Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ version and its date. Versions follow semantic versioning: a major version
when people have to change their setup, a minor one for new skills or
abilities, a patch for fixes.

## 1.1.27 - 2026-11-30

- Boards can have an AI chat: the new widget `widget-aichat` lets project members talk to one of the app's agents from `ai-template.yml`, or to the IronFlock assistant, in a tile. Boards show no assistant in view mode, so this tile is how board users talk to an agent. `ironflock-templates` lists it in the widget catalog and describes it in board-template.md ("AI chat tiles"): `agent` names the agent, `agentApp` stays empty on the app's own board, and `handle` names the columns of the conversation row that the platform writes into one of the app's tables when a conversation starts (`conversationIdColumn` required; `userColumn`, `agentColumn`, `promptColumn` and `extraColumns` optional, the extra columns' values also narrowing the tile's list of conversations). Anyone who may read the project can chat; the platform writes the row only when whoever last saved the tile may write the app's data. The row's table is a plain log without an entity key, so a chat cannot overwrite an entity's state. board-design.md and board-interaction.md say where the tile goes and what its texts say.
- Apps can follow their AI conversations: the platform records every conversation of the app's chat tiles and of its own code in the app's private tables `ai-conversations` (one row per version, latest filter, `deleted`) and `ai-messages` (one row per finished message or tool call). They hold the users' prompts, state changes, questions and confirmations, calls of the app's own tools and the answers of the app's own agents, never the IronFlock assistant's answers or another app's agent. Only the app's code, its transforms and its own board read them: not users' dashboards, other apps, share links or the `data_access` tools of AI agents. app-architecture.md ("AI conversations") gives their columns, the conversation row's table in data-template.yml, following conversations with `subscribe_to_table` and `getHistory`, starting them with the SDK's `create_conversation`, `send_prompt` and `cancel_conversation` (only with the app's own agents; a tool that needs a person's confirmation is refused there; at most 30 prompts a minute and 5 running conversations per app and stage, beyond that the error `ironflock.ai.rate_limited`), and `call_context()`, which tells a tool's device function which conversation called it. It warns that a board widget bound to these tables shows every user's conversations to everyone who can open the board.
- The board validator knows the columns of `ai-conversations` and `ai-messages`, reports a form, toolbar or chat tile that writes to them, and checks widget-aichat: its agent must be in `ai-template.yml`, `handle.conversationIdColumn` must be set and be a string column, and every handle column must be a declared column of that one table of the app; it warns when that table has an entity key. It refuses a binding to another app's `error-logs`, `ai-conversations` or `ai-messages`, which are private to their app. An agent that a chat tile on the board talks to no longer needs `main: true`.
- `ironflock-widgets`: the host contract describes the `ai-connect` event, with which a widget asks Studio for its chat element and mounts it; a widget never talks to the AI itself. `check_widget.py` accepts the setting type `aiAgent` and the `ai-connect` event.

## 1.1.26 - 2026-11-29

- `ironflock-templates`: `board-route-tree.md` no longer asks a board for phones to have the same entity pages as the desktop board: the two boards are designed independently, and only where both have a page for the same entity does that page get the same route on both.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.26
1.1.27
2 changes: 1 addition & 1 deletion plugins/ironflock-appliance/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ironflock-appliance",
"displayName": "IronFlock Appliance",
"version": "1.1.26",
"version": "1.1.27",
"description": "Add a direct connection from Claude Code to your IronFlock appliance. Configure the appliance’s HTTPS MCP address and sign in to that installation.",
"author": {
"name": "IronFlock",
Expand Down
2 changes: 1 addition & 1 deletion plugins/ironflock-dev/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ironflock-dev",
"displayName": "IronFlock Dev",
"version": "1.1.26",
"version": "1.1.27",
"description": "Build on IronFlock: design and scaffold edge apps that keep their state in the app's tables and embed their devices' web UIs in the board, write and validate their .ironflock templates (boards and widgets, data tables, app parameters, remote-access ports, AI agents), and create, change and check the board widgets themselves (@ironflock/widget-* Lit components). Needs the ironflock plugin, which Claude Code installs with it.",
"author": {
"name": "IronFlock",
Expand Down
3 changes: 2 additions & 1 deletion plugins/ironflock-dev/skills/ironflock-templates/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ files. Each file is optional and independent:
| `mobile-board-template.yml` | Installs the app's board for phones, next to that board: pages, widgets and layout of its own on a finer grid ([references/board-mobile.md](references/board-mobile.md)). |
| `env-template.yml` | Renders a parameters form per device or device group. Values reach the app as environment variables. |
| `port-template.yml` | Lists the ports the app serves. A production install opens a remote-access tunnel for each. |
| `ai-template.yml` | Registers the app's AI agents with the IronFlock assistant. |
| `ai-template.yml` | Registers the app's AI agents with the IronFlock assistant and the board's chat tiles (widget-aichat). |
| `skills/<name>/SKILL.md` | App skills: instructions an agent of `ai-template.yml` loads only when a task needs them ("App skills" in app-templates.md). |

Give every `topic:` tool a human-readable `title` and `annotations`, following
Expand Down Expand Up @@ -160,6 +160,7 @@ in it is described.
| A SCADA page | "SCADA pages" in board-template.md, board-layout-style.md, board-bindings.md, board-navigation.md |
| A filter dropdown or a date range | board-bindings.md for wiring, board-layout-style.md for placement and the tile background |
| Show a device's web UI | board-bindings.md ("Embedding a web UI the app serves"), board-navigation.md |
| Let board users talk to an AI agent (widget-aichat) | "AI chat tiles" in board-template.md, then "AI conversations" in app-architecture.md for the conversation row, the tables and the code |
| Build or change the board for phones (`mobile-board-template.yml`) | board-mobile.md and [references/example-mobile-board.yml](references/example-mobile-board.yml), then the references of the task as for the desktop board, and board-look.md with a `mobile` page |

All of them are in `references/`; "Which file to read" in board-template.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ starter app in `assets/app-template/` follows all of them; scaffold it with
9. [Following what the board writes](#following-what-the-board-writes)
10. [Reading another app's data](#reading-another-apps-data)
11. [Commands, device functions and topics](#commands-device-functions-and-topics)
12. [The container on the device](#the-container-on-the-device)
13. [Docker Compose](#docker-compose)
14. [Web UIs on the device](#web-uis-on-the-device)
15. [Several devices](#several-devices)
16. [Devices that register themselves](#devices-that-register-themselves)
17. [Checklist](#checklist)
12. [AI conversations](#ai-conversations)
13. [The container on the device](#the-container-on-the-device)
14. [Docker Compose](#docker-compose)
15. [Web UIs on the device](#web-uis-on-the-device)
16. [Several devices](#several-devices)
17. [Devices that register themselves](#devices-that-register-themselves)
18. [Checklist](#checklist)

## The parts of an app

Expand All @@ -46,7 +47,7 @@ An app runs on many devices at once, typically industrial PCs next to machines:
| Mobile board | Optional: the app's UI on phones, with pages of its own for the jobs people do there | `.ironflock/mobile-board-template.yml` |
| Parameters | Settings of one device or device group, made in its app settings | `.ironflock/env-template.yml` |
| Remote access | Tunnels to ports the containers serve, such as a web UI | `.ironflock/port-template.yml` |
| AI agents | Agents for the IronFlock assistant, with device functions as tools | `.ironflock/ai-template.yml` |
| AI agents | Agents for the IronFlock assistant and the board's chat tiles, with device functions as tools | `.ironflock/ai-template.yml` |

Installing the app in a project creates its tables in that project's database,
installs its board, and opens a private messaging realm (WAMP, realtime pub/sub)
Expand Down Expand Up @@ -300,6 +301,7 @@ window, filtered by the entity's key.
| One device's installation: a machine's address, a serial port | `env-template.yml` | the device's or group's app settings | the environment |
| Messages between parts that nobody needs later | the app's own topics | `publish` | `subscribe` |
| A request that needs one device's answer now | a device function | `register_device_function` | `call_device_function`, widget actions, AI tools |
| Conversations with the app's AI agents | `ai-conversations`, `ai-messages`, and a conversation row in a table of the app | the platform | the app's code with `subscribe_to_table`; see [AI conversations](#ai-conversations) |

**Parameters or a settings table?** Parameters belong to a device or a device
group: whoever installs or configures it sets them in IronFlock's app settings,
Expand Down Expand Up @@ -539,6 +541,138 @@ names in your own namespace. Names that start with a digit, `sys.`, `wamp.`,
`appendBulk.`, `history.` or `secret.` belong to the platform. The board cannot
subscribe to topics: whatever it shows must be in a table.

## AI conversations

The app's agents (ai-template.yml, app-templates.md) are reached in two ways:
the IronFlock assistant calls the `main: true` agent, and a widget-aichat on
the app's board talks to the agent its `agent` setting names
(board-template.md, "AI chat tiles"). Boards show no assistant in view mode,
so the chat tile is how board users talk to an agent. An agent that only a
chat tile talks to needs no `main: true`.

A conversation started by the app's chat tile, or by the app's code through
the SDK, belongs to the app. The platform records it in two tables of the
app's own data backend, and the app reads and follows them like its own
tables:

| Table | One row per | Columns |
|---|---|---|
| `ai-conversations` | version of a conversation, a new row on every change; `{"latest": True}` gives the current state of each (entity key `conversation_id`), and a filter on `deleted` leaves out the deleted ones | `tsp`, `conversation_id`, `state` (`THINKING`, `WAITING` for an answer or a confirmation, `IDLE`), `title`, `agent`, `agent_app_key`, `user_account_key`, `user_name`, `origin` (`widget` or `sdk`), `widget_key`, `scope` (json: the chat tile's extra column values, or the SDK's `scope`), `started_by_device_key`, `deleted` |
| `ai-messages` | finished message or tool call | `tsp`, `conversation_id`, `message_id`, `role` (`user`, `assistant`, `tool`, `question` or `confirmation`), `text`, `agent`, `tool_name`, `tool_args` (json), `tool_status` |

- Both also have `device_key` and `authid`, like every table. In
`ai-messages`, `device_key` is the device a tool call ran on.
- **Only the platform writes them.** A write from the app's code, a form or a
toolbar is refused. They are empty until the app has a conversation.
- **They hold what belongs to the app:** the users' prompts, state changes and
deletions, the agent's questions and confirmations, calls of the app's own
tools, and the answers of the app's own agents. They never hold the
IronFlock assistant's answers or anything another app's agent says.
- **They are private:** only the app's code, its transforms and its own
board's bindings read them. Users' own dashboards, other apps (not even
through `consumes`), share links and the `data_access` tools of AI agents,
the app's own included, cannot.
- **A board widget bound to them shows every user's conversations to everyone
who can open the board.** The chat tile lists only each viewer's own
conversations; a widget-table bound to `ai-messages` lists all of them. Bind
them on a board only when that is intended.
- **Streamed text is not stored.** A message appears once it is finished;
progress shows as `state` changes. A conversation the user deletes gets a
last version with `deleted` true, and its messages stay.
- **Tool calls are recorded under the conversation's `conversation_id`**, also
those of the sub-agents it delegated to, with the agent's name in `agent`.

**The conversation row.** A chat tile writes one row per new conversation
into a table of the app, the handle table its `handle` settings name. The
platform writes it before the conversation starts, with the ID and the
columns the tile binds, but only when the person who last saved the tile in
the board editor may write the app's data. Anyone who may read the project
can chat. Declare the table in data-template.yml as a plain log of
conversations, one column per handle setting, **without an entity key**
(`maintainLatestFlagFor`): in an entity table, the scope columns a chat binds
would write a new latest row of an entity, such as the machine the page
shows, and so overwrite its state. `user` is an SQL reserved word and cannot
be a column name:

```yaml
- tablename: machine_conversations
description: One row per AI conversation started on a machine page, written by the platform when it starts.
columns:
- {id: tsp, name: Started, description: Time the conversation started (UTC), dataType: timestamp}
- {id: conversation_id, name: Conversation, description: The conversation's ID, dataType: string}
- {id: user_key, name: User, description: Account key of the user who started it, dataType: bigint}
- {id: prompt, name: Request, description: The conversation's first message, dataType: string}
- {id: machine_id, name: Machine, description: The machine the conversation is about, dataType: string}
```

**Following conversations.** Subscribe to the tables, and read them with
`getHistory`. The latest version of a conversation tells whether its agent is
still at work (`THINKING`) or done for now (`IDLE`, or `WAITING` for the
user):

```python
async def on_conversation(row, *args, **kwargs):
if row["state"] == "IDLE" and not row["deleted"]:
messages = await flock.getHistory("ai-messages", {
"limit": 500,
"filterAnd": [{"column": "conversation_id", "operator": "=",
"value": row["conversation_id"], "dataType": "string"}],
})
... # e.g. check what the agent filed

await flock.subscribe_to_table("ai-conversations", on_conversation)
```

**Starting a conversation from the code.** The SDK starts conversations that
belong to the app, with one of the app's own agents, on behalf of a project
member:

| Python | What it does |
|---|---|
| `create_conversation(user, agent=None, scope=None, context=None)` | Starts a conversation and returns its ID. `user` is the account key of a member of the project; any other account is refused. `agent` is the name of one of the app's own agents and is required: the IronFlock assistant and other apps' agents are refused. `scope` is stored in the `scope` column. |
| `send_prompt(conversation_id, text, wait=True)` | Sends a prompt. With `wait=True` it returns when the agent's turn ends (`{"success": True, "response": ...}`); with `wait=False`, or while a turn runs, it answers `{"queued": True}`. Check `success`. |
| `cancel_conversation(conversation_id)` | Stops the agent's running turn. The conversation takes further prompts. |

- Only the app that started a conversation, in the same stage, can send to
it or cancel it. It cannot write into a conversation a person started in a
chat tile.
- No person sees such a conversation, so nothing in it can be confirmed: a
tool that needs a person's confirmation is refused, also in the agents it
delegates to, and the agent is told that the tool needs a person.
- Each app and stage may send at most 30 prompts a minute and run at most 5
such conversations at once. A call beyond that fails with the error
`ironflock.ai.rate_limited` (a `RuntimeError` in Python); wait and try
again later.

**Knowing which conversation called a tool.** When an agent's tool call
invokes a device function, `call_context()` inside the handler returns
`{"conversation_id": ..., "agent": ...}`, and `None` when no agent called it.
The ID is that of the conversation the user started, also when a sub-agent
made the call, so it matches `conversation_id` in both tables and in the
conversation row. Store it with what the tool creates, so the app can link
the two:

```python
from ironflock import call_context

async def create_report(machine_id: str, text: str):
ctx = call_context()
await flock.append_to_table("reports", {
"tsp": datetime.now(timezone.utc).isoformat(),
"report_id": str(uuid4()),
"machine_id": machine_id,
"text": text,
"conversation_id": ctx["conversation_id"] if ctx else None,
})
return "The report is filed."

await flock.register_device_function("create_report", create_report)
```

The handler's arguments do not change; the platform sets the context, and a
caller cannot. `create_conversation`, `send_prompt`, `cancel_conversation`
and `call_context` need an `ironflock` release that has them.

## The container on the device

What the device agent gives a container and expects from it:
Expand Down Expand Up @@ -791,4 +925,9 @@ network or scrapped, so neither the device nor the app can tell "offline" from
10. `design/` describes the app as it is now: its purpose, architecture, entity
model, board and decisions match the code and the templates, and the
starter's `TODO:` comments are gone.
11. `scripts/validate.py <app-dir>` reports no errors.
11. Where board users talk to an agent, a widget-aichat writes its
conversation row into a table of the app; the code follows the
conversations in `ai-conversations` and `ai-messages`, and tools store
`call_context()`'s conversation ID with what they create. No board widget
binds those two tables unless every viewer may see every conversation.
12. `scripts/validate.py <app-dir>` reports no errors.
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,17 @@ AI agents the app contributes to the IronFlock assistant.
the one the IronFlock assistant can call, and its `tool_description` tells the
assistant when to call it. The others are sub-agents, reached through a
`delegate:` tool.
- A widget-aichat on the app's board talks to the agent its `agent` setting
names, by this key (board-template.md, "AI chat tiles"). That agent needs no
`main: true`, and an app whose agents are only reached from its board needs
no main agent. Boards show no assistant in view mode, so the chat tile is
how board users reach an agent.
- Conversations the chat tile or the app's code starts belong to the app: the
platform records them in the app's private tables `ai-conversations` and
`ai-messages`, and a tool learns its conversation with `call_context()`
(app-architecture.md, "AI conversations"). An agent's `data_access` cannot
read those two tables. The app's code starts conversations only with its
own agents.
- Required on every agent: `system_prompt`, `tools` (at least one),
`max_context_tokens`, `messages_after_summary` and `max_iterations`.
- Each tool has a `description` and exactly one of `topic` or `delegate`.
Expand Down
Loading