@agentclientprotocol/claude-agent-acp 0.77.1-preview.2 → 0.77.1-preview.4

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/tools.js CHANGED
@@ -1093,79 +1093,6 @@ export function markdownEscape(text) {
1093
1093
  }
1094
1094
  return escape + "\n" + text + (text.endsWith("\n") ? "" : "\n") + escape;
1095
1095
  }
1096
- /**
1097
- * Builds diff ToolUpdate content from the structured toolResponse provided by
1098
- * the PostToolUse hook for diff-producing tools (Edit, Write). Unlike parsing
1099
- * the plain unified diff string, this uses the pre-parsed structuredPatch
1100
- * which supports multiple replacement sites (replaceAll) and always includes
1101
- * context lines for better readability.
1102
- */
1103
- export function toolUpdateFromDiffToolResponse(toolResponse) {
1104
- if (!toolResponse || typeof toolResponse !== "object")
1105
- return {};
1106
- const response = toolResponse;
1107
- if (!response.filePath || !Array.isArray(response.structuredPatch))
1108
- return {};
1109
- const content = [];
1110
- const locations = [];
1111
- for (const { lines, newStart } of response.structuredPatch) {
1112
- const oldText = [];
1113
- const newText = [];
1114
- for (const line of lines) {
1115
- if (line.startsWith("-")) {
1116
- oldText.push(line.slice(1));
1117
- }
1118
- else if (line.startsWith("+")) {
1119
- newText.push(line.slice(1));
1120
- }
1121
- else {
1122
- oldText.push(line.slice(1));
1123
- newText.push(line.slice(1));
1124
- }
1125
- }
1126
- if (oldText.length > 0 || newText.length > 0) {
1127
- locations.push({ path: response.filePath, line: newStart });
1128
- content.push({
1129
- type: "diff",
1130
- path: response.filePath,
1131
- oldText: oldText.join("\n") || null,
1132
- newText: newText.join("\n"),
1133
- });
1134
- }
1135
- }
1136
- // A Write `update` can arrive with an empty structuredPatch — nothing
1137
- // changed, the diff timed out, or the previous content was too large to
1138
- // diff (originalFile null; SDK 0.3.252 documents the lane). Returning `{}`
1139
- // would leave Write's optimistic tool_use-time content standing, and that
1140
- // was built with `oldText: null` — "creation" semantics — so an overwrite
1141
- // of a large existing file would render as creating it. Emit a truthful
1142
- // replacement instead. Gated on `type` so Edit (whose output carries no
1143
- // `type` and whose optimistic old/new diff is already truthful) keeps the
1144
- // empty-return behavior.
1145
- if (content.length === 0 && response.type === "update" && typeof response.content === "string") {
1146
- locations.push({ path: response.filePath });
1147
- content.push(typeof response.originalFile === "string"
1148
- ? {
1149
- type: "diff",
1150
- path: response.filePath,
1151
- oldText: response.originalFile,
1152
- newText: response.content,
1153
- }
1154
- : {
1155
- type: "content",
1156
- content: {
1157
- type: "text",
1158
- text: `Updated \`${response.filePath}\` (previous content too large to diff)`,
1159
- },
1160
- });
1161
- }
1162
- const result = {};
1163
- if (content.length > 0)
1164
- result.content = content;
1165
- if (locations.length > 0)
1166
- result.locations = locations;
1167
- return result;
1168
- }
1169
1096
  /* Callbacks are keyed globally because the SDK hook is process-wide, but each
1170
1097
  * entry retains its owning ACP session so cancellation/teardown can release it. */
1171
1098
  const toolUseCallbacks = new Map();
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.77.1-preview.2",
6
+ "version": "0.77.1-preview.4",
7
7
  "description": "An ACP-compatible coding agent powered by the Claude Agent SDK (TypeScript)",
8
8
  "main": "dist/lib.js",
9
9
  "types": "dist/lib.d.ts",