@agentclientprotocol/claude-agent-acp 0.85.2-preview.9 → 0.86.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/acp-agent.d.ts +56 -21
- package/dist/acp-agent.d.ts.map +1 -1
- package/dist/acp-agent.js +161 -34
- package/dist/clear-context-coordinator.d.ts +1 -0
- package/dist/clear-context-coordinator.d.ts.map +1 -1
- package/dist/clear-context-coordinator.js +2 -1
- package/dist/diff.d.ts +45 -8
- package/dist/diff.d.ts.map +1 -1
- package/dist/diff.js +111 -30
- package/dist/permissions/presentation.d.ts +17 -2
- package/dist/permissions/presentation.d.ts.map +1 -1
- package/dist/permissions/presentation.js +4 -0
- package/dist/session-config-ids.d.ts +1 -0
- package/dist/session-config-ids.d.ts.map +1 -1
- package/dist/session-config-ids.js +1 -0
- package/dist/tool-calls/client-capabilities.d.ts +20 -2
- package/dist/tool-calls/client-capabilities.d.ts.map +1 -1
- package/dist/tool-calls/client-capabilities.js +14 -4
- package/dist/tool-calls/facts.d.ts +8 -1
- package/dist/tool-calls/facts.d.ts.map +1 -1
- package/dist/tool-calls/renderer.d.ts +5 -1
- package/dist/tool-calls/renderer.d.ts.map +1 -1
- package/dist/tool-calls/renderer.js +14 -3
- package/dist/tool-calls/reporters/bash.d.ts.map +1 -1
- package/dist/tool-calls/reporters/bash.js +32 -5
- package/dist/tool-calls/reporters/file-edit.d.ts +1 -1
- package/dist/tool-calls/reporters/file-edit.d.ts.map +1 -1
- package/dist/tool-calls/reporters/file-edit.js +20 -14
- package/dist/v2/agent.d.ts +2 -0
- package/dist/v2/agent.d.ts.map +1 -1
- package/dist/v2/agent.js +109 -14
- package/dist/v2/initialize.d.ts +2 -5
- package/dist/v2/initialize.d.ts.map +1 -1
- package/dist/v2/initialize.js +42 -11
- package/dist/v2/permission.d.ts +25 -0
- package/dist/v2/permission.d.ts.map +1 -0
- package/dist/v2/permission.js +38 -0
- package/dist/v2/session-update.d.ts +6 -0
- package/dist/v2/session-update.d.ts.map +1 -1
- package/dist/v2/session-update.js +19 -0
- package/dist/v2/session.d.ts +29 -4
- package/dist/v2/session.d.ts.map +1 -1
- package/dist/v2/session.js +41 -6
- package/dist/v2/terminal.d.ts +42 -0
- package/dist/v2/terminal.d.ts.map +1 -0
- package/dist/v2/terminal.js +95 -0
- package/dist/v2/tool-call.d.ts +38 -0
- package/dist/v2/tool-call.d.ts.map +1 -0
- package/dist/v2/tool-call.js +49 -0
- package/package.json +1 -1
package/dist/diff.js
CHANGED
|
@@ -37,14 +37,14 @@ const NO_NEWLINE_MARKER = "\";
|
|
|
37
37
|
* normalizes quotes or fails.
|
|
38
38
|
*
|
|
39
39
|
* A Write always gets content that shows the change: the patch, the standard
|
|
40
|
-
* diff of a text that cannot have an exact patch, or
|
|
41
|
-
* overwrites a file that the adapter cannot show.
|
|
40
|
+
* diff (in v2, the change alone) of a text that cannot have an exact patch, or
|
|
41
|
+
* a notice that the Write overwrites a file that the adapter cannot show.
|
|
42
42
|
*
|
|
43
43
|
* The preview uses the tool input as it is. Claude can still remove the
|
|
44
44
|
* trailing whitespace of a line before it writes. The PostToolUse hook then
|
|
45
45
|
* sends the patch of the written file.
|
|
46
46
|
*/
|
|
47
|
-
export async function previewPatchContent(toolName, input, cwd) {
|
|
47
|
+
export async function previewPatchContent(toolName, input, cwd, form = "air") {
|
|
48
48
|
if (toolName === "Edit") {
|
|
49
49
|
const edit = input;
|
|
50
50
|
if (typeof edit.file_path !== "string" ||
|
|
@@ -67,7 +67,7 @@ export async function previewPatchContent(toolName, input, cwd) {
|
|
|
67
67
|
if (oldText !== null && (oldText.trim() !== "" || oldText.includes("\uFEFF"))) {
|
|
68
68
|
return undefined;
|
|
69
69
|
}
|
|
70
|
-
return
|
|
70
|
+
return exactPatch(filePath, oldText, newString, form);
|
|
71
71
|
}
|
|
72
72
|
if (oldText === null)
|
|
73
73
|
return undefined;
|
|
@@ -78,7 +78,7 @@ export async function previewPatchContent(toolName, input, cwd) {
|
|
|
78
78
|
return undefined;
|
|
79
79
|
}
|
|
80
80
|
const newText = replacedText(oldText, oldString, newString, edit.replace_all === true);
|
|
81
|
-
return
|
|
81
|
+
return exactPatch(filePath, oldText, newText, form);
|
|
82
82
|
}
|
|
83
83
|
if (toolName === "Write") {
|
|
84
84
|
const write = normalizeWriteInput(input);
|
|
@@ -104,12 +104,14 @@ export async function previewPatchContent(toolName, input, cwd) {
|
|
|
104
104
|
if (oldText === content)
|
|
105
105
|
return undefined;
|
|
106
106
|
const standard = [
|
|
107
|
-
|
|
107
|
+
form === "v2"
|
|
108
|
+
? v2DiffContent(filePath, oldText === null ? "create" : "update")
|
|
109
|
+
: { type: "diff", path: write.file_path, oldText, newText: content },
|
|
108
110
|
];
|
|
109
111
|
if (!isPatchableText(content))
|
|
110
112
|
return standard;
|
|
111
113
|
// A dense change can exceed the diff budget. The approval then shows the standard diff.
|
|
112
|
-
return
|
|
114
|
+
return exactPatch(filePath, oldText, content, form) ?? standard;
|
|
113
115
|
}
|
|
114
116
|
return undefined;
|
|
115
117
|
}
|
|
@@ -151,7 +153,7 @@ function replacedText(fileText, oldString, newString, replaceAll) {
|
|
|
151
153
|
* A written file that contains a CR or a byte order mark is declined, because
|
|
152
154
|
* Claude removed those bytes from `originalFile`.
|
|
153
155
|
*/
|
|
154
|
-
export async function patchUpdateFromDiffToolResponse(toolResponse) {
|
|
156
|
+
export async function patchUpdateFromDiffToolResponse(toolResponse, form = "air") {
|
|
155
157
|
if (!toolResponse || typeof toolResponse !== "object")
|
|
156
158
|
return undefined;
|
|
157
159
|
const response = toolResponse;
|
|
@@ -185,11 +187,11 @@ export async function patchUpdateFromDiffToolResponse(toolResponse) {
|
|
|
185
187
|
return undefined;
|
|
186
188
|
if (response.type === "create" && newText !== response.content)
|
|
187
189
|
return undefined;
|
|
188
|
-
const patch = filePatch(
|
|
190
|
+
const patch = filePatch(oldText, newText);
|
|
189
191
|
if (!patch)
|
|
190
192
|
return undefined;
|
|
191
193
|
return {
|
|
192
|
-
content: [patch
|
|
194
|
+
content: [patchContent(response.filePath, patch, form)],
|
|
193
195
|
// A created file keeps the location of its Write tool call.
|
|
194
196
|
locations: oldText === null
|
|
195
197
|
? [{ path: response.filePath }]
|
|
@@ -274,26 +276,75 @@ export function toolUpdateFromDiffToolResponse(toolResponse) {
|
|
|
274
276
|
result.locations = locations;
|
|
275
277
|
return result;
|
|
276
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* The ACP v2 diff of a finished Edit or Write: the exact patch of
|
|
281
|
+
* {@link patchUpdateFromDiffToolResponse} when it can be built, else the
|
|
282
|
+
* change with a patch from what the toolResponse holds.
|
|
283
|
+
*
|
|
284
|
+
* The fallback patch of an update comes from the `structuredPatch`, which is
|
|
285
|
+
* display data (see {@link patchUpdateFromDiffToolResponse}). That is enough
|
|
286
|
+
* for a v2 patch, which is renderable text, not a patch to apply. An update
|
|
287
|
+
* without hunks, such as one whose previous content was too large to diff,
|
|
288
|
+
* gets the change alone. An Edit with an empty `old_string` reports the same
|
|
289
|
+
* response for a created file and a filled empty one, so it gets no diff.
|
|
290
|
+
*/
|
|
291
|
+
export async function v2UpdateFromDiffToolResponse(toolResponse) {
|
|
292
|
+
const exact = await patchUpdateFromDiffToolResponse(toolResponse, "v2");
|
|
293
|
+
if (exact)
|
|
294
|
+
return exact;
|
|
295
|
+
if (!toolResponse || typeof toolResponse !== "object")
|
|
296
|
+
return {};
|
|
297
|
+
const response = toolResponse;
|
|
298
|
+
const filePath = response.filePath;
|
|
299
|
+
if (typeof filePath !== "string")
|
|
300
|
+
return {};
|
|
301
|
+
if (response.type === "create") {
|
|
302
|
+
const hunk = typeof response.content === "string" && isPatchableText(response.content)
|
|
303
|
+
? wholeFileHunk(response.content)
|
|
304
|
+
: undefined;
|
|
305
|
+
return {
|
|
306
|
+
content: [v2DiffContent(filePath, "create", hunk && [hunk])],
|
|
307
|
+
locations: [{ path: filePath }],
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
if (response.type === undefined && response.oldString === "" && response.originalFile === "") {
|
|
311
|
+
return {};
|
|
312
|
+
}
|
|
313
|
+
// A Write whose content is the previous text changed nothing.
|
|
314
|
+
if (response.type === "update" && response.content === response.originalFile)
|
|
315
|
+
return {};
|
|
316
|
+
const hunks = Array.isArray(response.structuredPatch) && response.structuredPatch.length > 0
|
|
317
|
+
? response.structuredPatch
|
|
318
|
+
: undefined;
|
|
319
|
+
return {
|
|
320
|
+
content: [v2DiffContent(filePath, "update", hunks)],
|
|
321
|
+
locations: hunks
|
|
322
|
+
? hunks.map(({ newStart }) => ({ path: filePath, line: newStart }))
|
|
323
|
+
: [{ path: filePath }],
|
|
324
|
+
};
|
|
325
|
+
}
|
|
277
326
|
/**
|
|
278
327
|
* The text of one git patch for `filePath`.
|
|
279
328
|
*
|
|
280
|
-
* The headers follow `git diff`: the path
|
|
281
|
-
*
|
|
282
|
-
*
|
|
329
|
+
* The headers follow `git diff`: the path is quoted when git would quote it,
|
|
330
|
+
* and a created file gets its mode line and a `/dev/null` side. With `git`
|
|
331
|
+
* paths, the path loses its leading slash and gets the `a/` and `b/` prefixes.
|
|
283
332
|
*/
|
|
284
|
-
export function gitPatchText(filePath, change, hunks) {
|
|
333
|
+
export function gitPatchText(filePath, change, hunks, paths = "git") {
|
|
285
334
|
return [
|
|
286
|
-
...gitPatchHeader(filePath, change),
|
|
335
|
+
...gitPatchHeader(filePath, change, paths),
|
|
287
336
|
...hunks.flatMap((hunk) => [hunkHeader(hunk), ...hunk.lines]),
|
|
288
337
|
"",
|
|
289
338
|
].join("\n");
|
|
290
339
|
}
|
|
291
|
-
function gitPatchHeader(filePath, change) {
|
|
292
|
-
//
|
|
293
|
-
//
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
const
|
|
340
|
+
function gitPatchHeader(filePath, change, paths) {
|
|
341
|
+
// A Windows path gets forward slashes so the header names the same file on
|
|
342
|
+
// every platform.
|
|
343
|
+
const slashed = filePath.replaceAll("\\", "/");
|
|
344
|
+
// git drops one leading slash of an absolute path.
|
|
345
|
+
const name = paths === "git" ? slashed.replace(/^\/+/u, "") : slashed;
|
|
346
|
+
const oldName = quoteGitPath(paths === "git" ? "a/" : "", name);
|
|
347
|
+
const newName = quoteGitPath(paths === "git" ? "b/" : "", name);
|
|
297
348
|
// git ends a ---/+++ name that contains a space with a tab, for GNU patch.
|
|
298
349
|
const tab = name.includes(" ") ? "\t" : "";
|
|
299
350
|
return [
|
|
@@ -400,15 +451,15 @@ function textLines(text) {
|
|
|
400
451
|
return text.match(/[^\n]*\n|[^\n]+$/g) ?? [];
|
|
401
452
|
}
|
|
402
453
|
/**
|
|
403
|
-
* The
|
|
404
|
-
* nothing changed or the diff runs out of
|
|
454
|
+
* The patch of a change from `oldText`, null for a missing file, to
|
|
455
|
+
* `newText`. Returns undefined when nothing changed or the diff runs out of
|
|
456
|
+
* its time budget.
|
|
405
457
|
*/
|
|
406
|
-
function filePatch(
|
|
458
|
+
function filePatch(oldText, newText) {
|
|
407
459
|
const hunks = diffHunks(oldText, newText);
|
|
408
460
|
if (!hunks || hunks.length === 0)
|
|
409
461
|
return undefined;
|
|
410
|
-
|
|
411
|
-
return { content: patchContent(filePath, gitPatchText(filePath, change, hunks)), hunks };
|
|
462
|
+
return { change: oldText === null ? "create" : "update", hunks };
|
|
412
463
|
}
|
|
413
464
|
/**
|
|
414
465
|
* Reads a file as patch input.
|
|
@@ -472,8 +523,16 @@ function isPatchableText(text) {
|
|
|
472
523
|
!text.includes("\0") &&
|
|
473
524
|
!text.includes("\r"));
|
|
474
525
|
}
|
|
475
|
-
|
|
476
|
-
|
|
526
|
+
/** The exact patch content of a change, or undefined when it has no patch. */
|
|
527
|
+
function exactPatch(filePath, oldText, newText, form) {
|
|
528
|
+
const patch = filePatch(oldText, newText);
|
|
529
|
+
return patch && [patchContent(filePath, patch, form)];
|
|
530
|
+
}
|
|
531
|
+
/** The content that carries a patch, in the given form. */
|
|
532
|
+
function patchContent(filePath, patch, form) {
|
|
533
|
+
return form === "v2"
|
|
534
|
+
? v2DiffContent(filePath, patch.change, patch.hunks)
|
|
535
|
+
: airPatchContent(filePath, patch);
|
|
477
536
|
}
|
|
478
537
|
/**
|
|
479
538
|
* A diff block in the AIR patch form.
|
|
@@ -481,7 +540,7 @@ function optionalContent(content) {
|
|
|
481
540
|
* `oldText: null` and `newText: ""` only satisfy the ACP schema. The adapter
|
|
482
541
|
* sends this form only to a client that advertised `diffPatch`.
|
|
483
542
|
*/
|
|
484
|
-
function
|
|
543
|
+
function airPatchContent(filePath, { change, hunks }) {
|
|
485
544
|
return {
|
|
486
545
|
type: "diff",
|
|
487
546
|
path: filePath,
|
|
@@ -490,10 +549,32 @@ function patchContent(filePath, text) {
|
|
|
490
549
|
_meta: withAirMeta(undefined, AIR_DIFF_PATCH_CAPABILITY, {
|
|
491
550
|
version: 1,
|
|
492
551
|
format: "git_patch",
|
|
493
|
-
text,
|
|
552
|
+
text: gitPatchText(filePath, change, hunks),
|
|
494
553
|
}),
|
|
495
554
|
};
|
|
496
555
|
}
|
|
556
|
+
/**
|
|
557
|
+
* The ACP v2 diff of a change to the text file `filePath`: the change and,
|
|
558
|
+
* given hunks, its git patch.
|
|
559
|
+
*
|
|
560
|
+
* The agent builds tool call content in v1 types, and v1 cannot express a v2
|
|
561
|
+
* diff, so the diff travels as v1 content. Nothing in the agent reads inside a
|
|
562
|
+
* diff, and only a v2 client gets one: the v2 surface sends it as it is
|
|
563
|
+
* (`src/v2/tool-call.ts`).
|
|
564
|
+
*/
|
|
565
|
+
export function v2DiffContent(filePath, change, hunks) {
|
|
566
|
+
const fileChange = change === "create"
|
|
567
|
+
? { operation: "add", path: filePath, fileType: "text" }
|
|
568
|
+
: { operation: "modify", path: filePath, fileType: "text" };
|
|
569
|
+
const diff = {
|
|
570
|
+
type: "diff",
|
|
571
|
+
changes: [fileChange],
|
|
572
|
+
...(hunks?.length
|
|
573
|
+
? { patch: { format: "git_patch", text: gitPatchText(filePath, change, hunks, "absolute") } }
|
|
574
|
+
: {}),
|
|
575
|
+
};
|
|
576
|
+
return diff;
|
|
577
|
+
}
|
|
497
578
|
function resolveToolPath(filePath, cwd) {
|
|
498
579
|
return path.isAbsolute(filePath) ? filePath : path.resolve(cwd ?? process.cwd(), filePath);
|
|
499
580
|
}
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import type { RequestPermissionRequest, ToolCallContent } from "@agentclientprotocol/sdk";
|
|
2
2
|
import { ClientCapabilities } from "../tool-calls/client-capabilities.js";
|
|
3
|
+
/**
|
|
4
|
+
* A permission request as the agent builds it. For a v2 client it also
|
|
5
|
+
* carries the heading and the explanation of the prompt, which ACP v2 sends as
|
|
6
|
+
* the request's `title` and `description`. v1 has no field for them; AIR gets
|
|
7
|
+
* them in `_meta`.
|
|
8
|
+
*/
|
|
9
|
+
export type AcpPermissionRequest = RequestPermissionRequest & {
|
|
10
|
+
/** The heading of the prompt. It is not the title of the tool call. */
|
|
11
|
+
title?: string;
|
|
12
|
+
/** Why the permission is asked. */
|
|
13
|
+
description?: string;
|
|
14
|
+
};
|
|
3
15
|
export interface ClaudePermissionPresentationInput {
|
|
4
16
|
toolName: string;
|
|
5
17
|
input: Record<string, unknown>;
|
|
6
18
|
toolUseID: string;
|
|
7
19
|
cwd?: string;
|
|
8
20
|
capabilities?: ClientCapabilities;
|
|
9
|
-
/** The exact patch of the change to approve, for a negotiated `diffPatch` client. */
|
|
21
|
+
/** The exact patch of the change to approve, for a negotiated `diffPatch` client or a v2 client. */
|
|
10
22
|
previewContent?: ToolCallContent[];
|
|
11
23
|
blockedPath?: string;
|
|
12
24
|
title?: string;
|
|
@@ -22,6 +34,9 @@ export interface ClaudePermissionPresentationInput {
|
|
|
22
34
|
* adapter emits the `tool_call` before the request, so the client already
|
|
23
35
|
* holds the rest. The request adds only what it shows new: the exact preview
|
|
24
36
|
* patch, and the blocked path when the tool call has no such location.
|
|
37
|
+
*
|
|
38
|
+
* The heading and the explanation of the prompt go to AIR in `_meta`, and to a
|
|
39
|
+
* v2 client as `title` and `description`.
|
|
25
40
|
*/
|
|
26
|
-
export declare function buildClaudePermissionPresentation(value: ClaudePermissionPresentationInput): Pick<
|
|
41
|
+
export declare function buildClaudePermissionPresentation(value: ClaudePermissionPresentationInput): Pick<AcpPermissionRequest, "toolCall" | "_meta" | "title" | "description">;
|
|
27
42
|
//# sourceMappingURL=presentation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation.d.ts","sourceRoot":"","sources":["../../src/permissions/presentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E,MAAM,WAAW,iCAAiC;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,
|
|
1
|
+
{"version":3,"file":"presentation.d.ts","sourceRoot":"","sources":["../../src/permissions/presentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GAAG;IAC5D,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,iCAAiC;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,oGAAoG;IACpG,cAAc,CAAC,EAAE,eAAe,EAAE,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA0BD;;;;;;;;;;GAUG;AACH,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,iCAAiC,GACvC,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,aAAa,CAAC,CAiE5E"}
|
|
@@ -29,6 +29,9 @@ function compactText(value) {
|
|
|
29
29
|
* adapter emits the `tool_call` before the request, so the client already
|
|
30
30
|
* holds the rest. The request adds only what it shows new: the exact preview
|
|
31
31
|
* patch, and the blocked path when the tool call has no such location.
|
|
32
|
+
*
|
|
33
|
+
* The heading and the explanation of the prompt go to AIR in `_meta`, and to a
|
|
34
|
+
* v2 client as `title` and `description`.
|
|
32
35
|
*/
|
|
33
36
|
export function buildClaudePermissionPresentation(value) {
|
|
34
37
|
const capabilities = value.capabilities ?? new ClientCapabilities();
|
|
@@ -89,5 +92,6 @@ export function buildClaudePermissionPresentation(value) {
|
|
|
89
92
|
}),
|
|
90
93
|
}
|
|
91
94
|
: {}),
|
|
95
|
+
...(capabilities.v2 ? { title, ...(description ? { description } : {}) } : {}),
|
|
92
96
|
};
|
|
93
97
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Shared sentinels and ids for session preferences managed by the adapter. */
|
|
2
2
|
export declare const DEFAULT_MODEL_ID = "default";
|
|
3
|
+
export declare const DEFAULT_AGENT_ID = "default";
|
|
3
4
|
export declare const EFFORT_CONFIG_ID = "effort";
|
|
4
5
|
//# sourceMappingURL=session-config-ids.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-config-ids.d.ts","sourceRoot":"","sources":["../src/session-config-ids.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAC1C,eAAO,MAAM,gBAAgB,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"session-config-ids.d.ts","sourceRoot":"","sources":["../src/session-config-ids.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAC1C,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAC1C,eAAO,MAAM,gBAAgB,WAAW,CAAC"}
|
|
@@ -16,6 +16,14 @@ export declare class ClientCapabilities {
|
|
|
16
16
|
readonly diffPatch: boolean;
|
|
17
17
|
/** The capabilities that only JetBrains AIR declares. */
|
|
18
18
|
readonly air: AirCapabilities;
|
|
19
|
+
/**
|
|
20
|
+
* The client speaks ACP v2. Its diffs carry structured `changes` and an
|
|
21
|
+
* optional git patch, which a v1 diff cannot express. Only the v2 surface
|
|
22
|
+
* sets this, never the capabilities that a client sends. A v2 client also
|
|
23
|
+
* takes the terminal extension (`terminalOutput`), which the v2 surface
|
|
24
|
+
* sends as display terminals.
|
|
25
|
+
*/
|
|
26
|
+
readonly v2: boolean;
|
|
19
27
|
constructor(
|
|
20
28
|
/** The client renders a terminal from `_meta.terminal_info`, `terminal_output`, and `terminal_exit`. */
|
|
21
29
|
terminalOutput?: boolean,
|
|
@@ -24,8 +32,18 @@ export declare class ClientCapabilities {
|
|
|
24
32
|
/** The client accepts an exact git patch in a diff (`jetbrains.air` `diffPatch`). */
|
|
25
33
|
diffPatch?: boolean,
|
|
26
34
|
/** The capabilities that only JetBrains AIR declares. */
|
|
27
|
-
air?: AirCapabilities
|
|
28
|
-
|
|
35
|
+
air?: AirCapabilities,
|
|
36
|
+
/**
|
|
37
|
+
* The client speaks ACP v2. Its diffs carry structured `changes` and an
|
|
38
|
+
* optional git patch, which a v1 diff cannot express. Only the v2 surface
|
|
39
|
+
* sets this, never the capabilities that a client sends. A v2 client also
|
|
40
|
+
* takes the terminal extension (`terminalOutput`), which the v2 surface
|
|
41
|
+
* sends as display terminals.
|
|
42
|
+
*/
|
|
43
|
+
v2?: boolean);
|
|
44
|
+
static from(capabilities: AcpClientCapabilities | null | undefined, { v2 }?: {
|
|
45
|
+
v2?: boolean;
|
|
46
|
+
}): ClientCapabilities;
|
|
29
47
|
}
|
|
30
48
|
/** The capabilities of JetBrains AIR, read from `_meta.jetbrains.air`. */
|
|
31
49
|
export interface AirCapabilities {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-capabilities.d.ts","sourceRoot":"","sources":["../../src/tool-calls/client-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,IAAI,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAS5F;;;;;;;GAOG;AACH,qBAAa,kBAAkB;IAE3B,wGAAwG;IACxG,QAAQ,CAAC,cAAc,EAAE,OAAO;IAChC,4FAA4F;IAC5F,QAAQ,CAAC,mBAAmB,EAAE,OAAO;IACrC,qFAAqF;IACrF,QAAQ,CAAC,SAAS,EAAE,OAAO;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,GAAG,EAAE,eAAe;;
|
|
1
|
+
{"version":3,"file":"client-capabilities.d.ts","sourceRoot":"","sources":["../../src/tool-calls/client-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,IAAI,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAS5F;;;;;;;GAOG;AACH,qBAAa,kBAAkB;IAE3B,wGAAwG;IACxG,QAAQ,CAAC,cAAc,EAAE,OAAO;IAChC,4FAA4F;IAC5F,QAAQ,CAAC,mBAAmB,EAAE,OAAO;IACrC,qFAAqF;IACrF,QAAQ,CAAC,SAAS,EAAE,OAAO;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,GAAG,EAAE,eAAe;IAC7B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,EAAE,OAAO;;IAfpB,wGAAwG;IAC/F,cAAc,GAAE,OAAe;IACxC,4FAA4F;IACnF,mBAAmB,GAAE,OAAe;IAC7C,qFAAqF;IAC5E,SAAS,GAAE,OAAe;IACnC,yDAAyD;IAChD,GAAG,GAAE,eAAwB;IACtC;;;;;;OAMG;IACM,EAAE,GAAE,OAAe;IAG9B,MAAM,CAAC,IAAI,CACT,YAAY,EAAE,qBAAqB,GAAG,IAAI,GAAG,SAAS,EACtD,EAAE,EAAU,EAAE,GAAE;QAAE,EAAE,CAAC,EAAE,OAAO,CAAA;KAAO,GACpC,kBAAkB;CAkBtB;AAED,0EAA0E;AAC1E,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B"}
|
|
@@ -12,6 +12,7 @@ export class ClientCapabilities {
|
|
|
12
12
|
terminalOutputDelta;
|
|
13
13
|
diffPatch;
|
|
14
14
|
air;
|
|
15
|
+
v2;
|
|
15
16
|
constructor(
|
|
16
17
|
/** The client renders a terminal from `_meta.terminal_info`, `terminal_output`, and `terminal_exit`. */
|
|
17
18
|
terminalOutput = false,
|
|
@@ -20,20 +21,29 @@ export class ClientCapabilities {
|
|
|
20
21
|
/** The client accepts an exact git patch in a diff (`jetbrains.air` `diffPatch`). */
|
|
21
22
|
diffPatch = false,
|
|
22
23
|
/** The capabilities that only JetBrains AIR declares. */
|
|
23
|
-
air = NO_AIR
|
|
24
|
+
air = NO_AIR,
|
|
25
|
+
/**
|
|
26
|
+
* The client speaks ACP v2. Its diffs carry structured `changes` and an
|
|
27
|
+
* optional git patch, which a v1 diff cannot express. Only the v2 surface
|
|
28
|
+
* sets this, never the capabilities that a client sends. A v2 client also
|
|
29
|
+
* takes the terminal extension (`terminalOutput`), which the v2 surface
|
|
30
|
+
* sends as display terminals.
|
|
31
|
+
*/
|
|
32
|
+
v2 = false) {
|
|
24
33
|
this.terminalOutput = terminalOutput;
|
|
25
34
|
this.terminalOutputDelta = terminalOutputDelta;
|
|
26
35
|
this.diffPatch = diffPatch;
|
|
27
36
|
this.air = air;
|
|
37
|
+
this.v2 = v2;
|
|
28
38
|
}
|
|
29
|
-
static from(capabilities) {
|
|
39
|
+
static from(capabilities, { v2 = false } = {}) {
|
|
30
40
|
const meta = capabilities?._meta;
|
|
31
41
|
const terminalOutputDelta = meta?.["terminal_output_delta"] === true;
|
|
32
|
-
return new ClientCapabilities(terminalOutputDelta || meta?.["terminal_output"] === true, terminalOutputDelta, clientSupportsAirCapability(capabilities, AIR_DIFF_PATCH_CAPABILITY), {
|
|
42
|
+
return new ClientCapabilities(v2 || terminalOutputDelta || meta?.["terminal_output"] === true, terminalOutputDelta, clientSupportsAirCapability(capabilities, AIR_DIFF_PATCH_CAPABILITY), {
|
|
33
43
|
client: isAirClient(capabilities),
|
|
34
44
|
rawInputRendering: clientSupportsAirCapability(capabilities, AIR_RAW_INPUT_RENDERING_CAPABILITY),
|
|
35
45
|
planFile: clientSupportsAirCapability(capabilities, AIR_PLAN_FILE_CAPABILITY),
|
|
36
|
-
});
|
|
46
|
+
}, v2);
|
|
37
47
|
}
|
|
38
48
|
}
|
|
39
49
|
const NO_AIR = {
|
|
@@ -41,7 +41,14 @@ export interface ToolUseFacts {
|
|
|
41
41
|
/** The output of a command, for the terminal channel. */
|
|
42
42
|
export interface CommandOutput {
|
|
43
43
|
output: string;
|
|
44
|
-
|
|
44
|
+
/**
|
|
45
|
+
* The exit code of the command, when the tool result says it. Absent when it
|
|
46
|
+
* does not: a failure that names no code, an interrupted or backgrounded
|
|
47
|
+
* command, or a non-zero code that Claude Code accepted as a success.
|
|
48
|
+
*/
|
|
49
|
+
exitCode?: number;
|
|
50
|
+
/** The command was interrupted before it ended. */
|
|
51
|
+
interrupted?: boolean;
|
|
45
52
|
}
|
|
46
53
|
/**
|
|
47
54
|
* The facts of a tool result, read once from the SDK tool_result.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facts.d.ts","sourceRoot":"","sources":["../../src/tool-calls/facts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAC5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,wCAAwC;AACxC,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,6DAA6D;IAC7D,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;IAC3B;;;;OAIG;IACH,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC;;;;OAIG;IACH,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,wEAAwE;IACxE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,yDAAyD;AACzD,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"facts.d.ts","sourceRoot":"","sources":["../../src/tool-calls/facts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,0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AAED,+DAA+D;AAC/D,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,kBAAkB,CAAC;IACjC;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,qDAAqD;AACrD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,iCAAiC;IACjC,MAAM,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/E,6EAA6E;IAC7E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,kBAAkB,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,GAAG,YAAY,CAAC;IAC/D;;;OAGG;IACH,UAAU,CAAC,CAAC,OAAO,EAAE,iBAAiB,GAAG,eAAe,CAAC;IACzD;;;OAGG;IACH,WAAW,CAAC,CAAC,OAAO,EAAE,iBAAiB,GAAG,eAAe,GAAG,SAAS,CAAC;IACtE;;;OAGG;IACH,UAAU,CAAC,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACvF"}
|
|
@@ -41,7 +41,11 @@ export type ToolUpdateMeta = {
|
|
|
41
41
|
};
|
|
42
42
|
terminal_exit?: {
|
|
43
43
|
terminal_id: string;
|
|
44
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Null when the agent does not know the code, as in `TerminalExitStatus`.
|
|
46
|
+
* AIR always gets a number.
|
|
47
|
+
*/
|
|
48
|
+
exit_code: number | null;
|
|
45
49
|
signal: string | null;
|
|
46
50
|
};
|
|
47
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file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B,CAAC,EAAE,MAAM,CAAC;QAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,cAAc;IA0BlB;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,GAAG,cAAc;IAsBlB;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO;IAgBzD;;;;OAIG;IACH,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,eAAe,EAAE;IAS1E;;;;;OAKG;IACH,WAAW,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,cAAc;CA0BtF"}
|
|
@@ -118,8 +118,9 @@ export class AcpToolCallRenderer {
|
|
|
118
118
|
permissionToolCall(toolUse, options = {}) {
|
|
119
119
|
const facts = this.facts(toolUse, options.cwd);
|
|
120
120
|
if (!this.capabilities.air.client) {
|
|
121
|
-
// The upstream shape: the whole tool call again.
|
|
122
|
-
|
|
121
|
+
// The upstream shape: the whole tool call again. A v2 client also gets
|
|
122
|
+
// the exact preview patch, which the tool call does not show.
|
|
123
|
+
const content = options.previewContent ?? this.toolUseContent(toolUse.id, facts);
|
|
123
124
|
const locations = [...(facts.locations ?? []), ...(options.extraLocations ?? [])];
|
|
124
125
|
return {
|
|
125
126
|
toolCallId: toolUse.id,
|
|
@@ -191,7 +192,17 @@ export class AcpToolCallRenderer {
|
|
|
191
192
|
...(this.capabilities.terminalOutputDelta
|
|
192
193
|
? { terminal_output_delta: output }
|
|
193
194
|
: { terminal_output: output }),
|
|
194
|
-
terminal_exit: {
|
|
195
|
+
terminal_exit: {
|
|
196
|
+
terminal_id: terminalId,
|
|
197
|
+
// AIR keeps the numbers it always got: 1 for a failed or
|
|
198
|
+
// interrupted command, else the exit code, or 0 when unknown.
|
|
199
|
+
exit_code: this.capabilities.air.client
|
|
200
|
+
? result.is_error === true || command.interrupted
|
|
201
|
+
? 1
|
|
202
|
+
: (command.exitCode ?? 0)
|
|
203
|
+
: (command.exitCode ?? null),
|
|
204
|
+
signal: null,
|
|
205
|
+
},
|
|
195
206
|
},
|
|
196
207
|
};
|
|
197
208
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../../src/tool-calls/reporters/bash.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAElG,gFAAgF;AAChF,qBAAa,YAAa,YAAW,YAAY;IAC/C,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY;IAUrC,iFAAiF;IACjF,WAAW,CAAC,OAAO,EAAE,iBAAiB,GAAG,eAAe,GAAG,SAAS;IAIpE,UAAU,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,iBAAiB,GAAG,eAAe;
|
|
1
|
+
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../../src/tool-calls/reporters/bash.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAElG,gFAAgF;AAChF,qBAAa,YAAa,YAAW,YAAY;IAC/C,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY;IAUrC,iFAAiF;IACjF,WAAW,CAAC,OAAO,EAAE,iBAAiB,GAAG,eAAe,GAAG,SAAS;IAIpE,UAAU,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,iBAAiB,GAAG,eAAe;CAsFvE"}
|
|
@@ -30,7 +30,11 @@ export class BashReporter {
|
|
|
30
30
|
// 4. Array content: text blocks for stdout, or image blocks when the
|
|
31
31
|
// command produces an image.
|
|
32
32
|
let output = "";
|
|
33
|
-
|
|
33
|
+
// Claude Code accepts a non-zero code as a success only with a
|
|
34
|
+
// `returnCodeInterpretation` (grep's "No matches found"), so a success
|
|
35
|
+
// without one exited with 0.
|
|
36
|
+
let exitCode = isError ? undefined : 0;
|
|
37
|
+
let interrupted = false;
|
|
34
38
|
const structuredBash = structuredResult(structured);
|
|
35
39
|
if (structuredBash &&
|
|
36
40
|
typeof structuredBash.stdout === "string" &&
|
|
@@ -38,12 +42,15 @@ export class BashReporter {
|
|
|
38
42
|
!structuredBash.isImage &&
|
|
39
43
|
structuredBash.backgroundTaskId === undefined) {
|
|
40
44
|
output = [structuredBash.stdout, structuredBash.stderr].filter(Boolean).join("\n");
|
|
41
|
-
// The CLI appends its abort marker only to the model-facing text
|
|
42
|
-
//
|
|
45
|
+
// The CLI appends its abort marker only to the model-facing text. The
|
|
46
|
+
// result does not carry the code of the aborted command.
|
|
43
47
|
if (structuredBash.interrupted) {
|
|
44
48
|
output = [output, "[Command was aborted before completion]"].filter(Boolean).join("\n");
|
|
45
|
-
exitCode =
|
|
49
|
+
exitCode = undefined;
|
|
50
|
+
interrupted = true;
|
|
46
51
|
}
|
|
52
|
+
if (structuredBash.returnCodeInterpretation !== undefined)
|
|
53
|
+
exitCode = undefined;
|
|
47
54
|
// Structured stdout is clipped when the full output was persisted to
|
|
48
55
|
// disk. Without this note the clip is silent.
|
|
49
56
|
if (typeof structuredBash.persistedOutputPath === "string") {
|
|
@@ -78,6 +85,26 @@ export class BashReporter {
|
|
|
78
85
|
}
|
|
79
86
|
output = content.map((c) => c.text).join("\n");
|
|
80
87
|
}
|
|
81
|
-
|
|
88
|
+
if (isError && exitCode === undefined)
|
|
89
|
+
exitCode = failureExitCode(output);
|
|
90
|
+
// A backgrounded command is still running: the result only announces it.
|
|
91
|
+
if (structuredBash?.backgroundTaskId !== undefined)
|
|
92
|
+
exitCode = undefined;
|
|
93
|
+
return {
|
|
94
|
+
command: {
|
|
95
|
+
output,
|
|
96
|
+
...(exitCode !== undefined ? { exitCode } : {}),
|
|
97
|
+
...(interrupted ? { interrupted } : {}),
|
|
98
|
+
},
|
|
99
|
+
};
|
|
82
100
|
}
|
|
83
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* The exit code that the text of a failed command names. Claude Code starts the
|
|
104
|
+
* text of a command that exited with a failing code with `Exit code N`. Other
|
|
105
|
+
* failures, such as a denial or a command that could not start, name none.
|
|
106
|
+
*/
|
|
107
|
+
function failureExitCode(text) {
|
|
108
|
+
const match = /^Exit code (\d+)(?:\n|$)/.exec(text);
|
|
109
|
+
return match ? Number(match[1]) : undefined;
|
|
110
|
+
}
|
|
@@ -22,7 +22,7 @@ type NormalizedWriteInput = Partial<FileWriteInput> & {
|
|
|
22
22
|
export declare function normalizeWriteInput(input: unknown): NormalizedWriteInput | undefined;
|
|
23
23
|
/** Edit: the diff holds the old and the new text. */
|
|
24
24
|
export declare class EditReporter implements ToolReporter {
|
|
25
|
-
toolUse(input: unknown, { cwd }: ToolUseContext): ToolUseFacts;
|
|
25
|
+
toolUse(input: unknown, { cwd, capabilities }: ToolUseContext): ToolUseFacts;
|
|
26
26
|
toolResult(): ToolResultFacts;
|
|
27
27
|
hookResult(toolResponse: unknown, context: ToolUseContext): Promise<ToolResultFacts>;
|
|
28
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-edit.d.ts","sourceRoot":"","sources":["../../../src/tool-calls/reporters/file-edit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,cAAc,EAEf,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"file-edit.d.ts","sourceRoot":"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