@astrosheep/keiyaku 4.5.7 → 4.5.9

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 (244) 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 +12 -11
  7. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +33 -12
  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 +392 -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/archetype.js +1 -1
  23. package/build/src/akuma/body.d.ts +8 -5
  24. package/build/src/akuma/body.js +12 -5
  25. package/build/src/akuma/call-request.d.ts +80 -0
  26. package/build/src/akuma/call-request.js +211 -0
  27. package/build/src/akuma/heart/facts.d.ts +16 -78
  28. package/build/src/akuma/heart/facts.js +11 -0
  29. package/build/src/akuma/heart/index.d.ts +3 -2
  30. package/build/src/akuma/heart/index.js +4 -1
  31. package/build/src/akuma/heart/request-authority.d.ts +5 -4
  32. package/build/src/akuma/heart/request-authority.js +20 -34
  33. package/build/src/akuma/heart/request-rows.js +12 -23
  34. package/build/src/akuma/heart/schema.d.ts +1 -1
  35. package/build/src/akuma/heart/schema.js +5 -13
  36. package/build/src/akuma/index.d.ts +1 -1
  37. package/build/src/akuma/index.js +1 -1
  38. package/build/src/akuma/projection-read.d.ts +1 -0
  39. package/build/src/akuma/projection-read.js +8 -1
  40. package/build/src/akuma/projection.d.ts +907 -137
  41. package/build/src/akuma/projection.js +193 -9
  42. package/build/src/akuma/provider.d.ts +30 -3
  43. package/build/src/akuma/provider.js +111 -0
  44. package/build/src/akuma/providers/acp/core.d.ts +2 -2
  45. package/build/src/akuma/providers/acp/core.js +13 -6
  46. package/build/src/akuma/providers/acp/index.js +5 -4
  47. package/build/src/akuma/providers/claude/events.d.ts +2 -2
  48. package/build/src/akuma/providers/claude/events.js +16 -3
  49. package/build/src/akuma/providers/claude/index.d.ts +3 -3
  50. package/build/src/akuma/providers/claude/index.js +16 -5
  51. package/build/src/akuma/providers/codex-app-server/events.d.ts +2 -2
  52. package/build/src/akuma/providers/codex-app-server/events.js +25 -4
  53. package/build/src/akuma/providers/codex-app-server/index.js +18 -6
  54. package/build/src/akuma/providers/grok-build/index.js +5 -4
  55. package/build/src/akuma/providers/opencode-sdk/index.js +66 -25
  56. package/build/src/akuma/providers/opencode-sdk/session.d.ts +3 -2
  57. package/build/src/akuma/providers/opencode-sdk/session.js +28 -11
  58. package/build/src/akuma/providers/pi/index.js +72 -58
  59. package/build/src/akuma/request-lifecycle.d.ts +4 -10
  60. package/build/src/akuma/request-lifecycle.js +7 -5
  61. package/build/src/akuma/request-rendezvous.d.ts +26 -0
  62. package/build/src/akuma/request-rendezvous.js +100 -0
  63. package/build/src/akuma/request-serve.d.ts +6 -66
  64. package/build/src/akuma/request-serve.js +83 -210
  65. package/build/src/akuma/request-wire.d.ts +109 -115
  66. package/build/src/akuma/request-wire.js +63 -318
  67. package/build/src/akuma/requests.d.ts +19 -47
  68. package/build/src/akuma/requests.js +51 -107
  69. package/build/src/akuma/turn-drive.d.ts +5 -3
  70. package/build/src/akuma/turn-drive.js +39 -11
  71. package/build/src/akuma-body.d.ts +7 -2
  72. package/build/src/akuma-body.js +68 -46
  73. package/build/src/body/amend.js +18 -19
  74. package/build/src/cli/accepted.d.ts +1 -1
  75. package/build/src/cli/accepted.js +2 -2
  76. package/build/src/cli/commands/akuma-invoke.d.ts +2 -0
  77. package/build/src/cli/commands/akuma-invoke.js +17 -9
  78. package/build/src/cli/commands/akuma.js +8 -8
  79. package/build/src/cli/commands/contract-invoke.d.ts +3 -2
  80. package/build/src/cli/commands/contract-invoke.js +42 -30
  81. package/build/src/cli/commands/contract.d.ts +16 -20
  82. package/build/src/cli/commands/contract.js +58 -25
  83. package/build/src/cli/commands/install.d.ts +2 -1
  84. package/build/src/cli/commands/install.js +3 -2
  85. package/build/src/cli/commands/task-invoke.d.ts +3 -0
  86. package/build/src/cli/commands/task-invoke.js +23 -140
  87. package/build/src/cli/commands/task.js +54 -20
  88. package/build/src/cli/invoke.js +39 -25
  89. package/build/src/cli/main.js +2 -1
  90. package/build/src/cli/parse.d.ts +2 -2
  91. package/build/src/cli/parse.js +56 -27
  92. package/build/src/cli/render/akuma-activity.d.ts +3 -0
  93. package/build/src/cli/render/akuma-activity.js +45 -29
  94. package/build/src/cli/render/akuma-tool.d.ts +5 -1
  95. package/build/src/cli/render/akuma.js +4 -8
  96. package/build/src/cli/render/audit.js +1 -1
  97. package/build/src/cli/render/catalog.js +80 -21
  98. package/build/src/cli/render/contract-observation.d.ts +2 -0
  99. package/build/src/cli/render/contract-observation.js +11 -0
  100. package/build/src/cli/render/contract.js +35 -62
  101. package/build/src/cli/render/kanshi-akuma.d.ts +8 -0
  102. package/build/src/cli/render/kanshi-akuma.js +132 -0
  103. package/build/src/cli/render/kanshi.js +131 -213
  104. package/build/src/cli/render/receipt.d.ts +1 -2
  105. package/build/src/cli/render/receipt.js +76 -26
  106. package/build/src/cli/render/refusal.js +2 -10
  107. package/build/src/cli/render/region.js +5 -2
  108. package/build/src/cli/render/settings.d.ts +1 -1
  109. package/build/src/cli/render/settings.js +27 -8
  110. package/build/src/cli/render/task.js +22 -5
  111. package/build/src/cli/render/terminal.d.ts +32 -1
  112. package/build/src/cli/render/terminal.js +77 -1
  113. package/build/src/cli/result.d.ts +3 -3
  114. package/build/src/cli/runtime.js +4 -2
  115. package/build/src/cli/selectors.d.ts +2 -1
  116. package/build/src/cli/selectors.js +4 -3
  117. package/build/src/cli/square-edge.js +120 -36
  118. package/build/src/cli/usage.js +2 -1
  119. package/build/src/contract-guidance.d.ts +5 -0
  120. package/build/src/contract-guidance.js +121 -0
  121. package/build/src/contract-worktree.d.ts +0 -1
  122. package/build/src/contract-worktree.js +32 -83
  123. package/build/src/coordination/sqlite-transaction-lock.d.ts +1 -0
  124. package/build/src/coordination/sqlite-transaction-lock.js +5 -0
  125. package/build/src/core/facts/codec.d.ts +2 -0
  126. package/build/src/core/facts/codec.js +4 -0
  127. package/build/src/core/verbs/placement.d.ts +6 -1
  128. package/build/src/core/verbs/placement.js +5 -3
  129. package/build/src/dispatch/index.d.ts +0 -2
  130. package/build/src/dispatch/index.js +54 -55
  131. package/build/src/git/admission.js +2 -2
  132. package/build/src/git/hooks.d.ts +9 -15
  133. package/build/src/git/hooks.js +23 -317
  134. package/build/src/git/nuke.d.ts +2 -1
  135. package/build/src/git/nuke.js +39 -21
  136. package/build/src/git/private-state-seat.d.ts +12 -0
  137. package/build/src/git/private-state-seat.js +39 -0
  138. package/build/src/git/process.d.ts +6 -0
  139. package/build/src/git/process.js +26 -11
  140. package/build/src/git/read-observation.js +29 -20
  141. package/build/src/git/reconcile.d.ts +13 -1
  142. package/build/src/git/reconcile.js +70 -11
  143. package/build/src/git/ref-migration.d.ts +22 -0
  144. package/build/src/git/ref-migration.js +55 -0
  145. package/build/src/git/repository.d.ts +10 -6
  146. package/build/src/git/repository.js +16 -8
  147. package/build/src/git/target-placement.d.ts +1 -0
  148. package/build/src/git/target-placement.js +5 -0
  149. package/build/src/git/tender.d.ts +1 -0
  150. package/build/src/git/terminal-reconcile.d.ts +1 -1
  151. package/build/src/git/terminal-reconcile.js +22 -20
  152. package/build/src/git/workspace.d.ts +14 -0
  153. package/build/src/git/workspace.js +44 -0
  154. package/build/src/kanshi/index.d.ts +1 -1
  155. package/build/src/kanshi/read.js +16 -16
  156. package/build/src/kanshi/report.d.ts +2 -2
  157. package/build/src/library/address.d.ts +9 -3
  158. package/build/src/library/address.js +3 -2
  159. package/build/src/library/akuma-creation.d.ts +4 -3
  160. package/build/src/library/akuma-creation.js +19 -13
  161. package/build/src/library/audit.d.ts +14 -6
  162. package/build/src/library/audit.js +13 -23
  163. package/build/src/library/catalog.d.ts +3 -1
  164. package/build/src/library/catalog.js +20 -6
  165. package/build/src/library/composition.d.ts +385 -0
  166. package/build/src/library/composition.js +28 -0
  167. package/build/src/library/configuration.js +8 -2
  168. package/build/src/library/continuation.js +66 -30
  169. package/build/src/library/contract-bind.js +10 -2
  170. package/build/src/library/contract-forwarding-reconciliation-result.d.ts +102 -0
  171. package/build/src/library/contract-forwarding-reconciliation-result.js +92 -0
  172. package/build/src/library/contract-forwarding-result.d.ts +4464 -0
  173. package/build/src/library/contract-forwarding-result.js +521 -0
  174. package/build/src/library/contract-forwarding.d.ts +71 -0
  175. package/build/src/library/contract-forwarding.js +114 -0
  176. package/build/src/library/contract-handle.d.ts +38 -0
  177. package/build/src/library/contract-handle.js +314 -0
  178. package/build/src/library/contract-operations.d.ts +214 -69
  179. package/build/src/library/contract-operations.js +189 -118
  180. package/build/src/library/contract-types.d.ts +7 -3
  181. package/build/src/library/contract.d.ts +21 -34
  182. package/build/src/library/contract.js +29 -287
  183. package/build/src/library/fleet-result.d.ts +1580 -0
  184. package/build/src/library/fleet-result.js +98 -0
  185. package/build/src/library/fleet.d.ts +112 -54
  186. package/build/src/library/fleet.js +211 -71
  187. package/build/src/library/input.d.ts +3 -1
  188. package/build/src/library/input.js +11 -1
  189. package/build/src/library/keiyaku.d.ts +388 -20
  190. package/build/src/library/keiyaku.js +13 -21
  191. package/build/src/library/mutation.d.ts +3 -3
  192. package/build/src/library/mutation.js +5 -9
  193. package/build/src/library/nuke.d.ts +1 -1
  194. package/build/src/library/nuke.js +4 -3
  195. package/build/src/library/reconcile.d.ts +4 -0
  196. package/build/src/library/reconcile.js +2 -0
  197. package/build/src/library/refusal.d.ts +0 -9
  198. package/build/src/library/refusal.js +0 -7
  199. package/build/src/protocol/amend.js +56 -50
  200. package/build/src/protocol/attempt.d.ts +2 -0
  201. package/build/src/protocol/attempt.js +8 -1
  202. package/build/src/protocol/completion.js +7 -0
  203. package/build/src/protocol/deliver.js +6 -2
  204. package/build/src/protocol/operations.d.ts +4 -1
  205. package/build/src/protocol/operations.js +5 -2
  206. package/build/src/protocol/placement.d.ts +1 -0
  207. package/build/src/protocol/placement.js +52 -38
  208. package/build/src/protocol/read/observation.d.ts +1 -4
  209. package/build/src/protocol/read/observation.js +2 -15
  210. package/build/src/protocol/reintegrate.js +62 -58
  211. package/build/src/protocol/review.js +5 -0
  212. package/build/src/protocol/run.js +17 -13
  213. package/build/src/runtime/proc/run.d.ts +9 -0
  214. package/build/src/runtime/proc/run.js +51 -4
  215. package/build/src/runtime/proc/termination.js +26 -22
  216. package/build/src/runtime/proc/windows-launch.exe +0 -0
  217. package/build/src/settlement/holder.d.ts +2 -1
  218. package/build/src/settlement/holder.js +15 -4
  219. package/build/src/settlement/settle.js +99 -33
  220. package/build/src/task/board.d.ts +68 -27
  221. package/build/src/task/board.js +31 -1
  222. package/build/src/task/catalog.d.ts +4 -0
  223. package/build/src/task/catalog.js +23 -0
  224. package/build/src/task/compose-language.js +33 -7
  225. package/build/src/task/compose-parser.d.ts +1 -1
  226. package/build/src/task/compose-parser.js +1 -1
  227. package/build/src/task/compose.js +2 -0
  228. package/build/src/task/index.d.ts +12 -4
  229. package/build/src/task/index.js +97 -16
  230. package/build/src/task/mutation-result.d.ts +923 -0
  231. package/build/src/task/mutation-result.js +140 -0
  232. package/build/src/task/mutation.d.ts +552 -28
  233. package/build/src/task/mutation.js +304 -97
  234. package/build/src/task/operations.d.ts +1 -4
  235. package/build/src/task/operations.js +0 -6
  236. package/build/src/task/public.d.ts +2 -0
  237. package/build/src/task/public.js +1 -0
  238. package/build/src/workspace-place.d.ts +7 -2
  239. package/build/src/workspace-place.js +34 -24
  240. package/build/src/world.d.ts +1 -0
  241. package/build/src/world.js +11 -0
  242. package/package.json +8 -6
  243. package/build/src/akuma/request-execution.d.ts +0 -8
  244. 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,393 @@ 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.ZodPipe<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>, z.ZodTransform<Readonly<{
139
+ turnSequence: number;
140
+ route: "launch" | "live";
141
+ receipt?: "unavailable" | "required";
142
+ deliveredAt: string;
143
+ }>, {
144
+ deliveredAt: string;
145
+ route: "live" | "launch";
146
+ turnSequence: number;
147
+ receipt?: "required" | "unavailable" | undefined;
148
+ }>>>>;
149
+ }, z.core.$strict>]>, z.ZodObject<{
150
+ kind: z.ZodLiteral<"tool">;
151
+ sequence: z.ZodNumber;
152
+ turnSequence: z.ZodNumber;
153
+ at: z.ZodString;
154
+ name: z.ZodString;
155
+ call: z.ZodUnion<readonly [z.ZodObject<{
156
+ kind: z.ZodLiteral<"run">;
157
+ command: z.ZodString;
158
+ }, z.core.$strict>, z.ZodObject<{
159
+ kind: z.ZodLiteral<"read">;
160
+ path: z.ZodString;
161
+ offset: z.ZodOptional<z.ZodNumber>;
162
+ limit: z.ZodOptional<z.ZodNumber>;
163
+ }, z.core.$strict>, z.ZodObject<{
164
+ kind: z.ZodLiteral<"search">;
165
+ query: z.ZodString;
166
+ scope: z.ZodOptional<z.ZodEnum<{
167
+ content: "content";
168
+ files: "files";
169
+ web: "web";
170
+ }>>;
171
+ path: z.ZodOptional<z.ZodString>;
172
+ glob: z.ZodOptional<z.ZodString>;
173
+ }, z.core.$strict>, z.ZodObject<{
174
+ kind: z.ZodLiteral<"fileChange">;
175
+ changes: z.ZodReadonly<z.ZodArray<z.ZodObject<{
176
+ op: z.ZodEnum<{
177
+ add: "add";
178
+ update: "update";
179
+ delete: "delete";
180
+ unspecified: "unspecified";
181
+ }>;
182
+ path: z.ZodString;
183
+ diffstat: z.ZodOptional<z.ZodObject<{
184
+ added: z.ZodNumber;
185
+ removed: z.ZodNumber;
186
+ }, z.core.$strict>>;
187
+ }, z.core.$strict>>>;
188
+ }, z.core.$strict>, z.ZodObject<{
189
+ kind: z.ZodLiteral<"other">;
190
+ display: z.ZodString;
191
+ }, z.core.$strict>]>;
192
+ state: z.ZodLiteral<"active">;
193
+ truncated: z.ZodOptional<z.ZodLiteral<true>>;
194
+ }, z.core.$strict>, z.ZodObject<{
195
+ kind: z.ZodLiteral<"tool">;
196
+ sequence: z.ZodNumber;
197
+ turnSequence: z.ZodNumber;
198
+ at: z.ZodString;
199
+ completedAt: z.ZodOptional<z.ZodString>;
200
+ durationMs: z.ZodOptional<z.ZodNumber>;
201
+ name: z.ZodString;
202
+ call: z.ZodUnion<readonly [z.ZodObject<{
203
+ kind: z.ZodLiteral<"run">;
204
+ command: z.ZodString;
205
+ }, z.core.$strict>, z.ZodObject<{
206
+ kind: z.ZodLiteral<"read">;
207
+ path: z.ZodString;
208
+ offset: z.ZodOptional<z.ZodNumber>;
209
+ limit: z.ZodOptional<z.ZodNumber>;
210
+ }, z.core.$strict>, z.ZodObject<{
211
+ kind: z.ZodLiteral<"search">;
212
+ query: z.ZodString;
213
+ scope: z.ZodOptional<z.ZodEnum<{
214
+ content: "content";
215
+ files: "files";
216
+ web: "web";
217
+ }>>;
218
+ path: z.ZodOptional<z.ZodString>;
219
+ glob: z.ZodOptional<z.ZodString>;
220
+ }, z.core.$strict>, z.ZodObject<{
221
+ kind: z.ZodLiteral<"fileChange">;
222
+ changes: z.ZodReadonly<z.ZodArray<z.ZodObject<{
223
+ op: z.ZodEnum<{
224
+ add: "add";
225
+ update: "update";
226
+ delete: "delete";
227
+ unspecified: "unspecified";
228
+ }>;
229
+ path: z.ZodString;
230
+ diffstat: z.ZodOptional<z.ZodObject<{
231
+ added: z.ZodNumber;
232
+ removed: z.ZodNumber;
233
+ }, z.core.$strict>>;
234
+ }, z.core.$strict>>>;
235
+ }, z.core.$strict>, z.ZodObject<{
236
+ kind: z.ZodLiteral<"other">;
237
+ display: z.ZodString;
238
+ }, z.core.$strict>]>;
239
+ state: z.ZodObject<{
240
+ status: z.ZodEnum<{
241
+ error: "error";
242
+ ok: "ok";
243
+ }>;
244
+ message: z.ZodOptional<z.ZodString>;
245
+ exitCode: z.ZodOptional<z.ZodNumber>;
246
+ }, z.core.$strict>;
247
+ truncated: z.ZodOptional<z.ZodLiteral<true>>;
248
+ }, z.core.$strict>]>;
249
+ }, z.core.$strict>]>>>;
250
+ omitted: z.ZodNumber;
251
+ }, z.core.$strict>, z.ZodObject<{
252
+ reportedChanges: z.ZodReadonly<z.ZodArray<z.ZodObject<{
253
+ sequence: z.ZodNumber;
254
+ at: z.ZodString;
255
+ op: z.ZodEnum<{
256
+ add: "add";
257
+ update: "update";
258
+ delete: "delete";
259
+ unspecified: "unspecified";
260
+ }>;
261
+ path: z.ZodString;
262
+ diffstat: z.ZodOptional<z.ZodObject<{
263
+ added: z.ZodNumber;
264
+ removed: z.ZodNumber;
265
+ }, z.core.$strict>>;
266
+ }, z.core.$strict>>>;
267
+ reportedChangesOmitted: z.ZodNumber;
268
+ kind: z.ZodLiteral<"idle">;
269
+ outcome: z.ZodOptional<z.ZodObject<{
270
+ kind: z.ZodLiteral<"outcome">;
271
+ sequence: z.ZodNumber;
272
+ turnSequence: z.ZodNumber;
273
+ at: z.ZodString;
274
+ outcome: z.ZodUnion<readonly [z.ZodObject<{
275
+ kind: z.ZodLiteral<"answered">;
276
+ historyId: z.ZodString;
277
+ answer: z.ZodString;
278
+ }, z.core.$strict>, z.ZodObject<{
279
+ kind: z.ZodLiteral<"failed">;
280
+ historyId: z.ZodString;
281
+ diagnostic: z.ZodString;
282
+ }, z.core.$strict>]>;
283
+ }, z.core.$strict>>;
284
+ entries: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
285
+ kind: z.ZodLiteral<"gap">;
286
+ count: z.ZodNumber;
287
+ }, z.core.$strict>, z.ZodObject<{
288
+ kind: z.ZodLiteral<"row">;
289
+ row: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodObject<{
290
+ kind: z.ZodLiteral<"call">;
291
+ sequence: z.ZodNumber;
292
+ turnSequence: z.ZodNumber;
293
+ at: z.ZodString;
294
+ text: z.ZodString;
295
+ }, z.core.$strict>, z.ZodObject<{
296
+ kind: z.ZodLiteral<"note" | "thought" | "said">;
297
+ sequence: z.ZodNumber;
298
+ turnSequence: z.ZodNumber;
299
+ at: z.ZodString;
300
+ text: z.ZodString;
301
+ truncated: z.ZodOptional<z.ZodLiteral<true>>;
302
+ }, z.core.$strict>, z.ZodObject<{
303
+ kind: z.ZodLiteral<"note" | "thought" | "said">;
304
+ sequence: z.ZodNumber;
305
+ turnSequence: z.ZodNumber;
306
+ at: z.ZodString;
307
+ text: z.ZodString;
308
+ truncated: z.ZodOptional<z.ZodLiteral<true>>;
309
+ }, z.core.$strict>, z.ZodObject<{
310
+ kind: z.ZodLiteral<"note" | "thought" | "said">;
311
+ sequence: z.ZodNumber;
312
+ turnSequence: z.ZodNumber;
313
+ at: z.ZodString;
314
+ text: z.ZodString;
315
+ truncated: z.ZodOptional<z.ZodLiteral<true>>;
316
+ }, z.core.$strict>, z.ZodObject<{
317
+ kind: z.ZodLiteral<"tell">;
318
+ sequence: z.ZodNumber;
319
+ at: z.ZodString;
320
+ tellId: z.ZodString;
321
+ text: z.ZodString;
322
+ state: z.ZodEnum<{
323
+ pending: "pending";
324
+ told: "told";
325
+ }>;
326
+ deliveries: z.ZodReadonly<z.ZodArray<z.ZodPipe<z.ZodObject<{
327
+ deliveredAt: z.ZodString;
328
+ route: z.ZodEnum<{
329
+ live: "live";
330
+ launch: "launch";
331
+ }>;
332
+ turnSequence: z.ZodNumber;
333
+ receipt: z.ZodOptional<z.ZodEnum<{
334
+ required: "required";
335
+ unavailable: "unavailable";
336
+ }>>;
337
+ }, z.core.$strict>, z.ZodTransform<Readonly<{
338
+ turnSequence: number;
339
+ route: "launch" | "live";
340
+ receipt?: "unavailable" | "required";
341
+ deliveredAt: string;
342
+ }>, {
343
+ deliveredAt: string;
344
+ route: "live" | "launch";
345
+ turnSequence: number;
346
+ receipt?: "required" | "unavailable" | undefined;
347
+ }>>>>;
348
+ }, z.core.$strict>]>, z.ZodObject<{
349
+ kind: z.ZodLiteral<"tool">;
350
+ sequence: z.ZodNumber;
351
+ turnSequence: z.ZodNumber;
352
+ at: z.ZodString;
353
+ completedAt: z.ZodOptional<z.ZodString>;
354
+ durationMs: z.ZodOptional<z.ZodNumber>;
355
+ name: z.ZodString;
356
+ call: z.ZodUnion<readonly [z.ZodObject<{
357
+ kind: z.ZodLiteral<"run">;
358
+ command: z.ZodString;
359
+ }, z.core.$strict>, z.ZodObject<{
360
+ kind: z.ZodLiteral<"read">;
361
+ path: z.ZodString;
362
+ offset: z.ZodOptional<z.ZodNumber>;
363
+ limit: z.ZodOptional<z.ZodNumber>;
364
+ }, z.core.$strict>, z.ZodObject<{
365
+ kind: z.ZodLiteral<"search">;
366
+ query: z.ZodString;
367
+ scope: z.ZodOptional<z.ZodEnum<{
368
+ content: "content";
369
+ files: "files";
370
+ web: "web";
371
+ }>>;
372
+ path: z.ZodOptional<z.ZodString>;
373
+ glob: z.ZodOptional<z.ZodString>;
374
+ }, z.core.$strict>, z.ZodObject<{
375
+ kind: z.ZodLiteral<"fileChange">;
376
+ changes: z.ZodReadonly<z.ZodArray<z.ZodObject<{
377
+ op: z.ZodEnum<{
378
+ add: "add";
379
+ update: "update";
380
+ delete: "delete";
381
+ unspecified: "unspecified";
382
+ }>;
383
+ path: z.ZodString;
384
+ diffstat: z.ZodOptional<z.ZodObject<{
385
+ added: z.ZodNumber;
386
+ removed: z.ZodNumber;
387
+ }, z.core.$strict>>;
388
+ }, z.core.$strict>>>;
389
+ }, z.core.$strict>, z.ZodObject<{
390
+ kind: z.ZodLiteral<"other">;
391
+ display: z.ZodString;
392
+ }, z.core.$strict>]>;
393
+ state: z.ZodObject<{
394
+ status: z.ZodEnum<{
395
+ error: "error";
396
+ ok: "ok";
397
+ }>;
398
+ message: z.ZodOptional<z.ZodString>;
399
+ exitCode: z.ZodOptional<z.ZodNumber>;
400
+ }, z.core.$strict>;
401
+ truncated: z.ZodOptional<z.ZodLiteral<true>>;
402
+ }, z.core.$strict>]>;
403
+ }, z.core.$strict>]>>>;
404
+ omitted: z.ZodNumber;
405
+ }, z.core.$strict>]>;
406
+ strandedReason: z.ZodOptional<z.ZodLiteral<"resume-unsupported">>;
407
+ }, z.core.$strict>;
408
+ export type AkumaStatus = z.infer<typeof akumaStatusSchema>;
409
+ export declare function parseAkumaStatus(value: unknown): AkumaStatus;
29
410
  /** The default completion judgment over one complete status snapshot. */
30
411
  export declare function defaultWaitComplete(status: AkumaStatus): boolean;
31
412
  export type { ReadonlyRestraint } from "./provider-recipe.js";
@@ -39,6 +420,7 @@ export type UnbornAkumaListRow = Readonly<{
39
420
  }>;
40
421
  }>;
41
422
  export type AkumaList = Readonly<{
423
+ observedAt: string;
42
424
  rows: readonly (AkumaListRow | UnbornAkumaListRow)[];
43
425
  searched: readonly string[];
44
426
  }>;
@@ -108,6 +490,7 @@ export { bornStatus, fleetListRow, readAkumaBirthCwd, readBudgetedStatus, type B
108
490
  export type AkumaConfiguration = Readonly<{
109
491
  home?: string;
110
492
  settings?: Settings;
493
+ execution?: ExecutionContext;
111
494
  }>;
112
495
  export { AkumaHandle, akumaCallExecution, type LastAnswer } from "./akuma-handle.js";
113
496
  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,
@@ -75,7 +75,7 @@ function archetypeReadonly(values) {
75
75
  function decodeArchetype(name, path, markdown) {
76
76
  const lines = markdown.split(/\r?\n/u);
77
77
  if (lines[0]?.trim() !== "---")
78
- throw new TypeError("Akuma configuration must begin with YAML frontmatter");
78
+ throw new TypeError("Akuma file must begin with YAML frontmatter");
79
79
  const closing = lines.findIndex((line, index) => index > 0 && line.trim() === "---");
80
80
  if (closing < 0)
81
81
  throw new TypeError("Akuma frontmatter is not closed");
@@ -1,7 +1,8 @@
1
- import { type SessionFact, type Soul } from "./heart/index.js";
1
+ import type { AkumaCallRequestChildLaunch } from "./call-request.js";
2
+ import { type SessionFact, type Soul, type TellRow } 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";
@@ -37,6 +38,7 @@ export type TellResult = Readonly<{
37
38
  tellId: string;
38
39
  fact: "recorded";
39
40
  }>;
41
+ row: TellRow;
40
42
  wake: TellWake;
41
43
  }>;
42
44
  export type TellWakeRuntime = Readonly<{
@@ -45,9 +47,10 @@ export type TellWakeRuntime = Readonly<{
45
47
  }>;
46
48
  type BodyRuntime = Readonly<{
47
49
  now(): string;
48
- spawnChild?(launch: RequestChildLaunch): Promise<OwnedProcess>;
50
+ spawnChild?(launch: AkumaCallRequestChildLaunch): Promise<OwnedProcess>;
49
51
  spawnBody?(launch: BodyLaunch): Promise<OwnedProcess>;
50
- upstream?: UpstreamExecutionPort;
52
+ upstream?: unknown;
53
+ commands: Readonly<Record<string, ErasedRequestCommand>>;
51
54
  }>;
52
55
  export declare function bodyProcessInput(launch: BodyLaunch, bodyModuleUrl?: string): Promise<{
53
56
  argv: string[];
@@ -60,5 +63,5 @@ export declare function bodyProcessInput(launch: BodyLaunch, bodyModuleUrl?: str
60
63
  export declare function handoffPendingTells(paths: AkumaPaths, spawn?: (launch: BodyLaunch) => Promise<OwnedProcess>): Promise<void>;
61
64
  export declare function driveAkumaBody(launch: BodyLaunch, adapter?: ProviderAdapter, runtime?: BodyRuntime): Promise<"held" | void>;
62
65
  export declare function spawnAkumaBody(launch: BodyLaunch): Promise<OwnedProcess>;
63
- export declare function runAkumaBody(launch: BodyLaunch, upstream: UpstreamExecutionPort): Promise<"held" | void>;
66
+ export declare function runAkumaBody(launch: BodyLaunch, upstream: unknown, commands: Readonly<Record<string, ErasedRequestCommand>>): Promise<"held" | void>;
64
67
  export declare function wakeRecordedTell(paths: AkumaPaths, tellId: string, runtime?: TellWakeRuntime): Promise<TellResult>;
@@ -3,11 +3,11 @@ import { fileURLToPath } from "node:url";
3
3
  import { abortableDelay } from "./abort.js";
4
4
  import { BodySupervisor } from "./body-supervisor.js";
5
5
  import { driveTurn, turnRecipe } from "./turn-drive.js";
6
- import { HeldAkumaLeash, breakBody, endTurn, finishBodyIfIdle, heartExists, isHeartAbsent, readHeart, readNonterminalRequests, } from "./heart/index.js";
6
+ import { HeldAkumaLeash, breakBody, endTurn, finishBodyIfIdle, heartExists, isHeartAbsent, projectTell, readHeart, readTell, readNonterminalRequests, } from "./heart/index.js";
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 }),
@@ -365,8 +367,13 @@ async function wakePendingTells(paths, tellId, runtime) {
365
367
  }
366
368
  }
367
369
  export async function wakeRecordedTell(paths, tellId, runtime = DIRECT_TELL_WAKE) {
370
+ const wake = (await wakePendingTells(paths, tellId, runtime));
371
+ const tell = await readTell(paths, tellId);
372
+ if (tell === null)
373
+ throw new Error(`recorded Tell ${tellId} is missing from Heart`);
368
374
  return {
369
375
  admission: { tellId, fact: "recorded" },
370
- wake: (await wakePendingTells(paths, tellId, runtime)),
376
+ row: projectTell(tell),
377
+ wake,
371
378
  };
372
379
  }