Download all docs
connectivity

Wire

The edge that turns a pile of elements into a graph — a wire connects one element's output port to another's input port, carries each payload as a typed envelope, and records what flowed through so you can inspect the last value and recent history on the canvas.

Working with it

Selecting a Wire reveals its settings in the properties panel; it has no dedicated full-screen workbench.

How it appears

The same element type rendered as a definition, a circle instance, and a live workspace card.

Wr
type

Wire

Connect an output port to an input port and carry typed envelopes between them

connectivityatomdefinition

When to use / not

When to use

  • Connecting a producer's output port to a consumer's input port so payloads flow between two distinct elements on the same canvas.
  • Inspecting what last crossed a connection — the wire-properties Last Payload tab reads the destination port's latest cell and recent ring-buffer history.
  • Fanning a port's envelope flow out to live observers with `transport: sse`, instead of the default synchronous `direct` handoff.

When not to use

  • Sequencing, branching, or looping over steps — a wire only carries envelopes between two ports; orchestration logic belongs in an app or automation (condition / loop / wait).
  • Transforming or filtering the payload in transit — put a function (python, javascript) or a modifier (validation, filter-words) on the path; a wire passes the envelope through unchanged.
  • Buffered async messaging today — `queue` transport is planned; for durable buffering reach for the queue element, since the live wire transports are `direct` and `sse`.

Topology

Composed with other elements inside an app or circle.

Properties

fromobject
Source endpoint — the OUTPUT port emitting envelopes.
toobject
Destination endpoint — the INPUT port consuming envelopes.
transportstring
How envelopes flow over this wire. `direct` (default) — synchronous in-process handoff between adjacent elements; `queue` — buffered async (planned); `sse` — server-sent-events fan-out for live observers.
enabledboolean
When false, the wire is present in the graph but doesn't carry payloads.

Operations

  • activityGET
  • attachmentsGET
  • batch_statsGET
  • composePOST
  • contextGET
  • createPOST
  • deleteDELETE
  • disablePOST
  • enablePOST
  • export_bundleGET
  • getGET
  • get_port_cellGET
  • get_port_cell_by_nameGET
  • get_port_historyGET
  • get_port_history_by_nameGET
  • import_bundlePOST
  • intentionGET
  • promotePOST
  • readmeGET
  • readme_updatePOST
  • remove-modifierPOST
  • restorePOST
  • schemaGET
  • sourceGET
  • source_branchesGET
  • source_promotePOST
  • source_repairPOST
  • source_statusGET
  • source_validatePOST
  • statsGET
  • treeGET
  • updatePATCH
  • update_metaPATCH
  • versionGET

Errors / when it fails

from.element and to.element must differ (no self-loops).
Fails unless: from.element != to.element
from and to must point at different ports.
Fails unless: from.element != to.element || from.port != to.port

Wire (wire)

Category: connectivity | Form: | Symbol: Wr

Connect an output port to an input port and carry typed envelopes between them

A wire is the connection between two ports — from.element:from.port (an output) to to.element:to.port (an input). It carries payloads as homogeneous envelopes ({data, meta: {actor_id, ts, trace_id, schema_ref, port_id}}) and persists them into per-port port_cells (latest-value) and port_history (ring buffer of last N) tables. The wire-properties Last Payload tab on the canvas reads from these.

Guide

Connect an output port to an input port and carry typed envelopes between them

What It Does

A wire is the connection between two ports — from.element:from.port (an output) to to.element:to.port (an input). It carries payloads as homogeneous envelopes ({data, meta: {actor_id, ts, trace_id, schema_ref, port_id}}) defined by the canonical port-envelope schema, and persists them into per-port port_cells (latest-value) and port_history (ring buffer of the last N) tables.

Wire is a first-class element under the connectivity category — it has a database row (UUID, parent, spec JSON, lifecycle SSE events) and YAML schema like any other element. It is an atomic structural element: it has no children and exposes no ports of its own — it connects other elements’ ports rather than presenting any. The wire’s spec captures just three things: the source endpoint, the destination endpoint, and the transport.

Wires don’t execute in the active sense an action element does — they observe the envelope flow. Each envelope written through a wire lands in the destination port’s cell and history substrate. The operations below are the read API over that substrate: the wire-properties Last Payload tab on the canvas reads through them.

Element Definition

PropertyValue
Typewire
Categoryconnectivity
Formatom
Residencecanvas
SymbolWr
Iconpolyline / #06B6D4

Properties

FieldTypeDefaultDescription
from.elementstringSlug of the source element (max 128 chars)
from.portstringName of the source element’s output port (max 64 chars)
from.port_idstring (uuid)Optional UUID of the source port, resolved at wire-create time
to.elementstringSlug of the target element (max 128 chars)
to.portstringName of the target element’s input port (max 64 chars)
to.port_idstring (uuid)Optional UUID of the target port, resolved at wire-create time
transportstringdirectHow envelopes flow: direct, queue, or sse
enabledbooleantrueWhen false, the wire is present in the graph but doesn’t carry payloads

from requires element + port; to requires element + port.

Transport values:

  • direct (default) — synchronous in-process handoff between adjacent elements.
  • queue — buffered async (planned).
  • sse — server-sent-events fan-out for live observers.

Ports

Wires have no ports of their own. They reference other elements’ ports via from / to in the spec — the contract declares empty inputs and outputs.

Persistence

Wire-carried envelopes are written to two per-circle tables:

TableRole
port_cellsLatest-value cell — the most recent envelope per port
port_historyRing buffer of recent envelopes per port

Metrics

MetricTypeDescription
wire_countcounterTotal wires created over the lifetime of the circle
wire_envelope_countcounterTotal envelopes written to port_cells via wire traversal
wire_envelope_byteshistogramDistribution of envelope JSON sizes (after serialization)

Operations

All wire operations are read-only (auth: read) and are keyed by port, not by the element-scoped /ops/{op} convention — either by port_id (UUID) or by (element, port_name, direction).

get_port_cell

GET _port_cells/{port_id}

Latest envelope cell for a port keyed by UUID. Returns the most recent envelope written to the named port. Useful when a UI surface already knows the port’s UUID (e.g. a wire’s resolved from.port_id / to.port_id). The cell is NULL/absent when the port has never been written to. Auth: read.

get_port_history

GET _port_history/{port_id}

Ring-buffer history for a port keyed by UUID. Returns the last N envelopes for the port, newest first. N is clamped server-side to the ring-buffer cap (PORT_HISTORY_DEFAULT_RING_SIZE = 10). Accepts an optional limit query parameter (default 10). Auth: read.

get_port_cell_by_name

GET {element}/_ports/{port_name}/cell

Latest envelope cell for a port keyed by (element_slug, port_name, direction). The name-keyed variant — UI surfaces that know a wire’s (target_element_slug, target_port_name) but not the port’s UUID call this. direction is an enum (in | out) and defaults to in (the target side of a wire is always an input port). Auth: read.

get_port_history_by_name

GET {element}/_ports/{port_name}/history

Ring-buffer history for a port keyed by (element_slug, port_name, direction). The name-keyed history variant. limit (default 10) and direction (default in) defaults match get_port_cell_by_name. Auth: read.

Quick Start

Creating a wire via API

A wire connects one element’s output port to another element’s input port. Create it on the canvas it lives on:

POST /api/{circle}/{parent}/
Content-Type: application/json

{
  "element_type": "wire",
  "slug": "fetch-to-store",
  "name": "Fetch → Store",
  "spec": {
    "from": { "element": "fetch-fn", "port": "result" },
    "to":   { "element": "store-db", "port": "payload" },
    "transport": "direct",
    "enabled": true
  }
}

Inspecting the latest payload

Read the most recent envelope on the destination port by name:

GET /api/{circle}/store-db/_ports/payload/cell

Or by the resolved port UUID:

GET /api/{circle}/_port_cells/{port_id}

Inspecting recent history

GET /api/{circle}/store-db/_ports/payload/history?limit=10

Common Mistakes

Wiring a port back to the same element. A wire cannot connect a port back to a port on the same element (no_self_loop): from.element and to.element must differ.

Connecting a port to itself. A wire must connect two distinct ports (from_and_to_must_differ): either the element or the port must differ between from and to.

Expecting more history than the ring buffer holds. port_history is a ring buffer. limit is clamped server-side to PORT_HISTORY_DEFAULT_RING_SIZE (10), so requesting more does not return older entries.

Expecting queue transport to buffer today. transport: direct is the synchronous, in-process path. queue (buffered async) is planned — direct and sse are the live behaviors.

Properties

PropertyTypeDefaultDescription
fromobjectSource endpoint — the OUTPUT port emitting envelopes.
toobjectDestination endpoint — the INPUT port consuming envelopes.
transportstring"direct"How envelopes flow over this wire. direct (default) — synchronous in-process handoff between adjacent elements; queue — buffered async (planned); sse — server-sent-events fan-out for live observers.
enabledbooleantrueWhen false, the wire is present in the graph but doesn’t carry payloads.

Operations

activity

Get /ops/activity | Auth: Read

Get activity events for this element

Scope depends on element capabilities: individual elements query by element_id, project-form elements with activity-scope-members include member activities, circle-level elements with activity-scope-all query the entire circle. Gracefully returns empty list if activities table is missing (old circles).

attachments

Get /ops/attachments | Auth: Read

List all modifiers and resources attached to this element

Returns both modifiers (policy enforcement) and resources (data injection) with is_modifier flag to distinguish. Items in the generated MODIFIER_TYPES list are modifiers; everything else is a resource. Includes cascade_policy and version pin info.

batch_stats

Get /ops/batch_stats | Auth: Read

Get per-element statistics for all children of this element

Returns per-child stats plus an aggregate. Most meaningful on compound or manifest form elements (repositories, circles, projects); atoms have no children so the result is an empty children array with a zeroed aggregate. Uses efficient GROUP BY SQL. Weighted averages for eval scores.

compose

Post /ops/compose | Auth: Execute

Batch add and remove modifiers on this element in a single call

Declarative composition: add modifiers by ref path (slug or path@version) and remove by attachment ID, all in one atomic call on the target element. Each ‘add’ entry resolves the source element, validates topology, attaches with optional priority and cascade policy. Each ‘remove’ entry deletes the attachment row. Returns a summary of what was added and removed. Example: compose({ add: [{ref: “my-prompt”}, {ref: “rate-limit/api@v2”, priority: 50}], remove: [{attachment_id: “uuid”}] })

context

Get /ops/context | Auth: Read

Get connected elements (graph traversal)

Graph traversal showing all connected elements with their relationship type (contains, contained_by, references, referenced_by, attaches, etc.). Use ?depth=N to control traversal depth (default 1) and ?types=actor,data to filter by element types.

create

Post /ops/create | Auth: Write

Create child element

POST to the parent path — element_type goes in the request body, NOT the URL. Both element_type and slug are required and must be non-empty. Name is derived from slug if omitted. Writes to both Git and PostgreSQL. All elements are stored flat under the circle — no intermediate library wrapper rows.

delete

Delete /ops/delete | Auth: Admin

Delete element (soft delete)

Soft delete — sets state to ‘deleted’ but retains the record. Cannot delete elements that have children (has_no_bond precondition) or active runs. Requires admin auth and confirmation.

disable

Post /ops/disable | Auth: Admin

Disable element (hides and prevents use)

Idempotent — safe to call on already-disabled elements. Optionally pass a reason string. Disabled elements cannot be invoked or executed. Inverse of enable.

enable

Post /ops/enable | Auth: Admin

Enable element (makes usable and visible)

Idempotent — safe to call on already-enabled elements. Transitions element to ready/enabled state. Cannot enable deleted elements. Inverse of disable.

export_bundle

Get /ops/export/bundle | Auth: Read

Export element as downloadable git bundle

On non-root-namespace elements, returns a binary git bundle. On root-namespace (circle) elements, dispatch hands off to the circle’s own export_bundle op, which returns a multi-element JSON envelope with one base64 bundle per child element — this is intentional, not an error.

get

Get /ops/get | Auth: Read

Get element details

Element is already resolved by the routing layer — this returns the cached element, not a fresh DB query. Use the path /api/{circle}/{slug} to address elements.

get_port_cell

Get /ops/_port_cells/{port_id} | Auth: Read

Latest envelope cell for a port keyed by UUID.

Returns the most recent envelope written to the named port. Useful when a UI surface already knows the port’s UUID (e.g. a wire’s resolved from.port_id / to.port_id).

get_port_cell_by_name

Get /ops/{element}/_ports/{port_name}/cell | Auth: Read

Latest envelope cell for a port keyed by (element_slug, port_name, direction).

Name-keyed variant — UI surfaces that know a wire’s (target_element_slug, target_port_name) but not the port’s UUID call this. Direction defaults to in (target side of a wire is always an input port).

get_port_history

Get /ops/_port_history/{port_id} | Auth: Read

Ring-buffer history for a port keyed by UUID.

Returns the last N envelopes for the port, newest first. N is clamped server-side to the ring-buffer cap (PORT_HISTORY_DEFAULT_RING_SIZE = 10).

get_port_history_by_name

Get /ops/{element}/_ports/{port_name}/history | Auth: Read

Ring-buffer history for a port keyed by (element_slug, port_name, direction).

Name-keyed history variant. Limit + direction defaults same as get_port_cell_by_name.

import_bundle

Post /ops/import/bundle | Auth: Write

Import git bundle into element

Accepts a base64-encoded git bundle in the JSON bundle_base64 field. Use overwrite=true to replace existing elements with same slug (default skips duplicates). Imported elements get new UUIDs. Returns counts of imported/skipped elements and any errors.

intention

Get /ops/intention | Auth: Read

Get element intention with full inheritance chain

Returns three levels: direct (this element’s intention), inherited (from category and root), and resolved (final merged intention). Useful for understanding an element’s purpose in context of its hierarchy.

promote

Post /ops/promote | Auth: Admin

Promote element configuration to a target environment

Only for manifest-form elements (projects). Environments advance: dev → demo → live. dev→demo requires member+ role, demo→live requires admin. Freezes member versions at promotion time (creates snapshot). Persists environment config to spec.environments.

readme

Get /ops/readme | Auth: Read

Get element README.md content

Reads README.md from the element’s git repository. Returns empty content (not an error) if no README exists. Always returns markdown format.

readme_update

Post /ops/readme_update | Auth: Write

Update element README.md content

Creates or overwrites README.md in the element’s git repo. Commits to the draft branch. Content must be provided as a markdown string.

remove-modifier

Post /ops/remove-modifier | Auth: Execute

Remove an attached modifier from this element by attachment ID

Removes a modifier/resource attachment by its row ID. The ID comes from the attachments or context API. This is the reverse of attach — called on the target element, not the source.

restore

Post /ops/restore | Auth: Admin

Restore element to a specific version

Automatically snapshots the current state before restoring (creates a ‘Before restore to vN’ version entry). Writes restored spec to git as .triform/spec.yaml. Git failures warn but don’t fail the operation — DB state is authoritative. Cannot restore deleted elements.

schema

Get /ops/schema | Auth: Read

Get element input/output schema (MCP tools/list compatible)

Returns type-level port schemas from the TypeRegistry — not instance-specific overrides. Includes direction (input/output), required flag, and JSON schema per port. Useful for understanding what data an element accepts and produces.

source

Get /ops/source | Auth: Read

Get any file’s content from the element’s git repository

Reads an arbitrary file from the element’s CAS-backed git tree by its relative path. Same store as readme, just generalized. Path safety: rejects .. traversal, leading /, and null bytes. Use this to view main.py for action elements, asset files for SPAs, etc. Returns empty content (not an error) if the file doesn’t exist.

source_branches

Get /ops/source/branches | Auth: Read

List Source branches for this element

Returns the standard draft/demo/live Source branches, their current commits, and promotion relationships. Use GET /api/{element_path}/ops/source/branches.

source_promote

Post /ops/source/promote | Auth: Write

Promote Source branch forward

Promotes draft to demo or demo to live through the generated element op path. Direct Git pushes to demo/live are blocked by Source policy.

source_repair

Post /ops/source/repair | Auth: Write

Inspect or repair the element Source index

Runs Source repair through the element operation path. Defaults to dry_run=true; set dry_run=false only after reviewing a dry-run report.

source_status

Get /ops/source/status | Auth: Read

Get Source control status for this element

Returns the branch-aware clone URL, checkout commands, current draft commit, child source-link count, portable export summary, Source health, warnings, and auth hints for the addressed element. Use the element-first path: GET /api/{element_path}/ops/source/status.

source_validate

Post /ops/source/validate | Auth: Read

Validate Source branch contents

Validates a Source branch before accepting local Git workflow changes or promotion. Defaults to branch=draft and rejects runtime data, generated output, secret material, and unreadable CAS refs.

stats

Get /ops/stats | Auth: Read

Get aggregate statistics for this element

Health status is computed: error if errors_per_day > 5 or success_rate < 0.8, warning if errors_per_day > 0 or success_rate < 0.95. Firing alerts escalate health to error/warning. Default period is ‘day’. Returns runs_per_day, success_rate, avg_duration_ms, and more.

tree

Get /ops/tree | Auth: Read

Get the element’s position in the graph — ancestors, children, references, and subtree statistics

Uses per-circle ElementGraph cache for O(1) lookups. Returns ancestors (containment chain), children (direct), members (references), referenced_by (reverse refs), attachments, and subtree stats. Default depth is 3, max is 10. Pass ?include_metadata=true for name/state on each node.

update

Patch /ops/update | Auth: Write

Update element

Partial update — send only the fields you want to change. spec, name, and intention are all independently optional. spec MUST be a JSON object when present; deep-merged into the existing spec by default. Empty {"spec":{}} preserves existing spec content but still records a new version (no-op for content, not for version state). To clear/replace the entire spec wholesale send {"spec":{...},"deep":false}. List-typed spec fields use replace semantics (the patch list replaces the existing list, no array merging). Coordinates Git + DB writes. Slug cannot be changed after creation.

update_meta

Patch /ops/update_meta | Auth: Write

Update element metadata (lightweight merge — does NOT bump version or snapshot spec)

Shallow JSONB merge into element.meta. Top-level keys in the provided value replace existing meta values; other keys are preserved. Used for UI metadata like canvas positions, panel state, viewer preferences. Wire-shape op_name is update_meta (distinct from update) so SSE subscribers + the cache auto-invalidator can distinguish lightweight metadata changes from spec edits without inspecting the payload. The MutatingElementStore wrapper stamps this op_name on the lifecycle event emitted by update_element_meta storage calls.

version

Get /ops/version | Auth: Read

Get current version or full history

Returns current version by default. Pass ?history=true for full version history (up to ?limit=N, default 50). Versions are backed by the element_versions table. Every spec update creates a new version entry.

Observability

Defined for this element

Metrics

  • wire_count
  • wire_envelope_count
  • wire_envelope_bytes

Events

  • wire.created
  • wire.envelope.written

Pricing / cost

Platform default

Operation costs

  • create: free
  • update: free
  • delete: free
  • get: free
  • list: free
  • invoke: 10000 micro-AU
  • tool_use: free