@maiaos/protocol 0.1.0-canary.44938d4.manual.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.
Files changed (246) hide show
  1. package/README.md +239 -0
  2. package/dist/aggregate/revision-effect-schema.d.ts +3 -0
  3. package/dist/aggregate/revision-effect-schema.d.ts.map +1 -0
  4. package/dist/aggregate/revision-effect-schema.js +4 -0
  5. package/dist/aggregate/revision-effect-schema.js.map +1 -0
  6. package/dist/capability.d.ts +12 -0
  7. package/dist/capability.d.ts.map +1 -0
  8. package/dist/capability.js +27 -0
  9. package/dist/capability.js.map +1 -0
  10. package/dist/command-receipt/contract.d.ts +85 -0
  11. package/dist/command-receipt/contract.d.ts.map +1 -0
  12. package/dist/command-receipt/contract.js +12 -0
  13. package/dist/command-receipt/contract.js.map +1 -0
  14. package/dist/command-receipt/effect-schema.d.ts +78 -0
  15. package/dist/command-receipt/effect-schema.d.ts.map +1 -0
  16. package/dist/command-receipt/effect-schema.js +72 -0
  17. package/dist/command-receipt/effect-schema.js.map +1 -0
  18. package/dist/command-receipt/policy.d.ts +16 -0
  19. package/dist/command-receipt/policy.d.ts.map +1 -0
  20. package/dist/command-receipt/policy.js +76 -0
  21. package/dist/command-receipt/policy.js.map +1 -0
  22. package/dist/command-receipt/version.d.ts +2 -0
  23. package/dist/command-receipt/version.d.ts.map +1 -0
  24. package/dist/command-receipt/version.js +2 -0
  25. package/dist/command-receipt/version.js.map +1 -0
  26. package/dist/configuration.d.ts +63 -0
  27. package/dist/configuration.d.ts.map +1 -0
  28. package/dist/configuration.js +93 -0
  29. package/dist/configuration.js.map +1 -0
  30. package/dist/envelope-effect-schema.d.ts +49 -0
  31. package/dist/envelope-effect-schema.d.ts.map +1 -0
  32. package/dist/envelope-effect-schema.js +50 -0
  33. package/dist/envelope-effect-schema.js.map +1 -0
  34. package/dist/envelope-policy.d.ts +4 -0
  35. package/dist/envelope-policy.d.ts.map +1 -0
  36. package/dist/envelope-policy.js +4 -0
  37. package/dist/envelope-policy.js.map +1 -0
  38. package/dist/envelope.d.ts +52 -0
  39. package/dist/envelope.d.ts.map +1 -0
  40. package/dist/envelope.js +41 -0
  41. package/dist/envelope.js.map +1 -0
  42. package/dist/execution/contract.d.ts +230 -0
  43. package/dist/execution/contract.d.ts.map +1 -0
  44. package/dist/execution/contract.js +16 -0
  45. package/dist/execution/contract.js.map +1 -0
  46. package/dist/execution/effect-schema.d.ts +370 -0
  47. package/dist/execution/effect-schema.d.ts.map +1 -0
  48. package/dist/execution/effect-schema.js +148 -0
  49. package/dist/execution/effect-schema.js.map +1 -0
  50. package/dist/execution/version.d.ts +5 -0
  51. package/dist/execution/version.d.ts.map +1 -0
  52. package/dist/execution/version.js +5 -0
  53. package/dist/execution/version.js.map +1 -0
  54. package/dist/harness/installed/contract.d.ts +144 -0
  55. package/dist/harness/installed/contract.d.ts.map +1 -0
  56. package/dist/harness/installed/contract.js +6 -0
  57. package/dist/harness/installed/contract.js.map +1 -0
  58. package/dist/harness/installed/effect-schema.d.ts +261 -0
  59. package/dist/harness/installed/effect-schema.d.ts.map +1 -0
  60. package/dist/harness/installed/effect-schema.js +63 -0
  61. package/dist/harness/installed/effect-schema.js.map +1 -0
  62. package/dist/harness/installed/version.d.ts +2 -0
  63. package/dist/harness/installed/version.d.ts.map +1 -0
  64. package/dist/harness/installed/version.js +2 -0
  65. package/dist/harness/installed/version.js.map +1 -0
  66. package/dist/index.d.ts +18 -0
  67. package/dist/index.d.ts.map +1 -0
  68. package/dist/index.js +18 -0
  69. package/dist/index.js.map +1 -0
  70. package/dist/integration-authorization/contract.d.ts +3495 -0
  71. package/dist/integration-authorization/contract.d.ts.map +1 -0
  72. package/dist/integration-authorization/contract.js +25 -0
  73. package/dist/integration-authorization/contract.js.map +1 -0
  74. package/dist/integration-authorization/effect-schema.d.ts +4495 -0
  75. package/dist/integration-authorization/effect-schema.d.ts.map +1 -0
  76. package/dist/integration-authorization/effect-schema.js +293 -0
  77. package/dist/integration-authorization/effect-schema.js.map +1 -0
  78. package/dist/integration-authorization/policy.d.ts +5 -0
  79. package/dist/integration-authorization/policy.d.ts.map +1 -0
  80. package/dist/integration-authorization/policy.js +5 -0
  81. package/dist/integration-authorization/policy.js.map +1 -0
  82. package/dist/integration-authorization/version.d.ts +2 -0
  83. package/dist/integration-authorization/version.d.ts.map +1 -0
  84. package/dist/integration-authorization/version.js +2 -0
  85. package/dist/integration-authorization/version.js.map +1 -0
  86. package/dist/invocation-context/contract.d.ts +38 -0
  87. package/dist/invocation-context/contract.d.ts.map +1 -0
  88. package/dist/invocation-context/contract.js +7 -0
  89. package/dist/invocation-context/contract.js.map +1 -0
  90. package/dist/invocation-context/effect-schema.d.ts +63 -0
  91. package/dist/invocation-context/effect-schema.d.ts.map +1 -0
  92. package/dist/invocation-context/effect-schema.js +52 -0
  93. package/dist/invocation-context/effect-schema.js.map +1 -0
  94. package/dist/invocation-context/policy.d.ts +8 -0
  95. package/dist/invocation-context/policy.d.ts.map +1 -0
  96. package/dist/invocation-context/policy.js +8 -0
  97. package/dist/invocation-context/policy.js.map +1 -0
  98. package/dist/invocation-context/version.d.ts +2 -0
  99. package/dist/invocation-context/version.d.ts.map +1 -0
  100. package/dist/invocation-context/version.js +2 -0
  101. package/dist/invocation-context/version.js.map +1 -0
  102. package/dist/local-node/contract.d.ts +233 -0
  103. package/dist/local-node/contract.d.ts.map +1 -0
  104. package/dist/local-node/contract.js +43 -0
  105. package/dist/local-node/contract.js.map +1 -0
  106. package/dist/local-node/effect-schema.d.ts +58786 -0
  107. package/dist/local-node/effect-schema.d.ts.map +1 -0
  108. package/dist/local-node/effect-schema.js +279 -0
  109. package/dist/local-node/effect-schema.js.map +1 -0
  110. package/dist/local-node/methods.d.ts +4 -0
  111. package/dist/local-node/methods.d.ts.map +1 -0
  112. package/dist/local-node/methods.js +73 -0
  113. package/dist/local-node/methods.js.map +1 -0
  114. package/dist/local-node/policy.d.ts +11 -0
  115. package/dist/local-node/policy.d.ts.map +1 -0
  116. package/dist/local-node/policy.js +11 -0
  117. package/dist/local-node/policy.js.map +1 -0
  118. package/dist/local-node.d.ts +2 -0
  119. package/dist/local-node.d.ts.map +1 -0
  120. package/dist/local-node.js +2 -0
  121. package/dist/local-node.js.map +1 -0
  122. package/dist/orchestration/canonical.d.ts +12 -0
  123. package/dist/orchestration/canonical.d.ts.map +1 -0
  124. package/dist/orchestration/canonical.js +50 -0
  125. package/dist/orchestration/canonical.js.map +1 -0
  126. package/dist/orchestration/contract.d.ts +2867 -0
  127. package/dist/orchestration/contract.d.ts.map +1 -0
  128. package/dist/orchestration/contract.js +45 -0
  129. package/dist/orchestration/contract.js.map +1 -0
  130. package/dist/orchestration/effect-schema.d.ts +4933 -0
  131. package/dist/orchestration/effect-schema.d.ts.map +1 -0
  132. package/dist/orchestration/effect-schema.js +610 -0
  133. package/dist/orchestration/effect-schema.js.map +1 -0
  134. package/dist/orchestration/policy.d.ts +28 -0
  135. package/dist/orchestration/policy.d.ts.map +1 -0
  136. package/dist/orchestration/policy.js +28 -0
  137. package/dist/orchestration/policy.js.map +1 -0
  138. package/dist/orchestration/topology.d.ts +13 -0
  139. package/dist/orchestration/topology.d.ts.map +1 -0
  140. package/dist/orchestration/topology.js +109 -0
  141. package/dist/orchestration/topology.js.map +1 -0
  142. package/dist/orchestration/version.d.ts +3 -0
  143. package/dist/orchestration/version.d.ts.map +1 -0
  144. package/dist/orchestration/version.js +3 -0
  145. package/dist/orchestration/version.js.map +1 -0
  146. package/dist/project-workspace/contract.d.ts +346 -0
  147. package/dist/project-workspace/contract.d.ts.map +1 -0
  148. package/dist/project-workspace/contract.js +20 -0
  149. package/dist/project-workspace/contract.js.map +1 -0
  150. package/dist/project-workspace/effect-schema.d.ts +602 -0
  151. package/dist/project-workspace/effect-schema.d.ts.map +1 -0
  152. package/dist/project-workspace/effect-schema.js +185 -0
  153. package/dist/project-workspace/effect-schema.js.map +1 -0
  154. package/dist/project-workspace/version.d.ts +5 -0
  155. package/dist/project-workspace/version.d.ts.map +1 -0
  156. package/dist/project-workspace/version.js +5 -0
  157. package/dist/project-workspace/version.js.map +1 -0
  158. package/dist/runtime/contract.d.ts +172 -0
  159. package/dist/runtime/contract.d.ts.map +1 -0
  160. package/dist/runtime/contract.js +6 -0
  161. package/dist/runtime/contract.js.map +1 -0
  162. package/dist/runtime/effect-schema.d.ts +211 -0
  163. package/dist/runtime/effect-schema.d.ts.map +1 -0
  164. package/dist/runtime/effect-schema.js +137 -0
  165. package/dist/runtime/effect-schema.js.map +1 -0
  166. package/dist/runtime/version.d.ts +2 -0
  167. package/dist/runtime/version.d.ts.map +1 -0
  168. package/dist/runtime/version.js +2 -0
  169. package/dist/runtime/version.js.map +1 -0
  170. package/dist/runtime-schema-effect.d.ts +4 -0
  171. package/dist/runtime-schema-effect.d.ts.map +1 -0
  172. package/dist/runtime-schema-effect.js +25 -0
  173. package/dist/runtime-schema-effect.js.map +1 -0
  174. package/dist/runtime-schema.d.ts +23 -0
  175. package/dist/runtime-schema.d.ts.map +1 -0
  176. package/dist/runtime-schema.js +12 -0
  177. package/dist/runtime-schema.js.map +1 -0
  178. package/dist/session/contract.d.ts +666 -0
  179. package/dist/session/contract.d.ts.map +1 -0
  180. package/dist/session/contract.js +16 -0
  181. package/dist/session/contract.js.map +1 -0
  182. package/dist/session/effect-schema.d.ts +1176 -0
  183. package/dist/session/effect-schema.d.ts.map +1 -0
  184. package/dist/session/effect-schema.js +195 -0
  185. package/dist/session/effect-schema.js.map +1 -0
  186. package/dist/session/version.d.ts +4 -0
  187. package/dist/session/version.d.ts.map +1 -0
  188. package/dist/session/version.js +4 -0
  189. package/dist/session/version.js.map +1 -0
  190. package/dist/temporal/recorded-at.d.ts +3 -0
  191. package/dist/temporal/recorded-at.d.ts.map +1 -0
  192. package/dist/temporal/recorded-at.js +13 -0
  193. package/dist/temporal/recorded-at.js.map +1 -0
  194. package/dist/terminal/contract.d.ts +3502 -0
  195. package/dist/terminal/contract.d.ts.map +1 -0
  196. package/dist/terminal/contract.js +31 -0
  197. package/dist/terminal/contract.js.map +1 -0
  198. package/dist/terminal/effect-schema.d.ts +15745 -0
  199. package/dist/terminal/effect-schema.d.ts.map +1 -0
  200. package/dist/terminal/effect-schema.js +193 -0
  201. package/dist/terminal/effect-schema.js.map +1 -0
  202. package/dist/terminal/live-contract.d.ts +87 -0
  203. package/dist/terminal/live-contract.d.ts.map +1 -0
  204. package/dist/terminal/live-contract.js +52 -0
  205. package/dist/terminal/live-contract.js.map +1 -0
  206. package/dist/terminal/live-effect-schema.d.ts +24770 -0
  207. package/dist/terminal/live-effect-schema.d.ts.map +1 -0
  208. package/dist/terminal/live-effect-schema.js +987 -0
  209. package/dist/terminal/live-effect-schema.js.map +1 -0
  210. package/dist/terminal/live-policy.d.ts +79 -0
  211. package/dist/terminal/live-policy.d.ts.map +1 -0
  212. package/dist/terminal/live-policy.js +91 -0
  213. package/dist/terminal/live-policy.js.map +1 -0
  214. package/dist/terminal/live-types.d.ts +584 -0
  215. package/dist/terminal/live-types.d.ts.map +1 -0
  216. package/dist/terminal/live-types.js +2 -0
  217. package/dist/terminal/live-types.js.map +1 -0
  218. package/dist/terminal/live-version.d.ts +4 -0
  219. package/dist/terminal/live-version.d.ts.map +1 -0
  220. package/dist/terminal/live-version.js +4 -0
  221. package/dist/terminal/live-version.js.map +1 -0
  222. package/dist/terminal/policy.d.ts +5 -0
  223. package/dist/terminal/policy.d.ts.map +1 -0
  224. package/dist/terminal/policy.js +5 -0
  225. package/dist/terminal/policy.js.map +1 -0
  226. package/dist/terminal/version.d.ts +4 -0
  227. package/dist/terminal/version.d.ts.map +1 -0
  228. package/dist/terminal/version.js +4 -0
  229. package/dist/terminal/version.js.map +1 -0
  230. package/dist/turn/contract.d.ts +493 -0
  231. package/dist/turn/contract.d.ts.map +1 -0
  232. package/dist/turn/contract.js +14 -0
  233. package/dist/turn/contract.js.map +1 -0
  234. package/dist/turn/effect-schema.d.ts +1063 -0
  235. package/dist/turn/effect-schema.d.ts.map +1 -0
  236. package/dist/turn/effect-schema.js +215 -0
  237. package/dist/turn/effect-schema.js.map +1 -0
  238. package/dist/turn/policy.d.ts +3 -0
  239. package/dist/turn/policy.d.ts.map +1 -0
  240. package/dist/turn/policy.js +3 -0
  241. package/dist/turn/policy.js.map +1 -0
  242. package/dist/turn/version.d.ts +2 -0
  243. package/dist/turn/version.d.ts.map +1 -0
  244. package/dist/turn/version.js +2 -0
  245. package/dist/turn/version.js.map +1 -0
  246. package/package.json +40 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effect-schema.d.ts","sourceRoot":"","sources":["../../src/orchestration/effect-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAuExC,eAAO,MAAM,kCAAkC;;;;EAM7C,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;;;;;EAO7C,CAAC;AAiBH,eAAO,MAAM,oCAAoC;;;;;;;;;;;EAEhD,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;EAGxC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;EAevC,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;;;;;;;EAU3C,CAAC;AAyBH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAc5C,CAAC;AAcH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;EAO1C,CAAC;AA6CJ,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAS1C,CAAC;AAgBJ,eAAO,MAAM,wCAAwC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGnD,CAAC;AAEH,eAAO,MAAM,6CAA6C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAajD,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;CAIxB,CAAC"}
@@ -0,0 +1,610 @@
1
+ import * as Schema from "effect/Schema";
2
+ import { aggregateRevisionEffectSchema } from "../aggregate/revision-effect-schema.js";
3
+ import { commandReceiptEffectSchema } from "../command-receipt/effect-schema.js";
4
+ import { protocolIdentifierEffectSchema } from "../envelope-effect-schema.js";
5
+ import { recordedAtEffectSchema } from "../temporal/recorded-at.js";
6
+ import { DEFAULT_ORCHESTRATION_CHECK_PAGE_SIZE, DEFAULT_ORCHESTRATION_LIST_PAGE_SIZE, DEFAULT_ORCHESTRATION_TASK_LIST_PAGE_SIZE, MAX_ORCHESTRATION_CHECK_PAGE_SIZE, MAX_ORCHESTRATION_DIRECT_DEPENDENCIES, MAX_ORCHESTRATION_LIST_PAGE_SIZE, MAX_ORCHESTRATION_MESSAGE_BODY_BYTES, MAX_ORCHESTRATION_MESSAGE_SUBJECT_BYTES, MAX_ORCHESTRATION_TASK_LIST_PAGE_SIZE, MAX_ORCHESTRATION_TASK_OBJECTIVE_BYTES, MAX_ORCHESTRATION_TASKS_PER_RUN, } from "./policy.js";
7
+ import { isValidOrchestrationGraphProjection } from "./topology.js";
8
+ import { ORCHESTRATION_MESSAGE_SCHEMA_VERSION, ORCHESTRATION_SCHEMA_VERSION, } from "./version.js";
9
+ const utf8 = new TextEncoder();
10
+ const bytesBetween = (minimum, maximum, expected) => Schema.String.check(Schema.makeFilter((value) => {
11
+ const length = utf8.encode(value).byteLength;
12
+ return length >= minimum && length <= maximum;
13
+ }, { expected }));
14
+ const clientKeyEffectSchema = Schema.String.check(Schema.isLengthBetween(1, 64), Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9_-]*$/u));
15
+ const taskObjectiveEffectSchema = bytesBetween(1, MAX_ORCHESTRATION_TASK_OBJECTIVE_BYTES, "a Task objective encoded as 1 to 4096 UTF-8 bytes");
16
+ const messageSubjectEffectSchema = bytesBetween(1, MAX_ORCHESTRATION_MESSAGE_SUBJECT_BYTES, "a Message subject encoded as 1 to 128 UTF-8 bytes");
17
+ const messageBodyEffectSchema = bytesBetween(1, MAX_ORCHESTRATION_MESSAGE_BODY_BYTES, "a Message body encoded as 1 to 4096 UTF-8 bytes");
18
+ const coordinatorEpochEffectSchema = Schema.Literal(1);
19
+ const runMailboxOwnerEffectSchema = Schema.Struct({
20
+ id: protocolIdentifierEffectSchema,
21
+ kind: Schema.Literal("run"),
22
+ });
23
+ const dispatchMailboxOwnerEffectSchema = Schema.Struct({
24
+ id: protocolIdentifierEffectSchema,
25
+ kind: Schema.Literal("dispatch"),
26
+ });
27
+ const mailboxOwnerEffectSchema = Schema.Union([
28
+ runMailboxOwnerEffectSchema,
29
+ dispatchMailboxOwnerEffectSchema,
30
+ ]);
31
+ export const orchestrationTaskInputEffectSchema = Schema.Struct({
32
+ clientKey: clientKeyEffectSchema,
33
+ dependsOn: Schema.Array(clientKeyEffectSchema).check(Schema.isMaxLength(MAX_ORCHESTRATION_DIRECT_DEPENDENCIES)),
34
+ objective: taskObjectiveEffectSchema,
35
+ });
36
+ export const orchestrationTaskGraphEffectSchema = Schema.Struct({
37
+ dispatchTaskKey: clientKeyEffectSchema,
38
+ rootTaskKey: clientKeyEffectSchema,
39
+ tasks: Schema.Array(orchestrationTaskInputEffectSchema).check(Schema.isMinLength(1), Schema.isMaxLength(MAX_ORCHESTRATION_TASKS_PER_RUN)),
40
+ });
41
+ const orchestrationTaskSummaryFields = {
42
+ clientKey: clientKeyEffectSchema,
43
+ createdAt: recordedAtEffectSchema,
44
+ dependencyTaskIds: Schema.Array(protocolIdentifierEffectSchema).check(Schema.isMaxLength(MAX_ORCHESTRATION_DIRECT_DEPENDENCIES)),
45
+ id: protocolIdentifierEffectSchema,
46
+ revision: aggregateRevisionEffectSchema,
47
+ runId: protocolIdentifierEffectSchema,
48
+ schemaVersion: Schema.Literal(ORCHESTRATION_SCHEMA_VERSION),
49
+ state: Schema.Literals(["pending", "active", "waiting-question", "failed"]),
50
+ updatedAt: recordedAtEffectSchema,
51
+ workspaceId: protocolIdentifierEffectSchema,
52
+ };
53
+ export const orchestrationTaskSummaryEffectSchema = Schema.Struct(orchestrationTaskSummaryFields);
54
+ export const orchestrationTaskEffectSchema = Schema.Struct({
55
+ ...orchestrationTaskSummaryFields,
56
+ objective: taskObjectiveEffectSchema,
57
+ });
58
+ export const orchestrationRunEffectSchema = Schema.Struct({
59
+ coordinator: Schema.Struct({
60
+ actorId: Schema.Literal("actor_local_user"),
61
+ epoch: coordinatorEpochEffectSchema,
62
+ }),
63
+ createdAt: recordedAtEffectSchema,
64
+ dispatchTaskId: protocolIdentifierEffectSchema,
65
+ id: protocolIdentifierEffectSchema,
66
+ revision: aggregateRevisionEffectSchema,
67
+ rootTaskId: protocolIdentifierEffectSchema,
68
+ schemaVersion: Schema.Literal(ORCHESTRATION_SCHEMA_VERSION),
69
+ state: Schema.Literals(["active", "waiting-question", "failed"]),
70
+ terminalId: protocolIdentifierEffectSchema,
71
+ updatedAt: recordedAtEffectSchema,
72
+ workspaceId: protocolIdentifierEffectSchema,
73
+ });
74
+ export const orchestrationAttemptEffectSchema = Schema.Struct({
75
+ createdAt: recordedAtEffectSchema,
76
+ id: protocolIdentifierEffectSchema,
77
+ ordinal: Schema.Literal(1),
78
+ revision: aggregateRevisionEffectSchema,
79
+ runId: protocolIdentifierEffectSchema,
80
+ schemaVersion: Schema.Literal(ORCHESTRATION_SCHEMA_VERSION),
81
+ state: Schema.Literals(["active", "waiting-question", "failed"]),
82
+ taskId: protocolIdentifierEffectSchema,
83
+ updatedAt: recordedAtEffectSchema,
84
+ });
85
+ const terminalFailureEffectSchema = Schema.Union([
86
+ Schema.Struct({
87
+ code: Schema.Literal("terminal_containment_unsupported"),
88
+ platform: Schema.Literals(["darwin", "linux"]),
89
+ }),
90
+ Schema.Struct({
91
+ code: Schema.Literal("platform_unsupported"),
92
+ platform: Schema.Literals(["win32", "other"]),
93
+ }),
94
+ ]);
95
+ const orchestrationDispatchFields = {
96
+ attemptId: protocolIdentifierEffectSchema,
97
+ createdAt: recordedAtEffectSchema,
98
+ id: protocolIdentifierEffectSchema,
99
+ revision: aggregateRevisionEffectSchema,
100
+ runId: protocolIdentifierEffectSchema,
101
+ schemaVersion: Schema.Literal(ORCHESTRATION_SCHEMA_VERSION),
102
+ taskId: protocolIdentifierEffectSchema,
103
+ terminalId: protocolIdentifierEffectSchema,
104
+ updatedAt: recordedAtEffectSchema,
105
+ };
106
+ export const orchestrationDispatchEffectSchema = Schema.Union([
107
+ Schema.Struct({
108
+ ...orchestrationDispatchFields,
109
+ state: Schema.Literal("active"),
110
+ }),
111
+ Schema.Struct({
112
+ ...orchestrationDispatchFields,
113
+ state: Schema.Literal("waiting-question"),
114
+ }),
115
+ Schema.Struct({
116
+ ...orchestrationDispatchFields,
117
+ failure: terminalFailureEffectSchema,
118
+ state: Schema.Literal("failed"),
119
+ }),
120
+ ]);
121
+ const orchestrationMailboxStructEffectSchema = Schema.Struct({
122
+ contentBytes: aggregateRevisionEffectSchema,
123
+ createdAt: recordedAtEffectSchema,
124
+ deliveryCount: aggregateRevisionEffectSchema,
125
+ headSequence: aggregateRevisionEffectSchema,
126
+ id: protocolIdentifierEffectSchema,
127
+ owner: mailboxOwnerEffectSchema,
128
+ revision: aggregateRevisionEffectSchema,
129
+ runId: protocolIdentifierEffectSchema,
130
+ schemaVersion: Schema.Literal(ORCHESTRATION_SCHEMA_VERSION),
131
+ updatedAt: recordedAtEffectSchema,
132
+ });
133
+ export const orchestrationMailboxEffectSchema = orchestrationMailboxStructEffectSchema.check(Schema.makeFilter((mailbox) => mailbox.owner.kind === "dispatch" || mailbox.owner.id === mailbox.runId, { expected: "a run Mailbox owned by its exact Run" }));
134
+ const orchestrationMessageFields = {
135
+ body: messageBodyEffectSchema,
136
+ createdAt: recordedAtEffectSchema,
137
+ digest: Schema.String.check(Schema.isLengthBetween(64, 64), Schema.isPattern(/^[a-f0-9]{64}$/u)),
138
+ id: protocolIdentifierEffectSchema,
139
+ runId: protocolIdentifierEffectSchema,
140
+ schemaVersion: Schema.Literal(ORCHESTRATION_MESSAGE_SCHEMA_VERSION),
141
+ sender: Schema.Struct({
142
+ actorId: Schema.Literal("actor_local_user"),
143
+ kind: Schema.Literal("run-coordinator"),
144
+ runId: protocolIdentifierEffectSchema,
145
+ }),
146
+ subject: messageSubjectEffectSchema,
147
+ };
148
+ const orchestrationMessageVariantEffectSchema = Schema.Union([
149
+ Schema.Struct({
150
+ ...orchestrationMessageFields,
151
+ recipient: dispatchMailboxOwnerEffectSchema,
152
+ type: Schema.Literal("dispatch"),
153
+ }),
154
+ Schema.Struct({
155
+ ...orchestrationMessageFields,
156
+ questionId: protocolIdentifierEffectSchema,
157
+ recipient: runMailboxOwnerEffectSchema,
158
+ type: Schema.Literal("question"),
159
+ }),
160
+ Schema.Struct({
161
+ ...orchestrationMessageFields,
162
+ questionId: protocolIdentifierEffectSchema,
163
+ recipient: dispatchMailboxOwnerEffectSchema,
164
+ type: Schema.Literal("reply"),
165
+ }),
166
+ Schema.Struct({
167
+ ...orchestrationMessageFields,
168
+ recipient: runMailboxOwnerEffectSchema,
169
+ type: Schema.Literal("dispatch-settled"),
170
+ }),
171
+ ]);
172
+ export const orchestrationMessageEffectSchema = orchestrationMessageVariantEffectSchema.check(Schema.makeFilter((message) => message.sender.runId === message.runId &&
173
+ (message.recipient.kind === "dispatch" ||
174
+ message.recipient.id === message.runId), { expected: "a Message whose Run identities are exact" }));
175
+ const orchestrationDeliveryFields = {
176
+ attemptCount: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(65_535)),
177
+ createdAt: recordedAtEffectSchema,
178
+ firstDeliveredAt: Schema.optional(recordedAtEffectSchema),
179
+ id: protocolIdentifierEffectSchema,
180
+ lastDeliveredAt: Schema.optional(recordedAtEffectSchema),
181
+ mailboxId: protocolIdentifierEffectSchema,
182
+ message: orchestrationMessageEffectSchema,
183
+ sequence: aggregateRevisionEffectSchema,
184
+ };
185
+ export const orchestrationPendingDeliveryEffectSchema = Schema.Struct({
186
+ ...orchestrationDeliveryFields,
187
+ state: Schema.Literal("pending"),
188
+ });
189
+ export const orchestrationAcknowledgedDeliveryEffectSchema = Schema.Struct({
190
+ ...orchestrationDeliveryFields,
191
+ acknowledgedAt: recordedAtEffectSchema,
192
+ acknowledgingActorId: Schema.Literal("actor_local_user"),
193
+ state: Schema.Literal("acknowledged"),
194
+ });
195
+ export const orchestrationDeliveryEffectSchema = Schema.Union([
196
+ orchestrationPendingDeliveryEffectSchema,
197
+ orchestrationAcknowledgedDeliveryEffectSchema,
198
+ ]);
199
+ const orchestrationQuestionFields = {
200
+ askMessageId: protocolIdentifierEffectSchema,
201
+ attemptId: protocolIdentifierEffectSchema,
202
+ body: messageBodyEffectSchema,
203
+ createdAt: recordedAtEffectSchema,
204
+ dispatchId: protocolIdentifierEffectSchema,
205
+ id: protocolIdentifierEffectSchema,
206
+ revision: aggregateRevisionEffectSchema,
207
+ runId: protocolIdentifierEffectSchema,
208
+ schemaVersion: Schema.Literal(ORCHESTRATION_SCHEMA_VERSION),
209
+ subject: messageSubjectEffectSchema,
210
+ taskId: protocolIdentifierEffectSchema,
211
+ updatedAt: recordedAtEffectSchema,
212
+ };
213
+ export const orchestrationQuestionEffectSchema = Schema.Union([
214
+ Schema.Struct({
215
+ ...orchestrationQuestionFields,
216
+ state: Schema.Literal("open"),
217
+ }),
218
+ Schema.Struct({
219
+ ...orchestrationQuestionFields,
220
+ answer: messageBodyEffectSchema,
221
+ replyMessageId: protocolIdentifierEffectSchema,
222
+ state: Schema.Literal("answered"),
223
+ }),
224
+ Schema.Struct({
225
+ ...orchestrationQuestionFields,
226
+ state: Schema.Literal("cancelled"),
227
+ }),
228
+ ]);
229
+ const orchestrationAggregateStructEffectSchema = Schema.Struct({
230
+ attempt: orchestrationAttemptEffectSchema,
231
+ dispatch: orchestrationDispatchEffectSchema,
232
+ mailboxes: Schema.Array(orchestrationMailboxEffectSchema).check(Schema.isLengthBetween(2, 2)),
233
+ question: Schema.optional(orchestrationQuestionEffectSchema),
234
+ run: orchestrationRunEffectSchema,
235
+ tasks: Schema.Array(orchestrationTaskEffectSchema).check(Schema.isMinLength(1), Schema.isMaxLength(MAX_ORCHESTRATION_TASKS_PER_RUN)),
236
+ });
237
+ const hasExactMailboxOwners = (aggregate) => {
238
+ const runMailboxes = aggregate.mailboxes.filter((mailbox) => mailbox.runId === aggregate.run.id &&
239
+ mailbox.owner.kind === "run" &&
240
+ mailbox.owner.id === aggregate.run.id);
241
+ const dispatchMailboxes = aggregate.mailboxes.filter((mailbox) => mailbox.runId === aggregate.run.id &&
242
+ mailbox.owner.kind === "dispatch" &&
243
+ mailbox.owner.id === aggregate.dispatch.id);
244
+ return runMailboxes.length === 1 && dispatchMailboxes.length === 1;
245
+ };
246
+ const hasExactTaskScope = (aggregate) => {
247
+ const taskIds = new Set(aggregate.tasks.map((task) => task.id));
248
+ return aggregate.tasks.every((task) => task.runId === aggregate.run.id &&
249
+ task.workspaceId === aggregate.run.workspaceId &&
250
+ task.dependencyTaskIds.every((dependencyId) => taskIds.has(dependencyId)));
251
+ };
252
+ const hasAdmittedTaskGraph = (aggregate) => isValidOrchestrationGraphProjection({
253
+ dispatchTaskKey: aggregate.run.dispatchTaskId,
254
+ rootTaskKey: aggregate.run.rootTaskId,
255
+ tasks: aggregate.tasks.map((task) => ({
256
+ clientKey: task.id,
257
+ dependsOn: task.dependencyTaskIds,
258
+ objective: task.objective,
259
+ })),
260
+ });
261
+ const hasUniqueAggregateIdentities = (aggregate) => new Set(aggregate.tasks.map((task) => task.id)).size ===
262
+ aggregate.tasks.length &&
263
+ new Set(aggregate.tasks.map((task) => task.clientKey)).size ===
264
+ aggregate.tasks.length &&
265
+ new Set(aggregate.mailboxes.map((mailbox) => mailbox.id)).size ===
266
+ aggregate.mailboxes.length;
267
+ const hasExactQuestionScope = (aggregate, selectedTaskId) => aggregate.question === undefined ||
268
+ (aggregate.question.runId === aggregate.run.id &&
269
+ aggregate.question.taskId === selectedTaskId &&
270
+ aggregate.question.attemptId === aggregate.attempt.id &&
271
+ aggregate.question.dispatchId === aggregate.dispatch.id);
272
+ const hasExactAggregateIdentity = (aggregate) => {
273
+ const selected = aggregate.tasks.find((task) => task.id === aggregate.run.dispatchTaskId);
274
+ const root = aggregate.tasks.find((task) => task.id === aggregate.run.rootTaskId);
275
+ return (selected !== undefined &&
276
+ root !== undefined &&
277
+ aggregate.attempt.runId === aggregate.run.id &&
278
+ aggregate.attempt.taskId === selected.id &&
279
+ aggregate.dispatch.runId === aggregate.run.id &&
280
+ aggregate.dispatch.attemptId === aggregate.attempt.id &&
281
+ aggregate.dispatch.taskId === selected.id &&
282
+ aggregate.dispatch.terminalId === aggregate.run.terminalId &&
283
+ hasAdmittedTaskGraph(aggregate) &&
284
+ hasUniqueAggregateIdentities(aggregate) &&
285
+ hasExactTaskScope(aggregate) &&
286
+ hasExactQuestionScope(aggregate, selected.id) &&
287
+ hasExactMailboxOwners(aggregate));
288
+ };
289
+ const hasFailedLifecycle = (aggregate, coordinatedStates) => coordinatedStates.every((state) => state === "failed") &&
290
+ aggregate.tasks.every((task) => task.state === "failed") &&
291
+ aggregate.question?.state !== "open";
292
+ const hasWaitingLifecycle = (aggregate, coordinatedStates, selectedTaskId) => coordinatedStates.every((state) => state === "waiting-question") &&
293
+ aggregate.tasks.every((task) => task.id === selectedTaskId || task.state === "pending") &&
294
+ aggregate.question?.state === "open";
295
+ const hasActiveLifecycle = (aggregate, coordinatedStates, selectedTaskId) => coordinatedStates.every((state) => state === "active") &&
296
+ aggregate.tasks.every((task) => task.id === selectedTaskId || task.state === "pending") &&
297
+ aggregate.question?.state !== "open";
298
+ const hasExactAggregateLifecycle = (aggregate) => {
299
+ const selected = aggregate.tasks.find((task) => task.id === aggregate.run.dispatchTaskId);
300
+ if (selected === undefined)
301
+ return false;
302
+ const coordinatedStates = [
303
+ aggregate.run.state,
304
+ aggregate.attempt.state,
305
+ aggregate.dispatch.state,
306
+ selected.state,
307
+ ];
308
+ if (aggregate.run.state === "failed") {
309
+ return hasFailedLifecycle(aggregate, coordinatedStates);
310
+ }
311
+ if (aggregate.run.state === "waiting-question") {
312
+ return hasWaitingLifecycle(aggregate, coordinatedStates, selected.id);
313
+ }
314
+ return hasActiveLifecycle(aggregate, coordinatedStates, selected.id);
315
+ };
316
+ export const orchestrationAggregateEffectSchema = orchestrationAggregateStructEffectSchema.check(Schema.makeFilter((aggregate) => hasExactAggregateIdentity(aggregate) &&
317
+ hasExactAggregateLifecycle(aggregate), { expected: "an exact local-v1 orchestration aggregate topology" }));
318
+ export const orchestrationRunCreateParametersEffectSchema = Schema.Struct({
319
+ commandId: protocolIdentifierEffectSchema,
320
+ expectedRevision: Schema.Literal("0"),
321
+ graph: orchestrationTaskGraphEffectSchema,
322
+ terminalId: protocolIdentifierEffectSchema,
323
+ workspaceId: protocolIdentifierEffectSchema,
324
+ });
325
+ export const orchestrationRunShowParametersEffectSchema = Schema.Struct({
326
+ runId: protocolIdentifierEffectSchema,
327
+ });
328
+ export const orchestrationRunListParametersEffectSchema = Schema.Struct({
329
+ afterCursor: aggregateRevisionEffectSchema,
330
+ limit: Schema.Int.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(MAX_ORCHESTRATION_LIST_PAGE_SIZE)),
331
+ workspaceId: protocolIdentifierEffectSchema,
332
+ });
333
+ export const orchestrationTaskListParametersEffectSchema = Schema.Struct({
334
+ afterCursor: aggregateRevisionEffectSchema,
335
+ limit: Schema.Int.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(MAX_ORCHESTRATION_TASK_LIST_PAGE_SIZE)),
336
+ runId: protocolIdentifierEffectSchema,
337
+ });
338
+ export const orchestrationTaskShowParametersEffectSchema = Schema.Struct({
339
+ runId: protocolIdentifierEffectSchema,
340
+ taskId: protocolIdentifierEffectSchema,
341
+ });
342
+ export const orchestrationDispatchShowParametersEffectSchema = Schema.Struct({
343
+ runId: protocolIdentifierEffectSchema,
344
+ });
345
+ export const orchestrationInboxCheckParametersEffectSchema = Schema.Struct({
346
+ coordinatorEpoch: coordinatorEpochEffectSchema,
347
+ limit: Schema.Int.check(Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(MAX_ORCHESTRATION_CHECK_PAGE_SIZE)),
348
+ owner: mailboxOwnerEffectSchema,
349
+ runId: protocolIdentifierEffectSchema,
350
+ });
351
+ export const orchestrationInboxAckParametersEffectSchema = Schema.Struct({
352
+ commandId: protocolIdentifierEffectSchema,
353
+ coordinatorEpoch: coordinatorEpochEffectSchema,
354
+ deliveryId: protocolIdentifierEffectSchema,
355
+ expectedMailboxRevision: aggregateRevisionEffectSchema,
356
+ owner: mailboxOwnerEffectSchema,
357
+ runId: protocolIdentifierEffectSchema,
358
+ });
359
+ const questionMutationBase = {
360
+ commandId: protocolIdentifierEffectSchema,
361
+ coordinatorEpoch: coordinatorEpochEffectSchema,
362
+ dispatchId: protocolIdentifierEffectSchema,
363
+ expectedDispatchRevision: aggregateRevisionEffectSchema,
364
+ expectedRunRevision: aggregateRevisionEffectSchema,
365
+ runId: protocolIdentifierEffectSchema,
366
+ };
367
+ export const orchestrationQuestionOpenParametersEffectSchema = Schema.Struct({
368
+ ...questionMutationBase,
369
+ body: messageBodyEffectSchema,
370
+ subject: messageSubjectEffectSchema,
371
+ });
372
+ export const orchestrationQuestionReplyParametersEffectSchema = Schema.Struct({
373
+ ...questionMutationBase,
374
+ answer: messageBodyEffectSchema,
375
+ expectedQuestionRevision: aggregateRevisionEffectSchema,
376
+ questionId: protocolIdentifierEffectSchema,
377
+ });
378
+ export const orchestrationQuestionCancelParametersEffectSchema = Schema.Struct({
379
+ ...questionMutationBase,
380
+ expectedQuestionRevision: aggregateRevisionEffectSchema,
381
+ questionId: protocolIdentifierEffectSchema,
382
+ });
383
+ export const orchestrationDispatchSettleTerminalParametersEffectSchema = Schema.Struct(questionMutationBase);
384
+ const receiptMatchesResult = (input) => input.receipt.actorId === "actor_local_user" &&
385
+ input.receipt.method === input.method &&
386
+ input.receipt.target.type === input.targetType &&
387
+ input.receipt.target.id === input.targetId;
388
+ const deliveryMatchesMailbox = (delivery, mailbox) => delivery.mailboxId === mailbox.id &&
389
+ delivery.message.runId === mailbox.runId &&
390
+ delivery.message.recipient.kind === mailbox.owner.kind &&
391
+ delivery.message.recipient.id === mailbox.owner.id;
392
+ const deliveryMatchesAggregateMailbox = (input) => {
393
+ const ownerId = input.ownerKind === "run"
394
+ ? input.aggregate.run.id
395
+ : input.aggregate.dispatch.id;
396
+ const mailbox = input.aggregate.mailboxes.find((candidate) => candidate.owner.kind === input.ownerKind &&
397
+ candidate.owner.id === ownerId);
398
+ return (mailbox !== undefined &&
399
+ input.delivery.message.type === input.messageType &&
400
+ deliveryMatchesMailbox(input.delivery, mailbox));
401
+ };
402
+ const orchestrationRunCreateResultStructEffectSchema = Schema.Struct({
403
+ aggregate: orchestrationAggregateEffectSchema,
404
+ delivery: Schema.Literals(["new", "duplicate"]),
405
+ initialDelivery: orchestrationDeliveryEffectSchema,
406
+ method: Schema.Literal("run.create"),
407
+ receipt: commandReceiptEffectSchema,
408
+ });
409
+ export const orchestrationRunCreateResultEffectSchema = orchestrationRunCreateResultStructEffectSchema.check(Schema.makeFilter((result) => deliveryMatchesAggregateMailbox({
410
+ aggregate: result.aggregate,
411
+ delivery: result.initialDelivery,
412
+ messageType: "dispatch",
413
+ ownerKind: "dispatch",
414
+ }) &&
415
+ receiptMatchesResult({
416
+ method: result.method,
417
+ receipt: result.receipt,
418
+ targetId: result.aggregate.run.id,
419
+ targetType: "orchestration-run",
420
+ }), { expected: "a Run-create Delivery matching its Dispatch Mailbox" }));
421
+ export const orchestrationRunShowResultEffectSchema = Schema.Struct({
422
+ aggregate: orchestrationAggregateEffectSchema,
423
+ method: Schema.Literal("run.show"),
424
+ });
425
+ const orchestrationRunListResultStructEffectSchema = Schema.Struct({
426
+ items: Schema.Array(orchestrationRunEffectSchema).check(Schema.isMaxLength(MAX_ORCHESTRATION_LIST_PAGE_SIZE)),
427
+ method: Schema.Literal("run.list"),
428
+ nextCursor: Schema.optional(aggregateRevisionEffectSchema),
429
+ });
430
+ export const orchestrationRunListResultEffectSchema = orchestrationRunListResultStructEffectSchema.check(Schema.makeFilter((result) => result.items.every((run) => run.workspaceId === result.items[0]?.workspaceId), { expected: "Run list items that share one Workspace ID" }));
431
+ const orchestrationTaskListResultStructEffectSchema = Schema.Struct({
432
+ items: Schema.Array(orchestrationTaskSummaryEffectSchema).check(Schema.isMaxLength(MAX_ORCHESTRATION_TASK_LIST_PAGE_SIZE)),
433
+ method: Schema.Literal("run.task.list"),
434
+ nextCursor: Schema.optional(aggregateRevisionEffectSchema),
435
+ runId: protocolIdentifierEffectSchema,
436
+ });
437
+ export const orchestrationTaskListResultEffectSchema = orchestrationTaskListResultStructEffectSchema.check(Schema.makeFilter((result) => result.items.every((task) => task.runId === result.runId), { expected: "Task list items that share the requested Run ID" }));
438
+ const orchestrationTaskShowResultStructEffectSchema = Schema.Struct({
439
+ method: Schema.Literal("run.task.show"),
440
+ runId: protocolIdentifierEffectSchema,
441
+ task: orchestrationTaskEffectSchema,
442
+ taskId: protocolIdentifierEffectSchema,
443
+ });
444
+ export const orchestrationTaskShowResultEffectSchema = orchestrationTaskShowResultStructEffectSchema.check(Schema.makeFilter((result) => result.task.runId === result.runId && result.task.id === result.taskId, {
445
+ expected: "a Task show result whose Task IDs match the requested Run and Task",
446
+ }));
447
+ const orchestrationDispatchShowResultStructEffectSchema = Schema.Struct({
448
+ dispatch: orchestrationDispatchEffectSchema,
449
+ method: Schema.Literal("run.dispatch.show"),
450
+ runId: protocolIdentifierEffectSchema,
451
+ });
452
+ export const orchestrationDispatchShowResultEffectSchema = orchestrationDispatchShowResultStructEffectSchema.check(Schema.makeFilter((result) => result.dispatch.runId === result.runId, {
453
+ expected: "a Dispatch show result whose Dispatch Run ID matches the requested Run",
454
+ }));
455
+ const orchestrationInboxCheckResultStructEffectSchema = Schema.Struct({
456
+ items: Schema.Array(orchestrationPendingDeliveryEffectSchema).check(Schema.isMaxLength(MAX_ORCHESTRATION_CHECK_PAGE_SIZE)),
457
+ mailbox: orchestrationMailboxEffectSchema,
458
+ method: Schema.Literal("run.inbox.check"),
459
+ });
460
+ export const orchestrationInboxCheckResultEffectSchema = orchestrationInboxCheckResultStructEffectSchema.check(Schema.makeFilter((result) => result.items.every((delivery) => deliveryMatchesMailbox(delivery, result.mailbox)), { expected: "inbox-check Deliveries matching the selected Mailbox" }));
461
+ const orchestrationInboxAckResultStructEffectSchema = Schema.Struct({
462
+ delivery: orchestrationAcknowledgedDeliveryEffectSchema,
463
+ mailbox: orchestrationMailboxEffectSchema,
464
+ method: Schema.Literal("run.inbox.ack"),
465
+ receipt: commandReceiptEffectSchema,
466
+ });
467
+ export const orchestrationInboxAckResultEffectSchema = orchestrationInboxAckResultStructEffectSchema.check(Schema.makeFilter((result) => deliveryMatchesMailbox(result.delivery, result.mailbox), {
468
+ expected: "an inbox acknowledgement matching its Mailbox",
469
+ }), Schema.makeFilter((result) => receiptMatchesResult({
470
+ method: result.method,
471
+ receipt: result.receipt,
472
+ targetId: result.mailbox.id,
473
+ targetType: "orchestration-mailbox",
474
+ }), { expected: "an inbox acknowledgement matching its Mailbox" }));
475
+ const questionMutationResultFields = {
476
+ aggregate: orchestrationAggregateEffectSchema,
477
+ receipt: commandReceiptEffectSchema,
478
+ };
479
+ const orchestrationQuestionOpenResultStructEffectSchema = Schema.Struct({
480
+ ...questionMutationResultFields,
481
+ delivery: orchestrationDeliveryEffectSchema,
482
+ method: Schema.Literal("run.question.open"),
483
+ });
484
+ export const orchestrationQuestionOpenResultEffectSchema = orchestrationQuestionOpenResultStructEffectSchema.check(Schema.makeFilter((result) => deliveryMatchesAggregateMailbox({
485
+ aggregate: result.aggregate,
486
+ delivery: result.delivery,
487
+ messageType: "question",
488
+ ownerKind: "run",
489
+ }) &&
490
+ receiptMatchesResult({
491
+ method: result.method,
492
+ receipt: result.receipt,
493
+ targetId: result.aggregate.run.id,
494
+ targetType: "orchestration-run",
495
+ }), { expected: "a Question-open Delivery matching the Run Mailbox" }));
496
+ const orchestrationQuestionReplyResultStructEffectSchema = Schema.Struct({
497
+ ...questionMutationResultFields,
498
+ delivery: orchestrationDeliveryEffectSchema,
499
+ method: Schema.Literal("run.question.reply"),
500
+ });
501
+ export const orchestrationQuestionReplyResultEffectSchema = orchestrationQuestionReplyResultStructEffectSchema.check(Schema.makeFilter((result) => deliveryMatchesAggregateMailbox({
502
+ aggregate: result.aggregate,
503
+ delivery: result.delivery,
504
+ messageType: "reply",
505
+ ownerKind: "dispatch",
506
+ }) &&
507
+ receiptMatchesResult({
508
+ method: result.method,
509
+ receipt: result.receipt,
510
+ targetId: result.aggregate.run.id,
511
+ targetType: "orchestration-run",
512
+ }), { expected: "a Question-reply Delivery matching the Dispatch Mailbox" }));
513
+ const orchestrationQuestionCancelResultStructEffectSchema = Schema.Struct({
514
+ ...questionMutationResultFields,
515
+ method: Schema.Literal("run.question.cancel"),
516
+ });
517
+ export const orchestrationQuestionCancelResultEffectSchema = orchestrationQuestionCancelResultStructEffectSchema.check(Schema.makeFilter((result) => receiptMatchesResult({
518
+ method: result.method,
519
+ receipt: result.receipt,
520
+ targetId: result.aggregate.run.id,
521
+ targetType: "orchestration-run",
522
+ }), { expected: "a Question-cancel receipt matching its Run" }));
523
+ const orchestrationDispatchSettleTerminalResultStructEffectSchema = Schema.Struct({
524
+ aggregate: orchestrationAggregateEffectSchema,
525
+ delivery: orchestrationDeliveryEffectSchema,
526
+ method: Schema.Literal("run.dispatch.settle-terminal"),
527
+ receipt: commandReceiptEffectSchema,
528
+ });
529
+ export const orchestrationDispatchSettleTerminalResultEffectSchema = orchestrationDispatchSettleTerminalResultStructEffectSchema.check(Schema.makeFilter((result) => deliveryMatchesAggregateMailbox({
530
+ aggregate: result.aggregate,
531
+ delivery: result.delivery,
532
+ messageType: "dispatch-settled",
533
+ ownerKind: "run",
534
+ }) &&
535
+ receiptMatchesResult({
536
+ method: result.method,
537
+ receipt: result.receipt,
538
+ targetId: result.aggregate.run.id,
539
+ targetType: "orchestration-run",
540
+ }), { expected: "a Dispatch settlement matching the Run Mailbox" }));
541
+ export const orchestrationRequestPayloadEffectSchema = Schema.Union([
542
+ Schema.Struct({
543
+ method: Schema.Literal("run.create"),
544
+ parameters: orchestrationRunCreateParametersEffectSchema,
545
+ }),
546
+ Schema.Struct({
547
+ method: Schema.Literal("run.list"),
548
+ parameters: orchestrationRunListParametersEffectSchema,
549
+ }),
550
+ Schema.Struct({
551
+ method: Schema.Literal("run.show"),
552
+ parameters: orchestrationRunShowParametersEffectSchema,
553
+ }),
554
+ Schema.Struct({
555
+ method: Schema.Literal("run.task.list"),
556
+ parameters: orchestrationTaskListParametersEffectSchema,
557
+ }),
558
+ Schema.Struct({
559
+ method: Schema.Literal("run.task.show"),
560
+ parameters: orchestrationTaskShowParametersEffectSchema,
561
+ }),
562
+ Schema.Struct({
563
+ method: Schema.Literal("run.dispatch.show"),
564
+ parameters: orchestrationDispatchShowParametersEffectSchema,
565
+ }),
566
+ Schema.Struct({
567
+ method: Schema.Literal("run.inbox.check"),
568
+ parameters: orchestrationInboxCheckParametersEffectSchema,
569
+ }),
570
+ Schema.Struct({
571
+ method: Schema.Literal("run.inbox.ack"),
572
+ parameters: orchestrationInboxAckParametersEffectSchema,
573
+ }),
574
+ Schema.Struct({
575
+ method: Schema.Literal("run.question.open"),
576
+ parameters: orchestrationQuestionOpenParametersEffectSchema,
577
+ }),
578
+ Schema.Struct({
579
+ method: Schema.Literal("run.question.reply"),
580
+ parameters: orchestrationQuestionReplyParametersEffectSchema,
581
+ }),
582
+ Schema.Struct({
583
+ method: Schema.Literal("run.question.cancel"),
584
+ parameters: orchestrationQuestionCancelParametersEffectSchema,
585
+ }),
586
+ Schema.Struct({
587
+ method: Schema.Literal("run.dispatch.settle-terminal"),
588
+ parameters: orchestrationDispatchSettleTerminalParametersEffectSchema,
589
+ }),
590
+ ]);
591
+ export const orchestrationSuccessResultEffectSchema = Schema.Union([
592
+ orchestrationRunCreateResultEffectSchema,
593
+ orchestrationRunListResultEffectSchema,
594
+ orchestrationRunShowResultEffectSchema,
595
+ orchestrationTaskListResultEffectSchema,
596
+ orchestrationTaskShowResultEffectSchema,
597
+ orchestrationDispatchShowResultEffectSchema,
598
+ orchestrationInboxCheckResultEffectSchema,
599
+ orchestrationInboxAckResultEffectSchema,
600
+ orchestrationQuestionOpenResultEffectSchema,
601
+ orchestrationQuestionReplyResultEffectSchema,
602
+ orchestrationQuestionCancelResultEffectSchema,
603
+ orchestrationDispatchSettleTerminalResultEffectSchema,
604
+ ]);
605
+ export const orchestrationDefaults = {
606
+ checkPageSize: DEFAULT_ORCHESTRATION_CHECK_PAGE_SIZE,
607
+ listPageSize: DEFAULT_ORCHESTRATION_LIST_PAGE_SIZE,
608
+ taskListPageSize: DEFAULT_ORCHESTRATION_TASK_LIST_PAGE_SIZE,
609
+ };
610
+ //# sourceMappingURL=effect-schema.js.map