@staix/agent-hub 0.52.0 → 0.54.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 +37 -0
- package/README.md +4 -3
- package/docs/addons/open-code-review.md +3 -6
- package/docs/agent-notes/README.md +1 -1
- package/docs/agent-notes/adapters.md +5 -4
- package/docs/agent-notes/budget.md +2 -2
- package/docs/agent-notes/bus.md +1 -0
- package/docs/agent-notes/daemon.md +6 -5
- package/docs/agent-notes/models.md +1 -1
- package/docs/agent-notes/tasks.md +3 -3
- package/docs/agent-notes/tests.md +4 -4
- package/docs/contracts/companion-cli-v2.json +90 -0
- package/docs/contracts/companion-cli-v3.json +348 -0
- package/docs/design/adapters.md +1 -1
- package/docs/design/agent-hub-architecture.md +8 -5
- package/docs/design/bus.md +1 -1
- package/docs/design/cli-output-inventory.md +4 -2
- package/docs/design/execution-reference.md +1 -1
- package/docs/design/guidance-experiments.md +1 -0
- package/docs/design/guidance-probes.md +1 -0
- package/docs/design/model-routes.md +20 -5
- package/docs/design/roadmap.md +6 -4
- package/docs/design/task-board.md +21 -2
- package/docs/dogfood.md +13 -6
- package/docs/events.md +1 -1
- package/docs/memory.md +2 -2
- package/docs/operations.md +158 -50
- package/docs/quickstart.md +14 -2
- package/docs/security.md +17 -9
- package/docs/specs/2026-09-19-agent-hub-design.md +5 -3
- package/docs/specs/2026-09-19-multi-project-design.md +1 -1
- package/docs/specs/2026-09-20-upgrade-recovery-design.md +24 -0
- package/docs/specs/2026-12-04-arev-adoption-design.md +84 -0
- package/docs/specs/mcp-endpoint.md +15 -4
- package/docs/specs/relay-contract.md +38 -0
- package/docs/verification/2026-12-04-host-shared-receipts.md +43 -0
- package/docs/verification/2026-12-05-0.53.0.md +101 -0
- package/docs/verification/2026-12-05-agy-1.5.24.md +55 -0
- package/docs/verification/2026-12-05-claude-implementer-2.1.337.md +43 -0
- package/docs/verification/2026-12-06-0.54.0.md +76 -0
- package/docs/verification/2026-12-06-codex-0174-reviewer-isolation.md +43 -0
- package/docs/verification/2026-12-06-codex-0174-reviewer-tool-call.md +34 -0
- package/docs/verification/2026-12-06-compat-codex-capabilities-0.174.0.md +25 -0
- package/docs/verification/2026-12-06-compat-pi-1.8.0.md +23 -0
- package/docs/verified.json +38 -29
- package/package.json +9 -3
- package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
- package/plugins/agent-hub/.mcp.json +1 -1
- package/plugins/agent-hub/compat.json +9 -5
- package/plugins/agent-hub/kimi-hook.js +892 -874
- package/plugins/agent-hub/relay-launcher.js +24 -0
- package/plugins/agent-hub/server.js +27271 -25146
- package/src/adapters/acp-session-model.ts +1 -1
- package/src/adapters/acp.ts +5 -4
- package/src/adapters/agy/definition.ts +1 -1
- package/src/adapters/agy/hooks.ts +1 -1
- package/src/adapters/channel-peer.ts +3 -1
- package/src/adapters/claude-channel-evidence.ts +26 -1
- package/src/adapters/claude-channel.ts +27 -30
- package/src/adapters/claude-connection-policy.ts +62 -0
- package/src/adapters/claude-relay.ts +255 -0
- package/src/adapters/codex-review-isolation.ts +1 -2
- package/src/adapters/compat.ts +28 -18
- package/src/adapters/definitions/native-cli-preview-pi.ts +2 -1
- package/src/adapters/definitions/native-config-defaults.ts +1 -1
- package/src/adapters/definitions/native-context.ts +1 -2
- package/src/adapters/definitions/native-factories.ts +4 -1
- package/src/adapters/definitions/native-quota.ts +1 -1
- package/src/adapters/definitions/native-recovery.ts +3 -1
- package/src/adapters/external-modules.ts +2 -2
- package/src/adapters/kimi-review.ts +1 -1
- package/src/adapters/kimi-tui-facts.ts +1 -1
- package/src/adapters/local-worker.ts +3 -3
- package/src/adapters/native-capabilities.ts +1 -1
- package/src/adapters/pi.ts +26 -7
- package/src/adapters/registry-types.ts +2 -0
- package/src/adapters/relay-launcher.ts +27 -0
- package/src/adapters/reviewer-mcp.ts +1 -1
- package/src/cli/agents.ts +20 -8
- package/src/cli/agy-mcp.ts +1 -1
- package/src/cli/claude-profile-hook.ts +1 -1
- package/src/cli/command-table.ts +1 -0
- package/src/cli/commands/agents.ts +18 -1
- package/src/cli/commands/doctor.ts +18 -4
- package/src/cli/commands/launch-line.ts +32 -0
- package/src/cli/commands/status.ts +14 -3
- package/src/cli/help.ts +7 -4
- package/src/cli/identity.ts +1 -1
- package/src/cli/init-roles.ts +1 -1
- package/src/cli/init-settings.ts +1 -1
- package/src/cli/launch-line-plan.ts +82 -0
- package/src/cli/launch-line-project.ts +13 -0
- package/src/cli/main.ts +10 -9
- package/src/cli/pi-steps-warning.ts +14 -0
- package/src/cli/recovery-package.ts +60 -6
- package/src/cli/reset.ts +1 -1
- package/src/cli/shell-quote.ts +1 -3
- package/src/cli/upgrade-interactive.ts +7 -2
- package/src/cli/upgrade-keep-plan.ts +47 -0
- package/src/cli/upgrade-restore-state.ts +1 -1
- package/src/cli/upgrade-runtime.ts +119 -18
- package/src/cli/upgrade.ts +17 -2
- package/src/hub/accounts.ts +8 -4
- package/src/hub/action-class.ts +1 -3
- package/src/hub/adec-triage.ts +105 -0
- package/src/hub/autonomy.ts +1 -1
- package/src/hub/board.ts +3 -27
- package/src/hub/bus.ts +39 -6
- package/src/hub/capabilities.ts +1 -1
- package/src/hub/channel-project-base.ts +46 -0
- package/src/hub/channel-project.ts +21 -46
- package/src/hub/config-apply.ts +1 -1
- package/src/hub/config-edit.ts +1 -1
- package/src/hub/config-tier.ts +1 -1
- package/src/hub/config.ts +2 -2
- package/src/hub/confirmation-matrix.ts +1 -1
- package/src/hub/control/board-messages.ts +415 -0
- package/src/hub/control/dashboard-messages.ts +221 -0
- package/src/hub/control/delivery-messages.ts +356 -0
- package/src/hub/control/dispatch.ts +114 -0
- package/src/hub/control/hub-tool-helpers.ts +243 -0
- package/src/hub/control/hub-tools.ts +147 -0
- package/src/hub/control/native-messages.ts +665 -0
- package/src/hub/control/operations-messages.ts +269 -0
- package/src/hub/control/peer-messages.ts +126 -0
- package/src/hub/control/recovery-messages.ts +391 -0
- package/src/hub/control/recovery-operation.ts +480 -0
- package/src/hub/control/scope.ts +460 -0
- package/src/hub/control/sdlc-messages.ts +373 -0
- package/src/hub/control/task-ops-more.ts +245 -0
- package/src/hub/control/task-ops.ts +553 -0
- package/src/hub/control/ui-actions.ts +241 -0
- package/src/hub/control-write-trace.ts +1 -4
- package/src/hub/daemon.ts +485 -4324
- package/src/hub/delivery-hints.ts +2 -0
- package/src/hub/delivery-journal.ts +17 -6
- package/src/hub/events.ts +2 -1
- package/src/hub/execution-reference.ts +1 -1
- package/src/hub/host.ts +41 -9
- package/src/hub/hub-tools.ts +3 -4
- package/src/hub/invocations.ts +1 -1
- package/src/hub/lifecycle.ts +4 -3
- package/src/hub/mcp-endpoint-serve.ts +4 -3
- package/src/hub/mcp-endpoint.ts +15 -6
- package/src/hub/memory-profile-check.ts +1 -1
- package/src/hub/no-writes.ts +1 -1
- package/src/hub/peers.ts +2 -0
- package/src/hub/pi-exit-policy.ts +27 -0
- package/src/hub/progress.ts +1 -1
- package/src/hub/project-runtime-state.ts +17 -4
- package/src/hub/project-runtime.ts +3 -1
- package/src/hub/protocol-window.ts +1 -1
- package/src/hub/recovery-continuity.ts +3 -3
- package/src/hub/recovery-kept-roster.ts +50 -0
- package/src/hub/review-anchor.ts +13 -181
- package/src/hub/review-brief.ts +78 -28
- package/src/hub/review-findings.ts +15 -193
- package/src/hub/review-ledger.ts +162 -0
- package/src/hub/review-material.ts +3 -3
- package/src/hub/reviewer-pool.ts +4 -2
- package/src/hub/roadmap-issue-states.ts +65 -14
- package/src/hub/roadmap-sync.ts +39 -14
- package/src/hub/routing.ts +9 -0
- package/src/hub/runtime-capture-prune.ts +8 -2
- package/src/hub/runtime-package-assets.ts +3 -0
- package/src/hub/sdlc-release-policy.ts +1 -2
- package/src/hub/settings.ts +1 -1
- package/src/hub/spec-ack-tool.ts +4 -0
- package/src/hub/spec-report-history.ts +36 -0
- package/src/hub/specs.ts +1 -4
- package/src/hub/supervision.ts +33 -6
- package/src/hub/tasks-audit.ts +390 -0
- package/src/hub/tasks-backlog.ts +522 -0
- package/src/hub/tasks-handoff.ts +208 -0
- package/src/hub/tasks-release.ts +257 -0
- package/src/hub/tasks-roadmap.ts +17 -3
- package/src/hub/tasks-specs.ts +672 -0
- package/src/hub/tasks-types.ts +334 -0
- package/src/hub/tasks.ts +286 -1961
- package/src/hub/upgrade-session-contract.ts +11 -0
- package/src/local/probe-sandbox.ts +1 -2
- package/src/local/probe-workspace.ts +1 -1
- package/src/models/route/config.ts +4 -4
- package/src/models/route/decision.ts +18 -10
- package/src/models/route/observation-signals.ts +1 -2
- package/src/models/route/runtime.ts +8 -5
- package/src/npm-artifact.ts +76 -0
- package/src/omniroute/client.ts +6 -0
- package/src/pi/extension.ts +5 -2
- package/src/pi/install.ts +77 -0
- package/src/pi/pin.ts +49 -0
- package/src/primitives.ts +14 -0
- package/src/version.ts +2 -0
- package/templates/adec/README.md +10 -6
- package/templates/config.json +1 -1
- package/templates/specs.block.md +1 -0
package/src/adapters/compat.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { randomUUID } from "node:crypto";
|
|
|
2
2
|
import { closeSync, constants, fstatSync, lstatSync, mkdirSync, openSync, readSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { hubHome } from "../hub/project.ts";
|
|
5
|
+
import { readPiPin } from "../pi/pin.ts";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* #691: the one version policy for native agent CLIs. Every version gate asks `assessVersion`; no other file holds a
|
|
@@ -37,17 +38,17 @@ export interface CompatPolicy {
|
|
|
37
38
|
|
|
38
39
|
const plain = (text: string) => text.length <= 64 && /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(text) ? text : undefined;
|
|
39
40
|
export const COMPAT = {
|
|
40
|
-
// Receipts: docs/verification/2026-10-26-pi-140-compat.md (1.4.0); docs/verification/2026-11-03-pi-150-compat.md (1.5.0); docs/verification/2026-11-14-pi-152-compat.md (1.5.2); docs/verification/2026-11-25-pi-160-compat.md (1.6.0); docs/verification/2026-11-26-compat-pi-1.6.1.md (1.6.1)
|
|
41
|
-
pi: { label: "Pi", verified: ["1.4.0", "1.5.0", "1.5.2", "1.6.0", "1.6.1"], gate: "contract", probe: ["pi", "--version"], config: "pi.cmd",
|
|
41
|
+
// Receipts: docs/verification/2026-10-26-pi-140-compat.md (1.4.0); docs/verification/2026-11-03-pi-150-compat.md (1.5.0); docs/verification/2026-11-14-pi-152-compat.md (1.5.2); docs/verification/2026-11-25-pi-160-compat.md (1.6.0); docs/verification/2026-11-26-compat-pi-1.6.1.md (1.6.1); docs/verification/2026-12-06-compat-pi-1.8.0.md (1.8.0)
|
|
42
|
+
pi: { label: "Pi", verified: ["1.4.0", "1.5.0", "1.5.2", "1.6.0", "1.6.1", "1.8.0"], gate: "contract", probe: ["pi", "--version"], config: "pi.cmd",
|
|
42
43
|
parse: out => plain(out.trim()),
|
|
43
|
-
trustNote: "The model-free extension load, RPC session identity and managed tool receipt path were checked on 1.4.0, 1.5.0, 1.5.2, 1.6.0
|
|
44
|
-
receipt: "docs/verification/2026-
|
|
45
|
-
// Transport receipts: docs/verification/2026-10-23-headless-claude-permissions.md; 2.1.310: docs/verification/2026-10-26-claude-implementer-2.1.310.md; 2.1.314 (transport and wrapper): docs/verification/2026-10-31-claude-implementer-2.1.314.md; 2.1.316: docs/verification/2026-10-31-claude-implementer-2.1.316.md; 2.1.318: docs/verification/2026-11-05-claude-implementer-2.1.318.md; 2.1.319: docs/verification/2026-11-06-claude-implementer-2.1.319.md; 2.1.322: docs/verification/2026-11-10-claude-implementer-2.1.322.md; 2.1.323: docs/verification/2026-11-13-claude-implementer-2.1.323.md; 2.1.328: docs/verification/2026-11-19-claude-implementer-2.1.328.md; 2.1.329: docs/verification/2026-11-20-claude-implementer-2.1.329.md; 2.1.332: docs/verification/2026-11-25-claude-implementer-2.1.332.md; 2.1.334: docs/verification/2026-12-02-claude-implementer-2.1.334.md; host-wrapper receipt below repeats with them.
|
|
46
|
-
"claude-implementer": { label: "Claude headless implementer", verified: ["2.1.309", "2.1.310", "2.1.314", "2.1.316", "2.1.318", "2.1.319", "2.1.322", "2.1.323", "2.1.328", "2.1.329", "2.1.332", "2.1.334"], gate: "contract", probe: ["claude", "--version"],
|
|
44
|
+
trustNote: "The model-free extension load, RPC session identity and managed tool receipt path were checked on 1.4.0, 1.5.0, 1.5.2, 1.6.0, 1.6.1 and 1.8.0. Permissions remain host-owned; account-backed inference and another version's extension contract are unverified.",
|
|
45
|
+
receipt: "docs/verification/2026-12-06-compat-pi-1.8.0.md" },
|
|
46
|
+
// Transport receipts: docs/verification/2026-10-23-headless-claude-permissions.md; 2.1.310: docs/verification/2026-10-26-claude-implementer-2.1.310.md; 2.1.314 (transport and wrapper): docs/verification/2026-10-31-claude-implementer-2.1.314.md; 2.1.316: docs/verification/2026-10-31-claude-implementer-2.1.316.md; 2.1.318: docs/verification/2026-11-05-claude-implementer-2.1.318.md; 2.1.319: docs/verification/2026-11-06-claude-implementer-2.1.319.md; 2.1.322: docs/verification/2026-11-10-claude-implementer-2.1.322.md; 2.1.323: docs/verification/2026-11-13-claude-implementer-2.1.323.md; 2.1.328: docs/verification/2026-11-19-claude-implementer-2.1.328.md; 2.1.329: docs/verification/2026-11-20-claude-implementer-2.1.329.md; 2.1.332: docs/verification/2026-11-25-claude-implementer-2.1.332.md; 2.1.334: docs/verification/2026-12-02-claude-implementer-2.1.334.md; 2.1.337: docs/verification/2026-12-05-claude-implementer-2.1.337.md; host-wrapper receipt below repeats with them.
|
|
47
|
+
"claude-implementer": { label: "Claude headless implementer", verified: ["2.1.309", "2.1.310", "2.1.314", "2.1.316", "2.1.318", "2.1.319", "2.1.322", "2.1.323", "2.1.328", "2.1.329", "2.1.332", "2.1.334", "2.1.337"], gate: "contract", probe: ["claude", "--version"],
|
|
47
48
|
parse: out => plain(out.trim().replace(/ \(Claude Code\)$/, "")),
|
|
48
49
|
trustNote: "The native prompt-tool transport and host-wrapper rewrite, environment isolation and replay contract have isolated receipts. No dontAsk/bypass fallback exists; another version's permission or rewrite behavior is unverified.",
|
|
49
|
-
receipt: "docs/verification/2026-12-
|
|
50
|
-
// 0.163.0 receipt: docs/verification/2026-10-22-codex-reviewer-isolation.md; 0.164.0 receipt: docs/verification/2026-10-24-codex-0164-reviewer-isolation.md; 0.166.0: docs/verification/2026-10-31-codex-0166-reviewer-isolation.md; 0.167.0 model-free only, not verified until its model-backed run: docs/verification/2026-11-06-codex-0167-reviewer-isolation.md; 0.167.2 model-free only, not verified until its model-backed run: docs/verification/2026-11-13-codex-01672-reviewer-isolation.md; 0.169.0 (model-free and one model-backed review): docs/verification/2026-11-14-codex-0169-reviewer-isolation.md and docs/verification/2026-11-14-codex-0169-reviewer-tool-call.md; 0.172.0 remains unverified: docs/verification/2026-11-25-codex-0172-reviewer-isolation.md and docs/verification/2026-11-26-codex-0172-reviewer-tool-call.md; 0.173.0 model-free
|
|
50
|
+
receipt: "docs/verification/2026-12-05-claude-implementer-2.1.337.md" },
|
|
51
|
+
// 0.163.0 receipt: docs/verification/2026-10-22-codex-reviewer-isolation.md; 0.164.0 receipt: docs/verification/2026-10-24-codex-0164-reviewer-isolation.md; 0.166.0: docs/verification/2026-10-31-codex-0166-reviewer-isolation.md; 0.167.0 model-free only, not verified until its model-backed run: docs/verification/2026-11-06-codex-0167-reviewer-isolation.md; 0.167.2 model-free only, not verified until its model-backed run: docs/verification/2026-11-13-codex-01672-reviewer-isolation.md; 0.169.0 (model-free and one model-backed review): docs/verification/2026-11-14-codex-0169-reviewer-isolation.md and docs/verification/2026-11-14-codex-0169-reviewer-tool-call.md; 0.172.0 remains unverified: docs/verification/2026-11-25-codex-0172-reviewer-isolation.md and docs/verification/2026-11-26-codex-0172-reviewer-tool-call.md; 0.173.0 model-free and one model-backed review, failed the served-model check: docs/verification/2026-12-03-codex-0173-reviewer-isolation.md and docs/verification/2026-12-03-codex-0173-reviewer-tool-call.md; 0.174.0 model-free pass outside the harness containment contract (disposable gate bypassed, unauthorized) and one model-backed review that produced no verdict: docs/verification/2026-12-06-codex-0174-reviewer-isolation.md and docs/verification/2026-12-06-codex-0174-reviewer-tool-call.md
|
|
51
52
|
"codex-review": { label: "Codex reviewer (codex-cli)", verified: ["0.146.0", "0.163.0", "0.164.0", "0.166.0", "0.169.0"], gate: "isolation", probe: ["codex", "--version"], config: "codex_bin",
|
|
52
53
|
parse: out => plain(out.trim().replace(/^codex-cli /, "")),
|
|
53
54
|
trustNote: "Every launch still proves the MCP inventory, Apps/plugins/hooks disabled, sandbox read/write denial and the binary fence; a failed leg still refuses. Trust covers only the source-level claims those probes cannot see (docs/verification/2026-10-19-reviewer-isolation.md).",
|
|
@@ -64,8 +65,8 @@ export const COMPAT = {
|
|
|
64
65
|
parse: out => plain(out.trim()),
|
|
65
66
|
trustNote: "Only 2.5.2 has a live receipt for turn.prompt/turn.ended/prompt completion rows, background task inventory and launcher-bound plugin hooks. Another version keeps completion receipts disabled.",
|
|
66
67
|
receipt: "docs/verification/2026-11-08-kimi-tui-completion-1282.md" },
|
|
67
|
-
// #1808 T2:
|
|
68
|
-
//
|
|
68
|
+
// #1808 T2: C0 (docs/verification/2026-10-30-445-capability-probes.md) verified one exact listing version per CLI.
|
|
69
|
+
// Codex 0.174.0 adds a hosted live skills/list receipt. Listing admission remains exact-version, with no line.
|
|
69
70
|
"kimi-capabilities": { label: "Kimi capability listing", verified: ["2.3.2"], gate: "contract", probe: ["kimi", "--version"],
|
|
70
71
|
parse: out => plain(out.trim()),
|
|
71
72
|
trustNote: "Only the available_commands_update shape of 2.3.2 was probed (fixture model, no account). Another version lists nothing unless you trust it. An untested listing of this version may miss or misclassify entries. A capability you shared earlier can be invoked again without a new share if its digest still matches, because the digest covers neither the CLI version nor the skill content.",
|
|
@@ -74,10 +75,10 @@ export const COMPAT = {
|
|
|
74
75
|
parse: out => plain(out.trim()),
|
|
75
76
|
trustNote: "Only the available_commands_update shape and the _meta.source field of 0.26.1 were probed (fixture auth, no account). Another version lists nothing unless you trust it. An untested listing of this version may miss or misclassify entries. A capability you shared earlier can be invoked again without a new share if its digest still matches, because the digest covers neither the CLI version nor the skill content.",
|
|
76
77
|
receipt: "docs/verification/2026-11-30-capability-listing-shape-1808.md" },
|
|
77
|
-
"codex-capabilities": { label: "Codex capability listing", verified: ["0.166.0"], gate: "contract", probe: ["codex", "--version"], config: "codex_bin",
|
|
78
|
+
"codex-capabilities": { label: "Codex capability listing", verified: ["0.166.0", "0.174.0"], gate: "contract", probe: ["codex", "--version"], config: "codex_bin",
|
|
78
79
|
parse: out => plain(out.trim().replace(/^codex-cli /, "")),
|
|
79
|
-
trustNote: "Only the skills/list
|
|
80
|
-
receipt: "docs/verification/2026-
|
|
80
|
+
trustNote: "Only the skills/list answers of 0.166.0 and 0.174.0 were probed live (no account). Another version lists nothing unless you trust it. An untested listing of this version may miss or misclassify entries. A capability you shared earlier can be invoked again without a new share if its digest still matches, because the digest covers neither the CLI version nor the skill content.",
|
|
81
|
+
receipt: "docs/verification/2026-12-06-compat-codex-capabilities-0.174.0.md" },
|
|
81
82
|
// #1808 T3: surfaces the hub only WATCHES. An `observe` entry never refuses and no launch, start or restore path reads it; the daily watch, `ahub agents` and `ahub doctor` report it.
|
|
82
83
|
// Receipt: docs/verification/2026-10-30-445-capability-probes.md (C0 `initialize` of Codex 0.166.0 and Kimi 2.3.2). The legs run a handshake without a model and were tested only with fake executables.
|
|
83
84
|
"codex-appserver": { label: "Codex app-server handshake", verified: ["0.166.0"], gate: "observe", probe: ["codex", "--version"], config: "codex_bin",
|
|
@@ -104,10 +105,10 @@ export const COMPAT = {
|
|
|
104
105
|
parse: out => { try { const v = JSON.parse(out).semver; return typeof v === "string" ? plain(v) : undefined; } catch { return undefined; } },
|
|
105
106
|
trustNote: "The ACP, serve and MCP contract was verified on 0.98.1, 0.99.1 and 1.0.3, steering on 0.99.0, 0.99.1 and 1.0.3, and a hub delivery was acknowledged on 1.0.3; an untested version inside the line may change them. A real account, provider or model, the TUI form and Linux builds stay unverified.",
|
|
106
107
|
receipt: "docs/verification/2026-11-22-jcode-1.0.3.md" },
|
|
107
|
-
agy: { label: "agy", verified: ["1.4.2", "1.4.7", "1.4.12", "1.5.3", "1.5.21"], line: { min: "1.4.0", below: "1.5.0" }, gate: "contract", probe: ["agy", "--version"],
|
|
108
|
+
agy: { label: "agy", verified: ["1.4.2", "1.4.7", "1.4.12", "1.5.3", "1.5.21", "1.5.24"], line: { min: "1.4.0", below: "1.5.0" }, gate: "contract", probe: ["agy", "--version"],
|
|
108
109
|
parse: out => plain(out.trim()),
|
|
109
|
-
trustNote: "Exact 1.5.3 and 1.5.
|
|
110
|
-
receipt: "docs/verification/2026-12-
|
|
110
|
+
trustNote: "Exact 1.5.3, 1.5.21 and 1.5.24 repeat the account-free CLI/plugin MCP, hooks, normal close and actual-launcher nonce legs; 1.5.21 also shows that the provider declarations run_workflow, swarm and update_steps reach the PreToolUse hook and are refused natively with no effect. Existing 1.4.x verified receipts remain unchanged. Other 1.5.x versions, real model/account behavior, headless ACP and native permission mappings remain unverified.",
|
|
111
|
+
receipt: "docs/verification/2026-12-05-agy-1.5.24.md" },
|
|
111
112
|
// Receipt: docs/verification/2026-11-22-qwen-0283-acp.md (0.27.1 and 0.28.3).
|
|
112
113
|
qwen: { label: "Qwen Code", verified: ["0.25.0", "0.26.0", "0.26.1", "0.26.4", "0.26.5", "0.26.8", "0.26.9", "0.27.0", "0.27.1", "0.28.3"], gate: "contract", probe: ["qwen", "--version"], config: "qwen_cmd",
|
|
113
114
|
parse: out => plain(out.trim()),
|
|
@@ -137,13 +138,18 @@ if (referenceOnlyBad.length) throw new Error(`COMPAT referenceOnly needs gate ob
|
|
|
137
138
|
export const KIMI_SETTER_VERSION = "2.5.2";
|
|
138
139
|
/** The Claude versions whose transcript record shape the instruction receipt was probed on. */
|
|
139
140
|
export const INSTRUCTION_PROBED_VERSIONS: readonly string[] = Object.freeze(["2.1.328", "2.1.329"]);
|
|
140
|
-
|
|
141
|
+
export function piCommand(explicit?: readonly string[]): string[] {
|
|
142
|
+
if (explicit?.length) return [...explicit];
|
|
143
|
+
const pin = readPiPin(COMPAT.pi.verified);
|
|
144
|
+
return pin ? [pin.command] : ["pi"];
|
|
145
|
+
}
|
|
146
|
+
type CommandConfig = { codex_bin: string; jcode_cmd: string[]; qwen_cmd: string[]; pi?: { cmd?: string[] } };
|
|
141
147
|
/** The configured executables the native gates use; the rest probe their PATH default. */
|
|
142
148
|
export function configuredCommands(config: CommandConfig): Partial<Record<CompatId, readonly string[]>> {
|
|
143
149
|
const out: Partial<Record<CompatId, readonly string[]>> = {};
|
|
144
150
|
for (const [id, policy] of Object.entries(COMPAT) as [CompatId, CompatPolicy][]) {
|
|
145
151
|
if (!policy.config) continue;
|
|
146
|
-
const value = policy.config === "pi.cmd" ? config.pi
|
|
152
|
+
const value = policy.config === "pi.cmd" ? config.pi && piCommand(config.pi.cmd) : config[policy.config];
|
|
147
153
|
if (value !== undefined) out[id] = typeof value === "string" ? [value] : value;
|
|
148
154
|
}
|
|
149
155
|
return out;
|
|
@@ -156,6 +162,10 @@ export type CompatVerdict =
|
|
|
156
162
|
|
|
157
163
|
const parts = (v: string) => /^(\d+)\.(\d+)\.(\d+)$/.exec(v)?.slice(1).map(Number);
|
|
158
164
|
const compare = (a: number[], b: number[]) => a[0]! - b[0]! || a[1]! - b[1]! || a[2]! - b[2]!;
|
|
165
|
+
/** Receipt publication appends entries, including receipts for older versions. */
|
|
166
|
+
export function newestVerifiedPiVersion(): string {
|
|
167
|
+
return COMPAT.pi.verified.reduce((newest, version) => compare(parts(version)!, parts(newest)!) > 0 ? version : newest);
|
|
168
|
+
}
|
|
159
169
|
function inLine(version: string, line?: { min: string; below: string }): boolean {
|
|
160
170
|
const v = parts(version);
|
|
161
171
|
return !!line && !!v && compare(v, parts(line.min)!) >= 0 && compare(v, parts(line.below)!) < 0;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { piCommand } from "../compat.ts";
|
|
1
2
|
import { join, resolve } from "node:path";
|
|
2
3
|
import type { Launch } from "../../cli/launch.ts";
|
|
3
4
|
import { REDACTED, UNRESOLVED, nativeCommand, previewState, finishPreview, type NativePreviewContext } from "./native-cli-preview-common.ts";
|
|
@@ -20,7 +21,7 @@ export function previewPi(ctx: NativePreviewContext) {
|
|
|
20
21
|
if (args.includes("--replace-session")) unresolved.push({ field: "session replacement", reason: "requires a person, a validated managed file and an offline settled owner at runtime; preview changes nothing" });
|
|
21
22
|
const models = relayModelIds({ enableHubAuto: true, mlx: config.mlx.enabled === false ? undefined : config.mlx, mlxAlias: "mlx/fast", allowedDGXmodels: { "dgx/coding": config.pi.dgx_coding, "dgx/fast": config.pi.dgx_fast } });
|
|
22
23
|
const pi = buildPiLaunch({
|
|
23
|
-
stateDir, cmd: nativeCommand(config.pi.cmd, ["pi"]), mode: mode as "headless" | "tui", backend: backend as "auto" | "dgx" | "mlx",
|
|
24
|
+
stateDir, cmd: nativeCommand(piCommand(config.pi.cmd), ["pi"]), mode: mode as "headless" | "tui", backend: backend as "auto" | "dgx" | "mlx",
|
|
24
25
|
...(value("--model") ? { model: REDACTED } : {}),
|
|
25
26
|
...(value("--session-id") ? { sessionId: REDACTED } : {}),
|
|
26
27
|
...(value("--session-file") ? { sessionFile: REDACTED } : {}),
|
|
@@ -8,7 +8,7 @@ export function nativeConfigurationDefaults(ctx: { home: string; env: Readonly<R
|
|
|
8
8
|
return {
|
|
9
9
|
commands: { kimi_cmd: ["kimi", "acp"], qwen_cmd: ["qwen", "--acp"], jcode_cmd: ["jcode"], jcode_home: ctx.env.JCODE_HOME ?? join(ctx.home, ".jcode"), jcode_provider_profile: "" },
|
|
10
10
|
proxy: { codex_bin: "codex" },
|
|
11
|
-
rpc: { pi: { enabled: false, auto_start: false,
|
|
11
|
+
rpc: { pi: { enabled: false, auto_start: false, backend: "auto" as const, dgx_coding: "coding", dgx_fast: "fast", max_steps: 100, max_continuations: 2 } },
|
|
12
12
|
sandbox: { local: { deny: [] as string[], bash_network: false, network_allow: ctx.networkAllow, max_steps: 30, read_allow: [] as string[], doc_read: false, web_fetch: { allow: [] as string[] } } },
|
|
13
13
|
};
|
|
14
14
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { recordOrEmpty as object, isRecord as record } from "../../primitives.ts";
|
|
1
2
|
import type { ContextReading } from "../../hub/context-window.ts";
|
|
2
3
|
|
|
3
4
|
export const nonnegative = (n: unknown): n is number => typeof n === "number" && Number.isFinite(n) && n >= 0;
|
|
4
5
|
export const positive = (n: unknown): n is number => nonnegative(n) && n > 0;
|
|
5
|
-
const record = (v: unknown): v is Record<string, unknown> => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
6
|
-
const object = (v: unknown): Record<string, unknown> => record(v) ? v : {};
|
|
7
6
|
export function claudeContext(value: unknown, sessionId: string, measuredAt: number): ContextReading {
|
|
8
7
|
const c = object(value);
|
|
9
8
|
const current = object(c.current_usage);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { piCommand } from "../compat.ts";
|
|
1
2
|
import { ACP_ACTIVITY } from "./native-activity.ts";
|
|
2
3
|
import type { CreateContext, DaemonEngine, DaemonPorts } from "../registry-types.ts";
|
|
3
4
|
import type { PeerAdapter } from "../../hub/peers.ts";
|
|
@@ -38,9 +39,11 @@ export function createPi(ctx: CreateContext): PeerAdapter {
|
|
|
38
39
|
const { PiPeer, PiVersionRefusal, piVersionAsync } = require("../pi.ts") as typeof import("../pi.ts");
|
|
39
40
|
const options = ctx.daemon.pi;
|
|
40
41
|
return new PiPeer(ctx.instance, options, async () => {
|
|
41
|
-
const
|
|
42
|
+
const command = piCommand(options.cmd);
|
|
43
|
+
const verdict = await piVersionAsync(command, options.cwd);
|
|
42
44
|
if (!verdict.ok) throw new PiVersionRefusal(verdict);
|
|
43
45
|
if (verdict.note) options.log?.(verdict.note);
|
|
46
|
+
return command;
|
|
44
47
|
});
|
|
45
48
|
}
|
|
46
49
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { recordOrEmpty as record } from "../../primitives.ts";
|
|
1
2
|
import { quotaAccountUsage, type QuotaAccountUsage } from "../../hub/quota-account.ts";
|
|
2
3
|
import { types } from "node:util";
|
|
3
4
|
import type { UsageWindow } from "../../hub/budget.ts";
|
|
@@ -33,7 +34,6 @@ export function claudeWindows(rateLimits: any): UsageWindow[] {
|
|
|
33
34
|
|
|
34
35
|
/** Bounds inspection of native detail rows; the native availableCount remains authoritative. */
|
|
35
36
|
const MAX_RESET_CREDIT_DETAILS = 128;
|
|
36
|
-
const record = (value: unknown): Record<string, unknown> => value && typeof value === "object" && !Array.isArray(value) ? value as Record<string, unknown> : {};
|
|
37
37
|
const epochMillis = (value: unknown): number | undefined => {
|
|
38
38
|
if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) return undefined;
|
|
39
39
|
const ms = value * 1000;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { recordOrEmpty as object } from "../../primitives.ts";
|
|
1
2
|
import { readdirSync } from "node:fs";
|
|
2
3
|
import { basename, join } from "node:path";
|
|
3
4
|
import { readEvents } from "../../hub/events.ts";
|
|
@@ -23,9 +24,9 @@ export function nativeRecordedSessionState(binding: TerminalBinding, kind: "roll
|
|
|
23
24
|
const startupArgs = (peer: RecoveryPeer): Record<string, string> => Object.fromEntries(["mode", "backend", "model", "route"]
|
|
24
25
|
.flatMap(key => typeof peer.args?.[key] === "string" ? [[key, peer.args[key]!]] : []));
|
|
25
26
|
const text = (value: unknown): value is string => typeof value === "string" && value.length > 0;
|
|
26
|
-
const object = (value: unknown): Record<string, unknown> => value !== null && typeof value === "object" && !Array.isArray(value) ? value as Record<string, unknown> : {};
|
|
27
27
|
|
|
28
28
|
export const CODEX_RECOVERY_SESSION: SessionPolicy = {
|
|
29
|
+
contractKind: "codex",
|
|
29
30
|
resumeArgv: (binding, fresh) => ["codex", ...(fresh ? [] : ["resume", binding.sessionId])],
|
|
30
31
|
transcriptPath: binding => checkedSessionPath(binding, "rollout"), transcriptExists: rolloutState,
|
|
31
32
|
personFresh: true, missingEvidence: "rollout",
|
|
@@ -42,6 +43,7 @@ export const CODEX_RECOVERY_SESSION: SessionPolicy = {
|
|
|
42
43
|
},
|
|
43
44
|
};
|
|
44
45
|
export const CLAUDE_RECOVERY_SESSION: SessionPolicy = {
|
|
46
|
+
contractKind: "claude",
|
|
45
47
|
resumeArgv: (binding, fresh) => ["claude", ...(fresh ? [] : ["--resume", binding.sessionId])],
|
|
46
48
|
transcriptPath: binding => checkedSessionPath(binding, "transcript"), transcriptExists: transcriptState,
|
|
47
49
|
zeroTurn: ({ binding, phase }) => phase !== "plan" && transcriptState(binding) !== true,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { sha256Hex as digest } from "../primitives.ts";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
2
3
|
import { constants, closeSync, fstatSync, lstatSync, openSync, readFileSync, readSync } from "node:fs";
|
|
3
4
|
import { isBuiltin } from "node:module";
|
|
4
5
|
import { isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
@@ -16,7 +17,6 @@ export { adapterModuleDeclarations, readAdapterModuleDeclarations, type AdapterM
|
|
|
16
17
|
|
|
17
18
|
const MAX_MODULE_BYTES = 2 * 1024 * 1024;
|
|
18
19
|
const ADAPTER_IMPORT = "@staix/agent-hub/adapter";
|
|
19
|
-
const digest = (bytes: Uint8Array) => createHash("sha256").update(bytes).digest("hex");
|
|
20
20
|
export interface ExternalModuleIdentity {
|
|
21
21
|
readonly projectRoot: string;
|
|
22
22
|
readonly modulePath: string;
|
|
@@ -11,9 +11,9 @@ import { KimiUsage } from "../hub/kimi-usage.ts";
|
|
|
11
11
|
import type { ReviewerBackend, ReviewerLaunch, ReviewerPrepareContext } from "./reviewer-print.ts";
|
|
12
12
|
import { assertCleanCwdAncestors, checkKimiReviewPolicy, kimiReviewFingerprint as hash, projectKimiReviewPolicyBinding, readKimiReviewFile as read } from "./kimi-review-policy.ts";
|
|
13
13
|
import { startKimiReviewPolicyWatch, type KimiReviewPolicyFactory } from "./kimi-review-policy-worker.ts";
|
|
14
|
+
import { isRecord as object } from "../primitives.ts";
|
|
14
15
|
|
|
15
16
|
const MANAGED = "managed:kimi-code";
|
|
16
|
-
const object = (v: unknown): v is Record<string, unknown> => !!v && typeof v === "object" && !Array.isArray(v);
|
|
17
17
|
const scalar = (value: unknown, depth = 0): string => {
|
|
18
18
|
if (depth > 4) throw new Error("managed model setting too deeply nested");
|
|
19
19
|
if (typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value)) return JSON.stringify(value);
|
|
@@ -4,6 +4,7 @@ import { basename, dirname, isAbsolute, join, relative } from "node:path";
|
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { realPath } from "../hub/project.ts";
|
|
6
6
|
import type { NativeFactsInput, NativeFactsPort, NativeFactsTranscript } from "./registry-types.ts";
|
|
7
|
+
import { isRecord as record } from "../primitives.ts";
|
|
7
8
|
|
|
8
9
|
const EVENTS = ["TurnStarted", "Stop", "StopFailure", "Interrupt", "SessionEnd", "TaskStarted", "Notification"] as const;
|
|
9
10
|
const SESSION = /^session_[A-Za-z0-9_-]{1,120}$/;
|
|
@@ -14,7 +15,6 @@ const WIRE_CAP = 8 * 1024 * 1024;
|
|
|
14
15
|
const TASK_CAP = 64 * 1024;
|
|
15
16
|
const MAX_AGENTS = 256;
|
|
16
17
|
const MAX_TASKS = 256;
|
|
17
|
-
const record = (value: unknown): value is Record<string, unknown> => !!value && typeof value === "object" && !Array.isArray(value);
|
|
18
18
|
const integer = (value: unknown): value is number => Number.isSafeInteger(value) && (value as number) >= 0;
|
|
19
19
|
const inside = (root: string, path: string) => { const rel = relative(root, path); return rel !== "" && rel !== ".." && !rel.startsWith("../") && !isAbsolute(rel); };
|
|
20
20
|
|
|
@@ -247,7 +247,7 @@ export class LocalPeer extends BasePeer {
|
|
|
247
247
|
) {
|
|
248
248
|
super(id, opts.watchdogMs);
|
|
249
249
|
this.routes = new HubRouteRuntime({
|
|
250
|
-
execute: async (model, messages, judge, signal, maxTokens) => {
|
|
250
|
+
execute: async (model, messages, judge, signal, maxTokens, decisionChoice) => {
|
|
251
251
|
if (signal.aborted) throw new Error("turn cancelled before model request");
|
|
252
252
|
const envs = this.routeEnvs, pii = this.routePii, generation = this.turn, task = this.routeTask;
|
|
253
253
|
await this.requireBudget(envs, "model_calls");
|
|
@@ -255,7 +255,7 @@ export class LocalPeer extends BasePeer {
|
|
|
255
255
|
if (signal.aborted) throw new Error("turn cancelled before model request");
|
|
256
256
|
const tools = judge ? undefined : [...this.toolSchemas(), ...(this.opts.taskTool ? [...profileTaskTools(this.opts.profile, this.opts.sdlcStages, this.opts.sdlcCriteria, this.opts.sdlcAudit, this.opts.sdlcSurvey, this.opts.taskWait).filter(tool => tool.name !== "hub_delivery_retry"), ...CONDUCTOR_TOOLS].concat(SESSION_TITLE_TOOL).map(asFunction) : [])];
|
|
257
257
|
this.releaseObserverInput(this.currentObserverInputContext, envs);
|
|
258
|
-
const result = await this.opts.omni.chat({ model, messages, ...(tools ? { tools } : {}), ...(judge ? { max_tokens: maxTokens ?? 2048 } : {}) }, { signal, ...(pii ? { onCampusOnly: true } : {}) });
|
|
258
|
+
const result = await this.opts.omni.chat({ model, messages, ...(tools ? { tools } : {}), ...(judge ? { max_tokens: maxTokens ?? 2048 } : {}) }, { signal, ...(pii ? { onCampusOnly: true } : {}), decisionChoice });
|
|
259
259
|
this.recordUsage(result, model, task);
|
|
260
260
|
if (generation !== this.turn) throw new Error("route belongs to an ended turn");
|
|
261
261
|
this.lastServedBy = `hub ${model} (provider ${result.provider ?? "?"})`;
|
|
@@ -265,7 +265,7 @@ export class LocalPeer extends BasePeer {
|
|
|
265
265
|
decisionContext: () => this.decisionContext(),
|
|
266
266
|
publicDecisionText: text => this.opts.routeEvidencePublic?.(text) === true,
|
|
267
267
|
admitDecision: () => this.requireBudget(this.routeEnvs, "model_calls"),
|
|
268
|
-
onDecisionIssue: reason => this.opts.log?.(`decision route
|
|
268
|
+
onDecisionIssue: reason => this.opts.log?.(`decision route ${reason}; using the current route; check adec serve and routing.toml`),
|
|
269
269
|
staySwitch: () => this.opts.staySwitch?.(),
|
|
270
270
|
onRoute: event => this.opts.onRoute?.(event),
|
|
271
271
|
onAdvisor: event => this.opts.onAdvisor?.(event),
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// Vendor identities and listing shapes live here, in the adapter layer, never in the core rules of `src/hub/capabilities.ts` (the #451 registry guard).
|
|
3
3
|
import { COMPAT, assessVersion } from "./compat.ts";
|
|
4
4
|
import { buildManifest, type Candidate, type CapabilityManifest, type FlatSchema } from "../hub/capabilities.ts";
|
|
5
|
+
import { isRecord as object } from "../primitives.ts";
|
|
5
6
|
|
|
6
|
-
const object = (value: unknown): value is Record<string, unknown> => !!value && typeof value === "object" && !Array.isArray(value);
|
|
7
7
|
|
|
8
8
|
// used-by: src/adapters/native-capabilities.ts
|
|
9
9
|
/** The vendor names of the three listings and the version their C0 receipt probed, read from the `COMPAT` entry (`verified[0]`), never held here (#1808). */
|
package/src/adapters/pi.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { QuestionWaitDetached } from "../hub/question-detach.ts";
|
|
|
19
19
|
import type { StartForm } from "./registry-types.ts";
|
|
20
20
|
import { stateModelId } from "./pi-state-model.ts";
|
|
21
21
|
import type { ModelObservation } from "../hub/events.ts";
|
|
22
|
+
import { piExitReason } from "../hub/pi-exit-policy.ts";
|
|
22
23
|
|
|
23
24
|
export interface PiModelDescriptor { id: string; name?: string; contextWindow?: number; maxTokens?: number; reasoning?: boolean; }
|
|
24
25
|
export interface PiToolSchema { name: string; description?: string; parameters: Record<string, unknown>; }
|
|
@@ -32,6 +33,9 @@ export interface PiExit {
|
|
|
32
33
|
turnActive: boolean;
|
|
33
34
|
toolActive: boolean;
|
|
34
35
|
lastToolName?: string;
|
|
36
|
+
/** #1967: the tail of the owner's stderr, the last native event type it reported and the provider a model_select named, each bounded and free of task text. */
|
|
37
|
+
stderrTail?: string;
|
|
38
|
+
modelProvider?: string;
|
|
35
39
|
}
|
|
36
40
|
export interface PiToolContext { userBash: boolean; isCurrent: () => boolean; onApproval: (provenance: ApprovalProvenance) => void; }
|
|
37
41
|
export interface PiToolResult { text: string; exitCode: number | null; }
|
|
@@ -254,7 +258,7 @@ export class PiPeer extends BasePeer {
|
|
|
254
258
|
private tuiWaiters: Array<{ resolve: (command: Record<string, unknown> | undefined) => void; timer: ReturnType<typeof setTimeout> }> = [];
|
|
255
259
|
|
|
256
260
|
/** The fixed production factory supplies preflight separately, preserving transport option identity. */
|
|
257
|
-
constructor(id: PeerId, private readonly opts: PiOptions, private readonly preflight?: () => Promise<
|
|
261
|
+
constructor(id: PeerId, private readonly opts: PiOptions, private readonly preflight?: () => Promise<string[]>) { super(id, opts.watchdogMs); this.baselineRequestedModel = opts.model ?? ""; }
|
|
258
262
|
get tuiLaunch(): PiTuiLaunch | undefined { return this._tuiLaunch; }
|
|
259
263
|
get pendingResume(): { sessionId?: string; sessionFile?: string } {
|
|
260
264
|
if (this.canReuseVerifiedEmptyResume()) return { sessionId: this.verifiedEmptyResume!.sessionId };
|
|
@@ -508,7 +512,7 @@ export class PiPeer extends BasePeer {
|
|
|
508
512
|
}
|
|
509
513
|
|
|
510
514
|
private async startImpl(): Promise<void> {
|
|
511
|
-
|
|
515
|
+
const cmd = this.preflight ? await this.preflight() : this.opts.cmd;
|
|
512
516
|
this.terminalOwnerObservation = undefined;
|
|
513
517
|
this.stopping = false;
|
|
514
518
|
this.observedTitle = undefined; this.titleRevision = -1; this.nativeTitleEpoch = undefined; this.onDoing?.("reset");
|
|
@@ -574,14 +578,14 @@ export class PiPeer extends BasePeer {
|
|
|
574
578
|
const extension = resolve(join(import.meta.dir, "../pi/extension.ts"));
|
|
575
579
|
const inherited: NodeJS.ProcessEnv = {};
|
|
576
580
|
for (const key of ["PATH", "HOME", "USER", "SHELL", "TMPDIR", "TERM", "TERM_PROGRAM", "LANG", "LC_ALL", "LC_CTYPE", "NO_COLOR", "CODEX_HOME"]) if (process.env[key]) inherited[key] = process.env[key];
|
|
577
|
-
this._tuiLaunch = buildPiLaunch({ ...this.opts, instance: this.id }, inherited, extension, bridge.port!, token);
|
|
581
|
+
this._tuiLaunch = buildPiLaunch({ ...this.opts, cmd, instance: this.id }, inherited, extension, bridge.port!, token);
|
|
578
582
|
const { cmd: bin, args, env } = this._tuiLaunch;
|
|
579
583
|
if (this.opts.mode === "tui") { return; }
|
|
580
584
|
// Its own process group, stopped as a whole (#115, as Codex's in #113).
|
|
581
585
|
this.proc = spawn(bin, args, { cwd: this.opts.cwd, env, stdio: ["pipe", "pipe", "pipe"], detached: true });
|
|
582
586
|
trackGroup(this.proc);
|
|
583
587
|
this.proc.stdout.on("data", (chunk) => this.onOutput(String(chunk)));
|
|
584
|
-
this.proc.stderr.on("data", (chunk) => this.opts.log?.(`[${this.id}] ${String(chunk).trimEnd()}`));
|
|
588
|
+
this.proc.stderr.on("data", (chunk) => { this.noteStderr(String(chunk)); this.opts.log?.(`[${this.id}] ${String(chunk).trimEnd()}`); });
|
|
585
589
|
const proc = this.proc;
|
|
586
590
|
proc.on("error", (error) => {
|
|
587
591
|
const exit = this.exitMetadata("spawn_error");
|
|
@@ -591,7 +595,15 @@ export class PiPeer extends BasePeer {
|
|
|
591
595
|
proc.on("exit", (code, signal) => {
|
|
592
596
|
const exit = { ...(this.shutdownExit ?? this.exitMetadata("process_exit")), code, signal };
|
|
593
597
|
this.fail(new Error(`pi exited with ${signal ? `signal ${signal}` : `code ${code}`}`));
|
|
594
|
-
|
|
598
|
+
// #1967: stderr the process wrote just before it died can still be in the pipe; report once it is drained, or after a short bound.
|
|
599
|
+
let reported = false;
|
|
600
|
+
const report = () => {
|
|
601
|
+
if (reported) return; reported = true;
|
|
602
|
+
const tail = this.stderrTail.trim();
|
|
603
|
+
this.reportExit(tail ? { ...exit, stderrTail: tail } : exit);
|
|
604
|
+
};
|
|
605
|
+
if (proc.stderr.destroyed || proc.stderr.readableEnded) report();
|
|
606
|
+
else { proc.stderr.once("close", report); setTimeout(report, 250).unref?.(); }
|
|
595
607
|
});
|
|
596
608
|
const titleRevisionBefore = this.titleRevision, titleEpochBefore = this.titleEpoch;
|
|
597
609
|
const state = await this.waitRpc("get_state", 15_000);
|
|
@@ -922,6 +934,9 @@ export class PiPeer extends BasePeer {
|
|
|
922
934
|
}
|
|
923
935
|
|
|
924
936
|
private handleBridgeEvent(event: any): void {
|
|
937
|
+
// #1967 T1: the exit line names the last native event and the provider a model_select asked for; neither carries task text.
|
|
938
|
+
if (typeof event?.type === "string" && /^[a-z_]{1,48}$/.test(event.type)) this.lastNativeEvent = event.type;
|
|
939
|
+
if (event?.type === "model_select_foreign" && typeof event.provider === "string" && /^[A-Za-z0-9_.:/-]{1,64}$/.test(event.provider)) this.foreignProvider = event.provider;
|
|
925
940
|
if (this.fencedPrompt && this.opts.mode === "tui" && !this.rosterUnownedRun && ["agent_start", "agent_end", "agent_settled"].includes(event.type)
|
|
926
941
|
&& typeof event.promptId === "string" && event.promptId !== this.hubPromptId) return;
|
|
927
942
|
if (this.fencedPrompt && this.opts.mode === "tui" && (this.activeEnvs.length > 0 || this.pendingPromptId || this.hubPromptId) && !this.rosterDetached && !this.rosterUnownedRun && !this.stopping && ["agent_start", "agent_end", "agent_settled"].includes(event.type)) {
|
|
@@ -1120,16 +1135,20 @@ export class PiPeer extends BasePeer {
|
|
|
1120
1135
|
try { return await Promise.race([this.sendRpc({ type: command }), new Promise<never>((_, reject) => { timer = setTimeout(() => reject(new Error(`Pi ${command} timed out`)), timeout); })]); }
|
|
1121
1136
|
finally { clearTimeout(timer); }
|
|
1122
1137
|
}
|
|
1138
|
+
private stderrTail = ""; private lastNativeEvent: string | undefined; private foreignProvider: string | undefined;
|
|
1139
|
+
private noteStderr(chunk: string): void { this.stderrTail = `${this.stderrTail}${chunk}`.replace(/\s+/g, " ").slice(-300); }
|
|
1123
1140
|
private exitMetadata(cause: PiExit["cause"]): PiExit {
|
|
1124
1141
|
return { cause, code: null, signal: null, expected: this.stopping, started: this.started,
|
|
1125
1142
|
turnActive: this.agentRunning || this.activeEnvs.length > 0, toolActive: this.activeTools > 0,
|
|
1126
|
-
...(this.lastToolName ? { lastToolName: this.lastToolName } : {})
|
|
1143
|
+
...(this.lastToolName ? { lastToolName: this.lastToolName } : {}),
|
|
1144
|
+
...(this.stderrTail.trim() ? { stderrTail: this.stderrTail.trim() } : {}),
|
|
1145
|
+
...(this.foreignProvider ? { modelProvider: this.foreignProvider } : {}) };
|
|
1127
1146
|
}
|
|
1128
1147
|
|
|
1129
1148
|
private reportExit(exit: PiExit): void {
|
|
1130
1149
|
if (this.exitReported) return;
|
|
1131
1150
|
this.exitReported = true;
|
|
1132
|
-
const line = `[${this.id}] Pi exit: cause=${exit.cause} code=${exit.code ?? "unknown"} signal=${exit.signal ?? "unknown"} expected=${exit.expected} started=${exit.started} turnActive=${exit.turnActive} toolActive=${exit.toolActive} lastTool=${exit.lastToolName ?? "none"}`;
|
|
1151
|
+
const line = `[${this.id}] Pi exit: cause=${exit.cause} code=${exit.code ?? "unknown"} signal=${exit.signal ?? "unknown"} expected=${exit.expected} started=${exit.started} turnActive=${exit.turnActive} toolActive=${exit.toolActive} lastTool=${exit.lastToolName ?? "none"} reason=${piExitReason(exit)} lastEvent=${this.lastNativeEvent ?? "none"}${exit.modelProvider ? ` provider=${exit.modelProvider}` : ""}${exit.stderrTail ? ` stderr=${JSON.stringify(exit.stderrTail.slice(-200))}` : ""}`;
|
|
1133
1152
|
try { this.opts.log?.(line); } catch { /* reporting must not prevent owner settlement */ }
|
|
1134
1153
|
try { this.opts.onExit?.(exit); } catch { /* the owner is already offline */ }
|
|
1135
1154
|
}
|
|
@@ -302,6 +302,8 @@ export interface AdapterDefinition {
|
|
|
302
302
|
recoveryRefusal?(peer: RecoveryPeer, phase?: "plan" | "restore"): string | undefined;
|
|
303
303
|
personFresh?: boolean;
|
|
304
304
|
missingEvidence?: "rollout" | "transcript";
|
|
305
|
+
/** Native release contract key for sessions that may be affected by an upgrade. */
|
|
306
|
+
contractKind?: keyof import("../hub/upgrade-session-contract.ts").SessionContract;
|
|
305
307
|
/** Fixed source-only compatibility reads used by released recovery coordinators. */
|
|
306
308
|
legacyTargetSupport?: { file: "src/hub/peer-catalog.ts"; exportName: "OPTIONAL_PEERS"; refusal: string };
|
|
307
309
|
legacyHeadlessArgv?: { file: "src/hub/start-mode.ts"; exportName: "START_MODE_PEERS"; argv: readonly string[] };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
|
|
4
|
+
const CONTRACT_VERSION = "1";
|
|
5
|
+
const PROBE_TIMEOUT_MS = 500;
|
|
6
|
+
const PROBE_OUTPUT_BYTES = 64;
|
|
7
|
+
const relayArgs = ["mcp-shim", "ahub"];
|
|
8
|
+
const asuite = Bun.which("asuite", { PATH: process.env.PATH ?? "" });
|
|
9
|
+
|
|
10
|
+
if (asuite) {
|
|
11
|
+
try {
|
|
12
|
+
const probe = spawnSync(asuite, [...relayArgs, "--contract"], {
|
|
13
|
+
encoding: "utf8",
|
|
14
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
15
|
+
timeout: PROBE_TIMEOUT_MS,
|
|
16
|
+
maxBuffer: PROBE_OUTPUT_BYTES,
|
|
17
|
+
killSignal: "SIGKILL",
|
|
18
|
+
});
|
|
19
|
+
if (!probe.error && probe.status === 0 && probe.stdout.trim() === CONTRACT_VERSION) {
|
|
20
|
+
process.execve!(asuite, [asuite, ...relayArgs]);
|
|
21
|
+
}
|
|
22
|
+
} catch {
|
|
23
|
+
// An exec can fail even after the probe succeeded, for example during an asuite update.
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
process.execve!(process.execPath, [process.execPath, "run", join(import.meta.dir, "server.js")]);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { randomBytes, timingSafeEqual } from "node:crypto";
|
|
2
2
|
import type { HubTool } from "../hub/hub-tools.ts";
|
|
3
3
|
import { sanitize } from "../hub/envelope.ts";
|
|
4
|
+
import { isRecord as record } from "../primitives.ts";
|
|
4
5
|
|
|
5
6
|
export type ReviewerToolName = "hub_review" | "hub_task_show";
|
|
6
7
|
export interface ReviewerMcpSession { config: string; close(): void }
|
|
@@ -15,7 +16,6 @@ export interface ReviewerMcpOptions {
|
|
|
15
16
|
}
|
|
16
17
|
const NAMES: readonly ReviewerToolName[] = ["hub_review", "hub_task_show"];
|
|
17
18
|
const BODY_CAP = 256 * 1024, RESULT_CAP = 4 * 1024 * 1024;
|
|
18
|
-
const record = (value: unknown): value is Record<string, unknown> => !!value && typeof value === "object" && !Array.isArray(value);
|
|
19
19
|
|
|
20
20
|
/** One revocable review capability. This server never reads a daemon control token or accepts a peer/role. */
|
|
21
21
|
export function createReviewerMcpSession(options: ReviewerMcpOptions): ReviewerMcpSession {
|
package/src/cli/agents.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
|
-
import { assessVersion, COMPAT, describe, isCompatId, readTrust, trustFile, writeTrust, type CompatId, type CompatVerdict } from "../adapters/compat.ts";
|
|
2
|
+
import { assessVersion, COMPAT, describe, isCompatId, newestVerifiedPiVersion, readTrust, trustFile, writeTrust, type CompatId, type CompatVerdict } from "../adapters/compat.ts";
|
|
3
3
|
import { childEnv } from "../hub/child-process.ts";
|
|
4
4
|
import { withoutOrcaEnv } from "../hub/orca-env.ts";
|
|
5
5
|
import { Report, asciiMarkers, resolveColor, streamEnv } from "./console-state.ts";
|
|
6
6
|
import { outputWidth } from "./output.ts";
|
|
7
7
|
import { renderAgents } from "./agents-output.ts";
|
|
8
|
+
import { readPiPin } from "../pi/pin.ts";
|
|
8
9
|
|
|
9
10
|
/** #691: what `ahub agents` and `ahub doctor` show for each gated native CLI. */
|
|
10
11
|
export interface AgentVersionRow { id: CompatId; executable?: string; verdict: CompatVerdict; policy: string }
|
|
@@ -24,15 +25,26 @@ function probeRow(id: CompatId, executable: string | undefined, stdout: string |
|
|
|
24
25
|
return { id, executable, verdict: assessVersion(id, stdout === undefined ? undefined : COMPAT[id].parse(stdout), trusted), policy: describe(id) };
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
function syncVersion(id: CompatId, commands: Partial<Record<CompatId, readonly string[]>>, trusted: ReturnType<typeof readTrust>, env = process.env): AgentVersionRow {
|
|
29
|
+
const target = probeTarget(id, commands);
|
|
30
|
+
if (!target) return probeRow(id, undefined, undefined, trusted);
|
|
31
|
+
const result = spawnSync(target.executable, target.args, { encoding: "utf8", timeout: 10_000, maxBuffer: 64 * 1024, env: withoutOrcaEnv(childEnv({ ...env, ...PROBE_ENV })) });
|
|
32
|
+
return probeRow(id, target.executable, result.status === 0 ? result.stdout ?? "" : undefined, trusted);
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
/** `commands` carries the configured argv (including pi.cmd); the probe words follow it. */
|
|
28
36
|
export function agentVersions(commands: Partial<Record<CompatId, readonly string[]>> = {}): AgentVersionRow[] {
|
|
29
37
|
const trusted = readTrust();
|
|
30
|
-
return (Object.keys(COMPAT) as CompatId[]).map(id =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
38
|
+
return (Object.keys(COMPAT) as CompatId[]).map(id => syncVersion(id, commands, trusted));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function piInstallReport(probePath = true): { detail: string; command?: string } {
|
|
42
|
+
const { HOME, PATH } = process.env;
|
|
43
|
+
const person = probePath ? syncVersion("pi", {}, [], { HOME, PATH }).verdict.version : undefined;
|
|
44
|
+
const pinned = readPiPin(COMPAT.pi.verified)?.version;
|
|
45
|
+
const latest = newestVerifiedPiVersion();
|
|
46
|
+
return { detail: `PATH Pi ${person ?? "unknown"}, hub-pinned Pi ${pinned ?? "none"}, newest verified ${latest}`,
|
|
47
|
+
...(pinned !== latest ? { command: `ahub agents install pi ${latest}` } : {}) };
|
|
36
48
|
}
|
|
37
49
|
|
|
38
50
|
const PROBE_OUTPUT_CAP = 64 * 1024;
|
|
@@ -106,7 +118,7 @@ export function runAgents(args: string[], commands: Partial<Record<CompatId, rea
|
|
|
106
118
|
print(receipt);
|
|
107
119
|
return;
|
|
108
120
|
}
|
|
109
|
-
if (sub !== undefined) fail("usage: ahub agents [--json] | ahub agents --latest [--json] | ahub agents trust <id> <version> [--revoke] | ahub agents presets [--json] | ahub agents add <preset> [--as <kind>] [--pull]");
|
|
121
|
+
if (sub !== undefined) fail("usage: ahub agents [--json] | ahub agents --latest [--json] | ahub agents install pi [<version>] | ahub agents trust <id> <version> [--revoke] | ahub agents presets [--json] | ahub agents add <preset> [--as <kind>] [--pull]");
|
|
110
122
|
const rows = agentVersions(commands);
|
|
111
123
|
if (args.includes("--json")) return console.log(JSON.stringify(rows.map(row => ({ id: row.id, executable: row.executable ?? null, ...row.verdict, policy: row.policy })), null, 2));
|
|
112
124
|
print(new Report(columns, ascii).append(renderAgents(rows, columns, ascii)));
|
package/src/cli/agy-mcp.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { shellQuote } from "../primitives.ts";
|
|
1
2
|
import { AGY_DEFINITION } from "../adapters/agy/definition.ts";
|
|
2
3
|
import type { Stats } from "node:fs";
|
|
3
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -42,7 +43,6 @@ function parseJson(bytes: Buffer, name: string): JsonObject {
|
|
|
42
43
|
try { return jsonFile(JSON.parse(bytes.toString("utf8")), name); }
|
|
43
44
|
catch (error) { if (error instanceof SyntaxError) throw new Error(`${name} is invalid JSON`); throw error; }
|
|
44
45
|
}
|
|
45
|
-
function shellQuote(value: string): string { return `'${value.replace(/'/g, `'\\''`)}'`; }
|
|
46
46
|
function shellUnquote(value: string): string | undefined {
|
|
47
47
|
if (!value.startsWith("'") || !value.endsWith("'")) return undefined;
|
|
48
48
|
let out = "";
|
|
@@ -6,13 +6,13 @@ import { replaceJsonValue } from "./json-text-spans.ts";
|
|
|
6
6
|
import { shellQuote } from "./shell-quote.ts";
|
|
7
7
|
import { stableBunRuntime, stablePackageRoot } from "./install-paths.ts";
|
|
8
8
|
import type { ClaudeHome } from "./claude-homes.ts";
|
|
9
|
+
import { isRecord as object } from "../primitives.ts";
|
|
9
10
|
|
|
10
11
|
export interface ClaudeProfileHookOptions { script?: string; runtime?: string; instruction?: boolean }
|
|
11
12
|
export interface ClaudeProfileHookCheck { state: "installed" | "missing" | "refused"; reason: string; outdated?: true }
|
|
12
13
|
export interface ClaudeProfileHookInstall extends ClaudeProfileHookCheck { changed: boolean }
|
|
13
14
|
const MAX_SETTINGS_BYTES = 1024 * 1024;
|
|
14
15
|
const validPath = (value: unknown): value is string => typeof value === "string" && value.length > 0 && value.length <= 4096 && isAbsolute(value) && !/[\x00-\x1f\x7f]/.test(value);
|
|
15
|
-
const object = (value: unknown): value is Record<string, unknown> => !!value && typeof value === "object" && !Array.isArray(value);
|
|
16
16
|
const owned = (info: Stats) => !!process.getuid && info.uid === process.getuid() && (info.mode & 0o022) === 0;
|
|
17
17
|
const same = (left: Stats | undefined, right: Stats | undefined) => !left && !right || !!left && !!right && left.dev === right.dev && left.ino === right.ino;
|
|
18
18
|
|
package/src/cli/command-table.ts
CHANGED
|
@@ -25,6 +25,7 @@ const commandLoaders: Readonly<Partial<Record<string, Loader>>> = Object.freeze(
|
|
|
25
25
|
pet: () => import("./commands/pet.ts"),
|
|
26
26
|
roles: () => import("./commands/roles.ts"),
|
|
27
27
|
status: () => import("./commands/status.ts"),
|
|
28
|
+
"launch-line": () => import("./commands/launch-line.ts"),
|
|
28
29
|
logs: () => import("./commands/logs.ts"),
|
|
29
30
|
export: () => import("./commands/export.ts"),
|
|
30
31
|
bench: () => import("./commands/bench.ts"),
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { runAgents } from "../agents.ts";
|
|
2
|
+
import { renderLifecycleReceipt } from "../reset-output.ts";
|
|
2
3
|
import { runAgentsLatest } from "../agents-latest.ts";
|
|
3
4
|
import { runAgentsAdd, runAgentsPresets } from "../agents-presets.ts";
|
|
4
|
-
import { configuredCommands } from "../../adapters/compat.ts";
|
|
5
|
+
import { COMPAT, configuredCommands, newestVerifiedPiVersion } from "../../adapters/compat.ts";
|
|
5
6
|
import { loadConfig } from "../../hub/config.ts";
|
|
6
7
|
import type { CommandContext } from "../command-context.ts";
|
|
7
8
|
|
|
@@ -11,8 +12,24 @@ export function run(context: CommandContext) {
|
|
|
11
12
|
// #1809 T1: both forms are person-only through src/cli/identity.ts (any `agents` argument but --json); neither loads the project config.
|
|
12
13
|
if (args[0] === "presets") return runAgentsPresets(args.slice(1), fail);
|
|
13
14
|
if (args[0] === "add") return runAgentsAdd(args.slice(1), cwd, fail);
|
|
15
|
+
if (args[0] === "install") return installPi(args.slice(1), context);
|
|
14
16
|
const commands = configuredCommands(loadConfig(cwd));
|
|
15
17
|
// #1808 T5: the one network read, person-run (src/cli/identity.ts keeps an agent shell out of every `agents` form but a plain listing).
|
|
16
18
|
if (args.includes("--latest")) return runAgentsLatest(args, commands, fail);
|
|
17
19
|
return runAgents(args, commands, fail);
|
|
18
20
|
}
|
|
21
|
+
|
|
22
|
+
async function installPi(args: string[], { fail, printOutput }: CommandContext): Promise<void> {
|
|
23
|
+
const [kind, requested, ...rest] = args;
|
|
24
|
+
const version = requested ?? newestVerifiedPiVersion();
|
|
25
|
+
if (kind !== COMPAT.pi.probe[0] || rest.length || !(COMPAT.pi.verified as readonly string[]).includes(version)) {
|
|
26
|
+
fail(`usage: ahub agents install pi [<verified-version>] (verified: ${COMPAT.pi.verified.join(", ")})`);
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
const { installPinnedPi } = await import("../../pi/install.ts");
|
|
30
|
+
const pinned = await installPinnedPi(version);
|
|
31
|
+
printOutput(renderLifecycleReceipt({ title: "Pi install", lines: [`Pi ${pinned.version} pinned at ${pinned.command}`] }), false);
|
|
32
|
+
} catch {
|
|
33
|
+
fail(`Pi ${version} install could not be verified. Check the registry and matching install files, then retry with ahub agents install pi ${version}.`);
|
|
34
|
+
}
|
|
35
|
+
}
|