@proletariat/cli 0.3.69 → 0.3.70

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 (53) 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/oclif.manifest.json +1426 -1426
  53. package/package.json +1 -1
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Executor Command Helpers
3
+ *
4
+ * Functions for building executor commands, checking executor availability,
5
+ * and running preflight checks across different execution environments.
6
+ */
7
+ import { ExecutionEnvironment, ExecutorType } from '../types.js';
8
+ export declare function getExecutorCommand(executor: ExecutorType, prompt: string, skipPermissions?: boolean): {
9
+ cmd: string;
10
+ args: string[];
11
+ };
12
+ /**
13
+ * Check if an executor is Claude Code.
14
+ */
15
+ export declare function isClaudeExecutor(executor: ExecutorType): boolean;
16
+ /**
17
+ * Get the display name for an executor type.
18
+ */
19
+ export declare function getExecutorDisplayName(executor: ExecutorType): string;
20
+ /**
21
+ * Get the npm package name for an executor (for container installation).
22
+ */
23
+ export declare function getExecutorPackage(executor: ExecutorType): string | null;
24
+ export interface PreflightResult {
25
+ ok: boolean;
26
+ error?: string;
27
+ }
28
+ /**
29
+ * Check executor binary availability on host.
30
+ */
31
+ export declare function checkExecutorOnHost(executor: ExecutorType): PreflightResult;
32
+ /**
33
+ * Check executor binary availability inside a container.
34
+ */
35
+ export declare function checkExecutorInContainer(executor: ExecutorType, containerId: string): PreflightResult;
36
+ /**
37
+ * Run executor preflight checks for the target environment.
38
+ */
39
+ export declare function runExecutorPreflight(environment: ExecutionEnvironment, executor: ExecutorType, options?: {
40
+ containerId?: string;
41
+ }): PreflightResult;
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Executor Command Helpers
3
+ *
4
+ * Functions for building executor commands, checking executor availability,
5
+ * and running preflight checks across different execution environments.
6
+ */
7
+ import { execSync } from 'node:child_process';
8
+ import { normalizeEnvironment, } from '../types.js';
9
+ import { getCodexCommand } from '../codex-adapter.js';
10
+ export function getExecutorCommand(executor, prompt, skipPermissions = true) {
11
+ switch (executor) {
12
+ case 'claude-code':
13
+ if (skipPermissions) {
14
+ return { cmd: 'claude', args: ['--permission-mode', 'bypassPermissions', '--dangerously-skip-permissions', '--effort', 'high', prompt] };
15
+ }
16
+ return { cmd: 'claude', args: [prompt] };
17
+ case 'codex': {
18
+ const codexPermission = skipPermissions ? 'danger' : 'safe';
19
+ const codexResult = getCodexCommand(prompt, codexPermission, 'interactive');
20
+ return { cmd: codexResult.cmd, args: codexResult.args };
21
+ }
22
+ case 'custom':
23
+ return { cmd: 'echo', args: ['Custom executor not configured'] };
24
+ default:
25
+ if (skipPermissions) {
26
+ return { cmd: 'claude', args: ['--permission-mode', 'bypassPermissions', '--dangerously-skip-permissions', '--effort', 'high', prompt] };
27
+ }
28
+ return { cmd: 'claude', args: [prompt] };
29
+ }
30
+ }
31
+ /**
32
+ * Check if an executor is Claude Code.
33
+ */
34
+ export function isClaudeExecutor(executor) {
35
+ return executor === 'claude-code';
36
+ }
37
+ /**
38
+ * Get the display name for an executor type.
39
+ */
40
+ export function getExecutorDisplayName(executor) {
41
+ switch (executor) {
42
+ case 'claude-code': return 'Claude Code';
43
+ case 'codex': return 'Codex';
44
+ case 'custom': return 'Custom';
45
+ default: return 'Claude Code';
46
+ }
47
+ }
48
+ /**
49
+ * Get the npm package name for an executor (for container installation).
50
+ */
51
+ export function getExecutorPackage(executor) {
52
+ switch (executor) {
53
+ case 'claude-code': return '@anthropic-ai/claude-code';
54
+ case 'codex': return '@openai/codex';
55
+ case 'custom': return null;
56
+ default: return '@anthropic-ai/claude-code';
57
+ }
58
+ }
59
+ /**
60
+ * Check executor binary availability on host.
61
+ */
62
+ export function checkExecutorOnHost(executor) {
63
+ const { cmd } = getExecutorCommand(executor, 'preflight');
64
+ try {
65
+ execSync(`command -v ${cmd}`, { stdio: 'pipe' });
66
+ return { ok: true };
67
+ }
68
+ catch {
69
+ const pkg = getExecutorPackage(executor);
70
+ const installHint = pkg ? `Install it with: npm install -g ${pkg}` : 'Install and configure the executor binary.';
71
+ return {
72
+ ok: false,
73
+ error: `${getExecutorDisplayName(executor)} CLI not found on host (missing "${cmd}"). ${installHint}`,
74
+ };
75
+ }
76
+ }
77
+ /**
78
+ * Check executor binary availability inside a container.
79
+ */
80
+ export function checkExecutorInContainer(executor, containerId) {
81
+ const { cmd } = getExecutorCommand(executor, 'preflight');
82
+ try {
83
+ execSync(`docker exec ${containerId} sh -lc 'command -v ${cmd}'`, { stdio: 'pipe' });
84
+ return { ok: true };
85
+ }
86
+ catch {
87
+ const pkg = getExecutorPackage(executor);
88
+ const installHint = pkg ? `Container image is missing ${pkg}.` : `Container image is missing "${cmd}".`;
89
+ return {
90
+ ok: false,
91
+ error: `${getExecutorDisplayName(executor)} CLI not found in container (missing "${cmd}"). ${installHint}`,
92
+ };
93
+ }
94
+ }
95
+ /**
96
+ * Run executor preflight checks for the target environment.
97
+ */
98
+ export function runExecutorPreflight(environment, executor, options) {
99
+ const env = normalizeEnvironment(environment);
100
+ if (env === 'host' || env === 'sandbox') {
101
+ return checkExecutorOnHost(executor);
102
+ }
103
+ if (env === 'devcontainer' && options?.containerId) {
104
+ return checkExecutorInContainer(executor, options.containerId);
105
+ }
106
+ return { ok: true };
107
+ }
108
+ //# sourceMappingURL=executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../src/lib/execution/runners/executor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAIL,oBAAoB,GACrB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,MAAM,UAAU,kBAAkB,CAAC,QAAsB,EAAE,MAAc,EAAE,kBAA2B,IAAI;IACxG,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,aAAa;YAChB,IAAI,eAAe,EAAE,CAAC;gBACpB,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,gCAAgC,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;YAC1I,CAAC;YACD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,CAAA;QAC1C,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,MAAM,eAAe,GAAmB,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAA;YAC3E,MAAM,WAAW,GAAG,eAAe,CAAC,MAAM,EAAE,eAAe,EAAE,aAAa,CAAC,CAAA;YAC3E,OAAO,EAAE,GAAG,EAAE,WAAW,CAAC,GAAG,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,CAAA;QACzD,CAAC;QACD,KAAK,QAAQ;YACX,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,gCAAgC,C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G,KAAK,MAAM,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACxC,OAAO,mBAAmB,CAAC,QAAQ,CAAC,CAAA;IACtC,CAAC;IAED,IAAI,GAAG,KAAK,cAAc,IAAI,OAAO,EAAE,WAAW,EAAE,CAAC;QACnD,OAAO,wBAAwB,CAAC,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;IAChE,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAA;AACrB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Host Runner — tmux session persistence on macOS
3
+ */
4
+ import { DisplayMode, ExecutorType, ExecutionContext, ExecutionConfig, RunnerResult } from './shared.js';
5
+ /**
6
+ * Run command on the host machine with tmux session for persistence.
7
+ * Supports multiple terminal emulators on macOS.
8
+ *
9
+ * Architecture (same as devcontainer):
10
+ * - Always creates a host tmux session for session persistence
11
+ * - displayMode controls whether to open a terminal tab attached to the session
12
+ * - User can reattach with `prlt session attach` if tab is closed
13
+ */
14
+ export declare function runHost(context: ExecutionContext, executor: ExecutorType, config: ExecutionConfig, displayMode?: DisplayMode): Promise<RunnerResult>;
@@ -0,0 +1,437 @@
1
+ /**
2
+ * Host Runner — tmux session persistence on macOS
3
+ */
4
+ import { execSync, fs, path, os, getSetTitleCommands, resolveCodexExecutionContext, validateCodexMode, getCodexCommand, resolveToolsForSpawn, buildWindowTitle, buildTmuxWindowName, buildPrompt, buildOrchestratorSystemPrompt, getExecutorCommand, isClaudeExecutor, shouldUseControlMode, buildTmuxMouseOption, buildTmuxAttachCommand, configureITermTmuxWindowMode, } from './shared.js';
5
+ import { buildSrtCommand } from './sandbox.js';
6
+ /**
7
+ * Run command on the host machine with tmux session for persistence.
8
+ * Supports multiple terminal emulators on macOS.
9
+ *
10
+ * Architecture (same as devcontainer):
11
+ * - Always creates a host tmux session for session persistence
12
+ * - displayMode controls whether to open a terminal tab attached to the session
13
+ * - User can reattach with `prlt session attach` if tab is closed
14
+ */
15
+ export async function runHost(context, executor, config, displayMode = 'terminal') {
16
+ // Session name: {ticketId}-{action} (e.g., TKT-347-implement)
17
+ const sessionName = buildTmuxWindowName(context);
18
+ const windowTitle = buildWindowTitle(context);
19
+ const prompt = buildPrompt(context);
20
+ // Terminal - use permission mode setting
21
+ const skipPermissions = config.permissionMode === 'danger';
22
+ // Validate Codex mode combination before proceeding
23
+ if (executor === 'codex') {
24
+ const codexPermission = config.permissionMode;
25
+ const codexContext = resolveCodexExecutionContext(displayMode, config.outputMode);
26
+ const modeError = validateCodexMode(codexPermission, codexContext);
27
+ if (modeError) {
28
+ return { success: false, error: modeError.message };
29
+ }
30
+ }
31
+ const { cmd, args } = getExecutorCommand(executor, prompt, skipPermissions);
32
+ // Write command to temp script to avoid shell escaping issues
33
+ // Use HQ .proletariat/scripts if available, otherwise fallback to home dir
34
+ const baseDir = context.hqPath
35
+ ? path.join(context.hqPath, '.proletariat', 'scripts')
36
+ : path.join(os.homedir(), '.proletariat', 'scripts');
37
+ fs.mkdirSync(baseDir, { recursive: true });
38
+ const timestamp = Date.now();
39
+ const scriptPath = path.join(baseDir, `exec-${context.ticketId}-${timestamp}.sh`);
40
+ const promptPath = path.join(baseDir, `prompt-${context.ticketId}-${timestamp}.txt`);
41
+ // For orchestrator sessions with Claude Code, split the prompt:
42
+ // - System prompt (role/tools/context) → injected via --system-prompt flag
43
+ // - User message (action instructions or default) → passed as the initial message
44
+ // Non-Claude executors get the full combined prompt as the user message.
45
+ let systemPromptPath = null;
46
+ if (context.isOrchestrator && isClaudeExecutor(executor)) {
47
+ const systemPrompt = buildOrchestratorSystemPrompt(context);
48
+ systemPromptPath = path.join(baseDir, `system-prompt-${context.ticketId}-${timestamp}.txt`);
49
+ fs.writeFileSync(systemPromptPath, systemPrompt, { mode: 0o644 });
50
+ // Override user message: just action instructions or a default startup message
51
+ const userMessage = context.actionPrompt
52
+ || 'Assess the current state of the project:\n'
53
+ + '1. Check the board: `prlt board view` — what tickets are in progress, blocked, or ready?\n'
54
+ + '2. List running agents: `prlt session list` — who is working on what? Any stale sessions?\n'
55
+ + '3. Check open PRs: `gh pr list` — any PRs ready for review or merge?\n'
56
+ + '4. Summarize what needs attention and recommend next actions.';
57
+ fs.writeFileSync(promptPath, userMessage, { mode: 0o644 });
58
+ }
59
+ else {
60
+ // Write full prompt (includes role context for non-Claude executors)
61
+ fs.writeFileSync(promptPath, prompt, { mode: 0o644 });
62
+ }
63
+ // Tool registry (TKT-083): generate MCP config for Claude Code
64
+ let mcpConfigPath = null;
65
+ if (context.hqPath && isClaudeExecutor(executor)) {
66
+ const toolsResult = resolveToolsForSpawn(context.hqPath, context.toolPolicy, baseDir);
67
+ mcpConfigPath = toolsResult.mcpConfigPath;
68
+ }
69
+ // Build the executor command using getExecutorCommand() output
70
+ // For Claude Code, we also support outputMode and additional flags
71
+ // For Codex, we use the codex adapter for deterministic command building (TKT-080)
72
+ // For other executors, we use the command as-is from getExecutorCommand()
73
+ let executorInvocation;
74
+ if (isClaudeExecutor(executor)) {
75
+ // Build flags based on config - Claude-specific flags
76
+ // PRLT-948: --permission-mode bypassPermissions skips the "trust this folder" dialog.
77
+ // Without it, Claude Code shows a workspace trust prompt in new worktrees and the
78
+ // agent sits idle waiting for user input that never comes in automated tmux sessions.
79
+ const bypassTrustFlag = skipPermissions ? '--permission-mode bypassPermissions ' : '';
80
+ const permissionsFlag = skipPermissions ? '--dangerously-skip-permissions ' : '';
81
+ // outputMode: 'print' adds -p flag (final result only), 'interactive' shows streaming UI
82
+ const printFlag = config.outputMode === 'print' ? '-p ' : '';
83
+ // --effort high: skips the effort level prompt for automated agents (TKT-1134)
84
+ const effortFlag = skipPermissions ? '--effort high ' : '';
85
+ // Orchestrator sessions inject their role via --system-prompt
86
+ const systemPromptFlag = systemPromptPath ? '--system-prompt "$(cat "$SYSTEM_PROMPT_PATH")" ' : '';
87
+ // TKT-053: Disable plan mode for background agents — prevents silent stalls
88
+ // when there's no user to approve the plan mode transition
89
+ const disallowPlanFlag = displayMode === 'background' ? '--disallowedTools EnterPlanMode ' : '';
90
+ // Tool registry (TKT-083): pass MCP config to Claude Code via --mcp-config flag
91
+ const mcpConfigFlag = mcpConfigPath ? `--mcp-config "${mcpConfigPath}" ` : '';
92
+ // PRLT-950: Use -- to separate flags from positional prompt argument.
93
+ // --disallowedTools is variadic and will consume the prompt as its second arg without --.
94
+ executorInvocation = `${cmd} ${bypassTrustFlag}${permissionsFlag}${effortFlag}${printFlag}${disallowPlanFlag}${systemPromptFlag}${mcpConfigFlag}-- "$(cat "$PROMPT_PATH")"`;
95
+ }
96
+ else if (executor === 'codex') {
97
+ // TKT-080: Use Codex adapter for deterministic command building.
98
+ // Uses PLACEHOLDER pattern for reliable prompt replacement (same as devcontainer runner).
99
+ const codexPermission = config.permissionMode;
100
+ const codexContext = resolveCodexExecutionContext(displayMode, config.outputMode);
101
+ const codexResult = getCodexCommand('PLACEHOLDER', codexPermission, codexContext);
102
+ const argsStr = codexResult.args.map(a => a === 'PLACEHOLDER' ? '"$(cat "$PROMPT_PATH")"' : a).join(' ');
103
+ executorInvocation = `${codexResult.cmd} ${argsStr}`;
104
+ }
105
+ else {
106
+ // Non-Claude, non-Codex executors: build command from getExecutorCommand() args
107
+ // Use PLACEHOLDER for reliable prompt replacement instead of fragile string comparison
108
+ const { cmd: execCmd, args: execArgs } = getExecutorCommand(executor, 'PLACEHOLDER', skipPermissions);
109
+ const argsWithFile = execArgs.map(a => a === 'PLACEHOLDER' ? '"$(cat "$PROMPT_PATH")"' : `"${a}"`);
110
+ executorInvocation = `${execCmd} ${argsWithFile.join(' ')}`;
111
+ }
112
+ // Build script that runs executor and keeps shell open after completion
113
+ const setTitleCmds = getSetTitleCommands(windowTitle);
114
+ // TKT-941: Export SYSTEM_PROMPT_PATH so it's available inside srt sandbox child processes.
115
+ // Without export, `bash -c '...'` inside srt can't access the variable.
116
+ const systemPromptVar = systemPromptPath ? `\nexport SYSTEM_PROMPT_PATH="${systemPromptPath}"` : '';
117
+ // Ephemeral agents auto-close after completion instead of dropping to interactive shell
118
+ const postExecBlock = context.isEphemeral
119
+ ? `
120
+ echo ""
121
+ echo "✅ Ephemeral agent work complete. Session will auto-close in 5s..."
122
+ sleep 5
123
+ exit 0
124
+ `
125
+ : `
126
+ echo ""
127
+ echo "✅ Agent work complete. Press Enter to close or run more commands."
128
+ exec $SHELL
129
+ `;
130
+ // Wrap with srt sandbox if running in sandbox environment
131
+ let finalInvocation = executorInvocation;
132
+ if (context.executionEnvironment === 'sandbox') {
133
+ // Build the srt wrapper command
134
+ // The inner command is the executor invocation that reads from PROMPT_PATH
135
+ const srtCmd = buildSrtCommand(`bash -c '${executorInvocation.replace(/'/g, "'\\''")}'`, context, config);
136
+ finalInvocation = srtCmd;
137
+ }
138
+ // TKT-099: Build a fallback invocation WITHOUT the prompt argument.
139
+ // Used when prompt file is missing/empty — starts Claude in interactive mode
140
+ // so the agent at least gets a working session instead of silently failing.
141
+ let fallbackInvocation;
142
+ if (isClaudeExecutor(executor)) {
143
+ const fbBypassTrust = skipPermissions ? '--permission-mode bypassPermissions ' : '';
144
+ const fbPermissions = skipPermissions ? '--dangerously-skip-permissions ' : '';
145
+ const fbEffort = skipPermissions ? '--effort high ' : '';
146
+ const fbPrint = config.outputMode === 'print' ? '-p ' : '';
147
+ const fbDisallowPlan = displayMode === 'background' ? '--disallowedTools EnterPlanMode ' : '';
148
+ const fbSystemPrompt = systemPromptPath ? '--system-prompt "$(cat "$SYSTEM_PROMPT_PATH")" ' : '';
149
+ const fbMcpConfig = mcpConfigPath ? `--mcp-config "${mcpConfigPath}" ` : '';
150
+ fallbackInvocation = `${cmd} ${fbBypassTrust}${fbPermissions}${fbEffort}${fbPrint}${fbDisallowPlan}${fbSystemPrompt}${fbMcpConfig}`.trim();
151
+ }
152
+ else {
153
+ fallbackInvocation = cmd;
154
+ }
155
+ const scriptContent = `#!/bin/bash
156
+ # Auto-generated script for ticket ${context.ticketId}
157
+ SCRIPT_PATH="${scriptPath}"
158
+ # TKT-941: Export PROMPT_PATH so it's available inside srt sandbox child processes.
159
+ # When running in sandbox mode, the executor is wrapped with:
160
+ # srt ... -- bash -c 'claude ... "$(cat "$PROMPT_PATH")"'
161
+ # Without export, the inner bash started by srt cannot access PROMPT_PATH,
162
+ # causing $(cat "$PROMPT_PATH") to expand to empty and the agent to start idle.
163
+ export PROMPT_PATH="${promptPath}"${systemPromptVar}
164
+ ${setTitleCmds}
165
+ echo "🚀 Starting: ${sessionName}"
166
+ ${context.executionEnvironment === 'sandbox' ? 'echo "🔒 Running in srt sandbox (filesystem + network isolation)"' : ''}
167
+ echo ""
168
+ cd "${context.worktreePath}"
169
+
170
+ # TKT-099: Robust prompt loading — wait for file and verify content before passing to executor.
171
+ # Prevents race where the prompt file isn't flushed/synced yet (e.g., Docker file-sharing
172
+ # delay, tmux server restart, or transient filesystem latency).
173
+ PROMPT_WAIT=0
174
+ while [ ! -s "$PROMPT_PATH" ] && [ $PROMPT_WAIT -lt 30 ]; do
175
+ sleep 0.5
176
+ PROMPT_WAIT=$((PROMPT_WAIT + 1))
177
+ done
178
+
179
+ if [ ! -s "$PROMPT_PATH" ]; then
180
+ echo "⚠️ Warning: Prompt file not available after 15s. Starting in interactive mode."
181
+ echo " Expected: $PROMPT_PATH"
182
+ # Fallback: launch executor without prompt so the session isn't lost
183
+ (unset CLAUDECODE CLAUDE_CODE_ENTRYPOINT; ${fallbackInvocation})
184
+ else
185
+ # Run executor in subshell with CLAUDECODE unset (prevents nested session error)
186
+ (unset CLAUDECODE CLAUDE_CODE_ENTRYPOINT; ${finalInvocation})
187
+ fi
188
+
189
+ # Clean up script and prompt files
190
+ rm -f "$SCRIPT_PATH" "$PROMPT_PATH"${systemPromptPath ? ' "$SYSTEM_PROMPT_PATH"' : ''}
191
+ ${postExecBlock}`;
192
+ fs.writeFileSync(scriptPath, scriptContent, { mode: 0o755 });
193
+ try {
194
+ // Check if tmux is available
195
+ execSync('which tmux', { stdio: 'pipe' });
196
+ const terminalApp = config.terminal.app;
197
+ // Check if we should use iTerm control mode (-CC)
198
+ // When using -CC, iTerm handles scrolling/selection natively, so we DON'T set mouse on
199
+ // Without -CC, we need mouse on for tmux to handle scrolling
200
+ const useControlMode = shouldUseControlMode(terminalApp, config.tmux.controlMode);
201
+ // Step 1: Create host tmux session (detached)
202
+ // Only enable mouse mode if NOT using control mode (control mode lets iTerm handle mouse natively)
203
+ const mouseOption = buildTmuxMouseOption(useControlMode);
204
+ const tmuxCmd = `tmux new-session -d -s "${sessionName}" -n "${sessionName}" "${scriptPath}"${mouseOption} \\; set-option -g set-titles on \\; set-option -g set-titles-string "#{window_name}"`;
205
+ try {
206
+ execSync(tmuxCmd, { stdio: 'pipe' });
207
+ }
208
+ catch (error) {
209
+ return {
210
+ success: false,
211
+ error: `Failed to create tmux session: ${error instanceof Error ? error.message : error}`,
212
+ };
213
+ }
214
+ // Step 2: Open terminal tab attached to tmux session (unless background or foreground mode)
215
+ if (displayMode === 'background') {
216
+ return {
217
+ success: true,
218
+ sessionId: sessionName,
219
+ };
220
+ }
221
+ // Foreground mode: attach to tmux session in current terminal (blocking)
222
+ if (displayMode === 'foreground') {
223
+ try {
224
+ // Clear screen and attach - this blocks until user detaches or claude exits
225
+ // Never use -CC in foreground mode: control mode sends raw tmux protocol
226
+ // sequences (%begin, %output, %end) that render as garbled text unless
227
+ // iTerm's native CC handler is active (only happens in new tabs opened via AppleScript)
228
+ const fgTmuxAttach = buildTmuxAttachCommand(false);
229
+ execSync(`clear && ${fgTmuxAttach} -t "${sessionName}"`, { stdio: 'inherit' });
230
+ return {
231
+ success: true,
232
+ sessionId: sessionName,
233
+ };
234
+ }
235
+ catch (error) {
236
+ return {
237
+ success: false,
238
+ error: `Failed to attach to tmux session: ${error instanceof Error ? error.message : error}`,
239
+ };
240
+ }
241
+ }
242
+ // Use tmux -CC (control mode) for iTerm when enabled in config
243
+ // -CC gives native iTerm scrolling, selection, and gesture support
244
+ // Without -CC, use regular attach (relies on mouse mode for scrolling)
245
+ const tmuxAttach = buildTmuxAttachCommand(useControlMode);
246
+ const attachCmd = `clear && ${tmuxAttach} -t \\"${sessionName}\\"`;
247
+ // For iTerm with control mode, create a new tab and run -CC attach there
248
+ // This avoids interfering with the terminal where prlt is running
249
+ if (terminalApp === 'iTerm' && useControlMode) {
250
+ // Configure iTerm to open tmux windows as tabs or windows based on user preference
251
+ configureITermTmuxWindowMode(config.tmux.windowMode);
252
+ const openInBackground = config.terminal.openInBackground ?? true;
253
+ if (openInBackground) {
254
+ // Open tab without stealing focus - save frontmost app and restore after
255
+ execSync(`osascript -e '
256
+ set frontApp to path to frontmost application as text
257
+ tell application "iTerm"
258
+ tell current window
259
+ set newTab to (create tab with default profile)
260
+ tell current session of newTab
261
+ write text "tmux -u -CC attach -d -t \\"${sessionName}\\""
262
+ end tell
263
+ end tell
264
+ end tell
265
+ tell application frontApp to activate
266
+ '`);
267
+ }
268
+ else {
269
+ execSync(`osascript -e '
270
+ tell application "iTerm"
271
+ activate
272
+ tell current window
273
+ set newTab to (create tab with default profile)
274
+ tell current session of newTab
275
+ write text "tmux -u -CC attach -d -t \\"${sessionName}\\""
276
+ end tell
277
+ end tell
278
+ end tell
279
+ '`);
280
+ }
281
+ return {
282
+ success: true,
283
+ sessionId: sessionName,
284
+ };
285
+ }
286
+ // Check if we should open in background (don't steal focus)
287
+ const openInBackground = config.terminal.openInBackground ?? true;
288
+ switch (terminalApp) {
289
+ case 'iTerm':
290
+ // Without control mode, create a new tab and attach normally
291
+ // When openInBackground is true, save frontmost app and restore after
292
+ if (openInBackground) {
293
+ execSync(`osascript -e '
294
+ -- Save the currently active application and window
295
+ tell application "System Events"
296
+ set frontApp to name of first application process whose frontmost is true
297
+ set frontAppBundle to bundle identifier of first application process whose frontmost is true
298
+ end tell
299
+
300
+ tell application "iTerm"
301
+ if (count of windows) = 0 then
302
+ create window with default profile
303
+ delay 0.3
304
+ tell current session of current window
305
+ set name to "${windowTitle}"
306
+ write text "${attachCmd}"
307
+ end tell
308
+ else
309
+ tell current window
310
+ set newTab to (create tab with default profile)
311
+ delay 0.3
312
+ tell current session of newTab
313
+ set name to "${windowTitle}"
314
+ write text "${attachCmd}"
315
+ end tell
316
+ end tell
317
+ end if
318
+ end tell
319
+
320
+ -- Restore focus to the original application
321
+ delay 0.2
322
+ tell application "System Events"
323
+ set frontmost of process frontApp to true
324
+ end tell
325
+ delay 0.1
326
+ do shell script "open -b " & quoted form of frontAppBundle
327
+ '`);
328
+ }
329
+ else {
330
+ execSync(`osascript -e '
331
+ tell application "iTerm"
332
+ activate
333
+ if (count of windows) = 0 then
334
+ create window with default profile
335
+ delay 0.3
336
+ tell current session of current window
337
+ set name to "${windowTitle}"
338
+ write text "${attachCmd}"
339
+ end tell
340
+ else
341
+ tell current window
342
+ set newTab to (create tab with default profile)
343
+ delay 0.3
344
+ tell current session of newTab
345
+ set name to "${windowTitle}"
346
+ write text "${attachCmd}"
347
+ end tell
348
+ end tell
349
+ end if
350
+ end tell
351
+ '`);
352
+ }
353
+ break;
354
+ case 'Ghostty':
355
+ // Ghostty - use osascript to open new tab and run command
356
+ execSync(`osascript -e '
357
+ tell application "Ghostty"
358
+ activate
359
+ end tell
360
+ tell application "System Events"
361
+ tell process "Ghostty"
362
+ keystroke "t" using command down
363
+ delay 0.3
364
+ keystroke "${attachCmd}"
365
+ keystroke return
366
+ end tell
367
+ end tell
368
+ '`);
369
+ break;
370
+ case 'WezTerm':
371
+ // WezTerm - use wezterm cli to spawn new tab
372
+ execSync(`wezterm cli spawn --new-window -- bash -c '${attachCmd}'`);
373
+ break;
374
+ case 'Kitty':
375
+ // Kitty - use kitten to open new tab
376
+ execSync(`kitty @ launch --type=tab -- bash -c '${attachCmd}'`);
377
+ break;
378
+ case 'Alacritty':
379
+ // Alacritty doesn't have native tab support, opens new window
380
+ execSync(`osascript -e '
381
+ tell application "Alacritty"
382
+ activate
383
+ end tell
384
+ tell application "System Events"
385
+ tell process "Alacritty"
386
+ keystroke "n" using command down
387
+ delay 0.3
388
+ keystroke "${attachCmd}"
389
+ keystroke return
390
+ end tell
391
+ end tell
392
+ '`);
393
+ break;
394
+ case 'Terminal':
395
+ default:
396
+ // macOS Terminal.app - new tab
397
+ // Note: Terminal.app with System Events keystrokes requires activation for Cmd+T
398
+ // But we can use 'do script' which opens a new window without activation if needed
399
+ if (openInBackground) {
400
+ // Open in background: use 'do script' which creates a new window without activating
401
+ execSync(`osascript -e '
402
+ tell application "Terminal"
403
+ do script "${attachCmd}"
404
+ set custom title of front window to "${windowTitle}"
405
+ end tell
406
+ '`);
407
+ }
408
+ else {
409
+ // Bring to front: use traditional Cmd+T for new tab
410
+ execSync(`osascript -e '
411
+ tell application "Terminal"
412
+ activate
413
+ tell application "System Events"
414
+ tell process "Terminal"
415
+ keystroke "t" using command down
416
+ end tell
417
+ end tell
418
+ delay 0.3
419
+ do script "${attachCmd}" in front window
420
+ end tell
421
+ '`);
422
+ }
423
+ break;
424
+ }
425
+ return {
426
+ success: true,
427
+ sessionId: sessionName,
428
+ };
429
+ }
430
+ catch (error) {
431
+ return {
432
+ success: false,
433
+ error: error instanceof Error ? error.message : `Failed to start host tmux session`,
434
+ };
435
+ }
436
+ }
437
+ //# sourceMappingURL=host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.js","sourceRoot":"","sources":["../../../../src/lib/execution/runners/host.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAEa,mBAAmB,EACtD,4BAA4B,EAAE,iBAAiB,EAAE,eAAe,EAAE,oBAAoB,EACtD,gBAAgB,EAAE,mBAAmB,EACrE,WAAW,EAAE,6BAA6B,EAAE,kBAAkB,EAAE,gBAAgB,EAChF,oBAAoB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,4BAA4B,GACjG,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C;;;;;;;;GAQG;AACH,MAAM,CAAC,K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/D,MAAK;YAEP,KAAK,WAAW;gBACd,8DAA8D;gBAC9D,QAAQ,CAAC;;;;;;;;2BAQU,SAAS;;;;UAI1B,CAAC,CAAA;gBACH,MAAK;YAEP,KAAK,UAAU,CAAC;YAChB;gBACE,+BAA+B;gBAC/B,iFAAiF;gBACjF,mFAAmF;gBACnF,IAAI,gBAAgB,EAAE,CAAC;oBACrB,oFAAoF;oBACpF,QAAQ,CAAC;;2BAEQ,SAAS;qDACiB,WAAW;;YAEpD,CAAC,CAAA;gBACL,CAAC;qBAAM,CAAC;oBACN,oDAAoD;oBACpD,QAAQ,CAAC;;;;;;;;;2BASQ,SAAS;;YAExB,CAAC,CAAA;gBACL,CAAC;gBACD,MAAK;QACT,CAAC;QAED,OAAO;YACL,OAAO,EAAE,IAAI;YACb,SAAS,EAAE,WAAW;SACvB,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,mCAAmC;SACpF,CAAA;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Execution Runners
3
+ *
4
+ * Dispatcher and re-exports for all execution environment runners.
5
+ * Each runner is in its own module for independent testability and maintainability.
6
+ *
7
+ * Modules:
8
+ * - shared.ts — Shared utilities (session names, credentials, docker, prompts, etc.)
9
+ * - host.ts — Host runner with tmux session persistence
10
+ * - devcontainer.ts — Docker container runner with raw Docker commands
11
+ * - docker.ts — Simple detached Docker container runner
12
+ * - orchestrator.ts — Orchestrator-in-Docker runner (sibling container pattern)
13
+ * - sandbox.ts — srt sandbox runner (wraps host runner)
14
+ * - cloud.ts — Remote execution via SSH
15
+ */
16
+ import { ExecutionEnvironment, DisplayMode, SessionManager, ExecutorType, ExecutionContext, ExecutionConfig } from './shared.js';
17
+ import { RunnerResult } from './shared.js';
18
+ export declare function runExecution(environment: ExecutionEnvironment, context: ExecutionContext, executor: ExecutorType, config?: ExecutionConfig, options?: {
19
+ host?: string;
20
+ displayMode?: DisplayMode;
21
+ sessionManager?: SessionManager;
22
+ }): Promise<RunnerResult>;
23
+ export { RunnerResult, Runner, buildSessionName, buildWindowTitle, buildTmuxWindowName, shouldUseControlMode, buildTmuxMouseOption, buildTmuxAttachCommand, configureITermTmuxPreferences, configureITermTmuxWindowMode, CLAUDE_CREDENTIALS_VOLUME, credentialsVolumeExists, dockerCredentialsExist, getDockerCredentialInfo, hostCredentialsExist, getExecutorCommand, isClaudeExecutor, getExecutorDisplayName, getExecutorPackage, PreflightResult, checkExecutorOnHost, checkExecutorInContainer, runExecutorPreflight, getGitHubToken, isGitHubTokenAvailable, DockerDaemonStatus, checkDockerDaemon, isDockerRunning, isDevcontainerCliInstalled, getHostPrltVersion, getAgentContainerName, containerExists, isContainerRunning, getContainerId, buildPrompt, buildOrchestratorSystemPrompt, buildIntegrationCommandsSection, } from './shared.js';
24
+ export { runHost } from './host.js';
25
+ export { runDevcontainer, buildDevcontainerCommand } from './devcontainer.js';
26
+ export { runDocker } from './docker.js';
27
+ export { runOrchestratorInDocker } from './orchestrator.js';
28
+ export { runSandbox, isSrtInstalled, buildSrtCommand } from './sandbox.js';
29
+ export { runCloud, runVm } from './cloud.js';