priiisk 0.1.15 → 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)
@@ -1972,47 +2004,47 @@ var makeDefaultCampUiContributions = (tui, detailBlocks) => [
1972
2004
  {
1973
2005
  id: "default-camp-header",
1974
2006
  slotId: CampUiSlot.campHeader,
1975
- mount: (context) => Effect_exports.succeed(makeCampUiCampHeader(context))
2007
+ mount: (context) => succeed2(makeCampUiCampHeader(context))
1976
2008
  },
1977
2009
  {
1978
2010
  id: "default-seat",
1979
2011
  slotId: CampUiSlot.seat,
1980
- mount: (context) => Effect_exports.succeed(makeCampUiSeat(context))
2012
+ mount: (context) => succeed2(makeCampUiSeat(context))
1981
2013
  },
1982
2014
  {
1983
2015
  id: "default-resources",
1984
2016
  slotId: CampUiSlot.resources,
1985
- mount: (context) => Effect_exports.succeed(makeCampUiResources(context))
2017
+ mount: (context) => succeed2(makeCampUiResources(context))
1986
2018
  },
1987
2019
  {
1988
2020
  id: "default-roster",
1989
2021
  slotId: CampUiSlot.roster,
1990
- mount: (context) => Effect_exports.succeed(makeCampUiRoster(context))
2022
+ mount: (context) => succeed2(makeCampUiRoster(context))
1991
2023
  },
1992
2024
  {
1993
2025
  id: "default-session-header",
1994
2026
  slotId: CampUiSlot.sessionHeader,
1995
- mount: (context) => Effect_exports.succeed(makeCampUiSessionHeader(context))
2027
+ mount: (context) => succeed2(makeCampUiSessionHeader(context))
1996
2028
  },
1997
2029
  {
1998
2030
  id: "default-transcript",
1999
2031
  slotId: CampUiSlot.transcript,
2000
- mount: (context) => Effect_exports.succeed(makeCampUiDetailComponent(context, detailBlocks))
2032
+ mount: (context) => succeed2(makeCampUiDetailComponent(context, detailBlocks))
2001
2033
  },
2002
2034
  {
2003
2035
  id: "default-composer",
2004
2036
  slotId: CampUiSlot.composer,
2005
- mount: (context) => Effect_exports.succeed(makeCampUiComposerComponent(context, tui))
2037
+ mount: (context) => succeed2(makeCampUiComposerComponent(context, tui))
2006
2038
  },
2007
2039
  {
2008
2040
  id: "default-camp-footer",
2009
2041
  slotId: CampUiSlot.campFooter,
2010
- mount: (context) => Effect_exports.succeed(makeCampUiCampFooter(context))
2042
+ mount: (context) => succeed2(makeCampUiCampFooter(context))
2011
2043
  },
2012
2044
  {
2013
2045
  id: "default-session-footer",
2014
2046
  slotId: CampUiSlot.sessionFooter,
2015
- mount: (context) => Effect_exports.succeed(makeCampUiSessionFooter(context))
2047
+ mount: (context) => succeed2(makeCampUiSessionFooter(context))
2016
2048
  }
2017
2049
  ];
2018
2050
 
@@ -2084,9 +2116,9 @@ var makeCampUiSection = (options) => {
2084
2116
  }
2085
2117
  } : {},
2086
2118
  ...disposableComponents ? {
2087
- dispose: Effect_exports.forEach(
2119
+ dispose: forEach(
2088
2120
  [...components].reverse(),
2089
- (component) => component.dispose ?? Effect_exports.void,
2121
+ (component) => component.dispose ?? _void,
2090
2122
  { discard: true }
2091
2123
  )
2092
2124
  } : {}
@@ -2416,11 +2448,11 @@ var PiCampUiRoot = class {
2416
2448
  var hasPendingCampUiAsk = (model) => model.snapshot.workers.some(
2417
2449
  (worker) => worker.asks.some((ask) => ask.state === CampAskState.pending)
2418
2450
  );
2419
- var runCampUiPresentationClock = (readModel, controller) => Effect_exports.forever(
2420
- Effect_exports.sleep("1 second").pipe(
2421
- Effect_exports.zipRight(
2422
- Effect_exports.suspend(
2423
- () => 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
2424
2456
  )
2425
2457
  )
2426
2458
  )
@@ -2477,39 +2509,39 @@ var makeCampUiTerminalModes = (terminal) => {
2477
2509
  };
2478
2510
 
2479
2511
  // packages/host-ui/src/pi/mountPiCampUi.ts
2480
- var closedOnPurpose = (exit) => Exit_exports.isSuccess(exit) || Cause_exports.isInterruptedOnly(exit.cause);
2481
- var mountPiCampUi = (options) => Effect_exports.gen(function* () {
2482
- const startedAt = yield* Clock_exports.currentTimeMillis;
2483
- 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({
2484
2516
  status: CampUiRuntimeStatus.starting,
2485
2517
  operation: "ui.mount",
2486
2518
  updatedAt: startedAt
2487
2519
  });
2488
- const setHealth = (health) => SubscriptionRef_exports.get(healthRef).pipe(
2489
- Effect_exports.flatMap(
2490
- (current2) => sameCampUiRuntimeHealth(current2, { ...health, updatedAt: current2.updatedAt }) ? Effect_exports.void : Clock_exports.currentTimeMillis.pipe(
2491
- Effect_exports.flatMap(
2492
- (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 })
2493
2525
  )
2494
2526
  )
2495
2527
  )
2496
2528
  );
2497
- yield* Effect_exports.sync(() => initTheme(void 0, false));
2529
+ yield* sync(() => initTheme(void 0, false));
2498
2530
  const initial = yield* options.backend.snapshot;
2499
2531
  const store = yield* makeCampUiStore(initial, startedAt);
2500
2532
  let current = yield* store.current;
2501
2533
  const terminal = options.terminal ?? new ProcessTerminal();
2502
2534
  const terminalModes = makeCampUiTerminalModes(terminal);
2503
- yield* Effect_exports.acquireRelease(
2504
- Effect_exports.sync(() => terminalModes.enter()),
2505
- () => Effect_exports.sync(() => terminalModes.exit())
2535
+ yield* acquireRelease(
2536
+ sync(() => terminalModes.enter()),
2537
+ () => sync(() => terminalModes.exit())
2506
2538
  );
2507
2539
  const tui = new TUI(terminal, true);
2508
- const runEffect = yield* FiberSet_exports.makeRuntime();
2540
+ const runEffect = yield* makeRuntime();
2509
2541
  const dispatch = (effect) => {
2510
2542
  runEffect(
2511
2543
  effect.pipe(
2512
- Effect_exports.catchAllCause((cause) => store.controller.setActionError(Cause_exports.pretty(cause)))
2544
+ catchAllCause((cause) => store.controller.setActionError(pretty(cause)))
2513
2545
  )
2514
2546
  );
2515
2547
  };
@@ -2542,62 +2574,62 @@ var mountPiCampUi = (options) => Effect_exports.gen(function* () {
2542
2574
  );
2543
2575
  tui.addChild(root);
2544
2576
  tui.setFocus(root);
2545
- yield* Effect_exports.sync(() => {
2577
+ yield* sync(() => {
2546
2578
  terminal.setTitle(initial.displayName);
2547
2579
  terminal.clearScreen();
2548
2580
  tui.start();
2549
2581
  });
2550
- yield* Effect_exports.addFinalizer(
2551
- (exit) => Effect_exports.sync(() => {
2582
+ yield* addFinalizer(
2583
+ (exit) => sync(() => {
2552
2584
  tui.stop();
2553
2585
  terminal.setProgress(false);
2554
2586
  }).pipe(
2555
- Effect_exports.zipRight(setHealth({ status: CampUiRuntimeStatus.stopped, operation: "ui.stop" })),
2556
- Effect_exports.zipRight(
2557
- 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
2558
2590
  )
2559
2591
  )
2560
2592
  );
2561
- yield* Effect_exports.forkScoped(
2562
- Effect_exports.gen(function* () {
2593
+ yield* forkScoped(
2594
+ gen(function* () {
2563
2595
  for (let attempt = 0; attempt < 25; attempt += 1) {
2564
- if (yield* Effect_exports.sync(() => terminalModes.tryEnableAlternateScroll())) return;
2565
- yield* Effect_exports.sleep("10 millis");
2596
+ if (yield* sync(() => terminalModes.tryEnableAlternateScroll())) return;
2597
+ yield* sleep("10 millis");
2566
2598
  }
2567
2599
  })
2568
2600
  );
2569
- const fibers = yield* FiberSet_exports.make();
2570
- yield* FiberSet_exports.run(
2601
+ const fibers = yield* make2();
2602
+ yield* run(
2571
2603
  fibers,
2572
2604
  store.changes.pipe(
2573
- Stream_exports.runForEach(
2574
- (model) => Effect_exports.sync(() => {
2605
+ runForEach(
2606
+ (model) => sync(() => {
2575
2607
  current = model;
2576
2608
  tui.requestRender();
2577
2609
  })
2578
2610
  )
2579
2611
  )
2580
2612
  );
2581
- yield* FiberSet_exports.run(
2613
+ yield* run(
2582
2614
  fibers,
2583
2615
  runCampUiPresentationClock(() => current, store.controller)
2584
2616
  );
2585
2617
  yield* setHealth({ status: CampUiRuntimeStatus.ready, operation: "ui.mount" });
2586
2618
  const runSubscription = (failures) => options.backend.changes.pipe(
2587
- Stream_exports.runForEach(
2619
+ runForEach(
2588
2620
  (snapshot) => store.updateSnapshot(snapshot).pipe(
2589
- Effect_exports.zipRight(
2621
+ zipRight(
2590
2622
  setHealth({ status: CampUiRuntimeStatus.ready, operation: "ui.subscribe" })
2591
2623
  ),
2592
- Effect_exports.zipRight(store.controller.setActionError(void 0))
2624
+ zipRight(store.controller.setActionError(void 0))
2593
2625
  )
2594
2626
  ),
2595
- Effect_exports.zipRight(
2596
- Effect_exports.fail(
2627
+ zipRight(
2628
+ fail(
2597
2629
  new Error("Camp UI backend subscription ended before the UI scope was closed")
2598
2630
  )
2599
2631
  ),
2600
- Effect_exports.catchAll((cause) => {
2632
+ catchAll((cause) => {
2601
2633
  const attempt = failures + 1;
2602
2634
  const message = cause instanceof Error ? cause.message : String(cause);
2603
2635
  if (attempt > CAMP_UI_SUBSCRIPTION_MAX_RETRIES) {
@@ -2606,11 +2638,11 @@ var mountPiCampUi = (options) => Effect_exports.gen(function* () {
2606
2638
  operation: "ui.subscribe",
2607
2639
  message,
2608
2640
  attempt
2609
- }).pipe(Effect_exports.zipRight(store.controller.setActionError(message)));
2641
+ }).pipe(zipRight(store.controller.setActionError(message)));
2610
2642
  }
2611
2643
  const delay = campUiSubscriptionRetryDelay(attempt);
2612
- return Clock_exports.currentTimeMillis.pipe(
2613
- Effect_exports.flatMap(
2644
+ return currentTimeMillis.pipe(
2645
+ flatMap(
2614
2646
  (now) => setHealth({
2615
2647
  status: CampUiRuntimeStatus.retrying,
2616
2648
  operation: "ui.subscribe",
@@ -2619,18 +2651,18 @@ var mountPiCampUi = (options) => Effect_exports.gen(function* () {
2619
2651
  nextRetryAt: now + delay
2620
2652
  })
2621
2653
  ),
2622
- Effect_exports.zipRight(store.controller.setActionError(message)),
2623
- Effect_exports.zipRight(Effect_exports.sleep(delay)),
2624
- Effect_exports.zipRight(Effect_exports.suspend(() => runSubscription(attempt)))
2654
+ zipRight(store.controller.setActionError(message)),
2655
+ zipRight(sleep(delay)),
2656
+ zipRight(suspend(() => runSubscription(attempt)))
2625
2657
  );
2626
2658
  })
2627
2659
  );
2628
- yield* FiberSet_exports.run(fibers, runSubscription(0));
2660
+ yield* run(fibers, runSubscription(0));
2629
2661
  tui.requestRender(true);
2630
2662
  return {
2631
2663
  controller: store.controller,
2632
2664
  tui,
2633
- health: { current: SubscriptionRef_exports.get(healthRef), changes: healthRef.changes }
2665
+ health: { current: get(healthRef), changes: healthRef.changes }
2634
2666
  };
2635
2667
  });
2636
2668
 
@@ -2699,132 +2731,131 @@ var PiCampRunSelectorRoot = class {
2699
2731
  invalidate() {
2700
2732
  }
2701
2733
  };
2702
- var selectCampRun = (options) => Effect_exports.scoped(
2703
- Effect_exports.gen(function* () {
2704
- yield* Effect_exports.sync(() => initTheme2(void 0, false));
2705
- 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();
2706
2738
  const terminal = options.terminal ?? new ProcessTerminal2();
2707
2739
  const modes = makeCampUiTerminalModes(terminal);
2708
- yield* Effect_exports.acquireRelease(
2709
- Effect_exports.sync(() => modes.enter()),
2710
- () => Effect_exports.sync(() => modes.exit())
2740
+ yield* acquireRelease(
2741
+ sync(() => modes.enter()),
2742
+ () => sync(() => modes.exit())
2711
2743
  );
2712
2744
  const tui = new TUI2(terminal, true);
2713
2745
  const root = new PiCampRunSelectorRoot(
2714
2746
  options.items,
2715
2747
  () => terminal.rows,
2716
2748
  (runId) => {
2717
- Effect_exports.runFork(Deferred_exports.succeed(selected, runId));
2749
+ runFork(succeed(selected, runId));
2718
2750
  },
2719
2751
  () => tui.requestRender()
2720
2752
  );
2721
2753
  tui.addChild(root);
2722
2754
  tui.setFocus(root);
2723
- yield* Effect_exports.acquireRelease(
2724
- Effect_exports.sync(() => {
2755
+ yield* acquireRelease(
2756
+ sync(() => {
2725
2757
  terminal.setTitle("Resume camp");
2726
2758
  terminal.clearScreen();
2727
2759
  tui.start();
2728
2760
  tui.requestRender(true);
2729
2761
  }),
2730
- () => Effect_exports.sync(() => tui.stop())
2762
+ () => sync(() => tui.stop())
2731
2763
  );
2732
- return yield* Deferred_exports.await(selected);
2764
+ return yield* _await(selected);
2733
2765
  })
2734
2766
  );
2735
2767
 
2736
2768
  // packages/host-ui/src/index.ts
2737
2769
  var PACKAGE = "@priiisk/host-ui";
2738
-
2739
2770
  export {
2740
- 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,
2741
2778
  CampUiBackend,
2742
- CampUiPlacement,
2743
- CampUiHealthStatus,
2744
- CampUiScreen,
2745
- campUiAskBlockId,
2746
- makeInitialCampUiState,
2747
- makeCampUiModel,
2748
- findCampUiWorker,
2749
- CampUiControllerError,
2750
- makeCampUiStore,
2751
- makeCampUiComponentGroup,
2752
- emptyCampUiComponent,
2753
- CampUiSlot,
2754
- CampUiContributionStrategy,
2779
+ CampUiBackendError,
2755
2780
  CampUiCompositionError,
2756
- composeCampUiSlots,
2757
- composeCampUiDetailBlocks,
2758
- renderCampUiDetailBlocks,
2759
- renderCampUiDetailBlockLayout,
2760
- campUiPendingAskTargets,
2761
- nextCampUiPendingAskTarget,
2762
- CampUiIntents,
2763
- makeCampUiIntentHandler,
2764
- makeCampUiIntentRouter,
2781
+ CampUiContributionStrategy,
2782
+ CampUiControllerError,
2783
+ CampUiExploredStatus,
2765
2784
  CampUiFocusDirection,
2766
- findCampUiSpatialFocusTarget,
2767
- defaultCampUiLayoutPolicy,
2768
- CampUiSectionSizeKind,
2769
- allocateCampUiSectionRows,
2770
- defaultCampUiLeftSectionSizes,
2785
+ CampUiGlyph,
2786
+ CampUiHealthStatus,
2787
+ CampUiIntents,
2771
2788
  CampUiLayoutMode,
2772
- makeDefaultCampUiLayout,
2789
+ CampUiPlacement,
2773
2790
  CampUiRuntimeStatus,
2774
- hasCampUiTextContent,
2775
- fitCampUiLine,
2776
- fitCampUiLines,
2777
- joinCampUiColumns,
2778
- jsonText,
2779
- compactNumber,
2791
+ CampUiScreen,
2792
+ CampUiSectionSizeKind,
2793
+ CampUiSlot,
2780
2794
  CampUiTone,
2781
- CampUiGlyph,
2782
- styleCampUiTone,
2783
- uniqueCampUiNames,
2784
- renderCampUiStatus,
2785
- renderCampUiState,
2786
- renderCampUiWorkerState,
2787
- renderSelectedCampUiRow,
2788
2795
  DEFAULT_DIRECTED_BLOCK_BODY_LINES,
2789
- formatCampUiDuration,
2790
- renderCampUiDirectedBlock,
2791
- campUiPendingAskBlockRenderer,
2792
- CampUiAssistantMessage,
2793
- resetCampUiBlockCache,
2794
- campUiBlockCacheSize,
2796
+ PACKAGE,
2797
+ PiCampRunSelectorRoot,
2798
+ PiCampUiRoot,
2799
+ allocateCampUiSectionRows,
2795
2800
  cachedCampUiBlock,
2796
- campUiMessageSignature,
2797
- campUiResultSignature,
2798
- makeCampUiComposerComponent,
2801
+ campUiAskBlockId,
2802
+ campUiBlockCacheSize,
2799
2803
  campUiEquipmentBlockRenderer,
2800
- renderCampUiPanel,
2801
- CAMP_UI_EXPLORED_TOOL_NAMES,
2802
- CAMP_UI_EXPLORED_COLLAPSED_PATHS,
2803
- CampUiExploredStatus,
2804
- isCampUiExploredTool,
2805
2804
  campUiExploredReadPath,
2806
2805
  campUiExploredReadRange,
2807
- renderCampUiExploredGroup,
2808
- CAMP_UI_DEFAULT_TOOL_PREVIEW_LINES,
2809
- CAMP_UI_BASH_PREVIEW_LINES,
2810
- resetCampUiToolResultCache,
2806
+ campUiMessageSignature,
2807
+ campUiPendingAskBlockRenderer,
2808
+ campUiPendingAskTargets,
2809
+ campUiResultSignature,
2810
+ campUiSubscriptionRetryDelay,
2811
2811
  campUiToolResultCacheSize,
2812
- renderCampUiToolResult,
2813
2812
  campUiTranscriptBlockRenderer,
2813
+ compactNumber,
2814
+ composeCampUiDetailBlocks,
2815
+ composeCampUiSlots,
2816
+ decorateDefaultCampUiSections,
2814
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,
2815
2833
  makeCampUiDetailComponent,
2816
- makeDefaultCampUiContributions,
2834
+ makeCampUiIntentHandler,
2835
+ makeCampUiIntentRouter,
2836
+ makeCampUiModel,
2817
2837
  makeCampUiSection,
2818
- decorateDefaultCampUiSections,
2819
- PiCampUiRoot,
2820
- 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,
2821
2856
  runCampUiPresentationClock,
2822
- CAMP_UI_SUBSCRIPTION_MAX_RETRIES,
2823
- CAMP_UI_SUBSCRIPTION_BASE_DELAY_MS,
2824
- campUiSubscriptionRetryDelay,
2825
2857
  sameCampUiRuntimeHealth,
2826
- mountPiCampUi,
2827
- PiCampRunSelectorRoot,
2828
2858
  selectCampRun,
2829
- PACKAGE
2859
+ styleCampUiTone,
2860
+ uniqueCampUiNames
2830
2861
  };