@cmodjs/core 5.8.0 → 5.10.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 +9 -5
- package/docs/jobs.md +2 -1
- package/docs/testing.md +1 -0
- package/jobs/program.d.ts +1 -0
- package/jobs/program.d.ts.map +1 -1
- package/jobs/program.js +12 -4
- package/package.json +1 -1
- package/records.d.ts +4 -2
- package/records.d.ts.map +1 -1
- package/records.js +8 -2
- package/runtime/lifecycle.d.ts.map +1 -1
- package/runtime/lifecycle.js +10 -2
- package/src/jobs/program.ts +10 -5
- package/src/records.ts +10 -2
- package/src/runtime/lifecycle.ts +9 -2
package/docs/commands.md
CHANGED
|
@@ -191,9 +191,9 @@ Turns the plugin on or off through Claude Code, as `/plugin` does, and every run
|
|
|
191
191
|
cmod list [--json]
|
|
192
192
|
```
|
|
193
193
|
|
|
194
|
-
Lists every plugin Claude Code has installed or linked, with its version. A mod shows whether cmod set it up, and any other plugin shows whether Claude Code enabled it. A plugin Claude Code turned off shows Claude Code's reason, such as `Requires "cmod@market" >=4.2.0, installed 4.0.0`. It also lists every mod Claude Code removed whose uninstall step has not run yet.
|
|
194
|
+
Lists every plugin Claude Code has installed or linked, with its version. A mod shows whether cmod set it up, and any other plugin shows whether Claude Code enabled it. A plugin Claude Code turned off shows Claude Code's reason, such as `Requires "cmod@market" >=4.2.0, installed 4.0.0`. It also lists every mod Claude Code removed whose uninstall step has not run yet. A mod that runs a program as a service of this computer, for a `program` job with `isService` ([jobs.md](jobs.md#program)), names it, as in `ready, runs anyhost as a service of this computer`.
|
|
195
195
|
|
|
196
|
-
- `--json` prints the list as JSON: one object per row with its `name`, `version`, `state`, and `unsatisfied`, the dependencies Claude Code turned the plugin off for because they are older than the plugin needs. A plugin whose folder exists also has `folder`, the folder it runs from: the checkout for a linked mod, and Claude Code's copy for any other. A mod also has `dataFolder`, and the two are the folders its `mod.folder` and `mod.dataFolder` name. A removed mod has only `dataFolder`, because its data stays until `cmod teardown` deletes it.
|
|
196
|
+
- `--json` prints the list as JSON: one object per row with its `name`, `version`, `state`, and `unsatisfied`, the dependencies Claude Code turned the plugin off for because they are older than the plugin needs. A plugin whose folder exists also has `folder`, the folder it runs from: the checkout for a linked mod, and Claude Code's copy for any other. A mod also has `dataFolder`, and the two are the folders its `mod.folder` and `mod.dataFolder` name. A mod that runs programs as services of this computer also has `services`, their names. A removed mod has only `dataFolder`, because its data stays until `cmod teardown` deletes it.
|
|
197
197
|
|
|
198
198
|
- The `cmod` commands count a plugin as a mod only when its `package.json` has a `cmod` step key or cmod holds an install record for it. A mod made with `cmod new` has neither until its first Claude Code session sets it up, so until then `cmod list` shows it as `enabled`, like any other plugin.
|
|
199
199
|
|
|
@@ -285,7 +285,7 @@ cmod runs these itself. A person runs them to see a step's whole log, or to fini
|
|
|
285
285
|
cmod setup <plugin-root> [--events]
|
|
286
286
|
```
|
|
287
287
|
|
|
288
|
-
Refuses a machine the `os` and `cpu` keys of the mod's `package.json` leave out. Downloads the program its `cmod.program` names, or builds it from the checkout's `cli/` when `cmod link` loaded the mod, so a linked checkout whose version has no release yet still sets up, and links it into cmod's programs folder, which Claude Code runs it from by its name, and into `~/.local/bin` unless a file there is not cmod's. Runs the mod's install step, saves its uninstall step, binds its hotkeys,
|
|
288
|
+
Refuses a machine the `os` and `cpu` keys of the mod's `package.json` leave out. Downloads the program its `cmod.program` names, or builds it from the checkout's `cli/` when `cmod link` loaded the mod, so a linked checkout whose version has no release yet still sets up, and links it into cmod's programs folder, which Claude Code runs it from by its name, and into `~/.local/bin` unless a file there is not cmod's. Runs the mod's install step, saves its uninstall step, binds its hotkeys, records the mod as set up, and restarts each service of the computer the mod runs a program as ([cmod program](#cmod-program)), so the service runs the new program, asking nothing first ([install-steps.md](install-steps.md#when-the-steps-run)). A mod installed from a marketplace whose automatic updates the person has not turned on or off gets them turned on, unless the marketplace is a folder, which Claude Code reads in place, through `"autoUpdate": true` on the marketplace's `extraKnownMarketplaces` entry in Claude Code's `settings.json`, and the setup says so. An unchanged mod runs nothing. `--events` prints one event per line for a program to read, and the mod's install toast in Claude Code reads them. Before all of that, it links each folder a cmod before 4.1.0 left in `CLAUDE_CODE_PLUGIN_DIRS`, as [`cmod watch`](#cmod-watch) does.
|
|
289
289
|
|
|
290
290
|
### cmod teardown
|
|
291
291
|
|
|
@@ -293,7 +293,7 @@ Refuses a machine the `os` and `cpu` keys of the mod's `package.json` leave out.
|
|
|
293
293
|
cmod teardown <plugin-name> [--events]
|
|
294
294
|
```
|
|
295
295
|
|
|
296
|
-
Runs a removed mod's saved uninstall step, then deletes its install record, the saved step, every version of its program, its data folder, and `instances/<plugin-name>/`, where its `singleInstance` programs keep their addresses, takes out each Claude Code setting it changed that still has the value it set, deletes its secrets ([cmod secret](#cmod-secret)), and deletes its entry in `consent.json`. It keeps the mod's config folder, `~/.claude/cmods/<plugin-name>`. A failed uninstall step keeps the record, so `cmod teardown` can run again.
|
|
296
|
+
Runs a removed mod's saved uninstall step, then deletes its install record, the saved step, every version of its program, its data folder, and `instances/<plugin-name>/`, where its `singleInstance` and `isService` programs keep their addresses, stops and deletes each service of the computer it runs a program as, with its record in `services/<plugin-name>/` ([cmod program](#cmod-program)), takes out each Claude Code setting it changed that still has the value it set, deletes its secrets ([cmod secret](#cmod-secret)), and deletes its entry in `consent.json`. It keeps the mod's config folder, `~/.claude/cmods/<plugin-name>`. A failed uninstall step keeps the record, so `cmod teardown` can run again.
|
|
297
297
|
|
|
298
298
|
### cmod hotkey
|
|
299
299
|
|
|
@@ -342,11 +342,15 @@ Starts a task in a new background Claude Code session, for a mod's `startTask` w
|
|
|
342
342
|
### cmod program
|
|
343
343
|
|
|
344
344
|
```text
|
|
345
|
-
cmod program <mod> [--no-wait] -- <command…>
|
|
345
|
+
cmod program <mod> [--no-wait | --service [--env <name>]... | --remove-service] -- <command…>
|
|
346
346
|
```
|
|
347
347
|
|
|
348
348
|
Runs one copy of a mod's program for the whole computer, for a `program` job with `singleInstance` ([jobs.md](jobs.md#program)). The first one takes `instances/<mod>/<program>.json.lock` in the cmod store, runs the command without `CLAUDE_CODE_SESSION_ID`, because the copy serves every session, writes its first line on standard output, its address, with the copy's process to `instances/<mod>/<program>.json`, and prints it. It touches its file in the lock every 5 seconds. With `--no-wait`, which a mod's session passes, another one touches the holder's file, prints `held`, and exits 0, and the session reads the address from `instances/<mod>/<program>.json` and runs `cmod program` again once that file is gone or the holder's file is 15 seconds old. Without it, as a mod built on `@cmodjs/core` before 5.3.0 runs it, another one prints the address in that file, then each new one as it changes, and tries the lock again whenever that folder changes and every 5 seconds, so it takes over once the holder exits. A lock whose process is gone counts as free. The holder stops its copy and gives up the lock on SIGTERM, SIGINT, or SIGHUP, and when the session that started it exits, which it checks every 5 seconds. When the copy exits on its own, the holder exits with the copy's exit code, and the copy's standard error passes through. A new holder that finds a copy an earlier holder left running sends it SIGTERM, then SIGKILL after 5 seconds, and starts its own copy only once that one is gone, so two copies never run at once.
|
|
349
349
|
|
|
350
|
+
With `--service`, which a session passes for a `program` job with `isService`, it makes the holder a service of the computer named `com.claudemodmanager.<mod>.<program>`: a launchd agent in `~/Library/LaunchAgents` on macOS, loaded into the person's login session, and a systemd user service in `~/.config/systemd/user` on Linux, enabled for `default.target`. Its file is mode 600, because it holds the program's environment. The service runs `cmod program <mod> -- <command…>` through the cmod store's `programs/cmod` at login and again whenever it exits, launchd at most once every 10 seconds and systemd 10 seconds after the exit, with `HOME`, `XDG_DATA_HOME`, and `CLAUDE_CONFIG_DIR` as the session has them, a `PATH` of the cmod store's `programs` folder, `/usr/local/bin`, `/opt/homebrew/bin`, `/usr/bin`, `/bin`, `/usr/sbin`, and `/sbin`, and each `--env` variable, which the job passes for each key of its `environment`, `PATH` included. The `PATH` is fixed, because sessions started from different shells hold different ones, and a service rewritten for each would restart at every session start. cmod records it in `services/<mod>/<program>.json` in the cmod store. It loads the service when it is new, changed, or not loaded, waits up to 15 seconds for a holder of `instances/<mod>/<program>.json.lock`, prints `held`, and exits 0, so the session follows the instance file as with `--no-wait`. A service that holds nothing after 15 seconds fails with the command that shows why, `launchctl print gui/<uid>/<label>` or `journalctl --user -u <label>.service`. When the computer does not take the service, such as a Linux machine without a systemd user session, it deletes what it wrote, says why on standard error, and runs as `--no-wait` does. `cmod setup` restarts each service of a mod it sets up, so the service runs the new program, and `cmod teardown` stops and deletes each one.
|
|
351
|
+
|
|
352
|
+
With `--remove-service`, it stops the program's service, deletes its file and its record in `services/<mod>/<program>.json`, and exits 0, holding the mod's lock in the cmod store so it never runs beside `cmod setup` or `cmod teardown` of the mod. A program with no service changes nothing. A session that starts a mod runs it for each record in `services/<mod>/` whose program the mod's setup no longer adds as an `isService` program, so a new version that dropped `isService` or renamed the program leaves no service of the old one. A session reads that folder without a process, so a mod with no `services/<mod>/` folder runs nothing for it.
|
|
353
|
+
|
|
350
354
|
### cmod option
|
|
351
355
|
|
|
352
356
|
```text
|
package/docs/jobs.md
CHANGED
|
@@ -318,7 +318,7 @@ export const loop = defineMod({
|
|
|
318
318
|
## program
|
|
319
319
|
|
|
320
320
|
```ts
|
|
321
|
-
program(options: { readonly command: readonly string[]; readonly environment?: Record<string, string>; readonly singleInstance?: boolean }): Job<Program>
|
|
321
|
+
program(options: { readonly command: readonly string[]; readonly environment?: Record<string, string>; readonly singleInstance?: boolean; readonly isService?: boolean }): Job<Program>
|
|
322
322
|
|
|
323
323
|
type Program = {
|
|
324
324
|
readonly state: 'stopped' | 'starting' | 'running' | 'backoff' | 'fatal'
|
|
@@ -333,6 +333,7 @@ type Program = {
|
|
|
333
333
|
- In an interactive session the program starts with the mod. Otherwise it starts at the first `ready()`.
|
|
334
334
|
- When the program exits, cmod starts it again after 1, 2, 4, 8, and 16 seconds. After 5 failed tries, or a first line that is not an address, the state is `fatal`, `ready()` rejects, and cmod logs `<mod>: the <program> program stopped: <reason>`.
|
|
335
335
|
- `singleInstance: true` runs one copy on the computer, however many sessions load the mod, such as a server that is the only writer of its data. The first session starts the copy through [`cmod program`](commands.md#cmod-program), every other session reads the copy's address from the cmod store and runs no process of its own, and every session's `ready()` resolves that copy's address. When the session running the copy ends, another open session starts a new copy within a few seconds, or within 20 seconds when the copy's session was killed with its `cmod program`, and from then on `ready()` resolves the new address in every session, so ask `ready()` before each use rather than keeping its answer. A copy a killed session left running is stopped before the new one starts. Two `singleInstance` programs with the same program name in one mod throw at `mod.use`.
|
|
336
|
+
- `isService: true` makes the program a service of the computer, so it runs whenever the person is logged in, with no Claude Code open, such as a program that records sessions Claude Code never sees. The first session that starts the mod has [`cmod program`](commands.md#cmod-program) write a launchd agent on macOS, or a systemd user service on Linux, which starts the program at login and again whenever it exits, with `environment`. The service's `PATH` is cmod's programs folder, `/usr/local/bin`, `/opt/homebrew/bin`, and the system folders, unless `environment` sets `PATH`. Every session reads the service's address from the cmod store, as a `singleInstance` program's sessions do, and `ready()` resolves it. The service runs one copy, so `isService` needs no `singleInstance` beside it. The mod writes no service file: cmod restarts the service when it sets up a new version of the mod, and stops and deletes it when the mod is removed. When a new version's setup no longer adds the `isService` program, because it dropped `isService` or renamed the program, the first session that starts that version stops and deletes the old service, so the computer stops running a program the mod no longer ships. Settings shows `Runs as a service of this computer` on the mod's page, and [`cmod list`](commands.md#cmod-list) names the program. On a computer that does not take the service, such as a Linux machine without a systemd user session, the program runs as a `singleInstance` program does. Two `isService` programs with the same program name in one mod throw at `mod.use`.
|
|
336
337
|
- A program that ships with the mod gets onto `PATH` through the `program` key of the mod's `package.json` ([install-steps.md](install-steps.md)). A program an install step fetched with `cmod download` is not on `PATH`, so `command` names it by its full path, `${mod.dataFolder}/bin/<program>`.
|
|
337
338
|
|
|
338
339
|
```ts
|
package/docs/testing.md
CHANGED
|
@@ -319,6 +319,7 @@ Set a fake to answer a call:
|
|
|
319
319
|
- A call with no fake throws `<call>(<args>) has no fake answer. Set fakes.<call> on the tested mod.` So set `fakes.process.run` before a test runs a program, and `fakes.ui.ask` before the mod asks a question.
|
|
320
320
|
- A `program` job is the exception: it catches the `process.spawn` error and retries after 1, 2, 4, 8 and 16 seconds on real timers, so its `ready()` waits past `bun test`'s 5-second timeout. Set `fakes.process.spawn` before a test starts a `program` job.
|
|
321
321
|
- A `program` job with `singleInstance` spawns `/test/home/.local/share/cmod/programs/cmod program <mod> --no-wait -- <command…>`, so `fakes.process.spawn` gets that `argv`, and the first line the fake writes to standard output is the address of the copy this session runs. A fake that writes `held` and ends tests a session another session runs the copy for: `ready()` resolves the address in `/test/home/.local/share/cmod/instances/<mod>/<program>.json`, which the test gives as `{"address":"unix:/tmp/x.sock"}` in `files`.
|
|
322
|
+
- A `program` job with `isService` spawns `/test/home/.local/share/cmod/programs/cmod program <mod> --service --env <name> -- <command…>`, with one `--env` for each key of its `environment`, every time it starts, and a fake that writes `held` and ends stands for the service: `ready()` resolves the address in the instance file, as above. A file `/test/home/.local/share/cmod/services/<mod>/<program>.json` in `files` stands for a service an earlier version of the mod wrote: when the mod's setup adds no `isService` program of that name, its start spawns `/test/home/.local/share/cmod/programs/cmod program <mod> --remove-service -- <program>`.
|
|
322
323
|
- `files` already fills the `fs` fakes: a write is read back, and `list` lists the given files. The fake file system resolves a relative path against `/`, not against the session's working folder, so a mod under test reads `${sessions.current.project}/<file>` rather than a relative path. `fs.list()` with no path rejects.
|
|
323
324
|
- `ui.open` places every pane by default. A fake that answers `{ isPlaced: false }` holds a pane back.
|
|
324
325
|
- `ui.scroll` answers `{}` by default, as when the window moved. A fake that answers `{ deny }` refuses the scroll.
|
package/jobs/program.d.ts
CHANGED
|
@@ -10,5 +10,6 @@ export declare function program(options: {
|
|
|
10
10
|
readonly command: readonly string[];
|
|
11
11
|
readonly environment?: Record<string, string>;
|
|
12
12
|
readonly singleInstance?: boolean;
|
|
13
|
+
readonly isService?: boolean;
|
|
13
14
|
}): Job<Program>;
|
|
14
15
|
//# sourceMappingURL=program.d.ts.map
|
package/jobs/program.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.d.ts","sourceRoot":"","s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AE,OAAO,CAAA;CAAE,GAAG,GAAG,CAAC,OAAO,CAAC,CA6ItM"}
|
package/jobs/program.js
CHANGED
|
@@ -9,14 +9,18 @@ const leaseCheckMs = 5000;
|
|
|
9
9
|
const staleMs = 15_000;
|
|
10
10
|
const retryWithinMs = 1000;
|
|
11
11
|
export function program(options) {
|
|
12
|
-
const { command, environment, singleInstance = false } = options;
|
|
12
|
+
const { command, environment, singleInstance = false, isService = false } = options;
|
|
13
13
|
return ({ mod, announce, reserveName }) => {
|
|
14
14
|
const { claude, report, spawnCmod, watches } = engineOf(mod);
|
|
15
15
|
const [executable] = command;
|
|
16
16
|
if (executable === undefined)
|
|
17
17
|
throw new Error(`${mod.name}: the program has no command. Name the program on PATH and its arguments, such as ['preview-server', '--port', '0'].`);
|
|
18
|
-
if (
|
|
18
|
+
if (isService)
|
|
19
|
+
for (const type of ['program', 'service'])
|
|
20
|
+
reserveName(type, basename(executable), `${mod.name}: the service ${executable} is already added. Give each isService program its own executable.`);
|
|
21
|
+
else if (singleInstance)
|
|
19
22
|
reserveName('program', basename(executable), `${mod.name}: the single instance of ${executable} is already added. Give each singleInstance program its own executable.`);
|
|
23
|
+
const isElected = singleInstance || isService;
|
|
20
24
|
const request = { argv: command, ...(environment === undefined ? {} : { env: environment }) };
|
|
21
25
|
let state = 'stopped';
|
|
22
26
|
let address;
|
|
@@ -27,7 +31,11 @@ export function program(options) {
|
|
|
27
31
|
let isWatching = false;
|
|
28
32
|
let instance;
|
|
29
33
|
let leaseCheck;
|
|
30
|
-
const spawn = () =>
|
|
34
|
+
const spawn = () => {
|
|
35
|
+
if (isService)
|
|
36
|
+
return spawnCmod(['program', mod.name, '--service', ...Object.keys(environment ?? {}).flatMap((name) => ['--env', name]), '--', ...command], environment);
|
|
37
|
+
return singleInstance ? spawnCmod(['program', mod.name, '--no-wait', '--', ...command], environment) : claude.process.spawn(request);
|
|
38
|
+
};
|
|
31
39
|
const instanceFile = () => (instance ??= Promise.all([claude.env.home(), claude.env.dataHome()]).then(([home, dataHome]) => instancePath(storeFolder({ HOME: home, XDG_DATA_HOME: dataHome }), mod.name, basename(executable))));
|
|
32
40
|
const following = (run) => void run.catch((error) => report({ id: `program:${executable}:follow`, message: `Could not follow the ${executable} program`, error }));
|
|
33
41
|
const stop = (reason) => {
|
|
@@ -101,7 +109,7 @@ export function program(options) {
|
|
|
101
109
|
const lines = `${pending}${piece.text}`.split('\n');
|
|
102
110
|
pending = lines.pop() ?? '';
|
|
103
111
|
for (const line of lines.slice(0, 1)) {
|
|
104
|
-
if (
|
|
112
|
+
if (isElected && line.trim() === 'held')
|
|
105
113
|
return await follow(await instanceFile());
|
|
106
114
|
const next = addressOf(line.trim());
|
|
107
115
|
if (next === undefined) {
|
package/package.json
CHANGED
package/records.d.ts
CHANGED
|
@@ -84,6 +84,8 @@ export declare function buildFailuresPath(store: string): string;
|
|
|
84
84
|
export declare function linksPath(store: string): string;
|
|
85
85
|
export declare function instanceFolder(store: string, mod: string): string;
|
|
86
86
|
export declare function instancePath(store: string, mod: string, executable: string): string;
|
|
87
|
+
export declare function serviceFolder(store: string, mod: string): string;
|
|
88
|
+
export declare function servicePath(store: string, mod: string, executable: string): string;
|
|
87
89
|
export type Links = {
|
|
88
90
|
readonly marketplaces: Readonly<Record<string, string>>;
|
|
89
91
|
readonly turnedOff: Readonly<Record<string, readonly string[]>>;
|
|
@@ -133,8 +135,8 @@ export declare function newestLog(entries: readonly LogEntry[]): LogEntry[];
|
|
|
133
135
|
export declare function versionsLine({ mod, core, cmod, program, claudeCode }: LogVersions): string;
|
|
134
136
|
export declare function logReport(entry: LogEntry): string;
|
|
135
137
|
export declare function parseConsent(value: unknown, path: string): Record<string, string[]>;
|
|
136
|
-
export declare const coreVersion = "5.
|
|
137
|
-
export declare const oldestCmodVersion = "5.
|
|
138
|
+
export declare const coreVersion = "5.10.0";
|
|
139
|
+
export declare const oldestCmodVersion = "5.10.0";
|
|
138
140
|
export declare function hotkeyCommand(mod: string, hotkey: string): string;
|
|
139
141
|
export declare function hotkeyBindings(mod: string, hotkeys: Hotkeys | undefined): Record<string, string>;
|
|
140
142
|
export declare function boundCombos(keybindings: unknown): Map<string, string>;
|
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,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAChC,CAAA;AAiBD,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;AAEpE,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KA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IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE"}
|
package/records.js
CHANGED
|
@@ -226,6 +226,12 @@ export function instanceFolder(store, mod) {
|
|
|
226
226
|
export function instancePath(store, mod, executable) {
|
|
227
227
|
return `${instanceFolder(store, mod)}/${executable}.json`;
|
|
228
228
|
}
|
|
229
|
+
export function serviceFolder(store, mod) {
|
|
230
|
+
return `${store}/services/${checkedName(mod)}`;
|
|
231
|
+
}
|
|
232
|
+
export function servicePath(store, mod, executable) {
|
|
233
|
+
return `${serviceFolder(store, mod)}/${checkedName(executable)}.json`;
|
|
234
|
+
}
|
|
229
235
|
export function parseLinks(value, path) {
|
|
230
236
|
if (value === undefined)
|
|
231
237
|
return { marketplaces: {}, turnedOff: {} };
|
|
@@ -302,8 +308,8 @@ function readHotkeys(hotkeys) {
|
|
|
302
308
|
throw new Error(`package.json "cmod.hotkeys" is not a map of hotkeys to their title and optional default combo. ${fix}`);
|
|
303
309
|
return { hotkeys: checkHotkeys('package.json "cmod"', hotkeys) };
|
|
304
310
|
}
|
|
305
|
-
export const coreVersion = '5.
|
|
306
|
-
export const oldestCmodVersion = '5.
|
|
311
|
+
export const coreVersion = '5.10.0';
|
|
312
|
+
export const oldestCmodVersion = '5.10.0';
|
|
307
313
|
export function hotkeyCommand(mod, hotkey) {
|
|
308
314
|
return `${mod}--${hotkey}`;
|
|
309
315
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../src/runtime/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAqB,WAAW,EAAE,MAAM,EAAc,aAAa,EAAwB,MAAM,aAAa,CAAA;AAGxI,OAAO,KAAK,EAAW,GAAG,EAAE,aAAa,EAA8G,MAAM,WAAW,CAAA;AACxK,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,eAAe,CAAA;AAC1D,OAAO,
|
|
1
|
+
{"version":3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AC3B,UAAU,UAAO,EACjB,eAAe,CAAC,EAAE,eAAe,GAChC,SAAS,CAAC,KAAK,CAAC,CA4hBlB"}
|
package/runtime/lifecycle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dataFolder, finishStepsMethod, isAtLeast, isProgramNewer, oldestCmodVersion, pendingStepsMethod, parseEvent, programPath, readRecord, readSteps, recordPath, scriptsSha256, storeFolder } from '../records.js';
|
|
1
|
+
import { dataFolder, finishStepsMethod, isAtLeast, isProgramNewer, oldestCmodVersion, pendingStepsMethod, parseEvent, programPath, readRecord, readSteps, recordPath, scriptsSha256, serviceFolder, storeFolder } from '../records.js';
|
|
2
2
|
import { homePrefix, ifMissing, relativePath } from '../utils/paths.js';
|
|
3
3
|
import { firstLine, formatExit, messageOf } from '../utils/text.js';
|
|
4
4
|
import { beforeDeadline, settledAfterAbort } from './deadline.js';
|
|
@@ -7,7 +7,7 @@ import { bind } from './bound.js';
|
|
|
7
7
|
import { answerCall, answeringOwnCalls, cmodPluginName, dependencyCalls, loadedMethod, withBareRefusals } from './dependencies.js';
|
|
8
8
|
import { keepEngine } from './engine.js';
|
|
9
9
|
import { classicFailure, classicHook, userSkillHook } from './hooks.js';
|
|
10
|
-
import { cmodError, locatingPrograms, newestCmodVersion, readLines, spawnCmod } from './programs.js';
|
|
10
|
+
import { cmodError, locatingPrograms, newestCmodVersion, readLines, runCmod, spawnCmod } from './programs.js';
|
|
11
11
|
import { createModFiles, resolvedPath } from './metadata.js';
|
|
12
12
|
import { fitsOption } from '../options.js';
|
|
13
13
|
import { createInstaller } from './installer.js';
|
|
@@ -1047,6 +1047,13 @@ async function createMod(definition, runtime) {
|
|
|
1047
1047
|
names.add(key);
|
|
1048
1048
|
return { remove: () => void names.delete(key) };
|
|
1049
1049
|
};
|
|
1050
|
+
const removeUndeclaredServices = async () => {
|
|
1051
|
+
for (const { name } of await claude.fs.list(serviceFolder(runtime.store, definition.name)).catch(ifMissing([]))) {
|
|
1052
|
+
const program = name.endsWith('.json') ? name.slice(0, -'.json'.length) : undefined;
|
|
1053
|
+
if (program !== undefined && !names.has(`service:${program}`))
|
|
1054
|
+
await runCmod(claude, ['program', definition.name, '--remove-service', '--', program], session);
|
|
1055
|
+
}
|
|
1056
|
+
};
|
|
1050
1057
|
await failsAs('its state did not load', () => modState.load());
|
|
1051
1058
|
await failsAs('its options did not load', () => modOptions.load(root));
|
|
1052
1059
|
const missing = modOptions.missing;
|
|
@@ -1057,6 +1064,7 @@ async function createMod(definition, runtime) {
|
|
|
1057
1064
|
api = apiOf(definition.name, returned);
|
|
1058
1065
|
await failsAs('its open panes did not load', () => area.restorePanes());
|
|
1059
1066
|
area.started();
|
|
1067
|
+
void removeUndeclaredServices().catch((error) => report({ id: 'program:services', message: 'Could not stop a service it no longer runs', error }));
|
|
1060
1068
|
return { mod, added, imports, raise: client.raise, area };
|
|
1061
1069
|
}
|
|
1062
1070
|
function apiOf(name, returned) {
|
package/src/jobs/program.ts
CHANGED
|
@@ -21,13 +21,15 @@ const staleMs = 15_000
|
|
|
21
21
|
|
|
22
22
|
const retryWithinMs = 1000
|
|
23
23
|
|
|
24
|
-
export function program(options: { readonly command: readonly string[]; readonly environment?: Record<string, string>; readonly singleInstance?: boolean }): Job<Program> {
|
|
25
|
-
const { command, environment, singleInstance = false } = options
|
|
24
|
+
export function program(options: { readonly command: readonly string[]; readonly environment?: Record<string, string>; readonly singleInstance?: boolean; readonly isService?: boolean }): Job<Program> {
|
|
25
|
+
const { command, environment, singleInstance = false, isService = false } = options
|
|
26
26
|
return ({ mod, announce, reserveName }) => {
|
|
27
27
|
const { claude, report, spawnCmod, watches } = engineOf(mod)
|
|
28
28
|
const [executable] = command
|
|
29
29
|
if (executable === undefined) throw new Error(`${mod.name}: the program has no command. Name the program on PATH and its arguments, such as ['preview-server', '--port', '0'].`)
|
|
30
|
-
if (
|
|
30
|
+
if (isService) for (const type of ['program', 'service']) reserveName(type, basename(executable), `${mod.name}: the service ${executable} is already added. Give each isService program its own executable.`)
|
|
31
|
+
else if (singleInstance) reserveName('program', basename(executable), `${mod.name}: the single instance of ${executable} is already added. Give each singleInstance program its own executable.`)
|
|
32
|
+
const isElected = singleInstance || isService
|
|
31
33
|
const request = { argv: command, ...(environment === undefined ? {} : { env: environment }) }
|
|
32
34
|
let state: Program['state'] = 'stopped'
|
|
33
35
|
let address: Address | undefined
|
|
@@ -39,7 +41,10 @@ export function program(options: { readonly command: readonly string[]; readonly
|
|
|
39
41
|
let instance: Promise<string> | undefined
|
|
40
42
|
let leaseCheck: Promise<void> | undefined
|
|
41
43
|
|
|
42
|
-
const spawn = () =>
|
|
44
|
+
const spawn = () => {
|
|
45
|
+
if (isService) return spawnCmod(['program', mod.name, '--service', ...Object.keys(environment ?? {}).flatMap((name) => ['--env', name]), '--', ...command], environment)
|
|
46
|
+
return singleInstance ? spawnCmod(['program', mod.name, '--no-wait', '--', ...command], environment) : claude.process.spawn(request)
|
|
47
|
+
}
|
|
43
48
|
|
|
44
49
|
const instanceFile = () =>
|
|
45
50
|
(instance ??= Promise.all([claude.env.home(), claude.env.dataHome()]).then(([home, dataHome]) => instancePath(storeFolder({ HOME: home, XDG_DATA_HOME: dataHome }), mod.name, basename(executable))))
|
|
@@ -116,7 +121,7 @@ export function program(options: { readonly command: readonly string[]; readonly
|
|
|
116
121
|
const lines = `${pending}${piece.text}`.split('\n')
|
|
117
122
|
pending = lines.pop() ?? ''
|
|
118
123
|
for (const line of lines.slice(0, 1)) {
|
|
119
|
-
if (
|
|
124
|
+
if (isElected && line.trim() === 'held') return await follow(await instanceFile())
|
|
120
125
|
const next = addressOf(line.trim())
|
|
121
126
|
if (next === undefined) {
|
|
122
127
|
stop(`its first line is "${line.trim()}". Write 127.0.0.1:<port> or unix:<socket path> as the first line on standard output.`)
|
package/src/records.ts
CHANGED
|
@@ -264,6 +264,14 @@ export function instancePath(store: string, mod: string, executable: string): st
|
|
|
264
264
|
return `${instanceFolder(store, mod)}/${executable}.json`
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
+
export function serviceFolder(store: string, mod: string): string {
|
|
268
|
+
return `${store}/services/${checkedName(mod)}`
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export function servicePath(store: string, mod: string, executable: string): string {
|
|
272
|
+
return `${serviceFolder(store, mod)}/${checkedName(executable)}.json`
|
|
273
|
+
}
|
|
274
|
+
|
|
267
275
|
export type Links = { readonly marketplaces: Readonly<Record<string, string>>; readonly turnedOff: Readonly<Record<string, readonly string[]>> }
|
|
268
276
|
|
|
269
277
|
export function parseLinks(value: unknown, path: string): Links {
|
|
@@ -369,9 +377,9 @@ function readHotkeys(hotkeys: unknown): Steps {
|
|
|
369
377
|
return { hotkeys: checkHotkeys('package.json "cmod"', hotkeys as Record<string, HotkeyInit>) }
|
|
370
378
|
}
|
|
371
379
|
|
|
372
|
-
export const coreVersion = '5.
|
|
380
|
+
export const coreVersion = '5.10.0'
|
|
373
381
|
|
|
374
|
-
export const oldestCmodVersion = '5.
|
|
382
|
+
export const oldestCmodVersion = '5.10.0'
|
|
375
383
|
|
|
376
384
|
export function hotkeyCommand(mod: string, hotkey: string): string {
|
|
377
385
|
return `${mod}--${hotkey}`
|
package/src/runtime/lifecycle.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Step } from '../installer.js'
|
|
|
3
3
|
|
|
4
4
|
import type { Imports, Mod, ModDefinition, Reservation, SettingsFile, SettingsFileChange, SettingsFileChangeListener, Subscription, Timer as ModTimer } from '../mod.js'
|
|
5
5
|
import type { Options, OptionValues } from '../options.js'
|
|
6
|
-
import { dataFolder, finishStepsMethod, isAtLeast, isProgramNewer, oldestCmodVersion, pendingStepsMethod, parseEvent, programPath, readRecord, readSteps, recordPath, scriptsSha256, storeFolder, type ReadFile, type RunnerEvent, type Steps } from '../records.js'
|
|
6
|
+
import { dataFolder, finishStepsMethod, isAtLeast, isProgramNewer, oldestCmodVersion, pendingStepsMethod, parseEvent, programPath, readRecord, readSteps, recordPath, scriptsSha256, serviceFolder, storeFolder, type ReadFile, type RunnerEvent, type Steps } from '../records.js'
|
|
7
7
|
import { homePrefix, ifMissing, relativePath } from '../utils/paths.js'
|
|
8
8
|
import { firstLine, formatExit, messageOf } from '../utils/text.js'
|
|
9
9
|
import type { Claude } from './claude.js'
|
|
@@ -16,7 +16,7 @@ import type { Device } from '../session/context/turn/device.js'
|
|
|
16
16
|
import { keepEngine } from './engine.js'
|
|
17
17
|
import { classicFailure, classicHook, userSkillHook, type Hook, type HookFields, type HookListener, type RoutedEvent } from './hooks.js'
|
|
18
18
|
import type { PermissionRoutes } from './permission-check.js'
|
|
19
|
-
import { cmodError, locatingPrograms, newestCmodVersion, readLines, spawnCmod, type Programs } from './programs.js'
|
|
19
|
+
import { cmodError, locatingPrograms, newestCmodVersion, readLines, runCmod, spawnCmod, type Programs } from './programs.js'
|
|
20
20
|
import { createModFiles, resolvedPath, type Places } from './metadata.js'
|
|
21
21
|
import { fitsOption } from '../options.js'
|
|
22
22
|
import { createInstaller } from './installer.js'
|
|
@@ -1100,6 +1100,12 @@ async function createMod<State extends object, Declared extends Options>(definit
|
|
|
1100
1100
|
names.add(key)
|
|
1101
1101
|
return { remove: () => void names.delete(key) }
|
|
1102
1102
|
}
|
|
1103
|
+
const removeUndeclaredServices = async () => {
|
|
1104
|
+
for (const { name } of await claude.fs.list(serviceFolder(runtime.store, definition.name)).catch(ifMissing([]))) {
|
|
1105
|
+
const program = name.endsWith('.json') ? name.slice(0, -'.json'.length) : undefined
|
|
1106
|
+
if (program !== undefined && !names.has(`service:${program}`)) await runCmod(claude, ['program', definition.name, '--remove-service', '--', program], session)
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1103
1109
|
await failsAs('its state did not load', () => modState.load())
|
|
1104
1110
|
await failsAs('its options did not load', () => modOptions.load(root))
|
|
1105
1111
|
const missing = modOptions.missing
|
|
@@ -1109,6 +1115,7 @@ async function createMod<State extends object, Declared extends Options>(definit
|
|
|
1109
1115
|
api = apiOf(definition.name, returned)
|
|
1110
1116
|
await failsAs('its open panes did not load', () => area.restorePanes())
|
|
1111
1117
|
area.started()
|
|
1118
|
+
void removeUndeclaredServices().catch((error: unknown) => report({ id: 'program:services', message: 'Could not stop a service it no longer runs', error }))
|
|
1112
1119
|
return { mod, added, imports, raise: client.raise, area }
|
|
1113
1120
|
}
|
|
1114
1121
|
|