From ea7fa2965d170595442497699843673f3de6987f Mon Sep 17 00:00:00 2001 From: Marko Petzold Date: Mon, 30 Nov 2026 00:35:19 +0100 Subject: [PATCH 1/2] feat: add AI chat widget support and related schema updates - Introduced the `widget-aichat` for AI chat interactions, including event handling for `ai-connect`. - Updated the data schema to include AI conversation and message tables. - Enhanced board validation to check for AI agent configurations and conversation row requirements. - Added tests for various scenarios involving the AI chat widget, including error handling for misconfigured agents and conversation IDs. - Updated documentation to reflect the new AI chat capabilities and configuration options. --- CHANGELOG.md | 7 + .../skills/ironflock-templates/SKILL.md | 3 +- .../references/app-architecture.md | 155 ++++++++++++++- .../references/app-templates.md | 11 ++ .../references/board-bindings.md | 7 + .../references/board-design.md | 5 + .../references/board-interaction.md | 6 + .../references/board-template.md | 83 ++++++++ .../references/widget-catalog.md | 16 +- .../schemas/ai-template/v1.yml | 3 +- .../schemas/board-template/v1.yml | 5 +- .../scripts/board_checks.py | 175 ++++++++++++++++- .../ironflock-templates/scripts/validate.py | 34 +++- .../ironflock-widgets/references/component.md | 3 +- .../references/config-schema.md | 1 + .../references/host-contract.md | 4 + .../references/widget-index.md | 2 + .../ironflock-widgets/scripts/check_widget.py | 7 +- tests/app/.ironflock/data-template.yml | 10 + tests/boards/aichat.yml | 185 ++++++++++++++++++ tests/run.py | 26 ++- tests/widget_checks.py | 25 +++ tools/build_widget_catalog.py | 1 + 23 files changed, 742 insertions(+), 32 deletions(-) create mode 100644 tests/boards/aichat.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index bd23d6c..1d9abfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. +## Unreleased + +- 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. diff --git a/plugins/ironflock-dev/skills/ironflock-templates/SKILL.md b/plugins/ironflock-dev/skills/ironflock-templates/SKILL.md index 63bb6d3..6d21eaf 100644 --- a/plugins/ironflock-dev/skills/ironflock-templates/SKILL.md +++ b/plugins/ironflock-dev/skills/ironflock-templates/SKILL.md @@ -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//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 @@ -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 diff --git a/plugins/ironflock-dev/skills/ironflock-templates/references/app-architecture.md b/plugins/ironflock-dev/skills/ironflock-templates/references/app-architecture.md index 809fb72..d548421 100644 --- a/plugins/ironflock-dev/skills/ironflock-templates/references/app-architecture.md +++ b/plugins/ironflock-dev/skills/ironflock-templates/references/app-architecture.md @@ -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 @@ -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) @@ -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, @@ -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: @@ -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 ` 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 ` reports no errors. diff --git a/plugins/ironflock-dev/skills/ironflock-templates/references/app-templates.md b/plugins/ironflock-dev/skills/ironflock-templates/references/app-templates.md index 0f1f477..ff74b34 100644 --- a/plugins/ironflock-dev/skills/ironflock-templates/references/app-templates.md +++ b/plugins/ironflock-dev/skills/ironflock-templates/references/app-templates.md @@ -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`. diff --git a/plugins/ironflock-dev/skills/ironflock-templates/references/board-bindings.md b/plugins/ironflock-dev/skills/ironflock-templates/references/board-bindings.md index 0fdca90..5d3c419 100644 --- a/plugins/ironflock-dev/skills/ironflock-templates/references/board-bindings.md +++ b/plugins/ironflock-dev/skills/ironflock-templates/references/board-bindings.md @@ -230,6 +230,13 @@ You can read: the types `success`, `error`, `info` and `warning`; `report_error` sends `error`, `warning`, `info` or `debug`, and the toast shows `debug` as `info`. SDK versions before 1.10.0 sent `warn` for `warning`, which the toast shows as `info` too. +- **`ai-conversations` and `ai-messages`:** the app's AI conversations, which + only the platform writes (app-architecture.md, "AI conversations"). Bind + `ai-conversations` with `{latest: true}` and a filter on `deleted`. **A + widget bound to them shows every user's conversations to everyone who can + open the board**, so bind them only when that is intended. They are + private: only the app's own board reads them, never a user's own dashboard + or a share link. Neither can be a form's or a toolbar's target. - **Another app's table:** add `provider_app: ` to the ref, and list that app under `consumes` in data-template.yml. Only that app's shared tables and transforms can be read. Its private ones are not shared. diff --git a/plugins/ironflock-dev/skills/ironflock-templates/references/board-design.md b/plugins/ironflock-dev/skills/ironflock-templates/references/board-design.md index 88cdf65..5cb2e02 100644 --- a/plugins/ironflock-dev/skills/ironflock-templates/references/board-design.md +++ b/plugins/ironflock-dev/skills/ironflock-templates/references/board-design.md @@ -106,6 +106,11 @@ States: RUNNING green, IDLE grey, FAULT red, the same on every widget. widget-value is left for two cases: a figure that is the average of its latest readings (`advanced.averageLatest`), and one readout per distinct value of a column for however many there are (`multiChart` with `pivot`). +- **An agent to talk to is a tile.** A board shows no AI assistant in view + mode. Where its users should talk to an agent, such as dictating a report + at the machine, place a widget-aichat on the page of what the talk is + about (board-template.md, "AI chat tiles"). It is read and typed into like + a form, so it does not belong on a wall screen. - **Repeat the same shape for the same thing.** One gauge per machine, all the same size, in one row, in the same order as the machine list and the table. diff --git a/plugins/ironflock-dev/skills/ironflock-templates/references/board-interaction.md b/plugins/ironflock-dev/skills/ironflock-templates/references/board-interaction.md index ffe94de..c6fb548 100644 --- a/plugins/ironflock-dev/skills/ironflock-templates/references/board-interaction.md +++ b/plugins/ironflock-dev/skills/ironflock-templates/references/board-interaction.md @@ -34,6 +34,12 @@ board-assets.md, colours and presets in board-design.md. pressure low. Line 2 waits."). widget-toast shows `message` and `type` from rows the app writes. No codes, table or service names, no apology, no "Try again": say what the user can do. +- **A chat tile says what to tell the agent.** Boards have no assistant in + view mode; a widget-aichat is how users talk to an agent there. Its + `greeting` says what to tell the agent and what it does with it ("Describe + what you see at the machine, and the assistant files a report."), its + `placeholder` the task ("Describe the problem"), its `title` the agent's + job ("Maintenance assistant"), never the agent's key. - **An empty tile says why and what to do**: widget-label `emptyText`; next to a list that can be empty, a widget-markdown hint. diff --git a/plugins/ironflock-dev/skills/ironflock-templates/references/board-template.md b/plugins/ironflock-dev/skills/ironflock-templates/references/board-template.md index f6be0f1..40f025e 100644 --- a/plugins/ironflock-dev/skills/ironflock-templates/references/board-template.md +++ b/plugins/ironflock-dev/skills/ironflock-templates/references/board-template.md @@ -53,6 +53,7 @@ What each file holds: - This file: [Anatomy](#anatomy), [Literal values](#literal-values), [Designing a board](#designing-a-board) (where the design is written, a sketch on a design canvas), [SCADA pages](#scada-pages), + [AI chat tiles](#ai-chat-tiles), [Left to the board editor](#left-to-the-board-editor) and the [Checklist](#checklist). @@ -275,6 +276,86 @@ widget, stretched to its tile: tiled dashboard: a SCADA page does not need to fill the screen. Ask the user to check the proportions in the board editor, because grid cells are not square. +## AI chat tiles + +A board shows no AI assistant in view mode. To let its users talk to an AI +agent, place a widget-aichat: a chat in the tile, with the list of the +viewer's own conversations of this tile, a "New" button and a microphone for +dictation. IronFlock draws the chat. Anyone who may read the project can use +it; anyone else sees it disabled. + +- **`agent`**: the name of an agent in the app's `ai-template.yml` (its key, + such as `$str:maintenance`). Leave it out, or empty, for the IronFlock + assistant. An agent that a chat tile talks to needs no `main: true`. +- **`agentApp`**: leave it out. Empty means the app whose table holds the + conversation row, so the app's own board needs only `agent`. Another app's + agent is picked in the board editor (see [Left to the board + editor](#left-to-the-board-editor)). +- **`handle`**: the conversation row. When a user starts a conversation, the + platform writes one row with its ID into a table of the app, so the app can + follow the conversation (app-architecture.md, "AI conversations"). The + platform writes it from the settings stored with the board, not the + browser, so viewers who may only read the board can chat too. It writes + the row only when the person who last saved the tile in the board editor + may write the app's data; otherwise the chat cannot start. Each column + is written like widget-form's `targetColumn` + (`{tablename, column, dataType}`): + - `conversationIdColumn`, **required**: a string column that gets the + conversation's ID. Without it the chat stays off. + - `userColumn`, `agentColumn`, `promptColumn`, optional: the account key of + the user who started it (a `bigint` column, so a binding can filter it + with `IS CURRENT USER`), the agent's name, and the first message. + - `extraColumns`, optional: a list of `{targetColumn, value}`. `value` is a + constant or bound, such as the record the page shows (a `valueRef` + filtered with `useRoute`). These values are the conversation's **scope**: + the tile lists only the conversations started with the same values, and + the app finds them in the `scope` column of `ai-conversations`. + - All of them are columns of **one table of the app's own + data-template.yml**, the table of `conversationIdColumn`: no + `provider_app`, no transform, no system table, and no `device_key` or + `authid`. The platform skips a column of another table. + - That table is a plain log of conversations, **not an entity table** + (no `maintainLatestFlagFor`): there, the scope columns would write a new + latest row of the entity the page shows and overwrite its state. +- **No column can be named `user`**: it is an SQL reserved word, and the + platform refuses the table. Name it `user_key`. +- **A chat is not a list of messages.** To show conversations or messages + elsewhere on the board, bind the tables `ai-conversations` and + `ai-messages`, and mind that they show every user's conversations to + everyone who can open the board (app-architecture.md, "AI conversations"). + +A machine page whose chat talks to the app's agent `maintenance` and keeps +the conversations of each machine apart: + +```yaml +- layout_id: machine-chat + package_name: widget-aichat + chartconfig: + title: $str:Maintenance assistant + agent: $str:maintenance + placeholder: $str:Describe the problem + greeting: $str:Describe what you see at the machine, and the assistant files a report. + handle: + conversationIdColumn: {tablename: machine_conversations, column: conversation_id, dataType: string} + userColumn: {tablename: machine_conversations, column: user_key, dataType: bigint} + promptColumn: {tablename: machine_conversations, column: prompt, dataType: string} + extraColumns: + - targetColumn: {tablename: machine_conversations, column: machine_id, dataType: string} + value: + valueRef: + tablename: machines + column: machine_id + queryParams: + limit: 1 + filterAnd: + - {column: machine_id, operator: '=', value: '2', dataType: string, useRoute: true} +``` + +The validator checks that the agent is in `ai-template.yml`, that +`conversationIdColumn` is set and a string column, that every handle +column is a declared column of that one table, and warns when that table +has an entity key. + ## Left to the board editor Some values only exist inside a running platform, and a template cannot know them: @@ -283,6 +364,8 @@ Some values only exist inside a running platform, and a template cannot know the an app and a device. Leave them out, and tell the user to pick them in the editor. On a data-bound list of devices, `actionDevice` can come from the `device_key` column. +- **`agentApp`** of a widget-aichat that talks to another app's agent. On the + app's own board, leave it out. - **Uploaded images** (`useUpload`). Use an image URL instead, or let the user upload. diff --git a/plugins/ironflock-dev/skills/ironflock-templates/references/widget-catalog.md b/plugins/ironflock-dev/skills/ironflock-templates/references/widget-catalog.md index 5b8c65c..19b471d 100644 --- a/plugins/ironflock-dev/skills/ironflock-templates/references/widget-catalog.md +++ b/plugins/ironflock-dev/skills/ironflock-templates/references/widget-catalog.md @@ -11,7 +11,7 @@ are not listed here because they change with widget releases. - Data visualization: widget-linechart, widget-value, widget-gauge, widget-signal, widget-doughnut, widget-table, widget-heatmap, widget-statehistory, widget-mapbox, widget-scada - Content and media: widget-label, widget-textbox, widget-markdown, widget-image, widget-overlay, widget-embed -- Input and control: widget-form, widget-switch, widget-toolbar, widget-filter-dropdown, widget-filter-calendar +- Input and control: widget-form, widget-switch, widget-toolbar, widget-aichat, widget-filter-dropdown, widget-filter-calendar - Navigation: widget-navbar, widget-sidenav, widget-navbutton - Notifications: widget-toast @@ -376,6 +376,20 @@ A bar of controls that users click to change things: buttons, switches, sliders, - One filter dropdown on its own, such as picking the machine a page shows — use widget-filter-dropdown. - Opening other pages — use widget-navbar or widget-navbutton. +### widget-aichat + +A chat tile in which project members talk to one AI agent: an app's own agent from its ai-template.yml, or the IronFlock assistant. Every new conversation writes a row with its ID into a table of the app, so the app can follow it, and the tile lists the viewer's own conversations of this tile and its scope. + +**Data shape:** No rows to show. handle.conversationIdColumn names the app table and string column that get one row per new conversation; the other handle columns of that table take the user, the agent, the first prompt and the extraColumns values. An extraColumns value may be bound, such as a record id from the route, and the values also narrow the tile's list of conversations. + +**Use when:** +- Board users should talk to an app's AI agent or the IronFlock assistant, such as dictating a case: set agent (agentApp for another app's agent) and bind handle.conversationIdColumn. +- A page about one record keeps its own conversations: an extraColumns entry bound to that record's id. + +**Not for:** +- Showing stored texts or messages of a table — use widget-table or widget-markdown. +- Entering fixed fields into a table — use widget-form. + ### widget-filter-dropdown A dropdown filter widget for selecting values from a predefined list. Use this widget to allow users to filter dashboard data by categorical values such as device names, locations, status types, or any enumerable options. diff --git a/plugins/ironflock-dev/skills/ironflock-templates/schemas/ai-template/v1.yml b/plugins/ironflock-dev/skills/ironflock-templates/schemas/ai-template/v1.yml index 90c7da3..670e28d 100644 --- a/plugins/ironflock-dev/skills/ironflock-templates/schemas/ai-template/v1.yml +++ b/plugins/ironflock-dev/skills/ironflock-templates/schemas/ai-template/v1.yml @@ -62,7 +62,8 @@ definitions: description: > If true, this agent is registered as a tool to the IronFlock router agent. If false, it can only be used as a sub-agent - via delegate. + via delegate, or by a widget-aichat on a board that names it + in its agent setting. data_access: type: boolean diff --git a/plugins/ironflock-dev/skills/ironflock-templates/schemas/board-template/v1.yml b/plugins/ironflock-dev/skills/ironflock-templates/schemas/board-template/v1.yml index df72d2b..5917f4b 100644 --- a/plugins/ironflock-dev/skills/ironflock-templates/schemas/board-template/v1.yml +++ b/plugins/ironflock-dev/skills/ironflock-templates/schemas/board-template/v1.yml @@ -93,6 +93,7 @@ $defs: description: The widget type, i.e. its npm package name under @ironflock. anyOf: - enum: + - widget-aichat - widget-doughnut - widget-embed - widget-filter-calendar @@ -194,7 +195,7 @@ $defs: tablename: type: string minLength: 1 - description: A table or transform of this app's data-template.yml, the system table error-logs, or a table of the app named in provider_app. + description: A table or transform of this app's data-template.yml, one of the system tables error-logs, ai-conversations and ai-messages, or a table of the app named in provider_app. column: type: string minLength: 1 @@ -224,7 +225,7 @@ $defs: tablename: type: string minLength: 1 - description: A table or transform of this app's data-template.yml, the system table error-logs, or a table of the app named in provider_app. + description: A table or transform of this app's data-template.yml, one of the system tables error-logs, ai-conversations and ai-messages, or a table of the app named in provider_app. format: description: >- Template for one array item, shaped like the items of the bound array diff --git a/plugins/ironflock-dev/skills/ironflock-templates/scripts/board_checks.py b/plugins/ironflock-dev/skills/ironflock-templates/scripts/board_checks.py index ae3ab2c..dfa6d9b 100644 --- a/plugins/ironflock-dev/skills/ironflock-templates/scripts/board_checks.py +++ b/plugins/ironflock-dev/skills/ironflock-templates/scripts/board_checks.py @@ -13,6 +13,8 @@ and filter widgets wired to the widgets they are meant to filter, - the mobile board (mobile-board-template.yml): the same checks, on its own default grid, +- widget-aichat: its agent in ai-template.yml, and its conversation row + (handle) in one table of the app; no widget writes the platform's AI tables, - URL parameters: none may take a name Studio keeps for itself (`editor` and others), - navigation: menu items that would be highlighted together with others, and whether every page can be reached from the home page by clicking, and left @@ -36,8 +38,8 @@ import widget as widget_lib PREFIXES = ("$str:", "$num:", "$bool:") -SCALAR_TYPES = {"string", "number", "integer", "boolean", "color", "textarea", "image", "actionApp", "actionDevice"} -TEXT_TYPES = {"string", "color", "textarea", "image"} +SCALAR_TYPES = {"string", "number", "integer", "boolean", "color", "textarea", "image", "actionApp", "actionDevice", "aiAgent"} +TEXT_TYPES = {"string", "color", "textarea", "image", "aiAgent"} NUMERIC = {"numeric", "bigint"} ORDERABLE = {"numeric", "bigint", "string", "timestamp"} PATTERN_OPERATORS = {"LIKE", "ILIKE", "NOT LIKE", "NOT ILIKE"} @@ -51,8 +53,48 @@ "level": "string", "device_key": "bigint", "user_message": "string", - } + }, + # The app's AI conversations: one row per version of a conversation + # (entity key conversation_id, read with the latest filter) ... + "ai-conversations": { + "tsp": "timestamp", + "conversation_id": "string", + "state": "string", + "title": "string", + "agent": "string", + "agent_app_key": "numeric", + "user_account_key": "numeric", + "user_name": "string", + "origin": "string", + "widget_key": "numeric", + "scope": "json", + "started_by_device_key": "numeric", + "deleted": "boolean", + "device_key": "bigint", + "authid": "string", + }, + # ... and one row per finished message or tool call; device_key is the + # device a tool call ran on. + "ai-messages": { + "tsp": "timestamp", + "conversation_id": "string", + "message_id": "string", + "role": "string", + "text": "string", + "agent": "string", + "tool_name": "string", + "tool_args": "json", + "tool_status": "string", + "device_key": "bigint", + "authid": "string", + }, } +#: The system tables only the platform writes: no form, toolbar or chat tile +#: can write into them. +PLATFORM_WRITTEN = {"ai-conversations", "ai-messages"} +#: Columns every table has but no template declares. The platform writes only +#: declared columns into a chat tile's conversation row. +UNDECLARED_COLUMNS = {"device_key", "authid"} #: The built-in alarms app that every project has. Boards read its tables #: through provider_app: alarms (with alarms or * under consumes), read-only and #: from production. Its third table, the notification recipients, is not @@ -258,6 +300,9 @@ class Board: report: Any data: Any grid: Grid = DESKTOP_GRID # MOBILE_GRID for mobile-board-template.yml + # The agent names of the app's ai-template.yml; None when they cannot be + # known (the file is there but did not load). + agents: set[str] | None = None filter_params_used: dict[str, list] = field(default_factory=dict) time_params_used: dict[str, list] = field(default_factory=dict) filter_params_offered: dict[str, list] = field(default_factory=dict) @@ -294,11 +339,12 @@ def is_alarms(provider: Any) -> bool: # -------------------------------------------------------------------------- -def check_board(doc, report, data, offline: bool, mobile: bool = False) -> None: +def check_board(doc, report, data, offline: bool, mobile: bool = False, agents: set[str] | None = None) -> None: """One board: the desktop board (board-template.yml), or with mobile the board for phones (mobile-board-template.yml), which has the same schema - and the same checks, with its own default grid.""" - board = Board(doc, report, data, grid=MOBILE_GRID if mobile else DESKTOP_GRID) + and the same checks, with its own default grid. agents: the agent names + of the app's ai-template.yml (empty without one, None when unknown).""" + board = Board(doc, report, data, grid=MOBILE_GRID if mobile else DESKTOP_GRID, agents=agents) tpl = doc.data if isinstance(doc.data, dict) else {} widgets = tpl.get("widgets") if isinstance(tpl.get("widgets"), list) else [] layout = tpl.get("layout") if isinstance(tpl.get("layout"), dict) else None @@ -584,6 +630,8 @@ def check_widget(board: Board, i: int, w: dict, offline: bool, cache: dict, plac check_open_parameter(board, config, cpath) if package == "widget-toolbar" and isinstance(config, dict): check_toolbar_targets(board, config, cpath) + if package == CHAT_WIDGET and isinstance(config, dict): + check_chat(board, config, cpath) if package == "widget-table" and isinstance(config, dict): check_single_record_table(board, config, cpath) check_edit_columns(board, config, cpath) @@ -782,6 +830,8 @@ def check_ref_common(self, ref: dict, path: list, kind: str) -> dict[str, str] | hint = difflib.get_close_matches(table, list(ALARMS_TABLES), n=1) more = f" (did you mean '{hint[0]}'?)" if hint else "" board.error(path + ["tablename"], f"the alarms app has no table '{table}'{more}; it offers alarms and alarm_events") + if isinstance(table, str) and provider and not is_alarms(provider) and table in SYSTEM_TABLES: + board.error(path + ["tablename"], f"'{table}' is private to the app '{provider}'; no other app's board can read it") if isinstance(table, str) and not provider: columns = board.columns_of(table, None) if columns is None and board.data.present: @@ -1013,6 +1063,116 @@ def check_toolbar_targets(board: Board, config: dict, path: list) -> None: check_write_targets(board, targets, "toolbar") +#: The AI chat tile. +CHAT_WIDGET = "widget-aichat" +#: The columns of widget-aichat's conversation row (handle) beside its extra +#: columns: what the platform writes into each, and the dataTypes that hold it. +CHAT_COLUMNS = { + "conversationIdColumn": ({"string"}, "the conversation's ID, a string"), + "userColumn": (NUMERIC | {"string"}, "the user's account key, a number"), + "agentColumn": ({"string"}, "the agent's name, a string"), + "promptColumn": ({"string"}, "the first message, a string"), +} + + +def own_app_agent(config: dict) -> str | None: + """The agent a widget-aichat config names in its own app's ai-template.yml: + `agent` set and `agentApp` empty (the app of the conversation row). None + for the IronFlock assistant, another app's agent, or a bound value.""" + agent, app = constant(config.get("agent")), config.get("agentApp") + if not isinstance(agent, str) or not agent.strip(): + return None + if app is not None and not is_unset(app) and constant(app) not in ("", 0): + return None + return agent.strip() + + +def chat_agents(boards: list) -> set[str]: + """The agents of the app that a widget-aichat on one of its boards talks to.""" + names = set() + for doc in boards: + tpl = doc.data if isinstance(doc.data, dict) else {} + for w in tpl.get("widgets") if isinstance(tpl.get("widgets"), list) else []: + if isinstance(w, dict) and w.get("package_name") == CHAT_WIDGET and isinstance(w.get("chartconfig"), dict): + name = own_app_agent(w["chartconfig"]) + if name: + names.add(name) + return names + + +def check_chat(board: Board, config: dict, path: list) -> None: + """widget-aichat: the agent it talks to, and the conversation row the + platform writes when a conversation starts (handle). Every handle column + is a declared column of the one table of handle.conversationIdColumn, a + table of this app's data-template.yml, a log without an entity key.""" + agent = own_app_agent(config) + if agent and board.agents is not None and agent not in board.agents: + if board.agents: + hint = difflib.get_close_matches(agent, sorted(board.agents), n=1) + more = f" (did you mean '{hint[0]}'?)" if hint else "" + where = f"ai-template.yml has no agent '{agent}'{more}" + else: + where = f"the app has no ai-template.yml, so there is no agent '{agent}'" + board.error(path + ["agent"], f"{where}; the chat cannot start. Leave agent empty for the IronFlock assistant") + + handle = config.get("handle") if isinstance(config.get("handle"), dict) else {} + hpath = path + ["handle"] + id_ref = handle.get("conversationIdColumn") + if not (isinstance(id_ref, dict) and id_ref.get("tablename") and id_ref.get("column")): + board.error( + hpath + ["conversationIdColumn"], + "widget-aichat needs handle.conversationIdColumn, a string column of one of the app's tables that gets " + "each new conversation's ID; without it the chat stays off", + ) + return + table = id_ref.get("tablename") + targets = [(hpath + [key], handle.get(key)) for key in CHAT_COLUMNS] + extra = handle.get("extraColumns") if isinstance(handle.get("extraColumns"), list) else [] + targets += [(hpath + ["extraColumns", k, "targetColumn"], e.get("targetColumn")) for k, e in enumerate(extra) if isinstance(e, dict)] + own = [] + for tpath, target in targets: + if not isinstance(target, dict) or not target.get("tablename"): + continue + if target.get("provider_app"): + board.error(tpath + ["provider_app"], "the conversation row goes into a table of this app, not of another app") + elif target.get("tablename") != table: + board.error( + tpath + ["tablename"], + f"'{target.get('tablename')}' is not the table of handle.conversationIdColumn ('{table}'); " + "the platform writes only that table's columns and skips this one", + ) + elif target.get("column") in UNDECLARED_COLUMNS: + board.error(tpath + ["column"], f"'{target.get('column')}' is a system column; the conversation row gets only columns data-template.yml declares") + else: + own.append((tpath, target)) + if table == "error-logs": + board.error(hpath + ["conversationIdColumn", "tablename"], "error-logs is the platform's error log; the conversation row goes into a table of data-template.yml") + return + check_write_targets(board, own, "chat") + keys = board.data.entity_keys.get(table) + if keys: + board.warn( + hpath + ["conversationIdColumn", "tablename"], + f"'{table}' is an entity table (maintainLatestFlagFor: {', '.join(keys)}), so each conversation row " + "becomes the latest row of an entity, and the scope columns can overwrite an entity's state; " + "write the conversation rows into a table without an entity key", + ) + columns = board.columns_of(table, None) + if columns is None or table in board.data.transforms: + return + for key, (types, what) in CHAT_COLUMNS.items(): + target = handle.get(key) + if not isinstance(target, dict) or target.get("tablename") != table or target.get("provider_app"): + continue + actual = columns.get(target.get("column")) + if actual and actual not in types: + message = f"{key} gets {what}, but column '{target.get('column')}' is {actual}" + if key == "conversationIdColumn": + board.error(hpath + [key, "column"], message) + else: + board.warn(hpath + [key, "column"], message) + + def check_write_targets(board: Board, targets: list, writer: str) -> None: """Every targetColumn a widget writes names a column of a table (not a transform) in data-template.yml, of the type it claims.""" @@ -1023,6 +1183,9 @@ def check_write_targets(board: Board, targets: list, writer: str) -> None: if is_alarms(target.get("provider_app")): board.error(tpath + ["provider_app"], f"the {writer} writes to the alarms app, whose tables are read-only") continue + if table in PLATFORM_WRITTEN and not target.get("provider_app"): + board.error(tpath + ["tablename"], f"the {writer} writes to '{table}', which only the platform writes") + continue columns = board.columns_of(table, None) if columns is None: if board.data.present: diff --git a/plugins/ironflock-dev/skills/ironflock-templates/scripts/validate.py b/plugins/ironflock-dev/skills/ironflock-templates/scripts/validate.py index 272c61d..908cb8f 100644 --- a/plugins/ironflock-dev/skills/ironflock-templates/scripts/validate.py +++ b/plugins/ironflock-dev/skills/ironflock-templates/scripts/validate.py @@ -567,13 +567,19 @@ def topic_markings(tool: dict) -> tuple | None: ) -def check_ai(doc: Doc, report: Report, data: DataModel) -> None: +def check_ai(doc: Doc, report: Report, data: DataModel, chat_agents: set[str] = frozenset()) -> None: + """chat_agents: the agents a widget-aichat on the app's boards talks to. + They are reached from the board, so they need no main: true.""" if not isinstance(doc.data, dict): return agents = {k: v for k, v in doc.data.items() if isinstance(v, dict)} mains = [k for k, v in agents.items() if v.get("main")] - if agents and not mains: - report.error(doc, [], "no agent has main: true, so the IronFlock assistant cannot reach any of them") + if agents and not mains and not (chat_agents & set(agents)): + report.error( + doc, [], + "no agent has main: true, so the IronFlock assistant cannot reach any of them " + "(an agent that a widget-aichat on the board talks to needs no main: true)", + ) elif len(mains) > 1: report.warn(doc, [mains[1], "main"], "more than one main agent; normally exactly one is main") topics: dict[str, tuple[list, tuple]] = {} @@ -651,15 +657,27 @@ def run(folder: Path, offline: bool) -> Report: check_env(docs["env-template"], report) if "port-template" in docs: check_port(docs["port-template"], report) - if "ai-template" in docs: - check_ai(docs["ai-template"], report, data) - skill_checks.check_skills(folder, docs.get("ai-template"), (folder / "ai-template.yml").exists(), report) - if any(name in docs for name in BOARDS): + boards = [docs[name] for name in BOARDS if name in docs] + chat_agents: set[str] = set() + if boards: import board_checks + chat_agents = board_checks.chat_agents(boards) + if "ai-template" in docs: + check_ai(docs["ai-template"], report, data, chat_agents) + skill_checks.check_skills(folder, docs.get("ai-template"), (folder / "ai-template.yml").exists(), report) + if boards: + # The agent names a widget-aichat may talk to; unknown (None) when + # ai-template.yml is there but did not load. + agents: set[str] | None = set() + if "ai-template" in docs: + ai = docs["ai-template"].data + agents = {k for k, v in ai.items() if isinstance(v, dict)} if isinstance(ai, dict) else None + elif (folder / "ai-template.yml").exists() or (folder / "ai-template.yaml").exists(): + agents = None for name, mobile in BOARDS.items(): if name in docs: - board_checks.check_board(docs[name], report, data, offline, mobile=mobile) + board_checks.check_board(docs[name], report, data, offline, mobile=mobile, agents=agents) if not docs and not report.issues: report.issues.append(Issue("WARN", str(folder), None, [], "no templates found")) return report diff --git a/plugins/ironflock-dev/skills/ironflock-widgets/references/component.md b/plugins/ironflock-dev/skills/ironflock-widgets/references/component.md index 12b00b2..07095be 100644 --- a/plugins/ironflock-dev/skills/ironflock-widgets/references/component.md +++ b/plugins/ironflock-dev/skills/ironflock-widgets/references/component.md @@ -214,7 +214,7 @@ of the widget or from a hand-written board template. ## Events The widget never navigates, writes or calls anything itself. It dispatches one of -the four events Studio handles, and Studio does the work with the viewer's +one of the events Studio handles, and Studio does the work with the viewer's permissions: ```ts @@ -231,6 +231,7 @@ this.dispatchEvent( | Write a row to a table | `data-submit` `[{ swarm_app_databackend_key, table_name, column_name, value }]` | widget-form | | Upload files, then write the row with their keys | `file-data-submit` `{ items, waitUntil }` ([host contract](host-contract.md#events)) | widget-form (file field) | | Upload several files, then write a row per file (rows told apart by `row`), with progress per file | `media-data-submit` `{ items, waitUntil, progress }` ([host contract](host-contract.md#events)) | widget-form (media field) | +| Show the platform's AI chat in the tile | `ai-connect` `{ settings, provide }` ([host contract](host-contract.md#events)) | widget-aichat | - Read the current state back from the host, not from what you sent: filter widgets read their selection from `route`, a switch from its bound value. diff --git a/plugins/ironflock-dev/skills/ironflock-widgets/references/config-schema.md b/plugins/ironflock-dev/skills/ironflock-widgets/references/config-schema.md index 778ce59..880a7a1 100644 --- a/plugins/ironflock-dev/skills/ironflock-widgets/references/config-schema.md +++ b/plugins/ironflock-dev/skills/ironflock-widgets/references/config-schema.md @@ -109,6 +109,7 @@ Use one string, from this list: | `image` | an upload field | the upload's URL | | `targetColumn` | the picker of a table column to write to (widget-form) | `{ swarm_app_databackend_key, tablename, column, … }` | | `actionApp` / `actionDevice` | app and device selects for device actions | numeric keys | +| `aiAgent` | a select of the AI agents of the app (widget-aichat), with the IronFlock assistant as the empty choice | the agent's name; `''` for the assistant | Don't use: diff --git a/plugins/ironflock-dev/skills/ironflock-widgets/references/host-contract.md b/plugins/ironflock-dev/skills/ironflock-widgets/references/host-contract.md index 9138ac5..243587e 100644 --- a/plugins/ironflock-dev/skills/ironflock-widgets/references/host-contract.md +++ b/plugins/ironflock-dev/skills/ironflock-widgets/references/host-contract.md @@ -217,6 +217,7 @@ dispatch with `bubbles: true, composed: true` anyway. | `data-submit` | An array of `{ swarm_app_databackend_key, table_name, column_name, value }` | Groups the items into one row per table, adds `tsp` (now), turns `NaN` into `null` and publishes the row to the app's table. Items without a key or table are skipped. | | `file-data-submit` | `{ items, waitUntil }`: `data-submit` items plus file items `{ swarm_app_databackend_key, table_name, column_name, file: File, namespace, contentType }` | Studio after 3.5.8 only. Claims the event by calling `waitUntil(promise)` during the dispatch. Uploads each file into the FleetFiles namespace of the item's app under a key of its own (`//`), puts the key in as the item's value, then writes the rows as for `data-submit`. If an upload fails, no row is written. The promise resolves once the rows are written and rejects with an `Error` whose message (localized) says why, which the widget shows. | | `media-data-submit` | `{ items, waitUntil, progress }`: `data-submit` items and file items as for `file-data-submit`, each with an optional `row` (the index of its row within its table; absent: the table's one row), and on a file item `id` (the same on every retry), an optional `key` (stored by an earlier attempt) and an optional `urlColumn` (`{ swarm_app_databackend_key, table_name, column_name }`, same table and row) | Studio with media support only (widget-form's media field). Claims the event by calling `waitUntil(promise)` during the dispatch. Stores each file item without a `key`, one after another, calling `progress(id, 'uploading')` before and `progress(id, 'stored', key)` after; an item with a `key` is not uploaded again and is reported `stored` at once. A failed upload is reported `failed` and rejects the promise; no row is written. Then it puts each key in as its item's value and the object's URL (or `null`) into `urlColumn`, groups the items into rows by databackend, table and `row`, each with `tsp`, a later item for a column winning, and writes the tables in the order their first item appears. A table with several rows goes out as one acknowledged publish on `bulk...` (rows in `args[0]`), which fleetdb inserts all or none; where the router refuses that topic to board sessions (`not_authorized`, a router before the `board_writer` bulk rule) Studio publishes the rows one by one, leaving the earlier ones written if one fails. It stops at the first table that fails; the promise then rejects. A widget that retries sends the same row values (ids, stored keys), so entity tables keyed by those ids take the retry as an update. | +| `ai-connect` | `{ settings, provide }`: `settings` is the tile's `inputData`; `provide(el: HTMLElement)` hands the widget an element | Studio with AI chat tiles only (widget-aichat). On a board tile, Studio answers during the dispatch with `provide()`: the list of the viewer's conversations of this tile, the messages, the message field and the microphone. The widget mounts that element and keeps it until a later dispatch is answered; an answer to an older dispatch is ignored. Dispatch it once in `firstUpdated()` and again when the settings change, with `bubbles: true, composed: true`. Studio takes the agent and the conversation row from the widget's stored settings and the scope from the tile's resolved data, not from `detail.settings`. Nobody answers outside a board tile (the demo, the AI chat, an older Studio): show a static preview with one sentence saying the chat works on a board. | | `widget-defaults` | A config object | Widget Editor only: replaces the defaults the form fills in (widget-scada sends the selected symbol's defaults). Needs `bubbles: true, composed: true`. | - `nav-submit` and `param-submit` only work on boards. In the Widget Editor and the @@ -224,6 +225,9 @@ dispatch with `bubbles: true, composed: true` anyway. - `action-submit`, `data-submit`, `file-data-submit` and `media-data-submit` work everywhere, **including the Widget Editor's preview and the AI chat**: a click there switches a real device, writes a real row or stores a real file. +- `ai-connect` is the only way a widget offers AI chat. The host mounts its own + chat element; a widget never calls the AI, writes a conversation or reads + one. - Any other event name is ignored. That is what makes a new event safe to add: a widget that sends one must check that a host handled it (`file-data-submit`, `media-data-submit`: nobody called `waitUntil`) and tell the user when none did, because an older diff --git a/plugins/ironflock-dev/skills/ironflock-widgets/references/widget-index.md b/plugins/ironflock-dev/skills/ironflock-widgets/references/widget-index.md index b60f3eb..48bd562 100644 --- a/plugins/ironflock-dev/skills/ironflock-widgets/references/widget-index.md +++ b/plugins/ironflock-dev/skills/ironflock-widgets/references/widget-index.md @@ -32,6 +32,7 @@ repo's `AGENTS.md` records its decisions and gotchas. | widget-sidenav | a side menu with the current page highlighted | `nav-submit`, reads `route` | @material/web | | widget-navbutton | one navigation button | `nav-submit`, reads `route` | @material/web | | widget-toast | notifications popping up for new rows | — (Studio floats its tile) | — | +| widget-aichat | a chat with an AI agent, drawn by Studio inside the tile | `ai-connect` | — | Every widget takes `lit` from the import map. @@ -57,6 +58,7 @@ Every widget takes `lit` from the import map. | A generated schema and a catalog for the AI | widget-scada (`scripts/`, `schema-curation.json`) | | Timers that must die with the element | widget-toast | | A library only some configs need, loaded as a chunk on demand | widget-markdown (`src/highlight.ts`, `loadHighlight()`) | +| An element the host draws and the widget only mounts | widget-aichat (`ai-connect` with `provide`, a static preview when nobody answers) | | Hiding a value that goes stale while no new data arrives | `staleAt()` and `scheduleStaleCheck()` in widget-gauge and widget-value | | Normalising malformed configs | widget-doughnut (`sections`), widget-gauge (section limits) | diff --git a/plugins/ironflock-dev/skills/ironflock-widgets/scripts/check_widget.py b/plugins/ironflock-dev/skills/ironflock-widgets/scripts/check_widget.py index b748ce3..4f6d11b 100644 --- a/plugins/ironflock-dev/skills/ironflock-widgets/scripts/check_widget.py +++ b/plugins/ironflock-dev/skills/ironflock-widgets/scripts/check_widget.py @@ -95,11 +95,11 @@ SHOULD_BE_EXTERNAL = ("lit", "lit-html", "lit-element", "@lit/reactive-element") # The events Studio listens for on a widget element. -HOST_EVENTS = {"nav-submit", "param-submit", "action-submit", "data-submit", "file-data-submit", "media-data-submit", "widget-defaults"} +HOST_EVENTS = {"nav-submit", "param-submit", "action-submit", "data-submit", "file-data-submit", "media-data-submit", "widget-defaults", "ai-connect"} # Widgets the platform registers (for aiSelection's notFor routing). KNOWN_WIDGETS = { - "widget-doughnut", "widget-embed", "widget-filter-calendar", "widget-filter-dropdown", + "widget-aichat", "widget-doughnut", "widget-embed", "widget-filter-calendar", "widget-filter-dropdown", "widget-form", "widget-gauge", "widget-heatmap", "widget-image", "widget-label", "widget-linechart", "widget-mapbox", "widget-markdown", "widget-navbar", "widget-navbutton", "widget-overlay", "widget-scada", "widget-sidenav", @@ -109,7 +109,7 @@ SCHEMA_TYPES = { "string", "number", "boolean", "object", "array", - "color", "textarea", "image", "targetColumn", "actionApp", "actionDevice", + "color", "textarea", "image", "targetColumn", "actionApp", "actionDevice", "aiAgent", } # fmt: skip BAD_TYPES = { "integer": ("WARN", "Studio's editor cannot store integer fields; use number and round in code"), @@ -1028,6 +1028,7 @@ def check_value(self, file: str, value: Any, node: dict, cpath: list[str], root: "string": (str,), "color": (str,), "textarea": (str,), "image": (str,), "number": (int, float), "boolean": (bool,), "object": (dict,), "array": (list,), "targetColumn": (str, dict), "actionApp": (int, str), "actionDevice": (int, str), "font": (dict, str), + "aiAgent": (str,), }.get(kind) # fmt: skip if expected and (not isinstance(value, expected) or (kind == "number" and isinstance(value, bool))): self.error(file, f"{type(value).__name__} where the schema says {kind}", path) diff --git a/tests/app/.ironflock/data-template.yml b/tests/app/.ironflock/data-template.yml index a5d23e0..568a3ef 100644 --- a/tests/app/.ironflock/data-template.yml +++ b/tests/app/.ironflock/data-template.yml @@ -85,6 +85,16 @@ data: - {id: longitude, name: Longitude, description: Longitude where the photo was taken in decimal degrees, dataType: numeric} - {id: altitude, name: Altitude, description: Altitude where the photo was taken in metres, dataType: numeric} - {id: position_source, name: Position source, description: Where the position came from (exif or device), dataType: string} + - tablename: machine_conversations + description: One row per AI conversation started from a machine page's chat tile, written by the platform. + columns: + - {id: tsp, name: Timestamp, 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: agent, name: Agent, description: The agent's name, dataType: string} + - {id: prompt, name: Prompt, description: The conversation's first message, dataType: string} + - {id: machine_id, name: Machine, description: The machine the conversation is about, dataType: string} + - {id: turns, name: Turns, description: Number of turns so far, dataType: numeric} transforms: - tablename: daily_energy description: Energy per machine and day. diff --git a/tests/boards/aichat.yml b/tests/boards/aichat.yml new file mode 100644 index 0000000..a3269ab --- /dev/null +++ b/tests/boards/aichat.yml @@ -0,0 +1,185 @@ +# yaml-language-server: $schema=https://ironflock.com/schemas/board-template/v1.yml +# widget-aichat: a chat tile that talks to the app's agent 'case' (declared in +# the ai-template.yml this test adds, without main: true) and writes a +# conversation row into machine_conversations (tests/app's data-template.yml) +# when a conversation starts (a log table, no entity key; widgets[10] writes +# into the entity table machine_status). Only the platform writes the AI tables +# ai-conversations and ai-messages; the board may read them. +# +# offline: widget-aichat is not on npm yet. Once it is published, remove this +# line and add expect-none lines for widgets[0]'s agent, handle and title, so +# the schema walk covers them too. +# ai-agents: case +# consumes: planner-app +# +# expect-none: widgets[0].chartconfig.agent +# expect-none: widgets[0].chartconfig.handle.conversationIdColumn +# expect-none: widgets[0].chartconfig.handle.conversationIdColumn.column +# expect-none: widgets[0].chartconfig.handle.userColumn.column +# expect-none: widgets[0].chartconfig.handle.agentColumn.column +# expect-none: widgets[0].chartconfig.handle.promptColumn.column +# expect-none: widgets[0].chartconfig.handle.extraColumns[0].targetColumn.tablename +# expect-none: widgets[0].chartconfig.handle.extraColumns[0].value.valueRef.column +# expect: ERROR widgets[1].chartconfig.handle.conversationIdColumn :: needs handle.conversationIdColumn +# expect: ERROR widgets[2].chartconfig.agent :: ai-template.yml has no agent 'cse' (did you mean 'case'?) +# expect: ERROR widgets[3].chartconfig.handle.extraColumns[0].targetColumn.tablename :: is not the table of handle.conversationIdColumn +# expect: ERROR widgets[3].chartconfig.handle.userColumn.column :: 'device_key' is a system column +# expect: ERROR widgets[4].chartconfig.handle.conversationIdColumn.tablename :: the chat writes to 'ai-conversations', which only the platform writes +# expect: ERROR widgets[5].chartconfig.handle.conversationIdColumn.column :: conversationIdColumn gets the conversation's ID, a string, but column 'turns' is numeric +# expect: WARN widgets[5].chartconfig.handle.agentColumn.column :: agentColumn gets the agent's name, a string, but column 'turns' is numeric +# expect: ERROR widgets[5].chartconfig.handle.promptColumn.column :: table 'machine_conversations' has no column 'question' +# expect: ERROR widgets[6].chartconfig.formFields[0].targetColumn.tablename :: the form writes to 'ai-messages', which only the platform writes +# expect-none: widgets[7].chartconfig.columns[0].values.tableRef.tablename +# expect-none: widgets[7].chartconfig.columns[0].values.tableRef.format.value +# expect-none: widgets[7].chartconfig.columns[0].values.tableRef.queryParams.filterAnd[1].column +# expect-none: widgets[7].chartconfig.columns[1].values.tableRef.format.value +# expect: ERROR widgets[8].chartconfig.columns[0].values.tableRef.format.value :: table 'ai-messages' has no column 'content' +# expect-none: widgets[9].chartconfig.agent +# expect-none: widgets[9].chartconfig.handle.conversationIdColumn +# expect-none: widgets[0].chartconfig.handle.conversationIdColumn.tablename +# expect: ERROR widgets[11].chartconfig.columns[0].values.tableRef.tablename :: 'ai-messages' is private to the app 'planner-app' +# expect: WARN widgets[10].chartconfig.handle.conversationIdColumn.tablename :: 'machine_status' is an entity table (maintainLatestFlagFor: machine_id) +name: aichat +widgets: + - layout_id: chat + package_name: widget-aichat + chartconfig: + title: $str:Machine assistant + agent: $str:case + placeholder: $str:Describe the problem + greeting: $str:Describe what you see and the assistant files a report. + voice: $bool:true + handle: + conversationIdColumn: {tablename: machine_conversations, column: conversation_id, dataType: string} + userColumn: {tablename: machine_conversations, column: user_key, dataType: bigint} + agentColumn: {tablename: machine_conversations, column: agent, dataType: string} + promptColumn: {tablename: machine_conversations, column: prompt, dataType: string} + extraColumns: + - targetColumn: {tablename: machine_conversations, column: machine_id, dataType: string} + value: + valueRef: + tablename: machine_status + column: machine_id + queryParams: + limit: 1 + filterAnd: + - {column: machine_id, operator: '=', value: press-1, dataType: string} + - layout_id: no-handle + package_name: widget-aichat + chartconfig: + agent: $str:case + - layout_id: misspelt-agent + package_name: widget-aichat + chartconfig: + agent: $str:cse + handle: + conversationIdColumn: {tablename: machine_conversations, column: conversation_id, dataType: string} + - layout_id: other-table + package_name: widget-aichat + chartconfig: + handle: + conversationIdColumn: {tablename: machine_conversations, column: conversation_id, dataType: string} + userColumn: {tablename: machine_conversations, column: device_key, dataType: bigint} + extraColumns: + - targetColumn: {tablename: machine_status, column: machine_id, dataType: string} + value: $str:press-1 + - layout_id: platform-table + package_name: widget-aichat + chartconfig: + handle: + conversationIdColumn: {tablename: ai-conversations, column: conversation_id, dataType: string} + - layout_id: wrong-types + package_name: widget-aichat + chartconfig: + handle: + conversationIdColumn: {tablename: machine_conversations, column: turns, dataType: numeric} + agentColumn: {tablename: machine_conversations, column: turns, dataType: numeric} + promptColumn: {tablename: machine_conversations, column: question, dataType: string} + - layout_id: write-messages + package_name: widget-form + chartconfig: + title: $str:Note + formFields: + - label: $str:Text + type: $str:textfield + targetColumn: {tablename: ai-messages, column: text, dataType: string} + - layout_id: conversations + package_name: widget-table + chartconfig: + title: $str:Conversations + columns: + - header: $str:Title + type: $str:string + values: + tableRef: + tablename: ai-conversations + format: {value: title} + queryParams: + limit: 100 + filterAnd: + - {latest: true, column: '', operator: '=', value: '', dataType: boolean} + - {column: deleted, operator: '=', value: false, dataType: boolean} + - header: $str:State + type: $str:string + values: + tableRef: + tablename: ai-conversations + format: {value: state} + queryParams: + limit: 100 + filterAnd: + - {latest: true, column: '', operator: '=', value: '', dataType: boolean} + - {column: deleted, operator: '=', value: false, dataType: boolean} + - layout_id: messages + package_name: widget-table + chartconfig: + title: $str:Messages + columns: + - header: $str:Message + type: $str:string + values: + tableRef: + tablename: ai-messages + format: {value: content} + queryParams: {limit: 100} + - layout_id: other-app-agent + package_name: widget-aichat + chartconfig: + agent: $str:planner + agentApp: $num:12 + handle: + conversationIdColumn: {tablename: machine_conversations, column: conversation_id, dataType: string} + - layout_id: entity-table + package_name: widget-aichat + chartconfig: + handle: + conversationIdColumn: {tablename: machine_status, column: state_text, dataType: string} + extraColumns: + - targetColumn: {tablename: machine_status, column: machine_id, dataType: string} + value: $str:press-1 + - layout_id: other-app-messages + package_name: widget-table + chartconfig: + columns: + - header: $str:Message + type: $str:string + values: + tableRef: + tablename: ai-messages + provider_app: planner-app + format: {value: text} + queryParams: {limit: 100} +layout: + gridLayout: + - {id: chat, x: 0, y: 0, w: 32, h: 32} + - {id: no-handle, x: 32, y: 0, w: 16, h: 16} + - {id: misspelt-agent, x: 48, y: 0, w: 16, h: 16} + - {id: other-table, x: 64, y: 0, w: 16, h: 16} + - {id: platform-table, x: 80, y: 0, w: 16, h: 16} + - {id: wrong-types, x: 32, y: 16, w: 16, h: 16} + - {id: write-messages, x: 48, y: 16, w: 16, h: 16} + - {id: other-app-agent, x: 64, y: 16, w: 16, h: 16} + - {id: entity-table, x: 80, y: 16, w: 16, h: 16} + - {id: conversations, x: 0, y: 32, w: 48, h: 32} + - {id: messages, x: 48, y: 32, w: 24, h: 32} + - {id: other-app-messages, x: 72, y: 32, w: 24, h: 32} diff --git a/tests/run.py b/tests/run.py index 2a57895..bf3cc3b 100644 --- a/tests/run.py +++ b/tests/run.py @@ -22,7 +22,11 @@ are not walked against their definition schemas, for a board that pins a widget version not yet on npm (the reason says which, and what to change once it is published). A board with `# consumes: [, ...]` lines is - validated with those apps added under `consumes` in data-template.yml. + validated with those apps added under `consumes` in data-template.yml. A + board with an `# ai-agents: [, ...]` line is validated with an + ai-template.yml that declares those agents, none of them `main`, and that + file must produce no findings: an agent a widget-aichat talks to needs no + `main: true`. Then the starter app: assets/app-template must produce no findings at all, and scripts/new_app.py must scaffold an app from it that keeps no trace of the @@ -78,6 +82,21 @@ BOARD_FILES = ("board-template.yml", "mobile-board-template.yml") OFFLINE = re.compile(r"^# offline:\s*\S") CONSUMES = re.compile(r"^# consumes:\s*(.+?)\s*$") +AI_AGENTS = re.compile(r"^# ai-agents:\s*(.+?)\s*$") +AI_AGENT = """{name}: + system_prompt: Answers questions about the machines. + tools: + machine_state: + title: Machine state + topic: machine_state + description: Reads one machine's state. + annotations: + readOnlyHint: true + openWorldHint: true + max_context_tokens: 32000 + messages_after_summary: 10 + max_iterations: 12 +""" def findings(app: Path, name: str, *flags: str) -> list[tuple[str, str, str, str]]: @@ -110,6 +129,10 @@ def run_board(board: Path, with_desktop: bool = False) -> tuple[list[tuple[str, data_template = app / ".ironflock" / "data-template.yml" entries = "".join(f" - app: '{a}'\n reason: Shows its data on the board\n" for a in consumed) data_template.write_text(data_template.read_text(encoding="utf-8") + "consumes:\n" + entries, encoding="utf-8") + agents = [a.strip() for m in map(AI_AGENTS.match, lines) if m for a in m[1].split(",") if a.strip()] + if agents: + header = "# yaml-language-server: $schema=https://ironflock.com/schemas/ai-template/v1.yml\n" + (app / ".ironflock" / "ai-template.yml").write_text(header + "".join(AI_AGENT.format(name=a) for a in agents), encoding="utf-8") return findings(app, board.name, *(["--offline"] if offline else [])), target @@ -688,6 +711,7 @@ def main() -> int: for lvl, file, path, msg in found_in if file in BOARD_FILES and file != target ] + problems += [f"unexpected {lvl} {file} {path}: {msg}" for lvl, file, path, msg in found_in if file == "ai-template.yml"] status = "ok " if not problems else "FAIL" print(f"{status} {label}: {len(found)} finding(s), {len(expected)} expected") for problem in problems: diff --git a/tests/widget_checks.py b/tests/widget_checks.py index f8e3a48..d8e9ccd 100644 --- a/tests/widget_checks.py +++ b/tests/widget_checks.py @@ -122,6 +122,17 @@ def with_style_condition(s: dict, shown_for: list) -> None: series_item(s)["unit"].update(condition={"relativePath": "../style", "showIfValueIn": shown_for}) +def with_agent(s: dict) -> None: + """An AI agent setting, as widget-aichat has it.""" + s["properties"]["agent"] = { + "title": "Agent", + "description": "The AI agent this tile talks to: an agent name from the app's ai-template.yml. Empty: the IronFlock assistant.", + "type": "aiAgent", + "dataDrivenDisabled": True, + "order": 4, + } + + def add_code(code: str) -> Callable[[str], str]: """Insert code into the component class, right after `version`.""" return lambda t: t.replace("version: string = 'versionplaceholder'\n", "version: string = 'versionplaceholder'\n" + code + "\n", 1) @@ -365,6 +376,10 @@ def add_code(code: str) -> Callable[[str], str]: lambda r: edit_json(r, DEFAULTS, lambda d: d["dataseries"][0].update(precision=9)), [("ERROR", DEFAULTS, "dataseries.0.precision", "above the maximum")], ), + "an AI agent setting whose default is not a name": ( + lambda r: (edit_json(r, SCHEMA, with_agent), edit_json(r, DEFAULTS, lambda d: d.update(agent=5))), + [("ERROR", DEFAULTS, "agent", "where the schema says aiAgent")], + ), "default for a hidden field": ( lambda r: ( edit_json( @@ -436,6 +451,16 @@ def add_code(code: str) -> Callable[[str], str]: # false matches an unset enum target in the editor, the AI and the board # validator (widget-form shows Target Column before a field type is picked). "false in an enum condition": lambda r: edit_json(r, SCHEMA, lambda s: with_style_condition(s, ["plain", False])), + # widget-aichat's settings and event: an aiAgent setting (an agent name, + # picked in the editor) and ai-connect, which Studio answers with its chat. + "an aiAgent setting and the ai-connect event": lambda r: ( + edit_json(r, SCHEMA, with_agent), + edit_json(r, DEFAULTS, lambda d: d.update(agent="case")), + edit(r, ENTRY, add_code( + " connect() { this.dispatchEvent(new CustomEvent('ai-connect', " + "{ detail: { settings: this.inputData, provide: () => {} }, bubbles: true, composed: true })) }" + )), + ), # A module loaded with import() is a chunk next to the entry; it may import # from the import map and from further chunks. An import() in a JSDoc type # is no import. diff --git a/tools/build_widget_catalog.py b/tools/build_widget_catalog.py index 6a47cef..152eec0 100644 --- a/tools/build_widget_catalog.py +++ b/tools/build_widget_catalog.py @@ -62,6 +62,7 @@ "widget-form", "widget-switch", "widget-toolbar", + "widget-aichat", "widget-filter-dropdown", "widget-filter-calendar", ], From f4584a39c8f0c0f1b18ffad1e2e0d1acc1b9e192 Mon Sep 17 00:00:00 2001 From: Marko Petzold Date: Mon, 30 Nov 2026 00:35:38 +0100 Subject: [PATCH 2/2] release ai-plugins v1.1.27 --- CHANGELOG.md | 2 +- VERSION | 2 +- plugins/ironflock-appliance/.claude-plugin/plugin.json | 2 +- plugins/ironflock-dev/.claude-plugin/plugin.json | 2 +- plugins/ironflock/.claude-plugin/plugin.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d9abfc..79c8f5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ 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. -## Unreleased +## 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. diff --git a/VERSION b/VERSION index 5166d13..93325dd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.26 +1.1.27 diff --git a/plugins/ironflock-appliance/.claude-plugin/plugin.json b/plugins/ironflock-appliance/.claude-plugin/plugin.json index 9c1b0d9..88d6bf5 100644 --- a/plugins/ironflock-appliance/.claude-plugin/plugin.json +++ b/plugins/ironflock-appliance/.claude-plugin/plugin.json @@ -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", diff --git a/plugins/ironflock-dev/.claude-plugin/plugin.json b/plugins/ironflock-dev/.claude-plugin/plugin.json index ca97412..3f39146 100644 --- a/plugins/ironflock-dev/.claude-plugin/plugin.json +++ b/plugins/ironflock-dev/.claude-plugin/plugin.json @@ -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", diff --git a/plugins/ironflock/.claude-plugin/plugin.json b/plugins/ironflock/.claude-plugin/plugin.json index fc66b44..7d039e7 100644 --- a/plugins/ironflock/.claude-plugin/plugin.json +++ b/plugins/ironflock/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "ironflock", "displayName": "IronFlock", - "version": "1.1.26", + "version": "1.1.27", "description": "Connect Claude to IronFlock in the cloud with browser sign-in. Work with devices, apps, alarms, logs and project data. Add the optional IronFlock Appliance plugin for a direct connection to a local installation.", "author": { "name": "IronFlock",