opencode-codex-memory 0.11.0 → 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 +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 +52 -0
- package/dist/src/v2/panel-messages.js +198 -0
- package/dist/src/v2/panel-status.d.ts +6 -4
- package/dist/src/v2/panel-status.js +21 -12
- 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 +576 -108
- package/dist/tools/control.d.ts +1 -0
- package/dist/tools/control.js +81 -4
- package/package.json +7 -7
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,11 @@ 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 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));
|
|
285
374
|
}
|
|
286
375
|
function elapsed(time, now) {
|
|
287
376
|
const minutes = Math.max(0, Math.floor((now - time) / 60000));
|
|
@@ -329,16 +418,15 @@ function pipelineRows(s, now) {
|
|
|
329
418
|
},
|
|
330
419
|
{
|
|
331
420
|
label: `${version} consolidation`,
|
|
332
|
-
value: pipeline
|
|
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,
|
|
333
422
|
tone: pipeline.lastError ? "warn" : "muted"
|
|
334
423
|
},
|
|
335
424
|
...pipeline.lastError ? [{ label: `${version} last error`, value: pipeline.lastError, tone: "warn" }] : []
|
|
336
425
|
];
|
|
337
426
|
});
|
|
338
427
|
}
|
|
339
|
-
function
|
|
428
|
+
function diagnosticRows(s, now) {
|
|
340
429
|
return [
|
|
341
|
-
{ label: "Activity", value: activityLabels[s.activity] },
|
|
342
430
|
{ label: "Memory version", value: `${s.sessionVersion} (default ${s.version})` },
|
|
343
431
|
{ label: "Learning pipelines", value: s.dualWrite ? "v1 + v2" : s.version },
|
|
344
432
|
{
|
|
@@ -346,7 +434,7 @@ function statusRows(s, now, { includeReadinessDiagnostic = true } = {}) {
|
|
|
346
434
|
value: `${s.v2Ready ? "Ready" : "Not ready"} \xB7 ${s.v2ConsolidatedThreads}/${s.minConsolidatedThreads} sessions`,
|
|
347
435
|
tone: s.v2Ready ? "ok" : "muted"
|
|
348
436
|
},
|
|
349
|
-
...
|
|
437
|
+
...s.v2NotReadyReason ? [{ label: "V2 not ready", value: s.v2NotReadyReason, tone: "muted" }] : [],
|
|
350
438
|
...s.v2SummaryBytes !== undefined ? [
|
|
351
439
|
{
|
|
352
440
|
label: "V2 summary",
|
|
@@ -354,7 +442,13 @@ function statusRows(s, now, { includeReadinessDiagnostic = true } = {}) {
|
|
|
354
442
|
tone: "muted"
|
|
355
443
|
}
|
|
356
444
|
] : [],
|
|
357
|
-
...pipelineRows(s, now)
|
|
445
|
+
...pipelineRows(s, now)
|
|
446
|
+
];
|
|
447
|
+
}
|
|
448
|
+
function statusRows(s, now) {
|
|
449
|
+
return [
|
|
450
|
+
{ label: "Activity", value: activityLabels[s.activity] },
|
|
451
|
+
...diagnosticRows(s, now),
|
|
358
452
|
{ label: "Use memories", value: s.useMemories ? "On" : "Off", tone: s.useMemories ? "ok" : "muted" },
|
|
359
453
|
{
|
|
360
454
|
label: "Learn from sessions",
|
|
@@ -390,6 +484,184 @@ function configRows(s) {
|
|
|
390
484
|
];
|
|
391
485
|
}
|
|
392
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
|
+
|
|
393
665
|
// src/v2/tui.tsx
|
|
394
666
|
function registerSlot(context, name, render) {
|
|
395
667
|
const slot = context.ui.slot;
|
|
@@ -453,6 +725,11 @@ function watchStatus(rpc, context, sessionID) {
|
|
|
453
725
|
}), (listener) => rpc.events.on("changed", listener));
|
|
454
726
|
}
|
|
455
727
|
var TABS = ["Overview", "Controls"];
|
|
728
|
+
var RETRY_KEYS = {
|
|
729
|
+
extraction: "e",
|
|
730
|
+
consolidation: "c"
|
|
731
|
+
};
|
|
732
|
+
var RETRY_PHASES = Object.keys(RETRY_KEYS);
|
|
456
733
|
function MemoryDialog(context, sessionID) {
|
|
457
734
|
const rpc = context.client.rpc(MemoryStatusRpc);
|
|
458
735
|
const {
|
|
@@ -471,8 +748,28 @@ function MemoryDialog(context, sessionID) {
|
|
|
471
748
|
const [busy, setBusy] = createSignal2(null);
|
|
472
749
|
const [armed, setArmed] = createSignal2(false);
|
|
473
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
|
+
});
|
|
474
771
|
const call = async (id, method, input, done) => {
|
|
475
|
-
if (busy() || unavailable())
|
|
772
|
+
if (busy() || unavailable() || status()?.activity === "stopping")
|
|
476
773
|
return;
|
|
477
774
|
setBusy(id);
|
|
478
775
|
setNotice(null);
|
|
@@ -487,16 +784,18 @@ function MemoryDialog(context, sessionID) {
|
|
|
487
784
|
if (method === "consolidateNow" ? reply?.status !== "started" : reply?.ok !== true) {
|
|
488
785
|
throw new Error(reply?.message ?? "The server did not apply the request. Refresh and try again.");
|
|
489
786
|
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
787
|
+
if (done)
|
|
788
|
+
setNotice({
|
|
789
|
+
message: done,
|
|
790
|
+
tone: "ok"
|
|
791
|
+
});
|
|
494
792
|
await refresh();
|
|
495
793
|
} catch (error) {
|
|
496
794
|
if (signal.aborted)
|
|
497
795
|
return;
|
|
796
|
+
const label = method === "retryFailed" ? "Couldn\u2019t start retry" : "Failed";
|
|
498
797
|
setNotice({
|
|
499
|
-
message:
|
|
798
|
+
message: `${label}: ${error instanceof Error ? error.message : String(error)}`,
|
|
500
799
|
tone: "error"
|
|
501
800
|
});
|
|
502
801
|
await refresh();
|
|
@@ -505,6 +804,28 @@ function MemoryDialog(context, sessionID) {
|
|
|
505
804
|
setBusy(null);
|
|
506
805
|
}
|
|
507
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
|
+
};
|
|
508
829
|
const controls = () => {
|
|
509
830
|
const s = status();
|
|
510
831
|
if (!s)
|
|
@@ -544,7 +865,7 @@ function MemoryDialog(context, sessionID) {
|
|
|
544
865
|
}, learning ? "This session is excluded from future learning." : "This session is eligible when global learning is on.")
|
|
545
866
|
});
|
|
546
867
|
}
|
|
547
|
-
const running = isMemoryRunning(s);
|
|
868
|
+
const running = isMemoryRunning(s, updatedAt());
|
|
548
869
|
list.push({
|
|
549
870
|
id: "now",
|
|
550
871
|
title: "Consolidate now",
|
|
@@ -636,6 +957,7 @@ function MemoryDialog(context, sessionID) {
|
|
|
636
957
|
event.stopPropagation();
|
|
637
958
|
action();
|
|
638
959
|
};
|
|
960
|
+
const retryShortcuts = () => RETRY_PHASES.filter(canRetry).map((phase) => `${RETRY_KEYS[phase]} retry ${phase}`).join(" \xB7 ");
|
|
639
961
|
context.keymap.layer(() => ({
|
|
640
962
|
mode: "modal",
|
|
641
963
|
commands: [...["left", "shift+tab"].map((bind) => ({
|
|
@@ -680,6 +1002,21 @@ function MemoryDialog(context, sessionID) {
|
|
|
680
1002
|
run: () => {
|
|
681
1003
|
refresh();
|
|
682
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
|
|
683
1020
|
}, ...["return", "space"].map((bind) => ({
|
|
684
1021
|
title: "Change selected control",
|
|
685
1022
|
bind,
|
|
@@ -776,8 +1113,8 @@ function MemoryDialog(context, sessionID) {
|
|
|
776
1113
|
_$setProp(_el$22, "paddingLeft", 1);
|
|
777
1114
|
_$setProp(_el$22, "paddingRight", 1);
|
|
778
1115
|
_$insert(_el$23, (() => {
|
|
779
|
-
var _c$
|
|
780
|
-
return () => _c$
|
|
1116
|
+
var _c$5 = _$memo(() => tab() === t);
|
|
1117
|
+
return () => _c$5() ? (() => {
|
|
781
1118
|
var _el$24 = _$createElement("b");
|
|
782
1119
|
_$insert(_el$24, t);
|
|
783
1120
|
return _el$24;
|
|
@@ -805,7 +1142,7 @@ function MemoryDialog(context, sessionID) {
|
|
|
805
1142
|
_$setProp(_el$25, "marginTop", 1);
|
|
806
1143
|
_$setProp(_el$25, "flexShrink", 0);
|
|
807
1144
|
_$setProp(_el$26, "wrapMode", "word");
|
|
808
|
-
_$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.");
|
|
809
1146
|
_$effect((_$p) => _$setProp(_el$26, "fg", color.error, _$p));
|
|
810
1147
|
return _el$25;
|
|
811
1148
|
})() : _$createElement("box");
|
|
@@ -834,8 +1171,8 @@ function MemoryDialog(context, sessionID) {
|
|
|
834
1171
|
var _el$28 = _$createElement("box");
|
|
835
1172
|
_$setProp(_el$28, "flexDirection", "column");
|
|
836
1173
|
_$insert(_el$28, (() => {
|
|
837
|
-
var _c$
|
|
838
|
-
return () => _c$
|
|
1174
|
+
var _c$6 = _$memo(() => notice()?.tone === "error");
|
|
1175
|
+
return () => _c$6() ? _$createComponent(Note, {
|
|
839
1176
|
get fg() {
|
|
840
1177
|
return color.error;
|
|
841
1178
|
},
|
|
@@ -844,6 +1181,120 @@ function MemoryDialog(context, sessionID) {
|
|
|
844
1181
|
}
|
|
845
1182
|
}) : _$createElement("box");
|
|
846
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);
|
|
847
1298
|
_$insert(_el$28, _$createComponent(Section, {
|
|
848
1299
|
title: "Status"
|
|
849
1300
|
}), null);
|
|
@@ -853,27 +1304,27 @@ function MemoryDialog(context, sessionID) {
|
|
|
853
1304
|
}
|
|
854
1305
|
}), null);
|
|
855
1306
|
_$insert(_el$28, (() => {
|
|
856
|
-
var _c$
|
|
857
|
-
return () => _c$
|
|
858
|
-
var _el$
|
|
859
|
-
_$setProp(_el$
|
|
860
|
-
_$setProp(_el$
|
|
861
|
-
_$insert(_el$
|
|
862
|
-
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"
|
|
863
1314
|
}), null);
|
|
864
|
-
_$insert(_el$
|
|
1315
|
+
_$insert(_el$44, _$createComponent(For, {
|
|
865
1316
|
get each() {
|
|
866
|
-
return
|
|
1317
|
+
return diagnostics();
|
|
867
1318
|
},
|
|
868
1319
|
children: (w) => (() => {
|
|
869
|
-
var _el$
|
|
870
|
-
_$setProp(_el$
|
|
871
|
-
_$insert(_el$
|
|
872
|
-
_$effect((_$p) => _$setProp(_el$
|
|
873
|
-
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;
|
|
874
1325
|
})()
|
|
875
1326
|
}), null);
|
|
876
|
-
return _el$
|
|
1327
|
+
return _el$44;
|
|
877
1328
|
})() : _$createElement("box");
|
|
878
1329
|
})(), null);
|
|
879
1330
|
_$insert(_el$28, _$createComponent(Section, {
|
|
@@ -900,10 +1351,10 @@ function MemoryDialog(context, sessionID) {
|
|
|
900
1351
|
}), null);
|
|
901
1352
|
return _el$28;
|
|
902
1353
|
})() : (() => {
|
|
903
|
-
var _el$
|
|
904
|
-
_$setProp(_el$
|
|
905
|
-
_$setProp(_el$
|
|
906
|
-
_$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, {
|
|
907
1358
|
get each() {
|
|
908
1359
|
return controls();
|
|
909
1360
|
},
|
|
@@ -913,49 +1364,49 @@ function MemoryDialog(context, sessionID) {
|
|
|
913
1364
|
const fg = () => selected() ? color.selectedText : disabled() ? color.muted : color.text;
|
|
914
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";
|
|
915
1366
|
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$
|
|
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;
|
|
939
1390
|
})() : c.title;
|
|
940
1391
|
})());
|
|
941
|
-
_$setProp(_el$
|
|
942
|
-
_$insert(_el$
|
|
943
|
-
_$insertNode(_el$
|
|
944
|
-
_$setProp(_el$
|
|
945
|
-
_$setProp(_el$
|
|
946
|
-
_$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);
|
|
947
1398
|
_$effect((_p$) => {
|
|
948
|
-
var _v$
|
|
1399
|
+
var _v$24 = `memory-control-${c.id}`, _v$25 = selected() ? color.selectedBg : undefined, _v$26 = click(() => {
|
|
949
1400
|
select(i());
|
|
950
1401
|
activate(i());
|
|
951
|
-
}), _v$
|
|
952
|
-
_v$
|
|
953
|
-
_v$
|
|
954
|
-
_v$
|
|
955
|
-
_v$
|
|
956
|
-
_v$
|
|
957
|
-
_v$
|
|
958
|
-
_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));
|
|
959
1410
|
return _p$;
|
|
960
1411
|
}, {
|
|
961
1412
|
e: undefined,
|
|
@@ -966,40 +1417,57 @@ function MemoryDialog(context, sessionID) {
|
|
|
966
1417
|
n: undefined,
|
|
967
1418
|
s: undefined
|
|
968
1419
|
});
|
|
969
|
-
return _el$
|
|
1420
|
+
return _el$48;
|
|
970
1421
|
})();
|
|
971
1422
|
}
|
|
972
1423
|
}), null);
|
|
973
|
-
_$insert(_el$
|
|
1424
|
+
_$insert(_el$47, _$createComponent(Note, {
|
|
974
1425
|
get fg() {
|
|
975
1426
|
return color.muted;
|
|
976
1427
|
},
|
|
977
1428
|
children: "The first two toggles affect all projects until the server restarts. Set plugin options in opencode.json(c) to keep them."
|
|
978
1429
|
}), null);
|
|
979
|
-
return _el$
|
|
1430
|
+
return _el$47;
|
|
980
1431
|
})();
|
|
981
1432
|
})());
|
|
982
1433
|
_$insert(_el$9, (() => {
|
|
983
1434
|
var _c$3 = _$memo(() => !!(!unavailable() && (busy() || notice())));
|
|
984
1435
|
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$
|
|
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;
|
|
993
1444
|
})());
|
|
994
|
-
_$effect((_$p) => _$setProp(_el$
|
|
995
|
-
return _el$
|
|
996
|
-
})() : _$
|
|
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");
|
|
997
1455
|
})(), _el$18);
|
|
998
1456
|
_$insertNode(_el$18, _el$19);
|
|
999
1457
|
_$insertNode(_el$18, _el$21);
|
|
1000
1458
|
_$setProp(_el$18, "flexDirection", "column");
|
|
1001
1459
|
_$setProp(_el$18, "marginTop", 1);
|
|
1002
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);
|
|
1003
1471
|
_$insertNode(_el$19, _el$20);
|
|
1004
1472
|
_$insert(_el$19, () => tab() === "Controls" ? "select" : "scroll", null);
|
|
1005
1473
|
_$insert(_el$21, () => tab() === "Controls" ? "Enter/Space change" : "PgUp/PgDn page \xB7 Home/End ends");
|
|
@@ -1052,27 +1520,27 @@ function StatusPanel(context, sessionID) {
|
|
|
1052
1520
|
return palette.muted;
|
|
1053
1521
|
};
|
|
1054
1522
|
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$
|
|
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`));
|
|
1064
1532
|
_$effect((_p$) => {
|
|
1065
|
-
var _v$
|
|
1066
|
-
_v$
|
|
1067
|
-
_v$
|
|
1068
|
-
_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));
|
|
1069
1537
|
return _p$;
|
|
1070
1538
|
}, {
|
|
1071
1539
|
e: undefined,
|
|
1072
1540
|
t: undefined,
|
|
1073
1541
|
a: undefined
|
|
1074
1542
|
});
|
|
1075
|
-
return _el$
|
|
1543
|
+
return _el$61;
|
|
1076
1544
|
})();
|
|
1077
1545
|
}
|
|
1078
1546
|
function KeymapLayer(context) {
|