opencode-codex-memory 0.10.3 → 0.12.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.
- package/README.md +7 -4
- package/dist/gui-experimental.cjs +1 -0
- package/dist/src/capture.d.ts +2 -2
- package/dist/src/capture.js +4 -4
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.js +7 -2
- package/dist/src/phase1.d.ts +11 -1
- package/dist/src/phase1.js +37 -21
- package/dist/src/phase2.d.ts +2 -0
- package/dist/src/phase2.js +1 -1
- package/dist/src/pipeline.d.ts +4 -1
- package/dist/src/pipeline.js +42 -25
- package/dist/src/recovery-info.d.ts +30 -0
- package/dist/src/recovery-info.js +33 -0
- package/dist/src/recovery-status.d.ts +10 -0
- package/dist/src/recovery-status.js +54 -0
- package/dist/src/retry.d.ts +14 -0
- package/dist/src/retry.js +147 -0
- package/dist/src/store.d.ts +11 -3
- package/dist/src/store.js +72 -17
- package/dist/src/v2/gui.d.ts +4 -0
- package/dist/src/v2/panel-messages.d.ts +52 -0
- package/dist/src/v2/panel-messages.js +198 -0
- package/dist/src/v2/panel-status.d.ts +24 -0
- package/dist/src/v2/panel-status.js +212 -0
- package/dist/src/v2/plugin.js +21 -2
- package/dist/src/v2/status-rpc.d.ts +95 -1
- package/dist/src/v2/status-rpc.js +71 -3
- package/dist/src/v2/status.js +50 -28
- package/dist/src/v2/tools.js +3 -2
- package/dist/src/v2/tui.js +707 -266
- package/dist/tools/control.d.ts +1 -0
- package/dist/tools/control.js +81 -4
- package/package.json +12 -9
package/dist/src/v2/tui.js
CHANGED
|
@@ -11,7 +11,42 @@ import { createElement as _$createElement } from "@opentui/solid";
|
|
|
11
11
|
import { createComponent as _$createComponent } from "@opentui/solid";
|
|
12
12
|
import { Plugin } from "@opencode/plugin/tui";
|
|
13
13
|
import { useTerminalDimensions } from "@opentui/solid";
|
|
14
|
-
import {
|
|
14
|
+
import { createMemo, createSignal as createSignal2, For, Index } from "solid-js";
|
|
15
|
+
|
|
16
|
+
// src/recovery-info.ts
|
|
17
|
+
var MEMORY_RETRY_PHASES = ["extraction", "consolidation"];
|
|
18
|
+
var MEMORY_RETRY_STATES = ["running", "completed", "blocked", "failed"];
|
|
19
|
+
var MEMORY_NOTICE_KINDS = [
|
|
20
|
+
"extraction_exhausted",
|
|
21
|
+
"consolidator_setup",
|
|
22
|
+
"configuration",
|
|
23
|
+
"discovery",
|
|
24
|
+
"codex_import",
|
|
25
|
+
"consolidation_failed",
|
|
26
|
+
"extraction_retry",
|
|
27
|
+
"provider_capacity"
|
|
28
|
+
];
|
|
29
|
+
function modelRecoveryGuidance(errors, phase) {
|
|
30
|
+
const setting = phase === "extraction" ? "extract_model" : "consolidation_model";
|
|
31
|
+
if (errors.some((error) => /"statusCode"\s*:\s*401\b|\bunauthorized\b|invalid api key/i.test(error))) {
|
|
32
|
+
return {
|
|
33
|
+
description: "The provider rejected authentication. Reconnect the background model\u2019s provider in OpenCode.",
|
|
34
|
+
help: "providers"
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
if (errors.some((error) => /model (?:unavailable|not found)|ModelNotFoundError|no supported model is available/i.test(error))) {
|
|
38
|
+
return {
|
|
39
|
+
description: `A background model was unavailable. Check ${setting} and choose a model available in OpenCode.`,
|
|
40
|
+
help: "models"
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (errors.some((error) => /^prompt failed: .*"statusCode"\s*:\s*404\b/.test(error))) {
|
|
44
|
+
return {
|
|
45
|
+
description: `A model request returned HTTP 404. Check ${setting} and its provider in OpenCode.`,
|
|
46
|
+
help: "models"
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
15
50
|
|
|
16
51
|
// src/v2/status-rpc.ts
|
|
17
52
|
var MEMORY_STATUS_ACTIVITIES = [
|
|
@@ -35,6 +70,7 @@ var INJECTED_SCHEMA = {
|
|
|
35
70
|
required: ["sessionTokens", "sessionRequests", "totalTokens", "totalRequests"],
|
|
36
71
|
additionalProperties: false
|
|
37
72
|
};
|
|
73
|
+
var RETRY_PHASE_SCHEMA = { type: "string", enum: [...MEMORY_RETRY_PHASES] };
|
|
38
74
|
var MemoryStatusRpc = {
|
|
39
75
|
id: "opencode-codex-memory",
|
|
40
76
|
methods: {
|
|
@@ -73,7 +109,8 @@ var MemoryStatusRpc = {
|
|
|
73
109
|
lastError: { type: ["string", "null"] },
|
|
74
110
|
phase2CooldownUntil: { type: ["number", "null"] },
|
|
75
111
|
phase1RetryAt: { type: ["number", "null"] },
|
|
76
|
-
phase2RetryAt: { type: ["number", "null"] }
|
|
112
|
+
phase2RetryAt: { type: ["number", "null"] },
|
|
113
|
+
phase2LeaseUntil: { type: ["number", "null"] }
|
|
77
114
|
},
|
|
78
115
|
required: ["version", "stage1Count", "extracting", "phase2Status", "lastError"],
|
|
79
116
|
additionalProperties: false
|
|
@@ -86,6 +123,33 @@ var MemoryStatusRpc = {
|
|
|
86
123
|
lastSuccessAt: { type: ["number", "null"] },
|
|
87
124
|
retryAt: { type: ["number", "null"] },
|
|
88
125
|
warnings: { type: "array", items: { type: "string" } },
|
|
126
|
+
notices: {
|
|
127
|
+
type: "array",
|
|
128
|
+
items: {
|
|
129
|
+
type: "object",
|
|
130
|
+
properties: {
|
|
131
|
+
kind: { type: "string", enum: [...MEMORY_NOTICE_KINDS] },
|
|
132
|
+
detail: { type: "string" },
|
|
133
|
+
version: { type: "string", enum: ["v1", "v2"] },
|
|
134
|
+
phase: RETRY_PHASE_SCHEMA,
|
|
135
|
+
sessionID: { type: "string" },
|
|
136
|
+
retryAt: { type: "number" },
|
|
137
|
+
retryPhase: RETRY_PHASE_SCHEMA
|
|
138
|
+
},
|
|
139
|
+
required: ["kind"],
|
|
140
|
+
additionalProperties: false
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
manualRetry: {
|
|
144
|
+
type: ["object", "null"],
|
|
145
|
+
properties: {
|
|
146
|
+
phase: RETRY_PHASE_SCHEMA,
|
|
147
|
+
state: { type: "string", enum: [...MEMORY_RETRY_STATES] },
|
|
148
|
+
message: { type: "string" }
|
|
149
|
+
},
|
|
150
|
+
required: ["phase", "state", "message"],
|
|
151
|
+
additionalProperties: false
|
|
152
|
+
},
|
|
89
153
|
sessionMode: { type: ["string", "null"], enum: ["enabled", "disabled", "polluted", null] },
|
|
90
154
|
memoryRoot: { type: "string" },
|
|
91
155
|
injected: INJECTED_SCHEMA
|
|
@@ -152,11 +216,25 @@ var MemoryStatusRpc = {
|
|
|
152
216
|
input: { type: "object", properties: {}, additionalProperties: false },
|
|
153
217
|
output: {
|
|
154
218
|
type: "object",
|
|
155
|
-
properties: { status: { type: "string" } },
|
|
219
|
+
properties: { status: { type: "string" }, message: { type: "string" } },
|
|
156
220
|
required: ["status"],
|
|
157
221
|
additionalProperties: false
|
|
158
222
|
}
|
|
159
223
|
},
|
|
224
|
+
retryFailed: {
|
|
225
|
+
input: {
|
|
226
|
+
type: "object",
|
|
227
|
+
properties: { phase: RETRY_PHASE_SCHEMA },
|
|
228
|
+
required: ["phase"],
|
|
229
|
+
additionalProperties: false
|
|
230
|
+
},
|
|
231
|
+
output: {
|
|
232
|
+
type: "object",
|
|
233
|
+
properties: { ok: { type: "boolean" }, message: { type: "string" } },
|
|
234
|
+
required: ["ok"],
|
|
235
|
+
additionalProperties: false
|
|
236
|
+
}
|
|
237
|
+
},
|
|
160
238
|
resetMemory: {
|
|
161
239
|
input: {
|
|
162
240
|
type: "object",
|
|
@@ -179,6 +257,9 @@ var MemoryStatusRpc = {
|
|
|
179
257
|
function isRecord(value) {
|
|
180
258
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
181
259
|
}
|
|
260
|
+
function isMemoryRetryPhase(value) {
|
|
261
|
+
return value === "extraction" || value === "consolidation";
|
|
262
|
+
}
|
|
182
263
|
function isMemoryStatus(value) {
|
|
183
264
|
if (!isRecord(value))
|
|
184
265
|
return false;
|
|
@@ -205,7 +286,7 @@ function isMemoryStatus(value) {
|
|
|
205
286
|
return false;
|
|
206
287
|
if (!Number.isInteger(value.minConsolidatedThreads) || value.minConsolidatedThreads < 1 || value.minConsolidatedThreads > 4096)
|
|
207
288
|
return false;
|
|
208
|
-
if (!Array.isArray(value.pipelines) || !value.pipelines.every((pipeline) => isRecord(pipeline) && (pipeline.version === "v1" || pipeline.version === "v2") && Number.isInteger(pipeline.stage1Count) && pipeline.stage1Count >= 0 && Number.isInteger(pipeline.extracting) && pipeline.extracting >= 0 && (pipeline.phase2Status === null || typeof pipeline.phase2Status === "string") && (pipeline.lastError === null || typeof pipeline.lastError === "string") && ["phase2CooldownUntil", "phase1RetryAt", "phase2RetryAt"].every((key) => pipeline[key] === undefined || pipeline[key] === null || typeof pipeline[key] === "number" && Number.isFinite(pipeline[key]))))
|
|
289
|
+
if (!Array.isArray(value.pipelines) || !value.pipelines.every((pipeline) => isRecord(pipeline) && (pipeline.version === "v1" || pipeline.version === "v2") && Number.isInteger(pipeline.stage1Count) && pipeline.stage1Count >= 0 && Number.isInteger(pipeline.extracting) && pipeline.extracting >= 0 && (pipeline.phase2Status === null || typeof pipeline.phase2Status === "string") && (pipeline.lastError === null || typeof pipeline.lastError === "string") && ["phase2CooldownUntil", "phase1RetryAt", "phase2RetryAt", "phase2LeaseUntil"].every((key) => pipeline[key] === undefined || pipeline[key] === null || typeof pipeline[key] === "number" && Number.isFinite(pipeline[key]))))
|
|
209
290
|
return false;
|
|
210
291
|
for (const key of ["extractModel", "consolidationModel", "lastSuccessAt", "retryAt"]) {
|
|
211
292
|
const v = value[key];
|
|
@@ -216,6 +297,11 @@ function isMemoryStatus(value) {
|
|
|
216
297
|
if (!Array.isArray(value.warnings) || !value.warnings.every((w) => typeof w === "string")) {
|
|
217
298
|
return false;
|
|
218
299
|
}
|
|
300
|
+
if (value.notices !== undefined && (!Array.isArray(value.notices) || !value.notices.every((notice) => isRecord(notice) && typeof notice.kind === "string" && MEMORY_NOTICE_KINDS.includes(notice.kind) && (notice.version === undefined || notice.version === "v1" || notice.version === "v2") && (notice.phase === undefined || isMemoryRetryPhase(notice.phase)) && (notice.detail === undefined || typeof notice.detail === "string") && (notice.sessionID === undefined || typeof notice.sessionID === "string") && (notice.retryPhase === undefined || isMemoryRetryPhase(notice.retryPhase)) && (notice.retryAt === undefined || typeof notice.retryAt === "number" && Number.isFinite(notice.retryAt)))))
|
|
301
|
+
return false;
|
|
302
|
+
const retry = value.manualRetry;
|
|
303
|
+
if (retry != null && (!isRecord(retry) || !isMemoryRetryPhase(retry.phase) || typeof retry.message !== "string" || !MEMORY_RETRY_STATES.includes(retry.state)))
|
|
304
|
+
return false;
|
|
219
305
|
if (value.sessionMode !== null && value.sessionMode !== "enabled" && value.sessionMode !== "disabled" && value.sessionMode !== "polluted") {
|
|
220
306
|
return false;
|
|
221
307
|
}
|
|
@@ -231,8 +317,9 @@ function isMemoryStatus(value) {
|
|
|
231
317
|
return true;
|
|
232
318
|
}
|
|
233
319
|
|
|
234
|
-
// src/v2/
|
|
235
|
-
|
|
320
|
+
// src/v2/panel-status.ts
|
|
321
|
+
import { createSignal, onCleanup } from "solid-js";
|
|
322
|
+
var activityLabels = {
|
|
236
323
|
idle: "Idle",
|
|
237
324
|
extracting: "Extracting",
|
|
238
325
|
consolidating: "Consolidating",
|
|
@@ -242,9 +329,50 @@ var labels = {
|
|
|
242
329
|
disabled: "Disabled",
|
|
243
330
|
stopping: "Stopping"
|
|
244
331
|
};
|
|
332
|
+
function watchMemoryStatus(read, subscribe) {
|
|
333
|
+
const [status, setStatus] = createSignal(null);
|
|
334
|
+
const [unavailable, setUnavailable] = createSignal(false);
|
|
335
|
+
const [refreshing, setRefreshing] = createSignal(false);
|
|
336
|
+
const [updatedAt, setUpdatedAt] = createSignal(Date.now());
|
|
337
|
+
const lifetime = new AbortController;
|
|
338
|
+
let revision = 0;
|
|
339
|
+
const refresh = async () => {
|
|
340
|
+
const request = ++revision;
|
|
341
|
+
setRefreshing(true);
|
|
342
|
+
try {
|
|
343
|
+
const next = await read(AbortSignal.any([lifetime.signal, AbortSignal.timeout(5000)]));
|
|
344
|
+
if (lifetime.signal.aborted || request !== revision)
|
|
345
|
+
return;
|
|
346
|
+
if (!isMemoryStatus(next))
|
|
347
|
+
throw new Error("invalid memory status payload");
|
|
348
|
+
setStatus(next);
|
|
349
|
+
setUpdatedAt(Date.now());
|
|
350
|
+
setUnavailable(false);
|
|
351
|
+
} catch {
|
|
352
|
+
if (!lifetime.signal.aborted && request === revision)
|
|
353
|
+
setUnavailable(true);
|
|
354
|
+
} finally {
|
|
355
|
+
if (!lifetime.signal.aborted && request === revision)
|
|
356
|
+
setRefreshing(false);
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
const unsubscribe = subscribe(() => void refresh());
|
|
360
|
+
const timer = setInterval(() => void refresh(), 30000);
|
|
361
|
+
onCleanup(() => {
|
|
362
|
+
lifetime.abort();
|
|
363
|
+
clearInterval(timer);
|
|
364
|
+
unsubscribe();
|
|
365
|
+
});
|
|
366
|
+
refresh();
|
|
367
|
+
return { status, unavailable, refreshing, updatedAt, refresh, signal: lifetime.signal };
|
|
368
|
+
}
|
|
369
|
+
function hasConsolidationLease(pipeline, now) {
|
|
370
|
+
return pipeline.phase2Status === "running" && (pipeline.phase2LeaseUntil == null || pipeline.phase2LeaseUntil > now);
|
|
371
|
+
}
|
|
372
|
+
function isMemoryRunning(status, now = Date.now()) {
|
|
373
|
+
return status.manualRetry?.state === "running" || status.activity === "consolidating" || status.activity === "extracting" || status.pipelines.some((pipeline) => pipeline.extracting > 0 || hasConsolidationLease(pipeline, now));
|
|
374
|
+
}
|
|
245
375
|
function elapsed(time, now) {
|
|
246
|
-
if (time == null)
|
|
247
|
-
return "\u2014";
|
|
248
376
|
const minutes = Math.max(0, Math.floor((now - time) / 60000));
|
|
249
377
|
if (minutes === 0)
|
|
250
378
|
return "just now";
|
|
@@ -266,6 +394,275 @@ function remaining(time, now) {
|
|
|
266
394
|
return `in ${Math.floor(minutes / 60)}h ${minutes % 60}m`;
|
|
267
395
|
return `in ${Math.floor(minutes / 1440)}d`;
|
|
268
396
|
}
|
|
397
|
+
function formatTokens(n) {
|
|
398
|
+
if (n >= 1e6)
|
|
399
|
+
return `${(n / 1e6).toFixed(1)}M`;
|
|
400
|
+
if (n >= 1000)
|
|
401
|
+
return `${(n / 1000).toFixed(1)}K`;
|
|
402
|
+
return String(n);
|
|
403
|
+
}
|
|
404
|
+
function pipelineRows(s, now) {
|
|
405
|
+
return s.pipelines.flatMap((pipeline) => {
|
|
406
|
+
const version = pipeline.version.toUpperCase();
|
|
407
|
+
const paused = !s.generateMemories || !s.dualWrite && pipeline.version !== s.version;
|
|
408
|
+
const extractionRetry = pipeline.phase1RetryAt != null && pipeline.phase1RetryAt > now;
|
|
409
|
+
const consolidationRetry = pipeline.phase2RetryAt != null && pipeline.phase2RetryAt > now;
|
|
410
|
+
const cooldown = pipeline.phase2CooldownUntil != null && pipeline.phase2CooldownUntil > now;
|
|
411
|
+
const consolidation = pipeline.phase2Status === "pending" ? "Queued" : pipeline.phase2Status === "failed" ? "Retry due" : "Idle";
|
|
412
|
+
return [
|
|
413
|
+
{ label: `${version} recaps`, value: `${pipeline.stage1Count} stored`, tone: "muted" },
|
|
414
|
+
{
|
|
415
|
+
label: `${version} extraction`,
|
|
416
|
+
value: pipeline.extracting ? `Running (${pipeline.extracting})` : paused ? "Paused" : extractionRetry ? `Retry ${remaining(pipeline.phase1RetryAt, now)}` : "Idle",
|
|
417
|
+
tone: extractionRetry && !paused ? "warn" : "muted"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
label: `${version} consolidation`,
|
|
421
|
+
value: hasConsolidationLease(pipeline, now) ? "Running" : paused ? "Paused" : consolidationRetry ? `Retry ${remaining(pipeline.phase2RetryAt, now)}` : cooldown ? `${consolidation} \xB7 cooldown ends ${remaining(pipeline.phase2CooldownUntil, now)}` : pipeline.phase2Status === "pending" ? "Queued \xB7 next activity" : pipeline.phase2Status === "running" ? "Interrupted \xB7 next activity" : consolidation,
|
|
422
|
+
tone: pipeline.lastError ? "warn" : "muted"
|
|
423
|
+
},
|
|
424
|
+
...pipeline.lastError ? [{ label: `${version} last error`, value: pipeline.lastError, tone: "warn" }] : []
|
|
425
|
+
];
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
function diagnosticRows(s, now) {
|
|
429
|
+
return [
|
|
430
|
+
{ label: "Memory version", value: `${s.sessionVersion} (default ${s.version})` },
|
|
431
|
+
{ label: "Learning pipelines", value: s.dualWrite ? "v1 + v2" : s.version },
|
|
432
|
+
{
|
|
433
|
+
label: "V2 readiness",
|
|
434
|
+
value: `${s.v2Ready ? "Ready" : "Not ready"} \xB7 ${s.v2ConsolidatedThreads}/${s.minConsolidatedThreads} sessions`,
|
|
435
|
+
tone: s.v2Ready ? "ok" : "muted"
|
|
436
|
+
},
|
|
437
|
+
...s.v2NotReadyReason ? [{ label: "V2 not ready", value: s.v2NotReadyReason, tone: "muted" }] : [],
|
|
438
|
+
...s.v2SummaryBytes !== undefined ? [
|
|
439
|
+
{
|
|
440
|
+
label: "V2 summary",
|
|
441
|
+
value: s.v2SummaryBytes === null ? "Unreadable" : s.v2InjectedSummaryBytes != null ? `${s.v2SummaryBytes} bytes on disk \xB7 ${s.v2InjectedSummaryBytes} injected${s.v2SummaryBytes >= 1e4 ? " (capped)" : ""}` : `${s.v2SummaryBytes} UTF-8 bytes`,
|
|
442
|
+
tone: "muted"
|
|
443
|
+
}
|
|
444
|
+
] : [],
|
|
445
|
+
...pipelineRows(s, now)
|
|
446
|
+
];
|
|
447
|
+
}
|
|
448
|
+
function statusRows(s, now) {
|
|
449
|
+
return [
|
|
450
|
+
{ label: "Activity", value: activityLabels[s.activity] },
|
|
451
|
+
...diagnosticRows(s, now),
|
|
452
|
+
{ label: "Use memories", value: s.useMemories ? "On" : "Off", tone: s.useMemories ? "ok" : "muted" },
|
|
453
|
+
{
|
|
454
|
+
label: "Learn from sessions",
|
|
455
|
+
value: s.generateMemories ? "On" : "Off",
|
|
456
|
+
tone: s.generateMemories ? "ok" : "muted"
|
|
457
|
+
},
|
|
458
|
+
...s.sessionMode ? [
|
|
459
|
+
{
|
|
460
|
+
label: "This session",
|
|
461
|
+
value: s.sessionMode === "enabled" ? s.generateMemories ? "Eligible for learning" : "Eligible (learning paused)" : s.sessionMode === "disabled" ? "Not learning" : "Excluded (external context)",
|
|
462
|
+
tone: s.sessionMode === "enabled" && s.generateMemories ? "ok" : "muted"
|
|
463
|
+
}
|
|
464
|
+
] : [],
|
|
465
|
+
{ label: "Last consolidated", value: s.lastSuccessAt == null ? "Never" : elapsed(s.lastSuccessAt, now) },
|
|
466
|
+
...s.retryAt == null ? [] : [{ label: "Next retry", value: remaining(s.retryAt, now), tone: "warn" }]
|
|
467
|
+
];
|
|
468
|
+
}
|
|
469
|
+
function usageRows(s, sessionID) {
|
|
470
|
+
const inj = s.injected;
|
|
471
|
+
const per = inj.sessionRequests > 0 ? Math.round(inj.sessionTokens / inj.sessionRequests) : inj.totalRequests > 0 ? Math.round(inj.totalTokens / inj.totalRequests) : 0;
|
|
472
|
+
return [
|
|
473
|
+
{ label: "Block size", value: per ? `~${formatTokens(per)} tokens / request` : "\u2014" },
|
|
474
|
+
...sessionID ? [{ label: "This session", value: `~${formatTokens(inj.sessionTokens)} tokens \xB7 ${inj.sessionRequests} req` }] : [],
|
|
475
|
+
{ label: "Since start", value: `~${formatTokens(inj.totalTokens)} tokens \xB7 ${inj.totalRequests} req` }
|
|
476
|
+
];
|
|
477
|
+
}
|
|
478
|
+
function configRows(s) {
|
|
479
|
+
return [
|
|
480
|
+
{ label: "Extraction", value: s.extractModel ?? "Host default" },
|
|
481
|
+
{ label: "Consolidation", value: s.consolidationModel ?? "Host default" },
|
|
482
|
+
{ label: "Codex import", value: s.codexImport ? "On" : "Off", tone: s.codexImport ? "ok" : "muted" },
|
|
483
|
+
{ label: "Location", value: s.memoryRoot }
|
|
484
|
+
];
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
// src/v2/panel-messages.ts
|
|
488
|
+
var memoryHelp = {
|
|
489
|
+
models: { label: "Background model setup", path: "configuration.md#choose-background-models" },
|
|
490
|
+
providers: { label: "Open provider settings", path: null },
|
|
491
|
+
backup: { label: "Set up backup models", path: "configuration.md#backup-models" },
|
|
492
|
+
configuration: { label: "Memory configuration", path: "configuration.md#where-to-put-options" },
|
|
493
|
+
service: { label: "Check the OpenCode service", path: "troubleshooting.md#check-opencodes-server" },
|
|
494
|
+
troubleshooting: { label: "Troubleshooting", path: "troubleshooting.md#common-symptoms" },
|
|
495
|
+
codex: { label: "Codex import setup", path: "integrations.md#sharing-memory-with-the-codex-cli" }
|
|
496
|
+
};
|
|
497
|
+
function memoryHelpURL(help) {
|
|
498
|
+
const page = memoryHelp[help].path;
|
|
499
|
+
return page === null ? null : `https://github.com/moritzfl/opencode-codex-memory/blob/main/docs/${page}`;
|
|
500
|
+
}
|
|
501
|
+
var retryLabels = {
|
|
502
|
+
extraction: { action: "Retry extraction", result: "Extraction retry" },
|
|
503
|
+
consolidation: { action: "Retry consolidation", result: "Consolidation retry" }
|
|
504
|
+
};
|
|
505
|
+
function retryDescription(times, now) {
|
|
506
|
+
return times.every((time) => time > now) ? `Automatic retry can run ${remaining(Math.min(...times), now)}, when there\u2019s OpenCode activity.` : "Automatic retry can run on the next OpenCode activity.";
|
|
507
|
+
}
|
|
508
|
+
function noticeMessage(kind, details, now, retryPhases, supportsRetry, sessionID) {
|
|
509
|
+
switch (kind) {
|
|
510
|
+
case "extraction_exhausted": {
|
|
511
|
+
const current = sessionID ? details.find((notice) => notice.sessionID === sessionID) : undefined;
|
|
512
|
+
const affected = current ?? details[0];
|
|
513
|
+
const recovery = modelRecoveryGuidance(details.filter((notice) => notice.sessionID === affected?.sessionID).map((notice) => notice.detail ?? ""), "extraction");
|
|
514
|
+
const conversation = current ? "this conversation" : "an affected conversation";
|
|
515
|
+
const nextStep = retryPhases.length ? "Retry a batch with the current background models. No new message is needed." : supportsRetry ? "Wait for the provider limit to clear before retrying." : `After fixing the issue, send a new message in ${conversation} and let it go idle.`;
|
|
516
|
+
return {
|
|
517
|
+
title: "Learning stopped for some sessions",
|
|
518
|
+
description: `${recovery?.description ?? "Some conversations ran out of retries."} ${nextStep}`,
|
|
519
|
+
help: recovery?.help ?? "troubleshooting",
|
|
520
|
+
warning: true,
|
|
521
|
+
affectedSessionID: current ? undefined : affected?.sessionID,
|
|
522
|
+
details
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
case "extraction_retry":
|
|
526
|
+
case "consolidation_failed": {
|
|
527
|
+
const extraction = kind === "extraction_retry";
|
|
528
|
+
const phase = extraction ? "Extraction" : "Consolidation";
|
|
529
|
+
const recovery = modelRecoveryGuidance(details.map((notice) => notice.detail ?? ""), extraction ? "extraction" : "consolidation");
|
|
530
|
+
const times = details.map((notice) => notice.retryAt ?? 0);
|
|
531
|
+
const waiting = times.every((time) => time > now);
|
|
532
|
+
const retry = retryDescription(times, now);
|
|
533
|
+
return {
|
|
534
|
+
title: recovery ? `${phase} failed` : waiting ? `${phase} waiting to retry` : `${phase} can retry`,
|
|
535
|
+
description: [
|
|
536
|
+
recovery?.description ?? (extraction ? "Learning from some sessions failed." : "The last memory update failed."),
|
|
537
|
+
retry,
|
|
538
|
+
retryPhases.length ? "You can retry now with the current models." : ""
|
|
539
|
+
].filter(Boolean).join(" "),
|
|
540
|
+
help: recovery?.help ?? (extraction ? undefined : "troubleshooting"),
|
|
541
|
+
warning: !!recovery,
|
|
542
|
+
details
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
case "provider_capacity":
|
|
546
|
+
return {
|
|
547
|
+
title: "Provider rate limit or quota",
|
|
548
|
+
description: details.every((notice) => (notice.retryAt ?? 0) > now) ? retryDescription(details.map((notice) => notice.retryAt ?? 0), now) : retryPhases.length ? "If the provider allows requests again, retry with the current background models." : "Learning can resume when the provider allows requests again.",
|
|
549
|
+
help: "backup",
|
|
550
|
+
details
|
|
551
|
+
};
|
|
552
|
+
case "configuration":
|
|
553
|
+
return {
|
|
554
|
+
title: "Check memory configuration",
|
|
555
|
+
description: "OpenCode ignored or adjusted some memory options. Correct the options listed below.",
|
|
556
|
+
help: "configuration",
|
|
557
|
+
warning: true,
|
|
558
|
+
details
|
|
559
|
+
};
|
|
560
|
+
case "consolidator_setup":
|
|
561
|
+
return {
|
|
562
|
+
title: "Memory agent needs attention",
|
|
563
|
+
description: "Check for overrides of the memorize agent. Restore the plugin's default agent permissions.",
|
|
564
|
+
help: "troubleshooting",
|
|
565
|
+
warning: true,
|
|
566
|
+
details
|
|
567
|
+
};
|
|
568
|
+
case "discovery":
|
|
569
|
+
return {
|
|
570
|
+
title: "Learning is limited to recent activity",
|
|
571
|
+
description: "Memory can only see conversations this server has observed. Check the OpenCode service to restore access to past sessions.",
|
|
572
|
+
help: "service",
|
|
573
|
+
warning: true,
|
|
574
|
+
details
|
|
575
|
+
};
|
|
576
|
+
case "codex_import":
|
|
577
|
+
return {
|
|
578
|
+
title: "Codex import is blocked",
|
|
579
|
+
description: "Check the Codex home and memory paths. OpenCode can still learn from its own conversations.",
|
|
580
|
+
help: "codex",
|
|
581
|
+
warning: true,
|
|
582
|
+
details
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
function memoryMessages(status, now, sessionID) {
|
|
587
|
+
if (status.activity === "stopping")
|
|
588
|
+
return [{ title: "Memory is stopping", description: "Wait for OpenCode to reconnect." }];
|
|
589
|
+
const shownRetries = new Set;
|
|
590
|
+
const messages = MEMORY_NOTICE_KINDS.flatMap((kind) => {
|
|
591
|
+
const notices = status.notices?.filter((notice) => notice.kind === kind) ?? [];
|
|
592
|
+
if (!notices.length)
|
|
593
|
+
return [];
|
|
594
|
+
const retryPhases = [];
|
|
595
|
+
if (status.manualRetry !== undefined) {
|
|
596
|
+
for (const { retryPhase } of notices) {
|
|
597
|
+
if (!retryPhase || shownRetries.has(retryPhase))
|
|
598
|
+
continue;
|
|
599
|
+
retryPhases.push(retryPhase);
|
|
600
|
+
shownRetries.add(retryPhase);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
return [
|
|
604
|
+
{ ...noticeMessage(kind, notices, now, retryPhases, status.manualRetry !== undefined, sessionID), retryPhases }
|
|
605
|
+
];
|
|
606
|
+
});
|
|
607
|
+
if (status.manualRetry?.state === "running")
|
|
608
|
+
return [{ title: `Retrying ${status.manualRetry.phase}\u2026`, description: status.manualRetry.message }, ...messages];
|
|
609
|
+
if (status.generateMemories) {
|
|
610
|
+
const active = status.pipelines.filter((pipeline) => status.dualWrite || pipeline.version === status.version);
|
|
611
|
+
if (status.activity === "consolidating") {
|
|
612
|
+
messages.unshift({ title: "Consolidating memories", description: "Updating the memory files used for recall." });
|
|
613
|
+
} else if (status.activity === "extracting") {
|
|
614
|
+
messages.unshift({
|
|
615
|
+
title: "Learning from sessions",
|
|
616
|
+
description: "Saving useful context from eligible conversations."
|
|
617
|
+
});
|
|
618
|
+
} else if (active.some((pipeline) => hasConsolidationLease(pipeline, now))) {
|
|
619
|
+
messages.unshift({
|
|
620
|
+
title: "Waiting for consolidation",
|
|
621
|
+
description: "A consolidation lock is active. Wait for the run to finish or for the lock to expire."
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
if (messages.length)
|
|
625
|
+
return messages.sort((a, b) => Number(!!b.warning) - Number(!!a.warning));
|
|
626
|
+
if (status.notices === undefined && status.activity === "error")
|
|
627
|
+
return [
|
|
628
|
+
{
|
|
629
|
+
title: "Check memory status",
|
|
630
|
+
description: "See the reported warnings, or ask the agent to run memory_inspect for recent errors.",
|
|
631
|
+
warning: true,
|
|
632
|
+
help: "troubleshooting"
|
|
633
|
+
}
|
|
634
|
+
];
|
|
635
|
+
if (status.notices === undefined && status.activity === "retrying")
|
|
636
|
+
return [
|
|
637
|
+
{
|
|
638
|
+
title: "Waiting to retry",
|
|
639
|
+
description: retryDescription([status.retryAt ?? 0], now)
|
|
640
|
+
}
|
|
641
|
+
];
|
|
642
|
+
const queued = active.filter((pipeline) => pipeline.phase2Status === "pending");
|
|
643
|
+
if (queued.length) {
|
|
644
|
+
const cooldowns = queued.map((pipeline) => pipeline.phase2CooldownUntil ?? 0);
|
|
645
|
+
return [
|
|
646
|
+
{
|
|
647
|
+
title: "Consolidation queued",
|
|
648
|
+
description: cooldowns.every((time) => time > now) ? `Cooldown ends ${remaining(Math.min(...cooldowns), now)}. OpenCode can update memory on activity after that.` : "OpenCode can update memory on the next conversation activity or when a session goes idle."
|
|
649
|
+
}
|
|
650
|
+
];
|
|
651
|
+
}
|
|
652
|
+
return [
|
|
653
|
+
{
|
|
654
|
+
title: "Idle",
|
|
655
|
+
description: "OpenCode checks for eligible idle conversations on new activity."
|
|
656
|
+
}
|
|
657
|
+
];
|
|
658
|
+
}
|
|
659
|
+
return [
|
|
660
|
+
status.useMemories ? { title: "Learning paused", description: "OpenCode can still use existing memories in conversations." } : { title: "Memory is off", description: "Turn on recall or learning below." },
|
|
661
|
+
...messages
|
|
662
|
+
];
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
// src/v2/tui.tsx
|
|
269
666
|
function registerSlot(context, name, render) {
|
|
270
667
|
const slot = context.ui.slot;
|
|
271
668
|
const claim = slot.length <= 1 ? {
|
|
@@ -319,167 +716,20 @@ function colors(context) {
|
|
|
319
716
|
}
|
|
320
717
|
};
|
|
321
718
|
}
|
|
322
|
-
function
|
|
323
|
-
|
|
324
|
-
return `${(n / 1e6).toFixed(1)}M`;
|
|
325
|
-
if (n >= 1000)
|
|
326
|
-
return `${(n / 1000).toFixed(1)}K`;
|
|
327
|
-
return String(n);
|
|
328
|
-
}
|
|
329
|
-
async function fetchStatus(rpc, context, sessionID, signal) {
|
|
330
|
-
const result = await rpc.status(sessionID ? {
|
|
719
|
+
function watchStatus(rpc, context, sessionID) {
|
|
720
|
+
return watchMemoryStatus((signal) => rpc.status(sessionID ? {
|
|
331
721
|
sessionID
|
|
332
722
|
} : {}, {
|
|
333
723
|
location: context.location ?? context.data.location.default(),
|
|
334
|
-
signal
|
|
335
|
-
});
|
|
336
|
-
if (!isMemoryStatus(result))
|
|
337
|
-
throw new Error("invalid memory status payload");
|
|
338
|
-
return result;
|
|
339
|
-
}
|
|
340
|
-
function watchStatus(rpc, context, sessionID) {
|
|
341
|
-
const [status, setStatus] = createSignal(null);
|
|
342
|
-
const [unavailable, setUnavailable] = createSignal(false);
|
|
343
|
-
const [refreshing, setRefreshing] = createSignal(false);
|
|
344
|
-
const [updatedAt, setUpdatedAt] = createSignal(Date.now());
|
|
345
|
-
const lifetime = new AbortController;
|
|
346
|
-
let revision = 0;
|
|
347
|
-
const refresh = async () => {
|
|
348
|
-
const request = ++revision;
|
|
349
|
-
setRefreshing(true);
|
|
350
|
-
try {
|
|
351
|
-
const next = await fetchStatus(rpc, context, sessionID, lifetime.signal);
|
|
352
|
-
if (lifetime.signal.aborted || request !== revision)
|
|
353
|
-
return;
|
|
354
|
-
setStatus(next);
|
|
355
|
-
setUpdatedAt(Date.now());
|
|
356
|
-
setUnavailable(false);
|
|
357
|
-
} catch {
|
|
358
|
-
if (!lifetime.signal.aborted && request === revision)
|
|
359
|
-
setUnavailable(true);
|
|
360
|
-
} finally {
|
|
361
|
-
if (!lifetime.signal.aborted && request === revision)
|
|
362
|
-
setRefreshing(false);
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
const unsubscribe = rpc.events.on("changed", () => void refresh());
|
|
366
|
-
const timer = setInterval(() => void refresh(), 30000);
|
|
367
|
-
onCleanup(() => {
|
|
368
|
-
lifetime.abort();
|
|
369
|
-
clearInterval(timer);
|
|
370
|
-
unsubscribe();
|
|
371
|
-
});
|
|
372
|
-
refresh();
|
|
373
|
-
return {
|
|
374
|
-
status,
|
|
375
|
-
unavailable,
|
|
376
|
-
refreshing,
|
|
377
|
-
updatedAt,
|
|
378
|
-
refresh,
|
|
379
|
-
signal: lifetime.signal
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
function pipelineRows(s, now) {
|
|
383
|
-
return s.pipelines.flatMap((pipeline) => {
|
|
384
|
-
const version = pipeline.version.toUpperCase();
|
|
385
|
-
const paused = !s.generateMemories || !s.dualWrite && pipeline.version !== s.version;
|
|
386
|
-
const extractionRetry = pipeline.phase1RetryAt != null && pipeline.phase1RetryAt > now;
|
|
387
|
-
const consolidationRetry = pipeline.phase2RetryAt != null && pipeline.phase2RetryAt > now;
|
|
388
|
-
const cooldown = pipeline.phase2CooldownUntil != null && pipeline.phase2CooldownUntil > now;
|
|
389
|
-
const consolidation = pipeline.phase2Status === "pending" ? "Queued" : pipeline.phase2Status === "failed" ? "Retry due" : "Idle";
|
|
390
|
-
return [{
|
|
391
|
-
label: `${version} recaps`,
|
|
392
|
-
value: `${pipeline.stage1Count} stored`,
|
|
393
|
-
tone: "muted"
|
|
394
|
-
}, {
|
|
395
|
-
label: `${version} extraction`,
|
|
396
|
-
value: pipeline.extracting ? `Running (${pipeline.extracting})` : paused ? "Paused" : extractionRetry ? `Retry ${remaining(pipeline.phase1RetryAt, now)}` : "Idle",
|
|
397
|
-
tone: extractionRetry && !paused ? "warn" : "muted"
|
|
398
|
-
}, {
|
|
399
|
-
label: `${version} consolidation`,
|
|
400
|
-
value: pipeline.phase2Status === "running" ? "Running" : paused ? "Paused" : consolidationRetry ? `Retry ${remaining(pipeline.phase2RetryAt, now)}` : cooldown ? `${consolidation} \xB7 cooldown ends ${remaining(pipeline.phase2CooldownUntil, now)}` : pipeline.phase2Status === "pending" ? "Queued \xB7 next activity" : consolidation,
|
|
401
|
-
tone: pipeline.lastError ? "warn" : "muted"
|
|
402
|
-
}, ...pipeline.lastError ? [{
|
|
403
|
-
label: `${version} last error`,
|
|
404
|
-
value: pipeline.lastError,
|
|
405
|
-
tone: "warn"
|
|
406
|
-
}] : []];
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
function statusRows(s, now) {
|
|
410
|
-
return [{
|
|
411
|
-
label: "Activity",
|
|
412
|
-
value: labels[s.activity]
|
|
413
|
-
}, {
|
|
414
|
-
label: "Memory version",
|
|
415
|
-
value: `${s.sessionVersion} (default ${s.version})`
|
|
416
|
-
}, {
|
|
417
|
-
label: "Learning pipelines",
|
|
418
|
-
value: s.dualWrite ? "v1 + v2" : s.version
|
|
419
|
-
}, {
|
|
420
|
-
label: "V2 readiness",
|
|
421
|
-
value: `${s.v2Ready ? "Ready" : "Not ready"} \xB7 ${s.v2ConsolidatedThreads}/${s.minConsolidatedThreads} sessions`,
|
|
422
|
-
tone: s.v2Ready ? "ok" : "muted"
|
|
423
|
-
}, ...s.v2NotReadyReason ? [{
|
|
424
|
-
label: "V2 not ready",
|
|
425
|
-
value: s.v2NotReadyReason,
|
|
426
|
-
tone: "muted"
|
|
427
|
-
}] : [], ...s.v2SummaryBytes !== undefined ? [{
|
|
428
|
-
label: "V2 summary",
|
|
429
|
-
value: s.v2SummaryBytes === null ? "Unreadable" : s.v2InjectedSummaryBytes != null ? `${s.v2SummaryBytes} bytes on disk \xB7 ${s.v2InjectedSummaryBytes} injected${s.v2SummaryBytes >= 1e4 ? " (capped)" : ""}` : `${s.v2SummaryBytes} UTF-8 bytes`,
|
|
430
|
-
tone: "muted"
|
|
431
|
-
}] : [], ...pipelineRows(s, now), {
|
|
432
|
-
label: "Use memories",
|
|
433
|
-
value: s.useMemories ? "On" : "Off",
|
|
434
|
-
tone: s.useMemories ? "ok" : "muted"
|
|
435
|
-
}, {
|
|
436
|
-
label: "Learn from sessions",
|
|
437
|
-
value: s.generateMemories ? "On" : "Off",
|
|
438
|
-
tone: s.generateMemories ? "ok" : "muted"
|
|
439
|
-
}, ...s.sessionMode ? [{
|
|
440
|
-
label: "This session",
|
|
441
|
-
value: s.sessionMode === "enabled" ? s.generateMemories ? "Eligible for learning" : "Eligible (learning paused)" : s.sessionMode === "disabled" ? "Not learning" : "Excluded (external context)",
|
|
442
|
-
tone: s.sessionMode === "enabled" && s.generateMemories ? "ok" : "muted"
|
|
443
|
-
}] : [], {
|
|
444
|
-
label: "Last consolidated",
|
|
445
|
-
value: s.lastSuccessAt == null ? "Never" : elapsed(s.lastSuccessAt, now)
|
|
446
|
-
}, ...s.retryAt == null ? [] : [{
|
|
447
|
-
label: "Next retry",
|
|
448
|
-
value: remaining(s.retryAt, now),
|
|
449
|
-
tone: "warn"
|
|
450
|
-
}]];
|
|
451
|
-
}
|
|
452
|
-
function usageRows(s, sessionID) {
|
|
453
|
-
const inj = s.injected;
|
|
454
|
-
const per = inj.sessionRequests > 0 ? Math.round(inj.sessionTokens / inj.sessionRequests) : inj.totalRequests > 0 ? Math.round(inj.totalTokens / inj.totalRequests) : 0;
|
|
455
|
-
return [{
|
|
456
|
-
label: "Block size",
|
|
457
|
-
value: per ? `~${formatTokens(per)} tokens / request` : "\u2014"
|
|
458
|
-
}, ...sessionID ? [{
|
|
459
|
-
label: "This session",
|
|
460
|
-
value: `~${formatTokens(inj.sessionTokens)} tokens \xB7 ${inj.sessionRequests} req`
|
|
461
|
-
}] : [], {
|
|
462
|
-
label: "Since start",
|
|
463
|
-
value: `~${formatTokens(inj.totalTokens)} tokens \xB7 ${inj.totalRequests} req`
|
|
464
|
-
}];
|
|
465
|
-
}
|
|
466
|
-
function configRows(s) {
|
|
467
|
-
return [{
|
|
468
|
-
label: "Extraction",
|
|
469
|
-
value: s.extractModel ?? "Host default"
|
|
470
|
-
}, {
|
|
471
|
-
label: "Consolidation",
|
|
472
|
-
value: s.consolidationModel ?? "Host default"
|
|
473
|
-
}, {
|
|
474
|
-
label: "Codex import",
|
|
475
|
-
value: s.codexImport ? "On" : "Off",
|
|
476
|
-
tone: s.codexImport ? "ok" : "muted"
|
|
477
|
-
}, {
|
|
478
|
-
label: "Location",
|
|
479
|
-
value: s.memoryRoot
|
|
480
|
-
}];
|
|
724
|
+
signal
|
|
725
|
+
}), (listener) => rpc.events.on("changed", listener));
|
|
481
726
|
}
|
|
482
727
|
var TABS = ["Overview", "Controls"];
|
|
728
|
+
var RETRY_KEYS = {
|
|
729
|
+
extraction: "e",
|
|
730
|
+
consolidation: "c"
|
|
731
|
+
};
|
|
732
|
+
var RETRY_PHASES = Object.keys(RETRY_KEYS);
|
|
483
733
|
function MemoryDialog(context, sessionID) {
|
|
484
734
|
const rpc = context.client.rpc(MemoryStatusRpc);
|
|
485
735
|
const {
|
|
@@ -492,14 +742,34 @@ function MemoryDialog(context, sessionID) {
|
|
|
492
742
|
} = watchStatus(rpc, context, sessionID);
|
|
493
743
|
const dimensions = useTerminalDimensions();
|
|
494
744
|
const color = colors(context);
|
|
495
|
-
const [tab, setTab] =
|
|
496
|
-
const [cursor, setCursor] =
|
|
497
|
-
const [notice, setNotice] =
|
|
498
|
-
const [busy, setBusy] =
|
|
499
|
-
const [armed, setArmed] =
|
|
745
|
+
const [tab, setTab] = createSignal2("Overview");
|
|
746
|
+
const [cursor, setCursor] = createSignal2(0);
|
|
747
|
+
const [notice, setNotice] = createSignal2(null);
|
|
748
|
+
const [busy, setBusy] = createSignal2(null);
|
|
749
|
+
const [armed, setArmed] = createSignal2(false);
|
|
500
750
|
let scroll;
|
|
751
|
+
const messages = createMemo(() => {
|
|
752
|
+
const snapshot = status();
|
|
753
|
+
return snapshot && !unavailable() ? memoryMessages(snapshot, updatedAt(), sessionID) : [];
|
|
754
|
+
});
|
|
755
|
+
const retry = () => unavailable() ? null : status()?.manualRetry;
|
|
756
|
+
const retryResult = () => retry()?.state === "running" ? null : retry();
|
|
757
|
+
const retryDisabled = () => {
|
|
758
|
+
const snapshot = status();
|
|
759
|
+
return busy() !== null || !snapshot?.generateMemories || snapshot.activity === "stopping" || isMemoryRunning(snapshot, updatedAt());
|
|
760
|
+
};
|
|
761
|
+
const canRetry = (phase) => !retryDisabled() && messages().some((message) => message.retryPhases?.includes(phase));
|
|
762
|
+
const needsProvider = () => messages().some((message) => message.help === "providers");
|
|
763
|
+
const affectedSession = () => messages().find((message) => message.affectedSessionID)?.affectedSessionID;
|
|
764
|
+
const diagnostics = createMemo(() => {
|
|
765
|
+
const snapshot = status();
|
|
766
|
+
return snapshot?.notices === undefined || unavailable() ? snapshot?.warnings ?? [] : messages().flatMap((message) => (message.details ?? []).flatMap(({
|
|
767
|
+
detail,
|
|
768
|
+
version
|
|
769
|
+
}) => detail ? [`${version ? `${version.toUpperCase()}: ` : ""}${detail}`] : []));
|
|
770
|
+
});
|
|
501
771
|
const call = async (id, method, input, done) => {
|
|
502
|
-
if (busy() || unavailable())
|
|
772
|
+
if (busy() || unavailable() || status()?.activity === "stopping")
|
|
503
773
|
return;
|
|
504
774
|
setBusy(id);
|
|
505
775
|
setNotice(null);
|
|
@@ -514,16 +784,18 @@ function MemoryDialog(context, sessionID) {
|
|
|
514
784
|
if (method === "consolidateNow" ? reply?.status !== "started" : reply?.ok !== true) {
|
|
515
785
|
throw new Error(reply?.message ?? "The server did not apply the request. Refresh and try again.");
|
|
516
786
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
787
|
+
if (done)
|
|
788
|
+
setNotice({
|
|
789
|
+
message: done,
|
|
790
|
+
tone: "ok"
|
|
791
|
+
});
|
|
521
792
|
await refresh();
|
|
522
793
|
} catch (error) {
|
|
523
794
|
if (signal.aborted)
|
|
524
795
|
return;
|
|
796
|
+
const label = method === "retryFailed" ? "Couldn\u2019t start retry" : "Failed";
|
|
525
797
|
setNotice({
|
|
526
|
-
message:
|
|
798
|
+
message: `${label}: ${error instanceof Error ? error.message : String(error)}`,
|
|
527
799
|
tone: "error"
|
|
528
800
|
});
|
|
529
801
|
await refresh();
|
|
@@ -532,6 +804,28 @@ function MemoryDialog(context, sessionID) {
|
|
|
532
804
|
setBusy(null);
|
|
533
805
|
}
|
|
534
806
|
};
|
|
807
|
+
const startRetry = (phase) => {
|
|
808
|
+
if (!canRetry(phase))
|
|
809
|
+
return;
|
|
810
|
+
scroll?.scrollTo(0);
|
|
811
|
+
call("retry", "retryFailed", {
|
|
812
|
+
phase
|
|
813
|
+
});
|
|
814
|
+
};
|
|
815
|
+
const openProviders = () => {
|
|
816
|
+
context.ui.dialog.clear();
|
|
817
|
+
context.keymap.dispatch("provider.connect");
|
|
818
|
+
};
|
|
819
|
+
const openAffected = () => {
|
|
820
|
+
const id = affectedSession();
|
|
821
|
+
if (!id)
|
|
822
|
+
return;
|
|
823
|
+
context.ui.dialog.clear();
|
|
824
|
+
context.ui.router.navigate({
|
|
825
|
+
type: "session",
|
|
826
|
+
sessionID: id
|
|
827
|
+
});
|
|
828
|
+
};
|
|
535
829
|
const controls = () => {
|
|
536
830
|
const s = status();
|
|
537
831
|
if (!s)
|
|
@@ -571,7 +865,7 @@ function MemoryDialog(context, sessionID) {
|
|
|
571
865
|
}, learning ? "This session is excluded from future learning." : "This session is eligible when global learning is on.")
|
|
572
866
|
});
|
|
573
867
|
}
|
|
574
|
-
const running = s
|
|
868
|
+
const running = isMemoryRunning(s, updatedAt());
|
|
575
869
|
list.push({
|
|
576
870
|
id: "now",
|
|
577
871
|
title: "Consolidate now",
|
|
@@ -663,6 +957,7 @@ function MemoryDialog(context, sessionID) {
|
|
|
663
957
|
event.stopPropagation();
|
|
664
958
|
action();
|
|
665
959
|
};
|
|
960
|
+
const retryShortcuts = () => RETRY_PHASES.filter(canRetry).map((phase) => `${RETRY_KEYS[phase]} retry ${phase}`).join(" \xB7 ");
|
|
666
961
|
context.keymap.layer(() => ({
|
|
667
962
|
mode: "modal",
|
|
668
963
|
commands: [...["left", "shift+tab"].map((bind) => ({
|
|
@@ -707,6 +1002,21 @@ function MemoryDialog(context, sessionID) {
|
|
|
707
1002
|
run: () => {
|
|
708
1003
|
refresh();
|
|
709
1004
|
}
|
|
1005
|
+
}, ...RETRY_PHASES.map((phase) => ({
|
|
1006
|
+
title: retryLabels[phase].action,
|
|
1007
|
+
bind: RETRY_KEYS[phase],
|
|
1008
|
+
enabled: () => tab() === "Overview" && canRetry(phase),
|
|
1009
|
+
run: () => startRetry(phase)
|
|
1010
|
+
})), {
|
|
1011
|
+
title: memoryHelp.providers.label,
|
|
1012
|
+
bind: "p",
|
|
1013
|
+
enabled: () => tab() === "Overview" && needsProvider(),
|
|
1014
|
+
run: openProviders
|
|
1015
|
+
}, {
|
|
1016
|
+
title: "Open affected session",
|
|
1017
|
+
bind: "s",
|
|
1018
|
+
enabled: () => tab() === "Overview" && !!affectedSession(),
|
|
1019
|
+
run: openAffected
|
|
710
1020
|
}, ...["return", "space"].map((bind) => ({
|
|
711
1021
|
title: "Change selected control",
|
|
712
1022
|
bind,
|
|
@@ -803,8 +1113,8 @@ function MemoryDialog(context, sessionID) {
|
|
|
803
1113
|
_$setProp(_el$22, "paddingLeft", 1);
|
|
804
1114
|
_$setProp(_el$22, "paddingRight", 1);
|
|
805
1115
|
_$insert(_el$23, (() => {
|
|
806
|
-
var _c$
|
|
807
|
-
return () => _c$
|
|
1116
|
+
var _c$5 = _$memo(() => tab() === t);
|
|
1117
|
+
return () => _c$5() ? (() => {
|
|
808
1118
|
var _el$24 = _$createElement("b");
|
|
809
1119
|
_$insert(_el$24, t);
|
|
810
1120
|
return _el$24;
|
|
@@ -832,7 +1142,7 @@ function MemoryDialog(context, sessionID) {
|
|
|
832
1142
|
_$setProp(_el$25, "marginTop", 1);
|
|
833
1143
|
_$setProp(_el$25, "flexShrink", 0);
|
|
834
1144
|
_$setProp(_el$26, "wrapMode", "word");
|
|
835
|
-
_$insert(_el$26, () => status() ? "Offline: last known status. Press r to
|
|
1145
|
+
_$insert(_el$26, () => status() ? "Offline: last known status. Press r to reconnect." : "Memory status unavailable. Press r to reconnect.");
|
|
836
1146
|
_$effect((_$p) => _$setProp(_el$26, "fg", color.error, _$p));
|
|
837
1147
|
return _el$25;
|
|
838
1148
|
})() : _$createElement("box");
|
|
@@ -861,8 +1171,8 @@ function MemoryDialog(context, sessionID) {
|
|
|
861
1171
|
var _el$28 = _$createElement("box");
|
|
862
1172
|
_$setProp(_el$28, "flexDirection", "column");
|
|
863
1173
|
_$insert(_el$28, (() => {
|
|
864
|
-
var _c$
|
|
865
|
-
return () => _c$
|
|
1174
|
+
var _c$6 = _$memo(() => notice()?.tone === "error");
|
|
1175
|
+
return () => _c$6() ? _$createComponent(Note, {
|
|
866
1176
|
get fg() {
|
|
867
1177
|
return color.error;
|
|
868
1178
|
},
|
|
@@ -871,6 +1181,120 @@ function MemoryDialog(context, sessionID) {
|
|
|
871
1181
|
}
|
|
872
1182
|
}) : _$createElement("box");
|
|
873
1183
|
})(), null);
|
|
1184
|
+
_$insert(_el$28, (() => {
|
|
1185
|
+
var _c$7 = _$memo(() => !!retryResult());
|
|
1186
|
+
return () => _c$7() ? _$createComponent(Note, {
|
|
1187
|
+
get fg() {
|
|
1188
|
+
return _$memo(() => retryResult().state === "completed")() ? color.ok : color.warn;
|
|
1189
|
+
},
|
|
1190
|
+
get children() {
|
|
1191
|
+
return `${retryLabels[retryResult().phase].result}: ${retryResult().message}`;
|
|
1192
|
+
}
|
|
1193
|
+
}) : _$createElement("box");
|
|
1194
|
+
})(), null);
|
|
1195
|
+
_$insert(_el$28, _$createComponent(Index, {
|
|
1196
|
+
get each() {
|
|
1197
|
+
return messages();
|
|
1198
|
+
},
|
|
1199
|
+
children: (message) => (() => {
|
|
1200
|
+
var _el$31 = _$createElement("box"), _el$32 = _$createElement("text"), _el$33 = _$createElement("b"), _el$34 = _$createElement("text");
|
|
1201
|
+
_$insertNode(_el$31, _el$32);
|
|
1202
|
+
_$insertNode(_el$31, _el$34);
|
|
1203
|
+
_$setProp(_el$31, "marginTop", 1);
|
|
1204
|
+
_$setProp(_el$31, "flexDirection", "column");
|
|
1205
|
+
_$setProp(_el$31, "flexShrink", 0);
|
|
1206
|
+
_$insertNode(_el$32, _el$33);
|
|
1207
|
+
_$setProp(_el$32, "wrapMode", "word");
|
|
1208
|
+
_$insert(_el$33, () => message().title);
|
|
1209
|
+
_$setProp(_el$34, "wrapMode", "word");
|
|
1210
|
+
_$insert(_el$34, () => message().description);
|
|
1211
|
+
_$insert(_el$31, _$createComponent(For, {
|
|
1212
|
+
get each() {
|
|
1213
|
+
return message().retryPhases;
|
|
1214
|
+
},
|
|
1215
|
+
children: (phase) => (() => {
|
|
1216
|
+
var _el$35 = _$createElement("text");
|
|
1217
|
+
_$setProp(_el$35, "wrapMode", "word");
|
|
1218
|
+
_$insert(_el$35, (() => {
|
|
1219
|
+
var _c$1 = _$memo(() => !!canRetry(phase));
|
|
1220
|
+
return () => _c$1() ? `[${RETRY_KEYS[phase]}] ` : "";
|
|
1221
|
+
})(), null);
|
|
1222
|
+
_$insert(_el$35, () => retryLabels[phase].action, null);
|
|
1223
|
+
_$insert(_el$35, () => canRetry(phase) ? "" : " (unavailable)", null);
|
|
1224
|
+
_$effect((_p$) => {
|
|
1225
|
+
var _v$16 = canRetry(phase) ? color.text : color.muted, _v$17 = click(() => startRetry(phase));
|
|
1226
|
+
_v$16 !== _p$.e && (_p$.e = _$setProp(_el$35, "fg", _v$16, _p$.e));
|
|
1227
|
+
_v$17 !== _p$.t && (_p$.t = _$setProp(_el$35, "onMouseUp", _v$17, _p$.t));
|
|
1228
|
+
return _p$;
|
|
1229
|
+
}, {
|
|
1230
|
+
e: undefined,
|
|
1231
|
+
t: undefined
|
|
1232
|
+
});
|
|
1233
|
+
return _el$35;
|
|
1234
|
+
})()
|
|
1235
|
+
}), null);
|
|
1236
|
+
_$insert(_el$31, (() => {
|
|
1237
|
+
var _c$9 = _$memo(() => message().help === "providers");
|
|
1238
|
+
return () => _c$9() ? (() => {
|
|
1239
|
+
var _el$36 = _$createElement("text"), _el$37 = _$createTextNode(`[p] `);
|
|
1240
|
+
_$insertNode(_el$36, _el$37);
|
|
1241
|
+
_$insert(_el$36, () => memoryHelp.providers.label, null);
|
|
1242
|
+
_$effect((_p$) => {
|
|
1243
|
+
var _v$18 = color.text, _v$19 = click(openProviders);
|
|
1244
|
+
_v$18 !== _p$.e && (_p$.e = _$setProp(_el$36, "fg", _v$18, _p$.e));
|
|
1245
|
+
_v$19 !== _p$.t && (_p$.t = _$setProp(_el$36, "onMouseUp", _v$19, _p$.t));
|
|
1246
|
+
return _p$;
|
|
1247
|
+
}, {
|
|
1248
|
+
e: undefined,
|
|
1249
|
+
t: undefined
|
|
1250
|
+
});
|
|
1251
|
+
return _el$36;
|
|
1252
|
+
})() : _$memo(() => !!message().help)() ? (() => {
|
|
1253
|
+
var _el$38 = _$createElement("text"), _el$39 = _$createElement("a");
|
|
1254
|
+
_$insertNode(_el$38, _el$39);
|
|
1255
|
+
_$setProp(_el$38, "wrapMode", "word");
|
|
1256
|
+
_$insert(_el$39, () => memoryHelp[message().help].label);
|
|
1257
|
+
_$effect((_p$) => {
|
|
1258
|
+
var _v$20 = color.text, _v$21 = memoryHelpURL(message().help);
|
|
1259
|
+
_v$20 !== _p$.e && (_p$.e = _$setProp(_el$38, "fg", _v$20, _p$.e));
|
|
1260
|
+
_v$21 !== _p$.t && (_p$.t = _$setProp(_el$39, "href", _v$21, _p$.t));
|
|
1261
|
+
return _p$;
|
|
1262
|
+
}, {
|
|
1263
|
+
e: undefined,
|
|
1264
|
+
t: undefined
|
|
1265
|
+
});
|
|
1266
|
+
return _el$38;
|
|
1267
|
+
})() : _$createElement("box");
|
|
1268
|
+
})(), null);
|
|
1269
|
+
_$insert(_el$31, (() => {
|
|
1270
|
+
var _c$0 = _$memo(() => !!message().affectedSessionID);
|
|
1271
|
+
return () => _c$0() ? (() => {
|
|
1272
|
+
var _el$41 = _$createElement("text");
|
|
1273
|
+
_$insertNode(_el$41, _$createTextNode(`[s] Open affected session`));
|
|
1274
|
+
_$effect((_p$) => {
|
|
1275
|
+
var _v$22 = color.text, _v$23 = click(openAffected);
|
|
1276
|
+
_v$22 !== _p$.e && (_p$.e = _$setProp(_el$41, "fg", _v$22, _p$.e));
|
|
1277
|
+
_v$23 !== _p$.t && (_p$.t = _$setProp(_el$41, "onMouseUp", _v$23, _p$.t));
|
|
1278
|
+
return _p$;
|
|
1279
|
+
}, {
|
|
1280
|
+
e: undefined,
|
|
1281
|
+
t: undefined
|
|
1282
|
+
});
|
|
1283
|
+
return _el$41;
|
|
1284
|
+
})() : _$createElement("box");
|
|
1285
|
+
})(), null);
|
|
1286
|
+
_$effect((_p$) => {
|
|
1287
|
+
var _v$14 = message().warning ? color.warn : color.text, _v$15 = color.muted;
|
|
1288
|
+
_v$14 !== _p$.e && (_p$.e = _$setProp(_el$32, "fg", _v$14, _p$.e));
|
|
1289
|
+
_v$15 !== _p$.t && (_p$.t = _$setProp(_el$34, "fg", _v$15, _p$.t));
|
|
1290
|
+
return _p$;
|
|
1291
|
+
}, {
|
|
1292
|
+
e: undefined,
|
|
1293
|
+
t: undefined
|
|
1294
|
+
});
|
|
1295
|
+
return _el$31;
|
|
1296
|
+
})()
|
|
1297
|
+
}), null);
|
|
874
1298
|
_$insert(_el$28, _$createComponent(Section, {
|
|
875
1299
|
title: "Status"
|
|
876
1300
|
}), null);
|
|
@@ -880,27 +1304,27 @@ function MemoryDialog(context, sessionID) {
|
|
|
880
1304
|
}
|
|
881
1305
|
}), null);
|
|
882
1306
|
_$insert(_el$28, (() => {
|
|
883
|
-
var _c$
|
|
884
|
-
return () => _c$
|
|
885
|
-
var _el$
|
|
886
|
-
_$setProp(_el$
|
|
887
|
-
_$setProp(_el$
|
|
888
|
-
_$insert(_el$
|
|
889
|
-
title: "
|
|
1307
|
+
var _c$8 = _$memo(() => diagnostics().length > 0);
|
|
1308
|
+
return () => _c$8() ? (() => {
|
|
1309
|
+
var _el$44 = _$createElement("box");
|
|
1310
|
+
_$setProp(_el$44, "flexDirection", "column");
|
|
1311
|
+
_$setProp(_el$44, "flexShrink", 0);
|
|
1312
|
+
_$insert(_el$44, _$createComponent(Section, {
|
|
1313
|
+
title: "Diagnostic details"
|
|
890
1314
|
}), null);
|
|
891
|
-
_$insert(_el$
|
|
1315
|
+
_$insert(_el$44, _$createComponent(For, {
|
|
892
1316
|
get each() {
|
|
893
|
-
return
|
|
1317
|
+
return diagnostics();
|
|
894
1318
|
},
|
|
895
1319
|
children: (w) => (() => {
|
|
896
|
-
var _el$
|
|
897
|
-
_$setProp(_el$
|
|
898
|
-
_$insert(_el$
|
|
899
|
-
_$effect((_$p) => _$setProp(_el$
|
|
900
|
-
return _el$
|
|
1320
|
+
var _el$45 = _$createElement("text");
|
|
1321
|
+
_$setProp(_el$45, "wrapMode", "word");
|
|
1322
|
+
_$insert(_el$45, `! ${w}`);
|
|
1323
|
+
_$effect((_$p) => _$setProp(_el$45, "fg", color.warn, _$p));
|
|
1324
|
+
return _el$45;
|
|
901
1325
|
})()
|
|
902
1326
|
}), null);
|
|
903
|
-
return _el$
|
|
1327
|
+
return _el$44;
|
|
904
1328
|
})() : _$createElement("box");
|
|
905
1329
|
})(), null);
|
|
906
1330
|
_$insert(_el$28, _$createComponent(Section, {
|
|
@@ -927,10 +1351,10 @@ function MemoryDialog(context, sessionID) {
|
|
|
927
1351
|
}), null);
|
|
928
1352
|
return _el$28;
|
|
929
1353
|
})() : (() => {
|
|
930
|
-
var _el$
|
|
931
|
-
_$setProp(_el$
|
|
932
|
-
_$setProp(_el$
|
|
933
|
-
_$insert(_el$
|
|
1354
|
+
var _el$47 = _$createElement("box");
|
|
1355
|
+
_$setProp(_el$47, "flexDirection", "column");
|
|
1356
|
+
_$setProp(_el$47, "marginTop", 1);
|
|
1357
|
+
_$insert(_el$47, _$createComponent(For, {
|
|
934
1358
|
get each() {
|
|
935
1359
|
return controls();
|
|
936
1360
|
},
|
|
@@ -940,49 +1364,49 @@ function MemoryDialog(context, sessionID) {
|
|
|
940
1364
|
const fg = () => selected() ? color.selectedText : disabled() ? color.muted : color.text;
|
|
941
1365
|
const state = () => busy() === c.id ? c.id === "now" ? "Starting\u2026" : c.id === "reset" ? "Resetting\u2026" : "Saving\u2026" : c.id === "reset" && armed() ? "Confirm" : c.on === undefined ? c.enabled ? "Run" : "Unavailable" : c.on ? "On" : "Off";
|
|
942
1366
|
return (() => {
|
|
943
|
-
var _el$
|
|
944
|
-
_$insertNode(_el$
|
|
945
|
-
_$insertNode(_el$
|
|
946
|
-
_$setProp(_el$
|
|
947
|
-
_$setProp(_el$
|
|
948
|
-
_$setProp(_el$
|
|
949
|
-
_$setProp(_el$
|
|
950
|
-
_$insertNode(_el$
|
|
951
|
-
_$insertNode(_el$
|
|
952
|
-
_$insertNode(_el$
|
|
953
|
-
_$setProp(_el$
|
|
954
|
-
_$setProp(_el$
|
|
955
|
-
_$setProp(_el$
|
|
956
|
-
_$insert(_el$
|
|
957
|
-
_$setProp(_el$
|
|
958
|
-
_$setProp(_el$
|
|
959
|
-
_$setProp(_el$
|
|
960
|
-
_$insert(_el$
|
|
961
|
-
var _c$
|
|
962
|
-
return () => _c$
|
|
963
|
-
var _el$
|
|
964
|
-
_$insert(_el$
|
|
965
|
-
return _el$
|
|
1367
|
+
var _el$48 = _$createElement("box"), _el$49 = _$createElement("box"), _el$50 = _$createElement("text"), _el$51 = _$createElement("text"), _el$52 = _$createElement("text"), _el$53 = _$createElement("box"), _el$54 = _$createElement("text");
|
|
1368
|
+
_$insertNode(_el$48, _el$49);
|
|
1369
|
+
_$insertNode(_el$48, _el$53);
|
|
1370
|
+
_$setProp(_el$48, "flexDirection", "column");
|
|
1371
|
+
_$setProp(_el$48, "flexShrink", 0);
|
|
1372
|
+
_$setProp(_el$48, "paddingLeft", 1);
|
|
1373
|
+
_$setProp(_el$48, "paddingRight", 1);
|
|
1374
|
+
_$insertNode(_el$49, _el$50);
|
|
1375
|
+
_$insertNode(_el$49, _el$51);
|
|
1376
|
+
_$insertNode(_el$49, _el$52);
|
|
1377
|
+
_$setProp(_el$49, "flexDirection", "row");
|
|
1378
|
+
_$setProp(_el$49, "gap", 1);
|
|
1379
|
+
_$setProp(_el$50, "flexShrink", 0);
|
|
1380
|
+
_$insert(_el$50, () => selected() ? "\u203A" : " ");
|
|
1381
|
+
_$setProp(_el$51, "flexGrow", 1);
|
|
1382
|
+
_$setProp(_el$51, "flexShrink", 1);
|
|
1383
|
+
_$setProp(_el$51, "wrapMode", "word");
|
|
1384
|
+
_$insert(_el$51, (() => {
|
|
1385
|
+
var _c$10 = _$memo(() => !!selected());
|
|
1386
|
+
return () => _c$10() ? (() => {
|
|
1387
|
+
var _el$55 = _$createElement("b");
|
|
1388
|
+
_$insert(_el$55, () => c.title);
|
|
1389
|
+
return _el$55;
|
|
966
1390
|
})() : c.title;
|
|
967
1391
|
})());
|
|
968
|
-
_$setProp(_el$
|
|
969
|
-
_$insert(_el$
|
|
970
|
-
_$insertNode(_el$
|
|
971
|
-
_$setProp(_el$
|
|
972
|
-
_$setProp(_el$
|
|
973
|
-
_$insert(_el$
|
|
1392
|
+
_$setProp(_el$52, "flexShrink", 0);
|
|
1393
|
+
_$insert(_el$52, state);
|
|
1394
|
+
_$insertNode(_el$53, _el$54);
|
|
1395
|
+
_$setProp(_el$53, "paddingLeft", 2);
|
|
1396
|
+
_$setProp(_el$54, "wrapMode", "word");
|
|
1397
|
+
_$insert(_el$54, () => c.hint);
|
|
974
1398
|
_$effect((_p$) => {
|
|
975
|
-
var _v$
|
|
1399
|
+
var _v$24 = `memory-control-${c.id}`, _v$25 = selected() ? color.selectedBg : undefined, _v$26 = click(() => {
|
|
976
1400
|
select(i());
|
|
977
1401
|
activate(i());
|
|
978
|
-
}), _v$
|
|
979
|
-
_v$
|
|
980
|
-
_v$
|
|
981
|
-
_v$
|
|
982
|
-
_v$
|
|
983
|
-
_v$
|
|
984
|
-
_v$
|
|
985
|
-
_v$
|
|
1402
|
+
}), _v$27 = fg(), _v$28 = fg(), _v$29 = selected() ? color.selectedText : c.on && !disabled() ? color.ok : color.muted, _v$30 = selected() ? color.selectedText : color.muted;
|
|
1403
|
+
_v$24 !== _p$.e && (_p$.e = _$setProp(_el$48, "id", _v$24, _p$.e));
|
|
1404
|
+
_v$25 !== _p$.t && (_p$.t = _$setProp(_el$48, "backgroundColor", _v$25, _p$.t));
|
|
1405
|
+
_v$26 !== _p$.a && (_p$.a = _$setProp(_el$48, "onMouseUp", _v$26, _p$.a));
|
|
1406
|
+
_v$27 !== _p$.o && (_p$.o = _$setProp(_el$50, "fg", _v$27, _p$.o));
|
|
1407
|
+
_v$28 !== _p$.i && (_p$.i = _$setProp(_el$51, "fg", _v$28, _p$.i));
|
|
1408
|
+
_v$29 !== _p$.n && (_p$.n = _$setProp(_el$52, "fg", _v$29, _p$.n));
|
|
1409
|
+
_v$30 !== _p$.s && (_p$.s = _$setProp(_el$54, "fg", _v$30, _p$.s));
|
|
986
1410
|
return _p$;
|
|
987
1411
|
}, {
|
|
988
1412
|
e: undefined,
|
|
@@ -993,40 +1417,57 @@ function MemoryDialog(context, sessionID) {
|
|
|
993
1417
|
n: undefined,
|
|
994
1418
|
s: undefined
|
|
995
1419
|
});
|
|
996
|
-
return _el$
|
|
1420
|
+
return _el$48;
|
|
997
1421
|
})();
|
|
998
1422
|
}
|
|
999
1423
|
}), null);
|
|
1000
|
-
_$insert(_el$
|
|
1424
|
+
_$insert(_el$47, _$createComponent(Note, {
|
|
1001
1425
|
get fg() {
|
|
1002
1426
|
return color.muted;
|
|
1003
1427
|
},
|
|
1004
1428
|
children: "The first two toggles affect all projects until the server restarts. Set plugin options in opencode.json(c) to keep them."
|
|
1005
1429
|
}), null);
|
|
1006
|
-
return _el$
|
|
1430
|
+
return _el$47;
|
|
1007
1431
|
})();
|
|
1008
1432
|
})());
|
|
1009
1433
|
_$insert(_el$9, (() => {
|
|
1010
1434
|
var _c$3 = _$memo(() => !!(!unavailable() && (busy() || notice())));
|
|
1011
1435
|
return () => _c$3() ? (() => {
|
|
1012
|
-
var _el$
|
|
1013
|
-
_$insertNode(_el$
|
|
1014
|
-
_$setProp(_el$
|
|
1015
|
-
_$setProp(_el$
|
|
1016
|
-
_$setProp(_el$
|
|
1017
|
-
_$insert(_el$
|
|
1018
|
-
var _c$
|
|
1019
|
-
return () => _c$
|
|
1436
|
+
var _el$56 = _$createElement("box"), _el$57 = _$createElement("text");
|
|
1437
|
+
_$insertNode(_el$56, _el$57);
|
|
1438
|
+
_$setProp(_el$56, "marginTop", 1);
|
|
1439
|
+
_$setProp(_el$56, "flexShrink", 0);
|
|
1440
|
+
_$setProp(_el$57, "wrapMode", "word");
|
|
1441
|
+
_$insert(_el$57, (() => {
|
|
1442
|
+
var _c$11 = _$memo(() => !!busy());
|
|
1443
|
+
return () => _c$11() ? busy() === "retry" ? "Starting retry\u2026" : "Applying change\u2026" : _$memo(() => notice()?.tone === "error")() ? tab() === "Overview" ? "Change failed. Details above." : "Change failed. See Overview for details." : notice().message;
|
|
1020
1444
|
})());
|
|
1021
|
-
_$effect((_$p) => _$setProp(_el$
|
|
1022
|
-
return _el$
|
|
1023
|
-
})() : _$
|
|
1445
|
+
_$effect((_$p) => _$setProp(_el$57, "fg", busy() ? color.muted : notice()?.tone === "error" ? color.error : notice()?.tone === "warn" ? color.warn : color.ok, _$p));
|
|
1446
|
+
return _el$56;
|
|
1447
|
+
})() : _$memo(() => !!(tab() === "Controls" && retry()))() ? _$createComponent(Note, {
|
|
1448
|
+
get fg() {
|
|
1449
|
+
return color.muted;
|
|
1450
|
+
},
|
|
1451
|
+
get children() {
|
|
1452
|
+
return _$memo(() => retry().state === "running")() ? `Retrying ${retry().phase}\u2026` : `${retryLabels[retry().phase].result}: ${retry().state}. See Overview.`;
|
|
1453
|
+
}
|
|
1454
|
+
}) : _$createElement("box");
|
|
1024
1455
|
})(), _el$18);
|
|
1025
1456
|
_$insertNode(_el$18, _el$19);
|
|
1026
1457
|
_$insertNode(_el$18, _el$21);
|
|
1027
1458
|
_$setProp(_el$18, "flexDirection", "column");
|
|
1028
1459
|
_$setProp(_el$18, "marginTop", 1);
|
|
1029
1460
|
_$setProp(_el$18, "flexShrink", 0);
|
|
1461
|
+
_$insert(_el$18, (() => {
|
|
1462
|
+
var _c$4 = _$memo(() => !!(tab() === "Overview" && retryShortcuts()));
|
|
1463
|
+
return () => _c$4() ? (() => {
|
|
1464
|
+
var _el$59 = _$createElement("text");
|
|
1465
|
+
_$setProp(_el$59, "wrapMode", "word");
|
|
1466
|
+
_$insert(_el$59, retryShortcuts);
|
|
1467
|
+
_$effect((_$p) => _$setProp(_el$59, "fg", color.text, _$p));
|
|
1468
|
+
return _el$59;
|
|
1469
|
+
})() : _$createElement("box");
|
|
1470
|
+
})(), _el$19);
|
|
1030
1471
|
_$insertNode(_el$19, _el$20);
|
|
1031
1472
|
_$insert(_el$19, () => tab() === "Controls" ? "select" : "scroll", null);
|
|
1032
1473
|
_$insert(_el$21, () => tab() === "Controls" ? "Enter/Space change" : "PgUp/PgDn page \xB7 Home/End ends");
|
|
@@ -1079,27 +1520,27 @@ function StatusPanel(context, sessionID) {
|
|
|
1079
1520
|
return palette.muted;
|
|
1080
1521
|
};
|
|
1081
1522
|
return (() => {
|
|
1082
|
-
var _el$
|
|
1083
|
-
_$insertNode(_el$
|
|
1084
|
-
_$insertNode(_el$
|
|
1085
|
-
_$insertNode(_el$
|
|
1086
|
-
_$setProp(_el$
|
|
1087
|
-
_$insertNode(_el$
|
|
1088
|
-
_$insertNode(_el$
|
|
1089
|
-
_$insert(_el$
|
|
1090
|
-
_$insertNode(_el$
|
|
1523
|
+
var _el$61 = _$createElement("box"), _el$62 = _$createElement("text"), _el$64 = _$createElement("text"), _el$65 = _$createTextNode(`\u25CF `), _el$66 = _$createElement("text");
|
|
1524
|
+
_$insertNode(_el$61, _el$62);
|
|
1525
|
+
_$insertNode(_el$61, _el$64);
|
|
1526
|
+
_$insertNode(_el$61, _el$66);
|
|
1527
|
+
_$setProp(_el$61, "flexDirection", "column");
|
|
1528
|
+
_$insertNode(_el$62, _$createTextNode(`Memory`));
|
|
1529
|
+
_$insertNode(_el$64, _el$65);
|
|
1530
|
+
_$insert(_el$64, title, null);
|
|
1531
|
+
_$insertNode(_el$66, _$createTextNode(` /memory-inspect`));
|
|
1091
1532
|
_$effect((_p$) => {
|
|
1092
|
-
var _v$
|
|
1093
|
-
_v$
|
|
1094
|
-
_v$
|
|
1095
|
-
_v$
|
|
1533
|
+
var _v$31 = palette.text, _v$32 = color(), _v$33 = palette.muted;
|
|
1534
|
+
_v$31 !== _p$.e && (_p$.e = _$setProp(_el$62, "fg", _v$31, _p$.e));
|
|
1535
|
+
_v$32 !== _p$.t && (_p$.t = _$setProp(_el$64, "fg", _v$32, _p$.t));
|
|
1536
|
+
_v$33 !== _p$.a && (_p$.a = _$setProp(_el$66, "fg", _v$33, _p$.a));
|
|
1096
1537
|
return _p$;
|
|
1097
1538
|
}, {
|
|
1098
1539
|
e: undefined,
|
|
1099
1540
|
t: undefined,
|
|
1100
1541
|
a: undefined
|
|
1101
1542
|
});
|
|
1102
|
-
return _el$
|
|
1543
|
+
return _el$61;
|
|
1103
1544
|
})();
|
|
1104
1545
|
}
|
|
1105
1546
|
function KeymapLayer(context) {
|