import type { Tools } from "./tools.js" /** A tool namespace with optional model-visible metadata. */ export type Namespace = { readonly _tag: "CodeModeNamespace" readonly description?: string readonly tools: Tools } /** Options for declaring one CodeMode namespace. */ export type Options = { readonly description?: string readonly tools: Tools } export const isNamespace = (value: Namespace | Tools): value is Namespace => Object.hasOwn(value, "_tag") && value._tag === "CodeModeNamespace" /** Declares a namespace when descriptions or other namespace metadata are needed. */ export const make = (options: Options): Namespace => ({ _tag: "CodeModeNamespace", ...(options.description === undefined ? {} : { description: options.description }), tools: options.tools, })