@cmodjs/core 5.6.0 → 5.8.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 +7 -5
- package/docs/dependencies.md +2 -2
- package/docs/install-steps.md +1 -1
- package/docs/mod.md +1 -1
- package/docs/ui.md +5 -3
- package/package.json +2 -2
- package/records.d.ts +15 -2
- package/records.d.ts.map +1 -1
- package/records.js +15 -3
- package/register.d.ts +3 -0
- package/register.d.ts.map +1 -1
- package/register.js +25 -15
- package/runtime/before.d.ts +3 -0
- package/runtime/before.d.ts.map +1 -1
- package/runtime/before.js +66 -31
- package/runtime/conversations.d.ts.map +1 -1
- package/runtime/conversations.js +29 -9
- package/runtime/lifecycle.d.ts +24 -2
- package/runtime/lifecycle.d.ts.map +1 -1
- package/runtime/lifecycle.js +36 -31
- package/runtime/pages.d.ts +2 -1
- package/runtime/pages.d.ts.map +1 -1
- package/runtime/pages.js +3 -6
- package/runtime/programs.d.ts +1 -0
- package/runtime/programs.d.ts.map +1 -1
- package/runtime/programs.js +8 -1
- package/runtime/router.d.ts +4 -2
- package/runtime/router.d.ts.map +1 -1
- package/runtime/router.js +10 -8
- package/runtime/toaster.d.ts.map +1 -1
- package/runtime/toaster.js +15 -7
- package/runtime/ui.d.ts.map +1 -1
- package/runtime/ui.js +27 -24
- package/src/records.ts +17 -3
- package/src/register.ts +29 -13
- package/src/runtime/before.ts +71 -34
- package/src/runtime/conversations.ts +26 -8
- package/src/runtime/lifecycle.ts +61 -43
- package/src/runtime/pages.ts +4 -3
- package/src/runtime/programs.ts +12 -1
- package/src/runtime/router.ts +11 -9
- package/src/runtime/toaster.ts +15 -7
- package/src/runtime/ui.ts +24 -21
- package/src/testing/fake-elements.ts +15 -3
- package/src/testing.ts +6 -3
- package/testing/fake-elements.js +15 -3
- package/testing.d.ts.map +1 -1
- package/testing.js +6 -3
- package/vendor-markdown.js +4 -8698
- package/vendor.js +7 -3384
package/docs/commands.md
CHANGED
|
@@ -34,7 +34,7 @@ It loads the checkout through a marketplace cmod keeps in the checkout's parent
|
|
|
34
34
|
3. It adds the marketplace to Claude Code with `claude plugin marketplace add <parent> --scope local`, which declares it in `<parent>/.claude/settings.local.json`, so the `settings.json` you share between computers holds no path of this one, the way `npm link` keeps a link out of the shared `package.json`. Then it installs `<mod>@<parent folder>-linked` from it, which loads the checkout's own files in every session, in any project, at the next reload.
|
|
35
35
|
4. It turns off the installed copy of the mod from any other marketplace, and records it in `links.json` in the cmod store, so `cmod unlink` turns that copy back on.
|
|
36
36
|
|
|
37
|
-
It refuses a parent folder whose `.claude-plugin/marketplace.json` cmod did not write. `cmod watch` reloads
|
|
37
|
+
It refuses a parent folder whose `.claude-plugin/marketplace.json` cmod did not write. Once a change builds, `cmod watch` reloads each session working inside the checkout, and every other session offers Reload.
|
|
38
38
|
|
|
39
39
|
- `--option key=value` sets one of the mod's options through `claude plugin configure`, once per option, under the linked id, such as `my-mod@Developer-linked`. It refuses a key the mod does not declare, and names the keys it does ([options.md](options.md)).
|
|
40
40
|
|
|
@@ -61,7 +61,7 @@ Runs every check this machine can run on the mod at `path` (default: the current
|
|
|
61
61
|
5. Checks the permission check. It adds `"approve": true` to `package.json` `"cmod"` when the mod allows or asks on Claude Code's permission check and `hooks/register.ts` calls `registerPermissionCheck`. It fails a mod whose `src/` hears the permission check while `register.ts` does not call `registerPermissionCheck`, and a mod on `@cmodjs/core` 5.0.0 or later whose `package.json` `"cmod"` still declares `"permissions"`, with the fix `Delete "permissions" from package.json "cmod", and write "approve": true there if the mod approves tool calls.`
|
|
62
62
|
6. Reads the metadata of every file in the mod, and names each file whose metadata cmod cannot read.
|
|
63
63
|
7. Writes the options `defineMod` declares into `.claude-plugin/plugin.json` `userConfig`, and its hotkeys into `package.json` `"cmod"` `hotkeys`, keeping each file's own formatting, so Claude Code shows the options in `/config` ([options.md](options.md)). It loads `hooks/register.ts` to read them, without starting the mod.
|
|
64
|
-
8. Writes the `cmod` dependency in `.claude-plugin/plugin.json` as `>=` the oldest cmod the `@cmodjs/core` the mod installed runs on, `oldestCmodVersion` in its `records.js`, such as `>=5.2.0`, so every newer cmod runs the mod. A `@cmodjs/core` that does not export `oldestCmodVersion` runs on the cmod of its own version, so the range is `>=` that version, such as `>=4.3.4`. A mod still on `@cmodjs/core` 3 keeps its own range ([dependencies.md](dependencies.md#call-the-methods-mod-dependencies)). Claude Code turns a mod off when its cmod is older than that dependency, so `cmod check` first compares it with every cmod plugin Claude Code installed on this machine. When an installed copy is older, it updates them as `cmod update cmod` does. When one is still older, as when your `@cmodjs/core` needs a cmod newer than every published one, the check fails, keeps the old dependency, and names the `@cmodjs/core` to install instead. When a cmod linked from a checkout is older, the check fails the same way and says to pull that checkout, because no update reaches it. On a machine without Claude Code or without a cmod plugin, such as CI, it writes the dependency at once.
|
|
64
|
+
8. Writes the `cmod` dependency in `.claude-plugin/plugin.json` as `>=` the oldest cmod the `@cmodjs/core` the mod installed runs on, `oldestCmodVersion` in its `records.js`, such as `>=5.2.0`, so every newer cmod runs the mod. When the mod needs a newer cmod than that, such as one whose cmod plugin carries out a call the mod makes, write that minimum yourself as `>=` its version, such as `>=5.6.0`, and `cmod check` keeps it. It raises only a minimum below that oldest cmod, and writes any other range as `>=` that oldest cmod. A `@cmodjs/core` that does not export `oldestCmodVersion` runs on the cmod of its own version, so the range is `>=` that version, such as `>=4.3.4`. A mod still on `@cmodjs/core` 3 keeps its own range ([dependencies.md](dependencies.md#call-the-methods-mod-dependencies)). Claude Code turns a mod off when its cmod is older than that dependency, so `cmod check` first compares it with every cmod plugin Claude Code installed on this machine. When an installed copy is older, it updates them as `cmod update cmod` does. When one is still older, as when your `@cmodjs/core` needs a cmod newer than every published one, the check fails, keeps the old dependency, and names the `@cmodjs/core` to install instead. When a cmod linked from a checkout is older, the check fails the same way and says to pull that checkout, because no update reaches it. On a machine without Claude Code or without a cmod plugin, such as CI, it writes the dependency at once.
|
|
65
65
|
9. Checks its imports.
|
|
66
66
|
10. Looks for prebuilt binaries outside `cli/`.
|
|
67
67
|
11. Builds the release in a temporary folder as `cmod publish` builds it, with its `"files"` list and its bundled hooks module, and validates the release with Claude Code, `claude plugin validate --strict`. So it fails on a path `plugin.json` names that `"files"` leaves out, a `"files"` path that matches no file in the mod, and each reason a bundle fails, and prints every line the validator writes. Then it deletes the folder.
|
|
@@ -71,6 +71,8 @@ Runs every check this machine can run on the mod at `path` (default: the current
|
|
|
71
71
|
15. Runs, with `claude plugin test`, the test files that import `claude-code/testing`. It skips this when none does.
|
|
72
72
|
16. Checks its name against other plugins. Only a project plugin, in `.claude/skills/<name>/` of a repository, runs this check: it fails when an installed or linked plugin has the same name and hides the project plugin. Any other mod passes it at once.
|
|
73
73
|
|
|
74
|
+
The checks that read the mod's files, the metadata, imports, binaries, permission check, and test files, skip every file git ignores, such as scratch work in an ignored folder, because no release holds it.
|
|
75
|
+
|
|
74
76
|
`cmod check` fetches `tsc` 7.0.2 and `oxlint` 1.86.0 into the cmod store the first time. A check it cannot run, such as one that needs Claude Code on a machine without it, fails with the reason, and the later checks still run. It ends with a count of passed, failed, and skipped checks, and exits 1 when one failed.
|
|
75
77
|
|
|
76
78
|
### cmod try
|
|
@@ -141,7 +143,7 @@ It needs, and refuses to start without:
|
|
|
141
143
|
|
|
142
144
|
## Install mods
|
|
143
145
|
|
|
144
|
-
`cmod install`, `cmod update`, `cmod remove`, `cmod enable`, `cmod disable`, `cmod link`, `cmod unlink`, and `cmod try` write the time to `plugins-changed` in the cmod store, then write `store-changed` beside it, when they finish, also when they fail partway, such as an update that updated some mods. The cmod plugin of every running session watches `store-changed` and Claude Code's `installed_plugins.json`, reads the `enabledPlugins` of the user's `settings.json` each time Claude Code reports that file changed and at each prompt,
|
|
146
|
+
`cmod install`, `cmod update`, `cmod remove`, `cmod enable`, `cmod disable`, `cmod link`, `cmod unlink`, and `cmod try` write the time to `plugins-changed` in the cmod store, then write `store-changed` beside it, when they finish, also when they fail partway, such as an update that updated some mods. The cmod plugin of every running session watches `store-changed` and Claude Code's `installed_plugins.json`, and reads the `enabledPlugins` of the user's `settings.json` each time Claude Code reports that file changed and at each prompt, whether a `cmod` command, `/plugin`, `claude plugin`, or Claude Code's automatic update changed them. While `plugins-changed`, `installed_plugins.json`, or `enabledPlugins` differs from what the session loaded, the session keeps running the plugins it loaded and shows one `Plugins changed` toast with a Reload button. It names each change, such as `notes updated to 1.3.0` or `inbox turned on`, or counts them past 3, and each further change updates the same toast. The person presses Reload, which runs `/reload-plugins`, or when the turn ends if Claude is working, and the prompt the person is typing stays. A change back to what the session loaded, or the person's own `/reload-plugins`, takes the toast away. A session no app shows, such as `claude -p`, shows nothing. A reload keeps the prompt cache: the next request reads the whole conversation from the cache and pays only for the plugins' new content. A reload clears each mod's `memory` state. A machine where cmod set up no mod has no store, and these commands write nothing there.
|
|
145
147
|
|
|
146
148
|
### cmod install
|
|
147
149
|
|
|
@@ -224,7 +226,7 @@ Reads every conversation Claude Code saved, as the sessions, contexts, turns, ta
|
|
|
224
226
|
- `goal` prints what the conversation is for: the goal a mod set, or its first prompt.
|
|
225
227
|
- `usage` prints the model and the context's tokens as of the last reply.
|
|
226
228
|
- `--task` reads `turns`, `contexts`, `goal`, and `usage` of the session a task's owner runs, the way they read the conversation's.
|
|
227
|
-
- `state` prints what a running conversation resumes from.
|
|
229
|
+
- `state` prints what a running conversation resumes from. It reads the index without writing to it, so it never waits for another cmod that is writing the index.
|
|
228
230
|
- `follow` prints each message, turn, context, task, and goal change of the sessions named as Claude Code saves it, until stopped with Ctrl+C. `--running` follows every running session of the project too, and each one that starts later. The cmod plugin runs it to hear other running sessions.
|
|
229
231
|
- `--json` prints JSON instead of one line each.
|
|
230
232
|
- `index` reads every saved conversation into the index at `~/.local/share/cmod/history-12.sqlite`, which holds where each message is in its transcript, not a copy of it, and each conversation's turns, with the device each ran on, contexts, and tasks. While cmod has set up a mod other than cmod, the cmod plugin runs it in the background at each session's start, and a second run while one is running exits at once. The index forgets a conversation whose transcript is deleted.
|
|
@@ -237,7 +239,7 @@ Reads every conversation Claude Code saved, as the sessions, contexts, turns, ta
|
|
|
237
239
|
cmod watch
|
|
238
240
|
```
|
|
239
241
|
|
|
240
|
-
|
|
242
|
+
Reloads the sessions working inside a checkout `cmod link` linked once it builds after a change, and tells every other running session. It watches each linked folder, outside `node_modules` and `.git`, and skips a change to a file git ignores, such as the `.claude-plugin/types/` Claude Code writes each time it loads the mod, a change inside the program's `output` folder, and a change to a file that is gone again and git does not track, such as a build's temporary file. Once a folder has had no change for 2 seconds, it bundles the mod's hooks module as `cmod publish` does. When a changed file is one the program's build reads, a file in `cli/` or one the JavaScript or TypeScript file `cli/package.json` `bin` names imports, such as the mod's own `src/`, it also builds the program `cli/` declares and links it as `cmod link` does, so the program in cmod's programs folder is never older than the mod. A change no program build reads builds no program. A program whose build failed builds again at the next change, whatever it changed. A program that stops when its file changes then restarts on the new build, and a build that writes the same program leaves the file as it is. A mod that builds marks `plugins-changed` with the checkout's folder, so each session whose project is that folder or inside it reloads by itself once the change has been quiet for 2 seconds, after its turn ends, and every other session shows the `Plugins changed` toast. A bundle or program build that still fails 10 seconds after the last change shows `<mod> does not build` with the error as one toast in every session, the last program that built keeps running, and the toast goes once the mod builds. So an agent's half-written file reloads nothing and shows nothing. At its start it bundles again each mod whose failure it finds in `build-failures.json`, so a failure an older cmod wrote goes once the mod builds. The cmod plugin starts one only in a session that an app shows, once a mod is linked, at the session's start or later, so a machine with no linked mod runs none. The first holds `watch.lock` in the cmod store, watches, and touches its file there every 5 seconds. Another one exits at once while it runs, and the cmod plugin of each such session starts one again once that file is gone or 15 seconds old, so a machine runs one watcher however many sessions it has open. Before each touch it reads the newest cmod in the cmod store, the newest version folder of `bin/cmod` that the launcher runs. A `cmod watch` older than that exits and lets go of `watch.lock`, so after a cmod update the new cmod's watcher judges the linked mods by its own rules within 15 seconds.
|
|
241
243
|
|
|
242
244
|
A cmod before 4.1.0 linked a checkout by writing it into `CLAUDE_CODE_PLUGIN_DIRS` in the `env` block of Claude Code's `settings.json`. `cmod watch` at its start, and `cmod setup`, link each folder still in that list as `cmod link` does now and take it out of the list. A folder that fails to link stays in the list, and its error prints on stderr.
|
|
243
245
|
|
package/docs/dependencies.md
CHANGED
|
@@ -65,9 +65,9 @@ A provider that changes or removes a method breaks every mod that calls it, and
|
|
|
65
65
|
|
|
66
66
|
Claude Code checks the range against the provider's `version` when it loads your mod. Every mod's marketplace lists cmod and each provider from its git repository, so Claude Code also installs it at the highest `<name>--v<version>` tag inside the range, which `cmod publish` pushes for every release ([Claude Code's plugin dependencies](https://code.claude.com/docs/en/plugins/dependencies)).
|
|
67
67
|
|
|
68
|
-
cmod is a provider too, with one difference: every newer cmod runs every mod built on an older `@cmodjs/core`. So a mod names only the oldest cmod it runs on, which the `@cmodjs/core` it bundles names as `oldestCmodVersion` in its `records.js`, as `>=5.2.0`. `cmod check` writes
|
|
68
|
+
cmod is a provider too, with one difference: every newer cmod runs every mod built on an older `@cmodjs/core`. So a mod names only the oldest cmod it runs on, which the `@cmodjs/core` it bundles names as `oldestCmodVersion` in its `records.js`, as `>=5.2.0`. When the mod needs a newer cmod, such as one whose cmod plugin carries out a call the mod makes, write that minimum as `>=` its version, as `>=5.6.0`. `cmod check` writes the newer of the two whenever the mod's `@cmodjs/core` changes, and `cmod publish` refuses a release whose range is not `>=` a version at or above `oldestCmodVersion`. A caret range such as `^5.0.0` stops Claude Code from updating cmod past 5.x for every mod on the computer, so leave it to `cmod check`.
|
|
69
69
|
|
|
70
|
-
Each mod's marketplace lists its own copy of cmod and of each provider, and Claude Code loads only one copy of each. When a mod needs a newer cmod than a copy Claude Code installed, the cmod plugin updates every copy of cmod, and when two copies of any plugin differ, it updates every copy of that plugin. Then
|
|
70
|
+
Each mod's marketplace lists its own copy of cmod and of each provider, and Claude Code loads only one copy of each. When a mod needs a newer cmod than a copy Claude Code installed, the cmod plugin updates every copy of cmod, and when two copies of any plugin differ, it updates every copy of that plugin. Then each session offers Reload, so a mod never waits for the person to update its providers, only to press Reload.
|
|
71
71
|
|
|
72
72
|
Claude Code then lays tracer's types file beside the mod's own types, so the call is typed:
|
|
73
73
|
|
package/docs/install-steps.md
CHANGED
|
@@ -203,7 +203,7 @@ A mod that builds its own command-line program keeps its source in `cli/`, and c
|
|
|
203
203
|
|
|
204
204
|
Then:
|
|
205
205
|
|
|
206
|
-
- `cmod link` builds the program and links this machine's build into cmod's programs folder and `~/.local/bin`. When the linked checkout's version changes, the next session's setup builds it again from the checkout, so a version with no release yet still sets up.
|
|
206
|
+
- `cmod link` builds the program and links this machine's build into cmod's programs folder and `~/.local/bin`. `cmod watch` builds it again, at the same version too, after each change to a file in `cli/` or a file the `bin` entry imports, so the program never runs older code than the mod. When the linked checkout's version changes, the next session's setup builds it again from the checkout, so a version with no release yet still sets up.
|
|
207
207
|
- `cmod publish` builds every machine's file and attaches each to the GitHub release `v<version>`, with a `SHA256SUMS` file. It refuses a `cli/` program that the `package.json` `program` key does not name.
|
|
208
208
|
- On install, cmod downloads `<repository>/releases/download/v<version>/<program>-<machine>`, checks it against `SHA256SUMS`, runs `<program> --version`, and links it into cmod's programs folder and `~/.local/bin`.
|
|
209
209
|
- `cmod unlink` and the uninstall remove the program and both links.
|
package/docs/mod.md
CHANGED
|
@@ -47,7 +47,7 @@ export const greeter = defineMod({
|
|
|
47
47
|
|
|
48
48
|
Claude Code loads the mod at the start of each session. cmod then checks that the mod is set up, and runs its install step when it is not, with a loading toast above the prompt ([install-steps.md](install-steps.md)). An option with no default and no value is asked on the mod's install page, the `Install <name>` tab of the Sidebar. Then cmod loads the saved state, runs `setup`, marks as open each of the mod's panes that Claude Code already shows, and opens the install page again for each `installer` step the mod declares that is not done.
|
|
49
49
|
|
|
50
|
-
The first time a mod starts on a machine, cmod shows the toast `Installed` under its name. Opened, it lists the mod's `plugin.json` `description`, what setup added, such as `Adds the my-mod pane, the Branch widget and /deploy.`, and what its install step set up, with a Settings button that opens Settings at the mod. A new version shows no toast of the mod's own:
|
|
50
|
+
The first time a mod starts on a machine, cmod shows the toast `Installed` under its name. Opened, it lists the mod's `plugin.json` `description`, what setup added, such as `Adds the my-mod pane, the Branch widget and /deploy.`, and what its install step set up, with a Settings button that opens Settings at the mod. A new version shows no toast of the mod's own: each running session keeps the version it loaded, and the cmod plugin's `Plugins changed` toast names `<mod> updated to <version>` with a Reload button ([commands.md](commands.md#install-mods)). A new session and `/reload-plugins` show no toast.
|
|
51
51
|
|
|
52
52
|
When a step fails, the mod stays stopped. Once another session sets it up, the mod starts at the next prompt of every session it stopped in, with no `/reload-plugins`.
|
|
53
53
|
|
package/docs/ui.md
CHANGED
|
@@ -142,7 +142,8 @@ type Page<Params = undefined> = {
|
|
|
142
142
|
- `props.columns` is the width the page draws in. The Sidebar draws the page in a panel titled with the mod's name, under its tab bar and above its key bar, so `columns` is the Sidebar's width less 6: its padding of one column on each side, and the panel's border and padding.
|
|
143
143
|
- A page opened from what the person did, such as a slash command they typed, a hotkey, or a `Button` they pressed, shows at any terminal width. A page opened from anything else, such as `setup`, a timer, or a listener, shows only on a terminal 144 columns wide. Below that it waits until the person opens the Sidebar.
|
|
144
144
|
- A page draws only the elements of `ui/elements.js` and `ui/components.js`, text, numbers, and plain objects, because the cmod plugin draws it. A `Button`'s `onPress` runs in the mod.
|
|
145
|
-
- A `render` that throws draws
|
|
145
|
+
- A `render` that throws draws `The <title> page could not draw: <error>` in the page, and cmod shows the error toast `The <title> page could not draw` once, until the page draws again.
|
|
146
|
+
- A press on a `Button` from an older drawing, such as one drawn before the mod reloaded, runs nothing. cmod shows the toast `The <mod> button was from an older drawing, so nothing ran` and draws the page again.
|
|
146
147
|
|
|
147
148
|
A hotkey is the usual way in:
|
|
148
149
|
|
|
@@ -439,7 +440,8 @@ type ToastOptions = {
|
|
|
439
440
|
- A toast stays 4 seconds once the band draws it, or `duration` ms. `Infinity` keeps it until the person closes it, and a loading toast stays until it changes.
|
|
440
441
|
- A toast with the `id` of a shown toast replaces it in place, so a loading toast turns into its success or error.
|
|
441
442
|
- A text `description` shows its first line dim under the message. A press on the message unfolds the whole text and stops the time. An element `description`, such as a `Progress`, draws as it is.
|
|
442
|
-
-
|
|
443
|
+
- Every toast takes the band's whole width, and its `✕` sits at the right end of its last line, whatever its text. So a stack of toasts closes one after another with presses in one spot, because the band keeps its last line by the prompt and the next toast moves down into the closed one's place.
|
|
444
|
+
- `action` draws a button just before the `✕`. Give every toast that asks the person to do something an `action` that does it.
|
|
443
445
|
- `✕` closes the toast. The band shows the newest 3, and `+N more` shows every toast.
|
|
444
446
|
- `promise` shows `loading` while `task` runs, then `success` or `error` in the same row. `unwrap()` resolves or rejects as `task` does.
|
|
445
447
|
|
|
@@ -453,7 +455,7 @@ An error also shows as a toast when any of these holds:
|
|
|
453
455
|
|
|
454
456
|
A cmod older than 4.3.0 keeps no Log, so there every error shows its toast.
|
|
455
457
|
|
|
456
|
-
The error toast stays, with its buttons on a line under the message:
|
|
458
|
+
The error toast stays, with its buttons and the time on a line under the message, and `Hide` in the place of `✕`, at the right end of that line:
|
|
457
459
|
|
|
458
460
|
- `Retry` runs the failed step again, where running it again can work: an install, the mod's setup, or a program that stopped.
|
|
459
461
|
- `Report` replaces the toast's buttons with the ways to tell the mod's author. `Ask Claude to report it` sends this session a prompt to file the report with the person's own tools. `Report it on GitHub (opens your browser)` opens a filled-in issue on the mod's `supportUrl` or `repository` in its `plugin.json`, or `Email the author (opens your mail app)` writes to its `author.email`. `Copy the error` copies the mod's name and version, the `@cmodjs/core` version, the message, the whole cause, and the stack.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmodjs/core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.0",
|
|
4
4
|
"description": "Build Claude Code mods: hooks, panes, checks, and an install that just works.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"docs/"
|
|
27
27
|
],
|
|
28
28
|
"scripts": {
|
|
29
|
-
"build": "tsc -p tsconfig.build.json && bun build src/vendor.ts --outfile vendor.js --format esm --target browser --define process=undefined && NODE_ENV=production bun build src/vendor-markdown.ts --outfile vendor-markdown.js --format esm --target browser --conditions worker",
|
|
29
|
+
"build": "tsc -p tsconfig.build.json && bun build src/vendor.ts --outfile vendor.js --format esm --target browser --define process=undefined --minify && NODE_ENV=production bun build src/vendor-markdown.ts --outfile vendor-markdown.js --format esm --target browser --conditions worker --minify",
|
|
30
30
|
"check": "tsc -p tsconfig.json --noEmit && OXLINT_TSGOLINT_PATH=../lint/node_modules/.bin/tsgolint ../lint/node_modules/.bin/oxlint --type-aware --deny-warnings",
|
|
31
31
|
"test": "bun test"
|
|
32
32
|
},
|
package/records.d.ts
CHANGED
|
@@ -77,6 +77,8 @@ export declare function marketplaceOf(root: string, name: string): string | unde
|
|
|
77
77
|
export declare function updatesToTurnOn(marketplace: string | undefined, settings: unknown, known: unknown): string | undefined;
|
|
78
78
|
export declare function consentPath(store: string): string;
|
|
79
79
|
export declare function pluginsChangedPath(store: string): string;
|
|
80
|
+
export declare function pluginsChangedMark(at: number, pid: number, checkout?: string): string;
|
|
81
|
+
export declare function markedCheckout(mark: string): string | undefined;
|
|
80
82
|
export declare function storeChangedPath(store: string): string;
|
|
81
83
|
export declare function buildFailuresPath(store: string): string;
|
|
82
84
|
export declare function linksPath(store: string): string;
|
|
@@ -131,12 +133,23 @@ export declare function newestLog(entries: readonly LogEntry[]): LogEntry[];
|
|
|
131
133
|
export declare function versionsLine({ mod, core, cmod, program, claudeCode }: LogVersions): string;
|
|
132
134
|
export declare function logReport(entry: LogEntry): string;
|
|
133
135
|
export declare function parseConsent(value: unknown, path: string): Record<string, string[]>;
|
|
134
|
-
export declare const coreVersion = "5.
|
|
136
|
+
export declare const coreVersion = "5.8.0";
|
|
135
137
|
export declare const oldestCmodVersion = "5.4.0";
|
|
136
138
|
export declare function hotkeyCommand(mod: string, hotkey: string): string;
|
|
137
139
|
export declare function hotkeyBindings(mod: string, hotkeys: Hotkeys | undefined): Record<string, string>;
|
|
138
140
|
export declare function boundCombos(keybindings: unknown): Map<string, string>;
|
|
139
|
-
export declare function
|
|
141
|
+
export declare function bundleOptions(steps: Steps): {
|
|
142
|
+
format: 'esm';
|
|
143
|
+
target: 'browser';
|
|
144
|
+
external: string[];
|
|
145
|
+
define: {} | {
|
|
146
|
+
'globalThis.cmodWithoutApprove': string;
|
|
147
|
+
};
|
|
148
|
+
minify: {
|
|
149
|
+
whitespace: boolean;
|
|
150
|
+
identifiers: boolean;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
140
153
|
export declare function scriptPaths(command: string): string[];
|
|
141
154
|
export declare function scriptsSha256(steps: Steps, files: {
|
|
142
155
|
read: ReadFile;
|
package/records.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["src/records.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,OAAO,EAAE,MAAM,cAAc,CAAA;AAG1E,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACtC,WAAW,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAA;IACrC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAA;CACnC,CAAA;AAED,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAA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AAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA6BzI;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAiBtD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAiBpD;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAQnE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE"}
|
package/records.js
CHANGED
|
@@ -205,6 +205,12 @@ export function consentPath(store) {
|
|
|
205
205
|
export function pluginsChangedPath(store) {
|
|
206
206
|
return `${store}/plugins-changed`;
|
|
207
207
|
}
|
|
208
|
+
export function pluginsChangedMark(at, pid, checkout) {
|
|
209
|
+
return `${at} ${pid}\n${checkout === undefined ? '' : `${checkout}\n`}`;
|
|
210
|
+
}
|
|
211
|
+
export function markedCheckout(mark) {
|
|
212
|
+
return mark.split('\n')[1] || undefined;
|
|
213
|
+
}
|
|
208
214
|
export function storeChangedPath(store) {
|
|
209
215
|
return `${store}/store-changed`;
|
|
210
216
|
}
|
|
@@ -296,7 +302,7 @@ function readHotkeys(hotkeys) {
|
|
|
296
302
|
throw new Error(`package.json "cmod.hotkeys" is not a map of hotkeys to their title and optional default combo. ${fix}`);
|
|
297
303
|
return { hotkeys: checkHotkeys('package.json "cmod"', hotkeys) };
|
|
298
304
|
}
|
|
299
|
-
export const coreVersion = '5.
|
|
305
|
+
export const coreVersion = '5.8.0';
|
|
300
306
|
export const oldestCmodVersion = '5.4.0';
|
|
301
307
|
export function hotkeyCommand(mod, hotkey) {
|
|
302
308
|
return `${mod}--${hotkey}`;
|
|
@@ -329,8 +335,14 @@ function readCommand(steps, key) {
|
|
|
329
335
|
throw new Error(`package.json "cmod.${key}" names ${atRoot}, a script at the plugin root. Move it into a folder, such as ./setup/${key}.sh: cmod runs the steps again whenever anything in a script's folder changes.`);
|
|
330
336
|
return { [key]: command };
|
|
331
337
|
}
|
|
332
|
-
export function
|
|
333
|
-
return
|
|
338
|
+
export function bundleOptions(steps) {
|
|
339
|
+
return {
|
|
340
|
+
format: 'esm',
|
|
341
|
+
target: 'browser',
|
|
342
|
+
external: ['claude-code'],
|
|
343
|
+
define: steps.approve === true ? {} : { 'globalThis.cmodWithoutApprove': 'true' },
|
|
344
|
+
minify: { whitespace: true, identifiers: true },
|
|
345
|
+
};
|
|
334
346
|
}
|
|
335
347
|
export function scriptPaths(command) {
|
|
336
348
|
const words = command
|
package/register.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { On, PluginOptions } from 'claude-code';
|
|
2
2
|
import type { ModDefinition } from './mod.js';
|
|
3
3
|
import type { Options } from './options.js';
|
|
4
|
+
import { type ServeCmodPlugin } from './runtime/lifecycle.js';
|
|
4
5
|
export declare function registeredMod(): ModDefinition<object> | undefined;
|
|
6
|
+
export declare const serveCmodPlugin: ServeCmodPlugin;
|
|
5
7
|
export declare function registerMod<State extends object, Declared extends Options>(addHook: On, definition: ModDefinition<State, string, Declared>, options: PluginOptions): void;
|
|
8
|
+
export declare function registerCmodPlugin<State extends object, Declared extends Options>(addHook: On, definition: ModDefinition<State, string, Declared>, options: PluginOptions): void;
|
|
6
9
|
export declare function registerPermissionCheck(addHook: On): void;
|
|
7
10
|
//# sourceMappingURL=register.d.ts.map
|
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;AAM3C,OAAO,EAA+C,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAY1G,wBAAgB,aAAa,IAAI,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAEjE;AAsHD,eAAO,MAAM,eAAe,EAAE,eAK7B,CAAA;AAED,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,CAGzK;AAED,wBAAgB,kBAAkB,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,CAUhL;AAiDD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,EAAE,GAAG,IAAI,CAIzD"}
|
package/register.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { serveConversations } from './runtime/conversations.js';
|
|
1
2
|
import { settledAfterAbort } from './runtime/deadline.js';
|
|
2
|
-
import { cmodPluginName } from './runtime/dependencies.js';
|
|
3
3
|
import { readDevice } from './runtime/device.js';
|
|
4
4
|
import { createLifecycle, readPlugin } from './runtime/lifecycle.js';
|
|
5
|
+
import { servePages } from './runtime/pages.js';
|
|
5
6
|
import { permissionRoutes } from './runtime/permission-check.js';
|
|
7
|
+
import { serveWidgets } from './runtime/widgets.js';
|
|
6
8
|
import { messageOf } from './utils/text.js';
|
|
7
9
|
let lifecycle;
|
|
8
10
|
let permissionCheck;
|
|
@@ -115,10 +117,31 @@ function routeCallToMod(_$, eventInput, passOn) {
|
|
|
115
117
|
function routeCallFailure(_$, eventInput, passOn) {
|
|
116
118
|
return lifecycle.caught('cmod.call', withCaller(eventInput, passOn), withoutCaller(passOn), passOn);
|
|
117
119
|
}
|
|
120
|
+
export const serveCmodPlugin = ({ claude, router, store, project, report, clear, tellRefusedPress, parts, markdownIn, tellStylers }) => {
|
|
121
|
+
const conversations = serveConversations({ claude, router, store, project, report, clear });
|
|
122
|
+
const widgets = serveWidgets({ claude, router, store, report, turnClosedBy: (rowId) => conversations.turnClosedBy(rowId), parts, markdownIn });
|
|
123
|
+
const pages = servePages({ claude, router, report, tellRefusedPress, widgets, parts, tellStylers });
|
|
124
|
+
return { conversations, widgets, pages };
|
|
125
|
+
};
|
|
118
126
|
export function registerMod(addHook, definition, options) {
|
|
127
|
+
registerHooks(addHook, definition, options);
|
|
128
|
+
addHook('ui.render', routeToMod).catch(routeFailure);
|
|
129
|
+
}
|
|
130
|
+
export function registerCmodPlugin(addHook, definition, options) {
|
|
131
|
+
registerHooks(addHook, definition, options, serveCmodPlugin);
|
|
132
|
+
addHook('ui.render', { component: ['AbovePrompt', 'PromptHint', 'SessionMode', 'Spinner', 'TurnDuration', 'Pane'] }, routeToMod).catch(routeFailure);
|
|
133
|
+
addHook('command.describe', { command: /--/ }, routeToMod).catch(routeFailure);
|
|
134
|
+
addHook('session.append', routeToMod).catch(routeFailure);
|
|
135
|
+
addHook('session.receive', routeToMod).catch(routeFailure);
|
|
136
|
+
addHook('agent.spawn', routeToMod).catch(routeFailure);
|
|
137
|
+
addHook('prompt.attachment', routeToMod).catch(routeFailure);
|
|
138
|
+
addHook('turn.start', routeToMod).catch(routeFailure);
|
|
139
|
+
addHook('turn.complete', routeToMod).catch(routeFailure);
|
|
140
|
+
}
|
|
141
|
+
function registerHooks(addHook, definition, options, serve) {
|
|
119
142
|
permissionCheck = undefined;
|
|
120
143
|
registered = definition;
|
|
121
|
-
lifecycle = createLifecycle(definition, () => permissionCheck, options);
|
|
144
|
+
lifecycle = createLifecycle(definition, () => permissionCheck, options, true, serve);
|
|
122
145
|
addHook('session.start', startMod);
|
|
123
146
|
addHook('classic.Setup', routeToMod).catch(routeFailure);
|
|
124
147
|
addHook('classic.SessionStart', routeToMod).catch(routeFailure);
|
|
@@ -155,24 +178,11 @@ export function registerMod(addHook, definition, options) {
|
|
|
155
178
|
addHook('command.run', routeToMod).catch(routeFailure);
|
|
156
179
|
addHook('session.measure', routeToMod).catch(routeFailure);
|
|
157
180
|
addHook('skill.prompt', routeToMod).catch(routeFailure);
|
|
158
|
-
if (definition.name === cmodPluginName)
|
|
159
|
-
addHook('ui.render', { component: ['AbovePrompt', 'PromptHint', 'SessionMode', 'Spinner', 'TurnDuration', 'Pane'] }, routeToMod).catch(routeFailure);
|
|
160
|
-
else
|
|
161
|
-
addHook('ui.render', routeToMod).catch(routeFailure);
|
|
162
181
|
addHook('ui.press', routeToMod).catch(routeFailure);
|
|
163
182
|
addHook('ui.scroll', routeToMod).catch(routeFailure);
|
|
164
183
|
addHook('ui.close', routeToMod).catch(routeFailure);
|
|
165
184
|
addHook('cmod.call', { to: definition.name }, routeCallToMod).catch(routeCallFailure);
|
|
166
185
|
addHook('session.compact', routeToMod).catch(routeFailure);
|
|
167
|
-
if (definition.name !== cmodPluginName)
|
|
168
|
-
return;
|
|
169
|
-
addHook('command.describe', { command: /--/ }, routeToMod).catch(routeFailure);
|
|
170
|
-
addHook('session.append', routeToMod).catch(routeFailure);
|
|
171
|
-
addHook('session.receive', routeToMod).catch(routeFailure);
|
|
172
|
-
addHook('agent.spawn', routeToMod).catch(routeFailure);
|
|
173
|
-
addHook('prompt.attachment', routeToMod).catch(routeFailure);
|
|
174
|
-
addHook('turn.start', routeToMod).catch(routeFailure);
|
|
175
|
-
addHook('turn.complete', routeToMod).catch(routeFailure);
|
|
176
186
|
}
|
|
177
187
|
export function registerPermissionCheck(addHook) {
|
|
178
188
|
permissionCheck = permissionRoutes;
|
package/runtime/before.d.ts
CHANGED
|
@@ -28,6 +28,9 @@ export type BeforeHooks = {
|
|
|
28
28
|
readonly place: () => Promise<Place>;
|
|
29
29
|
readonly wants: (event: BeforeEvent) => Promise<boolean>;
|
|
30
30
|
readonly fold: (cancel: AbortSignal) => Decide;
|
|
31
|
+
readonly failedBefore: (event: BeforeEvent, change: (where: Place) => SessionChange | undefined, error: Error) => {
|
|
32
|
+
readonly refuse: string;
|
|
33
|
+
} | undefined;
|
|
31
34
|
};
|
|
32
35
|
export declare function relayOf(e: Frozen<Args<'session.receive'>>): string | undefined;
|
|
33
36
|
export declare function installBefore({ claude, router, hooks }: {
|
package/runtime/before.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"before.d.ts","sourceRoot":"","sources":["../src/runtime/before.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAe,MAAM,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAc5D,OAAO,EAAgB,KAAK,WAAW,EAAE,KAAK,iBAAiB,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"before.d.ts","sourceRoot":"","sources":["../src/runtime/before.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAe,MAAM,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAc5D,OAAO,EAAgB,KAAK,WAAW,EAAE,KAAK,iBAAiB,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAiB,MAAM,4BAA4B,CAAA;AAExJ,OAAO,EAAiB,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,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ED,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,CAE/M;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAM9F;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,SAAS,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,EAAE,OAAO,GAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAuB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAiBlV"}
|
package/runtime/before.js
CHANGED
|
@@ -29,7 +29,7 @@ export function relayOf(e) {
|
|
|
29
29
|
return isFromCmod ? relayTag.exec(e.text)?.[1] : undefined;
|
|
30
30
|
}
|
|
31
31
|
export function installBefore({ claude, router, hooks }) {
|
|
32
|
-
const { place, wants, fold } = hooks;
|
|
32
|
+
const { place, wants, fold, failedBefore } = hooks;
|
|
33
33
|
const now = () => new Date().toISOString();
|
|
34
34
|
const asked = async (event, change, decide) => (await decide(event, change)) ?? {};
|
|
35
35
|
const message = (where, unplaced, task, isInTurn = true) => {
|
|
@@ -38,6 +38,23 @@ export function installBefore({ claude, router, hooks }) {
|
|
|
38
38
|
const call = unplaced.type === ToolResult ? where.openCalls?.[unplaced.callId] : undefined;
|
|
39
39
|
return { type: Message, message: { ...unplaced, ...call, session: where.session, context, ...(turn === undefined ? {} : { turn: turn.prompt.id }), ...(task === undefined ? {} : { task }) } };
|
|
40
40
|
};
|
|
41
|
+
const submitted = (e) => (where) => message(where, { id: '', at: now(), type: Prompt, text: e.text, from: senderOf(e.origin, false) }, undefined, false);
|
|
42
|
+
const received = (e) => (where) => message(where, { id: '', at: now(), type: Prompt, text: e.text, from: { type: 'session' } }, e.agentId, false);
|
|
43
|
+
const refusedOnFailure = (event, change, error, next) => (next.called ? undefined : failedBefore(event, change, error)?.refuse);
|
|
44
|
+
const toolCalled = (e, cwd) => (where) => message(where, { id: e.tool_use_id, at: now(), type: ToolCall, callId: e.tool_use_id, name: e.tool, input: toolInputOf(e), cwd, files: noFiles }, e.agentId);
|
|
45
|
+
const cwdOf = async (agentId) => (agentId === undefined ? undefined : agentFolders.get(agentId)) ?? (await claude.session.cwd());
|
|
46
|
+
const startedTask = (e, where) => ({ id: '', title: e.description, ...ownerOfSpawn(e.subagentType, where.session), model: e.model ?? e.parentModel, openedBy: e.tool_use_id, openedAt: now(), ...(e.parentAgentId === undefined ? {} : { parent: e.parentAgentId }), context: where.context });
|
|
47
|
+
const attachmentOf = (e) => {
|
|
48
|
+
if (e.type === 'nested_memory')
|
|
49
|
+
return { event: InstructionFile, found: { id: '', at: now(), type: InstructionFile, path: instructionPathOf(e.text), text: e.text, isRule: isRulePath(instructionPathOf(e.text)) } };
|
|
50
|
+
const attachmentType = attachmentTypeOf(e.type);
|
|
51
|
+
return attachmentType === undefined ? undefined : { event: AttachedFile, found: { id: '', at: now(), type: AttachedFile, path: attachedPathOf(e.text), attachmentType, text: e.text } };
|
|
52
|
+
};
|
|
53
|
+
const contextClosed = (e) => (where) => {
|
|
54
|
+
const task = e.agentId === undefined ? undefined : where.tasks[e.agentId];
|
|
55
|
+
return e.agentId !== undefined && task === undefined ? undefined : { type: ContextEnd, context: closingContext(where, task, now()) };
|
|
56
|
+
};
|
|
57
|
+
const turnEnded = (turn) => (turn === undefined ? undefined : { type: TurnEnd, turn: { ...turn, closedAt: now() } });
|
|
41
58
|
const titles = new Map();
|
|
42
59
|
const spawned = new Map();
|
|
43
60
|
const startedBy = new Map();
|
|
@@ -49,12 +66,12 @@ export function installBefore({ claude, router, hooks }) {
|
|
|
49
66
|
return waiting.length === 1 ? waiting[0]?.[0] : undefined;
|
|
50
67
|
};
|
|
51
68
|
const agentFolders = new Map();
|
|
52
|
-
const askedAtStop = (
|
|
69
|
+
const askedAtStop = (change, signal) => new Promise((resolve, reject) => {
|
|
53
70
|
if (signal.aborted)
|
|
54
71
|
return resolve({});
|
|
55
72
|
const cancelled = () => resolve({});
|
|
56
73
|
signal.addEventListener('abort', cancelled, { once: true });
|
|
57
|
-
asked(TurnEnd,
|
|
74
|
+
asked(TurnEnd, change, fold(signal))
|
|
58
75
|
.then(resolve, reject)
|
|
59
76
|
.finally(() => signal.removeEventListener('abort', cancelled));
|
|
60
77
|
});
|
|
@@ -82,8 +99,7 @@ export function installBefore({ claude, router, hooks }) {
|
|
|
82
99
|
router.add('prompt.submit', async (e, next) => {
|
|
83
100
|
if (!(await wants(Prompt)))
|
|
84
101
|
return next(e);
|
|
85
|
-
const
|
|
86
|
-
const answer = await asked(Prompt, message(where, { id: '', at: now(), type: Prompt, text: e.text, from: senderOf(e.origin, false) }, undefined, false), fold(next.signal));
|
|
102
|
+
const answer = await asked(Prompt, submitted(e)(await place()), fold(next.signal));
|
|
87
103
|
if (answer.refuse !== undefined)
|
|
88
104
|
return { drop: answer.refuse };
|
|
89
105
|
const text = answer.text ?? e.text;
|
|
@@ -98,6 +114,9 @@ export function installBefore({ claude, router, hooks }) {
|
|
|
98
114
|
titles.set(ran.text, passed);
|
|
99
115
|
}
|
|
100
116
|
return ran;
|
|
117
|
+
}, (e, error, next) => {
|
|
118
|
+
const refusal = refusedOnFailure(Prompt, submitted(e), error, next);
|
|
119
|
+
return refusal === undefined ? undefined : { drop: refusal };
|
|
101
120
|
}),
|
|
102
121
|
router.add('classic.UserPromptSubmit', async (e, next) => {
|
|
103
122
|
const named = titles.get(e.prompt);
|
|
@@ -110,11 +129,13 @@ export function installBefore({ claude, router, hooks }) {
|
|
|
110
129
|
router.add('session.receive', async (e, next) => {
|
|
111
130
|
if (!(await wants(Prompt)) || relayOf(e) !== undefined)
|
|
112
131
|
return next(e);
|
|
113
|
-
const
|
|
114
|
-
const answer = await asked(Prompt, message(where, { id: '', at: now(), type: Prompt, text: e.text, from: { type: 'session' } }, e.agentId, false), fold(next.signal));
|
|
132
|
+
const answer = await asked(Prompt, received(e)(await place()), fold(next.signal));
|
|
115
133
|
if (answer.refuse !== undefined)
|
|
116
134
|
return { consumed: answer.refuse };
|
|
117
135
|
return next(answer.text === undefined ? e : { ...e, text: answer.text });
|
|
136
|
+
}, (e, error, next) => {
|
|
137
|
+
const refusal = relayOf(e) === undefined ? refusedOnFailure(Prompt, received(e), error, next) : undefined;
|
|
138
|
+
return refusal === undefined ? undefined : { consumed: refusal };
|
|
118
139
|
}),
|
|
119
140
|
router.add('skill.prompt', async (e, next) => {
|
|
120
141
|
if (!(await wants(Skill)))
|
|
@@ -124,18 +145,17 @@ export function installBefore({ claude, router, hooks }) {
|
|
|
124
145
|
return answer.text === undefined ? next(e) : { text: answer.text };
|
|
125
146
|
}),
|
|
126
147
|
router.add('prompt.attachment', async (e, next) => {
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
if (event === undefined || !(await wants(event)))
|
|
148
|
+
const attachment = attachmentOf(e);
|
|
149
|
+
if (attachment === undefined || !(await wants(attachment.event)))
|
|
130
150
|
return next(e);
|
|
131
|
-
const
|
|
132
|
-
const found = attachmentType === undefined
|
|
133
|
-
? { id: '', at: now(), type: InstructionFile, path: instructionPathOf(e.text), text: e.text, isRule: isRulePath(instructionPathOf(e.text)) }
|
|
134
|
-
: { id: '', at: now(), type: AttachedFile, path: attachedPathOf(e.text), attachmentType, text: e.text };
|
|
135
|
-
const answer = await asked(event, message(where, found, e.agentId), fold(next.signal));
|
|
151
|
+
const answer = await asked(attachment.event, message(await place(), attachment.found, e.agentId), fold(next.signal));
|
|
136
152
|
if (answer.refuse !== undefined)
|
|
137
153
|
return { text: null };
|
|
138
154
|
return answer.text === undefined ? next(e) : { text: answer.text };
|
|
155
|
+
}, (e, error, next) => {
|
|
156
|
+
const attachment = attachmentOf(e);
|
|
157
|
+
const refusal = attachment === undefined ? undefined : refusedOnFailure(attachment.event, (where) => message(where, attachment.found, e.agentId), error, next);
|
|
158
|
+
return refusal === undefined ? undefined : { text: null };
|
|
139
159
|
}),
|
|
140
160
|
router.add('session.append', async (e, next) => {
|
|
141
161
|
const wanted = new Set((await Promise.all(appended.map(async (event) => ((await wants(event)) ? [event] : [])))).flat());
|
|
@@ -161,17 +181,19 @@ export function installBefore({ claude, router, hooks }) {
|
|
|
161
181
|
if (!(await wants(ToolCall)))
|
|
162
182
|
return next(e);
|
|
163
183
|
const where = await place();
|
|
164
|
-
const
|
|
165
|
-
const cwd = (e.agentId === undefined ? undefined : agentFolders.get(e.agentId)) ?? (await claude.session.cwd());
|
|
166
|
-
const answer = await asked(ToolCall, message(where, { id: e.tool_use_id, at: now(), type: ToolCall, callId: e.tool_use_id, name: e.tool, input, cwd, files: noFiles }, e.agentId), fold(next.signal));
|
|
184
|
+
const answer = await asked(ToolCall, toolCalled(e, await cwdOf(e.agentId))(where), fold(next.signal));
|
|
167
185
|
if (answer.refuse !== undefined)
|
|
168
186
|
return { deny: answer.refuse };
|
|
169
187
|
if (answer.result !== undefined)
|
|
170
188
|
return withContext({ result: answer.result }, answer.note);
|
|
171
189
|
if (answer.input === undefined)
|
|
172
190
|
return withContext(await next(e), answer.note);
|
|
191
|
+
const input = toolInputOf(e);
|
|
173
192
|
const reserved = Object.fromEntries(Object.entries(e).filter(([key]) => !(key in input)));
|
|
174
193
|
return withContext(await next({ ...reserved, ...answer.input }), answer.note);
|
|
194
|
+
}, async (e, error, next) => {
|
|
195
|
+
const refusal = refusedOnFailure(ToolCall, toolCalled(e, await cwdOf(e.agentId)), error, next);
|
|
196
|
+
return refusal === undefined ? undefined : { deny: refusal };
|
|
175
197
|
}),
|
|
176
198
|
router.add('agent.spawn', async (e, next) => {
|
|
177
199
|
spawned.set(e.tool_use_id, { prompt: e.prompt, agentType: e.subagentType });
|
|
@@ -188,9 +210,8 @@ export function installBefore({ claude, router, hooks }) {
|
|
|
188
210
|
};
|
|
189
211
|
if (!(await wants(TaskStart)))
|
|
190
212
|
return start(e);
|
|
191
|
-
const
|
|
192
|
-
const
|
|
193
|
-
const answer = await asked(TaskStart, { type: TaskStart, task: { ...task, context: where.context } }, fold(next.signal));
|
|
213
|
+
const task = startedTask(e, await place());
|
|
214
|
+
const answer = await asked(TaskStart, { type: TaskStart, task }, fold(next.signal));
|
|
194
215
|
if (answer.refuse !== undefined) {
|
|
195
216
|
spawned.delete(e.tool_use_id);
|
|
196
217
|
return { deny: answer.refuse };
|
|
@@ -211,6 +232,12 @@ export function installBefore({ claude, router, hooks }) {
|
|
|
211
232
|
};
|
|
212
233
|
spawned.set(e.tool_use_id, { prompt: answered.prompt, agentType: answered.subagentType });
|
|
213
234
|
return start(answered);
|
|
235
|
+
}, (e, error, next) => {
|
|
236
|
+
const refusal = refusedOnFailure(TaskStart, (where) => ({ type: TaskStart, task: startedTask(e, where) }), error, next);
|
|
237
|
+
if (refusal === undefined)
|
|
238
|
+
return undefined;
|
|
239
|
+
spawned.delete(e.tool_use_id);
|
|
240
|
+
return { deny: refusal };
|
|
214
241
|
}),
|
|
215
242
|
router.add('classic.SubagentStart', async (e, next) => {
|
|
216
243
|
const where = await place();
|
|
@@ -236,32 +263,40 @@ export function installBefore({ claude, router, hooks }) {
|
|
|
236
263
|
};
|
|
237
264
|
if (next.signal.aborted || !(await wants(TurnEnd)))
|
|
238
265
|
return stopped(await next(e));
|
|
239
|
-
const
|
|
240
|
-
if (
|
|
266
|
+
const change = turnEnded((await place()).taskTurns[e.agent_id]);
|
|
267
|
+
if (change === undefined)
|
|
241
268
|
return stopped(await next(e));
|
|
242
|
-
const answer = await askedAtStop(
|
|
269
|
+
const answer = await askedAtStop(change, next.signal);
|
|
243
270
|
return stopped(answeredStop(await next(e), answer, next.signal));
|
|
271
|
+
}, async (e, error, next) => {
|
|
272
|
+
const refusal = refusedOnFailure(TurnEnd, (where) => turnEnded(where.taskTurns[e.agent_id]), error, next);
|
|
273
|
+
return refusal === undefined ? undefined : { ...(await next(e)), block: refusal };
|
|
244
274
|
}),
|
|
245
275
|
router.add('classic.Stop', async (e, next) => {
|
|
246
276
|
if (next.signal.aborted || !(await wants(TurnEnd)))
|
|
247
277
|
return next(e);
|
|
248
|
-
const
|
|
249
|
-
if (
|
|
278
|
+
const change = turnEnded((await place()).turn);
|
|
279
|
+
if (change === undefined)
|
|
250
280
|
return next(e);
|
|
251
|
-
const answer = await askedAtStop(
|
|
281
|
+
const answer = await askedAtStop(change, next.signal);
|
|
252
282
|
return answeredStop(await next(e), answer, next.signal);
|
|
283
|
+
}, async (e, error, next) => {
|
|
284
|
+
const refusal = refusedOnFailure(TurnEnd, (where) => turnEnded(where.turn), error, next);
|
|
285
|
+
return refusal === undefined ? undefined : { ...(await next(e)), block: refusal };
|
|
253
286
|
}),
|
|
254
287
|
router.add('session.compact', async (e, next) => {
|
|
255
288
|
if (!(await wants(ContextEnd)) || e.trigger === 'precompute')
|
|
256
289
|
return next(e);
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
if (e.agentId !== undefined && task === undefined)
|
|
290
|
+
const change = contextClosed(e)(await place());
|
|
291
|
+
if (change === undefined)
|
|
260
292
|
return next(e);
|
|
261
|
-
const answer = await asked(ContextEnd,
|
|
293
|
+
const answer = await asked(ContextEnd, change, fold(next.signal));
|
|
262
294
|
if (answer.refuse !== undefined)
|
|
263
295
|
return { skip: answer.refuse };
|
|
264
296
|
return answer.summary === undefined ? next(e) : { messages: [{ role: 'user', text: answer.summary, toolUses: [] }] };
|
|
297
|
+
}, (e, error, next) => {
|
|
298
|
+
const refusal = e.trigger === 'precompute' ? undefined : refusedOnFailure(ContextEnd, contextClosed(e), error, next);
|
|
299
|
+
return refusal === undefined ? undefined : { skip: refusal };
|
|
265
300
|
}),
|
|
266
301
|
];
|
|
267
302
|
return { remove: () => added.forEach((each) => each.remove()) };
|