Skip to content

zidane-ui/session/headless

import { … } from 'zidane-ui/session/headless'ui/src/session/headless/index.ts

Functions#

arrangeHomeBlocksFunction#

The blocks shown, in the user's order and at the widths they picked, and the ones they hid.

attachmentsKeyFunction#

An equality key for a wire attachment list: type, name, length and both ends of the data (the whole payload would cost tens of ms per change for multi-MB images).

buildDiffTreeFunction#

Builds the tree of the changed files: folders before files, both by name, a chain of single-folder folders merged into one row, totals on each folder.

canKeepScheduleFunction#

Whether Keep applies: a repeat the agent made, which the backend turns off at expiresAt unless you keep it.

collectSessionDiffsFunction#

The patches of a session's edits, in order (several edits to one file stay separate entries).

countArtifactsFunction#

The number of artifacts across groups: the indicator badge.

createArtifactsStateFunction#

Creates an ArtifactsState.

createKeyedStateFunction#

Creates a KeyedState.

createPlansStateFunction#

Creates a PlansState.

createProviderUsageStateFunction#

Creates a ProviderUsageState. The cadence (when to auto-load) is the reader's: useProviderUsage.

createQueueStateFunction#

Creates a QueueState.

createRunningWorkStateFunction#

Creates a RunningWorkState.

createSchedulesStateFunction#

Creates a SchedulesState.

createSecretsStateFunction#

Creates a SecretsState.

createSessionActionsFunction#

The session actions over an app's hosts.

createSideRequestsFunction#

Creates an empty SideRequests: one per window.

createUsageSummaryStateFunction#

Creates a UsageSummaryState.

displayedPlanFunction#

The plan a session shows: the session scope's applying plan, else its most recent stopped one, else the last that closed (read-only). Never a proposal: the Inbox shows those. Sub-agent plans are not shown here.

fileDiffCountsFunction#

Changed-line counts for a parsed working-tree file. pierre's FileDiffMetadata.additionLines / deletionLines are the LINE CONTENTS (context included), not counts; rendering them printed file content where the list should show +12 −3. The hunks carry the real + / - counts.

fileOrderFunction#

Files in tree order, collapsed folders included.

formatTokensFunction#

Number and day helpers of the usage views. The usage card's own words (costs, hours, the comparison line) are zidane's (zidane/chat/pure: formatCost, formatHour, tokenComparison), shared with the usage block.

groupArtifactRowsFunction#

Groups rendered artifacts by kind, the built-in kinds first, the others alphabetically; rows keep their order.

groupByPathFunction#

The entries per path, in first-seen order, with summed counts: the file list on top of the panel.

hideHomeBlockFunction#

prefs with block id hidden.

homeBlocksOfFunction#

The panels that are blocks, in default order (home.order, then catalog order).

homeRowsFunction#

The rows the shown blocks make.

inboxPlansFunction#

Splits a session's plans into the Inbox's "In progress" and "Recent". Session scope only: sub-agent plans close with their run and are not listed.

isScheduleFinishedFunction#

Whether a reminder is finished: on, but with no next time (a one-off that was sent).

isUsageSummaryFunction#

Enough of the shape to render without throwing; anything else is dropped.

localDayStringFunction#

Local YYYY-MM-DD for a Date. Matches SQLite's date(…, 'localtime') buckets the backend aggregates by, or streak math drifts at midnight.

moveHomeBlockFunction#

prefs with block id moved delta places among the shown blocks.

parseHomePrefsFunction#

Every project's arrangement from its stored form; undefined for anything unrecognised.

parseSideCommandFunction#

Reads /side with an optional question: the question ('' for none), or null for any other prompt.

pickUsageSummaryFunction#

The summary to show for range: its own, or while it loads another range's (the one on screen, else any).

placeHomeBlockFunction#

prefs with block id moved to the place of block target among the shown blocks (a drop on that card): before it when coming from below, after it when coming from above.

plainArtifactRowFunction#

A plain row for a stored artifact: its label as the title, a web URI as the link. For a backend that answers stored artifacts without rendering them.

planTallyFunction#

A plan's steps per status, as the tally chips show them.

readReminderWhenFunction#

Reads the Reminders form's time field (in 20m, tomorrow 9:00, weekdays 9:00, cron "0 9 * * 1-5") in the client's time zone. The prompt has its own field, so words after the time are refused.

relativeToFunction#

key relative to root when inside it; untouched otherwise.

remindersSummaryFunction#

The composer badge's summary of a session's schedules. null when none will fire.

sameRunningWorkFunction#

Same items, in the same order and states: the list on screen stays.

sessionKeyCommandsFunction#

The session actions as key commands on the session on show (sessionGenerateTitle, sessionCompact, sessionExportMarkdown, sessionExportJson, sessionDelete, sessionCopyId, sessionFavorite). None without a session; no favorite on the main session.

setHomeBlockViewFunction#

prefs with one control of block id set.

setHomeBlockWidthFunction#

prefs with block id at width.

showHomeBlockFunction#

prefs with block id shown (added, or hidden and shown again), after every shown block.

sortSchedulesFunction#

Schedules as the Reminders panel lists them: the ones that will fire, soonest first, then the rest, newest first.

sortSecretsFunction#

Secrets by name, as the panel lists them.

stagedToWireFunction#

Staged attachments → wire attachments. An entry whose data URL can't be parsed is dropped.

toQueuedMessagesFunction#

The queue rows of a session's entries.

upcomingSchedulesFunction#

The schedules that will fire, soonest first: on, with a next time.

visibleRowsFunction#

The rows on screen: a collapsed folder hides what is below it.

wireToStagedFunction#

Wire attachments → staged ones. size comes from the base64 length; name falls back to '' so the round trip keeps attachmentsKey stable.

Constants#

DEFAULT_SESSION_LABELSConstant#

The default English strings of the session panels. Override any of them through SessionProvider.

EMPTY_HOME_PREFSConstant#

Nothing arranged yet.

USAGE_RANGESConstant#

The ranges, in the order a range switcher shows them.

USAGE_SNAPSHOT_KEYConstant#

The default storage key of the usage snapshot.

Interfaces#

ActivePlanSummaryInterface#

The one-line summary the composer pill and the TUI footer show.

ArtifactsStateInterface#

The artifact groups of every session a host has seen.

DiffListFileInterface#

One changed file, as a diff source lists it.

DiffTreeDirInterface#

A folder row of the tree.

DiffTreeFileInterface#

A file row of the tree.

HomeBlockInterface#

A block of the home.

HomeBlockSourceInterface#

What the home needs of a panel summary.

HomePrefsInterface#

How the user arranged one project's home.

InboxPlansInterface#

A session's plans as the Inbox shows them.

KeyedStateInterface#

A map of values whose keys each have a readable store.

PlansSnapshotInterface#

What a window shows of a session's plans.

PlansStateInterface#

The plan snapshots of every session a host has seen.

PlanStepInterface#

One step of a plan; the todo item the agent tracks.

PlanViewInterface#

The plan a session shows as "in progress", with a display-only liveness flag.

PromptAttachmentInterface#

Attachment carried alongside the prompt text (base64, no data-URL prefix).

ProviderResetCreditInterface#

One banked reset.

ProviderResetOutcomeInterface#

What redeeming a banked reset did. reset: the windows were emptied; nothing_to_reset: no window had usage, so nothing was spent; no_credit: no reset left; already_redeemed: this request was already applied; failed: the request failed (error says why), possibly before reaching the provider.

ProviderResetTargetInterface#

Which account a banked reset is spent on: a snapshot's provider and credential.

ProviderUsageSnapshotInterface#

Usage of one credential of a provider, as probed at one moment.

ProviderUsageSourceInterface#

The backend calls a ProviderUsageState makes.

ProviderUsageStateInterface#

One cache of subscription usage, shared by every reader.

ProviderUsageViewInterface#

What the subscription-usage readers see.

QueueAddOptionsInterface#

What goes with a message added to the queue.

QueueBackendInterface#

The backend calls the queue state makes.

QueuedAttachmentInterface#

An attachment on a queued prompt, without its bytes.

QueuedMessageInterface#

One message waiting in a session's queue, as the queue panel shows it.

QueueStateInterface#

The queues of every session a host has seen.

RemindersSummaryInterface#

What the composer's Reminders badge shows: how many will fire, and the soonest time.

RunningWorkItemInterface#

Parent-level cancellable tool call or background task.

RunningWorkStateInterface#

The running work of every session a host has seen.

ScheduleInterface#

A stored schedule.

ScheduleFireInterface#

One fire of a schedule, newest first in schedules.fires.

ScheduleInputInterface#

What schedules.create takes.

SchedulePatchInterface#

What schedules.update takes: the fields to change. expiresAt: null keeps a schedule for good (you pinned it).

SchedulesBackendInterface#

What a SchedulesState reads from the backend.

SchedulesStateInterface#

The reminders a host holds, as stores.

SchedulesStatusInterface#

Whether reminders are on (Settings.schedules) and whether the backend's store keeps them (zidane's schedules.status).

SecretsStateInterface#

The secret lists of every session a host has read.

SessionActionsInterface#

The session actions; each one present only when its capability is.

SessionActionsDepsInterface#

What the session actions run over. Each member left out removes the actions that need it.

SessionActionTargetInterface#

The session an action runs on: what the actions read off its row.

SessionArtifactInterface#

A recorded output of a session, such as a pull request, a branch, a commit or a file.

SessionArtifactGroupInterface#

A session's artifacts of one kind.

SessionArtifactRowInterface#

One artifact and its rendered row.

SessionArtifactRowViewInterface#

An artifact's row, rendered by the backend (the kind registry lives there).

SessionArtifactsInterface#

What a session produced: pull requests, branches, commits, files, extension kinds.

SessionConfirmOptionsInterface#

What confirm is asked before a delete.

SessionDetailsActionsInterface#

The session details dialog's actions on one session.

SessionDiffEntryInterface#

One edit the agent made, as a patch.

SessionEditEventInterface#

A transcript event as the Diffs panel reads it: a tool event may carry the edit it made.

SessionHostInterface#

The session panels' host. Every member is optional: what a host leaves out is not shown.

SessionPlansInterface#

A session's plans: the one the agent applies, the ones that stopped or closed.

SessionQueueInterface#

A session's type-ahead queue: messages sent while the agent works, delivered when the run ends.

SessionRunningWorkInterface#

A session's cancellable work: parent-level tool calls and background tasks.

SessionSchedulesInterface#

Reminders (zidane's schedules): prompts sent to a session at a set time, once or on a repeat. The Reminders panel and the composer badge. Every action rejects with the backend's reason (the feature is off, a refused input).

SessionSecretInputInterface#

What a secret saved by hand takes: its name, its value, how long it stays.

SessionSecretsInterface#

The saved secrets of a session's project (Settings.secrets): the Secrets panel. Values go in, never out: the entries carry names and expiry times only. The backend lists none while the setting is off.

SessionSideChatsInterface#

/side chats: a hidden session about another one (never listed, deleted with it), running read-only tools that read the parent, while the parent's own run streams.

SessionTurnInterface#

One persisted turn of a session: a user prompt, an assistant response, or a system or command entry.

SessionTurnsInterface#

A session's stored turns: what the turn details dialog reads and does.

SessionUsageInterface#

Usage: spend summaries and the providers' subscription windows.

SideChatLookupInterface#

A session's side chat (null until the first send creates it) and the session's own row.

SideChatSessionInterface#

A session row as the side chat needs it: its id; the app's pickers read the rest.

SideRequestsInterface#

The /side hand-over between a composer and the side chat.

StagedAttachmentInterface#

An attachment staged in the queue editor.

TodoItemInterface#

One item of a todowrite call.

UsageHeatmapDayInterface#

One heatmap cell. Sparse: days without activity are left out.

UsageModelDayPointInterface#

One stacked-bar segment of the models chart: a model's tokens on a day.

UsageModelRowInterface#

Per-model usage over the summary's range. tokensIn counts prompt input plus cache reads and writes; cost is USD.

UsageProviderRowInterface#

Spend per provider.

UsageSummaryInterface#

Usage and spend over a range. The heatmap always spans the last ~26 weeks.

UsageSummaryStateInterface#

The usage summaries a host keeps.

UsageSummaryStateOptionsInterface#

Options for createUsageSummaryState.

Types#

DiffTreeNodeType#

A row of the Diffs file tree: a folder or a file.

HomeRowType#

A row of the home: one full block, or two half blocks.

PlanControlActionType#

Stops or drops a plan.

PlanEditOpType#

A user edit to a plan's steps.

QueueAddDeliveryType#

How the backend delivered a message added to the queue.

QueuePushDeliveryType#

How the backend delivered a queued message pushed into the run now (missing: the entry was gone).

ReminderWhenType#

The time words of the Reminders form, read: a trigger, or why not.

SessionActionNameType#

The names onError reports.

SessionCacheReportType#

A session's recent requests and their prompt-cache numbers (zidane's CacheReport).

SessionExportFormatType#

The export formats of a transcript.

SessionLabelsType#

The shape of the session label dictionary. Some values are functions that build a string.

SessionSecretEntryType#

One saved secret of a session's project, without its value: name, save time, expiry, the session that saved it.

SideRefusalType#

Why a /side cannot open: no conversation yet, a host without side chats there, no side panel to open.

TodoTallyCountsType#

Steps per status.

UsageRangeType#

The time window of a usage summary.

UsageSummariesType#

The summaries held, by range.