@openclaw/copilot 2026.7.2-beta.7 → 2026.7.33
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/README.md +3 -1
- package/dist/{attempt-D6tQnv01.js → .setup/attempt-BohTAZ-k.mjs} +1374 -2220
- package/dist/{harness-D0K-5kNw.js → .setup/harness-D3I2IcZQ.mjs} +97 -145
- package/dist/{runtime-BY2Yi3Dg.js → .setup/runtime-BD2O8GCd.mjs} +7 -9
- package/dist/doctor-contract-api.js +2 -1
- package/dist/harness.js +1 -1
- package/dist/index.js +2 -2
- package/package.json +6 -5
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { buildAgentHookContextChannelFields, compactWithSafetyTimeout, getModelProviderRequestTransport,
|
|
1
|
+
import { buildAgentHookContextChannelFields, compactWithSafetyTimeout, getModelProviderRequestTransport, resolveCompactionTimeoutMs, runAgentHarnessAfterCompactionHook, runAgentHarnessBeforeCompactionHook } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
2
2
|
import { createHash, randomBytes } from "node:crypto";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { join, resolve } from "node:path";
|
|
5
5
|
import { createServer } from "node:http";
|
|
6
6
|
import { Readable } from "node:stream";
|
|
7
|
-
import {
|
|
7
|
+
import { pipeline } from "node:stream/promises";
|
|
8
8
|
import { fetchWithSsrFGuard, isBlockedHostnameOrIp } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
9
9
|
import { isNonSecretApiKeyMarker } from "openclaw/plugin-sdk/provider-auth";
|
|
10
10
|
//#region extensions/copilot/src/auth-bridge.ts
|
|
@@ -156,7 +156,8 @@ function resolveCopilotHome(args) {
|
|
|
156
156
|
if (args.explicit) return resolve(args.explicit);
|
|
157
157
|
if (args.agentDir) return resolve(join(args.agentDir, "copilot"));
|
|
158
158
|
const openClawHome = readString$1(args.env.OPENCLAW_HOME);
|
|
159
|
-
|
|
159
|
+
const rootHome = openClawHome ? resolve(openClawHome) : safeHomeDir(args.homeDir);
|
|
160
|
+
return resolve(join(rootHome, ".openclaw", "agents", args.agentId, "copilot"));
|
|
160
161
|
}
|
|
161
162
|
function safeHomeDir(homeDir) {
|
|
162
163
|
try {
|
|
@@ -293,7 +294,7 @@ async function handleProxyRequest(req, res, params) {
|
|
|
293
294
|
res.end();
|
|
294
295
|
return;
|
|
295
296
|
}
|
|
296
|
-
await
|
|
297
|
+
await pipeline(Readable.fromWeb(guarded.response.body), res);
|
|
297
298
|
} catch (error) {
|
|
298
299
|
if (res.destroyed || res.writableEnded) return;
|
|
299
300
|
if (res.headersSent) {
|
|
@@ -481,7 +482,7 @@ function resolveCopilotProvider(params) {
|
|
|
481
482
|
};
|
|
482
483
|
}
|
|
483
484
|
function isCopilotByokUnsupportedProviderError(error) {
|
|
484
|
-
return error instanceof Error && (error.message ===
|
|
485
|
+
return error instanceof Error && (error.message === "[copilot-attempt] BYOK requires an OpenAI-compatible or Anthropic model api and a non-empty baseUrl" || error.message === "[copilot-attempt] BYOK does not support OpenClaw provider request proxy, TLS, or private-network policy overrides" || error.message === "[copilot-attempt] BYOK endpoint is blocked by OpenClaw SSRF policy");
|
|
485
486
|
}
|
|
486
487
|
function supportsCopilotByokProviderShape(model) {
|
|
487
488
|
if (!readString(model.baseUrl) || hasUnsupportedTransportPolicy(model)) return false;
|
|
@@ -506,7 +507,8 @@ function assertByokEndpointHostAllowed(baseUrl) {
|
|
|
506
507
|
if (url.protocol !== "https:") throw new Error(COPILOT_BYOK_ENDPOINT_POLICY_ERROR);
|
|
507
508
|
if (url.username || url.password) throw new Error(COPILOT_BYOK_ENDPOINT_POLICY_ERROR);
|
|
508
509
|
for (const key of url.searchParams.keys()) if (CREDENTIAL_QUERY_PARAM_NAMES.has(normalizeCredentialQueryParamName(key))) throw new Error(COPILOT_BYOK_ENDPOINT_POLICY_ERROR);
|
|
509
|
-
|
|
510
|
+
const hostname = url.hostname.toLowerCase().replace(/\.+$/, "");
|
|
511
|
+
if (isBlockedHostnameOrIp(hostname)) throw new Error(COPILOT_BYOK_ENDPOINT_POLICY_ERROR);
|
|
510
512
|
}
|
|
511
513
|
function normalizeCredentialQueryParamName(name) {
|
|
512
514
|
const stripped = name.replace(QUERY_PARAM_NAME_SEPARATOR_RE, "");
|
|
@@ -607,10 +609,9 @@ function sessionAuthMatches(stored, current) {
|
|
|
607
609
|
return current.authMode === stored.authMode && stored.authProfileId === current.authProfileId && stored.authProfileVersion === current.authProfileVersion;
|
|
608
610
|
}
|
|
609
611
|
function normalizeBinding(value) {
|
|
610
|
-
if (!value || 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.
|
|
612
|
+
if (!value || 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.authMode !== "gitHubToken" && value.authMode !== "byok" && value.authMode !== "useLoggedInUser" || (value.authMode === "gitHubToken" || value.authMode === "byok") && (typeof value.authProfileId !== "string" || value.authProfileId.trim() === "" || typeof value.authProfileVersion !== "string" || value.authProfileVersion.trim() === "") || typeof value.updatedAt !== "number" || !Number.isFinite(value.updatedAt)) return;
|
|
611
613
|
return {
|
|
612
614
|
schemaVersion: 2,
|
|
613
|
-
...value.journalVersion === 1 ? { journalVersion: 1 } : {},
|
|
614
615
|
sdkSessionId: value.sdkSessionId.trim(),
|
|
615
616
|
compatKey: value.compatKey,
|
|
616
617
|
compactKey: value.compactKey,
|
|
@@ -821,7 +822,7 @@ function createCopilotAgentHarness(options) {
|
|
|
821
822
|
async function getPool() {
|
|
822
823
|
if (options?.pool) return options.pool;
|
|
823
824
|
if (!poolPromise) poolPromise = (async () => {
|
|
824
|
-
const { createCopilotClientPool } = await import("./runtime-
|
|
825
|
+
const { createCopilotClientPool } = await import("./runtime-BD2O8GCd.mjs");
|
|
825
826
|
createdPool = createCopilotClientPool(options?.poolOptions);
|
|
826
827
|
return createdPool;
|
|
827
828
|
})();
|
|
@@ -855,141 +856,9 @@ function createCopilotAgentHarness(options) {
|
|
|
855
856
|
for (const [, cleanup] of pending) cleanup.abort();
|
|
856
857
|
await Promise.allSettled(pending.map(([cleanup]) => cleanup));
|
|
857
858
|
}
|
|
858
|
-
async function runHarnessAttempt(params, operation) {
|
|
859
|
-
const attemptPromise = (async () => {
|
|
860
|
-
if (disposed) throw new Error("[copilot] harness has been disposed; cannot start new attempts");
|
|
861
|
-
const { resolvePoolAcquire, runCopilotAttempt } = await import("./attempt-D6tQnv01.js");
|
|
862
|
-
if (disposed) throw new Error("[copilot] harness was disposed while starting an attempt");
|
|
863
|
-
const pool = await getPool();
|
|
864
|
-
if (disposed) throw new Error("[copilot] harness was disposed while starting an attempt");
|
|
865
|
-
let poolAcquire;
|
|
866
|
-
try {
|
|
867
|
-
poolAcquire = resolvePoolAcquire(params);
|
|
868
|
-
} catch (error) {
|
|
869
|
-
if (operation === "attempt" && isCopilotByokUnsupportedProviderError(error)) return runCopilotAttempt(params, { pool });
|
|
870
|
-
throw error;
|
|
871
|
-
}
|
|
872
|
-
const openclawSessionId = typeof params.sessionId === "string" ? params.sessionId : void 0;
|
|
873
|
-
const currentCompatKey = computeSessionCompatKey(params);
|
|
874
|
-
const currentCompactKey = computeSessionCompactKey(params);
|
|
875
|
-
const compactionCleanupPending = openclawSessionId !== void 0 && hasPendingDeferredCompactionCleanup(openclawSessionId);
|
|
876
|
-
const replayBlocked = openclawSessionId !== void 0 && (compactionCleanupPending || resetBlockedStoredSessions.has(openclawSessionId));
|
|
877
|
-
const tracked = openclawSessionId && !replayBlocked ? trackedSessions.get(openclawSessionId) : void 0;
|
|
878
|
-
const stored = openclawSessionId ? replayBlocked ? void 0 : lookupStoredBinding(options?.sessionStore, openclawSessionId) : void 0;
|
|
879
|
-
const resumableBinding = tracked && tracked.compatKey === currentCompatKey ? tracked : !tracked && stored && stored.compatKey === currentCompatKey ? stored : void 0;
|
|
880
|
-
const resumableSessionId = resumableBinding?.sdkSessionId;
|
|
881
|
-
if (operation === "settled-tool-finalization" && !resumableSessionId) throw new Error("[copilot] cannot safely finalize a settled tool turn without its compatible SDK session");
|
|
882
|
-
const result = await runCopilotAttempt(resumableSessionId ? {
|
|
883
|
-
...params,
|
|
884
|
-
...operation === "settled-tool-finalization" ? {
|
|
885
|
-
disableTools: true,
|
|
886
|
-
onAgentEvent: void 0,
|
|
887
|
-
onAgentToolResult: void 0,
|
|
888
|
-
onAssistantDelta: void 0,
|
|
889
|
-
onAssistantMessageStart: void 0,
|
|
890
|
-
onBlockReply: void 0,
|
|
891
|
-
onBlockReplyFlush: void 0,
|
|
892
|
-
onPartialReply: void 0,
|
|
893
|
-
onReasoningEnd: void 0,
|
|
894
|
-
onReasoningStream: void 0,
|
|
895
|
-
onToolResult: void 0,
|
|
896
|
-
onToolStreamBoundary: void 0
|
|
897
|
-
} : {},
|
|
898
|
-
initialReplayState: operation === "settled-tool-finalization" ? {
|
|
899
|
-
...resumableBinding?.journalVersion === 1 ? { journalValidated: true } : {},
|
|
900
|
-
sdkSessionId: resumableSessionId
|
|
901
|
-
} : {
|
|
902
|
-
...params.initialReplayState,
|
|
903
|
-
...resumableBinding?.journalVersion === 1 ? { journalValidated: true } : {},
|
|
904
|
-
sdkSessionId: resumableSessionId
|
|
905
|
-
}
|
|
906
|
-
} : params, {
|
|
907
|
-
pool,
|
|
908
|
-
...operation === "settled-tool-finalization" ? { operation } : {},
|
|
909
|
-
onSessionEstablished: operation === "attempt" && openclawSessionId ? ({ compactionSessionConfig, sdkSessionId, pooledClient, sessionConfig }) => {
|
|
910
|
-
trackedSessions.set(openclawSessionId, {
|
|
911
|
-
sdkSessionId,
|
|
912
|
-
client: pooledClient.client,
|
|
913
|
-
clientOptions: poolAcquire.options,
|
|
914
|
-
compatKey: currentCompatKey,
|
|
915
|
-
compactKey: currentCompactKey,
|
|
916
|
-
poolKey: pooledClient.key,
|
|
917
|
-
sessionConfig: compactionSessionConfig ?? sessionConfig,
|
|
918
|
-
...sessionAuthFields(poolAcquire.auth)
|
|
919
|
-
});
|
|
920
|
-
registerStoredBinding(options?.sessionStore, openclawSessionId, {
|
|
921
|
-
schemaVersion: 2,
|
|
922
|
-
sdkSessionId,
|
|
923
|
-
compatKey: currentCompatKey,
|
|
924
|
-
compactKey: currentCompactKey,
|
|
925
|
-
...sessionAuthFields(poolAcquire.auth),
|
|
926
|
-
updatedAt: Date.now()
|
|
927
|
-
});
|
|
928
|
-
resetBlockedStoredSessions.delete(openclawSessionId);
|
|
929
|
-
} : void 0,
|
|
930
|
-
onDeferredCompaction: openclawSessionId ? ({ abort, cleanup, sdkSessionId }) => {
|
|
931
|
-
const trackedBinding = trackedSessions.get(openclawSessionId);
|
|
932
|
-
const storedBinding = lookupStoredBinding(options?.sessionStore, openclawSessionId);
|
|
933
|
-
const ownsTrackedSession = trackedBinding?.sdkSessionId === sdkSessionId;
|
|
934
|
-
const ownsStoredSession = storedBinding?.sdkSessionId === sdkSessionId;
|
|
935
|
-
if (!ownsTrackedSession && !ownsStoredSession) return;
|
|
936
|
-
trackDeferredCompactionCleanup({
|
|
937
|
-
abort,
|
|
938
|
-
cleanup,
|
|
939
|
-
sessionId: openclawSessionId,
|
|
940
|
-
sdkSessionId
|
|
941
|
-
});
|
|
942
|
-
resetBlockedStoredSessions.add(openclawSessionId);
|
|
943
|
-
cleanup.then((outcome) => {
|
|
944
|
-
const currentTracked = trackedSessions.get(openclawSessionId);
|
|
945
|
-
const currentStored = lookupStoredBinding(options?.sessionStore, openclawSessionId);
|
|
946
|
-
const stillOwnsTrackedSession = currentTracked?.sdkSessionId === sdkSessionId;
|
|
947
|
-
const stillOwnsStoredSession = currentStored?.sdkSessionId === sdkSessionId;
|
|
948
|
-
if (outcome === "completed") {
|
|
949
|
-
if (stillOwnsTrackedSession || stillOwnsStoredSession) resetBlockedStoredSessions.delete(openclawSessionId);
|
|
950
|
-
return;
|
|
951
|
-
}
|
|
952
|
-
if (stillOwnsTrackedSession) trackedSessions.delete(openclawSessionId);
|
|
953
|
-
if (stillOwnsStoredSession) deleteStoredBinding(options?.sessionStore, openclawSessionId);
|
|
954
|
-
if (stillOwnsTrackedSession || stillOwnsStoredSession) resetBlockedStoredSessions.add(openclawSessionId);
|
|
955
|
-
});
|
|
956
|
-
} : void 0
|
|
957
|
-
});
|
|
958
|
-
if (operation === "attempt" && openclawSessionId) {
|
|
959
|
-
const attemptResult = result;
|
|
960
|
-
const sdkSessionId = attemptResult.sdkSessionId;
|
|
961
|
-
const trackedSession = trackedSessions.get(openclawSessionId);
|
|
962
|
-
if (sdkSessionId && trackedSession?.sdkSessionId === sdkSessionId) {
|
|
963
|
-
const { journalVersion: _journalVersion, ...baseTracked } = trackedSession;
|
|
964
|
-
const nextTracked = {
|
|
965
|
-
...baseTracked,
|
|
966
|
-
...attemptResult.journalValidated ? { journalVersion: 1 } : {}
|
|
967
|
-
};
|
|
968
|
-
trackedSessions.set(openclawSessionId, nextTracked);
|
|
969
|
-
registerStoredBinding(options?.sessionStore, openclawSessionId, {
|
|
970
|
-
schemaVersion: 2,
|
|
971
|
-
...attemptResult.journalValidated ? { journalVersion: 1 } : {},
|
|
972
|
-
sdkSessionId,
|
|
973
|
-
compatKey: nextTracked.compatKey,
|
|
974
|
-
compactKey: nextTracked.compactKey,
|
|
975
|
-
...sessionAuthFields(nextTracked),
|
|
976
|
-
updatedAt: Date.now()
|
|
977
|
-
});
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
return result;
|
|
981
|
-
})();
|
|
982
|
-
inFlight.add(attemptPromise);
|
|
983
|
-
try {
|
|
984
|
-
return await attemptPromise;
|
|
985
|
-
} finally {
|
|
986
|
-
inFlight.delete(attemptPromise);
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
859
|
return {
|
|
990
860
|
id: options?.id ?? "copilot",
|
|
991
861
|
label: options?.label ?? "GitHub Copilot agent runtime",
|
|
992
|
-
autoSelection: { providerIds: [] },
|
|
993
862
|
supports(ctx) {
|
|
994
863
|
if (String(ctx.requestedRuntime ?? "").trim().toLowerCase() !== "copilot") return {
|
|
995
864
|
supported: false,
|
|
@@ -1024,9 +893,92 @@ function createCopilotAgentHarness(options) {
|
|
|
1024
893
|
priority: 100
|
|
1025
894
|
};
|
|
1026
895
|
},
|
|
1027
|
-
runAttempt
|
|
1028
|
-
|
|
1029
|
-
|
|
896
|
+
async runAttempt(params) {
|
|
897
|
+
const attemptPromise = (async () => {
|
|
898
|
+
if (disposed) throw new Error("[copilot] harness has been disposed; cannot start new attempts");
|
|
899
|
+
const { resolvePoolAcquire, runCopilotAttempt } = await import("./attempt-BohTAZ-k.mjs");
|
|
900
|
+
if (disposed) throw new Error("[copilot] harness was disposed while starting an attempt");
|
|
901
|
+
const pool = await getPool();
|
|
902
|
+
if (disposed) throw new Error("[copilot] harness was disposed while starting an attempt");
|
|
903
|
+
let poolAcquire;
|
|
904
|
+
try {
|
|
905
|
+
poolAcquire = resolvePoolAcquire(params);
|
|
906
|
+
} catch (error) {
|
|
907
|
+
if (isCopilotByokUnsupportedProviderError(error)) return runCopilotAttempt(params, { pool });
|
|
908
|
+
throw error;
|
|
909
|
+
}
|
|
910
|
+
const openclawSessionId = typeof params.sessionId === "string" ? params.sessionId : void 0;
|
|
911
|
+
const currentCompatKey = computeSessionCompatKey(params);
|
|
912
|
+
const currentCompactKey = computeSessionCompactKey(params);
|
|
913
|
+
const compactionCleanupPending = openclawSessionId !== void 0 && hasPendingDeferredCompactionCleanup(openclawSessionId);
|
|
914
|
+
const replayBlocked = openclawSessionId !== void 0 && (compactionCleanupPending || resetBlockedStoredSessions.has(openclawSessionId));
|
|
915
|
+
const tracked = openclawSessionId && !replayBlocked ? trackedSessions.get(openclawSessionId) : void 0;
|
|
916
|
+
const stored = openclawSessionId ? replayBlocked ? void 0 : lookupStoredBinding(options?.sessionStore, openclawSessionId) : void 0;
|
|
917
|
+
const resumableSessionId = tracked && tracked.compatKey === currentCompatKey ? tracked.sdkSessionId : !tracked && stored && stored.compatKey === currentCompatKey ? stored.sdkSessionId : void 0;
|
|
918
|
+
return runCopilotAttempt(resumableSessionId ? {
|
|
919
|
+
...params,
|
|
920
|
+
initialReplayState: {
|
|
921
|
+
...params.initialReplayState,
|
|
922
|
+
sdkSessionId: resumableSessionId
|
|
923
|
+
}
|
|
924
|
+
} : params, {
|
|
925
|
+
pool,
|
|
926
|
+
onSessionEstablished: openclawSessionId ? ({ compactionSessionConfig, sdkSessionId, pooledClient, sessionConfig }) => {
|
|
927
|
+
trackedSessions.set(openclawSessionId, {
|
|
928
|
+
sdkSessionId,
|
|
929
|
+
client: pooledClient.client,
|
|
930
|
+
clientOptions: poolAcquire.options,
|
|
931
|
+
compatKey: currentCompatKey,
|
|
932
|
+
compactKey: currentCompactKey,
|
|
933
|
+
poolKey: pooledClient.key,
|
|
934
|
+
sessionConfig: compactionSessionConfig ?? sessionConfig,
|
|
935
|
+
...sessionAuthFields(poolAcquire.auth)
|
|
936
|
+
});
|
|
937
|
+
registerStoredBinding(options?.sessionStore, openclawSessionId, {
|
|
938
|
+
schemaVersion: 2,
|
|
939
|
+
sdkSessionId,
|
|
940
|
+
compatKey: currentCompatKey,
|
|
941
|
+
compactKey: currentCompactKey,
|
|
942
|
+
...sessionAuthFields(poolAcquire.auth),
|
|
943
|
+
updatedAt: Date.now()
|
|
944
|
+
});
|
|
945
|
+
resetBlockedStoredSessions.delete(openclawSessionId);
|
|
946
|
+
} : void 0,
|
|
947
|
+
onDeferredCompaction: openclawSessionId ? ({ abort, cleanup, sdkSessionId }) => {
|
|
948
|
+
const trackedBinding = trackedSessions.get(openclawSessionId);
|
|
949
|
+
const storedBinding = lookupStoredBinding(options?.sessionStore, openclawSessionId);
|
|
950
|
+
const ownsTrackedSession = trackedBinding?.sdkSessionId === sdkSessionId;
|
|
951
|
+
const ownsStoredSession = storedBinding?.sdkSessionId === sdkSessionId;
|
|
952
|
+
if (!ownsTrackedSession && !ownsStoredSession) return;
|
|
953
|
+
trackDeferredCompactionCleanup({
|
|
954
|
+
abort,
|
|
955
|
+
cleanup,
|
|
956
|
+
sessionId: openclawSessionId,
|
|
957
|
+
sdkSessionId
|
|
958
|
+
});
|
|
959
|
+
resetBlockedStoredSessions.add(openclawSessionId);
|
|
960
|
+
cleanup.then((outcome) => {
|
|
961
|
+
const currentTracked = trackedSessions.get(openclawSessionId);
|
|
962
|
+
const currentStored = lookupStoredBinding(options?.sessionStore, openclawSessionId);
|
|
963
|
+
const stillOwnsTrackedSession = currentTracked?.sdkSessionId === sdkSessionId;
|
|
964
|
+
const stillOwnsStoredSession = currentStored?.sdkSessionId === sdkSessionId;
|
|
965
|
+
if (outcome === "completed") {
|
|
966
|
+
if (stillOwnsTrackedSession || stillOwnsStoredSession) resetBlockedStoredSessions.delete(openclawSessionId);
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
if (stillOwnsTrackedSession) trackedSessions.delete(openclawSessionId);
|
|
970
|
+
if (stillOwnsStoredSession) deleteStoredBinding(options?.sessionStore, openclawSessionId);
|
|
971
|
+
if (stillOwnsTrackedSession || stillOwnsStoredSession) resetBlockedStoredSessions.add(openclawSessionId);
|
|
972
|
+
});
|
|
973
|
+
} : void 0
|
|
974
|
+
});
|
|
975
|
+
})();
|
|
976
|
+
inFlight.add(attemptPromise);
|
|
977
|
+
try {
|
|
978
|
+
return await attemptPromise;
|
|
979
|
+
} finally {
|
|
980
|
+
inFlight.delete(attemptPromise);
|
|
981
|
+
}
|
|
1030
982
|
},
|
|
1031
983
|
async reset(params) {
|
|
1032
984
|
const openclawSessionId = typeof params.sessionId === "string" ? params.sessionId : void 0;
|
|
@@ -1060,7 +1012,7 @@ function createCopilotAgentHarness(options) {
|
|
|
1060
1012
|
};
|
|
1061
1013
|
const tracked = trackedSessions.get(openclawSessionId);
|
|
1062
1014
|
const currentCompactKey = computeSessionCompactKey(params);
|
|
1063
|
-
const { resolvePoolAcquire } = await import("./attempt-
|
|
1015
|
+
const { resolvePoolAcquire } = await import("./attempt-BohTAZ-k.mjs");
|
|
1064
1016
|
let resolvedPoolAcquire;
|
|
1065
1017
|
let currentAuth;
|
|
1066
1018
|
try {
|
|
@@ -34,7 +34,8 @@ async function doLoad(options) {
|
|
|
34
34
|
const fallbackPath = path.join(fallbackDir, "node_modules", "@github", "copilot-sdk");
|
|
35
35
|
if (!existsSync(fallbackPath)) throw createMissingSdkError(primaryErr, void 0, fallbackPath);
|
|
36
36
|
const fallbackImport = options.fallbackImport ?? (async () => {
|
|
37
|
-
|
|
37
|
+
const entry = createRequire(path.join(fallbackDir, "package.json")).resolve("@github/copilot-sdk");
|
|
38
|
+
return await import(pathToFileURL(entry).href);
|
|
38
39
|
});
|
|
39
40
|
try {
|
|
40
41
|
return await fallbackImport(fallbackPath);
|
|
@@ -78,7 +79,7 @@ function summarizeError(value) {
|
|
|
78
79
|
}
|
|
79
80
|
//#endregion
|
|
80
81
|
//#region extensions/copilot/src/runtime.ts
|
|
81
|
-
const DEFAULT_IDLE_TTL_MS =
|
|
82
|
+
const DEFAULT_IDLE_TTL_MS = 3e5;
|
|
82
83
|
const POOL_DISPOSED_MESSAGE = "[copilot-pool] pool disposed";
|
|
83
84
|
function createCopilotClientPool(options = {}) {
|
|
84
85
|
const sdkFactory = options.sdkFactory ?? (async (clientOptions) => {
|
|
@@ -182,7 +183,7 @@ function createCopilotClientPool(options = {}) {
|
|
|
182
183
|
};
|
|
183
184
|
};
|
|
184
185
|
const acquire = async (inputKey, optionsForCreate) => {
|
|
185
|
-
const key = normalizePoolKey(inputKey, optionsForCreate.copilotHome
|
|
186
|
+
const key = normalizePoolKey(inputKey, optionsForCreate.copilotHome);
|
|
186
187
|
const cacheKey = JSON.stringify(key);
|
|
187
188
|
const clientOptions = normalizeClientCreateOptions(optionsForCreate, key.copilotHome);
|
|
188
189
|
while (true) {
|
|
@@ -258,9 +259,7 @@ function createCopilotClientPool(options = {}) {
|
|
|
258
259
|
case "stopping":
|
|
259
260
|
case "stopped": return;
|
|
260
261
|
case "ready":
|
|
261
|
-
case "idle":
|
|
262
|
-
if (entry.state.client !== handle.client) return;
|
|
263
|
-
break;
|
|
262
|
+
case "idle": if (entry.state.client !== handle.client) return;
|
|
264
263
|
}
|
|
265
264
|
if (entry.refCount <= 0) return;
|
|
266
265
|
entry.refCount -= 1;
|
|
@@ -310,14 +309,13 @@ function createCopilotClientPool(options = {}) {
|
|
|
310
309
|
size: () => entries.size
|
|
311
310
|
};
|
|
312
311
|
}
|
|
313
|
-
function normalizePoolKey(key, rawCopilotHome
|
|
312
|
+
function normalizePoolKey(key, rawCopilotHome) {
|
|
314
313
|
return {
|
|
315
314
|
agentId: key.agentId,
|
|
316
315
|
copilotHome: normalizeCopilotHome(rawCopilotHome),
|
|
317
316
|
authMode: key.authMode,
|
|
318
317
|
authProfileId: key.authProfileId,
|
|
319
|
-
authProfileVersion: key.authProfileVersion
|
|
320
|
-
...clientMode === "empty" ? { clientMode } : {}
|
|
318
|
+
authProfileVersion: key.authProfileVersion
|
|
321
319
|
};
|
|
322
320
|
}
|
|
323
321
|
function normalizeClientCreateOptions(options, normalizedCopilotHome) {
|
|
@@ -10,7 +10,8 @@ function normalizeCompatibilityConfig({ cfg }) {
|
|
|
10
10
|
* Session-state ownership claim for the copilot agent runtime.
|
|
11
11
|
*
|
|
12
12
|
* - id / label: Identify the extension in doctor output.
|
|
13
|
-
* - providerIds: The subscription Copilot providers
|
|
13
|
+
* - providerIds: The subscription Copilot providers (kept in sync
|
|
14
|
+
* with `SUPPORTED_PROVIDERS` in attempt.ts).
|
|
14
15
|
* - runtimeIds: Our harness id (matches harness.ts `id` field).
|
|
15
16
|
* - cliSessionKeys: Session keys this harness writes; doctor uses
|
|
16
17
|
* this when pruning stale CLI session state.
|
package/dist/harness.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createCopilotAgentHarness } from "
|
|
1
|
+
import { t as createCopilotAgentHarness } from "./.setup/harness-D3I2IcZQ.mjs";
|
|
2
2
|
export { createCopilotAgentHarness };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createCopilotAgentHarness } from "
|
|
1
|
+
import { t as createCopilotAgentHarness } from "./.setup/harness-D3I2IcZQ.mjs";
|
|
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
|
|
@@ -20,7 +20,7 @@ var copilot_default = definePluginEntry({
|
|
|
20
20
|
const sessionStore = api.runtime.state.openSyncKeyedStore({
|
|
21
21
|
namespace: "sdk-sessions",
|
|
22
22
|
maxEntries: 5e3,
|
|
23
|
-
defaultTtlMs:
|
|
23
|
+
defaultTtlMs: 7776e6
|
|
24
24
|
});
|
|
25
25
|
api.registerAgentHarness(createCopilotAgentHarness({
|
|
26
26
|
...poolOptions ? { poolOptions } : {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/copilot",
|
|
3
|
-
"version": "2026.7.
|
|
3
|
+
"version": "2026.7.33",
|
|
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,9 +8,10 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@github/copilot-sdk": "1.0.
|
|
11
|
+
"@github/copilot-sdk": "1.0.5"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
+
"@github/copilot": "1.0.68",
|
|
14
15
|
"@openclaw/plugin-sdk": "workspace:*"
|
|
15
16
|
},
|
|
16
17
|
"openclaw": {
|
|
@@ -24,10 +25,10 @@
|
|
|
24
25
|
"minHostVersion": ">=2026.5.28"
|
|
25
26
|
},
|
|
26
27
|
"compat": {
|
|
27
|
-
"pluginApi": ">=2026.7.
|
|
28
|
+
"pluginApi": ">=2026.7.33"
|
|
28
29
|
},
|
|
29
30
|
"build": {
|
|
30
|
-
"openclawVersion": "2026.7.
|
|
31
|
+
"openclawVersion": "2026.7.33",
|
|
31
32
|
"bundledDist": false
|
|
32
33
|
},
|
|
33
34
|
"release": {
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"README.md"
|
|
46
47
|
],
|
|
47
48
|
"peerDependencies": {
|
|
48
|
-
"openclaw": ">=2026.7.
|
|
49
|
+
"openclaw": ">=2026.7.33"
|
|
49
50
|
},
|
|
50
51
|
"peerDependenciesMeta": {
|
|
51
52
|
"openclaw": {
|