@xemahq/kernel-contracts 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/agent-composition/lib/capability-layer.d.ts +6 -6
- package/dist/agent-composition/lib/capability-layer.d.ts.map +1 -1
- package/dist/agent-composition/lib/capability-layer.js +3 -3
- package/dist/agent-composition/lib/capability-layer.js.map +1 -1
- package/dist/agent-composition/lib/composition-limits-schema.d.ts +2 -2
- package/dist/agent-composition/lib/composition-limits-schema.d.ts.map +1 -1
- package/dist/agent-composition/lib/composition-limits-schema.js +2 -2
- package/dist/agent-composition/lib/composition-limits-schema.js.map +1 -1
- package/dist/agent-composition/lib/composition-workspace.d.ts +9 -9
- package/dist/agent-composition/lib/composition-workspace.d.ts.map +1 -1
- package/dist/agent-composition/lib/composition-workspace.js +6 -6
- package/dist/agent-composition/lib/composition-workspace.js.map +1 -1
- package/dist/agent-composition/lib/composition.d.ts +22 -22
- package/dist/agent-composition/lib/composition.d.ts.map +1 -1
- package/dist/agent-composition/lib/composition.js +15 -15
- package/dist/agent-composition/lib/composition.js.map +1 -1
- package/dist/agent-workspace/awp-spec.json +1 -1
- package/dist/agent-workspace/index.d.ts +1 -1
- package/dist/agent-workspace/index.d.ts.map +1 -1
- package/dist/agent-workspace/index.js +1 -1
- package/dist/agent-workspace/index.js.map +1 -1
- package/dist/agent-workspace/lib/awp.d.ts +15 -0
- package/dist/agent-workspace/lib/awp.d.ts.map +1 -0
- package/dist/agent-workspace/lib/awp.js +197 -0
- package/dist/agent-workspace/lib/awp.js.map +1 -0
- package/dist/contribution/lib/contribution-kind.d.ts +1 -1
- package/dist/contribution/lib/contribution-kind.d.ts.map +1 -1
- package/dist/contribution/lib/contribution-kind.js +1 -1
- package/dist/contribution/lib/contribution-kind.js.map +1 -1
- package/dist/invocation/lib/invocation-record.d.ts +1 -1
- package/dist/invocation/lib/invocation-record.d.ts.map +1 -1
- package/dist/invocation/lib/invocation-record.js +1 -1
- package/dist/invocation/lib/invocation-record.js.map +1 -1
- package/dist/invocation/lib/invoke-request.d.ts +3 -3
- package/dist/invocation/lib/invoke-request.d.ts.map +1 -1
- package/dist/invocation/lib/invoke-request.js +3 -3
- package/dist/invocation/lib/invoke-request.js.map +1 -1
- package/dist/invocation/lib/invoke-response.d.ts +2 -2
- package/dist/invocation/lib/invoke-response.d.ts.map +1 -1
- package/dist/invocation/lib/invoke-response.js +2 -2
- package/dist/invocation/lib/invoke-response.js.map +1 -1
- package/dist/object/lib/xema-object-kind.d.ts +1 -1
- package/dist/object/lib/xema-object-kind.d.ts.map +1 -1
- package/dist/object/lib/xema-object-kind.js +1 -1
- package/dist/object/lib/xema-object-kind.js.map +1 -1
- package/dist/workflow/lib/mount-plan.d.ts +1 -1
- package/dist/workflow/lib/mount-plan.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/agent-composition/index.ts +2 -2
- package/src/agent-composition/lib/capability-layer.ts +9 -9
- package/src/agent-composition/lib/composition-limits-schema.ts +4 -4
- package/src/agent-composition/lib/composition-workspace.ts +18 -18
- package/src/agent-composition/lib/composition.ts +28 -28
- package/src/agent-composition/lib/invocation-overlay.ts +1 -1
- package/src/agent-workspace/index.ts +1 -1
- package/src/agent-workspace/lib/working-file.ts +1 -1
- package/src/agent-workspace/lib/workspace-spec.ts +3 -3
- package/src/biome-availability/lib/biome-availability.ts +3 -3
- package/src/contribution/lib/contribution-kind.ts +1 -1
- package/src/contribution/lib/contribution-source.ts +1 -1
- package/src/distribution/lib/distribution.ts +1 -1
- package/src/document-templates/lib/document-template.ts +1 -1
- package/src/invocation/lib/execution-requirements.ts +1 -1
- package/src/invocation/lib/invocation-mode.ts +1 -1
- package/src/invocation/lib/invocation-record.ts +2 -2
- package/src/invocation/lib/invoke-request.ts +7 -7
- package/src/invocation/lib/invoke-response.ts +3 -3
- package/src/object/lib/object-lifecycle.ts +1 -1
- package/src/object/lib/xema-object-kind.ts +2 -2
- package/src/object/lib/xema-object.ts +2 -2
- package/src/workflow/lib/compiled-run.ts +3 -3
- package/src/workflow/lib/compiled-workspace-manifest.ts +1 -1
- package/src/workflow/lib/model-ref.ts +1 -1
- package/src/workflow/lib/mount-plan.ts +1 -1
- /package/src/agent-workspace/lib/{awp-v1.ts → awp.ts} +0 -0
|
@@ -147,7 +147,7 @@ export interface SlotDefinition {
|
|
|
147
147
|
/**
|
|
148
148
|
* Workspace-relative paths captured on session pause and restored on
|
|
149
149
|
* resume, plus per-slot policy overrides. The authoritative SOURCE of
|
|
150
|
-
* these values is the authored `
|
|
150
|
+
* these values is the authored `Agent.workspace.persistence` block
|
|
151
151
|
* (`@xemahq/agent-composition-contracts`); they are projected onto
|
|
152
152
|
* `WorkspaceSpec` so workspace-tree consumers (session lifecycle,
|
|
153
153
|
* workspace-proxy snapshot pipeline) read them off one resolved spec
|
|
@@ -185,7 +185,7 @@ export interface WorkspaceSpec {
|
|
|
185
185
|
readonly slots: readonly SlotDefinition[];
|
|
186
186
|
/**
|
|
187
187
|
* Workspace-relative persist-paths + per-slot policy overrides.
|
|
188
|
-
* Projected from `
|
|
188
|
+
* Projected from `Agent.workspace.persistence`. Optional — when
|
|
189
189
|
* absent the workspace persists only what the slots' own
|
|
190
190
|
* `persistencePolicy` fields declare. Additive: pre-existing consumers
|
|
191
191
|
* that never read this field keep compiling.
|
|
@@ -193,7 +193,7 @@ export interface WorkspaceSpec {
|
|
|
193
193
|
readonly persistence?: WorkspacePersistenceSpec;
|
|
194
194
|
/**
|
|
195
195
|
* Environment variables applied to the agent runtime before dispatch.
|
|
196
|
-
* Projected from `
|
|
196
|
+
* Projected from `Agent.workspace.env`. Optional / additive —
|
|
197
197
|
* absent means the composition declared no env block.
|
|
198
198
|
*/
|
|
199
199
|
readonly env?: readonly WorkspaceEnvVar[];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
2
2
|
// ── Biome Availability Filter — per-definition opt-in/opt-out (DBM.2) ──
|
|
3
3
|
//
|
|
4
|
-
// A definition (an Agent
|
|
4
|
+
// A definition (an Agent node, an Agent definition, a workflow
|
|
5
5
|
// job, a Session) MAY declare which biomes' contributions it wants in or out.
|
|
6
6
|
// This is a POST-SCOPE FILTER applied AFTER implicit-by-scope resolution
|
|
7
|
-
// (the 5-tier `SkillScope`/`
|
|
7
|
+
// (the 5-tier `SkillScope`/`AgentSpace` precedence): it NARROWS the
|
|
8
8
|
// already-visible set; it never widens it and it is NOT a parallel
|
|
9
9
|
// availability/binding table (see `.claude/rules/skills-and-composition.md`).
|
|
10
10
|
//
|
|
@@ -54,7 +54,7 @@ export interface BiomeAvailabilityFilter {
|
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* The shape a definition mixes in to gain the optional biome opt-in/opt-out
|
|
57
|
-
* knob. Mixed into `
|
|
57
|
+
* knob. Mixed into `AgentNode`, the Agent definition contract, the
|
|
58
58
|
* workflow job/stage contract, and the Session shape so the field has ONE
|
|
59
59
|
* declaration site (no per-shape restating).
|
|
60
60
|
*/
|
|
@@ -25,7 +25,7 @@ export enum ContributionKind {
|
|
|
25
25
|
ChartRuntime = 'chart-runtime',
|
|
26
26
|
PresentationRuntime = 'presentation-runtime',
|
|
27
27
|
AgentSkill = 'agent-skill',
|
|
28
|
-
|
|
28
|
+
AgentKernel = 'agent-kernel',
|
|
29
29
|
ModelResolutionDimension = 'model-resolution-dimension',
|
|
30
30
|
WidgetKind = 'widget-kind',
|
|
31
31
|
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* `ContributionSource` is the 5-tier scope at which a Contribution lives.
|
|
5
|
-
* Value-identical to `SkillSpace` and `
|
|
5
|
+
* Value-identical to `SkillSpace` and `AgentSpace` (see
|
|
6
6
|
* `.claude/rules/skills-and-composition.md`) — the three enums share ONE
|
|
7
7
|
* ownership / scope model and must not drift.
|
|
8
8
|
*
|
|
@@ -53,7 +53,7 @@ export const DistributionPlatformServiceSchema = z.object({
|
|
|
53
53
|
* is deployed (the deployment plane). It contains PACKAGING fields only — no
|
|
54
54
|
* infra/deploy/values config (that lives in the deployment overlay).
|
|
55
55
|
*
|
|
56
|
-
*
|
|
56
|
+
* Agent: `extends` names a parent distribution; the resolver composes
|
|
57
57
|
* parent → child, with the child's `include`/`exclude` overriding. The resolver
|
|
58
58
|
* enforces (fail-fast): kernel-tier biomes are always included and cannot be
|
|
59
59
|
* excluded; an included biome whose `requires` are absent is an error; selectors
|
|
@@ -51,7 +51,7 @@ export enum DocumentTemplateScope {
|
|
|
51
51
|
* not interpret the strings, just hands them to skill-registry-api.
|
|
52
52
|
*
|
|
53
53
|
* `subAgents` are agent slugs delegated as sub-agents on the session's
|
|
54
|
-
* Agent
|
|
54
|
+
* Agent. The bar for declaring one is "needs its own model,
|
|
55
55
|
* tools, or context"; most templates leave this empty and rely on
|
|
56
56
|
* sub-skills (cheap, shared context).
|
|
57
57
|
*
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
* Per-invocation hard limits. None are required at the contract level; an
|
|
11
11
|
* absent field means "no caller-declared limit on this axis" (the platform may
|
|
12
12
|
* still apply its own). These map directly onto the existing `composition.limits`
|
|
13
|
-
* consumed by `
|
|
13
|
+
* consumed by `AgentBudgetEnforcer` — no new enforcement engine.
|
|
14
14
|
*/
|
|
15
15
|
export interface InvocationLimits {
|
|
16
16
|
readonly maxDurationMs?: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* How the
|
|
4
|
+
* How the Agent Invocation Runtime executes an invocation.
|
|
5
5
|
*
|
|
6
6
|
* The platform owns mode selection (deterministic `selectMode`): a biome MAY
|
|
7
7
|
* hint a mode via `ExecutionRequirements.mode`, but policy may override it.
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
*/
|
|
17
17
|
export interface InvocationRecord {
|
|
18
18
|
readonly id: string;
|
|
19
|
-
readonly
|
|
19
|
+
readonly agentRef: string;
|
|
20
20
|
readonly orgId: string;
|
|
21
21
|
readonly projectId: string | null;
|
|
22
22
|
readonly threadKey: string;
|
|
@@ -38,7 +38,7 @@ export interface InvocationRecord {
|
|
|
38
38
|
|
|
39
39
|
export const InvocationRecordSchema = z.object({
|
|
40
40
|
id: z.string().min(1),
|
|
41
|
-
|
|
41
|
+
agentRef: z.string().min(1),
|
|
42
42
|
orgId: z.string().min(1),
|
|
43
43
|
projectId: z.string().min(1).nullable(),
|
|
44
44
|
threadKey: z.string().min(1),
|
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
* The wire body for `composition:invoke@1` — what a caller sends through the
|
|
9
9
|
* capability funnel to execute a published composition.
|
|
10
10
|
*
|
|
11
|
-
* `
|
|
11
|
+
* `AgentInvokeRequestSchema` is the fail-fast validator the runtime
|
|
12
12
|
* applies at the wire boundary before any execution.
|
|
13
13
|
*/
|
|
14
|
-
export interface
|
|
15
|
-
/**
|
|
16
|
-
readonly
|
|
14
|
+
export interface AgentInvokeRequest {
|
|
15
|
+
/** Agent slug or `slug@version`. */
|
|
16
|
+
readonly agentRef: string;
|
|
17
17
|
readonly orgId: string;
|
|
18
18
|
readonly projectId?: string;
|
|
19
19
|
/** Stable execution-context key — org+mailbox+emailThreadId for mail. */
|
|
@@ -23,12 +23,12 @@ export interface CompositionInvokeRequest {
|
|
|
23
23
|
readonly requirements: ExecutionRequirements;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export const
|
|
27
|
-
|
|
26
|
+
export const AgentInvokeRequestSchema = z.object({
|
|
27
|
+
agentRef: z.string().min(1),
|
|
28
28
|
orgId: z.string().min(1),
|
|
29
29
|
projectId: z.string().min(1).optional(),
|
|
30
30
|
threadKey: z.string().min(1),
|
|
31
31
|
correlationId: z.string().min(1).optional(),
|
|
32
32
|
input: z.record(z.string(), z.unknown()),
|
|
33
33
|
requirements: ExecutionRequirementsSchema,
|
|
34
|
-
}) as z.ZodType<
|
|
34
|
+
}) as z.ZodType<AgentInvokeRequest>;
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
* `Event` mode `output` is omitted and the consumer subscribes to the result
|
|
14
14
|
* completion event instead.
|
|
15
15
|
*/
|
|
16
|
-
export interface
|
|
16
|
+
export interface AgentInvokeResponse {
|
|
17
17
|
readonly invocationId: string;
|
|
18
18
|
readonly status: InvocationStatus;
|
|
19
19
|
readonly mode: InvocationMode;
|
|
@@ -26,7 +26,7 @@ export interface CompositionInvokeResponse {
|
|
|
26
26
|
readonly auditId?: string;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export const
|
|
29
|
+
export const AgentInvokeResponseSchema = z.object({
|
|
30
30
|
invocationId: z.string().min(1),
|
|
31
31
|
status: InvocationStatusSchema,
|
|
32
32
|
mode: InvocationModeSchema,
|
|
@@ -36,4 +36,4 @@ export const CompositionInvokeResponseSchema = z.object({
|
|
|
36
36
|
durationMs: z.number().optional(),
|
|
37
37
|
modelRef: z.string().min(1).optional(),
|
|
38
38
|
auditId: z.string().min(1).optional(),
|
|
39
|
-
}) as z.ZodType<
|
|
39
|
+
}) as z.ZodType<AgentInvokeResponse>;
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Lifecycle every versioned XemaObject moves through. Mirrors
|
|
5
|
-
* `
|
|
5
|
+
* `AgentLifecycle` from `@xemahq/agent-composition-contracts` —
|
|
6
6
|
* the two enums MUST stay value-identical (one ownership model across
|
|
7
7
|
* the four primitives + every other XemaObject kind, per
|
|
8
8
|
* `.claude/rules/skills-and-composition.md`).
|
|
@@ -19,9 +19,9 @@ export enum XemaObjectKind {
|
|
|
19
19
|
ExternalSubject = 'external-subject',
|
|
20
20
|
DelegatedSession = 'delegated-session',
|
|
21
21
|
|
|
22
|
-
// Agent runtime primitives
|
|
22
|
+
// Agent runtime primitives — a base kernel armed into an Agent
|
|
23
|
+
AgentKernel = 'agent-kernel',
|
|
23
24
|
Agent = 'agent',
|
|
24
|
-
AgentComposition = 'agent-composition',
|
|
25
25
|
Skill = 'skill',
|
|
26
26
|
Tool = 'tool',
|
|
27
27
|
Model = 'model',
|
|
@@ -35,11 +35,11 @@ export const SubjectRefSchema = z.object({
|
|
|
35
35
|
* - `ref` is the wire-stable address (`XemaObjectRef`).
|
|
36
36
|
* - `kind` is the closed `XemaObjectKind` enum value.
|
|
37
37
|
* - `scope` is the 5-tier ownership reference (single ownership model
|
|
38
|
-
* shared with `SkillSpace` / `
|
|
38
|
+
* shared with `SkillSpace` / `AgentSpace`).
|
|
39
39
|
* - `owner` is the subject that owns the object.
|
|
40
40
|
* - `version` is a semver string. Resolution serves only `Published`
|
|
41
41
|
* versions per `ObjectLifecycle` semantics.
|
|
42
|
-
* - `lifecycle` mirrors `
|
|
42
|
+
* - `lifecycle` mirrors `AgentLifecycle` (draft/published/archived).
|
|
43
43
|
* - `payload` is kind-specific; the resolved schema is supplied by the
|
|
44
44
|
* owning domain contract package.
|
|
45
45
|
*/
|
|
@@ -14,9 +14,9 @@ import type { WorkflowVariableRequirement } from './variable-requirement';
|
|
|
14
14
|
* Pre-resolved manifest source for `xema/agent`-shaped jobs. The
|
|
15
15
|
* workflow-dsl compiler emits exactly one variant per agent step:
|
|
16
16
|
*
|
|
17
|
-
* • `ref` — long-form `with.
|
|
17
|
+
* • `ref` — long-form `with.agentRef: <slug>` (or
|
|
18
18
|
* `<slug>@<version>`) that the activity resolves at boot via
|
|
19
|
-
* llm-registry-api's Agent
|
|
19
|
+
* llm-registry-api's Agent `GET /compositions/resolve/
|
|
20
20
|
* :ref`, reconstructing the compiled workspace manifest from the
|
|
21
21
|
* resolved composition's `workspace.mountLayout` block.
|
|
22
22
|
* • `inline` — short-form `with.mounts` whose agent metadata
|
|
@@ -30,7 +30,7 @@ import type { WorkflowVariableRequirement } from './variable-requirement';
|
|
|
30
30
|
*
|
|
31
31
|
* `null` for non-agent actions (compileManifestSource short-circuits
|
|
32
32
|
* when the action manifest's `inputs.properties` lacks both
|
|
33
|
-
* `
|
|
33
|
+
* `agentRef` and `mounts`).
|
|
34
34
|
*/
|
|
35
35
|
export type CompiledManifestSource =
|
|
36
36
|
| { readonly kind: 'ref'; readonly ref: string }
|
|
@@ -80,7 +80,7 @@ export interface CompiledManifestAgent {
|
|
|
80
80
|
* manifest's `spec.agent.instructions` (WS5 Phase B: author a migrated
|
|
81
81
|
* agent as `base agent slug + instructions`). A prompt fragment the
|
|
82
82
|
* runtime layers ONTO the referenced base agent's intrinsic system
|
|
83
|
-
* prompt — semantically the same as `
|
|
83
|
+
* prompt — semantically the same as `AgentNode.instructions`.
|
|
84
84
|
* Absent = the base agent's prompt passes through unchanged.
|
|
85
85
|
*/
|
|
86
86
|
readonly instructions?: string;
|
|
@@ -148,7 +148,7 @@ export function isStrategyModelRef(ref: ModelRef): ref is StrategyModelRef {
|
|
|
148
148
|
* The INVOCATION-overlay fragment shared by EVERY "agent node" shape — the
|
|
149
149
|
* genuinely-identical trio that specializes a referenced agent WITHOUT
|
|
150
150
|
* authoring a new definition. Single declaration site (the
|
|
151
|
-
* `ModelRef`/`PermissionMap` reuse pattern): `
|
|
151
|
+
* `ModelRef`/`PermissionMap` reuse pattern): `AgentNode`,
|
|
152
152
|
* `SubAgentBinding`, the compiled manifest agent block, and the typed
|
|
153
153
|
* workflow/session invocation overlays all `extends` this — the trio is
|
|
154
154
|
* never restated per shape.
|
|
@@ -113,7 +113,7 @@ export type MountSource =
|
|
|
113
113
|
| { readonly kind: 'static-literal'; readonly pathWithinWorkspace: string; readonly bytes: string }
|
|
114
114
|
// Platform-rendered (PR 1 of unified-workspace-image refactor):
|
|
115
115
|
| {
|
|
116
|
-
readonly kind: 'agent-
|
|
116
|
+
readonly kind: 'agent-kernel';
|
|
117
117
|
readonly orgId: string;
|
|
118
118
|
readonly agentSlug: string;
|
|
119
119
|
readonly stageKey: string;
|
|
File without changes
|