@xmoon76/dsh-pi-tui 0.5.6 → 0.5.8
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/LICENSE +33 -0
- package/README.en.md +103 -814
- package/README.md +102 -711
- package/cordis.patch.yml +186 -0
- package/dist/acp-preferences.d.mts +29 -0
- package/dist/acp-preferences.mjs +15 -0
- package/dist/{bootstrap-DQ4YPL-7.mjs → bootstrap-CMIjGyuk.mjs} +33515 -7587
- package/dist/builtins.mjs +3 -3
- package/dist/{client-bootstrap-Cr1JCaF5.mjs → client-bootstrap-BjGPc-DM.mjs} +4637 -492
- package/dist/client-extension-loader-probe-BUw7q8bJ.mjs +119 -0
- package/dist/command-trust-DChWUamk.mjs +406 -0
- package/dist/daemon-launcher-Dult7Jxv.mjs +1932 -0
- package/dist/daemon-launcher.d.mts +159 -0
- package/dist/daemon-launcher.mjs +2 -0
- package/dist/diagnostics-D5jwc-q1.d.mts +11 -0
- package/dist/{dist-CIsR7cz4.mjs → dist-BFgC-5tL.mjs} +938 -487
- package/dist/entry-control-DjNsE3I0.mjs +190 -0
- package/dist/extension/advanced.d.mts +1 -1
- package/dist/extension/unstable.d.mts +1 -1
- package/dist/extension-config-probe-BDdvutkG.mjs +95 -0
- package/dist/extension-config.d.mts +29 -0
- package/dist/extension-config.mjs +22 -0
- package/dist/{extensions-Bp0L37lP.mjs → extensions-B4uLpSTv.mjs} +1109 -100
- package/dist/{extensions-Bte3XOt5.d.mts → extensions-C8eAM0gX.d.mts} +1 -1
- package/dist/extensions.d.mts +2 -2
- package/dist/extensions.mjs +1 -1
- package/dist/{host-bootstrap-DilsvA6f.mjs → host-bootstrap-MVxks641.mjs} +129 -24
- package/dist/{host-foundation-probe--5jtvHVe.mjs → host-foundation-probe-DMNTmNrH.mjs} +2 -2
- package/dist/host-runtime.d.mts +11 -5
- package/dist/host-runtime.mjs +4171 -920
- package/dist/index.d.mts +86 -174
- package/dist/index.mjs +38087 -9967
- package/dist/local-acp-listener-B65J0Bx4.mjs +3115 -0
- package/dist/local-client.mjs +1158 -59
- package/dist/local-daemon-control-C14q9KnD.mjs +1588 -0
- package/dist/local-daemon-control-TCnERL7n.mjs +1424 -0
- package/dist/local-discovery-DOSsCh9q.mjs +2883 -0
- package/dist/local-discovery-egN4_gsQ.mjs +2 -0
- package/dist/local-discovery-uOBfFq5j.mjs +2764 -0
- package/dist/local-host.mjs +812 -89
- package/dist/local-profile-daemon-admin-BmQSdzT0.mjs +210 -0
- package/dist/local-scope-DamiMqPd.mjs +1340 -0
- package/dist/{local-transport-BVwFYq_Y.mjs → local-transport-Iwo0mtu3.mjs} +313 -38
- package/dist/local-web-control-DMrjwCkl.mjs +454 -0
- package/dist/local-workspace-object-D06GL0UO.mjs +248 -0
- package/dist/native/darwin/prebuilds/darwin-arm64/darwin-platform.node +0 -0
- package/dist/native/darwin/prebuilds/darwin-x64/darwin-platform.node +0 -0
- package/dist/open-CmOBxSjN.mjs +63 -0
- package/dist/persisted-setting-probe-DWZLtWoB.mjs +145 -0
- package/dist/pi-tui-acp-access-contract-BdLwduU6.mjs +75 -0
- package/dist/pi-tui-remote-contribution-Do8ECrUy.mjs +1492 -0
- package/dist/pi-tui-terminal-progress-contract-B3RoEzjK.mjs +146 -0
- package/dist/preferences.d.mts +17 -0
- package/dist/preferences.mjs +20 -0
- package/dist/preset-BcWqOtY7.mjs +46 -0
- package/dist/profile-preferences-migration-BfUGdPZx.mjs +500 -0
- package/dist/profile-preferences-migration-CThz4rHH.mjs +2 -0
- package/dist/prompt-sections-DUKmWb8g.mjs +2232 -0
- package/dist/prompt-sections-DXmjB58H.mjs +634 -0
- package/dist/{public-types-Dgf1bDke.d.mts → public-types-C1YgFtwC.d.mts} +56 -3
- package/dist/row-id-DPbyt9Nn.mjs +24 -0
- package/dist/{runtime-status-Cj1nFOdS.mjs → runtime-status-v-FTnWcD.mjs} +49 -3
- package/dist/schema-BTGYn8_X.d.mts +54 -0
- package/dist/schema-qE_P09zJ.mjs +124 -0
- package/dist/{session-BKGXyh80.mjs → session-C6tSs86s.mjs} +9672 -7270
- package/dist/{session-CPt_U8_f.mjs → session-CstInGIA.mjs} +9674 -7273
- package/dist/startup-CarQxWwi.d.mts +213 -0
- package/dist/{startup-7BYWuvBU.mjs → startup-EG5UqIcd.mjs} +341 -26
- package/dist/startup.d.mts +2 -99
- package/dist/startup.mjs +2 -2
- package/dist/{terminal-progress-source-DrqQhtT8.mjs → terminal-progress-source-CpfpQO_h.mjs} +2038 -67
- package/dist/{pasted-path-range-CMnxuGPx.mjs → transcript-view-C1YtJ49Y.mjs} +11590 -6718
- package/dist/{pasted-path-range-r6qzV_tC.mjs → transcript-view-CuJYWkhp.mjs} +12296 -6923
- package/dist/version-B9yC7bBk.mjs +83 -0
- package/dist/visual-tools.d.mts +1 -1
- package/dist/visual-tools.mjs +1 -1
- package/dist/web-preferences.d.mts +1 -1
- package/dist/{web-roster-CjqnUXNk.mjs → web-roster-Dis7BhrA.mjs} +63 -3
- package/generated/dsh-presets/cordis.patch.yml +4 -2
- package/generated/dsh-presets/ptc.patch.yml +4 -0
- package/generated/dsh-presets/standard.patch.yml +7 -0
- package/generated/web-access/cordis.patch.yml +239 -0
- package/package.json +217 -170
- package/dist/entry-control-DnduyDiw.mjs +0 -92
- package/dist/local-discovery-C9VMjc0K.mjs +0 -759
- package/dist/local-discovery-CDaQHA_R.mjs +0 -2
- package/dist/pi-tui-remote-contribution-B0EQsP0N.mjs +0 -85
- package/dist/pi-tui-terminal-progress-contract-CdBH9j78.mjs +0 -70
- package/dist/pi-tui-terminal-progress-contract-MLXZ-i3t.mjs +0 -905
- package/dist/version-a-eF-QER.mjs +0 -80
|
@@ -501,8 +501,26 @@ interface AutocompleteHandle {
|
|
|
501
501
|
readonly id: string;
|
|
502
502
|
dispose(): void;
|
|
503
503
|
}
|
|
504
|
-
/** One
|
|
505
|
-
|
|
504
|
+
/** One JSON scalar an author-declared persisted setting choice may write. */
|
|
505
|
+
type TuiPersistedScalar = string | number | boolean | null;
|
|
506
|
+
/** One author-declared mutation of a persisted extension setting. `set`
|
|
507
|
+
* writes the scalar at `persisted.path`; `unset` restores the inherited
|
|
508
|
+
* effective value at that path. The official Host may materialize and keep
|
|
509
|
+
* the USER field when a sibling override remains; USER-field presence is a
|
|
510
|
+
* displayed fact, never the success predicate. */
|
|
511
|
+
type TuiPersistedChoice = {
|
|
512
|
+
readonly id: string;
|
|
513
|
+
readonly label?: string;
|
|
514
|
+
readonly op: 'set';
|
|
515
|
+
readonly value: TuiPersistedScalar;
|
|
516
|
+
} | {
|
|
517
|
+
readonly id: string;
|
|
518
|
+
readonly label?: string;
|
|
519
|
+
readonly op: 'unset';
|
|
520
|
+
};
|
|
521
|
+
/** One runtime-only settings row (M5): the live value lives in this Client
|
|
522
|
+
* and the plugin's `onChange` is the only writer. */
|
|
523
|
+
interface TuiRuntimeSettingContribution {
|
|
506
524
|
readonly id: string;
|
|
507
525
|
readonly label: string;
|
|
508
526
|
readonly description?: string;
|
|
@@ -511,7 +529,32 @@ interface TuiSettingContribution {
|
|
|
511
529
|
/** Return false to keep the old value (rejection). */
|
|
512
530
|
readonly onChange?: (value: string) => boolean | void | Promise<boolean | void>;
|
|
513
531
|
readonly order?: number;
|
|
532
|
+
/** Persisted settings are a separate, explicit opt-in mode. */
|
|
533
|
+
readonly persisted?: never;
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* One persisted settings row (R8-E PR-4): the author declares a JSON scalar
|
|
537
|
+
* path relative to the package's official Config `data` plus a closed choice
|
|
538
|
+
* list. The Host Profile Config remains the sole persistence authority; the
|
|
539
|
+
* Client never stores a second copy. `currentValue` is this Client's live
|
|
540
|
+
* runtime fact and is never read back from the Host value.
|
|
541
|
+
*/
|
|
542
|
+
interface TuiPersistedSettingContribution {
|
|
543
|
+
readonly id: string;
|
|
544
|
+
readonly label: string;
|
|
545
|
+
readonly description?: string;
|
|
546
|
+
readonly currentValue: string;
|
|
547
|
+
readonly persisted: {
|
|
548
|
+
readonly path: readonly string[];
|
|
549
|
+
readonly choices: readonly TuiPersistedChoice[];
|
|
550
|
+
};
|
|
551
|
+
readonly values?: never;
|
|
552
|
+
readonly onChange?: never;
|
|
553
|
+
readonly order?: number;
|
|
514
554
|
}
|
|
555
|
+
/** One registered settings row (M5). Runtime-only rows keep their original
|
|
556
|
+
* shape; a persisted row is an explicit discriminated branch (PR-4). */
|
|
557
|
+
type TuiSettingContribution = TuiRuntimeSettingContribution | TuiPersistedSettingContribution;
|
|
515
558
|
/** A live handle on one settings row. */
|
|
516
559
|
interface TuiSettingHandle {
|
|
517
560
|
readonly id: string;
|
|
@@ -527,7 +570,12 @@ interface TuiSettingsRegistrySnapshot {
|
|
|
527
570
|
readonly currentValue: string;
|
|
528
571
|
readonly values: readonly string[];
|
|
529
572
|
readonly order: number;
|
|
530
|
-
readonly owner: string;
|
|
573
|
+
readonly owner: string; /** `runtime` for the original mode, `persisted` for the PR-4 opt-in. */
|
|
574
|
+
readonly mode?: 'runtime' | 'persisted'; /** The frozen author-declared descriptor of a persisted row. */
|
|
575
|
+
readonly persisted?: {
|
|
576
|
+
readonly path: readonly string[];
|
|
577
|
+
readonly choices: readonly TuiPersistedChoice[];
|
|
578
|
+
};
|
|
531
579
|
}[];
|
|
532
580
|
readonly revision: number;
|
|
533
581
|
}
|
|
@@ -576,6 +624,11 @@ interface TuiSettingsRegistryView {
|
|
|
576
624
|
readonly values: readonly string[];
|
|
577
625
|
readonly order: number;
|
|
578
626
|
readonly owner: string;
|
|
627
|
+
readonly mode?: 'runtime' | 'persisted';
|
|
628
|
+
readonly persisted?: {
|
|
629
|
+
readonly path: readonly string[];
|
|
630
|
+
readonly choices: readonly TuiPersistedChoice[];
|
|
631
|
+
};
|
|
579
632
|
}[];
|
|
580
633
|
apply(id: string, value: string): Promise<boolean>;
|
|
581
634
|
snapshot(): TuiSettingsRegistrySnapshot;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
//#region src/domain/extension-config/row-id.ts
|
|
3
|
+
/**
|
|
4
|
+
* The ONE per-package extension-config row identity.
|
|
5
|
+
*
|
|
6
|
+
* The Config carrier row id is derived from the installed npm manifest `name`
|
|
7
|
+
* (the exact UTF-8 `package.json#name`), never from a display name, alias,
|
|
8
|
+
* directory or version. Host-side discovery and the Direct/Remote Settings
|
|
9
|
+
* adapters must derive it through this single neutral function so fixture
|
|
10
|
+
* generation, profile discovery and the config port cannot drift.
|
|
11
|
+
*
|
|
12
|
+
* @module @xmoon76/dsh-pi-tui/domain/extension-config/row-id
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Derive one package's profile-owned Config row id.
|
|
16
|
+
*
|
|
17
|
+
* @param packageName - the resolved npm package name (the manifest `name`).
|
|
18
|
+
* @returns the Loader row id that package's patch must insert.
|
|
19
|
+
*/
|
|
20
|
+
function extensionConfigRowId(packageName) {
|
|
21
|
+
return `pi-tui-extcfg-${createHash("sha256").update(packageName, "utf8").digest("hex").slice(0, 32)}`;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { extensionConfigRowId as t };
|
|
@@ -382,7 +382,11 @@ const ALLOWED_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
|
382
382
|
"dominant-baseline",
|
|
383
383
|
"dx",
|
|
384
384
|
"dy",
|
|
385
|
-
"letter-spacing"
|
|
385
|
+
"letter-spacing",
|
|
386
|
+
"stroke-dasharray",
|
|
387
|
+
"stroke-dashoffset",
|
|
388
|
+
"stroke-miterlimit",
|
|
389
|
+
"color"
|
|
386
390
|
]);
|
|
387
391
|
const URI_ATTRIBUTES = /* @__PURE__ */ new Set(["href", "src"]);
|
|
388
392
|
const PAINT_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
@@ -392,6 +396,8 @@ const PAINT_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
|
392
396
|
"clip-path",
|
|
393
397
|
"mask"
|
|
394
398
|
]);
|
|
399
|
+
/** The `color` attribute feeds resvg's evaluation of `currentColor` paint. */
|
|
400
|
+
const COLOR_ATTRIBUTE = "color";
|
|
395
401
|
const NUMBER_OR_LENGTH_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
396
402
|
"x",
|
|
397
403
|
"y",
|
|
@@ -432,6 +438,10 @@ const COLOR_PATTERN = /^(#[0-9a-fA-F]{3,8}|[a-zA-Z]+|rgb\([^)]*\)|rgba\([^)]*\)|
|
|
|
432
438
|
const TRANSFORM_PATTERN = /^[a-zA-Z]+\([^)]*\)(?:\s*,?\s*[a-zA-Z]+\([^)]*\))*$/;
|
|
433
439
|
const PAINT_URL_PATTERN = /url\(\s*(?:"([^"]*)"|'([^']*)'|([^)'"]*))\s*\)/g;
|
|
434
440
|
const NUMBER_TOKEN_PATTERN = /[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g;
|
|
441
|
+
const DASH_TERM = String.raw`(?:\d+\.?\d*|\.\d+)`;
|
|
442
|
+
const DASH_SEP = String.raw`(?:[ \t]*,[ \t]*|\s+)`;
|
|
443
|
+
const DASH_LIST_PATTERN = new RegExp(`^${DASH_TERM}(?:${DASH_SEP}${DASH_TERM}){0,31}$|^none$`);
|
|
444
|
+
const SIGNED_DECIMAL_PATTERN = /^[+-]?(?:\d+\.?\d*|\.\d+)$/;
|
|
435
445
|
const UNIT_PX = {
|
|
436
446
|
px: 1,
|
|
437
447
|
pt: 4 / 3,
|
|
@@ -475,10 +485,11 @@ function checkLength(value, what, limit) {
|
|
|
475
485
|
if (px > limit) reject(`${what}: ${clip(value)} is ${Math.round(px)}px > ${limit}px`);
|
|
476
486
|
return px;
|
|
477
487
|
}
|
|
478
|
-
function checkPaint(value, what) {
|
|
488
|
+
function checkPaint(value, what, allowCurrentColor) {
|
|
479
489
|
const text = value.trim();
|
|
480
490
|
if (text === "" || text === "none" || text === "inherit") return;
|
|
481
491
|
const lower = text.toLowerCase();
|
|
492
|
+
if (allowCurrentColor && lower === "currentcolor") return;
|
|
482
493
|
if (lower.includes("var(") || lower.includes("currentcolor")) reject(`${what}: theme-dependent paint is outside the v1 fixed-colour subset`);
|
|
483
494
|
for (const match of text.matchAll(PAINT_URL_PATTERN)) {
|
|
484
495
|
const target = (match[1] ?? match[2] ?? match[3] ?? "").trim();
|
|
@@ -490,6 +501,13 @@ function checkPaint(value, what) {
|
|
|
490
501
|
if (!COLOR_PATTERN.test(token)) reject(`${what}: ${clip(token)} is not a colour`);
|
|
491
502
|
}
|
|
492
503
|
}
|
|
504
|
+
/** The static inherited `color` value: one recognizable fixed colour. */
|
|
505
|
+
function checkColor(value, what) {
|
|
506
|
+
const text = value.trim();
|
|
507
|
+
if (text === "" || !COLOR_PATTERN.test(text)) reject(`${what}: ${clip(value)} is not a fixed colour`);
|
|
508
|
+
const lower = text.toLowerCase();
|
|
509
|
+
if (lower === "currentcolor" || lower === "inherit" || lower === "none" || lower.includes("var(") || lower.includes("url(")) reject(`${what}: ${clip(value)} must be a static fixed colour`);
|
|
510
|
+
}
|
|
493
511
|
function checkTransform(value, what) {
|
|
494
512
|
const text = value.trim();
|
|
495
513
|
if (!TRANSFORM_PATTERN.test(text)) reject(`${what}: ${clip(value)} is not a bounded transform list`);
|
|
@@ -552,7 +570,35 @@ function attributeProblem(attribute) {
|
|
|
552
570
|
return;
|
|
553
571
|
}
|
|
554
572
|
if (PAINT_ATTRIBUTES.has(local)) {
|
|
555
|
-
checkPaint(value, what);
|
|
573
|
+
checkPaint(value, what, local === "fill" || local === "stroke" || local === "stop-color");
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
if (local === COLOR_ATTRIBUTE) {
|
|
577
|
+
checkColor(value, what);
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
if (local === "stroke-dasharray") {
|
|
581
|
+
const text = value.trim();
|
|
582
|
+
if (!DASH_LIST_PATTERN.test(text)) reject(`${what}: ${clip(value)} is not a bounded dash list`);
|
|
583
|
+
for (const token of text.split(/[ \t]*,[ \t]*|\s+/u)) {
|
|
584
|
+
if (token === "none") continue;
|
|
585
|
+
const number = Number(token);
|
|
586
|
+
if (!Number.isFinite(number) || number > LIMITS.maxCoord) reject(`${what}: a dash length ${clip(token)} exceeds ${LIMITS.maxCoord}`);
|
|
587
|
+
}
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
if (local === "stroke-dashoffset") {
|
|
591
|
+
const text = value.trim();
|
|
592
|
+
if (!SIGNED_DECIMAL_PATTERN.test(text)) reject(`${what}: ${clip(value)} is not a bounded dash offset`);
|
|
593
|
+
const number = Number(text);
|
|
594
|
+
if (!Number.isFinite(number) || Math.abs(number) > LIMITS.maxCoord) reject(`${what}: a dash offset ${clip(value)} exceeds ${LIMITS.maxCoord}`);
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
if (local === "stroke-miterlimit") {
|
|
598
|
+
const text = value.trim();
|
|
599
|
+
if (!SIGNED_DECIMAL_PATTERN.test(text)) reject(`${what}: ${clip(value)} is not a bounded miter limit`);
|
|
600
|
+
const number = Number(text);
|
|
601
|
+
if (!Number.isFinite(number) || number < 1 || number > 1e3) reject(`${what}: a miter limit must be between 1 and 1000`);
|
|
556
602
|
return;
|
|
557
603
|
}
|
|
558
604
|
if (NUMBER_OR_LENGTH_ATTRIBUTES.has(local)) {
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import { Volatile } from "@deepseek-ai/cordis";
|
|
3
|
+
|
|
4
|
+
//#region src/app/config/schema.d.ts
|
|
5
|
+
/** The canonical `pi-tui-preferences` Config: the 20 shared preferences plus
|
|
6
|
+
* the Host-owned migration marker (`legacySettingsMigrationVersion`, default
|
|
7
|
+
* 0, completion value 2). */
|
|
8
|
+
interface PreferencesConfig {
|
|
9
|
+
readonly theme: Volatile<string>;
|
|
10
|
+
readonly iconStyle: Volatile<string>;
|
|
11
|
+
readonly footer: Volatile<string>;
|
|
12
|
+
readonly footerFallbackMode: Volatile<string>;
|
|
13
|
+
readonly footerLayout: Volatile<unknown>;
|
|
14
|
+
readonly footerCustomItems: Volatile<unknown>;
|
|
15
|
+
readonly footerCommand: Volatile<unknown>;
|
|
16
|
+
readonly fullscreen: Volatile<string>;
|
|
17
|
+
readonly busyEnter: Volatile<string>;
|
|
18
|
+
readonly localShellSandbox: Volatile<string>;
|
|
19
|
+
readonly homeEndKeys: Volatile<string>;
|
|
20
|
+
readonly displayPreset: Volatile<string>;
|
|
21
|
+
readonly progressUpdates: Volatile<string>;
|
|
22
|
+
readonly gitAttribution: Volatile<string>;
|
|
23
|
+
readonly responseStyle: Volatile<string>;
|
|
24
|
+
readonly notificationMode: Volatile<string>;
|
|
25
|
+
readonly notificationMethod: Volatile<string>;
|
|
26
|
+
readonly terminalProgress: Volatile<string>;
|
|
27
|
+
readonly wheelScrollLines: Volatile<string>;
|
|
28
|
+
readonly keybindings: Volatile<unknown>;
|
|
29
|
+
/** Internal one-shot Host migration marker: NEVER a product row, never a
|
|
30
|
+
* behavior switch — it only keeps an already-migrated profile from
|
|
31
|
+
* re-applying old sources over newer user values. */
|
|
32
|
+
readonly legacySettingsMigrationVersion: Volatile<number>;
|
|
33
|
+
}
|
|
34
|
+
declare const PreferencesConfig: z<PreferencesConfig>;
|
|
35
|
+
/** The published root Config: the resumed session id, the internal test-only
|
|
36
|
+
* status sink, the 20 preferences and the marker. `tui-app` declares it; the
|
|
37
|
+
* canonical preferences row declares only {@link PreferencesConfig}. */
|
|
38
|
+
interface Config extends PreferencesConfig {
|
|
39
|
+
/** Resumed session id; a fresh session is created when absent. */
|
|
40
|
+
sessionId?: string;
|
|
41
|
+
/** Test seam: the pre-mount status output (defaults to process.stdout,
|
|
42
|
+
* TTY-gated). Injectable so the runner tests capture the status writes
|
|
43
|
+
* without patching the global stdout (which would fight the test
|
|
44
|
+
* reporter's own writes). STRUCTURAL on purpose: the public Config type
|
|
45
|
+
* must not reference the internal startup-status module (the public
|
|
46
|
+
* .d.mts leak gate). */
|
|
47
|
+
startupStatusOutput?: {
|
|
48
|
+
readonly isTTY?: boolean;
|
|
49
|
+
write(text: string): unknown;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
declare const Config: z<Config>;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { PreferencesConfig as n, Config as t };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
//#region src/app/config/schema.ts
|
|
3
|
+
/**
|
|
4
|
+
* The TUI plugin's Cordis config contract: the resumed session id plus the
|
|
5
|
+
* DSH 0.1.7 profile-owned live TUI preferences. Every preference field is a
|
|
6
|
+
* schemastery `.volatile()` reference.
|
|
7
|
+
*
|
|
8
|
+
* `PREFERENCE_FIELDS` is the ONE field table: the published `Config` (Direct's
|
|
9
|
+
* `tui-app` row, kept for compatibility and as a legacy migration source) and
|
|
10
|
+
* the canonical `PreferencesConfig` (`pi-tui-preferences`) are both derived
|
|
11
|
+
* from it, so the two rows can never drift apart.
|
|
12
|
+
*
|
|
13
|
+
* Authority note: the `tui-app` row is no longer the runtime preference
|
|
14
|
+
* authority; the canonical `pi-tui-preferences` row and its `piTuiPreferences`
|
|
15
|
+
* service are. `tui-app` keeps its schema (and the `sessionId` launch input)
|
|
16
|
+
* only so installed profiles and the published API keep working, and so the
|
|
17
|
+
* Host-owned migration can read the old USER values once.
|
|
18
|
+
*
|
|
19
|
+
* @module @xmoon76/dsh-pi-tui/app/config/schema
|
|
20
|
+
*/
|
|
21
|
+
/** The 20 durable TUI preferences every backend shares. The names are the
|
|
22
|
+
* persisted profile keys; the schema keeps the historical defaults, validators
|
|
23
|
+
* and shapes. */
|
|
24
|
+
const PREFERENCE_FIELDS = {
|
|
25
|
+
/** Theme values: auto | dark | light | custom:<name>. */
|
|
26
|
+
theme: z.string().default("auto").volatile(),
|
|
27
|
+
iconStyle: z.string().default("emoji").volatile(),
|
|
28
|
+
footer: z.string().default("full").volatile(),
|
|
29
|
+
/** The user's LAST NATIVE footer mode ('default' | 'compact' | 'custom'):
|
|
30
|
+
* persisted separately because `footer` itself is overwritten by
|
|
31
|
+
* 'command' when the command surface arms — the command surface's failure
|
|
32
|
+
* fallback resolves from THIS, so a compact user's fallback survives a
|
|
33
|
+
* restart. */
|
|
34
|
+
footerFallbackMode: z.string().default("default").volatile(),
|
|
35
|
+
/** The M2 versioned custom footer layout (a nested object, never a JSON
|
|
36
|
+
* string). No schema default: parseFooterLayout is the authority on the
|
|
37
|
+
* persisted value and resolves absence to the builtin default layout. */
|
|
38
|
+
footerLayout: z.object({
|
|
39
|
+
schemaVersion: z.const(1),
|
|
40
|
+
rows: z.array(z.object({
|
|
41
|
+
left: z.array(z.object({
|
|
42
|
+
id: z.string(),
|
|
43
|
+
format: z.string(),
|
|
44
|
+
tone: z.string(),
|
|
45
|
+
prefix: z.string(),
|
|
46
|
+
suffix: z.string(),
|
|
47
|
+
importance: z.number(),
|
|
48
|
+
hideInTsp: z.boolean()
|
|
49
|
+
})),
|
|
50
|
+
right: z.array(z.object({
|
|
51
|
+
id: z.string(),
|
|
52
|
+
format: z.string(),
|
|
53
|
+
tone: z.string(),
|
|
54
|
+
prefix: z.string(),
|
|
55
|
+
suffix: z.string(),
|
|
56
|
+
importance: z.number(),
|
|
57
|
+
hideInTsp: z.boolean()
|
|
58
|
+
})),
|
|
59
|
+
separator: z.object({
|
|
60
|
+
text: z.string(),
|
|
61
|
+
tone: z.string()
|
|
62
|
+
})
|
|
63
|
+
}))
|
|
64
|
+
}).volatile(),
|
|
65
|
+
/** PR C: the Custom Text/Command definition collection, retained as raw
|
|
66
|
+
* data — the fail-soft parser (footer/custom-items.ts) owns validation. */
|
|
67
|
+
footerCustomItems: z.any().volatile(),
|
|
68
|
+
/** M5: the trusted command status-line config (armed ONLY while the USER
|
|
69
|
+
* profile layer owns it — see resolveTrustedFooterCommand). */
|
|
70
|
+
footerCommand: z.object({
|
|
71
|
+
schemaVersion: z.const(1),
|
|
72
|
+
command: z.string(),
|
|
73
|
+
timeoutMs: z.number(),
|
|
74
|
+
refreshIntervalMs: z.number(),
|
|
75
|
+
maxRows: z.number()
|
|
76
|
+
}).volatile(),
|
|
77
|
+
fullscreen: z.string().default("on").volatile(),
|
|
78
|
+
/** Busy-Enter delivery for plain Enter while the agent runs: 'queue'
|
|
79
|
+
* (default) or 'steer'. */
|
|
80
|
+
busyEnter: z.string().default("queue").volatile(),
|
|
81
|
+
/** User-shell sandbox policy for user-typed `!`/`!!` commands: 'bypass'
|
|
82
|
+
* (default) runs them outside the dsh sandbox, 'sandbox' routes them
|
|
83
|
+
* through the dsh shell capability's policy. */
|
|
84
|
+
localShellSandbox: z.string().default("bypass").volatile(),
|
|
85
|
+
/** Home/End navigation behavior (issue #9): 'input' (default) moves
|
|
86
|
+
* within the input, 'viewport' keeps Home/End scrolling. */
|
|
87
|
+
homeEndKeys: z.string().default("input").volatile(),
|
|
88
|
+
/** Canonical transcript display preset (focus | compact | full). */
|
|
89
|
+
displayPreset: z.string().default("full").volatile(),
|
|
90
|
+
/** Mid-turn progress-update cadence (off | milestones | frequent). */
|
|
91
|
+
progressUpdates: z.string().default("milestones").volatile(),
|
|
92
|
+
/** Git attribution guidance mode (off | product | product-model). */
|
|
93
|
+
gitAttribution: z.string().default("off").volatile(),
|
|
94
|
+
/** Visible-answer density guidance (default | concise | explanatory). */
|
|
95
|
+
responseStyle: z.string().default("default").volatile(),
|
|
96
|
+
/** Completion-notification mode ('unfocused' | 'always' | 'off'). */
|
|
97
|
+
notificationMode: z.string().default("unfocused").volatile(),
|
|
98
|
+
/** Completion-notification method ('auto' | 'osc9' | 'osc777' | 'bell'). */
|
|
99
|
+
notificationMethod: z.string().default("auto").volatile(),
|
|
100
|
+
/** Terminal-progress protocol selection ('off' | '9;4' | '7501' |
|
|
101
|
+
* '9;4+7501'): which native terminal status protocols the TUI reports.
|
|
102
|
+
* Defaults to the dual protocol. */
|
|
103
|
+
terminalProgress: z.string().default("9;4+7501").volatile(),
|
|
104
|
+
/** Fullscreen mouse-wheel step ('1' | '2' | '3' | '5' | '8'). */
|
|
105
|
+
wheelScrollLines: z.string().default("1").volatile(),
|
|
106
|
+
/** The user keybinding overrides as a whole-value RAW field. The
|
|
107
|
+
* keybindings parser (src/tui/keybindings/config.ts) is the only
|
|
108
|
+
* validation/parsing authority — the keybinding business schema
|
|
109
|
+
* deliberately stays out of the plugin Config. */
|
|
110
|
+
keybindings: z.any().volatile()
|
|
111
|
+
};
|
|
112
|
+
/** The 20 persisted preference field names, in schema order. */
|
|
113
|
+
const PREFERENCE_FIELD_NAMES = Object.keys(PREFERENCE_FIELDS);
|
|
114
|
+
const PreferencesConfig = z.object({
|
|
115
|
+
...PREFERENCE_FIELDS,
|
|
116
|
+
legacySettingsMigrationVersion: z.number().default(0).volatile()
|
|
117
|
+
});
|
|
118
|
+
const Config = z.object({
|
|
119
|
+
sessionId: z.string(),
|
|
120
|
+
...PREFERENCE_FIELDS,
|
|
121
|
+
legacySettingsMigrationVersion: z.number().default(0).volatile()
|
|
122
|
+
});
|
|
123
|
+
//#endregion
|
|
124
|
+
export { PREFERENCE_FIELD_NAMES as n, PreferencesConfig as r, Config as t };
|