@yansirplus/cli 0.5.17 → 0.5.19
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/README.md +12 -6
- package/agent-catalog/agentOS/SKILL.md +22 -0
- package/agent-catalog/agentOS/references/agent/decision-graph.json +530 -0
- package/agent-catalog/agentOS/references/agent/errors.json +497 -0
- package/agent-catalog/agentOS/references/agent/invariant-matrix.json +337 -0
- package/agent-catalog/agentOS/references/agent/primitives.json +989 -0
- package/agent-catalog/agentOS/references/agent/recipes.json +109 -0
- package/agent-catalog/agentOS/references/agent/start-here.md +25 -0
- package/agent-catalog/agentOS/references/package-map.md +73 -0
- package/agent-catalog/agentOS/references/provenance.json +251 -0
- package/agent-catalog/agentOS/references/public-api/cli.md +20 -0
- package/agent-catalog/agentOS/references/public-api/client.md +90 -0
- package/agent-catalog/agentOS/references/public-api/core.md +1907 -0
- package/agent-catalog/agentOS/references/public-api/runtime.md +843 -0
- package/dist/build/agent-authoring/config.d.ts +20 -5
- package/dist/build/agent-authoring/config.js +132 -32
- package/dist/build/agent-authoring/manifest-compiler.d.ts +131 -2
- package/dist/build/agent-authoring/manifest-compiler.js +630 -8
- package/dist/build/agent-authoring/shared.d.ts +2 -0
- package/dist/build/agent-authoring/shared.js +2 -0
- package/dist/build/agent-authoring/static-target.d.ts +6 -3
- package/dist/build/agent-authoring/static-target.js +1900 -281
- package/dist/build/agent-authoring.d.ts +3 -3
- package/dist/build/agent-authoring.js +1 -1
- package/dist/build/build-cli.d.ts +1 -1
- package/dist/build/build-cli.js +1629 -26
- package/dist/check/algorithmic/client-boundary-checks.mjs +3 -34
- package/dist/check/algorithmic/convergence-smoke-checks.mjs +652 -6
- package/dist/check/algorithmic/distribution-checks.mjs +8 -7
- package/dist/check/algorithmic/package-boundary-checks.mjs +3 -2
- package/dist/check/algorithmic/repo-surface-checks.mjs +55 -1
- package/dist/check/algorithmic/static-target-checks.mjs +83 -5
- package/dist/check/algorithmic-checks.mjs +10 -17
- package/dist/check/default-gate.mjs +3 -3
- package/dist/check/effect-scan-gate.mjs +121 -0
- package/dist/check/package-graph.mjs +2 -32
- package/dist/consumer-overlay.mjs +1281 -0
- package/dist/lib/public-api-model.mjs +19 -0
- package/dist/lib/repo-source-files.mjs +26 -0
- package/dist/lib/ts-module-loader.mjs +44 -0
- package/dist/lib/workspace-manifest.mjs +77 -0
- package/dist/main.mjs +171 -21
- package/dist/release-status.mjs +515 -0
- package/package.json +8 -4
- package/dist/check/check-coverage.mjs +0 -231
- package/dist/generate/generate-agent-docs.mjs +0 -435
- package/dist/generate/generate-carrier-reference.mjs +0 -514
- package/dist/generate/generate-docs.mjs +0 -345
- package/dist/generate/generate-effect-skill-manifests.mjs +0 -193
- package/dist/generate/project-docs-site.mjs +0 -190
- package/dist/lib/boundary-rules.mjs +0 -63
- package/dist/lib/capability-routes.mjs +0 -354
- package/dist/lib/projection-sink.mjs +0 -113
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AgentManifest, ProviderResourceId, WorkspaceBindingRef, WorkspaceTopology } from "@yansirplus/core/runtime-protocol";
|
|
2
2
|
import { type DeploymentSpec, type HandlerKind } from "@yansirplus/core/runtime-protocol";
|
|
3
3
|
import { type WorkspaceToolName } from "@yansirplus/runtime";
|
|
4
|
-
import type { AgentManifestFactKey, AgentManifestOrigin, AuthoredAgentManifest, CompiledAgentManifest } from "./manifest-compiler.js";
|
|
4
|
+
import type { AgentManifestFactKey, AgentManifestOrigin, AuthoredAgentManifest, CompiledAgentChannel, CompiledAgentSchedule, CompiledAgentSkill, CompiledAgentWorkflow, CompiledAgentManifest } from "./manifest-compiler.js";
|
|
5
5
|
export declare const AGENTOS_CONFIG_PROFILE: {
|
|
6
6
|
readonly WORKSPACE_V1: "workspace@1";
|
|
7
7
|
readonly CHAT_V1: "chat@1";
|
|
@@ -9,6 +9,7 @@ export declare const AGENTOS_CONFIG_PROFILE: {
|
|
|
9
9
|
export type AgentOsConfigProfile = (typeof AGENTOS_CONFIG_PROFILE)[keyof typeof AGENTOS_CONFIG_PROFILE];
|
|
10
10
|
export declare const AGENTOS_CONFIG_TARGET: {
|
|
11
11
|
readonly CLOUDFLARE_DO_V1: "cloudflare-do@1";
|
|
12
|
+
readonly NODE_V1: "node@1";
|
|
12
13
|
};
|
|
13
14
|
export type AgentOsConfigTargetKind = (typeof AGENTOS_CONFIG_TARGET)[keyof typeof AGENTOS_CONFIG_TARGET];
|
|
14
15
|
export declare const AGENTOS_CONFIG_CLIENT: {
|
|
@@ -31,16 +32,22 @@ export interface AgentOsConfigCloudflareDoTarget {
|
|
|
31
32
|
readonly binding: string;
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
|
-
export
|
|
35
|
+
export interface AgentOsConfigNodeTarget {
|
|
36
|
+
readonly kind: typeof AGENTOS_CONFIG_TARGET.NODE_V1;
|
|
37
|
+
}
|
|
38
|
+
export type AgentOsConfigTarget = AgentOsConfigCloudflareDoTarget | AgentOsConfigNodeTarget;
|
|
35
39
|
export interface AgentOsConfigClient {
|
|
36
40
|
readonly kind: AgentOsConfigClientKind;
|
|
37
41
|
}
|
|
38
|
-
export interface
|
|
42
|
+
export interface AgentOsConfigLlmRouteBinding {
|
|
39
43
|
readonly route: AgentOsConfigLlmRoute;
|
|
40
44
|
readonly endpointRef: string;
|
|
41
45
|
readonly credentialRef: string;
|
|
42
46
|
readonly modelRef: string;
|
|
43
47
|
}
|
|
48
|
+
export interface AgentOsConfigLlm extends AgentOsConfigLlmRouteBinding {
|
|
49
|
+
readonly routes?: Readonly<Record<string, AgentOsConfigLlmRouteBinding>>;
|
|
50
|
+
}
|
|
44
51
|
export type AgentOsConfigWorkspaceTopology = WorkspaceTopology;
|
|
45
52
|
export interface AgentOsConfigWorkspace {
|
|
46
53
|
readonly binding: string;
|
|
@@ -130,9 +137,16 @@ export interface NormalizedAgentOsConfigBase<M extends AgentManifest = AgentMani
|
|
|
130
137
|
readonly deployment: DeploymentSpec<M>;
|
|
131
138
|
readonly deploymentVersion?: string;
|
|
132
139
|
readonly authoredToolNames: ReadonlyArray<string>;
|
|
140
|
+
readonly channels: ReadonlyArray<CompiledAgentChannel>;
|
|
141
|
+
readonly workflows: ReadonlyArray<CompiledAgentWorkflow>;
|
|
142
|
+
readonly schedules: ReadonlyArray<CompiledAgentSchedule>;
|
|
143
|
+
readonly skills: ReadonlyArray<CompiledAgentSkill>;
|
|
144
|
+
readonly instructionFragments: CompiledAgentManifest["instructionFragments"];
|
|
145
|
+
readonly dynamicResolvers: CompiledAgentManifest["dynamicResolvers"];
|
|
133
146
|
readonly target: AgentOsConfigTarget;
|
|
134
147
|
readonly client: AgentOsConfigClient;
|
|
135
|
-
readonly llm:
|
|
148
|
+
readonly llm: AgentOsConfigLlmRouteBinding;
|
|
149
|
+
readonly llmRoutes: Readonly<Record<string, AgentOsConfigLlmRouteBinding>>;
|
|
136
150
|
readonly origins: Readonly<Record<AgentOsConfigFactKey, AgentOsConfigOrigin>>;
|
|
137
151
|
readonly provenance: StaticTargetProvenance;
|
|
138
152
|
}
|
|
@@ -172,6 +186,7 @@ export declare const llmMaterialEnvBindingsForRefs: (refs: ReadonlyArray<{
|
|
|
172
186
|
export declare const llmMaterialEnvNameCollisionIssues: (bindings: ReadonlyArray<LlmMaterialEnvBinding>) => ReadonlyArray<Extract<AgentOsConfigIssue, {
|
|
173
187
|
readonly kind: "llm_material_env_name_collision";
|
|
174
188
|
}>>;
|
|
175
|
-
export declare const llmMaterialEnvBindings: (llm:
|
|
189
|
+
export declare const llmMaterialEnvBindings: (llm: AgentOsConfigLlmRouteBinding) => ReadonlyArray<LlmMaterialEnvBinding>;
|
|
190
|
+
export declare const llmMaterialEnvBindingsForRoutes: (routes: Readonly<Record<string, AgentOsConfigLlmRouteBinding>>) => ReadonlyArray<LlmMaterialEnvBinding>;
|
|
176
191
|
export declare const decodeAgentOsConfig: (value: unknown) => DecodeAgentOsConfigResult;
|
|
177
192
|
export declare const normalizeAgentOsConfig: <K extends HandlerKind = HandlerKind>(config: AgentOsConfigV1, compiled: CompiledAgentManifest<K>) => NormalizeAgentOsConfigResult<AuthoredAgentManifest<K>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { authoredValue } from "@yansirplus/core/authored-value";
|
|
2
2
|
import { WORKSPACE_TOPOLOGY, manifestScopeRefResult, workspaceBindingRef, workspaceProviderResourceId, } from "@yansirplus/core/runtime-protocol";
|
|
3
|
-
import { WORKSPACE_TOOL_DEFAULT_DECLARATIONS, } from "@yansirplus/runtime";
|
|
3
|
+
import { WORKSPACE_OP_FACT_OWNER, WORKSPACE_TOOL_DEFAULT_DECLARATIONS, } from "@yansirplus/runtime";
|
|
4
4
|
import { digestHex64, isNonEmptyString, isRecord } from "./shared.js";
|
|
5
5
|
import { workspaceManifestMacroOrigin } from "./manifest-compiler.js";
|
|
6
6
|
export const AGENTOS_CONFIG_PROFILE = {
|
|
@@ -9,6 +9,7 @@ export const AGENTOS_CONFIG_PROFILE = {
|
|
|
9
9
|
};
|
|
10
10
|
export const AGENTOS_CONFIG_TARGET = {
|
|
11
11
|
CLOUDFLARE_DO_V1: "cloudflare-do@1",
|
|
12
|
+
NODE_V1: "node@1",
|
|
12
13
|
};
|
|
13
14
|
export const AGENTOS_CONFIG_CLIENT = {
|
|
14
15
|
SVELTE_KIT_REMOTE_V1: "svelte-kit-remote@1",
|
|
@@ -20,6 +21,17 @@ export const AGENTOS_CONFIG_LLM_ROUTE = {
|
|
|
20
21
|
const configAuthorOrigin = (factKey) => `author:agentos.config.jsonc#${factKey}`;
|
|
21
22
|
const workspaceMacroOrigin = (factKey) => `macro(${AGENTOS_CONFIG_PROFILE.WORKSPACE_V1})#${factKey}`;
|
|
22
23
|
const chatMacroOrigin = (factKey) => `macro(${AGENTOS_CONFIG_PROFILE.CHAT_V1})#${factKey}`;
|
|
24
|
+
const targetOriginFacts = (target) => ({
|
|
25
|
+
"/target/kind": configAuthorOrigin("/target/kind"),
|
|
26
|
+
...(target.kind === AGENTOS_CONFIG_TARGET.CLOUDFLARE_DO_V1
|
|
27
|
+
? {
|
|
28
|
+
"/target/durableObject/className": configAuthorOrigin("/target/durableObject/className"),
|
|
29
|
+
"/target/durableObject/binding": configAuthorOrigin("/target/durableObject/binding"),
|
|
30
|
+
}
|
|
31
|
+
: {}),
|
|
32
|
+
});
|
|
33
|
+
const targetDeploymentBackend = (target) => target.kind === AGENTOS_CONFIG_TARGET.NODE_V1 ? "node" : "cloudflare-do";
|
|
34
|
+
const targetDeploymentAdapter = (target) => target.kind;
|
|
23
35
|
const materialEnvPrefix = (kind) => kind === "endpoint"
|
|
24
36
|
? "AGENTOS_ENDPOINT"
|
|
25
37
|
: kind === "credential"
|
|
@@ -56,6 +68,7 @@ export const llmMaterialEnvBindings = (llm) => llmMaterialEnvBindingsForRefs([
|
|
|
56
68
|
{ kind: "credential", ref: llm.credentialRef },
|
|
57
69
|
{ kind: "model", ref: llm.modelRef },
|
|
58
70
|
]);
|
|
71
|
+
export const llmMaterialEnvBindingsForRoutes = (routes) => Object.values(routes).flatMap((route) => llmMaterialEnvBindings(route));
|
|
59
72
|
const configAllowedFields = new Set([
|
|
60
73
|
"$schema",
|
|
61
74
|
"profile",
|
|
@@ -67,10 +80,12 @@ const configAllowedFields = new Set([
|
|
|
67
80
|
"workspace",
|
|
68
81
|
]);
|
|
69
82
|
const deploymentAllowedFields = new Set(["id", "version"]);
|
|
70
|
-
const
|
|
83
|
+
const nodeTargetAllowedFields = new Set(["kind"]);
|
|
84
|
+
const cloudflareTargetAllowedFields = new Set(["kind", "durableObject"]);
|
|
71
85
|
const durableObjectAllowedFields = new Set(["className", "binding"]);
|
|
72
86
|
const clientAllowedFields = new Set(["kind"]);
|
|
73
|
-
const llmAllowedFields = new Set(["route", "endpointRef", "credentialRef", "modelRef"]);
|
|
87
|
+
const llmAllowedFields = new Set(["route", "endpointRef", "credentialRef", "modelRef", "routes"]);
|
|
88
|
+
const llmRouteAllowedFields = new Set(["route", "endpointRef", "credentialRef", "modelRef"]);
|
|
74
89
|
const workspaceAllowedFields = new Set(["binding", "root", "topology"]);
|
|
75
90
|
const topologyAllowedFields = new Set(["kind", "allocator"]);
|
|
76
91
|
const configRuntimeFactFields = new Set([
|
|
@@ -150,11 +165,16 @@ const decodeTargetConfig = (issues, value) => {
|
|
|
150
165
|
const record = configRequiredRecord(issues, "agentos.config.jsonc", "/target", value);
|
|
151
166
|
if (record === null)
|
|
152
167
|
return null;
|
|
153
|
-
|
|
168
|
+
if (record.kind === AGENTOS_CONFIG_TARGET.NODE_V1) {
|
|
169
|
+
assertConfigAllowedFields(issues, "/target", record, nodeTargetAllowedFields);
|
|
170
|
+
return { kind: AGENTOS_CONFIG_TARGET.NODE_V1 };
|
|
171
|
+
}
|
|
154
172
|
if (record.kind !== AGENTOS_CONFIG_TARGET.CLOUDFLARE_DO_V1) {
|
|
173
|
+
assertConfigAllowedFields(issues, "/target", record, nodeTargetAllowedFields);
|
|
155
174
|
issueInvalidConfigValue(issues, "/target", "/target/kind", "target_kind_invalid");
|
|
156
175
|
return null;
|
|
157
176
|
}
|
|
177
|
+
assertConfigAllowedFields(issues, "/target", record, cloudflareTargetAllowedFields);
|
|
158
178
|
const durableObject = configRequiredRecord(issues, "/target", "/target/durableObject", record.durableObject);
|
|
159
179
|
if (durableObject === null)
|
|
160
180
|
return null;
|
|
@@ -180,18 +200,20 @@ const decodeClientConfig = (issues, value) => {
|
|
|
180
200
|
}
|
|
181
201
|
return { kind: record.kind };
|
|
182
202
|
};
|
|
183
|
-
const
|
|
184
|
-
const record = configRequiredRecord(issues, "agentos.config.jsonc",
|
|
203
|
+
const decodeLlmRouteConfig = (issues, path, value, options = {}) => {
|
|
204
|
+
const record = configRequiredRecord(issues, "agentos.config.jsonc", path, value);
|
|
185
205
|
if (record === null)
|
|
186
206
|
return null;
|
|
187
|
-
|
|
207
|
+
if (options.checkAllowedFields !== false) {
|
|
208
|
+
assertConfigAllowedFields(issues, path, record, llmRouteAllowedFields);
|
|
209
|
+
}
|
|
188
210
|
if (record.route !== AGENTOS_CONFIG_LLM_ROUTE.OPENAI_CHAT_COMPATIBLE) {
|
|
189
|
-
issueInvalidConfigValue(issues,
|
|
211
|
+
issueInvalidConfigValue(issues, path, `${path}/route`, "llm_route_invalid");
|
|
190
212
|
return null;
|
|
191
213
|
}
|
|
192
|
-
const endpointRef = configStringField(issues,
|
|
193
|
-
const credentialRef = configStringField(issues,
|
|
194
|
-
const modelRef = configStringField(issues,
|
|
214
|
+
const endpointRef = configStringField(issues, path, `${path}/endpointRef`, record.endpointRef);
|
|
215
|
+
const credentialRef = configStringField(issues, path, `${path}/credentialRef`, record.credentialRef);
|
|
216
|
+
const modelRef = configStringField(issues, path, `${path}/modelRef`, record.modelRef);
|
|
195
217
|
return endpointRef === null || credentialRef === null || modelRef === null
|
|
196
218
|
? null
|
|
197
219
|
: {
|
|
@@ -201,6 +223,46 @@ const decodeLlmConfig = (issues, value) => {
|
|
|
201
223
|
modelRef,
|
|
202
224
|
};
|
|
203
225
|
};
|
|
226
|
+
const routeBindingRefPattern = /^[A-Za-z0-9._:-]+$/u;
|
|
227
|
+
const decodeLlmRoutesConfig = (issues, value) => {
|
|
228
|
+
if (value === undefined)
|
|
229
|
+
return undefined;
|
|
230
|
+
const record = configRequiredRecord(issues, "/llm", "/llm/routes", value);
|
|
231
|
+
if (record === null)
|
|
232
|
+
return undefined;
|
|
233
|
+
const routes = {};
|
|
234
|
+
for (const [bindingRef, routeValue] of Object.entries(record).sort(([left], [right]) => left.localeCompare(right))) {
|
|
235
|
+
const routePath = `/llm/routes/${bindingRef}`;
|
|
236
|
+
if (bindingRef === "default") {
|
|
237
|
+
issueInvalidConfigValue(issues, routePath, routePath, "llm_default_route_duplicate");
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
if (!routeBindingRefPattern.test(bindingRef)) {
|
|
241
|
+
issueInvalidConfigValue(issues, routePath, routePath, "llm_route_binding_ref_invalid");
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
const route = decodeLlmRouteConfig(issues, routePath, routeValue);
|
|
245
|
+
if (route !== null)
|
|
246
|
+
routes[bindingRef] = route;
|
|
247
|
+
}
|
|
248
|
+
return routes;
|
|
249
|
+
};
|
|
250
|
+
const decodeLlmConfig = (issues, value) => {
|
|
251
|
+
const record = configRequiredRecord(issues, "agentos.config.jsonc", "/llm", value);
|
|
252
|
+
if (record === null)
|
|
253
|
+
return null;
|
|
254
|
+
assertConfigAllowedFields(issues, "/llm", record, llmAllowedFields);
|
|
255
|
+
const defaultRoute = decodeLlmRouteConfig(issues, "/llm", record, {
|
|
256
|
+
checkAllowedFields: false,
|
|
257
|
+
});
|
|
258
|
+
const routes = decodeLlmRoutesConfig(issues, record.routes);
|
|
259
|
+
return defaultRoute === null
|
|
260
|
+
? null
|
|
261
|
+
: {
|
|
262
|
+
...defaultRoute,
|
|
263
|
+
...(routes === undefined ? {} : { routes }),
|
|
264
|
+
};
|
|
265
|
+
};
|
|
204
266
|
const decodeWorkspaceTopologyConfig = (issues, value) => {
|
|
205
267
|
const record = configRequiredRecord(issues, "/workspace", "/workspace/topology", value);
|
|
206
268
|
if (record === null)
|
|
@@ -298,6 +360,7 @@ const workspaceMaterialRef = (providerResourceId) => ({
|
|
|
298
360
|
const workspaceDefaultToolFactKey = (toolId, field) => `/tools/${toolId}/${field}`;
|
|
299
361
|
const workspaceExecutionDomainFactKey = "/executionDomains/workspace/bindingRef";
|
|
300
362
|
const workspaceMaterialFactKey = "/materials/workspace";
|
|
363
|
+
const workspaceCapabilityFactKey = "/capabilities/workspaceOperations/bindingRef";
|
|
301
364
|
const defaultWorkspaceToolEntry = (tool, control) => ({
|
|
302
365
|
bindingRef: tool.name,
|
|
303
366
|
executionDomain: tool.executionDomain,
|
|
@@ -324,6 +387,9 @@ const addDefaultWorkspaceToolProvenance = (provenance, tool, control) => {
|
|
|
324
387
|
const applyWorkspaceDefaultTools = (compiled) => {
|
|
325
388
|
const issues = [];
|
|
326
389
|
const tools = { ...compiled.manifest.tools };
|
|
390
|
+
const capabilities = {
|
|
391
|
+
...compiled.manifest.capabilities,
|
|
392
|
+
};
|
|
327
393
|
const executionDomains = {
|
|
328
394
|
...compiled.manifest.executionDomains,
|
|
329
395
|
};
|
|
@@ -335,6 +401,10 @@ const applyWorkspaceDefaultTools = (compiled) => {
|
|
|
335
401
|
executionDomains.workspace = { bindingRef: "workspace" };
|
|
336
402
|
provenance[workspaceExecutionDomainFactKey] = workspaceManifestMacroOrigin(workspaceExecutionDomainFactKey);
|
|
337
403
|
}
|
|
404
|
+
if (capabilities.workspaceOperations === undefined) {
|
|
405
|
+
capabilities.workspaceOperations = { bindingRef: WORKSPACE_OP_FACT_OWNER };
|
|
406
|
+
provenance[workspaceCapabilityFactKey] = workspaceManifestMacroOrigin(workspaceCapabilityFactKey);
|
|
407
|
+
}
|
|
338
408
|
for (const defaultTool of WORKSPACE_TOOL_DEFAULT_DECLARATIONS) {
|
|
339
409
|
const control = compiled.workspaceToolControls[defaultTool.name];
|
|
340
410
|
const existing = compiled.manifest.tools?.[defaultTool.name];
|
|
@@ -355,12 +425,15 @@ const applyWorkspaceDefaultTools = (compiled) => {
|
|
|
355
425
|
}
|
|
356
426
|
const manifestWithoutTools = { ...compiled.manifest };
|
|
357
427
|
delete manifestWithoutTools.tools;
|
|
428
|
+
delete manifestWithoutTools.capabilities;
|
|
358
429
|
delete manifestWithoutTools.executionDomains;
|
|
359
430
|
const sortedTools = Object.fromEntries(Object.entries(tools).sort(([left], [right]) => left.localeCompare(right)));
|
|
431
|
+
const sortedCapabilities = Object.fromEntries(Object.entries(capabilities).sort(([left], [right]) => left.localeCompare(right)));
|
|
360
432
|
const sortedExecutionDomains = Object.fromEntries(Object.entries(executionDomains).sort(([left], [right]) => left.localeCompare(right)));
|
|
361
433
|
return {
|
|
362
434
|
manifest: authoredValue({
|
|
363
435
|
...manifestWithoutTools,
|
|
436
|
+
...(Object.keys(sortedCapabilities).length === 0 ? {} : { capabilities: sortedCapabilities }),
|
|
364
437
|
...(Object.keys(sortedTools).length === 0 ? {} : { tools: sortedTools }),
|
|
365
438
|
...(Object.keys(sortedExecutionDomains).length === 0
|
|
366
439
|
? {}
|
|
@@ -431,12 +504,35 @@ const cloudflareWorkspaceSandboxId = (input) => {
|
|
|
431
504
|
const shortenedPrefix = prefix.slice(0, prefixBudget).replace(/-+$/g, "") || "agentos-sandbox";
|
|
432
505
|
return `${shortenedPrefix}${suffix}`;
|
|
433
506
|
};
|
|
507
|
+
const defaultLlmRoute = (llm) => ({
|
|
508
|
+
route: llm.route,
|
|
509
|
+
endpointRef: llm.endpointRef,
|
|
510
|
+
credentialRef: llm.credentialRef,
|
|
511
|
+
modelRef: llm.modelRef,
|
|
512
|
+
});
|
|
513
|
+
const normalizedLlmRoutes = (llm) => ({
|
|
514
|
+
default: defaultLlmRoute(llm),
|
|
515
|
+
...(llm.routes ?? {}),
|
|
516
|
+
});
|
|
517
|
+
const addLlmRouteOrigins = (origins, llm) => {
|
|
518
|
+
origins["/llm/route"] = configAuthorOrigin("/llm/route");
|
|
519
|
+
origins["/llm/endpointRef"] = configAuthorOrigin("/llm/endpointRef");
|
|
520
|
+
origins["/llm/credentialRef"] = configAuthorOrigin("/llm/credentialRef");
|
|
521
|
+
origins["/llm/modelRef"] = configAuthorOrigin("/llm/modelRef");
|
|
522
|
+
for (const routeBindingRef of Object.keys(llm.routes ?? {}).sort()) {
|
|
523
|
+
origins[`/llm/routes/${routeBindingRef}/route`] = configAuthorOrigin(`/llm/routes/${routeBindingRef}/route`);
|
|
524
|
+
origins[`/llm/routes/${routeBindingRef}/endpointRef`] = configAuthorOrigin(`/llm/routes/${routeBindingRef}/endpointRef`);
|
|
525
|
+
origins[`/llm/routes/${routeBindingRef}/credentialRef`] = configAuthorOrigin(`/llm/routes/${routeBindingRef}/credentialRef`);
|
|
526
|
+
origins[`/llm/routes/${routeBindingRef}/modelRef`] = configAuthorOrigin(`/llm/routes/${routeBindingRef}/modelRef`);
|
|
527
|
+
}
|
|
528
|
+
};
|
|
434
529
|
export const normalizeAgentOsConfig = (config, compiled) => {
|
|
435
530
|
const decoded = decodeAgentOsConfig(config);
|
|
436
531
|
if (!decoded.ok)
|
|
437
532
|
return decoded;
|
|
438
533
|
const value = decoded.value;
|
|
439
|
-
const
|
|
534
|
+
const llmRoutes = normalizedLlmRoutes(value.llm);
|
|
535
|
+
const llmEnvIssues = llmMaterialEnvNameCollisionIssues(llmMaterialEnvBindingsForRoutes(llmRoutes));
|
|
440
536
|
if (llmEnvIssues.length > 0) {
|
|
441
537
|
return { ok: false, issues: llmEnvIssues };
|
|
442
538
|
}
|
|
@@ -476,19 +572,14 @@ export const normalizeAgentOsConfig = (config, compiled) => {
|
|
|
476
572
|
...(value.deployment.version === undefined
|
|
477
573
|
? {}
|
|
478
574
|
: { "/deployment/version": configAuthorOrigin("/deployment/version") }),
|
|
479
|
-
|
|
480
|
-
"/target/durableObject/className": configAuthorOrigin("/target/durableObject/className"),
|
|
481
|
-
"/target/durableObject/binding": configAuthorOrigin("/target/durableObject/binding"),
|
|
575
|
+
...targetOriginFacts(value.target),
|
|
482
576
|
"/client/kind": configAuthorOrigin("/client/kind"),
|
|
483
|
-
"/llm/route": configAuthorOrigin("/llm/route"),
|
|
484
|
-
"/llm/endpointRef": configAuthorOrigin("/llm/endpointRef"),
|
|
485
|
-
"/llm/credentialRef": configAuthorOrigin("/llm/credentialRef"),
|
|
486
|
-
"/llm/modelRef": configAuthorOrigin("/llm/modelRef"),
|
|
487
577
|
"/deployment/backend": `derived:/target/kind`,
|
|
488
578
|
"/deployment/adapter": `derived:/target/kind`,
|
|
489
579
|
"/deployment/codec": chatMacroOrigin("/deployment/codec"),
|
|
490
580
|
"/deployment/providerStrategy": `derived:/llm/route`,
|
|
491
581
|
};
|
|
582
|
+
addLlmRouteOrigins(origins, value.llm);
|
|
492
583
|
return {
|
|
493
584
|
ok: true,
|
|
494
585
|
value: {
|
|
@@ -497,8 +588,8 @@ export const normalizeAgentOsConfig = (config, compiled) => {
|
|
|
497
588
|
deployment: {
|
|
498
589
|
deploymentId: value.deployment.id,
|
|
499
590
|
manifest: profileManifest.manifest,
|
|
500
|
-
backend:
|
|
501
|
-
adapter:
|
|
591
|
+
backend: targetDeploymentBackend(value.target),
|
|
592
|
+
adapter: targetDeploymentAdapter(value.target),
|
|
502
593
|
codec: "agentos-json@1",
|
|
503
594
|
providerStrategy: value.llm.route,
|
|
504
595
|
},
|
|
@@ -506,9 +597,16 @@ export const normalizeAgentOsConfig = (config, compiled) => {
|
|
|
506
597
|
? {}
|
|
507
598
|
: { deploymentVersion: value.deployment.version }),
|
|
508
599
|
authoredToolNames: Object.keys(compiled.toolFilePaths).sort(),
|
|
600
|
+
channels: compiled.channels,
|
|
601
|
+
workflows: compiled.workflows,
|
|
602
|
+
schedules: compiled.schedules,
|
|
603
|
+
skills: compiled.skills,
|
|
604
|
+
instructionFragments: compiled.instructionFragments,
|
|
605
|
+
dynamicResolvers: compiled.dynamicResolvers,
|
|
509
606
|
target: value.target,
|
|
510
607
|
client: value.client,
|
|
511
|
-
llm:
|
|
608
|
+
llm: llmRoutes.default,
|
|
609
|
+
llmRoutes,
|
|
512
610
|
origins,
|
|
513
611
|
provenance: {
|
|
514
612
|
manifest: profileManifest.provenance,
|
|
@@ -544,14 +642,8 @@ export const normalizeAgentOsConfig = (config, compiled) => {
|
|
|
544
642
|
...(value.deployment.version === undefined
|
|
545
643
|
? {}
|
|
546
644
|
: { "/deployment/version": configAuthorOrigin("/deployment/version") }),
|
|
547
|
-
|
|
548
|
-
"/target/durableObject/className": configAuthorOrigin("/target/durableObject/className"),
|
|
549
|
-
"/target/durableObject/binding": configAuthorOrigin("/target/durableObject/binding"),
|
|
645
|
+
...targetOriginFacts(value.target),
|
|
550
646
|
"/client/kind": configAuthorOrigin("/client/kind"),
|
|
551
|
-
"/llm/route": configAuthorOrigin("/llm/route"),
|
|
552
|
-
"/llm/endpointRef": configAuthorOrigin("/llm/endpointRef"),
|
|
553
|
-
"/llm/credentialRef": configAuthorOrigin("/llm/credentialRef"),
|
|
554
|
-
"/llm/modelRef": configAuthorOrigin("/llm/modelRef"),
|
|
555
647
|
"/workspace/binding": configAuthorOrigin("/workspace/binding"),
|
|
556
648
|
"/workspace/bindingRef": `derived:/workspace/binding`,
|
|
557
649
|
"/workspace/root": configAuthorOrigin("/workspace/root"),
|
|
@@ -568,6 +660,7 @@ export const normalizeAgentOsConfig = (config, compiled) => {
|
|
|
568
660
|
"/workspace/providerResourceId": `derived:/deployment/id+/workspace/binding+/workspace/topology+/agent/scope`,
|
|
569
661
|
"/workspace/cloudflareSandboxId": `derived:/workspace/providerResourceId`,
|
|
570
662
|
};
|
|
663
|
+
addLlmRouteOrigins(origins, value.llm);
|
|
571
664
|
return {
|
|
572
665
|
ok: true,
|
|
573
666
|
value: {
|
|
@@ -576,8 +669,8 @@ export const normalizeAgentOsConfig = (config, compiled) => {
|
|
|
576
669
|
deployment: {
|
|
577
670
|
deploymentId: value.deployment.id,
|
|
578
671
|
manifest: manifestWithWorkspaceMaterial.manifest,
|
|
579
|
-
backend:
|
|
580
|
-
adapter:
|
|
672
|
+
backend: targetDeploymentBackend(value.target),
|
|
673
|
+
adapter: targetDeploymentAdapter(value.target),
|
|
581
674
|
codec: "agentos-json@1",
|
|
582
675
|
providerStrategy: value.llm.route,
|
|
583
676
|
},
|
|
@@ -585,9 +678,16 @@ export const normalizeAgentOsConfig = (config, compiled) => {
|
|
|
585
678
|
? {}
|
|
586
679
|
: { deploymentVersion: value.deployment.version }),
|
|
587
680
|
authoredToolNames: Object.keys(compiled.toolFilePaths).sort(),
|
|
681
|
+
channels: compiled.channels,
|
|
682
|
+
workflows: compiled.workflows,
|
|
683
|
+
schedules: compiled.schedules,
|
|
684
|
+
skills: compiled.skills,
|
|
685
|
+
instructionFragments: compiled.instructionFragments,
|
|
686
|
+
dynamicResolvers: compiled.dynamicResolvers,
|
|
588
687
|
target: value.target,
|
|
589
688
|
client: value.client,
|
|
590
|
-
llm:
|
|
689
|
+
llm: llmRoutes.default,
|
|
690
|
+
llmRoutes,
|
|
591
691
|
workspace: {
|
|
592
692
|
binding: value.workspace.binding,
|
|
593
693
|
bindingRef,
|
|
@@ -2,7 +2,7 @@ import type { Authored } from "@yansirplus/core";
|
|
|
2
2
|
import type { AgentSchemaSpec } from "@yansirplus/core/agent-schema";
|
|
3
3
|
import { type AuthorityRef } from "@yansirplus/core/effect-claim";
|
|
4
4
|
import { type MaterialRef } from "@yansirplus/core/material-ref";
|
|
5
|
-
import type { AgentExecutionDomainRef, AgentInteractionRef, AgentLlmRouteBindingRef, AgentManifest, AgentScopeIdentityPolicy } from "@yansirplus/core/runtime-protocol";
|
|
5
|
+
import type { AgentCapabilityBindingRef, AgentExecutionDomainRef, AgentInteractionRef, AgentLlmRouteBindingRef, AgentManifest, AgentScopeIdentityPolicy } from "@yansirplus/core/runtime-protocol";
|
|
6
6
|
import { type HandlerKind } from "@yansirplus/core/runtime-protocol";
|
|
7
7
|
import { type WorkspaceToolInteractionFloor, type WorkspaceToolName } from "@yansirplus/runtime";
|
|
8
8
|
import { AUTHORING_DEFAULTS_VERSION } from "./shared.js";
|
|
@@ -11,11 +11,19 @@ export type AgentManifestOrigin = `path:${string}` | `author:${string}#${string}
|
|
|
11
11
|
export interface AuthoredAgentTree {
|
|
12
12
|
readonly files: ReadonlyArray<AuthoredAgentTreeFile>;
|
|
13
13
|
}
|
|
14
|
-
export type AuthoredAgentTreeFile = AuthoredMarkdownFile | AuthoredJsonFile | AuthoredToolFile;
|
|
14
|
+
export type AuthoredAgentTreeFile = AuthoredMarkdownFile | AuthoredTextFile | AuthoredJsonFile | AuthoredToolFile | AuthoredDynamicResolverFile | AuthoredChannelFile | AuthoredWorkflowFile | AuthoredScheduleFile;
|
|
15
|
+
export type AuthoredFileSourceKind = "regular" | "symlink" | "non_regular";
|
|
15
16
|
export interface AuthoredMarkdownFile {
|
|
16
17
|
readonly path: string;
|
|
17
18
|
readonly kind: "markdown";
|
|
18
19
|
readonly text: string;
|
|
20
|
+
readonly sourceKind?: AuthoredFileSourceKind;
|
|
21
|
+
}
|
|
22
|
+
export interface AuthoredTextFile {
|
|
23
|
+
readonly path: string;
|
|
24
|
+
readonly kind: "text";
|
|
25
|
+
readonly bytes: Uint8Array;
|
|
26
|
+
readonly sourceKind?: AuthoredFileSourceKind;
|
|
19
27
|
}
|
|
20
28
|
export interface AuthoredJsonFile {
|
|
21
29
|
readonly path: string;
|
|
@@ -36,6 +44,85 @@ export interface AuthoredToolFile {
|
|
|
36
44
|
readonly kind: "tool";
|
|
37
45
|
readonly declaration?: AuthoredToolDeclaration;
|
|
38
46
|
}
|
|
47
|
+
export type DynamicCapabilitySlot = "tools" | "skills" | "instructions";
|
|
48
|
+
export interface AuthoredDynamicResolverDeclaration {
|
|
49
|
+
readonly outputs?: unknown;
|
|
50
|
+
readonly id?: unknown;
|
|
51
|
+
readonly name?: unknown;
|
|
52
|
+
}
|
|
53
|
+
export interface AuthoredDynamicResolverFile {
|
|
54
|
+
readonly path: string;
|
|
55
|
+
readonly kind: "dynamic";
|
|
56
|
+
readonly declaration?: AuthoredDynamicResolverDeclaration;
|
|
57
|
+
readonly sourceKind?: AuthoredFileSourceKind;
|
|
58
|
+
}
|
|
59
|
+
export interface AuthoredChannelFile {
|
|
60
|
+
readonly path: string;
|
|
61
|
+
readonly kind: "channel";
|
|
62
|
+
readonly sourceKind?: AuthoredFileSourceKind;
|
|
63
|
+
}
|
|
64
|
+
export interface AuthoredWorkflowFile {
|
|
65
|
+
readonly path: string;
|
|
66
|
+
readonly kind: "workflow";
|
|
67
|
+
readonly sourceKind?: AuthoredFileSourceKind;
|
|
68
|
+
}
|
|
69
|
+
export interface AuthoredScheduleDeclaration {
|
|
70
|
+
readonly cron?: unknown;
|
|
71
|
+
readonly handler?: unknown;
|
|
72
|
+
readonly id?: unknown;
|
|
73
|
+
readonly name?: unknown;
|
|
74
|
+
readonly kind?: unknown;
|
|
75
|
+
}
|
|
76
|
+
export interface AuthoredScheduleFile {
|
|
77
|
+
readonly path: string;
|
|
78
|
+
readonly kind: "schedule";
|
|
79
|
+
readonly declaration?: AuthoredScheduleDeclaration;
|
|
80
|
+
readonly sourceKind?: AuthoredFileSourceKind;
|
|
81
|
+
}
|
|
82
|
+
export interface CompiledAgentChannel {
|
|
83
|
+
readonly name: string;
|
|
84
|
+
readonly path: string;
|
|
85
|
+
readonly origin: AgentManifestOrigin;
|
|
86
|
+
}
|
|
87
|
+
export interface CompiledAgentWorkflow {
|
|
88
|
+
readonly name: string;
|
|
89
|
+
readonly path: string;
|
|
90
|
+
readonly origin: AgentManifestOrigin;
|
|
91
|
+
}
|
|
92
|
+
export interface CompiledAgentSchedule {
|
|
93
|
+
readonly scheduleId: string;
|
|
94
|
+
readonly cron: string;
|
|
95
|
+
readonly path: string;
|
|
96
|
+
readonly origin: AgentManifestOrigin;
|
|
97
|
+
}
|
|
98
|
+
export interface CompiledAgentSkill {
|
|
99
|
+
readonly name: string;
|
|
100
|
+
readonly description: string;
|
|
101
|
+
readonly path: string;
|
|
102
|
+
readonly digest: string;
|
|
103
|
+
readonly text: string;
|
|
104
|
+
readonly files: ReadonlyArray<CompiledAgentSkillFile>;
|
|
105
|
+
}
|
|
106
|
+
export interface CompiledAgentSkillFile {
|
|
107
|
+
readonly path: string;
|
|
108
|
+
readonly digest: string;
|
|
109
|
+
readonly bytes: number;
|
|
110
|
+
readonly text: string;
|
|
111
|
+
}
|
|
112
|
+
export interface CompiledAgentInstructionFragment {
|
|
113
|
+
readonly fragmentId: string;
|
|
114
|
+
readonly path: string;
|
|
115
|
+
readonly digest: string;
|
|
116
|
+
readonly text: string;
|
|
117
|
+
readonly origin: AgentManifestOrigin;
|
|
118
|
+
}
|
|
119
|
+
export interface CompiledAgentDynamicResolver {
|
|
120
|
+
readonly resolverId: string;
|
|
121
|
+
readonly slot: DynamicCapabilitySlot;
|
|
122
|
+
readonly path: string;
|
|
123
|
+
readonly outputs: ReadonlyArray<string>;
|
|
124
|
+
readonly origin: AgentManifestOrigin;
|
|
125
|
+
}
|
|
39
126
|
export interface AuthoredWorkspaceDefaultToolOverride {
|
|
40
127
|
readonly interaction?: WorkspaceToolInteractionFloor;
|
|
41
128
|
}
|
|
@@ -46,6 +133,7 @@ export interface AuthoredAgentJson {
|
|
|
46
133
|
readonly scope?: AgentScopeIdentityPolicy;
|
|
47
134
|
readonly effectAuthorityRef?: AuthorityRef;
|
|
48
135
|
readonly handlers?: ReadonlyArray<HandlerKind>;
|
|
136
|
+
readonly capabilities?: Readonly<Record<string, AgentCapabilityBindingRef>>;
|
|
49
137
|
readonly llmRoutes?: Readonly<Record<string, AgentLlmRouteBindingRef>>;
|
|
50
138
|
readonly tools?: Readonly<Record<string, AuthoredWorkspaceDefaultToolControl>>;
|
|
51
139
|
readonly materials?: Readonly<Record<string, MaterialRef>>;
|
|
@@ -59,6 +147,12 @@ export interface CompiledAgentManifest<K extends HandlerKind = HandlerKind> {
|
|
|
59
147
|
readonly provenance: Readonly<Record<AgentManifestFactKey, AgentManifestOrigin>>;
|
|
60
148
|
readonly workspaceToolControls: Readonly<Partial<Record<WorkspaceToolName, WorkspaceDefaultToolControl>>>;
|
|
61
149
|
readonly toolFilePaths: Readonly<Record<string, string>>;
|
|
150
|
+
readonly channels: ReadonlyArray<CompiledAgentChannel>;
|
|
151
|
+
readonly workflows: ReadonlyArray<CompiledAgentWorkflow>;
|
|
152
|
+
readonly schedules: ReadonlyArray<CompiledAgentSchedule>;
|
|
153
|
+
readonly skills: ReadonlyArray<CompiledAgentSkill>;
|
|
154
|
+
readonly instructionFragments: ReadonlyArray<CompiledAgentInstructionFragment>;
|
|
155
|
+
readonly dynamicResolvers: ReadonlyArray<CompiledAgentDynamicResolver>;
|
|
62
156
|
}
|
|
63
157
|
export type CompileAgentTreeIssue = {
|
|
64
158
|
readonly kind: "unsupported_path";
|
|
@@ -130,6 +224,41 @@ export type CompileAgentTreeIssue = {
|
|
|
130
224
|
readonly kind: "workspace_default_tool_shadowed";
|
|
131
225
|
readonly path: string;
|
|
132
226
|
readonly toolId: string;
|
|
227
|
+
} | {
|
|
228
|
+
readonly kind: "skill_identity_mismatch";
|
|
229
|
+
readonly path: string;
|
|
230
|
+
readonly expectedName: string;
|
|
231
|
+
readonly actualName: string;
|
|
232
|
+
} | {
|
|
233
|
+
readonly kind: "duplicate_skill";
|
|
234
|
+
readonly name: string;
|
|
235
|
+
readonly path: string;
|
|
236
|
+
readonly existingPath: string;
|
|
237
|
+
} | {
|
|
238
|
+
readonly kind: "duplicate_instruction_fragment";
|
|
239
|
+
readonly fragmentId: string;
|
|
240
|
+
readonly path: string;
|
|
241
|
+
readonly existingPath: string;
|
|
242
|
+
} | {
|
|
243
|
+
readonly kind: "duplicate_dynamic_resolver";
|
|
244
|
+
readonly slot: DynamicCapabilitySlot;
|
|
245
|
+
readonly resolverId: string;
|
|
246
|
+
readonly path: string;
|
|
247
|
+
readonly existingPath: string;
|
|
248
|
+
} | {
|
|
249
|
+
readonly kind: "dynamic_resolver_cross_slot_output";
|
|
250
|
+
readonly path: string;
|
|
251
|
+
readonly slot: DynamicCapabilitySlot;
|
|
252
|
+
readonly outputSlot: DynamicCapabilitySlot;
|
|
253
|
+
} | {
|
|
254
|
+
readonly kind: "dynamic_resolver_unknown_target";
|
|
255
|
+
readonly path: string;
|
|
256
|
+
readonly slot: DynamicCapabilitySlot;
|
|
257
|
+
readonly targetId: string;
|
|
258
|
+
} | {
|
|
259
|
+
readonly kind: "reserved_tool_name";
|
|
260
|
+
readonly path: string;
|
|
261
|
+
readonly toolId: string;
|
|
133
262
|
} | {
|
|
134
263
|
readonly kind: "runtime_fact_forbidden";
|
|
135
264
|
readonly path: string;
|