@aeolus-fleet/trierarch 0.17.2 → 0.18.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.
Files changed (69) hide show
  1. package/README.md +20 -11
  2. package/dist/adapters/claude-code.d.ts +12 -6
  3. package/dist/adapters/claude-code.js +41 -41
  4. package/dist/adapters/claude-code.js.map +1 -1
  5. package/dist/adapters/codex-setup.d.ts +18 -0
  6. package/dist/adapters/codex-setup.js +106 -0
  7. package/dist/adapters/codex-setup.js.map +1 -0
  8. package/dist/adapters/codex.d.ts +33 -0
  9. package/dist/adapters/codex.js +54 -0
  10. package/dist/adapters/codex.js.map +1 -0
  11. package/dist/adapters/command-line.d.ts +15 -0
  12. package/dist/adapters/command-line.js +17 -0
  13. package/dist/adapters/command-line.js.map +1 -0
  14. package/dist/adapters/files.d.ts +9 -0
  15. package/dist/adapters/files.js +16 -0
  16. package/dist/adapters/files.js.map +1 -1
  17. package/dist/adapters/harnesses.d.ts +28 -0
  18. package/dist/adapters/harnesses.js +48 -0
  19. package/dist/adapters/harnesses.js.map +1 -0
  20. package/dist/adapters/log.d.ts +39 -0
  21. package/dist/adapters/log.js +65 -0
  22. package/dist/adapters/log.js.map +1 -0
  23. package/dist/adapters/paths.d.ts +1 -0
  24. package/dist/adapters/paths.js +1 -0
  25. package/dist/adapters/paths.js.map +1 -1
  26. package/dist/adapters/plugin-identity.d.ts +12 -0
  27. package/dist/adapters/plugin-identity.js +41 -0
  28. package/dist/adapters/plugin-identity.js.map +1 -0
  29. package/dist/adapters/plugin.d.ts +9 -4
  30. package/dist/adapters/plugin.js +19 -9
  31. package/dist/adapters/plugin.js.map +1 -1
  32. package/dist/adapters/rest-fleet.js +18 -5
  33. package/dist/adapters/rest-fleet.js.map +1 -1
  34. package/dist/adapters/service.d.ts +1 -1
  35. package/dist/adapters/service.js +19 -16
  36. package/dist/adapters/service.js.map +1 -1
  37. package/dist/adapters/style.d.ts +18 -0
  38. package/dist/adapters/style.js +39 -0
  39. package/dist/adapters/style.js.map +1 -0
  40. package/dist/adapters/tmux.d.ts +2 -1
  41. package/dist/adapters/tmux.js +5 -1
  42. package/dist/adapters/tmux.js.map +1 -1
  43. package/dist/cli/config-check.d.ts +11 -2
  44. package/dist/cli/config-check.js +26 -5
  45. package/dist/cli/config-check.js.map +1 -1
  46. package/dist/cli/init.d.ts +8 -0
  47. package/dist/cli/init.js +106 -18
  48. package/dist/cli/init.js.map +1 -1
  49. package/dist/cli/list.d.ts +3 -1
  50. package/dist/cli/list.js +17 -7
  51. package/dist/cli/list.js.map +1 -1
  52. package/dist/cli/main.js +35 -15
  53. package/dist/cli/main.js.map +1 -1
  54. package/dist/cli/prompter.d.ts +4 -0
  55. package/dist/cli/prompter.js +18 -3
  56. package/dist/cli/prompter.js.map +1 -1
  57. package/dist/cli/run.d.ts +1 -1
  58. package/dist/cli/run.js +8 -8
  59. package/dist/cli/run.js.map +1 -1
  60. package/dist/cli/status.d.ts +11 -3
  61. package/dist/cli/status.js +41 -16
  62. package/dist/cli/status.js.map +1 -1
  63. package/dist/core/answers.js +7 -2
  64. package/dist/core/answers.js.map +1 -1
  65. package/dist/core/ports.d.ts +16 -2
  66. package/dist/core/run-pass.d.ts +5 -1
  67. package/dist/core/run-pass.js +62 -10
  68. package/dist/core/run-pass.js.map +1 -1
  69. package/package.json +3 -3
package/README.md CHANGED
@@ -4,7 +4,7 @@ Keeps the ships on its wanted list crewed on the machine it runs on: it starts,
4
4
 
5
5
  ## Install
6
6
 
7
- On the machine that will run the sessions (macOS or Linux), with Node 26, `git`, `tmux`, Claude Code and the aeolus plugin for Claude Code installed:
7
+ On the machine that will run the sessions (macOS or Linux), with Node 26, `git`, `tmux`, and Claude Code with the aeolus plugin for Claude Code, Codex with the aeolus plugin for Codex, or both, installed. Codex must be on the `PATH` as `codex`:
8
8
 
9
9
  ```sh
10
10
  npm install --global @aeolus-fleet/trierarch
@@ -22,10 +22,12 @@ That gives the command `aeolus-trierarch`.
22
22
  It asks for what it needs, in a short flow:
23
23
  - the fleet URL, the ship id and the secret. The secret is not shown as you type it, so it stays out of your shell history and any transcript. It registers the ship, keeps its crew token in `~/.aeolus/trierarch/crew-token` (readable by you only) and writes the secret nowhere;
24
24
  - whether Claude Code launches with `--dangerously-skip-permissions` and with `--remote-control` (both no unless you say yes);
25
+ - where `codex` runs or Codex is configured already: whether to offer Codex, and whether it launches with `--dangerously-bypass-approvals-and-sandbox` (no unless you say yes). Every Codex session launches with `--no-daemon` whatever the flags, so stopping it stops its work;
25
26
  - the repositories it may make worktrees of, by name and path;
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;
26
28
  - the caps: how many ships on its list, how many sessions at once.
27
29
 
28
- It writes `~/.aeolus/trierarch/config.json`, with `config.schema.json` beside it so an editor checks it. It answers Claude Code's one-time questions ahead, so a session nobody watches never waits on one: it trusts the worktree root in `~/.claude.json`, which covers every worktree under it, and each configured folder (on every run, so a folder added since is trusted too), 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.
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 changes the hooks: run `aeolus-trierarch init` again after updating the aeolus plugin for Codex. It answers Claude Code's one-time questions ahead, so a session nobody watches never waits on one: it trusts the worktree root in `~/.claude.json`, which covers every worktree under it, and each configured folder (on every run, so a folder added since is trusted too), 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.
29
31
 
30
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.
31
33
 
@@ -35,15 +37,16 @@ That gives the command `aeolus-trierarch`.
35
37
 
36
38
  | Command | What it does |
37
39
  | --- | --- |
38
- | `aeolus-trierarch status` | 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 service (running, pid, since), the fleet and the trierarch's own lease, the caps in use, the entries by state, kept worktrees and orphans |
39
41
  | `aeolus-trierarch list` | The wanted entries: ship, state, harness, workspace, since, restarts |
40
- | `aeolus-trierarch logs [--lines <n>] [--follow]` | The last lines of `~/.aeolus/trierarch/logs/trierarch.log`, and with `--follow` each new one |
41
- | `aeolus-trierarch config check` | Checks the configuration and gives the flags each harness launches with, and each option value's flags |
42
+ | `aeolus-trierarch logs [--lines <n>] [--follow]` | The last lines of `~/.aeolus/trierarch/logs/trierarch.log`, and with `--follow` each new one. The log holds one JSON record per line: each action the loop takes for a ship (crew, launch, wake, report, release, drop, 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
+ | `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) |
42
44
  | `aeolus-trierarch start`, `stop`, `restart` | The service. `stop` returns once the trierarch has exited; a stopped one starts again at the next login. Restart it after you change the configuration |
43
45
  | `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, 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 |
44
- | `aeolus-trierarch install [--no-load]` | Installs the service; with `--no-load` it only writes its file |
46
+ | `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 |
45
47
  | `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/` |
46
48
  | `aeolus-trierarch run` | What the service runs: keeps the wanted ships crewed until stopped |
49
+ | `aeolus-trierarch --version`, `-v` | The installed version |
47
50
 
48
51
  Every command takes `--json`, so a ship can read what it says, and `--config <path>`. `status`, `list` and `logs` read what is on the machine and send no message; `status` asks the fleet `whoami` once, for the lease.
49
52
 
@@ -65,6 +68,12 @@ To stop the trierarch: `aeolus-trierarch stop`, or `aeolus-trierarch uninstall`
65
68
  "options": {
66
69
  "model": { "values": { "opus": ["--model", "claude-opus-5-5"], "sonnet": ["--model", "claude-sonnet-5-5"] }, "default": "opus" }
67
70
  }
71
+ },
72
+ "codex": {
73
+ "flags": ["--dangerously-bypass-approvals-and-sandbox"],
74
+ "options": {
75
+ "model": { "values": { "sol": ["-m", "gpt-5.6-sol"] }, "default": "sol" }
76
+ }
68
77
  }
69
78
  }
70
79
  }
@@ -73,11 +82,11 @@ To stop the trierarch: `aeolus-trierarch stop`, or `aeolus-trierarch uninstall`
73
82
  - **caps**: how many ships it keeps on its list, and how many sessions run at once.
74
83
  - **repositories**: by name. A want for a worktree of one gets a git worktree under `~/.aeolus/trierarch/worktrees/<repository>/<ship>`, detached at the want's 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.
75
84
  - **folders**: by name, used as they are, one ship per folder, never removed.
76
- - **harnesses**: the flags every launch gets, and named options. A want picks option values by name; it never adds a flag, and messages never carry paths or flags. 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.
85
+ - **harnesses**: `claude-code`, `codex` or both: the flags every launch gets, and named options. A want picks option values by name; it never adds a flag, and messages never carry paths or flags. 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.
77
86
 
78
- `aeolus-trierarch init` writes caps, repositories and Claude Code's flags; edit the file for folders, options and `worktreeRoot`, then `aeolus-trierarch config check` and `aeolus-trierarch restart`.
87
+ `aeolus-trierarch init` writes caps, repositories, folders, and Claude Code's and Codex's flags; edit the file for options and `worktreeRoot`, then `aeolus-trierarch config check` and `aeolus-trierarch restart`.
79
88
 
80
- The trierarch finds the aeolus plugin in Claude Code's plugin cache (the newest version). Set `AEOLUS_PLUGIN_ROOT` and `AEOLUS_PLUGIN_DATA` to point it elsewhere. `aeolus-trierarch install` carries these, `AEOLUS_TRIERARCH_CONFIG` and `PATH` into the service as they are set where it runs.
89
+ The trierarch finds the aeolus plugin in each offered harness's plugin cache (the newest version): Claude Code's under `~/.claude/plugins`, Codex's under `~/.codex/plugins` (or `$CODEX_HOME/plugins`). 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, `CODEX_HOME`, `AEOLUS_TRIERARCH_CONFIG` and `PATH` into the service as they are set where it runs.
81
90
 
82
91
  ## What is here
83
92
 
@@ -90,7 +99,7 @@ The trierarch finds the aeolus plugin in Claude Code's plugin cache (the newest
90
99
  - the fleet over REST;
91
100
  - tmux, on its own server (`tmux -L aeolus-trierarch`, sessions named `trierarch-<ship id>` and kept on exit). Attach to one with `tmux -L aeolus-trierarch attach -t trierarch-<ship id>`;
92
101
  - git worktrees and folders;
93
- - Claude Code, through the aeolus plugin's `aeolus-identity.sh`;
102
+ - Claude Code and Codex, through the aeolus plugin's `aeolus-identity.sh`. Each passes its prompt last, after `--`, so a prompt never reads as a flag. A Codex session starts with `codex ... -- <prompt>`, always with `--no-daemon`, comes back with `codex resume --last`, and is woken by typing `$aeolus-wake`;
94
103
  - the JSON state store.
95
104
  - **The command** (`src/cli`): `init`, `status`, `list`, `logs`, `config check`, `start`, `stop`, `restart`, `install`, `uninstall`, `run`.
96
- - **Adapters for the setup**: the service (launchd or systemd), and Claude Code's own files for its one-time questions.
105
+ - **Adapters for the setup**: the service (launchd or systemd), Claude Code's own files and Codex's app server for their one-time questions.
@@ -1,5 +1,7 @@
1
- import type { TrierarchConfiguration } from '@aeolus-fleet/common';
1
+ import type { TrierarchAdapterFlag, TrierarchConfiguration } from '@aeolus-fleet/common';
2
2
  import type { HarnessPort } from '../core/ports.js';
3
+ import { type CommandPart } from './command-line.js';
4
+ import { type AeolusPlugin } from './plugin-identity.js';
3
5
  import type { Tmux } from './tmux.js';
4
6
  /**
5
7
  * Claude Code as a harness (docs/architecture.md, "First adapters"): `claude`
@@ -8,12 +10,16 @@ import type { Tmux } from './tmux.js';
8
10
  * plugin's own `aeolus-identity.sh`, never a copy of how the plugin names its
9
11
  * files.
10
12
  */
11
- /** The aeolus plugin as Claude Code installed it: its scripts and its data folder. */
12
- export interface AeolusPlugin {
13
- readonly root: string;
14
- readonly data: string;
15
- }
16
13
  export declare const WAKE_PROMPT = "/aeolus:wake";
14
+ export declare const CLAUDE_CODE_ADAPTER_FLAGS: readonly TrierarchAdapterFlag[];
15
+ /** `claude`, the flags, `--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. */
16
+ export declare function claudeCodeCommandLine(at: {
17
+ flags: readonly string[];
18
+ sessionName: string;
19
+ prompt: string;
20
+ isFirstStart: boolean;
21
+ program?: string;
22
+ }): CommandPart[];
17
23
  export declare function createClaudeCodeHarness(options: {
18
24
  configuration: TrierarchConfiguration;
19
25
  plugin: AeolusPlugin;
@@ -1,64 +1,64 @@
1
- import { readFile } from 'node:fs/promises';
1
+ import { partsWithWords, wordsOf } from './command-line.js';
2
2
  import { effectiveFlags } from './flags.js';
3
- import { runCommand } from './run-command.js';
3
+ import { createPluginIdentity } from './plugin-identity.js';
4
+ /**
5
+ * Claude Code as a harness (docs/architecture.md, "First adapters"): `claude`
6
+ * in the folder, `--continue` on a restart, `/aeolus:wake` typed to wake an
7
+ * idle session. A session's identity is written and read through the aeolus
8
+ * plugin's own `aeolus-identity.sh`, never a copy of how the plugin names its
9
+ * files.
10
+ */
4
11
  export const WAKE_PROMPT = '/aeolus:wake';
5
12
  const REMOTE_CONTROL = '--remote-control';
13
+ const CONTINUE = '--continue';
14
+ const END_OF_FLAGS = '--';
15
+ export const CLAUDE_CODE_ADAPTER_FLAGS = [{ flag: CONTINUE, when: 'restart' }];
6
16
  /**
7
- * The flags, with a name for the remote-control session where the operator
8
- * gave `--remote-control` without one: `[<repository or folder>] <ship>`, so
9
- * the session is easy to find among the operator's remote-control sessions.
10
- * A name the operator gave is kept; without the flag nothing is added.
17
+ * The configured flags, with a name for the remote-control session where the
18
+ * operator gave `--remote-control` without one: `[<repository or folder>]
19
+ * <ship>`, so the session is easy to find among the operator's
20
+ * remote-control sessions. A name the operator gave is kept; without the
21
+ * flag nothing is added.
11
22
  */
12
23
  function namedRemoteControl(flags, name) {
13
24
  const at = flags.indexOf(REMOTE_CONTROL);
14
25
  const next = flags[at + 1];
15
26
  if (at === -1 || (next !== undefined && !next.startsWith('-'))) {
16
- return [...flags];
27
+ return [{ words: flags, source: 'configuration' }];
17
28
  }
18
- return [...flags.slice(0, at + 1), name, ...flags.slice(at + 1)];
29
+ return [
30
+ { words: flags.slice(0, at + 1), source: 'configuration' },
31
+ { words: [name], source: 'adapter' },
32
+ { words: flags.slice(at + 1), source: 'configuration' },
33
+ ];
34
+ }
35
+ /** `claude`, the flags, `--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. */
36
+ export function claudeCodeCommandLine(at) {
37
+ return partsWithWords([
38
+ { words: [at.program ?? 'claude'] },
39
+ ...namedRemoteControl(at.flags, at.sessionName),
40
+ { words: at.isFirstStart ? [] : [CONTINUE], source: 'adapter' },
41
+ { words: [END_OF_FLAGS, at.prompt] },
42
+ ]);
19
43
  }
20
44
  export function createClaudeCodeHarness(options) {
21
45
  const { configuration, plugin, sessions } = options;
22
- const identity = async (folder, args) => runCommand('bash', { args: [`${plugin.root}/scripts/aeolus-identity.sh`, ...args], env: { AEOLUS_FOLDER: folder, AEOLUS_DATA: plugin.data } });
23
46
  return {
24
- prepareIdentity: async ({ folder, identity: crew }) => {
25
- const written = await identity(folder, [
26
- 'write',
27
- '--wake-by',
28
- 'trierarch',
29
- crew.fleetUrl,
30
- crew.shipId,
31
- crew.shipName,
32
- crew.crewToken,
33
- ...(crew.squadron === undefined ? [] : [crew.squadron]),
34
- ]);
35
- if (written.status !== 0) {
36
- throw new Error(`aeolus-identity.sh write failed: ${written.stderr.trim()}`);
37
- }
38
- },
39
- crewTokenOf: async (folder) => {
40
- const path = (await identity(folder, ['path'])).stdout.trim();
41
- const text = await readFile(path, 'utf8').catch(() => '');
42
- return /^crewToken=(.+)$/m.exec(text)?.[1];
43
- },
44
- removeIdentity: async (folder) => {
45
- await identity(folder, ['delete']);
46
- },
47
+ ...createPluginIdentity(plugin),
47
48
  launch: async ({ shipId, shipName, folder, workspace, harness, options: picked, isFirstStart, firstPrompt }) => {
48
49
  const settings = configuration.harnesses[harness];
49
50
  if (settings === undefined) {
50
51
  throw new Error(`The configuration has no harness ${harness}`);
51
52
  }
52
53
  const prompt = isFirstStart && firstPrompt !== undefined ? firstPrompt : WAKE_PROMPT;
53
- const flags = namedRemoteControl(effectiveFlags(settings, picked), `[${workspace.kind === 'worktree' ? workspace.repository : workspace.name}] ${shipName}`);
54
- // The prompt goes first: a flag with an optional value, such as `--remote-control [name]`, would take it.
55
- const command = [options.command ?? 'claude', prompt, ...flags, ...(isFirstStart ? [] : ['--continue'])];
56
- await sessions.start({ shipId, folder, command });
57
- },
58
- turnOf: async (folder) => {
59
- const turn = await identity(folder, ['turn']);
60
- const [state] = turn.stdout.split(' ');
61
- return turn.status === 0 && (state === 'busy' || state === 'idle') ? state : 'unknown';
54
+ const command = claudeCodeCommandLine({
55
+ flags: effectiveFlags(settings, picked),
56
+ sessionName: `[${workspace.kind === 'worktree' ? workspace.repository : workspace.name}] ${shipName}`,
57
+ prompt,
58
+ isFirstStart,
59
+ ...(options.command !== undefined && { program: options.command }),
60
+ });
61
+ await sessions.start({ shipId, folder, command: wordsOf(command) });
62
62
  },
63
63
  wake: async ({ shipId }) => {
64
64
  await sessions.type({ shipId, text: WAKE_PROMPT });
@@ -1 +1 @@
1
- {"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../src/adapters/claude-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAK5C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAiB9C,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;AAE1C,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAE1C;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,KAAwB,EAAE,IAAY;IAChE,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACzC,MAAM,IAAI,GAAG,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IAC3B,IAAI,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,C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AK,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,WAAW,EAAE,CAAC,CAAC;QACrD,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Codex's one-time questions, answered ahead so a session nobody watches never
3
+ * waits on one. Codex asks whether to trust a folder on its first start there;
4
+ * trusting a repository covers its worktrees, but trusting a parent folder
5
+ * covers no repository under it, so each configured repository and folder is
6
+ * trusted. It asks to review hooks that are new or changed, and runs none it
7
+ * does not trust, so the aeolus plugin's hooks (the turn marker among them)
8
+ * are trusted too. Both answers go through Codex's own app server, as its
9
+ * dialogs give them: the hash a hook is trusted by is Codex's to compute.
10
+ */
11
+ export interface CodexSetup {
12
+ trust(folders: readonly string[]): Promise<void>;
13
+ /** Trusts the aeolus plugin's hooks that are new or changed, as Codex sees them from the folder: their keys. */
14
+ trustAeolusHooks(folder: string): Promise<readonly string[]>;
15
+ }
16
+ export declare function createCodexSetup(options?: {
17
+ command?: string;
18
+ }): CodexSetup;
@@ -0,0 +1,106 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { createInterface } from 'node:readline';
3
+ import { z } from 'zod';
4
+ import { runningVersion } from './version.js';
5
+ const AEOLUS_PLUGIN_PREFIX = 'aeolus@';
6
+ /** How long the app server may take to answer before the setup gives up. */
7
+ const ANSWER_TIMEOUT_MS = 30_000;
8
+ const answerSchema = z.object({
9
+ id: z.number(),
10
+ result: z.unknown().optional(),
11
+ error: z.object({ message: z.string() }).optional(),
12
+ });
13
+ const hooksListSchema = z.object({
14
+ data: z.array(z.object({
15
+ hooks: z.array(z.object({ key: z.string(), pluginId: z.string().nullish(), currentHash: z.string(), trustStatus: z.string() })),
16
+ })),
17
+ });
18
+ /** A line the app server printed, as JSON; anything else is no answer. */
19
+ function parseJson(line) {
20
+ try {
21
+ return JSON.parse(line);
22
+ }
23
+ catch {
24
+ return undefined;
25
+ }
26
+ }
27
+ /**
28
+ * Runs `codex app-server` for one conversation: introduces itself, lets `talk`
29
+ * send its requests, one answer each, and ends the server after.
30
+ */
31
+ async function withAppServer(command, talk) {
32
+ const child = spawn(command, ['app-server'], { stdio: ['pipe', 'pipe', 'ignore'] });
33
+ const failed = new Promise((_resolve, reject) => {
34
+ child.on('error', (error) => {
35
+ reject(new Error(`Codex is not installed, or ${command} does not run: ${error.message}`));
36
+ });
37
+ child.on('exit', (code) => {
38
+ reject(new Error(`codex app-server ended before it answered (exit ${String(code)})`));
39
+ });
40
+ });
41
+ const waiting = new Map();
42
+ createInterface({ input: child.stdout }).on('line', (line) => {
43
+ const parsed = answerSchema.safeParse(parseJson(line));
44
+ const waiter = parsed.success ? waiting.get(parsed.data.id) : undefined;
45
+ if (!parsed.success || waiter === undefined) {
46
+ return;
47
+ }
48
+ waiting.delete(parsed.data.id);
49
+ if (parsed.data.error === undefined) {
50
+ waiter.resolve(parsed.data.result);
51
+ }
52
+ else {
53
+ waiter.reject(new Error(`${waiter.method}: ${parsed.data.error.message}`));
54
+ }
55
+ });
56
+ let nextId = 0;
57
+ const send = (message) => {
58
+ child.stdin.write(`${JSON.stringify({ jsonrpc: '2.0', ...message })}\n`);
59
+ };
60
+ const request = async (method, params) => {
61
+ nextId += 1;
62
+ const id = nextId;
63
+ const answered = new Promise((resolve, reject) => {
64
+ waiting.set(id, { resolve, reject, method });
65
+ });
66
+ send({ id, method, params });
67
+ const timeout = new Promise((_resolve, reject) => {
68
+ setTimeout(() => {
69
+ reject(new Error(`codex app-server did not answer ${method}`));
70
+ }, ANSWER_TIMEOUT_MS).unref();
71
+ });
72
+ return Promise.race([answered, failed, timeout]);
73
+ };
74
+ try {
75
+ await request('initialize', { clientInfo: { name: 'aeolus-trierarch', version: runningVersion() } });
76
+ send({ method: 'initialized' });
77
+ return await talk(request);
78
+ }
79
+ finally {
80
+ child.removeAllListeners('exit');
81
+ failed.catch(() => undefined);
82
+ child.kill();
83
+ }
84
+ }
85
+ function upsert(keyPath, value) {
86
+ return { edits: [{ keyPath, value, mergeStrategy: 'upsert' }], reloadUserConfig: true };
87
+ }
88
+ export function createCodexSetup(options = {}) {
89
+ const command = options.command ?? 'codex';
90
+ return {
91
+ trust: async (folders) => {
92
+ await withAppServer(command, (request) => request('config/batchWrite', upsert('projects', Object.fromEntries(folders.map((folder) => [folder, { trust_level: 'trusted' }])))));
93
+ },
94
+ trustAeolusHooks: async (folder) => withAppServer(command, async (request) => {
95
+ const listed = hooksListSchema.parse(await request('hooks/list', { cwds: [folder] }));
96
+ const untrusted = listed.data
97
+ .flatMap((entry) => entry.hooks)
98
+ .filter((hook) => hook.pluginId?.startsWith(AEOLUS_PLUGIN_PREFIX) === true && (hook.trustStatus === 'untrusted' || hook.trustStatus === 'modified'));
99
+ if (untrusted.length > 0) {
100
+ await request('config/batchWrite', upsert('hooks.state', Object.fromEntries(untrusted.map((hook) => [hook.key, { trusted_hash: hook.currentHash }]))));
101
+ }
102
+ return untrusted.map((hook) => hook.key);
103
+ }),
104
+ };
105
+ }
106
+ //# sourceMappingURL=codex-setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-setup.js","sourceRoot":"","sources":["../../src/adapters/codex-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAkB9C,MAAM,oBAAoB,GAAG,SAAS,CAAC;AAEvC,4EAA4E;AAC5E,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEjC,MAAM,YAAY,GAAG,CAAC,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AAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;iBAC/B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,oBAAoB,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,KAAK,WAAW,IAAI,IAAI,CAAC,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC;YACvJ,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACzB,MAAM,OAAO,CAAC,mBAAmB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACzJ,CAAC;YACD,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3C,CAAC,CAAC;KACL,CAAC;AACJ,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { TrierarchAdapterFlag, TrierarchConfiguration } from '@aeolus-fleet/common';
2
+ import type { HarnessPort } from '../core/ports.js';
3
+ import { type CommandPart } from './command-line.js';
4
+ import { type AeolusPlugin } from './plugin-identity.js';
5
+ import type { Tmux } from './tmux.js';
6
+ /**
7
+ * Codex as a harness (docs/architecture.md, "First adapters"): `codex` in the
8
+ * folder, `codex resume --last` on a restart (the folder's last conversation;
9
+ * one ship per folder), always with `--no-daemon`, and `$aeolus-wake` typed
10
+ * to wake an idle session. The identity and the turn marker go through the
11
+ * aeolus plugin for Codex, in Codex's own plugin data folder.
12
+ */
13
+ export declare const WAKE_PROMPT = "$aeolus-wake";
14
+ /**
15
+ * How long a typed wake waits before Enter. Codex takes an Enter that comes
16
+ * right after fast typing as part of a paste, a newline, and submits nothing.
17
+ */
18
+ export declare const CODEX_TYPING_SETTLE_MS = 1000;
19
+ export declare const CODEX_ADAPTER_FLAGS: readonly TrierarchAdapterFlag[];
20
+ /** `codex`, or `codex resume --last` on a restart, then the configured flags, --no-daemon once, and the prompt last after `--`, so it never reads as a flag. */
21
+ export declare function codexCommandLine(at: {
22
+ flags: readonly string[];
23
+ prompt: string;
24
+ isFirstStart: boolean;
25
+ program?: string;
26
+ }): CommandPart[];
27
+ export declare function createCodexHarness(options: {
28
+ configuration: TrierarchConfiguration;
29
+ plugin: AeolusPlugin;
30
+ sessions: Pick<Tmux, 'start' | 'type'>;
31
+ /** The program to run; `codex` unless a test runs another. */
32
+ command?: string;
33
+ }): HarnessPort;
@@ -0,0 +1,54 @@
1
+ import { partsWithWords, wordsOf } from './command-line.js';
2
+ import { effectiveFlags } from './flags.js';
3
+ import { createPluginIdentity } from './plugin-identity.js';
4
+ /**
5
+ * Codex as a harness (docs/architecture.md, "First adapters"): `codex` in the
6
+ * folder, `codex resume --last` on a restart (the folder's last conversation;
7
+ * one ship per folder), always with `--no-daemon`, and `$aeolus-wake` typed
8
+ * to wake an idle session. The identity and the turn marker go through the
9
+ * aeolus plugin for Codex, in Codex's own plugin data folder.
10
+ */
11
+ export const WAKE_PROMPT = '$aeolus-wake';
12
+ /**
13
+ * How long a typed wake waits before Enter. Codex takes an Enter that comes
14
+ * right after fast typing as part of a paste, a newline, and submits nothing.
15
+ */
16
+ export const CODEX_TYPING_SETTLE_MS = 1000;
17
+ /**
18
+ * Added to every launch, as mechanism: without it Codex runs the session's
19
+ * work in its shared app-server daemon, which keeps a turn running after the
20
+ * pane is gone, so a release or a crash would stop the pane but not the work.
21
+ */
22
+ const NO_DAEMON = '--no-daemon';
23
+ const END_OF_FLAGS = '--';
24
+ export const CODEX_ADAPTER_FLAGS = [{ flag: NO_DAEMON, when: 'always' }];
25
+ /** `codex`, or `codex resume --last` on a restart, then the configured flags, --no-daemon once, and the prompt last after `--`, so it never reads as a flag. */
26
+ export function codexCommandLine(at) {
27
+ const program = at.program ?? 'codex';
28
+ return partsWithWords([
29
+ { words: at.isFirstStart ? [program] : [program, 'resume', '--last'] },
30
+ { words: at.flags.filter((flag) => flag !== NO_DAEMON), source: 'configuration' },
31
+ { words: [NO_DAEMON], source: 'adapter' },
32
+ { words: [END_OF_FLAGS, at.prompt] },
33
+ ]);
34
+ }
35
+ export function createCodexHarness(options) {
36
+ const { configuration, plugin, sessions } = options;
37
+ return {
38
+ ...createPluginIdentity(plugin),
39
+ launch: async ({ shipId, folder, harness, options: picked, isFirstStart, firstPrompt }) => {
40
+ const settings = configuration.harnesses[harness];
41
+ if (settings === undefined) {
42
+ throw new Error(`The configuration has no harness ${harness}`);
43
+ }
44
+ const prompt = isFirstStart && firstPrompt !== undefined ? firstPrompt : WAKE_PROMPT;
45
+ const command = codexCommandLine({ flags: effectiveFlags(settings, picked), prompt, isFirstStart, ...(options.command !== undefined && { program: options.command }) });
46
+ await sessions.start({ shipId, folder, command: wordsOf(command) });
47
+ },
48
+ wake: async ({ shipId }) => {
49
+ // The space closes Codex's skill picker, which would otherwise take the Enter.
50
+ await sessions.type({ shipId, text: `${WAKE_PROMPT} `, settleMs: CODEX_TYPING_SETTLE_MS });
51
+ },
52
+ };
53
+ }
54
+ //# sourceMappingURL=codex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/adapters/codex.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAoB,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAqB,MAAM,sBAAsB,CAAC;AAG/E;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;AAE1C;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAE3C;;;;GAIG;AACH,MAAM,S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AE,CAAC,CAAC;YACjE,CAAC;YACD,MAAM,MAAM,GAAG,YAAY,IAAI,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC;YACrF,MAAM,OAAO,GAAG,gBAAgB,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;YACxK,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,+EAA+E;YAC/E,MAAM,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,WAAW,GAAG,EAAE,QAAQ,EAAE,sBAAsB,EAAE,CAAC,CAAC;QAC7F,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * A harness's command line in parts, each marked by where its words come
3
+ * from: the configuration's flags, or what the adapter adds itself. The
4
+ * program and the prompt carry no source. Launch runs the words; config
5
+ * check prints the parts, so the operator sees what will launch and why.
6
+ */
7
+ export interface CommandPart {
8
+ readonly words: readonly string[];
9
+ readonly source?: 'configuration' | 'adapter';
10
+ }
11
+ export declare function wordsOf(parts: readonly CommandPart[]): string[];
12
+ /** One line: each part's words, a word with a space in quotes, and each flag part followed by its source. */
13
+ export declare function describeCommandLine(parts: readonly CommandPart[]): string;
14
+ /** The parts with words in them: a configuration with no flags adds no empty part. */
15
+ export declare function partsWithWords(parts: readonly CommandPart[]): CommandPart[];
@@ -0,0 +1,17 @@
1
+ export function wordsOf(parts) {
2
+ return parts.flatMap((part) => part.words);
3
+ }
4
+ /** One line: each part's words, a word with a space in quotes, and each flag part followed by its source. */
5
+ export function describeCommandLine(parts) {
6
+ return parts
7
+ .map((part) => {
8
+ const words = part.words.map((word) => (word.includes(' ') ? `"${word}"` : word)).join(' ');
9
+ return part.source === undefined ? words : `${words} (${part.source})`;
10
+ })
11
+ .join(' ');
12
+ }
13
+ /** The parts with words in them: a configuration with no flags adds no empty part. */
14
+ export function partsWithWords(parts) {
15
+ return parts.filter((part) => part.words.length > 0);
16
+ }
17
+ //# sourceMappingURL=command-line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-line.js","sourceRoot":"","sources":["../../src/adapters/command-line.ts"],"names":[],"mappings":"AAWA,MAAM,UAAU,OAAO,CAAC,KAA6B;IACnD,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED,6GAA6G;AAC7G,MAAM,UAAU,mBAAmB,CAAC,KAA6B;IAC/D,OAAO,KAAK;SACT,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5F,OAAO,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC;IACzE,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,cAAc,CAAC,KAA6B;IAC1D,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACvD,CAAC"}
@@ -24,3 +24,12 @@ export declare function writeCrewFile(path: string, crew: CrewFile & {
24
24
  shipId: ShipId;
25
25
  }): Promise<void>;
26
26
  export declare function readCrewFile(path: string): Promise<CrewFile>;
27
+ /** What the running trierarch says of itself: its pid and its version, as it started. */
28
+ export interface RunningFile {
29
+ readonly pid: number;
30
+ readonly version: string;
31
+ }
32
+ /** Written by `run` as it starts: an upgrade replaces the installed files, so only the process itself knows the version it runs. */
33
+ export declare function writeRunningFile(path: string, running: RunningFile): Promise<void>;
34
+ /** None when no trierarch wrote it (one before 0.18.0 did not) or it does not fit. */
35
+ export declare function readRunningFile(path: string): Promise<RunningFile | undefined>;
@@ -67,4 +67,20 @@ export async function readCrewFile(path) {
67
67
  const shipId = idSchema('ship').safeParse(field('shipId'));
68
68
  return { fleetUrl, ...(shipId.success && { shipId: shipId.data }), crewToken };
69
69
  }
70
+ const runningFileSchema = z.object({ pid: z.int().positive(), version: z.string() });
71
+ /** Written by `run` as it starts: an upgrade replaces the installed files, so only the process itself knows the version it runs. */
72
+ export async function writeRunningFile(path, running) {
73
+ await mkdir(dirname(path), { recursive: true, mode: 0o700 });
74
+ await writeFile(path, `${JSON.stringify(running)}\n`);
75
+ }
76
+ /** None when no trierarch wrote it (one before 0.18.0 did not) or it does not fit. */
77
+ export async function readRunningFile(path) {
78
+ try {
79
+ const parsed = runningFileSchema.safeParse(JSON.parse(await readFile(path, 'utf8')));
80
+ return parsed.success ? parsed.data : undefined;
81
+ }
82
+ catch {
83
+ return undefined;
84
+ }
85
+ }
70
86
  //# sourceMappingURL=files.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/adapters/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAA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,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAErF,oIAAoI;AACpI,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAY,EAAE,OAAoB;IACvE,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7D,MAAM,SAAS,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACxD,CAAC;AAED,sFAAsF;AACtF,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAY;IAChD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QACrF,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAClD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { TrierarchAdapterFlag, TrierarchConfiguration } from '@aeolus-fleet/common';
2
+ import type { HarnessPort } from '../core/ports.js';
3
+ import type { CommandPart } from './command-line.js';
4
+ import type { AeolusPlugin } from './plugin-identity.js';
5
+ import type { Tmux } from './tmux.js';
6
+ /** The flags each configured harness's adapter adds itself, for describe. */
7
+ export declare function adapterFlagsOf(configuration: TrierarchConfiguration): Record<string, readonly TrierarchAdapterFlag[]>;
8
+ /** What a harness launches with the given flags, on a first start and a restart, for config check; undefined without an adapter. */
9
+ export declare function commandLinesOf(harness: string, flags: readonly string[]): {
10
+ firstStart: CommandPart[];
11
+ restart: CommandPart[];
12
+ } | undefined;
13
+ /**
14
+ * The adapters of the harnesses the configuration offers, by name, each with
15
+ * the aeolus plugin its harness installed. A plugin is looked for only for a
16
+ * harness on offer, so a machine without Codex needs no Codex plugin. A
17
+ * configured harness this trierarch has no adapter for is refused at start,
18
+ * so no want for it is ever taken.
19
+ */
20
+ export declare function createHarnesses(at: {
21
+ configuration: TrierarchConfiguration;
22
+ homeDirectory: string;
23
+ env: Readonly<Record<string, string | undefined>>;
24
+ sessions: Pick<Tmux, 'start' | 'type'>;
25
+ }): Promise<{
26
+ harnesses: Record<string, HarnessPort>;
27
+ plugins: Record<string, AeolusPlugin>;
28
+ }>;