@cmodjs/core 5.13.0 → 5.13.2
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 +2 -2
- package/docs/dependencies.md +1 -1
- package/docs/install-steps.md +1 -1
- package/docs/mod.md +1 -1
- package/docs/ui.md +7 -6
- package/package.json +1 -1
- package/records.d.ts +1 -1
- package/records.js +1 -1
- package/runtime/hooks.d.ts.map +1 -1
- package/runtime/hooks.js +3 -2
- package/runtime/lifecycle.d.ts.map +1 -1
- package/runtime/lifecycle.js +7 -7
- package/runtime/toaster.d.ts.map +1 -1
- package/runtime/toaster.js +13 -10
- package/src/records.ts +1 -1
- package/src/runtime/hooks.ts +2 -2
- package/src/runtime/lifecycle.ts +7 -8
- package/src/runtime/toaster.ts +14 -10
- package/src/utils/call-effects.ts +3 -1
- package/utils/call-effects.d.ts +2 -0
- package/utils/call-effects.d.ts.map +1 -1
- package/utils/call-effects.js +3 -1
package/docs/commands.md
CHANGED
|
@@ -139,7 +139,7 @@ It needs, and refuses to start without:
|
|
|
139
139
|
- a `cmod` dependency in `.claude-plugin/plugin.json` of `>=` the oldest cmod the `@cmodjs/core` the mod bundles runs on, which `cmod check` writes
|
|
140
140
|
- for a real publish, a working tree with no uncommitted changes, no `v<version>` or `<name>--v<version>` tag yet, a `git push` to `origin` that succeeds, and the `gh` command, which creates the GitHub release
|
|
141
141
|
|
|
142
|
-
`--dry-run` builds everything into a temporary folder, and pushes nothing. It writes `marketplace.json` there too, so the working tree stays as it was. It allows uncommitted changes and an existing tag, and builds from the working tree, uncommitted changes included. It prints the folder that holds the release, so you can read what the directory will read.
|
|
142
|
+
`--dry-run` builds everything into a temporary folder, and pushes nothing. It writes `marketplace.json` there too, so the working tree stays as it was. It allows uncommitted changes and an existing tag, and builds from the working tree, uncommitted changes included. It prints the folder that holds the release, so you can read what the directory will read. A real publish deletes that folder once the release is out.
|
|
143
143
|
|
|
144
144
|
## Install mods
|
|
145
145
|
|
|
@@ -247,7 +247,7 @@ Opens the browser app at `http://127.0.0.1:<port>/` and prints that address. The
|
|
|
247
247
|
cmod watch
|
|
248
248
|
```
|
|
249
249
|
|
|
250
|
-
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 build that changes the program stops its running copy, so a `singleInstance` or `isService` program restarts on the new build ([cmod program](#cmod-program)), and a build that writes the same program leaves the file and the copy as they are. 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.
|
|
250
|
+
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 build that changes the program stops its running copy, so a `singleInstance` or `isService` program restarts on the new build ([cmod program](#cmod-program)), and a build that writes the same program leaves the file and the copy as they are. 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. It also exits once the process that started it ends, so a session that crashed leaves no watcher behind.
|
|
251
251
|
|
|
252
252
|
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.
|
|
253
253
|
|
package/docs/dependencies.md
CHANGED
|
@@ -133,7 +133,7 @@ tracer: <the message of the error the method threw>
|
|
|
133
133
|
|
|
134
134
|
- `tracer is not installed` covers a provider whose code did not load. The caller's error toast shows a `Plugins` button, which opens Claude Code's `/plugin`.
|
|
135
135
|
- `tracer is not set up` covers a provider the person declined to install and one whose install failed, and names why. The provider's own toast shows the same reason, with `Retry` or `Install`.
|
|
136
|
-
- `tracer is installing` covers a provider whose install step still runs
|
|
136
|
+
- `tracer is installing` covers a provider whose install step still runs 5 seconds after the call. A provider that is installing or only starting makes the call wait for it, up to 5 seconds.
|
|
137
137
|
- When tracer is disabled, Claude Code unloads the mod that lists it, with its own error: `Dependency "tracer" is disabled — enable it or remove the dependency`.
|
|
138
138
|
- A call fails with `mod.dependencies.tracer.signatures passed its 30 s deadline` when the other mod takes longer than 30 seconds. A job bounds the whole function that makes the call by its own deadline ([jobs.md](jobs.md)), so a slow call inside `slashCommand` can fail the command first, with `/outline passed the 30 s deadline of slashCommand`.
|
|
139
139
|
|
package/docs/install-steps.md
CHANGED
|
@@ -123,7 +123,7 @@ The install step runs again on every new version of the mod and whenever its scr
|
|
|
123
123
|
|
|
124
124
|
- When the first install of a mod fails or is stopped, cmod runs the uninstall step to undo it. So the uninstall step must work on a partial install.
|
|
125
125
|
- When the install step of an upgrade fails or is stopped, cmod keeps the version it set up before.
|
|
126
|
-
- The failure shows at once as an error toast with `
|
|
126
|
+
- The failure shows at once as an error toast with `Report`, `Retry`, and `✕` ([ui.md](ui.md#toasts)).
|
|
127
127
|
- When waiting can fix the failure, cmod also retries in the background after 2, 4, 8, 16, 32, 64, and 128 seconds, then every 128 seconds, and the toast says `Trying again in <n> s.` A try that works replaces the toast with `Installed`. Waiting can fix two failures: a linked checkout whose build or install step failed, and a release download that got 404 or no answer, as when a release was published seconds ago. Any other failure waits for `Retry`. A linked checkout's failed build runs again only once a file in its program's folder changes, so a retry with no change shows the same error without building.
|
|
128
128
|
- A new version of a linked checkout whose install steps did not change keeps running on its last install while cmod builds the new version in the background, and other sessions wait for that one build. A failed build shows the build's own error.
|
|
129
129
|
- Before each try, cmod reads the mod's install record, so a mod another session installed starts without running its install again.
|
package/docs/mod.md
CHANGED
|
@@ -62,7 +62,7 @@ When a step fails, the mod does not start. An error toast above the prompt names
|
|
|
62
62
|
- `its open panes did not load: <error>` when Claude Code cannot list the open panes.
|
|
63
63
|
- `the details of its session did not load: <error>` when Claude Code cannot name the session's id, model, or start time.
|
|
64
64
|
|
|
65
|
-
Each of these has `Retry`, which starts the mod again, and `Report` and
|
|
65
|
+
Each of these has `Retry`, which starts the mod again, and `Report` and `✕` ([ui.md](ui.md#toasts)). A failed step is critical, so its toast shows for an installed mod too.
|
|
66
66
|
|
|
67
67
|
## Rules
|
|
68
68
|
|
package/docs/ui.md
CHANGED
|
@@ -441,9 +441,9 @@ type ToastOptions = {
|
|
|
441
441
|
- Each type draws its icon: `✓` success, `ℹ` info, `⚠` warning, `✗` error, and a spinner for loading.
|
|
442
442
|
- 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.
|
|
443
443
|
- A toast with the `id` of a shown toast replaces it in place, so a loading toast turns into its success or error.
|
|
444
|
-
- 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.
|
|
445
|
-
- Every toast takes the band's whole width, and its `✕` sits at the right end of its
|
|
446
|
-
- `action` draws a button
|
|
444
|
+
- A toast's first line holds its icon, the mod's name in a column 16 characters wide, and the message. A longer name shows whole and moves only its own toast's text. A text `description` shows its first line dim on the line 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.
|
|
445
|
+
- Every toast takes the band's whole width, and its `✕` sits at the right end of its first line, so a stack of toasts closes with presses in one spot.
|
|
446
|
+
- `action` draws a button on the left, on its own line under the message, with the time after it. Give every toast that asks the person to do something an `action` that does it.
|
|
447
447
|
- `✕` closes the toast. The band shows the newest 3, and `+N more` shows every toast.
|
|
448
448
|
- `promise` shows `loading` while `task` runs, then `success` or `error` in the same row. `unwrap()` resolves or rejects as `task` does.
|
|
449
449
|
|
|
@@ -463,11 +463,12 @@ A cmod older than 4.3.0 keeps no Log, so there every error shows its toast.
|
|
|
463
463
|
|
|
464
464
|
So a listener or handler that fails throws its error and lets cmod report it. A failure the mod works around and goes on past, such as one rule of many that did not load, goes to [`mod.log`](mod.md#modlog) with a `level`. A `mod.toast.error` for either reaches no Log and shows in every session, so a broken config of a mod the person runs in 30 sessions shows in all 30.
|
|
465
465
|
|
|
466
|
-
The error toast stays, with its buttons and the time on a line under the message,
|
|
466
|
+
The error toast stays, with its buttons and the time on a line under the message. `Report`, which every error toast has, comes first, at the same column in every error toast, and the buttons only some errors have come after it:
|
|
467
467
|
|
|
468
|
-
-
|
|
468
|
+
- `✕` closes the toast and keeps the same failure hidden in later sessions. A new version of the mod, or a different failure, shows again.
|
|
469
469
|
- `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.
|
|
470
|
-
- `
|
|
470
|
+
- `Retry` runs the failed step again, where running it again can work: an install, the mod's setup, or a program that stopped.
|
|
471
|
+
- `Plugins` or `Open /config` opens the place that fixes a missing mod or secret.
|
|
471
472
|
|
|
472
473
|
`clipboard.write(text)`, from `mod.js`, puts `text` on the person's clipboard. It rejects with Claude Code's reason when the terminal cannot take it.
|
|
473
474
|
|
package/package.json
CHANGED
package/records.d.ts
CHANGED
|
@@ -148,7 +148,7 @@ export declare function newestLog(entries: readonly LogEntry[]): LogEntry[];
|
|
|
148
148
|
export declare function versionsLine({ mod, core, cmod, program, claudeCode }: LogVersions): string;
|
|
149
149
|
export declare function logReport(entry: LogEntry): string;
|
|
150
150
|
export declare function parseConsent(value: unknown, path: string): Record<string, string[]>;
|
|
151
|
-
export declare const coreVersion = "5.13.
|
|
151
|
+
export declare const coreVersion = "5.13.2";
|
|
152
152
|
export declare const oldestCmodVersion = "5.10.0";
|
|
153
153
|
export declare function hotkeyCommand(mod: string, hotkey: string): string;
|
|
154
154
|
export declare function hotkeyBindings(mod: string, hotkeys: Hotkeys | undefined): Record<string, string>;
|
package/records.js
CHANGED
|
@@ -342,7 +342,7 @@ function readHotkeys(hotkeys) {
|
|
|
342
342
|
throw new Error(`package.json "cmod.hotkeys" is not a map of hotkeys to their title and optional default combo. ${fix}`);
|
|
343
343
|
return { hotkeys: checkHotkeys('package.json "cmod"', hotkeys) };
|
|
344
344
|
}
|
|
345
|
-
export const coreVersion = '5.13.
|
|
345
|
+
export const coreVersion = '5.13.2';
|
|
346
346
|
export const oldestCmodVersion = '5.10.0';
|
|
347
347
|
export function hotkeyCommand(mod, hotkey) {
|
|
348
348
|
return `${mod}--${hotkey}`;
|
package/runtime/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/runtime/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAEtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/runtime/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAEtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAA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,IAAI,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC,CAM1L;AAMD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC,cAAc,CAAC,CAexE;AAED,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAA;AAExG,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAgB3I"}
|
package/runtime/hooks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { configFolders } from '../records.js';
|
|
2
|
-
import { callEffects } from '../utils/call-effects.js';
|
|
2
|
+
import { callEffects, InvalidCall } from '../utils/call-effects.js';
|
|
3
3
|
import { dynamicPattern } from '../utils/parse-shell.js';
|
|
4
4
|
import { isMissing } from '../utils/paths.js';
|
|
5
5
|
import { messageOf } from '../utils/text.js';
|
|
@@ -62,7 +62,8 @@ export async function callFiles(name, claude, folders, use, cwd) {
|
|
|
62
62
|
return { read: read.flat(), changed: known(writes) };
|
|
63
63
|
}
|
|
64
64
|
catch (error) {
|
|
65
|
-
|
|
65
|
+
if (!(error instanceof InvalidCall))
|
|
66
|
+
claude.ui.warn('call:files', `${name}: the ${use.tool} call lists no files: ${messageOf(error)}`);
|
|
66
67
|
return { read: [], changed: [] };
|
|
67
68
|
}
|
|
68
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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,MAAM,EAAE,QAAQ,CAAC,EAClD,gBAAgB,GAAE,MAAM,gBAAgB,GAAG,SAA2B,EACtE,OAAO,GAAE,aAAkB,EAC3B,UAAU,UAAO,EACjB,eAAe,CAAC,EAAE,eAAe,GAChC,SAAS,CAAC,KAAK,CAAC,CA4iBlB"}
|
package/runtime/lifecycle.js
CHANGED
|
@@ -37,7 +37,7 @@ const recordCheckMs = 1000;
|
|
|
37
37
|
const drawsPerMs = 1000;
|
|
38
38
|
const cmodWaitMs = 60_000;
|
|
39
39
|
const cmodSlowCheckMs = 10_000;
|
|
40
|
-
const startHoldMs = hookMs
|
|
40
|
+
const startHoldMs = hookMs / 2;
|
|
41
41
|
const dependencyCallMs = 30_000;
|
|
42
42
|
const stallTicks = 3;
|
|
43
43
|
const stallMs = 60_000;
|
|
@@ -558,19 +558,19 @@ export function createLifecycle(definition, permissionRoutes = () => undefined,
|
|
|
558
558
|
if (event === 'cmod.call' && !isCallToThisMod)
|
|
559
559
|
return next(e);
|
|
560
560
|
const isListen = isCallToThisMod && event === 'cmod.call' && listenMethods.includes(asked.method);
|
|
561
|
+
if (isListen && phase !== 'active') {
|
|
562
|
+
heldListens.set(`${asked.caller}\n${asked.method}\n${String(asked.input.session)}`, asked);
|
|
563
|
+
void startSettled.then(whenInstalled).then(whenActive);
|
|
564
|
+
return { value: null };
|
|
565
|
+
}
|
|
561
566
|
const waitsForInstall = isCallToThisMod && !(event === 'cmod.call' && answeredAtOnce.includes(asked.method));
|
|
562
567
|
const isLate = await (waitsForInstall ? holdUntilInstalled(signal) : event === 'classic.SessionStart' || event === 'session.append' || isCallToThisMod ? holdUntilStarted(signal) : holdUntilActive(signal));
|
|
563
568
|
if (event === 'classic.SessionStart' && phase !== 'active') {
|
|
564
569
|
missedSessionStart = e;
|
|
565
570
|
return next(e);
|
|
566
571
|
}
|
|
567
|
-
if (isCallToThisMod && phase !== 'active')
|
|
568
|
-
if (isListen) {
|
|
569
|
-
heldListens.set(`${asked.caller}\n${asked.method}\n${String(asked.input.session)}`, asked);
|
|
570
|
-
return { value: null };
|
|
571
|
-
}
|
|
572
|
+
if (isCallToThisMod && phase !== 'active')
|
|
572
573
|
return { deny: phase === 'failed' ? notSetUp() : stillInstalling(definition.name) };
|
|
573
|
-
}
|
|
574
574
|
if (isLate && phase !== 'active')
|
|
575
575
|
return (startingRouter ?? router).dispatchFailure(event, e, new Error(`it was still starting after ${startHoldMs / 1000} s`), next, false);
|
|
576
576
|
const call = e;
|
package/runtime/toaster.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toaster.d.ts","sourceRoot":"","sources":["../src/runtime/toaster.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAS,MAAM,aAAa,CAAA;AACpF,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAgB,SAAS,EAAE,MAAM,WAAW,CAAA;AAExE,OAAO,EAAgD,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAA;AAEzG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAIzC,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAE9G,MAAM,MAAM,OAAO,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC;IAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,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
const columnGap = 2;
|
|
15
|
+
const nameColumn = 16;
|
|
14
16
|
const spinner = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
15
17
|
const spinnerMs = 100;
|
|
16
18
|
const spinFrames = 10_000 / spinnerMs;
|
|
@@ -232,7 +234,7 @@ export function createToaster(claude, name, version) {
|
|
|
232
234
|
changed();
|
|
233
235
|
return;
|
|
234
236
|
}
|
|
235
|
-
const actions = [
|
|
237
|
+
const actions = [{ label: 'Report', onClick: startReporting }, ...(retry === undefined ? [] : [{ label: 'Retry', onClick: tryAgain }]), ...fixes];
|
|
236
238
|
put('error', message, { id, ...(description === undefined ? {} : { description }), duration: Infinity }, actions, hides);
|
|
237
239
|
};
|
|
238
240
|
const startReporting = async () => {
|
|
@@ -285,27 +287,28 @@ export function createToaster(claude, name, version) {
|
|
|
285
287
|
const message = isText ? Button({ plain: true, key: `toast:${entry.id}:open`, label: entry.message, onPress: toggle(entry) }) : Text({ children: entry.message });
|
|
286
288
|
const details = !isText ? description : Text({ dimColor: true, wrap: entry.isOpen ? 'wrap' : 'truncate-end', children: entry.isOpen ? description : firstLine(description) });
|
|
287
289
|
const fixed = (child) => Box({ flexShrink: 0, children: child });
|
|
288
|
-
const close = Button({ plain: true, dimColor: true, key: `toast:${entry.id}:close`, label:
|
|
290
|
+
const close = Button({ plain: true, dimColor: true, key: `toast:${entry.id}:close`, label: '✕', onPress: () => hide(entry) });
|
|
289
291
|
const actions = entry.actions.map((action, index) => Button({ plain: true, key: `toast:${entry.id}:${index === 0 ? 'action' : `action-${index}`}`, label: action.label, onPress: press(entry, action.onClick) }));
|
|
290
|
-
const
|
|
292
|
+
const time = Text({ dimColor: true, children: entry.count > 1 ? `${clockTime(entry.at)} · ${entry.count} times` : clockTime(entry.at) });
|
|
293
|
+
const buttons = actions.length === 0 ? [] : [Box({ gap: columnGap, flexWrap: 'wrap', children: [...actions, time].map(fixed) })];
|
|
291
294
|
const trying = entry.trying === undefined ? undefined : Box({ gap: 1, children: [Text({ dimColor: true, children: 'Trying again:' }), typeof entry.trying === 'string' ? Text({ dimColor: true, wrap: 'truncate-end', children: entry.trying }) : entry.trying] });
|
|
292
|
-
const text = details === undefined ? [
|
|
293
|
-
const under = trying !== undefined && details === undefined ? [trying] : entry.reporting === undefined ?
|
|
295
|
+
const text = details === undefined ? [] : [trying ?? details];
|
|
296
|
+
const under = trying !== undefined && details === undefined ? [trying] : entry.reporting === undefined ? buttons : reportChoices(entry, entry.reporting);
|
|
294
297
|
return Box({
|
|
295
298
|
width: columns,
|
|
296
|
-
gap:
|
|
299
|
+
gap: columnGap,
|
|
297
300
|
justifyContent: 'space-between',
|
|
298
301
|
children: [
|
|
299
302
|
Box({
|
|
300
|
-
gap:
|
|
303
|
+
gap: columnGap,
|
|
301
304
|
flexShrink: 1,
|
|
302
305
|
children: [
|
|
303
306
|
fixed(Text({ ...(icon.color === undefined ? {} : { color: icon.color }), children: icon.glyph })),
|
|
304
|
-
fixed(Text({ dimColor: true, children: name })),
|
|
305
|
-
Box({ flexDirection: 'column', flexShrink: 1, children:
|
|
307
|
+
fixed(Text({ dimColor: true, children: name.padEnd(nameColumn) })),
|
|
308
|
+
Box({ flexDirection: 'column', flexShrink: 1, children: [message, ...text, ...under] }),
|
|
306
309
|
],
|
|
307
310
|
}),
|
|
308
|
-
|
|
311
|
+
fixed(close),
|
|
309
312
|
],
|
|
310
313
|
});
|
|
311
314
|
};
|
package/src/records.ts
CHANGED
|
@@ -417,7 +417,7 @@ function readHotkeys(hotkeys: unknown): Steps {
|
|
|
417
417
|
return { hotkeys: checkHotkeys('package.json "cmod"', hotkeys as Record<string, HotkeyInit>) }
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
-
export const coreVersion = '5.13.
|
|
420
|
+
export const coreVersion = '5.13.2'
|
|
421
421
|
|
|
422
422
|
export const oldestCmodVersion = '5.10.0'
|
|
423
423
|
|
package/src/runtime/hooks.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { configFolders } from '../records.js'
|
|
|
3
3
|
import type { Claude } from './claude.js'
|
|
4
4
|
import type { RoutedFailure, RoutedHook } from './router.js'
|
|
5
5
|
import type { Failure } from './toaster.js'
|
|
6
|
-
import { callEffects, type CallBase, type FileAccess } from '../utils/call-effects.js'
|
|
6
|
+
import { callEffects, InvalidCall, type CallBase, type FileAccess } from '../utils/call-effects.js'
|
|
7
7
|
import { dynamicPattern } from '../utils/parse-shell.js'
|
|
8
8
|
import { isMissing } from '../utils/paths.js'
|
|
9
9
|
import { messageOf } from '../utils/text.js'
|
|
@@ -97,7 +97,7 @@ export async function callFiles(name: string, claude: Claude, folders: Promise<H
|
|
|
97
97
|
const read = await Promise.all(known(reads).map(async (path) => ((await claude.fs.stat(path).catch(unchecked(path)))?.kind === 'file' ? [path] : [])))
|
|
98
98
|
return { read: read.flat(), changed: known(writes) }
|
|
99
99
|
} catch (error) {
|
|
100
|
-
claude.ui.warn('call:files', `${name}: the ${use.tool} call lists no files: ${messageOf(error)}`)
|
|
100
|
+
if (!(error instanceof InvalidCall)) claude.ui.warn('call:files', `${name}: the ${use.tool} call lists no files: ${messageOf(error)}`)
|
|
101
101
|
return { read: [], changed: [] }
|
|
102
102
|
}
|
|
103
103
|
}
|
package/src/runtime/lifecycle.ts
CHANGED
|
@@ -123,7 +123,7 @@ const cmodWaitMs = 60_000
|
|
|
123
123
|
|
|
124
124
|
const cmodSlowCheckMs = 10_000
|
|
125
125
|
|
|
126
|
-
const startHoldMs = hookMs
|
|
126
|
+
const startHoldMs = hookMs / 2
|
|
127
127
|
|
|
128
128
|
const dependencyCallMs = 30_000
|
|
129
129
|
|
|
@@ -646,19 +646,18 @@ export function createLifecycle<State extends object, Declared extends Options =
|
|
|
646
646
|
const isCallToThisMod = (event === 'cmod.call' && (e as Frozen<Args<'cmod.call'>>).to === definition.name) || (event === 'tool.call' && typeof tool === 'string' && tool.startsWith(`mcp__${definition.name}__`))
|
|
647
647
|
if (event === 'cmod.call' && !isCallToThisMod) return next(e)
|
|
648
648
|
const isListen = isCallToThisMod && event === 'cmod.call' && listenMethods.includes(asked.method)
|
|
649
|
+
if (isListen && phase !== 'active') {
|
|
650
|
+
heldListens.set(`${asked.caller}\n${asked.method}\n${String((asked.input as { readonly session?: unknown }).session)}`, asked)
|
|
651
|
+
void startSettled.then(whenInstalled).then(whenActive)
|
|
652
|
+
return { value: null } as EventResult<N>
|
|
653
|
+
}
|
|
649
654
|
const waitsForInstall = isCallToThisMod && !(event === 'cmod.call' && answeredAtOnce.includes(asked.method))
|
|
650
655
|
const isLate = await (waitsForInstall ? holdUntilInstalled(signal) : event === 'classic.SessionStart' || event === 'session.append' || isCallToThisMod ? holdUntilStarted(signal) : holdUntilActive(signal))
|
|
651
656
|
if (event === 'classic.SessionStart' && phase !== 'active') {
|
|
652
657
|
missedSessionStart = e as Frozen<Args<'classic.SessionStart'>>
|
|
653
658
|
return next(e)
|
|
654
659
|
}
|
|
655
|
-
if (isCallToThisMod && phase !== 'active') {
|
|
656
|
-
if (isListen) {
|
|
657
|
-
heldListens.set(`${asked.caller}\n${asked.method}\n${String((asked.input as { readonly session?: unknown }).session)}`, asked)
|
|
658
|
-
return { value: null } as EventResult<N>
|
|
659
|
-
}
|
|
660
|
-
return { deny: phase === 'failed' ? notSetUp() : stillInstalling(definition.name) } as EventResult<N>
|
|
661
|
-
}
|
|
660
|
+
if (isCallToThisMod && phase !== 'active') return { deny: phase === 'failed' ? notSetUp() : stillInstalling(definition.name) } as EventResult<N>
|
|
662
661
|
if (isLate && phase !== 'active') return (startingRouter ?? router).dispatchFailure(event, e, new Error(`it was still starting after ${startHoldMs / 1000} s`), next, false)
|
|
663
662
|
const call = e as Frozen<Args<'cmod.call'>>
|
|
664
663
|
if (event === 'cmod.call' && call.to === definition.name && mod !== undefined) {
|
package/src/runtime/toaster.ts
CHANGED
|
@@ -69,6 +69,9 @@ const logAgainMs = [10_000, 60_000, 300_000]
|
|
|
69
69
|
|
|
70
70
|
const defaultDuration = 4000
|
|
71
71
|
const visibleToasts = 3
|
|
72
|
+
const columnGap = 2
|
|
73
|
+
|
|
74
|
+
const nameColumn = 16
|
|
72
75
|
const spinner = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'] as const
|
|
73
76
|
const spinnerMs = 100
|
|
74
77
|
const spinFrames = 10_000 / spinnerMs
|
|
@@ -294,7 +297,7 @@ export function createToaster(claude: Claude, name: string, version: () => strin
|
|
|
294
297
|
changed()
|
|
295
298
|
return
|
|
296
299
|
}
|
|
297
|
-
const actions = [
|
|
300
|
+
const actions = [{ label: 'Report', onClick: startReporting }, ...(retry === undefined ? [] : [{ label: 'Retry', onClick: tryAgain }]), ...fixes]
|
|
298
301
|
put('error', message, { id, ...(description === undefined ? {} : { description }), duration: Infinity }, actions, hides)
|
|
299
302
|
}
|
|
300
303
|
const startReporting = async () => {
|
|
@@ -343,27 +346,28 @@ export function createToaster(claude: Claude, name: string, version: () => strin
|
|
|
343
346
|
const message = isText ? Button({ plain: true, key: `toast:${entry.id}:open`, label: entry.message, onPress: toggle(entry) }) : Text({ children: entry.message })
|
|
344
347
|
const details = !isText ? description : Text({ dimColor: true, wrap: entry.isOpen ? 'wrap' : 'truncate-end', children: entry.isOpen ? description : firstLine(description) })
|
|
345
348
|
const fixed = (child: RenderElement) => Box({ flexShrink: 0, children: child })
|
|
346
|
-
const close = Button({ plain: true, dimColor: true, key: `toast:${entry.id}:close`, label:
|
|
349
|
+
const close = Button({ plain: true, dimColor: true, key: `toast:${entry.id}:close`, label: '✕', onPress: () => hide(entry) })
|
|
347
350
|
const actions = entry.actions.map((action, index) => Button({ plain: true, key: `toast:${entry.id}:${index === 0 ? 'action' : `action-${index}`}`, label: action.label, onPress: press(entry, action.onClick) }))
|
|
348
|
-
const
|
|
351
|
+
const time = Text({ dimColor: true, children: entry.count > 1 ? `${clockTime(entry.at)} · ${entry.count} times` : clockTime(entry.at) })
|
|
352
|
+
const buttons = actions.length === 0 ? [] : [Box({ gap: columnGap, flexWrap: 'wrap', children: [...actions, time].map(fixed) })]
|
|
349
353
|
const trying = entry.trying === undefined ? undefined : Box({ gap: 1, children: [Text({ dimColor: true, children: 'Trying again:' }), typeof entry.trying === 'string' ? Text({ dimColor: true, wrap: 'truncate-end', children: entry.trying }) : entry.trying] })
|
|
350
|
-
const text = details === undefined ? [
|
|
351
|
-
const under = trying !== undefined && details === undefined ? [trying] : entry.reporting === undefined ?
|
|
354
|
+
const text = details === undefined ? [] : [trying ?? details]
|
|
355
|
+
const under = trying !== undefined && details === undefined ? [trying] : entry.reporting === undefined ? buttons : reportChoices(entry, entry.reporting)
|
|
352
356
|
return Box({
|
|
353
357
|
width: columns,
|
|
354
|
-
gap:
|
|
358
|
+
gap: columnGap,
|
|
355
359
|
justifyContent: 'space-between',
|
|
356
360
|
children: [
|
|
357
361
|
Box({
|
|
358
|
-
gap:
|
|
362
|
+
gap: columnGap,
|
|
359
363
|
flexShrink: 1,
|
|
360
364
|
children: [
|
|
361
365
|
fixed(Text({ ...(icon.color === undefined ? {} : { color: icon.color }), children: icon.glyph })),
|
|
362
|
-
fixed(Text({ dimColor: true, children: name })),
|
|
363
|
-
Box({ flexDirection: 'column', flexShrink: 1, children:
|
|
366
|
+
fixed(Text({ dimColor: true, children: name.padEnd(nameColumn) })),
|
|
367
|
+
Box({ flexDirection: 'column', flexShrink: 1, children: [message, ...text, ...under] }),
|
|
364
368
|
],
|
|
365
369
|
}),
|
|
366
|
-
|
|
370
|
+
fixed(close),
|
|
367
371
|
],
|
|
368
372
|
})
|
|
369
373
|
}
|
|
@@ -96,9 +96,11 @@ function fieldOf(use: CallBase, name: string): unknown {
|
|
|
96
96
|
return use.input[name]
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
export class InvalidCall extends Error {}
|
|
100
|
+
|
|
99
101
|
function textField(use: CallBase, name: string): string {
|
|
100
102
|
const value = fieldOf(use, name)
|
|
101
|
-
if (typeof value !== 'string') throw new
|
|
103
|
+
if (typeof value !== 'string') throw new InvalidCall(`The ${use.tool} call has no text field ${name}.`)
|
|
102
104
|
return value
|
|
103
105
|
}
|
|
104
106
|
|
package/utils/call-effects.d.ts
CHANGED
|
@@ -46,4 +46,6 @@ export declare function callEffects(use: CallBase, workspace: {
|
|
|
46
46
|
}): CallEffects;
|
|
47
47
|
export declare function inputOf(value: unknown): Readonly<Record<string, unknown>>;
|
|
48
48
|
export declare function callBaseOf({ tool, input, agentId, agentType }: CallBase): CallBase;
|
|
49
|
+
export declare class InvalidCall extends Error {
|
|
50
|
+
}
|
|
49
51
|
//# sourceMappingURL=call-effects.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call-effects.d.ts","sourceRoot":"","sources":["../src/utils/call-effects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAyB,KAAK,UAAU,EAAE,MAAM,YAAY,CAAA;AAGnE,MAAM,MAAM,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AACvH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG;IAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC;IAAC,aAAa,EAAE,OAAO,CAAA;CAAE,CAAA;AAClG,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAC9F,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA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AS,CAAA;IACrF,KAAK,EAAE,UAAU,EAAE,CAAA;IACnB,MAAM,EAAE,UAAU,EAAE,CAAA;IACpB,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7B,CAAA;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,UAAU,CAAA;CAAE,GAAG,WAAW,CAsCrI;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAEzE;AAED,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,QAAQ,GAAG,QAAQ,CAElF;AAgCD,qBAAa,WAAY,SAAQ,KAAK;CAAG"}
|
package/utils/call-effects.js
CHANGED
|
@@ -82,10 +82,12 @@ function once(load) {
|
|
|
82
82
|
function fieldOf(use, name) {
|
|
83
83
|
return use.input[name];
|
|
84
84
|
}
|
|
85
|
+
export class InvalidCall extends Error {
|
|
86
|
+
}
|
|
85
87
|
function textField(use, name) {
|
|
86
88
|
const value = fieldOf(use, name);
|
|
87
89
|
if (typeof value !== 'string')
|
|
88
|
-
throw new
|
|
90
|
+
throw new InvalidCall(`The ${use.tool} call has no text field ${name}.`);
|
|
89
91
|
return value;
|
|
90
92
|
}
|
|
91
93
|
function optionalTextField(use, name) {
|