@openclaw/copilot 2026.8.1 → 2026.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{attempt-DwhhWgyV.js → attempt-5q0X0LCu.js} +97 -90
- package/dist/{harness-DvYbOGRx.js → harness-Bmmbz3QS.js} +10 -7
- package/dist/harness.js +1 -1
- package/dist/index.js +2 -2
- package/dist/{isolated-completion-C0DfWtVO.js → isolated-completion-BYHkro0M.js} +1 -1
- package/dist/{runtime-DvZQV_8v.js → runtime-LtZ5NAjV.js} +4 -5
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
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-Bmmbz3QS.js";
|
|
2
2
|
import { n as normalizeCopilotUsage, r as createCopilotIsolatedSessionRestrictions, t as buildCopilotAssistantUsage } from "./usage-bridge-Cpa-ZYwL.js";
|
|
3
3
|
import { asNonArrayRecord, 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, callGatewayTool, cancelPendingAgentQuestionForSession, claimPendingAgentQuestionAnswer, clearActiveEmbeddedRun, detectAndLoadAgentHarnessPromptImages, embeddedAgentLog, extractToolErrorMessage, getModelProviderRequestTransport, getPluginToolMeta, getPluginToolSideEffectOwnerKey, isHostScopedAgentToolActive, isSubagentSessionKey, isToolResultError, projectAgentHarnessTranscriptMessageForDisplay, resolveAgentDir, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptFsWorkspaceOnly, resolveAttemptSpawnWorkspaceDir, resolveBootstrapContextForRun, resolveCompactionTimeoutMs, resolveEmbeddedAttemptToolConstructionPlan, resolveMainSessionDelegationMode, resolveModelAuthMode, resolveSandboxContext, resolveUserPath, runAgentEndSideEffects, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessGatewayQuestion, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, sanitizeToolResult, setActiveEmbeddedRun } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
@@ -10,6 +10,7 @@ import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-ru
|
|
|
10
10
|
import { convertMcpCallToolResult } from "@github/copilot-sdk";
|
|
11
11
|
import { createAgentHarnessToolSurfaceRuntime } from "openclaw/plugin-sdk/agent-harness-tool-runtime";
|
|
12
12
|
import { isDeepStrictEqual } from "node:util";
|
|
13
|
+
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
13
14
|
import { appendSessionTranscriptMessageByIdentityStrict, appendSessionTranscriptMessagesByIdentity, publishSessionTranscriptUpdateByIdentity, readVisibleSessionTranscriptMessageEntries } from "openclaw/plugin-sdk/session-transcript-runtime";
|
|
14
15
|
import { createAgentHarnessTaskRuntime } from "openclaw/plugin-sdk/agent-harness-task-runtime";
|
|
15
16
|
//#region extensions/copilot/src/attempt-types.ts
|
|
@@ -478,8 +479,9 @@ function resolveModelRef(params) {
|
|
|
478
479
|
};
|
|
479
480
|
}
|
|
480
481
|
function resolvePoolAcquire(params) {
|
|
482
|
+
const model = resolveModelRef(params);
|
|
481
483
|
const provider = resolveCopilotProvider({
|
|
482
|
-
model
|
|
484
|
+
model,
|
|
483
485
|
resolvedApiKey: readNonEmptyString(params.resolvedApiKey),
|
|
484
486
|
authProfileId: readNonEmptyString(params.authProfileId)
|
|
485
487
|
});
|
|
@@ -1328,7 +1330,7 @@ function registerCopilotActiveRun(params) {
|
|
|
1328
1330
|
}
|
|
1329
1331
|
if (params.isSettled() || params.isAborted()) throw new Error("Copilot steering is unavailable after the active run ended");
|
|
1330
1332
|
if (!params.canAcceptSteering()) throw new Error("Copilot steering is unavailable before initial user validation");
|
|
1331
|
-
messageId = await params.session.send({ prompt: text });
|
|
1333
|
+
messageId = await params.transcriptJournal.sendSdkUser(() => params.session.send({ prompt: text }), options?.userTurnTranscriptRecorder);
|
|
1332
1334
|
reportAcceptance(true);
|
|
1333
1335
|
} catch (error) {
|
|
1334
1336
|
reportAcceptance(false);
|
|
@@ -1536,7 +1538,7 @@ async function createCopilotToolBridge(input) {
|
|
|
1536
1538
|
const createOpenClawCodingTools = input.createOpenClawCodingTools ?? (await import("openclaw/plugin-sdk/agent-harness")).createOpenClawCodingTools;
|
|
1537
1539
|
const toolSurfaceRuntime = createAgentHarnessToolSurfaceRuntime({
|
|
1538
1540
|
abortSignal: input.abortSignal,
|
|
1539
|
-
agentId: input.agentId,
|
|
1541
|
+
agentId: attemptParams.sandboxAgentId ?? input.agentId,
|
|
1540
1542
|
config: attemptParams.config,
|
|
1541
1543
|
codeModeOverride: attemptParams.codeModeOverride,
|
|
1542
1544
|
disableTools: attemptParams.disableTools,
|
|
@@ -1637,6 +1639,7 @@ function buildOpenClawCodingToolsOptions(input, toolPlan, toolSurfaceRuntime) {
|
|
|
1637
1639
|
const modelCompat = model && typeof model === "object" && "compat" in model && model.compat && typeof model.compat === "object" ? model.compat : void 0;
|
|
1638
1640
|
return {
|
|
1639
1641
|
agentId: input.agentId,
|
|
1642
|
+
policyAgentId: a.sandboxAgentId ?? input.agentId,
|
|
1640
1643
|
...buildEmbeddedAttemptToolRunContext(a),
|
|
1641
1644
|
exec: {
|
|
1642
1645
|
...a.execOverrides,
|
|
@@ -2023,7 +2026,7 @@ function prepareCopilotAttemptContext(params, deps) {
|
|
|
2023
2026
|
runId: input.runId,
|
|
2024
2027
|
jobId: input.jobId,
|
|
2025
2028
|
agentId: sessionAgentId,
|
|
2026
|
-
sessionKey: sandboxSessionKey,
|
|
2029
|
+
sessionKey: readNonEmptyString(input.sessionKey) ?? sandboxSessionKey,
|
|
2027
2030
|
sessionId: input.sessionId,
|
|
2028
2031
|
workspaceDir: resolvedWorkspaceForSandbox,
|
|
2029
2032
|
modelProviderId: modelRef.provider,
|
|
@@ -2043,6 +2046,7 @@ async function resolveCopilotAttemptSandbox(params) {
|
|
|
2043
2046
|
const resolveSandbox = params.deps.resolveSandboxContextOverride ?? resolveSandboxContext;
|
|
2044
2047
|
const sandbox = params.input.sandbox !== void 0 ? params.input.sandbox : await resolveSandbox({
|
|
2045
2048
|
config: params.input.config,
|
|
2049
|
+
agentId: params.input.sandboxAgentId,
|
|
2046
2050
|
sessionKey: params.sandboxSessionKey,
|
|
2047
2051
|
workspaceDir: params.resolvedWorkspaceForSandbox
|
|
2048
2052
|
});
|
|
@@ -2091,7 +2095,7 @@ function buildCopilotPromptGuidance(params) {
|
|
|
2091
2095
|
//#endregion
|
|
2092
2096
|
//#region extensions/copilot/src/user-input-bridge.ts
|
|
2093
2097
|
const COPILOT_USER_INPUT_QUESTION_ID = "answer";
|
|
2094
|
-
const DEFAULT_USER_INPUT_TIMEOUT_MS =
|
|
2098
|
+
const DEFAULT_USER_INPUT_TIMEOUT_MS = 9e5;
|
|
2095
2099
|
function createCopilotUserInputBridge(params) {
|
|
2096
2100
|
let pending;
|
|
2097
2101
|
const gatewayCall = params.gatewayCall ?? callGatewayTool;
|
|
@@ -2428,6 +2432,41 @@ async function createCopilotSessionSetup(params) {
|
|
|
2428
2432
|
};
|
|
2429
2433
|
}
|
|
2430
2434
|
//#endregion
|
|
2435
|
+
//#region extensions/copilot/src/attempt-transcript-replay.ts
|
|
2436
|
+
function readAssistantToolCallIds(message) {
|
|
2437
|
+
return message.role === "assistant" ? message.content.flatMap((part) => part.type === "toolCall" ? [part.id] : []) : [];
|
|
2438
|
+
}
|
|
2439
|
+
function isCompatibleSingletonRewrite(original, prepared) {
|
|
2440
|
+
return original.role === prepared.role && (original.role !== "assistant" || JSON.stringify(readAssistantToolCallIds(original)) === JSON.stringify(readAssistantToolCallIds(prepared)));
|
|
2441
|
+
}
|
|
2442
|
+
function projectReplayPayload(message) {
|
|
2443
|
+
switch (message.role) {
|
|
2444
|
+
case "user": return {
|
|
2445
|
+
role: message.role,
|
|
2446
|
+
content: message.content
|
|
2447
|
+
};
|
|
2448
|
+
case "assistant": return {
|
|
2449
|
+
role: message.role,
|
|
2450
|
+
content: message.content,
|
|
2451
|
+
api: message.api,
|
|
2452
|
+
model: message.model,
|
|
2453
|
+
provider: message.provider,
|
|
2454
|
+
stopReason: message.stopReason
|
|
2455
|
+
};
|
|
2456
|
+
case "toolResult": return {
|
|
2457
|
+
role: message.role,
|
|
2458
|
+
content: message.content,
|
|
2459
|
+
isError: message.isError,
|
|
2460
|
+
toolCallId: message.toolCallId,
|
|
2461
|
+
toolName: message.toolName
|
|
2462
|
+
};
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2465
|
+
function isCompleteToolGroup(messages, order) {
|
|
2466
|
+
const [assistant, ...results] = messages;
|
|
2467
|
+
return assistant?.role === "assistant" && JSON.stringify(readAssistantToolCallIds(assistant)) === JSON.stringify(order) && results.length === order.length && results.every((message, index) => message.role === "toolResult" && message.toolCallId === order[index]);
|
|
2468
|
+
}
|
|
2469
|
+
//#endregion
|
|
2431
2470
|
//#region extensions/copilot/src/attempt-transcript-journal.ts
|
|
2432
2471
|
function readTurnTaintMetadata(message) {
|
|
2433
2472
|
const metadata = message["__openclaw"];
|
|
@@ -2484,6 +2523,7 @@ function createAttemptTranscriptJournal(params) {
|
|
|
2484
2523
|
let queue = Promise.resolve();
|
|
2485
2524
|
let firstFailure;
|
|
2486
2525
|
const sdkUserPersistenceReceipts = /* @__PURE__ */ new Map();
|
|
2526
|
+
const sdkUserRecorders = /* @__PURE__ */ new Map();
|
|
2487
2527
|
let abortPromise;
|
|
2488
2528
|
let replayInvalid = false;
|
|
2489
2529
|
let initialSdkUserObserved = false;
|
|
@@ -2504,7 +2544,8 @@ function createAttemptTranscriptJournal(params) {
|
|
|
2504
2544
|
const sdkUserPersistenceReceipt = (eventId) => {
|
|
2505
2545
|
let receipt = sdkUserPersistenceReceipts.get(eventId);
|
|
2506
2546
|
if (!receipt) {
|
|
2507
|
-
receipt =
|
|
2547
|
+
receipt = createDeferred();
|
|
2548
|
+
receipt.promise.catch(() => void 0);
|
|
2508
2549
|
sdkUserPersistenceReceipts.set(eventId, receipt);
|
|
2509
2550
|
if (firstFailure) receipt.reject(firstFailure);
|
|
2510
2551
|
}
|
|
@@ -2540,6 +2581,7 @@ function createAttemptTranscriptJournal(params) {
|
|
|
2540
2581
|
...taintMetadata
|
|
2541
2582
|
} } : {},
|
|
2542
2583
|
...idempotencyKey ? { idempotencyKey } : {},
|
|
2584
|
+
...message.role === "user" && message.provenance ? { provenance: message.provenance } : {},
|
|
2543
2585
|
...message.display === false ? { display: false } : {}
|
|
2544
2586
|
});
|
|
2545
2587
|
return options.singleton && !isCompatibleSingletonRewrite(message, prepared) ? void 0 : prepared;
|
|
@@ -2553,9 +2595,13 @@ function createAttemptTranscriptJournal(params) {
|
|
|
2553
2595
|
message: write.message,
|
|
2554
2596
|
prepareMessageAfterIdempotencyCheck: () => prepare(write, { singleton: true })
|
|
2555
2597
|
});
|
|
2556
|
-
if (outcome.kind === "suppressed")
|
|
2598
|
+
if (outcome.kind === "suppressed") {
|
|
2599
|
+
write.recorder?.markBlocked();
|
|
2600
|
+
return;
|
|
2601
|
+
}
|
|
2557
2602
|
if (outcome.kind === "rejected") throw new Error("Transcript session changed before singleton append");
|
|
2558
2603
|
if (!isDeepStrictEqual(projectReplayPayload(write.message), projectReplayPayload(outcome.result.message))) replayInvalid = true;
|
|
2604
|
+
if (outcome.result.message.role === "user") write.recorder?.markRuntimePersisted(outcome.result.message, outcome.result.anchor);
|
|
2559
2605
|
return outcome.result;
|
|
2560
2606
|
};
|
|
2561
2607
|
const appendToolGroup = async (group) => {
|
|
@@ -2623,6 +2669,20 @@ function createAttemptTranscriptJournal(params) {
|
|
|
2623
2669
|
}
|
|
2624
2670
|
};
|
|
2625
2671
|
return {
|
|
2672
|
+
async sendSdkUser(send, recorder) {
|
|
2673
|
+
if (!recorder) return await send();
|
|
2674
|
+
const registration = createDeferred();
|
|
2675
|
+
schedule(() => registration.promise);
|
|
2676
|
+
try {
|
|
2677
|
+
const messageId = await send();
|
|
2678
|
+
sdkUserRecorders.set(messageId, recorder);
|
|
2679
|
+
recorder.markSentToProvider?.();
|
|
2680
|
+
recorder.markRuntimePersistencePending(sdkUserPersistenceReceipt(messageId).promise);
|
|
2681
|
+
return messageId;
|
|
2682
|
+
} finally {
|
|
2683
|
+
registration.resolve();
|
|
2684
|
+
}
|
|
2685
|
+
},
|
|
2626
2686
|
markReplayIncomplete() {
|
|
2627
2687
|
replayInvalid = true;
|
|
2628
2688
|
},
|
|
@@ -2685,9 +2745,16 @@ function createAttemptTranscriptJournal(params) {
|
|
|
2685
2745
|
}
|
|
2686
2746
|
initialSdkUserObserved = true;
|
|
2687
2747
|
schedule(async () => {
|
|
2748
|
+
const recorder = sdkUserRecorders.get(input.eventId);
|
|
2749
|
+
sdkUserRecorders.delete(input.eventId);
|
|
2750
|
+
const provenance = (await recorder?.resolveMessage())?.provenance;
|
|
2688
2751
|
const write = {
|
|
2689
2752
|
eventId: input.eventId,
|
|
2690
|
-
message:
|
|
2753
|
+
message: provenance ? {
|
|
2754
|
+
...input.message,
|
|
2755
|
+
provenance
|
|
2756
|
+
} : input.message,
|
|
2757
|
+
recorder
|
|
2691
2758
|
};
|
|
2692
2759
|
if (pendingTools) {
|
|
2693
2760
|
deferredUserWrites.push(write);
|
|
@@ -2757,10 +2824,7 @@ function createAttemptTranscriptJournal(params) {
|
|
|
2757
2824
|
replayInvalid = true;
|
|
2758
2825
|
ownAssistant(group.assistantKey, false);
|
|
2759
2826
|
} else {
|
|
2760
|
-
for (const result of results)
|
|
2761
|
-
const didAppend = accept(result);
|
|
2762
|
-
appended ||= didAppend;
|
|
2763
|
-
}
|
|
2827
|
+
for (const result of results) appended = accept(result) || appended;
|
|
2764
2828
|
ownAssistant(group.assistantKey, true, results.at(-1)?.anchor);
|
|
2765
2829
|
}
|
|
2766
2830
|
pendingTools = void 0;
|
|
@@ -2772,8 +2836,7 @@ function createAttemptTranscriptJournal(params) {
|
|
|
2772
2836
|
if (write.eventId) sdkUserPersistenceReceipt(write.eventId).reject(/* @__PURE__ */ new Error("Copilot steering user write was suppressed"));
|
|
2773
2837
|
continue;
|
|
2774
2838
|
}
|
|
2775
|
-
|
|
2776
|
-
appended ||= didAppend;
|
|
2839
|
+
appended = accept(outcome) || appended;
|
|
2777
2840
|
if (write.eventId) deferredReceipts.push(sdkUserPersistenceReceipt(write.eventId));
|
|
2778
2841
|
}
|
|
2779
2842
|
await publish(appended);
|
|
@@ -2795,31 +2858,6 @@ function createAttemptTranscriptJournal(params) {
|
|
|
2795
2858
|
})
|
|
2796
2859
|
};
|
|
2797
2860
|
}
|
|
2798
|
-
function createPersistenceReceipt() {
|
|
2799
|
-
let settled = false;
|
|
2800
|
-
let rejectPromise;
|
|
2801
|
-
let resolvePromise;
|
|
2802
|
-
const promise = new Promise((resolve, reject) => {
|
|
2803
|
-
resolvePromise = resolve;
|
|
2804
|
-
rejectPromise = reject;
|
|
2805
|
-
});
|
|
2806
|
-
promise.catch(() => void 0);
|
|
2807
|
-
return {
|
|
2808
|
-
promise,
|
|
2809
|
-
reject(error) {
|
|
2810
|
-
if (!settled) {
|
|
2811
|
-
settled = true;
|
|
2812
|
-
rejectPromise?.(error);
|
|
2813
|
-
}
|
|
2814
|
-
},
|
|
2815
|
-
resolve() {
|
|
2816
|
-
if (!settled) {
|
|
2817
|
-
settled = true;
|
|
2818
|
-
resolvePromise?.();
|
|
2819
|
-
}
|
|
2820
|
-
}
|
|
2821
|
-
};
|
|
2822
|
-
}
|
|
2823
2861
|
function resolveTranscriptTarget(attempt) {
|
|
2824
2862
|
const sessionId = normalizeOptionalString(attempt.sessionTarget?.sessionId);
|
|
2825
2863
|
const sessionKey = normalizeOptionalString(attempt.sessionTarget?.sessionKey);
|
|
@@ -2837,35 +2875,6 @@ function resolveTranscriptTarget(attempt) {
|
|
|
2837
2875
|
...agentId ? { agentId } : {}
|
|
2838
2876
|
};
|
|
2839
2877
|
}
|
|
2840
|
-
function readAssistantToolCallIds(message) {
|
|
2841
|
-
return message.role === "assistant" ? message.content.flatMap((part) => part.type === "toolCall" ? [part.id] : []) : [];
|
|
2842
|
-
}
|
|
2843
|
-
function isCompatibleSingletonRewrite(original, prepared) {
|
|
2844
|
-
return original.role === prepared.role && (original.role !== "assistant" || JSON.stringify(readAssistantToolCallIds(original)) === JSON.stringify(readAssistantToolCallIds(prepared)));
|
|
2845
|
-
}
|
|
2846
|
-
function projectReplayPayload(message) {
|
|
2847
|
-
switch (message.role) {
|
|
2848
|
-
case "user": return {
|
|
2849
|
-
role: message.role,
|
|
2850
|
-
content: message.content
|
|
2851
|
-
};
|
|
2852
|
-
case "assistant": return {
|
|
2853
|
-
role: message.role,
|
|
2854
|
-
content: message.content,
|
|
2855
|
-
api: message.api,
|
|
2856
|
-
model: message.model,
|
|
2857
|
-
provider: message.provider,
|
|
2858
|
-
stopReason: message.stopReason
|
|
2859
|
-
};
|
|
2860
|
-
case "toolResult": return {
|
|
2861
|
-
role: message.role,
|
|
2862
|
-
content: message.content,
|
|
2863
|
-
isError: message.isError,
|
|
2864
|
-
toolCallId: message.toolCallId,
|
|
2865
|
-
toolName: message.toolName
|
|
2866
|
-
};
|
|
2867
|
-
}
|
|
2868
|
-
}
|
|
2869
2878
|
function readIdempotencyKey(message) {
|
|
2870
2879
|
const key = message.idempotencyKey;
|
|
2871
2880
|
return typeof key === "string" && key ? key : void 0;
|
|
@@ -2873,10 +2882,6 @@ function readIdempotencyKey(message) {
|
|
|
2873
2882
|
function isCurrentJournalIdentity(key, params) {
|
|
2874
2883
|
return key === `${params.attempt.runId}:user` || key.startsWith(`copilot-sdk:${params.sdkSessionId}:`);
|
|
2875
2884
|
}
|
|
2876
|
-
function isCompleteToolGroup(messages, order) {
|
|
2877
|
-
const [assistant, ...results] = messages;
|
|
2878
|
-
return assistant?.role === "assistant" && JSON.stringify(readAssistantToolCallIds(assistant)) === JSON.stringify(order) && results.length === order.length && results.every((message, index) => message.role === "toolResult" && message.toolCallId === order[index]);
|
|
2879
|
-
}
|
|
2880
2885
|
function isSameUserTurn(candidate, current, currentRunUserKey) {
|
|
2881
2886
|
if (candidate?.role !== "user" || !current) return false;
|
|
2882
2887
|
if (candidate === current) return true;
|
|
@@ -3183,7 +3188,7 @@ async function runCopilotExecution(context) {
|
|
|
3183
3188
|
runId: input.runId,
|
|
3184
3189
|
agentId: sessionAgentId,
|
|
3185
3190
|
sessionId: input.sessionId,
|
|
3186
|
-
sessionKey:
|
|
3191
|
+
sessionKey: hookContext.sessionKey,
|
|
3187
3192
|
channelId: hookContext.channelId,
|
|
3188
3193
|
startArgs: args,
|
|
3189
3194
|
...result !== void 0 ? { result } : {},
|
|
@@ -3352,25 +3357,27 @@ async function runCopilotExecution(context) {
|
|
|
3352
3357
|
if (!promptError && !timedOut && !aborted && snap.streamError) promptError = snap.streamError;
|
|
3353
3358
|
}
|
|
3354
3359
|
} catch (error) {
|
|
3355
|
-
if (!aborted)
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3360
|
+
if (!aborted) {
|
|
3361
|
+
if (isSdkSendAndWaitTimeoutError(error)) {
|
|
3362
|
+
timedOut = true;
|
|
3363
|
+
timedOutDuringCompaction = bridge?.isCompacting() === true;
|
|
3364
|
+
try {
|
|
3365
|
+
await bridge?.awaitDeltaChain();
|
|
3366
|
+
} catch {}
|
|
3367
|
+
await bridge?.awaitAgentEventChain();
|
|
3368
|
+
bridge?.flushTranscriptProjection();
|
|
3369
|
+
try {
|
|
3370
|
+
await transcriptJournal?.barrier("timeout");
|
|
3371
|
+
} catch (transcriptError) {
|
|
3372
|
+
promptError = toCopilotError(transcriptError);
|
|
3373
|
+
}
|
|
3374
|
+
} else try {
|
|
3375
|
+
bridge?.flushTranscriptProjection();
|
|
3376
|
+
await transcriptJournal?.barrier("attempt error");
|
|
3377
|
+
promptError = toCopilotError(error);
|
|
3365
3378
|
} catch (transcriptError) {
|
|
3366
3379
|
promptError = toCopilotError(transcriptError);
|
|
3367
3380
|
}
|
|
3368
|
-
} else try {
|
|
3369
|
-
bridge?.flushTranscriptProjection();
|
|
3370
|
-
await transcriptJournal?.barrier("attempt error");
|
|
3371
|
-
promptError = toCopilotError(error);
|
|
3372
|
-
} catch (transcriptError) {
|
|
3373
|
-
promptError = toCopilotError(transcriptError);
|
|
3374
3381
|
}
|
|
3375
3382
|
} finally {
|
|
3376
3383
|
settled = true;
|
|
@@ -157,7 +157,8 @@ function resolveCopilotHome(args) {
|
|
|
157
157
|
if (args.explicit) return resolve(args.explicit);
|
|
158
158
|
if (args.agentDir) return resolve(join(args.agentDir, "copilot"));
|
|
159
159
|
const openClawHome = readNonEmptyStringPreservingWhitespace(args.env.OPENCLAW_HOME);
|
|
160
|
-
|
|
160
|
+
const rootHome = openClawHome ? resolve(openClawHome) : safeHomeDir(args.homeDir);
|
|
161
|
+
return resolve(join(rootHome, ".openclaw", "agents", args.agentId, "copilot"));
|
|
161
162
|
}
|
|
162
163
|
function safeHomeDir(homeDir) {
|
|
163
164
|
try {
|
|
@@ -499,7 +500,8 @@ function assertByokEndpointHostAllowed(baseUrl) {
|
|
|
499
500
|
if (url.protocol !== "https:") throw new Error(COPILOT_BYOK_ENDPOINT_POLICY_ERROR);
|
|
500
501
|
if (url.username || url.password) throw new Error(COPILOT_BYOK_ENDPOINT_POLICY_ERROR);
|
|
501
502
|
for (const key of url.searchParams.keys()) if (CREDENTIAL_QUERY_PARAM_NAMES.has(normalizeCredentialQueryParamName(key))) throw new Error(COPILOT_BYOK_ENDPOINT_POLICY_ERROR);
|
|
502
|
-
|
|
503
|
+
const hostname = url.hostname.toLowerCase().replace(/\.+$/, "");
|
|
504
|
+
if (isBlockedHostnameOrIp(hostname)) throw new Error(COPILOT_BYOK_ENDPOINT_POLICY_ERROR);
|
|
503
505
|
}
|
|
504
506
|
function normalizeCredentialQueryParamName(name) {
|
|
505
507
|
const stripped = name.replace(QUERY_PARAM_NAME_SEPARATOR_RE, "");
|
|
@@ -822,7 +824,7 @@ function createCopilotAgentHarness(options) {
|
|
|
822
824
|
async function getPool() {
|
|
823
825
|
if (options?.pool) return options.pool;
|
|
824
826
|
if (!poolPromise) poolPromise = (async () => {
|
|
825
|
-
const { createCopilotClientPool } = await import("./runtime-
|
|
827
|
+
const { createCopilotClientPool } = await import("./runtime-LtZ5NAjV.js");
|
|
826
828
|
createdPool = createCopilotClientPool(options?.poolOptions);
|
|
827
829
|
return createdPool;
|
|
828
830
|
})();
|
|
@@ -859,7 +861,7 @@ function createCopilotAgentHarness(options) {
|
|
|
859
861
|
async function runHarnessAttempt(params, operation) {
|
|
860
862
|
const attemptPromise = (async () => {
|
|
861
863
|
if (disposed) throw new Error("[copilot] harness has been disposed; cannot start new attempts");
|
|
862
|
-
const { resolvePoolAcquire, runCopilotAttempt } = await import("./attempt-
|
|
864
|
+
const { resolvePoolAcquire, runCopilotAttempt } = await import("./attempt-5q0X0LCu.js");
|
|
863
865
|
if (disposed) throw new Error("[copilot] harness was disposed while starting an attempt");
|
|
864
866
|
const pool = await getPool();
|
|
865
867
|
if (disposed) throw new Error("[copilot] harness was disposed while starting an attempt");
|
|
@@ -990,7 +992,7 @@ function createCopilotAgentHarness(options) {
|
|
|
990
992
|
async function runIsolatedCompletionV2(params) {
|
|
991
993
|
const completionPromise = (async () => {
|
|
992
994
|
if (disposed) throw new Error("[copilot] harness has been disposed; cannot start isolated completion");
|
|
993
|
-
const { runCopilotIsolatedCompletion } = await import("./isolated-completion-
|
|
995
|
+
const { runCopilotIsolatedCompletion } = await import("./isolated-completion-BYHkro0M.js");
|
|
994
996
|
if (disposed) throw new Error("[copilot] harness was disposed while starting isolated completion");
|
|
995
997
|
return await runCopilotIsolatedCompletion(params, async () => {
|
|
996
998
|
const pool = await getPool();
|
|
@@ -1047,7 +1049,8 @@ function createCopilotAgentHarness(options) {
|
|
|
1047
1049
|
runAttempt: (params) => runHarnessAttempt(params, "attempt"),
|
|
1048
1050
|
runIsolatedCompletionV2,
|
|
1049
1051
|
finalizeSettledTurn: async ({ attempt }) => {
|
|
1050
|
-
|
|
1052
|
+
const result = await runHarnessAttempt(attempt, "settled-tool-finalization");
|
|
1053
|
+
return projectSettledTurnFinalizationAttemptResult(result);
|
|
1051
1054
|
},
|
|
1052
1055
|
async reset(params) {
|
|
1053
1056
|
const openclawSessionId = typeof params.sessionId === "string" ? params.sessionId : void 0;
|
|
@@ -1081,7 +1084,7 @@ function createCopilotAgentHarness(options) {
|
|
|
1081
1084
|
};
|
|
1082
1085
|
const tracked = trackedSessions.get(openclawSessionId);
|
|
1083
1086
|
const currentCompactKey = computeCompactRequestKey(params);
|
|
1084
|
-
const { resolvePoolAcquire } = await import("./attempt-
|
|
1087
|
+
const { resolvePoolAcquire } = await import("./attempt-5q0X0LCu.js");
|
|
1085
1088
|
let resolvedPoolAcquire;
|
|
1086
1089
|
let currentAuth;
|
|
1087
1090
|
try {
|
package/dist/harness.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createCopilotAgentHarness } from "./harness-
|
|
1
|
+
import { t as createCopilotAgentHarness } from "./harness-Bmmbz3QS.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-Bmmbz3QS.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
|
|
@@ -21,7 +21,7 @@ var copilot_default = definePluginEntry({
|
|
|
21
21
|
const getSessionStore = () => sessionStore ??= api.runtime.state.openSyncKeyedStore({
|
|
22
22
|
namespace: "sdk-sessions",
|
|
23
23
|
maxEntries: 5e3,
|
|
24
|
-
defaultTtlMs:
|
|
24
|
+
defaultTtlMs: 7776e6
|
|
25
25
|
});
|
|
26
26
|
api.registerAgentHarness(createCopilotAgentHarness({
|
|
27
27
|
...poolOptions ? { poolOptions } : {},
|
|
@@ -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-Bmmbz3QS.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
|
|
@@ -38,7 +38,8 @@ async function doLoad(options) {
|
|
|
38
38
|
const fallbackPath = path.join(fallbackDir, "node_modules", "@github", "copilot-sdk");
|
|
39
39
|
if (!existsSync(fallbackPath)) throw createMissingSdkError(primaryErr, void 0, fallbackPath);
|
|
40
40
|
const fallbackImport = options.fallbackImport ?? (async () => {
|
|
41
|
-
|
|
41
|
+
const entry = createRequire(path.join(fallbackDir, "package.json")).resolve("@github/copilot-sdk");
|
|
42
|
+
return await import(pathToFileURL(entry).href);
|
|
42
43
|
});
|
|
43
44
|
try {
|
|
44
45
|
return await fallbackImport(fallbackPath);
|
|
@@ -82,7 +83,7 @@ function summarizeError(value) {
|
|
|
82
83
|
}
|
|
83
84
|
//#endregion
|
|
84
85
|
//#region extensions/copilot/src/runtime.ts
|
|
85
|
-
const DEFAULT_IDLE_TTL_MS =
|
|
86
|
+
const DEFAULT_IDLE_TTL_MS = 3e5;
|
|
86
87
|
const POOL_DISPOSED_MESSAGE = "[copilot-pool] pool disposed";
|
|
87
88
|
function createCopilotClientPool(options = {}) {
|
|
88
89
|
const sdkFactory = options.sdkFactory ?? (async (clientOptions) => {
|
|
@@ -262,9 +263,7 @@ function createCopilotClientPool(options = {}) {
|
|
|
262
263
|
case "stopping":
|
|
263
264
|
case "stopped": return;
|
|
264
265
|
case "ready":
|
|
265
|
-
case "idle":
|
|
266
|
-
if (entry.state.client !== handle.client) return;
|
|
267
|
-
break;
|
|
266
|
+
case "idle": if (entry.state.client !== handle.client) return;
|
|
268
267
|
}
|
|
269
268
|
if (entry.refCount <= 0) return;
|
|
270
269
|
entry.refCount -= 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/copilot",
|
|
3
|
-
"version": "2026.8.
|
|
3
|
+
"version": "2026.8.2",
|
|
4
4
|
"description": "OpenClaw GitHub Copilot agent runtime plugin (registers a `github-copilot` AgentHarness backed by @github/copilot-sdk over JSON-RPC to the GitHub Copilot CLI)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"minHostVersion": ">=2026.5.28"
|
|
25
25
|
},
|
|
26
26
|
"compat": {
|
|
27
|
-
"pluginApi": ">=2026.8.
|
|
27
|
+
"pluginApi": ">=2026.8.2"
|
|
28
28
|
},
|
|
29
29
|
"build": {
|
|
30
|
-
"openclawVersion": "2026.8.
|
|
30
|
+
"openclawVersion": "2026.8.2",
|
|
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.
|
|
48
|
+
"openclaw": ">=2026.8.2"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
51
51
|
"openclaw": {
|