@wrongstack/cli 0.302.0 → 0.303.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/data/providers.json +41 -155
- package/dist/{acp-DATHHPNT.js → acp-AQMGKW6O.js} +6 -5
- package/dist/{audit-QRCLEHHW.js → audit-BBR22QH3.js} +2 -2
- package/dist/{auth-PJD3JRH2.js → auth-K7CYVVKH.js} +121 -78
- package/dist/auth-menu/index.d.ts +5 -5
- package/dist/auth-menu/local.d.ts +4 -5
- package/dist/auth-menu/openai-codex-oauth.d.ts +1 -1
- package/dist/{auto-discover-providers-DRW4OZHG.js → auto-discover-providers-MHFLDSD3.js} +2 -2
- package/dist/{bench-7ZDWSNEF.js → bench-XNDUJOSZ.js} +10 -11
- package/dist/boot/auto-discover-providers.d.ts +1 -1
- package/dist/boot/container-wiring.d.ts +3 -3
- package/dist/boot/dispatch-webui.d.ts +1 -1
- package/dist/boot/system-prompt.d.ts +1 -2
- package/dist/boot/tool-registry.d.ts +1 -1
- package/dist/boot/tui-coordinator-setup.d.ts +1 -1
- package/dist/boot/tui-project-picker-callback.d.ts +1 -1
- package/dist/boot/tui-theme-adapter.d.ts +33 -0
- package/dist/boot-config.d.ts +2 -2
- package/dist/boot.d.ts +1 -1
- package/dist/{chunk-ETOEGL3V.js → chunk-3IC4IEZC.js} +7 -2
- package/dist/{chunk-PFVVUH5B.js → chunk-3JPTNADJ.js} +3 -2
- package/dist/{chunk-4GVH7V3S.js → chunk-52C7PD2H.js} +1 -1
- package/dist/{chunk-I5MEUFDI.js → chunk-53STH6CX.js} +94 -15
- package/dist/{chunk-OP47B3IX.js → chunk-7YLN7YUA.js} +7 -2
- package/dist/{chunk-263G3FMB.js → chunk-B4JLSXZB.js} +11 -14
- package/dist/{chunk-MT6FGXO3.js → chunk-C5NXM2SI.js} +19 -6
- package/dist/{chunk-XTIXVJXP.js → chunk-DGXNL7OT.js} +1 -1
- package/dist/{chunk-3MOUBRKZ.js → chunk-FJVCVZIV.js} +974 -935
- package/dist/{chunk-MRLYDHQ7.js → chunk-JQURRYU4.js} +4 -6
- package/dist/{chunk-ZECLGUTF.js → chunk-KV6DNQT6.js} +2 -2
- package/dist/{chunk-2KDOFTTM.js → chunk-LUAFQIXT.js} +1067 -900
- package/dist/{chunk-F4PEGAJZ.js → chunk-NUIHRGPY.js} +1 -1
- package/dist/{chunk-GUHQQG63.js → chunk-RK7E3IXT.js} +2 -4
- package/dist/{chunk-PYTFS4MC.js → chunk-SSSJQVUY.js} +27 -16
- package/dist/{chunk-PJHET45A.js → chunk-SZ42FYPT.js} +3 -3
- package/dist/{chunk-A6Q5KGLV.js → chunk-YKBRFSGL.js} +5 -5
- package/dist/cli-context.d.ts +2 -2
- package/dist/cli-eternal-flag.d.ts +1 -2
- package/dist/{cli-main-EOJ74CI4.js → cli-main-37XO26GK.js} +3269 -2206
- package/dist/context-limit.d.ts +11 -5
- package/dist/{diag-doctor-OQ3AA63O.js → diag-doctor-ZF5BF2MK.js} +2 -3
- package/dist/execute-deps.d.ts +1 -1
- package/dist/{execution-CQ772VPS.js → execution-MVOH6PAQ.js} +302 -149
- package/dist/{export-DOBGPY23.js → export-CCUXRJOU.js} +3 -11
- package/dist/fleet/host-context.d.ts +9 -0
- package/dist/fleet/host-learning-tracker.d.ts +2 -2
- package/dist/fleet/host-learning.d.ts +12 -1
- package/dist/fleet/host-subagent-factory.d.ts +1 -1
- package/dist/fleet/host-supervisor.d.ts +1 -1
- package/dist/fleet/host.d.ts +23 -1
- package/dist/fleet/routing.d.ts +1 -2
- package/dist/goal-host.d.ts +2 -2
- package/dist/hooks-wiring.d.ts +1 -1
- package/dist/{hq-LN5CJHCM.js → hq-CD77GVSS.js} +104 -55
- package/dist/hq-command-controller.d.ts +1 -1
- package/dist/hq-server/routes/system-handlers.d.ts +1 -2
- package/dist/hq-server/routes.d.ts +7 -7
- package/dist/{hq-server-S7HZG3PA.js → hq-server-DME6EWIO.js} +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2635 -2642
- package/dist/mailbox-bridge-bootstrap.d.ts +2 -2
- package/dist/{mcp-OHPJH73U.js → mcp-AX6ZAFJR.js} +8 -7
- package/dist/mcp-serve.d.ts +1 -1
- package/dist/{modeldiag-3DOK4BWW.js → modeldiag-SIVUOX2Y.js} +18 -13
- package/dist/{permissions-FNYLZIL4.js → permissions-2PWBL4YU.js} +5 -3
- package/dist/picker.d.ts +1 -1
- package/dist/plugin-management.d.ts +1 -1
- package/dist/{plugin-usage-YEVLOR33.js → plugin-usage-PTEETL3J.js} +2 -2
- package/dist/{plugins-K3BAUP4D.js → plugins-XRGWC3NJ.js} +3 -3
- package/dist/pre-launch.d.ts +2 -2
- package/dist/{providers-models-WEZ4EGLL.js → providers-models-VV74TRQ2.js} +86 -37
- package/dist/repl.d.ts +1 -1
- package/dist/{replay-FCBNHW3K.js → replay-WBRMEWQ5.js} +2 -2
- package/dist/{rewind-AOD3JIYX.js → rewind-7RE6ONIC.js} +17 -17
- package/dist/{sdd-runtime-AIJCJGWC.js → sdd-runtime-GFZ3NJKS.js} +2 -2
- package/dist/{sessions-config-XXN7267N.js → sessions-config-YX2ZPAFM.js} +36 -32
- package/dist/{simpleui-dist-JIFGUJO7.js → simpleui-dist-33VO3QHF.js} +9 -2
- package/dist/slash-commands/agent-improve.d.ts +4 -1
- package/dist/slash-commands/agents.d.ts +14 -0
- package/dist/slash-commands/command-context.d.ts +2 -3
- package/dist/slash-commands/helpers.d.ts +1 -1
- package/dist/slash-commands/index.d.ts +1 -1
- package/dist/slash-commands/intake.d.ts +10 -0
- package/dist/slash-commands/memory-triage.d.ts +1 -1
- package/dist/slash-commands/provider-status.d.ts +1 -1
- package/dist/slash-commands/theme.d.ts +6 -0
- package/dist/subcommands/handlers/hq.d.ts +20 -0
- package/dist/subcommands/handlers/per-subcommand-help-data.d.ts +1 -1
- package/dist/subcommands/handlers/update.d.ts +2 -0
- package/dist/{update-MV6TUACD.js → update-VZSOZGYC.js} +3 -3
- package/dist/{update-check-UMYTOH7Z.js → update-check-WARHSVZA.js} +2 -2
- package/dist/webui-server/connection-handler.d.ts +1 -1
- package/dist/webui-server/context-breakdown.d.ts +1 -1
- package/dist/webui-server/cost-helpers.d.ts +1 -1
- package/dist/webui-server/lifecycle.d.ts +1 -1
- package/dist/webui-server/prefs-seeding.d.ts +1 -1
- package/dist/webui-server/setup-events.d.ts +1 -1
- package/dist/webui-server/static-serve.d.ts +1 -1
- package/dist/{webui-server-NFNRGNNT.js → webui-server-E3OPEKU5.js} +18 -10
- package/dist/webui-server-options.d.ts +1 -1
- package/dist/wiring/command-host-state.d.ts +2 -2
- package/dist/wiring/controllers.d.ts +1 -2
- package/dist/wiring/dep-watcher.d.ts +1 -1
- package/dist/wiring/director-setup.d.ts +3 -3
- package/dist/wiring/eternal-command-handlers.d.ts +2 -2
- package/dist/wiring/management-tools.d.ts +2 -2
- package/dist/wiring/provider-runtime.d.ts +1 -1
- package/dist/wiring/provider-status.d.ts +1 -1
- package/dist/wiring/provider-utility-tools.d.ts +3 -3
- package/dist/wiring/provider.d.ts +1 -1
- package/dist/wiring/replay.d.ts +1 -1
- package/dist/wiring/runtime-controller-deps.d.ts +1 -1
- package/dist/wiring/runtime-dispatch-state.d.ts +1 -2
- package/dist/wiring/runtime-lifecycle-deps.d.ts +2 -2
- package/dist/wiring/runtime-picker-deps.d.ts +1 -2
- package/dist/wiring/sage.d.ts +1 -1
- package/dist/wiring/session-command-handlers.d.ts +1 -2
- package/dist/wiring/session.d.ts +6 -1
- package/dist/wiring/slash-commands.d.ts +2 -3
- package/package.json +23 -23
|
@@ -7,17 +7,9 @@ import "./chunk-7OCVIDC7.js";
|
|
|
7
7
|
import * as fs from "node:fs/promises";
|
|
8
8
|
import * as path from "node:path";
|
|
9
9
|
import { DefaultSessionReader } from "@wrongstack/core/storage";
|
|
10
|
-
import { expectDefined } from "@wrongstack/core/utils";
|
|
11
|
-
import { toErrorMessage } from "@wrongstack/core/utils";
|
|
10
|
+
import { expectDefined, toErrorMessage } from "@wrongstack/core/utils";
|
|
12
11
|
var exportCmd = async (args, deps) => {
|
|
13
|
-
args = restoreFlags(args, deps, [
|
|
14
|
-
"format",
|
|
15
|
-
"f",
|
|
16
|
-
"out",
|
|
17
|
-
"o",
|
|
18
|
-
"no-tools",
|
|
19
|
-
"no-diagnostics"
|
|
20
|
-
]);
|
|
12
|
+
args = restoreFlags(args, deps, ["format", "f", "out", "o", "no-tools", "no-diagnostics"]);
|
|
21
13
|
if (!deps.sessionStore) {
|
|
22
14
|
deps.renderer.writeError("No session store configured.");
|
|
23
15
|
return 1;
|
|
@@ -72,4 +64,4 @@ var exportCmd = async (args, deps) => {
|
|
|
72
64
|
export {
|
|
73
65
|
exportCmd
|
|
74
66
|
};
|
|
75
|
-
//# sourceMappingURL=export-
|
|
67
|
+
//# sourceMappingURL=export-CCUXRJOU.js.map
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { SubagentConfig } from '@wrongstack/core/types';
|
|
2
2
|
import type { MultiAgentDeps } from './host-types.js';
|
|
3
|
+
/** Skills whose bodies were requested but did not make it into the prompt. */
|
|
4
|
+
export interface SkillResolutionReport {
|
|
5
|
+
content: string;
|
|
6
|
+
selected: string[];
|
|
7
|
+
/** skill → why it was dropped, so the omission is never silent. */
|
|
8
|
+
dropped: Record<string, 'not-found' | 'missing-capability' | 'missing-tool' | 'budget' | 'empty'>;
|
|
9
|
+
}
|
|
10
|
+
export declare function resolveHostSubagentSkillResolution(deps: MultiAgentDeps, roster: Record<string, SubagentConfig>, subCfg: SubagentConfig, availableToolNames?: readonly string[]): Promise<SkillResolutionReport>;
|
|
11
|
+
/** Backwards-compatible wrapper for callers that only need the prompt text. */
|
|
3
12
|
export declare function resolveHostSubagentSkillContent(deps: MultiAgentDeps, roster: Record<string, SubagentConfig>, subCfg: SubagentConfig, availableToolNames?: readonly string[]): Promise<string>;
|
|
4
13
|
export declare function retrieveHostSubagentMemory(deps: MultiAgentDeps, getLeaderMode: (() => string | undefined) | undefined, subCfg: SubagentConfig, taskContext?: Record<string, unknown>): Promise<string[]>;
|
|
5
14
|
//# sourceMappingURL=host-context.d.ts.map
|
|
@@ -5,7 +5,7 @@ export declare class HostLearningRoleTracker {
|
|
|
5
5
|
private readonly roles;
|
|
6
6
|
private readonly accessOrder;
|
|
7
7
|
constructor(maxEntries?: number);
|
|
8
|
-
record(subagentId: string, role: string): void;
|
|
9
|
-
capture(result: TaskResult, deps: Pick<MultiAgentDeps, 'container' | 'projectRoot'
|
|
8
|
+
record(subagentId: string, role: string, skills?: readonly string[]): void;
|
|
9
|
+
capture(result: TaskResult, deps: Pick<MultiAgentDeps, 'container' | 'projectRoot'>, onCaptured?: (role: string) => void): void;
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=host-learning-tracker.d.ts.map
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import type { TaskResult } from '@wrongstack/core/types';
|
|
2
2
|
import type { MultiAgentDeps } from './host-types.js';
|
|
3
|
-
|
|
3
|
+
/** What a spawn recorded about the agent that will produce this result. */
|
|
4
|
+
export interface LearningSubject {
|
|
5
|
+
role: string;
|
|
6
|
+
skills: readonly string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function captureCompletedTaskLearningForHost(result: TaskResult, deps: Pick<MultiAgentDeps, 'container' | 'projectRoot'>, subjects: ReadonlyMap<string, LearningSubject>,
|
|
9
|
+
/**
|
|
10
|
+
* Called when a capture persisted at least one directive. The auto-optimize
|
|
11
|
+
* scheduler uses it as its trigger, so distillation follows learning without
|
|
12
|
+
* anyone pressing a button.
|
|
13
|
+
*/
|
|
14
|
+
onCaptured?: (role: string) => void): void;
|
|
4
15
|
//# sourceMappingURL=host-learning.d.ts.map
|
|
@@ -9,7 +9,7 @@ export interface HostSubagentFactoryContext {
|
|
|
9
9
|
sessionFactory?: DirectorSessionFactory | undefined;
|
|
10
10
|
filterTools: (allow?: string[]) => Tool[];
|
|
11
11
|
mailboxProjectDir: () => string;
|
|
12
|
-
recordLearningRole: (subagentId: string, role: string) => void;
|
|
12
|
+
recordLearningRole: (subagentId: string, role: string, skills?: readonly string[]) => void;
|
|
13
13
|
subagentToolRegistry: (allow?: string[]) => ToolRegistry;
|
|
14
14
|
}
|
|
15
15
|
export declare function createHostSubagentFactory(config: Config, host: HostSubagentFactoryContext): AgentFactory;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type Director, FleetSupervisor } from '@wrongstack/core/coordination';
|
|
2
2
|
import type { EventBus } from '@wrongstack/core/kernel';
|
|
3
3
|
import type { Config, SubagentConfig } from '@wrongstack/core/types';
|
|
4
4
|
import type { MultiAgentHostOptions } from './host-types.js';
|
package/dist/fleet/host.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type AgentFactory, Director } from '@wrongstack/core/coordination';
|
|
2
2
|
import type { SubagentRunner } from '@wrongstack/core/types';
|
|
3
3
|
import { type Config, type SubagentConfig, type TaskResult } from '@wrongstack/core/types';
|
|
4
|
-
import { type FleetHostStatus, type FleetHostUsage } from './host-status.js';
|
|
5
4
|
import type { HostSpawnAndWaitOptions, HostSpawnOptions } from './host-spawn-types.js';
|
|
5
|
+
import { type FleetHostStatus, type FleetHostUsage } from './host-status.js';
|
|
6
6
|
import type { MultiAgentDeps, MultiAgentHostOptions } from './host-types.js';
|
|
7
7
|
export type { MultiAgentDeps, MultiAgentHostOptions } from './host-types.js';
|
|
8
8
|
/**
|
|
@@ -39,6 +39,9 @@ export declare class MultiAgentHost {
|
|
|
39
39
|
* Bounded to 20 entries with LRU eviction to prevent unbounded memory growth. */
|
|
40
40
|
private readonly acpRunnerCache;
|
|
41
41
|
private readonly learningRoles;
|
|
42
|
+
/** Background distillation of captured learning into per-skill addenda. */
|
|
43
|
+
private learningOptimizer;
|
|
44
|
+
private learningSwept;
|
|
42
45
|
/** Adaptive concurrency controller — created in buildDirector() when config has
|
|
43
46
|
* adaptiveConcurrency.enabled = true. Monitors FleetBus for 429 errors and
|
|
44
47
|
* automatically adjusts maxConcurrent to prevent rate limiting. */
|
|
@@ -202,6 +205,25 @@ export declare class MultiAgentHost {
|
|
|
202
205
|
private emitLifecycleCompleted;
|
|
203
206
|
private recordLearningRole;
|
|
204
207
|
private captureCompletedTaskLearning;
|
|
208
|
+
/**
|
|
209
|
+
* Lazily built so a session that never spawns a subagent pays nothing, and
|
|
210
|
+
* so the policy is read from the live config rather than frozen at boot.
|
|
211
|
+
* Returns null when auto-optimization is switched off.
|
|
212
|
+
*/
|
|
213
|
+
private getLearningOptimizer;
|
|
214
|
+
/**
|
|
215
|
+
* Resolve a model for the distillation pass. Uses the `memory-curator` slot
|
|
216
|
+
* of the model matrix when one is configured — curating learned knowledge is
|
|
217
|
+
* exactly that role's job — and the session default otherwise. A failure
|
|
218
|
+
* here is not fatal: the pass still writes the deterministic skill addenda.
|
|
219
|
+
*/
|
|
220
|
+
private resolveOptimizerLlm;
|
|
221
|
+
/**
|
|
222
|
+
* Evaluate every role with learning data once per session. Without it, a
|
|
223
|
+
* role that became eligible before this session would wait for its next
|
|
224
|
+
* capture — which for a rarely-used role can be never.
|
|
225
|
+
*/
|
|
226
|
+
private sweepLearningOptimization;
|
|
205
227
|
status(): FleetHostStatus;
|
|
206
228
|
/**
|
|
207
229
|
* Read-only concurrency + lifetime spawn budget for `/fleet status` and
|
package/dist/fleet/routing.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { SubagentRunner } from '@wrongstack/core/types';
|
|
2
|
-
import type { Config } from '@wrongstack/core/types';
|
|
1
|
+
import type { Config, SubagentRunner } from '@wrongstack/core/types';
|
|
3
2
|
import type { MultiAgentHost } from './host.js';
|
|
4
3
|
/**
|
|
5
4
|
* Routing runner — dispatches tasks to standard or ACP runner based on provider.
|
package/dist/goal-host.d.ts
CHANGED
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
* driven by the autonomous orchestrator + concurrent subagents rather than
|
|
16
16
|
* single-thread turn injection.
|
|
17
17
|
*/
|
|
18
|
-
import { type PhaseGraph, type PhaseProgress } from '@wrongstack/core/goal';
|
|
19
18
|
import { type BrainArbiter } from '@wrongstack/core/coordination';
|
|
20
|
-
import type
|
|
19
|
+
import { type PhaseGraph, type PhaseProgress } from '@wrongstack/core/goal';
|
|
21
20
|
import type { EventBus } from '@wrongstack/core/kernel';
|
|
21
|
+
import type { Config, TaskNode } from '@wrongstack/core/types';
|
|
22
22
|
import type { MultiAgentHost } from './multi-agent.js';
|
|
23
23
|
/**
|
|
24
24
|
* Extend/trim the autonomous goal command allowlist from the user's exec
|
package/dist/hooks-wiring.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { UserInputPayload } from '@wrongstack/core/agent';
|
|
1
2
|
import type { AgentExtension } from '@wrongstack/core/extension';
|
|
2
3
|
import type { HookRunner } from '@wrongstack/core/hooks';
|
|
3
|
-
import type { UserInputPayload } from '@wrongstack/core/agent';
|
|
4
4
|
/** Raised by the UserPromptSubmit middleware to block a turn before it runs. */
|
|
5
5
|
export declare class HookBlockedError extends Error {
|
|
6
6
|
constructor(reason: string);
|
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
parseTokenTtlValue
|
|
3
|
-
} from "./chunk-BGFM3PD7.js";
|
|
4
1
|
import {
|
|
5
2
|
resolveAuditActor
|
|
6
3
|
} from "./chunk-Q5GTM25S.js";
|
|
4
|
+
import {
|
|
5
|
+
parseTokenTtlValue
|
|
6
|
+
} from "./chunk-BGFM3PD7.js";
|
|
7
7
|
import "./chunk-7OCVIDC7.js";
|
|
8
8
|
|
|
9
9
|
// src/subcommands/handlers/hq.ts
|
|
10
|
-
import { HQ_AUTH_FILE_VERSION, HQ_CLI_DEFAULT_HOST, mutateHqAuthFile, mintHqToken, readHqAuthFile, resolveHqDataDir, logHqAuthAudit, hqAuthContentHash, hqAuthAuditPath, hqAuthFilePath } from "@wrongstack/core/hq";
|
|
11
|
-
import { HqInsecureExposureError } from "@wrongstack/core/hq";
|
|
12
|
-
import { expectDefined } from "@wrongstack/core/utils";
|
|
13
10
|
import * as fs from "node:fs/promises";
|
|
11
|
+
import {
|
|
12
|
+
HQ_AUTH_FILE_VERSION,
|
|
13
|
+
HQ_CLI_DEFAULT_HOST,
|
|
14
|
+
HqInsecureExposureError,
|
|
15
|
+
hqAuthAuditPath,
|
|
16
|
+
hqAuthContentHash,
|
|
17
|
+
hqAuthFilePath,
|
|
18
|
+
logHqAuthAudit,
|
|
19
|
+
mintHqToken,
|
|
20
|
+
mutateHqAuthFile,
|
|
21
|
+
readHqAuthFile,
|
|
22
|
+
resolveHqDataDir
|
|
23
|
+
} from "@wrongstack/core/hq";
|
|
24
|
+
import { expectDefined } from "@wrongstack/core/utils";
|
|
14
25
|
function resolveDataDir(deps) {
|
|
15
26
|
const override = typeof deps.flags?.["data-dir"] === "string" ? deps.flags["data-dir"] : void 0;
|
|
16
27
|
return resolveHqDataDir(override);
|
|
@@ -36,7 +47,7 @@ var hqCmd = async (args, deps) => {
|
|
|
36
47
|
return 1;
|
|
37
48
|
};
|
|
38
49
|
async function startServer(deps) {
|
|
39
|
-
const { startHqServer } = await import("./hq-server-
|
|
50
|
+
const { startHqServer } = await import("./hq-server-DME6EWIO.js");
|
|
40
51
|
const dataDir = resolveDataDir(deps);
|
|
41
52
|
const flags = deps.flags ?? {};
|
|
42
53
|
const host = typeof flags["host"] === "string" ? flags["host"] : HQ_CLI_DEFAULT_HOST;
|
|
@@ -183,10 +194,8 @@ async function hqAuditVerify(deps) {
|
|
|
183
194
|
`);
|
|
184
195
|
const fileExists = await fileExistsQuiet(authPath);
|
|
185
196
|
if (!fileExists) {
|
|
186
|
-
deps.renderer.write(
|
|
187
|
-
|
|
188
|
-
`
|
|
189
|
-
);
|
|
197
|
+
deps.renderer.write(`contentHash: (unavailable \u2014 auth.json does not exist)
|
|
198
|
+
`);
|
|
190
199
|
deps.renderer.write(
|
|
191
200
|
`Compare historical entries in the audit log above against a known-good hash.
|
|
192
201
|
`
|
|
@@ -199,10 +208,8 @@ async function hqAuditVerify(deps) {
|
|
|
199
208
|
});
|
|
200
209
|
const hash = hqAuthContentHash(authFile);
|
|
201
210
|
if (hash === void 0) {
|
|
202
|
-
deps.renderer.write(
|
|
203
|
-
|
|
204
|
-
`
|
|
205
|
-
);
|
|
211
|
+
deps.renderer.write(`contentHash: (unavailable \u2014 auth.json is unreadable or malformed)
|
|
212
|
+
`);
|
|
206
213
|
deps.renderer.write(
|
|
207
214
|
`Compare historical entries in the audit log above against a known-good hash.
|
|
208
215
|
`
|
|
@@ -283,7 +290,11 @@ function resolveTokenCapabilities(scope, args, deps) {
|
|
|
283
290
|
if (typeof raw !== "string") {
|
|
284
291
|
return { error: "--capabilities requires a comma-separated value." };
|
|
285
292
|
}
|
|
286
|
-
const capabilities = [
|
|
293
|
+
const capabilities = [
|
|
294
|
+
...new Set(
|
|
295
|
+
raw.split(",").map((item) => item.trim()).filter(Boolean)
|
|
296
|
+
)
|
|
297
|
+
];
|
|
287
298
|
const allowed = new Set(TOKEN_CAPABILITIES[scope]);
|
|
288
299
|
const invalid = capabilities.filter((capability) => !allowed.has(capability));
|
|
289
300
|
if (invalid.length > 0) {
|
|
@@ -409,25 +420,35 @@ async function tokenList(args, deps) {
|
|
|
409
420
|
});
|
|
410
421
|
const tokens = authFile[tokenField] ?? [];
|
|
411
422
|
if (tokens.length === 0) {
|
|
412
|
-
deps.renderer.write(
|
|
413
|
-
`
|
|
414
|
-
|
|
415
|
-
|
|
423
|
+
deps.renderer.write(
|
|
424
|
+
`No ${scope} tokens issued. ${scope === "browser" ? "Browsers" : "Clients"} are in OPEN MODE.
|
|
425
|
+
`
|
|
426
|
+
);
|
|
427
|
+
deps.renderer.write(
|
|
428
|
+
`Run \`wstack hq token create ${scope === "client" ? "--client " : ""}[label]\` to enter TOKEN MODE.
|
|
429
|
+
`
|
|
430
|
+
);
|
|
416
431
|
return 0;
|
|
417
432
|
}
|
|
418
|
-
deps.renderer.write(
|
|
419
|
-
|
|
433
|
+
deps.renderer.write(
|
|
434
|
+
`${scope === "client" ? "Client" : "Browser"} tokens (${tokens.length}) \u2014 TOKEN MODE:
|
|
435
|
+
`
|
|
436
|
+
);
|
|
420
437
|
deps.renderer.write("\n");
|
|
421
438
|
for (const t of tokens) {
|
|
422
439
|
const masked = `${t.token.slice(0, 6)}\u2026${t.token.slice(-4)} (${t.token.length} chars)`;
|
|
423
440
|
const capabilities = t.capabilities === void 0 ? "legacy-unscoped" : t.capabilities.join(",") || "none";
|
|
424
441
|
const expires = t.expiresAt ?? "(never)";
|
|
425
|
-
deps.renderer.write(
|
|
426
|
-
`
|
|
442
|
+
deps.renderer.write(
|
|
443
|
+
` ${t.id} ${masked} ${t.createdAt} expires ${expires}${t.label ? ` "${t.label}"` : ""} [${capabilities}]${t.lastUsedAt ? ` lastUsed ${t.lastUsedAt}` : ""}
|
|
444
|
+
`
|
|
445
|
+
);
|
|
427
446
|
}
|
|
428
447
|
deps.renderer.write("\n");
|
|
429
|
-
deps.renderer.write(
|
|
430
|
-
|
|
448
|
+
deps.renderer.write(
|
|
449
|
+
`${scope === "client" ? "Clients" : "Browsers"} must append ?token=<full-token> to /ws/${scope}.
|
|
450
|
+
`
|
|
451
|
+
);
|
|
431
452
|
return 0;
|
|
432
453
|
}
|
|
433
454
|
async function tokenRevoke(args, deps) {
|
|
@@ -435,8 +456,10 @@ async function tokenRevoke(args, deps) {
|
|
|
435
456
|
const pos = tokenPositionals(args);
|
|
436
457
|
const idPrefix = pos[0];
|
|
437
458
|
if (!idPrefix) {
|
|
438
|
-
deps.renderer.writeError(
|
|
439
|
-
`
|
|
459
|
+
deps.renderer.writeError(
|
|
460
|
+
`Usage: wstack hq token revoke ${scope === "client" ? "--client " : ""}<id-prefix>
|
|
461
|
+
`
|
|
462
|
+
);
|
|
440
463
|
return 1;
|
|
441
464
|
}
|
|
442
465
|
const dataDir = resolveDataDir(deps);
|
|
@@ -475,8 +498,10 @@ async function tokenRevoke(args, deps) {
|
|
|
475
498
|
`);
|
|
476
499
|
return 1;
|
|
477
500
|
}
|
|
478
|
-
deps.renderer.write(
|
|
479
|
-
`)
|
|
501
|
+
deps.renderer.write(
|
|
502
|
+
`Revoked ${scope} token ${revoked.id}${revoked.label ? ` ("${revoked.label}")` : ""}.
|
|
503
|
+
`
|
|
504
|
+
);
|
|
480
505
|
const hashField = await computeAuditHashField(
|
|
481
506
|
dataDir,
|
|
482
507
|
(msg) => deps.renderer.writeWarning(`${msg}
|
|
@@ -508,39 +533,57 @@ function printHelp(deps) {
|
|
|
508
533
|
`);
|
|
509
534
|
deps.renderer.write(` wstack hq serve Same as above (explicit form).
|
|
510
535
|
`);
|
|
511
|
-
deps.renderer.write(
|
|
512
|
-
`
|
|
513
|
-
|
|
514
|
-
|
|
536
|
+
deps.renderer.write(
|
|
537
|
+
` wstack hq token create [label] [--ttl <dur>] Mint a browser token, enter token mode.
|
|
538
|
+
`
|
|
539
|
+
);
|
|
540
|
+
deps.renderer.write(
|
|
541
|
+
` wstack hq token create --client [label] [--ttl <dur>] Mint a client token (/ws/client).
|
|
542
|
+
`
|
|
543
|
+
);
|
|
515
544
|
deps.renderer.write(` wstack hq token list List issued browser tokens.
|
|
516
545
|
`);
|
|
517
546
|
deps.renderer.write(` wstack hq token list --client List issued client tokens.
|
|
518
547
|
`);
|
|
519
|
-
deps.renderer.write(
|
|
520
|
-
`)
|
|
548
|
+
deps.renderer.write(
|
|
549
|
+
` wstack hq token revoke <id> Revoke a browser token (id prefix match).
|
|
550
|
+
`
|
|
551
|
+
);
|
|
521
552
|
deps.renderer.write(` wstack hq token revoke --client <id> Revoke a client token.
|
|
522
553
|
`);
|
|
523
|
-
deps.renderer.write(
|
|
524
|
-
`
|
|
554
|
+
deps.renderer.write(
|
|
555
|
+
` wstack hq audit verify Re-derive auth.json contentHash for forensic comparison.
|
|
556
|
+
`
|
|
557
|
+
);
|
|
525
558
|
deps.renderer.write("\n");
|
|
526
559
|
deps.renderer.write(`Flags (apply to all subcommands):
|
|
527
560
|
`);
|
|
528
|
-
deps.renderer.write(
|
|
529
|
-
`)
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
deps.renderer.write(
|
|
533
|
-
`)
|
|
561
|
+
deps.renderer.write(
|
|
562
|
+
` --data-dir <path> Override HQ data directory (default ~/.wrongstack/hq).
|
|
563
|
+
`
|
|
564
|
+
);
|
|
565
|
+
deps.renderer.write(
|
|
566
|
+
` --host <ip> Bind host (default 0.0.0.0; use 127.0.0.1 for local-only).
|
|
567
|
+
`
|
|
568
|
+
);
|
|
569
|
+
deps.renderer.write(
|
|
570
|
+
` --tunnel Publish a temporary *.trycloudflare.com URL (requires cloudflared).
|
|
571
|
+
`
|
|
572
|
+
);
|
|
534
573
|
deps.renderer.write(` --password <value> Set or rotate the browser login password.
|
|
535
574
|
`);
|
|
536
|
-
deps.renderer.write(
|
|
537
|
-
`
|
|
575
|
+
deps.renderer.write(
|
|
576
|
+
` --insecure-open Allow a non-loopback bind with no token/password set.
|
|
577
|
+
`
|
|
578
|
+
);
|
|
538
579
|
deps.renderer.write(` --port <n> Bind port (default 3499).
|
|
539
580
|
`);
|
|
540
581
|
deps.renderer.write(` --strict-port Fail if port is in use.
|
|
541
582
|
`);
|
|
542
|
-
deps.renderer.write(
|
|
543
|
-
`)
|
|
583
|
+
deps.renderer.write(
|
|
584
|
+
` --hq-token-ttl <dur> Stamp an expiresAt on first-run tokens (e.g. 1h, 7d, 3600s).
|
|
585
|
+
`
|
|
586
|
+
);
|
|
544
587
|
deps.renderer.write(
|
|
545
588
|
` --hq-trusted-proxy-hops <n> Trust the rightmost n X-Forwarded-For entries when rate-limiting logins.
|
|
546
589
|
Default 0 (ignore the header). Set to the real hop count behind a tunnel,
|
|
@@ -549,12 +592,18 @@ function printHelp(deps) {
|
|
|
549
592
|
);
|
|
550
593
|
deps.renderer.write(` --open Open the dashboard in the default browser.
|
|
551
594
|
`);
|
|
552
|
-
deps.renderer.write(
|
|
553
|
-
`
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
deps.renderer.write(
|
|
557
|
-
`)
|
|
595
|
+
deps.renderer.write(
|
|
596
|
+
` --client, -c Operate on client tokens instead of browser tokens.
|
|
597
|
+
`
|
|
598
|
+
);
|
|
599
|
+
deps.renderer.write(
|
|
600
|
+
` --capabilities <csv> Token grants (browser: control.enqueue; client: telemetry.publish,control.execute).
|
|
601
|
+
`
|
|
602
|
+
);
|
|
603
|
+
deps.renderer.write(
|
|
604
|
+
` --ttl <duration> Stamp an expiresAt on the token (e.g. --ttl 1h, --ttl 7d, --ttl 3600s).
|
|
605
|
+
`
|
|
606
|
+
);
|
|
558
607
|
deps.renderer.write("\n");
|
|
559
608
|
deps.renderer.write(`auth.json schema version: ${HQ_AUTH_FILE_VERSION}.
|
|
560
609
|
`);
|
|
@@ -563,4 +612,4 @@ export {
|
|
|
563
612
|
hqCmd,
|
|
564
613
|
resolveAuditActor
|
|
565
614
|
};
|
|
566
|
-
//# sourceMappingURL=hq-
|
|
615
|
+
//# sourceMappingURL=hq-CD77GVSS.js.map
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @module hq-command-controller
|
|
16
16
|
*/
|
|
17
|
-
import type { HqPublisherCommandResult } from '@wrongstack/core/hq';
|
|
18
17
|
import type { RemoteMailbox } from '@wrongstack/core/coordination';
|
|
18
|
+
import type { HqPublisherCommandResult } from '@wrongstack/core/hq';
|
|
19
19
|
/**
|
|
20
20
|
* Mutable holder for the command dispatch targets. Each field is populated
|
|
21
21
|
* lazily as the corresponding subsystem comes online (director on
|
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
* Covers: system update check, system health, command audit log, alerts.
|
|
6
6
|
*/
|
|
7
7
|
import type * as http from 'node:http';
|
|
8
|
+
import type { HqAlertEngine, HqCommandAuditLog, HqEventEnvelope, HqPersistence } from '@wrongstack/core/hq';
|
|
8
9
|
import type { WebSocket } from 'ws';
|
|
9
|
-
import type { HqCommandAuditLog, HqEventEnvelope, HqPersistence } from '@wrongstack/core/hq';
|
|
10
|
-
import type { HqAlertEngine } from '@wrongstack/core/hq';
|
|
11
10
|
import type { ConnectedClient } from '../types.js';
|
|
12
11
|
export declare function handleApiSystemUpdate(res: http.ServerResponse): Promise<void>;
|
|
13
12
|
export declare function handleApiSystemHealth(res: http.ServerResponse, clients: Map<WebSocket, ConnectedClient>, persistence: HqPersistence, eventLog: HqEventEnvelope[]): Promise<void>;
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
* @module hq-server/routes
|
|
9
9
|
*/
|
|
10
10
|
import type * as http from 'node:http';
|
|
11
|
-
import type { WebSocket } from 'ws';
|
|
12
|
-
import type { TrustBoundary } from '@wrongstack/core/security';
|
|
13
|
-
import { type createHqPersistence } from '@wrongstack/core/hq';
|
|
14
|
-
import type { HqSnapshot, HqAlertEngine, HqCommandAuditLog, HqEventEnvelope, HqTranscriptEntry } from '@wrongstack/core/hq';
|
|
15
11
|
import type { createMailboxHttpRouter } from '@wrongstack/core/coordination';
|
|
16
12
|
import { type Mailbox, type MailboxHttpAccessDecision, type MailboxHttpRateLimiter } from '@wrongstack/core/coordination';
|
|
13
|
+
import type { HqAlertEngine, HqCommandAuditLog, HqEventEnvelope, HqSnapshot, HqTranscriptEntry } from '@wrongstack/core/hq';
|
|
14
|
+
import { type createHqPersistence } from '@wrongstack/core/hq';
|
|
15
|
+
import type { TrustBoundary } from '@wrongstack/core/security';
|
|
16
|
+
import type { WebSocket } from 'ws';
|
|
17
17
|
import * as HqServerAuth from './auth.js';
|
|
18
|
-
import * as HqServerUtils from './utils.js';
|
|
19
18
|
import { type ApplyHqAuthFile } from './routes/auth-handlers.js';
|
|
19
|
+
import * as HqServerUtils from './utils.js';
|
|
20
20
|
export declare const setHqSecurityHeaders: typeof HqServerAuth.setHqSecurityHeaders;
|
|
21
21
|
export declare const hasTrustedBrowserOrigin: typeof HqServerAuth.hasTrustedBrowserOrigin;
|
|
22
22
|
export declare const authenticateBrowserRequest: typeof HqServerAuth.authenticateBrowserRequest;
|
|
@@ -41,9 +41,9 @@ export declare const agentMessageToEntry: typeof HqServerUtils.agentMessageToEnt
|
|
|
41
41
|
export declare const readLocalSubagentTranscript: typeof HqServerUtils.readLocalSubagentTranscript;
|
|
42
42
|
export declare const lanIPv4Addresses: typeof HqServerUtils.lanIPv4Addresses;
|
|
43
43
|
export declare const hqRuntimeMarkerPath: typeof HqServerUtils.hqRuntimeMarkerPath;
|
|
44
|
-
import type { ConnectedClient, HqRouterMutableAuth, HqSessionEntry, HqSnapshotBroadcaster, ProjectDetail, TranscriptRing } from './types.js';
|
|
45
44
|
import type { LoginAttemptStore } from './login-attempt-store.js';
|
|
46
|
-
|
|
45
|
+
import type { ConnectedClient, HqRouterMutableAuth, HqSessionEntry, HqSnapshotBroadcaster, ProjectDetail, TranscriptRing } from './types.js';
|
|
46
|
+
export type { ConnectedClient, HqSnapshotBroadcaster, ProjectDetail, TranscriptRing };
|
|
47
47
|
export interface HqRouterMailboxGateway {
|
|
48
48
|
mailbox: Mailbox;
|
|
49
49
|
router: ReturnType<typeof createMailboxHttpRouter>;
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
readLocalSubagentTranscript,
|
|
16
16
|
sanitizeApiError,
|
|
17
17
|
startHqServer
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-LUAFQIXT.js";
|
|
19
19
|
import "./chunk-KE7E7DPX.js";
|
|
20
20
|
import "./chunk-Q5GTM25S.js";
|
|
21
21
|
import "./chunk-7OCVIDC7.js";
|
|
@@ -37,4 +37,4 @@ export {
|
|
|
37
37
|
sanitizeApiError,
|
|
38
38
|
startHqServer
|
|
39
39
|
};
|
|
40
|
-
//# sourceMappingURL=hq-server-
|
|
40
|
+
//# sourceMappingURL=hq-server-DME6EWIO.js.map
|
package/dist/index.d.ts
CHANGED