# Calendar

Runs one Verdalia calendar operation through the same calendar service used by the browser.

- Tag: `calendar`
- Input: `input`
- Output: `output`
- Text fields support `{{ input.* }}` interpolation.
- Local times are JSON objects: `{"date":"YYYY-MM-DD","minute":0}`. End minutes may use `1440` for local day end.
- `properties` must render to a JSON object and is deserialized immediately after rendering.

## Operations

### `list`

Config: `from`, `to`, and `timezone`. `from` and `to` render as RFC3339 UTC datetimes; `timezone` is an IANA name. The service enforces the maximum window.

Output is an object with `items` and optional `external_calendar_warnings` (`{connection_id, code, message}`). Each block entry is flat: `{"kind":"block", ...CalendarBlockView}`. Its direct fields include identity, block type, title, schedule, source, recurrence, and properties. Recurring projections optionally include `segment` and `exception`; use `segment.series_id` and `segment.occurrence_index` as the occurrence address. External events are separate `kind: "external_event"` entries.

### `create`

Config: `type`, optional `title`, `start`, exactly one of `end` or `duration_minutes`, `timezone`, `available`, `locked`, `cancelled`, `reminders`, typed `source`, optional `recurrence`, optional `location`, optional `description_markdown` with `description_format`, and `properties`.

`available` and `locked` are interpolated text fields reading `true` or `false`, as they are on the update operations, so a workflow can decide either at runtime. An empty field is `false`. A configuration that stored a bare boolean keeps reading as that value.

`reminders` is an interpolated text field holding either a JSON array of minutes before the start, such as `[15, 1440]`, or one bare number, such as `15`. Interpolating a block's own `properties.reminders` renders the array form. An empty field is no reminders. An offset that is not a whole minute rounds to the nearest one. A block carries at most 5, each between 1 minute and 525600 (12 months); repeats collapse and the list is stored ascending.

`location` is an interpolated text field naming where the block happens, such as `Room 4` or `{{ input.venue }}`. An empty field is no location.

`description_markdown` is an interpolated text field saying what the block is about. `description_format` decides how it is read: `markdown` (the default) parses prose, and `json_block` reads a document block tree, so a description copied from another block's `properties.description` or a task's `content` keeps everything markdown cannot spell. An empty field is no description. The block stores and outputs the description as document blocks in `properties.description`.

`cancelled` reads `true` or `false` like `available` and `locked`, and an empty field is `false`. A cancelled block is still on the calendar and still comes back from `list`, but it withholds no free time and fires no reminders. It is set here so a workflow copying blocks out of `list` carries the flag across instead of reviving something that was called off; nothing else has reason to create one.

`cancelled` is not the same as a suppressed occurrence. Suppressing removes an occurrence from its series, and `list` does not return it. Cancelling leaves the block in place and only stops it counting. `update_occurrence` with `state: suppressed` does the first; setting `cancelled` on the block does the second.

`recurrence` is `{"rule":"FREQ=...;..."}` with an optional IANA `timezone`. `rule` is a plain RRULE fragment without `RRULE:`.

Output is `CalendarMutationResponse`: `upserted_blocks`, `deleted_block_ids`, and `projection`.

### `update_block`

Config selects `block_id`, every mutable `block` field, complete `placement`, and nullable `recurrence` through interpolated text fields. Fields start blank; configure static values or interpolation paths for the workflow's actual input shape. For example, a node configured with `{{ input.block.* }}` paths can consume:

```json
{
  "block_id": "01...",
  "block": {
    "type": "time_block",
    "title": null,
    "locked": false,
    "available": false,
    "reminders": "[15, 1440]",
    "source": {"kind": "no_link"},
    "location": null,
    "description_markdown": "Agenda:\n\n- budget\n- hiring",
    "cancelled": false,
    "properties": {},
    "placement": {
      "kind": "start_duration",
      "start": {"date": "2026-06-12", "minute": 600},
      "duration_minutes": 45,
      "timezone": "Europe/Prague"
    },
    "recurrence": null
  }
}
```

Updates are complete replacements, not patches. Every block path must resolve. `title`, `location`, and `recurrence` may resolve to `null`, `reminders` may resolve to an empty string, and `description_markdown` and `cancelled` may be left blank; all other fields are required. Because an update states the block whole, leaving `location` or `description_markdown` blank clears it, and leaving `cancelled` blank reads as `false` — an update node that says nothing about it restores a cancelled block. Source unlinking uses `{"kind":"no_link"}` and clearing properties uses `{}`.

`update_block` addresses one non-recurring row. A recurring root is refused with `scoped_mutation_required`: changing a root changes every occurrence, so it goes through `update_series`. Setting RRULE on a normal row converts it into a recurring root.

Output is `CalendarMutationResponse`.

### `update_occurrence`

Config selects `parent_id`, `occurrence_index`, the complete replacement `block`, and required `state` (`active` or `suppressed`). Configure each field with the required static value or interpolation path. Copy identity from `list`; do not derive it from dates. This operation only changes one occurrence.

### `update_future_occurrences`

Config selects `parent_id`, `occurrence_index`, and the complete replacement `block`, including nullable recurrence. This operation forks or truncates the selected suffix. At occurrence 0 the suffix is the whole series, so it is written as an entire-series update rather than as a fork against an emptied predecessor.

### `update_series`

Config selects `series_id` and the complete replacement `block`, including nullable recurrence. It addresses no occurrence, because every occurrence changes. Clearing recurrence converts the root back to a normal row. Any override the rewrite invalidated is set aside rather than destroyed: it stops projecting and stops answering by id, and a restore addressed at the same series brings it back. The next structural rewrite of that series drops the set-aside rows, so only the most recent write is restorable.

All three update operations output `CalendarMutationResponse`.

### `delete_block`

Config: `block_id`. Deletes one non-recurring row. A recurring root is refused with `scoped_mutation_required`; use `delete_series`.

### `delete_occurrence`

Config: `parent_id` and `occurrence_index`. Suppresses one occurrence.

### `delete_future_occurrences`

Config: `parent_id` and `occurrence_index`. Removes the selected suffix. At occurrence 0 the suffix is the whole series, so it removes the series.

### `delete_series`

Config: `series_id`. Removes the root and every materialized exception of it, setting them aside rather than destroying them, so a restore addressed at the same series brings the whole thing back under the ids it had. A series that was forked out of another lifts the truncation it imposed on its predecessor as it goes, and restoring it re-imposes that truncation.

All delete operations output `CalendarMutationResponse`.

### `plan_task_block`

Retained task-planning operation. Config: `task_id`, `type`, optional `title`, `start`, exactly one of `end` or `duration_minutes`, `timezone`, `locked`, `available`, `reminders`, optional `location`, optional `description_markdown` with `description_format`, and `properties`. `locked`, `available`, `location`, and `description_markdown` read the same way as on `create`.

Output contains `task` and `mutation` (`CalendarMutationResponse`).

## Calendar tool provider

Tag `calendar_tools` persists direct switches for exactly these operations:

```text
calendar_list
calendar_get
calendar_create
calendar_update
calendar_occurrence_update
calendar_delete
calendar_occurrence_delete
calendar_task_block_plan
```

The `operations` config contains `list`, `get`, `create`, `update`, `occurrence_update`, `delete`, `occurrence_delete`, and `plan_task_block`. The `operations` object also carries `timezone`, the IANA zone every calendar time these tools state is read in; it defaults to `UTC`. The editor has no group selector or group-level enabled control.

All switches may be disabled; the node then emits an empty tools output. Serialization and deserialization use the canonical `operations` shape with the eight direct switches.

Legacy top-level `tool_selection` JSON is no longer migrated by this node definition. Saved nodes using that shape fall back to the default `operations` selection when recovered. Unknown legacy fields inside `operations` are ignored; omitted canonical switches use their normal defaults.
