opencode-codex-memory 0.11.0 → 0.12.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.
@@ -0,0 +1,223 @@
1
+ import { activeMemoryWork, hasConsolidationLease, remaining } from "./panel-status.js";
2
+ import { modelRecoveryGuidance } from "../recovery-info.js";
3
+ import { MEMORY_NOTICE_KINDS } from "./status-rpc.js";
4
+ export const memoryHelp = {
5
+ models: { label: "Background model setup", path: "configuration.md#choose-background-models" },
6
+ providers: { label: "Open provider settings", path: null },
7
+ backup: { label: "Set up backup models", path: "configuration.md#backup-models" },
8
+ configuration: { label: "Memory configuration", path: "configuration.md#where-to-put-options" },
9
+ service: { label: "Check the OpenCode service", path: "troubleshooting.md#check-opencodes-server" },
10
+ troubleshooting: { label: "Troubleshooting", path: "troubleshooting.md#common-symptoms" },
11
+ codex: { label: "Codex import setup", path: "integrations.md#sharing-memory-with-the-codex-cli" },
12
+ };
13
+ export function memoryHelpURL(help) {
14
+ const page = memoryHelp[help].path;
15
+ return page === null ? null : `https://github.com/moritzfl/opencode-codex-memory/blob/main/docs/${page}`;
16
+ }
17
+ export const retryLabels = {
18
+ extraction: { action: "Retry extraction", result: "Extraction retry" },
19
+ consolidation: { action: "Retry consolidation", result: "Consolidation retry" },
20
+ };
21
+ const retryWaitMessages = {
22
+ retry: "A memory retry is already running. Wait for it to finish.",
23
+ consolidation: "A background memory update is running. You can retry when it finishes.",
24
+ extraction: "Memory is learning from sessions. You can retry when that finishes.",
25
+ };
26
+ function retryDescription(times, now) {
27
+ return times.every((time) => time > now)
28
+ ? `Automatic retry can run ${remaining(Math.min(...times), now)}, when there’s OpenCode activity.`
29
+ : "Automatic retry can run on the next OpenCode activity.";
30
+ }
31
+ function noticeMessage(kind, details, now, offersRetry, retryBlockedReason, supportsRetry, sessionID) {
32
+ const canRetry = offersRetry && !retryBlockedReason;
33
+ switch (kind) {
34
+ case "extraction_exhausted": {
35
+ const current = sessionID ? details.find((notice) => notice.sessionID === sessionID) : undefined;
36
+ const affected = current ?? details[0];
37
+ const recovery = modelRecoveryGuidance(details.filter((notice) => notice.sessionID === affected?.sessionID).map((notice) => notice.detail ?? ""), "extraction");
38
+ const conversation = current ? "this conversation" : "an affected conversation";
39
+ const nextStep = canRetry
40
+ ? "Retry a batch with the current background models. No new message is needed."
41
+ : offersRetry
42
+ ? undefined
43
+ : supportsRetry
44
+ ? "Wait for the provider limit to clear before retrying."
45
+ : `After fixing the issue, send a new message in ${conversation} and let it go idle.`;
46
+ return {
47
+ title: "Learning stopped for some sessions",
48
+ description: [recovery?.description ?? "Some conversations ran out of retries.", nextStep]
49
+ .filter(Boolean)
50
+ .join(" "),
51
+ help: recovery?.help ?? "troubleshooting",
52
+ warning: true,
53
+ affectedSessionID: current ? undefined : affected?.sessionID,
54
+ details,
55
+ };
56
+ }
57
+ case "extraction_retry":
58
+ case "consolidation_failed": {
59
+ const extraction = kind === "extraction_retry";
60
+ const phase = extraction ? "Extraction" : "Consolidation";
61
+ const recovery = modelRecoveryGuidance(details.map((notice) => notice.detail ?? ""), extraction ? "extraction" : "consolidation");
62
+ const times = details.map((notice) => notice.retryAt ?? 0);
63
+ const waiting = times.every((time) => time > now);
64
+ const retry = retryDescription(times, now);
65
+ return {
66
+ title: recovery || retryBlockedReason
67
+ ? `${phase} failed`
68
+ : waiting
69
+ ? `${phase} waiting to retry`
70
+ : `${phase} can retry`,
71
+ description: [
72
+ recovery?.description ??
73
+ (extraction ? "Learning from some sessions failed." : "The last memory update failed."),
74
+ offersRetry && retryBlockedReason ? "" : retry,
75
+ canRetry ? "You can retry now with the current models." : "",
76
+ ]
77
+ .filter(Boolean)
78
+ .join(" "),
79
+ help: recovery?.help ?? (extraction ? undefined : "troubleshooting"),
80
+ warning: !!recovery,
81
+ details,
82
+ };
83
+ }
84
+ case "provider_capacity":
85
+ return {
86
+ title: "Provider rate limit or quota",
87
+ description: details.every((notice) => (notice.retryAt ?? 0) > now)
88
+ ? retryDescription(details.map((notice) => notice.retryAt ?? 0), now)
89
+ : canRetry
90
+ ? "If the provider allows requests again, retry with the current background models."
91
+ : "Learning can resume when the provider allows requests again.",
92
+ help: "backup",
93
+ details,
94
+ };
95
+ case "configuration":
96
+ return {
97
+ title: "Check memory configuration",
98
+ description: "OpenCode ignored or adjusted some memory options. Correct the options listed below.",
99
+ help: "configuration",
100
+ warning: true,
101
+ details,
102
+ };
103
+ case "consolidator_setup":
104
+ return {
105
+ title: "Memory agent needs attention",
106
+ description: "Check for overrides of the memorize agent. Restore the plugin's default agent permissions.",
107
+ help: "troubleshooting",
108
+ warning: true,
109
+ details,
110
+ };
111
+ case "discovery":
112
+ return {
113
+ title: "Learning is limited to recent activity",
114
+ description: "Memory can only see conversations this server has observed. Check the OpenCode service to restore access to past sessions.",
115
+ help: "service",
116
+ warning: true,
117
+ details,
118
+ };
119
+ case "codex_import":
120
+ return {
121
+ title: "Codex import is blocked",
122
+ description: "Check the Codex home and memory paths. OpenCode can still learn from its own conversations.",
123
+ help: "codex",
124
+ warning: true,
125
+ details,
126
+ };
127
+ }
128
+ }
129
+ export function memoryMessages(status, now, sessionID) {
130
+ if (status.activity === "stopping")
131
+ return [{ title: "Memory is stopping", description: "Wait for OpenCode to reconnect." }];
132
+ const work = activeMemoryWork(status, now);
133
+ const retryBlockedReason = !status.generateMemories
134
+ ? "Turn on Learn from sessions to retry."
135
+ : work
136
+ ? retryWaitMessages[work]
137
+ : undefined;
138
+ const shownRetries = new Set();
139
+ const messages = MEMORY_NOTICE_KINDS.flatMap((kind) => {
140
+ const notices = status.notices?.filter((notice) => notice.kind === kind) ?? [];
141
+ if (!notices.length)
142
+ return [];
143
+ const retryPhases = [];
144
+ if (status.manualRetry !== undefined) {
145
+ for (const { retryPhase } of notices) {
146
+ if (!retryPhase || shownRetries.has(retryPhase))
147
+ continue;
148
+ retryPhases.push(retryPhase);
149
+ shownRetries.add(retryPhase);
150
+ }
151
+ }
152
+ const offersRetry = retryPhases.length > 0;
153
+ return [
154
+ {
155
+ ...noticeMessage(kind, notices, now, offersRetry, retryBlockedReason, status.manualRetry !== undefined, sessionID),
156
+ retryPhases,
157
+ retryBlockedReason: offersRetry ? retryBlockedReason : undefined,
158
+ },
159
+ ];
160
+ });
161
+ if (status.manualRetry?.state === "running")
162
+ return [{ title: `Retrying ${status.manualRetry.phase}…`, description: status.manualRetry.message }, ...messages];
163
+ if (status.generateMemories) {
164
+ const active = status.pipelines.filter((pipeline) => status.dualWrite || pipeline.version === status.version);
165
+ if (status.activity === "consolidating") {
166
+ messages.unshift({ title: "Consolidating memories", description: "Updating the memory files used for recall." });
167
+ }
168
+ else if (status.activity === "extracting") {
169
+ messages.unshift({
170
+ title: "Learning from sessions",
171
+ description: "Saving useful context from eligible conversations.",
172
+ });
173
+ }
174
+ else if (active.some((pipeline) => hasConsolidationLease(pipeline, now))) {
175
+ messages.unshift({
176
+ title: "Waiting for consolidation",
177
+ description: "A consolidation lock is active. Wait for the run to finish or for the lock to expire.",
178
+ });
179
+ }
180
+ if (messages.length)
181
+ return messages.sort((a, b) => Number(!!b.warning) - Number(!!a.warning));
182
+ if (status.notices === undefined && status.activity === "error")
183
+ return [
184
+ {
185
+ title: "Check memory status",
186
+ description: "See the reported warnings, or ask the agent to run memory_inspect for recent errors.",
187
+ warning: true,
188
+ help: "troubleshooting",
189
+ },
190
+ ];
191
+ if (status.notices === undefined && status.activity === "retrying")
192
+ return [
193
+ {
194
+ title: "Waiting to retry",
195
+ description: retryDescription([status.retryAt ?? 0], now),
196
+ },
197
+ ];
198
+ const queued = active.filter((pipeline) => pipeline.phase2Status === "pending");
199
+ if (queued.length) {
200
+ const cooldowns = queued.map((pipeline) => pipeline.phase2CooldownUntil ?? 0);
201
+ return [
202
+ {
203
+ title: "Consolidation queued",
204
+ description: cooldowns.every((time) => time > now)
205
+ ? `Cooldown ends ${remaining(Math.min(...cooldowns), now)}. OpenCode can update memory on activity after that.`
206
+ : "OpenCode can update memory on the next conversation activity or when a session goes idle.",
207
+ },
208
+ ];
209
+ }
210
+ return [
211
+ {
212
+ title: "Idle",
213
+ description: "OpenCode checks for eligible idle conversations on new activity.",
214
+ },
215
+ ];
216
+ }
217
+ return [
218
+ status.useMemories
219
+ ? { title: "Learning paused", description: "OpenCode can still use existing memories in conversations." }
220
+ : { title: "Memory is off", description: "Turn on recall or learning below." },
221
+ ...messages,
222
+ ];
223
+ }
@@ -9,14 +9,17 @@ export declare function watchMemoryStatus(read: (signal: AbortSignal) => Promise
9
9
  refresh: () => Promise<void>;
10
10
  signal: AbortSignal;
11
11
  };
12
- export declare function isMemoryRunning(status: MemoryStatus): boolean;
12
+ export declare function hasConsolidationLease(pipeline: MemoryStatus["pipelines"][number], now: number): boolean;
13
+ export declare function activeMemoryWork(status: MemoryStatus, now: number): "consolidation" | "extraction" | "retry" | undefined;
14
+ export declare function isMemoryRunning(status: MemoryStatus, now?: number): boolean;
15
+ export declare function elapsed(time: number, now: number): string;
16
+ export declare function remaining(time: number | null | undefined, now: number): string;
13
17
  export type StatusRow = {
14
18
  label: string;
15
19
  value: string;
16
20
  tone?: "ok" | "warn" | "muted";
17
21
  };
18
- export declare function statusRows(s: MemoryStatus, now: number, { includeReadinessDiagnostic }?: {
19
- includeReadinessDiagnostic?: boolean | undefined;
20
- }): StatusRow[];
22
+ export declare function diagnosticRows(s: MemoryStatus, now: number): StatusRow[];
23
+ export declare function statusRows(s: MemoryStatus, now: number): StatusRow[];
21
24
  export declare function usageRows(s: MemoryStatus, sessionID?: string): StatusRow[];
22
25
  export declare function configRows(s: MemoryStatus): StatusRow[];
@@ -50,12 +50,25 @@ export function watchMemoryStatus(read, subscribe) {
50
50
  void refresh();
51
51
  return { status, unavailable, refreshing, updatedAt, refresh, signal: lifetime.signal };
52
52
  }
53
- export function isMemoryRunning(status) {
54
- return (status.activity === "consolidating" ||
55
- status.activity === "extracting" ||
56
- status.pipelines.some((pipeline) => pipeline.extracting > 0 || pipeline.phase2Status === "running"));
53
+ export function hasConsolidationLease(pipeline, now) {
54
+ return pipeline.phase2Status === "running" && (pipeline.phase2LeaseUntil == null || pipeline.phase2LeaseUntil > now);
57
55
  }
58
- function elapsed(time, now) {
56
+ export function activeMemoryWork(status, now) {
57
+ if (status.manualRetry?.state === "running")
58
+ return "retry";
59
+ if (status.activity === "consolidating")
60
+ return "consolidation";
61
+ if (status.activity === "extracting")
62
+ return "extraction";
63
+ if (status.pipelines.some((pipeline) => hasConsolidationLease(pipeline, now)))
64
+ return "consolidation";
65
+ if (status.pipelines.some((pipeline) => pipeline.extracting > 0))
66
+ return "extraction";
67
+ }
68
+ export function isMemoryRunning(status, now = Date.now()) {
69
+ return activeMemoryWork(status, now) !== undefined;
70
+ }
71
+ export function elapsed(time, now) {
59
72
  const minutes = Math.max(0, Math.floor((now - time) / 60_000));
60
73
  if (minutes === 0)
61
74
  return "just now";
@@ -65,7 +78,7 @@ function elapsed(time, now) {
65
78
  return `${Math.floor(minutes / 60)}h ago`;
66
79
  return `${Math.floor(minutes / 1440)}d ago`;
67
80
  }
68
- function remaining(time, now) {
81
+ export function remaining(time, now) {
69
82
  if (time == null)
70
83
  return "—";
71
84
  const minutes = Math.max(0, Math.ceil((time - now) / 60_000));
@@ -107,7 +120,7 @@ function pipelineRows(s, now) {
107
120
  },
108
121
  {
109
122
  label: `${version} consolidation`,
110
- value: pipeline.phase2Status === "running"
123
+ value: hasConsolidationLease(pipeline, now)
111
124
  ? "Running"
112
125
  : paused
113
126
  ? "Paused"
@@ -117,7 +130,9 @@ function pipelineRows(s, now) {
117
130
  ? `${consolidation} · cooldown ends ${remaining(pipeline.phase2CooldownUntil, now)}`
118
131
  : pipeline.phase2Status === "pending"
119
132
  ? "Queued · next activity"
120
- : consolidation,
133
+ : pipeline.phase2Status === "running"
134
+ ? "Interrupted · next activity"
135
+ : consolidation,
121
136
  tone: pipeline.lastError ? "warn" : "muted",
122
137
  },
123
138
  ...(pipeline.lastError
@@ -126,9 +141,8 @@ function pipelineRows(s, now) {
126
141
  ];
127
142
  });
128
143
  }
129
- export function statusRows(s, now, { includeReadinessDiagnostic = true } = {}) {
144
+ export function diagnosticRows(s, now) {
130
145
  return [
131
- { label: "Activity", value: activityLabels[s.activity] },
132
146
  { label: "Memory version", value: `${s.sessionVersion} (default ${s.version})` },
133
147
  { label: "Learning pipelines", value: s.dualWrite ? "v1 + v2" : s.version },
134
148
  {
@@ -136,9 +150,7 @@ export function statusRows(s, now, { includeReadinessDiagnostic = true } = {}) {
136
150
  value: `${s.v2Ready ? "Ready" : "Not ready"} · ${s.v2ConsolidatedThreads}/${s.minConsolidatedThreads} sessions`,
137
151
  tone: s.v2Ready ? "ok" : "muted",
138
152
  },
139
- ...(includeReadinessDiagnostic && s.v2NotReadyReason
140
- ? [{ label: "V2 not ready", value: s.v2NotReadyReason, tone: "muted" }]
141
- : []),
153
+ ...(s.v2NotReadyReason ? [{ label: "V2 not ready", value: s.v2NotReadyReason, tone: "muted" }] : []),
142
154
  ...(s.v2SummaryBytes !== undefined
143
155
  ? [
144
156
  {
@@ -153,6 +165,12 @@ export function statusRows(s, now, { includeReadinessDiagnostic = true } = {}) {
153
165
  ]
154
166
  : []),
155
167
  ...pipelineRows(s, now),
168
+ ];
169
+ }
170
+ export function statusRows(s, now) {
171
+ return [
172
+ { label: "Activity", value: activityLabels[s.activity] },
173
+ ...diagnosticRows(s, now),
156
174
  { label: "Use memories", value: s.useMemories ? "On" : "Off", tone: s.useMemories ? "ok" : "muted" },
157
175
  {
158
176
  label: "Learn from sessions",
@@ -34,13 +34,15 @@ import { ensureV2Agents } from "./agents.js";
34
34
  import { buildV2Tools } from "./tools.js";
35
35
  import { performMemoryReset } from "../../tools/control.js";
36
36
  import { guardMemorySearchTools } from "./search-sandbox.js";
37
- import { MemoryStatusRpc } from "./status-rpc.js";
37
+ import { isMemoryRetryPhase, MemoryStatusRpc } from "./status-rpc.js";
38
38
  import { readMemoryStatus } from "./status.js";
39
+ import { clearMemoryRetryResult, memoryRetryStatus, onMemoryRetryChanged, requestMemoryRetry, waitForMemoryRetry, } from "../retry.js";
39
40
  import { recordInjection, resetInjectionStats } from "./injection.js";
40
41
  import { overlayV2CitationInstructions } from "./citation-overlay.js";
41
42
  import { estimateTokens } from "../token.js";
42
43
  const backgroundTasks = new Set();
43
44
  const statusListeners = new Set();
45
+ const RETRY_RESULT_LIFETIME_MS = 2 * 60_000;
44
46
  /**
45
47
  * The V2 host runs one plugin instance per location in the same process and
46
48
  * evicts idle locations independently. Process-wide state (lifecycle, shim
@@ -86,6 +88,7 @@ function trackBackgroundTask(task) {
86
88
  }
87
89
  /** Test seam: wait for hook-launched work to settle. */
88
90
  export async function waitForV2BackgroundTasks() {
91
+ await waitForMemoryRetry();
89
92
  while (backgroundTasks.size > 0) {
90
93
  await Promise.all([...backgroundTasks]);
91
94
  }
@@ -97,6 +100,7 @@ export function resetV2ModuleStateForTest() {
97
100
  clearTimeout(statusNotifyTimer);
98
101
  statusNotifyTimer = null;
99
102
  backgroundTasks.clear();
103
+ clearMemoryRetryResult();
100
104
  seenTurnSessions.clear();
101
105
  liveInstances.length = 0;
102
106
  activeConfig = undefined;
@@ -248,7 +252,10 @@ async function attach(ctx) {
248
252
  status: async (input) => {
249
253
  const sessionID = input?.sessionID;
250
254
  const minimum = input?.minConsolidatedThreads;
251
- return readMemoryStatus(typeof sessionID === "string" ? sessionID : null, minimum);
255
+ return {
256
+ ...readMemoryStatus(typeof sessionID === "string" ? sessionID : null, minimum),
257
+ manualRetry: memoryRetryStatus(RETRY_RESULT_LIFETIME_MS),
258
+ };
252
259
  },
253
260
  setOption: async (input) => {
254
261
  const { key, value } = (input ?? {});
@@ -301,11 +308,20 @@ async function attach(ctx) {
301
308
  return { ok: true };
302
309
  },
303
310
  consolidateNow: async () => {
311
+ if (memoryRetryStatus()?.state === "running")
312
+ return { status: "already_running", message: "A memory retry is in progress." };
304
313
  // Runs detached so the dialog does not block on a multi-minute turn.
305
314
  const run = consolidateNow();
306
315
  trackBackgroundTask(run.then(() => { }));
307
316
  return { status: "started" };
308
317
  },
318
+ retryFailed: async (input) => {
319
+ const phase = input?.phase;
320
+ if (!isMemoryRetryPhase(phase))
321
+ return { ok: false, message: "Choose extraction or consolidation to retry." };
322
+ const request = requestMemoryRetry(phase);
323
+ return request.ok ? { ok: true } : request;
324
+ },
309
325
  resetMemory: async (input) => {
310
326
  if (input?.confirm !== true)
311
327
  return { ok: false, message: "Reset not confirmed." };
@@ -440,6 +456,7 @@ async function attach(ctx) {
440
456
  console.warn("[opencode-codex-memory] orphaned phase2 sweep failed:", err);
441
457
  }
442
458
  statusListeners.add(publishStatus);
459
+ const unsubscribeRetry = onMemoryRetryChanged(publishStatus);
443
460
  // Event loop: execution.succeeded pumps phase 1 the way V1's idle events did.
444
461
  const eventAbort = new AbortController();
445
462
  void (async () => {
@@ -509,6 +526,7 @@ async function attach(ctx) {
509
526
  .finally(() => eventLoops.delete(eventAbort));
510
527
  eventLoops.add(eventAbort);
511
528
  return () => {
529
+ unsubscribeRetry();
512
530
  statusListeners.delete(publishStatus);
513
531
  eventAbort.abort();
514
532
  };
@@ -530,6 +548,7 @@ function releaseLocation(ctx) {
530
548
  draining = Promise.allSettled([abortActiveSubSessions(), waitForV2BackgroundTasks()]).then(() => {
531
549
  setSubSessionDirectory();
532
550
  setV2Context(null);
551
+ clearMemoryRetryResult();
533
552
  activeConfig = undefined;
534
553
  draining = undefined;
535
554
  invalidateCache();
@@ -6,6 +6,8 @@
6
6
  * `Rpc.define` is a runtime passthrough (validation only), so a plain object
7
7
  * with JSON Schema nodes is an equivalent portable definition.
8
8
  */
9
+ import { type MemoryNotice, type MemoryRetry, type MemoryRetryPhase } from "../recovery-info.js";
10
+ export { MEMORY_NOTICE_KINDS, type MemoryNotice, type MemoryRetry, type MemoryRetryPhase } from "../recovery-info.js";
9
11
  export declare const MEMORY_STATUS_ACTIVITIES: readonly ["idle", "extracting", "consolidating", "retrying", "error", "read_only", "disabled", "stopping"];
10
12
  export type MemoryStatusActivity = (typeof MEMORY_STATUS_ACTIVITIES)[number];
11
13
  export interface MemoryStatus {
@@ -31,6 +33,7 @@ export interface MemoryStatus {
31
33
  phase2CooldownUntil?: number | null;
32
34
  phase1RetryAt?: number | null;
33
35
  phase2RetryAt?: number | null;
36
+ phase2LeaseUntil?: number | null;
34
37
  }[];
35
38
  useMemories: boolean;
36
39
  generateMemories: boolean;
@@ -40,6 +43,10 @@ export interface MemoryStatus {
40
43
  lastSuccessAt: number | null;
41
44
  retryAt: number | null;
42
45
  warnings: string[];
46
+ /** Typed guidance inputs. Older servers only send warning strings. */
47
+ notices?: MemoryNotice[];
48
+ /** Null when no recent request; absent on servers without manual retry support. */
49
+ manualRetry?: MemoryRetry | null;
43
50
  /** Per-session read/write mode when a sessionID was supplied. */
44
51
  sessionMode: "enabled" | "disabled" | "polluted" | null;
45
52
  /** Root directory of the memory workspace. */
@@ -147,6 +154,9 @@ export declare const MemoryStatusRpc: {
147
154
  readonly phase2RetryAt: {
148
155
  readonly type: readonly ["number", "null"];
149
156
  };
157
+ readonly phase2LeaseUntil: {
158
+ readonly type: readonly ["number", "null"];
159
+ };
150
160
  };
151
161
  readonly required: readonly ["version", "stage1Count", "extracting", "phase2Status", "lastError"];
152
162
  readonly additionalProperties: false;
@@ -176,6 +186,59 @@ export declare const MemoryStatusRpc: {
176
186
  readonly type: "string";
177
187
  };
178
188
  };
189
+ readonly notices: {
190
+ readonly type: "array";
191
+ readonly items: {
192
+ readonly type: "object";
193
+ readonly properties: {
194
+ readonly kind: {
195
+ readonly type: "string";
196
+ readonly enum: readonly ["extraction_exhausted", "consolidator_setup", "configuration", "discovery", "codex_import", "consolidation_failed", "extraction_retry", "provider_capacity"];
197
+ };
198
+ readonly detail: {
199
+ readonly type: "string";
200
+ };
201
+ readonly version: {
202
+ readonly type: "string";
203
+ readonly enum: readonly ["v1", "v2"];
204
+ };
205
+ readonly phase: {
206
+ readonly type: "string";
207
+ readonly enum: readonly ["extraction", "consolidation"];
208
+ };
209
+ readonly sessionID: {
210
+ readonly type: "string";
211
+ };
212
+ readonly retryAt: {
213
+ readonly type: "number";
214
+ };
215
+ readonly retryPhase: {
216
+ readonly type: "string";
217
+ readonly enum: readonly ["extraction", "consolidation"];
218
+ };
219
+ };
220
+ readonly required: readonly ["kind"];
221
+ readonly additionalProperties: false;
222
+ };
223
+ };
224
+ readonly manualRetry: {
225
+ readonly type: readonly ["object", "null"];
226
+ readonly properties: {
227
+ readonly phase: {
228
+ readonly type: "string";
229
+ readonly enum: readonly ["extraction", "consolidation"];
230
+ };
231
+ readonly state: {
232
+ readonly type: "string";
233
+ readonly enum: readonly ["running", "completed", "blocked", "failed"];
234
+ };
235
+ readonly message: {
236
+ readonly type: "string";
237
+ };
238
+ };
239
+ readonly required: readonly ["phase", "state", "message"];
240
+ readonly additionalProperties: false;
241
+ };
179
242
  readonly sessionMode: {
180
243
  readonly type: readonly ["string", "null"];
181
244
  readonly enum: readonly ["enabled", "disabled", "polluted", null];
@@ -274,11 +337,41 @@ export declare const MemoryStatusRpc: {
274
337
  readonly status: {
275
338
  readonly type: "string";
276
339
  };
340
+ readonly message: {
341
+ readonly type: "string";
342
+ };
277
343
  };
278
344
  readonly required: readonly ["status"];
279
345
  readonly additionalProperties: false;
280
346
  };
281
347
  };
348
+ /** Try failed work with current options. Progress and outcome appear in status. */
349
+ readonly retryFailed: {
350
+ readonly input: {
351
+ readonly type: "object";
352
+ readonly properties: {
353
+ readonly phase: {
354
+ readonly type: "string";
355
+ readonly enum: readonly ["extraction", "consolidation"];
356
+ };
357
+ };
358
+ readonly required: readonly ["phase"];
359
+ readonly additionalProperties: false;
360
+ };
361
+ readonly output: {
362
+ readonly type: "object";
363
+ readonly properties: {
364
+ readonly ok: {
365
+ readonly type: "boolean";
366
+ };
367
+ readonly message: {
368
+ readonly type: "string";
369
+ };
370
+ };
371
+ readonly required: readonly ["ok"];
372
+ readonly additionalProperties: false;
373
+ };
374
+ };
282
375
  /** Same wipe as the V1 memory_reset tool; the panel's confirm step is the approval. */
283
376
  readonly resetMemory: {
284
377
  readonly input: {
@@ -316,6 +409,7 @@ export declare const MemoryStatusRpc: {
316
409
  };
317
410
  };
318
411
  };
412
+ export declare function isMemoryRetryPhase(value: unknown): value is MemoryRetryPhase;
319
413
  /** Runtime guard for the untyped RPC client result (no zod in the TUI bundle). */
320
414
  export declare function isMemoryStatus(value: unknown): value is MemoryStatus;
321
415
  /** Throwing parser for tests and call sites that want a typed value. */