UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

34 lines • 1.89 kB
import { ENV_AGENT_DIR, getAgentDir } from "../../config.js"; import { adoptedEngineTrustHandOff } from "../../engine-trust/index.js"; import { RPC_CLIENT_CAPABILITIES_ENV } from "./custom-capability.js"; import { daemonEnvironment } from "./host-daemon-env.js"; import { HOST_DAEMON_DIR_ENV } from "./host-daemon-paths.js"; import { HOST_GENERATION_ENV, HOST_INSTANCE_ID_ENV } from "./host-identity-env.js"; import { EXPECTED_RUNTIME_BUILD_ID_ENV } from "./host-idle-handover.js"; import { PINNED_HOST_CLIENT_CAPABILITIES } from "./host-launch.js"; export function initialHostEnvironment(options) { return daemonEnvironment(process.env, options.env, { ...adoptedEngineTrustHandOff(), [ENV_AGENT_DIR]: options.agentDir ?? getAgentDir(), [RPC_CLIENT_CAPABILITIES_ENV]: PINNED_HOST_CLIENT_CAPABILITIES.join(","), // Always SET, never inherited: two generations claiming one instance id make the handoff // completion signal - the instance id changing on the public socket - impossible to observe. [HOST_INSTANCE_ID_ENV]: options.instanceId, [HOST_GENERATION_ENV]: String(options.generation), [HOST_DAEMON_DIR_ENV]: options.paths.dir, }); } export function successorHostEnvironment(options) { return daemonEnvironment(process.env, options.env, { ...adoptedEngineTrustHandOff(), [RPC_CLIENT_CAPABILITIES_ENV]: PINNED_HOST_CLIENT_CAPABILITIES.join(","), ...(options.agentDir ? { [ENV_AGENT_DIR]: options.agentDir } : {}), [HOST_INSTANCE_ID_ENV]: options.instanceId, [HOST_GENERATION_ENV]: String(options.generation), [HOST_DAEMON_DIR_ENV]: options.paths.dir, ...(options.expectedRuntimeBuildId !== undefined && { [EXPECTED_RUNTIME_BUILD_ID_ENV]: options.expectedRuntimeBuildId, }), }); } //# sourceMappingURL=host-spawn-environment.js.map