@cmodjs/core 6.0.3 → 6.1.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 CHANGED
@@ -62,7 +62,7 @@ Runs every check this machine can run on the mod at `path` (default: the current
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
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
- 9. Checks its imports. It fails a file that imports the `claude-code` module, because every type a mod writes comes from `@cmodjs/core` ([index.md](index.md#what-a-mod-is)). A provider's types file adds to that module with `declare module 'claude-code'`, which imports nothing, so the check keeps it.
65
+ 9. Checks the imports of every file the release ships, the files `cmod publish` would release. It fails a file that imports the `claude-code` module, because every type a mod writes comes from `@cmodjs/core` ([index.md](index.md#what-a-mod-is)). A provider's types file adds to that module with `declare module 'claude-code'`, which imports nothing, so the check keeps it. A folder the release leaves out, such as a library its `"files"` list does not name, may import anything.
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.
68
68
  12. Compiles it against Claude Code's API with `tsc`, with `tsconfig.json`, and then with `tests/tsconfig.json` when it exists. `cmod new` writes both: the root config leaves Bun out of `src/`, which runs inside Claude Code, and the tests config adds `bun-types`, so a test can run a real program with `Bun.spawn` or read files with `node:fs`. When `.claude-plugin/types/` is missing, as in a fresh clone or in CI, Claude Code writes it first: cmod loads the mod in one `claude -p` run with a config folder of its own and no model to reach, so the run sends nothing.
@@ -111,16 +111,17 @@ Prints the Log that Settings shows on cmod's page, newest first: each failure an
111
111
  cmod publish [path] [--dry-run]
112
112
  ```
113
113
 
114
- 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`.
114
+ Releases the mod at `path` (default: the current folder) at the version in its `plugin.json`.
115
115
 
116
- 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.
117
- 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)).
118
- 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.
119
- 4. Commits the release as the `release` branch, and builds the release archive from that commit.
120
- 5. Builds the program `cli/` declares, and writes `SHA256SUMS` for every file of the release.
121
- 6. Writes `.claude-plugin/marketplace.json`, listing the archive, the cmod plugin, and each other mod `plugin.json` depends on. The cmod entry points at the `release` branch of `heyJordanParker/cmod`, so the mod's `"cmod"` dependency resolves in this marketplace and follows each cmod release with no new publish of the mod. Each other dependency's entry points at the `release` branch of the GitHub repository of the marketplace Claude Code added on your computer that lists it ([dependencies.md](dependencies.md#call-the-methods-mod-dependencies)).
122
- 7. Commits that file, tags `v<version>`, tags the release commit `<name>--v<version>`, which Claude Code installs a version range from when a marketplace lists the mod from its git repository, pushes both tags and the `release` branch, creates the GitHub release with every file, then pushes the branch that holds `marketplace.json`. So Claude Code never updates anyone to a release whose files are not up yet. Its notes are the version's section of the committed `CHANGELOG.md`, above GitHub's compare link ([mod.md](mod.md#release-notes)). `--dry-run` prints them.
123
- 8. Prints the link to paste as the Repository when you submit the mod at [claude.ai/directory/manage](https://claude.ai/directory/manage), such as `https://github.com/owner/my-mod/tree/release`. The portal reads the branch from the link, so the directory follows `release`.
116
+ 1. Runs every check of `cmod check` but its package install and its release build, which steps 2 to 4 do, and releases nothing when one fails, as `cargo publish` builds a crate before it uploads it. So a mod whose types, lint, tests, or imports fail never reaches the people who install it. Where `cmod check` writes a fix, such as the options `defineMod` declares into `userConfig`, its hotkeys, or the `cmod` dependency, `cmod publish` fails that check instead and leaves the file as it is, with the fix `Run cmod check, which writes it, commit <file>, then run the command again.` So `--dry-run` changes no file either.
117
+ 2. 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 3 needs. List every folder the hooks module imports from, such as `"files": ["hooks", "src", "skills"]`, because the bundle in step 3 is built from the release.
118
+ 3. 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)).
119
+ 4. 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.
120
+ 5. Commits the release as the `release` branch, and builds the release archive from that commit.
121
+ 6. Builds the program `cli/` declares, and writes `SHA256SUMS` for every file of the release.
122
+ 7. Writes `.claude-plugin/marketplace.json`, listing the archive, the cmod plugin, and each other mod `plugin.json` depends on. The cmod entry points at the `release` branch of `heyJordanParker/cmod`, so the mod's `"cmod"` dependency resolves in this marketplace and follows each cmod release with no new publish of the mod. Each other dependency's entry points at the `release` branch of the GitHub repository of the marketplace Claude Code added on your computer that lists it ([dependencies.md](dependencies.md#call-the-methods-mod-dependencies)).
123
+ 8. Commits that file, tags `v<version>`, tags the release commit `<name>--v<version>`, which Claude Code installs a version range from when a marketplace lists the mod from its git repository, pushes both tags and the `release` branch, creates the GitHub release with every file, then pushes the branch that holds `marketplace.json`. So Claude Code never updates anyone to a release whose files are not up yet. Its notes are the version's section of the committed `CHANGELOG.md`, above GitHub's compare link ([mod.md](mod.md#release-notes)). `--dry-run` prints them.
124
+ 9. Prints the link to paste as the Repository when you submit the mod at [claude.ai/directory/manage](https://claude.ai/directory/manage), such as `https://github.com/owner/my-mod/tree/release`. The portal reads the branch from the link, so the directory follows `release`.
124
125
 
125
126
  The release keeps `package.json`, so Claude Code still installs the mod's packages for its install and uninstall steps. It keeps `bun.lock` too, unless a `"files"` list leaves it out. `main` keeps the source only.
126
127
 
@@ -237,7 +238,7 @@ Reads every conversation Claude Code saved, as the sessions, contexts, turns, ta
237
238
  cmod web
238
239
  ```
239
240
 
240
- Opens the browser app at `http://127.0.0.1:<port>/` and prints that address. The browser app lists every Claude Code session that runs on the computer, in every project, in four groups: Needs you (a permission prompt, a question, or a turn that failed or was stopped), Replied (an answer the person has not opened), Working, and Idle. A session opens its conversation with a prompt box under it, which sends the text as the person's own prompt in that session, a Stop button while it works, and a tab for each Sidebar page its cmod plugin draws, where a press, a text, or a pick runs the mod's handler in that session. `j` and `k` move between sessions, `Enter` opens one and puts the cursor in its prompt box, `Esc` returns to the list, `e` marks a reply done, and `u` marks it unread. A permission prompt or a question is answered in the session's terminal. The browser app runs while `Show the Sidebar in your browser` is on in Settings, under cmod, Preferences, which `open in browser` on the Sidebar's key bar turns on and runs this command. When it does not run, `cmod web` exits 1 and says so. It opens the address by the rule a `Button` with `href` follows ([ui.md](ui.md#a-button-opens-a-web-page-with-href)): with the program `BROWSER` names, else `open` on macOS and `xdg-open` on Linux. Over ssh, on Linux with no display, or with `BROWSER` set to `true`, it opens nothing, prints the address, and exits 1 with `this computer has no browser to open, so open the address above yourself.` When the opener fails, it exits 1 after it printed the address.
241
+ Opens the browser app at `http://127.0.0.1:<port>/` and prints that address. The browser app lists every Claude Code session that runs on the computer, in every project, in four groups: Needs you (a permission prompt, a question, or a turn that failed or was stopped), Replied (an answer the person has not opened), Working, and Idle. A session opens its conversation with a prompt box under it, which sends the text as the person's own prompt in that session, a Stop button while it works, and a tab for each Sidebar page its cmod plugin draws, where a press, a text, or a pick runs the mod's handler in that session. `j` and `k` move between sessions, `Enter` opens one and puts the cursor in its prompt box, `Esc` returns to the list, `e` marks a reply done, and `u` marks it unread. A permission prompt or a question is answered in the session's terminal. The browser app runs while `Show the Sidebar in your browser` is on in Settings, under cmod, Preferences, which `open in browser` on the Sidebar's key bar turns on and runs this command. When it does not run, `cmod web` exits 1 and says so. It opens the address by the rule a `Button` with `href` follows ([ui.md](ui.md#a-button-opens-a-web-page-with-href)): with the program `BROWSER` names, else `open` on macOS and `xdg-open` on Linux. Over ssh, on Linux with no display, or with `BROWSER` set to `true`, it opens nothing, prints the address, and exits 1 with `this computer has no browser to open, so open the address above yourself.` When the opener fails, it exits 1 after it printed the address. While the browser app is on the person's tailnet ([cmod program](#cmod-program)), it also prints `From your other machines: https://<computer>.<tailnet>.ts.net:<port>/`, which opens the browser app from each of the person's machines.
241
242
 
242
243
  ## Run in an install script
243
244
 
@@ -301,7 +302,7 @@ Refuses a machine the `os` and `cpu` keys of the mod's `package.json` leave out.
301
302
  cmod teardown <plugin-name> [--events]
302
303
  ```
303
304
 
304
- 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 and log 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.
305
+ 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 and log in `services/<plugin-name>/` ([cmod program](#cmod-program)), takes each web app it put on the person's tailnet off it and deletes `tailnet/<plugin-name>/`, 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.
305
306
 
306
307
  ### cmod hotkey
307
308
 
@@ -350,13 +351,15 @@ Starts a task in a new background Claude Code session, for a mod's `startTask` w
350
351
  ### cmod program
351
352
 
352
353
  ```text
353
- cmod program <mod> [--no-wait | --service [--env <name>]... | --remove-service] -- <command…>
354
+ cmod program <mod> [--web-app] [--no-wait | --service [--env <name>]... | --remove-service] -- <command…>
354
355
  ```
355
356
 
356
357
  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. The cmod command that replaces the program's file in the cmod store's `programs` folder stops the copy itself: `cmod setup` when it links a new version, or links the old one back after a failed install step, `cmod link` and `cmod watch` when a build of the linked checkout changes the program, and `cmod download`. It sends SIGTERM, then SIGKILL after 5 seconds, to the copy each `instances/<mod>/<program>.json` names, once its process and start time match, so the copy restarts whatever cmod program holds it, an older one included. The holder then deletes that file and exits with the copy. The session that ran it runs `cmod program` again a second later, and every other session does too once that file is gone, so one of them starts the new file and the others follow its address. A service's holder exits the same way, and launchd or systemd starts it again. A build with the same bytes, and a link placed again at the same file, leave the program as it was, so the copy keeps running. 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.
357
358
 
358
359
  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`, `CLAUDE_CODE_EXECPATH`, 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. `CLAUDE_CODE_EXECPATH` names the Claude Code of the session that wrote the service, so a `cmod` command the program runs finds Claude Code though the `PATH` holds none. It names the path Claude Code's updates keep, `~/.local/bin/claude` when that launcher runs the same install, because the updater deletes old versions and a service rewritten for each version would restart at every update. cmod records it in `services/<mod>/<program>.json` in the cmod store. On macOS the launchd agent writes the service's standard error, the program's and cmod's own, to `services/<mod>/<program>.log` beside that record, because launchd keeps no output of its own. Each holder that starts the program first cuts a log over 1 MiB to the whole lines of its last 512 KiB, so a program that fails at every restart, which launchd starts again every 10 seconds, never fills the disk. Linux keeps the program's output in the systemd journal, so the systemd user service writes no log. It holds the mod's lock in the cmod store while it writes and loads the service and waits for it, so sessions that start the mod at once, as every session does after an update, never load it beside each other or beside `cmod setup` or `cmod teardown` of the mod. It loads the service when it is new, changed, or not loaded, waits up to 15 seconds for the program to write its address to `instances/<mod>/<program>.json`, prints `held`, and exits 0, so the session follows the instance file as with `--no-wait`. A program that has written no address after 15 seconds still counts as started while a holder holds `instances/<mod>/<program>.json.lock`, so a program slow to listen keeps its service. A service with neither, such as a program that exits at once and whose holder therefore held the lock only for a moment, is stopped, disabled, and deleted with its record, as `cmod remove` does, and it fails with what shows why: on macOS the service's log in the cmod store, which the removal keeps, and on Linux `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. When the computer took the service, a loaded launchd agent or an enabled systemd user service, and starting it still failed, such as systemd refusing a program that exited too often, it stops, disables, and deletes the service and its record as `cmod remove` does, and fails with the service manager's error and what shows why, because the program fails and the person needs that error. The service restarts on a new program as every copy does, and `cmod teardown` stops and deletes each one.
359
360
 
361
+ With `--web-app`, which a session passes for a `program` job with `isWebApp`, the holder puts the copy on the person's tailnet while `servesTailnet` in `preferences.json` in the cmod store is on, as it is unless the person turned it off, and `tailscale status --json` says Tailscale is signed in with HTTPS on. It finds `tailscale` on its `PATH`, then at `/Applications/Tailscale.app/Contents/MacOS/Tailscale`, the macOS app's own copy. It runs the copy with `CMOD_TAILNET_NAME`, the computer's tailnet name, and `CMOD_TAILNET_LOGIN`, the login of the computer's owner, and once the copy prints `127.0.0.1:<port>`, runs `tailscale serve --bg --https=<tailnet port> http://127.0.0.1:<port>` before it writes the address, so the instance file carries `tailnetUrl`, `https://<name>:<tailnet port>/`, from the moment a session reads it. The tailnet port is the first port the copy listened on, which `tailnet/<mod>/<program>.json` in the cmod store keeps with the address, or the reason the copy is not on the tailnet, such as Tailscale signed out, HTTPS off, or that port already serving something else on the tailnet, which Settings shows. When the copy exits, the holder runs `tailscale serve --https=<tailnet port> off`, so no address on the tailnet points at a port the copy left. It stops the copy, which starts again as after any exit, when `servesTailnet` changes, which it reads every 5 seconds, and when Tailscale becomes ready for a copy that started without it, which it checks every minute. A service passes `--web-app` on to the `cmod program` its service runs.
362
+
360
363
  With `--remove-service`, it stops the program's service, deletes its file, its record in `services/<mod>/<program>.json`, and its log, 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.
361
364
 
362
365
  ### cmod web serve
@@ -365,7 +368,7 @@ With `--remove-service`, it stops the program's service, deletes its file, its r
365
368
  cmod web serve
366
369
  ```
367
370
 
368
- Serves the browser app that [`cmod web`](#cmod-web) opens, on 127.0.0.1 only. The cmod plugin of each session an app shows runs it through `cmod program` while `Show the Sidebar in your browser` is on, so one copy serves every session. It reads every running session itself: Claude Code's `sessions/<pid>.json` records, a process counting as running only while its pid runs with the start time Claude Code recorded, and leaving out each `sdk-cli` process, then each session's transcript through the conversation index, as [`cmod history`](#cmod-history) does. A session Claude Code records as waiting on a permission prompt or a question moves to Needs you as soon as the dialog opens, and a turn stopped while a command it ran keeps running in the background says so. Each session's cmod plugin adds what only its own hooks hear: the permission prompt or question it waits on, how its last turn ended, and its context fill, and long-polls for the tabs a browser shows, the presses there, and the prompts and Stops the browser sends it. A session whose cmod plugin is older shows only what its transcript says. It keeps `web.json` in the cmod store with its port, listens on that port again while it is free, so a browser tab left open reconnects after a restart, and prints `127.0.0.1:<port>` once it listens. It keeps which replies the person read or marked done in `web-read.json` beside it. It refuses a request for any host but `127.0.0.1` and `localhost` with its port, and a change from any other page. It exits once the preference is off or a newer cmod is in the cmod store. A session that already ran it then starts it again through `cmod program` with the newest cmod, and that copy waits without listening while the preference is off.
371
+ Serves the browser app that [`cmod web`](#cmod-web) opens, on 127.0.0.1 only. The cmod plugin of each session an app shows runs it through `cmod program --web-app`, which puts it on the person's tailnet too, while `Show the Sidebar in your browser` is on, so one copy serves every session. It reads every running session itself: Claude Code's `sessions/<pid>.json` records, a process counting as running only while its pid runs with the start time Claude Code recorded, and leaving out each `sdk-cli` process, then each session's transcript through the conversation index, as [`cmod history`](#cmod-history) does. A session Claude Code records as waiting on a permission prompt or a question moves to Needs you as soon as the dialog opens, and a turn stopped while a command it ran keeps running in the background says so. Each session's cmod plugin adds what only its own hooks hear: the permission prompt or question it waits on, how its last turn ended, and its context fill, and long-polls for the tabs a browser shows, the presses there, and the prompts and Stops the browser sends it. A session whose cmod plugin is older shows only what its transcript says. It keeps `web.json` in the cmod store with its port, listens on that port again while it is free, so a browser tab left open reconnects after a restart, and prints `127.0.0.1:<port>` once it listens. It keeps which replies the person read or marked done in `web-read.json` beside it. It refuses a request for any host but `127.0.0.1` and `localhost` with its port, and a change from any other page. Through the tailnet it answers a request only when its host is `CMOD_TAILNET_NAME` and its `Tailscale-User-Login` is `CMOD_TAILNET_LOGIN`, the person's own, and answers no session call, which comes only from the computer's own sessions. It exits once the preference is off or a newer cmod is in the cmod store. A session that already ran it then starts it again through `cmod program` with the newest cmod, and that copy waits without listening while the preference is off.
369
372
 
370
373
  ### cmod option
371
374
 
package/docs/jobs.md CHANGED
@@ -318,11 +318,11 @@ export const myMod = defineMod({
318
318
  ## program
319
319
 
320
320
  ```ts
321
- program(options: { readonly command: readonly string[]; readonly environment?: Record<string, string>; readonly singleInstance?: boolean; readonly isService?: boolean }): Job<Program>
321
+ program(options: { readonly command: readonly string[]; readonly environment?: Record<string, string>; readonly singleInstance?: boolean; readonly isService?: boolean; readonly isWebApp?: boolean }): Job<Program>
322
322
 
323
323
  type Program = {
324
324
  readonly state: 'stopped' | 'starting' | 'running' | 'backoff' | 'fatal'
325
- ready(): Promise<{ url: string; socketPath?: string }>
325
+ ready(): Promise<{ url: string; socketPath?: string; tailnetUrl?: string }>
326
326
  }
327
327
  ```
328
328
 
@@ -334,6 +334,7 @@ type Program = {
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>`, which shows `The <program> program stopped` with `Retry` where the mod's errors toast ([ui.md](ui.md#toasts)).
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. When cmod installs a new version of the mod, or builds a new program from its linked checkout, it stops the copy, whichever cmod started it, so the copy restarts on the new program a few seconds later, and `ready()` resolves the new copy's address. Two `singleInstance` programs with the same program name in one mod throw at `mod.use`.
336
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`, and its `CLAUDE_CODE_EXECPATH` names the session's Claude Code by the path its updates keep, so a `cmod` command the program runs, such as `cmod options`, finds Claude Code. 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: the service restarts on the new program when cmod installs a new version of the mod or builds a new program from its linked checkout, and cmod 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. A service the computer took but could not start is removed, and the program fails with the service manager's error, as an exiting program does. A service whose program printed no address within 15 seconds and no longer runs is removed the same way. On macOS the program's standard error goes to `services/<mod>/<program>.log` in the cmod store, which that error names, and on Linux to the systemd journal. Two `isService` programs with the same program name in one mod throw at `mod.use`.
337
+ - `isWebApp: true` puts a program the person opens in a browser on their tailnet, so it opens from each of their machines, with `singleInstance` or `isService` beside it, because the tailnet reaches one copy per computer. A web app with neither throws at `mod.use`. While Tailscale is signed in on the computer with HTTPS on, the program runs with `CMOD_TAILNET_NAME`, the computer's tailnet name, such as `my-computer.my-tailnet.ts.net`, and `CMOD_TAILNET_LOGIN`, the person's Tailscale login, and once it prints `127.0.0.1:<port>`, cmod runs `tailscale serve`, so `https://<CMOD_TAILNET_NAME>:<port>/` reaches it, and `ready()` resolves that address as `tailnetUrl`. The tailnet port stays the first port the program listened on, so the address stays the same when it listens on another port later. Tailscale forwards each request with its own `Host` and sets `Tailscale-User-Login` to the login of the person who sent it, replacing any the request carried. So the program answers a request through the tailnet only when the host name of its `Host` is `CMOD_TAILNET_NAME` and its `Tailscale-User-Login` is `CMOD_TAILNET_LOGIN`, because a work tailnet or a device someone shared reaches other people's devices. The program keeps listening on `127.0.0.1` only. cmod takes the program off the tailnet when it exits, stops and starts it again when the person turns `Open web apps from your other machines` in Settings, under cmod, Preferences, off or on, or when Tailscale becomes ready, which it checks every minute, and takes it off when the mod is removed. Without Tailscale, the program runs on `127.0.0.1` alone, and Settings shows the reason on the mod's page, or its tailnet address when it is on the tailnet. A program that listens on a `unix:` socket stays off the tailnet.
337
338
  - 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>`.
338
339
 
339
340
  ```ts
package/docs/testing.md CHANGED
@@ -320,6 +320,7 @@ Set a fake to answer a call:
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
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>`.
323
+ - A `program` job with `isWebApp` puts `--web-app` right after `<mod>` in that `argv`. `ready()` resolves `tailnetUrl` when the instance file gives one, such as `{"address":"127.0.0.1:62021","tailnetUrl":"https://my-computer.my-tailnet.ts.net:62021/"}` in `files`.
323
324
  - `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.
324
325
  - `ui.open` places every pane by default. A fake that answers `{ isPlaced: false }` holds a pane back.
325
326
  - `ui.scroll` answers `{}` by default, as when the window moved. A fake that answers `{ deny }` refuses the scroll.
package/docs/ui.md CHANGED
@@ -157,7 +157,7 @@ type Page<Params = undefined> = {
157
157
  - 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.
158
158
  - 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.
159
159
 
160
- The person can run their sessions from the browser app too, which `open in browser` on the Sidebar's key bar opens and Settings, under cmod, turns off. It lists every running session, and an open session shows its Dashboard, pages, and Settings in tabs beside its conversation, as in the Sidebar. A page needs no change: the browser draws the same `render`, with `props.columns` the browser's width in characters and `props.isFocused` true. A `Button`, `Input`, `Select`, or Markdown link pressed there runs the same handler, with `surface: 'desktop'`, and the page redraws in the browser and in the Sidebar. A page the browser shows counts as `isShown`. The browser draws an `Image` from a file or shared memory as its `alt` text, and `Code` without syntax colors.
160
+ The person can run their sessions from the browser app too, which `open in browser` on the Sidebar's key bar opens and Settings, under cmod, turns off, and through Tailscale from each of their machines. It lists every running session, and an open session shows its Dashboard, pages, and Settings in tabs beside its conversation, as in the Sidebar. A page needs no change: the browser draws the same `render`, with `props.columns` the browser's width in characters and `props.isFocused` true. A `Button`, `Input`, `Select`, or Markdown link pressed there runs the same handler, with `surface: 'desktop'`, and the page redraws in the browser and in the Sidebar. A page the browser shows counts as `isShown`. The browser draws an `Image` from a file or shared memory as its `alt` text, and `Code` without syntax colors.
161
161
 
162
162
  A hotkey is the usual way in:
163
163
 
package/jobs/program.d.ts CHANGED
@@ -4,6 +4,7 @@ export type Program = {
4
4
  ready(): Promise<{
5
5
  url: string;
6
6
  socketPath?: string;
7
+ tailnetUrl?: string;
7
8
  }>;
8
9
  };
9
10
  export declare function program(options: {
@@ -11,5 +12,6 @@ export declare function program(options: {
11
12
  readonly environment?: Record<string, string>;
12
13
  readonly singleInstance?: boolean;
13
14
  readonly isService?: boolean;
15
+ readonly isWebApp?: boolean;
14
16
  }): Job<Program>;
15
17
  //# sourceMappingURL=program.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/jobs/program.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAQpC,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,KAAK,EAAE,SAAS,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CAAE,GAAG,GAAG,CAAC,OAAO,CAAC,CAuJnO"}
package/jobs/program.js CHANGED
@@ -9,7 +9,7 @@ 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, isService = false } = options;
12
+ const { command, environment, singleInstance = false, isService = false, isWebApp = false } = options;
13
13
  return ({ mod, announce, reserveName }) => {
14
14
  const { claude, report, spawnCmod, isInstalledCopy, watches } = engineOf(mod);
15
15
  const [executable] = command;
@@ -21,6 +21,9 @@ export function program(options) {
21
21
  else if (singleInstance)
22
22
  reserveName('program', basename(executable), `${mod.name}: the single instance of ${executable} is already added. Give each singleInstance program its own executable.`);
23
23
  const isElected = singleInstance || isService;
24
+ if (isWebApp && !isElected)
25
+ throw new Error(`${mod.name}: the web app ${executable} runs a copy per session, and your tailnet reaches one copy per computer. Add singleInstance: true or isService: true.`);
26
+ const webApp = isWebApp ? ['--web-app'] : [];
24
27
  const request = { argv: command, ...(environment === undefined ? {} : { env: environment }) };
25
28
  let state = 'stopped';
26
29
  let address;
@@ -33,8 +36,8 @@ export function program(options) {
33
36
  let leaseCheck;
34
37
  const spawn = (isOwnService) => {
35
38
  if (isOwnService)
36
- return spawnCmod(['program', mod.name, '--service', ...Object.keys(environment ?? {}).flatMap((name) => ['--env', name]), '--', ...command], environment);
37
- return isElected ? spawnCmod(['program', mod.name, '--no-wait', '--', ...command], environment) : claude.process.spawn(request);
39
+ return spawnCmod(['program', mod.name, ...webApp, '--service', ...Object.keys(environment ?? {}).flatMap((name) => ['--env', name]), '--', ...command], environment);
40
+ return isElected ? spawnCmod(['program', mod.name, ...webApp, '--no-wait', '--', ...command], environment) : claude.process.spawn(request);
38
41
  };
39
42
  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))));
40
43
  const following = (run) => void run.catch((error) => report({ id: `program:${executable}:follow`, message: `Could not follow the ${executable} program`, error }));
@@ -51,6 +54,14 @@ export function program(options) {
51
54
  for (const waiter of waiting.splice(0))
52
55
  waiter.reject(failure);
53
56
  };
57
+ const recordedAddress = async (file) => {
58
+ const recorded = await claude.fs.read(file).catch(ifMissing(undefined));
59
+ if (recorded === undefined)
60
+ return undefined;
61
+ const instance = JSON.parse(recorded);
62
+ const next = addressOf(String(instance.address).trim());
63
+ return next !== undefined && typeof instance.tailnetUrl === 'string' ? { ...next, tailnetUrl: instance.tailnetUrl } : next;
64
+ };
54
65
  const show = (next) => {
55
66
  address = next;
56
67
  state = 'running';
@@ -69,8 +80,7 @@ export function program(options) {
69
80
  const track = async (file) => {
70
81
  if (!isFollowing)
71
82
  return;
72
- const recorded = await claude.fs.read(file).catch(ifMissing(undefined));
73
- const next = recorded === undefined ? undefined : addressOf(String(JSON.parse(recorded).address).trim());
83
+ const next = await recordedAddress(file);
74
84
  if (next !== undefined)
75
85
  return show(next);
76
86
  address = undefined;
@@ -117,7 +127,7 @@ export function program(options) {
117
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.`);
118
128
  return;
119
129
  }
120
- show(next);
130
+ show(isWebApp ? ((await recordedAddress(await instanceFile())) ?? next) : next);
121
131
  isShown = true;
122
132
  }
123
133
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmodjs/core",
3
- "version": "6.0.3",
3
+ "version": "6.1.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",
package/records.d.ts CHANGED
@@ -114,8 +114,17 @@ export declare function preferencesPath(store: string): string;
114
114
  export type Preferences = {
115
115
  readonly showsInstalledModErrors: boolean;
116
116
  readonly servesWebUi: boolean;
117
+ readonly servesTailnet: boolean;
117
118
  };
118
119
  export declare function parsePreferences(value: unknown, path: string): Preferences;
120
+ export declare function tailnetFolder(store: string, mod: string): string;
121
+ export declare function tailnetPath(store: string, mod: string, executable: string): string;
122
+ export type TailnetRecord = {
123
+ readonly port: number | null;
124
+ readonly url: string | null;
125
+ readonly reason: string | null;
126
+ };
127
+ export declare function parseTailnetRecord(value: unknown, path: string): TailnetRecord | undefined;
119
128
  export declare function webPath(store: string): string;
120
129
  export type WebUi = {
121
130
  readonly port: number;
@@ -165,8 +174,8 @@ export declare function newestLog(entries: readonly LogEntry[]): LogEntry[];
165
174
  export declare function versionsLine({ mod, core, cmod, program, claudeCode }: LogVersions): string;
166
175
  export declare function logReport(entry: LogEntry): string;
167
176
  export declare function parseConsent(value: unknown, path: string): Record<string, string[]>;
168
- export declare const coreVersion = "6.0.3";
169
- export declare const oldestCmodVersion = "6.0.0";
177
+ export declare const coreVersion = "6.1.0";
178
+ export declare const oldestCmodVersion = "6.1.0";
170
179
  export declare function hotkeyCommand(mod: string, hotkey: string): string;
171
180
  export declare function hotkeyBindings(mod: string, hotkeys: Hotkeys | undefined): Record<string, string>;
172
181
  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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E,QAAQ,CAAC;IAAC,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,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
@@ -290,12 +290,26 @@ export function widgetsPath(store) {
290
290
  export function preferencesPath(store) {
291
291
  return `${store}/preferences.json`;
292
292
  }
293
- const preferenceKeys = ['showsInstalledModErrors', 'servesWebUi'];
293
+ const preferenceKeys = ['showsInstalledModErrors', 'servesWebUi', 'servesTailnet'];
294
294
  export function parsePreferences(value, path) {
295
295
  if (value !== undefined && (!isObject(value) || preferenceKeys.some((key) => value[key] !== undefined && typeof value[key] !== 'boolean')))
296
296
  throw new Error(`${path} is not a map of cmod's preferences to true or false. Delete it, and cmod uses its defaults.`);
297
297
  const saved = isObject(value) ? value : {};
298
- return { showsInstalledModErrors: saved['showsInstalledModErrors'] === true, servesWebUi: saved['servesWebUi'] === true };
298
+ return { showsInstalledModErrors: saved['showsInstalledModErrors'] === true, servesWebUi: saved['servesWebUi'] === true, servesTailnet: saved['servesTailnet'] !== false };
299
+ }
300
+ export function tailnetFolder(store, mod) {
301
+ return `${store}/tailnet/${checkedName(mod)}`;
302
+ }
303
+ export function tailnetPath(store, mod, executable) {
304
+ return `${tailnetFolder(store, mod)}/${checkedName(executable)}.json`;
305
+ }
306
+ export function parseTailnetRecord(value, path) {
307
+ if (value === undefined)
308
+ return undefined;
309
+ const isRecord = isObject(value) && (value['port'] === null || Number.isInteger(value['port'])) && (value['url'] === null || typeof value['url'] === 'string') && (value['reason'] === null || typeof value['reason'] === 'string');
310
+ if (!isRecord)
311
+ throw new Error(`${path} is not the tailnet address cmod keeps for a web app. Delete it, and the web app's next start writes it again.`);
312
+ return { port: value['port'], url: value['url'], reason: value['reason'] };
299
313
  }
300
314
  export function webPath(store) {
301
315
  return `${store}/web.json`;
@@ -364,8 +378,8 @@ function readHotkeys(hotkeys) {
364
378
  throw new Error(`package.json "cmod.hotkeys" is not a map of hotkeys to their title and optional default combo. ${fix}`);
365
379
  return { hotkeys: checkHotkeys('package.json "cmod"', hotkeys) };
366
380
  }
367
- export const coreVersion = '6.0.3';
368
- export const oldestCmodVersion = '6.0.0';
381
+ export const coreVersion = '6.1.0';
382
+ export const oldestCmodVersion = '6.1.0';
369
383
  export function hotkeyCommand(mod, hotkey) {
370
384
  return `${mod}--${hotkey}`;
371
385
  }
@@ -8,7 +8,7 @@ import { basename } from '../vendor.js'
8
8
 
9
9
  export type Program = {
10
10
  readonly state: 'stopped' | 'starting' | 'running' | 'backoff' | 'fatal'
11
- ready(): Promise<{ url: string; socketPath?: string }>
11
+ ready(): Promise<{ url: string; socketPath?: string; tailnetUrl?: string }>
12
12
  }
13
13
 
14
14
  type Address = Awaited<ReturnType<Program['ready']>>
@@ -21,8 +21,8 @@ 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; readonly isService?: boolean }): Job<Program> {
25
- const { command, environment, singleInstance = false, isService = false } = options
24
+ export function program(options: { readonly command: readonly string[]; readonly environment?: Record<string, string>; readonly singleInstance?: boolean; readonly isService?: boolean; readonly isWebApp?: boolean }): Job<Program> {
25
+ const { command, environment, singleInstance = false, isService = false, isWebApp = false } = options
26
26
  return ({ mod, announce, reserveName }) => {
27
27
  const { claude, report, spawnCmod, isInstalledCopy, watches } = engineOf(mod)
28
28
  const [executable] = command
@@ -30,6 +30,8 @@ export function program(options: { readonly command: readonly string[]; readonly
30
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
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
32
  const isElected = singleInstance || isService
33
+ if (isWebApp && !isElected) throw new Error(`${mod.name}: the web app ${executable} runs a copy per session, and your tailnet reaches one copy per computer. Add singleInstance: true or isService: true.`)
34
+ const webApp = isWebApp ? ['--web-app'] : []
33
35
  const request = { argv: command, ...(environment === undefined ? {} : { env: environment }) }
34
36
  let state: Program['state'] = 'stopped'
35
37
  let address: Address | undefined
@@ -42,8 +44,8 @@ export function program(options: { readonly command: readonly string[]; readonly
42
44
  let leaseCheck: Promise<void> | undefined
43
45
 
44
46
  const spawn = (isOwnService: boolean) => {
45
- if (isOwnService) return spawnCmod(['program', mod.name, '--service', ...Object.keys(environment ?? {}).flatMap((name) => ['--env', name]), '--', ...command], environment)
46
- return isElected ? spawnCmod(['program', mod.name, '--no-wait', '--', ...command], environment) : claude.process.spawn(request)
47
+ if (isOwnService) return spawnCmod(['program', mod.name, ...webApp, '--service', ...Object.keys(environment ?? {}).flatMap((name) => ['--env', name]), '--', ...command], environment)
48
+ return isElected ? spawnCmod(['program', mod.name, ...webApp, '--no-wait', '--', ...command], environment) : claude.process.spawn(request)
47
49
  }
48
50
 
49
51
  const instanceFile = () =>
@@ -64,6 +66,14 @@ export function program(options: { readonly command: readonly string[]; readonly
64
66
  for (const waiter of waiting.splice(0)) waiter.reject(failure)
65
67
  }
66
68
 
69
+ const recordedAddress = async (file: string): Promise<Address | undefined> => {
70
+ const recorded = await claude.fs.read(file).catch(ifMissing(undefined))
71
+ if (recorded === undefined) return undefined
72
+ const instance = JSON.parse(recorded) as { readonly address?: unknown; readonly tailnetUrl?: unknown }
73
+ const next = addressOf(String(instance.address).trim())
74
+ return next !== undefined && typeof instance.tailnetUrl === 'string' ? { ...next, tailnetUrl: instance.tailnetUrl } : next
75
+ }
76
+
67
77
  const show = (next: Address) => {
68
78
  address = next
69
79
  state = 'running'
@@ -82,8 +92,7 @@ export function program(options: { readonly command: readonly string[]; readonly
82
92
 
83
93
  const track = async (file: string) => {
84
94
  if (!isFollowing) return
85
- const recorded = await claude.fs.read(file).catch(ifMissing(undefined))
86
- const next = recorded === undefined ? undefined : addressOf(String((JSON.parse(recorded) as { readonly address?: unknown }).address).trim())
95
+ const next = await recordedAddress(file)
87
96
  if (next !== undefined) return show(next)
88
97
  address = undefined
89
98
  state = 'starting'
@@ -128,7 +137,7 @@ export function program(options: { readonly command: readonly string[]; readonly
128
137
  stop(`its first line is "${line.trim()}". Write 127.0.0.1:<port> or unix:<socket path> as the first line on standard output.`)
129
138
  return
130
139
  }
131
- show(next)
140
+ show(isWebApp ? ((await recordedAddress(await instanceFile())) ?? next) : next)
132
141
  isShown = true
133
142
  }
134
143
  }
package/src/records.ts CHANGED
@@ -340,14 +340,31 @@ export function preferencesPath(store: string): string {
340
340
  return `${store}/preferences.json`
341
341
  }
342
342
 
343
- export type Preferences = { readonly showsInstalledModErrors: boolean; readonly servesWebUi: boolean }
343
+ export type Preferences = { readonly showsInstalledModErrors: boolean; readonly servesWebUi: boolean; readonly servesTailnet: boolean }
344
344
 
345
- const preferenceKeys = ['showsInstalledModErrors', 'servesWebUi'] as const satisfies readonly (keyof Preferences)[]
345
+ const preferenceKeys = ['showsInstalledModErrors', 'servesWebUi', 'servesTailnet'] as const satisfies readonly (keyof Preferences)[]
346
346
 
347
347
  export function parsePreferences(value: unknown, path: string): Preferences {
348
348
  if (value !== undefined && (!isObject(value) || preferenceKeys.some((key) => value[key] !== undefined && typeof value[key] !== 'boolean'))) throw new Error(`${path} is not a map of cmod's preferences to true or false. Delete it, and cmod uses its defaults.`)
349
349
  const saved = isObject(value) ? value : {}
350
- return { showsInstalledModErrors: saved['showsInstalledModErrors'] === true, servesWebUi: saved['servesWebUi'] === true }
350
+ return { showsInstalledModErrors: saved['showsInstalledModErrors'] === true, servesWebUi: saved['servesWebUi'] === true, servesTailnet: saved['servesTailnet'] !== false }
351
+ }
352
+
353
+ export function tailnetFolder(store: string, mod: string): string {
354
+ return `${store}/tailnet/${checkedName(mod)}`
355
+ }
356
+
357
+ export function tailnetPath(store: string, mod: string, executable: string): string {
358
+ return `${tailnetFolder(store, mod)}/${checkedName(executable)}.json`
359
+ }
360
+
361
+ export type TailnetRecord = { readonly port: number | null; readonly url: string | null; readonly reason: string | null }
362
+
363
+ export function parseTailnetRecord(value: unknown, path: string): TailnetRecord | undefined {
364
+ if (value === undefined) return undefined
365
+ const isRecord = isObject(value) && (value['port'] === null || Number.isInteger(value['port'])) && (value['url'] === null || typeof value['url'] === 'string') && (value['reason'] === null || typeof value['reason'] === 'string')
366
+ if (!isRecord) throw new Error(`${path} is not the tailnet address cmod keeps for a web app. Delete it, and the web app's next start writes it again.`)
367
+ return { port: value['port'] as number | null, url: value['url'] as string | null, reason: value['reason'] as string | null }
351
368
  }
352
369
 
353
370
  export function webPath(store: string): string {
@@ -441,9 +458,9 @@ function readHotkeys(hotkeys: unknown): Steps {
441
458
  return { hotkeys: checkHotkeys('package.json "cmod"', hotkeys as Record<string, HotkeyInit>) }
442
459
  }
443
460
 
444
- export const coreVersion = '6.0.3'
461
+ export const coreVersion = '6.1.0'
445
462
 
446
- export const oldestCmodVersion = '6.0.0'
463
+ export const oldestCmodVersion = '6.1.0'
447
464
 
448
465
  export function hotkeyCommand(mod: string, hotkey: string): string {
449
466
  return `${mod}--${hotkey}`