@cmodjs/core 8.9.1 → 8.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/docs/commands.md +13 -11
  2. package/docs/dependencies.md +6 -3
  3. package/docs/index.md +1 -1
  4. package/docs/jobs.md +1 -1
  5. package/docs/mod.md +1 -1
  6. package/docs/session.md +8 -7
  7. package/docs/testing.md +2 -2
  8. package/docs/ui.md +6 -5
  9. package/jobs/program.d.ts.map +1 -1
  10. package/jobs/program.js +5 -4
  11. package/mod.d.ts +34 -5
  12. package/mod.d.ts.map +1 -1
  13. package/package.json +1 -1
  14. package/records.d.ts +4 -2
  15. package/records.d.ts.map +1 -1
  16. package/records.js +6 -3
  17. package/register.d.ts.map +1 -1
  18. package/register.js +14 -5
  19. package/rpc.d.ts.map +1 -1
  20. package/rpc.js +1 -0
  21. package/runtime/bun.d.ts +7 -2
  22. package/runtime/bun.d.ts.map +1 -1
  23. package/runtime/bun.js +61 -7
  24. package/runtime/conversations.d.ts +3 -1
  25. package/runtime/conversations.d.ts.map +1 -1
  26. package/runtime/conversations.js +43 -36
  27. package/runtime/device.d.ts +2 -1
  28. package/runtime/device.d.ts.map +1 -1
  29. package/runtime/device.js +22 -1
  30. package/runtime/drawing-rules.d.ts +9 -0
  31. package/runtime/drawing-rules.d.ts.map +1 -0
  32. package/runtime/drawing-rules.js +46 -0
  33. package/runtime/engine.d.ts +3 -1
  34. package/runtime/engine.d.ts.map +1 -1
  35. package/runtime/hooks.d.ts +1 -1
  36. package/runtime/hooks.d.ts.map +1 -1
  37. package/runtime/hotkeys.d.ts.map +1 -1
  38. package/runtime/hotkeys.js +0 -7
  39. package/runtime/installer.js +3 -3
  40. package/runtime/interfaces.d.ts +47 -8
  41. package/runtime/interfaces.d.ts.map +1 -1
  42. package/runtime/interfaces.js +152 -15
  43. package/runtime/lifecycle.d.ts.map +1 -1
  44. package/runtime/lifecycle.js +61 -29
  45. package/runtime/parts.d.ts +2 -2
  46. package/runtime/parts.d.ts.map +1 -1
  47. package/runtime/parts.js +61 -35
  48. package/runtime/rpc.d.ts +11 -3
  49. package/runtime/rpc.d.ts.map +1 -1
  50. package/runtime/rpc.js +56 -19
  51. package/runtime/sessions.d.ts +2 -1
  52. package/runtime/sessions.d.ts.map +1 -1
  53. package/runtime/sessions.js +11 -4
  54. package/runtime/ui.d.ts +1 -0
  55. package/runtime/ui.d.ts.map +1 -1
  56. package/runtime/ui.js +62 -45
  57. package/runtime/widgets.d.ts +4 -2
  58. package/runtime/widgets.d.ts.map +1 -1
  59. package/runtime/widgets.js +6 -5
  60. package/session/session.d.ts +5 -1
  61. package/session/session.d.ts.map +1 -1
  62. package/src/jobs/program.ts +5 -4
  63. package/src/mod.ts +12 -4
  64. package/src/records.ts +8 -4
  65. package/src/register.ts +15 -5
  66. package/src/rpc.ts +2 -1
  67. package/src/runtime/bun.ts +58 -6
  68. package/src/runtime/conversations.ts +45 -36
  69. package/src/runtime/device.ts +21 -1
  70. package/src/runtime/drawing-rules.ts +42 -0
  71. package/src/runtime/engine.ts +3 -1
  72. package/src/runtime/hooks.ts +0 -1
  73. package/src/runtime/hotkeys.ts +0 -7
  74. package/src/runtime/installer.ts +3 -3
  75. package/src/runtime/interfaces.ts +188 -22
  76. package/src/runtime/lifecycle.ts +63 -29
  77. package/src/runtime/parts.ts +61 -33
  78. package/src/runtime/rpc.ts +65 -20
  79. package/src/runtime/sessions.ts +11 -5
  80. package/src/runtime/ui.ts +61 -38
  81. package/src/runtime/widgets.ts +9 -5
  82. package/src/session/session.ts +3 -1
  83. package/src/testing/fake-elements.ts +7 -23
  84. package/src/testing/fake-serve.ts +51 -9
  85. package/src/testing/fake-sessions.ts +5 -3
  86. package/src/testing.ts +9 -3
  87. package/src/ui/components.ts +13 -14
  88. package/src/ui/elements.ts +4 -4
  89. package/src/ui/palette.ts +38 -0
  90. package/src/ui/styles.ts +2 -0
  91. package/testing/fake-elements.d.ts.map +1 -1
  92. package/testing/fake-elements.js +9 -26
  93. package/testing/fake-serve.d.ts +6 -1
  94. package/testing/fake-serve.d.ts.map +1 -1
  95. package/testing/fake-serve.js +42 -5
  96. package/testing/fake-sessions.d.ts +1 -0
  97. package/testing/fake-sessions.d.ts.map +1 -1
  98. package/testing/fake-sessions.js +4 -2
  99. package/testing.d.ts.map +1 -1
  100. package/testing.js +12 -4
  101. package/ui/components.d.ts.map +1 -1
  102. package/ui/components.js +12 -13
  103. package/ui/elements.d.ts +2 -1
  104. package/ui/elements.d.ts.map +1 -1
  105. package/ui/elements.js +3 -3
  106. package/ui/palette.d.ts +17 -0
  107. package/ui/palette.d.ts.map +1 -0
  108. package/ui/palette.js +20 -0
  109. package/ui/styles.d.ts +1 -0
  110. package/ui/styles.d.ts.map +1 -1
  111. package/ui/styles.js +1 -0
@@ -8,6 +8,7 @@ import { ifMissing } from '../utils/paths.js'
8
8
  import { messageOf } from '../utils/text.js'
9
9
  import type { Claude } from './claude.js'
10
10
  import { cmodPluginName, isNotInstalled, isStillInstalling } from './dependencies.js'
11
+ import type { StorePart } from './interfaces.js'
11
12
  import type { DrawnParts } from './parts.js'
12
13
  import type { Router } from './router.js'
13
14
  import { partMethods, styledAt, viewportColumns, type PartsUpdate, type WidgetDeclaration } from './ui.js'
@@ -41,7 +42,7 @@ const widgetSizes = { fit: { flexShrink: 0 }, fill: { flexGrow: 1, flexShrink: 1
41
42
  const separator = ''
42
43
 
43
44
  export type Widgets = {
44
- update(mod: string, update: Pick<PartsUpdate, 'parts' | 'redraw'>): void
45
+ update(mod: string, update: Pick<PartsUpdate, 'parts' | 'redraw' | 'changed'>): void
45
46
  widgets(): readonly PlacedWidget[]
46
47
  layout(): WidgetLayout
47
48
  change(edit: (layout: WidgetLayout) => WidgetLayout): Promise<void>
@@ -118,6 +119,7 @@ export function serveWidgets({
118
119
  turnClosedBy,
119
120
  parts,
120
121
  markdownIn,
122
+ tellStore = () => undefined,
121
123
  }: {
122
124
  readonly claude: Claude
123
125
  readonly router: Router
@@ -126,6 +128,7 @@ export function serveWidgets({
126
128
  readonly turnClosedBy: (rowId: string) => TurnData | undefined
127
129
  readonly parts: DrawnParts
128
130
  readonly markdownIn: (table: ElementTable, at: StyledAt) => ((props: MarkdownProps) => RenderElement) | undefined
131
+ readonly tellStore?: (part: StorePart) => void
129
132
  }): Widgets {
130
133
  const path = widgetsPath(store)
131
134
  const declared = new Map<string, readonly WidgetDeclaration[]>()
@@ -158,6 +161,7 @@ export function serveWidgets({
158
161
  const kept = isObject(file) ? file : {}
159
162
  await claude.fs.write(path, `${JSON.stringify({ ...kept, ...next, areas: { ...(isObject(kept['areas']) ? kept['areas'] : {}), ...next.areas } }, null, 2)}\n`)
160
163
  await claude.fs.write(storeChangedPath(store), '')
164
+ tellStore('widgets')
161
165
  stored = next
162
166
  }
163
167
  place()
@@ -232,7 +236,7 @@ export function serveWidgets({
232
236
  const widget = widgetOf(key)
233
237
  if (widget === undefined) return undefined
234
238
  const element = parts.element(widget.mod, cacheKey(key, area, at, turn), `${key}:`, nameOf(widget), `widget:${key}`)
235
- return element === undefined ? undefined : Box({ ...widgetSizes[widget.place?.size ?? 'fit'], children: element })
239
+ return element === undefined || element === null ? undefined : Box({ ...widgetSizes[widget.place?.size ?? 'fit'], children: element })
236
240
  }
237
241
 
238
242
  const isHidden = (key: string) => layout.hidden.includes(key)
@@ -283,9 +287,9 @@ export function serveWidgets({
283
287
  })
284
288
 
285
289
  return {
286
- update(mod, { parts: listing, redraw }) {
287
- if (listing === undefined && redraw !== true) return
288
- parts.forget(mod)
290
+ update(mod, { parts: listing, redraw, changed }) {
291
+ if (listing === undefined && redraw !== true && changed === undefined) return
292
+ parts.forget(mod, listing === undefined ? changed : undefined)
289
293
  if (listing !== undefined) {
290
294
  const listed = widgetsOf(listing)
291
295
  const isNewList = JSON.stringify(listed) !== JSON.stringify(declared.get(mod) ?? [])
@@ -141,6 +141,8 @@ export type SessionSend = {
141
141
  readonly as?: typeof Person | typeof Session
142
142
  }
143
143
 
144
+ export type SendReceipt = { readonly id?: number; readonly state: 'queued' | 'delivered' }
145
+
144
146
  export type TaskStartArgs = {
145
147
  readonly prompt: string
146
148
  readonly agentType?: string
@@ -182,7 +184,7 @@ export type Session = Pick<RecordPart, 'search'> & {
182
184
  turn(): Promise<Turn | undefined>
183
185
  turns(options?: { readonly last?: number }): Promise<Turn[]>
184
186
  messages(options?: { readonly after?: string; readonly last?: number }): Promise<Message[]>
185
- send(message: SessionSend): Promise<void>
187
+ send(message: SessionSend): Promise<SendReceipt>
186
188
  startTask(task: TaskStartArgs): Promise<Task>
187
189
  fork(task: ForkArgs): Promise<Task>
188
190
  callTool(call: ToolCallArgs): Promise<ToolResult>
@@ -1,4 +1,5 @@
1
1
  import type { ElementTable, RenderElement, RenderNode } from 'claude-code'
2
+ import { refusal } from '../runtime/drawing-rules.js'
2
3
 
3
4
  type Drawn = { readonly type: string; readonly props: Record<string, unknown>; readonly children?: readonly RenderNode[] }
4
5
 
@@ -6,8 +7,6 @@ const boxInsides = new WeakMap<object, Drawn>()
6
7
 
7
8
  const measuredProps = ['width', 'height', 'minWidth', 'minHeight'] as const
8
9
 
9
- const oncePerKey: ReadonlySet<string> = new Set(['Input', 'Select', 'Markdown', 'Client', 'Raster', 'Image'])
10
-
11
10
  function element(type: string) {
12
11
  return (props: Record<string, unknown>): RenderElement => {
13
12
  const { children, ...rest } = props
@@ -59,27 +58,12 @@ export function focusableKey(node: RenderNode, isTarget: (props: Drawn['props'])
59
58
  }
60
59
 
61
60
  export function checkKeys(tree: RenderNode, plugin: string, component: string): void {
62
- const seen = new Set<string>()
63
- for (const { type, props } of drawnIn(tree)) {
64
- const key = props['key']
65
- if (!oncePerKey.has(type) || typeof key !== 'string') continue
66
- const drawn = `${type}\u0000${key}`
67
- if (seen.has(drawn)) throw new Error(`${plugin}: returned a tree ${component} refuses: ${type} "${key}" is drawn twice; each takes its own key`)
68
- seen.add(drawn)
69
- }
70
- for (const { type, props } of hoversOutsideKeys(tree, false)) {
71
- const key = typeof props['key'] === 'string' ? ` "${props['key']}"` : ''
72
- throw new Error(`${plugin}: returned a tree ${component} refuses: ${type}${key} hover has no Box with a key around it; the nearest keyed Box is what the pointer hovers, or a scope names its group`)
73
- }
74
- }
75
-
76
- function* hoversOutsideKeys(node: RenderNode, isInKeyedBox: boolean): Generator<Drawn> {
77
- if (typeof node === 'string') return
78
- const drawn = insideOf(node)
79
- const isKeyed = isInKeyedBox || (drawn.type === 'Box' && typeof drawn.props['key'] === 'string')
80
- const hover = drawn.props['hover']
81
- if (typeof hover === 'object' && hover !== null && !('scope' in hover) && !isKeyed) yield drawn
82
- for (const child of drawn.children ?? []) yield* hoversOutsideKeys(child, isKeyed)
61
+ const rule = refusal(tree, (node) => {
62
+ if (typeof node === 'string') return undefined
63
+ const { type, props, children = [] } = insideOf(node as RenderElement)
64
+ return { type, key: props['key'], hover: props['hover'], children }
65
+ })
66
+ if (rule !== undefined) throw new Error(`${plugin}: returned a tree ${component} refuses: ${rule}`)
83
67
  }
84
68
 
85
69
  function* drawnIn(node: RenderNode): Generator<Drawn> {
@@ -1,7 +1,8 @@
1
1
  import type { HttpInit, HttpResponse } from 'claude-code'
2
2
  import type { Claude } from '../runtime/claude.js'
3
- import { devicesInterface, interfaceListeners, providerActs, routeSessions, serveProviders, type Implementation, type ProgramReach, type Provided, type ProvidedHeard, type ProviderIdentity, type ServedProviders, type SessionComputer, type SessionRouting } from '../runtime/interfaces.js'
4
- import { addressCall, connectRpc, RpcError, rpcCodes, type RpcClient } from '../runtime/rpc.js'
3
+ import { callDeadline } from '../runtime/deadline.js'
4
+ import { devicesInterface, interfaceListeners, providerActs, routeSessions, serveProviders, type Implementation, type Mail, type ProgramReach, type Provided, type ProvidedHeard, type ProviderIdentity, type ServedProviders, type SessionComputer, type SessionRouting } from '../runtime/interfaces.js'
5
+ import { addressCall, connectRpc, RpcError, rpcCodes, type RpcClient, type RpcClock } from '../runtime/rpc.js'
5
6
  import type { Device } from '../session/context/turn/device.js'
6
7
 
7
8
  type Here = Pick<Device, 'id' | 'name'>
@@ -32,11 +33,46 @@ declare function setTimeout(run: () => void, ms: number): unknown
32
33
 
33
34
  const realClock: ServeClock = { now: () => Date.now(), after: (ms, run) => setTimeout(run, ms) }
34
35
 
35
- const wait = (ms: number) => new Promise<void>((resolve) => void setTimeout(resolve, ms))
36
+ declare function clearTimeout(timer: unknown): void
37
+
38
+ const timers: RpcClock = {
39
+ after: (ms, run) => {
40
+ const timer = setTimeout(run, ms)
41
+ return { cancel: () => clearTimeout(timer) }
42
+ },
43
+ }
44
+
45
+ export const retriesAtOnce: RpcClock = {
46
+ after: (ms, run) => {
47
+ let isCancelled = false
48
+ if (ms < callDeadline.ms) void Promise.resolve().then(() => isCancelled || run())
49
+ return { cancel: () => void (isCancelled = true) }
50
+ },
51
+ }
52
+
53
+ export const stoppedClock: RpcClock = { after: () => ({ cancel: () => undefined }) }
36
54
 
37
55
  const notHere = (session: string) => new RpcError(rpcCodes.notHeld, `No session ${session} on this computer.`)
38
56
 
39
- const unfaked: SessionComputer = {
57
+ export type Mailbox = Pick<SessionComputer, 'queue' | 'queued' | 'delivered' | 'mail'>
58
+
59
+ export function memoryMail(): Mailbox {
60
+ const kept: Mail[] = []
61
+ return {
62
+ queue: async (mail) => kept.push({ ...mail, id: kept.length + 1 }),
63
+ queued: async (session) => kept.filter((mail) => mail.session === session && mail.deliveredAt === undefined),
64
+ delivered: async (id, at) => {
65
+ const mail = kept[id - 1]
66
+ if (mail !== undefined) kept[id - 1] = { ...mail, deliveredAt: at }
67
+ },
68
+ mail: async (session, { last }) => {
69
+ const rows = kept.filter((mail) => mail.session === session || mail.from === session)
70
+ return last === undefined ? rows : rows.slice(-last)
71
+ },
72
+ }
73
+ }
74
+
75
+ const unfaked: Omit<SessionComputer, keyof Mailbox> = {
40
76
  sessions: () => [],
41
77
  session: () => undefined,
42
78
  search: () => [],
@@ -52,9 +88,10 @@ const socketOf = (device: string) => `/test/devices/${device}/serve.sock`
52
88
 
53
89
  export function fakeServe(
54
90
  fakes: () => Partial<SessionComputer>,
55
- { device, programs, clock = realClock }: { readonly device: () => Promise<Here>; readonly programs?: ProgramReach; readonly clock?: ServeClock },
91
+ { device, programs, clock = realClock }: { readonly device: () => Promise<Here>; readonly programs?: Partial<ProgramReach>; readonly clock?: ServeClock },
56
92
  ): FakeServe {
57
- const answer = <Key extends keyof SessionComputer>(key: Key): SessionComputer[Key] => (fakes()[key] ?? unfaked[key])
93
+ const kept: SessionComputer = { ...unfaked, ...memoryMail() }
94
+ const answer = <Key extends keyof SessionComputer>(key: Key): SessionComputer[Key] => fakes()[key] ?? kept[key]
58
95
  const linked = new Map<string, FakeServe>()
59
96
  const reached = new Map<string, Here>()
60
97
  let devices: Provided | undefined
@@ -64,8 +101,9 @@ export function fakeServe(
64
101
  programs: {
65
102
  store: programs?.store ?? '/test/store',
66
103
  files: programs?.files ?? { list: async () => [], read: async () => undefined },
67
- fetch: (url, init) => linked.get(init.socketPath ?? '')?.fetch(url, init) ?? programs?.fetch(url, init) ?? Promise.resolve({ status: 404, text: '' }),
68
- wait: programs?.wait ?? wait,
104
+ fetch: (url, init) => linked.get(init.socketPath ?? '')?.fetch(url, init) ?? programs?.fetch?.(url, init) ?? Promise.resolve({ status: 404, text: '' }),
105
+ clock: programs?.clock ?? timers,
106
+ hasExited: programs?.hasExited ?? (async () => false),
69
107
  },
70
108
  now: () => clock.now(),
71
109
  after: (ms, run) => clock.after(ms, run),
@@ -84,6 +122,10 @@ export function fakeServe(
84
122
  unheld: (...args) => answer('unheld')(...args),
85
123
  visit: (...args) => answer('visit')(...args),
86
124
  remove: (...args) => answer('remove')(...args),
125
+ queue: (...args) => answer('queue')(...args),
126
+ queued: (...args) => answer('queued')(...args),
127
+ delivered: (...args) => answer('delivered')(...args),
128
+ mail: (...args) => answer('mail')(...args),
87
129
  },
88
130
  })
89
131
  const serve: FakeServe = {
@@ -152,7 +194,7 @@ function connectTo(serve: Pick<FakeServe, 'fetch'>, { provider, tell = async ()
152
194
  await served.replay()
153
195
  await listeners.replay(connected)
154
196
  },
155
- wait,
197
+ clock: timers,
156
198
  })
157
199
  const served = serveProviders({ serve: client, listeners, ...(provider === undefined ? {} : { provider }), tell, sessionCode, ...(device === undefined ? {} : { device }), after, report })
158
200
  return { client, served }
@@ -8,6 +8,7 @@ import { Prompt } from '../session/context/turn/message/prompt.js'
8
8
  import { Reply } from '../session/context/turn/message/reply.js'
9
9
  import { Mod, Person, Schedule, type Sender } from '../session/context/turn/message/sender.js'
10
10
  import { GoalChange } from '../session/goal/goal.js'
11
+ import { Session } from '../session/session.js'
11
12
  import { Task, TaskStart } from '../session/goal/task.js'
12
13
  import { Skill } from '../session/context/turn/message/skill.js'
13
14
  import { ToolCall } from '../session/context/turn/message/tool-call.js'
@@ -64,7 +65,7 @@ export type FakeSessions = {
64
65
  color(): SessionColor
65
66
  recolor(color: string | undefined): SessionColor
66
67
  lastTurn(): TurnData | undefined
67
- readonly sent: { readonly session: string; readonly task?: string; readonly type: string; readonly text: string; readonly as?: string }[]
68
+ readonly sent: { readonly session: string; readonly task?: string; readonly type: string; readonly text: string; readonly as?: string; readonly from?: string }[]
68
69
  }
69
70
 
70
71
  export function fakeSessions({ project, cwd, given, push, callTool, listAgents, decide }: { readonly project: () => string; readonly cwd: () => string; readonly given: readonly FakeSession[]; readonly push: (mod: string, session: string, change: SessionChange) => void; readonly callTool: Claude['tool']['call']; readonly listAgents: Claude['agent']['list']; readonly decide: Decide }): FakeSessions {
@@ -248,8 +249,9 @@ export function fakeSessions({ project, cwd, given, push, callTool, listAgents,
248
249
  return null
249
250
  }
250
251
  if (action === 'send') {
251
- sent.push({ session: session.data.id, ...(task === undefined ? {} : { task }), type: String(input['type']), text: String(input['text']), ...(typeof input['as'] === 'string' ? { as: input['as'] } : {}) })
252
- return null
252
+ const from = isObject(input['from']) ? String(input['from']['session']) : input['as'] === Session ? current : undefined
253
+ sent.push({ session: session.data.id, ...(task === undefined ? {} : { task }), type: String(input['type']), text: String(input['text']), ...(input['as'] === Person ? { as: Person } : {}), ...(from === undefined ? {} : { from }) })
254
+ return task === undefined ? { id: sent.length, state: 'queued' } : null
253
255
  }
254
256
  const text = (key: string) => (typeof input[key] === 'string' ? input[key] : undefined)
255
257
  const title = text('title') ?? ''
package/src/testing.ts CHANGED
@@ -267,7 +267,7 @@ export function testMod<State extends object, Declared extends Options = Options
267
267
  let provides: readonly string[] = []
268
268
  const ownMarkdown = new Map<string, DrawnPart | null>()
269
269
  const missedMarkdown = new Map<string, { readonly markdown: string } & StyledAt>()
270
- const updated = async ({ parts, redraw, requests }: PartsUpdate) => {
270
+ const updated = async ({ parts, redraw, changed, requests }: PartsUpdate) => {
271
271
  if (parts !== undefined) {
272
272
  declaredViews = viewsOf(parts)
273
273
  declaredPages = pagesOf(parts)
@@ -276,7 +276,7 @@ export function testMod<State extends object, Declared extends Options = Options
276
276
  for (const named of new Set([...before, ...provides])) if (before.includes(named) !== provides.includes(named)) await served.providersChanged(named)
277
277
  ownMarkdown.clear()
278
278
  }
279
- if (parts !== undefined || redraw !== undefined) (await widgetsOf()).update(name, { ...(parts === undefined ? {} : { parts }), ...(redraw === undefined ? {} : { redraw }) })
279
+ if (parts !== undefined || redraw !== undefined || changed !== undefined) (await widgetsOf()).update(name, { ...(parts === undefined ? {} : { parts }), ...(redraw === undefined ? {} : { redraw }), ...(changed === undefined ? {} : { changed }) })
280
280
  if (requests !== undefined && requests.length > 0) await applyRequests(requests)
281
281
  }
282
282
  const pressPart = (input: PartPress) => callMod(partMethods.press, input).then((update) => updated((update ?? {}) as PartsUpdate))
@@ -300,7 +300,11 @@ export function testMod<State extends object, Declared extends Options = Options
300
300
  missedMarkdown.clear()
301
301
  return draw()
302
302
  }
303
- const reportPart = (_id: string, message: string, error: unknown) => fake.claude.ui.log(`cmod: ${message}: ${messageOf(error)}`, { to: 'debug' })
303
+ const refusals: string[] = []
304
+ const reportPart = (id: string, message: string, error: unknown) => {
305
+ if (id.startsWith('refused:')) refusals.push(messageOf(error))
306
+ fake.claude.ui.log(`cmod: ${message}: ${messageOf(error)}`, { to: 'debug' })
307
+ }
304
308
  const openFromCmod = (href: string, press: UiPressArgument) => void openLink(fake.claude, href, press.surface).catch((error: unknown) => reportPart('open-link', 'Could not open the link', error))
305
309
  const cmodClaude: Claude = {
306
310
  ...fake.claude,
@@ -696,6 +700,8 @@ export function testMod<State extends object, Declared extends Options = Options
696
700
  const drawn = await withOwnMarkdown(() => served.draw(area, elements, { surface: 'terminal', columns }, turn))
697
701
  await fake.settle()
698
702
  const drawing = elements.Box({ flexDirection: 'column', children: [...drawn] })
703
+ const [refused] = refusals.splice(0)
704
+ if (refused !== undefined) throw new Error(`${cmodPluginName}: returned a tree ${areaComponents[area]} refuses: ${refused}`)
699
705
  checkKeys(drawing, cmodPluginName, areaComponents[area])
700
706
  return { drawing, columns }
701
707
  }
@@ -1,4 +1,5 @@
1
1
  import { Box, Button, drawnIn, hostComponent, Text, type Color } from './elements.js'
2
+ import { paletteOf, type Palette } from './palette.js'
2
3
 
3
4
  export type Tab = { readonly key: string; readonly label: string; readonly hotkey?: string }
4
5
 
@@ -6,12 +7,11 @@ export type Tone = 'neutral' | 'info' | 'success' | 'warning' | 'critical'
6
7
 
7
8
  type Pressed = () => void
8
9
 
9
- const toneColors: Readonly<Record<Tone, string | undefined>> = { neutral: undefined, info: 'suggestion', success: 'success', warning: 'warning', critical: 'error' }
10
+ const palette = (): Palette => paletteOf(drawnIn().theme)
10
11
 
11
- const textOf = (tone: Tone) => {
12
- const color = toneColors[tone]
13
- return color === undefined ? { dimColor: true } : { color }
14
- }
12
+ const toneTokens: Readonly<Record<Exclude<Tone, 'neutral'>, keyof Palette>> = { info: 'info', success: 'success', warning: 'warning', critical: 'destructive' }
13
+
14
+ const textOf = (tone: Tone) => (tone === 'neutral' ? { dimColor: true } : { color: palette()[toneTokens[tone]] })
15
15
 
16
16
  export const Tabs = hostComponent(
17
17
  'Tabs',
@@ -23,7 +23,7 @@ export const Tabs = hostComponent(
23
23
  ({ key: prefix, tabs, children }: { readonly key: string; readonly tabs: readonly (Tab & { readonly isSelected: boolean; readonly onSelect: Pressed })[]; readonly children?: JSX.Children }) => {
24
24
  const row = tabs.map(({ key, label, hotkey, isSelected, onSelect }) =>
25
25
  isSelected
26
- ? Text({ children: [...(hotkey === undefined ? [] : [Text({ color: 'claude', children: hotkey }), ': ']), Text({ bold: true, underline: true, children: label })] })
26
+ ? Text({ children: [...(hotkey === undefined ? [] : [Text({ color: palette().primary, children: hotkey }), ': ']), Text({ bold: true, underline: true, children: label })] })
27
27
  : Button({ plain: true, dimColor: true, key: `${prefix}tab:${key}`, ...(hotkey === undefined ? {} : { hotkey }), label, onPress: onSelect }),
28
28
  )
29
29
  return Box({ flexDirection: 'column', gap: 1, children: [Box({ gap: 3, children: row }), children] })
@@ -50,7 +50,7 @@ export const Panel = hostComponent(
50
50
  flexDirection: 'column',
51
51
  flexGrow: 1,
52
52
  children: [
53
- Box({ flexDirection: 'column', flexGrow: 1, gap: header.length === 0 ? 0 : 1, minWidth: [...title].length + 6, borderStyle: 'round', borderColor: 'subtle', paddingX: 1, children: [...header, children] }),
53
+ Box({ flexDirection: 'column', flexGrow: 1, gap: header.length === 0 ? 0 : 1, minWidth: [...title].length + 6, borderStyle: 'round', borderColor: palette().border, paddingX: 1, children: [...header, children] }),
54
54
  Box({ position: 'absolute', top: 0, left: 2, children: Text({ bold: true, wrap: 'truncate-end', children: ` ${title} ` }) }),
55
55
  ],
56
56
  })
@@ -72,9 +72,9 @@ function card(text: string, isShown: boolean): JSX.Element {
72
72
  left: 0,
73
73
  width: Math.min(text.length + 2, cardColumns),
74
74
  ...(isShown ? {} : { display: 'none' as const, hover: { display: 'flex' as const } }),
75
- backgroundColor: 'text',
75
+ backgroundColor: palette().foreground,
76
76
  paddingX: 1,
77
- children: Text({ color: 'inverseText', wrap: 'wrap', children: text }),
77
+ children: Text({ color: palette().background, wrap: 'wrap', children: text }),
78
78
  })
79
79
  }
80
80
 
@@ -129,8 +129,6 @@ const roundedLeft = '\u{E0B6}'
129
129
 
130
130
  const roundedRight = '\u{E0B4}'
131
131
 
132
- const barColors: Readonly<Record<Tone, string>> = { neutral: 'inactive', info: 'suggestion', success: 'success', warning: 'warning', critical: 'error' }
133
-
134
132
  function filledSections(sections: readonly ProgressSection[]): ProgressSection[] {
135
133
  let reached = 0
136
134
  return sections.map((section) => {
@@ -150,15 +148,16 @@ export const Progress = hostComponent(
150
148
  },
151
149
  ({ value, width, sections, buffer }: ProgressData) => {
152
150
  const isRounded = drawnIn().hasNerdFont && width > 2
151
+ const colors = palette()
153
152
  const cells = isRounded ? width - 2 : width
154
153
  const units = cells * eighths.length
155
154
  let reached = 0
156
155
  const ends = (sections ?? [{ value }]).map((section) => {
157
156
  reached += section.value
158
- return { end: Math.round((reached / 100) * units), color: 'color' in section ? section.color : section.tone === undefined ? 'claude' : barColors[section.tone] }
157
+ return { end: Math.round((reached / 100) * units), color: 'color' in section ? section.color : section.tone === undefined ? colors.primary : section.tone === 'neutral' ? colors.mutedForeground : colors[toneTokens[section.tone]] }
159
158
  })
160
159
  const buffered = Math.round(((buffer ?? 0) / 100) * units)
161
- const colorAt = (unit: number) => ends.find(({ end }) => unit < end)?.color ?? (unit < buffered ? 'promptBorder' : 'subtle')
160
+ const colorAt = (unit: number) => ends.find(({ end }) => unit < end)?.color ?? (unit < buffered ? colors.input : colors.border)
162
161
  const drawn: BarCell[] = []
163
162
  for (let cell = 0; cell < cells; cell++) {
164
163
  const from = cell * eighths.length
@@ -215,7 +214,7 @@ export const ListItem = hostComponent(
215
214
  const { key, label, description, leading, trailing, tone, isSelected, depth, onPress } = props
216
215
  if (depth !== undefined) return treeRow(props)
217
216
  const shown = [...statusOf(tone), ...(leading === undefined ? [] : [Text({ dimColor: true, children: `${leading} ` })]), label, ...(description === undefined ? [] : [Text({ dimColor: true, children: ` ${description}` })]), ...(trailing === undefined ? [] : [' ', trailing])]
218
- if (isSelected === true || onPress === undefined) return Box({ ...(isSelected === true ? { backgroundColor: 'userMessageBackground' } : {}), paddingX: 1, children: Text({ wrap: 'truncate-end', ...(isSelected === true ? { bold: true } : {}), children: shown }) })
217
+ if (isSelected === true || onPress === undefined) return Box({ ...(isSelected === true ? { backgroundColor: palette().accent } : {}), paddingX: 1, children: Text({ wrap: 'truncate-end', ...(isSelected === true ? { bold: true } : {}), children: shown }) })
219
218
  return Box({ paddingX: 1, children: Button({ plain: true, dimColor: true, key, onPress, children: shown }) })
220
219
  },
221
220
  )
@@ -40,13 +40,13 @@ type Terminal = Elements['terminal'] & Elements['desktop']
40
40
 
41
41
  type CompletedTable = Record<ElementName, (props: object) => RenderElement>
42
42
 
43
- export type DrawnIn = { readonly hasNerdFont: boolean }
43
+ export type DrawnIn = { readonly hasNerdFont: boolean; readonly theme: string }
44
44
 
45
45
  type Drawing = { readonly table: CompletedTable; readonly markdown: ((props: MarkdownProps) => RenderElement) | undefined; readonly drawnIn: DrawnIn }
46
46
 
47
47
  const tableFacts = new WeakMap<ElementTable, DrawnIn>()
48
48
 
49
- const plainTerminal: DrawnIn = { hasNerdFont: false }
49
+ const plainTerminal: DrawnIn = { hasNerdFont: false, theme: 'dark' }
50
50
 
51
51
  export function drawnIn(): DrawnIn {
52
52
  return drawing?.drawnIn ?? plainTerminal
@@ -163,7 +163,7 @@ export function drawsFocusable(data: unknown, key: string): boolean {
163
163
  return Object.values(fields).some((each) => drawsFocusable(each, key))
164
164
  }
165
165
 
166
- export function forClaudeCode(table: ElementTable, surface: RenderSurface, open: (href: string, press: UiPressArgument) => void, { hasNerdFont }: DrawnIn = plainTerminal): ElementTable {
166
+ export function forClaudeCode(table: ElementTable, surface: RenderSurface, open: (href: string, press: UiPressArgument) => void, facts: Partial<DrawnIn> = {}): ElementTable {
167
167
  const { Button: button, Link: link, Image: image, Svg: svg, Raster: raster } = table as CompletedTable
168
168
  const opening = (props: Readonly<Record<string, unknown>>) => {
169
169
  const { href, ...rest } = props
@@ -178,7 +178,7 @@ export function forClaudeCode(table: ElementTable, surface: RenderSurface, open:
178
178
  ({ label, ...rest }: Readonly<Record<string, unknown>>) =>
179
179
  draw({ alt: label, ...rest })
180
180
  const resolved = { ...table, Button: opening, Image: named(image), Svg: named(svg), Raster: ({ label, ...rest }: Readonly<Record<string, unknown>>) => raster(rest) }
181
- tableFacts.set(resolved, { hasNerdFont: hasNerdFont && surface === 'terminal' })
181
+ tableFacts.set(resolved, surface === 'terminal' ? { ...plainTerminal, ...facts } : plainTerminal)
182
182
  return resolved
183
183
  }
184
184
 
@@ -0,0 +1,38 @@
1
+ import type { Color } from './elements.js'
2
+
3
+ export type Palette = {
4
+ readonly foreground: Color
5
+ readonly background: Color
6
+ readonly mutedForeground: Color
7
+ readonly border: Color
8
+ readonly input: Color
9
+ readonly primary: Color
10
+ readonly accent: Color
11
+ readonly info: Color
12
+ readonly success: Color
13
+ readonly warning: Color
14
+ readonly destructive: Color
15
+ }
16
+
17
+ export const themePalette: Palette = {
18
+ foreground: 'text',
19
+ background: 'inverseText',
20
+ mutedForeground: 'inactive',
21
+ border: 'subtle',
22
+ input: 'promptBorder',
23
+ primary: 'claude',
24
+ accent: 'userMessageBackground',
25
+ info: 'suggestion',
26
+ success: 'success',
27
+ warning: 'warning',
28
+ destructive: 'error',
29
+ }
30
+
31
+ const ansiPalettes: Readonly<Record<string, Palette>> = {
32
+ 'dark-ansi': { ...themePalette, mutedForeground: 'ansi:whiteBright', input: 'ansi:white', border: 'ansi:blackBright' },
33
+ 'light-ansi': { ...themePalette, mutedForeground: 'ansi:black', input: 'ansi:blackBright', border: 'ansi:white' },
34
+ }
35
+
36
+ export function paletteOf(theme: string): Palette {
37
+ return ansiPalettes[theme] ?? themePalette
38
+ }
package/src/ui/styles.ts CHANGED
@@ -48,6 +48,8 @@ export type Style = {
48
48
  remove(): void
49
49
  }
50
50
 
51
+ export const modComponents: readonly RenderComponent[] = ['AbovePrompt', 'Pane', ...new Set(Object.values(components))]
52
+
51
53
  export function componentOf(kind: Kind): Exclude<RenderComponent, 'Pane'> | undefined {
52
54
  return typeof kind === 'string' && Object.hasOwn(components, kind) ? components[kind] : undefined
53
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fake-elements.d.ts","sourceRoot":"","sources":["../src/testing/fake-elements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAiB,UAAU,EAAE,MAAM,aAAa,CAAA;AAE1E,KAAK,KAAK,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,UAAU,EAAE,CAAA;CAAE,CAAA;AAyB1H,eAAO,MAAM,QAAQ,EAAE,YActB,CAAA;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,SAAS,CAQrI;AAID,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,OAAO,GAAG,MAAM,GAAG,SAAS,CAG/G;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAanF;AAkBD,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAOhE;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAiB/C"}
1
+ {"version":3,"file":"fake-elements.d.ts","sourceRoot":"","sources":["../src/testing/fake-elements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAiB,UAAU,EAAE,MAAM,aAAa,CAAA;AAG1E,KAAK,KAAK,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,UAAU,EAAE,CAAA;CAAE,CAAA;AAuB1H,eAAO,MAAM,QAAQ,EAAE,YActB,CAAA;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,SAAS,CAQrI;AAID,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,OAAO,GAAG,MAAM,GAAG,SAAS,CAG/G;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAOnF;AASD,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAOhE;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAiB/C"}
@@ -1,6 +1,6 @@
1
+ import { refusal } from '../runtime/drawing-rules.js';
1
2
  const boxInsides = new WeakMap();
2
3
  const measuredProps = ['width', 'height', 'minWidth', 'minHeight'];
3
- const oncePerKey = new Set(['Input', 'Select', 'Markdown', 'Client', 'Raster', 'Image']);
4
4
  function element(type) {
5
5
  return (props) => {
6
6
  const { children, ...rest } = props;
@@ -54,31 +54,14 @@ export function focusableKey(node, isTarget) {
54
54
  return undefined;
55
55
  }
56
56
  export function checkKeys(tree, plugin, component) {
57
- const seen = new Set();
58
- for (const { type, props } of drawnIn(tree)) {
59
- const key = props['key'];
60
- if (!oncePerKey.has(type) || typeof key !== 'string')
61
- continue;
62
- const drawn = `${type}\u0000${key}`;
63
- if (seen.has(drawn))
64
- throw new Error(`${plugin}: returned a tree ${component} refuses: ${type} "${key}" is drawn twice; each takes its own key`);
65
- seen.add(drawn);
66
- }
67
- for (const { type, props } of hoversOutsideKeys(tree, false)) {
68
- const key = typeof props['key'] === 'string' ? ` "${props['key']}"` : '';
69
- throw new Error(`${plugin}: returned a tree ${component} refuses: ${type}${key} hover has no Box with a key around it; the nearest keyed Box is what the pointer hovers, or a scope names its group`);
70
- }
71
- }
72
- function* hoversOutsideKeys(node, isInKeyedBox) {
73
- if (typeof node === 'string')
74
- return;
75
- const drawn = insideOf(node);
76
- const isKeyed = isInKeyedBox || (drawn.type === 'Box' && typeof drawn.props['key'] === 'string');
77
- const hover = drawn.props['hover'];
78
- if (typeof hover === 'object' && hover !== null && !('scope' in hover) && !isKeyed)
79
- yield drawn;
80
- for (const child of drawn.children ?? [])
81
- yield* hoversOutsideKeys(child, isKeyed);
57
+ const rule = refusal(tree, (node) => {
58
+ if (typeof node === 'string')
59
+ return undefined;
60
+ const { type, props, children = [] } = insideOf(node);
61
+ return { type, key: props['key'], hover: props['hover'], children };
62
+ });
63
+ if (rule !== undefined)
64
+ throw new Error(`${plugin}: returned a tree ${component} refuses: ${rule}`);
82
65
  }
83
66
  function* drawnIn(node) {
84
67
  if (typeof node === 'string')
@@ -1,6 +1,7 @@
1
1
  import type { HttpInit, HttpResponse } from 'claude-code';
2
2
  import type { Claude } from '../runtime/claude.js';
3
3
  import { type Implementation, type ProgramReach, type Provided, type ProvidedHeard, type ProviderIdentity, type ServedProviders, type SessionComputer, type SessionRouting } from '../runtime/interfaces.js';
4
+ import { type RpcClock } from '../runtime/rpc.js';
4
5
  import type { Device } from '../session/context/turn/device.js';
5
6
  type Here = Pick<Device, 'id' | 'name'>;
6
7
  export type ServeConnection = {
@@ -30,9 +31,13 @@ export type ServeClock = {
30
31
  now(): number;
31
32
  after(ms: number, run: () => void): unknown;
32
33
  };
34
+ export declare const retriesAtOnce: RpcClock;
35
+ export declare const stoppedClock: RpcClock;
36
+ export type Mailbox = Pick<SessionComputer, 'queue' | 'queued' | 'delivered' | 'mail'>;
37
+ export declare function memoryMail(): Mailbox;
33
38
  export declare function fakeServe(fakes: () => Partial<SessionComputer>, { device, programs, clock }: {
34
39
  readonly device: () => Promise<Here>;
35
- readonly programs?: ProgramReach;
40
+ readonly programs?: Partial<ProgramReach>;
36
41
  readonly clock?: ServeClock;
37
42
  }): FakeServe;
38
43
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"fake-serve.d.ts","sourceRoot":"","sources":["../src/testing/fake-serve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAqF,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAE/R,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAE/D,KAAK,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC,CAAA;AAEvC,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAA;IACpC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAC/F,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAA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