@astrosheep/keiyaku 4.5.7 → 4.5.8

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 (234) hide show
  1. package/README.md +10 -0
  2. package/build/integrations/marketplace/plugins/keiyaku/.claude-plugin/plugin.json +1 -1
  3. package/build/integrations/marketplace/plugins/keiyaku/.codex-plugin/plugin.json +1 -1
  4. package/build/integrations/marketplace/plugins/keiyaku/opencode.js +3 -2
  5. package/build/integrations/marketplace/plugins/keiyaku/package.json +1 -1
  6. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +10 -9
  7. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +22 -1
  8. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-babysit/SKILL.md +35 -96
  9. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +28 -49
  10. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-task/SKILL.md +21 -15
  11. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +148 -89
  12. package/build/src/akuma/abort.d.ts +2 -1
  13. package/build/src/akuma/abort.js +6 -23
  14. package/build/src/akuma/akuma-handle.js +4 -2
  15. package/build/src/akuma/akuma-observe.d.ts +2 -0
  16. package/build/src/akuma/akuma-observe.js +1 -0
  17. package/build/src/akuma/akuma-product.js +9 -7
  18. package/build/src/akuma/akuma.d.ts +372 -9
  19. package/build/src/akuma/akuma.js +31 -1
  20. package/build/src/akuma/allowed.d.ts +1 -1
  21. package/build/src/akuma/allowed.js +1 -0
  22. package/build/src/akuma/body.d.ts +6 -4
  23. package/build/src/akuma/body.js +5 -3
  24. package/build/src/akuma/call-request.d.ts +80 -0
  25. package/build/src/akuma/call-request.js +211 -0
  26. package/build/src/akuma/heart/facts.d.ts +6 -78
  27. package/build/src/akuma/heart/index.d.ts +1 -1
  28. package/build/src/akuma/heart/request-authority.d.ts +5 -4
  29. package/build/src/akuma/heart/request-authority.js +20 -34
  30. package/build/src/akuma/heart/request-rows.js +12 -23
  31. package/build/src/akuma/heart/schema.d.ts +1 -1
  32. package/build/src/akuma/heart/schema.js +5 -13
  33. package/build/src/akuma/index.d.ts +1 -1
  34. package/build/src/akuma/index.js +1 -1
  35. package/build/src/akuma/projection-read.d.ts +1 -0
  36. package/build/src/akuma/projection-read.js +8 -1
  37. package/build/src/akuma/projection.d.ts +856 -137
  38. package/build/src/akuma/projection.js +190 -0
  39. package/build/src/akuma/provider.d.ts +30 -3
  40. package/build/src/akuma/provider.js +104 -0
  41. package/build/src/akuma/providers/acp/core.d.ts +2 -2
  42. package/build/src/akuma/providers/acp/core.js +13 -6
  43. package/build/src/akuma/providers/acp/index.js +5 -4
  44. package/build/src/akuma/providers/claude/index.d.ts +3 -3
  45. package/build/src/akuma/providers/claude/index.js +16 -5
  46. package/build/src/akuma/providers/codex-app-server/events.js +1 -1
  47. package/build/src/akuma/providers/codex-app-server/index.js +18 -6
  48. package/build/src/akuma/providers/grok-build/index.js +5 -4
  49. package/build/src/akuma/providers/opencode-sdk/index.js +66 -25
  50. package/build/src/akuma/providers/opencode-sdk/session.d.ts +3 -2
  51. package/build/src/akuma/providers/opencode-sdk/session.js +28 -11
  52. package/build/src/akuma/providers/pi/index.js +42 -14
  53. package/build/src/akuma/request-lifecycle.d.ts +3 -9
  54. package/build/src/akuma/request-lifecycle.js +4 -4
  55. package/build/src/akuma/request-rendezvous.d.ts +26 -0
  56. package/build/src/akuma/request-rendezvous.js +100 -0
  57. package/build/src/akuma/request-serve.d.ts +5 -65
  58. package/build/src/akuma/request-serve.js +81 -208
  59. package/build/src/akuma/request-wire.d.ts +109 -115
  60. package/build/src/akuma/request-wire.js +63 -318
  61. package/build/src/akuma/requests.d.ts +19 -47
  62. package/build/src/akuma/requests.js +51 -107
  63. package/build/src/akuma/turn-drive.d.ts +5 -3
  64. package/build/src/akuma/turn-drive.js +32 -10
  65. package/build/src/akuma-body.d.ts +7 -2
  66. package/build/src/akuma-body.js +68 -46
  67. package/build/src/cli/accepted.d.ts +1 -1
  68. package/build/src/cli/accepted.js +2 -2
  69. package/build/src/cli/commands/akuma-invoke.d.ts +2 -0
  70. package/build/src/cli/commands/akuma-invoke.js +17 -9
  71. package/build/src/cli/commands/akuma.js +7 -7
  72. package/build/src/cli/commands/contract-invoke.d.ts +3 -2
  73. package/build/src/cli/commands/contract-invoke.js +26 -19
  74. package/build/src/cli/commands/contract.d.ts +13 -13
  75. package/build/src/cli/commands/contract.js +32 -17
  76. package/build/src/cli/commands/install.d.ts +1 -1
  77. package/build/src/cli/commands/install.js +1 -1
  78. package/build/src/cli/commands/task-invoke.d.ts +3 -0
  79. package/build/src/cli/commands/task-invoke.js +23 -140
  80. package/build/src/cli/commands/task.js +54 -20
  81. package/build/src/cli/invoke.js +39 -25
  82. package/build/src/cli/main.js +2 -1
  83. package/build/src/cli/parse.d.ts +2 -2
  84. package/build/src/cli/parse.js +37 -22
  85. package/build/src/cli/render/akuma-activity.d.ts +4 -1
  86. package/build/src/cli/render/akuma-activity.js +45 -30
  87. package/build/src/cli/render/akuma-tool.d.ts +5 -1
  88. package/build/src/cli/render/akuma.js +5 -9
  89. package/build/src/cli/render/audit.js +1 -1
  90. package/build/src/cli/render/catalog.js +80 -21
  91. package/build/src/cli/render/contract-observation.d.ts +2 -0
  92. package/build/src/cli/render/contract-observation.js +11 -0
  93. package/build/src/cli/render/contract.js +25 -65
  94. package/build/src/cli/render/kanshi-akuma.d.ts +8 -0
  95. package/build/src/cli/render/kanshi-akuma.js +111 -0
  96. package/build/src/cli/render/kanshi.js +108 -213
  97. package/build/src/cli/render/receipt.d.ts +1 -2
  98. package/build/src/cli/render/receipt.js +76 -26
  99. package/build/src/cli/render/refusal.js +2 -10
  100. package/build/src/cli/render/region.js +5 -2
  101. package/build/src/cli/render/settings.d.ts +1 -1
  102. package/build/src/cli/render/settings.js +27 -8
  103. package/build/src/cli/render/task.js +22 -5
  104. package/build/src/cli/render/terminal.d.ts +28 -0
  105. package/build/src/cli/render/terminal.js +65 -0
  106. package/build/src/cli/result.d.ts +3 -3
  107. package/build/src/cli/runtime.js +3 -1
  108. package/build/src/cli/selectors.d.ts +2 -1
  109. package/build/src/cli/selectors.js +4 -3
  110. package/build/src/cli/square-edge.js +120 -36
  111. package/build/src/cli/usage.js +2 -1
  112. package/build/src/contract-guidance.d.ts +5 -0
  113. package/build/src/contract-guidance.js +121 -0
  114. package/build/src/contract-worktree.d.ts +0 -1
  115. package/build/src/contract-worktree.js +32 -83
  116. package/build/src/coordination/sqlite-transaction-lock.d.ts +1 -0
  117. package/build/src/coordination/sqlite-transaction-lock.js +5 -0
  118. package/build/src/core/facts/codec.d.ts +2 -0
  119. package/build/src/core/facts/codec.js +4 -0
  120. package/build/src/core/verbs/placement.d.ts +6 -1
  121. package/build/src/core/verbs/placement.js +5 -3
  122. package/build/src/dispatch/index.d.ts +0 -2
  123. package/build/src/dispatch/index.js +54 -55
  124. package/build/src/git/admission.js +2 -2
  125. package/build/src/git/hooks.d.ts +9 -15
  126. package/build/src/git/hooks.js +23 -317
  127. package/build/src/git/nuke.d.ts +2 -1
  128. package/build/src/git/nuke.js +36 -18
  129. package/build/src/git/private-state-seat.d.ts +12 -0
  130. package/build/src/git/private-state-seat.js +39 -0
  131. package/build/src/git/process.d.ts +6 -0
  132. package/build/src/git/process.js +19 -7
  133. package/build/src/git/read-observation.js +29 -20
  134. package/build/src/git/reconcile.d.ts +11 -0
  135. package/build/src/git/reconcile.js +64 -11
  136. package/build/src/git/repository.d.ts +6 -2
  137. package/build/src/git/repository.js +8 -0
  138. package/build/src/git/target-placement.d.ts +1 -0
  139. package/build/src/git/target-placement.js +5 -0
  140. package/build/src/git/tender.d.ts +1 -0
  141. package/build/src/git/terminal-reconcile.d.ts +1 -1
  142. package/build/src/git/terminal-reconcile.js +22 -20
  143. package/build/src/git/workspace.d.ts +14 -0
  144. package/build/src/git/workspace.js +44 -0
  145. package/build/src/kanshi/index.d.ts +1 -1
  146. package/build/src/kanshi/read.js +16 -16
  147. package/build/src/kanshi/report.d.ts +2 -2
  148. package/build/src/library/address.d.ts +9 -3
  149. package/build/src/library/address.js +3 -2
  150. package/build/src/library/akuma-creation.d.ts +4 -3
  151. package/build/src/library/akuma-creation.js +19 -13
  152. package/build/src/library/audit.d.ts +1 -1
  153. package/build/src/library/audit.js +5 -3
  154. package/build/src/library/catalog.d.ts +3 -1
  155. package/build/src/library/catalog.js +20 -6
  156. package/build/src/library/composition.d.ts +371 -0
  157. package/build/src/library/composition.js +28 -0
  158. package/build/src/library/configuration.js +8 -2
  159. package/build/src/library/continuation.js +66 -30
  160. package/build/src/library/contract-bind.js +10 -2
  161. package/build/src/library/contract-forwarding-reconciliation-result.d.ts +96 -0
  162. package/build/src/library/contract-forwarding-reconciliation-result.js +83 -0
  163. package/build/src/library/contract-forwarding-result.d.ts +6723 -0
  164. package/build/src/library/contract-forwarding-result.js +521 -0
  165. package/build/src/library/contract-forwarding.d.ts +72 -0
  166. package/build/src/library/contract-forwarding.js +125 -0
  167. package/build/src/library/contract-handle.d.ts +36 -0
  168. package/build/src/library/contract-handle.js +313 -0
  169. package/build/src/library/contract-operations.d.ts +1044 -67
  170. package/build/src/library/contract-operations.js +190 -118
  171. package/build/src/library/contract.d.ts +11 -32
  172. package/build/src/library/contract.js +16 -289
  173. package/build/src/library/fleet-result.d.ts +1454 -0
  174. package/build/src/library/fleet-result.js +96 -0
  175. package/build/src/library/fleet.d.ts +112 -54
  176. package/build/src/library/fleet.js +211 -71
  177. package/build/src/library/input.d.ts +2 -0
  178. package/build/src/library/input.js +4 -0
  179. package/build/src/library/keiyaku.d.ts +371 -20
  180. package/build/src/library/keiyaku.js +8 -21
  181. package/build/src/library/mutation.d.ts +3 -3
  182. package/build/src/library/mutation.js +5 -9
  183. package/build/src/library/nuke.d.ts +1 -1
  184. package/build/src/library/nuke.js +4 -3
  185. package/build/src/library/reconcile.d.ts +4 -0
  186. package/build/src/library/reconcile.js +2 -0
  187. package/build/src/library/refusal.d.ts +0 -9
  188. package/build/src/library/refusal.js +0 -7
  189. package/build/src/protocol/amend.js +56 -50
  190. package/build/src/protocol/attempt.d.ts +2 -0
  191. package/build/src/protocol/attempt.js +8 -1
  192. package/build/src/protocol/completion.js +7 -0
  193. package/build/src/protocol/deliver.js +6 -2
  194. package/build/src/protocol/operations.d.ts +4 -1
  195. package/build/src/protocol/operations.js +5 -2
  196. package/build/src/protocol/placement.d.ts +1 -0
  197. package/build/src/protocol/placement.js +52 -38
  198. package/build/src/protocol/read/observation.d.ts +1 -4
  199. package/build/src/protocol/read/observation.js +2 -15
  200. package/build/src/protocol/reintegrate.js +62 -58
  201. package/build/src/protocol/review.js +5 -0
  202. package/build/src/protocol/run.js +17 -13
  203. package/build/src/runtime/proc/run.d.ts +8 -0
  204. package/build/src/runtime/proc/run.js +27 -0
  205. package/build/src/runtime/proc/termination.js +26 -22
  206. package/build/src/runtime/proc/windows-launch.exe +0 -0
  207. package/build/src/settlement/holder.d.ts +2 -1
  208. package/build/src/settlement/holder.js +15 -4
  209. package/build/src/settlement/settle.js +99 -33
  210. package/build/src/task/board.d.ts +68 -27
  211. package/build/src/task/board.js +31 -1
  212. package/build/src/task/catalog.d.ts +4 -0
  213. package/build/src/task/catalog.js +23 -0
  214. package/build/src/task/compose-language.js +33 -7
  215. package/build/src/task/compose-parser.d.ts +1 -1
  216. package/build/src/task/compose-parser.js +1 -1
  217. package/build/src/task/compose.js +2 -0
  218. package/build/src/task/index.d.ts +12 -4
  219. package/build/src/task/index.js +97 -16
  220. package/build/src/task/mutation-result.d.ts +923 -0
  221. package/build/src/task/mutation-result.js +140 -0
  222. package/build/src/task/mutation.d.ts +552 -28
  223. package/build/src/task/mutation.js +304 -97
  224. package/build/src/task/operations.d.ts +1 -4
  225. package/build/src/task/operations.js +0 -6
  226. package/build/src/task/public.d.ts +2 -0
  227. package/build/src/task/public.js +1 -0
  228. package/build/src/workspace-place.d.ts +7 -2
  229. package/build/src/workspace-place.js +34 -24
  230. package/build/src/world.d.ts +1 -0
  231. package/build/src/world.js +11 -0
  232. package/package.json +8 -6
  233. package/build/src/akuma/request-execution.d.ts +0 -8
  234. package/build/src/akuma/request-execution.js +0 -98
@@ -1,10 +1,11 @@
1
1
  import { type TellResult, type TellWakeRuntime } from "./body.js";
2
- import { HeldAkumaLeash, type AkumaLife, type KillEvidence, type ResumeCoordinate, type Soul } from "./heart/index.js";
2
+ import { HeldAkumaLeash, type AkumaLife, type KillEvidence, type ResumeCoordinate } from "./heart/index.js";
3
3
  import { type AkuId, type AkumaPaths } from "./identity.js";
4
- import type { ActivitySnapshot } from "./projection.js";
5
4
  import type { Settings } from "../settings.js";
6
5
  import type { WorldRoot } from "../world.js";
7
6
  import type { AllowedAction } from "./allowed.js";
7
+ import type { ExecutionContext } from "./requests.js";
8
+ import { z } from "zod";
8
9
  export declare const POLL_MS = 100;
9
10
  export declare function canonicalBirthCwd(input: string): Promise<string>;
10
11
  export declare function callReadonly(value: unknown): Readonly<{
@@ -19,13 +20,373 @@ export type AkumaListRow = Readonly<{
19
20
  lastActivityAt: string | null;
20
21
  pending: readonly string[];
21
22
  }>;
22
- export type AkumaStatus = Readonly<{
23
- id: AkuId;
24
- life: AkumaLife;
25
- readonly?: Soul["readonly"];
26
- timeline: ActivitySnapshot;
27
- strandedReason?: "resume-unsupported";
28
- }>;
23
+ export declare const akumaIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<AkuId, string>>;
24
+ export declare const akumaStatusSchema: z.ZodObject<{
25
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<AkuId, string>>;
26
+ life: z.ZodEnum<{
27
+ killed: "killed";
28
+ hung: "hung";
29
+ untidy: "untidy";
30
+ running: "running";
31
+ asleep: "asleep";
32
+ stranded: "stranded";
33
+ }>;
34
+ readonly: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
35
+ enforcement: z.ZodLiteral<"native">;
36
+ }, z.core.$strict>, z.ZodObject<{
37
+ enforcement: z.ZodLiteral<"none">;
38
+ diagnostic: z.ZodString;
39
+ }, z.core.$strict>]>>;
40
+ timeline: z.ZodUnion<readonly [z.ZodObject<{
41
+ reportedChanges: z.ZodReadonly<z.ZodArray<z.ZodObject<{
42
+ sequence: z.ZodNumber;
43
+ at: z.ZodString;
44
+ op: z.ZodEnum<{
45
+ add: "add";
46
+ update: "update";
47
+ delete: "delete";
48
+ unspecified: "unspecified";
49
+ }>;
50
+ path: z.ZodString;
51
+ diffstat: z.ZodOptional<z.ZodObject<{
52
+ added: z.ZodNumber;
53
+ removed: z.ZodNumber;
54
+ }, z.core.$strict>>;
55
+ }, z.core.$strict>>>;
56
+ reportedChangesOmitted: z.ZodNumber;
57
+ kind: z.ZodLiteral<"unborn">;
58
+ entries: z.ZodReadonly<z.ZodTuple<[], null>>;
59
+ omitted: z.ZodLiteral<0>;
60
+ }, z.core.$strict>, z.ZodObject<{
61
+ reportedChanges: z.ZodReadonly<z.ZodArray<z.ZodObject<{
62
+ sequence: z.ZodNumber;
63
+ at: z.ZodString;
64
+ op: z.ZodEnum<{
65
+ add: "add";
66
+ update: "update";
67
+ delete: "delete";
68
+ unspecified: "unspecified";
69
+ }>;
70
+ path: z.ZodString;
71
+ diffstat: z.ZodOptional<z.ZodObject<{
72
+ added: z.ZodNumber;
73
+ removed: z.ZodNumber;
74
+ }, z.core.$strict>>;
75
+ }, z.core.$strict>>>;
76
+ reportedChangesOmitted: z.ZodNumber;
77
+ kind: z.ZodLiteral<"open">;
78
+ turn: z.ZodObject<{
79
+ kind: z.ZodLiteral<"turn">;
80
+ sequence: z.ZodNumber;
81
+ turnSequence: z.ZodNumber;
82
+ bodySequence: z.ZodNumber;
83
+ at: z.ZodString;
84
+ }, z.core.$strict>;
85
+ entries: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
86
+ kind: z.ZodLiteral<"gap">;
87
+ count: z.ZodNumber;
88
+ }, z.core.$strict>, z.ZodObject<{
89
+ kind: z.ZodLiteral<"row">;
90
+ row: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
91
+ kind: z.ZodLiteral<"call">;
92
+ sequence: z.ZodNumber;
93
+ turnSequence: z.ZodNumber;
94
+ at: z.ZodString;
95
+ text: z.ZodString;
96
+ }, z.core.$strict>, z.ZodObject<{
97
+ kind: z.ZodLiteral<"note" | "thought" | "said">;
98
+ sequence: z.ZodNumber;
99
+ turnSequence: z.ZodNumber;
100
+ at: z.ZodString;
101
+ text: z.ZodString;
102
+ truncated: z.ZodOptional<z.ZodLiteral<true>>;
103
+ }, z.core.$strict>, z.ZodObject<{
104
+ kind: z.ZodLiteral<"note" | "thought" | "said">;
105
+ sequence: z.ZodNumber;
106
+ turnSequence: z.ZodNumber;
107
+ at: z.ZodString;
108
+ text: z.ZodString;
109
+ truncated: z.ZodOptional<z.ZodLiteral<true>>;
110
+ }, z.core.$strict>, z.ZodObject<{
111
+ kind: z.ZodLiteral<"note" | "thought" | "said">;
112
+ sequence: z.ZodNumber;
113
+ turnSequence: z.ZodNumber;
114
+ at: z.ZodString;
115
+ text: z.ZodString;
116
+ truncated: z.ZodOptional<z.ZodLiteral<true>>;
117
+ }, z.core.$strict>, z.ZodObject<{
118
+ kind: z.ZodLiteral<"tell">;
119
+ sequence: z.ZodNumber;
120
+ at: z.ZodString;
121
+ tellId: z.ZodString;
122
+ text: z.ZodString;
123
+ state: z.ZodEnum<{
124
+ pending: "pending";
125
+ told: "told";
126
+ }>;
127
+ deliveries: z.ZodReadonly<z.ZodArray<z.ZodObject<{
128
+ deliveredAt: z.ZodString;
129
+ route: z.ZodEnum<{
130
+ live: "live";
131
+ launch: "launch";
132
+ }>;
133
+ turnSequence: z.ZodNumber;
134
+ receipt: z.ZodOptional<z.ZodEnum<{
135
+ required: "required";
136
+ unavailable: "unavailable";
137
+ }>>;
138
+ }, z.core.$strict>>>;
139
+ }, z.core.$strict>]>, z.ZodObject<{
140
+ kind: z.ZodLiteral<"tool">;
141
+ sequence: z.ZodNumber;
142
+ turnSequence: z.ZodNumber;
143
+ at: z.ZodString;
144
+ name: z.ZodString;
145
+ call: z.ZodUnion<readonly [z.ZodObject<{
146
+ kind: z.ZodLiteral<"run">;
147
+ command: z.ZodString;
148
+ }, z.core.$strict>, z.ZodObject<{
149
+ kind: z.ZodLiteral<"read">;
150
+ path: z.ZodString;
151
+ offset: z.ZodOptional<z.ZodNumber>;
152
+ limit: z.ZodOptional<z.ZodNumber>;
153
+ }, z.core.$strict>, z.ZodObject<{
154
+ kind: z.ZodLiteral<"search">;
155
+ query: z.ZodString;
156
+ scope: z.ZodOptional<z.ZodEnum<{
157
+ content: "content";
158
+ files: "files";
159
+ web: "web";
160
+ }>>;
161
+ path: z.ZodOptional<z.ZodString>;
162
+ glob: z.ZodOptional<z.ZodString>;
163
+ }, z.core.$strict>, z.ZodObject<{
164
+ kind: z.ZodLiteral<"fileChange">;
165
+ changes: z.ZodReadonly<z.ZodArray<z.ZodObject<{
166
+ op: z.ZodEnum<{
167
+ add: "add";
168
+ update: "update";
169
+ delete: "delete";
170
+ unspecified: "unspecified";
171
+ }>;
172
+ path: z.ZodString;
173
+ diffstat: z.ZodOptional<z.ZodObject<{
174
+ added: z.ZodNumber;
175
+ removed: z.ZodNumber;
176
+ }, z.core.$strict>>;
177
+ }, z.core.$strict>>>;
178
+ }, z.core.$strict>, z.ZodObject<{
179
+ kind: z.ZodLiteral<"other">;
180
+ display: z.ZodString;
181
+ }, z.core.$strict>]>;
182
+ state: z.ZodLiteral<"active">;
183
+ truncated: z.ZodOptional<z.ZodLiteral<true>>;
184
+ }, z.core.$strict>, z.ZodObject<{
185
+ kind: z.ZodLiteral<"tool">;
186
+ sequence: z.ZodNumber;
187
+ turnSequence: z.ZodNumber;
188
+ at: z.ZodString;
189
+ completedAt: z.ZodOptional<z.ZodString>;
190
+ durationMs: z.ZodOptional<z.ZodNumber>;
191
+ name: z.ZodString;
192
+ call: z.ZodUnion<readonly [z.ZodObject<{
193
+ kind: z.ZodLiteral<"run">;
194
+ command: z.ZodString;
195
+ }, z.core.$strict>, z.ZodObject<{
196
+ kind: z.ZodLiteral<"read">;
197
+ path: z.ZodString;
198
+ offset: z.ZodOptional<z.ZodNumber>;
199
+ limit: z.ZodOptional<z.ZodNumber>;
200
+ }, z.core.$strict>, z.ZodObject<{
201
+ kind: z.ZodLiteral<"search">;
202
+ query: z.ZodString;
203
+ scope: z.ZodOptional<z.ZodEnum<{
204
+ content: "content";
205
+ files: "files";
206
+ web: "web";
207
+ }>>;
208
+ path: z.ZodOptional<z.ZodString>;
209
+ glob: z.ZodOptional<z.ZodString>;
210
+ }, z.core.$strict>, z.ZodObject<{
211
+ kind: z.ZodLiteral<"fileChange">;
212
+ changes: z.ZodReadonly<z.ZodArray<z.ZodObject<{
213
+ op: z.ZodEnum<{
214
+ add: "add";
215
+ update: "update";
216
+ delete: "delete";
217
+ unspecified: "unspecified";
218
+ }>;
219
+ path: z.ZodString;
220
+ diffstat: z.ZodOptional<z.ZodObject<{
221
+ added: z.ZodNumber;
222
+ removed: z.ZodNumber;
223
+ }, z.core.$strict>>;
224
+ }, z.core.$strict>>>;
225
+ }, z.core.$strict>, z.ZodObject<{
226
+ kind: z.ZodLiteral<"other">;
227
+ display: z.ZodString;
228
+ }, z.core.$strict>]>;
229
+ state: z.ZodObject<{
230
+ status: z.ZodEnum<{
231
+ error: "error";
232
+ ok: "ok";
233
+ }>;
234
+ message: z.ZodOptional<z.ZodString>;
235
+ exitCode: z.ZodOptional<z.ZodNumber>;
236
+ }, z.core.$strict>;
237
+ truncated: z.ZodOptional<z.ZodLiteral<true>>;
238
+ }, z.core.$strict>]>;
239
+ }, z.core.$strict>]>>>;
240
+ omitted: z.ZodNumber;
241
+ }, z.core.$strict>, z.ZodObject<{
242
+ reportedChanges: z.ZodReadonly<z.ZodArray<z.ZodObject<{
243
+ sequence: z.ZodNumber;
244
+ at: z.ZodString;
245
+ op: z.ZodEnum<{
246
+ add: "add";
247
+ update: "update";
248
+ delete: "delete";
249
+ unspecified: "unspecified";
250
+ }>;
251
+ path: z.ZodString;
252
+ diffstat: z.ZodOptional<z.ZodObject<{
253
+ added: z.ZodNumber;
254
+ removed: z.ZodNumber;
255
+ }, z.core.$strict>>;
256
+ }, z.core.$strict>>>;
257
+ reportedChangesOmitted: z.ZodNumber;
258
+ kind: z.ZodLiteral<"idle">;
259
+ outcome: z.ZodOptional<z.ZodObject<{
260
+ kind: z.ZodLiteral<"outcome">;
261
+ sequence: z.ZodNumber;
262
+ turnSequence: z.ZodNumber;
263
+ at: z.ZodString;
264
+ outcome: z.ZodUnion<readonly [z.ZodObject<{
265
+ kind: z.ZodLiteral<"answered">;
266
+ historyId: z.ZodString;
267
+ answer: z.ZodString;
268
+ }, z.core.$strict>, z.ZodObject<{
269
+ kind: z.ZodLiteral<"failed">;
270
+ historyId: z.ZodString;
271
+ diagnostic: z.ZodString;
272
+ }, z.core.$strict>]>;
273
+ }, z.core.$strict>>;
274
+ entries: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
275
+ kind: z.ZodLiteral<"gap">;
276
+ count: z.ZodNumber;
277
+ }, z.core.$strict>, z.ZodObject<{
278
+ kind: z.ZodLiteral<"row">;
279
+ row: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
280
+ kind: z.ZodLiteral<"call">;
281
+ sequence: z.ZodNumber;
282
+ turnSequence: z.ZodNumber;
283
+ at: z.ZodString;
284
+ text: z.ZodString;
285
+ }, z.core.$strict>, z.ZodObject<{
286
+ kind: z.ZodLiteral<"note" | "thought" | "said">;
287
+ sequence: z.ZodNumber;
288
+ turnSequence: z.ZodNumber;
289
+ at: z.ZodString;
290
+ text: z.ZodString;
291
+ truncated: z.ZodOptional<z.ZodLiteral<true>>;
292
+ }, z.core.$strict>, z.ZodObject<{
293
+ kind: z.ZodLiteral<"note" | "thought" | "said">;
294
+ sequence: z.ZodNumber;
295
+ turnSequence: z.ZodNumber;
296
+ at: z.ZodString;
297
+ text: z.ZodString;
298
+ truncated: z.ZodOptional<z.ZodLiteral<true>>;
299
+ }, z.core.$strict>, z.ZodObject<{
300
+ kind: z.ZodLiteral<"note" | "thought" | "said">;
301
+ sequence: z.ZodNumber;
302
+ turnSequence: z.ZodNumber;
303
+ at: z.ZodString;
304
+ text: z.ZodString;
305
+ truncated: z.ZodOptional<z.ZodLiteral<true>>;
306
+ }, z.core.$strict>, z.ZodObject<{
307
+ kind: z.ZodLiteral<"tell">;
308
+ sequence: z.ZodNumber;
309
+ at: z.ZodString;
310
+ tellId: z.ZodString;
311
+ text: z.ZodString;
312
+ state: z.ZodEnum<{
313
+ pending: "pending";
314
+ told: "told";
315
+ }>;
316
+ deliveries: z.ZodReadonly<z.ZodArray<z.ZodObject<{
317
+ deliveredAt: z.ZodString;
318
+ route: z.ZodEnum<{
319
+ live: "live";
320
+ launch: "launch";
321
+ }>;
322
+ turnSequence: z.ZodNumber;
323
+ receipt: z.ZodOptional<z.ZodEnum<{
324
+ required: "required";
325
+ unavailable: "unavailable";
326
+ }>>;
327
+ }, z.core.$strict>>>;
328
+ }, z.core.$strict>]>, z.ZodObject<{
329
+ kind: z.ZodLiteral<"tool">;
330
+ sequence: z.ZodNumber;
331
+ turnSequence: z.ZodNumber;
332
+ at: z.ZodString;
333
+ completedAt: z.ZodOptional<z.ZodString>;
334
+ durationMs: z.ZodOptional<z.ZodNumber>;
335
+ name: z.ZodString;
336
+ call: z.ZodUnion<readonly [z.ZodObject<{
337
+ kind: z.ZodLiteral<"run">;
338
+ command: z.ZodString;
339
+ }, z.core.$strict>, z.ZodObject<{
340
+ kind: z.ZodLiteral<"read">;
341
+ path: z.ZodString;
342
+ offset: z.ZodOptional<z.ZodNumber>;
343
+ limit: z.ZodOptional<z.ZodNumber>;
344
+ }, z.core.$strict>, z.ZodObject<{
345
+ kind: z.ZodLiteral<"search">;
346
+ query: z.ZodString;
347
+ scope: z.ZodOptional<z.ZodEnum<{
348
+ content: "content";
349
+ files: "files";
350
+ web: "web";
351
+ }>>;
352
+ path: z.ZodOptional<z.ZodString>;
353
+ glob: z.ZodOptional<z.ZodString>;
354
+ }, z.core.$strict>, z.ZodObject<{
355
+ kind: z.ZodLiteral<"fileChange">;
356
+ changes: z.ZodReadonly<z.ZodArray<z.ZodObject<{
357
+ op: z.ZodEnum<{
358
+ add: "add";
359
+ update: "update";
360
+ delete: "delete";
361
+ unspecified: "unspecified";
362
+ }>;
363
+ path: z.ZodString;
364
+ diffstat: z.ZodOptional<z.ZodObject<{
365
+ added: z.ZodNumber;
366
+ removed: z.ZodNumber;
367
+ }, z.core.$strict>>;
368
+ }, z.core.$strict>>>;
369
+ }, z.core.$strict>, z.ZodObject<{
370
+ kind: z.ZodLiteral<"other">;
371
+ display: z.ZodString;
372
+ }, z.core.$strict>]>;
373
+ state: z.ZodObject<{
374
+ status: z.ZodEnum<{
375
+ error: "error";
376
+ ok: "ok";
377
+ }>;
378
+ message: z.ZodOptional<z.ZodString>;
379
+ exitCode: z.ZodOptional<z.ZodNumber>;
380
+ }, z.core.$strict>;
381
+ truncated: z.ZodOptional<z.ZodLiteral<true>>;
382
+ }, z.core.$strict>]>;
383
+ }, z.core.$strict>]>>>;
384
+ omitted: z.ZodNumber;
385
+ }, z.core.$strict>]>;
386
+ strandedReason: z.ZodOptional<z.ZodLiteral<"resume-unsupported">>;
387
+ }, z.core.$strict>;
388
+ export type AkumaStatus = z.infer<typeof akumaStatusSchema>;
389
+ export declare function parseAkumaStatus(value: unknown): AkumaStatus;
29
390
  /** The default completion judgment over one complete status snapshot. */
30
391
  export declare function defaultWaitComplete(status: AkumaStatus): boolean;
31
392
  export type { ReadonlyRestraint } from "./provider-recipe.js";
@@ -39,6 +400,7 @@ export type UnbornAkumaListRow = Readonly<{
39
400
  }>;
40
401
  }>;
41
402
  export type AkumaList = Readonly<{
403
+ observedAt: string;
42
404
  rows: readonly (AkumaListRow | UnbornAkumaListRow)[];
43
405
  searched: readonly string[];
44
406
  }>;
@@ -108,6 +470,7 @@ export { bornStatus, fleetListRow, readAkumaBirthCwd, readBudgetedStatus, type B
108
470
  export type AkumaConfiguration = Readonly<{
109
471
  home?: string;
110
472
  settings?: Settings;
473
+ execution?: ExecutionContext;
111
474
  }>;
112
475
  export { AkumaHandle, akumaCallExecution, type LastAnswer } from "./akuma-handle.js";
113
476
  export { Akuma, callAkumaWithContext } from "./akuma-product.js";
@@ -3,7 +3,9 @@ import { realpath, stat } from "node:fs/promises";
3
3
  import { resolve } from "node:path";
4
4
  import { CONTROL_RESPONSE_MS, handoffPendingTells, wakeRecordedTell, } from "./body.js";
5
5
  import { HeldAkumaLeash, readHeart, readKill, recordTell, requestStop, } from "./heart/index.js";
6
- import { pathsForAkuId } from "./identity.js";
6
+ import { parseAkuId, pathsForAkuId } from "./identity.js";
7
+ import { activitySnapshotSchema } from "./projection.js";
8
+ import { z } from "zod";
7
9
  export const POLL_MS = 100;
8
10
  export async function canonicalBirthCwd(input) {
9
11
  const selected = resolve(input);
@@ -24,6 +26,34 @@ export function callReadonly(value) {
24
26
  throw new TypeError("Akuma call readonly must be true");
25
27
  return { readonly: true };
26
28
  }
29
+ export const akumaIdSchema = z.string().transform((value, context) => {
30
+ try {
31
+ const id = parseAkuId(value).id;
32
+ if (id !== value)
33
+ throw new Error("not canonical");
34
+ return id;
35
+ }
36
+ catch {
37
+ context.addIssue({ code: "custom", message: "expected canonical AkuId" });
38
+ return z.NEVER;
39
+ }
40
+ });
41
+ const readonlySchema = z.union([
42
+ z.object({ enforcement: z.literal("native") }).strict(),
43
+ z.object({ enforcement: z.literal("none"), diagnostic: z.string().refine((value) => value.trim() !== "") }).strict(),
44
+ ]);
45
+ export const akumaStatusSchema = z
46
+ .object({
47
+ id: akumaIdSchema,
48
+ life: z.enum(["running", "asleep", "stranded", "hung", "untidy", "killed"]),
49
+ readonly: readonlySchema.optional(),
50
+ timeline: activitySnapshotSchema,
51
+ strandedReason: z.literal("resume-unsupported").optional(),
52
+ })
53
+ .strict();
54
+ export function parseAkumaStatus(value) {
55
+ return akumaStatusSchema.parse(value);
56
+ }
27
57
  /** The default completion judgment over one complete status snapshot. */
28
58
  export function defaultWaitComplete(status) {
29
59
  return (status.life !== "running" &&
@@ -1,4 +1,4 @@
1
- export declare const ALLOWED_ACTIONS: readonly ["akuma.call", "akuma.kill", "akuma.tell", "contract.deliver", "contract.review", "task.add", "task.addDocument", "task.compose", "task.done", "task.drop", "task.hold", "task.resume", "task.start", "task.stop", "task.update"];
1
+ export declare const ALLOWED_ACTIONS: readonly ["akuma.call", "akuma.kill", "akuma.tell", "contract.audit", "contract.deliver", "contract.review", "task.add", "task.addDocument", "task.compose", "task.done", "task.drop", "task.hold", "task.resume", "task.start", "task.stop", "task.update"];
2
2
  export type AllowedAction = (typeof ALLOWED_ACTIONS)[number];
3
3
  export type AllowedActions = readonly AllowedAction[];
4
4
  export declare function isAllowedAction(value: unknown): value is AllowedAction;
@@ -3,6 +3,7 @@ export const ALLOWED_ACTIONS = Object.freeze([
3
3
  "akuma.call",
4
4
  "akuma.kill",
5
5
  "akuma.tell",
6
+ "contract.audit",
6
7
  "contract.deliver",
7
8
  "contract.review",
8
9
  ...TASK_MUTATION_ACTIONS,
@@ -1,7 +1,8 @@
1
+ import type { AkumaCallRequestChildLaunch } from "./call-request.js";
1
2
  import { type SessionFact, type Soul } from "./heart/index.js";
2
3
  import { type AkumaPaths } from "./identity.js";
3
4
  import type { ProviderAdapter } from "./provider.js";
4
- import { type UpstreamExecutionPort, type RequestChildLaunch } from "./request-serve.js";
5
+ import type { ErasedRequestCommand } from "./request-wire.js";
5
6
  import { type OwnedProcess, type RunLogReference } from "../runtime/proc/run.js";
6
7
  export declare const LEASH_HELD_EXIT = 75;
7
8
  export { CONTROL_RESPONSE_MS } from "./body-supervisor.js";
@@ -45,9 +46,10 @@ export type TellWakeRuntime = Readonly<{
45
46
  }>;
46
47
  type BodyRuntime = Readonly<{
47
48
  now(): string;
48
- spawnChild?(launch: RequestChildLaunch): Promise<OwnedProcess>;
49
+ spawnChild?(launch: AkumaCallRequestChildLaunch): Promise<OwnedProcess>;
49
50
  spawnBody?(launch: BodyLaunch): Promise<OwnedProcess>;
50
- upstream?: UpstreamExecutionPort;
51
+ upstream?: unknown;
52
+ commands: Readonly<Record<string, ErasedRequestCommand>>;
51
53
  }>;
52
54
  export declare function bodyProcessInput(launch: BodyLaunch, bodyModuleUrl?: string): Promise<{
53
55
  argv: string[];
@@ -60,5 +62,5 @@ export declare function bodyProcessInput(launch: BodyLaunch, bodyModuleUrl?: str
60
62
  export declare function handoffPendingTells(paths: AkumaPaths, spawn?: (launch: BodyLaunch) => Promise<OwnedProcess>): Promise<void>;
61
63
  export declare function driveAkumaBody(launch: BodyLaunch, adapter?: ProviderAdapter, runtime?: BodyRuntime): Promise<"held" | void>;
62
64
  export declare function spawnAkumaBody(launch: BodyLaunch): Promise<OwnedProcess>;
63
- export declare function runAkumaBody(launch: BodyLaunch, upstream: UpstreamExecutionPort): Promise<"held" | void>;
65
+ export declare function runAkumaBody(launch: BodyLaunch, upstream: unknown, commands: Readonly<Record<string, ErasedRequestCommand>>): Promise<"held" | void>;
64
66
  export declare function wakeRecordedTell(paths: AkumaPaths, tellId: string, runtime?: TellWakeRuntime): Promise<TellResult>;
@@ -7,7 +7,7 @@ import { HeldAkumaLeash, breakBody, endTurn, finishBodyIfIdle, heartExists, isHe
7
7
  import { worldRootForAkumaPaths } from "./identity.js";
8
8
  import { keiyakuSquarePath } from "../world.js";
9
9
  import { resolveProviderExecution } from "./providers/index.js";
10
- import { clearBodyRequestTransport, settleBodyRequests, } from "./request-serve.js";
10
+ import { clearBodyRequestTransport, settleBodyRequests } from "./request-serve.js";
11
11
  import { spawnDetachedProcess, } from "../runtime/proc/run.js";
12
12
  const LEASH_RETRY_MS = 100;
13
13
  const WAKE_REREAD_MS = 100;
@@ -121,6 +121,7 @@ function defaultRuntime() {
121
121
  return {
122
122
  now: () => new Date().toISOString(),
123
123
  spawnChild: spawnAkumaBody,
124
+ commands: {},
124
125
  spawnBody: spawnAkumaBody,
125
126
  };
126
127
  }
@@ -201,6 +202,7 @@ async function runBodyTurns(input) {
201
202
  ...(initial === undefined ? {} : { call: initial }),
202
203
  launchTells,
203
204
  ...(runtime.upstream === undefined ? {} : { upstream: runtime.upstream }),
205
+ commands: runtime.commands,
204
206
  now: runtime.now,
205
207
  });
206
208
  if (result.kind === "hung")
@@ -293,8 +295,8 @@ export async function driveAkumaBody(launch, adapter, runtime = defaultRuntime()
293
295
  export async function spawnAkumaBody(launch) {
294
296
  return await spawnDetachedProcess(await bodyProcessInput(launch));
295
297
  }
296
- export async function runAkumaBody(launch, upstream) {
297
- return await driveAkumaBody(launch, undefined, { ...defaultRuntime(), upstream });
298
+ export async function runAkumaBody(launch, upstream, commands) {
299
+ return await driveAkumaBody(launch, undefined, { ...defaultRuntime(), upstream, commands });
298
300
  }
299
301
  const DIRECT_TELL_WAKE = {
300
302
  spawn: async (paths) => await spawnAkumaBody({ paths, refuseIfHeld: true }),
@@ -0,0 +1,80 @@
1
+ import { type Soul } from "./heart/index.js";
2
+ import { type AkuId, type AkumaPaths } from "./identity.js";
3
+ import { type ErasedRequestCommand, type RequestCommand } from "./request-wire.js";
4
+ import type { OwnedProcess } from "../runtime/proc/run.js";
5
+ import { z } from "zod";
6
+ import { type WorldRoot } from "../world.js";
7
+ declare const akumaCallRecipeSchema: z.ZodObject<{
8
+ description: z.ZodOptional<z.ZodString>;
9
+ allowed: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("./allowed.js").AllowedActions, unknown>>;
10
+ provider: z.ZodPipe<z.ZodUnknown, z.ZodTransform<Readonly<{
11
+ name: string;
12
+ kind: "acp" | "claude-agent-sdk" | "codex-app-server" | "grok-build" | "opencode-sdk" | "pi";
13
+ executable?: string;
14
+ config?: Readonly<Record<string, unknown>>;
15
+ env?: Readonly<Record<string, string>>;
16
+ }>, unknown>>;
17
+ options: z.ZodPipe<z.ZodUnknown, z.ZodTransform<Readonly<{
18
+ model?: string;
19
+ effort?: string;
20
+ readonly?: true;
21
+ network?: "disabled" | "enabled";
22
+ systemPrompt?: string;
23
+ systemPromptMode?: import("./provider-recipe.js").SystemPromptMode;
24
+ }>, unknown>>;
25
+ readonly: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("./provider-recipe.js").ReadonlyRestraint, unknown>>>;
26
+ }, z.core.$strict>;
27
+ declare const akumaCallPayloadSchema: z.ZodObject<{
28
+ world: z.ZodString;
29
+ archetype: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
30
+ body: z.ZodString;
31
+ cwd: z.ZodOptional<z.ZodString>;
32
+ recipe: z.ZodObject<{
33
+ description: z.ZodOptional<z.ZodString>;
34
+ allowed: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("./allowed.js").AllowedActions, unknown>>;
35
+ provider: z.ZodPipe<z.ZodUnknown, z.ZodTransform<Readonly<{
36
+ name: string;
37
+ kind: "acp" | "claude-agent-sdk" | "codex-app-server" | "grok-build" | "opencode-sdk" | "pi";
38
+ executable?: string;
39
+ config?: Readonly<Record<string, unknown>>;
40
+ env?: Readonly<Record<string, string>>;
41
+ }>, unknown>>;
42
+ options: z.ZodPipe<z.ZodUnknown, z.ZodTransform<Readonly<{
43
+ model?: string;
44
+ effort?: string;
45
+ readonly?: true;
46
+ network?: "disabled" | "enabled";
47
+ systemPrompt?: string;
48
+ systemPromptMode?: import("./provider-recipe.js").SystemPromptMode;
49
+ }>, unknown>>;
50
+ readonly: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("./provider-recipe.js").ReadonlyRestraint, unknown>>>;
51
+ }, z.core.$strict>;
52
+ }, z.core.$strict>;
53
+ export type AkumaCallRecipe = z.infer<typeof akumaCallRecipeSchema>;
54
+ export type AkumaCallRequest = z.infer<typeof akumaCallPayloadSchema> & Readonly<{
55
+ action: "akuma.call";
56
+ }>;
57
+ export type AkumaCallRequestChildLaunch = Readonly<{
58
+ paths: AkumaPaths;
59
+ seed: Omit<Soul, "createdAt">;
60
+ initialBody: string;
61
+ }>;
62
+ type CallExecutionContext = Readonly<{
63
+ id: string;
64
+ requester: string;
65
+ signal: AbortSignal;
66
+ world: WorldRoot;
67
+ paths: AkumaPaths;
68
+ parent: Soul;
69
+ spawn(launch: AkumaCallRequestChildLaunch): Promise<OwnedProcess | void>;
70
+ admissionOpen(): boolean;
71
+ }>;
72
+ export declare function decodeAkumaCallRequest(value: unknown): AkumaCallRequest | null;
73
+ export declare function akumaCallRequestCommand(): RequestCommand<AkumaCallRequest, AkuId, never, AkuId, CallExecutionContext>;
74
+ export declare function akumaCallRequestCommands(): Readonly<Record<"akuma.call", ErasedRequestCommand>>;
75
+ export declare function requestForwardedAkumaCall(input: Omit<AkumaCallRequest, "action"> & Readonly<{
76
+ directory: string;
77
+ id: string;
78
+ signal?: AbortSignal;
79
+ }>): Promise<AkuId>;
80
+ export {};