@openclaw/copilot 2026.10.5-beta.4 → 2026.10.10-beta.1
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 +1 -1
- package/dist/.setup/{attempt-BTNvSiix.mjs → attempt-Ca9ft09-.mjs} +12 -12
- package/dist/.setup/{harness-CAJKYXN0.mjs → harness-B_eHdd0o.mjs} +4 -4
- package/dist/.setup/{isolated-completion-DWrGtYCY.mjs → isolated-completion-zufhizl0.mjs} +1 -1
- package/dist/.setup/{runtime-BgRSM1VR.mjs → runtime-C0R_TFVt.mjs} +38 -134
- package/dist/harness.js +1 -2
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ openclaw plugins install @openclaw/copilot
|
|
|
10
10
|
|
|
11
11
|
Restart the Gateway after installing or updating the plugin.
|
|
12
12
|
|
|
13
|
-
The harness claims the
|
|
13
|
+
The harness claims the `github-copilot` subscription provider plus
|
|
14
14
|
custom BYOK provider entries that the Copilot SDK can represent. Manifest-owned
|
|
15
15
|
native provider ids stay with their owning runtimes. The harness is opt-in only:
|
|
16
16
|
selection requires explicit `agentRuntime.id: "copilot"` on a model or provider
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { a as createCopilotByokProxy, i as createPromptError, n as resolveCopilotProvider, o as createCopilotByokAuth, s as resolveCopilotAuth } from "./harness-
|
|
1
|
+
import { a as createCopilotByokProxy, i as createPromptError, n as resolveCopilotProvider, o as createCopilotByokAuth, s as resolveCopilotAuth } from "./harness-B_eHdd0o.mjs";
|
|
2
2
|
import { n as normalizeCopilotUsage, r as createCopilotIsolatedSessionRestrictions, t as buildCopilotAssistantUsage } from "./usage-bridge--rLPdCvV.mjs";
|
|
3
3
|
import { asNonArrayRecord, asOptionalObjectRecord, asOptionalRecord, normalizeOptionalString, normalizeUniqueStringEntries, readNonBlankString, readNonEmptyStringPreservingWhitespace, readNonEmptyStringPreservingWhitespace as readNonEmptyString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
-
import { SKILL_WORKSHOP_TOOL_NAME, applyEmbeddedAttemptToolsAllow, awaitAgentEndSideEffects, buildAgentHookContextChannelFields, buildCredentialSafetyPrompt, buildDelegationGuidanceSection, buildEmbeddedAttemptToolRunContext, buildEmbeddedForegroundPromptContext, buildHarnessVisibleReplyGuidance, buildSkillWorkshopPromptSection, cancelPendingAgentQuestionForSession, claimPendingAgentQuestionAnswer, clearActiveEmbeddedRun, detectAndLoadAgentHarnessPromptImages, embeddedAgentLog, emitAgentEvent, extractToolErrorMessage, getModelProviderRequestTransport, getPluginToolMeta, getPluginToolSideEffectOwnerKey, isHostScopedAgentToolActive, isSubagentSessionKey, isToolResultError, projectAgentHarnessTranscriptMessageForDisplay, projectAgentToolActivity, resolveAgentDir, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptFsWorkspaceOnly, resolveAttemptSpawnWorkspaceDir, resolveBootstrapContextForRun, resolveCompactionTimeoutMs, resolveEmbeddedAttemptToolConstructionPlan, resolveMainSessionDelegationMode,
|
|
4
|
+
import { SKILL_WORKSHOP_TOOL_NAME, applyEmbeddedAttemptToolsAllow, awaitAgentEndSideEffects, buildAgentHookContextChannelFields, buildCredentialSafetyPrompt, buildDelegationGuidanceSection, buildEmbeddedAttemptToolRunContext, buildEmbeddedForegroundPromptContext, buildHarnessVisibleReplyGuidance, buildSkillWorkshopPromptSection, cancelPendingAgentQuestionForSession, claimPendingAgentQuestionAnswer, clearActiveEmbeddedRun, detectAndLoadAgentHarnessPromptImages, embeddedAgentLog, emitAgentEvent, extractToolErrorMessage, getModelProviderRequestTransport, getPluginToolMeta, getPluginToolSideEffectOwnerKey, isHostScopedAgentToolActive, isSubagentSessionKey, isToolResultError, projectAgentHarnessTranscriptMessageForDisplay, projectAgentToolActivity, resolveAgentDir, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptFsWorkspaceOnly, resolveAttemptSpawnWorkspaceDir, resolveBootstrapContextForRun, resolveCompactionTimeoutMs, resolveEmbeddedAttemptToolConstructionPlan, resolveMainSessionDelegationMode, resolveModelAuthModeAsync, 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";
|
|
6
6
|
import { raceWithTimeout, withTimeout } from "openclaw/plugin-sdk/time-runtime";
|
|
7
7
|
import { formatErrorMessage, toErrorObject, toStringifiedError, toStringifiedError as toCopilotError } from "openclaw/plugin-sdk/error-runtime";
|
|
8
8
|
import { createDeferred } from "openclaw/plugin-sdk/concurrency-runtime";
|
|
9
9
|
import { parseDateStringTimestampMs } from "openclaw/plugin-sdk/number-runtime";
|
|
10
|
-
import {
|
|
10
|
+
import { createAgentHarnessToolSurfaceRuntimeAsync, normalizeAcceptedSessionSpawnResult } from "openclaw/plugin-sdk/agent-harness-tool-runtime";
|
|
11
11
|
import fsp from "node:fs/promises";
|
|
12
12
|
import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
13
13
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -105,7 +105,7 @@ function createHooksBridge(config, options) {
|
|
|
105
105
|
}
|
|
106
106
|
//#endregion
|
|
107
107
|
//#region extensions/copilot/src/permission-bridge.ts
|
|
108
|
-
const REJECT_ALL_FEEDBACK = "copilot agent runtime: no permission policy installed (
|
|
108
|
+
const REJECT_ALL_FEEDBACK = "copilot agent runtime: no permission policy installed (denied by default)";
|
|
109
109
|
const rejectAllPolicy = () => ({
|
|
110
110
|
kind: "reject",
|
|
111
111
|
feedback: REJECT_ALL_FEEDBACK
|
|
@@ -1059,7 +1059,7 @@ async function finalizeCopilotAttempt(params, result, ctx, attemptStartedAt, now
|
|
|
1059
1059
|
ctx
|
|
1060
1060
|
};
|
|
1061
1061
|
if (!params.messageChannel && !params.messageProvider) await awaitAgentEndSideEffects(hookParams);
|
|
1062
|
-
else
|
|
1062
|
+
else await runAgentEndSideEffectsAsync(hookParams);
|
|
1063
1063
|
return result;
|
|
1064
1064
|
}
|
|
1065
1065
|
async function deferBackgroundCompactionCleanup(params) {
|
|
@@ -1382,7 +1382,7 @@ async function createCopilotToolBridge(input) {
|
|
|
1382
1382
|
promptToolPolicy: EMPTY_PROMPT_TOOL_POLICY,
|
|
1383
1383
|
sourceTools: []
|
|
1384
1384
|
};
|
|
1385
|
-
const toolSurfaceRuntime =
|
|
1385
|
+
const toolSurfaceRuntime = await createAgentHarnessToolSurfaceRuntimeAsync({
|
|
1386
1386
|
abortSignal: attemptParams.abortSignal,
|
|
1387
1387
|
agentId: input.agentId,
|
|
1388
1388
|
config: attemptParams.config,
|
|
@@ -1407,7 +1407,7 @@ async function createCopilotToolBridge(input) {
|
|
|
1407
1407
|
toolsAllow: attemptParams.toolsAllow,
|
|
1408
1408
|
trigger: attemptParams.trigger
|
|
1409
1409
|
});
|
|
1410
|
-
const toolOptions = buildOpenClawCodingToolsOptions(input, {
|
|
1410
|
+
const toolOptions = await buildOpenClawCodingToolsOptions(input, {
|
|
1411
1411
|
...toolPlan,
|
|
1412
1412
|
runtimeToolAllowlist: toolSurfaceRuntime.runtimeToolAllowlist
|
|
1413
1413
|
}, toolSurfaceRuntime);
|
|
@@ -1471,7 +1471,7 @@ async function createCopilotToolBridge(input) {
|
|
|
1471
1471
|
* attempt context and prepared sandbox/construction policy to enforce access.
|
|
1472
1472
|
* Missing fields here silently weaken or misapply the native harness contract.
|
|
1473
1473
|
*/
|
|
1474
|
-
function buildOpenClawCodingToolsOptions(input, toolPlan, toolSurfaceRuntime) {
|
|
1474
|
+
async function buildOpenClawCodingToolsOptions(input, toolPlan, toolSurfaceRuntime) {
|
|
1475
1475
|
const a = input.attemptParams;
|
|
1476
1476
|
const sandboxSessionKey = a.sandboxSessionKey?.trim() || a.sessionKey?.trim() || input.sessionId;
|
|
1477
1477
|
const liveSessionKey = a.sessionKey;
|
|
@@ -1523,7 +1523,7 @@ function buildOpenClawCodingToolsOptions(input, toolPlan, toolSurfaceRuntime) {
|
|
|
1523
1523
|
modelApi: model?.api,
|
|
1524
1524
|
modelContextWindowTokens: a.contextTokenBudget ?? model?.contextWindow,
|
|
1525
1525
|
delegationCapability: a.delegationCapability,
|
|
1526
|
-
modelAuthMode:
|
|
1526
|
+
modelAuthMode: await resolveModelAuthModeAsync(input.modelProvider, a.config, a.toolAuthProfileStore ?? a.authProfileStore, { workspaceDir }),
|
|
1527
1527
|
modelHasVision,
|
|
1528
1528
|
requireExplicitMessageTarget: a.requireExplicitMessageTarget ?? isSubagentSessionKey(liveSessionKey),
|
|
1529
1529
|
disableMessageTool: a.disableMessageTool,
|
|
@@ -2359,7 +2359,7 @@ function createAttemptTranscriptJournal(params) {
|
|
|
2359
2359
|
if (!firstFailure && pendingTools) captureFailure(/* @__PURE__ */ new Error(`Copilot transcript reached ${boundary} with unresolved tool results: ${pendingTools.order.join(", ")}`));
|
|
2360
2360
|
if (abortPromise) await abortPromise;
|
|
2361
2361
|
if (firstFailure) {
|
|
2362
|
-
const error = new Error(`[copilot-attempt]
|
|
2362
|
+
const error = new Error(`[copilot-attempt] saved transcript persistence failed: ${firstFailure.message}`, { cause: firstFailure });
|
|
2363
2363
|
error.code = "transcript_persistence_failed";
|
|
2364
2364
|
throw error;
|
|
2365
2365
|
}
|
|
@@ -2559,7 +2559,7 @@ function resolveTranscriptTarget(attempt) {
|
|
|
2559
2559
|
const sessionKey = normalizeOptionalString(attempt.sessionTarget?.sessionKey);
|
|
2560
2560
|
const storePath = normalizeOptionalString(attempt.sessionTarget?.storePath);
|
|
2561
2561
|
if (!sessionId || !sessionKey || !storePath) {
|
|
2562
|
-
const error = /* @__PURE__ */ new Error("[copilot-attempt]
|
|
2562
|
+
const error = /* @__PURE__ */ new Error("[copilot-attempt] saved transcript persistence requires an exact runtime session target");
|
|
2563
2563
|
error.code = "transcript_persistence_failed";
|
|
2564
2564
|
throw error;
|
|
2565
2565
|
}
|
|
@@ -2789,7 +2789,7 @@ async function runCopilotExecution(context) {
|
|
|
2789
2789
|
}
|
|
2790
2790
|
sessionRef.current = session;
|
|
2791
2791
|
sdkSessionId = readNonEmptyString(session.sessionId) ?? readNonEmptyString(session.id) ?? (resumeFailureRecovered ? void 0 : resumeSessionId);
|
|
2792
|
-
if (!sdkSessionId) throw createPromptError("transcript_persistence_failed", "[copilot-attempt]
|
|
2792
|
+
if (!sdkSessionId) throw createPromptError("transcript_persistence_failed", "[copilot-attempt] saved transcript persistence requires the Copilot SDK session id");
|
|
2793
2793
|
if (deps.onSessionEstablished && !settledToolFinalization) try {
|
|
2794
2794
|
await deps.onSessionEstablished({
|
|
2795
2795
|
compactionSessionConfig,
|
|
@@ -784,7 +784,7 @@ function createCopilotAgentHarness(options) {
|
|
|
784
784
|
async function getPool() {
|
|
785
785
|
if (options?.pool) return options.pool;
|
|
786
786
|
if (!poolPromise) poolPromise = (async () => {
|
|
787
|
-
const { createCopilotClientPool } = await import("./runtime-
|
|
787
|
+
const { createCopilotClientPool } = await import("./runtime-C0R_TFVt.mjs");
|
|
788
788
|
createdPool = createCopilotClientPool(options?.poolOptions);
|
|
789
789
|
return createdPool;
|
|
790
790
|
})();
|
|
@@ -821,7 +821,7 @@ function createCopilotAgentHarness(options) {
|
|
|
821
821
|
async function runHarnessAttempt(params, operation) {
|
|
822
822
|
return trackOperation(async () => {
|
|
823
823
|
if (disposed) throw new Error("[copilot] harness has been disposed; cannot start new attempts");
|
|
824
|
-
const { resolvePoolAcquire, runCopilotAttempt } = await import("./attempt-
|
|
824
|
+
const { resolvePoolAcquire, runCopilotAttempt } = await import("./attempt-Ca9ft09-.mjs");
|
|
825
825
|
if (disposed) throw new Error("[copilot] harness was disposed while starting an attempt");
|
|
826
826
|
const pool = await getPool();
|
|
827
827
|
if (disposed) throw new Error("[copilot] harness was disposed while starting an attempt");
|
|
@@ -934,7 +934,7 @@ function createCopilotAgentHarness(options) {
|
|
|
934
934
|
async function runIsolatedCompletionV2(params) {
|
|
935
935
|
return trackOperation(async () => {
|
|
936
936
|
if (disposed) throw new Error("[copilot] harness has been disposed; cannot start isolated completion");
|
|
937
|
-
const { runCopilotIsolatedCompletion } = await import("./isolated-completion-
|
|
937
|
+
const { runCopilotIsolatedCompletion } = await import("./isolated-completion-zufhizl0.mjs");
|
|
938
938
|
if (disposed) throw new Error("[copilot] harness was disposed while starting isolated completion");
|
|
939
939
|
return await runCopilotIsolatedCompletion(params, async () => {
|
|
940
940
|
const pool = await getPool();
|
|
@@ -1027,7 +1027,7 @@ function createCopilotAgentHarness(options) {
|
|
|
1027
1027
|
if (await bindingQueue.enqueue(openclawSessionId, () => hasPendingDeferredCompactionCleanup(openclawSessionId))) return failedCompaction("background-compaction-pending");
|
|
1028
1028
|
const tracked = trackedSessions.get(openclawSessionId);
|
|
1029
1029
|
const currentCompactKey = computeCompactRequestKey(params);
|
|
1030
|
-
const { resolvePoolAcquire } = await import("./attempt-
|
|
1030
|
+
const { resolvePoolAcquire } = await import("./attempt-Ca9ft09-.mjs");
|
|
1031
1031
|
let resolvedPoolAcquire;
|
|
1032
1032
|
try {
|
|
1033
1033
|
resolvedPoolAcquire = resolvePoolAcquire(params);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as createCopilotByokProxy, c as tokenFingerprint, n as resolveCopilotProvider, r as createCopilotAbortError } from "./harness-
|
|
1
|
+
import { a as createCopilotByokProxy, c as tokenFingerprint, n as resolveCopilotProvider, r as createCopilotAbortError } from "./harness-B_eHdd0o.mjs";
|
|
2
2
|
import { r as createCopilotIsolatedSessionRestrictions, t as buildCopilotAssistantUsage } from "./usage-bridge--rLPdCvV.mjs";
|
|
3
3
|
import { asNonArrayRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { resolve } from "node:path";
|
|
@@ -92,179 +92,88 @@ function createCopilotClientPool(options = {}) {
|
|
|
92
92
|
const idleTtlMs = options.idleTtlMs ?? DEFAULT_IDLE_TTL_MS;
|
|
93
93
|
const entries = /* @__PURE__ */ new Map();
|
|
94
94
|
const releasedHandles = /* @__PURE__ */ new WeakSet();
|
|
95
|
-
let disposed = false;
|
|
96
95
|
let disposePromise;
|
|
97
|
-
let disposeCompleted = false;
|
|
98
96
|
const createDisposedError = () => /* @__PURE__ */ new Error(POOL_DISPOSED_MESSAGE);
|
|
99
97
|
const maybeDeleteEntry = (entry) => {
|
|
100
98
|
if (entries.get(entry.cacheKey) === entry) entries.delete(entry.cacheKey);
|
|
101
99
|
};
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
104
|
-
|
|
100
|
+
const stopEntry = (entry) => {
|
|
101
|
+
if (entry.stopping) return entry.stopping;
|
|
102
|
+
clearTimeout(entry.idleTimer);
|
|
103
|
+
entry.stopping = (async () => {
|
|
105
104
|
try {
|
|
106
|
-
return await client.stop();
|
|
105
|
+
return await (await entry.client).stop();
|
|
107
106
|
} catch (error) {
|
|
108
107
|
return [toStringifiedError(error)];
|
|
109
108
|
} finally {
|
|
110
|
-
entry.state = { kind: "stopped" };
|
|
111
109
|
maybeDeleteEntry(entry);
|
|
112
110
|
}
|
|
113
111
|
})();
|
|
114
|
-
entry.
|
|
115
|
-
kind: "stopping",
|
|
116
|
-
client,
|
|
117
|
-
promise: stopPromise
|
|
118
|
-
};
|
|
119
|
-
return stopPromise;
|
|
120
|
-
};
|
|
121
|
-
const stopEntry = async (entry) => {
|
|
122
|
-
switch (entry.state.kind) {
|
|
123
|
-
case "creating":
|
|
124
|
-
try {
|
|
125
|
-
await entry.state.promise;
|
|
126
|
-
} catch (error) {
|
|
127
|
-
maybeDeleteEntry(entry);
|
|
128
|
-
return [toStringifiedError(error)];
|
|
129
|
-
}
|
|
130
|
-
return stopEntry(entry);
|
|
131
|
-
case "ready": return stopReadyOrIdleEntry(entry, entry.state.client);
|
|
132
|
-
case "idle": return stopReadyOrIdleEntry(entry, entry.state.client, entry.state.idleTimer);
|
|
133
|
-
case "stopping": return entry.state.promise;
|
|
134
|
-
case "stopped": return [];
|
|
135
|
-
default: return entry.state;
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
const scheduleIdleStop = (entry, client) => {
|
|
139
|
-
entry.state = {
|
|
140
|
-
kind: "idle",
|
|
141
|
-
client,
|
|
142
|
-
idleTimer: setTimeout(() => {
|
|
143
|
-
stopEntry(entry);
|
|
144
|
-
}, idleTtlMs)
|
|
145
|
-
};
|
|
112
|
+
return entry.stopping;
|
|
146
113
|
};
|
|
147
114
|
const createEntry = (key, cacheKey, clientOptions) => {
|
|
148
|
-
const createPromise = Promise.resolve().then(async () => {
|
|
149
|
-
try {
|
|
150
|
-
const client = await sdkFactory(clientOptions);
|
|
151
|
-
entry.state = {
|
|
152
|
-
kind: "ready",
|
|
153
|
-
client
|
|
154
|
-
};
|
|
155
|
-
return client;
|
|
156
|
-
} catch (error) {
|
|
157
|
-
entry.state = { kind: "stopped" };
|
|
158
|
-
maybeDeleteEntry(entry);
|
|
159
|
-
throw toStringifiedError(error);
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
115
|
const entry = {
|
|
163
116
|
key,
|
|
164
117
|
cacheKey,
|
|
165
|
-
refCount:
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
118
|
+
refCount: 0,
|
|
119
|
+
client: Promise.resolve().then(async () => {
|
|
120
|
+
try {
|
|
121
|
+
return await sdkFactory(clientOptions);
|
|
122
|
+
} catch (error) {
|
|
123
|
+
maybeDeleteEntry(entry);
|
|
124
|
+
throw toStringifiedError(error);
|
|
125
|
+
}
|
|
126
|
+
})
|
|
170
127
|
};
|
|
171
128
|
entries.set(cacheKey, entry);
|
|
172
|
-
return
|
|
173
|
-
entry,
|
|
174
|
-
createPromise
|
|
175
|
-
};
|
|
129
|
+
return entry;
|
|
176
130
|
};
|
|
177
131
|
const acquire = async (inputKey, optionsForCreate) => {
|
|
178
132
|
const key = normalizePoolKey(inputKey, optionsForCreate.copilotHome, optionsForCreate.mode);
|
|
179
133
|
const cacheKey = JSON.stringify(key);
|
|
180
134
|
const clientOptions = normalizeClientCreateOptions(optionsForCreate, key.copilotHome);
|
|
181
135
|
while (true) {
|
|
182
|
-
if (
|
|
183
|
-
const
|
|
184
|
-
if (
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
if (disposed) {
|
|
188
|
-
await stopEntry(created.entry);
|
|
189
|
-
throw createDisposedError();
|
|
190
|
-
}
|
|
191
|
-
return {
|
|
192
|
-
key: created.entry.key,
|
|
193
|
-
client
|
|
194
|
-
};
|
|
136
|
+
if (disposePromise) throw createDisposedError();
|
|
137
|
+
const entry = entries.get(cacheKey) ?? createEntry(key, cacheKey, clientOptions);
|
|
138
|
+
if (entry.stopping) {
|
|
139
|
+
await entry.stopping;
|
|
140
|
+
continue;
|
|
195
141
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
throw createDisposedError();
|
|
203
|
-
}
|
|
204
|
-
return {
|
|
205
|
-
key: existing.key,
|
|
206
|
-
client
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
case "ready":
|
|
210
|
-
existing.refCount += 1;
|
|
211
|
-
return {
|
|
212
|
-
key: existing.key,
|
|
213
|
-
client: existing.state.client
|
|
214
|
-
};
|
|
215
|
-
case "idle": {
|
|
216
|
-
const client = existing.state.client;
|
|
217
|
-
clearTimeout(existing.state.idleTimer);
|
|
218
|
-
existing.refCount += 1;
|
|
219
|
-
existing.state = {
|
|
220
|
-
kind: "ready",
|
|
221
|
-
client
|
|
222
|
-
};
|
|
223
|
-
return {
|
|
224
|
-
key: existing.key,
|
|
225
|
-
client
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
case "stopping":
|
|
229
|
-
await existing.state.promise;
|
|
230
|
-
continue;
|
|
231
|
-
case "stopped":
|
|
232
|
-
maybeDeleteEntry(existing);
|
|
233
|
-
continue;
|
|
142
|
+
clearTimeout(entry.idleTimer);
|
|
143
|
+
entry.refCount += 1;
|
|
144
|
+
const client = await entry.client;
|
|
145
|
+
if (disposePromise) {
|
|
146
|
+
await stopEntry(entry);
|
|
147
|
+
throw createDisposedError();
|
|
234
148
|
}
|
|
149
|
+
return {
|
|
150
|
+
key: entry.key,
|
|
151
|
+
client
|
|
152
|
+
};
|
|
235
153
|
}
|
|
236
154
|
};
|
|
237
155
|
const release = async (handle) => {
|
|
238
156
|
if (releasedHandles.has(handle)) return;
|
|
239
157
|
releasedHandles.add(handle);
|
|
240
158
|
const entry = entries.get(JSON.stringify(handle.key));
|
|
241
|
-
if (!entry) return;
|
|
242
|
-
switch (entry.state.kind) {
|
|
243
|
-
case "creating":
|
|
244
|
-
case "stopping":
|
|
245
|
-
case "stopped": return;
|
|
246
|
-
case "ready":
|
|
247
|
-
case "idle": if (entry.state.client !== handle.client) return;
|
|
248
|
-
}
|
|
249
|
-
if (entry.refCount <= 0) return;
|
|
159
|
+
if (!entry || entry.stopping || await entry.client !== handle.client) return;
|
|
250
160
|
entry.refCount -= 1;
|
|
251
161
|
if (entry.refCount > 0) return;
|
|
252
|
-
if (
|
|
162
|
+
if (disposePromise) {
|
|
253
163
|
await stopEntry(entry);
|
|
254
164
|
return;
|
|
255
165
|
}
|
|
256
|
-
|
|
257
|
-
|
|
166
|
+
entry.idleTimer = setTimeout(() => {
|
|
167
|
+
stopEntry(entry);
|
|
168
|
+
}, idleTtlMs);
|
|
258
169
|
};
|
|
259
170
|
const dispose = async () => {
|
|
260
|
-
if (disposeCompleted) return [];
|
|
261
171
|
if (disposePromise) {
|
|
262
172
|
await disposePromise;
|
|
263
173
|
return [];
|
|
264
174
|
}
|
|
265
|
-
disposed = true;
|
|
266
175
|
const snapshot = [...entries.values()];
|
|
267
|
-
for (const entry of snapshot)
|
|
176
|
+
for (const entry of snapshot) clearTimeout(entry.idleTimer);
|
|
268
177
|
disposePromise = (async () => {
|
|
269
178
|
const errors = [];
|
|
270
179
|
for (const entry of snapshot) {
|
|
@@ -272,14 +181,9 @@ function createCopilotClientPool(options = {}) {
|
|
|
272
181
|
errors.push(...stopErrors);
|
|
273
182
|
}
|
|
274
183
|
entries.clear();
|
|
275
|
-
disposeCompleted = true;
|
|
276
184
|
return errors;
|
|
277
185
|
})();
|
|
278
|
-
|
|
279
|
-
return await disposePromise;
|
|
280
|
-
} finally {
|
|
281
|
-
disposePromise = void 0;
|
|
282
|
-
}
|
|
186
|
+
return await disposePromise;
|
|
283
187
|
};
|
|
284
188
|
return {
|
|
285
189
|
acquire,
|
package/dist/harness.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { createCopilotAgentHarness };
|
|
1
|
+
export { t as createCopilotAgentHarness } from "./.setup/harness-B_eHdd0o.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-B_eHdd0o.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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/copilot",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.10-beta.1",
|
|
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.10.
|
|
27
|
+
"pluginApi": ">=2026.10.10-beta.1"
|
|
28
28
|
},
|
|
29
29
|
"build": {
|
|
30
|
-
"openclawVersion": "2026.10.
|
|
30
|
+
"openclawVersion": "2026.10.10-beta.1",
|
|
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.10.
|
|
50
|
+
"openclaw": ">=2026.10.10-beta.1"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"openclaw": {
|