@astrosheep/keiyaku 4.6.4 → 4.6.6

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 (191) hide show
  1. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +43 -8
  2. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +7 -8
  3. package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +3 -3
  4. package/build/src/akuma/akuma-observe.d.ts +18 -15
  5. package/build/src/akuma/akuma-observe.js +75 -16
  6. package/build/src/akuma/akuma-wait.d.ts +4 -3
  7. package/build/src/akuma/akuma-wait.js +75 -53
  8. package/build/src/akuma/akuma.d.ts +6 -4
  9. package/build/src/akuma/akuma.js +4 -0
  10. package/build/src/akuma/call-initial-tell.d.ts +2 -2
  11. package/build/src/akuma/call-initial-tell.js +1 -1
  12. package/build/src/akuma/call-request.d.ts +2 -2
  13. package/build/src/akuma/heart/index.d.ts +7 -2
  14. package/build/src/akuma/heart/index.js +50 -5
  15. package/build/src/akuma/heart/tells.d.ts +33 -2
  16. package/build/src/akuma/heart/tells.js +24 -18
  17. package/build/src/akuma/heart/timeline.d.ts +23 -1
  18. package/build/src/akuma/heart/timeline.js +28 -21
  19. package/build/src/akuma/projection.d.ts +10 -10
  20. package/build/src/akuma/providers/pi/index.js +72 -39
  21. package/build/src/akuma/selection-observation.d.ts +20 -20
  22. package/build/src/akuma-body.js +1 -0
  23. package/build/src/alias/index.d.ts +0 -1
  24. package/build/src/alias/index.js +0 -4
  25. package/build/src/body/amend.d.ts +0 -4
  26. package/build/src/body/amend.js +0 -3
  27. package/build/src/body/region.d.ts +0 -1
  28. package/build/src/body/region.js +0 -3
  29. package/build/src/body/verification.d.ts +0 -1
  30. package/build/src/cli/commands/akuma-grammar.js +23 -66
  31. package/build/src/cli/commands/akuma.js +17 -30
  32. package/build/src/cli/commands/contract-grammar.d.ts +14 -1
  33. package/build/src/cli/commands/contract-grammar.js +54 -21
  34. package/build/src/cli/commands/contract-help.d.ts +9 -8
  35. package/build/src/cli/commands/contract-help.js +14 -7
  36. package/build/src/cli/commands/contract.js +57 -117
  37. package/build/src/cli/commands/install.d.ts +5 -5
  38. package/build/src/cli/commands/install.js +1 -4
  39. package/build/src/cli/commands/task-grammar.js +10 -66
  40. package/build/src/cli/commands/task.d.ts +0 -1
  41. package/build/src/cli/commands/task.js +34 -53
  42. package/build/src/cli/coordinates.d.ts +1 -2
  43. package/build/src/cli/coordinates.js +1 -4
  44. package/build/src/cli/parse.d.ts +2 -3
  45. package/build/src/cli/parse.js +24 -66
  46. package/build/src/cli/render/akuma.d.ts +3 -16
  47. package/build/src/cli/render/akuma.js +1 -13
  48. package/build/src/cli/render/audit.js +1 -1
  49. package/build/src/cli/render/contract.js +34 -32
  50. package/build/src/cli/render/kanshi-akuma.d.ts +8 -2
  51. package/build/src/cli/render/kanshi-akuma.js +14 -7
  52. package/build/src/cli/render/kanshi.d.ts +3 -1
  53. package/build/src/cli/render/kanshi.js +44 -32
  54. package/build/src/cli/render/receipt.js +6 -1
  55. package/build/src/cli/render/task.d.ts +1 -1
  56. package/build/src/cli/render/task.js +3 -27
  57. package/build/src/cli/render/terminal.d.ts +6 -2
  58. package/build/src/cli/render/terminal.js +8 -2
  59. package/build/src/cli/runtime.js +3 -16
  60. package/build/src/cli/scan.d.ts +26 -0
  61. package/build/src/cli/scan.js +82 -0
  62. package/build/src/cli/streams.d.ts +5 -0
  63. package/build/src/cli/streams.js +11 -0
  64. package/build/src/contract-worktree.js +38 -21
  65. package/build/src/core/facts/codec.d.ts +1 -2
  66. package/build/src/core/facts/codec.js +5 -11
  67. package/build/src/core/facts/types.d.ts +16 -2
  68. package/build/src/core/facts/types.js +15 -0
  69. package/build/src/core/verbs/abandon.js +3 -9
  70. package/build/src/core/verbs/amend.js +2 -9
  71. package/build/src/core/verbs/arc.js +6 -13
  72. package/build/src/core/verbs/attestation.js +2 -9
  73. package/build/src/core/verbs/bind.js +2 -9
  74. package/build/src/core/verbs/deliver.js +2 -9
  75. package/build/src/core/verbs/placement.d.ts +1 -1
  76. package/build/src/core/verbs/placement.js +2 -9
  77. package/build/src/core/verbs/reintegrate.d.ts +1 -1
  78. package/build/src/core/verbs/reintegrate.js +2 -9
  79. package/build/src/dispatch/index.d.ts +2 -2
  80. package/build/src/dispatch/index.js +33 -11
  81. package/build/src/git/hooks.d.ts +2 -4
  82. package/build/src/git/hooks.js +0 -12
  83. package/build/src/git/integration.d.ts +5 -3
  84. package/build/src/git/integration.js +36 -25
  85. package/build/src/git/nuke.js +4 -4
  86. package/build/src/git/observe.d.ts +4 -4
  87. package/build/src/git/observe.js +5 -5
  88. package/build/src/git/process.d.ts +1 -4
  89. package/build/src/git/process.js +1 -11
  90. package/build/src/git/read-observation.js +1 -1
  91. package/build/src/git/reconcile.d.ts +1 -1
  92. package/build/src/git/reconcile.js +15 -13
  93. package/build/src/git/repository.d.ts +2 -6
  94. package/build/src/git/repository.js +18 -31
  95. package/build/src/git/scratch.d.ts +6 -6
  96. package/build/src/git/scratch.js +110 -46
  97. package/build/src/git/target-placement.d.ts +5 -5
  98. package/build/src/git/target-placement.js +18 -33
  99. package/build/src/git/tender.d.ts +6 -2
  100. package/build/src/git/tender.js +19 -12
  101. package/build/src/git/terminal-reconcile.js +24 -13
  102. package/build/src/git/terminal-seal.d.ts +2 -5
  103. package/build/src/git/terminal-seal.js +5 -3
  104. package/build/src/git/workspace.d.ts +17 -13
  105. package/build/src/git/workspace.js +58 -41
  106. package/build/src/kanshi/index.d.ts +2 -2
  107. package/build/src/kanshi/index.js +1 -1
  108. package/build/src/kanshi/read.d.ts +8 -1
  109. package/build/src/kanshi/read.js +72 -7
  110. package/build/src/kanshi/report.d.ts +12 -0
  111. package/build/src/library/akuma-creation.d.ts +4 -4
  112. package/build/src/library/bind.d.ts +1 -63
  113. package/build/src/library/bind.js +3 -9
  114. package/build/src/library/contract-creation.js +2 -30
  115. package/build/src/library/contract-execution.d.ts +0 -1
  116. package/build/src/library/contract-execution.js +9 -34
  117. package/build/src/library/contract-operations.d.ts +5 -1
  118. package/build/src/library/contract-operations.js +7 -3
  119. package/build/src/library/contract-types.d.ts +1 -1
  120. package/build/src/library/delivery.d.ts +91 -93
  121. package/build/src/library/delivery.js +2 -1
  122. package/build/src/library/input.d.ts +0 -2
  123. package/build/src/library/input.js +0 -4
  124. package/build/src/library/invocation.d.ts +0 -1
  125. package/build/src/library/invocation.js +3 -25
  126. package/build/src/library/outcome.d.ts +651 -602
  127. package/build/src/library/outcome.js +4 -4
  128. package/build/src/library/reconcile.d.ts +6 -0
  129. package/build/src/library/reconcile.js +31 -1
  130. package/build/src/library/repo.d.ts +0 -1
  131. package/build/src/library/selection.d.ts +1 -10
  132. package/build/src/library/selection.js +14 -15
  133. package/build/src/protocol/abandon.d.ts +1 -1
  134. package/build/src/protocol/abandon.js +3 -10
  135. package/build/src/protocol/amend.js +2 -5
  136. package/build/src/protocol/arc.d.ts +1 -1
  137. package/build/src/protocol/arc.js +2 -9
  138. package/build/src/protocol/attempt.d.ts +3 -20
  139. package/build/src/protocol/attempt.js +6 -5
  140. package/build/src/protocol/audit.d.ts +1 -0
  141. package/build/src/protocol/audit.js +10 -11
  142. package/build/src/protocol/completion.d.ts +129 -55
  143. package/build/src/protocol/completion.js +62 -73
  144. package/build/src/protocol/deliver.d.ts +7 -5
  145. package/build/src/protocol/deliver.js +74 -44
  146. package/build/src/protocol/execution-observation.d.ts +2 -4
  147. package/build/src/protocol/execution-observation.js +3 -7
  148. package/build/src/protocol/intent.d.ts +1 -1
  149. package/build/src/protocol/intent.js +1 -0
  150. package/build/src/protocol/operations.d.ts +24 -12
  151. package/build/src/protocol/operations.js +36 -15
  152. package/build/src/protocol/placement.d.ts +2 -1
  153. package/build/src/protocol/placement.js +21 -5
  154. package/build/src/protocol/progress.d.ts +1 -1
  155. package/build/src/protocol/read/status.js +58 -41
  156. package/build/src/protocol/reintegrate.d.ts +1 -1
  157. package/build/src/protocol/reintegrate.js +10 -19
  158. package/build/src/protocol/review.d.ts +3 -28
  159. package/build/src/protocol/review.js +10 -37
  160. package/build/src/protocol/run.d.ts +19 -7
  161. package/build/src/protocol/run.js +19 -9
  162. package/build/src/runtime/proc/windows-launch.exe +0 -0
  163. package/build/src/settlement/holder.d.ts +2 -4
  164. package/build/src/settlement/holder.js +3 -6
  165. package/build/src/task/board.d.ts +6 -0
  166. package/build/src/task/board.js +30 -1
  167. package/build/src/task/catalog.js +1 -4
  168. package/build/src/task/compose.d.ts +0 -1
  169. package/build/src/task/compose.js +0 -1
  170. package/build/src/task/context.d.ts +0 -1
  171. package/build/src/task/context.js +0 -3
  172. package/build/src/task/created-observation.d.ts +5 -1
  173. package/build/src/task/created-observation.js +12 -5
  174. package/build/src/task/index.d.ts +1 -1
  175. package/build/src/task/index.js +7 -6
  176. package/build/src/task/input.d.ts +0 -6
  177. package/build/src/task/input.js +2 -14
  178. package/build/src/task/mutation.d.ts +3 -4
  179. package/build/src/task/mutation.js +11 -39
  180. package/build/src/task/operations.d.ts +2 -7
  181. package/build/src/task/operations.js +37 -49
  182. package/build/src/task/query.d.ts +0 -1
  183. package/build/src/task/query.js +1 -4
  184. package/build/src/task/store.d.ts +0 -2
  185. package/build/src/task/store.js +27 -11
  186. package/build/src/verification/declaration.js +3 -2
  187. package/build/src/verification/execution.d.ts +3 -2
  188. package/build/src/verification/execution.js +10 -6
  189. package/build/src/workspace-place.d.ts +0 -1
  190. package/build/src/workspace-place.js +0 -11
  191. package/package.json +7 -3
@@ -125,8 +125,8 @@ declare const akumaObservationSchema: z.ZodObject<{
125
125
  }>;
126
126
  turnSequence: z.ZodNumber;
127
127
  receipt: z.ZodOptional<z.ZodEnum<{
128
- required: "required";
129
128
  unavailable: "unavailable";
129
+ required: "required";
130
130
  }>>;
131
131
  }, z.core.$strict>, z.ZodTransform<Readonly<{
132
132
  turnSequence: number;
@@ -137,7 +137,7 @@ declare const akumaObservationSchema: z.ZodObject<{
137
137
  deliveredAt: string;
138
138
  route: "live" | "launch";
139
139
  turnSequence: number;
140
- receipt?: "required" | "unavailable" | undefined;
140
+ receipt?: "unavailable" | "required" | undefined;
141
141
  }>>>>;
142
142
  }, z.core.$strict>]>, z.ZodObject<{
143
143
  kind: z.ZodLiteral<"tool">;
@@ -332,8 +332,8 @@ declare const akumaObservationSchema: z.ZodObject<{
332
332
  }>;
333
333
  turnSequence: z.ZodNumber;
334
334
  receipt: z.ZodOptional<z.ZodEnum<{
335
- required: "required";
336
335
  unavailable: "unavailable";
336
+ required: "required";
337
337
  }>>;
338
338
  }, z.core.$strict>, z.ZodTransform<Readonly<{
339
339
  turnSequence: number;
@@ -344,7 +344,7 @@ declare const akumaObservationSchema: z.ZodObject<{
344
344
  deliveredAt: string;
345
345
  route: "live" | "launch";
346
346
  turnSequence: number;
347
- receipt?: "required" | "unavailable" | undefined;
347
+ receipt?: "unavailable" | "required" | undefined;
348
348
  }>>>>;
349
349
  }, z.core.$strict>]>, z.ZodObject<{
350
350
  kind: z.ZodLiteral<"tool">;
@@ -589,8 +589,8 @@ declare const akumaWaitResultSchema: z.ZodObject<{
589
589
  }>;
590
590
  turnSequence: z.ZodNumber;
591
591
  receipt: z.ZodOptional<z.ZodEnum<{
592
- required: "required";
593
592
  unavailable: "unavailable";
593
+ required: "required";
594
594
  }>>;
595
595
  }, z.core.$strict>, z.ZodTransform<Readonly<{
596
596
  turnSequence: number;
@@ -601,7 +601,7 @@ declare const akumaWaitResultSchema: z.ZodObject<{
601
601
  deliveredAt: string;
602
602
  route: "live" | "launch";
603
603
  turnSequence: number;
604
- receipt?: "required" | "unavailable" | undefined;
604
+ receipt?: "unavailable" | "required" | undefined;
605
605
  }>>>>;
606
606
  }, z.core.$strict>]>, z.ZodObject<{
607
607
  kind: z.ZodLiteral<"tool">;
@@ -796,8 +796,8 @@ declare const akumaWaitResultSchema: z.ZodObject<{
796
796
  }>;
797
797
  turnSequence: z.ZodNumber;
798
798
  receipt: z.ZodOptional<z.ZodEnum<{
799
- required: "required";
800
799
  unavailable: "unavailable";
800
+ required: "required";
801
801
  }>>;
802
802
  }, z.core.$strict>, z.ZodTransform<Readonly<{
803
803
  turnSequence: number;
@@ -808,7 +808,7 @@ declare const akumaWaitResultSchema: z.ZodObject<{
808
808
  deliveredAt: string;
809
809
  route: "live" | "launch";
810
810
  turnSequence: number;
811
- receipt?: "required" | "unavailable" | undefined;
811
+ receipt?: "unavailable" | "required" | undefined;
812
812
  }>>>>;
813
813
  }, z.core.$strict>]>, z.ZodObject<{
814
814
  kind: z.ZodLiteral<"tool">;
@@ -958,8 +958,8 @@ declare const akumaTellResultSchema: z.ZodObject<{
958
958
  }>;
959
959
  turnSequence: z.ZodNumber;
960
960
  receipt: z.ZodOptional<z.ZodEnum<{
961
- required: "required";
962
961
  unavailable: "unavailable";
962
+ required: "required";
963
963
  }>>;
964
964
  }, z.core.$strict>, z.ZodTransform<Readonly<{
965
965
  turnSequence: number;
@@ -970,7 +970,7 @@ declare const akumaTellResultSchema: z.ZodObject<{
970
970
  deliveredAt: string;
971
971
  route: "live" | "launch";
972
972
  turnSequence: number;
973
- receipt?: "required" | "unavailable" | undefined;
973
+ receipt?: "unavailable" | "required" | undefined;
974
974
  }>>>>;
975
975
  }, z.core.$strict>;
976
976
  wake: z.ZodUnion<readonly [z.ZodObject<{
@@ -1062,8 +1062,8 @@ declare const akumaAskResultSchema: z.ZodObject<{
1062
1062
  }>;
1063
1063
  turnSequence: z.ZodNumber;
1064
1064
  receipt: z.ZodOptional<z.ZodEnum<{
1065
- required: "required";
1066
1065
  unavailable: "unavailable";
1066
+ required: "required";
1067
1067
  }>>;
1068
1068
  }, z.core.$strict>, z.ZodTransform<Readonly<{
1069
1069
  turnSequence: number;
@@ -1074,7 +1074,7 @@ declare const akumaAskResultSchema: z.ZodObject<{
1074
1074
  deliveredAt: string;
1075
1075
  route: "live" | "launch";
1076
1076
  turnSequence: number;
1077
- receipt?: "required" | "unavailable" | undefined;
1077
+ receipt?: "unavailable" | "required" | undefined;
1078
1078
  }>>>>;
1079
1079
  }, z.core.$strict>;
1080
1080
  wake: z.ZodUnion<readonly [z.ZodObject<{
@@ -1301,8 +1301,8 @@ export declare const selectionResultSchemas: {
1301
1301
  }>;
1302
1302
  turnSequence: z.ZodNumber;
1303
1303
  receipt: z.ZodOptional<z.ZodEnum<{
1304
- required: "required";
1305
1304
  unavailable: "unavailable";
1305
+ required: "required";
1306
1306
  }>>;
1307
1307
  }, z.core.$strict>, z.ZodTransform<Readonly<{
1308
1308
  turnSequence: number;
@@ -1313,7 +1313,7 @@ export declare const selectionResultSchemas: {
1313
1313
  deliveredAt: string;
1314
1314
  route: "live" | "launch";
1315
1315
  turnSequence: number;
1316
- receipt?: "required" | "unavailable" | undefined;
1316
+ receipt?: "unavailable" | "required" | undefined;
1317
1317
  }>>>>;
1318
1318
  }, z.core.$strict>]>, z.ZodObject<{
1319
1319
  kind: z.ZodLiteral<"tool">;
@@ -1508,8 +1508,8 @@ export declare const selectionResultSchemas: {
1508
1508
  }>;
1509
1509
  turnSequence: z.ZodNumber;
1510
1510
  receipt: z.ZodOptional<z.ZodEnum<{
1511
- required: "required";
1512
1511
  unavailable: "unavailable";
1512
+ required: "required";
1513
1513
  }>>;
1514
1514
  }, z.core.$strict>, z.ZodTransform<Readonly<{
1515
1515
  turnSequence: number;
@@ -1520,7 +1520,7 @@ export declare const selectionResultSchemas: {
1520
1520
  deliveredAt: string;
1521
1521
  route: "live" | "launch";
1522
1522
  turnSequence: number;
1523
- receipt?: "required" | "unavailable" | undefined;
1523
+ receipt?: "unavailable" | "required" | undefined;
1524
1524
  }>>>>;
1525
1525
  }, z.core.$strict>]>, z.ZodObject<{
1526
1526
  kind: z.ZodLiteral<"tool">;
@@ -1657,8 +1657,8 @@ export declare const selectionResultSchemas: {
1657
1657
  }>;
1658
1658
  turnSequence: z.ZodNumber;
1659
1659
  receipt: z.ZodOptional<z.ZodEnum<{
1660
- required: "required";
1661
1660
  unavailable: "unavailable";
1661
+ required: "required";
1662
1662
  }>>;
1663
1663
  }, z.core.$strict>, z.ZodTransform<Readonly<{
1664
1664
  turnSequence: number;
@@ -1669,7 +1669,7 @@ export declare const selectionResultSchemas: {
1669
1669
  deliveredAt: string;
1670
1670
  route: "live" | "launch";
1671
1671
  turnSequence: number;
1672
- receipt?: "required" | "unavailable" | undefined;
1672
+ receipt?: "unavailable" | "required" | undefined;
1673
1673
  }>>>>;
1674
1674
  }, z.core.$strict>;
1675
1675
  wake: z.ZodUnion<readonly [z.ZodObject<{
@@ -1746,8 +1746,8 @@ export declare const selectionResultSchemas: {
1746
1746
  }>;
1747
1747
  turnSequence: z.ZodNumber;
1748
1748
  receipt: z.ZodOptional<z.ZodEnum<{
1749
- required: "required";
1750
1749
  unavailable: "unavailable";
1750
+ required: "required";
1751
1751
  }>>;
1752
1752
  }, z.core.$strict>, z.ZodTransform<Readonly<{
1753
1753
  turnSequence: number;
@@ -1758,7 +1758,7 @@ export declare const selectionResultSchemas: {
1758
1758
  deliveredAt: string;
1759
1759
  route: "live" | "launch";
1760
1760
  turnSequence: number;
1761
- receipt?: "required" | "unavailable" | undefined;
1761
+ receipt?: "unavailable" | "required" | undefined;
1762
1762
  }>>>>;
1763
1763
  }, z.core.$strict>;
1764
1764
  wake: z.ZodUnion<readonly [z.ZodObject<{
@@ -62,6 +62,7 @@ function contractUpstream(processConfiguration) {
62
62
  return await contractChannel(repo, input.contractId, input.requester, configuration).review({
63
63
  verdict: input.verdict,
64
64
  ...(input.summary === undefined ? {} : { summary: input.summary }),
65
+ ...(input.actor === undefined ? {} : { actor: input.actor }),
65
66
  signal: input.signal,
66
67
  }, input.observe === undefined ? undefined : { observe: input.observe });
67
68
  },
@@ -11,7 +11,6 @@ export type AliasMove = Readonly<{
11
11
  }>;
12
12
  export declare function nukeAliases(world: WorldRoot): Promise<void>;
13
13
  export declare function readAliases(world: WorldRoot): Promise<readonly AliasBinding[]>;
14
- export declare function resolveAlias(world: WorldRoot, value: AkumaAlias): Promise<AkuId | null>;
15
14
  export declare function moveAlias(input: Readonly<{
16
15
  world: WorldRoot;
17
16
  alias: AkumaAlias;
@@ -113,10 +113,6 @@ export async function nukeAliases(world) {
113
113
  export async function readAliases(world) {
114
114
  return await read(paths(world).authority);
115
115
  }
116
- export async function resolveAlias(world, value) {
117
- const alias = parseReadableAkumaAlias(value);
118
- return (await readAliases(world)).find((binding) => binding.alias === alias)?.akuId ?? null;
119
- }
120
116
  export async function moveAlias(input) {
121
117
  const alias = parseAkumaAlias(input.alias);
122
118
  const akuId = parseAkuId(input.akuId).id;
@@ -1,8 +1,4 @@
1
1
  import type { DecodedContractDocument } from "./types.js";
2
- export declare function applyAmendDocument(source: string, current: DecodedContractDocument): Readonly<{
3
- document: string;
4
- changedSections: ReadonlySet<string>;
5
- }>;
6
2
  /** Caller syntax is decoded before any repository observation; current-dependent application stays pure. */
7
3
  export declare function prepareAmendDocument(source: string): (current: DecodedContractDocument) => Readonly<{
8
4
  document: string;
@@ -239,9 +239,6 @@ function apply(document, operations, current) {
239
239
  }
240
240
  return { body: completeBody(body), changed };
241
241
  }
242
- export function applyAmendDocument(source, current) {
243
- return prepareAmendDocument(source)(current);
244
- }
245
242
  /** Caller syntax is decoded before any repository observation; current-dependent application stays pure. */
246
243
  export function prepareAmendDocument(source) {
247
244
  const document = parseToAST(source);
@@ -17,4 +17,3 @@ export declare function decodeRegionOrRefusal(document: DocumentNode, section: S
17
17
  export type RegionRelation = "same" | "mine-within-theirs" | "theirs-within-mine" | "intersect";
18
18
  export type RegionOverlapPair = readonly [mine: string, theirs: string, relation: RegionRelation];
19
19
  export declare function regionsOverlapWithRelation(mine: readonly string[], theirs: readonly string[]): readonly RegionOverlapPair[];
20
- export declare function regionsOverlap(mine: readonly string[], theirs: readonly string[]): readonly [string, string][];
@@ -254,6 +254,3 @@ export function regionsOverlapWithRelation(mine, theirs) {
254
254
  }
255
255
  return overlaps;
256
256
  }
257
- export function regionsOverlap(mine, theirs) {
258
- return regionsOverlapWithRelation(mine, theirs).map(([minePattern, theirsPattern]) => [minePattern, theirsPattern]);
259
- }
@@ -1,6 +1,5 @@
1
1
  import type { DocumentNode, SectionNode } from "../markdown/types.js";
2
2
  import type { VerificationDeclaration } from "../verification/declaration.js";
3
- export type { VerificationDeclaration, VerificationExecutor } from "../verification/declaration.js";
4
3
  export declare class VerificationDocumentError extends Error {
5
4
  constructor(message: string);
6
5
  }
@@ -1,4 +1,5 @@
1
- import { CliUsageError, commandGuide, isBlankInput, usageLine } from "../usage.js";
1
+ import { CliUsageError, commandGuide, usageLine } from "../usage.js";
2
+ import { scanArgs } from "../scan.js";
2
3
  import { parseDuration as decodeDuration } from "../../duration.js";
3
4
  import { parseAkumaAlias, parseAkumaGlob } from "../../identity/selector.js";
4
5
  import { ALLOWED_ACTIONS, DEFAULT_ALLOWED_ACTIONS, decodeAllowedActions, } from "../../akuma/allowed.js";
@@ -12,7 +13,7 @@ const AKUMA_COMMAND_SPECS = {
12
13
  contract: "value",
13
14
  alias: "value",
14
15
  wait: "value",
15
- allowed: "repeatable",
16
+ allowed: "repeat",
16
17
  json: "boolean",
17
18
  schema: "value",
18
19
  },
@@ -134,6 +135,23 @@ export function renderAkumaHelp(action) {
134
135
  export function akumaUsageGuide(action) {
135
136
  return commandGuide(action, AKUMA_COMMAND_SPECS[action].usage);
136
137
  }
138
+ const TELL_ONLY_REFUSALS = {
139
+ "--wait": "tell --wait is not supported; use ask --wait",
140
+ "--schema": "tell --schema is not supported; use ask --schema",
141
+ };
142
+ /** The prompt is the only stdin reader; the ask-only options are refused tokens, as is `-d`. */
143
+ function scanSpec(action, spec) {
144
+ return {
145
+ subject: action,
146
+ flags: spec.flags,
147
+ ...(spec.stdin ? { stdin: "prompt" } : {}),
148
+ stdinRefusal: `stdin marker '-' is not valid for ${action}`,
149
+ refused: {
150
+ "-d": `option -d is not valid for ${action}`,
151
+ ...(action === "tell" ? TELL_ONLY_REFUSALS : {}),
152
+ },
153
+ };
154
+ }
137
155
  function stringFlag(value, diagnostic, fail) {
138
156
  if (typeof value !== "string")
139
157
  fail(diagnostic);
@@ -149,67 +167,6 @@ function parseDuration(raw, option, fail) {
149
167
  fail(`${option} duration exceeds the safe millisecond range`);
150
168
  return duration.milliseconds;
151
169
  }
152
- function scanNamedOption(input, flags, fail) {
153
- const token = input.argv[input.index];
154
- const name = token.slice(2);
155
- const kind = input.spec.flags[name];
156
- if (kind === undefined)
157
- fail(`option ${token} is not valid for ${input.action}`);
158
- if (kind !== "repeatable" && flags[name] !== undefined)
159
- fail(`duplicate option: ${token}`);
160
- if (kind === "boolean") {
161
- flags[name] = true;
162
- return input.index;
163
- }
164
- const value = input.argv[input.index + 1];
165
- if (value === undefined || value === "-" || value === "-d" || value.startsWith("--")) {
166
- fail(`${token} requires a value`);
167
- }
168
- if (isBlankInput(value))
169
- fail(`${token} requires a nonblank value`);
170
- flags[name] = kind === "repeatable" ? [...(Array.isArray(flags[name]) ? flags[name] : []), value] : value;
171
- return input.index + 1;
172
- }
173
- function scanAkuma(action, argv, fail) {
174
- const spec = AKUMA_COMMAND_SPECS[action];
175
- const flags = {};
176
- const positionals = [];
177
- let stdin = false;
178
- let positionalOnly = false;
179
- for (let index = 1; index < argv.length; index += 1) {
180
- const token = argv[index];
181
- if (!positionalOnly && token === "--") {
182
- positionalOnly = true;
183
- continue;
184
- }
185
- if (positionalOnly) {
186
- if (isBlankInput(token))
187
- fail(`${action} requires a nonblank value`);
188
- positionals.push(token);
189
- }
190
- else if (token === "-") {
191
- if (!spec.stdin)
192
- fail(`stdin marker '-' is not valid for ${action}`);
193
- if (stdin)
194
- fail("stdin marker '-' may appear only once");
195
- stdin = true;
196
- }
197
- else if (token === "-d") {
198
- fail(`option ${token} is not valid for ${action}`);
199
- }
200
- else if (!token.startsWith("--")) {
201
- if (isBlankInput(token))
202
- fail(`${action} requires a nonblank value`);
203
- positionals.push(token);
204
- }
205
- else {
206
- if (action === "tell" && (token === "--wait" || token === "--schema"))
207
- fail(`tell ${token} is not supported; use ask ${token}`);
208
- index = scanNamedOption({ action, spec, argv, index }, flags, fail);
209
- }
210
- }
211
- return { flags, positionals, stdin };
212
- }
213
170
  function positiveIndex(raw, option, fail) {
214
171
  if (typeof raw !== "string" || !/^[1-9][0-9]*$/u.test(raw))
215
172
  fail(`${option} requires a positive integer`);
@@ -397,10 +354,10 @@ export function parseAkumaCommand(argv) {
397
354
  const fail = (message) => {
398
355
  throw new CliUsageError(message, akumaUsageGuide(action));
399
356
  };
400
- const { flags, positionals, stdin } = scanAkuma(action, argv, fail);
357
+ const { flags, positionals, stdin } = scanArgs(argv, scanSpec(action, spec), fail);
401
358
  const output = flags.json === true ? "json" : "text";
402
359
  if (action === "call" || action === "tell" || action === "ask") {
403
- const parsed = parsePrompted(action, positionals, stdin, fail);
360
+ const parsed = parsePrompted(action, positionals, stdin !== undefined, fail);
404
361
  return action === "call"
405
362
  ? parseCall(flags, parsed.subject, parsed.prompt, output, fail)
406
363
  : action === "tell"
@@ -417,7 +374,7 @@ export function parseAkumaCommand(argv) {
417
374
  ? `${action} accepts one Akuma selector`
418
375
  : `${action} accepts exactly ${spec.arity} Akuma selectors`);
419
376
  }
420
- if (stdin)
377
+ if (stdin !== undefined)
421
378
  fail(`${action} reads no stdin`);
422
379
  return parseAddressed(action, positionals, flags, output, fail);
423
380
  }
@@ -12,10 +12,10 @@ import { akumasWithExecution } from "../../library/akumas.js";
12
12
  import { World } from "../../world.js";
13
13
  import { contractFromInput } from "../selectors.js";
14
14
  import { ActivityDriver } from "../activity.js";
15
- import { displayContext, resultContext, writeJson, writeStderr, writeStdout } from "../streams.js";
15
+ import { displayContext, emit, resultContext, writeJson, writeStderr, writeStdout } from "../streams.js";
16
16
  import { callObservationStream, inputWaitStream, waitObservationStream, } from "../render/akuma-activity.js";
17
- import { askRawAnswer, callRawAnswer, historyRawAnswer, waitRawAnswer } from "../render/akuma-activity.js";
18
- import { askExitCode, askProgressStream, callExitCode, callObservationHead, forkExitCode, historyExitCode, killExitCode, renderCallText, renderForkText, renderHistoryText, renderKillText, renderTellText, renderWaitText, tellExitCode, waitedTellProgress, } from "../render/akuma.js";
17
+ import { askRawAnswer, callRawAnswer, historyRawAnswer, historyText, tellText, waitRawAnswer, waitText, } from "../render/akuma-activity.js";
18
+ import { askExitCode, askProgressStream, callExitCode, callObservationHead, forkExitCode, historyExitCode, killExitCode, renderCallText, renderForkText, renderKillText, tellExitCode, waitedTellProgress, } from "../render/akuma.js";
19
19
  export { isParsedAkumaCommand, renderAkumaHelp } from "./akuma-grammar.js";
20
20
  // ---------------------------------------------------------------------------
21
21
  // Leaf dispatch: acquisition, one public SDK invocation, direct rendering
@@ -86,7 +86,7 @@ async function inputInitiator(input) {
86
86
  }
87
87
  return { initiator };
88
88
  }
89
- function emitResult(body, exact) {
89
+ function emitAnswer(body, exact) {
90
90
  if (exact)
91
91
  process.stdout.write(body);
92
92
  else
@@ -152,9 +152,9 @@ async function runCall(command, input) {
152
152
  }
153
153
  const raw = callRawAnswer(result, streamed);
154
154
  if (raw === undefined)
155
- emitResult(renderCallText(result, streamed, displayContext()), false);
155
+ emitAnswer(renderCallText(result, streamed, displayContext()), false);
156
156
  else
157
- emitResult(raw, true);
157
+ emitAnswer(raw, true);
158
158
  return callExitCode(result);
159
159
  }
160
160
  finally {
@@ -195,9 +195,9 @@ async function runWait(command, input) {
195
195
  }
196
196
  const raw = waitRawAnswer(result, streamed);
197
197
  if (raw === undefined)
198
- emitResult(renderWaitText(result, presentation, displayContext()), false);
198
+ emitAnswer(waitText(result, presentation, displayContext()), false);
199
199
  else
200
- emitResult(raw, true);
200
+ emitAnswer(raw, true);
201
201
  return 0;
202
202
  }
203
203
  finally {
@@ -214,12 +214,8 @@ async function runTell(command, input) {
214
214
  ...(input.repo === undefined ? {} : { repo: input.repo }),
215
215
  ...(input.signal === undefined ? {} : { signal: input.signal }),
216
216
  });
217
- if (command.output === "json") {
218
- writeJson(result);
219
- return tellExitCode(result);
220
- }
221
- emitResult(renderTellText(result, inputAlias(command.akuma), displayContext()), false);
222
- return tellExitCode(result);
217
+ const text = () => tellText(result, inputAlias(command.akuma), displayContext());
218
+ return emit(command.output, result, text, tellExitCode(result));
223
219
  }
224
220
  async function runAsk(command, input) {
225
221
  const body = await promptBody("ask", command, input);
@@ -261,7 +257,7 @@ async function runAsk(command, input) {
261
257
  writeJson(result);
262
258
  return askExitCode(result);
263
259
  }
264
- emitResult(askRawAnswer(result, schema !== undefined) ?? "", true);
260
+ emitAnswer(askRawAnswer(result, schema !== undefined) ?? "", true);
265
261
  return askExitCode(result);
266
262
  }
267
263
  finally {
@@ -289,11 +285,11 @@ async function runHistory(command, input) {
289
285
  last: command.last,
290
286
  };
291
287
  if (raw !== undefined)
292
- emitResult(raw, true);
288
+ emitAnswer(raw, true);
293
289
  else if (command.last && result.kind === "last")
294
- emitResult(result.answer, true);
290
+ emitAnswer(result.answer, true);
295
291
  else
296
- emitResult(renderHistoryText(result, presentation, displayContext()), false);
292
+ emitAnswer(historyText(result, presentation, displayContext()), false);
297
293
  return historyExitCode(result, command.id);
298
294
  }
299
295
  async function runFork(command, input) {
@@ -302,12 +298,7 @@ async function runFork(command, input) {
302
298
  at: command.at,
303
299
  ...(input.repo === undefined ? {} : { repo: input.repo }),
304
300
  });
305
- if (command.output === "json") {
306
- writeJson(receipt);
307
- return forkExitCode(receipt);
308
- }
309
- emitResult(renderForkText(receipt), false);
310
- return forkExitCode(receipt);
301
+ return emit(command.output, receipt, () => renderForkText(receipt), forkExitCode(receipt));
311
302
  }
312
303
  async function runKill(command, input) {
313
304
  const alias = command.akuma.length === 1 ? inputAlias(command.akuma[0]) : undefined;
@@ -316,12 +307,8 @@ async function runKill(command, input) {
316
307
  ...(input.repo === undefined ? {} : { repo: input.repo }),
317
308
  ...(input.signal === undefined ? {} : { signal: input.signal }),
318
309
  });
319
- if (command.output === "json") {
320
- writeJson(result);
321
- return killExitCode(result);
322
- }
323
- emitResult(renderKillText(result, alias, displayContext()), false);
324
- return killExitCode(result);
310
+ const text = () => renderKillText(result, alias, displayContext());
311
+ return emit(command.output, result, text, killExitCode(result));
325
312
  }
326
313
  async function akumaWorld(command, coordinates) {
327
314
  const world = command.command === "call"
@@ -44,7 +44,7 @@ export type ParsedDeliver = Output & Readonly<{
44
44
  materializeConflict: boolean;
45
45
  overwrite: boolean;
46
46
  }>;
47
- export type ParsedReview = Output & Readonly<{
47
+ export type ParsedReview = Output & Actor & Readonly<{
48
48
  command: "review";
49
49
  contract?: string;
50
50
  verdict: "satisfied" | "unsatisfied";
@@ -66,11 +66,23 @@ export type ParsedStatus = Output & (Readonly<{
66
66
  selectors?: readonly string[];
67
67
  akuma?: never;
68
68
  guidance?: true;
69
+ category?: never;
70
+ limit?: never;
69
71
  }> | Readonly<{
70
72
  command: "status";
71
73
  contract: string;
72
74
  akuma: true;
73
75
  guidance?: never;
76
+ category?: never;
77
+ limit?: never;
78
+ }> | Readonly<{
79
+ command: "status";
80
+ category: StatusCategory;
81
+ limit?: number;
82
+ contract?: never;
83
+ selectors?: never;
84
+ akuma?: never;
85
+ guidance?: never;
74
86
  }>);
75
87
  export type ParsedLs = Output & Readonly<{
76
88
  command: "ls";
@@ -108,5 +120,6 @@ export type ParsedContractParts = Readonly<{
108
120
  actor?: string;
109
121
  }>;
110
122
  export type ParsedContractCommand = ParsedBind | ParsedAmend | ParsedDeliver | ParsedReview | ParsedArc | ParsedAbandon | ParsedStatus | ParsedLs | ParsedAudit | ParsedReconcile | ParsedNuke | ParsedSettings | ParsedRegion;
123
+ export type StatusCategory = "akuma" | "contract";
111
124
  export declare function parseContractCommand(parts: ParsedContractParts): ParsedContractCommand;
112
125
  export {};
@@ -123,32 +123,65 @@ function parseReview(parts) {
123
123
  verdict: parts.flags.satisfied === true ? "satisfied" : "unsatisfied",
124
124
  ...(summary === undefined ? {} : { summary }),
125
125
  ...(parts.stdin ? { summaryFromStdin: true } : {}),
126
+ ...(parts.actor === undefined ? {} : { actor: parts.actor }),
126
127
  output: parts.output,
127
128
  };
128
129
  }
129
- function parseStatus(parts) {
130
- const guidance = parts.flags.guidance === true;
131
- if (guidance) {
132
- const selected = parts.positionals[0];
133
- if (parts.positionals.length > 1)
134
- refuse("status", "--guidance accepts at most one Contract selector");
135
- if (selected?.startsWith("aku/") === true)
136
- refuse("status", "--guidance cannot select an Akuma");
137
- return {
138
- command: "status",
139
- ...(selected === undefined ? {} : { contract: selected }),
140
- guidance: true,
141
- output: parts.output,
142
- };
130
+ // Only these fixed category forms are status selectors.
131
+ const STATUS_CATEGORY_SELECTORS = new Map([
132
+ ["aku", "akuma"],
133
+ ["aku/", "akuma"],
134
+ ["aku/*", "akuma"],
135
+ ["kei", "contract"],
136
+ ["kei/", "contract"],
137
+ ["kei/*", "contract"],
138
+ ]);
139
+ function rejectStatusGlobs(positionals) {
140
+ for (const selector of positionals) {
141
+ if (!STATUS_CATEGORY_SELECTORS.has(selector) && !selector.startsWith("@") && /[*?\[\]]/u.test(selector))
142
+ refuse("status", `unsupported status glob: ${selector}`);
143
143
  }
144
+ }
145
+ function parseStatusGuidance(parts, limit) {
146
+ if (limit !== undefined)
147
+ refuse("status", "--limit is not valid with --guidance");
148
+ const selected = parts.positionals[0];
149
+ if (selected !== undefined && STATUS_CATEGORY_SELECTORS.has(selected))
150
+ refuse("status", "--guidance cannot select a category");
151
+ if (parts.positionals.length > 1)
152
+ refuse("status", "--guidance accepts at most one Contract selector");
153
+ if (selected?.startsWith("aku/") === true)
154
+ refuse("status", "--guidance cannot select an Akuma");
155
+ if (selected !== undefined && !selected.startsWith("@") && /[*?\[\]]/u.test(selected))
156
+ refuse("status", `unsupported status glob: ${selected}`);
157
+ return {
158
+ command: "status",
159
+ ...(selected === undefined ? {} : { contract: selected }),
160
+ guidance: true,
161
+ output: parts.output,
162
+ };
163
+ }
164
+ function parseStatus(parts) {
165
+ const limit = listLimit(parts, "status");
166
+ if (parts.flags.guidance === true)
167
+ return parseStatusGuidance(parts, limit);
168
+ rejectStatusGlobs(parts.positionals);
144
169
  if (parts.positionals.length > 1) {
170
+ if (limit !== undefined)
171
+ refuse("status", "--limit is valid only for one category selector");
172
+ if (parts.positionals.some((selector) => STATUS_CATEGORY_SELECTORS.has(selector)))
173
+ refuse("status", "a category selector cannot combine with other selectors");
145
174
  return { command: "status", selectors: parts.positionals, output: parts.output };
146
175
  }
147
- const contract = parts.positionals[0];
148
- if (contract?.startsWith("aku/") === true) {
149
- return { command: "status", contract, akuma: true, output: parts.output };
150
- }
151
- return { command: "status", ...(contract === undefined ? {} : { contract }), output: parts.output };
176
+ const selected = parts.positionals[0];
177
+ const category = selected === undefined ? undefined : STATUS_CATEGORY_SELECTORS.get(selected);
178
+ if (category !== undefined)
179
+ return { command: "status", category, ...(limit === undefined ? {} : { limit }), output: parts.output };
180
+ if (limit !== undefined)
181
+ refuse("status", "--limit is valid only for a category selector");
182
+ if (selected?.startsWith("aku/") === true)
183
+ return { command: "status", contract: selected, akuma: true, output: parts.output };
184
+ return { command: "status", ...(selected === undefined ? {} : { contract: selected }), output: parts.output };
152
185
  }
153
186
  function parseRegion(parts) {
154
187
  const contract = parts.positionals[0];
@@ -172,10 +205,10 @@ function akumaCatalogQuery(query, parts) {
172
205
  ...(limit === undefined ? {} : { limit: Number(limit) }),
173
206
  };
174
207
  }
175
- function listLimit(parts) {
208
+ function listLimit(parts, command = "ls") {
176
209
  const limit = optionalFlag(parts.flags, "limit");
177
210
  if (limit !== undefined && (!/^[1-9][0-9]*$/u.test(limit) || !Number.isSafeInteger(Number(limit))))
178
- refuse("ls", "--limit requires a positive safe integer");
211
+ refuse(command, "--limit requires a positive safe integer");
179
212
  return limit === undefined ? undefined : Number(limit);
180
213
  }
181
214
  function taskCatalogQuery(path, limit) {