priiisk 0.1.14 → 0.1.16

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.
@@ -2,23 +2,55 @@ import { createRequire as __priiiskCreateRequire } from "node:module";
2
2
  const require = __priiiskCreateRequire(import.meta.url);
3
3
  import {
4
4
  CampAskState,
5
- Cause_exports,
6
- Clock_exports,
7
- Context_exports,
8
- Data_exports,
9
- Deferred_exports,
10
- Effect_exports,
11
- Exit_exports,
12
- FiberSet_exports,
13
- Match_exports,
14
- Stream_exports,
15
- SubscriptionRef_exports
16
- } from "./chunk-RIYKIIGA.js";
5
+ Tag,
6
+ TaggedError,
7
+ _await,
8
+ _void,
9
+ acquireRelease,
10
+ addFinalizer2 as addFinalizer,
11
+ as2 as as,
12
+ catchAll,
13
+ catchAllCause2 as catchAllCause,
14
+ currentTimeMillis,
15
+ fail4 as fail,
16
+ flatMap4 as flatMap,
17
+ forEach,
18
+ forever2 as forever,
19
+ forkScoped,
20
+ gen,
21
+ get7 as get,
22
+ ignore,
23
+ isInterruptedOnly,
24
+ isSuccess,
25
+ make11 as make2,
26
+ make13 as make3,
27
+ make7 as make,
28
+ makeRuntime,
29
+ modify2 as modify,
30
+ modifyEffect,
31
+ pretty,
32
+ run2 as run,
33
+ runForEach,
34
+ runFork,
35
+ scoped,
36
+ set3 as set,
37
+ sleep,
38
+ succeed2 as succeed,
39
+ succeed3 as succeed2,
40
+ suspend2 as suspend,
41
+ sync2 as sync,
42
+ taggedEnum,
43
+ tagsExhaustive,
44
+ tap2 as tap,
45
+ type,
46
+ update2 as update,
47
+ zipRight2 as zipRight
48
+ } from "./chunk-RIJ2MTZK.js";
17
49
 
18
50
  // packages/host-ui/src/backend/campUiBackend.ts
19
- var CampUiBackendError = class extends Data_exports.TaggedError("CampUiBackendError") {
51
+ var CampUiBackendError = class extends TaggedError("CampUiBackendError") {
20
52
  };
21
- var CampUiBackend = class extends Context_exports.Tag("priiisk/CampUiBackend")() {
53
+ var CampUiBackend = class extends Tag("priiisk/CampUiBackend")() {
22
54
  };
23
55
 
24
56
  // packages/host-ui/src/model/campUiModel.ts
@@ -101,21 +133,21 @@ var updateCampUiStringSet = (current, value, included) => {
101
133
  };
102
134
 
103
135
  // packages/host-ui/src/backend/campUiStore.ts
104
- var CampUiControllerError = class extends Data_exports.TaggedError("CampUiControllerError") {
136
+ var CampUiControllerError = class extends TaggedError("CampUiControllerError") {
105
137
  };
106
- var makeCampUiStore = (initial, presentationNow = 0) => Effect_exports.gen(function* () {
107
- const modelRef = yield* SubscriptionRef_exports.make(makeCampUiModel(initial, presentationNow));
108
- const updateState = (mutate) => SubscriptionRef_exports.update(modelRef, (model) => ({ ...model, state: mutate(model.state) }));
138
+ var makeCampUiStore = (initial, presentationNow = 0) => gen(function* () {
139
+ const modelRef = yield* make3(makeCampUiModel(initial, presentationNow));
140
+ const updateState = (mutate) => update(modelRef, (model) => ({ ...model, state: mutate(model.state) }));
109
141
  const controller = {
110
- selectWorker: (workerId) => SubscriptionRef_exports.modifyEffect(
142
+ selectWorker: (workerId) => modifyEffect(
111
143
  modelRef,
112
- (model) => findCampUiWorker(model.snapshot, workerId) === void 0 ? Effect_exports.fail(
144
+ (model) => findCampUiWorker(model.snapshot, workerId) === void 0 ? fail(
113
145
  new CampUiControllerError({
114
146
  operation: "campUi.selectWorker",
115
147
  code: "worker_not_found",
116
148
  workerId
117
149
  })
118
- ) : Effect_exports.succeed([
150
+ ) : succeed2([
119
151
  void 0,
120
152
  {
121
153
  ...model,
@@ -123,15 +155,15 @@ var makeCampUiStore = (initial, presentationNow = 0) => Effect_exports.gen(funct
123
155
  }
124
156
  ])
125
157
  ),
126
- openWorker: (workerId) => SubscriptionRef_exports.modifyEffect(
158
+ openWorker: (workerId) => modifyEffect(
127
159
  modelRef,
128
- (model) => findCampUiWorker(model.snapshot, workerId) === void 0 ? Effect_exports.fail(
160
+ (model) => findCampUiWorker(model.snapshot, workerId) === void 0 ? fail(
129
161
  new CampUiControllerError({
130
162
  operation: "campUi.openWorker",
131
163
  code: "worker_not_found",
132
164
  workerId
133
165
  })
134
- ) : Effect_exports.succeed([
166
+ ) : succeed2([
135
167
  void 0,
136
168
  {
137
169
  ...model,
@@ -143,14 +175,14 @@ var makeCampUiStore = (initial, presentationNow = 0) => Effect_exports.gen(funct
143
175
  }
144
176
  ])
145
177
  ),
146
- activateScreen: (screen) => SubscriptionRef_exports.modifyEffect(
178
+ activateScreen: (screen) => modifyEffect(
147
179
  modelRef,
148
- (model) => screen === CampUiScreen.worker && model.state.selectedWorkerId === void 0 ? Effect_exports.fail(
180
+ (model) => screen === CampUiScreen.worker && model.state.selectedWorkerId === void 0 ? fail(
149
181
  new CampUiControllerError({
150
182
  operation: "campUi.activateScreen",
151
183
  code: "worker_not_selected"
152
184
  })
153
- ) : Effect_exports.succeed([void 0, { ...model, state: { ...model.state, screen } }])
185
+ ) : succeed2([void 0, { ...model, state: { ...model.state, screen } }])
154
186
  ),
155
187
  focusDetailBlock: (focusedDetailBlockId) => updateState((state) => {
156
188
  if (focusedDetailBlockId !== void 0) return { ...state, focusedDetailBlockId };
@@ -189,9 +221,9 @@ var makeCampUiStore = (initial, presentationNow = 0) => Effect_exports.gen(funct
189
221
  })
190
222
  };
191
223
  return {
192
- current: SubscriptionRef_exports.get(modelRef),
224
+ current: get(modelRef),
193
225
  changes: modelRef.changes,
194
- updateSnapshot: (snapshot) => SubscriptionRef_exports.modify(modelRef, (current) => {
226
+ updateSnapshot: (snapshot) => modify(modelRef, (current) => {
195
227
  const stale = current.snapshot.generation === snapshot.generation && snapshot.revision <= current.snapshot.revision;
196
228
  return stale ? [false, current] : [true, { snapshot, state: reconcileCampUiState(current, snapshot) }];
197
229
  }),
@@ -248,19 +280,19 @@ var CampUiContributionStrategy = {
248
280
  replace: "replace",
249
281
  decorate: "decorate"
250
282
  };
251
- var CampUiCompositionError = class extends Data_exports.TaggedError("CampUiCompositionError") {
283
+ var CampUiCompositionError = class extends TaggedError("CampUiCompositionError") {
252
284
  };
253
285
  var orderContributions = (contributions) => [...contributions].sort(
254
286
  (left, right) => (left.order ?? 0) - (right.order ?? 0) || left.id.localeCompare(right.id)
255
287
  );
256
- var registerDispose = (component) => component.dispose === void 0 ? Effect_exports.succeed(component) : Effect_exports.addFinalizer(() => component.dispose).pipe(
257
- Effect_exports.as(component)
288
+ var registerDispose = (component) => component.dispose === void 0 ? succeed2(component) : addFinalizer(() => component.dispose).pipe(
289
+ as(component)
258
290
  );
259
291
  var validateContributions = (defaults, contributions) => {
260
292
  const ids = [...defaults, ...contributions].map((contribution) => contribution.id);
261
293
  const duplicateId = ids.find((id, index) => ids.indexOf(id) !== index);
262
294
  if (duplicateId !== void 0) {
263
- return Effect_exports.fail(
295
+ return fail(
264
296
  new CampUiCompositionError({ code: "duplicate_id", details: { id: duplicateId } })
265
297
  );
266
298
  }
@@ -268,19 +300,19 @@ var validateContributions = (defaults, contributions) => {
268
300
  const duplicateSlot = replacementSlots.find(
269
301
  (slotId, index) => replacementSlots.indexOf(slotId) !== index
270
302
  );
271
- return duplicateSlot === void 0 ? Effect_exports.void : Effect_exports.fail(
303
+ return duplicateSlot === void 0 ? _void : fail(
272
304
  new CampUiCompositionError({
273
305
  code: "multiple_replacements",
274
306
  details: { slotId: duplicateSlot }
275
307
  })
276
308
  );
277
309
  };
278
- var composeCampUiSlots = (context, defaults, contributions) => Effect_exports.gen(function* () {
310
+ var composeCampUiSlots = (context, defaults, contributions) => gen(function* () {
279
311
  yield* validateContributions(defaults, contributions);
280
312
  const slotIds = [...new Set([...defaults, ...contributions].map((item) => item.slotId))];
281
- const entries = yield* Effect_exports.forEach(
313
+ const entries = yield* forEach(
282
314
  slotIds,
283
- (slotId) => Effect_exports.gen(function* () {
315
+ (slotId) => gen(function* () {
284
316
  const replacement = contributions.find(
285
317
  (item) => item.slotId === slotId && item.strategy === CampUiContributionStrategy.replace
286
318
  );
@@ -293,9 +325,9 @@ var composeCampUiSlots = (context, defaults, contributions) => Effect_exports.ge
293
325
  ...replacement === void 0 ? [] : [replacement],
294
326
  ...appended
295
327
  ]);
296
- const components = yield* Effect_exports.forEach(
328
+ const components = yield* forEach(
297
329
  contentFactories,
298
- (item) => item.mount(context).pipe(Effect_exports.flatMap(registerDispose))
330
+ (item) => item.mount(context).pipe(flatMap(registerDispose))
299
331
  );
300
332
  let content = components.length === 0 ? emptyCampUiComponent : makeCampUiComponentGroup(components);
301
333
  const decorators = orderContributions(
@@ -304,7 +336,7 @@ var composeCampUiSlots = (context, defaults, contributions) => Effect_exports.ge
304
336
  )
305
337
  );
306
338
  for (const decorator of decorators) {
307
- content = yield* decorator.decorate(context, content).pipe(Effect_exports.flatMap(registerDispose));
339
+ content = yield* decorator.decorate(context, content).pipe(flatMap(registerDispose));
308
340
  }
309
341
  return [slotId, content];
310
342
  })
@@ -318,7 +350,7 @@ var composeCampUiDetailBlocks = (defaults, contributions) => {
318
350
  const renderers = [...defaults, ...contributions];
319
351
  const ids = renderers.map((renderer) => renderer.id);
320
352
  const duplicateId = ids.find((id, index) => ids.indexOf(id) !== index);
321
- return duplicateId === void 0 ? Effect_exports.succeed(renderers.sort(byOrder)) : Effect_exports.fail(
353
+ return duplicateId === void 0 ? succeed2(renderers.sort(byOrder)) : fail(
322
354
  new CampUiCompositionError({
323
355
  code: "duplicate_id",
324
356
  details: { area: "detail-block", id: duplicateId }
@@ -364,57 +396,57 @@ var nextCampUiPendingAskTarget = (snapshot, focusedBlockId) => {
364
396
  };
365
397
 
366
398
  // packages/host-ui/src/interaction/campUiIntents.ts
367
- var CampUiIntents = Data_exports.taggedEnum();
368
- var makeCampUiIntentHandler = (options) => Match_exports.type().pipe(
369
- Match_exports.tagsExhaustive({
399
+ var CampUiIntents = taggedEnum();
400
+ var makeCampUiIntentHandler = (options) => type().pipe(
401
+ tagsExhaustive({
370
402
  ActivateScreen: ({ screen }) => options.controller.activateScreen(screen),
371
403
  FocusDetailBlock: ({ blockId }) => options.controller.focusDetailBlock(blockId),
372
404
  FocusSlot: ({ slotId }) => options.controller.focusSlot(slotId),
373
- JumpToWorkerTail: ({ workerId }) => options.controller.focusDetailBlock(void 0).pipe(Effect_exports.zipRight(options.controller.setScrollOffset(workerId, 0))),
374
- NextPendingAsk: () => Effect_exports.suspend(() => {
405
+ JumpToWorkerTail: ({ workerId }) => options.controller.focusDetailBlock(void 0).pipe(zipRight(options.controller.setScrollOffset(workerId, 0))),
406
+ NextPendingAsk: () => suspend(() => {
375
407
  const model = options.readModel();
376
408
  const target = nextCampUiPendingAskTarget(
377
409
  model.snapshot,
378
410
  model.state.focusedDetailBlockId
379
411
  );
380
- return target === void 0 ? Effect_exports.void : options.controller.openWorker(target.workerId).pipe(
381
- Effect_exports.zipRight(options.controller.setDetailBlockExpanded(target.blockId, true)),
382
- Effect_exports.zipRight(options.controller.focusDetailBlock(target.blockId)),
383
- Effect_exports.zipRight(options.controller.focusSlot(CampUiSlot.transcript))
412
+ return target === void 0 ? _void : options.controller.openWorker(target.workerId).pipe(
413
+ zipRight(options.controller.setDetailBlockExpanded(target.blockId, true)),
414
+ zipRight(options.controller.focusDetailBlock(target.blockId)),
415
+ zipRight(options.controller.focusSlot(CampUiSlot.transcript))
384
416
  );
385
417
  }),
386
418
  OpenWorker: ({ workerId }) => options.controller.openWorker(workerId),
387
- ScrollWorker: ({ workerId, delta }) => Effect_exports.suspend(() => {
419
+ ScrollWorker: ({ workerId, delta }) => suspend(() => {
388
420
  const offset = options.readModel().state.scrollOffsets.get(workerId) ?? 0;
389
421
  return options.controller.focusDetailBlock(void 0).pipe(
390
- Effect_exports.zipRight(
422
+ zipRight(
391
423
  options.controller.setScrollOffset(workerId, Math.max(0, offset + delta))
392
424
  )
393
425
  );
394
426
  }),
395
- SelectRelativeWorker: ({ delta }) => Effect_exports.suspend(() => {
427
+ SelectRelativeWorker: ({ delta }) => suspend(() => {
396
428
  const model = options.readModel();
397
429
  const workers = model.snapshot.workers;
398
- if (workers.length === 0) return Effect_exports.void;
430
+ if (workers.length === 0) return _void;
399
431
  const current = workers.findIndex(
400
432
  (worker) => worker.snapshot.worker.id === model.state.selectedWorkerId
401
433
  );
402
434
  const index = current < 0 ? 0 : Math.min(workers.length - 1, Math.max(0, current + delta));
403
435
  const workerId = workers[index]?.snapshot.worker.id;
404
- return workerId === void 0 ? Effect_exports.void : options.controller.selectWorker(workerId);
436
+ return workerId === void 0 ? _void : options.controller.selectWorker(workerId);
405
437
  }),
406
438
  SelectWorker: ({ workerId }) => options.controller.selectWorker(workerId),
407
439
  SetDraft: ({ workerId, draft }) => options.controller.setDraft(workerId, draft),
408
440
  SetScrollOffset: ({ workerId, offset }) => options.controller.setScrollOffset(workerId, offset),
409
441
  SetTranscriptVisible: ({ visible }) => options.controller.setDetailVisible(visible),
410
- Steer: ({ workerId, message }) => message.trim() === "" ? Effect_exports.void : options.backend.steer({ workerId, message }).pipe(
411
- Effect_exports.tap(() => options.controller.setActionError(void 0)),
412
- Effect_exports.tap(() => options.controller.setDraft(workerId, "")),
413
- Effect_exports.catchAll(
414
- (cause) => options.controller.setDraft(workerId, message).pipe(Effect_exports.zipRight(options.controller.setActionError(cause.message)))
442
+ Steer: ({ workerId, message }) => message.trim() === "" ? _void : options.backend.steer({ workerId, message }).pipe(
443
+ tap(() => options.controller.setActionError(void 0)),
444
+ tap(() => options.controller.setDraft(workerId, "")),
445
+ catchAll(
446
+ (cause) => options.controller.setDraft(workerId, message).pipe(zipRight(options.controller.setActionError(cause.message)))
415
447
  )
416
448
  ),
417
- ToggleDetailBlock: ({ blockId }) => Effect_exports.suspend(
449
+ ToggleDetailBlock: ({ blockId }) => suspend(
418
450
  () => options.controller.setDetailBlockExpanded(
419
451
  blockId,
420
452
  !options.readModel().state.expandedDetailBlockIds.has(blockId)
@@ -1594,6 +1626,7 @@ var makeCampUiDetailComponent = (context, registry = defaultCampUiDetailBlockRen
1594
1626
  const renderState = /* @__PURE__ */ new Map();
1595
1627
  const detailCache = /* @__PURE__ */ new Map();
1596
1628
  let renderedRanges = [];
1629
+ let maximumScrollOffset = 0;
1597
1630
  let visibleRanges = [];
1598
1631
  return {
1599
1632
  focusable: true,
@@ -1649,6 +1682,7 @@ var makeCampUiDetailComponent = (context, registry = defaultCampUiDetailBlockRen
1649
1682
  lines.length - Math.min(lines.length, focusedRange.start + viewport.height)
1650
1683
  );
1651
1684
  const maximumOffset = Math.max(0, lines.length - viewport.height);
1685
+ maximumScrollOffset = maximumOffset;
1652
1686
  const desiredOffset = focusedOffset ?? (offset > 0 ? offset + growth : 0);
1653
1687
  const lockedOffset = Math.min(maximumOffset, desiredOffset);
1654
1688
  if (lockedOffset !== offset) {
@@ -1669,15 +1703,32 @@ var makeCampUiDetailComponent = (context, registry = defaultCampUiDetailBlockRen
1669
1703
  }));
1670
1704
  return lines.slice(start, end);
1671
1705
  },
1706
+ /*
1707
+ * An arrow first moves the selection between expandable blocks, and then
1708
+ * keeps reading: past the last block it scrolls a line at a time, so a long
1709
+ * history is reachable to its first message. Handing focus away at the last
1710
+ * block left the transcript stuck wherever the blocks happened to end
1711
+ * (priiisk-nss.6.41). Only the end of the content passes the arrow on to
1712
+ * spatial navigation.
1713
+ */
1672
1714
  handleInput: (input) => {
1673
1715
  const delta = matchesKey2(input, Key2.up) ? -1 : matchesKey2(input, Key2.down) ? 1 : void 0;
1674
- if (delta === void 0 || renderedRanges.length === 0) return false;
1675
- const focusedBlockId = context.readModel().state.focusedDetailBlockId;
1716
+ if (delta === void 0) return false;
1717
+ const model = context.readModel();
1718
+ const workerId = model.state.selectedWorkerId;
1719
+ if (workerId === void 0) return false;
1720
+ const focusedBlockId = model.state.focusedDetailBlockId;
1676
1721
  const current = renderedRanges.findIndex((range) => range.id === focusedBlockId);
1677
1722
  const next = current < 0 ? delta < 0 ? renderedRanges.length - 1 : 0 : current + delta;
1678
1723
  const target = renderedRanges[next];
1679
- if (target === void 0) return false;
1680
- context.emit(CampUiIntents.FocusDetailBlock({ blockId: target.id }));
1724
+ if (target !== void 0) {
1725
+ context.emit(CampUiIntents.FocusDetailBlock({ blockId: target.id }));
1726
+ return true;
1727
+ }
1728
+ const offset = model.state.scrollOffsets.get(workerId) ?? 0;
1729
+ const scrolled = delta < 0 ? offset + 1 : offset - 1;
1730
+ if (scrolled < 0 || scrolled > maximumScrollOffset) return false;
1731
+ context.emit(CampUiIntents.ScrollWorker({ workerId, delta: delta < 0 ? 1 : -1 }));
1681
1732
  return true;
1682
1733
  },
1683
1734
  handlePointer: (pointer) => {
@@ -1953,47 +2004,47 @@ var makeDefaultCampUiContributions = (tui, detailBlocks) => [
1953
2004
  {
1954
2005
  id: "default-camp-header",
1955
2006
  slotId: CampUiSlot.campHeader,
1956
- mount: (context) => Effect_exports.succeed(makeCampUiCampHeader(context))
2007
+ mount: (context) => succeed2(makeCampUiCampHeader(context))
1957
2008
  },
1958
2009
  {
1959
2010
  id: "default-seat",
1960
2011
  slotId: CampUiSlot.seat,
1961
- mount: (context) => Effect_exports.succeed(makeCampUiSeat(context))
2012
+ mount: (context) => succeed2(makeCampUiSeat(context))
1962
2013
  },
1963
2014
  {
1964
2015
  id: "default-resources",
1965
2016
  slotId: CampUiSlot.resources,
1966
- mount: (context) => Effect_exports.succeed(makeCampUiResources(context))
2017
+ mount: (context) => succeed2(makeCampUiResources(context))
1967
2018
  },
1968
2019
  {
1969
2020
  id: "default-roster",
1970
2021
  slotId: CampUiSlot.roster,
1971
- mount: (context) => Effect_exports.succeed(makeCampUiRoster(context))
2022
+ mount: (context) => succeed2(makeCampUiRoster(context))
1972
2023
  },
1973
2024
  {
1974
2025
  id: "default-session-header",
1975
2026
  slotId: CampUiSlot.sessionHeader,
1976
- mount: (context) => Effect_exports.succeed(makeCampUiSessionHeader(context))
2027
+ mount: (context) => succeed2(makeCampUiSessionHeader(context))
1977
2028
  },
1978
2029
  {
1979
2030
  id: "default-transcript",
1980
2031
  slotId: CampUiSlot.transcript,
1981
- mount: (context) => Effect_exports.succeed(makeCampUiDetailComponent(context, detailBlocks))
2032
+ mount: (context) => succeed2(makeCampUiDetailComponent(context, detailBlocks))
1982
2033
  },
1983
2034
  {
1984
2035
  id: "default-composer",
1985
2036
  slotId: CampUiSlot.composer,
1986
- mount: (context) => Effect_exports.succeed(makeCampUiComposerComponent(context, tui))
2037
+ mount: (context) => succeed2(makeCampUiComposerComponent(context, tui))
1987
2038
  },
1988
2039
  {
1989
2040
  id: "default-camp-footer",
1990
2041
  slotId: CampUiSlot.campFooter,
1991
- mount: (context) => Effect_exports.succeed(makeCampUiCampFooter(context))
2042
+ mount: (context) => succeed2(makeCampUiCampFooter(context))
1992
2043
  },
1993
2044
  {
1994
2045
  id: "default-session-footer",
1995
2046
  slotId: CampUiSlot.sessionFooter,
1996
- mount: (context) => Effect_exports.succeed(makeCampUiSessionFooter(context))
2047
+ mount: (context) => succeed2(makeCampUiSessionFooter(context))
1997
2048
  }
1998
2049
  ];
1999
2050
 
@@ -2065,9 +2116,9 @@ var makeCampUiSection = (options) => {
2065
2116
  }
2066
2117
  } : {},
2067
2118
  ...disposableComponents ? {
2068
- dispose: Effect_exports.forEach(
2119
+ dispose: forEach(
2069
2120
  [...components].reverse(),
2070
- (component) => component.dispose ?? Effect_exports.void,
2121
+ (component) => component.dispose ?? _void,
2071
2122
  { discard: true }
2072
2123
  )
2073
2124
  } : {}
@@ -2397,11 +2448,11 @@ var PiCampUiRoot = class {
2397
2448
  var hasPendingCampUiAsk = (model) => model.snapshot.workers.some(
2398
2449
  (worker) => worker.asks.some((ask) => ask.state === CampAskState.pending)
2399
2450
  );
2400
- var runCampUiPresentationClock = (readModel, controller) => Effect_exports.forever(
2401
- Effect_exports.sleep("1 second").pipe(
2402
- Effect_exports.zipRight(
2403
- Effect_exports.suspend(
2404
- () => hasPendingCampUiAsk(readModel()) ? Clock_exports.currentTimeMillis.pipe(Effect_exports.flatMap(controller.setPresentationNow)) : Effect_exports.void
2451
+ var runCampUiPresentationClock = (readModel, controller) => forever(
2452
+ sleep("1 second").pipe(
2453
+ zipRight(
2454
+ suspend(
2455
+ () => hasPendingCampUiAsk(readModel()) ? currentTimeMillis.pipe(flatMap(controller.setPresentationNow)) : _void
2405
2456
  )
2406
2457
  )
2407
2458
  )
@@ -2458,39 +2509,39 @@ var makeCampUiTerminalModes = (terminal) => {
2458
2509
  };
2459
2510
 
2460
2511
  // packages/host-ui/src/pi/mountPiCampUi.ts
2461
- var closedOnPurpose = (exit) => Exit_exports.isSuccess(exit) || Cause_exports.isInterruptedOnly(exit.cause);
2462
- var mountPiCampUi = (options) => Effect_exports.gen(function* () {
2463
- const startedAt = yield* Clock_exports.currentTimeMillis;
2464
- const healthRef = yield* SubscriptionRef_exports.make({
2512
+ var closedOnPurpose = (exit) => isSuccess(exit) || isInterruptedOnly(exit.cause);
2513
+ var mountPiCampUi = (options) => gen(function* () {
2514
+ const startedAt = yield* currentTimeMillis;
2515
+ const healthRef = yield* make3({
2465
2516
  status: CampUiRuntimeStatus.starting,
2466
2517
  operation: "ui.mount",
2467
2518
  updatedAt: startedAt
2468
2519
  });
2469
- const setHealth = (health) => SubscriptionRef_exports.get(healthRef).pipe(
2470
- Effect_exports.flatMap(
2471
- (current2) => sameCampUiRuntimeHealth(current2, { ...health, updatedAt: current2.updatedAt }) ? Effect_exports.void : Clock_exports.currentTimeMillis.pipe(
2472
- Effect_exports.flatMap(
2473
- (updatedAt) => SubscriptionRef_exports.set(healthRef, { ...health, updatedAt })
2520
+ const setHealth = (health) => get(healthRef).pipe(
2521
+ flatMap(
2522
+ (current2) => sameCampUiRuntimeHealth(current2, { ...health, updatedAt: current2.updatedAt }) ? _void : currentTimeMillis.pipe(
2523
+ flatMap(
2524
+ (updatedAt) => set(healthRef, { ...health, updatedAt })
2474
2525
  )
2475
2526
  )
2476
2527
  )
2477
2528
  );
2478
- yield* Effect_exports.sync(() => initTheme(void 0, false));
2529
+ yield* sync(() => initTheme(void 0, false));
2479
2530
  const initial = yield* options.backend.snapshot;
2480
2531
  const store = yield* makeCampUiStore(initial, startedAt);
2481
2532
  let current = yield* store.current;
2482
2533
  const terminal = options.terminal ?? new ProcessTerminal();
2483
2534
  const terminalModes = makeCampUiTerminalModes(terminal);
2484
- yield* Effect_exports.acquireRelease(
2485
- Effect_exports.sync(() => terminalModes.enter()),
2486
- () => Effect_exports.sync(() => terminalModes.exit())
2535
+ yield* acquireRelease(
2536
+ sync(() => terminalModes.enter()),
2537
+ () => sync(() => terminalModes.exit())
2487
2538
  );
2488
2539
  const tui = new TUI(terminal, true);
2489
- const runEffect = yield* FiberSet_exports.makeRuntime();
2540
+ const runEffect = yield* makeRuntime();
2490
2541
  const dispatch = (effect) => {
2491
2542
  runEffect(
2492
2543
  effect.pipe(
2493
- Effect_exports.catchAllCause((cause) => store.controller.setActionError(Cause_exports.pretty(cause)))
2544
+ catchAllCause((cause) => store.controller.setActionError(pretty(cause)))
2494
2545
  )
2495
2546
  );
2496
2547
  };
@@ -2523,62 +2574,62 @@ var mountPiCampUi = (options) => Effect_exports.gen(function* () {
2523
2574
  );
2524
2575
  tui.addChild(root);
2525
2576
  tui.setFocus(root);
2526
- yield* Effect_exports.sync(() => {
2577
+ yield* sync(() => {
2527
2578
  terminal.setTitle(initial.displayName);
2528
2579
  terminal.clearScreen();
2529
2580
  tui.start();
2530
2581
  });
2531
- yield* Effect_exports.addFinalizer(
2532
- (exit) => Effect_exports.sync(() => {
2582
+ yield* addFinalizer(
2583
+ (exit) => sync(() => {
2533
2584
  tui.stop();
2534
2585
  terminal.setProgress(false);
2535
2586
  }).pipe(
2536
- Effect_exports.zipRight(setHealth({ status: CampUiRuntimeStatus.stopped, operation: "ui.stop" })),
2537
- Effect_exports.zipRight(
2538
- closedOnPurpose(exit) ? options.backend.shutdown.pipe(Effect_exports.ignore) : Effect_exports.void
2587
+ zipRight(setHealth({ status: CampUiRuntimeStatus.stopped, operation: "ui.stop" })),
2588
+ zipRight(
2589
+ closedOnPurpose(exit) ? options.backend.shutdown.pipe(ignore) : _void
2539
2590
  )
2540
2591
  )
2541
2592
  );
2542
- yield* Effect_exports.forkScoped(
2543
- Effect_exports.gen(function* () {
2593
+ yield* forkScoped(
2594
+ gen(function* () {
2544
2595
  for (let attempt = 0; attempt < 25; attempt += 1) {
2545
- if (yield* Effect_exports.sync(() => terminalModes.tryEnableAlternateScroll())) return;
2546
- yield* Effect_exports.sleep("10 millis");
2596
+ if (yield* sync(() => terminalModes.tryEnableAlternateScroll())) return;
2597
+ yield* sleep("10 millis");
2547
2598
  }
2548
2599
  })
2549
2600
  );
2550
- const fibers = yield* FiberSet_exports.make();
2551
- yield* FiberSet_exports.run(
2601
+ const fibers = yield* make2();
2602
+ yield* run(
2552
2603
  fibers,
2553
2604
  store.changes.pipe(
2554
- Stream_exports.runForEach(
2555
- (model) => Effect_exports.sync(() => {
2605
+ runForEach(
2606
+ (model) => sync(() => {
2556
2607
  current = model;
2557
2608
  tui.requestRender();
2558
2609
  })
2559
2610
  )
2560
2611
  )
2561
2612
  );
2562
- yield* FiberSet_exports.run(
2613
+ yield* run(
2563
2614
  fibers,
2564
2615
  runCampUiPresentationClock(() => current, store.controller)
2565
2616
  );
2566
2617
  yield* setHealth({ status: CampUiRuntimeStatus.ready, operation: "ui.mount" });
2567
2618
  const runSubscription = (failures) => options.backend.changes.pipe(
2568
- Stream_exports.runForEach(
2619
+ runForEach(
2569
2620
  (snapshot) => store.updateSnapshot(snapshot).pipe(
2570
- Effect_exports.zipRight(
2621
+ zipRight(
2571
2622
  setHealth({ status: CampUiRuntimeStatus.ready, operation: "ui.subscribe" })
2572
2623
  ),
2573
- Effect_exports.zipRight(store.controller.setActionError(void 0))
2624
+ zipRight(store.controller.setActionError(void 0))
2574
2625
  )
2575
2626
  ),
2576
- Effect_exports.zipRight(
2577
- Effect_exports.fail(
2627
+ zipRight(
2628
+ fail(
2578
2629
  new Error("Camp UI backend subscription ended before the UI scope was closed")
2579
2630
  )
2580
2631
  ),
2581
- Effect_exports.catchAll((cause) => {
2632
+ catchAll((cause) => {
2582
2633
  const attempt = failures + 1;
2583
2634
  const message = cause instanceof Error ? cause.message : String(cause);
2584
2635
  if (attempt > CAMP_UI_SUBSCRIPTION_MAX_RETRIES) {
@@ -2587,11 +2638,11 @@ var mountPiCampUi = (options) => Effect_exports.gen(function* () {
2587
2638
  operation: "ui.subscribe",
2588
2639
  message,
2589
2640
  attempt
2590
- }).pipe(Effect_exports.zipRight(store.controller.setActionError(message)));
2641
+ }).pipe(zipRight(store.controller.setActionError(message)));
2591
2642
  }
2592
2643
  const delay = campUiSubscriptionRetryDelay(attempt);
2593
- return Clock_exports.currentTimeMillis.pipe(
2594
- Effect_exports.flatMap(
2644
+ return currentTimeMillis.pipe(
2645
+ flatMap(
2595
2646
  (now) => setHealth({
2596
2647
  status: CampUiRuntimeStatus.retrying,
2597
2648
  operation: "ui.subscribe",
@@ -2600,18 +2651,18 @@ var mountPiCampUi = (options) => Effect_exports.gen(function* () {
2600
2651
  nextRetryAt: now + delay
2601
2652
  })
2602
2653
  ),
2603
- Effect_exports.zipRight(store.controller.setActionError(message)),
2604
- Effect_exports.zipRight(Effect_exports.sleep(delay)),
2605
- Effect_exports.zipRight(Effect_exports.suspend(() => runSubscription(attempt)))
2654
+ zipRight(store.controller.setActionError(message)),
2655
+ zipRight(sleep(delay)),
2656
+ zipRight(suspend(() => runSubscription(attempt)))
2606
2657
  );
2607
2658
  })
2608
2659
  );
2609
- yield* FiberSet_exports.run(fibers, runSubscription(0));
2660
+ yield* run(fibers, runSubscription(0));
2610
2661
  tui.requestRender(true);
2611
2662
  return {
2612
2663
  controller: store.controller,
2613
2664
  tui,
2614
- health: { current: SubscriptionRef_exports.get(healthRef), changes: healthRef.changes }
2665
+ health: { current: get(healthRef), changes: healthRef.changes }
2615
2666
  };
2616
2667
  });
2617
2668
 
@@ -2680,132 +2731,131 @@ var PiCampRunSelectorRoot = class {
2680
2731
  invalidate() {
2681
2732
  }
2682
2733
  };
2683
- var selectCampRun = (options) => Effect_exports.scoped(
2684
- Effect_exports.gen(function* () {
2685
- yield* Effect_exports.sync(() => initTheme2(void 0, false));
2686
- const selected = yield* Deferred_exports.make();
2734
+ var selectCampRun = (options) => scoped(
2735
+ gen(function* () {
2736
+ yield* sync(() => initTheme2(void 0, false));
2737
+ const selected = yield* make();
2687
2738
  const terminal = options.terminal ?? new ProcessTerminal2();
2688
2739
  const modes = makeCampUiTerminalModes(terminal);
2689
- yield* Effect_exports.acquireRelease(
2690
- Effect_exports.sync(() => modes.enter()),
2691
- () => Effect_exports.sync(() => modes.exit())
2740
+ yield* acquireRelease(
2741
+ sync(() => modes.enter()),
2742
+ () => sync(() => modes.exit())
2692
2743
  );
2693
2744
  const tui = new TUI2(terminal, true);
2694
2745
  const root = new PiCampRunSelectorRoot(
2695
2746
  options.items,
2696
2747
  () => terminal.rows,
2697
2748
  (runId) => {
2698
- Effect_exports.runFork(Deferred_exports.succeed(selected, runId));
2749
+ runFork(succeed(selected, runId));
2699
2750
  },
2700
2751
  () => tui.requestRender()
2701
2752
  );
2702
2753
  tui.addChild(root);
2703
2754
  tui.setFocus(root);
2704
- yield* Effect_exports.acquireRelease(
2705
- Effect_exports.sync(() => {
2755
+ yield* acquireRelease(
2756
+ sync(() => {
2706
2757
  terminal.setTitle("Resume camp");
2707
2758
  terminal.clearScreen();
2708
2759
  tui.start();
2709
2760
  tui.requestRender(true);
2710
2761
  }),
2711
- () => Effect_exports.sync(() => tui.stop())
2762
+ () => sync(() => tui.stop())
2712
2763
  );
2713
- return yield* Deferred_exports.await(selected);
2764
+ return yield* _await(selected);
2714
2765
  })
2715
2766
  );
2716
2767
 
2717
2768
  // packages/host-ui/src/index.ts
2718
2769
  var PACKAGE = "@priiisk/host-ui";
2719
-
2720
2770
  export {
2721
- CampUiBackendError,
2771
+ CAMP_UI_BASH_PREVIEW_LINES,
2772
+ CAMP_UI_DEFAULT_TOOL_PREVIEW_LINES,
2773
+ CAMP_UI_EXPLORED_COLLAPSED_PATHS,
2774
+ CAMP_UI_EXPLORED_TOOL_NAMES,
2775
+ CAMP_UI_SUBSCRIPTION_BASE_DELAY_MS,
2776
+ CAMP_UI_SUBSCRIPTION_MAX_RETRIES,
2777
+ CampUiAssistantMessage,
2722
2778
  CampUiBackend,
2723
- CampUiPlacement,
2724
- CampUiHealthStatus,
2725
- CampUiScreen,
2726
- campUiAskBlockId,
2727
- makeInitialCampUiState,
2728
- makeCampUiModel,
2729
- findCampUiWorker,
2730
- CampUiControllerError,
2731
- makeCampUiStore,
2732
- makeCampUiComponentGroup,
2733
- emptyCampUiComponent,
2734
- CampUiSlot,
2735
- CampUiContributionStrategy,
2779
+ CampUiBackendError,
2736
2780
  CampUiCompositionError,
2737
- composeCampUiSlots,
2738
- composeCampUiDetailBlocks,
2739
- renderCampUiDetailBlocks,
2740
- renderCampUiDetailBlockLayout,
2741
- campUiPendingAskTargets,
2742
- nextCampUiPendingAskTarget,
2743
- CampUiIntents,
2744
- makeCampUiIntentHandler,
2745
- makeCampUiIntentRouter,
2781
+ CampUiContributionStrategy,
2782
+ CampUiControllerError,
2783
+ CampUiExploredStatus,
2746
2784
  CampUiFocusDirection,
2747
- findCampUiSpatialFocusTarget,
2748
- defaultCampUiLayoutPolicy,
2749
- CampUiSectionSizeKind,
2750
- allocateCampUiSectionRows,
2751
- defaultCampUiLeftSectionSizes,
2785
+ CampUiGlyph,
2786
+ CampUiHealthStatus,
2787
+ CampUiIntents,
2752
2788
  CampUiLayoutMode,
2753
- makeDefaultCampUiLayout,
2789
+ CampUiPlacement,
2754
2790
  CampUiRuntimeStatus,
2755
- hasCampUiTextContent,
2756
- fitCampUiLine,
2757
- fitCampUiLines,
2758
- joinCampUiColumns,
2759
- jsonText,
2760
- compactNumber,
2791
+ CampUiScreen,
2792
+ CampUiSectionSizeKind,
2793
+ CampUiSlot,
2761
2794
  CampUiTone,
2762
- CampUiGlyph,
2763
- styleCampUiTone,
2764
- uniqueCampUiNames,
2765
- renderCampUiStatus,
2766
- renderCampUiState,
2767
- renderCampUiWorkerState,
2768
- renderSelectedCampUiRow,
2769
2795
  DEFAULT_DIRECTED_BLOCK_BODY_LINES,
2770
- formatCampUiDuration,
2771
- renderCampUiDirectedBlock,
2772
- campUiPendingAskBlockRenderer,
2773
- CampUiAssistantMessage,
2774
- resetCampUiBlockCache,
2775
- campUiBlockCacheSize,
2796
+ PACKAGE,
2797
+ PiCampRunSelectorRoot,
2798
+ PiCampUiRoot,
2799
+ allocateCampUiSectionRows,
2776
2800
  cachedCampUiBlock,
2777
- campUiMessageSignature,
2778
- campUiResultSignature,
2779
- makeCampUiComposerComponent,
2801
+ campUiAskBlockId,
2802
+ campUiBlockCacheSize,
2780
2803
  campUiEquipmentBlockRenderer,
2781
- renderCampUiPanel,
2782
- CAMP_UI_EXPLORED_TOOL_NAMES,
2783
- CAMP_UI_EXPLORED_COLLAPSED_PATHS,
2784
- CampUiExploredStatus,
2785
- isCampUiExploredTool,
2786
2804
  campUiExploredReadPath,
2787
2805
  campUiExploredReadRange,
2788
- renderCampUiExploredGroup,
2789
- CAMP_UI_DEFAULT_TOOL_PREVIEW_LINES,
2790
- CAMP_UI_BASH_PREVIEW_LINES,
2791
- resetCampUiToolResultCache,
2806
+ campUiMessageSignature,
2807
+ campUiPendingAskBlockRenderer,
2808
+ campUiPendingAskTargets,
2809
+ campUiResultSignature,
2810
+ campUiSubscriptionRetryDelay,
2792
2811
  campUiToolResultCacheSize,
2793
- renderCampUiToolResult,
2794
2812
  campUiTranscriptBlockRenderer,
2813
+ compactNumber,
2814
+ composeCampUiDetailBlocks,
2815
+ composeCampUiSlots,
2816
+ decorateDefaultCampUiSections,
2795
2817
  defaultCampUiDetailBlockRenderers,
2818
+ defaultCampUiLayoutPolicy,
2819
+ defaultCampUiLeftSectionSizes,
2820
+ emptyCampUiComponent,
2821
+ findCampUiSpatialFocusTarget,
2822
+ findCampUiWorker,
2823
+ fitCampUiLine,
2824
+ fitCampUiLines,
2825
+ formatCampUiDuration,
2826
+ hasCampUiTextContent,
2827
+ hasPendingCampUiAsk,
2828
+ isCampUiExploredTool,
2829
+ joinCampUiColumns,
2830
+ jsonText,
2831
+ makeCampUiComponentGroup,
2832
+ makeCampUiComposerComponent,
2796
2833
  makeCampUiDetailComponent,
2797
- makeDefaultCampUiContributions,
2834
+ makeCampUiIntentHandler,
2835
+ makeCampUiIntentRouter,
2836
+ makeCampUiModel,
2798
2837
  makeCampUiSection,
2799
- decorateDefaultCampUiSections,
2800
- PiCampUiRoot,
2801
- hasPendingCampUiAsk,
2838
+ makeCampUiStore,
2839
+ makeDefaultCampUiContributions,
2840
+ makeDefaultCampUiLayout,
2841
+ makeInitialCampUiState,
2842
+ mountPiCampUi,
2843
+ nextCampUiPendingAskTarget,
2844
+ renderCampUiDetailBlockLayout,
2845
+ renderCampUiDetailBlocks,
2846
+ renderCampUiDirectedBlock,
2847
+ renderCampUiExploredGroup,
2848
+ renderCampUiPanel,
2849
+ renderCampUiState,
2850
+ renderCampUiStatus,
2851
+ renderCampUiToolResult,
2852
+ renderCampUiWorkerState,
2853
+ renderSelectedCampUiRow,
2854
+ resetCampUiBlockCache,
2855
+ resetCampUiToolResultCache,
2802
2856
  runCampUiPresentationClock,
2803
- CAMP_UI_SUBSCRIPTION_MAX_RETRIES,
2804
- CAMP_UI_SUBSCRIPTION_BASE_DELAY_MS,
2805
- campUiSubscriptionRetryDelay,
2806
2857
  sameCampUiRuntimeHealth,
2807
- mountPiCampUi,
2808
- PiCampRunSelectorRoot,
2809
2858
  selectCampRun,
2810
- PACKAGE
2859
+ styleCampUiTone,
2860
+ uniqueCampUiNames
2811
2861
  };