@xemahq/agent-session-runtime 0.5.0 → 0.6.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/lib/composition-resolution.d.ts +4 -4
- package/dist/lib/composition-resolution.d.ts.map +1 -1
- package/dist/lib/composition-resolution.js +15 -15
- package/dist/lib/composition-resolution.js.map +1 -1
- package/dist/lib/composition-workspace-manifest.d.ts +13 -13
- package/dist/lib/composition-workspace-manifest.d.ts.map +1 -1
- package/dist/lib/composition-workspace-manifest.js +15 -15
- package/dist/lib/composition-workspace-manifest.js.map +1 -1
- package/package.json +2 -2
- package/src/lib/composition-resolution.ts +16 -16
- package/src/lib/composition-workspace-manifest.ts +31 -31
|
@@ -2,10 +2,10 @@ import { type ModelRef, type NodeOverlayFragment, type SubAgentBinding } from '@
|
|
|
2
2
|
import type { ResolvedAgent, ResolvedAgentNode } from '@xemahq/kernel-contracts/agent-composition';
|
|
3
3
|
import type { PermissionMap } from '@xemahq/kernel-contracts/agent-permission';
|
|
4
4
|
import { type ToolSelectionEntry } from '@xemahq/kernel-contracts/mcp-tool';
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class AgentResolutionError extends Error {
|
|
6
6
|
constructor(context: string, detail: string);
|
|
7
7
|
}
|
|
8
|
-
export interface
|
|
8
|
+
export interface FlattenedAgentNode {
|
|
9
9
|
readonly slug: string;
|
|
10
10
|
readonly alias?: string;
|
|
11
11
|
readonly modelOverride?: ModelRef;
|
|
@@ -29,7 +29,7 @@ export interface RuntimeAgentConfig {
|
|
|
29
29
|
readonly allSkillSlugs: readonly string[];
|
|
30
30
|
readonly defaultToolSelection: readonly ToolSelectionEntry[];
|
|
31
31
|
}
|
|
32
|
-
export declare function
|
|
32
|
+
export declare function flattenAgentTree(root: ResolvedAgentNode): readonly FlattenedAgentNode[];
|
|
33
33
|
export declare function collectSkills(root: ResolvedAgentNode, opts?: CollectScopeOptions): readonly string[];
|
|
34
34
|
export declare function collectTools(root: ResolvedAgentNode, opts?: CollectScopeOptions): readonly ToolSelectionEntry[];
|
|
35
35
|
export declare function collectInstructionsBySlug(root: ResolvedAgentNode): Readonly<Record<string, string>>;
|
|
@@ -39,5 +39,5 @@ export declare function appendInstructions(baseSystemPrompt: string, nodeInstruc
|
|
|
39
39
|
export declare function normalizeInstructions(raw: string | undefined): string | null;
|
|
40
40
|
export declare function normalizePermission(raw: PermissionMap | undefined): PermissionMap | null;
|
|
41
41
|
export declare function projectModelOverride(raw: ModelRef | undefined, context: string): ModelRef | null;
|
|
42
|
-
export declare function
|
|
42
|
+
export declare function projectAgentToRuntimeConfig(resolved: ResolvedAgent, overlay?: NodeOverlayFragment): RuntimeAgentConfig;
|
|
43
43
|
//# sourceMappingURL=composition-resolution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composition-resolution.d.ts","sourceRoot":"","sources":["../../src/lib/composition-resolution.ts"],"names":[],"mappings":"AA4BA,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EAClB,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,mCAAmC,CAAC;AAU3C,qBAAa,
|
|
1
|
+
{"version":3,"file":"composition-resolution.d.ts","sourceRoot":"","sources":["../../src/lib/composition-resolution.ts"],"names":[],"mappings":"AA4BA,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EAClB,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAEL,KAAK,kBAA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E,mBAAmB,GAC5B,kBAAkB,CAyCpB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.AgentResolutionError = void 0;
|
|
4
|
+
exports.flattenAgentTree = flattenAgentTree;
|
|
5
5
|
exports.collectSkills = collectSkills;
|
|
6
6
|
exports.collectTools = collectTools;
|
|
7
7
|
exports.collectInstructionsBySlug = collectInstructionsBySlug;
|
|
@@ -11,17 +11,17 @@ exports.appendInstructions = appendInstructions;
|
|
|
11
11
|
exports.normalizeInstructions = normalizeInstructions;
|
|
12
12
|
exports.normalizePermission = normalizePermission;
|
|
13
13
|
exports.projectModelOverride = projectModelOverride;
|
|
14
|
-
exports.
|
|
14
|
+
exports.projectAgentToRuntimeConfig = projectAgentToRuntimeConfig;
|
|
15
15
|
const workflow_1 = require("@xemahq/kernel-contracts/workflow");
|
|
16
16
|
const mcp_tool_1 = require("@xemahq/kernel-contracts/mcp-tool");
|
|
17
|
-
class
|
|
17
|
+
class AgentResolutionError extends Error {
|
|
18
18
|
constructor(context, detail) {
|
|
19
19
|
super(`Agent resolution failed for "${context}": ${detail}`);
|
|
20
|
-
this.name = '
|
|
20
|
+
this.name = 'AgentResolutionError';
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
exports.
|
|
24
|
-
function
|
|
23
|
+
exports.AgentResolutionError = AgentResolutionError;
|
|
24
|
+
function flattenAgentTree(root) {
|
|
25
25
|
const seen = new Set();
|
|
26
26
|
const out = [];
|
|
27
27
|
const visit = (node) => {
|
|
@@ -148,14 +148,14 @@ function projectModelOverride(raw, context) {
|
|
|
148
148
|
}
|
|
149
149
|
if (raw.kind === workflow_1.ModelRefKind.CONCRETE) {
|
|
150
150
|
if (typeof raw.modelId !== 'string' || raw.modelId.trim().length === 0) {
|
|
151
|
-
throw new
|
|
151
|
+
throw new AgentResolutionError(context, 'concrete modelOverride is missing a modelId');
|
|
152
152
|
}
|
|
153
153
|
return raw;
|
|
154
154
|
}
|
|
155
155
|
const modelClass = raw.modelClass;
|
|
156
156
|
if (modelClass === undefined ||
|
|
157
157
|
!workflow_1.MODEL_CLASS_VALUES.includes(modelClass)) {
|
|
158
|
-
throw new
|
|
158
|
+
throw new AgentResolutionError(context, `strategy modelOverride.modelClass must be one of ${workflow_1.MODEL_CLASS_VALUES.join(', ')}`);
|
|
159
159
|
}
|
|
160
160
|
return raw;
|
|
161
161
|
}
|
|
@@ -176,11 +176,11 @@ function projectToolSelection(tools, context) {
|
|
|
176
176
|
for (const [idx, tool] of tools.entries()) {
|
|
177
177
|
if (typeof tool.providerKind !== 'string' ||
|
|
178
178
|
!validKinds.has(tool.providerKind)) {
|
|
179
|
-
throw new
|
|
179
|
+
throw new AgentResolutionError(context, `tools[${idx}].providerKind must be one of ${Object.values(mcp_tool_1.ToolProviderKind).join(', ')}`);
|
|
180
180
|
}
|
|
181
181
|
if (typeof tool.resourceId !== 'string' ||
|
|
182
182
|
tool.resourceId.trim().length === 0) {
|
|
183
|
-
throw new
|
|
183
|
+
throw new AgentResolutionError(context, `tools[${idx}].resourceId must be a non-empty string`);
|
|
184
184
|
}
|
|
185
185
|
if (tool.kind === 'provider') {
|
|
186
186
|
out.push({
|
|
@@ -192,7 +192,7 @@ function projectToolSelection(tools, context) {
|
|
|
192
192
|
else if (tool.kind === 'tool') {
|
|
193
193
|
if (typeof tool.toolName !== 'string' ||
|
|
194
194
|
tool.toolName.trim().length === 0) {
|
|
195
|
-
throw new
|
|
195
|
+
throw new AgentResolutionError(context, `tools[${idx}].toolName must be a non-empty string for kind='tool'`);
|
|
196
196
|
}
|
|
197
197
|
out.push({
|
|
198
198
|
kind: 'tool',
|
|
@@ -202,12 +202,12 @@ function projectToolSelection(tools, context) {
|
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
204
|
else {
|
|
205
|
-
throw new
|
|
205
|
+
throw new AgentResolutionError(context, `tools[${idx}].kind must be "provider" or "tool"`);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
return out;
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function projectAgentToRuntimeConfig(resolved, overlay) {
|
|
211
211
|
const root = resolved.root;
|
|
212
212
|
const agentRef = `${resolved.slug}@${resolved.version}`;
|
|
213
213
|
const rootInstructions = normalizeInstructions(root.instructions);
|
|
@@ -217,7 +217,7 @@ function projectCompositionToRuntimeConfig(resolved, overlay) {
|
|
|
217
217
|
const overlayModelOverride = projectModelOverride(overlay?.modelOverride, `${agentRef}#overlay`);
|
|
218
218
|
const rootPermission = normalizePermission(root.permission);
|
|
219
219
|
const overlayPermission = normalizePermission(overlay?.permission);
|
|
220
|
-
const flattened =
|
|
220
|
+
const flattened = flattenAgentTree(root);
|
|
221
221
|
return {
|
|
222
222
|
agentRef,
|
|
223
223
|
primaryAgentSlug: root.kernel.slug,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composition-resolution.js","sourceRoot":"","sources":["../../src/lib/composition-resolution.ts"],"names":[],"mappings":";;;AA6HA,
|
|
1
|
+
{"version":3,"file":"composition-resolution.js","sourceRoot":"","sources":["../../src/lib/composition-resolution.ts"],"names":[],"mappings":";;;AA6HA,4CA4BC;AAQD,sCA0BC;AAQD,oCAkBC;AAOD,8DAMC;AAMD,4DAMC;AAOD,kEAMC;AA2CD,gDAcC;AAWD,sDAMC;AAQD,kDAOC;AAOD,oDA+BC;AAqGD,kEA4CC;AA/eD,gEAO2C;AAM3C,gEAG2C;AAU3C,MAAa,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe,EAAE,MAAc;QACzC,KAAK,CAAC,gCAAgC,OAAO,MAAM,MAAM,EAAE,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AALD,oDAKC;AAkED,SAAgB,gBAAgB,CAC9B,IAAuB;IAEvB,MAAM,IAAI,GAAG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C;IAEnE,MAAM,SAAS,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAEzC,OAAO;QACL,QAAQ;QACR,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;QAClC,mBAAmB,EACjB,mBAAmB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI;QAC7D,iBAAiB,EAAE,iBAAiB,IAAI,cAAc;QACtD,oBAAoB,EAAE,oBAAoB,IAAI,iBAAiB;QAC/D,gBAAgB,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAClD,0BAA0B,EAAE,yBAAyB,CAAC,IAAI,CAAC;QAC3D,wBAAwB,EAAE,wBAAwB,CAAC,IAAI,CAAC;QACxD,4BAA4B,EAAE,2BAA2B,CAAC,IAAI,CAAC;QAC/D,iBAAiB,EAAE,aAAa,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QACzD,aAAa,EAAE,aAAa,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QACrD,oBAAoB,EAAE,YAAY,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;KAC5D,CAAC;AACJ,CAAC"}
|
|
@@ -2,28 +2,28 @@ import { type CompiledManifestCredential, type CompiledManifestPermissions, type
|
|
|
2
2
|
import type { PermissionMap } from '@xemahq/kernel-contracts/agent-permission';
|
|
3
3
|
import { type CompiledWorkspaceManifest } from '@xemahq/dsl/workspace-manifest';
|
|
4
4
|
export type { CompiledWorkspaceManifest };
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class AgentMountLayoutError extends Error {
|
|
6
6
|
constructor(agentRef: string, detail: string);
|
|
7
7
|
}
|
|
8
|
-
export interface
|
|
8
|
+
export interface AgentRunConfigInput {
|
|
9
9
|
readonly stage: string;
|
|
10
10
|
readonly role: string;
|
|
11
11
|
readonly deliverableSpecRef?: string;
|
|
12
12
|
}
|
|
13
|
-
export interface
|
|
13
|
+
export interface AgentMountLayoutInput {
|
|
14
14
|
readonly mounts: Readonly<Record<string, unknown>>;
|
|
15
|
-
readonly agentRunConfig:
|
|
15
|
+
readonly agentRunConfig: AgentRunConfigInput;
|
|
16
16
|
readonly seedFiles: readonly unknown[];
|
|
17
17
|
readonly inputs: Readonly<Record<string, unknown>>;
|
|
18
18
|
}
|
|
19
|
-
export interface
|
|
19
|
+
export interface AgentSubAgentBindingInput {
|
|
20
20
|
readonly slug: string;
|
|
21
21
|
readonly alias?: string;
|
|
22
22
|
readonly modelOverride?: ModelRef;
|
|
23
23
|
readonly instructions?: string;
|
|
24
24
|
readonly permission?: PermissionMap;
|
|
25
25
|
}
|
|
26
|
-
export interface
|
|
26
|
+
export interface AgentOutputSurfaceInput {
|
|
27
27
|
readonly kind: 'none' | 'web' | 'static' | 'app' | 'tunnel';
|
|
28
28
|
readonly port?: number;
|
|
29
29
|
readonly healthPath?: string;
|
|
@@ -32,20 +32,20 @@ export interface CompositionOutputSurfaceInput {
|
|
|
32
32
|
readonly root?: string;
|
|
33
33
|
readonly defaultDocument?: string;
|
|
34
34
|
}
|
|
35
|
-
export interface
|
|
35
|
+
export interface AgentManifestSource {
|
|
36
36
|
readonly agentRef: string;
|
|
37
37
|
readonly primaryAgentSlug: string;
|
|
38
|
-
readonly subAgentBindings: readonly
|
|
39
|
-
readonly mountLayout:
|
|
40
|
-
readonly outputSurface?:
|
|
38
|
+
readonly subAgentBindings: readonly AgentSubAgentBindingInput[];
|
|
39
|
+
readonly mountLayout: AgentMountLayoutInput | undefined;
|
|
40
|
+
readonly outputSurface?: AgentOutputSurfaceInput;
|
|
41
41
|
readonly credentials?: readonly CompiledManifestCredential[];
|
|
42
42
|
readonly permissions?: CompiledManifestPermissions;
|
|
43
43
|
}
|
|
44
|
-
export interface
|
|
44
|
+
export interface AgentManifestImplicitInputs {
|
|
45
45
|
readonly orgId: string;
|
|
46
46
|
readonly projectId: string;
|
|
47
47
|
readonly sessionId?: string;
|
|
48
48
|
}
|
|
49
|
-
export declare function
|
|
50
|
-
export declare function
|
|
49
|
+
export declare function compileAgentWorkspaceManifest(source: AgentManifestSource, bindInputs: Readonly<Record<string, unknown>>): CompiledWorkspaceManifest;
|
|
50
|
+
export declare function buildAgentManifestBindInputs(source: AgentManifestSource, explicitInputs: Record<string, unknown> | null, implicitInputs: AgentManifestImplicitInputs): Readonly<Record<string, unknown>>;
|
|
51
51
|
//# sourceMappingURL=composition-workspace-manifest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composition-workspace-manifest.d.ts","sourceRoot":"","sources":["../../src/lib/composition-workspace-manifest.ts"],"names":[],"mappings":"AA6BA,OAAO,EAIL,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,QAAQ,EACd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAEL,KAAK,yBAAyB,EAU/B,MAAM,gCAAgC,CAAC;AAMxC,YAAY,EAAE,yBAAyB,EAAE,CAAC;AAQ1C,qBAAa,
|
|
1
|
+
{"version":3,"file":"composition-workspace-manifest.d.ts","sourceRoot":"","sources":["../../src/lib/composition-workspace-manifest.ts"],"names":[],"mappings":"AA6BA,OAAO,EAIL,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,QAAQ,EACd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAEL,KAAK,yBAAyB,EAU/B,MAAM,gCAAgC,CAAC;AAMxC,YAAY,EAAE,yBAAyB,EAAE,CAAC;AAQ1C,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAO7C;AA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mB;IAElC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAElC,QAAQ,CAAC,gBAAgB,EAAE,SAAS,yBAAyB,EAAE,CAAC;IAMhE,QAAQ,CAAC,WAAW,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAUxD,QAAQ,CAAC,aAAa,CAAC,EAAE,uBAAuB,CAAC;IAajD,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,0BAA0B,EAAE,CAAC;IAa7D,QAAQ,CAAC,WAAW,CAAC,EAAE,2BAA2B,CAAC;CACpD;AAaD,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAwBD,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,mBAAmB,EAC3B,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAC5C,yBAAyB,CAsG3B;AA0GD,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,mBAAmB,EAC3B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EAC9C,cAAc,EAAE,2BAA2B,GAC1C,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA6CnC"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
3
|
+
exports.AgentMountLayoutError = void 0;
|
|
4
|
+
exports.compileAgentWorkspaceManifest = compileAgentWorkspaceManifest;
|
|
5
|
+
exports.buildAgentManifestBindInputs = buildAgentManifestBindInputs;
|
|
6
6
|
const workflow_1 = require("@xemahq/kernel-contracts/workflow");
|
|
7
7
|
const workspace_manifest_1 = require("@xemahq/dsl/workspace-manifest");
|
|
8
|
-
class
|
|
8
|
+
class AgentMountLayoutError extends Error {
|
|
9
9
|
constructor(agentRef, detail) {
|
|
10
10
|
super(`Cannot derive a workspace mount layout from Agent ` +
|
|
11
11
|
`"${agentRef}": ${detail}`);
|
|
12
|
-
this.name = '
|
|
12
|
+
this.name = 'AgentMountLayoutError';
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
exports.
|
|
16
|
-
function
|
|
15
|
+
exports.AgentMountLayoutError = AgentMountLayoutError;
|
|
16
|
+
function compileAgentWorkspaceManifest(source, bindInputs) {
|
|
17
17
|
const mountLayout = source.mountLayout;
|
|
18
18
|
if (!mountLayout) {
|
|
19
|
-
throw new
|
|
19
|
+
throw new AgentMountLayoutError(source.agentRef, 'the composition declares no `workspace.mountLayout` block — its ' +
|
|
20
20
|
'source workspace manifest was not projected by the llm-registry-api ' +
|
|
21
21
|
'composition seeder. Re-seed compositions (boot llm-registry-api) or ' +
|
|
22
22
|
'fix the source manifest.');
|
|
@@ -75,7 +75,7 @@ function compileCompositionWorkspaceManifest(source, bindInputs) {
|
|
|
75
75
|
};
|
|
76
76
|
const result = (0, workspace_manifest_1.compileManifest)(envelope, bindInputs);
|
|
77
77
|
if (!result.ok) {
|
|
78
|
-
throw new
|
|
78
|
+
throw new AgentMountLayoutError(source.agentRef, `reconstructed manifest failed to compile: ${result.errors
|
|
79
79
|
.map((e) => `${e.path}: ${e.message}`)
|
|
80
80
|
.join('; ')}`);
|
|
81
81
|
}
|
|
@@ -118,19 +118,19 @@ function projectPermissions(permissions) {
|
|
|
118
118
|
},
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function buildAgentManifestBindInputs(source, explicitInputs, implicitInputs) {
|
|
122
122
|
const declared = new Set(Object.keys(source.mountLayout?.inputs ?? {}));
|
|
123
123
|
if (declared.size === 0) {
|
|
124
124
|
return {};
|
|
125
125
|
}
|
|
126
126
|
if (explicitInputs !== null &&
|
|
127
127
|
(typeof explicitInputs !== 'object' || Array.isArray(explicitInputs))) {
|
|
128
|
-
throw new
|
|
128
|
+
throw new AgentMountLayoutError(source.agentRef, 'explicit manifest inputs must be an object when provided');
|
|
129
129
|
}
|
|
130
130
|
const explicit = explicitInputs ?? {};
|
|
131
131
|
for (const [key, value] of Object.entries(explicit)) {
|
|
132
132
|
if (!declared.has(key)) {
|
|
133
|
-
throw new
|
|
133
|
+
throw new AgentMountLayoutError(source.agentRef, `manifest inputs contain undeclared key "${key}"`);
|
|
134
134
|
}
|
|
135
135
|
assertManifestInputValue(source.agentRef, key, value);
|
|
136
136
|
}
|
|
@@ -156,7 +156,7 @@ function buildCompositionManifestBindInputs(source, explicitInputs, implicitInpu
|
|
|
156
156
|
function splitAgentRef(ref) {
|
|
157
157
|
const at = ref.lastIndexOf('@');
|
|
158
158
|
if (at <= 0 || at === ref.length - 1) {
|
|
159
|
-
throw new
|
|
159
|
+
throw new AgentMountLayoutError(ref, 'expected a version-pinned `slug@version` composition ref — the ' +
|
|
160
160
|
'session resolver always pins the resolved version');
|
|
161
161
|
}
|
|
162
162
|
return [ref.slice(0, at), ref.slice(at + 1)];
|
|
@@ -167,12 +167,12 @@ function assertManifestInputValue(agentRef, key, value) {
|
|
|
167
167
|
typeof value !== 'number' &&
|
|
168
168
|
typeof value !== 'boolean' &&
|
|
169
169
|
!Array.isArray(value)) {
|
|
170
|
-
throw new
|
|
170
|
+
throw new AgentMountLayoutError(agentRef, `manifest input "${key}" must be a primitive ` +
|
|
171
171
|
`(string, number, boolean, string[]) — got ${typeof value}`);
|
|
172
172
|
}
|
|
173
173
|
if (Array.isArray(value) &&
|
|
174
174
|
!value.every((entry) => typeof entry === 'string')) {
|
|
175
|
-
throw new
|
|
175
|
+
throw new AgentMountLayoutError(agentRef, `manifest input "${key}" is an array — every element must be a string`);
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
//# sourceMappingURL=composition-workspace-manifest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composition-workspace-manifest.js","sourceRoot":"","sources":["../../src/lib/composition-workspace-manifest.ts"],"names":[],"mappings":";;;AAwPA,
|
|
1
|
+
{"version":3,"file":"composition-workspace-manifest.js","sourceRoot":"","sources":["../../src/lib/composition-workspace-manifest.ts"],"names":[],"mappings":";;;AAwPA,sEAyGC;AA0GD,oEAiDC;AA/dD,gEAO2C;AAE3C,uEAYwC;AAcxC,MAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,QAAgB,EAAE,MAAc;QAC1C,KAAK,CACH,oDAAoD;YAClD,IAAI,QAAQ,MAAM,MAAM,EAAE,CAC7B,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AARD,sDAQC;AAgLD,SAAgB,6BAA6B,CAC3C,MAA2B,EAC3B,UAA6C;IAE7C,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;IACvC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,qBAAqB,CAC7B,MAAM,CAAC,QAAQ,EACf,kEAAkE;YAChE,sEAAsE;YACtE,sEAAsE;YACtE,0BAA0B,CAC7B,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAOvD,MAAM,SAAS,GAAuB,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAC/D,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACZ,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAMhE,GAAG,CAAC,OAAO,CAAC,aAAa,KAAK,SAAS;YACrC,C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AC1B,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EACrB,CAAC;QACD,MAAM,IAAI,qBAAqB,CAC7B,QAAQ,EACR,mBAAmB,GAAG,wBAAwB;YAC5C,6CAA6C,OAAO,KAAK,EAAE,CAC9D,CAAC;IACJ,CAAC;IACD,IACE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,EAClD,CAAC;QACD,MAAM,IAAI,qBAAqB,CAC7B,QAAQ,EACR,mBAAmB,GAAG,gDAAgD,CACvE,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xemahq/agent-session-runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"typescript": "5.9.3"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@xemahq/dsl": "^0.
|
|
40
|
+
"@xemahq/dsl": "^0.4.0",
|
|
41
41
|
"@xemahq/kernel-contracts": "^0.6.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
//
|
|
17
17
|
// Tier-1 functions (collect / walk) copy the canonical agent-session-api
|
|
18
18
|
// resolver semantics EXACTLY: depth-first PRE-ORDER over DESCENDANTS,
|
|
19
|
-
// FIRST-occurrence-by-slug wins. Tier-2 (`
|
|
19
|
+
// FIRST-occurrence-by-slug wins. Tier-2 (`projectAgentToRuntimeConfig`)
|
|
20
20
|
// assembles those into the runtime projection.
|
|
21
21
|
//
|
|
22
22
|
// `RuntimeAgentConfig` lives HERE, not in `@xemahq/kernel-contracts`, because
|
|
@@ -52,10 +52,10 @@ import {
|
|
|
52
52
|
* composition resolver in llm-registry-api owns the wire format, so drift is
|
|
53
53
|
* a platform bug, not a user error. Fail-fast: no silent coercion.
|
|
54
54
|
*/
|
|
55
|
-
export class
|
|
55
|
+
export class AgentResolutionError extends Error {
|
|
56
56
|
constructor(context: string, detail: string) {
|
|
57
57
|
super(`Agent resolution failed for "${context}": ${detail}`);
|
|
58
|
-
this.name = '
|
|
58
|
+
this.name = 'AgentResolutionError';
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -68,7 +68,7 @@ export class CompositionResolutionError extends Error {
|
|
|
68
68
|
* dropped. Mirrors {@link SubAgentBinding} minus the kernel's intrinsic-floor
|
|
69
69
|
* semantics (those are merged downstream, per-consumer).
|
|
70
70
|
*/
|
|
71
|
-
export interface
|
|
71
|
+
export interface FlattenedAgentNode {
|
|
72
72
|
readonly slug: string;
|
|
73
73
|
readonly alias?: string;
|
|
74
74
|
readonly modelOverride?: ModelRef;
|
|
@@ -123,11 +123,11 @@ export interface RuntimeAgentConfig {
|
|
|
123
123
|
* This is where the worker drift is corrected: `modelOverride` is carried on
|
|
124
124
|
* every entry, never dropped.
|
|
125
125
|
*/
|
|
126
|
-
export function
|
|
126
|
+
export function flattenAgentTree(
|
|
127
127
|
root: ResolvedAgentNode,
|
|
128
|
-
): readonly
|
|
128
|
+
): readonly FlattenedAgentNode[] {
|
|
129
129
|
const seen = new Set<string>();
|
|
130
|
-
const out:
|
|
130
|
+
const out: FlattenedAgentNode[] = [];
|
|
131
131
|
const visit = (node: ResolvedAgentNode): void => {
|
|
132
132
|
for (const child of node.children) {
|
|
133
133
|
const slug = child.kernel.slug;
|
|
@@ -215,7 +215,7 @@ export function collectTools(
|
|
|
215
215
|
|
|
216
216
|
/**
|
|
217
217
|
* Per-descendant-slug normalized instructions, keyed by agent slug. Mirrors
|
|
218
|
-
* {@link
|
|
218
|
+
* {@link flattenAgentTree} (DFS pre-order, first-wins). A descendant
|
|
219
219
|
* with no (or whitespace-only) instructions contributes no key.
|
|
220
220
|
*/
|
|
221
221
|
export function collectInstructionsBySlug(
|
|
@@ -354,7 +354,7 @@ export function projectModelOverride(
|
|
|
354
354
|
}
|
|
355
355
|
if (raw.kind === ModelRefKind.CONCRETE) {
|
|
356
356
|
if (typeof raw.modelId !== 'string' || raw.modelId.trim().length === 0) {
|
|
357
|
-
throw new
|
|
357
|
+
throw new AgentResolutionError(
|
|
358
358
|
context,
|
|
359
359
|
'concrete modelOverride is missing a modelId',
|
|
360
360
|
);
|
|
@@ -368,7 +368,7 @@ export function projectModelOverride(
|
|
|
368
368
|
modelClass === undefined ||
|
|
369
369
|
!MODEL_CLASS_VALUES.includes(modelClass as ModelClass)
|
|
370
370
|
) {
|
|
371
|
-
throw new
|
|
371
|
+
throw new AgentResolutionError(
|
|
372
372
|
context,
|
|
373
373
|
`strategy modelOverride.modelClass must be one of ${MODEL_CLASS_VALUES.join(
|
|
374
374
|
', ',
|
|
@@ -410,7 +410,7 @@ function projectToolSelection(
|
|
|
410
410
|
typeof tool.providerKind !== 'string' ||
|
|
411
411
|
!validKinds.has(tool.providerKind)
|
|
412
412
|
) {
|
|
413
|
-
throw new
|
|
413
|
+
throw new AgentResolutionError(
|
|
414
414
|
context,
|
|
415
415
|
`tools[${idx}].providerKind must be one of ${Object.values(
|
|
416
416
|
ToolProviderKind,
|
|
@@ -421,7 +421,7 @@ function projectToolSelection(
|
|
|
421
421
|
typeof tool.resourceId !== 'string' ||
|
|
422
422
|
tool.resourceId.trim().length === 0
|
|
423
423
|
) {
|
|
424
|
-
throw new
|
|
424
|
+
throw new AgentResolutionError(
|
|
425
425
|
context,
|
|
426
426
|
`tools[${idx}].resourceId must be a non-empty string`,
|
|
427
427
|
);
|
|
@@ -437,7 +437,7 @@ function projectToolSelection(
|
|
|
437
437
|
typeof tool.toolName !== 'string' ||
|
|
438
438
|
tool.toolName.trim().length === 0
|
|
439
439
|
) {
|
|
440
|
-
throw new
|
|
440
|
+
throw new AgentResolutionError(
|
|
441
441
|
context,
|
|
442
442
|
`tools[${idx}].toolName must be a non-empty string for kind='tool'`,
|
|
443
443
|
);
|
|
@@ -449,7 +449,7 @@ function projectToolSelection(
|
|
|
449
449
|
toolName: tool.toolName,
|
|
450
450
|
});
|
|
451
451
|
} else {
|
|
452
|
-
throw new
|
|
452
|
+
throw new AgentResolutionError(
|
|
453
453
|
context,
|
|
454
454
|
`tools[${idx}].kind must be "provider" or "tool"`,
|
|
455
455
|
);
|
|
@@ -477,7 +477,7 @@ function projectToolSelection(
|
|
|
477
477
|
* deep-merge against the AGENT's authored permission happens in the
|
|
478
478
|
* downstream materializer, not in this projection).
|
|
479
479
|
*/
|
|
480
|
-
export function
|
|
480
|
+
export function projectAgentToRuntimeConfig(
|
|
481
481
|
resolved: ResolvedAgent,
|
|
482
482
|
overlay?: NodeOverlayFragment,
|
|
483
483
|
): RuntimeAgentConfig {
|
|
@@ -504,7 +504,7 @@ export function projectCompositionToRuntimeConfig(
|
|
|
504
504
|
const rootPermission = normalizePermission(root.permission);
|
|
505
505
|
const overlayPermission = normalizePermission(overlay?.permission);
|
|
506
506
|
|
|
507
|
-
const flattened =
|
|
507
|
+
const flattened = flattenAgentTree(root);
|
|
508
508
|
|
|
509
509
|
return {
|
|
510
510
|
agentRef,
|
|
@@ -62,22 +62,22 @@ export type { CompiledWorkspaceManifest };
|
|
|
62
62
|
* composition ref, or a `compileManifest` failure. Fail-fast: a session /
|
|
63
63
|
* run cannot bootstrap a `/workspace/` tree without a valid mount layout.
|
|
64
64
|
*/
|
|
65
|
-
export class
|
|
65
|
+
export class AgentMountLayoutError extends Error {
|
|
66
66
|
constructor(agentRef: string, detail: string) {
|
|
67
67
|
super(
|
|
68
68
|
`Cannot derive a workspace mount layout from Agent ` +
|
|
69
69
|
`"${agentRef}": ${detail}`,
|
|
70
70
|
);
|
|
71
|
-
this.name = '
|
|
71
|
+
this.name = 'AgentMountLayoutError';
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* The agent run-config the seeder projects from the source manifest's
|
|
77
|
-
* `spec.agent` block. Mirrors `
|
|
77
|
+
* `spec.agent` block. Mirrors `AgentRunConfigDto` without
|
|
78
78
|
* importing the generated client.
|
|
79
79
|
*/
|
|
80
|
-
export interface
|
|
80
|
+
export interface AgentRunConfigInput {
|
|
81
81
|
/** Stage key. */
|
|
82
82
|
readonly stage: string;
|
|
83
83
|
/** Canonical `AgentRunRole` — drives renderer + system-overlay framing. */
|
|
@@ -96,11 +96,11 @@ export interface CompositionAgentRunConfigInput {
|
|
|
96
96
|
* / `inputs` against the manifest DSL's authoritative schema, so the loose
|
|
97
97
|
* typing here is checked downstream, not silently trusted.
|
|
98
98
|
*/
|
|
99
|
-
export interface
|
|
99
|
+
export interface AgentMountLayoutInput {
|
|
100
100
|
/** Raw `spec.mounts` block — manifest DSL mount-declaration map. */
|
|
101
101
|
readonly mounts: Readonly<Record<string, unknown>>;
|
|
102
102
|
/** Projected `spec.agent` run-config. */
|
|
103
|
-
readonly agentRunConfig:
|
|
103
|
+
readonly agentRunConfig: AgentRunConfigInput;
|
|
104
104
|
/** Raw `spec.seedFiles` array — manifest DSL seed-file entries. */
|
|
105
105
|
readonly seedFiles: readonly unknown[];
|
|
106
106
|
/** Raw `spec.inputs` block — manifest DSL input-declaration map. */
|
|
@@ -118,7 +118,7 @@ export interface CompositionMountLayoutInput {
|
|
|
118
118
|
* worker drift). All optional ⇒ backward-compatible with callers that only
|
|
119
119
|
* supply `slug` / `alias`.
|
|
120
120
|
*/
|
|
121
|
-
export interface
|
|
121
|
+
export interface AgentSubAgentBindingInput {
|
|
122
122
|
readonly slug: string;
|
|
123
123
|
readonly alias?: string;
|
|
124
124
|
/** Per-delegate model override — OVERRIDE on the referenced agent's model. */
|
|
@@ -141,7 +141,7 @@ export interface CompositionSubAgentBindingInput {
|
|
|
141
141
|
* same kind/root/port the bundle-apply path reads from
|
|
142
142
|
* `composition.workspace.outputSurface`.
|
|
143
143
|
*/
|
|
144
|
-
export interface
|
|
144
|
+
export interface AgentOutputSurfaceInput {
|
|
145
145
|
readonly kind: 'none' | 'web' | 'static' | 'app' | 'tunnel';
|
|
146
146
|
readonly port?: number;
|
|
147
147
|
readonly healthPath?: string;
|
|
@@ -156,19 +156,19 @@ export interface CompositionOutputSurfaceInput {
|
|
|
156
156
|
* `WorkspaceManifest` from. The caller maps its richer resolved-composition
|
|
157
157
|
* shape onto this — keeping the runtime package free of any API client.
|
|
158
158
|
*/
|
|
159
|
-
export interface
|
|
159
|
+
export interface AgentManifestSource {
|
|
160
160
|
/** Version-pinned `slug@version` of the resolved composition. */
|
|
161
161
|
readonly agentRef: string;
|
|
162
162
|
/** Root node's agent slug — the manifest's primary agent. */
|
|
163
163
|
readonly primaryAgentSlug: string;
|
|
164
164
|
/** Manifest-declared sub-agent bindings (descendant nodes). */
|
|
165
|
-
readonly subAgentBindings: readonly
|
|
165
|
+
readonly subAgentBindings: readonly AgentSubAgentBindingInput[];
|
|
166
166
|
/**
|
|
167
167
|
* The composition's `workspace.mountLayout` block. `undefined` when the
|
|
168
168
|
* composition declared no `workspace` block or the seeder did not project
|
|
169
169
|
* a layout — a fail-fast condition.
|
|
170
170
|
*/
|
|
171
|
-
readonly mountLayout:
|
|
171
|
+
readonly mountLayout: AgentMountLayoutInput | undefined;
|
|
172
172
|
/**
|
|
173
173
|
* The composition's `workspace.outputSurface` block. Threaded into the
|
|
174
174
|
* reconstructed manifest's `spec.outputSurface` so the compiled
|
|
@@ -178,7 +178,7 @@ export interface CompositionManifestSource {
|
|
|
178
178
|
* composition declared no surface — the DSL compile then yields the
|
|
179
179
|
* `{ kind: 'none' }` default.
|
|
180
180
|
*/
|
|
181
|
-
readonly outputSurface?:
|
|
181
|
+
readonly outputSurface?: AgentOutputSurfaceInput;
|
|
182
182
|
/**
|
|
183
183
|
* The composition's `workspace.credentials` block. Threaded into the
|
|
184
184
|
* reconstructed manifest's `spec.credentials` so the compiled manifest's
|
|
@@ -218,7 +218,7 @@ export interface CompositionManifestSource {
|
|
|
218
218
|
* it, and no first-party manifest does today. Optional so a caller with
|
|
219
219
|
* no run-scoped id at all can omit it.
|
|
220
220
|
*/
|
|
221
|
-
export interface
|
|
221
|
+
export interface AgentManifestImplicitInputs {
|
|
222
222
|
readonly orgId: string;
|
|
223
223
|
readonly projectId: string;
|
|
224
224
|
readonly sessionId?: string;
|
|
@@ -242,17 +242,17 @@ type ManifestInputValue =
|
|
|
242
242
|
* shape.
|
|
243
243
|
*
|
|
244
244
|
* `bindInputs` is the resolved manifest input bag (explicit inputs ∪
|
|
245
|
-
* implicit inputs), built by {@link
|
|
245
|
+
* implicit inputs), built by {@link buildAgentManifestBindInputs}.
|
|
246
246
|
* The compile fails fast on an unresolved required input or an enum
|
|
247
247
|
* violation — exactly the legacy behaviour.
|
|
248
248
|
*/
|
|
249
|
-
export function
|
|
250
|
-
source:
|
|
249
|
+
export function compileAgentWorkspaceManifest(
|
|
250
|
+
source: AgentManifestSource,
|
|
251
251
|
bindInputs: Readonly<Record<string, unknown>>,
|
|
252
252
|
): CompiledWorkspaceManifest {
|
|
253
253
|
const mountLayout = source.mountLayout;
|
|
254
254
|
if (!mountLayout) {
|
|
255
|
-
throw new
|
|
255
|
+
throw new AgentMountLayoutError(
|
|
256
256
|
source.agentRef,
|
|
257
257
|
'the composition declares no `workspace.mountLayout` block — its ' +
|
|
258
258
|
'source workspace manifest was not projected by the llm-registry-api ' +
|
|
@@ -333,7 +333,7 @@ export function compileCompositionWorkspaceManifest(
|
|
|
333
333
|
metadata: {
|
|
334
334
|
slug,
|
|
335
335
|
version,
|
|
336
|
-
//
|
|
336
|
+
// Agents resolved for a session bootstrap are, by definition,
|
|
337
337
|
// agent-session compatible — the runtime EnvironmentResolver still
|
|
338
338
|
// re-asserts `surfaceCompat` against the AGENT_SESSION surface.
|
|
339
339
|
surfaceCompat: [ManifestSurface.AGENT_SESSION],
|
|
@@ -343,7 +343,7 @@ export function compileCompositionWorkspaceManifest(
|
|
|
343
343
|
|
|
344
344
|
const result = compileManifest(envelope, bindInputs);
|
|
345
345
|
if (!result.ok) {
|
|
346
|
-
throw new
|
|
346
|
+
throw new AgentMountLayoutError(
|
|
347
347
|
source.agentRef,
|
|
348
348
|
`reconstructed manifest failed to compile: ${result.errors
|
|
349
349
|
.map((e) => `${e.path}: ${e.message}`)
|
|
@@ -355,7 +355,7 @@ export function compileCompositionWorkspaceManifest(
|
|
|
355
355
|
|
|
356
356
|
/**
|
|
357
357
|
* Project the composition's `workspace.outputSurface` block (carried on
|
|
358
|
-
* the runtime-agnostic `
|
|
358
|
+
* the runtime-agnostic `AgentManifestSource`) into the manifest DSL's
|
|
359
359
|
* `ManifestOutputSurface` shape so the reconstructed envelope's
|
|
360
360
|
* `spec.outputSurface` carries the same kind/root/port as the source. The
|
|
361
361
|
* `kind` value strings match the DSL enum 1:1 (`none` / `web` / `static` /
|
|
@@ -366,7 +366,7 @@ export function compileCompositionWorkspaceManifest(
|
|
|
366
366
|
* `{ kind: 'none', autoOpen: false, mode: 'single' }`.
|
|
367
367
|
*/
|
|
368
368
|
function projectOutputSurface(
|
|
369
|
-
surface:
|
|
369
|
+
surface: AgentOutputSurfaceInput | undefined,
|
|
370
370
|
): ManifestOutputSurface | undefined {
|
|
371
371
|
if (!surface) return undefined;
|
|
372
372
|
return {
|
|
@@ -386,7 +386,7 @@ function projectOutputSurface(
|
|
|
386
386
|
|
|
387
387
|
/**
|
|
388
388
|
* Project the composition's `workspace.credentials` block (carried on the
|
|
389
|
-
* runtime-agnostic `
|
|
389
|
+
* runtime-agnostic `AgentManifestSource` as the kernel
|
|
390
390
|
* `CompiledManifestCredential[]`) into the manifest DSL's authored
|
|
391
391
|
* `ManifestCredential[]` shape so the reconstructed envelope's
|
|
392
392
|
* `spec.credentials` carries the same entries as the source.
|
|
@@ -415,7 +415,7 @@ function projectCredentials(
|
|
|
415
415
|
|
|
416
416
|
/**
|
|
417
417
|
* Project the composition's `workspace.permissions` block (carried on the
|
|
418
|
-
* runtime-agnostic `
|
|
418
|
+
* runtime-agnostic `AgentManifestSource` as the kernel
|
|
419
419
|
* `CompiledManifestPermissions`) into the manifest DSL's authored
|
|
420
420
|
* `ManifestPermissions` shape so the reconstructed envelope's
|
|
421
421
|
* `spec.permissions` carries the same tool allow/deny lists as the source.
|
|
@@ -457,10 +457,10 @@ function projectPermissions(
|
|
|
457
457
|
*
|
|
458
458
|
* Returns `{}` when the composition declared no inputs.
|
|
459
459
|
*/
|
|
460
|
-
export function
|
|
461
|
-
source:
|
|
460
|
+
export function buildAgentManifestBindInputs(
|
|
461
|
+
source: AgentManifestSource,
|
|
462
462
|
explicitInputs: Record<string, unknown> | null,
|
|
463
|
-
implicitInputs:
|
|
463
|
+
implicitInputs: AgentManifestImplicitInputs,
|
|
464
464
|
): Readonly<Record<string, unknown>> {
|
|
465
465
|
const declared = new Set(Object.keys(source.mountLayout?.inputs ?? {}));
|
|
466
466
|
if (declared.size === 0) {
|
|
@@ -471,7 +471,7 @@ export function buildCompositionManifestBindInputs(
|
|
|
471
471
|
explicitInputs !== null &&
|
|
472
472
|
(typeof explicitInputs !== 'object' || Array.isArray(explicitInputs))
|
|
473
473
|
) {
|
|
474
|
-
throw new
|
|
474
|
+
throw new AgentMountLayoutError(
|
|
475
475
|
source.agentRef,
|
|
476
476
|
'explicit manifest inputs must be an object when provided',
|
|
477
477
|
);
|
|
@@ -479,7 +479,7 @@ export function buildCompositionManifestBindInputs(
|
|
|
479
479
|
const explicit = explicitInputs ?? {};
|
|
480
480
|
for (const [key, value] of Object.entries(explicit)) {
|
|
481
481
|
if (!declared.has(key)) {
|
|
482
|
-
throw new
|
|
482
|
+
throw new AgentMountLayoutError(
|
|
483
483
|
source.agentRef,
|
|
484
484
|
`manifest inputs contain undeclared key "${key}"`,
|
|
485
485
|
);
|
|
@@ -512,7 +512,7 @@ export function buildCompositionManifestBindInputs(
|
|
|
512
512
|
function splitAgentRef(ref: string): [slug: string, version: string] {
|
|
513
513
|
const at = ref.lastIndexOf('@');
|
|
514
514
|
if (at <= 0 || at === ref.length - 1) {
|
|
515
|
-
throw new
|
|
515
|
+
throw new AgentMountLayoutError(
|
|
516
516
|
ref,
|
|
517
517
|
'expected a version-pinned `slug@version` composition ref — the ' +
|
|
518
518
|
'session resolver always pins the resolved version',
|
|
@@ -539,7 +539,7 @@ function assertManifestInputValue(
|
|
|
539
539
|
typeof value !== 'boolean' &&
|
|
540
540
|
!Array.isArray(value)
|
|
541
541
|
) {
|
|
542
|
-
throw new
|
|
542
|
+
throw new AgentMountLayoutError(
|
|
543
543
|
agentRef,
|
|
544
544
|
`manifest input "${key}" must be a primitive ` +
|
|
545
545
|
`(string, number, boolean, string[]) — got ${typeof value}`,
|
|
@@ -549,7 +549,7 @@ function assertManifestInputValue(
|
|
|
549
549
|
Array.isArray(value) &&
|
|
550
550
|
!value.every((entry) => typeof entry === 'string')
|
|
551
551
|
) {
|
|
552
|
-
throw new
|
|
552
|
+
throw new AgentMountLayoutError(
|
|
553
553
|
agentRef,
|
|
554
554
|
`manifest input "${key}" is an array — every element must be a string`,
|
|
555
555
|
);
|