@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.
Files changed (90) hide show
  1. package/LICENSE +33 -0
  2. package/README.en.md +103 -814
  3. package/README.md +102 -711
  4. package/cordis.patch.yml +186 -0
  5. package/dist/acp-preferences.d.mts +29 -0
  6. package/dist/acp-preferences.mjs +15 -0
  7. package/dist/{bootstrap-DQ4YPL-7.mjs → bootstrap-CMIjGyuk.mjs} +33515 -7587
  8. package/dist/builtins.mjs +3 -3
  9. package/dist/{client-bootstrap-Cr1JCaF5.mjs → client-bootstrap-BjGPc-DM.mjs} +4637 -492
  10. package/dist/client-extension-loader-probe-BUw7q8bJ.mjs +119 -0
  11. package/dist/command-trust-DChWUamk.mjs +406 -0
  12. package/dist/daemon-launcher-Dult7Jxv.mjs +1932 -0
  13. package/dist/daemon-launcher.d.mts +159 -0
  14. package/dist/daemon-launcher.mjs +2 -0
  15. package/dist/diagnostics-D5jwc-q1.d.mts +11 -0
  16. package/dist/{dist-CIsR7cz4.mjs → dist-BFgC-5tL.mjs} +938 -487
  17. package/dist/entry-control-DjNsE3I0.mjs +190 -0
  18. package/dist/extension/advanced.d.mts +1 -1
  19. package/dist/extension/unstable.d.mts +1 -1
  20. package/dist/extension-config-probe-BDdvutkG.mjs +95 -0
  21. package/dist/extension-config.d.mts +29 -0
  22. package/dist/extension-config.mjs +22 -0
  23. package/dist/{extensions-Bp0L37lP.mjs → extensions-B4uLpSTv.mjs} +1109 -100
  24. package/dist/{extensions-Bte3XOt5.d.mts → extensions-C8eAM0gX.d.mts} +1 -1
  25. package/dist/extensions.d.mts +2 -2
  26. package/dist/extensions.mjs +1 -1
  27. package/dist/{host-bootstrap-DilsvA6f.mjs → host-bootstrap-MVxks641.mjs} +129 -24
  28. package/dist/{host-foundation-probe--5jtvHVe.mjs → host-foundation-probe-DMNTmNrH.mjs} +2 -2
  29. package/dist/host-runtime.d.mts +11 -5
  30. package/dist/host-runtime.mjs +4171 -920
  31. package/dist/index.d.mts +86 -174
  32. package/dist/index.mjs +38087 -9967
  33. package/dist/local-acp-listener-B65J0Bx4.mjs +3115 -0
  34. package/dist/local-client.mjs +1158 -59
  35. package/dist/local-daemon-control-C14q9KnD.mjs +1588 -0
  36. package/dist/local-daemon-control-TCnERL7n.mjs +1424 -0
  37. package/dist/local-discovery-DOSsCh9q.mjs +2883 -0
  38. package/dist/local-discovery-egN4_gsQ.mjs +2 -0
  39. package/dist/local-discovery-uOBfFq5j.mjs +2764 -0
  40. package/dist/local-host.mjs +812 -89
  41. package/dist/local-profile-daemon-admin-BmQSdzT0.mjs +210 -0
  42. package/dist/local-scope-DamiMqPd.mjs +1340 -0
  43. package/dist/{local-transport-BVwFYq_Y.mjs → local-transport-Iwo0mtu3.mjs} +313 -38
  44. package/dist/local-web-control-DMrjwCkl.mjs +454 -0
  45. package/dist/local-workspace-object-D06GL0UO.mjs +248 -0
  46. package/dist/native/darwin/prebuilds/darwin-arm64/darwin-platform.node +0 -0
  47. package/dist/native/darwin/prebuilds/darwin-x64/darwin-platform.node +0 -0
  48. package/dist/open-CmOBxSjN.mjs +63 -0
  49. package/dist/persisted-setting-probe-DWZLtWoB.mjs +145 -0
  50. package/dist/pi-tui-acp-access-contract-BdLwduU6.mjs +75 -0
  51. package/dist/pi-tui-remote-contribution-Do8ECrUy.mjs +1492 -0
  52. package/dist/pi-tui-terminal-progress-contract-B3RoEzjK.mjs +146 -0
  53. package/dist/preferences.d.mts +17 -0
  54. package/dist/preferences.mjs +20 -0
  55. package/dist/preset-BcWqOtY7.mjs +46 -0
  56. package/dist/profile-preferences-migration-BfUGdPZx.mjs +500 -0
  57. package/dist/profile-preferences-migration-CThz4rHH.mjs +2 -0
  58. package/dist/prompt-sections-DUKmWb8g.mjs +2232 -0
  59. package/dist/prompt-sections-DXmjB58H.mjs +634 -0
  60. package/dist/{public-types-Dgf1bDke.d.mts → public-types-C1YgFtwC.d.mts} +56 -3
  61. package/dist/row-id-DPbyt9Nn.mjs +24 -0
  62. package/dist/{runtime-status-Cj1nFOdS.mjs → runtime-status-v-FTnWcD.mjs} +49 -3
  63. package/dist/schema-BTGYn8_X.d.mts +54 -0
  64. package/dist/schema-qE_P09zJ.mjs +124 -0
  65. package/dist/{session-BKGXyh80.mjs → session-C6tSs86s.mjs} +9672 -7270
  66. package/dist/{session-CPt_U8_f.mjs → session-CstInGIA.mjs} +9674 -7273
  67. package/dist/startup-CarQxWwi.d.mts +213 -0
  68. package/dist/{startup-7BYWuvBU.mjs → startup-EG5UqIcd.mjs} +341 -26
  69. package/dist/startup.d.mts +2 -99
  70. package/dist/startup.mjs +2 -2
  71. package/dist/{terminal-progress-source-DrqQhtT8.mjs → terminal-progress-source-CpfpQO_h.mjs} +2038 -67
  72. package/dist/{pasted-path-range-CMnxuGPx.mjs → transcript-view-C1YtJ49Y.mjs} +11590 -6718
  73. package/dist/{pasted-path-range-r6qzV_tC.mjs → transcript-view-CuJYWkhp.mjs} +12296 -6923
  74. package/dist/version-B9yC7bBk.mjs +83 -0
  75. package/dist/visual-tools.d.mts +1 -1
  76. package/dist/visual-tools.mjs +1 -1
  77. package/dist/web-preferences.d.mts +1 -1
  78. package/dist/{web-roster-CjqnUXNk.mjs → web-roster-Dis7BhrA.mjs} +63 -3
  79. package/generated/dsh-presets/cordis.patch.yml +4 -2
  80. package/generated/dsh-presets/ptc.patch.yml +4 -0
  81. package/generated/dsh-presets/standard.patch.yml +7 -0
  82. package/generated/web-access/cordis.patch.yml +239 -0
  83. package/package.json +217 -170
  84. package/dist/entry-control-DnduyDiw.mjs +0 -92
  85. package/dist/local-discovery-C9VMjc0K.mjs +0 -759
  86. package/dist/local-discovery-CDaQHA_R.mjs +0 -2
  87. package/dist/pi-tui-remote-contribution-B0EQsP0N.mjs +0 -85
  88. package/dist/pi-tui-terminal-progress-contract-CdBH9j78.mjs +0 -70
  89. package/dist/pi-tui-terminal-progress-contract-MLXZ-i3t.mjs +0 -905
  90. package/dist/version-a-eF-QER.mjs +0 -80
@@ -0,0 +1,190 @@
1
+ import "./local-scope-DamiMqPd.mjs";
2
+ //#region src/app/remote-process/entry-control.ts
3
+ /** The single opt-in for the raw M4-A0 JSONL stream, frozen at process start. */
4
+ const ENTRY_RECORDS_ENABLED = process.env.DSH_PI_TUI_ENTRY_RECORDS === "1";
5
+ /** The longest free-text fragment the default Host production log prints. */
6
+ const MAX_ENTRY_LOG_TEXT = 1024;
7
+ /** One existing string field as a single bounded log line fragment. */
8
+ function logText(value) {
9
+ if (typeof value !== "string") return void 0;
10
+ const text = value.replace(/[\r\n]+/gu, " ");
11
+ return text.length <= MAX_ENTRY_LOG_TEXT ? text : text.slice(0, MAX_ENTRY_LOG_TEXT);
12
+ }
13
+ /**
14
+ * The default sink's Host production projection.
15
+ *
16
+ * A Host runs with its stdout/stderr redirected into the user-visible
17
+ * `host.log`/journal/launchd stream, so the default sink writes a few readable
18
+ * lifecycle lines instead of the qualification JSON. Only an actual Host
19
+ * process owns production messages; every other record is qualification data
20
+ * and stays silent unless the explicit JSONL opt-in is set.
21
+ */
22
+ function hostProductionLine(record) {
23
+ if (record.processRole !== "host") return void 0;
24
+ switch (record.m4a0) {
25
+ case "ready": return {
26
+ stdout: true,
27
+ text: `dsh-pi-tui host: ready (profile=${String(record.profile)}, pid=${String(record.pid)})`
28
+ };
29
+ case "failure": {
30
+ const phase = logText(record.phase);
31
+ const code = logText(record.code);
32
+ const context = [phase === void 0 ? void 0 : `[phase=${phase}]`, code === void 0 ? void 0 : `[code=${code}]`].filter((part) => part !== void 0).join(" ");
33
+ return {
34
+ stdout: false,
35
+ text: `dsh-pi-tui host: startup failed${context === "" ? "" : ` ${context}`}: ${logText(record.error) ?? ""}`
36
+ };
37
+ }
38
+ case "cleanup-failure": {
39
+ const step = logText(record.step);
40
+ return {
41
+ stdout: false,
42
+ text: `dsh-pi-tui host: cleanup failed${step === void 0 ? "" : ` [step=${step}]`}: ${logText(record.error) ?? ""}`
43
+ };
44
+ }
45
+ case "diagnostic": {
46
+ const code = logText(record.code) ?? "unknown";
47
+ const failure = logText(record.failure) ?? "unknown";
48
+ const state = logText(record.state);
49
+ return {
50
+ stdout: false,
51
+ text: `dsh-pi-tui host: warning ${code} (${state === void 0 ? failure : `${failure}, state=${state}`})`
52
+ };
53
+ }
54
+ case "diag": {
55
+ if (record.level !== "warn" && record.level !== "error") return void 0;
56
+ const message = logText(record.message) ?? "unknown message";
57
+ return {
58
+ stdout: false,
59
+ text: `dsh-pi-tui host: ${record.level}: ${message}`
60
+ };
61
+ }
62
+ case "web-autostart": return {
63
+ stdout: true,
64
+ text: "dsh-pi-tui host: web autostart enabled"
65
+ };
66
+ case "acp-autostart": return {
67
+ stdout: true,
68
+ text: "dsh-pi-tui host: ACP autostart enabled"
69
+ };
70
+ case "cleanup": return {
71
+ stdout: true,
72
+ text: "dsh-pi-tui host: stopped"
73
+ };
74
+ default: return;
75
+ }
76
+ }
77
+ /**
78
+ * The default sink: the qualification JSONL control channel when explicitly
79
+ * enabled, otherwise the minimal readable Host production log. An explicitly
80
+ * provided sink always receives every record unchanged.
81
+ */
82
+ const stdoutRecordSink = (record) => {
83
+ if (ENTRY_RECORDS_ENABLED) {
84
+ process.stdout.write(`${JSON.stringify(record)}\n`);
85
+ return;
86
+ }
87
+ const line = hostProductionLine(record);
88
+ if (line === void 0) return;
89
+ (line.stdout ? process.stdout : process.stderr).write(`${line.text}\n`);
90
+ };
91
+ /** One structured line emitted by a process entry. */
92
+ function writeEntryRecord(record, sink = stdoutRecordSink) {
93
+ sink(record);
94
+ }
95
+ /** A role-labelled structured diagnostics sink for the entry's detached work.
96
+ * The surface entry supplies its private JSONL file sink; the qualification
97
+ * entries keep the default stdout control channel. */
98
+ function createEntryDiag(processRole, sink) {
99
+ const emit = (level) => (message, fields) => {
100
+ writeEntryRecord({
101
+ m4a0: "diag",
102
+ processRole,
103
+ level,
104
+ message,
105
+ ...fields
106
+ }, sink);
107
+ };
108
+ return {
109
+ debug: emit("debug"),
110
+ info: emit("info"),
111
+ warn: emit("warn"),
112
+ error: emit("error"),
113
+ dispose: () => {}
114
+ };
115
+ }
116
+ /**
117
+ * Build the serialized control queue. A malformed request or a rejecting
118
+ * handler is reported as a structured `control-failure` line and the queue
119
+ * continues: the launcher owns the process, and one bad status query must not
120
+ * strand later shutdown/status requests or crash the Host outside its official
121
+ * disposer. The handler failure is never swallowed silently.
122
+ */
123
+ function createControlDispatcher(handler, options = {}) {
124
+ const emit = options.emit ?? writeEntryRecord;
125
+ let chain = Promise.resolve();
126
+ return { dispatch(line) {
127
+ chain = chain.then(async () => {
128
+ let request;
129
+ try {
130
+ request = JSON.parse(line);
131
+ } catch (error) {
132
+ emit({
133
+ m4a0: "control-error",
134
+ error: error instanceof Error ? error.message : String(error)
135
+ });
136
+ return;
137
+ }
138
+ if (typeof request !== "object" || request === null || typeof request.op !== "string") {
139
+ emit({
140
+ m4a0: "control-error",
141
+ error: "control request must be an object with a string op"
142
+ });
143
+ return;
144
+ }
145
+ if (await handler(request)) options.onStop?.();
146
+ }).catch((error) => {
147
+ emit({
148
+ m4a0: "control-failure",
149
+ error: error instanceof Error ? error.message : String(error),
150
+ ...error instanceof Error && error.stack !== void 0 ? { stack: error.stack } : {}
151
+ });
152
+ });
153
+ return chain;
154
+ } };
155
+ }
156
+ /**
157
+ * Read newline-delimited JSON control requests from stdin. Malformed input is
158
+ * reported as a structured `control-error` line and otherwise ignored: the
159
+ * launcher is the only writer, and a typo must not crash a live Host.
160
+ * @param handler - the entry's control handler.
161
+ * @param stdin - the control stream (the process stdin by default).
162
+ * @returns the channel, whose {@link EntryControlChannel.release} the shutdown
163
+ * owner calls once no further control request can be admitted.
164
+ */
165
+ function attachEntryControl(handler, stdin = process.stdin) {
166
+ let released = false;
167
+ let buffer = "";
168
+ const onData = (chunk) => {
169
+ buffer += chunk;
170
+ for (let newline = buffer.indexOf("\n"); newline >= 0; newline = buffer.indexOf("\n")) {
171
+ const line = buffer.slice(0, newline).trim();
172
+ buffer = buffer.slice(newline + 1);
173
+ if (line === "") continue;
174
+ dispatcher.dispatch(line);
175
+ }
176
+ };
177
+ const release = () => {
178
+ if (released) return;
179
+ released = true;
180
+ stdin.off("data", onData);
181
+ stdin.pause();
182
+ };
183
+ stdin.setEncoding("utf8");
184
+ stdin.resume();
185
+ const dispatcher = createControlDispatcher(handler, { onStop: release });
186
+ stdin.on("data", onData);
187
+ return { release };
188
+ }
189
+ //#endregion
190
+ export { createEntryDiag as n, writeEntryRecord as r, attachEntryControl as t };
@@ -1,4 +1,4 @@
1
- import { D as PiTuiApiInfo, E as NormalizedKey, _ as ExtensionTier, h as EditorSnapshot, ot as TuiOverlayOptions, v as ExtensionView } from "../public-types-Dgf1bDke.mjs";
1
+ import { D as PiTuiApiInfo, E as NormalizedKey, _ as ExtensionTier, h as EditorSnapshot, ot as TuiOverlayOptions, v as ExtensionView } from "../public-types-C1YgFtwC.mjs";
2
2
 
3
3
  //#region src/extension/advanced-types.d.ts
4
4
  /** API level of the advanced tier. Bumped only on advanced breaking changes. */
@@ -1,4 +1,4 @@
1
- import { D as PiTuiApiInfo, _ as ExtensionTier, ot as TuiOverlayOptions } from "../public-types-Dgf1bDke.mjs";
1
+ import { D as PiTuiApiInfo, _ as ExtensionTier, ot as TuiOverlayOptions } from "../public-types-C1YgFtwC.mjs";
2
2
 
3
3
  //#region src/extension/unstable-types.d.ts
4
4
  /** API level of the unstable tier. Bumped only on unstable breaking changes. */
@@ -0,0 +1,95 @@
1
+ //#region src/app/remote-process/extension-config-probe.ts
2
+ const PROBE_PACKAGES_ENV = "SPLIT_PROCESS_CLIENT_EXTENSION_CONFIG_PACKAGES";
3
+ /** Resolve the package identities supplied by the real-profile qualification. */
4
+ function probePackages() {
5
+ const raw = process.env[PROBE_PACKAGES_ENV];
6
+ if (raw === void 0 || raw === "") throw new Error(`extension-config probe: ${PROBE_PACKAGES_ENV} is not set`);
7
+ let parsed;
8
+ try {
9
+ parsed = JSON.parse(raw);
10
+ } catch (error) {
11
+ throw new Error(`extension-config probe: ${PROBE_PACKAGES_ENV} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`);
12
+ }
13
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) throw new Error(`extension-config probe: ${PROBE_PACKAGES_ENV} must be an object`);
14
+ const value = parsed;
15
+ if (typeof value.a !== "string" || value.a === "" || typeof value.b !== "string" || value.b === "") throw new Error(`extension-config probe: ${PROBE_PACKAGES_ENV} requires package names a and b`);
16
+ if (value.negative !== void 0 && (typeof value.negative !== "string" || value.negative === "")) throw new Error(`extension-config probe: ${PROBE_PACKAGES_ENV}.negative must be a non-empty string when set`);
17
+ return {
18
+ a: value.a,
19
+ b: value.b,
20
+ ...value.negative === void 0 ? {} : { negative: value.negative }
21
+ };
22
+ }
23
+ function factsOf(read) {
24
+ return read.kind === "ready" ? {
25
+ kind: "ready",
26
+ revision: read.revision,
27
+ effective: read.effective,
28
+ inherited: read.inherited,
29
+ user: read.user,
30
+ userDataPresent: read.userDataPresent
31
+ } : {
32
+ kind: read.kind,
33
+ reason: read.reason
34
+ };
35
+ }
36
+ /**
37
+ * Run the fixed two-package read/write/conflict probe on the mounted port.
38
+ *
39
+ * @param config - the production application ConfigPort of this surface revision.
40
+ * @returns one JSON-safe qualification record for the Client record sink.
41
+ */
42
+ async function runExtensionConfigProbe(config) {
43
+ const packages = probePackages();
44
+ const a0 = config.extensionConfigs.read(packages.a);
45
+ const b0 = config.extensionConfigs.read(packages.b);
46
+ const negativeRead = packages.negative === void 0 ? void 0 : config.extensionConfigs.read(packages.negative);
47
+ if (a0.kind !== "ready" || b0.kind !== "ready") throw new Error(`extension-config probe: both package rows must be readable (${a0.kind}/${b0.kind})`);
48
+ const writeA = await config.extensionConfigs.mutate(packages.a, [{
49
+ op: "set",
50
+ path: ["label"],
51
+ value: "probe-a"
52
+ }, {
53
+ op: "set",
54
+ path: ["nested", "flag"],
55
+ value: true
56
+ }], a0.revision, a0.generation);
57
+ const a1 = config.extensionConfigs.read(packages.a);
58
+ const b1 = config.extensionConfigs.read(packages.b);
59
+ const writeB = await config.extensionConfigs.mutate(packages.b, [{
60
+ op: "set",
61
+ path: ["limit"],
62
+ value: 11
63
+ }], b0.revision, b0.generation);
64
+ const a2 = config.extensionConfigs.read(packages.a);
65
+ const b2 = config.extensionConfigs.read(packages.b);
66
+ const stale = a2.kind === "ready" ? await config.extensionConfigs.mutate(packages.a, [{
67
+ op: "set",
68
+ path: ["label"],
69
+ value: "probe-stale-loser"
70
+ }], a0.revision, a2.generation) : { kind: "not-run" };
71
+ const a3 = config.extensionConfigs.read(packages.a);
72
+ await config.extensionConfigs.refresh();
73
+ return {
74
+ m4b2s: "qualification",
75
+ op: "extension-config-probe",
76
+ processRole: "client",
77
+ pid: process.pid,
78
+ packageA: packages.a,
79
+ packageB: packages.b,
80
+ ...negativeRead === void 0 ? {} : { negative: negativeRead.kind },
81
+ a0: factsOf(a0),
82
+ b0: factsOf(b0),
83
+ writeA: writeA.kind,
84
+ a1: factsOf(a1),
85
+ b1: factsOf(b1),
86
+ writeB: writeB.kind,
87
+ a2: factsOf(a2),
88
+ b2: factsOf(b2),
89
+ stale: stale.kind,
90
+ a3: factsOf(a3),
91
+ hasUnsettledWrites: config.hasUnsettledWrites()
92
+ };
93
+ }
94
+ //#endregion
95
+ export { runExtensionConfigProbe };
@@ -0,0 +1,29 @@
1
+ import z from "@deepseek-ai/schemastery";
2
+ import { Context } from "@deepseek-ai/cordis";
3
+
4
+ //#region src/app/host/extension-config-carrier.d.ts
5
+ /** Stable Cordis plugin name. The Loader row ID is the per-package hash, never this name. */
6
+ declare const name = "pi-tui-extension-config";
7
+ /** The row's per-package configuration document. */
8
+ interface Config {
9
+ /** Non-secret JSON the owning package persists through the official Settings service. */
10
+ data: unknown;
11
+ }
12
+ /**
13
+ * The Config schema the Loader resolves.
14
+ *
15
+ * `data` is volatile so the official Settings service projects it as a live
16
+ * form field and the Loader commits a saved value into the running reference
17
+ * without remounting the row. No default, no secret role and no business
18
+ * validation: this row is a storage carrier, not a feature schema.
19
+ */
20
+ declare const Config: z<Config>;
21
+ /**
22
+ * No execution: the carrier exists only to give each package's row a Config.
23
+ *
24
+ * @param ctx - the Host context this row is mounted in (unused by contract).
25
+ * @param config - the resolved per-package document (unused by contract).
26
+ */
27
+ declare function apply(ctx: Context, config: Config): void;
28
+ //#endregion
29
+ export { Config, apply, name };
@@ -0,0 +1,22 @@
1
+ import z from "@deepseek-ai/schemastery";
2
+ //#region src/app/host/extension-config-carrier.ts
3
+ /** Stable Cordis plugin name. The Loader row ID is the per-package hash, never this name. */
4
+ const name = "pi-tui-extension-config";
5
+ /**
6
+ * The Config schema the Loader resolves.
7
+ *
8
+ * `data` is volatile so the official Settings service projects it as a live
9
+ * form field and the Loader commits a saved value into the running reference
10
+ * without remounting the row. No default, no secret role and no business
11
+ * validation: this row is a storage carrier, not a feature schema.
12
+ */
13
+ const Config = z.object({ data: z.any().volatile() });
14
+ /**
15
+ * No execution: the carrier exists only to give each package's row a Config.
16
+ *
17
+ * @param ctx - the Host context this row is mounted in (unused by contract).
18
+ * @param config - the resolved per-package document (unused by contract).
19
+ */
20
+ function apply(ctx, config) {}
21
+ //#endregion
22
+ export { Config, apply, name };