@proletariat/cli 0.3.69 → 0.3.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/commands/session/health.d.ts +11 -0
  2. package/dist/commands/session/health.js +1 -1
  3. package/dist/commands/session/health.js.map +1 -1
  4. package/dist/lib/execution/runners/cloud.d.ts +16 -0
  5. package/dist/lib/execution/runners/cloud.js +88 -0
  6. package/dist/lib/execution/runners/cloud.js.map +1 -0
  7. package/dist/lib/execution/runners/devcontainer-terminal.d.ts +13 -0
  8. package/dist/lib/execution/runners/devcontainer-terminal.js +184 -0
  9. package/dist/lib/execution/runners/devcontainer-terminal.js.map +1 -0
  10. package/dist/lib/execution/runners/devcontainer-tmux.d.ts +16 -0
  11. package/dist/lib/execution/runners/devcontainer-tmux.js +270 -0
  12. package/dist/lib/execution/runners/devcontainer-tmux.js.map +1 -0
  13. package/dist/lib/execution/runners/devcontainer.d.ts +19 -0
  14. package/dist/lib/execution/runners/devcontainer.js +261 -0
  15. package/dist/lib/execution/runners/devcontainer.js.map +1 -0
  16. package/dist/lib/execution/runners/docker-credentials.d.ts +51 -0
  17. package/dist/lib/execution/runners/docker-credentials.js +175 -0
  18. package/dist/lib/execution/runners/docker-credentials.js.map +1 -0
  19. package/dist/lib/execution/runners/docker-management.d.ts +49 -0
  20. package/dist/lib/execution/runners/docker-management.js +300 -0
  21. package/dist/lib/execution/runners/docker-management.js.map +1 -0
  22. package/dist/lib/execution/runners/docker.d.ts +13 -0
  23. package/dist/lib/execution/runners/docker.js +75 -0
  24. package/dist/lib/execution/runners/docker.js.map +1 -0
  25. package/dist/lib/execution/runners/executor.d.ts +41 -0
  26. package/dist/lib/execution/runners/executor.js +108 -0
  27. package/dist/lib/execution/runners/executor.js.map +1 -0
  28. package/dist/lib/execution/runners/host.d.ts +14 -0
  29. package/dist/lib/execution/runners/host.js +437 -0
  30. package/dist/lib/execution/runners/host.js.map +1 -0
  31. package/dist/lib/execution/runners/index.d.ts +29 -0
  32. package/dist/lib/execution/runners/index.js +79 -0
  33. package/dist/lib/execution/runners/index.js.map +1 -0
  34. package/dist/lib/execution/runners/orchestrator.d.ts +30 -0
  35. package/dist/lib/execution/runners/orchestrator.js +332 -0
  36. package/dist/lib/execution/runners/orchestrator.js.map +1 -0
  37. package/dist/lib/execution/runners/prompt-builder.d.ts +12 -0
  38. package/dist/lib/execution/runners/prompt-builder.js +337 -0
  39. package/dist/lib/execution/runners/prompt-builder.js.map +1 -0
  40. package/dist/lib/execution/runners/sandbox.d.ts +34 -0
  41. package/dist/lib/execution/runners/sandbox.js +108 -0
  42. package/dist/lib/execution/runners/sandbox.js.map +1 -0
  43. package/dist/lib/execution/runners/shared.d.ts +62 -0
  44. package/dist/lib/execution/runners/shared.js +141 -0
  45. package/dist/lib/execution/runners/shared.js.map +1 -0
  46. package/dist/lib/execution/runners.d.ts +12 -272
  47. package/dist/lib/execution/runners.js +12 -3200
  48. package/dist/lib/execution/runners.js.map +1 -1
  49. package/dist/lib/external-issues/outbound-sync.d.ts +15 -0
  50. package/dist/lib/external-issues/outbound-sync.js +11 -1
  51. package/dist/lib/external-issues/outbound-sync.js.map +1 -1
  52. package/dist/lib/telemetry/analytics.d.ts +2 -1
  53. package/dist/lib/telemetry/analytics.js +39 -9
  54. package/dist/lib/telemetry/analytics.js.map +1 -1
  55. package/oclif.manifest.json +3080 -3080
  56. package/package.json +1 -1
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Shared Runner Utilities — Barrel Re-export
3
+ *
4
+ * This module re-exports all shared utilities from sub-modules.
5
+ * Runner modules import from this file for convenience.
6
+ *
7
+ * Sub-modules:
8
+ * - docker-credentials.ts — Credential volume + host creds + tmux keychain
9
+ * - executor.ts — Executor command building + preflight checks
10
+ * - docker-management.ts — Container lifecycle (create, setup, ensure, etc.)
11
+ * - prompt-builder.ts — Integration commands + orchestrator/ticket prompts
12
+ */
13
+ import { spawn, execSync } from 'node:child_process';
14
+ import * as fs from 'node:fs';
15
+ import * as path from 'node:path';
16
+ import * as os from 'node:os';
17
+ import { fileURLToPath } from 'node:url';
18
+ import { DEFAULT_EXECUTION_CONFIG, normalizeEnvironment, } from '../types.js';
19
+ import { getSetTitleCommands } from '../../terminal.js';
20
+ import { readDevcontainerJson, generateOrchestratorDockerfile } from '../devcontainer.js';
21
+ import { getCodexCommand, resolveCodexExecutionContext, validateCodexMode, CodexModeError } from '../codex-adapter.js';
22
+ import { resolveToolsForSpawn } from '../../tool-registry/index.js';
23
+ // =============================================================================
24
+ // Terminal Title Helpers
25
+ // =============================================================================
26
+ /**
27
+ * Build a unified name for tmux sessions, window names, and tab titles.
28
+ * Format: "{ticketId}-{action}-{agentName}"
29
+ */
30
+ export function buildSessionName(context) {
31
+ const action = (context.actionName || 'work')
32
+ .replace(/[^a-zA-Z0-9._-]/g, '-')
33
+ .replace(/-+/g, '-')
34
+ .replace(/^-|-$/g, '');
35
+ const agent = context.agentName || 'agent';
36
+ return `${context.ticketId}-${action}-${agent}`;
37
+ }
38
+ export function buildWindowTitle(context) {
39
+ return buildSessionName(context);
40
+ }
41
+ export function buildTmuxWindowName(context) {
42
+ return buildSessionName(context);
43
+ }
44
+ // =============================================================================
45
+ // Control Mode Helpers (iTerm -CC integration)
46
+ // =============================================================================
47
+ export function shouldUseControlMode(terminalApp, controlModeEnabled) {
48
+ return terminalApp === 'iTerm' && controlModeEnabled;
49
+ }
50
+ export function buildTmuxMouseOption(_useControlMode) {
51
+ return ' \\; set-option -g mouse on';
52
+ }
53
+ export function buildTmuxAttachCommand(useControlMode, includeUnicodeFlag = false) {
54
+ const unicodeFlag = includeUnicodeFlag ? '-u ' : '';
55
+ if (useControlMode) {
56
+ return `tmux -u -CC attach -d`;
57
+ }
58
+ return `tmux ${unicodeFlag}attach -d`;
59
+ }
60
+ export function configureITermTmuxPreferences(mode) {
61
+ try {
62
+ const windowModeValue = mode === 'tab' ? 2 : 1;
63
+ execSync(`defaults write com.googlecode.iterm2 OpenTmuxWindowsIn -int ${windowModeValue}`, { stdio: 'pipe' });
64
+ execSync(`defaults write com.googlecode.iterm2 AutoHideTmuxClientSession -bool true`, { stdio: 'pipe' });
65
+ }
66
+ catch {
67
+ // Non-fatal
68
+ }
69
+ }
70
+ export function configureITermTmuxWindowMode(mode) {
71
+ configureITermTmuxPreferences(mode);
72
+ }
73
+ // =============================================================================
74
+ // GitHub Token Check
75
+ // =============================================================================
76
+ export function getGitHubToken() {
77
+ if (process.env.GITHUB_TOKEN)
78
+ return process.env.GITHUB_TOKEN;
79
+ if (process.env.GH_TOKEN)
80
+ return process.env.GH_TOKEN;
81
+ try {
82
+ const token = execSync('gh auth token', { encoding: 'utf-8', stdio: 'pipe' }).trim();
83
+ if (token)
84
+ return token;
85
+ }
86
+ catch {
87
+ // gh auth token failed
88
+ }
89
+ return null;
90
+ }
91
+ export function isGitHubTokenAvailable() {
92
+ return getGitHubToken() !== null;
93
+ }
94
+ export function checkDockerDaemon() {
95
+ try {
96
+ execSync('which docker', { stdio: 'pipe', timeout: 3000 });
97
+ }
98
+ catch {
99
+ return { available: false, reason: 'not-installed', message: 'Docker is not installed.' };
100
+ }
101
+ const timeout = 5000;
102
+ try {
103
+ execSync('docker ps -q --no-trunc', { stdio: 'pipe', timeout });
104
+ return { available: true, reason: 'ready', message: 'Docker daemon is ready.' };
105
+ }
106
+ catch (error) {
107
+ const stderr = error?.stderr?.toString() || '';
108
+ const isTimeout = error?.killed === true;
109
+ let message;
110
+ if (isTimeout) {
111
+ message = 'Docker daemon is not responding (timed out after 5s). Docker Desktop may be initializing or stuck — check for license/login prompts.';
112
+ }
113
+ else if (stderr.includes('500') || stderr.includes('Internal Server Error')) {
114
+ message = 'Docker daemon is returning errors (500). Docker Desktop needs attention — check for license/login prompts.';
115
+ }
116
+ else if (stderr.includes('connect') || stderr.includes('Cannot connect') || stderr.includes('Is the docker daemon running')) {
117
+ message = 'Docker daemon is not running. Start Docker Desktop and try again.';
118
+ }
119
+ else {
120
+ message = `Docker daemon is not ready: ${stderr.trim() || 'unknown error'}. Check Docker Desktop status.`;
121
+ }
122
+ return { available: false, reason: 'daemon-not-ready', message };
123
+ }
124
+ }
125
+ export function isDockerRunning() {
126
+ return checkDockerDaemon().available;
127
+ }
128
+ /** @deprecated No longer required - we use raw Docker commands now */
129
+ export function isDevcontainerCliInstalled() {
130
+ return true;
131
+ }
132
+ // =============================================================================
133
+ // Re-exports from sub-modules
134
+ // =============================================================================
135
+ export { CLAUDE_CREDENTIALS_VOLUME, credentialsVolumeExists, dockerCredentialsExist, getDockerCredentialInfo, hostCredentialsExist, ensureTmuxServerHasKeychainAccess, copyClaudeCredentials, } from './docker-credentials.js';
136
+ export { getExecutorCommand, isClaudeExecutor, getExecutorDisplayName, getExecutorPackage, checkExecutorOnHost, checkExecutorInContainer, runExecutorPreflight, } from './executor.js';
137
+ export { getHostPrltVersion, getAgentContainerName, getContainerName, getImageName, containerExists, isContainerRunning, getContainerId, buildDockerImage, imageExists, createDockerContainer, runContainerSetup, ensureDockerContainer, } from './docker-management.js';
138
+ export { buildIntegrationCommandsSection, buildOrchestratorSystemPrompt, buildPrompt, } from './prompt-builder.js';
139
+ // Re-export Node modules and external deps used by runner modules
140
+ export { spawn, execSync, fs, path, os, fileURLToPath, DEFAULT_EXECUTION_CONFIG, normalizeEnvironment, getSetTitleCommands, readDevcontainerJson, generateOrchestratorDockerfile, getCodexCommand, resolveCodexExecutionContext, validateCodexMode, CodexModeError, resolveToolsForSpawn, };
141
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../src/lib/execution/runners/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,E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eAAe,EACf,4BAA4B,EAC5B,iBAAiB,EACjB,cAAc,EACd,oBAAoB,GACrB,CAAA"}
@@ -1,276 +1,16 @@
1
1
  /**
2
- * Execution Runners
2
+ * Execution Runners — Re-export barrel
3
3
  *
4
- * Implementations for each execution environment (host, sandbox, devcontainer, docker, cloud).
5
- */
6
- import { ExecutionEnvironment, DisplayMode, OutputMode, PermissionMode, SessionManager, ExecutorType, ExecutionContext, ExecutionConfig } from './types.js';
7
- /**
8
- * Build a unified name for tmux sessions, window names, and tab titles.
9
- * Format: "{ticketId}-{action}-{agentName}"
10
- * Example: "TKT-347-implement-altman"
11
- */
12
- export declare function buildSessionName(context: ExecutionContext): string;
13
- import type { TerminalApp } from './types.js';
14
- /**
15
- * Check if tmux control mode (-CC) should be used.
16
- * Control mode is only used with iTerm when controlMode is enabled in config.
17
- *
18
- * When control mode is active:
19
- * - iTerm handles scrolling, selection, and gestures natively
20
- * - tmux mouse mode should be disabled to avoid conflicts
21
- */
22
- export declare function shouldUseControlMode(terminalApp: TerminalApp, controlModeEnabled: boolean): boolean;
23
- /**
24
- * Build the tmux mouse option string for session creation.
25
- * Enables mouse mode for scroll support in tmux.
26
- * To select text or switch tabs, hold Shift or Option to bypass tmux.
27
- */
28
- export declare function buildTmuxMouseOption(_useControlMode: boolean): string;
29
- /**
30
- * Build the tmux attach command based on control mode.
31
- * Uses -u -CC flags for iTerm control mode (native scrolling/selection).
32
- * -u forces UTF-8 mode which is required for proper iTerm integration.
33
- * Uses regular attach otherwise.
34
- */
35
- export declare function buildTmuxAttachCommand(useControlMode: boolean, includeUnicodeFlag?: boolean): string;
36
- /**
37
- * Configure iTerm tmux preferences for control mode.
38
- * - windowMode: whether tmux -CC opens windows as tabs or new windows
39
- * - autoHide: automatically bury/hide the control session (the terminal where -CC was run)
40
- * @param mode - 'tab' for tabs in current window, 'window' for new windows
41
- */
42
- export declare function configureITermTmuxPreferences(mode: 'tab' | 'window'): void;
43
- export declare function configureITermTmuxWindowMode(mode: 'tab' | 'window'): void;
44
- /**
45
- * Check if the claude-credentials Docker volume exists.
46
- */
47
- export declare function credentialsVolumeExists(): boolean;
48
- /**
49
- * Check if valid Claude OAuth credentials exist in the Docker volume.
50
- * Returns true if OAuth credentials are stored (even if access token is expired,
51
- * since Claude Code handles refresh internally using stored refresh tokens).
52
- *
53
- * NOTE: This intentionally does NOT check for ANTHROPIC_API_KEY. If the user
54
- * has an API key but no OAuth credentials, we want to prompt them to set up
55
- * OAuth (which uses their Max subscription) rather than silently burning API credits.
56
- */
57
- export declare function dockerCredentialsExist(): boolean;
58
- /**
59
- * Get Docker credential info for display.
60
- * Returns expiration date and subscription type if available.
61
- */
62
- export declare function getDockerCredentialInfo(): {
63
- expiresAt: Date;
64
- subscriptionType?: string;
65
- } | null;
66
- /**
67
- * Check if Claude Code authentication is available on the host system.
68
- * Returns true if any of:
69
- * 1. ANTHROPIC_API_KEY environment variable is set
70
- * 2. OAuth credentials exist in ~/.claude/.credentials.json (Claude Code 1.x)
71
- * 3. OAuth credentials exist in macOS keychain (Claude Code 2.x)
72
- *
73
- * This is used to validate auth before spawning host sessions (e.g., orchestrator)
74
- * to avoid creating stuck sessions when the keychain is locked (SSH contexts).
75
- */
76
- export declare function hostCredentialsExist(): boolean;
77
- export declare function getExecutorCommand(executor: ExecutorType, prompt: string, skipPermissions?: boolean): {
78
- cmd: string;
79
- args: string[];
80
- };
81
- /**
82
- * Check if an executor is Claude Code.
83
- * Used to gate Claude-specific flags and configuration.
84
- */
85
- export declare function isClaudeExecutor(executor: ExecutorType): boolean;
86
- /**
87
- * Get the display name for an executor type.
88
- */
89
- export declare function getExecutorDisplayName(executor: ExecutorType): string;
90
- /**
91
- * Get the npm package name for an executor (for container installation).
92
- */
93
- export declare function getExecutorPackage(executor: ExecutorType): string | null;
94
- export interface PreflightResult {
95
- ok: boolean;
96
- error?: string;
97
- }
98
- /**
99
- * Check executor binary availability on host.
100
- */
101
- export declare function checkExecutorOnHost(executor: ExecutorType): PreflightResult;
102
- /**
103
- * Check executor binary availability inside a container.
104
- */
105
- export declare function checkExecutorInContainer(executor: ExecutorType, containerId: string): PreflightResult;
106
- /**
107
- * Run executor preflight checks for the target environment.
108
- */
109
- export declare function runExecutorPreflight(environment: ExecutionEnvironment, executor: ExecutorType, options?: {
110
- containerId?: string;
111
- }): PreflightResult;
112
- /**
113
- * Build the system prompt for orchestrator sessions.
114
- * This is injected via Claude Code's --system-prompt flag so the orchestrator
115
- * knows its role immediately without relying on CLAUDE.md.
116
- */
117
- export declare function buildOrchestratorSystemPrompt(context: ExecutionContext): string;
118
- export interface RunnerResult {
119
- success: boolean;
120
- pid?: string;
121
- containerId?: string;
122
- sessionId?: string;
123
- logPath?: string;
124
- error?: string;
125
- }
126
- export type Runner = (context: ExecutionContext, executor: ExecutorType, config: ExecutionConfig) => Promise<RunnerResult>;
127
- /**
128
- * Run command on the host machine with tmux session for persistence.
129
- * Supports multiple terminal emulators on macOS.
130
- *
131
- * Architecture (same as devcontainer):
132
- * - Always creates a host tmux session for session persistence
133
- * - displayMode controls whether to open a terminal tab attached to the session
134
- * - User can reattach with `prlt session attach` if tab is closed
135
- */
136
- export declare function runHost(context: ExecutionContext, executor: ExecutorType, config: ExecutionConfig, displayMode?: DisplayMode): Promise<RunnerResult>;
137
- /**
138
- * Check if GitHub token is available for git push operations.
139
- * Checks environment variables first, then tries gh auth token.
140
- * Returns the token if available, null otherwise.
141
- */
142
- export declare function getGitHubToken(): string | null;
143
- /**
144
- * Check if GitHub token is available.
145
- * Returns true if token is available via env vars or gh CLI.
146
- */
147
- export declare function isGitHubTokenAvailable(): boolean;
148
- /**
149
- * Docker daemon health check result (TKT-081).
150
- * Provides diagnostic info about why Docker isn't available.
151
- */
152
- export type DockerDaemonStatus = {
153
- available: boolean;
154
- /** 'ready' | 'not-installed' | 'daemon-not-ready' */
155
- reason: 'ready' | 'not-installed' | 'daemon-not-ready';
156
- /** Human-readable message for logging/display */
157
- message: string;
158
- };
159
- /**
160
- * Check Docker daemon health with fast detection (TKT-081).
161
- *
162
- * Uses `docker ps` with a 5-second timeout to quickly detect:
163
- * - Docker not installed
164
- * - Docker installed but daemon unresponsive (stuck on license, initializing, 500 errors)
165
- * - Docker ready
166
- *
167
- * Total worst-case time: ~5 seconds (single attempt with timeout).
168
- */
169
- export declare function checkDockerDaemon(): DockerDaemonStatus;
170
- /**
171
- * Check if Docker daemon is running.
172
- * Returns true if Docker is available and responsive.
173
- *
174
- * For detailed diagnostics, use checkDockerDaemon() instead.
175
- */
176
- export declare function isDockerRunning(): boolean;
177
- /**
178
- * Check if the devcontainer CLI is installed.
179
- * Returns true if the CLI is available, false otherwise.
180
- * @deprecated No longer required - we use raw Docker commands now
181
- */
182
- export declare function isDevcontainerCliInstalled(): boolean;
183
- /**
184
- * Get the container name for an agent.
185
- * Format: prlt-agent-{agentName}
186
- */
187
- export declare function getAgentContainerName(agentName: string): string;
188
- /**
189
- * Check if a Docker container exists (running or stopped).
190
- */
191
- export declare function containerExists(containerName: string): boolean;
192
- /**
193
- * Check if a Docker container is running.
194
- */
195
- export declare function isContainerRunning(containerName: string): boolean;
196
- /**
197
- * Get the container ID for a running container.
198
- */
199
- export declare function getContainerId(containerName: string): string | null;
200
- /**
201
- * Build the command to run Claude inside the container.
202
- * Uses docker exec for direct container access.
203
- * Uses a prompt file to avoid shell escaping issues.
204
- */
205
- export declare function buildDevcontainerCommand(context: ExecutionContext, executor: ExecutorType, promptFile: string, containerId?: string, outputMode?: OutputMode, permissionMode?: PermissionMode, displayMode?: DisplayMode, mcpConfigFile?: string): string;
206
- /**
207
- * Run command inside a Docker container.
208
- * Uses raw Docker commands for filesystem isolation - no devcontainer CLI required.
209
- * Agent can only access mounted worktrees and configured paths.
210
- *
211
- * @param displayMode - How to display output (terminal, foreground, background, tmux)
212
- * @param sessionManager - How to manage the session inside the container (tmux, direct)
213
- */
214
- export declare function runDevcontainer(context: ExecutionContext, executor: ExecutorType, config: ExecutionConfig, displayMode?: DisplayMode, sessionManager?: SessionManager): Promise<RunnerResult>;
215
- export declare function runDocker(context: ExecutionContext, executor: ExecutorType, config: ExecutionConfig): Promise<RunnerResult>;
216
- /**
217
- * Run orchestrator in a Docker container using the sibling container pattern.
218
- *
219
- * Architecture:
220
- * ```
221
- * Host Docker daemon
222
- * ├── orchestrator container (has /var/run/docker.sock mounted)
223
- * ├── agent-1 container (spawned by orchestrator, sibling)
224
- * ├── agent-2 container (spawned by orchestrator, sibling)
225
- * ```
226
- *
227
- * The orchestrator container needs:
228
- * - HQ directory mounted (proletariat-hq)
229
- * - Docker socket mounted (/var/run/docker.sock) — so it can spawn agent containers as siblings
230
- * - prlt CLI installed in the container
231
- * - OAuth credentials for Claude Code (via Docker volume)
232
- * - tmux for session persistence inside the container
233
- */
234
- export declare function runOrchestratorInDocker(context: ExecutionContext, executor: ExecutorType, config: ExecutionConfig, options?: {
235
- displayMode?: DisplayMode;
236
- sessionName?: string;
237
- }): Promise<RunnerResult>;
238
- /**
239
- * Check if srt (sandbox-runtime) is installed on the host.
240
- */
241
- export declare function isSrtInstalled(): boolean;
242
- /**
243
- * Build the srt command with filesystem and network restrictions.
244
- *
245
- * Filesystem policy (read-restriction philosophy from claude-code-sandbox):
246
- * - Read/write: agent worktree directory
247
- * - Read-only: repo source (if different from worktree)
248
- * - Read-only: additional configured read paths
249
- * - Deny: home directory, system paths, other repos
4
+ * This file has been refactored into separate modules under ./runners/.
5
+ * All exports are preserved for backwards compatibility.
250
6
  *
251
- * Network policy:
252
- * - Allow: configured domains (GitHub, Anthropic API, npm registries, etc.)
253
- * - Deny: everything else
254
- */
255
- export declare function buildSrtCommand(innerCommand: string, context: ExecutionContext, config: ExecutionConfig): string;
256
- /**
257
- * Run command in an srt sandbox on the host machine.
258
- * Uses the same tmux session approach as the host runner, but wraps the
259
- * executor command with srt for filesystem and network isolation.
260
- *
261
- * Falls back to host runner with warning if srt is not installed.
262
- */
263
- export declare function runSandbox(context: ExecutionContext, executor: ExecutorType, config: ExecutionConfig, displayMode?: DisplayMode): Promise<RunnerResult>;
264
- /**
265
- * Run command on a remote machine (cloud) via SSH.
266
- * Formerly 'runVm' — renamed to reflect the simplified environment hierarchy.
267
- * Uses cloud config with fallback to legacy vm config for backwards compatibility.
7
+ * @see ./runners/index.ts — Dispatcher and re-exports
8
+ * @see ./runners/shared.ts Shared utilities
9
+ * @see ./runners/host.ts Host runner
10
+ * @see ./runners/devcontainer.ts — Devcontainer runner
11
+ * @see ./runners/docker.ts Docker runner
12
+ * @see ./runners/orchestrator.ts — Orchestrator-in-Docker runner
13
+ * @see ./runners/sandbox.ts Sandbox runner
14
+ * @see ./runners/cloud.ts Cloud/VM runner
268
15
  */
269
- export declare function runCloud(context: ExecutionContext, executor: ExecutorType, config: ExecutionConfig, host?: string): Promise<RunnerResult>;
270
- /** @deprecated Use runCloud instead */
271
- export declare const runVm: typeof runCloud;
272
- export declare function runExecution(environment: ExecutionEnvironment, context: ExecutionContext, executor: ExecutorType, config?: ExecutionConfig, options?: {
273
- host?: string;
274
- displayMode?: DisplayMode;
275
- sessionManager?: SessionManager;
276
- }): Promise<RunnerResult>;
16
+ export * from './runners/index.js';