@xemahq/dsl 0.1.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/LICENSE +201 -0
- package/dist/deliverable-spec/index.d.ts +3 -0
- package/dist/deliverable-spec/index.d.ts.map +1 -0
- package/dist/deliverable-spec/index.js +19 -0
- package/dist/deliverable-spec/index.js.map +1 -0
- package/dist/deliverable-spec/lib/schema.d.ts +151 -0
- package/dist/deliverable-spec/lib/schema.d.ts.map +1 -0
- package/dist/deliverable-spec/lib/schema.js +139 -0
- package/dist/deliverable-spec/lib/schema.js.map +1 -0
- package/dist/deliverable-spec/lib/types.d.ts +8 -0
- package/dist/deliverable-spec/lib/types.d.ts.map +1 -0
- package/dist/deliverable-spec/lib/types.js +3 -0
- package/dist/deliverable-spec/lib/types.js.map +1 -0
- package/dist/payload-codec/index.d.ts +8 -0
- package/dist/payload-codec/index.d.ts.map +1 -0
- package/dist/payload-codec/index.js +27 -0
- package/dist/payload-codec/index.js.map +1 -0
- package/dist/payload-codec/lib/blob-store.d.ts +37 -0
- package/dist/payload-codec/lib/blob-store.d.ts.map +1 -0
- package/dist/payload-codec/lib/blob-store.js +0 -0
- package/dist/payload-codec/lib/blob-store.js.map +1 -0
- package/dist/payload-codec/lib/codec-context.d.ts +6 -0
- package/dist/payload-codec/lib/codec-context.d.ts.map +1 -0
- package/dist/payload-codec/lib/codec-context.js +16 -0
- package/dist/payload-codec/lib/codec-context.js.map +1 -0
- package/dist/payload-codec/lib/codec.d.ts +51 -0
- package/dist/payload-codec/lib/codec.d.ts.map +1 -0
- package/dist/payload-codec/lib/codec.js +330 -0
- package/dist/payload-codec/lib/codec.js.map +1 -0
- package/dist/payload-codec/lib/enums.d.ts +18 -0
- package/dist/payload-codec/lib/enums.d.ts.map +1 -0
- package/dist/payload-codec/lib/enums.js +23 -0
- package/dist/payload-codec/lib/enums.js.map +1 -0
- package/dist/payload-codec/lib/errors.d.ts +18 -0
- package/dist/payload-codec/lib/errors.d.ts.map +1 -0
- package/dist/payload-codec/lib/errors.js +39 -0
- package/dist/payload-codec/lib/errors.js.map +1 -0
- package/dist/payload-codec/lib/http-blob-store.d.ts +21 -0
- package/dist/payload-codec/lib/http-blob-store.d.ts.map +1 -0
- package/dist/payload-codec/lib/http-blob-store.js +139 -0
- package/dist/payload-codec/lib/http-blob-store.js.map +1 -0
- package/dist/payload-codec/lib/lru-cache.d.ts +12 -0
- package/dist/payload-codec/lib/lru-cache.d.ts.map +1 -0
- package/dist/payload-codec/lib/lru-cache.js +59 -0
- package/dist/payload-codec/lib/lru-cache.js.map +1 -0
- package/dist/schema/action.schema.json +181 -0
- package/dist/schema/reusable-workflow.schema.json +46 -0
- package/dist/schema/workflow.schema.json +373 -0
- package/dist/workflow/index.d.ts +14 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +49 -0
- package/dist/workflow/index.js.map +1 -0
- package/dist/workflow/lib/action-input-validator.d.ts +10 -0
- package/dist/workflow/lib/action-input-validator.d.ts.map +1 -0
- package/dist/workflow/lib/action-input-validator.js +69 -0
- package/dist/workflow/lib/action-input-validator.js.map +1 -0
- package/dist/workflow/lib/compiler/action-shape.d.ts +5 -0
- package/dist/workflow/lib/compiler/action-shape.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/action-shape.js +43 -0
- package/dist/workflow/lib/compiler/action-shape.js.map +1 -0
- package/dist/workflow/lib/compiler/canonical-json.d.ts +3 -0
- package/dist/workflow/lib/compiler/canonical-json.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/canonical-json.js +45 -0
- package/dist/workflow/lib/compiler/canonical-json.js.map +1 -0
- package/dist/workflow/lib/compiler/compile.d.ts +4 -0
- package/dist/workflow/lib/compiler/compile.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/compile.js +794 -0
- package/dist/workflow/lib/compiler/compile.js.map +1 -0
- package/dist/workflow/lib/compiler/concurrency.d.ts +5 -0
- package/dist/workflow/lib/compiler/concurrency.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/concurrency.js +104 -0
- package/dist/workflow/lib/compiler/concurrency.js.map +1 -0
- package/dist/workflow/lib/compiler/dag.d.ts +10 -0
- package/dist/workflow/lib/compiler/dag.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/dag.js +74 -0
- package/dist/workflow/lib/compiler/dag.js.map +1 -0
- package/dist/workflow/lib/compiler/index.d.ts +6 -0
- package/dist/workflow/lib/compiler/index.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/index.js +14 -0
- package/dist/workflow/lib/compiler/index.js.map +1 -0
- package/dist/workflow/lib/compiler/inputs.d.ts +4 -0
- package/dist/workflow/lib/compiler/inputs.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/inputs.js +108 -0
- package/dist/workflow/lib/compiler/inputs.js.map +1 -0
- package/dist/workflow/lib/compiler/installation-resource-validator.d.ts +9 -0
- package/dist/workflow/lib/compiler/installation-resource-validator.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/installation-resource-validator.js +76 -0
- package/dist/workflow/lib/compiler/installation-resource-validator.js.map +1 -0
- package/dist/workflow/lib/compiler/manifest-source.d.ts +4 -0
- package/dist/workflow/lib/compiler/manifest-source.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/manifest-source.js +100 -0
- package/dist/workflow/lib/compiler/manifest-source.js.map +1 -0
- package/dist/workflow/lib/compiler/matrix.d.ts +4 -0
- package/dist/workflow/lib/compiler/matrix.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/matrix.js +76 -0
- package/dist/workflow/lib/compiler/matrix.js.map +1 -0
- package/dist/workflow/lib/compiler/mount-plan.d.ts +4 -0
- package/dist/workflow/lib/compiler/mount-plan.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/mount-plan.js +96 -0
- package/dist/workflow/lib/compiler/mount-plan.js.map +1 -0
- package/dist/workflow/lib/compiler/payload-reach-in.d.ts +14 -0
- package/dist/workflow/lib/compiler/payload-reach-in.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/payload-reach-in.js +273 -0
- package/dist/workflow/lib/compiler/payload-reach-in.js.map +1 -0
- package/dist/workflow/lib/compiler/permissions.d.ts +6 -0
- package/dist/workflow/lib/compiler/permissions.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/permissions.js +43 -0
- package/dist/workflow/lib/compiler/permissions.js.map +1 -0
- package/dist/workflow/lib/compiler/retry-timeout.d.ts +6 -0
- package/dist/workflow/lib/compiler/retry-timeout.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/retry-timeout.js +64 -0
- package/dist/workflow/lib/compiler/retry-timeout.js.map +1 -0
- package/dist/workflow/lib/compiler/review-step.d.ts +18 -0
- package/dist/workflow/lib/compiler/review-step.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/review-step.js +247 -0
- package/dist/workflow/lib/compiler/review-step.js.map +1 -0
- package/dist/workflow/lib/compiler/types.d.ts +42 -0
- package/dist/workflow/lib/compiler/types.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/types.js +3 -0
- package/dist/workflow/lib/compiler/types.js.map +1 -0
- package/dist/workflow/lib/compiler/variable-requirements.d.ts +5 -0
- package/dist/workflow/lib/compiler/variable-requirements.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/variable-requirements.js +119 -0
- package/dist/workflow/lib/compiler/variable-requirements.js.map +1 -0
- package/dist/workflow/lib/deliverable-spec-keys.d.ts +3 -0
- package/dist/workflow/lib/deliverable-spec-keys.d.ts.map +1 -0
- package/dist/workflow/lib/deliverable-spec-keys.js +90 -0
- package/dist/workflow/lib/deliverable-spec-keys.js.map +1 -0
- package/dist/workflow/lib/dispatch-inputs/index.d.ts +23 -0
- package/dist/workflow/lib/dispatch-inputs/index.d.ts.map +1 -0
- package/dist/workflow/lib/dispatch-inputs/index.js +106 -0
- package/dist/workflow/lib/dispatch-inputs/index.js.map +1 -0
- package/dist/workflow/lib/dispatch-inputs/to-json-schema.d.ts +3 -0
- package/dist/workflow/lib/dispatch-inputs/to-json-schema.d.ts.map +1 -0
- package/dist/workflow/lib/dispatch-inputs/to-json-schema.js +43 -0
- package/dist/workflow/lib/dispatch-inputs/to-json-schema.js.map +1 -0
- package/dist/workflow/lib/duration.d.ts +2 -0
- package/dist/workflow/lib/duration.d.ts.map +1 -0
- package/dist/workflow/lib/duration.js +26 -0
- package/dist/workflow/lib/duration.js.map +1 -0
- package/dist/workflow/lib/errors.d.ts +9 -0
- package/dist/workflow/lib/errors.d.ts.map +1 -0
- package/dist/workflow/lib/errors.js +28 -0
- package/dist/workflow/lib/errors.js.map +1 -0
- package/dist/workflow/lib/expression/ast.d.ts +61 -0
- package/dist/workflow/lib/expression/ast.d.ts.map +1 -0
- package/dist/workflow/lib/expression/ast.js +34 -0
- package/dist/workflow/lib/expression/ast.js.map +1 -0
- package/dist/workflow/lib/expression/context.d.ts +63 -0
- package/dist/workflow/lib/expression/context.d.ts.map +1 -0
- package/dist/workflow/lib/expression/context.js +32 -0
- package/dist/workflow/lib/expression/context.js.map +1 -0
- package/dist/workflow/lib/expression/evaluator.d.ts +5 -0
- package/dist/workflow/lib/expression/evaluator.d.ts.map +1 -0
- package/dist/workflow/lib/expression/evaluator.js +291 -0
- package/dist/workflow/lib/expression/evaluator.js.map +1 -0
- package/dist/workflow/lib/expression/index.d.ts +9 -0
- package/dist/workflow/lib/expression/index.d.ts.map +1 -0
- package/dist/workflow/lib/expression/index.js +26 -0
- package/dist/workflow/lib/expression/index.js.map +1 -0
- package/dist/workflow/lib/expression/interpolation.d.ts +9 -0
- package/dist/workflow/lib/expression/interpolation.d.ts.map +1 -0
- package/dist/workflow/lib/expression/interpolation.js +51 -0
- package/dist/workflow/lib/expression/interpolation.js.map +1 -0
- package/dist/workflow/lib/expression/parser.d.ts +4 -0
- package/dist/workflow/lib/expression/parser.d.ts.map +1 -0
- package/dist/workflow/lib/expression/parser.js +203 -0
- package/dist/workflow/lib/expression/parser.js.map +1 -0
- package/dist/workflow/lib/expression/template.d.ts +18 -0
- package/dist/workflow/lib/expression/template.d.ts.map +1 -0
- package/dist/workflow/lib/expression/template.js +63 -0
- package/dist/workflow/lib/expression/template.js.map +1 -0
- package/dist/workflow/lib/expression/tokenizer.d.ts +3 -0
- package/dist/workflow/lib/expression/tokenizer.d.ts.map +1 -0
- package/dist/workflow/lib/expression/tokenizer.js +153 -0
- package/dist/workflow/lib/expression/tokenizer.js.map +1 -0
- package/dist/workflow/lib/expression/tokens.d.ts +25 -0
- package/dist/workflow/lib/expression/tokens.d.ts.map +1 -0
- package/dist/workflow/lib/expression/tokens.js +24 -0
- package/dist/workflow/lib/expression/tokens.js.map +1 -0
- package/dist/workflow/lib/expression/walk-artifact-refs.d.ts +5 -0
- package/dist/workflow/lib/expression/walk-artifact-refs.d.ts.map +1 -0
- package/dist/workflow/lib/expression/walk-artifact-refs.js +138 -0
- package/dist/workflow/lib/expression/walk-artifact-refs.js.map +1 -0
- package/dist/workflow/lib/installation-resource-kind.d.ts +14 -0
- package/dist/workflow/lib/installation-resource-kind.d.ts.map +1 -0
- package/dist/workflow/lib/installation-resource-kind.js +59 -0
- package/dist/workflow/lib/installation-resource-kind.js.map +1 -0
- package/dist/workflow/lib/schemas-loader.d.ts +4 -0
- package/dist/workflow/lib/schemas-loader.d.ts.map +1 -0
- package/dist/workflow/lib/schemas-loader.js +36 -0
- package/dist/workflow/lib/schemas-loader.js.map +1 -0
- package/dist/workflow/lib/serializer.d.ts +3 -0
- package/dist/workflow/lib/serializer.d.ts.map +1 -0
- package/dist/workflow/lib/serializer.js +15 -0
- package/dist/workflow/lib/serializer.js.map +1 -0
- package/dist/workflow/lib/types.d.ts +179 -0
- package/dist/workflow/lib/types.d.ts.map +1 -0
- package/dist/workflow/lib/types.js +3 -0
- package/dist/workflow/lib/types.js.map +1 -0
- package/dist/workflow/lib/validate.d.ts +8 -0
- package/dist/workflow/lib/validate.d.ts.map +1 -0
- package/dist/workflow/lib/validate.js +119 -0
- package/dist/workflow/lib/validate.js.map +1 -0
- package/dist/workspace-manifest/index.d.ts +6 -0
- package/dist/workspace-manifest/index.d.ts.map +1 -0
- package/dist/workspace-manifest/index.js +22 -0
- package/dist/workspace-manifest/index.js.map +1 -0
- package/dist/workspace-manifest/lib/compile.d.ts +8 -0
- package/dist/workspace-manifest/lib/compile.d.ts.map +1 -0
- package/dist/workspace-manifest/lib/compile.js +439 -0
- package/dist/workspace-manifest/lib/compile.js.map +1 -0
- package/dist/workspace-manifest/lib/interpolate.d.ts +12 -0
- package/dist/workspace-manifest/lib/interpolate.d.ts.map +1 -0
- package/dist/workspace-manifest/lib/interpolate.js +81 -0
- package/dist/workspace-manifest/lib/interpolate.js.map +1 -0
- package/dist/workspace-manifest/lib/resolve-extends.d.ts +10 -0
- package/dist/workspace-manifest/lib/resolve-extends.d.ts.map +1 -0
- package/dist/workspace-manifest/lib/resolve-extends.js +108 -0
- package/dist/workspace-manifest/lib/resolve-extends.js.map +1 -0
- package/dist/workspace-manifest/lib/schema.d.ts +710 -0
- package/dist/workspace-manifest/lib/schema.d.ts.map +1 -0
- package/dist/workspace-manifest/lib/schema.js +355 -0
- package/dist/workspace-manifest/lib/schema.js.map +1 -0
- package/dist/workspace-manifest/lib/types.d.ts +153 -0
- package/dist/workspace-manifest/lib/types.d.ts.map +1 -0
- package/dist/workspace-manifest/lib/types.js +10 -0
- package/dist/workspace-manifest/lib/types.js.map +1 -0
- package/package.json +79 -0
- package/schema/action.schema.json +181 -0
- package/schema/reusable-workflow.schema.json +46 -0
- package/schema/workflow.schema.json +373 -0
- package/src/deliverable-spec/index.ts +19 -0
- package/src/deliverable-spec/lib/schema.ts +248 -0
- package/src/deliverable-spec/lib/types.ts +26 -0
- package/src/payload-codec/index.ts +40 -0
- package/src/payload-codec/lib/blob-store.ts +0 -0
- package/src/payload-codec/lib/codec-context.ts +38 -0
- package/src/payload-codec/lib/codec.ts +593 -0
- package/src/payload-codec/lib/enums.ts +58 -0
- package/src/payload-codec/lib/errors.ts +54 -0
- package/src/payload-codec/lib/http-blob-store.ts +257 -0
- package/src/payload-codec/lib/lru-cache.ts +81 -0
- package/src/workflow/index.ts +98 -0
- package/src/workflow/lib/action-input-validator.ts +160 -0
- package/src/workflow/lib/compiler/action-shape.ts +71 -0
- package/src/workflow/lib/compiler/canonical-json.ts +53 -0
- package/src/workflow/lib/compiler/compile.ts +1518 -0
- package/src/workflow/lib/compiler/concurrency.ts +223 -0
- package/src/workflow/lib/compiler/dag.ts +108 -0
- package/src/workflow/lib/compiler/index.ts +10 -0
- package/src/workflow/lib/compiler/inputs.ts +199 -0
- package/src/workflow/lib/compiler/installation-resource-validator.ts +114 -0
- package/src/workflow/lib/compiler/manifest-source.ts +176 -0
- package/src/workflow/lib/compiler/matrix.ts +135 -0
- package/src/workflow/lib/compiler/mount-plan.ts +202 -0
- package/src/workflow/lib/compiler/payload-reach-in.ts +497 -0
- package/src/workflow/lib/compiler/permissions.ts +64 -0
- package/src/workflow/lib/compiler/retry-timeout.ts +105 -0
- package/src/workflow/lib/compiler/review-step.ts +517 -0
- package/src/workflow/lib/compiler/types.ts +170 -0
- package/src/workflow/lib/compiler/variable-requirements.ts +208 -0
- package/src/workflow/lib/deliverable-spec-keys.ts +109 -0
- package/src/workflow/lib/dispatch-inputs/index.ts +160 -0
- package/src/workflow/lib/dispatch-inputs/to-json-schema.ts +60 -0
- package/src/workflow/lib/duration.ts +48 -0
- package/src/workflow/lib/errors.ts +37 -0
- package/src/workflow/lib/expression/ast.ts +108 -0
- package/src/workflow/lib/expression/context.ts +148 -0
- package/src/workflow/lib/expression/evaluator.ts +492 -0
- package/src/workflow/lib/expression/index.ts +28 -0
- package/src/workflow/lib/expression/interpolation.ts +84 -0
- package/src/workflow/lib/expression/parser.ts +264 -0
- package/src/workflow/lib/expression/template.ts +117 -0
- package/src/workflow/lib/expression/tokenizer.ts +200 -0
- package/src/workflow/lib/expression/tokens.ts +30 -0
- package/src/workflow/lib/expression/walk-artifact-refs.ts +232 -0
- package/src/workflow/lib/installation-resource-kind.ts +107 -0
- package/src/workflow/lib/schemas-loader.ts +64 -0
- package/src/workflow/lib/serializer.ts +30 -0
- package/src/workflow/lib/types.ts +361 -0
- package/src/workflow/lib/validate.ts +199 -0
- package/src/workspace-manifest/index.ts +27 -0
- package/src/workspace-manifest/lib/compile.ts +608 -0
- package/src/workspace-manifest/lib/interpolate.ts +140 -0
- package/src/workspace-manifest/lib/resolve-extends.ts +260 -0
- package/src/workspace-manifest/lib/schema.ts +612 -0
- package/src/workspace-manifest/lib/types.ts +392 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
2
|
+
// ── WorkspaceManifest types ──
|
|
3
|
+
//
|
|
4
|
+
// A WorkspaceManifest declares the SHAPE of `/workspace/` for an agent
|
|
5
|
+
// invocation: which user-data mounts (inputs, references, repos, …) the
|
|
6
|
+
// agent expects, which platform-rendered slots the composer should
|
|
7
|
+
// auto-emit (agents-md, context-json, agent-bundles, …), and which
|
|
8
|
+
// per-profile seed files to drop in.
|
|
9
|
+
//
|
|
10
|
+
// Workflows reference manifests by `compositionRef:` on the `xema/agent`
|
|
11
|
+
// action — the named Agent Composition carries the manifest on its
|
|
12
|
+
// `workspace.mountLayout` block; interactive sessions reference them via
|
|
13
|
+
// the session's composition. The composer in `@xemahq/agent-session-runtime`
|
|
14
|
+
// turns a (manifest, bindInputs) pair into a `WorkspaceMountPlan` and
|
|
15
|
+
// posts it to `/workspace/mounts/apply`.
|
|
16
|
+
//
|
|
17
|
+
// Manifests are shipped by biomes as `*.workspace.yaml` content;
|
|
18
|
+
// on install each is compiled and projected into a published Agent
|
|
19
|
+
// Composition. Customers author them with the same ergonomics as
|
|
20
|
+
// workflow YAMLs.
|
|
21
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Top-level manifest envelope. `apiVersion: xema.dev/workspace/v1`,
|
|
25
|
+
* `kind: WorkspaceManifest`. Versioning is at the spec level —
|
|
26
|
+
* manifests are stored by `(slug, version)` so old workflow runs always
|
|
27
|
+
* resolve to the manifest they were authored against.
|
|
28
|
+
*
|
|
29
|
+
* `extends:` (optional) names a base manifest to inherit from.
|
|
30
|
+
* Resolution is single-level: the base manifest itself MUST NOT carry
|
|
31
|
+
* its own `extends:`. The resolver merges the base's spec into the
|
|
32
|
+
* child's spec deterministically (see {@link MANIFEST_MERGE_RULES}):
|
|
33
|
+
* • `mounts` and `inputs` are unioned key-by-key; child's per-slot
|
|
34
|
+
* declaration wins on conflict.
|
|
35
|
+
* • `seedFiles` and `env` are concatenated (base first, child after);
|
|
36
|
+
* duplicates by `path` / `name` keep the LAST occurrence (child wins).
|
|
37
|
+
* • `agent` block is fully replaced by the child (it's the agent's
|
|
38
|
+
* identity, not inheritable).
|
|
39
|
+
*
|
|
40
|
+
* The reference is a `xema://manifest/<slug>@<version>` URI. The
|
|
41
|
+
* resolver in {@link resolveManifestExtends} fetches the base via a
|
|
42
|
+
* caller-supplied lookup function — the kernel package stays runtime-
|
|
43
|
+
* dep-free.
|
|
44
|
+
*/
|
|
45
|
+
export interface WorkspaceManifest {
|
|
46
|
+
readonly apiVersion: 'xema.dev/workspace/v1';
|
|
47
|
+
readonly kind: 'WorkspaceManifest';
|
|
48
|
+
readonly extends?: string;
|
|
49
|
+
readonly metadata: WorkspaceManifestMetadata;
|
|
50
|
+
readonly spec: WorkspaceManifestSpec;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Slugs of the kernel-shipped manifest templates. Biomes/orgs may
|
|
55
|
+
* register their own templates with their own slugs; these four are
|
|
56
|
+
* always available at the system tier.
|
|
57
|
+
*
|
|
58
|
+
* `primary-agent-base` — coordinator/lead/executor shape with
|
|
59
|
+
* inputs RO, references RO, attachments
|
|
60
|
+
* RO, deliverables RW.
|
|
61
|
+
* `subagent-base` — same as primary-agent-base minus
|
|
62
|
+
* attachments.
|
|
63
|
+
* `reviewer-base` — adds `prior-artifacts`, `review-brief`,
|
|
64
|
+
* `findings` slots for review flows.
|
|
65
|
+
* `agent-session-base` — adds session-attachments slot for
|
|
66
|
+
* chat-driven runs.
|
|
67
|
+
*/
|
|
68
|
+
export const KERNEL_MANIFEST_TEMPLATE_SLUGS = [
|
|
69
|
+
'primary-agent-base',
|
|
70
|
+
'subagent-base',
|
|
71
|
+
'reviewer-base',
|
|
72
|
+
'agent-session-base',
|
|
73
|
+
] as const;
|
|
74
|
+
|
|
75
|
+
export type KernelManifestTemplateSlug = (typeof KERNEL_MANIFEST_TEMPLATE_SLUGS)[number];
|
|
76
|
+
|
|
77
|
+
export interface WorkspaceManifestMetadata {
|
|
78
|
+
readonly slug: string;
|
|
79
|
+
readonly version: string;
|
|
80
|
+
/**
|
|
81
|
+
* `system` (xema-internal), or any string identifying the org. The
|
|
82
|
+
* `biome:<id>` source tier is stored separately on the row, not in
|
|
83
|
+
* the manifest YAML itself.
|
|
84
|
+
*/
|
|
85
|
+
readonly org?: string;
|
|
86
|
+
readonly description?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Execution surfaces this manifest is compatible with. Optional in
|
|
89
|
+
* YAML for additive rollout; the compiler defaults absent values to
|
|
90
|
+
* `[workflow, agent-session]` so existing manifests keep
|
|
91
|
+
* compiling. Validated against {@link ManifestSurface}. Pairs with
|
|
92
|
+
* the workflow action manifest's `consumes[].surfaces` and the
|
|
93
|
+
* agent-session runtime — a manifest with
|
|
94
|
+
* `surfaceCompat: [workflow]` cannot boot an interactive session,
|
|
95
|
+
* and the runtime fails fast at resolve time.
|
|
96
|
+
*/
|
|
97
|
+
readonly surfaceCompat?: readonly ManifestSurface[];
|
|
98
|
+
/** Optional UX framing — drives Studio tiles, picker grouping. */
|
|
99
|
+
readonly display?: ManifestDisplayMetadata;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface ManifestDisplayMetadata {
|
|
103
|
+
readonly title?: string;
|
|
104
|
+
readonly blurb?: string;
|
|
105
|
+
/** Icon slug (frontend maps it to a glyph). */
|
|
106
|
+
readonly icon?: string;
|
|
107
|
+
/** Picker grouping. Free-form; kernel-shipped manifests prefer a closed set. */
|
|
108
|
+
readonly category?: string;
|
|
109
|
+
readonly badges?: readonly string[];
|
|
110
|
+
readonly sortOrder?: number;
|
|
111
|
+
readonly hidden?: boolean;
|
|
112
|
+
/** Call-to-action shown on the session-start tile. */
|
|
113
|
+
readonly ctaText?: string;
|
|
114
|
+
/** Marks a kernel-curated manifest (set by the kernel biome seeder). */
|
|
115
|
+
readonly curated?: boolean;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface WorkspaceManifestSpec {
|
|
119
|
+
/** Runtime parameters the manifest accepts at bind time. */
|
|
120
|
+
readonly inputs?: Record<string, ManifestInputDeclaration>;
|
|
121
|
+
/** User-data mounts (resolved from bind inputs). */
|
|
122
|
+
readonly mounts?: ManifestMountsBlock;
|
|
123
|
+
/** Agent runtime config — composer auto-derives the .opencode/* slots. */
|
|
124
|
+
readonly agent: ManifestAgentBlock;
|
|
125
|
+
/** Skill bundles auto-mounted at session/workflow boot. */
|
|
126
|
+
readonly skills?: readonly ManifestSkillRef[];
|
|
127
|
+
/**
|
|
128
|
+
* Default MCP tool selection inherited by every session/run booted on
|
|
129
|
+
* this manifest. Resolved at boot via mcp-gateway-api `POST /mcp-resolve`
|
|
130
|
+
* and merged into `opencode.json:mcp`. Sessions may override per-instance
|
|
131
|
+
* via `PATCH /sessions/:id/tools`.
|
|
132
|
+
*/
|
|
133
|
+
readonly toolSelection?: readonly ToolSelectionEntry[];
|
|
134
|
+
/** Credential bindings resolved before agent dispatch. */
|
|
135
|
+
readonly credentials?: readonly ManifestCredential[];
|
|
136
|
+
/** Tool permissions overlay (allow/deny lists over agent's intrinsic floor). */
|
|
137
|
+
readonly permissions?: ManifestPermissions;
|
|
138
|
+
/** Workspace-relative paths captured on pause and restored on resume. */
|
|
139
|
+
readonly persistence?: ManifestPersistence;
|
|
140
|
+
/** Output-surface declaration (consumed by workspace-proxy). */
|
|
141
|
+
readonly outputSurface?: ManifestOutputSurface;
|
|
142
|
+
/** Profile-specific seed files (rendered via Handlebars or inlined). */
|
|
143
|
+
readonly seedFiles?: readonly ManifestSeedFile[];
|
|
144
|
+
/** Env vars applied via `PATCH /env/variables`. */
|
|
145
|
+
readonly env?: readonly ManifestEnvVar[];
|
|
146
|
+
/**
|
|
147
|
+
* Working files the platform materialises before the agent's first
|
|
148
|
+
* turn. Each entry binds a `<workspace-relative-path>.<ext>` to a
|
|
149
|
+
* source (`kb-page`, `git-file`, …) the platform keeps in sync for
|
|
150
|
+
* the lifetime of the session. The compiled output's `path` and
|
|
151
|
+
* `sourceRef` carry `${input.x}`-interpolated values; the worker's
|
|
152
|
+
* working-file engine dispatches by `sourceKind`.
|
|
153
|
+
*/
|
|
154
|
+
readonly workingFiles?: readonly ManifestWorkingFile[];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Single working-file declaration in the manifest YAML. The schema's
|
|
159
|
+
* `path` regex requires a workspace-relative path (no leading `/`, no
|
|
160
|
+
* `..` segments); `slug` mirrors the file basename so the agent's
|
|
161
|
+
* mental model of `<slug>` and the on-disk file stay aligned. `format`
|
|
162
|
+
* + `syncDirection` are closed enums.
|
|
163
|
+
*
|
|
164
|
+
* `sourceRef` is a kind-specific string map (e.g. `{ pageId, versionId }`
|
|
165
|
+
* for `kb-page`). Values may carry `${input.x}` tokens — the compile
|
|
166
|
+
* step interpolates them against the bind inputs.
|
|
167
|
+
*/
|
|
168
|
+
export interface ManifestWorkingFile {
|
|
169
|
+
readonly slug: string;
|
|
170
|
+
readonly path: string;
|
|
171
|
+
readonly format: 'markdown' | 'html' | 'json' | 'yaml' | 'text';
|
|
172
|
+
readonly syncDirection: 'down-only' | 'up-only' | 'bidirectional';
|
|
173
|
+
readonly sourceKind: string;
|
|
174
|
+
readonly sourceRef: Readonly<Record<string, string>>;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface ManifestSkillRef {
|
|
178
|
+
readonly slug: string;
|
|
179
|
+
/** Optional semver range pin (`^1`, `~1.2.3`, etc.). */
|
|
180
|
+
readonly version?: string;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface ManifestCredential {
|
|
184
|
+
/** Stable name — UPPER_SNAKE_CASE; referenced from `env[].value`. */
|
|
185
|
+
readonly name: string;
|
|
186
|
+
readonly kind: CredentialKind;
|
|
187
|
+
/** Backend-specific reference. Interpreted by the credential fetcher. */
|
|
188
|
+
readonly sourceRef: string;
|
|
189
|
+
/** Required = resolve failure fails the bootstrap; optional = drift warning. */
|
|
190
|
+
readonly required?: boolean;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export interface ManifestPermissions {
|
|
194
|
+
readonly tools: {
|
|
195
|
+
readonly allow?: readonly ToolsetKey[];
|
|
196
|
+
readonly deny?: readonly ToolsetKey[];
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Per-slot persistence policy override. Currently only `git-push` is
|
|
202
|
+
* overridable — `tarball`/`none` have no fields biomes need to tune.
|
|
203
|
+
* Mirrors `SlotPersistencePolicy.git-push` in
|
|
204
|
+
* `@xemahq/kernel-contracts/agent-workspace`, plus the contract-mirror enums
|
|
205
|
+
* (`ManifestGitPushBranchSuffix`, `ManifestGitPushConcurrencyMode`)
|
|
206
|
+
* imported below.
|
|
207
|
+
*/
|
|
208
|
+
export interface ManifestSlotPersistenceOverride {
|
|
209
|
+
readonly kind: 'git-push';
|
|
210
|
+
readonly branchPrefix: string;
|
|
211
|
+
readonly branchSuffix?: import('@xemahq/kernel-contracts/workflow').ManifestGitPushBranchSuffix;
|
|
212
|
+
readonly concurrencyMode?: import('@xemahq/kernel-contracts/workflow').ManifestGitPushConcurrencyMode;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export interface ManifestPersistence {
|
|
216
|
+
/** Workspace-relative paths. No leading `/`, no `..`. */
|
|
217
|
+
readonly paths: readonly string[];
|
|
218
|
+
/**
|
|
219
|
+
* Per-slot persistence policy overrides. Keyed by AWP slot key
|
|
220
|
+
* (`repos`, etc.). Compile-time-validated against the kernel spec —
|
|
221
|
+
* unknown slot keys and overrides of non-`git-push` slots fail
|
|
222
|
+
* compilation.
|
|
223
|
+
*/
|
|
224
|
+
readonly overrides?: Readonly<Record<string, ManifestSlotPersistenceOverride>>;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export type ManifestOutputSurfaceMode = 'single' | 'multi';
|
|
228
|
+
|
|
229
|
+
export interface ManifestOutputSurface {
|
|
230
|
+
readonly kind: OutputSurfaceKind;
|
|
231
|
+
readonly port?: number;
|
|
232
|
+
readonly healthPath?: string;
|
|
233
|
+
/** Auto-open the preview pane on first ready signal. */
|
|
234
|
+
readonly autoOpen?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Single-port (default) vs. multi-app output surface. `multi` lets
|
|
237
|
+
* workspace-proxy's output-surface supervisor allocate a port per detected
|
|
238
|
+
* app target and emit one gateway route per app — used by webapp
|
|
239
|
+
* studios that scaffold N apps under one session.
|
|
240
|
+
*/
|
|
241
|
+
readonly mode?: ManifestOutputSurfaceMode;
|
|
242
|
+
/**
|
|
243
|
+
* Workspace-relative directory served as a static site. Required by
|
|
244
|
+
* the schema when `kind === 'static'` and rejected for other kinds.
|
|
245
|
+
* The baked `static-artifact-server.mjs` serves this directory at the
|
|
246
|
+
* supervisor-assigned port.
|
|
247
|
+
*/
|
|
248
|
+
readonly root?: string;
|
|
249
|
+
/**
|
|
250
|
+
* Default document name for directory requests in a `static` surface.
|
|
251
|
+
* Defaults to `index.html` at compile time. Schema rejects the field
|
|
252
|
+
* for non-`static` kinds.
|
|
253
|
+
*/
|
|
254
|
+
readonly defaultDocument?: string;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export interface ManifestInputDeclaration {
|
|
258
|
+
readonly type: 'string' | 'string[]' | 'boolean' | 'number' | 'object[]';
|
|
259
|
+
readonly required?: boolean;
|
|
260
|
+
readonly default?:
|
|
261
|
+
| string
|
|
262
|
+
| number
|
|
263
|
+
| boolean
|
|
264
|
+
| readonly string[]
|
|
265
|
+
| readonly Readonly<Record<string, unknown>>[];
|
|
266
|
+
/** Closed-set values; if omitted any value of the right type is allowed. */
|
|
267
|
+
readonly enum?: readonly string[];
|
|
268
|
+
readonly description?: string;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* User-data mount declarations. Each key matches a slot in
|
|
273
|
+
* `AWP_V1_SPEC` (inputs, references, repos, deliverable-specs,
|
|
274
|
+
* deliverables, attachments). Values can be `true`/`false` (use
|
|
275
|
+
* defaults), a mode override (`{ mode: 'read-write' }`), or per-slot
|
|
276
|
+
* config (e.g. `references: { kbSpaces: ${input.x} }`).
|
|
277
|
+
*
|
|
278
|
+
* Platform slots (agents-md, context-json, agent-bundles, etc.) are
|
|
279
|
+
* NEVER declared here — the composer auto-emits them based on
|
|
280
|
+
* `spec.agent`.
|
|
281
|
+
*/
|
|
282
|
+
export type ManifestMountsBlock = Record<string, ManifestMountDeclaration>;
|
|
283
|
+
|
|
284
|
+
export type ManifestMountDeclaration =
|
|
285
|
+
| boolean
|
|
286
|
+
| { readonly mode?: 'read-only' | 'read-write' }
|
|
287
|
+
| { readonly kbSpaces: ReadonlyArray<string> | string }
|
|
288
|
+
| { readonly externalProjects: ReadonlyArray<string> | string }
|
|
289
|
+
| { readonly mode?: 'read-only' | 'read-write'; readonly [key: string]: unknown };
|
|
290
|
+
|
|
291
|
+
export interface ManifestAgentBlock {
|
|
292
|
+
/** Agent slug to compose. May reference `${input.x}`. */
|
|
293
|
+
readonly slug: string;
|
|
294
|
+
/** Phase key (e.g. `engineering`, `interactive`). */
|
|
295
|
+
readonly phase: string;
|
|
296
|
+
/**
|
|
297
|
+
* Worker role — drives AGENTS.md rendering and the system-overlay
|
|
298
|
+
* `authority` block surfaced to the agent.
|
|
299
|
+
* Validated by `ManifestAgentBlockSchema` against
|
|
300
|
+
* `AGENT_RUN_ROLES` from `@xemahq/kernel-contracts/workflow`, so
|
|
301
|
+
* `compileManifest` returns a strongly-typed `AgentRunRole`.
|
|
302
|
+
*/
|
|
303
|
+
readonly role: AgentRunRole;
|
|
304
|
+
/** Optional deliverable spec ref. May reference `${input.x}`. */
|
|
305
|
+
readonly deliverableSpecRef?: string;
|
|
306
|
+
/**
|
|
307
|
+
* Optional default model suggestion for the primary agent. Concrete or
|
|
308
|
+
* strategy ref (`@xemahq/workflow-contracts:ModelRef`). Step/session
|
|
309
|
+
* overrides take precedence; this is the manifest's recommended pick
|
|
310
|
+
* when no override is supplied. Validated as a discriminated union by
|
|
311
|
+
* `ManifestAgentBlockSchema`.
|
|
312
|
+
*/
|
|
313
|
+
readonly defaultModel?: ManifestModelRef;
|
|
314
|
+
/**
|
|
315
|
+
* Optional sub-agent delegates the manifest bundles with the primary
|
|
316
|
+
* agent. Layered ON TOP of the primary's intrinsic delegates (declared
|
|
317
|
+
* in its source `permission.task` allowlist); step/session overrides
|
|
318
|
+
* add more on top. Bindings only ADD or refine model overrides — they
|
|
319
|
+
* never remove an intrinsic delegate.
|
|
320
|
+
*/
|
|
321
|
+
readonly subAgents?: readonly ManifestSubAgent[];
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export type ManifestModelRef =
|
|
325
|
+
| {
|
|
326
|
+
readonly kind: 'concrete';
|
|
327
|
+
readonly modelId: string;
|
|
328
|
+
readonly providerSlug?: string;
|
|
329
|
+
readonly temperature?: number;
|
|
330
|
+
}
|
|
331
|
+
| {
|
|
332
|
+
readonly kind: 'strategy';
|
|
333
|
+
readonly modelClass: ModelClass;
|
|
334
|
+
readonly temperature?: number;
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
export interface ManifestSubAgent {
|
|
338
|
+
readonly slug: string;
|
|
339
|
+
readonly alias?: string;
|
|
340
|
+
readonly defaultModel?: ManifestModelRef;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export interface ManifestSeedFile {
|
|
344
|
+
/** Path relative to `/workspace/`. No leading `/`, no `..`. */
|
|
345
|
+
readonly path: string;
|
|
346
|
+
/** Mount slot to land in. Defaults to `inputs` if omitted. */
|
|
347
|
+
readonly slot?: string;
|
|
348
|
+
/** Named template — resolved at composition time from a skill-bundle
|
|
349
|
+
* resource (`assets/templates/<name>.hbs`) served by `skill-registry-api`. */
|
|
350
|
+
readonly template?: string;
|
|
351
|
+
/** Inline content — alternative to `template`. */
|
|
352
|
+
readonly content?: string;
|
|
353
|
+
/** Variables passed to the template renderer. May reference `${input.x}`. */
|
|
354
|
+
readonly vars?: Record<string, unknown>;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export interface ManifestEnvVar {
|
|
358
|
+
readonly name: string;
|
|
359
|
+
readonly value: string;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export type {
|
|
363
|
+
CompiledWorkspaceManifest,
|
|
364
|
+
CompiledMountDeclaration,
|
|
365
|
+
CompiledSeedFile,
|
|
366
|
+
CompiledSeedFileSource,
|
|
367
|
+
} from '@xemahq/kernel-contracts/workflow';
|
|
368
|
+
|
|
369
|
+
import type {
|
|
370
|
+
AgentRunRole,
|
|
371
|
+
CompiledWorkspaceManifest,
|
|
372
|
+
CredentialKind,
|
|
373
|
+
ManifestSurface,
|
|
374
|
+
ModelClass,
|
|
375
|
+
OutputSurfaceKind,
|
|
376
|
+
ToolsetKey,
|
|
377
|
+
} from '@xemahq/kernel-contracts/workflow';
|
|
378
|
+
import type { ToolSelectionEntry } from '@xemahq/kernel-contracts/mcp-tool';
|
|
379
|
+
|
|
380
|
+
export interface ManifestIssue {
|
|
381
|
+
readonly path: string;
|
|
382
|
+
readonly message: string;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Result envelope for `compileManifest()`. Validation never throws —
|
|
387
|
+
* callers pattern-match on the discriminator. Lets the editor + preview
|
|
388
|
+
* flow surface every issue at once without try/catch ceremony.
|
|
389
|
+
*/
|
|
390
|
+
export type CompileResult =
|
|
391
|
+
| { readonly ok: true; readonly compiled: CompiledWorkspaceManifest }
|
|
392
|
+
| { readonly ok: false; readonly errors: readonly ManifestIssue[] };
|