@staix/agent-hub 0.51.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 +35 -0
- package/README.md +1 -1
- package/docs/adding-an-ai-tool.md +24 -2
- package/docs/agent-notes/adapters.md +1 -0
- package/docs/agent-notes/budget.md +8 -2
- package/docs/agent-notes/daemon.md +13 -8
- package/docs/agent-notes/security-review.md +6 -5
- package/docs/agent-notes/tasks.md +5 -2
- package/docs/agent-notes/tests.md +4 -3
- package/docs/cooperbench.md +1 -1
- package/docs/design/adapters.md +4 -0
- package/docs/design/cli-output-inventory.md +162 -152
- package/docs/design/cli-output.md +4 -3
- package/docs/design/guidance-probes.md +1 -0
- package/docs/design/roadmap.md +2 -0
- package/docs/design/task-board.md +1 -0
- package/docs/dogfood.md +14 -0
- package/docs/events.md +4 -2
- package/docs/memory.md +5 -3
- package/docs/operations.md +210 -16
- package/docs/quickstart.md +12 -2
- package/docs/roles.md +1 -1
- package/docs/sdlc.md +26 -3
- package/docs/security.md +11 -5
- package/docs/specs/2026-09-19-agent-hub-design.md +43 -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-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 +82 -41
- 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 +621 -865
- package/plugins/agent-hub/server.js +17423 -32962
- package/src/adapters/agy/definition.ts +7 -24
- package/src/adapters/channel-peer.ts +3 -1
- 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 +74 -11
- 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 +61 -83
- 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 +3 -2
- package/src/adapters/definitions/native-cli-codex-launch.ts +2 -1
- package/src/adapters/definitions/native-cli-entry-jcode.ts +4 -2
- package/src/adapters/definitions/native-cli-entry-types.ts +9 -2
- package/src/adapters/definitions/native-cli-launch-common.ts +2 -2
- package/src/adapters/definitions/native-cli-retained.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 +3 -12
- package/src/adapters/native-capabilities.ts +18 -8
- 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/budget-renew-guidance.ts +129 -0
- package/src/cli/claude-homes.ts +9 -5
- 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 +9 -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/console-state.ts +5 -138
- package/src/cli/console-versions.ts +1 -1
- package/src/cli/help.ts +37 -15
- package/src/cli/identity.ts +23 -4
- package/src/cli/launch-check.ts +1 -2
- package/src/cli/launch.ts +13 -82
- package/src/cli/light-dispatch.ts +29 -0
- package/src/cli/main.js +8 -1
- package/src/cli/main.ts +233 -2816
- package/src/cli/orca-probe.ts +119 -0
- package/src/cli/output.ts +31 -2
- package/src/cli/preview.ts +10 -5
- 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 +1 -1
- package/src/cli/start-agents-run.ts +1 -1
- 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 +11 -0
- package/src/cli/upgrade.ts +4 -15
- 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/conductor-peer.ts +24 -0
- package/src/hub/conductor.ts +2 -21
- package/src/hub/config-apply.ts +24 -13
- package/src/hub/config-edit.ts +1 -1
- package/src/hub/config-tier.ts +2 -0
- package/src/hub/config.ts +31 -14
- package/src/hub/control-client.ts +48 -0
- package/src/hub/daemon.ts +421 -61
- 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-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/peers.ts +5 -1
- package/src/hub/permission-mode.ts +2 -1
- 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/registry.ts +36 -2
- 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/sdlc-check.ts +205 -0
- package/src/hub/sdlc-sync.ts +146 -0
- package/src/hub/sdlc.ts +33 -4
- 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 +319 -2548
- 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/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");
|
|
@@ -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");
|
|
@@ -4,7 +4,7 @@ import { resolve } from "node:path";
|
|
|
4
4
|
import type { NativeCliEntryContext } from "./native-cli-entry-types.ts";
|
|
5
5
|
import type { ControlClient } from "../../hub/control-client.ts";
|
|
6
6
|
import type { JcodeTuiBinding, JcodeTuiState } from "../jcode.ts";
|
|
7
|
-
import { JCODE_HEADLESS_AFTER_RECOVERY } from "
|
|
7
|
+
import { JCODE_HEADLESS_AFTER_RECOVERY } from "./jcode-launch.ts";
|
|
8
8
|
import { bundleInStatus, rosterInStatus } from "../../hub/status-roster.ts";
|
|
9
9
|
|
|
10
10
|
const WAITING = "jcode's TUI opens after its first hub turn; send it work, or Ctrl-C";
|
|
@@ -142,6 +142,8 @@ export async function runJcodeEntry(ctx: NativeCliEntryContext): Promise<void> {
|
|
|
142
142
|
// answers on the dialed socket at startup, and on its reload-handoff reconnect. A hub stop or an owned-server crash
|
|
143
143
|
// between the confirm reply above and that check can leave an unowned jcode server on the private socket under the
|
|
144
144
|
// person's JCODE_HOME. No native flag prevents it; revisit if upstream adds an owner flag (#559 N2).
|
|
145
|
-
|
|
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);
|
|
146
148
|
} finally { process.removeListener("SIGINT", interrupt); hub.onClose = oldClose; hub.close(); }
|
|
147
149
|
}
|
|
@@ -3,19 +3,24 @@ 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>;
|
|
14
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. */
|
|
15
20
|
connectOnce(timeoutMs: number): Promise<ControlClient>;
|
|
16
21
|
fail(message: string): never;
|
|
17
22
|
exec(bin: string, argv: string[], tool?: "claude" | "codex" | "kimi"): never;
|
|
18
|
-
execWithEnv(bin: string, argv: string[], extra: NodeJS.ProcessEnv): never;
|
|
23
|
+
execWithEnv(bin: string, argv: string[], extra: NodeJS.ProcessEnv, replace?: boolean): never;
|
|
19
24
|
takeFlags(argv: string[], single: string[], repeated: string[]): { one: Record<string, string>; many: Record<string, string[]>; rest: string[] };
|
|
20
25
|
helpers: {
|
|
21
26
|
/** Fixed host validation; the entry never chooses or creates an execution worktree. */
|
|
@@ -48,3 +53,5 @@ export interface BuiltinCliEntry {
|
|
|
48
53
|
lifecycleAdmission: boolean;
|
|
49
54
|
execute(context: NativeCliEntryContext): Promise<void>;
|
|
50
55
|
}
|
|
56
|
+
|
|
57
|
+
export interface NativeCliDispatchEntry extends BuiltinCliEntry { definition: NativeCliDefinition }
|
|
@@ -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;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AdapterDefinition } from "../registry-types.ts";
|
|
2
|
+
import {
|
|
3
|
+
piConfigSchema, localConfigSchema, piRoutingSchema, localRoutingSchema,
|
|
4
|
+
PI_SETTINGS, PI_RESTART_REASONS, LOCAL_RESTART_REASONS, piEffectiveConfig,
|
|
5
|
+
} from "./native-config-policy.ts";
|
|
6
|
+
|
|
7
|
+
type NativeConfigurationPolicy = NonNullable<AdapterDefinition["configuration"]>;
|
|
8
|
+
|
|
9
|
+
export const PI_CONFIGURATION: NativeConfigurationPolicy = Object.freeze({
|
|
10
|
+
schema: piConfigSchema, routingSchema: piRoutingSchema, settings: PI_SETTINGS,
|
|
11
|
+
restartReasons: PI_RESTART_REASONS, validateEffective: piEffectiveConfig,
|
|
12
|
+
});
|
|
13
|
+
export const LOCAL_CONFIGURATION: NativeConfigurationPolicy = Object.freeze({
|
|
14
|
+
schema: localConfigSchema, routingSchema: localRoutingSchema, restartReasons: LOCAL_RESTART_REASONS,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/** Fixed native configuration providers in the registry's validation order. */
|
|
18
|
+
export const NATIVE_CONFIGURATION: readonly NativeConfigurationPolicy[] = Object.freeze([PI_CONFIGURATION, LOCAL_CONFIGURATION]);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { describe } from "../compat.ts";
|
|
2
|
+
|
|
3
|
+
/** CLI presentation and declaration facts shared by help and the executable definitions. */
|
|
4
|
+
export const NATIVE_CLI_HELP = {
|
|
5
|
+
claude: { kind: "claude", projection: { helpRank: 0 }, cli: { usage: [["ahub claude [--print-command] [--unattended] [args...]", "launch Claude Code with the hub channel", "launch Claude Code with the hub channel"]] }, instances: { mode: "external", roles: ["planner", "implementer", "verifier", "reviewer"] } },
|
|
6
|
+
codex: { kind: "codex", projection: { helpRank: 1 }, cli: { usage: [["ahub codex [--print-command] [--unattended] [args...]", "start the Codex adapter and attach the TUI", "start the Codex adapter and attach the TUI"]] }, instances: { mode: "headless" } },
|
|
7
|
+
kimi: { kind: "kimi", projection: { helpRank: 2 }, cli: { usage: [["ahub kimi [--print-command] [--mode tui|headless] [--model <alias>]", "default: Kimi's own TUI, pull-only via hub_inbox; no push, steer, watchdog, console approvals or automatic quota handoff. Select headless for ACP", "start Kimi in its own TUI, or headless over ACP"]] }, instances: { mode: "headless" } },
|
|
8
|
+
pi: { kind: "pi", projection: { helpRank: 6 }, cli: { usage: [["ahub pi [--print-command] [--mode headless|tui | --headless] [--backend auto|dgx|mlx] [--model <alias>] [--session-id <id>] [--session-file <path>] [--replace-session]", "start Pi: its TUI in this terminal unless --headless or the start mode setting (peers.pi.start_mode) says headless; without a terminal the hub opens one or says how", "start Pi in a terminal, or headless"]] }, instances: { mode: "headless" } },
|
|
9
|
+
local: { kind: "local", projection: { helpRank: 7 }, cli: { usage: [["ahub local [--route <id> | --model <id>]", "start the hub-native worker on the self-hosted models (routing.toml)", "start the hub-native worker on self-hosted models"]] }, instances: { mode: "headless" } },
|
|
10
|
+
jcode: { kind: "jcode", projection: { helpRank: 3 }, cli: { usage: [["ahub jcode [--mode tui|headless] [--model <alias>] [--provider-profile <name>] [--session-id <id>] [--print-command]", "optional Jcode (roster.jcode, default off): its TUI on the hub-owned ACP session, opened once that session is saved; --mode headless for ACP only; native policy unmanaged, no hub sandbox", "start optional Jcode, in its TUI or headless"]] }, instances: { mode: "headless", nativeHome: true } },
|
|
11
|
+
qwen: { kind: "qwen", projection: { helpRank: 5 }, cli: { usage: [["ahub qwen [--mode headless|tui] [--model <alias>] [--session-id <id>] [--print-command]", `start optional Qwen Code ACP (${describe("qwen")}; roster.qwen, default off); --mode tui runs Qwen's own TUI in this terminal, driven through its dual-output files (${describe("qwen-dual")}); a hub deny ends the turn without an answer and a stalled turn is stopped with Esc in the Qwen terminal`, "start optional Qwen Code, headless or in its TUI"]] }, instances: { mode: "headless" } },
|
|
12
|
+
agy: { kind: "agy", projection: { helpRank: 4 }, cli: { usage: [["ahub agy [--print-command | --dry-run] [args...]", "optional Antigravity CLI 1.4.x TUI (1.4.2 verified) in this terminal (roster.agy, default off): pull-only via hub_inbox, implementer/verifier only; native permissions unmanaged, no hub sandbox", "start optional Antigravity CLI in this terminal"]] } },
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
/** Ranked definitions sort before unranked definitions; ties retain source order. */
|
|
16
|
+
export function isBuiltinAdapterKind(kind: string): kind is keyof typeof NATIVE_CLI_HELP {
|
|
17
|
+
return Object.hasOwn(NATIVE_CLI_HELP, kind);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function compareNativeRank(left: number | undefined, right: number | undefined): number {
|
|
21
|
+
if (left === undefined) return right === undefined ? 0 : 1;
|
|
22
|
+
if (right === undefined) return -1;
|
|
23
|
+
return left - right;
|
|
24
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { declaredKind, resolvedDefinition } from "../declaration-resolution.ts";
|
|
2
|
+
import type { AdapterDefinition, KindMap } from "../registry-types.ts";
|
|
3
|
+
import { NATIVE_ADAPTER_POLICY as policy } from "./native-adapter-policy.ts";
|
|
4
|
+
import { isBuiltinAdapterKind } from "./native-help.ts";
|
|
5
|
+
|
|
6
|
+
interface LaunchDeclaration {
|
|
7
|
+
identity: AdapterDefinition["identity"];
|
|
8
|
+
pullOnly?: true;
|
|
9
|
+
reviewer?: Pick<NonNullable<AdapterDefinition["reviewer"]>, "declaration">;
|
|
10
|
+
reviewerVariant?: LaunchDeclaration;
|
|
11
|
+
headlessVariant?: LaunchDeclaration;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const reviewers = {
|
|
15
|
+
claude: { identity: policy.claudeReviewer.metadata.identity, reviewer: { declaration: "automatic" } },
|
|
16
|
+
codex: { identity: { mcp: "env" }, reviewer: { declaration: "explicit" } },
|
|
17
|
+
kimi: { identity: { mcp: "env" }, reviewer: { declaration: "explicit" } },
|
|
18
|
+
agy: { identity: { mcp: "env" }, reviewer: { declaration: "automatic" } },
|
|
19
|
+
} satisfies Record<string, LaunchDeclaration>;
|
|
20
|
+
|
|
21
|
+
const declarations = new Map<string, LaunchDeclaration>(Object.keys(policy).filter(isBuiltinAdapterKind).map(kind => {
|
|
22
|
+
const reviewer = Object.hasOwn(reviewers, kind) ? reviewers[kind as keyof typeof reviewers] : undefined;
|
|
23
|
+
const value: LaunchDeclaration = {
|
|
24
|
+
identity: policy[kind].metadata.identity,
|
|
25
|
+
...(kind === "kimi" || kind === "agy" ? { pullOnly: true } : {}),
|
|
26
|
+
...(reviewer ? { reviewerVariant: reviewer } : {}),
|
|
27
|
+
...(kind === "claude" ? { headlessVariant: { identity: policy.claudeImplementer.metadata.identity } } : {}),
|
|
28
|
+
};
|
|
29
|
+
return [kind, value];
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
export function nativeLaunchDeclaration(id: string, instances?: KindMap): LaunchDeclaration | undefined {
|
|
33
|
+
return resolvedDefinition(id, declarations.has(id) ? id : declaredKind(id, instances, declarations), instances, declarations);
|
|
34
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Launch admission flags shared by the native planners and runtime definitions. */
|
|
2
|
+
const hubSwitches = Object.freeze(["--unattended", "--safe", "--new"]);
|
|
3
|
+
export const CLAUDE_LAUNCH_POLICY = Object.freeze({ hubSwitches: hubSwitches, ownedFlags: Object.freeze(["--dangerously-load-development-channels", "--dangerously-skip-permissions"]), unattended: true, passthrough: true });
|
|
4
|
+
export const CODEX_LAUNCH_POLICY = Object.freeze({ hubSwitches: hubSwitches, ownedFlags: Object.freeze(["--remote", "--remote-auth-token-env", "--yolo", "--dangerously-bypass-approvals-and-sandbox"]), unattended: true, passthrough: true });
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export const CLAUDE_CHANNEL = "plugin:agent-hub@agent-hub";
|
|
2
|
+
/** The timeout registered for the start entry; the total above must stay under it with room for the process to start. */
|
|
3
|
+
export const START_HOOK_TIMEOUT_S = 5;
|
|
4
|
+
|
|
5
|
+
export const UNATTENDED_WARNING =
|
|
6
|
+
"WARNING: --unattended disables permission prompts. Other agents' messages are untrusted input and this agent will act on its own judgment without asking you.";
|
|
7
|
+
|
|
8
|
+
export interface Launch {
|
|
9
|
+
cmd: string;
|
|
10
|
+
args: string[];
|
|
11
|
+
warning?: string;
|
|
12
|
+
permissionHook?: boolean;
|
|
13
|
+
hookPurpose?: FactsHook["purpose"];
|
|
14
|
+
settingsFile?: string;
|
|
15
|
+
unattended?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface StatusLineTee {
|
|
19
|
+
/** absolute path of src/cli/statusline-tee.ts */
|
|
20
|
+
script: string;
|
|
21
|
+
stateDir: string;
|
|
22
|
+
/** the user's own statusLine setting, wrapped so the status line looks the same */
|
|
23
|
+
original?: { command?: string; refreshInterval?: number; padding?: number };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const sh = (s: string) => `'${s.replace(/'/g, `'\\''`)}'`;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Settings for one session that put the tee in front of the user's status line command. Claude Code's status line
|
|
30
|
+
* input carries `rate_limits`; this is the hub's Claude quota source. `~/.claude/settings.json` is never edited.
|
|
31
|
+
*/
|
|
32
|
+
export function statusLineSettings(tee: StatusLineTee): string {
|
|
33
|
+
const command = `AGENTHUB_STATE_DIR=${sh(tee.stateDir)} AGENTHUB_STATUSLINE_CMD=${sh(tee.original?.command ?? "")} bun ${sh(tee.script)}`;
|
|
34
|
+
return JSON.stringify({ statusLine: { type: "command", command, refreshInterval: tee.original?.refreshInterval ?? 10, ...(tee.original?.padding !== undefined ? { padding: tee.original.padding } : {}) } });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Shared facts, native observation and permission hook transport. */
|
|
38
|
+
export interface FactsHook {
|
|
39
|
+
script: string;
|
|
40
|
+
stateDir: string;
|
|
41
|
+
/** The same hook transport can observe native turns without injecting facts. */
|
|
42
|
+
purpose?: "facts" | "idle" | "facts-and-idle" | "permission";
|
|
43
|
+
/** Observe native sessions/turns for every enabled facts, idle or conductor hook configuration. */
|
|
44
|
+
observeNative?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* #1798 T3: add the session-start Hub check entry. Opt-in: only the interactive `ahub claude` entry and its preview set it.
|
|
47
|
+
* `claudeObservationHooks` never does, and the headless implementer and benchmarks call `sessionSettings` without it.
|
|
48
|
+
*/
|
|
49
|
+
startCheck?: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The one `--settings` value of a hub-launched Claude session: the status line tee, and in a turn-free project the
|
|
54
|
+
* facts hook before and after every tool call and at the end of each turn (issue #108; the turn end is the quiescence
|
|
55
|
+
* evidence of issue #107).
|
|
56
|
+
*/
|
|
57
|
+
export function sessionSettings(tee?: StatusLineTee, facts?: FactsHook): string {
|
|
58
|
+
const settings = (tee ? JSON.parse(statusLineSettings(tee)) : {}) as Record<string, unknown>;
|
|
59
|
+
if (facts) {
|
|
60
|
+
const hooks = [{ type: "command", command: `AGENTHUB_STATE_DIR=${sh(facts.stateDir)} AGENTHUB_HOOK_PURPOSE=${sh(facts.purpose ?? "facts")} bun ${sh(facts.script)}`, timeout: 5 }];
|
|
61
|
+
settings.hooks = { PreToolUse: [{ matcher: "*", hooks }], ...(facts.purpose !== "permission" ? { PostToolUse: [{ matcher: "*", hooks }], Stop: [{ hooks }] } : {}) };
|
|
62
|
+
if (facts.observeNative) Object.assign(settings.hooks as object, { SessionStart: [{ matcher: "*", hooks }], UserPromptSubmit: [{ hooks }] });
|
|
63
|
+
}
|
|
64
|
+
if (facts?.startCheck) {
|
|
65
|
+
// Reads and prints only: its own command, so it records no native session or turn facts and turns on no idle, facts or sweep behavior. Where the
|
|
66
|
+
// observation entry also fires on SessionStart the notice is a second, separate entry in the same array (the check appears once per session start).
|
|
67
|
+
const check = { type: "command", command: `AGENTHUB_STATE_DIR=${sh(facts.stateDir)} AGENTHUB_HOOK_PURPOSE='start-check' bun ${sh(facts.script)}`, timeout: START_HOOK_TIMEOUT_S };
|
|
68
|
+
const hooks = (settings.hooks ?? (settings.hooks = {})) as Record<string, unknown[]>;
|
|
69
|
+
hooks.SessionStart = [...(hooks.SessionStart ?? []), { matcher: "startup|resume", hooks: [check] }];
|
|
70
|
+
}
|
|
71
|
+
return JSON.stringify(settings);
|
|
72
|
+
}
|