taskflow-mcp-core 0.3.0-beta.1.1 โ†’ 1.0.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 (185) hide show
  1. package/CONTROL_GUIDE.md +113 -0
  2. package/README.md +34 -25
  3. package/dist/control/admission-service.d.ts +15 -0
  4. package/dist/control/admission-service.d.ts.map +1 -0
  5. package/dist/control/admission-service.js +64 -0
  6. package/dist/control/admission-service.js.map +1 -0
  7. package/dist/control/approval-edits.d.ts +12 -0
  8. package/dist/control/approval-edits.d.ts.map +1 -0
  9. package/dist/control/approval-edits.js +66 -0
  10. package/dist/control/approval-edits.js.map +1 -0
  11. package/dist/control/approval-service.d.ts +173 -0
  12. package/dist/control/approval-service.d.ts.map +1 -0
  13. package/dist/control/approval-service.js +342 -0
  14. package/dist/control/approval-service.js.map +1 -0
  15. package/dist/control/authorization.d.ts +94 -0
  16. package/dist/control/authorization.d.ts.map +1 -0
  17. package/dist/control/authorization.js +302 -0
  18. package/dist/control/authorization.js.map +1 -0
  19. package/dist/control/control-cli.d.ts +3 -0
  20. package/dist/control/control-cli.d.ts.map +1 -0
  21. package/dist/control/control-cli.js +279 -0
  22. package/dist/control/control-cli.js.map +1 -0
  23. package/dist/control/control-console.d.ts +17 -0
  24. package/dist/control/control-console.d.ts.map +1 -0
  25. package/dist/control/control-console.js +67 -0
  26. package/dist/control/control-console.js.map +1 -0
  27. package/dist/control/control-host.d.ts +98 -0
  28. package/dist/control/control-host.d.ts.map +1 -0
  29. package/dist/control/control-host.js +459 -0
  30. package/dist/control/control-host.js.map +1 -0
  31. package/dist/control/control-mcp.d.ts +11 -0
  32. package/dist/control/control-mcp.d.ts.map +1 -0
  33. package/dist/control/control-mcp.js +78 -0
  34. package/dist/control/control-mcp.js.map +1 -0
  35. package/dist/control/errors.d.ts +44 -0
  36. package/dist/control/errors.d.ts.map +1 -0
  37. package/dist/control/errors.js +93 -0
  38. package/dist/control/errors.js.map +1 -0
  39. package/dist/control/hello.d.ts +39 -0
  40. package/dist/control/hello.d.ts.map +1 -0
  41. package/dist/control/hello.js +80 -0
  42. package/dist/control/hello.js.map +1 -0
  43. package/dist/control/host-runtime.d.ts +32 -0
  44. package/dist/control/host-runtime.d.ts.map +1 -0
  45. package/dist/control/host-runtime.js +542 -0
  46. package/dist/control/host-runtime.js.map +1 -0
  47. package/dist/control/index.d.ts +32 -0
  48. package/dist/control/index.d.ts.map +1 -0
  49. package/dist/control/index.js +32 -0
  50. package/dist/control/index.js.map +1 -0
  51. package/dist/control/legacy-conflict.d.ts +19 -0
  52. package/dist/control/legacy-conflict.d.ts.map +1 -0
  53. package/dist/control/legacy-conflict.js +176 -0
  54. package/dist/control/legacy-conflict.js.map +1 -0
  55. package/dist/control/local-bootstrap.d.ts +21 -0
  56. package/dist/control/local-bootstrap.d.ts.map +1 -0
  57. package/dist/control/local-bootstrap.js +224 -0
  58. package/dist/control/local-bootstrap.js.map +1 -0
  59. package/dist/control/modes.d.ts +60 -0
  60. package/dist/control/modes.d.ts.map +1 -0
  61. package/dist/control/modes.js +86 -0
  62. package/dist/control/modes.js.map +1 -0
  63. package/dist/control/project-admin-cli.d.ts +3 -0
  64. package/dist/control/project-admin-cli.d.ts.map +1 -0
  65. package/dist/control/project-admin-cli.js +155 -0
  66. package/dist/control/project-admin-cli.js.map +1 -0
  67. package/dist/control/project-registry.d.ts +20 -0
  68. package/dist/control/project-registry.d.ts.map +1 -0
  69. package/dist/control/project-registry.js +181 -0
  70. package/dist/control/project-registry.js.map +1 -0
  71. package/dist/control/runtime-checkpoint.d.ts +11 -0
  72. package/dist/control/runtime-checkpoint.d.ts.map +1 -0
  73. package/dist/control/runtime-checkpoint.js +39 -0
  74. package/dist/control/runtime-checkpoint.js.map +1 -0
  75. package/dist/control/runtime-provider.d.ts +100 -0
  76. package/dist/control/runtime-provider.d.ts.map +1 -0
  77. package/dist/control/runtime-provider.js +258 -0
  78. package/dist/control/runtime-provider.js.map +1 -0
  79. package/dist/control/schema/approval.d.ts +108 -0
  80. package/dist/control/schema/approval.d.ts.map +1 -0
  81. package/dist/control/schema/approval.js +65 -0
  82. package/dist/control/schema/approval.js.map +1 -0
  83. package/dist/control/schema/commands.d.ts +663 -0
  84. package/dist/control/schema/commands.d.ts.map +1 -0
  85. package/dist/control/schema/commands.js +147 -0
  86. package/dist/control/schema/commands.js.map +1 -0
  87. package/dist/control/schema/common.d.ts +24 -0
  88. package/dist/control/schema/common.d.ts.map +1 -0
  89. package/dist/control/schema/common.js +38 -0
  90. package/dist/control/schema/common.js.map +1 -0
  91. package/dist/control/schema/coordinator.d.ts +98 -0
  92. package/dist/control/schema/coordinator.d.ts.map +1 -0
  93. package/dist/control/schema/coordinator.js +87 -0
  94. package/dist/control/schema/coordinator.js.map +1 -0
  95. package/dist/control/schema/evidence.d.ts +140 -0
  96. package/dist/control/schema/evidence.d.ts.map +1 -0
  97. package/dist/control/schema/evidence.js +64 -0
  98. package/dist/control/schema/evidence.js.map +1 -0
  99. package/dist/control/schema/header.d.ts +79 -0
  100. package/dist/control/schema/header.d.ts.map +1 -0
  101. package/dist/control/schema/header.js +66 -0
  102. package/dist/control/schema/header.js.map +1 -0
  103. package/dist/control/schema/index.d.ts +31 -0
  104. package/dist/control/schema/index.d.ts.map +1 -0
  105. package/dist/control/schema/index.js +31 -0
  106. package/dist/control/schema/index.js.map +1 -0
  107. package/dist/control/schema/plan.d.ts +291 -0
  108. package/dist/control/schema/plan.d.ts.map +1 -0
  109. package/dist/control/schema/plan.js +80 -0
  110. package/dist/control/schema/plan.js.map +1 -0
  111. package/dist/control/schema/policy.d.ts +96 -0
  112. package/dist/control/schema/policy.d.ts.map +1 -0
  113. package/dist/control/schema/policy.js +73 -0
  114. package/dist/control/schema/policy.js.map +1 -0
  115. package/dist/control/schema/run.d.ts +61 -0
  116. package/dist/control/schema/run.d.ts.map +1 -0
  117. package/dist/control/schema/run.js +56 -0
  118. package/dist/control/schema/run.js.map +1 -0
  119. package/dist/control/schema/te-mirrors.d.ts +145 -0
  120. package/dist/control/schema/te-mirrors.d.ts.map +1 -0
  121. package/dist/control/schema/te-mirrors.js +145 -0
  122. package/dist/control/schema/te-mirrors.js.map +1 -0
  123. package/dist/control/schema/transport.d.ts +479 -0
  124. package/dist/control/schema/transport.d.ts.map +1 -0
  125. package/dist/control/schema/transport.js +181 -0
  126. package/dist/control/schema/transport.js.map +1 -0
  127. package/dist/control/singleton.d.ts +135 -0
  128. package/dist/control/singleton.d.ts.map +1 -0
  129. package/dist/control/singleton.js +607 -0
  130. package/dist/control/singleton.js.map +1 -0
  131. package/dist/control/store/coordinator-store.d.ts +143 -0
  132. package/dist/control/store/coordinator-store.d.ts.map +1 -0
  133. package/dist/control/store/coordinator-store.js +620 -0
  134. package/dist/control/store/coordinator-store.js.map +1 -0
  135. package/dist/control/store/evidence-adapter.d.ts +10 -0
  136. package/dist/control/store/evidence-adapter.d.ts.map +1 -0
  137. package/dist/control/store/evidence-adapter.js +114 -0
  138. package/dist/control/store/evidence-adapter.js.map +1 -0
  139. package/dist/control/store/evidence-explanation.d.ts +55 -0
  140. package/dist/control/store/evidence-explanation.d.ts.map +1 -0
  141. package/dist/control/store/evidence-explanation.js +50 -0
  142. package/dist/control/store/evidence-explanation.js.map +1 -0
  143. package/dist/control/store/evidence-store.d.ts +143 -0
  144. package/dist/control/store/evidence-store.d.ts.map +1 -0
  145. package/dist/control/store/evidence-store.js +437 -0
  146. package/dist/control/store/evidence-store.js.map +1 -0
  147. package/dist/control/store/index.d.ts +3 -0
  148. package/dist/control/store/index.d.ts.map +1 -0
  149. package/dist/control/store/index.js +2 -0
  150. package/dist/control/store/index.js.map +1 -0
  151. package/dist/control/store/journal.d.ts +270 -0
  152. package/dist/control/store/journal.d.ts.map +1 -0
  153. package/dist/control/store/journal.js +50 -0
  154. package/dist/control/store/journal.js.map +1 -0
  155. package/dist/control/store/project-lifecycle.d.ts +49 -0
  156. package/dist/control/store/project-lifecycle.d.ts.map +1 -0
  157. package/dist/control/store/project-lifecycle.js +288 -0
  158. package/dist/control/store/project-lifecycle.js.map +1 -0
  159. package/dist/control/store/store.d.ts +93 -0
  160. package/dist/control/store/store.d.ts.map +1 -0
  161. package/dist/control/store/store.js +873 -0
  162. package/dist/control/store/store.js.map +1 -0
  163. package/dist/control/te-provider.d.ts +86 -0
  164. package/dist/control/te-provider.d.ts.map +1 -0
  165. package/dist/control/te-provider.js +131 -0
  166. package/dist/control/te-provider.js.map +1 -0
  167. package/dist/control/uds.d.ts +114 -0
  168. package/dist/control/uds.d.ts.map +1 -0
  169. package/dist/control/uds.js +456 -0
  170. package/dist/control/uds.js.map +1 -0
  171. package/dist/control/web-console/view.d.ts +5 -0
  172. package/dist/control/web-console/view.d.ts.map +1 -0
  173. package/dist/control/web-console/view.js +122 -0
  174. package/dist/control/web-console/view.js.map +1 -0
  175. package/dist/control/web-console.d.ts +50 -0
  176. package/dist/control/web-console.d.ts.map +1 -0
  177. package/dist/control/web-console.js +317 -0
  178. package/dist/control/web-console.js.map +1 -0
  179. package/dist/mcp/jsonrpc.d.ts.map +1 -1
  180. package/dist/mcp/jsonrpc.js +12 -3
  181. package/dist/mcp/jsonrpc.js.map +1 -1
  182. package/dist/mcp/server.d.ts.map +1 -1
  183. package/dist/mcp/server.js +26 -17
  184. package/dist/mcp/server.js.map +1 -1
  185. package/package.json +13 -5
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Command + event wire types (๐ŸŸฅ NEW) โ€” the authoritative narrative.
3
+ *
4
+ * Decisions: P12 (immutable CommandRecord committed atomically with its
5
+ * ControlEvents; `(controlDomainId, commandId)` unique), P11 (commitSeq never
6
+ * renumbered; CompactionCheckpointEvent as the only authoritative cursor
7
+ * floor; cursor leases).
8
+ */
9
+ import { createHash } from "node:crypto";
10
+ import { Type } from "typebox";
11
+ import { canonicalJson } from "taskflow-core/flowir/hash";
12
+ import { StringEnum } from "taskflow-core/typebox-helpers";
13
+ import { CONTROL_WIRE_SCHEMA_VERSION, Sha256HexSchema, UuidSchema, } from "./common.js";
14
+ import { ArtifactRefSchema, ReceiptSchema } from "./evidence.js";
15
+ import { ApprovalRequestSchema } from "./approval.js";
16
+ import { RunSnapshotSchema } from "./run.js";
17
+ // ---------------------------------------------------------------------------
18
+ // Command kinds (closed union; P15/P16 kinds, plus the base run command)
19
+ // ---------------------------------------------------------------------------
20
+ export const CommandKindSchema = StringEnum([
21
+ "run.submit",
22
+ "run.cancel",
23
+ "approval.decide",
24
+ "coordinator.setMaxActiveRuns",
25
+ "coordinator.forceRelease",
26
+ ]);
27
+ export const CommandStatusSchema = StringEnum(["accepted", "completed", "failed"]);
28
+ // ---------------------------------------------------------------------------
29
+ // CommandRecord (P12 / RFC ยง9.2) โ€” immutable authority record
30
+ // ---------------------------------------------------------------------------
31
+ export const CommandRecordSchema = Type.Object({
32
+ commandId: UuidSchema,
33
+ kind: CommandKindSchema,
34
+ requestHash: Sha256HexSchema,
35
+ callerPrincipal: Type.String({ minLength: 1 }),
36
+ authorizationContextHash: Sha256HexSchema,
37
+ projectId: UuidSchema,
38
+ controlDomainId: UuidSchema,
39
+ status: CommandStatusSchema,
40
+ firstCommitSeq: Type.Integer({ minimum: 1 }),
41
+ lastCommitSeq: Type.Integer({ minimum: 1 }),
42
+ responseArtifactRef: Type.Optional(ArtifactRefSchema),
43
+ recordedAt: Type.Integer({ minimum: 0 }),
44
+ }, { additionalProperties: false });
45
+ // ---------------------------------------------------------------------------
46
+ // ControlEvent payload โ€” closed union of S2-known narrative kinds
47
+ // (P11 compaction.checkpoint; RFC ยง8.4 reconcile.*; ยง16 dispatch.*;
48
+ // ยง17 approval.*; run terminal). Additive extension bumps schemaVersion.
49
+ // ---------------------------------------------------------------------------
50
+ export const LegacyControlEventPayloadSchema = Type.Union([
51
+ Type.Object({ kind: Type.Literal("command.recorded"), commandId: UuidSchema }, { additionalProperties: false }),
52
+ Type.Object({
53
+ kind: Type.Literal("reconcile.started"),
54
+ attempt: Type.Integer({ minimum: 1 }),
55
+ }, { additionalProperties: false }),
56
+ Type.Object({
57
+ kind: Type.Literal("reconcile.settled"),
58
+ outcome: StringEnum(["running", "terminal", "exhausted"]),
59
+ terminalStatus: Type.Optional(StringEnum(["completed", "failed", "blocked", "cancelled"])),
60
+ }, { additionalProperties: false }),
61
+ Type.Object({
62
+ kind: Type.Literal("dispatch.acknowledged"),
63
+ providerJobHandle: Type.Optional(Type.String({ minLength: 1 })),
64
+ }, { additionalProperties: false }),
65
+ Type.Object({ kind: Type.Literal("dispatch.rejected"), reason: Type.String({ minLength: 1 }) }, { additionalProperties: false }),
66
+ Type.Object({ kind: Type.Literal("dispatch.ambiguous") }, { additionalProperties: false }),
67
+ Type.Object({
68
+ kind: Type.Literal("run.terminal"),
69
+ status: StringEnum(["completed", "failed", "blocked", "cancelled"]),
70
+ }, { additionalProperties: false }),
71
+ Type.Object({
72
+ kind: Type.Literal("approval.pending"),
73
+ approvalRequestId: UuidSchema,
74
+ }, { additionalProperties: false }),
75
+ Type.Object({
76
+ kind: Type.Literal("approval.settled"),
77
+ decision: StringEnum(["approved", "rejected", "expired", "cancelled"]),
78
+ }, { additionalProperties: false }),
79
+ Type.Object({
80
+ kind: Type.Literal("compaction.checkpoint"),
81
+ throughCommitSeq: Type.Integer({ minimum: 1 }),
82
+ }, { additionalProperties: false }),
83
+ ]);
84
+ /** V2 carries complete approval and lifecycle facts. V1 remains read-only. */
85
+ const LifecycleEventPayloadSchema = Type.Union([
86
+ Type.Object({ kind: Type.Literal("approval.pending"), approvalRequestId: UuidSchema, request: ApprovalRequestSchema }, { additionalProperties: false }),
87
+ Type.Object({ kind: Type.Literal("approval.settled"), approvalRequestId: UuidSchema, decision: StringEnum(["approved", "rejected", "edited", "expired", "cancelled"]) }, { additionalProperties: false }),
88
+ Type.Object({ kind: Type.Literal("run.snapshot"), run: RunSnapshotSchema }, { additionalProperties: false }),
89
+ Type.Object({ kind: Type.Literal("approval.release.queued"), approvalRequestId: UuidSchema, intentId: UuidSchema, reservationId: UuidSchema }, { additionalProperties: false }),
90
+ Type.Object({ kind: Type.Literal("approval.release.completed"), approvalRequestId: UuidSchema, intentId: UuidSchema, reservationId: UuidSchema }, { additionalProperties: false }),
91
+ Type.Object({ kind: Type.Literal("approval.readmission.queued"), approvalRequestId: UuidSchema, intentId: UuidSchema, reservationId: UuidSchema }, { additionalProperties: false }),
92
+ Type.Object({ kind: Type.Literal("approval.readmission.completed"), approvalRequestId: UuidSchema, intentId: UuidSchema, reservationId: UuidSchema }, { additionalProperties: false }),
93
+ Type.Object({ kind: Type.Literal("receipt.issued"), receipt: ReceiptSchema }, { additionalProperties: false }),
94
+ Type.Object({ kind: Type.Literal("artifact.recorded"), runId: UuidSchema, commandKind: CommandKindSchema, artifact: ArtifactRefSchema }, { additionalProperties: false }),
95
+ ]);
96
+ // Preserve the literal tuple for TypeBox static inference: a variadic filtered
97
+ // array before new cases can otherwise erase the lifecycle discriminants.
98
+ export const ControlEventPayloadSchema = Type.Union([
99
+ ...LegacyControlEventPayloadSchema.anyOf.filter((schema) => !["approval.pending", "approval.settled"].includes(schema.properties.kind.const)),
100
+ ...LifecycleEventPayloadSchema.anyOf,
101
+ ]);
102
+ // ---------------------------------------------------------------------------
103
+ // ControlEvent (P12 / RFC ยง10) โ€” ledger envelope
104
+ // ---------------------------------------------------------------------------
105
+ const CurrentControlEventSchema = Type.Object({
106
+ eventId: UuidSchema,
107
+ schemaVersion: Type.Literal(CONTROL_WIRE_SCHEMA_VERSION),
108
+ controlDomainId: UuidSchema,
109
+ streamId: Type.String({ minLength: 1 }),
110
+ streamSeq: Type.Integer({ minimum: 1 }),
111
+ commitSeq: Type.Integer({ minimum: 1 }),
112
+ commandId: Type.Optional(UuidSchema),
113
+ commandEventIndex: Type.Optional(Type.Integer({ minimum: 0 })),
114
+ causationId: UuidSchema,
115
+ correlationId: UuidSchema,
116
+ projectId: UuidSchema,
117
+ recordedAt: Type.Integer({ minimum: 0 }),
118
+ payload: ControlEventPayloadSchema,
119
+ }, { additionalProperties: false });
120
+ export const ControlEventSchema = Type.Union([
121
+ CurrentControlEventSchema,
122
+ Type.Object({ ...CurrentControlEventSchema.properties, schemaVersion: Type.Literal(1), payload: LegacyControlEventPayloadSchema }, { additionalProperties: false }),
123
+ ]);
124
+ // ---------------------------------------------------------------------------
125
+ // CompactionCheckpointEvent (P11) โ€” journal-internal cursor floor
126
+ // ---------------------------------------------------------------------------
127
+ export const CompactionCheckpointEventSchema = Type.Object({
128
+ kind: Type.Literal("compaction.checkpoint"),
129
+ throughCommitSeq: Type.Integer({ minimum: 1 }),
130
+ }, { additionalProperties: false });
131
+ // ---------------------------------------------------------------------------
132
+ // CursorState (P11) โ€” cursor/subscription lease
133
+ // ---------------------------------------------------------------------------
134
+ export const CursorStateSchema = Type.Object({
135
+ minAvailableCommitSeq: Type.Integer({ minimum: 1 }),
136
+ cursorId: UuidSchema,
137
+ leaseExpiresAt: Type.Integer({ minimum: 0 }),
138
+ }, { additionalProperties: false });
139
+ // ---------------------------------------------------------------------------
140
+ // Convenience: P12 idempotency / cross-principal markers used by the hello
141
+ // and command layers. Not a separate wire doc โ€” checked against CommandRecord.
142
+ // ---------------------------------------------------------------------------
143
+ /** Canonical request hash over the command body (P12 ยง9.4). */
144
+ export function commandRequestHash(body) {
145
+ return createHash("sha256").update(canonicalJson(body), "utf8").digest("hex");
146
+ }
147
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../../taskflow-control/src/schema/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAe,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EACN,2BAA2B,EAC3B,eAAe,EACf,UAAU,GACV,MAAM,aAAa,CAA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AU;IACpB,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;CAC5C,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAC/B,CAAC;AAOF,8EAA8E;AAC9E,2EAA2E;AAC3E,+EAA+E;AAC/E,8EAA8E;AAE9E,+DAA+D;AAC/D,MAAM,UAAU,kBAAkB,CAAC,IAAa;IAC/C,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/E,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Shared 0.3-C wire conventions: schema version, scalar formats, and the
3
+ * closed-enum helper. Follows the TE convention (`taskflow-core/typebox-helpers`
4
+ * StringEnum) so providers that do not support anyOf/const keep working.
5
+ */
6
+ import { Type } from "typebox";
7
+ import { StringEnum } from "taskflow-core/typebox-helpers";
8
+ /**
9
+ * Single wire schema version for the 0.3-C control plane. Every top-level wire
10
+ * document that carries `schemaVersion` uses this constant; additive evolution
11
+ * bumps it (wire-freeze rule 4: freeze allows only additive changes + bump).
12
+ */
13
+ export declare const CONTROL_WIRE_SCHEMA_VERSION = 2;
14
+ /** Historical journal envelopes remain readable without rewriting their bytes. */
15
+ export declare const LEGACY_CONTROL_WIRE_SCHEMA_VERSION = 1;
16
+ /** UUID v4 scalar convention (ControlDomainId, projectId, eventId, ...). */
17
+ export declare const UuidSchema: Type.TString;
18
+ /** 64-lowercase-hex SHA-256 digest (the only hash family, P6). */
19
+ export declare const Sha256HexSchema: Type.TString;
20
+ /** Canonical (key-sorted, undefined-dropped) hash over a wire document. */
21
+ export declare const CanonicalHashRefSchema: Type.TString;
22
+ export type ControlWireSchemaVersion = typeof CONTROL_WIRE_SCHEMA_VERSION;
23
+ export { StringEnum };
24
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../taskflow-control/src/schema/common.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAC7C,kFAAkF;AAClF,eAAO,MAAM,kCAAkC,IAAI,CAAC;AAEpD,4EAA4E;AAC5E,eAAO,MAAM,UAAU,cAKrB,CAAC;AAEH,kEAAkE;AAClE,eAAO,MAAM,eAAe,cAK1B,CAAC;AAEH,2EAA2E;AAC3E,eAAO,MAAM,sBAAsB,cAKjC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,OAAO,2BAA2B,CAAC;AAE1E,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Shared 0.3-C wire conventions: schema version, scalar formats, and the
3
+ * closed-enum helper. Follows the TE convention (`taskflow-core/typebox-helpers`
4
+ * StringEnum) so providers that do not support anyOf/const keep working.
5
+ */
6
+ import { Type } from "typebox";
7
+ import { StringEnum } from "taskflow-core/typebox-helpers";
8
+ /**
9
+ * Single wire schema version for the 0.3-C control plane. Every top-level wire
10
+ * document that carries `schemaVersion` uses this constant; additive evolution
11
+ * bumps it (wire-freeze rule 4: freeze allows only additive changes + bump).
12
+ */
13
+ export const CONTROL_WIRE_SCHEMA_VERSION = 2;
14
+ /** Historical journal envelopes remain readable without rewriting their bytes. */
15
+ export const LEGACY_CONTROL_WIRE_SCHEMA_VERSION = 1;
16
+ /** UUID v4 scalar convention (ControlDomainId, projectId, eventId, ...). */
17
+ export const UuidSchema = Type.String({
18
+ minLength: 36,
19
+ maxLength: 36,
20
+ pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
21
+ description: "UUID v4 scalar",
22
+ });
23
+ /** 64-lowercase-hex SHA-256 digest (the only hash family, P6). */
24
+ export const Sha256HexSchema = Type.String({
25
+ minLength: 64,
26
+ maxLength: 64,
27
+ pattern: "^[0-9a-f]{64}$",
28
+ description: "SHA-256 digest as 64 lowercase hex chars",
29
+ });
30
+ /** Canonical (key-sorted, undefined-dropped) hash over a wire document. */
31
+ export const CanonicalHashRefSchema = Type.String({
32
+ minLength: 66,
33
+ maxLength: 96,
34
+ pattern: "^[a-z0-9]+:[0-9a-f]{64}$",
35
+ description: "Domain-separated content hash, e.g. ir:<64-hex> or plan:<64-hex>",
36
+ });
37
+ export { StringEnum };
38
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../taskflow-control/src/schema/common.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAC7C,kFAAkF;AAClF,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC;AAEpD,4EAA4E;AAC5E,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IACrC,SAAS,EAAE,EAAE;IACb,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,+EAA+E;IACxF,WAAW,EAAE,gBAAgB;CAC7B,CAAC,CAAC;AAEH,kEAAkE;AAClE,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC;IAC1C,SAAS,EAAE,EAAE;IACb,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,gBAAgB;IACzB,WAAW,EAAE,0CAA0C;CACvD,CAAC,CAAC;AAEH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,MAAM,CAAC;IACjD,SAAS,EAAE,EAAE;IACb,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,0BAA0B;IACnC,WAAW,EAAE,kEAAkE;CAC/E,CAAC,CAAC;AAIH,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * UserCoordinatorStore wire types (๐ŸŸฅ NEW) โ€” singleton lease + global
3
+ * concurrency reservations + narrow coordinator commands.
4
+ *
5
+ * Decisions: P16 โ€” slots โ‰ก 1 per admitted run; capacity formula
6
+ * count(reserved|committed|orphan-suspect) โ‰ค maxActiveRuns; committed never
7
+ * TTL-released (D37 normalRelease/forceRelease only); D2 admission uniqueness;
8
+ * D3 legacy residue fail-closed; D4 idempotent release.
9
+ */
10
+ import { Type } from "typebox";
11
+ export declare const CoordinatorLeaseSchema: Type.TObject<{
12
+ holderId: Type.TString;
13
+ fencingEpoch: Type.TInteger;
14
+ endpoint: Type.TString;
15
+ expiresAt: Type.TInteger;
16
+ }>;
17
+ export type CoordinatorLease = {
18
+ holderId: string;
19
+ fencingEpoch: number;
20
+ endpoint: string;
21
+ expiresAt: number;
22
+ };
23
+ export declare const ReservationStateSchema: import("typebox").TUnsafe<string>;
24
+ export type ReservationState = "reserved" | "committed" | "released" | "expired" | "orphan-suspect";
25
+ export declare const ConcurrencyReservationSchema: Type.TObject<{
26
+ reservationId: Type.TString;
27
+ state: import("typebox").TUnsafe<string>;
28
+ slots: Type.TLiteral<1>;
29
+ projectId: Type.TString;
30
+ projectControlDomainId: Type.TString;
31
+ runId: Type.TString;
32
+ projectAdmitCommitSeq: Type.TOptional<Type.TInteger>;
33
+ attemptId: Type.TOptional<Type.TString>;
34
+ providerJobHandle: Type.TOptional<Type.TString>;
35
+ coordinatorEpoch: Type.TInteger;
36
+ reservedExpiresAt: Type.TOptional<Type.TInteger>;
37
+ renewedAt: Type.TOptional<Type.TInteger>;
38
+ }>;
39
+ export type ConcurrencyReservation = {
40
+ reservationId: string;
41
+ state: ReservationState;
42
+ slots: 1;
43
+ projectId: string;
44
+ projectControlDomainId: string;
45
+ runId: string;
46
+ projectAdmitCommitSeq?: number;
47
+ attemptId?: string;
48
+ providerJobHandle?: string;
49
+ coordinatorEpoch: number;
50
+ reservedExpiresAt?: number;
51
+ renewedAt?: number;
52
+ };
53
+ /**
54
+ * P16 D2/D3 invariants, enforced at the store boundary (fail closed):
55
+ * - committed/orphan-suspect rows MUST carry projectAdmitCommitSeq (D3 residue
56
+ * that keeps a TTL field on a committed row is a separate check).
57
+ * - a reservation with a stale state/identity mismatch is rejected.
58
+ * TypeBox alone cannot express the state-conditional requirement, so the
59
+ * store layer asserts it here.
60
+ */
61
+ export declare function assertReservationInvariants(reservation: ConcurrencyReservation): void;
62
+ export declare const CoordinatorCommandKindSchema: import("typebox").TUnsafe<string>;
63
+ export type CoordinatorCommandKind = "setMaxActiveRuns" | "forceRelease";
64
+ export declare const CoordinatorCommandStatusSchema: import("typebox").TUnsafe<string>;
65
+ export type CoordinatorCommandStatus = "accepted" | "completed" | "failed";
66
+ export declare const CoordinatorCommandRecordSchema: Type.TObject<{
67
+ commandId: Type.TString;
68
+ kind: import("typebox").TUnsafe<string>;
69
+ requestHash: Type.TString;
70
+ callerPrincipal: Type.TString;
71
+ firstCommitSeq: Type.TInteger;
72
+ lastCommitSeq: Type.TInteger;
73
+ status: import("typebox").TUnsafe<string>;
74
+ }>;
75
+ export type CoordinatorCommandRecord = {
76
+ commandId: string;
77
+ kind: CoordinatorCommandKind;
78
+ requestHash: string;
79
+ callerPrincipal: string;
80
+ firstCommitSeq: number;
81
+ lastCommitSeq: number;
82
+ status: CoordinatorCommandStatus;
83
+ };
84
+ export declare const CapacitySnapshotSchema: Type.TObject<{
85
+ maxActiveRuns: Type.TInteger;
86
+ active: Type.TInteger;
87
+ reserved: Type.TInteger;
88
+ committed: Type.TInteger;
89
+ orphanSuspect: Type.TInteger;
90
+ }>;
91
+ export type CapacitySnapshot = {
92
+ maxActiveRuns: number;
93
+ active: number;
94
+ reserved: number;
95
+ committed: number;
96
+ orphanSuspect: number;
97
+ };
98
+ //# sourceMappingURL=coordinator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../../../taskflow-control/src/schema/coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAQ/B,eAAO,MAAM,sBAAsB;;;;;EAQlC,CAAC;AACF,MAAM,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CAClB,CAAC;AAMF,eAAO,MAAM,sBAAsB,mCAAiF,CAAC;AACrH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,gBAAgB,CAAC;AAEpG,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;EAkBxC,CAAC;AACF,MAAM,MAAM,sBAAsB,GAAG;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,gBAAgB,CAAC;IACxB,KAAK,EAAE,CAAC,CAAC;IACT,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,sBAAsB,GAAG,IAAI,CAYrF;AAMD,eAAO,MAAM,4BAA4B,mCAAmD,CAAC;AAC7F,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,GAAG,cAAc,CAAC;AAEzE,eAAO,MAAM,8BAA8B,mCAAkD,CAAC;AAC9F,MAAM,MAAM,wBAAwB,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE3E,eAAO,MAAM,8BAA8B;;;;;;;;EAW1C,CAAC;AACF,MAAM,MAAM,wBAAwB,GAAG;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,sBAAsB,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,wBAAwB,CAAC;CACjC,CAAC;AAMF,eAAO,MAAM,sBAAsB;;;;;;EASlC,CAAC;AACF,MAAM,MAAM,gBAAgB,GAAG;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACtB,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * UserCoordinatorStore wire types (๐ŸŸฅ NEW) โ€” singleton lease + global
3
+ * concurrency reservations + narrow coordinator commands.
4
+ *
5
+ * Decisions: P16 โ€” slots โ‰ก 1 per admitted run; capacity formula
6
+ * count(reserved|committed|orphan-suspect) โ‰ค maxActiveRuns; committed never
7
+ * TTL-released (D37 normalRelease/forceRelease only); D2 admission uniqueness;
8
+ * D3 legacy residue fail-closed; D4 idempotent release.
9
+ */
10
+ import { Type } from "typebox";
11
+ import { StringEnum } from "taskflow-core/typebox-helpers";
12
+ import { Sha256HexSchema, UuidSchema } from "./common.js";
13
+ // ---------------------------------------------------------------------------
14
+ // CoordinatorLease (P16 / D32)
15
+ // ---------------------------------------------------------------------------
16
+ export const CoordinatorLeaseSchema = Type.Object({
17
+ holderId: Type.String({ minLength: 1 }),
18
+ fencingEpoch: Type.Integer({ minimum: 0 }),
19
+ endpoint: Type.String({ minLength: 1 }),
20
+ expiresAt: Type.Integer({ minimum: 0 }),
21
+ }, { additionalProperties: false });
22
+ // ---------------------------------------------------------------------------
23
+ // ConcurrencyReservation (P16)
24
+ // ---------------------------------------------------------------------------
25
+ export const ReservationStateSchema = StringEnum(["reserved", "committed", "released", "expired", "orphan-suspect"]);
26
+ export const ConcurrencyReservationSchema = Type.Object({
27
+ reservationId: UuidSchema,
28
+ state: ReservationStateSchema,
29
+ slots: Type.Literal(1),
30
+ projectId: UuidSchema,
31
+ projectControlDomainId: UuidSchema,
32
+ runId: UuidSchema,
33
+ // Required once admitted (state โˆˆ {committed, orphan-suspect}); absent
34
+ // during the pre-admit reserved window (P16 crash matrix).
35
+ projectAdmitCommitSeq: Type.Optional(Type.Integer({ minimum: 1 })),
36
+ attemptId: Type.Optional(UuidSchema),
37
+ providerJobHandle: Type.Optional(Type.String({ minLength: 1 })),
38
+ coordinatorEpoch: Type.Integer({ minimum: 0 }),
39
+ reservedExpiresAt: Type.Optional(Type.Integer({ minimum: 0 })),
40
+ renewedAt: Type.Optional(Type.Integer({ minimum: 0 })),
41
+ }, { additionalProperties: false });
42
+ /**
43
+ * P16 D2/D3 invariants, enforced at the store boundary (fail closed):
44
+ * - committed/orphan-suspect rows MUST carry projectAdmitCommitSeq (D3 residue
45
+ * that keeps a TTL field on a committed row is a separate check).
46
+ * - a reservation with a stale state/identity mismatch is rejected.
47
+ * TypeBox alone cannot express the state-conditional requirement, so the
48
+ * store layer asserts it here.
49
+ */
50
+ export function assertReservationInvariants(reservation) {
51
+ if (reservation.state === "committed" || reservation.state === "orphan-suspect") {
52
+ if (reservation.projectAdmitCommitSeq === undefined) {
53
+ throw new Error("TF_ADMISSION_BINDING_CONFLICT: committed/orphan-suspect reservation requires projectAdmitCommitSeq");
54
+ }
55
+ if (reservation.reservedExpiresAt !== undefined) {
56
+ throw new Error("TF_ADMISSION_BINDING_CONFLICT: committed/orphan-suspect reservation must not retain reservedExpiresAt (P16 D3)");
57
+ }
58
+ }
59
+ if (reservation.slots !== 1) {
60
+ throw new Error("TF_ADMISSION_BINDING_CONFLICT: 0.3 slots are fixed at 1 (P16)");
61
+ }
62
+ }
63
+ // ---------------------------------------------------------------------------
64
+ // CoordinatorCommandRecord (P16 / D6) โ€” narrow command authority
65
+ // ---------------------------------------------------------------------------
66
+ export const CoordinatorCommandKindSchema = StringEnum(["setMaxActiveRuns", "forceRelease"]);
67
+ export const CoordinatorCommandStatusSchema = StringEnum(["accepted", "completed", "failed"]);
68
+ export const CoordinatorCommandRecordSchema = Type.Object({
69
+ commandId: UuidSchema,
70
+ kind: CoordinatorCommandKindSchema,
71
+ requestHash: Sha256HexSchema,
72
+ callerPrincipal: Type.String({ minLength: 1 }),
73
+ firstCommitSeq: Type.Integer({ minimum: 1 }),
74
+ lastCommitSeq: Type.Integer({ minimum: 1 }),
75
+ status: CoordinatorCommandStatusSchema,
76
+ }, { additionalProperties: false });
77
+ // ---------------------------------------------------------------------------
78
+ // CapacitySnapshot (P16) โ€” metering/statistics
79
+ // ---------------------------------------------------------------------------
80
+ export const CapacitySnapshotSchema = Type.Object({
81
+ maxActiveRuns: Type.Integer({ minimum: 1 }),
82
+ active: Type.Integer({ minimum: 0 }),
83
+ reserved: Type.Integer({ minimum: 0 }),
84
+ committed: Type.Integer({ minimum: 0 }),
85
+ orphanSuspect: Type.Integer({ minimum: 0 }),
86
+ }, { additionalProperties: false });
87
+ //# sourceMappingURL=coordinator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../../../../taskflow-control/src/schema/coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,eAAe,EA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UAAU;IACrB,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE,eAAe;IAC5B,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IAC9C,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IAC5C,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IAC3C,MAAM,EAAE,8BAA8B;CACtC,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAC/B,CAAC;AAWF,8EAA8E;AAC9E,+CAA+C;AAC/C,8EAA8E;AAE9E,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,MAAM,CAChD;IACC,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IAC3C,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACpC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACtC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACvC,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;CAC3C,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAC/B,CAAC"}
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Evidence wire types (๐ŸŸฅ NEW): ArtifactRef, Receipt, ReceiptAssurance.
3
+ *
4
+ * Decisions: P6 (digest is not a bearer token; ledger reachability authorizes
5
+ * read), P11 (Receipt survives compaction; manifests issued at receipt time
6
+ * remain valid), P14 (receipts dir under the store), P8 (assurance.enforcement
7
+ * records the promise; observedRevocationLatencyMs optional).
8
+ */
9
+ import { Type } from "typebox";
10
+ import { CONTROL_WIRE_SCHEMA_VERSION } from "./common.ts";
11
+ import type { ConfidentialityLabel, IntegrityLabel } from "taskflow-core/effects/types";
12
+ import { type EnforcementCapabilities } from "./policy.ts";
13
+ export declare const ArtifactRefSchema: Type.TObject<{
14
+ digest: Type.TString;
15
+ size: Type.TInteger;
16
+ mediaType: Type.TString;
17
+ storageClass: Type.TString;
18
+ redactionClass: Type.TString;
19
+ }>;
20
+ export type ArtifactRef = {
21
+ digest: string;
22
+ size: number;
23
+ mediaType: string;
24
+ storageClass: string;
25
+ redactionClass: string;
26
+ };
27
+ export declare const ProviderOutcomeSchema: import("typebox").TUnsafe<string>;
28
+ export type ProviderOutcome = "completed" | "failed" | "ambiguous" | "operator-intervened";
29
+ export declare const ArtifactIntegritySchema: import("typebox").TUnsafe<string>;
30
+ export type ArtifactIntegrity = "verified" | "unknown";
31
+ export declare const ReceiptAssuranceSchema: Type.TObject<{
32
+ journalContinuity: Type.TBoolean;
33
+ providerOutcome: import("typebox").TUnsafe<string>;
34
+ artifactIntegrity: import("typebox").TUnsafe<string>;
35
+ provenance: Type.TObject<{
36
+ confidentiality: import("typebox").TUnsafe<string>;
37
+ integrity: import("typebox").TUnsafe<string>;
38
+ }>;
39
+ enforcement: Type.TObject<{
40
+ capabilities: Type.TObject<{
41
+ resolution: import("typebox").TUnsafe<string>;
42
+ mutationMediation: import("typebox").TUnsafe<string>;
43
+ processIsolation: import("typebox").TUnsafe<string>;
44
+ revocation: Type.TUnion<[Type.TLiteral<"admission-only">, Type.TLiteral<"per-mutation">, Type.TObject<{
45
+ mode: Type.TLiteral<"bounded-latency">;
46
+ maxLatencyMs: Type.TInteger;
47
+ }>]>;
48
+ baselinePolicyId: Type.TString;
49
+ hostProbeSha256: Type.TString;
50
+ }>;
51
+ observedRevocationLatencyMs: Type.TOptional<Type.TInteger>;
52
+ }>;
53
+ }>;
54
+ export type ReceiptAssurance = {
55
+ journalContinuity: boolean;
56
+ providerOutcome: ProviderOutcome;
57
+ artifactIntegrity: ArtifactIntegrity;
58
+ provenance: {
59
+ confidentiality: ConfidentialityLabel;
60
+ integrity: IntegrityLabel;
61
+ };
62
+ enforcement: {
63
+ capabilities: EnforcementCapabilities;
64
+ observedRevocationLatencyMs?: number;
65
+ };
66
+ };
67
+ export declare const BuildInfoWireSchema: Type.TObject<{
68
+ packageVersion: Type.TString;
69
+ gitCommit: Type.TString;
70
+ schemaVersion: Type.TInteger;
71
+ buildTime: Type.TOptional<Type.TInteger>;
72
+ }>;
73
+ export type BuildInfoWire = {
74
+ packageVersion: string;
75
+ gitCommit: string;
76
+ schemaVersion: number;
77
+ buildTime?: number;
78
+ };
79
+ export declare const ReceiptSchema: Type.TObject<{
80
+ schemaVersion: Type.TLiteral<2>;
81
+ controlDomainId: Type.TString;
82
+ runId: Type.TString;
83
+ boundPlanHash: Type.TOptional<Type.TString>;
84
+ boundFragmentHash: Type.TOptional<Type.TString>;
85
+ eventManifest: Type.TArray<Type.TString>;
86
+ manifestRoot: Type.TString;
87
+ startCommitSeq: Type.TInteger;
88
+ endCommitSeq: Type.TInteger;
89
+ artifactRefs: Type.TArray<Type.TObject<{
90
+ digest: Type.TString;
91
+ size: Type.TInteger;
92
+ mediaType: Type.TString;
93
+ storageClass: Type.TString;
94
+ redactionClass: Type.TString;
95
+ }>>;
96
+ assurance: Type.TObject<{
97
+ journalContinuity: Type.TBoolean;
98
+ providerOutcome: import("typebox").TUnsafe<string>;
99
+ artifactIntegrity: import("typebox").TUnsafe<string>;
100
+ provenance: Type.TObject<{
101
+ confidentiality: import("typebox").TUnsafe<string>;
102
+ integrity: import("typebox").TUnsafe<string>;
103
+ }>;
104
+ enforcement: Type.TObject<{
105
+ capabilities: Type.TObject<{
106
+ resolution: import("typebox").TUnsafe<string>;
107
+ mutationMediation: import("typebox").TUnsafe<string>;
108
+ processIsolation: import("typebox").TUnsafe<string>;
109
+ revocation: Type.TUnion<[Type.TLiteral<"admission-only">, Type.TLiteral<"per-mutation">, Type.TObject<{
110
+ mode: Type.TLiteral<"bounded-latency">;
111
+ maxLatencyMs: Type.TInteger;
112
+ }>]>;
113
+ baselinePolicyId: Type.TString;
114
+ hostProbeSha256: Type.TString;
115
+ }>;
116
+ observedRevocationLatencyMs: Type.TOptional<Type.TInteger>;
117
+ }>;
118
+ }>;
119
+ buildInfo: Type.TObject<{
120
+ packageVersion: Type.TString;
121
+ gitCommit: Type.TString;
122
+ schemaVersion: Type.TInteger;
123
+ buildTime: Type.TOptional<Type.TInteger>;
124
+ }>;
125
+ }>;
126
+ export type Receipt = {
127
+ schemaVersion: typeof CONTROL_WIRE_SCHEMA_VERSION;
128
+ controlDomainId: string;
129
+ runId: string;
130
+ boundPlanHash?: string;
131
+ boundFragmentHash?: string;
132
+ eventManifest: string[];
133
+ manifestRoot: string;
134
+ startCommitSeq: number;
135
+ endCommitSeq: number;
136
+ artifactRefs: ArtifactRef[];
137
+ assurance: ReceiptAssurance;
138
+ buildInfo: BuildInfoWire;
139
+ };
140
+ //# sourceMappingURL=evidence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evidence.d.ts","sourceRoot":"","sources":["../../../../taskflow-control/src/schema/evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,2BAA2B,EAA+B,MAAM,aAAa,CAAC;AACvF,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACxF,OAAO,EAAiC,KAAK,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAM1F,eAAO,MAAM,iBAAiB;;;;;;EAS7B,CAAC;AACF,MAAM,MAAM,WAAW,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACvB,CAAC;AAMF,eAAO,MAAM,qBA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M,CAAC;IACrB,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,SAAS,EAAE,aAAa,CAAC;CACzB,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Evidence wire types (๐ŸŸฅ NEW): ArtifactRef, Receipt, ReceiptAssurance.
3
+ *
4
+ * Decisions: P6 (digest is not a bearer token; ledger reachability authorizes
5
+ * read), P11 (Receipt survives compaction; manifests issued at receipt time
6
+ * remain valid), P14 (receipts dir under the store), P8 (assurance.enforcement
7
+ * records the promise; observedRevocationLatencyMs optional).
8
+ */
9
+ import { Type } from "typebox";
10
+ import { StringEnum } from "taskflow-core/typebox-helpers";
11
+ import { CONTROL_WIRE_SCHEMA_VERSION, Sha256HexSchema, UuidSchema } from "./common.js";
12
+ import { EnforcementCapabilitiesSchema } from "./policy.js";
13
+ // ---------------------------------------------------------------------------
14
+ // ArtifactRef (P6 / RFC ยง12)
15
+ // ---------------------------------------------------------------------------
16
+ export const ArtifactRefSchema = Type.Object({
17
+ digest: Sha256HexSchema,
18
+ size: Type.Integer({ minimum: 0 }),
19
+ mediaType: Type.String({ minLength: 1 }),
20
+ storageClass: Type.String({ minLength: 1 }),
21
+ redactionClass: Type.String({ minLength: 1 }),
22
+ }, { additionalProperties: false });
23
+ // ---------------------------------------------------------------------------
24
+ // ReceiptAssurance (P8/P11)
25
+ // ---------------------------------------------------------------------------
26
+ export const ProviderOutcomeSchema = StringEnum(["completed", "failed", "ambiguous", "operator-intervened"]);
27
+ export const ArtifactIntegritySchema = StringEnum(["verified", "unknown"]);
28
+ export const ReceiptAssuranceSchema = Type.Object({
29
+ journalContinuity: Type.Boolean(),
30
+ providerOutcome: ProviderOutcomeSchema,
31
+ artifactIntegrity: ArtifactIntegritySchema,
32
+ provenance: Type.Object({
33
+ confidentiality: StringEnum(["public", "internal", "secret"]),
34
+ integrity: StringEnum(["untrusted", "project", "verified"]),
35
+ }, { additionalProperties: false }),
36
+ enforcement: Type.Object({
37
+ capabilities: EnforcementCapabilitiesSchema,
38
+ observedRevocationLatencyMs: Type.Optional(Type.Integer({ minimum: 0 })),
39
+ }, { additionalProperties: false }),
40
+ }, { additionalProperties: false });
41
+ // ---------------------------------------------------------------------------
42
+ // Receipt (P11/P14) โ€” issued once, immutable
43
+ // ---------------------------------------------------------------------------
44
+ export const BuildInfoWireSchema = Type.Object({
45
+ packageVersion: Type.String({ minLength: 1 }),
46
+ gitCommit: Type.String({ minLength: 1 }),
47
+ schemaVersion: Type.Integer({ minimum: 0 }),
48
+ buildTime: Type.Optional(Type.Integer({ minimum: 0 })),
49
+ }, { additionalProperties: false });
50
+ export const ReceiptSchema = Type.Object({
51
+ schemaVersion: Type.Literal(CONTROL_WIRE_SCHEMA_VERSION),
52
+ controlDomainId: UuidSchema,
53
+ runId: UuidSchema,
54
+ boundPlanHash: Type.Optional(Type.String({ minLength: 1 })),
55
+ boundFragmentHash: Type.Optional(Type.String({ minLength: 1 })),
56
+ eventManifest: Type.Array(UuidSchema),
57
+ manifestRoot: Sha256HexSchema,
58
+ startCommitSeq: Type.Integer({ minimum: 1 }),
59
+ endCommitSeq: Type.Integer({ minimum: 1 }),
60
+ artifactRefs: Type.Array(ArtifactRefSchema),
61
+ assurance: ReceiptAssuranceSchema,
62
+ buildInfo: BuildInfoWireSchema,
63
+ }, { additionalProperties: false });
64
+ //# sourceMappingURL=evidence.js.map