@openclaw/copilot 2026.12.1-beta.1 → 2026.12.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/.setup/{attempt-RSQRmr6n.mjs → attempt-C-mlE9Dj.mjs} +18 -5
- package/dist/.setup/{harness-C2NIcNAc.mjs → harness-DYLc_Pdo.mjs} +52 -13
- package/dist/.setup/{isolated-completion-CqaPtFRx.mjs → isolated-completion-D3A_5sKS.mjs} +35 -6
- package/dist/.setup/{runtime-DCn_HIxX.mjs → runtime-CSW3s9n8.mjs} +3 -3
- package/dist/.setup/{runtime-artifact-DQ8Ia6k4.mjs → runtime-artifact-CrK25YVl.mjs} +1 -1
- package/dist/.setup/{sdk-loader-MZ7UHepf.mjs → sdk-loader-Bj0G2KhK.mjs} +1 -1
- package/dist/.setup/{session-restrictions-BrC08l2U.mjs → session-restrictions-BhNldzCr.mjs} +1 -2
- package/dist/.setup/side-question-CkqKoVYT.mjs +48 -0
- package/dist/.source-module-urls/f7f35489a89dbc0fc6d0e80a0da5720af5de227b511e490a2415ffe55b1bc471.json +1 -1
- package/dist/harness.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { a as projectSdkUserMetadata, c as resolveEventTimestamp, i as hasOwnKeys, l as sanitizeToolDetailText, n as buildAssistantMessage, o as projectToolResultDetails, r as buildAssistantProjectionGroup, s as resolveAssistantUsage, t as createCopilotIsolatedSessionRestrictions, u as normalizeCopilotUsage } from "./session-restrictions-
|
|
1
|
+
import { a as createPromptError, c as resolveCopilotAuth, n as resolveCopilotSessionModel, o as createCopilotByokProxy, r as resolveCopilotProvider, s as createCopilotByokAuth } from "./harness-DYLc_Pdo.mjs";
|
|
2
|
+
import { a as projectSdkUserMetadata, c as resolveEventTimestamp, i as hasOwnKeys, l as sanitizeToolDetailText, n as buildAssistantMessage, o as projectToolResultDetails, r as buildAssistantProjectionGroup, s as resolveAssistantUsage, t as createCopilotIsolatedSessionRestrictions, u as normalizeCopilotUsage } from "./session-restrictions-BhNldzCr.mjs";
|
|
3
3
|
import { asOptionalObjectRecord, asOptionalRecord, normalizeOptionalString, normalizeUniqueStringEntries, readNonBlankString, readNonEmptyStringPreservingWhitespace, readNonEmptyStringPreservingWhitespace as readNonEmptyString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { applyEmbeddedAttemptToolsAllow, awaitAgentEndSideEffects, buildAgentHookContextChannelFields, buildCredentialSafetyPrompt, buildDelegationGuidanceSection, buildEmbeddedAttemptToolRunContext, buildEmbeddedForegroundPromptContext, buildHarnessVisibleReplyGuidance, cancelPendingAgentQuestionForSession, claimPendingAgentQuestionAnswer, clearActiveEmbeddedRun, detectAndLoadAgentHarnessPromptImages, embeddedAgentLog, emitAgentEvent, extractToolErrorMessage, getModelProviderRequestTransport, getPluginToolMeta, getPluginToolSideEffectOwnerKey, isHostScopedAgentToolActive, isSubagentSessionKey, isToolResultError, listToolPromptGuidance, projectAgentHarnessTranscriptMessageForDisplay, projectAgentToolActivity, resolveAgentDir, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptFsWorkspaceOnly, resolveAttemptSpawnWorkspaceDir, resolveBootstrapContextForRun, resolveCompactionTimeoutMs, resolveEmbeddedAttemptToolConstructionPlan, resolveMainSessionDelegationMode, resolveSandboxContext, resolveUserPath, restorePreparedUserTurnOperationalMetaForRuntime, runAgentEndSideEffectsAsync, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessGatewayQuestion, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, sanitizeToolResult, setActiveEmbeddedRun } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
5
5
|
import path from "node:path";
|
|
@@ -213,6 +213,7 @@ function resolveModelRef(params) {
|
|
|
213
213
|
provider: readNonEmptyString(model.provider) ?? readNonEmptyString(params.provider) ?? "unknown-provider",
|
|
214
214
|
baseUrl: readNonEmptyString(model.baseUrl),
|
|
215
215
|
azureApiVersion: readNonEmptyString(model.azureApiVersion ?? model.params?.azureApiVersion),
|
|
216
|
+
params: model.params,
|
|
216
217
|
headers: model.headers,
|
|
217
218
|
authHeader: model.authHeader,
|
|
218
219
|
requestAuthMode: readNonEmptyString(requestTransport?.auth?.mode ?? rawRequest?.auth?.mode),
|
|
@@ -1795,6 +1796,18 @@ function getCopilotContextFileBasename(filePath) {
|
|
|
1795
1796
|
}
|
|
1796
1797
|
// extensions/copilot/src/attempt-session-setup.ts
|
|
1797
1798
|
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.";
|
|
1799
|
+
function requireCopilotSdkSessionId(session, resumeId) {
|
|
1800
|
+
const id = readNonEmptyStringPreservingWhitespace(session.sessionId) ?? readNonEmptyStringPreservingWhitespace(session.id) ?? resumeId;
|
|
1801
|
+
if (!id) throw createPromptError("transcript_persistence_failed", "[copilot-attempt] saved transcript persistence requires the Copilot SDK session id");
|
|
1802
|
+
return id;
|
|
1803
|
+
}
|
|
1804
|
+
async function disableCopilotFinalizationRemoteExport(session, timeoutMs, signal) {
|
|
1805
|
+
const remote = session.rpc?.remote;
|
|
1806
|
+
if (!remote) throw new Error("[copilot] SDK cannot disable remote export for finalization");
|
|
1807
|
+
await raceWithTimeout(() => remote.disable(), timeoutMs, () => {
|
|
1808
|
+
throw new Error("[copilot] timed out disabling remote export for finalization");
|
|
1809
|
+
}, { signal });
|
|
1810
|
+
}
|
|
1798
1811
|
async function createCopilotSessionSetup(params) {
|
|
1799
1812
|
const { attempt: input, byokProxy, effectiveCwd, effectiveWorkspaceDir, hookContext, modelRef, messages, poolAcquire, ringZeroSystemAgentRun, promptToolPolicy, sessionProvider, settledToolFinalization, signal } = params;
|
|
1800
1813
|
const ordinaryAttemptInput = settledToolFinalization ? void 0 : (() => {
|
|
@@ -1918,7 +1931,7 @@ async function createCopilotSessionSetup(params) {
|
|
|
1918
1931
|
const availableTools = promptTools.map((tool) => tool.name);
|
|
1919
1932
|
if (includeAskUser) availableTools.push(...COPILOT_ASK_USER_AVAILABLE_TOOLS);
|
|
1920
1933
|
return {
|
|
1921
|
-
|
|
1934
|
+
...resolveCopilotSessionModel(modelRef, attemptInput),
|
|
1922
1935
|
onPermissionRequest: createPermissionBridge(permissionPolicy),
|
|
1923
1936
|
...onUserInputRequest ? { onUserInputRequest } : {},
|
|
1924
1937
|
...provider.provider ? { provider: provider.provider } : {},
|
|
@@ -2642,8 +2655,8 @@ async function runCopilotExecution(context) {
|
|
|
2642
2655
|
nativeSessionHistoryValidated = true;
|
|
2643
2656
|
}
|
|
2644
2657
|
sessionRef.current = session;
|
|
2645
|
-
|
|
2646
|
-
|
|
2658
|
+
if (settledToolFinalization) await disableCopilotFinalizationRemoteExport(session, input.timeoutMs, params.abortSignal);
|
|
2659
|
+
sdkSessionId = requireCopilotSdkSessionId(session, resumeFailureRecovered ? void 0 : resumeSessionId);
|
|
2647
2660
|
if (deps.onSessionEstablished && !settledToolFinalization) try {
|
|
2648
2661
|
await deps.onSessionEstablished({
|
|
2649
2662
|
compactionSessionConfig,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { filterStringRecord, normalizeOptionalString, readNonEmptyStringPreservingWhitespace } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
-
import { buildAgentHookContextChannelFields, compactWithSafetyTimeout, getModelProviderRequestTransport, projectSettledTurnFinalizationAttemptResult, resolveCompactionTimeoutMs, runAgentHarnessAfterCompactionHook, runAgentHarnessBeforeCompactionHook } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
1
|
+
import { filterStringRecord, isRecord, normalizeOptionalString, readNonEmptyStringPreservingWhitespace } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
+
import { buildAgentHookContextChannelFields, buildAgentRuntimePlan, compactWithSafetyTimeout, getModelProviderRequestTransport, projectSettledTurnFinalizationAttemptResult, resolveCompactionTimeoutMs, runAgentHarnessAfterCompactionHook, runAgentHarnessBeforeCompactionHook } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
3
3
|
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
4
4
|
import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
|
|
5
5
|
import { homedir } from "node:os";
|
|
@@ -512,25 +512,31 @@ function resolveProviderCredential(value) {
|
|
|
512
512
|
const credential = normalizeOptionalString(value);
|
|
513
513
|
return credential && !isNonSecretApiKeyMarker(credential) ? credential : void 0;
|
|
514
514
|
}
|
|
515
|
-
// extensions/copilot/
|
|
516
|
-
const COPILOT_PROVIDER_IDS = /* @__PURE__ */ new Set(["github-copilot"]);
|
|
515
|
+
// extensions/copilot/src/session-bindings.ts
|
|
517
516
|
function normalizeBinding(value) {
|
|
518
|
-
|
|
517
|
+
const authProfileId = typeof value.authProfileId === "string" ? value.authProfileId : void 0;
|
|
518
|
+
const authProfileVersion = typeof value.authProfileVersion === "string" ? value.authProfileVersion : void 0;
|
|
519
|
+
if (value.schemaVersion !== 2 || typeof value.sdkSessionId !== "string" || value.sdkSessionId.trim() === "" || typeof value.compatKey !== "string" || value.compatKey.trim() === "" || typeof value.compactKey !== "string" || value.compactKey.trim() === "" || value.journalVersion !== void 0 && value.journalVersion !== 1 || value.authMode !== "gitHubToken" && value.authMode !== "byok" && value.authMode !== "useLoggedInUser" || (value.authMode === "gitHubToken" || value.authMode === "byok") && (!authProfileId?.trim() || !authProfileVersion?.trim()) || typeof value.updatedAt !== "number" || !Number.isFinite(value.updatedAt)) return;
|
|
519
520
|
return {
|
|
520
521
|
schemaVersion: 2,
|
|
521
522
|
...value.journalVersion === 1 ? { journalVersion: 1 } : {},
|
|
522
523
|
sdkSessionId: value.sdkSessionId.trim(),
|
|
523
524
|
compatKey: value.compatKey,
|
|
524
525
|
compactKey: value.compactKey,
|
|
525
|
-
...sessionAuthFields(
|
|
526
|
+
...sessionAuthFields({
|
|
527
|
+
authMode: value.authMode,
|
|
528
|
+
authProfileId,
|
|
529
|
+
authProfileVersion
|
|
530
|
+
}),
|
|
526
531
|
updatedAt: value.updatedAt
|
|
527
532
|
};
|
|
528
533
|
}
|
|
529
534
|
function normalizeAttemptBinding(value) {
|
|
535
|
+
if (!isRecord(value)) return;
|
|
530
536
|
const current = normalizeBinding(value);
|
|
531
537
|
if (current) return current;
|
|
532
538
|
const legacy = value;
|
|
533
|
-
if (
|
|
539
|
+
if (legacy.schemaVersion !== 1 || typeof legacy.sdkSessionId !== "string" || legacy.sdkSessionId.trim() === "" || typeof legacy.compatKey !== "string" || legacy.compatKey.trim() === "" || typeof legacy.updatedAt !== "number" || !Number.isFinite(legacy.updatedAt)) return;
|
|
534
540
|
return {
|
|
535
541
|
sdkSessionId: legacy.sdkSessionId.trim(),
|
|
536
542
|
compatKey: legacy.compatKey
|
|
@@ -568,6 +574,26 @@ async function deleteStoredBinding(store, key) {
|
|
|
568
574
|
return false;
|
|
569
575
|
}
|
|
570
576
|
}
|
|
577
|
+
// extensions/copilot/src/model-selection.ts
|
|
578
|
+
function resolveCopilotSessionModel(model, context) {
|
|
579
|
+
if (model.provider.trim().toLowerCase() !== "github-copilot" || model.id.toLowerCase() !== "fusion") return { model: model.id };
|
|
580
|
+
const fusionTier = (context.runtimePlan ?? buildAgentRuntimePlan({
|
|
581
|
+
config: context.config,
|
|
582
|
+
agentId: context.agentId,
|
|
583
|
+
agentDir: context.agentDir,
|
|
584
|
+
workspaceDir: context.workspaceDir,
|
|
585
|
+
provider: model.provider,
|
|
586
|
+
modelId: model.id,
|
|
587
|
+
model,
|
|
588
|
+
harnessId: "copilot"
|
|
589
|
+
})).transport.resolveExtraParams().fusionTier ?? model.params?.fusionTier ?? "standard";
|
|
590
|
+
if (fusionTier !== "standard" && fusionTier !== "high" && fusionTier !== "max") throw new Error("[copilot] fusionTier must be \"standard\", \"high\", or \"max\"");
|
|
591
|
+
return {
|
|
592
|
+
model: "fusion",
|
|
593
|
+
capi: { fusionTier }
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
// extensions/copilot/src/session-compat.ts
|
|
571
597
|
function readAgentIdFromSessionKey(sessionKey) {
|
|
572
598
|
if (typeof sessionKey !== "string") return;
|
|
573
599
|
const parts = sessionKey.trim().split(":");
|
|
@@ -640,9 +666,15 @@ function computeSessionKey(input, options) {
|
|
|
640
666
|
} catch {
|
|
641
667
|
authParts = ["auth=unresolvable"];
|
|
642
668
|
}
|
|
669
|
+
const { capi } = resolveCopilotSessionModel({
|
|
670
|
+
id: modelId,
|
|
671
|
+
provider,
|
|
672
|
+
params: modelObj.params
|
|
673
|
+
}, input.params);
|
|
643
674
|
return [
|
|
644
675
|
`provider=${provider}`,
|
|
645
676
|
`model=${modelId}`,
|
|
677
|
+
...capi?.fusionTier ? [`fusionTier=${capi.fusionTier}`] : [],
|
|
646
678
|
...options.includeApi ? [`api=${normalizeOptionalString(modelObj.api) ?? ""}`] : [],
|
|
647
679
|
...options.includeApi ? [`baseUrlFingerprint=${fingerprintSessionValue(modelObj.baseUrl)}`] : [],
|
|
648
680
|
`cwd=${input.params.cwd ?? input.params.workspaceDir ?? ""}`,
|
|
@@ -683,6 +715,8 @@ function computeCompactRequestKey(params) {
|
|
|
683
715
|
includeAuth: false
|
|
684
716
|
});
|
|
685
717
|
}
|
|
718
|
+
// extensions/copilot/harness.ts
|
|
719
|
+
const COPILOT_PROVIDER_IDS = /* @__PURE__ */ new Set(["github-copilot"]);
|
|
686
720
|
function failedCompaction(reason, rawError) {
|
|
687
721
|
return {
|
|
688
722
|
ok: false,
|
|
@@ -716,7 +750,7 @@ function createCopilotAgentHarness(options) {
|
|
|
716
750
|
async function getPool() {
|
|
717
751
|
if (options?.pool) return options.pool;
|
|
718
752
|
if (!poolPromise) poolPromise = (async () => {
|
|
719
|
-
const { createCopilotClientPool } = await import("./runtime-
|
|
753
|
+
const { createCopilotClientPool } = await import("./runtime-CSW3s9n8.mjs");
|
|
720
754
|
createdPool = createCopilotClientPool(options?.poolOptions);
|
|
721
755
|
return createdPool;
|
|
722
756
|
})();
|
|
@@ -744,7 +778,7 @@ function createCopilotAgentHarness(options) {
|
|
|
744
778
|
async function runHarnessAttempt(params, operation) {
|
|
745
779
|
return trackOperation(async () => {
|
|
746
780
|
if (disposed) throw new Error("[copilot] harness has been disposed; cannot start new attempts");
|
|
747
|
-
const { resolvePoolAcquire, runCopilotAttempt } = await import("./attempt-
|
|
781
|
+
const { resolvePoolAcquire, runCopilotAttempt } = await import("./attempt-C-mlE9Dj.mjs");
|
|
748
782
|
const pool = await getPool();
|
|
749
783
|
let poolAcquire;
|
|
750
784
|
try {
|
|
@@ -842,7 +876,7 @@ function createCopilotAgentHarness(options) {
|
|
|
842
876
|
async function runIsolatedCompletionV2(params) {
|
|
843
877
|
return trackOperation(async () => {
|
|
844
878
|
if (disposed) throw new Error("[copilot] harness has been disposed; cannot start isolated completion");
|
|
845
|
-
const { runCopilotIsolatedCompletion } = await import("./isolated-completion-
|
|
879
|
+
const { runCopilotIsolatedCompletion } = await import("./isolated-completion-D3A_5sKS.mjs");
|
|
846
880
|
return await runCopilotIsolatedCompletion(params, async () => {
|
|
847
881
|
return await getPool();
|
|
848
882
|
});
|
|
@@ -854,7 +888,7 @@ function createCopilotAgentHarness(options) {
|
|
|
854
888
|
autoSelection: { providerIds: [] },
|
|
855
889
|
conversationToolPolicySupport: "exact",
|
|
856
890
|
runtimeArtifact: { async validate(binding) {
|
|
857
|
-
const { validateCopilotRuntimeArtifact } = await import("./runtime-artifact-
|
|
891
|
+
const { validateCopilotRuntimeArtifact } = await import("./runtime-artifact-CrK25YVl.mjs");
|
|
858
892
|
return await validateCopilotRuntimeArtifact(binding);
|
|
859
893
|
} },
|
|
860
894
|
supports(ctx) {
|
|
@@ -893,6 +927,11 @@ function createCopilotAgentHarness(options) {
|
|
|
893
927
|
},
|
|
894
928
|
runAttempt: (params) => runHarnessAttempt(params, "attempt"),
|
|
895
929
|
runIsolatedCompletionV2,
|
|
930
|
+
runSideQuestion: (params) => trackOperation(async () => {
|
|
931
|
+
if (disposed) throw new Error("[copilot] harness has been disposed; cannot answer side questions");
|
|
932
|
+
const { runCopilotSideQuestion } = await import("./side-question-CkqKoVYT.mjs");
|
|
933
|
+
return await runCopilotSideQuestion(params, getPool);
|
|
934
|
+
}),
|
|
896
935
|
finalizeSettledTurn: async ({ attempt }) => {
|
|
897
936
|
const result = await runHarnessAttempt(attempt, "settled-tool-finalization");
|
|
898
937
|
return projectSettledTurnFinalizationAttemptResult(result);
|
|
@@ -936,7 +975,7 @@ function createCopilotAgentHarness(options) {
|
|
|
936
975
|
if (await bindingQueue.enqueue(openclawSessionId, () => hasPendingDeferredCompactionCleanup(openclawSessionId))) return failedCompaction("background-compaction-pending");
|
|
937
976
|
const tracked = trackedSessions.get(openclawSessionId);
|
|
938
977
|
const currentCompactKey = computeCompactRequestKey(params);
|
|
939
|
-
const { resolvePoolAcquire } = await import("./attempt-
|
|
978
|
+
const { resolvePoolAcquire } = await import("./attempt-C-mlE9Dj.mjs");
|
|
940
979
|
let resolvedPoolAcquire;
|
|
941
980
|
try {
|
|
942
981
|
resolvedPoolAcquire = resolvePoolAcquire(params);
|
|
@@ -1049,4 +1088,4 @@ function createCopilotAgentHarness(options) {
|
|
|
1049
1088
|
}
|
|
1050
1089
|
};
|
|
1051
1090
|
}
|
|
1052
|
-
export {
|
|
1091
|
+
export { createPromptError as a, resolveCopilotAuth as c, createCopilotAbortError as i, tokenFingerprint as l, resolveCopilotSessionModel as n, createCopilotByokProxy as o, resolveCopilotProvider as r, createCopilotByokAuth as s, createCopilotAgentHarness as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as buildAssistantMessage, t as createCopilotIsolatedSessionRestrictions } from "./session-restrictions-
|
|
1
|
+
import { i as createCopilotAbortError, l as tokenFingerprint, n as resolveCopilotSessionModel, o as createCopilotByokProxy, r as resolveCopilotProvider } from "./harness-DYLc_Pdo.mjs";
|
|
2
|
+
import { n as buildAssistantMessage, t as createCopilotIsolatedSessionRestrictions, u as normalizeCopilotUsage } from "./session-restrictions-BhNldzCr.mjs";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
|
|
5
5
|
// extensions/copilot/src/isolated-completion.ts
|
|
@@ -55,7 +55,7 @@ async function awaitWithinCompletionBoundary(params) {
|
|
|
55
55
|
throw error;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
async function runCopilotIsolatedCompletion(params, getPool) {
|
|
58
|
+
async function runCopilotIsolatedCompletion(params, getPool, message, prepareRequest) {
|
|
59
59
|
const reasoningEffort = resolveReasoningEffort(params.thinkLevel);
|
|
60
60
|
if (params.thinkLevel !== void 0 && reasoningEffort === void 0) throw new Error(`[copilot] isolated completion does not support thinking level ${params.thinkLevel}`);
|
|
61
61
|
const boundary = {
|
|
@@ -67,6 +67,7 @@ async function runCopilotIsolatedCompletion(params, getPool) {
|
|
|
67
67
|
if (params.authorization.owner !== "host") throw new Error("[copilot] isolated completion requires host-prepared authorization");
|
|
68
68
|
const authorization = params.authorization;
|
|
69
69
|
const { auth, model } = authorization;
|
|
70
|
+
const sessionModel = resolveCopilotSessionModel(model, params);
|
|
70
71
|
const apiKey = auth.apiKey?.trim();
|
|
71
72
|
if (!apiKey) throw new Error("[copilot] isolated completion requires the prepared credential");
|
|
72
73
|
const resolvedProvider = resolveCopilotProvider({
|
|
@@ -101,6 +102,8 @@ async function runCopilotIsolatedCompletion(params, getPool) {
|
|
|
101
102
|
const authProfileVersion = authorization.sourceAuthFingerprint?.trim() || tokenFingerprint(apiKey);
|
|
102
103
|
let handle;
|
|
103
104
|
let session;
|
|
105
|
+
let unsubscribeUsage;
|
|
106
|
+
let usage;
|
|
104
107
|
try {
|
|
105
108
|
const acquiredHandle = await awaitWithinCompletionBoundary({
|
|
106
109
|
boundary,
|
|
@@ -122,7 +125,7 @@ async function runCopilotIsolatedCompletion(params, getPool) {
|
|
|
122
125
|
handle = acquiredHandle;
|
|
123
126
|
const sessionConfig = {
|
|
124
127
|
...createCopilotIsolatedSessionRestrictions(),
|
|
125
|
-
|
|
128
|
+
...sessionModel,
|
|
126
129
|
...githubAuth ? { gitHubToken: apiKey } : {},
|
|
127
130
|
...sessionProvider.provider ? { provider: sessionProvider.provider } : {},
|
|
128
131
|
...reasoningEffort ? { reasoningEffort } : {},
|
|
@@ -141,11 +144,35 @@ async function runCopilotIsolatedCompletion(params, getPool) {
|
|
|
141
144
|
}
|
|
142
145
|
});
|
|
143
146
|
session = createdSession;
|
|
147
|
+
unsubscribeUsage = createdSession.on("assistant.usage", (event) => {
|
|
148
|
+
if (event.agentId !== void 0) return;
|
|
149
|
+
usage = normalizeCopilotUsage(event.data);
|
|
150
|
+
});
|
|
151
|
+
await awaitWithinCompletionBoundary({
|
|
152
|
+
boundary,
|
|
153
|
+
start: () => createdSession.rpc.remote.disable()
|
|
154
|
+
});
|
|
155
|
+
let request = message ?? { prompt: params.prompt };
|
|
156
|
+
if (prepareRequest) request = await awaitWithinCompletionBoundary({
|
|
157
|
+
boundary,
|
|
158
|
+
start: () => prepareRequest(request)
|
|
159
|
+
});
|
|
160
|
+
const attachments = request.images?.map((image) => ({
|
|
161
|
+
type: "blob",
|
|
162
|
+
data: image.data,
|
|
163
|
+
mimeType: image.mimeType,
|
|
164
|
+
...image.displayName !== void 0 ? { displayName: image.displayName } : {}
|
|
165
|
+
}));
|
|
144
166
|
const requestHeaders = sessionProvider.provider?.headers;
|
|
145
167
|
const event = await awaitWithinCompletionBoundary({
|
|
146
168
|
boundary,
|
|
147
169
|
start: (remainingMs) => createdSession.sendAndWait({
|
|
148
|
-
prompt:
|
|
170
|
+
prompt: [
|
|
171
|
+
request.prependContext,
|
|
172
|
+
request.prompt,
|
|
173
|
+
request.appendContext
|
|
174
|
+
].filter((part) => part !== void 0).join("\n\n"),
|
|
175
|
+
...attachments?.length ? { attachments } : {},
|
|
149
176
|
...requestHeaders ? { requestHeaders } : {}
|
|
150
177
|
}, remainingMs),
|
|
151
178
|
onBoundary: () => {
|
|
@@ -157,9 +184,11 @@ async function runCopilotIsolatedCompletion(params, getPool) {
|
|
|
157
184
|
assistantTexts: [],
|
|
158
185
|
event,
|
|
159
186
|
modelRef: model,
|
|
160
|
-
now: Date.now
|
|
187
|
+
now: Date.now,
|
|
188
|
+
usage
|
|
161
189
|
}) };
|
|
162
190
|
} finally {
|
|
191
|
+
unsubscribeUsage?.();
|
|
163
192
|
if (session) {
|
|
164
193
|
const sessionToClose = session;
|
|
165
194
|
startBestEffortCleanup(() => sessionToClose.disconnect());
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as loadCopilotSdk } from "./sdk-loader-
|
|
1
|
+
import { n as loadCopilotSdk } from "./sdk-loader-Bj0G2KhK.mjs";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { toStringifiedError } from "openclaw/plugin-sdk/error-runtime";
|
|
4
4
|
// extensions/copilot/src/runtime.ts
|
|
@@ -40,7 +40,7 @@ function createCopilotClientPool(options = {}) {
|
|
|
40
40
|
const client = await sdkFactory(clientOptions);
|
|
41
41
|
if (runtimeArtifact) try {
|
|
42
42
|
await client.start();
|
|
43
|
-
const { validateCopilotRuntimeArtifact } = await import("./runtime-artifact-
|
|
43
|
+
const { validateCopilotRuntimeArtifact } = await import("./runtime-artifact-CrK25YVl.mjs");
|
|
44
44
|
if (!await validateCopilotRuntimeArtifact(runtimeArtifact)) throw new Error("[copilot] runtime changed while starting; retry setup verification");
|
|
45
45
|
} catch (error) {
|
|
46
46
|
await client.stop().catch(() => void 0);
|
|
@@ -58,7 +58,7 @@ function createCopilotClientPool(options = {}) {
|
|
|
58
58
|
};
|
|
59
59
|
const acquire = async (inputKey, optionsForCreate, runtimeArtifactRequest) => {
|
|
60
60
|
if (runtimeArtifactRequest && optionsForCreate.connection) throw new Error("[copilot] runtime verification requires the packaged stdio runtime");
|
|
61
|
-
const capture = runtimeArtifactRequest ? await (await import("./runtime-artifact-
|
|
61
|
+
const capture = runtimeArtifactRequest ? await (await import("./runtime-artifact-CrK25YVl.mjs")).captureCopilotRuntimeArtifact(optionsForCreate.env) : void 0;
|
|
62
62
|
const expected = runtimeArtifactRequest?.expected;
|
|
63
63
|
if (expected && (capture?.binding.id !== expected.id || capture.binding.fingerprint !== expected.fingerprint)) throw new Error("[copilot] verified runtime changed; rerun setup verification");
|
|
64
64
|
const runtimeArtifact = capture?.binding;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as loadCopilotSdkWithIdentity, t as fingerprintCopilotPackage } from "./sdk-loader-
|
|
1
|
+
import { r as loadCopilotSdkWithIdentity, t as fingerprintCopilotPackage } from "./sdk-loader-Bj0G2KhK.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
@@ -8,7 +8,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
8
8
|
import { sha256File } from "openclaw/plugin-sdk/file-access-runtime";
|
|
9
9
|
import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
|
|
10
10
|
// extensions/copilot/src/sdk-loader.ts
|
|
11
|
-
const COPILOT_SDK_SPEC = `@github/copilot-sdk@${{ "@github/copilot-sdk": "1.0.
|
|
11
|
+
const COPILOT_SDK_SPEC = `@github/copilot-sdk@${{ "@github/copilot-sdk": "1.0.34" }["@github/copilot-sdk"]}`;
|
|
12
12
|
let cached;
|
|
13
13
|
const installedImports = /* @__PURE__ */ new Map();
|
|
14
14
|
function unchanged(before, after) {
|
|
@@ -188,7 +188,7 @@ const COPILOT_ISOLATED_EXCLUDED_TOOLS = [
|
|
|
188
188
|
"mcp:*",
|
|
189
189
|
"custom:*"
|
|
190
190
|
];
|
|
191
|
-
/** Disable
|
|
191
|
+
/** Disable ambient startup capabilities; callers disable remote export before sending. */
|
|
192
192
|
function createCopilotIsolatedSessionRestrictions() {
|
|
193
193
|
return {
|
|
194
194
|
availableTools: [],
|
|
@@ -211,7 +211,6 @@ function createCopilotIsolatedSessionRestrictions() {
|
|
|
211
211
|
mcpServers: {},
|
|
212
212
|
memory: { enabled: false },
|
|
213
213
|
pluginDirectories: [],
|
|
214
|
-
remoteSession: "off",
|
|
215
214
|
requestCanvasRenderer: false,
|
|
216
215
|
requestExtensions: false,
|
|
217
216
|
skillDirectories: [],
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { runCopilotIsolatedCompletion } from "./isolated-completion-D3A_5sKS.mjs";
|
|
2
|
+
import { normalizeUsage } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
3
|
+
// extensions/copilot/src/side-question.ts
|
|
4
|
+
function buildSideQuestionMessage(messages, question, images) {
|
|
5
|
+
const requestImages = [];
|
|
6
|
+
const attach = (image) => {
|
|
7
|
+
const displayName = `context-image-${requestImages.length + 1}`;
|
|
8
|
+
requestImages.push({
|
|
9
|
+
...image,
|
|
10
|
+
displayName
|
|
11
|
+
});
|
|
12
|
+
return `[Attached image: ${displayName}]`;
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
prompt: [
|
|
16
|
+
"Use this sanitized conversation history as background context only.",
|
|
17
|
+
"<conversation_history>",
|
|
18
|
+
...messages.map((message) => {
|
|
19
|
+
const text = typeof message.content === "string" ? message.content : message.content.flatMap((part) => {
|
|
20
|
+
if (part.type === "text") return part.text;
|
|
21
|
+
if (part.type === "image") return attach(part);
|
|
22
|
+
return [];
|
|
23
|
+
}).join("\n");
|
|
24
|
+
return `${message.role === "assistant" ? "Assistant" : "User"}:\n${text}`;
|
|
25
|
+
}),
|
|
26
|
+
"</conversation_history>",
|
|
27
|
+
question,
|
|
28
|
+
...images.map(attach)
|
|
29
|
+
].join("\n\n"),
|
|
30
|
+
images: requestImages
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
async function runCopilotSideQuestion(params, getPool) {
|
|
34
|
+
params.hostCapabilities.assertActive();
|
|
35
|
+
if (!params.prepareIsolatedSideQuestion) throw new Error("[copilot] Update OpenClaw to use native Copilot side questions.");
|
|
36
|
+
const prepared = await params.prepareIsolatedSideQuestion();
|
|
37
|
+
params.hostCapabilities.assertActive();
|
|
38
|
+
if (prepared.kind === "handled") return prepared.result;
|
|
39
|
+
const assistant = (await runCopilotIsolatedCompletion(prepared.params, getPool, buildSideQuestionMessage(prepared.messages, prepared.params.prompt, prepared.images), prepared.prepareRequest)).assistant;
|
|
40
|
+
if (assistant.stopReason !== "stop" && assistant.stopReason !== "length" || assistant.content.some((part) => part.type !== "text" && part.type !== "thinking")) throw new Error("[copilot] Side question did not return a tool-free answer.");
|
|
41
|
+
const text = assistant.content.flatMap((part) => part.type === "text" ? part.text : []).join("").trim();
|
|
42
|
+
if (!text) throw new Error("[copilot] Side question returned no visible answer.");
|
|
43
|
+
return {
|
|
44
|
+
text,
|
|
45
|
+
usage: normalizeUsage(assistant.usage)
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export { runCopilotSideQuestion };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"entries":[{"output":"doctor-contract-api.js","source":"extensions/copilot/doctor-contract-api.ts"},{"output":"harness.js","source":"extensions/copilot/harness.ts"},{"output":"index.js","source":"extensions/copilot/index.ts"}],"chunks":[{"output":".setup/attempt-
|
|
1
|
+
{"version":3,"entries":[{"output":"doctor-contract-api.js","source":"extensions/copilot/doctor-contract-api.ts"},{"output":"harness.js","source":"extensions/copilot/harness.ts"},{"output":"index.js","source":"extensions/copilot/index.ts"}],"chunks":[{"output":".setup/attempt-C-mlE9Dj.mjs","sha256":"de65c6fd4dbcec446266d3d773521c954c494361263163fd849684e3bb32ea62","facadeSource":"extensions/copilot/src/attempt.ts","sources":["extensions/copilot/src/attempt-active-run.ts","extensions/copilot/src/attempt-cleanup.ts","extensions/copilot/src/attempt-config.ts","extensions/copilot/src/attempt-execution.ts","extensions/copilot/src/attempt-finalize.ts","extensions/copilot/src/attempt-mode.ts","extensions/copilot/src/attempt-prepare.ts","extensions/copilot/src/attempt-session-setup.ts","extensions/copilot/src/attempt-transcript-journal.ts","extensions/copilot/src/attempt-transcript-memory.ts","extensions/copilot/src/attempt-transcript-replay.ts","extensions/copilot/src/attempt-types.ts","extensions/copilot/src/attempt.ts","extensions/copilot/src/event-bridge.ts","extensions/copilot/src/hooks-bridge.ts","extensions/copilot/src/permission-bridge.ts","extensions/copilot/src/replay-shim.ts","extensions/copilot/src/tool-bridge.ts","extensions/copilot/src/user-input-bridge.ts","extensions/copilot/src/workspace-bootstrap.ts"]},{"output":".setup/harness-DYLc_Pdo.mjs","sha256":"0a29de5ea9affce9f34759c5af836c05070ce8c3c3c56c047b2463a2a1b53209","facadeSource":null,"sources":["extensions/copilot/harness.ts","extensions/copilot/src/auth-bridge.ts","extensions/copilot/src/byok-proxy.ts","extensions/copilot/src/history-compaction.ts","extensions/copilot/src/model-selection.ts","extensions/copilot/src/prompt-error.ts","extensions/copilot/src/provider-bridge.ts","extensions/copilot/src/session-bindings.ts","extensions/copilot/src/session-compat.ts"]},{"output":".setup/isolated-completion-D3A_5sKS.mjs","sha256":"bcd329adba9592a4f3fa8623af61ec3d1669496b181c8d10f25293a4be1f3ecd","facadeSource":"extensions/copilot/src/isolated-completion.ts","sources":["extensions/copilot/src/isolated-completion.ts"]},{"output":".setup/runtime-artifact-CrK25YVl.mjs","sha256":"79d5ab9d6829af93b92809b20e0be59b5e71abf0af04d16ae1af5650e7479d8f","facadeSource":"extensions/copilot/src/runtime-artifact.ts","sources":["extensions/copilot/src/runtime-artifact.ts"]},{"output":".setup/runtime-CSW3s9n8.mjs","sha256":"4bb8094cab924b69be98af038c714d920b85e956306d4b496b12231e7510cf34","facadeSource":"extensions/copilot/src/runtime.ts","sources":["extensions/copilot/src/runtime.ts"]},{"output":".setup/sdk-loader-Bj0G2KhK.mjs","sha256":"0badb391fff23c82561c4e0cc71985aa197662576090ecdf9003a55ee9f4aef3","facadeSource":null,"sources":["extensions/copilot/package.json","extensions/copilot/src/sdk-loader.ts"]},{"output":".setup/session-restrictions-BhNldzCr.mjs","sha256":"684ae732f424ba6c8315dad1c4696ac16333760da3c9c54edb5affdb3887bce9","facadeSource":null,"sources":["extensions/copilot/src/event-bridge-transcript.ts","extensions/copilot/src/session-restrictions.ts","extensions/copilot/src/usage-bridge.ts"]},{"output":".setup/side-question-CkqKoVYT.mjs","sha256":"1b86771500fc84af97c71b95520fd5bec0981a45080c2eaad6994b3f6f10f432","facadeSource":"extensions/copilot/src/side-question.ts","sources":["extensions/copilot/src/side-question.ts"]},{"output":"doctor-contract-api.js","sha256":"a502f11264fe700a54e481914d9d56d8fb5b4d905cdd6f1c26238fc675c651fd","facadeSource":"extensions/copilot/doctor-contract-api.ts","sources":["extensions/copilot/doctor-contract-api.ts"]},{"output":"harness.js","sha256":"b2a00f33599bbcbd776f2bd5db1987f00f7c9669cd34c2164727d2dbdc521e21","facadeSource":"extensions/copilot/harness.ts","sources":[]},{"output":"index.js","sha256":"67e2739a997618b072d6622a737855093b907c7ab7ac314ee0842ab0162476c4","facadeSource":"extensions/copilot/index.ts","sources":["extensions/copilot/index.ts"]}],"unrenderedSources":[]}
|
package/dist/harness.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as createCopilotAgentHarness } from "./.setup/harness-
|
|
1
|
+
export { t as createCopilotAgentHarness } from "./.setup/harness-DYLc_Pdo.mjs";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createCopilotAgentHarness } from "./.setup/harness-
|
|
1
|
+
import { t as createCopilotAgentHarness } from "./.setup/harness-DYLc_Pdo.mjs";
|
|
2
2
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
3
3
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
// extensions/copilot/index.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/copilot",
|
|
3
|
-
"version": "2026.12.1-beta.
|
|
3
|
+
"version": "2026.12.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",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@github/copilot-sdk": "1.0.
|
|
11
|
+
"@github/copilot-sdk": "1.0.34"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@openclaw/plugin-sdk": "workspace:*"
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"minHostVersion": ">=2026.5.28"
|
|
25
25
|
},
|
|
26
26
|
"compat": {
|
|
27
|
-
"pluginApi": ">=2026.12.1-beta.
|
|
27
|
+
"pluginApi": ">=2026.12.1-beta.3"
|
|
28
28
|
},
|
|
29
29
|
"build": {
|
|
30
|
-
"openclawVersion": "2026.12.1-beta.
|
|
30
|
+
"openclawVersion": "2026.12.1-beta.3",
|
|
31
31
|
"bundledDist": false
|
|
32
32
|
},
|
|
33
33
|
"release": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"assets/activity.svg"
|
|
48
48
|
],
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"openclaw": ">=2026.12.1-beta.
|
|
50
|
+
"openclaw": ">=2026.12.1-beta.3"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"openclaw": {
|