Skip to content
API reference

almanac/contract

Import
import * as api from "@fungi.computer/shiitake-extensions/almanac";
Kind Export Description
type alias Schedule One durable schedule.
constant Schedule One durable schedule as every caller sees it.
constant almanacContract Almanac’s contract: agent-scope schedule CRUD, no Session projection.
Signature
type Schedule = Schema.Schema.Type<typeof Schedule>;

One durable schedule.

Scheduleconstant

Section titled “Schedule”
Signature
const Schedule: Struct<{
id: String;
sessionId: String;
prompt: String;
cron: NullOr<
Struct<{
expression: String;
timeZone: String;
}>
>;
nextDueAt: Int;
state: Literals<readonly ["active", "paused", "cancelled", "finished"]>;
lastCommandId: NullOr<String>;
lastError: NullOr<String>;
attempt: Int;
}>;

One durable schedule as every caller sees it.


almanacContractconstant

Section titled “almanacContract”
Signature
const almanacContract: object;

Almanac’s contract: agent-scope schedule CRUD, no Session projection.

Name Type Default value Description
id string & Brand<"ExtensionId"> - Stable extension identity.
commands object - Agent-scoped schedule operations.
commands.createOneShot object - Create a schedule with one due occurrence.
commands.createOneShot.scope "agent" "agent" The Agent owns the schedule collection.
commands.createOneShot.input Struct<{ requestId: String; sessionId: String; prompt: String; dueAt: Int; }> - Decode the caller’s one-shot schedule request.
commands.createOneShot.output Struct<{ id: String; sessionId: String; prompt: String; cron: NullOr<Struct<{ expression: String; timeZone: String; }>>; nextDueAt: Int; state: Literals<readonly ["active", "paused", "cancelled", "finished"]>; lastCommandId: NullOr<String>; lastError: NullOr<String>; attempt: Int; }> Schedule Return the created durable schedule.
commands.createRecurring object - Create a recurring cron schedule.
commands.createRecurring.scope "agent" "agent" The Agent owns the schedule collection.
commands.createRecurring.input Struct<{ requestId: String; sessionId: String; prompt: String; expression: String; timeZone: String; }> - Decode the caller’s recurring schedule request.
commands.createRecurring.output Struct<{ id: String; sessionId: String; prompt: String; cron: NullOr<Struct<{ expression: String; timeZone: String; }>>; nextDueAt: Int; state: Literals<readonly ["active", "paused", "cancelled", "finished"]>; lastCommandId: NullOr<String>; lastError: NullOr<String>; attempt: Int; }> Schedule Return the created durable schedule.
commands.read object - Read one schedule, or null when absent.
commands.read.scope "agent" "agent" Read from the Agent’s schedule collection.
commands.read.input Struct<{ scheduleId: String; }> ScheduleRef Identify the schedule to read.
commands.read.output NullOr<Struct<{ id: String; sessionId: String; prompt: String; cron: NullOr<Struct<{ expression: String; timeZone: String; }>>; nextDueAt: Int; state: Literals<readonly ["active", "paused", "cancelled", "finished"]>; lastCommandId: NullOr<String>; lastError: NullOr<String>; attempt: Int; }>> - Decode the schedule or its absence.
commands.list object - Read a bounded page of schedules after an optional identity.
commands.list.scope "agent" "agent" Read from the Agent’s schedule collection.
commands.list.input Struct<{ after: optionalKey<String>; limit: optionalKey<Int>; }> - Decode pagination arguments.
commands.list.output $Array<Struct<{ id: String; sessionId: String; prompt: String; cron: NullOr<Struct<{ expression: String; timeZone: String; }>>; nextDueAt: Int; state: Literals<readonly ["active", "paused", "cancelled", "finished"]>; lastCommandId: NullOr<String>; lastError: NullOr<String>; attempt: Int; }>> - Decode the returned schedule rows.
commands.pause object - Suspend future occurrences of a schedule.
commands.pause.scope "agent" "agent" The Agent owns the schedule.
commands.pause.input Struct<{ scheduleId: String; }> ScheduleRef Identify the schedule to pause.
commands.pause.output Struct<{ id: String; sessionId: String; prompt: String; cron: NullOr<Struct<{ expression: String; timeZone: String; }>>; nextDueAt: Int; state: Literals<readonly ["active", "paused", "cancelled", "finished"]>; lastCommandId: NullOr<String>; lastError: NullOr<String>; attempt: Int; }> Schedule Return its updated state.
commands.resume object - Restore a paused schedule to active scheduling.
commands.resume.scope "agent" "agent" The Agent owns the schedule.
commands.resume.input Struct<{ scheduleId: String; }> ScheduleRef Identify the schedule to resume.
commands.resume.output Struct<{ id: String; sessionId: String; prompt: String; cron: NullOr<Struct<{ expression: String; timeZone: String; }>>; nextDueAt: Int; state: Literals<readonly ["active", "paused", "cancelled", "finished"]>; lastCommandId: NullOr<String>; lastError: NullOr<String>; attempt: Int; }> Schedule Return its updated state.
commands.cancel object - Cancel future occurrences of a schedule.
commands.cancel.scope "agent" "agent" The Agent owns the schedule.
commands.cancel.input Struct<{ scheduleId: String; }> ScheduleRef Identify the schedule to cancel.
commands.cancel.output Struct<{ id: String; sessionId: String; prompt: String; cron: NullOr<Struct<{ expression: String; timeZone: String; }>>; nextDueAt: Int; state: Literals<readonly ["active", "paused", "cancelled", "finished"]>; lastCommandId: NullOr<String>; lastError: NullOr<String>; attempt: Int; }> Schedule Return its updated state.
projection null null Almanac has no Session projection.