@openclaw/copilot 2026.8.1-beta.2 → 2026.8.1-beta.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-BNDq00ZS.js → attempt-DsIndF6T.js} +147 -91
- package/dist/{harness-EyKssDe5.js → harness-BJ_IcIJk.js} +57 -38
- package/dist/harness.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{isolated-completion-CM4w2GCk.js → isolated-completion-D9VIGPmy.js} +1 -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-BJ_IcIJk.js";
|
|
2
2
|
import { n as normalizeCopilotUsage, r as createCopilotIsolatedSessionRestrictions, t as buildCopilotAssistantUsage } from "./usage-bridge-Cpa-ZYwL.js";
|
|
3
|
-
import { normalizeOptionalString, readNonBlankString, readNonEmptyStringPreservingWhitespace, readNonEmptyStringPreservingWhitespace as readNonEmptyString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
-
import { TRANSCRIPT_CREDENTIAL_SAFETY_PROMPT, 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
|
+
import { normalizeOptionalString, normalizeUniqueStringEntries, readNonBlankString, readNonEmptyStringPreservingWhitespace, readNonEmptyStringPreservingWhitespace as readNonEmptyString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
+
import { SKILL_WORKSHOP_TOOL_NAME, TRANSCRIPT_CREDENTIAL_SAFETY_PROMPT, applyEmbeddedAttemptToolsAllow, awaitAgentEndSideEffects, buildAgentHookContextChannelFields, buildDelegationGuidanceSection, buildEmbeddedAttemptToolRunContext, buildHarnessVisibleReplyGuidance, buildSkillWorkshopPromptSection, callGatewayTool, cancelPendingAgentQuestionForSession, claimPendingAgentQuestionAnswer, clearActiveEmbeddedRun, detectAndLoadAgentHarnessPromptImages, embeddedAgentLog, extractToolErrorMessage, getModelProviderRequestTransport, getPluginToolMeta, getPluginToolSideEffectOwnerKey, isHostScopedAgentToolActive, isSubagentSessionKey, isToolResultError, projectAgentHarnessTranscriptMessageForDisplay, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptFsWorkspaceOnly, resolveAttemptSpawnWorkspaceDir, resolveBootstrapContextForRun, resolveCompactionTimeoutMs, resolveEmbeddedAttemptToolConstructionPlan, resolveMainSessionDelegationMode, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, resolveUserPath, 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";
|
|
@@ -304,7 +304,7 @@ function createResult(params, state) {
|
|
|
304
304
|
const toolMetas = state.toolMetas ?? [];
|
|
305
305
|
const replayMetadata = params.operation === "settled-tool-finalization" ? {
|
|
306
306
|
hadPotentialSideEffects: false,
|
|
307
|
-
replaySafe:
|
|
307
|
+
replaySafe: !transcriptPersistenceFailed
|
|
308
308
|
} : computeReplayMetadata({
|
|
309
309
|
priorReplayInvalid: params.initialReplayState?.replayInvalid === true || state.nativeReplayInvalid === true || transcriptPersistenceFailed,
|
|
310
310
|
priorHadPotentialSideEffects: params.initialReplayState?.hadPotentialSideEffects,
|
|
@@ -353,7 +353,8 @@ function createResult(params, state) {
|
|
|
353
353
|
sessionFileUsed: readNonEmptyString(params.sessionFile),
|
|
354
354
|
sessionIdUsed: state.sessionIdUsed ?? readNonEmptyString(params.sessionId) ?? "copilot-session",
|
|
355
355
|
toolMetas,
|
|
356
|
-
yieldDetected: state.yieldDetected === true
|
|
356
|
+
yieldDetected: state.yieldDetected === true,
|
|
357
|
+
...state.yieldAcknowledgment ? { yieldAcknowledgment: state.yieldAcknowledgment } : {}
|
|
357
358
|
};
|
|
358
359
|
}
|
|
359
360
|
function createPromptError$1(code, message, cause) {
|
|
@@ -441,21 +442,6 @@ function resolveImageCapabilityModel(params) {
|
|
|
441
442
|
if (model && typeof model === "object" && Array.isArray(model.input)) return { input: model.input };
|
|
442
443
|
return { input: ["image"] };
|
|
443
444
|
}
|
|
444
|
-
function createSystemMessageContent(params, workspaceBootstrapInstructions) {
|
|
445
|
-
if (isRawCopilotModelRun(params)) return;
|
|
446
|
-
const sections = [TRANSCRIPT_CREDENTIAL_SAFETY_PROMPT];
|
|
447
|
-
const bootstrap = workspaceBootstrapInstructions?.trim();
|
|
448
|
-
if (bootstrap) sections.push(bootstrap);
|
|
449
|
-
const extraSystemPrompt = readNonEmptyString(params.extraSystemPrompt)?.trim();
|
|
450
|
-
if (extraSystemPrompt) {
|
|
451
|
-
const contextHeader = params.promptMode === "minimal" ? "## Subagent Context" : "## Conversation Context";
|
|
452
|
-
sections.push(`${contextHeader}\n${extraSystemPrompt}`);
|
|
453
|
-
}
|
|
454
|
-
return sections.length > 0 ? sections.join("\n\n") : void 0;
|
|
455
|
-
}
|
|
456
|
-
function isRawCopilotModelRun(params) {
|
|
457
|
-
return params.modelRun === true || params.promptMode === "none";
|
|
458
|
-
}
|
|
459
445
|
function readResolvedAttemptPath(value) {
|
|
460
446
|
const raw = readNonEmptyString(value)?.trim();
|
|
461
447
|
if (!raw) return;
|
|
@@ -1403,7 +1389,7 @@ async function waitForPersistenceReceipt(receipt, requestedTimeoutMs) {
|
|
|
1403
1389
|
//#endregion
|
|
1404
1390
|
//#region extensions/copilot/src/attempt-finalize.ts
|
|
1405
1391
|
async function completeCopilotAttempt(params) {
|
|
1406
|
-
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;
|
|
1392
|
+
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, yieldAcknowledgment } = params;
|
|
1407
1393
|
const snap = bridge?.snapshot();
|
|
1408
1394
|
const assistantTexts = bridge?.finalizeAssistantTexts() ?? [];
|
|
1409
1395
|
const lastAssistant = bridge?.buildAssistantMessage({
|
|
@@ -1444,7 +1430,8 @@ async function completeCopilotAttempt(params) {
|
|
|
1444
1430
|
timedOutDuringCompaction,
|
|
1445
1431
|
toolMetas: snap ? [...snap.toolMetas] : [],
|
|
1446
1432
|
usage: snap?.usage,
|
|
1447
|
-
yieldDetected
|
|
1433
|
+
yieldDetected,
|
|
1434
|
+
yieldAcknowledgment
|
|
1448
1435
|
});
|
|
1449
1436
|
if (sentTurnStarted && !settledToolFinalization && !transcriptJournal?.hasFailed()) runAgentHarnessLlmOutputHook({
|
|
1450
1437
|
event: {
|
|
@@ -1503,7 +1490,16 @@ function userText$1(content) {
|
|
|
1503
1490
|
return JSON.stringify(content) ?? "";
|
|
1504
1491
|
}
|
|
1505
1492
|
//#endregion
|
|
1493
|
+
//#region extensions/copilot/src/attempt-mode.ts
|
|
1494
|
+
function isRawCopilotModelRun(params) {
|
|
1495
|
+
return params.modelRun === true || params.promptMode === "none";
|
|
1496
|
+
}
|
|
1497
|
+
//#endregion
|
|
1506
1498
|
//#region extensions/copilot/src/tool-bridge.ts
|
|
1499
|
+
const EMPTY_PROMPT_TOOL_POLICY = { apply: () => ({
|
|
1500
|
+
tools: [],
|
|
1501
|
+
callableToolNames: []
|
|
1502
|
+
}) };
|
|
1507
1503
|
const SUPPORTED_TOOL_PROVIDERS = /* @__PURE__ */ new Set(["github-copilot"]);
|
|
1508
1504
|
const BASE_COPILOT_CODING_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
1509
1505
|
"edit",
|
|
@@ -1515,20 +1511,17 @@ const SHELL_COPILOT_CODING_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
|
1515
1511
|
"exec",
|
|
1516
1512
|
"process"
|
|
1517
1513
|
]);
|
|
1518
|
-
function supportsModelTools(modelProvider) {
|
|
1519
|
-
return SUPPORTED_TOOL_PROVIDERS.has(modelProvider);
|
|
1520
|
-
}
|
|
1521
1514
|
async function createCopilotToolBridge(input) {
|
|
1522
|
-
if (!input.allowModelTools && !
|
|
1515
|
+
if (!input.allowModelTools && !SUPPORTED_TOOL_PROVIDERS.has(input.modelProvider)) return {
|
|
1523
1516
|
codeModeEngaged: false,
|
|
1524
|
-
|
|
1517
|
+
promptToolPolicy: EMPTY_PROMPT_TOOL_POLICY,
|
|
1525
1518
|
sourceTools: []
|
|
1526
1519
|
};
|
|
1527
1520
|
const attemptParams = input.attemptParams;
|
|
1528
1521
|
const toolPlan = resolveEmbeddedAttemptToolConstructionPlan({
|
|
1529
1522
|
disableTools: attemptParams.disableTools,
|
|
1530
1523
|
forceMessageTool: shouldForceCopilotMessageTool(attemptParams),
|
|
1531
|
-
isRawModelRun:
|
|
1524
|
+
isRawModelRun: isRawCopilotModelRun(attemptParams),
|
|
1532
1525
|
toolsAllow: attemptParams.toolsAllow
|
|
1533
1526
|
});
|
|
1534
1527
|
const effectiveToolPlan = hasNonWildcardGlobAllowlist(toolPlan.runtimeToolAllowlist) ? {
|
|
@@ -1545,7 +1538,7 @@ async function createCopilotToolBridge(input) {
|
|
|
1545
1538
|
} : toolPlan;
|
|
1546
1539
|
if (!effectiveToolPlan.constructTools) return {
|
|
1547
1540
|
codeModeEngaged: false,
|
|
1548
|
-
|
|
1541
|
+
promptToolPolicy: EMPTY_PROMPT_TOOL_POLICY,
|
|
1549
1542
|
sourceTools: []
|
|
1550
1543
|
};
|
|
1551
1544
|
const createOpenClawCodingTools = input.createOpenClawCodingTools ?? (await import("openclaw/plugin-sdk/agent-harness")).createOpenClawCodingTools;
|
|
@@ -1556,7 +1549,7 @@ async function createCopilotToolBridge(input) {
|
|
|
1556
1549
|
disableTools: attemptParams.disableTools,
|
|
1557
1550
|
executeTool: (toolParams) => executeCatalogTool(input, toolParams),
|
|
1558
1551
|
forceMessageTool: shouldForceCopilotMessageTool(attemptParams),
|
|
1559
|
-
isRawModelRun:
|
|
1552
|
+
isRawModelRun: isRawCopilotModelRun(attemptParams),
|
|
1560
1553
|
model: attemptParams.model,
|
|
1561
1554
|
modelId: input.modelId,
|
|
1562
1555
|
modelProvider: input.modelProvider,
|
|
@@ -1590,26 +1583,34 @@ async function createCopilotToolBridge(input) {
|
|
|
1590
1583
|
} catch (error) {
|
|
1591
1584
|
throw createError(`[copilot-tool-bridge] createOpenClawCodingTools failed: ${toStringifiedError(error).message}`, error);
|
|
1592
1585
|
}
|
|
1593
|
-
const
|
|
1594
|
-
const
|
|
1595
|
-
const newlyConstructedTools =
|
|
1586
|
+
const plannedSourceTools = filterCopilotToolsForConstructionPlan(applyEmbeddedAttemptToolsAllow(sourceTools, toolSurfaceRuntime.runtimeToolAllowlist, { toolMeta: (tool) => getPluginToolMeta(tool) ?? readInlinePluginToolMeta(tool) }), effectiveToolPlan.codingToolConstructionPlan, { preserveToolNames: toolSurfaceRuntime.runtimeToolAllowlist });
|
|
1587
|
+
const compactedTools = toolSurfaceRuntime.compactTools(plannedSourceTools, { localModelLeanApplied: true });
|
|
1588
|
+
const newlyConstructedTools = compactedTools.tools.filter((tool) => !boundSourceTools.has(tool));
|
|
1596
1589
|
const boundNewlyConstructedTools = newlyConstructedTools.length > 0 ? hostCapabilities.bindToolSurface(newlyConstructedTools, bindingOptions) : newlyConstructedTools;
|
|
1597
1590
|
if (boundNewlyConstructedTools.length !== newlyConstructedTools.length) throw new Error("Copilot host capability changed the tool surface length.");
|
|
1598
1591
|
const newlyBoundTools = /* @__PURE__ */ new Map();
|
|
1599
1592
|
for (let index = 0; index < newlyConstructedTools.length; index += 1) newlyBoundTools.set(newlyConstructedTools[index], boundNewlyConstructedTools[index]);
|
|
1600
|
-
const exposedTools =
|
|
1593
|
+
const exposedTools = compactedTools.tools.map((tool) => newlyBoundTools.get(tool) ?? tool);
|
|
1601
1594
|
const duplicateNames = findDuplicateToolNames(exposedTools);
|
|
1602
1595
|
if (duplicateNames.length > 0) throw new Error(`[copilot-tool-bridge] duplicate tool names: ${duplicateNames.join(", ")}`);
|
|
1596
|
+
const sdkTools = exposedTools.map((sourceTool) => convertOpenClawToolToSdkTool(sourceTool, {
|
|
1597
|
+
abortSignal: input.abortSignal,
|
|
1598
|
+
beforeExecute: input.beforeExecute,
|
|
1599
|
+
onAgentToolResult: input.attemptParams?.onAgentToolResult,
|
|
1600
|
+
onToolCompleted: input.onToolCompleted,
|
|
1601
|
+
observeToolTerminal: input.attemptParams?.observeToolTerminal
|
|
1602
|
+
}));
|
|
1603
1603
|
return {
|
|
1604
1604
|
cleanup: toolSurfaceRuntime.cleanup,
|
|
1605
1605
|
codeModeEngaged: toolSurfaceRuntime.codeModeControlsEnabled,
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1606
|
+
promptToolPolicy: { apply: (params = {}) => {
|
|
1607
|
+
const result = compactedTools.promptToolPolicy.apply(params);
|
|
1608
|
+
const directToolNames = new Set(result.tools.map((tool) => tool.name));
|
|
1609
|
+
return {
|
|
1610
|
+
tools: sdkTools.filter((tool) => directToolNames.has(tool.name)),
|
|
1611
|
+
callableToolNames: result.callableToolNames
|
|
1612
|
+
};
|
|
1613
|
+
} },
|
|
1613
1614
|
sourceTools: exposedTools
|
|
1614
1615
|
};
|
|
1615
1616
|
}
|
|
@@ -1665,6 +1666,7 @@ function buildOpenClawCodingToolsOptions(input, toolPlan, toolSurfaceRuntime) {
|
|
|
1665
1666
|
elevated: a.bashElevated
|
|
1666
1667
|
},
|
|
1667
1668
|
messageProvider: a.messageProvider ?? a.messageChannel,
|
|
1669
|
+
messageChannel: a.messageChannel,
|
|
1668
1670
|
toolBindings: a.toolBindings,
|
|
1669
1671
|
chatType: a.chatType,
|
|
1670
1672
|
agentAccountId: a.agentAccountId,
|
|
@@ -1689,6 +1691,7 @@ function buildOpenClawCodingToolsOptions(input, toolPlan, toolSurfaceRuntime) {
|
|
|
1689
1691
|
sessionId: input.sessionId,
|
|
1690
1692
|
runId: a.runId,
|
|
1691
1693
|
agentDir,
|
|
1694
|
+
preparedModelRuntime: a.preparedModelRuntime,
|
|
1692
1695
|
workspaceDir,
|
|
1693
1696
|
cwd,
|
|
1694
1697
|
sandbox,
|
|
@@ -1725,9 +1728,9 @@ function buildOpenClawCodingToolsOptions(input, toolPlan, toolSurfaceRuntime) {
|
|
|
1725
1728
|
computerContextEpoch: input.computerContextEpoch,
|
|
1726
1729
|
onToolOutcome: a.onToolOutcome,
|
|
1727
1730
|
isTurnTainted: a.isTurnTainted,
|
|
1728
|
-
onYield: (message) => {
|
|
1731
|
+
onYield: (message, acknowledgment) => {
|
|
1729
1732
|
try {
|
|
1730
|
-
input.onYieldDetected?.(message);
|
|
1733
|
+
input.onYieldDetected?.(message, acknowledgment);
|
|
1731
1734
|
} catch (error) {
|
|
1732
1735
|
console.warn("[copilot-tool-bridge] onYieldDetected handler threw; continuing", error);
|
|
1733
1736
|
}
|
|
@@ -1738,6 +1741,8 @@ function buildOpenClawCodingToolsOptions(input, toolPlan, toolSurfaceRuntime) {
|
|
|
1738
1741
|
function convertOpenClawToolToSdkTool(sourceTool, ctx) {
|
|
1739
1742
|
if (typeof sourceTool.name !== "string" || sourceTool.name.trim().length === 0) throw new Error("[copilot-tool-bridge] tool name must be a non-empty string");
|
|
1740
1743
|
if (typeof sourceTool.execute !== "function") throw new Error(`[copilot-tool-bridge] tool '${sourceTool.name}' must define an execute function`);
|
|
1744
|
+
const ownerKey = getPluginToolSideEffectOwnerKey(sourceTool);
|
|
1745
|
+
const ownerMutation = ownerKey ? { ownerKey } : void 0;
|
|
1741
1746
|
let sequentialLock = Promise.resolve();
|
|
1742
1747
|
const notifyToolResult = (result, isError) => {
|
|
1743
1748
|
try {
|
|
@@ -1767,7 +1772,8 @@ function convertOpenClawToolToSdkTool(sourceTool, ctx) {
|
|
|
1767
1772
|
arguments: executedArgs,
|
|
1768
1773
|
executionStarted,
|
|
1769
1774
|
outcome: "failure",
|
|
1770
|
-
failure: { error: errorMessage }
|
|
1775
|
+
failure: { error: errorMessage },
|
|
1776
|
+
...ownerMutation ? { ownerMutation } : {}
|
|
1771
1777
|
});
|
|
1772
1778
|
notifyToolResult(sanitizeToolResult({
|
|
1773
1779
|
content: [{
|
|
@@ -1830,7 +1836,8 @@ function convertOpenClawToolToSdkTool(sourceTool, ctx) {
|
|
|
1830
1836
|
arguments: preparedArgs,
|
|
1831
1837
|
executionStarted: true,
|
|
1832
1838
|
outcome: resultIsError ? "failure" : "success",
|
|
1833
|
-
...resultIsError ? { failure: { error: resultError ?? "tool returned an error" } } : {}
|
|
1839
|
+
...resultIsError ? { failure: { error: resultError ?? "tool returned an error" } } : {},
|
|
1840
|
+
...ownerMutation ? { ownerMutation } : {}
|
|
1834
1841
|
});
|
|
1835
1842
|
notifyToolResult(sanitizedResult, resultIsError);
|
|
1836
1843
|
notifyToolCompleted({
|
|
@@ -1859,6 +1866,8 @@ function convertOpenClawToolToSdkTool(sourceTool, ctx) {
|
|
|
1859
1866
|
}
|
|
1860
1867
|
async function executeCatalogTool(input, params) {
|
|
1861
1868
|
const sourceTool = params.tool;
|
|
1869
|
+
const ownerKey = getPluginToolSideEffectOwnerKey(sourceTool);
|
|
1870
|
+
const ownerMutation = ownerKey ? { ownerKey } : void 0;
|
|
1862
1871
|
const startedAt = Date.now();
|
|
1863
1872
|
let preparedArgs = params.input;
|
|
1864
1873
|
let executionStarted = false;
|
|
@@ -1877,7 +1886,8 @@ async function executeCatalogTool(input, params) {
|
|
|
1877
1886
|
arguments: preparedArgs,
|
|
1878
1887
|
executionStarted,
|
|
1879
1888
|
outcome: isError ? "failure" : "success",
|
|
1880
|
-
...error ? { failure: { error } } : {}
|
|
1889
|
+
...error ? { failure: { error } } : {},
|
|
1890
|
+
...ownerMutation ? { ownerMutation } : {}
|
|
1881
1891
|
});
|
|
1882
1892
|
input.attemptParams?.onAgentToolResult?.({
|
|
1883
1893
|
toolName: params.toolName,
|
|
@@ -1901,7 +1911,8 @@ async function executeCatalogTool(input, params) {
|
|
|
1901
1911
|
arguments: preparedArgs,
|
|
1902
1912
|
executionStarted,
|
|
1903
1913
|
outcome: "failure",
|
|
1904
|
-
failure: { error: message }
|
|
1914
|
+
failure: { error: message },
|
|
1915
|
+
...ownerMutation ? { ownerMutation } : {}
|
|
1905
1916
|
});
|
|
1906
1917
|
const failure = sanitizeToolResult({
|
|
1907
1918
|
content: [{
|
|
@@ -1944,17 +1955,6 @@ function createError(message, cause) {
|
|
|
1944
1955
|
return error;
|
|
1945
1956
|
}
|
|
1946
1957
|
/**
|
|
1947
|
-
* Returns true when the attempt was launched as a raw-model run, which
|
|
1948
|
-
* suppresses tool construction in PI
|
|
1949
|
-
* (`src/agents/pi-embedded-runner/run/attempt.ts:1305-1310` and
|
|
1950
|
-
* `attempt-tool-construction-plan.ts:165-184`). A run is raw when the
|
|
1951
|
-
* caller explicitly sets `modelRun: true` or asks for no system prompt
|
|
1952
|
-
* via `promptMode: "none"`.
|
|
1953
|
-
*/
|
|
1954
|
-
function isCopilotRawModelRun(params) {
|
|
1955
|
-
return params.modelRun === true || params.promptMode === "none";
|
|
1956
|
-
}
|
|
1957
|
-
/**
|
|
1958
1958
|
* Mirrors PI's `shouldForceMessageTool` semantics: a message tool is
|
|
1959
1959
|
* forced when the caller asked for it explicitly or when the source
|
|
1960
1960
|
* reply delivery mode is `message_tool_only`, but never when
|
|
@@ -1967,18 +1967,6 @@ function shouldForceCopilotMessageTool(params) {
|
|
|
1967
1967
|
if (params.disableMessageTool === true) return false;
|
|
1968
1968
|
return params.forceMessageTool === true || params.sourceReplyDeliveryMode === "message_tool_only";
|
|
1969
1969
|
}
|
|
1970
|
-
/**
|
|
1971
|
-
* Mirrors PI's `applyEmbeddedAttemptToolsAllow`
|
|
1972
|
-
* (`src/agents/embedded-agent-runner/run/attempt-tool-construction-plan.ts`)
|
|
1973
|
-
* so final filtering keeps aliases, groups, plugin policies, and glob
|
|
1974
|
-
* semantics identical to the in-tree embedded runner.
|
|
1975
|
-
*/
|
|
1976
|
-
function filterCopilotToolsForAllowlist(tools, toolsAllow, options) {
|
|
1977
|
-
const filtered = applyEmbeddedAttemptToolsAllow(tools, toolsAllow, { toolMeta: (tool) => getPluginToolMeta(tool) ?? readInlinePluginToolMeta(tool) });
|
|
1978
|
-
if (!options?.forceToolNames?.length) return filtered;
|
|
1979
|
-
const allowedNames = /* @__PURE__ */ new Set([...filtered.map((tool) => tool.name), ...options.forceToolNames]);
|
|
1980
|
-
return tools.filter((tool) => allowedNames.has(tool.name));
|
|
1981
|
-
}
|
|
1982
1970
|
function filterCopilotToolsForConstructionPlan(tools, plan, options = {}) {
|
|
1983
1971
|
if (plan.includeBaseCodingTools && plan.includeShellTools) return tools;
|
|
1984
1972
|
const preserveToolNames = new Set(options.preserveToolNames);
|
|
@@ -2090,6 +2078,41 @@ async function resolveCopilotAttemptSandbox(params) {
|
|
|
2090
2078
|
};
|
|
2091
2079
|
}
|
|
2092
2080
|
//#endregion
|
|
2081
|
+
//#region extensions/copilot/src/prompt-guidance.ts
|
|
2082
|
+
const COPILOT_HARNESS_IDENTITY = "You are a personal agent running inside OpenClaw. Your available OpenClaw capabilities are policy-filtered for this turn; use only the exact tools exposed to you.";
|
|
2083
|
+
function buildCopilotPromptGuidance(params) {
|
|
2084
|
+
if (isRawCopilotModelRun(params.attempt)) return;
|
|
2085
|
+
const callableTools = new Set(normalizeUniqueStringEntries(params.callableToolNames));
|
|
2086
|
+
const hasSessionsSpawn = callableTools.has("sessions_spawn");
|
|
2087
|
+
const isMinimal = params.attempt.promptMode === "minimal";
|
|
2088
|
+
const extraSystemPrompt = readNonEmptyStringPreservingWhitespace(params.attempt.extraSystemPrompt)?.trim();
|
|
2089
|
+
const delegationGuidance = params.attempt.disableTools !== true && params.attempt.delegationCapability !== "report_only" ? buildDelegationGuidanceSection({
|
|
2090
|
+
mode: resolveMainSessionDelegationMode({
|
|
2091
|
+
config: params.attempt.config,
|
|
2092
|
+
agentId: params.attempt.agentId,
|
|
2093
|
+
sessionKey: params.attempt.sessionKey
|
|
2094
|
+
}),
|
|
2095
|
+
isMinimal,
|
|
2096
|
+
hiddenDelegationTool: hasSessionsSpawn ? "`sessions_spawn`" : "",
|
|
2097
|
+
hasVisibleSessionSpawn: hasSessionsSpawn,
|
|
2098
|
+
hasSessionsYield: callableTools.has("sessions_yield"),
|
|
2099
|
+
hasSubagentsList: callableTools.has("subagents"),
|
|
2100
|
+
hasSessionsSend: callableTools.has("sessions_send")
|
|
2101
|
+
}).join("\n") : void 0;
|
|
2102
|
+
return [
|
|
2103
|
+
COPILOT_HARNESS_IDENTITY,
|
|
2104
|
+
callableTools.has(SKILL_WORKSHOP_TOOL_NAME) ? buildSkillWorkshopPromptSection().join("\n") : void 0,
|
|
2105
|
+
delegationGuidance,
|
|
2106
|
+
buildHarnessVisibleReplyGuidance({
|
|
2107
|
+
sourceReplyDeliveryMode: params.attempt.sourceReplyDeliveryMode,
|
|
2108
|
+
messageToolAvailable: callableTools.has("message")
|
|
2109
|
+
}),
|
|
2110
|
+
TRANSCRIPT_CREDENTIAL_SAFETY_PROMPT,
|
|
2111
|
+
params.workspaceBootstrapInstructions?.trim(),
|
|
2112
|
+
extraSystemPrompt ? `${isMinimal ? "## Subagent Context" : "## Conversation Context"}\n${extraSystemPrompt}` : void 0
|
|
2113
|
+
].filter((section) => section?.trim()).join("\n\n") || void 0;
|
|
2114
|
+
}
|
|
2115
|
+
//#endregion
|
|
2093
2116
|
//#region extensions/copilot/src/user-input-bridge.ts
|
|
2094
2117
|
const COPILOT_USER_INPUT_QUESTION_ID = "answer";
|
|
2095
2118
|
const DEFAULT_USER_INPUT_TIMEOUT_MS = 15 * 6e4;
|
|
@@ -2325,7 +2348,7 @@ function readResolvedWorkspacePath(value) {
|
|
|
2325
2348
|
//#endregion
|
|
2326
2349
|
//#region extensions/copilot/src/attempt-session-setup.ts
|
|
2327
2350
|
async function createCopilotSessionSetup(params) {
|
|
2328
|
-
const { attempt: input, byokProxy, effectiveCwd, effectiveWorkspaceDir, hookContext, modelRef, messages, operation, poolAcquire, ringZeroSystemAgentRun,
|
|
2351
|
+
const { attempt: input, byokProxy, effectiveCwd, effectiveWorkspaceDir, hookContext, modelRef, messages, operation, poolAcquire, ringZeroSystemAgentRun, promptToolPolicy, sessionProvider, settledToolFinalization, signal } = params;
|
|
2329
2352
|
const ordinaryAttemptInput = settledToolFinalization ? void 0 : (() => {
|
|
2330
2353
|
assertCopilotAttemptHostCapabilities(input);
|
|
2331
2354
|
return input;
|
|
@@ -2335,22 +2358,51 @@ async function createCopilotSessionSetup(params) {
|
|
|
2335
2358
|
effectiveWorkspaceDir,
|
|
2336
2359
|
warn: (message) => console.warn(message)
|
|
2337
2360
|
}) : { instructions: void 0 };
|
|
2338
|
-
const
|
|
2339
|
-
|
|
2361
|
+
const forceToolNames = ordinaryAttemptInput && shouldForceCopilotMessageTool(ordinaryAttemptInput) ? ["message"] : void 0;
|
|
2362
|
+
let promptPolicyResult;
|
|
2363
|
+
let promptBuild;
|
|
2364
|
+
if (settledToolFinalization) promptBuild = {
|
|
2340
2365
|
prompt: input.prompt,
|
|
2341
|
-
developerInstructions:
|
|
2342
|
-
}
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2366
|
+
developerInstructions: ""
|
|
2367
|
+
};
|
|
2368
|
+
else if (isRawCopilotModelRun(input)) {
|
|
2369
|
+
promptPolicyResult = promptToolPolicy?.apply();
|
|
2370
|
+
promptBuild = {
|
|
2371
|
+
prompt: input.prompt,
|
|
2372
|
+
developerInstructions: ""
|
|
2373
|
+
};
|
|
2374
|
+
} else {
|
|
2375
|
+
if (!ordinaryAttemptInput) throw new Error("Copilot ordinary attempt authority is unavailable.");
|
|
2376
|
+
if (!promptToolPolicy) throw new Error("Copilot ordinary attempts require a prompt tool policy.");
|
|
2377
|
+
promptBuild = await resolveAgentHarnessBeforePromptBuildResult({
|
|
2378
|
+
prompt: input.prompt,
|
|
2379
|
+
developerInstructions: { build: ({ toolsAllow }) => {
|
|
2380
|
+
promptPolicyResult = promptToolPolicy.apply({
|
|
2381
|
+
toolsAllow,
|
|
2382
|
+
forceToolNames
|
|
2383
|
+
});
|
|
2384
|
+
return buildCopilotPromptGuidance({
|
|
2385
|
+
attempt: input,
|
|
2386
|
+
callableToolNames: promptPolicyResult.callableToolNames,
|
|
2387
|
+
workspaceBootstrapInstructions: workspaceBootstrap.instructions
|
|
2388
|
+
});
|
|
2389
|
+
} },
|
|
2390
|
+
messages,
|
|
2391
|
+
ctx: hookContext,
|
|
2392
|
+
bootstrapContextRunKind: input.bootstrapContextRunKind,
|
|
2393
|
+
toolAuthority: {
|
|
2394
|
+
fingerprint: input.toolAuthorityFingerprint,
|
|
2395
|
+
activeToolNames: () => promptPolicyResult?.callableToolNames ?? [],
|
|
2396
|
+
assertActive: ordinaryAttemptInput.hostCapabilities.assertActive
|
|
2397
|
+
}
|
|
2398
|
+
});
|
|
2399
|
+
}
|
|
2349
2400
|
const attemptInput = promptBuild.prompt === input.prompt ? input : {
|
|
2350
2401
|
...input,
|
|
2351
2402
|
prompt: promptBuild.prompt
|
|
2352
2403
|
};
|
|
2353
|
-
const promptTools =
|
|
2404
|
+
const promptTools = promptPolicyResult?.tools ?? [];
|
|
2405
|
+
const finalDeveloperInstructions = promptBuild.developerInstructions;
|
|
2354
2406
|
const includeAskUser = !ringZeroSystemAgentRun && (attemptInput.pluginHarnessToolPolicyRestricted !== true || promptTools.some((tool) => tool.name === "ask_user"));
|
|
2355
2407
|
let promptImagesCount = 0;
|
|
2356
2408
|
const emitLlmInput = (prompt, additionalContext) => {
|
|
@@ -2361,7 +2413,7 @@ async function createCopilotSessionSetup(params) {
|
|
|
2361
2413
|
sessionId: input.sessionId,
|
|
2362
2414
|
provider: modelRef.provider,
|
|
2363
2415
|
model: modelRef.id,
|
|
2364
|
-
...
|
|
2416
|
+
...finalDeveloperInstructions ? { systemPrompt: finalDeveloperInstructions } : {},
|
|
2365
2417
|
prompt: additionalContext ? `${prompt}\n\n${additionalContext}` : prompt,
|
|
2366
2418
|
historyMessages: [],
|
|
2367
2419
|
imagesCount: promptImagesCount,
|
|
@@ -2378,14 +2430,14 @@ async function createCopilotSessionSetup(params) {
|
|
|
2378
2430
|
signal
|
|
2379
2431
|
});
|
|
2380
2432
|
})();
|
|
2381
|
-
const sessionConfig = createSessionConfig(attemptInput, modelRef.id, promptTools, poolAcquire.auth, sessionProvider,
|
|
2433
|
+
const sessionConfig = createSessionConfig(attemptInput, modelRef.id, promptTools, poolAcquire.auth, sessionProvider, finalDeveloperInstructions || void 0, effectiveWorkspaceDir, effectiveCwd, userInputBridge?.onUserInputRequest, {
|
|
2382
2434
|
hooksBridgeOptions: hasNativePromptHook ? { onUserPromptSubmitted: ({ additionalContext, prompt }) => emitLlmInput(prompt, additionalContext) } : void 0,
|
|
2383
2435
|
includeAskUser,
|
|
2384
2436
|
operation: operation ?? "attempt"
|
|
2385
2437
|
});
|
|
2386
2438
|
return {
|
|
2387
2439
|
attemptInput,
|
|
2388
|
-
compactionSessionConfig: byokProxy ? createSessionConfig(attemptInput, modelRef.id, promptTools, poolAcquire.auth, poolAcquire.provider,
|
|
2440
|
+
compactionSessionConfig: byokProxy ? createSessionConfig(attemptInput, modelRef.id, promptTools, poolAcquire.auth, poolAcquire.provider, finalDeveloperInstructions || void 0, effectiveWorkspaceDir, effectiveCwd, userInputBridge?.onUserInputRequest, {
|
|
2389
2441
|
hooksBridgeOptions: hasNativePromptHook ? { onUserPromptSubmitted: ({ additionalContext, prompt }) => emitLlmInput(prompt, additionalContext) } : void 0,
|
|
2390
2442
|
includeAskUser,
|
|
2391
2443
|
operation: operation ?? "attempt"
|
|
@@ -3027,6 +3079,7 @@ async function runCopilotExecution(context) {
|
|
|
3027
3079
|
let downgradedFromResume = false;
|
|
3028
3080
|
let resumeFailureRecovered = false;
|
|
3029
3081
|
let yieldDetected = false;
|
|
3082
|
+
let yieldAcknowledgment;
|
|
3030
3083
|
let lastToolError;
|
|
3031
3084
|
const hostObserveToolTerminal = input.observeToolTerminal;
|
|
3032
3085
|
const observeToolTerminal = hostObserveToolTerminal ? (observation) => {
|
|
@@ -3124,8 +3177,8 @@ async function runCopilotExecution(context) {
|
|
|
3124
3177
|
const sessionRef = { current: void 0 };
|
|
3125
3178
|
const computerContextEpoch = { value: 0 };
|
|
3126
3179
|
let codeModeEngaged;
|
|
3180
|
+
let promptToolPolicy;
|
|
3127
3181
|
try {
|
|
3128
|
-
let sdkTools = [];
|
|
3129
3182
|
let resultContentSourceByToolName = /* @__PURE__ */ new Map();
|
|
3130
3183
|
if (!settledToolFinalization) try {
|
|
3131
3184
|
assertCopilotAttemptHostCapabilities(input);
|
|
@@ -3148,8 +3201,9 @@ async function runCopilotExecution(context) {
|
|
|
3148
3201
|
} : input,
|
|
3149
3202
|
computerContextEpoch,
|
|
3150
3203
|
sessionRef,
|
|
3151
|
-
onYieldDetected: () => {
|
|
3204
|
+
onYieldDetected: (_message, acknowledgment) => {
|
|
3152
3205
|
yieldDetected = true;
|
|
3206
|
+
yieldAcknowledgment = acknowledgment;
|
|
3153
3207
|
},
|
|
3154
3208
|
onToolCompleted: ({ args, error, result, startedAt, toolCallId, toolName }) => runAgentHarnessAfterToolCallHook({
|
|
3155
3209
|
toolName,
|
|
@@ -3167,7 +3221,7 @@ async function runCopilotExecution(context) {
|
|
|
3167
3221
|
});
|
|
3168
3222
|
cleanupToolBridge = toolBridge.cleanup;
|
|
3169
3223
|
codeModeEngaged = toolBridge.codeModeEngaged;
|
|
3170
|
-
|
|
3224
|
+
promptToolPolicy = toolBridge.promptToolPolicy;
|
|
3171
3225
|
resultContentSourceByToolName = new Map(toolBridge.sourceTools.flatMap((tool) => tool.resultContentSource ? [[tool.name, tool.resultContentSource]] : []));
|
|
3172
3226
|
} catch (error) {
|
|
3173
3227
|
return finishAttempt(createResult(input, {
|
|
@@ -3191,7 +3245,7 @@ async function runCopilotExecution(context) {
|
|
|
3191
3245
|
operation: deps.operation,
|
|
3192
3246
|
poolAcquire,
|
|
3193
3247
|
ringZeroSystemAgentRun,
|
|
3194
|
-
|
|
3248
|
+
promptToolPolicy,
|
|
3195
3249
|
sessionProvider,
|
|
3196
3250
|
settledToolFinalization,
|
|
3197
3251
|
signal: params.abortSignal
|
|
@@ -3207,7 +3261,8 @@ async function runCopilotExecution(context) {
|
|
|
3207
3261
|
if (resumeSessionId) try {
|
|
3208
3262
|
session = await client.resumeSession(resumeSessionId, {
|
|
3209
3263
|
...sessionConfig,
|
|
3210
|
-
continuePendingWork: false
|
|
3264
|
+
continuePendingWork: false,
|
|
3265
|
+
...settledToolFinalization ? { suppressResumeEvent: true } : {}
|
|
3211
3266
|
});
|
|
3212
3267
|
nativeSessionHistoryValidated = input.initialReplayState?.journalValidated === true;
|
|
3213
3268
|
} catch (error) {
|
|
@@ -3440,7 +3495,8 @@ async function runCopilotExecution(context) {
|
|
|
3440
3495
|
settledToolFinalization,
|
|
3441
3496
|
timedOut,
|
|
3442
3497
|
timedOutDuringCompaction,
|
|
3443
|
-
yieldDetected
|
|
3498
|
+
yieldDetected,
|
|
3499
|
+
yieldAcknowledgment
|
|
3444
3500
|
});
|
|
3445
3501
|
}
|
|
3446
3502
|
//#endregion
|
|
@@ -687,12 +687,16 @@ function readAgentIdFromSessionKey(sessionKey) {
|
|
|
687
687
|
const parts = sessionKey.trim().split(":");
|
|
688
688
|
return parts[0] === "agent" && parts[1]?.trim() ? parts[1].trim() : void 0;
|
|
689
689
|
}
|
|
690
|
-
function computeSessionKey(
|
|
691
|
-
const
|
|
692
|
-
const
|
|
693
|
-
const
|
|
694
|
-
const
|
|
695
|
-
const
|
|
690
|
+
function computeSessionKey(input, options) {
|
|
691
|
+
const attempt = input.kind === "attempt" ? input.params : void 0;
|
|
692
|
+
const compact = input.kind === "compact" ? input.params : void 0;
|
|
693
|
+
const attemptModel = attempt?.model;
|
|
694
|
+
const compactModel = compact?.model;
|
|
695
|
+
const rawModel = attemptModel ?? compactModel;
|
|
696
|
+
const modelObj = rawModel && typeof rawModel === "object" ? rawModel : compact?.runtimeModel ?? { id: typeof rawModel === "string" ? rawModel : void 0 };
|
|
697
|
+
const provider = normalizeOptionalString(modelObj.provider) ?? attempt?.provider ?? compact?.provider ?? "";
|
|
698
|
+
const modelId = normalizeOptionalString(modelObj.id) ?? attempt?.modelId ?? compact?.modelId ?? (typeof compactModel === "string" ? compactModel : "");
|
|
699
|
+
const requestTransport = rawModel && typeof rawModel === "object" ? getModelProviderRequestTransport(rawModel) : void 0;
|
|
696
700
|
const requestAuthMode = normalizeOptionalString(requestTransport?.auth?.mode ?? modelObj.request?.auth?.mode);
|
|
697
701
|
const azureApiVersion = normalizeOptionalString(modelObj.azureApiVersion ?? modelObj.params?.azureApiVersion);
|
|
698
702
|
let authParts;
|
|
@@ -700,18 +704,18 @@ function computeSessionKey(params, options) {
|
|
|
700
704
|
let resolvedCopilotHome = "";
|
|
701
705
|
try {
|
|
702
706
|
const resolved = !options.includeAuth ? resolveCopilotAuth({
|
|
703
|
-
agentId:
|
|
704
|
-
agentDir:
|
|
705
|
-
workspaceDir:
|
|
706
|
-
copilotHome:
|
|
707
|
+
agentId: input.params.agentId ?? readAgentIdFromSessionKey(input.params.sessionKey),
|
|
708
|
+
agentDir: input.params.agentDir,
|
|
709
|
+
workspaceDir: input.params.workspaceDir,
|
|
710
|
+
copilotHome: input.params.copilotHome,
|
|
707
711
|
auth: { useLoggedInUser: true }
|
|
708
712
|
}) : (() => {
|
|
709
713
|
const modelProvider = resolveCopilotProvider({
|
|
710
714
|
model: {
|
|
711
|
-
api: modelObj.api,
|
|
715
|
+
api: normalizeOptionalString(modelObj.api),
|
|
712
716
|
id: modelId,
|
|
713
717
|
provider,
|
|
714
|
-
baseUrl: modelObj.baseUrl,
|
|
718
|
+
baseUrl: normalizeOptionalString(modelObj.baseUrl),
|
|
715
719
|
azureApiVersion,
|
|
716
720
|
headers: modelObj.headers,
|
|
717
721
|
authHeader: modelObj.authHeader,
|
|
@@ -723,25 +727,25 @@ function computeSessionKey(params, options) {
|
|
|
723
727
|
contextWindow: modelObj.contextWindow,
|
|
724
728
|
maxTokens: modelObj.maxTokens
|
|
725
729
|
},
|
|
726
|
-
resolvedApiKey:
|
|
727
|
-
authProfileId:
|
|
730
|
+
resolvedApiKey: input.params.resolvedApiKey,
|
|
731
|
+
authProfileId: input.params.authProfileId
|
|
728
732
|
});
|
|
729
733
|
return modelProvider.mode === "byok" ? createCopilotByokAuth({
|
|
730
|
-
agentId:
|
|
731
|
-
agentDir:
|
|
732
|
-
workspaceDir:
|
|
733
|
-
copilotHome:
|
|
734
|
+
agentId: input.params.agentId ?? readAgentIdFromSessionKey(input.params.sessionKey),
|
|
735
|
+
agentDir: input.params.agentDir,
|
|
736
|
+
workspaceDir: input.params.workspaceDir,
|
|
737
|
+
copilotHome: input.params.copilotHome,
|
|
734
738
|
authProfileId: modelProvider.authProfileId,
|
|
735
739
|
authProfileVersion: modelProvider.authProfileVersion
|
|
736
740
|
}) : resolveCopilotAuth({
|
|
737
|
-
agentId:
|
|
738
|
-
agentDir:
|
|
739
|
-
workspaceDir:
|
|
740
|
-
copilotHome:
|
|
741
|
-
auth:
|
|
742
|
-
resolvedApiKey:
|
|
743
|
-
authProfileId:
|
|
744
|
-
profileVersion:
|
|
741
|
+
agentId: input.params.agentId ?? readAgentIdFromSessionKey(input.params.sessionKey),
|
|
742
|
+
agentDir: input.params.agentDir,
|
|
743
|
+
workspaceDir: input.params.workspaceDir,
|
|
744
|
+
copilotHome: input.params.copilotHome,
|
|
745
|
+
auth: input.params.auth,
|
|
746
|
+
resolvedApiKey: input.params.resolvedApiKey,
|
|
747
|
+
authProfileId: input.params.authProfileId,
|
|
748
|
+
profileVersion: input.params.profileVersion
|
|
745
749
|
});
|
|
746
750
|
})();
|
|
747
751
|
resolvedAgentId = resolved.agentId;
|
|
@@ -758,12 +762,12 @@ function computeSessionKey(params, options) {
|
|
|
758
762
|
return [
|
|
759
763
|
`provider=${provider}`,
|
|
760
764
|
`model=${modelId}`,
|
|
761
|
-
...options.includeApi ? [`api=${modelObj.api ?? ""}`] : [],
|
|
765
|
+
...options.includeApi ? [`api=${normalizeOptionalString(modelObj.api) ?? ""}`] : [],
|
|
762
766
|
...options.includeApi ? [`baseUrlFingerprint=${fingerprintSessionValue(modelObj.baseUrl)}`] : [],
|
|
763
|
-
`cwd=${
|
|
767
|
+
`cwd=${input.params.cwd ?? input.params.workspaceDir ?? ""}`,
|
|
764
768
|
`agentId=${resolvedAgentId}`,
|
|
765
|
-
`agentDir=${
|
|
766
|
-
`copilotHome=${
|
|
769
|
+
`agentDir=${input.params.agentDir ?? ""}`,
|
|
770
|
+
`copilotHome=${input.params.copilotHome ?? ""}`,
|
|
767
771
|
`resolvedCopilotHome=${resolvedCopilotHome}`,
|
|
768
772
|
...options.includeAuth ? authParts : []
|
|
769
773
|
].join("|");
|
|
@@ -772,13 +776,28 @@ function fingerprintSessionValue(value) {
|
|
|
772
776
|
return typeof value === "string" && value ? tokenFingerprint(value) : "";
|
|
773
777
|
}
|
|
774
778
|
function computeSessionCompatKey(params) {
|
|
775
|
-
return computeSessionKey(
|
|
779
|
+
return computeSessionKey({
|
|
780
|
+
kind: "attempt",
|
|
781
|
+
params
|
|
782
|
+
}, {
|
|
776
783
|
includeApi: true,
|
|
777
784
|
includeAuth: true
|
|
778
785
|
});
|
|
779
786
|
}
|
|
780
|
-
function
|
|
781
|
-
return computeSessionKey(
|
|
787
|
+
function computeAttemptCompactKey(params) {
|
|
788
|
+
return computeSessionKey({
|
|
789
|
+
kind: "attempt",
|
|
790
|
+
params
|
|
791
|
+
}, {
|
|
792
|
+
includeApi: false,
|
|
793
|
+
includeAuth: false
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
function computeCompactRequestKey(params) {
|
|
797
|
+
return computeSessionKey({
|
|
798
|
+
kind: "compact",
|
|
799
|
+
params
|
|
800
|
+
}, {
|
|
782
801
|
includeApi: false,
|
|
783
802
|
includeAuth: false
|
|
784
803
|
});
|
|
@@ -845,7 +864,7 @@ function createCopilotAgentHarness(options) {
|
|
|
845
864
|
async function runHarnessAttempt(params, operation) {
|
|
846
865
|
const attemptPromise = (async () => {
|
|
847
866
|
if (disposed) throw new Error("[copilot] harness has been disposed; cannot start new attempts");
|
|
848
|
-
const { resolvePoolAcquire, runCopilotAttempt } = await import("./attempt-
|
|
867
|
+
const { resolvePoolAcquire, runCopilotAttempt } = await import("./attempt-DsIndF6T.js");
|
|
849
868
|
if (disposed) throw new Error("[copilot] harness was disposed while starting an attempt");
|
|
850
869
|
const pool = await getPool();
|
|
851
870
|
if (disposed) throw new Error("[copilot] harness was disposed while starting an attempt");
|
|
@@ -858,7 +877,7 @@ function createCopilotAgentHarness(options) {
|
|
|
858
877
|
}
|
|
859
878
|
const openclawSessionId = typeof params.sessionId === "string" ? params.sessionId : void 0;
|
|
860
879
|
const currentCompatKey = computeSessionCompatKey(params);
|
|
861
|
-
const currentCompactKey =
|
|
880
|
+
const currentCompactKey = computeAttemptCompactKey(params);
|
|
862
881
|
const compactionCleanupPending = openclawSessionId !== void 0 && hasPendingDeferredCompactionCleanup(openclawSessionId);
|
|
863
882
|
const replayBlocked = openclawSessionId !== void 0 && (compactionCleanupPending || resetBlockedStoredSessions.has(openclawSessionId));
|
|
864
883
|
const tracked = openclawSessionId && !replayBlocked ? trackedSessions.get(openclawSessionId) : void 0;
|
|
@@ -976,7 +995,7 @@ function createCopilotAgentHarness(options) {
|
|
|
976
995
|
async function runIsolatedCompletionV2(params) {
|
|
977
996
|
const completionPromise = (async () => {
|
|
978
997
|
if (disposed) throw new Error("[copilot] harness has been disposed; cannot start isolated completion");
|
|
979
|
-
const { runCopilotIsolatedCompletion } = await import("./isolated-completion-
|
|
998
|
+
const { runCopilotIsolatedCompletion } = await import("./isolated-completion-D9VIGPmy.js");
|
|
980
999
|
if (disposed) throw new Error("[copilot] harness was disposed while starting isolated completion");
|
|
981
1000
|
return await runCopilotIsolatedCompletion(params, async () => {
|
|
982
1001
|
const pool = await getPool();
|
|
@@ -1066,8 +1085,8 @@ function createCopilotAgentHarness(options) {
|
|
|
1066
1085
|
failure: { reason: "background-compaction-pending" }
|
|
1067
1086
|
};
|
|
1068
1087
|
const tracked = trackedSessions.get(openclawSessionId);
|
|
1069
|
-
const currentCompactKey =
|
|
1070
|
-
const { resolvePoolAcquire } = await import("./attempt-
|
|
1088
|
+
const currentCompactKey = computeCompactRequestKey(params);
|
|
1089
|
+
const { resolvePoolAcquire } = await import("./attempt-DsIndF6T.js");
|
|
1071
1090
|
let resolvedPoolAcquire;
|
|
1072
1091
|
let currentAuth;
|
|
1073
1092
|
try {
|
package/dist/harness.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createCopilotAgentHarness } from "./harness-
|
|
1
|
+
import { t as createCopilotAgentHarness } from "./harness-BJ_IcIJk.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-BJ_IcIJk.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-BJ_IcIJk.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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/copilot",
|
|
3
|
-
"version": "2026.8.1-beta.
|
|
3
|
+
"version": "2026.8.1-beta.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.8.1-beta.
|
|
27
|
+
"pluginApi": ">=2026.8.1-beta.3"
|
|
28
28
|
},
|
|
29
29
|
"build": {
|
|
30
|
-
"openclawVersion": "2026.8.1-beta.
|
|
30
|
+
"openclawVersion": "2026.8.1-beta.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.8.1-beta.
|
|
48
|
+
"openclaw": ">=2026.8.1-beta.3"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
51
51
|
"openclaw": {
|