@tangle-network/agent-app 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{mcp-eZCmkgCF.d.ts → auth-BlS9GWfL.d.ts} +1 -51
- package/dist/chunk-KOG473C4.js +132 -0
- package/dist/chunk-KOG473C4.js.map +1 -0
- package/dist/design-canvas/index.d.ts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +116 -116
- package/dist/mcp-BShTlESm.d.ts +54 -0
- package/dist/model-resolution/index.d.ts +78 -0
- package/dist/model-resolution/index.js +76 -0
- package/dist/model-resolution/index.js.map +1 -0
- package/dist/profile/index.d.ts +149 -0
- package/dist/profile/index.js +75 -0
- package/dist/profile/index.js.map +1 -0
- package/dist/prompt/index.d.ts +77 -0
- package/dist/prompt/index.js +22 -0
- package/dist/prompt/index.js.map +1 -0
- package/dist/run/index.d.ts +64 -0
- package/dist/run/index.js +30 -0
- package/dist/run/index.js.map +1 -0
- package/dist/runtime/index.d.ts +2 -1
- package/dist/sandbox/index.d.ts +146 -0
- package/dist/sandbox/index.js +304 -0
- package/dist/sandbox/index.js.map +1 -0
- package/dist/sequences/index.d.ts +2 -1
- package/dist/skills/index.js +7 -123
- package/dist/skills/index.js.map +1 -1
- package/dist/tools/index.d.ts +3 -2
- package/package.json +26 -1
|
@@ -59,54 +59,4 @@ declare function authenticateToolRequest(request: Request, opts: AuthenticateOpt
|
|
|
59
59
|
* aliases (`args` / `arguments`) or a bare body. Returns null on non-JSON. */
|
|
60
60
|
declare function readToolArgs<T>(request: Request): Promise<T | null>;
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
* at these paths (or supplies its own via {@link BuildMcpServerOptions.paths}). */
|
|
64
|
-
declare const DEFAULT_APP_TOOL_PATHS: Record<AppToolName, string>;
|
|
65
|
-
/** The portable MCP server entry the sandbox SDK accepts (transport + url +
|
|
66
|
-
* headers). Matches `AgentProfileMcpServer` structurally without importing the
|
|
67
|
-
* sandbox SDK — products spread it into their profile's `mcp` map. */
|
|
68
|
-
interface AppToolMcpServer {
|
|
69
|
-
transport: 'http';
|
|
70
|
-
url: string;
|
|
71
|
-
headers: Record<string, string>;
|
|
72
|
-
enabled: true;
|
|
73
|
-
metadata: {
|
|
74
|
-
description: string;
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
interface BuildHttpMcpServerOptions {
|
|
78
|
-
/** Route path on the app the sandbox POSTs to (e.g. `/api/tools/propose`). */
|
|
79
|
-
path: string;
|
|
80
|
-
/** App base URL the sandbox reaches back to (no trailing slash required). */
|
|
81
|
-
baseUrl: string;
|
|
82
|
-
/** Per-user capability token, baked into the Authorization header. */
|
|
83
|
-
token: string;
|
|
84
|
-
ctx: AppToolContext;
|
|
85
|
-
/** Tool description the model sees. */
|
|
86
|
-
description: string;
|
|
87
|
-
headerNames?: ToolHeaderNames;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Build ONE HTTP MCP server entry — the generic agent→app bridge. The
|
|
91
|
-
* capability token + the user/workspace/thread ids ride in server-set headers
|
|
92
|
-
* (never tool args), so the model can't forge identity or target another
|
|
93
|
-
* workspace. Workspace/thread headers are omitted when their `ctx` value is
|
|
94
|
-
* empty/null (e.g. an integration-invoke bridge that's user-scoped only). Used
|
|
95
|
-
* directly for non-app-tool bridges (integration_invoke) and via
|
|
96
|
-
* {@link buildAppToolMcpServer} for the four app tools.
|
|
97
|
-
*/
|
|
98
|
-
declare function buildHttpMcpServer(opts: BuildHttpMcpServerOptions): AppToolMcpServer;
|
|
99
|
-
interface BuildMcpServerOptions {
|
|
100
|
-
tool: AppToolName;
|
|
101
|
-
baseUrl: string;
|
|
102
|
-
token: string;
|
|
103
|
-
ctx: AppToolContext;
|
|
104
|
-
description: string;
|
|
105
|
-
headerNames?: ToolHeaderNames;
|
|
106
|
-
paths?: Partial<Record<AppToolName, string>>;
|
|
107
|
-
}
|
|
108
|
-
/** Build one of the four app-tool MCP servers — a thin wrapper over
|
|
109
|
-
* {@link buildHttpMcpServer} that maps the tool name to its route path. */
|
|
110
|
-
declare function buildAppToolMcpServer(opts: BuildMcpServerOptions): AppToolMcpServer;
|
|
111
|
-
|
|
112
|
-
export { APP_TOOL_NAMES as A, type BuildHttpMcpServerOptions as B, DEFAULT_APP_TOOL_PATHS as D, type OpenAIFunctionTool as O, type ToolAuthResult as T, type AppToolMcpServer as a, type AppToolName as b, type AuthenticateOptions as c, type BuildMcpServerOptions as d, DEFAULT_HEADER_NAMES as e, type ToolHeaderNames as f, authenticateToolRequest as g, buildAppToolMcpServer as h, buildAppToolOpenAITools as i, buildHttpMcpServer as j, isAppToolName as k, readToolArgs as r };
|
|
62
|
+
export { APP_TOOL_NAMES as A, DEFAULT_HEADER_NAMES as D, type OpenAIFunctionTool as O, type ToolAuthResult as T, type AppToolName as a, type AuthenticateOptions as b, type ToolHeaderNames as c, authenticateToolRequest as d, buildAppToolOpenAITools as e, isAppToolName as i, readToolArgs as r };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// src/skills/index.ts
|
|
2
|
+
function inlineResource(name, content) {
|
|
3
|
+
return { kind: "inline", name, content };
|
|
4
|
+
}
|
|
5
|
+
function skillMountPath(id) {
|
|
6
|
+
return `~/.claude/skills/${id}/SKILL.md`;
|
|
7
|
+
}
|
|
8
|
+
function normalizeKey(key, anchor) {
|
|
9
|
+
const marker = `${anchor}/`;
|
|
10
|
+
const at = key.lastIndexOf(marker);
|
|
11
|
+
if (at >= 0) return key.slice(at);
|
|
12
|
+
return key.startsWith("./") ? key.slice(2) : key;
|
|
13
|
+
}
|
|
14
|
+
function toCorpusId(normalizedKey, anchor) {
|
|
15
|
+
const nested = normalizedKey.match(new RegExp(`${anchor}/([^/]+)/SKILL\\.md$`));
|
|
16
|
+
if (nested) return nested[1];
|
|
17
|
+
const flat = normalizedKey.match(new RegExp(`${anchor}/(.+)\\.md$`));
|
|
18
|
+
if (flat) return flat[1];
|
|
19
|
+
return normalizedKey;
|
|
20
|
+
}
|
|
21
|
+
function nodeBuiltins() {
|
|
22
|
+
const getBuiltin = globalThis.process?.getBuiltinModule;
|
|
23
|
+
if (typeof getBuiltin !== "function") return void 0;
|
|
24
|
+
return {
|
|
25
|
+
fs: getBuiltin("node:fs"),
|
|
26
|
+
path: getBuiltin("node:path"),
|
|
27
|
+
url: getBuiltin("node:url")
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function fsWalkFlat(builtins, root) {
|
|
31
|
+
const { fs, path } = builtins;
|
|
32
|
+
const out = {};
|
|
33
|
+
if (!fs.existsSync(root)) return out;
|
|
34
|
+
const walk = (dir) => {
|
|
35
|
+
let entries;
|
|
36
|
+
try {
|
|
37
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
38
|
+
} catch {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
for (const entry of entries) {
|
|
42
|
+
if (entry.name.startsWith(".")) continue;
|
|
43
|
+
const full = path.join(dir, entry.name);
|
|
44
|
+
if (entry.isDirectory()) walk(full);
|
|
45
|
+
else if (entry.isFile() && entry.name.endsWith(".md")) out[full] = fs.readFileSync(full, "utf8");
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
walk(root);
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
51
|
+
function fsWalkNested(builtins, root) {
|
|
52
|
+
const { fs, path } = builtins;
|
|
53
|
+
const out = {};
|
|
54
|
+
if (!fs.existsSync(root)) return out;
|
|
55
|
+
let entries;
|
|
56
|
+
try {
|
|
57
|
+
entries = fs.readdirSync(root, { withFileTypes: true });
|
|
58
|
+
} catch {
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
for (const entry of entries) {
|
|
62
|
+
if (!entry.isDirectory()) continue;
|
|
63
|
+
const skillFile = path.join(root, entry.name, "SKILL.md");
|
|
64
|
+
if (!fs.existsSync(skillFile)) continue;
|
|
65
|
+
out[skillFile] = fs.readFileSync(skillFile, "utf8");
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
function resolveFsBase(builtins, fsBaseDir, importMetaUrl) {
|
|
70
|
+
const { path, url } = builtins;
|
|
71
|
+
if (path.isAbsolute(fsBaseDir)) return fsBaseDir;
|
|
72
|
+
const here = importMetaUrl ? path.dirname(url.fileURLToPath(importMetaUrl)) : process.cwd();
|
|
73
|
+
return path.join(here, fsBaseDir);
|
|
74
|
+
}
|
|
75
|
+
function loadMarkdownCorpus(options, importMetaUrl) {
|
|
76
|
+
const { anchor, globModules, fsBaseDir, fsLayout = "flat", skip } = options;
|
|
77
|
+
let modules;
|
|
78
|
+
let source;
|
|
79
|
+
if (globModules && Object.keys(globModules).length > 0) {
|
|
80
|
+
modules = globModules;
|
|
81
|
+
source = "vite";
|
|
82
|
+
} else {
|
|
83
|
+
const builtins = nodeBuiltins();
|
|
84
|
+
if (builtins && fsBaseDir) {
|
|
85
|
+
const root = resolveFsBase(builtins, fsBaseDir, importMetaUrl);
|
|
86
|
+
modules = fsLayout === "nested" ? fsWalkNested(builtins, root) : fsWalkFlat(builtins, root);
|
|
87
|
+
source = Object.keys(modules).length > 0 ? "fs" : "empty";
|
|
88
|
+
} else {
|
|
89
|
+
modules = {};
|
|
90
|
+
source = "empty";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const entries = [];
|
|
94
|
+
for (const [rawKey, content] of Object.entries(modules)) {
|
|
95
|
+
if (typeof content !== "string") continue;
|
|
96
|
+
const key = normalizeKey(rawKey, anchor);
|
|
97
|
+
if (skip && skip(key)) continue;
|
|
98
|
+
entries.push({ id: toCorpusId(key, anchor), key, content });
|
|
99
|
+
}
|
|
100
|
+
entries.sort((a, b) => a.id.localeCompare(b.id));
|
|
101
|
+
return { source, entries };
|
|
102
|
+
}
|
|
103
|
+
function corpusSkills(corpus, anchor) {
|
|
104
|
+
return corpus.map(
|
|
105
|
+
(entry) => ({
|
|
106
|
+
path: `${anchor}/${entry.id}.md`,
|
|
107
|
+
resource: inlineResource(`${anchor}-${entry.id}`, entry.content)
|
|
108
|
+
})
|
|
109
|
+
).sort((a, b) => a.path.localeCompare(b.path));
|
|
110
|
+
}
|
|
111
|
+
function registrySkills(registry, tier = "free") {
|
|
112
|
+
return registry.filter((s) => s.tier === tier).map(
|
|
113
|
+
(s) => ({
|
|
114
|
+
path: skillMountPath(s.id),
|
|
115
|
+
resource: inlineResource(s.id, s.skillMd)
|
|
116
|
+
})
|
|
117
|
+
).sort((a, b) => a.path.localeCompare(b.path));
|
|
118
|
+
}
|
|
119
|
+
function composeShellResources(input) {
|
|
120
|
+
const { skills = [], knowledge = [], evolvable = [], registry = [], predicate } = input;
|
|
121
|
+
const composed = [...skills, ...knowledge, ...evolvable, ...registry];
|
|
122
|
+
return predicate ? composed.filter(predicate) : composed;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export {
|
|
126
|
+
skillMountPath,
|
|
127
|
+
loadMarkdownCorpus,
|
|
128
|
+
corpusSkills,
|
|
129
|
+
registrySkills,
|
|
130
|
+
composeShellResources
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=chunk-KOG473C4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/skills/index.ts"],"sourcesContent":["/**\n * Unified skill + corpus mounter for agent products.\n *\n * Every agent product hand-rolls the same two file-mount systems and then\n * drifts on the seams between them. (1) An ALWAYS-MOUNTED markdown corpus —\n * (`skills/<slug>/SKILL.md`, `doctrine` and `knowledge` markdown trees) — discovered\n * by a Vite `?raw` glob in the Worker bundle and by Node `fs` under the eval\n * CLI, then projected into `resources.files`. (2) A TIER-GATED installable\n * registry — a hand-authored array of `SkillEntry` whose free tier mounts at\n * the harness skill-discovery path and whose paid tier is installed on demand.\n * Both ride the same `resources.files` channel but use different provenance\n * (file-backed vs inline), different mount paths (relative corpus path vs\n * `~/.claude/skills/<id>/SKILL.md`), and different selection rules. This module\n * makes both DATA: a corpus loader that accepts a Vite glob-result map (or an\n * fs fallback), a registry adapter that tier-gates, and a single\n * `composeShellResources` that projects either onto the SDK file-mount shape.\n *\n * Substrate-free over storage, exact over the SDK boundary: the only inbound\n * seam is the glob-result map the consumer passes in (its call site keeps the\n * literal `import.meta.glob` Vite must static-analyze); the only outbound seam\n * is `@tangle-network/sandbox`'s `AgentProfileFileMount[]`, the exact shape the\n * agent profile's `resources.files` consumes. Node builtins are resolved lazily\n * via `process.getBuiltinModule` so a static `node:*` import never reaches the\n * Vite SSR bundle.\n */\n\nimport type { AgentProfileFileMount, AgentProfileResourceRef } from '@tangle-network/sandbox'\n\n/** Construct the inline arm of the SDK's `AgentProfileResourceRef`. Inlined here\n * so this leaf subpath stays type-only over `@tangle-network/sandbox` — it\n * carries no runtime dependency on the SDK, just its file-mount type contract. */\nfunction inlineResource(name: string, content: string): AgentProfileResourceRef {\n return { kind: 'inline', name, content }\n}\n\n/** A Vite eager `?raw` glob result: glob key -> raw file body. The consumer\n * produces this by calling `import.meta.glob('<lit>', { eager: true, query:\n * '?raw', import: 'default' })` at its own call site — the literal must stay\n * literal so Vite can static-analyze it; passing the result here keeps that\n * constraint at the edge and the loader substrate-free. */\nexport type GlobModules = Record<string, string>\n\n/** One markdown document discovered from the corpus. */\nexport interface CorpusEntry {\n /** Slug derived from the glob key (folder slug for `SKILL.md` layouts, or the\n * normalized relative path for flat `*.md` layouts). */\n id: string\n /** Glob/fs key the entry was loaded from, normalized to a stable relative\n * form (leading `./` and absolute prefixes stripped). */\n key: string\n /** Raw markdown body (including any frontmatter). */\n content: string\n}\n\n/** A hand-authored, tier-gated installable skill. Mirrors the per-product\n * registry entry (gtm/insurance `SkillEntry`); the runtime's certified `skill`\n * artifact kind is unrelated. `skillMd` is the inline body — file provenance\n * does not apply to the registry. */\nexport interface SkillEntry {\n id: string\n name: string\n description: string\n author?: { name: string; url?: string }\n source?: string\n category?: string\n tags?: string[]\n /** Gate keyword. `composeShellResources`/`registrySkills` treat `free` as\n * always-mounted; everything else is install-on-demand. */\n tier: string\n skillMd: string\n}\n\n/** Harness skill-discovery path the Claude Code / OpenCode backend reads\n * natively. The registry mounts here; the corpus mounts at its relative path. */\nexport function skillMountPath(id: string): string {\n return `~/.claude/skills/${id}/SKILL.md`\n}\n\n/** Strip a glob/fs key down to a stable relative form: drop a leading `./`,\n * and for an absolute fs path keep only the tail from the last anchor segment\n * the pattern implies. We normalize on the trailing `<dir>/.../*.md` so the\n * Vite key (`./skills/x/SKILL.md`) and the fs key (`/abs/.../skills/x/SKILL.md`)\n * collapse to the same value. */\nfunction normalizeKey(key: string, anchor: string): string {\n const marker = `${anchor}/`\n const at = key.lastIndexOf(marker)\n if (at >= 0) return key.slice(at)\n return key.startsWith('./') ? key.slice(2) : key\n}\n\n/** Folder-slug for a `<anchor>/<slug>/SKILL.md` layout; falls back to the\n * normalized key (sans `<anchor>/` prefix, sans `.md`) for flat layouts. */\nfunction toCorpusId(normalizedKey: string, anchor: string): string {\n const nested = normalizedKey.match(new RegExp(`${anchor}/([^/]+)/SKILL\\\\.md$`))\n if (nested) return nested[1]!\n const flat = normalizedKey.match(new RegExp(`${anchor}/(.+)\\\\.md$`))\n if (flat) return flat[1]!\n return normalizedKey\n}\n\n/** Resolve Node builtins lazily. `process.getBuiltinModule` (Node 22+) is\n * absent in workerd, so this returns undefined there and the fs path is never\n * taken — Workers always reach the loader through the Vite glob map. A static\n * `import 'node:fs'` would break Vite SSR bundling in the consumer apps, so it\n * is deliberately avoided. */\nfunction nodeBuiltins():\n | { fs: typeof import('node:fs'); path: typeof import('node:path'); url: typeof import('node:url') }\n | undefined {\n const getBuiltin = (globalThis as { process?: { getBuiltinModule?: (id: string) => unknown } })\n .process?.getBuiltinModule\n if (typeof getBuiltin !== 'function') return undefined\n return {\n fs: getBuiltin('node:fs') as typeof import('node:fs'),\n path: getBuiltin('node:path') as typeof import('node:path'),\n url: getBuiltin('node:url') as typeof import('node:url'),\n }\n}\n\n/** Options for {@link loadMarkdownCorpus}. */\nexport interface LoadCorpusOptions {\n /** The anchor folder name that appears in both glob keys and fs paths\n * (`skills`, `doctrine`, `knowledge`). Used to normalize keys + derive ids. */\n anchor: string\n /** Vite glob-result map. When present and non-empty it is authoritative and\n * the fs path is skipped. Omit it (or pass an empty map) only outside Vite. */\n globModules?: GlobModules\n /** Absolute or `import.meta.url`-relative base dir the fs fallback walks when\n * `globModules` is empty. Required for the fs path to run; without it the fs\n * fallback returns no entries (Workers never need it). */\n fsBaseDir?: string\n /** Walk strategy for the fs fallback. `nested` finds `<dir>/<slug>/SKILL.md`\n * one level deep; `flat` recurses for every `*.md`. Default: `flat`. */\n fsLayout?: 'nested' | 'flat'\n /** Drop an entry by its normalized key after load. Covers the per-product\n * skip lists (corpus index/log files, scaffold templates, allow-lists). */\n skip?: (normalizedKey: string) => boolean\n}\n\n/** Outcome of {@link loadMarkdownCorpus}: the entries plus which path produced\n * them, so a caller can fail loud when both are empty rather than silently\n * mounting nothing. */\nexport interface CorpusLoadResult {\n source: 'vite' | 'fs' | 'empty'\n entries: CorpusEntry[]\n}\n\nfunction fsWalkFlat(\n builtins: NonNullable<ReturnType<typeof nodeBuiltins>>,\n root: string,\n): GlobModules {\n const { fs, path } = builtins\n const out: GlobModules = {}\n if (!fs.existsSync(root)) return out\n const walk = (dir: string) => {\n let entries: import('node:fs').Dirent[]\n try {\n entries = fs.readdirSync(dir, { withFileTypes: true })\n } catch {\n return\n }\n for (const entry of entries) {\n if (entry.name.startsWith('.')) continue\n const full = path.join(dir, entry.name)\n if (entry.isDirectory()) walk(full)\n else if (entry.isFile() && entry.name.endsWith('.md')) out[full] = fs.readFileSync(full, 'utf8')\n }\n }\n walk(root)\n return out\n}\n\nfunction fsWalkNested(\n builtins: NonNullable<ReturnType<typeof nodeBuiltins>>,\n root: string,\n): GlobModules {\n const { fs, path } = builtins\n const out: GlobModules = {}\n if (!fs.existsSync(root)) return out\n let entries: import('node:fs').Dirent[]\n try {\n entries = fs.readdirSync(root, { withFileTypes: true })\n } catch {\n return out\n }\n for (const entry of entries) {\n if (!entry.isDirectory()) continue\n const skillFile = path.join(root, entry.name, 'SKILL.md')\n if (!fs.existsSync(skillFile)) continue\n out[skillFile] = fs.readFileSync(skillFile, 'utf8')\n }\n return out\n}\n\n/** Resolve `fsBaseDir` against `import.meta.url` when relative-looking, so a\n * consumer can pass a bare folder name (`'skills'`) and have it land beside\n * the calling module. Absolute paths pass through. */\nfunction resolveFsBase(\n builtins: NonNullable<ReturnType<typeof nodeBuiltins>>,\n fsBaseDir: string,\n importMetaUrl?: string,\n): string {\n const { path, url } = builtins\n if (path.isAbsolute(fsBaseDir)) return fsBaseDir\n const here = importMetaUrl\n ? path.dirname(url.fileURLToPath(importMetaUrl))\n : process.cwd()\n return path.join(here, fsBaseDir)\n}\n\n/**\n * Load a markdown corpus, preferring a Vite glob-result map and falling back to\n * a Node fs walk. Selection is by non-empty glob result — never an env flag.\n * Entries are normalized, optionally skip-filtered, and sorted by id for\n * determinism. The `import.meta.glob` literal stays at the CONSUMER call site\n * (passed in as `globModules`); this loader never constructs a glob.\n */\nexport function loadMarkdownCorpus(\n options: LoadCorpusOptions,\n importMetaUrl?: string,\n): CorpusLoadResult {\n const { anchor, globModules, fsBaseDir, fsLayout = 'flat', skip } = options\n\n let modules: GlobModules\n let source: CorpusLoadResult['source']\n if (globModules && Object.keys(globModules).length > 0) {\n modules = globModules\n source = 'vite'\n } else {\n const builtins = nodeBuiltins()\n if (builtins && fsBaseDir) {\n const root = resolveFsBase(builtins, fsBaseDir, importMetaUrl)\n modules = fsLayout === 'nested' ? fsWalkNested(builtins, root) : fsWalkFlat(builtins, root)\n source = Object.keys(modules).length > 0 ? 'fs' : 'empty'\n } else {\n modules = {}\n source = 'empty'\n }\n }\n\n const entries: CorpusEntry[] = []\n for (const [rawKey, content] of Object.entries(modules)) {\n if (typeof content !== 'string') continue\n const key = normalizeKey(rawKey, anchor)\n if (skip && skip(key)) continue\n entries.push({ id: toCorpusId(key, anchor), key, content })\n }\n entries.sort((a, b) => a.id.localeCompare(b.id))\n return { source, entries }\n}\n\n/** Project corpus entries onto SDK file mounts at a relative path under\n * `<anchor>/`. Always-mounted: the corpus is the agent's baseline knowledge. */\nexport function corpusSkills(corpus: CorpusEntry[], anchor: string): AgentProfileFileMount[] {\n return corpus\n .map(\n (entry) =>\n ({\n path: `${anchor}/${entry.id}.md`,\n resource: inlineResource(`${anchor}-${entry.id}`, entry.content),\n }) satisfies AgentProfileFileMount,\n )\n .sort((a, b) => a.path.localeCompare(b.path))\n}\n\n/** Project the registry's free-tier (or `tier`-matched) entries onto SDK file\n * mounts at the harness skill-discovery path. Tier-gating is the registry's\n * only selection rule — paid skills are installed on demand, not at boot. */\nexport function registrySkills(\n registry: SkillEntry[],\n tier: string = 'free',\n): AgentProfileFileMount[] {\n return registry\n .filter((s) => s.tier === tier)\n .map(\n (s) =>\n ({\n path: skillMountPath(s.id),\n resource: inlineResource(s.id, s.skillMd),\n }) satisfies AgentProfileFileMount,\n )\n .sort((a, b) => a.path.localeCompare(b.path))\n}\n\n/** Inputs to {@link composeShellResources}. Each channel is optional so a\n * product mounts only the systems it has — corpus-only, registry-only, or\n * both — without conflating them. */\nexport interface ComposeShellResourcesInput {\n /** Corpus mounts (always-mounted baseline). Pass the result of\n * {@link corpusSkills}, or a hand-built mount list. */\n skills?: AgentProfileFileMount[]\n /** Knowledge-corpus mounts (a second always-mounted corpus, e.g. a domain\n * knowledge pack distinct from the skills corpus). */\n knowledge?: AgentProfileFileMount[]\n /** Evolvable / learned-guidance mounts (single-file corpora). */\n evolvable?: AgentProfileFileMount[]\n /** Registry mounts (tier-gated). Pass the result of {@link registrySkills}. */\n registry?: AgentProfileFileMount[]\n /** Final skip filter applied to the composed mount list by mount `path`. */\n predicate?: (mount: AgentProfileFileMount) => boolean\n}\n\n/**\n * Compose every mount channel into one `resources.files`-ready array. Corpus\n * channels come first (baseline), the tier-gated registry last (so a registry\n * entry can override a corpus entry that mounts at the same path). The result\n * is exactly `AgentProfileFileMount[]` — assign it straight into\n * `profile.resources.files` with no cast.\n */\nexport function composeShellResources(input: ComposeShellResourcesInput): AgentProfileFileMount[] {\n const { skills = [], knowledge = [], evolvable = [], registry = [], predicate } = input\n const composed = [...skills, ...knowledge, ...evolvable, ...registry]\n return predicate ? composed.filter(predicate) : composed\n}\n"],"mappings":"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","names":[]}
|
|
@@ -5,7 +5,8 @@ export { A as AddElementOperation, a as AddPageOperation, b as ApplyDataOperatio
|
|
|
5
5
|
import { d as SceneStore, N as NewSceneDecision, a as SceneDocumentRecord } from '../store-CUStmtdH.js';
|
|
6
6
|
export { S as SceneDecision, b as SceneExportFormat, c as SceneExportRecord, e as SceneStoreScope } from '../store-CUStmtdH.js';
|
|
7
7
|
import { c as McpToolDefinition } from '../mcp-rpc-DLw_r9PQ.js';
|
|
8
|
-
import {
|
|
8
|
+
import { c as ToolHeaderNames } from '../auth-BlS9GWfL.js';
|
|
9
|
+
import { A as AppToolMcpServer } from '../mcp-BShTlESm.js';
|
|
9
10
|
import { b as AppToolContext } from '../types-2rOJo8Hc.js';
|
|
10
11
|
|
|
11
12
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { AppToolRuntimeExecutor, CapabilityTokenOptions, DispatchOptions, ExpiringCapabilityTokenOptions, HandleToolRequestOptions, ResolveToolCapabilitiesOptions, ResolvedToolCapabilities, RuntimeExecutorOptions, ToolCapability, ToolInputError, createAppToolRuntimeExecutor, createCapabilityToken, createExpiringCapabilityToken, dispatchAppTool, handleAppToolRequest, outcomeStatus, resolveToolCapabilities, restrictTaxonomy, verifyCapabilityToken, verifyExpiringCapabilityToken } from './tools/index.js';
|
|
2
|
-
export { A as APP_TOOL_NAMES, a as
|
|
2
|
+
export { A as APP_TOOL_NAMES, a as AppToolName, b as AuthenticateOptions, D as DEFAULT_HEADER_NAMES, O as OpenAIFunctionTool, T as ToolAuthResult, c as ToolHeaderNames, d as authenticateToolRequest, e as buildAppToolOpenAITools, i as isAppToolName, r as readToolArgs } from './auth-BlS9GWfL.js';
|
|
3
|
+
export { A as AppToolMcpServer, B as BuildHttpMcpServerOptions, a as BuildMcpServerOptions, D as DEFAULT_APP_TOOL_PATHS, b as buildAppToolMcpServer, c as buildHttpMcpServer } from './mcp-BShTlESm.js';
|
|
3
4
|
export { C as CreateMcpToolHandlerOptions, M as MCP_PROTOCOL_VERSIONS, a as McpProtocolVersion, b as McpServerInfo, c as McpToolDefinition, d as createMcpToolHandler } from './mcp-rpc-DLw_r9PQ.js';
|
|
4
5
|
export { A as AddCitationArgs, a as AddCitationResult, b as AppToolContext, c as AppToolHandlers, d as AppToolOutcome, e as AppToolProducedEvent, f as AppToolTaxonomy, R as RenderUiArgs, g as RenderUiResult, S as ScheduleFollowupArgs, h as ScheduleFollowupResult, i as SubmitProposalArgs, j as SubmitProposalResult } from './types-2rOJo8Hc.js';
|
|
5
6
|
export { BuildDelegationOptions, DELEGATION_MCP_SERVER_KEY, DELEGATION_TOOLS, DelegationMcpServer, buildDelegationMcpServer, delegationMcpForConfig } from './delegation/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,58 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ApprovalEventSchema,
|
|
3
|
-
BrandTokensSchema,
|
|
4
|
-
ConversionMetricsSchema,
|
|
5
|
-
CopyContentSchema,
|
|
6
|
-
EmailContentSchema,
|
|
7
|
-
ImageContentSchema,
|
|
8
|
-
VideoContentSchema,
|
|
9
|
-
parseAssetSpec,
|
|
10
|
-
safeParseAssetSpec
|
|
11
|
-
} from "./chunk-5PTGEJZL.js";
|
|
12
|
-
import {
|
|
13
|
-
DEFAULT_SEQUENCES_MCP_DESCRIPTION,
|
|
14
|
-
MAX_CAPTION_BATCH,
|
|
15
|
-
SEQUENCES_MCP_PROTOCOL_VERSIONS,
|
|
16
|
-
SEQUENCE_EXPORT_FORMATS,
|
|
17
|
-
SEQUENCE_MCP_TOOLS,
|
|
18
|
-
SEQUENCE_MEDIA_KINDS,
|
|
19
|
-
SEQUENCE_OPERATION_TYPES,
|
|
20
|
-
SEQUENCE_TRACK_KINDS,
|
|
21
|
-
applySequenceOperation,
|
|
22
|
-
applySequenceOperations,
|
|
23
|
-
assertSequenceMediaUrl,
|
|
24
|
-
buildCaptionChunks,
|
|
25
|
-
buildContactSheetManifest,
|
|
26
|
-
buildEdl,
|
|
27
|
-
buildOtio,
|
|
28
|
-
buildSequencesMcpServerEntry,
|
|
29
|
-
buildSrt,
|
|
30
|
-
buildVtt,
|
|
31
|
-
captionCoverage,
|
|
32
|
-
captionTrackNameForLanguage,
|
|
33
|
-
createSequencesMcpHandler,
|
|
34
|
-
findSequenceMcpTool,
|
|
35
|
-
lastClipEndFrame,
|
|
36
|
-
normalizeLanguageTag,
|
|
37
|
-
parseSequenceOperations,
|
|
38
|
-
planLanguageFanout,
|
|
39
|
-
resolveCaptionPlacement,
|
|
40
|
-
resolveCaptionTarget,
|
|
41
|
-
resolvePlaceClipTrack,
|
|
42
|
-
validateAddCaption,
|
|
43
|
-
validateCreateTrack,
|
|
44
|
-
validateDeleteClip,
|
|
45
|
-
validateExtendSequence,
|
|
46
|
-
validateMoveClip,
|
|
47
|
-
validatePlaceClip,
|
|
48
|
-
validateQueueExport,
|
|
49
|
-
validateSequenceOperation,
|
|
50
|
-
validateSequenceOperations,
|
|
51
|
-
validateSetClipDisabled,
|
|
52
|
-
validateSetClipText,
|
|
53
|
-
validateSplitClip,
|
|
54
|
-
validateTrimClip
|
|
55
|
-
} from "./chunk-6UOE5CTA.js";
|
|
56
1
|
import {
|
|
57
2
|
CANVAS_ELEMENT_KINDS,
|
|
58
3
|
CANVAS_MCP_TOOLS,
|
|
@@ -101,57 +46,6 @@ import {
|
|
|
101
46
|
validateSceneOperations,
|
|
102
47
|
validateSlotValue
|
|
103
48
|
} from "./chunk-JZAJE3JL.js";
|
|
104
|
-
import {
|
|
105
|
-
MIN_SEQUENCE_CLIP_FRAMES,
|
|
106
|
-
assertClipFitsSequence,
|
|
107
|
-
chooseCaptionPlacement,
|
|
108
|
-
clampClipDuration,
|
|
109
|
-
clampClipStart,
|
|
110
|
-
formatSeconds,
|
|
111
|
-
formatTimecode,
|
|
112
|
-
framesToSeconds,
|
|
113
|
-
secondsToFrames,
|
|
114
|
-
snapshotFrame,
|
|
115
|
-
trackIntervals
|
|
116
|
-
} from "./chunk-ZYBWGSAZ.js";
|
|
117
|
-
import {
|
|
118
|
-
HubExecClient,
|
|
119
|
-
invokeIntegrationHub,
|
|
120
|
-
resolveIntegrationAction
|
|
121
|
-
} from "./chunk-L2TG5DBW.js";
|
|
122
|
-
import {
|
|
123
|
-
DEFAULT_MISSION_STEP_KINDS,
|
|
124
|
-
MISSION_CONTROL_CHANNEL_ID,
|
|
125
|
-
MissionConcurrencyError,
|
|
126
|
-
RetryableStepError,
|
|
127
|
-
applyMissionEvent,
|
|
128
|
-
asMissionStreamEvent,
|
|
129
|
-
budgetGateProposalId,
|
|
130
|
-
buildAgentMissionPlan,
|
|
131
|
-
createInMemoryMissionStore,
|
|
132
|
-
createMissionEngine,
|
|
133
|
-
createMissionService,
|
|
134
|
-
isMissionStopRequested,
|
|
135
|
-
isMissionTerminal,
|
|
136
|
-
mergeMissionState,
|
|
137
|
-
noopEventSink,
|
|
138
|
-
parseMissionBlocks,
|
|
139
|
-
parseSessionStreamEnvelope,
|
|
140
|
-
reduceMissionEvents,
|
|
141
|
-
stepAgentActivity,
|
|
142
|
-
stepGateProposalId,
|
|
143
|
-
volumeGateProposalId
|
|
144
|
-
} from "./chunk-UDXMR3AD.js";
|
|
145
|
-
import {
|
|
146
|
-
addSecurityHeaders,
|
|
147
|
-
checkRateLimit,
|
|
148
|
-
clearCookieHeader,
|
|
149
|
-
extractRequestContext,
|
|
150
|
-
parseJsonObjectBody,
|
|
151
|
-
readCookieValue,
|
|
152
|
-
requireString,
|
|
153
|
-
serializeCookie
|
|
154
|
-
} from "./chunk-SCG5JJ4C.js";
|
|
155
49
|
import {
|
|
156
50
|
DEFAULT_REDACTION_PATTERNS,
|
|
157
51
|
buildRedactedDocument,
|
|
@@ -177,17 +71,73 @@ import {
|
|
|
177
71
|
stepActivityFlowTrace
|
|
178
72
|
} from "./chunk-AFDROJ64.js";
|
|
179
73
|
import {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
74
|
+
ApprovalEventSchema,
|
|
75
|
+
BrandTokensSchema,
|
|
76
|
+
ConversionMetricsSchema,
|
|
77
|
+
CopyContentSchema,
|
|
78
|
+
EmailContentSchema,
|
|
79
|
+
ImageContentSchema,
|
|
80
|
+
VideoContentSchema,
|
|
81
|
+
parseAssetSpec,
|
|
82
|
+
safeParseAssetSpec
|
|
83
|
+
} from "./chunk-5PTGEJZL.js";
|
|
184
84
|
import {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
85
|
+
DEFAULT_SEQUENCES_MCP_DESCRIPTION,
|
|
86
|
+
MAX_CAPTION_BATCH,
|
|
87
|
+
SEQUENCES_MCP_PROTOCOL_VERSIONS,
|
|
88
|
+
SEQUENCE_EXPORT_FORMATS,
|
|
89
|
+
SEQUENCE_MCP_TOOLS,
|
|
90
|
+
SEQUENCE_MEDIA_KINDS,
|
|
91
|
+
SEQUENCE_OPERATION_TYPES,
|
|
92
|
+
SEQUENCE_TRACK_KINDS,
|
|
93
|
+
applySequenceOperation,
|
|
94
|
+
applySequenceOperations,
|
|
95
|
+
assertSequenceMediaUrl,
|
|
96
|
+
buildCaptionChunks,
|
|
97
|
+
buildContactSheetManifest,
|
|
98
|
+
buildEdl,
|
|
99
|
+
buildOtio,
|
|
100
|
+
buildSequencesMcpServerEntry,
|
|
101
|
+
buildSrt,
|
|
102
|
+
buildVtt,
|
|
103
|
+
captionCoverage,
|
|
104
|
+
captionTrackNameForLanguage,
|
|
105
|
+
createSequencesMcpHandler,
|
|
106
|
+
findSequenceMcpTool,
|
|
107
|
+
lastClipEndFrame,
|
|
108
|
+
normalizeLanguageTag,
|
|
109
|
+
parseSequenceOperations,
|
|
110
|
+
planLanguageFanout,
|
|
111
|
+
resolveCaptionPlacement,
|
|
112
|
+
resolveCaptionTarget,
|
|
113
|
+
resolvePlaceClipTrack,
|
|
114
|
+
validateAddCaption,
|
|
115
|
+
validateCreateTrack,
|
|
116
|
+
validateDeleteClip,
|
|
117
|
+
validateExtendSequence,
|
|
118
|
+
validateMoveClip,
|
|
119
|
+
validatePlaceClip,
|
|
120
|
+
validateQueueExport,
|
|
121
|
+
validateSequenceOperation,
|
|
122
|
+
validateSequenceOperations,
|
|
123
|
+
validateSetClipDisabled,
|
|
124
|
+
validateSetClipText,
|
|
125
|
+
validateSplitClip,
|
|
126
|
+
validateTrimClip
|
|
127
|
+
} from "./chunk-6UOE5CTA.js";
|
|
128
|
+
import {
|
|
129
|
+
MIN_SEQUENCE_CLIP_FRAMES,
|
|
130
|
+
assertClipFitsSequence,
|
|
131
|
+
chooseCaptionPlacement,
|
|
132
|
+
clampClipDuration,
|
|
133
|
+
clampClipStart,
|
|
134
|
+
formatSeconds,
|
|
135
|
+
formatTimecode,
|
|
136
|
+
framesToSeconds,
|
|
137
|
+
secondsToFrames,
|
|
138
|
+
snapshotFrame,
|
|
139
|
+
trackIntervals
|
|
140
|
+
} from "./chunk-ZYBWGSAZ.js";
|
|
191
141
|
import {
|
|
192
142
|
agentAppConfigJsonSchema,
|
|
193
143
|
defineAgentApp
|
|
@@ -241,6 +191,56 @@ import {
|
|
|
241
191
|
resolveToolId,
|
|
242
192
|
resolveToolName
|
|
243
193
|
} from "./chunk-CPI3RILI.js";
|
|
194
|
+
import {
|
|
195
|
+
HubExecClient,
|
|
196
|
+
invokeIntegrationHub,
|
|
197
|
+
resolveIntegrationAction
|
|
198
|
+
} from "./chunk-L2TG5DBW.js";
|
|
199
|
+
import {
|
|
200
|
+
DEFAULT_MISSION_STEP_KINDS,
|
|
201
|
+
MISSION_CONTROL_CHANNEL_ID,
|
|
202
|
+
MissionConcurrencyError,
|
|
203
|
+
RetryableStepError,
|
|
204
|
+
applyMissionEvent,
|
|
205
|
+
asMissionStreamEvent,
|
|
206
|
+
budgetGateProposalId,
|
|
207
|
+
buildAgentMissionPlan,
|
|
208
|
+
createInMemoryMissionStore,
|
|
209
|
+
createMissionEngine,
|
|
210
|
+
createMissionService,
|
|
211
|
+
isMissionStopRequested,
|
|
212
|
+
isMissionTerminal,
|
|
213
|
+
mergeMissionState,
|
|
214
|
+
noopEventSink,
|
|
215
|
+
parseMissionBlocks,
|
|
216
|
+
parseSessionStreamEnvelope,
|
|
217
|
+
reduceMissionEvents,
|
|
218
|
+
stepAgentActivity,
|
|
219
|
+
stepGateProposalId,
|
|
220
|
+
volumeGateProposalId
|
|
221
|
+
} from "./chunk-UDXMR3AD.js";
|
|
222
|
+
import {
|
|
223
|
+
addSecurityHeaders,
|
|
224
|
+
checkRateLimit,
|
|
225
|
+
clearCookieHeader,
|
|
226
|
+
extractRequestContext,
|
|
227
|
+
parseJsonObjectBody,
|
|
228
|
+
readCookieValue,
|
|
229
|
+
requireString,
|
|
230
|
+
serializeCookie
|
|
231
|
+
} from "./chunk-SCG5JJ4C.js";
|
|
232
|
+
import {
|
|
233
|
+
createKnowledgeLoop,
|
|
234
|
+
createReviewerDecider,
|
|
235
|
+
reviewCandidate
|
|
236
|
+
} from "./chunk-EEPJGZJW.js";
|
|
237
|
+
import {
|
|
238
|
+
DEFAULT_HARNESS,
|
|
239
|
+
KNOWN_HARNESSES,
|
|
240
|
+
coerceHarness,
|
|
241
|
+
isHarness,
|
|
242
|
+
resolveSessionHarness
|
|
243
|
+
} from "./chunk-SD2H4FWY.js";
|
|
244
244
|
import {
|
|
245
245
|
createCapabilityToken,
|
|
246
246
|
createExpiringCapabilityToken,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { b as AppToolContext } from './types-2rOJo8Hc.js';
|
|
2
|
+
import { c as ToolHeaderNames, a as AppToolName } from './auth-BlS9GWfL.js';
|
|
3
|
+
|
|
4
|
+
/** Default route path each app tool is served at. A product mounts its routes
|
|
5
|
+
* at these paths (or supplies its own via {@link BuildMcpServerOptions.paths}). */
|
|
6
|
+
declare const DEFAULT_APP_TOOL_PATHS: Record<AppToolName, string>;
|
|
7
|
+
/** The portable MCP server entry the sandbox SDK accepts (transport + url +
|
|
8
|
+
* headers). Matches `AgentProfileMcpServer` structurally without importing the
|
|
9
|
+
* sandbox SDK — products spread it into their profile's `mcp` map. */
|
|
10
|
+
interface AppToolMcpServer {
|
|
11
|
+
transport: 'http';
|
|
12
|
+
url: string;
|
|
13
|
+
headers: Record<string, string>;
|
|
14
|
+
enabled: true;
|
|
15
|
+
metadata: {
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
interface BuildHttpMcpServerOptions {
|
|
20
|
+
/** Route path on the app the sandbox POSTs to (e.g. `/api/tools/propose`). */
|
|
21
|
+
path: string;
|
|
22
|
+
/** App base URL the sandbox reaches back to (no trailing slash required). */
|
|
23
|
+
baseUrl: string;
|
|
24
|
+
/** Per-user capability token, baked into the Authorization header. */
|
|
25
|
+
token: string;
|
|
26
|
+
ctx: AppToolContext;
|
|
27
|
+
/** Tool description the model sees. */
|
|
28
|
+
description: string;
|
|
29
|
+
headerNames?: ToolHeaderNames;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Build ONE HTTP MCP server entry — the generic agent→app bridge. The
|
|
33
|
+
* capability token + the user/workspace/thread ids ride in server-set headers
|
|
34
|
+
* (never tool args), so the model can't forge identity or target another
|
|
35
|
+
* workspace. Workspace/thread headers are omitted when their `ctx` value is
|
|
36
|
+
* empty/null (e.g. an integration-invoke bridge that's user-scoped only). Used
|
|
37
|
+
* directly for non-app-tool bridges (integration_invoke) and via
|
|
38
|
+
* {@link buildAppToolMcpServer} for the four app tools.
|
|
39
|
+
*/
|
|
40
|
+
declare function buildHttpMcpServer(opts: BuildHttpMcpServerOptions): AppToolMcpServer;
|
|
41
|
+
interface BuildMcpServerOptions {
|
|
42
|
+
tool: AppToolName;
|
|
43
|
+
baseUrl: string;
|
|
44
|
+
token: string;
|
|
45
|
+
ctx: AppToolContext;
|
|
46
|
+
description: string;
|
|
47
|
+
headerNames?: ToolHeaderNames;
|
|
48
|
+
paths?: Partial<Record<AppToolName, string>>;
|
|
49
|
+
}
|
|
50
|
+
/** Build one of the four app-tool MCP servers — a thin wrapper over
|
|
51
|
+
* {@link buildHttpMcpServer} that maps the tool name to its route path. */
|
|
52
|
+
declare function buildAppToolMcpServer(opts: BuildMcpServerOptions): AppToolMcpServer;
|
|
53
|
+
|
|
54
|
+
export { type AppToolMcpServer as A, type BuildHttpMcpServerOptions as B, DEFAULT_APP_TOOL_PATHS as D, type BuildMcpServerOptions as a, buildAppToolMcpServer as b, buildHttpMcpServer as c };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical chat-model resolution — identical across every agent app.
|
|
3
|
+
*
|
|
4
|
+
* The ONLY per-app inputs are DATA, never logic: the default model, the
|
|
5
|
+
* allowlist, the env value the deployment set, and the catalog-fetch loader.
|
|
6
|
+
* The logic is one precedence ladder + one fail-closed validator that every
|
|
7
|
+
* product uses the same way — there is no per-product variant, no env-var name
|
|
8
|
+
* baked in, and no backend dimension (router-vs-sandbox is the harness/dispatch
|
|
9
|
+
* concern, not model resolution; a sandbox's provider default lives in the
|
|
10
|
+
* sandbox subpath).
|
|
11
|
+
*
|
|
12
|
+
* - resolveChatModel: request > workspace > env > default. The product reads its
|
|
13
|
+
* own deploy env var and passes the VALUE as `envModel`; the shell knows no
|
|
14
|
+
* env-var names. Source is canonical: 'request' | 'workspace' | 'env' | 'default'.
|
|
15
|
+
* - validateChatModelId: fail-closed. Admit an id that is in the allowlist, or
|
|
16
|
+
* equals the operator-set env model, or is served by the live router catalog
|
|
17
|
+
* (exact, or a bare id resolved to its canonical id when the suffix is unique).
|
|
18
|
+
*/
|
|
19
|
+
/** The router /v1/models entry shape this module reads. Minimal on purpose. */
|
|
20
|
+
interface ModelInfo {
|
|
21
|
+
id: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
_provider?: string;
|
|
24
|
+
provider?: string;
|
|
25
|
+
}
|
|
26
|
+
type ChatModelSource = 'request' | 'workspace' | 'env' | 'default';
|
|
27
|
+
interface ResolvedChatModel {
|
|
28
|
+
model: string;
|
|
29
|
+
source: ChatModelSource;
|
|
30
|
+
}
|
|
31
|
+
interface ChatModelValidationSuccess {
|
|
32
|
+
succeeded: true;
|
|
33
|
+
value: string;
|
|
34
|
+
}
|
|
35
|
+
interface ChatModelValidationFailure {
|
|
36
|
+
succeeded: false;
|
|
37
|
+
error: string;
|
|
38
|
+
}
|
|
39
|
+
type ChatModelValidationResult = ChatModelValidationSuccess | ChatModelValidationFailure;
|
|
40
|
+
/** The catalog-fetch boundary: maps a router base URL to the raw model list. */
|
|
41
|
+
type LoadModels = (routerBaseUrl: string) => Promise<ModelInfo[]>;
|
|
42
|
+
interface ResolveChatModelInput {
|
|
43
|
+
/** Per-request override (highest precedence). */
|
|
44
|
+
requestModel?: string;
|
|
45
|
+
/** Persisted workspace-pinned model. */
|
|
46
|
+
workspaceModel?: string;
|
|
47
|
+
/** The value the deployment's model env var holds (the product reads its own
|
|
48
|
+
* var name and passes the value — the shell stays env-var-name agnostic). */
|
|
49
|
+
envModel?: string;
|
|
50
|
+
/** Final fallback (the product's default, typically profile.model.default). */
|
|
51
|
+
defaultModel: string;
|
|
52
|
+
}
|
|
53
|
+
/** Resolve the chat-turn model by the one canonical precedence. Blank values are
|
|
54
|
+
* treated as absent. */
|
|
55
|
+
declare function resolveChatModel(input: ResolveChatModelInput): ResolvedChatModel;
|
|
56
|
+
interface ValidateChatModelIdInput {
|
|
57
|
+
/** Ids accepted without a catalog round-trip (defaults + operator-trusted). */
|
|
58
|
+
allowlist?: Iterable<string>;
|
|
59
|
+
/** The operator-set env model value — always admitted (operator-trusted). */
|
|
60
|
+
envModel?: string;
|
|
61
|
+
/** Catalog loader; required to reach the catalog path. */
|
|
62
|
+
loadModels?: LoadModels;
|
|
63
|
+
/** Catalog endpoint base; required to reach the catalog path. */
|
|
64
|
+
routerBaseUrl?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Fail-closed model-id validation. Accepts an id only when it is well-formed AND
|
|
68
|
+
* (in the allowlist, or equals the operator-set env model, or served by the live
|
|
69
|
+
* catalog). A bare id (no provider prefix) resolves to its canonical id only when
|
|
70
|
+
* the suffix is unique across the catalog — an ambiguous suffix is rejected
|
|
71
|
+
* rather than silently assigned a provider.
|
|
72
|
+
*/
|
|
73
|
+
declare function validateChatModelId(modelId: unknown, input: ValidateChatModelIdInput): Promise<ChatModelValidationResult>;
|
|
74
|
+
declare function cleanModelId(value: unknown): string | undefined;
|
|
75
|
+
declare function isWellFormedModelId(modelId: string): boolean;
|
|
76
|
+
declare function catalogIdsForModel(model: ModelInfo): string[];
|
|
77
|
+
|
|
78
|
+
export { type ChatModelSource, type ChatModelValidationFailure, type ChatModelValidationResult, type ChatModelValidationSuccess, type LoadModels, type ModelInfo, type ResolveChatModelInput, type ResolvedChatModel, type ValidateChatModelIdInput, catalogIdsForModel, cleanModelId, isWellFormedModelId, resolveChatModel, validateChatModelId };
|