eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
55 lines (54 loc) • 2.3 kB
TypeScript
/**
* Generic task creation, readiness acknowledgement, and dispatch rejection.
* Task-run transport (start/command/view) lives in `run-parent.ts`, which
* Callers compose these primitives around their own executor policy.
*/
import type { ActivityObserverConfig } from "#channel/types.js";
import type { HarnessSession } from "#harness/types.js";
import type { JsonValue } from "#shared/json.js";
import type { TaskExecutorBinding } from "#tools/task.js";
import { type TaskMetadata } from "#tasks/types.js";
/** A prepared background task: identity plus its started durable run. */
export interface BackgroundTask {
readonly taskInboxToken: string;
readonly createdByStepIndex?: number;
readonly createdByTurnId: string;
readonly executor?: TaskExecutorBinding;
readonly metadata: TaskMetadata;
readonly taskId: string;
readonly taskRunId: string;
}
type BackgroundTaskDraft = Omit<BackgroundTask, "taskRunId">;
/** Derives the replay-stable task identity before its owning run is started. */
export declare function prepareBackgroundTask(input: {
readonly callId: string;
readonly metadata: TaskMetadata;
readonly parentSessionId: string;
readonly parentStepIndex?: number;
readonly parentTurnId: string;
readonly session: HarnessSession;
}): BackgroundTaskDraft;
/** Starts a lifecycle-only task run for a non-workflow external executor. */
export declare function beginBackgroundTask(input: {
readonly activityObserver?: ActivityObserverConfig;
readonly callId: string;
readonly metadata: TaskMetadata;
readonly parentSessionId: string;
readonly parentStepIndex?: number;
readonly parentTurnId: string;
readonly session: HarnessSession;
}): Promise<BackgroundTask>;
/** Releases task events only after the parent session index committed. */
export declare function acknowledgeDelegatedTasksStep(input: {
readonly tasks: readonly {
readonly taskInboxToken: string;
readonly taskId: string;
readonly taskRunId: string;
}[];
}): Promise<void>;
/** Silently terminates a task whose child dispatch failed before parent indexing. */
export declare function rejectDelegatedDispatch(input: {
readonly error: JsonValue;
readonly task: BackgroundTask;
}): Promise<void>;
export {};