@astrosheep/keiyaku 4.0.0 → 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.
- package/README.md +133 -8
- package/build/integrations/marketplace/plugins/keiyaku/.claude-plugin/plugin.json +2 -2
- package/build/integrations/marketplace/plugins/keiyaku/.codex-plugin/plugin.json +4 -4
- package/build/integrations/marketplace/plugins/keiyaku/opencode.js +2 -2
- package/build/integrations/marketplace/plugins/keiyaku/package.json +2 -2
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +13 -5
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +91 -32
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +134 -0
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/agents/openai.yaml +4 -0
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-task/SKILL.md +41 -6
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +262 -46
- package/build/src/akuma/abort.d.ts +2 -0
- package/build/src/akuma/abort.js +50 -0
- package/build/src/akuma/akuma.d.ts +50 -33
- package/build/src/akuma/akuma.js +175 -127
- package/build/src/akuma/archetype.d.ts +14 -5
- package/build/src/akuma/archetype.js +85 -39
- package/build/src/akuma/body.d.ts +3 -5
- package/build/src/akuma/body.js +490 -183
- package/build/src/akuma/coordinate.d.ts +9 -0
- package/build/src/akuma/coordinate.js +22 -0
- package/build/src/akuma/heart/facts.d.ts +88 -45
- package/build/src/akuma/heart/facts.js +19 -8
- package/build/src/akuma/heart/index.d.ts +64 -55
- package/build/src/akuma/heart/index.js +172 -252
- package/build/src/akuma/heart/rows.d.ts +38 -83
- package/build/src/akuma/heart/rows.js +117 -155
- package/build/src/akuma/heart/schema.d.ts +1 -1
- package/build/src/akuma/heart/schema.js +61 -22
- package/build/src/akuma/heart/soul.d.ts +8 -0
- package/build/src/akuma/heart/soul.js +136 -0
- package/build/src/akuma/heart/storage.d.ts +47 -0
- package/build/src/akuma/heart/storage.js +224 -0
- package/build/src/akuma/heart/tells.d.ts +12 -0
- package/build/src/akuma/heart/tells.js +79 -0
- package/build/src/akuma/heart/timeline.d.ts +15 -0
- package/build/src/akuma/heart/timeline.js +86 -0
- package/build/src/akuma/identity.d.ts +2 -2
- package/build/src/akuma/identity.js +9 -9
- package/build/src/akuma/index.d.ts +10 -3
- package/build/src/akuma/index.js +7 -1
- package/build/src/akuma/projection.d.ts +176 -0
- package/build/src/akuma/projection.js +256 -0
- package/build/src/akuma/provider-recipe.d.ts +24 -0
- package/build/src/akuma/provider-recipe.js +100 -0
- package/build/src/akuma/provider.d.ts +67 -13
- package/build/src/akuma/provider.js +172 -105
- package/build/src/akuma/providers/acp/core.d.ts +19 -0
- package/build/src/akuma/providers/acp/core.js +159 -0
- package/build/src/akuma/providers/acp/events.d.ts +20 -0
- package/build/src/akuma/providers/acp/events.js +73 -0
- package/build/src/akuma/providers/acp/index.d.ts +12 -0
- package/build/src/akuma/providers/acp/index.js +94 -0
- package/build/src/akuma/providers/{claude.d.ts → claude/events.d.ts} +9 -41
- package/build/src/akuma/providers/claude/events.js +238 -0
- package/build/src/akuma/providers/claude/index.d.ts +47 -0
- package/build/src/akuma/providers/claude/index.js +279 -0
- package/build/src/akuma/providers/claude/input.d.ts +13 -0
- package/build/src/akuma/providers/claude/input.js +109 -0
- package/build/src/akuma/providers/codex-app-server/events.d.ts +1 -1
- package/build/src/akuma/providers/codex-app-server/events.js +15 -12
- package/build/src/akuma/providers/codex-app-server/index.d.ts +15 -13
- package/build/src/akuma/providers/codex-app-server/index.js +77 -33
- package/build/src/akuma/providers/grok-build/index.d.ts +4 -0
- package/build/src/akuma/providers/grok-build/index.js +70 -0
- package/build/src/akuma/providers/index.d.ts +5 -3
- package/build/src/akuma/providers/index.js +35 -56
- package/build/src/akuma/providers/opencode-sdk/events.d.ts +54 -0
- package/build/src/akuma/providers/opencode-sdk/events.js +235 -0
- package/build/src/akuma/providers/opencode-sdk/index.d.ts +33 -0
- package/build/src/akuma/providers/opencode-sdk/index.js +308 -0
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +26 -0
- package/build/src/akuma/providers/opencode-sdk/session.js +63 -0
- package/build/src/akuma/providers/pi/events.d.ts +33 -0
- package/build/src/akuma/providers/pi/events.js +166 -0
- package/build/src/akuma/providers/pi/index.d.ts +11 -0
- package/build/src/akuma/providers/pi/index.js +191 -0
- package/build/src/akuma/publication.d.ts +3 -3
- package/build/src/akuma/publication.js +28 -40
- package/build/src/akuma/requests.d.ts +9 -6
- package/build/src/akuma/requests.js +95 -65
- package/build/src/alias/index.d.ts +4 -3
- package/build/src/alias/index.js +12 -13
- package/build/src/body/decode.js +7 -1
- package/build/src/body/region.d.ts +2 -0
- package/build/src/body/region.js +77 -7
- package/build/src/body/render.js +2 -1
- package/build/src/body/shape.js +7 -1
- package/build/src/body/verification.js +19 -4
- package/build/src/cli/accepted.d.ts +18 -12
- package/build/src/cli/accepted.js +73 -34
- package/build/src/cli/actor.js +3 -3
- package/build/src/cli/commands/akuma-invoke.d.ts +44 -19
- package/build/src/cli/commands/akuma-invoke.js +101 -52
- package/build/src/cli/commands/akuma.d.ts +27 -9
- package/build/src/cli/commands/akuma.js +151 -80
- package/build/src/cli/commands/contract.d.ts +155 -0
- package/build/src/cli/commands/contract.js +20 -0
- package/build/src/cli/commands/install.js +2 -0
- package/build/src/cli/commands/task-invoke.d.ts +19 -4
- package/build/src/cli/commands/task-invoke.js +65 -17
- package/build/src/cli/commands/task-query.d.ts +5 -0
- package/build/src/cli/commands/task-query.js +247 -0
- package/build/src/cli/commands/task.d.ts +3 -1
- package/build/src/cli/commands/task.js +52 -14
- package/build/src/cli/coordinates.d.ts +18 -0
- package/build/src/cli/coordinates.js +120 -0
- package/build/src/cli/draft.d.ts +8 -0
- package/build/src/cli/draft.js +96 -0
- package/build/src/cli/invoke.d.ts +9 -3
- package/build/src/cli/invoke.js +287 -108
- package/build/src/cli/main.js +54 -7
- package/build/src/cli/parse.d.ts +21 -117
- package/build/src/cli/parse.js +79 -84
- package/build/src/cli/render/akuma-tool-command.d.ts +6 -0
- package/build/src/cli/render/akuma-tool-command.js +144 -0
- package/build/src/cli/render/akuma-tool.d.ts +4 -2
- package/build/src/cli/render/akuma-tool.js +35 -5
- package/build/src/cli/render/akuma.d.ts +3 -1
- package/build/src/cli/render/akuma.js +247 -212
- package/build/src/cli/render/audit.d.ts +3 -0
- package/build/src/cli/render/audit.js +104 -0
- package/build/src/cli/render/catalog.d.ts +2 -0
- package/build/src/cli/render/catalog.js +16 -0
- package/build/src/cli/render/contract.d.ts +3 -3
- package/build/src/cli/render/contract.js +200 -54
- package/build/src/cli/render/kanshi.js +272 -129
- package/build/src/cli/render/receipt.d.ts +19 -0
- package/build/src/cli/render/receipt.js +106 -0
- package/build/src/cli/render/refusal.d.ts +16 -2
- package/build/src/cli/render/refusal.js +88 -3
- package/build/src/cli/render/region.d.ts +2 -0
- package/build/src/cli/render/region.js +17 -0
- package/build/src/cli/render/task.d.ts +2 -1
- package/build/src/cli/render/task.js +223 -60
- package/build/src/cli/render/terminal.d.ts +20 -0
- package/build/src/cli/render/terminal.js +121 -0
- package/build/src/cli/render/text.js +11 -3
- package/build/src/cli/result.d.ts +126 -19
- package/build/src/cli/usage.d.ts +1 -0
- package/build/src/cli/usage.js +3 -0
- package/build/src/contract-worktree.d.ts +44 -0
- package/build/src/contract-worktree.js +251 -0
- package/build/src/coordination/durable-file.d.ts +5 -1
- package/build/src/coordination/durable-file.js +57 -10
- package/build/src/coordination/sqlite-transaction-lock.d.ts +4 -0
- package/build/src/coordination/sqlite-transaction-lock.js +22 -5
- package/build/src/core/facts/codec.js +23 -4
- package/build/src/core/facts/eligibility.d.ts +1 -10
- package/build/src/core/facts/eligibility.js +0 -49
- package/build/src/core/facts/fold.js +1 -6
- package/build/src/core/facts/gate.d.ts +1 -0
- package/build/src/core/facts/gate.js +1 -0
- package/build/src/core/facts/observation.d.ts +3 -0
- package/build/src/core/facts/observation.js +12 -0
- package/build/src/core/facts/types.d.ts +10 -3
- package/build/src/core/subject.js +2 -2
- package/build/src/core/verbs/amend.d.ts +1 -1
- package/build/src/core/verbs/amend.js +3 -18
- package/build/src/core/verbs/bind.js +2 -16
- package/build/src/core/verbs/deliver.d.ts +1 -1
- package/build/src/core/verbs/deliver.js +14 -4
- package/build/src/core/verbs/placement.d.ts +1 -1
- package/build/src/core/verbs/placement.js +7 -9
- package/build/src/dispatch/index.d.ts +5 -3
- package/build/src/dispatch/index.js +30 -21
- package/build/src/duration.d.ts +10 -0
- package/build/src/duration.js +22 -0
- package/build/src/git/admission.d.ts +2 -2
- package/build/src/git/admission.js +33 -23
- package/build/src/git/hooks.d.ts +15 -0
- package/build/src/git/hooks.js +70 -18
- package/build/src/git/identity.d.ts +5 -1
- package/build/src/git/identity.js +23 -4
- package/build/src/git/integration.d.ts +48 -0
- package/build/src/git/integration.js +250 -0
- package/build/src/git/observe.d.ts +29 -15
- package/build/src/git/observe.js +185 -76
- package/build/src/git/read-observation.d.ts +41 -0
- package/build/src/git/read-observation.js +361 -0
- package/build/src/git/reconcile.d.ts +17 -5
- package/build/src/git/reconcile.js +305 -109
- package/build/src/git/repository.d.ts +41 -18
- package/build/src/git/repository.js +220 -114
- package/build/src/git/scratch.d.ts +17 -0
- package/build/src/git/scratch.js +73 -0
- package/build/src/git/target-placement.d.ts +92 -0
- package/build/src/git/target-placement.js +375 -0
- package/build/src/git/tender.d.ts +49 -0
- package/build/src/git/tender.js +63 -0
- package/build/src/git/terminal-seal.d.ts +24 -0
- package/build/src/git/terminal-seal.js +89 -0
- package/build/src/git/tree.d.ts +2 -2
- package/build/src/git/tree.js +4 -0
- package/build/src/git/workspace.d.ts +53 -0
- package/build/src/git/workspace.js +139 -0
- package/build/src/identity/selector.d.ts +6 -0
- package/build/src/identity/selector.js +19 -0
- package/build/src/index.d.ts +4 -2
- package/build/src/index.js +2 -1
- package/build/src/kanshi/index.d.ts +2 -2
- package/build/src/kanshi/index.js +1 -1
- package/build/src/kanshi/read.d.ts +7 -3
- package/build/src/kanshi/read.js +245 -45
- package/build/src/kanshi/report.d.ts +81 -6
- package/build/src/kanshi/select.d.ts +5 -0
- package/build/src/kanshi/select.js +33 -1
- package/build/src/library/address.d.ts +57 -0
- package/build/src/library/address.js +165 -0
- package/build/src/library/akuma-creation.d.ts +16 -7
- package/build/src/library/akuma-creation.js +96 -22
- package/build/src/library/audit.d.ts +18 -0
- package/build/src/library/audit.js +44 -0
- package/build/src/library/bind.d.ts +21 -0
- package/build/src/library/bind.js +56 -0
- package/build/src/library/catalog.d.ts +58 -0
- package/build/src/library/catalog.js +69 -0
- package/build/src/library/configuration.d.ts +6 -15
- package/build/src/library/configuration.js +14 -17
- package/build/src/library/contract.d.ts +23 -49
- package/build/src/library/contract.js +171 -185
- package/build/src/library/delivery.d.ts +24 -0
- package/build/src/library/delivery.js +21 -0
- package/build/src/library/fleet.d.ts +65 -0
- package/build/src/library/fleet.js +153 -0
- package/build/src/library/input.d.ts +3 -0
- package/build/src/library/input.js +19 -0
- package/build/src/library/keiyaku.d.ts +18 -3
- package/build/src/library/keiyaku.js +12 -1
- package/build/src/library/mutation.d.ts +39 -0
- package/build/src/library/mutation.js +37 -0
- package/build/src/library/reconcile.d.ts +29 -0
- package/build/src/library/reconcile.js +179 -0
- package/build/src/library/refusal.d.ts +21 -0
- package/build/src/library/refusal.js +29 -0
- package/build/src/library/region.d.ts +14 -1
- package/build/src/library/region.js +18 -4
- package/build/src/library/repo.d.ts +4 -13
- package/build/src/library/repo.js +14 -24
- package/build/src/protocol/attempt.d.ts +16 -3
- package/build/src/protocol/attempt.js +41 -10
- package/build/src/protocol/bind.d.ts +9 -2
- package/build/src/protocol/bind.js +48 -40
- package/build/src/protocol/intent.d.ts +57 -20
- package/build/src/protocol/intent.js +55 -79
- package/build/src/protocol/operations.d.ts +152 -43
- package/build/src/protocol/operations.js +482 -166
- package/build/src/protocol/outcome.d.ts +14 -3
- package/build/src/protocol/outcome.js +11 -3
- package/build/src/protocol/placement.d.ts +41 -0
- package/build/src/protocol/placement.js +147 -0
- package/build/src/protocol/read/documents.d.ts +2 -2
- package/build/src/protocol/read/documents.js +4 -4
- package/build/src/protocol/read/status.d.ts +18 -5
- package/build/src/protocol/read/status.js +73 -13
- package/build/src/protocol/run.d.ts +49 -7
- package/build/src/protocol/run.js +53 -25
- package/build/src/runtime/proc/line-rpc.d.ts +4 -8
- package/build/src/runtime/proc/line-rpc.js +22 -28
- package/build/src/runtime/proc/run.d.ts +23 -21
- package/build/src/runtime/proc/run.js +123 -89
- package/build/src/runtime/proc/stdio.d.ts +18 -0
- package/build/src/runtime/proc/stdio.js +58 -0
- package/build/src/settings.d.ts +7 -1
- package/build/src/settings.js +32 -17
- package/build/src/settlement/fence.d.ts +5 -0
- package/build/src/settlement/fence.js +14 -0
- package/build/src/settlement/holder.d.ts +35 -4
- package/build/src/settlement/holder.js +127 -28
- package/build/src/settlement/settle.d.ts +9 -1
- package/build/src/settlement/settle.js +74 -37
- package/build/src/task/board.d.ts +23 -5
- package/build/src/task/board.js +17 -10
- package/build/src/task/compose.d.ts +2 -2
- package/build/src/task/compose.js +18 -10
- package/build/src/task/context.d.ts +3 -3
- package/build/src/task/context.js +15 -20
- package/build/src/task/document.d.ts +2 -1
- package/build/src/task/document.js +15 -5
- package/build/src/task/index.d.ts +27 -15
- package/build/src/task/index.js +57 -35
- package/build/src/task/operations.d.ts +38 -13
- package/build/src/task/operations.js +80 -46
- package/build/src/task/query.d.ts +67 -0
- package/build/src/task/query.js +279 -0
- package/build/src/task/store.d.ts +5 -7
- package/build/src/task/store.js +43 -28
- package/build/src/verification/declaration.d.ts +1 -0
- package/build/src/verification/execution.d.ts +51 -0
- package/build/src/verification/execution.js +108 -0
- package/build/src/workspace-place.d.ts +41 -0
- package/build/src/workspace-place.js +386 -0
- package/build/src/world.d.ts +24 -0
- package/build/src/world.js +136 -0
- package/package.json +8 -4
- package/build/src/akuma/activity.d.ts +0 -66
- package/build/src/akuma/activity.js +0 -139
- package/build/src/akuma/providers/claude.js +0 -305
- package/build/src/context-root.d.ts +0 -4
- package/build/src/context-root.js +0 -15
- package/build/src/git/delivery.d.ts +0 -20
- package/build/src/git/delivery.js +0 -109
- package/build/src/git/verification.d.ts +0 -14
- package/build/src/git/verification.js +0 -56
- package/build/src/protocol/read/audit.d.ts +0 -25
- package/build/src/protocol/read/audit.js +0 -39
- package/build/src/verification/producer.d.ts +0 -23
- package/build/src/verification/producer.js +0 -54
|
@@ -1,72 +1,288 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: keiyaku-workflow
|
|
3
|
-
description: Use when authoring, binding, delivering, reviewing, amending,
|
|
3
|
+
description: Use when authoring, binding, auditing, delivering, reviewing, amending, or abandoning a Keiyaku v4 Contract.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Keiyaku Workflow
|
|
7
7
|
|
|
8
|
-
A Contract
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Akuma execution remain separate products.
|
|
8
|
+
A Contract turns one bounded delivery into acceptable terms: bind it, work in
|
|
9
|
+
the appointed worktree, audit the Contract, deliver, then review. When every
|
|
10
|
+
declared gate is current, the result lands on the target ref.
|
|
12
11
|
|
|
13
|
-
##
|
|
12
|
+
## How The Delivery Moves
|
|
14
13
|
|
|
15
14
|
```text
|
|
16
|
-
bind ->
|
|
17
|
-
|
|
15
|
+
contract document -> bind -> work -> audit -> deliver -> review gates
|
|
16
|
+
-> placement -> claimed
|
|
17
|
+
\-> abandoned
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
The lifecycle is `waiting -> bound -> pending-delivery -> claimed | abandoned`;
|
|
21
|
+
the last two are terminal. Reserve `--after` for true logical ordering: one
|
|
22
|
+
Contract's result must ultimately build on another's settled outcome, or their
|
|
23
|
+
intended work has a large or irreconcilable interaction that should be
|
|
24
|
+
sequenced. Ordinary Region overlap is not enough. Small overlaps may proceed
|
|
25
|
+
under Git's optimistic write model and be resolved manually or by a delegated
|
|
26
|
+
worker. At runtime prerequisites are placement obligations, not a delivery
|
|
27
|
+
admission gate: a Contract may record `bound` and deliver before they claim,
|
|
28
|
+
while placement waits for the current prerequisites and declared gates. Active
|
|
29
|
+
terms may amend `--after` after `bound` or `deliver`; terminal Contracts remain
|
|
30
|
+
immutable. You never push it through states by hand: `deliver` and satisfied
|
|
31
|
+
reviews request placement, and placement claims when every prerequisite and
|
|
32
|
+
gate allows it.
|
|
26
33
|
|
|
27
34
|
## Bind
|
|
28
35
|
|
|
29
|
-
|
|
36
|
+
Use `keiyaku-bind` to decide readiness, author one bounded Contract, choose
|
|
37
|
+
bind inputs, and read the receipt. Continue here from that receipt.
|
|
38
|
+
|
|
39
|
+
## Work In The Contract Worktree
|
|
40
|
+
|
|
41
|
+
Change and test code in the worktree the bind receipt names. `deliver` accepts
|
|
42
|
+
a clean worktree by default. You may commit first, or explicitly include all
|
|
43
|
+
non-ignored staged, unstaged, and untracked final bytes with
|
|
44
|
+
`deliver --include-dirty`.
|
|
45
|
+
|
|
46
|
+
## Regain The Picture
|
|
47
|
+
|
|
48
|
+
Rebuild state from reads, not memory — after a compact, a handoff, or any
|
|
49
|
+
surprising receipt, read before acting:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
keiyaku status # the whole board
|
|
53
|
+
keiyaku status <contract> # lifecycle, candidate, one mark per gate
|
|
54
|
+
keiyaku show <contract> # the exact current Contract terms
|
|
55
|
+
keiyaku region # every active Contract's declared surfaces
|
|
56
|
+
keiyaku region <contract> # one Contract's declared intent
|
|
57
|
+
keiyaku region --overlap # which declared intents intersect
|
|
58
|
+
keiyaku region --path <path> # which active Contracts declare this path
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`status` marks each gate: `✓` current satisfied, `!` current unsatisfied, `?`
|
|
62
|
+
stale because the patch or document changed after the evidence, `○` missing.
|
|
63
|
+
A Region is a Contract's declared write intent — not ownership, not a gate,
|
|
64
|
+
and not a Git conflict. Read the world before decomposing or commissioning
|
|
65
|
+
into an occupied repository; read `--overlap` before choosing a landing order
|
|
66
|
+
or an `--after` edge; read `--path` before touching a file that may belong to
|
|
67
|
+
another lane. Regions are declarations only, a coarse planning signal: actual
|
|
68
|
+
touched paths and conflicts remain Git's.
|
|
69
|
+
|
|
70
|
+
## Commission A Contract
|
|
71
|
+
|
|
72
|
+
When another agent will fulfill or review the Contract, the commissioning
|
|
73
|
+
harness must pass one explicit seat and one exact worktree. `--contract` or an
|
|
74
|
+
equivalent association identifies the Contract; it does not appoint a seat.
|
|
75
|
+
Never ask the worker to infer either value.
|
|
76
|
+
|
|
77
|
+
Use this minimum handoff in the dispatch body, regardless of harness:
|
|
78
|
+
|
|
79
|
+
```text
|
|
80
|
+
Contract: kei/...
|
|
81
|
+
Seat: Deliverer | Reviewer
|
|
82
|
+
Worktree: /absolute/path/from-the-bind-receipt
|
|
83
|
+
Read first:
|
|
84
|
+
- .keiyaku/KEIYAKU.md
|
|
85
|
+
- <owner documents governing this delivery>
|
|
86
|
+
- <source files named or selected from the Contract Region for this work>
|
|
87
|
+
Objective:
|
|
88
|
+
<bounded assignment>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Every `Read first` path is relative to `Worktree` unless it is absolute. The
|
|
92
|
+
worker starts by reading `.keiyaku/KEIYAKU.md` in that worktree, confirms its
|
|
93
|
+
frontmatter names `Contract`, then reads the listed owner documents and source
|
|
94
|
+
files before acting. Do not substitute a generic repository tour for the files
|
|
95
|
+
that actually govern the assignment.
|
|
96
|
+
|
|
97
|
+
A `Deliverer` implements and verifies the terms in `Worktree`. Commission a
|
|
98
|
+
`Reviewer` after delivery. The reviewer inspects the complete current Contract
|
|
99
|
+
worktree snapshot, not a worker report or named candidate commit, and does not
|
|
100
|
+
modify it. Missing or contradictory seat, worktree, or reading list means stop
|
|
101
|
+
and ask.
|
|
102
|
+
|
|
103
|
+
Observe commissioned workers through their Contract association instead of
|
|
104
|
+
collecting Aku ids by hand:
|
|
30
105
|
|
|
31
106
|
```bash
|
|
32
|
-
keiyaku
|
|
33
|
-
keiyaku
|
|
34
|
-
keiyaku bind --here -
|
|
35
|
-
keiyaku bind --after <kei/...> --gates <name> -
|
|
107
|
+
keiyaku wait kei/<contract> --all --timeout 5m
|
|
108
|
+
keiyaku wait kei/<first> kei/<second> --any --timeout 5m
|
|
36
109
|
```
|
|
37
110
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
111
|
+
A Contract selector snapshots its dispatched workers when the command starts.
|
|
112
|
+
Use `--all` to wait for every selected worker or `--any` to return when one
|
|
113
|
+
finishes; an expanded set with more than one worker requires an explicit mode.
|
|
114
|
+
|
|
115
|
+
## Decompose Complex Work
|
|
116
|
+
|
|
117
|
+
Complex Keiyaku should be divided along independently acceptable delivery
|
|
118
|
+
boundaries. Use judgment to find those boundaries from the work's objectives,
|
|
119
|
+
dependencies, Regions, and acceptance criteria; raw size or file count is not
|
|
120
|
+
the test. Give each resulting Contract coherent terms. Connect them with
|
|
121
|
+
`--after` only when one must proceed from another's settled result or their
|
|
122
|
+
intended work is unsafe to run concurrently.
|
|
42
123
|
|
|
43
|
-
|
|
124
|
+
When a complex Keiyaku cannot be split without breaking one acceptance
|
|
125
|
+
boundary, organize its fulfillment into arcs. Do not hand the whole
|
|
126
|
+
undifferentiated Contract to one Deliverer and trust one pass to finish it.
|
|
127
|
+
Record and work one current chapter at a time.
|
|
128
|
+
|
|
129
|
+
An arc is a chapter as in a work of literature: one named part of the
|
|
130
|
+
delivery's story, not a task list, progress slice, or claim that the work is
|
|
131
|
+
mechanically sequential. Its title names the chapter, Objective states that
|
|
132
|
+
chapter's aim, and Brief commissions work for that chapter. When an Arc is
|
|
133
|
+
active, stay within that current chapter. `.keiyaku/KEIYAKU.md` renders the
|
|
134
|
+
current Arc.
|
|
135
|
+
Record the next chapter before entering it:
|
|
44
136
|
|
|
45
137
|
```bash
|
|
46
|
-
keiyaku
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
138
|
+
keiyaku arc <contract> - <<'KEIYAKU'
|
|
139
|
+
# <chapter title>
|
|
140
|
+
|
|
141
|
+
## Objective
|
|
142
|
+
<nonblank objective>
|
|
143
|
+
|
|
144
|
+
## Brief
|
|
145
|
+
<nonblank dispatch brief>
|
|
146
|
+
KEIYAKU
|
|
54
147
|
```
|
|
55
148
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
149
|
+
All chapters live inside that Contract's single delivery and acceptance
|
|
150
|
+
boundary. The document grammar authority is `docs/document.md`.
|
|
151
|
+
|
|
152
|
+
## Amend Or Start Over
|
|
153
|
+
|
|
154
|
+
Use `amend` when a discovery during the same delivery changes terms but the
|
|
155
|
+
original Objective, Design, and acceptance boundary still truthfully describe
|
|
156
|
+
the result:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
keiyaku amend <contract> -
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
See `amend --help` for the operation grammar. If the objective or boundary
|
|
163
|
+
itself changed, `abandon` with a note and bind a new Contract; do not steer an
|
|
164
|
+
old Contract onto a different delivery.
|
|
165
|
+
|
|
166
|
+
## Audit Before Delivery
|
|
167
|
+
|
|
168
|
+
Audit is how you see a delivery before it exists:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
keiyaku audit <contract> --diff
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Audit answers three already-adjudicated questions: candidate, Verification,
|
|
175
|
+
and target. It uses the same candidate preparation as deliver, shows the
|
|
176
|
+
prospective identity and optional requested diff, and runs declared
|
|
177
|
+
Verification against that candidate. A terminal run records ordinary
|
|
178
|
+
subject-bound `verified` testimony; it does not record a delivery or request
|
|
179
|
+
placement. Read those three answers instead of trusting a worker's completion
|
|
180
|
+
report.
|
|
181
|
+
|
|
182
|
+
## Deliver
|
|
183
|
+
|
|
184
|
+
Deliver when the worktree content is the candidate you intend to land:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
keiyaku deliver <contract>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
`deliver` freshly tenders the clean `HEAD`, records the candidate, and requests
|
|
191
|
+
placement. When a current audit attestation names the identical integration
|
|
192
|
+
snapshot and Verification segment, deliver reuses it; otherwise it runs the
|
|
193
|
+
declarations. Worktree, target, policy, document, Verification, or
|
|
194
|
+
snapshot-producing option changes prevent reuse. If the workspace is dirty, the refusal
|
|
195
|
+
lists staged, unstaged, and untracked paths, a short statistic, and the
|
|
196
|
+
`--include-dirty` option. Use that option only when the complete current
|
|
197
|
+
workspace is the intended delivery; dirty submodule internals cannot be
|
|
198
|
+
included. Read the receipt:
|
|
199
|
+
|
|
200
|
+
- When every gate is current, the receipt shows placement and `claimed`; the
|
|
201
|
+
delivery is done.
|
|
202
|
+
- When a gate is not current, the receipt shows the recorded candidate and the
|
|
203
|
+
placement stop. This is not a failed delivery. The Contract stays
|
|
204
|
+
`pending-delivery` while you complete the gates.
|
|
205
|
+
- A lag row reports an accepted physical effect that has not finished. The
|
|
206
|
+
delivery stands; `reconcile` completes the effect later. It never changes
|
|
207
|
+
the verdict.
|
|
208
|
+
|
|
209
|
+
## Review Gates
|
|
210
|
+
|
|
211
|
+
A `reviewed` gate wants a recorded judgment of the current patch:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
keiyaku review <contract> --satisfied --summary "<conclusion>"
|
|
215
|
+
keiyaku review <contract> --unsatisfied --summary "<finding>"
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Have an independent reviewer inspect the delivered Contract worktree snapshot.
|
|
219
|
+
The `review` command records the verdict. `--satisfied` requests placement; if
|
|
220
|
+
the other gates are current, the receipt shows `claimed`.
|
|
221
|
+
|
|
222
|
+
Fixing findings changes the patch and makes earlier evidence stale (`?` in
|
|
223
|
+
`status`). Audit the rework, deliver it, then review again. Record
|
|
224
|
+
`--unsatisfied` only when the negative judgment should remain in Contract
|
|
225
|
+
history.
|
|
226
|
+
|
|
227
|
+
## When Multiple Contracts Overlap On One Target
|
|
228
|
+
|
|
229
|
+
When active Contracts write a shared surface, landing order is a coordinator
|
|
230
|
+
judgment, not Contract state. Keep the decision in the workflow skill; do not
|
|
231
|
+
persist a train or add a second placement authority.
|
|
232
|
+
|
|
233
|
+
- `audit` and a reviewer's report are preliminary. `review --satisfied` is
|
|
234
|
+
authoritative gate testimony: it requests placement and claims when
|
|
235
|
+
delivery, prerequisites, and all gates are current. Record it only when the
|
|
236
|
+
reviewed bytes are intended to land now.
|
|
237
|
+
- Before recording a satisfied review, or delivering a Contract with no
|
|
238
|
+
declared gates, ask whether the exact patch will survive until placement. A
|
|
239
|
+
pure rebase whose `ChangeId` is unchanged keeps the existing review current;
|
|
240
|
+
do not re-review content addressing kept alive. Conflict resolution that
|
|
241
|
+
changes the `ChangeId` makes earlier testimony stale and requires a fresh
|
|
242
|
+
review against the resolved candidate.
|
|
243
|
+
- For Contracts known to overlap, resolve the current-target integration before
|
|
244
|
+
the authoritative review. Preliminary feedback may happen earlier, but it
|
|
245
|
+
is not a satisfied gate until its reviewed patch is the candidate intended
|
|
246
|
+
for placement. Land overlapping Contracts one at a time; let independent,
|
|
247
|
+
non-overlapping Contracts proceed without ceremony. Treat overlap as a
|
|
248
|
+
planning signal, not a correctness verdict.
|
|
249
|
+
- After target movement, a changed candidate, or a placement refusal, read the
|
|
250
|
+
current Contract facts again. Recompute the next landing judgment from those
|
|
251
|
+
facts; do not rely on a remembered queue or promise exactly one rebase.
|
|
252
|
+
|
|
253
|
+
## Target Placement
|
|
254
|
+
|
|
255
|
+
Placement follows the Git mental model you already have:
|
|
256
|
+
|
|
257
|
+
- Delivering from a managed worktree to a checked-out target behaves like a
|
|
258
|
+
merge. Non-overlapping staged, unstaged, and untracked files in that checkout
|
|
259
|
+
are preserved. A staged path refuses only when Git cannot carry it through
|
|
260
|
+
the predecessor-to-candidate merge; overlapping worktree changes and
|
|
261
|
+
colliding untracked files also refuse. The receipt lists the exact paths.
|
|
262
|
+
The deliver or review you just ran still counts: the recorded candidate and
|
|
263
|
+
any `✓ reviewed` verdict are kept, but nothing claims and nothing moves.
|
|
264
|
+
The target ref, its checkout, and your bytes stay exactly where they were,
|
|
265
|
+
and the Contract stays `pending-delivery`.
|
|
266
|
+
- A `--here` Contract behaves like a commit with gates: it lands on the current
|
|
267
|
+
branch and cannot deliver to a foreign checked-out target.
|
|
268
|
+
|
|
269
|
+
After a refusal, handle the listed paths, then `deliver` again or record a
|
|
270
|
+
satisfied review; either command requests placement again.
|
|
271
|
+
|
|
272
|
+
## Recover Or End
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
keiyaku reconcile <contract> # finish accepted lagging effects
|
|
276
|
+
keiyaku abandon <contract> --note "<why>" # terminal; target untouched
|
|
277
|
+
```
|
|
62
278
|
|
|
63
|
-
|
|
279
|
+
`reconcile` completes physical effects of already accepted placements; it does
|
|
280
|
+
not retry an ordinary placement refusal. `abandon` ends the Contract and never
|
|
281
|
+
touches the target.
|
|
64
282
|
|
|
65
|
-
|
|
66
|
-
abandoned fact and does not touch a target ref. There is no `petition`, `claim`,
|
|
67
|
-
`forfeit`, `renew`, or `bind --task` command in v4. A successful placement
|
|
68
|
-
produces the claimed terminal state; inspect the typed result and decide what
|
|
69
|
-
to do next.
|
|
283
|
+
## Routine Output
|
|
70
284
|
|
|
71
|
-
Use default text output for
|
|
72
|
-
needs the public result
|
|
285
|
+
Use default text output for normal operation and `--json` only when a script
|
|
286
|
+
needs the public result. Use the complete `kei/...` ID, or `@...` inside a
|
|
287
|
+
managed worktree. When a flag or stdin form is unclear, read that command's
|
|
288
|
+
`--help` instead of guessing.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export function abortable(operation, signal, disposeLate) {
|
|
2
|
+
signal.throwIfAborted();
|
|
3
|
+
return new Promise((resolve, reject) => {
|
|
4
|
+
let aborted = false;
|
|
5
|
+
const abort = () => {
|
|
6
|
+
aborted = true;
|
|
7
|
+
if (disposeLate === undefined)
|
|
8
|
+
reject(signal.reason);
|
|
9
|
+
};
|
|
10
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
11
|
+
if (signal.aborted)
|
|
12
|
+
abort();
|
|
13
|
+
void operation.then(async (value) => {
|
|
14
|
+
signal.removeEventListener("abort", abort);
|
|
15
|
+
if (!aborted) {
|
|
16
|
+
resolve(value);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
await disposeLate?.(value);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
reject(error);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
reject(signal.reason);
|
|
27
|
+
}, (error) => {
|
|
28
|
+
signal.removeEventListener("abort", abort);
|
|
29
|
+
reject(aborted ? signal.reason : error);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export function abortableDelay(milliseconds, signal) {
|
|
34
|
+
if (signal === undefined)
|
|
35
|
+
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
36
|
+
signal.throwIfAborted();
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
const timeout = setTimeout(() => {
|
|
39
|
+
signal.removeEventListener("abort", abort);
|
|
40
|
+
resolve();
|
|
41
|
+
}, milliseconds);
|
|
42
|
+
const abort = () => {
|
|
43
|
+
clearTimeout(timeout);
|
|
44
|
+
reject(signal.reason);
|
|
45
|
+
};
|
|
46
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
47
|
+
if (signal.aborted)
|
|
48
|
+
abort();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import { type AkumaLife, type
|
|
1
|
+
import { type AkumaLife, type KillEvidence, type ResumeCoordinate, type Soul } from "./heart/index.js";
|
|
2
2
|
import { type AkuId } from "./identity.js";
|
|
3
|
-
import { type ActivityHistory, type ActivitySnapshot } from "./
|
|
3
|
+
import { type ActivityHistory, type ActivitySnapshot } from "./projection.js";
|
|
4
4
|
import { type Settings } from "../settings.js";
|
|
5
|
+
import type { WorldRoot } from "../world.js";
|
|
5
6
|
export type AkumaListRow = Readonly<{
|
|
6
7
|
id: AkuId;
|
|
7
8
|
archetype: string;
|
|
8
9
|
description?: string;
|
|
9
10
|
life: AkumaLife;
|
|
10
|
-
|
|
11
|
+
lifeAt: string | null;
|
|
11
12
|
confinement: Soul["confinement"];
|
|
12
13
|
pending: readonly string[];
|
|
13
14
|
}>;
|
|
14
|
-
export type AkumaStatus =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
export type AkumaStatus = Readonly<{
|
|
16
|
+
id: AkuId;
|
|
17
|
+
life: AkumaLife;
|
|
18
|
+
readonly?: Soul["readonly"];
|
|
19
|
+
timeline: ActivitySnapshot;
|
|
20
|
+
strandedReason?: "resume-unsupported";
|
|
20
21
|
}>;
|
|
21
|
-
export type {
|
|
22
|
+
export type { ReadonlyRestraint } from "./provider-recipe.js";
|
|
23
|
+
export type * from "./projection.js";
|
|
22
24
|
export type UnbornAkumaListRow = Readonly<{
|
|
23
25
|
id: AkuId;
|
|
24
26
|
life: "unborn" | "stillborn";
|
|
@@ -31,25 +33,26 @@ export type AkumaList = Readonly<{
|
|
|
31
33
|
rows: readonly (AkumaListRow | UnbornAkumaListRow)[];
|
|
32
34
|
searched: readonly string[];
|
|
33
35
|
}>;
|
|
34
|
-
export type
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
export type AkumaListInput = Readonly<{
|
|
37
|
+
archetype?: string;
|
|
38
|
+
}>;
|
|
39
|
+
export type TellResult = Readonly<{
|
|
40
|
+
admission: Readonly<{
|
|
41
|
+
tellId: string;
|
|
42
|
+
fact: "recorded";
|
|
43
|
+
}>;
|
|
37
44
|
wake: "spawned" | Readonly<{
|
|
38
45
|
kind: "failed";
|
|
39
46
|
diagnostic: string;
|
|
40
47
|
}>;
|
|
41
48
|
}>;
|
|
42
49
|
export type InterruptReceipt = Readonly<{
|
|
43
|
-
kind: "
|
|
44
|
-
|
|
45
|
-
kind: "unstoppable";
|
|
46
|
-
evidence: "no-collar" | "collar-unverifiable" | "unavailable" | "alive-after-sigkill" | "leash-held-after-put-down";
|
|
50
|
+
kind: "unavailable";
|
|
51
|
+
evidence: "hung" | "untidy" | "unavailable";
|
|
47
52
|
}> | Readonly<{
|
|
48
53
|
kind: "interrupted";
|
|
49
|
-
putDown: "was-idle" | "self-aborted"
|
|
50
|
-
tell:
|
|
51
|
-
kind: "refused-dead";
|
|
52
|
-
}>;
|
|
54
|
+
putDown: "was-idle" | "self-aborted";
|
|
55
|
+
tell: TellResult;
|
|
53
56
|
}>;
|
|
54
57
|
export type ForkReceipt = Readonly<{
|
|
55
58
|
kind: "forked";
|
|
@@ -73,44 +76,58 @@ export declare class AkumaNotBornError extends Error {
|
|
|
73
76
|
readonly kind = "akuma-not-born";
|
|
74
77
|
constructor(id: AkuId);
|
|
75
78
|
}
|
|
79
|
+
/** Package-internal action observation; it uses the same snapshot selector as status. */
|
|
80
|
+
export declare function readActionFeedbackStatus(worldPath: WorldRoot, id: AkuId): Promise<AkumaStatus>;
|
|
81
|
+
export type BudgetedStatusObservation = Readonly<{
|
|
82
|
+
status: AkumaStatus;
|
|
83
|
+
ordinarySelected: number;
|
|
84
|
+
}>;
|
|
85
|
+
/** Package-internal budgeted observation; Fleet allocates, Akuma still selects. */
|
|
86
|
+
export declare function readBudgetedStatus(worldPath: WorldRoot, id: AkuId, input: Readonly<{
|
|
87
|
+
ordinaryBudget: number;
|
|
88
|
+
}>): Promise<BudgetedStatusObservation>;
|
|
76
89
|
export declare class AkumaHandle {
|
|
77
90
|
readonly id: AkuId;
|
|
78
91
|
private readonly worldPath;
|
|
79
|
-
constructor(id: AkuId, worldPath:
|
|
92
|
+
constructor(id: AkuId, worldPath: WorldRoot);
|
|
80
93
|
private get paths();
|
|
81
|
-
status(): AkumaStatus
|
|
94
|
+
status(): Promise<AkumaStatus>;
|
|
82
95
|
history(input?: Readonly<{
|
|
83
96
|
before?: number;
|
|
84
97
|
since?: number;
|
|
85
98
|
limit?: number;
|
|
86
|
-
}>): ActivityHistory
|
|
99
|
+
}>): Promise<ActivityHistory>;
|
|
87
100
|
wait(predicate?: (status: AkumaStatus) => boolean, options?: Readonly<{
|
|
88
101
|
timeoutMs?: number;
|
|
89
102
|
}>): Promise<AkumaStatus>;
|
|
90
|
-
tell(body: string): Promise<
|
|
103
|
+
tell(body: string): Promise<TellResult>;
|
|
91
104
|
interrupt(body: string): Promise<InterruptReceipt>;
|
|
92
105
|
fork(input: Readonly<{
|
|
93
106
|
at: string;
|
|
94
107
|
}>): Promise<ForkReceipt>;
|
|
95
108
|
kill(): Promise<KillEvidence>;
|
|
96
|
-
lastAnswer():
|
|
109
|
+
lastAnswer(): Promise<LastAnswer>;
|
|
97
110
|
}
|
|
111
|
+
export type LastAnswer = Readonly<{
|
|
112
|
+
kind: "answer";
|
|
113
|
+
answer: string;
|
|
114
|
+
}> | Readonly<{
|
|
115
|
+
kind: "no-answer";
|
|
116
|
+
}>;
|
|
98
117
|
export declare class Akuma {
|
|
99
118
|
private readonly path;
|
|
100
|
-
private readonly
|
|
119
|
+
private readonly configuredSettings?;
|
|
101
120
|
private constructor();
|
|
102
|
-
static
|
|
103
|
-
|
|
104
|
-
settings?: Settings;
|
|
105
|
-
}>): Akuma;
|
|
121
|
+
static of(root: WorldRoot, settings?: Settings): Akuma;
|
|
122
|
+
private settings;
|
|
106
123
|
of(input: Readonly<{
|
|
107
124
|
id: string;
|
|
108
125
|
}>): AkumaHandle;
|
|
109
|
-
listArchetypes(): readonly string[]
|
|
126
|
+
listArchetypes(): Promise<readonly string[]>;
|
|
110
127
|
call(input: Readonly<{
|
|
111
128
|
archetype: string;
|
|
112
129
|
body: string;
|
|
113
130
|
cwd?: string;
|
|
114
131
|
}>): Promise<AkumaHandle>;
|
|
115
|
-
list(): AkumaList
|
|
132
|
+
list(input?: AkumaListInput): Promise<AkumaList>;
|
|
116
133
|
}
|