@astrosheep/keiyaku 4.6.7 → 4.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/README.md +6 -2
  2. package/build/plugins/pi/keiyaku.ts +0 -5
  3. package/build/src/akuma/akuma-call.d.ts +2 -0
  4. package/build/src/akuma/akuma-call.js +8 -2
  5. package/build/src/akuma/akuma-instance.d.ts +12 -1
  6. package/build/src/akuma/akuma-instance.js +27 -7
  7. package/build/src/akuma/akuma-observe.js +2 -0
  8. package/build/src/akuma/akuma-owner.d.ts +3 -0
  9. package/build/src/akuma/akuma-owner.js +4 -0
  10. package/build/src/akuma/akuma.d.ts +35 -5
  11. package/build/src/akuma/akuma.js +8 -10
  12. package/build/src/akuma/archetype.d.ts +7 -15
  13. package/build/src/akuma/archetype.js +36 -35
  14. package/build/src/akuma/body.d.ts +5 -3
  15. package/build/src/akuma/body.js +29 -7
  16. package/build/src/akuma/call-request.d.ts +18 -10
  17. package/build/src/akuma/call-request.js +10 -3
  18. package/build/src/akuma/caller.d.ts +39 -0
  19. package/build/src/akuma/caller.js +36 -0
  20. package/build/src/akuma/dispatch-association.d.ts +0 -1
  21. package/build/src/akuma/dispatch-association.js +0 -3
  22. package/build/src/akuma/heart/facts.d.ts +16 -12
  23. package/build/src/akuma/heart/facts.js +8 -0
  24. package/build/src/akuma/heart/index.d.ts +2 -7
  25. package/build/src/akuma/heart/index.js +3 -17
  26. package/build/src/akuma/heart/rows.d.ts +3 -3
  27. package/build/src/akuma/heart/soul.d.ts +1 -1
  28. package/build/src/akuma/heart/soul.js +5 -24
  29. package/build/src/akuma/heart/storage.d.ts +5 -0
  30. package/build/src/akuma/heart/storage.js +7 -3
  31. package/build/src/akuma/identity.d.ts +0 -1
  32. package/build/src/akuma/identity.js +2 -5
  33. package/build/src/akuma/index.d.ts +5 -2
  34. package/build/src/akuma/index.js +1 -0
  35. package/build/src/akuma/nuke.js +6 -28
  36. package/build/src/akuma/projection.d.ts +0 -11
  37. package/build/src/akuma/provider-recipe.d.ts +7 -6
  38. package/build/src/akuma/provider-recipe.js +1 -1
  39. package/build/src/akuma/provider.d.ts +6 -10
  40. package/build/src/akuma/provider.js +6 -7
  41. package/build/src/akuma/providers/acp/events.js +5 -18
  42. package/build/src/akuma/providers/acp/index.js +2 -3
  43. package/build/src/akuma/providers/claude/events.js +35 -60
  44. package/build/src/akuma/providers/claude/index.d.ts +2 -2
  45. package/build/src/akuma/providers/claude/index.js +2 -3
  46. package/build/src/akuma/providers/codex-app-server/index.js +2 -2
  47. package/build/src/akuma/providers/decode.d.ts +25 -0
  48. package/build/src/akuma/providers/decode.js +44 -0
  49. package/build/src/akuma/providers/execution-environment.d.ts +2 -1
  50. package/build/src/akuma/providers/execution-environment.js +3 -0
  51. package/build/src/akuma/providers/grok-build/index.js +6 -22
  52. package/build/src/akuma/providers/index.js +2 -0
  53. package/build/src/akuma/providers/lifecycle.d.ts +9 -0
  54. package/build/src/akuma/providers/lifecycle.js +10 -0
  55. package/build/src/akuma/providers/opencode-sdk/events.js +1 -14
  56. package/build/src/akuma/providers/opencode-sdk/index.js +10 -17
  57. package/build/src/akuma/providers/opencode-sdk/session.js +1 -3
  58. package/build/src/akuma/providers/paseo/events.d.ts +25 -0
  59. package/build/src/akuma/providers/paseo/events.js +157 -0
  60. package/build/src/akuma/providers/paseo/index.d.ts +9 -0
  61. package/build/src/akuma/providers/paseo/index.js +353 -0
  62. package/build/src/akuma/providers/pi/events.js +5 -15
  63. package/build/src/akuma/publication.d.ts +2 -0
  64. package/build/src/akuma/publication.js +5 -0
  65. package/build/src/akuma/request-lifecycle.d.ts +3 -0
  66. package/build/src/akuma/request-lifecycle.js +25 -4
  67. package/build/src/akuma/requests.d.ts +3 -1
  68. package/build/src/akuma/requests.js +32 -0
  69. package/build/src/akuma/selection-observation.d.ts +72 -2
  70. package/build/src/akuma/selection-observation.js +0 -6
  71. package/build/src/akuma/turn-drive.js +2 -5
  72. package/build/src/cli/akuma-caller.d.ts +3 -0
  73. package/build/src/cli/akuma-caller.js +21 -0
  74. package/build/src/cli/commands/akuma-grammar.js +7 -12
  75. package/build/src/cli/commands/akuma.js +12 -4
  76. package/build/src/cli/commands/contract-grammar.d.ts +2 -1
  77. package/build/src/cli/commands/contract-grammar.js +13 -15
  78. package/build/src/cli/commands/contract-help.d.ts +2 -1
  79. package/build/src/cli/commands/contract-help.js +31 -1
  80. package/build/src/cli/commands/contract.js +24 -53
  81. package/build/src/cli/commands/task.js +18 -35
  82. package/build/src/cli/parse.d.ts +2 -2
  83. package/build/src/cli/render/catalog.d.ts +2 -5
  84. package/build/src/cli/render/contract-history.js +3 -6
  85. package/build/src/cli/render/contract.js +15 -50
  86. package/build/src/cli/render/receipt.js +3 -10
  87. package/build/src/cli/render/task.d.ts +4 -6
  88. package/build/src/cli/render/task.js +9 -26
  89. package/build/src/cli/runtime.d.ts +1 -1
  90. package/build/src/cli/runtime.js +11 -17
  91. package/build/src/cli/selectors.d.ts +3 -6
  92. package/build/src/cli/selectors.js +22 -53
  93. package/build/src/dispatch/index.d.ts +3 -3
  94. package/build/src/dispatch/index.js +1 -2
  95. package/build/src/git/observe.d.ts +6 -2
  96. package/build/src/git/observe.js +6 -2
  97. package/build/src/index.d.ts +6 -6
  98. package/build/src/index.js +2 -2
  99. package/build/src/kanshi/index.d.ts +1 -1
  100. package/build/src/kanshi/read.js +21 -6
  101. package/build/src/library/address.js +2 -4
  102. package/build/src/library/akuma-creation.d.ts +5 -1
  103. package/build/src/library/akuma-creation.js +27 -47
  104. package/build/src/library/akumas.d.ts +5 -4
  105. package/build/src/library/akumas.js +13 -9
  106. package/build/src/library/bind.d.ts +14 -14
  107. package/build/src/library/bind.js +11 -7
  108. package/build/src/library/contract-address.d.ts +9 -0
  109. package/build/src/library/contract-address.js +71 -0
  110. package/build/src/library/contract-composition.d.ts +4 -7
  111. package/build/src/library/contract-composition.js +6 -18
  112. package/build/src/library/contract-creation.d.ts +3 -5
  113. package/build/src/library/contract-creation.js +19 -17
  114. package/build/src/library/contract-execution.js +18 -23
  115. package/build/src/library/contract-outcomes.d.ts +2 -14
  116. package/build/src/library/contract-outcomes.js +2 -13
  117. package/build/src/library/contract-types.d.ts +36 -2
  118. package/build/src/library/delivery.d.ts +0 -2
  119. package/build/src/library/delivery.js +2 -5
  120. package/build/src/library/keiyaku.d.ts +0 -5
  121. package/build/src/library/keiyaku.js +6 -12
  122. package/build/src/library/outcome.d.ts +500 -499
  123. package/build/src/library/outcome.js +10 -0
  124. package/build/src/library/reconcile.js +8 -16
  125. package/build/src/library/refusal.d.ts +2 -2
  126. package/build/src/library/repo.d.ts +3 -2
  127. package/build/src/library/repo.js +10 -5
  128. package/build/src/library/selection.d.ts +4 -4
  129. package/build/src/library/selection.js +12 -12
  130. package/build/src/plugin/akuma-signals.d.ts +2 -0
  131. package/build/src/plugin/akuma-signals.js +4 -0
  132. package/build/src/plugin/public.d.ts +27 -2
  133. package/build/src/plugin/runtime.js +2 -2
  134. package/build/src/protocol/amend.js +3 -2
  135. package/build/src/protocol/attempt.js +3 -8
  136. package/build/src/protocol/bind.d.ts +2 -2
  137. package/build/src/protocol/bind.js +1 -1
  138. package/build/src/protocol/deliver.js +3 -3
  139. package/build/src/protocol/operations.d.ts +1 -3
  140. package/build/src/protocol/operations.js +0 -8
  141. package/build/src/protocol/outcome.d.ts +1 -2
  142. package/build/src/protocol/outcome.js +1 -13
  143. package/build/src/protocol/placement.js +3 -10
  144. package/build/src/protocol/read/status.js +31 -70
  145. package/build/src/protocol/reintegrate.js +3 -10
  146. package/build/src/protocol/review.js +3 -3
  147. package/build/src/protocol/run.d.ts +5 -1
  148. package/build/src/protocol/run.js +3 -3
  149. package/build/src/runtime/proc/windows-launch.exe +0 -0
  150. package/package.json +8 -4
  151. package/plugins/pi/keiyaku.ts +57 -0
  152. package/skills/keiyaku/SKILL.md +44 -0
  153. package/skills/keiyaku-akuma/SKILL.md +130 -0
  154. package/skills/keiyaku-akuma/references/automation.md +269 -0
  155. package/skills/keiyaku-babysit/SKILL.md +65 -0
  156. package/skills/keiyaku-bind/SKILL.md +216 -0
  157. package/skills/keiyaku-bind/agents/openai.yaml +4 -0
  158. package/skills/keiyaku-task/SKILL.md +104 -0
  159. package/skills/keiyaku-workflow/SKILL.md +129 -0
  160. package/build/src/cli/commands/amend.d.ts +0 -12
  161. package/build/src/cli/commands/amend.js +0 -10
  162. package/build/src/cli/commands/bind.d.ts +0 -11
  163. package/build/src/cli/commands/bind.js +0 -23
  164. package/build/src/dispatch/association.d.ts +0 -1
  165. package/build/src/dispatch/association.js +0 -1
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: keiyaku-workflow
3
+ description: >-
4
+ Must read before binding a `kei` (Contract) or when acting as its holder.
5
+ Use when deciding when to bind a kei, how to shape and hold it, how to
6
+ delegate its work, and how to accept, amend, or end it.
7
+ ---
8
+
9
+ # Keiyaku Workflow
10
+
11
+ The holder runs one Contract's fulfillment loop from preparation to completion.
12
+
13
+ ## 1. Prepare Before Binding
14
+
15
+ Before `bind`, settle the information that makes the `kei` truthful:
16
+
17
+ - objective and intended outcome;
18
+ - design and approach;
19
+ - affected Region;
20
+ - acceptance conditions;
21
+ - verification and required evidence;
22
+ - prerequisites;
23
+ - holder.
24
+
25
+ If the design, approach, or acceptance conditions are still open, do not bind.
26
+ Resolve them with their owner first. Private implementation details may remain
27
+ for the Deliverer; the public meaning and acceptance boundary may not.
28
+
29
+ Bind independent `kei`s in parallel. Do not split one acceptance boundary just
30
+ to create parallel work.
31
+
32
+ ## 2. Split the Work
33
+
34
+ - Separate `kei`s have independently acceptable outcomes.
35
+ - An Arc is a chapter of one `kei`; it is not separately accepted.
36
+ - A Task stores decomposition or dependencies that outlive this conversation.
37
+
38
+ Use `after` only when one `kei` requires another to be accepted first. Ordinary
39
+ overlap is not a dependency.
40
+
41
+ ## 3. Roles
42
+
43
+ A `kei` has three roles. They are responsibilities, not people, and one agent
44
+ may fill more than one of them, with one exception below.
45
+
46
+ - **Holder:** exactly one per `kei`. Owns the fulfillment loop and acceptance
47
+ until the Contract is accepted or abandoned. Handing work to others never
48
+ transfers this responsibility.
49
+ - **Deliverer:** produces the candidate in the appointed worktree and tenders
50
+ it with `deliver`.
51
+ - **Reviewer:** judges the complete Contract against its acceptance conditions
52
+ and records the verdict with `review`.
53
+
54
+ Review is independent when the Reviewer did not deliver the candidate under
55
+ review. That is the whole requirement. The holder may review its own `kei`; a
56
+ fresh Akuma is not what makes review independent. Keiyaku does not check who
57
+ reviews, so keeping the Reviewer apart from the Deliverer is the holder's duty.
58
+
59
+ Any role may be filled directly or handed to an Akuma. Hand one over when other
60
+ hands help the work, not to make review count.
61
+
62
+ ## 4. Lifecycle
63
+
64
+ Each act changes a different part of the world:
65
+
66
+ - **Bind:** Journal gains the Contract and its terms. Workspace appointment
67
+ names one managed worktree; the receipt reports its path. Appointment lag
68
+ leaves the bind admitted without a path and reports pending reconciliation.
69
+ `reconcile` retries workspace realization.
70
+ - **Work:** Changes and commits belong in the appointed worktree. Another
71
+ lane's claim can move the target beneath it. Check target movement before
72
+ audit; when it matters, merge the target branch (main when selected) in the
73
+ worktree and resolve conflicts there before auditing.
74
+ - **Audit:** Previews the candidate and target without tendering or claiming.
75
+ With `verified` selected, Verification runs for the captured subject and can
76
+ record an attestation. Without that gate, the section is inert text and no
77
+ verb runs Verification. A stopped run records no new verdict.
78
+ - **Deliver:** Captures a tender and integration against the observed target;
79
+ journal gains a delivered candidate. Ready prerequisites and gates trigger
80
+ placement and claim in this invocation; otherwise the candidate waits.
81
+ Changed candidate content stales earlier review. Identical content retains
82
+ review across rebase or target movement.
83
+ - **Review:** Records verdict evidence for the current document and worktree
84
+ content, even before delivery. Satisfied review requests placement: with a
85
+ delivered candidate, current gates, and ready prerequisites, it accepts in
86
+ this invocation. Unsatisfied review records testimony without placement.
87
+ - **Abandon:** Records the alternate terminal outcome without accepting. Accepted
88
+ and abandoned Contracts cannot be reopened.
89
+
90
+ Placement judges declared gates, not the producer's identity. Review does not
91
+ replace Verification; audit never requests placement. Read the final receipt
92
+ for stops and reconciliation lag after an admitted act.
93
+
94
+ ## 5. Handing A Role To An Akuma
95
+
96
+ This is the one commissioning map. `call --help` owns the exact action
97
+ vocabulary and default set. The flagship acting directly needs no grant.
98
+ Birth freezes an Akuma's actions; `--contract` records association, not
99
+ authority.
100
+
101
+ | Role | Grant at birth | Return |
102
+ | --- | --- | --- |
103
+ | Holder | The actions the delegated loop will perform; include `contract.review` when this holder will review. Commission with the `kei`, current Arc when one exists, appointed worktree, and holder duties. | Acceptance or abandonment, with receipts. |
104
+ | Deliverer | The ordinary baseline: every Task mutation, Contract audit and delivery, and Akuma management. `keiyaku -C <repo> call worker --alias @deliverer --contract <kei/...> --workdir <appointed-path> -` | The delivery receipt. |
105
+ | Reviewer | `--allowed contract.review`: `keiyaku -C <repo> call review-akuma --alias @reviewer --contract <kei/...> --workdir <appointed-path> --allowed contract.review -` | The verdict receipt. Without the grant, `not-allowed` refuses and no verdict is recorded. |
106
+
107
+ An Archetype's explicit allowed set replaces the ordinary baseline; check
108
+ `status` for effective actions. `tell` and `fork` cannot add a grant to a live
109
+ Akuma, so call a fresh one with the grant. Nested calls cannot exceed their
110
+ direct parent's actions.
111
+
112
+ Commission with a clear objective, current Arc when one exists, appointed
113
+ worktree, and expected result. Never ask the Akuma that delivered a candidate
114
+ to review it. Use `keiyaku-akuma` for invocation and observation, and command
115
+ help for exact syntax.
116
+
117
+ ## 6. Decide What Happens Next
118
+
119
+ The holder checks candidate, verification, review, prerequisites, and gates.
120
+
121
+ - A ready delivered candidate claims automatically on delivery or satisfied
122
+ review; no separate claim command is needed.
123
+ - Missing evidence or unfinished work calls for another commission or chapter.
124
+ - Amend when the objective and acceptance boundary remain the same but terms
125
+ must change.
126
+ - Abandon and bind a new `kei` when the objective or acceptance boundary changes.
127
+
128
+ Read `keiyaku-bind` for authoring, `keiyaku-akuma` for delegation, and
129
+ `keiyaku-babysit` for supervising multiple lanes.
@@ -1,12 +0,0 @@
1
- import { type ActorId, type Keiyaku, type Repo } from "../../index.js";
2
- import type { ParsedAmend } from "./contract-grammar.js";
3
- type AmendCommandInput = Readonly<{
4
- command: ParsedAmend;
5
- repo: Repo;
6
- contract: Keiyaku;
7
- markdown?: string;
8
- gates?: readonly string[];
9
- actor?: ActorId;
10
- }>;
11
- export declare function amendFromCommand({ command, repo, contract, markdown, gates, actor, }: AmendCommandInput): ReturnType<Keiyaku["amend"]>;
12
- export {};
@@ -1,10 +0,0 @@
1
- import { contractFromInput } from "../selectors.js";
2
- export function amendFromCommand({ command, repo, contract, markdown, gates, actor, }) {
3
- const after = command.clearAfter === true ? [] : command.after?.map((id) => contractFromInput(repo, id).id);
4
- return contract.amend({
5
- ...(markdown === undefined ? {} : { markdown }),
6
- ...(actor === undefined ? {} : { actor }),
7
- ...(after === undefined ? {} : { after }),
8
- ...(gates === undefined ? {} : { gates }),
9
- });
10
- }
@@ -1,11 +0,0 @@
1
- import { type ActorId, type BindResult, type KeiyakuLibrary, type Repo } from "../../index.js";
2
- import type { ParsedBind } from "./contract-grammar.js";
3
- type BindCommandInput = Readonly<{
4
- command: ParsedBind;
5
- repo: Repo;
6
- library: KeiyakuLibrary;
7
- markdown?: string;
8
- actor?: ActorId;
9
- }>;
10
- export declare function bindFromCommand({ command, repo, library, markdown, actor, }: BindCommandInput): Promise<BindResult>;
11
- export {};
@@ -1,23 +0,0 @@
1
- import { contractFromInput } from "../selectors.js";
2
- export async function bindFromCommand({ command, repo, library, markdown, actor, }) {
3
- if (command.forkOf !== undefined) {
4
- return library.bind({
5
- repo,
6
- forkOf: contractFromInput(repo, command.forkOf).id,
7
- ...(command.target === undefined ? {} : { target: command.target }),
8
- ...(actor === undefined ? {} : { actor }),
9
- });
10
- }
11
- const after = command.after?.map((id) => contractFromInput(repo, id).id);
12
- if (markdown === undefined)
13
- throw new Error("Markdown bind command is missing stdin terms");
14
- return library.bind({
15
- repo,
16
- markdown,
17
- ...(command.task === undefined ? {} : { task: command.task }),
18
- ...(command.target === undefined ? {} : { target: command.target }),
19
- ...(actor === undefined ? {} : { actor }),
20
- ...(after === undefined ? {} : { after }),
21
- ...(command.gates === undefined ? {} : { gates: command.gates }),
22
- });
23
- }
@@ -1 +0,0 @@
1
- export { dispatchAssociationSchema, NO_DISPATCH_ASSOCIATION, parseDispatchAssociation, type DispatchAssociation, } from "../akuma/dispatch-association.js";
@@ -1 +0,0 @@
1
- export { dispatchAssociationSchema, NO_DISPATCH_ASSOCIATION, parseDispatchAssociation, } from "../akuma/dispatch-association.js";