@staix/agent-hub 0.37.0 → 0.39.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.
- package/CHANGELOG.md +55 -0
- package/README.md +17 -7
- package/docs/adding-an-ai-tool.md +6 -4
- package/docs/agent-notes/README.md +16 -0
- package/docs/agent-notes/adapters.md +4 -2
- package/docs/agent-notes/budget.md +8 -0
- package/docs/agent-notes/daemon.md +15 -8
- package/docs/agent-notes/local-worker.md +1 -1
- package/docs/agent-notes/security-review.md +55 -0
- package/docs/agent-notes/tasks.md +15 -4
- package/docs/agent-notes/tests.md +3 -2
- package/docs/design/adapters.md +51 -0
- package/docs/design/agent-hub-architecture.md +29 -1
- package/docs/design/guidance-probes.md +365 -0
- package/docs/design/task-board.md +151 -5
- package/docs/dogfood.md +22 -7
- package/docs/events.md +3 -3
- package/docs/memory.md +5 -5
- package/docs/operations.md +189 -32
- package/docs/profiles.md +101 -9
- package/docs/quickstart.md +38 -4
- package/docs/research.md +6 -3
- package/docs/roles.md +52 -0
- package/docs/sdlc.md +187 -1
- package/docs/security.md +56 -13
- package/docs/text-projection.md +1 -0
- package/docs/verification/2026-11-11-0.38.0.md +41 -0
- package/docs/verification/2026-11-11-guidance-probe-t3-1226.md +85 -0
- package/docs/verification/2026-11-11-guidance-probe-t4-1226.md +65 -0
- package/docs/verification/2026-11-13-claude-implementer-2.1.323.md +59 -0
- package/docs/verification/2026-11-13-codex-01672-reviewer-isolation.md +69 -0
- package/docs/verification/2026-11-14-0.39.0.md +51 -0
- package/docs/verified.json +48 -25
- package/package.json +3 -3
- package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
- package/plugins/agent-hub/kimi-hook.js +1989 -474
- package/plugins/agent-hub/server.js +2056 -512
- package/src/adapters/acp-model-policy.ts +1 -1
- package/src/adapters/acp-session-model.ts +35 -0
- package/src/adapters/acp.ts +14 -0
- package/src/adapters/agy/definition.ts +1 -1
- package/src/adapters/agy/hooks.ts +7 -0
- package/src/adapters/claude-channel.ts +3 -2
- package/src/adapters/claude-implementer.ts +8 -0
- package/src/adapters/claude-print-child.ts +26 -2
- package/src/adapters/claude-print.ts +4 -0
- package/src/adapters/codex-appserver.ts +90 -16
- package/src/adapters/codex-review-isolation.ts +2 -0
- package/src/adapters/compat.ts +4 -4
- package/src/adapters/conformance/fakes/acp-server.ts +11 -2
- package/src/adapters/conformance/fakes/app-server.ts +5 -1
- package/src/adapters/conformance/fakes/pi-rpc.ts +1 -1
- package/src/adapters/definitions/builtin-metadata.ts +6 -6
- package/src/adapters/definitions/native-cli-jcode-mcp.ts +18 -3
- package/src/adapters/definitions/native-quota.ts +122 -0
- package/src/adapters/definitions/native-recovery.ts +3 -0
- package/src/adapters/definitions/qwen.ts +1 -1
- package/src/adapters/kimi-review.ts +23 -0
- package/src/adapters/kimi-wire-usage.ts +39 -16
- package/src/adapters/local-probe.ts +65 -6
- package/src/adapters/local-worker.ts +6 -3
- package/src/adapters/pi-state-model.ts +12 -0
- package/src/adapters/pi.ts +22 -0
- package/src/adapters/print-result-model.ts +24 -0
- package/src/adapters/registry-types.ts +10 -1
- package/src/adapters/registry.ts +19 -2
- package/src/adapters/reviewer-print.ts +130 -15
- package/src/adapters/role-eligibility.ts +99 -0
- package/src/adapters/same-directory.ts +16 -0
- package/src/cli/agy-mcp.ts +18 -7
- package/src/cli/console-state.ts +3 -1
- package/src/cli/free-text.ts +20 -0
- package/src/cli/handoff-args.ts +1 -1
- package/src/cli/help.ts +61 -6
- package/src/cli/identity.ts +10 -4
- package/src/cli/init-prompt.ts +31 -2
- package/src/cli/init-roles.ts +156 -0
- package/src/cli/init-settings.ts +24 -2
- package/src/cli/init.ts +141 -17
- package/src/cli/main.ts +216 -56
- package/src/cli/model.ts +1 -1
- package/src/cli/output.ts +64 -5
- package/src/cli/preview.ts +1 -1
- package/src/cli/recovery-launch.ts +114 -0
- package/src/cli/recovery-package.ts +14 -7
- package/src/cli/recovery-version-preflight.ts +104 -0
- package/src/cli/role-doctor.ts +39 -0
- package/src/cli/sdlc-output.ts +66 -1
- package/src/cli/study-output.ts +54 -0
- package/src/cli/study.ts +14 -1
- package/src/cli/terminal-recovery.ts +14 -0
- package/src/cli/upgrade-presentation.ts +4 -0
- package/src/cli/upgrade-restore-state.ts +12 -3
- package/src/cli/upgrade-runtime.ts +41 -3
- package/src/cli/upgrade.ts +8 -4
- package/src/hub/advisor-survey.ts +139 -0
- package/src/hub/audit-source.ts +66 -0
- package/src/hub/board.ts +479 -14
- package/src/hub/budget.ts +54 -4
- package/src/hub/bus.ts +2 -2
- package/src/hub/conductor.ts +14 -8
- package/src/hub/config-apply.ts +2 -1
- package/src/hub/config-edit-host.ts +77 -5
- package/src/hub/considered-findings.ts +47 -0
- package/src/hub/control-client.ts +1 -1
- package/src/hub/daemon.ts +373 -66
- package/src/hub/deliverable-files.ts +17 -1
- package/src/hub/dogfood-profile.ts +3 -2
- package/src/hub/envelope.ts +6 -1
- package/src/hub/events.ts +23 -2
- package/src/hub/folder-trigger.ts +11 -4
- package/src/hub/guidance-probe-store.ts +345 -14
- package/src/hub/guidance-probes.ts +338 -4
- package/src/hub/hub-tools.ts +88 -16
- package/src/hub/kimi-usage.ts +34 -2
- package/src/hub/lifecycle-schema.ts +3 -3
- package/src/hub/manager.ts +24 -1
- package/src/hub/memory-profile.ts +9 -1
- package/src/hub/memory-sync-state.ts +1 -0
- package/src/hub/model-overrides.ts +2 -1
- package/src/hub/no-writes.ts +2 -0
- package/src/hub/operational-authority.ts +8 -2
- package/src/hub/operational-view.ts +5 -1
- package/src/hub/peers.ts +2 -0
- package/src/hub/person-command.ts +25 -0
- package/src/hub/plan-conformance.ts +20 -2
- package/src/hub/quota-account.ts +34 -0
- package/src/hub/recovery-policy.ts +18 -4
- package/src/hub/research-evidence.ts +51 -3
- package/src/hub/research.ts +77 -13
- package/src/hub/restart.ts +14 -0
- package/src/hub/review-budget.ts +88 -0
- package/src/hub/review-findings.ts +93 -12
- package/src/hub/reviewer-pool-config.ts +6 -2
- package/src/hub/reviewer-pool.ts +39 -6
- package/src/hub/routing.ts +7 -3
- package/src/hub/sdlc-merge.ts +1 -1
- package/src/hub/sdlc-queue.ts +14 -4
- package/src/hub/sdlc-release.ts +1 -1
- package/src/hub/sdlc.ts +10 -6
- package/src/hub/security-audit.ts +178 -0
- package/src/hub/security-pass.ts +115 -0
- package/src/hub/settings.ts +11 -5
- package/src/hub/source-read.ts +80 -2
- package/src/hub/sources.ts +57 -9
- package/src/hub/startup-event-seeds.ts +5 -3
- package/src/hub/startup-timing.ts +1 -0
- package/src/hub/supervision.ts +3 -2
- package/src/hub/synthesis-readiness.ts +279 -0
- package/src/hub/tasks.ts +1131 -72
- package/src/hub/text-projection.ts +11 -1
- package/src/local/probe-types.ts +2 -0
- package/src/local/probe-workspace.ts +191 -2
- package/src/memory/capture.ts +2 -1
- package/src/ui/guidance-panel.ts +34 -2
- package/src/ui/guidance-view.ts +33 -0
- package/src/ui/index.html +3 -0
- package/src/ui/office-model.ts +11 -3
- package/src/ui/office-space.ts +50 -30
- package/src/ui/plugin.ts +31 -14
- package/templates/AGENTS.block.md +14 -14
- package/templates/profiles/general.json +1 -1
- package/templates/profiles/research.json +1 -1
- package/templates/profiles/writing.json +1 -1
package/docs/design/adapters.md
CHANGED
|
@@ -230,6 +230,42 @@ The PII screen is distinct from ordinary optional inference. It may use an on-de
|
|
|
230
230
|
|
|
231
231
|
Runtime memory capture and recall use the in-process `@staix/agent-mem` package, screened and invoked by host integration. claude-mem is off by default and import-only; there is no worker HTTP or model-summary path in the runtime. This avoids a parallel capture route with different privacy checks ([#752](https://github.com/STAIxBWLB/agent-hub/issues/752), [agent-mem#13](https://github.com/STAIxBWLB/agent-mem/issues/13)).
|
|
232
232
|
|
|
233
|
+
## Codex quota observation (#1440)
|
|
234
|
+
|
|
235
|
+
Codex reads `account/rateLimits/read` through its current authenticated TUI link
|
|
236
|
+
using hidden negative request IDs. Normal cadence remains `usagePollMs` (ten
|
|
237
|
+
minutes by default). While the canonical Budget account has an open pause,
|
|
238
|
+
Budget's observational subscription re-arms the adapter at the fixed 60-second
|
|
239
|
+
cadence. The subscription and all usage timers/requests are revoked on detach,
|
|
240
|
+
stop or input replacement; a late callback cannot poll or retime a new link.
|
|
241
|
+
The adapter never redeems a credit or resumes a peer. Budget.evaluate retains
|
|
242
|
+
its existing native-window/reset-time resume path and manual pause boundaries.
|
|
243
|
+
|
|
244
|
+
The native-to-host callback contains only window fields and a separate allowlist
|
|
245
|
+
of account diagnostics: reset-credit count, proven earliest expiry, expiry-known
|
|
246
|
+
flag, ordinaryUsageAllowed, hasCredits and unlimited. Native balances, account
|
|
247
|
+
identifiers, credit identifiers, titles and descriptions are discarded at that
|
|
248
|
+
boundary. `availableCount` is authoritative; the detail list can be capped, so a
|
|
249
|
+
partial or unavailable list leaves global earliest expiry unknown. Nullable or
|
|
250
|
+
malformed Boolean fields remain unknown, preserving explicit false values.
|
|
251
|
+
|
|
252
|
+
Diagnostics are timestamped RAM-only data keyed by the existing canonical hub
|
|
253
|
+
account. Paused-account budget text/JSON shows their freshness and permitted
|
|
254
|
+
fields. A fresh snapshot reporting ordinary usage unavailable and paid credits
|
|
255
|
+
available labels that turns would use paid credits; no financial flag changes
|
|
256
|
+
quota admission, pause or resume. A restart leaves these diagnostics unknown
|
|
257
|
+
until another native read. Older clients may omit the additive accountUsage
|
|
258
|
+
projection. Native/account effectiveness remains separate from fake-clock and
|
|
259
|
+
fake app-server fixtures.
|
|
260
|
+
|
|
261
|
+
## Observed turn model (#1402)
|
|
262
|
+
|
|
263
|
+
An adapter may implement `PeerAdapter.observedModel()`: the model its native surface reported for the turn that just ended, as `{ model, evidence }`. The daemon reads it once, when it writes the peer's `turn_end`, and passes it through `turnModelFields`: the event carries `model` (the id exactly as reported, through `safeModelLabel`) and `modelEvidence` (`served`, `session` or `configured`, strongest first) or neither. A label `safeModelLabel` refuses is dropped whole, never truncated, and an alias (`opus`, `default`) is never expanded. An adapter that reports nothing, or throws, records nothing: unknown stays unknown. Codex and Claude print are wired (#1402 T2); the others (ACP peers, Pi, Antigravity) by the later tasks of #1402. Codex: the model in the `thread/start` or `thread/resume` reply, or the model the hub or the TUI started a turn with once Codex accepted it, is `session`; a `model/rerouted` notification names the model it moved the running turn to, `served` for that turn only. Neither reply nor `turn/start` carries a per-response model, so Codex is never `served` unless it said so (schema of codex-cli 0.167.2). Claude print (reviewer and implementer): the `modelUsage` keys of the `result` row are `served`; several keys name the one with strictly more usage tokens, and a tie or a breakdown with no counts names none (`src/adapters/print-result-model.ts`). Claude channel and TUI sessions are unchanged (their transcript usage already carries `servedModel`). research builds `ownerModels` from the owner's turns only (`docs/research.md`).
|
|
264
|
+
|
|
265
|
+
ACP peers (Qwen, Jcode, headless Kimi; #1402 T3) report the session's current model as `session` evidence, whatever the override policy (`src/adapters/acp-session-model.ts`). The id is read from `models.currentModelId` or the `model` select's `currentValue` of the `session/new` or `session/load` result, and moved by `current_model_update`, `config_option_update` and Qwen's `session/model-update` notices for the current session only. It is the value when the turn's prompt was sent, read once at the turn end, so a change that arrives mid-turn belongs to the next one. Qwen's `id(openai)` wire id goes through its receipt codec; an id `safeModelLabel` refuses, the placeholder `unknown` or an absent field names no model. This is the agent's own current model, not a per-response one, so it is never `served`.
|
|
266
|
+
|
|
267
|
+
Pi and Antigravity (#1402 T4). A headless Pi reads `get_state` when a turn starts: `data.model.id` is `session` evidence (`src/adapters/pi-state-model.ts`); Pi 1.5.2 reports the placeholder id `unknown` when no model is selected, which names none. The model the hub set with `set_model` that Pi acknowledged is `configured` and only used when `get_state` names none. The Pi TUI snapshot (`get_session_state`) carries no model, so a TUI Pi reports only a `configured` one. Antigravity's hook payloads carry `modelName` (verified in the 1.4.3 to 1.5.3 receipts); `decodeAgyHook` keeps it as `NativeFactsInput.model` through `safeModelLabel`, and the daemon holds the latest one per peer and uses it, as `session` evidence, for the turn that ends next, dropping it when the peer goes offline. The Antigravity transcript rows the usage reader parses carry no model, so the hook is the only source. An alias such as `default` is kept as reported, never expanded.
|
|
268
|
+
|
|
233
269
|
## Person-owned live model selection (#1317)
|
|
234
270
|
|
|
235
271
|
A person may store a per-peer model override in `hub.db` with `ahub model set`,
|
|
@@ -403,3 +439,18 @@ The local worker binds review observer exclusion to its actual input envelopes b
|
|
|
403
439
|
Only a host-owned getter supplies the imported agent-mem instruction at an admitted headless turn boundary, after owned input and busy state exist and before the native prompt/model request. Multi-call local turns keep one fixed prompt. Native-client prompts, steer, Claude hooks and isolated reviewers keep their separate surfaces. A getter failure omits optional Record guidance and does not change ordinary routing. The production getter reads the public `recordsEnabled(activeHome, executionCwd)` accessor from the exact-pinned amem package; either machine or repository false disables the optional Record path. Its boolean revision is not a privacy-policy fingerprint: current package and hub screens are rechecked separately before effects.
|
|
404
440
|
|
|
405
441
|
Model final output uses a host-only final-answer callback distinct from explicit send tools and diagnostic messages. Only normal completion can append Record rows; partial output is stripped for sharing without certifying a settled record. Capture binds immutable owner, turn, session/generation, execution cwd, profile and policy identity. Replacement, exclusion or unsafe steering revokes the frame before any later append. This grants no task, permission, native consumption or model acceptance authority.
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
## Restoration launch diagnostics (#1426)
|
|
445
|
+
|
|
446
|
+
Recovery keeps terminal descriptors and native ownership/session proofs intact. A private per-attempt launch observation binds its nonce and peer, records only a nonzero exit and bounded screened hub diagnostic, and is consumed between readiness slices. It is failure evidence only: it cannot settle a session, waive a hold or grant startup authority. Late outcomes cannot replace another attempt. Restore receipts/status retain typed `version_refused` or `launch_exit` causes and the existing coordinator resume command; legacy receipts remain readable.
|
|
447
|
+
|
|
448
|
+
Before source commit, the verified target's compatibility assessor and current machine trust decide the configured versions of semantically version-gated restored peers. Unknown is not accepted. Fixed native definitions declare those gates; ordinary Codex does not inherit its reviewer-only gate. Cached uncommitted stages recheck mutable observations, while committed or commit-sent sources retain their recovery evidence rather than gaining a retroactive gate. Tests use fake executable/transport observations; these fixtures do not attest a live account or terminal restoration.
|
|
449
|
+
|
|
450
|
+
## Reviewer quota and owned accounting (#1446)
|
|
451
|
+
|
|
452
|
+
Native definitions admit only pinned outer refusal envelopes, returning safe window/reset metadata and no raw message. Codex exec 0.166.0 has a message-only error schema; only pinned native refusal prefixes inside outer `error`/`turn.failed` are recognized, with UNKNOWN reset. Kimi has no typed frame: the exception is a nonzero owned child with complete bounded own-stderr beginning `error: failed to run prompt: provider.` and containing `usage limit`, observed on 2.2.0 and unverified on 2.5.2. This exception always has UNKNOWN reset. Never inspect stdout/model/tool prose or wire error records. Source pointers and the diagnostic receipt are in [operations](../operations.md#reviewer-quota-admission-and-review-caps-1446).
|
|
453
|
+
|
|
454
|
+
Reviewer quotas use canonical Budget fanout; attached account siblings remain the only native rate-limit observation source. A reviewer-only child adds no account transport and cannot prove an early reset. The wall cap samples once per child and uses the same owned teardown. Kimi usage-only reads reuse the existing session-index/wire counter in the private profile after group settlement, before cleanup. A host opaque journal intent must ACK before spawn; a complete/unknown terminal must ACK after usage read. Incomplete profiles remain held, and unmatched/unknown attempts make the account soft count unknown across restart without inventing an expiry. No native session/home/prompt/stderr leaves the owned read boundary.
|
|
455
|
+
|
|
456
|
+
The host receives admitted quota observations before task fallback, so explicit stop/cleanup failure cannot erase a hard pause. Only settlement of that owned attempt releases the handoff hold. Kimi's stderr callback remains after nonzero owned settlement; no earlier diagnostic gains authority.
|
|
@@ -5,6 +5,7 @@ title: Agent Hub Architecture
|
|
|
5
5
|
status: draft
|
|
6
6
|
parent: agent-hub
|
|
7
7
|
paths:
|
|
8
|
+
- src/hub/startup-event-seeds.ts
|
|
8
9
|
- src/hub/daemon.ts
|
|
9
10
|
- src/hub/peers.ts
|
|
10
11
|
- src/hub/envelope.ts
|
|
@@ -52,6 +53,16 @@ id and cannot release observer provenance or establish execution isolation. A
|
|
|
52
53
|
person takeover detaches ownership without terminating the process, and normal
|
|
53
54
|
delivery uncertainty remains independent ([#1174](https://github.com/STAIxBWLB/agent-hub/issues/1174)).
|
|
54
55
|
|
|
56
|
+
The cooperative instruction boundary also permits the unique conductor to stage
|
|
57
|
+
only off/advise and required check names through `ahub sdlc configure` after
|
|
58
|
+
initialization. The host rechecks its authenticated session, role, privacy and
|
|
59
|
+
recovery context, requires durable instruction intent before the existing
|
|
60
|
+
validated write and backup, and records the actual actor with value hashes.
|
|
61
|
+
The file takes effect at the next start. Initialization, generic settings editing,
|
|
62
|
+
enforce and protected lifecycle settings remain person-only; no release consent
|
|
63
|
+
follows from the configuration claim. See [the narrow SDLC configuration
|
|
64
|
+
contract](../sdlc.md#instructed-conductor-configuration-1432).
|
|
65
|
+
|
|
55
66
|
## Console presentation surfaces
|
|
56
67
|
|
|
57
68
|
The floating pet belongs to acon Mini (#1012). The compatibility command
|
|
@@ -89,6 +100,13 @@ establish entailment or synthesis readiness. The research-only record tool
|
|
|
89
100
|
returns an ids-only receipt and excludes its arguments/results from capture.
|
|
90
101
|
Its T1 authorization, revision and recovery boundaries are defined in
|
|
91
102
|
[the task-board contract](task-board.md#claim-evidence-records-931-t1).
|
|
103
|
+
Explicit synthesis checks bind the complete evidence inventory and registered
|
|
104
|
+
deliverable hashes through that boundary, rechecking privacy and immutable
|
|
105
|
+
provenance after asynchronous reads. Their separate readiness statuses certify
|
|
106
|
+
structural provenance only; #901 retains person judgment. Append-only relation
|
|
107
|
+
history prevents withdrawal/reclassification from silently erasing a contradiction;
|
|
108
|
+
its current manifest still needs the person's explicit disposition. See
|
|
109
|
+
[explicit synthesis readiness](task-board.md#explicit-synthesis-readiness-931-t3).
|
|
92
110
|
|
|
93
111
|
## Bounded visual attachments (#1058)
|
|
94
112
|
|
|
@@ -108,7 +126,7 @@ summary 4000, each pro/con 2000, table cell 4000, key 128, path 4096 and asset
|
|
|
108
126
|
reference 256. These are hub limits, not a claim that acon imposes each limit;
|
|
109
127
|
validation refuses rather than truncates. acon counts Mermaid UTF-16 code units
|
|
110
128
|
and leaves captions unbounded, while the hub counts UTF-8 bytes. All 42 published
|
|
111
|
-
acon 0.
|
|
129
|
+
acon 0.2.0 visual cases are consumed directly; six named valid-acon cases are
|
|
112
130
|
rejected only by these stricter source/caption/asset-ID ceilings. Historical
|
|
113
131
|
hub-owned cases remain extra coverage, not a substitute for the shared fixture.
|
|
114
132
|
|
|
@@ -186,6 +204,10 @@ Privacy decisions are made at hub boundaries, not delegated to model routing. A
|
|
|
186
204
|
|
|
187
205
|
Recovery is a coordinated daemon operation over separately persisted board, delivery, and native-session evidence. A restart or upgrade can continue only with compatible feature evidence from the verified target and host-held proofs that still match the project and actor. Adapters report native evidence; they do not certify their own recovery authority. This avoids treating a stale status file or an unverified receipt as proof that a native process is safe to resume ([#37](https://github.com/STAIxBWLB/agent-hub/issues/37), [#625](https://github.com/STAIxBWLB/agent-hub/issues/625), [#900](https://github.com/STAIxBWLB/agent-hub/issues/900)).
|
|
188
206
|
|
|
207
|
+
Advisor surveys use that same Tasks authority and recovery boundary. An explicit person or current conductor request creates one read-only planner task and its private pinned-ref survey record in one transaction before any task delivery. Findings remain declarations until the current planner explicitly vets them; resulting cards enter the backlog for planning or read-only investigation. Prior rejections remain append-only and apply only within their repository, semantic identity and unchanged affected paths. An unavailable complete diff retains unknown suppression, while explicit reasoned reconsideration appends history. Public briefs and readback withhold security details and private source facts. The `advisor_surveys` recovery feature is required once surveys, candidates or considered records exist; the conditional `advisorSurveys` proof contains validated counts and a digest, and empty legacy stores retain their existing snapshot shape and database floor. Bounds and role rules are in the [task-board contract](task-board.md#advisor-survey-and-rejection-ledger-1403-t7).
|
|
208
|
+
|
|
209
|
+
Target-version preflight and bounded private launch-failure observations follow the [adapter restoration contract](adapters.md#restoration-launch-diagnostics-1426). Failure diagnostics do not replace the existing native ownership, readiness or permission proofs.
|
|
210
|
+
|
|
189
211
|
The architecture does not claim that a fixture proves a real provider account, native session, campus network, or operating-system sandbox. Those are distinct runtime evidence and remain separate from source-level and automated checks ([#625](https://github.com/STAIxBWLB/agent-hub/issues/625), [#754](https://github.com/STAIxBWLB/agent-hub/issues/754)).
|
|
190
212
|
|
|
191
213
|
## Person review packages (#1056)
|
|
@@ -193,3 +215,9 @@ The architecture does not claim that a fixture proves a real provider account, n
|
|
|
193
215
|
The task-board module owns anchored findings and person-authored comment lifecycles. Transport carries one explicit review package only after `Tasks` admits the selected draft set; drafting and editing do not start peer turns. acon supplies the shared review kit and a server-verified person identity, while the standalone dashboard reads counts and bounded placements only. Neither surface writes the Board directly.
|
|
194
216
|
|
|
195
217
|
The host-only review package reference is an observer exclusion, not PII authority. Durable open comment/finding scope protects memory notes naming that task after restart or intervening input. Capture, progress and session-title exclusion follows the current review input, not unrelated board history. The read-only own held inbox view (#1328 AC6) creates no durable handout receipt. Its narrow conservative ceiling also excludes retained readable observer-excluded held inputs (trusted review packages and host-stamped peer chat/status responses) across restart until explicit disposition, even if unread; an overflowing or unreadable recipient row/byte window stays unknown and excluded because a previously viewed review can move outside the window. Ordinary queued/deferred review rows do not acquire this ceiling, and verified ordinary replacement retains its existing turn rules. ID-only current-input holds survive daemon restart. An intact, readable, complete store with no matching held record admits a new session as clean. Unreadable or corrupt storage and unconfirmed coverage for the current identity remain excluded. A validated release receipt confirms that identity without declaring other legacy identities clean. For an identified pull-only session, a positive held row remains sticky across restart until confirmed native identity changes. Its own incomplete marker excludes until verified ordinary replacement or a confirmed new session clears that marker; legacy coverage alone does not create a sticky hold. Missing native identity permits handout under an in-RAM unknown-held scope. A never-identified peer can release it with verified ordinary replacement in that daemon run; earlier positive or incomplete SID rows instead keep unidentified observer state held until a real SID is confirmed. First confirmation persists any current RAM quote under that SID before clearing the peer marker, without discarding other SID rows. It does not invent a native identity or weaken write-failure refusal. Legacy coverage completes from settled journal evidence, after which NULL clean receipts can be pruned; corrupt state remains excluded and is named in status with a repair next step. The hold grants no authority; the task-bound recipient summary and check output remain distinct from observer projections. Explicit publication recovery uses the saved immutable envelope and retained journal evidence, never automatic effect replay. Its intended recipient may read a public package, but memory capture, operational views, delivery logging and incoming-message labels exclude its body. Local-worker capture latches exclusion before any tool in a batch that submits an anchored verdict, including a refused verdict, and applies it to subsequent capture, final summaries and retained history. A delayed response cannot become capturable when another turn starts. Recovery advertises the conditional `review_comments` feature when retained comment/package records require it. It also requires `review_observer_input_state` when held or unknown session-input provenance could otherwise be lost. See [the task-board contract](task-board.md#anchored-review-packages-1056) for bounds, immutable snapshot placement and lifecycle authority.
|
|
218
|
+
|
|
219
|
+
## Reviewer quota coordination (#1446)
|
|
220
|
+
|
|
221
|
+
Reviewer admission is a pure consumer of canonical account headroom and Budget pause evidence, with default floor 0.8, unknown policy skip and per-child cap 20 minutes. Explicit `review.unknown_quota = "pass"` admits unknown observations while retaining the known floor; admitted unknowns supply no wait evidence. `review.gate = "off"` disables floor/unknown checks and all quota waiting, while actual Budget/manual pauses and existing role/health/family guards remain binding. The hub does not gain a second native quota transport or resume authority. Tasks persists bounded wait identity/deadline in role history, schedules one owned deadline per current review, and consumes existing Budget signals. Only a fully quota-blocked declared pool with known resets and a numeric gate waits; unknown under the default skip policy or other blockers use existing fallback. Kimi accounting uses the existing event journal and usage counter, with acknowledged pre-spawn intent, post-settlement terminal accounting, and conservative UNKNOWN replay for unmatched/damaged history. It adds no account/private-profile store.
|
|
222
|
+
|
|
223
|
+
An admitted quota observation writes the canonical account pause independently of task reroute. A host opaque attempt hold delays Budget handoff until owned group/watch settlement; task reroute remains generation-fenced. Controlled recovery conditionally requires `reviewer_quota` and includes safe accounting counts, replay completeness and ordered journal digest in the existing integrity snapshot, checked before target usage replay. Explicit `review.unknown_quota` (including skip) or gate off requires the existing `reviewer_quota` capability; legacy empty state without explicit policy adds no capability requirement.
|
|
@@ -35,6 +35,15 @@ paths:
|
|
|
35
35
|
- test/guidance-probe-input-matrix.test.ts
|
|
36
36
|
- test/guidance-probe-sandbox.test.ts
|
|
37
37
|
- test/omniroute.test.ts
|
|
38
|
+
- src/hub/manager.ts
|
|
39
|
+
- src/ui/plugin.ts
|
|
40
|
+
- src/ui/guidance-panel.ts
|
|
41
|
+
- src/ui/guidance-view.ts
|
|
42
|
+
- test/guidance-probe-status.test.ts
|
|
43
|
+
- test/guidance-probe-console.test.ts
|
|
44
|
+
- test/guidance-probe-cli.test.ts
|
|
45
|
+
- test/guidance-probe-gate.test.ts
|
|
46
|
+
- test/helpers/guidance-probe-tasks.ts
|
|
38
47
|
---
|
|
39
48
|
|
|
40
49
|
# Fake-only guidance probe admission
|
|
@@ -800,3 +809,359 @@ Store replay path applies. No replay call may create an unframed reservation.
|
|
|
800
809
|
Tests add an ordinary delivered
|
|
801
810
|
message during a running fake effect and prove continuity, then independently
|
|
802
811
|
change authority/privacy and prove the next effect is refused.
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
## T3 receipts, reconcile and cleanup contract
|
|
815
|
+
|
|
816
|
+
This section is a contract proposal for review before implementation, on merged T2
|
|
817
|
+
(`fa53e8b1`). It does not enable a runner, claim native confinement or authorize a real
|
|
818
|
+
model or worker trial. The constructor-only host adapter stays unwired. T3 adds evidence
|
|
819
|
+
and cleanup around sessions the existing lifecycle already runs; it changes no admission,
|
|
820
|
+
budget, fence or authority rule.
|
|
821
|
+
|
|
822
|
+
### What a receipt is
|
|
823
|
+
|
|
824
|
+
A receipt is the host's immutable observation of one finished session, written once after
|
|
825
|
+
the process tree is known quiescent and the output is collected. It is not a provider
|
|
826
|
+
claim: every field is computed by the host from what it admitted, measured or read back.
|
|
827
|
+
|
|
828
|
+
`ProbeReceiptV1` is closed, inert JSON, canonical and bounded like the manifest. It binds
|
|
829
|
+
exact experiment and slot ids, the reservation generation and revision, and:
|
|
830
|
+
|
|
831
|
+
- `requestedModel` and `servedModel`: exact literals. `servedModel` is `null` when the
|
|
832
|
+
host could not observe it. No normalization, alias or slash splitting.
|
|
833
|
+
- `inputFrameSha256` and, for a worker, `workerEffectiveInputSha256` and
|
|
834
|
+
`nonGuidanceInputSha256`; `guidanceSha256` for the admitted slot.
|
|
835
|
+
- `runtimeSha256`, `toolsetSha256`, `modelConfigSha256`, read from the host's own
|
|
836
|
+
fingerprints at seal time (`localProbeFingerprints`), never copied from the declaration.
|
|
837
|
+
They are `null` when the host could not read them (a crash reconcile never saw them),
|
|
838
|
+
which is unverified coverage. A fingerprint that differs from the declared one is
|
|
839
|
+
recorded as it is and makes the pair incomparable (`input_drift`).
|
|
840
|
+
- `startedAt`, `endedAt` and `elapsedMs` from the Store's trusted clock.
|
|
841
|
+
- `state`: one of `succeeded`, `failed`, `cancelled`, `timed_out`, `unavailable`,
|
|
842
|
+
`unknown`. `succeeded` requires every condition under "Sealing" below.
|
|
843
|
+
- `usage`: per-session model calls and tool calls with their known counts, and the
|
|
844
|
+
tokens this session alone observed, or `null`. A gap stays `null`; a sum is never
|
|
845
|
+
filled in, and the experiment's running token total is never copied into a receipt.
|
|
846
|
+
- `limits`: the closed list of observation limits that applied (for example
|
|
847
|
+
`usage_unknown`, `served_model_unobserved`, `teardown_unverified`, `output_truncated`,
|
|
848
|
+
`storage_over_cap`).
|
|
849
|
+
- `output`: a `ProbeOutputManifestV1`, below.
|
|
850
|
+
- `digest`: SHA-256 of the canonical record without this field.
|
|
851
|
+
|
|
852
|
+
`ProbeOutputManifestV1` lists at most 64 entries of `{ relative, sha256, bytes }`, with
|
|
853
|
+
each file at most 1 MiB and the total at most the slot's declared `outputBytes`. Paths are
|
|
854
|
+
workspace-relative under the declared output root, regular files with link count 1 only,
|
|
855
|
+
at most 256 UTF-8 bytes (`PROBE_OUTPUT_LIMITS.nameBytes`) and free of control and format
|
|
856
|
+
characters (`probeOutputName`, the one check for a manifest entry, an exclusion and a
|
|
857
|
+
retained record). A name that fails it is never hashed: it is an exclusion
|
|
858
|
+
(`invalid_name`) recorded under a digest label, never raw.
|
|
859
|
+
Anything else (symlink, hardlink, device, a path outside the declared writes, a file over
|
|
860
|
+
the cap, a tree nested deeper than 8 directory levels, a walk past the entry cap) is not
|
|
861
|
+
hashed: it is recorded as a closed `excluded` reason (`over_file_cap` for a file past 1 MiB,
|
|
862
|
+
`over_total_cap` when the slot's total bound would be crossed, `over_depth` for the nesting
|
|
863
|
+
limit, `over_walk_cap` for the entry cap) and the receipt cannot be `succeeded`. The walk
|
|
864
|
+
limits never skip silently: scratch nested past the depth limit, or holding more entries
|
|
865
|
+
than the cap, is reported as unmeasured, which counts as over the scratch cap.
|
|
866
|
+
|
|
867
|
+
Both walks (output, then scratch, each with its own budget of `PROBE_WALK_ENTRIES` = 4096
|
|
868
|
+
directory entries) run synchronously on the daemon's event loop, so the number of entries
|
|
869
|
+
they visit is bounded as well as the bytes: a confined child that leaves a million empty
|
|
870
|
+
files is far under every byte cap and would otherwise stall the control socket and every
|
|
871
|
+
peer. Reaching the entry cap is treated like the depth cap. Output: whatever the unfinished
|
|
872
|
+
walk had read is discarded, nothing is hashed or retained, and the whole output root is
|
|
873
|
+
excluded as `over_walk_cap`. Scratch: unmeasured, hence `storage_over_cap`.
|
|
874
|
+
|
|
875
|
+
The byte bound of a receipt, `PROBE_OUTPUT_LIMITS.receiptBytes`, is **derived** from the
|
|
876
|
+
largest valid receipt, never chosen: 64 entries and 64 exclusions of the longest allowed
|
|
877
|
+
names (each name byte can cost two in JSON) plus every other field at its own maximum. A
|
|
878
|
+
session that meets every success condition and writes 64 files with the longest names
|
|
879
|
+
therefore still seals as a success. `sealReceipt` writes only a receipt that its own
|
|
880
|
+
hydration would accept (it parses what it is about to store), so a record the reader would
|
|
881
|
+
refuse is a refused seal, never permanent storage corruption.
|
|
882
|
+
|
|
883
|
+
### Sealing
|
|
884
|
+
|
|
885
|
+
The adapter's `close` path already stops the peer and confinement and joins owned work.
|
|
886
|
+
Output is collected only AFTER `stopProbe` and the confinement stop have both returned,
|
|
887
|
+
that is after they reported known quiescence, because until then a child may still be
|
|
888
|
+
writing and the bytes are not evidence. When the stop failed or is uncertain nothing is
|
|
889
|
+
read at all. Collection and the receipt follow, before the host releases the workspace it
|
|
890
|
+
owns:
|
|
891
|
+
|
|
892
|
+
1. Collect the output manifest by opening each declared output file `O_NONBLOCK|O_NOFOLLOW`
|
|
893
|
+
and requiring it to still be a regular file through the opened descriptor (a file
|
|
894
|
+
swapped for a FIFO, device or symlink after its `lstat` is excluded and cannot block
|
|
895
|
+
the daemon), hashing the bytes read from that descriptor, and re-checking the identity
|
|
896
|
+
after the read. A file that changed while read is excluded, not hashed twice.
|
|
897
|
+
Retention copies those same bytes. It never re-reads a workspace path, so a swap after
|
|
898
|
+
collection can neither hang it nor change what is kept.
|
|
899
|
+
2. Build the receipt from the session's own settled facts, the immutable manifest and the
|
|
900
|
+
host's measurement only, then compute its digest. Mutable experiment state (the
|
|
901
|
+
running token total, the current hold, a later cancel, another session) is never read:
|
|
902
|
+
a session records why it settled (`closeCause`) when it settles.
|
|
903
|
+
3. Write it in one `BEGIN IMMEDIATE` transaction together with the session settlement
|
|
904
|
+
(`settleAndSeal`), so a receipt and its session state are never separately visible. If
|
|
905
|
+
the seal fails the settlement rolls back with it; the host then settles the session as
|
|
906
|
+
`unknown` with a conservative receipt, and a session still open after a crash is
|
|
907
|
+
recorded as unknown by the explicit reconcile below. A settled session therefore never
|
|
908
|
+
exists without its receipt.
|
|
909
|
+
|
|
910
|
+
The state is decided in this order, so what the host cannot vouch for always wins:
|
|
911
|
+
unverified teardown or a crash is `unknown`; then the settled cause (`cancelled`,
|
|
912
|
+
`timed_out`); then `unavailable`, which means the session could not start and is never
|
|
913
|
+
used once a model or tool call ran (a confinement error after a call is `failed` or
|
|
914
|
+
`unknown`); then `failed`; then `succeeded`.
|
|
915
|
+
|
|
916
|
+
A receipt is `succeeded` only if all of these hold: the session settled `closed_fixture`
|
|
917
|
+
with verified coverage; `servedModel` equals `requestedModel`; teardown is known
|
|
918
|
+
quiescent; no output entry was excluded; no hold is latched; and the elapsed ceiling was
|
|
919
|
+
not hit. A timeout, an abort, a token or step ceiling, an uncertain stop and a hold each
|
|
920
|
+
map to a non-success state. **A timeout is never `succeeded`**, whatever partial output
|
|
921
|
+
exists. There is no path that upgrades a receipt after it is written.
|
|
922
|
+
|
|
923
|
+
Immutability: a second `sealReceipt` for the same reservation with identical content
|
|
924
|
+
returns the stored receipt (`already: true`); different content refuses and latches the
|
|
925
|
+
observation hold. There is no update and no delete. A prune never removes a receipt or an
|
|
926
|
+
output manifest (see "Cleanup"): receipts are the outcome denominator's record and live as
|
|
927
|
+
long as the experiment row does.
|
|
928
|
+
|
|
929
|
+
### Tamper, torn writes and crash
|
|
930
|
+
|
|
931
|
+
Receipts live in the same `hub.db`, so a torn receipt is a rolled-back transaction, not a
|
|
932
|
+
half file. The Store hydrates a receipt only if its digest recomputes, its experiment, slot,
|
|
933
|
+
generation and revision match the session row, and its `state` is consistent with the
|
|
934
|
+
session state. Any mismatch is `storage` corruption: the experiment becomes unknown-held,
|
|
935
|
+
shows no success and is never silently repaired.
|
|
936
|
+
|
|
937
|
+
Output files are re-verified against their manifest only through the same captured
|
|
938
|
+
identities, while the workspace is still owned. After the workspace is released the
|
|
939
|
+
manifest is the record; the bytes are not claimed to still exist unless retained
|
|
940
|
+
(next section).
|
|
941
|
+
|
|
942
|
+
Crash after admission: a session found `reserved` or `running` with no receipt is
|
|
943
|
+
reconciled to `unknown_held` with receipt state `unknown` and limit `teardown_unverified`,
|
|
944
|
+
whether or not a cancel request or an elapsed hold was already latched: a crash is never
|
|
945
|
+
recorded as `cancelled` or `timed_out`, because the host did not witness a stop.
|
|
946
|
+
Reconcile never launches, retries or restarts a session, and never turns an in-flight
|
|
947
|
+
session into a failure or a success. It only records that the host cannot vouch for it.
|
|
948
|
+
The lane stays held until a person or conductor cancels it through the existing
|
|
949
|
+
`cancelIntent`.
|
|
950
|
+
|
|
951
|
+
Reconcile runs **only** through an explicit host call, `GuidanceProbeStore.reconcile()`,
|
|
952
|
+
made by the daemon in two places: at start, after the recovery integrity comparison, and
|
|
953
|
+
at the release of a held recovery (a held target must keep carried rows byte-identical so
|
|
954
|
+
its comparison holds). Opening the Store, `read`, `integrity`, `previewPrune` and every
|
|
955
|
+
other read never write: a Store opened read-only (`new GuidanceProbeStore(file, now, true)`,
|
|
956
|
+
a connection that cannot write) changes no row, and `reconcile` through it fails. `reconcile` is
|
|
957
|
+
idempotent: a second call finds no unreconciled session and writes nothing. A reconciled
|
|
958
|
+
`unknown` receipt counts in the outcome denominator as `unknown`, never as `failed`.
|
|
959
|
+
One bad experiment never hides the others: `reconcile` visits every experiment key, hands
|
|
960
|
+
each failure and its key to an optional `onFailure` callback (the daemon logs the experiment
|
|
961
|
+
id prefix and the error class, never content) and carries on; it returns
|
|
962
|
+
`{ reconciled, failed }`. With no callback the first failure is thrown only after every key
|
|
963
|
+
was tried, so a caller can never mistake a partial pass for a full one. The recovery
|
|
964
|
+
integrity pass reads receipts through the same session cross-check as `receipts()`
|
|
965
|
+
(generation, revision and a state that session could have produced), so an edited pair is
|
|
966
|
+
caught at restart, not only on a later read.
|
|
967
|
+
|
|
968
|
+
### Comparability and the outcome denominator (AC4)
|
|
969
|
+
|
|
970
|
+
`classifyProbeComparability` is a pure function over the experiment's receipts and
|
|
971
|
+
returns `{ comparable, reasons }`, with a closed reason list: `served_model_mismatch`,
|
|
972
|
+
`served_model_unobserved`, `input_drift` (a worker's non-guidance hash differs from the
|
|
973
|
+
baseline's, or a fingerprint differs), `usage_unknown`, `incomplete_coverage`,
|
|
974
|
+
`teardown_unverified`, `authoring_uncontrolled`, `missing_receipt`.
|
|
975
|
+
|
|
976
|
+
- A pair is incomparable if either side has a reason. One reason is enough; reasons are
|
|
977
|
+
listed, not ranked.
|
|
978
|
+
- The public `comparable` flag becomes this function's result. It replaces the current
|
|
979
|
+
inline expression in `Tasks.guidanceProbeProjection` and may only get stricter: every
|
|
980
|
+
case the current expression calls incomparable stays incomparable.
|
|
981
|
+
- The outcome denominator is every preregistered attempt slot that was reserved:
|
|
982
|
+
`succeeded`, `failed`, `cancelled`, `timed_out`, `unavailable` and `unknown` all count.
|
|
983
|
+
Slots never started stay `planned` or `not_needed` and are reported separately as such;
|
|
984
|
+
they are neither successes nor failures. A failed, cancelled or unavailable arm is
|
|
985
|
+
never dropped from the denominator, and the status shows the per-state counts.
|
|
986
|
+
- Usage gaps stay `null`. No cost or money figure is derived: this task adds no price
|
|
987
|
+
table, so total money remains unknown.
|
|
988
|
+
|
|
989
|
+
### Cleanup and the 1 GiB cap (AC6)
|
|
990
|
+
|
|
991
|
+
The experiment's declared `inputBytes + scratchBytes + outputBytes` is already capped at
|
|
992
|
+
1 GiB at admission. T3 adds no second source of truth: retained storage is accounted from
|
|
993
|
+
the receipts' output manifests plus the retained workspace bytes the host recorded.
|
|
994
|
+
|
|
995
|
+
The cap also holds at runtime, not only in the declaration. At seal time the host measures
|
|
996
|
+
what the session actually left behind in scratch and output. If either exceeds the bound
|
|
997
|
+
declared for it, the receipt is a non-success with limit `storage_over_cap` (or
|
|
998
|
+
`output_truncated` when output files were excluded for size), and retention is never
|
|
999
|
+
silently larger than declared: bytes past the bound are not retained, hashed or counted
|
|
1000
|
+
as the session's output.
|
|
1001
|
+
|
|
1002
|
+
Cleanup touches only resources the host created and still owns, verified at the moment
|
|
1003
|
+
of removal by captured physical identity (device, inode, directory/file kind, link count)
|
|
1004
|
+
exactly as `materializeProbeWorkspace` already does for its failure cleanup. Inode numbers
|
|
1005
|
+
are recycled (Linux reuses one straight after an unlink), so a retained file's identity also
|
|
1006
|
+
carries its change time in nanoseconds (`ctimeNs`): a replacement made later has a later
|
|
1007
|
+
change time even with the same inode. A directory has no stable change time, so it is
|
|
1008
|
+
identified by device and inode only. A path whose
|
|
1009
|
+
identity differs, a replaced root, a bystander file or a symlink swap is left alone and
|
|
1010
|
+
reported as `retained: <reason>`; cleanup never recurses into or deletes a name it did not
|
|
1011
|
+
create. It never follows a link and never touches another session's resources.
|
|
1012
|
+
|
|
1013
|
+
`previewPrune(key, fs)` is read-only and returns the exact list of what a prune would
|
|
1014
|
+
remove (relative names and byte counts, no content) and what it would keep and why.
|
|
1015
|
+
`prune(key, planDigest, fs)` takes that preview's digest and refuses if the owned set has
|
|
1016
|
+
changed since, so a prune only ever does what the person saw. Neither takes a time: expiry
|
|
1017
|
+
is decided on the Store's own trusted clock, so a caller cannot pull a retention date
|
|
1018
|
+
forward.
|
|
1019
|
+
|
|
1020
|
+
Retention is `PROBE_RETENTION_DAYS = 14`, a named constant. It is not a setting, a
|
|
1021
|
+
manifest field or a config key. At seal time each retained output gets an explicit
|
|
1022
|
+
`expiresAt` (seal time plus that constant), stored with the receipt and shown by
|
|
1023
|
+
`previewPrune`. **Nothing is deleted automatically:** there is no timer and no background
|
|
1024
|
+
sweep. Removal happens only through `previewPrune` followed by `prune(planDigest)`,
|
|
1025
|
+
called by the host or the person. An output is prunable only after its `expiresAt`, and
|
|
1026
|
+
only when no session of its experiment is in flight and the experiment is finished:
|
|
1027
|
+
terminal (`closed_fixture`, `failed_fixture`), or stopped by the person's or conductor's
|
|
1028
|
+
existing `cancelIntent`. An experiment that is held (`unknown_held`, for example after a
|
|
1029
|
+
crash reconcile or a latched hold) stays unprunable until that cancel has released it, so
|
|
1030
|
+
its retained output cannot be removed while the person has not yet seen the hold, and it
|
|
1031
|
+
can still expire afterwards. `usageUnknown` alone never blocks a prune: it describes the
|
|
1032
|
+
measurements, not whether work is running. A receipt is never deleted in any case.
|
|
1033
|
+
|
|
1034
|
+
A prune removes retained output and workspace bytes only. It never deletes a receipt or an
|
|
1035
|
+
output manifest. A session still `reserved` or `running` blocks the prune of its
|
|
1036
|
+
experiment even when the experiment is otherwise finished (a cancel that has not yet
|
|
1037
|
+
reached every session): the in-flight guard is its own check, tested apart from the
|
|
1038
|
+
state rule.
|
|
1039
|
+
|
|
1040
|
+
Locks: receipts and prune plans use the Store's SQLite transaction, so no file lock and
|
|
1041
|
+
no stale-holder recovery are introduced. If implementation finds a file-level lock is
|
|
1042
|
+
unavoidable it must follow `SourceRegistry.locked` (publish whole by `link(2)`, never
|
|
1043
|
+
unlink on another's behalf, fail closed on a stale holder, name the file) and ship a
|
|
1044
|
+
two-recoverer test (#329).
|
|
1045
|
+
|
|
1046
|
+
### Scope boundary
|
|
1047
|
+
|
|
1048
|
+
T3 adds: the receipt and output manifest types and pure parsing in `guidance-probes.ts`;
|
|
1049
|
+
one additive private table in the Store (`guidance_probe_receipts`) with receipt
|
|
1050
|
+
hydration, tamper checks and reconcile folded into the existing integrity and recovery
|
|
1051
|
+
passes; `sealReceipt`, `settleAndSeal`, `receipts`, `outcome`, `reconcile`, `previewPrune` and `prune`; output collection and
|
|
1052
|
+
owned cleanup in the adapter and workspace modules; the comparability function; and fake
|
|
1053
|
+
fixtures for the mismatch, tamper, crash and teardown cases. It does not add a CLI verb,
|
|
1054
|
+
a wire operation, a daemon runner, a config key, a real model call or a live trial (T4).
|
|
1055
|
+
Public `show` is unchanged: it keeps only the stricter `comparable` flag. The per-state
|
|
1056
|
+
denominator counts and the comparability reasons are private status, read by the host
|
|
1057
|
+
through the Store; T4 (below) adds the producer receipt reader and decides what leaves it.
|
|
1058
|
+
|
|
1059
|
+
### How the adapter and host seal
|
|
1060
|
+
|
|
1061
|
+
The adapter cannot reach the Store. After the stop reported quiescence it collects and
|
|
1062
|
+
retains the declared output and reports what it measured on the observation
|
|
1063
|
+
(`ProbeFakeObservation.measured`, every `ProbeMeasuredSession` field except `startedAt`,
|
|
1064
|
+
including the host's own runtime fingerprints). The fixture host samples `startedAt` on the
|
|
1065
|
+
trusted clock where it exposes the launch and calls `settleAndSeal`; the adapter never
|
|
1066
|
+
supplies the start instant. An observation that carries no measurement, or that did not
|
|
1067
|
+
match, is sealed with a conservative one (teardown not verified, nothing observed), so a
|
|
1068
|
+
session is never a success the host could not witness. Collection never throws: a failure
|
|
1069
|
+
becomes an `output_truncated` limit, which can only keep a receipt from being a success.
|
|
1070
|
+
Retention needs a host-owned `retentionRoot` outside every workspace; without one the
|
|
1071
|
+
output is hashed and nothing is kept. Past the declared scratch or output cap, or with
|
|
1072
|
+
scratch nested past the walk limit, nothing is retained and the receipt carries
|
|
1073
|
+
`storage_over_cap`. Hydration checks every receipt against its session row: generation,
|
|
1074
|
+
revision and a state that session could have produced.
|
|
1075
|
+
|
|
1076
|
+
**Retained output always has an owner.** Retention happens in the adapter, before the host
|
|
1077
|
+
seals, so the adapter may have copied output the host then declines to seal with that
|
|
1078
|
+
record: an observation that did not match its reservation (a fallback model is the AC4
|
|
1079
|
+
case), a seal that failed and was replaced by the conservative one, a settlement that lost
|
|
1080
|
+
its clock and sealed nothing. A directory with no row can never be previewed or pruned. So
|
|
1081
|
+
the ports carry one optional call, `discardRetained(record)`, and the host makes it for
|
|
1082
|
+
every measurement it did not seal together with its own `retained` record (on the match
|
|
1083
|
+
path after the settle, and on the failure path before the conservative settle). The port
|
|
1084
|
+
removes only a record that is exactly one it created (it keeps its own bounded ledger of
|
|
1085
|
+
canonical records, so a forged or altered record reaches no delete), and it removes by the
|
|
1086
|
+
identity captured at creation. It never throws into the host. The receipt of such a
|
|
1087
|
+
session carries no retained record, and no directory of it remains.
|
|
1088
|
+
|
|
1089
|
+
Public `show` computes `comparable` as the older expression AND the sealed-receipt verdict,
|
|
1090
|
+
so the flag only ever gets stricter. A store that cannot be read yields `false`.
|
|
1091
|
+
|
|
1092
|
+
### Rulings applied
|
|
1093
|
+
|
|
1094
|
+
The reviewer ruled on the three open choices of the first draft: no automatic expiry and
|
|
1095
|
+
no new setting (a named constant and an explicit `expiresAt`); reconcile only through an
|
|
1096
|
+
explicit host call at daemon start; the denominator counts and reasons stay private. They
|
|
1097
|
+
are folded into the sections above. Three amendments are also applied: prune never deletes
|
|
1098
|
+
receipts or manifests, the 1 GiB cap holds at runtime, and a reconciled `unknown` receipt
|
|
1099
|
+
counts as `unknown`.
|
|
1100
|
+
|
|
1101
|
+
## T4 producer status and receipt export
|
|
1102
|
+
|
|
1103
|
+
T4 (#1226) adds the producer-facing read of what T3 sealed, and the focused check that runs the whole fake lifecycle end to end. It adds no way to start work.
|
|
1104
|
+
It does not enable a runner, claim native confinement, call a model or launch a worker, and the constructor-only adapter stays unwired (a test reads the daemon,
|
|
1105
|
+
the CLI, the plugin, the manager and every other adapter and fails if one names it). **AC7's authorized real local-worker trial is not part of this change and
|
|
1106
|
+
stays open**: nothing here shows actual isolation or effective guidance delivery to a model, and nothing may be read as showing either.
|
|
1107
|
+
|
|
1108
|
+
### What a producer or a receipt consumer reads
|
|
1109
|
+
|
|
1110
|
+
One read, `Tasks.guidanceProbeReceipts(by, id)`, answered over the control op `guidance_probe_receipts`, the CLI `ahub guidance probe receipts --id HASH [--json]`
|
|
1111
|
+
and the guidance panel's `probe` read. It carries the same person-or-current-conductor, session, task-state and privacy fences as `show`, and it is read-only:
|
|
1112
|
+
it launches, reserves, writes and prunes nothing, and a read-only Store serves its inputs. The reply is a `ProbeReceiptExport`:
|
|
1113
|
+
|
|
1114
|
+
- `status`: the public status `show` returns, with `comparable` already combined with the sealed verdict.
|
|
1115
|
+
- `comparable` and `reasons`: the stricter of the older public expression and the sealed-receipt verdict, and the sealed reasons (`served_model_mismatch`,
|
|
1116
|
+
`served_model_unobserved`, `input_drift`, `usage_unknown`, `incomplete_coverage`, `teardown_unverified`, `authoring_uncontrolled`, `missing_receipt`). A comparable
|
|
1117
|
+
export never lists a reason and never outranks a status that refused.
|
|
1118
|
+
- `counts`: the full outcome denominator. Every reserved slot is in it, failed, cancelled, timed out and unavailable ones included; a reserved slot with no
|
|
1119
|
+
receipt is `unknown`; slots that never started are `planned` or `not_needed`, apart from success and failure.
|
|
1120
|
+
- `slots`: one row per declared slot, with its stage, role, arm and the session's own state, the verbatim sealed receipt (or none), the receipt's digest, a
|
|
1121
|
+
`withheld` flag and the retention state of its output (`none`, `retained` or `pruned`).
|
|
1122
|
+
|
|
1123
|
+
Unknown stays unknown: a usage gap is `usage_unknown` and prints as `unknown`, never zero; an unobserved served model is `unobserved`; a slot with no receipt says
|
|
1124
|
+
so. Evidence is at most `fixture`, and every rendering says that no live model or worker trial, sampling control, provider behaviour or model quality is claimed.
|
|
1125
|
+
|
|
1126
|
+
### Bounds, privacy and tamper
|
|
1127
|
+
|
|
1128
|
+
- **Closed, inert, bounded.** `parseGuidanceProbeReceiptExport` accepts exactly these fields, at most nine slots, and at most `PROBE_EXPORT_BYTES`, derived from the
|
|
1129
|
+
largest valid receipt, never chosen. It re-verifies every embedded receipt with `parseProbeReceipt`, so a receipt that was edited, moved to another slot or given
|
|
1130
|
+
another digest never parses. The counts must add up to the slot list, and a slot's digest must be its receipt's.
|
|
1131
|
+
- **Tamper refuses the whole read.** The Store hydrates receipts with its own session cross-check; a bad row fails the read with the storage error rather than
|
|
1132
|
+
being skipped or shown. `Tasks` then parses what it is about to send with the same parser, so a result the consumer would refuse is a storage fault, never a
|
|
1133
|
+
partial answer. The manager, the panel provider and the CLI parse again on receipt, and a reply that names another probe than the one asked for is refused.
|
|
1134
|
+
- **A model-written name is screened, not trusted.** An output path or served-model name in a receipt passes the same public-field screen as any other public field
|
|
1135
|
+
(`guidanceFieldAllowed`: nameable, not secret-like, not under a denied path). A receipt with a name that fails it is replaced by its digest and flagged
|
|
1136
|
+
`withheld`; the slot and the denominator still count it, so withholding never hides an arm. Every rendered string is stripped of control and format characters,
|
|
1137
|
+
and the experiment label is advisory untrusted text.
|
|
1138
|
+
- **A location is a state, never a path.** The export says a slot's output is retained or pruned and never names where. `GuidanceProbeStore.retentionStates` is the
|
|
1139
|
+
only accessor and returns states.
|
|
1140
|
+
|
|
1141
|
+
### Surfaces
|
|
1142
|
+
|
|
1143
|
+
- **Control and authority.** `guidance_probe_receipts` is a conductor operation labelled `guidance probe receipts`, answered with the request `rid` like every
|
|
1144
|
+
probe op, and advertised as the feature `guidance_probe_receipts` beside `guidance_probes`. A client facing a hub without it says to upgrade and restart and sends
|
|
1145
|
+
nothing. The CLI refuses a malformed id or any option other than `--id` and `--json` before a request, and a delegated live-test run is refused as for the other
|
|
1146
|
+
probe commands.
|
|
1147
|
+
- **Producer panel.** The existing Guidance panel gains a probe read, not a new panel: `DASHBOARD_VIEWS` and the manifest's actions are unchanged. The provider
|
|
1148
|
+
forwards exactly one field, the 64-hex probe id, through a producer-only read port on `projectConsole` (`guidanceProbe`) that pins the instance, checks the feature
|
|
1149
|
+
and writes nothing. The panel shows the provider's own lines for exactly the probe it asked about as literal text; a reply that is malformed, for another probe, or
|
|
1150
|
+
late (the project or id changed, the panel was hidden or destroyed) shows nothing of itself.
|
|
1151
|
+
- **One text.** The panel and the CLI print the same lines, `guidanceProbeStatusLines`.
|
|
1152
|
+
|
|
1153
|
+
### The focused check gate (AC7, fake-provider leg)
|
|
1154
|
+
|
|
1155
|
+
`test/guidance-probe-gate.test.ts` is the end-to-end pass over the real `Tasks` + `GuidanceProbeStore` + `Bus` with the fake provider: register, run the baseline and a
|
|
1156
|
+
candidate, seal, and read the export, asserting at once that the two arms share every non-guidance input byte (AC1), that attempts and calls are counted once per
|
|
1157
|
+
slot (AC3), that the denominator is complete and the pair is incomparable for the stated reason (AC4), that every receipt is host-sealed and bound to its slot
|
|
1158
|
+
(AC4, AC6), that no message, PII screen or lineage read happened and the task's public bytes are unchanged (AC5), that a crash in the middle is recorded unknown and
|
|
1159
|
+
never launched again (AC3, AC6), and that reading changes no row. It runs under `scripts/check.sh --changed` because it imports the files above. What it does not
|
|
1160
|
+
run is stated in the test and here: a real model call, a real worker, OS isolation, effective guidance delivery, sampling control.
|
|
1161
|
+
|
|
1162
|
+
### Scope boundary
|
|
1163
|
+
|
|
1164
|
+
T4 (this part) adds: `ProbeReceiptExport`, `parseGuidanceProbeReceiptExport`, `PROBE_EXPORT_BYTES`; `GuidanceProbeStore.retentionStates`; `Tasks.guidanceProbeReceipts`;
|
|
1165
|
+
the control op, feature, authority label, CLI subcommand and help line; the manager read port, the plugin's `probe` read and the panel section; the shared text; and
|
|
1166
|
+
the tests above. It does not add a runner, a config key, a write, a prune verb or a model call. The authorized live trial, and with it AC7's real-isolation and
|
|
1167
|
+
real-delivery evidence, is a separate decision and stays open.
|