aicodeman 1.3.5 → 1.4.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 +16 -0
- package/dist/docker-export.d.ts +107 -0
- package/dist/docker-export.d.ts.map +1 -0
- package/dist/docker-export.js +335 -0
- package/dist/docker-export.js.map +1 -0
- package/dist/docker-hosts.d.ts +264 -0
- package/dist/docker-hosts.d.ts.map +1 -0
- package/dist/docker-hosts.js +744 -0
- package/dist/docker-hosts.js.map +1 -0
- package/dist/mux-interface.d.ts +7 -1
- package/dist/mux-interface.d.ts.map +1 -1
- package/dist/session.d.ts +9 -2
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +48 -4
- package/dist/session.js.map +1 -1
- package/dist/tmux-manager.d.ts +58 -1
- package/dist/tmux-manager.d.ts.map +1 -1
- package/dist/tmux-manager.js +247 -7
- package/dist/tmux-manager.js.map +1 -1
- package/dist/types/api.d.ts +9 -1
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/api.js.map +1 -1
- package/dist/types/session.d.ts +102 -0
- package/dist/types/session.d.ts.map +1 -1
- package/dist/types/session.js.map +1 -1
- package/dist/web/network-auth-policy.d.ts +9 -0
- package/dist/web/network-auth-policy.d.ts.map +1 -1
- package/dist/web/network-auth-policy.js +12 -0
- package/dist/web/network-auth-policy.js.map +1 -1
- package/dist/web/public/api-client.c9b1cddc.js.gz +0 -0
- package/dist/web/public/{app.6890f3d0.js → app.6c4b9893.js} +1 -1
- package/dist/web/public/app.6c4b9893.js.br +0 -0
- package/dist/web/public/app.6c4b9893.js.gz +0 -0
- package/dist/web/public/{constants.5b18ed64.js → constants.48da7f03.js} +7 -0
- package/dist/web/public/constants.48da7f03.js.br +0 -0
- package/dist/web/public/{constants.5b18ed64.js.gz → constants.48da7f03.js.gz} +0 -0
- package/dist/web/public/cron-ui.js.gz +0 -0
- package/dist/web/public/image-input.ee16ad88.js.gz +0 -0
- package/dist/web/public/index.html +148 -11
- package/dist/web/public/index.html.br +0 -0
- package/dist/web/public/index.html.gz +0 -0
- package/dist/web/public/input-cjk.63794d0b.js.gz +0 -0
- package/dist/web/public/keyboard-accessory.3f91acef.js.gz +0 -0
- package/dist/web/public/mobile-handlers.b5a667ef.js.gz +0 -0
- package/dist/web/public/mobile.0644e3ac.css.gz +0 -0
- package/dist/web/public/notification-manager.ca9dc40d.js.gz +0 -0
- package/dist/web/public/orchestrator-panel.js.gz +0 -0
- package/dist/web/public/{panels-ui.ca03853f.js → panels-ui.3c9b0465.js} +53 -53
- package/dist/web/public/panels-ui.3c9b0465.js.br +0 -0
- package/dist/web/public/panels-ui.3c9b0465.js.gz +0 -0
- package/dist/web/public/ralph-panel.6de2d0f8.js.gz +0 -0
- package/dist/web/public/ralph-wizard.13a1831e.js.gz +0 -0
- package/dist/web/public/respawn-ui.2d249da9.js.gz +0 -0
- package/dist/web/public/sanitize-html.bc7078d6.js.gz +0 -0
- package/dist/web/public/session-ui.4851c61a.js +58 -0
- package/dist/web/public/session-ui.4851c61a.js.br +0 -0
- package/dist/web/public/session-ui.4851c61a.js.gz +0 -0
- package/dist/web/public/settings-ui.29214cf1.js +67 -0
- package/dist/web/public/settings-ui.29214cf1.js.br +0 -0
- package/dist/web/public/settings-ui.29214cf1.js.gz +0 -0
- package/dist/web/public/{styles.3d78fd0d.css → styles.ff43f80f.css} +1 -1
- package/dist/web/public/styles.ff43f80f.css.br +0 -0
- package/dist/web/public/styles.ff43f80f.css.gz +0 -0
- package/dist/web/public/subagent-windows.69b60c35.js.gz +0 -0
- package/dist/web/public/sw.js.gz +0 -0
- package/dist/web/public/terminal-ui.efda6083.js.gz +0 -0
- package/dist/web/public/ultracode-panel.js.gz +0 -0
- package/dist/web/public/ultracode-windows.js.gz +0 -0
- package/dist/web/public/upload.html.gz +0 -0
- package/dist/web/public/vendor/dompurify.min.js.gz +0 -0
- package/dist/web/public/vendor/marked.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-fit.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-serialize.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-unicode11.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-webgl.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-zerolag-input.137ad9f0.js.gz +0 -0
- package/dist/web/public/vendor/xterm.css.gz +0 -0
- package/dist/web/public/vendor/xterm.min.js.gz +0 -0
- package/dist/web/public/voice-input.085e9e73.js.gz +0 -0
- package/dist/web/routes/case-routes.d.ts.map +1 -1
- package/dist/web/routes/case-routes.js +422 -3
- package/dist/web/routes/case-routes.js.map +1 -1
- package/dist/web/routes/session-routes.d.ts.map +1 -1
- package/dist/web/routes/session-routes.js +85 -5
- package/dist/web/routes/session-routes.js.map +1 -1
- package/dist/web/schemas.d.ts +72 -1
- package/dist/web/schemas.d.ts.map +1 -1
- package/dist/web/schemas.js +158 -0
- package/dist/web/schemas.js.map +1 -1
- package/dist/web/server.d.ts +11 -0
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/server.js +81 -1
- package/dist/web/server.js.map +1 -1
- package/dist/web/sse-events.d.ts +21 -0
- package/dist/web/sse-events.d.ts.map +1 -1
- package/dist/web/sse-events.js +23 -0
- package/dist/web/sse-events.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/public/app.6890f3d0.js.br +0 -0
- package/dist/web/public/app.6890f3d0.js.gz +0 -0
- package/dist/web/public/constants.5b18ed64.js.br +0 -0
- package/dist/web/public/panels-ui.ca03853f.js.br +0 -0
- package/dist/web/public/panels-ui.ca03853f.js.gz +0 -0
- package/dist/web/public/session-ui.c9094fe9.js +0 -49
- package/dist/web/public/session-ui.c9094fe9.js.br +0 -0
- package/dist/web/public/session-ui.c9094fe9.js.gz +0 -0
- package/dist/web/public/settings-ui.9538a0c1.js +0 -67
- package/dist/web/public/settings-ui.9538a0c1.js.br +0 -0
- package/dist/web/public/settings-ui.9538a0c1.js.gz +0 -0
- package/dist/web/public/styles.3d78fd0d.css.br +0 -0
- package/dist/web/public/styles.3d78fd0d.css.gz +0 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Docker cases: storage, pure command-arg builders, and daemon probes.
|
|
3
|
+
*
|
|
4
|
+
* Docker mode is a LOCATION OVERLAY on cases (not a 6th SessionMode), the direct
|
|
5
|
+
* analog of the remote-SSH feature in `remote-hosts.ts`. Instead of a local tmux
|
|
6
|
+
* pane running `ssh host` into a durable remote tmux server, a local tmux pane
|
|
7
|
+
* runs `docker exec -it` into a durable IN-CONTAINER tmux server. The container is
|
|
8
|
+
* scoped to the CASE (`codeman-case-<name>`), so multiple sessions can `docker
|
|
9
|
+
* exec` into the same long-lived container.
|
|
10
|
+
*
|
|
11
|
+
* This module mirrors `remote-hosts.ts`:
|
|
12
|
+
* - JSON storage for hosts (`docker-hosts.json`) and cases (`docker-cases.json`)
|
|
13
|
+
* - `toSessionDocker()` (mirror of `toSessionRemote`)
|
|
14
|
+
* - `buildDockerBaseArgs()` / `buildDockerCreateArgs()` (mirror of `buildSshConnectionArgs`)
|
|
15
|
+
* - `checkDockerAvailable()` / `checkDockerTmuxAvailable()` (mirror of `checkRemoteTmuxAvailable`)
|
|
16
|
+
*
|
|
17
|
+
* The launch/kill command orchestration (`buildDockerLaunchCommand`,
|
|
18
|
+
* `buildDockerKillCommand`, `dockerTmuxSessionName`) lives in `tmux-manager.ts`,
|
|
19
|
+
* mirroring where `buildRemoteLaunchCommand` lives.
|
|
20
|
+
*
|
|
21
|
+
* @module docker-hosts
|
|
22
|
+
*/
|
|
23
|
+
import type { DockerCase, DockerEngine, DockerHost, DockerResourceLimits, SessionDocker, SessionMode } from './types.js';
|
|
24
|
+
/** Locally-built base image (see scripts/build-agent-image.mjs). */
|
|
25
|
+
export declare const DEFAULT_AGENT_IMAGE = "codeman/agent:base";
|
|
26
|
+
/** HOME inside the base image (the `agent` user). Cred mounts + hook-secret land under it. */
|
|
27
|
+
export declare const CONTAINER_HOME = "/home/agent";
|
|
28
|
+
/** Sensible resource defaults (all overridable per host). */
|
|
29
|
+
export declare const DEFAULT_DOCKER_RESOURCES: DockerResourceLimits;
|
|
30
|
+
export declare function dockerHostsPath(configDir: string): string;
|
|
31
|
+
export declare function dockerCasesPath(configDir: string): string;
|
|
32
|
+
export declare function readDockerHosts(configDir: string): Promise<DockerHost[]>;
|
|
33
|
+
export declare function writeDockerHosts(configDir: string, hosts: DockerHost[]): Promise<void>;
|
|
34
|
+
export declare function readDockerCases(configDir: string): Promise<DockerCase[]>;
|
|
35
|
+
export declare function writeDockerCases(configDir: string, cases: DockerCase[]): Promise<void>;
|
|
36
|
+
/** Per-case container name. Mirrors how remote derives a stable name from the case. */
|
|
37
|
+
export declare function dockerContainerName(caseName: string): string;
|
|
38
|
+
/** Default pane command per CLI mode (mirror of defaultRemoteCommandForMode). */
|
|
39
|
+
export declare function defaultDockerCommandForMode(mode: SessionMode): string;
|
|
40
|
+
/** `container:/workdir` display string (mirror of remoteDisplayPath's `user@host:path`). */
|
|
41
|
+
export declare function dockerDisplayPath(docker: Pick<SessionDocker, 'containerName' | 'containerWorkdir'> | {
|
|
42
|
+
container: string;
|
|
43
|
+
path: string;
|
|
44
|
+
}): string;
|
|
45
|
+
/**
|
|
46
|
+
* The host-callback gateway alias is ENGINE-SPECIFIC: Docker exposes the host as
|
|
47
|
+
* `host.docker.internal`, Podman as `host.containers.internal`. Both are added to
|
|
48
|
+
* the host-guard allowlist so a mixed fleet keeps working.
|
|
49
|
+
*/
|
|
50
|
+
export declare function hostGatewayAlias(engine: DockerEngine): string;
|
|
51
|
+
/**
|
|
52
|
+
* Rewrite the server's own `CODEMAN_API_URL` to a container-reachable one by
|
|
53
|
+
* swapping ONLY the hostname for the engine's host-gateway alias, preserving
|
|
54
|
+
* scheme AND port (prod is HTTPS on 3000, so hardcoding http://…:3000 breaks
|
|
55
|
+
* every hook). Falls back to `https://<alias>:3000` when the input is absent or
|
|
56
|
+
* unparseable.
|
|
57
|
+
*/
|
|
58
|
+
export declare function containerApiUrl(processApiUrl: string | undefined, engine: DockerEngine): string;
|
|
59
|
+
/**
|
|
60
|
+
* Stable hash of the drift-relevant `docker create` inputs, stored on the
|
|
61
|
+
* container as the `codeman.confighash` label. On launch, a mismatch between the
|
|
62
|
+
* desired hash and the running container's label triggers the recreate-on-drift
|
|
63
|
+
* prompt (host config edits actually take effect).
|
|
64
|
+
*/
|
|
65
|
+
export declare function dockerConfigHash(docker: Pick<SessionDocker, 'engine' | 'image' | 'containerWorkdir' | 'network' | 'networkName' | 'resources' | 'gpus' | 'mountCredentials' | 'extraCreateArgs'>): string;
|
|
66
|
+
/**
|
|
67
|
+
* Build the flattened per-session Docker metadata from a host profile + a case,
|
|
68
|
+
* resolving every default (mirror of toSessionRemote). The `configHash` is
|
|
69
|
+
* computed last over the resolved values.
|
|
70
|
+
*/
|
|
71
|
+
export declare function toSessionDocker(host: DockerHost, dockerCase: DockerCase): SessionDocker;
|
|
72
|
+
/**
|
|
73
|
+
* POSIX single-quote shell-escaping (end-quote, escaped-quote, restart-quote).
|
|
74
|
+
* Mirror of the helper in remote-hosts.ts / tmux-manager.ts. Every dynamic value
|
|
75
|
+
* interpolated into the outer `bash -c "..."` launch layer is escaped through
|
|
76
|
+
* this so a path with spaces stays a single shell token. Operator-entered fields
|
|
77
|
+
* are ALSO schema-rejected for `$`/backtick (NO_SHELL_META) as defense in depth.
|
|
78
|
+
*/
|
|
79
|
+
export declare function shellescape(str: string): string;
|
|
80
|
+
/** A resolved bind mount (source existence already checked by the caller). */
|
|
81
|
+
export interface DockerMount {
|
|
82
|
+
src: string;
|
|
83
|
+
dst: string;
|
|
84
|
+
readonly?: boolean;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Resolved, IO-free context for buildDockerCreateArgs. The caller (tmux-manager)
|
|
88
|
+
* resolves the environment-dependent bits (host uid, existing cred mounts, the
|
|
89
|
+
* derived api url, Desktop detection) so this builder stays pure and unit-testable.
|
|
90
|
+
*/
|
|
91
|
+
export interface DockerCreateContext {
|
|
92
|
+
docker: SessionDocker;
|
|
93
|
+
/** Codeman session id (only the first 8 chars are used, for the codeman.session label). */
|
|
94
|
+
sessionId: string;
|
|
95
|
+
/** CODEMAN_INSTANCE ('' for prod) — scopes the boot reaper so a beta never reaps prod. */
|
|
96
|
+
instance: string;
|
|
97
|
+
/** Pre-resolved uid/userns tokens: ['--user','1000:0'] | ['--userns','keep-id'] | []. */
|
|
98
|
+
userArgs: string[];
|
|
99
|
+
/** Existing host credential bind mounts (convenient mode). Empty in sealed mode. */
|
|
100
|
+
credentialMounts: DockerMount[];
|
|
101
|
+
/** Extra bind mounts (e.g. the read-only hook-secret file). */
|
|
102
|
+
extraMounts: DockerMount[];
|
|
103
|
+
/** Create-time env (NON-secret, committed-safe): HOME, TERM, COLORTERM, CODEMAN_API_URL, CODEMAN_HOOK_SECRET_FILE. */
|
|
104
|
+
envCreate: Record<string, string>;
|
|
105
|
+
/** Whether to add `--add-host <alias>:host-gateway` (skipped on Docker Desktop, where the alias is native). */
|
|
106
|
+
addHostGateway: boolean;
|
|
107
|
+
/** Engine host-gateway alias (host.docker.internal / host.containers.internal). */
|
|
108
|
+
gatewayAlias: string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Engine prefix tokens shared by every docker invocation (mirror of
|
|
112
|
+
* buildSshConnectionArgs). Returns e.g. ['docker'] or ['podman','--context','ctx'].
|
|
113
|
+
*/
|
|
114
|
+
export declare function buildDockerBaseArgs(docker: Pick<SessionDocker, 'engine' | 'context' | 'daemonHost'>): string[];
|
|
115
|
+
/**
|
|
116
|
+
* Build the `docker create` token list (from `create` through the `sleep
|
|
117
|
+
* infinity` CMD) for a long-lived, hardened, per-case container. PURE: every
|
|
118
|
+
* dynamic value is shellescaped; the caller joins with spaces into the launch
|
|
119
|
+
* string. Security invariants baked in: --cap-drop ALL, --security-opt
|
|
120
|
+
* no-new-privileges, --pids-limit, --memory==--memory-swap, --init,
|
|
121
|
+
* --pull=never, --restart no, NEVER --privileged, NEVER the docker socket.
|
|
122
|
+
*/
|
|
123
|
+
export declare function buildDockerCreateArgs(ctx: DockerCreateContext): string[];
|
|
124
|
+
/**
|
|
125
|
+
* PURE argv for building the agent base image locally (the programmatic mirror of
|
|
126
|
+
* scripts/build-agent-image.mjs): `build -f <dockerfile> -t <image> [--no-cache]
|
|
127
|
+
* <contextDir>`. Kept pure + unit-testable; the caller prepends the engine binary.
|
|
128
|
+
*/
|
|
129
|
+
export declare function agentImageBuildArgs(dockerfile: string, image: string, contextDir: string, noCache?: boolean): string[];
|
|
130
|
+
/** Container Claude config dir (created gid-0 writable in the image). */
|
|
131
|
+
export declare const CONTAINER_CLAUDE_DIR = "/home/agent/.claude";
|
|
132
|
+
/** In-container path of the seeded (writable) `~/.claude.json`. */
|
|
133
|
+
export declare const CLAUDE_JSON_HOME = "/home/agent/.claude.json";
|
|
134
|
+
/** In-container path of the read-only host-seeded `~/.claude.json` (copied into HOME at launch). */
|
|
135
|
+
export declare const CLAUDE_JSON_SEED = "/home/agent/.codeman/claude.seed.json";
|
|
136
|
+
/**
|
|
137
|
+
* PURE: merge the host `~/.claude.json` into a config that makes an
|
|
138
|
+
* already-authenticated Claude skip its INTERACTIVE onboarding inside the container
|
|
139
|
+
* (the host file itself lacks these flags — the host install is grandfathered, so a
|
|
140
|
+
* verbatim copy still triggers the theme picker + login wizard + folder-trust
|
|
141
|
+
* prompt). Forces `hasCompletedOnboarding`, a `theme` (so the theme picker is
|
|
142
|
+
* skipped), and marks the workspace project trusted + onboarded. Auth still comes
|
|
143
|
+
* from the copied `oauthAccount` + the dir-mounted `~/.claude/.credentials.json`.
|
|
144
|
+
*/
|
|
145
|
+
export declare function buildSeamlessClaudeConfig(hostConfig: Record<string, unknown>, workspacePath: string, theme?: string): Record<string, unknown>;
|
|
146
|
+
/**
|
|
147
|
+
* Resolve the read-only seed mount for `~/.claude.json`. Reads the host file, merges
|
|
148
|
+
* in the seamless-onboarding flags + workspace trust (buildSeamlessClaudeConfig),
|
|
149
|
+
* writes the result to a per-container seed file under `~/.codeman/docker-seeds/`,
|
|
150
|
+
* and returns its mount. The launch chain copies it to `~/.claude.json` inside HOME
|
|
151
|
+
* once — giving Claude a NORMAL writable, already-onboarded config (no atomic-rename
|
|
152
|
+
* EBUSY, no re-auth, no theme/trust prompts). Falls back to the RAW host file when
|
|
153
|
+
* parse/write fails (auth still works; the wizard may show). Returns null when the
|
|
154
|
+
* host has no `~/.claude.json`. IO; under VITEST returns the raw mount (no write).
|
|
155
|
+
*/
|
|
156
|
+
export declare function resolveClaudeJsonSeedMount(home?: string, containerName?: string, workspacePath?: string): DockerMount | null;
|
|
157
|
+
/** A file (or dir, when `recursive`) copied into the container HOME once at launch
|
|
158
|
+
* (`[ -e to ] || cp [-a] from to`). */
|
|
159
|
+
export interface DockerSeedCopy {
|
|
160
|
+
from: string;
|
|
161
|
+
to: string;
|
|
162
|
+
/** `cp -a` for whole-directory credential seeds (gemini/gcloud/opencode). */
|
|
163
|
+
recursive?: boolean;
|
|
164
|
+
}
|
|
165
|
+
export interface DockerClaudeArtifacts {
|
|
166
|
+
/** Bind mounts to add: the shared `projects/` transcripts (RW) + read-only seed files. */
|
|
167
|
+
mounts: DockerMount[];
|
|
168
|
+
/** Files copied into the container's writable HOME/.claude (+ HOME/.claude.json) at launch. */
|
|
169
|
+
seedCopies: DockerSeedCopy[];
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Resolve the ISOLATED Claude artifacts for a docker session (replaces the old
|
|
173
|
+
* whole-`~/.claude` RW mount that polluted the host). Shares ONLY what must cross
|
|
174
|
+
* the boundary and seeds the rest as writable copies:
|
|
175
|
+
* - `~/.claude/projects` → RW dir mount (transcripts: host watchers + `--resume`).
|
|
176
|
+
* - `~/.claude.json` → merged onboarding seed, copied to HOME (no re-auth/wizard).
|
|
177
|
+
* - `~/.claude/.credentials.json` + `~/.claude/settings.json` → read-only seeds
|
|
178
|
+
* copied into the container's own `~/.claude` (token + global prefs carry in;
|
|
179
|
+
* the container refreshes its own copy and never writes back to the host).
|
|
180
|
+
* Everything else Claude writes (backups, tasks, teams, session-env, history) stays
|
|
181
|
+
* container-local. IO (reads host files, writes the merged `.claude.json` seed).
|
|
182
|
+
*/
|
|
183
|
+
export declare function resolveDockerClaudeArtifacts(home: string, containerName: string, workspacePath: string): DockerClaudeArtifacts;
|
|
184
|
+
/**
|
|
185
|
+
* Resolve the ISOLATED codex/gemini/gcloud/opencode artifacts (replaces the old
|
|
186
|
+
* whole-dir RW mounts that let each in-container CLI write its refreshed tokens +
|
|
187
|
+
* session state back into the host). Every path is existsSync-gated (on most hosts
|
|
188
|
+
* only a subset exists). Pure-ish IO (no writes; just existence checks + mount specs).
|
|
189
|
+
*/
|
|
190
|
+
export declare function resolveDockerCredentialArtifacts(home?: string): DockerClaudeArtifacts;
|
|
191
|
+
export interface DockerAvailability {
|
|
192
|
+
ok: boolean;
|
|
193
|
+
engine: DockerEngine;
|
|
194
|
+
rootless: boolean;
|
|
195
|
+
isDesktop: boolean;
|
|
196
|
+
cgroupV2: boolean;
|
|
197
|
+
/** Best-effort: are --memory/--cpus/--pids-limit actually enforced on this engine? */
|
|
198
|
+
capsEnforced: boolean;
|
|
199
|
+
error?: string;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Probe the container engine: server up, cgroup version, rootless, Desktop, and
|
|
203
|
+
* whether resource caps are enforceable. Auto-detects docker then podman when no
|
|
204
|
+
* engine is given. No-op canned value under VITEST.
|
|
205
|
+
*/
|
|
206
|
+
export declare function checkDockerAvailable(engine?: DockerEngine): Promise<DockerAvailability>;
|
|
207
|
+
/** Is the base image present locally? (never triggers an auto-pull). */
|
|
208
|
+
export declare function checkDockerImagePresent(engine: DockerEngine, image: string): Promise<boolean>;
|
|
209
|
+
export interface EnsureImageResult {
|
|
210
|
+
ok: boolean;
|
|
211
|
+
/** true when this call actually ran a build (vs. the image already existing). */
|
|
212
|
+
built: boolean;
|
|
213
|
+
alreadyPresent: boolean;
|
|
214
|
+
error?: string;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Ensure the agent base image exists, BUILDING it locally on first use so a missing
|
|
218
|
+
* image is never a hard blocker (decision: "build locally on first use",
|
|
219
|
+
* docs/docker-cases-plan.md). Idempotent, concurrency-safe (one build per
|
|
220
|
+
* engine:image shared by concurrent callers), and a no-op under VITEST. Only the
|
|
221
|
+
* DEFAULT image is auto-built — we can never build a user's custom ref, and the
|
|
222
|
+
* `--pull=never` invariant forbids pulling. `onProgress` receives build output
|
|
223
|
+
* lines for SSE surfacing.
|
|
224
|
+
*/
|
|
225
|
+
export declare function ensureAgentBaseImage(engine: DockerEngine, image: string, opts?: {
|
|
226
|
+
onProgress?: (line: string) => void;
|
|
227
|
+
noCache?: boolean;
|
|
228
|
+
}): Promise<EnsureImageResult>;
|
|
229
|
+
export interface DockerTmuxCheckResult {
|
|
230
|
+
ok: boolean;
|
|
231
|
+
tmuxPath?: string;
|
|
232
|
+
/** Distinguishes "image missing" (build it) from "tmux missing in image" (rebuild it). */
|
|
233
|
+
imageMissing?: boolean;
|
|
234
|
+
error?: string;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Verify the base image is present AND contains tmux (a HARD prerequisite: the
|
|
238
|
+
* in-container tmux is what makes reconnect durable). Never triggers a pull
|
|
239
|
+
* (`--pull=never`). No-op under VITEST. Mirror of checkRemoteTmuxAvailable.
|
|
240
|
+
*/
|
|
241
|
+
export declare function checkDockerTmuxAvailable(docker: Pick<SessionDocker, 'engine' | 'image'>): Promise<DockerTmuxCheckResult>;
|
|
242
|
+
/**
|
|
243
|
+
* Resolve the host's IP on the default docker bridge (the address a container
|
|
244
|
+
* reaches as `host.docker.internal`), so the server can bind a hooks-only listener
|
|
245
|
+
* there and in-container hooks can call back. Defaults to the conventional
|
|
246
|
+
* 172.17.0.1 when the inspect fails but docker is up; null when docker is absent.
|
|
247
|
+
* No-op canned value under VITEST.
|
|
248
|
+
*/
|
|
249
|
+
export declare function detectDockerBridgeGateway(engine?: DockerEngine): Promise<string | null>;
|
|
250
|
+
/**
|
|
251
|
+
* Instance-scoped boot reaper: `docker rm -f` any MANAGED container that belongs
|
|
252
|
+
* to THIS instance (by the `codeman.instance` label) but whose case is no longer
|
|
253
|
+
* in `docker-cases.json`. The instance scoping is what stops a beta from reaping
|
|
254
|
+
* prod's containers (the cross-instance hazard). No-op under VITEST. Best-effort.
|
|
255
|
+
*/
|
|
256
|
+
export declare function reapOrphanedDockerContainers(configDir: string, instance: string, engine?: DockerEngine): Promise<string[]>;
|
|
257
|
+
/**
|
|
258
|
+
* Read the IN-CONTAINER Claude CLI version (`docker exec <container> claude
|
|
259
|
+
* --version`). Feeds Session.cliVersion for docker sessions (the LOCAL claude
|
|
260
|
+
* would report the wrong version and disable trackpad wheel-forwarding, #154).
|
|
261
|
+
* Returns undefined on any failure. No-op under VITEST.
|
|
262
|
+
*/
|
|
263
|
+
export declare function probeDockerCliVersion(docker: Pick<SessionDocker, 'engine' | 'containerName'>, mode: SessionMode): Promise<string | undefined>;
|
|
264
|
+
//# sourceMappingURL=docker-hosts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docker-hosts.d.ts","sourceRoot":"","sources":["../src/docker-hosts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAWH,OAAO,KAAK,EACV,UAAU,EAEV,YAAY,EACZ,UAAU,EAEV,oBAAoB,EACpB,aAAa,EACb,WAAW,EACZ,MAAM,YAAY,CAAC;AAUpB,oEAAoE;AACpE,eAAO,MAAM,mBAAmB,uBAAuB,CAAC;AAExD,8FAA8F;AAC9F,eAAO,MAAM,cAAc,gBAAgB,CAAC;AAO5C,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,EAAE,oBAKtC,CAAC;AAIF,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,eAA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