agent-debugger 0.1.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/README.md +131 -0
- package/bin/agent-debugger +2 -0
- package/dist/src/adapters/base.d.ts +45 -0
- package/dist/src/adapters/base.d.ts.map +1 -0
- package/dist/src/adapters/base.js +3 -0
- package/dist/src/adapters/base.js.map +1 -0
- package/dist/src/adapters/go.d.ts +27 -0
- package/dist/src/adapters/go.d.ts.map +1 -0
- package/dist/src/adapters/go.js +144 -0
- package/dist/src/adapters/go.js.map +1 -0
- package/dist/src/adapters/node.d.ts +27 -0
- package/dist/src/adapters/node.d.ts.map +1 -0
- package/dist/src/adapters/node.js +197 -0
- package/dist/src/adapters/node.js.map +1 -0
- package/dist/src/adapters/python.d.ts +27 -0
- package/dist/src/adapters/python.d.ts.map +1 -0
- package/dist/src/adapters/python.js +152 -0
- package/dist/src/adapters/python.js.map +1 -0
- package/dist/src/adapters/registry.d.ts +10 -0
- package/dist/src/adapters/registry.d.ts.map +1 -0
- package/dist/src/adapters/registry.js +45 -0
- package/dist/src/adapters/registry.js.map +1 -0
- package/dist/src/adapters/rust.d.ts +27 -0
- package/dist/src/adapters/rust.d.ts.map +1 -0
- package/dist/src/adapters/rust.js +149 -0
- package/dist/src/adapters/rust.js.map +1 -0
- package/dist/src/cli.d.ts +4 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +326 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/daemon.d.ts +3 -0
- package/dist/src/daemon.d.ts.map +1 -0
- package/dist/src/daemon.js +136 -0
- package/dist/src/daemon.js.map +1 -0
- package/dist/src/dap-client.d.ts +35 -0
- package/dist/src/dap-client.d.ts.map +1 -0
- package/dist/src/dap-client.js +256 -0
- package/dist/src/dap-client.js.map +1 -0
- package/dist/src/dap-types.d.ts +52 -0
- package/dist/src/dap-types.d.ts.map +1 -0
- package/dist/src/dap-types.js +3 -0
- package/dist/src/dap-types.js.map +1 -0
- package/dist/src/protocol.d.ts +253 -0
- package/dist/src/protocol.d.ts.map +1 -0
- package/dist/src/protocol.js +50 -0
- package/dist/src/protocol.js.map +1 -0
- package/dist/src/session.d.ts +30 -0
- package/dist/src/session.d.ts.map +1 -0
- package/dist/src/session.js +407 -0
- package/dist/src/session.js.map +1 -0
- package/dist/src/util/paths.d.ts +5 -0
- package/dist/src/util/paths.d.ts.map +1 -0
- package/dist/src/util/paths.js +7 -0
- package/dist/src/util/paths.js.map +1 -0
- package/dist/src/util/ports.d.ts +3 -0
- package/dist/src/util/ports.d.ts.map +1 -0
- package/dist/src/util/ports.js +19 -0
- package/dist/src/util/ports.js.map +1 -0
- package/dist/test/protocol.test.d.ts +2 -0
- package/dist/test/protocol.test.d.ts.map +1 -0
- package/dist/test/protocol.test.js +25 -0
- package/dist/test/protocol.test.js.map +1 -0
- package/package.json +55 -0
- package/skills/agent-debugger/SKILL.md +225 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/** DAP (Debug Adapter Protocol) client over TCP.*/
|
|
2
|
+
import { Socket } from "node:net";
|
|
3
|
+
import { EventEmitter } from "node:events";
|
|
4
|
+
export class DAPClient extends EventEmitter {
|
|
5
|
+
sock = null;
|
|
6
|
+
seq = 0;
|
|
7
|
+
pending = new Map();
|
|
8
|
+
/** Deferred promises for requestAsync — survives dispatch resolution. */
|
|
9
|
+
asyncResponses = new Map();
|
|
10
|
+
eventQueue = [];
|
|
11
|
+
buffer = Buffer.alloc(0);
|
|
12
|
+
capabilities = {};
|
|
13
|
+
/** Connect to a DAP server with retry loop. */
|
|
14
|
+
async connect(host, port, timeout = 10000) {
|
|
15
|
+
const deadline = Date.now() + timeout;
|
|
16
|
+
let lastErr = null;
|
|
17
|
+
while (Date.now() < deadline) {
|
|
18
|
+
try {
|
|
19
|
+
await this.tryConnect(host, port, Math.min(1000, deadline - Date.now()));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
lastErr = err;
|
|
24
|
+
await sleep(100);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
throw new Error(`Could not connect to ${host}:${port} within ${timeout}ms: ${lastErr?.message}`);
|
|
28
|
+
}
|
|
29
|
+
tryConnect(host, port, timeout) {
|
|
30
|
+
return new Promise((resolve, reject) => {
|
|
31
|
+
const sock = new Socket();
|
|
32
|
+
const timer = setTimeout(() => {
|
|
33
|
+
sock.destroy();
|
|
34
|
+
reject(new Error("Connection timeout"));
|
|
35
|
+
}, timeout);
|
|
36
|
+
sock.once("connect", () => {
|
|
37
|
+
clearTimeout(timer);
|
|
38
|
+
this.sock = sock;
|
|
39
|
+
this.setupSocket();
|
|
40
|
+
resolve();
|
|
41
|
+
});
|
|
42
|
+
sock.once("error", (err) => {
|
|
43
|
+
clearTimeout(timer);
|
|
44
|
+
sock.destroy();
|
|
45
|
+
reject(err);
|
|
46
|
+
});
|
|
47
|
+
sock.connect(port, host);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
setupSocket() {
|
|
51
|
+
if (!this.sock)
|
|
52
|
+
return;
|
|
53
|
+
this.sock.on("data", (chunk) => {
|
|
54
|
+
this.buffer = Buffer.concat([this.buffer, chunk]);
|
|
55
|
+
this.processBuffer();
|
|
56
|
+
});
|
|
57
|
+
this.sock.on("close", () => {
|
|
58
|
+
for (const [seq, pending] of this.pending) {
|
|
59
|
+
clearTimeout(pending.timer);
|
|
60
|
+
pending.reject(new Error("Connection closed"));
|
|
61
|
+
this.pending.delete(seq);
|
|
62
|
+
}
|
|
63
|
+
// Also reject any async deferred that hasn't resolved
|
|
64
|
+
for (const [seq, deferred] of this.asyncResponses) {
|
|
65
|
+
if (!deferred.settled) {
|
|
66
|
+
deferred.reject(new Error("Connection closed"));
|
|
67
|
+
}
|
|
68
|
+
this.asyncResponses.delete(seq);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
this.sock.on("error", () => {
|
|
72
|
+
// Handled by close
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
processBuffer() {
|
|
76
|
+
while (true) {
|
|
77
|
+
const headerEnd = this.buffer.indexOf("\r\n\r\n");
|
|
78
|
+
if (headerEnd === -1)
|
|
79
|
+
return;
|
|
80
|
+
const header = this.buffer.subarray(0, headerEnd).toString("ascii");
|
|
81
|
+
let contentLength = null;
|
|
82
|
+
for (const line of header.split("\r\n")) {
|
|
83
|
+
if (line.toLowerCase().startsWith("content-length:")) {
|
|
84
|
+
contentLength = parseInt(line.split(":")[1].trim(), 10);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (contentLength === null)
|
|
88
|
+
return;
|
|
89
|
+
const bodyStart = headerEnd + 4;
|
|
90
|
+
const bodyEnd = bodyStart + contentLength;
|
|
91
|
+
if (this.buffer.length < bodyEnd)
|
|
92
|
+
return;
|
|
93
|
+
const body = this.buffer.subarray(bodyStart, bodyEnd).toString("utf-8");
|
|
94
|
+
this.buffer = this.buffer.subarray(bodyEnd);
|
|
95
|
+
const msg = JSON.parse(body);
|
|
96
|
+
this.dispatch(msg);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
dispatch(msg) {
|
|
100
|
+
if (msg.type === "response") {
|
|
101
|
+
const resp = msg;
|
|
102
|
+
// Check async responses first (requestAsync + waitForResponse)
|
|
103
|
+
const deferred = this.asyncResponses.get(resp.request_seq);
|
|
104
|
+
if (deferred) {
|
|
105
|
+
deferred.resolve(resp);
|
|
106
|
+
// Don't delete — waitForResponse may not have been called yet.
|
|
107
|
+
// It gets cleaned up there.
|
|
108
|
+
}
|
|
109
|
+
// Also resolve any pending entry (from request())
|
|
110
|
+
const pending = this.pending.get(resp.request_seq);
|
|
111
|
+
if (pending) {
|
|
112
|
+
clearTimeout(pending.timer);
|
|
113
|
+
this.pending.delete(resp.request_seq);
|
|
114
|
+
pending.resolve(resp);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
else if (msg.type === "event") {
|
|
118
|
+
const evt = msg;
|
|
119
|
+
this.eventQueue.push(evt);
|
|
120
|
+
this.emit("event", evt);
|
|
121
|
+
this.emit(`event:${evt.event}`, evt);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
send(msg) {
|
|
125
|
+
if (!this.sock)
|
|
126
|
+
throw new Error("Not connected");
|
|
127
|
+
const body = Buffer.from(JSON.stringify(msg), "utf-8");
|
|
128
|
+
const header = Buffer.from(`Content-Length: ${body.length}\r\n\r\n`, "ascii");
|
|
129
|
+
this.sock.write(Buffer.concat([header, body]));
|
|
130
|
+
}
|
|
131
|
+
/** Send a request and wait for the response. */
|
|
132
|
+
request(command, args, timeout = 30000) {
|
|
133
|
+
return new Promise((resolve, reject) => {
|
|
134
|
+
this.seq++;
|
|
135
|
+
const seq = this.seq;
|
|
136
|
+
const timer = setTimeout(() => {
|
|
137
|
+
this.pending.delete(seq);
|
|
138
|
+
reject(new Error(`DAP request '${command}' timed out after ${timeout}ms`));
|
|
139
|
+
}, timeout);
|
|
140
|
+
this.pending.set(seq, { resolve, reject, timer });
|
|
141
|
+
const msg = { seq, type: "request", command };
|
|
142
|
+
if (args)
|
|
143
|
+
msg.arguments = args;
|
|
144
|
+
this.send(msg);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/** Send a request without waiting. Returns the seq for later retrieval via waitForResponse. */
|
|
148
|
+
requestAsync(command, args) {
|
|
149
|
+
this.seq++;
|
|
150
|
+
const seq = this.seq;
|
|
151
|
+
const msg = { seq, type: "request", command };
|
|
152
|
+
if (args)
|
|
153
|
+
msg.arguments = args;
|
|
154
|
+
// Create a deferred that survives dispatch resolution
|
|
155
|
+
const deferred = createDeferred();
|
|
156
|
+
this.asyncResponses.set(seq, deferred);
|
|
157
|
+
this.send(msg);
|
|
158
|
+
return seq;
|
|
159
|
+
}
|
|
160
|
+
/** Wait for response to a previously sent async request. */
|
|
161
|
+
async waitForResponse(seq, timeout = 30000) {
|
|
162
|
+
const deferred = this.asyncResponses.get(seq);
|
|
163
|
+
if (!deferred) {
|
|
164
|
+
throw new Error(`No pending async request with seq ${seq}`);
|
|
165
|
+
}
|
|
166
|
+
// Race the deferred promise against a timeout
|
|
167
|
+
const result = await Promise.race([
|
|
168
|
+
deferred.promise,
|
|
169
|
+
new Promise((_, reject) => {
|
|
170
|
+
setTimeout(() => reject(new Error(`DAP request seq=${seq} timed out after ${timeout}ms`)), timeout);
|
|
171
|
+
}),
|
|
172
|
+
]);
|
|
173
|
+
// Clean up
|
|
174
|
+
this.asyncResponses.delete(seq);
|
|
175
|
+
return result;
|
|
176
|
+
}
|
|
177
|
+
/** Wait for a specific DAP event. */
|
|
178
|
+
waitForEvent(eventName, timeout = 30000) {
|
|
179
|
+
// Check queue first
|
|
180
|
+
const idx = this.eventQueue.findIndex((e) => e.event === eventName);
|
|
181
|
+
if (idx !== -1) {
|
|
182
|
+
return Promise.resolve(this.eventQueue.splice(idx, 1)[0]);
|
|
183
|
+
}
|
|
184
|
+
return new Promise((resolve) => {
|
|
185
|
+
const timer = setTimeout(() => {
|
|
186
|
+
this.removeListener(`event:${eventName}`, handler);
|
|
187
|
+
resolve(null);
|
|
188
|
+
}, timeout);
|
|
189
|
+
const handler = (evt) => {
|
|
190
|
+
clearTimeout(timer);
|
|
191
|
+
this.removeListener(`event:${eventName}`, handler);
|
|
192
|
+
// Remove from queue if it was also queued
|
|
193
|
+
const qi = this.eventQueue.indexOf(evt);
|
|
194
|
+
if (qi !== -1)
|
|
195
|
+
this.eventQueue.splice(qi, 1);
|
|
196
|
+
resolve(evt);
|
|
197
|
+
};
|
|
198
|
+
this.once(`event:${eventName}`, handler);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/** Drain all events of a given type from the queue. */
|
|
202
|
+
drainEvents(eventName) {
|
|
203
|
+
if (eventName) {
|
|
204
|
+
const matched = this.eventQueue.filter((e) => e.event === eventName);
|
|
205
|
+
this.eventQueue = this.eventQueue.filter((e) => e.event !== eventName);
|
|
206
|
+
return matched;
|
|
207
|
+
}
|
|
208
|
+
const all = [...this.eventQueue];
|
|
209
|
+
this.eventQueue = [];
|
|
210
|
+
return all;
|
|
211
|
+
}
|
|
212
|
+
getCapabilities() {
|
|
213
|
+
return this.capabilities;
|
|
214
|
+
}
|
|
215
|
+
/** Disconnect from the DAP server. */
|
|
216
|
+
async disconnect(terminate = true) {
|
|
217
|
+
try {
|
|
218
|
+
await this.request("disconnect", { restart: false, terminateDebuggee: terminate }, 5000);
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
// Best effort
|
|
222
|
+
}
|
|
223
|
+
finally {
|
|
224
|
+
if (this.sock) {
|
|
225
|
+
this.sock.destroy();
|
|
226
|
+
this.sock = null;
|
|
227
|
+
}
|
|
228
|
+
for (const [, pending] of this.pending) {
|
|
229
|
+
clearTimeout(pending.timer);
|
|
230
|
+
}
|
|
231
|
+
this.pending.clear();
|
|
232
|
+
this.asyncResponses.clear();
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
async close() {
|
|
236
|
+
await this.disconnect(true);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function sleep(ms) {
|
|
240
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
241
|
+
}
|
|
242
|
+
function createDeferred() {
|
|
243
|
+
let resolve;
|
|
244
|
+
let reject;
|
|
245
|
+
const deferred = {
|
|
246
|
+
settled: false,
|
|
247
|
+
};
|
|
248
|
+
deferred.promise = new Promise((res, rej) => {
|
|
249
|
+
resolve = (val) => { deferred.settled = true; res(val); };
|
|
250
|
+
reject = (err) => { deferred.settled = true; rej(err); };
|
|
251
|
+
});
|
|
252
|
+
deferred.resolve = resolve;
|
|
253
|
+
deferred.reject = reject;
|
|
254
|
+
return deferred;
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=dap-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dap-client.js","sourceRoot":"","sources":["../../src/dap-client.ts"],"names":[],"mappings":"AAAA,mDAAmD;AAE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"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** DAP (Debug Adapter Protocol) message type definitions. */
|
|
2
|
+
export interface DAPMessage {
|
|
3
|
+
seq: number;
|
|
4
|
+
type: "request" | "response" | "event";
|
|
5
|
+
}
|
|
6
|
+
export interface DAPRequest extends DAPMessage {
|
|
7
|
+
type: "request";
|
|
8
|
+
command: string;
|
|
9
|
+
arguments?: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
export interface DAPResponse extends DAPMessage {
|
|
12
|
+
type: "response";
|
|
13
|
+
request_seq: number;
|
|
14
|
+
success: boolean;
|
|
15
|
+
command: string;
|
|
16
|
+
message?: string;
|
|
17
|
+
body?: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
export interface DAPEvent extends DAPMessage {
|
|
20
|
+
type: "event";
|
|
21
|
+
event: string;
|
|
22
|
+
body?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export interface StackFrame {
|
|
25
|
+
id: number;
|
|
26
|
+
name: string;
|
|
27
|
+
line: number;
|
|
28
|
+
column: number;
|
|
29
|
+
source?: {
|
|
30
|
+
name?: string;
|
|
31
|
+
path?: string;
|
|
32
|
+
sourceReference?: number;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export interface Variable {
|
|
36
|
+
name: string;
|
|
37
|
+
value: string;
|
|
38
|
+
type?: string;
|
|
39
|
+
variablesReference: number;
|
|
40
|
+
}
|
|
41
|
+
export interface Scope {
|
|
42
|
+
name: string;
|
|
43
|
+
variablesReference: number;
|
|
44
|
+
expensive: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface Breakpoint {
|
|
47
|
+
id?: number;
|
|
48
|
+
verified: boolean;
|
|
49
|
+
line?: number;
|
|
50
|
+
message?: string;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=dap-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dap-types.d.ts","sourceRoot":"","sources":["../../src/d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EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dap-types.js","sourceRoot":"","sources":["../../src/dap-types.ts"],"names":[],"mappings":"AAAA,6DAA6D"}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/** Daemon <-> CLI protocol schemas. Newline-delimited JSON. */
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export declare const StartCommand: z.ZodObject<{
|
|
4
|
+
action: z.ZodLiteral<"start">;
|
|
5
|
+
script: z.ZodString;
|
|
6
|
+
language: z.ZodOptional<z.ZodString>;
|
|
7
|
+
breakpoints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
8
|
+
runtime: z.ZodOptional<z.ZodString>;
|
|
9
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
10
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
11
|
+
stop_on_entry: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
action: "start";
|
|
14
|
+
script: string;
|
|
15
|
+
language?: string | undefined;
|
|
16
|
+
breakpoints?: string[] | undefined;
|
|
17
|
+
runtime?: string | undefined;
|
|
18
|
+
args?: string[] | undefined;
|
|
19
|
+
cwd?: string | undefined;
|
|
20
|
+
stop_on_entry?: boolean | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
action: "start";
|
|
23
|
+
script: string;
|
|
24
|
+
language?: string | undefined;
|
|
25
|
+
breakpoints?: string[] | undefined;
|
|
26
|
+
runtime?: string | undefined;
|
|
27
|
+
args?: string[] | undefined;
|
|
28
|
+
cwd?: string | undefined;
|
|
29
|
+
stop_on_entry?: boolean | undefined;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const VarsCommand: z.ZodObject<{
|
|
32
|
+
action: z.ZodLiteral<"vars">;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
action: "vars";
|
|
35
|
+
}, {
|
|
36
|
+
action: "vars";
|
|
37
|
+
}>;
|
|
38
|
+
export declare const StackCommand: z.ZodObject<{
|
|
39
|
+
action: z.ZodLiteral<"stack">;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
action: "stack";
|
|
42
|
+
}, {
|
|
43
|
+
action: "stack";
|
|
44
|
+
}>;
|
|
45
|
+
export declare const EvalCommand: z.ZodObject<{
|
|
46
|
+
action: z.ZodLiteral<"eval">;
|
|
47
|
+
expression: z.ZodString;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
action: "eval";
|
|
50
|
+
expression: string;
|
|
51
|
+
}, {
|
|
52
|
+
action: "eval";
|
|
53
|
+
expression: string;
|
|
54
|
+
}>;
|
|
55
|
+
export declare const StepCommand: z.ZodObject<{
|
|
56
|
+
action: z.ZodLiteral<"step">;
|
|
57
|
+
kind: z.ZodOptional<z.ZodEnum<["over", "into", "out"]>>;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
action: "step";
|
|
60
|
+
kind?: "over" | "into" | "out" | undefined;
|
|
61
|
+
}, {
|
|
62
|
+
action: "step";
|
|
63
|
+
kind?: "over" | "into" | "out" | undefined;
|
|
64
|
+
}>;
|
|
65
|
+
export declare const ContinueCommand: z.ZodObject<{
|
|
66
|
+
action: z.ZodLiteral<"continue">;
|
|
67
|
+
}, "strip", z.ZodTypeAny, {
|
|
68
|
+
action: "continue";
|
|
69
|
+
}, {
|
|
70
|
+
action: "continue";
|
|
71
|
+
}>;
|
|
72
|
+
export declare const BreakCommand: z.ZodObject<{
|
|
73
|
+
action: z.ZodLiteral<"break">;
|
|
74
|
+
file: z.ZodString;
|
|
75
|
+
line: z.ZodNumber;
|
|
76
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
77
|
+
}, "strip", z.ZodTypeAny, {
|
|
78
|
+
action: "break";
|
|
79
|
+
file: string;
|
|
80
|
+
line: number;
|
|
81
|
+
condition?: string | undefined;
|
|
82
|
+
}, {
|
|
83
|
+
action: "break";
|
|
84
|
+
file: string;
|
|
85
|
+
line: number;
|
|
86
|
+
condition?: string | undefined;
|
|
87
|
+
}>;
|
|
88
|
+
export declare const SourceCommand: z.ZodObject<{
|
|
89
|
+
action: z.ZodLiteral<"source">;
|
|
90
|
+
file: z.ZodOptional<z.ZodString>;
|
|
91
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
92
|
+
}, "strip", z.ZodTypeAny, {
|
|
93
|
+
action: "source";
|
|
94
|
+
file?: string | undefined;
|
|
95
|
+
line?: number | undefined;
|
|
96
|
+
}, {
|
|
97
|
+
action: "source";
|
|
98
|
+
file?: string | undefined;
|
|
99
|
+
line?: number | undefined;
|
|
100
|
+
}>;
|
|
101
|
+
export declare const StatusCommand: z.ZodObject<{
|
|
102
|
+
action: z.ZodLiteral<"status">;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
action: "status";
|
|
105
|
+
}, {
|
|
106
|
+
action: "status";
|
|
107
|
+
}>;
|
|
108
|
+
export declare const CloseCommand: z.ZodObject<{
|
|
109
|
+
action: z.ZodLiteral<"close">;
|
|
110
|
+
}, "strip", z.ZodTypeAny, {
|
|
111
|
+
action: "close";
|
|
112
|
+
}, {
|
|
113
|
+
action: "close";
|
|
114
|
+
}>;
|
|
115
|
+
export declare const Command: z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
|
|
116
|
+
action: z.ZodLiteral<"start">;
|
|
117
|
+
script: z.ZodString;
|
|
118
|
+
language: z.ZodOptional<z.ZodString>;
|
|
119
|
+
breakpoints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
120
|
+
runtime: z.ZodOptional<z.ZodString>;
|
|
121
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
122
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
123
|
+
stop_on_entry: z.ZodOptional<z.ZodBoolean>;
|
|
124
|
+
}, "strip", z.ZodTypeAny, {
|
|
125
|
+
action: "start";
|
|
126
|
+
script: string;
|
|
127
|
+
language?: string | undefined;
|
|
128
|
+
breakpoints?: string[] | undefined;
|
|
129
|
+
runtime?: string | undefined;
|
|
130
|
+
args?: string[] | undefined;
|
|
131
|
+
cwd?: string | undefined;
|
|
132
|
+
stop_on_entry?: boolean | undefined;
|
|
133
|
+
}, {
|
|
134
|
+
action: "start";
|
|
135
|
+
script: string;
|
|
136
|
+
language?: string | undefined;
|
|
137
|
+
breakpoints?: string[] | undefined;
|
|
138
|
+
runtime?: string | undefined;
|
|
139
|
+
args?: string[] | undefined;
|
|
140
|
+
cwd?: string | undefined;
|
|
141
|
+
stop_on_entry?: boolean | undefined;
|
|
142
|
+
}>, z.ZodObject<{
|
|
143
|
+
action: z.ZodLiteral<"vars">;
|
|
144
|
+
}, "strip", z.ZodTypeAny, {
|
|
145
|
+
action: "vars";
|
|
146
|
+
}, {
|
|
147
|
+
action: "vars";
|
|
148
|
+
}>, z.ZodObject<{
|
|
149
|
+
action: z.ZodLiteral<"stack">;
|
|
150
|
+
}, "strip", z.ZodTypeAny, {
|
|
151
|
+
action: "stack";
|
|
152
|
+
}, {
|
|
153
|
+
action: "stack";
|
|
154
|
+
}>, z.ZodObject<{
|
|
155
|
+
action: z.ZodLiteral<"eval">;
|
|
156
|
+
expression: z.ZodString;
|
|
157
|
+
}, "strip", z.ZodTypeAny, {
|
|
158
|
+
action: "eval";
|
|
159
|
+
expression: string;
|
|
160
|
+
}, {
|
|
161
|
+
action: "eval";
|
|
162
|
+
expression: string;
|
|
163
|
+
}>, z.ZodObject<{
|
|
164
|
+
action: z.ZodLiteral<"step">;
|
|
165
|
+
kind: z.ZodOptional<z.ZodEnum<["over", "into", "out"]>>;
|
|
166
|
+
}, "strip", z.ZodTypeAny, {
|
|
167
|
+
action: "step";
|
|
168
|
+
kind?: "over" | "into" | "out" | undefined;
|
|
169
|
+
}, {
|
|
170
|
+
action: "step";
|
|
171
|
+
kind?: "over" | "into" | "out" | undefined;
|
|
172
|
+
}>, z.ZodObject<{
|
|
173
|
+
action: z.ZodLiteral<"continue">;
|
|
174
|
+
}, "strip", z.ZodTypeAny, {
|
|
175
|
+
action: "continue";
|
|
176
|
+
}, {
|
|
177
|
+
action: "continue";
|
|
178
|
+
}>, z.ZodObject<{
|
|
179
|
+
action: z.ZodLiteral<"break">;
|
|
180
|
+
file: z.ZodString;
|
|
181
|
+
line: z.ZodNumber;
|
|
182
|
+
condition: z.ZodOptional<z.ZodString>;
|
|
183
|
+
}, "strip", z.ZodTypeAny, {
|
|
184
|
+
action: "break";
|
|
185
|
+
file: string;
|
|
186
|
+
line: number;
|
|
187
|
+
condition?: string | undefined;
|
|
188
|
+
}, {
|
|
189
|
+
action: "break";
|
|
190
|
+
file: string;
|
|
191
|
+
line: number;
|
|
192
|
+
condition?: string | undefined;
|
|
193
|
+
}>, z.ZodObject<{
|
|
194
|
+
action: z.ZodLiteral<"source">;
|
|
195
|
+
file: z.ZodOptional<z.ZodString>;
|
|
196
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
197
|
+
}, "strip", z.ZodTypeAny, {
|
|
198
|
+
action: "source";
|
|
199
|
+
file?: string | undefined;
|
|
200
|
+
line?: number | undefined;
|
|
201
|
+
}, {
|
|
202
|
+
action: "source";
|
|
203
|
+
file?: string | undefined;
|
|
204
|
+
line?: number | undefined;
|
|
205
|
+
}>, z.ZodObject<{
|
|
206
|
+
action: z.ZodLiteral<"status">;
|
|
207
|
+
}, "strip", z.ZodTypeAny, {
|
|
208
|
+
action: "status";
|
|
209
|
+
}, {
|
|
210
|
+
action: "status";
|
|
211
|
+
}>, z.ZodObject<{
|
|
212
|
+
action: z.ZodLiteral<"close">;
|
|
213
|
+
}, "strip", z.ZodTypeAny, {
|
|
214
|
+
action: "close";
|
|
215
|
+
}, {
|
|
216
|
+
action: "close";
|
|
217
|
+
}>]>;
|
|
218
|
+
export type Command = z.infer<typeof Command>;
|
|
219
|
+
export interface LocationInfo {
|
|
220
|
+
file: string;
|
|
221
|
+
line: number;
|
|
222
|
+
function: string;
|
|
223
|
+
}
|
|
224
|
+
export interface BreakpointInfo {
|
|
225
|
+
file: string;
|
|
226
|
+
line: number;
|
|
227
|
+
verified: boolean;
|
|
228
|
+
}
|
|
229
|
+
export interface VariableInfo {
|
|
230
|
+
name: string;
|
|
231
|
+
value: string;
|
|
232
|
+
type: string;
|
|
233
|
+
}
|
|
234
|
+
export interface CommandResult {
|
|
235
|
+
error?: string;
|
|
236
|
+
status?: string;
|
|
237
|
+
reason?: string;
|
|
238
|
+
location?: LocationInfo | null;
|
|
239
|
+
breakpoints?: BreakpointInfo[];
|
|
240
|
+
variables?: VariableInfo[];
|
|
241
|
+
count?: number;
|
|
242
|
+
frames?: LocationInfo[];
|
|
243
|
+
result?: string;
|
|
244
|
+
type?: string;
|
|
245
|
+
exitCode?: number | null;
|
|
246
|
+
source?: string;
|
|
247
|
+
file?: string;
|
|
248
|
+
line?: number;
|
|
249
|
+
verified?: boolean;
|
|
250
|
+
state?: string;
|
|
251
|
+
message?: string;
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/protocol.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAE/D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;EASvB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;EAA0C,CAAC;AACnE,eAAO,MAAM,YAAY;;;;;;EAA2C,CAAC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f,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** Daemon <-> CLI protocol schemas. Newline-delimited JSON. */
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
// --- Commands (CLI -> Daemon) ---
|
|
4
|
+
export const StartCommand = z.object({
|
|
5
|
+
action: z.literal("start"),
|
|
6
|
+
script: z.string(),
|
|
7
|
+
language: z.string().optional(),
|
|
8
|
+
breakpoints: z.array(z.string()).optional(),
|
|
9
|
+
runtime: z.string().optional(),
|
|
10
|
+
args: z.array(z.string()).optional(),
|
|
11
|
+
cwd: z.string().optional(),
|
|
12
|
+
stop_on_entry: z.boolean().optional(),
|
|
13
|
+
});
|
|
14
|
+
export const VarsCommand = z.object({ action: z.literal("vars") });
|
|
15
|
+
export const StackCommand = z.object({ action: z.literal("stack") });
|
|
16
|
+
export const EvalCommand = z.object({
|
|
17
|
+
action: z.literal("eval"),
|
|
18
|
+
expression: z.string(),
|
|
19
|
+
});
|
|
20
|
+
export const StepCommand = z.object({
|
|
21
|
+
action: z.literal("step"),
|
|
22
|
+
kind: z.enum(["over", "into", "out"]).optional(),
|
|
23
|
+
});
|
|
24
|
+
export const ContinueCommand = z.object({ action: z.literal("continue") });
|
|
25
|
+
export const BreakCommand = z.object({
|
|
26
|
+
action: z.literal("break"),
|
|
27
|
+
file: z.string(),
|
|
28
|
+
line: z.number(),
|
|
29
|
+
condition: z.string().optional(),
|
|
30
|
+
});
|
|
31
|
+
export const SourceCommand = z.object({
|
|
32
|
+
action: z.literal("source"),
|
|
33
|
+
file: z.string().optional(),
|
|
34
|
+
line: z.number().optional(),
|
|
35
|
+
});
|
|
36
|
+
export const StatusCommand = z.object({ action: z.literal("status") });
|
|
37
|
+
export const CloseCommand = z.object({ action: z.literal("close") });
|
|
38
|
+
export const Command = z.discriminatedUnion("action", [
|
|
39
|
+
StartCommand,
|
|
40
|
+
VarsCommand,
|
|
41
|
+
StackCommand,
|
|
42
|
+
EvalCommand,
|
|
43
|
+
StepCommand,
|
|
44
|
+
ContinueCommand,
|
|
45
|
+
BreakCommand,
|
|
46
|
+
SourceCommand,
|
|
47
|
+
StatusCommand,
|
|
48
|
+
CloseCommand,
|
|
49
|
+
]);
|
|
50
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/protocol.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAE/D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,mCAAmC;AAEnC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAC1B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC3C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACpC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ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