@xmoon76/dsh-pi-tui 0.5.7 → 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 (78) hide show
  1. package/README.en.md +64 -26
  2. package/README.md +64 -26
  3. package/cordis.patch.yml +13 -0
  4. package/dist/acp-stdio.mjs +151 -0
  5. package/dist/{bootstrap-C9nl6e13.mjs → bootstrap-CVyHGQDX.mjs} +22330 -6888
  6. package/dist/browser-CDUSHIIr.mjs +76 -0
  7. package/dist/builtins.mjs +2 -2
  8. package/dist/{client-bootstrap-CGezi85O.mjs → client-bootstrap-4UoeVIHE.mjs} +2407 -1830
  9. package/dist/client-runtime-BHBlVUf5.mjs +1376 -0
  10. package/dist/{daemon-launcher-H_1r5Cqs.mjs → daemon-launcher-DxIgjBHW.mjs} +1551 -57
  11. package/dist/daemon-launcher.d.mts +85 -14
  12. package/dist/daemon-launcher.mjs +2 -2
  13. package/dist/diagnostics-Db5iVcuJ.mjs +123 -0
  14. package/dist/{entry-control-jBfKn1qO.mjs → entry-control-BDLZgg4m.mjs} +1 -1
  15. package/dist/{extensions-6a5vvJUT.mjs → extensions-Dx7ncPNA.mjs} +1 -4
  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-DK7n5jDu.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 +22766 -6893
  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 +719 -93
  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-BPZw1wEd.mjs → local-discovery-BMhaGIiJ.mjs} +254 -544
  38. package/dist/{local-discovery-BMoNXZjJ.mjs → local-discovery-Ba7_-NNC.mjs} +1 -1
  39. package/dist/{local-discovery-Bq3jLAn1.mjs → local-discovery-QSbFpjK2.mjs} +301 -544
  40. package/dist/local-host.mjs +970 -501
  41. package/dist/local-profile-daemon-admin-otpm69R6.mjs +469 -0
  42. package/dist/{local-scope-DEuGAy8l.mjs → local-scope-5DEKA_lW.mjs} +1075 -31
  43. package/dist/{local-transport-X4ZCe2uE.mjs → local-transport-DeWmdZ5E.mjs} +14 -3
  44. package/dist/{local-web-control-DKWtXIkr.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-DC0XQr5O.mjs → session-Cs8iLCEx.mjs} +784 -342
  62. package/dist/{session-Cihe8PPS.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-CARqn3kV.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-D4DHyXDo.mjs → terminal-progress-source-VsczdXA-.mjs} +610 -335
  70. package/dist/{transcript-view-a7cROAaI.mjs → transcript-view-B6vCnukn.mjs} +2284 -1166
  71. package/dist/{transcript-view-hvNVkPtv.mjs → transcript-view-DSSdE2vK.mjs} +2191 -765
  72. package/dist/write-failure-xNKczXH7.mjs +189 -0
  73. package/package.json +25 -8
  74. package/dist/local-acp-listener-CNkguN5-.mjs +0 -2566
  75. package/dist/local-daemon-control-Bg9s2aYi.mjs +0 -1424
  76. package/dist/local-daemon-control-Cu_4FIdd.mjs +0 -1585
  77. package/dist/local-profile-daemon-admin-AXgVH-6y.mjs +0 -91
  78. package/dist/preset-BcWqOtY7.mjs +0 -46
@@ -0,0 +1,101 @@
1
+ import { i as parsePiTuiAcpAccessStatus } from "./pi-tui-acp-access-contract-BdLwduU6.mjs";
2
+ //#region src/app/remote-process/local-acp-status.ts
3
+ /** The one Owner-only authenticated route of the live ACP status observation. */
4
+ const LOCAL_ACP_STATUS_ROUTE = "/api/pi-tui.acp-status";
5
+ /** Hard cap on the status response body; the DTO is a few hundred bytes. */
6
+ const LOCAL_ACP_STATUS_MAX_BYTES = 1024;
7
+ /** Bound on the one observation request. */
8
+ const LOCAL_ACP_STATUS_TIMEOUT_MS = 3e3;
9
+ /** Drain the body within the byte cap; an oversized/unreadable body is absent. */
10
+ async function readBoundedBody(response) {
11
+ if (response.body === null) return "";
12
+ const reader = response.body.getReader();
13
+ const chunks = [];
14
+ let total = 0;
15
+ try {
16
+ for (;;) {
17
+ const { done, value } = await reader.read();
18
+ if (done) break;
19
+ total += value.byteLength;
20
+ if (total > LOCAL_ACP_STATUS_MAX_BYTES) {
21
+ await reader.cancel();
22
+ return;
23
+ }
24
+ chunks.push(value);
25
+ }
26
+ } finally {
27
+ reader.releaseLock();
28
+ }
29
+ return Buffer.concat(chunks.map((chunk) => Buffer.from(chunk))).toString("utf8");
30
+ }
31
+ /** Cancel an unread body without observing it. */
32
+ async function discard(response) {
33
+ try {
34
+ await response.body?.cancel();
35
+ } catch {}
36
+ }
37
+ /**
38
+ * Observe the running Host's live ACP listener status through the authenticated
39
+ * read-only route. This is the ONLY headless observation; it never creates a
40
+ * controller, never calls `setEnabled`, and never caches the result.
41
+ *
42
+ * Every external-boundary failure category is `undefined` (the caller's
43
+ * `unavailable`), including an instance id that does not match the Host the
44
+ * Cookie was issued for: a response from a replaced/foreign Host can never be
45
+ * attributed to this observation.
46
+ *
47
+ * @param verified - the already authenticated Host record and in-memory cookie.
48
+ * @param signal - an optional owner cancellation (the management CLI lifecycle);
49
+ * it is combined with the fixed observation timeout and never extends it.
50
+ * @returns the validated live listener status, or `undefined` when unprovable.
51
+ */
52
+ async function observeAuthenticatedLocalAcpStatus(verified, signal) {
53
+ const timeout = AbortSignal.timeout(LOCAL_ACP_STATUS_TIMEOUT_MS);
54
+ const request = {
55
+ method: "GET",
56
+ headers: { cookie: verified.cookie },
57
+ redirect: "manual",
58
+ cache: "no-store",
59
+ signal: signal === void 0 ? timeout : AbortSignal.any([signal, timeout])
60
+ };
61
+ let response;
62
+ try {
63
+ response = await fetch(`${verified.record.origin}${LOCAL_ACP_STATUS_ROUTE}`, request);
64
+ } catch {
65
+ return;
66
+ }
67
+ if (response.status !== 200) {
68
+ await discard(response);
69
+ return;
70
+ }
71
+ const contentType = response.headers.get("content-type") ?? "";
72
+ const cacheControl = response.headers.get("cache-control") ?? "";
73
+ if (!/^application\/json\b/iu.test(contentType) || !/\bno-store\b/iu.test(cacheControl)) {
74
+ await discard(response);
75
+ return;
76
+ }
77
+ let text;
78
+ try {
79
+ const body = await readBoundedBody(response);
80
+ if (body === void 0) return void 0;
81
+ text = body;
82
+ } catch {
83
+ return;
84
+ }
85
+ let value;
86
+ try {
87
+ value = JSON.parse(text);
88
+ } catch {
89
+ return;
90
+ }
91
+ if (typeof value !== "object" || value === null) return void 0;
92
+ const record = value;
93
+ if (Object.keys(record).length !== 3 || record.schema !== 1 || typeof record.instanceId !== "string" || record.instanceId !== verified.identity.instanceId) return;
94
+ try {
95
+ return parsePiTuiAcpAccessStatus(record.status);
96
+ } catch {
97
+ return;
98
+ }
99
+ }
100
+ //#endregion
101
+ export { observeAuthenticatedLocalAcpStatus as t };