@openclaw/copilot 2026.10.5 → 2026.10.7

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.
@@ -1,4 +1,4 @@
1
- import { a as createCopilotByokProxy, i as createPromptError, n as resolveCopilotProvider, o as createCopilotByokAuth, s as resolveCopilotAuth } from "./harness-CAJKYXN0.mjs";
1
+ import { a as createCopilotByokProxy, i as createPromptError, n as resolveCopilotProvider, o as createCopilotByokAuth, s as resolveCopilotAuth } from "./harness-BEMig-PH.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
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, resolveModelAuthMode, resolveSandboxContext, resolveUserPath, restorePreparedUserTurnOperationalMetaForRuntime, runAgentEndSideEffects, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessGatewayQuestion, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, sanitizeToolResult, setActiveEmbeddedRun } from "openclaw/plugin-sdk/agent-harness-runtime";
@@ -1214,6 +1214,10 @@ async function waitForPersistenceReceipt(receipt, requestedTimeoutMs) {
1214
1214
  }
1215
1215
  //#endregion
1216
1216
  //#region extensions/copilot/src/attempt-transcript-replay.ts
1217
+ function readIdempotencyKey(message) {
1218
+ const key = "idempotencyKey" in message ? message.idempotencyKey : void 0;
1219
+ return typeof key === "string" && key ? key : void 0;
1220
+ }
1217
1221
  function userText(content) {
1218
1222
  if (typeof content === "string") return content;
1219
1223
  if (Array.isArray(content) && content.length === 1) {
@@ -2159,6 +2163,27 @@ async function createCopilotSessionSetup(params) {
2159
2163
  };
2160
2164
  }
2161
2165
  //#endregion
2166
+ //#region extensions/copilot/src/attempt-transcript-memory.ts
2167
+ function findInMemoryMessage(manager, message) {
2168
+ const key = readIdempotencyKey(message);
2169
+ if (!key) return;
2170
+ for (const entry of manager.getEntries()) if (entry.type === "message" && readIdempotencyKey(entry.message) === key) return {
2171
+ appended: false,
2172
+ message: entry.message,
2173
+ messageId: entry.id
2174
+ };
2175
+ }
2176
+ async function appendInMemoryMessage(manager, message) {
2177
+ const previous = findInMemoryMessage(manager, message);
2178
+ if (previous) return previous;
2179
+ const result = await manager.appendMessageWithTranscriptAnchorAsync(message);
2180
+ return {
2181
+ appended: result.appended,
2182
+ message: result.message,
2183
+ messageId: result.entryId
2184
+ };
2185
+ }
2186
+ //#endregion
2162
2187
  //#region extensions/copilot/src/attempt-transcript-journal.ts
2163
2188
  function readTurnTaintMetadata(message) {
2164
2189
  const metadata = message["__openclaw"];
@@ -2207,7 +2232,18 @@ function createAttemptTranscriptJournal(params) {
2207
2232
  };
2208
2233
  const currentUser = params.attempt.userTurnTranscriptRecorder?.message;
2209
2234
  if (currentUser) replaceTailUser(currentUser, projectDisplay(currentUser));
2210
- const target = resolveTranscriptTarget(params.attempt);
2235
+ const manager = params.attempt.sessionManager;
2236
+ const owner = manager && !manager.getSessionTarget() ? {
2237
+ kind: "memory",
2238
+ manager,
2239
+ sessionId: manager.getSessionId()
2240
+ } : {
2241
+ kind: "durable",
2242
+ target: resolveTranscriptTarget(params.attempt)
2243
+ };
2244
+ const assertMemoryOwnerCurrent = () => {
2245
+ if (owner.kind === "memory" && (owner.manager.getSessionTarget() || owner.manager.getSessionId() !== owner.sessionId)) throw new Error("Copilot caller-owned transcript changed during attempt");
2246
+ };
2211
2247
  const config = params.attempt.config;
2212
2248
  const seenEventIds = /* @__PURE__ */ new Set();
2213
2249
  const deferredUserWrites = [];
@@ -2249,12 +2285,13 @@ function createAttemptTranscriptJournal(params) {
2249
2285
  queue = queue.then(() => firstFailure ? void 0 : task()).catch(captureFailure);
2250
2286
  };
2251
2287
  const prepare = (write, options = {}) => {
2288
+ assertMemoryOwnerCurrent();
2252
2289
  const message = structuredClone(write.message);
2253
2290
  const originalReplayPayload = projectReplayPayload(message);
2254
2291
  const hooked = runAgentHarnessBeforeMessageWriteHook({
2255
2292
  message: structuredClone(message),
2256
- agentId: target.agentId,
2257
- sessionKey: target.sessionKey,
2293
+ agentId: owner.kind === "durable" ? owner.target.agentId : params.attempt.agentId,
2294
+ sessionKey: owner.kind === "durable" ? owner.target.sessionKey : params.attempt.sessionKey,
2258
2295
  prepareAssistantTranscriptMessage: options.singleton && !hiddenTurn ? params.attempt.prepareAssistantTranscriptMessage : void 0
2259
2296
  });
2260
2297
  if (!hooked) return;
@@ -2283,33 +2320,59 @@ function createAttemptTranscriptJournal(params) {
2283
2320
  return options.singleton && !isCompatibleSingletonRewrite(message, prepared) ? void 0 : prepared;
2284
2321
  };
2285
2322
  const append = async (write) => {
2286
- const outcome = await appendSessionTranscriptMessageByIdentityStrict({
2287
- ...target,
2288
- ...config ? { config } : {},
2289
- ...write.eventId ? { eventId: write.eventId } : {},
2290
- idempotencyLookup: "scan",
2291
- message: write.message,
2292
- preparation: { prepareMessage: async () => prepare(write, { singleton: true }) }
2293
- });
2294
- if (outcome.kind === "suppressed") {
2295
- write.recorder?.markBlocked();
2296
- return;
2323
+ let result;
2324
+ if (owner.kind === "memory") {
2325
+ assertMemoryOwnerCurrent();
2326
+ const previous = findInMemoryMessage(owner.manager, write.message);
2327
+ const message = previous?.message ?? prepare(write, { singleton: true });
2328
+ if (!message) {
2329
+ write.recorder?.markBlocked();
2330
+ return;
2331
+ }
2332
+ assertMemoryOwnerCurrent();
2333
+ result = previous ?? await appendInMemoryMessage(owner.manager, message);
2334
+ assertMemoryOwnerCurrent();
2335
+ } else {
2336
+ const outcome = await appendSessionTranscriptMessageByIdentityStrict({
2337
+ ...owner.target,
2338
+ ...config ? { config } : {},
2339
+ ...write.eventId ? { eventId: write.eventId } : {},
2340
+ idempotencyLookup: "scan",
2341
+ message: write.message,
2342
+ preparation: { prepareMessage: async () => prepare(write, { singleton: true }) }
2343
+ });
2344
+ if (outcome.kind === "suppressed") {
2345
+ write.recorder?.markBlocked();
2346
+ return;
2347
+ }
2348
+ if (outcome.kind === "rejected") throw new Error("Transcript session changed before singleton append");
2349
+ result = outcome.result;
2297
2350
  }
2298
- if (outcome.kind === "rejected") throw new Error("Transcript session changed before singleton append");
2299
- if (!isDeepStrictEqual(projectReplayPayload(write.message), projectReplayPayload(outcome.result.message))) replayInvalid = true;
2300
- if (outcome.result.message.role === "user") write.recorder?.markRuntimePersisted(outcome.result.message, outcome.result.anchor, { appended: outcome.result.appended });
2301
- return outcome.result;
2351
+ if (!isDeepStrictEqual(projectReplayPayload(write.message), projectReplayPayload(result.message))) replayInvalid = true;
2352
+ if (result.message.role === "user") write.recorder?.markRuntimePersisted(result.message, result.anchor, { appended: result.appended });
2353
+ return result;
2302
2354
  };
2303
2355
  const appendToolGroup = async (group) => {
2356
+ assertMemoryOwnerCurrent();
2304
2357
  const writes = [group.assistant, ...group.order.map((id) => group.results.get(id))];
2305
2358
  const keys = writes.map((write) => readIdempotencyKey(write.message));
2306
- const persistedKeys = new Set((await readVisibleSessionTranscriptMessageEntries(target)).flatMap((entry) => entry.idempotencyKey ? [entry.idempotencyKey] : []));
2359
+ const persistedKeys = owner.kind === "memory" ? new Set(owner.manager.getEntries().flatMap((entry) => {
2360
+ const key = entry.type === "message" ? readIdempotencyKey(entry.message) : void 0;
2361
+ return key ? [key] : [];
2362
+ })) : new Set((await readVisibleSessionTranscriptMessageEntries(owner.target)).flatMap((entry) => entry.idempotencyKey ? [entry.idempotencyKey] : []));
2307
2363
  const persistedCount = keys.filter((key) => key && persistedKeys.has(key)).length;
2308
2364
  if (persistedCount > 0 && persistedCount < writes.length) throw new Error("Copilot transcript found a partial persisted tool group");
2309
2365
  const messages = persistedCount === writes.length ? writes.map((write) => write.message) : writes.map((write) => prepare(write));
2310
2366
  if (messages.some((message) => !message) || !isCompleteToolGroup(messages, group.order)) return;
2311
- const results = await appendSessionTranscriptMessagesByIdentity({
2312
- ...target,
2367
+ let results;
2368
+ if (owner.kind === "memory") {
2369
+ assertMemoryOwnerCurrent();
2370
+ const staged = await owner.manager.prepareTranscriptRewriteAsync();
2371
+ results = [];
2372
+ for (const message of messages) results.push(await appendInMemoryMessage(staged.sessionManager, message));
2373
+ await staged.commit(/* @__PURE__ */ new Map());
2374
+ } else results = await appendSessionTranscriptMessagesByIdentity({
2375
+ ...owner.target,
2313
2376
  ...config ? { config } : {},
2314
2377
  messages: writes.map((write, index) => ({
2315
2378
  eventId: write.eventId,
@@ -2322,7 +2385,7 @@ function createAttemptTranscriptJournal(params) {
2322
2385
  return results;
2323
2386
  };
2324
2387
  const publish = async (appended) => {
2325
- if (appended) await publishSessionTranscriptUpdateByIdentity({ ...target }).catch((error) => {
2388
+ if (appended && owner.kind === "durable") await publishSessionTranscriptUpdateByIdentity({ ...owner.target }).catch((error) => {
2326
2389
  console.warn("[copilot-attempt] transcript update notification failed", error);
2327
2390
  });
2328
2391
  };
@@ -2571,10 +2634,6 @@ function resolveTranscriptTarget(attempt) {
2571
2634
  ...agentId ? { agentId } : {}
2572
2635
  };
2573
2636
  }
2574
- function readIdempotencyKey(message) {
2575
- const key = message.idempotencyKey;
2576
- return typeof key === "string" && key ? key : void 0;
2577
- }
2578
2637
  function isCurrentJournalIdentity(key, params) {
2579
2638
  return key === `${params.attempt.runId}:user` || key.startsWith(`copilot-sdk:${params.sdkSessionId}:`);
2580
2639
  }
@@ -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-BTNvSiix.mjs");
824
+ const { resolvePoolAcquire, runCopilotAttempt } = await import("./attempt-DyGAUcyd.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");
@@ -832,7 +832,7 @@ function createCopilotAgentHarness(options) {
832
832
  if (operation === "attempt" && isCopilotByokUnsupportedProviderError(error)) return runCopilotAttempt(params, { pool });
833
833
  throw error;
834
834
  }
835
- const openclawSessionId = typeof params.sessionId === "string" ? params.sessionId : void 0;
835
+ const openclawSessionId = params.sessionPersistence === "detached" || typeof params.sessionId !== "string" ? void 0 : params.sessionId;
836
836
  const currentCompatKey = computeSessionCompatKey(params);
837
837
  const currentCompactKey = computeAttemptCompactKey(params);
838
838
  const resumableBinding = openclawSessionId ? await bindingQueue.enqueue(openclawSessionId, async () => {
@@ -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-DWrGtYCY.mjs");
937
+ const { runCopilotIsolatedCompletion } = await import("./isolated-completion-DbEdfimQ.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-BTNvSiix.mjs");
1030
+ const { resolvePoolAcquire } = await import("./attempt-DyGAUcyd.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-CAJKYXN0.mjs";
1
+ import { a as createCopilotByokProxy, c as tokenFingerprint, n as resolveCopilotProvider, r as createCopilotAbortError } from "./harness-BEMig-PH.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";
package/dist/harness.js CHANGED
@@ -1 +1 @@
1
- export { t as createCopilotAgentHarness } from "./.setup/harness-CAJKYXN0.mjs";
1
+ export { t as createCopilotAgentHarness } from "./.setup/harness-BEMig-PH.mjs";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createCopilotAgentHarness } from "./.setup/harness-CAJKYXN0.mjs";
1
+ import { t as createCopilotAgentHarness } from "./.setup/harness-BEMig-PH.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.5",
3
+ "version": "2026.10.7",
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.5"
27
+ "pluginApi": ">=2026.10.7"
28
28
  },
29
29
  "build": {
30
- "openclawVersion": "2026.10.5",
30
+ "openclawVersion": "2026.10.7",
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.5"
50
+ "openclaw": ">=2026.10.7"
51
51
  },
52
52
  "peerDependenciesMeta": {
53
53
  "openclaw": {