@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
@@ -1,6 +1,9 @@
1
1
  import { i as PI_TUI_WEB_ACCESS_SET_ENABLED, n as PI_TUI_WEB_ACCESS_GET_STATUS, t as PI_TUI_WEB_ACCESS_GET_AUTHENTICATED_URL } from "./pi-tui-web-access-contract-BN8Cc_Ho.mjs";
2
2
  import { r as PI_TUI_ACP_ACCESS_SET_ENABLED, t as PI_TUI_ACP_ACCESS_GET_STATUS } from "./pi-tui-acp-access-contract-BdLwduU6.mjs";
3
3
  import { c as MAX_HOST_USER_SHELL_SPILL_PATH_BYTES, l as MAX_HOST_USER_SHELL_STREAM_BYTES, n as PI_TUI_TERMINAL_PROGRESS_WATCH, o as MAX_HOST_USER_SHELL_MESSAGE_BYTES } from "./pi-tui-terminal-progress-contract-B3RoEzjK.mjs";
4
+ import { n as HISTORY_SESSION_RECALL_MAX_BYTES, r as HISTORY_SESSION_RECALL_MAX_TEXT_CHARS, t as HISTORY_SEARCH_READ_TEXT_LIMIT_MAX } from "./history-search-limits-Cx2UvRC2.mjs";
5
+ import "node:crypto";
6
+ import { isAbsolute } from "node:path";
4
7
  import { constants } from "node:os";
5
8
  //#region src/runtime/remote/pi-tui-authorization-contract.ts
6
9
  /** The wire namespace (and Host Cordis service key) of the private service. */
@@ -20,60 +23,60 @@ const WITHDRAWN_FRAME_LABEL = "piTuiAuthorization/run frame (prompt-withdrawn)";
20
23
  const SETTLED_FRAME_LABEL = "piTuiAuthorization/run frame (settled)";
21
24
  const UNCONFIRMED_FRAME_LABEL = "piTuiAuthorization/run frame (unconfirmed)";
22
25
  const TARGET_LABEL = "piTuiAuthorization/list target";
23
- function recordOf$6(value, label) {
26
+ function recordOf$7(value, label) {
24
27
  if (typeof value !== "object" || value === null || Array.isArray(value)) throw new TypeError(`${label}: the value must be an object`);
25
28
  return value;
26
29
  }
27
- function exactKeys$5(record, keys, label) {
30
+ function exactKeys$6(record, keys, label) {
28
31
  for (const key of Object.keys(record)) if (!keys.includes(key)) throw new TypeError(`${label}: unexpected field ${JSON.stringify(key)}`);
29
32
  }
30
- function requiredKeys$2(record, keys, label) {
33
+ function requiredKeys$3(record, keys, label) {
31
34
  for (const key of keys) if (!Object.hasOwn(record, key)) throw new TypeError(`${label}: missing field ${JSON.stringify(key)}`);
32
35
  }
33
- function nonEmptyString(value, label) {
36
+ function nonEmptyString$1(value, label) {
34
37
  if (typeof value !== "string" || value === "") throw new TypeError(`${label}: expected a non-empty string`);
35
38
  return value;
36
39
  }
37
40
  function optionalNonEmptyString(value, label) {
38
41
  if (value === void 0) return void 0;
39
- return nonEmptyString(value, label);
42
+ return nonEmptyString$1(value, label);
40
43
  }
41
44
  function assertOnlyOptional(record, keys, label) {
42
45
  for (const key of Object.keys(record)) if (!keys.includes(key)) throw new TypeError(`${label}: unexpected field ${JSON.stringify(key)}`);
43
46
  }
44
47
  function parseNotice(value) {
45
- const record = recordOf$6(value, NOTICE_FRAME_LABEL);
48
+ const record = recordOf$7(value, NOTICE_FRAME_LABEL);
46
49
  assertOnlyOptional(record, [
47
50
  "message",
48
51
  "url",
49
52
  "code"
50
53
  ], NOTICE_FRAME_LABEL);
51
- requiredKeys$2(record, ["message"], NOTICE_FRAME_LABEL);
54
+ requiredKeys$3(record, ["message"], NOTICE_FRAME_LABEL);
52
55
  return {
53
- message: nonEmptyString(record.message, `${NOTICE_FRAME_LABEL} message`),
54
- ...record.url === void 0 ? {} : { url: nonEmptyString(record.url, `${NOTICE_FRAME_LABEL} url`) },
55
- ...record.code === void 0 ? {} : { code: nonEmptyString(record.code, `${NOTICE_FRAME_LABEL} code`) }
56
+ message: nonEmptyString$1(record.message, `${NOTICE_FRAME_LABEL} message`),
57
+ ...record.url === void 0 ? {} : { url: nonEmptyString$1(record.url, `${NOTICE_FRAME_LABEL} url`) },
58
+ ...record.code === void 0 ? {} : { code: nonEmptyString$1(record.code, `${NOTICE_FRAME_LABEL} code`) }
56
59
  };
57
60
  }
58
61
  function parsePromptOptions(value) {
59
62
  if (!Array.isArray(value) || value.length === 0) throw new TypeError(`${PROMPT_FRAME_LABEL}: a select prompt needs a non-empty options array`);
60
63
  return value.map((entry) => {
61
- const option = recordOf$6(entry, `${PROMPT_FRAME_LABEL} option`);
64
+ const option = recordOf$7(entry, `${PROMPT_FRAME_LABEL} option`);
62
65
  assertOnlyOptional(option, [
63
66
  "id",
64
67
  "label",
65
68
  "description"
66
69
  ], `${PROMPT_FRAME_LABEL} option`);
67
- requiredKeys$2(option, ["id", "label"], `${PROMPT_FRAME_LABEL} option`);
70
+ requiredKeys$3(option, ["id", "label"], `${PROMPT_FRAME_LABEL} option`);
68
71
  return {
69
- id: nonEmptyString(option.id, `${PROMPT_FRAME_LABEL} option id`),
70
- label: nonEmptyString(option.label, `${PROMPT_FRAME_LABEL} option label`),
71
- ...option.description === void 0 ? {} : { description: nonEmptyString(option.description, `${PROMPT_FRAME_LABEL} option description`) }
72
+ id: nonEmptyString$1(option.id, `${PROMPT_FRAME_LABEL} option id`),
73
+ label: nonEmptyString$1(option.label, `${PROMPT_FRAME_LABEL} option label`),
74
+ ...option.description === void 0 ? {} : { description: nonEmptyString$1(option.description, `${PROMPT_FRAME_LABEL} option description`) }
72
75
  };
73
76
  });
74
77
  }
75
78
  function parsePrompt(value) {
76
- const record = recordOf$6(value, PROMPT_FRAME_LABEL);
79
+ const record = recordOf$7(value, PROMPT_FRAME_LABEL);
77
80
  const kind = record.kind;
78
81
  if (kind !== "text" && kind !== "secret" && kind !== "select") throw new TypeError(`${PROMPT_FRAME_LABEL}: the prompt kind must be text, secret or select`);
79
82
  if (kind === "select") {
@@ -82,10 +85,10 @@ function parsePrompt(value) {
82
85
  "message",
83
86
  "options"
84
87
  ], PROMPT_FRAME_LABEL);
85
- requiredKeys$2(record, ["message", "options"], PROMPT_FRAME_LABEL);
88
+ requiredKeys$3(record, ["message", "options"], PROMPT_FRAME_LABEL);
86
89
  return {
87
90
  kind: "select",
88
- message: nonEmptyString(record.message, `${PROMPT_FRAME_LABEL} message`),
91
+ message: nonEmptyString$1(record.message, `${PROMPT_FRAME_LABEL} message`),
89
92
  options: parsePromptOptions(record.options)
90
93
  };
91
94
  }
@@ -94,11 +97,11 @@ function parsePrompt(value) {
94
97
  "message",
95
98
  "placeholder"
96
99
  ], PROMPT_FRAME_LABEL);
97
- requiredKeys$2(record, ["message"], PROMPT_FRAME_LABEL);
100
+ requiredKeys$3(record, ["message"], PROMPT_FRAME_LABEL);
98
101
  return {
99
102
  kind,
100
- message: nonEmptyString(record.message, `${PROMPT_FRAME_LABEL} message`),
101
- ...record.placeholder === void 0 ? {} : { placeholder: nonEmptyString(record.placeholder, `${PROMPT_FRAME_LABEL} placeholder`) }
103
+ message: nonEmptyString$1(record.message, `${PROMPT_FRAME_LABEL} message`),
104
+ ...record.placeholder === void 0 ? {} : { placeholder: nonEmptyString$1(record.placeholder, `${PROMPT_FRAME_LABEL} placeholder`) }
102
105
  };
103
106
  }
104
107
  /**
@@ -111,63 +114,63 @@ function parsePrompt(value) {
111
114
  * Host identifier) makes the frame invalid instead of passing it through.
112
115
  */
113
116
  function parsePiTuiAuthorizationFrame(value) {
114
- const record = recordOf$6(value, "piTuiAuthorization/run frame");
117
+ const record = recordOf$7(value, "piTuiAuthorization/run frame");
115
118
  const kind = record.kind;
116
- const attemptId = nonEmptyString(record.attemptId, "piTuiAuthorization/run frame attemptId");
119
+ const attemptId = nonEmptyString$1(record.attemptId, "piTuiAuthorization/run frame attemptId");
117
120
  switch (kind) {
118
121
  case "started":
119
- exactKeys$5(record, ["kind", "attemptId"], STARTED_FRAME_LABEL);
122
+ exactKeys$6(record, ["kind", "attemptId"], STARTED_FRAME_LABEL);
120
123
  return {
121
124
  kind: "started",
122
125
  attemptId
123
126
  };
124
127
  case "notice":
125
- exactKeys$5(record, [
128
+ exactKeys$6(record, [
126
129
  "kind",
127
130
  "attemptId",
128
131
  "notice"
129
132
  ], NOTICE_FRAME_LABEL);
130
- requiredKeys$2(record, ["notice"], NOTICE_FRAME_LABEL);
133
+ requiredKeys$3(record, ["notice"], NOTICE_FRAME_LABEL);
131
134
  return {
132
135
  kind: "notice",
133
136
  attemptId,
134
137
  notice: parseNotice(record.notice)
135
138
  };
136
139
  case "prompt":
137
- exactKeys$5(record, [
140
+ exactKeys$6(record, [
138
141
  "kind",
139
142
  "attemptId",
140
143
  "promptId",
141
144
  "prompt"
142
145
  ], PROMPT_FRAME_LABEL);
143
- requiredKeys$2(record, ["promptId", "prompt"], PROMPT_FRAME_LABEL);
146
+ requiredKeys$3(record, ["promptId", "prompt"], PROMPT_FRAME_LABEL);
144
147
  return {
145
148
  kind: "prompt",
146
149
  attemptId,
147
- promptId: nonEmptyString(record.promptId, `${PROMPT_FRAME_LABEL} promptId`),
150
+ promptId: nonEmptyString$1(record.promptId, `${PROMPT_FRAME_LABEL} promptId`),
148
151
  prompt: parsePrompt(record.prompt)
149
152
  };
150
153
  case "prompt-withdrawn":
151
- exactKeys$5(record, [
154
+ exactKeys$6(record, [
152
155
  "kind",
153
156
  "attemptId",
154
157
  "promptId"
155
158
  ], WITHDRAWN_FRAME_LABEL);
156
- requiredKeys$2(record, ["promptId"], WITHDRAWN_FRAME_LABEL);
159
+ requiredKeys$3(record, ["promptId"], WITHDRAWN_FRAME_LABEL);
157
160
  return {
158
161
  kind: "prompt-withdrawn",
159
162
  attemptId,
160
- promptId: nonEmptyString(record.promptId, `${WITHDRAWN_FRAME_LABEL} promptId`)
163
+ promptId: nonEmptyString$1(record.promptId, `${WITHDRAWN_FRAME_LABEL} promptId`)
161
164
  };
162
165
  case "settled": {
163
- exactKeys$5(record, [
166
+ exactKeys$6(record, [
164
167
  "kind",
165
168
  "attemptId",
166
169
  "status",
167
170
  "code",
168
171
  "message"
169
172
  ], SETTLED_FRAME_LABEL);
170
- requiredKeys$2(record, ["status"], SETTLED_FRAME_LABEL);
173
+ requiredKeys$3(record, ["status"], SETTLED_FRAME_LABEL);
171
174
  const status = record.status;
172
175
  if (status !== "authorized" && status !== "cancelled" && status !== "failed") throw new TypeError(`${SETTLED_FRAME_LABEL}: the status must be authorized, cancelled or failed`);
173
176
  const code = optionalNonEmptyString(record.code, `${SETTLED_FRAME_LABEL} code`);
@@ -181,16 +184,16 @@ function parsePiTuiAuthorizationFrame(value) {
181
184
  };
182
185
  }
183
186
  case "unconfirmed":
184
- exactKeys$5(record, [
187
+ exactKeys$6(record, [
185
188
  "kind",
186
189
  "attemptId",
187
190
  "reason"
188
191
  ], UNCONFIRMED_FRAME_LABEL);
189
- requiredKeys$2(record, ["reason"], UNCONFIRMED_FRAME_LABEL);
192
+ requiredKeys$3(record, ["reason"], UNCONFIRMED_FRAME_LABEL);
190
193
  return {
191
194
  kind: "unconfirmed",
192
195
  attemptId,
193
- reason: nonEmptyString(record.reason, `${UNCONFIRMED_FRAME_LABEL} reason`)
196
+ reason: nonEmptyString$1(record.reason, `${UNCONFIRMED_FRAME_LABEL} reason`)
194
197
  };
195
198
  default: throw new TypeError("piTuiAuthorization/run frame: the kind is unknown");
196
199
  }
@@ -201,7 +204,7 @@ function parsePiTuiAuthorizationFrame(value) {
201
204
  * credential value, Host object or provider-internal path can ride along.
202
205
  */
203
206
  function parsePiTuiAuthorizationTarget(value) {
204
- const record = recordOf$6(value, TARGET_LABEL);
207
+ const record = recordOf$7(value, TARGET_LABEL);
205
208
  assertOnlyOptional(record, [
206
209
  "kind",
207
210
  "route",
@@ -210,7 +213,7 @@ function parsePiTuiAuthorizationTarget(value) {
210
213
  "methods",
211
214
  "inFlight"
212
215
  ], TARGET_LABEL);
213
- requiredKeys$2(record, [
216
+ requiredKeys$3(record, [
214
217
  "kind",
215
218
  "key",
216
219
  "label",
@@ -222,16 +225,16 @@ function parsePiTuiAuthorizationTarget(value) {
222
225
  if (typeof record.inFlight !== "boolean") throw new TypeError(`${TARGET_LABEL}: inFlight must be a boolean`);
223
226
  return {
224
227
  kind: "authorization",
225
- ...record.route === void 0 ? {} : { route: nonEmptyString(record.route, `${TARGET_LABEL} route`) },
226
- key: nonEmptyString(record.key, `${TARGET_LABEL} key`),
227
- label: nonEmptyString(record.label, `${TARGET_LABEL} label`),
228
+ ...record.route === void 0 ? {} : { route: nonEmptyString$1(record.route, `${TARGET_LABEL} route`) },
229
+ key: nonEmptyString$1(record.key, `${TARGET_LABEL} key`),
230
+ label: nonEmptyString$1(record.label, `${TARGET_LABEL} label`),
228
231
  methods: record.methods.map((entry) => {
229
- const method = recordOf$6(entry, `${TARGET_LABEL} method`);
230
- exactKeys$5(method, ["id", "label"], `${TARGET_LABEL} method`);
231
- requiredKeys$2(method, ["id", "label"], `${TARGET_LABEL} method`);
232
+ const method = recordOf$7(entry, `${TARGET_LABEL} method`);
233
+ exactKeys$6(method, ["id", "label"], `${TARGET_LABEL} method`);
234
+ requiredKeys$3(method, ["id", "label"], `${TARGET_LABEL} method`);
232
235
  return {
233
- id: nonEmptyString(method.id, `${TARGET_LABEL} method id`),
234
- label: nonEmptyString(method.label, `${TARGET_LABEL} method label`)
236
+ id: nonEmptyString$1(method.id, `${TARGET_LABEL} method id`),
237
+ label: nonEmptyString$1(method.label, `${TARGET_LABEL} method label`)
235
238
  };
236
239
  }),
237
240
  inFlight: record.inFlight
@@ -239,16 +242,16 @@ function parsePiTuiAuthorizationTarget(value) {
239
242
  }
240
243
  /** Validate and detach one roster snapshot. */
241
244
  function parsePiTuiAuthorizationTargetsSnapshot(value) {
242
- const record = recordOf$6(value, "piTuiAuthorization/list result");
245
+ const record = recordOf$7(value, "piTuiAuthorization/list result");
243
246
  if (record.kind === "unavailable") {
244
- exactKeys$5(record, ["kind", "reason"], "piTuiAuthorization/list result");
247
+ exactKeys$6(record, ["kind", "reason"], "piTuiAuthorization/list result");
245
248
  return {
246
249
  kind: "unavailable",
247
- reason: nonEmptyString(record.reason, "piTuiAuthorization/list result reason")
250
+ reason: nonEmptyString$1(record.reason, "piTuiAuthorization/list result reason")
248
251
  };
249
252
  }
250
253
  if (record.kind !== "ready") throw new TypeError("piTuiAuthorization/list result: the kind must be ready or unavailable");
251
- exactKeys$5(record, ["kind", "targets"], "piTuiAuthorization/list result");
254
+ exactKeys$6(record, ["kind", "targets"], "piTuiAuthorization/list result");
252
255
  if (!Array.isArray(record.targets)) throw new TypeError("piTuiAuthorization/list result: targets must be an array");
253
256
  return {
254
257
  kind: "ready",
@@ -269,7 +272,7 @@ function codecOf(label, parse) {
269
272
  };
270
273
  }
271
274
  function stringCodec$2(label) {
272
- return codecOf(label, (value) => nonEmptyString(value, `piTuiAuthorization ${label}`));
275
+ return codecOf(label, (value) => nonEmptyString$1(value, `piTuiAuthorization ${label}`));
273
276
  }
274
277
  const FRAME_CODEC = {
275
278
  mode: "strict",
@@ -395,14 +398,14 @@ const CREDENTIAL_RECORD_KEY_PATTERN = /^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/;
395
398
  const RECORD_LABEL = "piTuiCredentialRecords record";
396
399
  const LIST_LABEL = "piTuiCredentialRecords/list result";
397
400
  const KEY_LABEL = "piTuiCredentialRecords key";
398
- function recordOf$5(value, label) {
401
+ function recordOf$6(value, label) {
399
402
  if (typeof value !== "object" || value === null || Array.isArray(value)) throw new TypeError(`${label}: the value must be an object`);
400
403
  return value;
401
404
  }
402
- function exactKeys$4(record, keys, label) {
405
+ function exactKeys$5(record, keys, label) {
403
406
  for (const key of Object.keys(record)) if (!keys.includes(key)) throw new TypeError(`${label}: unexpected field ${JSON.stringify(key)}`);
404
407
  }
405
- function requiredKeys$1(record, keys, label) {
408
+ function requiredKeys$2(record, keys, label) {
406
409
  for (const key of keys) if (!Object.hasOwn(record, key)) throw new TypeError(`${label}: missing field ${JSON.stringify(key)}`);
407
410
  }
408
411
  /**
@@ -416,9 +419,9 @@ function parsePiTuiCredentialRecordKey(value) {
416
419
  }
417
420
  /** Validate and detach ONE stored-record metadata row (exactly `key`+`kind`). */
418
421
  function parsePiTuiCredentialRecordMetadata(value) {
419
- const record = recordOf$5(value, RECORD_LABEL);
420
- exactKeys$4(record, ["key", "kind"], RECORD_LABEL);
421
- requiredKeys$1(record, ["key", "kind"], RECORD_LABEL);
422
+ const record = recordOf$6(value, RECORD_LABEL);
423
+ exactKeys$5(record, ["key", "kind"], RECORD_LABEL);
424
+ requiredKeys$2(record, ["key", "kind"], RECORD_LABEL);
422
425
  const kind = record.kind;
423
426
  if (kind !== "api-key" && kind !== "grant") throw new TypeError(`${RECORD_LABEL}: the kind must be api-key or grant`);
424
427
  return {
@@ -520,11 +523,11 @@ function workspaceIdCodec$1(typeSymbol) {
520
523
  };
521
524
  }
522
525
  const signalNames = new Set(Object.keys(constants.signals));
523
- function recordOf$4(value, label) {
526
+ function recordOf$5(value, label) {
524
527
  if (typeof value !== "object" || value === null || Array.isArray(value)) throw new TypeError(`${label}: expected an object`);
525
528
  return value;
526
529
  }
527
- function exactKeys$3(record, expected, label) {
530
+ function exactKeys$4(record, expected, label) {
528
531
  for (const key of Object.keys(record)) if (!expected.includes(key)) throw new TypeError(`${label}: unexpected field ${JSON.stringify(key)}`);
529
532
  for (const key of expected) if (!Object.hasOwn(record, key)) throw new TypeError(`${label}: missing field ${JSON.stringify(key)}`);
530
533
  }
@@ -553,9 +556,9 @@ function policyOf(value, label) {
553
556
  return value;
554
557
  }
555
558
  function parseExit(value) {
556
- const exit = recordOf$4(value, "piTuiHostUserShell/run: exit");
559
+ const exit = recordOf$5(value, "piTuiHostUserShell/run: exit");
557
560
  if (exit.kind === "exit") {
558
- exactKeys$3(exit, ["kind", "code"], "piTuiHostUserShell/run: exit");
561
+ exactKeys$4(exit, ["kind", "code"], "piTuiHostUserShell/run: exit");
559
562
  if (!Number.isSafeInteger(exit.code) || exit.code < 0 || exit.code > 255) throw new TypeError("piTuiHostUserShell/run: exit code must be an integer from 0 through 255");
560
563
  return {
561
564
  kind: "exit",
@@ -563,7 +566,7 @@ function parseExit(value) {
563
566
  };
564
567
  }
565
568
  if (exit.kind === "signal") {
566
- exactKeys$3(exit, ["kind", "signal"], "piTuiHostUserShell/run: exit");
569
+ exactKeys$4(exit, ["kind", "signal"], "piTuiHostUserShell/run: exit");
567
570
  const signal = stringOf(exit.signal, "piTuiHostUserShell/run: exit signal");
568
571
  if (!signalNames.has(signal)) throw new TypeError("piTuiHostUserShell/run: exit signal is invalid");
569
572
  return {
@@ -575,7 +578,7 @@ function parseExit(value) {
575
578
  }
576
579
  function parseOutput(value, stream) {
577
580
  const label = `piTuiHostUserShell/run: ${stream}`;
578
- const output = recordOf$4(value, label);
581
+ const output = recordOf$5(value, label);
579
582
  for (const key of Object.keys(output)) if (key !== "text" && key !== "truncated" && key !== "spillPath") throw new TypeError(`${label}: unexpected field ${JSON.stringify(key)}`);
580
583
  if (!Object.hasOwn(output, "text")) throw new TypeError(`${label}: missing field "text"`);
581
584
  if (!Object.hasOwn(output, "truncated")) throw new TypeError(`${label}: missing field "truncated"`);
@@ -594,8 +597,8 @@ function parseOutput(value, stream) {
594
597
  };
595
598
  }
596
599
  function parseResult(value) {
597
- const result = recordOf$4(value, "piTuiHostUserShell/run: result");
598
- exactKeys$3(result, [
600
+ const result = recordOf$5(value, "piTuiHostUserShell/run: result");
601
+ exactKeys$4(result, [
599
602
  "exit",
600
603
  "stdout",
601
604
  "stderr",
@@ -622,16 +625,16 @@ function boundedMessageOf(value, label) {
622
625
  }
623
626
  /** The single strict decoder for one unary Shell outcome. */
624
627
  function parseHostUserShellRunOutcome(value) {
625
- const outcome = recordOf$4(value, "piTuiHostUserShell/run: outcome");
628
+ const outcome = recordOf$5(value, "piTuiHostUserShell/run: outcome");
626
629
  if (outcome.kind === "settled") {
627
- exactKeys$3(outcome, ["kind", "result"], "piTuiHostUserShell/run: settled outcome");
630
+ exactKeys$4(outcome, ["kind", "result"], "piTuiHostUserShell/run: settled outcome");
628
631
  return {
629
632
  kind: "settled",
630
633
  result: parseResult(outcome.result)
631
634
  };
632
635
  }
633
636
  if (outcome.kind === "refused") {
634
- exactKeys$3(outcome, [
637
+ exactKeys$4(outcome, [
635
638
  "kind",
636
639
  "reason",
637
640
  "message"
@@ -644,7 +647,7 @@ function parseHostUserShellRunOutcome(value) {
644
647
  };
645
648
  }
646
649
  if (outcome.kind === "failed") {
647
- exactKeys$3(outcome, [
650
+ exactKeys$4(outcome, [
648
651
  "kind",
649
652
  "phase",
650
653
  "message"
@@ -660,16 +663,16 @@ function parseHostUserShellRunOutcome(value) {
660
663
  }
661
664
  /** Strict decoder for Host completion arguments. */
662
665
  function parseHostShellCompletionRequest(value) {
663
- const request = recordOf$4(value, "piTuiHostUserShell/complete: request");
666
+ const request = recordOf$5(value, "piTuiHostUserShell/complete: request");
664
667
  if (request.kind === "commands" || request.kind === "variables") {
665
- exactKeys$3(request, ["kind", "prefix"], "piTuiHostUserShell/complete: request");
668
+ exactKeys$4(request, ["kind", "prefix"], "piTuiHostUserShell/complete: request");
666
669
  return {
667
670
  kind: request.kind,
668
671
  prefix: stringOf(request.prefix, "piTuiHostUserShell/complete: prefix", { empty: true })
669
672
  };
670
673
  }
671
674
  if (request.kind === "subcommands") {
672
- exactKeys$3(request, [
675
+ exactKeys$4(request, [
673
676
  "kind",
674
677
  "command",
675
678
  "prefix"
@@ -681,7 +684,7 @@ function parseHostShellCompletionRequest(value) {
681
684
  };
682
685
  }
683
686
  if (request.kind === "paths") {
684
- exactKeys$3(request, ["kind", "prefix"], "piTuiHostUserShell/complete: request");
687
+ exactKeys$4(request, ["kind", "prefix"], "piTuiHostUserShell/complete: request");
685
688
  return {
686
689
  kind: "paths",
687
690
  prefix: stringOf(request.prefix, "piTuiHostUserShell/complete: prefix", { empty: true })
@@ -691,16 +694,16 @@ function parseHostShellCompletionRequest(value) {
691
694
  }
692
695
  /** Strict bounded decoder for a unary completion result. */
693
696
  function parseHostShellCompletionOutcome(value) {
694
- const outcome = recordOf$4(value, "piTuiHostUserShell/complete: result");
697
+ const outcome = recordOf$5(value, "piTuiHostUserShell/complete: result");
695
698
  if (outcome.kind === "unavailable") {
696
- exactKeys$3(outcome, ["kind", "reason"], "piTuiHostUserShell/complete: unavailable result");
699
+ exactKeys$4(outcome, ["kind", "reason"], "piTuiHostUserShell/complete: unavailable result");
697
700
  return {
698
701
  kind: "unavailable",
699
702
  reason: stringOf(outcome.reason, "piTuiHostUserShell/complete: reason")
700
703
  };
701
704
  }
702
705
  if (outcome.kind !== "ok") throw new TypeError("piTuiHostUserShell/complete: result kind is invalid");
703
- exactKeys$3(outcome, ["kind", "candidates"], "piTuiHostUserShell/complete: ok result");
706
+ exactKeys$4(outcome, ["kind", "candidates"], "piTuiHostUserShell/complete: ok result");
704
707
  if (!Array.isArray(outcome.candidates)) throw new TypeError("piTuiHostUserShell/complete: candidates must be an array");
705
708
  if (outcome.candidates.length > 50) throw new TypeError("piTuiHostUserShell/complete: result exceeds 50 candidates");
706
709
  const detached = {
@@ -825,7 +828,7 @@ const PI_TUI_HOST_USER_SHELL_COMPLETE_WORKSPACE = {
825
828
  const PI_TUI_SKILLS_NAMESPACE = "piTuiSkills";
826
829
  const PI_TUI_SKILLS_STANDING_ENDPOINT = "@xmoon76/dsh-pi-tui#piTuiSkills/standing";
827
830
  const PI_TUI_SKILLS_WATCH_INVALIDATIONS_ENDPOINT = "@xmoon76/dsh-pi-tui#piTuiSkills/watchInvalidations";
828
- function recordOf$3(value, label) {
831
+ function recordOf$4(value, label) {
829
832
  if (typeof value !== "object" || value === null || Array.isArray(value)) throw new TypeError(`${label}: the value must be an object`);
830
833
  return value;
831
834
  }
@@ -833,7 +836,7 @@ function assertOnlyKeys(record, keys, label) {
833
836
  for (const key of Object.keys(record)) if (!keys.includes(key)) throw new TypeError(`${label}: unexpected field ${JSON.stringify(key)}`);
834
837
  }
835
838
  function parsePiTuiSkillsStandingRequest(value) {
836
- const record = recordOf$3(value, "piTuiSkills/standing request");
839
+ const record = recordOf$4(value, "piTuiSkills/standing request");
837
840
  assertOnlyKeys(record, ["workspaceId", "presetId"], "piTuiSkills/standing request");
838
841
  if (typeof record.workspaceId !== "string" || record.workspaceId === "") throw new TypeError("piTuiSkills/standing request: workspaceId must be a non-empty string");
839
842
  if (record.presetId !== void 0 && (typeof record.presetId !== "string" || record.presetId === "")) throw new TypeError("piTuiSkills/standing request: presetId must be a non-empty string when supplied");
@@ -843,7 +846,7 @@ function parsePiTuiSkillsStandingRequest(value) {
843
846
  };
844
847
  }
845
848
  function parsePiTuiSkillsStandingResult(value) {
846
- const record = recordOf$3(value, "piTuiSkills/standing result");
849
+ const record = recordOf$4(value, "piTuiSkills/standing result");
847
850
  assertOnlyKeys(record, [
848
851
  "skills",
849
852
  "complete",
@@ -853,7 +856,7 @@ function parsePiTuiSkillsStandingResult(value) {
853
856
  if (record.notice !== void 0 && typeof record.notice !== "string") throw new TypeError("piTuiSkills/standing result: notice must be a string when supplied");
854
857
  return {
855
858
  skills: record.skills.map((value) => {
856
- const skill = recordOf$3(value, "piTuiSkills/standing skill");
859
+ const skill = recordOf$4(value, "piTuiSkills/standing skill");
857
860
  assertOnlyKeys(skill, [
858
861
  "name",
859
862
  "description",
@@ -873,7 +876,7 @@ function parsePiTuiSkillsStandingResult(value) {
873
876
  };
874
877
  }
875
878
  function parsePiTuiSkillsInvalidationFrame(value) {
876
- const record = recordOf$3(value, "piTuiSkills/watchInvalidations frame");
879
+ const record = recordOf$4(value, "piTuiSkills/watchInvalidations frame");
877
880
  assertOnlyKeys(record, ["kind"], "piTuiSkills/watchInvalidations frame");
878
881
  if (record.kind !== "invalidated") throw new TypeError("piTuiSkills/watchInvalidations frame: kind must be invalidated");
879
882
  return { kind: "invalidated" };
@@ -1061,14 +1064,14 @@ const READ_LABEL = "piTuiSessionPolicy/read result";
1061
1064
  const SET_LABEL = "piTuiSessionPolicy/setApproval result";
1062
1065
  const SESSION_ID_LABEL = "piTuiSessionPolicy sessionId";
1063
1066
  const POLICY_LABEL = "piTuiSessionPolicy policy";
1064
- function recordOf$2(value, label) {
1067
+ function recordOf$3(value, label) {
1065
1068
  if (typeof value !== "object" || value === null || Array.isArray(value)) throw new TypeError(`${label}: the value must be an object`);
1066
1069
  return value;
1067
1070
  }
1068
- function exactKeys$2(record, keys, label) {
1071
+ function exactKeys$3(record, keys, label) {
1069
1072
  for (const key of Object.keys(record)) if (!keys.includes(key)) throw new TypeError(`${label}: unexpected field ${JSON.stringify(key)}`);
1070
1073
  }
1071
- function requiredKeys(record, keys, label) {
1074
+ function requiredKeys$1(record, keys, label) {
1072
1075
  for (const key of keys) if (!Object.hasOwn(record, key)) throw new TypeError(`${label}: missing field ${JSON.stringify(key)}`);
1073
1076
  }
1074
1077
  /** Validate one non-empty session id as wire text and return it. */
@@ -1092,9 +1095,9 @@ function parseSandboxMode(value, label) {
1092
1095
  }
1093
1096
  /** Validate and detach one knob's wire side (closed state union, exact keys). */
1094
1097
  function parsePolicySide(value, parseValue, label) {
1095
- const record = recordOf$2(value, label);
1098
+ const record = recordOf$3(value, label);
1096
1099
  if (record.state === "unavailable") {
1097
- exactKeys$2(record, ["state", "reason"], label);
1100
+ exactKeys$3(record, ["state", "reason"], label);
1098
1101
  if (record.reason !== "service-not-installed") throw new TypeError(`${label}: unknown unavailable reason ${JSON.stringify(record.reason)}`);
1099
1102
  return {
1100
1103
  state: "unavailable",
@@ -1103,7 +1106,7 @@ function parsePolicySide(value, parseValue, label) {
1103
1106
  }
1104
1107
  if (record.state !== "ready") throw new TypeError(`${label}: unknown state ${JSON.stringify(record.state)}`);
1105
1108
  if (Object.hasOwn(record, "override")) {
1106
- exactKeys$2(record, [
1109
+ exactKeys$3(record, [
1107
1110
  "state",
1108
1111
  "effective",
1109
1112
  "override"
@@ -1114,7 +1117,7 @@ function parsePolicySide(value, parseValue, label) {
1114
1117
  override: parseValue(record.override, label)
1115
1118
  };
1116
1119
  }
1117
- exactKeys$2(record, ["state", "effective"], label);
1120
+ exactKeys$3(record, ["state", "effective"], label);
1118
1121
  return {
1119
1122
  state: "ready",
1120
1123
  effective: parseValue(record.effective, label)
@@ -1127,9 +1130,9 @@ function parsePolicySide(value, parseValue, label) {
1127
1130
  * an authoritative answer.
1128
1131
  */
1129
1132
  function parseSessionPolicyRead(value) {
1130
- const record = recordOf$2(value, READ_LABEL);
1133
+ const record = recordOf$3(value, READ_LABEL);
1131
1134
  if (record.kind === "unavailable") {
1132
- exactKeys$2(record, [
1135
+ exactKeys$3(record, [
1133
1136
  "kind",
1134
1137
  "sessionId",
1135
1138
  "reason"
@@ -1142,13 +1145,13 @@ function parseSessionPolicyRead(value) {
1142
1145
  };
1143
1146
  }
1144
1147
  if (record.kind !== "ready") throw new TypeError(`${READ_LABEL}: unknown kind ${JSON.stringify(record.kind)}`);
1145
- exactKeys$2(record, [
1148
+ exactKeys$3(record, [
1146
1149
  "kind",
1147
1150
  "sessionId",
1148
1151
  "approval",
1149
1152
  "sandbox"
1150
1153
  ], READ_LABEL);
1151
- requiredKeys(record, [
1154
+ requiredKeys$1(record, [
1152
1155
  "kind",
1153
1156
  "sessionId",
1154
1157
  "approval",
@@ -1168,16 +1171,16 @@ const SET_REFUSAL_REASONS = [
1168
1171
  ];
1169
1172
  /** Validate and detach the `setApproval` result (closed union, exact keys). */
1170
1173
  function parseSessionPolicySetWireOutcome(value) {
1171
- const record = recordOf$2(value, SET_LABEL);
1174
+ const record = recordOf$3(value, SET_LABEL);
1172
1175
  if (record.kind === "applied") {
1173
- exactKeys$2(record, ["kind", "sessionId"], SET_LABEL);
1176
+ exactKeys$3(record, ["kind", "sessionId"], SET_LABEL);
1174
1177
  return {
1175
1178
  kind: "applied",
1176
1179
  sessionId: parseSessionPolicySessionId(record.sessionId)
1177
1180
  };
1178
1181
  }
1179
1182
  if (record.kind === "refused") {
1180
- exactKeys$2(record, ["kind", "reason"], SET_LABEL);
1183
+ exactKeys$3(record, ["kind", "reason"], SET_LABEL);
1181
1184
  if (!SET_REFUSAL_REASONS.includes(record.reason)) throw new TypeError(`${SET_LABEL}: unknown refusal reason ${JSON.stringify(record.reason)}`);
1182
1185
  return {
1183
1186
  kind: "refused",
@@ -1261,11 +1264,11 @@ const REFUSAL_REASONS$1 = [
1261
1264
  "profile-persistence-unavailable",
1262
1265
  "profile-entry-unavailable"
1263
1266
  ];
1264
- function recordOf$1(value, label) {
1267
+ function recordOf$2(value, label) {
1265
1268
  if (typeof value !== "object" || value === null || Array.isArray(value)) throw new TypeError(`${label}: the value must be an object`);
1266
1269
  return value;
1267
1270
  }
1268
- function exactKeys$1(record, keys, label) {
1271
+ function exactKeys$2(record, keys, label) {
1269
1272
  for (const key of Object.keys(record)) if (!keys.includes(key)) throw new TypeError(`${label}: unexpected field ${JSON.stringify(key)}`);
1270
1273
  }
1271
1274
  /** A model identifier: a NON-EMPTY string, deliberately NOT trimmed (whitespace
@@ -1281,8 +1284,8 @@ function parseIdentifier(value, label) {
1281
1284
  * `null`, a number, an array or any extra field is refused at the boundary.
1282
1285
  */
1283
1286
  function parseDefaultModelSelection(value) {
1284
- const record = recordOf$1(value, SELECTION_LABEL);
1285
- exactKeys$1(record, [
1287
+ const record = recordOf$2(value, SELECTION_LABEL);
1288
+ exactKeys$2(record, [
1286
1289
  "provider",
1287
1290
  "model",
1288
1291
  "reasoningEffort"
@@ -1303,13 +1306,13 @@ function parseDefaultModelSelection(value) {
1303
1306
  }
1304
1307
  /** Validate and detach one Host result (closed union, exact keys). */
1305
1308
  function parseDefaultModelSaveResult(value) {
1306
- const record = recordOf$1(value, RESULT_LABEL);
1309
+ const record = recordOf$2(value, RESULT_LABEL);
1307
1310
  if (record.kind === "saved") {
1308
- exactKeys$1(record, ["kind"], RESULT_LABEL);
1311
+ exactKeys$2(record, ["kind"], RESULT_LABEL);
1309
1312
  return { kind: "saved" };
1310
1313
  }
1311
1314
  if (record.kind === "refused") {
1312
- exactKeys$1(record, ["kind", "reason"], RESULT_LABEL);
1315
+ exactKeys$2(record, ["kind", "reason"], RESULT_LABEL);
1313
1316
  if (!REFUSAL_REASONS$1.includes(record.reason)) throw new TypeError(`${RESULT_LABEL}: unknown refusal reason ${JSON.stringify(record.reason)}`);
1314
1317
  return {
1315
1318
  kind: "refused",
@@ -1364,11 +1367,11 @@ const DISPLAY_PRESETS = [
1364
1367
  "compact",
1365
1368
  "full"
1366
1369
  ];
1367
- function recordOf(value, label) {
1370
+ function recordOf$1(value, label) {
1368
1371
  if (typeof value !== "object" || value === null || Array.isArray(value)) throw new TypeError(`${label}: the value must be an object`);
1369
1372
  return value;
1370
1373
  }
1371
- function exactKeys(record, keys, label) {
1374
+ function exactKeys$1(record, keys, label) {
1372
1375
  for (const key of Object.keys(record)) if (!keys.includes(key)) throw new TypeError(`${label}: unexpected field ${JSON.stringify(key)}`);
1373
1376
  }
1374
1377
  /**
@@ -1393,16 +1396,16 @@ function parsePresenceRevision(value) {
1393
1396
  }
1394
1397
  /** Validate and detach one `syncView` result. */
1395
1398
  function parsePresenceSyncResult(value) {
1396
- const record = recordOf(value, SYNC_RESULT_LABEL);
1399
+ const record = recordOf$1(value, SYNC_RESULT_LABEL);
1397
1400
  if (record.kind === "applied") {
1398
- exactKeys(record, ["kind", "revision"], SYNC_RESULT_LABEL);
1401
+ exactKeys$1(record, ["kind", "revision"], SYNC_RESULT_LABEL);
1399
1402
  return {
1400
1403
  kind: "applied",
1401
1404
  revision: parsePresenceRevision(record.revision)
1402
1405
  };
1403
1406
  }
1404
1407
  if (record.kind === "refused") {
1405
- exactKeys(record, ["kind", "reason"], SYNC_RESULT_LABEL);
1408
+ exactKeys$1(record, ["kind", "reason"], SYNC_RESULT_LABEL);
1406
1409
  if (!REFUSAL_REASONS.includes(record.reason)) throw new TypeError(`${SYNC_RESULT_LABEL}: unknown refusal reason ${JSON.stringify(record.reason)}`);
1407
1410
  return {
1408
1411
  kind: "refused",
@@ -1411,6 +1414,542 @@ function parsePresenceSyncResult(value) {
1411
1414
  }
1412
1415
  throw new TypeError(`${SYNC_RESULT_LABEL}: unknown kind ${JSON.stringify(record.kind)}`);
1413
1416
  }
1417
+ /** The ONE shared `syncView` descriptor both contributions derive from. */
1418
+ const PI_TUI_PROMPT_PRESENCE_SYNC_VIEW = {
1419
+ id: PI_TUI_PROMPT_PRESENCE_SYNC_VIEW_ENDPOINT,
1420
+ service: PI_TUI_PROMPT_PRESENCE_NAMESPACE,
1421
+ namespace: PI_TUI_PROMPT_PRESENCE_NAMESPACE,
1422
+ method: "syncView",
1423
+ invocation: { kind: "direct" },
1424
+ parameters: [
1425
+ {
1426
+ name: "viewedSessionId",
1427
+ wire: "viewedSessionId",
1428
+ source: "json",
1429
+ codec: {
1430
+ mode: "strict",
1431
+ typeSymbol: `${PI_TUI_PROMPT_PRESENCE_SYNC_VIEW_ENDPOINT}:viewedSessionId`,
1432
+ create: () => ({ parse: parsePresenceViewedSessionId }),
1433
+ decode: parsePresenceViewedSessionId
1434
+ }
1435
+ },
1436
+ {
1437
+ name: "displayPreset",
1438
+ wire: "displayPreset",
1439
+ source: "json",
1440
+ codec: {
1441
+ mode: "strict",
1442
+ typeSymbol: `${PI_TUI_PROMPT_PRESENCE_SYNC_VIEW_ENDPOINT}:displayPreset`,
1443
+ create: () => ({ parse: parsePresenceDisplayPreset }),
1444
+ decode: parsePresenceDisplayPreset
1445
+ }
1446
+ },
1447
+ {
1448
+ name: "revision",
1449
+ wire: "revision",
1450
+ source: "json",
1451
+ codec: {
1452
+ mode: "strict",
1453
+ typeSymbol: `${PI_TUI_PROMPT_PRESENCE_SYNC_VIEW_ENDPOINT}:revision`,
1454
+ create: () => ({ parse: parsePresenceRevision }),
1455
+ decode: parsePresenceRevision
1456
+ }
1457
+ }
1458
+ ],
1459
+ cancellation: { parameter: "signal" },
1460
+ result: {
1461
+ mode: "strict",
1462
+ typeSymbol: `${PI_TUI_PROMPT_PRESENCE_SYNC_VIEW_ENDPOINT}:result`,
1463
+ create: () => ({ parse: parsePresenceSyncResult }),
1464
+ decode: parsePresenceSyncResult
1465
+ }
1466
+ };
1467
+ //#endregion
1468
+ //#region src/runtime/remote/pi-tui-history-search-contract.ts
1469
+ /** The wire namespace (and Host Cordis service key) of the private service. */
1470
+ const PI_TUI_HISTORY_SEARCH_NAMESPACE = "piTuiHistorySearch";
1471
+ /** The search endpoint's stable identity. */
1472
+ const PI_TUI_HISTORY_SEARCH_SEARCH_ENDPOINT = "@xmoon76/dsh-pi-tui#piTuiHistorySearch/search";
1473
+ /** The exact-text read endpoint's stable identity. */
1474
+ const PI_TUI_HISTORY_SEARCH_READ_TEXT_ENDPOINT = "@xmoon76/dsh-pi-tui#piTuiHistorySearch/readText";
1475
+ /** The session-scoped recall endpoint's stable identity. */
1476
+ const PI_TUI_HISTORY_SEARCH_SESSION_RECALL_ENDPOINT = "@xmoon76/dsh-pi-tui#piTuiHistorySearch/readSessionRecall";
1477
+ /** The blank-Session temporary directory recall endpoint's stable identity. */
1478
+ const PI_TUI_HISTORY_SEARCH_BLANK_DIRECTORY_RECALL_ENDPOINT = "@xmoon76/dsh-pi-tui#piTuiHistorySearch/readBlankDirectoryRecall";
1479
+ /** The preview is a bounded prefix, never recoverable full content. */
1480
+ const HISTORY_SEARCH_PREVIEW_MAX_CHARS = 4096;
1481
+ /** Inclusive chunk-size bound of one readText request. */
1482
+ /** The encoded keyset cursor bound in bytes. */
1483
+ const HISTORY_SEARCH_CURSOR_MAX_BYTES = 2048;
1484
+ const REQUEST_LABEL = "piTuiHistorySearch/search request";
1485
+ const READ_REQUEST_LABEL = "piTuiHistorySearch/readText request";
1486
+ const RECALL_REQUEST_LABEL = "piTuiHistorySearch/readSessionRecall request";
1487
+ const RECALL_ITEM_LABEL = "piTuiHistorySearch recall item";
1488
+ const BLANK_REQUEST_LABEL = "piTuiHistorySearch/readBlankDirectoryRecall request";
1489
+ const BLANK_ITEM_LABEL = "piTuiHistorySearch blank directory recall item";
1490
+ const BLANK_ANSWER_LABEL = "piTuiHistorySearch/readBlankDirectoryRecall result";
1491
+ const ITEM_LABEL = "piTuiHistorySearch item";
1492
+ const ANSWER_LABEL = "piTuiHistorySearch/search result";
1493
+ const READ_ANSWER_LABEL = "piTuiHistorySearch/readText result";
1494
+ const RECALL_ANSWER_LABEL = "piTuiHistorySearch/readSessionRecall result";
1495
+ const SCOPES = [
1496
+ "all",
1497
+ "session",
1498
+ "directory"
1499
+ ];
1500
+ const INCOMPLETE_REASONS = [
1501
+ "source-uncertain",
1502
+ "reconciling",
1503
+ "resource-limit",
1504
+ "source-read-failed"
1505
+ ];
1506
+ const UNAVAILABLE_REASONS = ["index-unavailable", "service-missing"];
1507
+ const READ_UNAVAILABLE_REASONS = [
1508
+ "not-found",
1509
+ "stale-content",
1510
+ "index-unavailable",
1511
+ "service-missing"
1512
+ ];
1513
+ function recordOf(value, label) {
1514
+ if (typeof value !== "object" || value === null || Array.isArray(value)) throw new TypeError(`${label}: the value must be an object`);
1515
+ return value;
1516
+ }
1517
+ function exactKeys(record, keys, label) {
1518
+ for (const key of Object.keys(record)) if (!keys.includes(key)) throw new TypeError(`${label}: unexpected field ${JSON.stringify(key)}`);
1519
+ }
1520
+ function requiredKeys(record, keys, label) {
1521
+ for (const key of keys) if (!Object.hasOwn(record, key)) throw new TypeError(`${label}: missing field ${JSON.stringify(key)}`);
1522
+ }
1523
+ function nonEmptyString(value, label) {
1524
+ if (typeof value !== "string" || value === "") throw new TypeError(`${label}: expected a non-empty string`);
1525
+ return value;
1526
+ }
1527
+ function nonNegativeInteger(value, label) {
1528
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) throw new TypeError(`${label}: expected a non-negative safe integer`);
1529
+ return value;
1530
+ }
1531
+ function boundedInteger(value, min, max, label) {
1532
+ const parsed = nonNegativeInteger(value, label);
1533
+ if (parsed < min || parsed > max) throw new TypeError(`${label}: expected an integer within ${min}..${max}`);
1534
+ return parsed;
1535
+ }
1536
+ function parseContentSha256(value, label) {
1537
+ if (typeof value !== "string" || !/^[0-9a-f]{64}$/u.test(value)) throw new TypeError(`${label}: expected a lowercase hex SHA-256`);
1538
+ return value;
1539
+ }
1540
+ function parseQuery(value) {
1541
+ if (typeof value !== "string" || value.length > 256) throw new TypeError(`${REQUEST_LABEL}: query must be a string of at most 256 characters`);
1542
+ return value;
1543
+ }
1544
+ /** Validate one exact wire request and return a detached copy. */
1545
+ function parseHistorySearchRequest(value) {
1546
+ const record = recordOf(value, REQUEST_LABEL);
1547
+ if (typeof record.scope !== "string" || !SCOPES.includes(record.scope)) throw new TypeError(`${REQUEST_LABEL}: scope must be one of ${SCOPES.join("|")}`);
1548
+ const scope = record.scope;
1549
+ const query = parseQuery(record.query);
1550
+ const limit = boundedInteger(record.limit, 1, 25, `${REQUEST_LABEL} limit`);
1551
+ const cursor = record.cursor === void 0 ? void 0 : nonEmptyString(record.cursor, `${REQUEST_LABEL} cursor`);
1552
+ if (cursor !== void 0 && Buffer.byteLength(cursor, "utf8") > 2048) throw new TypeError(`${REQUEST_LABEL}: cursor exceeds ${HISTORY_SEARCH_CURSOR_MAX_BYTES} bytes`);
1553
+ if (scope === "session") {
1554
+ exactKeys(record, [
1555
+ "scope",
1556
+ "sessionId",
1557
+ "query",
1558
+ "limit",
1559
+ "cursor"
1560
+ ], REQUEST_LABEL);
1561
+ return {
1562
+ scope,
1563
+ sessionId: nonEmptyString(record.sessionId, `${REQUEST_LABEL} sessionId`),
1564
+ query,
1565
+ limit,
1566
+ ...cursor === void 0 ? {} : { cursor }
1567
+ };
1568
+ }
1569
+ if (scope === "directory") {
1570
+ exactKeys(record, [
1571
+ "scope",
1572
+ "cwd",
1573
+ "query",
1574
+ "limit",
1575
+ "cursor"
1576
+ ], REQUEST_LABEL);
1577
+ const cwd = nonEmptyString(record.cwd, `${REQUEST_LABEL} cwd`);
1578
+ if (!isAbsolute(cwd)) throw new TypeError(`${REQUEST_LABEL}: cwd must be an absolute Host path`);
1579
+ if (cwd.includes("\0")) throw new TypeError(`${REQUEST_LABEL}: cwd must not contain NUL`);
1580
+ return {
1581
+ scope,
1582
+ cwd,
1583
+ query,
1584
+ limit,
1585
+ ...cursor === void 0 ? {} : { cursor }
1586
+ };
1587
+ }
1588
+ exactKeys(record, [
1589
+ "scope",
1590
+ "query",
1591
+ "limit",
1592
+ "cursor"
1593
+ ], REQUEST_LABEL);
1594
+ return {
1595
+ scope,
1596
+ query,
1597
+ limit,
1598
+ ...cursor === void 0 ? {} : { cursor }
1599
+ };
1600
+ }
1601
+ /** Validate one exact readText request and return a detached copy. */
1602
+ function parseHistoryReadTextRequest(value) {
1603
+ const record = recordOf(value, READ_REQUEST_LABEL);
1604
+ exactKeys(record, [
1605
+ "sessionId",
1606
+ "messageId",
1607
+ "contentSha256",
1608
+ "offset",
1609
+ "limit"
1610
+ ], READ_REQUEST_LABEL);
1611
+ requiredKeys(record, [
1612
+ "sessionId",
1613
+ "messageId",
1614
+ "contentSha256",
1615
+ "offset",
1616
+ "limit"
1617
+ ], READ_REQUEST_LABEL);
1618
+ return {
1619
+ sessionId: nonEmptyString(record.sessionId, `${READ_REQUEST_LABEL} sessionId`),
1620
+ messageId: nonEmptyString(record.messageId, `${READ_REQUEST_LABEL} messageId`),
1621
+ contentSha256: parseContentSha256(record.contentSha256, `${READ_REQUEST_LABEL} contentSha256`),
1622
+ offset: nonNegativeInteger(record.offset, `${READ_REQUEST_LABEL} offset`),
1623
+ limit: boundedInteger(record.limit, 1, HISTORY_SEARCH_READ_TEXT_LIMIT_MAX, `${READ_REQUEST_LABEL} limit`)
1624
+ };
1625
+ }
1626
+ /** Validate and detach one result item. */
1627
+ function parseHistorySearchItem(value) {
1628
+ const record = recordOf(value, ITEM_LABEL);
1629
+ const keys = [
1630
+ "sessionId",
1631
+ "messageId",
1632
+ "firstEventSeq",
1633
+ "acceptedAt",
1634
+ "effectiveCwd",
1635
+ "preview",
1636
+ "contentLength",
1637
+ "contentSha256",
1638
+ "hasNonText"
1639
+ ];
1640
+ exactKeys(record, keys, ITEM_LABEL);
1641
+ requiredKeys(record, keys, ITEM_LABEL);
1642
+ if (typeof record.preview !== "string" || record.preview.length > 4096) throw new TypeError(`${ITEM_LABEL}: preview must be a string of at most ${HISTORY_SEARCH_PREVIEW_MAX_CHARS} characters`);
1643
+ if (record.effectiveCwd !== null && typeof record.effectiveCwd !== "string") throw new TypeError(`${ITEM_LABEL}: effectiveCwd must be a string or null`);
1644
+ if (typeof record.hasNonText !== "boolean") throw new TypeError(`${ITEM_LABEL}: hasNonText must be a boolean`);
1645
+ return {
1646
+ sessionId: nonEmptyString(record.sessionId, `${ITEM_LABEL} sessionId`),
1647
+ messageId: nonEmptyString(record.messageId, `${ITEM_LABEL} messageId`),
1648
+ firstEventSeq: nonNegativeInteger(record.firstEventSeq, `${ITEM_LABEL} firstEventSeq`),
1649
+ acceptedAt: nonNegativeInteger(record.acceptedAt, `${ITEM_LABEL} acceptedAt`),
1650
+ effectiveCwd: record.effectiveCwd,
1651
+ preview: record.preview,
1652
+ contentLength: nonNegativeInteger(record.contentLength, `${ITEM_LABEL} contentLength`),
1653
+ contentSha256: parseContentSha256(record.contentSha256, `${ITEM_LABEL} contentSha256`),
1654
+ hasNonText: record.hasNonText
1655
+ };
1656
+ }
1657
+ /** Validate and detach the closed search answer union. */
1658
+ function parseHistorySearchResponse(value) {
1659
+ const record = recordOf(value, ANSWER_LABEL);
1660
+ if (record.kind === "ready") {
1661
+ exactKeys(record, [
1662
+ "kind",
1663
+ "generation",
1664
+ "items",
1665
+ "nextCursor"
1666
+ ], ANSWER_LABEL);
1667
+ if (!Array.isArray(record.items)) throw new TypeError(`${ANSWER_LABEL}: items must be an array`);
1668
+ if (record.nextCursor !== null && typeof record.nextCursor !== "string") throw new TypeError(`${ANSWER_LABEL}: nextCursor must be a string or null`);
1669
+ if (typeof record.nextCursor === "string" && Buffer.byteLength(record.nextCursor, "utf8") > 2048) throw new TypeError(`${ANSWER_LABEL}: nextCursor exceeds ${HISTORY_SEARCH_CURSOR_MAX_BYTES} bytes`);
1670
+ return {
1671
+ kind: "ready",
1672
+ generation: nonEmptyString(record.generation, `${ANSWER_LABEL} generation`),
1673
+ items: record.items.map(parseHistorySearchItem),
1674
+ nextCursor: record.nextCursor
1675
+ };
1676
+ }
1677
+ if (record.kind === "partial") {
1678
+ exactKeys(record, [
1679
+ "kind",
1680
+ "items",
1681
+ "progress"
1682
+ ], ANSWER_LABEL);
1683
+ requiredKeys(record, [
1684
+ "kind",
1685
+ "items",
1686
+ "progress"
1687
+ ], ANSWER_LABEL);
1688
+ if (!Array.isArray(record.items)) throw new TypeError(`${ANSWER_LABEL}: items must be an array`);
1689
+ const progress = recordOf(record.progress, `${ANSWER_LABEL} progress`);
1690
+ exactKeys(progress, ["settled", "total"], `${ANSWER_LABEL} progress`);
1691
+ requiredKeys(progress, ["settled", "total"], `${ANSWER_LABEL} progress`);
1692
+ const settled = nonNegativeInteger(progress.settled, `${ANSWER_LABEL} progress settled`);
1693
+ const total = nonNegativeInteger(progress.total, `${ANSWER_LABEL} progress total`);
1694
+ if (total < 1 || settled < 1 || settled > total) throw new TypeError(`${ANSWER_LABEL}: progress must satisfy 1 <= settled <= total`);
1695
+ return {
1696
+ kind: "partial",
1697
+ items: record.items.map(parseHistorySearchItem),
1698
+ progress: {
1699
+ settled,
1700
+ total
1701
+ }
1702
+ };
1703
+ }
1704
+ if (record.kind === "loading") {
1705
+ exactKeys(record, ["kind"], ANSWER_LABEL);
1706
+ return { kind: "loading" };
1707
+ }
1708
+ if (record.kind === "incomplete") {
1709
+ exactKeys(record, ["kind", "reason"], ANSWER_LABEL);
1710
+ if (!INCOMPLETE_REASONS.includes(record.reason)) throw new TypeError(`${ANSWER_LABEL}: unknown incomplete reason ${JSON.stringify(record.reason)}`);
1711
+ return {
1712
+ kind: "incomplete",
1713
+ reason: record.reason
1714
+ };
1715
+ }
1716
+ if (record.kind === "unavailable") {
1717
+ exactKeys(record, ["kind", "reason"], ANSWER_LABEL);
1718
+ if (!UNAVAILABLE_REASONS.includes(record.reason)) throw new TypeError(`${ANSWER_LABEL}: unknown unavailable reason ${JSON.stringify(record.reason)}`);
1719
+ return {
1720
+ kind: "unavailable",
1721
+ reason: record.reason
1722
+ };
1723
+ }
1724
+ if (record.kind === "stale") {
1725
+ exactKeys(record, ["kind", "reason"], ANSWER_LABEL);
1726
+ if (record.reason !== "cursor-stale") throw new TypeError(`${ANSWER_LABEL}: unknown stale reason ${JSON.stringify(record.reason)}`);
1727
+ return {
1728
+ kind: "stale",
1729
+ reason: "cursor-stale"
1730
+ };
1731
+ }
1732
+ throw new TypeError(`${ANSWER_LABEL}: unknown kind ${JSON.stringify(record.kind)}`);
1733
+ }
1734
+ /** Validate and detach the closed readText answer union. */
1735
+ function parseHistoryReadTextResponse(value) {
1736
+ const record = recordOf(value, READ_ANSWER_LABEL);
1737
+ if (record.kind === "ready") {
1738
+ exactKeys(record, [
1739
+ "kind",
1740
+ "chunk",
1741
+ "nextOffset",
1742
+ "contentLength"
1743
+ ], READ_ANSWER_LABEL);
1744
+ if (typeof record.chunk !== "string") throw new TypeError(`${READ_ANSWER_LABEL}: chunk must be a string`);
1745
+ if (record.chunk.length > 16385) throw new TypeError(`${READ_ANSWER_LABEL}: chunk exceeds ${HISTORY_SEARCH_READ_TEXT_LIMIT_MAX + 1} UTF-16 code units`);
1746
+ if (record.chunk.length === 16385) {
1747
+ const high = record.chunk.charCodeAt(HISTORY_SEARCH_READ_TEXT_LIMIT_MAX - 1);
1748
+ const low = record.chunk.charCodeAt(HISTORY_SEARCH_READ_TEXT_LIMIT_MAX);
1749
+ if (!(high >= 55296 && high <= 56319 && low >= 56320 && low <= 57343)) throw new TypeError(`${READ_ANSWER_LABEL}: a chunk over ${HISTORY_SEARCH_READ_TEXT_LIMIT_MAX} code units must end with one complete surrogate pair`);
1750
+ }
1751
+ if (record.nextOffset !== null) nonNegativeInteger(record.nextOffset, `${READ_ANSWER_LABEL} nextOffset`);
1752
+ return {
1753
+ kind: "ready",
1754
+ chunk: record.chunk,
1755
+ nextOffset: record.nextOffset,
1756
+ contentLength: nonNegativeInteger(record.contentLength, `${READ_ANSWER_LABEL} contentLength`)
1757
+ };
1758
+ }
1759
+ if (record.kind === "loading") {
1760
+ exactKeys(record, ["kind"], READ_ANSWER_LABEL);
1761
+ return { kind: "loading" };
1762
+ }
1763
+ if (record.kind === "incomplete") {
1764
+ exactKeys(record, ["kind", "reason"], READ_ANSWER_LABEL);
1765
+ if (!INCOMPLETE_REASONS.includes(record.reason)) throw new TypeError(`${READ_ANSWER_LABEL}: unknown incomplete reason ${JSON.stringify(record.reason)}`);
1766
+ return {
1767
+ kind: "incomplete",
1768
+ reason: record.reason
1769
+ };
1770
+ }
1771
+ if (record.kind === "unavailable") {
1772
+ exactKeys(record, ["kind", "reason"], READ_ANSWER_LABEL);
1773
+ if (!READ_UNAVAILABLE_REASONS.includes(record.reason)) throw new TypeError(`${READ_ANSWER_LABEL}: unknown unavailable reason ${JSON.stringify(record.reason)}`);
1774
+ return {
1775
+ kind: "unavailable",
1776
+ reason: record.reason
1777
+ };
1778
+ }
1779
+ throw new TypeError(`${READ_ANSWER_LABEL}: unknown kind ${JSON.stringify(record.kind)}`);
1780
+ }
1781
+ /**
1782
+ * Validate one exact session-scoped recall request and return a detached copy.
1783
+ */
1784
+ function parseHistorySessionRecallRequest(value) {
1785
+ const record = recordOf(value, RECALL_REQUEST_LABEL);
1786
+ exactKeys(record, ["sessionId"], RECALL_REQUEST_LABEL);
1787
+ requiredKeys(record, ["sessionId"], RECALL_REQUEST_LABEL);
1788
+ return { sessionId: nonEmptyString(record.sessionId, `${RECALL_REQUEST_LABEL} sessionId`) };
1789
+ }
1790
+ /** Validate one recalled occurrence and return a detached copy. */
1791
+ function parseHistorySessionRecallItem(value) {
1792
+ const record = recordOf(value, RECALL_ITEM_LABEL);
1793
+ exactKeys(record, [
1794
+ "messageId",
1795
+ "rpcId",
1796
+ "firstEventSeq",
1797
+ "text"
1798
+ ], RECALL_ITEM_LABEL);
1799
+ requiredKeys(record, [
1800
+ "messageId",
1801
+ "firstEventSeq",
1802
+ "text"
1803
+ ], RECALL_ITEM_LABEL);
1804
+ if (typeof record.text !== "string" || record.text.length === 0 || record.text.length > 65536) throw new TypeError(`${RECALL_ITEM_LABEL}: text must be a non-empty string of at most ${HISTORY_SESSION_RECALL_MAX_TEXT_CHARS} characters (the response envelope owns the actual fit)`);
1805
+ const rpcId = record.rpcId === void 0 ? void 0 : nonEmptyString(record.rpcId, `${RECALL_ITEM_LABEL} rpcId`);
1806
+ if (rpcId !== void 0 && rpcId.length > 256) throw new TypeError(`${RECALL_ITEM_LABEL}: rpcId exceeds 256 characters`);
1807
+ return {
1808
+ messageId: nonEmptyString(record.messageId, `${RECALL_ITEM_LABEL} messageId`),
1809
+ ...rpcId === void 0 ? {} : { rpcId },
1810
+ firstEventSeq: nonNegativeInteger(record.firstEventSeq, `${RECALL_ITEM_LABEL} firstEventSeq`),
1811
+ text: record.text
1812
+ };
1813
+ }
1814
+ /**
1815
+ * Validate and detach the closed session-recall answer union. The WHOLE
1816
+ * serialized answer must stay within the fixed UTF-8 byte budget, so the
1817
+ * budget is enforced on the actual response envelope, not on a per-field
1818
+ * estimate.
1819
+ */
1820
+ function parseHistorySessionRecallResponse(value) {
1821
+ if (Buffer.byteLength(JSON.stringify(value), "utf8") > 65536) throw new TypeError(`${RECALL_ANSWER_LABEL}: the answer exceeds ${HISTORY_SESSION_RECALL_MAX_BYTES} bytes`);
1822
+ const record = recordOf(value, RECALL_ANSWER_LABEL);
1823
+ if (record.kind === "ready") {
1824
+ exactKeys(record, [
1825
+ "kind",
1826
+ "sessionId",
1827
+ "items"
1828
+ ], RECALL_ANSWER_LABEL);
1829
+ requiredKeys(record, [
1830
+ "kind",
1831
+ "sessionId",
1832
+ "items"
1833
+ ], RECALL_ANSWER_LABEL);
1834
+ if (!Array.isArray(record.items) || record.items.length > 100) throw new TypeError(`${RECALL_ANSWER_LABEL}: items must be an array of at most 100 rows`);
1835
+ return {
1836
+ kind: "ready",
1837
+ sessionId: nonEmptyString(record.sessionId, `${RECALL_ANSWER_LABEL} sessionId`),
1838
+ items: record.items.map(parseHistorySessionRecallItem)
1839
+ };
1840
+ }
1841
+ if (record.kind === "loading") {
1842
+ exactKeys(record, ["kind"], RECALL_ANSWER_LABEL);
1843
+ return { kind: "loading" };
1844
+ }
1845
+ if (record.kind === "incomplete") {
1846
+ exactKeys(record, ["kind", "reason"], RECALL_ANSWER_LABEL);
1847
+ if (!INCOMPLETE_REASONS.includes(record.reason)) throw new TypeError(`${RECALL_ANSWER_LABEL}: unknown incomplete reason ${JSON.stringify(record.reason)}`);
1848
+ return {
1849
+ kind: "incomplete",
1850
+ reason: record.reason
1851
+ };
1852
+ }
1853
+ if (record.kind === "unavailable") {
1854
+ exactKeys(record, ["kind", "reason"], RECALL_ANSWER_LABEL);
1855
+ if (!UNAVAILABLE_REASONS.includes(record.reason)) throw new TypeError(`${RECALL_ANSWER_LABEL}: unknown unavailable reason ${JSON.stringify(record.reason)}`);
1856
+ return {
1857
+ kind: "unavailable",
1858
+ reason: record.reason
1859
+ };
1860
+ }
1861
+ throw new TypeError(`${RECALL_ANSWER_LABEL}: unknown kind ${JSON.stringify(record.kind)}`);
1862
+ }
1863
+ /** Validate one exact blank-Session directory request; normalization is Host-only. */
1864
+ function parseHistoryBlankDirectoryRecallRequest(value) {
1865
+ const record = recordOf(value, BLANK_REQUEST_LABEL);
1866
+ exactKeys(record, ["sessionId", "cwd"], BLANK_REQUEST_LABEL);
1867
+ requiredKeys(record, ["sessionId", "cwd"], BLANK_REQUEST_LABEL);
1868
+ const cwd = nonEmptyString(record.cwd, `${BLANK_REQUEST_LABEL} cwd`);
1869
+ if (!isAbsolute(cwd)) throw new TypeError(`${BLANK_REQUEST_LABEL}: cwd must be an absolute Host path`);
1870
+ if (cwd.includes("\0")) throw new TypeError(`${BLANK_REQUEST_LABEL}: cwd must not contain NUL`);
1871
+ return {
1872
+ sessionId: nonEmptyString(record.sessionId, `${BLANK_REQUEST_LABEL} sessionId`),
1873
+ cwd
1874
+ };
1875
+ }
1876
+ /** Validate one borrowed occurrence and retain its original Session identity. */
1877
+ function parseHistoryBlankDirectoryRecallItem(value) {
1878
+ const record = recordOf(value, BLANK_ITEM_LABEL);
1879
+ exactKeys(record, [
1880
+ "sessionId",
1881
+ "messageId",
1882
+ "firstEventSeq",
1883
+ "text"
1884
+ ], BLANK_ITEM_LABEL);
1885
+ requiredKeys(record, [
1886
+ "sessionId",
1887
+ "messageId",
1888
+ "firstEventSeq",
1889
+ "text"
1890
+ ], BLANK_ITEM_LABEL);
1891
+ if (typeof record.text !== "string" || record.text.length === 0 || record.text.length > 65536) throw new TypeError(`${BLANK_ITEM_LABEL}: text must be a non-empty string of at most ${HISTORY_SESSION_RECALL_MAX_TEXT_CHARS} characters (the response envelope owns the actual fit)`);
1892
+ return {
1893
+ sessionId: nonEmptyString(record.sessionId, `${BLANK_ITEM_LABEL} sessionId`),
1894
+ messageId: nonEmptyString(record.messageId, `${BLANK_ITEM_LABEL} messageId`),
1895
+ firstEventSeq: nonNegativeInteger(record.firstEventSeq, `${BLANK_ITEM_LABEL} firstEventSeq`),
1896
+ text: record.text
1897
+ };
1898
+ }
1899
+ /** Validate the closed blank-directory answer under the same actual byte budget. */
1900
+ function parseHistoryBlankDirectoryRecallResponse(value) {
1901
+ if (Buffer.byteLength(JSON.stringify(value), "utf8") > 65536) throw new TypeError(`${BLANK_ANSWER_LABEL}: the answer exceeds ${HISTORY_SESSION_RECALL_MAX_BYTES} bytes`);
1902
+ const record = recordOf(value, BLANK_ANSWER_LABEL);
1903
+ if (record.kind === "ready") {
1904
+ exactKeys(record, [
1905
+ "kind",
1906
+ "sessionId",
1907
+ "cwd",
1908
+ "items"
1909
+ ], BLANK_ANSWER_LABEL);
1910
+ requiredKeys(record, [
1911
+ "kind",
1912
+ "sessionId",
1913
+ "cwd",
1914
+ "items"
1915
+ ], BLANK_ANSWER_LABEL);
1916
+ const cwd = nonEmptyString(record.cwd, `${BLANK_ANSWER_LABEL} cwd`);
1917
+ if (!isAbsolute(cwd)) throw new TypeError(`${BLANK_ANSWER_LABEL}: cwd must be an absolute Host path`);
1918
+ if (cwd.includes("\0")) throw new TypeError(`${BLANK_ANSWER_LABEL}: cwd must not contain NUL`);
1919
+ if (!Array.isArray(record.items) || record.items.length > 100) throw new TypeError(`${BLANK_ANSWER_LABEL}: items must be an array of at most 100 rows`);
1920
+ return {
1921
+ kind: "ready",
1922
+ sessionId: nonEmptyString(record.sessionId, `${BLANK_ANSWER_LABEL} sessionId`),
1923
+ cwd,
1924
+ items: record.items.map(parseHistoryBlankDirectoryRecallItem)
1925
+ };
1926
+ }
1927
+ if (record.kind === "not-eligible") {
1928
+ exactKeys(record, ["kind"], BLANK_ANSWER_LABEL);
1929
+ return { kind: "not-eligible" };
1930
+ }
1931
+ if (record.kind === "loading") {
1932
+ exactKeys(record, ["kind"], BLANK_ANSWER_LABEL);
1933
+ return { kind: "loading" };
1934
+ }
1935
+ if (record.kind === "incomplete") {
1936
+ exactKeys(record, ["kind", "reason"], BLANK_ANSWER_LABEL);
1937
+ if (!INCOMPLETE_REASONS.includes(record.reason)) throw new TypeError(`${BLANK_ANSWER_LABEL}: unknown incomplete reason ${JSON.stringify(record.reason)}`);
1938
+ return {
1939
+ kind: "incomplete",
1940
+ reason: record.reason
1941
+ };
1942
+ }
1943
+ if (record.kind === "unavailable") {
1944
+ exactKeys(record, ["kind", "reason"], BLANK_ANSWER_LABEL);
1945
+ if (!UNAVAILABLE_REASONS.includes(record.reason)) throw new TypeError(`${BLANK_ANSWER_LABEL}: unknown unavailable reason ${JSON.stringify(record.reason)}`);
1946
+ return {
1947
+ kind: "unavailable",
1948
+ reason: record.reason
1949
+ };
1950
+ }
1951
+ throw new TypeError(`${BLANK_ANSWER_LABEL}: unknown kind ${JSON.stringify(record.kind)}`);
1952
+ }
1414
1953
  /** The explicit Client contribution mounted once with `ctx.remote.$mount`. */
1415
1954
  const PI_TUI_CLIENT_CONTRIBUTION = {
1416
1955
  package: "@xmoon76/dsh-pi-tui",
@@ -1437,56 +1976,108 @@ const PI_TUI_CLIENT_CONTRIBUTION = {
1437
1976
  PI_TUI_SESSION_POLICY_READ,
1438
1977
  PI_TUI_SESSION_POLICY_SET_APPROVAL,
1439
1978
  PI_TUI_DEFAULT_MODEL_SAVE_SELECTION,
1979
+ PI_TUI_PROMPT_PRESENCE_SYNC_VIEW,
1980
+ {
1981
+ id: PI_TUI_HISTORY_SEARCH_SEARCH_ENDPOINT,
1982
+ service: PI_TUI_HISTORY_SEARCH_NAMESPACE,
1983
+ namespace: PI_TUI_HISTORY_SEARCH_NAMESPACE,
1984
+ method: "search",
1985
+ invocation: { kind: "direct" },
1986
+ parameters: [{
1987
+ name: "request",
1988
+ wire: "request",
1989
+ source: "json",
1990
+ codec: {
1991
+ mode: "strict",
1992
+ typeSymbol: `${PI_TUI_HISTORY_SEARCH_SEARCH_ENDPOINT}:request`,
1993
+ create: () => ({ parse: parseHistorySearchRequest }),
1994
+ decode: parseHistorySearchRequest
1995
+ }
1996
+ }],
1997
+ cancellation: { parameter: "signal" },
1998
+ result: {
1999
+ mode: "strict",
2000
+ typeSymbol: `${PI_TUI_HISTORY_SEARCH_SEARCH_ENDPOINT}:result`,
2001
+ create: () => ({ parse: parseHistorySearchResponse }),
2002
+ decode: parseHistorySearchResponse
2003
+ }
2004
+ },
2005
+ {
2006
+ id: PI_TUI_HISTORY_SEARCH_READ_TEXT_ENDPOINT,
2007
+ service: PI_TUI_HISTORY_SEARCH_NAMESPACE,
2008
+ namespace: PI_TUI_HISTORY_SEARCH_NAMESPACE,
2009
+ method: "readText",
2010
+ invocation: { kind: "direct" },
2011
+ parameters: [{
2012
+ name: "request",
2013
+ wire: "request",
2014
+ source: "json",
2015
+ codec: {
2016
+ mode: "strict",
2017
+ typeSymbol: `${PI_TUI_HISTORY_SEARCH_READ_TEXT_ENDPOINT}:request`,
2018
+ create: () => ({ parse: parseHistoryReadTextRequest }),
2019
+ decode: parseHistoryReadTextRequest
2020
+ }
2021
+ }],
2022
+ cancellation: { parameter: "signal" },
2023
+ result: {
2024
+ mode: "strict",
2025
+ typeSymbol: `${PI_TUI_HISTORY_SEARCH_READ_TEXT_ENDPOINT}:result`,
2026
+ create: () => ({ parse: parseHistoryReadTextResponse }),
2027
+ decode: parseHistoryReadTextResponse
2028
+ }
2029
+ },
2030
+ {
2031
+ id: PI_TUI_HISTORY_SEARCH_SESSION_RECALL_ENDPOINT,
2032
+ service: PI_TUI_HISTORY_SEARCH_NAMESPACE,
2033
+ namespace: PI_TUI_HISTORY_SEARCH_NAMESPACE,
2034
+ method: "readSessionRecall",
2035
+ invocation: { kind: "direct" },
2036
+ parameters: [{
2037
+ name: "request",
2038
+ wire: "request",
2039
+ source: "json",
2040
+ codec: {
2041
+ mode: "strict",
2042
+ typeSymbol: `${PI_TUI_HISTORY_SEARCH_SESSION_RECALL_ENDPOINT}:request`,
2043
+ create: () => ({ parse: parseHistorySessionRecallRequest }),
2044
+ decode: parseHistorySessionRecallRequest
2045
+ }
2046
+ }],
2047
+ cancellation: { parameter: "signal" },
2048
+ result: {
2049
+ mode: "strict",
2050
+ typeSymbol: `${PI_TUI_HISTORY_SEARCH_SESSION_RECALL_ENDPOINT}:result`,
2051
+ create: () => ({ parse: parseHistorySessionRecallResponse }),
2052
+ decode: parseHistorySessionRecallResponse
2053
+ }
2054
+ },
1440
2055
  {
1441
- id: PI_TUI_PROMPT_PRESENCE_SYNC_VIEW_ENDPOINT,
1442
- service: PI_TUI_PROMPT_PRESENCE_NAMESPACE,
1443
- namespace: PI_TUI_PROMPT_PRESENCE_NAMESPACE,
1444
- method: "syncView",
2056
+ id: PI_TUI_HISTORY_SEARCH_BLANK_DIRECTORY_RECALL_ENDPOINT,
2057
+ service: PI_TUI_HISTORY_SEARCH_NAMESPACE,
2058
+ namespace: PI_TUI_HISTORY_SEARCH_NAMESPACE,
2059
+ method: "readBlankDirectoryRecall",
1445
2060
  invocation: { kind: "direct" },
1446
- parameters: [
1447
- {
1448
- name: "viewedSessionId",
1449
- wire: "viewedSessionId",
1450
- source: "json",
1451
- codec: {
1452
- mode: "strict",
1453
- typeSymbol: `${PI_TUI_PROMPT_PRESENCE_SYNC_VIEW_ENDPOINT}:viewedSessionId`,
1454
- create: () => ({ parse: parsePresenceViewedSessionId }),
1455
- decode: parsePresenceViewedSessionId
1456
- }
1457
- },
1458
- {
1459
- name: "displayPreset",
1460
- wire: "displayPreset",
1461
- source: "json",
1462
- codec: {
1463
- mode: "strict",
1464
- typeSymbol: `${PI_TUI_PROMPT_PRESENCE_SYNC_VIEW_ENDPOINT}:displayPreset`,
1465
- create: () => ({ parse: parsePresenceDisplayPreset }),
1466
- decode: parsePresenceDisplayPreset
1467
- }
1468
- },
1469
- {
1470
- name: "revision",
1471
- wire: "revision",
1472
- source: "json",
1473
- codec: {
1474
- mode: "strict",
1475
- typeSymbol: `${PI_TUI_PROMPT_PRESENCE_SYNC_VIEW_ENDPOINT}:revision`,
1476
- create: () => ({ parse: parsePresenceRevision }),
1477
- decode: parsePresenceRevision
1478
- }
2061
+ parameters: [{
2062
+ name: "request",
2063
+ wire: "request",
2064
+ source: "json",
2065
+ codec: {
2066
+ mode: "strict",
2067
+ typeSymbol: `${PI_TUI_HISTORY_SEARCH_BLANK_DIRECTORY_RECALL_ENDPOINT}:request`,
2068
+ create: () => ({ parse: parseHistoryBlankDirectoryRecallRequest }),
2069
+ decode: parseHistoryBlankDirectoryRecallRequest
1479
2070
  }
1480
- ],
2071
+ }],
1481
2072
  cancellation: { parameter: "signal" },
1482
2073
  result: {
1483
2074
  mode: "strict",
1484
- typeSymbol: `${PI_TUI_PROMPT_PRESENCE_SYNC_VIEW_ENDPOINT}:result`,
1485
- create: () => ({ parse: parsePresenceSyncResult }),
1486
- decode: parsePresenceSyncResult
2075
+ typeSymbol: `${PI_TUI_HISTORY_SEARCH_BLANK_DIRECTORY_RECALL_ENDPOINT}:result`,
2076
+ create: () => ({ parse: parseHistoryBlankDirectoryRecallResponse }),
2077
+ decode: parseHistoryBlankDirectoryRecallResponse
1487
2078
  }
1488
2079
  }
1489
2080
  ]
1490
2081
  };
1491
2082
  //#endregion
1492
- export { PI_TUI_SKILLS_NAMESPACE as a, PI_TUI_CREDENTIAL_RECORDS_NAMESPACE as c, PI_TUI_AUTHORIZATION_NAMESPACE as d, parsePiTuiAuthorizationFrame as f, PI_TUI_FILE_REFERENCES_NAMESPACE as i, parsePiTuiCredentialRecordKey as l, PI_TUI_DEFAULT_MODEL_NAMESPACE as n, parsePiTuiSkillsInvalidationFrame as o, parsePiTuiAuthorizationTargetsSnapshot as p, PI_TUI_SESSION_POLICY_NAMESPACE as r, parseHostShellCompletionOutcome as s, PI_TUI_CLIENT_CONTRIBUTION as t, parsePiTuiCredentialRecordList as u };
2083
+ export { parsePiTuiAuthorizationTargetsSnapshot as _, parseHistorySessionRecallRequest as a, PI_TUI_FILE_REFERENCES_NAMESPACE as c, parseHostShellCompletionOutcome as d, PI_TUI_CREDENTIAL_RECORDS_NAMESPACE as f, parsePiTuiAuthorizationFrame as g, PI_TUI_AUTHORIZATION_NAMESPACE as h, parseHistorySearchRequest as i, PI_TUI_SKILLS_NAMESPACE as l, parsePiTuiCredentialRecordList as m, parseHistoryBlankDirectoryRecallRequest as n, PI_TUI_DEFAULT_MODEL_NAMESPACE as o, parsePiTuiCredentialRecordKey as p, parseHistoryReadTextRequest as r, PI_TUI_SESSION_POLICY_NAMESPACE as s, PI_TUI_CLIENT_CONTRIBUTION as t, parsePiTuiSkillsInvalidationFrame as u };