// GENERATED from `supercode ontology schema` — do not edit; run node sdk/orchestrator/scripts/generate-types.mjs // // The committed `sdk/interchange/ontology-schemas.json` contracts own these types. // Native serde records remain only with the capabilities still using them. /** The access record, as Hermes's stores hold it. */ export interface Access { /** Allowed senders per platform. */ allowlist?: Record; /** Admins per platform. */ admins?: Record; /** Policy per platform; `allowlist` when absent. */ policy?: Record; } /** Per-platform policy. */ export type AccessPolicy = /** Only allowlisted (or paired) senders. */ | 'allowlist' /** Anyone. */ | 'open'; /** * One step a transition, an entry or an exit takes: a primitive the engine provides, named, with its arguments * (`notify: {roles: [creator], template: …}`). Written as a one-key map. */ export interface Action { /** The primitive (`assign`, `count`, `reset`, `notify`, `comment`, `send_to_actor`, `close_session`, …). */ name: string; /** Its arguments, as written. */ args: unknown; } /** * One agent this home declares: who answers, and which profile is its template. * A named profile implies its own agent of the same name; a declaration names others (several * agents may share one profile) and the parent each is declared under. */ export interface AgentDecl { /** Unique among the home's agents; a route, a speaker policy and a binding name it. */ name: string; /** The profile it runs as (its layered template). */ profile: string; /** A display label, not identity. */ label?: string | null; /** The agent it is declared under, if not the home's root. */ parent?: string | null; /** What a source format said about it that the IR has no field for, verbatim. */ residue?: Record; } /** What one artifact reached on the way in or out. */ export interface ArtifactFidelity { /** Path relative to the home the codec read or wrote. */ path: string; /** The tier reached. */ fidelity: Fidelity; /** Named loss; non-empty only when `fidelity` tolerates residue. */ loss?: string[]; } /** Something attached to an outbound message. */ export interface Attachment { /** `image` | `file` | `video` | `audio`. */ kind: string; /** File name. */ name?: string | null; /** MIME type. */ mime?: string | null; /** Size in bytes. */ size?: number | null; /** A URL to fetch it from. */ url?: string | null; /** A local path. */ path?: string | null; /** Adapter data to re-fetch it. */ ref?: unknown; } /** The conversation record. */ export interface Binding { /** The surface; degenerate (all `None`) on a terminal. */ key: SurfaceKey; /** The profile that owns it (`None` = the home's default). */ profile?: string | null; /** The conversation it holds a session in (G1/G5); `None` where the source records none. */ conversation?: string | null; /** The agent whose session it is; with `conversation`, its key. `None` where the source records none. */ agent?: string | null; /** The worker session. */ worker: Worker; /** * Why the conversation exists. The orchestrator's own store keeps no * trigger column (it is derived from the key and recurrence), so the * wire may omit it. */ trigger?: Trigger; /** The job this conversation is a fire of. */ recurrence?: Recurrence | null; /** Moved (or moving) to another surface. */ handoff?: Handoff | null; /** RFC3339 instants where the source has them. */ started_at?: string | null; /** Last activity, RFC3339. */ last_activity_at?: string | null; /** End, RFC3339, when ended. */ ended_at?: string | null; /** Why it ended. */ end_reason?: EndReason | null; /** Source fields the record does not model, verbatim. */ residue?: Residue; } /** * A per-action gate on a profile's agents: a start or resume over it is refused, with the reason, * and the refusal is told to the manager. It never pauses or ends anything itself. */ export interface Budget { /** The window. */ period: BudgetPeriod; /** The bound. */ limit: BudgetLimit; } /** What a budget bounds. */ export interface BudgetLimit { /** Total tokens. */ tokens?: number | null; /** Total cost. */ cost?: Cost | null; } /** A budget's window. */ export type BudgetPeriod = /** One run. */ | 'run' /** A calendar day. */ | 'day' /** A calendar month. */ | 'month'; /** * A cap on what the dispatcher starts, in the board's one capacity language (docs/adr/0009-board-capacity.md): * what it counts, in which scope, among which cards and sessions, at most how many. Every cap applies; a card starts * only when each cap that matches it has room. */ export interface Cap { /** What the cap is called where a card waits on it and in the capacity view. */ name: string; /** Where one count is kept: one for the whole home, or one per board, machine or profile. */ scope: CapScope; /** What is counted. */ counts: CapCount; /** Only what matches counts, and only a card that matches is held (every key that is given must match). */ where?: CapFilter; /** What matches this is neither counted nor held, whatever `where` says (a standing service that holds no slot). */ unless?: CapFilter; /** The most there may be in each count; a max that evaluates to nothing caps nothing. */ max: Expr; /** Slots of each count held back for the cards this matches while any waits (Hermes's review reservation). */ reserve?: Reserve | null; } /** What a cap counts. */ export type CapCount = /** Cards with a live run. */ | 'runs' /** Cards, each once whatever its runs and sessions (a cap's `where` names the statuses that hold a slot). */ | 'cards' /** Live sessions the home's cards hold, in every slot (implementer and reviewer), idle or working. */ | 'sessions' /** Those of the sessions that are in a turn now. */ | 'turns' /** Cards started in this tick. */ | 'starts'; /** Which cards and sessions a cap is about: each key given narrows it; a key's names are alternatives. */ export interface CapFilter { /** Whether the session was started or resumed by the dispatcher, rather than attached by hand. */ dispatch?: boolean | null; /** The card itself, by id. */ card?: Names; /** The model a session runs (the card's model, else its profile's). */ model?: Names; /** The harness a session runs (`claude-code`, `codex`, …). */ harness?: Names; /** The card's assignee (its profile). */ assignee?: Names; /** The card's status (for a card being started, the status its start moves it to). */ status?: Names; /** The status the board stores for the card (`blocked` for a paused card or one blocked on a message). */ stored?: Names; /** The machine the card names. */ machine?: Names; /** The card's board. */ board?: Names; } /** Where a cap keeps one count. */ export type CapScope = /** One count across every board of the home and every machine its cards run on. */ | 'global' /** One count per board. */ | 'board' /** One count per machine a card names. */ | 'machine' /** One count per profile (the lane a card's run is started in). */ | 'profile'; /** One platform's configuration. */ export interface ChannelConfig { /** The platform name (`telegram`, `slack`, `api_server`, …). */ platform: string; /** Whether the adapter is enabled. */ enabled?: boolean; /** Credential keys by reference; presence is checked at load, values never held. */ credentials?: Record; /** Adapter-specific settings, verbatim (`extra.` for the nested block). */ extra?: Record; } /** A conversation, a Resource separate from the sessions bound to it (G5, amended by M3). */ export interface Conversation { /** Its id. */ id: string; /** Thread or private. */ kind: ConversationKind; /** Where a thread is shown; no profile is part of it. */ surface?: SurfaceKey | null; /** People and agents in it. */ participants?: Participant[]; /** Who receives a line. */ speaker?: SpeakerPolicy; /** Where its record lives. */ history?: HistoryRef; /** The agent a completed transfer gave the conversation to; an unaddressed line goes to it. */ holder?: string | null; /** The agent that took the last line (round robin's position). */ last_speaker?: string | null; } /** `thread`: a root and its replies, wherever it is shown; `private`: a harness session's own input. */ export type ConversationKind = /** A root and its replies (a Room conversation, a chat thread, a mailbox exchange). */ | 'thread' /** A harness session's own conversation with its owner; its history is that transcript. */ | 'private'; /** A cost, as the provider reported it or a rate table priced it. */ export interface Cost { /** The amount. */ amount: number; /** ISO currency. */ currency: string; /** `provider` or `rate_table`. */ source?: string | null; } /** A transition taken once a duration has passed in the status (XState's `after`, ASL's `Wait`). */ export interface Delayed { /** How long, in seconds (an expression). */ after: Expr; /** Source statuses; empty applies from every status. */ from?: string[]; /** * Who may send the event: role names (the workflow's `roles`, and the engine's `platform` and `manager`). * Empty: anyone who may write the card. */ by?: string[]; /** The transition is taken only when this holds (Jira's condition); the first one that holds is taken. */ guard?: Expr | null; /** Must hold, else the event is refused with the message (Jira's validator). */ validate?: Validation[]; /** The status the card moves to: a status name, or `{{expr}}`; none stays where it is (runs the actions only). */ target?: string | null; /** What happens, in order, after the move (Jira's post functions). */ actions?: Action[]; /** What a person reads about it (the event's door text, the log). */ description?: string | null; } /** The dispatcher: when it runs, what it may start, in what order, under which caps. */ export interface Dispatch { /** Seconds between ticks. */ tick: Expr; /** The event the dispatcher sends a card it starts (to cards whose status has a transition for it). */ start: string; /** Which cards it may start this tick. */ eligible?: Expr | null; /** The order it starts them in: sort keys, `-` before one for descending. */ order?: Expr[]; /** The caps, in the capacity language. */ capacity?: Cap[]; } /** Why a binding ended (`docs/ORCHESTRATOR-IR.md` §2.5). */ export type EndReason = /** Idle expiry. */ | 'idle' /** The daily reset boundary. */ | 'daily' /** `/reset` (or the operator verb). */ | 'reset' /** `/new` (or the operator verb). */ | 'new' /** Moved to another surface. */ | 'handoff' /** The conversation was transferred to another agent (G2). */ | 'transfer' /** The agent left the conversation. */ | 'left' /** The worker failed. */ | 'error'; /** A worker environment value: a literal, or a secret by reference. */ export type EnvValue = /** A plain, non-secret value. */ | string /** A secret, named and never held. */ | SecretRef; /** * An expression over the card, its relations, the event and `params` (a small CEL-like language: literals, * `card.*`, `event.*`, `params.*`, comparisons, `&&`/`||`/`!`, `in`, and the engine's functions such as * `parents.all(p, …)`). Written as a string; a bare number, boolean or null is the literal it spells. */ export type Expr = string; /** * How faithfully a reconstruction reproduces its source. * * One vocabulary for every surface that has to state what it gave up. It was * introduced for session ARTIFACTS (`harness.v1.sessions.export` reports a * level plus a named residue list); session LOADS report the same pair, * because a read-only VIEW of a session is allowed to settle for * [`Fidelity::Semantic`] where a continuation is not (see * a session loader's explicitly semantic/read-only mode). */ export type Fidelity = /** The reconstruction reproduces the source bytes exactly. */ | 'byte_lossless' /** Every value survives; only the container bytes were re-synthesized. */ | 'value_lossless' /** Meaning survives; the named residue says exactly what did not. */ | 'semantic'; /** One fire. */ export interface Fire { /** The fire id, which is also its session name `cron__`. */ id: string; /** The job. */ job_id: string; /** The session it opened, when known. */ session_id?: string | null; /** Status. */ status: FireStatus; /** Claim instant. */ claimed_at: string; /** Start instant. */ started_at?: string | null; /** Finish instant. */ finished_at?: string | null; /** The error, on failure. */ error?: string | null; /** The delivery this fire produced, if any. */ obligation_id?: string | null; /** Ledger columns the record does not model (`source`, `pid`, …), verbatim. */ residue?: Residue; } /** * A fire's status. `unknown` is Hermes's own word for a fire whose scheduler * restarted under it; `completed` ⇄ `succeeded` on the codec boundary and * `timeout` writes back as `failed`. */ export type FireStatus = /** Claimed, not yet started. */ | 'claimed' /** Running (read from Hermes; never written by us). */ | 'running' /** Finished with a result. */ | 'succeeded' /** Finished with an error. */ | 'failed' /** The session ended without a result. */ | 'timeout' /** The scheduler restarted under it. */ | 'unknown'; /** Observations a role can subscribe to, separate from a card's transition events. */ export type FleetEventKind = 'session_started' | 'session_resumed' | 'session_ended' | 'duplicate_session_process' | 'card_waiting_on_user' | 'machine_health_crit'; /** A conversation moved (or moving) to another surface — Hermes `handoff_*`. */ export interface Handoff { /** The destination platform. */ to?: string | null; /** `pending` | `done` | `failed` (the source's own word, verbatim). */ state: string; /** The failure, when `state` is `failed`. */ error?: string | null; } /** A session moving to another conversation (Hermes `/handoff`, kept by the naming rule). */ export interface Handoff2 { /** The session (`:`). */ session: string; /** The target conversation. */ to: string; /** Who asked. */ by: string; /** Its progress. */ state: HandoffState; /** Why it failed. */ error?: string | null; /** RFC3339. */ at: string; } /** A handoff's progress. */ export type HandoffState = /** Announced on the target, not yet picked up. */ | 'pending' /** The session is bound there. */ | 'done' /** It could not move. */ | 'failed'; /** Extensible identifier for a coding harness. */ export type HarnessId = string; /** Where a conversation's record lives. */ export type HistoryRef = /** The platform's own thread (a chat thread, a Room conversation). */ | { kind: 'platform' } /** The mailbox thread. */ | { thread: string; kind: 'mailbox' } /** A private conversation's history: its owning session's transcript. */ | { session: string; kind: 'transcript' }; /** One scheduled job. */ export interface Job { /** The id (a file-name-safe token). */ id: string; /** When it fires. */ schedule: Schedule; /** The prompt. */ prompt?: string | null; /** Working directory: relative to the profile dir, or absolute. */ workdir?: string | null; /** Model override. */ model?: string | null; /** Skills to load. */ skills?: string[]; /** Job ids (or `self`) whose newest output is prepended at fire time. */ context_from?: string[] | null; /** Where the result goes. */ deliver: Target; /** Where a failure goes; `deliver` with a prefix when absent. */ failure_deliver?: Target | null; /** The creating conversation. */ origin?: JobOrigin | null; /** * The fire is a turn in the live session of the conversation it delivers to (steering a running turn where * the worker allows), instead of a session of its own; Hermes mirrors it into that transcript. */ attach_to_session?: boolean | null; /** * Which session a fire runs in: `main` (its agent's main session), `current` (the binding's session), * `isolated` (a new one) or `session:` (that one). Absent: the source's own default. */ session_target?: string | null; /** * The machine whose session runs each fire (supercode's: Hermes runs every fire on its own host). Absent, a * fire runs where the orchestrator does. */ machine?: string | null; /** Remaining-runs counter for `once` jobs. */ repeat?: Repeat | null; /** Whether it fires at all. */ enabled?: boolean; /** Next fire, RFC3339. */ next_run_at?: string | null; /** Last fire, RFC3339. */ last_run_at?: string | null; /** Last fire's status word. */ last_status?: string | null; /** Creation, RFC3339. */ created_at?: string | null; /** Source fields the record does not model, verbatim. */ residue?: Residue; } /** The conversation a job was created from (Hermes `origin`). */ export interface JobOrigin { /** The platform. */ platform: string; /** The chat type, when known. */ chat_type?: string | null; /** The chat. */ chat_id?: string | null; /** The thread. */ thread_id?: string | null; } /** Names written as one name or a list of them. */ export type Names = string[]; /** One delivery obligation. */ export interface Obligation { /** The id. */ id: string; /** The surface it goes to. */ target: SurfaceKey; /** Hermes's `session_key` column, verbatim. */ session_key?: string | null; /** What is delivered. */ content: OutboundContent; /** State. */ state: ObligationState; /** Attempts so far. */ attempts?: number; /** The last failure. */ last_error?: string | null; /** Creation instant (Hermes: epoch seconds as text). */ created_at: string; /** Last transition instant. */ updated_at: string; /** When it was sent. */ delivered_at?: string | null; /** The platform's handle for what was sent. */ posted?: Posted | null; /** Where it came from. */ source: ObligationSource; /** Ledger columns the record does not model, verbatim. */ residue?: Residue; } /** Where an obligation came from. */ export type ObligationSource = /** A conversation's turn. */ | { key?: SurfaceKey | null; kind: 'turn' } /** A job fire. */ | { fire_id: string; kind: 'fire' } /** A webhook. */ | { name: string; kind: 'webhook' }; /** Delivery state; `sent` is Hermes's `delivered`. */ export type ObligationState = /** Not yet delivered. */ | 'pending' /** Delivered. */ | 'sent' /** Gave up. */ | 'failed' /** Dropped on purpose. */ | 'dropped'; /** * The whole home: the persisted half of `OrchestratorState` (§2.1); the * runtime half is never written and is not part of the wire. */ export interface Orchestration { /** The home folder. */ root: string; /** `default` is the root folder; the rest are `profiles//`. */ profiles: Record; /** O — how the home's boards are worked (`workflow.yaml` at the root; Hermes's dispatcher when there is none). */ workflow?: Workflow; /** O — declared agents by name (§2.10); a named profile implies its own agent without one. */ agents?: Record; /** O — conversations by id, separate from the sessions bound to them (G5). */ conversations?: Record; /** O — transfers between agents, in order (G2). */ transfers?: Transfer[]; /** O — sessions moved to other conversations, in order (G2). */ handoffs?: Handoff2[]; /** O — usage per session (`:`), summed per agent (G3). */ usage?: Record; } /** What is delivered. */ export interface OutboundContent { /** The text. */ text: string; /** Attachments. */ attachments?: Attachment[] | null; /** The message this replies to. */ reply_to?: string | null; /** `text` | `markdown`. */ format?: string | null; } /** A person or an agent in a conversation. */ export interface Participant { /** An agent's name, or a person as `:` (an identity observation). */ principal: string; /** To or CC. */ role: ParticipantRole; /** RFC3339. */ since: string; /** RFC3339, when it left. */ until?: string | null; } /** How a participant is addressed on a thread (amendment M3). */ export type ParticipantRole = /** Addressed: expected to act. */ | 'to' /** Copied: receives every reply. */ | 'cc'; /** What happens to a worker's permission prompt when no human answers. */ export type PermissionDefault = /** Refuse after the timeout. */ | 'deny' /** Allow after the timeout. */ | 'allow'; /** How prompts are answered when no human is reachable (§4.6). */ export interface PermissionPolicy { /** Seconds a relayed prompt waits for an answer. */ timeout_seconds?: number; /** The answer given when nobody replies in time. */ default?: PermissionDefault; /** The answer given at once where nobody attends: a cron fire or a webhook turn. */ unattended?: PermissionUnattended; } /** * What a prompt raised where nobody attends (a cron fire, a webhook turn) is answered with, at * once (Hermes `approvals.cron_mode`). */ export type PermissionUnattended = /** Refuse it. */ | 'deny' /** Approve it. */ | 'approve'; /** The persona: `AGENTS.md` at the profile root, content hash first. */ export interface PersonaRef { /** Always `AGENTS.md` in our folder (`SOUL.md` in a Hermes home). */ path: string; /** The text, when loaded. */ text?: string | null; /** Hex sha256 of the text. */ sha256: string; } /** The platform's handle for what was sent. */ export interface Posted { /** The platform message id. */ message_id: string; } export interface PrDispositionRecorded { kind: 'pr_disposition_recorded'; url: string; head: string; by?: string; actor: string; reason: string; target: string | null; disposition: 'merge' | 'release-only'; } export interface PrReleaseReadback { kind: 'pr_release_readback'; url: string; head: string; by?: string; actor: string; reason: string; target: string; artifact: string; evidence: string; disposition_event: number; verdict: number; verification: { kind: 'machine' | 'manager-attestation'; source: string; target: string; observed_at: number; by?: string; actor?: string; receipt?: Record }; } /** One profile: a folder with `AGENTS.md` at its root. */ export interface Profile { /** `default` for the root, else the folder name. */ name: string; /** The folder. */ dir: string; /** O — which harness runs it. */ worker?: WorkerSpec | null; /** O — `AGENTS.md`. */ persona?: PersonaRef | null; /** H — `config.yaml` `platforms:` blocks. */ channels?: Record; /** H — `gateway.profile_routes`. */ routes?: Route[]; /** H — `cron/jobs.json`. */ jobs?: Record; /** H — `webhook_subscriptions.json`. */ subscriptions?: Record; /** H — allowlists and pairing. */ access?: Access; /** * O — the conversations, keyed by their slot (the surface key string for * a live one, `#[#n]` for ended ones). */ bindings?: Record; /** H — `cron/executions.db`. */ fires?: Fire[]; /** H — `delivery_obligations`. */ obligations?: Obligation[]; /** O — per-action gates on this profile's agents (G3); they only narrow down the layers. */ budgets?: Budget[]; /** What the model does not interpret. */ residue?: ProfileResidue; } /** What a profile carries that the model does not interpret. */ export interface ProfileResidue { /** `config.yaml` keys that are the source harness's, verbatim. */ config?: Record; /** Unmodeled files, by path relative to the profile dir; copied verbatim. */ files?: string[]; } /** ORCH-3: the job a recurring session belongs to. */ export interface Recurrence { /** The job id. */ job_id: string; /** `cron` | `heartbeat`. */ kind?: string; } /** Hermes 0.21.0's `repeat`: `{times: N | null, completed: M}`; `null` times = forever. */ export interface Repeat { /** Remaining fires, or `None` for forever. */ times?: number | null; /** Fires so far. */ completed?: number; } /** Slots of a cap held for some cards. */ export interface Reserve { /** The cards the slots are held for. */ for: CapFilter; /** How many. */ slots: Expr; } /** Unmodeled source fields, keyed by the source's own field name. */ export type Residue = Record; /** * One role's fleet listeners, written under `workflow.yaml` `listeners.`. * Mailboxes are explicit, preferably stable `sc::agent:` addresses; * session addresses remain valid destinations but do not follow a replacement main. */ export interface RoleFleetListener { /** The observed kinds this role receives; a nonempty list. */ events: FleetEventKind[]; /** The role's full mail addresses; a nonempty list. Existing mail authority still applies. */ addresses: string[]; /** * Normalized machine names to hear; absent means every machine the runtime may read. * An empty list deliberately hears none. */ machines?: string[] | null; } /** One route. */ export interface Route { /** Optional name. */ name?: string | null; /** What it matches. */ match: RouteMatch; /** The agent that answers (G1); a named profile's own agent bears the profile's name. */ agent: string; /** Unmodeled fields of the route, verbatim. */ residue?: Residue; } /** What a route matches; most specific wins. */ export interface RouteMatch { /** The platform. */ platform: string; /** Discord-style guild id. */ guild_id?: string | null; /** The chat. */ chat_id?: string | null; /** The thread. */ thread_id?: string | null; } /** What runs while a card is in a status: an actor of a role's lane in a named session slot of the card. */ export interface Run { /** The role whose lane (the profile it names) runs it. */ role: string; /** * The card's session slot it runs in: a live session in the slot is kept, a lost one resumed, an empty slot * started fresh. Different slots are different sessions (a reviewer never works in the implementer's). */ session: string; /** * What the actor is told when it starts: a template over the card (`{{card.id}}`, `{{context}}`) and * `{{doors}}`, the events the actor may send in this status, generated from its transitions. */ prompt?: string; /** Prompt file relative to the orchestration home. */ prompt_file?: string | null; /** Skills the actor's session is given. */ skills?: string[]; /** * Limits on the run, each an expression in seconds or a count (`runtime`, `heartbeat`, …); the engine emits * an event when one passes (`timed_out`, `stale`, …). */ limits?: Record; } /** The independently supervised run machine. Its events never become card notices. */ export interface RunMachine { /** Run specification selected for a card with an Every interval. */ recurring_role?: string | null; /** Shared supervision limits, overridden by individual role specifications. */ limits?: Record; /** Named run specifications, selected by a card status or a recurring role. */ roles?: Record; /** Run states and their entry, exit and event rules. */ states?: Record; /** Initial run state. */ initial?: string; /** Supervision shared by all run states. */ on?: Record; /** A run outcome emits this card verb (the sole link between machines). */ outcomes?: Record; } /** When a job fires. */ export type Schedule = /** Once, at an instant. */ | { run_at: string; kind: 'once' } /** Every N minutes. */ | { minutes: number; kind: 'interval' } /** A five-field cron expression in a timezone. */ | { expr: string; tz?: string | null; kind: 'cron' }; /** Where a secret value lives. Wire form: `{"env": NAME}` or `{"dotenv": KEY}`. */ export type SecretRef = /** An environment variable of the process that resolves it. */ | { env: string } /** A key in the home's own `.env` file. */ | { dotenv: string }; /** A session's usage, kept on the session and summed upward (session → agent → Org). */ export interface SessionUsage { /** The agent the session belongs to, when it has one. */ agent?: string | null; /** The records. */ usage?: Usage[]; } /** Which bound agents receive a line on a shared surface (G1). */ export type SpeakerPolicy = /** Mentions pick the agent; `default` takes the rest (a Hermes or OpenClaw surface: one agent). */ | { default?: string | null; kind: 'addressed' } /** Every bound agent gets every line. */ | { kind: 'all' } /** Agents take lines in this order. */ | { order: string[]; kind: 'round_robin' } /** An agent picks the next speaker (an event out and back, never a hidden model call). */ | { selector: string; kind: 'selector' } /** The meeting's adapter decides (RH2's floor, the voice pack). */ | { kind: 'floor' }; /** One status a card can be in. */ export interface Status { /** * What `kanban.db`'s `tasks.status` holds for a card here, so Hermes reads the board (Hermes's own nine * statuses store as themselves); the exact name rides beside it where it differs. */ stored_as?: string | null; /** What a person reads about it. */ description?: string | null; /** What runs while a card is here. */ run?: Run | null; /** A specification in the run machine's roles, without repeating supervision. */ run_role?: string | null; /** Status used when a failed or blocked run is later resumed. */ resume_as?: string | null; /** Done on entering (after the move's own actions). */ entry?: Action[]; /** Done on leaving (before the move's own actions): e.g. `close_session: reviewer`. */ exit?: Action[]; /** Events and their transitions, the first whose guard holds taken. */ on?: Record; /** Transitions taken as soon as their guard holds (XState's `always`). */ always?: Transition[]; /** Transitions taken after a time in the status. */ after?: Delayed[]; } /** Ordered lowering rule for Hermes's fixed dispatcher. */ export interface StorageRule { guard: Expr; status: string; } /** * ORCH-3: the conversation identity on a surface. Full tuple on a channel; * degenerate (all `None`) on a terminal. */ export interface SurfaceKey { /** The harness's own key string, verbatim. */ key?: string | null; /** Transport / platform (`telegram`, `slack`, `acp`, …). */ platform?: string | null; /** * `dm` | `group` | `channel` | `thread` | `main` (harness vocabulary, verbatim). * `chat_type` is the orchestrator IR's spelling of the same field. */ kind?: string | null; /** The chat / group / channel id on the platform. */ chat_id?: string | null; /** The thread or topic within the chat. */ thread_id?: string | null; /** The participant, when the surface is per person. */ participant_id?: string | null; } /** Where a result goes. */ export type Target = /** The surface the job was created from. */ | { kind: 'origin' } /** The profile's `/sethome` surface. */ | { kind: 'home' } /** A file under the profile dir (the fire's own output file). */ | { kind: 'local' } /** A named surface, as `hermes send --to` spells one. */ | { platform: string; chat_id?: string | null; thread_id?: string | null; kind: 'explicit' }; /** One agent handing a conversation to another (OpenAI handoff, AutoGen Swarm, voice `hand_off`). */ export interface Transfer { /** The conversation. */ conversation: string; /** The giving agent. */ from: string; /** The receiving agent. */ to: string; /** Who did it (the giving agent, or whom the speaker policy allows). */ by: string; /** Why. */ reason: string; /** What history the receiver is given. */ history: TransferHistory; /** For `filtered`: which part (`{"last": N}`). */ filter?: unknown; /** Its progress. */ state: TransferState; /** RFC3339. */ at: string; /** Why it was refused. */ error?: string | null; } /** How much of the conversation a transfer's receiver is given. */ export type TransferHistory = /** All of it (the default). */ | 'full' /** What the filter keeps. */ | 'filtered' /** None. */ | 'none'; /** A transfer's progress. */ export type TransferState = /** Asked, not yet applied. */ | 'pending' /** The receiver holds the conversation. */ | 'done' /** The receiver may not take part. */ | 'refused'; /** A move from the card's status on an event (or on none: `always`, `after`). */ export interface Transition { /** Source statuses; empty applies from every status. */ from?: string[]; /** * Who may send the event: role names (the workflow's `roles`, and the engine's `platform` and `manager`). * Empty: anyone who may write the card. */ by?: string[]; /** The transition is taken only when this holds (Jira's condition); the first one that holds is taken. */ guard?: Expr | null; /** Must hold, else the event is refused with the message (Jira's validator). */ validate?: Validation[]; /** The status the card moves to: a status name, or `{{expr}}`; none stays where it is (runs the actions only). */ target?: string | null; /** What happens, in order, after the move (Jira's post functions). */ actions?: Action[]; /** What a person reads about it (the event's door text, the log). */ description?: string | null; } /** ORCH-3: why a session exists (the trigger noun; `docs/HERMES-IDEAL-SUPPORT-DESIGN.md` §3). */ export type Trigger = /** A person started it on a terminal, IDE, or chat surface. */ | 'human' /** A message on a channel opened it. */ | 'channel' /** A scheduled job fired it. */ | 'cron' /** A periodic main-session turn. */ | 'heartbeat' /** An inbound webhook / mapped hook. */ | 'webhook' /** Spawned by a parent session (delegate / subagent). */ | 'parent' /** An HTTP API / bridge client. */ | 'api' /** A board's dispatcher spawned it to work a task (the workflow layer). */ | 'task' /** The source does not say. */ | 'unknown'; /** One measured use of a model, from the harness's own records (G3). */ export interface Usage { /** RFC3339. */ at: string; /** The model. */ model: string; /** Input tokens. */ input_tokens: number; /** Output tokens. */ output_tokens: number; /** Cache reads, when measured. */ cache_read_tokens?: number | null; /** Cache writes, when measured. */ cache_write_tokens?: number | null; /** Its cost, when known. */ cost?: Cost | null; } /** A validator: the expression must hold, else the event is refused with the message. */ export interface Validation { /** What must hold. */ expr: Expr; /** The refusal. */ message: string; } /** One subscription: the route is `/webhooks/`. */ export interface WebhookSubscription { /** The name. */ name: string; /** The HMAC secret, by reference. */ secret?: SecretRef | null; /** Accepted event names; all when absent. */ events?: string[] | null; /** The prompt, rendered with the payload. */ prompt_template?: string; /** Where the answer goes. */ deliver?: Target | null; /** Skills to load. */ skills?: string[]; /** Description. */ description?: string | null; /** Creation, RFC3339. */ created_at?: string | null; /** Unmodeled fields, verbatim. */ residue?: Residue; } /** The worker session a binding points at. */ export interface Worker { /** Which harness runs the conversation. */ harness: HarnessId; /** The harness's own session id, when one exists yet. */ session_id?: string | null; /** Where that session's transcript can be read (a path or store address). */ locator?: string | null; } /** Whose Claude home (or harness home) a worker runs in. */ export type WorkerHome = /** The profile folder is the harness's whole config home (its persona, skills and MCP servers only). */ | 'profile' /** * The user's own harness home (their instructions, skills, hooks, plugins, MCP servers and login), with the * profile's persona and skills brought in beside it for the session. */ | 'user'; /** The worker specification (O-record; Hermes has no worker choice). */ export interface WorkerSpec { /** Any registry id whose runtime can start a session. */ harness: HarnessId; /** Model, where the harness's door accepts one. */ model?: string | null; /** Reasoning effort, passed explicitly to harnesses that support it. */ reasoning_effort?: string | null; /** supercode preset name. */ preset?: string | null; /** Relative to the profile dir; `.` by default. */ cwd?: string; /** Extra environment for the worker process; secrets by reference. */ env?: Record; /** Permission prompt policy. */ permission?: PermissionPolicy; /** Whose harness home the worker runs in. */ home?: WorkerHome; /** How the board runs this profile's tasks. */ surface?: WorkerSurface; /** At most this many of the profile's board tasks run at once; the rest wait in `ready`. */ capacity?: number | null; } /** How a board task's session runs when the board dispatches it to this profile. */ export type WorkerSurface = /** Hermes's worker: one query, headless, closed when it answers. */ | 'headless' /** * An interactive session in a terminal pane on the machine the card names, started with a * session id the dispatcher chose, kept open, resumed when lost and replaced from the card only * when it cannot be resumed. */ | 'pane'; /** A board's workflow. */ export interface Workflow { /** The run machine; absent for legacy homes during migration. */ run?: RunMachine | null; /** Card verbs declared once, with source statuses on each transition. */ verbs?: Record; /** Derived card conditions, such as ready. */ derived?: Record; /** Relation policies, interpreted by the engine's relation primitives. */ relations?: Record; /** Flag policies, interpreted by the engine's flag primitives. */ flags?: Record; /** Ordered Hermes projection and its explicitly accepted losses. */ stored_as?: StorageRule[]; losses?: string[]; /** What a person reads about it. */ description?: string | null; /** * Named values the expressions read (`params.failure_limit`); a home's config.yaml `kanban:` keys override * them by name, so Hermes's settings are this workflow's parameters. */ params?: Record; /** Who acts on a card, each an expression naming a profile (`implementer: card.assignee`) or a person. */ roles?: Record; /** Where a new card starts: the first transition whose guard holds. */ initial: Transition[]; /** Every status, by name. */ statuses: Record; /** Events that apply in every status (a status's own `on` for the same event is tried first). */ on?: Record; /** The dispatcher. */ dispatch: Dispatch; /** * Who is told what: for each audience (`creator`, `worker`, `dependency`, `chat`: who a card's subscriptions * are), the event kinds it hears and the template each is told in. A kind not named is not sent. */ notify?: Record>; /** Role fleet listeners; a declaration grants no machine or mailbox authority. */ listeners?: Record; }