eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
342 lines (341 loc) • 20.6 kB
TypeScript
import { z } from "#compiled/zod/index.js";
import type { DeliverHookPayload, SessionCommand, SessionTimeoutHookPayload } from "#channel/types.js";
/** Version 6 adds session-owned task cancellation to the cancel command. */
export declare const sessionInboxWireV6Schema: z.ZodDiscriminatedUnion<[z.ZodObject<{
auth: z.ZodOptional<z.ZodNullable<z.ZodObject<{
attributes: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
authenticator: z.ZodString;
issuer: z.ZodOptional<z.ZodString>;
principalId: z.ZodString;
principalType: z.ZodString;
subject: z.ZodOptional<z.ZodString>;
}, z.core.$strict>>>;
kind: z.ZodLiteral<"deliver">;
requestId: z.ZodOptional<z.ZodString>;
taskDeliveryId: z.ZodOptional<z.ZodString>;
turnPolicy: z.ZodOptional<z.ZodEnum<{
queue: "queue";
steer: "steer";
}>>;
caller: z.ZodOptional<z.ZodObject<{
callId: z.ZodString;
replyTo: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"hook">;
token: z.ZodString;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"callback">;
token: z.ZodString;
url: z.ZodString;
}, z.core.$strict>], "kind">;
subagentName: z.ZodString;
taskId: z.ZodOptional<z.ZodString>;
activityObserver: z.ZodOptional<z.ZodObject<{
sink: z.ZodObject<{
url: z.ZodString;
version: z.ZodLiteral<1>;
}, z.core.$strict>;
workIdentity: z.ZodOptional<z.ZodObject<{
callId: z.ZodOptional<z.ZodString>;
id: z.ZodString;
kind: z.ZodEnum<{
"remote-agent": "remote-agent";
"root-turn": "root-turn";
subagent: "subagent";
task: "task";
}>;
name: z.ZodOptional<z.ZodString>;
parentId: z.ZodOptional<z.ZodString>;
rootSessionId: z.ZodString;
rootTurnId: z.ZodString;
sessionId: z.ZodOptional<z.ZodString>;
turnId: z.ZodOptional<z.ZodString>;
}, z.core.$strict>>;
}, z.core.$strict>>;
}, z.core.$strict>>;
deliveryMetadata: z.ZodOptional<z.ZodArray<z.ZodObject<{
channelKind: z.ZodString;
channelName: z.ZodString;
deliveryId: z.ZodString;
payloadIndex: z.ZodNumber;
requestId: z.ZodOptional<z.ZodString>;
requestTraceContext: z.ZodOptional<z.ZodObject<{
spanId: z.ZodString;
traceFlags: z.ZodNumber;
traceId: z.ZodString;
}, z.core.$strict>>;
acceptedDeploymentId: z.ZodOptional<z.ZodString>;
}, z.core.$strict>>>;
payload: z.ZodObject<{
context: z.ZodOptional<z.ZodArray<z.ZodString>>;
inputResponses: z.ZodOptional<z.ZodArray<z.ZodObject<{
optionId: z.ZodOptional<z.ZodString>;
requestId: z.ZodString;
text: z.ZodOptional<z.ZodString>;
}, z.core.$strict>>>;
message: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
text: z.ZodString;
type: z.ZodLiteral<"text">;
}, z.core.$strict>, z.ZodObject<{
image: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>;
mediaType: z.ZodOptional<z.ZodString>;
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
type: z.ZodLiteral<"image">;
}, z.core.$strict>, z.ZodObject<{
data: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>;
filename: z.ZodOptional<z.ZodString>;
mediaType: z.ZodString;
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
type: z.ZodLiteral<"file">;
}, z.core.$strict>], "type">>]>>;
outputSchema: z.ZodOptional<z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>;
task: z.ZodOptional<z.ZodObject<{
agentRequests: z.ZodOptional<z.ZodArray<z.ZodObject<{
replyTo: z.ZodString;
request: z.ZodDiscriminatedUnion<[z.ZodObject<{
input: z.ZodObject<{
agentId: z.ZodOptional<z.ZodString>;
message: z.ZodString;
outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>>>;
target: z.ZodString;
}, z.core.$strict>;
invocationId: z.ZodString;
kind: z.ZodLiteral<"agent-invoke">;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"agent-settled">;
result: z.ZodObject<{
backgroundTask: z.ZodOptional<z.ZodObject<{
status: z.ZodLiteral<"working">;
taskId: z.ZodString;
}, z.core.$strict>>;
callId: z.ZodString;
isError: z.ZodOptional<z.ZodBoolean>;
kind: z.ZodLiteral<"subagent-result">;
origin: z.ZodLiteral<"child">;
outcome: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"parked">;
result: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"succeeded">;
output: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
}, z.core.$strict>, z.ZodObject<{
error: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
kind: z.ZodLiteral<"failed">;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"cancelled">;
}, z.core.$strict>], "kind">;
usageDelta: z.ZodObject<{
cacheReadTokens: z.ZodNumber;
cacheWriteTokens: z.ZodNumber;
inputTokens: z.ZodNumber;
outputTokens: z.ZodNumber;
costUsd: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"terminal">;
result: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"succeeded">;
output: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
}, z.core.$strict>, z.ZodObject<{
error: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
kind: z.ZodLiteral<"failed">;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"cancelled">;
}, z.core.$strict>], "kind">;
usageDelta: z.ZodObject<{
cacheReadTokens: z.ZodNumber;
cacheWriteTokens: z.ZodNumber;
inputTokens: z.ZodNumber;
outputTokens: z.ZodNumber;
costUsd: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>;
}, z.core.$strict>], "kind">;
output: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
subagentName: z.ZodString;
usage: z.ZodOptional<z.ZodObject<{
cacheReadTokens: z.ZodNumber;
cacheWriteTokens: z.ZodNumber;
inputTokens: z.ZodNumber;
outputTokens: z.ZodNumber;
costUsd: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>>;
}, z.core.$strict>;
}, z.core.$strict>], "kind">;
taskId: z.ZodString;
}, z.core.$strict>>>;
authorizationEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{
hookPayload: z.ZodObject<{
callId: z.ZodString;
childSessionId: z.ZodString;
event: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>;
kind: z.ZodLiteral<"subagent-authorization-event">;
subagentName: z.ZodString;
}, z.core.$strict>;
taskId: z.ZodString;
}, z.core.$strict>>>;
inputRequests: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
replyTo: z.ZodString;
sequence: z.ZodNumber;
stepIndex: z.ZodNumber;
taskId: z.ZodString;
turnId: z.ZodString;
request: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
}, z.core.$loose>, z.ZodObject<{
replyTo: z.ZodString;
sequence: z.ZodNumber;
stepIndex: z.ZodNumber;
taskId: z.ZodString;
turnId: z.ZodString;
requests: z.ZodArray<z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>>;
}, z.core.$loose>]>>>;
views: z.ZodOptional<z.ZodArray<z.ZodType<import("../../tasks/types.ts").TaskView, unknown, z.core.$ZodTypeInternals<import("../../tasks/types.ts").TaskView, unknown>>>>;
}, z.core.$strict>>;
}, z.core.$loose>;
payloads: z.ZodArray<z.ZodObject<{
context: z.ZodOptional<z.ZodArray<z.ZodString>>;
inputResponses: z.ZodOptional<z.ZodArray<z.ZodObject<{
optionId: z.ZodOptional<z.ZodString>;
requestId: z.ZodString;
text: z.ZodOptional<z.ZodString>;
}, z.core.$strict>>>;
message: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
text: z.ZodString;
type: z.ZodLiteral<"text">;
}, z.core.$strict>, z.ZodObject<{
image: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>;
mediaType: z.ZodOptional<z.ZodString>;
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
type: z.ZodLiteral<"image">;
}, z.core.$strict>, z.ZodObject<{
data: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>;
filename: z.ZodOptional<z.ZodString>;
mediaType: z.ZodString;
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
type: z.ZodLiteral<"file">;
}, z.core.$strict>], "type">>]>>;
outputSchema: z.ZodOptional<z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>;
task: z.ZodOptional<z.ZodObject<{
agentRequests: z.ZodOptional<z.ZodArray<z.ZodObject<{
replyTo: z.ZodString;
request: z.ZodDiscriminatedUnion<[z.ZodObject<{
input: z.ZodObject<{
agentId: z.ZodOptional<z.ZodString>;
message: z.ZodString;
outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>>>;
target: z.ZodString;
}, z.core.$strict>;
invocationId: z.ZodString;
kind: z.ZodLiteral<"agent-invoke">;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"agent-settled">;
result: z.ZodObject<{
backgroundTask: z.ZodOptional<z.ZodObject<{
status: z.ZodLiteral<"working">;
taskId: z.ZodString;
}, z.core.$strict>>;
callId: z.ZodString;
isError: z.ZodOptional<z.ZodBoolean>;
kind: z.ZodLiteral<"subagent-result">;
origin: z.ZodLiteral<"child">;
outcome: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"parked">;
result: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"succeeded">;
output: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
}, z.core.$strict>, z.ZodObject<{
error: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
kind: z.ZodLiteral<"failed">;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"cancelled">;
}, z.core.$strict>], "kind">;
usageDelta: z.ZodObject<{
cacheReadTokens: z.ZodNumber;
cacheWriteTokens: z.ZodNumber;
inputTokens: z.ZodNumber;
outputTokens: z.ZodNumber;
costUsd: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"terminal">;
result: z.ZodDiscriminatedUnion<[z.ZodObject<{
kind: z.ZodLiteral<"succeeded">;
output: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
}, z.core.$strict>, z.ZodObject<{
error: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
kind: z.ZodLiteral<"failed">;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"cancelled">;
}, z.core.$strict>], "kind">;
usageDelta: z.ZodObject<{
cacheReadTokens: z.ZodNumber;
cacheWriteTokens: z.ZodNumber;
inputTokens: z.ZodNumber;
outputTokens: z.ZodNumber;
costUsd: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>;
}, z.core.$strict>], "kind">;
output: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
subagentName: z.ZodString;
usage: z.ZodOptional<z.ZodObject<{
cacheReadTokens: z.ZodNumber;
cacheWriteTokens: z.ZodNumber;
inputTokens: z.ZodNumber;
outputTokens: z.ZodNumber;
costUsd: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>>;
}, z.core.$strict>;
}, z.core.$strict>], "kind">;
taskId: z.ZodString;
}, z.core.$strict>>>;
authorizationEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{
hookPayload: z.ZodObject<{
callId: z.ZodString;
childSessionId: z.ZodString;
event: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>;
kind: z.ZodLiteral<"subagent-authorization-event">;
subagentName: z.ZodString;
}, z.core.$strict>;
taskId: z.ZodString;
}, z.core.$strict>>>;
inputRequests: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
replyTo: z.ZodString;
sequence: z.ZodNumber;
stepIndex: z.ZodNumber;
taskId: z.ZodString;
turnId: z.ZodString;
request: z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>;
}, z.core.$loose>, z.ZodObject<{
replyTo: z.ZodString;
sequence: z.ZodNumber;
stepIndex: z.ZodNumber;
taskId: z.ZodString;
turnId: z.ZodString;
requests: z.ZodArray<z.ZodType<import("../../shared/json.ts").JsonValue, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonValue, unknown>>>;
}, z.core.$loose>]>>>;
views: z.ZodOptional<z.ZodArray<z.ZodType<import("../../tasks/types.ts").TaskView, unknown, z.core.$ZodTypeInternals<import("../../tasks/types.ts").TaskView, unknown>>>>;
}, z.core.$strict>>;
}, z.core.$loose>>;
version: z.ZodLiteral<6>;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"session-timeout">;
version: z.ZodLiteral<6>;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"clear">;
version: z.ZodLiteral<6>;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"compact">;
version: z.ZodLiteral<6>;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"reset">;
reason: z.ZodOptional<z.ZodString>;
version: z.ZodLiteral<6>;
}, z.core.$strict>, z.ZodObject<{
kind: z.ZodLiteral<"cancel">;
taskId: z.ZodOptional<z.ZodString>;
turnId: z.ZodOptional<z.ZodString>;
tasks: z.ZodOptional<z.ZodBoolean>;
version: z.ZodLiteral<6>;
}, z.core.$strict>], "kind">;
export type SessionInboxWireV6 = z.infer<typeof sessionInboxWireV6Schema>;
/** Builds and validates one complete version-6 wire value. */
export declare function encodeSessionCommandV6(command: DeliverHookPayload | SessionCommand | SessionTimeoutHookPayload): SessionInboxWireV6;