@openclaw/copilot 2026.7.2-beta.1 → 2026.7.2-beta.2

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.
@@ -1,4 +1,4 @@
1
- import { a as resolveCopilotAuth, i as createCopilotByokAuth, n as resolveCopilotProvider, r as createCopilotByokProxy } from "./harness-DnbBZBdi.js";
1
+ import { a as resolveCopilotAuth, i as createCopilotByokAuth, n as resolveCopilotProvider, r as createCopilotByokProxy } from "./harness-DeWR8_cC.js";
2
2
  import { applyEmbeddedAttemptToolsAllow, awaitAgentEndSideEffects, buildAgentHarnessUserInputAnswers, buildAgentHookContextChannelFields, buildEmbeddedAttemptToolRunContext, clearActiveEmbeddedRun, deliverAgentHarnessUserInputPrompt, detectAndLoadAgentHarnessPromptImages, embeddedAgentLog, extractToolErrorMessage, getModelProviderRequestTransport, getPluginToolMeta, isHostScopedAgentToolActive, isSubagentSessionKey, isToolResultError, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptFsWorkspaceOnly, resolveAttemptSpawnWorkspaceDir, resolveBootstrapContextForRun, resolveCompactionTimeoutMs, resolveEmbeddedAttemptToolConstructionPlan, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, resolveUserPath, runAgentEndSideEffects, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, sanitizeToolResult, setActiveEmbeddedRun } from "openclaw/plugin-sdk/agent-harness-runtime";
3
3
  import { createHash } from "node:crypto";
4
4
  import path from "node:path";
@@ -299,7 +299,10 @@ function attachEventBridge(session, options) {
299
299
  });
300
300
  });
301
301
  registerListener(session, unsubscribeFns, "exit_plan_mode.requested", (event) => {
302
- const steps = splitPlanText(event.data.planContent);
302
+ const steps = splitPlanText(event.data.planContent).map((step) => ({
303
+ step,
304
+ status: "pending"
305
+ }));
303
306
  enqueueAgentEvent({
304
307
  stream: "plan",
305
308
  data: {
@@ -1046,7 +1049,8 @@ async function createCopilotToolBridge(input) {
1046
1049
  abortSignal: input.abortSignal,
1047
1050
  beforeExecute: input.beforeExecute,
1048
1051
  onAgentToolResult: input.attemptParams?.onAgentToolResult,
1049
- onToolCompleted: input.onToolCompleted
1052
+ onToolCompleted: input.onToolCompleted,
1053
+ observeToolTerminal: input.attemptParams?.observeToolTerminal
1050
1054
  })),
1051
1055
  sourceTools: filteredTools
1052
1056
  };
@@ -1192,8 +1196,16 @@ function convertOpenClawToolToSdkTool(sourceTool, ctx) {
1192
1196
  console.warn("[copilot-tool-bridge] onToolCompleted handler threw; continuing", error);
1193
1197
  }
1194
1198
  };
1195
- const failureResult = (executedArgs, invocation, startedAt, message, error) => {
1199
+ const failureResult = (executedArgs, invocation, startedAt, message, error, executionStarted) => {
1196
1200
  const errorMessage = toError$1(error).message;
1201
+ ctx.observeToolTerminal?.({
1202
+ toolCallId: invocation.toolCallId,
1203
+ toolName: sourceTool.name,
1204
+ arguments: executedArgs,
1205
+ executionStarted,
1206
+ outcome: "failure",
1207
+ failure: { error: errorMessage }
1208
+ });
1197
1209
  notifyToolResult(sanitizeToolResult({
1198
1210
  content: [{
1199
1211
  type: "text",
@@ -1217,7 +1229,7 @@ function convertOpenClawToolToSdkTool(sourceTool, ctx) {
1217
1229
  const startedAt = Date.now();
1218
1230
  if (ctx.abortSignal?.aborted) {
1219
1231
  const error = /* @__PURE__ */ new Error("[copilot-tool-bridge] aborted before execution");
1220
- return failureResult(args, invocation, startedAt, error.message, error);
1232
+ return failureResult(args, invocation, startedAt, error.message, error, false);
1221
1233
  }
1222
1234
  try {
1223
1235
  await ctx.beforeExecute?.({
@@ -1228,24 +1240,32 @@ function convertOpenClawToolToSdkTool(sourceTool, ctx) {
1228
1240
  toolName: sourceTool.name
1229
1241
  });
1230
1242
  } catch (error) {
1231
- return failureResult(args, invocation, startedAt, `[copilot-tool-bridge] beforeExecute failed for tool '${sourceTool.name}': ${toError$1(error).message}`, error);
1243
+ return failureResult(args, invocation, startedAt, `[copilot-tool-bridge] beforeExecute failed for tool '${sourceTool.name}': ${toError$1(error).message}`, error, false);
1232
1244
  }
1233
1245
  let preparedArgs;
1234
1246
  try {
1235
1247
  preparedArgs = sourceTool.prepareArguments ? sourceTool.prepareArguments(args) : args;
1236
1248
  } catch (error) {
1237
- return failureResult(args, invocation, startedAt, `[copilot-tool-bridge] prepareArguments failed for tool '${sourceTool.name}': ${toError$1(error).message}`, error);
1249
+ return failureResult(args, invocation, startedAt, `[copilot-tool-bridge] prepareArguments failed for tool '${sourceTool.name}': ${toError$1(error).message}`, error, false);
1238
1250
  }
1239
1251
  let result;
1240
1252
  try {
1241
1253
  result = await sourceTool.execute(invocation.toolCallId, preparedArgs, ctx.abortSignal, void 0);
1242
1254
  } catch (error) {
1243
- return failureResult(preparedArgs, invocation, startedAt, `[copilot-tool-bridge] tool '${sourceTool.name}' failed: ${toError$1(error).message}`, error);
1255
+ return failureResult(preparedArgs, invocation, startedAt, `[copilot-tool-bridge] tool '${sourceTool.name}' failed: ${toError$1(error).message}`, error, true);
1244
1256
  }
1245
1257
  const sdkResult = convertMcpCallToolResult({ content: result.content });
1246
1258
  const sanitizedResult = sanitizeToolResult(result);
1247
1259
  const resultIsError = sdkResult.resultType === "failure" || isToolResultError(sanitizedResult);
1248
1260
  const resultError = resultIsError ? extractToolErrorMessage(sanitizedResult) : void 0;
1261
+ ctx.observeToolTerminal?.({
1262
+ toolCallId: invocation.toolCallId,
1263
+ toolName: sourceTool.name,
1264
+ arguments: preparedArgs,
1265
+ executionStarted: true,
1266
+ outcome: resultIsError ? "failure" : "success",
1267
+ ...resultIsError ? { failure: { error: resultError ?? "tool returned an error" } } : {}
1268
+ });
1249
1269
  notifyToolResult(sanitizedResult, resultIsError);
1250
1270
  notifyToolCompleted({
1251
1271
  toolName: sourceTool.name,
@@ -1275,11 +1295,24 @@ async function executeCatalogTool(input, params) {
1275
1295
  const sourceTool = params.tool;
1276
1296
  const startedAt = Date.now();
1277
1297
  let preparedArgs = params.input;
1298
+ let executionStarted = false;
1299
+ let terminalObserved = false;
1278
1300
  try {
1279
1301
  preparedArgs = sourceTool.prepareArguments ? sourceTool.prepareArguments(params.input) : params.input;
1302
+ executionStarted = true;
1280
1303
  const result = await sourceTool.execute(params.toolCallId, preparedArgs, params.signal ?? input.abortSignal, params.onUpdate);
1281
1304
  const sanitizedResult = sanitizeToolResult(result);
1282
1305
  const isError = isToolResultError(sanitizedResult);
1306
+ const error = isError ? extractToolErrorMessage(sanitizedResult) ?? "tool returned an error" : void 0;
1307
+ terminalObserved = true;
1308
+ input.attemptParams?.observeToolTerminal?.({
1309
+ toolCallId: params.toolCallId,
1310
+ toolName: params.toolName,
1311
+ arguments: preparedArgs,
1312
+ executionStarted,
1313
+ outcome: isError ? "failure" : "success",
1314
+ ...error ? { failure: { error } } : {}
1315
+ });
1283
1316
  input.attemptParams?.onAgentToolResult?.({
1284
1317
  toolName: params.toolName,
1285
1318
  result: sanitizedResult,
@@ -1290,12 +1323,20 @@ async function executeCatalogTool(input, params) {
1290
1323
  toolCallId: params.toolCallId,
1291
1324
  args: toToolStartArgs(preparedArgs),
1292
1325
  result: sanitizedResult,
1293
- ...isError ? { error: extractToolErrorMessage(sanitizedResult) ?? "tool returned an error" } : {},
1326
+ ...error ? { error } : {},
1294
1327
  startedAt
1295
1328
  });
1296
1329
  return result;
1297
1330
  } catch (error) {
1298
1331
  const message = toError$1(error).message;
1332
+ if (!terminalObserved) input.attemptParams?.observeToolTerminal?.({
1333
+ toolCallId: params.toolCallId,
1334
+ toolName: params.toolName,
1335
+ arguments: preparedArgs,
1336
+ executionStarted,
1337
+ outcome: "failure",
1338
+ failure: { error: message }
1339
+ });
1299
1340
  const failure = sanitizeToolResult({
1300
1341
  content: [{
1301
1342
  type: "text",
@@ -1825,6 +1866,13 @@ async function runCopilotAttempt(params, deps) {
1825
1866
  let downgradedFromResume = false;
1826
1867
  let resumeFailureRecovered = false;
1827
1868
  let yieldDetected = false;
1869
+ let lastToolError;
1870
+ const hostObserveToolTerminal = input.observeToolTerminal;
1871
+ const observeToolTerminal = hostObserveToolTerminal ? (observation) => {
1872
+ const terminal = hostObserveToolTerminal(observation);
1873
+ lastToolError = terminal.lastToolError;
1874
+ return terminal;
1875
+ } : void 0;
1828
1876
  const markExternalAbort = () => {
1829
1877
  abortRequested = true;
1830
1878
  externalAbort = true;
@@ -1925,7 +1973,10 @@ async function runCopilotAttempt(params, deps) {
1925
1973
  sandbox,
1926
1974
  spawnWorkspaceDir: sandboxAwareSpawnWorkspaceDir,
1927
1975
  abortSignal: params.abortSignal,
1928
- attemptParams: input,
1976
+ attemptParams: observeToolTerminal ? {
1977
+ ...input,
1978
+ observeToolTerminal
1979
+ } : input,
1929
1980
  computerContextEpoch,
1930
1981
  sessionRef,
1931
1982
  onYieldDetected: () => {
@@ -2237,6 +2288,7 @@ async function runCopilotAttempt(params, deps) {
2237
2288
  startedCount: snap?.startedCount ?? 0
2238
2289
  },
2239
2290
  lastAssistant,
2291
+ lastToolError,
2240
2292
  messagesSnapshot,
2241
2293
  now,
2242
2294
  promptError,
@@ -2302,6 +2354,7 @@ function createResult(params, state) {
2302
2354
  startedCount: 0
2303
2355
  },
2304
2356
  lastAssistant: state.lastAssistant,
2357
+ ...state.lastToolError ? { lastToolError: state.lastToolError } : {},
2305
2358
  messagesSnapshot: state.messagesSnapshot,
2306
2359
  messagingToolSentMediaUrls: [],
2307
2360
  messagingToolSentTargets: [],
@@ -894,7 +894,7 @@ function createCopilotAgentHarness(options) {
894
894
  async runAttempt(params) {
895
895
  const attemptPromise = (async () => {
896
896
  if (disposed) throw new Error("[copilot] harness has been disposed; cannot start new attempts");
897
- const { resolvePoolAcquire, runCopilotAttempt } = await import("./attempt-BxxMpQmE.js");
897
+ const { resolvePoolAcquire, runCopilotAttempt } = await import("./attempt-Bwgye68K.js");
898
898
  if (disposed) throw new Error("[copilot] harness was disposed while starting an attempt");
899
899
  const pool = await getPool();
900
900
  if (disposed) throw new Error("[copilot] harness was disposed while starting an attempt");
@@ -1010,7 +1010,7 @@ function createCopilotAgentHarness(options) {
1010
1010
  };
1011
1011
  const tracked = trackedSessions.get(openclawSessionId);
1012
1012
  const currentCompactKey = computeSessionCompactKey(params);
1013
- const { resolvePoolAcquire } = await import("./attempt-BxxMpQmE.js");
1013
+ const { resolvePoolAcquire } = await import("./attempt-Bwgye68K.js");
1014
1014
  let resolvedPoolAcquire;
1015
1015
  let currentAuth;
1016
1016
  try {
package/dist/harness.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as createCopilotAgentHarness } from "./harness-DnbBZBdi.js";
1
+ import { t as createCopilotAgentHarness } from "./harness-DeWR8_cC.js";
2
2
  export { createCopilotAgentHarness };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createCopilotAgentHarness } from "./harness-DnbBZBdi.js";
1
+ import { t as createCopilotAgentHarness } from "./harness-DeWR8_cC.js";
2
2
  import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
3
3
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  //#region extensions/copilot/index.ts
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@openclaw/copilot",
3
- "version": "2026.7.2-beta.1",
3
+ "version": "2026.7.2-beta.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/copilot",
9
- "version": "2026.7.2-beta.1",
9
+ "version": "2026.7.2-beta.2",
10
10
  "dependencies": {
11
11
  "@github/copilot-sdk": "1.0.5"
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/copilot",
3
- "version": "2026.7.2-beta.1",
3
+ "version": "2026.7.2-beta.2",
4
4
  "description": "OpenClaw GitHub Copilot agent runtime plugin (registers a `github-copilot` AgentHarness backed by @github/copilot-sdk over JSON-RPC to the GitHub Copilot CLI)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,7 +11,6 @@
11
11
  "@github/copilot-sdk": "1.0.5"
12
12
  },
13
13
  "devDependencies": {
14
- "@github/copilot": "1.0.68",
15
14
  "@openclaw/plugin-sdk": "workspace:*"
16
15
  },
17
16
  "openclaw": {
@@ -25,10 +24,10 @@
25
24
  "minHostVersion": ">=2026.5.28"
26
25
  },
27
26
  "compat": {
28
- "pluginApi": ">=2026.7.2-beta.1"
27
+ "pluginApi": ">=2026.7.2-beta.2"
29
28
  },
30
29
  "build": {
31
- "openclawVersion": "2026.7.2-beta.1",
30
+ "openclawVersion": "2026.7.2-beta.2",
32
31
  "bundledDist": false
33
32
  },
34
33
  "release": {
@@ -47,7 +46,7 @@
47
46
  "README.md"
48
47
  ],
49
48
  "peerDependencies": {
50
- "openclaw": ">=2026.7.2-beta.1"
49
+ "openclaw": ">=2026.7.2-beta.2"
51
50
  },
52
51
  "peerDependenciesMeta": {
53
52
  "openclaw": {