@cmodjs/core 0.1.8 → 0.1.10

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 (86) hide show
  1. package/docs/commands.md +2 -2
  2. package/docs/hooks.md +62 -6
  3. package/docs/index.md +7 -4
  4. package/docs/install-steps.md +3 -3
  5. package/docs/jobs.md +5 -4
  6. package/docs/mod.md +57 -7
  7. package/docs/testing.md +25 -9
  8. package/docs/ui.md +134 -5
  9. package/jobs/check.js +2 -2
  10. package/jobs/context.d.ts.map +1 -1
  11. package/jobs/context.js +2 -0
  12. package/jobs/permissions/decide-permission.js +2 -2
  13. package/jobs/permissions/find-project-scope.d.ts +1 -1
  14. package/jobs/permissions/find-project-scope.d.ts.map +1 -1
  15. package/jobs/permissions/find-project-scope.js +9 -9
  16. package/jobs/permissions/match-target.d.ts.map +1 -1
  17. package/jobs/permissions/match-target.js +4 -3
  18. package/mod.d.ts +16 -6
  19. package/mod.d.ts.map +1 -1
  20. package/package.json +2 -1
  21. package/path.d.ts +2 -0
  22. package/path.d.ts.map +1 -0
  23. package/path.js +1 -0
  24. package/register.d.ts.map +1 -1
  25. package/register.js +8 -2
  26. package/runtime/claude.d.ts +4 -1
  27. package/runtime/claude.d.ts.map +1 -1
  28. package/runtime/hooks.d.ts +10 -2
  29. package/runtime/hooks.d.ts.map +1 -1
  30. package/runtime/hooks.js +56 -18
  31. package/runtime/lifecycle.d.ts.map +1 -1
  32. package/runtime/lifecycle.js +12 -2
  33. package/runtime/ui.d.ts.map +1 -1
  34. package/runtime/ui.js +42 -26
  35. package/shell.d.ts +2 -0
  36. package/shell.d.ts.map +1 -0
  37. package/shell.js +1 -0
  38. package/src/jobs/check.ts +2 -2
  39. package/src/jobs/context.ts +2 -0
  40. package/src/jobs/permissions/decide-permission.ts +2 -2
  41. package/src/jobs/permissions/find-project-scope.ts +11 -10
  42. package/src/jobs/permissions/match-target.ts +4 -3
  43. package/src/mod.ts +24 -4
  44. package/src/path.ts +1 -0
  45. package/src/register.ts +8 -2
  46. package/src/runtime/claude.ts +11 -1
  47. package/src/runtime/hooks.ts +62 -23
  48. package/src/runtime/lifecycle.ts +11 -4
  49. package/src/runtime/ui.ts +39 -26
  50. package/src/shell.ts +1 -0
  51. package/src/testing/fake-claude.ts +14 -5
  52. package/src/testing/fake-elements.ts +5 -7
  53. package/src/testing/fake-files.ts +5 -5
  54. package/src/testing.ts +83 -11
  55. package/src/ui/components.ts +70 -0
  56. package/src/ui/define-pane.ts +5 -1
  57. package/src/utils/call-effects.ts +12 -11
  58. package/src/utils/parse-shell.ts +28 -36
  59. package/src/utils/paths.ts +4 -19
  60. package/src/vendor.ts +1 -0
  61. package/testing/fake-claude.d.ts +5 -0
  62. package/testing/fake-claude.d.ts.map +1 -1
  63. package/testing/fake-claude.js +13 -3
  64. package/testing/fake-elements.d.ts +5 -8
  65. package/testing/fake-elements.d.ts.map +1 -1
  66. package/testing/fake-elements.js +6 -6
  67. package/testing/fake-files.js +5 -5
  68. package/testing.d.ts +4 -2
  69. package/testing.d.ts.map +1 -1
  70. package/testing.js +65 -9
  71. package/ui/components.d.ts +48 -0
  72. package/ui/components.d.ts.map +1 -0
  73. package/ui/components.js +56 -0
  74. package/ui/define-pane.d.ts +5 -1
  75. package/ui/define-pane.d.ts.map +1 -1
  76. package/utils/call-effects.d.ts.map +1 -1
  77. package/utils/call-effects.js +12 -11
  78. package/utils/parse-shell.d.ts +5 -9
  79. package/utils/parse-shell.d.ts.map +1 -1
  80. package/utils/parse-shell.js +5 -10
  81. package/utils/paths.d.ts +0 -3
  82. package/utils/paths.d.ts.map +1 -1
  83. package/utils/paths.js +3 -18
  84. package/vendor.d.ts +1 -0
  85. package/vendor.d.ts.map +1 -1
  86. package/vendor.js +209 -12
package/docs/ui.md CHANGED
@@ -5,9 +5,10 @@ A mod draws in four places: its own panes, the rows Claude Code draws (slots), t
5
5
  ```ts
6
6
  mod.ui.pane(pane: Pane<State>): PaneHandle
7
7
  mod.ui.render<S extends Slot>(slot: S, Component: (props: SlotProps<S>) => RenderElement): void
8
- mod.ui.toast(text: string): void
8
+ mod.ui.toast(text: string, options?: { timeoutMs?: number }): void
9
9
  mod.ui.progress<T>(title: string, task: (report: (step: ProgressStep) => void) => Promise<T>): Promise<T>
10
10
  mod.ui.ask(question: string, options?: readonly string[] | AskOptions): Promise<string>
11
+ mod.ui.scroll(args: UiScrollArgs): Promise<UiScrollResult>
11
12
  ```
12
13
 
13
14
  Claude Mod Manager (cmod) draws the mod again whenever a value in `mod.state` changes. A render reads `mod.state` and returns what to show. It never draws by hand.
@@ -48,6 +49,111 @@ An element called outside a render throws `<Element> was called outside a render
48
49
 
49
50
  `drawWith(table, draw, markdown?)` is the function cmod draws a render with. A mod never calls it.
50
51
 
52
+ ## Components
53
+
54
+ `ui/components.js` exports controls built from the elements and Claude Code's theme colors, so they follow the person's theme and look the same in every mod. Each is a component like the ones a mod writes: a function of props, used in a pane's `render` or a slot's component.
55
+
56
+ ```ts
57
+ Tabs(props: { tabs: readonly { key: string; label: string }[]; selected: string; onSelect(key: string): void; children? })
58
+ Split(props: { children: readonly RenderElement[] })
59
+ Panel(props: { title: string; children? })
60
+ Toggle(props: { label: string; checked: boolean; onChange(checked: boolean): void })
61
+ Tooltip(props: { text: string; children? })
62
+ Help(props: { text: string; isOpen: boolean; onOpenChange(isOpen: boolean): void })
63
+ Dialog(props: { title: string; children?; actions })
64
+ Pagination(props: { page: number; pages: number; onPage(page: number): void })
65
+ ProgressBar(props: { done: number; total: number; width?: number })
66
+ ```
67
+
68
+ - `Tabs` draws a row of tabs over `children`. The selected tab's number is in the accent color and its label bold and underlined. Each other tab is a `Button` whose hotkey is its number, so a pane that holds the keyboard switches tabs by number, Tab, or a click. A hotkey is one digit, so only the first nine tabs have a number.
69
+ - `Split` lays its children side by side in equal widths. `Panel` frames one part of a pane in a rounded border with a bold title.
70
+ - `Toggle` draws `[x] label` or `[ ] label` as a `Button`. Enter or a click calls `onChange` with the other value.
71
+ - `Tooltip` shows `text` in an inverted card above its children while the pointer rests on them. The card opens upward, because Claude Code paints a card over the rows drawn before it and under the rows drawn after it. It has no border, so a one-line card needs one free row above its children. The pointer alone opens it, so put nothing only a tooltip says.
72
+ - `Help` draws a `?` that shows `text` the same way. A press of `?` keeps the card open until the next press, so the keyboard reaches it too. Keep `isOpen` in `mod.state`.
73
+ - `Dialog` lays out a dialog's title, body, and `actions`, the buttons in a row. Put the safe action first, as the `primary` Button with `autoFocus`.
74
+ - `Pagination` draws `p: Previous 2 of 5 n: Next`. `p` and `n` are its hotkeys, and an end it cannot pass is dim text.
75
+ - `ProgressBar` fills `width` columns, 24 unless given, in proportion to `done` of `total`, and shows the count. The progress lines `mod.ui.progress` draws use it too.
76
+ - `Tabs`, `Toggle`, `Help`, and `Pagination` hold no state of their own. Keep their value in `mod.state` and set it in the callback, as in React's controlled components.
77
+
78
+ A pane opened with `focus`, `closeOnEscape`, and `holdToasts` is a dialog. Claude Code shows it as a tab of the dock, beside the mod's other panes, and Escape closes it:
79
+
80
+ ```tsx
81
+ import { definePane } from '../../node_modules/@cmodjs/core/ui/define-pane.js'
82
+ import { Dialog } from '../../node_modules/@cmodjs/core/ui/components.js'
83
+ import { Button, Text } from '../../node_modules/@cmodjs/core/ui/elements.js'
84
+
85
+ export const confirmPane = definePane<{ session: { deleting: boolean } }>({
86
+ id: 'delete-branch',
87
+ title: 'Delete branch',
88
+ rows: 9,
89
+ closeOnEscape: true,
90
+ holdToasts: true,
91
+ render: (mod) => (
92
+ <Dialog
93
+ title="Delete the branch feature/kit?"
94
+ actions={[
95
+ <Button variant="primary" autoFocus label="Keep it" onPress={() => void mod.ui.toast('Kept feature/kit')} />,
96
+ <Button label="Delete" onPress={() => void (mod.state.session.deleting = true)} />,
97
+ ]}
98
+ >
99
+ <Text dimColor wrap="wrap">Its 3 commits are not on main. Deleting it removes them from this machine.</Text>
100
+ </Dialog>
101
+ ),
102
+ })
103
+ ```
104
+
105
+ Open it with `mod.ui.pane(confirmPane).open({ focus: true })`. It draws as:
106
+
107
+ ```text
108
+ Widgets Delete branch ✕
109
+ Delete the branch feature/kit?
110
+
111
+ Its 3 commits are not on main. Deleting it removes them from
112
+ this machine.
113
+
114
+ [ Keep it ] [ Delete ]
115
+ ```
116
+
117
+ A pane with `Tabs`, a `Tooltip`, a `ProgressBar`, `Pagination`, and a `Toggle` with `Help` draws as:
118
+
119
+ ```text
120
+ 1: Controls 2: Split 3: Files
121
+
122
+ 3 files read
123
+
124
+ ██████████████░░░░░░░░░░ 7/12
125
+
126
+ p: Previous 2 of 5 n: Next
127
+
128
+ [x] Show hidden files ?
129
+ ```
130
+
131
+ With the pointer on `3 files read` and `Help` open, the two cards cover the rows above them:
132
+
133
+ ```text
134
+ 1: Controls 2: Split 3: Files
135
+ Files Claude read this session
136
+ 3 files read
137
+
138
+ ██████████████░░░░░░░░░░ 7/12
139
+
140
+ p: Previous 2 of 5 n Hidden files start with a dot,
141
+ such as .env.
142
+ [x] Show hidden files ?
143
+ ```
144
+
145
+ and its Split tab, two `Panel`s in a `Split`, as:
146
+
147
+ ```text
148
+ 1: Controls 2: Split 3: Files
149
+
150
+ ╭─────────────────────────────────╮ ╭────────────────────────────────╮
151
+ │ Changed files │ │ src/mod.tsx │
152
+ │ src/mod.tsx │ │ + mod.ui.pane(widgetsPane) │
153
+ │ src/state.ts │ │ - mod.ui.pane(oldPane) │
154
+ ╰─────────────────────────────────╯ ╰────────────────────────────────╯
155
+ ```
156
+
51
157
  ## Panes
52
158
 
53
159
  A pane is a framed region the mod opens. Claude Code docks it beside the transcript in fullscreen, or shows it above the prompt.
@@ -62,14 +168,23 @@ type Pane<State> = {
62
168
  readonly title: string
63
169
  readonly columns?: number | ((state: State) => number | undefined)
64
170
  readonly rows?: number | ((state: State) => number | undefined)
171
+ readonly closeOnEscape?: true
172
+ readonly holdToasts?: true
65
173
  render(mod: Mod<State>, props: Frozen<RenderPropsOf['Pane']>): RenderElement
174
+ onScroll?(mod: Mod<State>, e: Frozen<UiScrollInput>): void | Promise<void>
175
+ onClose?(mod: Mod<State>, e: Frozen<PaneCloseInput>): void | Promise<void>
66
176
  }
67
177
  ```
68
178
 
69
179
  - `id` is 1 to 64 letters, digits, `_`, or `-`. Another id throws `definePane: "<id>" is not a pane id.`
70
180
  - `title` labels the pane's tab while more than one pane is open.
71
181
  - `columns` and `rows` ask for a size. A number must be a whole number above 0, or `definePane` throws. A function reads the state and returns the size, or `undefined` for Claude Code's default. When the state changes the size, cmod resizes an open pane. A function that returns a bad size keeps an open pane at its size and logs the pane's title to the debug log. `open`, and `toggle` on a closed pane, reject with that size instead.
182
+ - `closeOnEscape` closes the pane when the person presses Escape while it holds the keyboard, as their own close does. Left out, Escape gives the keyboard back to the prompt and the pane stays.
183
+ - `holdToasts` holds every toast back while the pane is shown, the toasts of other plugins and of Claude Code included. Use it for a pane the person answers and closes, never for one that stays open.
72
184
  - `render` draws the pane's body. `props` holds `title`, `isFocused`, `bodyColumns`, `placement` (`'dock'` or `'inline'`), `scroll`, the body's window over a taller drawing, and `view`, which transcript is on screen beside the pane.
185
+ - `onScroll` runs after this pane's window moved, by the person's wheel or keys or by `mod.ui.scroll`. `e` holds the new `offset`, the move's `by`, `bodyRows`, `contentRows`, and `origin`. Another pane's scroll and the band's never reach it, and a scroll Claude Code refused does not either.
186
+ - `onClose` runs after the pane closed, by the person or by `close()`. `e.origin.kind` is `'person'` or `'plugin'`.
187
+ - A handler that throws logs `<mod>: the <title> pane's <handler> threw: <error>`.
73
188
 
74
189
  Put each pane in its own file in `src/panes/`.
75
190
 
@@ -98,20 +213,22 @@ export const notesPane = definePane<NotesState>({
98
213
 
99
214
  ```ts
100
215
  type PaneHandle = {
101
- open(): Promise<void>
216
+ open(options?: { readonly focus?: true }): Promise<void>
102
217
  close(): Promise<void>
103
- toggle(): Promise<void>
218
+ toggle(options?: { readonly focus?: true }): Promise<void>
104
219
  readonly isOpen: boolean
105
220
  }
106
221
  ```
107
222
 
108
223
  - `open` asks Claude Code to show the pane. `isOpen` turns true once Claude Code places it. Claude Code may hold a pane back, and then `isOpen` stays false.
224
+ - `{ focus: true }` asks Claude Code to give the pane the keyboard as it opens. Claude Code gives it only while the prompt is empty and holds the keyboard, so typed text, a dialog, or another pane the person is using keeps it. cmod sends `focus` only on that one open, never when it resizes the pane.
109
225
  - `mod.ui.pane` only adds the pane. cmod opens it only when the mod calls `open` or `toggle`, and Claude Code shows a pane only once the plugin has opened it. So give the person a way in, such as a slash command whose `reply` calls `pane.toggle()`.
110
226
  - A pane opened from what the person did, such as a slash command they typed or a `Button` they pressed, shows at any terminal width. A pane opened from anything else, such as `setup`, a timer, or `SessionStart`, shows only on a terminal 144 columns wide, or 110 for a pane the person opened before. Below that it waits undrawn until the person opens it or the terminal widens.
111
227
  - `close` closes it. The person closes a pane too, and `isOpen` follows.
112
228
  - `toggle` closes an open pane and opens a closed one.
113
229
  - When the mod starts, `isOpen` is true for each of its panes Claude Code already shows.
114
230
  - Adding two panes with one id throws `<mod>: the pane "<id>" is already added. Give each pane its own id.`
231
+ - A `render` that throws draws `The <title> pane could not draw: <error>` in the pane, and cmod logs `<mod>: the <title> pane render threw: <error>` once.
115
232
  - The line cmod logs when the mod first starts names the pane by its `title`, as in `the Notes pane`.
116
233
 
117
234
  ```tsx
@@ -126,7 +243,7 @@ export const notes = defineMod({
126
243
  state: initialState,
127
244
  setup(mod) {
128
245
  const pane = mod.ui.pane(notesPane)
129
- mod.use(slashCommand({ name: 'notes', description: 'Show or hide the notes', reply: () => pane.toggle() }))
246
+ mod.use(slashCommand({ name: 'notes', description: 'Show or hide the notes', reply: () => pane.toggle({ focus: true }) }))
130
247
  },
131
248
  })
132
249
  ```
@@ -238,7 +355,7 @@ markdownBlocks<S>(text: string, slot: S): Omit<SlotProps<S>, 'Default'>[]
238
355
 
239
356
  ## Toasts
240
357
 
241
- `mod.ui.toast(text)` shows the person a short message.
358
+ `mod.ui.toast(text, options?)` shows the person a short message on Claude Code's stack of plugin toasts, over the transcript's top right corner and under the mod's name. It stays 4 seconds, or `timeoutMs`. A click takes it off, and the pointer resting on it holds it. While a pane opened with `holdToasts` is shown, it waits.
242
359
 
243
360
  ## Progress lines
244
361
 
@@ -290,6 +407,18 @@ export const committer = defineMod({
290
407
  })
291
408
  ```
292
409
 
410
+ ## Scrolling
411
+
412
+ ```ts
413
+ mod.ui.scroll(args: { to: 'start' | 'end' | { key: string } | { requestId: string }; in?: string; block?: 'start' | 'center' | 'end' | 'nearest' }): Promise<UiScrollResult>
414
+ ```
415
+
416
+ `scroll` brings something the mod drew into view. `{ key }` is an element the mod drew with that `key`. `'start'` and `'end'` are the top and bottom of the pane whose id `in` names, and `'end'` keeps up with rows the mod adds until the person scrolls. `{ requestId }` is a row Claude Code drew, such as a message of the transcript, which scrolls only while the mod answers the person's own press or key. `block` places the target in the window, `'nearest'` by default. It resolves `{}` once the window moved, or `{ deny }` with the reason it did not.
417
+
418
+ ```tsx
419
+ <Button label="Latest" onPress={() => mod.ui.scroll({ to: 'end', in: 'log' })} />
420
+ ```
421
+
293
422
  ## Test the UI
294
423
 
295
424
  `tested.lines(paneId)` reads an open pane as rows of text. `tested.lines(slot, props)` draws a slot render. `tested.press(paneId, key)` presses a button. `tested.shown.toasts` lists the toasts. [testing.md](testing.md) covers each.
package/jobs/check.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { longestMs } from '../runtime/deadline.js';
2
2
  import { callEffects } from '../utils/call-effects.js';
3
- import { parentOf } from '../utils/paths.js';
3
+ import { dirname } from '../vendor.js';
4
4
  import { listed, messageOf } from '../utils/text.js';
5
5
  import { afterCall, modOf, targetWords } from './context.js';
6
6
  import { matchTarget, targetOf } from './permissions/match-target.js';
@@ -55,6 +55,6 @@ async function triggeredRun(after, run, use, workspace) {
55
55
  existing.push(path);
56
56
  const last = existing.at(-1);
57
57
  if (last !== undefined)
58
- return { command: [...run, ...existing], folder: parentOf(last) };
58
+ return { command: [...run, ...existing], folder: dirname(last) };
59
59
  return commandFolder === undefined ? undefined : { command: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G,GAAG,CAAC,KAAK,CAAC,CAEjM;AAED,wBAAgB,SAAS,CAAC,KAAK,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,UAAU,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAyB,GAAG,GAAG,CAAC,KAAK,CAAC,CA0BvL;AAwBD,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CASlD"}
package/jobs/context.js CHANGED
@@ -60,6 +60,8 @@ export function modWithin({ mod, claude }, deadline, workTree = async () => unde
60
60
  read: (path) => within('mod.fs.read', mod.fs.read(path)),
61
61
  write: (path, text) => within('mod.fs.write', mod.fs.write(path, text)),
62
62
  list: (path) => within('mod.fs.list', mod.fs.list(path)),
63
+ exists: (path) => within('mod.fs.exists', mod.fs.exists(path)),
64
+ stat: (path, options) => within('mod.fs.stat', mod.fs.stat(path, options)),
63
65
  },
64
66
  http: { fetch: (url, init) => within('mod.http.fetch', mod.http.fetch(url, init)) },
65
67
  dependencies: dependencyCalls(claude, within),
@@ -2,7 +2,7 @@ import { strictness } from '../../runtime/hooks.js';
2
2
  import { messageOf } from '../../utils/text.js';
3
3
  import { callBaseOf, callEffects } from '../../utils/call-effects.js';
4
4
  import { folderInScope, matchTarget, targetOf } from './match-target.js';
5
- import { resolvePath } from '../../utils/paths.js';
5
+ import { resolve } from '../../vendor.js';
6
6
  const wordBoundary = '\\s;&|()<>\'"`=';
7
7
  export function stricterVerdict(first, second) {
8
8
  return strictness.indexOf(second.decision) > strictness.indexOf(first.decision) ? second : first;
@@ -63,7 +63,7 @@ async function unparsedMatches(target, use, effects, workspace) {
63
63
  const folder = named.length === 0 ? undefined : await folderInScope(shell, workspace);
64
64
  if (folder === undefined)
65
65
  return [];
66
- return named.map((segment) => ({ call: { ...base, path: resolvePath(segment, folder) }, access: undefined, folder }));
66
+ return named.map((segment) => ({ call: { ...base, path: resolve(folder, segment) }, access: undefined, folder }));
67
67
  }
68
68
  function containsWord(line, word) {
69
69
  const escaped = word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
@@ -1,4 +1,4 @@
1
- import { type FileSystem } from '../../utils/paths.js';
1
+ import type { FileSystem } from '../../utils/paths.js';
2
2
  export type ProjectScope = {
3
3
  workTreeOf: (path: string) => Promise<string | undefined>;
4
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"find-project-scope.d.ts","sourceRoot":"","sources":["../../src/jobs/permissions/find-project-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAErF,MAAM,MAAM,YAAY,GAAG;IAAE,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;CAAE,CAAA;AAExF,MAAM,MAAM,SAAS,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,YAAY,GAAG,SAAS,CAAA;CAAE,CAAA;AAE3H,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAwB1H"}
1
+ {"version":3,"file":"find-project-scope.d.ts","sourceRoot":"","sources":["../../src/jobs/permissions/find-project-scope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAGtD,MAAM,MAAM,YAAY,GAAG;IAAE,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;CAAE,CAAA;AAExF,MAAM,MAAM,SAAS,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,YAAY,GAAG,SAAS,CAAA;CAAE,CAAA;AAE3H,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAwB1H"}
@@ -1,9 +1,9 @@
1
- import { nameOf, parentOf, resolvePath } from '../../utils/paths.js';
1
+ import { basename, dirname, resolve } from '../../vendor.js';
2
2
  export async function findProjectScope(pluginRoot, home, fs) {
3
- const skills = parentOf(pluginRoot);
4
- const claude = parentOf(skills);
5
- const root = parentOf(claude);
6
- if (nameOf(skills) !== 'skills' || nameOf(claude) !== '.claude' || root === resolvePath(home, '/'))
3
+ const skills = dirname(pluginRoot);
4
+ const claude = dirname(skills);
5
+ const root = dirname(claude);
6
+ if (basename(skills) !== 'skills' || basename(claude) !== '.claude' || root === resolve('/', home))
7
7
  return undefined;
8
8
  const repositories = new Map();
9
9
  const repositoryOf = async (workTree) => {
@@ -20,7 +20,7 @@ export async function findProjectScope(pluginRoot, home, fs) {
20
20
  return undefined;
21
21
  return {
22
22
  async workTreeOf(path) {
23
- for (let folder = path;; folder = parentOf(folder)) {
23
+ for (let folder = path;; folder = dirname(folder)) {
24
24
  const repository = await repositoryOf(folder);
25
25
  if (repository !== undefined)
26
26
  return repository === project ? folder : undefined;
@@ -31,7 +31,7 @@ export async function findProjectScope(pluginRoot, home, fs) {
31
31
  };
32
32
  }
33
33
  async function readRepository(workTree, fs) {
34
- const gitPath = resolvePath('.git', workTree);
34
+ const gitPath = resolve(workTree, '.git');
35
35
  const git = await fs.stat(gitPath).catch(() => undefined);
36
36
  if (git === undefined)
37
37
  return undefined;
@@ -41,8 +41,8 @@ async function readRepository(workTree, fs) {
41
41
  const gitDirectory = /^gitdir:\s*(.+)$/m.exec(await fs.read(gitPath))?.[1]?.trim();
42
42
  if (gitDirectory === undefined)
43
43
  throw new Error(`${gitPath} has no gitdir line.`);
44
- const linkedDirectory = resolvePath(gitDirectory, workTree);
45
- const commonDirectory = await fs.read(resolvePath('commondir', linkedDirectory)).then((text) => resolvePath(text.trim(), linkedDirectory), () => linkedDirectory);
44
+ const linkedDirectory = resolve(workTree, gitDirectory);
45
+ const commonDirectory = await fs.read(resolve(linkedDirectory, 'commondir')).then((text) => resolve(linkedDirectory, text.trim()), () => linkedDirectory);
46
46
  return (await fs.stat(commonDirectory)).realPath ?? commonDirectory;
47
47
  }
48
48
  catch {
@@ -1 +1 @@
1
- {"version":3,"file":"match-target.d.ts","sourceRoot":"","sources":["../../src/jobs/permissions/match-target.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,KAAK,OAAO,EAAE,MAAM,6BAA6B,CAAA;AACxL,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGxD,MAAM,MAAM,WAAW,GAAG;IAAE,OAAO,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAA;AACzI,MAAM,MAAM,SAAS,GAAG,MAAM,WAAW,CAAA;AACzC,MAAM,MAAM,QAAQ,CAAC,GAAG,SAAS,SAAS,IAAI,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA;AAC9H,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AE,QAAQ,CAAA;CAAE,CAAA;AACzI,MAAM,MAAM,SAAS,GAAG,MAAM,WAAW,CAAA;AACzC,MAAM,MAAM,QAAQ,CAAC,GAAG,SAAS,SAAS,IAAI,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA;AAC9H,MAAM,MAAM,MAAM,GAAG;KAAG,GAAG,IAAI,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC;CAAE,CAAC,SAAS,CAAC,CAAA;AACrE,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAI5F,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAQ/E;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CA6BlI;AA4BD,wBAAsB,aAAa,CAAC,KAAK,EAAE,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAI/H"}
@@ -1,7 +1,8 @@
1
1
  import { matchesGlob } from '../../utils/matches-glob.js';
2
2
  import { parseShell } from '../../utils/parse-shell.js';
3
3
  import { callBaseOf } from '../../utils/call-effects.js';
4
- import { nameOf, realPathOf, relativePath } from '../../utils/paths.js';
4
+ import { realPathOf, relativePath } from '../../utils/paths.js';
5
+ import { basename } from '../../vendor.js';
5
6
  const targetKeys = ['command', 'read', 'write', 'fetch', 'subagent', 'tool'];
6
7
  export function targetOf(target) {
7
8
  const keys = targetKeys.filter((key) => key in target);
@@ -51,10 +52,10 @@ function commandPattern(pattern) {
51
52
  const command = parseShell(pattern).commands[0];
52
53
  if (command === undefined)
53
54
  throw new Error(`The command pattern '${pattern}' names no program.`);
54
- return command;
55
+ return command.argv;
55
56
  }
56
57
  function commandMatches(pattern, argv) {
57
- if (nameOf(argv[0]) !== nameOf(pattern[0]))
58
+ if (basename(argv[0]) !== basename(pattern[0]))
58
59
  return false;
59
60
  const wanted = splitArguments(pattern.slice(1));
60
61
  const actual = splitArguments(argv.slice(1));
package/mod.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AskOptions, ClassicHookInputs, CmodDependencies, FsEntry, HookStream, HttpInit, HttpResponse, PermissionRequestDecision, ProcessRunInit, ProcessRunResult, ProcessSpawnChunk, ProcessSpawnRequest, ProcessSpawnResult, RenderElement, Settings, SettingsReadArgs } from 'claude-code';
1
+ import type { AgentSpawnArgs, AgentSpawnResult, AskOptions, ClassicHookInputs, CmodDependencies, FsEntry, FsStat, FsStatOptions, HookStream, HttpInit, HttpResponse, PaneOpenArgs, PermissionRequestDecision, ProcessRunInit, ProcessRunResult, ProcessSpawnChunk, ProcessSpawnRequest, ProcessSpawnResult, RenderElement, Settings, SettingsReadArgs, ToastOptions, UiScrollArgs, UiScrollResult } from 'claude-code';
2
2
  import type { Claude } from './runtime/claude.js';
3
3
  import type { RoutedEvent } from './runtime/hooks.js';
4
4
  import type { RoutedHook } from './runtime/router.js';
@@ -11,16 +11,16 @@ export type ProgressStep = {
11
11
  readonly label?: string;
12
12
  };
13
13
  export type PaneHandle = {
14
- open(): Promise<void>;
14
+ open(options?: Readonly<Pick<PaneOpenArgs, 'focus'>>): Promise<void>;
15
15
  close(): Promise<void>;
16
- toggle(): Promise<void>;
16
+ toggle(options?: Readonly<Pick<PaneOpenArgs, 'focus'>>): Promise<void>;
17
17
  readonly isOpen: boolean;
18
18
  };
19
19
  export type { Claude, RoutedEvent, RoutedHook, ToolCalls };
20
20
  export { longestMs } from './runtime/deadline.js';
21
21
  export { notInstalled } from './runtime/dependencies.js';
22
22
  export { messageOf } from './utils/text.js';
23
- export type ModEvent = 'SessionStart' | 'SessionEnd' | 'UserPromptSubmit' | 'InstructionsLoaded' | 'PreToolUse' | 'PermissionRequest' | 'PermissionDenied' | 'PostToolUse' | 'PostToolUseFailure' | 'PostToolBatch' | 'SubagentStart' | 'SubagentStop' | 'Notification' | 'PreCompact' | 'Stop' | 'StopFailure' | 'CwdChanged';
23
+ export type ModEvent = 'SessionStart' | 'SessionEnd' | 'UserPromptSubmit' | 'InstructionsLoaded' | 'PreToolUse' | 'PermissionRequest' | 'PermissionDenied' | 'PostToolUse' | 'PostToolUseFailure' | 'PostToolBatch' | 'SubagentStart' | 'SubagentStop' | 'Notification' | 'PreCompact' | 'Stop' | 'StopFailure' | 'CwdChanged' | 'FileChanged';
24
24
  export type HookAnswer = {
25
25
  continue?: boolean;
26
26
  stopReason?: string;
@@ -69,7 +69,8 @@ type HookInputs = Omit<ClassicHookInputs, 'PreToolUse' | 'PostToolUse' | 'PostTo
69
69
  };
70
70
  CwdChanged: Omit<ClassicHookInputs['CwdChanged'], 'transcript_path'>;
71
71
  };
72
- export type ModHook<E extends ModEvent> = (input: HookInputs[E]) => HookAnswer | void | Promise<HookAnswer | void>;
72
+ export type HookInput<E extends ModEvent> = HookInputs[E];
73
+ export type ModHook<E extends ModEvent> = (input: HookInput<E>) => HookAnswer | void | Promise<HookAnswer | void>;
73
74
  export type Mod<State extends object = Record<never, never>> = {
74
75
  readonly name: string;
75
76
  readonly state: Readonly<State>;
@@ -79,9 +80,10 @@ export type Mod<State extends object = Record<never, never>> = {
79
80
  readonly ui: {
80
81
  pane(pane: Pane<State>): PaneHandle;
81
82
  render<S extends Slot>(slot: S, Component: (props: SlotProps<S>) => RenderElement): void;
82
- toast(text: string): void;
83
+ toast(text: string, options?: ToastOptions): void;
83
84
  progress<T>(title: string, task: (report: (step: ProgressStep) => void) => Promise<T>): Promise<T>;
84
85
  ask(question: string, options?: readonly string[] | AskOptions): Promise<string>;
86
+ scroll(args: UiScrollArgs): Promise<UiScrollResult>;
85
87
  };
86
88
  readonly process: {
87
89
  run(argv: readonly string[], init?: ProcessRunInit): Promise<ProcessRunResult>;
@@ -91,6 +93,8 @@ export type Mod<State extends object = Record<never, never>> = {
91
93
  read(path: string): Promise<string>;
92
94
  write(path: string, text: string): Promise<void>;
93
95
  list(path?: string): Promise<FsEntry[]>;
96
+ exists(path: string): Promise<boolean>;
97
+ stat(path: string, options?: FsStatOptions): Promise<FsStat>;
94
98
  };
95
99
  readonly http: {
96
100
  fetch(url: string, init?: HttpInit): Promise<HttpResponse>;
@@ -98,6 +102,12 @@ export type Mod<State extends object = Record<never, never>> = {
98
102
  readonly settings: {
99
103
  read(args?: SettingsReadArgs): Promise<Settings>;
100
104
  };
105
+ readonly session: {
106
+ messages: Claude['session']['messages'];
107
+ };
108
+ readonly agent: {
109
+ spawn(args: AgentSpawnArgs): Promise<AgentSpawnResult>;
110
+ };
101
111
  readonly projectRoot: string;
102
112
  readonly cwd: string;
103
113
  readonly dependencies: CmodDependencies;
package/mod.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,EACP,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,yBAAyB,EACzB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,QAAQ,EACR,gBAAgB,EACjB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,K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AG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7C,CAAA;AAED,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI;IACpE,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,EAAE,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;IAC9D,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5D,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,KAAK,SAAS,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,KAAK,MAAM,CAAA;AAE7G,wBAAgB,SAAS,CAAC,KAAK,SAAS,WAAW,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,UAAU,EAAE,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,CAG5K"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmodjs/core",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "Build Claude Code mods: hooks, panes, permissions, checks, and an install that just works.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -43,6 +43,7 @@
43
43
  "mdast-util-to-string": "^4.0.0",
44
44
  "micromark-extension-gfm": "^3.0.0",
45
45
  "oxlint": "1.86.0",
46
+ "pathe": "^2.0.3",
46
47
  "picomatch": "^4.0.7",
47
48
  "shell-quote": "^1.12.0",
48
49
  "typescript": "^7.0.2"
package/path.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { basename, dirname, extname, isAbsolute, join, normalize, relative, resolve } from './vendor.js';
2
+ //# sourceMappingURL=path.d.ts.map
package/path.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["src/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA"}
package/path.js ADDED
@@ -0,0 +1 @@
1
+ export { basename, dirname, extname, isAbsolute, join, normalize, relative, resolve } from './vendor.js';
package/register.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["src/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoD,EAAE,EAAE,MAAM,aAAa,CAAA;AACvF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AA0E7C,wBAAgB,WAAW,CAAC,KAAK,SAAS,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI,CA4BrG;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,EAAE,GAAG,IAAI,CAKzD"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["src/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoD,EAAE,EAAE,MAAM,aAAa,CAAA;AACvF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AA+E7C,wBAAgB,WAAW,CAAC,KAAK,SAAS,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI,CA8BrG;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,EAAE,GAAG,IAAI,CAIzD"}
package/register.js CHANGED
@@ -14,6 +14,7 @@ async function startMod($, eventInput, passOn) {
14
14
  open: (pane) => $.ui.open(pane),
15
15
  close: (pane) => $.ui.close(pane),
16
16
  panes: () => $.ui.panes(),
17
+ scroll: (args) => $.ui.scroll(args),
17
18
  resolve: (render) => $.ui.resolve(render),
18
19
  },
19
20
  process: {
@@ -47,10 +48,14 @@ async function startMod($, eventInput, passOn) {
47
48
  model: () => $.session.model(),
48
49
  usage: () => $.session.usage(),
49
50
  surfaces: () => $.session.surfaces(),
51
+ messages: ((args) => (args === undefined ? $.session.messages() : $.session.messages(args))),
50
52
  },
51
53
  command: { register: (command) => $.command.register(command) },
52
54
  tool: { register: (tool) => $.tool.register(tool) },
53
- agent: { list: () => $.agent.list() },
55
+ agent: {
56
+ list: () => $.agent.list(),
57
+ spawn: (args) => $.agent.spawn(args),
58
+ },
54
59
  env: {
55
60
  home: () => $.env.get('HOME'),
56
61
  dataHome: () => $.env.get('XDG_DATA_HOME'),
@@ -82,6 +87,7 @@ export function registerMod(addHook, definition) {
82
87
  addHook('classic.PreCompact', routeToMod);
83
88
  addHook('classic.Stop', routeToMod);
84
89
  addHook('classic.StopFailure', routeToMod);
90
+ addHook('classic.FileChanged', routeToMod);
85
91
  addHook('tool.call', routeToMod);
86
92
  addHook('prompt.submit', routeToMod);
87
93
  addHook('prompt.context', routeToMod);
@@ -90,12 +96,12 @@ export function registerMod(addHook, definition) {
90
96
  addHook('skill.prompt', routeToMod);
91
97
  addHook('ui.render', routeToMod);
92
98
  addHook('ui.press', routeToMod);
99
+ addHook('ui.scroll', routeToMod);
93
100
  addHook('ui.close', routeToMod);
94
101
  addHook('cmod.call', routeToMod);
95
102
  }
96
103
  export function registerPermissionCheck(addHook) {
97
104
  checksPermissions = true;
98
105
  addHook('tool.check', routeToMod);
99
- addHook('classic.PreToolUse', routeToMod);
100
106
  addHook('classic.PermissionRequest', routeToMod);
101
107
  }
@@ -1,4 +1,4 @@
1
- import type { AgentInfo, Args, AskOptions, CommandSpec, ElementTable, FsEntry, FsStat, FsStatOptions, HookStream, HttpInit, HttpResponse, InvalidatableEventName, PaneCloseArgs, PaneOpenArgs, ProcessRunInit, ProcessRunResult, ProcessSpawnChunk, ProcessSpawnRequest, ProcessSpawnResult, RenderSurface, ResolveInput, SessionUsage, Settings, SettingsReadArgs, Timer, ToastOptions, ToolSpec, UiLogOptions, UiOpenResult, UiPane } from 'claude-code';
1
+ import type { AgentInfo, AgentSpawnArgs, AgentSpawnResult, Args, EngineInterface, AskOptions, CommandSpec, ElementTable, FsEntry, FsStat, FsStatOptions, HookStream, HttpInit, HttpResponse, InvalidatableEventName, PaneCloseArgs, PaneOpenArgs, ProcessRunInit, ProcessRunResult, ProcessSpawnChunk, ProcessSpawnRequest, ProcessSpawnResult, RenderSurface, ResolveInput, SessionUsage, Settings, SettingsReadArgs, Timer, ToastOptions, ToolSpec, UiLogOptions, UiOpenResult, UiPane, UiScrollArgs, UiScrollResult } from 'claude-code';
2
2
  export type Claude = {
3
3
  readonly plugin: {
4
4
  readonly name: string;
@@ -14,6 +14,7 @@ export type Claude = {
14
14
  open(pane: PaneOpenArgs): Promise<UiOpenResult>;
15
15
  close(pane: PaneCloseArgs): Promise<void>;
16
16
  panes(): Promise<readonly UiPane[]>;
17
+ scroll(args: UiScrollArgs): Promise<UiScrollResult>;
17
18
  resolve(e: ResolveInput): ElementTable<RenderSurface>;
18
19
  };
19
20
  readonly process: {
@@ -51,6 +52,7 @@ export type Claude = {
51
52
  model(): Promise<string>;
52
53
  usage(): Promise<SessionUsage>;
53
54
  surfaces(): Promise<readonly RenderSurface[]>;
55
+ messages: EngineInterface['session']['messages'];
54
56
  };
55
57
  readonly command: {
56
58
  register(command: CommandSpec): Promise<{
@@ -64,6 +66,7 @@ export type Claude = {
64
66
  };
65
67
  readonly agent: {
66
68
  list(): Promise<AgentInfo[]>;
69
+ spawn(args: AgentSpawnArgs): Promise<AgentSpawnResult>;
67
70
  };
68
71
  readonly env: {
69
72
  home(): Promise<string | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../src/runtime/claude.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,IAAI,EACJ,UAAU,EACV,WAAW,EACX,YAAY,EACZ,OAAO,EACP,MAAM,EACN,aAAa,EACb,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,sBAAsB,EACtB,aAAa,EACb,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,gBAAgB,EAChB,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,MAAM,EACP,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IACjE,QAAQ,CAAC,EAAE,EAAE;QACX,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;QACjD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAA;QACtC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;QAC/C,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAA;QACzD,UAAU,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAAA;QAC/C,GAAG,CAAC,QAAQ,EAAE,MA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AC,IAAI,EAAE;QAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;KAAE,CAAA;CACpE,CAAA"}
@@ -2,9 +2,17 @@ import type { ModEvent, ModHook } from '../mod.js';
2
2
  import type { Claude } from './claude.js';
3
3
  import type { RoutedHook } from './router.js';
4
4
  import { type ToolCalls } from './tool-calls.js';
5
- export type RoutedEvent = `classic.${ModEvent}` | 'tool.check' | 'tool.call' | 'prompt.submit' | 'prompt.context' | 'command.run' | 'session.measure' | 'skill.prompt' | 'ui.render' | 'ui.press' | 'ui.close' | 'cmod.call';
5
+ export type RoutedEvent = `classic.${Exclude<ModEvent, 'PreToolUse'>}` | 'tool.check' | 'tool.call' | 'prompt.submit' | 'prompt.context' | 'command.run' | 'session.measure' | 'skill.prompt' | 'ui.render' | 'ui.press' | 'ui.scroll' | 'ui.close' | 'cmod.call';
6
6
  export declare const permissionEvents: readonly RoutedEvent[];
7
- export declare function classicHook<E extends ModEvent>(name: string, event: E, hook: ModHook<E>, claude: Claude, calls: ToolCalls): RoutedHook<RoutedEvent>;
7
+ export declare function classicHook<E extends Exclude<ModEvent, 'PreToolUse'>>(name: string, event: E, hook: ModHook<E>, claude: Claude, calls: ToolCalls): RoutedHook<RoutedEvent>;
8
+ type HeldDecision = {
9
+ readonly decision: 'allow' | 'ask';
10
+ readonly reason?: string;
11
+ };
12
+ export type HeldDecisions = Map<string, HeldDecision>;
13
+ export declare function preToolUseHook(name: string, hook: ModHook<'PreToolUse'>, claude: Claude, calls: ToolCalls, held: HeldDecisions | undefined): RoutedHook<'tool.call'>;
14
+ export declare function heldDecisionHook(held: HeldDecisions): RoutedHook<'tool.check'>;
8
15
  export declare function userSkillHook(claude: Claude): RoutedHook<'skill.prompt'>;
9
16
  export declare const strictness: readonly ['allow', 'ask', 'deny'];
17
+ export {};
10
18
  //# sourceMappingURL=hooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/runtime/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAK7D,MAAM,MAAM,WAAW,GACnB,WAAW,QAAQ,EAAE,GACrB,YAAY,GACZ,WAAW,GACX,eAAe,GACf,gBAAgB,GAChB,aAAa,GACb,iBAAiB,GACjB,cAAc,GACd,WAAW,GACX,UAAU,GACV,UAAU,GACV,WAAW,CAAA;AAEf,eAAO,MAAM,gBAAgB,EAAE,SAAS,WAAW,EAAsE,CAAA;AA8BzH,wBAAgB,WAAW,CAAC,CAAC,SAAS,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,UAAU,CAAC,WAAW,CAAC,CA0BnJ;AAMD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC,cAAc,CAAC,CAexE;AA4DD,eAAO,MAAM,UAAU,YAAI,OAAO,EAAE,KAAK,EAAE,MAAM,CAAU,CAAA"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/runtime/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAyB,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAK3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