MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / composeCommand

Function composeCommand

src/workspaces/adapters/codex.ts:78–91  ·  view source on GitHub ↗

* Prepends MCP server flags only when OpenAlice's optional MCP server is * enabled. The default tool path is CLI-mode (`alice*` shell commands), so a * workspace must still spawn even when no MCP URL is present.

(_base: readonly string[], ctx: SpawnContext)

Source from the content-addressed store, hash-verified

76 * workspace must still spawn even when no MCP URL is present.
77 */
78 composeCommand(_base: readonly string[], ctx: SpawnContext): readonly string[] {
79 const head = codexMcpHead(ctx);
80 if (ctx.resume === undefined) {
81 // Quick-chat seed: `codex [-c …] -- <prompt>` opens the interactive TUI on
82 // that prompt ("Optional user prompt to start the session" per `codex
83 // --help`). `--` terminates options so a `-`-leading prompt is safe (codex
84 // accepts `--` at the top level; verified). Seeding only on fresh spawns —
85 // codex's `resume <id>` subcommand has no positional-prompt slot.
86 if (ctx.initialPrompt) return [...head, '--', ctx.initialPrompt];
87 return head;
88 }
89 if (ctx.resume === 'last') return [...head, 'resume', '--last'];
90 return [...head, 'resume', ctx.resume.sessionId];
91 },
92
93 // Headless codex is CLI-MODE, NOT MCP: `codex exec` cancels EVERY MCP tool
94 // call when there's no human to approve — even under approval_policy=never

Callers

nothing calls this directly

Calls 1

codexMcpHeadFunction · 0.85

Tested by

no test coverage detected