@wrongstack/cli 1.1.2 → 1.1.5
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-NKUEYJDZ.js} +14 -5
- package/dist/acp-leader/acp-leader-confirm.d.ts +20 -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 +17 -0
- package/dist/acp-leader/acp-leader-host.d.ts +82 -0
- package/dist/acp-leader/acp-leader-picker.d.ts +24 -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 +83 -0
- package/dist/{auth-ANOVZVHE.js → auth-2ZG5DBHS.js} +62 -66
- package/dist/auth-menu/index.d.ts +1 -2
- package/dist/boot/dispatch-webui.d.ts +16 -0
- package/dist/boot/launch-menu-arrow.d.ts +20 -0
- package/dist/boot/launch-menu-types.d.ts +36 -0
- package/dist/boot/launch-menu.d.ts +1 -57
- package/dist/boot/tui-session-resume-rollback.d.ts +31 -0
- package/dist/{boot-auto-thin-7D4OVEWA.js → boot-auto-thin-N2CIGTXE.js} +3 -3
- package/dist/{chunk-TZPKOS5G.js → chunk-2XQ6SRKG.js} +2 -2
- package/dist/chunk-3LEIFO5D.js +65 -0
- package/dist/chunk-5SGMUDP5.js +752 -0
- package/dist/{chunk-3EXRPTAU.js → chunk-5TQ65PXQ.js} +17 -17
- package/dist/{chunk-GRAGMA4B.js → chunk-7BM4LGKQ.js} +18 -18
- package/dist/{chunk-VAQXOZKP.js → chunk-AJM4EFCM.js} +139 -136
- package/dist/{chunk-C2BBH4S4.js → chunk-E3MJFAFR.js} +2 -2
- package/dist/{chunk-5TRZZHMN.js → chunk-JCZ2D3VV.js} +4 -65
- package/dist/{chunk-AWRZWPJ3.js → chunk-JFYQGMMM.js} +99 -75
- package/dist/{chunk-BIGSVBPI.js → chunk-KNYIEQAY.js} +64 -61
- package/dist/chunk-LUEO5HLZ.js +50 -0
- package/dist/chunk-LYWOV4OX.js +252 -0
- package/dist/chunk-M7FNHCE3.js +2070 -0
- package/dist/{chunk-75OLD563.js → chunk-M7PSENGF.js} +3 -1
- package/dist/{chunk-NMXQFQ26.js → chunk-MEBXWI7U.js} +5 -5
- package/dist/{chunk-RAWHRRUJ.js → chunk-MKMM5RIW.js} +209 -201
- package/dist/{chunk-3R3OADC5.js → chunk-P7MEEUGT.js} +281 -252
- package/dist/chunk-QLYPIJ7X.js +258 -0
- package/dist/chunk-RN5CFAVQ.js +292 -0
- package/dist/{chunk-WDXNBYGD.js → chunk-TDP7CZGE.js} +6 -1
- package/dist/{chunk-6VPWQ4TG.js → chunk-UROB7MK5.js} +2 -1
- package/dist/chunk-VEESMPTX.js +254 -0
- package/dist/{chunk-IJLIAPCW.js → chunk-VPSAKGLK.js} +47 -47
- package/dist/{cli-context-YIT4FEDM.js → cli-context-CQYGIWOU.js} +254 -237
- package/dist/{cli-main-JIADJ5OL.js → cli-main-VRUJNUBX.js} +2081 -1594
- package/dist/cli-main-boot.d.ts +1 -1
- package/dist/config-doctor-known-keys.d.ts +33 -0
- package/dist/config-doctor.d.ts +2 -47
- package/dist/config-history-support.d.ts +36 -0
- package/dist/config-history.d.ts +1 -1
- package/dist/{config-transfer-Y7XJMJRN.js → config-transfer-B4GOZTFC.js} +2 -2
- package/dist/{execution-BAP566QC.js → execution-IV72RUSM.js} +5354 -5258
- package/dist/execution-tui.d.ts +30 -0
- 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 +50 -0
- package/dist/fleet/host-acp.d.ts +23 -2
- package/dist/fleet/wrongforge-client.d.ts +116 -0
- package/dist/fleet/wrongforge-gateway.d.ts +20 -0
- package/dist/fleet/wrongforge-info.d.ts +32 -0
- package/dist/fleet/wrongforge-quota.d.ts +10 -0
- package/dist/fleet/wrongforge-runner.d.ts +37 -0
- package/dist/fleet/wrongforge-runtime.d.ts +10 -0
- package/dist/{hq-JD5AZVMG.js → hq-54PQYR5O.js} +311 -307
- package/dist/hq-server/sweeps.d.ts +28 -0
- package/dist/{hq-server-BI23EPM7.js → hq-server-YK7FBLL6.js} +3 -3
- package/dist/index.js +8 -5
- package/dist/mcp-22CFBX4H.js +236 -0
- package/dist/mcp-serve-project.d.ts +18 -0
- package/dist/mcp-serve.d.ts +0 -63
- package/dist/{modeldiag-HDIKG37X.js → modeldiag-5PBB777J.js} +4 -4
- package/dist/{per-subcommand-help-D6J4ZXW2.js → per-subcommand-help-MQGERD4E.js} +2 -2
- package/dist/plugin-llm-command.d.ts +9 -0
- package/dist/{plugin-usage-TYF5HY4K.js → plugin-usage-UWKYMNQU.js} +3 -3
- package/dist/{plugins-XGAXDLPT.js → plugins-VP7JQH47.js} +4 -4
- package/dist/{sdd-runtime-6MFUXWJK.js → sdd-runtime-HIJ4Z5TF.js} +2 -2
- package/dist/services/sdd/state.d.ts +2 -0
- package/dist/session-event-wiring-types.d.ts +62 -0
- package/dist/session-event-wiring.d.ts +2 -52
- package/dist/{sessions-config-SJVQXCIE.js → sessions-config-7MK742OW.js} +2 -2
- package/dist/short-circuit-flags-AGHURHMQ.js +11 -0
- package/dist/slash-commands/command-context-fleet.d.ts +187 -0
- package/dist/slash-commands/command-context-sdd-goal.d.ts +102 -0
- package/dist/slash-commands/command-context.d.ts +3 -282
- package/dist/slash-commands/project-switch-interactive.d.ts +11 -0
- package/dist/slash-commands/setmodel-helpers.d.ts +36 -0
- package/dist/subcommands/handlers/hq-token.d.ts +3 -0
- package/dist/subcommands/handlers/hq.d.ts +0 -21
- package/dist/subcommands/handlers/per-subcommand-help-operations.d.ts +8 -0
- package/dist/subcommands/handlers/tools-cli-args.d.ts +57 -0
- package/dist/subcommands/handlers/tools-cli.d.ts +5 -0
- package/dist/subcommands/handlers/tools-serve.d.ts +4 -0
- package/dist/{subcommands-VTMIZQBP.js → subcommands-OCJNO57E.js} +2 -2
- package/dist/tool-gateway-http.d.ts +30 -0
- package/dist/tool-gateway.d.ts +185 -0
- package/dist/tools-cli-44MLIUQO.js +509 -0
- package/dist/tools-serve-TRCET2M7.js +102 -0
- package/dist/{tools-skills-55QVTMSK.js → tools-skills-WDTMCE46.js} +7 -2
- package/dist/tuneup-runtime-checks.d.ts +7 -0
- package/dist/tuneup-types.d.ts +118 -0
- package/dist/tuneup.d.ts +3 -122
- package/dist/{typesafe-YBEADNAH.js → typesafe-QLSMFU7J.js} +1 -1
- package/dist/{version-help-RBZC5GZZ.js → version-help-X6CC4CFY.js} +2 -2
- package/dist/{webui-server-HIUY3RHD.js → webui-server-V2R5WQUK.js} +79 -3
- package/dist/wiring/provider-runtime-setup.d.ts +3 -1
- package/dist/wiring/session-runtime.d.ts +1 -1
- package/dist/wrongforge-gateway-UOFBK56J.js +92 -0
- package/dist/wrongforge-leader/wrongforge-leader-gateway.d.ts +9 -0
- package/dist/wrongforge-leader/wrongforge-leader-picker.d.ts +12 -0
- package/dist/wrongforge-leader/wrongforge-leader-provider.d.ts +49 -0
- package/package.json +34 -30
- package/dist/auth-menu/anthropic-oauth.d.ts +0 -43
- package/dist/chunk-XT3NAHRX.js +0 -337
- package/dist/chunk-ZNNFEKDZ.js +0 -319
- package/dist/mcp-2XWBJEQN.js +0 -464
- package/dist/short-circuit-flags-CPCT5MWB.js +0 -11
|
@@ -4,10 +4,13 @@ import {
|
|
|
4
4
|
loadCachedAcpRegistry,
|
|
5
5
|
refreshAcpRegistry,
|
|
6
6
|
setupProvider
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-M7FNHCE3.js";
|
|
8
8
|
import {
|
|
9
|
-
createHqCommandDispatcher
|
|
10
|
-
|
|
9
|
+
createHqCommandDispatcher,
|
|
10
|
+
wrongstackBridgeSetup
|
|
11
|
+
} from "./chunk-5SGMUDP5.js";
|
|
12
|
+
import "./chunk-3LEIFO5D.js";
|
|
13
|
+
import "./chunk-VEESMPTX.js";
|
|
11
14
|
import {
|
|
12
15
|
startCliHqConnection
|
|
13
16
|
} from "./chunk-76JE54WD.js";
|
|
@@ -15,6 +18,7 @@ import {
|
|
|
15
18
|
WebSocketServer
|
|
16
19
|
} from "./chunk-OZCYZYN2.js";
|
|
17
20
|
import "./chunk-UFRVTBV6.js";
|
|
21
|
+
import "./chunk-LUEO5HLZ.js";
|
|
18
22
|
import "./chunk-HKMOIIPQ.js";
|
|
19
23
|
import "./chunk-W23PY4IJ.js";
|
|
20
24
|
|
|
@@ -99,8 +103,13 @@ async function spawnACPAgent(args, deps) {
|
|
|
99
103
|
...cmd.env !== void 0 ? { env: cmd.env } : {},
|
|
100
104
|
role: subagentId,
|
|
101
105
|
task,
|
|
106
|
+
// The project, not wherever `wstack` was launched from: the bridge's
|
|
107
|
+
// servers are bound to it, and the agent must edit the same tree.
|
|
108
|
+
cwd: deps.projectRoot,
|
|
109
|
+
projectRoot: deps.projectRoot,
|
|
102
110
|
signal: ac.signal,
|
|
103
111
|
permissionPolicy: defaultPermissionPolicy,
|
|
112
|
+
sessionSetup: wrongstackBridgeSetup(subagentId, deps.projectRoot, deps.config.acp?.bridge),
|
|
104
113
|
onProgress: (event) => {
|
|
105
114
|
const line = formatProgress(event);
|
|
106
115
|
if (line) deps.renderer.writeInfo(` ${line}
|
|
@@ -1115,7 +1124,7 @@ var acpCmd = async (args, deps) => {
|
|
|
1115
1124
|
const sub = args[0];
|
|
1116
1125
|
const loginIndex = sub === "auth" ? 0 : (sub === "server" || sub === "serve") && args[1] === "auth" ? 1 : -1;
|
|
1117
1126
|
if (loginIndex >= 0) {
|
|
1118
|
-
const { authCmd } = await import("./auth-
|
|
1127
|
+
const { authCmd } = await import("./auth-2ZG5DBHS.js");
|
|
1119
1128
|
return authCmd(args.slice(loginIndex + 1), deps);
|
|
1120
1129
|
}
|
|
1121
1130
|
if (!sub || sub === "server" || sub === "serve") {
|
|
@@ -1196,4 +1205,4 @@ parallel:
|
|
|
1196
1205
|
export {
|
|
1197
1206
|
acpCmd
|
|
1198
1207
|
};
|
|
1199
|
-
//# sourceMappingURL=acp-
|
|
1208
|
+
//# sourceMappingURL=acp-NKUEYJDZ.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { EventBus } from '@wrongstack/core/kernel';
|
|
2
|
+
import type { PermissionPolicy, Tool } from '@wrongstack/core/types';
|
|
3
|
+
export declare const ACP_CONFIRM_TIMEOUT_MS = 120000;
|
|
4
|
+
export interface EventConfirmRequest {
|
|
5
|
+
events: EventBus;
|
|
6
|
+
sessionId: string | undefined;
|
|
7
|
+
tool: Tool;
|
|
8
|
+
input: unknown;
|
|
9
|
+
toolUseId: string;
|
|
10
|
+
suggestedPattern: string;
|
|
11
|
+
signal: AbortSignal;
|
|
12
|
+
/** Where an "always" or "deny" answer is remembered, as for the leader's own tools. */
|
|
13
|
+
permission?: Pick<PermissionPolicy, 'trust' | 'deny'> | undefined;
|
|
14
|
+
/** The context the policy evaluates the agent's calls in: an exact-input answer is keyed to it. */
|
|
15
|
+
context: Parameters<PermissionPolicy['evaluate']>[2];
|
|
16
|
+
timeoutMs?: number | undefined;
|
|
17
|
+
}
|
|
18
|
+
/** Resolves true when the user approved the call. */
|
|
19
|
+
export declare function confirmThroughEvents(req: EventConfirmRequest): Promise<boolean>;
|
|
20
|
+
//# sourceMappingURL=acp-leader-confirm.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The leading agent's context, as the agent reports it. WrongStack's
|
|
3
|
+
* transcript is not what the agent holds, and a turn's usage is the sum of
|
|
4
|
+
* every model call in it, so neither measures the agent's window. Its own
|
|
5
|
+
* reports do: `usage_update` (`used` / `size`, after each model call) and the
|
|
6
|
+
* result of a compaction, manual or automatic (`preTokens` / `postTokens` on
|
|
7
|
+
* Claude's "Compact conversation" call).
|
|
8
|
+
*/
|
|
9
|
+
import type { ACPCapturedToolCall } from '@wrongstack/acp';
|
|
10
|
+
import type { EventBus } from '@wrongstack/core/kernel';
|
|
11
|
+
import type { AgentContextUsage } from '@wrongstack/core/types';
|
|
12
|
+
export declare class LeaderContext {
|
|
13
|
+
private reading;
|
|
14
|
+
/** The agent's last reading. */
|
|
15
|
+
get current(): AgentContextUsage | undefined;
|
|
16
|
+
/** A `usage_update`: the context after the agent's latest model call. */
|
|
17
|
+
usage(update: {
|
|
18
|
+
used: number;
|
|
19
|
+
size: number;
|
|
20
|
+
}): AgentContextUsage;
|
|
21
|
+
/** A settled tool call; a compaction resets the context to what it kept. */
|
|
22
|
+
toolCall(call: ACPCapturedToolCall): AgentContextUsage | undefined;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Show a reading mid-turn: the agent's context grows with every tool call of
|
|
26
|
+
* a long turn, and the loop reports the fill only once the turn ends.
|
|
27
|
+
*/
|
|
28
|
+
export declare function publishLeaderContext(events: EventBus | undefined, sessionId: string | undefined, reading: AgentContextUsage, fallbackMaxContext: number): void;
|
|
29
|
+
//# sourceMappingURL=acp-leader-context.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AcpLeaderHost } from './acp-leader-host.js';
|
|
2
|
+
/** The MCP server name the agent sees (`mcp__wrongstack-fleet__<tool>`). */
|
|
3
|
+
export declare const FLEET_SERVER_NAME = "wrongstack-fleet";
|
|
4
|
+
/**
|
|
5
|
+
* The coordination tools offered, when the leader has them (a profile can
|
|
6
|
+
* disable `delegate`; then the spawn/assign/await path is what remains).
|
|
7
|
+
*/
|
|
8
|
+
export declare const FLEET_TOOLS: readonly string[];
|
|
9
|
+
/** The leader tool behind a fleet MCP tool name, if it is one. */
|
|
10
|
+
export declare function fleetToolName(mcpName: string): string | undefined;
|
|
11
|
+
export interface FleetEndpoint {
|
|
12
|
+
url: string;
|
|
13
|
+
token: string;
|
|
14
|
+
/** The tools actually offered (those the leader has). */
|
|
15
|
+
tools: string[];
|
|
16
|
+
close(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Serve the leader's fleet tools to one agent session; undefined when the
|
|
20
|
+
* leader has none of them. Its calls run on the agent of `run.sessionId` (a
|
|
21
|
+
* WebUI tab's own), and one the policy wants confirmed runs on `run.approve`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function startFleetEndpoint(host: AcpLeaderHost, run?: Parameters<AcpLeaderHost['runTool']>[2]): Promise<FleetEndpoint | undefined>;
|
|
24
|
+
/** What the leader note says about the fleet tools it was given. */
|
|
25
|
+
export declare function fleetNote(tools: readonly string[]): string;
|
|
26
|
+
//# sourceMappingURL=acp-leader-fleet.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Agent } from '@wrongstack/core/agent';
|
|
2
|
+
import type { EventBus } from '@wrongstack/core/kernel';
|
|
3
|
+
import type { Config, ConfirmAwaiter, Tool } from '@wrongstack/core/types';
|
|
4
|
+
import { type AcpLeaderHost } from './acp-leader-host.js';
|
|
5
|
+
export interface AcpLeaderHostOptions {
|
|
6
|
+
/** The leader: the agent of any session the host does not run itself. */
|
|
7
|
+
agent: Agent;
|
|
8
|
+
events: EventBus;
|
|
9
|
+
projectRoot: string;
|
|
10
|
+
stateDir?: string | undefined;
|
|
11
|
+
getConfig(): Config;
|
|
12
|
+
getTool(name: string): Tool | undefined;
|
|
13
|
+
listTools?(): Tool[];
|
|
14
|
+
confirmAwaiter?: ConfirmAwaiter | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare function createAcpLeaderHost(opts: AcpLeaderHostOptions): AcpLeaderHost;
|
|
17
|
+
//# sourceMappingURL=acp-leader-host-binding.d.ts.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host services the ACP leader provider needs but cannot get when it is built.
|
|
3
|
+
*
|
|
4
|
+
* Providers are created with the provider registry, before the agent exists;
|
|
5
|
+
* the leader provider still has to put the agent's tool calls on the agent's
|
|
6
|
+
* event bus, decide its permission requests with the leader's policy and ask
|
|
7
|
+
* through the leader's confirmation prompt. The CLI binds these once the
|
|
8
|
+
* agent is created (`bindAcpLeaderHost`); until then — or on a surface that
|
|
9
|
+
* never binds them — the provider runs the agent with the read-only default
|
|
10
|
+
* permission policy and shows no tool cards.
|
|
11
|
+
*/
|
|
12
|
+
import type { Agent } from '@wrongstack/core/agent';
|
|
13
|
+
import type { EventBus } from '@wrongstack/core/kernel';
|
|
14
|
+
import type { Config, ConfirmAwaiter, PermissionPolicy, Tool } from '@wrongstack/core/types';
|
|
15
|
+
/** The provider id an ACP agent leads under (`--provider acp --model claude-code`). */
|
|
16
|
+
export declare const ACP_LEADER_PROVIDER_ID = "acp";
|
|
17
|
+
export interface AcpLeaderHost {
|
|
18
|
+
events: EventBus;
|
|
19
|
+
projectRoot: string;
|
|
20
|
+
/** The project's state directory, where a session's agent session is remembered for resume. */
|
|
21
|
+
stateDir?: string | undefined;
|
|
22
|
+
getConfig(): Config;
|
|
23
|
+
/**
|
|
24
|
+
* The live permission policy (it can change with YOLO and trust rules) of
|
|
25
|
+
* the agent running `sessionId` — a WebUI tab's own; the leader's without one.
|
|
26
|
+
*/
|
|
27
|
+
permission(sessionId?: string): PermissionPolicy;
|
|
28
|
+
/** That agent's context, which the policy reads (files already read, the session). */
|
|
29
|
+
context(sessionId?: string): Parameters<PermissionPolicy['evaluate']>[2];
|
|
30
|
+
getTool(name: string): Tool | undefined;
|
|
31
|
+
/** Every tool the leader has (the WrongForge leader offers them over its gateway). */
|
|
32
|
+
listTools?(): Tool[];
|
|
33
|
+
/**
|
|
34
|
+
* Run one of the leader's tools as the leader would — the executor and
|
|
35
|
+
* context of the agent running `sessionId`, so permissions, hooks, events
|
|
36
|
+
* and the session all apply. Used by the fleet tools the agent reaches over
|
|
37
|
+
* MCP (`delegate` and kin). A call the policy wants confirmed runs only when
|
|
38
|
+
* `approve` says yes.
|
|
39
|
+
*/
|
|
40
|
+
runTool(name: string, input: Record<string, unknown>, run?: {
|
|
41
|
+
sessionId?: string | undefined;
|
|
42
|
+
approve?: ((tool: Tool, input: Record<string, unknown>) => Promise<boolean>) | undefined;
|
|
43
|
+
}): Promise<{
|
|
44
|
+
content: string;
|
|
45
|
+
isError: boolean;
|
|
46
|
+
}>;
|
|
47
|
+
/** The leader's confirmation prompt, when the surface has one. */
|
|
48
|
+
confirmAwaiter?: ConfirmAwaiter | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* The surface answers confirmations itself (TUI, WebUI): a question goes
|
|
51
|
+
* out as a `tool.confirm_needed` event, the leader tools' own prompt.
|
|
52
|
+
*/
|
|
53
|
+
confirmThroughEvents?: boolean | undefined;
|
|
54
|
+
}
|
|
55
|
+
/** The agent of a session, on a host that runs one agent per session (the WebUI's tabs). */
|
|
56
|
+
export type AcpLeaderSessionAgent = Pick<Agent, 'ctx' | 'permission' | 'toolExecutor' | 'perIterationOutputCapBytes'>;
|
|
57
|
+
/** Set by a host with an agent per session; without it every session uses the leader. */
|
|
58
|
+
export declare function setAcpLeaderSessionAgents(resolve: ((sessionId: string) => AcpLeaderSessionAgent | undefined) | undefined): void;
|
|
59
|
+
export declare function acpLeaderSessionAgent(sessionId: string): AcpLeaderSessionAgent | undefined;
|
|
60
|
+
export declare function bindAcpLeaderHost(host: AcpLeaderHost | undefined): void;
|
|
61
|
+
export declare function acpLeaderHost(): AcpLeaderHost | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* The surface took the prompt away (`agent.disableInteractiveConfirmation()`:
|
|
64
|
+
* the TUI and WebUI answer confirmations themselves). The stdin prompt must
|
|
65
|
+
* not be used under them: it would read the terminal Ink or the browser owns.
|
|
66
|
+
* The agent's questions are asked the way the leader's own tools ask there.
|
|
67
|
+
*/
|
|
68
|
+
export declare function confirmAcpLeaderThroughEvents(): void;
|
|
69
|
+
/** Something holding live agent sessions: an ACP leader provider. */
|
|
70
|
+
interface LeaderSessions {
|
|
71
|
+
closeAll(): Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
export declare function trackAcpLeader(leader: LeaderSessions): void;
|
|
74
|
+
/**
|
|
75
|
+
* Close every ACP leader's agent sessions, bounded by `timeoutMs`. Called on
|
|
76
|
+
* the way out: an open agent (and the MCP servers it started) otherwise holds
|
|
77
|
+
* the process until the forced exit. Imports nothing heavy — it runs on every
|
|
78
|
+
* CLI exit.
|
|
79
|
+
*/
|
|
80
|
+
export declare function closeAcpLeaderSessions(timeoutMs?: number): Promise<void>;
|
|
81
|
+
export {};
|
|
82
|
+
//# sourceMappingURL=acp-leader-host.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ProviderRegistry } from '@wrongstack/core/registry';
|
|
2
|
+
import type { Config, Provider, ProviderConfig } from '@wrongstack/core/types';
|
|
3
|
+
export interface PickableHostProvider {
|
|
4
|
+
id: string;
|
|
5
|
+
type: string;
|
|
6
|
+
refreshQuota?: () => Promise<boolean>;
|
|
7
|
+
models: Array<{
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
contextWindow?: number;
|
|
12
|
+
reasoningEffortLevels?: string[];
|
|
13
|
+
effortSupported?: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
/** The `acp` entry, or none when no ACP agent is installed. */
|
|
17
|
+
export declare function acpLeaderPickable(config: Config | undefined): PickableHostProvider[];
|
|
18
|
+
/**
|
|
19
|
+
* Build a host-registered leader (the ACP leader, WrongForge) from the host's
|
|
20
|
+
* provider registry, where its factory is registered; undefined for every
|
|
21
|
+
* other provider, which the WebUI builds as before.
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildAcpLeaderProvider(registry: Pick<ProviderRegistry, 'has' | 'create'> | undefined, providerId: string, config: ProviderConfig): Provider | undefined;
|
|
24
|
+
//# sourceMappingURL=acp-leader-picker.d.ts.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { AgentContextUsage, Capabilities, Config, Provider, ProviderFactory, Request, Response, StreamEvent } from '@wrongstack/core/types';
|
|
2
|
+
import { ACP_LEADER_PROVIDER_ID } from './acp-leader-host.js';
|
|
3
|
+
export { ACP_LEADER_PROVIDER_ID };
|
|
4
|
+
export declare function leaderSideModel(config: Config): {
|
|
5
|
+
provider: string;
|
|
6
|
+
model: string;
|
|
7
|
+
} | undefined;
|
|
8
|
+
/** A leader turn: the request's thread is its own conversation (a subagent's is not). */
|
|
9
|
+
export declare function isLeaderTurn(req: Request): boolean;
|
|
10
|
+
export interface AcpLeaderProviderOptions {
|
|
11
|
+
id?: string | undefined;
|
|
12
|
+
/** The config at boot; the bound host's live config wins once available. */
|
|
13
|
+
bootConfig: Config;
|
|
14
|
+
/** Build a WrongStack provider by id, for side requests. */
|
|
15
|
+
buildProvider(providerId: string, config: Config): Provider | undefined;
|
|
16
|
+
}
|
|
17
|
+
export declare class AcpLeaderProvider implements Provider {
|
|
18
|
+
private readonly opts;
|
|
19
|
+
readonly id: string;
|
|
20
|
+
private caps;
|
|
21
|
+
private acp;
|
|
22
|
+
private readonly sessions;
|
|
23
|
+
private readonly sideProviders;
|
|
24
|
+
/**
|
|
25
|
+
* Fleet calls the user already approved through the agent's permission
|
|
26
|
+
* request, by session, tool and input: the call that follows runs on that
|
|
27
|
+
* approval instead of asking again.
|
|
28
|
+
*/
|
|
29
|
+
private readonly fleetGrants;
|
|
30
|
+
constructor(opts: AcpLeaderProviderOptions);
|
|
31
|
+
private config;
|
|
32
|
+
/**
|
|
33
|
+
* The leading agent's capabilities. One object per agent, so a host that
|
|
34
|
+
* refines a field in place keeps it until the user picks another agent.
|
|
35
|
+
*/
|
|
36
|
+
get capabilities(): Capabilities;
|
|
37
|
+
/** The WrongStack provider and request for anything that is not a leader turn. */
|
|
38
|
+
private side;
|
|
39
|
+
complete(req: Request, opts: {
|
|
40
|
+
signal: AbortSignal;
|
|
41
|
+
}): Promise<Response>;
|
|
42
|
+
stream(req: Request, opts: {
|
|
43
|
+
signal: AbortSignal;
|
|
44
|
+
}): AsyncIterable<StreamEvent>;
|
|
45
|
+
/** The turn's prompt; an agent joining a conversation under way gets the turns before it. */
|
|
46
|
+
private promptText;
|
|
47
|
+
/**
|
|
48
|
+
* `/compact` on this route: the agent compacts its own conversation. No
|
|
49
|
+
* agent started yet means there is nothing in its context to compact.
|
|
50
|
+
*/
|
|
51
|
+
compactOwnContext(opts: {
|
|
52
|
+
sessionId: string;
|
|
53
|
+
signal: AbortSignal;
|
|
54
|
+
}): Promise<AgentContextUsage | undefined>;
|
|
55
|
+
/** The progress handler of one agent turn: text, tool cards, rate limits and context. */
|
|
56
|
+
private progress;
|
|
57
|
+
/** A context reading from the agent: its window is the route's, and the fill shows at once. */
|
|
58
|
+
private observeContext;
|
|
59
|
+
private publishContext;
|
|
60
|
+
private loadAcp;
|
|
61
|
+
private drop;
|
|
62
|
+
/** The persistent agent session for this conversation, started on first use. */
|
|
63
|
+
private sessionFor;
|
|
64
|
+
/**
|
|
65
|
+
* Ask the user about one of the agent's calls on the prompt the surface
|
|
66
|
+
* has: the REPL's own, or the TUI/WebUI approval prompt in the session's tab.
|
|
67
|
+
*/
|
|
68
|
+
private confirm;
|
|
69
|
+
/**
|
|
70
|
+
* A fleet call the policy wants confirmed: the approval the user gave the
|
|
71
|
+
* agent's permission request for it, once, or a question now (an agent
|
|
72
|
+
* whose own settings let it call the tool without asking).
|
|
73
|
+
*/
|
|
74
|
+
private approveFleetCall;
|
|
75
|
+
private ask;
|
|
76
|
+
private startSession;
|
|
77
|
+
/** Close every agent session (process shutdown). */
|
|
78
|
+
closeAll(): Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Registered with the provider registry at boot. Inert unless the leader
|
|
82
|
+
* names it (`--provider acp`, `/model acp/claude-code`).
|
|
83
|
+
*/
|
|
84
|
+
export declare function createAcpLeaderProviderFactory(opts: Omit<AcpLeaderProviderOptions, 'id'>): ProviderFactory;
|
|
85
|
+
//# sourceMappingURL=acp-leader-provider.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface LeaderSessionRecord {
|
|
2
|
+
agentId: string;
|
|
3
|
+
agentSessionId: string;
|
|
4
|
+
updatedAt: string;
|
|
5
|
+
}
|
|
6
|
+
/** The agent session that led `sessionId` with `agentId`, if one is on record. */
|
|
7
|
+
export declare function readLeaderSession(stateDir: string, sessionId: string, agentId: string): Promise<string | undefined>;
|
|
8
|
+
/** Remember that `agentSessionId` leads `sessionId`. Writes are serialized and atomic. */
|
|
9
|
+
export declare function writeLeaderSession(stateDir: string, sessionId: string, record: Omit<LeaderSessionRecord, 'updatedAt'>): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=acp-leader-resume.d.ts.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turning an ACP agent's turn into a provider stream (see
|
|
3
|
+
* acp-leader-provider.ts): a push queue the progress callback feeds and the
|
|
4
|
+
* stream drains, the text block bookkeeping, the tool calls the agent runs
|
|
5
|
+
* itself relayed to the host as tool cards, and its failures as typed
|
|
6
|
+
* ProviderErrors.
|
|
7
|
+
*/
|
|
8
|
+
import type { ACPCapturedToolCall, ACPSessionRunResult } from '@wrongstack/acp';
|
|
9
|
+
import type { EventBus } from '@wrongstack/core/kernel';
|
|
10
|
+
import type { Message, StopReason, StreamEvent, SubagentError, Usage } from '@wrongstack/core/types';
|
|
11
|
+
import { ProviderError } from '@wrongstack/core/types';
|
|
12
|
+
/** A push-to-pull bridge: the agent's progress callback pushes, the stream iterates. */
|
|
13
|
+
export declare class StreamQueue {
|
|
14
|
+
private readonly items;
|
|
15
|
+
private wake;
|
|
16
|
+
private done;
|
|
17
|
+
private failure;
|
|
18
|
+
push(event: StreamEvent): void;
|
|
19
|
+
end(): void;
|
|
20
|
+
fail(err: unknown): void;
|
|
21
|
+
drain(): AsyncGenerator<StreamEvent>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Text arrives in chunks across one or more agent messages; each run of text
|
|
25
|
+
* is one content block. Thoughts are not forwarded into the response: an
|
|
26
|
+
* unsigned thinking block in history is rejected by Anthropic's wire if the
|
|
27
|
+
* user later switches the session to a real model.
|
|
28
|
+
*/
|
|
29
|
+
export declare class TextBlocks {
|
|
30
|
+
private readonly queue;
|
|
31
|
+
private open;
|
|
32
|
+
private index;
|
|
33
|
+
constructor(queue: StreamQueue);
|
|
34
|
+
text(chunk: string): void;
|
|
35
|
+
close(): void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The agent's own tool calls as the host's tool cards: `tool.started` once a
|
|
39
|
+
* call is announced, `tool.executed` once it settles. Named by the agent's
|
|
40
|
+
* title ("Read src/a.ts", "git status"), which is what the user needs to see.
|
|
41
|
+
*/
|
|
42
|
+
export declare class ToolCardRelay {
|
|
43
|
+
private readonly events;
|
|
44
|
+
private readonly meta;
|
|
45
|
+
private readonly started;
|
|
46
|
+
private readonly settled;
|
|
47
|
+
constructor(events: EventBus | undefined, meta: {
|
|
48
|
+
sessionId?: string | undefined;
|
|
49
|
+
model: string;
|
|
50
|
+
provider?: string | undefined;
|
|
51
|
+
});
|
|
52
|
+
update(call: ACPCapturedToolCall): void;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* What the agent has not seen yet: the text of every user message since its
|
|
56
|
+
* last reply (the user's prompt plus anything WrongStack folded in after it —
|
|
57
|
+
* a [DELEGATION RESULT], a session note). The agent keeps its own history.
|
|
58
|
+
*/
|
|
59
|
+
export declare function latestUserText(messages: readonly Message[]): string;
|
|
60
|
+
/**
|
|
61
|
+
* The conversation before the agent's first turn, for an agent that joins one
|
|
62
|
+
* already under way: a `/model` switch to it, or a resumed session (a fresh
|
|
63
|
+
* agent remembers nothing). Text only, newest kept when it is long; the
|
|
64
|
+
* messages `latestUserText` sends are not repeated.
|
|
65
|
+
*/
|
|
66
|
+
export declare function earlierConversation(messages: readonly Message[], maxChars?: number): string | undefined;
|
|
67
|
+
export declare function turnUsage(result: ACPSessionRunResult): Usage;
|
|
68
|
+
export declare function turnStopReason(result: ACPSessionRunResult): StopReason;
|
|
69
|
+
/**
|
|
70
|
+
* A failed agent turn as a ProviderError the leader's loop already handles:
|
|
71
|
+
* a spent subscription quota is `quota_exhausted` (the fallback chain moves
|
|
72
|
+
* the session to a WrongStack model), a stall is a timeout, a dead agent a
|
|
73
|
+
* server error. `dead` tells the caller to start a fresh agent next turn.
|
|
74
|
+
*/
|
|
75
|
+
export declare function agentTurnError(err: unknown, agentId: string, classify: (rpc: {
|
|
76
|
+
code?: number;
|
|
77
|
+
message: string;
|
|
78
|
+
data?: unknown;
|
|
79
|
+
}, agent: string) => SubagentError | undefined): {
|
|
80
|
+
error: ProviderError;
|
|
81
|
+
dead: boolean;
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=acp-leader-stream.d.ts.map
|