@openclaw/copilot 2026.9.1 → 2026.9.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.
- package/dist/{attempt-Ls_qYja7.js → attempt-e3wCSh8h.js} +78 -87
- package/dist/{harness-V2lGlWa5.js → harness-qA-Kb-ZC.js} +3 -3
- package/dist/harness.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{isolated-completion-DxQ0E51R.js → isolated-completion-D01XCEU3.js} +19 -8
- package/openclaw.plugin.json +0 -1
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as resolveCopilotAuth, i as createCopilotByokAuth, n as resolveCopilotProvider, r as createCopilotByokProxy } from "./harness-
|
|
1
|
+
import { a as resolveCopilotAuth, i as createCopilotByokAuth, n as resolveCopilotProvider, r as createCopilotByokProxy } from "./harness-qA-Kb-ZC.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
|
-
import { SKILL_WORKSHOP_TOOL_NAME, applyEmbeddedAttemptToolsAllow, awaitAgentEndSideEffects, buildAgentHookContextChannelFields, buildCredentialSafetyPrompt, buildDelegationGuidanceSection, buildEmbeddedAttemptToolRunContext, buildEmbeddedForegroundPromptContext, buildHarnessVisibleReplyGuidance, buildSkillWorkshopPromptSection,
|
|
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";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { formatErrorMessage, toErrorObject, toStringifiedError, toStringifiedError as toCopilotError } from "openclaw/plugin-sdk/error-runtime";
|
|
7
7
|
import { parseDateStringTimestampMs } from "openclaw/plugin-sdk/number-runtime";
|
|
@@ -1323,15 +1323,20 @@ function registerCopilotActiveRun(params) {
|
|
|
1323
1323
|
acceptanceReported = true;
|
|
1324
1324
|
options?.onQueueAccepted?.(accepted);
|
|
1325
1325
|
};
|
|
1326
|
+
if (await claimPendingUserInputAnswer(text, options)) {
|
|
1327
|
+
reportAcceptance(true);
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1326
1330
|
let messageId;
|
|
1327
1331
|
try {
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
return;
|
|
1331
|
-
}
|
|
1332
|
+
const recorder = options?.userTurnTranscriptRecorder;
|
|
1333
|
+
const sourceMessage = recorder ? await recorder.resolveMessage() : void 0;
|
|
1332
1334
|
if (params.isSettled() || params.isAborted()) throw new Error("Copilot steering is unavailable after the active run ended");
|
|
1333
1335
|
if (!params.canAcceptSteering()) throw new Error("Copilot steering is unavailable before initial user validation");
|
|
1334
|
-
messageId = await params.transcriptJournal.sendSdkUser(() => params.session.send({
|
|
1336
|
+
messageId = await params.transcriptJournal.sendSdkUser(() => params.session.send({
|
|
1337
|
+
prompt: text,
|
|
1338
|
+
...typeof sourceMessage?.content === "string" ? { displayPrompt: sourceMessage.content } : {}
|
|
1339
|
+
}), recorder);
|
|
1335
1340
|
reportAcceptance(true);
|
|
1336
1341
|
} catch (error) {
|
|
1337
1342
|
reportAcceptance(false);
|
|
@@ -1375,7 +1380,7 @@ function registerCopilotActiveRun(params) {
|
|
|
1375
1380
|
params.abortActiveSession();
|
|
1376
1381
|
}
|
|
1377
1382
|
};
|
|
1378
|
-
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);
|
|
1379
1384
|
params.input.replyOperation?.attachBackend(activeRunHandle);
|
|
1380
1385
|
return activeRunHandle;
|
|
1381
1386
|
}
|
|
@@ -1590,31 +1595,38 @@ async function createCopilotToolBridge(input) {
|
|
|
1590
1595
|
const exposedTools = compactedTools.tools.map((tool) => newlyBoundTools.get(tool) ?? tool);
|
|
1591
1596
|
const duplicateNames = findDuplicateToolNames(exposedTools);
|
|
1592
1597
|
if (duplicateNames.length > 0) throw new Error(`[copilot-tool-bridge] duplicate tool names: ${duplicateNames.join(", ")}`);
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1598
|
+
let sequentialBarrier = Promise.resolve();
|
|
1599
|
+
const pendingCalls = /* @__PURE__ */ new Set();
|
|
1600
|
+
const scheduleToolExecution = (executionMode, execute) => {
|
|
1601
|
+
const run = (executionMode === "sequential" ? Promise.all(pendingCalls) : sequentialBarrier).then(execute);
|
|
1602
|
+
const settled = run.then(() => void 0, () => void 0);
|
|
1603
|
+
pendingCalls.add(settled);
|
|
1604
|
+
settled.then(() => pendingCalls.delete(settled));
|
|
1605
|
+
if (executionMode === "sequential") sequentialBarrier = settled;
|
|
1606
|
+
return run;
|
|
1607
|
+
};
|
|
1608
|
+
const sdkTools = exposedTools.map((sourceTool) => convertOpenClawToolToSdkTool(sourceTool, input, scheduleToolExecution));
|
|
1600
1609
|
return {
|
|
1601
1610
|
cleanup: toolSurfaceRuntime.cleanup,
|
|
1602
1611
|
codeModeEngaged: toolSurfaceRuntime.codeModeControlsEnabled,
|
|
1603
|
-
promptToolPolicy: {
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
...
|
|
1608
|
-
toolsAllow:
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
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
|
+
},
|
|
1618
1630
|
sourceTools: exposedTools
|
|
1619
1631
|
};
|
|
1620
1632
|
}
|
|
@@ -1632,10 +1644,6 @@ function buildOpenClawCodingToolsOptions(input, toolPlan, toolSurfaceRuntime) {
|
|
|
1632
1644
|
const cwd = input.cwd ?? a.cwd;
|
|
1633
1645
|
const agentDir = input.agentDir ?? a.agentDir;
|
|
1634
1646
|
const sandbox = input.sandbox ?? void 0;
|
|
1635
|
-
const spawnWorkspaceDir = input.spawnWorkspaceDir ?? (workspaceDir ? resolveAttemptSpawnWorkspaceDir({
|
|
1636
|
-
sandbox,
|
|
1637
|
-
resolvedWorkspace: workspaceDir
|
|
1638
|
-
}) : void 0);
|
|
1639
1647
|
const model = a.model;
|
|
1640
1648
|
const modelHasVision = Array.isArray(model?.input) && model.input.includes("image");
|
|
1641
1649
|
const modelCompat = model && typeof model === "object" && "compat" in model && model.compat && typeof model.compat === "object" ? model.compat : void 0;
|
|
@@ -1649,24 +1657,10 @@ function buildOpenClawCodingToolsOptions(input, toolPlan, toolSurfaceRuntime) {
|
|
|
1649
1657
|
},
|
|
1650
1658
|
messageProvider: a.messageProvider ?? a.messageChannel,
|
|
1651
1659
|
messageChannel: a.messageChannel,
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
messageThreadId: a.messageThreadId,
|
|
1657
|
-
nativeChannelId: a.chatId,
|
|
1658
|
-
messageActionTurnCapability: a.messageActionTurnCapability,
|
|
1659
|
-
groupId: a.groupId,
|
|
1660
|
-
groupChannel: a.groupChannel,
|
|
1661
|
-
groupSpace: a.groupSpace,
|
|
1662
|
-
memberRoleIds: a.memberRoleIds,
|
|
1663
|
-
spawnedBy: a.spawnedBy,
|
|
1664
|
-
senderId: a.senderId,
|
|
1665
|
-
senderName: a.senderName,
|
|
1666
|
-
senderUsername: a.senderUsername,
|
|
1667
|
-
senderE164: a.senderE164,
|
|
1668
|
-
senderIsOwner: a.senderIsOwner,
|
|
1669
|
-
scheduledToolPolicy: a.scheduledToolPolicy,
|
|
1660
|
+
...a.onToolResult ? { questionPrompt: {
|
|
1661
|
+
send: a.onToolResult,
|
|
1662
|
+
...a.messageChannel ? { messageChannel: a.messageChannel } : {}
|
|
1663
|
+
} } : {},
|
|
1670
1664
|
allowGatewaySubagentBinding: a.allowGatewaySubagentBinding,
|
|
1671
1665
|
sessionKey: sandboxSessionKey,
|
|
1672
1666
|
runSessionKey,
|
|
@@ -1677,7 +1671,7 @@ function buildOpenClawCodingToolsOptions(input, toolPlan, toolSurfaceRuntime) {
|
|
|
1677
1671
|
workspaceDir,
|
|
1678
1672
|
cwd,
|
|
1679
1673
|
sandbox,
|
|
1680
|
-
spawnWorkspaceDir,
|
|
1674
|
+
spawnWorkspaceDir: input.spawnWorkspaceDir,
|
|
1681
1675
|
config: toolSurfaceRuntime?.config ?? a.config,
|
|
1682
1676
|
abortSignal: input.abortSignal,
|
|
1683
1677
|
modelProvider: input.modelProvider,
|
|
@@ -1693,15 +1687,8 @@ function buildOpenClawCodingToolsOptions(input, toolPlan, toolSurfaceRuntime) {
|
|
|
1693
1687
|
modelContextWindowTokens: a.contextTokenBudget ?? model?.contextWindow,
|
|
1694
1688
|
delegationCapability: a.delegationCapability,
|
|
1695
1689
|
modelAuthMode: resolveModelAuthMode(input.modelProvider, a.config, void 0, { workspaceDir }),
|
|
1696
|
-
currentChannelId: a.currentChannelId,
|
|
1697
|
-
currentMessagingTarget: a.currentMessagingTarget,
|
|
1698
|
-
currentThreadTs: a.currentThreadTs,
|
|
1699
|
-
currentMessageId: a.currentMessageId,
|
|
1700
|
-
replyToMode: a.replyToMode,
|
|
1701
|
-
hasRepliedRef: a.hasRepliedRef,
|
|
1702
1690
|
modelHasVision,
|
|
1703
1691
|
requireExplicitMessageTarget: a.requireExplicitMessageTarget ?? isSubagentSessionKey(liveSessionKey),
|
|
1704
|
-
sourceReplyDeliveryMode: a.sourceReplyDeliveryMode,
|
|
1705
1692
|
disableMessageTool: a.disableMessageTool,
|
|
1706
1693
|
forceMessageTool: a.forceMessageTool,
|
|
1707
1694
|
enableHeartbeatTool: a.enableHeartbeatTool,
|
|
@@ -1720,15 +1707,14 @@ function buildOpenClawCodingToolsOptions(input, toolPlan, toolSurfaceRuntime) {
|
|
|
1720
1707
|
}
|
|
1721
1708
|
};
|
|
1722
1709
|
}
|
|
1723
|
-
function convertOpenClawToolToSdkTool(sourceTool,
|
|
1710
|
+
function convertOpenClawToolToSdkTool(sourceTool, input, scheduleToolExecution) {
|
|
1724
1711
|
if (typeof sourceTool.name !== "string" || sourceTool.name.trim().length === 0) throw new Error("[copilot-tool-bridge] tool name must be a non-empty string");
|
|
1725
1712
|
if (typeof sourceTool.execute !== "function") throw new Error(`[copilot-tool-bridge] tool '${sourceTool.name}' must define an execute function`);
|
|
1726
1713
|
const ownerKey = getPluginToolSideEffectOwnerKey(sourceTool);
|
|
1727
1714
|
const ownerMutation = ownerKey ? { ownerKey } : void 0;
|
|
1728
|
-
let sequentialLock = Promise.resolve();
|
|
1729
1715
|
const notifyToolResult = (result, isError) => {
|
|
1730
1716
|
try {
|
|
1731
|
-
|
|
1717
|
+
input.attemptParams.onAgentToolResult?.({
|
|
1732
1718
|
toolName: sourceTool.name,
|
|
1733
1719
|
result,
|
|
1734
1720
|
isError
|
|
@@ -1739,7 +1725,7 @@ function convertOpenClawToolToSdkTool(sourceTool, ctx) {
|
|
|
1739
1725
|
};
|
|
1740
1726
|
const notifyToolCompleted = (completion) => {
|
|
1741
1727
|
try {
|
|
1742
|
-
Promise.resolve(
|
|
1728
|
+
Promise.resolve(input.onToolCompleted?.(completion)).catch((error) => {
|
|
1743
1729
|
console.warn("[copilot-tool-bridge] onToolCompleted handler threw; continuing", error);
|
|
1744
1730
|
});
|
|
1745
1731
|
} catch (error) {
|
|
@@ -1748,9 +1734,10 @@ function convertOpenClawToolToSdkTool(sourceTool, ctx) {
|
|
|
1748
1734
|
};
|
|
1749
1735
|
const failureResult = (executedArgs, invocation, startedAt, message, error, executionStarted) => {
|
|
1750
1736
|
const errorMessage = toStringifiedError(error).message;
|
|
1751
|
-
|
|
1737
|
+
input.attemptParams.observeToolTerminal?.({
|
|
1752
1738
|
toolCallId: invocation.toolCallId,
|
|
1753
1739
|
toolName: sourceTool.name,
|
|
1740
|
+
result: error,
|
|
1754
1741
|
arguments: executedArgs,
|
|
1755
1742
|
executionStarted,
|
|
1756
1743
|
outcome: "failure",
|
|
@@ -1778,12 +1765,12 @@ function convertOpenClawToolToSdkTool(sourceTool, ctx) {
|
|
|
1778
1765
|
};
|
|
1779
1766
|
const executeOnce = async (args, invocation) => {
|
|
1780
1767
|
const startedAt = Date.now();
|
|
1781
|
-
if (
|
|
1768
|
+
if (input.abortSignal?.aborted) {
|
|
1782
1769
|
const error = /* @__PURE__ */ new Error("[copilot-tool-bridge] aborted before execution");
|
|
1783
1770
|
return failureResult(args, invocation, startedAt, error.message, error, false);
|
|
1784
1771
|
}
|
|
1785
1772
|
try {
|
|
1786
|
-
await
|
|
1773
|
+
await input.beforeExecute?.({
|
|
1787
1774
|
args,
|
|
1788
1775
|
invocation,
|
|
1789
1776
|
sourceTool,
|
|
@@ -1801,7 +1788,7 @@ function convertOpenClawToolToSdkTool(sourceTool, ctx) {
|
|
|
1801
1788
|
}
|
|
1802
1789
|
let result;
|
|
1803
1790
|
try {
|
|
1804
|
-
result = await sourceTool.execute(invocation.toolCallId, preparedArgs,
|
|
1791
|
+
result = await sourceTool.execute(invocation.toolCallId, preparedArgs, input.abortSignal, void 0);
|
|
1805
1792
|
} catch (error) {
|
|
1806
1793
|
return failureResult(preparedArgs, invocation, startedAt, `[copilot-tool-bridge] tool '${sourceTool.name}' failed: ${toStringifiedError(error).message}`, error, true);
|
|
1807
1794
|
}
|
|
@@ -1812,9 +1799,10 @@ function convertOpenClawToolToSdkTool(sourceTool, ctx) {
|
|
|
1812
1799
|
isError: resultIsError
|
|
1813
1800
|
});
|
|
1814
1801
|
const resultError = resultIsError ? extractToolErrorMessage(sanitizedResult) : void 0;
|
|
1815
|
-
|
|
1802
|
+
input.attemptParams.observeToolTerminal?.({
|
|
1816
1803
|
toolCallId: invocation.toolCallId,
|
|
1817
1804
|
toolName: sourceTool.name,
|
|
1805
|
+
result,
|
|
1818
1806
|
arguments: preparedArgs,
|
|
1819
1807
|
executionStarted: true,
|
|
1820
1808
|
outcome: resultIsError ? "failure" : "success",
|
|
@@ -1832,15 +1820,10 @@ function convertOpenClawToolToSdkTool(sourceTool, ctx) {
|
|
|
1832
1820
|
});
|
|
1833
1821
|
return sdkResult;
|
|
1834
1822
|
};
|
|
1835
|
-
const handler = sourceTool.executionMode === "sequential" ? (args, invocation) => {
|
|
1836
|
-
const run = sequentialLock.then(() => executeOnce(args, invocation), () => executeOnce(args, invocation));
|
|
1837
|
-
sequentialLock = run.then(() => void 0, () => void 0);
|
|
1838
|
-
return run;
|
|
1839
|
-
} : executeOnce;
|
|
1840
1823
|
return {
|
|
1841
1824
|
description: sourceTool.description,
|
|
1842
1825
|
defer: sourceTool.catalogMode === "direct-only" ? "never" : void 0,
|
|
1843
|
-
handler,
|
|
1826
|
+
handler: (args, invocation) => scheduleToolExecution(sourceTool.executionMode, () => executeOnce(args, invocation)),
|
|
1844
1827
|
name: sourceTool.name,
|
|
1845
1828
|
overridesBuiltInTool: true,
|
|
1846
1829
|
parameters: sourceTool.parameters,
|
|
@@ -1866,6 +1849,7 @@ async function executeCatalogTool(input, params) {
|
|
|
1866
1849
|
input.attemptParams?.observeToolTerminal?.({
|
|
1867
1850
|
toolCallId: params.toolCallId,
|
|
1868
1851
|
toolName: params.toolName,
|
|
1852
|
+
result,
|
|
1869
1853
|
arguments: preparedArgs,
|
|
1870
1854
|
executionStarted,
|
|
1871
1855
|
outcome: isError ? "failure" : "success",
|
|
@@ -1891,6 +1875,7 @@ async function executeCatalogTool(input, params) {
|
|
|
1891
1875
|
if (!terminalObserved) input.attemptParams?.observeToolTerminal?.({
|
|
1892
1876
|
toolCallId: params.toolCallId,
|
|
1893
1877
|
toolName: params.toolName,
|
|
1878
|
+
result: error,
|
|
1894
1879
|
arguments: preparedArgs,
|
|
1895
1880
|
executionStarted,
|
|
1896
1881
|
outcome: "failure",
|
|
@@ -2087,7 +2072,8 @@ function buildCopilotPromptGuidance(params) {
|
|
|
2087
2072
|
delegationGuidance,
|
|
2088
2073
|
buildHarnessVisibleReplyGuidance({
|
|
2089
2074
|
sourceReplyDeliveryMode: params.attempt.sourceReplyDeliveryMode,
|
|
2090
|
-
messageToolAvailable: callableTools.has("message")
|
|
2075
|
+
messageToolAvailable: callableTools.has("message"),
|
|
2076
|
+
requireExplicitMessageTarget: params.requireExplicitMessageTarget
|
|
2091
2077
|
}),
|
|
2092
2078
|
buildCredentialSafetyPrompt(params.attempt.disableTools !== true && callableTools.has("secrets") ? "secrets" : void 0),
|
|
2093
2079
|
params.workspaceBootstrapInstructions?.trim(),
|
|
@@ -2100,7 +2086,6 @@ const COPILOT_USER_INPUT_QUESTION_ID = "answer";
|
|
|
2100
2086
|
const DEFAULT_USER_INPUT_TIMEOUT_MS = 9e5;
|
|
2101
2087
|
function createCopilotUserInputBridge(params) {
|
|
2102
2088
|
let pending;
|
|
2103
|
-
const gatewayCall = params.gatewayCall ?? callGatewayTool;
|
|
2104
2089
|
return {
|
|
2105
2090
|
async onUserInputRequest(request) {
|
|
2106
2091
|
pending?.abort(/* @__PURE__ */ new Error("Copilot user input request replaced"));
|
|
@@ -2117,7 +2102,7 @@ function createCopilotUserInputBridge(params) {
|
|
|
2117
2102
|
agentId: params.paramsForRun.agentId,
|
|
2118
2103
|
runId: params.paramsForRun.runId,
|
|
2119
2104
|
timeoutMs: params.paramsForRun.timeoutMs ?? DEFAULT_USER_INPUT_TIMEOUT_MS,
|
|
2120
|
-
gatewayCall,
|
|
2105
|
+
gatewayCall: params.gatewayCall,
|
|
2121
2106
|
delivery: params.paramsForRun,
|
|
2122
2107
|
promptOptions: {
|
|
2123
2108
|
intro: "Copilot needs input:",
|
|
@@ -2366,6 +2351,7 @@ async function createCopilotSessionSetup(params) {
|
|
|
2366
2351
|
return buildCopilotPromptGuidance({
|
|
2367
2352
|
attempt: input,
|
|
2368
2353
|
callableToolNames: promptPolicyResult.callableToolNames,
|
|
2354
|
+
requireExplicitMessageTarget: promptToolPolicy.requireExplicitMessageTarget,
|
|
2369
2355
|
workspaceBootstrapInstructions: workspaceBootstrap.instructions
|
|
2370
2356
|
});
|
|
2371
2357
|
} },
|
|
@@ -2560,7 +2546,7 @@ function createAttemptTranscriptJournal(params) {
|
|
|
2560
2546
|
};
|
|
2561
2547
|
const prepare = (write, options = {}) => {
|
|
2562
2548
|
const message = structuredClone(write.message);
|
|
2563
|
-
const originalReplayPayload =
|
|
2549
|
+
const originalReplayPayload = projectReplayPayload(message);
|
|
2564
2550
|
const hooked = runAgentHarnessBeforeMessageWriteHook({
|
|
2565
2551
|
message: structuredClone(message),
|
|
2566
2552
|
agentId: target.agentId,
|
|
@@ -2575,7 +2561,7 @@ function createAttemptTranscriptJournal(params) {
|
|
|
2575
2561
|
toolCallId: message.toolCallId,
|
|
2576
2562
|
toolName: message.toolName
|
|
2577
2563
|
} : {};
|
|
2578
|
-
const
|
|
2564
|
+
const projected = projectDisplay({
|
|
2579
2565
|
...hooked,
|
|
2580
2566
|
...toolIdentity,
|
|
2581
2567
|
...taintMetadata ? { __openclaw: {
|
|
@@ -2586,6 +2572,10 @@ function createAttemptTranscriptJournal(params) {
|
|
|
2586
2572
|
...message.role === "user" && message.provenance ? { provenance: message.provenance } : {},
|
|
2587
2573
|
...message.display === false ? { display: false } : {}
|
|
2588
2574
|
});
|
|
2575
|
+
const prepared = message.role === "user" ? restorePreparedUserTurnOperationalMetaForRuntime({
|
|
2576
|
+
runtimeMessage: projected,
|
|
2577
|
+
preparedMessage: message
|
|
2578
|
+
}) : projected;
|
|
2589
2579
|
return options.singleton && !isCompatibleSingletonRewrite(message, prepared) ? void 0 : prepared;
|
|
2590
2580
|
};
|
|
2591
2581
|
const append = async (write) => {
|
|
@@ -2603,7 +2593,7 @@ function createAttemptTranscriptJournal(params) {
|
|
|
2603
2593
|
}
|
|
2604
2594
|
if (outcome.kind === "rejected") throw new Error("Transcript session changed before singleton append");
|
|
2605
2595
|
if (!isDeepStrictEqual(projectReplayPayload(write.message), projectReplayPayload(outcome.result.message))) replayInvalid = true;
|
|
2606
|
-
if (outcome.result.message.role === "user") write.recorder?.markRuntimePersisted(outcome.result.message, outcome.result.anchor);
|
|
2596
|
+
if (outcome.result.message.role === "user") write.recorder?.markRuntimePersisted(outcome.result.message, outcome.result.anchor, { appended: outcome.result.appended });
|
|
2607
2597
|
return outcome.result;
|
|
2608
2598
|
};
|
|
2609
2599
|
const appendToolGroup = async (group) => {
|
|
@@ -2723,7 +2713,7 @@ function createAttemptTranscriptJournal(params) {
|
|
|
2723
2713
|
accept(outcome);
|
|
2724
2714
|
persistedInitialUser = persisted;
|
|
2725
2715
|
terminalAnchor = outcome.anchor;
|
|
2726
|
-
recorder.markRuntimePersisted(persisted, outcome.anchor);
|
|
2716
|
+
recorder.markRuntimePersisted(persisted, outcome.anchor, { appended: outcome.appended });
|
|
2727
2717
|
params.attempt.onUserMessagePersisted?.(persisted);
|
|
2728
2718
|
await publish(outcome.appended);
|
|
2729
2719
|
})();
|
|
@@ -2749,13 +2739,13 @@ function createAttemptTranscriptJournal(params) {
|
|
|
2749
2739
|
schedule(async () => {
|
|
2750
2740
|
const recorder = sdkUserRecorders.get(input.eventId);
|
|
2751
2741
|
sdkUserRecorders.delete(input.eventId);
|
|
2752
|
-
const
|
|
2742
|
+
const preparedMessage = await recorder?.resolveMessage();
|
|
2753
2743
|
const write = {
|
|
2754
2744
|
eventId: input.eventId,
|
|
2755
|
-
message:
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
}
|
|
2745
|
+
message: restorePreparedUserTurnOperationalMetaForRuntime({
|
|
2746
|
+
runtimeMessage: input.message,
|
|
2747
|
+
preparedMessage
|
|
2748
|
+
}),
|
|
2759
2749
|
recorder
|
|
2760
2750
|
};
|
|
2761
2751
|
if (pendingTools) {
|
|
@@ -3329,6 +3319,7 @@ async function runCopilotExecution(context) {
|
|
|
3329
3319
|
if (!userInputBridge) throw new Error("[copilot-attempt] ordinary attempts require a user-input bridge");
|
|
3330
3320
|
activeRunHandleRef = registerCopilotActiveRun({
|
|
3331
3321
|
abortActiveSession,
|
|
3322
|
+
agentId: sessionAgentId,
|
|
3332
3323
|
bridge,
|
|
3333
3324
|
canAcceptSteering: () => initialSdkUserValidated,
|
|
3334
3325
|
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-
|
|
891
|
+
const { resolvePoolAcquire, runCopilotAttempt } = await import("./attempt-e3wCSh8h.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-
|
|
1022
|
+
const { runCopilotIsolatedCompletion } = await import("./isolated-completion-D01XCEU3.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-
|
|
1114
|
+
const { resolvePoolAcquire } = await import("./attempt-e3wCSh8h.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-
|
|
1
|
+
import { t as createCopilotAgentHarness } from "./harness-qA-Kb-ZC.js";
|
|
2
2
|
export { createCopilotAgentHarness };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createCopilotAgentHarness } from "./harness-
|
|
1
|
+
import { t as createCopilotAgentHarness } from "./harness-qA-Kb-ZC.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-
|
|
1
|
+
import { n as resolveCopilotProvider, o as tokenFingerprint, r as createCopilotByokProxy } from "./harness-qA-Kb-ZC.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
|
|
@@ -26,14 +26,12 @@ async function awaitWithinCompletionBoundary(params) {
|
|
|
26
26
|
if (signal?.aborted) throw createAbortError(signal);
|
|
27
27
|
const remainingMs = params.boundary.deadlineMs - Date.now();
|
|
28
28
|
if (remainingMs <= 0) throw createTimeoutError(params.boundary.timeoutMs);
|
|
29
|
-
let boundaryWon = false;
|
|
30
29
|
let boundaryError;
|
|
31
30
|
let timer;
|
|
32
31
|
let onAbort;
|
|
33
32
|
const boundary = new Promise((_resolve, reject) => {
|
|
34
33
|
const rejectBoundary = (error) => {
|
|
35
|
-
if (
|
|
36
|
-
boundaryWon = true;
|
|
34
|
+
if (boundaryError) return;
|
|
37
35
|
boundaryError = error;
|
|
38
36
|
params.onBoundary?.();
|
|
39
37
|
reject(error);
|
|
@@ -45,15 +43,27 @@ async function awaitWithinCompletionBoundary(params) {
|
|
|
45
43
|
if (signal.aborted) onAbort();
|
|
46
44
|
}
|
|
47
45
|
});
|
|
46
|
+
const assertCurrent = () => {
|
|
47
|
+
if (boundaryError) throw boundaryError;
|
|
48
|
+
params.boundary.assertCurrent?.();
|
|
49
|
+
};
|
|
48
50
|
const operation = Promise.resolve().then(() => {
|
|
49
|
-
|
|
51
|
+
assertCurrent();
|
|
50
52
|
return params.start(remainingMs);
|
|
51
|
-
}).then(
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
}).then((value) => {
|
|
54
|
+
try {
|
|
55
|
+
assertCurrent();
|
|
56
|
+
return value;
|
|
57
|
+
} catch (error) {
|
|
58
|
+
startBestEffortCleanup(async () => await params.cleanupLate?.(value));
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
54
61
|
});
|
|
55
62
|
try {
|
|
56
63
|
return await Promise.race([operation, boundary]);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
params.boundary.assertCurrent?.();
|
|
66
|
+
throw error;
|
|
57
67
|
} finally {
|
|
58
68
|
if (timer) clearTimeout(timer);
|
|
59
69
|
if (signal && onAbort) signal.removeEventListener("abort", onAbort);
|
|
@@ -76,6 +86,7 @@ async function runCopilotIsolatedCompletion(params, getPool) {
|
|
|
76
86
|
if (params.thinkLevel !== void 0 && reasoningEffort === void 0) throw new Error(`[copilot] isolated completion does not support thinking level ${params.thinkLevel}`);
|
|
77
87
|
const boundary = {
|
|
78
88
|
abortSignal: params.abortSignal,
|
|
89
|
+
assertCurrent: params.assertCurrent,
|
|
79
90
|
deadlineMs: Date.now() + params.timeoutMs,
|
|
80
91
|
timeoutMs: params.timeoutMs
|
|
81
92
|
};
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/copilot",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.3",
|
|
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.
|
|
27
|
+
"pluginApi": ">=2026.9.3"
|
|
28
28
|
},
|
|
29
29
|
"build": {
|
|
30
|
-
"openclawVersion": "2026.9.
|
|
30
|
+
"openclawVersion": "2026.9.3",
|
|
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.
|
|
48
|
+
"openclaw": ">=2026.9.3"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
51
51
|
"openclaw": {
|