@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
package/src/cli/console-state.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { Report as SharedReport
|
|
1
|
+
import { Report as SharedReport } from "@staix/cli-output";
|
|
2
|
+
import { terminalText, paint, wrap, type Span, type Tone } from "./report-layout.ts";
|
|
3
|
+
export { terminalText, paint, wrap, Report, PALETTE, TONE_ROLE, type Span, type Tone } from "./report-layout.ts";
|
|
2
4
|
import { consoleNeeds, characterAttentionLine, attentionCommand } from "./attention.ts";
|
|
3
5
|
import { CHARACTERS, petFrame, petSize, petFooterRows, type CharacterId, type PetSize, type PetPose } from "../pet/frame.ts";
|
|
4
|
-
import { PEER_PALETTE } from "../ui/peer-palette.ts";
|
|
5
6
|
import { SGR_RESET, TONE_SGR, ROLE_SGR, MARKERS, MARKER_COLUMN, SECTION_MARKER, cellWidth, markerCell, resolveColor, asciiMarkers, streamEnv, MARKER_NAMES, type Role, type MarkerName, type ColorEnv } from "./output-standard.ts";
|
|
6
7
|
export { SGR_RESET, TONE_SGR, ROLE_SGR, MARKERS, MARKER_COLUMN, SECTION_MARKER, cellWidth, markerCell, resolveColor, asciiMarkers, streamEnv, MARKER_NAMES, type Role, type MarkerName, type ColorEnv };
|
|
7
8
|
import { PERMISSION_MODES, permissionBoundary } from "../hub/permission-mode.ts";
|
|
8
|
-
import { PLANNER_PEERS, definitionOf,
|
|
9
|
+
import { DECLARATION_PLANNER_PEERS as PLANNER_PEERS, builtinDeclarationOf as definitionOf, createProjectDeclarationCatalog as createProjectAdapterCatalog } from "../adapters/declaration-catalog.ts";
|
|
10
|
+
import { nativeStreamTone } from "../adapters/definitions/native-display.ts";
|
|
9
11
|
import { taskProgress } from "../ui/task-progress.ts";
|
|
10
12
|
import type { ProgressStage } from "../ui/task-progress.ts";
|
|
11
13
|
import { sanitize } from "../hub/envelope.ts";
|
|
@@ -135,30 +137,6 @@ export function syncPermissionDefaults(s: ConsoleState, rows: unknown): boolean
|
|
|
135
137
|
export function permissionDefaultText(row: Pick<PermissionDefault, "peer" | "source">): string {
|
|
136
138
|
return `never-ask default for ${row.peer} from ${quoted(row.source)}\n${permissionBoundary(row.peer, undefined, createProjectAdapterCatalog())}\nUntil you answer y, this default stays ask. y enables; n cancels for this hub; Esc defers.`;
|
|
137
139
|
}
|
|
138
|
-
/** Strip terminal controls before any daemon or child output reaches a terminal. Preserve printable Unicode. */
|
|
139
|
-
// Preserve the hub's control and header policy for non-Report output.
|
|
140
|
-
export function terminalText(value: unknown): string {
|
|
141
|
-
return sanitize(String(value ?? "")
|
|
142
|
-
.replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\|$)/g, "")
|
|
143
|
-
.replace(/\x1b[P_X^][\s\S]*?(?:\x1b\\|$)/g, "")
|
|
144
|
-
.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "")
|
|
145
|
-
.replace(/\x1b[^\n]?/g, "").replace(/[\x00-\x08\x0b-\x1f\x7f-\x9f]/g, ""));
|
|
146
|
-
}
|
|
147
|
-
export type Tone = "info" | "strong" | "success" | "attention" | "failure" | "muted" | "peerClaude" | "peerCodex" | "taskKeyword" | "number" | "issueRef" | "taskRef";
|
|
148
|
-
/** A report span names a semantic role (CLI output standard v1, docs/design/cli-output.md) or, for the console, a tone; a role wins. */
|
|
149
|
-
export interface Span { text: string; tone?: Tone; role?: Role }
|
|
150
|
-
export const PALETTE: Readonly<Record<Tone, string>> = Object.freeze({
|
|
151
|
-
info: PEER_PALETTE.hub.ansi, strong: TONE_SGR.strong, success: PEER_PALETTE.local.ansi, attention: PEER_PALETTE.pi.ansi, failure: TONE_SGR.failure, muted: PEER_PALETTE.other.ansi,
|
|
152
|
-
peerClaude: PEER_PALETTE.claude.ansi, peerCodex: PEER_PALETTE.codex.ansi,
|
|
153
|
-
taskKeyword: PEER_PALETTE.kimi.ansi, number: TONE_SGR.number, issueRef: TONE_SGR.issueRef, taskRef: TONE_SGR.taskRef,
|
|
154
|
-
});
|
|
155
|
-
/** The console's tones onto roles. A tone that is not here names an identity (a peer, a task keyword, a reference), never a status. */
|
|
156
|
-
export const TONE_ROLE: Readonly<Partial<Record<Tone, Role>>> = Object.freeze({
|
|
157
|
-
info: "accent", strong: "header", success: "success", attention: "warning", failure: "error", muted: "hint", number: "value",
|
|
158
|
-
});
|
|
159
|
-
export function paint(line: Span[], color: boolean): string {
|
|
160
|
-
return sharedPaint(line.map(({ tone, ...span }) => ({ ...span, text: terminalText(span.text), ...(tone ? { style: tone } : {}) })), color, PALETTE);
|
|
161
|
-
}
|
|
162
140
|
/** Console stream headers only. Tokenize sanitized text; bodies and command output stay plain. */
|
|
163
141
|
export function streamTokens(value: string, eventTone?: Tone, kind?: string): Span[] {
|
|
164
142
|
const text = terminalText(value);
|
|
@@ -236,105 +214,6 @@ export function wrapStreamTokens(value: string, columns: number, tone?: Tone, ki
|
|
|
236
214
|
return out;
|
|
237
215
|
});
|
|
238
216
|
}
|
|
239
|
-
/**
|
|
240
|
-
* The layout grammar of standard v1 as one builder, so every report has the same header, section, key/value row, bullet row, next step
|
|
241
|
-
* and summary line. Blank lines follow the standard: exactly one before each section, none after it, never two in a row, none at the
|
|
242
|
-
* end. Lines are Span arrays; `paint(line, color)` prints them. The builder never colors by itself: it names roles.
|
|
243
|
-
*/
|
|
244
|
-
// Shared Report supplies matching primitives; layout uses shared wrapping with the legacy fallback below.
|
|
245
|
-
export class Report {
|
|
246
|
-
private readonly out: Span[][] = [];
|
|
247
|
-
/** `columns` undefined means no wrap width: standard v1 wraps on a pipe only when COLUMNS is set, so a script reading `ahub doctor | grep` gets whole lines. */
|
|
248
|
-
constructor(readonly columns: number | undefined = undefined, readonly ascii = false) {}
|
|
249
|
-
/** The text as lines at most `room` cells wide, or as one line per source line when there is no wrap width. */
|
|
250
|
-
private fit(text: string, room: number): string[] {
|
|
251
|
-
return this.columns === undefined ? terminalText(text).split("\n").map(line => line.replace(/\t/g, " ")) : wrap(text, Math.max(10, room), 0);
|
|
252
|
-
}
|
|
253
|
-
private push(line: Span[]) { this.out.push(line); }
|
|
254
|
-
/** ` <tool> <Report>` in `header`, then one line of context in `hint` on the same line. At most one per report. */
|
|
255
|
-
header(tool: string, name: string, context?: string): this {
|
|
256
|
-
this.out.push(...new SharedReport(this.columns, this.ascii).header(tool, name, context).lines());
|
|
257
|
-
return this;
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* #1654 AC3: the one header-fit rule. The header line does not wrap, so a name that fits the terminal stays in it and a longer
|
|
261
|
-
* one moves to a wrapped line under a short header. `context` follows the name after two spaces in `hint`; with `inline` it
|
|
262
|
-
* joins the name by one space (`Merge queue owner/repo`) and moves in `value`. A name too wide for any header keeps its first
|
|
263
|
-
* word there and repeats in full on the wrapped line. No wrap width means no moving.
|
|
264
|
-
*/
|
|
265
|
-
titled(tool: string, name: string, context?: string, inline = false): this {
|
|
266
|
-
const fits = (text: string) => this.columns === undefined || cellWidth(` ${tool} ${text}`) <= this.columns;
|
|
267
|
-
const joined = !context ? name : inline ? `${name} ${context}` : `${name} ${context}`;
|
|
268
|
-
if (fits(joined)) return inline && context ? this.header(tool, joined) : this.header(tool, name, context || undefined);
|
|
269
|
-
if (context && fits(name)) return this.header(tool, name).note(context, inline ? "value" : "hint");
|
|
270
|
-
return this.header(tool, name.split(" ")[0]!).note(joined, "value");
|
|
271
|
-
}
|
|
272
|
-
/** One blank line, then `▸ <Name>` (ASCII `> <Name>`) in `section`, with an optional count in `hint`. */
|
|
273
|
-
section(name: string, count?: string): this {
|
|
274
|
-
if (this.out.length && this.out.at(-1)!.length) this.push([]);
|
|
275
|
-
this.out.push(...new SharedReport(this.columns, this.ascii).section(name, count).lines());
|
|
276
|
-
return this;
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Key/value rows of one section: two-space indent, `Key:` padded to the widest key, two spaces, value. A key wider than 28 cells
|
|
280
|
-
* puts its value on the next line at a four-space indent. An empty value is `(unset)` in `hint`.
|
|
281
|
-
*/
|
|
282
|
-
kv(rows: readonly (readonly [string, unknown])[], indent = 2, options: { colon?: boolean } = {}): this {
|
|
283
|
-
const suffix = options.colon === false ? "" : ":";
|
|
284
|
-
const keys = rows.map(([key]) => cellWidth(`${terminalText(key)}${suffix}`));
|
|
285
|
-
const pad = Math.max(0, ...keys.filter(width => width <= 28));
|
|
286
|
-
for (const [index, [key, raw]] of rows.entries()) {
|
|
287
|
-
const label = `${terminalText(key)}${suffix}`, text = terminalText(raw ?? "").trim();
|
|
288
|
-
const value = (line: string): Span => text ? { text: line, role: "value" } : { text: "(unset)", role: "hint" };
|
|
289
|
-
const lead = " ".repeat(indent);
|
|
290
|
-
// a terminal too narrow to leave 10 cells beside the label stacks the value under its key, like a key wider than 28
|
|
291
|
-
// stacked when fewer than 10 cells remain beside the label, or when the value's longest word does not fit there
|
|
292
|
-
const longest = Math.max(0, ...text.split(/\s+/).map(word => cellWidth(word)));
|
|
293
|
-
const narrow = keys[index]! <= 28 && this.columns !== undefined && (indent + pad + 2 + 10 > this.columns || longest > this.columns - indent - pad - 2 && longest <= this.columns - indent);
|
|
294
|
-
if (keys[index]! > 28 || narrow) {
|
|
295
|
-
// a terminal too narrow for the label column keeps the value at the key's own indent, so a long word is not broken by the hang
|
|
296
|
-
const hang = narrow ? 0 : 2;
|
|
297
|
-
this.push([{ text: `${lead}${label}`, role: "key" }]);
|
|
298
|
-
for (const line of text ? this.fit(text, (this.columns ?? 0) - indent - hang) : [""]) this.push([{ text: `${lead}${" ".repeat(hang)}` }, value(line)]);
|
|
299
|
-
continue;
|
|
300
|
-
}
|
|
301
|
-
const gap = " ".repeat(pad - keys[index]! + 2), room = (this.columns ?? 0) - indent - pad - 2;
|
|
302
|
-
const lines = text ? this.fit(text, room) : [""];
|
|
303
|
-
this.push([{ text: lead }, { text: label, role: "key" }, { text: gap }, value(lines[0]!)]);
|
|
304
|
-
for (const line of lines.slice(1)) this.push([{ text: " ".repeat(indent + pad + 2) }, value(line)]);
|
|
305
|
-
}
|
|
306
|
-
return this;
|
|
307
|
-
}
|
|
308
|
-
/** ` <marker> <text>`; a nested detail line uses four spaces. The text carries the state word, so meaning survives without color. */
|
|
309
|
-
bullet(name: MarkerName, text: string, nested = false): this {
|
|
310
|
-
const indent = nested ? " " : " ", lead = indent.length + MARKER_COLUMN + 1;
|
|
311
|
-
const lines = this.fit(text, (this.columns ?? 0) - lead);
|
|
312
|
-
this.push([{ text: indent }, { text: markerCell(name, this.ascii), role: MARKERS[name].role }, { text: " " }, { text: lines[0]! }]);
|
|
313
|
-
for (const line of lines.slice(1)) this.push([{ text: " ".repeat(lead) + line }]);
|
|
314
|
-
return this;
|
|
315
|
-
}
|
|
316
|
-
/** Lines another renderer built (a table), placed as they are. A section's blank line is still added by `section()`. */
|
|
317
|
-
append(lines: readonly Span[][]): this { for (const line of lines) this.push([...line]); return this; }
|
|
318
|
-
/** A free line in one role, indented two cells (a pointer to more detail, a note). */
|
|
319
|
-
note(text: string, role: Role = "hint"): this {
|
|
320
|
-
for (const line of this.fit(text, (this.columns ?? 0) - 2)) this.push([{ text: " " }, { text: line, role }]);
|
|
321
|
-
return this;
|
|
322
|
-
}
|
|
323
|
-
/** ` → <command>` in `accent`: complete and copyable, never shortened. */
|
|
324
|
-
next(command: string): this {
|
|
325
|
-
this.out.push(...new SharedReport(this.columns, this.ascii, { sanitize: terminalText, sanitizeFirst: true, wrapNext: false }).next(command).lines());
|
|
326
|
-
return this;
|
|
327
|
-
}
|
|
328
|
-
/** The last line of a check command: `✗ 2 failed ⚠ 3 warnings ✓ 18 ok`, zero counts omitted, unknowns as `? 2 unknown`. */
|
|
329
|
-
summary(counts: { failed?: number; warnings?: number; unknown?: number; ok?: number }): this {
|
|
330
|
-
const lines = new SharedReport(this.columns, this.ascii).summary(counts).lines();
|
|
331
|
-
if (lines.length) { if (this.out.length) this.push([]); this.out.push(...lines); }
|
|
332
|
-
return this;
|
|
333
|
-
}
|
|
334
|
-
lines(): Span[][] { return this.out.map(line => line.map(item => ({ ...item }))); }
|
|
335
|
-
/** The report as text: one painted string per line, no trailing blank line. */
|
|
336
|
-
render(color: boolean): string[] { return this.out.map(line => paint(line, color)); }
|
|
337
|
-
}
|
|
338
217
|
export function stateTone(state: string): Tone | undefined {
|
|
339
218
|
if (state === "idle" || state === "approved") return "success";
|
|
340
219
|
if (["busy", "paused", "in_review", "changes_requested", "ready"].includes(state)) return "attention";
|
|
@@ -369,18 +248,6 @@ export function fitLine(line: Span[], columns: number): Span[] {
|
|
|
369
248
|
export function fit(value: unknown, columns: number): string {
|
|
370
249
|
return paint(fitLine([span(value)], columns), false);
|
|
371
250
|
}
|
|
372
|
-
/**
|
|
373
|
-
* A source line keeps its indent and its continuations hang `hang` columns deeper, both capped at half the width, so
|
|
374
|
-
* below that cap wrapped untrusted text never starts where its source line, or a hub line at that indent, starts. Breaks fall
|
|
375
|
-
* at whitespace, which they drop; only a word longer than a whole line is split. A tab counts as one space.
|
|
376
|
-
* Lines come out sanitized: a width counts the `> ` that sanitize() puts before a line starting like a hub header.
|
|
377
|
-
*/
|
|
378
|
-
export function wrap(value: unknown, columns: number, hang = 4): string[] {
|
|
379
|
-
// A bare chunk ending in "--- from" becomes a header marker when table padding follows it.
|
|
380
|
-
const quoteChunk = (chunk: string) => sanitize(chunk + " ").slice(0, -1);
|
|
381
|
-
// Code-point splitting keeps legacy output for every width, including the non-positive ones.
|
|
382
|
-
return sharedWrap(terminalText(value), columns, hang, quoteChunk, false, "codepoint");
|
|
383
|
-
}
|
|
384
251
|
export const plural = (n: number, word: string) => `${n} ${word}${n === 1 ? "" : "s"}`;
|
|
385
252
|
/** `45s`, `12m`, `3h05m`, `2d03h`. */
|
|
386
253
|
export function duration(ms: number): string {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { closeSync, fstatSync, openSync, readSync, constants } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { DOCTOR_PLUGIN_PROBE } from "../adapters/
|
|
3
|
+
import { DOCTOR_PLUGIN_PROBE } from "../adapters/definitions/native-cli-doctor.ts";
|
|
4
4
|
import { childEnv } from "../hub/child-process.ts";
|
|
5
5
|
import { withoutOrcaEnv } from "../hub/orca-env.ts";
|
|
6
6
|
import { displayVersion } from "../version.ts";
|
package/src/cli/facts-hook.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import { claudePeer as defaultChannelPeer } from "../hub/claude-state.ts";
|
|
3
|
-
import {
|
|
3
|
+
import { nativeFactsHook } from "../adapters/native-facts-hooks.ts";
|
|
4
4
|
// Managed Claude hook transport for turn-free facts, native observations and runtime permissions.
|
|
5
5
|
// PreToolUse preserves facts additionalContext and adds permission decisions; other phases observe only.
|
|
6
6
|
// A failed or timed-out hub decides nothing, leaving Claude's native permission rules in effect.
|
|
7
7
|
import { relative, resolve, isAbsolute } from "node:path";
|
|
8
8
|
import { matchesPolicy } from "../hub/path-policy.ts";
|
|
9
9
|
import { realPath } from "../hub/project.ts";
|
|
10
|
-
import { isAgentConfigPath, isInstructionPath, isPermissionMode, hardLinked, isHubWritePath } from "../hub/permission-
|
|
10
|
+
import { isAgentConfigPath, isInstructionPath, isPermissionMode, hardLinked, isHubWritePath } from "../hub/permission-paths.ts";
|
|
11
11
|
import { ControlClient } from "../hub/control-client.ts";
|
|
12
|
+
import { startCheck } from "./start-check.ts";
|
|
12
13
|
|
|
13
14
|
/** A library call may target another hub; only the managed command hook inherits that target's native identity. */
|
|
14
15
|
export function nativeHookIdentity(stateDir: string, peer: string, env: NodeJS.ProcessEnv = process.env): { nativeInstanceId?: string; nativeLaunchId?: string; hookPurpose?: string } {
|
|
@@ -62,7 +63,7 @@ export function scopedWriteBlocked(phase: string, permission: unknown, tool: unk
|
|
|
62
63
|
export async function factsHook(stdin: string, stateDir: string, peer: string, timeoutMs = 2000, nativeEvent?: string): Promise<string | undefined> {
|
|
63
64
|
if (nativeEvent !== undefined) {
|
|
64
65
|
if (Buffer.byteLength(stdin, "utf8") > 1024 * 1024) return undefined;
|
|
65
|
-
const port =
|
|
66
|
+
const port = nativeFactsHook(peer);
|
|
66
67
|
const payload: unknown = JSON.parse(stdin);
|
|
67
68
|
const decoded = port?.decode(nativeEvent, payload);
|
|
68
69
|
if (!port || !decoded) return undefined;
|
|
@@ -110,7 +111,13 @@ export async function factsHook(stdin: string, stateDir: string, peer: string, t
|
|
|
110
111
|
if (import.meta.main) {
|
|
111
112
|
try {
|
|
112
113
|
const stateDir = process.env.AGENTHUB_STATE_DIR;
|
|
113
|
-
const
|
|
114
|
+
const peer = process.env.AGENTHUB_PEER_ID ?? defaultChannelPeer(undefined);
|
|
115
|
+
let out: string | undefined;
|
|
116
|
+
if (process.env.AGENTHUB_HOOK_PURPOSE === "start-check") {
|
|
117
|
+
// #1798 T3: this exact purpose runs the session-start Hub check and never reaches `factsHook`, even on an error: it sends no facts or native_facts request.
|
|
118
|
+
const document = stateDir ? await startCheck(await Bun.stdin.text(), stateDir, peer, process.env.AGENTHUB_LAUNCH_ID || undefined) : undefined; // display only: the daemon compares it with the attached socket's own launch id
|
|
119
|
+
out = document ? JSON.stringify(document) : undefined;
|
|
120
|
+
} else out = stateDir ? await factsHook(await Bun.stdin.text(), stateDir, peer, 2000, process.env.AGENTHUB_HOOK_EVENT) : undefined;
|
|
114
121
|
if (out) console.log(out);
|
|
115
122
|
} catch {
|
|
116
123
|
// a hook that fails must not get in the way of the tool call
|
package/src/cli/help.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AdapterDefinition } from "../adapters/registry.ts";
|
|
2
|
+
import { compareNativeRank, NATIVE_CLI_HELP } from "../adapters/definitions/native-help.ts";
|
|
2
3
|
import { VERSION } from "../version.ts";
|
|
3
|
-
import { ROADMAP_FORMS } from "./roadmap.ts";
|
|
4
|
-
import { paint, wrap, Report as LayoutReport, type Span } from "./
|
|
4
|
+
import { ROADMAP_FORMS } from "./roadmap-usage.ts";
|
|
5
|
+
import { paint, wrap, Report as LayoutReport, type Span } from "./report-layout.ts";
|
|
5
6
|
|
|
6
7
|
/** One usage form of `ahub help`: the usage starts with `ahub <command>`, alternatives joined by `|`. */
|
|
7
8
|
export interface HelpEntry { section: string; usage: string; description: string; /** #1504: the overview row of a native agent, from the third element of its definition's `cli.usage` entry; never a table in this file that names a peer. */ summary?: string }
|
|
@@ -40,13 +41,15 @@ const SECTIONS: [string, [usage: string, description: string][]][] = [
|
|
|
40
41
|
["ahub completion zsh|bash|fish", "print a shell completion script; its candidates come from these help entries"],
|
|
41
42
|
]],
|
|
42
43
|
["Daemon and runtime", [
|
|
43
|
-
["ahub up [--unattended] [--no-console] [--no-agents]", "start the daemon, then ask it to start this project's default agents (start.agents, claude and codex unless chosen at setup; one line each, a refusal names the manual command; --no-agents skips them), then enter console in an interactive terminal"],
|
|
44
|
+
["ahub up [--unattended] [--no-console] [--no-agents] [--wait <seconds>] [--json]", "start the daemon, then ask it to start this project's default agents (start.agents, claude and codex unless chosen at setup; one line each, a refusal names the manual command; --no-agents skips them), wait up to --wait seconds (default 15, at most 600) for the started agents to attach and print a Hub check, one line per agent (a started agent still not attached is pending, a refused one shows its refusal and next step; --json prints one JSON document and does not enter the console), then enter console in an interactive terminal"],
|
|
44
45
|
["ahub console [--panels] [--color=auto|always|never]", "enter the human console; P cycles built-in pet characters/off; exiting leaves the daemon running"],
|
|
45
46
|
["ahub console --no-pet", "turn off attention for this session; combines with --panels and --color"],
|
|
46
47
|
["ahub pet [--short]", "read attention without connecting; --short prints ahub!N only when action is needed"],
|
|
47
48
|
["ahub pet --window [--close]", "retired floating-window options: run acon ui and open Mini"],
|
|
48
49
|
["ahub pet --palette <blue|teal|violet|ochre>", "retired floating-window option: run acon ui and open Mini"],
|
|
49
|
-
["ahub sdlc status [task] | explain <task> [--json] [--color=auto|always|never] | export <task> | record <task> <receipt-json>", "read head-bound lifecycle gates and the next actor/action; status and explain are open to any agent as a public view (private tasks stay stubs), export and record are person only; export stays JSON"],
|
|
50
|
+
["ahub sdlc status [--all] [task] | explain <task> [--json] [--color=auto|always|never] | export <task> | record <task> <receipt-json>", "read head-bound lifecycle gates and the next actor/action; status and explain are open to any agent as a public view (private tasks stay stubs), export and record are person only; export stays JSON"],
|
|
51
|
+
["ahub sdlc check [--json] [--color=auto|always|never]", "read-only audit of the lifecycle setup (config, roles, required checks, bindings, roadmap hygiene); each warning names its cause and next command; exit 1 only when a row fails; `ahub doctor` shows the offline sdlc row (#1856)"],
|
|
52
|
+
["ahub sdlc sync [--write-roadmap] [--close-settled-issues] [--json] [--color=auto|always|never] | sync <same flags> --apply --confirm <fingerprint> [--json] [--color=auto|always|never]", "preview board receipt repairs (title issue link, open PR and head binding, merged-PR adoption) with a 64-hex fingerprint and write nothing; apply re-plans and refuses on drift; person or the configured conductor; --write-roadmap refreshes the tracked roadmap files, --close-settled-issues closes issues whose tasks are approved at merged PRs and whose body has no open item, under roadmap apply authority only (#1856)"],
|
|
50
53
|
["ahub sdlc queue <owner/repo> | release <owner/repo> [live-issue...] [--json] [--color=auto|always|never]", "read-only merge and release evidence; open to any agent as public readback of the checkout's repositories, never an authorization"],
|
|
51
54
|
["ahub sdlc survey start [--focus bugs|tests|debt|deps|dx|docs] [--json] [--color=auto|always|never]", "person or current conductor: file one read-only planner survey at a pinned source ref; only explicitly vetted findings produce backlog cards"],
|
|
52
55
|
["ahub sdlc survey show <task> [--json] [--color=auto|always|never]", "read findings and their vet decisions; unchanged or unknown prior rejections remain rejected before, and reconsideration needs an explicit vetted reason"],
|
|
@@ -74,8 +77,13 @@ const SECTIONS: [string, [usage: string, description: string][]][] = [
|
|
|
74
77
|
["ahub doctor [--json] [--full] [--ascii] [--color=auto|always|never]", "check the tools, daemon, plugin, gateway, models, memory library and memory capture setup (read from `amem setup <tool> --json`, a preview) this project uses, the runtime capture pruning ledger, whether the shared config.json tracking matches the AGENTS.md roles sentence, and who holds conductor, planner and reviewer as the loader settled them (a warning, never a failure), the hub skills of the Claude plugin and every other agent host (installed, stale, missing, modified, foreign or linked, with a repair command), and any rostered implementer that no routing class lists (a warning); warn when the CLI or plugin is older than its running daemon"],
|
|
75
78
|
["ahub doctor --stale-anchors [--json]", "read-only bounded report of public memory symbol anchors at current HEAD; private or unavailable evidence stays unknown"],
|
|
76
79
|
["ahub doctor --orphans [--kill] [--json] [--color=auto|always|never]", "person: inspect missing-root registrations; conductor --kill: selected project only; signed hub ownership is required before any stop"],
|
|
80
|
+
["ahub accounts import --from orca", "person only: print an `accounts` block for config.local.json from `orca account list --json`, labels only, nothing written"],
|
|
77
81
|
["ahub agents [--json]", "show each gated agent CLI's installed version and verdict (verified, in-line, trusted, refused or unknown)"],
|
|
82
|
+
["ahub agents --latest [--json]", "person only, reads the network: say, for each refused or trusted agent CLI, which release verifies the version installed here, read from the newest published release's compat.json (advice only, writes nothing, admits nothing; the hub never reads the network for it)"],
|
|
78
83
|
["ahub agents trust <id> <version> [--revoke]", "accept an untested agent CLI version on this machine (person only; runtime proofs still run)"],
|
|
84
|
+
["ahub agents presets [--json]", "person only: list the shipped agent presets (gemini, opencode, kiro, copilot) with the recorded CLI version and whether a verification receipt backs each (verified) or not (untested)"],
|
|
85
|
+
["ahub agents add <preset> [--as <kind>] [--pull]", "person only: write the preset's headless launch line as a configured kind into the untracked .agenthub/config.local.json; with --pull write a pull kind (the CLI in your own terminal, owns no task) and print the command that registers the hub bridge in that CLI. Refuses an existing kind, a missing executable or, without --pull, a preset with no launch line"],
|
|
86
|
+
["ahub <kind> [--print-command | --dry-run] [args...]", "start a configured pull kind's CLI in your terminal with its peer identity, passing any other args to it (person only; the kind must be loaded by the hub and on the roster); --print-command or --dry-run prints the launch as JSON and starts nothing"],
|
|
79
87
|
["ahub kill", "stop this project's hub"],
|
|
80
88
|
["ahub down", "stop this project's hub, the counterpart of ahub up (same as ahub kill)"],
|
|
81
89
|
["ahub reset [--all] [--yes]", "list, then with --yes stop the hub and discard every queued and needs_review delivery, clear holds and pauses and drop session pointers; --all moves the state directory to .agenthub/archive instead"],
|
|
@@ -86,6 +94,7 @@ const SECTIONS: [string, [usage: string, description: string][]][] = [
|
|
|
86
94
|
["ahub recovery dispose [<operation-id>] --fresh-session codex|claude --reason <text>", "end a partial operation by starting that peer as a new session, recording the lost conversation"],
|
|
87
95
|
["ahub recovery dispose [<operation-id>] --stop-and-archive --reason <text>", "end a partial operation: stop its own targets, archive its snapshot and release the lock; the upgrade is abandoned, not completed"],
|
|
88
96
|
["ahub daemon [--unattended]", "internal: the detached hub process that ahub up or the dashboard manager starts"],
|
|
97
|
+
["ahub host --runtime <root> [--add-current] [--unattended]", "internal: the host process several projects of one runtime share when their config sets host.shared (off by default)"],
|
|
89
98
|
["ahub recovery-run <operation-id>", "internal: a detached runner; conductor use is limited to the captured operation continuation, not a general command"],
|
|
90
99
|
]],
|
|
91
100
|
["Agents", [
|
|
@@ -126,6 +135,8 @@ const SECTIONS: [string, [usage: string, description: string][]][] = [
|
|
|
126
135
|
["ahub task propose [--class <c> | <class>] <title...> [--owner <peer>] [--path <p>]... [--after <id>]... [--urgent] [--needs-network] [--needs-worktree] [--backlog] [--detail <text>]", "put a task on the board; --needs-network keeps it away from a peer whose shell has none; --needs-worktree keeps it away from a sandboxed peer unless the hub can make the task worktree for it (it makes it, commits and pushes at done); a first word that names a class is taken as the class; while a task named by --after is not approved yet, --owner reserves the task for that peer, offered to it first once it is ready; otherwise --owner assigns it now"],
|
|
127
136
|
["ahub task handoff --list | --sync | --project <root|id> [<class>] <title...> [--path <p>]... [--issue <n>] [--task <n>] [--detail <text>] [--duplicate-ok <reason>] [--key <uuid>] [--json] [--color=auto|always|never]", "person only: register work that belongs to ANOTHER project that runs agent-hub on that project's board (an ownerless proposal its own roles take from there); the target must be registered and running, nothing is queued; a feature or behavior change first needs a spec issue there (--issue), and an issue that already has an open task there is refused with those ids unless --duplicate-ok <reason>; a handoff the target did not confirm is reported as outcome_unknown with a key, and --key <uuid> files the same request once; --list shows each handoff with its age and whether its target is reachable (reachable, unreachable with the cause, or moved), and --sync asks every target now instead of at the next 5-minute pass; its state changes show in ahub board --handoffs (an agent that hands off gets them as task messages)"],
|
|
128
137
|
["ahub backlog list [--json] [--full] [--color=auto|always|never] | add <class> <title...> | plan <id> <revision> <fields-json> <reason...> | pin <id> <revision> true|false <reason...> | person <id> <revision> true|false <reason...> | undo <id> <revision> [--json] [--color=auto|always|never]", "person only: plan work with a reason; {} records a note-only revision, fields.sdlc sets backlog repo/issue identity and clears old spec acceptance; preserve pins/frozen scope and refuse stale edits; person marks a leg only the person can run (live receipts, their accounts or approvals): no agent is offered it, auto pull and the idle sweep skip it, and it counts toward no planner WIP; list is by rank and shows it as waiting on the person (--json: raw listing)"],
|
|
138
|
+
["ahub structure check [--json]", "check project file budgets and shared names using .agenthub/sdlc.toml"],
|
|
139
|
+
["ahub structure baseline --write", "create an initial baseline for review, or shrink the existing baseline"],
|
|
129
140
|
[`ahub roadmap ${ROADMAP_FORMS.list} | ${ROADMAP_FORMS.show}`, "read public milestone membership and computed progress; private work is a count, unavailable evidence stays unknown"],
|
|
130
141
|
[`ahub roadmap ${ROADMAP_FORMS.new}`, "planner or conductor: create a milestone without GitHub writes or roadmap model calls"],
|
|
131
142
|
[`ahub roadmap ${ROADMAP_FORMS.edit}`, "edit at the current revision; reload roadmap show after a stale-revision refusal"],
|
|
@@ -140,6 +151,8 @@ const SECTIONS: [string, [usage: string, description: string][]][] = [
|
|
|
140
151
|
["ahub backlog pull-ready <id> <revision> <reason...> [--json] [--color=auto|always|never]", "person only: reserve an eligible WIP slot before routing; pending unowned work can be undone"],
|
|
141
152
|
["ahub backlog pull|return <id>", "person only: pull backlog into To Do or return ownerless proposed work; --backlog on task propose stages unoffered work"],
|
|
142
153
|
["ahub smoke run qwen-dual-output --project-id <id> --receipt <file.json> [--timeout-ms <100..120000>] [--json]", "requires the leading --live-test flag; disposable temporary project only: Q2 dual-file submit and queued second submit; isolated native HOME, owned-process cleanup and a counts/timings receipt; requires OPENAI_API_KEY, OPENAI_BASE_URL and OPENAI_MODEL; real-account live proof remains a separate person leg"],
|
|
154
|
+
["ahub releases list [--json]", "person only: every entry under the hub home's releases directory with its kind (capture, coordinator-source, registry-install, unknown), version, digest, size and what refers to it"],
|
|
155
|
+
["ahub releases prune [--kind <capture|coordinator-source|registry-install>] [--older-than <days>] [--apply] [--json]", "person only: preview what nothing refers to (no project runtime.json, recovery operation or live process); --apply removes it after rechecking each entry. An unreadable reference keeps the entry; unknown layouts and symlinks are never removed"],
|
|
143
156
|
["ahub broker serve [--hostname <host>] [--port <0..65535>] [--public-url <ws[s]://host/>] [--owner <fingerprint>]... [--state-dir <dir>]", "person only: standalone ciphertext relay; default loopback port 8788, public WSS needs owner allowlist and TLS termination"],
|
|
144
157
|
["ahub broker room drop <room> --yes [--state-dir <dir>]", "person only, broker stopped: forget one room's pins, floors and queued ciphertext; other rooms stay intact"],
|
|
145
158
|
["ahub room create <name> --broker <url> [--label <id>] | invite <name> [--accept <request>] | join <token> [--name <name>] [--label <id>] | join <name> --roster <signed-roster> | leave <name> | revoke <name> <fingerprint> | expose <name> [<peer>...] [--confirm <member-fingerprint-prefix>]", "person only, never --live-test: every mutation displays both fingerprints, then requires TTY y/N (default No) or --confirm matching 16..64 lowercase hex of the member fingerprint; exchange artifacts out of band, never invitation secrets through the broker"],
|
|
@@ -172,6 +185,8 @@ const SECTIONS: [string, [usage: string, description: string][]][] = [
|
|
|
172
185
|
]],
|
|
173
186
|
["Budget", [
|
|
174
187
|
["ahub budget [--json] [--full] [--color=auto|always|never]", "quota windows per peer with each number's kind (native, count, manual) and source, what is left and when the window would reach its limit at the recent hourly burn rate (or why there is no forecast), why a peer shows no number, who is paused until when, and the reviewer quota admission rule"],
|
|
188
|
+
["ahub budget renew <peer> --reset [--json] [--color=auto|always|never]", "person only: clear the account's earlier quota readings after refreshing the same account and retain the budget gate"],
|
|
189
|
+
["ahub budget renew <peer> --switched [--json] [--color=auto|always|never]", "person only: clear earlier quota readings after switching accounts, with a Codex home comparison and restart steps where required"],
|
|
175
190
|
["ahub budget set <peer> <0..1> [--resets-in 30m] [--window 5h|week]", "feed a reading by hand (also: test the relay)"],
|
|
176
191
|
["ahub budget resume <peer>", "override a budget pause; readings are ignored for that peer until the window resets"],
|
|
177
192
|
["ahub budget execution status [id] [--json] [--color=auto|always|never]", "read execution counters and limits"],
|
|
@@ -227,10 +242,15 @@ const SECTIONS: [string, [usage: string, description: string][]][] = [
|
|
|
227
242
|
["ahub manager", "internal: the dashboard manager process that ahub ui --all starts"],
|
|
228
243
|
]],
|
|
229
244
|
];
|
|
230
|
-
|
|
245
|
+
type HelpDefinition = Pick<AdapterDefinition, "kind" | "projection" | "instances"> & {
|
|
246
|
+
cli: Pick<AdapterDefinition["cli"], "usage">;
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
export function helpEntries(definitions: readonly HelpDefinition[] = Object.values(NATIVE_CLI_HELP)): readonly HelpEntry[] {
|
|
231
250
|
const byKind = new Map(definitions.map(definition => [definition.kind, definition]));
|
|
232
|
-
const order =
|
|
233
|
-
|
|
251
|
+
const order = [...definitions].sort((left, right) => compareNativeRank(left.projection?.helpRank, right.projection?.helpRank))
|
|
252
|
+
.map(definition => definition.kind);
|
|
253
|
+
const native = order.flatMap(kind => byKind.get(kind)?.cli.usage ?? []);
|
|
234
254
|
const instanceKinds = order.filter(kind => byKind.get(kind)?.instances !== undefined);
|
|
235
255
|
const instances: readonly [string, string] = [`ahub ${instanceKinds.join("|")} --as <instance> [options...]`, "start an extra instance of that kind declared under instances in .agenthub/config.local.json"];
|
|
236
256
|
return SECTIONS.flatMap(([section, rows]) => {
|
|
@@ -260,20 +280,20 @@ const SUMMARIES: Readonly<Record<string, string>> = {
|
|
|
260
280
|
"--live-test": "user-authorized console delegation (person only)", help: "this overview, or one command's usage", version: "print the installed version", completion: "print a shell completion script",
|
|
261
281
|
up: "start the daemon and this project's default agents", console: "open the human console", pet: "read attention without connecting", sdlc: "read lifecycle gates and the next action",
|
|
262
282
|
"Daemon and runtime/backlog": "return accepted untouched work to the backlog", status: "is the hub OK, and what to do next", logs: "show the hub log", doctor: "check tools, daemon, plugin, models and memory",
|
|
263
|
-
agents: "show each agent CLI's version and verdict", kill: "stop this project's hub", down: "stop this project's hub (same as kill)", reset: "discard queued deliveries and clear holds",
|
|
283
|
+
agents: "show each agent CLI's version and verdict", accounts: "print an accounts block from Orca (person only)", kill: "stop this project's hub", down: "stop this project's hub (same as kill)", reset: "discard queued deliveries and clear holds",
|
|
264
284
|
restart: "recover this project's runtime", upgrade: "review and upgrade this project", recovery: "inspect, resume or abort a held operation",
|
|
265
|
-
daemon: "internal: the detached hub process", "recovery-run": "internal: a detached recovery runner",
|
|
285
|
+
daemon: "internal: the detached hub process", host: "internal: the shared per-runtime host process", "recovery-run": "internal: a detached recovery runner",
|
|
266
286
|
role: "read catalog guidance for a role", stop: "stop a hub-owned headless peer", peer: "hand the attached session to a standby", models: "inspect local model state",
|
|
267
287
|
say: "send a message as the console user", watch: "watch a headless ACP peer's activity", tail: "live stream of messages and states", permission: "inspect or set a peer's permission mode",
|
|
268
288
|
permit: "answer a permission request", answer: "list and answer open hub_ask questions", results: "list what your runs left behind", roster: "every known peer and its participation",
|
|
269
289
|
roles: "each peer's flow roles, planner and reviewers", autonomy: "apply the autonomy preset", model: "select or inspect runtime models", settings: "list, read and change settings",
|
|
270
290
|
pause: "hold or release a peer's deliveries", title: "rename a Pi or local-worker session", queue: "inspect and resolve durable deliveries",
|
|
271
291
|
board: "show the task board, import open issues", task: "put tasks on the board and move them along", "Tasks and review/backlog": "plan, pull and return backlog cards", roadmap: "milestones and their computed progress",
|
|
272
|
-
release: "plan and ship releases", smoke: "live smoke test in a temporary project", broker: "run the ciphertext relay for rooms", room: "encrypted rooms between hubs (person only)",
|
|
292
|
+
release: "plan and ship releases", releases: "list and prune hub runtime copies", smoke: "live smoke test in a temporary project", broker: "run the ciphertext relay for rooms", room: "encrypted rooms between hubs (person only)",
|
|
273
293
|
source: "register inputs as content-hashed sources", schedule: "list and run machine-local schedules", intake: "turn a plain request into a draft backlog card",
|
|
274
294
|
capabilities: "list the skills each attached peer offers", learn: "review recurring-criterion candidates", study: "research campaign contracts",
|
|
275
295
|
deliverables: "what each task delivered and a reviewer approved", review: "give a review verdict on a task", route: "why a task went where it did",
|
|
276
|
-
ask: "answer from the board, memory and the log", remember: "save a note to shared memory", budget: "quota windows per peer and why one is paused",
|
|
296
|
+
ask: "answer from the board, memory and the log", remember: "save a note to shared memory", structure: "check file budgets and shared names", budget: "quota windows per peer and why one is paused",
|
|
277
297
|
instructed: "run a confirmed exact or intent instruction",
|
|
278
298
|
guidance: "guidance declarations and the probe lifecycle", lineage: "execution metadata and evidence strengths", turns: "recent turns and the files each changed",
|
|
279
299
|
undo: "put back the files a turn changed", report: "turns, tokens, messages and task events", usage: "tokens per group from the roll-up", export: "events as JSON lines",
|
|
@@ -318,6 +338,7 @@ export const EXAMPLES: Readonly<Record<string, readonly string[]>> = {
|
|
|
318
338
|
instructed: ["ahub instructed run", "ahub instructed run task assign 12 claude"],
|
|
319
339
|
help: ["ahub help task"], version: ["ahub version"], "--version": ["ahub --version"], completion: ["ahub completion zsh"],
|
|
320
340
|
up: ["ahub up --no-console"], console: ["ahub console --panels"], pet: ["ahub pet --short"],
|
|
341
|
+
structure: ["ahub structure check", "ahub structure baseline --write"],
|
|
321
342
|
sdlc: ["ahub sdlc status 12", "ahub sdlc explain 12 --json"], backlog: ["ahub backlog list --full", "ahub backlog return 12 3 waiting on a spec"],
|
|
322
343
|
status: ["ahub status --verbose"], logs: ["ahub logs -f"], doctor: ["ahub doctor --json"], agents: ["ahub agents --json"],
|
|
323
344
|
kill: ["ahub kill"], down: ["ahub down"], tail: ["ahub tail"],
|
|
@@ -328,7 +349,7 @@ export const EXAMPLES: Readonly<Record<string, readonly string[]>> = {
|
|
|
328
349
|
autonomy: ["ahub autonomy status"], model: ["ahub model list"], settings: ["ahub settings list"], pause: ["ahub pause codex"], resume: ["ahub resume codex"],
|
|
329
350
|
title: ["ahub title pi release review"], queue: ["ahub queue list --peer codex"], board: ["ahub board --ready"],
|
|
330
351
|
task: ["ahub task show 12", "ahub task propose implement Fix the flaky test --path test/a.test.ts"], roadmap: ["ahub roadmap show 3"], release: ["ahub release list"],
|
|
331
|
-
smoke: ["ahub smoke run qwen-dual-output --project-id 1f3a --receipt receipt.json"], broker: ["ahub broker serve --port 8787"], room: ["ahub room list"],
|
|
352
|
+
smoke: ["ahub smoke run qwen-dual-output --project-id 1f3a --receipt receipt.json"], broker: ["ahub broker serve --port 8787"], releases: ["ahub releases list"], room: ["ahub room list"],
|
|
332
353
|
source: ["ahub source list"], schedule: ["ahub schedule list"], intake: ["ahub intake \"Add a dark mode toggle\""], capabilities: ["ahub capabilities --json"], learn: ["ahub learn list"],
|
|
333
354
|
study: ["ahub study show --json"], deliverables: ["ahub deliverables --task 12 --check"], review: ["ahub review 12 approved looks good", "ahub review brief 12"],
|
|
334
355
|
route: ["ahub route explain 12"], ask: ["ahub ask what blocks task 12"], remember: ["ahub remember Pi 1.5.2 is verified"], budget: ["ahub budget --full"],
|
|
@@ -337,7 +358,7 @@ export const EXAMPLES: Readonly<Record<string, readonly string[]>> = {
|
|
|
337
358
|
bench: ["ahub bench list"], "check-path": ["ahub check-path src/cli/help.ts"], memory: ["ahub memory search sweep"], goal: ["ahub goal list"], ui: ["ahub ui --no-open"],
|
|
338
359
|
};
|
|
339
360
|
/** Commands nobody types: a process the hub starts, or a hook a tool calls. They have no example. */
|
|
340
|
-
export const INTERNAL_COMMANDS: readonly string[] = ["daemon", "recovery-run", "manager", "facts"];
|
|
361
|
+
export const INTERNAL_COMMANDS: readonly string[] = ["daemon", "host", "recovery-run", "manager", "facts"];
|
|
341
362
|
|
|
342
363
|
/** One example per native agent, from its own definition: `ahub <kind> --print-command` when its usage has that flag (it prints the launch and starts nothing), else the bare command. */
|
|
343
364
|
function nativeExample(command: string, entries: readonly HelpEntry[]): string[] {
|
|
@@ -378,6 +399,7 @@ export function helpFlags(command: string, entries: readonly HelpEntry[] = HELP)
|
|
|
378
399
|
* file adds) falls back to the forms that take it, and `test/help.test.ts` fails a flag of any command in this file that has no line.
|
|
379
400
|
*/
|
|
380
401
|
export const FLAG_DESCRIPTIONS: Readonly<Record<string, string>> = {
|
|
402
|
+
"structure --write": "write the initial or reduced baseline",
|
|
381
403
|
"--json": "one JSON document on stdout, never colored",
|
|
382
404
|
"--color": "auto, always or never; auto follows NO_COLOR, FORCE_COLOR and the terminal",
|
|
383
405
|
// in many commands
|
|
@@ -398,10 +420,11 @@ export const FLAG_DESCRIPTIONS: Readonly<Record<string, string>> = {
|
|
|
398
420
|
"--shadow": "hub-owned snapshots for a non-git folder", "--release-guard": "install the tag pre-push hook", "--focus": "area the survey looks at", "--review": "review scope: full, delta or none",
|
|
399
421
|
"--reviewers": "number of reviewers", "--ci": "CI scope: full, focused or reuse", "--reserved": "reserve the card for this peer", "--unreserve": "clear the card's reservation", "--to": "version to upgrade to", "--all-stopped": "retarget every stopped project's runtime",
|
|
400
422
|
"--version": "print the installed version",
|
|
423
|
+
"--write-roadmap": "also refresh tracked roadmap files here", "--close-settled-issues": "also close settled issues (authority needed)",
|
|
401
424
|
// daemon, agents and recovery
|
|
402
|
-
"--unattended": "no permission prompts; the agent acts alone", "--no-console": "do not enter the console", "--no-agents": "do not start the default agents", "--panels": "start in panels mode",
|
|
425
|
+
"--unattended": "no permission prompts; the agent acts alone", "--runtime": "the runtime root this host serves", "--add-current": "add this project when the host starts", "--no-console": "do not enter the console", "--no-agents": "do not start the default agents", "--wait": "attach wait in seconds (default 15, max 600)", "--panels": "start in panels mode",
|
|
403
426
|
"--no-pet": "turn the attention pet off", "--short": "print ahub!N only when action is needed", "--palette": "retired: run acon ui and open Mini", "pet --window": "retired: run acon ui and open Mini", "--close": "retired: no window is opened", "-f": "follow new lines",
|
|
404
|
-
"--stale-anchors": "report stale memory symbol anchors", "--orphans": "inspect registrations whose root is gone", "--kill": "stop the selected orphan's hub", "--revoke": "withdraw a trusted version",
|
|
427
|
+
"--stale-anchors": "report stale memory symbol anchors", "--orphans": "inspect registrations whose root is gone", "--kill": "stop the selected orphan's hub", "--revoke": "withdraw a trusted version", "--pull": "add a pull kind, print its registration", "--latest": "read the newest release's table; person only",
|
|
405
428
|
"--fresh-session": "restart the peer as a new session", "--stop-and-archive": "stop its targets and archive the snapshot", "--print-command": "print the launch command, start nothing", "--as": "name of the extra instance",
|
|
406
429
|
"--mode": "tui or headless", "--session-id": "session id to resume or pin", "--provider-profile": "Jcode provider profile to use", "--headless": "run without a terminal", "--backend": "Pi backend: auto, dgx or mlx",
|
|
407
430
|
"--session-file": "Pi session file to open", "--replace-session": "replace the saved session", "--route": "routing.toml route to use", "--group": "only this catalog group", "--no-thoughts": "hide the peer's reasoning lines",
|
|
@@ -420,21 +443,22 @@ export const FLAG_DESCRIPTIONS: Readonly<Record<string, string>> = {
|
|
|
420
443
|
"--campaign": "campaign id", "--events-after": "continue its events after this number", "--plan": "plan hash to compare under", "--baseline": "baseline attempt id", "--approved": "only approved tasks",
|
|
421
444
|
"--check": "measure the files now, mark changed ones", "--unmet": "criterion not met (repeatable)", "--head": "head commit SHA the verdict is for", "--findings": "findings as JSON", "--security-pass": "security pass result as JSON",
|
|
422
445
|
// history, reports and memory
|
|
446
|
+
"--reset": "renew quota after a reset on the same account", "--switched": "renew quota after changing accounts",
|
|
423
447
|
"--remember": "also save the answer to memory", "--resets-in": "when the window resets, such as 30m", "--window": "5h or week", "--root": "execution root reference as JSON", "--task-scope": "task the root is scoped to",
|
|
424
448
|
"--nodes": "at most this many nodes", "--edges": "at most this many edges", "--bytes": "at most this many bytes", "--ref": "execution reference as JSON", "--from": "reference the link comes from, as JSON",
|
|
425
449
|
"--context": "also drop a Codex turn from its conversation", "--dogfood": "print the dogfood scorecard", "--dataset": "directory for the per-project datasets", "--arm": "label of the arm being run", "--repeat": "attempts per task",
|
|
426
|
-
"--tasks": "run only these tasks (a,b)", "--addon": "declare an add-on: name=on or name=off", "--suite": "suite to compare", "--mixed": "compare across suites", "--tier": "short or long term", "--kind": "decision, contract, fail or finding",
|
|
450
|
+
"--tasks": "run only these tasks (a,b)", "--addon": "declare an add-on: name=on or name=off", "--suite": "suite to compare", "--mixed": "compare across suites", "--tier": "short or long term", "--kind": "decision, contract, fail or finding", "--older-than": "only entries not changed for this many days",
|
|
427
451
|
"--machine": "only entries from this machine", "--hops": "graph depth: 1 or 2", "--history": "include superseded and expired entries", "--ungrouped": "show individual same-task search hits", "--as-of": "memory as it stood at this time", "--remote": "private git remote to sync with",
|
|
428
452
|
"--db": "claude-mem database to read", "--restart": "revisit rows skipped under an earlier policy", "--days": "older than this many days (default 90)", "--depends": "goal it depends on (repeatable)", "--shared": "share the goal across machines",
|
|
429
453
|
"--force": "void other machines' claims", "--no-open": "print the link, do not open it", "--settings": "open with a settings session", "--stop": "stop the dashboard manager", "--hook": "run as a Claude Code hook; never blocks",
|
|
430
454
|
// a flag one command uses for something other than its own entry
|
|
431
|
-
"--all": "include everything, not the default subset", "status --all": "every registered project", "ui --all": "the unified project dashboard", "reset --all": "archive the state directory instead", "queue --all": "include rows already settled",
|
|
455
|
+
"--all": "include everything, not the default subset", "sdlc --all": "also list settled tasks (the first 100)", "status --all": "every registered project", "ui --all": "the unified project dashboard", "reset --all": "archive the state directory instead", "queue --all": "include rows already settled",
|
|
432
456
|
"learn --all": "include decided candidates", "learn --accepted": "the followed checklist lines and their status", "research --all": "every registered project", "goal --all": "include completed goals", "sdlc --mode": "off or advise", "sdlc --profile": "audit depth: quick or standard",
|
|
433
457
|
"sdlc --since": "git ref, or a date for metrics", "memory --since": "only entries since this ISO time", "memory --label": "name for this machine", "bench --memory": "memory state: off, claude-mem, native or both",
|
|
434
458
|
"task --model": "model label the verdict was given under", "room --action": "accept or discard the application", "room --label": "label for your member", "room --confirm": "member fingerprint prefix",
|
|
435
459
|
"worktrees --confirm": "fingerprint of the preview to run", "board --label": "only issues with this label", "board --milestone": "only issues of this milestone", "board --repo": "repository to import from", "goal --milestone": "milestone of the goal (repeatable)",
|
|
436
|
-
"broker --owner": "owner fingerprint allowed (repeatable)", "study --after": "continue after this id", "--live-test --project": "project to run the command in", "task --project": "project to hand the work to",
|
|
437
|
-
"task --revision": "refuse if the task has moved on", "study --revision": "revision of the evidence to read", "usage --by": "peer, task, issue, pr, release, day or model", "report --by": "group by task", "check-path --peer": "the peer asking (default: this one)",
|
|
460
|
+
"broker --owner": "owner fingerprint allowed (repeatable)", "releases --kind": "capture, source or registry install", "study --after": "continue after this id", "--live-test --project": "project to run the command in", "task --project": "project to hand the work to",
|
|
461
|
+
"task --revision": "refuse if the task has moved on", "agents --as": "kind name to write instead of the preset id", "study --revision": "revision of the evidence to read", "usage --by": "peer, task, issue, pr, release, day or model", "report --by": "group by task", "check-path --peer": "the peer asking (default: this one)",
|
|
438
462
|
};
|
|
439
463
|
/** The widest a flag's line may be, except the standard's two flags: it sits beside the longest label (30 cells and a gap) within 80 columns. */
|
|
440
464
|
export const FLAG_LINE = 46;
|
package/src/cli/identity.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { conductorOperation, OPERATIONAL_PERSON_GUIDANCE } from "../hub/operational-authority.ts";
|
|
2
2
|
import { nativeCliMarkerPeer } from "../adapters/definitions/native-identity-defaults.ts";
|
|
3
3
|
import { recoveryPresentationFlag } from "./recovery-presentation-options.ts";
|
|
4
|
-
import {
|
|
4
|
+
import { declaredKind } from "../adapters/declaration-resolution.ts";
|
|
5
|
+
import { NATIVE_ADAPTER_POLICY } from "../adapters/definitions/native-adapter-policy.ts";
|
|
6
|
+
import { isBuiltinAdapterKind } from "../adapters/definitions/native-help.ts";
|
|
7
|
+
import type { AdapterDefinition, KindMap, ProjectAdapterCatalog } from "../adapters/registry-types.ts";
|
|
8
|
+
|
|
9
|
+
const builtinKinds = { has: isBuiltinAdapterKind };
|
|
10
|
+
|
|
11
|
+
function builtinCliPolicy(kind: string): Pick<AdapterDefinition, "cli"> | undefined {
|
|
12
|
+
return isBuiltinAdapterKind(kind) ? NATIVE_ADAPTER_POLICY[kind] : undefined;
|
|
13
|
+
}
|
|
14
|
+
|
|
5
15
|
|
|
6
16
|
/** Recovery reads this declaration before delegating to another package's CLI. */
|
|
7
17
|
export const LIVE_TEST_SUPPORTED = true;
|
|
@@ -14,17 +24,23 @@ function recoveryAction(args: readonly string[]): string | undefined {
|
|
|
14
24
|
export const LIVE_TEST_PERSON_REFUSAL = "live-test cannot write person-attributed content; use peer tools or a person's terminal";
|
|
15
25
|
|
|
16
26
|
/** Person verdicts and user-authored workflow content are never delegated. */
|
|
27
|
+
const isBudgetRenewal = (command: string, args: readonly string[]): boolean =>
|
|
28
|
+
command === "budget" && args.find(arg => !["--json", "--full", "--ascii"].includes(arg) && !arg.startsWith("--color=")) === "renew";
|
|
29
|
+
|
|
17
30
|
export function liveTestRefusal(command: string, args: readonly string[], context: { repairedFresh?: boolean } = {}): boolean {
|
|
18
31
|
if (command === "roadmap" && ![undefined, "list", "show", "--json"].includes(args[0])) return true;
|
|
19
32
|
if (command === "roadmap" && args[0] === "--json" && ![undefined, "list", "show"].includes(args[1])) return true;
|
|
20
33
|
if (command === "sdlc" && args[0] === "configure") return true;
|
|
21
34
|
// #1540: retargeting a stopped project's runtime or every stopped one is the person's choice of which code runs next; an agent shell must not reach it through `--live-test`.
|
|
22
35
|
if (command === "upgrade" && args.includes("--all-stopped")) return true;
|
|
36
|
+
// #1781: removing shared release entries across every project is the person's act; an agent shell must not reach `releases prune --apply` through `--live-test`. Preview and `releases list` stay delegable.
|
|
37
|
+
if (command === "releases" && args[0] === "prune" && args.includes("--apply")) return true;
|
|
23
38
|
if (command === "lineage" && args[0] === "link") return true;
|
|
24
39
|
if (command === "guidance" && ["create", "withdraw"].includes(args[0] ?? "")) return true;
|
|
25
40
|
if (command === "sdlc" && args[0] === "survey" && args[1] !== "show") return true;
|
|
26
41
|
// #1403 A4: starting a security audit files a task; only `show` stays a live-test read.
|
|
27
42
|
if (command === "sdlc" && args[0] === "audit" && args[1] !== "show") return true;
|
|
43
|
+
if (isBudgetRenewal(command, args)) return true;
|
|
28
44
|
if (command === "model") return true; // #1317: even listing runtime overrides is person-only, never live-test delegated.
|
|
29
45
|
if (command === "sdlc" && (args[0] === "authorize-release" || args[0] === "plan-review" || args[0] === "release-assign" || args[0] === "merge" || args[0] === "train" && args[1] !== "report")) return true;
|
|
30
46
|
if (args.some(arg => arg === "--as-user" || arg.startsWith("--as-user="))) return true;
|
|
@@ -46,6 +62,8 @@ export function liveTestRefusal(command: string, args: readonly string[], contex
|
|
|
46
62
|
// #1057: removing a worktree and its branch is the person's own act, in their own terminal; no delegation, live-test or otherwise, may confirm a tidy.
|
|
47
63
|
|| (command === "worktrees" && args.some(arg => arg === "--confirm" || arg.startsWith("--confirm=")))
|
|
48
64
|
|| (command === "agents" && !args.every(arg => arg === "--json"))
|
|
65
|
+
// #1811 T4: reading Orca for account labels is the person's own step; an agent shell never imports account declarations.
|
|
66
|
+
|| command === "accounts"
|
|
49
67
|
// #1053: an answer is the person's choice, recorded as the person's; an agent that could run it through `--live-test` would answer its own hub_ask as the person. Any operand answers (the set, a pick, --other); a bare listing stays allowed.
|
|
50
68
|
|| (command === "answer" && args.some(arg => arg !== "--json" && arg !== "--full" && !arg.startsWith("--color=")))
|
|
51
69
|
// #1054: a receipt is the person's record that they read a result and clears their unread need; no delegation, live-test or otherwise, may write one. A plain listing stays allowed.
|
|
@@ -73,7 +91,7 @@ export function detectCliIdentity(env: Readonly<Record<string, string | undefine
|
|
|
73
91
|
if (session !== undefined && claude === undefined) return invalid("CLAUDE_CODE_SESSION_ID without CLAUDECODE marker");
|
|
74
92
|
if (claude !== undefined && codex !== undefined) return invalid("conflicting native agent markers");
|
|
75
93
|
const native = nativeCliMarkerPeer(claude !== undefined, codex !== undefined);
|
|
76
|
-
if (hub !== undefined && native !== undefined && (
|
|
94
|
+
if (hub !== undefined && native !== undefined && (isBuiltinAdapterKind(hub) ? hub : declaredKind(hub, instances, builtinKinds) ?? hub) !== native) return invalid("AGENTHUB_PEER_ID conflicts with native agent marker");
|
|
77
95
|
const peer = hub ?? native;
|
|
78
96
|
return peer === undefined ? { role: "console" } : { role: "tools", peer };
|
|
79
97
|
}
|
|
@@ -163,7 +181,7 @@ const isPeerReadForm = (command: string, args: readonly string[]): boolean => {
|
|
|
163
181
|
export function classifyPeerCommand(command: string, args: readonly string[], catalog?: ProjectAdapterCatalog): PeerCommandAccess {
|
|
164
182
|
if (command === "model") return "console";
|
|
165
183
|
if (command === "recovery" && recoveryAction(args) === "reattach") return "console";
|
|
166
|
-
const native = catalog?.definitionOf(command) ??
|
|
184
|
+
const native = catalog?.definitionOf(command) ?? builtinCliPolicy(command);
|
|
167
185
|
if (native?.cli.personOnlyFlags?.some(flag => args.includes(flag))) return "console";
|
|
168
186
|
if (command === "permission" || command === "watch") return "console";
|
|
169
187
|
if (args.some((arg) => arg === "--as-user" || arg.startsWith("--as-user="))) return "console";
|
|
@@ -199,6 +217,7 @@ export function classifyPeerCommand(command: string, args: readonly string[], ca
|
|
|
199
217
|
if (command === "route") return args[0] === "explain" ? "allowed" : "console";
|
|
200
218
|
// #691: reading agent CLI versions is harmless; trusting an untested version on this machine is a person's.
|
|
201
219
|
if (command === "agents") return args.every(arg => arg === "--json") ? "allowed" : "console";
|
|
220
|
+
if (command === "accounts") return "console";
|
|
202
221
|
// #247: reading the research measures and records is harmless (ids and counts only); #933 made backfill a conductor operation (above).
|
|
203
222
|
if (command === "research") return args[0] === "backfill" ? "console" : "allowed";
|
|
204
223
|
// #1522 (hub task 969): an agent shell runs the memory family as itself. The CLI wraps the writers in amem's agent attribution (`memoryCommand`), so the recorded and displayed actor is the agent, never the person.
|
|
@@ -237,12 +256,15 @@ export function cliCommandLabel(command: string, args: readonly string[], catalo
|
|
|
237
256
|
if (command === "lineage") return ["show", "link"].includes(args[0] ?? "") ? `lineage ${args[0]}` : "lineage";
|
|
238
257
|
if (command === "guidance") return ["create", "list", "show", "withdraw"].includes(args[0] ?? "") ? `guidance ${args[0]}` : "guidance";
|
|
239
258
|
if (command === "model") return ["list", "set", "clear"].includes(args[0] ?? "") ? `model ${args[0]}` : "model";
|
|
259
|
+
if (isBudgetRenewal(command, args)) return "budget renew";
|
|
240
260
|
if (command === "peer") return args[0] === "takeover" ? "peer takeover" : "peer";
|
|
241
261
|
if (command === "backlog") return ["list", "add", "pull", "pull-ready", "split", "return", "plan", "pin", "undo"].includes(args[0] ?? "") ? `backlog ${args[0]}` : "backlog";
|
|
242
262
|
if (command === "board" && args[0] === "import") return "board import";
|
|
243
263
|
// #508: the registry's two forms are named in the audit and in a refusal, never their operands (a path or a URL can carry a secret).
|
|
244
264
|
if (command === "smoke") return args[0] === "run" ? "smoke run" : "smoke";
|
|
245
265
|
if (command === "broker") return args[0] === "serve" ? "broker serve" : args[0] === "room" && args[1] === "drop" ? "broker room drop" : "broker";
|
|
266
|
+
// #1781: the audit and a refusal name the subcommand only, never a flag value.
|
|
267
|
+
if (command === "releases") return ["list", "prune"].includes(args[0] ?? "") ? `releases ${args[0]}` : "releases";
|
|
246
268
|
if (command === "room" && args[0] === "inbox") return ["show", "done", "discard"].includes(args[1] ?? "") && args[2] && args[2] !== "--json" ? `room inbox ${args[1]}` : "room inbox list";
|
|
247
269
|
if (command === "room") return ["create", "invite", "join", "leave", "revoke", "expose", "resolve", "list", "status"].includes(args[0] ?? "") ? `room ${args[0]}` : "room";
|
|
248
270
|
// #335: a schedule id is config text, so the audit names the subcommand only.
|
|
@@ -261,12 +283,13 @@ export function cliCommandLabel(command: string, args: readonly string[], catalo
|
|
|
261
283
|
if (command === "usage") return args[0] === "limits" || args[0] === "total" ? `usage ${args[0]}` : "usage";
|
|
262
284
|
if (command === "deliverables") return "deliverables";
|
|
263
285
|
if (command === "title") return "title";
|
|
286
|
+
if (command === "structure") return args[0] === "check" || args[0] === "baseline" ? `structure ${args[0]}` : "structure";
|
|
264
287
|
// #1054: a result id is the hub's, but the audit names the action only, never the id.
|
|
265
288
|
if (command === "results") return ["--read-all", "--unread-last"].find(flag => args.includes(flag))?.slice(2) ? `results ${["--read-all", "--unread-last"].find(flag => args.includes(flag))!.slice(2)}` : args.includes("--read") || args.some(arg => arg.startsWith("--read=")) ? "results read" : "results";
|
|
266
289
|
if (command === "specs") return ["list", "check", "covers", "stamp"].includes(args[0] ?? "") ? `specs ${args[0]}` : "specs";
|
|
267
290
|
// #1057: the audit names the subcommand and whether it confirms, never a path, a branch or a fingerprint.
|
|
268
291
|
if (command === "worktrees") return args[0] === "tidy" ? (args.some(arg => arg === "--confirm" || arg.startsWith("--confirm=")) ? "worktrees tidy confirm" : "worktrees tidy") : "worktrees";
|
|
269
|
-
if (!(catalog?.definitionOf(command) ??
|
|
292
|
+
if (!(catalog?.definitionOf(command) ?? builtinCliPolicy(command)) && !["accounts", "upgrade", "restart", "recovery", "recovery-run", "help", "--help", "--version", "version", "completion", "projects", "ui", "manager", "setup", "init", "daemon", "host", "up", "console", "stop", "roles", "models", "say", "queue", "tail", "watch", "budget", "board", "task", "review", "remember", "ask", "route", "pause", "resume", "permit", "answer", "permission", "results", "settings", "roster", "status", "pet", "logs", "export", "report", "research", "memory", "goal", "bench", "sdlc", "role", "facts", "instruction-hook", "instructed", "check-path", "turns", "undo", "kill", "down", "reset", "doctor", "agents", "source", "releases", "broker", "schedule", "intake", "learn", "study"].includes(command)) return "unknown";
|
|
270
293
|
if (["task", "queue", "budget", "route", "recovery", "models", "projects", "research", "memory", "goal", "bench", "agents", "roster", "settings"].includes(command)) {
|
|
271
294
|
const sub = command === "bench" || command === "memory" || command === "goal" ? args.find((arg) => arg !== "--json") : args[0];
|
|
272
295
|
if (sub && ["propose", "show", "assign", "unassign", "escalate", "cancel", "claim", "label", "list", "add", "resolve", "resume", "set", "execution", "explain", "status", "abort", "dispose", "reattach", "setup", "start", "stop", "remove", "discard", "export", "backfill", "addons", "run", "report", "compare", "search", "graph", "promote", "demote", "forget", "supersede", "dedupe", "decay", "rebuild", "sync", "machine", "import", "suggestions", "confirm", "reject", "new", "link", "state", "done", "take", "trust"].includes(sub)) return `${command} ${sub}`;
|
package/src/cli/init-prompt.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { INIT_SETTINGS, TRACK_CONFIG, SDLC_MODES, SPEC_REVIEW_MODES, COORDINATIO
|
|
|
14
14
|
import { readFileSync } from "node:fs";
|
|
15
15
|
import { join } from "node:path";
|
|
16
16
|
import { PROFILE_NAMES } from "../hub/profiles.ts";
|
|
17
|
-
import { DEFAULT_CONFIG } from "../hub/
|
|
17
|
+
import { DEFAULT_CONFIG } from "../hub/config.ts";
|
|
18
18
|
import { DEFAULT_SPECS_CONFIG } from "../hub/specs-config.ts";
|
|
19
19
|
import { START_AGENTS_ALLOWED, START_AGENTS_DEFAULT } from "../hub/start-agents.ts";
|
|
20
20
|
import { NO_CONDUCTOR, PERSON_REVIEWS, ROLE_FLAGS, eligiblePeers, parseRoleFlag, roleKeyOf, type RoleFlag } from "./init-roles.ts";
|