@wrongstack/cli 1.0.26 → 1.0.28
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-LI665LO2.js → acp-M4565YUW.js} +30 -17
- package/dist/boot/dispatch-singleshot.d.ts +8 -0
- package/dist/boot/dispatch-webui.d.ts +2 -0
- package/dist/boot/goal-tui-default.d.ts +10 -0
- package/dist/{chunk-BEHGRNOQ.js → chunk-3ZTLPNEQ.js} +10 -10
- package/dist/chunk-7IQWQCBH.js +160 -0
- package/dist/{chunk-OAVBM55Q.js → chunk-ENRYW73H.js} +525 -379
- package/dist/{chunk-WQV2NP57.js → chunk-L5TD7UIG.js} +2 -2
- package/dist/{chunk-2EBVTYJR.js → chunk-NRXWOMK7.js} +17 -3
- package/dist/{chunk-5SEYGOCH.js → chunk-RDGGWMTI.js} +2 -2
- package/dist/{chunk-KJS5543T.js → chunk-RGFWGUAB.js} +26 -14
- package/dist/{chunk-S4FFHDJG.js → chunk-SDJCLEK6.js} +6 -2
- package/dist/{cli-context-UVGAN3NO.js → cli-context-O2SHBDFH.js} +33 -6
- package/dist/{cli-main-TN3KZ2P6.js → cli-main-BKG4ZVLN.js} +1079 -616
- package/dist/{execution-7QIP6GRY.js → execution-THXWTHYT.js} +87 -33
- package/dist/execution-chimera-review.d.ts +18 -1
- package/dist/fleet/host-memory-companion.d.ts +43 -0
- package/dist/fleet/host-subagent-factory.d.ts +1 -1
- package/dist/fleet/host.d.ts +1 -0
- package/dist/fleet/memory-companion-evidence.d.ts +12 -0
- package/dist/fleet/memory-companion-policy.d.ts +9 -0
- package/dist/goal-commands.d.ts +10 -0
- package/dist/{hq-GLZ7QESM.js → hq-44F4OQH2.js} +5 -4
- package/dist/hq-fleet-control.d.ts +36 -0
- package/dist/hq-live-status.d.ts +22 -0
- package/dist/hq-publisher.d.ts +18 -0
- package/dist/hq-server/routes/command-handlers.d.ts +12 -1
- package/dist/hq-server/routes/data-handlers.d.ts +1 -1
- package/dist/hq-server/socket-credentials.d.ts +63 -0
- package/dist/hq-server/upgrade-handler.d.ts +2 -0
- package/dist/hq-server/ws.d.ts +24 -0
- package/dist/{hq-server-YTKDVQPY.js → hq-server-UIB24LU6.js} +2 -2
- package/dist/{import-claude-code-32PCSIQI.js → import-claude-code-AYG24RG2.js} +36 -4
- package/dist/index.js +3 -3
- package/dist/live-settings-input.d.ts +1 -0
- package/dist/{mailbox-serve-NW5VZG7R.js → mailbox-serve-GNGXEQ2R.js} +2 -2
- package/dist/{modeldiag-36VODVIH.js → modeldiag-W7XAE625.js} +2 -2
- package/dist/{remote-O5WXHLWV.js → remote-GB5VXCCT.js} +38 -23
- package/dist/services/run-git.d.ts +3 -1
- package/dist/{sessions-config-SXTTLNXA.js → sessions-config-XHLXJ5C3.js} +75 -6
- package/dist/{short-circuit-flags-74Y5N6CF.js → short-circuit-flags-BSIPTAPD.js} +2 -2
- package/dist/slash-commands/theme.d.ts +15 -1
- package/dist/subcommands/handlers/import-claude-code.d.ts +10 -0
- package/dist/subcommands/handlers/sessions-fleet.d.ts +0 -12
- package/dist/{subcommands-Q6ORSB2E.js → subcommands-SRRB3RAS.js} +2 -2
- package/dist/{typesafe-U7YB2RRV.js → typesafe-WA5O3KVS.js} +10 -2
- package/dist/{webui-server-YTHLRFD2.js → webui-server-GCXIO3JY.js} +37 -30
- package/dist/webui-server-options.d.ts +10 -0
- package/dist/wiring/command-host-state.d.ts +2 -0
- package/dist/wiring/hq-telemetry.d.ts +12 -0
- package/package.json +29 -28
- package/dist/chunk-OWNC7LMD.js +0 -78
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
loadCachedAcpRegistry,
|
|
5
5
|
refreshAcpRegistry,
|
|
6
6
|
setupProvider
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RDGGWMTI.js";
|
|
8
8
|
import {
|
|
9
9
|
createHqCommandDispatcher
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NRXWOMK7.js";
|
|
11
11
|
import {
|
|
12
12
|
startCliHqConnection
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-RGFWGUAB.js";
|
|
14
|
+
import "./chunk-SDJCLEK6.js";
|
|
15
15
|
import "./chunk-F5DCFAKI.js";
|
|
16
16
|
import "./chunk-SIGUWXAA.js";
|
|
17
17
|
import "./chunk-LUMETJFO.js";
|
|
@@ -19,7 +19,7 @@ import "./chunk-DAKVBMD4.js";
|
|
|
19
19
|
|
|
20
20
|
// src/subcommands/handlers/acp.ts
|
|
21
21
|
import { randomBytes } from "node:crypto";
|
|
22
|
-
import * as
|
|
22
|
+
import * as path2 from "node:path";
|
|
23
23
|
import {
|
|
24
24
|
defaultPermissionPolicy,
|
|
25
25
|
EnsembleRegistry,
|
|
@@ -41,6 +41,7 @@ import { leaderDeliveryHub } from "@wrongstack/core/coordination";
|
|
|
41
41
|
import { WebSocketServer } from "ws";
|
|
42
42
|
|
|
43
43
|
// src/acp-hq-telemetry.ts
|
|
44
|
+
import * as path from "node:path";
|
|
44
45
|
import { AgentStatusTracker } from "@wrongstack/core/coordination";
|
|
45
46
|
import {
|
|
46
47
|
createApprovalRegistry,
|
|
@@ -60,6 +61,15 @@ function startAcpHqTelemetry(options) {
|
|
|
60
61
|
}
|
|
61
62
|
return false;
|
|
62
63
|
};
|
|
64
|
+
const resolveUserInput = (requestId, response, sessionId) => {
|
|
65
|
+
if (sessionId !== void 0) {
|
|
66
|
+
return entries.get(sessionId)?.approvals?.resolveUserInput?.(requestId, response, sessionId) ?? false;
|
|
67
|
+
}
|
|
68
|
+
for (const entry of entries.values()) {
|
|
69
|
+
if (entry.approvals?.resolveUserInput?.(requestId, response) === true) return true;
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
};
|
|
63
73
|
const connection = startCliHqConnection({
|
|
64
74
|
clientKind: "acp",
|
|
65
75
|
projectRoot: options.projectRoot,
|
|
@@ -70,11 +80,11 @@ function startAcpHqTelemetry(options) {
|
|
|
70
80
|
"mailbox.summary",
|
|
71
81
|
"fleet.summary",
|
|
72
82
|
"session.summary",
|
|
73
|
-
// Approvals are the ONLY control this host
|
|
74
|
-
// the server's gate for any command at
|
|
75
|
-
// everything except `approve`
|
|
76
|
-
//
|
|
77
|
-
// to abort.
|
|
83
|
+
// Approvals and answers to ask_user are the ONLY control this host
|
|
84
|
+
// accepts. `control.receive` is the server's gate for any command at
|
|
85
|
+
// all, so it has to be declared; everything except `approve` and
|
|
86
|
+
// `answer-input` falls through the dispatcher and is refused, because
|
|
87
|
+
// an ACP session has no mailbox to steer and no leader to abort.
|
|
78
88
|
"control.receive",
|
|
79
89
|
"control.approve"
|
|
80
90
|
],
|
|
@@ -83,7 +93,8 @@ function startAcpHqTelemetry(options) {
|
|
|
83
93
|
sessionTag: () => "acp",
|
|
84
94
|
ownsSession: (sessionId) => entries.has(sessionId),
|
|
85
95
|
allowRunCommand: () => false,
|
|
86
|
-
resolveApproval
|
|
96
|
+
resolveApproval,
|
|
97
|
+
resolveUserInput
|
|
87
98
|
})
|
|
88
99
|
});
|
|
89
100
|
const attach = (sessionId, agent, cwd) => {
|
|
@@ -103,7 +114,9 @@ function startAcpHqTelemetry(options) {
|
|
|
103
114
|
// An ACP session works in the directory the client opened, which is
|
|
104
115
|
// not necessarily where the server booted.
|
|
105
116
|
projectRoot: cwd,
|
|
106
|
-
|
|
117
|
+
// A NAME, not a path: the full root is an absolute path (it carries
|
|
118
|
+
// the OS account name) and `projectName` is not a redacted key.
|
|
119
|
+
projectName: options.projectName ?? path.basename(cwd),
|
|
107
120
|
initialAgents: tracker.getAgents(),
|
|
108
121
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
109
122
|
});
|
|
@@ -709,13 +722,13 @@ async function runACPWebSocketServer(deps, port) {
|
|
|
709
722
|
}
|
|
710
723
|
hqTelemetry = startAcpHqTelemetry({
|
|
711
724
|
projectRoot: deps.cwd ?? process.cwd(),
|
|
712
|
-
projectName:
|
|
725
|
+
projectName: path2.basename(deps.cwd ?? process.cwd()),
|
|
713
726
|
appConfig: deps.config
|
|
714
727
|
});
|
|
715
728
|
const tracked = hqTelemetry.wrapAgentFactory(agentFor);
|
|
716
729
|
wsAgentFactory = agentFor;
|
|
717
730
|
turnFactory = () => makeACPServerAgentTurn({ agentFor: tracked, pendingDeliveries: pendingLeaderDeliveries });
|
|
718
|
-
store = deps.paths?.projectDir ? new ACPSessionStore({ dir:
|
|
731
|
+
store = deps.paths?.projectDir ? new ACPSessionStore({ dir: path2.join(deps.paths.projectDir, "acp-sessions") }) : void 0;
|
|
719
732
|
}
|
|
720
733
|
const acpToken = process.env["WRONGSTACK_ACP_TOKEN"]?.trim() || randomBytes(32).toString("hex");
|
|
721
734
|
const gate = createAcpConnectionGate({ host, port, token: acpToken });
|
|
@@ -830,7 +843,7 @@ async function runACPServer(deps) {
|
|
|
830
843
|
}
|
|
831
844
|
stdioHqTelemetry = startAcpHqTelemetry({
|
|
832
845
|
projectRoot: deps.cwd ?? process.cwd(),
|
|
833
|
-
projectName:
|
|
846
|
+
projectName: path2.basename(deps.cwd ?? process.cwd()),
|
|
834
847
|
appConfig: deps.config
|
|
835
848
|
});
|
|
836
849
|
const stdioAgentFactory = agentFor;
|
|
@@ -838,7 +851,7 @@ async function runACPServer(deps) {
|
|
|
838
851
|
agentFor: stdioHqTelemetry.wrapAgentFactory(agentFor),
|
|
839
852
|
pendingDeliveries: pendingLeaderDeliveries
|
|
840
853
|
});
|
|
841
|
-
const store = deps.paths?.projectDir ? new ACPSessionStore({ dir:
|
|
854
|
+
const store = deps.paths?.projectDir ? new ACPSessionStore({ dir: path2.join(deps.paths.projectDir, "acp-sessions") }) : void 0;
|
|
842
855
|
return {
|
|
843
856
|
runTurn: turn,
|
|
844
857
|
replayFor: turn.replay,
|
|
@@ -1179,4 +1192,4 @@ ${renderAcpBenchText(result)}
|
|
|
1179
1192
|
export {
|
|
1180
1193
|
acpCmd
|
|
1181
1194
|
};
|
|
1182
|
-
//# sourceMappingURL=acp-
|
|
1195
|
+
//# sourceMappingURL=acp-M4565YUW.js.map
|
|
@@ -28,6 +28,14 @@ interface SingleShotDispatchContext {
|
|
|
28
28
|
renderer: TerminalRenderer;
|
|
29
29
|
/** Host event bus; required for `--max-budget-usd` to see spend as it lands. */
|
|
30
30
|
events?: Pick<EventBus, 'on'> | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The host's interrupt seam. HQ's "abort leader" and every other remote stop
|
|
33
|
+
* call `abortLeader()`; a one-shot turn has no TUI to rebind it, so this run
|
|
34
|
+
* binds it to its own controller for the duration of the turn.
|
|
35
|
+
*/
|
|
36
|
+
interruptController?: {
|
|
37
|
+
abortLeader: () => boolean;
|
|
38
|
+
} | undefined;
|
|
31
39
|
}
|
|
32
40
|
/**
|
|
33
41
|
* Run a single `agent.run()` turn and render the result.
|
|
@@ -110,6 +110,8 @@ export interface WebUIDispatchContext {
|
|
|
110
110
|
/** Live fleet budget for WebUI concurrency/spawn gauges (issue #323). */
|
|
111
111
|
getFleetBudget?: CliWebUIOptions['getFleetBudget'];
|
|
112
112
|
stopSessionFleet?: CliWebUIOptions['stopSessionFleet'];
|
|
113
|
+
interruptController?: CliWebUIOptions['interruptController'];
|
|
114
|
+
hqFleetControl?: CliWebUIOptions['hqFleetControl'];
|
|
113
115
|
onSessionRetired?: CliWebUIOptions['onSessionRetired'];
|
|
114
116
|
/** The process's single background-delegation auto-wake controller. */
|
|
115
117
|
leaderAutoWake?: CliWebUIOptions['leaderAutoWake'];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `--goal` / `--ask` without a prompt run in the TUI (`--no-tui` still wins).
|
|
3
|
+
*
|
|
4
|
+
* Decided in `boot`, before the composition root reads `flags.tui`: this used
|
|
5
|
+
* to happen in execution.ts, after cli-main had already derived screen
|
|
6
|
+
* ownership and the HQ client kind from it — a goal run painted the TUI but
|
|
7
|
+
* announced itself to HQ as `cli`, with non-TUI stderr behaviour.
|
|
8
|
+
*/
|
|
9
|
+
export declare function applyGoalTuiDefault(flags: Record<string, string | boolean>, positional: readonly string[]): void;
|
|
10
|
+
//# sourceMappingURL=goal-tui-default.d.ts.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
// src/subcommands/index.ts
|
|
3
3
|
var loaders = {
|
|
4
|
-
acp: async () => (await import("./acp-
|
|
4
|
+
acp: async () => (await import("./acp-M4565YUW.js")).acpCmd,
|
|
5
5
|
init: async () => (await import("./init-DRMMFG2G.js")).initCmd,
|
|
6
6
|
auth: async () => (await import("./auth-TE55JF4Z.js")).authCmd,
|
|
7
7
|
update: async () => (await import("./update-TDZX4IL2.js")).updateCmd,
|
|
8
|
-
remote: async () => (await import("./remote-
|
|
9
|
-
sessions: async () => (await import("./sessions-config-
|
|
10
|
-
config: async () => (await import("./sessions-config-
|
|
8
|
+
remote: async () => (await import("./remote-GB5VXCCT.js")).remoteCmd,
|
|
9
|
+
sessions: async () => (await import("./sessions-config-XHLXJ5C3.js")).sessionsCmd,
|
|
10
|
+
config: async () => (await import("./sessions-config-XHLXJ5C3.js")).configCmd,
|
|
11
11
|
"config-export": async () => (await import("./config-transfer-RUWLDCNK.js")).configExportCmd,
|
|
12
12
|
"config-import": async () => (await import("./config-transfer-RUWLDCNK.js")).configImportCmd,
|
|
13
13
|
rewind: async () => (await import("./rewind-JA3ZLCNM.js")).rewindCmd,
|
|
@@ -16,7 +16,7 @@ var loaders = {
|
|
|
16
16
|
tools: async () => (await import("./tools-skills-GH24UCBY.js")).toolsCmd,
|
|
17
17
|
skills: async () => (await import("./tools-skills-GH24UCBY.js")).skillsCmd,
|
|
18
18
|
"skill-suggest": async () => (await import("./skill-suggest-L2EVWB6R.js")).skillSuggestCmd,
|
|
19
|
-
typesafe: async () => (await import("./typesafe-
|
|
19
|
+
typesafe: async () => (await import("./typesafe-WA5O3KVS.js")).typesafeCmd,
|
|
20
20
|
providers: async () => (await import("./providers-models-5Z2PJTEW.js")).providersCmd,
|
|
21
21
|
models: async () => (await import("./providers-models-5Z2PJTEW.js")).modelsCmd,
|
|
22
22
|
mcp: async () => (await import("./mcp-LBS45HWZ.js")).mcpCmd,
|
|
@@ -30,16 +30,16 @@ var loaders = {
|
|
|
30
30
|
version: async () => (await import("./version-help-XJJQ7YSH.js")).versionCmd,
|
|
31
31
|
help: async () => (await import("./version-help-XJJQ7YSH.js")).helpCmd,
|
|
32
32
|
projects: async () => (await import("./projects-T4CZCA25.js")).projectsCmd,
|
|
33
|
-
modeldiag: async () => (await import("./modeldiag-
|
|
33
|
+
modeldiag: async () => (await import("./modeldiag-W7XAE625.js")).modeldiagCmd,
|
|
34
34
|
quick: async () => (await import("./quick-CNB4Z3HS.js")).quickCmd,
|
|
35
35
|
bench: async () => (await import("./bench-GTLPM22B.js")).benchCmd,
|
|
36
36
|
chronicle: async () => (await import("./chronicle-UTFETHP6.js")).chronicleCmd,
|
|
37
|
-
hq: async () => (await import("./hq-
|
|
38
|
-
mailbox: async () => (await import("./mailbox-serve-
|
|
37
|
+
hq: async () => (await import("./hq-44F4OQH2.js")).hqCmd,
|
|
38
|
+
mailbox: async () => (await import("./mailbox-serve-GNGXEQ2R.js")).mailboxServeCmd,
|
|
39
39
|
permissions: async () => (await import("./permissions-PL27UHYD.js")).permissionsCmd,
|
|
40
40
|
project: async () => (await import("./project-AOQI5XTK.js")).projectCmd,
|
|
41
41
|
governance: async () => (await import("./governance-RYSHV675.js")).governanceCmd,
|
|
42
|
-
"import-claude-code": async () => (await import("./import-claude-code-
|
|
42
|
+
"import-claude-code": async () => (await import("./import-claude-code-AYG24RG2.js")).importClaudeCodeCmd
|
|
43
43
|
};
|
|
44
44
|
var subcommands = Object.fromEntries(
|
|
45
45
|
Object.entries(loaders).map(
|
|
@@ -55,4 +55,4 @@ export {
|
|
|
55
55
|
subcommands,
|
|
56
56
|
subcommandNames
|
|
57
57
|
};
|
|
58
|
-
//# sourceMappingURL=chunk-
|
|
58
|
+
//# sourceMappingURL=chunk-3ZTLPNEQ.js.map
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
|
|
2
|
+
// src/boot/execution-mode.ts
|
|
3
|
+
function resolveExecutionMode(positional, flags) {
|
|
4
|
+
const prompt = typeof flags["prompt"] === "string" ? flags["prompt"] : "";
|
|
5
|
+
if (positional.length > 0 || prompt.length > 0) return "single-shot";
|
|
6
|
+
if (flags.tui && flags["no-tui"] !== true && !flags.webui && !flags["webui-session-child"])
|
|
7
|
+
return "tui";
|
|
8
|
+
if (flags.webui || flags["webui-session-child"]) return "webui";
|
|
9
|
+
return "repl";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// src/hq-fleet-control.ts
|
|
13
|
+
import {
|
|
14
|
+
areSubagentsAllowedForSession,
|
|
15
|
+
FLEET_ROSTER
|
|
16
|
+
} from "@wrongstack/core/coordination";
|
|
17
|
+
import { AgentError } from "@wrongstack/core/types";
|
|
18
|
+
async function killHqSessionFleet(director, sessionId, scope) {
|
|
19
|
+
if (!director) return 0;
|
|
20
|
+
const owned = sessionId ? director.subagentIdsForSession(sessionId) : [];
|
|
21
|
+
if (owned.length > 0 && sessionId) {
|
|
22
|
+
await director.terminateSession(sessionId);
|
|
23
|
+
return owned.length;
|
|
24
|
+
}
|
|
25
|
+
if (scope.multiConversation) return 0;
|
|
26
|
+
let killed = 0;
|
|
27
|
+
for (const subagent of director.status().subagents) {
|
|
28
|
+
if (subagent.status === "running" || subagent.status === "idle") {
|
|
29
|
+
try {
|
|
30
|
+
await director.remove(subagent.id);
|
|
31
|
+
killed++;
|
|
32
|
+
} catch {
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return killed;
|
|
37
|
+
}
|
|
38
|
+
async function terminateHqAgent(director, subagentId) {
|
|
39
|
+
if (!director) return false;
|
|
40
|
+
try {
|
|
41
|
+
await director.terminate(subagentId);
|
|
42
|
+
return true;
|
|
43
|
+
} catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function spawnHqAgent(director, sessionId, role, task, maxIterations) {
|
|
48
|
+
if (!director) {
|
|
49
|
+
throw new AgentError({
|
|
50
|
+
message: "Director is not available.",
|
|
51
|
+
code: "AGENT_RUN_FAILED",
|
|
52
|
+
context: { phase: "hq-spawn", role }
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (!areSubagentsAllowedForSession(sessionId)) {
|
|
56
|
+
throw new Error("Subagents are disabled for this session.");
|
|
57
|
+
}
|
|
58
|
+
const base = FLEET_ROSTER[role] ?? {
|
|
59
|
+
id: `manual-${Date.now()}`,
|
|
60
|
+
name: role,
|
|
61
|
+
maxIterations: maxIterations ?? 0,
|
|
62
|
+
maxToolCalls: 200
|
|
63
|
+
};
|
|
64
|
+
const overrides = maxIterations !== void 0 ? { maxIterations } : {};
|
|
65
|
+
const config = task !== void 0 ? { ...base, ...overrides, task } : { ...base, ...overrides };
|
|
66
|
+
return director.spawn({ ...config, originSessionId: sessionId });
|
|
67
|
+
}
|
|
68
|
+
function createHqFleetControl(getDirector, defaultSessionId, scope) {
|
|
69
|
+
return {
|
|
70
|
+
killFleet: (sessionId) => killHqSessionFleet(getDirector(), sessionId ?? defaultSessionId(), scope),
|
|
71
|
+
terminateAgent: (subagentId) => terminateHqAgent(getDirector(), subagentId),
|
|
72
|
+
spawnAgent: (role, task, maxIterations, sessionId) => spawnHqAgent(getDirector(), sessionId ?? defaultSessionId(), role, task, maxIterations)
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// src/services/suggestion-store.ts
|
|
77
|
+
var sharedSuggestions = [];
|
|
78
|
+
var sharedAutoSuggestions = [];
|
|
79
|
+
function setSuggestions(suggestions) {
|
|
80
|
+
sharedSuggestions = suggestions;
|
|
81
|
+
}
|
|
82
|
+
function setAutoSuggestions(suggestions) {
|
|
83
|
+
sharedAutoSuggestions = suggestions;
|
|
84
|
+
}
|
|
85
|
+
function getSuggestions() {
|
|
86
|
+
return sharedSuggestions;
|
|
87
|
+
}
|
|
88
|
+
function removeSuggestions(indices) {
|
|
89
|
+
if (indices.length === 0) return;
|
|
90
|
+
const set = new Set(indices);
|
|
91
|
+
sharedSuggestions = sharedSuggestions.filter((_, i) => !set.has(i));
|
|
92
|
+
sharedAutoSuggestions = [];
|
|
93
|
+
}
|
|
94
|
+
function clearSuggestions() {
|
|
95
|
+
sharedSuggestions = [];
|
|
96
|
+
sharedAutoSuggestions = [];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// src/tui-thinking-word.ts
|
|
100
|
+
var DEFAULT_TUI_THINKING_WORD = "thinking";
|
|
101
|
+
var MAX_TUI_THINKING_WORD_LENGTH = 16;
|
|
102
|
+
function normalizeTuiThinkingWord(value) {
|
|
103
|
+
if (typeof value !== "string") return DEFAULT_TUI_THINKING_WORD;
|
|
104
|
+
const word = value.trim();
|
|
105
|
+
if (word.length === 0 || word.length > MAX_TUI_THINKING_WORD_LENGTH) {
|
|
106
|
+
return DEFAULT_TUI_THINKING_WORD;
|
|
107
|
+
}
|
|
108
|
+
if (!/^[\p{L}\p{N}_-]+$/u.test(word)) return DEFAULT_TUI_THINKING_WORD;
|
|
109
|
+
return word;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// src/services/run-git.ts
|
|
113
|
+
import { spawn } from "node:child_process";
|
|
114
|
+
import { toErrorMessage } from "@wrongstack/core/utils";
|
|
115
|
+
async function runGit(args, cwd, env) {
|
|
116
|
+
try {
|
|
117
|
+
return await new Promise((resolve, reject) => {
|
|
118
|
+
const child = spawn("git", args, {
|
|
119
|
+
cwd,
|
|
120
|
+
...env ? { env: { ...process.env, ...env } } : {},
|
|
121
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
122
|
+
signal: AbortSignal.timeout(3e4),
|
|
123
|
+
windowsHide: true
|
|
124
|
+
});
|
|
125
|
+
let stdout = "";
|
|
126
|
+
let stderr = "";
|
|
127
|
+
child.stdout?.setEncoding("utf8");
|
|
128
|
+
child.stderr?.setEncoding("utf8");
|
|
129
|
+
child.stdout?.on("data", (d) => {
|
|
130
|
+
stdout += d;
|
|
131
|
+
});
|
|
132
|
+
child.stderr?.on("data", (d) => {
|
|
133
|
+
stderr += d;
|
|
134
|
+
});
|
|
135
|
+
child.on("error", (err) => {
|
|
136
|
+
reject(new Error(`Failed to run git: ${err.message}`));
|
|
137
|
+
});
|
|
138
|
+
child.on("close", (code) => resolve({ stdout, stderr, code: code ?? 1 }));
|
|
139
|
+
});
|
|
140
|
+
} catch (err) {
|
|
141
|
+
throw new Error(toErrorMessage(err));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export {
|
|
146
|
+
resolveExecutionMode,
|
|
147
|
+
setSuggestions,
|
|
148
|
+
setAutoSuggestions,
|
|
149
|
+
getSuggestions,
|
|
150
|
+
removeSuggestions,
|
|
151
|
+
clearSuggestions,
|
|
152
|
+
killHqSessionFleet,
|
|
153
|
+
terminateHqAgent,
|
|
154
|
+
spawnHqAgent,
|
|
155
|
+
createHqFleetControl,
|
|
156
|
+
MAX_TUI_THINKING_WORD_LENGTH,
|
|
157
|
+
normalizeTuiThinkingWord,
|
|
158
|
+
runGit
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=chunk-7IQWQCBH.js.map
|