@astrosheep/keiyaku 4.6.14 → 4.6.16

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 (56) hide show
  1. package/build/plugins/claude/skills/keiyaku/SKILL.md +1 -1
  2. package/build/plugins/claude/skills/keiyaku-akuma/SKILL.md +13 -8
  3. package/build/plugins/codex/skills/keiyaku/SKILL.md +1 -1
  4. package/build/plugins/codex/skills/keiyaku-akuma/SKILL.md +13 -8
  5. package/build/plugins/opencode/skills/keiyaku/SKILL.md +1 -1
  6. package/build/plugins/opencode/skills/keiyaku-akuma/SKILL.md +13 -8
  7. package/build/skills/keiyaku/SKILL.md +1 -1
  8. package/build/skills/keiyaku-akuma/SKILL.md +13 -8
  9. package/build/src/akuma/archetype.js +2 -2
  10. package/build/src/cli/commands/akuma-grammar.js +18 -14
  11. package/build/src/cli/commands/akuma.d.ts +2 -1
  12. package/build/src/cli/commands/akuma.js +24 -25
  13. package/build/src/cli/commands/contract-help.d.ts +11 -11
  14. package/build/src/cli/commands/contract-help.js +16 -16
  15. package/build/src/cli/commands/contract.d.ts +3 -2
  16. package/build/src/cli/commands/contract.js +45 -65
  17. package/build/src/cli/commands/debt-grammar.js +8 -15
  18. package/build/src/cli/commands/debt.d.ts +2 -1
  19. package/build/src/cli/commands/debt.js +22 -22
  20. package/build/src/cli/commands/install.d.ts +2 -1
  21. package/build/src/cli/commands/install.js +4 -3
  22. package/build/src/cli/commands/whoami.d.ts +46 -0
  23. package/build/src/cli/commands/whoami.js +127 -0
  24. package/build/src/cli/main.js +5 -4
  25. package/build/src/cli/parse.d.ts +7 -1
  26. package/build/src/cli/parse.js +23 -3
  27. package/build/src/cli/render/akuma-activity.d.ts +10 -23
  28. package/build/src/cli/render/akuma-activity.js +178 -212
  29. package/build/src/cli/render/akuma.d.ts +7 -6
  30. package/build/src/cli/render/akuma.js +22 -18
  31. package/build/src/cli/render/catalog.js +4 -3
  32. package/build/src/cli/render/contract-history.js +5 -16
  33. package/build/src/cli/render/debt.d.ts +2 -1
  34. package/build/src/cli/render/debt.js +6 -6
  35. package/build/src/cli/render/nuke.d.ts +2 -1
  36. package/build/src/cli/render/nuke.js +4 -2
  37. package/build/src/cli/render/receipt.js +8 -3
  38. package/build/src/cli/render/reconcile.js +8 -7
  39. package/build/src/cli/render/refusal.js +7 -3
  40. package/build/src/cli/render/terminal.d.ts +5 -2
  41. package/build/src/cli/render/terminal.js +74 -12
  42. package/build/src/cli/render/whoami.d.ts +2 -0
  43. package/build/src/cli/render/whoami.js +56 -0
  44. package/build/src/cli/runtime.d.ts +2 -1
  45. package/build/src/cli/runtime.js +59 -58
  46. package/build/src/cli/streams.d.ts +11 -1
  47. package/build/src/cli/streams.js +6 -2
  48. package/build/src/cli/usage.d.ts +1 -0
  49. package/build/src/cli/usage.js +7 -6
  50. package/build/src/contract-worktree.js +1 -1
  51. package/build/src/library/selection.d.ts +1 -0
  52. package/build/src/library/selection.js +1 -1
  53. package/build/src/runtime/proc/windows-launch.exe +0 -0
  54. package/package.json +2 -2
  55. package/skills/keiyaku/SKILL.md +1 -1
  56. package/skills/keiyaku-akuma/SKILL.md +13 -8
@@ -27,7 +27,7 @@ keiyaku -C <repo> debt add "title"
27
27
  keiyaku -C <repo> bind [--debt <debt-id>] -
28
28
  keiyaku -C <repo> status
29
29
  keiyaku -C <repo> deliver [<contract>|@<contract>]
30
- keiyaku -C <repo> review [<contract>|@<contract>] --satisfied
30
+ keiyaku -C <repo> review [<contract>|@<contract>] --satisfied --summary "<evidence>"
31
31
  ```
32
32
 
33
33
  `-C` selects the invocation cwd and therefore the World. `--repo <path>` only
@@ -61,8 +61,9 @@ keiyaku ask @reviewer --schema verdict.schema.json - < question.md
61
61
 
62
62
  `tell` admits the next instruction and returns its admission receipt; it does
63
63
  not await an answer. `ask` admits a Tell and observes that exact answer,
64
- unbounded unless `--wait` limits observation. Both require a prompt and accept
65
- `--interrupt` to put down current work before admitting the new Tell. Schema
64
+ unbounded unless `--wait` limits observation. Both require a prompt. With
65
+ `--interrupt`, the Tell is admitted while current work is asked to yield; an
66
+ admitted Tell remains recoverable even if settlement cannot be proven. Schema
66
67
  belongs only to `ask`; `tell --schema` and `tell --wait` refuse and point to
67
68
  `ask`. A deadline never withdraws an admitted Tell. Read `tell --help` and
68
69
  `ask --help` for the complete flag grammar.
@@ -83,6 +84,7 @@ observes existing Akuma-wide work, not the answer to a newly admitted Tell.
83
84
  ## Inspect and retrieve results
84
85
 
85
86
  ```bash
87
+ keiyaku whoami
86
88
  keiyaku status
87
89
  keiyaku status @reviewer
88
90
  keiyaku ls aku/
@@ -92,16 +94,19 @@ keiyaku history @reviewer --last
92
94
  keiyaku history @reviewer --id turn/3
93
95
  ```
94
96
 
95
- `status` shows the roster or one Akuma's workdir and effective actions.
96
- `ls aku/` shows callable names; `ls "aku/*/*"` shows born workers.
97
+ `whoami` shows self and, for an Akuma, its current Turn initiator and birth profile without
98
+ creating a World or changing Square. `status` shows the roster or one Akuma's
99
+ workdir; use `keiyaku status <aku/...|@alias> --json` to inspect `status.allowed`.
100
+ `ls aku/` shows callable names; `ls "aku/*/*"` shows recent retained instances.
97
101
  `ls --mine` narrows that roster to Akumas this process's caller called and their
98
102
  transitive descendants in this World; `--caller <integration>:<id>` or
99
103
  `--caller aku/<name>/<suffix>` names the same selection explicitly. Descendant
100
104
  rows show their immediate caller as `· by <akuId>`. The selection is World-local
101
105
  and refuses for Contract, Debt, and Akuma-name catalogues.
102
106
  `history --last` reads the latest complete answer; `history --id` reads an
103
- exact result named by status or wait. Use the complete AkuId when an alias may
104
- move; see `history --help` for paging.
107
+ exact retained terminal turn's answer or failure diagnostic. Find its `historyId`
108
+ in paged `keiyaku history <aku/...|@alias> --json`. Use the complete AkuId when
109
+ an alias may move; see `history --help` for paging.
105
110
 
106
111
  ## Retention
107
112
 
@@ -113,8 +118,8 @@ entries. It removes only the Akuma's recognized runtime custody; it never kills
113
118
  a worker and never rewrites another Akuma, Contract, Debt, or alias. Its final
114
119
  Heart re-read keeps a pending Tell it observes; a Tell admitted immediately
115
120
  after that read is best-effort, not atomic. There is no timer and no prune
116
- command. Observation and Tell commands (`status`, `ls`, `history`, `wait`,
117
- `tell`, `ask`) never trigger retention; without a later successful
121
+ command. Observation and Tell commands (`whoami`, `status`, `ls`, `history`,
122
+ `wait`, `tell`, `ask`) never trigger retention; without a later successful
118
123
  `call`/`fork`, old entries simply remain.
119
124
 
120
125
  ## Stop and branch
@@ -27,7 +27,7 @@ keiyaku -C <repo> debt add "title"
27
27
  keiyaku -C <repo> bind [--debt <debt-id>] -
28
28
  keiyaku -C <repo> status
29
29
  keiyaku -C <repo> deliver [<contract>|@<contract>]
30
- keiyaku -C <repo> review [<contract>|@<contract>] --satisfied
30
+ keiyaku -C <repo> review [<contract>|@<contract>] --satisfied --summary "<evidence>"
31
31
  ```
32
32
 
33
33
  `-C` selects the invocation cwd and therefore the World. `--repo <path>` only
@@ -61,8 +61,9 @@ keiyaku ask @reviewer --schema verdict.schema.json - < question.md
61
61
 
62
62
  `tell` admits the next instruction and returns its admission receipt; it does
63
63
  not await an answer. `ask` admits a Tell and observes that exact answer,
64
- unbounded unless `--wait` limits observation. Both require a prompt and accept
65
- `--interrupt` to put down current work before admitting the new Tell. Schema
64
+ unbounded unless `--wait` limits observation. Both require a prompt. With
65
+ `--interrupt`, the Tell is admitted while current work is asked to yield; an
66
+ admitted Tell remains recoverable even if settlement cannot be proven. Schema
66
67
  belongs only to `ask`; `tell --schema` and `tell --wait` refuse and point to
67
68
  `ask`. A deadline never withdraws an admitted Tell. Read `tell --help` and
68
69
  `ask --help` for the complete flag grammar.
@@ -83,6 +84,7 @@ observes existing Akuma-wide work, not the answer to a newly admitted Tell.
83
84
  ## Inspect and retrieve results
84
85
 
85
86
  ```bash
87
+ keiyaku whoami
86
88
  keiyaku status
87
89
  keiyaku status @reviewer
88
90
  keiyaku ls aku/
@@ -92,16 +94,19 @@ keiyaku history @reviewer --last
92
94
  keiyaku history @reviewer --id turn/3
93
95
  ```
94
96
 
95
- `status` shows the roster or one Akuma's workdir and effective actions.
96
- `ls aku/` shows callable names; `ls "aku/*/*"` shows born workers.
97
+ `whoami` shows self and, for an Akuma, its current Turn initiator and birth profile without
98
+ creating a World or changing Square. `status` shows the roster or one Akuma's
99
+ workdir; use `keiyaku status <aku/...|@alias> --json` to inspect `status.allowed`.
100
+ `ls aku/` shows callable names; `ls "aku/*/*"` shows recent retained instances.
97
101
  `ls --mine` narrows that roster to Akumas this process's caller called and their
98
102
  transitive descendants in this World; `--caller <integration>:<id>` or
99
103
  `--caller aku/<name>/<suffix>` names the same selection explicitly. Descendant
100
104
  rows show their immediate caller as `· by <akuId>`. The selection is World-local
101
105
  and refuses for Contract, Debt, and Akuma-name catalogues.
102
106
  `history --last` reads the latest complete answer; `history --id` reads an
103
- exact result named by status or wait. Use the complete AkuId when an alias may
104
- move; see `history --help` for paging.
107
+ exact retained terminal turn's answer or failure diagnostic. Find its `historyId`
108
+ in paged `keiyaku history <aku/...|@alias> --json`. Use the complete AkuId when
109
+ an alias may move; see `history --help` for paging.
105
110
 
106
111
  ## Retention
107
112
 
@@ -113,8 +118,8 @@ entries. It removes only the Akuma's recognized runtime custody; it never kills
113
118
  a worker and never rewrites another Akuma, Contract, Debt, or alias. Its final
114
119
  Heart re-read keeps a pending Tell it observes; a Tell admitted immediately
115
120
  after that read is best-effort, not atomic. There is no timer and no prune
116
- command. Observation and Tell commands (`status`, `ls`, `history`, `wait`,
117
- `tell`, `ask`) never trigger retention; without a later successful
121
+ command. Observation and Tell commands (`whoami`, `status`, `ls`, `history`,
122
+ `wait`, `tell`, `ask`) never trigger retention; without a later successful
118
123
  `call`/`fork`, old entries simply remain.
119
124
 
120
125
  ## Stop and branch
@@ -27,7 +27,7 @@ keiyaku -C <repo> debt add "title"
27
27
  keiyaku -C <repo> bind [--debt <debt-id>] -
28
28
  keiyaku -C <repo> status
29
29
  keiyaku -C <repo> deliver [<contract>|@<contract>]
30
- keiyaku -C <repo> review [<contract>|@<contract>] --satisfied
30
+ keiyaku -C <repo> review [<contract>|@<contract>] --satisfied --summary "<evidence>"
31
31
  ```
32
32
 
33
33
  `-C` selects the invocation cwd and therefore the World. `--repo <path>` only
@@ -61,8 +61,9 @@ keiyaku ask @reviewer --schema verdict.schema.json - < question.md
61
61
 
62
62
  `tell` admits the next instruction and returns its admission receipt; it does
63
63
  not await an answer. `ask` admits a Tell and observes that exact answer,
64
- unbounded unless `--wait` limits observation. Both require a prompt and accept
65
- `--interrupt` to put down current work before admitting the new Tell. Schema
64
+ unbounded unless `--wait` limits observation. Both require a prompt. With
65
+ `--interrupt`, the Tell is admitted while current work is asked to yield; an
66
+ admitted Tell remains recoverable even if settlement cannot be proven. Schema
66
67
  belongs only to `ask`; `tell --schema` and `tell --wait` refuse and point to
67
68
  `ask`. A deadline never withdraws an admitted Tell. Read `tell --help` and
68
69
  `ask --help` for the complete flag grammar.
@@ -83,6 +84,7 @@ observes existing Akuma-wide work, not the answer to a newly admitted Tell.
83
84
  ## Inspect and retrieve results
84
85
 
85
86
  ```bash
87
+ keiyaku whoami
86
88
  keiyaku status
87
89
  keiyaku status @reviewer
88
90
  keiyaku ls aku/
@@ -92,16 +94,19 @@ keiyaku history @reviewer --last
92
94
  keiyaku history @reviewer --id turn/3
93
95
  ```
94
96
 
95
- `status` shows the roster or one Akuma's workdir and effective actions.
96
- `ls aku/` shows callable names; `ls "aku/*/*"` shows born workers.
97
+ `whoami` shows self and, for an Akuma, its current Turn initiator and birth profile without
98
+ creating a World or changing Square. `status` shows the roster or one Akuma's
99
+ workdir; use `keiyaku status <aku/...|@alias> --json` to inspect `status.allowed`.
100
+ `ls aku/` shows callable names; `ls "aku/*/*"` shows recent retained instances.
97
101
  `ls --mine` narrows that roster to Akumas this process's caller called and their
98
102
  transitive descendants in this World; `--caller <integration>:<id>` or
99
103
  `--caller aku/<name>/<suffix>` names the same selection explicitly. Descendant
100
104
  rows show their immediate caller as `· by <akuId>`. The selection is World-local
101
105
  and refuses for Contract, Debt, and Akuma-name catalogues.
102
106
  `history --last` reads the latest complete answer; `history --id` reads an
103
- exact result named by status or wait. Use the complete AkuId when an alias may
104
- move; see `history --help` for paging.
107
+ exact retained terminal turn's answer or failure diagnostic. Find its `historyId`
108
+ in paged `keiyaku history <aku/...|@alias> --json`. Use the complete AkuId when
109
+ an alias may move; see `history --help` for paging.
105
110
 
106
111
  ## Retention
107
112
 
@@ -113,8 +118,8 @@ entries. It removes only the Akuma's recognized runtime custody; it never kills
113
118
  a worker and never rewrites another Akuma, Contract, Debt, or alias. Its final
114
119
  Heart re-read keeps a pending Tell it observes; a Tell admitted immediately
115
120
  after that read is best-effort, not atomic. There is no timer and no prune
116
- command. Observation and Tell commands (`status`, `ls`, `history`, `wait`,
117
- `tell`, `ask`) never trigger retention; without a later successful
121
+ command. Observation and Tell commands (`whoami`, `status`, `ls`, `history`,
122
+ `wait`, `tell`, `ask`) never trigger retention; without a later successful
118
123
  `call`/`fork`, old entries simply remain.
119
124
 
120
125
  ## Stop and branch
@@ -27,7 +27,7 @@ keiyaku -C <repo> debt add "title"
27
27
  keiyaku -C <repo> bind [--debt <debt-id>] -
28
28
  keiyaku -C <repo> status
29
29
  keiyaku -C <repo> deliver [<contract>|@<contract>]
30
- keiyaku -C <repo> review [<contract>|@<contract>] --satisfied
30
+ keiyaku -C <repo> review [<contract>|@<contract>] --satisfied --summary "<evidence>"
31
31
  ```
32
32
 
33
33
  `-C` selects the invocation cwd and therefore the World. `--repo <path>` only
@@ -61,8 +61,9 @@ keiyaku ask @reviewer --schema verdict.schema.json - < question.md
61
61
 
62
62
  `tell` admits the next instruction and returns its admission receipt; it does
63
63
  not await an answer. `ask` admits a Tell and observes that exact answer,
64
- unbounded unless `--wait` limits observation. Both require a prompt and accept
65
- `--interrupt` to put down current work before admitting the new Tell. Schema
64
+ unbounded unless `--wait` limits observation. Both require a prompt. With
65
+ `--interrupt`, the Tell is admitted while current work is asked to yield; an
66
+ admitted Tell remains recoverable even if settlement cannot be proven. Schema
66
67
  belongs only to `ask`; `tell --schema` and `tell --wait` refuse and point to
67
68
  `ask`. A deadline never withdraws an admitted Tell. Read `tell --help` and
68
69
  `ask --help` for the complete flag grammar.
@@ -83,6 +84,7 @@ observes existing Akuma-wide work, not the answer to a newly admitted Tell.
83
84
  ## Inspect and retrieve results
84
85
 
85
86
  ```bash
87
+ keiyaku whoami
86
88
  keiyaku status
87
89
  keiyaku status @reviewer
88
90
  keiyaku ls aku/
@@ -92,16 +94,19 @@ keiyaku history @reviewer --last
92
94
  keiyaku history @reviewer --id turn/3
93
95
  ```
94
96
 
95
- `status` shows the roster or one Akuma's workdir and effective actions.
96
- `ls aku/` shows callable names; `ls "aku/*/*"` shows born workers.
97
+ `whoami` shows self and, for an Akuma, its current Turn initiator and birth profile without
98
+ creating a World or changing Square. `status` shows the roster or one Akuma's
99
+ workdir; use `keiyaku status <aku/...|@alias> --json` to inspect `status.allowed`.
100
+ `ls aku/` shows callable names; `ls "aku/*/*"` shows recent retained instances.
97
101
  `ls --mine` narrows that roster to Akumas this process's caller called and their
98
102
  transitive descendants in this World; `--caller <integration>:<id>` or
99
103
  `--caller aku/<name>/<suffix>` names the same selection explicitly. Descendant
100
104
  rows show their immediate caller as `· by <akuId>`. The selection is World-local
101
105
  and refuses for Contract, Debt, and Akuma-name catalogues.
102
106
  `history --last` reads the latest complete answer; `history --id` reads an
103
- exact result named by status or wait. Use the complete AkuId when an alias may
104
- move; see `history --help` for paging.
107
+ exact retained terminal turn's answer or failure diagnostic. Find its `historyId`
108
+ in paged `keiyaku history <aku/...|@alias> --json`. Use the complete AkuId when
109
+ an alias may move; see `history --help` for paging.
105
110
 
106
111
  ## Retention
107
112
 
@@ -113,8 +118,8 @@ entries. It removes only the Akuma's recognized runtime custody; it never kills
113
118
  a worker and never rewrites another Akuma, Contract, Debt, or alias. Its final
114
119
  Heart re-read keeps a pending Tell it observes; a Tell admitted immediately
115
120
  after that read is best-effort, not atomic. There is no timer and no prune
116
- command. Observation and Tell commands (`status`, `ls`, `history`, `wait`,
117
- `tell`, `ask`) never trigger retention; without a later successful
121
+ command. Observation and Tell commands (`whoami`, `status`, `ls`, `history`,
122
+ `wait`, `tell`, `ask`) never trigger retention; without a later successful
118
123
  `call`/`fork`, old entries simply remain.
119
124
 
120
125
  ## Stop and branch
@@ -20,10 +20,10 @@ export class AkumaArchetypeError extends Error {
20
20
  }
21
21
  }
22
22
  function projectArchetypeDirectory(project) {
23
- return project === undefined ? undefined : join(project, ".keiyaku", "akuma");
23
+ return project === undefined ? undefined : join(project, ".keiyaku", "akumas");
24
24
  }
25
25
  function homeArchetypeDirectory(home) {
26
- return join(home ?? join(homedir(), ".keiyaku"), "akuma");
26
+ return join(home ?? join(homedir(), ".keiyaku"), "akumas");
27
27
  }
28
28
  function archetypeDirectories(input) {
29
29
  return [projectArchetypeDirectory(input.project), homeArchetypeDirectory(input.home)].filter((directory) => directory !== undefined);
@@ -5,6 +5,9 @@ import { parseAkumaAlias, parseAkumaGlob } from "../../identity/selector.js";
5
5
  import { ALLOWED_ACTIONS, DEFAULT_ALLOWED_ACTIONS, decodeAllowedActions, } from "../../akuma/allowed.js";
6
6
  import { parsePublicHistoryId } from "../../akuma/identity.js";
7
7
  const EXTRA_ALLOWED_ACTIONS = ALLOWED_ACTIONS.filter((action) => !DEFAULT_ALLOWED_ACTIONS.includes(action));
8
+ const SET_SELECTORS = '(<aku/...> | @alias | <kei/...> | "aku/<name-pattern>/<hex-pattern>")...';
9
+ const SET_DETAILS = "Globs contain * and use lowercase hex digits or * in the suffix. --repo requires at least one Contract (kei/...) selector.";
10
+ const SCHEMA_DETAILS = "--schema supplies a JSON Schema answer contract to the provider; on observation the CLI parses JSON but does not independently validate schema conformance.";
8
11
  const AKUMA_COMMAND_SPECS = {
9
12
  call: {
10
13
  arity: 1,
@@ -17,25 +20,24 @@ const AKUMA_COMMAND_SPECS = {
17
20
  json: "boolean",
18
21
  schema: "value",
19
22
  },
20
- usage: "call <akuma-name> [--contract <kei/...>] [--workdir <path>] [--alias <name>] [--allowed <product.action>]... [--schema <file>] [--wait <duration>] [<prompt> | -]",
23
+ usage: "call <akuma-name> [--contract <kei/...>] [--repo <path>] [--workdir <path>] [--alias <name>] [--allowed <product.action>]... [--schema <file>] [--wait <duration>] [<prompt> | -]",
21
24
  purpose: "Call an Akuma into the world.",
22
25
  details: [
23
26
  "Use keiyaku ls aku/ to find visible Akuma names; hidden definitions can still be called by name.",
24
27
  "Omit the prompt to birth without a Tell; otherwise give <prompt> as one argument, or use - to read stdin.",
25
28
  "--schema and --wait require a prompt.",
26
29
  "By default, call returns after birth and optional first Tell admission; --wait also waits for its first answer, up to the given duration.",
27
- "--contract assigns the Akuma work from that Contract; it does not choose where the Akuma works.",
28
- "--workdir selects where the Akuma works; relative paths start from your current directory. Without it, the current directory is used.",
29
- "--alias <name> gives the new Akuma the selector @name; use it instead of aku/<id>.",
30
+ "--contract records an association, not the work or execution directory; include the Contract and worktree context in the prompt as needed. --repo requires --contract.",
31
+ "--workdir selects where the Akuma works; relative paths resolve from the invocation directory selected by -C/--cwd, or the process cwd when omitted. Without --workdir, the invocation directory is used.",
32
+ "--alias <name> gives the new Akuma the selector @name instead of aku/<id>; an existing @name is reassigned to this Akuma.",
30
33
  `Default actions: ${DEFAULT_ALLOWED_ACTIONS.join(", ")}.`,
31
34
  ...(EXTRA_ALLOWED_ACTIONS.length === 0
32
35
  ? []
33
36
  : [`Also available with --allowed: ${EXTRA_ALLOWED_ACTIONS.join(", ")}.`]),
34
37
  "Repeated --allowed adds actions to the selected Akuma's allowed actions; it cannot remove inherited permissions.",
35
38
  "If no actions are configured, defaults apply; an explicitly empty list allows none.",
36
- "An Akuma started by another Akuma can use only actions its parent can use. status <aku/...|@alias> shows that Akuma's allowed actions.",
37
- "--schema checks the Akuma's answer against a JSON Schema file; stdin is still the prompt source.",
38
- "On success, the Akuma is assigned to the Contract; if @name is already in use, --alias reassigns it to this Akuma.",
39
+ "An Akuma started by another Akuma can use only actions its parent can use. Use keiyaku status <aku/...|@alias> --json to inspect status.allowed.",
40
+ SCHEMA_DETAILS,
39
41
  "With --wait, completed activity streams on stderr and the final answer is written to stdout once.",
40
42
  ].join("\n"),
41
43
  },
@@ -43,10 +45,11 @@ const AKUMA_COMMAND_SPECS = {
43
45
  arity: "one-or-more",
44
46
  stdin: false,
45
47
  flags: { any: "boolean", all: "boolean", timeout: "value", json: "boolean" },
46
- usage: "wait <aku/...|@alias>... [--any | --all] [--timeout <duration>]",
48
+ usage: `wait ${SET_SELECTORS} [--any | --all] [--timeout <duration>] [--repo <path>]`,
47
49
  purpose: "Wait for one or more Akumas to finish work.",
48
50
  details: [
49
51
  "The default mode is any; --all waits until every selected Akuma completes.",
52
+ SET_DETAILS,
50
53
  "An already completed member counts immediately, so repeating a selection can return at once.",
51
54
  "Text prints each selected Akuma's status snapshot, then one failure fact for any Akuma it could not read.",
52
55
  "An answer is part of that snapshot; wait writes no separate copy of it to stdout.",
@@ -74,7 +77,7 @@ const AKUMA_COMMAND_SPECS = {
74
77
  details: [
75
78
  "Give <prompt> as one argument, or use - to read stdin.",
76
79
  "--interrupt durably admits the new Tell while asking the current Body to yield; admission remains even if completion cannot be proven.",
77
- "--schema reads a JSON Schema file for the answer contract; stdin remains the prompt source.",
80
+ SCHEMA_DETAILS,
78
81
  "--wait bounds how long to block for the answer; the Tell stays admitted past the deadline.",
79
82
  "Completed activity streams on stderr and the final answer is written to stdout once.",
80
83
  ].join("\n"),
@@ -91,10 +94,10 @@ const AKUMA_COMMAND_SPECS = {
91
94
  full: "boolean",
92
95
  json: "boolean",
93
96
  },
94
- usage: "history <aku/...|@alias> [--id <historyId> | --before <index> | --since <index>] [--limit <count>] [--last]\nhistory <kei/...> [--full]",
97
+ usage: "history <aku/...|@alias> [--before <index> | --since <index>] [--limit <count>]\nhistory <aku/...|@alias> --id <historyId>\nhistory <aku/...|@alias> --last\nhistory <kei/...> [--full] [--repo <path>]",
95
98
  purpose: "Read an Akuma's answers and activity, or a Contract's history of changes and assigned work.",
96
99
  details: [
97
- "--id reads the exact retained answered turn (turn/<number>).",
100
+ "--id reads an exact retained terminal turn (turn/<number>): its answer or failure diagnostic.",
98
101
  "--before <index> pages older rows before that sequence; --since <index> pages newer rows after it.",
99
102
  "--limit bounds page size (default 12); without --since, the latest rows are shown.",
100
103
  "With --since, paging starts at the earliest newer rows.",
@@ -106,16 +109,17 @@ const AKUMA_COMMAND_SPECS = {
106
109
  arity: 1,
107
110
  stdin: false,
108
111
  flags: { at: "value", json: "boolean" },
109
- usage: "fork <aku/...|@alias> --at <historyId>",
112
+ usage: "fork <aku/...|@alias> --at <historyId> [--repo <path>]",
110
113
  purpose: "Create a new Akuma from an answered turn.",
111
- details: "--at takes a retained answered turn id (turn/<n>); find one with history.",
114
+ details: "--at takes a retained answered turn id (turn/<n>); find its historyId in paged keiyaku history <aku/...|@alias> --json. Fork also requires a retained provider fork point.",
112
115
  },
113
116
  kill: {
114
117
  arity: "one-or-more",
115
118
  stdin: false,
116
119
  flags: { json: "boolean" },
117
- usage: "kill <aku/...|@alias>...",
120
+ usage: `kill ${SET_SELECTORS} [--repo <path>]`,
118
121
  purpose: "Stop the selected Akuma's current work; it can be woken again with tell.",
122
+ details: SET_DETAILS,
119
123
  },
120
124
  };
121
125
  export function isAkumaAction(value) {
@@ -1,5 +1,6 @@
1
1
  import type { InvokedAkumaCommand } from "./akuma-grammar.js";
2
2
  import type { CliCoordinates } from "../coordinates.js";
3
+ import { type CliOutcome } from "../streams.js";
3
4
  import type { CliRuntime } from "../runtime.js";
4
5
  export { isParsedAkumaCommand, renderAkumaHelp } from "./akuma-grammar.js";
5
- export declare function runAkumaCommand(command: InvokedAkumaCommand, coordinates: CliCoordinates, workdir: string | undefined, runtime: CliRuntime): Promise<number>;
6
+ export declare function runAkumaCommand(command: InvokedAkumaCommand, coordinates: CliCoordinates, workdir: string | undefined, runtime: CliRuntime): Promise<CliOutcome>;
@@ -13,10 +13,10 @@ import { akumasWithExecution } from "../../library/akumas.js";
13
13
  import { World } from "../../world.js";
14
14
  import { contractFromInput } from "../selectors.js";
15
15
  import { ActivityDriver } from "../activity.js";
16
- import { displayContext, emit, resultContext, writeJson, writeStderr, writeStdout } from "../streams.js";
16
+ import { displayContext, emit, resultContext, writeJson, writeStderr, writeStdout, } from "../streams.js";
17
17
  import { callObservationStream } from "../render/akuma-activity.js";
18
18
  import { askRawAnswer, callRawAnswer, historyRawAnswer, historyText, tellText, waitText, } from "../render/akuma-activity.js";
19
- import { askExitCode, askProgressStream, callExitCode, callObservationHead, forkExitCode, historyExitCode, killExitCode, renderCallText, renderFailedCallObservation, renderForkText, renderKillText, tellExitCode, waitedTellProgress, } from "../render/akuma.js";
19
+ import { askOutcome, askProgressStream, callOutcome, callObservationHead, forkOutcome, historyOutcome, killOutcome, renderCallText, renderFailedCallObservation, renderForkText, renderKillText, tellOutcome, waitedTellProgress, } from "../render/akuma.js";
20
20
  export { isParsedAkumaCommand, renderAkumaHelp } from "./akuma-grammar.js";
21
21
  // ---------------------------------------------------------------------------
22
22
  // Leaf dispatch: acquisition, one public SDK invocation, direct rendering
@@ -142,16 +142,16 @@ async function runCall(command, input) {
142
142
  writeStderr(renderFailedCallObservation(result, resultContext()));
143
143
  streamed = true;
144
144
  }
145
- if (command.output === "json") {
145
+ if (command.output === "json")
146
146
  writeJson(result);
147
- return callExitCode(result);
147
+ else {
148
+ const raw = callRawAnswer(result, streamed);
149
+ if (raw === undefined)
150
+ emitAnswer(renderCallText(result, streamed, displayContext()), false);
151
+ else
152
+ emitAnswer(raw, true);
148
153
  }
149
- const raw = callRawAnswer(result, streamed);
150
- if (raw === undefined)
151
- emitAnswer(renderCallText(result, streamed, displayContext()), false);
152
- else
153
- emitAnswer(raw, true);
154
- return callExitCode(result);
154
+ return callOutcome(result);
155
155
  }
156
156
  finally {
157
157
  driver.close(stream?.flush() ?? []);
@@ -166,12 +166,12 @@ async function runWait(command, input) {
166
166
  ...(command.timeoutMs === undefined ? {} : { timeoutMs: command.timeoutMs }),
167
167
  ...(input.signal === undefined ? {} : { signal: input.signal }),
168
168
  });
169
- if (command.output === "json") {
169
+ const outcome = result.unobserved.length === 0 ? "accepted" : "failed";
170
+ if (command.output === "json")
170
171
  writeJson(result);
171
- return 0;
172
- }
173
- emitAnswer(waitText(result, { ...(alias === undefined ? {} : { alias }) }, displayContext()), false);
174
- return 0;
172
+ else
173
+ emitAnswer(waitText(result, { ...(alias === undefined ? {} : { alias }) }, displayContext()), false);
174
+ return outcome;
175
175
  }
176
176
  async function runTell(command, input) {
177
177
  const body = await promptBody("tell", command, input);
@@ -184,7 +184,7 @@ async function runTell(command, input) {
184
184
  ...(input.signal === undefined ? {} : { signal: input.signal }),
185
185
  });
186
186
  const text = () => tellText(result, inputAlias(command.akuma), displayContext());
187
- return emit(command.output, result, text, tellExitCode(result));
187
+ return emit(command.output, result, text, tellOutcome(result));
188
188
  }
189
189
  async function runAsk(command, input) {
190
190
  const body = await promptBody("ask", command, input);
@@ -222,12 +222,11 @@ async function runAsk(command, input) {
222
222
  driver.conclude(progress.conclude(result).join("\n"));
223
223
  else if (command.output === "text" && channel.kind === "body-request")
224
224
  writeStderr(waitedTellProgress(result, alias, resultContext()));
225
- if (command.output === "json") {
225
+ if (command.output === "json")
226
226
  writeJson(result);
227
- return askExitCode(result);
228
- }
229
- emitAnswer(askRawAnswer(result, schema !== undefined) ?? "", true);
230
- return askExitCode(result);
227
+ else
228
+ emitAnswer(askRawAnswer(result, schema !== undefined) ?? "", true);
229
+ return askOutcome(result);
231
230
  }
232
231
  finally {
233
232
  driver.close(progress?.flush() ?? []);
@@ -245,7 +244,7 @@ async function runHistory(command, input) {
245
244
  });
246
245
  if (command.output === "json") {
247
246
  writeJson(result);
248
- return historyExitCode(result, command.id);
247
+ return historyOutcome(result, command.id);
249
248
  }
250
249
  const raw = historyRawAnswer(result, command.id);
251
250
  const presentation = {
@@ -259,7 +258,7 @@ async function runHistory(command, input) {
259
258
  emitAnswer(result.answer, true);
260
259
  else
261
260
  emitAnswer(historyText(result, presentation, displayContext()), false);
262
- return historyExitCode(result, command.id);
261
+ return historyOutcome(result, command.id);
263
262
  }
264
263
  async function runFork(command, input) {
265
264
  const caller = await akumaCallerFromEnvironment(input.environment);
@@ -270,7 +269,7 @@ async function runFork(command, input) {
270
269
  at: command.at,
271
270
  ...(input.repo === undefined ? {} : { repo: input.repo }),
272
271
  });
273
- return emit(command.output, receipt, () => renderForkText(receipt), forkExitCode(receipt));
272
+ return emit(command.output, receipt, () => renderForkText(receipt), forkOutcome(receipt));
274
273
  }
275
274
  async function runKill(command, input) {
276
275
  const alias = command.akuma.length === 1 ? inputAlias(command.akuma[0]) : undefined;
@@ -280,7 +279,7 @@ async function runKill(command, input) {
280
279
  ...(input.signal === undefined ? {} : { signal: input.signal }),
281
280
  });
282
281
  const text = () => renderKillText(result, alias, displayContext());
283
- return emit(command.output, result, text, killExitCode(result));
282
+ return emit(command.output, result, text, killOutcome(result));
284
283
  }
285
284
  async function akumaWorld(command, coordinates) {
286
285
  const world = command.command === "call"
@@ -21,7 +21,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
21
21
  readonly "fork-of": "value";
22
22
  readonly json: "boolean";
23
23
  };
24
- readonly usage: "bind [--debt <debt/...>] [--target <ref> | --no-target] [--after <kei/...> ...] [--gates <name,...>] [--actor <actor>] - | bind --fork-of <kei/...> [--target <ref> | --no-target] [--actor <actor>]";
24
+ readonly usage: "bind [--debt <debt/...>] [--target <ref> | --no-target] [--after <kei/...>]... [--gates <name,...>] [--actor <actor>] [--repo <path>] -\nbind --fork-of <kei/...> [--target <ref> | --no-target] [--actor <actor>] [--repo <path>]";
25
25
  readonly purpose: "Create a Contract from stdin Markdown or copy an existing Contract as a starting point.";
26
26
  readonly details: string;
27
27
  };
@@ -35,7 +35,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
35
35
  readonly gates: "raw-value";
36
36
  readonly json: "boolean";
37
37
  };
38
- readonly usage: "amend [<contract>|@<contract>] [--after <kei/...> ... | --clear-after] [--gates <name,...>] [--actor <actor>] [-]";
38
+ readonly usage: "amend [<contract>|@<contract>] [--after <kei/...> [--after <kei/...>]... | --clear-after] [--gates <name,...>] [--actor <actor>] [--repo <path>] [-]";
39
39
  readonly purpose: "Change a Contract's document, prerequisites, or acceptance gates.";
40
40
  readonly details: string;
41
41
  };
@@ -51,7 +51,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
51
51
  readonly overwrite: "boolean";
52
52
  readonly json: "boolean";
53
53
  };
54
- readonly usage: "deliver [<contract>|@<contract>] [--message <text>] [--include-dirty] [--materialize-conflict] [--overwrite] | deliver [<contract>|@<contract>] --dry-run [--include-dirty] [--show-diff]";
54
+ readonly usage: "deliver [<contract>|@<contract>] [--message <text>] [--include-dirty] [--materialize-conflict] [--overwrite] [--repo <path>]\ndeliver [<contract>|@<contract>] --dry-run [--include-dirty] [--show-diff] [--repo <path>]";
55
55
  readonly purpose: "Submit work for a Contract and integrate it when its requirements are met.";
56
56
  readonly details: string;
57
57
  };
@@ -65,7 +65,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
65
65
  readonly summary: "value";
66
66
  readonly json: "boolean";
67
67
  };
68
- readonly usage: "review [<contract>|@<contract>] (--satisfied | --unsatisfied) (--summary <text> | -) [--actor <actor>]";
68
+ readonly usage: "review [<contract>|@<contract>] (--satisfied | --unsatisfied) (--summary <text> | -) [--actor <actor>] [--repo <path>]";
69
69
  readonly purpose: "Record whether a Contract meets its acceptance criteria.";
70
70
  readonly details: string;
71
71
  };
@@ -76,7 +76,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
76
76
  readonly actor: "value";
77
77
  readonly json: "boolean";
78
78
  };
79
- readonly usage: "arc [<contract>|@<contract>] [--actor <actor>] -";
79
+ readonly usage: "arc [<contract>|@<contract>] [--actor <actor>] [--repo <path>] -";
80
80
  readonly purpose: "Name the current chapter of a Contract's story (a story arc).";
81
81
  readonly details: string;
82
82
  };
@@ -88,8 +88,8 @@ export declare const CONTRACT_COMMAND_SPECS: {
88
88
  readonly note: "value";
89
89
  readonly json: "boolean";
90
90
  };
91
- readonly usage: "abandon [<contract>|@<contract>] [--note <text>] [--actor <actor>]";
92
- readonly purpose: "End work on a Contract without delivering it; optionally record why.";
91
+ readonly usage: "abandon [<contract>|@<contract>] [--note <text>] [--actor <actor>] [--repo <path>]";
92
+ readonly purpose: "End work on a Contract without accepting it; optionally record why.";
93
93
  };
94
94
  readonly show: {
95
95
  readonly positional: "optional";
@@ -97,7 +97,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
97
97
  readonly flags: {
98
98
  readonly json: "boolean";
99
99
  };
100
- readonly usage: "show [<contract>|@<contract>]";
100
+ readonly usage: "show [<contract>|@<contract>] [--repo <path>]";
101
101
  readonly purpose: "Read one Contract's guidance.";
102
102
  readonly details: string;
103
103
  };
@@ -121,7 +121,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
121
121
  readonly mine: "boolean";
122
122
  readonly caller: "value";
123
123
  };
124
- readonly usage: "ls debt[/] [--limit <count>]\nls kei[/] [--limit <count>]\nls aku[/] [--limit <count>]\nls aku/<name>[/] [--limit <count>]\nls \"aku/<name>/*\" [--limit <count>]\nls \"aku/*/*\" [--limit <count>]\nls [\"aku/*/*\"] --mine\nls [\"aku/*/*\"] --caller <integration>:<id> | aku/<name>/<suffix>";
124
+ readonly usage: "ls debt[/] [--limit <count>]\nls debt/<namespace>/ [--limit <count>]\nls kei[/] [--limit <count>]\nls aku[/] [--limit <count>]\nls aku/<name>[/] [--limit <count>]\nls \"aku/<name>/*\" [--limit <count>]\nls \"aku/*/*\" [--limit <count>]\nls [aku/<name>[/] | \"aku/<name>/*\" | \"aku/*/*\"] (--mine | --caller (<integration>:<id> | aku/<name>/<suffix>)) [--limit <count>]";
125
125
  readonly purpose: "List debts (ls debt), contracts (ls kei), or akumas (ls aku).";
126
126
  readonly details: string;
127
127
  };
@@ -132,7 +132,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
132
132
  readonly "retry-hooks": "boolean";
133
133
  readonly json: "boolean";
134
134
  };
135
- readonly usage: "reconcile [<contract>|@<contract>] [--retry-hooks]";
135
+ readonly usage: "reconcile [<contract>|@<contract>] [--retry-hooks] [--repo <path>]";
136
136
  readonly purpose: "Restore a Contract's Git workspace from its recorded state, or all of this World's.";
137
137
  readonly details: "--retry-hooks reruns configured setup commands even when a Contract workspace already exists; otherwise they run when reconciliation creates it.";
138
138
  };
@@ -163,7 +163,7 @@ export declare const CONTRACT_COMMAND_SPECS: {
163
163
  readonly path: "repeat";
164
164
  readonly json: "boolean";
165
165
  };
166
- readonly usage: "region [<contract>]\nregion --path <pattern> [--path <pattern> ...]";
166
+ readonly usage: "region [<contract>] [--repo <path>]\nregion --path <pattern> [--path <pattern>]... [--repo <path>]";
167
167
  readonly purpose: "Show declared Contract write patterns — all, one Contract's, or those overlapping given paths.";
168
168
  readonly details: "Check overlap before starting parallel work.";
169
169
  };