@calliopelabs/cli 3.6.0 → 3.8.0

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 (196) hide show
  1. package/README.md +13 -0
  2. package/dist/acp/controls.d.ts +10 -0
  3. package/dist/acp/controls.d.ts.map +1 -0
  4. package/dist/acp/controls.js +81 -0
  5. package/dist/acp/controls.js.map +1 -0
  6. package/dist/acp.d.ts +11 -4
  7. package/dist/acp.d.ts.map +1 -1
  8. package/dist/acp.js +114 -18
  9. package/dist/acp.js.map +1 -1
  10. package/dist/approvals/request.d.ts.map +1 -1
  11. package/dist/approvals/request.js +10 -0
  12. package/dist/approvals/request.js.map +1 -1
  13. package/dist/auth/chatgpt/fallback.d.ts +31 -0
  14. package/dist/auth/chatgpt/fallback.d.ts.map +1 -0
  15. package/dist/auth/chatgpt/fallback.js +111 -0
  16. package/dist/auth/chatgpt/fallback.js.map +1 -0
  17. package/dist/auth/chatgpt/index.d.ts +6 -0
  18. package/dist/auth/chatgpt/index.d.ts.map +1 -0
  19. package/dist/auth/chatgpt/index.js +6 -0
  20. package/dist/auth/chatgpt/index.js.map +1 -0
  21. package/dist/auth/chatgpt/login.d.ts +4 -0
  22. package/dist/auth/chatgpt/login.d.ts.map +1 -0
  23. package/dist/auth/chatgpt/login.js +82 -0
  24. package/dist/auth/chatgpt/login.js.map +1 -0
  25. package/dist/auth/chatgpt/protocol.d.ts +24 -0
  26. package/dist/auth/chatgpt/protocol.d.ts.map +1 -0
  27. package/dist/auth/chatgpt/protocol.js +71 -0
  28. package/dist/auth/chatgpt/protocol.js.map +1 -0
  29. package/dist/auth/chatgpt/session.d.ts +24 -0
  30. package/dist/auth/chatgpt/session.d.ts.map +1 -0
  31. package/dist/auth/chatgpt/session.js +101 -0
  32. package/dist/auth/chatgpt/session.js.map +1 -0
  33. package/dist/auth/chatgpt/store.d.ts +28 -0
  34. package/dist/auth/chatgpt/store.d.ts.map +1 -0
  35. package/dist/auth/chatgpt/store.js +75 -0
  36. package/dist/auth/chatgpt/store.js.map +1 -0
  37. package/dist/auth/cli.d.ts +2 -0
  38. package/dist/auth/cli.d.ts.map +1 -0
  39. package/dist/auth/cli.js +38 -0
  40. package/dist/auth/cli.js.map +1 -0
  41. package/dist/auth/index.d.ts +2 -0
  42. package/dist/auth/index.d.ts.map +1 -0
  43. package/dist/auth/index.js +2 -0
  44. package/dist/auth/index.js.map +1 -0
  45. package/dist/bin.d.ts.map +1 -1
  46. package/dist/bin.js +25 -0
  47. package/dist/bin.js.map +1 -1
  48. package/dist/brain/exchange.d.ts.map +1 -1
  49. package/dist/brain/exchange.js +3 -1
  50. package/dist/brain/exchange.js.map +1 -1
  51. package/dist/brain/kg-export.d.ts +1 -1
  52. package/dist/brain/kg.d.ts +1 -1
  53. package/dist/brain/kg.d.ts.map +1 -1
  54. package/dist/brain/kg.js +3 -1
  55. package/dist/brain/kg.js.map +1 -1
  56. package/dist/build-identity.d.ts +27 -0
  57. package/dist/build-identity.d.ts.map +1 -0
  58. package/dist/build-identity.js +32 -0
  59. package/dist/build-identity.js.map +1 -0
  60. package/dist/build-metadata.json +1 -0
  61. package/dist/config.d.ts +7 -0
  62. package/dist/config.d.ts.map +1 -1
  63. package/dist/config.js +7 -2
  64. package/dist/config.js.map +1 -1
  65. package/dist/delegation/claude.d.ts +28 -0
  66. package/dist/delegation/claude.d.ts.map +1 -0
  67. package/dist/delegation/claude.js +107 -0
  68. package/dist/delegation/claude.js.map +1 -0
  69. package/dist/delegation/index.d.ts +2 -0
  70. package/dist/delegation/index.d.ts.map +1 -0
  71. package/dist/delegation/index.js +2 -0
  72. package/dist/delegation/index.js.map +1 -0
  73. package/dist/execution/attribution.d.ts +3 -0
  74. package/dist/execution/attribution.d.ts.map +1 -1
  75. package/dist/execution/attribution.js.map +1 -1
  76. package/dist/execution/delegated.d.ts.map +1 -1
  77. package/dist/execution/delegated.js +5 -2
  78. package/dist/execution/delegated.js.map +1 -1
  79. package/dist/execution/ledger-cli.d.ts.map +1 -1
  80. package/dist/execution/ledger-cli.js +9 -7
  81. package/dist/execution/ledger-cli.js.map +1 -1
  82. package/dist/execution/ledger-server.d.ts +6 -0
  83. package/dist/execution/ledger-server.d.ts.map +1 -1
  84. package/dist/execution/ledger-server.js +39 -4
  85. package/dist/execution/ledger-server.js.map +1 -1
  86. package/dist/execution/quote.d.ts +1 -1
  87. package/dist/execution/quote.d.ts.map +1 -1
  88. package/dist/execution/quote.js +4 -2
  89. package/dist/execution/quote.js.map +1 -1
  90. package/dist/execution/remote-ledger.d.ts +7 -0
  91. package/dist/execution/remote-ledger.d.ts.map +1 -1
  92. package/dist/execution/remote-ledger.js +22 -5
  93. package/dist/execution/remote-ledger.js.map +1 -1
  94. package/dist/health/target.d.ts.map +1 -1
  95. package/dist/health/target.js +8 -1
  96. package/dist/health/target.js.map +1 -1
  97. package/dist/improvement/cli.d.ts +1 -1
  98. package/dist/improvement/cli.d.ts.map +1 -1
  99. package/dist/improvement/cli.js +18 -4
  100. package/dist/improvement/cli.js.map +1 -1
  101. package/dist/improvement/host-capabilities.d.ts +252 -0
  102. package/dist/improvement/host-capabilities.d.ts.map +1 -0
  103. package/dist/improvement/host-capabilities.js +25 -0
  104. package/dist/improvement/host-capabilities.js.map +1 -0
  105. package/dist/improvement/index.d.ts +3 -0
  106. package/dist/improvement/index.d.ts.map +1 -1
  107. package/dist/improvement/index.js +3 -0
  108. package/dist/improvement/index.js.map +1 -1
  109. package/dist/improvement/task-feedback-contract.d.ts +41 -0
  110. package/dist/improvement/task-feedback-contract.d.ts.map +1 -0
  111. package/dist/improvement/task-feedback-contract.js +83 -0
  112. package/dist/improvement/task-feedback-contract.js.map +1 -0
  113. package/dist/improvement/task-feedback.d.ts +149 -0
  114. package/dist/improvement/task-feedback.d.ts.map +1 -0
  115. package/dist/improvement/task-feedback.js +117 -0
  116. package/dist/improvement/task-feedback.js.map +1 -0
  117. package/dist/improvement/task-outcomes.d.ts +2 -2
  118. package/dist/improvement/task-outcomes.d.ts.map +1 -1
  119. package/dist/improvement/task-outcomes.js +2 -3
  120. package/dist/improvement/task-outcomes.js.map +1 -1
  121. package/dist/model-detection.d.ts +0 -5
  122. package/dist/model-detection.d.ts.map +1 -1
  123. package/dist/model-detection.js +5 -5
  124. package/dist/model-detection.js.map +1 -1
  125. package/dist/orchestration/coordinator-types.d.ts +4 -1
  126. package/dist/orchestration/coordinator-types.d.ts.map +1 -1
  127. package/dist/orchestration/execution-journal.d.ts.map +1 -1
  128. package/dist/orchestration/execution-journal.js +10 -3
  129. package/dist/orchestration/execution-journal.js.map +1 -1
  130. package/dist/orchestration/execution.d.ts +3 -1
  131. package/dist/orchestration/execution.d.ts.map +1 -1
  132. package/dist/orchestration/execution.js +1 -1
  133. package/dist/orchestration/execution.js.map +1 -1
  134. package/dist/orchestration/reviewed-ledger.d.ts +42 -0
  135. package/dist/orchestration/reviewed-ledger.d.ts.map +1 -1
  136. package/dist/orchestration/reviewed-ledger.js +59 -9
  137. package/dist/orchestration/reviewed-ledger.js.map +1 -1
  138. package/dist/orchestration/routing.d.ts +5 -0
  139. package/dist/orchestration/routing.d.ts.map +1 -1
  140. package/dist/orchestration/routing.js +15 -2
  141. package/dist/orchestration/routing.js.map +1 -1
  142. package/dist/orchestration/task-configuration.d.ts +8 -0
  143. package/dist/orchestration/task-configuration.d.ts.map +1 -0
  144. package/dist/orchestration/task-configuration.js +23 -0
  145. package/dist/orchestration/task-configuration.js.map +1 -0
  146. package/dist/providers/chatgpt.d.ts +11 -0
  147. package/dist/providers/chatgpt.d.ts.map +1 -0
  148. package/dist/providers/chatgpt.js +156 -0
  149. package/dist/providers/chatgpt.js.map +1 -0
  150. package/dist/providers/index.d.ts +0 -5
  151. package/dist/providers/index.d.ts.map +1 -1
  152. package/dist/providers/index.js +10 -2
  153. package/dist/providers/index.js.map +1 -1
  154. package/dist/providers/types.d.ts +5 -0
  155. package/dist/providers/types.d.ts.map +1 -1
  156. package/dist/providers/types.js.map +1 -1
  157. package/dist/runlog.d.ts +1 -1
  158. package/dist/runlog.d.ts.map +1 -1
  159. package/dist/runtime/permissions.d.ts.map +1 -1
  160. package/dist/runtime/permissions.js +1 -0
  161. package/dist/runtime/permissions.js.map +1 -1
  162. package/dist/runtime/turn.d.ts.map +1 -1
  163. package/dist/runtime/turn.js +79 -12
  164. package/dist/runtime/turn.js.map +1 -1
  165. package/dist/sessions/execution-binding.d.ts +8 -3
  166. package/dist/sessions/execution-binding.d.ts.map +1 -1
  167. package/dist/sessions/execution-binding.js +13 -3
  168. package/dist/sessions/execution-binding.js.map +1 -1
  169. package/dist/storage.d.ts +2 -0
  170. package/dist/storage.d.ts.map +1 -1
  171. package/dist/storage.js +5 -1
  172. package/dist/storage.js.map +1 -1
  173. package/dist/types.d.ts +1 -0
  174. package/dist/types.d.ts.map +1 -1
  175. package/dist/types.js.map +1 -1
  176. package/dist/ui/components.d.ts.map +1 -1
  177. package/dist/ui/components.js +3 -5
  178. package/dist/ui/components.js.map +1 -1
  179. package/dist/ui/frame.js +3 -3
  180. package/dist/ui/frame.js.map +1 -1
  181. package/dist/ui/modals/tool-output.d.ts.map +1 -1
  182. package/dist/ui/modals/tool-output.js +5 -6
  183. package/dist/ui/modals/tool-output.js.map +1 -1
  184. package/dist/ui/state/use-terminal-width.d.ts.map +1 -1
  185. package/dist/ui/state/use-terminal-width.js +2 -13
  186. package/dist/ui/state/use-terminal-width.js.map +1 -1
  187. package/docs/acp.md +228 -0
  188. package/docs/chatgpt-plan.md +109 -0
  189. package/docs/claude-plan.md +58 -0
  190. package/docs/delegation-ledger.md +56 -3
  191. package/docs/improvement-cycles.md +309 -0
  192. package/docs/releases/3.7.0.md +53 -0
  193. package/docs/releases/3.8.0.md +65 -0
  194. package/docs/reviewed-provider-metadata.md +84 -0
  195. package/docs/task-feedback.md +77 -0
  196. package/package.json +21 -12
@@ -49,10 +49,24 @@ servers reject that token version; current raw-ledger endpoints reject its revie
49
49
  authority binding. Child credentials retain that binding. A sibling owner endpoint
50
50
  cannot accept the token, and reservations, settlements and revocations enforce the
51
51
  selected subtree. Each new request also checks the target account's native admission,
52
- stop/escalation state and the host's output cap. Existing requests can still settle
52
+ stop/escalation state, explicit reviewed provider/model choices and the host's
53
+ output cap. Smart agents also enforce their reviewed initial pool. Task-bound
54
+ hosts derive escalation eligibility from that task's retained native failed-check
55
+ evidence; account-only hosts cannot select an escalation pool. Explicit reviewed
56
+ pins retain the same precedence as local Smart routing. The provider/model check
57
+ uses the current admitted graph and runs
58
+ again under the ledger writer lock before a new reservation commits. Existing requests can still settle
53
59
  after owner cancellation; grant revocation and token expiry retain their existing
54
60
  semantics.
55
61
 
62
+ Reviewed host capabilities additionally advertise `endpointBinding: 1`. Hosting
63
+ captures the owner's configured provider target hashes in the native budget approval
64
+ and token audience. New reservations must match that target for their provider;
65
+ changing an owner's endpoint fences existing hosts and changes newly issued tokens.
66
+ Restarting with unchanged endpoint configuration preserves credentials and allowance.
67
+ API key rotation does not change target identity. Child-side endpoint overrides cannot
68
+ widen this authority. Target hashes contain no API keys or raw endpoint strings.
69
+
56
70
  The HTTP grant operation only returns credentials for an **exact, already admitted**
57
71
  native child grant. It cannot create a proposal, approve children, bypass native
58
72
  depth/count limits or promote an interrupted ledger grant into the execution graph.
@@ -67,10 +81,48 @@ that history requires verified restoration or an explicit owner-managed credenti
67
81
  rotation; opening it never silently treats missing revocations as an empty history.
68
82
 
69
83
  This is reviewed ledger hosting, not automatic Cykick/Astrolift enrollment. Remote
70
- workspace identity, dispatcher credential delivery, task-attempt ownership, transport
84
+ workspace identity, dispatcher credential delivery, exclusive task ownership, transport
71
85
  reachability and any narrower Cykick file-mutation policy still need their native
72
86
  bindings. A loopback listener does not make a desktop reachable from a remote pod.
73
87
 
88
+ ## Serve one active native task attempt
89
+
90
+ ```sh
91
+ calliope ledger serve-task --run RUN_ID --task TASK_ID --attempt 1 \
92
+ --max-output-tokens 1024 --project /path/to/project \
93
+ --token-file /private/task.token
94
+ ```
95
+
96
+ `prepareReviewedTaskLedger(cwd, runId, taskId, attempt, maxOutputTokens, options)`
97
+ derives the agent, session, immutable start-event ID/hash and native owner from
98
+ the current attributed `task_started` journal event. Pending, legacy unattributed,
99
+ stopped, completed and stale attempts cannot open this host. The private token's
100
+ audience binds that task, owner and output cap as well as the reviewed run.
101
+ Another task, changed owner, different cap or account-only host rejects the token.
102
+ This endpoint advertises reviewed capability version 2 with `taskBinding: 1`.
103
+
104
+ Its operations are only `hello`, `journal`, `task-execution`, `reserve` and `settle`.
105
+ There is no legacy `execution` fallback or child-grant mutation. Current clients
106
+ negotiate `task-execution`, validate its version 2 binding and automatically carry
107
+ the exact attribution and output cap into the shared execution guard. Older clients
108
+ refuse the missing legacy operation before inference. Each new reservation verifies
109
+ the attribution, agent, output cap and still-active native owner/attempt, including
110
+ under the ledger writer lock. Existing admissions may replay or settle after the
111
+ attempt ends; the original token expiry and accounting still apply.
112
+
113
+ Task-bound sessions retain version 2 restrictions with the start-event provenance.
114
+ A different task/attempt or an account-only connection cannot resume them. Reopening
115
+ the same active attempt preserves its token, allowance, history and deadline.
116
+ This does not dispatch work, acquire an exclusive process lease, implement Astrolift enrollment. A trusted scheduler still
117
+ owns those actions and the delivery of the private credential.
118
+
119
+ Run `CALLIOPE_REVIEWED_HOST_TASKS=1 npm run test:reviewed-host` for the real-process
120
+ task-host qualification. It checks two concurrent headless children, native ACP
121
+ session binding, exact request attribution, host restart, completed-attempt refusal, an active sibling
122
+ and run cancellation against a local deterministic provider with no paid requests.
123
+ The current reverse exec tunnel retains its child-grant contract; this task-host
124
+ mode is qualified through direct native HTTP transport.
125
+
74
126
  ## Run a delegated child
75
127
 
76
128
  A host (Cy, an Astrolift task) grants the child, writes its scoped token to a private file and
@@ -100,6 +152,7 @@ undelegated fallback.
100
152
  | `hello` | any | protocol and operations |
101
153
  | `journal` | any | the full hash-chained history (`manifest`, `events`) |
102
154
  | `execution` | account owner | verify `{agentId, project: {root, key}}` against the retained owner grant and return its native workspace binding |
155
+ | `task-execution` | task owner, task endpoint only | verify the account/workspace and return the immutable native start provenance and output cap |
103
156
  | `reserve` | owner of `reservation.agentId` | charge before dispatch; same id replays the original admission |
104
157
  | `settle` | owner of the reserved request | record usage or an outcome; same settlement replays |
105
158
  | `grant` | parent, or a child for its own accounts | allocate child accounts; returns the child's scoped token |
@@ -321,7 +374,7 @@ The executable reports its tested artifact type and invariant results as JSON.
321
374
  This is a local HTTP host example, not a deployed Astrolift acceptance test.
322
375
  Use `delegation-ledger/v1`, reviewed host capability version 1 and the headless
323
376
  capability tuple above; a matching package version alone is insufficient.
324
- The current CLI entry point requests a 4096-token output limit, so the reviewed
377
+ The account-only CLI entry point requests a 4096-token output limit, so the reviewed
325
378
  host and discovered model must both permit that bound. Lower output caps are
326
379
  available to library callers through `DelegatedExecutionOptions.maxOutputTokens`.
327
380
  The existing ledger, workspace and session suites cover nested grants, lost
@@ -0,0 +1,309 @@
1
+ # Bounded improvement cycles
2
+
3
+ Version-4 [supervised runs](continuous-supervision.md) record each final `retry`,
4
+ `replan` or `decompose` decision as an improvement cycle. The controller optimizes
5
+ for the reviewed principle (`speed`, `robustness`, `stability`, `security`,
6
+ `performance` or `cost`), reviews executor evidence, and receives the latest four
7
+ cycles' measured outcomes. A reviewer, when configured, owns the final decision;
8
+ its controller draft is not a second improvement.
9
+
10
+ ## Host capability discovery
11
+
12
+ `calliope improve host-capabilities --contract-version 1 --json` returns the
13
+ additive version-1 `improvement.host-capabilities` contract. It inventories the
14
+ native execution, review-request, task-outcome and source-change interfaces with
15
+ their independent versions. Discovery uses CLI JSON; operations use the native
16
+ library APIs described below. This declaration does not create remote RPC methods.
17
+ Unknown requested versions and run/approval/mutation selectors are refused.
18
+
19
+ `implementation` identifies the installed package version, artifact form and
20
+ build metadata status. Source metadata records the build's Git commit and dirty
21
+ state when available; builds outside their own source repository retain `null`.
22
+ The query never runs Git in the caller's project. Missing, malformed or mismatched
23
+ metadata cannot establish source identity. Even clean metadata is self-reported:
24
+ verify npm integrity and publisher provenance, or standalone release checksums
25
+ and binary attestations, against the same release tag and source commit before
26
+ trusting it. The query explicitly reports `external-attestation-required`.
27
+
28
+ Legacy execution discovery remains unchanged:
29
+
30
+ `calliope improve capabilities --json` returns a version-1 `improvement` envelope
31
+ whose action is `capabilities` and whose data kind is `improvement.capabilities`.
32
+ The data contract is version 2; its `hostAdmission` field advertises the native
33
+ `expectedExecutionRevision` option for propose/run and binding to the controller's
34
+ own committed reset event. Version-1 declarations do not promise this admission
35
+ contract. The outer CLI response envelope remains version 1.
36
+ This read-only query does not select a project/run, call a model, import feedback,
37
+ or grant execution authority. Run selectors, approval hashes and mutation flags
38
+ are rejected for this action. Hosts must negotiate this declaration instead of
39
+ inferring learning support from the package version or command names.
40
+
41
+ The current declaration advertises native recursive task-strategy improvement,
42
+ history schema versions, operation effects, exact-proposal approval, inherited
43
+ limits and withdrawal semantics. External feedback import, cross-run learned
44
+ strategy selection and model training are explicitly unavailable. Project brain
45
+ memory remains a separate interface. A supported operation still requires the
46
+ exact native run's current state and policy; this declaration is not evidence
47
+ that an installed run can execute it. Unknown contract versions are not compatible
48
+ by implication. This is the capability-discovery part of #413, not a completed
49
+ external feedback or reinforcement-learning interface.
50
+
51
+ ## Host review requests
52
+
53
+ Explicit host contract version 2 additionally exposes the
54
+ [reviewed task feedback](task-feedback.md) record/inspect/history API. Version 1
55
+ discovery remains unchanged. Feedback receipts do not award rewards or enable
56
+ cross-run learning.
57
+
58
+ The separately negotiated `improvementReviewCapabilities()` API (version 1,
59
+ `improvement.review-capabilities`) advertises `requestImprovementReview`,
60
+ `inspectImprovementReviews` and `dismissImprovementReview`. It is request-only;
61
+ existing version-2 execution capabilities are unchanged. Hosts must negotiate
62
+ this API separately before exposing a model request tool. Hosts supply the model-tool and human-review UI adapters. This API increment
63
+ does not add a CLI subcommand.
64
+
65
+ Requests carry version 1, `action` (`propose`, `run`, `rollback`), the exact
66
+ `executionRevision`, `cycleId` and `proposalHash` (both null for `propose`), and a
67
+ nonempty untrusted `reason` of at most 1,024 characters. Recording requires an
68
+ inactive approved supervised run and native policy/confirmation. It calls no
69
+ model, starts no worker, approves no proposal, and changes neither task state nor
70
+ budget. Run/withdrawal requests bind the native proposal hash; a new proposal
71
+ request needs retained task outcomes and remaining original controller time and
72
+ round capacity. Withdrawal requests can outlive the original deadline.
73
+
74
+ Version-9 events append to the existing private execution journal. Each request
75
+ is bound to the immediately preceding revision. Only one request can be current;
76
+ identical retries after a lost acknowledgement return that same request ID after
77
+ rechecking policy and run approval. A competing changed request fails. Native
78
+ ownership, revision and revocation checks run again before commit. At most 64
79
+ requests are retained per run, within the existing journal byte/event bounds.
80
+ Replay independently validates requests and never derives execution authority
81
+ from them. Older readers that do not support event version 9 must refuse these
82
+ journals; do not downgrade a run's owner after recording a request.
83
+
84
+ Inspection projects `pending`, `expired`, `stale` or `dismissed` from native
85
+ events. Any later execution/control event makes the old request stale, not
86
+ approved or completed. Human execution must use a fresh native inspection and
87
+ the existing proposal/run/withdrawal APIs with their normal review and policy.
88
+ Dismissal requires the exact current request ID/revision and a separate native
89
+ confirmation; it retains all history and does not withdraw the strategy. The
90
+ request reason remains untrusted display data, never an instruction or reward.
91
+
92
+ ## Controls
93
+
94
+ ```sh
95
+ calliope improve history --run RUN_ID --json
96
+ calliope improve propose --run RUN_ID --allow-mutations --json
97
+ calliope improve run CYCLE_ID --run RUN_ID --approve PROPOSAL_HASH --allow-mutations --json
98
+ calliope improve rollback CYCLE_ID --run RUN_ID --allow-mutations --json
99
+ ```
100
+
101
+ The REPL exposes the same arguments under `/improve`. Without a subcommand it
102
+ shows history; without `--run` it inspects the latest run in the active project.
103
+ Headless mutations require `--allow-mutations` or an approval callback, and still
104
+ pass project policy. REPL approvals use the existing scope preview and audit log.
105
+
106
+ `propose` reviews an inactive supervised run's retained outcomes, or returns its
107
+ existing pending proposal without another model call. Explicit recovery of a
108
+ halted controller retains its original rounds, task attempts, reservations and
109
+ deadline. It starts no workers and applies no proposed changes. It needs recorded
110
+ outcomes and remaining controller authority; a completed run or a `continue` or
111
+ `stop` decision can produce no improvement proposal. Inspect that decision before
112
+ resuming ordinary execution.
113
+
114
+ A recorded proposal hold survives restart. `run` requires its exact review hash;
115
+ ordinary `run resume` cannot bypass that hold. Approval is recorded in the same
116
+ execution journal before application, and checked again under coordinator
117
+ ownership. All subsequent decisions remain subject to the original reviewed
118
+ supervision policy. To inspect and retire a strategy, stop the coordinator first.
119
+
120
+ Native hosts can pass `expectedExecutionRevision` to `proposeImprovement` and
121
+ `runImprovement`. It must match the execution revision from their reviewed
122
+ inspection. Malformed, missing-history and stale bindings are refused before
123
+ execution approval. The coordinator rechecks after asynchronous authorization,
124
+ under its ownership lease and inside the journal append lock before starting
125
+ work. The execution permission request includes that bound `executionRevision`.
126
+ An explicit controller reset advances the binding only to its own committed
127
+ reset event; another writer's revision is never silently adopted. Existing
128
+ callers that omit the option bind to the history inspected by the improvement
129
+ action. This host API does not add a CLI flag; hosts negotiate the version-2 data
130
+ contract before relying on it. It does not authorize execution, change proposal hashes, or replenish
131
+ the original budget or deadline.
132
+
133
+ `rollback` **withdraws the execution strategy**. For a replan it restores the
134
+ previous unwithdrawn applied strategy; for decomposition it stops the admitted
135
+ child agents and their descendants. It stops controller continuation and preserves
136
+ the task graph, allocations, attempts, checks, candidate worktrees and artifacts.
137
+ It does not apply an inverse patch to source: this loop edits isolated candidates,
138
+ and never automatically applies them to the source checkout. Inspect the retained
139
+ base commit and patch artifacts to compare or recover a candidate. A different
140
+ pending decision must be resolved before withdrawing an older cycle. Withdrawing
141
+ an expired cycle is allowed because it reduces authority; it cannot revive the
142
+ clock or refund spend.
143
+
144
+ ## Evidence and schema
145
+
146
+ History is a deterministic projection of the existing private, hash-chained
147
+ journals, not a second mutable database. Legacy histories and cycles retain
148
+ `version: 1`; runs with [request attribution](request-attribution.md) use version 2
149
+ and identify the observed budget revision. Cycles whose review events carry
150
+ sanitized [provider-health evidence](provider-health.md) use version 3 and retain
151
+ the controller snapshot plus the reviewer snapshot when that separate role is
152
+ configured. This records the aggregate operational evidence available to each
153
+ decision without importing credentials, endpoint strings, provider text or new
154
+ execution authority. Each cycle's immutable ID is its final decision event ID. It
155
+ includes:
156
+
157
+ - Trigger event IDs/hashes, principle, proposed hypothesis/change/metric.
158
+ - Parent decomposition and previous attempt links, target tasks, original run
159
+ deadline and limits, scoped worker/controller/reviewer accounts and ancestors.
160
+ - Review hold, explicit approval, application and withdrawal event references;
161
+ original plan approval and separate production approval (`not-approved`).
162
+ - Baseline and direct next-attempt outcomes, checks, artifact hashes, observed
163
+ duration/tool results, unresolved risks, isolation image and rollback references.
164
+ - Original manifest hash and the inspected execution revision.
165
+ - Controller and optional reviewer provider-health snapshots, their observation
166
+ times, relevant-event counts and history hashes.
167
+
168
+ Inspection validates journal ancestry, current artifact read permissions, retained
169
+ artifact bytes and the pinned worktree base. Evidence reads are bounded to 64 MiB
170
+ per inspection; histories retain the execution store's existing event/size bounds.
171
+ No inspection calls a model or replays a tool. Recorded run replay reproduces the
172
+ same cycles without execution. Keep history private: task evidence can contain
173
+ project information even though API keys are not part of the cycle contract.
174
+
175
+ A cycle measures its **direct next attempts**. If a decomposed child fails and a
176
+ nested replan fixes it, the parent cycle retains that first failed result and the
177
+ nested cycle records the verified retry. This preserves the failure instead of
178
+ retroactively claiming every experiment succeeded. `verified` means the recorded
179
+ targets completed their acceptance process, not that every optimization claim was
180
+ proved. Human acceptance remains distinguishable by its source event.
181
+
182
+ ## Measurements and limitations
183
+
184
+ | Measurement | Definition | Comparison requirement |
185
+ |---|---|---|
186
+ | `acceptance-check-pass-rate` | Passed recorded acceptance checks / all recorded checks | Same tasks and check definitions |
187
+ | `attempt-duration` | Sum of task-start to task-finish event durations, milliseconds | Same complete task population |
188
+ | `tool-failure-rate` | Failed completed tool calls / completed tool calls | Same complete task population |
189
+ | `provider-accounted-cost` | Accounted provider charges for the recorded worker attempts, integer nano-dollars | Same complete task population, bound request provenance and fully settled usage |
190
+
191
+ Missing measurements are `null`, never zero. New task populations and changed
192
+ check definitions are explicitly non-comparable. These observations do not prove
193
+ causality or provide an automatic security/performance certification. Requested
194
+ metrics remain proposed even when checks pass. The duration is summed task time,
195
+ not workflow wall time; acceptance checks are not the individual assertions inside
196
+ a test process. The cost measurement excludes planning and controller/reviewer
197
+ overhead, and is not whole-goal cost per successful task or an invoice. Those
198
+ roles retain separate request attribution in run diagnostics. Unknown or pending
199
+ requests retain their conservative charge, but prevent a comparable cost delta.
200
+ Legacy/missing bindings yield unavailable costs rather than fabricated zeroes;
201
+ the shared run/project ledgers continue enforcing their original reservations.
202
+
203
+ For linked goals, [whole-goal metrics](goal-accounting.md) separately include
204
+ planning and review overhead and inspect final artifacts before reporting cost
205
+ per verified task. This total is not a comparable before/after cycle metric.
206
+
207
+ The HUD adds the latest cycle's status, comparable check rate and comparable
208
+ worker-attempt cost. Explicit Brain run ingestion cites the budget revision and
209
+ stores a separate snapshot when accounting changes; hypotheses remain proposed.
210
+ Headless output
211
+ uses `version: 1`, `type: improvement` for results and `type: improvement.event`
212
+ for streamed execution events; enclosed events keep their own schema version.
213
+ Execution exit codes remain 0 success, 4 partial, 3 policy denial, 130 cancellation
214
+ and 1 failure; malformed command arguments exit 2. History is local-only JSON and
215
+ can be redirected for diagnostics. There is no import of execution authority.
216
+
217
+ ## Safety and recovery
218
+
219
+ The loop cannot edit permissions, expand budgets/depth/count, reset deadlines,
220
+ erase evidence, publish, merge, deploy or send external messages. Every file/tool
221
+ mutation uses the shared runtime gates; child admission rechecks inherited scope
222
+ and grants. All coding attempts use retained Git worktrees and reviewed isolated
223
+ verification. Unknown requests retain their reservation, and interrupted calls
224
+ require explicit recovery. A cancelled or denied experiment keeps its partial
225
+ results; a new run is not an automatic escape from its allowance.
226
+
227
+ This implements recursive, evidence-driven **task strategy improvement**. It does
228
+ not automatically patch Calliope itself or promote knowledge to accepted fact.
229
+ The [project Brain](project-brain.md) can explicitly ingest verified run evidence;
230
+ improvement hypotheses remain proposed. [Opt-in agent retrieval](agent-knowledge.md)
231
+ lets planners and workers read that knowledge within their inherited source scopes.
232
+
233
+ ## Reviewed source proposals
234
+
235
+ The native `sourceChangeCapabilities`, `previewSourceChange`,
236
+ `proposeSourceChange`, `inspectSourceChange` and `listSourceChanges` APIs let a host offer verified
237
+ source changes for human review. A source-owned skill or interface uses the Git
238
+ repository that owns its files. Installed skills keep their separate installation
239
+ and trust lifecycle.
240
+
241
+ The selection binds the original run, execution revision, verified cycle, task
242
+ and executor-collected patch hash. Preview checks the original approval, task
243
+ write scope, pinned source commit and repository-local author. It returns the
244
+ patch, affected paths and a review hash without creating Git objects or refs.
245
+ Creating a proposal requires the exact `orchestration_source_proposal` permission
246
+ and rechecks those inputs under the execution lease.
247
+
248
+ The writer creates one commit and one local branch under
249
+ `refs/heads/calliope-proposals/<run>/<review hash>` using a temporary private
250
+ index. It leaves the source checkout/index and execution journal unchanged.
251
+ Immutable intent and candidate records support retry after cancellation or a lost
252
+ response; repeated publication recovers the same branch instead of overwriting
253
+ it. Inspection reports `prepared` when the branch is absent and `proposed` when
254
+ the exact recorded commit is present. Absence alone does not establish whether
255
+ someone previously removed the branch. A moved branch is a conflict.
256
+ Listing retains original review identities across restart and source HEAD changes;
257
+ it reads the same native intent/candidate records and checks each branch.
258
+
259
+ This API does not install skills, merge, push, release or invoke a model. A host
260
+ must explicitly support the separate versioned source-change capability before
261
+ offering the action. Desktop integration and platform qualification are separate
262
+ from native API validation.
263
+
264
+ ## Ordinary task evidence
265
+
266
+ `taskOutcomeCapabilities()` and `inspectTaskOutcome(project, runId, selection,
267
+ options)` expose the same native evidence for an ordinary task outside an
268
+ improvement cycle. Select `{taskId, attempt, executionRevision}` from an inactive
269
+ run. The reader replays the journal at that attempt's start, retains its task,
270
+ agent and strategy configuration hash, and revalidates each artifact's bytes
271
+ under the native read policy. It refuses active ownership, stale selections and
272
+ changed or missing evidence. In particular, a historical live project file that
273
+ a later retry overwrote cannot be freshly verified; retained run artifacts allow
274
+ independent inspection of both attempts.
275
+
276
+ The returned `{value, hash}` separates executor status from native human task
277
+ acceptance, includes original event/check/artifact references, and attributes
278
+ charges to the exact start event using the reservation ledger. Missing or
279
+ unsettled costs remain `null`; reservations are not reported as settled cost.
280
+ Duration, tool calls and failures are recorded observations. An interrupted
281
+ attempt without a finish remains unknown. The accounting snapshot carries its
282
+ own ledger revision and may advance independently of the execution journal.
283
+
284
+ This read-only API performs no inference, artifact execution, ledger writes,
285
+ user assessment, feedback import or reward assignment. A host may separately
286
+ propose a human assessment for memory review; doing so does not change the
287
+ executor evidence. Ordinary-task UI and memory feedback require their own host
288
+ qualification.
289
+
290
+ ## Native validation
291
+
292
+ The [native Brain-loop receipt](docs/evidence/native-brain-loop-smoke.json) records a
293
+ Fable planner/controller and a Haiku worker on a public clamp fixture. All 12 paid
294
+ requests used the native provider after live discovery. Planning recovered from
295
+ one output cutoff within its original allowance. After exact-plan review, the
296
+ worker submitted a deliberately unchanged baseline, the real Docker check failed,
297
+ the controller replanned, and a one-line repair passed the same unchanged tests.
298
+ The live HUD showed both agents, attempts, controller rounds and remaining budgets.
299
+
300
+ Planner and worker Brain reads left its journal unchanged. A fresh process resumed
301
+ and replayed the completed run without model calls or execution/budget changes.
302
+ Explicit run ingestion then preserved both failed and passed checks as observations
303
+ and the improvement hypothesis as proposed knowledge. All artifact hashes were
304
+ verified, and the source checkout remained unchanged.
305
+
306
+ The probe retained $3.068752 of conservative reservations, including the cutoff,
307
+ within a $5 cap. This demonstrates one staged repair cycle; it does not establish
308
+ general coding reliability, causal improvement, or native nested decomposition.
309
+ Provider conformance and signing remain separate release gates.
@@ -0,0 +1,53 @@
1
+ # Calliope CLI 3.7.0
2
+
3
+ This release adds durable ACP session controls, tightens reviewed inference
4
+ admission, and publishes a versioned discovery contract for native improvement
5
+ hosts. It retains the LiteLLM retirement and Hugging Face support from 3.6.0.
6
+
7
+ ## ACP session controls
8
+
9
+ ACP clients can change Work/Plan mode through `session/set_mode` and choose a
10
+ model through `session/set_config_option`. Model choices come from live provider
11
+ discovery. Saved controls survive process restart; stale or concurrent updates
12
+ refuse instead of overwriting another client. Plan mode denies mutating tools.
13
+ Delegated sessions retain their parent's model authority.
14
+
15
+ The stable ACP wire protocol and `--version --json` remain unchanged. Clients
16
+ must negotiate `_meta.calliopeSessionControls.version: 1`; an older CLI does not
17
+ promise these controls. See the [ACP contract](../acp.md).
18
+
19
+ ## Reviewed inference authority
20
+
21
+ New remote-ledger reservations must match the current admitted agent's explicit
22
+ provider/model choices. The host rechecks those constraints under the ledger
23
+ writer lock, including for newly admitted descendants. Rejected choices leave
24
+ the parent's allowance unchanged; already-admitted requests retain their replay
25
+ and settlement semantics.
26
+
27
+ The Node and standalone qualifications use real child and ledger processes with
28
+ deterministic local inference. Task/attempt and endpoint authority, Smart routing
29
+ stage binding and actual disposable Astrolift parent/child acceptance remain in
30
+ [#415](https://github.com/calliopeai/calliope-cli/issues/415). This release does not
31
+ claim those deployment requirements are complete.
32
+
33
+ ## Native improvement host discovery
34
+
35
+ `calliope improve host-capabilities --contract-version 1 --json` reports the
36
+ installed native execution, review-request, task-outcome and source-proposal
37
+ interfaces with independent versions. It does not open the caller's project or
38
+ grant execution authority. Unsupported versions and execution selectors refuse;
39
+ the existing `improve capabilities` response remains compatible.
40
+
41
+ The declaration includes the installed package version and build source metadata
42
+ when available. Metadata is self-reported, not proof of authenticity: verify npm
43
+ integrity and provenance, or native checksums and attestations, against the release
44
+ tag and source commit. Missing, dirty or invalid metadata cannot establish a
45
+ released build. See the [improvement host contract](../improvement-cycles.md).
46
+
47
+ External feedback import, cross-run learned strategy selection and model-weight
48
+ training remain unavailable. SDK 7 recapture work remains separate from this
49
+ release; xAI live qualification remains deferred.
50
+
51
+ Refs: [#444](https://github.com/calliopeai/calliope-cli/issues/444),
52
+ [#415](https://github.com/calliopeai/calliope-cli/issues/415),
53
+ [#413](https://github.com/calliopeai/calliope-cli/issues/413).
@@ -0,0 +1,65 @@
1
+ # Calliope CLI 3.8.0
2
+
3
+ This release adds explicit subscription access, native task-bound delegation and
4
+ reviewed feedback. It also tightens reviewed inference authority and reads
5
+ Mimwell portable knowledge graphs.
6
+
7
+ ## Experimental subscription access
8
+
9
+ `calliope auth chatgpt login` selects ChatGPT-plan access for the OpenAI provider.
10
+ Account selection, private credential storage, refresh/revocation and live model
11
+ discovery are separate from API-key access. Streamed Responses and tool calls use
12
+ Calliope's existing permission loop. Expired sessions stop; quota exhaustion can
13
+ use an explicitly configured paid API-key fallback. Subscription requests refuse output-token
14
+ and USD enforcement that the service cannot provide; USD totals exclude this
15
+ consumption. See [ChatGPT plan access](../chatgpt-plan.md).
16
+
17
+ Quota and rate-limit circuits persist across processes. Opt-in API-key fallback
18
+ reserves every paid request against a shared project ceiling, preserves public
19
+ conversation/tool context and strips encrypted subscription state. Paid sessions
20
+ stay on their selected model; partial output, cancellation, logout and reviewed
21
+ execution stop automatic transitions. A depleted API account stops without
22
+ retrying or switching back. Missing live/reviewed billing bounds refuse payment.
23
+
24
+ `calliope claude -- <prompt>` delegates a complete session to the installed,
25
+ authenticated official Claude Code CLI. `calliope claude status` checks that local
26
+ setup. Claude owns permissions, tools, sessions and plan usage; Calliope's native
27
+ sandbox and budgets do not govern the delegated session. See
28
+ [local Claude plan delegation](../claude-plan.md).
29
+
30
+ These integrations ship as opt-in experimental features. Tests use synthetic
31
+ authentication and response fixtures; live account eligibility and subscription
32
+ prompt/tool round trips remain unqualified. Complete the user-operated checks in
33
+ the linked guides before relying on either route for unattended work.
34
+
35
+ ## Reviewed task authority and feedback
36
+
37
+ Delegated headless and ACP execution can bind to an exact native task attempt,
38
+ including its owner, output cap and original accounting across host restarts.
39
+ Completed or mismatched attempts refuse new inference. Reviewed Smart routing
40
+ pools and provider endpoints now constrain new reservations; an endpoint change
41
+ requires new review, while prior admissions retain replay and settlement.
42
+ See [delegation ledger](../delegation-ledger.md).
43
+
44
+ Version-2 improvement host discovery exposes reviewed task feedback. Receipts bind
45
+ an assessment to the exact observed completed attempt and retain private journal
46
+ evidence. They neither mark a task accepted nor activate a learned policy. See
47
+ [task feedback](../task-feedback.md). External placement and disposable remote
48
+ parent/child acceptance remain tracked in #415; cross-run learned strategy
49
+ selection remains tracked in #413.
50
+
51
+ ## Compatibility and runtime
52
+
53
+ - `brain import` accepts `mimwell-kg/v1` alongside existing graph formats; exports
54
+ continue using `calliope-kg/v1`.
55
+ - OpenAI SDK 7 stream capture handling now recognizes delivered completion events.
56
+ Runtime SDKs, Conf, Ink and supporting dependencies are updated; container builds
57
+ include the metadata builder.
58
+ - Node 24 or later is required. The stable ACP wire protocol remains version 1.
59
+ - Mistral/Hugging Face SDK 7 live qualification follow-up remains in #457; xAI is
60
+ explicitly deferred by the existing publication gate.
61
+
62
+ Performance budgets from #210 remain enforced for cold start, keystroke rendering
63
+ and retained-session heap growth. See [performance measurements](../performance.md).
64
+
65
+ Refs: #474, #467, #468, #415, #455, #463, #457.
@@ -0,0 +1,84 @@
1
+ # Reviewed metadata for bounded provider calls
2
+
3
+ Some providers discover model IDs without publishing capabilities, limits or
4
+ prices through their models API. An operator can supply the missing evidence for
5
+ bounded execution in a private billing file. This does not enable Smart routing,
6
+ change a provider/model pin, or add models to discovery. The selected model and
7
+ endpoint must still match recent live discovery.
8
+
9
+ Use `~/.calliope-cli/billing.json` or `CALLIOPE_BILLING_FILE`, outside the worker
10
+ project. Protect it with `chmod 600`. The existing reader rejects aliases,
11
+ symlinks, hardlinks, group/world write access, files over 128 KiB and more than
12
+ 64 profiles. Profiles are operator authority; workers must never generate or
13
+ install them from their outputs.
14
+
15
+ ```json
16
+ {
17
+ "version": 2,
18
+ "profiles": [{
19
+ "version": 2,
20
+ "provider": "deepseek",
21
+ "model": "<exact live-discovered model ID>",
22
+ "target": "<configured providerTarget(provider).key digest>",
23
+ "checkedAt": 0,
24
+ "expiresAt": 0,
25
+ "sources": ["https://api-docs.deepseek.com/quick_start/pricing/"],
26
+ "prices": {"input": 0, "output": 0},
27
+ "capabilities": {"chat": true, "tools": true, "streaming": true},
28
+ "limits": {"contextLength": 0, "maxOutputTokens": 0},
29
+ "admission": "reviewed-full-context-v1"
30
+ }]
31
+ }
32
+ ```
33
+
34
+ The placeholders are intentionally invalid. Set positive token limits from
35
+ current provider documentation and epoch-millisecond timestamps, with expiry at
36
+ most seven days after review. Review the exact endpoint's billing terms: a
37
+ gateway may charge differently from its upstream provider. Prices are USD per
38
+ million tokens and must upper-bound applicable cache, reasoning and time/tier
39
+ rates on the adapter path. URL presence alone does not verify metadata. Include
40
+ no keys, private prompts or response content; source URLs must be HTTPS without
41
+ credentials, queries or fragments. Every configured provider can use this schema;
42
+ the CLI bundles no model or pricing catalogue.
43
+
44
+ ## Conservative admission
45
+
46
+ Each request reserves the larger of reviewed and live input capacity, plus its
47
+ requested maximum output. This is a full-capacity allowance, not a tokenizer
48
+ estimate or consumed tokens. A tiny prompt to a large-context model may therefore
49
+ need substantial token headroom before dispatch; do not reduce the reviewed
50
+ capacity to make a budget fit. Successful usage reporting settles the reservation
51
+ to reported usage at the reserved rates. Failures, cancellation and missing usage
52
+ retain the reservation, and overruns stop subsequent requests.
53
+
54
+ The output maximum is the smaller of the reviewed and live limits. Prices use
55
+ the larger rate for each input/output direction. Reviewed capabilities fill only
56
+ unknown live fields; a live rejection always vetoes the request. Unknown required
57
+ capabilities in both sources fail closed. Live routing metadata remains unchanged,
58
+ including unknown prices used by Smart ranking. This profile does not request
59
+ Anthropic token counting, accept supplied input counts or admit multimodal input.
60
+
61
+ The provider/model/endpoint binding, original run/agent/project budgets, policy,
62
+ deadlines and cancellation checks still apply. The profile is re-read before
63
+ reservation and before dispatch; deletion, edits or expiry revoke admission.
64
+ Revocation after a durable reservation retains that reservation conservatively.
65
+ No automatic paid probe or retry can replenish the original allowance.
66
+
67
+ ## Versioning and recovery
68
+
69
+ Version-2 billing files can contain these profiles together with unchanged
70
+ [legacy counted profiles](counted-admission.md). Version-1 files retain their
71
+ original format and hashes; no file or historical journal is migrated.
72
+
73
+ New quotes carry `quoteEvidence.version = 2`, including the reviewed profile and
74
+ digest, quote time, live observations and required capabilities. Execution
75
+ reservations carrying that proof use reservation event version 4, also supporting
76
+ existing request attribution. Replay reconstructs the conservative bounds from
77
+ the recorded proof and rejects inconsistent prices, limits or event versions.
78
+ Historical replay checks validity at quote time, without fetching metadata or
79
+ requiring a now-expired profile to be renewed.
80
+
81
+ Ordinary project-capped turns include the same proof in their existing hash-linked
82
+ policy audit event. Execution journals retain it with the reservation. Neither
83
+ contains prompt bytes, tool arguments or credentials. The outer headless JSON
84
+ envelope and existing ledger projections retain their versions.