eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
63 lines (62 loc) • 2.96 kB
TypeScript
import type { SessionInboxAddress } from "#execution/session-inbox/address.js";
import type { DeliverPayload, SubagentInputRequestHookPayload } from "#channel/types.js";
import type { AnswerHookRoute, ProxyInputRequest } from "#harness/proxy-input-requests.js";
import type { HarnessEmitFn, HarnessSession, SessionStateMap } from "#harness/types.js";
import type { RunMode } from "#shared/run-mode.js";
import type { InputResponse } from "#shared/input.js";
/**
* Runs the parent-side work for a `subagent-input-request`. Conversation
* mode emits a waiting boundary on the parent stream; the returned proxy
* entries route the eventual response back down to the child.
*/
export declare function emitProxiedInputRequest(input: {
readonly emit: HarnessEmitFn;
readonly hookPayload: SubagentInputRequestHookPayload;
readonly mode: RunMode;
readonly session: HarnessSession;
}): Promise<{
readonly entries: readonly (readonly [requestId: string, route: ProxyInputRequest])[];
readonly session: HarnessSession;
}>;
/** One proxied-child bucket of a routed deliver payload. */
export interface RoutedChildDelivery {
readonly answerHook?: AnswerHookRoute;
readonly childContinuationToken: string;
readonly childSessionInbox?: SessionInboxAddress;
readonly childResponseUrl?: string;
/** Answer-hook requests the user moved past; each hook resumes as `dismissed`. */
readonly dismissedRequestIds?: readonly string[];
readonly payload: {
readonly inputResponses: readonly InputResponse[];
};
/** Parent-visible request IDs safe to retire once this bucket is forwarded. */
readonly retireRequestIds: readonly string[];
/** Present when the child is owned by a task run, which delivers on the parent's behalf. */
readonly taskId?: string;
}
/**
* Outcome of splitting one deliver payload by the session's proxy map.
* `forSelf` is the parent-local remainder (or `undefined` when fully
* routed); `forChildren` carries one entry per descendant token.
*/
export interface RoutedDeliverPayload {
readonly forChildren: readonly RoutedChildDelivery[];
readonly forSelf: DeliverPayload | undefined;
readonly parentAction: {
readonly kind: "cancel-turn";
} | undefined;
}
/**
* Splits a deliver payload into parent-local and proxied-child buckets.
*
* With `resolveMessage`, a plain-text message is also resolved against pending
* `ctx.ask()` questions: when exactly one question is pending, a matching option or
* permitted free text answers it and consumes the message. Otherwise the
* message dismisses every `dismissible` question and stays with the parent.
*/
export declare function routeDeliverPayload(input: {
readonly allowRoute?: (requestId: string, route: ProxyInputRequest) => boolean;
readonly payload: DeliverPayload;
readonly resolveMessage?: boolean;
readonly state: SessionStateMap | undefined;
}): RoutedDeliverPayload;