@astrosheep/keiyaku 4.0.1 → 4.0.2

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 (245) hide show
  1. package/README.md +137 -5
  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/package.json +1 -1
  5. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +3 -3
  6. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +91 -35
  7. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +98 -58
  8. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +152 -53
  9. package/build/src/akuma/abort.d.ts +2 -0
  10. package/build/src/akuma/abort.js +50 -0
  11. package/build/src/akuma/akuma.d.ts +23 -14
  12. package/build/src/akuma/akuma.js +120 -104
  13. package/build/src/akuma/archetype.d.ts +7 -6
  14. package/build/src/akuma/archetype.js +68 -41
  15. package/build/src/akuma/body.d.ts +3 -5
  16. package/build/src/akuma/body.js +408 -213
  17. package/build/src/akuma/heart/facts.d.ts +25 -34
  18. package/build/src/akuma/heart/facts.js +18 -7
  19. package/build/src/akuma/heart/index.d.ts +39 -42
  20. package/build/src/akuma/heart/index.js +134 -93
  21. package/build/src/akuma/heart/rows.d.ts +9 -31
  22. package/build/src/akuma/heart/rows.js +26 -44
  23. package/build/src/akuma/heart/schema.d.ts +1 -1
  24. package/build/src/akuma/heart/schema.js +7 -15
  25. package/build/src/akuma/heart/soul.d.ts +8 -0
  26. package/build/src/akuma/heart/soul.js +136 -0
  27. package/build/src/akuma/heart/storage.d.ts +28 -14
  28. package/build/src/akuma/heart/storage.js +86 -26
  29. package/build/src/akuma/identity.d.ts +2 -2
  30. package/build/src/akuma/identity.js +9 -9
  31. package/build/src/akuma/index.d.ts +6 -1
  32. package/build/src/akuma/index.js +6 -0
  33. package/build/src/akuma/projection.d.ts +117 -38
  34. package/build/src/akuma/projection.js +208 -97
  35. package/build/src/akuma/provider-recipe.d.ts +24 -0
  36. package/build/src/akuma/provider-recipe.js +100 -0
  37. package/build/src/akuma/provider.d.ts +12 -4
  38. package/build/src/akuma/provider.js +117 -70
  39. package/build/src/akuma/providers/acp/core.d.ts +19 -0
  40. package/build/src/akuma/providers/acp/core.js +159 -0
  41. package/build/src/akuma/providers/acp/events.d.ts +20 -0
  42. package/build/src/akuma/providers/acp/events.js +73 -0
  43. package/build/src/akuma/providers/acp/index.d.ts +12 -0
  44. package/build/src/akuma/providers/acp/index.js +94 -0
  45. package/build/src/akuma/providers/claude/events.js +66 -13
  46. package/build/src/akuma/providers/claude/index.d.ts +2 -1
  47. package/build/src/akuma/providers/claude/index.js +35 -21
  48. package/build/src/akuma/providers/codex-app-server/events.js +4 -1
  49. package/build/src/akuma/providers/codex-app-server/index.d.ts +3 -3
  50. package/build/src/akuma/providers/codex-app-server/index.js +24 -31
  51. package/build/src/akuma/providers/grok-build/index.d.ts +4 -0
  52. package/build/src/akuma/providers/grok-build/index.js +70 -0
  53. package/build/src/akuma/providers/index.d.ts +5 -3
  54. package/build/src/akuma/providers/index.js +24 -59
  55. package/build/src/akuma/providers/opencode-sdk/events.d.ts +40 -34
  56. package/build/src/akuma/providers/opencode-sdk/events.js +220 -101
  57. package/build/src/akuma/providers/opencode-sdk/index.d.ts +3 -2
  58. package/build/src/akuma/providers/opencode-sdk/index.js +233 -128
  59. package/build/src/akuma/providers/opencode-sdk/session.d.ts +11 -26
  60. package/build/src/akuma/providers/opencode-sdk/session.js +10 -9
  61. package/build/src/akuma/providers/pi/events.js +49 -11
  62. package/build/src/akuma/providers/pi/index.d.ts +1 -1
  63. package/build/src/akuma/providers/pi/index.js +50 -21
  64. package/build/src/akuma/publication.d.ts +3 -3
  65. package/build/src/akuma/publication.js +28 -40
  66. package/build/src/akuma/requests.d.ts +9 -7
  67. package/build/src/akuma/requests.js +92 -65
  68. package/build/src/alias/index.d.ts +2 -2
  69. package/build/src/alias/index.js +10 -10
  70. package/build/src/body/decode.js +7 -1
  71. package/build/src/body/region.d.ts +2 -0
  72. package/build/src/body/region.js +77 -7
  73. package/build/src/cli/accepted.d.ts +17 -13
  74. package/build/src/cli/accepted.js +72 -34
  75. package/build/src/cli/actor.js +3 -3
  76. package/build/src/cli/commands/akuma-invoke.d.ts +4 -3
  77. package/build/src/cli/commands/akuma-invoke.js +14 -9
  78. package/build/src/cli/commands/akuma.d.ts +13 -3
  79. package/build/src/cli/commands/akuma.js +67 -34
  80. package/build/src/cli/commands/contract.d.ts +18 -5
  81. package/build/src/cli/commands/contract.js +9 -3
  82. package/build/src/cli/commands/task-invoke.d.ts +17 -4
  83. package/build/src/cli/commands/task-invoke.js +43 -20
  84. package/build/src/cli/commands/task-query.d.ts +5 -0
  85. package/build/src/cli/commands/task-query.js +247 -0
  86. package/build/src/cli/commands/task.d.ts +3 -1
  87. package/build/src/cli/commands/task.js +51 -13
  88. package/build/src/cli/coordinates.d.ts +18 -0
  89. package/build/src/cli/coordinates.js +120 -0
  90. package/build/src/cli/draft.d.ts +8 -0
  91. package/build/src/cli/draft.js +96 -0
  92. package/build/src/cli/invoke.d.ts +4 -3
  93. package/build/src/cli/invoke.js +160 -179
  94. package/build/src/cli/main.js +34 -6
  95. package/build/src/cli/parse.d.ts +9 -2
  96. package/build/src/cli/parse.js +29 -7
  97. package/build/src/cli/render/akuma-tool-command.d.ts +6 -0
  98. package/build/src/cli/render/akuma-tool-command.js +144 -0
  99. package/build/src/cli/render/akuma-tool.d.ts +2 -2
  100. package/build/src/cli/render/akuma-tool.js +30 -4
  101. package/build/src/cli/render/akuma.d.ts +1 -0
  102. package/build/src/cli/render/akuma.js +211 -116
  103. package/build/src/cli/render/audit.d.ts +3 -0
  104. package/build/src/cli/render/audit.js +104 -0
  105. package/build/src/cli/render/contract.d.ts +3 -3
  106. package/build/src/cli/render/contract.js +192 -79
  107. package/build/src/cli/render/kanshi.js +263 -168
  108. package/build/src/cli/render/receipt.d.ts +19 -0
  109. package/build/src/cli/render/receipt.js +106 -0
  110. package/build/src/cli/render/refusal.d.ts +16 -2
  111. package/build/src/cli/render/refusal.js +88 -20
  112. package/build/src/cli/render/region.d.ts +2 -0
  113. package/build/src/cli/render/region.js +17 -0
  114. package/build/src/cli/render/task.d.ts +2 -1
  115. package/build/src/cli/render/task.js +223 -60
  116. package/build/src/cli/render/terminal.d.ts +7 -0
  117. package/build/src/cli/render/terminal.js +46 -0
  118. package/build/src/cli/render/text.js +6 -3
  119. package/build/src/cli/result.d.ts +115 -20
  120. package/build/src/cli/usage.d.ts +1 -0
  121. package/build/src/cli/usage.js +3 -0
  122. package/build/src/contract-worktree.d.ts +6 -5
  123. package/build/src/contract-worktree.js +95 -57
  124. package/build/src/coordination/durable-file.d.ts +4 -3
  125. package/build/src/coordination/durable-file.js +29 -25
  126. package/build/src/coordination/sqlite-transaction-lock.d.ts +4 -0
  127. package/build/src/coordination/sqlite-transaction-lock.js +22 -5
  128. package/build/src/core/facts/fold.js +1 -6
  129. package/build/src/core/facts/gate.d.ts +1 -0
  130. package/build/src/core/facts/gate.js +1 -0
  131. package/build/src/core/verbs/amend.d.ts +1 -1
  132. package/build/src/core/verbs/amend.js +0 -11
  133. package/build/src/core/verbs/deliver.d.ts +1 -1
  134. package/build/src/core/verbs/deliver.js +1 -7
  135. package/build/src/core/verbs/placement.d.ts +1 -1
  136. package/build/src/core/verbs/placement.js +4 -1
  137. package/build/src/dispatch/index.d.ts +2 -2
  138. package/build/src/dispatch/index.js +17 -17
  139. package/build/src/git/admission.d.ts +1 -1
  140. package/build/src/git/admission.js +11 -11
  141. package/build/src/git/hooks.js +13 -13
  142. package/build/src/git/integration.d.ts +14 -15
  143. package/build/src/git/integration.js +80 -44
  144. package/build/src/git/observe.d.ts +5 -3
  145. package/build/src/git/observe.js +18 -12
  146. package/build/src/git/read-observation.js +9 -9
  147. package/build/src/git/reconcile.d.ts +2 -0
  148. package/build/src/git/reconcile.js +138 -95
  149. package/build/src/git/repository.d.ts +27 -19
  150. package/build/src/git/repository.js +155 -83
  151. package/build/src/git/scratch.d.ts +7 -3
  152. package/build/src/git/scratch.js +44 -37
  153. package/build/src/git/target-placement.d.ts +40 -4
  154. package/build/src/git/target-placement.js +221 -101
  155. package/build/src/git/tender.d.ts +6 -5
  156. package/build/src/git/tender.js +24 -43
  157. package/build/src/git/terminal-seal.d.ts +1 -1
  158. package/build/src/git/terminal-seal.js +7 -5
  159. package/build/src/git/workspace.d.ts +36 -4
  160. package/build/src/git/workspace.js +53 -18
  161. package/build/src/identity/selector.js +1 -1
  162. package/build/src/index.d.ts +3 -3
  163. package/build/src/index.js +1 -1
  164. package/build/src/kanshi/index.d.ts +2 -2
  165. package/build/src/kanshi/index.js +1 -1
  166. package/build/src/kanshi/read.d.ts +2 -1
  167. package/build/src/kanshi/read.js +118 -27
  168. package/build/src/kanshi/report.d.ts +50 -0
  169. package/build/src/kanshi/select.d.ts +5 -0
  170. package/build/src/kanshi/select.js +32 -0
  171. package/build/src/library/address.d.ts +12 -3
  172. package/build/src/library/address.js +77 -46
  173. package/build/src/library/akuma-creation.d.ts +6 -1
  174. package/build/src/library/akuma-creation.js +86 -13
  175. package/build/src/library/audit.d.ts +18 -0
  176. package/build/src/library/audit.js +44 -0
  177. package/build/src/library/bind.js +4 -4
  178. package/build/src/library/catalog.d.ts +1 -1
  179. package/build/src/library/catalog.js +5 -8
  180. package/build/src/library/contract.d.ts +5 -6
  181. package/build/src/library/contract.js +11 -35
  182. package/build/src/library/delivery.d.ts +2 -1
  183. package/build/src/library/fleet.d.ts +2 -2
  184. package/build/src/library/fleet.js +35 -71
  185. package/build/src/library/keiyaku.d.ts +3 -2
  186. package/build/src/library/keiyaku.js +1 -0
  187. package/build/src/library/mutation.d.ts +7 -6
  188. package/build/src/library/mutation.js +23 -25
  189. package/build/src/library/reconcile.d.ts +29 -0
  190. package/build/src/library/reconcile.js +179 -0
  191. package/build/src/library/region.d.ts +12 -0
  192. package/build/src/library/region.js +15 -1
  193. package/build/src/library/repo.d.ts +4 -16
  194. package/build/src/library/repo.js +13 -38
  195. package/build/src/protocol/attempt.js +6 -6
  196. package/build/src/protocol/bind.js +4 -4
  197. package/build/src/protocol/intent.d.ts +15 -2
  198. package/build/src/protocol/intent.js +21 -6
  199. package/build/src/protocol/operations.d.ts +73 -22
  200. package/build/src/protocol/operations.js +292 -88
  201. package/build/src/protocol/outcome.d.ts +9 -3
  202. package/build/src/protocol/outcome.js +3 -1
  203. package/build/src/protocol/placement.d.ts +15 -4
  204. package/build/src/protocol/placement.js +58 -25
  205. package/build/src/protocol/read/status.d.ts +8 -1
  206. package/build/src/protocol/read/status.js +61 -14
  207. package/build/src/runtime/proc/line-rpc.d.ts +3 -8
  208. package/build/src/runtime/proc/line-rpc.js +16 -43
  209. package/build/src/runtime/proc/run.d.ts +15 -29
  210. package/build/src/runtime/proc/run.js +113 -105
  211. package/build/src/runtime/proc/stdio.d.ts +18 -0
  212. package/build/src/runtime/proc/stdio.js +58 -0
  213. package/build/src/settings.d.ts +2 -2
  214. package/build/src/settings.js +8 -8
  215. package/build/src/settlement/fence.d.ts +0 -4
  216. package/build/src/settlement/fence.js +0 -9
  217. package/build/src/settlement/holder.d.ts +11 -1
  218. package/build/src/settlement/holder.js +25 -0
  219. package/build/src/settlement/settle.d.ts +1 -1
  220. package/build/src/settlement/settle.js +52 -89
  221. package/build/src/task/board.d.ts +3 -3
  222. package/build/src/task/board.js +6 -9
  223. package/build/src/task/compose.d.ts +1 -1
  224. package/build/src/task/compose.js +18 -10
  225. package/build/src/task/context.d.ts +3 -3
  226. package/build/src/task/context.js +14 -14
  227. package/build/src/task/document.d.ts +2 -1
  228. package/build/src/task/document.js +15 -5
  229. package/build/src/task/index.d.ts +19 -7
  230. package/build/src/task/index.js +42 -23
  231. package/build/src/task/operations.d.ts +15 -9
  232. package/build/src/task/operations.js +78 -48
  233. package/build/src/task/query.d.ts +67 -0
  234. package/build/src/task/query.js +279 -0
  235. package/build/src/task/store.d.ts +2 -2
  236. package/build/src/task/store.js +40 -25
  237. package/build/src/verification/execution.d.ts +4 -2
  238. package/build/src/verification/execution.js +9 -5
  239. package/build/src/workspace-place.d.ts +41 -0
  240. package/build/src/workspace-place.js +386 -0
  241. package/build/src/world.d.ts +13 -2
  242. package/build/src/world.js +81 -48
  243. package/package.json +3 -2
  244. package/build/src/protocol/read/audit.d.ts +0 -31
  245. package/build/src/protocol/read/audit.js +0 -55
@@ -1,48 +1,86 @@
1
1
  import { KeiyakuRefused, KeiyakuRetry, } from "../index.js";
2
- function hasOverlaps(value) {
3
- return "overlaps" in value;
2
+ function acceptedFacts(result) {
3
+ return result.facts.map((fact) => ({
4
+ contract: fact.contract,
5
+ entry: fact.entry,
6
+ kind: fact.kind,
7
+ }));
4
8
  }
5
- function hasOverlapFailure(value) {
6
- return "overlapFailure" in value;
7
- }
8
- function hasDocumentDiff(value) {
9
- return "documentDiff" in value && typeof value.documentDiff === "string";
10
- }
11
- function resultFromMutation(verb, result, options) {
12
- const acceptedContract = options.coordinate ?? result.facts[0]?.contract;
13
- if (acceptedContract === undefined)
9
+ function acceptedEnvelope(result, coordinate) {
10
+ const contract = coordinate ?? result.facts[0]?.contract;
11
+ if (contract === undefined)
14
12
  throw new Error("accepted mutation is missing its contract identity");
13
+ const firstLag = result.lags[0];
15
14
  return {
16
15
  kind: "accepted",
17
- verb,
18
- contract: acceptedContract,
16
+ contract,
19
17
  head: result.head,
20
- facts: result.facts.map((fact) => ({
21
- contract: fact.contract,
22
- entry: fact.entry,
23
- kind: fact.kind,
24
- })),
18
+ facts: acceptedFacts(result),
25
19
  effects: result.effects,
26
20
  settlement: result.settlement,
27
- ...(options.target === undefined ? {} : { target: options.target }),
28
- ...options.obligations,
29
- ...(hasOverlaps(result) ? { overlaps: result.overlaps } : {}),
30
- ...(hasOverlapFailure(result) ? { overlapFailure: result.overlapFailure } : {}),
31
- ...(hasDocumentDiff(result) ? { diff: result.documentDiff } : {}),
32
- ...(options.report === undefined ? {} : { report: options.report }),
33
- ...(options.workspace === undefined ? {} : { workspace: options.workspace }),
34
- ...(options.diff === undefined ? {} : { diff: options.diff }),
35
- ...(result.lags.length === 0 ? {} : { lag: result.lags }),
21
+ ...(result.lags.length === 0 || firstLag === undefined ? {} : { lag: [firstLag, ...result.lags.slice(1)] }),
22
+ };
23
+ }
24
+ function acceptedRegion(result) {
25
+ if (result.overlapFailure !== undefined)
26
+ return { overlapFailure: result.overlapFailure };
27
+ return { overlaps: result.overlaps };
28
+ }
29
+ export function acceptedBind(result, target) {
30
+ return {
31
+ ...acceptedEnvelope(result, undefined),
32
+ verb: "bind",
33
+ target,
34
+ ...acceptedRegion(result),
35
+ };
36
+ }
37
+ export function acceptedAmend(result, coordinate) {
38
+ return {
39
+ ...acceptedEnvelope(result, coordinate),
40
+ verb: "amend",
41
+ diff: result.documentDiff,
42
+ ...acceptedRegion(result),
43
+ };
44
+ }
45
+ export function acceptedDeliver(result, coordinate) {
46
+ const value = result.value;
47
+ return {
48
+ ...acceptedEnvelope(result, coordinate),
49
+ verb: "deliver",
50
+ ...(value.verification === undefined ? {} : { verification: value.verification }),
51
+ ...(value.verificationReuse === undefined ? {} : { verificationReuse: value.verificationReuse }),
52
+ ...(value.placement === undefined ? {} : { placement: value.placement }),
53
+ ...(value.cleanup === undefined ? {} : { cleanup: value.cleanup }),
54
+ ...(value.leak === undefined ? {} : { leak: value.leak }),
55
+ };
56
+ }
57
+ export function acceptedReview(result, coordinate) {
58
+ const value = result.value;
59
+ return {
60
+ ...acceptedEnvelope(result, coordinate),
61
+ verb: "review",
62
+ ...(value.placement === undefined ? {} : { placement: value.placement }),
63
+ ...(value.workspace === undefined ? {} : { workspace: value.workspace }),
64
+ };
65
+ }
66
+ export function acceptedArc(result, coordinate) {
67
+ return { ...acceptedEnvelope(result, coordinate), verb: "arc" };
68
+ }
69
+ export function acceptedAbandon(result, coordinate) {
70
+ return { ...acceptedEnvelope(result, coordinate), verb: "abandon" };
71
+ }
72
+ export function acceptedAudit(result, coordinate) {
73
+ return {
74
+ ...acceptedEnvelope(result, coordinate),
75
+ verb: "audit",
76
+ report: result.value,
77
+ ...(result.cleanup === undefined ? {} : { cleanup: result.cleanup }),
78
+ ...(result.leak === undefined ? {} : { leak: result.leak }),
36
79
  };
37
80
  }
38
- export async function resultFromMutationCall(verb, call, options = {}) {
81
+ export async function resultFromMutationCall(verb, call, project, options = {}) {
39
82
  try {
40
- const result = await call();
41
- const projected = options.project === undefined ? {} : await options.project(result);
42
- return resultFromMutation(verb, result, {
43
- ...projected,
44
- ...(options.coordinate === undefined ? {} : { coordinate: options.coordinate }),
45
- });
83
+ return project(await call());
46
84
  }
47
85
  catch (error) {
48
86
  if (error instanceof KeiyakuRefused) {
@@ -1,4 +1,4 @@
1
- const PROJECTION_ID_ENV = "KEIYAKU_PROJECTION_ID";
1
+ const ACTOR_ID_ENV = "KEIYAKU_ACTOR_ID";
2
2
  /** Resolve optional caller testimony from the current CLI edge vocabulary. */
3
3
  export function resolveActor(input = {}) {
4
4
  if (input.actor !== undefined) {
@@ -6,6 +6,6 @@ export function resolveActor(input = {}) {
6
6
  throw new TypeError("actor must be a nonblank string");
7
7
  return input.actor;
8
8
  }
9
- const projectionId = input.env?.[PROJECTION_ID_ENV];
10
- return projectionId !== undefined && projectionId.trim().length > 0 ? projectionId : undefined;
9
+ const actorId = input.env?.[ACTOR_ID_ENV];
10
+ return actorId !== undefined && actorId.trim().length > 0 ? actorId : undefined;
11
11
  }
@@ -7,6 +7,7 @@ export type AkumaInvocationResult = Readonly<{
7
7
  kind: "akuma";
8
8
  action: "call";
9
9
  result: CallResult;
10
+ world: WorldRoot;
10
11
  }> | Readonly<{
11
12
  kind: "akuma";
12
13
  action: "status";
@@ -66,12 +67,12 @@ export type AkumaInvocationResult = Readonly<{
66
67
  }>;
67
68
  type InvokeInput = Readonly<{
68
69
  path: WorldRoot;
69
- executionCwd: string;
70
+ executionCwd?: string;
70
71
  settings: Settings;
71
72
  contract?: KeiyakuContract;
72
73
  repo?: Repo;
73
- readStdin(): string;
74
+ readStdin(): Promise<string>;
74
75
  }>;
75
76
  export declare function invokeAkuma(command: ParsedAkumaCommand, input: InvokeInput): Promise<AkumaInvocationResult>;
76
- export declare function invokeAkumaStatus(path: WorldRoot, akuma: string, settings: Settings, alias?: string, repo?: Repo): AkumaInvocationResult;
77
+ export declare function invokeAkumaStatus(path: WorldRoot, akuma: string, settings: Settings, alias?: string, repo?: Repo): Promise<AkumaInvocationResult>;
77
78
  export {};
@@ -2,6 +2,9 @@ import { Keiyaku, } from "../../index.js";
2
2
  function inputAlias(selector) {
3
3
  return selector.startsWith("@") ? selector : undefined;
4
4
  }
5
+ async function promptBody(command, input) {
6
+ return command.prompt.kind === "stdin" ? await input.readStdin() : command.prompt.value;
7
+ }
5
8
  async function invokeWait(command, input) {
6
9
  const alias = command.akuma.length === 1 ? inputAlias(command.akuma[0]) : undefined;
7
10
  return {
@@ -19,7 +22,7 @@ async function invokeWait(command, input) {
19
22
  };
20
23
  }
21
24
  async function invokeTell(command, input) {
22
- const body = input.readStdin();
25
+ const body = await promptBody(command, input);
23
26
  if (command.interrupt) {
24
27
  const result = await Keiyaku.interrupt({ path: input.path, akuma: command.akuma, settings: input.settings, body, ...(input.repo === undefined ? {} : { repo: input.repo }) });
25
28
  const alias = inputAlias(command.akuma);
@@ -29,14 +32,15 @@ async function invokeTell(command, input) {
29
32
  const alias = inputAlias(command.akuma);
30
33
  return { kind: "akuma", action: "tell", mode: "ordinary", result, body, ...(alias === undefined ? {} : { alias }) };
31
34
  }
32
- function invokeHistory(command, input) {
33
- const result = Keiyaku.history({
35
+ async function invokeHistory(command, input) {
36
+ const result = await Keiyaku.history({
34
37
  path: input.path,
35
38
  akuma: command.akuma,
36
39
  settings: input.settings,
37
40
  ...(input.repo === undefined ? {} : { repo: input.repo }),
38
41
  ...(command.before === undefined ? {} : { before: command.before }),
39
42
  ...(command.since === undefined ? {} : { since: command.since }),
43
+ ...(command.limit === undefined ? {} : { limit: command.limit }),
40
44
  last: command.last,
41
45
  });
42
46
  return {
@@ -82,31 +86,32 @@ async function invokeKill(command, input) {
82
86
  export async function invokeAkuma(command, input) {
83
87
  switch (command.command) {
84
88
  case "call": {
89
+ const body = await promptBody(command, input);
85
90
  const result = await Keiyaku.call({
86
91
  path: input.path,
87
92
  archetype: command.archetype,
88
- body: input.readStdin(),
93
+ body,
89
94
  settings: input.settings,
90
- cwd: input.executionCwd,
95
+ ...(input.executionCwd === undefined ? {} : { cwd: input.executionCwd }),
91
96
  mode: command.mode,
92
97
  ...(command.timeoutMs === undefined ? {} : { timeoutMs: command.timeoutMs }),
93
98
  ...(input.contract === undefined ? {} : { contract: input.contract }),
94
99
  ...(command.alias === undefined ? {} : { alias: command.alias }),
95
100
  });
96
- return { kind: "akuma", action: "call", result };
101
+ return { kind: "akuma", action: "call", result, world: input.path };
97
102
  }
98
103
  case "wait": return await invokeWait(command, input);
99
104
  case "tell": return await invokeTell(command, input);
100
- case "history": return invokeHistory(command, input);
105
+ case "history": return await invokeHistory(command, input);
101
106
  case "fork": return await invokeFork(command, input);
102
107
  case "kill": return await invokeKill(command, input);
103
108
  }
104
109
  }
105
- export function invokeAkumaStatus(path, akuma, settings, alias, repo) {
110
+ export async function invokeAkumaStatus(path, akuma, settings, alias, repo) {
106
111
  return {
107
112
  kind: "akuma",
108
113
  action: "status",
109
- status: Keiyaku.status({ path, akuma, settings, ...(repo === undefined ? {} : { repo }) }),
114
+ status: await Keiyaku.status({ path, akuma, settings, ...(repo === undefined ? {} : { repo }) }),
110
115
  ...(alias === undefined ? {} : { alias }),
111
116
  };
112
117
  }
@@ -5,14 +5,23 @@ type Output = Readonly<{
5
5
  type Addressed = Readonly<{
6
6
  akuma: string;
7
7
  }>;
8
- export type ParsedAkumaCommand = Output & (Readonly<{
8
+ export type AkumaPromptSource = Readonly<{
9
+ kind: "argument";
10
+ value: string;
11
+ }> | Readonly<{
12
+ kind: "stdin";
13
+ }>;
14
+ type Prompted = Readonly<{
15
+ prompt: AkumaPromptSource;
16
+ }>;
17
+ export type ParsedAkumaCommand = Output & ((Readonly<{
9
18
  command: "call";
10
19
  archetype: string;
11
20
  contract?: string;
12
21
  alias?: AkumaAlias;
13
22
  mode: "wait" | "detach";
14
23
  timeoutMs?: number;
15
- }> | Readonly<{
24
+ }> & Prompted) | Readonly<{
16
25
  command: "kill";
17
26
  akuma: readonly string[];
18
27
  }> | Readonly<{
@@ -23,11 +32,12 @@ export type ParsedAkumaCommand = Output & (Readonly<{
23
32
  }> | (Readonly<{
24
33
  command: "tell";
25
34
  interrupt: boolean;
26
- }> & Addressed) | (Readonly<{
35
+ }> & Addressed & Prompted) | (Readonly<{
27
36
  command: "history";
28
37
  last: boolean;
29
38
  before?: number;
30
39
  since?: number;
40
+ limit?: number;
31
41
  }> & Addressed) | (Readonly<{
32
42
  command: "fork";
33
43
  at: string;
@@ -1,4 +1,4 @@
1
- import { CliUsageError, usageLine } from "../usage.js";
1
+ import { CliUsageError, isBlankInput, usageLine } from "../usage.js";
2
2
  import { archetypeName, parseAkuId } from "../../akuma/identity.js";
3
3
  import { parseDuration as decodeDuration } from "../../duration.js";
4
4
  import { parseAkumaAlias, parseAkumaGlob } from "../../identity/selector.js";
@@ -9,13 +9,19 @@ const AKUMA_COMMAND_SPECS = {
9
9
  flags: {
10
10
  contract: "value",
11
11
  alias: "value",
12
- wait: "boolean",
13
- timeout: "value",
12
+ wait: "value",
14
13
  detach: "boolean",
15
14
  json: "boolean",
16
15
  },
17
- usage: "call <akuma> [--contract <kei/...>] [--alias @name] [--wait [--timeout <duration>] | -d | --detach] [--json] -",
18
- purpose: "Call an Akuma from an Archetype and stdin body.",
16
+ usage: "call <akuma-name> [--contract <kei/...>] [--alias @name] [--wait <duration> | -d | --detach] [--json] (<prompt> | -)",
17
+ purpose: "Birth an Akuma from <akuma-name> with one prompt.",
18
+ details: [
19
+ "Give <prompt> as one argument, or use final - to read stdin.",
20
+ "Default: --wait 5m. An explicit --wait replaces that duration; -d and --detach return after birth.",
21
+ "--contract dispatches the born Akuma to that Contract.",
22
+ "--alias assigns the world-local @name selector to the born Akuma.",
23
+ "With --contract, Dispatch succeeds first. If @name exists, the alias then moves.",
24
+ ].join("\n"),
19
25
  },
20
26
  wait: {
21
27
  arity: "one-or-more",
@@ -28,14 +34,18 @@ const AKUMA_COMMAND_SPECS = {
28
34
  arity: 1,
29
35
  stdin: true,
30
36
  flags: { interrupt: "boolean", json: "boolean" },
31
- usage: "tell <aku/...> [--interrupt] [--json] -",
32
- purpose: "Record and wake one Akuma, optionally putting down its current Body first.",
37
+ usage: "tell <aku/...|@alias> [--interrupt] [--json] (<prompt> | -)",
38
+ purpose: "Send one prompt to an existing Akuma and wake it.",
39
+ details: [
40
+ "Give <prompt> as one argument, or use final - to read stdin.",
41
+ "--interrupt ends the current Body before recording the prompt and waking its successor.",
42
+ ].join("\n"),
33
43
  },
34
44
  history: {
35
45
  arity: 1,
36
46
  stdin: false,
37
- flags: { before: "value", since: "value", last: "boolean", json: "boolean" },
38
- usage: "history <aku/...> [--before <index> | --since <index> | --last] [--json]",
47
+ flags: { before: "value", since: "value", limit: "value", last: "boolean", json: "boolean" },
48
+ usage: "history <aku/...> [--before <index> | --since <index>] [--limit <count>] [--last] [--json]",
39
49
  purpose: "Read the persistent execution history or the last answer.",
40
50
  },
41
51
  fork: {
@@ -64,7 +74,7 @@ export function renderAkumaRootRows() {
64
74
  }
65
75
  export function renderAkumaHelp(action) {
66
76
  const spec = AKUMA_COMMAND_SPECS[action];
67
- return `${spec.purpose}\n\n${usageLine(spec.usage)}`;
77
+ return `${spec.purpose}\n\n${usageLine(spec.usage)}${spec.details === undefined ? "" : `\n\n${spec.details}`}`;
68
78
  }
69
79
  export function renderAkumaUsage(action) {
70
80
  return usageLine(AKUMA_COMMAND_SPECS[action].usage);
@@ -84,14 +94,14 @@ function stringFlag(value, diagnostic, fail) {
84
94
  fail(diagnostic);
85
95
  return value;
86
96
  }
87
- function parseDuration(raw, fail) {
97
+ function parseDuration(raw, option, fail) {
88
98
  if (typeof raw !== "string")
89
- fail("--timeout requires an integer duration with unit ms, s, m, or h");
99
+ fail(`${option} requires an integer duration with unit ms, s, m, or h`);
90
100
  const duration = decodeDuration(raw);
91
101
  if (duration.kind === "invalid")
92
- fail("--timeout requires an integer duration with unit ms, s, m, or h");
102
+ fail(`${option} requires an integer duration with unit ms, s, m, or h`);
93
103
  if (duration.kind === "overflow")
94
- fail("--timeout duration exceeds the safe millisecond range");
104
+ fail(`${option} duration exceeds the safe millisecond range`);
95
105
  return duration.milliseconds;
96
106
  }
97
107
  function scanAkuma(action, argv, fail) {
@@ -113,8 +123,11 @@ function scanAkuma(action, argv, fail) {
113
123
  fail("duplicate option: --detach");
114
124
  flags.detach = true;
115
125
  }
116
- else if (!token.startsWith("--"))
126
+ else if (!token.startsWith("--")) {
127
+ if (isBlankInput(token))
128
+ fail(`${action} requires a nonblank value`);
117
129
  positionals.push(token);
130
+ }
118
131
  else {
119
132
  const name = token.slice(2);
120
133
  const kind = spec.flags[name];
@@ -129,6 +142,8 @@ function scanAkuma(action, argv, fail) {
129
142
  if (value === undefined || value === "-" || value === "-d" || value.startsWith("--")) {
130
143
  fail(`${token} requires a value`);
131
144
  }
145
+ if (isBlankInput(value))
146
+ fail(`${token} requires a nonblank value`);
132
147
  flags[name] = value;
133
148
  index += 1;
134
149
  }
@@ -181,42 +196,57 @@ function parseWait(rawSelectors, flags, output, fail) {
181
196
  command: "wait",
182
197
  akuma: rawSelectors.map((value) => validateSet(value, fail)),
183
198
  ...(completion === undefined ? {} : { completion }),
184
- ...(flags.timeout === undefined ? {} : { timeoutMs: parseDuration(flags.timeout, fail) }),
199
+ ...(flags.timeout === undefined ? {} : { timeoutMs: parseDuration(flags.timeout, "--timeout", fail) }),
185
200
  output,
186
201
  };
187
202
  }
188
203
  function parseHistory(akuma, flags, output, fail) {
189
204
  if (flags.before !== undefined && flags.since !== undefined)
190
205
  fail("history --before and --since are mutually exclusive");
191
- if (flags.last === true && (flags.before !== undefined || flags.since !== undefined)) {
192
- fail("history --last cannot be combined with --before or --since");
206
+ if (flags.last === true && (flags.before !== undefined || flags.since !== undefined || flags.limit !== undefined)) {
207
+ fail("history --last cannot be combined with --before, --since, or --limit");
193
208
  }
209
+ const limit = flags.limit === undefined ? undefined : positiveIndex(flags.limit, "--limit", fail);
210
+ if (limit !== undefined && limit > 5_000)
211
+ fail("--limit must be no greater than 5000");
194
212
  return {
195
213
  command: "history",
196
214
  akuma,
197
215
  last: flags.last === true,
198
216
  ...(flags.before === undefined ? {} : { before: positiveIndex(flags.before, "--before", fail) }),
199
217
  ...(flags.since === undefined ? {} : { since: positiveIndex(flags.since, "--since", fail) }),
218
+ ...(limit === undefined ? {} : { limit }),
200
219
  output,
201
220
  };
202
221
  }
203
222
  function parseAddressed(action, rawSelectors, flags, output, fail) {
204
223
  if (action === "kill")
205
224
  return { command: action, akuma: rawSelectors.map((value) => validateSet(value, fail)), output };
206
- if (action === "tell") {
207
- return { command: action, akuma: validateDirect(rawSelectors[0], fail), interrupt: flags.interrupt === true, output };
208
- }
209
225
  if (action === "wait")
210
226
  return parseWait(rawSelectors, flags, output, fail);
211
227
  const akuma = validateDirect(rawSelectors[0], fail);
212
228
  if (action === "history")
213
229
  return parseHistory(akuma, flags, output, fail);
214
230
  const at = stringFlag(flags.at, "fork requires --at <historyId>", fail);
215
- if (at.trim().length === 0)
216
- fail("fork requires --at <historyId>");
217
231
  return { command: action, akuma, at, output };
218
232
  }
219
- function parseCall(flags, positionals, output, fail) {
233
+ function parsePrompted(action, positionals, stdin, fail) {
234
+ if (positionals.length < 1 || positionals.length > 2)
235
+ fail(`${action} has invalid positional arguments`);
236
+ const argument = positionals[1];
237
+ if (stdin && argument !== undefined)
238
+ fail(`${action} accepts either a prompt argument or stdin, not both`);
239
+ if (!stdin && argument === undefined)
240
+ fail(`${action} requires a prompt argument or stdin`);
241
+ return {
242
+ subject: positionals[0],
243
+ prompt: stdin ? { kind: "stdin" } : { kind: "argument", value: argument },
244
+ };
245
+ }
246
+ function parseTell(flags, subject, prompt, output, fail) {
247
+ return { command: "tell", akuma: validateDirect(subject, fail), interrupt: flags.interrupt === true, prompt, output };
248
+ }
249
+ function parseCall(flags, archetype, prompt, output, fail) {
220
250
  let alias;
221
251
  if (flags.alias !== undefined) {
222
252
  try {
@@ -226,19 +256,18 @@ function parseCall(flags, positionals, output, fail) {
226
256
  fail(error instanceof Error ? error.message : "invalid Akuma alias");
227
257
  }
228
258
  }
229
- if (flags.detach === true && flags.wait === true)
259
+ if (flags.detach === true && flags.wait !== undefined)
230
260
  fail("call --wait and --detach are mutually exclusive");
231
- if (flags.detach === true && flags.timeout !== undefined)
232
- fail("call --timeout and --detach are mutually exclusive");
233
261
  const mode = flags.detach === true ? "detach" : "wait";
234
- const timeoutMs = flags.timeout === undefined ? undefined : parseDuration(flags.timeout, fail);
262
+ const timeoutMs = flags.wait === undefined ? undefined : parseDuration(flags.wait, "--wait", fail);
235
263
  return {
236
264
  command: "call",
237
- archetype: positionals[0],
265
+ archetype,
238
266
  ...(typeof flags.contract === "string" ? { contract: flags.contract } : {}),
239
267
  ...(alias === undefined ? {} : { alias }),
240
268
  mode,
241
269
  ...(timeoutMs === undefined ? {} : { timeoutMs }),
270
+ prompt,
242
271
  output,
243
272
  };
244
273
  }
@@ -250,13 +279,17 @@ export function parseAkumaCommand(argv) {
250
279
  const spec = AKUMA_COMMAND_SPECS[action];
251
280
  const fail = (message) => { throw new CliUsageError(message, renderAkumaUsage(action)); };
252
281
  const { flags, positionals, stdin } = scanAkuma(action, argv, fail);
282
+ const output = flags.json === true ? "json" : "text";
283
+ if (action === "call" || action === "tell") {
284
+ const parsed = parsePrompted(action, positionals, stdin, fail);
285
+ return action === "call"
286
+ ? parseCall(flags, parsed.subject, parsed.prompt, output, fail)
287
+ : parseTell(flags, parsed.subject, parsed.prompt, output, fail);
288
+ }
253
289
  if (spec.arity === "one-or-more" ? positionals.length === 0 : positionals.length !== spec.arity) {
254
290
  fail(`${action} has invalid positional arguments`);
255
291
  }
256
- if (stdin !== spec.stdin)
257
- fail(`${action} ${spec.stdin ? "requires" : "reads no"} stdin`);
258
- const output = flags.json === true ? "json" : "text";
259
- if (action === "call")
260
- return parseCall(flags, positionals, output, fail);
292
+ if (stdin)
293
+ fail(`${action} reads no stdin`);
261
294
  return parseAddressed(action, positionals, flags, output, fail);
262
295
  }
@@ -6,6 +6,7 @@ export type ContractCommandSpec = Readonly<{
6
6
  usage: string;
7
7
  purpose: string;
8
8
  }>;
9
+ export declare const AMEND_MINIMAL_STDIN_HELP: string;
9
10
  export declare const CONTRACT_COMMAND_SPECS: {
10
11
  readonly bind: {
11
12
  readonly positional: "none";
@@ -57,7 +58,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
57
58
  readonly summary: "value";
58
59
  readonly json: "boolean";
59
60
  };
60
- readonly usage: "review [<contract>|@<contract>] (--satisfied | --unsatisfied) [--summary <text>] [--actor <actor>] [--json] [-]";
61
+ readonly usage: "review [<contract>|@<contract>] (--satisfied | --unsatisfied) (--summary <text> | -) [--actor <actor>] [--json]";
61
62
  readonly purpose: "Record one review verdict.";
62
63
  };
63
64
  readonly arc: {
@@ -105,19 +106,20 @@ export declare const CONTRACT_COMMAND_SPECS: {
105
106
  readonly flags: {
106
107
  readonly json: "boolean";
107
108
  };
108
- readonly usage: "ls task/ [--json]\n keiyaku ls kei/ [--json]\n keiyaku ls aku/ [--json]\n keiyaku ls aku/<archetype>/ [--json]\n keiyaku ls aku/*/* [--json]";
109
+ readonly usage: "ls task/ [--json]\n keiyaku ls kei/ [--json]\n keiyaku ls aku/ [--json]\n keiyaku ls aku/<akuma>/ [--json]\n keiyaku ls \"aku/*/*\" [--json]";
109
110
  readonly purpose: "List one identity directory.";
110
111
  };
111
112
  readonly audit: {
112
113
  readonly positional: "optional";
113
114
  readonly stdin: "none";
114
115
  readonly flags: {
115
- readonly "show-diff-body": "boolean";
116
+ readonly "include-dirty": "boolean";
117
+ readonly diff: "boolean";
116
118
  readonly actor: "value";
117
119
  readonly json: "boolean";
118
120
  };
119
- readonly usage: "audit [<contract>|@<contract>] [--show-diff-body] [--actor <actor>] [--json]";
120
- readonly purpose: "Audit one Contract without mutation.";
121
+ readonly usage: "audit [<contract>|@<contract>] [--include-dirty] [--diff] [--actor <actor>] [--json]";
122
+ readonly purpose: "Ask what candidate preparation, Verification, and target placement would do.";
121
123
  };
122
124
  readonly reconcile: {
123
125
  readonly positional: "optional";
@@ -138,5 +140,16 @@ export declare const CONTRACT_COMMAND_SPECS: {
138
140
  readonly usage: "settings [--json]";
139
141
  readonly purpose: "Read user and project Settings resources.";
140
142
  };
143
+ readonly region: {
144
+ readonly positional: "optional";
145
+ readonly stdin: "none";
146
+ readonly flags: {
147
+ readonly overlap: "boolean";
148
+ readonly path: "value";
149
+ readonly json: "boolean";
150
+ };
151
+ readonly usage: "region [<contract>] [--overlap] [--json]\n region --path <repo-relative-path> [--json]";
152
+ readonly purpose: "Read active declared Contract Regions.";
153
+ };
141
154
  };
142
155
  export type ContractCommand = keyof typeof CONTRACT_COMMAND_SPECS;
@@ -1,14 +1,20 @@
1
+ export const AMEND_MINIMAL_STDIN_HELP = [
2
+ "minimal stdin:",
3
+ " ## Replace: Design",
4
+ " <complete replacement>",
5
+ ].join("\n");
1
6
  export const CONTRACT_COMMAND_SPECS = {
2
7
  bind: { positional: "none", stdin: "required", flags: { actor: "value", task: "value", target: "value", here: "boolean", after: "repeat-value", gates: "value", json: "boolean" }, usage: "bind [--task <task/...>] [--target <ref>] [--here] [--after <kei/...> ...] [--gates <name>] [--actor <actor>] [--json] -", purpose: "Create one Contract from stdin Markdown." },
3
8
  amend: { positional: "optional", stdin: "required", flags: { actor: "value", after: "repeat-value", "clear-after": "boolean", gates: "value", json: "boolean" }, usage: "amend [<contract>|@<contract>] [--after <kei/...> ... | --clear-after] [--gates <name>] [--actor <actor>] [--json] -", purpose: "Apply stdin amendment operations to one Contract." },
4
9
  deliver: { positional: "optional", stdin: "none", flags: { actor: "value", message: "value", "include-dirty": "boolean", json: "boolean" }, usage: "deliver [<contract>|@<contract>] [--message <text>] [--include-dirty] [--actor <actor>] [--json]", purpose: "Deliver one Contract candidate." },
5
- review: { positional: "optional", stdin: "optional", flags: { actor: "value", satisfied: "boolean", unsatisfied: "boolean", summary: "value", json: "boolean" }, usage: "review [<contract>|@<contract>] (--satisfied | --unsatisfied) [--summary <text>] [--actor <actor>] [--json] [-]", purpose: "Record one review verdict." },
10
+ review: { positional: "optional", stdin: "optional", flags: { actor: "value", satisfied: "boolean", unsatisfied: "boolean", summary: "value", json: "boolean" }, usage: "review [<contract>|@<contract>] (--satisfied | --unsatisfied) (--summary <text> | -) [--actor <actor>] [--json]", purpose: "Record one review verdict." },
6
11
  arc: { positional: "optional", stdin: "required", flags: { actor: "value", json: "boolean" }, usage: "arc [<contract>|@<contract>] [--actor <actor>] [--json] -", purpose: "Record stdin arc Markdown for one Contract." },
7
12
  abandon: { positional: "optional", stdin: "none", flags: { actor: "value", note: "value", json: "boolean" }, usage: "abandon [<contract>|@<contract>] [--note <text>] [--actor <actor>] [--json]", purpose: "Abandon one Contract with an optional note." },
8
13
  status: { positional: "optional", stdin: "none", flags: { json: "boolean" }, usage: "status [<contract>|@name|<aku/...>] [--json]", purpose: "Read the world status board or one Contract projection." },
9
14
  show: { positional: "optional", stdin: "none", flags: { json: "boolean" }, usage: "show [<contract>|@<contract>] [--json]", purpose: "Read one Contract guidance projection." },
10
- ls: { positional: "optional", stdin: "none", flags: { json: "boolean" }, usage: "ls task/ [--json]\n keiyaku ls kei/ [--json]\n keiyaku ls aku/ [--json]\n keiyaku ls aku/<archetype>/ [--json]\n keiyaku ls aku/*/* [--json]", purpose: "List one identity directory." },
11
- audit: { positional: "optional", stdin: "none", flags: { "show-diff-body": "boolean", actor: "value", json: "boolean" }, usage: "audit [<contract>|@<contract>] [--show-diff-body] [--actor <actor>] [--json]", purpose: "Audit one Contract without mutation." },
15
+ ls: { positional: "optional", stdin: "none", flags: { json: "boolean" }, usage: "ls task/ [--json]\n keiyaku ls kei/ [--json]\n keiyaku ls aku/ [--json]\n keiyaku ls aku/<akuma>/ [--json]\n keiyaku ls \"aku/*/*\" [--json]", purpose: "List one identity directory." },
16
+ audit: { positional: "optional", stdin: "none", flags: { "include-dirty": "boolean", diff: "boolean", actor: "value", json: "boolean" }, usage: "audit [<contract>|@<contract>] [--include-dirty] [--diff] [--actor <actor>] [--json]", purpose: "Ask what candidate preparation, Verification, and target placement would do." },
12
17
  reconcile: { positional: "optional", stdin: "none", flags: { "retry-hooks": "boolean", json: "boolean" }, usage: "reconcile [<contract>|@<contract>] [--retry-hooks] [--json]", purpose: "Reconcile one Contract or the invocation world." },
13
18
  settings: { positional: "none", stdin: "none", flags: { json: "boolean" }, usage: "settings [--json]", purpose: "Read user and project Settings resources." },
19
+ region: { positional: "optional", stdin: "none", flags: { overlap: "boolean", path: "value", json: "boolean" }, usage: "region [<contract>] [--overlap] [--json]\n region --path <repo-relative-path> [--json]", purpose: "Read active declared Contract Regions." },
14
20
  };
@@ -1,11 +1,24 @@
1
- import { type BlockedTaskList, type TaskBatchResult, type TaskCompositionResult, type TaskDependencyTree, type TaskDetail, type TaskDoctorReport, type TaskList, type TaskMutationResult, type TaskNamespaceResult, type TaskUpdateResult } from "../../task/index.js";
1
+ import { type BlockedTaskList, type TaskBatchResult, type TaskCompositionResult, type TaskDecompositionTree, type TaskDetail, type TaskDoctorReport, type TaskList, type TaskMutationResult, type TaskNamespaceResult, type TaskQueryResult, type TaskUpdateResult } from "../../task/index.js";
2
2
  import type { ParsedTaskCommand } from "./task.js";
3
3
  import type { WorldRoot } from "../../world.js";
4
- export type TaskInvocationResult = TaskMutationResult | TaskUpdateResult | TaskBatchResult | TaskCompositionResult | TaskDetail | TaskList | BlockedTaskList | TaskDependencyTree | TaskDoctorReport | TaskNamespaceResult;
4
+ export type TaskInvocationResult = TaskMutationResult | TaskUpdateResult | TaskBatchResult | TaskCompositionResult | TaskDetail | TaskList | BlockedTaskList | TaskQueryResult | TaskDecompositionTree | TaskDoctorReport | TaskNamespaceResult | TaskWorldObservation;
5
+ type TaskWorldRead = TaskList | BlockedTaskList | TaskQueryResult | TaskDoctorReport;
6
+ export type TaskWorldObservation = Readonly<{
7
+ kind: "present";
8
+ value: TaskWorldRead;
9
+ }> | Readonly<{
10
+ kind: "absent";
11
+ }> | Readonly<{
12
+ kind: "failed";
13
+ failure: Readonly<{
14
+ message: string;
15
+ }>;
16
+ }>;
5
17
  type TaskInput = Readonly<{
6
18
  world: WorldRoot | null;
7
- establish(): WorldRoot;
8
- readStdin(): string;
19
+ establish(): Promise<WorldRoot>;
20
+ readStdin(): Promise<string>;
21
+ actor?: string;
9
22
  }>;
10
23
  export declare function invokeTask(command: ParsedTaskCommand, input: TaskInput): Promise<TaskInvocationResult>;
11
24
  export {};