@xemahq/kernel-contracts 0.3.7 → 0.4.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/composition-workspace.d.ts +1 -1
- package/dist/agent-composition/lib/model-resolution-matrix.d.ts +3 -3
- package/dist/agent-composition/lib/model-resolution-matrix.js +1 -1
- package/dist/agent-workspace/awp-spec.json +1 -1
- package/dist/agent-workspace/lib/context-json.d.ts +1 -1
- package/dist/llm-gateway/lib/caller.d.ts +1 -1
- package/dist/workflow/lib/compiled-workspace-manifest.d.ts +1 -1
- package/dist/workflow/lib/mount-plan.d.ts +3 -3
- package/package.json +1 -1
- package/src/agent-composition/lib/composition-workspace.ts +4 -4
- package/src/agent-composition/lib/model-resolution-matrix.ts +9 -9
- package/src/agent-workspace/lib/context-json.ts +1 -1
- package/src/llm-gateway/lib/caller.ts +4 -4
- package/src/workflow/lib/compiled-run.ts +1 -1
- package/src/workflow/lib/compiled-workspace-manifest.ts +1 -1
- package/src/workflow/lib/mount-plan.ts +3 -3
- package/src/workflow/lib/workflow-stage.ts +2 -2
|
@@ -15,7 +15,7 @@ export interface CompositionOutputSurface {
|
|
|
15
15
|
readonly defaultDocument?: string;
|
|
16
16
|
}
|
|
17
17
|
export interface CompositionAgentRunConfig {
|
|
18
|
-
readonly
|
|
18
|
+
readonly stage: string;
|
|
19
19
|
readonly role: AgentRunRole;
|
|
20
20
|
readonly deliverableSpecRef?: string;
|
|
21
21
|
}
|
|
@@ -3,14 +3,14 @@ export declare enum ResolutionDimension {
|
|
|
3
3
|
Agent = "agent",
|
|
4
4
|
Skill = "skill",
|
|
5
5
|
Project = "project",
|
|
6
|
-
|
|
6
|
+
Stage = "stage",
|
|
7
7
|
Purpose = "purpose"
|
|
8
8
|
}
|
|
9
9
|
export interface ModelMatrixSelector {
|
|
10
10
|
readonly agent?: string;
|
|
11
11
|
readonly skill?: string;
|
|
12
12
|
readonly project?: string;
|
|
13
|
-
readonly
|
|
13
|
+
readonly stage?: string;
|
|
14
14
|
readonly purpose?: string;
|
|
15
15
|
readonly extra?: Readonly<Record<string, string>>;
|
|
16
16
|
}
|
|
@@ -24,7 +24,7 @@ export interface ModelResolutionContext {
|
|
|
24
24
|
readonly agentSlug: string;
|
|
25
25
|
readonly projectId?: string;
|
|
26
26
|
readonly skillSlug?: string;
|
|
27
|
-
readonly
|
|
27
|
+
readonly stageKey?: string;
|
|
28
28
|
readonly purpose?: string;
|
|
29
29
|
readonly extra?: Readonly<Record<string, string>>;
|
|
30
30
|
}
|
|
@@ -6,7 +6,7 @@ var ResolutionDimension;
|
|
|
6
6
|
ResolutionDimension["Agent"] = "agent";
|
|
7
7
|
ResolutionDimension["Skill"] = "skill";
|
|
8
8
|
ResolutionDimension["Project"] = "project";
|
|
9
|
-
ResolutionDimension["
|
|
9
|
+
ResolutionDimension["Stage"] = "stage";
|
|
10
10
|
ResolutionDimension["Purpose"] = "purpose";
|
|
11
11
|
})(ResolutionDimension || (exports.ResolutionDimension = ResolutionDimension = {}));
|
|
12
12
|
//# sourceMappingURL=model-resolution-matrix.js.map
|
|
@@ -8,7 +8,7 @@ export interface ContextInvocation {
|
|
|
8
8
|
readonly surface: InvocationSurface;
|
|
9
9
|
readonly attempt: number;
|
|
10
10
|
readonly runId: string | null;
|
|
11
|
-
readonly
|
|
11
|
+
readonly stageKey: string | null;
|
|
12
12
|
readonly sessionId: string | null;
|
|
13
13
|
}
|
|
14
14
|
export interface ContextAuthority {
|
|
@@ -28,7 +28,7 @@ export interface CompiledWorkspaceManifest {
|
|
|
28
28
|
}
|
|
29
29
|
export interface CompiledManifestAgent {
|
|
30
30
|
readonly slug: string;
|
|
31
|
-
readonly
|
|
31
|
+
readonly stageKey: string;
|
|
32
32
|
readonly role: AgentRunRole;
|
|
33
33
|
readonly deliverableSpecRef?: string;
|
|
34
34
|
readonly defaultModel?: ModelRef;
|
|
@@ -53,7 +53,7 @@ export type MountSource = {
|
|
|
53
53
|
readonly kind: 'agent-definition';
|
|
54
54
|
readonly orgId: string;
|
|
55
55
|
readonly agentSlug: string;
|
|
56
|
-
readonly
|
|
56
|
+
readonly stageKey: string;
|
|
57
57
|
readonly agentMode: 'primary' | 'subagent';
|
|
58
58
|
} | {
|
|
59
59
|
readonly kind: 'skill-bundle';
|
|
@@ -63,7 +63,7 @@ export type MountSource = {
|
|
|
63
63
|
readonly orgId: string;
|
|
64
64
|
readonly sectionKey: string;
|
|
65
65
|
readonly agentSlug?: string;
|
|
66
|
-
readonly
|
|
66
|
+
readonly stageKey?: string;
|
|
67
67
|
} | ({
|
|
68
68
|
readonly kind: 'rendered-agents-md';
|
|
69
69
|
} & RenderedAgentRunContextParams) | ({
|
|
@@ -75,7 +75,7 @@ export interface RenderedAgentRunContextParams {
|
|
|
75
75
|
readonly orgId: string;
|
|
76
76
|
readonly projectId: string;
|
|
77
77
|
readonly agentSlug: string;
|
|
78
|
-
readonly
|
|
78
|
+
readonly stageKey: string;
|
|
79
79
|
readonly role: AgentRunRole;
|
|
80
80
|
readonly sessionId?: string;
|
|
81
81
|
readonly runId?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xemahq/kernel-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Consolidated Xema OS kernel wire contracts — pure types + zod schemas for the 32 kernel protocol surfaces. One package, one npm scope, wildcard per-surface subpath exports. No framework/runtime deps.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -93,17 +93,17 @@ export interface CompositionOutputSurface {
|
|
|
93
93
|
/**
|
|
94
94
|
* The agent run-config the composer needs that is NOT carried by the
|
|
95
95
|
* `CompositionNode` tree. The node tree pins WHICH agent runs; these
|
|
96
|
-
* three fields pin the run FRAMING (
|
|
96
|
+
* three fields pin the run FRAMING (stage + role + deliverable
|
|
97
97
|
* contract) the renderer + system-overlay are driven by.
|
|
98
98
|
*
|
|
99
|
-
* `role` is the canonical {@link AgentRunRole}. `
|
|
99
|
+
* `role` is the canonical {@link AgentRunRole}. `stage` /
|
|
100
100
|
* `deliverableSpecRef` are carried verbatim from the source manifest's
|
|
101
101
|
* `spec.agent` block — they MAY still hold a `${input.x}` token, which
|
|
102
102
|
* the workspace pipeline resolves against the run's bind inputs (the
|
|
103
103
|
* same fail-fast interpolation grammar `env` values use).
|
|
104
104
|
*/
|
|
105
105
|
export interface CompositionAgentRunConfig {
|
|
106
|
-
readonly
|
|
106
|
+
readonly stage: string;
|
|
107
107
|
readonly role: AgentRunRole;
|
|
108
108
|
readonly deliverableSpecRef?: string;
|
|
109
109
|
}
|
|
@@ -143,7 +143,7 @@ export interface CompositionMountLayout {
|
|
|
143
143
|
* slots are NEVER present — the composer auto-emits them.
|
|
144
144
|
*/
|
|
145
145
|
readonly mounts: Readonly<Record<string, unknown>>;
|
|
146
|
-
/** Agent run-config (
|
|
146
|
+
/** Agent run-config (stage + role + deliverable contract). */
|
|
147
147
|
readonly agentRunConfig: CompositionAgentRunConfig;
|
|
148
148
|
/**
|
|
149
149
|
* Raw `spec.seedFiles` array — manifest DSL `ManifestSeedFile`
|
|
@@ -18,20 +18,20 @@
|
|
|
18
18
|
import type { ModelRef } from '../../workflow';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* Open registry of matrix dimensions. v1 ships agent/skill/project/
|
|
21
|
+
* Open registry of matrix dimensions. v1 ships agent/skill/project/stage;
|
|
22
22
|
* v1.1 adds `purpose` for non-agent invocations (memory summarization,
|
|
23
23
|
* embedding, reorganization). New dimensions are added here + carried in
|
|
24
24
|
* `ModelMatrixSelector.extra` (untyped) or as a typed first-class field.
|
|
25
25
|
*
|
|
26
|
-
* The `
|
|
27
|
-
* structural
|
|
28
|
-
* its `
|
|
26
|
+
* The `stage` dimension is the kernel-neutral name for a sub-app's
|
|
27
|
+
* structural workflow-stage tag on a job (e.g. the software-dev biome maps
|
|
28
|
+
* its `stageKey:` YAML field onto this dimension at compile time).
|
|
29
29
|
*/
|
|
30
30
|
export enum ResolutionDimension {
|
|
31
31
|
Agent = 'agent',
|
|
32
32
|
Skill = 'skill',
|
|
33
33
|
Project = 'project',
|
|
34
|
-
|
|
34
|
+
Stage = 'stage',
|
|
35
35
|
Purpose = 'purpose',
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -47,11 +47,11 @@ export interface ModelMatrixSelector {
|
|
|
47
47
|
/** Match when the invocation's project id equals this value. */
|
|
48
48
|
readonly project?: string;
|
|
49
49
|
/**
|
|
50
|
-
* Match when the invocation's structural
|
|
51
|
-
* Kernel-neutral name; the software-dev biome's `
|
|
50
|
+
* Match when the invocation's structural stage key equals this value.
|
|
51
|
+
* Kernel-neutral name; the software-dev biome's `stageKey:` YAML field
|
|
52
52
|
* is mapped onto this dimension by the DSL compiler.
|
|
53
53
|
*/
|
|
54
|
-
readonly
|
|
54
|
+
readonly stage?: string;
|
|
55
55
|
/**
|
|
56
56
|
* Match when the invocation's non-agent purpose equals this value. Used
|
|
57
57
|
* for system flows that route LLM calls outside the agent/skill model —
|
|
@@ -84,7 +84,7 @@ export interface ModelResolutionContext {
|
|
|
84
84
|
readonly agentSlug: string;
|
|
85
85
|
readonly projectId?: string;
|
|
86
86
|
readonly skillSlug?: string;
|
|
87
|
-
readonly
|
|
87
|
+
readonly stageKey?: string;
|
|
88
88
|
/**
|
|
89
89
|
* Non-agent invocation purpose (e.g. memory summarization/embedding).
|
|
90
90
|
* Optional — agent and skill invocations leave this undefined.
|
|
@@ -32,9 +32,9 @@ export enum LlmCallerKind {
|
|
|
32
32
|
* - `kind` + `id` together identify the originating object.
|
|
33
33
|
* - `orgId` is always present (billing/audit anchor).
|
|
34
34
|
* - `projectId` is set when the call is project-scoped (most are).
|
|
35
|
-
* - `
|
|
36
|
-
*
|
|
37
|
-
* maps its own `
|
|
35
|
+
* - `stageKey` is set when the caller is tied to a workflow's structural
|
|
36
|
+
* stage bucket. Kernel-neutral name; a sub-app biome (e.g. software-dev)
|
|
37
|
+
* maps its own `stageKey` YAML value onto this field at compile time.
|
|
38
38
|
*
|
|
39
39
|
* Adding new fields is non-breaking; renaming or repurposing existing
|
|
40
40
|
* ones is breaking and requires updates on both gateway and consumers.
|
|
@@ -44,5 +44,5 @@ export interface LlmCaller {
|
|
|
44
44
|
id: string;
|
|
45
45
|
orgId: string;
|
|
46
46
|
projectId?: string;
|
|
47
|
-
|
|
47
|
+
stageKey?: string;
|
|
48
48
|
}
|
|
@@ -19,7 +19,7 @@ import type { WorkflowVariableRequirement } from './variable-requirement';
|
|
|
19
19
|
* :ref`, reconstructing the compiled workspace manifest from the
|
|
20
20
|
* resolved composition's `workspace.mountLayout` block.
|
|
21
21
|
* • `inline` — short-form `with.mounts` whose agent metadata
|
|
22
|
-
* (`agentSlug`, `
|
|
22
|
+
* (`agentSlug`, `stageKey`, `deliverableSpecRef`, every entry in
|
|
23
23
|
* `mounts`) is fully literal at compile time. The compiler runs
|
|
24
24
|
* `compileManifest()` once and embeds the result so the worker
|
|
25
25
|
* skips both the DB round-trip and the runtime synthesis step.
|
|
@@ -66,7 +66,7 @@ export interface CompiledWorkspaceManifest {
|
|
|
66
66
|
|
|
67
67
|
export interface CompiledManifestAgent {
|
|
68
68
|
readonly slug: string;
|
|
69
|
-
readonly
|
|
69
|
+
readonly stageKey: string;
|
|
70
70
|
/**
|
|
71
71
|
* Canonical {@link AgentRunRole}. Validated by the DSL's
|
|
72
72
|
* `ManifestAgentBlockSchema` at compile time, so the runtime can
|
|
@@ -116,7 +116,7 @@ export type MountSource =
|
|
|
116
116
|
readonly kind: 'agent-definition';
|
|
117
117
|
readonly orgId: string;
|
|
118
118
|
readonly agentSlug: string;
|
|
119
|
-
readonly
|
|
119
|
+
readonly stageKey: string;
|
|
120
120
|
/**
|
|
121
121
|
* Frontmatter `mode` for the rendered .opencode/agents/<slug>.md
|
|
122
122
|
* file. Per OpenCode docs, primary agents and sub-agents share the
|
|
@@ -141,7 +141,7 @@ export type MountSource =
|
|
|
141
141
|
readonly orgId: string;
|
|
142
142
|
readonly sectionKey: string;
|
|
143
143
|
readonly agentSlug?: string;
|
|
144
|
-
readonly
|
|
144
|
+
readonly stageKey?: string;
|
|
145
145
|
}
|
|
146
146
|
| ({ readonly kind: 'rendered-agents-md' } & RenderedAgentRunContextParams)
|
|
147
147
|
| ({ readonly kind: 'rendered-system-overlay' } & RenderedAgentRunContextParams)
|
|
@@ -170,7 +170,7 @@ export interface RenderedAgentRunContextParams {
|
|
|
170
170
|
readonly orgId: string;
|
|
171
171
|
readonly projectId: string;
|
|
172
172
|
readonly agentSlug: string;
|
|
173
|
-
readonly
|
|
173
|
+
readonly stageKey: string;
|
|
174
174
|
readonly role: AgentRunRole;
|
|
175
175
|
readonly sessionId?: string;
|
|
176
176
|
readonly runId?: string;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
//
|
|
10
10
|
// A stage is identified by a free-form `stageKey` string. The artifact
|
|
11
11
|
// natural key already `_`-encodes this value (`{kind}:{workflowRunId}:
|
|
12
|
-
// {
|
|
12
|
+
// {stageKey|_}:{scope|_}:{slug}`), and the workflow engine sequences jobs
|
|
13
13
|
// via explicit `needs:` dependency edges — neither needs a closed enum.
|
|
14
14
|
//
|
|
15
15
|
// Biomes that DO define an ordered stage list (e.g. for a phase rail or a
|
|
@@ -33,7 +33,7 @@ export enum WorkflowStageCategory {
|
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* A single ordered workflow stage. `stageKey` is the value that flows onto
|
|
36
|
-
* a job's `
|
|
36
|
+
* a job's `stageKey` and into the artifact natural key — a free-form
|
|
37
37
|
* string the kernel never validates against a closed set.
|
|
38
38
|
*/
|
|
39
39
|
export interface WorkflowStage {
|