@xmoon76/dsh-pi-tui 0.5.8 → 0.5.9

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 (77) hide show
  1. package/README.en.md +61 -25
  2. package/README.md +61 -25
  3. package/cordis.patch.yml +13 -0
  4. package/dist/acp-stdio.mjs +151 -0
  5. package/dist/{bootstrap-CMIjGyuk.mjs → bootstrap-CVyHGQDX.mjs} +21901 -6575
  6. package/dist/browser-CDUSHIIr.mjs +76 -0
  7. package/dist/builtins.mjs +2 -2
  8. package/dist/{client-bootstrap-BjGPc-DM.mjs → client-bootstrap-4UoeVIHE.mjs} +2488 -2734
  9. package/dist/client-runtime-BHBlVUf5.mjs +1376 -0
  10. package/dist/{daemon-launcher-Dult7Jxv.mjs → daemon-launcher-DxIgjBHW.mjs} +1549 -172
  11. package/dist/daemon-launcher.d.mts +85 -14
  12. package/dist/daemon-launcher.mjs +2 -2
  13. package/dist/{local-profile-daemon-admin-BmQSdzT0.mjs → diagnostics-Db5iVcuJ.mjs} +3 -90
  14. package/dist/{entry-control-DjNsE3I0.mjs → entry-control-BDLZgg4m.mjs} +1 -1
  15. package/dist/{extensions-B4uLpSTv.mjs → extensions-Dx7ncPNA.mjs} +1 -1
  16. package/dist/extensions.mjs +1 -1
  17. package/dist/handoff-BjoEy3f8.mjs +106 -0
  18. package/dist/history-search-limits-Cx2UvRC2.mjs +16 -0
  19. package/dist/history-search-remote-BHuoellG.mjs +113 -0
  20. package/dist/history-search-remote-BzXdvrxk.mjs +26 -0
  21. package/dist/history-search-seat-BcHJTpeB.mjs +639 -0
  22. package/dist/history-search-seat-rZcq0XV6.mjs +639 -0
  23. package/dist/{host-bootstrap-MVxks641.mjs → host-bootstrap-BfnufpnW.mjs} +37 -72
  24. package/dist/{host-foundation-probe-DMNTmNrH.mjs → host-foundation-probe-DlD8-N_Q.mjs} +2 -2
  25. package/dist/host-runtime.mjs +5611 -290
  26. package/dist/index.d.mts +13 -6
  27. package/dist/index.mjs +22334 -6695
  28. package/dist/installed-dsh-BjUiJSwR.mjs +142 -0
  29. package/dist/interaction-port-D1Yv9zgu.mjs +45 -0
  30. package/dist/local-acp-control-CC5z4Xbq.mjs +304 -0
  31. package/dist/local-acp-endpoint-D1jYdJdv.mjs +41 -0
  32. package/dist/local-acp-listener-Cmgb5M0H.mjs +9493 -0
  33. package/dist/local-acp-status-B_25Q6kU.mjs +101 -0
  34. package/dist/local-client.mjs +292 -63
  35. package/dist/local-daemon-control-BFJAC8Kg.mjs +2199 -0
  36. package/dist/local-daemon-control-Bm3imctD.mjs +2101 -0
  37. package/dist/{local-discovery-uOBfFq5j.mjs → local-discovery-BMhaGIiJ.mjs} +254 -544
  38. package/dist/{local-discovery-egN4_gsQ.mjs → local-discovery-Ba7_-NNC.mjs} +1 -1
  39. package/dist/{local-discovery-DOSsCh9q.mjs → local-discovery-QSbFpjK2.mjs} +301 -544
  40. package/dist/local-host.mjs +952 -501
  41. package/dist/local-profile-daemon-admin-otpm69R6.mjs +469 -0
  42. package/dist/{local-scope-DamiMqPd.mjs → local-scope-5DEKA_lW.mjs} +1023 -96
  43. package/dist/{local-transport-Iwo0mtu3.mjs → local-transport-DeWmdZ5E.mjs} +14 -3
  44. package/dist/{local-web-control-DMrjwCkl.mjs → local-web-control-Dny93N-r.mjs} +10 -7
  45. package/dist/{local-workspace-object-D06GL0UO.mjs → local-workspace-object-D0RVQt8U.mjs} +33 -9
  46. package/dist/model-selection-CYlqg2DV.mjs +83 -0
  47. package/dist/native-client-domains-Dg4srzYt.mjs +2 -0
  48. package/dist/native-client.d.mts +735 -0
  49. package/dist/native-client.mjs +3534 -0
  50. package/dist/{open-CmOBxSjN.mjs → open-QQva8-ar.mjs} +24 -20
  51. package/dist/{pi-tui-remote-contribution-Do8ECrUy.mjs → pi-tui-remote-contribution-565wiLWp.mjs} +741 -150
  52. package/dist/preferences.mjs +1 -1
  53. package/dist/{profile-preferences-migration-CThz4rHH.mjs → profile-preferences-migration-CNOWIdnr.mjs} +1 -1
  54. package/dist/{profile-preferences-migration-BfUGdPZx.mjs → profile-preferences-migration-IrnXcJWK.mjs} +10 -8
  55. package/dist/{prompt-sections-DXmjB58H.mjs → prompt-sections-Bi-9_Gr_.mjs} +28 -10
  56. package/dist/{prompt-sections-DUKmWb8g.mjs → prompt-sections-DFS1dqsY.mjs} +342 -56
  57. package/dist/{dist-BFgC-5tL.mjs → recall-scope-9Nuoto_i.mjs} +353 -1
  58. package/dist/rolldown-runtime-8H4AJuhK.mjs +14 -0
  59. package/dist/schema-CCLvDa7Q.mjs +177 -0
  60. package/dist/{schema-qE_P09zJ.mjs → schema-t97l3aK8.mjs} +56 -3
  61. package/dist/{session-C6tSs86s.mjs → session-Cs8iLCEx.mjs} +784 -342
  62. package/dist/{session-CstInGIA.mjs → session-EBRZF6Ow.mjs} +783 -341
  63. package/dist/session-create-facts-CkfG5DpQ.mjs +20 -0
  64. package/dist/{startup-CarQxWwi.d.mts → startup-Dti3Udne.d.mts} +30 -3
  65. package/dist/{startup-EG5UqIcd.mjs → startup-UtFQSDe_.mjs} +90 -15
  66. package/dist/startup.d.mts +2 -2
  67. package/dist/startup.mjs +1 -1
  68. package/dist/task-read-remote-DRtkXDrZ.mjs +1083 -0
  69. package/dist/{terminal-progress-source-CpfpQO_h.mjs → terminal-progress-source-VsczdXA-.mjs} +610 -332
  70. package/dist/{transcript-view-CuJYWkhp.mjs → transcript-view-B6vCnukn.mjs} +2096 -977
  71. package/dist/{transcript-view-C1YtJ49Y.mjs → transcript-view-DSSdE2vK.mjs} +2078 -651
  72. package/dist/write-failure-xNKczXH7.mjs +189 -0
  73. package/package.json +20 -3
  74. package/dist/local-acp-listener-B65J0Bx4.mjs +0 -3115
  75. package/dist/local-daemon-control-C14q9KnD.mjs +0 -1588
  76. package/dist/local-daemon-control-TCnERL7n.mjs +0 -1424
  77. package/dist/preset-BcWqOtY7.mjs +0 -46
@@ -1,9 +1,10 @@
1
- import { n as LocalScopeError } from "./local-scope-DamiMqPd.mjs";
1
+ import { n as LocalScopeError } from "./local-scope-5DEKA_lW.mjs";
2
2
  import { i as runDetached } from "./tasks-D_z5Yjjr.mjs";
3
- import { f as readLaunchMaterial, m as sameLocalInstanceRecord, p as readLocalRecord, r as assertRecordedHostKernelIdentityCurrent, s as connectForCookie } from "./local-discovery-DOSsCh9q.mjs";
3
+ import { f as readLaunchMaterial, m as sameLocalInstanceRecord, p as readLocalRecord, r as assertRecordedHostKernelIdentityCurrent, s as connectForCookie } from "./local-discovery-QSbFpjK2.mjs";
4
4
  import { t as mergeCause } from "./dispose-cause-CNFuUnjR.mjs";
5
5
  import { createRequire } from "node:module";
6
- import { realpathSync } from "node:fs";
6
+ import { existsSync, realpathSync } from "node:fs";
7
+ import { join } from "node:path";
7
8
  import { pathToFileURL } from "node:url";
8
9
  import WebSocket from "ws";
9
10
  //#region src/app/remote-process/local-transport.ts
@@ -63,6 +64,7 @@ function cookieFetch(origin, currentCookie, includeCookie, qualificationPromptAc
63
64
  let promptAckDropped = false;
64
65
  const dropModelAck = process.env.SPLIT_PROCESS_CLIENT_DROP_MODEL_ACK === "1";
65
66
  let modelAckDropped = false;
67
+ const failPresetRosterDir = process.env.SPLIT_PROCESS_CLIENT_FAIL_PRESET_ROSTER;
66
68
  const expireOperatorOnce = process.env.SPLIT_PROCESS_CLIENT_EXPIRE_OPERATOR_ONCE;
67
69
  /**
68
70
  * Qualification-only delay before the forged operator expires: a real TTL
@@ -90,6 +92,15 @@ function cookieFetch(origin, currentCookie, includeCookie, qualificationPromptAc
90
92
  redirect: "manual",
91
93
  cache: "no-store"
92
94
  };
95
+ if (failPresetRosterDir !== void 0 && failPresetRosterDir !== "" && typeof init.body === "string" && existsSync(join(failPresetRosterDir, "fail"))) {
96
+ let method;
97
+ try {
98
+ method = JSON.parse(init.body).method;
99
+ } catch {
100
+ method = void 0;
101
+ }
102
+ if (method === "agentPresets/list") throw new Error("local transport: qualification failed the agentPresets/list roster read before dispatch");
103
+ }
93
104
  if (dropPromptAck && !promptAckDropped && typeof init.body === "string") {
94
105
  let method;
95
106
  try {
@@ -1,6 +1,6 @@
1
- import { n as openerFor } from "./open-CmOBxSjN.mjs";
2
- import { v as inspectInstalledProfileScope } from "./daemon-launcher-Dult7Jxv.mjs";
3
- import { a as inspectHostProcess, n as assertRecordedHostKernelIdentityCurrent, o as readLocalRecord, r as authenticateLocalHost, s as sameLocalInstanceRecord, t as assertClientHostCompatible } from "./local-discovery-uOBfFq5j.mjs";
1
+ import { n as openerFor } from "./open-QQva8-ar.mjs";
2
+ import { T as inspectInstalledProfileScope } from "./daemon-launcher-DxIgjBHW.mjs";
3
+ import { a as inspectHostProcess, n as assertRecordedHostKernelIdentityCurrent, o as readLocalRecord, r as authenticateLocalHost, s as sameLocalInstanceRecord, t as assertClientHostCompatible } from "./local-discovery-BMhaGIiJ.mjs";
4
4
  import { spawn } from "node:child_process";
5
5
  //#region src/app/remote-process/local-web-control-route.ts
6
6
  /** The one Owner-only authenticated route of the headless Web CLI. */
@@ -177,7 +177,7 @@ function disabledReason(profile) {
177
177
  function toWebControlError(error) {
178
178
  if (error instanceof WebControlError) return error;
179
179
  switch (error?.code) {
180
- case "B1_PLATFORM_UNSUPPORTED": return new WebControlError("UNSUPPORTED_PLATFORM", "the web CLI is only supported on Linux and macOS");
180
+ case "B1_PLATFORM_UNSUPPORTED": return new WebControlError("UNSUPPORTED_PLATFORM", "the web CLI is only supported on Linux, macOS and Windows");
181
181
  case "SCOPE_DIRECTORY_UNSAFE":
182
182
  case "LOCAL_FILE_UNSAFE":
183
183
  case "HOST_PROTOCOL_INCOMPATIBLE":
@@ -292,14 +292,16 @@ function assertAuthenticatedWebUrl(raw, origin) {
292
292
  * spawn error or immediate non-zero exit is a real failure.
293
293
  */
294
294
  async function launchBrowser(url, deps) {
295
- const { command, args } = openerFor(url, platformOf(deps));
296
295
  const spawnImpl = deps.spawn ?? spawn;
296
+ const platform = platformOf(deps);
297
+ const detached = platform !== "win32";
297
298
  let child;
298
299
  try {
300
+ const { command, args } = openerFor(url, platform);
299
301
  child = spawnImpl(command, args, {
300
302
  shell: false,
301
303
  stdio: "ignore",
302
- detached: true
304
+ detached
303
305
  });
304
306
  } catch (error) {
305
307
  throw new WebControlError("BROWSER_LAUNCH_UNAVAILABLE", "the local browser opener could not be started", error);
@@ -332,6 +334,7 @@ async function launchBrowser(url, deps) {
332
334
  }, 2e3);
333
335
  child.once("spawn", () => {
334
336
  if (spawnTimer !== void 0) clearTimeout(spawnTimer);
337
+ if (!detached) return;
335
338
  try {
336
339
  child.unref();
337
340
  } catch {}
@@ -371,7 +374,7 @@ function unknownWriteOutcome(profile) {
371
374
  async function runLocalWebControl(intent, profile, deps = {}) {
372
375
  try {
373
376
  const platform = platformOf(deps);
374
- if (platform !== "linux" && platform !== "darwin") throw new WebControlError("UNSUPPORTED_PLATFORM", "the web CLI is only supported on Linux and macOS");
377
+ if (platform !== "linux" && platform !== "darwin" && platform !== "win32") throw new WebControlError("UNSUPPORTED_PLATFORM", "the web CLI is only supported on Linux, macOS and Windows");
375
378
  const scope = inspectInstalledProfileScope({
376
379
  dshHome: profile.home,
377
380
  profileDir: profile.dir,
@@ -1,4 +1,5 @@
1
- import { statSync } from "node:fs";
1
+ import { D as isWin32LocalFixedNtfs } from "./local-scope-5DEKA_lW.mjs";
2
+ import { realpathSync, statSync } from "node:fs";
2
3
  //#region src/app/remote-process/local-workspace-object.ts
3
4
  /**
4
5
  * The Host-owned read-only directory-object observation route.
@@ -22,8 +23,6 @@ import { statSync } from "node:fs";
22
23
  const LOCAL_WORKSPACE_OBJECT_ROUTE = "/api/pi-tui.workspace-object";
23
24
  /** Hard request-body bound (plan §7). */
24
25
  const MAX_WORKSPACE_OBJECT_REQUEST_BYTES = 8192;
25
- /** Hard absolute-path bound in UTF-8 bytes. */
26
- const MAX_WORKSPACE_OBJECT_PATH_BYTES = 4096;
27
26
  /** Hard response-body bound the Client accepts. */
28
27
  const MAX_WORKSPACE_OBJECT_RESPONSE_BYTES = 1024;
29
28
  /** Bound on one loopback observation after any caller cancellation has been
@@ -88,11 +87,35 @@ function failure(status) {
88
87
  headers: { "cache-control": "no-store" }
89
88
  });
90
89
  }
91
- /** Validate one absolute path against the route's hard limits. */
92
- function isBoundedAbsolutePath(value) {
90
+ /**
91
+ * Validate one absolute path against the route's hard limits.
92
+ *
93
+ * POSIX keeps its original `/` root semantics. Windows admits ONLY an ordinary
94
+ * drive-absolute spelling: a drive-relative `C:foo`, a root-relative `\foo`,
95
+ * a UNC/network `\\server\share`, and an extended/device `\\?\`/`\\.\` form are
96
+ * refused here even though `path.win32.isAbsolute` accepts the UNC/device
97
+ * spellings. Volume/type proof is a separate observation ({@link isSupportedWin32WorkspacePath}).
98
+ */
99
+ function isBoundedWorkspaceObjectPath(value, platform = process.platform) {
93
100
  if (typeof value !== "string" || value === "" || value.includes("\0")) return false;
94
- if (!value.startsWith("/")) return false;
95
- return Buffer.byteLength(value, "utf8") <= MAX_WORKSPACE_OBJECT_PATH_BYTES;
101
+ if (Buffer.byteLength(value, "utf8") > 4096) return false;
102
+ if (platform === "win32") return /^[A-Za-z]:[\\/]/u.test(value);
103
+ return value.startsWith("/");
104
+ }
105
+ /**
106
+ * Prove one Windows path resolves to an ordinary directory on a LOCAL FIXED
107
+ * NTFS volume. The grammar alone is not evidence (a UNC spelling or a mapped
108
+ * volume can be absolute); the real target's volume type is. The caller keeps
109
+ * the ORIGINAL path for its `(dev, ino)` observation — the resolved spelling is
110
+ * never substituted for object identity.
111
+ */
112
+ function isSupportedWin32WorkspacePath(value) {
113
+ try {
114
+ const resolved = realpathSync.native(value);
115
+ return /^[A-Za-z]:[\\/]/u.test(resolved) && isWin32LocalFixedNtfs(resolved);
116
+ } catch {
117
+ return false;
118
+ }
96
119
  }
97
120
  /**
98
121
  * Build the ONE Host route handler. It answers only for the CURRENT Host
@@ -115,7 +138,7 @@ function createWorkspaceObjectHandler(currentInstanceId, statDirectory = default
115
138
  }
116
139
  if (!isRecord(value) || !hasExactKeys(value, REQUEST_KEYS)) return failure(400);
117
140
  if (value.instanceId !== currentInstanceId || !UUID_PATTERN.test(currentInstanceId)) return failure(409);
118
- if (!isBoundedAbsolutePath(value.path)) return failure(400);
141
+ if (!isBoundedWorkspaceObjectPath(value.path)) return failure(400);
119
142
  let directory;
120
143
  try {
121
144
  directory = statDirectory(value.path);
@@ -123,6 +146,7 @@ function createWorkspaceObjectHandler(currentInstanceId, statDirectory = default
123
146
  return failure(404);
124
147
  }
125
148
  if (!directory.isDirectory()) return failure(404);
149
+ if (process.platform === "win32" && !isSupportedWin32WorkspacePath(value.path)) return failure(400);
126
150
  return jsonResponse({
127
151
  schema: 1,
128
152
  instanceId: currentInstanceId,
@@ -245,4 +269,4 @@ async function readResponseText(response, maxBytes) {
245
269
  return Buffer.concat(chunks.map((chunk) => Buffer.from(chunk))).toString("utf8");
246
270
  }
247
271
  //#endregion
248
- export { createWorkspaceObjectHandler as n, observeHostWorkspaceObject as r, LOCAL_WORKSPACE_OBJECT_ROUTE as t };
272
+ export { observeHostWorkspaceObject as a, isSupportedWin32WorkspacePath as i, createWorkspaceObjectHandler as n, isBoundedWorkspaceObjectPath as r, LOCAL_WORKSPACE_OBJECT_ROUTE as t };
@@ -0,0 +1,83 @@
1
+ //#region src/runtime/read-error.ts
2
+ /**
3
+ * A typed semantic READ failure: the read was superseded by a connection or
4
+ * surface change, so its result must not be presented as the current Host
5
+ * state. Remote adapters throw this instead of a generic Error so a consumer
6
+ * can stay UI-silent (v2 §0.2.3/§0.3.1) rather than surfacing a stale failure.
7
+ * Host-free; no I/O.
8
+ * @module @xmoon76/dsh-pi-tui/read-error
9
+ */
10
+ /** The read no longer owns the surface (generation change or superseded epoch). */
11
+ var SupersededReadError = class extends Error {
12
+ reason;
13
+ constructor(reason) {
14
+ super(reason);
15
+ this.name = "SupersededReadError";
16
+ this.reason = reason;
17
+ }
18
+ };
19
+ //#endregion
20
+ //#region src/domain/session/model-selection.ts
21
+ function recordOf(value) {
22
+ return typeof value === "object" && value !== null ? value : void 0;
23
+ }
24
+ /**
25
+ * Normalize untrusted event data into a detached model-selection value.
26
+ * Provider and model identifiers are intentionally not trimmed: whitespace is
27
+ * part of an identifier if a provider elected to use it.
28
+ */
29
+ function normalizeModelSelection(value) {
30
+ const record = recordOf(value);
31
+ if (record === void 0 || typeof record.provider !== "string" || record.provider.length === 0 || typeof record.model !== "string" || record.model.length === 0) return void 0;
32
+ if (record.reasoningEffort === void 0 || record.reasoningEffort === null) return {
33
+ provider: record.provider,
34
+ model: record.model
35
+ };
36
+ if (typeof record.reasoningEffort !== "string" || record.reasoningEffort.length === 0) return void 0;
37
+ return {
38
+ provider: record.provider,
39
+ model: record.model,
40
+ reasoningEffort: record.reasoningEffort
41
+ };
42
+ }
43
+ /** Compare provider, model, and the presence/value of reasoning effort.
44
+ * Defensive by contract: malformed runtime values (null, non-objects) are
45
+ * never equal to anything, so untrusted event data cannot throw here. */
46
+ function sameModelSelection(left, right) {
47
+ if (left === void 0 || right === void 0) return false;
48
+ if (typeof left !== "object" || left === null || typeof right !== "object" || right === null) return false;
49
+ return left.provider === right.provider && left.model === right.model && left.reasoningEffort === right.reasoningEffort;
50
+ }
51
+ function requestConfig(header) {
52
+ const headerRecord = recordOf(header);
53
+ return headerRecord === void 0 ? void 0 : recordOf(headerRecord.config);
54
+ }
55
+ /**
56
+ * Read the raw selection used for pending-intent matching. This intentionally
57
+ * keeps an adapter-generated effort: consumption compares the exact request
58
+ * header fields, not the sanitized user-facing representation.
59
+ */
60
+ function rawSelectionFromRequestHeader(header) {
61
+ const config = requestConfig(header);
62
+ if (config === void 0 || typeof config.provider !== "string" || config.provider.length === 0 || typeof config.model !== "string" || config.model.length === 0) return void 0;
63
+ if (config.reasoningEffort === void 0 || config.reasoningEffort === null) return {
64
+ provider: config.provider,
65
+ model: config.model
66
+ };
67
+ if (typeof config.reasoningEffort !== "string" || config.reasoningEffort.length === 0) return void 0;
68
+ return {
69
+ provider: config.provider,
70
+ model: config.model,
71
+ reasoningEffort: config.reasoningEffort
72
+ };
73
+ }
74
+ /** Clone a detached value so a Host-owned selection cannot cross the boundary by alias. */
75
+ function copyModelSelection(value) {
76
+ return value === void 0 ? void 0 : {
77
+ provider: value.provider,
78
+ model: value.model,
79
+ ...value.reasoningEffort === void 0 ? {} : { reasoningEffort: value.reasoningEffort }
80
+ };
81
+ }
82
+ //#endregion
83
+ export { SupersededReadError as a, sameModelSelection as i, normalizeModelSelection as n, rawSelectionFromRequestHeader as r, copyModelSelection as t };
@@ -0,0 +1,2 @@
1
+ import { t as mountRemoteClientDomainPrerequisites } from "./client-runtime-BHBlVUf5.mjs";
2
+ export { mountRemoteClientDomainPrerequisites };