@staix/agent-hub 0.50.0 → 0.52.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 +51 -0
- package/README.md +1 -1
- package/docs/adding-an-ai-tool.md +26 -4
- package/docs/agent-notes/README.md +1 -0
- package/docs/agent-notes/adapters.md +4 -3
- package/docs/agent-notes/budget.md +8 -2
- package/docs/agent-notes/daemon.md +13 -8
- package/docs/agent-notes/local-worker.md +3 -3
- package/docs/agent-notes/security-review.md +6 -5
- package/docs/agent-notes/tasks.md +10 -3
- package/docs/agent-notes/tests.md +4 -3
- package/docs/cooperbench.md +1 -1
- package/docs/design/adapters.md +21 -0
- package/docs/design/cli-output-inventory.md +165 -150
- package/docs/design/cli-output.md +4 -3
- package/docs/design/guidance-probes.md +1 -0
- package/docs/design/roadmap.md +3 -1
- package/docs/design/task-board.md +35 -0
- package/docs/dogfood.md +21 -3
- package/docs/events.md +4 -2
- package/docs/memory.md +5 -3
- package/docs/operations.md +259 -19
- package/docs/quickstart.md +29 -2
- package/docs/roadmap.json +20 -20
- package/docs/roadmap.md +2 -2
- package/docs/roles.md +1 -1
- package/docs/sdlc.md +29 -5
- package/docs/security.md +11 -5
- package/docs/specs/2026-09-19-agent-hub-design.md +44 -0
- package/docs/specs/2026-09-19-multi-project-design.md +4 -0
- package/docs/specs/2026-09-20-upgrade-recovery-design.md +17 -0
- package/docs/specs/mcp-endpoint.md +63 -0
- package/docs/verification/2026-11-29-agy-1.5.20.md +33 -0
- package/docs/verification/2026-11-29-claude-profile-hook.md +12 -0
- package/docs/verification/2026-11-29-idle-daemon-footprint.md +75 -0
- package/docs/verification/2026-11-29-kimi-281-reviewer-compat.md +38 -0
- package/docs/verification/2026-11-29-kimi-tui-281.md +12 -0
- package/docs/verification/2026-11-30-0.51.0.md +91 -0
- package/docs/verification/2026-11-30-account-switch-1806.md +445 -0
- package/docs/verification/2026-11-30-capability-listing-shape-1808.md +45 -0
- package/docs/verification/2026-11-30-upgrade-keep-1807.md +174 -0
- package/docs/verification/2026-12-01-1811-confirmation-receipt.md +19 -0
- package/docs/verification/2026-12-01-1811-orca-agent-list.md +20 -0
- package/docs/verification/2026-12-01-1811-orca-pane-key.md +21 -0
- package/docs/verification/2026-12-02-1819-claude-process-after-renewal.md +54 -0
- package/docs/verification/2026-12-02-agy-1.5.21.md +74 -0
- package/docs/verification/2026-12-02-claude-implementer-2.1.334.md +44 -0
- package/docs/verification/2026-12-02-cli-import-graph.md +33 -0
- package/docs/verification/2026-12-03-0.52.0.md +150 -0
- package/docs/verification/2026-12-03-codex-0173-reviewer-isolation.md +53 -0
- package/docs/verification/2026-12-03-codex-0173-reviewer-tool-call.md +34 -0
- package/docs/verification/2026-12-03-jcode-1.3.0.md +25 -0
- package/docs/verification/agy/README.md +17 -0
- package/docs/verification/agy/cli-surface.ts +68 -0
- package/docs/verification/agy/interactive-bridge.ts +92 -0
- package/docs/verification/agy/interactive-session.ts +131 -0
- package/docs/verification/agy/launcher-nonce.ts +215 -0
- package/docs/verification/agy/native-hooks.ts +210 -0
- package/docs/verification/agy/originals/agent-hub-681/cli-surface.ts +87 -0
- package/docs/verification/agy/originals/agent-hub-681/native-hooks-adapted.ts +91 -0
- package/docs/verification/agy/originals/agent-hub-681/tui-actual.ts +200 -0
- package/docs/verification/agy/originals/agent-hub-684/probe.ts +107 -0
- package/docs/verification/agy/originals.json +25 -0
- package/docs/verification/agy/permission-new-functions.ts +128 -0
- package/docs/verification/agy/run-probe.py +108 -0
- package/docs/verification/agy/runtime.ts +171 -0
- package/docs/verification/agy/tmux-helper-control.ts +6 -0
- package/docs/verification/agy/tmux-session.ts +235 -0
- package/docs/verified.json +87 -42
- package/package.json +3 -3
- package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
- package/plugins/agent-hub/compat.json +157 -0
- package/plugins/agent-hub/kimi-hook.js +1416 -24985
- package/plugins/agent-hub/server.js +17415 -32755
- package/scripts/check-docs.mjs +1 -1
- package/src/adapters/acp.ts +13 -13
- package/src/adapters/agy/definition.ts +9 -26
- package/src/adapters/agy/entry.ts +2 -0
- package/src/adapters/channel-peer.ts +3 -1
- package/src/adapters/claude-channel-evidence.ts +7 -3
- package/src/adapters/claude-channel.ts +38 -257
- package/src/adapters/claude-implementer.ts +3 -1
- package/src/adapters/codex-appserver.ts +77 -15
- package/src/adapters/compat.ts +78 -14
- package/src/adapters/configured-acp.ts +23 -163
- package/src/adapters/configured-adapter-policy.ts +160 -0
- package/src/adapters/configured-pull-entry.ts +53 -0
- package/src/adapters/configured-pull.ts +38 -0
- package/src/adapters/conformance/fakes/app-server.ts +9 -2
- package/src/adapters/declaration-catalog.ts +25 -0
- package/src/adapters/declaration-data.ts +342 -0
- package/src/adapters/declaration-resolution.ts +53 -0
- package/src/adapters/definitions/builtin-metadata.ts +62 -84
- package/src/adapters/definitions/jcode-launch.ts +13 -0
- package/src/adapters/definitions/native-adapter-policy.ts +390 -0
- package/src/adapters/definitions/native-cli-claude-launch.ts +6 -3
- package/src/adapters/definitions/native-cli-codex-launch.ts +2 -1
- package/src/adapters/definitions/native-cli-entry-claude.ts +17 -2
- package/src/adapters/definitions/native-cli-entry-codex.ts +2 -0
- package/src/adapters/definitions/native-cli-entry-jcode.ts +6 -2
- package/src/adapters/definitions/native-cli-entry-kimi.ts +2 -0
- package/src/adapters/definitions/native-cli-entry-pi.ts +2 -0
- package/src/adapters/definitions/native-cli-entry-qwen.ts +2 -0
- package/src/adapters/definitions/native-cli-entry-types.ts +12 -3
- package/src/adapters/definitions/native-cli-jcode-home-init.ts +1 -1
- package/src/adapters/definitions/native-cli-launch-common.ts +2 -2
- package/src/adapters/definitions/native-cli-preview-common.ts +1 -1
- package/src/adapters/definitions/native-cli-retained.ts +1 -1
- package/src/adapters/definitions/native-config-defaults.ts +1 -1
- package/src/adapters/definitions/native-configuration.ts +18 -0
- package/src/adapters/definitions/native-help.ts +24 -0
- package/src/adapters/definitions/native-launch-declarations.ts +34 -0
- package/src/adapters/definitions/native-launch-policy.ts +4 -0
- package/src/adapters/definitions/native-launch-settings.ts +72 -0
- package/src/adapters/definitions/native-light-cli.ts +18 -0
- package/src/adapters/definitions/native-light-preview.ts +10 -0
- package/src/adapters/definitions/native-wrapper-launch.ts +10 -0
- package/src/adapters/definitions/qwen.ts +6 -29
- package/src/adapters/definitions/reviewer-variants.ts +7 -8
- package/src/adapters/external-declarations.ts +31 -0
- package/src/adapters/external-modules.ts +4 -29
- package/src/adapters/jcode.ts +19 -12
- package/src/adapters/native-capabilities.ts +18 -8
- package/src/adapters/native-facts-hooks.ts +12 -0
- package/src/adapters/native-proof-ports.ts +1 -1
- package/src/adapters/presets.ts +136 -0
- package/src/adapters/qwen-dual.ts +2 -2
- package/src/adapters/registry-types.ts +3 -0
- package/src/adapters/registry.ts +20 -81
- package/src/adapters/reviewer-print.ts +26 -9
- package/src/adapters/role-eligibility.ts +2 -1
- package/src/cli/accounts-import.ts +72 -0
- package/src/cli/agents-latest-table.ts +88 -0
- package/src/cli/agents-latest.ts +22 -0
- package/src/cli/agents-output.ts +10 -0
- package/src/cli/agents-presets.ts +100 -0
- package/src/cli/agents.ts +1 -1
- package/src/cli/attention.ts +3 -2
- package/src/cli/autonomy-homes.ts +7 -2
- package/src/cli/autonomy-offline.ts +1 -1
- package/src/cli/bench.ts +1 -1
- package/src/cli/budget-renew-guidance.ts +129 -0
- package/src/cli/claude-homes.ts +9 -5
- package/src/cli/claude-profile-hook.ts +31 -11
- package/src/cli/command-context.ts +3 -0
- package/src/cli/command-table.ts +123 -0
- package/src/cli/commands/accounts.ts +8 -0
- package/src/cli/commands/agents.ts +18 -0
- package/src/cli/commands/answer.ts +28 -0
- package/src/cli/commands/ask.ts +17 -0
- package/src/cli/commands/autonomy.ts +83 -0
- package/src/cli/commands/backlog.ts +46 -0
- package/src/cli/commands/bench.ts +60 -0
- package/src/cli/commands/board.ts +48 -0
- package/src/cli/commands/broker.ts +9 -0
- package/src/cli/commands/budget.ts +96 -0
- package/src/cli/commands/capabilities.ts +12 -0
- package/src/cli/commands/check-path.ts +55 -0
- package/src/cli/commands/completion.ts +8 -0
- package/src/cli/commands/console.ts +12 -0
- package/src/cli/commands/daemon.ts +8 -0
- package/src/cli/commands/deliverables.ts +25 -0
- package/src/cli/commands/doctor.ts +249 -0
- package/src/cli/commands/down.ts +3 -0
- package/src/cli/commands/export.ts +15 -0
- package/src/cli/commands/facts.ts +15 -0
- package/src/cli/commands/goal.ts +22 -0
- package/src/cli/commands/guidance.ts +102 -0
- package/src/cli/commands/help.ts +17 -0
- package/src/cli/commands/host.ts +45 -0
- package/src/cli/commands/init.ts +121 -0
- package/src/cli/commands/instructed.ts +19 -0
- package/src/cli/commands/instruction-hook.ts +15 -0
- package/src/cli/commands/intake.ts +24 -0
- package/src/cli/commands/kill.ts +15 -0
- package/src/cli/commands/learn.ts +23 -0
- package/src/cli/commands/lineage.ts +30 -0
- package/src/cli/commands/logs.ts +21 -0
- package/src/cli/commands/manager.ts +15 -0
- package/src/cli/commands/memory.ts +21 -0
- package/src/cli/commands/model.ts +25 -0
- package/src/cli/commands/models.ts +40 -0
- package/src/cli/commands/native.ts +39 -0
- package/src/cli/commands/pause.ts +5 -0
- package/src/cli/commands/peer.ts +32 -0
- package/src/cli/commands/permission.ts +26 -0
- package/src/cli/commands/permit.ts +12 -0
- package/src/cli/commands/pet.ts +24 -0
- package/src/cli/commands/projects.ts +49 -0
- package/src/cli/commands/queue.ts +70 -0
- package/src/cli/commands/recovery-run.ts +13 -0
- package/src/cli/commands/recovery.ts +130 -0
- package/src/cli/commands/release.ts +23 -0
- package/src/cli/commands/releases.ts +91 -0
- package/src/cli/commands/remember.ts +6 -0
- package/src/cli/commands/report.ts +27 -0
- package/src/cli/commands/research.ts +53 -0
- package/src/cli/commands/reset.ts +89 -0
- package/src/cli/commands/restart.ts +5 -0
- package/src/cli/commands/results.ts +31 -0
- package/src/cli/commands/resume.ts +5 -0
- package/src/cli/commands/review.ts +24 -0
- package/src/cli/commands/roadmap.ts +21 -0
- package/src/cli/commands/role.ts +34 -0
- package/src/cli/commands/roles.ts +30 -0
- package/src/cli/commands/room.ts +14 -0
- package/src/cli/commands/roster.ts +48 -0
- package/src/cli/commands/route.ts +9 -0
- package/src/cli/commands/say.ts +21 -0
- package/src/cli/commands/schedule.ts +17 -0
- package/src/cli/commands/sdlc.ts +321 -0
- package/src/cli/commands/settings.ts +148 -0
- package/src/cli/commands/setup.ts +89 -0
- package/src/cli/commands/shared-refusals.ts +25 -0
- package/src/cli/commands/smoke.ts +44 -0
- package/src/cli/commands/source.ts +64 -0
- package/src/cli/commands/specs.ts +13 -0
- package/src/cli/commands/status.ts +28 -0
- package/src/cli/commands/stop.ts +17 -0
- package/src/cli/commands/structure.ts +60 -0
- package/src/cli/commands/study.ts +39 -0
- package/src/cli/commands/tail.ts +19 -0
- package/src/cli/commands/task.ts +114 -0
- package/src/cli/commands/title.ts +17 -0
- package/src/cli/commands/turns.ts +10 -0
- package/src/cli/commands/ui.ts +47 -0
- package/src/cli/commands/undo.ts +77 -0
- package/src/cli/commands/up.ts +39 -0
- package/src/cli/commands/upgrade.ts +5 -0
- package/src/cli/commands/usage.ts +33 -0
- package/src/cli/commands/version.ts +5 -0
- package/src/cli/commands/watch.ts +30 -0
- package/src/cli/commands/worktrees.ts +31 -0
- package/src/cli/conductor-recovery.ts +1 -1
- package/src/cli/console-state.ts +5 -138
- package/src/cli/console-versions.ts +1 -1
- package/src/cli/facts-hook.ts +11 -4
- package/src/cli/help.ts +44 -20
- package/src/cli/identity.ts +27 -4
- package/src/cli/init-prompt.ts +1 -1
- package/src/cli/init-settings.ts +4 -35
- package/src/cli/init.ts +1 -1
- package/src/cli/json-text-spans.ts +57 -0
- package/src/cli/launch-check.ts +156 -0
- package/src/cli/launch.ts +19 -70
- package/src/cli/light-dispatch.ts +29 -0
- package/src/cli/main.js +8 -1
- package/src/cli/main.ts +257 -2799
- package/src/cli/memory.ts +1 -1
- package/src/cli/orca-probe.ts +119 -0
- package/src/cli/output.ts +45 -3
- package/src/cli/preview.ts +11 -6
- package/src/cli/recovery-launch.ts +1 -1
- package/src/cli/recovery-version-preflight.ts +28 -9
- package/src/cli/replace-process.ts +22 -0
- package/src/cli/report-layout.ts +142 -0
- package/src/cli/roadmap-usage.ts +16 -0
- package/src/cli/roadmap.ts +3 -16
- package/src/cli/sdlc-doctor.ts +27 -0
- package/src/cli/sdlc-output.ts +55 -1
- package/src/cli/setup-homes.ts +2 -2
- package/src/cli/start-agents-run.ts +85 -7
- package/src/cli/start-check.ts +28 -0
- package/src/cli/statusline-tee.ts +25 -4
- package/src/cli/terminal-recovery.ts +53 -10
- package/src/cli/upgrade-interactive.ts +1 -0
- package/src/cli/upgrade-runtime.ts +12 -1
- package/src/cli/upgrade.ts +4 -15
- package/src/cli/warn-line.ts +1 -1
- package/src/hub/accounts.ts +148 -0
- package/src/hub/addons.ts +20 -0
- package/src/hub/agent-drift.ts +2 -1
- package/src/hub/budget-projection.ts +39 -7
- package/src/hub/budget.ts +231 -16
- package/src/hub/channel-project.ts +3 -3
- package/src/hub/ci-watch.ts +311 -79
- package/src/hub/conductor-peer.ts +24 -0
- package/src/hub/conductor.ts +2 -21
- package/src/hub/config-apply.ts +25 -14
- package/src/hub/config-edit.ts +1 -1
- package/src/hub/config-tier.ts +2 -0
- package/src/hub/config.ts +535 -0
- package/src/hub/control-client.ts +49 -1
- package/src/hub/daemon.ts +492 -569
- package/src/hub/delivery-public.ts +11 -0
- package/src/hub/events.ts +3 -0
- package/src/hub/home-tag.ts +12 -0
- package/src/hub/host.ts +217 -0
- package/src/hub/hub-check.ts +125 -0
- package/src/hub/hub-tools.ts +2 -1
- package/src/hub/instance-budget.ts +2 -2
- package/src/hub/instance-config.ts +15 -126
- package/src/hub/instances.ts +22 -6
- package/src/hub/instruction-receipt.ts +2 -2
- package/src/hub/kimi-usage.ts +38 -11
- package/src/hub/lifecycle.ts +86 -4
- package/src/hub/mcp-bridge-core.ts +98 -0
- package/src/hub/mcp-channel-push.ts +20 -0
- package/src/hub/mcp-endpoint-serve.ts +178 -0
- package/src/hub/mcp-endpoint.ts +226 -0
- package/src/hub/mcp-tool-call.ts +181 -0
- package/src/hub/operational-settings.ts +2 -0
- package/src/hub/orca-env.ts +6 -0
- package/src/hub/orca-state.ts +84 -0
- package/src/hub/path-policy.ts +1 -1
- package/src/hub/peers.ts +5 -1
- package/src/hub/permission-mode.ts +5 -41
- package/src/hub/permission-paths.ts +41 -0
- package/src/hub/project.ts +20 -0
- package/src/hub/protocol-window.ts +58 -0
- package/src/hub/quota-origin.ts +20 -0
- package/src/hub/recovery-policy.ts +1 -1
- package/src/hub/registry.ts +36 -2
- package/src/hub/releases-inventory.ts +198 -0
- package/src/hub/report.ts +1 -1
- package/src/hub/research.ts +1 -1
- package/src/hub/review-brief.ts +47 -2
- package/src/hub/roster.ts +6 -3
- package/src/hub/routing.ts +9 -2
- package/src/hub/runtime-capture-prune.ts +25 -3
- package/src/hub/runtime-prune-health.ts +8 -1
- package/src/hub/sdlc-check.ts +205 -0
- package/src/hub/sdlc-release-authorization.ts +42 -21
- package/src/hub/sdlc-release-diagnostics.ts +5 -0
- package/src/hub/sdlc-release-policy.ts +21 -7
- package/src/hub/sdlc-release.ts +80 -20
- package/src/hub/sdlc-sync.ts +146 -0
- package/src/hub/sdlc.ts +38 -5
- package/src/hub/settings.ts +7 -4
- package/src/hub/start-agents.ts +1 -1
- package/src/hub/start-mode.ts +11 -4
- package/src/hub/structure-budget.ts +131 -0
- package/src/hub/structure-scan.ts +149 -0
- package/src/hub/tasks-experiment.ts +455 -0
- package/src/hub/tasks-guidance.ts +606 -0
- package/src/hub/tasks-roadmap-plan.ts +419 -0
- package/src/hub/tasks-roadmap.ts +491 -0
- package/src/hub/tasks-study.ts +661 -0
- package/src/hub/tasks-survey.ts +192 -0
- package/src/hub/tasks.ts +457 -2584
- package/src/hub/terminal-open.ts +5 -3
- package/src/hub/tooling.ts +3 -19
- package/src/hub/usage-rollup.ts +9 -3
- package/src/local/tools.ts +5 -0
- package/src/ui/index.html +1 -1
- package/src/ui/needs.ts +17 -5
- package/src/ui/peer-palette.ts +2 -4
- package/src/ui/plugin.ts +1 -1
- package/templates/presets/agents.json +60 -0
- package/templates/presets/confirmation-matrix.json +8 -8
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
import type { AdapterDefinition } from "../registry-types.ts";
|
|
2
|
+
import { compareNativeRank, isBuiltinAdapterKind, NATIVE_CLI_HELP } from "./native-help.ts";
|
|
3
|
+
|
|
4
|
+
const implementerRoles = Object.freeze(["implementer", "verifier"]);
|
|
5
|
+
export const dualForms = Object.freeze(["tui", "headless"] as const);
|
|
6
|
+
const headlessForms = Object.freeze(["headless"] as const);
|
|
7
|
+
const hubGrants = {
|
|
8
|
+
ask: "every write, edit and shell command asks",
|
|
9
|
+
"ask-when-needed": "write, edit and proven bounded read-only shell commands inside the project run without asking; other shell commands and git writes still ask",
|
|
10
|
+
"never-ask": "every tool runs without asking, inside the hub sandbox and path guard",
|
|
11
|
+
};
|
|
12
|
+
type Policy = {
|
|
13
|
+
headlessFactory: boolean;
|
|
14
|
+
metadata: Pick<AdapterDefinition, "api" | "kind" | "projection" | "displayName" | "family" | "transport" | "roles"
|
|
15
|
+
| "optional" | "defaultOnRoster" | "trust" | "enabledSwitchStartOnly" | "identity" | "instances" | "permission">;
|
|
16
|
+
start?: Partial<Pick<AdapterDefinition["start"], "forms" | "defaultForm" | "daemonPort" | "conductorStartable"
|
|
17
|
+
| "upStart" | "unattended" | "hubSwitches" | "ownedFlags" | "explicitHeadlessMode" | "refreshTools"
|
|
18
|
+
| "reconfigureWhileAttached" | "autoStart" | "exclusiveStartRefusal">>;
|
|
19
|
+
cli: Pick<AdapterDefinition["cli"], "command" | "usage" | "authority" | "personOnlyFlags"
|
|
20
|
+
| "launchConfigKeys" | "previewArgs" | "startWords">;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** Builtin facts. Only the executable definitions bind launch ports and establish identity. */
|
|
24
|
+
export const NATIVE_ADAPTER_POLICY = {
|
|
25
|
+
claudeReviewer: {
|
|
26
|
+
headlessFactory: true,
|
|
27
|
+
metadata: {
|
|
28
|
+
api: 1,
|
|
29
|
+
kind: "claude",
|
|
30
|
+
displayName: "Claude Code reviewer",
|
|
31
|
+
family: "claude",
|
|
32
|
+
transport: "hub-native",
|
|
33
|
+
roles: Object.freeze(["reviewer"]),
|
|
34
|
+
defaultOnRoster: true,
|
|
35
|
+
trust: { onPrem: false, hubSandboxed: false },
|
|
36
|
+
identity: { mcp: "env" },
|
|
37
|
+
instances: { mode: "headless" },
|
|
38
|
+
permission: { unmanaged: "each review runs read-only (Read, Grep, Glob) and may call only hub_review and hub_task_show" },
|
|
39
|
+
},
|
|
40
|
+
start: {
|
|
41
|
+
daemonPort: "claude-print",
|
|
42
|
+
forms: headlessForms,
|
|
43
|
+
defaultForm: "headless",
|
|
44
|
+
conductorStartable: true,
|
|
45
|
+
hubSwitches: [],
|
|
46
|
+
ownedFlags: [],
|
|
47
|
+
},
|
|
48
|
+
cli: {
|
|
49
|
+
command: "claude",
|
|
50
|
+
startWords: () => ["claude"],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
claudeImplementer: {
|
|
54
|
+
headlessFactory: true,
|
|
55
|
+
metadata: {
|
|
56
|
+
api: 1,
|
|
57
|
+
kind: "claude",
|
|
58
|
+
displayName: "Claude Code implementer",
|
|
59
|
+
family: "claude",
|
|
60
|
+
transport: "hub-native",
|
|
61
|
+
roles: Object.freeze(["implementer"]),
|
|
62
|
+
defaultOnRoster: true,
|
|
63
|
+
trust: { onPrem: false, hubSandboxed: false },
|
|
64
|
+
identity: { mcp: "env", currentChild: true },
|
|
65
|
+
instances: { mode: "headless", roles: ["implementer", "verifier"], modelSelect: true },
|
|
66
|
+
permission: { grants: { ask: "every write, edit and shell command asks", "ask-when-needed": "file tools, proven read-only shell commands and bound task commands inside the owned worktree may run automatically; protected paths and other commands ask" } },
|
|
67
|
+
},
|
|
68
|
+
start: {
|
|
69
|
+
daemonPort: "claude-implementer",
|
|
70
|
+
forms: headlessForms,
|
|
71
|
+
defaultForm: "headless",
|
|
72
|
+
conductorStartable: true,
|
|
73
|
+
hubSwitches: [],
|
|
74
|
+
ownedFlags: [],
|
|
75
|
+
},
|
|
76
|
+
cli: {
|
|
77
|
+
command: "claude",
|
|
78
|
+
startWords: () => ["claude"],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
claude: {
|
|
82
|
+
headlessFactory: false,
|
|
83
|
+
metadata: {
|
|
84
|
+
projection: { roleRank: 0, helpRank: NATIVE_CLI_HELP.claude.projection.helpRank, plannerEligible: true, conductorEligible: true, reviewerEligible: true },
|
|
85
|
+
api: 1,
|
|
86
|
+
kind: NATIVE_CLI_HELP.claude.kind,
|
|
87
|
+
displayName: "Claude Code",
|
|
88
|
+
family: "claude",
|
|
89
|
+
transport: "claude-channel",
|
|
90
|
+
roles: Object.freeze(["planner", "reviewer"]),
|
|
91
|
+
defaultOnRoster: true,
|
|
92
|
+
trust: { onPrem: false, hubSandboxed: false },
|
|
93
|
+
identity: { mcp: "channel-plugin" },
|
|
94
|
+
instances: NATIVE_CLI_HELP.claude.instances,
|
|
95
|
+
permission: { grants: { ask: "Claude's own permission rules decide",
|
|
96
|
+
"ask-when-needed": "file tools on project files run without asking, outside .agenthub, .git and agent configuration; other tools keep Claude's own rules",
|
|
97
|
+
"never-ask": "every tool runs without asking" } },
|
|
98
|
+
},
|
|
99
|
+
start: {
|
|
100
|
+
forms: Object.freeze(["tui"] as const),
|
|
101
|
+
defaultForm: "tui",
|
|
102
|
+
conductorStartable: true,
|
|
103
|
+
upStart: { allowed: true, default: true },
|
|
104
|
+
},
|
|
105
|
+
cli: {
|
|
106
|
+
command: "claude",
|
|
107
|
+
usage: NATIVE_CLI_HELP.claude.cli.usage,
|
|
108
|
+
startWords: () => ["claude"],
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
codex: {
|
|
112
|
+
headlessFactory: true,
|
|
113
|
+
metadata: {
|
|
114
|
+
projection: { roleRank: 1, startRank: 1, helpRank: NATIVE_CLI_HELP.codex.projection.helpRank, plannerEligible: true, conductorEligible: true, reviewerEligible: true },
|
|
115
|
+
api: 1,
|
|
116
|
+
kind: NATIVE_CLI_HELP.codex.kind,
|
|
117
|
+
displayName: "Codex",
|
|
118
|
+
family: "codex",
|
|
119
|
+
transport: "codex-appserver",
|
|
120
|
+
roles: Object.freeze(["implementer"]),
|
|
121
|
+
defaultOnRoster: true,
|
|
122
|
+
trust: { onPrem: false, hubSandboxed: false },
|
|
123
|
+
identity: { mcp: "env" },
|
|
124
|
+
instances: NATIVE_CLI_HELP.codex.instances,
|
|
125
|
+
permission: { trackUnattended: true, grants: { ask: "the session's own approval policy applies again", "ask-when-needed": "approval policy on-request on every turn", "never-ask": "approval policy never on every turn: nothing asks" } },
|
|
126
|
+
},
|
|
127
|
+
start: {
|
|
128
|
+
daemonPort: "codex-appserver",
|
|
129
|
+
forms: dualForms,
|
|
130
|
+
defaultForm: "tui",
|
|
131
|
+
conductorStartable: true,
|
|
132
|
+
upStart: { allowed: true, default: true },
|
|
133
|
+
},
|
|
134
|
+
cli: {
|
|
135
|
+
command: "codex",
|
|
136
|
+
usage: NATIVE_CLI_HELP.codex.cli.usage,
|
|
137
|
+
launchConfigKeys: ["codex_bin"],
|
|
138
|
+
startWords: () => ["codex"],
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
kimi: {
|
|
142
|
+
headlessFactory: true,
|
|
143
|
+
metadata: {
|
|
144
|
+
projection: { roleRank: 2, startRank: 2, helpRank: NATIVE_CLI_HELP.kimi.projection.helpRank, plannerEligible: true, conductorEligible: false, reviewerEligible: true },
|
|
145
|
+
api: 1,
|
|
146
|
+
kind: NATIVE_CLI_HELP.kimi.kind,
|
|
147
|
+
displayName: "Kimi Code",
|
|
148
|
+
family: "kimi",
|
|
149
|
+
transport: "acp",
|
|
150
|
+
roles: implementerRoles,
|
|
151
|
+
defaultOnRoster: true,
|
|
152
|
+
trust: { onPrem: false, hubSandboxed: false },
|
|
153
|
+
identity: { mcp: "acp-session" },
|
|
154
|
+
instances: NATIVE_CLI_HELP.kimi.instances,
|
|
155
|
+
permission: { grants: { ask: "Kimi asks as it does on its own", "ask-when-needed": "Kimi's yolo mode: it asks only where it judges it must", "never-ask": "Kimi's auto mode: nothing asks" },
|
|
156
|
+
unmanagedForms: Object.freeze(["tui"] as const), unmanagedStatusNote: "Kimi approves tools in its own TUI; no hub permission mode", unmanagedNote: "Kimi approves tools and selects its permission mode in its own TUI; no hub permission mode" },
|
|
157
|
+
},
|
|
158
|
+
start: {
|
|
159
|
+
daemonPort: "acp", forms: dualForms, defaultForm: "tui", conductorStartable: true,
|
|
160
|
+
upStart: { allowed: true }, hubSwitches: [], ownedFlags: [],
|
|
161
|
+
},
|
|
162
|
+
cli: {
|
|
163
|
+
command: "kimi",
|
|
164
|
+
usage: NATIVE_CLI_HELP.kimi.cli.usage,
|
|
165
|
+
launchConfigKeys: ["kimi_cmd", "peers.kimi.start_mode"],
|
|
166
|
+
startWords: form => ["kimi", "--mode", form],
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
pi: {
|
|
170
|
+
headlessFactory: true,
|
|
171
|
+
metadata: {
|
|
172
|
+
projection: { roleRank: 4, startRank: 0, helpRank: NATIVE_CLI_HELP.pi.projection.helpRank, plannerEligible: false, conductorEligible: true, reviewerEligible: true },
|
|
173
|
+
api: 1,
|
|
174
|
+
kind: NATIVE_CLI_HELP.pi.kind,
|
|
175
|
+
enabledSwitchStartOnly: true,
|
|
176
|
+
displayName: "Pi",
|
|
177
|
+
family: "pi",
|
|
178
|
+
transport: "hub-native",
|
|
179
|
+
roles: implementerRoles,
|
|
180
|
+
defaultOnRoster: false,
|
|
181
|
+
trust: { onPrem: false, hubSandboxed: true },
|
|
182
|
+
identity: { mcp: "env" },
|
|
183
|
+
instances: NATIVE_CLI_HELP.pi.instances,
|
|
184
|
+
permission: { grants: { ...hubGrants } },
|
|
185
|
+
},
|
|
186
|
+
start: {
|
|
187
|
+
exclusiveStartRefusal: "Pi start is in progress; inspect status before retrying",
|
|
188
|
+
refreshTools: true,
|
|
189
|
+
explicitHeadlessMode: true,
|
|
190
|
+
daemonPort: "pi-rpc",
|
|
191
|
+
forms: dualForms,
|
|
192
|
+
defaultForm: "tui",
|
|
193
|
+
conductorStartable: true,
|
|
194
|
+
upStart: { allowed: true },
|
|
195
|
+
autoStart: "pi.auto_start",
|
|
196
|
+
hubSwitches: [],
|
|
197
|
+
ownedFlags: [],
|
|
198
|
+
},
|
|
199
|
+
cli: {
|
|
200
|
+
command: "pi",
|
|
201
|
+
usage: NATIVE_CLI_HELP.pi.cli.usage,
|
|
202
|
+
launchConfigKeys: ["pi.cmd", "pi.backend", "pi.dgx_coding", "pi.dgx_fast", "pi.max_steps", "routing.pi", "peers.pi.start_mode"],
|
|
203
|
+
previewArgs: ["--mode", "tui"],
|
|
204
|
+
personOnlyFlags: ["--replace-session"],
|
|
205
|
+
startWords: form => ["pi", "--mode", form],
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
local: {
|
|
209
|
+
headlessFactory: true,
|
|
210
|
+
metadata: {
|
|
211
|
+
projection: { roleRank: 3, helpRank: NATIVE_CLI_HELP.local.projection.helpRank, plannerEligible: false, conductorEligible: false, reviewerEligible: true },
|
|
212
|
+
api: 1,
|
|
213
|
+
kind: NATIVE_CLI_HELP.local.kind,
|
|
214
|
+
displayName: "Local worker",
|
|
215
|
+
family: "local",
|
|
216
|
+
transport: "hub-native",
|
|
217
|
+
roles: implementerRoles,
|
|
218
|
+
defaultOnRoster: true,
|
|
219
|
+
trust: { onPrem: true, hubSandboxed: true },
|
|
220
|
+
identity: { mcp: "env" },
|
|
221
|
+
instances: NATIVE_CLI_HELP.local.instances,
|
|
222
|
+
permission: { grants: { ...hubGrants } },
|
|
223
|
+
},
|
|
224
|
+
start: {
|
|
225
|
+
reconfigureWhileAttached: true,
|
|
226
|
+
refreshTools: true,
|
|
227
|
+
daemonPort: "local-worker",
|
|
228
|
+
forms: headlessForms,
|
|
229
|
+
defaultForm: "headless",
|
|
230
|
+
conductorStartable: true,
|
|
231
|
+
upStart: { allowed: true },
|
|
232
|
+
hubSwitches: [],
|
|
233
|
+
ownedFlags: [],
|
|
234
|
+
},
|
|
235
|
+
cli: {
|
|
236
|
+
command: "local",
|
|
237
|
+
usage: NATIVE_CLI_HELP.local.cli.usage,
|
|
238
|
+
launchConfigKeys: ["local.deny", "local.bash_network", "local.network_allow", "local.max_steps", "local.read_allow", "routing.local"],
|
|
239
|
+
startWords: () => ["local"],
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
jcode: {
|
|
243
|
+
headlessFactory: true,
|
|
244
|
+
metadata: {
|
|
245
|
+
projection: { roleRank: 6, startRank: 3, helpRank: NATIVE_CLI_HELP.jcode.projection.helpRank, plannerEligible: true, conductorEligible: true, reviewerEligible: true },
|
|
246
|
+
api: 1,
|
|
247
|
+
kind: NATIVE_CLI_HELP.jcode.kind,
|
|
248
|
+
displayName: "Jcode",
|
|
249
|
+
family: "jcode",
|
|
250
|
+
transport: "acp",
|
|
251
|
+
roles: implementerRoles,
|
|
252
|
+
optional: true,
|
|
253
|
+
defaultOnRoster: false,
|
|
254
|
+
trust: { onPrem: false, hubSandboxed: false },
|
|
255
|
+
identity: { mcp: "project-file" },
|
|
256
|
+
instances: NATIVE_CLI_HELP.jcode.instances,
|
|
257
|
+
permission: { unmanaged: "Jcode native policy is unmanaged; no hub mode mapping", grants: {
|
|
258
|
+
ask: "no verified hub mode mapping; native policy only", "ask-when-needed": "no verified hub mode mapping; native policy only", "never-ask": "no verified hub mode mapping; native policy only" } },
|
|
259
|
+
},
|
|
260
|
+
start: {
|
|
261
|
+
daemonPort: "owned-acp",
|
|
262
|
+
forms: dualForms,
|
|
263
|
+
defaultForm: "tui",
|
|
264
|
+
explicitHeadlessMode: true,
|
|
265
|
+
conductorStartable: true,
|
|
266
|
+
upStart: { allowed: true },
|
|
267
|
+
hubSwitches: [],
|
|
268
|
+
ownedFlags: [],
|
|
269
|
+
},
|
|
270
|
+
cli: {
|
|
271
|
+
command: "jcode",
|
|
272
|
+
usage: NATIVE_CLI_HELP.jcode.cli.usage,
|
|
273
|
+
authority: "person",
|
|
274
|
+
launchConfigKeys: ["jcode_cmd", "jcode_home", "jcode_provider_profile"],
|
|
275
|
+
startWords: mode => ["jcode", "--mode", mode],
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
qwen: {
|
|
279
|
+
headlessFactory: true,
|
|
280
|
+
metadata: {
|
|
281
|
+
api: 1,
|
|
282
|
+
kind: NATIVE_CLI_HELP.qwen.kind,
|
|
283
|
+
projection: { roleRank: 5, helpRank: NATIVE_CLI_HELP.qwen.projection.helpRank, plannerEligible: true, conductorEligible: false, reviewerEligible: true },
|
|
284
|
+
displayName: "Qwen Code",
|
|
285
|
+
family: "qwen",
|
|
286
|
+
transport: "acp",
|
|
287
|
+
roles: ["implementer", "verifier"],
|
|
288
|
+
optional: true,
|
|
289
|
+
trust: { onPrem: false, hubSandboxed: false },
|
|
290
|
+
identity: { mcp: "acp-session" },
|
|
291
|
+
instances: NATIVE_CLI_HELP.qwen.instances,
|
|
292
|
+
permission: {
|
|
293
|
+
grants: {
|
|
294
|
+
ask: "every write, edit and shell command asks",
|
|
295
|
+
"ask-when-needed": "Qwen auto-edit approves file edits; shell commands ask; NO hub sandbox",
|
|
296
|
+
"never-ask": "Qwen yolo approves every tool; NO hub sandbox",
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
start: {
|
|
301
|
+
daemonPort: "acp",
|
|
302
|
+
forms: ["headless"],
|
|
303
|
+
defaultForm: "headless",
|
|
304
|
+
conductorStartable: true,
|
|
305
|
+
// #608: Qwen TUI is explicit only, so ahub up never starts it from the start set.
|
|
306
|
+
upStart: { allowed: false, refusal: "the hub never opens its TUI, and a Qwen is started only by ahub qwen" },
|
|
307
|
+
hubSwitches: [],
|
|
308
|
+
ownedFlags: [],
|
|
309
|
+
},
|
|
310
|
+
cli: {
|
|
311
|
+
command: "qwen",
|
|
312
|
+
usage: NATIVE_CLI_HELP.qwen.cli.usage,
|
|
313
|
+
launchConfigKeys: ["qwen_cmd"],
|
|
314
|
+
startWords: () => ["qwen"],
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
agy: {
|
|
318
|
+
headlessFactory: false,
|
|
319
|
+
metadata: {
|
|
320
|
+
api: 1,
|
|
321
|
+
kind: NATIVE_CLI_HELP.agy.kind,
|
|
322
|
+
projection: { roleRank: 7, helpRank: NATIVE_CLI_HELP.agy.projection.helpRank, plannerEligible: false, conductorEligible: false, reviewerEligible: false },
|
|
323
|
+
displayName: "Antigravity",
|
|
324
|
+
family: "agy",
|
|
325
|
+
transport: "ws-pull",
|
|
326
|
+
roles: ["implementer", "verifier"],
|
|
327
|
+
optional: true,
|
|
328
|
+
defaultOnRoster: false,
|
|
329
|
+
trust: { onPrem: false, hubSandboxed: false },
|
|
330
|
+
identity: { mcp: "channel-plugin" },
|
|
331
|
+
permission: {
|
|
332
|
+
unmanaged: "Antigravity selects its own permission mode in its TUI; no hub permission mode",
|
|
333
|
+
unmanagedForms: ["tui"],
|
|
334
|
+
unmanagedNote: "Antigravity approves tools in its own TUI; no hub permission mode",
|
|
335
|
+
unmanagedStatusNote: "unmanaged native permission policy",
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
start: {
|
|
339
|
+
forms: ["tui"],
|
|
340
|
+
defaultForm: "tui",
|
|
341
|
+
conductorStartable: false,
|
|
342
|
+
hubSwitches: [],
|
|
343
|
+
ownedFlags: ["--new", "--continue", "--conversation", "--resume"],
|
|
344
|
+
},
|
|
345
|
+
cli: {
|
|
346
|
+
command: "agy",
|
|
347
|
+
usage: NATIVE_CLI_HELP.agy.cli.usage,
|
|
348
|
+
authority: "person",
|
|
349
|
+
startWords: () => ["agy"],
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
} satisfies Record<string, Policy>;
|
|
353
|
+
|
|
354
|
+
/** Callers own their role arrays, independent of immutable native policy. */
|
|
355
|
+
export function defaultPeerRoles(includeOptional = false): Record<string, string[]> {
|
|
356
|
+
const rows = Object.keys(NATIVE_ADAPTER_POLICY).filter(isBuiltinAdapterKind)
|
|
357
|
+
.map(kind => NATIVE_ADAPTER_POLICY[kind].metadata as Policy["metadata"]);
|
|
358
|
+
return Object.fromEntries(rows.filter(row => includeOptional || !row.optional)
|
|
359
|
+
.sort((left, right) => compareNativeRank(left.projection?.roleRank, right.projection?.roleRank))
|
|
360
|
+
.map(row => [row.kind, [...row.roles]]));
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export const DEFAULT_ROLES: Record<string, string[]> = defaultPeerRoles(true);
|
|
364
|
+
|
|
365
|
+
export const NATIVE_FRESH_REVIEWER_FACTORY = Object.freeze({
|
|
366
|
+
codex: true,
|
|
367
|
+
kimi: true,
|
|
368
|
+
agy: false,
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
/** Fresh reviewer metadata does not carry its backend or a live factory. */
|
|
372
|
+
export function freshReviewerPolicy(kind: string, displayName: string, hasBackend: boolean) {
|
|
373
|
+
return {
|
|
374
|
+
api: 1, kind, family: kind, displayName, transport: "hub-native", roles: ["reviewer"],
|
|
375
|
+
defaultOnRoster: false, trust: { onPrem: false, hubSandboxed: false },
|
|
376
|
+
start: { ...(hasBackend ? { daemonPort: "reviewer-print" as const } : {}), forms: ["headless"], defaultForm: "headless",
|
|
377
|
+
conductorStartable: true, hubSwitches: [], ownedFlags: [] },
|
|
378
|
+
identity: { mcp: "env" }, instances: { mode: "headless" },
|
|
379
|
+
permission: { unmanaged: "fresh read-only reviewer; an isolation receipt is required before startup" },
|
|
380
|
+
cli: { command: kind, startWords: () => [] },
|
|
381
|
+
} satisfies Pick<AdapterDefinition, "api" | "kind" | "family" | "displayName" | "transport"
|
|
382
|
+
| "roles" | "defaultOnRoster" | "trust" | "start" | "identity" | "instances" | "permission" | "cli">;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export const NATIVE_WATCH_CAPABILITIES = Object.freeze({ watch: true });
|
|
386
|
+
export const NATIVE_ROUTING_POLICY = {
|
|
387
|
+
agy: { allowedRoles: NATIVE_ADAPTER_POLICY.agy.metadata.roles },
|
|
388
|
+
pi: { localAllowedRefusal: "local_allowed = false also excludes pi for this class", longContext: "backend-limit", preferredTier: true, handoffPriority: 0, trace: "backend", backendLabel: "pi" },
|
|
389
|
+
local: { localAllowedRefusal: "local_allowed = false for this class", longContext: "skip-owner", preferredTier: true, handoffPriority: 1, trace: "route" },
|
|
390
|
+
} satisfies Record<string, NonNullable<AdapterDefinition["routing"]>>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { CLAUDE_LAUNCH_POLICY } from "./native-launch-policy.ts";
|
|
1
2
|
import { mkdirSync, writeFileSync, renameSync, unlinkSync, readFileSync } from "node:fs";
|
|
2
3
|
import { randomUUID } from "node:crypto";
|
|
3
4
|
import { resolve, join } from "node:path";
|
|
4
|
-
import { CLAUDE_CHANNEL, sessionSettings, UNATTENDED_WARNING, type Launch } from "
|
|
5
|
+
import { CLAUDE_CHANNEL, sessionSettings, UNATTENDED_WARNING, type Launch } from "./native-launch-settings.ts";
|
|
5
6
|
import type { LaunchContext, LaunchPlan } from "../registry-types.ts";
|
|
6
7
|
import { nativeLaunchArguments, nativeLaunchPlan } from "./native-cli-launch-common.ts";
|
|
7
8
|
|
|
8
|
-
export
|
|
9
|
+
export { CLAUDE_LAUNCH_POLICY };
|
|
9
10
|
|
|
10
11
|
function claudeChannel(userArgs: string[]): string {
|
|
11
12
|
const bundle = resolve(import.meta.dir, "../../../plugins/agent-hub/server.js");
|
|
@@ -21,7 +22,9 @@ function claudeChannel(userArgs: string[]): string {
|
|
|
21
22
|
return CLAUDE_CHANNEL;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
export function claudeNativeLaunch(
|
|
25
|
+
export function claudeNativeLaunch(input: LaunchContext): LaunchPlan {
|
|
26
|
+
// #1798 T3: a preview shows what the interactive entry launches, so its hooks carry the session-start check the entry opts in to. A copy, never the caller's object.
|
|
27
|
+
const ctx: LaunchContext = input.preview && input.facts ? { ...input, facts: { ...input.facts, startCheck: true } } : input;
|
|
25
28
|
const { passthrough, unattended } = nativeLaunchArguments("claude", ctx, CLAUDE_LAUNCH_POLICY);
|
|
26
29
|
const build = (): Launch => {
|
|
27
30
|
// `--settings` takes one value, so a user-supplied one wins and Claude has no quota source for that session.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { CODEX_LAUNCH_POLICY } from "./native-launch-policy.ts";
|
|
1
2
|
import type { LaunchContext, LaunchPlan } from "../registry-types.ts";
|
|
2
3
|
import { nativeLaunchArguments, nativeLaunchPlan } from "./native-cli-launch-common.ts";
|
|
3
4
|
|
|
4
|
-
export
|
|
5
|
+
export { CODEX_LAUNCH_POLICY };
|
|
5
6
|
export function codexNativeLaunch(ctx: LaunchContext): LaunchPlan {
|
|
6
7
|
const { passthrough, unattended, warning } = nativeLaunchArguments("codex", ctx, CODEX_LAUNCH_POLICY);
|
|
7
8
|
if (!ctx.proxyUrl) throw new Error("codex proxy url is missing");
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { classifyClaudeParentCommand } from "../claude-channel-evidence.ts";
|
|
1
2
|
import { retainedLaunchWarning } from "./native-cli-retained.ts";
|
|
2
3
|
import { readFileSync } from "node:fs";
|
|
3
4
|
import { join } from "node:path";
|
|
@@ -5,6 +6,7 @@ import { randomUUID } from "node:crypto";
|
|
|
5
6
|
import type { ClaudeLaunchRecord } from "../../cli/launch.ts";
|
|
6
7
|
import type { NativeCliEntryContext } from "./native-cli-entry-types.ts";
|
|
7
8
|
import { claudeStateFile, isClaudeSessionUuid } from "../../hub/claude-state.ts";
|
|
9
|
+
import { claudeArgvNextStep, printLaunchCheck, readLaunchCheck } from "../../cli/launch-check.ts";
|
|
8
10
|
|
|
9
11
|
/** Preserve native selectors. A picker, continuation or fork without an explicit id stays unattested. */
|
|
10
12
|
function managedSession(nativeArgs: string[]): string | undefined {
|
|
@@ -21,7 +23,7 @@ function managedSession(nativeArgs: string[]): string | undefined {
|
|
|
21
23
|
if (options.some(arg => ["-c", "--continue", "--from-pr", "--teleport", "--fork-session"].some(flag => arg === flag || arg.startsWith(flag + "=")))) return;
|
|
22
24
|
if (resume.length) return resume.length === 1 && isClaudeSessionUuid(resume[0]) ? resume[0] : undefined;
|
|
23
25
|
const id = randomUUID();
|
|
24
|
-
nativeArgs.
|
|
26
|
+
nativeArgs.splice(options.length, 0, "--session-id", id);
|
|
25
27
|
return id;
|
|
26
28
|
}
|
|
27
29
|
|
|
@@ -74,6 +76,7 @@ export async function runClaudeEntry(ctx: NativeCliEntryContext): Promise<void>
|
|
|
74
76
|
}
|
|
75
77
|
// Turn-free facts and opted-in task sweeps share native PreToolUse/PostToolUse/Stop observations.
|
|
76
78
|
const facts = claudeObservationHooks(projectConfig(), { script: join(cliDir, "facts-hook.ts"), stateDir });
|
|
79
|
+
if (facts) facts.startCheck = true; // #1798 T3: the interactive entry alone opts in to the session-start Hub check
|
|
77
80
|
let previousLaunch: unknown;
|
|
78
81
|
try { previousLaunch = JSON.parse(readFileSync(join(stateDir, claudeStateFile("claude-launch", peer)), "utf8")); } catch { /* no previous managed launch */ }
|
|
79
82
|
const launch = buildLaunch("claude", args, { unattended: unattendedEnv, statusLine: { script: join(cliDir, "statusline-tee.ts"), stateDir, ...(original ? { original } : {}) }, ...(facts ? { facts } : {}) });
|
|
@@ -88,10 +91,22 @@ export async function runClaudeEntry(ctx: NativeCliEntryContext): Promise<void>
|
|
|
88
91
|
recordClaudeLaunch(stateDir, launchRecord);
|
|
89
92
|
cleanupStaleClaudeSettings(stateDir, previousLaunch);
|
|
90
93
|
}
|
|
94
|
+
// This foreground path always requests the development channel. Check the final argv after attestation.
|
|
95
|
+
let rejectedPosition: number | undefined;
|
|
96
|
+
const evidence = classifyClaudeParentCommand([launch.cmd, ...launch.args].join(" "), position => { rejectedPosition = position; });
|
|
97
|
+
if (evidence !== "development-channel-launch") {
|
|
98
|
+
const cause = rejectedPosition === undefined ? "command length or control characters" : `argv[${rejectedPosition}]`;
|
|
99
|
+
console.error(`Hub check failed for Claude channel (${evidence} at ${cause}). ${claudeArgvNextStep([launch.cmd, ...launch.args].join(" "), rejectedPosition)}`);
|
|
100
|
+
}
|
|
91
101
|
if (launch.warning) console.error(launch.warning);
|
|
102
|
+
// #1798 T3: the pre-launch Hub check runs inside runClaudeLaunch, just before the spawn. One read, one 3 s total deadline, no retry.
|
|
103
|
+
const beforeSpawn = async () => {
|
|
104
|
+
if (process.stderr.isTTY !== true) return; // nothing would print, so make no connection
|
|
105
|
+
printLaunchCheck({ hubCheck: await readLaunchCheck(timeoutMs => ctx.connectOnce(timeoutMs)) }, peer, ctx.definition, "tui");
|
|
106
|
+
};
|
|
92
107
|
const env = nativeLaunchEnv("claude", childEnv());
|
|
93
108
|
if (ctx.instance) env.AGENTHUB_PEER_ID = peer; // the channel plugin and the statusline tee write for this instance
|
|
94
|
-
result = await runClaudeLaunch(launch, { cwd: executionCwd, stateDir, env: { ...env, AGENTHUB_STATE_DIR: stateDir, AGENTHUB_PROJECT_DIR: cwd }, ...(launchRecord ? { record: launchRecord } : {}) });
|
|
109
|
+
result = await runClaudeLaunch(launch, { cwd: executionCwd, stateDir, env: { ...env, AGENTHUB_STATE_DIR: stateDir, AGENTHUB_PROJECT_DIR: cwd }, ...(launchRecord ? { record: launchRecord } : {}), beforeSpawn });
|
|
95
110
|
} finally {
|
|
96
111
|
cleanupClaudeSettings(stateDir, launch.settingsFile);
|
|
97
112
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { retainedLaunchWarning } from "./native-cli-retained.ts";
|
|
2
|
+
import { printLaunchCheck } from "../../cli/launch-check.ts";
|
|
2
3
|
import type { NativeCliEntryContext } from "./native-cli-entry-types.ts";
|
|
3
4
|
|
|
4
5
|
export async function runCodexEntry(ctx: NativeCliEntryContext): Promise<void> {
|
|
@@ -26,6 +27,7 @@ export async function runCodexEntry(ctx: NativeCliEntryContext): Promise<void> {
|
|
|
26
27
|
const hub = await connect();
|
|
27
28
|
const snapshot = (await hub.request({ t: "status" })).status;
|
|
28
29
|
const warning = retainedLaunchWarning(snapshot, peer, ctx.definition); if (warning) console.error(warning);
|
|
30
|
+
printLaunchCheck(snapshot, peer, ctx.definition, "tui");
|
|
29
31
|
const res = await hub.request({ t: "start", peer, args: { unattended: launch0.unattended === true }, operationId: process.env.AGENTHUB_RECOVERY_OPERATION });
|
|
30
32
|
if (!res.ok) { hub.close(); fail(res.error); }
|
|
31
33
|
if (ctx.instance) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { retainedLaunchWarning } from "./native-cli-retained.ts";
|
|
2
|
+
import { printLaunchCheck } from "../../cli/launch-check.ts";
|
|
2
3
|
import { resolve } from "node:path";
|
|
3
4
|
import type { NativeCliEntryContext } from "./native-cli-entry-types.ts";
|
|
4
5
|
import type { ControlClient } from "../../hub/control-client.ts";
|
|
5
6
|
import type { JcodeTuiBinding, JcodeTuiState } from "../jcode.ts";
|
|
6
|
-
import { JCODE_HEADLESS_AFTER_RECOVERY } from "
|
|
7
|
+
import { JCODE_HEADLESS_AFTER_RECOVERY } from "./jcode-launch.ts";
|
|
7
8
|
import { bundleInStatus, rosterInStatus } from "../../hub/status-roster.ts";
|
|
8
9
|
|
|
9
10
|
const WAITING = "jcode's TUI opens after its first hub turn; send it work, or Ctrl-C";
|
|
@@ -104,6 +105,7 @@ export async function runJcodeEntry(ctx: NativeCliEntryContext): Promise<void> {
|
|
|
104
105
|
if (rostered === undefined) fail(`cannot read ${peer}'s roster membership from the running hub; upgrade or restart it, then retry (nothing was started)`);
|
|
105
106
|
if (!rostered) fail(`${peer} is off roster; add it with ahub roster add ${peer}`);
|
|
106
107
|
const warning = retainedLaunchWarning(snapshot, peer, ctx.definition); if (warning) console.error(warning);
|
|
108
|
+
if (mode === "tui" && !print) printLaunchCheck(snapshot, peer, ctx.definition, "tui");
|
|
107
109
|
const options = { model: one["--model"], providerProfile: one["--provider-profile"], sessionId: one["--session-id"] };
|
|
108
110
|
if (print) {
|
|
109
111
|
if (!hub.features.includes("native_tui_launch") || mode !== "tui") return console.log(JSON.stringify(launcherPreview("jcode", args, cwd, stateDir, unattendedEnv), null, 2));
|
|
@@ -140,6 +142,8 @@ export async function runJcodeEntry(ctx: NativeCliEntryContext): Promise<void> {
|
|
|
140
142
|
// answers on the dialed socket at startup, and on its reload-handoff reconnect. A hub stop or an owned-server crash
|
|
141
143
|
// between the confirm reply above and that check can leave an unowned jcode server on the private socket under the
|
|
142
144
|
// person's JCODE_HOME. No native flag prevents it; revisit if upstream adds an owner flag (#559 N2).
|
|
143
|
-
|
|
145
|
+
// #1778 T6a: no ahub socket may reach the agent, so the hub client is closed before the wrapper replaces itself.
|
|
146
|
+
hub.onClose = oldClose; hub.close();
|
|
147
|
+
ctx.execWithEnv(confirmed.launch.cmd, confirmed.launch.args, { ...ctx.helpers.childEnv(), ...confirmed.launch.env }, true);
|
|
144
148
|
} finally { process.removeListener("SIGINT", interrupt); hub.onClose = oldClose; hub.close(); }
|
|
145
149
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { retainedLaunchWarning } from "./native-cli-retained.ts";
|
|
2
|
+
import { printLaunchCheck } from "../../cli/launch-check.ts";
|
|
2
3
|
import { join, resolve } from "node:path";
|
|
3
4
|
import { homedir } from "node:os";
|
|
4
5
|
import { spawn, spawnSync } from "node:child_process";
|
|
@@ -69,6 +70,7 @@ export async function runKimiEntry(ctx: NativeCliEntryContext): Promise<void> {
|
|
|
69
70
|
if (rostered === undefined) fail("cannot read kimi's roster membership from the running hub; upgrade or restart it, then retry (nothing was started)");
|
|
70
71
|
if (!rostered) fail("kimi is off roster; add it with ahub roster add kimi");
|
|
71
72
|
const warning = retainedLaunchWarning(snapshot, peer, ctx.definition); if (warning) console.error(warning);
|
|
73
|
+
printLaunchCheck(snapshot, peer, ctx.definition, "tui");
|
|
72
74
|
const owner = snapshot?.peers?.[peer];
|
|
73
75
|
if (owner && !["offline"].includes(owner.state) && !owner.pullOnly) fail("Kimi is running headless; run ahub stop kimi before starting its TUI");
|
|
74
76
|
const admission = await hub.request({ t: "start", peer, args: { mode: "tui" }, operationId: process.env.AGENTHUB_RECOVERY_OPERATION });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { retainedLaunchWarning } from "./native-cli-retained.ts";
|
|
2
|
+
import { printLaunchCheck } from "../../cli/launch-check.ts";
|
|
2
3
|
import { parsePiFlags } from "./native-cli-pi.ts";
|
|
3
4
|
import type { NativeCliEntryContext } from "./native-cli-entry-types.ts";
|
|
4
5
|
|
|
@@ -37,6 +38,7 @@ export async function runPiEntry(ctx: NativeCliEntryContext): Promise<void> {
|
|
|
37
38
|
const hub = await connect();
|
|
38
39
|
const snapshot = (await hub.request({ t: "status" })).status;
|
|
39
40
|
const warning = retainedLaunchWarning(snapshot, peer, ctx.definition); if (warning) console.error(warning);
|
|
41
|
+
if (options.mode === "tui") printLaunchCheck(snapshot, peer, ctx.definition, "tui");
|
|
40
42
|
const res = await hub.request({ t: "start", peer, args: options, operationId: process.env.AGENTHUB_RECOVERY_OPERATION });
|
|
41
43
|
hub.close();
|
|
42
44
|
if (!res.ok) fail(res.error);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { peerChildEnv } from "../../hub/child-process.ts";
|
|
2
2
|
import { retainedLaunchWarning } from "./native-cli-retained.ts";
|
|
3
|
+
import { printLaunchCheck } from "../../cli/launch-check.ts";
|
|
3
4
|
import type { NativeCliEntryContext } from "./native-cli-entry-types.ts";
|
|
4
5
|
|
|
5
6
|
function verifiedLaunch(value: unknown): { cmd: string; args: string[]; env: NodeJS.ProcessEnv } | undefined {
|
|
@@ -29,6 +30,7 @@ export async function runQwenEntry(ctx: NativeCliEntryContext): Promise<void> {
|
|
|
29
30
|
try {
|
|
30
31
|
const snapshot = (await hub.request({ t: "status" })).status;
|
|
31
32
|
const warning = retainedLaunchWarning(snapshot, peer, ctx.definition); if (warning) console.error(warning);
|
|
33
|
+
if (mode === "tui") printLaunchCheck(snapshot, peer, ctx.definition, "tui");
|
|
32
34
|
const reply = await hub.request({ t: "start", peer, args: { mode, ...(one["--model"] ? { model: one["--model"] } : {}), ...(one["--session-id"] ? { sessionId: one["--session-id"] } : {}) }, operationId: process.env.AGENTHUB_RECOVERY_OPERATION }, 35_000);
|
|
33
35
|
if (!reply.ok) fail(reply.error);
|
|
34
36
|
if (mode === "tui") {
|
|
@@ -1,19 +1,26 @@
|
|
|
1
|
-
import type { HubConfig } from "../../hub/
|
|
1
|
+
import type { HubConfig } from "../../hub/config.ts";
|
|
2
2
|
import type { ControlClient } from "../../hub/control-client.ts";
|
|
3
3
|
import type { AdapterDefinition } from "../registry-types.ts";
|
|
4
4
|
|
|
5
5
|
/** Private static builtin relocation ports. The CLI binds identity, project and authority before invocation. */
|
|
6
|
+
interface NativeCliDefinition extends Pick<AdapterDefinition, "transport" | "attach"> {
|
|
7
|
+
cli: Pick<AdapterDefinition["cli"], "command" | "launchConfigKeys">;
|
|
8
|
+
session: Pick<AdapterDefinition["session"], "crashIdentity">;
|
|
9
|
+
}
|
|
10
|
+
|
|
6
11
|
export interface NativeCliEntryContext {
|
|
7
12
|
instance?: string; executionCwd?: string;
|
|
8
13
|
/** #223: the selected instance is started by the hub (a headless reviewer), never as a terminal launch. */
|
|
9
14
|
hubStarted?: true;
|
|
10
15
|
person?: boolean;
|
|
11
|
-
args: string[]; cwd: string; stateDir: string; cliDir: string; unattendedEnv: boolean; definition:
|
|
16
|
+
args: string[]; cwd: string; stateDir: string; cliDir: string; unattendedEnv: boolean; definition: NativeCliDefinition;
|
|
12
17
|
projectConfig(): HubConfig;
|
|
13
18
|
connect(): Promise<ControlClient>;
|
|
19
|
+
/** #1798 T3: one connection attempt as the caller's own identity, no retry, no instance check, no retry message and never the delegated audit connection. */
|
|
20
|
+
connectOnce(timeoutMs: number): Promise<ControlClient>;
|
|
14
21
|
fail(message: string): never;
|
|
15
22
|
exec(bin: string, argv: string[], tool?: "claude" | "codex" | "kimi"): never;
|
|
16
|
-
execWithEnv(bin: string, argv: string[], extra: NodeJS.ProcessEnv): never;
|
|
23
|
+
execWithEnv(bin: string, argv: string[], extra: NodeJS.ProcessEnv, replace?: boolean): never;
|
|
17
24
|
takeFlags(argv: string[], single: string[], repeated: string[]): { one: Record<string, string>; many: Record<string, string[]>; rest: string[] };
|
|
18
25
|
helpers: {
|
|
19
26
|
/** Fixed host validation; the entry never chooses or creates an execution worktree. */
|
|
@@ -46,3 +53,5 @@ export interface BuiltinCliEntry {
|
|
|
46
53
|
lifecycleAdmission: boolean;
|
|
47
54
|
execute(context: NativeCliEntryContext): Promise<void>;
|
|
48
55
|
}
|
|
56
|
+
|
|
57
|
+
export interface NativeCliDispatchEntry extends BuiltinCliEntry { definition: NativeCliDefinition }
|
|
@@ -11,7 +11,7 @@ import { configRefusal } from "../../hub/config-trust.ts";
|
|
|
11
11
|
import { idFor } from "../../hub/registry.ts";
|
|
12
12
|
import { projectRoot } from "../../hub/project.ts";
|
|
13
13
|
import { startModeOf } from "../../hub/start-mode.ts";
|
|
14
|
-
import type { HubConfig } from "../../hub/
|
|
14
|
+
import type { HubConfig } from "../../hub/config.ts";
|
|
15
15
|
import { shellQuote } from "../../cli/shell-quote.ts";
|
|
16
16
|
|
|
17
17
|
/** Whether init should offer the hub-owned home: jcode is installed or rostered, and `jcode_home` is unset or the person's own. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LaunchContext, LaunchPlan } from "../registry-types.ts";
|
|
2
|
-
import type { Launch } from "
|
|
3
|
-
import { UNATTENDED_WARNING } from "
|
|
2
|
+
import type { Launch } from "./native-launch-settings.ts";
|
|
3
|
+
import { UNATTENDED_WARNING } from "./native-launch-settings.ts";
|
|
4
4
|
import { shellQuote } from "../../cli/shell-quote.ts";
|
|
5
5
|
|
|
6
6
|
export interface NativeLaunchPolicy { hubSwitches: readonly string[]; ownedFlags: readonly string[] }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AdapterDefinition } from "../registry-types.ts";
|
|
2
2
|
|
|
3
3
|
/** Explain a retained launch setting using only metadata from the selected adapter definition. */
|
|
4
|
-
export function retainedLaunchWarning(status: unknown, peer: string, definition: AdapterDefinition): string | undefined {
|
|
4
|
+
export function retainedLaunchWarning(status: unknown, peer: string, definition: { cli: Pick<AdapterDefinition["cli"], "launchConfigKeys"> }): string | undefined {
|
|
5
5
|
const keys = definition.cli.launchConfigKeys;
|
|
6
6
|
const retained = (status as { retainedConfig?: unknown } | undefined)?.retainedConfig;
|
|
7
7
|
if (!keys?.length || !Array.isArray(retained)) return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import type { HubConfig } from "../../hub/
|
|
2
|
+
import type { HubConfig } from "../../hub/config.ts";
|
|
3
3
|
import type { Routing } from "../../hub/routing.ts";
|
|
4
4
|
|
|
5
5
|
/** Preserve the legacy config block order and shallow native merges. */
|