@staix/agent-hub 0.44.0 → 0.46.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 +66 -0
- package/README.md +12 -11
- package/docs/adding-an-ai-tool.md +1 -0
- package/docs/agent-notes/adapters.md +35 -6
- package/docs/agent-notes/budget.md +2 -1
- package/docs/agent-notes/daemon.md +5 -1
- package/docs/agent-notes/local-worker.md +1 -1
- package/docs/agent-notes/security-review.md +3 -2
- package/docs/agent-notes/tasks.md +6 -2
- package/docs/agent-notes/tests.md +4 -3
- package/docs/design/adapters.md +20 -2
- package/docs/design/agent-hub-architecture.md +12 -0
- package/docs/design/agent-hub.md +1 -1
- package/docs/design/cli-output.md +2 -0
- package/docs/design/roadmap.md +158 -4
- package/docs/design/supervision.md +21 -1
- package/docs/design/task-board.md +32 -4
- package/docs/dogfood.md +28 -4
- package/docs/events.md +7 -3
- package/docs/influences.md +7 -0
- package/docs/memory.md +4 -4
- package/docs/operations.md +151 -36
- package/docs/quickstart.md +16 -4
- package/docs/research.md +16 -0
- package/docs/roadmap.json +4 -0
- package/docs/roadmap.md +9 -0
- package/docs/sdlc.md +15 -3
- package/docs/security.md +9 -7
- package/docs/smoke.md +1 -1
- package/docs/verification/2026-11-05-hardcoded-values-classification-rules.md +28 -0
- package/docs/verification/2026-11-19-claude-implementer-2.1.328.md +49 -0
- package/docs/verification/2026-11-20-claude-implementer-2.1.329.md +49 -0
- package/docs/verification/2026-11-20-sdlc-metrics-diagnosis.md +7 -0
- package/docs/verification/2026-11-21-0.45.0.md +69 -0
- package/docs/verification/2026-11-22-agy-1.5.14.md +27 -0
- package/docs/verification/2026-11-22-claude-instruction-hook.md +35 -0
- package/docs/verification/2026-11-22-codex-0171-reviewer-isolation.md +47 -0
- package/docs/verification/2026-11-22-instructed-ipc.md +9 -0
- package/docs/verification/2026-11-22-jcode-1.0.3.md +71 -0
- package/docs/verification/2026-11-22-jcode-separate-home.md +14 -0
- package/docs/verification/2026-11-22-qwen-0283-acp.md +28 -0
- package/docs/verification/2026-11-22-qwen-0283-dual-output.md +33 -0
- package/docs/verification/2026-11-22-roadmap-r5-view-receipt.md +63 -0
- package/docs/verification/2026-11-23-0.46.0.md +44 -0
- package/docs/verification/assets/1483-r5-detail-1440-light.png +0 -0
- package/docs/verification/assets/1483-r5-detail-390-light.png +0 -0
- package/docs/verification/assets/1483-r5-view-1440-dark.png +0 -0
- package/docs/verification/assets/1483-r5-view-1440-light.png +0 -0
- package/docs/verification/assets/1483-r5-view-390-dark.png +0 -0
- package/docs/verification/assets/1483-r5-view-390-light.png +0 -0
- package/docs/verification/assets/1483-r5-view-820-dark.png +0 -0
- package/docs/verification/assets/1483-r5-view-820-light.png +0 -0
- package/docs/verified.json +33 -27
- package/package.json +3 -2
- package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
- package/plugins/agent-hub/kimi-hook.js +4743 -4048
- package/plugins/agent-hub/kimi-review-policy-worker.js +5 -5
- package/plugins/agent-hub/server.js +1641 -1265
- package/plugins/agent-hub/skills/ahub/SKILL.md +17 -0
- package/plugins/agent-hub/skills/ahub-manage/SKILL.md +37 -0
- package/plugins/agent-hub/skills/ahub-status/SKILL.md +14 -0
- package/plugins/agent-hub/skills/ahub-use/SKILL.md +12 -0
- package/scripts/check-docs.mjs +9 -1
- package/src/adapters/acp.ts +11 -1
- package/src/adapters/claude-channel.ts +2 -1
- package/src/adapters/compat.ts +15 -14
- package/src/adapters/definitions/builtin-metadata.ts +2 -2
- package/src/adapters/definitions/native-cli-claude-setup.ts +9 -1
- package/src/adapters/definitions/native-cli-doctor.ts +8 -5
- package/src/adapters/definitions/native-cli-jcode-home-init.ts +158 -0
- package/src/adapters/definitions/native-cli-jcode-home.ts +72 -0
- package/src/adapters/definitions/native-cli-jcode-mcp.ts +20 -0
- package/src/adapters/definitions/native-cli-skills.ts +29 -0
- package/src/adapters/definitions/native-context.ts +10 -0
- package/src/adapters/jcode.ts +10 -0
- package/src/adapters/local-worker.ts +3 -2
- package/src/adapters/pi.ts +15 -4
- package/src/cli/claude-profile-hook.ts +40 -3
- package/src/cli/console-state.ts +58 -27
- package/src/cli/console-usage.ts +5 -3
- package/src/cli/console.ts +35 -4
- package/src/cli/help.ts +17 -10
- package/src/cli/identity.ts +4 -2
- package/src/cli/instruction-hook.ts +28 -0
- package/src/cli/jcode-mcp.ts +2 -1
- package/src/cli/main.js +8 -0
- package/src/cli/main.ts +149 -23
- package/src/cli/output-standard.ts +3 -55
- package/src/cli/output.ts +8 -2
- package/src/cli/recovery-package.ts +62 -13
- package/src/cli/roadmap-write.ts +59 -0
- package/src/cli/roadmap.ts +115 -4
- package/src/cli/sdlc-output.ts +4 -0
- package/src/cli/setup-homes.ts +1 -0
- package/src/cli/setup.ts +1 -1
- package/src/cli/skills-install.ts +463 -0
- package/src/cli/task-output.ts +1 -1
- package/src/cli/upgrade-presentation-flags.ts +1 -1
- package/src/cli/upgrade-runtime.ts +10 -6
- package/src/hub/agent-mem-range.ts +43 -0
- package/src/hub/board.ts +144 -5
- package/src/hub/budget-projection.ts +99 -0
- package/src/hub/check-runner.ts +25 -1
- package/src/hub/claude-launch-proof.ts +5 -1
- package/src/hub/conductor.ts +8 -3
- package/src/hub/config-apply.ts +6 -3
- package/src/hub/config-tier.ts +1 -1
- package/src/hub/config-trust.ts +1 -1
- package/src/hub/context-window.ts +1 -1
- package/src/hub/control-client.ts +9 -2
- package/src/hub/cost-governance.ts +11 -7
- package/src/hub/daemon.ts +707 -53
- package/src/hub/dogfood-read.ts +4 -2
- package/src/hub/edit-guard.ts +100 -0
- package/src/hub/events.ts +80 -9
- package/src/hub/execution-budget.ts +29 -8
- package/src/hub/facts.ts +57 -4
- package/src/hub/hub-tools.ts +3 -1
- package/src/hub/inference.ts +1 -1
- package/src/hub/instances.ts +10 -1
- package/src/hub/instructed-exact.ts +95 -0
- package/src/hub/instructed-intent.ts +64 -0
- package/src/hub/instructed-ipc.ts +33 -0
- package/src/hub/instructed-runtime.ts +19 -0
- package/src/hub/instruction-receipt.ts +218 -0
- package/src/hub/lifecycle.ts +6 -1
- package/src/hub/log-rotation.ts +130 -0
- package/src/hub/manager.ts +46 -3
- package/src/hub/memory-profile.ts +137 -21
- package/src/hub/no-writes.ts +1 -0
- package/src/hub/operational-authority.ts +3 -2
- package/src/hub/operational-settings.ts +2 -2
- package/src/hub/recovery-store.ts +49 -21
- package/src/hub/registry.ts +1 -1
- package/src/hub/research-experiments.ts +132 -0
- package/src/hub/research-quality.ts +8 -2
- package/src/hub/research-record.ts +35 -0
- package/src/hub/research.ts +128 -28
- package/src/hub/roadmap-check.ts +65 -0
- package/src/hub/roadmap-decompose.ts +139 -0
- package/src/hub/roadmap-export.ts +27 -0
- package/src/hub/roadmap-sync.ts +97 -0
- package/src/hub/roadmap.ts +59 -1
- package/src/hub/routing.ts +18 -1
- package/src/hub/runtime-capture-prune.ts +2 -1
- package/src/hub/sdlc-branch-ci.ts +128 -0
- package/src/hub/sdlc-merge.ts +6 -3
- package/src/hub/sdlc-metrics.ts +19 -5
- package/src/hub/sdlc.ts +73 -5
- package/src/hub/settings.ts +3 -1
- package/src/hub/snapshots.ts +13 -1
- package/src/hub/startup-event-seeds.ts +21 -15
- package/src/hub/startup-timing.ts +3 -1
- package/src/hub/supervision-proposals.ts +10 -2
- package/src/hub/supervision-rules.ts +26 -3
- package/src/hub/supervision.ts +7 -0
- package/src/hub/task-pr.ts +47 -0
- package/src/hub/task-worktree.ts +18 -11
- package/src/hub/tasks.ts +694 -44
- package/src/hub/ui.ts +6 -2
- package/src/hub/usage-rollup.ts +77 -22
- package/src/local/tools.ts +13 -1
- package/src/memory/client.ts +3 -2
- package/src/pi/extension.ts +15 -3
- package/src/pi/tool-receipts.ts +26 -0
- package/src/ui/index.html +342 -8
- package/src/ui/plugin.ts +6 -2
- package/src/ui/roadmap-model.ts +70 -0
package/src/cli/main.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
+
import { INSTRUCTION_CONTROL_TIMEOUT_MS } from "../hub/instructed-exact.ts";
|
|
2
3
|
import { assertConductorOperationLocal, authorizeConductorOperation, authorizeConductorLaunch, issueConductorOperation, preflightConductorRecovery, retireConductorOperation } from "./conductor-recovery.ts";
|
|
3
4
|
import { runtimePruneHealth } from "../hub/runtime-prune-health.ts";
|
|
4
5
|
import { conductorLocalOperation, conductorOperation, OPERATIONAL_PERSON_GUIDANCE } from "../hub/operational-authority.ts";
|
|
5
6
|
import { sayRecipients } from "./say-input.ts";
|
|
6
7
|
import { parseAnswerArgs } from "./answer-args.ts";
|
|
7
8
|
import { parseRoadmapArgs, renderRoadmap } from "./roadmap.ts";
|
|
9
|
+
import { roadmapWorktree, writeRoadmap } from "./roadmap-write.ts";
|
|
8
10
|
import type { DeliverableRow } from "../hub/tasks.ts";
|
|
9
11
|
import { kimiSourceRow } from "../hub/budget-notes.ts";
|
|
10
12
|
import { hubGitSync, hubGitEnv } from "../hub/git.ts";
|
|
@@ -57,13 +59,13 @@ import { projectProfile, resolveProfile } from "../hub/profiles.ts";
|
|
|
57
59
|
import { catalogAssignments, loadRoleCatalog, selectedRoles } from "../hub/roles.ts";
|
|
58
60
|
import { attachWatch } from "./watch.ts";
|
|
59
61
|
import { verifiedJcodeCommand } from "../adapters/jcode.ts";
|
|
60
|
-
import { configureJcodeMcp, jcodeExtraMcpServers } from "./jcode-mcp.ts";
|
|
62
|
+
import { configureJcodeMcp, jcodeExtraMcpServers, splitJcodeMcpServers } from "./jcode-mcp.ts";
|
|
61
63
|
import { qwenSessionId } from "../hub/crash.ts";
|
|
62
64
|
import { isPermissionMode } from "../hub/permission-mode.ts";
|
|
63
65
|
import { parseSettingText, settingDef, settingText, undoableDef, type SettingRow } from "../hub/settings.ts";
|
|
64
66
|
import { startModeOf } from "../hub/start-mode.ts";
|
|
65
67
|
import { rolesRow } from "./role-doctor.ts";
|
|
66
|
-
import { currentRouting, OVERLAY_FILE, parseOverlay, parseRouting, routingText, type Routing, type RoutingOverlay } from "../hub/routing.ts";
|
|
68
|
+
import { classListRow, currentRouting, loadRouting, OVERLAY_FILE, parseOverlay, parseRouting, routingText, type Routing, type RoutingOverlay } from "../hub/routing.ts";
|
|
67
69
|
import { spawn, spawnSync } from "node:child_process";
|
|
68
70
|
import { chmodSync, closeSync, constants, existsSync, fstatSync, openSync, readFileSync, readSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
69
71
|
import { randomUUID } from "node:crypto";
|
|
@@ -72,6 +74,7 @@ import { basename, dirname, join, relative, resolve } from "node:path";
|
|
|
72
74
|
import { retryLaunchConnect, ControlClient, readControl } from "../hub/control-client.ts";
|
|
73
75
|
import { loadConfig } from "../hub/daemon.ts";
|
|
74
76
|
import { factsHook } from "./facts-hook.ts";
|
|
77
|
+
import { parseInstructionHook } from "./instruction-hook.ts";
|
|
75
78
|
import { hubHome, projectContext, projectRoot, realPath } from "../hub/project.ts";
|
|
76
79
|
import { Registry, type Project } from "../hub/registry.ts";
|
|
77
80
|
import { datasetInputFor, exportResearchDataset, projectFamilyOf } from "../hub/research-dataset.ts";
|
|
@@ -89,7 +92,9 @@ import { loadPacks } from "../hub/packs.ts";
|
|
|
89
92
|
import { launcherPreview } from "./preview.ts";
|
|
90
93
|
import { instanceLaunchArguments, requirePeerInstances, requireActiveInstance, cleanupStaleClaudeSettings, cleanupClaudeSettings, buildLaunch, buildKimiTuiLaunch, claudeObservationHooks, nativeLaunchEnv, recordClaudeLaunch, runClaudeLaunch, type ClaudeLaunchRecord, UNATTENDED_WARNING } from "./launch.ts";
|
|
91
94
|
import { configureKimiMcp } from "./kimi-mcp.ts";
|
|
92
|
-
import { nextStep, parseList, pluginState, type InstalledPlugin, type Marketplace } from "./setup.ts";
|
|
95
|
+
import { HUB_SKILL_NAMES, hubSkillsPresent, nextStep, parseList, pluginState, type InstalledPlugin, type Marketplace } from "./setup.ts";
|
|
96
|
+
import { installHubSkills, skillHostStates, skillStateRow } from "./skills-install.ts";
|
|
97
|
+
import { applyJcodeHome, installHubSkillsInJcodeHomes, installSkillsInJcodeHome, jcodeHomeBlocked, jcodeHomeSkillStates, jcodeSkillHomes, planJcodeHomeInit, rosterPreflight, rosterPreflightLines, writeJcodeHomeConfig } from "../adapters/definitions/native-cli-jcode-home-init.ts";
|
|
93
98
|
import { CLASSES } from "../hub/board.ts";
|
|
94
99
|
import { VERSION } from "../version.ts";
|
|
95
100
|
import { freeText, unknownOption, unknownOptionRefusal, withoutSeparator } from "./free-text.ts";
|
|
@@ -122,7 +127,7 @@ import { runSpecs, runSpecsStamp } from "./specs.ts";
|
|
|
122
127
|
import { confirmTidy, planTidy, realTidyGit, rowsFromReply, type TidyGit } from "./worktree-tidy.ts";
|
|
123
128
|
import { renderTidyPreview, renderTidyResult, renderWorktrees } from "./worktrees-output.ts";
|
|
124
129
|
import { formatMemoryStaleAnchors } from "../hub/memory-stale-anchors.ts";
|
|
125
|
-
import {
|
|
130
|
+
import { AGENT_MEM_REFUSAL, AGENT_MEM_VERSION, memoryIndexExists, selectedMemoryProfile } from "../hub/memory-profile.ts";
|
|
126
131
|
import { checkMemoryProfiles, formatMemoryProfileCheck } from "../hub/memory-profile-check.ts";
|
|
127
132
|
import { addonReport, appendRecords, closedAtOf, formatAddons, formatResearch, LABELS, labelTarget, RESEARCH_SCHEMA, projectKey, readStores, researchReport, taskRecords, toCsv, type Label, type TaskRecord } from "../hub/research.ts";
|
|
128
133
|
import { summarize, summarizeByTask } from "../hub/report.ts";
|
|
@@ -352,7 +357,7 @@ try { process.chdir(cwd); } catch { fail(`project directory is unavailable: ${cw
|
|
|
352
357
|
function outputOptions(source: readonly string[] = args) {
|
|
353
358
|
const flags = source.filter(arg => arg.startsWith("--color="));
|
|
354
359
|
if (flags.length > 1 || source.includes("--color")) fail(`usage: ahub ${cmd} [--color=auto|always|never] [--json] [--full]`);
|
|
355
|
-
const color = resolveColor(flags[0]?.slice("--color=".length), streamEnv(!!process.stdout.isTTY));
|
|
360
|
+
const color = resolveColor(flags[0]?.slice("--color=".length), streamEnv(!!process.stdout.isTTY), "ahub");
|
|
356
361
|
if (color instanceof Error) fail(`usage: ahub ${cmd} [--color=auto|always|never] [--json] [--full]`);
|
|
357
362
|
return { color: color === true, json: source.includes("--json"), full: source.includes("--full"), verbose: source.includes("--verbose"),
|
|
358
363
|
columns: outputWidth({ isTTY: !!process.stdout.isTTY, columns: process.stdout.columns, COLUMNS: process.env.COLUMNS }) };
|
|
@@ -413,6 +418,11 @@ const connect = async (timeoutMs = 3000) => {
|
|
|
413
418
|
|
|
414
419
|
const connectLaunch = () => retryLaunchConnect(connect, () => console.error("hub busy, retrying"));
|
|
415
420
|
|
|
421
|
+
/** #1627 A: what init does for the hub-owned jcode home, read-only. */
|
|
422
|
+
function initJcodeHome() {
|
|
423
|
+
const config = loadConfig(cwd);
|
|
424
|
+
return planJcodeHomeInit({ cwd, stateDir, bundle: join(import.meta.dir, "..", "..", "plugins", "agent-hub", "server.js"), hubHome: hubHome(), config, env: process.env, installed: !!Bun.which(config.jcode_cmd[0] ?? "jcode") });
|
|
425
|
+
}
|
|
416
426
|
function registeredProject(): Project {
|
|
417
427
|
const registry = new Registry();
|
|
418
428
|
try { return registry.register(cwd, stateDir); }
|
|
@@ -1097,7 +1107,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1097
1107
|
else if (conductorPeer) retireConductorOperation(result, conductorPeer);
|
|
1098
1108
|
},
|
|
1099
1109
|
help: () => {
|
|
1100
|
-
const color = resolveColor(undefined, streamEnv(!!process.stdout.isTTY)) === true;
|
|
1110
|
+
const color = resolveColor(undefined, streamEnv(!!process.stdout.isTTY), "ahub") === true;
|
|
1101
1111
|
const topic = asksHelp(args[0]) ? undefined : args[0];
|
|
1102
1112
|
const text = topic && !definitionOf(topic) && projectCatalog.definitionOf(topic)?.permission.genericAcp !== undefined
|
|
1103
1113
|
? configuredAcpHelp(topic) : renderHelp(process.stdout.columns ?? 80, color, topic, undefined, asciiMarkers(process.env, args.includes("--ascii")));
|
|
@@ -1172,8 +1182,23 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1172
1182
|
const root = join(import.meta.dir, "..", "..");
|
|
1173
1183
|
if (args.includes("--research") && args.includes("--no-research")) fail("--research conflicts with --no-research; give one; nothing was written");
|
|
1174
1184
|
const research = args.includes("--research") ? true : args.includes("--no-research") ? false : undefined;
|
|
1175
|
-
const setupFlags = takeFlags(args.filter(arg => !["--yes", "--research", "--no-research"].includes(arg)), ["--agents"], []);
|
|
1176
|
-
if (setupFlags.rest.length) fail("usage: ahub setup [--yes] [--agents <a,b>] [--research|--no-research]");
|
|
1185
|
+
const setupFlags = takeFlags(args.filter(arg => !["--yes", "--research", "--no-research", "--undo"].includes(arg)), ["--agents"], []);
|
|
1186
|
+
if (setupFlags.rest.length) fail("usage: ahub setup [--yes] [--agents <a,b>] [--research|--no-research] [--undo]");
|
|
1187
|
+
if (args.includes("--undo")) {
|
|
1188
|
+
if (research !== undefined || setupFlags.one["--agents"] !== undefined) fail("--undo removes the hub's own skill trees only; drop --research and --agents; nothing was written");
|
|
1189
|
+
// #1622: remove only the trees the hub wrote and nobody edited; a modified, foreign or linked tree is reported and kept.
|
|
1190
|
+
const undoReader = process.stdin.isTTY ? createInterface({ input: process.stdin, output: process.stdout }) : undefined;
|
|
1191
|
+
try {
|
|
1192
|
+
await installHubSkills({ undo: true, yes: args.includes("--yes"),
|
|
1193
|
+
ask: async prompt => { try { return undoReader ? await undoReader.question(prompt) : null; } catch { return null; } },
|
|
1194
|
+
print: line => console.log(terminalText(line)) });
|
|
1195
|
+
// #1627 AC1b: the hub-owned jcode homes (the configured one and each instance's), under the same marker contract.
|
|
1196
|
+
await installHubSkillsInJcodeHomes({ undo: true, homes: jcodeSkillHomes(loadConfig(cwd), process.env), yes: args.includes("--yes"),
|
|
1197
|
+
ask: async prompt => { try { return undoReader ? await undoReader.question(prompt) : null; } catch { return null; } },
|
|
1198
|
+
print: line => console.log(terminalText(line)) });
|
|
1199
|
+
} finally { undoReader?.close(); }
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1177
1202
|
if (research !== undefined && (liveTest || delegatedPeer || recoveryLauncherCurrent)) fail("the machine research default requires the person's own ahub setup; nothing was written");
|
|
1178
1203
|
const registry = new Registry(), rl = process.stdin.isTTY ? createInterface({ input: process.stdin, output: process.stdout }) : undefined;
|
|
1179
1204
|
let machineRoots = [cwd];
|
|
@@ -1182,7 +1207,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1182
1207
|
const found = recoveryLauncherCurrent || delegatedPeer ? await discoverClaudeHomes({ home: homedir(), env: process.env }) : await usedClaudeHomes(registry, homedir(), process.env);
|
|
1183
1208
|
for (const notice of found.notices) console.log(terminalText(notice));
|
|
1184
1209
|
try {
|
|
1185
|
-
await setupClaudeHomes({ homes: found.homes, env: process.env, packageRoot: root, yes: args.includes("--yes"),
|
|
1210
|
+
await setupClaudeHomes({ homes: found.homes, env: process.env, packageRoot: root, yes: args.includes("--yes"), hook: { instruction: true },
|
|
1186
1211
|
interactive: !!rl,
|
|
1187
1212
|
current: () => { recoveryLauncherCurrent?.(); assertLifecycleAvailable(cwd); },
|
|
1188
1213
|
print: line => console.log(terminalText(line)), ask: async prompt => rl ? rl.question(prompt) : null,
|
|
@@ -1197,6 +1222,14 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1197
1222
|
...(rl ? { ask: async (prompt: string) => { try { return await rl.question(prompt); } catch { return null; } } } : {}), print: line => console.log(terminalText(line)) });
|
|
1198
1223
|
if (refused) fail(refused);
|
|
1199
1224
|
}
|
|
1225
|
+
// #1622: the hub's own skills for every other installed agent host, under the marker contract.
|
|
1226
|
+
assertLifecycleAvailable(cwd);
|
|
1227
|
+
await installHubSkills({ source: join(root, "plugins", "agent-hub", "skills"), yes: args.includes("--yes"),
|
|
1228
|
+
ask: async prompt => { try { return rl ? await rl.question(prompt) : null; } catch { return null; } },
|
|
1229
|
+
print: line => console.log(terminalText(line)) });
|
|
1230
|
+
await installHubSkillsInJcodeHomes({ source: join(root, "plugins", "agent-hub", "skills"), homes: jcodeSkillHomes(loadConfig(cwd), process.env), yes: args.includes("--yes"),
|
|
1231
|
+
ask: async prompt => { try { return rl ? await rl.question(prompt) : null; } catch { return null; } },
|
|
1232
|
+
print: line => console.log(terminalText(line)) });
|
|
1200
1233
|
if (research !== undefined) machineRoots = [...registry.list().map(row => row.root), cwd];
|
|
1201
1234
|
} finally { registry.close(); rl?.close(); }
|
|
1202
1235
|
if (homesFailed) fail(startupDiagnostic(homesFailure));
|
|
@@ -1213,7 +1246,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1213
1246
|
// #1065 T1: the settings flags come out first (a value flag takes the next word), then the older flags as before.
|
|
1214
1247
|
let settings: ReturnType<typeof parseInitSettings>;
|
|
1215
1248
|
try { settings = parseInitSettings(args); } catch (error) { return fail((error as Error).message); }
|
|
1216
|
-
const flags = takeFlags(settings.rest.filter(arg => arg !== "--dry-run" && arg !== "--json" && arg !== "--shadow" && arg !== "--release-guard" && arg !== "--yes"), ["--profile"], []);
|
|
1249
|
+
const flags = takeFlags(settings.rest.filter(arg => arg !== "--dry-run" && arg !== "--json" && arg !== "--shadow" && arg !== "--release-guard" && arg !== "--yes" && arg !== "--no-jcode-home"), ["--profile"], []);
|
|
1217
1250
|
if (flags.rest.length) fail(INIT_USAGE);
|
|
1218
1251
|
// A pack is a project file in .agenthub/roles/<name>.pack.json (#513a); init resolves the name and refuses an unknown one with the profiles and packs it knows.
|
|
1219
1252
|
let requestedProfile = flags.one["--profile"];
|
|
@@ -1259,6 +1292,9 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1259
1292
|
const inherit = inheritAutonomy ? autonomyInheritanceChange(cwd, defaults.enabled, request.autonomy) : undefined;
|
|
1260
1293
|
if (inherit) plan.push(inherit);
|
|
1261
1294
|
if (defaults.notice) console.error(defaults.notice);
|
|
1295
|
+
// #1627 A: the hub-owned jcode home is part of the plan, never written by a dry run.
|
|
1296
|
+
const homePlan = args.includes("--no-jcode-home") ? undefined : initJcodeHome();
|
|
1297
|
+
if (homePlan?.applicable) for (const line of homePlan.lines) plan.push({ action: homePlan.plan?.exists ? "modify" : "create", path: homePlan.plan!.home, reason: line.trim() });
|
|
1262
1298
|
// Without a settings flag the preview is the bare list of file rows, as it always was; with one it is { changes, settings }.
|
|
1263
1299
|
if (args.includes("--json")) return console.log(JSON.stringify(asked ? { changes: plan, settings: rows } : plan, null, 2));
|
|
1264
1300
|
const settingLines = rows.map(row => ` ${row.key}: ${row.from === undefined ? "(not set)" : JSON.stringify(row.from)} -> ${JSON.stringify(row.to)} (${row.file})`);
|
|
@@ -1270,6 +1306,24 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1270
1306
|
try { nextSteps = initNextSteps(cwd, request); changed = init(cwd, requestedProfile, shadow, releaseGuard, request); } catch (error) { return fail((error as Error).message); }
|
|
1271
1307
|
const project = registeredProject();
|
|
1272
1308
|
console.log(changed.length ? changed.map((p) => `${existsSync(p) ? "wrote" : "removed"} ${p}`).join("\n") : "already up to date");
|
|
1309
|
+
// #1627 A: the hub-owned jcode home, after the project files exist. The person's own home is never written; a rerun reports drift only.
|
|
1310
|
+
if (!args.includes("--no-jcode-home")) {
|
|
1311
|
+
const homeInit = initJcodeHome();
|
|
1312
|
+
if (homeInit.applicable && homeInit.plan) {
|
|
1313
|
+
for (const line of homeInit.lines) console.log(terminalText(line));
|
|
1314
|
+
if (homeInit.switchHome) { try { writeJcodeHomeConfig(cwd, homeInit.plan.home); console.log(`jcode_home now points at ${homeInit.plan.home}`); } catch (error) { console.error((error as Error).message); process.exitCode = 1; } }
|
|
1315
|
+
if (!homeInit.plan.exists) {
|
|
1316
|
+
if (jcodeHomeBlocked(homeInit.plan.home)) console.error(`jcode home ${homeInit.plan.home} is not a plain directory; nothing was created there`);
|
|
1317
|
+
else {
|
|
1318
|
+
try {
|
|
1319
|
+
applyJcodeHome(homeInit.plan);
|
|
1320
|
+
const installed = installSkillsInJcodeHome(join(import.meta.dir, "..", "..", "plugins", "agent-hub", "skills"), homeInit.plan.home);
|
|
1321
|
+
console.log(`wrote ${homeInit.plan.home}; hub skills: ${installed.filter(entry => entry.action === "install" || entry.action === "replace").length} installed`);
|
|
1322
|
+
} catch (error) { console.error(`jcode home was not fully set up: ${(error as Error).message}`); process.exitCode = 1; }
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1273
1327
|
if (newProject) {
|
|
1274
1328
|
if (inheritAutonomy) {
|
|
1275
1329
|
const registry = new Registry();
|
|
@@ -1293,7 +1347,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1293
1347
|
|
|
1294
1348
|
console: async () => {
|
|
1295
1349
|
if (args.some(arg => arg !== "--panels" && arg !== "--no-pet" && !arg.startsWith("--color=")) || args.filter(arg => arg.startsWith("--color=")).length > 1) fail("usage: ahub console [--panels] [--no-pet] [--color=auto|always|never]");
|
|
1296
|
-
const color = resolveColor(args.find(arg => arg.startsWith("--color="))?.slice("--color=".length), streamEnv(!!process.stdin.isTTY && !!process.stdout.isTTY));
|
|
1350
|
+
const color = resolveColor(args.find(arg => arg.startsWith("--color="))?.slice("--color=".length), streamEnv(!!process.stdin.isTTY && !!process.stdout.isTTY), "ahub");
|
|
1297
1351
|
if (color instanceof Error) return fail("usage: ahub console [--panels] [--no-pet] [--color=auto|always|never]");
|
|
1298
1352
|
await runConsole({ client: await connect(), cwd, stateDir, liveTest, panels: args.includes("--panels"), noPet: args.includes("--no-pet"), color, installed: consoleInstalled() });
|
|
1299
1353
|
},
|
|
@@ -1596,7 +1650,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1596
1650
|
const peer = args[0];
|
|
1597
1651
|
if (typeof peer !== "string" || !peerDefinition(peer)?.capabilities?.watch) fail("usage: ahub watch kimi|qwen [--no-thoughts] [--color=auto|always|never]");
|
|
1598
1652
|
if (args.slice(1).some(arg => arg !== "--no-thoughts" && !/^--color=(auto|always|never)$/.test(arg))) fail("unsupported watch option");
|
|
1599
|
-
const color = resolveColor(args.find(arg => arg.startsWith("--color="))?.slice(8), streamEnv(!!process.stdout.isTTY));
|
|
1653
|
+
const color = resolveColor(args.find(arg => arg.startsWith("--color="))?.slice(8), streamEnv(!!process.stdout.isTTY), "ahub");
|
|
1600
1654
|
if (color instanceof Error) fail(color.message);
|
|
1601
1655
|
const hub = await connect();
|
|
1602
1656
|
const input = process.stdin;
|
|
@@ -1639,8 +1693,11 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1639
1693
|
const op = outputArguments()[1] ?? "status";
|
|
1640
1694
|
let request: Record<string, unknown> = { t: "execution_budget", op, ...(outputArguments()[2] ? { id: outputArguments()[2] } : {}) };
|
|
1641
1695
|
if (op === "configure") {
|
|
1642
|
-
|
|
1643
|
-
|
|
1696
|
+
// #1513 AC3: the reason is optional; without one the budget is configured exactly as before.
|
|
1697
|
+
const flags = takeFlags(outputArguments().slice(2), ["--reason"], []);
|
|
1698
|
+
const configPath = flags.rest[0];
|
|
1699
|
+
if (!configPath || flags.rest.length > 1) { hub.close(); fail("usage: ahub budget execution configure <config.json> [--reason <text>]"); }
|
|
1700
|
+
try { request = { t: "execution_budget", op, config: JSON.parse(readFileSync(configPath, "utf8")), ...(flags.one["--reason"] ? { reason: flags.one["--reason"] } : {}) }; }
|
|
1644
1701
|
catch { hub.close(); fail("cannot read execution budget JSON configuration"); }
|
|
1645
1702
|
}
|
|
1646
1703
|
const result = await hub.request(request); hub.close();
|
|
@@ -1717,7 +1774,13 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1717
1774
|
let options;
|
|
1718
1775
|
try { options = parseRoadmapArgs(args); } catch (error) { return fail(`${error instanceof Error ? error.message : "invalid roadmap arguments"}; see ahub help roadmap`); }
|
|
1719
1776
|
// R3 (#1481): the GitHub reads and the model call each carry their own deadline, so these ops wait longer than the 30 s default.
|
|
1720
|
-
const text = await taskOp(options.op, options.args, false, undefined, ["hub_roadmap_unplaced", "hub_roadmap_triage", "roadmap_import_github"].includes(options.op) ? 60_000 : undefined);
|
|
1777
|
+
const text = await taskOp(options.op, options.args, false, undefined, ["hub_roadmap_unplaced", "hub_roadmap_triage", "hub_roadmap_decompose", "roadmap_import_github", "hub_roadmap_check", "roadmap_sync", "roadmap_sync_apply", "roadmap_export_apply"].includes(options.op) ? 60_000 : undefined);
|
|
1778
|
+
if (options.write) {
|
|
1779
|
+
let rendered: { json: string; markdown: string };
|
|
1780
|
+
try { rendered = JSON.parse(text); const root = roadmapWorktree(cwd, invokedFrom), policy = loadConfig(cwd); writeRoadmap(root, rendered, { deny: policy.local.deny, readOnly: policy.data?.readonly ?? [], pii: policy.pii?.paths ?? [] }); }
|
|
1781
|
+
catch (error) { return fail(error instanceof Error ? error.message : "roadmap export unavailable"); }
|
|
1782
|
+
if (!options.json) { console.log("Roadmap files written in the current worktree."); return; }
|
|
1783
|
+
}
|
|
1721
1784
|
if (options.json) console.log(text);
|
|
1722
1785
|
else console.log(renderRoadmap(text, outputOptions().columns));
|
|
1723
1786
|
},
|
|
@@ -2435,6 +2498,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
2435
2498
|
if (reply.ok === false && reply.error === "no answer from the hub within 35 s") fail("session title request timed out; the title may have been applied; check ahub status before retrying");
|
|
2436
2499
|
if (reply.ok !== true) fail(String(reply.error ?? `session title refused: ${String(reply.reason ?? "invalid")}; refresh ahub status, then retry`));
|
|
2437
2500
|
console.log(`${peer}: session title updated`);
|
|
2501
|
+
if (typeof reply.previousTitle === "string") console.log(`To restore the previous title in a terminal:\ncd ${shellQuote(cwd)} && ahub title ${shellQuote(peer!)} ${shellQuote(reply.previousTitle)}`);
|
|
2438
2502
|
} finally { hub.close(); }
|
|
2439
2503
|
},
|
|
2440
2504
|
|
|
@@ -2464,7 +2528,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
2464
2528
|
roster: async () => {
|
|
2465
2529
|
const options = outputOptions(), flags = args.filter(arg => arg.startsWith("--")), positional = outputArguments().filter(arg => arg !== "--yes" && arg !== "--now");
|
|
2466
2530
|
const [sub = "list", peer, ...extra] = positional;
|
|
2467
|
-
if (!["list", "add", "remove"].includes(sub) || extra.length || (sub === "list" ? peer !== undefined : !peerDefinition(peer) && !(sub === "remove" && typeof peer === "string" && staleInstanceKey(peer, projectCatalog))) || flags.some(flag => !["--json", "--full", "--yes", "--now"].includes(flag) && !flag.startsWith("--color=")) || (sub !== "list" && options.json) || (sub
|
|
2531
|
+
if (!["list", "add", "remove"].includes(sub) || extra.length || (sub === "list" ? peer !== undefined : !peerDefinition(peer) && !(sub === "remove" && typeof peer === "string" && staleInstanceKey(peer, projectCatalog))) || flags.some(flag => !["--json", "--full", "--yes", "--now"].includes(flag) && !flag.startsWith("--color=")) || (sub !== "list" && options.json) || (sub === "list" && flags.some(flag => ["--yes", "--now"].includes(flag))) || (sub === "add" && flags.includes("--now"))) fail("usage: ahub roster [--json] | add <peer> [--yes] | remove <peer> [--yes] [--now]");
|
|
2468
2532
|
const hub = await connect();
|
|
2469
2533
|
try {
|
|
2470
2534
|
requireNamedPeerFeature(hub, peer);
|
|
@@ -2478,6 +2542,17 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
2478
2542
|
const key = `roster.${peer}`, stale = sub === "remove" && !peerDefinition(peer) && staleInstanceKey(peer!, projectCatalog), value = stale ? null : sub === "add";
|
|
2479
2543
|
const preview = await request({ t: "settings_preview", key, value });
|
|
2480
2544
|
printOutput((preview.lines ?? []).map((text: string) => [{ text }]), options.color);
|
|
2545
|
+
// #1627 B: adding a peer shows what it would start with, and asks first. Without a terminal and without --yes nothing is changed; a conductor that passes --yes keeps today's authority.
|
|
2546
|
+
if (sub === "add") {
|
|
2547
|
+
const config = loadConfig(cwd), kind = peerDefinition(peer)?.kind ?? peer!;
|
|
2548
|
+
printOutput(rosterPreflightLines(peer!, rosterPreflight(peer!, kind, cwd, config, process.env)).map(text => [{ text }]), options.color);
|
|
2549
|
+
if (!flags.includes("--yes")) {
|
|
2550
|
+
if (!process.stdin.isTTY) fail(`not a terminal: nothing was changed; rerun with: cd ${shellQuote(cwd)} && ahub roster add ${peer} --yes`);
|
|
2551
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
2552
|
+
let answer: string; try { answer = await rl.question(`Add ${peer} to the roster? [y/N] `); } finally { rl.close(); }
|
|
2553
|
+
if (!/^(y|yes)$/i.test(answer.trim())) return console.log("nothing was changed");
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2481
2556
|
if (sub === "remove" && !flags.includes("--yes")) {
|
|
2482
2557
|
if (!process.stdin.isTTY) fail("not a terminal: nothing was changed; rerun with --yes after reviewing the preview");
|
|
2483
2558
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -2586,6 +2661,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
2586
2661
|
const def = key === undefined || sdlcRead ? undefined : settingDef(key, settingScope.instances, settingScope.catalog);
|
|
2587
2662
|
if (typeof def === "string") fail(settingScopeError && def.startsWith("unknown setting") ? `${key}: ${def}; the project config could not be read: ${settingScopeError}` : `${key}: ${def}`);
|
|
2588
2663
|
if (flags.includes("--now") && (typeof def !== "object" || def.group !== "Roster")) fail(usage);
|
|
2664
|
+
if (sub === "set" && key === "instructed.mode" && (caller.role !== "console" || liveTest || !process.stdin.isTTY)) fail("instructed.mode is changed only by the person in a terminal");
|
|
2589
2665
|
const value = sub === "set" ? parseSettingText(def!, text!) : undefined;
|
|
2590
2666
|
const peer = def?.group === "Permissions" || def?.group === "Roster" ? def.path.at(-1)! : undefined;
|
|
2591
2667
|
if (sub === "set" && value === "never-ask" && !flags.includes("--preview")) {
|
|
@@ -2686,7 +2762,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
2686
2762
|
if (sub === "list" && row.group !== group) console.log(`${group ? "\n" : ""}${group = row.group}`);
|
|
2687
2763
|
const facts = [`from ${row.source}`, `file: ${settingText(row.fileValue === undefined ? row.pending ?? row.value : row.fileValue)}`, row.applies === "live" ? "applies at once" : row.applies === "next use" ? "applies at next use" : "pending restart", ...(row.restartReason ? [row.restartReason] : []), ...(row.note ? [row.note] : [])];
|
|
2688
2764
|
console.log(` ${row.key.padEnd(width)} ${settingText(row.value).padEnd(valueWidth)} ${facts.join("; ")}`);
|
|
2689
|
-
if (sub === "get") console.log(` ${row.label}; written to ${row.file}; takes ${row.type === "boolean" ? "true, false" : row.type === "number-or-off" ? `off or a number from ${row.min ?? 0} to ${row.max ?? "the configured bound"}` : row.type === "integer" || row.type === "number" ? `a number from ${row.min ?? 0} to ${row.max ?? "the configured bound"}` : row.type === "peers" ? "a comma list of peer ids" : row.type === "roles" ? "up to two comma-separated catalog ids" : (row.values ?? []).join(", ")}${row.file === "this hub run" ? "" : ", or inherit to remove the machine-local value"}${row.risk === "raises" ? "; a dashboard needs a settings session (ahub ui --settings) to raise it" : ""}`);
|
|
2765
|
+
if (sub === "get") console.log(` ${row.label}; written to ${row.file}; takes ${row.type === "boolean" ? "true, false" : row.type === "number-or-off" ? `off or a number from ${row.min ?? 0} to ${row.max ?? "the configured bound"}` : row.type === "integer" || row.type === "number" ? `a number from ${row.min ?? 0} to ${row.max ?? "the configured bound"}` : row.type === "peers" ? "a comma list of peer ids" : row.type === "roles" ? "up to two comma-separated catalog ids" : (row.values ?? []).join(", ")}${row.file === "this hub run" || row.key === "instructed.mode" ? "" : ", or inherit to remove the machine-local value"}${row.risk === "raises" ? "; a dashboard needs a settings session (ahub ui --settings) to raise it" : ""}`);
|
|
2690
2766
|
}
|
|
2691
2767
|
if (sub === "list" && view.pendingRestart?.length) console.log(`\npending restart: ${view.pendingRestart.map((entry: { key: string }) => entry.key).join(", ")}`);
|
|
2692
2768
|
if (sub === "list" && view.undo) console.log(`\nahub settings undo puts back the last write (${view.undo})`);
|
|
@@ -3043,6 +3119,32 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
3043
3119
|
if (options.json) return console.log(JSON.stringify(sub === "limits" ? { limits: reply.limits, current: reply.current } : sub === "total" ? reply.total : reply.usage, null, 2));
|
|
3044
3120
|
printOutput(sub === "limits" ? renderLimits(reply.limits, reply.current, options.columns) : sub === "total" ? renderTotal(reply.total, options.columns) : renderUsage(reply.usage, options.columns), options.color);
|
|
3045
3121
|
},
|
|
3122
|
+
instructed: async () => {
|
|
3123
|
+
if (args[0] === "run") {
|
|
3124
|
+
const session = process.env.CLAUDE_CODE_SESSION_ID;
|
|
3125
|
+
if (caller.role !== "tools" || !session || liveTest) return fail("instruction requires the current managed Claude session");
|
|
3126
|
+
const hub = await connect();
|
|
3127
|
+
try {
|
|
3128
|
+
const result = await hub.request({ t: "instruction_execute", session, ...(args.length > 1 ? { argv: args.slice(1) } : {}) }, INSTRUCTION_CONTROL_TIMEOUT_MS);
|
|
3129
|
+
if (typeof result.output === "string") process.stdout.write(result.output);
|
|
3130
|
+
if (result.ok !== true) fail(String(result.error ?? "instruction was not completed"));
|
|
3131
|
+
} finally { hub.close(); }
|
|
3132
|
+
return;
|
|
3133
|
+
}
|
|
3134
|
+
return fail("usage: ahub instructed run [<operation> <args...>]");
|
|
3135
|
+
},
|
|
3136
|
+
"instruction-hook": async () => {
|
|
3137
|
+
if (args.length || caller.role !== "tools" || liveTest) return;
|
|
3138
|
+
try {
|
|
3139
|
+
const chunks: Buffer[] = []; let size = 0;
|
|
3140
|
+
for await (const chunk of process.stdin) { const bytes = Buffer.from(chunk); size += bytes.length; if (size > 1024 * 1024) return; chunks.push(bytes); }
|
|
3141
|
+
const input = Buffer.concat(chunks).toString("utf8");
|
|
3142
|
+
const message = parseInstructionHook(input, process.env);
|
|
3143
|
+
if (!message) return;
|
|
3144
|
+
const hub = await connect(2000);
|
|
3145
|
+
try { await hub.request(message, 2000); } finally { hub.close(); }
|
|
3146
|
+
} catch { /* Hook failure never alters the native prompt or reveals it. */ }
|
|
3147
|
+
},
|
|
3046
3148
|
facts: async () => {
|
|
3047
3149
|
if (!args.includes("--hook")) return fail("usage: ahub facts --hook (a Claude Code PreToolUse, PostToolUse and Stop hook)");
|
|
3048
3150
|
try {
|
|
@@ -3346,6 +3448,18 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
3346
3448
|
const config = loadConfig(cwd), assigned = catalogAssignments(config.catalog_roles);
|
|
3347
3449
|
for (const peer of Object.keys(assigned)) selectedRoles(peer, config.roles, assigned, catalog);
|
|
3348
3450
|
} catch { row(false, "catalog roles", "invalid assignment id, shape or flow base"); }
|
|
3451
|
+
// #1626 C: a rostered peer that can implement but sits in no class list never gets a task from routing. A warning, like the rows above.
|
|
3452
|
+
try {
|
|
3453
|
+
const config = loadConfig(cwd), scope = readInstanceRoleConfig(cwd);
|
|
3454
|
+
const roster = (peer: string) => rosterAllows(config.roster, peer, config.pi.enabled, scope.instances, scope.catalog);
|
|
3455
|
+
const implementers = [...new Set([...Object.keys(config.roles), ...Object.keys(config.roster)])]
|
|
3456
|
+
.filter(peer => roster(peer) && ((config.roles[peer] ?? []).includes("implementer") || [...(definitionOf(peer, scope.instances)?.roles ?? [])].includes("implementer")))
|
|
3457
|
+
.sort();
|
|
3458
|
+
const file = join(cwd, ".agenthub", "routing.toml");
|
|
3459
|
+
const result = classListRow(implementers, loadRouting(cwd), file, existsSync(file));
|
|
3460
|
+
// An advisory row, so it warns rather than failing: only a row the person must repair is a fail.
|
|
3461
|
+
checks.push({ name: "routing classes", section: "Config", level: result.ok === undefined ? "warn" : result.ok ? "ok" : "fail", detail: result.detail });
|
|
3462
|
+
} catch (error) { row(undefined, "routing classes", `could not be checked: ${error instanceof Error ? error.message : "unknown error"}`); }
|
|
3349
3463
|
for (const bin of DOCTOR_TOOL_PROBES) {
|
|
3350
3464
|
const v = version(bin);
|
|
3351
3465
|
row(!!v, bin, v ?? "not found on PATH");
|
|
@@ -3371,8 +3485,19 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
3371
3485
|
}
|
|
3372
3486
|
} finally { hub.close(); }
|
|
3373
3487
|
}
|
|
3374
|
-
const
|
|
3488
|
+
const plugins = parseList<InstalledPlugin>(spawnSync(DOCTOR_PLUGIN_PROBE.command, [...DOCTOR_PLUGIN_PROBE.argv], { encoding: "utf8" }).stdout ?? "");
|
|
3489
|
+
const plugin = pluginState(plugins, join(import.meta.dir, "..", ".."));
|
|
3375
3490
|
row(plugin.state === "current", DOCTOR_PLUGIN_PROBE.name, plugin.state === "missing" ? "missing: run ahub setup" : plugin.state === "current" ? `agent-hub@agent-hub ${plugin.version}` : `agent-hub@agent-hub is stale (${plugin.why}): run ahub setup`);
|
|
3491
|
+
// #1622: one row for the hub's own skills, in the Claude plugin and on every other installed host; a tree the hub will not touch is a warning.
|
|
3492
|
+
const skillsPresent = hubSkillsPresent(plugins);
|
|
3493
|
+
const hostSkills = skillStateRow(skillHostStates({ home: homedir(), env: process.env }, HUB_SKILL_NAMES));
|
|
3494
|
+
const claudeSkills = skillsPresent ? "Claude plugin skills present" : `missing from Claude user plugin; repair: cd ${shellQuote(cwd)} && ${plugin.state === "missing" ? "ahub setup" : "claude plugin uninstall agent-hub@agent-hub --scope user && ahub setup"}`;
|
|
3495
|
+
const hostRepair = hostSkills.ok === false ? `; repair: cd ${shellQuote(cwd)} && ahub setup` : "";
|
|
3496
|
+
// #1627 AC1b: the hub-owned jcode homes carry the skills too; a missing or stale tree there is the same repair.
|
|
3497
|
+
const ownedHomes = jcodeHomeSkillStates(jcodeSkillHomes(loadConfig(cwd), process.env), HUB_SKILL_NAMES);
|
|
3498
|
+
const ownedBad = ownedHomes.filter(state => state.state === "missing" || state.state === "stale" || state.state === "failed");
|
|
3499
|
+
const ownedText = ownedHomes.length ? `; hub-owned jcode ${ownedHomes.map(state => `${state.home} ${state.state}`).join(", ")}${ownedBad.length ? `; repair: cd ${shellQuote(cwd)} && ahub setup` : ""}` : "";
|
|
3500
|
+
row(skillsPresent ? (ownedBad.length ? false : hostSkills.ok) : false, "hub skills", `${claudeSkills}; ${hostSkills.detail}${hostRepair}${ownedText}`);
|
|
3376
3501
|
let profileRegistry: Registry | undefined;
|
|
3377
3502
|
try {
|
|
3378
3503
|
profileRegistry = new Registry();
|
|
@@ -3402,8 +3527,10 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
3402
3527
|
if (probe.kind === "source-identity") row(verifiedJcodeCommand(probe.command, cwd), probe.name, probe.detail);
|
|
3403
3528
|
else if (probe.kind === "jcode-mcp") {
|
|
3404
3529
|
const { servers, unreadable } = jcodeExtraMcpServers(cwd, probe.home);
|
|
3405
|
-
|
|
3406
|
-
|
|
3530
|
+
const { allowed, refused } = splitJcodeMcpServers(servers, probe.allow ?? []);
|
|
3531
|
+
row(refused.length || unreadable.length ? false : true, probe.name,
|
|
3532
|
+
[refused.length ? `${refused.length} besides the hub's own would load in the hub-owned jcode and are not allowed (${refused.join(", ")}); jcode has no switch to choose them, so remove them from its config, use another JCODE_HOME, or accept them by name in jcode_mcp_allow in .agenthub/config.local.json` : "",
|
|
3533
|
+
allowed.length ? `allowed by the person: ${allowed.join(", ")}` : "",
|
|
3407
3534
|
unreadable.length ? `unreadable or unsafe, not listed: ${unreadable.join(", ")}` : ""].filter(Boolean).join("; ") || "none besides the hub's own");
|
|
3408
3535
|
} else {
|
|
3409
3536
|
const verdict = assessVersion(probe.compat, COMPAT[probe.compat].parse(version(probe.command[0]!) ?? ""));
|
|
@@ -3437,9 +3564,8 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
3437
3564
|
row(mlx.state === "ready" || mlx.state === "stopped", "pi mlx", `${mlx.state}${mlx.model ? ` (${mlx.model})` : ""}${mlx.lastError ? `: ${mlx.lastError}` : ""}`);
|
|
3438
3565
|
}
|
|
3439
3566
|
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
row(memoryLibraryReady, "memory library", memoryLibraryReady ? `amem ${AGENT_MEM_VERSION}; in-process, no claude-mem worker` : "installed amem does not match the exact dependency pin");
|
|
3567
|
+
const memoryLibraryReady = AGENT_MEM_REFUSAL === undefined;
|
|
3568
|
+
row(memoryLibraryReady, "memory library", memoryLibraryReady ? `amem ${AGENT_MEM_VERSION}; in-process, no claude-mem worker` : AGENT_MEM_REFUSAL!);
|
|
3443
3569
|
// #1008: memory capture is agent-mem's own setup state, read as structured data (`amem setup <tool> --json`, a preview that writes nothing), never dotfiles text. The caller's
|
|
3444
3570
|
// identity is NOT scrubbed: agent-mem screens a plan for an agent, and a refusal reads as unknown here instead of being laundered into a person's answer.
|
|
3445
3571
|
for (const tool of DOCTOR_MEMORY_CAPTURE_PEERS) {
|
|
@@ -1,56 +1,4 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Human-output code names a role or a marker, never an SGR code or a glyph literal.
|
|
3
|
-
/**
|
|
4
|
-
* The nine semantic roles of CLI output standard v1 on the 16 ANSI colors, so a terminal theme decides the shades. Code names a role,
|
|
5
|
-
* never an SGR code (`test/cli-output-conformance.test.ts` fails on a raw SGR literal in `src/cli/` and `src/hub/`). `value` is the
|
|
6
|
-
* default foreground and carries no SGR. Bold is only for `header`, `section` and the three status roles; no backgrounds.
|
|
7
|
-
*/
|
|
8
|
-
/** End of every painted span. */
|
|
9
|
-
export const SGR_RESET = "\x1b[0m";
|
|
10
|
-
/** SGR of the console tones that are not an identity palette entry; the role table above is the standard, these are the TUI's own. */
|
|
1
|
+
// Hub-specific TUI tones; the portable standard is provided by @staix/cli-output.
|
|
11
2
|
export const TONE_SGR = Object.freeze({ strong: "\x1b[1;36m", failure: "\x1b[31m", number: "\x1b[1m", issueRef: "\x1b[4m", taskRef: "\x1b[4;35m" } as const);
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
header: "\x1b[1;34m", section: "\x1b[1;35m", key: "\x1b[34m", value: "", success: "\x1b[1;32m", warning: "\x1b[1;33m", error: "\x1b[1;31m", hint: "\x1b[90m", accent: "\x1b[36m",
|
|
15
|
-
});
|
|
16
|
-
export const MARKER_NAMES = ["ok", "fail", "warn", "absent", "unknown", "pending", "active", "next"] as const;
|
|
17
|
-
export type MarkerName = (typeof MARKER_NAMES)[number];
|
|
18
|
-
/** Semantic glyphs, each with its ASCII form and the one role that colors it. Code names a marker, never a glyph literal. */
|
|
19
|
-
export const MARKERS: Readonly<Record<MarkerName, { glyph: string; ascii: string; role: Role }>> = Object.freeze({
|
|
20
|
-
ok: { glyph: "\u2713", ascii: "ok", role: "success" }, fail: { glyph: "\u2717", ascii: "x", role: "error" }, warn: { glyph: "\u26a0", ascii: "!", role: "warning" },
|
|
21
|
-
absent: { glyph: "-", ascii: "-", role: "hint" }, unknown: { glyph: "?", ascii: "?", role: "hint" }, pending: { glyph: "~", ascii: "~", role: "hint" },
|
|
22
|
-
active: { glyph: "*", ascii: "*", role: "success" }, next: { glyph: "\u2192", ascii: "->", role: "accent" },
|
|
23
|
-
});
|
|
24
|
-
export const SECTION_MARKER = { glyph: "\u25b8", ascii: ">" } as const;
|
|
25
|
-
export const MARKER_COLUMN = 2;
|
|
26
|
-
/** Cells a string occupies: East Asian Ambiguous characters count as 1, so a Korean or CJK terminal keeps the same alignment. */
|
|
27
|
-
export const cellWidth = (text: string): number => Bun.stringWidth(text, { ambiguousIsNarrow: true });
|
|
28
|
-
/** A marker padded to the 2-cell marker column (ASCII `ok` and `->` fill it). */
|
|
29
|
-
export function markerCell(name: MarkerName, ascii: boolean): string {
|
|
30
|
-
const text = ascii ? MARKERS[name].ascii : MARKERS[name].glyph;
|
|
31
|
-
return text + " ".repeat(Math.max(0, MARKER_COLUMN - cellWidth(text)));
|
|
32
|
-
}
|
|
33
|
-
/** The environment one output stream's color decision reads (`streamEnv` builds it). */
|
|
34
|
-
export interface ColorEnv { isTTY: boolean; TERM?: string; NO_COLOR?: string; FORCE_COLOR?: string; CLICOLOR?: string; CLICOLOR_FORCE?: string }
|
|
35
|
-
/** `isTTY` of the stream that is decided (stdout and stderr are decided separately) plus the color variables of `env`. */
|
|
36
|
-
export function streamEnv(isTTY: boolean, env: Readonly<Record<string, string | undefined>> = process.env): ColorEnv {
|
|
37
|
-
return { isTTY, TERM: env.TERM, NO_COLOR: env.NO_COLOR, FORCE_COLOR: env.FORCE_COLOR, CLICOLOR: env.CLICOLOR, CLICOLOR_FORCE: env.CLICOLOR_FORCE };
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Color for one stream, first rule wins (standard v1): `--color=never|always`; non-empty NO_COLOR off; FORCE_COLOR or CLICOLOR_FORCE
|
|
41
|
-
* non-empty and not `0` on; FORCE_COLOR=0 or CLICOLOR=0 off; a TTY whose TERM is not `dumb` on; otherwise off. `auto` and no flag
|
|
42
|
-
* apply rules 2 to 6. An unknown flag value is a usage error. `--json` is never colored: the caller does not ask.
|
|
43
|
-
*/
|
|
44
|
-
export function resolveColor(flag: string | undefined, env: ColorEnv): boolean | Error {
|
|
45
|
-
if (flag === "always") return true;
|
|
46
|
-
if (flag === "never") return false;
|
|
47
|
-
if (flag !== undefined && flag !== "auto") return new Error("usage: ahub <command> [--color=auto|always|never]");
|
|
48
|
-
if (env.NO_COLOR) return false;
|
|
49
|
-
if ((env.FORCE_COLOR && env.FORCE_COLOR !== "0") || (env.CLICOLOR_FORCE && env.CLICOLOR_FORCE !== "0")) return true;
|
|
50
|
-
if (env.FORCE_COLOR === "0" || env.CLICOLOR === "0") return false;
|
|
51
|
-
return env.isTTY && env.TERM !== "dumb";
|
|
52
|
-
}
|
|
53
|
-
/** ASCII markers when `--ascii` is given or the locale (`LC_ALL`, then `LC_CTYPE`, then `LANG`) is not UTF-8. */
|
|
54
|
-
export function asciiMarkers(env: Readonly<Record<string, string | undefined>> = process.env, flag = false): boolean {
|
|
55
|
-
return flag || !/utf-?8/i.test(env.LC_ALL || env.LC_CTYPE || env.LANG || "");
|
|
56
|
-
}
|
|
3
|
+
export { SGR_RESET, ROLE_SGR, MARKER_NAMES, MARKERS, SECTION_MARKER, MARKER_COLUMN, cellWidth, markerCell, streamEnv, resolveColor, asciiMarkers } from "@staix/cli-output";
|
|
4
|
+
export type { Role, MarkerName, ColorEnv } from "@staix/cli-output";
|
package/src/cli/output.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReviewGate, ReviewUnknownQuota } from "../hub/review-budget.ts";
|
|
2
|
+
import { projectionText } from "../hub/budget-projection.ts";
|
|
2
3
|
import { quotaAccountReading } from "../hub/quota-account.ts";
|
|
3
4
|
import { projectModelStatus } from "./model.ts";
|
|
4
5
|
import type { RuntimeModelStatus } from "../hub/model-overrides.ts";
|
|
@@ -616,8 +617,13 @@ export function renderBudget(data: BudgetOutput, columns?: number, now = Date.no
|
|
|
616
617
|
if (data.review) out.push(...detail("Reviewer admission", data.review.rule, columns));
|
|
617
618
|
// KIND names what the number is (#285): the provider's own (native), tokens the hub counted against a ceiling (count), or a person's (manual).
|
|
618
619
|
// A window without a kind, from an older hub, is classified by `windowKind`. A fresh window that does not gate says so in STATE.
|
|
619
|
-
|
|
620
|
-
|
|
620
|
+
// #1513 AC2: LEFT and REACHES are the same fields the dashboard and the console render, from the same window view.
|
|
621
|
+
const windows = Object.entries(data.budget).flatMap(([peer, b]) => (b.windows ?? []).map((w: any) => [span(peer, peerTone(peer)), span(w.id), span(`${Math.round(w.used * 100)}%`, "number"),
|
|
622
|
+
span(typeof w.left === "number" ? `${Math.round(w.left * 100)}%` : "unknown", typeof w.left === "number" ? "number" : "muted"),
|
|
623
|
+
span(typeof w.resetsAt === "number" ? relative(w.resetsAt, now) : "-", "muted"),
|
|
624
|
+
span(w.projection ? projectionText(w.projection, at => relative(at, now)) : "unknown", w.projection?.state === "projected" ? undefined : "muted"),
|
|
625
|
+
span(windowKind({ id: w.id, source: w.source ?? "", kind: w.kind }), "muted"), span(w.source ?? "unknown", "muted"), span(typeof w.at === "number" ? relative(w.at, now) : "unknown", "muted"), span(w.stale ? "stale" : w.superseded ? "info only" : "fresh", w.stale ? "attention" : undefined)]));
|
|
626
|
+
if (windows.length) out.push(...rows(["PEER", "WINDOW", "USED", "LEFT", "RESETS", "REACHES", "KIND", "SOURCE", "MEASURED", "STATE"], windows, columns));
|
|
621
627
|
else if (!data.peers?.length) out.push(...lines(`no quota readings yet (gate ${data.gate ?? "unknown"}). Sources: Codex rate limits, Claude's status line (ahub claude), ahub budget set.`, columns));
|
|
622
628
|
// A peer with no number says why, in its own line, so a peer without quota is not mistaken for one that has not reported.
|
|
623
629
|
for (const note of data.peers ?? []) out.push(...detail(note.peer, note.note, columns, peerTone(note.peer)));
|
|
@@ -5,6 +5,7 @@ import { basename, dirname, join, resolve } from "node:path";
|
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import { hubHome, realPath } from "../hub/project.ts";
|
|
7
7
|
import { Registry } from "../hub/registry.ts";
|
|
8
|
+
import { AGENT_MEM_HOST_API_RANGE, agentMemHostApiOk, agentMemVersionInRange, isAgentMemFloorRange, readHostApiConstants } from "../hub/agent-mem-range.ts";
|
|
8
9
|
|
|
9
10
|
export type CommandResult = { code: number; stdout: string; stderr: string };
|
|
10
11
|
export type RunCommand = (args: string[], options?: { cwd?: string; env?: NodeJS.ProcessEnv; timeoutMs?: number; input?: string; pipeExitGraceMs?: number }) => Promise<CommandResult>;
|
|
@@ -42,14 +43,17 @@ export function exactVersion(version: string): string {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
const MEMORY_ASSETS = ["src", "bin", "package.json", "README.md", "LICENSE"] as const;
|
|
46
|
+
const OUTPUT_ASSETS = ["src", "package.json", "README.md", "LICENSE"] as const;
|
|
45
47
|
|
|
46
|
-
/**
|
|
48
|
+
/** Runtime dependencies are limited to the reviewed first-party packages, never an arbitrary dependency tree. */
|
|
47
49
|
function memoryRuntime(root: string, dependencyRoot?: string): string | undefined {
|
|
48
50
|
const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
49
51
|
const deps = pkg.dependencies ?? {};
|
|
50
52
|
if (!Object.keys(deps).length) return undefined;
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
+
const declared = deps["@staix/agent-mem"];
|
|
54
|
+
// #1611: a current package declares a floor range `>=X.Y.Z <M.0.0`; a package staged under #1605 declares `~X.Y.Z` and one before it an exact
|
|
55
|
+
// version, so a cached release still verifies (legacy forms need no host API); compound ranges, `^`, `*` and prereleases stay refused.
|
|
56
|
+
if (Object.keys(deps).some(name => !["@staix/agent-mem", "@staix/cli-output"].includes(name)) || typeof declared !== "string" || !(/^~?\d+\.\d+\.\d+$/.test(declared) || isAgentMemFloorRange(declared))) throw new Error("unsupported runtime dependencies in recovery package");
|
|
53
57
|
let dir = dependencyRoot ? join(dependencyRoot, "node_modules/@staix/agent-mem")
|
|
54
58
|
: dirname(createRequire(join(root, "package.json")).resolve("@staix/agent-mem"));
|
|
55
59
|
if (dependencyRoot && !existsSync(dir)) throw new Error("memory runtime dependency is unavailable");
|
|
@@ -61,7 +65,17 @@ function memoryRuntime(root: string, dependencyRoot?: string): string | undefine
|
|
|
61
65
|
if (existsSync(manifest)) {
|
|
62
66
|
const memory = JSON.parse(readFileSync(manifest, "utf8"));
|
|
63
67
|
if (memory.name === "@staix/agent-mem") {
|
|
64
|
-
|
|
68
|
+
const installed = typeof memory.version === "string" ? memory.version : "";
|
|
69
|
+
const accepted = declared.startsWith("~") || declared.startsWith(">=") ? agentMemVersionInRange(installed, declared) : installed === declared;
|
|
70
|
+
if (accepted && isAgentMemFloorRange(declared)) {
|
|
71
|
+
// #1611: a floor-form package also needs a host API the hub supports, read from the staged package's own platform module.
|
|
72
|
+
let text = "";
|
|
73
|
+
try { text = readFileSync(join(dir, "src/memory/platform.ts"), "utf8"); } catch { /* missing constants refuse below */ }
|
|
74
|
+
const host = readHostApiConstants(text);
|
|
75
|
+
if (!agentMemHostApiOk(host.min, host.version))
|
|
76
|
+
throw new Error(`memory runtime host API ${host.min ?? "missing"}..${host.version ?? "missing"} does not intersect the supported ${AGENT_MEM_HOST_API_RANGE[0]}..${AGENT_MEM_HOST_API_RANGE[1]}`);
|
|
77
|
+
}
|
|
78
|
+
if (!accepted || Object.keys(memory.dependencies ?? {}).length) throw new Error("memory runtime dependency identity/version mismatch");
|
|
65
79
|
return realPath(dir);
|
|
66
80
|
}
|
|
67
81
|
}
|
|
@@ -71,14 +85,43 @@ function memoryRuntime(root: string, dependencyRoot?: string): string | undefine
|
|
|
71
85
|
}
|
|
72
86
|
}
|
|
73
87
|
|
|
88
|
+
/** Resolve only the declared exact output package, including in an isolated retained or staged install. */
|
|
89
|
+
function outputRuntime(root: string, dependencyRoot?: string): string | undefined {
|
|
90
|
+
const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
91
|
+
const declared = pkg.dependencies?.["@staix/cli-output"];
|
|
92
|
+
if (declared === undefined) return undefined;
|
|
93
|
+
if (typeof declared !== "string" || !/^\d+\.\d+\.\d+$/.test(declared)) throw new Error("output runtime dependency must be an exact version");
|
|
94
|
+
let dir = dependencyRoot ? join(dependencyRoot, "node_modules/@staix/cli-output")
|
|
95
|
+
: dirname(createRequire(join(root, "package.json")).resolve("@staix/cli-output"));
|
|
96
|
+
if (dependencyRoot && !existsSync(dir)) throw new Error("output runtime dependency is unavailable");
|
|
97
|
+
if (dependencyRoot) for (const name of ["node_modules", "node_modules/@staix", "node_modules/@staix/cli-output"]) {
|
|
98
|
+
if (lstatSync(join(dependencyRoot, name)).isSymbolicLink()) throw new Error("runtime package must not contain symlinks");
|
|
99
|
+
}
|
|
100
|
+
for (;;) {
|
|
101
|
+
const manifest = join(dir, "package.json");
|
|
102
|
+
if (existsSync(manifest)) {
|
|
103
|
+
const output = JSON.parse(readFileSync(manifest, "utf8"));
|
|
104
|
+
if (output.name === "@staix/cli-output") {
|
|
105
|
+
if (output.version !== declared || Object.keys(output.dependencies ?? {}).length) throw new Error("output runtime dependency identity/version mismatch");
|
|
106
|
+
return realPath(dir);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const parent = dirname(dir);
|
|
110
|
+
if (dependencyRoot || parent === dir) throw new Error("output runtime dependency is unavailable");
|
|
111
|
+
dir = parent;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
74
115
|
export function preserveRuntimeDependencies(root: string, destination: string): void {
|
|
75
|
-
const memory = memoryRuntime(root);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
116
|
+
const memory = memoryRuntime(root), output = outputRuntime(root);
|
|
117
|
+
for (const [source, packageName, assets] of [[memory, "agent-mem", MEMORY_ASSETS], [output, "cli-output", OUTPUT_ASSETS]] as const) {
|
|
118
|
+
if (!source) continue;
|
|
119
|
+
const target = join(destination, "node_modules/@staix", packageName);
|
|
120
|
+
mkdirSync(target, { recursive: true });
|
|
121
|
+
for (const name of assets) {
|
|
122
|
+
if (lstatSync(join(source, name)).isSymbolicLink()) throw new Error("runtime package must not contain symlinks");
|
|
123
|
+
cpSync(join(source, name), join(target, name), { recursive: true, dereference: false });
|
|
124
|
+
}
|
|
82
125
|
}
|
|
83
126
|
}
|
|
84
127
|
|
|
@@ -93,7 +136,7 @@ export function packageDigest(root: string, options: { ownDependencies?: boolean
|
|
|
93
136
|
else file(join(directory, item.name), name);
|
|
94
137
|
}
|
|
95
138
|
};
|
|
96
|
-
// Only runtime assets and the
|
|
139
|
+
// Only runtime assets and the resolved first-party packages; never private state or unrelated dependencies.
|
|
97
140
|
for (const name of ["src", "plugins", "templates", ".claude-plugin"]) visit(join(root, name), `${name}/`);
|
|
98
141
|
hash.update(readFileSync(join(root, "package.json")));
|
|
99
142
|
const memory = memoryRuntime(root, options.ownDependencies ? root : options.dependencyRoot);
|
|
@@ -102,6 +145,12 @@ export function packageDigest(root: string, options: { ownDependencies?: boolean
|
|
|
102
145
|
if (stat.isSymbolicLink()) throw new Error("runtime package must not contain symlinks");
|
|
103
146
|
if (stat.isDirectory()) visit(path, `${prefix}/`); else file(path, prefix);
|
|
104
147
|
}
|
|
148
|
+
const output = outputRuntime(root, options.ownDependencies ? root : options.dependencyRoot);
|
|
149
|
+
if (output) for (const name of OUTPUT_ASSETS) {
|
|
150
|
+
const path = join(output, name), stat = lstatSync(path), prefix = `node_modules/@staix/cli-output/${name}`;
|
|
151
|
+
if (stat.isSymbolicLink()) throw new Error("runtime package must not contain symlinks");
|
|
152
|
+
if (stat.isDirectory()) visit(path, `${prefix}/`); else file(path, prefix);
|
|
153
|
+
}
|
|
105
154
|
return hash.digest("hex");
|
|
106
155
|
}
|
|
107
156
|
|
|
@@ -118,7 +167,7 @@ export function recoveryPackageOptions(kind: "restart" | "upgrade", root: string
|
|
|
118
167
|
if (kind === "restart") return { ownDependencies: true };
|
|
119
168
|
if (kind !== "upgrade") throw new Error("unsupported recovery package kind");
|
|
120
169
|
const canonical = realPath(root);
|
|
121
|
-
// Project captures own
|
|
170
|
+
// Project captures own their resolved dependencies and keep the registry install separate below this version.
|
|
122
171
|
if (canonical === root && /^source-[a-f0-9]{64}$/.test(basename(canonical)) && /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(basename(dirname(canonical)))
|
|
123
172
|
&& basename(dirname(dirname(canonical))) === "releases") return { ownDependencies: true };
|
|
124
173
|
const dependencyRoot = resolve(canonical, "../../..");
|