@cmodjs/core 5.2.1 → 5.4.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.
- package/docs/commands.md +26 -2
- package/docs/dependencies.md +27 -0
- package/docs/install-steps.md +2 -0
- package/docs/jobs.md +1 -1
- package/docs/mod.md +9 -0
- package/docs/options.md +2 -0
- package/docs/state.md +1 -1
- package/docs/testing.md +2 -2
- package/docs/ui.md +1 -1
- package/jobs/program.d.ts.map +1 -1
- package/jobs/program.js +55 -4
- package/mod.d.ts +4 -0
- package/mod.d.ts.map +1 -1
- package/mod.js +3 -0
- package/options.d.ts +5 -0
- package/options.d.ts.map +1 -1
- package/options.js +52 -0
- package/package.json +1 -1
- package/records.d.ts +2 -2
- package/records.js +2 -2
- package/register.d.ts.map +1 -1
- package/register.js +23 -3
- package/runtime/claude.d.ts +2 -0
- package/runtime/claude.d.ts.map +1 -1
- package/runtime/conversations.js +8 -8
- package/runtime/deadline.d.ts +2 -0
- package/runtime/deadline.d.ts.map +1 -1
- package/runtime/deadline.js +17 -0
- package/runtime/dependencies.d.ts +1 -0
- package/runtime/dependencies.d.ts.map +1 -1
- package/runtime/dependencies.js +1 -0
- package/runtime/device.d.ts +13 -2
- package/runtime/device.d.ts.map +1 -1
- package/runtime/engine.d.ts +2 -0
- package/runtime/engine.d.ts.map +1 -1
- package/runtime/hooks.js +2 -2
- package/runtime/hotkeys.js +1 -1
- package/runtime/installer.js +1 -1
- package/runtime/lifecycle.d.ts.map +1 -1
- package/runtime/lifecycle.js +106 -75
- package/runtime/metadata.js +1 -1
- package/runtime/options.d.ts.map +1 -1
- package/runtime/options.js +6 -31
- package/runtime/pages.js +3 -3
- package/runtime/programs.d.ts +1 -0
- package/runtime/programs.d.ts.map +1 -1
- package/runtime/programs.js +6 -0
- package/runtime/sessions.js +1 -1
- package/runtime/state.d.ts +1 -0
- package/runtime/state.d.ts.map +1 -1
- package/runtime/state.js +6 -3
- package/runtime/toaster.d.ts +5 -0
- package/runtime/toaster.d.ts.map +1 -1
- package/runtime/toaster.js +27 -11
- package/runtime/ui.d.ts +1 -0
- package/runtime/ui.d.ts.map +1 -1
- package/runtime/ui.js +6 -6
- package/runtime/widgets.js +1 -1
- package/src/jobs/program.ts +60 -4
- package/src/mod.ts +5 -0
- package/src/options.ts +51 -0
- package/src/records.ts +2 -2
- package/src/register.ts +25 -3
- package/src/runtime/claude.ts +2 -0
- package/src/runtime/conversations.ts +8 -8
- package/src/runtime/deadline.ts +16 -0
- package/src/runtime/dependencies.ts +2 -0
- package/src/runtime/device.ts +7 -3
- package/src/runtime/engine.ts +2 -0
- package/src/runtime/hooks.ts +2 -2
- package/src/runtime/hotkeys.ts +1 -1
- package/src/runtime/installer.ts +1 -1
- package/src/runtime/lifecycle.ts +97 -67
- package/src/runtime/metadata.ts +1 -1
- package/src/runtime/options.ts +5 -26
- package/src/runtime/pages.ts +3 -3
- package/src/runtime/programs.ts +7 -0
- package/src/runtime/sessions.ts +1 -1
- package/src/runtime/state.ts +7 -3
- package/src/runtime/toaster.ts +47 -12
- package/src/runtime/ui.ts +6 -6
- package/src/runtime/widgets.ts +1 -1
- package/src/testing/fake-claude.ts +2 -0
- package/src/testing.ts +8 -4
- package/testing/fake-claude.d.ts.map +1 -1
- package/testing/fake-claude.js +2 -0
- package/testing.d.ts.map +1 -1
- package/testing.js +9 -4
package/docs/commands.md
CHANGED
|
@@ -241,6 +241,30 @@ cmod download <program> <machine> <url> <sha256> [<machine> <url> <sha256> …]
|
|
|
241
241
|
|
|
242
242
|
Downloads a program for an install script: fetches the download for this machine, checks its SHA-256, unpacks it, and moves `<program>` to `$CMOD_DATA/bin/<program>`. [install-steps.md](install-steps.md) explains it.
|
|
243
243
|
|
|
244
|
+
## Run from a mod's program
|
|
245
|
+
|
|
246
|
+
A mod's own program runs outside any session, as one copy per computer or over `ssh` on a computer with no Claude Code open. These give it what a mod reads in a session.
|
|
247
|
+
|
|
248
|
+
### cmod options
|
|
249
|
+
|
|
250
|
+
```text
|
|
251
|
+
cmod options <mod> [--project <folder>]... [--json]
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Prints a mod's option values in two levels. `person` holds the values the person set in `/config`. `projects` holds the values each project's committed `.claude/cmods/<mod>/options.json` sets, keyed by the project's git root as `git rev-parse --show-toplevel` prints it, or by the project's own folder outside git. With no `--project`, it reads every project cmod's conversation index holds a session of, and lists only those whose `options.json` exists. It leaves out secrets, and the entries a session would ignore, and names each of those on stderr. A session uses a project's value over the person's, and a value the person's organization locks over both, which this command cannot read outside Claude Code. `--json` prints `{ person, projects }`:
|
|
255
|
+
|
|
256
|
+
```json
|
|
257
|
+
{ "person": { "folders": ["~/notes"] }, "projects": { "/Users/ana/work/app": { "folders": ["plans"] } } }
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### cmod device
|
|
261
|
+
|
|
262
|
+
```text
|
|
263
|
+
cmod device [--json]
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Prints the computer as a mod's `device.read()` gives it: its id, name, operating system, and architecture ([mod.md](mod.md#device-the-computer-the-session-runs-on)). It runs the same reader, so a program names each computer by the id its mod sees. `--json` prints `{ id, name, os, arch }`. On a computer with no machine id, it exits 1 and says so.
|
|
267
|
+
|
|
244
268
|
## Run by cmod
|
|
245
269
|
|
|
246
270
|
cmod runs these itself. A person runs them to see a step's whole log, or to finish a step.
|
|
@@ -308,10 +332,10 @@ Starts a task in a new background Claude Code session, for a mod's `startTask` w
|
|
|
308
332
|
### cmod program
|
|
309
333
|
|
|
310
334
|
```text
|
|
311
|
-
cmod program <mod> -- <command…>
|
|
335
|
+
cmod program <mod> [--no-wait] -- <command…>
|
|
312
336
|
```
|
|
313
337
|
|
|
314
|
-
Runs one copy of a mod's program for the whole computer, for a `program` job with `singleInstance` ([jobs.md](jobs.md#program))
|
|
338
|
+
Runs one copy of a mod's program for the whole computer, for a `program` job with `singleInstance` ([jobs.md](jobs.md#program)). The first one takes `instances/<mod>/<program>.json.lock` in the cmod store, runs the command without `CLAUDE_CODE_SESSION_ID`, because the copy serves every session, writes its first line on standard output, its address, with the copy's process to `instances/<mod>/<program>.json`, and prints it. It touches its file in the lock every 5 seconds. With `--no-wait`, which a mod's session passes, another one touches the holder's file, prints `held`, and exits 0, and the session reads the address from `instances/<mod>/<program>.json` and runs `cmod program` again once that file is gone or the holder's file is 15 seconds old. Without it, as a mod built on `@cmodjs/core` before 5.3.0 runs it, another one prints the address in that file, then each new one as it changes, and tries the lock again whenever that folder changes and every 5 seconds, so it takes over once the holder exits. A lock whose process is gone counts as free. The holder stops its copy and gives up the lock on SIGTERM, SIGINT, or SIGHUP, and when the session that started it exits, which it checks every 5 seconds. When the copy exits on its own, the holder exits with the copy's exit code, and the copy's standard error passes through. A new holder that finds a copy an earlier holder left running sends it SIGTERM, then SIGKILL after 5 seconds, and starts its own copy only once that one is gone, so two copies never run at once.
|
|
315
339
|
|
|
316
340
|
### cmod option
|
|
317
341
|
|
package/docs/dependencies.md
CHANGED
|
@@ -92,6 +92,33 @@ export const outline = defineMod({
|
|
|
92
92
|
})
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
## Call a mod only when it runs: mods.isLoaded
|
|
96
|
+
|
|
97
|
+
A mod that works without another mod, and only uses it when the person has it, does not list it, because Claude Code installs every listed dependency for everyone who installs your mod. Ask whether it runs first, then call it through `mod.dependencies` as usual:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import { defineMod, mods } from '../node_modules/@cmodjs/core/mod.js'
|
|
101
|
+
|
|
102
|
+
export const inbox = defineMod({
|
|
103
|
+
name: 'inbox',
|
|
104
|
+
setup(mod) {
|
|
105
|
+
return {
|
|
106
|
+
save: async () => {
|
|
107
|
+
if (await mods.isLoaded('anyhost')) await mod.dependencies.anyhost.sync({ folder: mod.dataFolder })
|
|
108
|
+
},
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
})
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
isLoaded(name: string): Promise<boolean>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
- `isLoaded` answers true when the mod runs in this Claude Code process, as one Claude Code loaded or one run from its checkout with `--plugin-dir`. A mod the person installed but turned off answers false.
|
|
119
|
+
- Claude Code lays a provider's types file beside your mod's only for a listed dependency, so type the methods you call in your own `types/index.d.ts`, with the shape the provider's types file exports, such as `interface CmodDependencies { anyhost: Anyhost }`.
|
|
120
|
+
- A mod that calls `mods.isLoaded` runs on cmod 5.4.0 or later, which the `cmod` range `cmod check` writes says.
|
|
121
|
+
|
|
95
122
|
## When a call fails
|
|
96
123
|
|
|
97
124
|
A call that cannot answer rejects with one of these reasons:
|
package/docs/install-steps.md
CHANGED
|
@@ -233,3 +233,5 @@ A mod runs on macOS and Linux, on arm64 and x64, unless the `os` and `cpu` keys
|
|
|
233
233
|
Claude Code itself has no field for this, and installs the mod on any machine.
|
|
234
234
|
|
|
235
235
|
The cmod repository ships the `cmod` program this way. Its `package.json` holds `"cmod": { "program": "cmod" }`, and its `cli/package.json` holds `"cmod": { "build": "bun run build", "output": "dist" }`.
|
|
236
|
+
|
|
237
|
+
Its `build` script passes `--no-compile-autoload-dotenv --no-compile-autoload-bunfig` to `bun build --compile`, because a compiled Bun program otherwise loads the `.env` and `bunfig.toml` of the folder it runs in, and runs that `bunfig.toml`'s `preload` scripts inside itself. It starts with `trap 'rm -f .*.bun-build' EXIT;`, because Bun 1.4.4 leaves an 89 MB `.<hash>-00000000.bun-build` file beside every compile.
|
package/docs/jobs.md
CHANGED
|
@@ -332,7 +332,7 @@ type Program = {
|
|
|
332
332
|
- The program's first line on standard output must be its address: `127.0.0.1:<port>`, or `unix:<absolute socket path>`. `ready()` then resolves `{ url: 'http://127.0.0.1:<port>' }`, or `{ url: 'http://localhost', socketPath }`. Pass both to `http.fetch`, which reaches that address.
|
|
333
333
|
- In an interactive session the program starts with the mod. Otherwise it starts at the first `ready()`.
|
|
334
334
|
- When the program exits, cmod starts it again after 1, 2, 4, 8, and 16 seconds. After 5 failed tries, or a first line that is not an address, the state is `fatal`, `ready()` rejects, and cmod logs `<mod>: the <program> program stopped: <reason>`.
|
|
335
|
-
- `singleInstance: true` runs one copy on the computer, however many sessions load the mod, such as a server that is the only writer of its data.
|
|
335
|
+
- `singleInstance: true` runs one copy on the computer, however many sessions load the mod, such as a server that is the only writer of its data. The first session starts the copy through [`cmod program`](commands.md#cmod-program), every other session reads the copy's address from the cmod store and runs no process of its own, and every session's `ready()` resolves that copy's address. When the session running the copy ends, another open session starts a new copy within a few seconds, or within 20 seconds when the copy's session was killed with its `cmod program`, and from then on `ready()` resolves the new address in every session, so ask `ready()` before each use rather than keeping its answer. A copy a killed session left running is stopped before the new one starts. Two `singleInstance` programs with the same program name in one mod throw at `mod.use`.
|
|
336
336
|
- A program that ships with the mod gets onto `PATH` through the `program` key of the mod's `package.json` ([install-steps.md](install-steps.md)). A program an install step fetched with `cmod download` is not on `PATH`, so `command` names it by its full path, `${mod.dataFolder}/bin/<program>`.
|
|
337
337
|
|
|
338
338
|
```ts
|
package/docs/mod.md
CHANGED
|
@@ -540,6 +540,7 @@ type Device = { id: string; name: string; os: 'darwin' | 'linux'; arch: 'arm64'
|
|
|
540
540
|
- `name` is the name the computer goes by on its network: its LocalHostName on macOS, such as `Jordans-Mac-mini`, and its hostname on Linux.
|
|
541
541
|
- `os` and `arch` are the names cmod's builds use, such as `darwin` and `arm64`.
|
|
542
542
|
- `read` reads the computer the first time the mod calls it, and answers the same device after that. It rejects on a computer other than macOS or Linux on arm64 or x64. It also rejects on a Linux computer where neither `/etc/machine-id` nor `/var/lib/dbus/machine-id` holds a machine id, as in many containers, with a sentence that names both files.
|
|
543
|
+
- A mod's program that runs with no session, such as over `ssh`, reads the same device with `cmod device --json` ([commands.md](commands.md#cmod-device)).
|
|
543
544
|
- Each turn names the device it ran on, as `turn.device` ([session.md](session.md#turn-context-goal-and-task)), so a mod tells which computer ran each turn of a session that moved between computers. A start on a computer without a machine id names no device, so the turns after it keep the device of the start before, or have none.
|
|
544
545
|
|
|
545
546
|
```ts
|
|
@@ -547,6 +548,14 @@ const here = await device.read()
|
|
|
547
548
|
const elsewhere = (await sessions.current.turns()).filter((turn) => turn.device !== undefined && turn.device.id !== here.id)
|
|
548
549
|
```
|
|
549
550
|
|
|
551
|
+
## mods: the other mods that run
|
|
552
|
+
|
|
553
|
+
```ts
|
|
554
|
+
mods.isLoaded(name: string): Promise<boolean>
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
Answers whether a mod runs in this Claude Code process, so a mod calls another mod it does not list only when the person has it ([dependencies.md](dependencies.md#call-a-mod-only-when-it-runs-modsisloaded)).
|
|
558
|
+
|
|
550
559
|
## messageOf
|
|
551
560
|
|
|
552
561
|
```ts
|
package/docs/options.md
CHANGED
|
@@ -55,6 +55,8 @@ An option with no default and no value is asked before `setup` runs, on the mod'
|
|
|
55
55
|
|
|
56
56
|
`mod.options` follows the values while the session runs. Read an option where you use it, as in `mod.options.branch`, so a change applies at once. A change in `/config` reloads the mod, and a `/cd` reads the new project's `options.json`.
|
|
57
57
|
|
|
58
|
+
A mod that needs both levels at once, such as one that syncs the person's folders and every project's, reads them with `cmod options <mod> --json`. It prints the person's values and each project's, for every project the computer has had sessions in ([commands.md](commands.md#cmod-options)).
|
|
59
|
+
|
|
58
60
|
## Set options for a team
|
|
59
61
|
|
|
60
62
|
A project sets options for everyone who works in it with an `options.json` in its config folder, committed with the repository:
|
package/docs/state.md
CHANGED
|
@@ -79,7 +79,7 @@ export const reads = defineMod({
|
|
|
79
79
|
})
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
- Keep only JSON data in a saved group. A value cmod cannot save
|
|
82
|
+
- Keep only JSON data in a saved group. A value cmod cannot save, such as one that is not JSON, fails as `Could not keep state.<group>.<key>`, with Claude Code's reason under it.
|
|
83
83
|
- cmod saves values one at a time in the order they were assigned.
|
|
84
84
|
|
|
85
85
|
## Where the values come from
|
package/docs/testing.md
CHANGED
|
@@ -45,7 +45,7 @@ type TestOptions<State, Options> = {
|
|
|
45
45
|
| `scope` | `'project'` makes the mod a project plugin, in `<projectRoot>/.claude/skills/<name>` | `'user'` |
|
|
46
46
|
| `projectRoot` | `sessions.current.project` | `/test/plugins/<name>`, or `/test/project` for a project plugin |
|
|
47
47
|
| `cwd` | `sessions.current.cwd` | `projectRoot` |
|
|
48
|
-
| `dependencies` | The methods other mods answer with | none: every call fails with `<name> is not installed. Install it in Plugins
|
|
48
|
+
| `dependencies` | The methods other mods answer with, and the mods `mods.isLoaded` answers true for | none: every call fails with `<name> is not installed. Install it in Plugins.`, and `mods.isLoaded` answers true only for the tested mod and cmod |
|
|
49
49
|
| `files` | The fake file system, absolute path to text | no files |
|
|
50
50
|
| `links` | Symbolic links in the fake file system, absolute link path to its target | no links |
|
|
51
51
|
| `secrets` | The mod's secrets `mod.secrets` starts with, key to value. The fake keeps what the mod stores in memory, and `tested.calls` never holds a value | no secrets |
|
|
@@ -310,7 +310,7 @@ Set a fake to answer a call:
|
|
|
310
310
|
- `device.read` answers `{ id: '5f0e8c2a9b7d4e31a6c4d2b0e8f71a93', name: 'test-computer', os: 'linux', arch: 'x64' }` unless set, so `device.read()` and each turn's `device` answer the same in every test on every computer. Set it to test the mod on another computer, or to reject to test a computer cmod cannot read, where the cmod plugin's note is left out and turns have no `device`.
|
|
311
311
|
- A call with no fake throws `<call>(<args>) has no fake answer. Set fakes.<call> on the tested mod.` So set `fakes.process.run` before a test runs a program, and `fakes.ui.ask` before the mod asks a question.
|
|
312
312
|
- A `program` job is the exception: it catches the `process.spawn` error and retries after 1, 2, 4, 8 and 16 seconds on real timers, so its `ready()` waits past `bun test`'s 5-second timeout. Set `fakes.process.spawn` before a test starts a `program` job.
|
|
313
|
-
- A `program` job with `singleInstance` spawns `/test/home/.local/share/cmod/programs/cmod program <mod> -- <command…>`, so `fakes.process.spawn` gets that `argv
|
|
313
|
+
- A `program` job with `singleInstance` spawns `/test/home/.local/share/cmod/programs/cmod program <mod> --no-wait -- <command…>`, so `fakes.process.spawn` gets that `argv`, and the first line the fake writes to standard output is the address of the copy this session runs. A fake that writes `held` and ends tests a session another session runs the copy for: `ready()` resolves the address in `/test/home/.local/share/cmod/instances/<mod>/<program>.json`, which the test gives as `{"address":"unix:/tmp/x.sock"}` in `files`.
|
|
314
314
|
- `files` already fills the `fs` fakes: a write is read back, and `list` lists the given files. The fake file system resolves a relative path against `/`, not against the session's working folder, so a mod under test reads `${sessions.current.project}/<file>` rather than a relative path. `fs.list()` with no path rejects.
|
|
315
315
|
- `ui.open` places every pane by default. A fake that answers `{ isPlaced: false }` holds a pane back.
|
|
316
316
|
- `ui.scroll` answers `{}` by default, as when the window moved. A fake that answers `{ deny }` refuses the scroll.
|
package/docs/ui.md
CHANGED
|
@@ -440,7 +440,7 @@ type ToastOptions = {
|
|
|
440
440
|
- `✕` closes the toast. The band shows the newest 3, and `+N more` shows every toast.
|
|
441
441
|
- `promise` shows `loading` while `task` runs, then `success` or `error` in the same row. `unwrap()` resolves or rejects as `task` does.
|
|
442
442
|
|
|
443
|
-
Every error cmod catches for a mod, such as a listener that throws, goes to the Log, in Settings on cmod's page. The Log keeps the newest 100 failures of every session, each with the mod, the time, the message, `Copy`, and `Report`, and the same failure again updates its entry.
|
|
443
|
+
Every error cmod catches for a mod, such as a listener that throws, goes to the Log, in Settings on cmod's page, and so does every warning cmod has for a mod, such as a session that did not hear of its listener. A warning never shows a toast. The Log keeps the newest 100 failures of every session, each with the mod, the time, the message, the versions of the mod, its `@cmodjs/core`, cmod, and Claude Code, `Copy`, and `Report`, and the same failure again updates its entry and counts the repeat.
|
|
444
444
|
|
|
445
445
|
An error also shows as a toast when any of these holds:
|
|
446
446
|
|
package/jobs/program.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/jobs/program.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/jobs/program.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAQpC,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;IACxE,KAAK,IAAI,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACvD,CAAA;AAYD,wBAAgB,OAAO,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,GAAG,CAAC,OAAO,CAAC,CAwIxK"}
|
package/jobs/program.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
import { instancePath, storeFolder } from '../records.js';
|
|
1
2
|
import { engineOf } from '../runtime/engine.js';
|
|
3
|
+
import { isHeld } from '../runtime/programs.js';
|
|
4
|
+
import { ifMissing } from '../utils/paths.js';
|
|
2
5
|
import { messageOf } from '../utils/text.js';
|
|
3
6
|
import { basename } from '../vendor.js';
|
|
4
7
|
const backoffSeconds = [1, 2, 4, 8, 16];
|
|
8
|
+
const leaseCheckMs = 5000;
|
|
9
|
+
const staleMs = 15_000;
|
|
10
|
+
const retryWithinMs = 1000;
|
|
5
11
|
export function program(options) {
|
|
6
12
|
const { command, environment, singleInstance = false } = options;
|
|
7
13
|
return ({ mod, announce, reserveName }) => {
|
|
8
|
-
const { claude, report, spawnCmod } = engineOf(mod);
|
|
14
|
+
const { claude, report, spawnCmod, watches } = engineOf(mod);
|
|
9
15
|
const [executable] = command;
|
|
10
16
|
if (executable === undefined)
|
|
11
17
|
throw new Error(`${mod.name}: the program has no command. Name the program on PATH and its arguments, such as ['preview-server', '--port', '0'].`);
|
|
@@ -17,7 +23,13 @@ export function program(options) {
|
|
|
17
23
|
let failure;
|
|
18
24
|
let exits = 0;
|
|
19
25
|
const waiting = [];
|
|
20
|
-
|
|
26
|
+
let isFollowing = false;
|
|
27
|
+
let isWatching = false;
|
|
28
|
+
let instance;
|
|
29
|
+
let leaseCheck;
|
|
30
|
+
const spawn = () => (singleInstance ? spawnCmod(['program', mod.name, '--no-wait', '--', ...command], environment) : claude.process.spawn(request));
|
|
31
|
+
const instanceFile = () => (instance ??= Promise.all([claude.env.home(), claude.env.dataHome()]).then(([home, dataHome]) => instancePath(storeFolder({ HOME: home, XDG_DATA_HOME: dataHome }), mod.name, basename(executable))));
|
|
32
|
+
const following = (run) => void run.catch((error) => report({ id: `program:${executable}:follow`, message: `Could not follow the ${executable} program`, error }));
|
|
21
33
|
const stop = (reason) => {
|
|
22
34
|
address = undefined;
|
|
23
35
|
state = 'fatal';
|
|
@@ -38,27 +50,66 @@ export function program(options) {
|
|
|
38
50
|
for (const waiter of waiting.splice(0))
|
|
39
51
|
waiter.resolve(next);
|
|
40
52
|
};
|
|
53
|
+
const checkLease = (file) => (leaseCheck ??= (async () => {
|
|
54
|
+
if (!isFollowing || (await isHeld(claude, `${file}.lock`, staleMs)))
|
|
55
|
+
return;
|
|
56
|
+
isFollowing = false;
|
|
57
|
+
void start();
|
|
58
|
+
})().finally(() => {
|
|
59
|
+
leaseCheck = undefined;
|
|
60
|
+
}));
|
|
61
|
+
const track = async (file) => {
|
|
62
|
+
if (!isFollowing)
|
|
63
|
+
return;
|
|
64
|
+
const recorded = await claude.fs.read(file).catch(ifMissing(undefined));
|
|
65
|
+
const next = recorded === undefined ? undefined : addressOf(String(JSON.parse(recorded).address).trim());
|
|
66
|
+
if (next !== undefined)
|
|
67
|
+
return show(next);
|
|
68
|
+
address = undefined;
|
|
69
|
+
state = 'starting';
|
|
70
|
+
claude.clock.after(Math.random() * retryWithinMs, () => following(checkLease(file)));
|
|
71
|
+
};
|
|
72
|
+
const follow = async (file) => {
|
|
73
|
+
isFollowing = true;
|
|
74
|
+
if (!isWatching) {
|
|
75
|
+
isWatching = true;
|
|
76
|
+
watches.add([file], () => following(track(file)));
|
|
77
|
+
claude.clock.every(leaseCheckMs, () => following(checkLease(file)));
|
|
78
|
+
}
|
|
79
|
+
await track(file);
|
|
80
|
+
};
|
|
41
81
|
const start = async () => {
|
|
82
|
+
isFollowing = false;
|
|
83
|
+
address = undefined;
|
|
42
84
|
state = 'starting';
|
|
43
85
|
let pending = '';
|
|
44
86
|
let lastError = '';
|
|
87
|
+
let isShown = false;
|
|
45
88
|
try {
|
|
89
|
+
if (singleInstance) {
|
|
90
|
+
const file = await instanceFile();
|
|
91
|
+
if (await isHeld(claude, `${file}.lock`, staleMs))
|
|
92
|
+
return await follow(file);
|
|
93
|
+
}
|
|
46
94
|
for await (const piece of await spawn()) {
|
|
47
95
|
if (piece.stream === 'stderr') {
|
|
48
96
|
lastError = piece.text.trim().split('\n').at(-1) ?? lastError;
|
|
49
97
|
continue;
|
|
50
98
|
}
|
|
51
|
-
if (
|
|
99
|
+
if (isShown)
|
|
52
100
|
continue;
|
|
53
101
|
const lines = `${pending}${piece.text}`.split('\n');
|
|
54
102
|
pending = lines.pop() ?? '';
|
|
55
|
-
for (const line of
|
|
103
|
+
for (const line of lines.slice(0, 1)) {
|
|
104
|
+
if (singleInstance && line.trim() === 'held')
|
|
105
|
+
return await follow(await instanceFile());
|
|
56
106
|
const next = addressOf(line.trim());
|
|
57
107
|
if (next === undefined) {
|
|
58
108
|
stop(`its first line is "${line.trim()}". Write 127.0.0.1:<port> or unix:<socket path> as the first line on standard output.`);
|
|
59
109
|
return;
|
|
60
110
|
}
|
|
61
111
|
show(next);
|
|
112
|
+
isShown = true;
|
|
62
113
|
}
|
|
63
114
|
}
|
|
64
115
|
}
|
package/mod.d.ts
CHANGED
|
@@ -144,6 +144,9 @@ export type Imports = {
|
|
|
144
144
|
readonly clipboard: {
|
|
145
145
|
write(text: string): Promise<void>;
|
|
146
146
|
};
|
|
147
|
+
readonly mods: {
|
|
148
|
+
isLoaded(name: string): Promise<boolean>;
|
|
149
|
+
};
|
|
147
150
|
};
|
|
148
151
|
export declare const sessions: Imports['sessions'];
|
|
149
152
|
export declare const settings: Imports['settings'];
|
|
@@ -156,6 +159,7 @@ export declare const process: Imports['process'];
|
|
|
156
159
|
export declare const http: Imports['http'];
|
|
157
160
|
export declare const device: Imports['device'];
|
|
158
161
|
export declare const clipboard: Imports['clipboard'];
|
|
162
|
+
export declare const mods: Imports['mods'];
|
|
159
163
|
export type Mod<State extends object = Record<never, never>, Declared extends Options = Options, Keys extends Hotkeys = Hotkeys> = {
|
|
160
164
|
readonly name: string;
|
|
161
165
|
readonly folder: string;
|
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,gBAAgB,EAChB,SAAS,IAAI,eAAe,EAC5B,aAAa,EACb,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,QAAQ,EACT,MAAM,aAAa,CAAA;AACpB,OAAO,EAAgB,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAA;AACvF,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,EAAgB,KAAK,MAAM,EAAE,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AAEzF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,C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AY,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AAC9D,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAA;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAA;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,wCAAwC,CAAA;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,yCAAyC,CAAA;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAA;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,yCAAyC,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,oDAAoD,CAAA;AACpF,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,iDAAiD,CAAA;AACnG,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,0CAA0C,CAAA;AAC/H,YAAY,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA"}
|
package/mod.js
CHANGED
|
@@ -56,6 +56,9 @@ export const device = {
|
|
|
56
56
|
export const clipboard = {
|
|
57
57
|
write: (text) => bound().clipboard.write(text),
|
|
58
58
|
};
|
|
59
|
+
export const mods = {
|
|
60
|
+
isLoaded: (name) => bound().mods.isLoaded(name),
|
|
61
|
+
};
|
|
59
62
|
export const Mod = modSender;
|
|
60
63
|
export function defineMod(definition) {
|
|
61
64
|
if (definition.name.trim() === '')
|
package/options.d.ts
CHANGED
|
@@ -52,6 +52,11 @@ export declare const option: {
|
|
|
52
52
|
};
|
|
53
53
|
export declare function checkOptions(name: string, options: Options): Options;
|
|
54
54
|
export declare function userConfigOf(options: Options): Record<string, UserConfigField>;
|
|
55
|
+
export declare function optionsOf(userConfig: Readonly<Record<string, unknown>>): Options;
|
|
56
|
+
export declare function projectOptionsOf(name: string, declared: Options, text: string): {
|
|
57
|
+
readonly values: Record<string, unknown>;
|
|
58
|
+
readonly ignored: readonly string[];
|
|
59
|
+
};
|
|
55
60
|
export declare function isUnset(value: unknown): boolean;
|
|
56
61
|
export declare function fitsOption(declared: Option, value: unknown): string | undefined;
|
|
57
62
|
export {};
|
package/options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["src/options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["src/options.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAA;AAExG,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,MAAM,EAAE,CAAA;AAEvE,KAAK,SAAS,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAA;AAEzE,MAAM,MAAM,MAAM,CAAC,KAAK,SAAS,WAAW,GAAG,WAAW,IAAI,SAAS,GAAG;IACxE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,CAAA;IACxB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;IACr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,MAAM,EAAE,CAAA;CAAE,CAqBjK;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE/C;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAa/E"}
|
package/options.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isObject, secretFix } from './records.js';
|
|
2
|
+
import { messageOf } from './utils/text.js';
|
|
1
3
|
export const option = {
|
|
2
4
|
text: (field) => ({ ...field, type: 'text' }),
|
|
3
5
|
secret: (field) => ({ ...field, type: 'secret' }),
|
|
@@ -40,6 +42,56 @@ export function userConfigOf(options) {
|
|
|
40
42
|
},
|
|
41
43
|
]));
|
|
42
44
|
}
|
|
45
|
+
const optionTypes = { string: 'text', number: 'number', boolean: 'toggle', directory: 'folder', file: 'file' };
|
|
46
|
+
export function optionsOf(userConfig) {
|
|
47
|
+
return Object.fromEntries(Object.entries(userConfig).flatMap(([key, field]) => {
|
|
48
|
+
if (!isObject(field) || typeof field['type'] !== 'string' || !Object.hasOwn(optionTypes, field['type']))
|
|
49
|
+
return [];
|
|
50
|
+
const choices = Array.isArray(field['options']) ? field['options'].filter((choice) => typeof choice === 'string') : undefined;
|
|
51
|
+
const type = field['sensitive'] === true ? 'secret' : field['multiple'] === true ? 'list' : choices !== undefined ? 'choice' : optionTypes[field['type']];
|
|
52
|
+
return [
|
|
53
|
+
[
|
|
54
|
+
key,
|
|
55
|
+
{
|
|
56
|
+
type,
|
|
57
|
+
title: typeof field['title'] === 'string' ? field['title'] : key,
|
|
58
|
+
description: typeof field['description'] === 'string' ? field['description'] : '',
|
|
59
|
+
...(typeof field['min'] === 'number' ? { min: field['min'] } : {}),
|
|
60
|
+
...(typeof field['max'] === 'number' ? { max: field['max'] } : {}),
|
|
61
|
+
...(choices === undefined ? {} : { choices }),
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
];
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
export function projectOptionsOf(name, declared, text) {
|
|
68
|
+
let file;
|
|
69
|
+
try {
|
|
70
|
+
file = JSON.parse(text);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
return { values: {}, ignored: [`is not JSON (${messageOf(error)}). Fix the file; ${name} uses its other options until then.`] };
|
|
74
|
+
}
|
|
75
|
+
if (!isObject(file))
|
|
76
|
+
return { values: {}, ignored: ['is not a JSON object. Write one, such as { "branch": "main" }.'] };
|
|
77
|
+
const values = {};
|
|
78
|
+
const ignored = [];
|
|
79
|
+
for (const [key, value] of Object.entries(file)) {
|
|
80
|
+
const option = declared[key];
|
|
81
|
+
if (option === undefined)
|
|
82
|
+
ignored.push(`sets ${key}, which ${name} does not declare. ${Object.keys(declared).length === 0 ? 'Remove it.' : `Remove it, or use one of: ${Object.keys(declared).join(', ')}.`}`);
|
|
83
|
+
else if (option.type === 'secret')
|
|
84
|
+
ignored.push(`sets ${key}, a secret, and a project file is committed for everyone to read. Remove it. ${secretFix}`);
|
|
85
|
+
else {
|
|
86
|
+
const misfit = fitsOption(option, value);
|
|
87
|
+
if (misfit === undefined)
|
|
88
|
+
values[key] = value;
|
|
89
|
+
else
|
|
90
|
+
ignored.push(`sets ${key} to ${JSON.stringify(value)}, and ${option.title} ${misfit}.`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return { values, ignored };
|
|
94
|
+
}
|
|
43
95
|
export function isUnset(value) {
|
|
44
96
|
return value === undefined || value === '' || (Array.isArray(value) && value.length === 0);
|
|
45
97
|
}
|
package/package.json
CHANGED
package/records.d.ts
CHANGED
|
@@ -96,8 +96,8 @@ export type Preferences = {
|
|
|
96
96
|
};
|
|
97
97
|
export declare function parsePreferences(value: unknown, path: string): Preferences;
|
|
98
98
|
export declare function parseConsent(value: unknown, path: string): Record<string, string[]>;
|
|
99
|
-
export declare const coreVersion = "5.
|
|
100
|
-
export declare const oldestCmodVersion = "5.
|
|
99
|
+
export declare const coreVersion = "5.4.0";
|
|
100
|
+
export declare const oldestCmodVersion = "5.4.0";
|
|
101
101
|
export declare function hotkeyCommand(mod: string, hotkey: string): string;
|
|
102
102
|
export declare function hotkeyBindings(mod: string, hotkeys: Hotkeys | undefined): Record<string, string>;
|
|
103
103
|
export declare function boundCombos(keybindings: unknown): Map<string, string>;
|
package/records.js
CHANGED
|
@@ -266,8 +266,8 @@ function readHotkeys(hotkeys) {
|
|
|
266
266
|
throw new Error(`package.json "cmod.hotkeys" is not a map of hotkeys to their title and optional default combo. ${fix}`);
|
|
267
267
|
return { hotkeys: checkHotkeys('package.json "cmod"', hotkeys) };
|
|
268
268
|
}
|
|
269
|
-
export const coreVersion = '5.
|
|
270
|
-
export const oldestCmodVersion = '5.
|
|
269
|
+
export const coreVersion = '5.4.0';
|
|
270
|
+
export const oldestCmodVersion = '5.4.0';
|
|
271
271
|
export function hotkeyCommand(mod, hotkey) {
|
|
272
272
|
return `${mod}--${hotkey}`;
|
|
273
273
|
}
|
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,EAA4D,EAAE,EAAE,aAAa,EAAgB,MAAM,aAAa,CAAA;AAC5H,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["src/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4D,EAAE,EAAE,aAAa,EAAgB,MAAM,aAAa,CAAA;AAC5H,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAgB3C,wBAAgB,aAAa,IAAI,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAEjE;AAsHD,wBAAgB,WAAW,CAAC,KAAK,SAAS,MAAM,EAAE,QAAQ,SAAS,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAsDzK;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,EAAE,GAAG,IAAI,CAIzD"}
|
package/register.js
CHANGED
|
@@ -1,18 +1,37 @@
|
|
|
1
|
+
import { settledAfterAbort } from './runtime/deadline.js';
|
|
1
2
|
import { cmodPluginName } from './runtime/dependencies.js';
|
|
2
3
|
import { readDevice } from './runtime/device.js';
|
|
3
4
|
import { createLifecycle, readPlugin } from './runtime/lifecycle.js';
|
|
4
5
|
import { permissionRoutes } from './runtime/permission-check.js';
|
|
6
|
+
import { messageOf } from './utils/text.js';
|
|
5
7
|
let lifecycle;
|
|
6
8
|
let permissionCheck;
|
|
7
9
|
let registered;
|
|
8
10
|
export function registeredMod() {
|
|
9
11
|
return registered;
|
|
10
12
|
}
|
|
13
|
+
const lockedRetryMs = [100, 300, 600];
|
|
14
|
+
const heldLock = 'Lock file is already being held';
|
|
15
|
+
const timers = globalThis;
|
|
16
|
+
async function whenUnlocked(write) {
|
|
17
|
+
for (const waitMs of lockedRetryMs) {
|
|
18
|
+
try {
|
|
19
|
+
return await write();
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
if (!messageOf(error).includes(heldLock))
|
|
23
|
+
throw error;
|
|
24
|
+
await new Promise((resolve) => void timers.setTimeout(resolve, waitMs));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return write();
|
|
28
|
+
}
|
|
11
29
|
async function startMod($, eventInput, passOn) {
|
|
12
30
|
const claude = {
|
|
13
31
|
plugin: { name: $.plugin.name, root: $.plugin.root },
|
|
14
32
|
ui: {
|
|
15
33
|
log: (text, options) => $.ui.log(text, options),
|
|
34
|
+
warn: (_id, text) => $.ui.log(text, { to: 'debug' }),
|
|
16
35
|
notice: (toolUseId, text) => $.ui.notice(toolUseId, text),
|
|
17
36
|
toast: (text, options) => $.ui.toast(text, options),
|
|
18
37
|
invalidate: (event) => $.ui.invalidate(event),
|
|
@@ -41,8 +60,8 @@ async function startMod($, eventInput, passOn) {
|
|
|
41
60
|
config: { list: () => $.config.list() },
|
|
42
61
|
store: {
|
|
43
62
|
get: (key) => $.store.get(key),
|
|
44
|
-
set: (key, value) => $.store.set(key, value),
|
|
45
|
-
delete: (key) => $.store.delete(key),
|
|
63
|
+
set: (key, value) => whenUnlocked(() => $.store.set(key, value)),
|
|
64
|
+
delete: (key) => whenUnlocked(() => $.store.delete(key)),
|
|
46
65
|
keys: () => $.store.keys(),
|
|
47
66
|
},
|
|
48
67
|
clock: {
|
|
@@ -57,6 +76,7 @@ async function startMod($, eventInput, passOn) {
|
|
|
57
76
|
model: () => $.session.model(),
|
|
58
77
|
usage: () => $.session.usage(),
|
|
59
78
|
surfaces: () => $.session.surfaces(),
|
|
79
|
+
version: async () => (await $.session.version()).version,
|
|
60
80
|
messages: ((args) => (args === undefined ? $.session.messages() : $.session.messages(args))),
|
|
61
81
|
append: (args) => $.session.append(args),
|
|
62
82
|
send: (args) => $.session.send(args),
|
|
@@ -78,7 +98,7 @@ async function startMod($, eventInput, passOn) {
|
|
|
78
98
|
device: { read: () => readDevice(claude) },
|
|
79
99
|
cmod: { call: (input) => $.cmod.call(input) },
|
|
80
100
|
};
|
|
81
|
-
const [, answer] = await Promise.all([lifecycle.start(claude, readPlugin), passOn(eventInput)]);
|
|
101
|
+
const [, answer] = await settledAfterAbort(Promise.all([lifecycle.start(claude, readPlugin), passOn(eventInput)]), passOn.signal);
|
|
82
102
|
return answer;
|
|
83
103
|
}
|
|
84
104
|
function routeToMod(_$, eventInput, passOn) {
|
package/runtime/claude.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type Claude = {
|
|
|
7
7
|
};
|
|
8
8
|
readonly ui: {
|
|
9
9
|
log(text: string, options?: UiLogOptions): void;
|
|
10
|
+
warn(id: string, text: string): void;
|
|
10
11
|
notice(toolUseId: string, text: string | undefined): void;
|
|
11
12
|
toast(text: string, options?: ToastOptions): void;
|
|
12
13
|
invalidate(event: InvalidatableEventName): void;
|
|
@@ -57,6 +58,7 @@ export type Claude = {
|
|
|
57
58
|
model(): Promise<string>;
|
|
58
59
|
usage(): Promise<SessionUsage>;
|
|
59
60
|
surfaces(): Promise<readonly RenderSurface[]>;
|
|
61
|
+
version(): Promise<string>;
|
|
60
62
|
messages: EngineInterface['session']['messages'];
|
|
61
63
|
append: EngineInterface['session']['append'];
|
|
62
64
|
send: EngineInterface['session']['send'];
|