@cmodjs/core 5.6.0 → 5.7.0

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.
@@ -15,7 +15,7 @@ import { formatExit, messageOf } from '../utils/text.js'
15
15
  import { beforeAnswerKeys, foldBefore, installBefore, relayOf, type Decide, type Place } from './before.js'
16
16
  import type { Claude } from './claude.js'
17
17
  import { cmodPluginName, isNotInstalled } from './dependencies.js'
18
- import { readLines, runCmod, spawnCmod } from './programs.js'
18
+ import { newestCmodVersion, readLines, runCmod, spawnCmod } from './programs.js'
19
19
  import type { RoutedHook, Router } from './router.js'
20
20
  import { PassedTimeout } from './deadline.js'
21
21
  import { conversationMethods, everySession, isAct, isHeardBy, isInScope, pickedColor, resultOf, spawnTask, usageOf, type Act, type Listened, type SessionColor } from './sessions.js'
@@ -98,6 +98,7 @@ export function serveConversations({
98
98
  const ownWatches = new Map<string, Watch>()
99
99
  let watchers: readonly Watcher[] = []
100
100
  let watching: Promise<void> = Promise.resolve()
101
+ let hasReadWatchers = false
101
102
  let published = new Set<string>()
102
103
  let publishing: Promise<unknown> = Promise.resolve()
103
104
  let session = ''
@@ -190,22 +191,27 @@ export function serveConversations({
190
191
  follower?.stop()
191
192
  follower = undefined
192
193
  if (args.length === 0) return
194
+ const version = newestCmodVersion(claude)
193
195
  const stream = spawnCmod(claude, ['history', 'follow', ...args, '--json', '--project', project()], session)
194
196
  const started = { sessions: wanted, stop: () => void stream.return(undefined as never) }
195
197
  follower = started
196
- void readLines(stream, (line) => {
198
+ const followed = readLines(stream, (line) => {
197
199
  if (line.trim() === '') return
198
200
  const parsed = JSON.parse(line) as { readonly session: string; readonly isInProject: boolean; readonly change: SessionChange }
199
201
  dispatch(parsed.session, [parsed.change], parsed.isInProject)
200
202
  })
201
- .then(({ code, lastError }) => {
203
+ void Promise.all([version, followed])
204
+ .then(([, { code, lastError }]) => {
202
205
  if (follower === started) throw new Error(`cmod history follow ${formatExit(code, lastError)}`)
203
206
  })
204
- .catch((error: unknown) => {
207
+ .catch(async (error: unknown) => {
205
208
  if (follower !== started) return
206
209
  follower = undefined
207
- report('follow', 'Stopped hearing the other sessions', error)
210
+ started.stop()
211
+ if ((await newestCmodVersion(claude)) === (await version)) throw error
212
+ follow()
208
213
  })
214
+ .catch((error: unknown) => report('follow', 'Stopped hearing the other sessions', error))
209
215
  }
210
216
 
211
217
  const follow = () => void restartFollower().catch((error: unknown) => report('follow', 'Stopped hearing the other sessions', error))
@@ -391,8 +397,8 @@ export function serveConversations({
391
397
  return false
392
398
  }
393
399
 
394
- const refuses = (watcher: Watcher, event: BeforeEvent, change: SessionChange) =>
395
- beforeAnswerKeys[event].includes('refuse') && (watcher.refusing ?? []).some(({ event: heard, matcher, scope }) => isInScope(scope ?? {}, session, change, isUnderHere) && isHeardBy(heard, matcher === undefined ? undefined : receivedMatcher(matcher), change))
400
+ const refuses = (watcher: Watcher, event: BeforeEvent, change: SessionChange | undefined) =>
401
+ beforeAnswerKeys[event].includes('refuse') && (watcher.refusing ?? []).some(({ event: heard, matcher, scope }) => (change === undefined ? heard === event : isInScope(scope ?? {}, session, change, isUnderHere) && isHeardBy(heard, matcher === undefined ? undefined : receivedMatcher(matcher), change)))
396
402
 
397
403
  const askAway = async (watcher: Watcher, event: BeforeEvent, change: SessionChange, endsAt: number) => {
398
404
  try {
@@ -416,10 +422,17 @@ export function serveConversations({
416
422
  }
417
423
 
418
424
  const wants = async (event: BeforeEvent) => {
419
- await Promise.all([starting, watching])
425
+ await watching
420
426
  return deciders(event).length > 0
421
427
  }
422
428
 
429
+ const failedBefore = (event: BeforeEvent, change: (where: Place) => SessionChange | undefined, error: Error) => {
430
+ if (!hasReadWatchers) return { refuse: `${cmodPluginName}: ${error.message}` }
431
+ const changed = change(place())
432
+ const refusing = deciders(event).find((watcher) => refuses(watcher, event, changed))
433
+ return refusing === undefined ? undefined : { refuse: `${refusing.mod}: ${error.message}` }
434
+ }
435
+
423
436
  const decide = (cancel?: AbortSignal): Decide => {
424
437
  let endsAt: Promise<number> | undefined
425
438
  return (event, change) =>
@@ -458,6 +471,7 @@ export function serveConversations({
458
471
  },
459
472
  wants,
460
473
  fold: decide,
474
+ failedBefore,
461
475
  },
462
476
  })
463
477
 
@@ -487,6 +501,10 @@ export function serveConversations({
487
501
  .then(follow)
488
502
  starting = Promise.all([starting, restored]).then(() => undefined)
489
503
  reloadWatchers()
504
+ hasReadWatchers = false
505
+ void watching.then(() => {
506
+ if (session === id) hasReadWatchers = true
507
+ })
490
508
  if (subscribed.size > 0) void Promise.all([previous === '' ? undefined : clearListeners(previous), saveListeners()]).catch((error: unknown) => report('follow', 'Kept telling the mods about the session from before', error))
491
509
  if (ownWatches.size === 0) return
492
510
  void Promise.all([previous === '' ? undefined : clearWatches(previous), publishWatches()]).catch((error: unknown) => report('before', 'Kept its before listeners on the session from before', error))
@@ -3,7 +3,7 @@ import type { Step } from '../installer.js'
3
3
 
4
4
  import type { Imports, Mod, ModDefinition, Reservation, SettingsFile, SettingsFileChange, SettingsFileChangeListener, Subscription, Timer as ModTimer } from '../mod.js'
5
5
  import type { Options, OptionValues } from '../options.js'
6
- import { dataFolder, finishStepsMethod, isAtLeast, isProgramNewer, oldestCmodVersion, pendingStepsMethod, parseEvent, programPath, readCmodVersion, readRecord, readSteps, recordPath, scriptsSha256, storeFolder, type ReadFile, type RunnerEvent, type Steps } from '../records.js'
6
+ import { dataFolder, finishStepsMethod, isAtLeast, isProgramNewer, oldestCmodVersion, pendingStepsMethod, parseEvent, programPath, readRecord, readSteps, recordPath, scriptsSha256, storeFolder, type ReadFile, type RunnerEvent, type Steps } from '../records.js'
7
7
  import { homePrefix, ifMissing, relativePath } from '../utils/paths.js'
8
8
  import { firstLine, formatExit, messageOf } from '../utils/text.js'
9
9
  import type { Claude } from './claude.js'
@@ -16,7 +16,7 @@ import type { Device } from '../session/context/turn/device.js'
16
16
  import { keepEngine } from './engine.js'
17
17
  import { classicFailure, classicHook, userSkillHook, type Hook, type HookFields, type HookListener, type RoutedEvent } from './hooks.js'
18
18
  import type { PermissionRoutes } from './permission-check.js'
19
- import { cmodError, locatingPrograms, readLines, spawnCmod, type Programs } from './programs.js'
19
+ import { cmodError, locatingPrograms, newestCmodVersion, readLines, spawnCmod, type Programs } from './programs.js'
20
20
  import { createModFiles, resolvedPath, type Places } from './metadata.js'
21
21
  import { fitsOption } from '../options.js'
22
22
  import { createInstaller } from './installer.js'
@@ -128,7 +128,7 @@ export async function readPlugin(claude: Claude): Promise<Plugin> {
128
128
  const store = storeFolder({ HOME: await claude.env.home(), XDG_DATA_HOME: await claude.env.dataHome() })
129
129
  const steps = readSteps(await readJson(read, `${root}/package.json`)) ?? {}
130
130
  if (name === cmodPluginName) {
131
- const installed = await cmodVersion(claude)
131
+ const installed = await newestCmodVersion(claude)
132
132
  return { name, root, version, store, steps, isInstalled: version !== undefined && installed !== undefined && isAtLeast(installed, version), shouldRecord: false }
133
133
  }
134
134
  const plugin = { name, root, version, store, steps }
@@ -166,17 +166,6 @@ async function readJson(read: ReadFile, path: string): Promise<unknown> {
166
166
  }
167
167
  }
168
168
 
169
- async function cmodVersion(claude: Claude): Promise<string | undefined> {
170
- const store = storeFolder({ HOME: await claude.env.home(), XDG_DATA_HOME: await claude.env.dataHome() })
171
- return readCmodVersion(
172
- {
173
- list: async (folder) => (await claude.fs.list(folder).catch(ifMissing([]))).map((entry) => entry.name),
174
- exists: async (path) => (await claude.fs.stat(path).catch(ifMissing(undefined))) !== undefined,
175
- },
176
- store,
177
- )
178
- }
179
-
180
169
  export function createLifecycle<State extends object, Declared extends Options = Options>(
181
170
  definition: ModDefinition<State, string, Declared>,
182
171
  permissionRoutes: () => PermissionRoutes | undefined = () => undefined,
@@ -184,6 +173,7 @@ export function createLifecycle<State extends object, Declared extends Options =
184
173
  asksPerson = true,
185
174
  ): Lifecycle<State> {
186
175
  let router: Router = createRouter()
176
+ let startingRouter: Router | undefined
187
177
  let phase: Phase = 'starting'
188
178
  let runtime: Pick<ModRuntime, 'claude' | 'toaster'> | undefined
189
179
  let programs: Programs | undefined
@@ -286,7 +276,7 @@ export function createLifecycle<State extends object, Declared extends Options =
286
276
  }
287
277
 
288
278
  const recordThroughCmod = async () => {
289
- if (plugin === undefined || (await cmodVersion(claude())) === undefined) return
279
+ if (plugin === undefined || (await newestCmodVersion(claude())) === undefined) return
290
280
  let failed: string | undefined
291
281
  const { code, lastError } = await readLines(claude().process.spawn({ argv: ['cmod', 'setup', plugin.root, '--events'] }), (text) => {
292
282
  const event = parseEvent(text)
@@ -372,12 +362,17 @@ export function createLifecycle<State extends object, Declared extends Options =
372
362
  const activate = async (): Promise<void> => {
373
363
  if (runtime === undefined || plugin === undefined) return
374
364
  const activeRouter = createRouter()
375
- const active = await createMod(definition, { ...runtime, router: activeRouter, dataFolder: dataFolder(plugin.store, plugin.name), store: plugin.store, permissionRoutes, options: pluginOptions, nextDraw }).catch(async (error: unknown) => {
376
- if (error instanceof MissingOptions && (await askOptions(error))) return undefined
377
- await installer.close()
378
- fail(messageOf(error), error instanceof MissingOptions ? `Retry asks for ${error.keys.length === 1 ? 'it' : 'them'}.` : undefined, begin, error)
379
- throw error
380
- })
365
+ startingRouter = activeRouter
366
+ const active = await createMod(definition, { ...runtime, router: activeRouter, dataFolder: dataFolder(plugin.store, plugin.name), store: plugin.store, permissionRoutes, options: pluginOptions, nextDraw })
367
+ .catch(async (error: unknown) => {
368
+ if (error instanceof MissingOptions && (await askOptions(error))) return undefined
369
+ await installer.close()
370
+ fail(messageOf(error), error instanceof MissingOptions ? `Retry asks for ${error.keys.length === 1 ? 'it' : 'them'}.` : undefined, begin, error)
371
+ throw error
372
+ })
373
+ .finally(() => {
374
+ startingRouter = undefined
375
+ })
381
376
  if (active === undefined) return activate()
382
377
  const { added } = active
383
378
  mod = active.mod
@@ -429,7 +424,7 @@ export function createLifecycle<State extends object, Declared extends Options =
429
424
  if (plugin === undefined) return
430
425
  if (plugin.name === cmodPluginName) return bootstrap(plugin.root)
431
426
  phase = 'installing'
432
- const found = await cmodVersion(claude())
427
+ const found = await newestCmodVersion(claude())
433
428
  if (!fits(found)) return waitForcmod(found)
434
429
  if (!isQuiet) installing()
435
430
  let outcome: RunnerEvent | undefined
@@ -460,7 +455,7 @@ export function createLifecycle<State extends object, Declared extends Options =
460
455
  }
461
456
  const poll = (ms: number) =>
462
457
  claude().clock.every(ms, () => {
463
- check ??= cmodVersion(claude())
458
+ check ??= newestCmodVersion(claude())
464
459
  .then((version) => {
465
460
  check = undefined
466
461
  latest = version
@@ -575,24 +570,24 @@ export function createLifecycle<State extends object, Declared extends Options =
575
570
  if (activation !== undefined && phase !== 'active') await activation
576
571
  }
577
572
 
578
- const held = (work: Promise<void>, signal: AbortSignal | undefined): Promise<void> =>
573
+ const held = (work: Promise<void>, signal: AbortSignal | undefined): Promise<boolean> =>
579
574
  runtime === undefined
580
- ? work
581
- : new Promise<void>((resolve) => {
582
- const limit = claude().clock.after(startHoldMs, resolve)
583
- if (signal?.aborted === true) resolve()
584
- signal?.addEventListener('abort', () => resolve(), { once: true })
575
+ ? work.then(() => false)
576
+ : new Promise<boolean>((resolve) => {
577
+ const limit = claude().clock.after(startHoldMs, () => resolve(true))
578
+ if (signal?.aborted === true) resolve(false)
579
+ signal?.addEventListener('abort', () => resolve(false), { once: true })
585
580
  void work.then(() => {
586
581
  limit.cancel()
587
- resolve()
582
+ resolve(false)
588
583
  })
589
584
  })
590
585
 
591
- const holdUntilStarted = (signal?: AbortSignal): Promise<void> => held(startSettled.then(whenActive), signal)
586
+ const holdUntilStarted = (signal?: AbortSignal): Promise<boolean> => held(startSettled.then(whenActive), signal)
592
587
 
593
- const holdUntilActive = (signal: AbortSignal | undefined): Promise<void> => {
588
+ const holdUntilActive = (signal: AbortSignal | undefined): Promise<boolean> => {
594
589
  const activating = whenActive()
595
- return activation !== undefined && phase !== 'active' ? held(activating, signal) : activating
590
+ return activation !== undefined && phase !== 'active' ? held(activating, signal) : activating.then(() => false)
596
591
  }
597
592
 
598
593
  const routed = async <N extends RoutedEvent>(event: N, e: Frozen<Args<N>>, next: RouterNext<N>, signal?: AbortSignal): Promise<EventResult<N>> => {
@@ -617,7 +612,7 @@ export function createLifecycle<State extends object, Declared extends Options =
617
612
  const tool = (e as { readonly tool?: unknown }).tool
618
613
  const isCallToThisMod = (event === 'cmod.call' && (e as Frozen<Args<'cmod.call'>>).to === definition.name) || (event === 'tool.call' && typeof tool === 'string' && tool.startsWith(`mcp__${definition.name}__`))
619
614
  if (event === 'cmod.call' && !isCallToThisMod) return next(e)
620
- await (event === 'classic.SessionStart' || event === 'session.append' || isCallToThisMod ? holdUntilStarted(signal) : holdUntilActive(signal))
615
+ const isLate = await (event === 'classic.SessionStart' || event === 'session.append' || isCallToThisMod ? holdUntilStarted(signal) : holdUntilActive(signal))
621
616
  if (event === 'classic.SessionStart' && phase !== 'active') {
622
617
  missedSessionStart = e as Frozen<Args<'classic.SessionStart'>>
623
618
  return next(e)
@@ -629,6 +624,7 @@ export function createLifecycle<State extends object, Declared extends Options =
629
624
  }
630
625
  return { deny: phase === 'failed' ? notSetUp() : `${definition.name} is installing. Try again when it's ready.` } as EventResult<N>
631
626
  }
627
+ if (isLate && phase !== 'active') return (startingRouter ?? router).dispatchFailure(event, e, new Error(`it was still starting after ${startHoldMs / 1000} s`), next, false)
632
628
  const call = e as Frozen<Args<'cmod.call'>>
633
629
  if (event === 'cmod.call' && call.to === definition.name && mod !== undefined) {
634
630
  if (call.method === pendingStepsMethod) return { value: await pendingSteps(mod) } as EventResult<N>
@@ -712,7 +708,7 @@ export function createLifecycle<State extends object, Declared extends Options =
712
708
  const error = new Error(reason)
713
709
  const failedBeneath = called && kind === 'throw' ? await next(e).then(() => undefined, messageOf) : undefined
714
710
  if (failedBeneath === undefined || failedBeneath !== message) toastFailure({ id: `stopped:${event}`, message: `Claude Code stopped its ${event.replace(/^classic\./, '')} hook`, error })
715
- return router.dispatchFailure(event, e, error, next)
711
+ return (startingRouter ?? router).dispatchFailure(event, e, error, next, called)
716
712
  },
717
713
  }
718
714
  }
@@ -1,5 +1,5 @@
1
1
  import type { HookStream, ProcessSpawnChunk, ProcessSpawnResult } from 'claude-code'
2
- import { storeFolder } from '../records.js'
2
+ import { readCmodVersion, storeFolder } from '../records.js'
3
3
  import { ifMissing } from '../utils/paths.js'
4
4
  import { formatExit } from '../utils/text.js'
5
5
  import type { Claude } from './claude.js'
@@ -46,6 +46,17 @@ export async function isHeld(claude: Claude, lock: string, staleMs: number): Pro
46
46
  return touched.some((at) => now - at < staleMs)
47
47
  }
48
48
 
49
+ export async function newestCmodVersion(claude: Claude): Promise<string | undefined> {
50
+ const store = storeFolder({ HOME: await claude.env.home(), XDG_DATA_HOME: await claude.env.dataHome() })
51
+ return readCmodVersion(
52
+ {
53
+ list: async (folder) => (await claude.fs.list(folder).catch(ifMissing([]))).map((entry) => entry.name),
54
+ exists: async (path) => (await claude.fs.stat(path).catch(ifMissing(undefined))) !== undefined,
55
+ },
56
+ store,
57
+ )
58
+ }
59
+
49
60
  export async function runCmod(claude: Claude, args: readonly string[], session: string): Promise<string> {
50
61
  const lines: string[] = []
51
62
  const { code, lastError } = await readLines(spawnCmod(claude, args, session), (line) => void lines.push(line))
@@ -8,17 +8,17 @@ export type RoutedNext<N extends RoutedEvent> = RouterNext<N> & { readonly signa
8
8
 
9
9
  export type RoutedHook<N extends RoutedEvent> = (e: Frozen<Args<N>>, next: RoutedNext<N>) => EventResult<N> | Promise<EventResult<N>>
10
10
 
11
- export type RoutedFailure<N extends RoutedEvent> = (e: Frozen<Args<N>>, error: Error, next: RoutedNext<N>) => EventResult<N> | undefined | Promise<EventResult<N> | undefined>
11
+ export type RoutedFailure<N extends RoutedEvent> = (e: Frozen<Args<N>>, error: Error, next: RoutedNext<N> & { readonly called: boolean }) => EventResult<N> | undefined | Promise<EventResult<N> | undefined>
12
12
 
13
13
  export type Router = {
14
14
  add<N extends RoutedEvent>(event: N, hook: RoutedHook<N>, failed?: RoutedFailure<N>): Subscription
15
15
  dispatch<N extends RoutedEvent>(event: N, e: Frozen<Args<N>>, next: RouterNext<N>, signal?: AbortSignal): Promise<EventResult<N>>
16
- dispatchFailure<N extends RoutedEvent>(event: N, e: Frozen<Args<N>>, error: Error, next: RouterNext<N>): Promise<EventResult<N>>
16
+ dispatchFailure<N extends RoutedEvent>(event: N, e: Frozen<Args<N>>, error: Error, next: RouterNext<N>, called: boolean): Promise<EventResult<N>>
17
17
  }
18
18
 
19
19
  type Next = ((e: unknown) => Promise<unknown>) & { readonly signal: AbortSignal }
20
20
 
21
- type Route = { readonly hook: (e: unknown, next: Next) => unknown; readonly failed?: (e: unknown, error: Error, next: Next) => unknown }
21
+ type Route = { readonly hook: (e: unknown, next: Next) => unknown; readonly failed?: (e: unknown, error: Error, next: Next & { readonly called: boolean }) => unknown }
22
22
 
23
23
  export const unaborted = new AbortController().signal
24
24
 
@@ -46,13 +46,15 @@ export function createRouter(): Router {
46
46
  }
47
47
  return call(0, e) as Promise<EventResult<N>>
48
48
  },
49
- async dispatchFailure<N extends RoutedEvent>(event: N, e: Frozen<Args<N>>, error: Error, next: RouterNext<N>): Promise<EventResult<N>> {
50
- const signalled = Object.assign((passed: unknown) => next(passed as Frozen<Args<N>>), { signal: unaborted })
51
- for (const route of routes.get(event) ?? []) {
52
- const answer = await route.failed?.(e, error, signalled)
53
- if (answer !== undefined) return answer as EventResult<N>
49
+ dispatchFailure<N extends RoutedEvent>(event: N, e: Frozen<Args<N>>, error: Error, next: RouterNext<N>, called: boolean): Promise<EventResult<N>> {
50
+ const chain = routes.get(event)
51
+ const fail = async (index: number, current: unknown): Promise<unknown> => {
52
+ const route = chain?.[index]
53
+ if (route === undefined) return next(current as Frozen<Args<N>>)
54
+ const answer = await route.failed?.(current, error, Object.assign((passed: unknown) => fail(index + 1, passed), { signal: unaborted, called }))
55
+ return answer === undefined ? fail(index + 1, current) : answer
54
56
  }
55
- return next(e)
57
+ return fail(0, e) as Promise<EventResult<N>>
56
58
  },
57
59
  }
58
60
  }
@@ -314,7 +314,7 @@ export function createToaster(claude: Claude, name: string, version: () => strin
314
314
  changed()
315
315
  }
316
316
 
317
- const row = (entry: Entry): RenderElement => {
317
+ const row = (entry: Entry, columns: number): RenderElement => {
318
318
  const { description } = entry.options
319
319
  const isText = typeof description === 'string'
320
320
  const icon = entry.type === 'loading' || entry.trying !== undefined ? { glyph: isSpinning(entry) ? (spinner[frame % spinner.length] as string) : still, color: 'claude' } : icons[entry.type]
@@ -323,17 +323,25 @@ export function createToaster(claude: Claude, name: string, version: () => strin
323
323
  const fixed = (child: RenderElement) => Box({ flexShrink: 0, children: child })
324
324
  const close = Button({ plain: true, dimColor: true, key: `toast:${entry.id}:close`, label: entry.hides === undefined ? '✕' : 'Hide', onPress: () => hide(entry) })
325
325
  const actions = entry.actions.map((action, index) => Button({ plain: true, key: `toast:${entry.id}:${index === 0 ? 'action' : `action-${index}`}`, label: action.label, onPress: press(entry, action.onClick) }))
326
- const buttons = Box({ gap: 2, flexWrap: 'wrap', children: [...actions, close, Text({ dimColor: true, children: clockTime(entry.at) })].map(fixed) })
326
+ const buttons = Box({ gap: 2, flexWrap: 'wrap', children: [...actions, Text({ dimColor: true, children: clockTime(entry.at) })].map(fixed) })
327
327
  const trying = entry.trying === undefined ? undefined : Box({ gap: 1, children: [Text({ dimColor: true, children: 'Trying again:' }), typeof entry.trying === 'string' ? Text({ dimColor: true, wrap: 'truncate-end', children: entry.trying }) : entry.trying] })
328
328
  const text = details === undefined ? [message] : [message, trying ?? details]
329
329
  const under = trying !== undefined && details === undefined ? [trying] : entry.reporting === undefined ? [buttons] : reportChoices(entry, entry.reporting)
330
330
  return Box({
331
+ width: columns,
331
332
  gap: 2,
333
+ justifyContent: 'space-between',
332
334
  children: [
333
- fixed(Text({ ...(icon.color === undefined ? {} : { color: icon.color }), children: icon.glyph })),
334
- fixed(Text({ dimColor: true, children: name })),
335
- Box({ flexDirection: 'column', flexGrow: 1, flexShrink: 1, children: entry.hides === undefined ? text : [...text, ...under] }),
336
- ...(entry.hides === undefined ? [...actions.map(fixed), fixed(close)] : []),
335
+ Box({
336
+ gap: 2,
337
+ flexShrink: 1,
338
+ children: [
339
+ fixed(Text({ ...(icon.color === undefined ? {} : { color: icon.color }), children: icon.glyph })),
340
+ fixed(Text({ dimColor: true, children: name })),
341
+ Box({ flexDirection: 'column', flexShrink: 1, children: entry.hides === undefined ? text : [...text, ...under] }),
342
+ ],
343
+ }),
344
+ Box({ gap: 2, flexShrink: 0, alignSelf: 'flex-end', children: entry.hides === undefined ? [...actions, close] : [close] }),
337
345
  ],
338
346
  })
339
347
  }
@@ -397,7 +405,7 @@ export function createToaster(claude: Claude, name: string, version: () => strin
397
405
  changed()
398
406
  },
399
407
  })
400
- return drawWith(table, () => Box({ flexDirection: 'column', children: [drawn, ...(hidden > 0 ? [more] : []), ...all.slice(hidden).map(row)] }))
408
+ return drawWith(table, () => Box({ flexDirection: 'column', children: [drawn, ...(hidden > 0 ? [more] : []), ...all.slice(hidden).map((entry) => row(entry, band.bodyColumns))] }))
401
409
  },
402
410
  }
403
411
  }
@@ -132,7 +132,7 @@ function boxRows({ props, children = [] }: Drawn, width: number): string[] {
132
132
  const ordered = direction.endsWith('-reverse') ? [...flowing].reverse() : flowing
133
133
  const outer = Math.min(width, size('width') ?? width)
134
134
  const inner = outer - left - right - border * 2
135
- const rows = direction.startsWith('column') ? stacked(ordered, inner, size('rowGap') ?? size('gap') ?? 0) : sideBySide(ordered, inner, size('columnGap') ?? size('gap') ?? 0, props['justifyContent'] === 'space-between')
135
+ const rows = direction.startsWith('column') ? stacked(ordered, inner, size('rowGap') ?? size('gap') ?? 0) : sideBySide(ordered, inner, size('columnGap') ?? size('gap') ?? 0, props['justifyContent'] === 'space-between', props['alignItems'])
136
136
  const content = border === 1 && Number.isFinite(inner) ? inner : right === 0 && border === 0 ? 0 : Math.max(widthOf(rows), (size('minWidth') ?? 0) - left - right - border * 2)
137
137
  const padded = [...blankRows(space('Top', 'Y')), ...rows.map((row) => `${' '.repeat(left)}${paddedTo(row, content)}${' '.repeat(right)}`), ...blankRows(space('Bottom', 'Y'))]
138
138
  const framed = border === 0 ? padded : framedRows(padded, left + content + right, props['borderStyle'])
@@ -176,7 +176,7 @@ function stacked(children: readonly RenderNode[], width: number, gap: number): s
176
176
  return blocks.flatMap((block, index) => [...blankRows(index === 0 ? 0 : gap), ...block])
177
177
  }
178
178
 
179
- function sideBySide(children: readonly RenderNode[], width: number, gap: number, isSpread = false): string[] {
179
+ function sideBySide(children: readonly RenderNode[], width: number, gap: number, isSpread: boolean, alignItems: unknown): string[] {
180
180
  const laid = children
181
181
  .map((child) => ({ child, natural: rowsOf(child, Number.POSITIVE_INFINITY) }))
182
182
  .filter(({ natural }) => natural.length > 0)
@@ -189,7 +189,19 @@ function sideBySide(children: readonly RenderNode[], width: number, gap: number,
189
189
  const spaces = blocks.length - 1
190
190
  const free = isSpread && Number.isFinite(width) ? Math.max(width - columns.reduce((sum, each) => sum + each, 0) - gap * spaces, 0) : 0
191
191
  const gapAfter = (index: number) => gap + Math.floor(free / spaces) + (index < free % spaces ? 1 : 0)
192
- return Array.from({ length: height }, (_, row) => blocks.map((block, index) => `${paddedTo(block[row] ?? '', index === spaces ? 0 : (columns[index] ?? 0))}${index === spaces ? '' : ' '.repeat(gapAfter(index))}`).join(''))
192
+ const tops = laid.map(({ child }, index) => topOf(alignOf(child, alignItems), height - (blocks[index]?.length ?? 0)))
193
+ return Array.from({ length: height }, (_, row) => blocks.map((block, index) => `${paddedTo(block[row - (tops[index] ?? 0)] ?? '', index === spaces ? 0 : (columns[index] ?? 0))}${index === spaces ? '' : ' '.repeat(gapAfter(index))}`).join(''))
194
+ }
195
+
196
+ function alignOf(node: RenderNode, alignItems: unknown): unknown {
197
+ const alignSelf = typeof node === 'string' ? undefined : insideOf(node).props['alignSelf']
198
+ return alignSelf === undefined || alignSelf === 'auto' ? alignItems : alignSelf
199
+ }
200
+
201
+ function topOf(align: unknown, spare: number): number {
202
+ if (align === 'flex-end') return spare
203
+ if (align === 'center') return Math.floor(spare / 2)
204
+ return 0
193
205
  }
194
206
 
195
207
  function minWidthOf(node: RenderNode): number {
package/src/testing.ts CHANGED
@@ -425,6 +425,7 @@ export function testMod<State extends object, Declared extends Options = Options
425
425
  place: async () => conversations.place(),
426
426
  wants: async (event) => conversations.wants(name, event),
427
427
  fold: decide,
428
+ failedBefore: () => undefined,
428
429
  },
429
430
  })
430
431
 
@@ -139,7 +139,7 @@ function boxRows({ props, children = [] }, width) {
139
139
  const ordered = direction.endsWith('-reverse') ? [...flowing].reverse() : flowing;
140
140
  const outer = Math.min(width, size('width') ?? width);
141
141
  const inner = outer - left - right - border * 2;
142
- const rows = direction.startsWith('column') ? stacked(ordered, inner, size('rowGap') ?? size('gap') ?? 0) : sideBySide(ordered, inner, size('columnGap') ?? size('gap') ?? 0, props['justifyContent'] === 'space-between');
142
+ const rows = direction.startsWith('column') ? stacked(ordered, inner, size('rowGap') ?? size('gap') ?? 0) : sideBySide(ordered, inner, size('columnGap') ?? size('gap') ?? 0, props['justifyContent'] === 'space-between', props['alignItems']);
143
143
  const content = border === 1 && Number.isFinite(inner) ? inner : right === 0 && border === 0 ? 0 : Math.max(widthOf(rows), (size('minWidth') ?? 0) - left - right - border * 2);
144
144
  const padded = [...blankRows(space('Top', 'Y')), ...rows.map((row) => `${' '.repeat(left)}${paddedTo(row, content)}${' '.repeat(right)}`), ...blankRows(space('Bottom', 'Y'))];
145
145
  const framed = border === 0 ? padded : framedRows(padded, left + content + right, props['borderStyle']);
@@ -176,7 +176,7 @@ function stacked(children, width, gap) {
176
176
  const blocks = children.map((child) => rowsOf(child, width)).filter((block) => block.length > 0);
177
177
  return blocks.flatMap((block, index) => [...blankRows(index === 0 ? 0 : gap), ...block]);
178
178
  }
179
- function sideBySide(children, width, gap, isSpread = false) {
179
+ function sideBySide(children, width, gap, isSpread, alignItems) {
180
180
  const laid = children
181
181
  .map((child) => ({ child, natural: rowsOf(child, Number.POSITIVE_INFINITY) }))
182
182
  .filter(({ natural }) => natural.length > 0)
@@ -189,7 +189,19 @@ function sideBySide(children, width, gap, isSpread = false) {
189
189
  const spaces = blocks.length - 1;
190
190
  const free = isSpread && Number.isFinite(width) ? Math.max(width - columns.reduce((sum, each) => sum + each, 0) - gap * spaces, 0) : 0;
191
191
  const gapAfter = (index) => gap + Math.floor(free / spaces) + (index < free % spaces ? 1 : 0);
192
- return Array.from({ length: height }, (_, row) => blocks.map((block, index) => `${paddedTo(block[row] ?? '', index === spaces ? 0 : (columns[index] ?? 0))}${index === spaces ? '' : ' '.repeat(gapAfter(index))}`).join(''));
192
+ const tops = laid.map(({ child }, index) => topOf(alignOf(child, alignItems), height - (blocks[index]?.length ?? 0)));
193
+ return Array.from({ length: height }, (_, row) => blocks.map((block, index) => `${paddedTo(block[row - (tops[index] ?? 0)] ?? '', index === spaces ? 0 : (columns[index] ?? 0))}${index === spaces ? '' : ' '.repeat(gapAfter(index))}`).join(''));
194
+ }
195
+ function alignOf(node, alignItems) {
196
+ const alignSelf = typeof node === 'string' ? undefined : insideOf(node).props['alignSelf'];
197
+ return alignSelf === undefined || alignSelf === 'auto' ? alignItems : alignSelf;
198
+ }
199
+ function topOf(align, spare) {
200
+ if (align === 'flex-end')
201
+ return spare;
202
+ if (align === 'center')
203
+ return Math.floor(spare / 2);
204
+ return 0;
193
205
  }
194
206
  function minWidthOf(node) {
195
207
  if (typeof node === 'string')
package/testing.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EAEJ,gBAAgB,EAIhB,WAAW,EAUX,eAAe,EAGhB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AA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,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7C,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACxD,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC7E,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC/B,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAA;IACnC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CACtB,CAAA;AAqBD,wBAAgB,OAAO,CAAC,KAAK,SAAS,MAAM,EAAE,QAAQ,SAAS,OAAO,GAAG,OAAO,EAAE,UAAU,EAAE,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAE,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CA2oBlM"}
package/testing.js CHANGED
@@ -345,6 +345,7 @@ export function testMod(definition, options = {}) {
345
345
  place: async () => conversations.place(),
346
346
  wants: async (event) => conversations.wants(name, event),
347
347
  fold: decide,
348
+ failedBefore: () => undefined,
348
349
  },
349
350
  });
350
351
  const route = async (event, input, below, signal) => {