@xmoon76/dsh-pi-tui 0.5.4 → 0.5.6

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 (50) hide show
  1. package/README.en.md +46 -42
  2. package/README.md +46 -27
  3. package/cordis.patch.yml +77 -7
  4. package/dist/bootstrap-DQ4YPL-7.mjs +113583 -0
  5. package/dist/builtins.mjs +3 -9
  6. package/dist/{runtime-vc4mdr-R.mjs → client-bootstrap-Cr1JCaF5.mjs} +3670 -2277
  7. package/dist/disposal-BYBbEpVY.mjs +54 -0
  8. package/dist/dist-CIsR7cz4.mjs +15717 -0
  9. package/dist/{entry-control-DvSrndWd.mjs → entry-control-DnduyDiw.mjs} +12 -31
  10. package/dist/{extensions-CcuMY4n2.mjs → extensions-Bp0L37lP.mjs} +1239 -271
  11. package/dist/extensions.mjs +1 -1
  12. package/dist/host-bootstrap-DilsvA6f.mjs +281 -0
  13. package/dist/host-foundation-probe--5jtvHVe.mjs +413 -0
  14. package/dist/host-runtime.d.mts +30 -0
  15. package/dist/host-runtime.mjs +1317 -0
  16. package/dist/index.d.mts +19 -18
  17. package/dist/index.mjs +18410 -8836
  18. package/dist/local-client.mjs +2027 -187
  19. package/dist/local-discovery-C9VMjc0K.mjs +759 -0
  20. package/dist/local-discovery-CDaQHA_R.mjs +2 -0
  21. package/dist/local-host.mjs +1088 -87
  22. package/dist/local-transport-BVwFYq_Y.mjs +513 -0
  23. package/dist/{context-summary-DAisTA_7.mjs → pasted-path-range-CMnxuGPx.mjs} +7613 -216
  24. package/dist/pasted-path-range-r6qzV_tC.mjs +17510 -0
  25. package/dist/performance-host.d.mts +2 -2
  26. package/dist/performance-host.mjs +258 -1
  27. package/dist/pi-tui-remote-contribution-B0EQsP0N.mjs +85 -0
  28. package/dist/pi-tui-terminal-progress-contract-CdBH9j78.mjs +70 -0
  29. package/dist/pi-tui-terminal-progress-contract-MLXZ-i3t.mjs +905 -0
  30. package/dist/pi-tui-web-access-contract-BN8Cc_Ho.mjs +118 -0
  31. package/dist/{runtime-status-0lp9CM0V.mjs → runtime-status-Cj1nFOdS.mjs} +72 -214
  32. package/dist/session-BKGXyh80.mjs +15794 -0
  33. package/dist/{session-tdJHLnJR.mjs → session-CPt_U8_f.mjs} +10707 -3657
  34. package/dist/{startup-JaVZoTIl.mjs → startup-7BYWuvBU.mjs} +124 -8
  35. package/dist/startup.d.mts +1 -1
  36. package/dist/startup.mjs +1 -1
  37. package/dist/{client-bootstrap-F5DHFI9t.mjs → terminal-progress-source-DrqQhtT8.mjs} +3653 -2969
  38. package/dist/visual-tools.d.mts +2 -2
  39. package/dist/visual-tools.mjs +26 -31
  40. package/dist/web-preferences.d.mts +29 -0
  41. package/dist/web-preferences.mjs +15 -0
  42. package/dist/web-roster-CjqnUXNk.mjs +285 -0
  43. package/generated/dsh-presets/cordis.patch.yml +5 -3
  44. package/generated/dsh-presets/ptc.patch.yml +7 -7
  45. package/generated/dsh-presets/standard.patch.yml +6 -4
  46. package/package.json +195 -172
  47. package/dist/host-bootstrap-DAgKknbY.mjs +0 -119
  48. package/dist/performance-host-CcDJjjVA.mjs +0 -266
  49. package/dist/rolldown-runtime-8H4AJuhK.mjs +0 -14
  50. package/dist/terminal-progress-source-xor3vakJ.mjs +0 -2256
@@ -23,8 +23,8 @@ declare const PI_TUI_PERFORMANCE_READY_SERVICE = "piTuiPerformanceReady";
23
23
  * Register the `piTuiPerformance` unit and publish the readiness gate.
24
24
  *
25
25
  * The registry is resolved through the context's reflection layer, the
26
- * documented Host-plane idiom of this repository (`app/remote/host-runtime.ts`
27
- * and `app/remote/pi-tui-file-reference-host.ts` do the same): this module IS
26
+ * documented Host-plane idiom of this repository (`app/host/pi-tui-host-runtime.ts`
27
+ * and `app/host/features/file-reference.ts` do the same): this module IS
28
28
  * the Host plane, so its Host-service read is not Client-side coupling and the
29
29
  * client-boundary inventory stays unchanged. `inject` above is what guarantees
30
30
  * the service is present and active here.
@@ -1,2 +1,259 @@
1
- import { i as name, n as apply, r as inject, t as PI_TUI_PERFORMANCE_READY_SERVICE } from "./performance-host-CcDJjjVA.mjs";
1
+ import { a as firstTokenTimeFromAssistantStream, c as usageFromAssistantSettlement, r as emptyPerformanceView, t as PI_TUI_PERFORMANCE_KEY } from "./performance-view-CfGvLZyD.mjs";
2
+ import { z } from "zod";
3
+ //#region src/app/host/performance-projection.ts
4
+ /**
5
+ * The `piTuiPerformance` Host fold: the ONE statistics state machine for the
6
+ * recent (R5) and Session-lifetime ("All") model-request output rate and for
7
+ * the recent time-to-first-token.
8
+ *
9
+ * The unit is a pure synchronous fold over committed Session events (plan §3.3
10
+ * / §3.4). The official session-projection seam owns the subscription, the
11
+ * per-session cell, the checkpoint cache and the change feed; this module owns
12
+ * only the computation and its plain-JSON state:
13
+ *
14
+ * ```text
15
+ * step/start open the logical step (turn, step, startTime)
16
+ * assistant/attempt fill the step's missing first-token evidence only
17
+ * assistant/message close it ONCE: route epoch, All pair, R5 pair, TTFB sample
18
+ * step/end, turn/end close a step that produced no message (no accounting)
19
+ * ```
20
+ *
21
+ * Every other event returns the SAME state object (zero downstream work), and
22
+ * an internal-only transition that changes nothing observable reuses the
23
+ * previous view object, so the seam publishes no frame for it (plan §3.3).
24
+ *
25
+ * Usage parsing and the observable-first-token predicate are the SHARED
26
+ * transcript facts (`domain/transcript/usage.ts`), never a second parser; the
27
+ * route identity is the message's `(provider, model)` pair, encoded
28
+ * unambiguously.
29
+ *
30
+ * @module @xmoon76/dsh-pi-tui/app/host/performance-projection
31
+ */
32
+ const counterSchema = z.strictObject({
33
+ outputTokens: z.number().nonnegative(),
34
+ modelMs: z.number().nonnegative(),
35
+ samples: z.number().int().nonnegative()
36
+ });
37
+ const recentCounterSchema = z.strictObject({
38
+ outputTokens: z.number().nonnegative(),
39
+ modelMs: z.number().nonnegative(),
40
+ samples: z.number().int().nonnegative(),
41
+ firstTokenMs: z.number().nonnegative(),
42
+ firstTokenSamples: z.number().int().nonnegative()
43
+ });
44
+ const viewSchema = z.strictObject({
45
+ recent: recentCounterSchema,
46
+ all: counterSchema
47
+ });
48
+ const stateSchema = z.strictObject({
49
+ view: viewSchema,
50
+ openStep: z.strictObject({
51
+ turn: z.number().int().nonnegative(),
52
+ step: z.number().int().nonnegative(),
53
+ startTime: z.number().nonnegative(),
54
+ firstTokenTime: z.number().nonnegative().nullable()
55
+ }).nullable(),
56
+ routeKey: z.string().nullable(),
57
+ recentSamples: z.array(z.strictObject({
58
+ outputTokens: z.number().nonnegative(),
59
+ modelMs: z.number().nonnegative()
60
+ })).max(5),
61
+ firstTokenSamples: z.array(z.number().nonnegative()).max(5)
62
+ });
63
+ /** The empty fold state. */
64
+ function emptyPerformanceState() {
65
+ return {
66
+ view: emptyPerformanceView(),
67
+ openStep: null,
68
+ routeKey: null,
69
+ recentSamples: [],
70
+ firstTokenSamples: []
71
+ };
72
+ }
73
+ /** Whether a replacement-surface rewrite (compaction) carries no new evidence. */
74
+ function isReplacementSurface(event) {
75
+ const op = event.surfaceOp;
76
+ return typeof op === "object" && op !== null && op.op === "replace";
77
+ }
78
+ /**
79
+ * The step's `(provider, model)` route identity. Only a message whose source is
80
+ * a model route yields a key — a missing identity never resets the window
81
+ * (fail-soft), it only keeps that step out of the route-scoped rings.
82
+ */
83
+ function performanceRouteKeyOf(message) {
84
+ const source = message.source;
85
+ if (source?.kind !== "model") return void 0;
86
+ if (typeof source.provider !== "string" || typeof source.model !== "string") return void 0;
87
+ return JSON.stringify([source.provider, source.model]);
88
+ }
89
+ /**
90
+ * One eligible TPS pair: a finite positive output count AND a finite positive
91
+ * model wall time. Provider-boundary validation: an invalid, absent,
92
+ * NaN/Infinity or negative value never enters the All counter or an R5 ring.
93
+ */
94
+ function eligibleSample(outputTokens, modelMs) {
95
+ if (outputTokens === void 0 || !Number.isFinite(outputTokens) || outputTokens <= 0) return void 0;
96
+ if (!Number.isFinite(modelMs) || modelMs <= 0) return void 0;
97
+ return {
98
+ outputTokens,
99
+ modelMs
100
+ };
101
+ }
102
+ /** Append to a bounded ring, dropping the oldest entries past the limit. */
103
+ function appendRing(ring, value) {
104
+ const next = [...ring, value];
105
+ return next.length > 5 ? next.slice(next.length - 5) : next;
106
+ }
107
+ /** Whether two published views are numerically identical. */
108
+ function sameView(left, right) {
109
+ return left.recent.outputTokens === right.recent.outputTokens && left.recent.modelMs === right.recent.modelMs && left.recent.samples === right.recent.samples && left.recent.firstTokenMs === right.recent.firstTokenMs && left.recent.firstTokenSamples === right.recent.firstTokenSamples && left.all.outputTokens === right.all.outputTokens && left.all.modelMs === right.all.modelMs && left.all.samples === right.all.samples;
110
+ }
111
+ /**
112
+ * Close ONE step at its `assistant/message` boundary and produce the next
113
+ * state (plan §3.4 rules 4-7, 9, 10):
114
+ *
115
+ * 1. a validly declared route different from the current one clears both
116
+ * route-scoped rings BEFORE this step's samples join (A→B→A included);
117
+ * 2. an eligible pair (`outputTokens > 0`, `modelMs > 0`) joins the All counter
118
+ * always and the R5 ring only for a route-identified step;
119
+ * 3. a completed step with first-token evidence inside
120
+ * `[step/start, assistant/message]` joins the TTFB ring for a
121
+ * route-identified step, independent of `outputTokens`;
122
+ * 4. the view object is recreated only when one of its numbers changed.
123
+ */
124
+ function settleCompletedStep(state, open, eventTime, topLevelUsage, stream, message) {
125
+ const modelMs = eventTime - open.startTime;
126
+ const declaredRouteKey = performanceRouteKeyOf(message);
127
+ let routeKey = state.routeKey;
128
+ let recentSamples = state.recentSamples;
129
+ let firstTokenSamples = state.firstTokenSamples;
130
+ if (declaredRouteKey !== void 0) {
131
+ if (routeKey !== null && routeKey !== declaredRouteKey) {
132
+ recentSamples = [];
133
+ firstTokenSamples = [];
134
+ }
135
+ routeKey = declaredRouteKey;
136
+ }
137
+ const sample = eligibleSample(usageFromAssistantSettlement("message", topLevelUsage, stream)?.outputTokens, modelMs);
138
+ if (sample !== void 0 && declaredRouteKey !== void 0) recentSamples = appendRing(recentSamples, sample);
139
+ const firstTokenTime = open.firstTokenTime ?? firstTokenTimeFromAssistantStream(stream) ?? null;
140
+ if (declaredRouteKey !== void 0 && firstTokenTime !== null) {
141
+ const firstTokenMs = firstTokenTime - open.startTime;
142
+ if (Number.isFinite(firstTokenMs) && firstTokenMs >= 0 && firstTokenMs <= modelMs) firstTokenSamples = appendRing(firstTokenSamples, firstTokenMs);
143
+ }
144
+ const previousAll = state.view.all;
145
+ const all = sample === void 0 ? previousAll : {
146
+ outputTokens: previousAll.outputTokens + sample.outputTokens,
147
+ modelMs: previousAll.modelMs + sample.modelMs,
148
+ samples: previousAll.samples + 1
149
+ };
150
+ const nextView = {
151
+ recent: {
152
+ outputTokens: recentSamples.reduce((sum, pair) => sum + pair.outputTokens, 0),
153
+ modelMs: recentSamples.reduce((sum, pair) => sum + pair.modelMs, 0),
154
+ samples: recentSamples.length,
155
+ firstTokenMs: firstTokenSamples.reduce((sum, value) => sum + value, 0),
156
+ firstTokenSamples: firstTokenSamples.length
157
+ },
158
+ all
159
+ };
160
+ return {
161
+ view: sameView(state.view, nextView) ? state.view : nextView,
162
+ openStep: null,
163
+ routeKey,
164
+ recentSamples,
165
+ firstTokenSamples
166
+ };
167
+ }
168
+ /**
169
+ * The `piTuiPerformance` projection unit. `stateVersion` gates the persisted
170
+ * cache: a row from another fold version is discarded and refolded, never
171
+ * forward-applied into garbage.
172
+ */
173
+ const piTuiPerformanceDefinition = {
174
+ key: PI_TUI_PERFORMANCE_KEY,
175
+ stateVersion: 1,
176
+ stateSchema,
177
+ init: () => emptyPerformanceState(),
178
+ apply: (state, event) => {
179
+ if (isReplacementSurface(event)) return state;
180
+ switch (event.type) {
181
+ case "step/start": return {
182
+ ...state,
183
+ openStep: {
184
+ turn: event.data.turn,
185
+ step: event.data.step,
186
+ startTime: event.time,
187
+ firstTokenTime: null
188
+ }
189
+ };
190
+ case "assistant/attempt": {
191
+ const open = state.openStep;
192
+ if (open === null || open.turn !== event.data.turn || open.step !== event.data.step) return state;
193
+ if (open.firstTokenTime !== null) return state;
194
+ const firstTokenTime = firstTokenTimeFromAssistantStream(event.data.stream);
195
+ if (firstTokenTime === void 0 || !Number.isFinite(firstTokenTime)) return state;
196
+ return {
197
+ ...state,
198
+ openStep: {
199
+ ...open,
200
+ firstTokenTime
201
+ }
202
+ };
203
+ }
204
+ case "assistant/message": {
205
+ const open = state.openStep;
206
+ if (open === null || open.turn !== event.data.turn || open.step !== event.data.step) return state;
207
+ return settleCompletedStep(state, open, event.time, event.data.usage, event.data.stream, event.data.message);
208
+ }
209
+ case "step/end":
210
+ case "turn/end": return state.openStep === null ? state : {
211
+ ...state,
212
+ openStep: null
213
+ };
214
+ default: return state;
215
+ }
216
+ },
217
+ wire: {
218
+ viewSchema,
219
+ view: (state) => state.view
220
+ }
221
+ };
222
+ //#endregion
223
+ //#region src/app/host/performance-host.ts
224
+ /** Stable Cordis plugin name (the Loader row id in `cordis.patch.yml`). */
225
+ const name = "pi-tui-performance-host";
226
+ /** The projection registry is this plugin's whole purpose: without it the fiber stays pending. */
227
+ const inject = ["sessionProjections"];
228
+ /**
229
+ * The readiness gate this row publishes after the unit is registered. It
230
+ * carries NO data — it is not a second performance authority, only the
231
+ * ordering proof that the Host projection exists before the TUI mounts.
232
+ *
233
+ * The key is declared the way this repository declares its OWN Cordis
234
+ * services (`src/startup.ts`'s `TUI_STARTUP_SERVICE`): an exported string
235
+ * constant, consumed by the dependent row's `inject` list in
236
+ * `cordis.patch.yml`. The gate is data-free, so there is no value shape to
237
+ * declare and no `Context` augmentation to add; a consumer that needs to
238
+ * narrow the read does it at its own call site, exactly as the `tuiStartup`
239
+ * consumers do.
240
+ */
241
+ const PI_TUI_PERFORMANCE_READY_SERVICE = "piTuiPerformanceReady";
242
+ /**
243
+ * Register the `piTuiPerformance` unit and publish the readiness gate.
244
+ *
245
+ * The registry is resolved through the context's reflection layer, the
246
+ * documented Host-plane idiom of this repository (`app/host/pi-tui-host-runtime.ts`
247
+ * and `app/host/features/file-reference.ts` do the same): this module IS
248
+ * the Host plane, so its Host-service read is not Client-side coupling and the
249
+ * client-boundary inventory stays unchanged. `inject` above is what guarantees
250
+ * the service is present and active here.
251
+ *
252
+ * @param ctx - the Host context that owns this row's fiber.
253
+ */
254
+ function apply(ctx) {
255
+ ctx.reflect.get("sessionProjections").register(piTuiPerformanceDefinition);
256
+ ctx.provide(PI_TUI_PERFORMANCE_READY_SERVICE, {});
257
+ }
258
+ //#endregion
2
259
  export { PI_TUI_PERFORMANCE_READY_SERVICE, apply, inject, name };
@@ -0,0 +1,85 @@
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
+ import { n as PI_TUI_TERMINAL_PROGRESS_WATCH } from "./pi-tui-terminal-progress-contract-CdBH9j78.mjs";
3
+ //#region src/runtime/remote/pi-tui-file-reference-contract.ts
4
+ /** The wire namespace (and Host Cordis service key) of the augmentation. */
5
+ const PI_TUI_FILE_REFERENCES_NAMESPACE = "piTuiFileReferences";
6
+ /** The private method's stable endpoint identity. */
7
+ const PI_TUI_FILE_REFERENCES_LIST_ENDPOINT = "@xmoon76/dsh-pi-tui#piTuiFileReferences/list";
8
+ /** One strict JSON codec that validates a wire string. */
9
+ function stringCodec(typeSymbol) {
10
+ return {
11
+ mode: "strict",
12
+ typeSymbol,
13
+ create: () => ({ parse: (value) => {
14
+ if (typeof value !== "string") throw new TypeError(`${typeSymbol}: the wire value must be a string`);
15
+ return value;
16
+ } })
17
+ };
18
+ }
19
+ /**
20
+ * Validate and detach one wire `HostFileListResult`. The result is produced by
21
+ * this package's own Host router, but it is still a wire boundary on the Client
22
+ * and the ONLY place the shape crosses.
23
+ */
24
+ function decodeHostFileListResult(value) {
25
+ if (typeof value !== "object" || value === null) throw new TypeError("piTuiFileReferences/list: the result must be an object");
26
+ const record = value;
27
+ if (record.kind === "unavailable") {
28
+ if (typeof record.reason !== "string") throw new TypeError("piTuiFileReferences/list: an unavailable result needs a reason");
29
+ return {
30
+ kind: "unavailable",
31
+ reason: record.reason
32
+ };
33
+ }
34
+ if (record.kind !== "ok" || !Array.isArray(record.items)) throw new TypeError("piTuiFileReferences/list: the result must be ok(items) or unavailable(reason)");
35
+ return {
36
+ kind: "ok",
37
+ items: record.items.map((entry) => {
38
+ if (typeof entry !== "object" || entry === null) throw new TypeError("piTuiFileReferences/list: every candidate must be an object");
39
+ const candidate = entry;
40
+ if (typeof candidate.path !== "string" || candidate.kind !== "file" && candidate.kind !== "directory") throw new TypeError("piTuiFileReferences/list: every candidate needs a string path and a file/directory kind");
41
+ return {
42
+ path: candidate.path,
43
+ kind: candidate.kind
44
+ };
45
+ })
46
+ };
47
+ }
48
+ const HOST_FILE_LIST_RESULT_CODEC = {
49
+ mode: "strict",
50
+ typeSymbol: "@xmoon76/dsh-pi-tui#piTuiFileReferences/list:result",
51
+ create: () => ({ parse: decodeHostFileListResult }),
52
+ decode: decodeHostFileListResult
53
+ };
54
+ /** The explicit Client contribution mounted once with `ctx.remote.$mount`. */
55
+ const PI_TUI_CLIENT_CONTRIBUTION = {
56
+ package: "@xmoon76/dsh-pi-tui",
57
+ descriptors: [
58
+ {
59
+ id: PI_TUI_FILE_REFERENCES_LIST_ENDPOINT,
60
+ service: PI_TUI_FILE_REFERENCES_NAMESPACE,
61
+ namespace: PI_TUI_FILE_REFERENCES_NAMESPACE,
62
+ method: "list",
63
+ invocation: { kind: "direct" },
64
+ parameters: [{
65
+ name: "sessionId",
66
+ wire: "sessionId",
67
+ source: "json",
68
+ codec: stringCodec("@xmoon76/dsh-pi-tui#piTuiFileReferences/list:sessionId")
69
+ }, {
70
+ name: "query",
71
+ wire: "query",
72
+ source: "json",
73
+ codec: stringCodec("@xmoon76/dsh-pi-tui#piTuiFileReferences/list:query")
74
+ }],
75
+ cancellation: { parameter: "signal" },
76
+ result: HOST_FILE_LIST_RESULT_CODEC
77
+ },
78
+ PI_TUI_TERMINAL_PROGRESS_WATCH,
79
+ PI_TUI_WEB_ACCESS_GET_STATUS,
80
+ PI_TUI_WEB_ACCESS_SET_ENABLED,
81
+ PI_TUI_WEB_ACCESS_GET_AUTHENTICATED_URL
82
+ ]
83
+ };
84
+ //#endregion
85
+ export { PI_TUI_FILE_REFERENCES_NAMESPACE as n, PI_TUI_CLIENT_CONTRIBUTION as t };
@@ -0,0 +1,70 @@
1
+ //#region src/runtime/remote/pi-tui-terminal-progress-contract.ts
2
+ /** The wire namespace (and Host Cordis service key) of the private stream. */
3
+ const PI_TUI_TERMINAL_PROGRESS_NAMESPACE = "piTuiTerminalProgress";
4
+ /** The private method's stable endpoint identity. */
5
+ const PI_TUI_TERMINAL_PROGRESS_WATCH_ENDPOINT = "@xmoon76/dsh-pi-tui#piTuiTerminalProgress/watch";
6
+ /** One strict JSON codec that validates a wire string. */
7
+ function stringCodec(typeSymbol) {
8
+ return {
9
+ mode: "strict",
10
+ typeSymbol,
11
+ create: () => ({ parse: (value) => {
12
+ if (typeof value !== "string") throw new TypeError(`${typeSymbol}: the wire value must be a string`);
13
+ return value;
14
+ } })
15
+ };
16
+ }
17
+ /**
18
+ * Validate and detach one `PiTuiTerminalProgressFrame`. This is the ONE
19
+ * structural validator of the frame shape: the descriptor's `result` codec
20
+ * uses it, and the R2 Client source must call it on every downlink item because
21
+ * the framework does not (see the module JSDoc).
22
+ */
23
+ function parsePiTuiTerminalProgressFrame(value) {
24
+ if (typeof value !== "object" || value === null) throw new TypeError("piTuiTerminalProgress/watch: the frame must be an object");
25
+ const frame = value;
26
+ if (frame.kind !== "snapshot" && frame.kind !== "update") throw new TypeError("piTuiTerminalProgress/watch: the frame kind must be snapshot or update");
27
+ if (typeof frame.sessionId !== "string") throw new TypeError("piTuiTerminalProgress/watch: the frame needs a string sessionId");
28
+ if (typeof frame.hostEpoch !== "string") throw new TypeError("piTuiTerminalProgress/watch: the frame needs a string hostEpoch");
29
+ if (typeof frame.agentEpoch !== "number") throw new TypeError("piTuiTerminalProgress/watch: the frame needs a numeric agentEpoch");
30
+ if (typeof frame.revision !== "number") throw new TypeError("piTuiTerminalProgress/watch: the frame needs a numeric revision");
31
+ if (typeof frame.running !== "boolean") throw new TypeError("piTuiTerminalProgress/watch: the frame needs a boolean running");
32
+ if (frame.outcome !== "idle" && frame.outcome !== "done" && frame.outcome !== "error") throw new TypeError("piTuiTerminalProgress/watch: the frame outcome must be idle, done or error");
33
+ return {
34
+ kind: frame.kind,
35
+ sessionId: frame.sessionId,
36
+ hostEpoch: frame.hostEpoch,
37
+ agentEpoch: frame.agentEpoch,
38
+ revision: frame.revision,
39
+ running: frame.running,
40
+ outcome: frame.outcome
41
+ };
42
+ }
43
+ const PI_TUI_TERMINAL_PROGRESS_FRAME_CODEC = {
44
+ mode: "strict",
45
+ typeSymbol: "@xmoon76/dsh-pi-tui#piTuiTerminalProgress/watch:frame",
46
+ create: () => ({ parse: parsePiTuiTerminalProgressFrame }),
47
+ decode: parsePiTuiTerminalProgressFrame
48
+ };
49
+ /**
50
+ * The ONE shared invocation descriptor both contributions derive from. The
51
+ * Host registers this exact object; the Client mounts this exact object.
52
+ */
53
+ const PI_TUI_TERMINAL_PROGRESS_WATCH = {
54
+ id: PI_TUI_TERMINAL_PROGRESS_WATCH_ENDPOINT,
55
+ service: PI_TUI_TERMINAL_PROGRESS_NAMESPACE,
56
+ namespace: PI_TUI_TERMINAL_PROGRESS_NAMESPACE,
57
+ method: "watch",
58
+ mode: "stream",
59
+ invocation: { kind: "direct" },
60
+ parameters: [{
61
+ name: "sessionId",
62
+ wire: "sessionId",
63
+ source: "json",
64
+ codec: stringCodec("@xmoon76/dsh-pi-tui#piTuiTerminalProgress/watch:sessionId")
65
+ }],
66
+ cancellation: { parameter: "signal" },
67
+ result: PI_TUI_TERMINAL_PROGRESS_FRAME_CODEC
68
+ };
69
+ //#endregion
70
+ export { PI_TUI_TERMINAL_PROGRESS_WATCH as n, parsePiTuiTerminalProgressFrame as r, PI_TUI_TERMINAL_PROGRESS_NAMESPACE as t };