opencode-codex-memory 0.12.0 → 0.13.0

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,5 @@
1
1
  import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import { type MemoryRetryPhase, type MemoryRetryRequest } from "../src/recovery-info.js";
2
3
  /**
3
4
  * Shared by the memory_reset tool (after user approval) and the OpenCode 2
4
5
  * memory panel (whose confirmation is the approval).
@@ -10,4 +11,5 @@ export declare function performMemoryReset(): {
10
11
  export declare const memory_reset: ToolDefinition;
11
12
  export declare const memory_inspect: ToolDefinition;
12
13
  export declare const memory_mode: ToolDefinition;
14
+ export declare function makeMemoryRetryTool(start?: (phase: MemoryRetryPhase, sessionID?: string, all?: boolean) => MemoryRetryRequest): ToolDefinition;
13
15
  export declare const memory_retry: ToolDefinition;
@@ -17,7 +17,7 @@ import { activeProviderCapacityBackoffs } from "../src/ratelimit.js";
17
17
  import { readMigrationStatus, memoryPipelineSnapshots } from "../src/migration.js";
18
18
  import { peekSessionMemoryVersion } from "../src/session-version.js";
19
19
  import { withMemoryVersion, writeMemoryVersions } from "../src/memory-version.js";
20
- import { MEMORY_RETRY_PHASES, modelRecoveryGuidance } from "../src/recovery-info.js";
20
+ import { MEMORY_RETRY_PHASES, modelRecoveryGuidance, retryResultText, } from "../src/recovery-info.js";
21
21
  import { recoveryNotices } from "../src/recovery-status.js";
22
22
  import { clearMemoryRetryResult, memoryRetryBlockedReason, memoryRetryStatus, requestMemoryRetry, } from "../src/retry.js";
23
23
  function isSymlinkedRoot() {
@@ -279,7 +279,11 @@ function inspectRecovery(writers, now) {
279
279
  : MEMORY_RETRY_PHASES.filter((phase) => notices.some((notice) => notice.retryPhase === phase));
280
280
  const lines = [
281
281
  "Recovery:",
282
- ...(latest ? [` Latest ${latest.phase} retry (${latest.state}): ${latest.message}`] : []),
282
+ ...(latest
283
+ ? [
284
+ ` Latest ${latest.action === "update" ? "memory update" : `${latest.phase} retry`} (${latest.state}): ${retryResultText(latest)}`,
285
+ ]
286
+ : []),
283
287
  ...notices.map(({ phase, kind, version, detail, sessionID, retryAt }) => {
284
288
  const label = `${phase ?? "memory"}${version ? ` (${version})` : ""}${sessionID ? ` for ${sessionID}` : ""}`;
285
289
  const error = kind === "provider_capacity"
@@ -545,21 +549,34 @@ export const memory_mode = tool({
545
549
  }
546
550
  },
547
551
  });
548
- export const memory_retry = tool({
549
- description: "On the user's explicit request, retry failed memory extraction or consolidation once with current background models. " +
550
- "This runs only the selected phase and returns its outcome. It skips ordinary failure delays but respects provider " +
551
- "rate limits, active work, learning settings, and session eligibility. Use memory_inspect to diagnose failures or " +
552
- "check the latest outcome. Do not keep retrying after a failure or blocked result.",
553
- args: {
554
- phase: tool.schema.enum(MEMORY_RETRY_PHASES).describe("Retry failed session extraction or a failed memory update."),
555
- },
556
- async execute({ phase }, ctx) {
557
- ctx.abort?.throwIfAborted();
558
- const request = requestMemoryRetry(phase, ctx.sessionID);
559
- const retry = request.ok ? await request.completion : { phase, state: "blocked", message: request.message };
560
- return {
561
- output: `Memory ${retry.phase} retry (${retry.state}): ${retry.message}`,
562
- metadata: { retry },
563
- };
564
- },
565
- });
552
+ export function makeMemoryRetryTool(start) {
553
+ return tool({
554
+ description: "On the user's explicit request, retry failed memory extraction or consolidation with current background models. " +
555
+ (start ? "Set all=true only when the user asks to retry all eligible extraction failures. " : "") +
556
+ "This runs only the selected phase and returns its outcome. It skips ordinary failure delays but respects provider " +
557
+ "rate limits, active work, learning settings, and session eligibility. Use memory_inspect to diagnose failures or " +
558
+ "check the latest outcome. Do not keep retrying after a failure or blocked result.",
559
+ args: {
560
+ phase: tool.schema
561
+ .enum(MEMORY_RETRY_PHASES)
562
+ .describe("Retry failed session extraction or a failed memory update."),
563
+ ...(start
564
+ ? { all: tool.schema.boolean().optional().describe("For extraction, retry each eligible failed job once.") }
565
+ : {}),
566
+ },
567
+ async execute({ phase, all }, ctx) {
568
+ ctx.abort?.throwIfAborted();
569
+ if (all && phase !== "extraction")
570
+ return { output: "Retry all is only available for extraction." };
571
+ const request = start ? start(phase, ctx.sessionID, all === true) : requestMemoryRetry(phase, ctx.sessionID);
572
+ const retry = request.ok
573
+ ? await request.completion
574
+ : { phase, state: "blocked", message: request.message };
575
+ return {
576
+ output: `Memory ${retry.phase} retry (${retry.state}): ${start ? retryResultText(retry) : retry.message}`,
577
+ metadata: { retry },
578
+ };
579
+ },
580
+ });
581
+ }
582
+ export const memory_retry = makeMemoryRetryTool();
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "opencode-codex-memory",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
+ "packageManager": "bun@1.4.4",
4
5
  "description": "Persistent memory plugin for opencode — ports codex's two-phase memory system (extraction → consolidation → injection → citation feedback)",
5
6
  "type": "module",
6
7
  "main": "./dist/src/index.js",
@@ -44,7 +45,7 @@
44
45
  },
45
46
  "scripts": {
46
47
  "dev": "bun --watch src/index.ts",
47
- "build": "rm -rf dist && tsc && bun scripts/build-tui.ts && bun scripts/build-gui.ts && cp -R src/templates dist/src/templates && cp opencode.json dist/opencode.json",
48
+ "build": "bun scripts/build.ts",
48
49
  "smoke": "bun scripts/smoke.ts",
49
50
  "contract": "bun scripts/check-opencode-contract.ts",
50
51
  "contract:v2": "bun scripts/check-opencode2-contract.ts",
@@ -109,6 +110,6 @@
109
110
  }
110
111
  },
111
112
  "engines": {
112
- "bun": ">=1.1.0"
113
+ "bun": ">=1.3.14"
113
114
  }
114
115
  }