@astrosheep/keiyaku 1.0.0 → 1.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 (123) hide show
  1. package/README.md +73 -56
  2. package/build/.tsbuildinfo +1 -1
  3. package/build/agents/call-terms_v2.js +103 -0
  4. package/build/agents/harness/activity-values.js +54 -0
  5. package/build/agents/harness/event-channel.js +55 -20
  6. package/build/agents/harness/events.js +47 -1
  7. package/build/agents/harness/execution-handle.js +292 -61
  8. package/build/agents/harness/index.js +103 -121
  9. package/build/agents/harness/pump.js +36 -47
  10. package/build/agents/harness/runtime.js +3 -0
  11. package/build/agents/launch-snapshot_v2.js +348 -0
  12. package/build/agents/opencode-sdk.js +42 -169
  13. package/build/agents/providers/claude-agent-sdk.js +240 -79
  14. package/build/agents/providers/codex-app-server.js +280 -72
  15. package/build/agents/providers/codex-sdk.js +159 -41
  16. package/build/agents/providers/event-type-tail.js +16 -0
  17. package/build/agents/providers/opencode-sdk.js +165 -59
  18. package/build/agents/providers/pi.js +254 -42
  19. package/build/agents/selector_v2.js +122 -0
  20. package/build/cli/commands/akuma.js +120 -42
  21. package/build/cli/completion.js +6 -7
  22. package/build/cli/flags.js +36 -10
  23. package/build/cli/help.js +42 -26
  24. package/build/cli/index.js +225 -93
  25. package/build/cli/parse.js +194 -75
  26. package/build/cli/projection-address.js +11 -0
  27. package/build/cli/render/address.js +88 -0
  28. package/build/cli/render/arc.js +10 -10
  29. package/build/cli/render/call.js +59 -0
  30. package/build/cli/render/compact-text.js +3 -0
  31. package/build/cli/render/errors.js +4 -2
  32. package/build/cli/render/format.js +6 -0
  33. package/build/cli/render/line-width.js +70 -0
  34. package/build/cli/render/misc.js +7 -4
  35. package/build/cli/render/petition.js +4 -3
  36. package/build/cli/render/projection-activity.js +201 -0
  37. package/build/cli/render/shared.js +46 -12
  38. package/build/cli/render/status.js +59 -10
  39. package/build/cli/render/tool-ledger-rollup.js +74 -0
  40. package/build/cli/render/tool-presentation.js +97 -0
  41. package/build/cli/render/wait.js +229 -0
  42. package/build/cli/skills-install.js +42 -24
  43. package/build/cli/subagent-guard.js +1 -1
  44. package/build/config/akuma-loader_v2.js +222 -0
  45. package/build/config/env-keys.js +0 -4
  46. package/build/config/env.js +0 -6
  47. package/build/config/settings.js +325 -12
  48. package/build/core/addressing.js +224 -0
  49. package/build/core/amend.js +30 -47
  50. package/build/core/arc.js +68 -60
  51. package/build/core/bind.js +105 -25
  52. package/build/core/call-persist.js +69 -0
  53. package/build/core/call.js +658 -0
  54. package/build/core/claim.js +72 -44
  55. package/build/core/command-io.js +19 -19
  56. package/build/core/context.js +11 -36
  57. package/build/core/draft.js +2 -3
  58. package/build/core/entry.js +101 -6
  59. package/build/core/execution-coordinate.js +62 -0
  60. package/build/core/execution-pact.js +141 -0
  61. package/build/core/forfeit.js +2 -3
  62. package/build/core/hints.js +10 -10
  63. package/build/core/ids.js +6 -0
  64. package/build/core/ledger.js +16 -1
  65. package/build/core/petition-claim-gates.js +14 -12
  66. package/build/core/petition-claim.js +1 -0
  67. package/build/core/petition-run.js +6 -2
  68. package/build/core/petition.js +63 -21
  69. package/build/core/places.js +106 -13
  70. package/build/core/projection/generation.js +412 -0
  71. package/build/core/projection/heart.js +316 -0
  72. package/build/core/projection/identity.js +81 -0
  73. package/build/core/projection/leash.js +87 -0
  74. package/build/core/projection/mint.js +154 -0
  75. package/build/core/projection-activity.js +219 -0
  76. package/build/core/projection-coordinate.js +35 -0
  77. package/build/core/projection-core.js +69 -463
  78. package/build/core/projection-generation-continuation.js +31 -0
  79. package/build/core/projection-generation-execution.js +148 -0
  80. package/build/core/projection-generation-identity.js +17 -0
  81. package/build/core/projection-generation-launcher.js +90 -0
  82. package/build/core/projection-generation-process.js +43 -0
  83. package/build/core/projection-generation-runner.js +144 -0
  84. package/build/core/projection-generation-runtime.js +15 -0
  85. package/build/core/projection-generation-store.js +707 -0
  86. package/build/core/projection-identity.js +11 -0
  87. package/build/core/projection-life-observer.js +87 -0
  88. package/build/core/projection-life-protocol.js +95 -0
  89. package/build/core/projection-mint.js +96 -24
  90. package/build/core/projection-runner-lock.js +230 -0
  91. package/build/core/projection-status.js +207 -107
  92. package/build/core/projection-tells.js +401 -0
  93. package/build/core/projection-wait.js +155 -0
  94. package/build/core/projection-wake.js +109 -231
  95. package/build/core/queue_v2.js +342 -0
  96. package/build/core/registry.js +6 -3
  97. package/build/core/render.js +63 -1
  98. package/build/core/renew.js +80 -53
  99. package/build/core/scope.js +186 -137
  100. package/build/core/seal.js +16 -19
  101. package/build/core/status.js +88 -25
  102. package/build/core/stored-agent-event.js +101 -0
  103. package/build/core/transcripts.js +214 -228
  104. package/build/core/verdict.js +27 -15
  105. package/build/core/worktree-bootstrap.js +187 -0
  106. package/build/core/worktree-path.js +72 -18
  107. package/build/flow-error.js +4 -6
  108. package/build/generated/version.js +1 -1
  109. package/build/git/branches.js +6 -1
  110. package/build/index.js +8 -5
  111. package/build/keiyaku.js +1 -3
  112. package/package.json +6 -5
  113. package/skills/keiyaku/SKILL.md +6 -47
  114. package/skills/keiyaku-akuma/SKILL.md +75 -0
  115. package/build/agents/effective-policy.js +0 -32
  116. package/build/agents/index.js +0 -114
  117. package/build/agents/selector.js +0 -28
  118. package/build/cli/render/summon.js +0 -17
  119. package/build/cli/render/tell.js +0 -11
  120. package/build/config/akuma-loader.js +0 -268
  121. package/build/core/queue.js +0 -73
  122. package/build/core/summon-persist.js +0 -73
  123. package/build/core/summon.js +0 -377
package/README.md CHANGED
@@ -13,7 +13,7 @@ npm install -g @astrosheep/keiyaku
13
13
  Missing any of these? Don't come crying.
14
14
 
15
15
  - **Git repo.** Clean worktree. Dirty = refused.
16
- - **Supported providers.** `codex-sdk`, `claude-agent-sdk`, `opencode-sdk`. Runtime executables are `codex`, `claude`, and `opencode`.
16
+ - **Supported providers.** `codex-sdk`, `codex-app-server`, `claude-agent-sdk`, `opencode-sdk`, and `pi`.
17
17
 
18
18
  ---
19
19
 
@@ -26,16 +26,14 @@ Open a git repo. Run `keiyaku guide` and `keiyaku akuma list`. Then use `keiyaku
26
26
  ## Flow
27
27
 
28
28
  ```
29
- bind → round open → [summon/ask | amend | delivery work] → delivery commits → round close → [round open | amend | petition]
29
+ bind → arc → [call | amend | delivery work] → arc | renew | petition
30
30
  ```
31
31
 
32
32
  ---
33
33
 
34
34
  ## Tools
35
35
 
36
- **`summon <name> [prompt|-]`** — Calls in an agent to do scoped work. If a round is open, the round scope is injected. Add `--incognito` for a one-off run with no response history.
37
-
38
- `ask <name> [prompt|-]` is the short alias for the same behavior.
36
+ **`call <name> [prompt|-]`** — Calls in an agent to do scoped work. If a round is open, the round scope is injected. Add `--incognito` for a one-off run with no response history.
39
37
 
40
38
  ```
41
39
  Implement the retry tests. Report touched files and verification.
@@ -43,15 +41,15 @@ Implement the retry tests. Report touched files and verification.
43
41
 
44
42
  ---
45
43
 
46
- **`resume <response-path> [prompt|-]`** — Continues a prior summon session from a response artifact.
44
+ **`revive <response-path> [prompt|-]`** — Continues a prior call session from a response artifact.
47
45
 
48
46
  ```bash
49
- keiyaku resume .keiyaku/response/previous.md "Continue from here"
47
+ keiyaku revive .keiyaku/response/previous.md "Continue from here"
50
48
  ```
51
49
 
52
50
  ---
53
51
 
54
- **`akuma list` / `akuma show <name>`** — Inspect available helpers before choosing `keiyaku summon NAME`.
52
+ **`akuma list` / `akuma show <name>`** — Inspect available helpers before choosing `keiyaku call NAME`.
55
53
 
56
54
  ```bash
57
55
  keiyaku akuma list
@@ -76,7 +74,7 @@ bind:
76
74
 
77
75
  ---
78
76
 
79
- **`round open`** — Frame a delivery round before work starts.
77
+ **`arc`** — Frame the next delivery arc. An existing open arc is sealed first.
80
78
 
81
79
  ```
82
80
  # Retry backoff
@@ -85,19 +83,7 @@ bind:
85
83
  Implement retries with exponential backoff.
86
84
 
87
85
  ## Brief
88
- Keep the public API unchanged. Commit the delivery work before closing the round.
89
- ```
90
-
91
- ---
92
-
93
- **`round close`** — Record a completed round from git commits.
94
-
95
- ```
96
- ## Commits
97
- - abc1234
98
-
99
- ## Report
100
- Retry tests pass and backoff is now 2x.
86
+ Keep the public API unchanged. Commit the delivery work before sealing the arc.
101
87
  ```
102
88
 
103
89
  ---
@@ -112,7 +98,7 @@ Oath required unless you explicitly bypass gates. Configured verification and re
112
98
 
113
99
  **`status`** — Current state and what's blocking you.
114
100
 
115
- **`keiyaku guide`** — Full reference.
101
+ **`keiyaku guide`** — Workflow guide.
116
102
 
117
103
  ---
118
104
 
@@ -133,53 +119,84 @@ Don't want these tracked:
133
119
 
134
120
  ---
135
121
 
136
- ## Advanced
122
+ ## Configuration
123
+
124
+ Keiyaku works with its builtin `akuma-codex` and `akuma-claude` profiles without a settings file. Inspect the effective catalog before launching an Akuma:
137
125
 
138
126
  ```bash
139
- keiyaku dump-env
127
+ keiyaku akuma list
128
+ keiyaku akuma show akuma-codex
140
129
  ```
141
130
 
142
- Per-agent runtime settings live in `.keiyaku/settings.json` and use `provider` / `executable`:
131
+ ### Akuma profiles
132
+
133
+ Akuma profiles are Markdown files. The filename is the profile name, YAML frontmatter configures the provider, and the Markdown body supplies the Akuma instructions.
134
+
135
+ | Layer | Location | Precedence |
136
+ |---|---|---|
137
+ | Builtin | packaged with Keiyaku | lowest |
138
+ | User | `<KEIYAKU_HOME>/akuma/<name>.md` | replaces the same builtin name |
139
+ | Project | `.keiyaku/akuma/<name>.md` | highest |
140
+
141
+ `KEIYAKU_HOME` defaults to `~/.keiyaku`. A higher layer replaces the whole file; layers are not field-merged.
142
+
143
+ Minimal project profile:
144
+
145
+ ```markdown
146
+ ---
147
+ provider: codex-sdk
148
+ description: Repository implementation agent
149
+ model: gpt-5.4
150
+ effort: high
151
+ accessPolicy: write
152
+ networkPolicy: disabled
153
+ webSearchPolicy: disabled
154
+ threadOptions.sandboxMode: workspace-write
155
+ ---
156
+ Follow the repository instructions, make scoped changes, and run relevant tests.
157
+ ```
158
+
159
+ Provider fields:
160
+
161
+ | Provider | Supported profile fields |
162
+ |---|---|
163
+ | `codex-sdk` | `description`, `model`, `profile`, `executable`, `effort`, `accessPolicy`, `networkPolicy`, `webSearchPolicy`, `threadOptions.*`, `config.*` |
164
+ | `codex-app-server` | `description`, `model`, `profile`, `executable`, `config.*` |
165
+ | `claude-agent-sdk` | `description`, `model`, `executable`, `effort`, `permissionMode`, `settingSources` |
166
+ | `opencode-sdk` | `description`, `model`, `executable` |
167
+ | `pi` | `description`, `model` |
168
+
169
+ For `threadOptions.*`, JSON values such as arrays and objects are accepted. Keiyaku owns `workingDirectory` and `skipGitRepoCheck`, so profiles cannot set those paths.
170
+
171
+ ### Settings
172
+
173
+ Settings select roles and workflow knobs; provider definitions do not belong in settings. Keiyaku loads user settings first and overlays project settings:
174
+
175
+ - User: `<KEIYAKU_HOME>/settings.json`
176
+ - Project: `.keiyaku/settings.json`
143
177
 
144
178
  ```json
145
179
  {
146
- "agents": {
147
- "akuma-claude": {
148
- "provider": "claude-agent-sdk",
149
- "model": "claude-sonnet-4-5",
150
- "executable": "claude",
151
- "description": "Claude-side Akuma for review and integration.",
152
- "systemPromptFile": ".keiyaku/claude-system.md"
153
- },
154
- "akuma-codex": {
155
- "provider": "codex-sdk",
156
- "executable": "codex",
157
- "description": "Default Codex-side Akuma.",
158
- "config": {
159
- "developer_instructions": "Adapter-level instructions appended to Codex sessions."
160
- }
161
- },
162
- },
163
180
  "default": "akuma-codex",
164
- "reviewer": "akuma-codex"
181
+ "reviewer": "akuma-claude",
182
+ "defaultBranch": "main",
183
+ "gate": {
184
+ "commands": [
185
+ { "label": "tests", "command": "npm", "args": ["test"] }
186
+ ]
187
+ }
165
188
  }
166
189
  ```
167
190
 
168
- Claude defaults:
169
- - `settingSources: ["project"]`
170
- - `permissionMode: "bypassPermissions"`
171
- - `keiyaku resume RESPONSE_PATH` resumes via persisted provider session metadata
191
+ The only settings keys are `default`, `reviewer`, `defaultBranch`, and `gate`. The former `agents` key is invalid; define profiles in an `akuma/` directory instead. `keiyaku status` reports invalid settings without hiding the rest of the board.
172
192
 
173
- Codex SDK notes:
174
- - `config` is passed through to Codex. Use `developer_instructions` for adapter-level instructions.
175
- - `model_instructions_file` is also accepted through `config`, but it replaces Codex built-in instructions.
193
+ ### Environment
176
194
 
177
- `keiyaku akuma list` and `keiyaku akuma ls` show each profile's description when present.
195
+ ```bash
196
+ keiyaku dump-env
197
+ ```
178
198
 
179
- | Variable | Default | |
180
- |----------|---------|--|
181
- | `KEIYAKU_SUBAGENT_EXEC_TIMEOUT_MS` | — | Execution timeout |
182
- | `KEIYAKU_SUBAGENT_EXEC_IDLE_TIMEOUT_MS` | — | Idle timeout |
199
+ Keiyaku loads `<KEIYAKU_HOME>/.env`, then `.keiyaku/.env`; values already present in the process environment take precedence. `dump-env` is the authoritative template for supported keys and defaults.
183
200
 
184
201
  ---
185
202