Skip to main content

@flow-state-dev/orchestration/inbox

Type Aliases​

BoardActions​

type BoardActions = object;

One board's actions, bound by InboxClient.board. Each resolves on the board's ok: true, and rejects with the board's own words on a refusal (a finished task, a locked field), with nothing written. One rejection may follow a write: the board finished the action but its answer couldn't be read, so check the board before trying again.

Methods​

cancel()​
cancel(id): Promise<string[]>;

Cancel a task. Resolves to the ids of the dependents the board cancelled with it.

Parameters​
id​

string

Returns​

Promise<string[]>

get()​
get(id): Promise<{
assignee?: string;
attempts: number;
checkpoint?: true;
completedAt?: number;
context?: string;
current?: {
id: string;
output?: unknown;
outputCut?: true;
};
deps?: string[];
error?: string;
filedByTask?: string;
followUpOf?: string;
goal: string;
holds?: (
| {
actor: "system" | "user";
ask: {
kind: "approval" | "input" | "review";
prompt: string;
title?: string;
};
due?: number;
id: string;
openedAt: number;
source: {
kind: "suspension";
requestId: string;
suspensionId: string;
};
}
| {
actor: "system" | "user";
ask: {
kind: "confirm" | "external" | "question";
onNo?: "cancel" | "continue";
prompt: string;
title?: string;
};
due?: number;
id: string;
midway?: true;
openedAt: number;
source: {
closedBy: ...[];
kind: "task";
};
})[];
id: string;
input?: unknown;
inputCut?: true;
keptOpenBy?: "filed" | "steer" | "suspended";
labels?: string[];
maxAttempts?: number;
metadata?: unknown;
metadataCut?: true;
output?: unknown;
outputCut?: true;
priority?: number;
resultTo?: "conversation" | "filer";
run?: {
attempt: number;
requestId: string;
sessionId: string;
startedAt?: number;
};
session?: "new" | "ongoing";
status: | "cancelled"
| "completed"
| "errored"
| "held"
| "in_progress"
| "pending";
statusNote?: string;
steers?: object[];
target?: string;
title?: string;
}>;

Read one task as the board's getTask reads it: its brief (context, labels, priority) whole, its input and output cut as that read cuts them. A re-run reads its brief here before refile, so a long brief keeps every instruction.

Parameters​
id​

string

Returns​

Promise<{ assignee?: string; attempts: number; checkpoint?: true; completedAt?: number; context?: string; current?: { id: string; output?: unknown; outputCut?: true; }; deps?: string[]; error?: string; filedByTask?: string; followUpOf?: string; goal: string; holds?: ( | { actor: "system" | "user"; ask: { kind: "approval" | "input" | "review"; prompt: string; title?: string; }; due?: number; id: string; openedAt: number; source: { kind: "suspension"; requestId: string; suspensionId: string; }; } | { actor: "system" | "user"; ask: { kind: "confirm" | "external" | "question"; onNo?: "cancel" | "continue"; prompt: string; title?: string; }; due?: number; id: string; midway?: true; openedAt: number; source: { closedBy: ...[]; kind: "task"; }; })[]; id: string; input?: unknown; inputCut?: true; keptOpenBy?: "filed" | "steer" | "suspended"; labels?: string[]; maxAttempts?: number; metadata?: unknown; metadataCut?: true; output?: unknown; outputCut?: true; priority?: number; resultTo?: "conversation" | "filer"; run?: { attempt: number; requestId: string; sessionId: string; startedAt?: number; }; session?: "new" | "ongoing"; status: | "cancelled" | "completed" | "errored" | "held" | "in_progress" | "pending"; statusNote?: string; steers?: object[]; target?: string; title?: string; }>

refile()​
refile(row, overrides?): Promise<string>;

File row's task again as a new one: its goal, title, context, assignee, labels and priority, overrides winning. Resolves to the new task's id. For a task that should run again changed; retry keeps the task.

Parameters​
row​

RefiledTask

overrides?​

RefileOverrides

Returns​

Promise<string>

release()​
release(id): Promise<void>;

Release a held task: it goes back to pending.

Parameters​
id​

string

Returns​

Promise<void>

retry()​
retry(id): Promise<void>;

Retry a failed or cancelled task as the same task: its id, history and spend kept, one more try counted.

Parameters​
id​

string

Returns​

Promise<void>

steer()​
steer(id, message): Promise<void>;

Send words to an open task: they join its brief. Uses no try, never cancels.

Parameters​
id​

string

message​

string

Returns​

Promise<void>


BoardAt​

type BoardAt = object;

The board a task screen works: the flow and the session that hold it, and its collection id (Workforce's "tasks", not a row's <sessionId>.tasks ref). Its actions run there, as the signed-in user.

Properties​

board​
board: string;
flowId​
flowId: string;
sessionId​
sessionId: string;

BoardTaskRead​

type BoardTaskRead = ReturnType<typeof readTaskView>;

One task as the board's getTask returns it (BoardActions.get).


InboxAnswer​

type InboxAnswer<K> = InboxAnswerFor[K];

The answer a hold of kind K takes.

Type Parameters​

K​

K extends InboxAskKind = InboxAskKind


InboxAnswerFor​

type InboxAnswerFor = object;

The answer each kind of hold takes.

Properties​

approval​
readonly approval: object;

A yes or a no, with what the approval's form carries.

approved​
readonly approved: boolean;
data?​
readonly data?: unknown;
confirm​
readonly confirm: object;

Whether the user gives the go, with a note.

done​
readonly done: boolean;
note?​
readonly note?: string;
input​
readonly input:
| {
value: unknown;
}
| {
skipped: true;
};

What the user gave, or that they skipped an optional one.

question​
readonly question: object;

The user's words.

text​
readonly text: string;
review​
readonly review:
| {
value: unknown;
}
| {
skipped: true;
};

The user's verdict, or that they skipped an optional one.


InboxAskKind​

type InboxAskKind = SuspendForUserKind | "question" | "confirm";

What a hold asks the user for: a task run's stop (approval, review, input) or a row's own (question, confirm).


InboxClient​

type InboxClient = object;

The Inbox's client: its one answer call, and each board's task actions.

Methods​

answer()​
answer(
item,
answer,
questionId?
): Promise<void>;

Answer item's hold questionId (its first when omitted) with the answer its ask takes. Rejects when the hold isn't answerable, or the route refuses.

Parameters​
item​

InboxItem<unknown>

answer​

InboxAnswer

questionId?​

string

Returns​

Promise<void>

answerOne()​
answerOne(hold, answer): Promise<void>;

Answer one hold, as an item's are answered: for a hold drawn on its own, such as an ask in a task's session view.

Parameters​
hold​

InboxHold<unknown>

answer​

InboxAnswer

Returns​

Promise<void>

board()​
board(at): BoardActions;

Board at's task actions: cancel, steer, release, retry and re-file, each sent to the board's own action on the session that holds it. Answering a task's question stays answerOne.

Parameters​
at​

BoardAt

Returns​

BoardActions


InboxHold​

type InboxHold<TDetail> = object;

One open hold an item shows.

Type Parameters​

TDetail​

TDetail = unknown

Properties​

answerable​
readonly answerable: boolean;

Whether the user can answer it from the Inbox.

ask​
readonly ask: object;
kind​
readonly kind: InboxAskKind;
prompt​
readonly prompt: string;
title?​
readonly title?: string;
detail?​
readonly detail?: TDetail;

What the reader found for it beside the row (for a suspension, its pending item), to draw it with.

due?​
readonly due?: number;

When it ends unanswered, epoch ms; absent when no deadline is set.

id​
readonly id: string;

A suspension hold's request and suspension (suspensionHoldId); an own hold's own id.

openedAt​
readonly openedAt: number;

When it opened, epoch ms.

source​
readonly source:
| SuspensionHoldSource
| OwnHoldSource;

What answers it: a suspension through the engine, an own hold through the board.

unanswerable​
readonly unanswerable: string | null;

Why not, when it isn't answerable; null when it is.


InboxItem​

type InboxItem<TDetail> = object;

One thing waiting on the user.

Type Parameters​

TDetail​

TDetail = unknown

Properties​

answerable​
readonly answerable: boolean;

Whether the user can answer any of its holds from the Inbox.

holds​
readonly holds: readonly InboxHold<TDetail>[];

Its open holds, oldest first. Never empty. Each says where its own answer goes.

id​
readonly id: string;

Its address in the Inbox: a task's item by its board and task, else its lone suspension's hold id.

since​
readonly since: number;

When the oldest opened, epoch ms.

task​
readonly task: InboxTask | null;

The task it holds; null for a suspension in a request with no task.

unanswerable​
readonly unanswerable: string | null;

Why not, when none of its holds is answerable; null when one is.


InboxSuspension​

type InboxSuspension<TDetail> = object;

A suspension for the user a reader found in a session.

Type Parameters​

TDetail​

TDetail = unknown

Properties​

detail?​
readonly detail?: TDetail;
due?​
readonly due?: number;

When it ends unanswered (its expiresAt), epoch ms: the hold's due. Absent when no deadline is set.

flowId​
readonly flowId: string | null;

The flow that owns the session; null when it names none.

kind​
readonly kind: SuspendForUserKind;
prompt​
readonly prompt: string;
requestId​
readonly requestId: string;
sessionId​
readonly sessionId: string | null;

The session the run is parked in; null for a run with no conversation.

since​
readonly since: number;

When it was raised, epoch ms.

suspensionId​
readonly suspensionId: string;
title?​
readonly title?: string;

InboxTask​

type InboxTask = object;

The task an item is about.

Properties​

assignee​
readonly assignee: string | null;
board​
readonly board: string;

The board's ref the row is on.

taskId​
readonly taskId: string;
title​
readonly title: string;

InboxTaskInput​

type InboxTaskInput = object;

A task, as much of it as the Inbox reads. A browser's board row and a server's Task both fit.

Properties​

assignee?​
readonly assignee?: string | null;
board​
readonly board: string;

The board's ref the row is on.

goal?​
readonly goal?: string | null;
holder?​
readonly holder?:
| {
action: string;
sessionId: string;
}
| null;

Where its own questions are answered: the session that holds the board, and the board's updateTask action there. null when the reader can't say, which leaves them unanswerable.

holds?​
readonly holds?: readonly TaskHold[] | null;

What holds it (Task.holds): its questions and confirms, and its run's stop for a person.

id​
readonly id: string;
run?​
readonly run?:
| {
requestId: string;
sessionId: string;
}
| null;

The run working it: the session and request its stop is in.

status​
readonly status: string;
steers?​
readonly steers?: readonly object[] | null;

Its steers, as far as the Inbox reads them: which hold each answers. A question is open while none carries its id.

title?​
readonly title?: string | null;
updatedAt?​
readonly updatedAt?: number | null;

OwnHoldSource​

type OwnHoldSource = object;

A hold kept on the task itself (a question or a confirm): answered through the board's updateTask action, as the user, on the session that holds the board.

Properties​

action​
readonly action: string | null;

The board's updateTask action on that session.

flowId​
readonly flowId: string | null;

The flow that owns the board's session; null when the reader can't name it, which leaves the hold unanswerable.

kind​
readonly kind: "task";
sessionId​
readonly sessionId: string | null;

The session that holds the board; null when the row names none.

taskId​
readonly taskId: string;

The task the hold is on.


RefiledTask​

type RefiledTask = object;

What a re-file copies from a row: the brief and where it goes. A browser's row or a server's Task fits. input, metadata and deps aren't copied (a browser's row doesn't carry the first two, and old deps may name finished rows); an override sets any of them.

Properties​

assignee?​
assignee?: string | null;
context?​
context?: string | null;
goal​
goal: string;
labels?​
labels?: readonly string[] | null;
priority?​
priority?: number | null;
title?​
title?: string | null;

RefileOverrides​

type RefileOverrides = Partial<RefiledTask> & object;

What a re-file sets over the copied row: any copied field, and the ones a re-file doesn't copy.

Type Declaration​

deps?​
deps?: readonly string[];
input?​
input?: Record<string, unknown>;
metadata?​
metadata?: Record<string, unknown>;

SuspensionHoldSource​

type SuspensionHoldSource = object;

Where a suspension hold's answer goes: the run's flow, its request and the stop.

Properties​

flowId​
readonly flowId: string | null;

The flow that owns the run's session; null when the session names none, which leaves the hold unanswerable.

kind​
readonly kind: "suspension";
requestId​
readonly requestId: string;
sessionId​
readonly sessionId: string | null;

The session the run is parked in; null for a run with no conversation, answered through its flow alone.

suspensionId​
readonly suspensionId: string;

TaskActionTool​

type TaskActionTool = "createTask" | "getTask" | "listTasks" | "updateTask" | "retryTask";

The task tools a board takes from outside a run, each an action on the flow that holds the board.


TaskListView​

type TaskListView = ReturnType<typeof taskListView>;

A board's task-list view, as taskToolViews builds it: for a client's viewRef<TaskListView>.


TaskView​

type TaskView<TDetail> = object;

One task, as a person sees it.

Type Parameters​

TDetail​

TDetail = unknown

Properties​

assignee​
readonly assignee: string | null;
board​
readonly board: string;
error​
readonly error: string | null;
goal​
readonly goal: string | null;
harness​
readonly harness: string | null;

The harness its runs last reported, or null.

hold​
readonly hold: InboxHold<TDetail> | null;

Its oldest open user hold: what it asks (ask.kind, ask.prompt), where the answer goes, whether it can be answered here, and what the reader found for it. null when nothing waits on the user. Set exactly when state is waiting.

holds​
readonly holds: readonly InboxHold<TDetail>[];

Every open user hold, oldest first. Empty on a terminal row.

id​
readonly id: string;
model​
readonly model: string | null;

The model its runs last called, or null.

spend​
readonly spend: TaskSpendView | null;

What its runs spent (taskSpendView), or null before it runs or when the stored spend can't be read.

state​
readonly state: TaskViewStatus;

What a person sees it as.

status​
readonly status: string;

The status as stored. Kept even when it is a word state doesn't know.

statusNote​
readonly statusNote: string | null;

Its worker's last one-line progress note.

times​
readonly times: object;

Epoch ms; null where the row has none.

completedAt​
readonly completedAt: number | null;
createdAt​
readonly createdAt: number | null;
startedAt​
readonly startedAt: number | null;
updatedAt​
readonly updatedAt: number | null;
title​
readonly title: string;

Its title, else its goal, else its id.


TaskViewInput​

type TaskViewInput = InboxTaskInput & object;

A task as the view reads it: an Inbox row plus what a board publishes beside it. A Task on its board fits.

Type Declaration​

completedAt?​
readonly completedAt?: number | null;
createdAt?​
readonly createdAt?: number | null;
error?​
readonly error?: string | null;
spend?​
readonly spend?:
| Task["spend"]
| TaskSpendView
| null;

The stored ledger (a raw board row) or the view listTasks already folded it to.

startedAt?​
readonly startedAt?: number | null;
statusNote?​
readonly statusNote?: string | null;

TaskViewStatus​

type TaskViewStatus =
| "queued"
| "held"
| "running"
| "waiting"
| "failed"
| "done"
| "cancelled";

What a person sees a task as.

  • queued: filed, waiting to start (pending, or a stored word this version doesn't know).
  • held: filed, not to start until someone releases it.
  • running: being worked, nothing waiting on the user.
  • waiting: an open hold waits on the user, whatever the row's stored status, as long as it isn't terminal.
  • failed, done, cancelled: its terminal statuses.

Functions​

createInboxClient()​

function createInboxClient(client): InboxClient;

The Inbox's client over one connection.

Parameters​

client​

Client

Returns​

InboxClient


inboxItems()​

function inboxItems<TDetail>(input): InboxItem<TDetail>[];

The Inbox list: one item per task that holds the user, and one per suspension a reader found that no row claims, oldest first.

A task run's stop lists under its row, never on its own: one the row's hold names, and one in the request the row's open run is even when the row records no hold for it yet (before the stop arm's write, or a record it couldn't read). That one is the found suspension's own hold, still answerable; the check reports the row's missing record as drift. flowOf names the flow that owns a session, where a row's run is.

Type Parameters​

TDetail​

TDetail = unknown

Parameters​

input​
flowOf​

(sessionId) => string | null | undefined

rows​

readonly InboxTaskInput[]

suspensions​

readonly InboxSuspension<TDetail>[]

Returns​

InboxItem<TDetail>[]


suspensionHoldId()​

function suspensionHoldId(requestId, suspensionId): string;

A suspension hold's id, and a lone suspension's item id: its request and its suspension. A suspension id is unique only within its request, so two requests that stop on the same id are two holds. Each part is URI-encoded, so no : inside a caller's request or suspension id can make two pairs one id.

Parameters​

requestId​

string

suspensionId​

string

Returns​

string


taskActionName()​

function taskActionName(tool, board): string;

The name of board board's action for tool: <tool>_<suffix>, the one place an app gets it. board is the collection id (Workforce's "tasks"), not a row's board ref. For a reader that builds an InboxTaskInput.holder, or a test that acts on the board directly; an app that changes a task calls InboxClient.board.

Parameters​

tool​

TaskActionTool

board​

string

Returns​

string


taskListViewRef()​

function taskListViewRef(flow, board): ViewRef<ViewDefinition<BlockDefinition<ZodObject<{
assignee: ZodOptional<ZodString>;
filedByTask: ZodOptional<ZodString>;
status: ZodOptional<ZodEnum<["pending", "in_progress", "held", "completed", "errored", "cancelled"]>>;
}, "strip", ZodTypeAny, {
assignee?: string;
filedByTask?: string;
status?: | "completed"
| "errored"
| "cancelled"
| "pending"
| "in_progress"
| "held";
}, {
assignee?: string;
filedByTask?: string;
status?: | "completed"
| "errored"
| "cancelled"
| "pending"
| "in_progress"
| "held";
}>, ZodArray<ZodObject<{
assignee: ZodOptional<ZodString>;
attachments: ZodOptional<ZodArray<ZodObject<{
data: ZodEffects<..., ..., ...>;
filename: ZodOptional<...>;
mediaType: ZodString;
type: ZodLiteral<...>;
}, "strip", ZodTypeAny, {
data: string;
filename?: ... | ...;
mediaType: string;
type: "file";
}, {
data: string;
filename?: ... | ...;
mediaType: string;
type: "file";
}>, "many">>;
attempts: ZodNumber;
completedAt: ZodOptional<ZodNumber>;
createdAt: ZodOptional<ZodNumber>;
current: ZodOptional<ZodObject<{
id: ZodString;
}, "strip", ZodTypeAny, {
id: string;
}, {
id: string;
}>>;
deps: ZodOptional<ZodArray<ZodString, "many">>;
error: ZodOptional<ZodString>;
filedByTask: ZodOptional<ZodString>;
goal: ZodString;
holds: ZodOptional<ZodArray<ZodUnion<[ZodObject<..., ..., ..., ..., ...>, ZodObject<..., ..., ..., ..., ...>]>, "many">>;
id: ZodString;
keptOpenBy: ZodOptional<ZodEnum<["suspended", "filed", "steer"]>>;
leaseUntil: ZodOptional<ZodNumber>;
run: ZodOptional<ZodObject<{
attempt: ZodNumber;
requestId: ZodString;
sessionId: ZodString;
startedAt: ZodOptional<ZodNumber>;
}, "strip", ZodTypeAny, {
attempt: number;
requestId: string;
sessionId: string;
startedAt?: number;
}, {
attempt: number;
requestId: string;
sessionId: string;
startedAt?: number;
}>>;
spend: ZodOptional<ZodNullable<ZodObject<{
costUsd: ZodOptional<...>;
harness: ZodNullable<...>;
inputTokens: ZodNullable<...>;
live: ZodBoolean;
model: ZodNullable<...>;
outputTokens: ZodNullable<...>;
unreported: ZodBoolean;
}, "strip", ZodTypeAny, {
costUsd?: ... | ... | ...;
harness: ... | ...;
inputTokens: ... | ...;
live: boolean;
model: ... | ...;
outputTokens: ... | ...;
unreported: boolean;
}, {
costUsd?: ... | ... | ...;
harness: ... | ...;
inputTokens: ... | ...;
live: boolean;
model: ... | ...;
outputTokens: ... | ...;
unreported: boolean;
}>>>;
startedAt: ZodOptional<ZodNumber>;
status: ZodString;
statusNote: ZodOptional<ZodString>;
title: ZodOptional<ZodString>;
updatedAt: ZodOptional<ZodNumber>;
waitedOn: ZodOptional<ZodLiteral<true>>;
}, "strip", ZodTypeAny, {
assignee?: string;
attachments?: object[];
attempts: number;
completedAt?: number;
createdAt?: number;
current?: {
id: string;
};
deps?: string[];
error?: string;
filedByTask?: string;
goal: string;
holds?: (
| {
actor: ... | ...;
ask: {
kind: ...;
prompt: ...;
title?: ...;
};
due?: ... | ...;
id: string;
openedAt: number;
source: {
kind: ...;
requestId: ...;
suspensionId: ...;
};
}
| {
actor: ... | ...;
ask: {
kind: ...;
onNo?: ...;
prompt: ...;
title?: ...;
};
due?: ... | ...;
id: string;
midway?: ... | ...;
openedAt: number;
source: {
closedBy: ...;
kind: ...;
};
})[];
id: string;
keptOpenBy?: "suspended" | "filed" | "steer";
leaseUntil?: number;
run?: {
attempt: number;
requestId: string;
sessionId: string;
startedAt?: number;
};
spend?: | {
costUsd?: number | null;
harness: string | null;
inputTokens: number | null;
live: boolean;
model: string | null;
outputTokens: number | null;
unreported: boolean;
}
| null;
startedAt?: number;
status: string;
statusNote?: string;
title?: string;
updatedAt?: number;
waitedOn?: true;
}, {
assignee?: string;
attachments?: object[];
attempts: number;
completedAt?: number;
createdAt?: number;
current?: {
id: string;
};
deps?: string[];
error?: string;
filedByTask?: string;
goal: string;
holds?: (
| {
actor: ... | ...;
ask: {
kind: ...;
prompt: ...;
title?: ...;
};
due?: ... | ...;
id: string;
openedAt: number;
source: {
kind: ...;
requestId: ...;
suspensionId: ...;
};
}
| {
actor: ... | ...;
ask: {
kind: ...;
onNo?: ...;
prompt: ...;
title?: ...;
};
due?: ... | ...;
id: string;
midway?: ... | ...;
openedAt: number;
source: {
closedBy: ...;
kind: ...;
};
})[];
id: string;
keptOpenBy?: "suspended" | "filed" | "steer";
leaseUntil?: number;
run?: {
attempt: number;
requestId: string;
sessionId: string;
startedAt?: number;
};
spend?: | {
costUsd?: number | null;
harness: string | null;
inputTokens: number | null;
live: boolean;
model: string | null;
outputTokens: number | null;
unreported: boolean;
}
| null;
startedAt?: number;
status: string;
statusNote?: string;
title?: string;
updatedAt?: number;
waitedOn?: true;
}>, "many">, {
assignee?: string;
filedByTask?: string;
status?: | "completed"
| "errored"
| "cancelled"
| "pending"
| "in_progress"
| "held";
}, object[]>, "session">>;

The client's handle on board board's task list, the session view listTasks_<suffix> flow flow declares (orchestration's taskToolViews): for useView(ref, {}, { sessionId }) or client.view(ref, {}, { sessionId }), on the session that holds the board. Its answer is the board's rows, keyed by task id.

Parameters​

flow​

string

board​

string

Returns​

ViewRef<ViewDefinition<BlockDefinition<ZodObject<{ assignee: ZodOptional<ZodString>; filedByTask: ZodOptional<ZodString>; status: ZodOptional<ZodEnum<["pending", "in_progress", "held", "completed", "errored", "cancelled"]>>; }, "strip", ZodTypeAny, { assignee?: string; filedByTask?: string; status?: | "completed" | "errored" | "cancelled" | "pending" | "in_progress" | "held"; }, { assignee?: string; filedByTask?: string; status?: | "completed" | "errored" | "cancelled" | "pending" | "in_progress" | "held"; }>, ZodArray<ZodObject<{ assignee: ZodOptional<ZodString>; attachments: ZodOptional<ZodArray<ZodObject<{ data: ZodEffects<..., ..., ...>; filename: ZodOptional<...>; mediaType: ZodString; type: ZodLiteral<...>; }, "strip", ZodTypeAny, { data: string; filename?: ... | ...; mediaType: string; type: "file"; }, { data: string; filename?: ... | ...; mediaType: string; type: "file"; }>, "many">>; attempts: ZodNumber; completedAt: ZodOptional<ZodNumber>; createdAt: ZodOptional<ZodNumber>; current: ZodOptional<ZodObject<{ id: ZodString; }, "strip", ZodTypeAny, { id: string; }, { id: string; }>>; deps: ZodOptional<ZodArray<ZodString, "many">>; error: ZodOptional<ZodString>; filedByTask: ZodOptional<ZodString>; goal: ZodString; holds: ZodOptional<ZodArray<ZodUnion<[ZodObject<..., ..., ..., ..., ...>, ZodObject<..., ..., ..., ..., ...>]>, "many">>; id: ZodString; keptOpenBy: ZodOptional<ZodEnum<["suspended", "filed", "steer"]>>; leaseUntil: ZodOptional<ZodNumber>; run: ZodOptional<ZodObject<{ attempt: ZodNumber; requestId: ZodString; sessionId: ZodString; startedAt: ZodOptional<ZodNumber>; }, "strip", ZodTypeAny, { attempt: number; requestId: string; sessionId: string; startedAt?: number; }, { attempt: number; requestId: string; sessionId: string; startedAt?: number; }>>; spend: ZodOptional<ZodNullable<ZodObject<{ costUsd: ZodOptional<...>; harness: ZodNullable<...>; inputTokens: ZodNullable<...>; live: ZodBoolean; model: ZodNullable<...>; outputTokens: ZodNullable<...>; unreported: ZodBoolean; }, "strip", ZodTypeAny, { costUsd?: ... | ... | ...; harness: ... | ...; inputTokens: ... | ...; live: boolean; model: ... | ...; outputTokens: ... | ...; unreported: boolean; }, { costUsd?: ... | ... | ...; harness: ... | ...; inputTokens: ... | ...; live: boolean; model: ... | ...; outputTokens: ... | ...; unreported: boolean; }>>>; startedAt: ZodOptional<ZodNumber>; status: ZodString; statusNote: ZodOptional<ZodString>; title: ZodOptional<ZodString>; updatedAt: ZodOptional<ZodNumber>; waitedOn: ZodOptional<ZodLiteral<true>>; }, "strip", ZodTypeAny, { assignee?: string; attachments?: object[]; attempts: number; completedAt?: number; createdAt?: number; current?: { id: string; }; deps?: string[]; error?: string; filedByTask?: string; goal: string; holds?: ( | { actor: ... | ...; ask: { kind: ...; prompt: ...; title?: ...; }; due?: ... | ...; id: string; openedAt: number; source: { kind: ...; requestId: ...; suspensionId: ...; }; } | { actor: ... | ...; ask: { kind: ...; onNo?: ...; prompt: ...; title?: ...; }; due?: ... | ...; id: string; midway?: ... | ...; openedAt: number; source: { closedBy: ...; kind: ...; }; })[]; id: string; keptOpenBy?: "suspended" | "filed" | "steer"; leaseUntil?: number; run?: { attempt: number; requestId: string; sessionId: string; startedAt?: number; }; spend?: | { costUsd?: number | null; harness: string | null; inputTokens: number | null; live: boolean; model: string | null; outputTokens: number | null; unreported: boolean; } | null; startedAt?: number; status: string; statusNote?: string; title?: string; updatedAt?: number; waitedOn?: true; }, { assignee?: string; attachments?: object[]; attempts: number; completedAt?: number; createdAt?: number; current?: { id: string; }; deps?: string[]; error?: string; filedByTask?: string; goal: string; holds?: ( | { actor: ... | ...; ask: { kind: ...; prompt: ...; title?: ...; }; due?: ... | ...; id: string; openedAt: number; source: { kind: ...; requestId: ...; suspensionId: ...; }; } | { actor: ... | ...; ask: { kind: ...; onNo?: ...; prompt: ...; title?: ...; }; due?: ... | ...; id: string; midway?: ... | ...; openedAt: number; source: { closedBy: ...; kind: ...; }; })[]; id: string; keptOpenBy?: "suspended" | "filed" | "steer"; leaseUntil?: number; run?: { attempt: number; requestId: string; sessionId: string; startedAt?: number; }; spend?: | { costUsd?: number | null; harness: string | null; inputTokens: number | null; live: boolean; model: string | null; outputTokens: number | null; unreported: boolean; } | null; startedAt?: number; status: string; statusNote?: string; title?: string; updatedAt?: number; waitedOn?: true; }>, "many">, { assignee?: string; filedByTask?: string; status?: | "completed" | "errored" | "cancelled" | "pending" | "in_progress" | "held"; }, object[]>, "session">>


taskView()​

function taskView<TDetail>(row, holds?): TaskView<TDetail>;

A task as a person sees it: one display state, what it waits on the user for, its spend, its harness and its times.

Type Parameters​

TDetail​

TDetail = unknown

Parameters​

row​

TaskViewInput

holds?​

readonly InboxHold<TDetail>[]

The row's holds from its Inbox item (inboxItems), when the caller has one: they also carry a stop found in the row's open run that the row hasn't recorded yet, and know where each answer goes. Without them the view reads the row's own record through the Inbox's hold read, so a row holding a question waits on you whether or not the caller did the Inbox read; those holds say they can't be answered from here.

Returns​

TaskView<TDetail>

References​

TaskHold​

Re-exports TaskHold


taskHoldSchema​

Re-exports taskHoldSchema