@wrongstack/cli 1.1.2 → 1.1.4
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/dist/{acp-HCGUTFNE.js → acp-MZ5MQBFN.js} +13 -5
- package/dist/acp-leader/acp-leader-confirm.d.ts +18 -0
- package/dist/acp-leader/acp-leader-context.d.ts +29 -0
- package/dist/acp-leader/acp-leader-fleet.d.ts +26 -0
- package/dist/acp-leader/acp-leader-host-binding.d.ts +16 -0
- package/dist/acp-leader/acp-leader-host.d.ts +80 -0
- package/dist/acp-leader/acp-leader-picker.d.ts +21 -0
- package/dist/acp-leader/acp-leader-provider.d.ts +85 -0
- package/dist/acp-leader/acp-leader-resume.d.ts +10 -0
- package/dist/acp-leader/acp-leader-stream.d.ts +82 -0
- package/dist/{auth-ANOVZVHE.js → auth-IHQS6AFW.js} +60 -64
- package/dist/auth-menu/index.d.ts +1 -2
- package/dist/boot/dispatch-webui.d.ts +16 -0
- package/dist/{chunk-GRAGMA4B.js → chunk-2LTHDKZX.js} +4 -4
- package/dist/chunk-3LEIFO5D.js +65 -0
- package/dist/chunk-COGI7EQU.js +1458 -0
- package/dist/chunk-GKGWPFW2.js +50 -0
- package/dist/{chunk-RAWHRRUJ.js → chunk-I5LJLKA3.js} +198 -197
- package/dist/{chunk-5TRZZHMN.js → chunk-JCZ2D3VV.js} +4 -65
- package/dist/{chunk-XT3NAHRX.js → chunk-JKTJSLUT.js} +192 -1
- package/dist/{chunk-NMXQFQ26.js → chunk-TAE3EGBM.js} +3 -3
- package/dist/{chunk-3R3OADC5.js → chunk-ZF4HRR5F.js} +7 -3
- package/dist/{cli-context-YIT4FEDM.js → cli-context-E44HQ4ZO.js} +13 -7
- package/dist/{cli-main-JIADJ5OL.js → cli-main-OT63I2FX.js} +452 -217
- package/dist/{execution-BAP566QC.js → execution-OK34CJKJ.js} +7 -2
- package/dist/fleet/acp-live-steer.d.ts +28 -0
- package/dist/fleet/acp-permission-bridge.d.ts +49 -0
- package/dist/fleet/acp-quota-hold.d.ts +3 -0
- package/dist/fleet/acp-quota-reading.d.ts +3 -0
- package/dist/fleet/acp-turn-reminders.d.ts +15 -0
- package/dist/fleet/acp-wrongstack-bridge.d.ts +42 -0
- package/dist/fleet/host-acp.d.ts +20 -2
- package/dist/index.js +7 -4
- package/dist/{mcp-2XWBJEQN.js → mcp-W7A5HUXV.js} +97 -1
- package/dist/mcp-serve-project.d.ts +18 -0
- package/dist/{per-subcommand-help-D6J4ZXW2.js → per-subcommand-help-4GYSCMLU.js} +2 -2
- package/dist/{short-circuit-flags-CPCT5MWB.js → short-circuit-flags-QEXUS3BY.js} +2 -2
- package/dist/{subcommands-VTMIZQBP.js → subcommands-YADUV7IJ.js} +2 -2
- package/dist/{webui-server-HIUY3RHD.js → webui-server-CB64CFDG.js} +41 -3
- package/package.json +34 -30
- package/dist/auth-menu/anthropic-oauth.d.ts +0 -43
- package/dist/chunk-ZNNFEKDZ.js +0 -319
|
@@ -18,14 +18,12 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
configureSimpleUiRuntimeContext,
|
|
20
20
|
detectProjectFacts,
|
|
21
|
-
isRestrictedMode,
|
|
22
21
|
isSafeMode,
|
|
23
22
|
makeConfirmAwaiter,
|
|
24
23
|
renderAgentsTemplate,
|
|
25
24
|
resolveToolRestriction,
|
|
26
|
-
unknownRestrictedToolNames
|
|
27
|
-
|
|
28
|
-
} from "./chunk-5TRZZHMN.js";
|
|
25
|
+
unknownRestrictedToolNames
|
|
26
|
+
} from "./chunk-JCZ2D3VV.js";
|
|
29
27
|
import "./chunk-JTTV2EVA.js";
|
|
30
28
|
import {
|
|
31
29
|
awaitFirstWrongProxyProbe,
|
|
@@ -73,7 +71,7 @@ import {
|
|
|
73
71
|
import {
|
|
74
72
|
renderDeepHelpToString,
|
|
75
73
|
renderFocusedHelpToString
|
|
76
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-ZF4HRR5F.js";
|
|
77
75
|
import {
|
|
78
76
|
explainCall,
|
|
79
77
|
formatExplainedCall,
|
|
@@ -111,7 +109,7 @@ import {
|
|
|
111
109
|
runAuthLocal,
|
|
112
110
|
runProviderAuthLogin,
|
|
113
111
|
validateFamily
|
|
114
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-I5LJLKA3.js";
|
|
115
113
|
import "./chunk-ZXX3MJRL.js";
|
|
116
114
|
import {
|
|
117
115
|
buildPickableProviders,
|
|
@@ -136,14 +134,24 @@ import {
|
|
|
136
134
|
createGracefulShutdown,
|
|
137
135
|
formatAcpAgentList,
|
|
138
136
|
loadCachedAcpRegistry,
|
|
137
|
+
recordAcpRateLimit,
|
|
139
138
|
refreshAcpRegistry,
|
|
140
|
-
setupProvider
|
|
141
|
-
|
|
139
|
+
setupProvider,
|
|
140
|
+
startAcpTurnReminders,
|
|
141
|
+
wrongstackAcpPermissionPolicy
|
|
142
|
+
} from "./chunk-COGI7EQU.js";
|
|
142
143
|
import {
|
|
144
|
+
DEFAULT_BRIDGE_SERVERS,
|
|
143
145
|
createHqCommandDispatcher,
|
|
144
146
|
createProjectKanbanAssignHandler,
|
|
145
|
-
createProjectKanbanTransitionHandler
|
|
146
|
-
|
|
147
|
+
createProjectKanbanTransitionHandler,
|
|
148
|
+
installedBridgeAgents,
|
|
149
|
+
wrongstackBridgeSetup
|
|
150
|
+
} from "./chunk-JKTJSLUT.js";
|
|
151
|
+
import {
|
|
152
|
+
isRestrictedMode,
|
|
153
|
+
withRestrictedTools
|
|
154
|
+
} from "./chunk-3LEIFO5D.js";
|
|
147
155
|
import {
|
|
148
156
|
startCliHqConnection
|
|
149
157
|
} from "./chunk-76JE54WD.js";
|
|
@@ -162,6 +170,11 @@ import {
|
|
|
162
170
|
import {
|
|
163
171
|
parseSpawnFlags
|
|
164
172
|
} from "./chunk-75OLD563.js";
|
|
173
|
+
import {
|
|
174
|
+
ACP_LEADER_PROVIDER_ID,
|
|
175
|
+
acpLeaderSessionAgent,
|
|
176
|
+
bindAcpLeaderHost
|
|
177
|
+
} from "./chunk-GKGWPFW2.js";
|
|
165
178
|
import {
|
|
166
179
|
checkForUpdate
|
|
167
180
|
} from "./chunk-H53EXXAU.js";
|
|
@@ -1008,7 +1021,18 @@ function createPickableProvidersLoader(args) {
|
|
|
1008
1021
|
logger,
|
|
1009
1022
|
reason: "model-picker"
|
|
1010
1023
|
});
|
|
1011
|
-
|
|
1024
|
+
const config = getConfig();
|
|
1025
|
+
const providers = await buildPickableProviders(modelsRegistry, config);
|
|
1026
|
+
const agents = installedBridgeAgents(config.acp);
|
|
1027
|
+
return agents.length > 0 && !providers.some((p) => p.id === ACP_LEADER_PROVIDER_ID) ? [
|
|
1028
|
+
...providers,
|
|
1029
|
+
{
|
|
1030
|
+
id: ACP_LEADER_PROVIDER_ID,
|
|
1031
|
+
family: "acp",
|
|
1032
|
+
models: agents,
|
|
1033
|
+
modelsLabel: "ACP agent as leader"
|
|
1034
|
+
}
|
|
1035
|
+
] : providers;
|
|
1012
1036
|
};
|
|
1013
1037
|
}
|
|
1014
1038
|
|
|
@@ -2962,6 +2986,44 @@ import {
|
|
|
2962
2986
|
MCPVaultTokenStore
|
|
2963
2987
|
} from "@wrongstack/mcp";
|
|
2964
2988
|
|
|
2989
|
+
// src/acp-leader/acp-leader-host-binding.ts
|
|
2990
|
+
import { randomUUID } from "node:crypto";
|
|
2991
|
+
function createAcpLeaderHost(opts) {
|
|
2992
|
+
const agentFor = (sessionId) => (sessionId ? acpLeaderSessionAgent(sessionId) : void 0) ?? opts.agent;
|
|
2993
|
+
return {
|
|
2994
|
+
events: opts.events,
|
|
2995
|
+
projectRoot: opts.projectRoot,
|
|
2996
|
+
stateDir: opts.stateDir,
|
|
2997
|
+
getConfig: opts.getConfig,
|
|
2998
|
+
permission: (sessionId) => agentFor(sessionId).permission,
|
|
2999
|
+
context: (sessionId) => agentFor(sessionId).ctx,
|
|
3000
|
+
getTool: opts.getTool,
|
|
3001
|
+
runTool: async (name, input, run = {}) => {
|
|
3002
|
+
const agent = agentFor(run.sessionId);
|
|
3003
|
+
const use = { type: "tool_use", id: `acp_fleet_${randomUUID()}`, name, input };
|
|
3004
|
+
const batch = await agent.toolExecutor.executeBatch([use], agent.ctx, "sequential");
|
|
3005
|
+
let result = batch.outputs[0]?.result;
|
|
3006
|
+
if (result?.type === "tool_confirm_pending") {
|
|
3007
|
+
const tool = opts.getTool(name);
|
|
3008
|
+
const approved = { ...use, input: result.input };
|
|
3009
|
+
if (!tool || !await run.approve?.(tool, approved.input)) {
|
|
3010
|
+
return { content: `${name} was not approved by the user.`, isError: true };
|
|
3011
|
+
}
|
|
3012
|
+
result = (await agent.toolExecutor.executeTool(
|
|
3013
|
+
tool,
|
|
3014
|
+
approved,
|
|
3015
|
+
agent.ctx,
|
|
3016
|
+
agent.perIterationOutputCapBytes
|
|
3017
|
+
)).block;
|
|
3018
|
+
}
|
|
3019
|
+
if (!result) return { content: `${name} returned no result.`, isError: true };
|
|
3020
|
+
const content = typeof result.content === "string" ? result.content : JSON.stringify(result.content);
|
|
3021
|
+
return { content, isError: Boolean(result.is_error) };
|
|
3022
|
+
},
|
|
3023
|
+
confirmAwaiter: opts.confirmAwaiter
|
|
3024
|
+
};
|
|
3025
|
+
}
|
|
3026
|
+
|
|
2965
3027
|
// src/hooks-wiring.ts
|
|
2966
3028
|
var HookBlockedError = class extends Error {
|
|
2967
3029
|
constructor(reason) {
|
|
@@ -3790,6 +3852,7 @@ async function setupLifecycleAndPlugins(deps) {
|
|
|
3790
3852
|
logger.debug(`max-context re-resolve after catalog change failed: ${toErrorMessage3(err)}`);
|
|
3791
3853
|
});
|
|
3792
3854
|
});
|
|
3855
|
+
const confirmAwaiter = makeConfirmAwaiter(reader);
|
|
3793
3856
|
const agent = createAgent({
|
|
3794
3857
|
container,
|
|
3795
3858
|
tools: toolRegistry,
|
|
@@ -3798,13 +3861,24 @@ async function setupLifecycleAndPlugins(deps) {
|
|
|
3798
3861
|
pipelines,
|
|
3799
3862
|
context,
|
|
3800
3863
|
config,
|
|
3801
|
-
confirmAwaiter
|
|
3864
|
+
confirmAwaiter,
|
|
3802
3865
|
hookRunner,
|
|
3803
3866
|
tracer: deps.tracer,
|
|
3804
3867
|
fullConfig: config,
|
|
3805
3868
|
source: "cli"
|
|
3806
3869
|
});
|
|
3807
3870
|
agent.extensions.register(createLifecycleHooksExtension(hookRunner));
|
|
3871
|
+
bindAcpLeaderHost(
|
|
3872
|
+
createAcpLeaderHost({
|
|
3873
|
+
agent,
|
|
3874
|
+
events,
|
|
3875
|
+
projectRoot: wpaths.projectRoot,
|
|
3876
|
+
stateDir: wpaths.projectDir,
|
|
3877
|
+
getConfig: () => configStore.get(),
|
|
3878
|
+
getTool: (name) => toolRegistry.get(name),
|
|
3879
|
+
confirmAwaiter
|
|
3880
|
+
})
|
|
3881
|
+
);
|
|
3808
3882
|
const mcpTokenStore = new MCPVaultTokenStore(
|
|
3809
3883
|
path6.join(wpaths.projectDir, "mcp-auth.json"),
|
|
3810
3884
|
vault
|
|
@@ -4071,7 +4145,7 @@ function setupProviderRuntime(deps) {
|
|
|
4071
4145
|
const buildProviderForId2 = (providerId) => buildProviderForIdRuntime({ config: cfg, providerRegistry, logger }, providerId);
|
|
4072
4146
|
const buildProviderForModel = async (providerId, modelId) => {
|
|
4073
4147
|
const provider = buildProviderForId2(providerId);
|
|
4074
|
-
if (!cfg.features.modelsRegistry) return provider;
|
|
4148
|
+
if (!cfg.features.modelsRegistry || providerId === ACP_LEADER_PROVIDER_ID) return provider;
|
|
4075
4149
|
const { cfg: resolvedCfg } = resolveProviderCfg2(providerId);
|
|
4076
4150
|
return withCatalogCapabilities(
|
|
4077
4151
|
modelsRegistry,
|
|
@@ -6424,7 +6498,7 @@ async function bootCliRuntime(cliCtx, state) {
|
|
|
6424
6498
|
|
|
6425
6499
|
// src/cli-main-orchestration.ts
|
|
6426
6500
|
import { mailboxSessionTag as mailboxSessionTag8 } from "@wrongstack/core/coordination";
|
|
6427
|
-
import { TOKENS as
|
|
6501
|
+
import { TOKENS as TOKENS17 } from "@wrongstack/core/kernel";
|
|
6428
6502
|
import { createPolicySandboxApprover, setSandboxExpansionApprover } from "@wrongstack/core/sandbox";
|
|
6429
6503
|
|
|
6430
6504
|
// src/cli-eternal-flag.ts
|
|
@@ -6494,7 +6568,7 @@ import {
|
|
|
6494
6568
|
createBrainRuntime,
|
|
6495
6569
|
resolveBrainConfigDefaults
|
|
6496
6570
|
} from "@wrongstack/core/execution";
|
|
6497
|
-
import { TOKENS as
|
|
6571
|
+
import { TOKENS as TOKENS15 } from "@wrongstack/core/kernel";
|
|
6498
6572
|
import {
|
|
6499
6573
|
createMcpControlTool,
|
|
6500
6574
|
createMcpUseTool,
|
|
@@ -6610,21 +6684,27 @@ function createSubagentWrongTraceHookRunner(sessionId, emit) {
|
|
|
6610
6684
|
}
|
|
6611
6685
|
|
|
6612
6686
|
// src/fleet/host.ts
|
|
6613
|
-
import { randomUUID as
|
|
6687
|
+
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
6614
6688
|
import { createProjectAgentRoster } from "@wrongstack/core/agent-catalog";
|
|
6615
6689
|
import {
|
|
6616
6690
|
areSubagentsAllowedForSession as areSubagentsAllowedForSession2,
|
|
6617
6691
|
FLEET_ROSTER as FLEET_ROSTER2,
|
|
6618
|
-
resolveProjectDir as
|
|
6692
|
+
resolveProjectDir as resolveProjectDir3
|
|
6619
6693
|
} from "@wrongstack/core/coordination";
|
|
6620
6694
|
import { ToolRegistry as ToolRegistry3 } from "@wrongstack/core/registry";
|
|
6621
6695
|
import {
|
|
6622
6696
|
AgentError
|
|
6623
6697
|
} from "@wrongstack/core/types";
|
|
6624
|
-
import { wstackGlobalRoot as
|
|
6698
|
+
import { wstackGlobalRoot as wstackGlobalRoot3 } from "@wrongstack/core/utils";
|
|
6625
6699
|
|
|
6626
6700
|
// src/fleet/host-acp-runner.ts
|
|
6627
|
-
import { randomUUID } from "node:crypto";
|
|
6701
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
6702
|
+
import { TOKENS as TOKENS9 } from "@wrongstack/core/kernel";
|
|
6703
|
+
import {
|
|
6704
|
+
AutoApprovePermissionPolicy,
|
|
6705
|
+
subagentYoloPlus,
|
|
6706
|
+
ToolCapabilities
|
|
6707
|
+
} from "@wrongstack/core/security";
|
|
6628
6708
|
|
|
6629
6709
|
// src/fleet/host-event-bridge.ts
|
|
6630
6710
|
import * as path11 from "node:path";
|
|
@@ -6977,6 +7057,26 @@ function publishAcpLiveProgress(opts) {
|
|
|
6977
7057
|
});
|
|
6978
7058
|
return;
|
|
6979
7059
|
}
|
|
7060
|
+
case "turn_usage": {
|
|
7061
|
+
const t = event.tokens;
|
|
7062
|
+
fleet?.emit({
|
|
7063
|
+
subagentId,
|
|
7064
|
+
taskId,
|
|
7065
|
+
ts,
|
|
7066
|
+
type: "provider.response",
|
|
7067
|
+
payload: {
|
|
7068
|
+
provider: "acp",
|
|
7069
|
+
usage: {
|
|
7070
|
+
input: t?.input ?? 0,
|
|
7071
|
+
output: t?.output ?? 0,
|
|
7072
|
+
cacheRead: t?.cacheRead ?? 0,
|
|
7073
|
+
cacheWrite: t?.cacheWrite ?? 0
|
|
7074
|
+
},
|
|
7075
|
+
costUsd: event.costUsd
|
|
7076
|
+
}
|
|
7077
|
+
});
|
|
7078
|
+
return;
|
|
7079
|
+
}
|
|
6980
7080
|
default:
|
|
6981
7081
|
return;
|
|
6982
7082
|
}
|
|
@@ -6992,15 +7092,42 @@ function safeJson(value) {
|
|
|
6992
7092
|
|
|
6993
7093
|
// src/fleet/host-acp-runner.ts
|
|
6994
7094
|
function acpCommandOpts() {
|
|
6995
|
-
let
|
|
7095
|
+
let acp;
|
|
6996
7096
|
try {
|
|
6997
|
-
|
|
7097
|
+
acp = this.deps.configStore.get()?.acp;
|
|
6998
7098
|
} catch {
|
|
6999
|
-
|
|
7099
|
+
acp = void 0;
|
|
7000
7100
|
}
|
|
7101
|
+
const overrides = acp?.agents;
|
|
7001
7102
|
return {
|
|
7002
7103
|
...overrides ? { overrides } : {},
|
|
7104
|
+
projectRoot: this.deps.projectRoot,
|
|
7105
|
+
bridge: { projectRoot: this.deps.projectRoot, config: acp?.bridge },
|
|
7106
|
+
// The worker answers to the same rules as WrongStack's own subagents:
|
|
7107
|
+
// the user's deny rules, the destructive and credential guards, YOLO+.
|
|
7108
|
+
// Every capability is granted; the guards, not an allowlist, gate it.
|
|
7109
|
+
permissions: (ctx) => {
|
|
7110
|
+
const leaderPolicy = this.deps.container.safeResolve(TOKENS9.PermissionPolicy);
|
|
7111
|
+
const policy = new AutoApprovePermissionPolicy(Object.values(ToolCapabilities), {
|
|
7112
|
+
yoloPlus: () => subagentYoloPlus({
|
|
7113
|
+
sessionId: ctx.sessionId,
|
|
7114
|
+
leaderPolicy,
|
|
7115
|
+
fallback: () => this.deps.configStore.get().autonomy?.yoloPlus === true
|
|
7116
|
+
})
|
|
7117
|
+
});
|
|
7118
|
+
return wrongstackAcpPermissionPolicy({
|
|
7119
|
+
evaluate: (tool, input, scope) => policy.evaluate(tool, input, scope),
|
|
7120
|
+
getTool: (name) => this.deps.toolRegistry.get(name),
|
|
7121
|
+
projectRoot: this.deps.projectRoot,
|
|
7122
|
+
allowMcp: !isRestrictedMode({}),
|
|
7123
|
+
onRefused: (call, reason) => this.deps.container.safeResolve(TOKENS9.Logger)?.info(`acp worker ${ctx.subagentId}: refused ${call.tool} \u2014 ${reason}`)
|
|
7124
|
+
});
|
|
7125
|
+
},
|
|
7003
7126
|
publishLive: (ctx, task, event) => {
|
|
7127
|
+
if (event.type === "rate_limit") {
|
|
7128
|
+
recordAcpRateLimit(ctx.config.role ?? ctx.config.name ?? ctx.subagentId, event.info);
|
|
7129
|
+
return;
|
|
7130
|
+
}
|
|
7004
7131
|
publishAcpLiveProgress({
|
|
7005
7132
|
event,
|
|
7006
7133
|
subagentId: ctx.subagentId,
|
|
@@ -7014,7 +7141,7 @@ function acpCommandOpts() {
|
|
|
7014
7141
|
};
|
|
7015
7142
|
}
|
|
7016
7143
|
async function spawnACP(subagentId, task, config) {
|
|
7017
|
-
const taskId =
|
|
7144
|
+
const taskId = randomUUID2();
|
|
7018
7145
|
await this.ensureCoordinator(config);
|
|
7019
7146
|
const coordinator = this.getCoordinator();
|
|
7020
7147
|
const acpRunner = await this.buildACPRunner(subagentId);
|
|
@@ -7052,7 +7179,41 @@ import {
|
|
|
7052
7179
|
makeACPSubagentRunner,
|
|
7053
7180
|
resolveAcpAgentCommand
|
|
7054
7181
|
} from "@wrongstack/acp";
|
|
7182
|
+
import { getSharedProjectMailbox as getSharedProjectMailbox4, resolveProjectDir as resolveProjectDir2 } from "@wrongstack/core/coordination";
|
|
7055
7183
|
import { ToolValidationError } from "@wrongstack/core/types";
|
|
7184
|
+
import { wstackGlobalRoot as wstackGlobalRoot2 } from "@wrongstack/core/utils";
|
|
7185
|
+
|
|
7186
|
+
// src/fleet/acp-live-steer.ts
|
|
7187
|
+
import { sessionNoteHub } from "@wrongstack/core/coordination";
|
|
7188
|
+
import { toErrorMessage as toErrorMessage7 } from "@wrongstack/core/utils";
|
|
7189
|
+
function steerMessage(note) {
|
|
7190
|
+
const head = `[WrongStack ${note.kind} from ${note.from}${note.subject ? ` \u2014 ${note.subject}` : ""}]`;
|
|
7191
|
+
return `${head}
|
|
7192
|
+
${note.body}`;
|
|
7193
|
+
}
|
|
7194
|
+
function registerAcpSteerInbox(ctx, _task, steer, hub = sessionNoteHub, onUndelivered = () => {
|
|
7195
|
+
}) {
|
|
7196
|
+
const sessionId = ctx.sessionId;
|
|
7197
|
+
if (!sessionId) return void 0;
|
|
7198
|
+
const name = ctx.config.name;
|
|
7199
|
+
return hub.register({
|
|
7200
|
+
sessionId,
|
|
7201
|
+
agentId: ctx.subagentId,
|
|
7202
|
+
...name && name !== ctx.subagentId ? { aliases: [name] } : {},
|
|
7203
|
+
// A steer interrupts the worker's generation; peer chatter must not.
|
|
7204
|
+
ignorePeerBroadcasts: true,
|
|
7205
|
+
deliver: (note) => {
|
|
7206
|
+
steer(steerMessage(note)).then(
|
|
7207
|
+
(outcome) => {
|
|
7208
|
+
if (outcome !== "injected") onUndelivered(outcome);
|
|
7209
|
+
},
|
|
7210
|
+
(err) => onUndelivered(toErrorMessage7(err))
|
|
7211
|
+
);
|
|
7212
|
+
}
|
|
7213
|
+
});
|
|
7214
|
+
}
|
|
7215
|
+
|
|
7216
|
+
// src/fleet/host-acp.ts
|
|
7056
7217
|
function buildAcpSubagentRunner(subagentId, options) {
|
|
7057
7218
|
const cmd = resolveAcpAgentCommand(subagentId, options?.overrides, options?.live);
|
|
7058
7219
|
if (!cmd) {
|
|
@@ -7062,10 +7223,39 @@ function buildAcpSubagentRunner(subagentId, options) {
|
|
|
7062
7223
|
context: { requested: subagentId }
|
|
7063
7224
|
});
|
|
7064
7225
|
}
|
|
7226
|
+
const bridgeSetup = options?.bridge ? wrongstackBridgeSetup(subagentId, options.bridge.projectRoot, options.bridge.config) : void 0;
|
|
7227
|
+
const mailboxProjectRoot = options?.bridge?.projectRoot;
|
|
7228
|
+
const mailboxEnabled = bridgeSetup !== void 0 && (options?.bridge?.config?.servers ?? DEFAULT_BRIDGE_SERVERS).includes("mailbox");
|
|
7229
|
+
const permissions = options?.permissions;
|
|
7230
|
+
const sessionSetup = bridgeSetup || permissions ? (task, ctx) => ({
|
|
7231
|
+
...bridgeSetup?.(task, ctx),
|
|
7232
|
+
...permissions ? { permissionPolicy: permissions(ctx) } : {}
|
|
7233
|
+
}) : void 0;
|
|
7234
|
+
const projectRoot = options?.projectRoot;
|
|
7065
7235
|
return makeACPSubagentRunner({
|
|
7066
7236
|
...cmd,
|
|
7237
|
+
...projectRoot ? { cwd: projectRoot, projectRoot } : {},
|
|
7067
7238
|
permissionPolicy: defaultPermissionPolicy,
|
|
7068
|
-
|
|
7239
|
+
// Claude asks before edits and commands only in `default`; left in the
|
|
7240
|
+
// user's own mode (often `auto`) it would never consult the policy.
|
|
7241
|
+
...permissions ? { initialModeId: "default" } : {},
|
|
7242
|
+
...permissions && subagentId === "claude-code" ? { requireInitialMode: true } : {},
|
|
7243
|
+
...options?.publishLive ? { publishLive: options.publishLive } : {},
|
|
7244
|
+
...sessionSetup ? { sessionSetup } : {},
|
|
7245
|
+
// The leader's `session_note` to a running worker joins its turn.
|
|
7246
|
+
onTurnLive: (ctx, task, steer) => {
|
|
7247
|
+
const stopNotes = registerAcpSteerInbox(ctx, task, steer);
|
|
7248
|
+
const stopMail = mailboxEnabled && mailboxProjectRoot ? startAcpTurnReminders({
|
|
7249
|
+
steer,
|
|
7250
|
+
unreadCount: () => getSharedProjectMailbox4(
|
|
7251
|
+
resolveProjectDir2(mailboxProjectRoot, wstackGlobalRoot2())
|
|
7252
|
+
).unreadCount(ctx.subagentId, ctx.sessionId)
|
|
7253
|
+
}) : void 0;
|
|
7254
|
+
return () => {
|
|
7255
|
+
stopNotes?.();
|
|
7256
|
+
stopMail?.();
|
|
7257
|
+
};
|
|
7258
|
+
}
|
|
7069
7259
|
});
|
|
7070
7260
|
}
|
|
7071
7261
|
|
|
@@ -7077,7 +7267,7 @@ import {
|
|
|
7077
7267
|
} from "@wrongstack/core/coordination";
|
|
7078
7268
|
import {
|
|
7079
7269
|
clampSubagentCapabilities,
|
|
7080
|
-
ToolCapabilities,
|
|
7270
|
+
ToolCapabilities as ToolCapabilities2,
|
|
7081
7271
|
WIDE_SUBAGENT_CAPABILITIES
|
|
7082
7272
|
} from "@wrongstack/core/security";
|
|
7083
7273
|
import { makePreferSideConflictResolver } from "@wrongstack/sdd";
|
|
@@ -7191,12 +7381,12 @@ function resolveSubagentCapabilities(subCfg, toolsForAllow) {
|
|
|
7191
7381
|
if (subCfg.allowedCapabilities) {
|
|
7192
7382
|
return clampSubagentCapabilities([
|
|
7193
7383
|
...subCfg.allowedCapabilities,
|
|
7194
|
-
|
|
7384
|
+
ToolCapabilities2.COORDINATION_RESULT_SUBMIT
|
|
7195
7385
|
]).granted;
|
|
7196
7386
|
}
|
|
7197
7387
|
const allow = subCfg.tools;
|
|
7198
7388
|
if (allow && allow.length === 0) {
|
|
7199
|
-
return clampSubagentCapabilities([
|
|
7389
|
+
return clampSubagentCapabilities([ToolCapabilities2.COORDINATION_RESULT_SUBMIT]).granted;
|
|
7200
7390
|
}
|
|
7201
7391
|
if (!allow) return WIDE_SUBAGENT_CAPABILITIES;
|
|
7202
7392
|
const caps = new Set(WIDE_SUBAGENT_CAPABILITIES);
|
|
@@ -7433,12 +7623,12 @@ import {
|
|
|
7433
7623
|
makeFleetEmitTool,
|
|
7434
7624
|
postSessionNote as postSessionNote2
|
|
7435
7625
|
} from "@wrongstack/core/coordination";
|
|
7436
|
-
import { TOKENS as
|
|
7626
|
+
import { TOKENS as TOKENS10 } from "@wrongstack/core/kernel";
|
|
7437
7627
|
import { formatMemoryEvidenceBlock } from "@wrongstack/core/utils";
|
|
7438
7628
|
import { getSageSurface } from "@wrongstack/sage";
|
|
7439
7629
|
|
|
7440
7630
|
// src/fleet/host-director-builder.ts
|
|
7441
|
-
import { randomUUID as
|
|
7631
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
7442
7632
|
import * as path13 from "node:path";
|
|
7443
7633
|
import {
|
|
7444
7634
|
DEFAULT_MAX_FLEET_SPAWNS,
|
|
@@ -7464,7 +7654,7 @@ function createHostFleetManager(opts) {
|
|
|
7464
7654
|
function prepareHostDirectorRuntime(input) {
|
|
7465
7655
|
const { config, deps, opts } = input;
|
|
7466
7656
|
const coordinatorConfig = {
|
|
7467
|
-
coordinatorId:
|
|
7657
|
+
coordinatorId: randomUUID3(),
|
|
7468
7658
|
doneCondition: { type: "all_tasks_done" },
|
|
7469
7659
|
maxConcurrent: opts.maxConcurrent ?? 4
|
|
7470
7660
|
};
|
|
@@ -7662,7 +7852,7 @@ function registerCoordinatorLifecycleHandlers(input) {
|
|
|
7662
7852
|
|
|
7663
7853
|
// src/fleet/host-director-services.ts
|
|
7664
7854
|
import {
|
|
7665
|
-
getSharedProjectMailbox as
|
|
7855
|
+
getSharedProjectMailbox as getSharedProjectMailbox5,
|
|
7666
7856
|
mailboxSessionTag as mailboxSessionTag2
|
|
7667
7857
|
} from "@wrongstack/core/coordination";
|
|
7668
7858
|
|
|
@@ -7850,7 +8040,7 @@ function createHostStatusBroadcaster(input) {
|
|
|
7850
8040
|
const { events, sessionId, mailboxProjectDir, subagentName, config } = input;
|
|
7851
8041
|
return createFleetStatusBroadcaster({
|
|
7852
8042
|
events,
|
|
7853
|
-
mailboxFactory: () =>
|
|
8043
|
+
mailboxFactory: () => getSharedProjectMailbox5(mailboxProjectDir(), events),
|
|
7854
8044
|
sessionTag: () => mailboxSessionTag2(sessionId),
|
|
7855
8045
|
subagentName,
|
|
7856
8046
|
config
|
|
@@ -7858,13 +8048,13 @@ function createHostStatusBroadcaster(input) {
|
|
|
7858
8048
|
}
|
|
7859
8049
|
|
|
7860
8050
|
// src/fleet/host-explore-companion.ts
|
|
7861
|
-
import { randomUUID as
|
|
8051
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
7862
8052
|
import {
|
|
7863
8053
|
buildProbeTaskText,
|
|
7864
8054
|
DEFAULT_EXPLORE_COMPANION_AGENT_ID,
|
|
7865
8055
|
ExploreCompanion,
|
|
7866
8056
|
formatSubagentStructuredReport,
|
|
7867
|
-
getSharedProjectMailbox as
|
|
8057
|
+
getSharedProjectMailbox as getSharedProjectMailbox6,
|
|
7868
8058
|
mailboxSessionTag as mailboxSessionTag3,
|
|
7869
8059
|
postSessionNote
|
|
7870
8060
|
} from "@wrongstack/core/coordination";
|
|
@@ -7875,7 +8065,7 @@ function createHostExploreCompanion(input) {
|
|
|
7875
8065
|
const { director, events, sessionId, mailboxProjectDir, roster, config } = input;
|
|
7876
8066
|
if (config?.enabled === false) return null;
|
|
7877
8067
|
const sessionTag = mailboxSessionTag3(sessionId);
|
|
7878
|
-
const mailbox = () =>
|
|
8068
|
+
const mailbox = () => getSharedProjectMailbox6(mailboxProjectDir, events);
|
|
7879
8069
|
const template = roster[DEFAULT_EXPLORE_COMPANION_AGENT_ID];
|
|
7880
8070
|
let residentId;
|
|
7881
8071
|
let active2;
|
|
@@ -7917,7 +8107,7 @@ function createHostExploreCompanion(input) {
|
|
|
7917
8107
|
...template,
|
|
7918
8108
|
// Unique incarnation: late removal of an old resident cannot remove
|
|
7919
8109
|
// its replacement, including after a registry eviction/recreation.
|
|
7920
|
-
id: `explore-companion-${sessionTag}-${
|
|
8110
|
+
id: `explore-companion-${sessionTag}-${randomUUID4().slice(0, 8)}`,
|
|
7921
8111
|
name: "Explore Companion",
|
|
7922
8112
|
// The resident belongs to the conversation it explores for. Without the
|
|
7923
8113
|
// stamp the coordinator files it under the host's own session, and every
|
|
@@ -7940,7 +8130,7 @@ function createHostExploreCompanion(input) {
|
|
|
7940
8130
|
leaderSessionId: sessionId,
|
|
7941
8131
|
leaderAgentId: "leader",
|
|
7942
8132
|
onProbe: async (probe2) => {
|
|
7943
|
-
const taskId =
|
|
8133
|
+
const taskId = randomUUID4();
|
|
7944
8134
|
let resolve11;
|
|
7945
8135
|
const done = new Promise((finish) => {
|
|
7946
8136
|
resolve11 = finish;
|
|
@@ -8104,7 +8294,7 @@ function createExploreCompanionRegistry(input) {
|
|
|
8104
8294
|
}
|
|
8105
8295
|
|
|
8106
8296
|
// src/fleet/host-memory-companion.ts
|
|
8107
|
-
import { randomUUID as
|
|
8297
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
8108
8298
|
import { memoryReviewReason } from "@wrongstack/sage";
|
|
8109
8299
|
|
|
8110
8300
|
// src/fleet/memory-companion-evidence.ts
|
|
@@ -8330,7 +8520,7 @@ var HostMemoryCompanion = class {
|
|
|
8330
8520
|
const resident = await this.spawnBounded(
|
|
8331
8521
|
constrainMemoryCompanion({
|
|
8332
8522
|
...template,
|
|
8333
|
-
id: `memory-companion-${
|
|
8523
|
+
id: `memory-companion-${randomUUID5()}`,
|
|
8334
8524
|
name: "Memory Companion",
|
|
8335
8525
|
role: "memory-curator",
|
|
8336
8526
|
originSessionId: sessionId,
|
|
@@ -8347,7 +8537,7 @@ var HostMemoryCompanion = class {
|
|
|
8347
8537
|
}
|
|
8348
8538
|
session.probes++;
|
|
8349
8539
|
const agentId = session.resident;
|
|
8350
|
-
const taskId =
|
|
8540
|
+
const taskId = randomUUID5();
|
|
8351
8541
|
this.send(
|
|
8352
8542
|
sessionId,
|
|
8353
8543
|
"[memory:checking]",
|
|
@@ -8513,7 +8703,7 @@ ${JSON.stringify({
|
|
|
8513
8703
|
};
|
|
8514
8704
|
|
|
8515
8705
|
// src/fleet/host-skill-companion.ts
|
|
8516
|
-
import { createHash as createHash2, randomUUID as
|
|
8706
|
+
import { createHash as createHash2, randomUUID as randomUUID6 } from "node:crypto";
|
|
8517
8707
|
import {
|
|
8518
8708
|
extractSkillMentions,
|
|
8519
8709
|
isSkillRecommendable,
|
|
@@ -8526,7 +8716,7 @@ import {
|
|
|
8526
8716
|
|
|
8527
8717
|
// src/fleet/skill-companion-policy.ts
|
|
8528
8718
|
import { makeSubagentResultTool as makeSubagentResultTool3 } from "@wrongstack/core/coordination";
|
|
8529
|
-
import { ToolCapabilities as
|
|
8719
|
+
import { ToolCapabilities as ToolCapabilities3 } from "@wrongstack/core/security";
|
|
8530
8720
|
import { skillPromptExclusionReasons } from "@wrongstack/core/skills";
|
|
8531
8721
|
var SKILL_COMPANION_ROLE = "skill-companion";
|
|
8532
8722
|
var SKILL_COMPANION_ID_PREFIX = "skill-companion-";
|
|
@@ -8558,7 +8748,7 @@ function constrainSkillCompanion(config) {
|
|
|
8558
8748
|
tools: [],
|
|
8559
8749
|
disabledTools: void 0,
|
|
8560
8750
|
capabilities: [],
|
|
8561
|
-
allowedCapabilities: [
|
|
8751
|
+
allowedCapabilities: [ToolCapabilities3.COORDINATION_RESULT_SUBMIT],
|
|
8562
8752
|
skillNames: [],
|
|
8563
8753
|
skillPool: [],
|
|
8564
8754
|
skillContent: void 0,
|
|
@@ -8846,7 +9036,7 @@ var HostSkillCompanion = class {
|
|
|
8846
9036
|
const agentId = await this.resident(sessionId, session);
|
|
8847
9037
|
if (!agentId || !this.current(sessionId, session)) return;
|
|
8848
9038
|
session.probes++;
|
|
8849
|
-
const taskId =
|
|
9039
|
+
const taskId = randomUUID6();
|
|
8850
9040
|
let timeout;
|
|
8851
9041
|
const completed = new Promise((resolve11) => {
|
|
8852
9042
|
this.active = { taskId, agentId, settle: resolve11 };
|
|
@@ -8918,7 +9108,7 @@ ${JSON.stringify({
|
|
|
8918
9108
|
session.resident = void 0;
|
|
8919
9109
|
if (session.resident) return session.resident;
|
|
8920
9110
|
const config = constrainSkillCompanion({
|
|
8921
|
-
id: `${SKILL_COMPANION_ID_PREFIX}${
|
|
9111
|
+
id: `${SKILL_COMPANION_ID_PREFIX}${randomUUID6()}`,
|
|
8922
9112
|
name: "Skill Companion",
|
|
8923
9113
|
role: SKILL_COMPANION_ROLE,
|
|
8924
9114
|
originSessionId: sessionId,
|
|
@@ -9076,7 +9266,7 @@ async function buildDirector(host) {
|
|
|
9076
9266
|
projectRoot: host.deps.projectRoot,
|
|
9077
9267
|
roster: host.roster,
|
|
9078
9268
|
memory: () => {
|
|
9079
|
-
const port = host.deps.container.safeResolve(
|
|
9269
|
+
const port = host.deps.container.safeResolve(TOKENS10.MemoryStore);
|
|
9080
9270
|
return port ? getSageSurface(port) : void 0;
|
|
9081
9271
|
},
|
|
9082
9272
|
enabled: (sessionId) => {
|
|
@@ -9164,7 +9354,7 @@ async function buildDirector(host) {
|
|
|
9164
9354
|
(n) => coordinator.setMaxConcurrent(n),
|
|
9165
9355
|
{ maxConcurrent: host.getMaxConcurrent(), ...adaptiveConfig },
|
|
9166
9356
|
void 0,
|
|
9167
|
-
host.deps.container.safeResolve(
|
|
9357
|
+
host.deps.container.safeResolve(TOKENS10.Logger)
|
|
9168
9358
|
);
|
|
9169
9359
|
}
|
|
9170
9360
|
const runner = await host.buildSubagentRunner(config);
|
|
@@ -9412,11 +9602,11 @@ import {
|
|
|
9412
9602
|
recordDirectiveOutcomes,
|
|
9413
9603
|
recordSkillOutcome
|
|
9414
9604
|
} from "@wrongstack/core/agent-catalog";
|
|
9415
|
-
import { TOKENS as
|
|
9605
|
+
import { TOKENS as TOKENS11 } from "@wrongstack/core/kernel";
|
|
9416
9606
|
function captureCompletedTaskLearningForHost(result, deps, subjects, onCaptured) {
|
|
9417
9607
|
const subject = subjects.get(result.subagentId);
|
|
9418
9608
|
if (!subject) return;
|
|
9419
|
-
const logger = deps.container.safeResolve(
|
|
9609
|
+
const logger = deps.container.safeResolve(TOKENS11.Logger);
|
|
9420
9610
|
const graded = result.status !== "stopped";
|
|
9421
9611
|
const succeeded = result.status === "success";
|
|
9422
9612
|
if (graded && subject.skills.length > 0) {
|
|
@@ -9886,7 +10076,7 @@ var HostShadowManager = class {
|
|
|
9886
10076
|
};
|
|
9887
10077
|
|
|
9888
10078
|
// src/fleet/host-subagent-factory.ts
|
|
9889
|
-
import { randomUUID as
|
|
10079
|
+
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
9890
10080
|
import { existsSync, statSync } from "node:fs";
|
|
9891
10081
|
import * as path15 from "node:path";
|
|
9892
10082
|
import {
|
|
@@ -9905,7 +10095,7 @@ import {
|
|
|
9905
10095
|
import {
|
|
9906
10096
|
DEFAULT_SUBAGENT_BASELINE,
|
|
9907
10097
|
FLEET_ROSTER,
|
|
9908
|
-
getSharedProjectMailbox as
|
|
10098
|
+
getSharedProjectMailbox as getSharedProjectMailbox7,
|
|
9909
10099
|
resolveSubagentModelTarget as resolveSubagentModelTarget2
|
|
9910
10100
|
} from "@wrongstack/core/coordination";
|
|
9911
10101
|
import { installDesignStudioMiddleware as installDesignStudioMiddleware2 } from "@wrongstack/core/design";
|
|
@@ -9916,9 +10106,9 @@ import {
|
|
|
9916
10106
|
ToolExecutor as ToolExecutor2
|
|
9917
10107
|
} from "@wrongstack/core/execution";
|
|
9918
10108
|
import { DefaultTokenCounter } from "@wrongstack/core/infrastructure";
|
|
9919
|
-
import { EventBus, TOKENS as
|
|
10109
|
+
import { EventBus, TOKENS as TOKENS13 } from "@wrongstack/core/kernel";
|
|
9920
10110
|
import { ToolRegistry as ToolRegistry2 } from "@wrongstack/core/registry";
|
|
9921
|
-
import { AutoApprovePermissionPolicy, subagentYoloPlus } from "@wrongstack/core/security";
|
|
10111
|
+
import { AutoApprovePermissionPolicy as AutoApprovePermissionPolicy2, subagentYoloPlus as subagentYoloPlus2 } from "@wrongstack/core/security";
|
|
9922
10112
|
import { createSessionEventBridge as createSessionEventBridge3, resolveSessionLoggingConfig as resolveSessionLoggingConfig2 } from "@wrongstack/core/storage";
|
|
9923
10113
|
|
|
9924
10114
|
// src/fleet/host-context.ts
|
|
@@ -9935,7 +10125,7 @@ import {
|
|
|
9935
10125
|
resolveRoleSkillCandidates,
|
|
9936
10126
|
runtimeToolReferencesFromText
|
|
9937
10127
|
} from "@wrongstack/core/agent-catalog";
|
|
9938
|
-
import { TOKENS as
|
|
10128
|
+
import { TOKENS as TOKENS12 } from "@wrongstack/core/kernel";
|
|
9939
10129
|
import { activeLimits, positiveLimit } from "@wrongstack/core/types";
|
|
9940
10130
|
import { formatMemoryEvidenceBlock as formatMemoryEvidenceBlock2, formatProjectSuppliedBlock } from "@wrongstack/core/utils";
|
|
9941
10131
|
import { formatMemoryHintsDetailed, getSageRetrieval } from "@wrongstack/sage";
|
|
@@ -10120,7 +10310,7 @@ function composeAddendumOnly(role, skillName, augmentation) {
|
|
|
10120
10310
|
].join("\n");
|
|
10121
10311
|
}
|
|
10122
10312
|
async function retrieveHostSubagentMemory(deps, getLeaderMode, subCfg, taskContext, owningSessionId) {
|
|
10123
|
-
const memoryPort = deps.container.safeResolve(
|
|
10313
|
+
const memoryPort = deps.container.safeResolve(TOKENS12.MemoryStore);
|
|
10124
10314
|
const memory = memoryPort ? getSageRetrieval(memoryPort) : void 0;
|
|
10125
10315
|
if (!memory?.retrieveForAudience) return void 0;
|
|
10126
10316
|
const contextualTaskType = typeof taskContext?.["taskType"] === "string" ? taskContext["taskType"] : void 0;
|
|
@@ -10355,7 +10545,7 @@ ${message} Falling back to the assigned checkout.` : `${message} Falling back to
|
|
|
10355
10545
|
}
|
|
10356
10546
|
let onlineAgents = [];
|
|
10357
10547
|
try {
|
|
10358
|
-
const subagentMailbox =
|
|
10548
|
+
const subagentMailbox = getSharedProjectMailbox7(host.mailboxProjectDir());
|
|
10359
10549
|
onlineAgents = await subagentMailbox.getAgentStatuses();
|
|
10360
10550
|
} catch {
|
|
10361
10551
|
}
|
|
@@ -10418,7 +10608,7 @@ ${message} Falling back to the assigned checkout.` : `${message} Falling back to
|
|
|
10418
10608
|
if (rolePrompt) {
|
|
10419
10609
|
baseSystem.push({ type: "text", text: rolePrompt });
|
|
10420
10610
|
}
|
|
10421
|
-
const subagentName = effectiveCfg.id ?? effectiveCfg.name ?? `sub_${
|
|
10611
|
+
const subagentName = effectiveCfg.id ?? effectiveCfg.name ?? `sub_${randomUUID7().slice(0, 8)}`;
|
|
10422
10612
|
if (effectiveCfg.role) {
|
|
10423
10613
|
host.recordLearningRole(subagentName, effectiveCfg.role, skillResolution.selected);
|
|
10424
10614
|
}
|
|
@@ -10493,16 +10683,16 @@ ${message} Falling back to the assigned checkout.` : `${message} Falling back to
|
|
|
10493
10683
|
effectiveCfg,
|
|
10494
10684
|
(allow) => host.filterTools([...allow])
|
|
10495
10685
|
);
|
|
10496
|
-
const leaderPolicy = host.deps.container.safeResolve(
|
|
10686
|
+
const leaderPolicy = host.deps.container.safeResolve(TOKENS13.PermissionPolicy);
|
|
10497
10687
|
const subagentPolicyOptions = {
|
|
10498
|
-
yoloPlus: () =>
|
|
10688
|
+
yoloPlus: () => subagentYoloPlus2({
|
|
10499
10689
|
sessionId: owningSessionId,
|
|
10500
10690
|
leaderPolicy,
|
|
10501
10691
|
fallback: () => host.deps.configStore.get().autonomy?.yoloPlus === true
|
|
10502
10692
|
})
|
|
10503
10693
|
};
|
|
10504
10694
|
const toolExecutor = new ToolExecutor2(baseRegistry, {
|
|
10505
|
-
permissionPolicy: new
|
|
10695
|
+
permissionPolicy: new AutoApprovePermissionPolicy2(subAllowedCaps, subagentPolicyOptions),
|
|
10506
10696
|
secretScrubber: host.deps.secretScrubber,
|
|
10507
10697
|
renderer: host.deps.renderer,
|
|
10508
10698
|
events,
|
|
@@ -10540,7 +10730,7 @@ ${message} Falling back to the assigned checkout.` : `${message} Falling back to
|
|
|
10540
10730
|
events,
|
|
10541
10731
|
pipelines,
|
|
10542
10732
|
context: ctx,
|
|
10543
|
-
permissionPolicy: new
|
|
10733
|
+
permissionPolicy: new AutoApprovePermissionPolicy2(subAllowedCaps, subagentPolicyOptions),
|
|
10544
10734
|
toolExecutor,
|
|
10545
10735
|
tracer: host.deps.tracer,
|
|
10546
10736
|
loopDetection: config.tools?.loopDetection,
|
|
@@ -10621,14 +10811,14 @@ ${message} Falling back to the assigned checkout.` : `${message} Falling back to
|
|
|
10621
10811
|
}
|
|
10622
10812
|
|
|
10623
10813
|
// src/fleet/host-supervisor.ts
|
|
10624
|
-
import { randomUUID as
|
|
10814
|
+
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
10625
10815
|
import {
|
|
10626
10816
|
dispatchAgent,
|
|
10627
10817
|
FleetSupervisor,
|
|
10628
10818
|
mailboxSessionTag as mailboxSessionTag4,
|
|
10629
10819
|
postSessionNote as postSessionNote3
|
|
10630
10820
|
} from "@wrongstack/core/coordination";
|
|
10631
|
-
import { toErrorMessage as
|
|
10821
|
+
import { toErrorMessage as toErrorMessage8 } from "@wrongstack/core/utils/error";
|
|
10632
10822
|
|
|
10633
10823
|
// src/fleet/supervisor-registry.ts
|
|
10634
10824
|
var active = null;
|
|
@@ -10674,7 +10864,7 @@ function createHostFleetSupervisor(input) {
|
|
|
10674
10864
|
].filter((part) => typeof part === "string" && part.trim().length > 0).join("\n\n");
|
|
10675
10865
|
const subagentId = await director.spawn({
|
|
10676
10866
|
...template ?? { name: "fleet helper", role: "executor" },
|
|
10677
|
-
id: `helper-${
|
|
10867
|
+
id: `helper-${randomUUID8().slice(0, 8)}`,
|
|
10678
10868
|
name: `fleet helper (${routed.role})`,
|
|
10679
10869
|
role: routed.role,
|
|
10680
10870
|
systemPromptOverride: helperPrompt,
|
|
@@ -10684,7 +10874,7 @@ function createHostFleetSupervisor(input) {
|
|
|
10684
10874
|
});
|
|
10685
10875
|
return { subagentId };
|
|
10686
10876
|
} catch (err) {
|
|
10687
|
-
return { error:
|
|
10877
|
+
return { error: toErrorMessage8(err) };
|
|
10688
10878
|
}
|
|
10689
10879
|
},
|
|
10690
10880
|
steerAgent: async (subagentId, subject, body) => {
|
|
@@ -10722,7 +10912,7 @@ function createHostFleetSupervisor(input) {
|
|
|
10722
10912
|
// src/fleet/host-task-result-report.ts
|
|
10723
10913
|
import {
|
|
10724
10914
|
formatSubagentStructuredReport as formatSubagentStructuredReport2,
|
|
10725
|
-
getSharedProjectMailbox as
|
|
10915
|
+
getSharedProjectMailbox as getSharedProjectMailbox8,
|
|
10726
10916
|
mailboxSessionTag as mailboxSessionTag5
|
|
10727
10917
|
} from "@wrongstack/core/coordination";
|
|
10728
10918
|
async function reportTaskResultToLeader({
|
|
@@ -10734,7 +10924,7 @@ async function reportTaskResultToLeader({
|
|
|
10734
10924
|
}) {
|
|
10735
10925
|
try {
|
|
10736
10926
|
const leaderId2 = getLeaderMailboxId?.() ?? `leader@${mailboxSessionTag5(sessionId)}`;
|
|
10737
|
-
const mailbox =
|
|
10927
|
+
const mailbox = getSharedProjectMailbox8(mailboxProjectDir, events);
|
|
10738
10928
|
const ok = n.status === "success";
|
|
10739
10929
|
const MAX_BODY = 700;
|
|
10740
10930
|
const failureText = [
|
|
@@ -10762,8 +10952,43 @@ ${n.partialText}` : ""
|
|
|
10762
10952
|
|
|
10763
10953
|
// src/fleet/routing.ts
|
|
10764
10954
|
import { makeAgentSubagentRunner, NULL_FLEET_BUS } from "@wrongstack/core/coordination";
|
|
10765
|
-
import { TOKENS as
|
|
10955
|
+
import { TOKENS as TOKENS14 } from "@wrongstack/core/kernel";
|
|
10766
10956
|
import { expectDefined as expectDefined2 } from "@wrongstack/core/utils";
|
|
10957
|
+
|
|
10958
|
+
// src/fleet/acp-quota-hold.ts
|
|
10959
|
+
var DEFAULT_HOLD_MS = 15 * 6e4;
|
|
10960
|
+
var holds = /* @__PURE__ */ new Map();
|
|
10961
|
+
function isQuotaError(err) {
|
|
10962
|
+
return !!err && typeof err === "object" && err.kind === "provider_quota";
|
|
10963
|
+
}
|
|
10964
|
+
async function runWithQuotaHold(agentId, start, now = Date.now) {
|
|
10965
|
+
const hold = holds.get(agentId);
|
|
10966
|
+
if (hold) {
|
|
10967
|
+
const left = hold.until - now();
|
|
10968
|
+
if (left > 0) {
|
|
10969
|
+
const at = new Date(hold.until).toLocaleTimeString([], {
|
|
10970
|
+
hour: "2-digit",
|
|
10971
|
+
minute: "2-digit"
|
|
10972
|
+
});
|
|
10973
|
+
throw {
|
|
10974
|
+
...hold.error,
|
|
10975
|
+
message: `${hold.error.message} \u2014 not started: ${agentId} is held until ${at}`,
|
|
10976
|
+
backoffMs: left
|
|
10977
|
+
};
|
|
10978
|
+
}
|
|
10979
|
+
holds.delete(agentId);
|
|
10980
|
+
}
|
|
10981
|
+
try {
|
|
10982
|
+
return await start();
|
|
10983
|
+
} catch (err) {
|
|
10984
|
+
if (isQuotaError(err)) {
|
|
10985
|
+
holds.set(agentId, { until: now() + (err.backoffMs ?? DEFAULT_HOLD_MS), error: err });
|
|
10986
|
+
}
|
|
10987
|
+
throw err;
|
|
10988
|
+
}
|
|
10989
|
+
}
|
|
10990
|
+
|
|
10991
|
+
// src/fleet/routing.ts
|
|
10767
10992
|
function buildRoutingRunner(config, host) {
|
|
10768
10993
|
const standardRunner = makeAgentSubagentRunner({
|
|
10769
10994
|
factory: host.makeSubagentFactory(config),
|
|
@@ -10773,8 +10998,10 @@ function buildRoutingRunner(config, host) {
|
|
|
10773
10998
|
const subCfg = ctx.config;
|
|
10774
10999
|
if (subCfg.provider === "acp") {
|
|
10775
11000
|
const cacheKey = subCfg.role ?? subCfg.name ?? expectDefined2(subCfg.id);
|
|
10776
|
-
|
|
10777
|
-
|
|
11001
|
+
return runWithQuotaHold(cacheKey, async () => {
|
|
11002
|
+
const runner = await host.buildACPRunner(cacheKey);
|
|
11003
|
+
return runner(task, ctx);
|
|
11004
|
+
});
|
|
10778
11005
|
}
|
|
10779
11006
|
return standardRunner(task, ctx);
|
|
10780
11007
|
};
|
|
@@ -10956,7 +11183,7 @@ var MultiAgentHost = class {
|
|
|
10956
11183
|
return selectSubagentTools(this.deps.toolRegistry.list(), this.directorToolsByName, allow);
|
|
10957
11184
|
}
|
|
10958
11185
|
mailboxProjectDir() {
|
|
10959
|
-
return this.opts.mailboxProjectDir ??
|
|
11186
|
+
return this.opts.mailboxProjectDir ?? resolveProjectDir3(this.deps.projectRoot, wstackGlobalRoot3());
|
|
10960
11187
|
}
|
|
10961
11188
|
buildFleetSupervisor(config) {
|
|
10962
11189
|
this.fleetSupervisor = createHostFleetSupervisor({
|
|
@@ -11067,7 +11294,7 @@ var MultiAgentHost = class {
|
|
|
11067
11294
|
context: { sessionId: originSessionId, phase: "subagentPolicy" }
|
|
11068
11295
|
});
|
|
11069
11296
|
}
|
|
11070
|
-
const taskId =
|
|
11297
|
+
const taskId = randomUUID9();
|
|
11071
11298
|
if (!this.director)
|
|
11072
11299
|
throw new AgentError({
|
|
11073
11300
|
message: "Director is not initialized",
|
|
@@ -11396,7 +11623,7 @@ function setupBrainAndOrchestration(deps) {
|
|
|
11396
11623
|
getSystemOneJudge: () => resolveTypeSafeJudge({
|
|
11397
11624
|
config: configStore.get?.() ?? config,
|
|
11398
11625
|
feature: "brain",
|
|
11399
|
-
logger: container.safeResolve(
|
|
11626
|
+
logger: container.safeResolve(TOKENS15.Logger)
|
|
11400
11627
|
}),
|
|
11401
11628
|
ledger: {
|
|
11402
11629
|
getPath: () => ledgerEnabled ? ledgerPath : void 0,
|
|
@@ -11468,7 +11695,7 @@ function setupBrainAndOrchestration(deps) {
|
|
|
11468
11695
|
),
|
|
11469
11696
|
events
|
|
11470
11697
|
);
|
|
11471
|
-
container.bind(
|
|
11698
|
+
container.bind(TOKENS15.BrainArbiter, () => brain);
|
|
11472
11699
|
const {
|
|
11473
11700
|
brainLog,
|
|
11474
11701
|
getTierStats: brainTierStats,
|
|
@@ -11538,7 +11765,7 @@ function setupBrainAndOrchestration(deps) {
|
|
|
11538
11765
|
providerRegistry,
|
|
11539
11766
|
configStore,
|
|
11540
11767
|
modelsRegistry,
|
|
11541
|
-
fallbackProfileManager: container.resolve(
|
|
11768
|
+
fallbackProfileManager: container.resolve(TOKENS15.FallbackProfileManager),
|
|
11542
11769
|
events,
|
|
11543
11770
|
systemPromptBuilder: promptBuilder,
|
|
11544
11771
|
session,
|
|
@@ -11547,7 +11774,7 @@ function setupBrainAndOrchestration(deps) {
|
|
|
11547
11774
|
cwd,
|
|
11548
11775
|
skillLoader,
|
|
11549
11776
|
tracer: deps.tracer,
|
|
11550
|
-
secretScrubber: container.resolve(
|
|
11777
|
+
secretScrubber: container.resolve(TOKENS15.SecretScrubber),
|
|
11551
11778
|
// WrongTrace lock gate for every spawned worker — same fail-open
|
|
11552
11779
|
// coordination the leader's executor enforces (lifecycle-plugins).
|
|
11553
11780
|
// Registered unconditionally to mirror the leader registration.
|
|
@@ -11596,7 +11823,7 @@ function setupBrainAndOrchestration(deps) {
|
|
|
11596
11823
|
}
|
|
11597
11824
|
);
|
|
11598
11825
|
const delegationTracker = new DelegationTracker({ events });
|
|
11599
|
-
container.bind(
|
|
11826
|
+
container.bind(TOKENS15.DelegationTracker, () => delegationTracker);
|
|
11600
11827
|
teardownHandlers.push(() => delegationTracker.dispose());
|
|
11601
11828
|
try {
|
|
11602
11829
|
const restoredEvents = sessResult.restoredEvents;
|
|
@@ -11630,9 +11857,10 @@ function setupBrainAndOrchestration(deps) {
|
|
|
11630
11857
|
getJudge: () => resolveTypeSafeJudge({
|
|
11631
11858
|
config: configStore.get?.() ?? config,
|
|
11632
11859
|
feature: "modelTier",
|
|
11633
|
-
logger: container.safeResolve(
|
|
11860
|
+
logger: container.safeResolve(TOKENS15.Logger)
|
|
11634
11861
|
})
|
|
11635
|
-
})
|
|
11862
|
+
}),
|
|
11863
|
+
externalAgents: installedBridgeAgents(config.acp)
|
|
11636
11864
|
})
|
|
11637
11865
|
);
|
|
11638
11866
|
toolRegistry.exposeToProvider("delegate");
|
|
@@ -11658,7 +11886,7 @@ function setupBrainAndOrchestration(deps) {
|
|
|
11658
11886
|
}
|
|
11659
11887
|
toolRegistry.register(
|
|
11660
11888
|
createSessionRenameTool({
|
|
11661
|
-
rename: (sessionId, name) => container.resolve(
|
|
11889
|
+
rename: (sessionId, name) => container.resolve(TOKENS15.SessionStore).rename(sessionId, name),
|
|
11662
11890
|
events
|
|
11663
11891
|
})
|
|
11664
11892
|
);
|
|
@@ -11679,7 +11907,7 @@ function setupBrainAndOrchestration(deps) {
|
|
|
11679
11907
|
}
|
|
11680
11908
|
|
|
11681
11909
|
// src/wiring/cli-slash-commands-setup.ts
|
|
11682
|
-
import { TOKENS as
|
|
11910
|
+
import { TOKENS as TOKENS16 } from "@wrongstack/core/kernel";
|
|
11683
11911
|
|
|
11684
11912
|
// src/wiring/command-host-adapters.ts
|
|
11685
11913
|
import { color as color5, isStdinTTY } from "@wrongstack/core/utils";
|
|
@@ -13070,7 +13298,7 @@ import {
|
|
|
13070
13298
|
STATUSLINE_ITEMS
|
|
13071
13299
|
} from "@wrongstack/core/statusline";
|
|
13072
13300
|
import { ERROR_CODES, FsError } from "@wrongstack/core/types";
|
|
13073
|
-
import { atomicWrite as atomicWrite2, resolveWstackPaths, toErrorMessage as
|
|
13301
|
+
import { atomicWrite as atomicWrite2, resolveWstackPaths, toErrorMessage as toErrorMessage9 } from "@wrongstack/core/utils";
|
|
13074
13302
|
var CONFIG_ENV = "WRONGSTACK_STATUSLINE_CONFIG";
|
|
13075
13303
|
var STATUSLINE_CONFIG_VERSION = 4;
|
|
13076
13304
|
var STATUSLINE_CONFIG_KEYS = STATUSLINE_ITEMS;
|
|
@@ -13227,7 +13455,7 @@ async function saveStatuslineConfig(config) {
|
|
|
13227
13455
|
);
|
|
13228
13456
|
} catch (error) {
|
|
13229
13457
|
throw new FsError({
|
|
13230
|
-
message:
|
|
13458
|
+
message: toErrorMessage9(error),
|
|
13231
13459
|
code: error instanceof Error && error.message.includes("mkdir") ? ERROR_CODES.FS_MKDIR_FAILED : ERROR_CODES.FS_ATOMIC_WRITE_FAILED,
|
|
13232
13460
|
path: configPath,
|
|
13233
13461
|
cause: error
|
|
@@ -13311,8 +13539,8 @@ function estimateTokens(messages) {
|
|
|
13311
13539
|
|
|
13312
13540
|
// src/slash-commands/acp.ts
|
|
13313
13541
|
import {
|
|
13314
|
-
EnsembleRegistry,
|
|
13315
13542
|
defaultPermissionPolicy as defaultPermissionPolicy2,
|
|
13543
|
+
EnsembleRegistry,
|
|
13316
13544
|
probeAcpAgents,
|
|
13317
13545
|
renderAcpBenchText,
|
|
13318
13546
|
renderEnsembleText,
|
|
@@ -13321,7 +13549,7 @@ import {
|
|
|
13321
13549
|
runEnsemble,
|
|
13322
13550
|
runOneAcpTask
|
|
13323
13551
|
} from "@wrongstack/acp";
|
|
13324
|
-
import { toErrorMessage as
|
|
13552
|
+
import { toErrorMessage as toErrorMessage10 } from "@wrongstack/core/utils";
|
|
13325
13553
|
function buildAcpCommand(opts) {
|
|
13326
13554
|
return {
|
|
13327
13555
|
name: "acp",
|
|
@@ -13374,6 +13602,13 @@ function buildAcpCommand(opts) {
|
|
|
13374
13602
|
}
|
|
13375
13603
|
};
|
|
13376
13604
|
}
|
|
13605
|
+
function readBridgeConfig(opts) {
|
|
13606
|
+
try {
|
|
13607
|
+
return opts.configStore?.get()?.acp?.bridge;
|
|
13608
|
+
} catch {
|
|
13609
|
+
return void 0;
|
|
13610
|
+
}
|
|
13611
|
+
}
|
|
13377
13612
|
function readOverrides(opts) {
|
|
13378
13613
|
try {
|
|
13379
13614
|
return opts.configStore?.get()?.acp?.agents;
|
|
@@ -13394,7 +13629,7 @@ Run \`/acp\` to see them, or \`/acp probe <id>\` to test one.`
|
|
|
13394
13629
|
};
|
|
13395
13630
|
} catch (err) {
|
|
13396
13631
|
return {
|
|
13397
|
-
message: `ACP registry sync failed: ${
|
|
13632
|
+
message: `ACP registry sync failed: ${toErrorMessage10(err)}
|
|
13398
13633
|
The bundled offline catalog is still available via \`/acp\`.`
|
|
13399
13634
|
};
|
|
13400
13635
|
}
|
|
@@ -13517,7 +13752,7 @@ async function parallelAgents(rest, overrides, live, opts) {
|
|
|
13517
13752
|
const summary = await opts.onSpawn(task, { provider: "acp", name: id });
|
|
13518
13753
|
dispatched.push(` \u2022 ${id}: ${summary}`);
|
|
13519
13754
|
} catch (err) {
|
|
13520
|
-
skipped.push({ id, reason:
|
|
13755
|
+
skipped.push({ id, reason: toErrorMessage10(err) });
|
|
13521
13756
|
}
|
|
13522
13757
|
}
|
|
13523
13758
|
const lines = [
|
|
@@ -13542,7 +13777,7 @@ async function parallelAgents(rest, overrides, live, opts) {
|
|
|
13542
13777
|
});
|
|
13543
13778
|
return { message: renderEnsembleText(result) };
|
|
13544
13779
|
} catch (err) {
|
|
13545
|
-
return { message: `Ensemble failed: ${
|
|
13780
|
+
return { message: `Ensemble failed: ${toErrorMessage10(err)}` };
|
|
13546
13781
|
}
|
|
13547
13782
|
}
|
|
13548
13783
|
async function runSingle(agentId, rest, overrides, live, opts) {
|
|
@@ -13575,7 +13810,7 @@ Run \`/acp\` to see available agents.`
|
|
|
13575
13810
|
return { message: `Dispatched '${agentId}' as a background ACP subagent.
|
|
13576
13811
|
${summary}` };
|
|
13577
13812
|
} catch (err) {
|
|
13578
|
-
return { message: `Background spawn failed: ${
|
|
13813
|
+
return { message: `Background spawn failed: ${toErrorMessage10(err)}` };
|
|
13579
13814
|
}
|
|
13580
13815
|
}
|
|
13581
13816
|
opts.renderer.writeInfo(`Running task on '${agentId}'\u2026
|
|
@@ -13591,6 +13826,7 @@ ${summary}` };
|
|
|
13591
13826
|
projectRoot: opts.projectRoot,
|
|
13592
13827
|
sessionId: opts.context?.eventSessionId(),
|
|
13593
13828
|
permissionPolicy: defaultPermissionPolicy2,
|
|
13829
|
+
sessionSetup: wrongstackBridgeSetup(agentId, opts.projectRoot, readBridgeConfig(opts)),
|
|
13594
13830
|
onProgress: (event) => {
|
|
13595
13831
|
const line = formatProgress(event);
|
|
13596
13832
|
if (line) opts.renderer.writeInfo(` ${line}
|
|
@@ -13607,7 +13843,7 @@ ${body}
|
|
|
13607
13843
|
} catch (err) {
|
|
13608
13844
|
const e = err;
|
|
13609
13845
|
const detail = e.kind ? `[${e.kind}] ` : "";
|
|
13610
|
-
const message = e.message ??
|
|
13846
|
+
const message = e.message ?? toErrorMessage10(err);
|
|
13611
13847
|
return { message: `ACP agent '${agentId}' failed: ${detail}${message}` };
|
|
13612
13848
|
}
|
|
13613
13849
|
}
|
|
@@ -14007,7 +14243,6 @@ function buildAuthCommand(opts) {
|
|
|
14007
14243
|
`${color12.bold("OAuth sign-in")}`,
|
|
14008
14244
|
"",
|
|
14009
14245
|
` Run ${color12.cyan("wstack auth login chatgpt")} \u2014 ChatGPT Plus/Pro (\u2192 openai-codex)`,
|
|
14010
|
-
` Run ${color12.cyan("wstack auth login claude")} \u2014 Claude Pro/Max (\u2192 anthropic-oauth)`,
|
|
14011
14246
|
` Run ${color12.cyan("wstack auth login copilot")} \u2014 GitHub Copilot (\u2192 github-copilot)`,
|
|
14012
14247
|
` Run ${color12.cyan("wstack auth login openrouter")} \u2014 OpenRouter API key (\u2192 openrouter)`
|
|
14013
14248
|
].join("\n")
|
|
@@ -14353,7 +14588,7 @@ ${color13.dim("YOLO enabled; tool calls run without approval unless an explicit
|
|
|
14353
14588
|
}
|
|
14354
14589
|
|
|
14355
14590
|
// src/slash-commands/brain.ts
|
|
14356
|
-
import { randomUUID as
|
|
14591
|
+
import { randomUUID as randomUUID10 } from "node:crypto";
|
|
14357
14592
|
import { color as color16 } from "@wrongstack/core/utils";
|
|
14358
14593
|
|
|
14359
14594
|
// src/slash-commands/brain-council.ts
|
|
@@ -14966,7 +15201,7 @@ function buildBrainCommand(opts) {
|
|
|
14966
15201
|
}
|
|
14967
15202
|
try {
|
|
14968
15203
|
const decision = await opts.brain.decide({
|
|
14969
|
-
id: `brain-ask-${
|
|
15204
|
+
id: `brain-ask-${randomUUID10()}`,
|
|
14970
15205
|
sessionId: opts.context?.session.id,
|
|
14971
15206
|
source: "user",
|
|
14972
15207
|
question,
|
|
@@ -15514,7 +15749,7 @@ function buildClearCommand(opts) {
|
|
|
15514
15749
|
// src/slash-commands/codebase-map.ts
|
|
15515
15750
|
import * as fs6 from "node:fs/promises";
|
|
15516
15751
|
import * as path18 from "node:path";
|
|
15517
|
-
import { color as color18, toErrorMessage as
|
|
15752
|
+
import { color as color18, toErrorMessage as toErrorMessage11 } from "@wrongstack/core/utils";
|
|
15518
15753
|
import {
|
|
15519
15754
|
ATLAS_DIR,
|
|
15520
15755
|
checkProjectAtlasFreshness,
|
|
@@ -15671,7 +15906,7 @@ function buildCodebaseMapCommand(opts) {
|
|
|
15671
15906
|
)
|
|
15672
15907
|
};
|
|
15673
15908
|
} catch (err) {
|
|
15674
|
-
return { message: `${color18.red("codebase-map failed:")} ${
|
|
15909
|
+
return { message: `${color18.red("codebase-map failed:")} ${toErrorMessage11(err)}` };
|
|
15675
15910
|
}
|
|
15676
15911
|
}
|
|
15677
15912
|
};
|
|
@@ -15744,7 +15979,7 @@ function renderFreshness(report) {
|
|
|
15744
15979
|
}
|
|
15745
15980
|
|
|
15746
15981
|
// src/slash-commands/codebase-reindex.ts
|
|
15747
|
-
import { color as color19, toErrorMessage as
|
|
15982
|
+
import { color as color19, toErrorMessage as toErrorMessage12 } from "@wrongstack/core/utils";
|
|
15748
15983
|
import { resetIndexCircuitBreaker, runStartupIndex } from "@wrongstack/tools";
|
|
15749
15984
|
function buildCodebaseReindexCommand(opts) {
|
|
15750
15985
|
return {
|
|
@@ -15776,7 +16011,7 @@ ${color19.yellow(" corrupt index detected \u2014 rebuilt from scratch")}` : "")
|
|
|
15776
16011
|
${color19.yellow(` ${r.errors.length} error(s) reported`)}` : "");
|
|
15777
16012
|
return { message: summary };
|
|
15778
16013
|
} catch (err) {
|
|
15779
|
-
const msg = `${color19.red("Codebase reindex failed:")} ${
|
|
16014
|
+
const msg = `${color19.red("Codebase reindex failed:")} ${toErrorMessage12(err)}`;
|
|
15780
16015
|
return { message: msg };
|
|
15781
16016
|
}
|
|
15782
16017
|
}
|
|
@@ -15784,7 +16019,7 @@ ${color19.yellow(` ${r.errors.length} error(s) reported`)}` : "");
|
|
|
15784
16019
|
}
|
|
15785
16020
|
|
|
15786
16021
|
// src/slash-commands/collab.ts
|
|
15787
|
-
import { color as color20, toErrorMessage as
|
|
16022
|
+
import { color as color20, toErrorMessage as toErrorMessage13, truncate } from "@wrongstack/core/utils";
|
|
15788
16023
|
function buildCollabCommand(opts) {
|
|
15789
16024
|
return {
|
|
15790
16025
|
name: "collab",
|
|
@@ -15862,7 +16097,7 @@ async function historyCommand(opts, sessionId, args) {
|
|
|
15862
16097
|
}
|
|
15863
16098
|
} catch (err) {
|
|
15864
16099
|
return {
|
|
15865
|
-
message: color20.yellow(`Failed to read session: ${
|
|
16100
|
+
message: color20.yellow(`Failed to read session: ${toErrorMessage13(err)}`)
|
|
15866
16101
|
};
|
|
15867
16102
|
}
|
|
15868
16103
|
const tail = events.slice(-limit);
|
|
@@ -16780,7 +17015,7 @@ ${description}`
|
|
|
16780
17015
|
// src/slash-commands/delegate.ts
|
|
16781
17016
|
import { AGENT_CATALOG, AGENTS_BY_PHASE } from "@wrongstack/core/agent-catalog";
|
|
16782
17017
|
import { dispatchAgent as dispatchAgent2 } from "@wrongstack/core/coordination";
|
|
16783
|
-
import { color as color23, toErrorMessage as
|
|
17018
|
+
import { color as color23, toErrorMessage as toErrorMessage14 } from "@wrongstack/core/utils";
|
|
16784
17019
|
function buildDelegateCommand(opts) {
|
|
16785
17020
|
return {
|
|
16786
17021
|
name: "delegate",
|
|
@@ -16899,7 +17134,7 @@ async function spawnAgent(opts, role, _task, _name, header) {
|
|
|
16899
17134
|
opts.renderer.write(msg);
|
|
16900
17135
|
return { message: msg };
|
|
16901
17136
|
} catch (err) {
|
|
16902
|
-
const msg = `${color23.red("\u2717 Spawn failed")}: ${
|
|
17137
|
+
const msg = `${color23.red("\u2717 Spawn failed")}: ${toErrorMessage14(err)}`;
|
|
16903
17138
|
opts.renderer.writeWarning(msg);
|
|
16904
17139
|
return { message: msg };
|
|
16905
17140
|
}
|
|
@@ -17406,7 +17641,7 @@ function buildStatsCommand(opts) {
|
|
|
17406
17641
|
// src/slash-commands/doctor.ts
|
|
17407
17642
|
import * as fs8 from "node:fs/promises";
|
|
17408
17643
|
import * as path20 from "node:path";
|
|
17409
|
-
import { atomicWrite as atomicWrite3, color as color26, toErrorMessage as
|
|
17644
|
+
import { atomicWrite as atomicWrite3, color as color26, toErrorMessage as toErrorMessage15, withFileLock as withFileLock2 } from "@wrongstack/core/utils";
|
|
17410
17645
|
|
|
17411
17646
|
// src/config-doctor.ts
|
|
17412
17647
|
import { isSecretField } from "@wrongstack/core/security";
|
|
@@ -17999,7 +18234,7 @@ async function runSessionsDoctor(opts, rest) {
|
|
|
17999
18234
|
try {
|
|
18000
18235
|
report = await diagnoseSessions({ sessionsDir });
|
|
18001
18236
|
} catch (err) {
|
|
18002
|
-
return { message: `${color26.red("Session scan failed")} ${
|
|
18237
|
+
return { message: `${color26.red("Session scan failed")} ${toErrorMessage15(err)}` };
|
|
18003
18238
|
}
|
|
18004
18239
|
const lines = [`${color26.bold("WrongStack")} ${color26.dim("\u2014 Session Doctor")}`, ""];
|
|
18005
18240
|
const gb = (bytes) => bytes >= 1e9 ? `${(bytes / 1e9).toFixed(2)} GB` : `${(bytes / 1e6).toFixed(1)} MB`;
|
|
@@ -18050,7 +18285,7 @@ async function runSessionsDoctor(opts, rest) {
|
|
|
18050
18285
|
try {
|
|
18051
18286
|
lines.push(` ${color26.green("\u2713")} re-indexed ${await store.rebuildIndex()} session(s)`);
|
|
18052
18287
|
} catch (err) {
|
|
18053
|
-
lines.push(` ${color26.red("\u2717")} catalog rebuild failed: ${
|
|
18288
|
+
lines.push(` ${color26.red("\u2717")} catalog rebuild failed: ${toErrorMessage15(err)}`);
|
|
18054
18289
|
}
|
|
18055
18290
|
}
|
|
18056
18291
|
for (const failure of repair.failed) {
|
|
@@ -18204,7 +18439,7 @@ function buildDoctorCommand(opts) {
|
|
|
18204
18439
|
parsed = JSON.parse(stripBom(raw));
|
|
18205
18440
|
} catch (err) {
|
|
18206
18441
|
errorCount++;
|
|
18207
|
-
const msg =
|
|
18442
|
+
const msg = toErrorMessage15(err);
|
|
18208
18443
|
lines.push(` ${color26.red("\u2717")} invalid JSON \u2014 ${msg}`);
|
|
18209
18444
|
if (!applyFixes) {
|
|
18210
18445
|
fixableCount++;
|
|
@@ -18574,7 +18809,7 @@ import {
|
|
|
18574
18809
|
resolveAcpAgentCommand as resolveAcpAgentCommand3,
|
|
18575
18810
|
runEnsemble as runEnsemble2
|
|
18576
18811
|
} from "@wrongstack/acp";
|
|
18577
|
-
import { toErrorMessage as
|
|
18812
|
+
import { toErrorMessage as toErrorMessage16 } from "@wrongstack/core/utils";
|
|
18578
18813
|
function buildEnsembleCommand(opts) {
|
|
18579
18814
|
return {
|
|
18580
18815
|
name: "ensemble",
|
|
@@ -18664,7 +18899,7 @@ function buildEnsembleCommand(opts) {
|
|
|
18664
18899
|
});
|
|
18665
18900
|
return { message: renderEnsembleText2(result) };
|
|
18666
18901
|
} catch (err) {
|
|
18667
|
-
return { message: `Ensemble failed: ${
|
|
18902
|
+
return { message: `Ensemble failed: ${toErrorMessage16(err)}` };
|
|
18668
18903
|
}
|
|
18669
18904
|
}
|
|
18670
18905
|
};
|
|
@@ -18756,7 +18991,7 @@ import {
|
|
|
18756
18991
|
parseModelRef as parseModelRef3,
|
|
18757
18992
|
simulateFallbackFailover
|
|
18758
18993
|
} from "@wrongstack/core/agent";
|
|
18759
|
-
import { color as color30, toErrorMessage as
|
|
18994
|
+
import { color as color30, toErrorMessage as toErrorMessage17, updateJsonObjectFile as updateJsonObjectFile4 } from "@wrongstack/core/utils";
|
|
18760
18995
|
|
|
18761
18996
|
// src/slash-commands/fallback-chain-view.ts
|
|
18762
18997
|
import { runtimeFallbackChain, smartDefaultFallbackChain } from "@wrongstack/core/agent";
|
|
@@ -19338,7 +19573,7 @@ ${color30.dim("Add favorites first: /fallback fav add <ref>, or fix provider mod
|
|
|
19338
19573
|
};
|
|
19339
19574
|
} catch (err) {
|
|
19340
19575
|
return {
|
|
19341
|
-
message: `${color30.red("fallback error")}: ${
|
|
19576
|
+
message: `${color30.red("fallback error")}: ${toErrorMessage17(err)}`
|
|
19342
19577
|
};
|
|
19343
19578
|
}
|
|
19344
19579
|
}
|
|
@@ -20285,7 +20520,7 @@ When the error confidence is low (< 0.85) or the problem spans multiple files,
|
|
|
20285
20520
|
import { AGENTS_BY_PHASE as AGENTS_BY_PHASE2, summarizeDispatchLog } from "@wrongstack/core/agent-catalog";
|
|
20286
20521
|
import { dispatchAgent as dispatchAgent3 } from "@wrongstack/core/coordination";
|
|
20287
20522
|
import { sandboxTierForAgent } from "@wrongstack/core/sandbox";
|
|
20288
|
-
import { color as color32, toErrorMessage as
|
|
20523
|
+
import { color as color32, toErrorMessage as toErrorMessage18 } from "@wrongstack/core/utils";
|
|
20289
20524
|
var PHASE_ORDER = [
|
|
20290
20525
|
{ phase: "discovery", label: "1 \xB7 Discovery" },
|
|
20291
20526
|
{ phase: "planning", label: "2 \xB7 Planning" },
|
|
@@ -20601,7 +20836,7 @@ async function handleSpawn(opts, subargs) {
|
|
|
20601
20836
|
const id = await opts.onFleetSpawn(role);
|
|
20602
20837
|
spawned.push(id);
|
|
20603
20838
|
} catch (err) {
|
|
20604
|
-
const warnMsg = `${color32.red("\u2717 Spawn failed")} for slot ${i + 1}: ${
|
|
20839
|
+
const warnMsg = `${color32.red("\u2717 Spawn failed")} for slot ${i + 1}: ${toErrorMessage18(err)}`;
|
|
20605
20840
|
opts.renderer.writeWarning(warnMsg);
|
|
20606
20841
|
}
|
|
20607
20842
|
}
|
|
@@ -20711,7 +20946,7 @@ ${msg2}` };
|
|
|
20711
20946
|
const id = await opts.onFleetSpawn(decision.role);
|
|
20712
20947
|
lines.push(` ${color32.green("\u2713 spawned")} ${color32.bold(decision.role)} as ${color32.dim(id)}`);
|
|
20713
20948
|
} catch (err) {
|
|
20714
|
-
lines.push(` ${color32.amber("\u26A0 spawn failed:")} ${
|
|
20949
|
+
lines.push(` ${color32.amber("\u26A0 spawn failed:")} ${toErrorMessage18(err)}`);
|
|
20715
20950
|
}
|
|
20716
20951
|
} else {
|
|
20717
20952
|
lines.push(` ${color32.dim("(no fleet active \u2014 try spawning a task)")}`);
|
|
@@ -21076,7 +21311,7 @@ import {
|
|
|
21076
21311
|
color as color34,
|
|
21077
21312
|
configureChildEnvGitIdentity as configureChildEnvGitIdentity2,
|
|
21078
21313
|
getChildEnvGitIdentity,
|
|
21079
|
-
toErrorMessage as
|
|
21314
|
+
toErrorMessage as toErrorMessage19,
|
|
21080
21315
|
updateJsonObjectFile as updateJsonObjectFile5
|
|
21081
21316
|
} from "@wrongstack/core/utils";
|
|
21082
21317
|
function looksLikeEmail(s) {
|
|
@@ -21191,7 +21426,7 @@ function buildGitIdCommand(opts) {
|
|
|
21191
21426
|
message: `${color34.red("Unknown subcommand")} "${sub}". Try ${color34.dim("/gitid")}, ${color34.dim("/gitid set <name...> <email>")}, or ${color34.dim("/gitid help")}.`
|
|
21192
21427
|
};
|
|
21193
21428
|
} catch (err) {
|
|
21194
|
-
return { message: `${color34.red("gitid error")}: ${
|
|
21429
|
+
return { message: `${color34.red("gitid error")}: ${toErrorMessage19(err)}` };
|
|
21195
21430
|
}
|
|
21196
21431
|
}
|
|
21197
21432
|
};
|
|
@@ -23786,16 +24021,16 @@ function buildKanbanCommand(opts) {
|
|
|
23786
24021
|
|
|
23787
24022
|
// src/slash-commands/mailbox.ts
|
|
23788
24023
|
import {
|
|
23789
|
-
getSharedProjectMailbox as
|
|
24024
|
+
getSharedProjectMailbox as getSharedProjectMailbox9,
|
|
23790
24025
|
mailboxSessionTag as mailboxSessionTag6,
|
|
23791
24026
|
resolveMailboxIdentity,
|
|
23792
|
-
resolveProjectDir as
|
|
24027
|
+
resolveProjectDir as resolveProjectDir4
|
|
23793
24028
|
} from "@wrongstack/core/coordination";
|
|
23794
|
-
import { color as color42, wstackGlobalRoot as
|
|
24029
|
+
import { color as color42, wstackGlobalRoot as wstackGlobalRoot4 } from "@wrongstack/core/utils";
|
|
23795
24030
|
function buildMailbox(opts) {
|
|
23796
|
-
const projectDir = opts.paths?.projectDir ??
|
|
24031
|
+
const projectDir = opts.paths?.projectDir ?? resolveProjectDir4(opts.projectRoot, wstackGlobalRoot4());
|
|
23797
24032
|
try {
|
|
23798
|
-
return
|
|
24033
|
+
return getSharedProjectMailbox9(projectDir);
|
|
23799
24034
|
} catch {
|
|
23800
24035
|
return null;
|
|
23801
24036
|
}
|
|
@@ -24117,15 +24352,15 @@ function buildMailboxCommand(opts) {
|
|
|
24117
24352
|
|
|
24118
24353
|
// src/slash-commands/mailbox-demo.ts
|
|
24119
24354
|
import {
|
|
24120
|
-
getSharedProjectMailbox as
|
|
24121
|
-
resolveProjectDir as
|
|
24355
|
+
getSharedProjectMailbox as getSharedProjectMailbox10,
|
|
24356
|
+
resolveProjectDir as resolveProjectDir5
|
|
24122
24357
|
} from "@wrongstack/core/coordination";
|
|
24123
|
-
import { wstackGlobalRoot as
|
|
24358
|
+
import { wstackGlobalRoot as wstackGlobalRoot5 } from "@wrongstack/core/utils";
|
|
24124
24359
|
var DEMO_AGENT_ID = "mailbox-demo";
|
|
24125
24360
|
function buildMailbox2(opts) {
|
|
24126
|
-
const projectDir = opts.paths?.projectDir ??
|
|
24361
|
+
const projectDir = opts.paths?.projectDir ?? resolveProjectDir5(opts.projectRoot, wstackGlobalRoot5());
|
|
24127
24362
|
try {
|
|
24128
|
-
return
|
|
24363
|
+
return getSharedProjectMailbox10(projectDir);
|
|
24129
24364
|
} catch {
|
|
24130
24365
|
return null;
|
|
24131
24366
|
}
|
|
@@ -24315,8 +24550,8 @@ import * as fs11 from "node:fs/promises";
|
|
|
24315
24550
|
import * as os3 from "node:os";
|
|
24316
24551
|
import * as path24 from "node:path";
|
|
24317
24552
|
import { cliSpawnArgs as cliSpawnArgs2 } from "@wrongstack/core/utils";
|
|
24318
|
-
import { resolveProjectDir as
|
|
24319
|
-
import { wstackGlobalRoot as
|
|
24553
|
+
import { resolveProjectDir as resolveProjectDir6 } from "@wrongstack/core/coordination";
|
|
24554
|
+
import { wstackGlobalRoot as wstackGlobalRoot6 } from "@wrongstack/core/utils";
|
|
24320
24555
|
function buildMailboxServeCommand(opts) {
|
|
24321
24556
|
return {
|
|
24322
24557
|
name: "mailbox-serve",
|
|
@@ -24355,7 +24590,7 @@ function buildMailboxServeCommand(opts) {
|
|
|
24355
24590
|
else if (tok === "--host" || tok === "--port") flags.push(tok);
|
|
24356
24591
|
}
|
|
24357
24592
|
const cwd = opts.paths?.projectDir ?? opts.cwd;
|
|
24358
|
-
const projectDir =
|
|
24593
|
+
const projectDir = resolveProjectDir6(cwd, wstackGlobalRoot6());
|
|
24359
24594
|
const tokenPath = path24.join(projectDir, ".mailbox.token");
|
|
24360
24595
|
const pidFile = path24.join(
|
|
24361
24596
|
os3.tmpdir(),
|
|
@@ -24738,12 +24973,12 @@ function errorMessage(err) {
|
|
|
24738
24973
|
}
|
|
24739
24974
|
|
|
24740
24975
|
// src/slash-commands/memory.ts
|
|
24741
|
-
import { toErrorMessage as
|
|
24976
|
+
import { toErrorMessage as toErrorMessage25 } from "@wrongstack/core/utils";
|
|
24742
24977
|
import { getSageSurface as getSageSurface5 } from "@wrongstack/sage";
|
|
24743
24978
|
import { runSearchRace } from "@wrongstack/vector-memory";
|
|
24744
24979
|
|
|
24745
24980
|
// src/slash-commands/memory-audience.ts
|
|
24746
|
-
import { toErrorMessage as
|
|
24981
|
+
import { toErrorMessage as toErrorMessage20 } from "@wrongstack/core/utils";
|
|
24747
24982
|
function parseAudienceFlags(tokens) {
|
|
24748
24983
|
const out = { errors: [] };
|
|
24749
24984
|
for (let i = 0; i < tokens.length; i++) {
|
|
@@ -24872,7 +25107,7 @@ async function runAudienceMemory(store, rest) {
|
|
|
24872
25107
|
message: `Remembered \`${memory.id}\` for ${formatAudienceSelector(memory.audience)}: ${memory.text}`
|
|
24873
25108
|
};
|
|
24874
25109
|
} catch (err) {
|
|
24875
|
-
return { message: `Could not remember: ${
|
|
25110
|
+
return { message: `Could not remember: ${toErrorMessage20(err)}` };
|
|
24876
25111
|
}
|
|
24877
25112
|
}
|
|
24878
25113
|
if (sub === "clear") {
|
|
@@ -24884,7 +25119,7 @@ async function runAudienceMemory(store, rest) {
|
|
|
24884
25119
|
message: `Cleared audience scope from \`${id}\` \u2014 it is now general project memory.`
|
|
24885
25120
|
};
|
|
24886
25121
|
} catch (err) {
|
|
24887
|
-
return { message: `Could not clear audience: ${
|
|
25122
|
+
return { message: `Could not clear audience: ${toErrorMessage20(err)}` };
|
|
24888
25123
|
}
|
|
24889
25124
|
}
|
|
24890
25125
|
if (sub === "search" || sub === "find") {
|
|
@@ -25042,7 +25277,7 @@ async function runAudienceMemory(store, rest) {
|
|
|
25042
25277
|
}
|
|
25043
25278
|
|
|
25044
25279
|
// src/slash-commands/memory-compact.ts
|
|
25045
|
-
import { toErrorMessage as
|
|
25280
|
+
import { toErrorMessage as toErrorMessage21 } from "@wrongstack/core/utils";
|
|
25046
25281
|
import { getSageSurface as getSageSurface2 } from "@wrongstack/sage";
|
|
25047
25282
|
var COMPACT_SYSTEM_PROMPT = `You are a memory curator. Your task is to review, deduplicate, and improve a set of long-term memory entries.
|
|
25048
25283
|
|
|
@@ -25154,7 +25389,7 @@ async function runCompact(opts) {
|
|
|
25154
25389
|
responseText = response.content.filter((b) => b.type === "text").map((b) => b.text).join("").trim();
|
|
25155
25390
|
} catch (err) {
|
|
25156
25391
|
return {
|
|
25157
|
-
message: `LLM call failed: ${
|
|
25392
|
+
message: `LLM call failed: ${toErrorMessage21(err)}`
|
|
25158
25393
|
};
|
|
25159
25394
|
}
|
|
25160
25395
|
if (!responseText) {
|
|
@@ -25170,7 +25405,7 @@ ${responseText.slice(0, 500)}` };
|
|
|
25170
25405
|
parsed = JSON.parse(jsonMatch[0]);
|
|
25171
25406
|
} catch (err) {
|
|
25172
25407
|
return {
|
|
25173
|
-
message: `Failed to parse LLM response: ${
|
|
25408
|
+
message: `Failed to parse LLM response: ${toErrorMessage21(err)}
|
|
25174
25409
|
|
|
25175
25410
|
Raw response:
|
|
25176
25411
|
${responseText.slice(0, 500)}`
|
|
@@ -25243,7 +25478,7 @@ ${responseText.slice(0, 500)}`
|
|
|
25243
25478
|
}
|
|
25244
25479
|
}
|
|
25245
25480
|
} catch (err) {
|
|
25246
|
-
errors.push(`${op.action} failed for ${op.targets.join(", ")}: ${
|
|
25481
|
+
errors.push(`${op.action} failed for ${op.targets.join(", ")}: ${toErrorMessage21(err)}`);
|
|
25247
25482
|
}
|
|
25248
25483
|
}
|
|
25249
25484
|
const lines = ["## Memory Compact \u2014 Complete"];
|
|
@@ -25744,7 +25979,7 @@ function formatSearchRace(race) {
|
|
|
25744
25979
|
}
|
|
25745
25980
|
|
|
25746
25981
|
// src/slash-commands/memory-gather.ts
|
|
25747
|
-
import { toErrorMessage as
|
|
25982
|
+
import { toErrorMessage as toErrorMessage22 } from "@wrongstack/core/utils";
|
|
25748
25983
|
import { getSageSurface as getSageSurface3, SAGE_KINDS } from "@wrongstack/sage";
|
|
25749
25984
|
async function runPathMemory(store, targetPath, includeAncestors) {
|
|
25750
25985
|
const Sage = getSageSurface3(store);
|
|
@@ -25915,12 +26150,12 @@ async function runGatherCommand(Sage, rest) {
|
|
|
25915
26150
|
}
|
|
25916
26151
|
return { message: lines.join("\n") };
|
|
25917
26152
|
} catch (err) {
|
|
25918
|
-
return { message: `gather failed: ${
|
|
26153
|
+
return { message: `gather failed: ${toErrorMessage22(err)}` };
|
|
25919
26154
|
}
|
|
25920
26155
|
}
|
|
25921
26156
|
|
|
25922
26157
|
// src/slash-commands/memory-purge-domain-terms.ts
|
|
25923
|
-
import { toErrorMessage as
|
|
26158
|
+
import { toErrorMessage as toErrorMessage23 } from "@wrongstack/core/utils";
|
|
25924
26159
|
var DOMAIN_TERM_TAG2 = "domain-term";
|
|
25925
26160
|
async function runPurgeDomainTerms(Sage, rest) {
|
|
25926
26161
|
if (!Sage) return requiresSage("purge-domain-terms");
|
|
@@ -25974,7 +26209,7 @@ This is a one-off migration that permanently removes every SAGE memory tagged \`
|
|
|
25974
26209
|
});
|
|
25975
26210
|
deleted++;
|
|
25976
26211
|
} catch (err) {
|
|
25977
|
-
failures.push(`${t.id}: ${
|
|
26212
|
+
failures.push(`${t.id}: ${toErrorMessage23(err)}`);
|
|
25978
26213
|
}
|
|
25979
26214
|
}
|
|
25980
26215
|
const tagSummary = /* @__PURE__ */ new Map();
|
|
@@ -26000,7 +26235,7 @@ The \`${DOMAIN_TERM_TAG2}\` tag is now absent from the live corpus. Run \`/memor
|
|
|
26000
26235
|
};
|
|
26001
26236
|
} catch (err) {
|
|
26002
26237
|
return {
|
|
26003
|
-
message: `purge-domain-terms failed: ${
|
|
26238
|
+
message: `purge-domain-terms failed: ${toErrorMessage23(err)}`
|
|
26004
26239
|
};
|
|
26005
26240
|
}
|
|
26006
26241
|
}
|
|
@@ -26134,7 +26369,7 @@ async function runStats(opts) {
|
|
|
26134
26369
|
|
|
26135
26370
|
// src/slash-commands/memory-triage.ts
|
|
26136
26371
|
import { resolveTypeSafeJudge as resolveTypeSafeJudge2 } from "@wrongstack/core/typesafe";
|
|
26137
|
-
import { toErrorMessage as
|
|
26372
|
+
import { toErrorMessage as toErrorMessage24 } from "@wrongstack/core/utils";
|
|
26138
26373
|
import {
|
|
26139
26374
|
createSystemOneTriage,
|
|
26140
26375
|
fileTriageProposals,
|
|
@@ -26258,7 +26493,7 @@ Usage: /memory triage [--dry-run|--apply] [--limit N] [--max-phase3 N] [--max-ph
|
|
|
26258
26493
|
systemOne
|
|
26259
26494
|
});
|
|
26260
26495
|
} catch (err) {
|
|
26261
|
-
return { message: `Triage failed: ${
|
|
26496
|
+
return { message: `Triage failed: ${toErrorMessage24(err)}` };
|
|
26262
26497
|
}
|
|
26263
26498
|
if (!dryRun) {
|
|
26264
26499
|
const applyReport = await applyDispatch(Sage, report);
|
|
@@ -26318,7 +26553,7 @@ async function applyDispatch(Sage, report) {
|
|
|
26318
26553
|
autoOk++;
|
|
26319
26554
|
} catch (err) {
|
|
26320
26555
|
autoFail++;
|
|
26321
|
-
lines.push(` \u2717 Failed to update ${action.memoryId}: ${
|
|
26556
|
+
lines.push(` \u2717 Failed to update ${action.memoryId}: ${toErrorMessage24(err)}`);
|
|
26322
26557
|
}
|
|
26323
26558
|
}
|
|
26324
26559
|
lines.push(`**Auto-apply:** ${autoOk} succeeded, ${autoFail} failed`);
|
|
@@ -26342,7 +26577,7 @@ async function applyDispatch(Sage, report) {
|
|
|
26342
26577
|
} catch (err) {
|
|
26343
26578
|
mergeFail++;
|
|
26344
26579
|
lines.push(
|
|
26345
|
-
` \u2717 Failed to merge ${merge.supersededId} \u2192 ${merge.keeperId}: ${
|
|
26580
|
+
` \u2717 Failed to merge ${merge.supersededId} \u2192 ${merge.keeperId}: ${toErrorMessage24(err)}`
|
|
26346
26581
|
);
|
|
26347
26582
|
}
|
|
26348
26583
|
}
|
|
@@ -26428,7 +26663,7 @@ function buildMemoryCommand(opts) {
|
|
|
26428
26663
|
message: `Remembered \`${memory.id}\` [${memory.kind}] ${memory.text}${tags}`
|
|
26429
26664
|
};
|
|
26430
26665
|
} catch (err) {
|
|
26431
|
-
return { message: `Could not remember: ${
|
|
26666
|
+
return { message: `Could not remember: ${toErrorMessage25(err)}` };
|
|
26432
26667
|
}
|
|
26433
26668
|
}
|
|
26434
26669
|
case "update":
|
|
@@ -26466,7 +26701,7 @@ function buildMemoryCommand(opts) {
|
|
|
26466
26701
|
message: `Updated \`${memory.id}\` [${memory.kind}|${memory.status}] ${memory.text}`
|
|
26467
26702
|
};
|
|
26468
26703
|
} catch (err) {
|
|
26469
|
-
return { message: `Could not update: ${
|
|
26704
|
+
return { message: `Could not update: ${toErrorMessage25(err)}` };
|
|
26470
26705
|
}
|
|
26471
26706
|
}
|
|
26472
26707
|
case "delete":
|
|
@@ -26481,7 +26716,7 @@ function buildMemoryCommand(opts) {
|
|
|
26481
26716
|
await Sage.deleteSage(id, reason, { force: true });
|
|
26482
26717
|
return { message: `Deleted \`${id}\`.` };
|
|
26483
26718
|
} catch (err) {
|
|
26484
|
-
return { message: `Could not delete: ${
|
|
26719
|
+
return { message: `Could not delete: ${toErrorMessage25(err)}` };
|
|
26485
26720
|
}
|
|
26486
26721
|
}
|
|
26487
26722
|
case "forget":
|
|
@@ -26745,7 +26980,7 @@ function buildMemoryCommand(opts) {
|
|
|
26745
26980
|
File size reduced. Audit-logged as \`memory.log_compacted\`.`
|
|
26746
26981
|
};
|
|
26747
26982
|
} catch (err) {
|
|
26748
|
-
return { message: `Compaction failed: ${
|
|
26983
|
+
return { message: `Compaction failed: ${toErrorMessage25(err)}` };
|
|
26749
26984
|
}
|
|
26750
26985
|
}
|
|
26751
26986
|
case "stats": {
|
|
@@ -27228,7 +27463,7 @@ function buildModelCapsCommand(opts) {
|
|
|
27228
27463
|
import {
|
|
27229
27464
|
ToolValidationError as ToolValidationError3
|
|
27230
27465
|
} from "@wrongstack/core/types";
|
|
27231
|
-
import { color as color46, toErrorMessage as
|
|
27466
|
+
import { color as color46, toErrorMessage as toErrorMessage26, updateJsonObjectFile as updateJsonObjectFile6 } from "@wrongstack/core/utils";
|
|
27232
27467
|
async function patchProfileConfig(mutate, profileConfigPath) {
|
|
27233
27468
|
return updateJsonObjectFile6(profileConfigPath, async (config) => {
|
|
27234
27469
|
await backupCurrent(void 0, profileConfigPath);
|
|
@@ -27437,7 +27672,7 @@ function buildModelsCommand(opts) {
|
|
|
27437
27672
|
};
|
|
27438
27673
|
} catch (err) {
|
|
27439
27674
|
return {
|
|
27440
|
-
message: `${color46.red("models error")}: ${
|
|
27675
|
+
message: `${color46.red("models error")}: ${toErrorMessage26(err)}`
|
|
27441
27676
|
};
|
|
27442
27677
|
}
|
|
27443
27678
|
}
|
|
@@ -27593,7 +27828,7 @@ function handleList2(opts) {
|
|
|
27593
27828
|
// src/slash-commands/nextsteps-mode.ts
|
|
27594
27829
|
import { noOpVault as noOpVault3 } from "@wrongstack/core/security";
|
|
27595
27830
|
import { NEXT_STEPS_MODES as NEXT_STEPS_MODES2, resolveNextStepsMode } from "@wrongstack/core/types";
|
|
27596
|
-
import { color as color48, toErrorMessage as
|
|
27831
|
+
import { color as color48, toErrorMessage as toErrorMessage27 } from "@wrongstack/core/utils";
|
|
27597
27832
|
var NEXT_STEPS_LIMIT_PRESETS = [5, 10, 20, 50, 100, 0];
|
|
27598
27833
|
var UNLIMITED_WORDS = /* @__PURE__ */ new Set(["unlimited", "inf", "infinite", "\u221E", "sonsuz", "0"]);
|
|
27599
27834
|
function parseNextStepsLimit(raw) {
|
|
@@ -27682,7 +27917,7 @@ function buildNextStepsModeCommand(opts) {
|
|
|
27682
27917
|
(target) => apply(target)
|
|
27683
27918
|
);
|
|
27684
27919
|
} catch (err) {
|
|
27685
|
-
return { message: `${color48.red("Failed to save")}: ${
|
|
27920
|
+
return { message: `${color48.red("Failed to save")}: ${toErrorMessage27(err)}` };
|
|
27686
27921
|
}
|
|
27687
27922
|
const liveAutonomy = { ...opts.configStore.get().autonomy ?? {} };
|
|
27688
27923
|
apply(liveAutonomy);
|
|
@@ -27937,7 +28172,7 @@ import {
|
|
|
27937
28172
|
readSessionPermissionOverrides,
|
|
27938
28173
|
setSessionPermissionOverrides
|
|
27939
28174
|
} from "@wrongstack/core/security";
|
|
27940
|
-
import { color as color50, toErrorMessage as
|
|
28175
|
+
import { color as color50, toErrorMessage as toErrorMessage28 } from "@wrongstack/core/utils";
|
|
27941
28176
|
var HELP2 = [
|
|
27942
28177
|
"Usage:",
|
|
27943
28178
|
" /permissions List this session\u2019s allow/deny rules",
|
|
@@ -28023,7 +28258,7 @@ ${formatPermissionRules(rules)}` };
|
|
|
28023
28258
|
|
|
28024
28259
|
${formatExplainedCall(explained)}` };
|
|
28025
28260
|
} catch (err) {
|
|
28026
|
-
return { message: color50.red(`Explain failed: ${
|
|
28261
|
+
return { message: color50.red(`Explain failed: ${toErrorMessage28(err)}`) };
|
|
28027
28262
|
}
|
|
28028
28263
|
}
|
|
28029
28264
|
let next;
|
|
@@ -28078,7 +28313,7 @@ ${HELP2}`) };
|
|
|
28078
28313
|
try {
|
|
28079
28314
|
await setSessionPermissionOverrides(ctx, next);
|
|
28080
28315
|
} catch (err) {
|
|
28081
|
-
return { message: color50.red(`Could not save the session rule: ${
|
|
28316
|
+
return { message: color50.red(`Could not save the session rule: ${toErrorMessage28(err)}`) };
|
|
28082
28317
|
}
|
|
28083
28318
|
return { message: color50.green(done) };
|
|
28084
28319
|
}
|
|
@@ -28942,7 +29177,7 @@ function buildPruneCommand(opts) {
|
|
|
28942
29177
|
|
|
28943
29178
|
// src/slash-commands/refiner.ts
|
|
28944
29179
|
import { noOpVault as noOpVault4 } from "@wrongstack/core/security";
|
|
28945
|
-
import { color as color54, toErrorMessage as
|
|
29180
|
+
import { color as color54, toErrorMessage as toErrorMessage29 } from "@wrongstack/core/utils";
|
|
28946
29181
|
function buildRefinerCommand(opts) {
|
|
28947
29182
|
const help = [
|
|
28948
29183
|
"Usage:",
|
|
@@ -29042,7 +29277,7 @@ function buildRefinerCommand(opts) {
|
|
|
29042
29277
|
};
|
|
29043
29278
|
} catch (err) {
|
|
29044
29279
|
return {
|
|
29045
|
-
message: `${color54.red("refiner error")}: ${
|
|
29280
|
+
message: `${color54.red("refiner error")}: ${toErrorMessage29(err)}`
|
|
29046
29281
|
};
|
|
29047
29282
|
}
|
|
29048
29283
|
}
|
|
@@ -29064,7 +29299,7 @@ function buildRefinerCommand(opts) {
|
|
|
29064
29299
|
};
|
|
29065
29300
|
} catch (err) {
|
|
29066
29301
|
return {
|
|
29067
|
-
message: `${color54.red("refiner error")}: ${
|
|
29302
|
+
message: `${color54.red("refiner error")}: ${toErrorMessage29(err)}`
|
|
29068
29303
|
};
|
|
29069
29304
|
}
|
|
29070
29305
|
}
|
|
@@ -30531,11 +30766,11 @@ ${sddHelp()}`
|
|
|
30531
30766
|
// src/slash-commands/session.ts
|
|
30532
30767
|
import * as path26 from "node:path";
|
|
30533
30768
|
import { extractInterruptedTools, SessionRecovery as SessionRecovery2 } from "@wrongstack/core/storage";
|
|
30534
|
-
import { color as color57, toErrorMessage as
|
|
30769
|
+
import { color as color57, toErrorMessage as toErrorMessage31 } from "@wrongstack/core/utils";
|
|
30535
30770
|
|
|
30536
30771
|
// src/slash-commands/session-live-status.ts
|
|
30537
30772
|
import { getSessionRegistry as getSessionRegistry3 } from "@wrongstack/core/storage";
|
|
30538
|
-
import { color as color56, isPidAlive as isPidAlive2, toErrorMessage as
|
|
30773
|
+
import { color as color56, isPidAlive as isPidAlive2, toErrorMessage as toErrorMessage30 } from "@wrongstack/core/utils";
|
|
30539
30774
|
function statusIcon2(status) {
|
|
30540
30775
|
switch (status) {
|
|
30541
30776
|
case "active":
|
|
@@ -30830,7 +31065,7 @@ async function killSession(sessionId, confirm) {
|
|
|
30830
31065
|
};
|
|
30831
31066
|
} catch (err) {
|
|
30832
31067
|
return {
|
|
30833
|
-
message: color56.red(`Failed to kill session: ${
|
|
31068
|
+
message: color56.red(`Failed to kill session: ${toErrorMessage30(err)}`)
|
|
30834
31069
|
};
|
|
30835
31070
|
}
|
|
30836
31071
|
}
|
|
@@ -30901,7 +31136,7 @@ function buildLoadCommand(opts) {
|
|
|
30901
31136
|
message: name ? color57.green(`Renamed ${targetId} \u2192 "${name}"`) : color57.green(`Cleared name on ${targetId} (title: "${summary.title}")`)
|
|
30902
31137
|
};
|
|
30903
31138
|
} catch (err) {
|
|
30904
|
-
return { message: color57.red(`Rename failed: ${
|
|
31139
|
+
return { message: color57.red(`Rename failed: ${toErrorMessage31(err)}`) };
|
|
30905
31140
|
}
|
|
30906
31141
|
}
|
|
30907
31142
|
if (first === "move") {
|
|
@@ -30931,7 +31166,7 @@ function buildLoadCommand(opts) {
|
|
|
30931
31166
|
});
|
|
30932
31167
|
return { message: color57.green(describeSessionMove(result)) };
|
|
30933
31168
|
} catch (err) {
|
|
30934
|
-
return { message: color57.red(`Move failed: ${
|
|
31169
|
+
return { message: color57.red(`Move failed: ${toErrorMessage31(err)}`) };
|
|
30935
31170
|
}
|
|
30936
31171
|
}
|
|
30937
31172
|
if (first === "archive") {
|
|
@@ -30951,7 +31186,7 @@ function buildLoadCommand(opts) {
|
|
|
30951
31186
|
)
|
|
30952
31187
|
};
|
|
30953
31188
|
} catch (err) {
|
|
30954
|
-
return { message: color57.red(`Archive failed: ${
|
|
31189
|
+
return { message: color57.red(`Archive failed: ${toErrorMessage31(err)}`) };
|
|
30955
31190
|
}
|
|
30956
31191
|
}
|
|
30957
31192
|
if (!apply) {
|
|
@@ -30991,7 +31226,7 @@ function buildLoadCommand(opts) {
|
|
|
30991
31226
|
message: result.action === "rehydrated" ? color57.green(`Rehydrated ${targetId}`) : color57.dim(`Rehydrate ${result.action}: ${targetId}`)
|
|
30992
31227
|
};
|
|
30993
31228
|
} catch (err) {
|
|
30994
|
-
return { message: color57.red(`Rehydrate failed: ${
|
|
31229
|
+
return { message: color57.red(`Rehydrate failed: ${toErrorMessage31(err)}`) };
|
|
30995
31230
|
}
|
|
30996
31231
|
}
|
|
30997
31232
|
if (first === "delete") {
|
|
@@ -31022,7 +31257,7 @@ function buildLoadCommand(opts) {
|
|
|
31022
31257
|
await opts.sessionStore.delete(targetId);
|
|
31023
31258
|
return { message: color57.green(`Deleted session ${targetId}`) };
|
|
31024
31259
|
} catch (err) {
|
|
31025
|
-
return { message: color57.red(`Delete failed: ${
|
|
31260
|
+
return { message: color57.red(`Delete failed: ${toErrorMessage31(err)}`) };
|
|
31026
31261
|
}
|
|
31027
31262
|
}
|
|
31028
31263
|
const showIncomplete = parts.includes("--incomplete") || parts.includes("-i");
|
|
@@ -31184,7 +31419,7 @@ import {
|
|
|
31184
31419
|
isReasoningEffort as isReasoningEffort2,
|
|
31185
31420
|
REASONING_EFFORT_LEVELS as REASONING_EFFORT_LEVELS2
|
|
31186
31421
|
} from "@wrongstack/core/types";
|
|
31187
|
-
import { color as color58, expectDefined as expectDefined9, toErrorMessage as
|
|
31422
|
+
import { color as color58, expectDefined as expectDefined9, toErrorMessage as toErrorMessage32, updateJsonObjectFile as updateJsonObjectFile7 } from "@wrongstack/core/utils";
|
|
31188
31423
|
import { catalogProviderIdFor as catalogProviderIdFor5 } from "@wrongstack/providers";
|
|
31189
31424
|
async function resolveCatalogModelIds(registry, config, providerIds) {
|
|
31190
31425
|
const out = /* @__PURE__ */ new Map();
|
|
@@ -31724,7 +31959,7 @@ function buildSetModelCommand(opts) {
|
|
|
31724
31959
|
};
|
|
31725
31960
|
} catch (err) {
|
|
31726
31961
|
return {
|
|
31727
|
-
message: `${color58.red("setmodel error")}: ${
|
|
31962
|
+
message: `${color58.red("setmodel error")}: ${toErrorMessage32(err)}`
|
|
31728
31963
|
};
|
|
31729
31964
|
}
|
|
31730
31965
|
}
|
|
@@ -32057,7 +32292,7 @@ ${help}`) };
|
|
|
32057
32292
|
import { execFile as execFile2 } from "node:child_process";
|
|
32058
32293
|
import { access as access3 } from "node:fs/promises";
|
|
32059
32294
|
import * as path27 from "node:path";
|
|
32060
|
-
import { color as color60, toErrorMessage as
|
|
32295
|
+
import { color as color60, toErrorMessage as toErrorMessage33 } from "@wrongstack/core/utils";
|
|
32061
32296
|
import { parseNextSteps } from "@wrongstack/tools/next-steps";
|
|
32062
32297
|
function readGitStatus(projectRoot, includeBranch) {
|
|
32063
32298
|
const args = ["status", "--short"];
|
|
@@ -32198,7 +32433,7 @@ function buildSuggestCommand(opts) {
|
|
|
32198
32433
|
return { message: formatSuggestions(suggestions) };
|
|
32199
32434
|
} catch (err) {
|
|
32200
32435
|
if (!isCurrent()) return superseded();
|
|
32201
|
-
const msg = `Suggestion generation failed: ${
|
|
32436
|
+
const msg = `Suggestion generation failed: ${toErrorMessage33(err)}`;
|
|
32202
32437
|
opts.renderer.writeWarning(msg);
|
|
32203
32438
|
return { message: msg };
|
|
32204
32439
|
}
|
|
@@ -32507,7 +32742,7 @@ function buildThemeCommand(opts) {
|
|
|
32507
32742
|
|
|
32508
32743
|
// src/slash-commands/tier.ts
|
|
32509
32744
|
import { leaderTierPolicy, listTierIds, resolveTier } from "@wrongstack/core/coordination";
|
|
32510
|
-
import { color as color62, toErrorMessage as
|
|
32745
|
+
import { color as color62, toErrorMessage as toErrorMessage34, updateJsonObjectFile as updateJsonObjectFile8 } from "@wrongstack/core/utils";
|
|
32511
32746
|
var LEADER_MODES = ["off", "propose", "auto"];
|
|
32512
32747
|
var DECIMAL_RE2 = /^(?:\d+(?:\.\d*)?|\.\d+)$/;
|
|
32513
32748
|
var INTEGER_RE2 = /^\d+$/;
|
|
@@ -32824,7 +33059,7 @@ function buildTierCommand(opts) {
|
|
|
32824
33059
|
message: `${color62.red("Unknown subcommand")} "${sub}". Try ${color62.dim("/tier")} or ${color62.dim("/tier help")}.`
|
|
32825
33060
|
};
|
|
32826
33061
|
} catch (err) {
|
|
32827
|
-
return { message: `${color62.red("tier error")}: ${
|
|
33062
|
+
return { message: `${color62.red("tier error")}: ${toErrorMessage34(err)}` };
|
|
32828
33063
|
}
|
|
32829
33064
|
}
|
|
32830
33065
|
};
|
|
@@ -34316,7 +34551,7 @@ function buildSecurityCommand(opts) {
|
|
|
34316
34551
|
import { color as color74 } from "@wrongstack/core/utils";
|
|
34317
34552
|
|
|
34318
34553
|
// src/slash-commands/settings-mutations.ts
|
|
34319
|
-
import { color as color72, toErrorMessage as
|
|
34554
|
+
import { color as color72, toErrorMessage as toErrorMessage35 } from "@wrongstack/core/utils";
|
|
34320
34555
|
|
|
34321
34556
|
// src/slash-commands/settings-context-mutations.ts
|
|
34322
34557
|
import { color as color66 } from "@wrongstack/core/utils";
|
|
@@ -35480,7 +35715,7 @@ async function executeSettingsSubcommand(sub, rest, opts) {
|
|
|
35480
35715
|
};
|
|
35481
35716
|
} catch (err) {
|
|
35482
35717
|
return {
|
|
35483
|
-
message: `${color72.red("Settings error")}: ${
|
|
35718
|
+
message: `${color72.red("Settings error")}: ${toErrorMessage35(err)}`
|
|
35484
35719
|
};
|
|
35485
35720
|
}
|
|
35486
35721
|
}
|
|
@@ -36048,7 +36283,7 @@ function buildSidebarCommand(opts) {
|
|
|
36048
36283
|
}
|
|
36049
36284
|
|
|
36050
36285
|
// src/slash-commands/spawn-agents.ts
|
|
36051
|
-
import { toErrorMessage as
|
|
36286
|
+
import { toErrorMessage as toErrorMessage36 } from "@wrongstack/core/utils";
|
|
36052
36287
|
function buildSpawnCommand(opts) {
|
|
36053
36288
|
return {
|
|
36054
36289
|
name: "spawn",
|
|
@@ -36085,7 +36320,7 @@ function buildSpawnCommand(opts) {
|
|
|
36085
36320
|
const summary = Object.keys(parsed).length > 0 ? await opts.onSpawn(description, parsed) : await opts.onSpawn(description);
|
|
36086
36321
|
return { message: summary };
|
|
36087
36322
|
} catch (err) {
|
|
36088
|
-
return { message: `Spawn failed: ${
|
|
36323
|
+
return { message: `Spawn failed: ${toErrorMessage36(err)}` };
|
|
36089
36324
|
}
|
|
36090
36325
|
}
|
|
36091
36326
|
};
|
|
@@ -36370,7 +36605,7 @@ function buildSupervisorCommand(opts) {
|
|
|
36370
36605
|
}
|
|
36371
36606
|
|
|
36372
36607
|
// src/slash-commands/tasks.ts
|
|
36373
|
-
import { randomUUID as
|
|
36608
|
+
import { randomUUID as randomUUID11 } from "node:crypto";
|
|
36374
36609
|
import {
|
|
36375
36610
|
addPlanItem as addPlanItem2,
|
|
36376
36611
|
formatPlan as formatPlan2,
|
|
@@ -36535,7 +36770,7 @@ ${formatPlan2(updated)}`;
|
|
|
36535
36770
|
const title = parts.join(" ");
|
|
36536
36771
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
36537
36772
|
file.tasks.push({
|
|
36538
|
-
id: `task_${
|
|
36773
|
+
id: `task_${randomUUID11()}`,
|
|
36539
36774
|
title,
|
|
36540
36775
|
type,
|
|
36541
36776
|
priority,
|
|
@@ -36705,7 +36940,7 @@ ${formatTaskProgress(file.tasks)}`;
|
|
|
36705
36940
|
];
|
|
36706
36941
|
if (found.item.description) {
|
|
36707
36942
|
todos.push({
|
|
36708
|
-
id: `todo_${
|
|
36943
|
+
id: `todo_${randomUUID11()}`,
|
|
36709
36944
|
content: found.item.description.slice(0, 200),
|
|
36710
36945
|
status: "pending",
|
|
36711
36946
|
promotedFromTask: found.item.id
|
|
@@ -36791,7 +37026,7 @@ ${formatTaskProgress(file.tasks)}`;
|
|
|
36791
37026
|
// src/slash-commands/techstack.ts
|
|
36792
37027
|
import * as fs15 from "node:fs/promises";
|
|
36793
37028
|
import * as path30 from "node:path";
|
|
36794
|
-
import { color as color78, toErrorMessage as
|
|
37029
|
+
import { color as color78, toErrorMessage as toErrorMessage37 } from "@wrongstack/core/utils";
|
|
36795
37030
|
async function discoverPackageFiles(projectRoot) {
|
|
36796
37031
|
const files = [];
|
|
36797
37032
|
const rootPkg = path30.join(projectRoot, "package.json");
|
|
@@ -36999,7 +37234,7 @@ function buildTechStackCommand(opts) {
|
|
|
36999
37234
|
message: `TechStack remediation finished: ${applied} applied, ${failed} failed, ${skipped} skipped.`
|
|
37000
37235
|
};
|
|
37001
37236
|
} catch (err) {
|
|
37002
|
-
const msg = `TechStack remediation failed: ${
|
|
37237
|
+
const msg = `TechStack remediation failed: ${toErrorMessage37(err)}`;
|
|
37003
37238
|
opts.renderer.writeWarning(msg);
|
|
37004
37239
|
return { message: msg };
|
|
37005
37240
|
} finally {
|
|
@@ -37018,7 +37253,7 @@ function buildTechStackCommand(opts) {
|
|
|
37018
37253
|
message: `TechStack inventory complete: ${snapshot.workspaces.length} workspaces, ${snapshot.dependencies.length} dependencies (fingerprint: ${snapshot.fingerprint})`
|
|
37019
37254
|
};
|
|
37020
37255
|
} catch (err) {
|
|
37021
|
-
const msg = `TechStack inventory failed: ${
|
|
37256
|
+
const msg = `TechStack inventory failed: ${toErrorMessage37(err)}`;
|
|
37022
37257
|
opts.renderer.writeWarning(msg);
|
|
37023
37258
|
return { message: msg };
|
|
37024
37259
|
}
|
|
@@ -37033,7 +37268,7 @@ function buildTechStackCommand(opts) {
|
|
|
37033
37268
|
);
|
|
37034
37269
|
}
|
|
37035
37270
|
} catch (err) {
|
|
37036
|
-
discoveryNote = color78.red(`Could not scan for package files: ${
|
|
37271
|
+
discoveryNote = color78.red(`Could not scan for package files: ${toErrorMessage37(err)}`);
|
|
37037
37272
|
}
|
|
37038
37273
|
const task = buildTechStackTask({
|
|
37039
37274
|
projectRoot: opts.projectRoot,
|
|
@@ -37073,7 +37308,7 @@ function buildTechStackCommand(opts) {
|
|
|
37073
37308
|
});
|
|
37074
37309
|
return { message: summary };
|
|
37075
37310
|
} catch (err) {
|
|
37076
|
-
const msg = `Tech stack scan failed: ${
|
|
37311
|
+
const msg = `Tech stack scan failed: ${toErrorMessage37(err)}`;
|
|
37077
37312
|
opts.renderer.writeWarning(msg);
|
|
37078
37313
|
return { message: msg };
|
|
37079
37314
|
}
|
|
@@ -37082,7 +37317,7 @@ function buildTechStackCommand(opts) {
|
|
|
37082
37317
|
}
|
|
37083
37318
|
|
|
37084
37319
|
// src/slash-commands/telegram-settings.ts
|
|
37085
|
-
import { color as color80, toErrorMessage as
|
|
37320
|
+
import { color as color80, toErrorMessage as toErrorMessage38 } from "@wrongstack/core/utils";
|
|
37086
37321
|
|
|
37087
37322
|
// src/slash-commands/telegram-setup.ts
|
|
37088
37323
|
import { color as color79 } from "@wrongstack/core/utils";
|
|
@@ -37580,7 +37815,7 @@ function buildTelegramSettingsCommand(opts) {
|
|
|
37580
37815
|
};
|
|
37581
37816
|
} catch (err) {
|
|
37582
37817
|
return {
|
|
37583
|
-
message: `${color80.red("Settings error")}: ${
|
|
37818
|
+
message: `${color80.red("Settings error")}: ${toErrorMessage38(err)}`
|
|
37584
37819
|
};
|
|
37585
37820
|
}
|
|
37586
37821
|
}
|
|
@@ -37588,7 +37823,7 @@ function buildTelegramSettingsCommand(opts) {
|
|
|
37588
37823
|
}
|
|
37589
37824
|
|
|
37590
37825
|
// src/slash-commands/todos.ts
|
|
37591
|
-
import { randomUUID as
|
|
37826
|
+
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
37592
37827
|
import { formatTodosList as formatTodosList2 } from "@wrongstack/core/utils";
|
|
37593
37828
|
import { todoTool as todoTool3 } from "@wrongstack/tools";
|
|
37594
37829
|
function findTodo(todos, query) {
|
|
@@ -37648,7 +37883,7 @@ function buildTodosCommand(opts) {
|
|
|
37648
37883
|
return { message: "This Todo list is a Kanban projection. Add the task in Kanban." };
|
|
37649
37884
|
}
|
|
37650
37885
|
const item = {
|
|
37651
|
-
id: `todo_${Date.now()}_${
|
|
37886
|
+
id: `todo_${Date.now()}_${randomUUID12().slice(0, 7)}`,
|
|
37652
37887
|
content: restJoined,
|
|
37653
37888
|
status: "pending"
|
|
37654
37889
|
};
|
|
@@ -37753,7 +37988,7 @@ import {
|
|
|
37753
37988
|
normalizeToolDescriptionMode,
|
|
37754
37989
|
normalizeToolResultRenderMode,
|
|
37755
37990
|
setToolResultRenderMode,
|
|
37756
|
-
toErrorMessage as
|
|
37991
|
+
toErrorMessage as toErrorMessage39
|
|
37757
37992
|
} from "@wrongstack/core/utils";
|
|
37758
37993
|
|
|
37759
37994
|
// src/slash-commands/tool-auto-thin-commands.ts
|
|
@@ -38278,7 +38513,7 @@ function buildToolCommand(opts) {
|
|
|
38278
38513
|
try {
|
|
38279
38514
|
return { message: await cmdEnableAll() };
|
|
38280
38515
|
} catch (err) {
|
|
38281
|
-
return { message: `${color82.red("Error")}: ${
|
|
38516
|
+
return { message: `${color82.red("Error")}: ${toErrorMessage39(err)}` };
|
|
38282
38517
|
}
|
|
38283
38518
|
}
|
|
38284
38519
|
if (sub === "autothin" || sub === "auto-thin") {
|
|
@@ -38306,7 +38541,7 @@ function buildToolCommand(opts) {
|
|
|
38306
38541
|
};
|
|
38307
38542
|
}
|
|
38308
38543
|
} catch (err) {
|
|
38309
|
-
return { message: `${color82.red("Error")}: ${
|
|
38544
|
+
return { message: `${color82.red("Error")}: ${toErrorMessage39(err)}` };
|
|
38310
38545
|
}
|
|
38311
38546
|
}
|
|
38312
38547
|
const name = parts[0] ?? "";
|
|
@@ -38320,7 +38555,7 @@ function buildToolCommand(opts) {
|
|
|
38320
38555
|
for (const t of targets) results.push(await cmdDisable(t));
|
|
38321
38556
|
return { message: results.join("\n") };
|
|
38322
38557
|
} catch (err) {
|
|
38323
|
-
return { message: `${color82.red("Error")}: ${
|
|
38558
|
+
return { message: `${color82.red("Error")}: ${toErrorMessage39(err)}` };
|
|
38324
38559
|
}
|
|
38325
38560
|
}
|
|
38326
38561
|
if (sub === "enable") {
|
|
@@ -38332,7 +38567,7 @@ function buildToolCommand(opts) {
|
|
|
38332
38567
|
for (const t of targets) results.push(await cmdEnable(t));
|
|
38333
38568
|
return { message: results.join("\n") };
|
|
38334
38569
|
} catch (err) {
|
|
38335
|
-
return { message: `${color82.red("Error")}: ${
|
|
38570
|
+
return { message: `${color82.red("Error")}: ${toErrorMessage39(err)}` };
|
|
38336
38571
|
}
|
|
38337
38572
|
}
|
|
38338
38573
|
const action = parts[1]?.toLowerCase();
|
|
@@ -38345,7 +38580,7 @@ function buildToolCommand(opts) {
|
|
|
38345
38580
|
try {
|
|
38346
38581
|
return { message: action === "disable" ? await cmdDisable(name) : await cmdEnable(name) };
|
|
38347
38582
|
} catch (err) {
|
|
38348
|
-
return { message: `${color82.red("Error")}: ${
|
|
38583
|
+
return { message: `${color82.red("Error")}: ${toErrorMessage39(err)}` };
|
|
38349
38584
|
}
|
|
38350
38585
|
}
|
|
38351
38586
|
if (!opts.toolRegistry.get(name) && !opts.toolRegistry.isDisabled(name)) {
|
|
@@ -38385,7 +38620,7 @@ function buildToolCommand(opts) {
|
|
|
38385
38620
|
};
|
|
38386
38621
|
} catch (err) {
|
|
38387
38622
|
return {
|
|
38388
|
-
message: `${color82.red("Could not save tool setting")}: ${
|
|
38623
|
+
message: `${color82.red("Could not save tool setting")}: ${toErrorMessage39(err)}`
|
|
38389
38624
|
};
|
|
38390
38625
|
}
|
|
38391
38626
|
}
|
|
@@ -38405,7 +38640,7 @@ function buildToolCommand(opts) {
|
|
|
38405
38640
|
};
|
|
38406
38641
|
} catch (err) {
|
|
38407
38642
|
return {
|
|
38408
|
-
message: `${color82.red("Could not save tool setting")}: ${
|
|
38643
|
+
message: `${color82.red("Could not save tool setting")}: ${toErrorMessage39(err)}`
|
|
38409
38644
|
};
|
|
38410
38645
|
}
|
|
38411
38646
|
}
|
|
@@ -39333,7 +39568,7 @@ function summaryLine(findings, fixable, handoffs, power) {
|
|
|
39333
39568
|
// src/slash-commands/working-dir.ts
|
|
39334
39569
|
import * as fs17 from "node:fs/promises";
|
|
39335
39570
|
import * as path32 from "node:path";
|
|
39336
|
-
import { color as color85, toErrorMessage as
|
|
39571
|
+
import { color as color85, toErrorMessage as toErrorMessage40 } from "@wrongstack/core/utils";
|
|
39337
39572
|
function buildWorkingDirCommand(_opts) {
|
|
39338
39573
|
return {
|
|
39339
39574
|
name: "working_dir",
|
|
@@ -39390,7 +39625,7 @@ function buildWorkingDirCommand(_opts) {
|
|
|
39390
39625
|
ctx.setWorkingDir(resolved);
|
|
39391
39626
|
} catch (err) {
|
|
39392
39627
|
return {
|
|
39393
|
-
message: color85.red(
|
|
39628
|
+
message: color85.red(toErrorMessage40(err))
|
|
39394
39629
|
};
|
|
39395
39630
|
}
|
|
39396
39631
|
const prevRel = path32.relative(ctx.projectRoot, previous) || ".";
|
|
@@ -39833,15 +40068,15 @@ function setupCliSlashCommands(params) {
|
|
|
39833
40068
|
return built;
|
|
39834
40069
|
},
|
|
39835
40070
|
getConfig: () => config,
|
|
39836
|
-
fallbackProfileManager: container.resolve(
|
|
40071
|
+
fallbackProfileManager: container.resolve(TOKENS16.FallbackProfileManager)
|
|
39837
40072
|
}) : void 0;
|
|
39838
40073
|
const slashCmds = buildCommandHostSlashCommands({
|
|
39839
40074
|
registry: slashRegistry,
|
|
39840
40075
|
toolRegistry,
|
|
39841
40076
|
...createCommandHostAdapters({ agent, toolRegistry, interruptController, reader }),
|
|
39842
40077
|
paths: wpaths,
|
|
39843
|
-
compactor: container.resolve(
|
|
39844
|
-
permissionPolicy: container.resolve(
|
|
40078
|
+
compactor: container.resolve(TOKENS16.Compactor),
|
|
40079
|
+
permissionPolicy: container.resolve(TOKENS16.PermissionPolicy),
|
|
39845
40080
|
sessionStore,
|
|
39846
40081
|
sessionRef,
|
|
39847
40082
|
skillLoader,
|
|
@@ -39931,7 +40166,7 @@ function setupCliSlashCommands(params) {
|
|
|
39931
40166
|
...createEternalCommandHandlers({
|
|
39932
40167
|
agent,
|
|
39933
40168
|
projectRoot,
|
|
39934
|
-
compactor: container.resolve(
|
|
40169
|
+
compactor: container.resolve(TOKENS16.Compactor),
|
|
39935
40170
|
effectiveMaxContext: effectiveMaxContextRef,
|
|
39936
40171
|
onIteration: broadcastEternalIteration,
|
|
39937
40172
|
onStage: broadcastAutonomyStage,
|
|
@@ -40271,7 +40506,7 @@ async function setupCommandHostState(input) {
|
|
|
40271
40506
|
// src/wiring/dep-watcher.ts
|
|
40272
40507
|
import * as path33 from "node:path";
|
|
40273
40508
|
import {
|
|
40274
|
-
getSharedProjectMailbox as
|
|
40509
|
+
getSharedProjectMailbox as getSharedProjectMailbox11,
|
|
40275
40510
|
startPackageOutdatedWatcher,
|
|
40276
40511
|
startTechStackConsumer
|
|
40277
40512
|
} from "@wrongstack/core/coordination";
|
|
@@ -40320,7 +40555,7 @@ function setupDepWatcherConsumers(deps) {
|
|
|
40320
40555
|
let offSessionEnded;
|
|
40321
40556
|
try {
|
|
40322
40557
|
const projectDir = path33.join(globalRoot, "projects", projectSlug);
|
|
40323
|
-
const tsMailbox =
|
|
40558
|
+
const tsMailbox = getSharedProjectMailbox11(projectDir, events);
|
|
40324
40559
|
const fileAuthorOpts = {
|
|
40325
40560
|
storageDir: projectDir,
|
|
40326
40561
|
projectRoot
|
|
@@ -40426,7 +40661,7 @@ function setupDepWatcherConsumers(deps) {
|
|
|
40426
40661
|
if (depWatcherEnabled) {
|
|
40427
40662
|
try {
|
|
40428
40663
|
const projectDir = path33.join(globalRoot, "projects", projectSlug);
|
|
40429
|
-
const pkgMailbox =
|
|
40664
|
+
const pkgMailbox = getSharedProjectMailbox11(projectDir, events);
|
|
40430
40665
|
const pkgTrackerOpts = {
|
|
40431
40666
|
storageDir: projectDir,
|
|
40432
40667
|
projectRoot
|
|
@@ -41537,13 +41772,13 @@ async function wireCliOrchestration(cliCtx, state, boot) {
|
|
|
41537
41772
|
brain,
|
|
41538
41773
|
renderer,
|
|
41539
41774
|
reader,
|
|
41540
|
-
permissionPolicy: container.resolve(
|
|
41775
|
+
permissionPolicy: container.resolve(TOKENS17.PermissionPolicy),
|
|
41541
41776
|
contextMeta: agent.ctx.meta,
|
|
41542
41777
|
configStore
|
|
41543
41778
|
});
|
|
41544
41779
|
if (state.config.autonomy?.yoloPlus === true) setYoloPlusMode(true);
|
|
41545
41780
|
setSandboxExpansionApprover(
|
|
41546
|
-
createPolicySandboxApprover(() => container.resolve(
|
|
41781
|
+
createPolicySandboxApprover(() => container.resolve(TOKENS17.PermissionPolicy))
|
|
41547
41782
|
);
|
|
41548
41783
|
setupCliSlashCommands({
|
|
41549
41784
|
slashRegistry,
|
|
@@ -41747,13 +41982,13 @@ async function wireCliOrchestration(cliCtx, state, boot) {
|
|
|
41747
41982
|
// src/wiring/cli-execute-builder.ts
|
|
41748
41983
|
import { FLEET_ROSTER as FLEET_ROSTER5 } from "@wrongstack/core/coordination";
|
|
41749
41984
|
import { gatedEnhancerReasoning } from "@wrongstack/core/execution";
|
|
41750
|
-
import { TOKENS as
|
|
41985
|
+
import { TOKENS as TOKENS18 } from "@wrongstack/core/kernel";
|
|
41751
41986
|
|
|
41752
41987
|
// src/auth-menu/panel-service.ts
|
|
41753
|
-
import { toErrorMessage as
|
|
41988
|
+
import { toErrorMessage as toErrorMessage42 } from "@wrongstack/core/utils";
|
|
41754
41989
|
|
|
41755
41990
|
// src/auth-menu/panel-flow-bridge.ts
|
|
41756
|
-
import { toErrorMessage as
|
|
41991
|
+
import { toErrorMessage as toErrorMessage41 } from "@wrongstack/core/utils";
|
|
41757
41992
|
var ANSI_RE = /\u001b\[[0-9;]*m/g;
|
|
41758
41993
|
function stripAnsi(text) {
|
|
41759
41994
|
return text.replace(ANSI_RE, "");
|
|
@@ -41796,7 +42031,7 @@ async function runFlow(run, onSuccess) {
|
|
|
41796
42031
|
return { ok };
|
|
41797
42032
|
} catch (err) {
|
|
41798
42033
|
if (isCancel(err)) return { ok: false, message: "Cancelled." };
|
|
41799
|
-
return { ok: false, message:
|
|
42034
|
+
return { ok: false, message: toErrorMessage41(err) };
|
|
41800
42035
|
}
|
|
41801
42036
|
}
|
|
41802
42037
|
function plainMaskedKey(key) {
|
|
@@ -41976,13 +42211,13 @@ function createAuthPanelHost(deps) {
|
|
|
41976
42211
|
deps.profileConfigPath
|
|
41977
42212
|
);
|
|
41978
42213
|
} catch (err) {
|
|
41979
|
-
return
|
|
42214
|
+
return toErrorMessage42(err);
|
|
41980
42215
|
}
|
|
41981
42216
|
if (result === null && deps.onProvidersChanged) {
|
|
41982
42217
|
try {
|
|
41983
42218
|
await deps.onProvidersChanged();
|
|
41984
42219
|
} catch (err) {
|
|
41985
|
-
return `Saved, but live config reload failed: ${
|
|
42220
|
+
return `Saved, but live config reload failed: ${toErrorMessage42(err)}`;
|
|
41986
42221
|
}
|
|
41987
42222
|
}
|
|
41988
42223
|
return result;
|
|
@@ -42927,7 +43162,7 @@ async function runCliExecution(params) {
|
|
|
42927
43162
|
governanceHandle,
|
|
42928
43163
|
setConfig
|
|
42929
43164
|
} = params;
|
|
42930
|
-
const { execute } = await import("./execution-
|
|
43165
|
+
const { execute } = await import("./execution-OK34CJKJ.js");
|
|
42931
43166
|
return execute(
|
|
42932
43167
|
toExecuteDeps({
|
|
42933
43168
|
core: {
|
|
@@ -43062,11 +43297,11 @@ async function runCliExecution(params) {
|
|
|
43062
43297
|
},
|
|
43063
43298
|
agent,
|
|
43064
43299
|
setPermissionYolo: (enabled) => {
|
|
43065
|
-
container.resolve(
|
|
43300
|
+
container.resolve(TOKENS18.PermissionPolicy).setYolo?.(enabled);
|
|
43066
43301
|
agent.ctx.meta["yolo"] = enabled;
|
|
43067
43302
|
},
|
|
43068
43303
|
setLogLevel: (level) => {
|
|
43069
|
-
container.resolve(
|
|
43304
|
+
container.resolve(TOKENS18.Logger).level = level;
|
|
43070
43305
|
},
|
|
43071
43306
|
sessionBridge,
|
|
43072
43307
|
autoCompactor,
|
|
@@ -43345,4 +43580,4 @@ export {
|
|
|
43345
43580
|
CLI_VERSION,
|
|
43346
43581
|
runInteractive
|
|
43347
43582
|
};
|
|
43348
|
-
//# sourceMappingURL=cli-main-
|
|
43583
|
+
//# sourceMappingURL=cli-main-OT63I2FX.js.map
|