@agentclientprotocol/claude-agent-acp 0.85.2-preview.19 → 0.85.2-preview.3

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.
Files changed (62) hide show
  1. package/README.md +0 -1
  2. package/dist/acp-agent.d.ts +18 -81
  3. package/dist/acp-agent.d.ts.map +1 -1
  4. package/dist/acp-agent.js +170 -435
  5. package/dist/air-extension.d.ts +0 -2
  6. package/dist/air-extension.d.ts.map +1 -1
  7. package/dist/air-extension.js +0 -2
  8. package/dist/diff.d.ts +8 -45
  9. package/dist/diff.d.ts.map +1 -1
  10. package/dist/diff.js +30 -111
  11. package/dist/permissions/presentation.d.ts +2 -17
  12. package/dist/permissions/presentation.d.ts.map +1 -1
  13. package/dist/permissions/presentation.js +0 -4
  14. package/dist/resumed-session.d.ts +6 -16
  15. package/dist/resumed-session.d.ts.map +1 -1
  16. package/dist/resumed-session.js +25 -91
  17. package/dist/session-mode.d.ts +0 -14
  18. package/dist/session-mode.d.ts.map +1 -1
  19. package/dist/session-mode.js +0 -22
  20. package/dist/tool-calls/client-capabilities.d.ts +2 -20
  21. package/dist/tool-calls/client-capabilities.d.ts.map +1 -1
  22. package/dist/tool-calls/client-capabilities.js +4 -14
  23. package/dist/tool-calls/renderer.d.ts.map +1 -1
  24. package/dist/tool-calls/renderer.js +2 -3
  25. package/dist/tool-calls/reporters/file-edit.d.ts +1 -1
  26. package/dist/tool-calls/reporters/file-edit.d.ts.map +1 -1
  27. package/dist/tool-calls/reporters/file-edit.js +14 -20
  28. package/dist/turn-events.d.ts +5 -11
  29. package/dist/turn-events.d.ts.map +1 -1
  30. package/dist/usage-markdown.d.ts +0 -2
  31. package/dist/usage-markdown.d.ts.map +1 -1
  32. package/dist/usage-markdown.js +1 -2
  33. package/dist/utils.d.ts +0 -12
  34. package/dist/utils.d.ts.map +1 -1
  35. package/dist/utils.js +0 -28
  36. package/dist/v2/agent.d.ts.map +1 -1
  37. package/dist/v2/agent.js +17 -121
  38. package/dist/v2/initialize.d.ts +5 -2
  39. package/dist/v2/initialize.d.ts.map +1 -1
  40. package/dist/v2/initialize.js +6 -23
  41. package/dist/v2/session-update.d.ts +0 -6
  42. package/dist/v2/session-update.d.ts.map +1 -1
  43. package/dist/v2/session-update.js +0 -27
  44. package/dist/v2/session.d.ts +4 -15
  45. package/dist/v2/session.d.ts.map +1 -1
  46. package/dist/v2/session.js +6 -20
  47. package/package.json +2 -2
  48. package/dist/mcp-command.d.ts +0 -51
  49. package/dist/mcp-command.d.ts.map +0 -1
  50. package/dist/mcp-command.js +0 -321
  51. package/dist/v2/permission.d.ts +0 -25
  52. package/dist/v2/permission.d.ts.map +0 -1
  53. package/dist/v2/permission.js +0 -38
  54. package/dist/v2/prompt.d.ts +0 -47
  55. package/dist/v2/prompt.d.ts.map +0 -1
  56. package/dist/v2/prompt.js +0 -153
  57. package/dist/v2/terminal.d.ts +0 -42
  58. package/dist/v2/terminal.d.ts.map +0 -1
  59. package/dist/v2/terminal.js +0 -95
  60. package/dist/v2/tool-call.d.ts +0 -38
  61. package/dist/v2/tool-call.d.ts.map +0 -1
  62. package/dist/v2/tool-call.js +0 -49
@@ -41,20 +41,6 @@ type InitializeSessionModeParams = {
41
41
  /** When false, bypassPermissions is omitted from the mode catalog. */
42
42
  allowBypass: boolean;
43
43
  };
44
- /**
45
- * The permission mode a new Claude query starts in.
46
- *
47
- * An explicit mode wins. A resume or a load continues in the mode of the last
48
- * user record of the transcript. If that mode is unknown or not available now,
49
- * for example bypass, the session starts in `defaultMode` of the settings.
50
- */
51
- export declare function resolveInitialPermissionMode(sources: {
52
- explicit?: PermissionMode;
53
- resumed?: string;
54
- defaultMode?: unknown;
55
- }, logger: {
56
- error: (...args: unknown[]) => void;
57
- }, allowBypass: boolean): PermissionMode;
58
44
  /** Owns session-mode policy and the ACP/SDK synchronization it requires. */
59
45
  export declare class SessionModeManager<S extends SessionMode> {
60
46
  private readonly options;
@@ -1 +1 @@
1
- {"version":3,"file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;IAS9E,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO9D,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAuB9E,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlF,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,SAAS;IAcjB,OAAO,CAAC,mBAAmB;YA4Cb,WAAW;CAW1B"}
@@ -1,6 +1,5 @@
1
1
  import { RequestError, } from "@agentclientprotocol/sdk";
2
2
  import { AIR_KIND_KEY, airOnlyMeta } from "./air-extension.js";
3
- import { resolvePermissionMode } from "./permissions/modes.js";
4
3
  import { noticeOrTranscriptUpdate, noticeTranscriptText, sentenceCase, } from "./session-notices.js";
5
4
  export const MODE_CONFIG_ID = "mode";
6
5
  export const AUTO_MODE_FALLBACK = "acceptEdits";
@@ -12,27 +11,6 @@ const AUTO_MODE_FALLBACK_NOTICE = {
12
11
  title: "Auto mode unavailable",
13
12
  description: sentenceCase(AUTO_MODE_FALLBACK_REASON),
14
13
  };
15
- /**
16
- * The permission mode a new Claude query starts in.
17
- *
18
- * An explicit mode wins. A resume or a load continues in the mode of the last
19
- * user record of the transcript. If that mode is unknown or not available now,
20
- * for example bypass, the session starts in `defaultMode` of the settings.
21
- */
22
- export function resolveInitialPermissionMode(sources, logger, allowBypass) {
23
- if (sources.explicit !== undefined) {
24
- return resolvePermissionMode(sources.explicit, logger, allowBypass);
25
- }
26
- if (sources.resumed !== undefined) {
27
- let rejected = false;
28
- const mode = resolvePermissionMode(sources.resumed, { error: () => (rejected = true) }, allowBypass);
29
- if (!rejected)
30
- return mode;
31
- logger.error(`Ignoring permission mode "${sources.resumed}" of the resumed transcript: ` +
32
- `not available in this session.`);
33
- }
34
- return resolvePermissionMode(sources.defaultMode, logger, allowBypass);
35
- }
36
14
  /** Owns session-mode policy and the ACP/SDK synchronization it requires. */
37
15
  export class SessionModeManager {
38
16
  options;
@@ -16,14 +16,6 @@ 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;
27
19
  constructor(
28
20
  /** The client renders a terminal from `_meta.terminal_info`, `terminal_output`, and `terminal_exit`. */
29
21
  terminalOutput?: boolean,
@@ -32,18 +24,8 @@ export declare class ClientCapabilities {
32
24
  /** The client accepts an exact git patch in a diff (`jetbrains.air` `diffPatch`). */
33
25
  diffPatch?: boolean,
34
26
  /** The capabilities that only JetBrains AIR declares. */
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;
27
+ air?: AirCapabilities);
28
+ static from(capabilities: AcpClientCapabilities | null | undefined): ClientCapabilities;
47
29
  }
48
30
  /** The capabilities of JetBrains AIR, read from `_meta.jetbrains.air`. */
49
31
  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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,CAAC,mBAAmB,EAAE,OAAO;IACrC,qFAAqF;IACrF,QAAQ,CAAC,SAAS,EAAE,OAAO;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,GAAG,EAAE,eAAe;;IAP7B,wGAAwG;IAC/F,cAAc,GAAE,OAAe;IACxC,4FAA4F;IACnF,mBAAmB,GAAE,OAAe;IAC7C,qFAAqF;IAC5E,SAAS,GAAE,OAAe;IACnC,yDAAyD;IAChD,GAAG,GAAE,eAAwB;IAGxC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,qBAAqB,GAAG,IAAI,GAAG,SAAS,GAAG,kBAAkB;CAiBxF;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,7 +12,6 @@ export class ClientCapabilities {
12
12
  terminalOutputDelta;
13
13
  diffPatch;
14
14
  air;
15
- v2;
16
15
  constructor(
17
16
  /** The client renders a terminal from `_meta.terminal_info`, `terminal_output`, and `terminal_exit`. */
18
17
  terminalOutput = false,
@@ -21,29 +20,20 @@ export class ClientCapabilities {
21
20
  /** The client accepts an exact git patch in a diff (`jetbrains.air` `diffPatch`). */
22
21
  diffPatch = false,
23
22
  /** The capabilities that only JetBrains AIR declares. */
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) {
23
+ air = NO_AIR) {
33
24
  this.terminalOutput = terminalOutput;
34
25
  this.terminalOutputDelta = terminalOutputDelta;
35
26
  this.diffPatch = diffPatch;
36
27
  this.air = air;
37
- this.v2 = v2;
38
28
  }
39
- static from(capabilities, { v2 = false } = {}) {
29
+ static from(capabilities) {
40
30
  const meta = capabilities?._meta;
41
31
  const terminalOutputDelta = meta?.["terminal_output_delta"] === true;
42
- return new ClientCapabilities(v2 || terminalOutputDelta || meta?.["terminal_output"] === true, terminalOutputDelta, clientSupportsAirCapability(capabilities, AIR_DIFF_PATCH_CAPABILITY), {
32
+ return new ClientCapabilities(terminalOutputDelta || meta?.["terminal_output"] === true, terminalOutputDelta, clientSupportsAirCapability(capabilities, AIR_DIFF_PATCH_CAPABILITY), {
43
33
  client: isAirClient(capabilities),
44
34
  rawInputRendering: clientSupportsAirCapability(capabilities, AIR_RAW_INPUT_RENDERING_CAPABILITY),
45
35
  planFile: clientSupportsAirCapability(capabilities, AIR_PLAN_FILE_CAPABILITY),
46
- }, v2);
36
+ });
47
37
  }
48
38
  }
49
39
  const NO_AIR = {
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/tool-calls/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,IAAI,qBAAqB,EAC3C,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI5F,MAAM,MAAM,cAAc,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;AAK3D,yCAAyC;AACzC,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,CAAC,EAAE;QAIX,QAAQ,CAAC,EAAE,MAAM,CAAC;QAIlB,YAAY,CAAC,EAAE,OAAO,CAAC;QAIvB,eAAe,CAAC,EAAE,MAAM,CAAC;QAMzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAG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AG,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,9 +118,8 @@ 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. 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);
121
+ // The upstream shape: the whole tool call again.
122
+ const content = this.toolUseContent(toolUse.id, facts);
124
123
  const locations = [...(facts.locations ?? []), ...(options.extraLocations ?? [])];
125
124
  return {
126
125
  toolCallId: toolUse.id,
@@ -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, capabilities }: ToolUseContext): ToolUseFacts;
25
+ toolUse(input: unknown, { cwd }: 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;AAQrD,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,YAAY,EACb,MAAM,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Aa,CAAC;AAErB;;;GAGG;AACH,qBAAa,aAAc,YAAW,YAAY;IAChD,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,cAAc,GAAG,YAAY;IAiCpF,UAAU,IAAI,eAAe;IAI7B,UAAU,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;CAGrF;AAED,yFAAyF;AACzF,KAAK,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAI9E;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,GAAG,SAAS,CAYpF;AAED,qDAAqD;AACrD,qBAAa,YAAa,YAAW,YAAY;IAC/C,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE,cAAc,GAAG,YAAY;IAyB9D,UAAU,IAAI,eAAe;IAI7B,UAAU,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;CAGrF;AAwCD;;;;;;;GAOG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IACvD,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,YAAY,EAAE,EAAE,cAAc,GAAG,YAAY;IAsB5E;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,eAAe;CAMxD"}
@@ -1,4 +1,4 @@
1
- import { patchUpdateFromDiffToolResponse, toolUpdateFromDiffToolResponse, v2UpdateFromDiffToolResponse, } from "../../diff.js";
1
+ import { patchUpdateFromDiffToolResponse, toolUpdateFromDiffToolResponse } from "../../diff.js";
2
2
  import { markdownEscape, resultText, textContent, toDisplayPath } from "../content.js";
3
3
  /**
4
4
  * Write: the diff holds the file text. The PostToolUse hook sends the final
@@ -14,15 +14,12 @@ export class WriteReporter {
14
14
  locations: write?.file_path ? [{ path: write.file_path }] : [],
15
15
  };
16
16
  if (write?.file_path) {
17
- // A negotiated client and a v2 client get the exact patch from the
18
- // approval preview or from the PostToolUse hook. The input does not tell
19
- // whether the file exists, so the live tool call shows no diff: a diff
20
- // without the old text would claim a creation. The adapter reads the
21
- // file only for the preview. A replay has no preview and no hook, so it
22
- // keeps the diff, except for a v2 client: a v2 diff names the operation,
23
- // which the input does not tell.
24
- const inputDiff = capabilities.v2 ? false : !capabilities.diffPatch || replay;
25
- if (inputDiff) {
17
+ // A negotiated client gets the exact patch from the approval preview or
18
+ // from the PostToolUse hook. The input does not tell whether the file
19
+ // exists, so the live tool call shows no diff: a diff without the old
20
+ // text would claim a creation. The adapter reads the file only for the
21
+ // preview. A replay has no preview and no hook, so it keeps the diff.
22
+ if (!capabilities.diffPatch || replay) {
26
23
  facts.change = [
27
24
  {
28
25
  type: "diff",
@@ -71,7 +68,7 @@ export function normalizeWriteInput(input) {
71
68
  }
72
69
  /** Edit: the diff holds the old and the new text. */
73
70
  export class EditReporter {
74
- toolUse(input, { cwd, capabilities }) {
71
+ toolUse(input, { cwd }) {
75
72
  const edit = input;
76
73
  const displayPath = edit?.file_path ? toDisplayPath(edit.file_path, cwd) : undefined;
77
74
  const facts = {
@@ -79,11 +76,10 @@ export class EditReporter {
79
76
  kind: "edit",
80
77
  locations: edit?.file_path ? [{ path: edit.file_path }] : [],
81
78
  };
82
- // The standard diff, also for a client that negotiated patches: the input
83
- // holds a snippet, not the file, so a patch would need line numbers that
84
- // the adapter does not know here. A v2 diff cannot hold a snippet, so a v2
85
- // client gets the patch from the PostToolUse hook alone.
86
- if (edit?.file_path && (edit.old_string || edit.new_string) && !capabilities.v2) {
79
+ if (edit?.file_path && (edit.old_string || edit.new_string)) {
80
+ // The standard diff, also for a client that negotiated patches: the
81
+ // input holds a snippet, not the file, so a patch would need line
82
+ // numbers that the adapter does not know here.
87
83
  facts.change = [
88
84
  {
89
85
  type: "diff",
@@ -108,14 +104,12 @@ export class EditReporter {
108
104
  * PostToolUse `tool_response`. For Write it replaces the optimistic creation
109
105
  * diff with the real diff of an updated file. A negotiated client gets an
110
106
  * exact git patch built from the written file, or the standard diff when none
111
- * can be built. A v2 client gets a v2 diff.
107
+ * can be built.
112
108
  */
113
109
  async function finalChange(toolResponse, { capabilities }) {
114
- if (capabilities.v2)
115
- return v2UpdateFromDiffToolResponse(toolResponse);
116
110
  if (!capabilities.diffPatch)
117
111
  return toolUpdateFromDiffToolResponse(toolResponse);
118
- const patch = await patchUpdateFromDiffToolResponse(toolResponse, "air");
112
+ const patch = await patchUpdateFromDiffToolResponse(toolResponse);
119
113
  if (patch)
120
114
  return patch;
121
115
  const created = createdFileDiff(toolResponse);
@@ -13,14 +13,9 @@ export interface TurnEvents {
13
13
  /**
14
14
  * Claude Code took the prompt in as the user message `messageId` of the
15
15
  * conversation. Reported at most once per turn, and never after
16
- * {@link ended} or {@link failed}.
17
- *
18
- * When Claude Code reports command lifecycles (`msg_lifecycle_v1`), that is
19
- * when the prompt starts a turn, before the turn's output. Otherwise, and
20
- * while another turn is still active (held for its background work,
21
- * steered, or cancelled but not yet ended), it is the prompt's echo, after
22
- * that turn ended; for a command Claude Code does not echo (such as
23
- * `/compact`), it is the command's result, after any output it streamed.
16
+ * {@link ended} or {@link failed}. For a prompt Claude Code echoes, that is
17
+ * the echo; for a command it does not echo (such as `/compact`), it is the
18
+ * command's result, after any output the command streamed.
24
19
  */
25
20
  inserted(messageId: string): void;
26
21
  /**
@@ -42,10 +37,9 @@ export interface TurnEvents {
42
37
  ended(outcome: TurnOutcome): void;
43
38
  /**
44
39
  * The turn failed. Without {@link inserted} before, Claude Code was not seen
45
- * taking the prompt in. `title`, when the agent has one, describes the
46
- * failure for the user in plain text, such as "API Error: 529 Overloaded".
40
+ * taking the prompt in.
47
41
  */
48
- failed(error: unknown, title?: string): void;
42
+ failed(error: unknown): void;
49
43
  }
50
44
  /** Why a turn ended. Every ACP version has these reasons. */
51
45
  export type StopReason = "end_turn" | "max_tokens" | "max_turn_requests" | "refusal" | "cancelled";
@@ -1 +1 @@
1
- {"version":3,"file":"turn-events.d.ts","sourceRoot":"","sources":["../src/turn-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC;;;;;OAKG;IACH,YAAY,IAAI,IAAI,CAAC;IACrB;;;OAGG;IACH,OAAO,IAAI,IAAI,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAClC;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9C;AAED,6DAA6D;AAC7D,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,YAAY,GAAG,mBAAmB,GAAG,SAAS,GAAG,WAAW,CAAC;AAEnG,wBAAwB;AACxB,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,UAAU,CAAC;IACvB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC"}
1
+ {"version":3,"file":"turn-events.d.ts","sourceRoot":"","sources":["../src/turn-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC;;;;;OAKG;IACH,YAAY,IAAI,IAAI,CAAC;IACrB;;;OAGG;IACH,OAAO,IAAI,IAAI,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAClC;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9B;AAED,6DAA6D;AAC7D,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,YAAY,GAAG,mBAAmB,GAAG,SAAS,GAAG,WAAW,CAAC;AAEnG,wBAAwB;AACxB,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,UAAU,CAAC;IACvB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC"}
@@ -2,8 +2,6 @@ import type { SDKControlGetUsageResponse } from "@anthropic-ai/claude-agent-sdk"
2
2
  /** Validate the experimental SDK response at the runtime boundary. */
3
3
  export declare function parseUsageResponse(value: unknown): SDKControlGetUsageResponse | null;
4
4
  export declare function isUsageCommandText(text: string): boolean;
5
- /** Escape the Markdown syntax characters of `value` and fold its line breaks. */
6
- export declare function escapeMarkdown(value: string): string;
7
5
  /** Render the SDK's structured `/usage` response as Markdown. */
8
6
  export declare function formatUsageResponse(usage: SDKControlGetUsageResponse): string;
9
7
  //# sourceMappingURL=usage-markdown.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"usage-markdown.d.ts","sourceRoot":"","sources":["../src/usage-markdown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AA8DjF,sEAAsE;AACtE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,0BAA0B,GAAG,IAAI,CAMpF;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AASD,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD;AA+DD,iEAAiE;AACjE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,0BAA0B,GAAG,MAAM,CAiE7E"}
1
+ {"version":3,"file":"usage-markdown.d.ts","sourceRoot":"","sources":["../src/usage-markdown.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AA8DjF,sEAAsE;AACtE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,0BAA0B,GAAG,IAAI,CAMpF;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AA0ED,iEAAiE;AACjE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,0BAA0B,GAAG,MAAM,CAiE7E"}
@@ -71,8 +71,7 @@ function usageBar(percent) {
71
71
  const filled = clamped === 0 ? 0 : Math.max(1, Math.round((clamped / 100) * cells));
72
72
  return `${"█".repeat(filled)}${"░".repeat(cells - filled)}`;
73
73
  }
74
- /** Escape the Markdown syntax characters of `value` and fold its line breaks. */
75
- export function escapeMarkdown(value) {
74
+ function escapeMarkdown(value) {
76
75
  return value.replace(/([\\`*_[\]<>|])/g, "\\$1").replace(/[\r\n]+/g, " ");
77
76
  }
78
77
  function formatDuration(milliseconds) {
package/dist/utils.d.ts CHANGED
@@ -13,16 +13,4 @@ export declare function nodeToWebWritable(nodeStream: Writable): WritableStream<
13
13
  export declare function nodeToWebReadable(nodeStream: Readable): ReadableStream<Uint8Array>;
14
14
  export declare function unreachable(value: never, logger?: Logger): void;
15
15
  export declare function sleep(time: number): Promise<void>;
16
- /** The outcome of {@link raceTimeoutAndAbort}. */
17
- export type RaceOutcome<T> = {
18
- type: "done";
19
- value: T;
20
- } | {
21
- type: "timeout";
22
- } | {
23
- type: "aborted";
24
- };
25
- /** Wait for `promise` until `timeoutMs` passes or `signal` aborts. A rejection
26
- * of `promise` rejects the result. The timer does not keep the process alive. */
27
- export declare function raceTimeoutAndAbort<T>(promise: Promise<T>, timeoutMs: number, signal: AbortSignal): Promise<RaceOutcome<T>>;
28
16
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,qBAAa,QAAQ,CAAC,CAAC,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,SAAS,CAA8C;IAC/D,OAAO,CAAC,IAAI,CAAS;IAErB,IAAI,CAAC,IAAI,EAAE,CAAC;IASZ,GAAG;IAQH,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC;CAgB3C;AAGD,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,QAAQ,GAAG,cAAc,CAAC,UAAU,CAAC,CAclF;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,QAAQ,GAAG,cAAc,CAAC,UAAU,CAAC,CAUlF;AAED,wBAAgB,WAAW,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AAC,CAUlF;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,GAAE,MAAgB,QAQjE;AAED,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjD"}
package/dist/utils.js CHANGED
@@ -79,31 +79,3 @@ export function unreachable(value, logger = console) {
79
79
  export function sleep(time) {
80
80
  return new Promise((resolve) => setTimeout(resolve, time));
81
81
  }
82
- /** Wait for `promise` until `timeoutMs` passes or `signal` aborts. A rejection
83
- * of `promise` rejects the result. The timer does not keep the process alive. */
84
- export async function raceTimeoutAndAbort(promise, timeoutMs, signal) {
85
- let timeout;
86
- let onAbort;
87
- try {
88
- return await Promise.race([
89
- promise.then((value) => ({ type: "done", value })),
90
- new Promise((resolve) => {
91
- timeout = setTimeout(() => resolve({ type: "timeout" }), timeoutMs);
92
- timeout.unref?.();
93
- }),
94
- new Promise((resolve) => {
95
- onAbort = () => resolve({ type: "aborted" });
96
- if (signal.aborted)
97
- onAbort();
98
- else
99
- signal.addEventListener("abort", onAbort, { once: true });
100
- }),
101
- ]);
102
- }
103
- finally {
104
- if (timeout)
105
- clearTimeout(timeout);
106
- if (onAbort)
107
- signal.removeEventListener("abort", onAbort);
108
- }
109
- }
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/v2/agent.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAkB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAiB9E;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,GACvC,EAAE,CAAC,QAAQ,CA6Cb"}
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/v2/agent.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAkB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAa9E;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,GACvC,EAAE,CAAC,QAAQ,CA4Bb"}
package/dist/v2/agent.js CHANGED
@@ -1,11 +1,8 @@
1
1
  import * as v2 from "@agentclientprotocol/sdk/experimental/v2";
2
2
  import { ClaudeAcpAgent } from "../acp-agent.js";
3
3
  import { v1InitializeRequest, v2InitializeResponse } from "./initialize.js";
4
- import { v1PermissionResponse, v2PermissionRequest } from "./permission.js";
5
- import { v2Prompt } from "./prompt.js";
6
- import { v1NewSessionRequest, v1RestoreSessionRequest, v1SetSessionConfigOptionRequest, v2ConfigOptions, v2NewSessionResponse, v2ResumeSessionResponse, } from "./session.js";
4
+ import { v1NewSessionRequest, v1ResumeSessionRequest, v1SetSessionConfigOptionRequest, v2ConfigOptions, v2NewSessionResponse, v2ResumeSessionResponse, } from "./session.js";
7
5
  import { v2SessionUpdate } from "./session-update.js";
8
- import { V2Terminals } from "./terminal.js";
9
6
  /**
10
7
  * The ACP v2 surface, for one connection.
11
8
  *
@@ -15,12 +12,10 @@ import { V2Terminals } from "./terminal.js";
15
12
  */
16
13
  export function v2AgentApp(logger, onAgent) {
17
14
  let agent;
18
- let client;
19
15
  return v2
20
16
  .agent({ name: "claude-code-acp" })
21
17
  .onConnect((connection) => {
22
- client = new V2ClientConnection(connection.client, logger ?? console);
23
- agent = new ClaudeAcpAgent(client, logger, { v2: true });
18
+ agent = new ClaudeAcpAgent(new V2ClientConnection(connection.client), logger);
24
19
  onAgent(agent);
25
20
  })
26
21
  .onRequest(v2.methods.agent.initialize, async ({ params }) => v2InitializeResponse(await agent.initialize(v1InitializeRequest(params))))
@@ -28,75 +23,25 @@ export function v2AgentApp(logger, onAgent) {
28
23
  .onRequest(v2.methods.agent.auth.logout, ({ params }) => agent.logout(params))
29
24
  .onRequest(v2.methods.agent.session.new, async ({ params }) => v2NewSessionResponse(await agent.newSession(v1NewSessionRequest(params))))
30
25
  .onRequest(v2.methods.agent.session.list, ({ params }) => agent.listSessions(params))
31
- .onRequest(v2.methods.agent.session.resume, async ({ params }) => {
32
- const restore = v1RestoreSessionRequest(params);
33
- return v2ResumeSessionResponse(restore.method === "resume"
34
- ? await agent.resumeSession(restore.request)
35
- : await client.replaying(params.sessionId, () => agent.loadSession(restore.request)));
36
- })
37
- .onRequest(v2.methods.agent.session.close, async ({ params }) => {
38
- const response = await agent.closeSession(params);
39
- client.terminals.forget(params.sessionId);
40
- return response;
41
- })
26
+ .onRequest(v2.methods.agent.session.resume, async ({ params }) => v2ResumeSessionResponse(await agent.resumeSession(v1ResumeSessionRequest(params))))
27
+ .onRequest(v2.methods.agent.session.close, ({ params }) => agent.closeSession(params))
42
28
  .onRequest(v2.methods.agent.session.delete, ({ params }) => agent.deleteSession(params))
43
29
  .onRequest(v2.methods.agent.session.setConfigOption, async ({ params }) => {
44
30
  const { configOptions, ...response } = await agent.setSessionConfigOption(v1SetSessionConfigOptionRequest(params));
45
31
  return { ...response, configOptions: v2ConfigOptions(configOptions) };
46
- })
47
- .onRequest(v2.methods.agent.session.prompt, ({ params }) => v2Prompt(agent, params, (update) => {
48
- void client.send({ sessionId: params.sessionId, update });
49
- }))
50
- .onNotification(v2.methods.agent.session.cancel, ({ params }) => agent.cancel(params));
32
+ });
51
33
  }
52
34
  /**
53
35
  * The {@link AcpClient} of an ACP v2 connection: it sends the v1 messages of
54
36
  * the agent as v2 messages.
37
+ *
38
+ * The v2 surface does not serve prompts yet, so permission requests, which
39
+ * only a prompt turn makes, still reject.
55
40
  */
56
41
  class V2ClientConnection {
57
42
  ctx;
58
- logger;
59
- /**
60
- * The sessions whose history replays, each with the messages that the
61
- * replay has cleared so far.
62
- */
63
- replays = new Map();
64
- /** The display terminals of the commands that the agent runs. */
65
- terminals = new V2Terminals();
66
- constructor(ctx, logger) {
43
+ constructor(ctx) {
67
44
  this.ctx = ctx;
68
- this.logger = logger;
69
- }
70
- /**
71
- * Runs `restore`, which replays the history of `sessionId`.
72
- *
73
- * The agent replays messages as chunks. A v2 client may still hold a
74
- * replayed message, and chunks append, so before the first replayed chunk of
75
- * each message the client gets the message with no content, which clears it,
76
- * as v2 requires of a message replayed as chunks.
77
- */
78
- async replaying(sessionId, restore) {
79
- this.replays.set(sessionId, new Set());
80
- try {
81
- return await restore();
82
- }
83
- finally {
84
- this.replays.delete(sessionId);
85
- }
86
- }
87
- /**
88
- * Sends a v2 session update, and logs rather than rejects when that fails.
89
- * It and {@link sessionUpdate} hand updates to the connection synchronously,
90
- * so they go out in the order of the calls. The agent's consumer awaits each
91
- * of its updates before it reports the next turn event, so a turn's state
92
- * follows the output that came before it. (An update the consumer is still
93
- * routing can be overtaken by an event from elsewhere, such as a permission
94
- * request opening.)
95
- */
96
- send(notification) {
97
- return this.ctx.notify(v2.methods.client.session.update, notification).catch((error) => {
98
- this.logger.error(`Failed to send a ${notification.update.sessionUpdate} update:`, error);
99
- });
100
45
  }
101
46
  extNotification(method, params) {
102
47
  if (!isExtensionMethod(method)) {
@@ -105,48 +50,16 @@ class V2ClientConnection {
105
50
  return this.ctx.notify(method, params);
106
51
  }
107
52
  async sessionUpdate({ update, ...notification }) {
108
- const updates = this.v2Updates(notification.sessionId, update).flatMap((v2Update) => {
109
- const clear = this.replayClear(notification.sessionId, v2Update);
110
- return clear ? [clear, v2Update] : [v2Update];
111
- });
112
- // Every update goes to the connection before any is awaited, so an update
113
- // that another call sends meanwhile cannot come between them.
114
- await Promise.all(updates.map((v2Update) => this.ctx.notify(v2.methods.client.session.update, { ...notification, update: v2Update })));
115
- }
116
- /**
117
- * The v2 updates of a v1 update: for a tool call report, the updates of its
118
- * terminal first, then the report itself (see {@link V2Terminals}).
119
- */
120
- v2Updates(sessionId, update) {
121
- if (update.sessionUpdate !== "tool_call" && update.sessionUpdate !== "tool_call_update") {
122
- const v2Update = v2SessionUpdate(update);
123
- return v2Update ? [v2Update] : [];
53
+ const v2Update = v2SessionUpdate(update);
54
+ if (v2Update) {
55
+ await this.ctx.notify(v2.methods.client.session.update, {
56
+ ...notification,
57
+ update: v2Update,
58
+ });
124
59
  }
125
- const { terminal, report } = this.terminals.split(sessionId, update);
126
- const reportUpdate = report && v2SessionUpdate(report);
127
- return [...terminal, ...(reportUpdate ? [reportUpdate] : [])];
128
60
  }
129
- /**
130
- * The update that clears the message of a replayed chunk, when it is the
131
- * first replayed chunk of that message (see {@link replaying}).
132
- */
133
- replayClear(sessionId, update) {
134
- const cleared = this.replays.get(sessionId);
135
- if (!cleared)
136
- return undefined;
137
- const kind = MESSAGE_OF_CHUNK.get(update.sessionUpdate);
138
- if (!kind)
139
- return undefined;
140
- const { messageId } = update;
141
- const key = `${kind} ${messageId}`;
142
- if (cleared.has(key))
143
- return undefined;
144
- cleared.add(key);
145
- return emptyMessage(kind, messageId);
146
- }
147
- async requestPermission(params, signal) {
148
- const response = await this.ctx.request(v2.methods.client.session.requestPermission, v2PermissionRequest(params), { cancellationSignal: signal });
149
- return v1PermissionResponse(response);
61
+ requestPermission() {
62
+ return Promise.reject(new Error("The ACP v2 surface does not serve session/request_permission yet"));
150
63
  }
151
64
  // Elicitation is the same in v1 and v2.
152
65
  createElicitation(params, signal) {
@@ -168,23 +81,6 @@ class V2ClientConnection {
168
81
  return Promise.reject(new Error("ACP v2 has no client file system"));
169
82
  }
170
83
  }
171
- /** The message update of each message chunk. */
172
- const MESSAGE_OF_CHUNK = new Map([
173
- ["user_message_chunk", "user_message"],
174
- ["agent_message_chunk", "agent_message"],
175
- ["agent_thought_chunk", "agent_thought"],
176
- ]);
177
- function emptyMessage(kind, messageId) {
178
- const message = { messageId, content: [] };
179
- switch (kind) {
180
- case "user_message":
181
- return { ...message, sessionUpdate: kind };
182
- case "agent_message":
183
- return { ...message, sessionUpdate: kind };
184
- default:
185
- return { ...message, sessionUpdate: kind };
186
- }
187
- }
188
84
  function isExtensionMethod(method) {
189
85
  return method.startsWith("_");
190
86
  }
@@ -14,8 +14,11 @@ export declare function v1InitializeRequest(request: v2.InitializeRequest): Init
14
14
  /**
15
15
  * The v2 `initialize` response for the v1 response of the agent.
16
16
  *
17
- * It does not advertise the unstable `providers` methods, which the v2
18
- * surface does not serve yet.
17
+ * It advertises no `session` capability yet. A v2 agent that advertises
18
+ * `session` must serve the whole session baseline (`session/new`, `list`,
19
+ * `resume`, `close`, `prompt`, `cancel`, and `update`), and the v2 surface of
20
+ * the adapter does not serve it yet. Nor does it advertise the unstable
21
+ * `providers` methods, which the v2 surface does not serve yet either.
19
22
  */
20
23
  export declare function v2InitializeResponse(response: InitializeResponse): v2.InitializeResponse;
21
24
  //# sourceMappingURL=initialize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../src/v2/initialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAE/D,0DAA0D;AAC1D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,EAAE,CAAC,iBAAiB,GAAG,iBAAiB,CAwBpF;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,EAAE,CAAC,kBAAkB,CAiBxF"}
1
+ {"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../src/v2/initialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAE/D,0DAA0D;AAC1D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,EAAE,CAAC,iBAAiB,GAAG,iBAAiB,CAwBpF;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,EAAE,CAAC,kBAAkB,CAcxF"}