@wrongstack/acp 0.284.1 → 0.286.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.d.ts +13 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/{wrongstack-acp-agent-nzrqmJnc.d.ts → agent/protocol-handler.d.ts} +26 -75
- package/dist/agent/protocol-handler.d.ts.map +1 -0
- package/dist/{server-agent-turn-C3U0lhA-.d.ts → agent/server-agent-turn.d.ts} +8 -63
- package/dist/agent/server-agent-turn.d.ts.map +1 -0
- package/dist/agent/session-store.d.ts +53 -0
- package/dist/agent/session-store.d.ts.map +1 -0
- package/dist/agent/stdio-transport.d.ts +82 -0
- package/dist/agent/stdio-transport.d.ts.map +1 -0
- package/dist/{tools-registry-D2xdbzN7.d.ts → agent/tools-registry.d.ts} +4 -7
- package/dist/agent/tools-registry.d.ts.map +1 -0
- package/dist/agent/wrongstack-acp-agent.d.ts +58 -0
- package/dist/agent/wrongstack-acp-agent.d.ts.map +1 -0
- package/dist/agent/ws-bridge-transport.d.ts +37 -0
- package/dist/agent/ws-bridge-transport.d.ts.map +1 -0
- package/dist/agent.d.ts +1 -45
- package/dist/agent.js +21 -11
- package/dist/agent.js.map +7 -1
- package/dist/client/acp-session.d.ts +349 -0
- package/dist/client/acp-session.d.ts.map +1 -0
- package/dist/client/file-server.d.ts +44 -0
- package/dist/client/file-server.d.ts.map +1 -0
- package/dist/client/index.d.ts +12 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/permission.d.ts +45 -0
- package/dist/client/permission.d.ts.map +1 -0
- package/dist/client/terminal-server.d.ts +54 -0
- package/dist/client/terminal-server.d.ts.map +1 -0
- package/dist/{index-DEEYyEpu.d.ts → client/tool-translator.d.ts} +17 -8
- package/dist/client/tool-translator.d.ts.map +1 -0
- package/dist/client/websocket-transport.d.ts +40 -0
- package/dist/client/websocket-transport.d.ts.map +1 -0
- package/dist/client.d.ts +1 -5
- package/dist/client.js +36 -17
- package/dist/client.js.map +7 -1
- package/dist/index.d.ts +43 -457
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +126 -67
- package/dist/index.js.map +7 -1
- package/dist/integration/acp-bench.d.ts +68 -0
- package/dist/integration/acp-bench.d.ts.map +1 -0
- package/dist/integration/acp-subagent-runner.d.ts +194 -0
- package/dist/integration/acp-subagent-runner.d.ts.map +1 -0
- package/dist/integration/ensemble-runner.d.ts +147 -0
- package/dist/integration/ensemble-runner.d.ts.map +1 -0
- package/dist/integration/run-one-acp-task.d.ts +29 -0
- package/dist/integration/run-one-acp-task.d.ts.map +1 -0
- package/dist/registry/acp-registry-fetch.d.ts +86 -0
- package/dist/registry/acp-registry-fetch.d.ts.map +1 -0
- package/dist/registry/agents.catalog.d.ts +46 -0
- package/dist/registry/agents.catalog.d.ts.map +1 -0
- package/dist/registry/ensemble-registry.d.ts +104 -0
- package/dist/registry/ensemble-registry.d.ts.map +1 -0
- package/dist/sdk.d.ts +41 -12
- package/dist/sdk.d.ts.map +1 -0
- package/dist/sdk.js +142 -72
- package/dist/sdk.js.map +7 -1
- package/dist/types/acp-messages.d.ts +133 -0
- package/dist/types/acp-messages.d.ts.map +1 -0
- package/dist/types/acp-v1.d.ts +476 -0
- package/dist/types/acp-v1.d.ts.map +1 -0
- package/dist/win32-cmd.d.ts +7 -0
- package/dist/win32-cmd.d.ts.map +1 -0
- package/dist/wrongstack-acp-agent.d.ts +1 -3
- package/dist/wrongstack-acp-agent.js +11 -9
- package/dist/wrongstack-acp-agent.js.map +7 -1
- package/package.json +4 -4
- package/dist/acp-subagent-runner-BAlo23L-.d.ts +0 -644
- package/dist/acp-v1-BxskPsdo.d.ts +0 -520
- package/dist/terminal-server-P9KpMZTT.d.ts +0 -99
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/** Vendor classification — used to filter the catalog by family. */
|
|
2
|
+
export type ACPAgentVendor = 'anthropic' | 'google' | 'openai' | 'github' | 'community';
|
|
3
|
+
/** How the agent is integrated into ACP. */
|
|
4
|
+
export type ACPIntegration =
|
|
5
|
+
/** Agent ships with a documented ACP entry flag. */
|
|
6
|
+
'native'
|
|
7
|
+
/** Runs through Zed's SDK adapter or similar wrapper. */
|
|
8
|
+
| 'adapter'
|
|
9
|
+
/** Community-maintained wrapper (e.g. @agentify/cline, bub-acp-server). */
|
|
10
|
+
| 'community'
|
|
11
|
+
/** Listed by ACP but no public ACP entry yet; may not work. */
|
|
12
|
+
| 'experimental';
|
|
13
|
+
/** Static metadata for a known agent. */
|
|
14
|
+
export interface ACPAgentDescriptor {
|
|
15
|
+
/** Stable identifier used as the spawn key. Lowercase, hyphenated. */
|
|
16
|
+
id: string;
|
|
17
|
+
/** Display name shown in the TUI / WebUI / CLI. */
|
|
18
|
+
displayName: string;
|
|
19
|
+
vendor: ACPAgentVendor;
|
|
20
|
+
/** argv to detect installation. Exits 0 with stdout on success. */
|
|
21
|
+
probe: {
|
|
22
|
+
command: string;
|
|
23
|
+
args?: readonly string[];
|
|
24
|
+
};
|
|
25
|
+
/** argv to start the agent in ACP mode. */
|
|
26
|
+
acp: {
|
|
27
|
+
command: string;
|
|
28
|
+
args?: readonly string[];
|
|
29
|
+
env?: Record<string, string>;
|
|
30
|
+
};
|
|
31
|
+
/** Capability hints — used to fail fast when the binary predates ACP. */
|
|
32
|
+
supports: {
|
|
33
|
+
loadSession: boolean;
|
|
34
|
+
promptImages: boolean;
|
|
35
|
+
terminal: boolean;
|
|
36
|
+
fs: boolean;
|
|
37
|
+
};
|
|
38
|
+
integration: ACPIntegration;
|
|
39
|
+
/** Documentation URL — shown in `wstack acp list` and the ensemble UI. */
|
|
40
|
+
docs: string;
|
|
41
|
+
}
|
|
42
|
+
/** A descriptor with its runtime detection result attached. */
|
|
43
|
+
export interface DetectedAgent extends ACPAgentDescriptor {
|
|
44
|
+
installed: boolean;
|
|
45
|
+
/** Absolute path to the binary, if discovered. */
|
|
46
|
+
path?: string;
|
|
47
|
+
/** Captured version string, if `probe` produced one. */
|
|
48
|
+
version?: string;
|
|
49
|
+
/**
|
|
50
|
+
* When `installed: false`, a short reason — typically "binary not
|
|
51
|
+
* found", "binary predates ACP", or "probe timed out".
|
|
52
|
+
*/
|
|
53
|
+
reason?: string;
|
|
54
|
+
}
|
|
55
|
+
/** A single probe failure — never thrown, always returned. */
|
|
56
|
+
interface ProbeFailure {
|
|
57
|
+
ok: false;
|
|
58
|
+
reason: string;
|
|
59
|
+
/** Wall-clock duration of the failed probe in ms. */
|
|
60
|
+
durationMs: number;
|
|
61
|
+
}
|
|
62
|
+
interface ProbeSuccess {
|
|
63
|
+
ok: true;
|
|
64
|
+
version: string;
|
|
65
|
+
path?: string;
|
|
66
|
+
durationMs: number;
|
|
67
|
+
}
|
|
68
|
+
type ProbeResult = ProbeSuccess | ProbeFailure;
|
|
69
|
+
export interface EnsembleRegistryOptions {
|
|
70
|
+
/** Override the catalog (mostly for tests). */
|
|
71
|
+
catalog?: readonly ACPAgentDescriptor[];
|
|
72
|
+
/** Override the probe timeout (ms). */
|
|
73
|
+
probeTimeoutMs?: number;
|
|
74
|
+
/** Inject a custom probe function (used by tests). */
|
|
75
|
+
probeFn?: (descriptor: ACPAgentDescriptor) => Promise<ProbeResult>;
|
|
76
|
+
}
|
|
77
|
+
export declare class EnsembleRegistry {
|
|
78
|
+
private readonly catalog;
|
|
79
|
+
private readonly timeoutMs;
|
|
80
|
+
private readonly probe;
|
|
81
|
+
private cache;
|
|
82
|
+
constructor(options?: EnsembleRegistryOptions);
|
|
83
|
+
/** Return the full catalog (no probe), in catalog order. */
|
|
84
|
+
listAll(): readonly ACPAgentDescriptor[];
|
|
85
|
+
/**
|
|
86
|
+
* Probe every catalog entry in parallel and return the detection
|
|
87
|
+
* results. Results are cached for `PROBE_CACHE_MS`.
|
|
88
|
+
*
|
|
89
|
+
* Probes are dispatched with bounded concurrency (`MAX_PARALLEL_PROBES`)
|
|
90
|
+
* so cold-start lists do not spawn `catalog.length` subprocesses at
|
|
91
|
+
* once — which is especially wasteful on Windows shells and on hosts
|
|
92
|
+
* with large agent catalogs. The output order still matches
|
|
93
|
+
* `this.catalog` so callers can index by position.
|
|
94
|
+
*/
|
|
95
|
+
list(): Promise<readonly DetectedAgent[]>;
|
|
96
|
+
/** Probe a single descriptor. Always returns a `DetectedAgent`. */
|
|
97
|
+
detect(desc: ACPAgentDescriptor): Promise<DetectedAgent>;
|
|
98
|
+
/** Invalidate the per-process cache. */
|
|
99
|
+
invalidate(): void;
|
|
100
|
+
/** Convenience: just the installed agents. */
|
|
101
|
+
listInstalled(): Promise<readonly DetectedAgent[]>;
|
|
102
|
+
}
|
|
103
|
+
export {};
|
|
104
|
+
//# sourceMappingURL=ensemble-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensemble-registry.d.ts","sourceRoot":"","sources":["../../src/registry/ensemble-registry.ts"],"names":[],"mappings":"AAoBA,oEAAoE;AACpE,MAAM,MAAM,cAAc,GACtB,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,WAAW,CAAC;AAEhB,4CAA4C;AAC5C,MAAM,MAAM,cAAc;AACxB,oDAAoD;AAClD,QAAQ;AACV,yDAAyD;GACvD,SAAS;AACX,2EAA2E;GACzE,WAAW;AACb,+DAA+D;GAC7D,cAAc,CAAC;AAEnB,yCAAyC;AACzC,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,EAAE,EAAE,MAAM,CAAC;IACX,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,cAAc,CAAC;IACvB,mEAAmE;IACnE,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC;IACrD,2CAA2C;IAC3C,GAAG,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,GAAG,CAAC,EAAE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CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkD;IACxE,OAAO,CAAC,KAAK,CAAiE;IAE9E,YAAY,OAAO,GAAE,uBAA4B,EAIhD;IAED,4DAA4D;IAC5D,OAAO,IAAI,SAAS,kBAAkB,EAAE,CAEvC;IAED;;;;;;;;;OASG;IACG,IAAI,IAAI,OAAO,CAAC,SAAS,aAAa,EAAE,CAAC,CAW9C;IAED,mEAAmE;IAC7D,MAAM,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC,CAY7D;IAED,wCAAwC;IACxC,UAAU,IAAI,IAAI,CAEjB;IAED,8CAA8C;IACxC,aAAa,IAAI,OAAO,CAAC,SAAS,aAAa,EAAE,CAAC,CAGvD;CACF"}
|
package/dist/sdk.d.ts
CHANGED
|
@@ -1,12 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Official ACP TypeScript SDK integration for WrongStack.
|
|
3
|
+
*
|
|
4
|
+
* This module re-exports types and utilities from @agentclientprotocol/sdk
|
|
5
|
+
* alongside WrongStack's own ACP implementation, providing 100% ACP v1
|
|
6
|
+
* type coverage.
|
|
7
|
+
*
|
|
8
|
+
* Import from here when you need the full ACP type surface:
|
|
9
|
+
* import { ACPSession, AcpServer, schema, ... } from '@wrongstack/acp/sdk';
|
|
10
|
+
*/
|
|
11
|
+
export { AGENT_METHODS, CLIENT_METHODS, PROTOCOL_METHODS, PROTOCOL_VERSION, } from '@agentclientprotocol/sdk';
|
|
12
|
+
export { AgentApp, ClientApp, ActiveSession, SessionBuilder, methods, } from '@agentclientprotocol/sdk';
|
|
13
|
+
export type { AgentContext, AgentConnection, ClientContext, ClientConnection, AcpConnection, } from '@agentclientprotocol/sdk';
|
|
14
|
+
export { AcpServer, } from '@agentclientprotocol/sdk/experimental/server';
|
|
15
|
+
export { createWebSocketStream, } from '@agentclientprotocol/sdk/experimental/ws-client';
|
|
16
|
+
export type { WebSocketStreamOptions, } from '@agentclientprotocol/sdk/experimental/ws-client';
|
|
17
|
+
export { createNodeHttpHandler, createNodeWebSocketUpgradeHandler, } from '@agentclientprotocol/sdk/experimental/node';
|
|
18
|
+
import type schema from '@agentclientprotocol/sdk/schema/schema.json';
|
|
19
|
+
export type { schema };
|
|
20
|
+
export { ACPSession, ACPSessionError, textContent, imageContent, audioContent, } from './client/acp-session.js';
|
|
21
|
+
export type { ACPSessionOptions, ACPSessionRunResult, ACPSessionErrorKind, ACPProgressEvent, ACPProgressHandler, ACPCapturedToolCall, ACPCapturedDiff, } from './client/acp-session.js';
|
|
22
|
+
export { WebSocketClientTransport } from './client/websocket-transport.js';
|
|
23
|
+
export type { WebSocketClientTransportOptions } from './client/websocket-transport.js';
|
|
24
|
+
export type { ACPClientTransport } from './agent/stdio-transport.js';
|
|
25
|
+
export { ACPProtocolHandler, WRONGSTACK_VERSION, } from './agent/protocol-handler.js';
|
|
26
|
+
export type { RunTurn, RunTurnResult, RunTurnInput, SessionState, SessionMode, SessionConfigOption, ProtocolHandlerOptions, } from './agent/protocol-handler.js';
|
|
27
|
+
export { WrongStackACPServer, } from './agent/wrongstack-acp-agent.js';
|
|
28
|
+
export type { WrongStackACPServerOptions, } from './agent/wrongstack-acp-agent.js';
|
|
29
|
+
export { makeACPServerAgentTurn, disposeACPServerAgentTurn, } from './agent/server-agent-turn.js';
|
|
30
|
+
export type { ACPServerAgentTurnOptions, } from './agent/server-agent-turn.js';
|
|
31
|
+
export { ACPSessionStore, } from './agent/session-store.js';
|
|
32
|
+
export type { SessionStoreOptions, } from './agent/session-store.js';
|
|
33
|
+
export { FileServer, FsError, } from './client/file-server.js';
|
|
34
|
+
export type { FileServerOptions, ReadFileParams, WriteFileParams, FsErrorCode, } from './client/file-server.js';
|
|
35
|
+
export { TerminalServer, } from './client/terminal-server.js';
|
|
36
|
+
export type { TerminalServerOptions, } from './client/terminal-server.js';
|
|
37
|
+
export { defaultPermissionPolicy, readOnlyPermissionPolicy, makePermissionPolicy, } from './client/permission.js';
|
|
38
|
+
export type { PermissionPolicy, PermissionRequest, } from './client/permission.js';
|
|
39
|
+
export { makeACPSubagentRunner, makeACPSubagentRunnerWithStop, ACP_AGENT_COMMANDS, resolveAcpAgentCommand, runOneAcpTask, probeAcpAgent, } from './integration/acp-subagent-runner.js';
|
|
40
|
+
export type { ACPSubagentRunnerOptions, AcpAgentCommandOverrides, RunOneAcpTaskOptions, RunOneAcpTaskResult, AcpProbeResult, } from './integration/acp-subagent-runner.js';
|
|
41
|
+
//# sourceMappingURL=sdk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EACL,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,QAAQ,EACR,SAAS,EACT,aAAa,EACb,cAAc,EACd,OAAO,GACR,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,YAAY,EACZ,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,aAAa,GACd,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,SAAS,GACV,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EACL,qBAAqB,GACtB,MAAM,iDAAiD,CAAC;AAEzD,YAAY,EACV,sBAAsB,GACvB,MAAM,iDAAiD,CAAC;AAEzD,OAAO,EACL,qBAAqB,EACrB,iCAAiC,GAClC,MAAM,4CAA4C,CAAC;AAIpD,OAAO,KAAK,MAAM,MAAM,6CAA6C,CAAC;AACtE,YAAY,EAAE,MAAM,EAAE,CAAC;AAGvB,OAAO,EACL,UAAU,EACV,eAAe,EACf,WAAW,EACX,YAAY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BAAwB,CAAC;AAEhC,OAAO,EACL,qBAAqB,EACrB,6BAA6B,EAC7B,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,aAAa,GACd,MAAM,sCAAsC,CAAC;AAC9C,YAAY,EACV,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,GACf,MAAM,sCAAsC,CAAC"}
|
package/dist/sdk.js
CHANGED
|
@@ -1,16 +1,30 @@
|
|
|
1
|
-
export { AGENT_METHODS, ActiveSession, AgentApp, CLIENT_METHODS, ClientApp, PROTOCOL_METHODS, PROTOCOL_VERSION, SessionBuilder, methods } from '@agentclientprotocol/sdk';
|
|
2
|
-
export { AcpServer } from '@agentclientprotocol/sdk/experimental/server';
|
|
3
|
-
export { createWebSocketStream } from '@agentclientprotocol/sdk/experimental/ws-client';
|
|
4
|
-
export { createNodeHttpHandler, createNodeWebSocketUpgradeHandler } from '@agentclientprotocol/sdk/experimental/node';
|
|
5
|
-
import { writeErr, expectDefined } from '@wrongstack/core';
|
|
6
|
-
import * as fsp2 from 'fs/promises';
|
|
7
|
-
import * as path3 from 'path';
|
|
8
|
-
import { spawn } from 'child_process';
|
|
9
|
-
import { fileURLToPath } from 'url';
|
|
10
|
-
import { createServer } from 'http';
|
|
11
|
-
import { SubagentBudget } from '@wrongstack/core/coordination';
|
|
12
|
-
|
|
13
1
|
// src/sdk.ts
|
|
2
|
+
import {
|
|
3
|
+
AGENT_METHODS,
|
|
4
|
+
CLIENT_METHODS,
|
|
5
|
+
PROTOCOL_METHODS,
|
|
6
|
+
PROTOCOL_VERSION
|
|
7
|
+
} from "@agentclientprotocol/sdk";
|
|
8
|
+
import {
|
|
9
|
+
AgentApp,
|
|
10
|
+
ClientApp,
|
|
11
|
+
ActiveSession,
|
|
12
|
+
SessionBuilder,
|
|
13
|
+
methods
|
|
14
|
+
} from "@agentclientprotocol/sdk";
|
|
15
|
+
import {
|
|
16
|
+
AcpServer
|
|
17
|
+
} from "@agentclientprotocol/sdk/experimental/server";
|
|
18
|
+
import {
|
|
19
|
+
createWebSocketStream
|
|
20
|
+
} from "@agentclientprotocol/sdk/experimental/ws-client";
|
|
21
|
+
import {
|
|
22
|
+
createNodeHttpHandler,
|
|
23
|
+
createNodeWebSocketUpgradeHandler
|
|
24
|
+
} from "@agentclientprotocol/sdk/experimental/node";
|
|
25
|
+
|
|
26
|
+
// src/agent/stdio-transport.ts
|
|
27
|
+
import { expectDefined, writeErr } from "@wrongstack/core";
|
|
14
28
|
|
|
15
29
|
// src/win32-cmd.ts
|
|
16
30
|
var WIN32_CMD_META = /[&|<>"\r\n\0]/;
|
|
@@ -142,9 +156,9 @@ var ClientTransport = class {
|
|
|
142
156
|
async start() {
|
|
143
157
|
if (this.child) return;
|
|
144
158
|
const [{ spawn: spawn2 }, { buildChildEnv }, os] = await Promise.all([
|
|
145
|
-
import(
|
|
146
|
-
import(
|
|
147
|
-
import(
|
|
159
|
+
import("node:child_process"),
|
|
160
|
+
import("@wrongstack/core"),
|
|
161
|
+
import("node:os")
|
|
148
162
|
]);
|
|
149
163
|
return new Promise((resolve3, reject) => {
|
|
150
164
|
const timeout = setTimeout(() => {
|
|
@@ -398,6 +412,10 @@ var WebSocketClientTransport = class {
|
|
|
398
412
|
|
|
399
413
|
// src/types/acp-v1.ts
|
|
400
414
|
var ACP_PROTOCOL_VERSION = 1;
|
|
415
|
+
|
|
416
|
+
// src/client/file-server.ts
|
|
417
|
+
import * as fsp from "node:fs/promises";
|
|
418
|
+
import * as path from "node:path";
|
|
401
419
|
var FsError = class extends Error {
|
|
402
420
|
code;
|
|
403
421
|
path;
|
|
@@ -412,7 +430,7 @@ var FileServer = class {
|
|
|
412
430
|
root;
|
|
413
431
|
timeoutMs;
|
|
414
432
|
constructor(opts) {
|
|
415
|
-
this.root =
|
|
433
|
+
this.root = path.resolve(opts.projectRoot);
|
|
416
434
|
this.timeoutMs = opts.timeoutMs ?? 3e4;
|
|
417
435
|
}
|
|
418
436
|
/** Read a text file. Returns the content as a string. */
|
|
@@ -421,7 +439,7 @@ var FileServer = class {
|
|
|
421
439
|
const controller = new AbortController();
|
|
422
440
|
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
423
441
|
try {
|
|
424
|
-
const content = await
|
|
442
|
+
const content = await fsp.readFile(safe, {
|
|
425
443
|
encoding: "utf8",
|
|
426
444
|
signal: controller.signal
|
|
427
445
|
});
|
|
@@ -442,14 +460,14 @@ var FileServer = class {
|
|
|
442
460
|
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
443
461
|
const tmp = `${safe}.${randomHex(4)}.tmp`;
|
|
444
462
|
try {
|
|
445
|
-
await
|
|
463
|
+
await fsp.writeFile(tmp, params.content, {
|
|
446
464
|
encoding: "utf8",
|
|
447
465
|
signal: controller.signal
|
|
448
466
|
});
|
|
449
|
-
await
|
|
467
|
+
await fsp.rename(tmp, safe);
|
|
450
468
|
} catch (err) {
|
|
451
469
|
try {
|
|
452
|
-
await
|
|
470
|
+
await fsp.unlink(tmp);
|
|
453
471
|
} catch {
|
|
454
472
|
}
|
|
455
473
|
if (controller.signal.aborted) {
|
|
@@ -470,11 +488,11 @@ var FileServer = class {
|
|
|
470
488
|
if (typeof p !== "string" || p.length === 0) {
|
|
471
489
|
throw new FsError("INVALID_PATH", p, "path is empty or not a string");
|
|
472
490
|
}
|
|
473
|
-
if (!
|
|
491
|
+
if (!path.isAbsolute(p)) {
|
|
474
492
|
throw new FsError("INVALID_PATH", p, "path must be absolute (ACP requirement)");
|
|
475
493
|
}
|
|
476
|
-
const resolved =
|
|
477
|
-
const rootWithSep = this.root.endsWith(
|
|
494
|
+
const resolved = path.resolve(p);
|
|
495
|
+
const rootWithSep = this.root.endsWith(path.sep) ? this.root : this.root + path.sep;
|
|
478
496
|
if (resolved !== this.root && !resolved.startsWith(rootWithSep)) {
|
|
479
497
|
throw new FsError("OUTSIDE_ROOT", resolved, "path is outside the project root");
|
|
480
498
|
}
|
|
@@ -541,6 +559,10 @@ function makePermissionPolicy(decide) {
|
|
|
541
559
|
return allow ? pickAllow(req.options) : pickReject(req.options);
|
|
542
560
|
};
|
|
543
561
|
}
|
|
562
|
+
|
|
563
|
+
// src/client/terminal-server.ts
|
|
564
|
+
import { spawn } from "node:child_process";
|
|
565
|
+
import * as path2 from "node:path";
|
|
544
566
|
var TerminalServer = class {
|
|
545
567
|
terminals = /* @__PURE__ */ new Map();
|
|
546
568
|
projectRoot;
|
|
@@ -548,7 +570,7 @@ var TerminalServer = class {
|
|
|
548
570
|
outputByteLimit;
|
|
549
571
|
nextId = 1;
|
|
550
572
|
constructor(opts) {
|
|
551
|
-
this.projectRoot =
|
|
573
|
+
this.projectRoot = path2.resolve(opts.projectRoot);
|
|
552
574
|
this.commandTimeoutMs = opts.commandTimeoutMs ?? 5 * 6e4;
|
|
553
575
|
this.outputByteLimit = opts.outputByteLimit ?? 1024 * 1024;
|
|
554
576
|
if (opts.signal) {
|
|
@@ -684,8 +706,8 @@ var TerminalServer = class {
|
|
|
684
706
|
}
|
|
685
707
|
resolveCwd(cwd) {
|
|
686
708
|
if (!cwd) return this.projectRoot;
|
|
687
|
-
const resolved =
|
|
688
|
-
const rootWithSep = this.projectRoot.endsWith(
|
|
709
|
+
const resolved = path2.resolve(cwd);
|
|
710
|
+
const rootWithSep = this.projectRoot.endsWith(path2.sep) ? this.projectRoot : this.projectRoot + path2.sep;
|
|
689
711
|
if (resolved !== this.projectRoot && !resolved.startsWith(rootWithSep)) {
|
|
690
712
|
return this.projectRoot;
|
|
691
713
|
}
|
|
@@ -2366,6 +2388,11 @@ function errorToJsonRpc(err) {
|
|
|
2366
2388
|
const message = err instanceof Error ? err.message : String(err);
|
|
2367
2389
|
return { code: -32603, message };
|
|
2368
2390
|
}
|
|
2391
|
+
|
|
2392
|
+
// src/agent/wrongstack-acp-agent.ts
|
|
2393
|
+
import { fileURLToPath } from "node:url";
|
|
2394
|
+
import { createServer } from "node:http";
|
|
2395
|
+
import { writeErr as writeErr2 } from "@wrongstack/core";
|
|
2369
2396
|
var WrongStackACPServer = class {
|
|
2370
2397
|
transport;
|
|
2371
2398
|
handler;
|
|
@@ -2472,7 +2499,7 @@ var WrongStackACPServer = class {
|
|
|
2472
2499
|
});
|
|
2473
2500
|
return new Promise((resolve3) => {
|
|
2474
2501
|
this.httpServer.listen(port, host, () => {
|
|
2475
|
-
|
|
2502
|
+
writeErr2(`[wstack-acp] HTTP server listening on http://${host}:${port}
|
|
2476
2503
|
`);
|
|
2477
2504
|
this.running = true;
|
|
2478
2505
|
resolve3();
|
|
@@ -2499,7 +2526,7 @@ async function main() {
|
|
|
2499
2526
|
var isEntrypoint = process.argv[1] !== void 0 && fileURLToPath(import.meta.url) === process.argv[1];
|
|
2500
2527
|
if (isEntrypoint) {
|
|
2501
2528
|
main().catch((err) => {
|
|
2502
|
-
|
|
2529
|
+
writeErr2(`[wstack-acp fatal] ${err}
|
|
2503
2530
|
`);
|
|
2504
2531
|
process.exit(1);
|
|
2505
2532
|
});
|
|
@@ -2757,6 +2784,10 @@ function extractUsage(result) {
|
|
|
2757
2784
|
}
|
|
2758
2785
|
return null;
|
|
2759
2786
|
}
|
|
2787
|
+
|
|
2788
|
+
// src/agent/session-store.ts
|
|
2789
|
+
import * as fsp2 from "node:fs/promises";
|
|
2790
|
+
import * as path3 from "node:path";
|
|
2760
2791
|
var ACPSessionStore = class {
|
|
2761
2792
|
dir;
|
|
2762
2793
|
/**
|
|
@@ -3121,6 +3152,50 @@ function findAgentDescriptor(id) {
|
|
|
3121
3152
|
return AGENTS_CATALOG.find((a) => a.id === id);
|
|
3122
3153
|
}
|
|
3123
3154
|
|
|
3155
|
+
// src/integration/run-one-acp-task.ts
|
|
3156
|
+
import { SubagentBudget } from "@wrongstack/core/coordination";
|
|
3157
|
+
async function runOneAcpTask(opts) {
|
|
3158
|
+
const role = opts.role ?? "acp";
|
|
3159
|
+
const timeoutMs = opts.timeoutMs ?? 5 * 6e4;
|
|
3160
|
+
const { runner, stop } = await makeACPSubagentRunnerWithStop({
|
|
3161
|
+
command: opts.command,
|
|
3162
|
+
...opts.args !== void 0 ? { args: opts.args } : {},
|
|
3163
|
+
...opts.env !== void 0 ? { env: opts.env } : {},
|
|
3164
|
+
...opts.cwd !== void 0 ? { cwd: opts.cwd } : {},
|
|
3165
|
+
...opts.projectRoot !== void 0 ? { projectRoot: opts.projectRoot } : {},
|
|
3166
|
+
role,
|
|
3167
|
+
timeoutMs,
|
|
3168
|
+
...opts.onProgress !== void 0 ? { onProgress: opts.onProgress } : {},
|
|
3169
|
+
...opts.permissionPolicy !== void 0 ? { permissionPolicy: opts.permissionPolicy } : {}
|
|
3170
|
+
});
|
|
3171
|
+
try {
|
|
3172
|
+
const budget = new SubagentBudget({
|
|
3173
|
+
timeoutMs,
|
|
3174
|
+
maxIterations: 2e3,
|
|
3175
|
+
maxToolCalls: 5e3
|
|
3176
|
+
});
|
|
3177
|
+
budget.start();
|
|
3178
|
+
const ctx = {
|
|
3179
|
+
subagentId: role,
|
|
3180
|
+
config: { id: role, name: role, role, provider: "acp", prompt: "" },
|
|
3181
|
+
budget,
|
|
3182
|
+
signal: opts.signal ?? new AbortController().signal,
|
|
3183
|
+
bridge: null
|
|
3184
|
+
};
|
|
3185
|
+
const result = await runner({ id: `acp-${role}`, description: opts.task }, ctx);
|
|
3186
|
+
return {
|
|
3187
|
+
result: result.result == null ? "" : String(result.result),
|
|
3188
|
+
iterations: result.iterations,
|
|
3189
|
+
toolCalls: result.toolCalls
|
|
3190
|
+
};
|
|
3191
|
+
} finally {
|
|
3192
|
+
try {
|
|
3193
|
+
await stop();
|
|
3194
|
+
} catch {
|
|
3195
|
+
}
|
|
3196
|
+
}
|
|
3197
|
+
}
|
|
3198
|
+
|
|
3124
3199
|
// src/integration/acp-subagent-runner.ts
|
|
3125
3200
|
var ACP_AGENT_COMMANDS = {
|
|
3126
3201
|
cline: {
|
|
@@ -3324,47 +3399,6 @@ function resolveAcpAgentCommand(id, overrides, live) {
|
|
|
3324
3399
|
if (fromMap) return fromMap;
|
|
3325
3400
|
return null;
|
|
3326
3401
|
}
|
|
3327
|
-
async function runOneAcpTask(opts) {
|
|
3328
|
-
const role = opts.role ?? "acp";
|
|
3329
|
-
const timeoutMs = opts.timeoutMs ?? 5 * 6e4;
|
|
3330
|
-
const { runner, stop } = await makeACPSubagentRunnerWithStop({
|
|
3331
|
-
command: opts.command,
|
|
3332
|
-
...opts.args !== void 0 ? { args: opts.args } : {},
|
|
3333
|
-
...opts.env !== void 0 ? { env: opts.env } : {},
|
|
3334
|
-
...opts.cwd !== void 0 ? { cwd: opts.cwd } : {},
|
|
3335
|
-
...opts.projectRoot !== void 0 ? { projectRoot: opts.projectRoot } : {},
|
|
3336
|
-
role,
|
|
3337
|
-
timeoutMs,
|
|
3338
|
-
...opts.onProgress !== void 0 ? { onProgress: opts.onProgress } : {},
|
|
3339
|
-
...opts.permissionPolicy !== void 0 ? { permissionPolicy: opts.permissionPolicy } : {}
|
|
3340
|
-
});
|
|
3341
|
-
try {
|
|
3342
|
-
const budget = new SubagentBudget({
|
|
3343
|
-
timeoutMs,
|
|
3344
|
-
maxIterations: 2e3,
|
|
3345
|
-
maxToolCalls: 5e3
|
|
3346
|
-
});
|
|
3347
|
-
budget.start();
|
|
3348
|
-
const ctx = {
|
|
3349
|
-
subagentId: role,
|
|
3350
|
-
config: { id: role, name: role, role, provider: "acp", prompt: "" },
|
|
3351
|
-
budget,
|
|
3352
|
-
signal: opts.signal ?? new AbortController().signal,
|
|
3353
|
-
bridge: null
|
|
3354
|
-
};
|
|
3355
|
-
const result = await runner({ id: `acp-${role}`, description: opts.task }, ctx);
|
|
3356
|
-
return {
|
|
3357
|
-
result: result.result == null ? "" : String(result.result),
|
|
3358
|
-
iterations: result.iterations,
|
|
3359
|
-
toolCalls: result.toolCalls
|
|
3360
|
-
};
|
|
3361
|
-
} finally {
|
|
3362
|
-
try {
|
|
3363
|
-
await stop();
|
|
3364
|
-
} catch {
|
|
3365
|
-
}
|
|
3366
|
-
}
|
|
3367
|
-
}
|
|
3368
3402
|
async function probeAcpAgent(idOrCmd, opts) {
|
|
3369
3403
|
const id = typeof idOrCmd === "string" ? idOrCmd : idOrCmd.role ?? idOrCmd.command;
|
|
3370
3404
|
const cmd = typeof idOrCmd === "string" ? resolveAcpAgentCommand(idOrCmd, opts?.overrides, opts?.live) : idOrCmd;
|
|
@@ -3405,7 +3439,43 @@ async function probeAcpAgent(idOrCmd, opts) {
|
|
|
3405
3439
|
}
|
|
3406
3440
|
}
|
|
3407
3441
|
}
|
|
3408
|
-
|
|
3409
|
-
|
|
3442
|
+
export {
|
|
3443
|
+
ACPProtocolHandler,
|
|
3444
|
+
ACPSession,
|
|
3445
|
+
ACPSessionError,
|
|
3446
|
+
ACPSessionStore,
|
|
3447
|
+
ACP_AGENT_COMMANDS,
|
|
3448
|
+
AGENT_METHODS,
|
|
3449
|
+
AcpServer,
|
|
3450
|
+
ActiveSession,
|
|
3451
|
+
AgentApp,
|
|
3452
|
+
CLIENT_METHODS,
|
|
3453
|
+
ClientApp,
|
|
3454
|
+
FileServer,
|
|
3455
|
+
FsError,
|
|
3456
|
+
PROTOCOL_METHODS,
|
|
3457
|
+
PROTOCOL_VERSION,
|
|
3458
|
+
SessionBuilder,
|
|
3459
|
+
TerminalServer,
|
|
3460
|
+
WRONGSTACK_VERSION,
|
|
3461
|
+
WebSocketClientTransport,
|
|
3462
|
+
WrongStackACPServer,
|
|
3463
|
+
audioContent,
|
|
3464
|
+
createNodeHttpHandler,
|
|
3465
|
+
createNodeWebSocketUpgradeHandler,
|
|
3466
|
+
createWebSocketStream,
|
|
3467
|
+
defaultPermissionPolicy,
|
|
3468
|
+
disposeACPServerAgentTurn,
|
|
3469
|
+
imageContent,
|
|
3470
|
+
makeACPServerAgentTurn,
|
|
3471
|
+
makeACPSubagentRunner,
|
|
3472
|
+
makeACPSubagentRunnerWithStop,
|
|
3473
|
+
makePermissionPolicy,
|
|
3474
|
+
methods,
|
|
3475
|
+
probeAcpAgent,
|
|
3476
|
+
readOnlyPermissionPolicy,
|
|
3477
|
+
resolveAcpAgentCommand,
|
|
3478
|
+
runOneAcpTask,
|
|
3479
|
+
textContent
|
|
3480
|
+
};
|
|
3410
3481
|
//# sourceMappingURL=sdk.js.map
|
|
3411
|
-
//# sourceMappingURL=sdk.js.map
|