@xemahq/agent-session-runtime 0.5.0 → 0.6.1
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/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-resolution.d.ts +43 -0
- package/dist/lib/agent-resolution.d.ts.map +1 -0
- package/dist/lib/agent-resolution.js +236 -0
- package/dist/lib/agent-resolution.js.map +1 -0
- package/dist/lib/agent-workspace-manifest.d.ts +51 -0
- package/dist/lib/agent-workspace-manifest.d.ts.map +1 -0
- package/dist/lib/agent-workspace-manifest.js +178 -0
- package/dist/lib/agent-workspace-manifest.js.map +1 -0
- 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 +7 -4
- package/src/index.ts +2 -2
- package/src/lib/{composition-resolution.ts → agent-resolution.ts} +16 -16
- package/src/lib/{composition-workspace-manifest.ts → agent-workspace-manifest.ts} +31 -31
|
@@ -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
|
);
|