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.
- package/README.md +4 -2
- package/dist/gui-experimental.cjs +1 -1
- package/dist/src/capture.d.ts +2 -2
- package/dist/src/capture.js +4 -4
- package/dist/src/index.d.ts +1 -1
- 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/panel-messages.d.ts +53 -0
- package/dist/src/v2/panel-messages.js +223 -0
- package/dist/src/v2/panel-status.d.ts +7 -4
- package/dist/src/v2/panel-status.js +31 -13
- package/dist/src/v2/plugin.js +21 -2
- package/dist/src/v2/status-rpc.d.ts +94 -0
- package/dist/src/v2/status-rpc.js +70 -2
- package/dist/src/v2/status.js +50 -28
- package/dist/src/v2/tools.js +3 -2
- package/dist/src/v2/tui.js +611 -108
- package/dist/tools/control.d.ts +1 -0
- package/dist/tools/control.js +81 -4
- package/package.json +10 -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 { createSignal as createSignal2, For } from "solid-js";
|
|
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
|
}
|
|
@@ -280,8 +366,23 @@ function watchMemoryStatus(read, subscribe) {
|
|
|
280
366
|
refresh();
|
|
281
367
|
return { status, unavailable, refreshing, updatedAt, refresh, signal: lifetime.signal };
|
|
282
368
|
}
|
|
283
|
-
function
|
|
284
|
-
return
|
|
369
|
+
function hasConsolidationLease(pipeline, now) {
|
|
370
|
+
return pipeline.phase2Status === "running" && (pipeline.phase2LeaseUntil == null || pipeline.phase2LeaseUntil > now);
|
|
371
|
+
}
|
|
372
|
+
function activeMemoryWork(status, now) {
|
|
373
|
+
if (status.manualRetry?.state === "running")
|
|
374
|
+
return "retry";
|
|
375
|
+
if (status.activity === "consolidating")
|
|
376
|
+
return "consolidation";
|
|
377
|
+
if (status.activity === "extracting")
|
|
378
|
+
return "extraction";
|
|
379
|
+
if (status.pipelines.some((pipeline) => hasConsolidationLease(pipeline, now)))
|
|
380
|
+
return "consolidation";
|
|
381
|
+
if (status.pipelines.some((pipeline) => pipeline.extracting > 0))
|
|
382
|
+
return "extraction";
|
|
383
|
+
}
|
|
384
|
+
function isMemoryRunning(status, now = Date.now()) {
|
|
385
|
+
return activeMemoryWork(status, now) !== undefined;
|
|
285
386
|
}
|
|
286
387
|
function elapsed(time, now) {
|
|
287
388
|
const minutes = Math.max(0, Math.floor((now - time) / 60000));
|
|
@@ -329,16 +430,15 @@ function pipelineRows(s, now) {
|
|
|
329
430
|
},
|
|
330
431
|
{
|
|
331
432
|
label: `${version} consolidation`,
|
|
332
|
-
value: pipeline
|
|
433
|
+
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,
|
|
333
434
|
tone: pipeline.lastError ? "warn" : "muted"
|
|
334
435
|
},
|
|
335
436
|
...pipeline.lastError ? [{ label: `${version} last error`, value: pipeline.lastError, tone: "warn" }] : []
|
|
336
437
|
];
|
|
337
438
|
});
|
|
338
439
|
}
|
|
339
|
-
function
|
|
440
|
+
function diagnosticRows(s, now) {
|
|
340
441
|
return [
|
|
341
|
-
{ label: "Activity", value: activityLabels[s.activity] },
|
|
342
442
|
{ label: "Memory version", value: `${s.sessionVersion} (default ${s.version})` },
|
|
343
443
|
{ label: "Learning pipelines", value: s.dualWrite ? "v1 + v2" : s.version },
|
|
344
444
|
{
|
|
@@ -346,7 +446,7 @@ function statusRows(s, now, { includeReadinessDiagnostic = true } = {}) {
|
|
|
346
446
|
value: `${s.v2Ready ? "Ready" : "Not ready"} \xB7 ${s.v2ConsolidatedThreads}/${s.minConsolidatedThreads} sessions`,
|
|
347
447
|
tone: s.v2Ready ? "ok" : "muted"
|
|
348
448
|
},
|
|
349
|
-
...
|
|
449
|
+
...s.v2NotReadyReason ? [{ label: "V2 not ready", value: s.v2NotReadyReason, tone: "muted" }] : [],
|
|
350
450
|
...s.v2SummaryBytes !== undefined ? [
|
|
351
451
|
{
|
|
352
452
|
label: "V2 summary",
|
|
@@ -354,7 +454,13 @@ function statusRows(s, now, { includeReadinessDiagnostic = true } = {}) {
|
|
|
354
454
|
tone: "muted"
|
|
355
455
|
}
|
|
356
456
|
] : [],
|
|
357
|
-
...pipelineRows(s, now)
|
|
457
|
+
...pipelineRows(s, now)
|
|
458
|
+
];
|
|
459
|
+
}
|
|
460
|
+
function statusRows(s, now) {
|
|
461
|
+
return [
|
|
462
|
+
{ label: "Activity", value: activityLabels[s.activity] },
|
|
463
|
+
...diagnosticRows(s, now),
|
|
358
464
|
{ label: "Use memories", value: s.useMemories ? "On" : "Off", tone: s.useMemories ? "ok" : "muted" },
|
|
359
465
|
{
|
|
360
466
|
label: "Learn from sessions",
|
|
@@ -390,6 +496,197 @@ function configRows(s) {
|
|
|
390
496
|
];
|
|
391
497
|
}
|
|
392
498
|
|
|
499
|
+
// src/v2/panel-messages.ts
|
|
500
|
+
var memoryHelp = {
|
|
501
|
+
models: { label: "Background model setup", path: "configuration.md#choose-background-models" },
|
|
502
|
+
providers: { label: "Open provider settings", path: null },
|
|
503
|
+
backup: { label: "Set up backup models", path: "configuration.md#backup-models" },
|
|
504
|
+
configuration: { label: "Memory configuration", path: "configuration.md#where-to-put-options" },
|
|
505
|
+
service: { label: "Check the OpenCode service", path: "troubleshooting.md#check-opencodes-server" },
|
|
506
|
+
troubleshooting: { label: "Troubleshooting", path: "troubleshooting.md#common-symptoms" },
|
|
507
|
+
codex: { label: "Codex import setup", path: "integrations.md#sharing-memory-with-the-codex-cli" }
|
|
508
|
+
};
|
|
509
|
+
function memoryHelpURL(help) {
|
|
510
|
+
const page = memoryHelp[help].path;
|
|
511
|
+
return page === null ? null : `https://github.com/moritzfl/opencode-codex-memory/blob/main/docs/${page}`;
|
|
512
|
+
}
|
|
513
|
+
var retryLabels = {
|
|
514
|
+
extraction: { action: "Retry extraction", result: "Extraction retry" },
|
|
515
|
+
consolidation: { action: "Retry consolidation", result: "Consolidation retry" }
|
|
516
|
+
};
|
|
517
|
+
var retryWaitMessages = {
|
|
518
|
+
retry: "A memory retry is already running. Wait for it to finish.",
|
|
519
|
+
consolidation: "A background memory update is running. You can retry when it finishes.",
|
|
520
|
+
extraction: "Memory is learning from sessions. You can retry when that finishes."
|
|
521
|
+
};
|
|
522
|
+
function retryDescription(times, now) {
|
|
523
|
+
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.";
|
|
524
|
+
}
|
|
525
|
+
function noticeMessage(kind, details, now, offersRetry, retryBlockedReason, supportsRetry, sessionID) {
|
|
526
|
+
const canRetry = offersRetry && !retryBlockedReason;
|
|
527
|
+
switch (kind) {
|
|
528
|
+
case "extraction_exhausted": {
|
|
529
|
+
const current = sessionID ? details.find((notice) => notice.sessionID === sessionID) : undefined;
|
|
530
|
+
const affected = current ?? details[0];
|
|
531
|
+
const recovery = modelRecoveryGuidance(details.filter((notice) => notice.sessionID === affected?.sessionID).map((notice) => notice.detail ?? ""), "extraction");
|
|
532
|
+
const conversation = current ? "this conversation" : "an affected conversation";
|
|
533
|
+
const nextStep = canRetry ? "Retry a batch with the current background models. No new message is needed." : offersRetry ? undefined : 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.`;
|
|
534
|
+
return {
|
|
535
|
+
title: "Learning stopped for some sessions",
|
|
536
|
+
description: [recovery?.description ?? "Some conversations ran out of retries.", nextStep].filter(Boolean).join(" "),
|
|
537
|
+
help: recovery?.help ?? "troubleshooting",
|
|
538
|
+
warning: true,
|
|
539
|
+
affectedSessionID: current ? undefined : affected?.sessionID,
|
|
540
|
+
details
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
case "extraction_retry":
|
|
544
|
+
case "consolidation_failed": {
|
|
545
|
+
const extraction = kind === "extraction_retry";
|
|
546
|
+
const phase = extraction ? "Extraction" : "Consolidation";
|
|
547
|
+
const recovery = modelRecoveryGuidance(details.map((notice) => notice.detail ?? ""), extraction ? "extraction" : "consolidation");
|
|
548
|
+
const times = details.map((notice) => notice.retryAt ?? 0);
|
|
549
|
+
const waiting = times.every((time) => time > now);
|
|
550
|
+
const retry = retryDescription(times, now);
|
|
551
|
+
return {
|
|
552
|
+
title: recovery || retryBlockedReason ? `${phase} failed` : waiting ? `${phase} waiting to retry` : `${phase} can retry`,
|
|
553
|
+
description: [
|
|
554
|
+
recovery?.description ?? (extraction ? "Learning from some sessions failed." : "The last memory update failed."),
|
|
555
|
+
offersRetry && retryBlockedReason ? "" : retry,
|
|
556
|
+
canRetry ? "You can retry now with the current models." : ""
|
|
557
|
+
].filter(Boolean).join(" "),
|
|
558
|
+
help: recovery?.help ?? (extraction ? undefined : "troubleshooting"),
|
|
559
|
+
warning: !!recovery,
|
|
560
|
+
details
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
case "provider_capacity":
|
|
564
|
+
return {
|
|
565
|
+
title: "Provider rate limit or quota",
|
|
566
|
+
description: details.every((notice) => (notice.retryAt ?? 0) > now) ? retryDescription(details.map((notice) => notice.retryAt ?? 0), now) : canRetry ? "If the provider allows requests again, retry with the current background models." : "Learning can resume when the provider allows requests again.",
|
|
567
|
+
help: "backup",
|
|
568
|
+
details
|
|
569
|
+
};
|
|
570
|
+
case "configuration":
|
|
571
|
+
return {
|
|
572
|
+
title: "Check memory configuration",
|
|
573
|
+
description: "OpenCode ignored or adjusted some memory options. Correct the options listed below.",
|
|
574
|
+
help: "configuration",
|
|
575
|
+
warning: true,
|
|
576
|
+
details
|
|
577
|
+
};
|
|
578
|
+
case "consolidator_setup":
|
|
579
|
+
return {
|
|
580
|
+
title: "Memory agent needs attention",
|
|
581
|
+
description: "Check for overrides of the memorize agent. Restore the plugin's default agent permissions.",
|
|
582
|
+
help: "troubleshooting",
|
|
583
|
+
warning: true,
|
|
584
|
+
details
|
|
585
|
+
};
|
|
586
|
+
case "discovery":
|
|
587
|
+
return {
|
|
588
|
+
title: "Learning is limited to recent activity",
|
|
589
|
+
description: "Memory can only see conversations this server has observed. Check the OpenCode service to restore access to past sessions.",
|
|
590
|
+
help: "service",
|
|
591
|
+
warning: true,
|
|
592
|
+
details
|
|
593
|
+
};
|
|
594
|
+
case "codex_import":
|
|
595
|
+
return {
|
|
596
|
+
title: "Codex import is blocked",
|
|
597
|
+
description: "Check the Codex home and memory paths. OpenCode can still learn from its own conversations.",
|
|
598
|
+
help: "codex",
|
|
599
|
+
warning: true,
|
|
600
|
+
details
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
function memoryMessages(status, now, sessionID) {
|
|
605
|
+
if (status.activity === "stopping")
|
|
606
|
+
return [{ title: "Memory is stopping", description: "Wait for OpenCode to reconnect." }];
|
|
607
|
+
const work = activeMemoryWork(status, now);
|
|
608
|
+
const retryBlockedReason = !status.generateMemories ? "Turn on Learn from sessions to retry." : work ? retryWaitMessages[work] : undefined;
|
|
609
|
+
const shownRetries = new Set;
|
|
610
|
+
const messages = MEMORY_NOTICE_KINDS.flatMap((kind) => {
|
|
611
|
+
const notices = status.notices?.filter((notice) => notice.kind === kind) ?? [];
|
|
612
|
+
if (!notices.length)
|
|
613
|
+
return [];
|
|
614
|
+
const retryPhases = [];
|
|
615
|
+
if (status.manualRetry !== undefined) {
|
|
616
|
+
for (const { retryPhase } of notices) {
|
|
617
|
+
if (!retryPhase || shownRetries.has(retryPhase))
|
|
618
|
+
continue;
|
|
619
|
+
retryPhases.push(retryPhase);
|
|
620
|
+
shownRetries.add(retryPhase);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
const offersRetry = retryPhases.length > 0;
|
|
624
|
+
return [
|
|
625
|
+
{
|
|
626
|
+
...noticeMessage(kind, notices, now, offersRetry, retryBlockedReason, status.manualRetry !== undefined, sessionID),
|
|
627
|
+
retryPhases,
|
|
628
|
+
retryBlockedReason: offersRetry ? retryBlockedReason : undefined
|
|
629
|
+
}
|
|
630
|
+
];
|
|
631
|
+
});
|
|
632
|
+
if (status.manualRetry?.state === "running")
|
|
633
|
+
return [{ title: `Retrying ${status.manualRetry.phase}\u2026`, description: status.manualRetry.message }, ...messages];
|
|
634
|
+
if (status.generateMemories) {
|
|
635
|
+
const active = status.pipelines.filter((pipeline) => status.dualWrite || pipeline.version === status.version);
|
|
636
|
+
if (status.activity === "consolidating") {
|
|
637
|
+
messages.unshift({ title: "Consolidating memories", description: "Updating the memory files used for recall." });
|
|
638
|
+
} else if (status.activity === "extracting") {
|
|
639
|
+
messages.unshift({
|
|
640
|
+
title: "Learning from sessions",
|
|
641
|
+
description: "Saving useful context from eligible conversations."
|
|
642
|
+
});
|
|
643
|
+
} else if (active.some((pipeline) => hasConsolidationLease(pipeline, now))) {
|
|
644
|
+
messages.unshift({
|
|
645
|
+
title: "Waiting for consolidation",
|
|
646
|
+
description: "A consolidation lock is active. Wait for the run to finish or for the lock to expire."
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
if (messages.length)
|
|
650
|
+
return messages.sort((a, b) => Number(!!b.warning) - Number(!!a.warning));
|
|
651
|
+
if (status.notices === undefined && status.activity === "error")
|
|
652
|
+
return [
|
|
653
|
+
{
|
|
654
|
+
title: "Check memory status",
|
|
655
|
+
description: "See the reported warnings, or ask the agent to run memory_inspect for recent errors.",
|
|
656
|
+
warning: true,
|
|
657
|
+
help: "troubleshooting"
|
|
658
|
+
}
|
|
659
|
+
];
|
|
660
|
+
if (status.notices === undefined && status.activity === "retrying")
|
|
661
|
+
return [
|
|
662
|
+
{
|
|
663
|
+
title: "Waiting to retry",
|
|
664
|
+
description: retryDescription([status.retryAt ?? 0], now)
|
|
665
|
+
}
|
|
666
|
+
];
|
|
667
|
+
const queued = active.filter((pipeline) => pipeline.phase2Status === "pending");
|
|
668
|
+
if (queued.length) {
|
|
669
|
+
const cooldowns = queued.map((pipeline) => pipeline.phase2CooldownUntil ?? 0);
|
|
670
|
+
return [
|
|
671
|
+
{
|
|
672
|
+
title: "Consolidation queued",
|
|
673
|
+
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."
|
|
674
|
+
}
|
|
675
|
+
];
|
|
676
|
+
}
|
|
677
|
+
return [
|
|
678
|
+
{
|
|
679
|
+
title: "Idle",
|
|
680
|
+
description: "OpenCode checks for eligible idle conversations on new activity."
|
|
681
|
+
}
|
|
682
|
+
];
|
|
683
|
+
}
|
|
684
|
+
return [
|
|
685
|
+
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." },
|
|
686
|
+
...messages
|
|
687
|
+
];
|
|
688
|
+
}
|
|
689
|
+
|
|
393
690
|
// src/v2/tui.tsx
|
|
394
691
|
function registerSlot(context, name, render) {
|
|
395
692
|
const slot = context.ui.slot;
|
|
@@ -453,6 +750,11 @@ function watchStatus(rpc, context, sessionID) {
|
|
|
453
750
|
}), (listener) => rpc.events.on("changed", listener));
|
|
454
751
|
}
|
|
455
752
|
var TABS = ["Overview", "Controls"];
|
|
753
|
+
var RETRY_KEYS = {
|
|
754
|
+
extraction: "e",
|
|
755
|
+
consolidation: "c"
|
|
756
|
+
};
|
|
757
|
+
var RETRY_PHASES = Object.keys(RETRY_KEYS);
|
|
456
758
|
function MemoryDialog(context, sessionID) {
|
|
457
759
|
const rpc = context.client.rpc(MemoryStatusRpc);
|
|
458
760
|
const {
|
|
@@ -471,8 +773,28 @@ function MemoryDialog(context, sessionID) {
|
|
|
471
773
|
const [busy, setBusy] = createSignal2(null);
|
|
472
774
|
const [armed, setArmed] = createSignal2(false);
|
|
473
775
|
let scroll;
|
|
776
|
+
const messages = createMemo(() => {
|
|
777
|
+
const snapshot = status();
|
|
778
|
+
return snapshot && !unavailable() ? memoryMessages(snapshot, updatedAt(), sessionID) : [];
|
|
779
|
+
});
|
|
780
|
+
const retry = () => unavailable() ? null : status()?.manualRetry;
|
|
781
|
+
const retryResult = () => retry()?.state === "running" ? null : retry();
|
|
782
|
+
const retryDisabled = () => {
|
|
783
|
+
const snapshot = status();
|
|
784
|
+
return busy() !== null || !snapshot?.generateMemories || snapshot.activity === "stopping" || isMemoryRunning(snapshot, updatedAt());
|
|
785
|
+
};
|
|
786
|
+
const canRetry = (phase) => !retryDisabled() && messages().some((message) => message.retryPhases?.includes(phase));
|
|
787
|
+
const needsProvider = () => messages().some((message) => message.help === "providers");
|
|
788
|
+
const affectedSession = () => messages().find((message) => message.affectedSessionID)?.affectedSessionID;
|
|
789
|
+
const diagnostics = createMemo(() => {
|
|
790
|
+
const snapshot = status();
|
|
791
|
+
return snapshot?.notices === undefined || unavailable() ? snapshot?.warnings ?? [] : messages().flatMap((message) => (message.details ?? []).flatMap(({
|
|
792
|
+
detail,
|
|
793
|
+
version
|
|
794
|
+
}) => detail ? [`${version ? `${version.toUpperCase()}: ` : ""}${detail}`] : []));
|
|
795
|
+
});
|
|
474
796
|
const call = async (id, method, input, done) => {
|
|
475
|
-
if (busy() || unavailable())
|
|
797
|
+
if (busy() || unavailable() || status()?.activity === "stopping")
|
|
476
798
|
return;
|
|
477
799
|
setBusy(id);
|
|
478
800
|
setNotice(null);
|
|
@@ -487,16 +809,18 @@ function MemoryDialog(context, sessionID) {
|
|
|
487
809
|
if (method === "consolidateNow" ? reply?.status !== "started" : reply?.ok !== true) {
|
|
488
810
|
throw new Error(reply?.message ?? "The server did not apply the request. Refresh and try again.");
|
|
489
811
|
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
812
|
+
if (done)
|
|
813
|
+
setNotice({
|
|
814
|
+
message: done,
|
|
815
|
+
tone: "ok"
|
|
816
|
+
});
|
|
494
817
|
await refresh();
|
|
495
818
|
} catch (error) {
|
|
496
819
|
if (signal.aborted)
|
|
497
820
|
return;
|
|
821
|
+
const label = method === "retryFailed" ? "Couldn\u2019t start retry" : "Failed";
|
|
498
822
|
setNotice({
|
|
499
|
-
message:
|
|
823
|
+
message: `${label}: ${error instanceof Error ? error.message : String(error)}`,
|
|
500
824
|
tone: "error"
|
|
501
825
|
});
|
|
502
826
|
await refresh();
|
|
@@ -505,6 +829,28 @@ function MemoryDialog(context, sessionID) {
|
|
|
505
829
|
setBusy(null);
|
|
506
830
|
}
|
|
507
831
|
};
|
|
832
|
+
const startRetry = (phase) => {
|
|
833
|
+
if (!canRetry(phase))
|
|
834
|
+
return;
|
|
835
|
+
scroll?.scrollTo(0);
|
|
836
|
+
call("retry", "retryFailed", {
|
|
837
|
+
phase
|
|
838
|
+
});
|
|
839
|
+
};
|
|
840
|
+
const openProviders = () => {
|
|
841
|
+
context.ui.dialog.clear();
|
|
842
|
+
context.keymap.dispatch("provider.connect");
|
|
843
|
+
};
|
|
844
|
+
const openAffected = () => {
|
|
845
|
+
const id = affectedSession();
|
|
846
|
+
if (!id)
|
|
847
|
+
return;
|
|
848
|
+
context.ui.dialog.clear();
|
|
849
|
+
context.ui.router.navigate({
|
|
850
|
+
type: "session",
|
|
851
|
+
sessionID: id
|
|
852
|
+
});
|
|
853
|
+
};
|
|
508
854
|
const controls = () => {
|
|
509
855
|
const s = status();
|
|
510
856
|
if (!s)
|
|
@@ -544,7 +890,7 @@ function MemoryDialog(context, sessionID) {
|
|
|
544
890
|
}, learning ? "This session is excluded from future learning." : "This session is eligible when global learning is on.")
|
|
545
891
|
});
|
|
546
892
|
}
|
|
547
|
-
const running = isMemoryRunning(s);
|
|
893
|
+
const running = isMemoryRunning(s, updatedAt());
|
|
548
894
|
list.push({
|
|
549
895
|
id: "now",
|
|
550
896
|
title: "Consolidate now",
|
|
@@ -636,6 +982,7 @@ function MemoryDialog(context, sessionID) {
|
|
|
636
982
|
event.stopPropagation();
|
|
637
983
|
action();
|
|
638
984
|
};
|
|
985
|
+
const retryShortcuts = () => RETRY_PHASES.filter(canRetry).map((phase) => `${RETRY_KEYS[phase]} retry ${phase}`).join(" \xB7 ");
|
|
639
986
|
context.keymap.layer(() => ({
|
|
640
987
|
mode: "modal",
|
|
641
988
|
commands: [...["left", "shift+tab"].map((bind) => ({
|
|
@@ -680,6 +1027,21 @@ function MemoryDialog(context, sessionID) {
|
|
|
680
1027
|
run: () => {
|
|
681
1028
|
refresh();
|
|
682
1029
|
}
|
|
1030
|
+
}, ...RETRY_PHASES.map((phase) => ({
|
|
1031
|
+
title: retryLabels[phase].action,
|
|
1032
|
+
bind: RETRY_KEYS[phase],
|
|
1033
|
+
enabled: () => tab() === "Overview" && canRetry(phase),
|
|
1034
|
+
run: () => startRetry(phase)
|
|
1035
|
+
})), {
|
|
1036
|
+
title: memoryHelp.providers.label,
|
|
1037
|
+
bind: "p",
|
|
1038
|
+
enabled: () => tab() === "Overview" && needsProvider(),
|
|
1039
|
+
run: openProviders
|
|
1040
|
+
}, {
|
|
1041
|
+
title: "Open affected session",
|
|
1042
|
+
bind: "s",
|
|
1043
|
+
enabled: () => tab() === "Overview" && !!affectedSession(),
|
|
1044
|
+
run: openAffected
|
|
683
1045
|
}, ...["return", "space"].map((bind) => ({
|
|
684
1046
|
title: "Change selected control",
|
|
685
1047
|
bind,
|
|
@@ -776,8 +1138,8 @@ function MemoryDialog(context, sessionID) {
|
|
|
776
1138
|
_$setProp(_el$22, "paddingLeft", 1);
|
|
777
1139
|
_$setProp(_el$22, "paddingRight", 1);
|
|
778
1140
|
_$insert(_el$23, (() => {
|
|
779
|
-
var _c$
|
|
780
|
-
return () => _c$
|
|
1141
|
+
var _c$5 = _$memo(() => tab() === t);
|
|
1142
|
+
return () => _c$5() ? (() => {
|
|
781
1143
|
var _el$24 = _$createElement("b");
|
|
782
1144
|
_$insert(_el$24, t);
|
|
783
1145
|
return _el$24;
|
|
@@ -805,7 +1167,7 @@ function MemoryDialog(context, sessionID) {
|
|
|
805
1167
|
_$setProp(_el$25, "marginTop", 1);
|
|
806
1168
|
_$setProp(_el$25, "flexShrink", 0);
|
|
807
1169
|
_$setProp(_el$26, "wrapMode", "word");
|
|
808
|
-
_$insert(_el$26, () => status() ? "Offline: last known status. Press r to
|
|
1170
|
+
_$insert(_el$26, () => status() ? "Offline: last known status. Press r to reconnect." : "Memory status unavailable. Press r to reconnect.");
|
|
809
1171
|
_$effect((_$p) => _$setProp(_el$26, "fg", color.error, _$p));
|
|
810
1172
|
return _el$25;
|
|
811
1173
|
})() : _$createElement("box");
|
|
@@ -834,8 +1196,8 @@ function MemoryDialog(context, sessionID) {
|
|
|
834
1196
|
var _el$28 = _$createElement("box");
|
|
835
1197
|
_$setProp(_el$28, "flexDirection", "column");
|
|
836
1198
|
_$insert(_el$28, (() => {
|
|
837
|
-
var _c$
|
|
838
|
-
return () => _c$
|
|
1199
|
+
var _c$6 = _$memo(() => notice()?.tone === "error");
|
|
1200
|
+
return () => _c$6() ? _$createComponent(Note, {
|
|
839
1201
|
get fg() {
|
|
840
1202
|
return color.error;
|
|
841
1203
|
},
|
|
@@ -844,6 +1206,130 @@ function MemoryDialog(context, sessionID) {
|
|
|
844
1206
|
}
|
|
845
1207
|
}) : _$createElement("box");
|
|
846
1208
|
})(), null);
|
|
1209
|
+
_$insert(_el$28, (() => {
|
|
1210
|
+
var _c$7 = _$memo(() => !!retryResult());
|
|
1211
|
+
return () => _c$7() ? _$createComponent(Note, {
|
|
1212
|
+
get fg() {
|
|
1213
|
+
return _$memo(() => retryResult().state === "completed")() ? color.ok : color.warn;
|
|
1214
|
+
},
|
|
1215
|
+
get children() {
|
|
1216
|
+
return `${retryLabels[retryResult().phase].result}: ${retryResult().message}`;
|
|
1217
|
+
}
|
|
1218
|
+
}) : _$createElement("box");
|
|
1219
|
+
})(), null);
|
|
1220
|
+
_$insert(_el$28, _$createComponent(Index, {
|
|
1221
|
+
get each() {
|
|
1222
|
+
return messages();
|
|
1223
|
+
},
|
|
1224
|
+
children: (message) => (() => {
|
|
1225
|
+
var _el$31 = _$createElement("box"), _el$32 = _$createElement("text"), _el$33 = _$createElement("b"), _el$34 = _$createElement("text");
|
|
1226
|
+
_$insertNode(_el$31, _el$32);
|
|
1227
|
+
_$insertNode(_el$31, _el$34);
|
|
1228
|
+
_$setProp(_el$31, "marginTop", 1);
|
|
1229
|
+
_$setProp(_el$31, "flexDirection", "column");
|
|
1230
|
+
_$setProp(_el$31, "flexShrink", 0);
|
|
1231
|
+
_$insertNode(_el$32, _el$33);
|
|
1232
|
+
_$setProp(_el$32, "wrapMode", "word");
|
|
1233
|
+
_$insert(_el$33, () => message().title);
|
|
1234
|
+
_$setProp(_el$34, "wrapMode", "word");
|
|
1235
|
+
_$insert(_el$34, () => message().description);
|
|
1236
|
+
_$insert(_el$31, _$createComponent(For, {
|
|
1237
|
+
get each() {
|
|
1238
|
+
return message().retryPhases;
|
|
1239
|
+
},
|
|
1240
|
+
children: (phase) => (() => {
|
|
1241
|
+
var _el$35 = _$createElement("text");
|
|
1242
|
+
_$setProp(_el$35, "wrapMode", "word");
|
|
1243
|
+
_$insert(_el$35, (() => {
|
|
1244
|
+
var _c$10 = _$memo(() => !!canRetry(phase));
|
|
1245
|
+
return () => _c$10() ? `[${RETRY_KEYS[phase]}] ` : "";
|
|
1246
|
+
})(), null);
|
|
1247
|
+
_$insert(_el$35, () => retryLabels[phase].action, null);
|
|
1248
|
+
_$insert(_el$35, () => canRetry(phase) ? "" : " (unavailable)", null);
|
|
1249
|
+
_$effect((_p$) => {
|
|
1250
|
+
var _v$16 = canRetry(phase) ? color.text : color.muted, _v$17 = click(() => startRetry(phase));
|
|
1251
|
+
_v$16 !== _p$.e && (_p$.e = _$setProp(_el$35, "fg", _v$16, _p$.e));
|
|
1252
|
+
_v$17 !== _p$.t && (_p$.t = _$setProp(_el$35, "onMouseUp", _v$17, _p$.t));
|
|
1253
|
+
return _p$;
|
|
1254
|
+
}, {
|
|
1255
|
+
e: undefined,
|
|
1256
|
+
t: undefined
|
|
1257
|
+
});
|
|
1258
|
+
return _el$35;
|
|
1259
|
+
})()
|
|
1260
|
+
}), null);
|
|
1261
|
+
_$insert(_el$31, (() => {
|
|
1262
|
+
var _c$9 = _$memo(() => !!message().retryBlockedReason);
|
|
1263
|
+
return () => _c$9() ? (() => {
|
|
1264
|
+
var _el$36 = _$createElement("text");
|
|
1265
|
+
_$setProp(_el$36, "wrapMode", "word");
|
|
1266
|
+
_$insert(_el$36, () => message().retryBlockedReason);
|
|
1267
|
+
_$effect((_$p) => _$setProp(_el$36, "fg", color.muted, _$p));
|
|
1268
|
+
return _el$36;
|
|
1269
|
+
})() : _$createElement("box");
|
|
1270
|
+
})(), null);
|
|
1271
|
+
_$insert(_el$31, (() => {
|
|
1272
|
+
var _c$0 = _$memo(() => message().help === "providers");
|
|
1273
|
+
return () => _c$0() ? (() => {
|
|
1274
|
+
var _el$38 = _$createElement("text"), _el$39 = _$createTextNode(`[p] `);
|
|
1275
|
+
_$insertNode(_el$38, _el$39);
|
|
1276
|
+
_$insert(_el$38, () => memoryHelp.providers.label, null);
|
|
1277
|
+
_$effect((_p$) => {
|
|
1278
|
+
var _v$18 = color.text, _v$19 = click(openProviders);
|
|
1279
|
+
_v$18 !== _p$.e && (_p$.e = _$setProp(_el$38, "fg", _v$18, _p$.e));
|
|
1280
|
+
_v$19 !== _p$.t && (_p$.t = _$setProp(_el$38, "onMouseUp", _v$19, _p$.t));
|
|
1281
|
+
return _p$;
|
|
1282
|
+
}, {
|
|
1283
|
+
e: undefined,
|
|
1284
|
+
t: undefined
|
|
1285
|
+
});
|
|
1286
|
+
return _el$38;
|
|
1287
|
+
})() : _$memo(() => !!message().help)() ? (() => {
|
|
1288
|
+
var _el$40 = _$createElement("text"), _el$41 = _$createElement("a");
|
|
1289
|
+
_$insertNode(_el$40, _el$41);
|
|
1290
|
+
_$setProp(_el$40, "wrapMode", "word");
|
|
1291
|
+
_$insert(_el$41, () => memoryHelp[message().help].label);
|
|
1292
|
+
_$effect((_p$) => {
|
|
1293
|
+
var _v$20 = color.text, _v$21 = memoryHelpURL(message().help);
|
|
1294
|
+
_v$20 !== _p$.e && (_p$.e = _$setProp(_el$40, "fg", _v$20, _p$.e));
|
|
1295
|
+
_v$21 !== _p$.t && (_p$.t = _$setProp(_el$41, "href", _v$21, _p$.t));
|
|
1296
|
+
return _p$;
|
|
1297
|
+
}, {
|
|
1298
|
+
e: undefined,
|
|
1299
|
+
t: undefined
|
|
1300
|
+
});
|
|
1301
|
+
return _el$40;
|
|
1302
|
+
})() : _$createElement("box");
|
|
1303
|
+
})(), null);
|
|
1304
|
+
_$insert(_el$31, (() => {
|
|
1305
|
+
var _c$1 = _$memo(() => !!message().affectedSessionID);
|
|
1306
|
+
return () => _c$1() ? (() => {
|
|
1307
|
+
var _el$43 = _$createElement("text");
|
|
1308
|
+
_$insertNode(_el$43, _$createTextNode(`[s] Open affected session`));
|
|
1309
|
+
_$effect((_p$) => {
|
|
1310
|
+
var _v$22 = color.text, _v$23 = click(openAffected);
|
|
1311
|
+
_v$22 !== _p$.e && (_p$.e = _$setProp(_el$43, "fg", _v$22, _p$.e));
|
|
1312
|
+
_v$23 !== _p$.t && (_p$.t = _$setProp(_el$43, "onMouseUp", _v$23, _p$.t));
|
|
1313
|
+
return _p$;
|
|
1314
|
+
}, {
|
|
1315
|
+
e: undefined,
|
|
1316
|
+
t: undefined
|
|
1317
|
+
});
|
|
1318
|
+
return _el$43;
|
|
1319
|
+
})() : _$createElement("box");
|
|
1320
|
+
})(), null);
|
|
1321
|
+
_$effect((_p$) => {
|
|
1322
|
+
var _v$14 = message().warning ? color.warn : color.text, _v$15 = color.muted;
|
|
1323
|
+
_v$14 !== _p$.e && (_p$.e = _$setProp(_el$32, "fg", _v$14, _p$.e));
|
|
1324
|
+
_v$15 !== _p$.t && (_p$.t = _$setProp(_el$34, "fg", _v$15, _p$.t));
|
|
1325
|
+
return _p$;
|
|
1326
|
+
}, {
|
|
1327
|
+
e: undefined,
|
|
1328
|
+
t: undefined
|
|
1329
|
+
});
|
|
1330
|
+
return _el$31;
|
|
1331
|
+
})()
|
|
1332
|
+
}), null);
|
|
847
1333
|
_$insert(_el$28, _$createComponent(Section, {
|
|
848
1334
|
title: "Status"
|
|
849
1335
|
}), null);
|
|
@@ -853,27 +1339,27 @@ function MemoryDialog(context, sessionID) {
|
|
|
853
1339
|
}
|
|
854
1340
|
}), null);
|
|
855
1341
|
_$insert(_el$28, (() => {
|
|
856
|
-
var _c$
|
|
857
|
-
return () => _c$
|
|
858
|
-
var _el$
|
|
859
|
-
_$setProp(_el$
|
|
860
|
-
_$setProp(_el$
|
|
861
|
-
_$insert(_el$
|
|
862
|
-
title: "
|
|
1342
|
+
var _c$8 = _$memo(() => diagnostics().length > 0);
|
|
1343
|
+
return () => _c$8() ? (() => {
|
|
1344
|
+
var _el$46 = _$createElement("box");
|
|
1345
|
+
_$setProp(_el$46, "flexDirection", "column");
|
|
1346
|
+
_$setProp(_el$46, "flexShrink", 0);
|
|
1347
|
+
_$insert(_el$46, _$createComponent(Section, {
|
|
1348
|
+
title: "Diagnostic details"
|
|
863
1349
|
}), null);
|
|
864
|
-
_$insert(_el$
|
|
1350
|
+
_$insert(_el$46, _$createComponent(For, {
|
|
865
1351
|
get each() {
|
|
866
|
-
return
|
|
1352
|
+
return diagnostics();
|
|
867
1353
|
},
|
|
868
1354
|
children: (w) => (() => {
|
|
869
|
-
var _el$
|
|
870
|
-
_$setProp(_el$
|
|
871
|
-
_$insert(_el$
|
|
872
|
-
_$effect((_$p) => _$setProp(_el$
|
|
873
|
-
return _el$
|
|
1355
|
+
var _el$47 = _$createElement("text");
|
|
1356
|
+
_$setProp(_el$47, "wrapMode", "word");
|
|
1357
|
+
_$insert(_el$47, `! ${w}`);
|
|
1358
|
+
_$effect((_$p) => _$setProp(_el$47, "fg", color.warn, _$p));
|
|
1359
|
+
return _el$47;
|
|
874
1360
|
})()
|
|
875
1361
|
}), null);
|
|
876
|
-
return _el$
|
|
1362
|
+
return _el$46;
|
|
877
1363
|
})() : _$createElement("box");
|
|
878
1364
|
})(), null);
|
|
879
1365
|
_$insert(_el$28, _$createComponent(Section, {
|
|
@@ -900,10 +1386,10 @@ function MemoryDialog(context, sessionID) {
|
|
|
900
1386
|
}), null);
|
|
901
1387
|
return _el$28;
|
|
902
1388
|
})() : (() => {
|
|
903
|
-
var _el$
|
|
904
|
-
_$setProp(_el$
|
|
905
|
-
_$setProp(_el$
|
|
906
|
-
_$insert(_el$
|
|
1389
|
+
var _el$49 = _$createElement("box");
|
|
1390
|
+
_$setProp(_el$49, "flexDirection", "column");
|
|
1391
|
+
_$setProp(_el$49, "marginTop", 1);
|
|
1392
|
+
_$insert(_el$49, _$createComponent(For, {
|
|
907
1393
|
get each() {
|
|
908
1394
|
return controls();
|
|
909
1395
|
},
|
|
@@ -913,49 +1399,49 @@ function MemoryDialog(context, sessionID) {
|
|
|
913
1399
|
const fg = () => selected() ? color.selectedText : disabled() ? color.muted : color.text;
|
|
914
1400
|
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";
|
|
915
1401
|
return (() => {
|
|
916
|
-
var _el$
|
|
917
|
-
_$insertNode(_el$
|
|
918
|
-
_$insertNode(_el$
|
|
919
|
-
_$setProp(_el$
|
|
920
|
-
_$setProp(_el$
|
|
921
|
-
_$setProp(_el$
|
|
922
|
-
_$setProp(_el$
|
|
923
|
-
_$insertNode(_el$
|
|
924
|
-
_$insertNode(_el$
|
|
925
|
-
_$insertNode(_el$
|
|
926
|
-
_$setProp(_el$
|
|
927
|
-
_$setProp(_el$
|
|
928
|
-
_$setProp(_el$
|
|
929
|
-
_$insert(_el$
|
|
930
|
-
_$setProp(_el$
|
|
931
|
-
_$setProp(_el$
|
|
932
|
-
_$setProp(_el$
|
|
933
|
-
_$insert(_el$
|
|
934
|
-
var _c$
|
|
935
|
-
return () => _c$
|
|
936
|
-
var _el$
|
|
937
|
-
_$insert(_el$
|
|
938
|
-
return _el$
|
|
1402
|
+
var _el$50 = _$createElement("box"), _el$51 = _$createElement("box"), _el$52 = _$createElement("text"), _el$53 = _$createElement("text"), _el$54 = _$createElement("text"), _el$55 = _$createElement("box"), _el$56 = _$createElement("text");
|
|
1403
|
+
_$insertNode(_el$50, _el$51);
|
|
1404
|
+
_$insertNode(_el$50, _el$55);
|
|
1405
|
+
_$setProp(_el$50, "flexDirection", "column");
|
|
1406
|
+
_$setProp(_el$50, "flexShrink", 0);
|
|
1407
|
+
_$setProp(_el$50, "paddingLeft", 1);
|
|
1408
|
+
_$setProp(_el$50, "paddingRight", 1);
|
|
1409
|
+
_$insertNode(_el$51, _el$52);
|
|
1410
|
+
_$insertNode(_el$51, _el$53);
|
|
1411
|
+
_$insertNode(_el$51, _el$54);
|
|
1412
|
+
_$setProp(_el$51, "flexDirection", "row");
|
|
1413
|
+
_$setProp(_el$51, "gap", 1);
|
|
1414
|
+
_$setProp(_el$52, "flexShrink", 0);
|
|
1415
|
+
_$insert(_el$52, () => selected() ? "\u203A" : " ");
|
|
1416
|
+
_$setProp(_el$53, "flexGrow", 1);
|
|
1417
|
+
_$setProp(_el$53, "flexShrink", 1);
|
|
1418
|
+
_$setProp(_el$53, "wrapMode", "word");
|
|
1419
|
+
_$insert(_el$53, (() => {
|
|
1420
|
+
var _c$11 = _$memo(() => !!selected());
|
|
1421
|
+
return () => _c$11() ? (() => {
|
|
1422
|
+
var _el$57 = _$createElement("b");
|
|
1423
|
+
_$insert(_el$57, () => c.title);
|
|
1424
|
+
return _el$57;
|
|
939
1425
|
})() : c.title;
|
|
940
1426
|
})());
|
|
941
|
-
_$setProp(_el$
|
|
942
|
-
_$insert(_el$
|
|
943
|
-
_$insertNode(_el$
|
|
944
|
-
_$setProp(_el$
|
|
945
|
-
_$setProp(_el$
|
|
946
|
-
_$insert(_el$
|
|
1427
|
+
_$setProp(_el$54, "flexShrink", 0);
|
|
1428
|
+
_$insert(_el$54, state);
|
|
1429
|
+
_$insertNode(_el$55, _el$56);
|
|
1430
|
+
_$setProp(_el$55, "paddingLeft", 2);
|
|
1431
|
+
_$setProp(_el$56, "wrapMode", "word");
|
|
1432
|
+
_$insert(_el$56, () => c.hint);
|
|
947
1433
|
_$effect((_p$) => {
|
|
948
|
-
var _v$
|
|
1434
|
+
var _v$24 = `memory-control-${c.id}`, _v$25 = selected() ? color.selectedBg : undefined, _v$26 = click(() => {
|
|
949
1435
|
select(i());
|
|
950
1436
|
activate(i());
|
|
951
|
-
}), _v$
|
|
952
|
-
_v$
|
|
953
|
-
_v$
|
|
954
|
-
_v$
|
|
955
|
-
_v$
|
|
956
|
-
_v$
|
|
957
|
-
_v$
|
|
958
|
-
_v$
|
|
1437
|
+
}), _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;
|
|
1438
|
+
_v$24 !== _p$.e && (_p$.e = _$setProp(_el$50, "id", _v$24, _p$.e));
|
|
1439
|
+
_v$25 !== _p$.t && (_p$.t = _$setProp(_el$50, "backgroundColor", _v$25, _p$.t));
|
|
1440
|
+
_v$26 !== _p$.a && (_p$.a = _$setProp(_el$50, "onMouseUp", _v$26, _p$.a));
|
|
1441
|
+
_v$27 !== _p$.o && (_p$.o = _$setProp(_el$52, "fg", _v$27, _p$.o));
|
|
1442
|
+
_v$28 !== _p$.i && (_p$.i = _$setProp(_el$53, "fg", _v$28, _p$.i));
|
|
1443
|
+
_v$29 !== _p$.n && (_p$.n = _$setProp(_el$54, "fg", _v$29, _p$.n));
|
|
1444
|
+
_v$30 !== _p$.s && (_p$.s = _$setProp(_el$56, "fg", _v$30, _p$.s));
|
|
959
1445
|
return _p$;
|
|
960
1446
|
}, {
|
|
961
1447
|
e: undefined,
|
|
@@ -966,40 +1452,57 @@ function MemoryDialog(context, sessionID) {
|
|
|
966
1452
|
n: undefined,
|
|
967
1453
|
s: undefined
|
|
968
1454
|
});
|
|
969
|
-
return _el$
|
|
1455
|
+
return _el$50;
|
|
970
1456
|
})();
|
|
971
1457
|
}
|
|
972
1458
|
}), null);
|
|
973
|
-
_$insert(_el$
|
|
1459
|
+
_$insert(_el$49, _$createComponent(Note, {
|
|
974
1460
|
get fg() {
|
|
975
1461
|
return color.muted;
|
|
976
1462
|
},
|
|
977
1463
|
children: "The first two toggles affect all projects until the server restarts. Set plugin options in opencode.json(c) to keep them."
|
|
978
1464
|
}), null);
|
|
979
|
-
return _el$
|
|
1465
|
+
return _el$49;
|
|
980
1466
|
})();
|
|
981
1467
|
})());
|
|
982
1468
|
_$insert(_el$9, (() => {
|
|
983
1469
|
var _c$3 = _$memo(() => !!(!unavailable() && (busy() || notice())));
|
|
984
1470
|
return () => _c$3() ? (() => {
|
|
985
|
-
var _el$
|
|
986
|
-
_$insertNode(_el$
|
|
987
|
-
_$setProp(_el$
|
|
988
|
-
_$setProp(_el$
|
|
989
|
-
_$setProp(_el$
|
|
990
|
-
_$insert(_el$
|
|
991
|
-
var _c$
|
|
992
|
-
return () => _c$
|
|
1471
|
+
var _el$58 = _$createElement("box"), _el$59 = _$createElement("text");
|
|
1472
|
+
_$insertNode(_el$58, _el$59);
|
|
1473
|
+
_$setProp(_el$58, "marginTop", 1);
|
|
1474
|
+
_$setProp(_el$58, "flexShrink", 0);
|
|
1475
|
+
_$setProp(_el$59, "wrapMode", "word");
|
|
1476
|
+
_$insert(_el$59, (() => {
|
|
1477
|
+
var _c$12 = _$memo(() => !!busy());
|
|
1478
|
+
return () => _c$12() ? 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;
|
|
993
1479
|
})());
|
|
994
|
-
_$effect((_$p) => _$setProp(_el$
|
|
995
|
-
return _el$
|
|
996
|
-
})() : _$
|
|
1480
|
+
_$effect((_$p) => _$setProp(_el$59, "fg", busy() ? color.muted : notice()?.tone === "error" ? color.error : notice()?.tone === "warn" ? color.warn : color.ok, _$p));
|
|
1481
|
+
return _el$58;
|
|
1482
|
+
})() : _$memo(() => !!(tab() === "Controls" && retry()))() ? _$createComponent(Note, {
|
|
1483
|
+
get fg() {
|
|
1484
|
+
return color.muted;
|
|
1485
|
+
},
|
|
1486
|
+
get children() {
|
|
1487
|
+
return _$memo(() => retry().state === "running")() ? `Retrying ${retry().phase}\u2026` : `${retryLabels[retry().phase].result}: ${retry().state}. See Overview.`;
|
|
1488
|
+
}
|
|
1489
|
+
}) : _$createElement("box");
|
|
997
1490
|
})(), _el$18);
|
|
998
1491
|
_$insertNode(_el$18, _el$19);
|
|
999
1492
|
_$insertNode(_el$18, _el$21);
|
|
1000
1493
|
_$setProp(_el$18, "flexDirection", "column");
|
|
1001
1494
|
_$setProp(_el$18, "marginTop", 1);
|
|
1002
1495
|
_$setProp(_el$18, "flexShrink", 0);
|
|
1496
|
+
_$insert(_el$18, (() => {
|
|
1497
|
+
var _c$4 = _$memo(() => !!(tab() === "Overview" && retryShortcuts()));
|
|
1498
|
+
return () => _c$4() ? (() => {
|
|
1499
|
+
var _el$61 = _$createElement("text");
|
|
1500
|
+
_$setProp(_el$61, "wrapMode", "word");
|
|
1501
|
+
_$insert(_el$61, retryShortcuts);
|
|
1502
|
+
_$effect((_$p) => _$setProp(_el$61, "fg", color.text, _$p));
|
|
1503
|
+
return _el$61;
|
|
1504
|
+
})() : _$createElement("box");
|
|
1505
|
+
})(), _el$19);
|
|
1003
1506
|
_$insertNode(_el$19, _el$20);
|
|
1004
1507
|
_$insert(_el$19, () => tab() === "Controls" ? "select" : "scroll", null);
|
|
1005
1508
|
_$insert(_el$21, () => tab() === "Controls" ? "Enter/Space change" : "PgUp/PgDn page \xB7 Home/End ends");
|
|
@@ -1052,27 +1555,27 @@ function StatusPanel(context, sessionID) {
|
|
|
1052
1555
|
return palette.muted;
|
|
1053
1556
|
};
|
|
1054
1557
|
return (() => {
|
|
1055
|
-
var _el$
|
|
1056
|
-
_$insertNode(_el$
|
|
1057
|
-
_$insertNode(_el$
|
|
1058
|
-
_$insertNode(_el$
|
|
1059
|
-
_$setProp(_el$
|
|
1060
|
-
_$insertNode(_el$
|
|
1061
|
-
_$insertNode(_el$
|
|
1062
|
-
_$insert(_el$
|
|
1063
|
-
_$insertNode(_el$
|
|
1558
|
+
var _el$63 = _$createElement("box"), _el$64 = _$createElement("text"), _el$66 = _$createElement("text"), _el$67 = _$createTextNode(`\u25CF `), _el$68 = _$createElement("text");
|
|
1559
|
+
_$insertNode(_el$63, _el$64);
|
|
1560
|
+
_$insertNode(_el$63, _el$66);
|
|
1561
|
+
_$insertNode(_el$63, _el$68);
|
|
1562
|
+
_$setProp(_el$63, "flexDirection", "column");
|
|
1563
|
+
_$insertNode(_el$64, _$createTextNode(`Memory`));
|
|
1564
|
+
_$insertNode(_el$66, _el$67);
|
|
1565
|
+
_$insert(_el$66, title, null);
|
|
1566
|
+
_$insertNode(_el$68, _$createTextNode(` /memory-inspect`));
|
|
1064
1567
|
_$effect((_p$) => {
|
|
1065
|
-
var _v$
|
|
1066
|
-
_v$
|
|
1067
|
-
_v$
|
|
1068
|
-
_v$
|
|
1568
|
+
var _v$31 = palette.text, _v$32 = color(), _v$33 = palette.muted;
|
|
1569
|
+
_v$31 !== _p$.e && (_p$.e = _$setProp(_el$64, "fg", _v$31, _p$.e));
|
|
1570
|
+
_v$32 !== _p$.t && (_p$.t = _$setProp(_el$66, "fg", _v$32, _p$.t));
|
|
1571
|
+
_v$33 !== _p$.a && (_p$.a = _$setProp(_el$68, "fg", _v$33, _p$.a));
|
|
1069
1572
|
return _p$;
|
|
1070
1573
|
}, {
|
|
1071
1574
|
e: undefined,
|
|
1072
1575
|
t: undefined,
|
|
1073
1576
|
a: undefined
|
|
1074
1577
|
});
|
|
1075
|
-
return _el$
|
|
1578
|
+
return _el$63;
|
|
1076
1579
|
})();
|
|
1077
1580
|
}
|
|
1078
1581
|
function KeymapLayer(context) {
|