@openclaw/copilot 2026.9.2 → 2026.9.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.
@@ -1,4 +1,4 @@
1
- import { a as resolveCopilotAuth, i as createCopilotByokAuth, n as resolveCopilotProvider, r as createCopilotByokProxy } from "./harness-CIPB8kLr.js";
1
+ import { a as resolveCopilotAuth, i as createCopilotByokAuth, n as resolveCopilotProvider, r as createCopilotByokProxy } from "./harness-C_65tSNm.js";
2
2
  import { n as normalizeCopilotUsage, r as createCopilotIsolatedSessionRestrictions, t as buildCopilotAssistantUsage } from "./usage-bridge-Cpa-ZYwL.js";
3
3
  import { asNonArrayRecord, asOptionalRecord, normalizeOptionalString, normalizeUniqueStringEntries, readNonBlankString, readNonEmptyStringPreservingWhitespace, readNonEmptyStringPreservingWhitespace as readNonEmptyString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import { SKILL_WORKSHOP_TOOL_NAME, applyEmbeddedAttemptToolsAllow, awaitAgentEndSideEffects, buildAgentHookContextChannelFields, buildCredentialSafetyPrompt, buildDelegationGuidanceSection, buildEmbeddedAttemptToolRunContext, buildEmbeddedForegroundPromptContext, buildHarnessVisibleReplyGuidance, buildSkillWorkshopPromptSection, cancelPendingAgentQuestionForSession, claimPendingAgentQuestionAnswer, clearActiveEmbeddedRun, detectAndLoadAgentHarnessPromptImages, embeddedAgentLog, extractToolErrorMessage, getModelProviderRequestTransport, getPluginToolMeta, getPluginToolSideEffectOwnerKey, isHostScopedAgentToolActive, isSubagentSessionKey, isToolResultError, projectAgentHarnessTranscriptMessageForDisplay, resolveAgentDir, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptFsWorkspaceOnly, resolveAttemptSpawnWorkspaceDir, resolveBootstrapContextForRun, resolveCompactionTimeoutMs, resolveEmbeddedAttemptToolConstructionPlan, resolveMainSessionDelegationMode, resolveModelAuthMode, resolveSandboxContext, resolveUserPath, restorePreparedUserTurnOperationalMetaForRuntime, runAgentEndSideEffects, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessGatewayQuestion, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, sanitizeToolResult, setActiveEmbeddedRun } from "openclaw/plugin-sdk/agent-harness-runtime";
@@ -1380,7 +1380,7 @@ function registerCopilotActiveRun(params) {
1380
1380
  params.abortActiveSession();
1381
1381
  }
1382
1382
  };
1383
- setActiveEmbeddedRun(params.input.sessionId, activeRunHandle, params.input.sessionKey, params.input.sessionFile);
1383
+ setActiveEmbeddedRun(params.input.sessionId, activeRunHandle, params.input.sessionKey, params.input.sessionFile, params.agentId);
1384
1384
  params.input.replyOperation?.attachBackend(activeRunHandle);
1385
1385
  return activeRunHandle;
1386
1386
  }
@@ -1609,21 +1609,24 @@ async function createCopilotToolBridge(input) {
1609
1609
  return {
1610
1610
  cleanup: toolSurfaceRuntime.cleanup,
1611
1611
  codeModeEngaged: toolSurfaceRuntime.codeModeControlsEnabled,
1612
- promptToolPolicy: { apply: (params = {}) => {
1613
- const result = compactedTools.promptToolPolicy.apply({
1614
- ...params,
1615
- toolsAllow: buildEmbeddedAttemptToolRunContext({
1616
- ...attemptParams,
1617
- toolsAllow: params.toolsAllow,
1618
- forceMessageTool: shouldForceCopilotMessageTool(attemptParams)
1619
- }).runtimeToolAllowlist
1620
- });
1621
- const directToolNames = new Set(result.tools.map((tool) => tool.name));
1622
- return {
1623
- tools: sdkTools.filter((tool) => directToolNames.has(tool.name)),
1624
- callableToolNames: result.callableToolNames
1625
- };
1626
- } },
1612
+ promptToolPolicy: {
1613
+ requireExplicitMessageTarget: toolOptions.requireExplicitMessageTarget,
1614
+ apply: (params = {}) => {
1615
+ const result = compactedTools.promptToolPolicy.apply({
1616
+ ...params,
1617
+ toolsAllow: buildEmbeddedAttemptToolRunContext({
1618
+ ...attemptParams,
1619
+ toolsAllow: params.toolsAllow,
1620
+ forceMessageTool: shouldForceCopilotMessageTool(attemptParams)
1621
+ }).runtimeToolAllowlist
1622
+ });
1623
+ const directToolNames = new Set(result.tools.map((tool) => tool.name));
1624
+ return {
1625
+ tools: sdkTools.filter((tool) => directToolNames.has(tool.name)),
1626
+ callableToolNames: result.callableToolNames
1627
+ };
1628
+ }
1629
+ },
1627
1630
  sourceTools: exposedTools
1628
1631
  };
1629
1632
  }
@@ -1641,10 +1644,6 @@ function buildOpenClawCodingToolsOptions(input, toolPlan, toolSurfaceRuntime) {
1641
1644
  const cwd = input.cwd ?? a.cwd;
1642
1645
  const agentDir = input.agentDir ?? a.agentDir;
1643
1646
  const sandbox = input.sandbox ?? void 0;
1644
- const spawnWorkspaceDir = input.spawnWorkspaceDir ?? (workspaceDir ? resolveAttemptSpawnWorkspaceDir({
1645
- sandbox,
1646
- resolvedWorkspace: workspaceDir
1647
- }) : void 0);
1648
1647
  const model = a.model;
1649
1648
  const modelHasVision = Array.isArray(model?.input) && model.input.includes("image");
1650
1649
  const modelCompat = model && typeof model === "object" && "compat" in model && model.compat && typeof model.compat === "object" ? model.compat : void 0;
@@ -1662,24 +1661,6 @@ function buildOpenClawCodingToolsOptions(input, toolPlan, toolSurfaceRuntime) {
1662
1661
  send: a.onToolResult,
1663
1662
  ...a.messageChannel ? { messageChannel: a.messageChannel } : {}
1664
1663
  } } : {},
1665
- toolBindings: a.toolBindings,
1666
- chatType: a.chatType,
1667
- agentAccountId: a.agentAccountId,
1668
- messageTo: a.messageTo,
1669
- messageThreadId: a.messageThreadId,
1670
- nativeChannelId: a.chatId,
1671
- messageActionTurnCapability: a.messageActionTurnCapability,
1672
- groupId: a.groupId,
1673
- groupChannel: a.groupChannel,
1674
- groupSpace: a.groupSpace,
1675
- memberRoleIds: a.memberRoleIds,
1676
- spawnedBy: a.spawnedBy,
1677
- senderId: a.senderId,
1678
- senderName: a.senderName,
1679
- senderUsername: a.senderUsername,
1680
- senderE164: a.senderE164,
1681
- senderIsOwner: a.senderIsOwner,
1682
- scheduledToolPolicy: a.scheduledToolPolicy,
1683
1664
  allowGatewaySubagentBinding: a.allowGatewaySubagentBinding,
1684
1665
  sessionKey: sandboxSessionKey,
1685
1666
  runSessionKey,
@@ -1690,7 +1671,7 @@ function buildOpenClawCodingToolsOptions(input, toolPlan, toolSurfaceRuntime) {
1690
1671
  workspaceDir,
1691
1672
  cwd,
1692
1673
  sandbox,
1693
- spawnWorkspaceDir,
1674
+ spawnWorkspaceDir: input.spawnWorkspaceDir,
1694
1675
  config: toolSurfaceRuntime?.config ?? a.config,
1695
1676
  abortSignal: input.abortSignal,
1696
1677
  modelProvider: input.modelProvider,
@@ -1706,15 +1687,8 @@ function buildOpenClawCodingToolsOptions(input, toolPlan, toolSurfaceRuntime) {
1706
1687
  modelContextWindowTokens: a.contextTokenBudget ?? model?.contextWindow,
1707
1688
  delegationCapability: a.delegationCapability,
1708
1689
  modelAuthMode: resolveModelAuthMode(input.modelProvider, a.config, void 0, { workspaceDir }),
1709
- currentChannelId: a.currentChannelId,
1710
- currentMessagingTarget: a.currentMessagingTarget,
1711
- currentThreadTs: a.currentThreadTs,
1712
- currentMessageId: a.currentMessageId,
1713
- replyToMode: a.replyToMode,
1714
- hasRepliedRef: a.hasRepliedRef,
1715
1690
  modelHasVision,
1716
1691
  requireExplicitMessageTarget: a.requireExplicitMessageTarget ?? isSubagentSessionKey(liveSessionKey),
1717
- sourceReplyDeliveryMode: a.sourceReplyDeliveryMode,
1718
1692
  disableMessageTool: a.disableMessageTool,
1719
1693
  forceMessageTool: a.forceMessageTool,
1720
1694
  enableHeartbeatTool: a.enableHeartbeatTool,
@@ -1763,6 +1737,7 @@ function convertOpenClawToolToSdkTool(sourceTool, input, scheduleToolExecution)
1763
1737
  input.attemptParams.observeToolTerminal?.({
1764
1738
  toolCallId: invocation.toolCallId,
1765
1739
  toolName: sourceTool.name,
1740
+ result: error,
1766
1741
  arguments: executedArgs,
1767
1742
  executionStarted,
1768
1743
  outcome: "failure",
@@ -1827,6 +1802,7 @@ function convertOpenClawToolToSdkTool(sourceTool, input, scheduleToolExecution)
1827
1802
  input.attemptParams.observeToolTerminal?.({
1828
1803
  toolCallId: invocation.toolCallId,
1829
1804
  toolName: sourceTool.name,
1805
+ result,
1830
1806
  arguments: preparedArgs,
1831
1807
  executionStarted: true,
1832
1808
  outcome: resultIsError ? "failure" : "success",
@@ -1873,6 +1849,7 @@ async function executeCatalogTool(input, params) {
1873
1849
  input.attemptParams?.observeToolTerminal?.({
1874
1850
  toolCallId: params.toolCallId,
1875
1851
  toolName: params.toolName,
1852
+ result,
1876
1853
  arguments: preparedArgs,
1877
1854
  executionStarted,
1878
1855
  outcome: isError ? "failure" : "success",
@@ -1898,6 +1875,7 @@ async function executeCatalogTool(input, params) {
1898
1875
  if (!terminalObserved) input.attemptParams?.observeToolTerminal?.({
1899
1876
  toolCallId: params.toolCallId,
1900
1877
  toolName: params.toolName,
1878
+ result: error,
1901
1879
  arguments: preparedArgs,
1902
1880
  executionStarted,
1903
1881
  outcome: "failure",
@@ -2041,6 +2019,7 @@ function prepareCopilotAttemptContext(params, deps) {
2041
2019
  modelProviderId: modelRef.provider,
2042
2020
  modelId: modelRef.id,
2043
2021
  trigger: input.trigger,
2022
+ inputProvenance: input.inputProvenance,
2044
2023
  foregroundPromptContext: buildEmbeddedForegroundPromptContext({
2045
2024
  ...input,
2046
2025
  agentId: sessionAgentId
@@ -2094,9 +2073,10 @@ function buildCopilotPromptGuidance(params) {
2094
2073
  delegationGuidance,
2095
2074
  buildHarnessVisibleReplyGuidance({
2096
2075
  sourceReplyDeliveryMode: params.attempt.sourceReplyDeliveryMode,
2097
- messageToolAvailable: callableTools.has("message")
2076
+ messageToolAvailable: callableTools.has("message"),
2077
+ requireExplicitMessageTarget: params.requireExplicitMessageTarget
2098
2078
  }),
2099
- buildCredentialSafetyPrompt(params.attempt.disableTools !== true && callableTools.has("secrets") ? "secrets" : void 0),
2079
+ buildCredentialSafetyPrompt({ controlToolsAvailable: params.attempt.disableTools !== true && (callableTools.has("openclaw") || callableTools.has("gateway")) }),
2100
2080
  params.workspaceBootstrapInstructions?.trim(),
2101
2081
  extraSystemPrompt ? `${isMinimal ? "## Subagent Context" : "## Conversation Context"}\n${extraSystemPrompt}` : void 0
2102
2082
  ].filter((section) => section?.trim()).join("\n\n") || void 0;
@@ -2372,6 +2352,7 @@ async function createCopilotSessionSetup(params) {
2372
2352
  return buildCopilotPromptGuidance({
2373
2353
  attempt: input,
2374
2354
  callableToolNames: promptPolicyResult.callableToolNames,
2355
+ requireExplicitMessageTarget: promptToolPolicy.requireExplicitMessageTarget,
2375
2356
  workspaceBootstrapInstructions: workspaceBootstrap.instructions
2376
2357
  });
2377
2358
  } },
@@ -2566,7 +2547,7 @@ function createAttemptTranscriptJournal(params) {
2566
2547
  };
2567
2548
  const prepare = (write, options = {}) => {
2568
2549
  const message = structuredClone(write.message);
2569
- const originalReplayPayload = structuredClone(projectReplayPayload(message));
2550
+ const originalReplayPayload = projectReplayPayload(message);
2570
2551
  const hooked = runAgentHarnessBeforeMessageWriteHook({
2571
2552
  message: structuredClone(message),
2572
2553
  agentId: target.agentId,
@@ -2962,9 +2943,9 @@ var CopilotNativeSubagentTaskMirror = class {
2962
2943
  status: "cancelled",
2963
2944
  endedAt: eventAt,
2964
2945
  lastEventAt: eventAt,
2965
- error: "Copilot native subagent ended with its parent attempt.",
2966
- progressSummary: "Copilot native subagent cancelled with its parent attempt.",
2967
- terminalSummary: "Copilot native subagent cancelled."
2946
+ error: "Subagent ended with its parent attempt.",
2947
+ progressSummary: "Subagent cancelled with its parent attempt.",
2948
+ terminalSummary: "Subagent cancelled."
2968
2949
  });
2969
2950
  }
2970
2951
  this.activeRunIds.clear();
@@ -2974,19 +2955,19 @@ var CopilotNativeSubagentTaskMirror = class {
2974
2955
  if (agentId ? this.runIdByAgentId.get(agentId) : this.runIdByToolCallId.get(toolCallId)) return;
2975
2956
  const eventAt = this.now();
2976
2957
  const label = event.data.agentDisplayName.trim() || event.data.agentName.trim();
2977
- const task = event.data.agentDescription.trim() || `Copilot native subagent ${label}`;
2958
+ const task = event.data.agentDescription.trim() || `Subagent ${label}`;
2978
2959
  if (!this.runtime.tryCreateRunningTaskRun({
2979
2960
  sourceId: toolCallId,
2980
2961
  agentId: this.params.agentId,
2981
2962
  runId,
2982
- label: label || "Copilot subagent",
2963
+ label: label || "Subagent",
2983
2964
  task,
2984
2965
  notifyPolicy: "silent",
2985
2966
  deliveryStatus: "not_applicable",
2986
2967
  preferMetadata: true,
2987
2968
  startedAt: eventAt,
2988
2969
  lastEventAt: eventAt,
2989
- progressSummary: "Copilot native subagent started."
2970
+ progressSummary: "Subagent started."
2990
2971
  })) return;
2991
2972
  if (agentId) this.runIdByAgentId.set(agentId, runId);
2992
2973
  else this.runIdByToolCallId.set(toolCallId, runId);
@@ -3003,7 +2984,7 @@ var CopilotNativeSubagentTaskMirror = class {
3003
2984
  status: "succeeded",
3004
2985
  endedAt: eventAt,
3005
2986
  lastEventAt: eventAt,
3006
- progressSummary: "Copilot native subagent completed.",
2987
+ progressSummary: "Subagent completed.",
3007
2988
  terminalSummary: buildCompletionSummary(event)
3008
2989
  });
3009
2990
  }
@@ -3018,8 +2999,8 @@ var CopilotNativeSubagentTaskMirror = class {
3018
2999
  endedAt: eventAt,
3019
3000
  lastEventAt: eventAt,
3020
3001
  error: event.data.error,
3021
- progressSummary: "Copilot native subagent failed.",
3022
- terminalSummary: "Copilot native subagent failed."
3002
+ progressSummary: "Subagent failed.",
3003
+ terminalSummary: "Subagent failed."
3023
3004
  });
3024
3005
  }
3025
3006
  resolveRunId(event) {
@@ -3036,7 +3017,7 @@ var CopilotNativeSubagentTaskMirror = class {
3036
3017
  };
3037
3018
  function buildCompletionSummary(event) {
3038
3019
  const details = [event.data.totalToolCalls !== void 0 ? `${event.data.totalToolCalls} tool calls` : void 0, event.data.totalTokens !== void 0 ? `${event.data.totalTokens} tokens` : void 0].filter((value) => value !== void 0);
3039
- return details.length > 0 ? `Copilot native subagent completed (${details.join(", ")}).` : "Copilot native subagent completed.";
3020
+ return details.length > 0 ? `Subagent completed (${details.join(", ")}).` : "Subagent completed.";
3040
3021
  }
3041
3022
  //#endregion
3042
3023
  //#region extensions/copilot/src/attempt-execution.ts
@@ -3339,6 +3320,7 @@ async function runCopilotExecution(context) {
3339
3320
  if (!userInputBridge) throw new Error("[copilot-attempt] ordinary attempts require a user-input bridge");
3340
3321
  activeRunHandleRef = registerCopilotActiveRun({
3341
3322
  abortActiveSession,
3323
+ agentId: sessionAgentId,
3342
3324
  bridge,
3343
3325
  canAcceptSteering: () => initialSdkUserValidated,
3344
3326
  startedAtMs: input.startedAtMs,
@@ -888,7 +888,7 @@ function createCopilotAgentHarness(options) {
888
888
  async function runHarnessAttempt(params, operation) {
889
889
  const attemptPromise = (async () => {
890
890
  if (disposed) throw new Error("[copilot] harness has been disposed; cannot start new attempts");
891
- const { resolvePoolAcquire, runCopilotAttempt } = await import("./attempt-BJ2mxTkh.js");
891
+ const { resolvePoolAcquire, runCopilotAttempt } = await import("./attempt-EPgLnjoV.js");
892
892
  if (disposed) throw new Error("[copilot] harness was disposed while starting an attempt");
893
893
  const pool = await getPool();
894
894
  if (disposed) throw new Error("[copilot] harness was disposed while starting an attempt");
@@ -1019,7 +1019,7 @@ function createCopilotAgentHarness(options) {
1019
1019
  async function runIsolatedCompletionV2(params) {
1020
1020
  const completionPromise = (async () => {
1021
1021
  if (disposed) throw new Error("[copilot] harness has been disposed; cannot start isolated completion");
1022
- const { runCopilotIsolatedCompletion } = await import("./isolated-completion-OGrJ9ITR.js");
1022
+ const { runCopilotIsolatedCompletion } = await import("./isolated-completion-YG0Z8FkF.js");
1023
1023
  if (disposed) throw new Error("[copilot] harness was disposed while starting isolated completion");
1024
1024
  return await runCopilotIsolatedCompletion(params, async () => {
1025
1025
  const pool = await getPool();
@@ -1111,7 +1111,7 @@ function createCopilotAgentHarness(options) {
1111
1111
  };
1112
1112
  const tracked = trackedSessions.get(openclawSessionId);
1113
1113
  const currentCompactKey = computeCompactRequestKey(params);
1114
- const { resolvePoolAcquire } = await import("./attempt-BJ2mxTkh.js");
1114
+ const { resolvePoolAcquire } = await import("./attempt-EPgLnjoV.js");
1115
1115
  let resolvedPoolAcquire;
1116
1116
  let currentAuth;
1117
1117
  try {
package/dist/harness.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as createCopilotAgentHarness } from "./harness-CIPB8kLr.js";
1
+ import { t as createCopilotAgentHarness } from "./harness-C_65tSNm.js";
2
2
  export { createCopilotAgentHarness };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createCopilotAgentHarness } from "./harness-CIPB8kLr.js";
1
+ import { t as createCopilotAgentHarness } from "./harness-C_65tSNm.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,4 +1,4 @@
1
- import { n as resolveCopilotProvider, o as tokenFingerprint, r as createCopilotByokProxy } from "./harness-CIPB8kLr.js";
1
+ import { n as resolveCopilotProvider, o as tokenFingerprint, r as createCopilotByokProxy } from "./harness-C_65tSNm.js";
2
2
  import { r as createCopilotIsolatedSessionRestrictions, t as buildCopilotAssistantUsage } from "./usage-bridge-Cpa-ZYwL.js";
3
3
  import { resolve } from "node:path";
4
4
  //#region extensions/copilot/src/isolated-completion.ts
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "id": "copilot",
3
+ "categories": ["runtime"],
3
4
  "doctorContract": {
4
5
  "configRepair": true
5
6
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/copilot",
3
- "version": "2026.9.2",
3
+ "version": "2026.9.4",
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.9.2"
27
+ "pluginApi": ">=2026.9.4"
28
28
  },
29
29
  "build": {
30
- "openclawVersion": "2026.9.2",
30
+ "openclawVersion": "2026.9.4",
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.9.2"
48
+ "openclaw": ">=2026.9.4"
49
49
  },
50
50
  "peerDependenciesMeta": {
51
51
  "openclaw": {