@zgeoff/atc 0.1.12 → 1.0.1
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 +50 -12
- package/package.json +7 -2
- package/src/{agent-adapter.ts → agents/agent-adapter.ts} +31 -14
- package/src/{build-cli-command.ts → agents/build-cli-command.ts} +1 -1
- package/src/agents/build-hook-settings.ts +59 -0
- package/src/{claude-adapter.ts → agents/claude-adapter.ts} +41 -80
- package/src/{codex-adapter.ts → agents/codex-adapter.ts} +41 -30
- package/src/agents/gateway-adapter.ts +106 -0
- package/src/{grok-adapter.ts → agents/grok-adapter.ts} +83 -46
- package/src/agents/resolve-agent-home.ts +13 -0
- package/src/agents/truncate-detail.ts +7 -0
- package/src/agents/write-hook-settings.ts +37 -0
- package/src/cli.ts +25 -14
- package/src/{boot-daemon.ts → client/boot-daemon.ts} +8 -7
- package/src/client/build-client-machine.ts +119 -0
- package/src/client/collect-agent-picks.ts +31 -0
- package/src/{daemon-client.ts → client/daemon-client.ts} +4 -4
- package/src/{dirs.ts → client/dirs.ts} +8 -0
- package/src/client/format-overlay-agent-mark.ts +15 -0
- package/src/{index.ts → client/index.ts} +181 -550
- package/src/client/keys.ts +111 -0
- package/src/client/parse-daemon-event.ts +114 -0
- package/src/{pick-tab-target.ts → client/pick-tab-target.ts} +2 -2
- package/src/client/plan-vacated-rows.ts +26 -0
- package/src/client/spawn-picker.ts +305 -0
- package/src/client/to-mirror-session.ts +65 -0
- package/src/{ui.ts → client/ui.ts} +27 -8
- package/src/{attach-registry.ts → daemon/attach-registry.ts} +12 -10
- package/src/daemon/build-session-event.ts +43 -0
- package/src/{daemon-connection.ts → daemon/daemon-connection.ts} +194 -108
- package/src/{daemon.ts → daemon/daemon.ts} +148 -313
- package/src/{hooks.ts → daemon/hooks.ts} +6 -4
- package/src/daemon/mint-session-id.ts +12 -0
- package/src/{permission-registry.ts → daemon/permission-registry.ts} +5 -3
- package/src/daemon/restore-fleet.ts +141 -0
- package/src/daemon/run-eject-handoff.ts +33 -0
- package/src/{screen-model.ts → daemon/screen-model.ts} +1 -1
- package/src/daemon/session-runtime.ts +64 -0
- package/src/{sessions.ts → daemon/sessions.ts} +77 -133
- package/src/{start-headless-run.ts → daemon/start-headless-run.ts} +9 -3
- package/src/daemon/start-headless-turn.ts +57 -0
- package/src/hook-report.ts +2 -2
- package/src/mcp-server.ts +33 -44
- package/src/protocol/parse-request-params.ts +31 -0
- package/src/{protocol.ts → protocol/protocol.ts} +1 -1
- package/src/protocol/request-param-schemas.ts +109 -0
- package/src/shared/agent-session-id.ts +8 -0
- package/src/shared/build-optional-boolean.ts +10 -0
- package/src/shared/build-optional-string-array.ts +14 -0
- package/src/shared/build-optional-string.ts +10 -0
- package/src/shared/collect-gateways.ts +113 -0
- package/src/{config.ts → shared/config.ts} +47 -31
- package/src/{get-build.ts → shared/get-build.ts} +21 -6
- package/src/shared/get-record.ts +20 -0
- package/src/shared/session-id.ts +8 -0
- package/src/shared/to-agent-session-id.ts +12 -0
- package/src/shared/to-session-id.ts +11 -0
- package/src/shared/to-shell-arg.ts +7 -0
- package/src/statusline.ts +2 -2
- package/src/store/bun-sqlite-driver.ts +96 -0
- package/src/store/fleet-entry.ts +72 -0
- package/src/store/run-migrations.ts +242 -0
- package/src/store/state-store.ts +226 -0
- package/src/format-overlay-agent-mark.ts +0 -17
- package/src/state-store.ts +0 -236
- /package/src/{normalize-hook-event.ts → agents/normalize-hook-event.ts} +0 -0
- /package/src/{print-codex-hook-file.ts → agents/print-codex-hook-file.ts} +0 -0
- /package/src/{print-grok-hook-file.ts → agents/print-grok-hook-file.ts} +0 -0
- /package/src/{build-leader-chords.ts → client/build-leader-chords.ts} +0 -0
- /package/src/{daemon-error.ts → protocol/daemon-error.ts} +0 -0
- /package/src/{outbound-queue.ts → protocol/outbound-queue.ts} +0 -0
- /package/src/{collect-clean-env.ts → shared/collect-clean-env.ts} +0 -0
- /package/src/{report.ts → shared/report.ts} +0 -0
- /package/src/{reset-input-modes.ts → shared/reset-input-modes.ts} +0 -0
- /package/src/{resolve-repo-root.ts → shared/resolve-repo-root.ts} +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AgentID } from '../agents/agent-adapter';
|
|
2
|
+
import type { Config } from '../shared/config';
|
|
3
|
+
|
|
4
|
+
export interface AgentPick {
|
|
5
|
+
readonly agent: AgentID;
|
|
6
|
+
readonly label: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The agent choices the spawn and adopt flows offer, in menu order. An agent
|
|
11
|
+
* whose configured binary does not resolve is left out, so every row in the
|
|
12
|
+
* menu is a session that can start. Resolution follows the rule a spawn
|
|
13
|
+
* follows: a bare name comes off PATH, a name carrying a separator is taken
|
|
14
|
+
* as a path, and either way it has to be executable.
|
|
15
|
+
*/
|
|
16
|
+
export function collectAgentPicks(config: Config): AgentPick[] {
|
|
17
|
+
// Spawns inherit this process's PATH, so the search list is read live
|
|
18
|
+
// rather than left to the snapshot Bun.which defaults to.
|
|
19
|
+
const opts = { PATH: process.env['PATH'] ?? '' };
|
|
20
|
+
|
|
21
|
+
const candidates: readonly (AgentPick & { readonly bin: string })[] = [
|
|
22
|
+
{ agent: 'claude', label: 'Claude', bin: config.claudeBin },
|
|
23
|
+
{ agent: 'grok', label: 'Grok', bin: config.grokBin },
|
|
24
|
+
{ agent: 'codex', label: 'Codex', bin: config.codexBin },
|
|
25
|
+
...config.gateways.map((g) => ({ agent: g.id, label: g.label, bin: g.bin })),
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
return candidates
|
|
29
|
+
.filter((c) => Bun.which(c.bin, opts) !== null)
|
|
30
|
+
.map((c) => ({ agent: c.agent, label: c.label }));
|
|
31
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DaemonError } from '
|
|
2
|
-
import { OutboundQueue } from '
|
|
3
|
-
import { PROTOCOL_V, decodeMessage, encodeMessage } from '
|
|
4
|
-
import type { EventMsg, ResponseMsg } from '
|
|
1
|
+
import { DaemonError } from '../protocol/daemon-error';
|
|
2
|
+
import { OutboundQueue } from '../protocol/outbound-queue';
|
|
3
|
+
import { PROTOCOL_V, decodeMessage, encodeMessage } from '../protocol/protocol';
|
|
4
|
+
import type { EventMsg, ResponseMsg } from '../protocol/protocol';
|
|
5
5
|
|
|
6
6
|
interface Pending {
|
|
7
7
|
readonly resolve: (ok: Readonly<Record<string, unknown>>) => void;
|
|
@@ -61,6 +61,14 @@ export function formatDir(d: string): string {
|
|
|
61
61
|
return d.startsWith(home) ? `~${d.slice(home.length)}` : d;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* The short display name for a directory: its leaf, which is the name a
|
|
66
|
+
* session spawned there takes when its own name is left blank.
|
|
67
|
+
*/
|
|
68
|
+
export function formatDirName(d: string): string {
|
|
69
|
+
return basename(d);
|
|
70
|
+
}
|
|
71
|
+
|
|
64
72
|
const SEPARATORS = new Set(['/', '-', '_', '.', ' ']);
|
|
65
73
|
|
|
66
74
|
/**
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AgentID } from '../agents/agent-adapter';
|
|
2
|
+
|
|
3
|
+
const BUILT_IN_MARKS: Readonly<Record<AgentID, string>> = { grok: 'g', codex: 'x' };
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The reserved overlay column after unread: one character per agent, a space
|
|
7
|
+
* for Claude, so session names stay aligned across a mixed fleet. A
|
|
8
|
+
* configured mark wins, so a backend added by the user gets its own letter.
|
|
9
|
+
*/
|
|
10
|
+
export function formatOverlayAgentMark(
|
|
11
|
+
agent: AgentID,
|
|
12
|
+
marks: Readonly<Record<AgentID, string>> = {},
|
|
13
|
+
): string {
|
|
14
|
+
return marks[agent] ?? BUILT_IN_MARKS[agent] ?? ' ';
|
|
15
|
+
}
|