@simonepri/refined-antigravity-acp 0.2.0 → 1.0.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/bin/cli.js +2 -51
- package/dist/bin/cli.js.map +1 -1
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +44 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/{command.d.ts → core/command.d.ts} +4 -0
- package/dist/src/core/command.d.ts.map +1 -0
- package/dist/src/{command.js → core/command.js} +27 -11
- package/dist/src/core/command.js.map +1 -0
- package/dist/src/core/pipeline.d.ts +20 -0
- package/dist/src/core/pipeline.d.ts.map +1 -0
- package/dist/src/core/pipeline.js +94 -0
- package/dist/src/core/pipeline.js.map +1 -0
- package/dist/src/core/session-cache.d.ts +12 -0
- package/dist/src/core/session-cache.d.ts.map +1 -0
- package/dist/src/core/session-cache.js +85 -0
- package/dist/src/core/session-cache.js.map +1 -0
- package/dist/src/core/supervisor.d.ts +90 -0
- package/dist/src/core/supervisor.d.ts.map +1 -0
- package/dist/src/core/supervisor.js +582 -0
- package/dist/src/core/supervisor.js.map +1 -0
- package/dist/src/core/telemetry.d.ts +23 -0
- package/dist/src/core/telemetry.d.ts.map +1 -0
- package/dist/src/core/telemetry.js +75 -0
- package/dist/src/core/telemetry.js.map +1 -0
- package/dist/src/core/transport.d.ts +7 -0
- package/dist/src/core/transport.d.ts.map +1 -0
- package/dist/src/core/transport.js +37 -0
- package/dist/src/core/transport.js.map +1 -0
- package/dist/src/core/types.d.ts +293 -0
- package/dist/src/core/types.d.ts.map +1 -0
- package/dist/src/core/types.js +78 -0
- package/dist/src/core/types.js.map +1 -0
- package/dist/src/fixes/active-turn-collision/index.d.ts +27 -0
- package/dist/src/fixes/active-turn-collision/index.d.ts.map +1 -0
- package/dist/src/fixes/active-turn-collision/index.js +117 -0
- package/dist/src/fixes/active-turn-collision/index.js.map +1 -0
- package/dist/src/fixes/cancellation-leak/index.d.ts +17 -0
- package/dist/src/fixes/cancellation-leak/index.d.ts.map +1 -0
- package/dist/src/fixes/cancellation-leak/index.js +57 -0
- package/dist/src/fixes/cancellation-leak/index.js.map +1 -0
- package/dist/src/fixes/dangling-tool-calls/index.d.ts +32 -0
- package/dist/src/fixes/dangling-tool-calls/index.d.ts.map +1 -0
- package/dist/src/fixes/dangling-tool-calls/index.js +188 -0
- package/dist/src/fixes/dangling-tool-calls/index.js.map +1 -0
- package/dist/src/fixes/dropped-history-chunks/index.d.ts +47 -0
- package/dist/src/fixes/dropped-history-chunks/index.d.ts.map +1 -0
- package/dist/src/fixes/dropped-history-chunks/index.js +202 -0
- package/dist/src/fixes/dropped-history-chunks/index.js.map +1 -0
- package/dist/src/fixes/flattened-model-efforts/index.d.ts +39 -0
- package/dist/src/fixes/flattened-model-efforts/index.d.ts.map +1 -0
- package/dist/src/fixes/flattened-model-efforts/index.js +306 -0
- package/dist/src/fixes/flattened-model-efforts/index.js.map +1 -0
- package/dist/src/fixes/index.d.ts +25 -0
- package/dist/src/fixes/index.d.ts.map +1 -0
- package/dist/src/fixes/index.js +61 -0
- package/dist/src/fixes/index.js.map +1 -0
- package/dist/src/fixes/malformed-stream-syntax/index.d.ts +44 -0
- package/dist/src/fixes/malformed-stream-syntax/index.d.ts.map +1 -0
- package/dist/src/fixes/malformed-stream-syntax/index.js +346 -0
- package/dist/src/fixes/malformed-stream-syntax/index.js.map +1 -0
- package/dist/src/fixes/missing-localharness/index.d.ts +20 -0
- package/dist/src/fixes/missing-localharness/index.d.ts.map +1 -0
- package/dist/src/fixes/missing-localharness/index.js +103 -0
- package/dist/src/fixes/missing-localharness/index.js.map +1 -0
- package/dist/src/fixes/missing-question-fallback/index.d.ts +30 -0
- package/dist/src/fixes/missing-question-fallback/index.d.ts.map +1 -0
- package/dist/src/fixes/missing-question-fallback/index.js +119 -0
- package/dist/src/fixes/missing-question-fallback/index.js.map +1 -0
- package/dist/src/fixes/missing-slash-skills/index.d.ts +17 -0
- package/dist/src/fixes/missing-slash-skills/index.d.ts.map +1 -0
- package/dist/src/fixes/missing-slash-skills/index.js +107 -0
- package/dist/src/fixes/missing-slash-skills/index.js.map +1 -0
- package/dist/src/{skills.d.ts → fixes/missing-slash-skills/skills.d.ts} +2 -1
- package/dist/src/fixes/missing-slash-skills/skills.d.ts.map +1 -0
- package/dist/src/fixes/missing-slash-skills/skills.js +199 -0
- package/dist/src/fixes/missing-slash-skills/skills.js.map +1 -0
- package/dist/src/fixes/missing-system-prompt/index.d.ts +19 -0
- package/dist/src/fixes/missing-system-prompt/index.d.ts.map +1 -0
- package/dist/src/fixes/missing-system-prompt/index.js +118 -0
- package/dist/src/fixes/missing-system-prompt/index.js.map +1 -0
- package/dist/src/fixes/missing-usage-metrics/index.d.ts +26 -0
- package/dist/src/fixes/missing-usage-metrics/index.d.ts.map +1 -0
- package/dist/src/fixes/missing-usage-metrics/index.js +132 -0
- package/dist/src/fixes/missing-usage-metrics/index.js.map +1 -0
- package/dist/src/fixes/noisy-stderr-logs/index.d.ts +15 -0
- package/dist/src/fixes/noisy-stderr-logs/index.d.ts.map +1 -0
- package/dist/src/fixes/noisy-stderr-logs/index.js +23 -0
- package/dist/src/fixes/noisy-stderr-logs/index.js.map +1 -0
- package/dist/src/fixes/non-canonical-mode-ids/index.d.ts +26 -0
- package/dist/src/fixes/non-canonical-mode-ids/index.d.ts.map +1 -0
- package/dist/src/fixes/non-canonical-mode-ids/index.js +47 -0
- package/dist/src/fixes/non-canonical-mode-ids/index.js.map +1 -0
- package/dist/src/fixes/orphaned-checkpoints/index.d.ts +31 -0
- package/dist/src/fixes/orphaned-checkpoints/index.d.ts.map +1 -0
- package/dist/src/fixes/orphaned-checkpoints/index.js +82 -0
- package/dist/src/fixes/orphaned-checkpoints/index.js.map +1 -0
- package/dist/src/fixes/silent-background-tasks/index.d.ts +66 -0
- package/dist/src/fixes/silent-background-tasks/index.d.ts.map +1 -0
- package/dist/src/fixes/silent-background-tasks/index.js +491 -0
- package/dist/src/fixes/silent-background-tasks/index.js.map +1 -0
- package/dist/src/{mcp-proxy.d.ts → fixes/stale-mcp-endpoints/index.d.ts} +31 -4
- package/dist/src/fixes/stale-mcp-endpoints/index.d.ts.map +1 -0
- package/dist/src/{mcp-proxy.js → fixes/stale-mcp-endpoints/index.js} +162 -14
- package/dist/src/fixes/stale-mcp-endpoints/index.js.map +1 -0
- package/dist/src/fixes/subagent-hang/index.d.ts +2 -0
- package/dist/src/fixes/subagent-hang/index.d.ts.map +1 -0
- package/dist/src/fixes/subagent-hang/index.js +2 -0
- package/dist/src/fixes/subagent-hang/index.js.map +1 -0
- package/dist/src/fixes/subagent-hang/subagent-hang.d.ts +43 -0
- package/dist/src/fixes/subagent-hang/subagent-hang.d.ts.map +1 -0
- package/dist/src/fixes/subagent-hang/subagent-hang.js +114 -0
- package/dist/src/fixes/subagent-hang/subagent-hang.js.map +1 -0
- package/dist/src/index.d.ts +27 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +43 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/protobuf.d.ts +9 -0
- package/dist/src/lib/protobuf.d.ts.map +1 -0
- package/dist/src/lib/protobuf.js +89 -0
- package/dist/src/lib/protobuf.js.map +1 -0
- package/package.json +22 -7
- package/readme.md +147 -141
- package/assets/icon.svg +0 -3
- package/build/paseo/assets/icon.svg +0 -3
- package/build/paseo/assets/logo.svg +0 -62
- package/build/paseo/index.server.ts +0 -9
- package/build/paseo/paseo-plugin.json +0 -7
- package/build/paseo/server/agy-patch.ts +0 -445
- package/build/paseo/server/auth.ts +0 -122
- package/build/paseo/server/command.ts +0 -92
- package/build/paseo/server/connector.ts +0 -1371
- package/build/paseo/server/history.ts +0 -157
- package/build/paseo/server/mcp-proxy.ts +0 -375
- package/build/paseo/server/provider.ts +0 -37
- package/build/paseo/server/sanitize.ts +0 -286
- package/build/paseo/server/skills.ts +0 -183
- package/build/paseo/server/steering.ts +0 -199
- package/dist/index.server.d.ts +0 -4
- package/dist/index.server.d.ts.map +0 -1
- package/dist/index.server.js +0 -7
- package/dist/index.server.js.map +0 -1
- package/dist/src/agy-patch.d.ts +0 -65
- package/dist/src/agy-patch.d.ts.map +0 -1
- package/dist/src/agy-patch.js +0 -351
- package/dist/src/agy-patch.js.map +0 -1
- package/dist/src/auth.d.ts +0 -27
- package/dist/src/auth.d.ts.map +0 -1
- package/dist/src/auth.js +0 -113
- package/dist/src/auth.js.map +0 -1
- package/dist/src/command.d.ts.map +0 -1
- package/dist/src/command.js.map +0 -1
- package/dist/src/connector.d.ts +0 -187
- package/dist/src/connector.d.ts.map +0 -1
- package/dist/src/connector.js +0 -1127
- package/dist/src/connector.js.map +0 -1
- package/dist/src/history.d.ts +0 -12
- package/dist/src/history.d.ts.map +0 -1
- package/dist/src/history.js +0 -152
- package/dist/src/history.js.map +0 -1
- package/dist/src/mcp-proxy.d.ts.map +0 -1
- package/dist/src/mcp-proxy.js.map +0 -1
- package/dist/src/provider.d.ts +0 -11
- package/dist/src/provider.d.ts.map +0 -1
- package/dist/src/provider.js +0 -31
- package/dist/src/provider.js.map +0 -1
- package/dist/src/sanitize.d.ts +0 -29
- package/dist/src/sanitize.d.ts.map +0 -1
- package/dist/src/sanitize.js +0 -237
- package/dist/src/sanitize.js.map +0 -1
- package/dist/src/skills.d.ts.map +0 -1
- package/dist/src/skills.js +0 -140
- package/dist/src/skills.js.map +0 -1
- package/dist/src/steering.d.ts +0 -30
- package/dist/src/steering.d.ts.map +0 -1
- package/dist/src/steering.js +0 -174
- package/dist/src/steering.js.map +0 -1
- package/paseo-plugin.json +0 -8
- package/scripts/build-paseo.js +0 -60
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export const RAW_WS_MSG_MARKER = "RAW WS MSG:";
|
|
2
|
+
export const TELEMETRY_STATES = {
|
|
3
|
+
WAITING_FOR_TASKS: "STATE_WAITING_FOR_TASKS",
|
|
4
|
+
FULLY_IDLE: "STATE_FULLY_IDLE",
|
|
5
|
+
IDLE: "STATE_IDLE",
|
|
6
|
+
RUNNING: "STATE_RUNNING",
|
|
7
|
+
COMPLETE: "STATE_COMPLETE",
|
|
8
|
+
ACTIVE: "STATE_ACTIVE",
|
|
9
|
+
};
|
|
10
|
+
export const TARGET_ENVIRONMENT = "TARGET_ENVIRONMENT";
|
|
11
|
+
function extractJsonCandidate(line) {
|
|
12
|
+
const idx = line.indexOf(RAW_WS_MSG_MARKER);
|
|
13
|
+
if (idx !== -1) {
|
|
14
|
+
return line.slice(idx + RAW_WS_MSG_MARKER.length).trim();
|
|
15
|
+
}
|
|
16
|
+
const keyIdx = line.indexOf('"trajectoryStateUpdate"');
|
|
17
|
+
if (keyIdx === -1)
|
|
18
|
+
return null;
|
|
19
|
+
const braceIdx = line.lastIndexOf("{", keyIdx);
|
|
20
|
+
if (braceIdx === -1)
|
|
21
|
+
return null;
|
|
22
|
+
return line.slice(braceIdx).trim();
|
|
23
|
+
}
|
|
24
|
+
function tryParseJsonCandidate(candidate, parser) {
|
|
25
|
+
if (!candidate)
|
|
26
|
+
return null;
|
|
27
|
+
try {
|
|
28
|
+
return parser(JSON.parse(candidate));
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
const lastBrace = candidate.lastIndexOf("}");
|
|
32
|
+
if (lastBrace === -1)
|
|
33
|
+
return null;
|
|
34
|
+
try {
|
|
35
|
+
return parser(JSON.parse(candidate.slice(0, lastBrace + 1)));
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function parseTsuObject(parsed) {
|
|
43
|
+
if (!parsed || typeof parsed !== "object")
|
|
44
|
+
return null;
|
|
45
|
+
const tsu = parsed.trajectoryStateUpdate;
|
|
46
|
+
if (!tsu || typeof tsu !== "object")
|
|
47
|
+
return null;
|
|
48
|
+
const o = tsu;
|
|
49
|
+
if (typeof o.trajectoryId !== "string" || typeof o.state !== "string")
|
|
50
|
+
return null;
|
|
51
|
+
return { trajectoryId: o.trajectoryId, state: o.state };
|
|
52
|
+
}
|
|
53
|
+
export function parseTrajectoryStateUpdate(line) {
|
|
54
|
+
return tryParseJsonCandidate(extractJsonCandidate(line), parseTsuObject);
|
|
55
|
+
}
|
|
56
|
+
function parseStepUpdateObject(parsed) {
|
|
57
|
+
if (!parsed || typeof parsed !== "object")
|
|
58
|
+
return null;
|
|
59
|
+
const su = parsed.stepUpdate;
|
|
60
|
+
if (!su || typeof su !== "object")
|
|
61
|
+
return null;
|
|
62
|
+
const o = su;
|
|
63
|
+
if (typeof o.trajectoryId !== "string" || typeof o.state !== "string")
|
|
64
|
+
return null;
|
|
65
|
+
return {
|
|
66
|
+
trajectoryId: o.trajectoryId,
|
|
67
|
+
state: o.state,
|
|
68
|
+
target: typeof o.target === "string" ? o.target : undefined,
|
|
69
|
+
source: typeof o.source === "string" ? o.source : undefined,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export function parseStepUpdate(line) {
|
|
73
|
+
return tryParseJsonCandidate(extractJsonCandidate(line), parseStepUpdateObject);
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=telemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../../src/core/telemetry.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAE/C,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,iBAAiB,EAAE,yBAAyB;IAC5C,UAAU,EAAE,kBAAkB;IAC9B,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,eAAe;IACxB,QAAQ,EAAE,gBAAgB;IAC1B,MAAM,EAAE,cAAc;CACd,CAAC;AAEX,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAcvD,SAAS,oBAAoB,CAAC,IAAY;IACxC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAA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;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,qBAAqB,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,qBAAqB,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ChildProcess } from "node:child_process";
|
|
2
|
+
import type { AcpStreamMessage } from "./types.js";
|
|
3
|
+
import type { AcpPipeline } from "./pipeline.js";
|
|
4
|
+
export declare function traceAcp(direction: "client->agy" | "agy->client", msg: AcpStreamMessage): void;
|
|
5
|
+
export declare function defaultSpawnProcess(cmd: string, args: string[], pipeline?: AcpPipeline): ChildProcess;
|
|
6
|
+
export declare function writeJsonMessage(child: ChildProcess, msg: AcpStreamMessage): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../src/core/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,oBAAoB,CAAC;AAE9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIjD,wBAAgB,QAAQ,CAAC,SAAS,EAAE,aAAa,GAAG,aAAa,EAAE,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAM9F;AAED,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EAAE,EACd,QAAQ,CAAC,EAAE,WAAW,GACrB,YAAY,CAed;AAED,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAWhG"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { once } from "node:events";
|
|
3
|
+
const ACP_TRACE_ENABLED = process.env.REFINED_AGY_TRACE === "1";
|
|
4
|
+
export function traceAcp(direction, msg) {
|
|
5
|
+
if (!ACP_TRACE_ENABLED)
|
|
6
|
+
return;
|
|
7
|
+
const m = msg;
|
|
8
|
+
const id = m.id === undefined ? "-" : String(m.id);
|
|
9
|
+
const kind = m.method ? String(m.method) : m.error ? "error" : "result";
|
|
10
|
+
console.error(`[refined-antigravity-acp][acp] ${direction} id=${id} ${kind}`);
|
|
11
|
+
}
|
|
12
|
+
export function defaultSpawnProcess(cmd, args, pipeline) {
|
|
13
|
+
const env = {
|
|
14
|
+
...process.env,
|
|
15
|
+
AGY_ACP_FORCE_FILE_STORAGE: "1",
|
|
16
|
+
BROWSER: "false",
|
|
17
|
+
};
|
|
18
|
+
if (pipeline) {
|
|
19
|
+
pipeline.applySpawn(env, cmd, args);
|
|
20
|
+
}
|
|
21
|
+
return spawn(cmd, args, {
|
|
22
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
23
|
+
env,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export async function writeJsonMessage(child, msg) {
|
|
27
|
+
const stdin = child.stdin;
|
|
28
|
+
if (!stdin || !stdin.writable) {
|
|
29
|
+
throw new Error("Child process stdin is not writable");
|
|
30
|
+
}
|
|
31
|
+
const payload = JSON.stringify(msg) + "\n";
|
|
32
|
+
const canContinue = stdin.write(payload);
|
|
33
|
+
if (!canContinue) {
|
|
34
|
+
await once(stdin, "drain");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../src/core/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAInC,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,KAAK,GA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AAC,CAAC;IACzD,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAC3C,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import type { ChildProcess } from "node:child_process";
|
|
2
|
+
export declare const ACP_METHODS: {
|
|
3
|
+
readonly INITIALIZE: "initialize";
|
|
4
|
+
readonly AUTHENTICATE: "authenticate";
|
|
5
|
+
readonly LOGOUT: "logout";
|
|
6
|
+
readonly SESSION_NEW: "session/new";
|
|
7
|
+
readonly SESSION_LOAD: "session/load";
|
|
8
|
+
readonly SESSION_LIST: "session/list";
|
|
9
|
+
readonly SESSION_RESUME: "session/resume";
|
|
10
|
+
readonly SESSION_CLOSE: "session/close";
|
|
11
|
+
readonly SESSION_DELETE: "session/delete";
|
|
12
|
+
readonly SESSION_FORK: "session/fork";
|
|
13
|
+
readonly SESSION_PROMPT: "session/prompt";
|
|
14
|
+
readonly SESSION_SET_MODE: "session/set_mode";
|
|
15
|
+
readonly SESSION_SET_MODEL: "session/set_model";
|
|
16
|
+
readonly SESSION_SET_CONFIG_OPTION: "session/set_config_option";
|
|
17
|
+
readonly SESSION_CANCEL: "session/cancel";
|
|
18
|
+
readonly SESSION_UPDATE: "session/update";
|
|
19
|
+
readonly SESSION_REQUEST_PERMISSION: "session/request_permission";
|
|
20
|
+
readonly CANCEL_REQUEST: "$/cancel_request";
|
|
21
|
+
};
|
|
22
|
+
export declare const SESSION_UPDATES: {
|
|
23
|
+
readonly AGENT_MESSAGE_CHUNK: "agent_message_chunk";
|
|
24
|
+
readonly USER_MESSAGE_CHUNK: "user_message_chunk";
|
|
25
|
+
readonly AGENT_THOUGHT_CHUNK: "agent_thought_chunk";
|
|
26
|
+
readonly TOOL_CALL: "tool_call";
|
|
27
|
+
readonly TOOL_CALL_UPDATE: "tool_call_update";
|
|
28
|
+
readonly PLAN: "plan";
|
|
29
|
+
readonly PLAN_UPDATE: "plan_update";
|
|
30
|
+
readonly PLAN_REMOVED: "plan_removed";
|
|
31
|
+
readonly AVAILABLE_COMMANDS_UPDATE: "available_commands_update";
|
|
32
|
+
readonly CURRENT_MODE_UPDATE: "current_mode_update";
|
|
33
|
+
readonly CONFIG_OPTION_UPDATE: "config_option_update";
|
|
34
|
+
readonly SESSION_INFO_UPDATE: "session_info_update";
|
|
35
|
+
readonly USAGE_UPDATE: "usage_update";
|
|
36
|
+
readonly NOTICE: "notice";
|
|
37
|
+
readonly COMPACTION_UPDATE: "compaction_update";
|
|
38
|
+
readonly COMPACTION_SUMMARY_CHUNK: "compaction_summary_chunk";
|
|
39
|
+
};
|
|
40
|
+
export declare const STOP_REASONS: {
|
|
41
|
+
readonly END_TURN: "end_turn";
|
|
42
|
+
readonly CANCELLED: "cancelled";
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Standard JSON-RPC 2.0 message variants in ACP
|
|
46
|
+
*/
|
|
47
|
+
export interface JsonRpcRequest<TMethod extends string = string, TParams = unknown> {
|
|
48
|
+
jsonrpc: "2.0";
|
|
49
|
+
id: string | number;
|
|
50
|
+
method: TMethod;
|
|
51
|
+
params?: TParams;
|
|
52
|
+
}
|
|
53
|
+
export interface JsonRpcNotification<TMethod extends string = string, TParams = unknown> {
|
|
54
|
+
jsonrpc: "2.0";
|
|
55
|
+
method: TMethod;
|
|
56
|
+
params?: TParams;
|
|
57
|
+
}
|
|
58
|
+
export interface JsonRpcSuccessResponse<TResult = unknown> {
|
|
59
|
+
jsonrpc: "2.0";
|
|
60
|
+
id: string | number | null;
|
|
61
|
+
result: TResult;
|
|
62
|
+
}
|
|
63
|
+
export interface JsonRpcErrorObject {
|
|
64
|
+
code: number;
|
|
65
|
+
message: string;
|
|
66
|
+
data?: unknown;
|
|
67
|
+
}
|
|
68
|
+
export interface JsonRpcErrorResponse {
|
|
69
|
+
jsonrpc: "2.0";
|
|
70
|
+
id: string | number | null;
|
|
71
|
+
error: JsonRpcErrorObject;
|
|
72
|
+
}
|
|
73
|
+
export type AcpStreamMessage = JsonRpcRequest | JsonRpcNotification | JsonRpcSuccessResponse | JsonRpcErrorResponse;
|
|
74
|
+
export declare function isJsonRpcRequest(msg: AcpStreamMessage): msg is JsonRpcRequest;
|
|
75
|
+
export declare function isJsonRpcNotification(msg: AcpStreamMessage): msg is JsonRpcNotification;
|
|
76
|
+
export declare function isJsonRpcSuccessResponse<T = unknown>(msg: AcpStreamMessage): msg is JsonRpcSuccessResponse<T>;
|
|
77
|
+
export declare function isJsonRpcErrorResponse(msg: AcpStreamMessage): msg is JsonRpcErrorResponse;
|
|
78
|
+
export declare function isMethod<M extends string>(msg: AcpStreamMessage, method: M): msg is (JsonRpcRequest<M> | JsonRpcNotification<M>) & {
|
|
79
|
+
method: M;
|
|
80
|
+
};
|
|
81
|
+
export interface AcpStream {
|
|
82
|
+
writable: WritableStream<AcpStreamMessage>;
|
|
83
|
+
readable: ReadableStream<AcpStreamMessage>;
|
|
84
|
+
}
|
|
85
|
+
export type AcpConnector = () => AcpStream | Promise<AcpStream>;
|
|
86
|
+
export interface UrlRewriter {
|
|
87
|
+
rewriteUrl: (url: string) => Promise<string> | string;
|
|
88
|
+
}
|
|
89
|
+
export interface CachedConfigOption {
|
|
90
|
+
value: unknown;
|
|
91
|
+
type?: string | undefined;
|
|
92
|
+
}
|
|
93
|
+
export interface CachedSessionMetadata {
|
|
94
|
+
sessionId: string;
|
|
95
|
+
cwd?: string;
|
|
96
|
+
_meta?: unknown;
|
|
97
|
+
lastModeId?: string;
|
|
98
|
+
lastConfigOptions: Map<string, CachedConfigOption>;
|
|
99
|
+
needsRecycle?: boolean;
|
|
100
|
+
/** Fixes can store arbitrary session-scoped state here */
|
|
101
|
+
fixData?: Map<string, unknown>;
|
|
102
|
+
}
|
|
103
|
+
export declare function getFixData<T>(session: CachedSessionMetadata | undefined, key: string): T | undefined;
|
|
104
|
+
export declare function setFixData<T>(session: CachedSessionMetadata, key: string, value: T): void;
|
|
105
|
+
export declare function getOrCreateFixData<T>(session: CachedSessionMetadata, key: string, factory: () => T): T;
|
|
106
|
+
export interface SessionCache {
|
|
107
|
+
sessions: Map<string, CachedSessionMetadata>;
|
|
108
|
+
pendingSessionMetadata: Map<string | number, Partial<CachedSessionMetadata>>;
|
|
109
|
+
/** Session a pending request's response belongs to, by request id. */
|
|
110
|
+
pendingRequestSessions: Map<string | number, string>;
|
|
111
|
+
cachedInitializeParams?: unknown;
|
|
112
|
+
}
|
|
113
|
+
export interface CoreContext {
|
|
114
|
+
sessionCache: SessionCache;
|
|
115
|
+
proxies?: UrlRewriter | undefined;
|
|
116
|
+
forwardInbound: (msg: AcpStreamMessage) => void;
|
|
117
|
+
writeToChild: (msg: AcpStreamMessage) => Promise<void>;
|
|
118
|
+
sendInternalRequest: (msg: AcpStreamMessage, timeoutMs?: number | undefined) => Promise<AcpStreamMessage>;
|
|
119
|
+
triggerRecycle: (session: CachedSessionMetadata) => Promise<void>;
|
|
120
|
+
declareHang: (sessionId: string, promptId: string | number, reason: string) => void;
|
|
121
|
+
}
|
|
122
|
+
export interface OutboundContext extends CoreContext {
|
|
123
|
+
session?: CachedSessionMetadata | undefined;
|
|
124
|
+
fixes?: readonly AcpFix[] | undefined;
|
|
125
|
+
}
|
|
126
|
+
export interface InboundContext extends CoreContext {
|
|
127
|
+
session?: CachedSessionMetadata | undefined;
|
|
128
|
+
isRecycling?: boolean | undefined;
|
|
129
|
+
}
|
|
130
|
+
export interface StderrContext extends CoreContext {
|
|
131
|
+
session?: CachedSessionMetadata | undefined;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Interface that each hardening fix implements.
|
|
135
|
+
* To add a fix, implement this interface and add to active fixes list.
|
|
136
|
+
* To remove a fix, delete the file and remove from active fixes list.
|
|
137
|
+
*/
|
|
138
|
+
export interface AcpFix {
|
|
139
|
+
/** Unique name of the fix matching the Readme issue (e.g. "flattened-model-efforts") */
|
|
140
|
+
readonly name: string;
|
|
141
|
+
/** Optional human-readable description */
|
|
142
|
+
readonly description?: string;
|
|
143
|
+
/** Hook called during child process spawning to modify environment or command */
|
|
144
|
+
onSpawn?: (env: NodeJS.ProcessEnv, cmd: string, args: string[]) => void;
|
|
145
|
+
/**
|
|
146
|
+
* Intercept or modify an outbound message from the client before it is written to the child process.
|
|
147
|
+
* Return null or undefined to drop the message.
|
|
148
|
+
*/
|
|
149
|
+
onOutbound?: (msg: AcpStreamMessage, context: OutboundContext) => Promise<AcpStreamMessage | null | undefined> | AcpStreamMessage | null | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* Intercept or modify an inbound message from the child process before it reaches the client.
|
|
152
|
+
* Return an array of messages (empty to drop, multiple to expand).
|
|
153
|
+
*/
|
|
154
|
+
onInbound?: (msg: AcpStreamMessage, context: InboundContext) => Promise<AcpStreamMessage[]> | AcpStreamMessage[];
|
|
155
|
+
/**
|
|
156
|
+
* Hook called when a turn completes (e.g. response with result arrived),
|
|
157
|
+
* allowing fixes to flush buffered items or emit synthesized end chunks.
|
|
158
|
+
*/
|
|
159
|
+
onTurnEnd?: (sessionId: string, context: InboundContext) => AcpStreamMessage[];
|
|
160
|
+
/**
|
|
161
|
+
* Intercept a line of stderr output from the child process.
|
|
162
|
+
* Return true to suppress/drop the line from stderr.
|
|
163
|
+
*/
|
|
164
|
+
onStderrLine?: (line: string, context: StderrContext) => boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Hook called when a child process is recycled to resynchronize fix state.
|
|
167
|
+
*/
|
|
168
|
+
onRecycle?: (session: CachedSessionMetadata, newChild: ChildProcess, context: CoreContext) => Promise<void> | void;
|
|
169
|
+
/**
|
|
170
|
+
* Optional hook allowing a fix to contribute domain-specific system instructions or guidelines
|
|
171
|
+
* (e.g. formatting requirements, steering behavior) to the session prompt.
|
|
172
|
+
*/
|
|
173
|
+
getSystemInstructions?: (session?: CachedSessionMetadata, context?: OutboundContext) => readonly string[] | undefined;
|
|
174
|
+
/** Clean up timers, locks, or resources when the connector closes */
|
|
175
|
+
dispose?: () => void;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Structured ACP protocol payloads
|
|
179
|
+
*/
|
|
180
|
+
export interface McpServerConfig {
|
|
181
|
+
name: string;
|
|
182
|
+
type?: string;
|
|
183
|
+
url?: string;
|
|
184
|
+
command?: string;
|
|
185
|
+
args?: string[];
|
|
186
|
+
env?: Record<string, string>;
|
|
187
|
+
headers?: unknown;
|
|
188
|
+
}
|
|
189
|
+
export interface PromptContentItem {
|
|
190
|
+
type: string;
|
|
191
|
+
text?: string;
|
|
192
|
+
data?: unknown;
|
|
193
|
+
[key: string]: unknown;
|
|
194
|
+
}
|
|
195
|
+
export interface SessionPlanEntry {
|
|
196
|
+
content: string;
|
|
197
|
+
priority: "high" | "medium" | "low";
|
|
198
|
+
status: "pending" | "in_progress" | "completed";
|
|
199
|
+
}
|
|
200
|
+
export interface InitializeParams {
|
|
201
|
+
protocolVersion: number;
|
|
202
|
+
clientCapabilities?: Record<string, unknown>;
|
|
203
|
+
clientInfo?: {
|
|
204
|
+
name: string;
|
|
205
|
+
version: string;
|
|
206
|
+
};
|
|
207
|
+
[key: string]: unknown;
|
|
208
|
+
}
|
|
209
|
+
export interface SessionNewParams {
|
|
210
|
+
cwd?: string;
|
|
211
|
+
modeId?: string;
|
|
212
|
+
_meta?: unknown;
|
|
213
|
+
mcpServers?: McpServerConfig[];
|
|
214
|
+
[key: string]: unknown;
|
|
215
|
+
}
|
|
216
|
+
export interface SessionLoadParams {
|
|
217
|
+
sessionId: string;
|
|
218
|
+
cwd?: string;
|
|
219
|
+
modeId?: string;
|
|
220
|
+
_meta?: unknown;
|
|
221
|
+
mcpServers?: McpServerConfig[];
|
|
222
|
+
[key: string]: unknown;
|
|
223
|
+
}
|
|
224
|
+
export interface SessionSetModeParams {
|
|
225
|
+
sessionId: string;
|
|
226
|
+
modeId: string;
|
|
227
|
+
[key: string]: unknown;
|
|
228
|
+
}
|
|
229
|
+
export interface SessionSetConfigOptionParams {
|
|
230
|
+
sessionId: string;
|
|
231
|
+
configId: string;
|
|
232
|
+
value: unknown;
|
|
233
|
+
type?: string;
|
|
234
|
+
[key: string]: unknown;
|
|
235
|
+
}
|
|
236
|
+
export interface SessionPromptParams {
|
|
237
|
+
sessionId: string;
|
|
238
|
+
prompt: string | PromptContentItem[];
|
|
239
|
+
[key: string]: unknown;
|
|
240
|
+
}
|
|
241
|
+
export interface SessionCancelParams {
|
|
242
|
+
sessionId: string;
|
|
243
|
+
[key: string]: unknown;
|
|
244
|
+
}
|
|
245
|
+
export interface TextContentBlock {
|
|
246
|
+
type: "text";
|
|
247
|
+
text: string;
|
|
248
|
+
}
|
|
249
|
+
export interface SessionUpdatePayload {
|
|
250
|
+
sessionUpdate?: string;
|
|
251
|
+
content?: TextContentBlock | TextContentBlock[] | {
|
|
252
|
+
type?: string;
|
|
253
|
+
text?: string;
|
|
254
|
+
} | Array<{
|
|
255
|
+
type?: string;
|
|
256
|
+
text?: string;
|
|
257
|
+
}> | unknown[] | null;
|
|
258
|
+
toolCallId?: string;
|
|
259
|
+
name?: string | null;
|
|
260
|
+
title?: string | null;
|
|
261
|
+
kind?: string | null;
|
|
262
|
+
status?: string | null;
|
|
263
|
+
rawInput?: unknown;
|
|
264
|
+
arguments?: unknown;
|
|
265
|
+
entries?: SessionPlanEntry[];
|
|
266
|
+
availableCommands?: Array<{
|
|
267
|
+
name: string;
|
|
268
|
+
description: string;
|
|
269
|
+
}>;
|
|
270
|
+
[key: string]: unknown;
|
|
271
|
+
}
|
|
272
|
+
export interface SessionUpdateParams {
|
|
273
|
+
sessionId: string;
|
|
274
|
+
update: SessionUpdatePayload;
|
|
275
|
+
[key: string]: unknown;
|
|
276
|
+
}
|
|
277
|
+
export interface SessionAllocationResult {
|
|
278
|
+
sessionId: string;
|
|
279
|
+
[key: string]: unknown;
|
|
280
|
+
}
|
|
281
|
+
export interface SessionPromptResult {
|
|
282
|
+
stopReason?: string;
|
|
283
|
+
[key: string]: unknown;
|
|
284
|
+
}
|
|
285
|
+
export type InitializeRequest = JsonRpcRequest<"initialize", InitializeParams>;
|
|
286
|
+
export type SessionNewRequest = JsonRpcRequest<"session/new", SessionNewParams>;
|
|
287
|
+
export type SessionLoadRequest = JsonRpcRequest<"session/load", SessionLoadParams>;
|
|
288
|
+
export type SessionPromptRequest = JsonRpcRequest<"session/prompt", SessionPromptParams>;
|
|
289
|
+
export type SessionSetModeRequest = JsonRpcRequest<"session/set_mode", SessionSetModeParams>;
|
|
290
|
+
export type SessionSetConfigOptionRequest = JsonRpcRequest<"session/set_config_option", SessionSetConfigOptionParams>;
|
|
291
|
+
export type SessionCancelNotification = JsonRpcNotification<"session/cancel", SessionCancelParams>;
|
|
292
|
+
export type SessionUpdateNotification = JsonRpcNotification<"session/update", SessionUpdateParams>;
|
|
293
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;CAmBd,CAAC;AAEX,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;CAiBlB,CAAC;AAEX,eAAO,MAAM,YAAY;;;CAGf,CAAC;AAEX;;GAEG;AAEH,MAAM,WAAW,cAAc,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAAE,OAAO,GAAG,OAAO;IAChF,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;A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AM,MAAM,oBAAoB,GAAG,cAAc,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,CAAC;AACzF,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC;AAC7F,MAAM,MAAM,6BAA6B,GAAG,cAAc,CACxD,2BAA2B,EAC3B,4BAA4B,CAC7B,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG,mBAAmB,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,CAAC;AACnG,MAAM,MAAM,yBAAyB,GAAG,mBAAmB,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export const ACP_METHODS = {
|
|
2
|
+
INITIALIZE: "initialize",
|
|
3
|
+
AUTHENTICATE: "authenticate",
|
|
4
|
+
LOGOUT: "logout",
|
|
5
|
+
SESSION_NEW: "session/new",
|
|
6
|
+
SESSION_LOAD: "session/load",
|
|
7
|
+
SESSION_LIST: "session/list",
|
|
8
|
+
SESSION_RESUME: "session/resume",
|
|
9
|
+
SESSION_CLOSE: "session/close",
|
|
10
|
+
SESSION_DELETE: "session/delete",
|
|
11
|
+
SESSION_FORK: "session/fork",
|
|
12
|
+
SESSION_PROMPT: "session/prompt",
|
|
13
|
+
SESSION_SET_MODE: "session/set_mode",
|
|
14
|
+
SESSION_SET_MODEL: "session/set_model",
|
|
15
|
+
SESSION_SET_CONFIG_OPTION: "session/set_config_option",
|
|
16
|
+
SESSION_CANCEL: "session/cancel",
|
|
17
|
+
SESSION_UPDATE: "session/update",
|
|
18
|
+
SESSION_REQUEST_PERMISSION: "session/request_permission",
|
|
19
|
+
CANCEL_REQUEST: "$/cancel_request",
|
|
20
|
+
};
|
|
21
|
+
export const SESSION_UPDATES = {
|
|
22
|
+
AGENT_MESSAGE_CHUNK: "agent_message_chunk",
|
|
23
|
+
USER_MESSAGE_CHUNK: "user_message_chunk",
|
|
24
|
+
AGENT_THOUGHT_CHUNK: "agent_thought_chunk",
|
|
25
|
+
TOOL_CALL: "tool_call",
|
|
26
|
+
TOOL_CALL_UPDATE: "tool_call_update",
|
|
27
|
+
PLAN: "plan",
|
|
28
|
+
PLAN_UPDATE: "plan_update",
|
|
29
|
+
PLAN_REMOVED: "plan_removed",
|
|
30
|
+
AVAILABLE_COMMANDS_UPDATE: "available_commands_update",
|
|
31
|
+
CURRENT_MODE_UPDATE: "current_mode_update",
|
|
32
|
+
CONFIG_OPTION_UPDATE: "config_option_update",
|
|
33
|
+
SESSION_INFO_UPDATE: "session_info_update",
|
|
34
|
+
USAGE_UPDATE: "usage_update",
|
|
35
|
+
NOTICE: "notice",
|
|
36
|
+
COMPACTION_UPDATE: "compaction_update",
|
|
37
|
+
COMPACTION_SUMMARY_CHUNK: "compaction_summary_chunk",
|
|
38
|
+
};
|
|
39
|
+
export const STOP_REASONS = {
|
|
40
|
+
END_TURN: "end_turn",
|
|
41
|
+
CANCELLED: "cancelled",
|
|
42
|
+
};
|
|
43
|
+
export function isJsonRpcRequest(msg) {
|
|
44
|
+
return "method" in msg && "id" in msg && msg.id !== null && msg.id !== undefined;
|
|
45
|
+
}
|
|
46
|
+
export function isJsonRpcNotification(msg) {
|
|
47
|
+
return "method" in msg && !("id" in msg);
|
|
48
|
+
}
|
|
49
|
+
export function isJsonRpcSuccessResponse(msg) {
|
|
50
|
+
return "result" in msg && "id" in msg;
|
|
51
|
+
}
|
|
52
|
+
export function isJsonRpcErrorResponse(msg) {
|
|
53
|
+
return "error" in msg && "id" in msg && typeof msg.error === "object" && msg.error !== null;
|
|
54
|
+
}
|
|
55
|
+
export function isMethod(msg, method) {
|
|
56
|
+
return "method" in msg && msg.method === method;
|
|
57
|
+
}
|
|
58
|
+
export function getFixData(session, key) {
|
|
59
|
+
return session?.fixData?.get(key);
|
|
60
|
+
}
|
|
61
|
+
export function setFixData(session, key, value) {
|
|
62
|
+
if (!session.fixData) {
|
|
63
|
+
session.fixData = new Map();
|
|
64
|
+
}
|
|
65
|
+
session.fixData.set(key, value);
|
|
66
|
+
}
|
|
67
|
+
export function getOrCreateFixData(session, key, factory) {
|
|
68
|
+
if (!session.fixData) {
|
|
69
|
+
session.fixData = new Map();
|
|
70
|
+
}
|
|
71
|
+
let data = session.fixData.get(key);
|
|
72
|
+
if (data === undefined) {
|
|
73
|
+
data = factory();
|
|
74
|
+
session.fixData.set(key, data);
|
|
75
|
+
}
|
|
76
|
+
return data;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,UAAU,EAAE,YAAY;IACxB,YAAY,EAAE,cAAc;IAC5B,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,cAAc;IAC5B,YAAY,EAAE,cAAc;IAC5B,cAAc,EAAE,gBAAgB;IAChC,aAAa,EAAE,eAAe;IAC9B,cAAc,EAAE,gBAAgB;IAChC,YAAY,EAAE,cAAc;IAC5B,cAAc,EAAE,gBAAgB;IAChC,gBAAgB,EAAE,kBAAkB;IACpC,iBAAiB,EAAE,mBAAmB;IACtC,yBAAyB,EAAE,2BAA2B;IACtD,cAAc,EAAE,gBAAgB;IAChC,cAAc,EAAE,gBAAgB;IAChC,0BAA0B,EAAE,4BAA4B;IACxD,cAAc,EAAE,kBAAkB;CAC1B,CAAC;AAEX,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,mBAAmB,EAAE,qBAAqB;IAC1C,kBAAkB,EAAE,oBAAoB;IACxC,mBAAmB,EAAE,qBAAqB;IAC1C,SAAS,EAAE,WAAW;IACtB,gBAAgB,EAAE,kBAAkB;IACpC,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,cAAc;IAC5B,yBAAyB,EAAE,2BAA2B;IACtD,m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AAW,EAAE,KAAQ;IACjF,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrB,OAAO,CAAC,OAAO,GAAG,IAAI,GAAG,EAAmB,CAAC;IAC/C,CAAC;IACD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,OAA8B,EAC9B,GAAW,EACX,OAAgB;IAEhB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrB,OAAO,CAAC,OAAO,GAAG,IAAI,GAAG,EAAmB,CAAC;IAC/C,CAAC;IACD,IAAI,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAkB,CAAC;IACrD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,IAAI,GAAG,OAAO,EAAE,CAAC;QACjB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Problem:
|
|
3
|
+
* Sending a prompt request while an upstream agent turn is in progress (e.g. executing tool calls)
|
|
4
|
+
* is rejected with a fatal error: `"A foreground turn is already active"`.
|
|
5
|
+
*
|
|
6
|
+
* Solution:
|
|
7
|
+
* Queues in-flight user steering directives, classifies mid-turn inputs, and retries
|
|
8
|
+
* rejected prompt requests once the active turn transitions to idle.
|
|
9
|
+
*/
|
|
10
|
+
import { type AcpFix } from "../../core/types.js";
|
|
11
|
+
export declare function stripSteeringPrefix(text: string): string;
|
|
12
|
+
export declare const FOREGROUND_TURN_ERROR_PATTERN: RegExp;
|
|
13
|
+
export declare const DONE_CH_ERROR_PATTERN: RegExp;
|
|
14
|
+
export declare const MAX_PROMPT_RETRIES = 5;
|
|
15
|
+
export declare const DEFAULT_PROMPT_RETRY_DELAY_MS = 500;
|
|
16
|
+
export interface UserSteeringOptions {
|
|
17
|
+
delayMs?: number;
|
|
18
|
+
maxRetries?: number;
|
|
19
|
+
}
|
|
20
|
+
export declare const USER_STEERING_INSTRUCTIONS: readonly string[];
|
|
21
|
+
export declare function createActiveTurnCollisionFix(options?: UserSteeringOptions): AcpFix;
|
|
22
|
+
export declare const activeTurnCollisionFix: AcpFix;
|
|
23
|
+
export declare const createUserSteeringFix: typeof createActiveTurnCollisionFix;
|
|
24
|
+
export declare const userSteeringFix: AcpFix;
|
|
25
|
+
export declare const createPromptRetryFix: typeof createActiveTurnCollisionFix;
|
|
26
|
+
export declare const promptRetryFix: AcpFix;
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/fixes/active-turn-collision/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAIL,KAAK,MAAM,EAEZ,MAAM,qBAAqB,CAAC;AAU7B,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIxD;AAED,eAAO,MAAM,6BAA6B,QAAuC,CAAC;AAClF,eAAO,MAAM,qBAAqB,QAAwC,CAAC;AAC3E,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAEjD,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAwDD,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAEvD,CAAC;AAEF,wBAAgB,4BAA4B,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAwDlF;AAED,eAAO,MAAM,sBAAsB,QAAiC,CAAC;AACrE,eAAO,MAAM,qBAAqB,qCAA+B,CAAC;AAClE,eAAO,MAAM,eAAe,QAAyB,CAAC;AACtD,eAAO,MAAM,oBAAoB,qCAA+B,CAAC;AACjE,eAAO,MAAM,cAAc,QAAyB,CAAC"}
|