@aeolus-fleet/trierarch 0.17.3 → 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.
- package/README.md +8 -6
- package/dist/adapters/claude-code.d.ts +11 -1
- package/dist/adapters/claude-code.js +32 -10
- package/dist/adapters/claude-code.js.map +1 -1
- package/dist/adapters/codex.d.ts +10 -1
- package/dist/adapters/codex.js +15 -4
- package/dist/adapters/codex.js.map +1 -1
- package/dist/adapters/command-line.d.ts +15 -0
- package/dist/adapters/command-line.js +17 -0
- package/dist/adapters/command-line.js.map +1 -0
- package/dist/adapters/files.d.ts +9 -0
- package/dist/adapters/files.js +16 -0
- package/dist/adapters/files.js.map +1 -1
- package/dist/adapters/harnesses.d.ts +9 -1
- package/dist/adapters/harnesses.js +25 -2
- package/dist/adapters/harnesses.js.map +1 -1
- package/dist/adapters/log.d.ts +39 -0
- package/dist/adapters/log.js +65 -0
- package/dist/adapters/log.js.map +1 -0
- package/dist/adapters/paths.d.ts +1 -0
- package/dist/adapters/paths.js +1 -0
- package/dist/adapters/paths.js.map +1 -1
- package/dist/adapters/rest-fleet.js +18 -5
- package/dist/adapters/rest-fleet.js.map +1 -1
- package/dist/adapters/service.js +17 -14
- package/dist/adapters/service.js.map +1 -1
- package/dist/adapters/style.d.ts +18 -0
- package/dist/adapters/style.js +39 -0
- package/dist/adapters/style.js.map +1 -0
- package/dist/cli/config-check.d.ts +11 -2
- package/dist/cli/config-check.js +26 -5
- package/dist/cli/config-check.js.map +1 -1
- package/dist/cli/init.js +40 -14
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/list.d.ts +3 -1
- package/dist/cli/list.js +17 -7
- package/dist/cli/list.js.map +1 -1
- package/dist/cli/main.js +31 -14
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/prompter.d.ts +4 -0
- package/dist/cli/prompter.js +18 -3
- package/dist/cli/prompter.js.map +1 -1
- package/dist/cli/run.d.ts +1 -1
- package/dist/cli/run.js +4 -3
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/status.d.ts +11 -3
- package/dist/cli/status.js +41 -16
- package/dist/cli/status.js.map +1 -1
- package/dist/core/answers.js +7 -2
- package/dist/core/answers.js.map +1 -1
- package/dist/core/ports.d.ts +16 -2
- package/dist/core/run-pass.d.ts +3 -0
- package/dist/core/run-pass.js +36 -1
- package/dist/core/run-pass.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -24,6 +24,7 @@ That gives the command `aeolus-trierarch`.
|
|
|
24
24
|
- whether Claude Code launches with `--dangerously-skip-permissions` and with `--remote-control` (both no unless you say yes);
|
|
25
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;
|
|
26
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;
|
|
27
28
|
- the caps: how many ships on its list, how many sessions at once.
|
|
28
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 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.
|
|
@@ -36,15 +37,16 @@ That gives the command `aeolus-trierarch`.
|
|
|
36
37
|
|
|
37
38
|
| Command | What it does |
|
|
38
39
|
| --- | --- |
|
|
39
|
-
| `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 |
|
|
40
41
|
| `aeolus-trierarch list` | The wanted entries: ship, state, harness, workspace, since, restarts |
|
|
41
|
-
| `aeolus-trierarch logs [--lines <n>] [--follow]` | The last lines of `~/.aeolus/trierarch/logs/trierarch.log`, and with `--follow` each new one |
|
|
42
|
-
| `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) |
|
|
43
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 |
|
|
44
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 |
|
|
45
|
-
| `aeolus-trierarch install [--no-load]` | Installs the service;
|
|
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 |
|
|
46
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/` |
|
|
47
48
|
| `aeolus-trierarch run` | What the service runs: keeps the wanted ships crewed until stopped |
|
|
49
|
+
| `aeolus-trierarch --version`, `-v` | The installed version |
|
|
48
50
|
|
|
49
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.
|
|
50
52
|
|
|
@@ -82,7 +84,7 @@ To stop the trierarch: `aeolus-trierarch stop`, or `aeolus-trierarch uninstall`
|
|
|
82
84
|
- **folders**: by name, used as they are, one ship per folder, never removed.
|
|
83
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.
|
|
84
86
|
|
|
85
|
-
`aeolus-trierarch init` writes caps, repositories, and Claude Code's and Codex's flags; edit the file for
|
|
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`.
|
|
86
88
|
|
|
87
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.
|
|
88
90
|
|
|
@@ -97,7 +99,7 @@ The trierarch finds the aeolus plugin in each offered harness's plugin cache (th
|
|
|
97
99
|
- the fleet over REST;
|
|
98
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>`;
|
|
99
101
|
- git worktrees and folders;
|
|
100
|
-
- Claude Code and Codex, through the aeolus plugin's `aeolus-identity.sh`. A Codex session starts with `codex <prompt>`, always with `--no-daemon`, comes back with `codex resume --last`, and is woken by typing `$aeolus-wake`;
|
|
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`;
|
|
101
103
|
- the JSON state store.
|
|
102
104
|
- **The command** (`src/cli`): `init`, `status`, `list`, `logs`, `config check`, `start`, `stop`, `restart`, `install`, `uninstall`, `run`.
|
|
103
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,6 @@
|
|
|
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';
|
|
3
4
|
import { type AeolusPlugin } from './plugin-identity.js';
|
|
4
5
|
import type { Tmux } from './tmux.js';
|
|
5
6
|
/**
|
|
@@ -10,6 +11,15 @@ import type { Tmux } from './tmux.js';
|
|
|
10
11
|
* files.
|
|
11
12
|
*/
|
|
12
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[];
|
|
13
23
|
export declare function createClaudeCodeHarness(options: {
|
|
14
24
|
configuration: TrierarchConfiguration;
|
|
15
25
|
plugin: AeolusPlugin;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { partsWithWords, wordsOf } from './command-line.js';
|
|
1
2
|
import { effectiveFlags } from './flags.js';
|
|
2
3
|
import { createPluginIdentity } from './plugin-identity.js';
|
|
3
4
|
/**
|
|
@@ -9,19 +10,36 @@ import { createPluginIdentity } from './plugin-identity.js';
|
|
|
9
10
|
*/
|
|
10
11
|
export const WAKE_PROMPT = '/aeolus:wake';
|
|
11
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' }];
|
|
12
16
|
/**
|
|
13
|
-
* The flags, with a name for the remote-control session where the
|
|
14
|
-
* gave `--remote-control` without one: `[<repository or folder>]
|
|
15
|
-
* the session is easy to find among the operator's
|
|
16
|
-
* A name the operator gave is kept; without the
|
|
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.
|
|
17
22
|
*/
|
|
18
23
|
function namedRemoteControl(flags, name) {
|
|
19
24
|
const at = flags.indexOf(REMOTE_CONTROL);
|
|
20
25
|
const next = flags[at + 1];
|
|
21
26
|
if (at === -1 || (next !== undefined && !next.startsWith('-'))) {
|
|
22
|
-
return [
|
|
27
|
+
return [{ words: flags, source: 'configuration' }];
|
|
23
28
|
}
|
|
24
|
-
return [
|
|
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
|
+
]);
|
|
25
43
|
}
|
|
26
44
|
export function createClaudeCodeHarness(options) {
|
|
27
45
|
const { configuration, plugin, sessions } = options;
|
|
@@ -33,10 +51,14 @@ export function createClaudeCodeHarness(options) {
|
|
|
33
51
|
throw new Error(`The configuration has no harness ${harness}`);
|
|
34
52
|
}
|
|
35
53
|
const prompt = isFirstStart && firstPrompt !== undefined ? firstPrompt : WAKE_PROMPT;
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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) });
|
|
40
62
|
},
|
|
41
63
|
wake: async ({ shipId }) => {
|
|
42
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":"AAGA,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,MAAM,cAAc,GAAG,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../src/adapters/claude-code.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,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAC1C,MAAM,QAAQ,GAAG,YAAY,CAAC;AAC9B,MAAM,YAAY,GAAG,IAAI,CAAC;AAE1B,MAAM,CAAC,MAAM,yBAAyB,GAAoC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;AAEhH;;;;;;GAMG;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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,EAAE,EAAE,EAAE;YAC7G,MAAM,QAAQ,GAAG,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YAClD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,MAAM,IAAI,KAAK,CAAC,oCAAoC,OAAO,EAAE,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,qBAAqB,CAAC;gBACpC,KAAK,EAAE,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC;gBACvC,WAAW,EAAE,IAAI,SAAS,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACrG,MAAM;gBACN,YAAY;gBACZ,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;aACnE,CAAC,CAAC;YACH,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,WAAW,EAAE,CAAC,CAAC;QACrD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/adapters/codex.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
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';
|
|
3
4
|
import { type AeolusPlugin } from './plugin-identity.js';
|
|
4
5
|
import type { Tmux } from './tmux.js';
|
|
5
6
|
/**
|
|
@@ -15,6 +16,14 @@ export declare const WAKE_PROMPT = "$aeolus-wake";
|
|
|
15
16
|
* right after fast typing as part of a paste, a newline, and submits nothing.
|
|
16
17
|
*/
|
|
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[];
|
|
18
27
|
export declare function createCodexHarness(options: {
|
|
19
28
|
configuration: TrierarchConfiguration;
|
|
20
29
|
plugin: AeolusPlugin;
|
package/dist/adapters/codex.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { partsWithWords, wordsOf } from './command-line.js';
|
|
1
2
|
import { effectiveFlags } from './flags.js';
|
|
2
3
|
import { createPluginIdentity } from './plugin-identity.js';
|
|
3
4
|
/**
|
|
@@ -19,6 +20,18 @@ export const CODEX_TYPING_SETTLE_MS = 1000;
|
|
|
19
20
|
* pane is gone, so a release or a crash would stop the pane but not the work.
|
|
20
21
|
*/
|
|
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
|
+
}
|
|
22
35
|
export function createCodexHarness(options) {
|
|
23
36
|
const { configuration, plugin, sessions } = options;
|
|
24
37
|
return {
|
|
@@ -29,10 +42,8 @@ export function createCodexHarness(options) {
|
|
|
29
42
|
throw new Error(`The configuration has no harness ${harness}`);
|
|
30
43
|
}
|
|
31
44
|
const prompt = isFirstStart && firstPrompt !== undefined ? firstPrompt : WAKE_PROMPT;
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
const flags = effectiveFlags(settings, picked).filter((flag) => flag !== NO_DAEMON);
|
|
35
|
-
await sessions.start({ shipId, folder, command: [...command, ...flags, NO_DAEMON] });
|
|
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) });
|
|
36
47
|
},
|
|
37
48
|
wake: async ({ shipId }) => {
|
|
38
49
|
// The space closes Codex's skill picker, which would otherwise take the Enter.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/adapters/codex.ts"],"names":[],"mappings":"AAGA,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,SAAS,GAAG,aAAa,CAAC;
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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"}
|
package/dist/adapters/files.d.ts
CHANGED
|
@@ -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>;
|
package/dist/adapters/files.js
CHANGED
|
@@ -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,kBAAkB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,4BAA4B,EAA4C,MAAM,sBAAsB,CAAC;AACxH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AAEH,2EAA2E;AAC3E,MAAM,OAAO,kBAAmB,SAAQ,KAAK;CAAG;AAEhD,4IA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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"}
|
|
@@ -1,7 +1,15 @@
|
|
|
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';
|
|
3
4
|
import type { AeolusPlugin } from './plugin-identity.js';
|
|
4
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;
|
|
5
13
|
/**
|
|
6
14
|
* The adapters of the harnesses the configuration offers, by name, each with
|
|
7
15
|
* the aeolus plugin its harness installed. A plugin is looked for only for a
|
|
@@ -1,6 +1,29 @@
|
|
|
1
|
-
import { createClaudeCodeHarness } from './claude-code.js';
|
|
2
|
-
import { createCodexHarness } from './codex.js';
|
|
1
|
+
import { CLAUDE_CODE_ADAPTER_FLAGS, claudeCodeCommandLine, createClaudeCodeHarness, WAKE_PROMPT as CLAUDE_CODE_WAKE_PROMPT } from './claude-code.js';
|
|
2
|
+
import { CODEX_ADAPTER_FLAGS, codexCommandLine, createCodexHarness, WAKE_PROMPT as CODEX_WAKE_PROMPT } from './codex.js';
|
|
3
3
|
import { findAeolusPlugin } from './plugin.js';
|
|
4
|
+
/** What a want's first prompt and a ship's session name stand for where config check shows a command line. */
|
|
5
|
+
const FIRST_PROMPT = '<first prompt>';
|
|
6
|
+
const SESSION_NAME = '[<repository or folder>] <ship>';
|
|
7
|
+
/** Per harness this trierarch has an adapter for: the flags it adds itself, and its command line for given flags. */
|
|
8
|
+
const ADAPTERS = {
|
|
9
|
+
'claude-code': {
|
|
10
|
+
adapterFlags: CLAUDE_CODE_ADAPTER_FLAGS,
|
|
11
|
+
commandLine: ({ flags, isFirstStart }) => claudeCodeCommandLine({ flags, sessionName: SESSION_NAME, prompt: isFirstStart ? FIRST_PROMPT : CLAUDE_CODE_WAKE_PROMPT, isFirstStart }),
|
|
12
|
+
},
|
|
13
|
+
codex: {
|
|
14
|
+
adapterFlags: CODEX_ADAPTER_FLAGS,
|
|
15
|
+
commandLine: ({ flags, isFirstStart }) => codexCommandLine({ flags, prompt: isFirstStart ? FIRST_PROMPT : CODEX_WAKE_PROMPT, isFirstStart }),
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
/** The flags each configured harness's adapter adds itself, for describe. */
|
|
19
|
+
export function adapterFlagsOf(configuration) {
|
|
20
|
+
return Object.fromEntries(Object.keys(configuration.harnesses).map((name) => [name, ADAPTERS[name]?.adapterFlags ?? []]));
|
|
21
|
+
}
|
|
22
|
+
/** What a harness launches with the given flags, on a first start and a restart, for config check; undefined without an adapter. */
|
|
23
|
+
export function commandLinesOf(harness, flags) {
|
|
24
|
+
const adapter = ADAPTERS[harness];
|
|
25
|
+
return adapter === undefined ? undefined : { firstStart: adapter.commandLine({ flags, isFirstStart: true }), restart: adapter.commandLine({ flags, isFirstStart: false }) };
|
|
26
|
+
}
|
|
4
27
|
/**
|
|
5
28
|
* The adapters of the harnesses the configuration offers, by name, each with
|
|
6
29
|
* the aeolus plugin its harness installed. A plugin is looked for only for a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harnesses.js","sourceRoot":"","sources":["../../src/adapters/harnesses.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"harnesses.js","sourceRoot":"","sources":["../../src/adapters/harnesses.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,WAAW,IAAI,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AACrJ,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGzH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,8GAA8G;AAC9G,MAAM,YAAY,GAAG,gBAAgB,CAAC;AACtC,MAAM,YAAY,GAAG,iCAAiC,CAAC;AAEvD,qHAAqH;AACrH,MAAM,QAAQ,GAAqL;IACjM,aAAa,EAAE;QACb,YAAY,EAAE,yBAAyB;QACvC,WAAW,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,qBAAqB,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,uBAAuB,EAAE,YAAY,EAAE,CAAC;KACnL;IACD,KAAK,EAAE;QACL,YAAY,EAAE,mBAAmB;QACjC,WAAW,EAAE,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I,IAAI,KAAK,OAAO,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CAAC,iDAAiD,IAAI,mCAAmC,CAAC,CAAC;QAC5G,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,EAAE,aAAa,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7E,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;QACvB,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC9J,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type Style } from './style.js';
|
|
3
|
+
import type { Logger } from '../core/ports.js';
|
|
4
|
+
declare const logRecordSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
5
|
+
time: z.ZodString;
|
|
6
|
+
shipId: z.ZodString;
|
|
7
|
+
shipName: z.ZodOptional<z.ZodString>;
|
|
8
|
+
action: z.ZodString;
|
|
9
|
+
outcome: z.ZodString;
|
|
10
|
+
next: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
12
|
+
time: z.ZodString;
|
|
13
|
+
level: z.ZodEnum<{
|
|
14
|
+
info: "info";
|
|
15
|
+
warn: "warn";
|
|
16
|
+
}>;
|
|
17
|
+
message: z.ZodString;
|
|
18
|
+
}, z.core.$strict>]>;
|
|
19
|
+
export type LogRecord = z.infer<typeof logRecordSchema>;
|
|
20
|
+
/** A stream the log writes to, and whether a person reads it there. */
|
|
21
|
+
export interface LogStream {
|
|
22
|
+
write(text: string): void;
|
|
23
|
+
readonly isTerminal: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** A line of the log as its record, or as it is when it is none. */
|
|
26
|
+
export declare function readLogLine(line: string): LogRecord | {
|
|
27
|
+
line: string;
|
|
28
|
+
};
|
|
29
|
+
/** A line of the log as the operator reads it. */
|
|
30
|
+
export declare function renderLogLine(line: string, style?: Style): string;
|
|
31
|
+
/** Info and actions to `out`, warnings to `err`; each a JSON line, or rendered text where a person reads it. */
|
|
32
|
+
export declare function createLogger(at: {
|
|
33
|
+
out: LogStream;
|
|
34
|
+
err: LogStream;
|
|
35
|
+
now: () => Date;
|
|
36
|
+
}): Logger & {
|
|
37
|
+
info(message: string): void;
|
|
38
|
+
};
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PLAIN } from './style.js';
|
|
3
|
+
/**
|
|
4
|
+
* The trierarch's log, `~/.aeolus/trierarch/logs/trierarch.log`: one JSON
|
|
5
|
+
* object per line, an action the loop took for a ship or a message. JSON so
|
|
6
|
+
* `aeolus-trierarch logs --json` passes the records on as they are, and
|
|
7
|
+
* `logs` renders them for the operator. A run in a terminal writes the
|
|
8
|
+
* rendered text instead. A line that is no record (an older line, a stack
|
|
9
|
+
* trace) is read and shown as it is.
|
|
10
|
+
*/
|
|
11
|
+
const actionRecordSchema = z.strictObject({
|
|
12
|
+
time: z.string(),
|
|
13
|
+
shipId: z.string(),
|
|
14
|
+
shipName: z.string().optional(),
|
|
15
|
+
action: z.string(),
|
|
16
|
+
outcome: z.string(),
|
|
17
|
+
next: z.string().optional(),
|
|
18
|
+
});
|
|
19
|
+
const messageRecordSchema = z.strictObject({ time: z.string(), level: z.enum(['info', 'warn']), message: z.string() });
|
|
20
|
+
const logRecordSchema = z.union([actionRecordSchema, messageRecordSchema]);
|
|
21
|
+
const FAILED = 'failed:';
|
|
22
|
+
/** A record as the operator reads it; where the style colours, the time quiet, the ship strong, a failure bad and what happens next busy. */
|
|
23
|
+
function render(record, style = PLAIN) {
|
|
24
|
+
const time = style.tone('quiet', record.time);
|
|
25
|
+
if ('level' in record) {
|
|
26
|
+
return `${time} ${record.level === 'warn' ? style.tone('busy', record.level) : record.level} ${record.message}`;
|
|
27
|
+
}
|
|
28
|
+
const ship = style.tone('strong', record.shipName === undefined ? record.shipId : `${record.shipId} (${record.shipName})`);
|
|
29
|
+
const outcome = record.outcome.startsWith(FAILED) ? style.tone('bad', record.outcome) : record.outcome;
|
|
30
|
+
return `${time} ${ship} ${record.action}: ${outcome}${record.next === undefined ? '' : `. ${style.tone('busy', `Next: ${record.next}`)}`}`;
|
|
31
|
+
}
|
|
32
|
+
/** A line of the log as its record, or as it is when it is none. */
|
|
33
|
+
export function readLogLine(line) {
|
|
34
|
+
try {
|
|
35
|
+
const record = logRecordSchema.safeParse(JSON.parse(line));
|
|
36
|
+
return record.success ? record.data : { line };
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return { line };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** A line of the log as the operator reads it. */
|
|
43
|
+
export function renderLogLine(line, style = PLAIN) {
|
|
44
|
+
const read = readLogLine(line);
|
|
45
|
+
return 'line' in read ? read.line : render(read, style);
|
|
46
|
+
}
|
|
47
|
+
/** Info and actions to `out`, warnings to `err`; each a JSON line, or rendered text where a person reads it. */
|
|
48
|
+
export function createLogger(at) {
|
|
49
|
+
const write = (stream, record) => {
|
|
50
|
+
stream.write(`${stream.isTerminal ? render(record) : JSON.stringify(record)}\n`);
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
info: (message) => {
|
|
54
|
+
write(at.out, { time: at.now().toISOString(), level: 'info', message });
|
|
55
|
+
},
|
|
56
|
+
warn: (message) => {
|
|
57
|
+
write(at.err, { time: at.now().toISOString(), level: 'warn', message });
|
|
58
|
+
},
|
|
59
|
+
action: (logged) => {
|
|
60
|
+
const { time, ...rest } = logged;
|
|
61
|
+
write(at.out, { time: time.toISOString(), ...rest });
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/adapters/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,EAAc,MAAM,YAAY,CAAC;AAG/C;;;;;;;GAOG;AAEH,MAAM,kBAAkB,GAAG,CAAC,CAAC,YAAY,CAAC;IACxC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAEvH,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,CAAC,CAAC;AAS3E,MAAM,MAAM,GAAG,SAAS,CAAC;AAEzB,6IAA6I;AAC7I,SAAS,MAAM,CAAC,MAAiB,EAAE,QAAe,KAAK;IACrD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,OAAO,IAAI,MAAM,EAAE,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EAAE,CAAC,CAAC;QACvD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/adapters/paths.d.ts
CHANGED
package/dist/adapters/paths.js
CHANGED
|
@@ -7,6 +7,7 @@ export function trierarchPaths(at) {
|
|
|
7
7
|
configSchema: join(home, 'config.schema.json'),
|
|
8
8
|
crewToken: join(home, 'crew-token'),
|
|
9
9
|
state: join(home, 'state.json'),
|
|
10
|
+
running: join(home, 'running.json'),
|
|
10
11
|
logs: join(home, 'logs'),
|
|
11
12
|
worktrees: join(home, 'worktrees'),
|
|
12
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/adapters/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/adapters/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAmBjC,MAAM,UAAU,cAAc,CAAC,EAA8C;IAC3E,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IAC5D,OAAO;QACL,IAAI;QACJ,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC;QAC9C,YAAY,EAAE,IAAI,CAAC,IAAI,EAAE,oBAAoB,CAAC;QAC9C,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC;QACnC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC;QAC/B,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC;QACnC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;QACxB,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC;KACnC,CAAC;AACJ,CAAC"}
|
|
@@ -25,6 +25,8 @@ export class FleetRefusal extends Error {
|
|
|
25
25
|
}
|
|
26
26
|
export function createRestFleet(options) {
|
|
27
27
|
const fleetUrl = options.fleetUrl.replace(/\/$/, '');
|
|
28
|
+
/** A call that got no answer: said with the fleet's url, unless it was stopped on purpose. */
|
|
29
|
+
const unreachable = (error, signal) => signal?.aborted === true ? error : new Error(`The fleet at ${fleetUrl} cannot be reached: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
28
30
|
async function call(request) {
|
|
29
31
|
const headers = {};
|
|
30
32
|
const crewToken = request.crewToken ?? options.crewToken;
|
|
@@ -39,12 +41,23 @@ export function createRestFleet(options) {
|
|
|
39
41
|
: { method: 'POST', headers: { ...headers, 'content-type': 'application/json' }, body: JSON.stringify(request.body), signal: request.signal ?? null });
|
|
40
42
|
}
|
|
41
43
|
catch (error) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
throw unreachable(error, request.signal);
|
|
45
|
+
}
|
|
46
|
+
// While the fleet restarts, an answer may come empty, as a proxy's page, or cut off: none of it is the fleet's word.
|
|
47
|
+
let text;
|
|
48
|
+
try {
|
|
49
|
+
text = await response.text();
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
throw unreachable(error, request.signal);
|
|
53
|
+
}
|
|
54
|
+
let body;
|
|
55
|
+
try {
|
|
56
|
+
body = JSON.parse(text);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
throw new Error(`The fleet at ${fleetUrl} cannot be reached: it answered ${String(response.status)} without JSON, as while it restarts`, { cause: error });
|
|
46
60
|
}
|
|
47
|
-
const body = await response.json();
|
|
48
61
|
if (!response.ok) {
|
|
49
62
|
const refusal = refusalSchema.safeParse(body);
|
|
50
63
|
throw refusal.success ? new FleetRefusal(refusal.data.code, refusal.data.message) : new FleetRefusal(String(response.status), 'The fleet refused');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rest-fleet.js","sour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