@cmodjs/core 5.4.0 → 5.4.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 +1 -1
- package/docs/mod.md +1 -1
- package/package.json +1 -1
- package/records.d.ts +1 -1
- package/records.js +1 -1
- package/register.d.ts.map +1 -1
- package/register.js +1 -0
- package/runtime/hooks.d.ts +1 -1
- package/runtime/hooks.d.ts.map +1 -1
- package/runtime/lifecycle.d.ts.map +1 -1
- package/runtime/lifecycle.js +17 -2
- package/src/records.ts +1 -1
- package/src/register.ts +1 -0
- package/src/runtime/hooks.ts +1 -0
- package/src/runtime/lifecycle.ts +19 -2
package/docs/commands.md
CHANGED
|
@@ -103,7 +103,7 @@ cmod publish [path] [--dry-run]
|
|
|
103
103
|
|
|
104
104
|
Releases the mod at `path` (default: the current folder) at the version in its `plugin.json`. It refuses a `plugin.json` whose `userConfig` differs from the options `defineMod` declares, and says to run `cmod check` and commit `.claude-plugin/plugin.json`.
|
|
105
105
|
|
|
106
|
-
1. Builds the release from the files git does not ignore, leaving out `cli/`, `.github/`, and `.claude/`. A `"files"` list in `package.json` limits the release to the paths it lists, plus the folders of the install and uninstall steps, `.claude-plugin/`, `package.json`, `tsconfig.json`, the README, the license, and `CHANGELOG.md`, the way `npm publish` reads it. `tsconfig.json` holds the JSX settings the bundle in step 2 needs. List every folder the hooks module imports from, such as `"files": ["hooks", "src", "skills"]`, because the bundle in step 2 is built from the release.
|
|
106
|
+
1. Builds the release from the files git does not ignore, leaving out `cli/`, `.github/`, and `.claude/`. A `"files"` list in `package.json` limits the release to the paths it lists, a path in those three folders included, such as `cli/bin/<launcher>`, plus the folders of the install and uninstall steps, `.claude-plugin/`, `package.json`, `tsconfig.json`, the README, the license, and `CHANGELOG.md`, the way `npm publish` reads it. `tsconfig.json` holds the JSX settings the bundle in step 2 needs. List every folder the hooks module imports from, such as `"files": ["hooks", "src", "skills"]`, because the bundle in step 2 is built from the release.
|
|
107
107
|
2. Bundles the hooks module that `hooks/hooks.json` names, with the mod's source and packages, into one readable `.js` file, writes each control character in it as a `\u` escape, and points `hooks/hooks.json` at it. Anthropic's plugin directory reads a repository without installing its packages, so it can follow a mod only when all its code is in one file. Without `"approve": true` in `package.json` `"cmod"`, the bundle leaves out the code that allows and asks on Claude Code's permission check, because Anthropic's plugin directory does not list a mod that can approve Claude's tool calls ([mod.md](mod.md#register-the-mod-with-claude-code)).
|
|
108
108
|
3. Checks the release's `.claude-plugin/plugin.json`, and its `.claude-plugin/marketplace.json` when it has one, with `claude plugin validate --strict`, and stops with every line the validator writes when it fails. `cmod check` builds and validates the release the same way, so it fails first.
|
|
109
109
|
4. Commits the release as the `release` branch, and builds the release archive from that commit.
|
package/docs/mod.md
CHANGED
|
@@ -245,7 +245,7 @@ mod.after(ms: number, listener: () => unknown): Timer
|
|
|
245
245
|
type Timer = { readonly isRunning: boolean; stop(): void }
|
|
246
246
|
```
|
|
247
247
|
|
|
248
|
-
`every` runs `listener` every `ms` milliseconds until the session ends or the mod calls `stop()`. A tick that comes while the last run is still going is skipped, so a slow run never stacks up. `after` runs `listener` once, `ms` milliseconds from now, unless the mod calls `stop()` first. `isRunning` is true until the timer stops, and an `after` timer stops once it ran. A run that throws shows the error toast `The every <ms> ms timer failed`, or `The after <ms> ms timer failed`, and the next tick of an `every` runs again. `ms` is a whole number above 0 and at most `2147483647`, and any other `ms` stops `setup` with `<mod>: mod.every is <ms>. Give a whole number of milliseconds above 0 and at most 2147483647.`
|
|
248
|
+
`every` runs `listener` every `ms` milliseconds until the session ends or the mod calls `stop()`. A tick that comes while the last run is still going is skipped, so a slow run never stacks up. A run that goes on past three ticks and a minute, such as one awaiting a request that never answers, writes one warning to the Log in Settings, `<mod>: one run of its every <ms> ms timer has gone on for <s> s, so the timer skipped every tick since.`, so give what a run awaits a deadline. `after` runs `listener` once, `ms` milliseconds from now, unless the mod calls `stop()` first. `isRunning` is true until the timer stops, and an `after` timer stops once it ran. A run that throws shows the error toast `The every <ms> ms timer failed`, or `The after <ms> ms timer failed`, and the next tick of an `every` runs again. `ms` is a whole number above 0 and at most `2147483647`, and any other `ms` stops `setup` with `<mod>: mod.every is <ms>. Give a whole number of milliseconds above 0 and at most 2147483647.`
|
|
249
249
|
|
|
250
250
|
A watch that reacts on its own is `every` plus `mod.state` plus a `prompt` with no trigger: `every` checks the outside world, writes what it found to `mod.state`, and the panes and the prompt follow the state ([jobs.md](jobs.md#prompt)).
|
|
251
251
|
|
package/package.json
CHANGED
package/records.d.ts
CHANGED
|
@@ -96,7 +96,7 @@ export type Preferences = {
|
|
|
96
96
|
};
|
|
97
97
|
export declare function parsePreferences(value: unknown, path: string): Preferences;
|
|
98
98
|
export declare function parseConsent(value: unknown, path: string): Record<string, string[]>;
|
|
99
|
-
export declare const coreVersion = "5.4.
|
|
99
|
+
export declare const coreVersion = "5.4.2";
|
|
100
100
|
export declare const oldestCmodVersion = "5.4.0";
|
|
101
101
|
export declare function hotkeyCommand(mod: string, hotkey: string): string;
|
|
102
102
|
export declare function hotkeyBindings(mod: string, hotkeys: Hotkeys | undefined): Record<string, string>;
|
package/records.js
CHANGED
|
@@ -266,7 +266,7 @@ function readHotkeys(hotkeys) {
|
|
|
266
266
|
throw new Error(`package.json "cmod.hotkeys" is not a map of hotkeys to their title and optional default combo. ${fix}`);
|
|
267
267
|
return { hotkeys: checkHotkeys('package.json "cmod"', hotkeys) };
|
|
268
268
|
}
|
|
269
|
-
export const coreVersion = '5.4.
|
|
269
|
+
export const coreVersion = '5.4.2';
|
|
270
270
|
export const oldestCmodVersion = '5.4.0';
|
|
271
271
|
export function hotkeyCommand(mod, hotkey) {
|
|
272
272
|
return `${mod}--${hotkey}`;
|
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;AAgB3C,wBAAgB,aAAa,IAAI,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAEjE;AAsHD,wBAAgB,WAAW,CAAC,KAAK,SAAS,MAAM,EAAE,QAAQ,SAAS,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["src/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4D,EAAE,EAAE,aAAa,EAAgB,MAAM,aAAa,CAAA;AAC5H,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAgB3C,wBAAgB,aAAa,IAAI,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAEjE;AAsHD,wBAAgB,WAAW,CAAC,KAAK,SAAS,MAAM,EAAE,QAAQ,SAAS,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAuDzK;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,EAAE,GAAG,IAAI,CAIzD"}
|
package/register.js
CHANGED
|
@@ -172,6 +172,7 @@ export function registerMod(addHook, definition, options) {
|
|
|
172
172
|
addHook('agent.spawn', routeToMod).catch(routeFailure);
|
|
173
173
|
addHook('prompt.attachment', routeToMod).catch(routeFailure);
|
|
174
174
|
addHook('turn.start', routeToMod).catch(routeFailure);
|
|
175
|
+
addHook('turn.complete', routeToMod).catch(routeFailure);
|
|
175
176
|
}
|
|
176
177
|
export function registerPermissionCheck(addHook) {
|
|
177
178
|
permissionCheck = permissionRoutes;
|
package/runtime/hooks.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type CallBase } from '../utils/call-effects.js';
|
|
|
6
6
|
export type Hook = Exclude<ClassicHookEvent, 'PreToolUse'>;
|
|
7
7
|
export type HookFields = Readonly<Record<string, unknown>>;
|
|
8
8
|
export type HookListener<H extends Hook> = (input: ClassicHookInputs[H], signal: AbortSignal) => HookFields | undefined | Promise<HookFields | undefined>;
|
|
9
|
-
export type RoutedEvent = `classic.${Hook}` | 'tool.check' | 'tool.call' | 'prompt.submit' | 'prompt.context' | 'prompt.attachment' | 'command.run' | 'command.describe' | 'session.measure' | 'skill.prompt' | 'ui.render' | 'ui.press' | 'ui.scroll' | 'ui.close' | 'cmod.call' | 'session.append' | 'session.compact' | 'session.receive' | 'agent.spawn' | 'turn.start';
|
|
9
|
+
export type RoutedEvent = `classic.${Hook}` | 'tool.check' | 'tool.call' | 'prompt.submit' | 'prompt.context' | 'prompt.attachment' | 'command.run' | 'command.describe' | 'session.measure' | 'skill.prompt' | 'ui.render' | 'ui.press' | 'ui.scroll' | 'ui.close' | 'cmod.call' | 'session.append' | 'session.compact' | 'session.receive' | 'agent.spawn' | 'turn.start' | 'turn.complete';
|
|
10
10
|
type CallFiles = {
|
|
11
11
|
readonly read: string[];
|
|
12
12
|
readonly changed: string[];
|
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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C,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAClD,gBAAgB,GAAE,MAAM,gBAAgB,GAAG,SAA2B,EACtE,OAAO,GAAE,aAAkB,EAC3B,UAAU,UAAO,GAChB,SAAS,CAAC,KAAK,CAAC,CAqhBlB"}
|
package/runtime/lifecycle.js
CHANGED
|
@@ -42,6 +42,8 @@ const cmodSlowCheckMs = 10_000;
|
|
|
42
42
|
const hookMs = 10_000;
|
|
43
43
|
const startHoldMs = hookMs - 1_000;
|
|
44
44
|
const dependencyCallMs = 30_000;
|
|
45
|
+
const stallTicks = 3;
|
|
46
|
+
const stallMs = 60_000;
|
|
45
47
|
const shellTools = ['Bash', 'PowerShell'];
|
|
46
48
|
export async function readPlugin(claude) {
|
|
47
49
|
const { name, root } = claude.plugin;
|
|
@@ -806,14 +808,27 @@ async function createMod(definition, runtime) {
|
|
|
806
808
|
const timer = (ms, subject, repeats, listener) => {
|
|
807
809
|
let isFiring = false;
|
|
808
810
|
let isRunning = true;
|
|
811
|
+
let firedAt = 0;
|
|
812
|
+
let isStallTold = false;
|
|
813
|
+
const tellStall = async () => {
|
|
814
|
+
const ranMs = (await claude.clock.now()) - firedAt;
|
|
815
|
+
if (isStallTold || ranMs < Math.max(checked * stallTicks, stallMs))
|
|
816
|
+
return;
|
|
817
|
+
isStallTold = true;
|
|
818
|
+
claude.ui.warn(`${subject}:${ms}:stalled`, `${definition.name}: one run of its ${subject} ${ms} ms timer has gone on for ${Math.round(ranMs / 1000)} s, so the timer skipped every tick since. Give what the listener awaits a deadline.`);
|
|
819
|
+
};
|
|
809
820
|
const fire = () => {
|
|
810
821
|
if (!repeats)
|
|
811
822
|
isRunning = false;
|
|
812
|
-
if (isFiring)
|
|
823
|
+
if (isFiring) {
|
|
824
|
+
void tellStall();
|
|
813
825
|
return;
|
|
826
|
+
}
|
|
814
827
|
isFiring = true;
|
|
828
|
+
isStallTold = false;
|
|
815
829
|
void Promise.resolve()
|
|
816
|
-
.then(() => {
|
|
830
|
+
.then(async () => {
|
|
831
|
+
firedAt = await claude.clock.now();
|
|
817
832
|
bind(imports);
|
|
818
833
|
return listener();
|
|
819
834
|
})
|
package/src/records.ts
CHANGED
|
@@ -307,7 +307,7 @@ function readHotkeys(hotkeys: unknown): Steps {
|
|
|
307
307
|
return { hotkeys: checkHotkeys('package.json "cmod"', hotkeys as Record<string, HotkeyInit>) }
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
export const coreVersion = '5.4.
|
|
310
|
+
export const coreVersion = '5.4.2'
|
|
311
311
|
|
|
312
312
|
export const oldestCmodVersion = '5.4.0'
|
|
313
313
|
|
package/src/register.ts
CHANGED
|
@@ -190,6 +190,7 @@ export function registerMod<State extends object, Declared extends Options>(addH
|
|
|
190
190
|
addHook('agent.spawn', routeToMod).catch(routeFailure)
|
|
191
191
|
addHook('prompt.attachment', routeToMod).catch(routeFailure)
|
|
192
192
|
addHook('turn.start', routeToMod).catch(routeFailure)
|
|
193
|
+
addHook('turn.complete', routeToMod).catch(routeFailure)
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
export function registerPermissionCheck(addHook: On): void {
|
package/src/runtime/hooks.ts
CHANGED
package/src/runtime/lifecycle.ts
CHANGED
|
@@ -110,6 +110,10 @@ const startHoldMs = hookMs - 1_000
|
|
|
110
110
|
|
|
111
111
|
const dependencyCallMs = 30_000
|
|
112
112
|
|
|
113
|
+
const stallTicks = 3
|
|
114
|
+
|
|
115
|
+
const stallMs = 60_000
|
|
116
|
+
|
|
113
117
|
|
|
114
118
|
const shellTools: readonly string[] = ['Bash', 'PowerShell']
|
|
115
119
|
|
|
@@ -864,12 +868,25 @@ async function createMod<State extends object, Declared extends Options>(definit
|
|
|
864
868
|
const timer = (ms: number, subject: string, repeats: boolean, listener: () => unknown): ModTimer => {
|
|
865
869
|
let isFiring = false
|
|
866
870
|
let isRunning = true
|
|
871
|
+
let firedAt = 0
|
|
872
|
+
let isStallTold = false
|
|
873
|
+
const tellStall = async () => {
|
|
874
|
+
const ranMs = (await claude.clock.now()) - firedAt
|
|
875
|
+
if (isStallTold || ranMs < Math.max(checked * stallTicks, stallMs)) return
|
|
876
|
+
isStallTold = true
|
|
877
|
+
claude.ui.warn(`${subject}:${ms}:stalled`, `${definition.name}: one run of its ${subject} ${ms} ms timer has gone on for ${Math.round(ranMs / 1000)} s, so the timer skipped every tick since. Give what the listener awaits a deadline.`)
|
|
878
|
+
}
|
|
867
879
|
const fire = () => {
|
|
868
880
|
if (!repeats) isRunning = false
|
|
869
|
-
if (isFiring)
|
|
881
|
+
if (isFiring) {
|
|
882
|
+
void tellStall()
|
|
883
|
+
return
|
|
884
|
+
}
|
|
870
885
|
isFiring = true
|
|
886
|
+
isStallTold = false
|
|
871
887
|
void Promise.resolve()
|
|
872
|
-
.then(() => {
|
|
888
|
+
.then(async () => {
|
|
889
|
+
firedAt = await claude.clock.now()
|
|
873
890
|
bind(imports)
|
|
874
891
|
return listener()
|
|
875
892
|
})
|