@openclaw/copilot 2026.7.2-beta.5 → 2026.7.2-beta.7

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-C1nz8B8g.js";
1
+ import { a as resolveCopilotAuth, i as createCopilotByokAuth, n as resolveCopilotProvider, r as createCopilotByokProxy } from "./harness-D0K-5kNw.js";
2
2
  import { applyEmbeddedAttemptToolsAllow, awaitAgentEndSideEffects, buildAgentHookContextChannelFields, buildEmbeddedAttemptToolRunContext, callGatewayTool, cancelPendingAgentQuestionForSession, claimPendingAgentQuestionAnswer, clearActiveEmbeddedRun, detectAndLoadAgentHarnessPromptImages, embeddedAgentLog, extractToolErrorMessage, getModelProviderRequestTransport, getPluginToolMeta, isHostScopedAgentToolActive, isSubagentSessionKey, isToolResultError, projectAgentHarnessTranscriptMessageForDisplay, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptFsWorkspaceOnly, resolveAttemptSpawnWorkspaceDir, resolveBootstrapContextForRun, resolveCompactionTimeoutMs, resolveEmbeddedAttemptToolConstructionPlan, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, resolveUserPath, runAgentEndSideEffects, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessGatewayQuestion, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, sanitizeToolResult, setActiveEmbeddedRun } from "openclaw/plugin-sdk/agent-harness-runtime";
3
3
  import path from "node:path";
4
4
  import fsp from "node:fs/promises";
@@ -338,6 +338,7 @@ function createResult(params, state) {
338
338
  } : {},
339
339
  ...state.sdkSessionId ? { sdkSessionId: state.sdkSessionId } : {},
340
340
  ...state.journalValidated !== void 0 ? { journalValidated: state.journalValidated } : {},
341
+ ...state.codeModeEngaged !== void 0 ? { codeModeEngaged: state.codeModeEngaged } : {},
341
342
  assistantTexts: state.assistantTexts ?? [],
342
343
  attemptUsage: state.usage,
343
344
  cloudCodeAssistFormatError: false,
@@ -890,20 +891,23 @@ function attachEventBridge(session, options) {
890
891
  const resultText = event.data.success ? event.data.result?.content ?? "" : event.data.error?.message ?? "Tool execution failed";
891
892
  const details = projectToolResultDetails(event.data);
892
893
  const replayIncomplete = Boolean(event.data.result?.binaryResultsForLlm?.length || event.data.result?.citableSources?.length);
894
+ const resolvedToolName = toolName ?? event.data.toolDescription?.name ?? projectedToolName ?? "unknown";
895
+ const resultContentSource = projection.resultContentSourceByToolName?.get(resolvedToolName);
893
896
  projection.journal.recordToolResult({
894
897
  eventId: event.id,
895
898
  replayIncomplete,
896
899
  message: {
897
900
  role: "toolResult",
898
901
  toolCallId: event.data.toolCallId,
899
- toolName: toolName ?? event.data.toolDescription?.name ?? projectedToolName ?? "unknown",
902
+ toolName: resolvedToolName,
900
903
  content: [{
901
904
  type: "text",
902
905
  text: sanitizeToolDetailText(resultText)
903
906
  }],
904
907
  ...hasOwnKeys(details) ? { details } : {},
905
908
  isError: !event.data.success,
906
- timestamp: resolveEventTimestamp(event.timestamp, projection.now)
909
+ timestamp: resolveEventTimestamp(event.timestamp, projection.now),
910
+ ...resultContentSource ? { __openclaw: { resultContentSource } } : {}
907
911
  }
908
912
  });
909
913
  }
@@ -1439,7 +1443,7 @@ function registerCopilotActiveRun(params) {
1439
1443
  //#endregion
1440
1444
  //#region extensions/copilot/src/attempt-finalize.ts
1441
1445
  async function completeCopilotAttempt(params) {
1442
- const { aborted, attemptStartedAt, bridge, downgradedFromResume, externalAbort, hookContext, hookContextWindowFields, input, lastToolError, messages, nativeSessionHistoryUnvalidated, transcriptJournal, modelRef, now, promptError, releaseError, resumeFailureRecovered, sdkSessionId, sentTurnStarted, sessionIdUsed, settledFinalizationAssistantCompleted, settledToolFinalization, timedOut, timedOutDuringCompaction, yieldDetected } = params;
1446
+ const { aborted, attemptStartedAt, bridge, codeModeEngaged, downgradedFromResume, externalAbort, hookContext, hookContextWindowFields, input, lastToolError, messages, nativeSessionHistoryUnvalidated, transcriptJournal, modelRef, now, promptError, releaseError, resumeFailureRecovered, sdkSessionId, sentTurnStarted, sessionIdUsed, settledFinalizationAssistantCompleted, settledToolFinalization, timedOut, timedOutDuringCompaction, yieldDetected } = params;
1443
1447
  const snap = bridge?.snapshot();
1444
1448
  const assistantTexts = bridge?.finalizeAssistantTexts() ?? [];
1445
1449
  const lastAssistant = bridge?.buildAssistantMessage({
@@ -1453,6 +1457,7 @@ async function completeCopilotAttempt(params) {
1453
1457
  const result = createResult(input, {
1454
1458
  aborted,
1455
1459
  assistantTexts,
1460
+ codeModeEngaged,
1456
1461
  currentAttemptAssistant: lastAssistant,
1457
1462
  currentAttemptCompletedAssistant: settledFinalizationAssistantCompleted ? lastAssistant : void 0,
1458
1463
  downgradedFromResume,
@@ -1554,6 +1559,7 @@ function supportsModelTools(modelProvider) {
1554
1559
  }
1555
1560
  async function createCopilotToolBridge(input) {
1556
1561
  if (!input.allowModelTools && !supportsModelTools(input.modelProvider)) return {
1562
+ codeModeEngaged: false,
1557
1563
  sdkTools: [],
1558
1564
  sourceTools: []
1559
1565
  };
@@ -1577,6 +1583,7 @@ async function createCopilotToolBridge(input) {
1577
1583
  includeCoreTools: true
1578
1584
  } : toolPlan;
1579
1585
  if (!effectiveToolPlan.constructTools) return {
1586
+ codeModeEngaged: false,
1580
1587
  sdkTools: [],
1581
1588
  sourceTools: []
1582
1589
  };
@@ -1599,6 +1606,7 @@ async function createCopilotToolBridge(input) {
1599
1606
  sessionId: input.sessionId,
1600
1607
  sessionKey: attemptParams.sandboxSessionKey ?? attemptParams.sessionKey ?? input.sessionKey,
1601
1608
  scheduledToolPolicy: attemptParams.scheduledToolPolicy,
1609
+ skillWorkshopProposalOnly: attemptParams.skillWorkshopProposalOnly,
1602
1610
  sourceReplyDeliveryMode: attemptParams.sourceReplyDeliveryMode,
1603
1611
  toolsAllow: attemptParams.toolsAllow
1604
1612
  });
@@ -1619,6 +1627,7 @@ async function createCopilotToolBridge(input) {
1619
1627
  if (duplicateNames.length > 0) throw new Error(`[copilot-tool-bridge] duplicate tool names: ${duplicateNames.join(", ")}`);
1620
1628
  return {
1621
1629
  cleanup: toolSurfaceRuntime.cleanup,
1630
+ codeModeEngaged: toolSurfaceRuntime.codeModeControlsEnabled,
1622
1631
  sdkTools: filteredTools.map((sourceTool) => convertOpenClawToolToSdkTool(sourceTool, {
1623
1632
  abortSignal: input.abortSignal,
1624
1633
  beforeExecute: input.beforeExecute,
@@ -1983,8 +1992,11 @@ function shouldForceCopilotMessageTool(params) {
1983
1992
  * so final filtering keeps aliases, groups, plugin policies, and glob
1984
1993
  * semantics identical to the in-tree embedded runner.
1985
1994
  */
1986
- function filterCopilotToolsForAllowlist(tools, toolsAllow) {
1987
- return applyEmbeddedAttemptToolsAllow(tools, toolsAllow, { toolMeta: (tool) => getPluginToolMeta(tool) ?? readInlinePluginToolMeta(tool) });
1995
+ function filterCopilotToolsForAllowlist(tools, toolsAllow, options) {
1996
+ const filtered = applyEmbeddedAttemptToolsAllow(tools, toolsAllow, { toolMeta: (tool) => getPluginToolMeta(tool) ?? readInlinePluginToolMeta(tool) });
1997
+ if (!options?.forceToolNames?.length) return filtered;
1998
+ const allowedNames = /* @__PURE__ */ new Set([...filtered.map((tool) => tool.name), ...options.forceToolNames]);
1999
+ return tools.filter((tool) => allowedNames.has(tool.name));
1988
2000
  }
1989
2001
  function filterCopilotToolsForConstructionPlan(tools, plan, options = {}) {
1990
2002
  if (plan.includeBaseCodingTools && plan.includeShellTools) return tools;
@@ -2355,6 +2367,7 @@ async function createCopilotSessionSetup(params) {
2355
2367
  ...input,
2356
2368
  prompt: promptBuild.prompt
2357
2369
  };
2370
+ const promptTools = filterCopilotToolsForAllowlist(sdkTools, promptBuild.toolsAllow, shouldForceCopilotMessageTool(input) ? { forceToolNames: ["message"] } : void 0);
2358
2371
  let promptImagesCount = 0;
2359
2372
  const emitLlmInput = (prompt, additionalContext) => {
2360
2373
  if (settledToolFinalization) return;
@@ -2368,7 +2381,7 @@ async function createCopilotSessionSetup(params) {
2368
2381
  prompt: additionalContext ? `${prompt}\n\n${additionalContext}` : prompt,
2369
2382
  historyMessages: [],
2370
2383
  imagesCount: promptImagesCount,
2371
- tools: sdkTools
2384
+ tools: promptTools
2372
2385
  },
2373
2386
  ctx: hookContext
2374
2387
  });
@@ -2378,14 +2391,14 @@ async function createCopilotSessionSetup(params) {
2378
2391
  paramsForRun: attemptInput,
2379
2392
  signal
2380
2393
  });
2381
- const sessionConfig = createSessionConfig(attemptInput, modelRef.id, sdkTools, poolAcquire.auth, sessionProvider, promptBuild.developerInstructions || void 0, effectiveWorkspaceDir, effectiveCwd, settledToolFinalization ? void 0 : userInputBridge.onUserInputRequest, {
2394
+ const sessionConfig = createSessionConfig(attemptInput, modelRef.id, promptTools, poolAcquire.auth, sessionProvider, promptBuild.developerInstructions || void 0, effectiveWorkspaceDir, effectiveCwd, settledToolFinalization ? void 0 : userInputBridge.onUserInputRequest, {
2382
2395
  hooksBridgeOptions: hasNativePromptHook ? { onUserPromptSubmitted: ({ additionalContext, prompt }) => emitLlmInput(prompt, additionalContext) } : void 0,
2383
2396
  includeAskUser: !ringZeroSystemAgentRun,
2384
2397
  operation: operation ?? "attempt"
2385
2398
  });
2386
2399
  return {
2387
2400
  attemptInput,
2388
- compactionSessionConfig: byokProxy ? createSessionConfig(attemptInput, modelRef.id, sdkTools, poolAcquire.auth, poolAcquire.provider, promptBuild.developerInstructions || void 0, effectiveWorkspaceDir, effectiveCwd, settledToolFinalization ? void 0 : userInputBridge.onUserInputRequest, {
2401
+ compactionSessionConfig: byokProxy ? createSessionConfig(attemptInput, modelRef.id, promptTools, poolAcquire.auth, poolAcquire.provider, promptBuild.developerInstructions || void 0, effectiveWorkspaceDir, effectiveCwd, settledToolFinalization ? void 0 : userInputBridge.onUserInputRequest, {
2389
2402
  hooksBridgeOptions: hasNativePromptHook ? { onUserPromptSubmitted: ({ additionalContext, prompt }) => emitLlmInput(prompt, additionalContext) } : void 0,
2390
2403
  includeAskUser: !ringZeroSystemAgentRun,
2391
2404
  operation: operation ?? "attempt"
@@ -2401,6 +2414,27 @@ async function createCopilotSessionSetup(params) {
2401
2414
  }
2402
2415
  //#endregion
2403
2416
  //#region extensions/copilot/src/attempt-transcript-journal.ts
2417
+ function readTurnTaintMetadata(message) {
2418
+ const metadata = message["__openclaw"];
2419
+ return metadata && typeof metadata === "object" && !Array.isArray(metadata) ? metadata : void 0;
2420
+ }
2421
+ function isActiveTurnTainted(messages) {
2422
+ for (const message of messages.toReversed()) {
2423
+ if (message.role === "user") return false;
2424
+ const metadata = readTurnTaintMetadata(message);
2425
+ if (metadata?.turnTainted === true || metadata?.resultContentSource === "network") return true;
2426
+ }
2427
+ return false;
2428
+ }
2429
+ function withAssistantTurnTaint(message, tainted) {
2430
+ return tainted ? {
2431
+ ...message,
2432
+ __openclaw: {
2433
+ ...readTurnTaintMetadata(message),
2434
+ turnTainted: true
2435
+ }
2436
+ } : message;
2437
+ }
2404
2438
  function createAttemptTranscriptJournal(params) {
2405
2439
  const hiddenTurn = params.attempt.trigger === "memory";
2406
2440
  const projectDisplay = (message) => projectAgentHarnessTranscriptMessageForDisplay({
@@ -2408,6 +2442,7 @@ function createAttemptTranscriptJournal(params) {
2408
2442
  message
2409
2443
  });
2410
2444
  const messagesSnapshot = [...params.messages];
2445
+ let turnTainted = isActiveTurnTainted(messagesSnapshot);
2411
2446
  const snapshotIdempotencyKeys = new Set(messagesSnapshot.flatMap((message) => {
2412
2447
  const key = readIdempotencyKey(message);
2413
2448
  return key && isCurrentJournalIdentity(key, params) ? [key] : [];
@@ -2464,6 +2499,7 @@ function createAttemptTranscriptJournal(params) {
2464
2499
  if (!hooked) return;
2465
2500
  if (!isDeepStrictEqual(originalReplayPayload, projectReplayPayload(hooked))) replayInvalid = true;
2466
2501
  const idempotencyKey = message.idempotencyKey;
2502
+ const taintMetadata = readTurnTaintMetadata(message);
2467
2503
  const toolIdentity = message.role === "toolResult" ? {
2468
2504
  toolCallId: message.toolCallId,
2469
2505
  toolName: message.toolName
@@ -2471,6 +2507,10 @@ function createAttemptTranscriptJournal(params) {
2471
2507
  const prepared = projectDisplay({
2472
2508
  ...hooked,
2473
2509
  ...toolIdentity,
2510
+ ...taintMetadata ? { __openclaw: {
2511
+ ...readTurnTaintMetadata(hooked),
2512
+ ...taintMetadata
2513
+ } } : {},
2474
2514
  ...idempotencyKey ? { idempotencyKey } : {},
2475
2515
  ...message.display === false ? { display: false } : {}
2476
2516
  });
@@ -2625,6 +2665,7 @@ function createAttemptTranscriptJournal(params) {
2625
2665
  recordAssistant(input) {
2626
2666
  if (!claim(input.eventId)) return;
2627
2667
  replayInvalid ||= input.replayIncomplete === true;
2668
+ const message = withAssistantTurnTaint(input.message, turnTainted);
2628
2669
  const key = `copilot-sdk:${params.sdkSessionId}:${input.eventId}`;
2629
2670
  latestAssistantKey = key;
2630
2671
  assistantTranscriptOwned = false;
@@ -2634,7 +2675,7 @@ function createAttemptTranscriptJournal(params) {
2634
2675
  const write = {
2635
2676
  eventId: input.eventId,
2636
2677
  message: {
2637
- ...input.message,
2678
+ ...message,
2638
2679
  idempotencyKey: key
2639
2680
  }
2640
2681
  };
@@ -2655,6 +2696,7 @@ function createAttemptTranscriptJournal(params) {
2655
2696
  },
2656
2697
  recordToolResult(input) {
2657
2698
  if (!claim(input.eventId)) return;
2699
+ turnTainted ||= readTurnTaintMetadata(input.message)?.resultContentSource === "network";
2658
2700
  schedule(async () => {
2659
2701
  const group = pendingTools;
2660
2702
  if (!group || !group.order.includes(input.message.toolCallId)) throw new Error(`Copilot emitted an unmatched tool result: ${input.message.toolCallId}`);
@@ -3034,8 +3076,10 @@ async function runCopilotExecution(context) {
3034
3076
  const sessionProvider = byokProxy?.provider ?? poolAcquire.provider;
3035
3077
  const sessionRef = { current: void 0 };
3036
3078
  const computerContextEpoch = { value: 0 };
3079
+ let codeModeEngaged;
3037
3080
  try {
3038
3081
  let sdkTools = [];
3082
+ let resultContentSourceByToolName = /* @__PURE__ */ new Map();
3039
3083
  if (!settledToolFinalization) try {
3040
3084
  const toolBridge = await createToolBridge({
3041
3085
  allowModelTools: poolAcquire.provider.mode === "byok",
@@ -3074,7 +3118,9 @@ async function runCopilotExecution(context) {
3074
3118
  })
3075
3119
  });
3076
3120
  cleanupToolBridge = toolBridge.cleanup;
3121
+ codeModeEngaged = toolBridge.codeModeEngaged;
3077
3122
  sdkTools = toolBridge.sdkTools;
3123
+ resultContentSourceByToolName = new Map(toolBridge.sourceTools.flatMap((tool) => tool.resultContentSource ? [[tool.name, tool.resultContentSource]] : []));
3078
3124
  } catch (error) {
3079
3125
  return finishAttempt(createResult(input, {
3080
3126
  messagesSnapshot: messages,
@@ -3179,7 +3225,8 @@ async function runCopilotExecution(context) {
3179
3225
  sdkSessionId
3180
3226
  }),
3181
3227
  modelRef,
3182
- now
3228
+ now,
3229
+ resultContentSourceByToolName
3183
3230
  }
3184
3231
  });
3185
3232
  activeRunHandleRef = registerCopilotActiveRun({
@@ -3309,6 +3356,7 @@ async function runCopilotExecution(context) {
3309
3356
  aborted,
3310
3357
  attemptStartedAt,
3311
3358
  bridge,
3359
+ codeModeEngaged,
3312
3360
  downgradedFromResume,
3313
3361
  externalAbort,
3314
3362
  hookContext,
@@ -858,7 +858,7 @@ function createCopilotAgentHarness(options) {
858
858
  async function runHarnessAttempt(params, operation) {
859
859
  const attemptPromise = (async () => {
860
860
  if (disposed) throw new Error("[copilot] harness has been disposed; cannot start new attempts");
861
- const { resolvePoolAcquire, runCopilotAttempt } = await import("./attempt-VUKDewiG.js");
861
+ const { resolvePoolAcquire, runCopilotAttempt } = await import("./attempt-D6tQnv01.js");
862
862
  if (disposed) throw new Error("[copilot] harness was disposed while starting an attempt");
863
863
  const pool = await getPool();
864
864
  if (disposed) throw new Error("[copilot] harness was disposed while starting an attempt");
@@ -1060,7 +1060,7 @@ function createCopilotAgentHarness(options) {
1060
1060
  };
1061
1061
  const tracked = trackedSessions.get(openclawSessionId);
1062
1062
  const currentCompactKey = computeSessionCompactKey(params);
1063
- const { resolvePoolAcquire } = await import("./attempt-VUKDewiG.js");
1063
+ const { resolvePoolAcquire } = await import("./attempt-D6tQnv01.js");
1064
1064
  let resolvedPoolAcquire;
1065
1065
  let currentAuth;
1066
1066
  try {
package/dist/harness.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as createCopilotAgentHarness } from "./harness-C1nz8B8g.js";
1
+ import { t as createCopilotAgentHarness } from "./harness-D0K-5kNw.js";
2
2
  export { createCopilotAgentHarness };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createCopilotAgentHarness } from "./harness-C1nz8B8g.js";
1
+ import { t as createCopilotAgentHarness } from "./harness-D0K-5kNw.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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/copilot",
3
- "version": "2026.7.2-beta.5",
3
+ "version": "2026.7.2-beta.7",
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",
@@ -24,10 +24,10 @@
24
24
  "minHostVersion": ">=2026.5.28"
25
25
  },
26
26
  "compat": {
27
- "pluginApi": ">=2026.7.2-beta.5"
27
+ "pluginApi": ">=2026.7.2-beta.7"
28
28
  },
29
29
  "build": {
30
- "openclawVersion": "2026.7.2-beta.5",
30
+ "openclawVersion": "2026.7.2-beta.7",
31
31
  "bundledDist": false
32
32
  },
33
33
  "release": {
@@ -45,7 +45,7 @@
45
45
  "README.md"
46
46
  ],
47
47
  "peerDependencies": {
48
- "openclaw": ">=2026.7.2-beta.5"
48
+ "openclaw": ">=2026.7.2-beta.7"
49
49
  },
50
50
  "peerDependenciesMeta": {
51
51
  "openclaw": {