# Aetherius local daemon API. # Language-agnostic contract for the FastAPI gateway that lets any language drive the engine. # This is the design sketch; the server implementation in src/aetherius/server must conform to it, # and the SDK client types are generated from it. openapi: 3.1.0 info: title: Aetherius Daemon version: 0.1.0 description: > Local HTTP + WebSocket gateway to the Aetherius engine. Binds to 127.0.0.1 by default. Submit a Blueprint with its inputs and secrets, then poll the result or stream live events. servers: - url: http://127.0.0.1:8787 # Authentication is optional: the daemon binds to loopback. When a token is configured, every # request must present it as a bearer credential; otherwise no auth is required. The two entries # below (bearer, or none) model exactly that. /health always opts out. security: - bearerAuth: [] - {} paths: /health: get: summary: Unauthenticated readiness probe used when spawning the daemon. operationId: getHealth security: [] responses: "200": description: The daemon is up. content: application/json: schema: type: object properties: status: { type: string } version: { type: string } /v1/runs: post: summary: Submit a Blueprint for execution. operationId: createRun requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/RunRequest" } responses: "202": description: Run accepted. content: application/json: schema: { $ref: "#/components/schemas/RunHandle" } /v1/runs/{runId}: get: summary: Fetch run status and result. operationId: getRun parameters: - { name: runId, in: path, required: true, schema: { type: string } } responses: "200": description: Run state. content: application/json: schema: { $ref: "#/components/schemas/Run" } /v1/runs/{runId}/events: get: summary: WebSocket upgrade streaming the run event feed. description: Each message conforms to contracts/events.schema.json. operationId: streamRunEvents parameters: - { name: runId, in: path, required: true, schema: { type: string } } responses: "101": { description: Switching Protocols (WebSocket). } /v1/runs/{runId}/decisions: post: summary: Deliver a human decision to a run parked on a confirm step. description: > Human-in-the-loop (Jalon 2-E). A `confirm` step parks the run until a decision arrives; this route resolves it. The `token` (carried on the `input_requested` event) authorises exactly one run's pending decision. The run stays `running` throughout — no new status. operationId: decideRun parameters: - { name: runId, in: path, required: true, schema: { type: string } } requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/DecisionRequest" } responses: "200": description: Decision delivered to the parked run. content: application/json: schema: { $ref: "#/components/schemas/DecisionAck" } "404": { description: Unknown run. } "409": { description: No pending decision for this run, or the token is invalid. } /v1/blueprints/validate: post: summary: Validate a Blueprint against the schema and the selected Act capabilities. operationId: validateBlueprint requestBody: required: true content: application/json: schema: { type: object } responses: "200": description: Validation report. content: application/json: schema: { $ref: "#/components/schemas/ValidationReport" } /v1/schema: get: summary: Return the Blueprint JSON Schema. operationId: getSchema responses: "200": { description: JSON Schema document. } /v1/schedules: post: summary: Create a persistent schedule (re-run a Blueprint on a cron/interval/at trigger). operationId: createSchedule requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/ScheduleCreate" } responses: "201": description: Schedule created (with its computed next_run_at). content: application/json: schema: { $ref: "#/components/schemas/Schedule" } "422": { description: Invalid trigger or notify policy. } get: summary: List every schedule. operationId: listSchedules responses: "200": description: All schedules, oldest first. content: application/json: schema: type: array items: { $ref: "#/components/schemas/Schedule" } /v1/schedules/{scheduleId}: get: summary: Fetch one schedule. operationId: getSchedule parameters: - { name: scheduleId, in: path, required: true, schema: { type: string } } responses: "200": description: The schedule. content: application/json: schema: { $ref: "#/components/schemas/Schedule" } "404": { description: Unknown schedule. } patch: summary: Partially edit a schedule (pause/resume via `enabled`, retune the trigger, ...). description: > Omitted fields keep their value. Setting `enabled` to true (resume) or changing `trigger` recomputes `next_run_at` from now, so a paused window is never caught up as a misfire. operationId: updateSchedule parameters: - { name: scheduleId, in: path, required: true, schema: { type: string } } requestBody: required: true content: application/json: schema: { $ref: "#/components/schemas/ScheduleUpdate" } responses: "200": description: The updated schedule. content: application/json: schema: { $ref: "#/components/schemas/Schedule" } "404": { description: Unknown schedule. } "422": { description: Invalid trigger or notify policy. } delete: summary: Delete a schedule. operationId: deleteSchedule parameters: - { name: scheduleId, in: path, required: true, schema: { type: string } } responses: "204": { description: Deleted. } "404": { description: Unknown schedule. } /v1/schedules/{scheduleId}/run: post: summary: Fire the schedule immediately, without touching its cadence. operationId: runSchedule parameters: - { name: scheduleId, in: path, required: true, schema: { type: string } } responses: "202": description: Run accepted; poll and stream it like any other run. content: application/json: schema: { $ref: "#/components/schemas/RunHandle" } "404": { description: Unknown schedule. } "422": { description: The schedule's Blueprint cannot be loaded. } /v1/recorder/sessions: post: summary: Start a recorder session that emits a Blueprint from live actions. description: > Recording is a host-local, interactive flow (a visible browser driven by demonstration, producing a Blueprint file). It is intentionally not exposed over the daemon and returns 501; use `aetherius record` or the Console Recorder instead. Reserved in the contract as a deferred capability. operationId: startRecorder responses: "501": { description: Not implemented; recording is host-local (see description). } components: securitySchemes: bearerAuth: type: http scheme: bearer description: Optional token, enforced only when the daemon is started with one. schemas: RunRequest: type: object required: [blueprint] properties: blueprint: description: Inline Blueprint object, or a path resolvable by the daemon. oneOf: [{ type: object }, { type: string }] inputs: { type: object } secrets: { type: object, additionalProperties: { type: string } } RunHandle: type: object properties: run_id: { type: string } Run: type: object properties: run_id: { type: string } status: { type: string, enum: [queued, running, succeeded, failed] } outputs: { type: object } error: { type: string, nullable: true } DecisionRequest: type: object required: [token, approved] description: A human's answer to a parked confirm step. properties: token: { type: string, description: Opaque credential from the input_requested event. } approved: { type: boolean } value: { description: Optional value supplied with the decision. } DecisionAck: type: object properties: run_id: { type: string } accepted: { type: boolean } ValidationReport: type: object properties: valid: { type: boolean } errors: type: array items: type: object properties: path: { type: string } message: { type: string } Trigger: type: object description: > When a schedule fires. Cron expressions are evaluated in the daemon host's local timezone. `misfire` decides what happens to fire times missed while the daemon was down (default run_once: one catch-up fire). required: [kind] properties: kind: { type: string, enum: [cron, interval, at] } expr: { type: string, description: 5-field cron expression (kind=cron). } seconds: { type: integer, minimum: 1, description: Seconds between fires (kind=interval). } when: { type: string, format: date-time, description: One-shot fire time (kind=at). } misfire: { type: string, enum: [skip, run_once, run_all], default: run_once } NotifyPolicy: type: object description: > Per-schedule alert policy; an empty object disables alerting. `target`/`config` values may reference `{{ secrets.x }}`, resolved from the daemon's environment at fire time (channel addresses are never persisted). `on: change` alerts only when a successful run's outputs differ from the previous fire. properties: channel: { type: string, description: Channel kind (webhook, discord, telegram, ntfy, ...). } target: { type: string, description: Single-value channel address (url, topic, chat id). } config: { type: object, additionalProperties: { type: string } } "on": { type: string, enum: [failure, success, always, change], default: failure } ScheduleCreate: type: object required: [name, blueprint, trigger] properties: name: { type: string } blueprint: type: string description: Path to the Blueprint file, resolvable by the daemon at fire time. inputs: { type: object } secrets: type: array items: { type: string } description: Secret names only; values are resolved from the environment at fire time. trigger: { $ref: "#/components/schemas/Trigger" } notify: { $ref: "#/components/schemas/NotifyPolicy" } enabled: { type: boolean, default: true } ScheduleUpdate: type: object description: Partial edit; omitted fields keep their value. properties: name: { type: string } blueprint: { type: string } inputs: { type: object } secrets: type: array items: { type: string } trigger: { $ref: "#/components/schemas/Trigger" } notify: { $ref: "#/components/schemas/NotifyPolicy" } enabled: { type: boolean } Schedule: type: object properties: id: { type: string } name: { type: string } blueprint: { type: string } inputs: { type: object } secrets: type: array items: { type: string } trigger: { $ref: "#/components/schemas/Trigger" } notify: { $ref: "#/components/schemas/NotifyPolicy" } enabled: { type: boolean } created_at: { type: string, format: date-time } next_run_at: { type: string, format: date-time, nullable: true } last_run_at: { type: string, format: date-time, nullable: true }