@aeolus-fleet/trierarch 0.22.0 → 0.23.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 +3 -3
- package/dist/adapters/capped-log.d.ts +23 -0
- package/dist/adapters/capped-log.js +74 -0
- package/dist/adapters/capped-log.js.map +1 -0
- package/dist/adapters/codex-plugin-data.d.ts +11 -0
- package/dist/adapters/codex-plugin-data.js +44 -0
- package/dist/adapters/codex-plugin-data.js.map +1 -0
- package/dist/adapters/json-state.js +1 -0
- package/dist/adapters/json-state.js.map +1 -1
- package/dist/adapters/plugin-identity.d.ts +6 -2
- package/dist/adapters/plugin-identity.js +4 -2
- package/dist/adapters/plugin-identity.js.map +1 -1
- package/dist/adapters/plugin-update.d.ts +41 -0
- package/dist/adapters/plugin-update.js +141 -0
- package/dist/adapters/plugin-update.js.map +1 -0
- package/dist/adapters/plugin.d.ts +8 -1
- package/dist/adapters/plugin.js +14 -6
- package/dist/adapters/plugin.js.map +1 -1
- package/dist/adapters/running-processes.d.ts +10 -0
- package/dist/adapters/running-processes.js +28 -0
- package/dist/adapters/running-processes.js.map +1 -0
- package/dist/cli/main.js +26 -9
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/upgrade.d.ts +28 -0
- package/dist/cli/upgrade.js +68 -3
- package/dist/cli/upgrade.js.map +1 -1
- package/dist/core/entry.d.ts +2 -0
- package/dist/core/entry.js.map +1 -1
- package/dist/core/reconciler.d.ts +10 -0
- package/dist/core/reconciler.js +22 -3
- package/dist/core/reconciler.js.map +1 -1
- package/dist/core/run-pass.js +37 -9
- package/dist/core/run-pass.js.map +1 -1
- package/package.json +11 -4
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 can change the hooks:
|
|
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: `aeolus-trierarch upgrade` trusts the new or changed ones, and the trierarch trusts them 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
|
|
|
@@ -39,12 +39,12 @@ That gives the command `aeolus-trierarch`.
|
|
|
39
39
|
| --- | --- |
|
|
40
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 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 |
|
|
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, with the log before it in `trierarch.log.1` (docs/trierarch.md says when it moves aside); 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
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
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 |
|
|
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 also updates the aeolus plugin for each harness the configuration offers to the plugin of the version it upgrades to, from that release's tag (from main for releases up to 0.22.0), even when the trierarch is on its version already, before the restart: Codex's version folders that running Codex sessions use stay beside the new one, and those none uses any more are removed, and the plugin's new or changed Codex hooks are trusted. A plugin that could not be updated is said, and upgrade exits 1. On a trierarch machine this is the only supported way to update the plugin: not `codex plugin marketplace upgrade`, nor Claude Code's own update. It never upgrades on its own |
|
|
48
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 |
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { LogStream } from './log.js';
|
|
2
|
+
/**
|
|
3
|
+
* The trierarch's log file capped, by the rule the aeolus plugin's log follows
|
|
4
|
+
* (plugins/aeolus/README.md, "The log"): before a record, a log that reached
|
|
5
|
+
* 1 MiB moves aside as `trierarch.log.1`, replacing an older one, and the
|
|
6
|
+
* record starts a new log. On macOS launchd writes the log: it opened the file
|
|
7
|
+
* for appending as the trierarch's stdout and stderr and keeps it open, so a
|
|
8
|
+
* renamed log would take its writes along. The log moves aside as a copy, and
|
|
9
|
+
* the file launchd holds is emptied: appending, its next write starts the new
|
|
10
|
+
* log. The records are written synchronously, so none falls between the copy
|
|
11
|
+
* and the emptying. On Linux the journal caps the log itself.
|
|
12
|
+
*/
|
|
13
|
+
/** The log's size limit in bytes: the trierarch keeps at most about twice it. */
|
|
14
|
+
export declare const LOG_MAX_BYTES: number;
|
|
15
|
+
/** A stream that writes each record to the log through `stream`, moving the log aside first once it is full. A log it cannot move aside is written on. */
|
|
16
|
+
export declare function cappedLogStream(at: {
|
|
17
|
+
file: string;
|
|
18
|
+
stream: LogStream;
|
|
19
|
+
now: () => Date;
|
|
20
|
+
maxBytes?: number;
|
|
21
|
+
}): LogStream;
|
|
22
|
+
/** Whether a file descriptor is open on the log file, as the trierarch's stdout is under launchd. */
|
|
23
|
+
export declare function isWritingTo(descriptor: number, file: string): boolean;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { copyFileSync, fstatSync, mkdirSync, rmdirSync, statSync, truncateSync } from 'node:fs';
|
|
2
|
+
/**
|
|
3
|
+
* The trierarch's log file capped, by the rule the aeolus plugin's log follows
|
|
4
|
+
* (plugins/aeolus/README.md, "The log"): before a record, a log that reached
|
|
5
|
+
* 1 MiB moves aside as `trierarch.log.1`, replacing an older one, and the
|
|
6
|
+
* record starts a new log. On macOS launchd writes the log: it opened the file
|
|
7
|
+
* for appending as the trierarch's stdout and stderr and keeps it open, so a
|
|
8
|
+
* renamed log would take its writes along. The log moves aside as a copy, and
|
|
9
|
+
* the file launchd holds is emptied: appending, its next write starts the new
|
|
10
|
+
* log. The records are written synchronously, so none falls between the copy
|
|
11
|
+
* and the emptying. On Linux the journal caps the log itself.
|
|
12
|
+
*/
|
|
13
|
+
/** The log's size limit in bytes: the trierarch keeps at most about twice it. */
|
|
14
|
+
export const LOG_MAX_BYTES = 1024 * 1024;
|
|
15
|
+
/** A lock older than this was left by a writer stopped while moving the log aside. */
|
|
16
|
+
const STALE_LOCK_MS = 60 * 1000;
|
|
17
|
+
const sizeOf = (file) => statSync(file, { throwIfNoEntry: false })?.size ?? 0;
|
|
18
|
+
/**
|
|
19
|
+
* Moves the log aside once it reached its limit. One writer moves it: another
|
|
20
|
+
* finding the lock taken appends on, and the one holding the lock looks at the
|
|
21
|
+
* size again, so a log just moved aside by another is not moved twice.
|
|
22
|
+
*/
|
|
23
|
+
function moveAsideWhenFull(at) {
|
|
24
|
+
const { file, maxBytes, now } = at;
|
|
25
|
+
if (sizeOf(file) < maxBytes) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const lock = `${file}.lock`;
|
|
29
|
+
const taken = statSync(lock, { throwIfNoEntry: false });
|
|
30
|
+
if (taken !== undefined && now().getTime() - taken.mtimeMs > STALE_LOCK_MS) {
|
|
31
|
+
rmdirSync(lock);
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
mkdirSync(lock);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
if (sizeOf(file) >= maxBytes) {
|
|
41
|
+
copyFileSync(file, `${file}.1`);
|
|
42
|
+
truncateSync(file, 0);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
rmdirSync(lock);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** A stream that writes each record to the log through `stream`, moving the log aside first once it is full. A log it cannot move aside is written on. */
|
|
50
|
+
export function cappedLogStream(at) {
|
|
51
|
+
const { file, stream, now, maxBytes = LOG_MAX_BYTES } = at;
|
|
52
|
+
return {
|
|
53
|
+
isTerminal: stream.isTerminal,
|
|
54
|
+
write: (text) => {
|
|
55
|
+
try {
|
|
56
|
+
moveAsideWhenFull({ file, maxBytes, now });
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// A full disk or a changed permission must not stop the trierarch: the record is written all the same.
|
|
60
|
+
}
|
|
61
|
+
stream.write(text);
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/** Whether a file descriptor is open on the log file, as the trierarch's stdout is under launchd. */
|
|
66
|
+
export function isWritingTo(descriptor, file) {
|
|
67
|
+
const log = statSync(file, { throwIfNoEntry: false });
|
|
68
|
+
if (log === undefined) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
const open = fstatSync(descriptor);
|
|
72
|
+
return open.dev === log.dev && open.ino === log.ino;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=capped-log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capped-log.js","sourceRoot":"","sources":["../../src/adapters/capped-log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIhG;;;;;;;;;;GAUG;AAEH,iFAAiF;AACjF,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,CAAC;AAEzC,sFAAsF;AACtF,MAAM,aAAa,GAAG,EAAE,GAAG,IAAI,CAAC;AAEhC,MAAM,MAAM,GAAG,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CAAC,IAAI,EAAE,EAAE;YACd,IAAI,CAAC;gBACH,iBAAiB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;YAC7C,CAAC;YAAC,MAAM,CAAC;gBACP,uGAAuG;YACzG,CAAC;YACD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,qGAAqG;AACrG,MAAM,UAAU,WAAW,CAAC,UAAkB,EAAE,IAAY;IAC1D,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;IACtD,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,IAAI,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IACnC,OAAO,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether Codex keeps the aeolus plugin's data folder, which holds its log
|
|
3
|
+
* and the crew identities not yet moved to ~/.aeolus/crews (decision 0015),
|
|
4
|
+
* when its aeolus-fleet marketplace is removed (#660).
|
|
5
|
+
* Trierarch upgrade removes that marketplace to point it elsewhere, so it asks
|
|
6
|
+
* first: the Codex given installs an aeolus plugin of its own from a local
|
|
7
|
+
* aeolus-fleet marketplace in a throwaway CODEX_HOME, a mark goes in the
|
|
8
|
+
* plugin's data folder, and the marketplace is removed. The real Codex home
|
|
9
|
+
* is never touched. Throws, saying what Codex said, when Codex cannot run it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function codexKeepsPluginData(codex: string): Promise<boolean>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { tmpdir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { PLUGIN_DATA_FOLDER } from './plugin.js';
|
|
5
|
+
import { runCommand } from './run-command.js';
|
|
6
|
+
/**
|
|
7
|
+
* Whether Codex keeps the aeolus plugin's data folder, which holds its log
|
|
8
|
+
* and the crew identities not yet moved to ~/.aeolus/crews (decision 0015),
|
|
9
|
+
* when its aeolus-fleet marketplace is removed (#660).
|
|
10
|
+
* Trierarch upgrade removes that marketplace to point it elsewhere, so it asks
|
|
11
|
+
* first: the Codex given installs an aeolus plugin of its own from a local
|
|
12
|
+
* aeolus-fleet marketplace in a throwaway CODEX_HOME, a mark goes in the
|
|
13
|
+
* plugin's data folder, and the marketplace is removed. The real Codex home
|
|
14
|
+
* is never touched. Throws, saying what Codex said, when Codex cannot run it.
|
|
15
|
+
*/
|
|
16
|
+
export async function codexKeepsPluginData(codex) {
|
|
17
|
+
const folder = await mkdtemp(join(tmpdir(), 'aeolus-codex-plugin-data-'));
|
|
18
|
+
try {
|
|
19
|
+
const marketplace = join(folder, 'marketplace');
|
|
20
|
+
const codexHome = join(folder, 'codex-home');
|
|
21
|
+
await mkdir(join(marketplace, '.agents', 'plugins'), { recursive: true });
|
|
22
|
+
await mkdir(join(marketplace, 'plugins', 'aeolus', '.codex-plugin'), { recursive: true });
|
|
23
|
+
await mkdir(codexHome);
|
|
24
|
+
await writeFile(join(marketplace, '.agents', 'plugins', 'marketplace.json'), JSON.stringify({ name: 'aeolus-fleet', plugins: [{ name: 'aeolus', source: { source: 'local', path: './plugins/aeolus' }, policy: { installation: 'AVAILABLE', authentication: 'ON_INSTALL' } }] }));
|
|
25
|
+
await writeFile(join(marketplace, 'plugins', 'aeolus', '.codex-plugin', 'plugin.json'), JSON.stringify({ name: 'aeolus', version: '0.0.0', description: 'The aeolus plugin data proof of aeolus-trierarch.' }));
|
|
26
|
+
const run = async (args) => {
|
|
27
|
+
const result = await runCommand(codex, { args, env: { CODEX_HOME: codexHome } });
|
|
28
|
+
if (result.status !== 0) {
|
|
29
|
+
throw new Error(`codex ${args.join(' ')} failed: ${`${result.stdout}${result.stderr}`.trim()}`);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
await run(['plugin', 'marketplace', 'add', marketplace]);
|
|
33
|
+
await run(['plugin', 'add', 'aeolus@aeolus-fleet']);
|
|
34
|
+
const data = join(codexHome, 'plugins', 'data', PLUGIN_DATA_FOLDER);
|
|
35
|
+
await mkdir(data, { recursive: true });
|
|
36
|
+
await writeFile(join(data, 'mark'), 'kept\n');
|
|
37
|
+
await run(['plugin', 'marketplace', 'remove', 'aeolus-fleet']);
|
|
38
|
+
return (await readFile(join(data, 'mark'), 'utf8').catch(() => undefined)) === 'kept\n';
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
await rm(folder, { recursive: true, force: true });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=codex-plugin-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-plugin-data.js","sourceRoot":"","sources":["../../src/adapters/codex-plugin-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,KAAa;IACtD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,2BAA2B,CAAC,CAAC,CAAC;IAC1E,IAAI,CAAC;QACH,MAAM,WAAW,GAA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AAK,CAAC,EAAE,CAAC;gBACxB,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAClG,CAAC;QACH,CAAC,CAAC;QACF,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;QACzD,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,qBAAqB,CAAC,CAAC,CAAC;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,kBAAkB,CAAC,CAAC;QACpE,MAAM,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACvC,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC9C,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC;QAC/D,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,KAAK,QAAQ,CAAC;IAC1F,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,CAAC;AACH,CAAC"}
|
|
@@ -31,6 +31,7 @@ const stateSchema = z.object({
|
|
|
31
31
|
hasStarted: z.boolean(),
|
|
32
32
|
launchedAt: z.string().optional(),
|
|
33
33
|
isReleasedElsewhere: z.literal(true).optional(),
|
|
34
|
+
isIdentityGone: z.literal(true).optional(),
|
|
34
35
|
wake: z.object({ waiting: z.int().nonnegative(), isPending: z.boolean() }),
|
|
35
36
|
})),
|
|
36
37
|
kept: z.array(z.object({ shipId: idSchema('ship'), repository: z.string(), path: z.string() })),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-state.js","sourceRoot":"","sources":["../../src/adapters/json-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAuB,MAAM,kBAAkB,CAAC;AAGlF;;;;;;;GAOG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,cAAc,GAAG,iBAAiB,CAAC;AAEhD,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,CACf,CAAC,CAAC,MAAM,EAAE,EACV,CAAC,CAAC,MAAM,CAAC;QACP,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC;QACxB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC/B,eAAe,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;QACnC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,SAAS,EAAE,wBAAwB;QACnC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC/B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAClC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,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AAS,CAAC,IAAI,CAAC,CAAC;YAC3C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACpB,gHAAgH;gBAChH,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,iKAAiK,CACzK,CAAC;YACJ,CAAC;YACD,OAAO,MAAM,CAAC,IAAI,CAAC;QACrB,CAAC;QACD,IAAI,EAAE,KAAK,EAAE,KAAqB,EAAE,EAAE;YACpC,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAChD,MAAM,SAAS,GAAG,GAAG,IAAI,MAAM,CAAC;YAChC,MAAM,SAAS,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YACnF,MAAM,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAChC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { HarnessPort } from '../core/ports.js';
|
|
2
|
-
/** The aeolus plugin as a harness installed it: its scripts and its
|
|
2
|
+
/** The aeolus plugin as a harness installed it: its scripts, its data folder, and where its sessions' identities live. */
|
|
3
3
|
export interface AeolusPlugin {
|
|
4
4
|
readonly root: string;
|
|
5
5
|
readonly data: string;
|
|
6
|
+
/** ~/.aeolus/crews/<harness> (#658). */
|
|
7
|
+
readonly crews: string;
|
|
6
8
|
}
|
|
7
9
|
/**
|
|
8
10
|
* A session's identity and turn, through the aeolus plugin's own
|
|
9
11
|
* `aeolus-identity.sh`, never a copy of how the plugin names its files. The
|
|
10
|
-
* same for every harness; each keeps them in
|
|
12
|
+
* same for every harness; each keeps them in a crews folder of its own. The
|
|
13
|
+
* data folder goes along, so the script moves an identity an older plugin
|
|
14
|
+
* kept there.
|
|
11
15
|
*/
|
|
12
16
|
export declare function createPluginIdentity(plugin: AeolusPlugin): Pick<HarnessPort, 'prepareIdentity' | 'crewTokenOf' | 'removeIdentity' | 'turnOf'>;
|
|
@@ -3,10 +3,12 @@ import { runCommand } from './run-command.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* A session's identity and turn, through the aeolus plugin's own
|
|
5
5
|
* `aeolus-identity.sh`, never a copy of how the plugin names its files. The
|
|
6
|
-
* same for every harness; each keeps them in
|
|
6
|
+
* same for every harness; each keeps them in a crews folder of its own. The
|
|
7
|
+
* data folder goes along, so the script moves an identity an older plugin
|
|
8
|
+
* kept there.
|
|
7
9
|
*/
|
|
8
10
|
export function createPluginIdentity(plugin) {
|
|
9
|
-
const identity = async (folder, args) => runCommand('bash', { args: [`${plugin.root}/scripts/aeolus-identity.sh`, ...args], env: { AEOLUS_FOLDER: folder, AEOLUS_DATA: plugin.data } });
|
|
11
|
+
const identity = async (folder, args) => runCommand('bash', { args: [`${plugin.root}/scripts/aeolus-identity.sh`, ...args], env: { AEOLUS_FOLDER: folder, AEOLUS_DATA: plugin.data, AEOLUS_CREWS: plugin.crews } });
|
|
10
12
|
return {
|
|
11
13
|
prepareIdentity: async ({ folder, identity: crew }) => {
|
|
12
14
|
const written = await identity(folder, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-identity.js","sourceRoot":"","sources":["../../src/adapters/plugin-identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin-identity.js","sourceRoot":"","sources":["../../src/adapters/plugin-identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAU9C;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAoB;IACvD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,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7C,CAAC;QACD,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YAC/B,MAAM,QAAQ,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrC,CAAC;QACD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAiB,EAAE;YACtC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;YAC9C,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACvC,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QACzF,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type PluginHarness } from './plugin.js';
|
|
2
|
+
import { type RunningProcess } from './running-processes.js';
|
|
3
|
+
/**
|
|
4
|
+
* The aeolus plugin updated through each harness's own command (#581), from
|
|
5
|
+
* the release tag it is given, or main without one (#652): each harness's
|
|
6
|
+
* aeolus-fleet marketplace is pointed at it first. Neither harness adds a
|
|
7
|
+
* second source for a marketplace. Codex's is removed and added again, which
|
|
8
|
+
* keeps the plugin and its cache, once a throwaway Codex home proves this
|
|
9
|
+
* Codex keeps the plugin's data, its log and the crew identities not yet
|
|
10
|
+
* moved to ~/.aeolus/crews, when it is removed (#660); the upgrade changes
|
|
11
|
+
* nothing otherwise. Claude Code's is never removed, since that uninstalls the
|
|
12
|
+
* plugin and deletes its data, with its log and those identities: the
|
|
13
|
+
* marketplace its settings declare is dropped from them, and adding it again
|
|
14
|
+
* declares the new source.
|
|
15
|
+
* Codex's plugin upgrade installs the new version and deletes every other
|
|
16
|
+
* version folder, so a Codex session still running on the old version would
|
|
17
|
+
* lose its plugin scripts: the version folders there before are kept aside and
|
|
18
|
+
* put back beside the new one, also when the upgrade fails. After an upgrade
|
|
19
|
+
* that succeeded, a version folder no running session can use is removed
|
|
20
|
+
* (#653): a session uses the newest version there was when it started, so a
|
|
21
|
+
* version is left behind once its next version came before every running
|
|
22
|
+
* Codex process, and the trierarch, started. A version counts from when the
|
|
23
|
+
* upgrade installed it. Claude Code keeps old versions beside the new one
|
|
24
|
+
* itself.
|
|
25
|
+
*/
|
|
26
|
+
export interface PluginUpdate {
|
|
27
|
+
/** `tag`: the release tag to install the plugin from; none installs it from main. */
|
|
28
|
+
update(harness: PluginHarness, tag: string | undefined): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
export declare function createPluginUpdate(at: {
|
|
31
|
+
homeDirectory: string;
|
|
32
|
+
env: Readonly<Record<string, string | undefined>>;
|
|
33
|
+
/** The programs to run; `codex` and `claude` unless a test runs others. */
|
|
34
|
+
commands?: Partial<Record<PluginHarness, string>>;
|
|
35
|
+
/** The clock; a test passes its own. */
|
|
36
|
+
now?: () => Date;
|
|
37
|
+
/** The processes running on this machine now; ps unless a test says them. */
|
|
38
|
+
processes?: (now: Date) => Promise<readonly RunningProcess[]>;
|
|
39
|
+
/** The running trierarch's pid, none when none runs: it took its plugin scripts from the newest version when it started. */
|
|
40
|
+
trierarchPid: () => Promise<number | undefined>;
|
|
41
|
+
}): PluginUpdate;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { cp, mkdtemp, readdir, readFile, rename, rm, stat, utimes, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { tmpdir } from 'node:os';
|
|
3
|
+
import { basename, join } from 'node:path';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { codexKeepsPluginData } from './codex-plugin-data.js';
|
|
6
|
+
import { byVersion } from './plugin.js';
|
|
7
|
+
import { runCommand } from './run-command.js';
|
|
8
|
+
import { runningProcesses } from './running-processes.js';
|
|
9
|
+
const MARKETPLACE = 'aeolus-fleet';
|
|
10
|
+
const REPOSITORY = 'ThomasHendrickx/aeolus-fleet';
|
|
11
|
+
const PLUGIN = 'aeolus@aeolus-fleet';
|
|
12
|
+
async function run(command, args) {
|
|
13
|
+
const result = await runCommand(command, { args });
|
|
14
|
+
if (result.status !== 0) {
|
|
15
|
+
throw new Error(`${[command, ...args].join(' ')} failed: ${`${result.stdout}${result.stderr}`.trim()}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const settingsSchema = z.record(z.string(), z.unknown());
|
|
19
|
+
const marketplacesSchema = z.record(z.string(), z.unknown());
|
|
20
|
+
/** Drops the aeolus-fleet marketplace from the `extraKnownMarketplaces` of Claude Code's settings, leaving everything else as it is. */
|
|
21
|
+
async function dropDeclaredMarketplace(path) {
|
|
22
|
+
const text = await readFile(path, 'utf8').catch(() => undefined);
|
|
23
|
+
if (text === undefined) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const settings = settingsSchema.parse(JSON.parse(text));
|
|
27
|
+
const declared = marketplacesSchema.safeParse(settings.extraKnownMarketplaces).data;
|
|
28
|
+
if (declared?.[MARKETPLACE] === undefined) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const others = Object.fromEntries(Object.entries(declared).filter(([name]) => name !== MARKETPLACE));
|
|
32
|
+
const temporary = `${path}.aeolus-trierarch.tmp`;
|
|
33
|
+
await writeFile(temporary, `${JSON.stringify({ ...settings, extraKnownMarketplaces: others }, null, 2)}\n`, { mode: (await stat(path)).mode & 0o777 });
|
|
34
|
+
await rename(temporary, path);
|
|
35
|
+
}
|
|
36
|
+
/** The folders under `cache`, none where it does not exist. */
|
|
37
|
+
async function versionFolders(cache) {
|
|
38
|
+
const names = await readdir(cache).catch(() => []);
|
|
39
|
+
const folders = [];
|
|
40
|
+
for (const name of names) {
|
|
41
|
+
if ((await stat(join(cache, name))).isDirectory()) {
|
|
42
|
+
folders.push(name);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return folders;
|
|
46
|
+
}
|
|
47
|
+
/** ps says elapsed time in whole seconds, and a session takes a moment to read its plugin: a start this close after a version came may still have found the one before. */
|
|
48
|
+
const START_MARGIN_MS = 60 * 1000;
|
|
49
|
+
const VERSION = /^\d+\.\d+\.\d+$/;
|
|
50
|
+
/** Marks each version folder the upgrade installed with the time it did, whatever times Codex gave its files. */
|
|
51
|
+
async function markInstalled(cache, at) {
|
|
52
|
+
for (const version of await versionFolders(cache)) {
|
|
53
|
+
if (!at.before.includes(version)) {
|
|
54
|
+
await utimes(join(cache, version), at.now, at.now);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** Removes each version folder whose next version came before the earliest start, every older one when nothing runs. */
|
|
59
|
+
async function removeUnused(cache, earliestStart) {
|
|
60
|
+
const versions = (await versionFolders(cache)).filter((name) => VERSION.test(name)).sort(byVersion);
|
|
61
|
+
for (const [index, version] of versions.entries()) {
|
|
62
|
+
const next = versions[index + 1];
|
|
63
|
+
if (next === undefined) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const nextCame = (await stat(join(cache, next))).mtime.getTime();
|
|
67
|
+
if (earliestStart === undefined || earliestStart.getTime() >= nextCame + START_MARGIN_MS) {
|
|
68
|
+
await rm(join(cache, version), { recursive: true, force: true });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** The earliest start of a process that may use a Codex plugin version: a Codex one, or the trierarch. */
|
|
73
|
+
function earliestStartOf(processes, trierarchPid) {
|
|
74
|
+
const users = processes.filter((process) => basename(process.program) === 'codex' || process.pid === trierarchPid);
|
|
75
|
+
return users.map((process) => process.startedAt).reduce((earliest, startedAt) => (earliest === undefined || startedAt < earliest ? startedAt : earliest), undefined);
|
|
76
|
+
}
|
|
77
|
+
/** Runs `upgrade` with every version folder in `cache` kept aside, and puts back each one it deleted; then removes the unused ones. */
|
|
78
|
+
async function keepingVersions(cache, at) {
|
|
79
|
+
const versions = await versionFolders(cache);
|
|
80
|
+
const times = new Map(await Promise.all(versions.map(async (version) => [version, await stat(join(cache, version))])));
|
|
81
|
+
const aside = await mkdtemp(join(tmpdir(), 'aeolus-plugin-versions-'));
|
|
82
|
+
try {
|
|
83
|
+
for (const version of versions) {
|
|
84
|
+
await cp(join(cache, version), join(aside, version), { recursive: true, preserveTimestamps: true });
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
await at.upgrade();
|
|
88
|
+
}
|
|
89
|
+
finally {
|
|
90
|
+
const left = new Set(await versionFolders(cache));
|
|
91
|
+
for (const version of versions.filter((name) => !left.has(name))) {
|
|
92
|
+
await cp(join(aside, version), join(cache, version), { recursive: true, preserveTimestamps: true });
|
|
93
|
+
// cp keeps the times of files, not of folders: the folder's time says when its version came.
|
|
94
|
+
const time = times.get(version);
|
|
95
|
+
if (time !== undefined) {
|
|
96
|
+
await utimes(join(cache, version), time.atime, time.mtime);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
await at.afterUpgrade(versions);
|
|
101
|
+
}
|
|
102
|
+
finally {
|
|
103
|
+
await rm(aside, { recursive: true, force: true });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export function createPluginUpdate(at) {
|
|
107
|
+
const now = at.now ?? (() => new Date());
|
|
108
|
+
const processes = at.processes ?? runningProcesses;
|
|
109
|
+
const codex = at.commands?.codex ?? 'codex';
|
|
110
|
+
const claude = at.commands?.['claude-code'] ?? 'claude';
|
|
111
|
+
const claudeSettings = join(at.env.CLAUDE_CONFIG_DIR ?? join(at.homeDirectory, '.claude'), 'settings.json');
|
|
112
|
+
const codexCache = join(at.env.CODEX_HOME ?? join(at.homeDirectory, '.codex'), 'plugins', 'cache', MARKETPLACE, 'aeolus');
|
|
113
|
+
return {
|
|
114
|
+
update: async (harness, tag) => {
|
|
115
|
+
if (harness === 'codex') {
|
|
116
|
+
if (!(await codexKeepsPluginData(codex))) {
|
|
117
|
+
throw new Error(`Codex would delete the aeolus plugin's data on this machine, its log and the crew identities not yet moved to ~/.aeolus/crews, when its ${MARKETPLACE} marketplace is removed: the upgrade leaves the marketplace as it is`);
|
|
118
|
+
}
|
|
119
|
+
await keepingVersions(codexCache, {
|
|
120
|
+
upgrade: async () => {
|
|
121
|
+
// There may be no marketplace to remove: adding it says what is wrong.
|
|
122
|
+
await runCommand(codex, { args: ['plugin', 'marketplace', 'remove', MARKETPLACE] });
|
|
123
|
+
await run(codex, ['plugin', 'marketplace', 'add', REPOSITORY, ...(tag === undefined ? [] : ['--ref', tag])]);
|
|
124
|
+
await run(codex, ['plugin', 'marketplace', 'upgrade', MARKETPLACE]);
|
|
125
|
+
},
|
|
126
|
+
afterUpgrade: async (before) => {
|
|
127
|
+
const upgradedAt = now();
|
|
128
|
+
await markInstalled(codexCache, { before, now: upgradedAt });
|
|
129
|
+
await removeUnused(codexCache, earliestStartOf(await processes(upgradedAt), await at.trierarchPid()));
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
await dropDeclaredMarketplace(claudeSettings);
|
|
135
|
+
await run(claude, ['plugin', 'marketplace', 'add', tag === undefined ? REPOSITORY : `${REPOSITORY}#${tag}`]);
|
|
136
|
+
await run(claude, ['plugin', 'marketplace', 'update', MARKETPLACE]);
|
|
137
|
+
await run(claude, ['plugin', 'update', PLUGIN]);
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=plugin-update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-update.js","sourceRoot":"","sources":["../../src/adapters/plugin-update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB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
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import type { AeolusPlugin } from './plugin-identity.js';
|
|
2
2
|
/** The harnesses that install the aeolus plugin, each in its own plugin folders. */
|
|
3
3
|
export type PluginHarness = 'claude-code' | 'codex';
|
|
4
|
+
export declare const PLUGIN_HARNESSES: readonly PluginHarness[];
|
|
5
|
+
/** The aeolus plugin's data folder in a harness's plugin folders, as both harnesses name it. */
|
|
6
|
+
export declare const PLUGIN_DATA_FOLDER = "aeolus-aeolus-fleet";
|
|
4
7
|
/**
|
|
5
8
|
* Where a harness installed the aeolus plugin: the newest version in its
|
|
6
9
|
* plugin cache and the plugin's data folder, unless variables name others
|
|
7
10
|
* (AEOLUS_PLUGIN_ROOT and AEOLUS_PLUGIN_DATA for Claude Code,
|
|
8
11
|
* AEOLUS_CODEX_PLUGIN_ROOT and AEOLUS_CODEX_PLUGIN_DATA for Codex). The
|
|
9
|
-
* folders follow CLAUDE_CONFIG_DIR and CODEX_HOME as the harnesses do.
|
|
12
|
+
* folders follow CLAUDE_CONFIG_DIR and CODEX_HOME as the harnesses do. The
|
|
13
|
+
* identities of the harness's sessions live in ~/.aeolus/crews/<harness>, as
|
|
14
|
+
* the plugin keeps them (decision 0015).
|
|
10
15
|
*/
|
|
11
16
|
export declare function findAeolusPlugin(at: {
|
|
12
17
|
homeDirectory: string;
|
|
@@ -23,3 +28,5 @@ export declare function aeolusPluginVersion(at: {
|
|
|
23
28
|
env: Readonly<Record<string, string | undefined>>;
|
|
24
29
|
harness: string;
|
|
25
30
|
}): Promise<string | undefined>;
|
|
31
|
+
/** Orders versions such as 0.9.0 and 0.10.0 by their numbers. */
|
|
32
|
+
export declare function byVersion(left: string, right: string): number;
|
package/dist/adapters/plugin.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { readdir, readFile } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
+
export const PLUGIN_HARNESSES = ['claude-code', 'codex'];
|
|
5
|
+
/** The aeolus plugin's data folder in a harness's plugin folders, as both harnesses name it. */
|
|
6
|
+
export const PLUGIN_DATA_FOLDER = 'aeolus-aeolus-fleet';
|
|
4
7
|
/** Where each harness keeps its plugins, and the variables that point elsewhere. */
|
|
5
8
|
function placesOf(at) {
|
|
6
9
|
const { homeDirectory, env } = at;
|
|
@@ -14,13 +17,17 @@ function placesOf(at) {
|
|
|
14
17
|
* plugin cache and the plugin's data folder, unless variables name others
|
|
15
18
|
* (AEOLUS_PLUGIN_ROOT and AEOLUS_PLUGIN_DATA for Claude Code,
|
|
16
19
|
* AEOLUS_CODEX_PLUGIN_ROOT and AEOLUS_CODEX_PLUGIN_DATA for Codex). The
|
|
17
|
-
* folders follow CLAUDE_CONFIG_DIR and CODEX_HOME as the harnesses do.
|
|
20
|
+
* folders follow CLAUDE_CONFIG_DIR and CODEX_HOME as the harnesses do. The
|
|
21
|
+
* identities of the harness's sessions live in ~/.aeolus/crews/<harness>, as
|
|
22
|
+
* the plugin keeps them (decision 0015).
|
|
18
23
|
*/
|
|
19
24
|
export async function findAeolusPlugin(at) {
|
|
20
|
-
const
|
|
21
|
-
const
|
|
25
|
+
const harness = at.harness ?? 'claude-code';
|
|
26
|
+
const places = placesOf({ ...at, harness });
|
|
27
|
+
const data = places.data ?? join(places.plugins, 'data', PLUGIN_DATA_FOLDER);
|
|
28
|
+
const crews = join(at.homeDirectory, '.aeolus', 'crews', harness);
|
|
22
29
|
if (places.root !== undefined) {
|
|
23
|
-
return { root: places.root, data };
|
|
30
|
+
return { root: places.root, data, crews };
|
|
24
31
|
}
|
|
25
32
|
const cache = join(places.plugins, 'cache', 'aeolus-fleet', 'aeolus');
|
|
26
33
|
const versions = (await readdir(cache).catch(() => [])).filter((name) => /^\d+\.\d+\.\d+$/.test(name)).sort(byVersion);
|
|
@@ -28,7 +35,7 @@ export async function findAeolusPlugin(at) {
|
|
|
28
35
|
if (newest === undefined) {
|
|
29
36
|
throw new Error(`The aeolus plugin is not installed for ${places.name} (nothing in ${cache}): install it, or set ${places.rootVariable}`);
|
|
30
37
|
}
|
|
31
|
-
return { root: join(cache, newest), data };
|
|
38
|
+
return { root: join(cache, newest), data, crews };
|
|
32
39
|
}
|
|
33
40
|
/** The part of a plugin's manifest the version is read from. */
|
|
34
41
|
const manifestSchema = z.object({ version: z.string() });
|
|
@@ -59,7 +66,8 @@ export async function aeolusPluginVersion(at) {
|
|
|
59
66
|
return undefined;
|
|
60
67
|
}
|
|
61
68
|
}
|
|
62
|
-
|
|
69
|
+
/** Orders versions such as 0.9.0 and 0.10.0 by their numbers. */
|
|
70
|
+
export function byVersion(left, right) {
|
|
63
71
|
const [a, b] = [left, right].map((version) => version.split('.').map(Number));
|
|
64
72
|
for (let index = 0; index < 3; index += 1) {
|
|
65
73
|
const difference = (a?.[index] ?? 0) - (b?.[index] ?? 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/adapters/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,oFAAoF;AACpF,SAAS,QAAQ,CAAC,EAAwG;IACxH,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IAClC,IAAI,EAAE,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAC3B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,EAAE,SAAS,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,wBAAwB,EAAE,IAAI,EAAE,GAAG,CAAC,wBAAwB,EAAE,YAAY,EAAE,0BAA0B,EAAE,CAAC;IACxN,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CAAC,CAAC,CAAC;QAC1D,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1D,CAAC;IAAC,MAAM,CAAC;QACP,8CAA8C;QAC9C,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9E,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC1C,MAAM,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACzD,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,UAAU,CAAC;QACpB,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** A process running on this machine: its pid, its program and when it started. */
|
|
2
|
+
export interface RunningProcess {
|
|
3
|
+
readonly pid: number;
|
|
4
|
+
readonly program: string;
|
|
5
|
+
readonly startedAt: Date;
|
|
6
|
+
}
|
|
7
|
+
/** The processes `ps -A -o pid=,etime=,comm=` says, each started its elapsed time before `now`. */
|
|
8
|
+
export declare function processesOf(text: string, now: Date): RunningProcess[];
|
|
9
|
+
/** Every process running on this machine now, as macOS and Linux ps both say them. */
|
|
10
|
+
export declare function runningProcesses(now: Date): Promise<RunningProcess[]>;
|