pantheon-opencode 2.0.0-beta.3 → 2.0.0-beta.5
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/CHANGELOG.md +28 -66
- package/README.md +18 -5
- package/bin/pantheon-init.mjs +1 -2
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/pyproject.toml +1 -1
- package/scripts/changelog-format.mjs +345 -0
- package/scripts/changelog-merge.mjs +5 -10
- package/scripts/docs-check-changelog.mjs +36 -137
- package/scripts/install/interactive.mjs +5 -254
- package/scripts/install/opencode.mjs +6 -75
- package/scripts/release-gates.mjs +33 -13
- package/scripts/release-notes.mjs +51 -36
- package/scripts/release-retrofit.mjs +158 -0
- package/scripts/versioning.mjs +1 -1
- package/src/plugins/tui/dist/tui.d.ts +3 -2
- package/src/plugins/tui/dist/tui.d.ts.map +1 -1
- package/src/plugins/tui/dist/tui.js +1264 -639
- package/src/plugins/tui/dist/tui.js.map +1 -1
- package/src/plugins/tui/package-lock.json +2 -2
- package/src/plugins/tui/package.json +1 -1
- package/src/plugins/tui/src/decision-router-state.ts +22 -19
- package/src/plugins/tui/src/doctor-state.ts +41 -32
- package/src/plugins/tui/src/index.tsx +107 -32
- package/src/plugins/tui/src/j1-gate-status.ts +29 -27
- package/src/plugins/tui/src/pantheon-settings-state.ts +209 -110
- package/src/plugins/tui/src/pantheon-settings.tsx +622 -270
- package/src/plugins/tui/src/preset-state.ts +21 -22
- package/src/plugins/tui/src/tui-prefs.ts +378 -0
- package/src/plugins/tui/src/update-status.ts +14 -20
|
@@ -59,6 +59,25 @@ function formatSpent(cost) {
|
|
|
59
59
|
const MODEL_USAGE_VISIBLE_CEILING = 3;
|
|
60
60
|
const MODEL_USAGE_MESSAGE_LIMIT = 400;
|
|
61
61
|
const MODEL_USAGE_SESSION_LIMIT = 8;
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/decision-router-state.ts
|
|
64
|
+
/**
|
|
65
|
+
* decision-router-state.ts — the Decision Model section of the settings window.
|
|
66
|
+
*
|
|
67
|
+
* TUI-local replica of the user-level decision-router config
|
|
68
|
+
* (scripts/install/decision-router-config.mjs — the bundle must stay
|
|
69
|
+
* self-contained); tests/tui-decision-router-state.test.mjs pins the schema
|
|
70
|
+
* version, the exact key set and the provider matrix against that source.
|
|
71
|
+
*
|
|
72
|
+
* The runtime re-reads this file on EVERY gated call (jev-decision-tool.ts),
|
|
73
|
+
* so a write here applies live — no restart. The strict exact-key schema is
|
|
74
|
+
* load-bearing: any unknown key fail-closes the runtime to disabled/local,
|
|
75
|
+
* so the writer validates before persisting.
|
|
76
|
+
*
|
|
77
|
+
* Egress consent is CLI-owned: the window never writes `egress_consent`, and
|
|
78
|
+
* refuses to enable the router while remote candidates exist without it.
|
|
79
|
+
*/
|
|
80
|
+
const DECISION_ENABLED_CYCLE = Object.freeze(["enabled", "disabled"]);
|
|
62
81
|
/** Exact top-level key set — anything else fail-closes the runtime. */
|
|
63
82
|
const DECISION_CONFIG_KEYS = Object.freeze([
|
|
64
83
|
"egress_consent",
|
|
@@ -203,30 +222,33 @@ function writeDecisionRouterConfig(config, env = process.env) {
|
|
|
203
222
|
renameSync(temp, path);
|
|
204
223
|
chmodSync(path, 384);
|
|
205
224
|
}
|
|
206
|
-
function
|
|
225
|
+
function buildDecisionTab(read) {
|
|
207
226
|
const { config, corrupt } = read;
|
|
208
227
|
const rows = [{
|
|
209
228
|
id: "decision.enabled",
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
229
|
+
name: "Router",
|
|
230
|
+
value: config.enabled ? "enabled" : "disabled",
|
|
231
|
+
...corrupt ? {} : { cycle: DECISION_ENABLED_CYCLE },
|
|
232
|
+
note: corrupt ? "config unreadable/invalid — runtime fail-closes; repair via `decision-router setup-model`" : "applies live — the runtime re-reads this on every gated call"
|
|
213
233
|
}, {
|
|
214
234
|
id: "decision.selection",
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
235
|
+
name: "Selection",
|
|
236
|
+
value: `${config.selection.mode}${config.selection.provider ? ` · ${config.selection.provider}` : ""}`,
|
|
237
|
+
note: "local routes on-device; auto/explicit pick a remote decision model"
|
|
218
238
|
}];
|
|
219
239
|
if (config.enabled_candidates.length > 0) rows.push({
|
|
220
240
|
id: "decision.candidates",
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
241
|
+
name: "Candidates",
|
|
242
|
+
value: String(config.enabled_candidates.length),
|
|
243
|
+
note: config.egress_consent ? config.enabled_candidates.map((candidate) => `${candidate.provider}/${candidate.model}`).join(", ") : "egress consent NOT granted — remote routes fail closed"
|
|
224
244
|
});
|
|
225
245
|
return {
|
|
226
246
|
id: "decision",
|
|
227
|
-
title: "Decision
|
|
228
|
-
|
|
229
|
-
|
|
247
|
+
title: "Decision",
|
|
248
|
+
groups: [{
|
|
249
|
+
title: "Decision router",
|
|
250
|
+
rows
|
|
251
|
+
}]
|
|
230
252
|
};
|
|
231
253
|
}
|
|
232
254
|
//#endregion
|
|
@@ -280,38 +302,11 @@ new Set(SETTINGS_BEHAVIORS.map((b) => b.id));
|
|
|
280
302
|
function isBehaviorDisabled(effective, id) {
|
|
281
303
|
return effective[id]?.action === "disable";
|
|
282
304
|
}
|
|
283
|
-
/** The rows up/down can reach and enter can dispatch on, in order. */
|
|
284
|
-
function selectableRows(section) {
|
|
285
|
-
return section.rows.filter((row) => row.selectable !== false);
|
|
286
|
-
}
|
|
287
|
-
/** Flat selection order across every section of the window. */
|
|
288
|
-
function flatSelectableRows(sections) {
|
|
289
|
-
return sections.flatMap((section) => selectableRows(section));
|
|
290
|
-
}
|
|
291
|
-
function firstSelectableId(sections) {
|
|
292
|
-
return flatSelectableRows(sections)[0]?.id;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Merge for DISPLAY only, mirroring the runtime precedence: the project file
|
|
296
|
-
* wins per id (whole entry). The window still writes only the global file.
|
|
297
|
-
*/
|
|
298
|
-
function mergedOverrides(load) {
|
|
299
|
-
return {
|
|
300
|
-
...load.global,
|
|
301
|
-
...load.project
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
function canWriteOverrides(load) {
|
|
305
|
-
return !load.corruptGlobal;
|
|
306
|
-
}
|
|
307
305
|
const TOGGLE_REASON = "toggled in /pantheon-settings";
|
|
308
306
|
/**
|
|
309
|
-
* Toggle
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
* disabling keeps its `content` under the disable entry, and re-enabling
|
|
313
|
-
* restores the replace. A settings-written disable (no content) is removed
|
|
314
|
-
* outright so the overrides file does not accumulate toggle noise.
|
|
307
|
+
* Toggle (a targeted write keeps the toggle semantics: a `replace` entry is
|
|
308
|
+
* never destroyed — disabling keeps its `content`, re-enabling restores the
|
|
309
|
+
* replace; a settings-written disable is removed outright, no toggle noise).
|
|
315
310
|
*/
|
|
316
311
|
function toggledOverrides(effective, id, reason = TOGGLE_REASON) {
|
|
317
312
|
const next = { ...effective };
|
|
@@ -336,64 +331,142 @@ function toggledOverrides(effective, id, reason = TOGGLE_REASON) {
|
|
|
336
331
|
};
|
|
337
332
|
return next;
|
|
338
333
|
}
|
|
334
|
+
/** Set an explicit on/off target (the cycler's save path) via the toggle semantics. */
|
|
335
|
+
function setOverrideState(effective, id, target, reason = TOGGLE_REASON) {
|
|
336
|
+
const disabled = isBehaviorDisabled(effective, id);
|
|
337
|
+
if (target === "disabled" === disabled) return effective;
|
|
338
|
+
return toggledOverrides(effective, id, reason);
|
|
339
|
+
}
|
|
339
340
|
function serializeOverrides(effective) {
|
|
340
341
|
const ordered = {};
|
|
341
342
|
for (const id of Object.keys(effective).sort()) ordered[id] = effective[id];
|
|
342
343
|
return `${JSON.stringify(ordered, null, 2)}\n`;
|
|
343
344
|
}
|
|
344
|
-
/**
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
345
|
+
/** Merge for DISPLAY only, mirroring the runtime precedence: project wins per id. */
|
|
346
|
+
function mergedOverrides(load) {
|
|
347
|
+
return {
|
|
348
|
+
...load.global,
|
|
349
|
+
...load.project
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
function canWriteOverrides(load) {
|
|
353
|
+
return !load.corruptGlobal;
|
|
354
|
+
}
|
|
355
|
+
/** Neutral tab for out-of-range indexes (noUncheckedIndexedAccess guard). */
|
|
356
|
+
const EMPTY_TAB = {
|
|
357
|
+
id: "empty",
|
|
358
|
+
title: "",
|
|
359
|
+
groups: []
|
|
360
|
+
};
|
|
361
|
+
/** Flat, in-order rows of a tab (the up/down navigation space). */
|
|
362
|
+
function tabRows(tab) {
|
|
363
|
+
return tab.groups.flatMap((group) => group.rows);
|
|
364
|
+
}
|
|
365
|
+
/** Step through the cycle with wrap-around; non-cyclable rows return the input. */
|
|
366
|
+
function cycleValue(value, cycle, direction) {
|
|
367
|
+
if (cycle.length === 0) return value;
|
|
368
|
+
const index = cycle.indexOf(value);
|
|
369
|
+
if (index === -1) return cycle[0] ?? value;
|
|
370
|
+
return cycle[(index + direction + cycle.length) % cycle.length] ?? value;
|
|
371
|
+
}
|
|
372
|
+
function stageValue(draft, row, direction) {
|
|
373
|
+
if (row.cycle === void 0) return draft;
|
|
374
|
+
const staged = cycleValue(draft[row.id] ?? row.value, row.cycle, direction);
|
|
375
|
+
if (staged === row.value) {
|
|
376
|
+
if (draft[row.id] === void 0) return draft;
|
|
377
|
+
const next = { ...draft };
|
|
378
|
+
delete next[row.id];
|
|
379
|
+
return next;
|
|
380
|
+
}
|
|
381
|
+
return {
|
|
382
|
+
...draft,
|
|
383
|
+
[row.id]: staged
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
/** Drop every staged entry of one tab (ctrl+r). */
|
|
387
|
+
function resetTab(draft, tab) {
|
|
388
|
+
const ids = new Set(tabRows(tab).map((row) => row.id));
|
|
389
|
+
const next = {};
|
|
390
|
+
for (const [id, value] of Object.entries(draft)) if (!ids.has(id)) next[id] = value;
|
|
391
|
+
return next;
|
|
392
|
+
}
|
|
393
|
+
function draftCount(draft) {
|
|
394
|
+
return Object.keys(draft).length;
|
|
395
|
+
}
|
|
396
|
+
function draftDirty(draft) {
|
|
397
|
+
return draftCount(draft) > 0;
|
|
398
|
+
}
|
|
399
|
+
function tabDirty(draft, tab) {
|
|
400
|
+
return tabRows(tab).some((row) => draft[row.id] !== void 0);
|
|
401
|
+
}
|
|
402
|
+
/** Apply every staged entry; failures are collected, never thrown. */
|
|
403
|
+
function applyDraft(draft, writer) {
|
|
404
|
+
const applied = [];
|
|
405
|
+
const failed = [];
|
|
406
|
+
for (const [id, value] of Object.entries(draft)) {
|
|
407
|
+
const result = writer(id, value);
|
|
408
|
+
if (result.ok) applied.push(id);
|
|
409
|
+
else failed.push({
|
|
410
|
+
id,
|
|
411
|
+
reason: result.reason ?? "write failed"
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
return {
|
|
415
|
+
applied,
|
|
416
|
+
failed
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
/** The rows that succeeded and are still in the draft (failed ones stay staged). */
|
|
420
|
+
function settledDraft(draft, applied) {
|
|
421
|
+
const next = {};
|
|
422
|
+
for (const [id, value] of Object.entries(draft)) if (!applied.includes(id)) next[id] = value;
|
|
423
|
+
return next;
|
|
424
|
+
}
|
|
425
|
+
const GATES_ENABLED_CYCLE = Object.freeze(["enabled", "disabled"]);
|
|
426
|
+
function buildGatesTab(load) {
|
|
350
427
|
const merged = mergedOverrides(load);
|
|
351
|
-
const
|
|
428
|
+
const rowFor = (behavior) => {
|
|
352
429
|
const fromProject = load.project[behavior.id] !== void 0;
|
|
430
|
+
const writable = !fromProject && canWriteOverrides(load);
|
|
353
431
|
return {
|
|
354
432
|
id: `gate.${behavior.id}`,
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
source: fromProject ? "project" : "global"
|
|
433
|
+
name: fromProject ? `${behavior.title} (project)` : behavior.title,
|
|
434
|
+
value: isBehaviorDisabled(merged, behavior.id) ? "disabled" : "enabled",
|
|
435
|
+
...writable ? { cycle: GATES_ENABLED_CYCLE } : {},
|
|
436
|
+
note: fromProject ? "project file wins at runtime — edit .pantheon/overrides.json" : behavior.description
|
|
360
437
|
};
|
|
361
|
-
}
|
|
438
|
+
};
|
|
439
|
+
const install = SETTINGS_BEHAVIORS.filter((behavior) => behavior.kind === "install");
|
|
440
|
+
const runtime = SETTINGS_BEHAVIORS.filter((behavior) => behavior.kind === "runtime");
|
|
362
441
|
return {
|
|
363
442
|
id: "gates",
|
|
364
|
-
title: "Gates
|
|
365
|
-
|
|
366
|
-
|
|
443
|
+
title: "Gates",
|
|
444
|
+
groups: [{
|
|
445
|
+
title: "Install skills",
|
|
446
|
+
rows: install.map(rowFor)
|
|
447
|
+
}, {
|
|
448
|
+
title: "Runtime gates",
|
|
449
|
+
rows: runtime.map(rowFor)
|
|
450
|
+
}]
|
|
367
451
|
};
|
|
368
452
|
}
|
|
369
|
-
function
|
|
453
|
+
function buildAboutTab(version) {
|
|
370
454
|
return {
|
|
371
455
|
id: "about",
|
|
372
456
|
title: "About",
|
|
373
|
-
rows: [{
|
|
457
|
+
groups: [{ rows: [{
|
|
374
458
|
id: "about.version",
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
459
|
+
name: "Version",
|
|
460
|
+
value: `v${version}`,
|
|
461
|
+
note: "OpenCode 2.x only — the V1 contract is removed"
|
|
378
462
|
}, {
|
|
379
463
|
id: "about.behaviors",
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
}]
|
|
464
|
+
name: "Behaviors",
|
|
465
|
+
value: String(SETTINGS_BEHAVIORS.length),
|
|
466
|
+
note: "docs/design/2.0-settings-and-install.md"
|
|
467
|
+
}] }]
|
|
384
468
|
};
|
|
385
469
|
}
|
|
386
|
-
//#endregion
|
|
387
|
-
//#region src/update-notice.ts
|
|
388
|
-
/**
|
|
389
|
-
* Update notifier core (TUI-local copy — the bundle must stay self-contained,
|
|
390
|
-
* same precedent as cost-data.ts/model-pricing.ts).
|
|
391
|
-
*
|
|
392
|
-
* Pin + notify, never silent auto-update: one notice per newer version,
|
|
393
|
-
* TTL-cached, offline-safe, and a stable install is never advertised a beta
|
|
394
|
-
* (the update guard owns that crossing). docs/design/2.0-settings-and-install.md
|
|
395
|
-
*/
|
|
396
|
-
const UPDATE_CHECK_TTL_MS = 216e5;
|
|
397
470
|
/** Semver-ish compare for X.Y.Z[-beta.N]; betas sort before their release. */
|
|
398
471
|
function comparePantheonVersions(left, right) {
|
|
399
472
|
const parse = (version) => {
|
|
@@ -536,46 +609,49 @@ function classifyDecisionConfigHealth(env = process.env) {
|
|
|
536
609
|
if (!existsSync(join(env.XDG_CONFIG_HOME ?? join(env.HOME ?? "", ".config"), "pantheon", "decision-router.json"))) return { status: "absent" };
|
|
537
610
|
return readDecisionRouterConfig(env).corrupt ? { status: "corrupt" } : { status: "ok" };
|
|
538
611
|
}
|
|
539
|
-
function
|
|
612
|
+
function buildDoctorTab(input) {
|
|
540
613
|
const env = input.env ?? process.env;
|
|
541
614
|
const rows = [];
|
|
542
615
|
const version = classifyInstallVersion(input.runningVersion, env);
|
|
543
616
|
rows.push({
|
|
544
617
|
id: "doctor.version",
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
selectable: false
|
|
618
|
+
name: "Install version",
|
|
619
|
+
value: version.status === "ok" ? `v${version.installed} — matches` : version.status === "older" ? `v${version.installed} older` : version.status === "newer" ? `v${version.installed} newer` : "unknown",
|
|
620
|
+
note: version.status === "older" ? "refresh with `pantheon-opencode update`" : "read from <config>/opencode/.pantheon/install-state.json"
|
|
549
621
|
});
|
|
550
622
|
const nodeOk = isSupportedNodeFloor(input.nodeVersion);
|
|
551
623
|
rows.push({
|
|
552
624
|
id: "doctor.node",
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
selectable: false
|
|
625
|
+
name: "Node runtime",
|
|
626
|
+
value: input.nodeVersion.replace(/^v/, ""),
|
|
627
|
+
note: nodeOk ? `meets the >= ${MIN_SUPPORTED_NODE_VERSION} floor` : `below the >= ${MIN_SUPPORTED_NODE_VERSION} floor — tooling may refuse`
|
|
557
628
|
});
|
|
558
629
|
const overrides = classifyOverridesHealth(input.load);
|
|
559
630
|
rows.push({
|
|
560
631
|
id: "doctor.overrides",
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
selectable: false
|
|
632
|
+
name: "Overrides",
|
|
633
|
+
value: overrides.status === "clean" ? "valid" : overrides.status === "corrupt" ? "unreadable" : `${overrides.unknownIds.length} unknown id(s)`,
|
|
634
|
+
note: overrides.status === "unknown-ids" ? `${overrides.unknownIds.join(", ")} — harmless; repair with doctor --fix` : overrides.status === "corrupt" ? "writes are refused until repaired (doctor --fix)" : "both files parse against the behavior registry"
|
|
565
635
|
});
|
|
566
636
|
const decision = classifyDecisionConfigHealth(env);
|
|
567
637
|
rows.push({
|
|
568
638
|
id: "doctor.decision",
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
selectable: false
|
|
639
|
+
name: "Decision config",
|
|
640
|
+
value: decision.status === "ok" ? "valid" : decision.status === "corrupt" ? "corrupt" : "absent",
|
|
641
|
+
note: decision.status === "corrupt" ? "runtime fail-closes to disabled · read from <config>/pantheon/decision-router.json" : "read from <config>/pantheon/decision-router.json"
|
|
573
642
|
});
|
|
574
643
|
return {
|
|
575
644
|
id: "doctor",
|
|
576
645
|
title: "Doctor",
|
|
577
|
-
|
|
578
|
-
|
|
646
|
+
groups: [{
|
|
647
|
+
title: "Health (file-derived)",
|
|
648
|
+
rows
|
|
649
|
+
}, { rows: [{
|
|
650
|
+
id: "doctor.cli",
|
|
651
|
+
name: "Full check",
|
|
652
|
+
value: "`pantheon-opencode doctor`",
|
|
653
|
+
note: "MCP smoke, venv pins, git stay in the CLI"
|
|
654
|
+
}] }]
|
|
579
655
|
};
|
|
580
656
|
}
|
|
581
657
|
//#endregion
|
|
@@ -610,36 +686,36 @@ const MODE_DESCRIPTION = {
|
|
|
610
686
|
warn: "RESERVED — behaves as shadow in this release",
|
|
611
687
|
enforce: "high-risk scores DENY the tool call (fail-open on gate unavailability)"
|
|
612
688
|
};
|
|
613
|
-
function
|
|
689
|
+
function buildJ1Tab(env, disabledByOverride) {
|
|
614
690
|
const mode = j1ModeFromEnv(env);
|
|
615
691
|
const threshold = j1ThresholdFromEnv(env);
|
|
616
692
|
const gateState = disabledByOverride ? "disabled via overrides" : mode === "off" ? "off (env unset)" : "active";
|
|
617
|
-
const rows = [
|
|
618
|
-
{
|
|
619
|
-
id: "j1.mode",
|
|
620
|
-
title: `Mode: ${mode}`,
|
|
621
|
-
description: MODE_DESCRIPTION[mode],
|
|
622
|
-
...disabledByOverride ? { marker: "[!]" } : {},
|
|
623
|
-
selectable: false
|
|
624
|
-
},
|
|
625
|
-
{
|
|
626
|
-
id: "j1.threshold",
|
|
627
|
-
title: `Enforce threshold: ${threshold}`,
|
|
628
|
-
description: "deny at or above; 0..1, default 0.8",
|
|
629
|
-
selectable: false
|
|
630
|
-
},
|
|
631
|
-
{
|
|
632
|
-
id: "j1.gate",
|
|
633
|
-
title: `Gate: ${gateState}`,
|
|
634
|
-
description: "the runtime plugin reads this once at startup",
|
|
635
|
-
selectable: false
|
|
636
|
-
}
|
|
637
|
-
];
|
|
638
693
|
return {
|
|
639
694
|
id: "j1",
|
|
640
|
-
title: "J1
|
|
641
|
-
|
|
642
|
-
|
|
695
|
+
title: "J1",
|
|
696
|
+
groups: [{
|
|
697
|
+
title: "Ladder (env-only — never written here)",
|
|
698
|
+
rows: [
|
|
699
|
+
{
|
|
700
|
+
id: "j1.mode",
|
|
701
|
+
name: "Mode",
|
|
702
|
+
value: mode,
|
|
703
|
+
note: `${MODE_DESCRIPTION[mode]} · restart applies`
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
id: "j1.threshold",
|
|
707
|
+
name: "Enforce threshold",
|
|
708
|
+
value: String(threshold),
|
|
709
|
+
note: "deny at or above · 0..1 · default 0.8"
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
id: "j1.gate",
|
|
713
|
+
name: "Gate",
|
|
714
|
+
value: gateState,
|
|
715
|
+
note: `${J1_FLAG_ENV} / ${J1_THRESHOLD_ENV} · read once at startup`
|
|
716
|
+
}
|
|
717
|
+
]
|
|
718
|
+
}]
|
|
643
719
|
};
|
|
644
720
|
}
|
|
645
721
|
//#endregion
|
|
@@ -718,35 +794,200 @@ function backupMarker(path) {
|
|
|
718
794
|
mkdirSync(dirname(path), { recursive: true });
|
|
719
795
|
copyFileSync(path, `${path}.bak`);
|
|
720
796
|
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
title: "none",
|
|
731
|
-
description: "clear the global marker — opencode defaults",
|
|
732
|
-
disabled: input.globalName === null,
|
|
733
|
-
marker: input.globalName === null ? "[x]" : "[ ]"
|
|
734
|
-
});
|
|
797
|
+
const PRESET_CYCLE = Object.freeze(["none", ...PRESET_NAMES]);
|
|
798
|
+
function buildPresetTab(input) {
|
|
799
|
+
const rows = [{
|
|
800
|
+
id: "preset",
|
|
801
|
+
name: "Preset",
|
|
802
|
+
value: input.globalName ?? "none",
|
|
803
|
+
cycle: PRESET_CYCLE,
|
|
804
|
+
note: "global marker · atomic write, .bak backup · none = opencode defaults"
|
|
805
|
+
}];
|
|
735
806
|
if (input.projectName !== null) rows.push({
|
|
736
807
|
id: "preset.project",
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
selectable: false
|
|
808
|
+
name: "Project",
|
|
809
|
+
value: input.projectName,
|
|
810
|
+
note: `${projectActivePresetPath()} wins over the global marker — read-only here`
|
|
741
811
|
});
|
|
742
812
|
return {
|
|
743
813
|
id: "preset",
|
|
744
|
-
title: "
|
|
745
|
-
|
|
746
|
-
|
|
814
|
+
title: "Preset",
|
|
815
|
+
groups: [{
|
|
816
|
+
title: "Model preset",
|
|
817
|
+
rows
|
|
818
|
+
}]
|
|
747
819
|
};
|
|
748
820
|
}
|
|
749
821
|
//#endregion
|
|
822
|
+
//#region src/tui-prefs.ts
|
|
823
|
+
const PREFS_SYMBOL = Symbol.for("pantheon.tui.prefs.v1");
|
|
824
|
+
function stash() {
|
|
825
|
+
return globalThis[PREFS_SYMBOL];
|
|
826
|
+
}
|
|
827
|
+
/** Create (or reuse) the durable prefs store. Fail-open: without host
|
|
828
|
+
* storage the consumers fall back to DEFAULT_TUI_PREFS (read-only). */
|
|
829
|
+
function initTuiPrefs(context) {
|
|
830
|
+
if (stash() !== void 0) return;
|
|
831
|
+
try {
|
|
832
|
+
const handle = context.storage?.store?.("tui-prefs", { initial: DEFAULT_TUI_PREFS });
|
|
833
|
+
if (handle !== void 0) globalThis[PREFS_SYMBOL] = handle;
|
|
834
|
+
} catch {}
|
|
835
|
+
}
|
|
836
|
+
/** The live reactive prefs (read properties inside memos/JSX — tracked). */
|
|
837
|
+
function tuiPrefs() {
|
|
838
|
+
return stash()?.[0] ?? DEFAULT_TUI_PREFS;
|
|
839
|
+
}
|
|
840
|
+
/** Stage a mutation against the durable store; resolves when persisted. */
|
|
841
|
+
function mutateTuiPrefs(mutation) {
|
|
842
|
+
const handle = stash();
|
|
843
|
+
if (handle === void 0) return Promise.resolve();
|
|
844
|
+
return handle[1](mutation);
|
|
845
|
+
}
|
|
846
|
+
const GAUGE_STYLES = Object.freeze([
|
|
847
|
+
"both",
|
|
848
|
+
"bar",
|
|
849
|
+
"percent",
|
|
850
|
+
"off"
|
|
851
|
+
]);
|
|
852
|
+
const ENABLED_CYCLE = Object.freeze(["enabled", "disabled"]);
|
|
853
|
+
const DEFAULT_TUI_PREFS = {
|
|
854
|
+
version: 1,
|
|
855
|
+
sidebar: {
|
|
856
|
+
header: {
|
|
857
|
+
version: true,
|
|
858
|
+
preset: true,
|
|
859
|
+
session: true
|
|
860
|
+
},
|
|
861
|
+
blocks: {
|
|
862
|
+
context: true,
|
|
863
|
+
git: true,
|
|
864
|
+
todo: true,
|
|
865
|
+
dispatch: true
|
|
866
|
+
},
|
|
867
|
+
context: {
|
|
868
|
+
gauge: "both",
|
|
869
|
+
tokens: true,
|
|
870
|
+
spent: true,
|
|
871
|
+
modelUsage: true,
|
|
872
|
+
performance: true,
|
|
873
|
+
localSpend: true
|
|
874
|
+
}
|
|
875
|
+
},
|
|
876
|
+
footer: {
|
|
877
|
+
prompt: true,
|
|
878
|
+
home: true
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
const onOff = ENABLED_CYCLE;
|
|
882
|
+
const row = (id, name, value, note) => ({
|
|
883
|
+
id,
|
|
884
|
+
name,
|
|
885
|
+
value: value ? "enabled" : "disabled",
|
|
886
|
+
cycle: onOff,
|
|
887
|
+
note
|
|
888
|
+
});
|
|
889
|
+
function buildTuiTab(prefs) {
|
|
890
|
+
return {
|
|
891
|
+
id: "tui",
|
|
892
|
+
title: "TUI",
|
|
893
|
+
groups: [
|
|
894
|
+
{
|
|
895
|
+
title: "Sidebar header",
|
|
896
|
+
rows: [
|
|
897
|
+
row("tui.sidebar.header.version", "Version line", prefs.sidebar.header.version, "the `Pantheon v…` line"),
|
|
898
|
+
row("tui.sidebar.header.preset", "Preset line", prefs.sidebar.header.preset, "the `▸ preset · provider` line"),
|
|
899
|
+
row("tui.sidebar.header.session", "Session line", prefs.sidebar.header.session, "the active session title")
|
|
900
|
+
]
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
title: "Sidebar blocks",
|
|
904
|
+
rows: [
|
|
905
|
+
row("tui.sidebar.block.context", "Context block", prefs.sidebar.blocks.context, "tokens, gauge, spend, model usage"),
|
|
906
|
+
row("tui.sidebar.block.git", "Git block", prefs.sidebar.blocks.git, "branch + working-tree counts"),
|
|
907
|
+
row("tui.sidebar.block.todo", "Todo block", prefs.sidebar.blocks.todo, "the newest todowrite"),
|
|
908
|
+
row("tui.sidebar.block.dispatch", "Dispatch block", prefs.sidebar.blocks.dispatch, "live delegations + rollup")
|
|
909
|
+
]
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
title: "Context block detail",
|
|
913
|
+
rows: [
|
|
914
|
+
{
|
|
915
|
+
id: "tui.sidebar.context.gauge",
|
|
916
|
+
name: "Gauge style",
|
|
917
|
+
value: prefs.sidebar.context.gauge,
|
|
918
|
+
cycle: GAUGE_STYLES,
|
|
919
|
+
note: "both | bar | percent | off — `▰▱ 42% of 200k`"
|
|
920
|
+
},
|
|
921
|
+
row("tui.sidebar.context.tokens", "Tokens row", prefs.sidebar.context.tokens, "the raw token count line"),
|
|
922
|
+
row("tui.sidebar.context.spent", "Spent row", prefs.sidebar.context.spent, "the `$… gasto na sessão` line"),
|
|
923
|
+
row("tui.sidebar.context.modelUsage", "Model usage table", prefs.sidebar.context.modelUsage, "per-model tokens/USD"),
|
|
924
|
+
row("tui.sidebar.context.performance", "Performance line", prefs.sidebar.context.performance, "cache % + tok/s"),
|
|
925
|
+
row("tui.sidebar.context.localSpend", "Local spend", prefs.sidebar.context.localSpend, "hoje / 30d totals")
|
|
926
|
+
]
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
title: "Footers",
|
|
930
|
+
rows: [row("tui.footer.prompt", "Prompt footer", prefs.footer.prompt, "the `▸preset · ✦n ativos` line while delegations run"), row("tui.footer.home", "Home status", prefs.footer.home, "the `Pantheon v…` line under the home prompt")]
|
|
931
|
+
}
|
|
932
|
+
]
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* Apply one staged row INTO a prefs draft (in place — the storage mutate
|
|
937
|
+
* callback hands an immer-style draft). Unknown ids or junk values are no-ops.
|
|
938
|
+
*/
|
|
939
|
+
function applyTuiRow(draft, id, value) {
|
|
940
|
+
const enabled = value === "enabled";
|
|
941
|
+
switch (id) {
|
|
942
|
+
case "tui.sidebar.header.version":
|
|
943
|
+
draft.sidebar.header.version = enabled;
|
|
944
|
+
return;
|
|
945
|
+
case "tui.sidebar.header.preset":
|
|
946
|
+
draft.sidebar.header.preset = enabled;
|
|
947
|
+
return;
|
|
948
|
+
case "tui.sidebar.header.session":
|
|
949
|
+
draft.sidebar.header.session = enabled;
|
|
950
|
+
return;
|
|
951
|
+
case "tui.sidebar.block.context":
|
|
952
|
+
draft.sidebar.blocks.context = enabled;
|
|
953
|
+
return;
|
|
954
|
+
case "tui.sidebar.block.git":
|
|
955
|
+
draft.sidebar.blocks.git = enabled;
|
|
956
|
+
return;
|
|
957
|
+
case "tui.sidebar.block.todo":
|
|
958
|
+
draft.sidebar.blocks.todo = enabled;
|
|
959
|
+
return;
|
|
960
|
+
case "tui.sidebar.block.dispatch":
|
|
961
|
+
draft.sidebar.blocks.dispatch = enabled;
|
|
962
|
+
return;
|
|
963
|
+
case "tui.sidebar.context.gauge":
|
|
964
|
+
if (GAUGE_STYLES.includes(value)) draft.sidebar.context.gauge = value;
|
|
965
|
+
return;
|
|
966
|
+
case "tui.sidebar.context.tokens":
|
|
967
|
+
draft.sidebar.context.tokens = enabled;
|
|
968
|
+
return;
|
|
969
|
+
case "tui.sidebar.context.spent":
|
|
970
|
+
draft.sidebar.context.spent = enabled;
|
|
971
|
+
return;
|
|
972
|
+
case "tui.sidebar.context.modelUsage":
|
|
973
|
+
draft.sidebar.context.modelUsage = enabled;
|
|
974
|
+
return;
|
|
975
|
+
case "tui.sidebar.context.performance":
|
|
976
|
+
draft.sidebar.context.performance = enabled;
|
|
977
|
+
return;
|
|
978
|
+
case "tui.sidebar.context.localSpend":
|
|
979
|
+
draft.sidebar.context.localSpend = enabled;
|
|
980
|
+
return;
|
|
981
|
+
case "tui.footer.prompt":
|
|
982
|
+
draft.footer.prompt = enabled;
|
|
983
|
+
return;
|
|
984
|
+
case "tui.footer.home":
|
|
985
|
+
draft.footer.home = enabled;
|
|
986
|
+
return;
|
|
987
|
+
default: return;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
//#endregion
|
|
750
991
|
//#region src/update-status.ts
|
|
751
992
|
/** The running version's channel: a `-beta.N` suffix rides the beta dist-tag. */
|
|
752
993
|
function updateChannelFor(version) {
|
|
@@ -765,54 +1006,74 @@ function formatAgo(ms) {
|
|
|
765
1006
|
if (ms < 864e5) return `${Math.floor(ms / 36e5)}h ago`;
|
|
766
1007
|
return `${Math.floor(ms / 864e5)}d ago`;
|
|
767
1008
|
}
|
|
768
|
-
function
|
|
1009
|
+
function buildUpdatesTab(input) {
|
|
769
1010
|
const nowMs = input.nowMs ?? Date.now();
|
|
770
1011
|
const channel = updateChannelFor(input.currentVersion);
|
|
771
1012
|
const lastCheckMs = input.state.lastCheckMs;
|
|
772
1013
|
const latest = input.lastCheckedVersion ?? input.state.lastNotifiedVersion;
|
|
773
1014
|
const rows = [{
|
|
774
1015
|
id: "update.channel",
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
1016
|
+
name: "Channel",
|
|
1017
|
+
value: channel,
|
|
1018
|
+
note: "stable tracks npm `latest`; beta tracks npm `beta`"
|
|
778
1019
|
}, {
|
|
779
1020
|
id: "update.check",
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
1021
|
+
name: "Check now",
|
|
1022
|
+
value: input.checking ? "checking…" : lastCheckMs ? `last check ${formatAgo(nowMs - lastCheckMs)}` : "never checked",
|
|
1023
|
+
action: "update-check",
|
|
1024
|
+
note: "enter probes the registry for the running channel"
|
|
784
1025
|
}];
|
|
785
1026
|
if (latest) {
|
|
786
1027
|
const stable = (version) => !/-beta\.\d+$/.test(version);
|
|
787
1028
|
const newer = comparePantheonVersions(latest, input.currentVersion) > 0 && !(stable(input.currentVersion) && !stable(latest));
|
|
788
1029
|
rows.push({
|
|
789
1030
|
id: "update.latest",
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
selectable: false
|
|
1031
|
+
name: "Registry",
|
|
1032
|
+
value: newer ? `v${latest} available` : "up to date",
|
|
1033
|
+
note: newer ? "adopt with `pantheon-opencode update`" : "no newer compatible version"
|
|
794
1034
|
});
|
|
795
1035
|
}
|
|
796
1036
|
return {
|
|
797
1037
|
id: "updates",
|
|
798
1038
|
title: "Updates",
|
|
799
|
-
|
|
800
|
-
|
|
1039
|
+
groups: [{
|
|
1040
|
+
title: "Updates",
|
|
1041
|
+
rows
|
|
1042
|
+
}]
|
|
801
1043
|
};
|
|
802
1044
|
}
|
|
803
1045
|
//#endregion
|
|
804
1046
|
//#region src/pantheon-settings.tsx
|
|
805
1047
|
/** @jsxImportSource @opentui/solid */
|
|
806
1048
|
/**
|
|
807
|
-
* pantheon-settings.tsx — the /pantheon-settings window.
|
|
1049
|
+
* pantheon-settings.tsx — the /pantheon-settings window (2.0.0-beta.4).
|
|
1050
|
+
*
|
|
1051
|
+
* A FULL-SCREEN settings window in the OpenCode Quota shape: a tab header,
|
|
1052
|
+
* grouped setting rows with ←/→ value cyclers, a note column, and a
|
|
1053
|
+
* save/reset footer. The surface is a ROUTER PAGE (`ui.router.register` +
|
|
1054
|
+
* `navigate({type:'plugin'})`) — true full-screen, reachable from the home
|
|
1055
|
+
* route AND sessions, no focus dance (binary-verified precedent: the host's
|
|
1056
|
+
* own opencode.diffs plugin). Hosts without a router fall back to the old
|
|
1057
|
+
* dialog with the same commands (fail-open).
|
|
808
1058
|
*
|
|
809
|
-
*
|
|
810
|
-
*
|
|
811
|
-
*
|
|
812
|
-
*
|
|
813
|
-
*
|
|
814
|
-
*
|
|
1059
|
+
* Edits stage into a DRAFT: ←/→ cycles a row's value, `ctrl+s` saves every
|
|
1060
|
+
* staged row through the per-surface guards, `ctrl+r` resets the current
|
|
1061
|
+
* tab, `esc`/`q` confirms before discarding. The disk never changes before
|
|
1062
|
+
* save, and every refusal surfaces in the notice line — never silent.
|
|
1063
|
+
*
|
|
1064
|
+
* The keymap layer is registered ONCE at setup with `priority: 1` (the host
|
|
1065
|
+
* resolves bind conflicts by priority then registration order — a stale
|
|
1066
|
+
* dispatch-panel layer must never win while this window is open; field
|
|
1067
|
+
* report beta.2: navigation "stopped working" was exactly that theft).
|
|
815
1068
|
*/
|
|
1069
|
+
const ROUTE_NAME = "pantheon-settings";
|
|
1070
|
+
/** Loose local shape of a host route (the real Route lives in the host typings). */
|
|
1071
|
+
const [blocking, setBlocking] = createSignal(false);
|
|
1072
|
+
/** True while a Pantheon settings surface (page or fallback dialog) is open. */
|
|
1073
|
+
function pantheonSettingsBlocking() {
|
|
1074
|
+
return blocking();
|
|
1075
|
+
}
|
|
1076
|
+
let routerAvailable = false;
|
|
816
1077
|
function globalOverridesPath() {
|
|
817
1078
|
const xdgConfig = process.env.XDG_CONFIG_HOME ?? join(process.env.HOME ?? "", ".config");
|
|
818
1079
|
return join(xdgConfig, "opencode", "pantheon-overrides.json");
|
|
@@ -820,7 +1081,6 @@ function globalOverridesPath() {
|
|
|
820
1081
|
function projectOverridesPath() {
|
|
821
1082
|
return join(process.cwd(), ".pantheon", "overrides.json");
|
|
822
1083
|
}
|
|
823
|
-
/** Read one overrides file; a missing file is empty, an unreadable one is corrupt. */
|
|
824
1084
|
function readOneOverrides(path) {
|
|
825
1085
|
try {
|
|
826
1086
|
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
@@ -862,10 +1122,6 @@ function readUpdateCheckState() {
|
|
|
862
1122
|
return {};
|
|
863
1123
|
}
|
|
864
1124
|
}
|
|
865
|
-
/**
|
|
866
|
-
* Registry check for the RUNNING version's channel (beta installs ask the
|
|
867
|
-
* beta dist-tag). Resolves with the latest version seen, or null offline.
|
|
868
|
-
*/
|
|
869
1125
|
async function fetchLatestForChannel(currentVersion) {
|
|
870
1126
|
try {
|
|
871
1127
|
const response = await fetch(registryUrlForChannel(updateChannelFor(currentVersion)), { signal: AbortSignal.timeout(5e3) });
|
|
@@ -891,280 +1147,588 @@ function resolveRunningVersion$1() {
|
|
|
891
1147
|
return "unknown";
|
|
892
1148
|
}
|
|
893
1149
|
}
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
rows: []
|
|
899
|
-
};
|
|
1150
|
+
const VALUE_WIDTH = 22;
|
|
1151
|
+
function SettingsWindow(props) {
|
|
1152
|
+
const tab = () => props.tabs()[props.page()] ?? props.tabs()[0] ?? EMPTY_TAB;
|
|
1153
|
+
const rows = () => tabRows(tab());
|
|
900
1154
|
return (() => {
|
|
901
|
-
var _el$ = createElement("box"), _el$2 = createElement("
|
|
1155
|
+
var _el$ = createElement("box"), _el$2 = createElement("box"), _el$3 = createElement("text"), _el$4 = createElement("text"), _el$6 = createElement("text"), _el$9 = createElement("text"), _el$0 = createElement("text");
|
|
902
1156
|
insertNode(_el$, _el$2);
|
|
903
|
-
insertNode(_el$, _el$
|
|
904
|
-
insertNode(_el$, _el$
|
|
905
|
-
insertNode(_el$, _el$
|
|
1157
|
+
insertNode(_el$, _el$6);
|
|
1158
|
+
insertNode(_el$, _el$9);
|
|
1159
|
+
insertNode(_el$, _el$0);
|
|
906
1160
|
setProp(_el$, "flexDirection", "column");
|
|
907
1161
|
setProp(_el$, "paddingLeft", 1);
|
|
908
1162
|
setProp(_el$, "paddingRight", 1);
|
|
909
1163
|
setProp(_el$, "paddingTop", 1);
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
1164
|
+
insertNode(_el$2, _el$3);
|
|
1165
|
+
insertNode(_el$2, _el$4);
|
|
1166
|
+
setProp(_el$2, "flexDirection", "row");
|
|
1167
|
+
setProp(_el$3, "attributes", 1);
|
|
1168
|
+
insert(_el$3, () => `Pantheon v${props.version}`);
|
|
1169
|
+
insert(_el$2, createComponent(For, {
|
|
1170
|
+
get each() {
|
|
1171
|
+
return props.tabs();
|
|
1172
|
+
},
|
|
1173
|
+
children: (t, index) => (() => {
|
|
1174
|
+
var _el$10 = createElement("text");
|
|
1175
|
+
spread(_el$10, mergeProps({ get fg() {
|
|
1176
|
+
return memo(() => index() === props.page())() ? props.fg : props.muted;
|
|
1177
|
+
} }, () => index() === props.page() ? { attributes: 1 } : {}), true);
|
|
1178
|
+
insert(_el$10, () => ` ${t.title}${tabDirty(props.draft(), t) ? " ●" : ""}`);
|
|
1179
|
+
return _el$10;
|
|
1180
|
+
})()
|
|
1181
|
+
}), _el$4);
|
|
1182
|
+
insertNode(_el$4, createTextNode(` esc`));
|
|
1183
|
+
insertNode(_el$6, createTextNode(`────────────────────────────────────────────────────────────────────────`));
|
|
913
1184
|
insert(_el$, createComponent(For, {
|
|
914
1185
|
get each() {
|
|
915
|
-
return
|
|
1186
|
+
return tab().groups;
|
|
916
1187
|
},
|
|
917
|
-
children: (
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
1188
|
+
children: (group) => (() => {
|
|
1189
|
+
var _el$11 = createElement("box"), _el$13 = createElement("box");
|
|
1190
|
+
insertNode(_el$11, _el$13);
|
|
1191
|
+
setProp(_el$11, "flexDirection", "column");
|
|
1192
|
+
insert(_el$11, createComponent(Show, {
|
|
1193
|
+
get when() {
|
|
1194
|
+
return group.title !== void 0;
|
|
1195
|
+
},
|
|
1196
|
+
get children() {
|
|
1197
|
+
var _el$12 = createElement("text");
|
|
1198
|
+
setProp(_el$12, "attributes", 1);
|
|
1199
|
+
insert(_el$12, () => group.title);
|
|
1200
|
+
effect((_$p) => setProp(_el$12, "fg", props.fg, _$p));
|
|
1201
|
+
return _el$12;
|
|
1202
|
+
}
|
|
1203
|
+
}), _el$13);
|
|
1204
|
+
insert(_el$11, createComponent(For, {
|
|
1205
|
+
get each() {
|
|
1206
|
+
return group.rows;
|
|
1207
|
+
},
|
|
1208
|
+
children: (row) => {
|
|
1209
|
+
const isSelected = () => rows()[props.selected()]?.id === row.id;
|
|
1210
|
+
const display = () => props.draft()[row.id] ?? row.value;
|
|
1211
|
+
const staged = () => props.draft()[row.id] !== void 0;
|
|
1212
|
+
const gutter = () => isSelected() ? "▸ " : " ";
|
|
1213
|
+
const valueCell = () => row.cycle !== void 0 ? `< ${display()} >` : display();
|
|
1214
|
+
return (() => {
|
|
1215
|
+
var _el$14 = createElement("box"), _el$15 = createElement("box"), _el$16 = createElement("text"), _el$17 = createElement("box"), _el$18 = createElement("text");
|
|
1216
|
+
insertNode(_el$14, _el$15);
|
|
1217
|
+
insertNode(_el$14, _el$17);
|
|
1218
|
+
setProp(_el$14, "flexDirection", "row");
|
|
1219
|
+
insertNode(_el$15, _el$16);
|
|
1220
|
+
setProp(_el$15, "width", 28);
|
|
1221
|
+
spread(_el$16, mergeProps({ get fg() {
|
|
1222
|
+
return props.fg;
|
|
1223
|
+
} }, () => isSelected() ? { attributes: 1 } : {}), true);
|
|
1224
|
+
insert(_el$16, () => `${gutter()}${row.name}`.padEnd(28));
|
|
1225
|
+
insertNode(_el$17, _el$18);
|
|
1226
|
+
setProp(_el$17, "width", 22);
|
|
1227
|
+
spread(_el$18, mergeProps({ get fg() {
|
|
1228
|
+
return memo(() => !!(isSelected() || staged()))() ? props.fg : props.muted;
|
|
1229
|
+
} }, () => isSelected() ? { attributes: 1 } : {}), true);
|
|
1230
|
+
insert(_el$18, () => `${valueCell()}${staged() ? " ●" : ""}`.padEnd(VALUE_WIDTH));
|
|
1231
|
+
insert(_el$14, createComponent(Show, {
|
|
1232
|
+
get when() {
|
|
1233
|
+
return row.note !== void 0;
|
|
1234
|
+
},
|
|
1235
|
+
get children() {
|
|
1236
|
+
var _el$19 = createElement("box"), _el$20 = createElement("text");
|
|
1237
|
+
insertNode(_el$19, _el$20);
|
|
1238
|
+
setProp(_el$19, "flexGrow", 1);
|
|
1239
|
+
setProp(_el$19, "flexShrink", 1);
|
|
1240
|
+
insert(_el$20, () => row.note);
|
|
1241
|
+
effect((_$p) => setProp(_el$20, "fg", props.muted, _$p));
|
|
1242
|
+
return _el$19;
|
|
1243
|
+
}
|
|
1244
|
+
}), null);
|
|
1245
|
+
return _el$14;
|
|
1246
|
+
})();
|
|
1247
|
+
}
|
|
1248
|
+
}), _el$13);
|
|
1249
|
+
setProp(_el$13, "height", 1);
|
|
1250
|
+
return _el$11;
|
|
1251
|
+
})()
|
|
1252
|
+
}), _el$9);
|
|
944
1253
|
insert(_el$, createComponent(Show, {
|
|
945
1254
|
get when() {
|
|
946
|
-
return
|
|
1255
|
+
return props.notice() !== void 0;
|
|
947
1256
|
},
|
|
948
1257
|
get children() {
|
|
949
|
-
var _el$
|
|
950
|
-
insert(_el$
|
|
951
|
-
effect((_$p) => setProp(_el$
|
|
952
|
-
return _el$
|
|
1258
|
+
var _el$8 = createElement("text");
|
|
1259
|
+
insert(_el$8, () => `⚠ ${props.notice()}`);
|
|
1260
|
+
effect((_$p) => setProp(_el$8, "fg", props.warn ?? props.muted, _$p));
|
|
1261
|
+
return _el$8;
|
|
953
1262
|
}
|
|
954
|
-
}), _el$
|
|
955
|
-
|
|
956
|
-
|
|
1263
|
+
}), _el$9);
|
|
1264
|
+
insert(_el$9, (() => {
|
|
1265
|
+
var _c$ = memo(() => !!draftDirty(props.draft()));
|
|
1266
|
+
return () => _c$() ? `● unsaved (${draftCount(props.draft())}) — ctrl+s save · ctrl+r reset page` : "no staged changes";
|
|
1267
|
+
})());
|
|
1268
|
+
insertNode(_el$0, createTextNode(`1-9 tab · ←/→ change value · enter apply · tab next tab · ctrl+s save · ctrl+r reset page · esc/q close`));
|
|
957
1269
|
effect((_p$) => {
|
|
958
|
-
var _v$ = props.fg, _v$2 = props.muted, _v$3 = props.muted;
|
|
959
|
-
_v$ !== _p$.e && (_p$.e = setProp(_el$
|
|
960
|
-
_v$2 !== _p$.t && (_p$.t = setProp(_el$
|
|
961
|
-
_v$3 !== _p$.a && (_p$.a = setProp(_el$
|
|
1270
|
+
var _v$ = props.fg, _v$2 = props.muted, _v$3 = props.muted, _v$4 = draftDirty(props.draft()) ? props.warn ?? props.fg : props.muted, _v$5 = props.muted;
|
|
1271
|
+
_v$ !== _p$.e && (_p$.e = setProp(_el$3, "fg", _v$, _p$.e));
|
|
1272
|
+
_v$2 !== _p$.t && (_p$.t = setProp(_el$4, "fg", _v$2, _p$.t));
|
|
1273
|
+
_v$3 !== _p$.a && (_p$.a = setProp(_el$6, "fg", _v$3, _p$.a));
|
|
1274
|
+
_v$4 !== _p$.o && (_p$.o = setProp(_el$9, "fg", _v$4, _p$.o));
|
|
1275
|
+
_v$5 !== _p$.i && (_p$.i = setProp(_el$0, "fg", _v$5, _p$.i));
|
|
962
1276
|
return _p$;
|
|
963
1277
|
}, {
|
|
964
1278
|
e: void 0,
|
|
965
1279
|
t: void 0,
|
|
966
|
-
a: void 0
|
|
1280
|
+
a: void 0,
|
|
1281
|
+
o: void 0,
|
|
1282
|
+
i: void 0
|
|
967
1283
|
});
|
|
968
1284
|
return _el$;
|
|
969
1285
|
})();
|
|
970
1286
|
}
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
currentVersion,
|
|
989
|
-
state: readUpdateCheckState(),
|
|
990
|
-
checking: checking(),
|
|
991
|
-
nowMs: Date.now()
|
|
992
|
-
};
|
|
993
|
-
const seen = lastChecked();
|
|
994
|
-
if (seen !== void 0) input.lastCheckedVersion = seen;
|
|
995
|
-
return input;
|
|
996
|
-
};
|
|
997
|
-
const presetInput = () => {
|
|
998
|
-
presetTick();
|
|
999
|
-
return {
|
|
1000
|
-
globalName: readActivePresetMarker(globalActivePresetPath())?.name ?? null,
|
|
1001
|
-
projectName: readActivePresetMarker(projectActivePresetPath())?.name ?? null
|
|
1002
|
-
};
|
|
1003
|
-
};
|
|
1004
|
-
const sections = () => [
|
|
1005
|
-
buildGatesSection(load()),
|
|
1006
|
-
buildDecisionSection(decision()),
|
|
1007
|
-
buildPresetSection(presetInput()),
|
|
1008
|
-
buildJ1Section(process.env, isBehaviorDisabled(mergedOverrides(load()), "gate-j1-risk-gate")),
|
|
1009
|
-
buildUpdatesSection(updatesInput()),
|
|
1010
|
-
buildDoctorSection({
|
|
1011
|
-
runningVersion: currentVersion,
|
|
1012
|
-
nodeVersion: process.versions.node,
|
|
1013
|
-
load: load()
|
|
1014
|
-
}),
|
|
1015
|
-
buildAboutSection(currentVersion)
|
|
1016
|
-
];
|
|
1017
|
-
const [selectedId, setSelectedId] = createSignal(firstSelectableId(sections()));
|
|
1018
|
-
const move = (delta) => {
|
|
1019
|
-
const list = flatSelectableRows(sections());
|
|
1020
|
-
if (list.length === 0) return;
|
|
1021
|
-
const current = list.findIndex((row) => row.id === selectedId());
|
|
1022
|
-
const nextIndex = current === -1 ? 0 : Math.min(Math.max(current + delta, 0), list.length - 1);
|
|
1023
|
-
setSelectedId(list[nextIndex]?.id);
|
|
1287
|
+
let pageApi;
|
|
1288
|
+
function createWindowController(context, exit) {
|
|
1289
|
+
const [page, setPage] = createSignal(0);
|
|
1290
|
+
const [selected, setSelected] = createSignal(0);
|
|
1291
|
+
const [load, setLoad] = createSignal(readOverridesLoad());
|
|
1292
|
+
const [decision, setDecision] = createSignal(readDecisionRouterConfig());
|
|
1293
|
+
const [presetTick, setPresetTick] = createSignal(0);
|
|
1294
|
+
const [lastChecked, setLastChecked] = createSignal(void 0);
|
|
1295
|
+
const [checking, setChecking] = createSignal(false);
|
|
1296
|
+
const [draft, setDraft] = createSignal({});
|
|
1297
|
+
const [notice, setNotice] = createSignal(void 0);
|
|
1298
|
+
const currentVersion = resolveRunningVersion$1();
|
|
1299
|
+
const presetInput = () => {
|
|
1300
|
+
presetTick();
|
|
1301
|
+
return {
|
|
1302
|
+
globalName: readActivePresetMarker(globalActivePresetPath())?.name ?? null,
|
|
1303
|
+
projectName: readActivePresetMarker(projectActivePresetPath())?.name ?? null
|
|
1024
1304
|
};
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
if (within) setSelectedId(within.id);
|
|
1305
|
+
};
|
|
1306
|
+
const updatesInput = () => {
|
|
1307
|
+
const input = {
|
|
1308
|
+
currentVersion,
|
|
1309
|
+
state: readUpdateCheckState(),
|
|
1310
|
+
checking: checking(),
|
|
1311
|
+
nowMs: Date.now()
|
|
1033
1312
|
};
|
|
1034
|
-
const
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1313
|
+
const seen = lastChecked();
|
|
1314
|
+
if (seen !== void 0) input.lastCheckedVersion = seen;
|
|
1315
|
+
return input;
|
|
1316
|
+
};
|
|
1317
|
+
const tabs = () => [
|
|
1318
|
+
buildGatesTab(load()),
|
|
1319
|
+
buildDecisionTab(decision()),
|
|
1320
|
+
buildPresetTab(presetInput()),
|
|
1321
|
+
buildTuiTab(tuiPrefs()),
|
|
1322
|
+
buildJ1Tab(process.env, false),
|
|
1323
|
+
buildUpdatesTab(updatesInput()),
|
|
1324
|
+
buildDoctorTab({
|
|
1325
|
+
runningVersion: currentVersion,
|
|
1326
|
+
nodeVersion: process.versions.node,
|
|
1327
|
+
load: load()
|
|
1328
|
+
}),
|
|
1329
|
+
buildAboutTab(currentVersion)
|
|
1330
|
+
];
|
|
1331
|
+
const rows = () => tabRows(tabs()[page()] ?? tabs()[0] ?? EMPTY_TAB);
|
|
1332
|
+
const move = (delta) => {
|
|
1333
|
+
const list = rows();
|
|
1334
|
+
if (list.length === 0) return;
|
|
1335
|
+
setSelected((current) => Math.min(Math.max(current + delta, 0), list.length - 1));
|
|
1336
|
+
};
|
|
1337
|
+
const step = (direction) => {
|
|
1338
|
+
const row = rows()[selected()];
|
|
1339
|
+
if (row === void 0) return;
|
|
1340
|
+
setNotice(void 0);
|
|
1341
|
+
setDraft(stageValue(draft(), row, direction));
|
|
1342
|
+
};
|
|
1343
|
+
const checkUpdatesNow = () => {
|
|
1344
|
+
if (checking()) return;
|
|
1345
|
+
setChecking(true);
|
|
1346
|
+
setNotice(void 0);
|
|
1347
|
+
fetchLatestForChannel(currentVersion).then((latest) => {
|
|
1348
|
+
if (latest) setLastChecked(latest);
|
|
1349
|
+
persistUpdateCheckState(readUpdateCheckState(), latest);
|
|
1350
|
+
}).catch(() => {}).finally(() => setChecking(false));
|
|
1351
|
+
};
|
|
1352
|
+
const dispatchWrite = (id, value) => {
|
|
1353
|
+
if (id.startsWith("gate.")) {
|
|
1354
|
+
if (!canWriteOverrides(load())) return {
|
|
1355
|
+
ok: false,
|
|
1356
|
+
reason: "overrides file unreadable — repair with `doctor --fix`"
|
|
1042
1357
|
};
|
|
1358
|
+
const behaviorId = id.slice(5);
|
|
1359
|
+
const nextGlobal = setOverrideState(load().global, behaviorId, value === "disabled" ? "disabled" : "enabled");
|
|
1360
|
+
if (nextGlobal === load().global) return { ok: true };
|
|
1043
1361
|
try {
|
|
1044
|
-
writeOverridesToDisk(
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1362
|
+
writeOverridesToDisk({
|
|
1363
|
+
...load(),
|
|
1364
|
+
global: nextGlobal
|
|
1365
|
+
});
|
|
1366
|
+
setLoad({
|
|
1367
|
+
...load(),
|
|
1368
|
+
global: nextGlobal
|
|
1369
|
+
});
|
|
1370
|
+
return { ok: true };
|
|
1371
|
+
} catch {
|
|
1372
|
+
return {
|
|
1373
|
+
ok: false,
|
|
1374
|
+
reason: "overrides disk write failed"
|
|
1375
|
+
};
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
if (id === "decision.enabled") {
|
|
1057
1379
|
const current = decision();
|
|
1058
|
-
if (current.corrupt) return
|
|
1059
|
-
|
|
1060
|
-
|
|
1380
|
+
if (current.corrupt) return {
|
|
1381
|
+
ok: false,
|
|
1382
|
+
reason: "decision-router.json unreadable — repair via `decision-router setup-model`"
|
|
1383
|
+
};
|
|
1384
|
+
const guarded = setDecisionEnabled(current.config, value === "enabled");
|
|
1385
|
+
if (!guarded.ok) return {
|
|
1386
|
+
ok: false,
|
|
1387
|
+
reason: guarded.reason
|
|
1388
|
+
};
|
|
1061
1389
|
try {
|
|
1062
|
-
writeDecisionRouterConfig(
|
|
1390
|
+
writeDecisionRouterConfig(guarded.config);
|
|
1063
1391
|
setDecision({
|
|
1064
|
-
config:
|
|
1392
|
+
config: guarded.config,
|
|
1065
1393
|
corrupt: false
|
|
1066
1394
|
});
|
|
1067
|
-
|
|
1395
|
+
return { ok: true };
|
|
1396
|
+
} catch {
|
|
1397
|
+
return {
|
|
1398
|
+
ok: false,
|
|
1399
|
+
reason: "decision-router disk write failed"
|
|
1400
|
+
};
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
if (id === "preset") try {
|
|
1404
|
+
if (value === "none") clearActivePreset(globalActivePresetPath());
|
|
1405
|
+
else writeActivePreset(globalActivePresetPath(), value);
|
|
1406
|
+
setPresetTick((tick) => tick + 1);
|
|
1407
|
+
return { ok: true };
|
|
1408
|
+
} catch (error) {
|
|
1409
|
+
return {
|
|
1410
|
+
ok: false,
|
|
1411
|
+
reason: error instanceof Error ? error.message : "preset marker write failed"
|
|
1412
|
+
};
|
|
1413
|
+
}
|
|
1414
|
+
if (id.startsWith("tui.")) try {
|
|
1415
|
+
mutateTuiPrefs((prefsDraft) => applyTuiRow(prefsDraft, id, value)).then(() => setNotice(void 0)).catch(() => setNotice("tui prefs: persist failed — the change is active for this session only"));
|
|
1416
|
+
return { ok: true };
|
|
1417
|
+
} catch {
|
|
1418
|
+
return {
|
|
1419
|
+
ok: false,
|
|
1420
|
+
reason: "tui prefs storage unavailable"
|
|
1421
|
+
};
|
|
1422
|
+
}
|
|
1423
|
+
return {
|
|
1424
|
+
ok: false,
|
|
1425
|
+
reason: "unknown staged row"
|
|
1068
1426
|
};
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1427
|
+
};
|
|
1428
|
+
const save = () => {
|
|
1429
|
+
if (!draftDirty(draft())) {
|
|
1430
|
+
setNotice("nothing staged — ←/→ stages a change first");
|
|
1431
|
+
return;
|
|
1432
|
+
}
|
|
1433
|
+
const writer = dispatchWrite;
|
|
1434
|
+
const { applied, failed } = applyDraft(draft(), writer);
|
|
1435
|
+
if (applied.length > 0) {
|
|
1436
|
+
setDraft(settledDraft(draft(), applied));
|
|
1437
|
+
setLoad(readOverridesLoad());
|
|
1438
|
+
setDecision(readDecisionRouterConfig());
|
|
1439
|
+
setPresetTick((tick) => tick + 1);
|
|
1440
|
+
}
|
|
1441
|
+
if (failed.length > 0) setNotice(`${failed.map((f) => `${f.id}: ${f.reason}`).join(" · ")} — staged changes kept`);
|
|
1442
|
+
else setNotice(`saved ${applied.length} change${applied.length === 1 ? "" : "s"}`);
|
|
1443
|
+
};
|
|
1444
|
+
const resetPage = () => {
|
|
1445
|
+
const tab = tabs()[page()];
|
|
1446
|
+
if (tab === void 0) return;
|
|
1447
|
+
setDraft(resetTab(draft(), tab));
|
|
1448
|
+
setNotice(void 0);
|
|
1449
|
+
};
|
|
1450
|
+
const nextTab = () => {
|
|
1451
|
+
setPage((current) => (current + 1) % tabs().length);
|
|
1452
|
+
setSelected(0);
|
|
1453
|
+
};
|
|
1454
|
+
const close = () => {
|
|
1455
|
+
if (draftDirty(draft())) {
|
|
1075
1456
|
try {
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1457
|
+
Promise.resolve(context.ui.dialog.confirm({
|
|
1458
|
+
title: "Pantheon settings",
|
|
1459
|
+
message: "Discard unsaved settings changes?"
|
|
1460
|
+
})).then((confirmed) => {
|
|
1461
|
+
if (confirmed === true) exit();
|
|
1462
|
+
});
|
|
1079
1463
|
} catch {}
|
|
1080
|
-
|
|
1081
|
-
|
|
1464
|
+
return;
|
|
1465
|
+
}
|
|
1466
|
+
exit();
|
|
1467
|
+
};
|
|
1468
|
+
return {
|
|
1469
|
+
tabs,
|
|
1470
|
+
page,
|
|
1471
|
+
selected,
|
|
1472
|
+
draft,
|
|
1473
|
+
notice,
|
|
1474
|
+
api: {
|
|
1475
|
+
move,
|
|
1476
|
+
step,
|
|
1477
|
+
actuate: () => {
|
|
1478
|
+
if (rows()[selected()]?.action === "update-check") checkUpdatesNow();
|
|
1479
|
+
else step(1);
|
|
1480
|
+
},
|
|
1481
|
+
nextTab,
|
|
1482
|
+
jumpTab: (index) => {
|
|
1483
|
+
if (index >= 0 && index < tabs().length) {
|
|
1484
|
+
setPage(index);
|
|
1485
|
+
setSelected(0);
|
|
1486
|
+
}
|
|
1487
|
+
},
|
|
1488
|
+
save,
|
|
1489
|
+
resetPage,
|
|
1490
|
+
close
|
|
1491
|
+
},
|
|
1492
|
+
cleanup: () => {
|
|
1493
|
+
pageApi = void 0;
|
|
1494
|
+
setBlocking(false);
|
|
1495
|
+
}
|
|
1496
|
+
};
|
|
1497
|
+
}
|
|
1498
|
+
function SettingsPage(props) {
|
|
1499
|
+
const returnRoute = props.data?.returnRoute;
|
|
1500
|
+
const context = props.context;
|
|
1501
|
+
const controller = createWindowController(context, () => navigateBack(context, returnRoute !== void 0 ? { returnRoute } : {}));
|
|
1502
|
+
const theme = context.theme?.text ?? {};
|
|
1503
|
+
const warn = theme?.feedback?.warning?.base ?? theme.muted;
|
|
1504
|
+
onCleanup(controller.cleanup);
|
|
1505
|
+
setBlocking(true);
|
|
1506
|
+
pageApi = controller.api;
|
|
1507
|
+
return createComponent(SettingsWindow, {
|
|
1508
|
+
get version() {
|
|
1509
|
+
return resolveRunningVersion$1();
|
|
1510
|
+
},
|
|
1511
|
+
get tabs() {
|
|
1512
|
+
return controller.tabs;
|
|
1513
|
+
},
|
|
1514
|
+
get page() {
|
|
1515
|
+
return controller.page;
|
|
1516
|
+
},
|
|
1517
|
+
get selected() {
|
|
1518
|
+
return controller.selected;
|
|
1519
|
+
},
|
|
1520
|
+
get draft() {
|
|
1521
|
+
return controller.draft;
|
|
1522
|
+
},
|
|
1523
|
+
get notice() {
|
|
1524
|
+
return controller.notice;
|
|
1525
|
+
},
|
|
1526
|
+
get fg() {
|
|
1527
|
+
return theme.base;
|
|
1528
|
+
},
|
|
1529
|
+
get muted() {
|
|
1530
|
+
return theme.muted;
|
|
1531
|
+
},
|
|
1532
|
+
warn
|
|
1533
|
+
});
|
|
1534
|
+
}
|
|
1535
|
+
function navigateBack(context, data) {
|
|
1536
|
+
try {
|
|
1537
|
+
context.ui.router.navigate(data?.returnRoute ?? { type: "home" });
|
|
1538
|
+
} catch {}
|
|
1539
|
+
}
|
|
1540
|
+
const [dialogOpen, setDialogOpen] = createSignal(false);
|
|
1541
|
+
let dialogDismiss = () => {};
|
|
1542
|
+
function openSettingsDialog(context) {
|
|
1543
|
+
const controller = createWindowController(context, () => dialogDismiss());
|
|
1544
|
+
const theme = context.theme?.text ?? {};
|
|
1545
|
+
const warn = theme?.feedback?.warning?.base ?? theme.muted;
|
|
1546
|
+
controller.cleanup = () => {
|
|
1547
|
+
pageApi = void 0;
|
|
1548
|
+
setBlocking(false);
|
|
1549
|
+
setDialogOpen(false);
|
|
1550
|
+
};
|
|
1551
|
+
const close = () => {
|
|
1552
|
+
controller.cleanup();
|
|
1553
|
+
};
|
|
1554
|
+
dialogDismiss = () => {
|
|
1082
1555
|
try {
|
|
1083
|
-
context.
|
|
1084
|
-
mode: "global",
|
|
1085
|
-
enabled: () => open(),
|
|
1086
|
-
commands: [
|
|
1087
|
-
{
|
|
1088
|
-
id: "pantheon.settings.close",
|
|
1089
|
-
title: "Close settings",
|
|
1090
|
-
bind: "escape,q",
|
|
1091
|
-
run: () => {
|
|
1092
|
-
if (!open()) return false;
|
|
1093
|
-
dismiss();
|
|
1094
|
-
}
|
|
1095
|
-
},
|
|
1096
|
-
{
|
|
1097
|
-
id: "pantheon.settings.down",
|
|
1098
|
-
title: "Select next",
|
|
1099
|
-
bind: "down,j",
|
|
1100
|
-
run: () => {
|
|
1101
|
-
if (!open()) return false;
|
|
1102
|
-
move(1);
|
|
1103
|
-
}
|
|
1104
|
-
},
|
|
1105
|
-
{
|
|
1106
|
-
id: "pantheon.settings.up",
|
|
1107
|
-
title: "Select previous",
|
|
1108
|
-
bind: "up,k",
|
|
1109
|
-
run: () => {
|
|
1110
|
-
if (!open()) return false;
|
|
1111
|
-
move(-1);
|
|
1112
|
-
}
|
|
1113
|
-
},
|
|
1114
|
-
{
|
|
1115
|
-
id: "pantheon.settings.toggle",
|
|
1116
|
-
title: "Apply the selected row",
|
|
1117
|
-
bind: "enter,space",
|
|
1118
|
-
run: () => {
|
|
1119
|
-
if (!open()) return false;
|
|
1120
|
-
const id = selectedId();
|
|
1121
|
-
if (id?.startsWith("gate.")) return toggleSelectedGate();
|
|
1122
|
-
if (id === "decision.enabled") return toggleDecisionEnabled();
|
|
1123
|
-
if (id?.startsWith("preset.")) return applySelectedPreset();
|
|
1124
|
-
if (id === "update.check") return checkUpdatesNow();
|
|
1125
|
-
}
|
|
1126
|
-
},
|
|
1127
|
-
{
|
|
1128
|
-
id: "pantheon.settings.section",
|
|
1129
|
-
title: "Next section",
|
|
1130
|
-
bind: "tab",
|
|
1131
|
-
run: () => {
|
|
1132
|
-
if (!open()) return false;
|
|
1133
|
-
flipSection();
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
]
|
|
1137
|
-
}));
|
|
1556
|
+
context.ui.dialog.clear();
|
|
1138
1557
|
} catch {}
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1558
|
+
close();
|
|
1559
|
+
};
|
|
1560
|
+
setBlocking(true);
|
|
1561
|
+
setDialogOpen(true);
|
|
1562
|
+
pageApi = controller.api;
|
|
1563
|
+
try {
|
|
1564
|
+
context.ui.dialog.show(() => createComponent(SettingsWindow, {
|
|
1565
|
+
get version() {
|
|
1566
|
+
return resolveRunningVersion$1();
|
|
1567
|
+
},
|
|
1568
|
+
get tabs() {
|
|
1569
|
+
return controller.tabs;
|
|
1570
|
+
},
|
|
1571
|
+
get page() {
|
|
1572
|
+
return controller.page;
|
|
1573
|
+
},
|
|
1574
|
+
get selected() {
|
|
1575
|
+
return controller.selected;
|
|
1576
|
+
},
|
|
1577
|
+
get draft() {
|
|
1578
|
+
return controller.draft;
|
|
1579
|
+
},
|
|
1580
|
+
get notice() {
|
|
1581
|
+
return controller.notice;
|
|
1582
|
+
},
|
|
1583
|
+
get fg() {
|
|
1584
|
+
return theme.base;
|
|
1585
|
+
},
|
|
1586
|
+
get muted() {
|
|
1587
|
+
return theme.muted;
|
|
1588
|
+
},
|
|
1589
|
+
warn
|
|
1590
|
+
}), close);
|
|
1591
|
+
} catch {}
|
|
1592
|
+
}
|
|
1593
|
+
function setupPantheonSettings(context) {
|
|
1594
|
+
try {
|
|
1595
|
+
context.ui.router?.register?.({
|
|
1596
|
+
name: ROUTE_NAME,
|
|
1597
|
+
render: ({ data }) => createComponent(SettingsPage, {
|
|
1598
|
+
context,
|
|
1599
|
+
data
|
|
1600
|
+
})
|
|
1601
|
+
});
|
|
1602
|
+
routerAvailable = true;
|
|
1603
|
+
} catch {
|
|
1604
|
+
routerAvailable = false;
|
|
1605
|
+
}
|
|
1606
|
+
const routeGated = () => {
|
|
1150
1607
|
try {
|
|
1151
|
-
const
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1608
|
+
const route = context.ui?.router?.current?.();
|
|
1609
|
+
return route?.type === "plugin" && route.name === "pantheon-settings";
|
|
1610
|
+
} catch {
|
|
1611
|
+
return false;
|
|
1612
|
+
}
|
|
1613
|
+
};
|
|
1614
|
+
const commands = [
|
|
1615
|
+
{
|
|
1616
|
+
id: "pantheon.settings.close",
|
|
1617
|
+
title: "Close settings",
|
|
1618
|
+
bind: "escape,q",
|
|
1619
|
+
run: () => {
|
|
1620
|
+
pageApi?.close();
|
|
1621
|
+
}
|
|
1622
|
+
},
|
|
1623
|
+
{
|
|
1624
|
+
id: "pantheon.settings.down",
|
|
1625
|
+
title: "Select next row",
|
|
1626
|
+
bind: "down,j",
|
|
1627
|
+
run: () => {
|
|
1628
|
+
pageApi?.move(1);
|
|
1629
|
+
}
|
|
1630
|
+
},
|
|
1631
|
+
{
|
|
1632
|
+
id: "pantheon.settings.up",
|
|
1633
|
+
title: "Select previous row",
|
|
1634
|
+
bind: "up,k",
|
|
1635
|
+
run: () => {
|
|
1636
|
+
pageApi?.move(-1);
|
|
1637
|
+
}
|
|
1638
|
+
},
|
|
1639
|
+
{
|
|
1640
|
+
id: "pantheon.settings.cycle.next",
|
|
1641
|
+
title: "Stage the next value",
|
|
1642
|
+
bind: "right,l",
|
|
1643
|
+
run: () => {
|
|
1644
|
+
pageApi?.step(1);
|
|
1645
|
+
}
|
|
1646
|
+
},
|
|
1647
|
+
{
|
|
1648
|
+
id: "pantheon.settings.cycle.prev",
|
|
1649
|
+
title: "Stage the previous value",
|
|
1650
|
+
bind: "left,h",
|
|
1651
|
+
run: () => {
|
|
1652
|
+
pageApi?.step(-1);
|
|
1653
|
+
}
|
|
1654
|
+
},
|
|
1655
|
+
{
|
|
1656
|
+
id: "pantheon.settings.actuate",
|
|
1657
|
+
title: "Apply / act on the row",
|
|
1658
|
+
bind: "enter,space",
|
|
1659
|
+
run: () => {
|
|
1660
|
+
pageApi?.actuate();
|
|
1661
|
+
}
|
|
1662
|
+
},
|
|
1663
|
+
{
|
|
1664
|
+
id: "pantheon.settings.next.tab",
|
|
1665
|
+
title: "Next settings tab",
|
|
1666
|
+
bind: "tab",
|
|
1667
|
+
run: () => {
|
|
1668
|
+
pageApi?.nextTab();
|
|
1669
|
+
}
|
|
1670
|
+
},
|
|
1671
|
+
{
|
|
1672
|
+
id: "pantheon.settings.save",
|
|
1673
|
+
title: "Save staged changes",
|
|
1674
|
+
bind: "ctrl+s",
|
|
1675
|
+
run: () => {
|
|
1676
|
+
pageApi?.save();
|
|
1677
|
+
}
|
|
1678
|
+
},
|
|
1679
|
+
{
|
|
1680
|
+
id: "pantheon.settings.reset.page",
|
|
1681
|
+
title: "Reset this tab",
|
|
1682
|
+
bind: "ctrl+r",
|
|
1683
|
+
run: () => {
|
|
1684
|
+
pageApi?.resetPage();
|
|
1685
|
+
}
|
|
1686
|
+
},
|
|
1687
|
+
...Array.from({ length: 9 }, (_, index) => ({
|
|
1688
|
+
id: `pantheon.settings.tab.${index + 1}`,
|
|
1689
|
+
title: `Jump to tab ${index + 1}`,
|
|
1690
|
+
bind: String(index + 1),
|
|
1691
|
+
run: () => {
|
|
1692
|
+
pageApi?.jumpTab(index);
|
|
1693
|
+
}
|
|
1694
|
+
}))
|
|
1695
|
+
];
|
|
1696
|
+
try {
|
|
1697
|
+
context.keymap.layer(() => ({
|
|
1698
|
+
mode: "global",
|
|
1699
|
+
priority: 1,
|
|
1700
|
+
enabled: () => routeGated(),
|
|
1701
|
+
commands
|
|
1702
|
+
}));
|
|
1703
|
+
} catch {}
|
|
1704
|
+
try {
|
|
1705
|
+
context.keymap.layer(() => ({
|
|
1706
|
+
mode: "global",
|
|
1707
|
+
priority: 1,
|
|
1708
|
+
enabled: () => dialogOpen(),
|
|
1709
|
+
commands
|
|
1710
|
+
}));
|
|
1711
|
+
} catch {}
|
|
1712
|
+
}
|
|
1713
|
+
async function openPantheonSettings(context) {
|
|
1714
|
+
try {
|
|
1715
|
+
if (routerAvailable && context.ui?.router?.navigate) {
|
|
1716
|
+
let returnRoute;
|
|
1163
1717
|
try {
|
|
1164
|
-
context.ui.
|
|
1165
|
-
|
|
1166
|
-
|
|
1718
|
+
const current = context.ui.router.current();
|
|
1719
|
+
if (!(current.type === "plugin" && current.name === "pantheon-settings")) returnRoute = current;
|
|
1720
|
+
} catch {
|
|
1721
|
+
returnRoute = void 0;
|
|
1722
|
+
}
|
|
1723
|
+
context.ui.router.navigate({
|
|
1724
|
+
type: "plugin",
|
|
1725
|
+
name: ROUTE_NAME,
|
|
1726
|
+
...returnRoute !== void 0 ? { data: { returnRoute } } : {}
|
|
1727
|
+
});
|
|
1728
|
+
return;
|
|
1729
|
+
}
|
|
1167
1730
|
} catch {}
|
|
1731
|
+
openSettingsDialog(context);
|
|
1168
1732
|
}
|
|
1169
1733
|
//#endregion
|
|
1170
1734
|
//#region src/sidebar-width.ts
|
|
@@ -1475,7 +2039,7 @@ async function readChangelogForBundle(bundleUrl) {
|
|
|
1475
2039
|
}
|
|
1476
2040
|
/** The ambient build-time version, or null outside a tsdown build. */
|
|
1477
2041
|
function embeddedVersion() {
|
|
1478
|
-
return "2.0.0-beta.
|
|
2042
|
+
return "2.0.0-beta.5";
|
|
1479
2043
|
}
|
|
1480
2044
|
/**
|
|
1481
2045
|
* Resolve the running Pantheon version for the what's-new window: the plugin
|
|
@@ -2322,8 +2886,9 @@ function turnTokensPerSecond(messages, position) {
|
|
|
2322
2886
|
* `$<spent> spent`. The percentage row carries the only semantic tone, the
|
|
2323
2887
|
* gauge bar (12 cells) and is omitted entirely when the percentage is
|
|
2324
2888
|
* unavailable (never `undefined%`). A block with neither tokens nor cost
|
|
2325
|
-
* yields null.
|
|
2326
|
-
|
|
2889
|
+
* yields null. `gaugeStyle` (the TUI tab's pref) picks the percent-row
|
|
2890
|
+
* shape: `both` (default), `bar`, `percent`, or `off` (row omitted). Pure. */
|
|
2891
|
+
function contextBlockRows(usage, cost, gaugeStyle = "both") {
|
|
2327
2892
|
const spentValue = formatSpent(cost);
|
|
2328
2893
|
const spent = spentValue === null ? null : {
|
|
2329
2894
|
lead: null,
|
|
@@ -2348,13 +2913,32 @@ function contextBlockRows(usage, cost) {
|
|
|
2348
2913
|
const percentValue = numberOrNull(usage.percent);
|
|
2349
2914
|
const window = formatContextWindow(usage.limit);
|
|
2350
2915
|
const bar = contextBar(percentValue);
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2916
|
+
let percent = null;
|
|
2917
|
+
if (gaugeStyle !== "off" && bar !== null && percentValue !== null) {
|
|
2918
|
+
const suffix = window === null ? null : ` of ${window}`;
|
|
2919
|
+
const tone = contextUsageTone(percentValue);
|
|
2920
|
+
if (gaugeStyle === "bar") percent = {
|
|
2921
|
+
lead: bar.filled,
|
|
2922
|
+
value: "",
|
|
2923
|
+
tail: bar.empty,
|
|
2924
|
+
suffix,
|
|
2925
|
+
tone
|
|
2926
|
+
};
|
|
2927
|
+
else if (gaugeStyle === "percent") percent = {
|
|
2928
|
+
lead: null,
|
|
2929
|
+
value: ` ${Math.round(percentValue)}%`,
|
|
2930
|
+
tail: null,
|
|
2931
|
+
suffix: null,
|
|
2932
|
+
tone
|
|
2933
|
+
};
|
|
2934
|
+
else percent = {
|
|
2935
|
+
lead: bar.filled,
|
|
2936
|
+
value: ` ${Math.round(percentValue)}%`,
|
|
2937
|
+
tail: bar.empty,
|
|
2938
|
+
suffix,
|
|
2939
|
+
tone
|
|
2940
|
+
};
|
|
2941
|
+
}
|
|
2358
2942
|
if (tokens === null && percent === null && spent === null) return null;
|
|
2359
2943
|
return {
|
|
2360
2944
|
tokens,
|
|
@@ -4113,7 +4697,7 @@ async function checkForPantheonUpdate(context) {
|
|
|
4113
4697
|
const latest = String((await response.json())?.version ?? "");
|
|
4114
4698
|
if (!latest) return;
|
|
4115
4699
|
const notice = pickUpdateNotice({
|
|
4116
|
-
currentVersion: "2.0.0-beta.
|
|
4700
|
+
currentVersion: "2.0.0-beta.5",
|
|
4117
4701
|
latestVersion: latest,
|
|
4118
4702
|
state: readState(),
|
|
4119
4703
|
nowMs: Date.now()
|
|
@@ -4642,11 +5226,12 @@ function createSidebarModel(context, sessionID, gitExec = defaultGitExec) {
|
|
|
4642
5226
|
return buildDispatchBlock(allDelegations(), Date.now(), frame());
|
|
4643
5227
|
});
|
|
4644
5228
|
const blocks = createMemo(() => {
|
|
5229
|
+
const prefs = tuiPrefs();
|
|
4645
5230
|
const present = [];
|
|
4646
|
-
if (contextBlockRows(contextUsage(), cost()) !== null || contextSpendLine(spend()) !== null) present.push("context");
|
|
4647
|
-
if (branch() !== null || gitLine() !== null) present.push("git");
|
|
4648
|
-
if (todo().visible.length > 0) present.push("todo");
|
|
4649
|
-
if (dispatch() !== null) present.push("dispatch");
|
|
5231
|
+
if (prefs.sidebar.blocks.context && (contextBlockRows(contextUsage(), cost(), prefs.sidebar.context.gauge) !== null || prefs.sidebar.context.localSpend && contextSpendLine(spend()) !== null)) present.push("context");
|
|
5232
|
+
if (prefs.sidebar.blocks.git && (branch() !== null || gitLine() !== null)) present.push("git");
|
|
5233
|
+
if (prefs.sidebar.blocks.todo && todo().visible.length > 0) present.push("todo");
|
|
5234
|
+
if (prefs.sidebar.blocks.dispatch && dispatch() !== null) present.push("dispatch");
|
|
4650
5235
|
return withBlockSpacers(present);
|
|
4651
5236
|
});
|
|
4652
5237
|
onMount(() => {
|
|
@@ -4873,11 +5458,20 @@ function Sidebar(props) {
|
|
|
4873
5458
|
const open = (sessionID) => () => navigateToSession(context.ui?.router, sessionID);
|
|
4874
5459
|
const block = (key) => model.blocks().find((entry) => entry.key === key);
|
|
4875
5460
|
const spacer = (key) => block(key)?.spacer === true;
|
|
4876
|
-
const usageRows = () => modelUsageRows(model.modelUsage().visible);
|
|
4877
5461
|
const usageHidden = () => hiddenModelUsageText(model.modelUsage().hidden, model.modelUsage().hiddenCost);
|
|
4878
|
-
const contextRows = () =>
|
|
4879
|
-
|
|
4880
|
-
|
|
5462
|
+
const contextRows = () => {
|
|
5463
|
+
const prefs = tuiPrefs();
|
|
5464
|
+
const rows = contextBlockRows(model.contextUsage(), model.cost(), prefs.sidebar.context.gauge);
|
|
5465
|
+
if (rows === null) return null;
|
|
5466
|
+
return {
|
|
5467
|
+
tokens: prefs.sidebar.context.tokens ? rows.tokens : null,
|
|
5468
|
+
percent: rows.percent,
|
|
5469
|
+
spent: prefs.sidebar.context.spent ? rows.spent : null
|
|
5470
|
+
};
|
|
5471
|
+
};
|
|
5472
|
+
const spendLine = () => tuiPrefs().sidebar.context.localSpend ? contextSpendLine(model.spend()) : null;
|
|
5473
|
+
const performanceLine = () => tuiPrefs().sidebar.context.performance ? contextPerformanceLine(model.performance()) : null;
|
|
5474
|
+
const usageRows = () => tuiPrefs().sidebar.context.modelUsage ? modelUsageRows(model.modelUsage().visible) : [];
|
|
4881
5475
|
const gaugeFg = (row) => contextProgressColor(row.tone ?? "warning", context.theme);
|
|
4882
5476
|
const dispatchView = () => model.dispatch();
|
|
4883
5477
|
const dispatchSummary = () => {
|
|
@@ -4885,33 +5479,64 @@ function Sidebar(props) {
|
|
|
4885
5479
|
return view === null ? null : dispatchHeaderSummary(view.runningCount, view.totalCost);
|
|
4886
5480
|
};
|
|
4887
5481
|
const failedSuffix = () => failedSuffixText(dispatchView()?.failures);
|
|
5482
|
+
const header = () => tuiPrefs().sidebar.header;
|
|
4888
5483
|
return (() => {
|
|
4889
|
-
var _el$12 = createElement("box")
|
|
4890
|
-
insertNode(_el$12, _el$13);
|
|
4891
|
-
insertNode(_el$12, _el$14);
|
|
5484
|
+
var _el$12 = createElement("box");
|
|
4892
5485
|
setProp(_el$12, "flexDirection", "column");
|
|
4893
5486
|
setProp(_el$12, "width", "100%");
|
|
4894
5487
|
setProp(_el$12, "padding", 1);
|
|
4895
|
-
setProp(_el$13, "attributes", 1);
|
|
4896
|
-
insert(_el$13, `Pantheon v2.0.0-beta.3`);
|
|
4897
|
-
insert(_el$14, () => presetHeaderLine(model.preset().name ?? "", model.provider()));
|
|
4898
5488
|
insert(_el$12, createComponent(Show, {
|
|
4899
5489
|
get when() {
|
|
4900
|
-
return
|
|
5490
|
+
return header().version;
|
|
5491
|
+
},
|
|
5492
|
+
get children() {
|
|
5493
|
+
var _el$13 = createElement("text");
|
|
5494
|
+
setProp(_el$13, "attributes", 1);
|
|
5495
|
+
insert(_el$13, `Pantheon v2.0.0-beta.5`);
|
|
5496
|
+
effect((_$p) => setProp(_el$13, "fg", text(), _$p));
|
|
5497
|
+
return _el$13;
|
|
5498
|
+
}
|
|
5499
|
+
}), null);
|
|
5500
|
+
insert(_el$12, createComponent(Show, {
|
|
5501
|
+
get when() {
|
|
5502
|
+
return header().preset;
|
|
5503
|
+
},
|
|
5504
|
+
get children() {
|
|
5505
|
+
var _el$14 = createElement("text");
|
|
5506
|
+
insert(_el$14, () => presetHeaderLine(model.preset().name ?? "", model.provider()));
|
|
5507
|
+
effect((_$p) => setProp(_el$14, "fg", muted(), _$p));
|
|
5508
|
+
return _el$14;
|
|
5509
|
+
}
|
|
5510
|
+
}), null);
|
|
5511
|
+
insert(_el$12, createComponent(Show, {
|
|
5512
|
+
get when() {
|
|
5513
|
+
return memo(() => !!(header().session && model.activeSessionID() !== ""))() && model.session();
|
|
4901
5514
|
},
|
|
4902
5515
|
get fallback() {
|
|
4903
|
-
return (
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
5516
|
+
return createComponent(Show, {
|
|
5517
|
+
get when() {
|
|
5518
|
+
return header().session;
|
|
5519
|
+
},
|
|
5520
|
+
get fallback() {
|
|
5521
|
+
return (() => {
|
|
5522
|
+
var _el$26 = createElement("box");
|
|
5523
|
+
setProp(_el$26, "height", 0);
|
|
5524
|
+
return _el$26;
|
|
5525
|
+
})();
|
|
5526
|
+
},
|
|
5527
|
+
get children() {
|
|
5528
|
+
var _el$25 = createElement("text");
|
|
5529
|
+
insert(_el$25, () => sidebarPlaceholder(props.sessionID));
|
|
5530
|
+
effect((_$p) => setProp(_el$25, "fg", muted(), _$p));
|
|
5531
|
+
return _el$25;
|
|
5532
|
+
}
|
|
5533
|
+
});
|
|
4909
5534
|
},
|
|
4910
5535
|
children: (current) => (() => {
|
|
4911
|
-
var _el$
|
|
4912
|
-
insert(_el$
|
|
4913
|
-
effect((_$p) => setProp(_el$
|
|
4914
|
-
return _el$
|
|
5536
|
+
var _el$27 = createElement("text");
|
|
5537
|
+
insert(_el$27, () => `Sessão: ${truncateLabel(current().title || current().id)}`);
|
|
5538
|
+
effect((_$p) => setProp(_el$27, "fg", text(), _$p));
|
|
5539
|
+
return _el$27;
|
|
4915
5540
|
})()
|
|
4916
5541
|
}), null);
|
|
4917
5542
|
insert(_el$12, createComponent(Show, {
|
|
@@ -4958,9 +5583,9 @@ function Sidebar(props) {
|
|
|
4958
5583
|
return contextRows();
|
|
4959
5584
|
},
|
|
4960
5585
|
children: (rows) => (() => {
|
|
4961
|
-
var _el$
|
|
4962
|
-
setProp(_el$
|
|
4963
|
-
insert(_el$
|
|
5586
|
+
var _el$28 = createElement("box");
|
|
5587
|
+
setProp(_el$28, "flexDirection", "column");
|
|
5588
|
+
insert(_el$28, createComponent(Show, {
|
|
4964
5589
|
get when() {
|
|
4965
5590
|
return rows().tokens;
|
|
4966
5591
|
},
|
|
@@ -4976,7 +5601,7 @@ function Sidebar(props) {
|
|
|
4976
5601
|
}
|
|
4977
5602
|
})
|
|
4978
5603
|
}), null);
|
|
4979
|
-
insert(_el$
|
|
5604
|
+
insert(_el$28, createComponent(Show, {
|
|
4980
5605
|
get when() {
|
|
4981
5606
|
return rows().percent;
|
|
4982
5607
|
},
|
|
@@ -4992,7 +5617,7 @@ function Sidebar(props) {
|
|
|
4992
5617
|
}
|
|
4993
5618
|
})
|
|
4994
5619
|
}), null);
|
|
4995
|
-
insert(_el$
|
|
5620
|
+
insert(_el$28, createComponent(Show, {
|
|
4996
5621
|
get when() {
|
|
4997
5622
|
return rows().spent;
|
|
4998
5623
|
},
|
|
@@ -5008,46 +5633,46 @@ function Sidebar(props) {
|
|
|
5008
5633
|
}
|
|
5009
5634
|
})
|
|
5010
5635
|
}), null);
|
|
5011
|
-
insert(_el$
|
|
5636
|
+
insert(_el$28, createComponent(Show, {
|
|
5012
5637
|
get when() {
|
|
5013
|
-
return usageRows().length > 0;
|
|
5638
|
+
return memo(() => !!tuiPrefs().sidebar.context.modelUsage)() && usageRows().length > 0;
|
|
5014
5639
|
},
|
|
5015
5640
|
get children() {
|
|
5016
5641
|
return [(() => {
|
|
5017
|
-
var _el$
|
|
5018
|
-
insertNode(_el$
|
|
5019
|
-
effect((_$p) => setProp(_el$
|
|
5020
|
-
return _el$
|
|
5642
|
+
var _el$29 = createElement("text");
|
|
5643
|
+
insertNode(_el$29, createTextNode(`Sessão · custo reportado`));
|
|
5644
|
+
effect((_$p) => setProp(_el$29, "fg", muted(), _$p));
|
|
5645
|
+
return _el$29;
|
|
5021
5646
|
})(), (() => {
|
|
5022
|
-
var _el$
|
|
5023
|
-
insertNode(_el$
|
|
5024
|
-
effect((_$p) => setProp(_el$
|
|
5025
|
-
return _el$
|
|
5647
|
+
var _el$31 = createElement("text");
|
|
5648
|
+
insertNode(_el$31, createTextNode(`Modelo Tokens USD`));
|
|
5649
|
+
effect((_$p) => setProp(_el$31, "fg", muted(), _$p));
|
|
5650
|
+
return _el$31;
|
|
5026
5651
|
})()];
|
|
5027
5652
|
}
|
|
5028
5653
|
}), null);
|
|
5029
|
-
insert(_el$
|
|
5654
|
+
insert(_el$28, createComponent(For, {
|
|
5030
5655
|
get each() {
|
|
5031
5656
|
return usageRows();
|
|
5032
5657
|
},
|
|
5033
5658
|
children: (row) => (() => {
|
|
5034
|
-
var _el$
|
|
5035
|
-
setProp(_el$
|
|
5036
|
-
insert(_el$
|
|
5659
|
+
var _el$33 = createElement("box");
|
|
5660
|
+
setProp(_el$33, "flexDirection", "column");
|
|
5661
|
+
insert(_el$33, createComponent(For, {
|
|
5037
5662
|
get each() {
|
|
5038
5663
|
return modelUsageRowLines(row);
|
|
5039
5664
|
},
|
|
5040
5665
|
children: (line) => (() => {
|
|
5041
|
-
var _el$
|
|
5042
|
-
insert(_el$
|
|
5043
|
-
effect((_$p) => setProp(_el$
|
|
5044
|
-
return _el$
|
|
5666
|
+
var _el$34 = createElement("text");
|
|
5667
|
+
insert(_el$34, line);
|
|
5668
|
+
effect((_$p) => setProp(_el$34, "fg", text(), _$p));
|
|
5669
|
+
return _el$34;
|
|
5045
5670
|
})()
|
|
5046
5671
|
}));
|
|
5047
|
-
return _el$
|
|
5672
|
+
return _el$33;
|
|
5048
5673
|
})()
|
|
5049
5674
|
}), null);
|
|
5050
|
-
insert(_el$
|
|
5675
|
+
insert(_el$28, createComponent(Show, {
|
|
5051
5676
|
get when() {
|
|
5052
5677
|
return usageHidden();
|
|
5053
5678
|
},
|
|
@@ -5056,14 +5681,14 @@ function Sidebar(props) {
|
|
|
5056
5681
|
return sidebarTextLines(line());
|
|
5057
5682
|
},
|
|
5058
5683
|
children: (part) => (() => {
|
|
5059
|
-
var _el$
|
|
5060
|
-
insert(_el$
|
|
5061
|
-
effect((_$p) => setProp(_el$
|
|
5062
|
-
return _el$
|
|
5684
|
+
var _el$35 = createElement("text");
|
|
5685
|
+
insert(_el$35, part);
|
|
5686
|
+
effect((_$p) => setProp(_el$35, "fg", muted(), _$p));
|
|
5687
|
+
return _el$35;
|
|
5063
5688
|
})()
|
|
5064
5689
|
})
|
|
5065
5690
|
}), null);
|
|
5066
|
-
return _el$
|
|
5691
|
+
return _el$28;
|
|
5067
5692
|
})()
|
|
5068
5693
|
}), null);
|
|
5069
5694
|
insert(_el$16, createComponent(Show, {
|
|
@@ -5071,10 +5696,10 @@ function Sidebar(props) {
|
|
|
5071
5696
|
return performanceLine();
|
|
5072
5697
|
},
|
|
5073
5698
|
children: (line) => (() => {
|
|
5074
|
-
var _el$
|
|
5075
|
-
insert(_el$
|
|
5076
|
-
effect((_$p) => setProp(_el$
|
|
5077
|
-
return _el$
|
|
5699
|
+
var _el$36 = createElement("text");
|
|
5700
|
+
insert(_el$36, line);
|
|
5701
|
+
effect((_$p) => setProp(_el$36, "fg", muted(), _$p));
|
|
5702
|
+
return _el$36;
|
|
5078
5703
|
})()
|
|
5079
5704
|
}), null);
|
|
5080
5705
|
insert(_el$16, createComponent(Show, {
|
|
@@ -5086,10 +5711,10 @@ function Sidebar(props) {
|
|
|
5086
5711
|
return contextSpendLines(line());
|
|
5087
5712
|
},
|
|
5088
5713
|
children: (part) => (() => {
|
|
5089
|
-
var _el$
|
|
5090
|
-
insert(_el$
|
|
5091
|
-
effect((_$p) => setProp(_el$
|
|
5092
|
-
return _el$
|
|
5714
|
+
var _el$37 = createElement("text");
|
|
5715
|
+
insert(_el$37, part);
|
|
5716
|
+
effect((_$p) => setProp(_el$37, "fg", muted(), _$p));
|
|
5717
|
+
return _el$37;
|
|
5093
5718
|
})()
|
|
5094
5719
|
})
|
|
5095
5720
|
}), null);
|
|
@@ -5130,22 +5755,22 @@ function Sidebar(props) {
|
|
|
5130
5755
|
return model.branch();
|
|
5131
5756
|
},
|
|
5132
5757
|
children: (value) => (() => {
|
|
5133
|
-
var _el$
|
|
5134
|
-
insertNode(_el$
|
|
5135
|
-
insertNode(_el$
|
|
5136
|
-
setProp(_el$
|
|
5137
|
-
insertNode(_el$
|
|
5138
|
-
insert(_el$
|
|
5758
|
+
var _el$38 = createElement("box"), _el$39 = createElement("text"), _el$41 = createElement("text");
|
|
5759
|
+
insertNode(_el$38, _el$39);
|
|
5760
|
+
insertNode(_el$38, _el$41);
|
|
5761
|
+
setProp(_el$38, "flexDirection", "row");
|
|
5762
|
+
insertNode(_el$39, createTextNode(`⎇ `));
|
|
5763
|
+
insert(_el$41, () => truncateLabel(value(), 32));
|
|
5139
5764
|
effect((_p$) => {
|
|
5140
|
-
var _v$
|
|
5141
|
-
_v$
|
|
5142
|
-
_v$
|
|
5765
|
+
var _v$3 = muted(), _v$4 = text();
|
|
5766
|
+
_v$3 !== _p$.e && (_p$.e = setProp(_el$39, "fg", _v$3, _p$.e));
|
|
5767
|
+
_v$4 !== _p$.t && (_p$.t = setProp(_el$41, "fg", _v$4, _p$.t));
|
|
5143
5768
|
return _p$;
|
|
5144
5769
|
}, {
|
|
5145
5770
|
e: void 0,
|
|
5146
5771
|
t: void 0
|
|
5147
5772
|
});
|
|
5148
|
-
return _el$
|
|
5773
|
+
return _el$38;
|
|
5149
5774
|
})()
|
|
5150
5775
|
}), null);
|
|
5151
5776
|
insert(_el$18, createComponent(Show, {
|
|
@@ -5153,10 +5778,10 @@ function Sidebar(props) {
|
|
|
5153
5778
|
return model.gitLine();
|
|
5154
5779
|
},
|
|
5155
5780
|
children: (line) => (() => {
|
|
5156
|
-
var _el$
|
|
5157
|
-
insert(_el$
|
|
5158
|
-
effect((_$p) => setProp(_el$
|
|
5159
|
-
return _el$
|
|
5781
|
+
var _el$42 = createElement("text");
|
|
5782
|
+
insert(_el$42, line);
|
|
5783
|
+
effect((_$p) => setProp(_el$42, "fg", text(), _$p));
|
|
5784
|
+
return _el$42;
|
|
5160
5785
|
})()
|
|
5161
5786
|
}), null);
|
|
5162
5787
|
return _el$18;
|
|
@@ -5203,10 +5828,10 @@ function Sidebar(props) {
|
|
|
5203
5828
|
return model.todo().visible;
|
|
5204
5829
|
},
|
|
5205
5830
|
children: (item) => (() => {
|
|
5206
|
-
var _el$
|
|
5207
|
-
insert(_el$
|
|
5208
|
-
effect((_$p) => setProp(_el$
|
|
5209
|
-
return _el$
|
|
5831
|
+
var _el$43 = createElement("text");
|
|
5832
|
+
insert(_el$43, () => todoRowText(item));
|
|
5833
|
+
effect((_$p) => setProp(_el$43, "fg", todoFg(item.status), _$p));
|
|
5834
|
+
return _el$43;
|
|
5210
5835
|
})()
|
|
5211
5836
|
}), null);
|
|
5212
5837
|
insert(_el$22, createComponent(Show, {
|
|
@@ -5214,10 +5839,10 @@ function Sidebar(props) {
|
|
|
5214
5839
|
return hiddenTodoText(model.todo().hidden);
|
|
5215
5840
|
},
|
|
5216
5841
|
children: (line) => (() => {
|
|
5217
|
-
var _el$
|
|
5218
|
-
insert(_el$
|
|
5219
|
-
effect((_$p) => setProp(_el$
|
|
5220
|
-
return _el$
|
|
5842
|
+
var _el$44 = createElement("text");
|
|
5843
|
+
insert(_el$44, line);
|
|
5844
|
+
effect((_$p) => setProp(_el$44, "fg", muted(), _$p));
|
|
5845
|
+
return _el$44;
|
|
5221
5846
|
})()
|
|
5222
5847
|
}), null);
|
|
5223
5848
|
return _el$22;
|
|
@@ -5248,9 +5873,9 @@ function Sidebar(props) {
|
|
|
5248
5873
|
return dispatchView();
|
|
5249
5874
|
},
|
|
5250
5875
|
children: (view) => (() => {
|
|
5251
|
-
var _el$
|
|
5252
|
-
setProp(_el$
|
|
5253
|
-
insert(_el$
|
|
5876
|
+
var _el$45 = createElement("box");
|
|
5877
|
+
setProp(_el$45, "flexDirection", "column");
|
|
5878
|
+
insert(_el$45, createComponent(BlockHeader, {
|
|
5254
5879
|
get icon() {
|
|
5255
5880
|
return BLOCK_ICONS.dispatch;
|
|
5256
5881
|
},
|
|
@@ -5265,100 +5890,91 @@ function Sidebar(props) {
|
|
|
5265
5890
|
return dispatchSummary();
|
|
5266
5891
|
}
|
|
5267
5892
|
}), null);
|
|
5268
|
-
insert(_el$
|
|
5893
|
+
insert(_el$45, createComponent(For, {
|
|
5269
5894
|
get each() {
|
|
5270
5895
|
return view().running;
|
|
5271
5896
|
},
|
|
5272
5897
|
children: (row) => (() => {
|
|
5273
|
-
var _el$
|
|
5274
|
-
insertNode(_el$
|
|
5275
|
-
setProp(_el$
|
|
5276
|
-
insert(_el$
|
|
5898
|
+
var _el$47 = createElement("box"), _el$48 = createElement("text");
|
|
5899
|
+
insertNode(_el$47, _el$48);
|
|
5900
|
+
setProp(_el$47, "flexShrink", 0);
|
|
5901
|
+
insert(_el$48, () => row.text);
|
|
5277
5902
|
effect((_p$) => {
|
|
5278
|
-
var _v$
|
|
5279
|
-
_v$
|
|
5280
|
-
_v$
|
|
5903
|
+
var _v$5 = open(row.id), _v$6 = tone("success");
|
|
5904
|
+
_v$5 !== _p$.e && (_p$.e = setProp(_el$47, "onMouseDown", _v$5, _p$.e));
|
|
5905
|
+
_v$6 !== _p$.t && (_p$.t = setProp(_el$48, "fg", _v$6, _p$.t));
|
|
5281
5906
|
return _p$;
|
|
5282
5907
|
}, {
|
|
5283
5908
|
e: void 0,
|
|
5284
5909
|
t: void 0
|
|
5285
5910
|
});
|
|
5286
|
-
return _el$
|
|
5911
|
+
return _el$47;
|
|
5287
5912
|
})()
|
|
5288
5913
|
}), null);
|
|
5289
|
-
insert(_el$
|
|
5914
|
+
insert(_el$45, createComponent(Show, {
|
|
5290
5915
|
get when() {
|
|
5291
5916
|
return view().runningHidden > 0;
|
|
5292
5917
|
},
|
|
5293
5918
|
get children() {
|
|
5294
|
-
var _el$
|
|
5295
|
-
insert(_el$
|
|
5296
|
-
effect((_$p) => setProp(_el$
|
|
5297
|
-
return _el$
|
|
5919
|
+
var _el$46 = createElement("text");
|
|
5920
|
+
insert(_el$46, () => `\u2026 +${view().runningHidden} rodando`);
|
|
5921
|
+
effect((_$p) => setProp(_el$46, "fg", muted(), _$p));
|
|
5922
|
+
return _el$46;
|
|
5298
5923
|
}
|
|
5299
5924
|
}), null);
|
|
5300
|
-
insert(_el$
|
|
5925
|
+
insert(_el$45, createComponent(Show, {
|
|
5301
5926
|
get when() {
|
|
5302
5927
|
return view().summary;
|
|
5303
5928
|
},
|
|
5304
5929
|
children: (line) => (() => {
|
|
5305
|
-
var _el$
|
|
5306
|
-
insertNode(_el$
|
|
5307
|
-
setProp(_el$
|
|
5308
|
-
setProp(_el$
|
|
5309
|
-
insert(_el$
|
|
5310
|
-
insert(_el$
|
|
5930
|
+
var _el$49 = createElement("box"), _el$50 = createElement("text");
|
|
5931
|
+
insertNode(_el$49, _el$50);
|
|
5932
|
+
setProp(_el$49, "flexDirection", "row");
|
|
5933
|
+
setProp(_el$49, "flexShrink", 0);
|
|
5934
|
+
insert(_el$50, line);
|
|
5935
|
+
insert(_el$49, createComponent(Show, {
|
|
5311
5936
|
get when() {
|
|
5312
5937
|
return failedSuffix();
|
|
5313
5938
|
},
|
|
5314
5939
|
children: (suffix) => (() => {
|
|
5315
|
-
var _el$
|
|
5316
|
-
insert(_el$
|
|
5317
|
-
effect((_$p) => setProp(_el$
|
|
5318
|
-
return _el$
|
|
5940
|
+
var _el$51 = createElement("text");
|
|
5941
|
+
insert(_el$51, () => `${SPEND_LINE_SEPARATOR}${suffix()}`);
|
|
5942
|
+
effect((_$p) => setProp(_el$51, "fg", tone("error"), _$p));
|
|
5943
|
+
return _el$51;
|
|
5319
5944
|
})()
|
|
5320
5945
|
}), null);
|
|
5321
|
-
effect((_$p) => setProp(_el$
|
|
5322
|
-
return _el$
|
|
5946
|
+
effect((_$p) => setProp(_el$50, "fg", muted(), _$p));
|
|
5947
|
+
return _el$49;
|
|
5323
5948
|
})()
|
|
5324
5949
|
}), null);
|
|
5325
|
-
insert(_el$
|
|
5950
|
+
insert(_el$45, createComponent(For, {
|
|
5326
5951
|
get each() {
|
|
5327
5952
|
return view().agents;
|
|
5328
5953
|
},
|
|
5329
5954
|
children: (row) => (() => {
|
|
5330
|
-
var _el$
|
|
5331
|
-
insert(_el$
|
|
5332
|
-
effect((_$p) => setProp(_el$
|
|
5333
|
-
return _el$
|
|
5955
|
+
var _el$52 = createElement("text");
|
|
5956
|
+
insert(_el$52, () => childAgentRowText(row));
|
|
5957
|
+
effect((_$p) => setProp(_el$52, "fg", muted(), _$p));
|
|
5958
|
+
return _el$52;
|
|
5334
5959
|
})()
|
|
5335
5960
|
}), null);
|
|
5336
|
-
insert(_el$
|
|
5961
|
+
insert(_el$45, createComponent(Show, {
|
|
5337
5962
|
get when() {
|
|
5338
5963
|
return hiddenChildAgentsText(view().agentsHidden, view().agentsHiddenCost);
|
|
5339
5964
|
},
|
|
5340
5965
|
children: (line) => (() => {
|
|
5341
|
-
var _el$
|
|
5342
|
-
insert(_el$
|
|
5343
|
-
effect((_$p) => setProp(_el$
|
|
5344
|
-
return _el$
|
|
5966
|
+
var _el$53 = createElement("text");
|
|
5967
|
+
insert(_el$53, line);
|
|
5968
|
+
effect((_$p) => setProp(_el$53, "fg", muted(), _$p));
|
|
5969
|
+
return _el$53;
|
|
5345
5970
|
})()
|
|
5346
5971
|
}), null);
|
|
5347
|
-
return _el$
|
|
5972
|
+
return _el$45;
|
|
5348
5973
|
})()
|
|
5349
5974
|
}), null);
|
|
5350
5975
|
return _el$23;
|
|
5351
5976
|
}
|
|
5352
5977
|
}), null);
|
|
5353
|
-
effect((_p$) => {
|
|
5354
|
-
var _v$3 = text(), _v$4 = muted();
|
|
5355
|
-
_v$3 !== _p$.e && (_p$.e = setProp(_el$13, "fg", _v$3, _p$.e));
|
|
5356
|
-
_v$4 !== _p$.t && (_p$.t = setProp(_el$14, "fg", _v$4, _p$.t));
|
|
5357
|
-
return _p$;
|
|
5358
|
-
}, {
|
|
5359
|
-
e: void 0,
|
|
5360
|
-
t: void 0
|
|
5361
|
-
});
|
|
5362
5978
|
return _el$12;
|
|
5363
5979
|
})();
|
|
5364
5980
|
}
|
|
@@ -5389,7 +6005,7 @@ function runDispatchPanelCommand(action, panel, model) {
|
|
|
5389
6005
|
* focused and the composer lost its keys. `enabled` (the documented gate) makes
|
|
5390
6006
|
* the whole layer inert until `panel.focused` is true. Pure. */
|
|
5391
6007
|
function dispatchPanelKeymapLayer(panel, model) {
|
|
5392
|
-
const focused = () => panel.focused === true;
|
|
6008
|
+
const focused = () => panel.focused === true && !pantheonSettingsBlocking();
|
|
5393
6009
|
return {
|
|
5394
6010
|
mode: "global",
|
|
5395
6011
|
enabled: focused,
|
|
@@ -5428,25 +6044,25 @@ function DispatchPanel(props) {
|
|
|
5428
6044
|
return model.visible().rows;
|
|
5429
6045
|
},
|
|
5430
6046
|
children: (row) => (() => {
|
|
5431
|
-
var _el$
|
|
5432
|
-
insertNode(_el$
|
|
5433
|
-
insertNode(_el$
|
|
5434
|
-
setProp(_el$
|
|
5435
|
-
setProp(_el$
|
|
5436
|
-
insert(_el$
|
|
5437
|
-
insert(_el$
|
|
6047
|
+
var _el$54 = createElement("box"), _el$55 = createElement("text"), _el$56 = createElement("text");
|
|
6048
|
+
insertNode(_el$54, _el$55);
|
|
6049
|
+
insertNode(_el$54, _el$56);
|
|
6050
|
+
setProp(_el$54, "flexDirection", "row");
|
|
6051
|
+
setProp(_el$54, "flexShrink", 0);
|
|
6052
|
+
insert(_el$55, () => selected(row.id) ? `▸ ` : " ");
|
|
6053
|
+
insert(_el$56, () => row.text);
|
|
5438
6054
|
effect((_p$) => {
|
|
5439
|
-
var _v$
|
|
5440
|
-
_v$
|
|
5441
|
-
_v$
|
|
5442
|
-
_v$
|
|
6055
|
+
var _v$7 = selected(row.id) ? text() : muted(), _v$8 = rowFg(row.state), _v$9 = selected(row.id) ? 1 : 0;
|
|
6056
|
+
_v$7 !== _p$.e && (_p$.e = setProp(_el$55, "fg", _v$7, _p$.e));
|
|
6057
|
+
_v$8 !== _p$.t && (_p$.t = setProp(_el$56, "fg", _v$8, _p$.t));
|
|
6058
|
+
_v$9 !== _p$.a && (_p$.a = setProp(_el$56, "attributes", _v$9, _p$.a));
|
|
5443
6059
|
return _p$;
|
|
5444
6060
|
}, {
|
|
5445
6061
|
e: void 0,
|
|
5446
6062
|
t: void 0,
|
|
5447
6063
|
a: void 0
|
|
5448
6064
|
});
|
|
5449
|
-
return _el$
|
|
6065
|
+
return _el$54;
|
|
5450
6066
|
})()
|
|
5451
6067
|
});
|
|
5452
6068
|
const detail = () => createComponent(For, {
|
|
@@ -5454,28 +6070,28 @@ function DispatchPanel(props) {
|
|
|
5454
6070
|
return model.detail();
|
|
5455
6071
|
},
|
|
5456
6072
|
children: (line, index) => (() => {
|
|
5457
|
-
var _el$
|
|
5458
|
-
insert(_el$
|
|
5459
|
-
effect((_$p) => setProp(_el$
|
|
5460
|
-
return _el$
|
|
6073
|
+
var _el$57 = createElement("text");
|
|
6074
|
+
insert(_el$57, line);
|
|
6075
|
+
effect((_$p) => setProp(_el$57, "fg", index() === 0 ? text() : muted(), _$p));
|
|
6076
|
+
return _el$57;
|
|
5461
6077
|
})()
|
|
5462
6078
|
});
|
|
5463
6079
|
const empty = () => (() => {
|
|
5464
|
-
var _el$
|
|
5465
|
-
insertNode(_el$
|
|
5466
|
-
effect((_$p) => setProp(_el$
|
|
5467
|
-
return _el$
|
|
6080
|
+
var _el$58 = createElement("text");
|
|
6081
|
+
insertNode(_el$58, createTextNode(`Nenhuma sessão delegada`));
|
|
6082
|
+
effect((_$p) => setProp(_el$58, "fg", muted(), _$p));
|
|
6083
|
+
return _el$58;
|
|
5468
6084
|
})();
|
|
5469
6085
|
return (() => {
|
|
5470
|
-
var _el$
|
|
5471
|
-
insertNode(_el$
|
|
5472
|
-
insertNode(_el$
|
|
5473
|
-
insertNode(_el$
|
|
5474
|
-
insertNode(_el$
|
|
5475
|
-
setProp(_el$
|
|
5476
|
-
setProp(_el$
|
|
5477
|
-
setProp(_el$
|
|
5478
|
-
insert(_el$
|
|
6086
|
+
var _el$60 = createElement("box"), _el$61 = createElement("text"), _el$62 = createElement("text"), _el$66 = createElement("box"), _el$67 = createElement("text");
|
|
6087
|
+
insertNode(_el$60, _el$61);
|
|
6088
|
+
insertNode(_el$60, _el$62);
|
|
6089
|
+
insertNode(_el$60, _el$66);
|
|
6090
|
+
insertNode(_el$60, _el$67);
|
|
6091
|
+
setProp(_el$60, "flexDirection", "column");
|
|
6092
|
+
setProp(_el$60, "width", "100%");
|
|
6093
|
+
setProp(_el$60, "padding", 1);
|
|
6094
|
+
insert(_el$60, createComponent(DispatchPanelKeymap, {
|
|
5479
6095
|
get context() {
|
|
5480
6096
|
return props.context;
|
|
5481
6097
|
},
|
|
@@ -5483,30 +6099,30 @@ function DispatchPanel(props) {
|
|
|
5483
6099
|
return props.panel;
|
|
5484
6100
|
},
|
|
5485
6101
|
model
|
|
5486
|
-
}), _el$
|
|
5487
|
-
setProp(_el$
|
|
5488
|
-
insert(_el$
|
|
5489
|
-
insert(_el$
|
|
6102
|
+
}), _el$61);
|
|
6103
|
+
setProp(_el$61, "attributes", 1);
|
|
6104
|
+
insert(_el$61, () => model.title());
|
|
6105
|
+
insert(_el$60, createComponent(Show, {
|
|
5490
6106
|
get when() {
|
|
5491
6107
|
return model.header();
|
|
5492
6108
|
},
|
|
5493
6109
|
children: (line) => (() => {
|
|
5494
|
-
var _el$
|
|
5495
|
-
insert(_el$
|
|
5496
|
-
effect((_$p) => setProp(_el$
|
|
5497
|
-
return _el$
|
|
6110
|
+
var _el$68 = createElement("text");
|
|
6111
|
+
insert(_el$68, line);
|
|
6112
|
+
effect((_$p) => setProp(_el$68, "fg", muted(), _$p));
|
|
6113
|
+
return _el$68;
|
|
5498
6114
|
})()
|
|
5499
|
-
}), _el$
|
|
5500
|
-
insert(_el$
|
|
5501
|
-
insert(_el$
|
|
6115
|
+
}), _el$62);
|
|
6116
|
+
insert(_el$62, () => dispatchPanelRule(props.panel.width - 2));
|
|
6117
|
+
insert(_el$60, createComponent(Show, {
|
|
5502
6118
|
get when() {
|
|
5503
6119
|
return model.layout().mode === "wide";
|
|
5504
6120
|
},
|
|
5505
6121
|
get fallback() {
|
|
5506
6122
|
return (() => {
|
|
5507
|
-
var _el$
|
|
5508
|
-
setProp(_el$
|
|
5509
|
-
insert(_el$
|
|
6123
|
+
var _el$69 = createElement("box");
|
|
6124
|
+
setProp(_el$69, "flexDirection", "column");
|
|
6125
|
+
insert(_el$69, createComponent(Show, {
|
|
5510
6126
|
get when() {
|
|
5511
6127
|
return model.rows().length > 0;
|
|
5512
6128
|
},
|
|
@@ -5514,34 +6130,34 @@ function DispatchPanel(props) {
|
|
|
5514
6130
|
return empty();
|
|
5515
6131
|
},
|
|
5516
6132
|
get children() {
|
|
5517
|
-
var _el$
|
|
5518
|
-
setProp(_el$
|
|
5519
|
-
insert(_el$
|
|
5520
|
-
return _el$
|
|
6133
|
+
var _el$70 = createElement("box");
|
|
6134
|
+
setProp(_el$70, "flexDirection", "column");
|
|
6135
|
+
insert(_el$70, rows);
|
|
6136
|
+
return _el$70;
|
|
5521
6137
|
}
|
|
5522
6138
|
}), null);
|
|
5523
|
-
insert(_el$
|
|
6139
|
+
insert(_el$69, createComponent(Show, {
|
|
5524
6140
|
get when() {
|
|
5525
6141
|
return model.selectedID();
|
|
5526
6142
|
},
|
|
5527
6143
|
get children() {
|
|
5528
|
-
var _el$
|
|
5529
|
-
insertNode(_el$
|
|
5530
|
-
setProp(_el$
|
|
5531
|
-
setProp(_el$
|
|
5532
|
-
insert(_el$
|
|
5533
|
-
return _el$
|
|
6144
|
+
var _el$71 = createElement("box"), _el$72 = createElement("box");
|
|
6145
|
+
insertNode(_el$71, _el$72);
|
|
6146
|
+
setProp(_el$71, "flexDirection", "column");
|
|
6147
|
+
setProp(_el$72, "height", 1);
|
|
6148
|
+
insert(_el$71, detail, null);
|
|
6149
|
+
return _el$71;
|
|
5534
6150
|
}
|
|
5535
6151
|
}), null);
|
|
5536
|
-
return _el$
|
|
6152
|
+
return _el$69;
|
|
5537
6153
|
})();
|
|
5538
6154
|
},
|
|
5539
6155
|
get children() {
|
|
5540
|
-
var _el$
|
|
5541
|
-
insertNode(_el$
|
|
5542
|
-
setProp(_el$
|
|
5543
|
-
setProp(_el$
|
|
5544
|
-
insert(_el$
|
|
6156
|
+
var _el$63 = createElement("box"), _el$64 = createElement("box");
|
|
6157
|
+
insertNode(_el$63, _el$64);
|
|
6158
|
+
setProp(_el$63, "flexDirection", "row");
|
|
6159
|
+
setProp(_el$64, "flexDirection", "column");
|
|
6160
|
+
insert(_el$64, createComponent(Show, {
|
|
5545
6161
|
get when() {
|
|
5546
6162
|
return model.rows().length > 0;
|
|
5547
6163
|
},
|
|
@@ -5552,36 +6168,36 @@ function DispatchPanel(props) {
|
|
|
5552
6168
|
return rows();
|
|
5553
6169
|
}
|
|
5554
6170
|
}));
|
|
5555
|
-
insert(_el$
|
|
6171
|
+
insert(_el$63, createComponent(Show, {
|
|
5556
6172
|
get when() {
|
|
5557
6173
|
return model.selectedID();
|
|
5558
6174
|
},
|
|
5559
6175
|
get children() {
|
|
5560
|
-
var _el$
|
|
5561
|
-
setProp(_el$
|
|
5562
|
-
insert(_el$
|
|
5563
|
-
effect((_$p) => setProp(_el$
|
|
5564
|
-
return _el$
|
|
6176
|
+
var _el$65 = createElement("box");
|
|
6177
|
+
setProp(_el$65, "flexDirection", "column");
|
|
6178
|
+
insert(_el$65, detail);
|
|
6179
|
+
effect((_$p) => setProp(_el$65, "width", model.layout().detailWidth, _$p));
|
|
6180
|
+
return _el$65;
|
|
5565
6181
|
}
|
|
5566
6182
|
}), null);
|
|
5567
|
-
effect((_$p) => setProp(_el$
|
|
5568
|
-
return _el$
|
|
6183
|
+
effect((_$p) => setProp(_el$64, "width", model.layout().listWidth, _$p));
|
|
6184
|
+
return _el$63;
|
|
5569
6185
|
}
|
|
5570
|
-
}), _el$
|
|
5571
|
-
setProp(_el$
|
|
5572
|
-
insert(_el$
|
|
6186
|
+
}), _el$66);
|
|
6187
|
+
setProp(_el$66, "height", 1);
|
|
6188
|
+
insert(_el$67, () => model.footer());
|
|
5573
6189
|
effect((_p$) => {
|
|
5574
|
-
var _v$
|
|
5575
|
-
_v$
|
|
5576
|
-
_v$
|
|
5577
|
-
_v$
|
|
6190
|
+
var _v$0 = text(), _v$1 = muted(), _v$10 = muted();
|
|
6191
|
+
_v$0 !== _p$.e && (_p$.e = setProp(_el$61, "fg", _v$0, _p$.e));
|
|
6192
|
+
_v$1 !== _p$.t && (_p$.t = setProp(_el$62, "fg", _v$1, _p$.t));
|
|
6193
|
+
_v$10 !== _p$.a && (_p$.a = setProp(_el$67, "fg", _v$10, _p$.a));
|
|
5578
6194
|
return _p$;
|
|
5579
6195
|
}, {
|
|
5580
6196
|
e: void 0,
|
|
5581
6197
|
t: void 0,
|
|
5582
6198
|
a: void 0
|
|
5583
6199
|
});
|
|
5584
|
-
return _el$
|
|
6200
|
+
return _el$60;
|
|
5585
6201
|
})();
|
|
5586
6202
|
}
|
|
5587
6203
|
/** App-level command claim: the only way into the panel. It registers the
|
|
@@ -5621,7 +6237,7 @@ function PantheonSettingsCommandLayer(props) {
|
|
|
5621
6237
|
palette: true,
|
|
5622
6238
|
slash: { name: "pantheon-settings" },
|
|
5623
6239
|
run: () => {
|
|
5624
|
-
|
|
6240
|
+
openPantheonSettings(props.context);
|
|
5625
6241
|
}
|
|
5626
6242
|
}]
|
|
5627
6243
|
}));
|
|
@@ -5633,12 +6249,17 @@ function PantheonSettingsCommandLayer(props) {
|
|
|
5633
6249
|
function HomeStatus(props) {
|
|
5634
6250
|
const preset = useActivePreset(props.context).preset;
|
|
5635
6251
|
const muted = () => props.context.theme?.text?.muted ?? props.context.theme?.text?.base;
|
|
5636
|
-
return (
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
6252
|
+
return createComponent(Show, {
|
|
6253
|
+
get when() {
|
|
6254
|
+
return tuiPrefs().footer.home;
|
|
6255
|
+
},
|
|
6256
|
+
get children() {
|
|
6257
|
+
var _el$73 = createElement("text");
|
|
6258
|
+
insert(_el$73, () => `Pantheon v2.0.0-beta.5${preset().name ? ` ▸ ${preset().name}` : ""}`);
|
|
6259
|
+
effect((_$p) => setProp(_el$73, "fg", muted(), _$p));
|
|
6260
|
+
return _el$73;
|
|
6261
|
+
}
|
|
6262
|
+
});
|
|
5642
6263
|
}
|
|
5643
6264
|
/** Lean footer model: only the preset label and the live delegation count. It
|
|
5644
6265
|
* deliberately does not reuse `createSidebarModel` — that model owns the
|
|
@@ -5689,13 +6310,13 @@ function PromptFooter(props) {
|
|
|
5689
6310
|
const muted = () => props.context.theme?.text?.muted ?? props.context.theme?.text?.base;
|
|
5690
6311
|
return createComponent(Show, {
|
|
5691
6312
|
get when() {
|
|
5692
|
-
return model.running() > 0;
|
|
6313
|
+
return memo(() => !!tuiPrefs().footer.prompt)() && model.running() > 0;
|
|
5693
6314
|
},
|
|
5694
6315
|
get children() {
|
|
5695
|
-
var _el$
|
|
5696
|
-
insert(_el$
|
|
5697
|
-
effect((_$p) => setProp(_el$
|
|
5698
|
-
return _el$
|
|
6316
|
+
var _el$74 = createElement("text");
|
|
6317
|
+
insert(_el$74, () => `▸${model.preset().name ?? "default"} · ✦${model.running()} ativos`);
|
|
6318
|
+
effect((_$p) => setProp(_el$74, "fg", muted(), _$p));
|
|
6319
|
+
return _el$74;
|
|
5699
6320
|
}
|
|
5700
6321
|
});
|
|
5701
6322
|
}
|
|
@@ -5705,6 +6326,7 @@ const plugin = Plugin.define({
|
|
|
5705
6326
|
const globalState = globalThis;
|
|
5706
6327
|
if (globalState[SINGLETON]) return;
|
|
5707
6328
|
globalState[SINGLETON] = true;
|
|
6329
|
+
initTuiPrefs(context);
|
|
5708
6330
|
warmUpSidebarData(context, resolveLocation(context));
|
|
5709
6331
|
const unregisterSidebar = context.ui.slot({
|
|
5710
6332
|
append: "sidebar.content",
|
|
@@ -5749,6 +6371,9 @@ const plugin = Plugin.define({
|
|
|
5749
6371
|
append: "app",
|
|
5750
6372
|
render: () => createComponent(PantheonSettingsCommandLayer, { context })
|
|
5751
6373
|
});
|
|
6374
|
+
try {
|
|
6375
|
+
setupPantheonSettings(context);
|
|
6376
|
+
} catch {}
|
|
5752
6377
|
maybeShowWhatsNewV2(context);
|
|
5753
6378
|
return () => {
|
|
5754
6379
|
clearTimeout(updateNoticeTimer);
|