mirror of
https://github.com/stablyai/orca.git
synced 2026-10-07 16:02:29 +00:00
* fix: wait for OpenCode worker composer before first dispatch Reuse captured composer readiness on local and paired execution hosts and revoke launching-shell paste anchors. Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> * feat(opencode): probe execution-host CLI capabilities * fix(opencode): select plugin default for execution host loader * fix(opencode): limit prompt prefill capability to verified release * feat(opencode): probe launch capabilities on the execution host * fix(opencode): select plugin loader for the launched host binary * fix(opencode): match WSL probe cwd and declared guest environment * fix(opencode): preserve launch environment deletion boundaries * wip(opencode): authorize native startup prompt intent at execution owner * fix(opencode): atomically replace status plugin entrypoints * fix(opencode): retain plugin permissions across restrictive umasks * test(opencode): resolve permission fixture from primary cwd * feat(opencode): install startup prompt plugin independently of status hooks * fix(opencode): wait for admitted startup intent and preserve failed-launch briefs * fix(opencode): unsubscribe hook settings during async host shutdown * STRICT launch CI contract correction * CAPS launch CI contract correction * INTENT launch CI contract correction * test: initialize Claude prompt state in output retention fixture * Wait for OpenCode location hydration in intent startup * Bind OpenCode startup readiness to the current location in intent startup * Retry interrupted OpenCode startup prompt claims --------- Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Co-authored-by: Ahmed Nagy <ahmednagy25t@gmail.com> Co-authored-by: Orca startup hydration review <agents@stably.ai> Co-authored-by: Orca <dev@stably.ai>
40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
import { isOpenCodeRunCommand } from './opencode-headless-command'
|
|
import { sha256 } from './sha256'
|
|
import { tokenizeStartupCommand, type AgentStartupShell } from './tui-agent-startup-shell'
|
|
import type { TuiAgent } from './tui-agent'
|
|
|
|
export const OPENCODE_STARTUP_PROMPT_SHA256_ENV = 'ORCA_OPENCODE_STARTUP_PROMPT_SHA256'
|
|
export const OPENCODE_STARTUP_PROMPT_NONCE_ENV = 'ORCA_OPENCODE_STARTUP_PROMPT_NONCE'
|
|
export const OPENCODE_STARTUP_PROMPT_ENDPOINT_ENV = 'ORCA_OPENCODE_STARTUP_PROMPT_ENDPOINT'
|
|
export const OPENCODE_STARTUP_PROMPT_CLAIM_PATH = '/opencode/startup-prompt/claim'
|
|
export const OPENCODE_STARTUP_PROMPT_BODY_ENV = 'ORCA_OPENCODE_STARTUP_PROMPT_BODY'
|
|
export const OPENCODE_STARTUP_PROMPT_SHELL_ENV = 'ORCA_OPENCODE_STARTUP_PROMPT_SHELL'
|
|
|
|
export function openCodeStartupPromptEnv(
|
|
agent: TuiAgent,
|
|
command: string,
|
|
shell: AgentStartupShell,
|
|
prompt: string,
|
|
env: Record<string, string> | null | undefined
|
|
): { env?: Record<string, string> } {
|
|
const parsed = tokenizeStartupCommand(command, shell)
|
|
if (
|
|
(agent !== 'opencode' && agent !== 'opencode2') ||
|
|
!parsed.ok ||
|
|
isOpenCodeRunCommand(parsed.tokens)
|
|
) {
|
|
return env ? { env: { ...env } } : {}
|
|
}
|
|
const digest = Array.from(sha256(new TextEncoder().encode(prompt)), (byte) =>
|
|
byte.toString(16).padStart(2, '0')
|
|
).join('')
|
|
return {
|
|
env: {
|
|
...env,
|
|
[OPENCODE_STARTUP_PROMPT_SHA256_ENV]: digest,
|
|
[OPENCODE_STARTUP_PROMPT_BODY_ENV]: prompt,
|
|
[OPENCODE_STARTUP_PROMPT_SHELL_ENV]: shell
|
|
}
|
|
}
|
|
}
|