Skip to content

Automation Catalogue Channel

JSON Schema: state.schema.json

State Types

AutomationOperation

Operations the host currently permits for an automation.

The list on {@link AutomationState.operations} is authoritative and may change over time. Clients MUST NOT infer permission from capabilities alone: capabilities describe what the host implementation can support, while operations describe what is allowed for this particular automation now.

MemberValueDescription
Update'update'Replace editable fields using {@link AutomationUpdateRequestedAction | automation/updateRequested}.
Remove'remove'Permanently remove the automation using {@link AutomationRemovedAction | automation/removed}.
Run'run'Start a manual run using {@link RunAutomationParams | runAutomation}.

AutomationSchedule

A portable recurring schedule evaluated in a named time zone.

The expression uses exactly five whitespace-separated fields, in this order:

FieldValues
minute059
hour023
day of month131
month112 or JANDEC
day of week07 or SUNSAT; both 0 and 7 mean Sunday

Month and weekday names are ASCII and case-insensitive. Each field accepts *, a single value, an inclusive range (1-5), a comma-separated list of values or ranges (1,3,8-10), or a step applied to * or a range (for example, */15 or 1-30/2). A step MUST be a positive integer. AHP does not support seconds, years, macros such as @daily, or Quartz extensions such as ?, L, W, and #.

Minute, hour, and month must all match. When both day-of-month and day-of-week are restricted (not *), an occurrence matches when either day field matches, following Unix cron semantics.

FieldTypeDescription
expressionstringFive-field AHP cron expression described by {@link AutomationSchedule}.
timeZonestringIANA Time Zone Database identifier used to interpret the expression, for example "UTC" or "Europe/Berlin".

AutomationMisfirePolicy

How a host handles schedule occurrences missed while automatic execution was unavailable.

MemberValueDescription
Skip'skip'Discard missed occurrences and wait for the next future occurrence.
RunOnce'runOnce'Start at most one catch-up run when execution becomes available, regardless of how many occurrences were missed.

AutomationTriggerKind

Discriminant for automatic trigger definitions.

MemberValueDescription
Schedule'schedule'A portable recurring {@link AutomationSchedule}.
Event'event'A host-defined external event discovered from trigger definitions.

AutomationScheduleTrigger

Starts runs from a recurring cron schedule evaluated by the host.

FieldTypeRequiredDescription
idstringYesIdentifier unique and stable within this automation definition. Recorded in {@link AutomationTriggeredRunOrigin.triggerId} when this trigger creates a run.
kindAutomationTriggerKind.ScheduleYes
scheduleAutomationScheduleYesRecurrence and time zone evaluated by the host.
misfirePolicyAutomationMisfirePolicyNoPolicy for missed occurrences. Omission is equivalent to {@link AutomationMisfirePolicy.RunOnce}.

AutomationEventTrigger

Starts runs from events understood by the owning host.

Event trigger types, events, and configuration are discovered through {@link ListAutomationTriggerDefinitionsParams | listAutomationTriggerDefinitions}. The saved trigger includes the matching human-readable metadata so it remains displayable without repeating discovery.

FieldTypeRequiredDescription
idstringYesIdentifier unique and stable within this automation definition. Recorded in {@link AutomationTriggeredRunOrigin.triggerId} when this trigger creates a run.
kindAutomationTriggerKind.EventYes
typestringYesMatches {@link AutomationTriggerDefinition.type}.
titlestringYesHost-normalized human-readable trigger type name.
descriptionstringNoOptional host-normalized explanation of the trigger source.
eventsAutomationTriggerEventDefinition[]YesSelected events for this trigger type.

Event ids carry the trigger semantics. Titles and descriptions are last-known display metadata and do not indicate current availability.
configRecord<string, unknown>NoValues described by {@link AutomationTriggerDefinition.configSchema}. Clients MUST preserve unknown entries when editing other fields.

AutomationTrigger

An automatic trigger that can create runs for an enabled automation.

Manual execution is not represented as a trigger. An empty trigger list therefore means the automation is manual-only.

AutomationScheduleTrigger | AutomationEventTrigger

AutomationTriggerEventDefinition

Describes one host-defined trigger event.

FieldTypeRequiredDescription
idstringYesStable event id.
titlestringYesHuman-readable event name.
descriptionstringNoOptional longer explanation of when this event fires.

AutomationTriggerDefinition

Describes one host-defined event trigger type available for a prospective automation session template.

Trigger definitions are discovery metadata, not durable automation state. Hosts may return different definitions for different providers, working directories, or session configuration.

FieldTypeRequiredDescription
typestringYesStable type id stored in {@link AutomationEventTrigger.type}.
titlestringYesHuman-readable trigger type name.
descriptionstringNoOptional longer explanation of the trigger source.
eventsAutomationTriggerEventDefinition[]YesEvents available for selection. Saved triggers retain their selected event descriptors.
configSchemaConfigSchemaNoOptional schema for {@link AutomationEventTrigger.config}.

AutomationSessionTemplate

Template from which the host creates a fresh session for each automation run.

The host revalidates every selection when the run starts. Definitions never carry credentials, confirmation decisions, or durable permission grants.

FieldTypeRequiredDescription
providerstringNoProvider id matching {@link AgentInfo.provider}. Omit to use the host's default provider.
modelModelSelectionNoOptional model selection resolved when a run starts. Its {@link ModelSelection.id} matches a {@link SessionModelInfo.id} advertised by the selected provider.
agentAgentSelectionNoOptional custom agent selection identified by {@link AgentSelection.uri}.
workingDirectoriesURI[]NoOrdered working-directory URIs for each created session, equivalent to {@link CreateSessionParams.workingDirectories}. Absence means a workspace-less session.
configRecord<string, unknown>NoSession configuration values equivalent to {@link CreateSessionParams.config}, normally obtained from {@link ResolveSessionConfigResult.values}.

AutomationDefinition

Durable, client-editable definition of an automation.

A definition combines the initial automation message, the session template used for each run, and zero or more automatic triggers. Run history, timestamps, and currently allowed operations live on {@link AutomationState} rather than in the definition.

FieldTypeRequiredDescription
titlestringYesHuman-readable automation name.
messageMessageYesInitial message sent to every newly created run session. Its {@link Message.origin} kind MUST be {@link MessageKind.Automation}.
sessionAutomationSessionTemplateYesTemplate used to create fresh sessions for each run.
enabledbooleanYesWhether automatic triggers may create runs. Manual runs remain available whenever {@link AutomationOperation.Run} is advertised.
triggersAutomationTrigger[]YesAutomatic triggers. An empty list means manual-only.
_metaRecord<string, unknown>NoOpaque implementation-defined metadata. Clients MUST preserve unknown entries when updating the definition.

AutomationState

Authoritative state of one automation in the {@link AutomationCatalogState.automations} catalogue.

The host owns trigger evaluation, run claims, run retention, and operation availability. Clients render this state and submit actions or commands; they never run a fallback scheduler for a host-owned definition.

FieldTypeRequiredDescription
resourceURIYesStable ahp-automation:/&lt;id&gt; resource identifier.
definitionAutomationDefinitionYesCurrent durable definition.
nextRunAtstringNoEarliest schedule occurrence awaiting evaluation, as an ISO 8601 timestamp. It may be in the past while catch-up is pending.
runsAutomationRunSummary[]YesNewest-first retained run summaries. This is a bounded window; use {@link FetchAutomationRunsParams | fetchAutomationRuns} when {@link AutomationState.runsNextCursor} is present.
runsNextCursorstringNoOpaque cursor passed as {@link FetchAutomationRunsParams.cursor} for the next older run-history page.
operationsAutomationOperation[]YesOperations currently permitted for this automation.
createdAtstringYesCreation timestamp in ISO 8601 format.
modifiedAtstringYesLast definition modification timestamp in ISO 8601 format.
_metaRecord<string, unknown>NoOpaque host-defined state metadata.

AutomationCatalogState

Authoritative automation catalogue exposed on the ahp-automations:// channel.

A subscription snapshot contains every automation visible to the client. Subsequent {@link AutomationSetAction | automation/set} and {@link AutomationRemovedAction | automation/removed} actions keep the catalogue synchronized and participate in normal reconnect replay.

FieldTypeRequiredDescription
automationsAutomationState[]YesFull automation states keyed by {@link AutomationState.resource}.
_metaRecord<string, unknown>NoOpaque host-defined catalogue metadata.

Actions

JSON Schema: actions.schema.json

automation/createRequested

Ask the host to create a durable automation at a client-chosen resource.

Clients may dispatch this action only when the host advertises its create automation capability. {@link AutomationCreateRequestedAction.resource | resource} MUST use the ahp-automation: scheme and MUST NOT already identify an unrelated automation.

This side-effect request leaves optimistic catalogue state unchanged. The host validates trigger ids and configuration, normalizes event-trigger titles and descriptions, persists the definition, then publishes the authoritative result with {@link AutomationSetAction | automation/set}. Rejections leave the catalogue unchanged.

FieldTypeDescription
typeActionType.AutomationCreateRequested
resourceURIClient-chosen ahp-automation: URI that becomes {@link AutomationState.resource}.
definitionAutomationDefinitionComplete initial {@link AutomationState.definition}.

automation/updateRequested

Ask the host to update editable fields of an existing automation.

Clients may dispatch this action only while the target advertises {@link AutomationOperation.Update}. The host revalidates that operation and the client's authorization.

This side-effect request leaves optimistic catalogue state unchanged. The host applies accepted patches to its current authoritative definition in action order, revalidates and normalizes affected event triggers, then publishes the result with {@link AutomationSetAction | automation/set}. Omitted fields remain unchanged; when accepted actions replace the same field, the later action in server order wins.

FieldTypeDescription
typeActionType.AutomationUpdateRequested
resourceURITarget {@link AutomationState.resource}.
changesAutomationDefinitionPatchEditable {@link AutomationDefinition} fields to replace.

automation/set

Add or replace one full automation state in {@link AutomationCatalogState.automations}.

Existing entries are matched by {@link AutomationState.resource} and replaced in place. A previously unseen resource is appended.

FieldTypeDescription
typeActionType.AutomationSet
automationAutomationStateFull new or replacement automation state.

automation/removed

Remove one automation from {@link AutomationCatalogState.automations}.

Clients may dispatch this action only while the target advertises {@link AutomationOperation.Remove}. The host revalidates that operation before permanently deleting the automation. A rejected action leaves the authoritative catalogue and durable definition unchanged.

Removing an unknown resource is a no-op.

FieldTypeDescription
typeActionType.AutomationRemoved
resourceURI{@link AutomationState.resource} to remove.

Commands

JSON Schema: commands.schema.json

listAutomationTriggerDefinitions

Discover event-trigger types available for a prospective session template.

Hosts may vary definitions by provider, workspace, and session configuration. Schedule triggers are protocol-defined and therefore do not appear in this result. The result describes current authoring and validation choices. Saved {@link AutomationEventTrigger} values retain their selected event descriptors for display but do not establish current availability.

PropertyValue
DirectionClient → Server
TypeRequest

Parameters:

FieldTypeRequiredDescription
channel'ahp-root://'YesTrigger definitions are discovered from the root channel.
providerstringNoProspective provider id matching {@link AgentInfo.provider}, or omitted for the host default.
workingDirectoriesURI[]NoProspective {@link AutomationSessionTemplate.workingDirectories}.
sessionConfigRecord<string, unknown>NoProspective resolved {@link AutomationSessionTemplate.config}.

Result:

FieldTypeDescription
itemsAutomationTriggerDefinition[]Available event trigger definitions.

runAutomation

Start a manual run of an automation.

Manual execution is independent of {@link AutomationDefinition.enabled}. The host persists the run before beginning session side effects.

PropertyValue
DirectionClient → Server
TypeRequest

Parameters:

FieldTypeDescription
channel'ahp-automations://'Manual runs are scoped to the catalogue channel.
automationURITarget {@link AutomationState.resource}.
requestIdstringDurable client-generated idempotency key. Retrying with the same key and automation MUST return the original run URI rather than create another run.

Result:

FieldTypeDescription
resourceURISubscribable ahp-automation-run: URI matching {@link AutomationRunState.resource}.

fetchAutomationRuns

Load one older page into a catalogued automation's run-history state.

The response only acknowledges the request. The updated full state arrives through {@link AutomationSetAction | automation/set} on the ahp-automations:// channel, keeping all catalogue subscribers synchronized through the normal action stream.

PropertyValue
DirectionClient → Server
TypeRequest

Parameters:

FieldTypeRequiredDescription
channel'ahp-automations://'YesRun-history loading is scoped to the catalogue channel.
automationURIYesTarget {@link AutomationState.resource}.
cursorstringNoCursor previously received as {@link AutomationState.runsNextCursor}. Omit to request the first page not already included by the snapshot.

Result:

(empty object)


Released under the MIT License.