@aeolus-fleet/trierarch 0.20.5 → 0.22.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/README.md +9 -9
- package/dist/adapters/claude-code-detector.js +7 -0
- package/dist/adapters/claude-code-detector.js.map +1 -1
- package/dist/adapters/claude-code-screen.js +4 -2
- package/dist/adapters/claude-code-screen.js.map +1 -1
- package/dist/adapters/claude-code-setup.d.ts +37 -1
- package/dist/adapters/claude-code-setup.js +60 -4
- package/dist/adapters/claude-code-setup.js.map +1 -1
- package/dist/adapters/claude-code.d.ts +21 -6
- package/dist/adapters/claude-code.js +65 -7
- package/dist/adapters/claude-code.js.map +1 -1
- package/dist/adapters/codex-detector.d.ts +1 -1
- package/dist/adapters/codex-screen.d.ts +2 -0
- package/dist/adapters/codex-screen.js +9 -3
- package/dist/adapters/codex-screen.js.map +1 -1
- package/dist/adapters/codex-setup.js +4 -0
- package/dist/adapters/codex-setup.js.map +1 -1
- package/dist/adapters/codex.d.ts +8 -2
- package/dist/adapters/codex.js +12 -6
- package/dist/adapters/codex.js.map +1 -1
- package/dist/adapters/command-line.d.ts +3 -1
- package/dist/adapters/command-line.js +6 -3
- package/dist/adapters/command-line.js.map +1 -1
- package/dist/adapters/detected-file.js +1 -0
- package/dist/adapters/detected-file.js.map +1 -1
- package/dist/adapters/detectors.d.ts +1 -0
- package/dist/adapters/detectors.js +2 -1
- package/dist/adapters/detectors.js.map +1 -1
- package/dist/adapters/harnesses.d.ts +20 -5
- package/dist/adapters/harnesses.js +17 -9
- package/dist/adapters/harnesses.js.map +1 -1
- package/dist/adapters/json-state.js +1 -1
- package/dist/adapters/json-state.js.map +1 -1
- package/dist/adapters/plugin.d.ts +12 -2
- package/dist/adapters/plugin.js +34 -4
- package/dist/adapters/plugin.js.map +1 -1
- package/dist/adapters/rest-fleet.d.ts +6 -1
- package/dist/adapters/rest-fleet.js +25 -3
- package/dist/adapters/rest-fleet.js.map +1 -1
- package/dist/adapters/run-command.d.ts +10 -0
- package/dist/adapters/run-command.js +30 -0
- package/dist/adapters/run-command.js.map +1 -1
- package/dist/adapters/service.d.ts +2 -0
- package/dist/adapters/service.js +9 -4
- package/dist/adapters/service.js.map +1 -1
- package/dist/adapters/tmux.d.ts +11 -0
- package/dist/adapters/tmux.js +11 -1
- package/dist/adapters/tmux.js.map +1 -1
- package/dist/adapters/trust.d.ts +2 -1
- package/dist/adapters/trust.js +3 -3
- package/dist/adapters/trust.js.map +1 -1
- package/dist/bin/aeolus-trierarch.js +2 -1
- package/dist/bin/aeolus-trierarch.js.map +1 -1
- package/dist/cli/config-check.d.ts +2 -1
- package/dist/cli/config-check.js +6 -5
- package/dist/cli/config-check.js.map +1 -1
- package/dist/cli/init.js +3 -3
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/logs.d.ts +37 -2
- package/dist/cli/logs.js +32 -2
- package/dist/cli/logs.js.map +1 -1
- package/dist/cli/main.d.ts +7 -1
- package/dist/cli/main.js +45 -31
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/new-process.d.ts +3 -8
- package/dist/cli/new-process.js +7 -4
- package/dist/cli/new-process.js.map +1 -1
- package/dist/cli/run.d.ts +1 -0
- package/dist/cli/run.js +6 -6
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/service-command.d.ts +25 -0
- package/dist/cli/service-command.js +16 -0
- package/dist/cli/service-command.js.map +1 -0
- package/dist/cli/status.d.ts +8 -1
- package/dist/cli/status.js +22 -1
- package/dist/cli/status.js.map +1 -1
- package/dist/cli/upgrade.d.ts +16 -3
- package/dist/cli/upgrade.js +34 -23
- package/dist/cli/upgrade.js.map +1 -1
- package/dist/core/entry.d.ts +2 -2
- package/dist/core/no-terminal-questions.d.ts +4 -0
- package/dist/core/no-terminal-questions.js +10 -0
- package/dist/core/no-terminal-questions.js.map +1 -0
- package/dist/core/ports.d.ts +10 -0
- package/dist/core/reconciler.d.ts +11 -0
- package/dist/core/reconciler.js +45 -22
- package/dist/core/reconciler.js.map +1 -1
- package/dist/core/run-pass.js +69 -19
- package/dist/core/run-pass.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ That gives the command `aeolus-trierarch`.
|
|
|
27
27
|
- the folders it may crew a ship in as they are, by name and path. It trusts each one, so a session there starts with no trust question;
|
|
28
28
|
- the caps: how many ships it takes, how many sessions run at once.
|
|
29
29
|
|
|
30
|
-
It writes `~/.aeolus/trierarch/config.json`, with `config.schema.json` beside it so an editor checks it. When the configuration offers Codex, it answers Codex's one-time questions ahead too, through `codex app-server` as Codex's own dialogs do: it trusts each configured repository and folder in `~/.codex/config.toml` (a repository covers its worktrees), and trusts the aeolus plugin's hooks, without which a Codex session marks no turn and is never woken. A plugin update
|
|
30
|
+
It writes `~/.aeolus/trierarch/config.json`, with `config.schema.json` beside it so an editor checks it. When the configuration offers Codex, it answers Codex's one-time questions ahead too, through `codex app-server` as Codex's own dialogs do: it trusts each configured repository and folder in `~/.codex/config.toml` (a repository covers its worktrees), and trusts the aeolus plugin's hooks, without which a Codex session marks no turn and is never woken. A plugin update can change the hooks: the trierarch trusts the new or changed ones again before every Codex launch. When the configuration offers Claude Code, it answers Claude Code's one-time questions ahead, so a session nobody watches never waits on one, and otherwise leaves Claude Code's files alone: it trusts the worktree root in `~/.claude.json`, each configured repository and each configured folder (on every run, so a place added since is trusted too), completes Claude Code's onboarding there without asking (each launch completes it again), and, when the sessions skip permissions, offers to accept bypass permissions mode in `~/.claude/settings.json`. Then it offers to install and start the service: a launchd agent on macOS (`~/Library/LaunchAgents/dev.aeolus-fleet.trierarch.plist`), a systemd user unit on Linux (`aeolus-trierarch.service`), started at login and again whenever it stops.
|
|
31
31
|
|
|
32
32
|
Without a terminal, pass everything as flags and take every default with `--yes`: `aeolus-trierarch init --fleet-url https://fleet.example.com --ship-id shp_... --secret aeolus_sk_v1_... --yes`. Prefer the prompt: a secret in a flag lands in your shell history.
|
|
33
33
|
|
|
@@ -37,15 +37,15 @@ That gives the command `aeolus-trierarch`.
|
|
|
37
37
|
|
|
38
38
|
| Command | What it does |
|
|
39
39
|
| --- | --- |
|
|
40
|
-
| `aeolus-trierarch status` | The installed version, and the one the service runs when it differs (then it says to restart), the service (running, pid, since), the fleet and the trierarch's own lease, the caps in use, the entries by state, kept worktrees and orphans |
|
|
40
|
+
| `aeolus-trierarch status` | The installed version, and the one the service runs when it differs (then it says to restart), the aeolus plugin version each configured harness uses (or that it has none), the configured repositories by name, the service (running, pid, since), the fleet and the trierarch's own lease, the caps in use, the entries by state, kept worktrees and orphans |
|
|
41
41
|
| `aeolus-trierarch list` | The ships it crews: ship, state, harness, workspace, since, restarts |
|
|
42
|
-
| `aeolus-trierarch logs [--lines <n>] [--follow]` | The last lines of `~/.aeolus/trierarch/logs/trierarch.log`, where the launchd agent writes on
|
|
42
|
+
| `aeolus-trierarch logs [--lines <n>] [--follow]` | The last lines of the log, and with `--follow` each new one: on macOS `~/.aeolus/trierarch/logs/trierarch.log`, where the launchd agent writes; on Linux the journal the systemd user unit writes to, read through `journalctl --user --unit aeolus-trierarch.service`. The log holds one JSON record per line: each action the loop takes for a ship (crew, launch, wake, report, release, confirm, forget, leave, stop) as `{ time, shipId, shipName, action, outcome, next }`, where `next` says what happens after a failure, or a message as `{ time, level, message }`. `logs` renders them as text, and `--json` gives the records as they are (a line that is no record as `{ line }`). `run` in a terminal writes the text |
|
|
43
43
|
| `aeolus-trierarch add repository <name> <path>`, `aeolus-trierarch add folder <name> <path>` | Adds a repository to make worktrees of, or a folder to crew a ship in as it is, checked as init checks it, and trusts it for every configured harness in one step: adding a place is what trusts it. Then it restarts the service so the trierarch offers it, and waits until the new process says its version (at most 30 seconds); sessions keep running. A place written into `config.json` by hand is never offered and never crewed until it is added |
|
|
44
|
-
| `aeolus-trierarch config check` | Checks the configuration and gives the flags each harness launches with, and each option value's flags. Then the command each harness launches on a first start and on a restart, with each flag marked `(configuration)` or `(adapter)` when the adapter adds it itself (`--no-daemon` for Codex, `--continue` on a Claude Code restart, the remote-control session name) |
|
|
44
|
+
| `aeolus-trierarch config check` | Checks the configuration and gives the flags each harness launches with, and each option value's flags. Then the command each harness launches on a first start and on a restart, with each flag marked `(configuration)` or `(adapter)` when the adapter adds it itself (`--no-daemon` for Codex, `--continue` on a Claude Code restart, the remote-control session name, `--permission-mode manual` (or `default`) where Claude Code's settings make plan the default mode, with when it applies where the folder's settings decide) |
|
|
45
45
|
| `aeolus-trierarch detect` | Detects again what each configured harness offers (its models, and effort where its CLI has a flag for it) and keeps it in `~/.aeolus/trierarch/detected.json`, then gives per harness its version, each option's values and when its models were last confirmed. Restart the trierarch so it reads them ([docs/trierarch.md](../../docs/trierarch.md#detected-options)) |
|
|
46
|
-
| `aeolus-trierarch start`, `stop`, `restart` | The service. `stop` returns once the trierarch has exited; a stopped one starts again at the next login. `restart`
|
|
47
|
-
| `aeolus-trierarch upgrade [version]` | Installs the given version, or the latest on npm, globally and pinned to it. Then it stops the old process and starts the new one, waits until the new one says its version (at most 30 seconds), and shows `status`. Sessions keep running: the new process takes them over. If the install fails, the old version keeps running. It never upgrades on its own |
|
|
48
|
-
| `aeolus-trierarch install [--no-load]` | Installs the service; over a running one it waits for the old process to exit, then loads it again. With `--no-load` it only writes its file |
|
|
46
|
+
| `aeolus-trierarch start`, `stop`, `restart` | The service. `stop` returns once the trierarch has exited; a stopped one starts again at the next login. `start` and `restart` return once the new process says its version (at most 30 seconds). Restart it after you change the configuration |
|
|
47
|
+
| `aeolus-trierarch upgrade [version]` | Installs the given version, or the latest on npm, globally and pinned to it. Then the version it installs rewrites the service's file as its `init` does, and it stops the old process and starts the new one, waits until the new one says its version (at most 30 seconds), and shows `status`. Sessions keep running: the new process takes them over. If the install fails, the old version keeps running. Where npm's global folder is not yours to write (a system Node install), it installs nothing and says what to run instead: `sudo npm install --global @aeolus-fleet/trierarch@<version>`, then `aeolus-trierarch install` when the service is installed. It never upgrades on its own |
|
|
48
|
+
| `aeolus-trierarch install [--no-load]` | Installs the service; over a running one it waits for the old process to exit, then loads it again, and returns once the new process says its version (at most 30 seconds). With `--no-load` it only writes its file |
|
|
49
49
|
| `aeolus-trierarch uninstall` | Removes the service and stops every session. It deletes nothing else: it lists the worktrees it leaves, and keeps its own files under `~/.aeolus/trierarch/` |
|
|
50
50
|
| `aeolus-trierarch run` | What the service runs: keeps the ships assigned to it crewed until stopped |
|
|
51
51
|
| `aeolus-trierarch --version`, `-v` | The installed version |
|
|
@@ -83,11 +83,11 @@ To stop the trierarch: `aeolus-trierarch stop`, or `aeolus-trierarch uninstall`
|
|
|
83
83
|
- **caps**: how many ships it takes (the trierarch plugin assigns it no more), and how many sessions run at once.
|
|
84
84
|
- **repositories**: by name. A crew request for a worktree of one gets a git worktree under `~/.aeolus/trierarch/worktrees/<repository>/<ship>`, detached at the settings' ref or the repository's HEAD. It fetches the repository first, and a ref `origin` has a branch for checks out that remote branch (`origin/<ref>`), so a ship starts from current code; when the fetch fails it uses what the repository has. `worktreeRoot` moves that root.
|
|
85
85
|
- **folders**: by name, used as they are, one ship per folder, never removed.
|
|
86
|
-
- **harnesses**: `claude-code`, `codex` or both: the flags every launch gets, and named options. A crew request's settings pick option values by name; they never add a flag or carry a path. There is no policy on which flags: put `--dangerously-skip-permissions` in `flags` if you want it. The trierarch never adds a flag by itself. With `--remote-control` and no name after it, each session is named `[<repository or folder>] <ship>`, such as `[aeolus-fleet] trial-1`, so it is easy to find among your remote-control sessions.
|
|
86
|
+
- **harnesses**: `claude-code`, `codex` or both: the flags every launch gets, and named options. A crew request's settings pick option values by name; they never add a flag or carry a path. There is no policy on which flags: put `--dangerously-skip-permissions` in `flags` if you want it. The trierarch never adds a flag by itself. With `--remote-control` and no name after it, each session is named `[<repository or folder>] <ship>`, such as `[aeolus-fleet] trial-1`, so it is easy to find among your remote-control sessions. Claude Code's `--permission-mode plan`, in `flags` or an option, is ignored: a crewed session runs without plan mode's tools, so it could never leave plan mode (#465); `config check` shows the command without it. For the same reason, when Claude Code's settings make `plan` the default mode and the flags name no permission mode, a launch adds `--permission-mode manual`, or `default` where the detected Claude Code's `--help` lists no `manual` mode (#505, #507, #517). It reads `permissions.defaultMode` where Claude Code does, the first that names one winning: the managed settings files (`managed-settings.json`, then `managed-settings.d/*.json`, in `/Library/Application Support/ClaudeCode` or `/etc/claude-code`), `--settings` in the flags (JSON, or a file, relative to the folder), then of the sources `--setting-sources` loads (none with `--restricted`) the folder's `.claude/settings.local.json`, its `.claude/settings.json` and the user's `settings.json` (in `CLAUDE_CONFIG_DIR` when set, else `~/.claude`). A plan default mode from server-managed settings or a macOS configuration profile is not overridden: those are an admin's deliberate policy, and are not read. `config check` shows the override as the launch adds it, and where the folder's settings decide, with when it applies.
|
|
87
87
|
|
|
88
88
|
`aeolus-trierarch init` writes caps, repositories, folders, and Claude Code's and Codex's flags, and detects each harness's models and effort levels into `detected.json` ([docs/trierarch.md](../../docs/trierarch.md#detected-options)). Options you write here replace the detected option of the same name whole, except `model`: model ids come from detection only, and a `model` here is ignored (#382). The example above narrows Claude Code's effort to two levels with a default, and takes the detected models as they are. Edit the file for options and `worktreeRoot`, then `aeolus-trierarch config check` and `aeolus-trierarch restart`.
|
|
89
89
|
|
|
90
|
-
The trierarch finds the aeolus plugin in each offered harness's plugin cache (the newest version): Claude Code's under `~/.claude/plugins
|
|
90
|
+
The trierarch finds the aeolus plugin in each offered harness's plugin cache (the newest version): Claude Code's under `~/.claude/plugins` (or `$CLAUDE_CONFIG_DIR/plugins`), Codex's under `~/.codex/plugins` (or `$CODEX_HOME/plugins`). Claude Code's settings and `.claude.json` follow `CLAUDE_CONFIG_DIR` the same way, as Claude Code's own do, and Codex's `config.toml` follows `CODEX_HOME`; init's summary names the files it wrote. Set `AEOLUS_PLUGIN_ROOT` and `AEOLUS_PLUGIN_DATA` (Claude Code), or `AEOLUS_CODEX_PLUGIN_ROOT` and `AEOLUS_CODEX_PLUGIN_DATA` (Codex), to point it elsewhere. `aeolus-trierarch install` carries these, `CLAUDE_CONFIG_DIR`, `CODEX_HOME`, `AEOLUS_TRIERARCH_CONFIG` and `PATH` into the service as they are set where it runs.
|
|
91
91
|
|
|
92
92
|
## What is here
|
|
93
93
|
|
|
@@ -71,6 +71,11 @@ function effortLevelsOf(help) {
|
|
|
71
71
|
.map((level) => level.trim())
|
|
72
72
|
.filter((level) => trierarchNameSchema.safeParse(level).success);
|
|
73
73
|
}
|
|
74
|
+
/** The modes `--permission-mode <mode> ... (choices: "acceptEdits", ...)` lists in --help, each one word such as acceptEdits (#517). */
|
|
75
|
+
function permissionModesOf(help) {
|
|
76
|
+
const listed = /\(choices:([^)]*)\)/.exec(entryOf(help, '--permission-mode <mode>'))?.[1];
|
|
77
|
+
return [...(listed ?? '').matchAll(/"([A-Za-z]+)"/g)].flatMap((match) => (match[1] === undefined ? [] : [match[1]]));
|
|
78
|
+
}
|
|
74
79
|
function optionOf(names, flag) {
|
|
75
80
|
return { values: Object.fromEntries(names.map((name) => [name, [flag, name]])) };
|
|
76
81
|
}
|
|
@@ -85,6 +90,7 @@ export function createClaudeCodeDetector(deps) {
|
|
|
85
90
|
const help = await deps.run(program, { args: ['--help'], timeoutMs: QUICK_TIMEOUT_MS });
|
|
86
91
|
const text = help.status === 0 ? help.stdout : '';
|
|
87
92
|
const levels = effortLevelsOf(text);
|
|
93
|
+
const permissionModes = permissionModesOf(text);
|
|
88
94
|
const aliases = aliasesOf(text);
|
|
89
95
|
const before = previous?.version === version ? previous : undefined;
|
|
90
96
|
const resolvedBefore = Object.keys(before?.options.model?.values ?? {});
|
|
@@ -105,6 +111,7 @@ export function createClaudeCodeDetector(deps) {
|
|
|
105
111
|
...(ids.length > 0 && { model: optionOf(ids, '--model') }),
|
|
106
112
|
...(levels.length > 0 && { effort: optionOf(levels, '--effort') }),
|
|
107
113
|
},
|
|
114
|
+
...(permissionModes.length > 0 && { permissionModes }),
|
|
108
115
|
...(aliases.length === 0 && {
|
|
109
116
|
problem: `Claude Code ${version}'s --help names no model alias, so this machine declares no Claude Code model until an update of Claude Code names one`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AAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC9I,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACtD,CAAC;YACD,OAAO;gBACL,OAAO;gBACP,UAAU,EAAE,GAAG;gBACf,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,WAAW,IAAI,IAAI,CAAC;gBAChE,OAAO,EAAE;oBACP,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,CAAC;oBAC1D,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC;iBACnE;gBACD,GAAG,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,eAAe,EAAE,CAAC;gBACtD,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI;oBAC1B,OAAO,EAAE,eAAe,OAAO,wHAAwH;iBACxJ,CAAC;aACH,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -4,11 +4,13 @@ import { launchSeenWith } from './launch-screen.js';
|
|
|
4
4
|
* 2.1.295 writes it: the one place its texts are matched, tested on screens
|
|
5
5
|
* captured from real sessions (test/screens). Its first-run screens (#403)
|
|
6
6
|
* show on a machine where it never ran by hand, and each waits for a key.
|
|
7
|
-
* It marks a tool call with ⏺ on macOS and with ● on Linux (#487)
|
|
7
|
+
* It marks a tool call with ⏺ on macOS and with ● on Linux (#487), so any
|
|
8
|
+
* single mark that is no letter, digit or space counts as that marker (#489),
|
|
9
|
+
* except ❯, which marks the prompt it was given.
|
|
8
10
|
*/
|
|
9
11
|
const CLAUDE_CODE_TEXTS = {
|
|
10
12
|
// A tool call collapsed once done ("Ran 1 shell command", "Read 1 file", "Called aeolus"), under way ("⏺ Reading 1 file…"), or shown whole ("⏺ Bash(echo hi)").
|
|
11
|
-
activity: /^ {2}(?:Ran|Read|Wrote|Edited|Updated|Searched for|Listed|Fetched) \d+ |^ {2}Called \S+|^[
|
|
13
|
+
activity: /^ {2}(?:Ran|Read|Wrote|Edited|Updated|Searched for|Listed|Fetched) \d+ |^ {2}Called \S+|^[^\s\p{L}\p{N}❯] (?:Running|Reading|Calling|Writing|Editing|Updating|Searching|Listing|Fetching) |^[^\s\p{L}\p{N}❯] [A-Za-z][\w-]*\(/mu,
|
|
12
14
|
refused: /There's an issue with the selected model \(([^()\s]+)\)/gu,
|
|
13
15
|
screens: [
|
|
14
16
|
{ name: 'theme picker', text: /Choose the text style that looks best with your terminal/u },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code-screen.js","sourceRoot":"","sources":["../../src/adapters/claude-code-screen.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAoB,MAAM,oBAAoB,CAAC;AAEtE
|
|
1
|
+
{"version":3,"file":"claude-code-screen.js","sourceRoot":"","sources":["../../src/adapters/claude-code-screen.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAoB,MAAM,oBAAoB,CAAC;AAEtE;;;;;;;;GAQG;AACH,MAAM,iBAAiB,GAAgB;IACrC,gKAAgK;IAChK,QAAQ,EACN,iOAAiO;IACnO,OAAO,EAAE,2DAA2D;IACpE,OAAO,EAAE;QACP,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,2DAA2D,EAAE;QAC3F,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,uBAAuB,EAAE;QAChE,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,qBAAqB,EAAE;QACvD,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,mDAAmD,EAAE;QAC5F,EAAE,IAAI,EAAE,4BAA4B,EAAE,IAAI,EAAE,0DAA0D,EAAE;QACxG,EAAE,IAAI,EAAE,2BAA2B,EAAE,IAAI,EAAE,oCAAoC,EAAE;KAClF;CACF,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAAC,EAAsC;IACzE,OAAO,cAAc,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -9,9 +9,16 @@
|
|
|
9
9
|
* renderer (#403); a completed onboarding skips the first, and an offer seen
|
|
10
10
|
* as often as it is shown skips the second. The answers live in Claude Code's
|
|
11
11
|
* own files, which this changes key by key, keeping everything else and the
|
|
12
|
-
* file's mode.
|
|
12
|
+
* file's mode. It reads the default permission mode its settings give a
|
|
13
|
+
* folder, so a crewed session is never started in plan mode (#505, #507). Its
|
|
14
|
+
* files follow CLAUDE_CONFIG_DIR when it is set, as Claude Code's do (#474).
|
|
13
15
|
*/
|
|
14
16
|
export interface ClaudeCodeSetup {
|
|
17
|
+
/** The files it answers in: `.claude.json` and the user's `settings.json`, where Claude Code keeps them. */
|
|
18
|
+
readonly files: {
|
|
19
|
+
readonly claudeJson: string;
|
|
20
|
+
readonly settings: string;
|
|
21
|
+
};
|
|
15
22
|
trust(folder: string): Promise<void>;
|
|
16
23
|
isTrusted(folder: string): Promise<boolean>;
|
|
17
24
|
/** Every folder it trusts, from one read of its file (#381). */
|
|
@@ -20,7 +27,36 @@ export interface ClaudeCodeSetup {
|
|
|
20
27
|
isSkipPermissionsAccepted(): Promise<boolean>;
|
|
21
28
|
completeOnboarding(): Promise<void>;
|
|
22
29
|
isOnboardingComplete(): Promise<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* The `permissions.defaultMode` Claude Code takes from its settings files,
|
|
32
|
+
* the first that names one: the managed settings, the `--settings` file or
|
|
33
|
+
* JSON, then of the sources it loads the folder's local settings, its
|
|
34
|
+
* project's and the user's. Without a folder it is decided only when no
|
|
35
|
+
* folder settings come before the one that names it.
|
|
36
|
+
*/
|
|
37
|
+
defaultPermissionMode(at: {
|
|
38
|
+
folder?: string;
|
|
39
|
+
settings?: string;
|
|
40
|
+
sources: readonly SettingSource[];
|
|
41
|
+
}): Promise<SettingsDefaultMode>;
|
|
23
42
|
}
|
|
43
|
+
/** The settings files `--setting-sources` picks from. */
|
|
44
|
+
export type SettingSource = 'user' | 'project' | 'local';
|
|
45
|
+
/** The settings sources, the one Claude Code takes first. */
|
|
46
|
+
export declare const SETTING_SOURCES: readonly SettingSource[];
|
|
47
|
+
/** A default mode the settings decide, possibly none; or one the settings of each folder decide. */
|
|
48
|
+
export type SettingsDefaultMode = {
|
|
49
|
+
kind: 'decided';
|
|
50
|
+
mode: string | undefined;
|
|
51
|
+
} | {
|
|
52
|
+
kind: 'per folder';
|
|
53
|
+
};
|
|
54
|
+
/** Where Claude Code reads its managed settings files on macOS and on Linux; only the command itself reads it, so no test reads the machine's own (#516). */
|
|
55
|
+
export declare const CLAUDE_CODE_MANAGED_SETTINGS: string;
|
|
24
56
|
export declare function createClaudeCodeSetup(at: {
|
|
25
57
|
homeDirectory: string;
|
|
58
|
+
/** Claude Code's configuration folder, CLAUDE_CONFIG_DIR when set, where it keeps the user's settings and .claude.json; ~/.claude by default, with .claude.json in the home folder. */
|
|
59
|
+
configDirectory?: string;
|
|
60
|
+
/** Where Claude Code reads its managed settings files: CLAUDE_CODE_MANAGED_SETTINGS on the machine, a folder of its own in a test. */
|
|
61
|
+
managedSettings: string;
|
|
26
62
|
}): ClaudeCodeSetup;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { mkdir, readFile, rename, stat, writeFile } from 'node:fs/promises';
|
|
2
|
-
import { dirname, join } from 'node:path';
|
|
1
|
+
import { mkdir, readdir, readFile, rename, stat, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { dirname, isAbsolute, join } from 'node:path';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { TrierarchFileError } from './files.js';
|
|
5
|
+
/** The settings sources, the one Claude Code takes first. */
|
|
6
|
+
export const SETTING_SOURCES = ['local', 'project', 'user'];
|
|
7
|
+
/** Where Claude Code reads its managed settings files on macOS and on Linux; only the command itself reads it, so no test reads the machine's own (#516). */
|
|
8
|
+
export const CLAUDE_CODE_MANAGED_SETTINGS = process.platform === 'darwin' ? '/Library/Application Support/ClaudeCode' : '/etc/claude-code';
|
|
5
9
|
const jsonObjectSchema = z.record(z.string(), z.unknown());
|
|
6
10
|
/** How often Claude Code 2.1.295 offers its fullscreen renderer at most: once seen this often, it offers it no more. */
|
|
7
11
|
const FULLSCREEN_OFFER_SHOWN_MAX = 3;
|
|
@@ -22,6 +26,38 @@ async function readJsonObject(path) {
|
|
|
22
26
|
throw new TrierarchFileError(`${path} is no JSON object: fix it by hand, then run this again`);
|
|
23
27
|
}
|
|
24
28
|
}
|
|
29
|
+
/** Settings' `permissions.defaultMode`, or none when they are no JSON or name none: Claude Code reports broken settings itself. */
|
|
30
|
+
function defaultModeOf(text) {
|
|
31
|
+
try {
|
|
32
|
+
const settings = jsonObjectSchema.parse(JSON.parse(text));
|
|
33
|
+
return z.object({ defaultMode: z.string() }).safeParse(settings.permissions).data?.defaultMode;
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** A settings file's default mode, or none when the file is missing. */
|
|
40
|
+
async function defaultModeIn(path) {
|
|
41
|
+
const text = await readFile(path, 'utf8').catch(() => undefined);
|
|
42
|
+
return text === undefined ? undefined : defaultModeOf(text);
|
|
43
|
+
}
|
|
44
|
+
/** The managed settings' default mode: managed-settings.json, then each visible `.json` in managed-settings.d in alphabetical order, the last that names one winning. */
|
|
45
|
+
async function managedDefaultMode(folder) {
|
|
46
|
+
const dropIns = join(folder, 'managed-settings.d');
|
|
47
|
+
const files = (await readdir(dropIns).catch(() => [])).filter((file) => file.endsWith('.json') && !file.startsWith('.')).sort();
|
|
48
|
+
const modes = await Promise.all([join(folder, 'managed-settings.json'), ...files.map((file) => join(dropIns, file))].map(defaultModeIn));
|
|
49
|
+
return modes.findLast((mode) => mode !== undefined);
|
|
50
|
+
}
|
|
51
|
+
/** `--settings` takes a file or JSON; a relative file is the folder's, so without a folder it is unknown. */
|
|
52
|
+
async function commandLineDefaultMode(settings, folder) {
|
|
53
|
+
if (settings.trimStart().startsWith('{')) {
|
|
54
|
+
return defaultModeOf(settings);
|
|
55
|
+
}
|
|
56
|
+
if (isAbsolute(settings)) {
|
|
57
|
+
return defaultModeIn(settings);
|
|
58
|
+
}
|
|
59
|
+
return folder === undefined ? undefined : defaultModeIn(join(folder, settings));
|
|
60
|
+
}
|
|
25
61
|
async function writeJsonObject(path, value) {
|
|
26
62
|
const mode = (await stat(path).catch(() => undefined))?.mode ?? PRIVATE_MODE;
|
|
27
63
|
await mkdir(dirname(path), { recursive: true });
|
|
@@ -30,11 +66,13 @@ async function writeJsonObject(path, value) {
|
|
|
30
66
|
await rename(temporary, path);
|
|
31
67
|
}
|
|
32
68
|
export function createClaudeCodeSetup(at) {
|
|
33
|
-
|
|
34
|
-
const
|
|
69
|
+
// As Claude Code does: .claude.json in CLAUDE_CONFIG_DIR when it is set, else in the home folder beside ~/.claude (#474).
|
|
70
|
+
const state = join(at.configDirectory ?? at.homeDirectory, '.claude.json');
|
|
71
|
+
const settings = join(at.configDirectory ?? join(at.homeDirectory, '.claude'), 'settings.json');
|
|
35
72
|
const projectsOf = (claude) => jsonObjectSchema.safeParse(claude.projects).data ?? {};
|
|
36
73
|
const fullscreenOfferSeen = (claude) => z.number().safeParse(claude.fullscreenUpsellSeenCount).data ?? 0;
|
|
37
74
|
return {
|
|
75
|
+
files: { claudeJson: state, settings },
|
|
38
76
|
trust: async (folder) => {
|
|
39
77
|
const claude = await readJsonObject(state);
|
|
40
78
|
const projects = projectsOf(claude);
|
|
@@ -61,6 +99,24 @@ export function createClaudeCodeSetup(at) {
|
|
|
61
99
|
const claude = await readJsonObject(state);
|
|
62
100
|
return claude.hasCompletedOnboarding === true && fullscreenOfferSeen(claude) >= FULLSCREEN_OFFER_SHOWN_MAX;
|
|
63
101
|
},
|
|
102
|
+
defaultPermissionMode: async ({ folder, settings: commandLine, sources }) => {
|
|
103
|
+
const above = (await managedDefaultMode(at.managedSettings)) ?? (commandLine === undefined ? undefined : await commandLineDefaultMode(commandLine, folder));
|
|
104
|
+
if (above !== undefined) {
|
|
105
|
+
return { kind: 'decided', mode: above };
|
|
106
|
+
}
|
|
107
|
+
const fileOf = (source) => source === 'user' ? settings : folder === undefined ? undefined : join(folder, '.claude', source === 'local' ? 'settings.local.json' : 'settings.json');
|
|
108
|
+
for (const source of SETTING_SOURCES.filter((source) => sources.includes(source))) {
|
|
109
|
+
const file = fileOf(source);
|
|
110
|
+
if (file === undefined) {
|
|
111
|
+
return { kind: 'per folder' };
|
|
112
|
+
}
|
|
113
|
+
const mode = await defaultModeIn(file);
|
|
114
|
+
if (mode !== undefined) {
|
|
115
|
+
return { kind: 'decided', mode };
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return { kind: 'decided', mode: undefined };
|
|
119
|
+
},
|
|
64
120
|
};
|
|
65
121
|
}
|
|
66
122
|
//# sourceMappingURL=claude-code-setup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code-setup.js","sourceRoot":"","sources":["../../src/adapters/claude-code-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"claude-code-setup.js","sourceRoot":"","sources":["../../src/ad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G,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;gBACvC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;oBACvB,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;gBACnC,CAAC;YACH,CAAC;YACD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC9C,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import type { TrierarchConfiguration } from '@aeolus-fleet/common';
|
|
2
2
|
import type { AdapterFlag, HarnessPort } from '../core/ports.js';
|
|
3
|
-
import type
|
|
3
|
+
import { type ClaudeCodeSetup, type SettingsDefaultMode } from './claude-code-setup.js';
|
|
4
4
|
import { type CommandPart } from './command-line.js';
|
|
5
5
|
import { type AeolusPlugin } from './plugin-identity.js';
|
|
6
6
|
import type { Tmux } from './tmux.js';
|
|
7
7
|
/**
|
|
8
8
|
* Claude Code as a harness (docs/architecture.md, "First adapters"): `claude`
|
|
9
9
|
* in the folder, `--continue` on a restart when the folder has a conversation
|
|
10
|
-
* to continue, `/aeolus:wake` typed to wake an idle session,
|
|
10
|
+
* to continue, `/aeolus:wake` typed to wake an idle session, each prompt with
|
|
11
|
+
* the line that no human reads its terminal (#585), and always
|
|
11
12
|
* without AskUserQuestion and plan mode: nobody watches the session's pane, so
|
|
12
13
|
* it asks its questions over the fleet, and a question form or a plan approval
|
|
13
14
|
* waiting there would take the keys of a wake (#457, #460). Plan mode goes as a
|
|
14
|
-
* whole: without ExitPlanMode alone a session that entered it could never leave
|
|
15
|
+
* whole: without ExitPlanMode alone a session that entered it could never leave,
|
|
16
|
+
* and for that reason a configured `--permission-mode plan` is ignored (#465),
|
|
17
|
+
* and a default mode of plan from any of Claude Code's settings files is
|
|
18
|
+
* overridden with `--permission-mode manual` when the flags name no mode of
|
|
19
|
+
* their own (#505, #507), or `default` on a Claude Code whose --help lists no
|
|
20
|
+
* manual mode (#517).
|
|
15
21
|
* Its onboarding is completed before every launch, so a session on a machine
|
|
16
22
|
* where Claude Code never ran by hand stops at no first-run screen (#403). A
|
|
17
23
|
* session's identity is written and read through the aeolus
|
|
@@ -24,12 +30,19 @@ export declare const CLAUDE_CODE_ADAPTER_FLAGS: readonly AdapterFlag[];
|
|
|
24
30
|
export declare const SKIP_PERMISSIONS = "--dangerously-skip-permissions";
|
|
25
31
|
/** The flags of Claude Code that are risky: it then runs every tool without asking (#326). */
|
|
26
32
|
export declare const CLAUDE_CODE_RISKY_FLAGS: readonly string[];
|
|
27
|
-
/**
|
|
33
|
+
/** The default mode Claude Code's settings give a session started with the flags, in the folder or, without one, for config check. */
|
|
34
|
+
export declare function claudeCodeSettingsDefaultMode(setup: Pick<ClaudeCodeSetup, 'defaultPermissionMode'>, at: {
|
|
35
|
+
flags: readonly string[];
|
|
36
|
+
folder?: string;
|
|
37
|
+
}): Promise<SettingsDefaultMode>;
|
|
38
|
+
/** `claude`, the flags without plan mode, `--permission-mode manual` (or `default`, as the installed Claude Code lists) when the settings' default mode is plan and the flags name none (or where it depends on the folder, with when it applies), AskUserQuestion and plan mode disallowed, `--continue` on a restart, then the prompt last after `--`: no flag takes it (`--remote-control [name]` has an optional value), and it never reads as a flag. */
|
|
28
39
|
export declare function claudeCodeCommandLine(at: {
|
|
29
40
|
flags: readonly string[];
|
|
30
41
|
sessionName: string;
|
|
31
42
|
prompt: string;
|
|
32
43
|
isFirstStart: boolean;
|
|
44
|
+
defaultPermissionMode?: SettingsDefaultMode;
|
|
45
|
+
permissionModes?: readonly string[] | undefined;
|
|
33
46
|
program?: string;
|
|
34
47
|
}): CommandPart[];
|
|
35
48
|
export declare function createClaudeCodeHarness(options: {
|
|
@@ -38,8 +51,10 @@ export declare function createClaudeCodeHarness(options: {
|
|
|
38
51
|
sessions: Pick<Tmux, 'start' | 'type' | 'screen'>;
|
|
39
52
|
/** Claude Code's projects folder, where it keeps each folder's conversations. */
|
|
40
53
|
projects: string;
|
|
41
|
-
/** Claude Code's own files, where its onboarding is completed before each launch (#403). */
|
|
42
|
-
setup: Pick<ClaudeCodeSetup, 'completeOnboarding'>;
|
|
54
|
+
/** Claude Code's own files, where its onboarding is completed before each launch (#403) and its settings' default mode is read (#505, #507). */
|
|
55
|
+
setup: Pick<ClaudeCodeSetup, 'completeOnboarding' | 'defaultPermissionMode'>;
|
|
56
|
+
/** The permission modes the installed Claude Code lists, as detection last found them (#517); undefined before it found any. */
|
|
57
|
+
permissionModes: () => readonly string[] | undefined;
|
|
43
58
|
/** The program to run; `claude` unless a test runs another. */
|
|
44
59
|
command?: string;
|
|
45
60
|
}): HarnessPort;
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import { readdir } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { claudeCodeLaunchSeen } from './claude-code-screen.js';
|
|
4
|
+
import { SETTING_SOURCES } from './claude-code-setup.js';
|
|
4
5
|
import { partsWithWords, wordsOf } from './command-line.js';
|
|
5
6
|
import { effectiveFlags } from '../core/effective-flags.js';
|
|
7
|
+
import { firstPromptOf, wakePromptOf } from '../core/no-terminal-questions.js';
|
|
6
8
|
import { createPluginIdentity } from './plugin-identity.js';
|
|
7
9
|
/**
|
|
8
10
|
* Claude Code as a harness (docs/architecture.md, "First adapters"): `claude`
|
|
9
11
|
* in the folder, `--continue` on a restart when the folder has a conversation
|
|
10
|
-
* to continue, `/aeolus:wake` typed to wake an idle session,
|
|
12
|
+
* to continue, `/aeolus:wake` typed to wake an idle session, each prompt with
|
|
13
|
+
* the line that no human reads its terminal (#585), and always
|
|
11
14
|
* without AskUserQuestion and plan mode: nobody watches the session's pane, so
|
|
12
15
|
* it asks its questions over the fleet, and a question form or a plan approval
|
|
13
16
|
* waiting there would take the keys of a wake (#457, #460). Plan mode goes as a
|
|
14
|
-
* whole: without ExitPlanMode alone a session that entered it could never leave
|
|
17
|
+
* whole: without ExitPlanMode alone a session that entered it could never leave,
|
|
18
|
+
* and for that reason a configured `--permission-mode plan` is ignored (#465),
|
|
19
|
+
* and a default mode of plan from any of Claude Code's settings files is
|
|
20
|
+
* overridden with `--permission-mode manual` when the flags name no mode of
|
|
21
|
+
* their own (#505, #507), or `default` on a Claude Code whose --help lists no
|
|
22
|
+
* manual mode (#517).
|
|
15
23
|
* Its onboarding is completed before every launch, so a session on a machine
|
|
16
24
|
* where Claude Code never ran by hand stops at no first-run screen (#403). A
|
|
17
25
|
* session's identity is written and read through the aeolus
|
|
@@ -23,6 +31,16 @@ const REMOTE_CONTROL = '--remote-control';
|
|
|
23
31
|
const CONTINUE = '--continue';
|
|
24
32
|
const END_OF_FLAGS = '--';
|
|
25
33
|
const NO_PANE_PROMPTS = '--disallowedTools=AskUserQuestion,EnterPlanMode,ExitPlanMode';
|
|
34
|
+
const PERMISSION_MODE = '--permission-mode';
|
|
35
|
+
const PLAN_MODE = 'plan';
|
|
36
|
+
/** The mode that asks before each action: Claude Code names it manual where its --help lists that, and default before (#517). */
|
|
37
|
+
const MANUAL_MODE = 'manual';
|
|
38
|
+
const DEFAULT_MODE = 'default';
|
|
39
|
+
const SETTINGS = '--settings';
|
|
40
|
+
const SETTING_SOURCES_FLAG = '--setting-sources';
|
|
41
|
+
const RESTRICTED = '--restricted';
|
|
42
|
+
/** Where config check cannot know the folder: the override is shown with when it applies. */
|
|
43
|
+
const WHEN_PLAN_PER_FOLDER = 'the Claude Code settings for the folder make plan the default mode';
|
|
26
44
|
export const CLAUDE_CODE_ADAPTER_FLAGS = [
|
|
27
45
|
{ flag: NO_PANE_PROMPTS, when: 'always' },
|
|
28
46
|
{ flag: CONTINUE, when: 'restart' },
|
|
@@ -31,6 +49,41 @@ export const CLAUDE_CODE_ADAPTER_FLAGS = [
|
|
|
31
49
|
export const SKIP_PERMISSIONS = '--dangerously-skip-permissions';
|
|
32
50
|
/** The flags of Claude Code that are risky: it then runs every tool without asking (#326). */
|
|
33
51
|
export const CLAUDE_CODE_RISKY_FLAGS = [SKIP_PERMISSIONS];
|
|
52
|
+
/** The flags without `--permission-mode plan` (or `=plan`): a session started in plan mode could never leave it (#465). */
|
|
53
|
+
function withoutPlanMode(flags) {
|
|
54
|
+
const startsPlanMode = (at) => flags[at] === PERMISSION_MODE && flags[at + 1] === PLAN_MODE;
|
|
55
|
+
return flags.filter((flag, at) => flag !== `${PERMISSION_MODE}=${PLAN_MODE}` && !startsPlanMode(at) && !startsPlanMode(at - 1));
|
|
56
|
+
}
|
|
57
|
+
/** Whether the flags start Claude Code in a permission mode of their own, which wins over its settings' default mode. */
|
|
58
|
+
function namesPermissionMode(flags) {
|
|
59
|
+
return flags.some((flag) => flag === PERMISSION_MODE || flag.startsWith(`${PERMISSION_MODE}=`) || flag === SKIP_PERMISSIONS);
|
|
60
|
+
}
|
|
61
|
+
/** A flag's value, given as `<flag> <value>` or `<flag>=<value>`; the last one wins. */
|
|
62
|
+
function valueOf(flags, flag) {
|
|
63
|
+
return flags.flatMap((word, at) => (word === flag ? [flags[at + 1]] : word.startsWith(`${flag}=`) ? [word.slice(flag.length + 1)] : [])).findLast((value) => value !== undefined);
|
|
64
|
+
}
|
|
65
|
+
/** The settings sources Claude Code loads with the flags: none with `--restricted`, those `--setting-sources` names, else all. */
|
|
66
|
+
function settingSourcesOf(flags) {
|
|
67
|
+
if (flags.includes(RESTRICTED)) {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
const named = valueOf(flags, SETTING_SOURCES_FLAG)?.split(',').map((source) => source.trim());
|
|
71
|
+
return named === undefined ? SETTING_SOURCES : SETTING_SOURCES.filter((source) => named.includes(source));
|
|
72
|
+
}
|
|
73
|
+
/** The default mode Claude Code's settings give a session started with the flags, in the folder or, without one, for config check. */
|
|
74
|
+
export function claudeCodeSettingsDefaultMode(setup, at) {
|
|
75
|
+
const settings = valueOf(at.flags, SETTINGS);
|
|
76
|
+
return setup.defaultPermissionMode({ sources: settingSourcesOf(at.flags), ...(at.folder !== undefined && { folder: at.folder }), ...(settings !== undefined && { settings }) });
|
|
77
|
+
}
|
|
78
|
+
/** `--permission-mode manual` (or `default` where the installed Claude Code lists no manual) where the settings' default mode is plan and the flags name none, and with when it applies where that depends on the folder. */
|
|
79
|
+
function planOverride(flags, installed) {
|
|
80
|
+
const { defaultMode, permissionModes } = installed;
|
|
81
|
+
if (namesPermissionMode(flags) || defaultMode === undefined || (defaultMode.kind === 'decided' && defaultMode.mode !== PLAN_MODE)) {
|
|
82
|
+
return { words: [] };
|
|
83
|
+
}
|
|
84
|
+
const mode = permissionModes?.includes(MANUAL_MODE) === true ? MANUAL_MODE : DEFAULT_MODE;
|
|
85
|
+
return { words: [PERMISSION_MODE, mode], source: 'adapter', ...(defaultMode.kind === 'per folder' && { when: WHEN_PLAN_PER_FOLDER }) };
|
|
86
|
+
}
|
|
34
87
|
/**
|
|
35
88
|
* The configured flags, with a name for the remote-control session where the
|
|
36
89
|
* operator gave `--remote-control` without one: `[<repository or folder>]
|
|
@@ -50,11 +103,13 @@ function namedRemoteControl(flags, name) {
|
|
|
50
103
|
{ words: flags.slice(at + 1), source: 'configuration' },
|
|
51
104
|
];
|
|
52
105
|
}
|
|
53
|
-
/** `claude`, the flags, AskUserQuestion and plan mode disallowed, `--continue` on a restart, then the prompt last after `--`: no flag takes it (`--remote-control [name]` has an optional value), and it never reads as a flag. */
|
|
106
|
+
/** `claude`, the flags without plan mode, `--permission-mode manual` (or `default`, as the installed Claude Code lists) when the settings' default mode is plan and the flags name none (or where it depends on the folder, with when it applies), AskUserQuestion and plan mode disallowed, `--continue` on a restart, then the prompt last after `--`: no flag takes it (`--remote-control [name]` has an optional value), and it never reads as a flag. */
|
|
54
107
|
export function claudeCodeCommandLine(at) {
|
|
108
|
+
const flags = withoutPlanMode(at.flags);
|
|
55
109
|
return partsWithWords([
|
|
56
110
|
{ words: [at.program ?? 'claude'] },
|
|
57
|
-
...namedRemoteControl(
|
|
111
|
+
...namedRemoteControl(flags, at.sessionName),
|
|
112
|
+
planOverride(flags, { defaultMode: at.defaultPermissionMode, permissionModes: at.permissionModes }),
|
|
58
113
|
{ words: [NO_PANE_PROMPTS], source: 'adapter' },
|
|
59
114
|
{ words: at.isFirstStart ? [] : [CONTINUE], source: 'adapter' },
|
|
60
115
|
{ words: [END_OF_FLAGS, at.prompt] },
|
|
@@ -83,19 +138,22 @@ export function createClaudeCodeHarness(options) {
|
|
|
83
138
|
if (settings === undefined) {
|
|
84
139
|
throw new Error(`The configuration has no harness ${harness}`);
|
|
85
140
|
}
|
|
86
|
-
const prompt = isFirstStart && firstPrompt !== undefined ? firstPrompt : WAKE_PROMPT;
|
|
141
|
+
const prompt = isFirstStart && firstPrompt !== undefined ? firstPromptOf(firstPrompt) : wakePromptOf(WAKE_PROMPT);
|
|
142
|
+
const flags = effectiveFlags(settings, picked);
|
|
87
143
|
const command = claudeCodeCommandLine({
|
|
88
|
-
flags
|
|
144
|
+
flags,
|
|
89
145
|
sessionName: `[${workspace.kind === 'worktree' ? workspace.repository : workspace.name}] ${shipName}`,
|
|
90
146
|
prompt,
|
|
91
147
|
isFirstStart: isFirstStart || !(await hasConversation(options.projects, folder)),
|
|
148
|
+
defaultPermissionMode: await claudeCodeSettingsDefaultMode(options.setup, { flags, folder }),
|
|
149
|
+
permissionModes: options.permissionModes(),
|
|
92
150
|
...(options.command !== undefined && { program: options.command }),
|
|
93
151
|
});
|
|
94
152
|
await options.setup.completeOnboarding();
|
|
95
153
|
await sessions.start({ shipId, folder, command: wordsOf(command) });
|
|
96
154
|
},
|
|
97
155
|
wake: async ({ shipId }) => {
|
|
98
|
-
await sessions.type({ shipId, text: WAKE_PROMPT });
|
|
156
|
+
await sessions.type({ shipId, text: wakePromptOf(WAKE_PROMPT) });
|
|
99
157
|
},
|
|
100
158
|
launchSeen: async ({ shipId, model }) => claudeCodeLaunchSeen({ screen: await sessions.screen(shipId), ...(model !== undefined && { model }) }),
|
|
101
159
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":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;gBAC5F,eAAe,EAAE,OAAO,CAAC,eAAe,EAAE;gBAC1C,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;aACnE,CAAC,CAAC;YACH,MAAM,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,CAAC;YACzC,MAAM,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACtE,CAAC;QACD,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YACzB,MAAM,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACnE,CAAC;QACD,UAAU,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;KAChJ,CAAC;AACJ,CAAC"}
|
|
@@ -8,7 +8,7 @@ export declare function createCodexDetector(deps: {
|
|
|
8
8
|
cwd?: string;
|
|
9
9
|
timeoutMs?: number;
|
|
10
10
|
}) => Promise<CommandResult>;
|
|
11
|
-
/** The user's Codex configuration,
|
|
11
|
+
/** The user's Codex configuration, `config.toml` in CODEX_HOME or `~/.codex`; undefined when there is none. */
|
|
12
12
|
readConfig: () => Promise<string | undefined>;
|
|
13
13
|
/** An empty folder to probe from, so no project's instructions or settings apply. */
|
|
14
14
|
neutralFolder: () => Promise<string>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { LaunchSeen } from '../core/ports.js';
|
|
2
|
+
/** The Codex version the texts above were checked on, the version its screens in test/screens were captured on (#594). */
|
|
3
|
+
export declare const CODEX_SCREENS_CHECKED_ON = "0.162.1";
|
|
2
4
|
export declare function codexLaunchSeen(at: {
|
|
3
5
|
screen: string;
|
|
4
6
|
model?: string;
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { launchSeenWith } from './launch-screen.js';
|
|
2
2
|
/**
|
|
3
|
-
* Codex's screen in a session's launch window (#382), as Codex 0.
|
|
3
|
+
* Codex's screen in a session's launch window (#382), as Codex 0.162.1
|
|
4
4
|
* writes it: the one place its texts are matched, tested on screens captured
|
|
5
5
|
* from real sessions (test/screens). "• Working" shows even with no tool
|
|
6
|
-
* call, so it is no activity.
|
|
6
|
+
* call, so it is no activity. codex-setup answers its folder trust and hooks
|
|
7
|
+
* review screens ahead; they are named here for when one still shows (#602).
|
|
7
8
|
*/
|
|
8
9
|
const CODEX_TEXTS = {
|
|
9
10
|
// A tool call done: "• Ran echo hi", "• Explored", "• Called aeolus.whoami", "• Edited file.ts".
|
|
10
11
|
activity: /^• (?:Ran \S|Explored$|Called \S|Edited \S)/mu,
|
|
11
12
|
refused: /"type":"invalid_request_error","message":"The '([^']+)' model is not supported/gu,
|
|
12
|
-
screens: [
|
|
13
|
+
screens: [
|
|
14
|
+
{ name: 'folder trust question', text: /^ {2}Trust this folder\?/mu },
|
|
15
|
+
{ name: 'hooks review', text: /^ {2}Hooks need review$/mu },
|
|
16
|
+
],
|
|
13
17
|
};
|
|
18
|
+
/** The Codex version the texts above were checked on, the version its screens in test/screens were captured on (#594). */
|
|
19
|
+
export const CODEX_SCREENS_CHECKED_ON = '0.162.1';
|
|
14
20
|
export function codexLaunchSeen(at) {
|
|
15
21
|
return launchSeenWith(CODEX_TEXTS, at);
|
|
16
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-screen.js","sourceRoot":"","sources":["../../src/adapters/codex-screen.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAoB,MAAM,oBAAoB,CAAC;AAEtE
|
|
1
|
+
{"version":3,"file":"codex-screen.js","sourceRoot":"","sources":["../../src/adapters/codex-screen.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAoB,MAAM,oBAAoB,CAAC;AAEtE;;;;;;GAMG;AACH,MAAM,WAAW,GAAgB;IAC/B,iGAAiG;IACjG,QAAQ,EAAE,+CAA+C;IACzD,OAAO,EAAE,kFAAkF;IAC3F,OAAO,EAAE;QACP,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,4BAA4B,EAAE;QACrE,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,2BAA2B,EAAE;KAC5D;CACF,CAAC;AAEF,0HAA0H;AAC1H,MAAM,CAAC,MAAM,wBAAwB,GAAG,SAAS,CAAC;AAElD,MAAM,UAAU,eAAe,CAAC,EAAsC;IACpE,OAAO,cAAc,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -39,6 +39,10 @@ async function withAppServer(command, talk) {
|
|
|
39
39
|
child.on('exit', (code) => {
|
|
40
40
|
reject(new Error(`codex app-server ended before it answered (exit ${String(code)})`));
|
|
41
41
|
});
|
|
42
|
+
// An app server that ends before it reads what it is sent fails the write (EPIPE): a failed setup, not a crash.
|
|
43
|
+
child.stdin.on('error', (error) => {
|
|
44
|
+
reject(new Error(`codex app-server ended before it read what it was sent: ${error.message}`));
|
|
45
|
+
});
|
|
42
46
|
});
|
|
43
47
|
const waiting = new Map();
|
|
44
48
|
createInterface({ input: child.stdout }).on('line', (line) => {
|