UNPKG

@code-yeongyu/senpi

Version:

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

46 lines • 2.94 kB
import type { ExecutionScope, OpenHandScope } from "@earendil-works/pi-agent-core"; import type { JsonValue } from "@earendil-works/pi-ai"; import type { HandWake } from "../../core/execution/hand-wake-route.ts"; import type { InlineExtension } from "../../core/extensions/types.ts"; import type { SettingsManager } from "../../core/settings-manager.ts"; import type { CliRuntimeConfiguration } from "../../main.ts"; import type { TwoSidedHome } from "./loopless-tool-handlers.ts"; /** * A hand's durable wake outbox, per scope (brain/hand split H3): what a scope's work produces for the loop after the call * that started it ended. A scope's runtime is that scope's alone, so the scope that owns a late effect is the runtime it * came from. */ export interface HandWakes { offer(scope: string, wake: HandWake): void; /** The scope was disposed: its un-acked wakes are kept for the retention, then reported dropped to the loop. */ closeScope(scope: string): void; } export interface LooplessHandOptions { extensionFactories?: InlineExtension[]; startupSettingsManager?: SettingsManager; twoSidedHome?: TwoSidedHome; wakes?: HandWakes; } /** A hand on loopless runtimes: its scopes for the remote executor, and its loop hooks for a loop that runs elsewhere. */ export interface LooplessHand { readonly openScope: OpenHandScope; /** * Runs the loop hooks for `event` on the runtime of `scope`: the same runtime, and so the same extension instances, * that its tool calls run on (S33, K5), opened here first when no call has opened it yet. */ runLoopHooks(scope: ExecutionScope, event: string, payload: JsonValue): Promise<JsonValue>; /** `runLoopHooks` for `serveLoopHooks`: the scope comes from the payload's `scope` (`{ id, root }`); refused without one. */ readonly loopHooks: (event: string, payload: JsonValue) => Promise<JsonValue>; /** Disposes every runtime this hand opened, including one only loop hooks opened; every later call is refused. */ close(): Promise<void>; } /** * Opens a hand's execution scopes on loopless runtimes (brain/hand split, S27a): one runtime per scope, bound to the * scope's root as its cwd, built with the remote tool executor's grant so every call runs that runtime's extensions' * `tool_call`/`tool_result` handlers (permission checks among them) around the tool. Nothing about the session reaches * the runtime: the scope ID and root are all it is opened with. The loop hooks of a scope run on that scope's runtime. */ export declare function createLooplessHand(configuration: CliRuntimeConfiguration, local?: LooplessHandOptions): LooplessHand; /** The scopes of {@link createLooplessHand}, for a hand that serves no loop hooks. */ export declare function createLooplessHandScopes(configuration: CliRuntimeConfiguration, local?: LooplessHandOptions): OpenHandScope; //# sourceMappingURL=remote-executor-scope.d.ts.map