@xemahq/kernel-contracts 0.13.4 → 0.15.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.
Files changed (178) hide show
  1. package/dist/agent-composition/lib/agent.d.ts.map +1 -1
  2. package/dist/agent-composition/lib/agent.js.map +1 -1
  3. package/dist/agent-session/index.d.ts +2 -0
  4. package/dist/agent-session/index.d.ts.map +1 -0
  5. package/dist/{document-templates/lib → agent-session}/index.js +1 -2
  6. package/dist/agent-session/index.js.map +1 -0
  7. package/dist/agent-session/lib/lifecycle.d.ts +40 -0
  8. package/dist/agent-session/lib/lifecycle.d.ts.map +1 -0
  9. package/dist/agent-session/lib/lifecycle.js +73 -0
  10. package/dist/agent-session/lib/lifecycle.js.map +1 -0
  11. package/dist/agent-workspace/awp-spec.json +1 -1
  12. package/dist/agent-workspace/lib/workspace-layout.d.ts +0 -1
  13. package/dist/agent-workspace/lib/workspace-layout.d.ts.map +1 -1
  14. package/dist/agent-workspace/lib/workspace-layout.js +1 -6
  15. package/dist/agent-workspace/lib/workspace-layout.js.map +1 -1
  16. package/dist/biome/index.d.ts +0 -1
  17. package/dist/biome/index.d.ts.map +1 -1
  18. package/dist/biome/index.js +0 -1
  19. package/dist/biome/index.js.map +1 -1
  20. package/dist/biome/lib/biome-manifest.d.ts +12 -22
  21. package/dist/biome/lib/biome-manifest.d.ts.map +1 -1
  22. package/dist/biome/lib/biome-manifest.js +5 -27
  23. package/dist/biome/lib/biome-manifest.js.map +1 -1
  24. package/dist/biome/lib/biome-origin.d.ts.map +1 -1
  25. package/dist/biome/lib/biome-origin.js.map +1 -1
  26. package/dist/contribution/index.d.ts +1 -0
  27. package/dist/contribution/index.d.ts.map +1 -1
  28. package/dist/contribution/index.js +1 -0
  29. package/dist/contribution/index.js.map +1 -1
  30. package/dist/contribution/lib/sync.d.ts +75 -0
  31. package/dist/contribution/lib/sync.d.ts.map +1 -0
  32. package/dist/contribution/lib/sync.js +45 -0
  33. package/dist/contribution/lib/sync.js.map +1 -0
  34. package/dist/distribution/lib/distribution-lock.d.ts +2 -1
  35. package/dist/distribution/lib/distribution-lock.d.ts.map +1 -1
  36. package/dist/distribution/lib/distribution-lock.js +2 -1
  37. package/dist/distribution/lib/distribution-lock.js.map +1 -1
  38. package/dist/distribution/lib/distribution.d.ts +4 -2
  39. package/dist/distribution/lib/distribution.d.ts.map +1 -1
  40. package/dist/distribution/lib/distribution.js +6 -2
  41. package/dist/distribution/lib/distribution.js.map +1 -1
  42. package/dist/execution-context/lib/execution-context.d.ts.map +1 -1
  43. package/dist/execution-context/lib/execution-context.js.map +1 -1
  44. package/dist/execution-environment/lib/execution-environment.d.ts +0 -1
  45. package/dist/execution-environment/lib/execution-environment.d.ts.map +1 -1
  46. package/dist/execution-environment/lib/execution-environment.js +1 -2
  47. package/dist/execution-environment/lib/execution-environment.js.map +1 -1
  48. package/dist/object/lib/xema-object-kind.d.ts +0 -1
  49. package/dist/object/lib/xema-object-kind.d.ts.map +1 -1
  50. package/dist/object/lib/xema-object-kind.js +0 -1
  51. package/dist/object/lib/xema-object-kind.js.map +1 -1
  52. package/dist/object/lib/xema-object-ref.d.ts.map +1 -1
  53. package/dist/object/lib/xema-object-ref.js +20 -1
  54. package/dist/object/lib/xema-object-ref.js.map +1 -1
  55. package/dist/reference-resolution/lib/reference-resolution.d.ts.map +1 -1
  56. package/dist/reference-resolution/lib/reference-resolution.js.map +1 -1
  57. package/dist/resource/lib/resource-managed-by.d.ts +2 -0
  58. package/dist/resource/lib/resource-managed-by.d.ts.map +1 -1
  59. package/dist/resource/lib/resource-managed-by.js +2 -0
  60. package/dist/resource/lib/resource-managed-by.js.map +1 -1
  61. package/dist/runner/index.d.ts +0 -1
  62. package/dist/runner/index.d.ts.map +1 -1
  63. package/dist/runner/index.js +0 -1
  64. package/dist/runner/index.js.map +1 -1
  65. package/dist/runner-input-hash/index.d.ts +2 -0
  66. package/dist/runner-input-hash/index.d.ts.map +1 -0
  67. package/dist/{document-themes/lib → runner-input-hash}/index.js +1 -2
  68. package/dist/runner-input-hash/index.js.map +1 -0
  69. package/dist/runner-input-hash/lib/input-hash.d.ts.map +1 -0
  70. package/dist/runner-input-hash/lib/input-hash.js.map +1 -0
  71. package/dist/search-source/lib/search-replay.d.ts +0 -1
  72. package/dist/search-source/lib/search-replay.d.ts.map +1 -1
  73. package/dist/search-source/lib/search-replay.js +0 -5
  74. package/dist/search-source/lib/search-replay.js.map +1 -1
  75. package/dist/service-registry/lib/service-names.generated.d.ts +3 -0
  76. package/dist/service-registry/lib/service-names.generated.d.ts.map +1 -1
  77. package/dist/service-registry/lib/service-names.generated.js +3 -0
  78. package/dist/service-registry/lib/service-names.generated.js.map +1 -1
  79. package/dist/workflow/index.d.ts +0 -2
  80. package/dist/workflow/index.d.ts.map +1 -1
  81. package/dist/workflow/index.js +0 -2
  82. package/dist/workflow/index.js.map +1 -1
  83. package/dist/workflow/lib/catalog-taxonomies.d.ts +0 -1
  84. package/dist/workflow/lib/catalog-taxonomies.d.ts.map +1 -1
  85. package/dist/workflow/lib/catalog-taxonomies.js +9 -12
  86. package/dist/workflow/lib/catalog-taxonomies.js.map +1 -1
  87. package/dist/workflow/lib/enums.d.ts +0 -7
  88. package/dist/workflow/lib/enums.d.ts.map +1 -1
  89. package/dist/workflow/lib/enums.js +1 -14
  90. package/dist/workflow/lib/enums.js.map +1 -1
  91. package/dist/workflow/lib/model-ref.d.ts.map +1 -1
  92. package/dist/workflow/lib/model-ref.js.map +1 -1
  93. package/dist/workflow/lib/mount-plan.d.ts.map +1 -1
  94. package/dist/workspace-storage/index.d.ts +0 -1
  95. package/dist/workspace-storage/index.d.ts.map +1 -1
  96. package/dist/workspace-storage/index.js +0 -1
  97. package/dist/workspace-storage/index.js.map +1 -1
  98. package/dist/workspace-storage/lib/types.d.ts.map +1 -1
  99. package/package.json +1 -1
  100. package/src/agent-composition/lib/agent.ts +3 -2
  101. package/src/agent-session/index.ts +1 -0
  102. package/src/agent-session/lib/lifecycle.ts +156 -0
  103. package/src/agent-workspace/lib/workspace-layout.ts +0 -13
  104. package/src/biome/index.ts +0 -1
  105. package/src/biome/lib/biome-manifest.ts +11 -52
  106. package/src/biome/lib/biome-origin.ts +4 -3
  107. package/src/contribution/index.ts +1 -0
  108. package/src/contribution/lib/sync.ts +132 -0
  109. package/src/distribution/lib/distribution-lock.ts +6 -2
  110. package/src/distribution/lib/distribution.ts +22 -3
  111. package/src/execution-context/lib/execution-context.ts +4 -7
  112. package/src/execution-environment/lib/execution-environment.ts +4 -7
  113. package/src/object/lib/xema-object-kind.ts +2 -2
  114. package/src/object/lib/xema-object-ref.ts +21 -1
  115. package/src/policy/lib/obligations.ts +5 -5
  116. package/src/reference-resolution/lib/reference-resolution.ts +4 -2
  117. package/src/resource/lib/resource-managed-by.ts +15 -2
  118. package/src/runner/index.ts +0 -1
  119. package/src/runner-input-hash/index.ts +1 -0
  120. package/src/{runner → runner-input-hash}/lib/input-hash.ts +7 -0
  121. package/src/search-source/lib/search-replay.ts +0 -10
  122. package/src/service-registry/lib/service-names.generated.ts +3 -0
  123. package/src/space/lib/skill-mirror-path.ts +2 -2
  124. package/src/workflow/index.ts +0 -2
  125. package/src/workflow/lib/catalog-taxonomies.ts +21 -15
  126. package/src/workflow/lib/enums.ts +0 -20
  127. package/src/workflow/lib/model-ref.ts +5 -6
  128. package/src/workflow/lib/mount-plan.ts +0 -1
  129. package/src/workspace-storage/index.ts +0 -1
  130. package/src/workspace-storage/lib/types.ts +11 -5
  131. package/dist/agent-composition/lib/composition-limits-schema.d.ts +0 -4
  132. package/dist/agent-composition/lib/composition-limits-schema.d.ts.map +0 -1
  133. package/dist/agent-composition/lib/composition-limits-schema.js +0 -13
  134. package/dist/agent-composition/lib/composition-limits-schema.js.map +0 -1
  135. package/dist/agent-composition/lib/composition-workspace.d.ts +0 -37
  136. package/dist/agent-composition/lib/composition-workspace.d.ts.map +0 -1
  137. package/dist/agent-composition/lib/composition-workspace.js +0 -9
  138. package/dist/agent-composition/lib/composition-workspace.js.map +0 -1
  139. package/dist/agent-composition/lib/composition.d.ts +0 -65
  140. package/dist/agent-composition/lib/composition.d.ts.map +0 -1
  141. package/dist/agent-composition/lib/composition.js +0 -18
  142. package/dist/agent-composition/lib/composition.js.map +0 -1
  143. package/dist/agent-workspace/lib/awp-v1.d.ts +0 -15
  144. package/dist/agent-workspace/lib/awp-v1.d.ts.map +0 -1
  145. package/dist/agent-workspace/lib/awp-v1.js +0 -197
  146. package/dist/agent-workspace/lib/awp-v1.js.map +0 -1
  147. package/dist/biome/lib/biome-api.d.ts +0 -12
  148. package/dist/biome/lib/biome-api.d.ts.map +0 -1
  149. package/dist/biome/lib/biome-api.js +0 -14
  150. package/dist/biome/lib/biome-api.js.map +0 -1
  151. package/dist/document-templates/lib/index.d.ts +0 -3
  152. package/dist/document-templates/lib/index.d.ts.map +0 -1
  153. package/dist/document-templates/lib/index.js.map +0 -1
  154. package/dist/document-themes/lib/index.d.ts +0 -3
  155. package/dist/document-themes/lib/index.d.ts.map +0 -1
  156. package/dist/document-themes/lib/index.js.map +0 -1
  157. package/dist/runner/lib/input-hash.d.ts.map +0 -1
  158. package/dist/runner/lib/input-hash.js.map +0 -1
  159. package/dist/workflow/lib/sampling-profiles.d.ts +0 -18
  160. package/dist/workflow/lib/sampling-profiles.d.ts.map +0 -1
  161. package/dist/workflow/lib/sampling-profiles.js +0 -56
  162. package/dist/workflow/lib/sampling-profiles.js.map +0 -1
  163. package/dist/workflow/lib/workflow-stage.d.ts +0 -11
  164. package/dist/workflow/lib/workflow-stage.d.ts.map +0 -1
  165. package/dist/workflow/lib/workflow-stage.js +0 -28
  166. package/dist/workflow/lib/workflow-stage.js.map +0 -1
  167. package/dist/workspace-storage/lib/schemas.d.ts +0 -56
  168. package/dist/workspace-storage/lib/schemas.d.ts.map +0 -1
  169. package/dist/workspace-storage/lib/schemas.js +0 -59
  170. package/dist/workspace-storage/lib/schemas.js.map +0 -1
  171. package/src/biome/lib/biome-api.ts +0 -33
  172. package/src/document-templates/lib/index.ts +0 -2
  173. package/src/document-themes/lib/index.ts +0 -2
  174. package/src/workflow/lib/sampling-profiles.ts +0 -153
  175. package/src/workflow/lib/workflow-stage.ts +0 -89
  176. package/src/workspace-storage/lib/schemas.ts +0 -75
  177. /package/dist/{runner → runner-input-hash}/lib/input-hash.d.ts +0 -0
  178. /package/dist/{runner → runner-input-hash}/lib/input-hash.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"mount-plan.d.ts","sourceRoot":"","sources":["../../../src/workflow/lib/mount-plan.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC/C,QAAQ,CAAC,SAAS,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACjD;AAED,MAAM,WAAW,gBAAgB;IAE/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAGD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,SAAS,aAAa,EAAE,CAAC;CAC9C;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B;AAQD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,YAAY,EAAE,YAAY,EAAE,CAAC;AAa7B,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,IAAI,EAAE,2BAA2B,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC7E;IAeE,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAS5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,E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C;QAC5B,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;KACtD,CAAC,CAAC;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACpC"}
@@ -1,4 +1,3 @@
1
1
  export * from './lib/enums';
2
2
  export * from './lib/types';
3
- export * from './lib/schemas';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workspace-storage/index.ts"],"names":[],"mappings":"AASA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workspace-storage/index.ts"],"names":[],"mappings":"AASA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
@@ -16,5 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./lib/enums"), exports);
18
18
  __exportStar(require("./lib/types"), exports);
19
- __exportStar(require("./lib/schemas"), exports);
20
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/workspace-storage/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AASA,8CAA4B;AAC5B,8CAA4B;AAC5B,gDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/workspace-storage/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AASA,8CAA4B;AAC5B,8CAA4B"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/workspace-storage/lib/types.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,iBAAiB,EAClB,MAAM,SAAS,CAAC;AA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AAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AASD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xemahq/kernel-contracts",
3
- "version": "0.13.4",
3
+ "version": "0.15.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/",
@@ -9,8 +9,9 @@
9
9
  // By-reference: a node names an agent as `slug@version`; the same agent
10
10
  // definition can be the root of one composition and a leaf of another.
11
11
  //
12
- // Phase 6 collapses `AgentSessionProfile`, `Session.subAgentBindings`, and
13
- // the agent section of `WorkspaceManifest` into this primitive.
12
+ // This primitive supersedes `AgentSessionProfile`, `Session.subAgentBindings`,
13
+ // and the agent section of `WorkspaceManifest` (unified-Agent program). Do not
14
+ // add new consumers of those legacy shapes.
14
15
  // ═══════════════════════════════════════════════════════════════════════════
15
16
 
16
17
  import type { ToolSelectionEntry } from '../../mcp-tool';
@@ -0,0 +1 @@
1
+ export * from './lib/lifecycle';
@@ -0,0 +1,156 @@
1
+ // ═══════════════════════════════════════════════════════════════════════════
2
+ // ── Agent-session lifecycle — SINGLE SOURCE OF TRUTH ──
3
+ //
4
+ // The closed `SessionLifecycleState` / `SessionOwnerKind` value sets + the
5
+ // transition FSM for an agent-session row. This is the canonical Layer-0
6
+ // contract that the persistence enum (agent-session-api Prisma `SessionStatus`
7
+ // / `SessionOwnerKind`), the service's in-tree state machine, and the
8
+ // runtime worker mirror ALL derive from — collapsing the former three hand-
9
+ // maintained copies into one. Prisma cannot import a TS value, so its schema
10
+ // re-declares the same members and CI guards parity
11
+ // (`tooling/boundaries/check-session-enum-parity.mjs`).
12
+ //
13
+ // `canTransition()` is the single predicate every caller (interactive sessions
14
+ // AND the workflow-runtime worker dispatch activity) consults before issuing a
15
+ // state-change HTTP call, so misuse fails fast at compile time rather than as a
16
+ // 409 from the service.
17
+ // ═══════════════════════════════════════════════════════════════════════════
18
+
19
+ import { z } from 'zod';
20
+
21
+ /**
22
+ * Lifecycle state of an agent-session row. Value-identical to the persisted
23
+ * `session_status` Prisma enum. Closed set.
24
+ */
25
+ export const SessionLifecycleState = {
26
+ creating: 'creating',
27
+ provisioning: 'provisioning',
28
+ active: 'active',
29
+ paused: 'paused',
30
+ recovering: 'recovering',
31
+ completing: 'completing',
32
+ completed: 'completed',
33
+ failed: 'failed',
34
+ archived: 'archived',
35
+ } as const;
36
+
37
+ export type SessionLifecycleStateValue =
38
+ (typeof SessionLifecycleState)[keyof typeof SessionLifecycleState];
39
+
40
+ export const SessionLifecycleStateSchema = z.enum(
41
+ Object.values(SessionLifecycleState) as [
42
+ SessionLifecycleStateValue,
43
+ ...SessionLifecycleStateValue[],
44
+ ],
45
+ );
46
+
47
+ /**
48
+ * Who created the session row. Value-identical to the persisted
49
+ * `session_owner_kind` Prisma enum.
50
+ *
51
+ * - `interactive_session` — user-facing chat sessions
52
+ * - `pipeline_run` — workflow-runtime-worker redraft loop spines
53
+ * - `chat_thread` — reserved (no dispatcher today)
54
+ */
55
+ export const SessionOwnerKind = {
56
+ interactive_session: 'interactive_session',
57
+ pipeline_run: 'pipeline_run',
58
+ chat_thread: 'chat_thread',
59
+ } as const;
60
+
61
+ export type SessionOwnerKindValue =
62
+ (typeof SessionOwnerKind)[keyof typeof SessionOwnerKind];
63
+
64
+ export const SessionOwnerKindSchema = z.enum(
65
+ Object.values(SessionOwnerKind) as [
66
+ SessionOwnerKindValue,
67
+ ...SessionOwnerKindValue[],
68
+ ],
69
+ );
70
+
71
+ /**
72
+ * Per-state transition matrix. `canTransition(from, to)` returns true iff the
73
+ * transition is valid.
74
+ *
75
+ * Notable transitions:
76
+ * - `paused → recovering` (resume claim)
77
+ * - `recovering → active` (resume success)
78
+ * - `recovering → paused` (resume rollback)
79
+ * - `active → completing → completed` (terminal success)
80
+ * - any-non-terminal → `failed` (terminal failure)
81
+ * - `paused | completed | failed → archived` (cleanup sweep)
82
+ */
83
+ const TRANSITIONS: Readonly<
84
+ Record<SessionLifecycleStateValue, ReadonlySet<SessionLifecycleStateValue>>
85
+ > = {
86
+ creating: new Set([
87
+ SessionLifecycleState.provisioning,
88
+ SessionLifecycleState.failed,
89
+ ]),
90
+ provisioning: new Set([
91
+ SessionLifecycleState.active,
92
+ SessionLifecycleState.failed,
93
+ ]),
94
+ active: new Set([
95
+ SessionLifecycleState.paused,
96
+ SessionLifecycleState.completing,
97
+ SessionLifecycleState.failed,
98
+ ]),
99
+ paused: new Set([
100
+ SessionLifecycleState.recovering,
101
+ SessionLifecycleState.archived,
102
+ SessionLifecycleState.failed,
103
+ ]),
104
+ recovering: new Set([
105
+ SessionLifecycleState.active,
106
+ SessionLifecycleState.paused,
107
+ SessionLifecycleState.failed,
108
+ ]),
109
+ completing: new Set([
110
+ SessionLifecycleState.completed,
111
+ SessionLifecycleState.failed,
112
+ ]),
113
+ completed: new Set([SessionLifecycleState.archived]),
114
+ failed: new Set([SessionLifecycleState.archived]),
115
+ archived: new Set(),
116
+ };
117
+
118
+ export function canTransition(
119
+ from: SessionLifecycleStateValue,
120
+ to: SessionLifecycleStateValue,
121
+ ): boolean {
122
+ return TRANSITIONS[from].has(to);
123
+ }
124
+
125
+ /**
126
+ * Terminal states — no further transitions possible (except the
127
+ * `completed | failed → archived` cleanup sweep). Callers use this to
128
+ * short-circuit "is this session done?" checks.
129
+ */
130
+ export function isTerminal(state: SessionLifecycleStateValue): boolean {
131
+ return (
132
+ state === SessionLifecycleState.completed ||
133
+ state === SessionLifecycleState.failed ||
134
+ state === SessionLifecycleState.archived
135
+ );
136
+ }
137
+
138
+ /**
139
+ * Pausable states — the session has a live worker that can be told to
140
+ * snapshot. `provisioning` is intentionally excluded: the worker isn't ready
141
+ * yet, so a pause request would 409. Callers receiving such a 409 should retry
142
+ * with backoff once `active` is reached.
143
+ */
144
+ export function isPausable(state: SessionLifecycleStateValue): boolean {
145
+ return state === SessionLifecycleState.active;
146
+ }
147
+
148
+ /**
149
+ * Resumable states. `paused` is the canonical case. `failed` rows are NOT
150
+ * resumable from here — they require explicit operator action (the resume API
151
+ * would 409). `recovering` is a transient state owned by an in-flight resume;
152
+ * another caller observing it should back off.
153
+ */
154
+ export function isResumable(state: SessionLifecycleStateValue): boolean {
155
+ return state === SessionLifecycleState.paused;
156
+ }
@@ -35,19 +35,6 @@ export enum WorkspaceMount {
35
35
  Instructions = '/workspace/.xema/instructions',
36
36
  }
37
37
 
38
- // `WorkspaceRole` is the role the running session takes. The canonical
39
- // values + helpers live in `@xemahq/workflow-contracts:agent-role` —
40
- // re-exported here as `WorkspaceRole` for back-compat with consumers
41
- // that imported from this module. New code should import `AgentRunRole`
42
- // directly from `@xemahq/workflow-contracts`.
43
- export {
44
- AGENT_RUN_ROLES as WORKSPACE_ROLES,
45
- AGENT_RUN_ROLES_INTERACTIVE as WORKSPACE_ROLES_INTERACTIVE,
46
- AGENT_RUN_ROLES_PIPELINE as WORKSPACE_ROLES_PIPELINE,
47
- isAgentRunRole as isWorkspaceRole,
48
- type AgentRunRole as WorkspaceRole,
49
- } from '../../workflow';
50
-
51
38
  /**
52
39
  * Mount mode the worker requests. Read-only mounts are `chmod a-w` at
53
40
  * attach-time so the kernel enforces immutability; writable mounts
@@ -7,7 +7,6 @@ export * from './lib/biome-audience';
7
7
  export * from './lib/biome-origin';
8
8
  export * from './lib/biome-trust-tier';
9
9
  export * from './lib/biome-availability-grant';
10
- export * from './lib/biome-api';
11
10
  export * from './lib/biome-lifecycle-hooks';
12
11
  export * from './lib/biome-engines';
13
12
  export * from './lib/biome-permissions';
@@ -13,21 +13,18 @@ import {
13
13
  MigrationRunnerKind,
14
14
  OrgDatabasePurpose,
15
15
  } from '../../org-database';
16
- // Import from the specific runner lib files, NOT the `../../runner` barrel.
17
- // The barrel re-exports `input-hash` (a server-only util with a top-level
18
- // `require('node:crypto')`); pulling the barrel here drags `node:crypto` into
19
- // every browser consumer of `@xemahq/kernel-contracts/biome` (e.g. host-web's
20
- // BiomeNewPage), which webpack cannot bundle (UnhandledSchemeError). These
21
- // three symbols carry no crypto dependency.
22
- import { DataLocalitySchema } from '../../runner/lib/runner-registration';
23
- import { RuntimeIsolationLevelSchema } from '../../runner/lib/runtime-isolation';
24
- import { RunnerTrustTier } from '../../runner/lib/runner';
16
+ import {
17
+ DataLocalitySchema,
18
+ RuntimeIsolationLevelSchema,
19
+ RunnerTrustTier,
20
+ } from '../../runner';
25
21
  import { z } from 'zod';
26
22
  import {
27
23
  BiomeAudience,
28
24
  BiomeAudienceSchema,
29
25
  DEFAULT_BIOME_AUDIENCE,
30
26
  } from './biome-audience';
27
+ import { BiomeOriginSchema } from './biome-origin';
31
28
  import {
32
29
  BiomeEnginesSchema,
33
30
  } from './biome-engines';
@@ -129,18 +126,6 @@ const LEGACY_SHIPS_CONTENT_DIR: Readonly<Record<string, string>> = {
129
126
  provisioningScaffolds: 'provisioning',
130
127
  };
131
128
 
132
- const LEGACY_SHIPS_MODULES_DIR: Readonly<Record<string, string>> = {
133
- agents: 'agents',
134
- actions: 'actions',
135
- mountSourceKinds: 'mount-source-kinds',
136
- deliverableSpecKinds: 'deliverable-spec-kinds',
137
- runtimeMountKinds: 'runtime-mount-kinds',
138
- workspaceSpecOverlay: 'workspace-spec-overlay',
139
- systemOverlayContributions: 'system-overlay-contributions',
140
- adapterKinds: 'adapter-kinds',
141
- integrationProviders: 'integration-providers',
142
- };
143
-
144
129
  /**
145
130
  * Resolve a legacy `ships.content[]` value to its conventional directory
146
131
  * name, or `null` for unknown tokens. Used by the legacy file-walk
@@ -157,21 +142,6 @@ export function contentKindToDir(kind: string): string {
157
142
  return dir;
158
143
  }
159
144
 
160
- /**
161
- * Resolve a legacy `ships.modules[]` value to its conventional directory
162
- * name. Same legacy-only scope as `contentKindToDir`.
163
- */
164
- export function moduleKindToDir(kind: string): string {
165
- const dir = LEGACY_SHIPS_MODULES_DIR[kind];
166
- if (!dir) {
167
- throw new Error(
168
- `biome-host-sdk: unknown legacy ships.modules[] value "${kind}". ` +
169
- `Either migrate the biome to xema.contributions or extend LEGACY_SHIPS_MODULES_DIR.`,
170
- );
171
- }
172
- return dir;
173
- }
174
-
175
145
  /**
176
146
  * Org-managed database declaration for biomes that need a dedicated
177
147
  * schema in a provisioned org database.
@@ -335,19 +305,6 @@ export const BiomeShipsSchema = z
335
305
  .strict();
336
306
  export type BiomeShips = z.infer<typeof BiomeShipsSchema>;
337
307
 
338
- /**
339
- * Manifest-shape hosting/trust posture for a server biome. Used by
340
- * integration-host plumbing (Phase 7) to decide whether to load
341
- * adapter-contribution modules in-process or via a sidecar deployment.
342
- * Manifests authored by Xema and audited third parties may set
343
- * `first-party`; everything else defaults to `third-party`.
344
- *
345
- * Kept manifest-internal (not re-exported) so it does not collide with the
346
- * kernel `BiomeTrustTier` provenance enum (`first-party | verified-store |
347
- * community-store | …`) already exposed by this package.
348
- */
349
- const ManifestBiomeTrustTierSchema = z.enum(['first-party', 'third-party']);
350
-
351
308
  /**
352
309
  * AdapterKind slug — accepts a built-in slug verbatim, plus any
353
310
  * lowercase kebab-case slug a biome-contributed kind could register.
@@ -765,10 +722,12 @@ const ServerBiomeXemaSchema = z
765
722
  ships: BiomeShipsSchema.optional(),
766
723
  capabilities: ServerBiomeCapabilitiesSchema.optional(),
767
724
  /**
768
- * Hosting posture for adapter-contribution modules (Phase 7). Other
769
- * biome kinds ignore this field. Defaults to `third-party`.
725
+ * Hosting/provenance posture for adapter-contribution modules (Phase 7).
726
+ * The same `first-party | third-party` set as {@link BiomeOrigin} (which
727
+ * documents this very field) — uses `BiomeOriginSchema` so the two cannot
728
+ * drift. Other biome kinds ignore this field. Defaults to `third-party`.
770
729
  */
771
- trustTier: ManifestBiomeTrustTierSchema.optional(),
730
+ trustTier: BiomeOriginSchema.optional(),
772
731
  /**
773
732
  * Integration dependencies the biome needs to be useful. Surfaced
774
733
  * to the install wizard as a consent screen. Non-optional entries
@@ -11,9 +11,10 @@ import { z } from 'zod';
11
11
  * and is not knowable from source. Keep the two separate — the distribution
12
12
  * trust gate operates on origin, not on install-time provenance.
13
13
  *
14
- * Closed set; new values are a kernel change. (Seam: the biome-sdk manifest's
15
- * own 2-value `BiomeTrustTierSchema` should migrate to import this enum so the
16
- * posture has a single source of truth.)
14
+ * Closed set; new values are a kernel change. This IS the single source of
15
+ * truth: the `xema-biome.json` manifest schema (`BiomeXemaSchema.trustTier`)
16
+ * validates against `BiomeOriginSchema`, and biome-sdk re-exports that schema
17
+ * rather than declaring its own — so the posture cannot drift.
17
18
  */
18
19
  export enum BiomeOrigin {
19
20
  FirstParty = 'first-party',
@@ -2,3 +2,4 @@ export * from './lib/contribution-kind';
2
2
  export * from './lib/contribution-source';
3
3
  export * from './lib/contribution';
4
4
  export * from './lib/registry';
5
+ export * from './lib/sync';
@@ -0,0 +1,132 @@
1
+ import { z } from 'zod';
2
+ import { ContributionKind, ContributionKindSchema } from './contribution-kind';
3
+ import { AnyContributionEnvelopeSchema } from './contribution';
4
+
5
+ // NOTE: the `contribution` subpath is a DAG leaf and MUST NOT import the
6
+ // `resource` subpath (enforced by check-subpath-dag.mjs). The mapping from
7
+ // `ContributionOwnerKind` to `ResourceManagedBy` therefore lives in the
8
+ // consuming SDK (`@xemahq/contribution-sync-nest`), which legally depends on
9
+ // both subpaths. Keep that mapping the single source of truth there.
10
+
11
+ // ═══════════════════════════════════════════════════════════════════════════
12
+ // Contribution sync — the declarative, owner-scoped push contract.
13
+ //
14
+ // biome-host (and a runtime service self-registering its own capabilities)
15
+ // pushes the COMPLETE desired set of contributions for one `(owner, kind)`
16
+ // to the owning registry over HTTP. The registry upserts every item and
17
+ // prunes anything it owns for that `(owner, kind)` that is no longer present.
18
+ //
19
+ // This replaces the boot-time local-directory scan: registries no longer read
20
+ // biome trees off disk; they receive their content. Pruning is owner-scoped
21
+ // (NEVER installation-scoped — biome content is platform-global and shared
22
+ // across org/project installs), so a per-tenant enable/disable never deletes
23
+ // shared content.
24
+ // ═══════════════════════════════════════════════════════════════════════════
25
+
26
+ /**
27
+ * Who owns a pushed set of contributions. The typed owner keeps three
28
+ * lifecycles cleanly separated while sharing ONE engine + wire shape:
29
+ *
30
+ * - `Biome` — a biome bundle's contributions, pushed by biome-host.
31
+ * `id` is the biome id, `version` the biome version. Maps to
32
+ * `ResourceManagedBy.BiomeContributed`.
33
+ * - `RuntimeService` — a service self-registering its OWN capabilities (the
34
+ * `@XemaCapability` auto-register path). `id` is the service name. Maps to
35
+ * `ResourceManagedBy.RuntimeRegistered`.
36
+ * - `SystemSeed` — a genuine package/in-service seed that is neither a
37
+ * biome push nor runtime self-registration (`@xemahq/system-skills`,
38
+ * `INITIAL_CAPABILITY_SEED`). Maps to `ResourceManagedBy.Seeder`.
39
+ */
40
+ export enum ContributionOwnerKind {
41
+ Biome = 'biome',
42
+ RuntimeService = 'runtime_service',
43
+ SystemSeed = 'system_seed',
44
+ }
45
+
46
+ export const ContributionOwnerKindSchema = z.nativeEnum(ContributionOwnerKind);
47
+
48
+ /** The typed owner of a pushed contribution set. */
49
+ export interface ContributionOwner {
50
+ readonly type: ContributionOwnerKind;
51
+ /** Biome id, service name, or seed id depending on `type`. */
52
+ readonly id: string;
53
+ /** Biome/bundle version for `Biome` owners; optional otherwise. */
54
+ readonly version?: string;
55
+ }
56
+
57
+ export const ContributionOwnerSchema = z.object({
58
+ type: ContributionOwnerKindSchema,
59
+ id: z.string().min(1),
60
+ version: z.string().min(1).optional(),
61
+ });
62
+
63
+ /**
64
+ * Lifecycle/availability status of a registry's content for one `(owner, kind)`.
65
+ * Persisted by the registry and aggregated by biome-host for the UI AND used by
66
+ * the registry to gate consumption (a not-fully-synced set is not served).
67
+ *
68
+ * - `NOT_SYNCED` — never synced; no rows exist yet (structural empty).
69
+ * - `SYNCING` — a sync is in flight.
70
+ * - `SYNCED` — desired === active; content is the current good set.
71
+ * - `SYNC_FAILED` — last attempt failed (e.g. referential-integrity reject);
72
+ * the prior `active` set is preserved and still served.
73
+ * - `PENDING_RETRY`— transient failure queued for retry (outbox).
74
+ * - `PARTIAL` — synced, but a cross-service dependency is unsatisfied;
75
+ * affected items are not launchable until it resolves.
76
+ */
77
+ export enum ContributionSyncStatus {
78
+ NotSynced = 'not_synced',
79
+ Syncing = 'syncing',
80
+ Synced = 'synced',
81
+ SyncFailed = 'sync_failed',
82
+ PendingRetry = 'pending_retry',
83
+ Partial = 'partial',
84
+ }
85
+
86
+ export const ContributionSyncStatusSchema = z.nativeEnum(ContributionSyncStatus);
87
+
88
+ /**
89
+ * The push request. `items` is the COMPLETE desired set for `(owner, kind)`
90
+ * after the pusher's cross-biome `extends`-dedup — never a delta.
91
+ *
92
+ * `contentHash` is a stable sha256 over the canonicalized `items` (idempotent
93
+ * no-op detection). `syncToken` is a MONOTONIC lifecycle-attempt token (ULID /
94
+ * sequence / transition counter) — deliberately NOT derived from the version,
95
+ * so a downgrade still carries a higher token than the upgrade it reverts.
96
+ */
97
+ export interface ContributionSyncRequest {
98
+ readonly owner: ContributionOwner;
99
+ readonly kind: ContributionKind;
100
+ readonly items: readonly z.infer<typeof AnyContributionEnvelopeSchema>[];
101
+ readonly contentHash: string;
102
+ readonly syncToken: string;
103
+ }
104
+
105
+ export const ContributionSyncRequestSchema = z.object({
106
+ owner: ContributionOwnerSchema,
107
+ kind: ContributionKindSchema,
108
+ items: z.array(AnyContributionEnvelopeSchema),
109
+ contentHash: z.string().min(1),
110
+ syncToken: z.string().min(1),
111
+ });
112
+
113
+ /** The registry's response to a sync push. */
114
+ export interface ContributionSyncResult {
115
+ readonly owner: ContributionOwner;
116
+ readonly kind: ContributionKind;
117
+ readonly upserted: number;
118
+ readonly pruned: number;
119
+ readonly unchanged: number;
120
+ readonly skippedNoOp: boolean;
121
+ readonly status: ContributionSyncStatus;
122
+ }
123
+
124
+ export const ContributionSyncResultSchema = z.object({
125
+ owner: ContributionOwnerSchema,
126
+ kind: ContributionKindSchema,
127
+ upserted: z.number().int().nonnegative(),
128
+ pruned: z.number().int().nonnegative(),
129
+ unchanged: z.number().int().nonnegative(),
130
+ skippedNoOp: z.boolean(),
131
+ status: ContributionSyncStatusSchema,
132
+ });
@@ -7,6 +7,10 @@ import {
7
7
  type BiomeTarget,
8
8
  type BiomeOrigin,
9
9
  } from '../../biome';
10
+ import {
11
+ PlatformServiceTierSchema,
12
+ type PlatformServiceTier,
13
+ } from './distribution';
10
14
 
11
15
  /**
12
16
  * A single biome as resolved into a distribution lockfile. Version-pinned and
@@ -63,12 +67,12 @@ export const LockedBiomeSchema = z.object({
63
67
  export interface LockedPlatformService {
64
68
  name: string;
65
69
  /** Wave/boot tier — drives ordering in the generated bring-up plan. */
66
- tier: BiomeTier | 'edge';
70
+ tier: PlatformServiceTier;
67
71
  }
68
72
 
69
73
  export const LockedPlatformServiceSchema = z.object({
70
74
  name: z.string().min(1),
71
- tier: z.union([BiomeTierSchema, z.literal('edge')]),
75
+ tier: PlatformServiceTierSchema,
72
76
  }) as z.ZodType<LockedPlatformService>;
73
77
 
74
78
  /**
@@ -1,10 +1,29 @@
1
1
  import { z } from 'zod';
2
- import { BiomeOriginSchema, type BiomeOrigin } from '../../biome';
2
+ import {
3
+ BiomeOriginSchema,
4
+ BiomeTierSchema,
5
+ type BiomeOrigin,
6
+ type BiomeTier,
7
+ } from '../../biome';
3
8
  import {
4
9
  DistributionSelectorSchema,
5
10
  type DistributionSelector,
6
11
  } from './distribution-selector';
7
12
 
13
+ /**
14
+ * Wave/boot tier of a platform-substrate service — the four {@link BiomeTier}
15
+ * waves (`kernel | system | base | platform`) plus `edge` for the outermost,
16
+ * browser-facing wave. Single source of truth for BOTH the distribution
17
+ * manifest ({@link DistributionPlatformService}) and the resolved lock
18
+ * (`LockedPlatformService`), so the tier vocabulary can never drift between them.
19
+ */
20
+ export type PlatformServiceTier = BiomeTier | 'edge';
21
+
22
+ export const PlatformServiceTierSchema = z.union([
23
+ BiomeTierSchema,
24
+ z.literal('edge'),
25
+ ]) as z.ZodType<PlatformServiceTier>;
26
+
8
27
  /**
9
28
  * Schema-versioning seed for `xema-distribution.json`. Bumped via a coordinated
10
29
  * PR on an incompatible shape change; consumers refuse versions they do not
@@ -37,12 +56,12 @@ export const DistributionTrustPolicySchema = z.object({
37
56
  export interface DistributionPlatformService {
38
57
  name: string;
39
58
  /** Wave/boot tier — drives ordering in the generated bring-up plan. */
40
- tier: 'kernel' | 'system' | 'base' | 'platform' | 'edge';
59
+ tier: PlatformServiceTier;
41
60
  }
42
61
 
43
62
  export const DistributionPlatformServiceSchema = z.object({
44
63
  name: z.string().min(1),
45
- tier: z.enum(['kernel', 'system', 'base', 'platform', 'edge']),
64
+ tier: PlatformServiceTierSchema,
46
65
  }) as z.ZodType<DistributionPlatformService>;
47
66
 
48
67
  /**
@@ -64,14 +64,11 @@ export const ExecutionContextBiomeSchema = z.object({
64
64
  * v4.3 §A.3).
65
65
  *
66
66
  * `id` is the canonical `environment:<slug>` ref (string-typed here to
67
- * keep the envelope JSON-clean — the kernel-side reference type lives in
68
- * `@xemahq/execution-environment-contracts`).
67
+ * keep the envelope JSON-clean — the kernel-side reference type lives in the
68
+ * `@xemahq/kernel-contracts/execution-environment` surface).
69
69
  *
70
- * `kind` is the {@link ExecutionEnvironmentKind} value matched against the eight
71
- * built-in environments + the `trusted-dev` escape hatch. The internal
72
- * identifier `ExecutionEnvironmentKind` is still named "Zone" — the rename to
73
- * `ExecutionEnvironmentKind` is scheduled for Phase A.5 (plan §A.1
74
- * follow-up sweep), not Phase A.3.
70
+ * `kind` is the {@link ExecutionEnvironmentKind} value matched against the
71
+ * built-in environments + the `trusted-dev` escape hatch.
75
72
  */
76
73
  export interface ExecutionContextEnvironment {
77
74
  id: string;
@@ -53,10 +53,10 @@ export interface ParsedExecutionEnvironmentRef {
53
53
 
54
54
  /**
55
55
  * Structured error thrown by `parseEnvironmentRef` / `formatEnvironmentRef`.
56
- * Carries the stable `EXECUTION_ENVIRONMENT_REF_INVALID` code. Subclass
57
- * of `CapabilityError` so call sites that already branch on capability-
58
- * layer errors get this for free; the dedicated code keeps the denial
59
- * taxonomy crisp.
56
+ * A subclass of `CapabilityError` carrying `CapabilityErrorCode.CapabilityRefInvalid`
57
+ * an environment ref IS a capability-layer ref, so call sites that already
58
+ * branch on `CapabilityRefInvalid` handle it uniformly. The subclass `name`
59
+ * (`ExecutionEnvironmentRefParseError`) distinguishes it for diagnostics.
60
60
  */
61
61
  export class ExecutionEnvironmentRefParseError extends CapabilityError {
62
62
  constructor(args: { message: string; raw: string }) {
@@ -69,9 +69,6 @@ export class ExecutionEnvironmentRefParseError extends CapabilityError {
69
69
  }
70
70
  }
71
71
 
72
- /** Stable wire code for `ExecutionEnvironmentRefParseError`. */
73
- export const EXECUTION_ENVIRONMENT_REF_INVALID = 'EXECUTION_ENVIRONMENT_REF_INVALID';
74
-
75
72
  /**
76
73
  * Parse an `ExecutionEnvironmentRef` string into its structured parts.
77
74
  * Throws `ExecutionEnvironmentRefParseError` on any grammar violation —