agentworkshop 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/_nuxt/B9Yie5HN.js +2 -0
- package/.output/public/_nuxt/CN7Zh8GQ.js +1 -0
- package/.output/public/_nuxt/CdSgfcYR.js +1 -0
- package/.output/public/_nuxt/CdfAP_IH2.js +1 -0
- package/.output/public/_nuxt/ChnfyQHz.js +1 -0
- package/.output/public/_nuxt/{BkKYf8xY.js → CyygA0q4.js} +4 -4
- package/.output/public/_nuxt/{Bz40vyZS.js → DFnGFEav.js} +7 -7
- package/.output/public/_nuxt/Xaf_HIR3.js +1 -0
- package/.output/public/_nuxt/ZugRk0CM2.js +4 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/55c10854-ee0e-4be4-924b-a1b0e100fe11.json +1 -0
- package/.output/public/_nuxt/{default.iGJy9dP-.css → default.D17kXlD6.css} +1 -1
- package/.output/public/_nuxt/monitor.CmwpEUCI.css +1 -0
- package/.output/public/_nuxt/yIKY_V1P.js +1 -0
- package/.output/server/chunks/_/nitro.mjs +1131 -920
- package/.output/server/chunks/_/nitro.mjs.map +1 -1
- package/.output/server/chunks/build/{TownView-BkHxMiwZ.mjs → TownView-Bl8Gkcxi.mjs} +3 -3
- package/.output/server/chunks/build/{TownView-BkHxMiwZ.mjs.map → TownView-Bl8Gkcxi.mjs.map} +1 -1
- package/.output/server/chunks/build/{_id_-Bna1_JuB.mjs → _id_-CWLFGZjV.mjs} +2 -2
- package/.output/server/chunks/build/{_id_-Bna1_JuB.mjs.map → _id_-CWLFGZjV.mjs.map} +1 -1
- package/.output/server/chunks/build/_id_-GnRJPykX.mjs +1 -1
- package/.output/server/chunks/build/{_wsId_-CzLDGT_V.mjs → _wsId_-BhQMjyHG.mjs} +3 -4
- package/.output/server/chunks/build/{_wsId_-CzLDGT_V.mjs.map → _wsId_-BhQMjyHG.mjs.map} +1 -1
- package/.output/server/chunks/build/{daq-CmeM4u5u.mjs → daq-BOgpn9sl.mjs} +4 -5
- package/.output/server/chunks/build/daq-BOgpn9sl.mjs.map +1 -0
- package/.output/server/chunks/build/dcw-BTM5YU-B.mjs +1 -1
- package/.output/server/chunks/build/{default-Dt6xLdpd.mjs → default-CKJWhkot.mjs} +60 -17
- package/.output/server/chunks/build/{default-Dt6xLdpd.mjs.map → default-CKJWhkot.mjs.map} +1 -1
- package/.output/server/chunks/build/{logs-CUQt1z7D.mjs → logs-Dyk0I2I9.mjs} +3 -4
- package/.output/server/chunks/build/logs-Dyk0I2I9.mjs.map +1 -0
- package/.output/server/chunks/build/{monitor-yNoV98rf.mjs → monitor-KW8WLOJd.mjs} +34 -33
- package/.output/server/chunks/build/{monitor-yNoV98rf.mjs.map → monitor-KW8WLOJd.mjs.map} +1 -1
- package/.output/server/chunks/build/{town-BN4vQPb8.mjs → town-_4tEEEVW.mjs} +3 -4
- package/.output/server/chunks/build/town-_4tEEEVW.mjs.map +1 -0
- package/.output/server/chunks/build/useDaqStream-hwkhJHFU.mjs +1 -1
- package/.output/server/chunks/build/useDcwStream-Bdew_yrr.mjs +1 -1
- package/.output/server/chunks/build/{useWorkshopWs-xcdeiSmJ.mjs → useWorkshopWs-B3j5wIAK.mjs} +177 -3
- package/.output/server/chunks/build/useWorkshopWs-B3j5wIAK.mjs.map +1 -0
- package/.output/server/chunks/build/{workshop-CLhwe5eo.mjs → workshop-k0XZTFKg.mjs} +2 -3
- package/.output/server/chunks/build/workshop-k0XZTFKg.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/channel-templates/_id/instantiate.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/channels.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/hitl/pending.get.mjs +32 -0
- package/.output/server/chunks/routes/api/workshop/hitl/pending.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/hitl/respond.post.mjs +56 -0
- package/.output/server/chunks/routes/api/workshop/hitl/respond.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/workshop/plugins/_name/disable.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/plugins/_name/enable.post.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.delete.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/scene/layouts/_channelId_.put.mjs +1 -1
- package/.output/server/chunks/routes/api/workshop/workspaces/_id/channel-templates/_tplId_.post.mjs +1 -1
- package/.output/server/chunks/routes/renderer.mjs +2 -2
- package/.output/server/chunks/virtual/entry.mjs +17 -11
- package/.output/server/chunks/virtual/precomputed.mjs +1 -1
- package/.output/server/package.json +1 -1
- package/README.md +435 -434
- package/app/components/AppHeader.vue +138 -0
- package/app/composables/workshop/useWorkshopWs.ts +4 -0
- package/app/pages/monitor.vue +17 -1
- package/app/stores/workshop/hitl.ts +80 -0
- package/bin/aw.mjs +0 -0
- package/cli/commands/tui.mjs +19 -0
- package/config.yml +134 -134
- package/docs/tui.md +43 -0
- package/i18n/locales/en.ts +3 -0
- package/i18n/locales/zh-CN.ts +3 -0
- package/package.json +140 -144
- package/scripts/_spike-pitui.mjs +116 -0
- package/scripts/e2e-hitl-live.mjs +323 -0
- package/scripts/e2e-line-live.mjs +144 -0
- package/scripts/test-hitl-registry.ts +112 -0
- package/scripts/test-tui-commands.mjs +131 -0
- package/scripts/test-tui-reducers.mjs +72 -0
- package/scripts/tsconfig.json +14 -0
- package/scripts/tui-smoke.mjs +91 -0
- package/server/api/workshop/hitl/pending.get.ts +28 -0
- package/server/api/workshop/hitl/respond.post.ts +67 -0
- package/server/api/workshop/ws.ts +30 -1
- package/server/data/daqs.json +39 -17
- package/server/data/dcw-lines.json +14 -0
- package/server/data/dcw-products.json +35 -0
- package/server/data/dcw-recipes.json +140 -0
- package/server/data/dcw-rollback.json +111 -1
- package/server/data/dcw-runs.json +135 -90
- package/server/data/dcw-writes.json +120 -0
- package/server/data/dcws.json +400 -275
- package/server/data/line-runs.json +11 -1
- package/server/plugins/workshop.ts +7 -0
- package/server/services/workshop/agents/harness-terminal.ts +92 -25
- package/server/services/workshop/agents/hitl-registry.ts +181 -0
- package/server/services/workshop/agents/tool-approvals.ts +15 -0
- package/server/services/workshop/scene-events.ts +19 -9
- package/shared/workshop-protocol.ts +37 -0
- package/tui/README.md +65 -0
- package/tui/aw-tui.mjs +356 -0
- package/tui/commands/index.mjs +250 -0
- package/tui/components/chat-log.mjs +42 -0
- package/tui/components/hitl-card.mjs +36 -0
- package/tui/components/monitor-pane.mjs +39 -0
- package/tui/components/root.mjs +53 -0
- package/tui/components/status-bar.mjs +29 -0
- package/tui/lib/api.mjs +82 -0
- package/tui/lib/config.mjs +58 -0
- package/tui/lib/reducers.mjs +218 -0
- package/tui/lib/state.mjs +80 -0
- package/tui/lib/virtual-terminal.mjs +48 -0
- package/tui/lib/ws.mjs +124 -0
- package/tui/theme.mjs +38 -0
- package/.output/public/_nuxt/B7V9IfTL.js +0 -1
- package/.output/public/_nuxt/BE5QyG5J2.js +0 -1
- package/.output/public/_nuxt/BuKI8z-5.js +0 -1
- package/.output/public/_nuxt/D0C5Q0di.js +0 -1
- package/.output/public/_nuxt/DC-QMEk1.js +0 -2
- package/.output/public/_nuxt/DEkQ0qQ02.js +0 -1
- package/.output/public/_nuxt/builds/meta/c6c01cdd-762e-4fb8-86e7-753c5185b856.json +0 -1
- package/.output/public/_nuxt/dt2tKE95.js +0 -4
- package/.output/public/_nuxt/i_MKObHo.js +0 -1
- package/.output/public/_nuxt/monitor.41fCD6TB.css +0 -1
- package/.output/public/_nuxt/tpDMVY5w.js +0 -1
- package/.output/server/chunks/build/connection-Dc0fn6yd.mjs +0 -120
- package/.output/server/chunks/build/connection-Dc0fn6yd.mjs.map +0 -1
- package/.output/server/chunks/build/daq-CmeM4u5u.mjs.map +0 -1
- package/.output/server/chunks/build/logs-CUQt1z7D.mjs.map +0 -1
- package/.output/server/chunks/build/town-BN4vQPb8.mjs.map +0 -1
- package/.output/server/chunks/build/useWorkshopWs-xcdeiSmJ.mjs.map +0 -1
- package/.output/server/chunks/build/workshop-CLhwe5eo.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,434 +1,435 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
<img src="https://raw.githubusercontent.com/kingdol666/AgentWorkShop/main/docs/readme-assets/hero.png" alt="AgentWorkShop — Agents that run the production line" width="100%" />
|
|
4
|
-
|
|
5
|
-
# AgentWorkShop
|
|
6
|
-
|
|
7
|
-
**Where AI agent teams meet the production line.**
|
|
8
|
-
|
|
9
|
-
[](https://nuxt.com)
|
|
10
|
-
[](https://vuejs.org)
|
|
11
|
-
[](https://www.typescriptlang.org)
|
|
12
|
-
[](https://nodejs.org)
|
|
13
|
-
[](https://nodejs.org/api/sqlite.html)
|
|
14
|
-
[](./LICENSE)
|
|
15
|
-
|
|
16
|
-
**[中文文档 →](./README-zh.md)** · **[Online Docs →](https://kingdol666.github.io/AgentWorkShop/)**
|
|
17
|
-
|
|
18
|
-
*A configuration-driven platform where **AI agent teams** and an **industrial digital twin** share one runtime — agents query real telemetry, issue supervisory setpoints through human-approved write control, and every event streams live to a 3D twin.*
|
|
19
|
-
|
|
20
|
-
</div>
|
|
21
|
-
|
|
22
|
-
> ⚠️ **Positioning: supervisory layer.** AgentWorkShop is a *supervisory* (SCADA-adjacent) layer for production-line management, digital twins, DAQ and agent orchestration, operating at **second-level soft real-time**. It is **not** a hard real-time controller: any time-critical loop (**< 10 ms**, interlocks, safety, servo) **must live inside the PLC**. Setpoints written here are advisory — plant-side logic may veto.
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## What is this?
|
|
27
|
-
|
|
28
|
-
AgentWorkShop started as a **multi-agent software workshop** — channels of coding agents with a lead-agent scheduler, a 7-state task machine, persistent memory, and four interoperable entry points (WebSocket / MCP / A2A / REST).
|
|
29
|
-
|
|
30
|
-
It grew an **industrial half**: a full data-acquisition and write-control stack (Modbus TCP / OPC UA), production lines with recipes and batch runs, a 3D digital-twin town — and the bridge that makes it unique: **agents can be granted bound, permission-scoped access to real industrial nodes**, query their live telemetry with physical semantics attached, and drive write operations through an interlock → human-in-the-loop → readback pipeline.
|
|
31
|
-
|
|
32
|
-
The result: submit a goal like *"analyze the melt temperature trend and optimize the setpoint"* — and an agent team reads real sensor history, computes statistics, proposes a new setpoint, waits for your approval in the HITL panel, writes it to the PLC, verifies the readback, and reports the numbers back. **End to end, verified by automated E2E.**
|
|
33
|
-
|
|
34
|
-
<div align="center">
|
|
35
|
-
<img src="https://raw.githubusercontent.com/kingdol666/AgentWorkShop/main/docs/readme-assets/town-demo.gif" alt="3D digital twin — live production line" width="86%" />
|
|
36
|
-
<br><sub><b>Live 3D twin.</b> Line equipment, device health, DAQ channels and trend analysis — all driven by real-time telemetry.</sub>
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
## Highlights
|
|
42
|
-
|
|
43
|
-
| Capability | Why it matters |
|
|
44
|
-
|---|---|
|
|
45
|
-
| **Agent teams, industrial scope** | Agents bind to DAQ/DCW nodes and see semantic cards — physical meaning, units, safe range, recipe window — never raw registers. |
|
|
46
|
-
| **Human-approved write control** | DCW writes flow through **safe-range ∩ recipe-window** interlock → optional **HITL approval** → PLC write → **readback verification** → signed write history. |
|
|
47
|
-
| **Read-write DCW channels (v0.7)** | Every control node also **reads its PLC value back** through the same calibration path it writes with: periodic + on-demand + agent reads surface **SET vs ACT** side by side in the DCW console, the twin panel (green ACT row) and a new `dcw_read` agent tool — passive observation, never blocked by write interlocks. |
|
|
48
|
-
| **Fully config-driven runtime (v0.7)** | Every runtime knob (memory budgets, compaction, rollback guardrails, retention, backups, log level…) is declared once in the settings descriptor registry with precedence **config.yml < runtime-settings < env** — legacy env names kept as aliases, no hardcoded defaults left in code. Project-level `.AgentWorkShop` wins; `~/.AgentWorkShop` is the user-level fallback (auto-seeded on install). |
|
|
49
|
-
| **Real field buses** | Modbus TCP with per-connection op queues; OPC UA with session pools. Linear calibration hooks (PLC value ↔ engineering unit) on every node. |
|
|
50
|
-
| **Multi-modal DAQ frame pipeline (v0.6)** | Multi-point profiles (thickness/scanner) and CCD image frames are processed through template sink pipelines before storage: vectors & metadata into Timescale (`daq_frames`), pixels into object storage (MinIO, auto disk fallback); derived-metric thresholds ride the existing alarm chain. |
|
|
51
|
-
| **Plugin extension API (v0.6)** | `ctx.daq.registerDriver / registerProcessor / registerTemplate` for custom acquisition and sink algorithms (drop into `plugins/`); `ctx.omp.registerTool` for custom agent tools, hot-injected into every running session on registry change. |
|
|
52
|
-
| **Line operations** | Lines → products → recipes → batch runs. Recipe windows gate acquisition and interlock writes; every sample is tagged `product/recipe/run` for per-batch isolation. |
|
|
53
|
-
| **Lead-agent orchestration** | Each channel has one lead: decomposes goals, dispatches to idle workers, reassigns failures, judges goal satisfaction. LLM decisions with a deterministic rule-engine fallback — the system never stalls. |
|
|
54
|
-
| **Three execution modes** | `goal` (satisfaction judging) · `loop` (fixed-interval replay) · `pipeline` (ordered stages). 7-state task machine with progress, artifacts and full history. |
|
|
55
|
-
| **Four entry points** | One manager behind every door: **WS** (AEP v1 event stream with seq-resume), **MCP** (in-process tools), **A2A** (JSON-RPC 2.0 + AgentCard), **REST**. |
|
|
56
|
-
| **Persistent memory** | Private + channel-shared domains; FTS5 with CJK segmentation, optional vector hybrid recall, token-budgeted injection; session compaction summaries auto-archived, team chronicle and idle reflections keep accumulating (v0.6). |
|
|
57
|
-
| **Harness-agnostic** | One `AgentInterface`: `mock` (in-process), `omp` (real agent subprocess via RPC), `claude` (SDK adapter). The platform never knows which one runs. |
|
|
58
|
-
| **3D digital twin** | Three.js town: place line equipment and channel territories, watch device health, alarms and live values — driven by the same event bus. |
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## Interface
|
|
63
|
-
|
|
64
|
-
<div align="center">
|
|
65
|
-
|
|
66
|
-
| Agent Workbench | Line Operations |
|
|
67
|
-
|:---:|:---:|
|
|
68
|
-
|  |  |
|
|
69
|
-
|
|
70
|
-
| DAQ Center | Digital Twin Town |
|
|
71
|
-
|:---:|:---:|
|
|
72
|
-
|  |  |
|
|
73
|
-
|
|
74
|
-
</div>
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
## Architecture
|
|
79
|
-
|
|
80
|
-
```mermaid
|
|
81
|
-
flowchart TB
|
|
82
|
-
subgraph FE["Frontend — Nuxt 4 / Vue 3"]
|
|
83
|
-
UI["Workshop UI · 3D Twin · Dashboards"]
|
|
84
|
-
WS["AEP client — seq resume"]
|
|
85
|
-
end
|
|
86
|
-
subgraph SRV["Server — Nitro / h3"]
|
|
87
|
-
REST["REST /api/workshop/**"]
|
|
88
|
-
HUB["WS Hub — AEP v1"]
|
|
89
|
-
A2A["A2A JSON-RPC"]
|
|
90
|
-
MCP["MCP Server"]
|
|
91
|
-
subgraph RT["Runtime"]
|
|
92
|
-
MGR["AgentChannelManager"]
|
|
93
|
-
SCH["SchedulerLoop — lead supervision"]
|
|
94
|
-
TE["TaskEngine — 7-state machine"]
|
|
95
|
-
AR["AgentRuntime × N"]
|
|
96
|
-
MEM["AgentMemory — FTS5 + vector"]
|
|
97
|
-
BUS["ChannelBus — per-channel seq + ring"]
|
|
98
|
-
end
|
|
99
|
-
subgraph IND["Industrial"]
|
|
100
|
-
DAQ["DAQ gateway — per-node edge runtimes"]
|
|
101
|
-
DCW["DCW gateway — write control"]
|
|
102
|
-
BR["Bus — inproc / MQTT"]
|
|
103
|
-
TSDB["TSDB — SQLite / Timescale"]
|
|
104
|
-
end
|
|
105
|
-
subgraph HB["Harness adapters"]
|
|
106
|
-
MOCK["mock"]
|
|
107
|
-
OMP["omp — real subprocess"]
|
|
108
|
-
CLD["claude — SDK"]
|
|
109
|
-
end
|
|
110
|
-
DB[("SQLite — channels · agents · tasks
|
|
111
|
-
messages · memories (FTS5) · events")]
|
|
112
|
-
end
|
|
113
|
-
UI <--> WS
|
|
114
|
-
WS --> BUS
|
|
115
|
-
REST & A2A & MCP --> MGR
|
|
116
|
-
MGR --> SCH & TE & AR
|
|
117
|
-
AR --> MEM
|
|
118
|
-
AR --> MOCK & OMP & CLD
|
|
119
|
-
MGR & TE & MEM & BUS --> DB
|
|
120
|
-
DAQ <--> BR --> TSDB
|
|
121
|
-
DCW --> BR
|
|
122
|
-
DAQ & DCW --> BUS
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
**The agent × machine bridge** (the part worth reading the source for):
|
|
126
|
-
|
|
127
|
-
```
|
|
128
|
-
agent ──binds to──▶ node (daq: auto / dcw: manual)
|
|
129
|
-
│ │
|
|
130
|
-
│ my_industrial_nodes ◀── semantic card: meaning · unit · safe range · recipe window
|
|
131
|
-
│ daq_query ◀── TSDB history, stats + physical semantics
|
|
132
|
-
│ dcw_control ──▶ interlock (safe range ∩ recipe window)
|
|
133
|
-
│ ──▶ HITL approval (manual mode, 180 s timeout)
|
|
134
|
-
│ ──▶ PLC write → readback check → ACK + write history
|
|
135
|
-
◀── result text with numbers the agent can cite
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
## Quick start
|
|
141
|
-
|
|
142
|
-
### Prerequisites
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
node -v # ≥ 23.4.0 (needs built-in node:sqlite)
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
> The `omp` harness (recommended for real work) requires the `omp` CLI on PATH. The `mock` harness works out of the box for demos and CI. Optional DAQ infrastructure (MQTT broker + TimescaleDB) auto-starts via Docker when reachable (`docker compose up -d`).
|
|
149
|
-
|
|
150
|
-
### Option A — install from npm (recommended)
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
npm install -g agentworkshop # → `aw` / `agentworkshop` on PATH
|
|
154
|
-
aw start # first run builds once (~2-3 min) → http://localhost:3001
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
That's it — no checkout, no build tools. On first launch everything initializes into the config root **`~/.AgentWorkShop`**: the default `config.yml`, a generated `.env` holding a random session secret, `runtime-settings.json`, a docker-compose seed and an empty `data/` directory. All runtime data (SQLite, JSON repos, backups, logs) lives there too — config and data stay with the install, not the working directory.
|
|
158
|
-
|
|
159
|
-
Prefer a one-off run without installing?
|
|
160
|
-
|
|
161
|
-
```bash
|
|
162
|
-
npx agentworkshop start # fetch + run, nothing persisted globally
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### Option B — from source
|
|
166
|
-
|
|
167
|
-
```bash
|
|
168
|
-
git clone https://github.com/kingdol666/AgentWorkShop.git && cd AgentWorkShop
|
|
169
|
-
pnpm install
|
|
170
|
-
pnpm dev # → http://localhost:3000 (port from config.yml)
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
Production from source:
|
|
174
|
-
|
|
175
|
-
```bash
|
|
176
|
-
pnpm build # nuxt build → .output/
|
|
177
|
-
pnpm start # port from config.yml → server.prod.port
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
> In a source checkout the config root is the project's **`.AgentWorkShop/`** folder (runtime overrides, data, project-level commands), while `config.yml` / `.env` stay at the checkout root, version-controlled as the factory defaults.
|
|
181
|
-
|
|
182
|
-
### Updating
|
|
183
|
-
|
|
184
|
-
```bash
|
|
185
|
-
aw update # check + self-update the global install
|
|
186
|
-
aw update --check # only report; nothing is installed
|
|
187
|
-
npm install -g agentworkshop@latest # manual equivalent
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
Releases follow semver. Every `aw start` verifies the config root and migrates it in place when a new version changes the layout — your data survives upgrades.
|
|
191
|
-
|
|
192
|
-
### Your first agent × line session (~2 minutes)
|
|
193
|
-
|
|
194
|
-
1. **Sign in** — register in the sidebar (or `POST /api/users/register`).
|
|
195
|
-
2. **Build a line** — `Line Operations` → create a line, add DAQ nodes (e.g. `daq-temp-tc`) and control nodes (e.g. `dcw-temp-sp`), create a product + recipe, hit **Start**. Live values start flowing.
|
|
196
|
-
3. **Create a team** — `Agent Workshop` → pick a lead + workers, **deploy** into a channel.
|
|
197
|
-
4. **Bind nodes** — open the agent's detail panel → bind the DAQ node (*auto*) and the control node (*manual* = needs your approval).
|
|
198
|
-
5. **Submit the goal** — *"Analyze the last 5 minutes of melt temperature; if deviation from 182 °C exceeds 1 °C, correct the setpoint (wait for my approval)."*
|
|
199
|
-
6. **Approve** — the agent reads real history, computes the mean, requests the write → approve in the HITL panel → watch the setpoint change and the goal close with a numeric report.
|
|
200
|
-
|
|
201
|
-
---
|
|
202
|
-
|
|
203
|
-
## Configuration & CLI — config-driven by design
|
|
204
|
-
|
|
205
|
-
One runtime, one source of truth. **`config.yml`** declares defaults; **`runtime-settings.json`** inside the config root carries runtime overrides; environment variables and CLI flags sit on top. Every editable key is described once in `shared/config/schema.json` (type, range, enum, live-vs-restart) and surfaced through the same descriptors in **both the UI and the CLI**.
|
|
206
|
-
|
|
207
|
-
```
|
|
208
|
-
config.yml (defaults) < .AgentWorkShop/runtime-settings.json (runtime) < env vars / CLI flags
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
The config root is **`~/.AgentWorkShop`** for a global install (`npm i -g`) — wherever you run `aw` from — and **`<repo>/.AgentWorkShop`** in a source checkout (with `config.yml` / `.env` staying at the checkout root as version-controlled factory defaults). `AW_HOME` redirects it; `AW_MODE=home` forces the global shape.
|
|
212
|
-
|
|
213
|
-
### Live settings, persisted, hot-reloaded
|
|
214
|
-
|
|
215
|
-
- The **Settings → Runtime config** tab renders every editable key from the descriptors — change server ports, theme, API timeouts, locale or the approval gate, hit save.
|
|
216
|
-
- `live` keys apply instantly (theme, title, timeouts, approval gate…) over a server-sent event stream — no reload, no restart.
|
|
217
|
-
- `restart` keys (ports, hosts) persist to disk and take effect on the next launch of the matching mode (`aw dev` / `aw start`).
|
|
218
|
-
- One channel for every writer: the UI, the CLI and the server's file watcher all converge on the same settings file, so a change made anywhere shows up everywhere.
|
|
219
|
-
|
|
220
|
-
### The `aw` CLI
|
|
221
|
-
|
|
222
|
-
| Command | What it does |
|
|
223
|
-
|---|---|
|
|
224
|
-
| `aw start · aw dev · aw build` | Production server / dev server / build — ports from the effective config; first `start` builds once |
|
|
225
|
-
| `aw config list · get · set · unset · reset` | Read & write runtime settings (validated against the schema, atomic writes) |
|
|
226
|
-
| `aw home` | Inspect / initialize the config root `.AgentWorkShop` |
|
|
227
|
-
| `aw init <dir>` | Scaffold a runnable project (full config system + CLI included) |
|
|
228
|
-
| `aw register <path\|url\|npm:pkg>` | Register a new command — project-local or `--global` |
|
|
229
|
-
| `aw update` | Check npm for the latest release and self-update the global install |
|
|
230
|
-
| `aw doctor` | Environment + project health check (node, config, ports, keys) |
|
|
231
|
-
| `aw status` | Live overview: mode, config sources, running server, command table |
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
|
243
|
-
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
export
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
- **
|
|
263
|
-
- **
|
|
264
|
-
- **
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
-
|
|
270
|
-
- **
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
| `
|
|
303
|
-
| `
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
| **
|
|
311
|
-
| **
|
|
312
|
-
| **
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
|
332
|
-
|
|
|
333
|
-
|
|
|
334
|
-
|
|
|
335
|
-
|
|
|
336
|
-
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
├──
|
|
348
|
-
|
|
349
|
-
│ ├──
|
|
350
|
-
│
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
│ ├──
|
|
354
|
-
│
|
|
355
|
-
│ │ ├──
|
|
356
|
-
│ │ ├──
|
|
357
|
-
│ │
|
|
358
|
-
│
|
|
359
|
-
│
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
├── .
|
|
364
|
-
├──
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
|
374
|
-
|
|
|
375
|
-
|
|
|
376
|
-
|
|
|
377
|
-
|
|
|
378
|
-
|
|
|
379
|
-
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
pnpm
|
|
386
|
-
pnpm
|
|
387
|
-
pnpm
|
|
388
|
-
pnpm
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
|
398
|
-
|
|
|
399
|
-
|
|
|
400
|
-
|
|
|
401
|
-
|
|
|
402
|
-
|
|
|
403
|
-
|
|
|
404
|
-
|
|
|
405
|
-
|
|
|
406
|
-
|
|
|
407
|
-
|
|
|
408
|
-
|
|
|
409
|
-
|
|
|
410
|
-
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
-
|
|
420
|
-
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
<source media="(prefers-color-scheme:
|
|
430
|
-
<
|
|
431
|
-
|
|
432
|
-
</
|
|
433
|
-
|
|
434
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="https://raw.githubusercontent.com/kingdol666/AgentWorkShop/main/docs/readme-assets/hero.png" alt="AgentWorkShop — Agents that run the production line" width="100%" />
|
|
4
|
+
|
|
5
|
+
# AgentWorkShop
|
|
6
|
+
|
|
7
|
+
**Where AI agent teams meet the production line.**
|
|
8
|
+
|
|
9
|
+
[](https://nuxt.com)
|
|
10
|
+
[](https://vuejs.org)
|
|
11
|
+
[](https://www.typescriptlang.org)
|
|
12
|
+
[](https://nodejs.org)
|
|
13
|
+
[](https://nodejs.org/api/sqlite.html)
|
|
14
|
+
[](./LICENSE)
|
|
15
|
+
|
|
16
|
+
**[中文文档 →](./README-zh.md)** · **[Online Docs →](https://kingdol666.github.io/AgentWorkShop/)**
|
|
17
|
+
|
|
18
|
+
*A configuration-driven platform where **AI agent teams** and an **industrial digital twin** share one runtime — agents query real telemetry, issue supervisory setpoints through human-approved write control, and every event streams live to a 3D twin.*
|
|
19
|
+
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
> ⚠️ **Positioning: supervisory layer.** AgentWorkShop is a *supervisory* (SCADA-adjacent) layer for production-line management, digital twins, DAQ and agent orchestration, operating at **second-level soft real-time**. It is **not** a hard real-time controller: any time-critical loop (**< 10 ms**, interlocks, safety, servo) **must live inside the PLC**. Setpoints written here are advisory — plant-side logic may veto.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## What is this?
|
|
27
|
+
|
|
28
|
+
AgentWorkShop started as a **multi-agent software workshop** — channels of coding agents with a lead-agent scheduler, a 7-state task machine, persistent memory, and four interoperable entry points (WebSocket / MCP / A2A / REST).
|
|
29
|
+
|
|
30
|
+
It grew an **industrial half**: a full data-acquisition and write-control stack (Modbus TCP / OPC UA), production lines with recipes and batch runs, a 3D digital-twin town — and the bridge that makes it unique: **agents can be granted bound, permission-scoped access to real industrial nodes**, query their live telemetry with physical semantics attached, and drive write operations through an interlock → human-in-the-loop → readback pipeline.
|
|
31
|
+
|
|
32
|
+
The result: submit a goal like *"analyze the melt temperature trend and optimize the setpoint"* — and an agent team reads real sensor history, computes statistics, proposes a new setpoint, waits for your approval in the HITL panel, writes it to the PLC, verifies the readback, and reports the numbers back. **End to end, verified by automated E2E.**
|
|
33
|
+
|
|
34
|
+
<div align="center">
|
|
35
|
+
<img src="https://raw.githubusercontent.com/kingdol666/AgentWorkShop/main/docs/readme-assets/town-demo.gif" alt="3D digital twin — live production line" width="86%" />
|
|
36
|
+
<br><sub><b>Live 3D twin.</b> Line equipment, device health, DAQ channels and trend analysis — all driven by real-time telemetry.</sub>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Highlights
|
|
42
|
+
|
|
43
|
+
| Capability | Why it matters |
|
|
44
|
+
|---|---|
|
|
45
|
+
| **Agent teams, industrial scope** | Agents bind to DAQ/DCW nodes and see semantic cards — physical meaning, units, safe range, recipe window — never raw registers. |
|
|
46
|
+
| **Human-approved write control** | DCW writes flow through **safe-range ∩ recipe-window** interlock → optional **HITL approval** → PLC write → **readback verification** → signed write history. |
|
|
47
|
+
| **Read-write DCW channels (v0.7)** | Every control node also **reads its PLC value back** through the same calibration path it writes with: periodic + on-demand + agent reads surface **SET vs ACT** side by side in the DCW console, the twin panel (green ACT row) and a new `dcw_read` agent tool — passive observation, never blocked by write interlocks. |
|
|
48
|
+
| **Fully config-driven runtime (v0.7)** | Every runtime knob (memory budgets, compaction, rollback guardrails, retention, backups, log level…) is declared once in the settings descriptor registry with precedence **config.yml < runtime-settings < env** — legacy env names kept as aliases, no hardcoded defaults left in code. Project-level `.AgentWorkShop` wins; `~/.AgentWorkShop` is the user-level fallback (auto-seeded on install). |
|
|
49
|
+
| **Real field buses** | Modbus TCP with per-connection op queues; OPC UA with session pools. Linear calibration hooks (PLC value ↔ engineering unit) on every node. |
|
|
50
|
+
| **Multi-modal DAQ frame pipeline (v0.6)** | Multi-point profiles (thickness/scanner) and CCD image frames are processed through template sink pipelines before storage: vectors & metadata into Timescale (`daq_frames`), pixels into object storage (MinIO, auto disk fallback); derived-metric thresholds ride the existing alarm chain. |
|
|
51
|
+
| **Plugin extension API (v0.6)** | `ctx.daq.registerDriver / registerProcessor / registerTemplate` for custom acquisition and sink algorithms (drop into `plugins/`); `ctx.omp.registerTool` for custom agent tools, hot-injected into every running session on registry change. |
|
|
52
|
+
| **Line operations** | Lines → products → recipes → batch runs. Recipe windows gate acquisition and interlock writes; every sample is tagged `product/recipe/run` for per-batch isolation. |
|
|
53
|
+
| **Lead-agent orchestration** | Each channel has one lead: decomposes goals, dispatches to idle workers, reassigns failures, judges goal satisfaction. LLM decisions with a deterministic rule-engine fallback — the system never stalls. |
|
|
54
|
+
| **Three execution modes** | `goal` (satisfaction judging) · `loop` (fixed-interval replay) · `pipeline` (ordered stages). 7-state task machine with progress, artifacts and full history. |
|
|
55
|
+
| **Four entry points** | One manager behind every door: **WS** (AEP v1 event stream with seq-resume), **MCP** (in-process tools), **A2A** (JSON-RPC 2.0 + AgentCard), **REST**. |
|
|
56
|
+
| **Persistent memory** | Private + channel-shared domains; FTS5 with CJK segmentation, optional vector hybrid recall, token-budgeted injection; session compaction summaries auto-archived, team chronicle and idle reflections keep accumulating (v0.6). |
|
|
57
|
+
| **Harness-agnostic** | One `AgentInterface`: `mock` (in-process), `omp` (real agent subprocess via RPC), `claude` (SDK adapter). The platform never knows which one runs. |
|
|
58
|
+
| **3D digital twin** | Three.js town: place line equipment and channel territories, watch device health, alarms and live values — driven by the same event bus. |
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Interface
|
|
63
|
+
|
|
64
|
+
<div align="center">
|
|
65
|
+
|
|
66
|
+
| Agent Workbench | Line Operations |
|
|
67
|
+
|:---:|:---:|
|
|
68
|
+
|  |  |
|
|
69
|
+
|
|
70
|
+
| DAQ Center | Digital Twin Town |
|
|
71
|
+
|:---:|:---:|
|
|
72
|
+
|  |  |
|
|
73
|
+
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Architecture
|
|
79
|
+
|
|
80
|
+
```mermaid
|
|
81
|
+
flowchart TB
|
|
82
|
+
subgraph FE["Frontend — Nuxt 4 / Vue 3"]
|
|
83
|
+
UI["Workshop UI · 3D Twin · Dashboards"]
|
|
84
|
+
WS["AEP client — seq resume"]
|
|
85
|
+
end
|
|
86
|
+
subgraph SRV["Server — Nitro / h3"]
|
|
87
|
+
REST["REST /api/workshop/**"]
|
|
88
|
+
HUB["WS Hub — AEP v1"]
|
|
89
|
+
A2A["A2A JSON-RPC"]
|
|
90
|
+
MCP["MCP Server"]
|
|
91
|
+
subgraph RT["Runtime"]
|
|
92
|
+
MGR["AgentChannelManager"]
|
|
93
|
+
SCH["SchedulerLoop — lead supervision"]
|
|
94
|
+
TE["TaskEngine — 7-state machine"]
|
|
95
|
+
AR["AgentRuntime × N"]
|
|
96
|
+
MEM["AgentMemory — FTS5 + vector"]
|
|
97
|
+
BUS["ChannelBus — per-channel seq + ring"]
|
|
98
|
+
end
|
|
99
|
+
subgraph IND["Industrial"]
|
|
100
|
+
DAQ["DAQ gateway — per-node edge runtimes"]
|
|
101
|
+
DCW["DCW gateway — write control"]
|
|
102
|
+
BR["Bus — inproc / MQTT"]
|
|
103
|
+
TSDB["TSDB — SQLite / Timescale"]
|
|
104
|
+
end
|
|
105
|
+
subgraph HB["Harness adapters"]
|
|
106
|
+
MOCK["mock"]
|
|
107
|
+
OMP["omp — real subprocess"]
|
|
108
|
+
CLD["claude — SDK"]
|
|
109
|
+
end
|
|
110
|
+
DB[("SQLite — channels · agents · tasks
|
|
111
|
+
messages · memories (FTS5) · events")]
|
|
112
|
+
end
|
|
113
|
+
UI <--> WS
|
|
114
|
+
WS --> BUS
|
|
115
|
+
REST & A2A & MCP --> MGR
|
|
116
|
+
MGR --> SCH & TE & AR
|
|
117
|
+
AR --> MEM
|
|
118
|
+
AR --> MOCK & OMP & CLD
|
|
119
|
+
MGR & TE & MEM & BUS --> DB
|
|
120
|
+
DAQ <--> BR --> TSDB
|
|
121
|
+
DCW --> BR
|
|
122
|
+
DAQ & DCW --> BUS
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**The agent × machine bridge** (the part worth reading the source for):
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
agent ──binds to──▶ node (daq: auto / dcw: manual)
|
|
129
|
+
│ │
|
|
130
|
+
│ my_industrial_nodes ◀── semantic card: meaning · unit · safe range · recipe window
|
|
131
|
+
│ daq_query ◀── TSDB history, stats + physical semantics
|
|
132
|
+
│ dcw_control ──▶ interlock (safe range ∩ recipe window)
|
|
133
|
+
│ ──▶ HITL approval (manual mode, 180 s timeout)
|
|
134
|
+
│ ──▶ PLC write → readback check → ACK + write history
|
|
135
|
+
◀── result text with numbers the agent can cite
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Quick start
|
|
141
|
+
|
|
142
|
+
### Prerequisites
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
node -v # ≥ 23.4.0 (needs built-in node:sqlite)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
> The `omp` harness (recommended for real work) requires the `omp` CLI on PATH. The `mock` harness works out of the box for demos and CI. Optional DAQ infrastructure (MQTT broker + TimescaleDB) auto-starts via Docker when reachable (`docker compose up -d`).
|
|
149
|
+
|
|
150
|
+
### Option A — install from npm (recommended)
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npm install -g agentworkshop # → `aw` / `agentworkshop` on PATH
|
|
154
|
+
aw start # first run builds once (~2-3 min) → http://localhost:3001
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
That's it — no checkout, no build tools. On first launch everything initializes into the config root **`~/.AgentWorkShop`**: the default `config.yml`, a generated `.env` holding a random session secret, `runtime-settings.json`, a docker-compose seed and an empty `data/` directory. All runtime data (SQLite, JSON repos, backups, logs) lives there too — config and data stay with the install, not the working directory.
|
|
158
|
+
|
|
159
|
+
Prefer a one-off run without installing?
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
npx agentworkshop start # fetch + run, nothing persisted globally
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Option B — from source
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
git clone https://github.com/kingdol666/AgentWorkShop.git && cd AgentWorkShop
|
|
169
|
+
pnpm install
|
|
170
|
+
pnpm dev # → http://localhost:3000 (port from config.yml)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Production from source:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
pnpm build # nuxt build → .output/
|
|
177
|
+
pnpm start # port from config.yml → server.prod.port
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
> In a source checkout the config root is the project's **`.AgentWorkShop/`** folder (runtime overrides, data, project-level commands), while `config.yml` / `.env` stay at the checkout root, version-controlled as the factory defaults.
|
|
181
|
+
|
|
182
|
+
### Updating
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
aw update # check + self-update the global install
|
|
186
|
+
aw update --check # only report; nothing is installed
|
|
187
|
+
npm install -g agentworkshop@latest # manual equivalent
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Releases follow semver. Every `aw start` verifies the config root and migrates it in place when a new version changes the layout — your data survives upgrades.
|
|
191
|
+
|
|
192
|
+
### Your first agent × line session (~2 minutes)
|
|
193
|
+
|
|
194
|
+
1. **Sign in** — register in the sidebar (or `POST /api/users/register`).
|
|
195
|
+
2. **Build a line** — `Line Operations` → create a line, add DAQ nodes (e.g. `daq-temp-tc`) and control nodes (e.g. `dcw-temp-sp`), create a product + recipe, hit **Start**. Live values start flowing.
|
|
196
|
+
3. **Create a team** — `Agent Workshop` → pick a lead + workers, **deploy** into a channel.
|
|
197
|
+
4. **Bind nodes** — open the agent's detail panel → bind the DAQ node (*auto*) and the control node (*manual* = needs your approval).
|
|
198
|
+
5. **Submit the goal** — *"Analyze the last 5 minutes of melt temperature; if deviation from 182 °C exceeds 1 °C, correct the setpoint (wait for my approval)."*
|
|
199
|
+
6. **Approve** — the agent reads real history, computes the mean, requests the write → approve in the HITL panel → watch the setpoint change and the goal close with a numeric report.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Configuration & CLI — config-driven by design
|
|
204
|
+
|
|
205
|
+
One runtime, one source of truth. **`config.yml`** declares defaults; **`runtime-settings.json`** inside the config root carries runtime overrides; environment variables and CLI flags sit on top. Every editable key is described once in `shared/config/schema.json` (type, range, enum, live-vs-restart) and surfaced through the same descriptors in **both the UI and the CLI**.
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
config.yml (defaults) < .AgentWorkShop/runtime-settings.json (runtime) < env vars / CLI flags
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
The config root is **`~/.AgentWorkShop`** for a global install (`npm i -g`) — wherever you run `aw` from — and **`<repo>/.AgentWorkShop`** in a source checkout (with `config.yml` / `.env` staying at the checkout root as version-controlled factory defaults). `AW_HOME` redirects it; `AW_MODE=home` forces the global shape.
|
|
212
|
+
|
|
213
|
+
### Live settings, persisted, hot-reloaded
|
|
214
|
+
|
|
215
|
+
- The **Settings → Runtime config** tab renders every editable key from the descriptors — change server ports, theme, API timeouts, locale or the approval gate, hit save.
|
|
216
|
+
- `live` keys apply instantly (theme, title, timeouts, approval gate…) over a server-sent event stream — no reload, no restart.
|
|
217
|
+
- `restart` keys (ports, hosts) persist to disk and take effect on the next launch of the matching mode (`aw dev` / `aw start`).
|
|
218
|
+
- One channel for every writer: the UI, the CLI and the server's file watcher all converge on the same settings file, so a change made anywhere shows up everywhere.
|
|
219
|
+
|
|
220
|
+
### The `aw` CLI
|
|
221
|
+
|
|
222
|
+
| Command | What it does |
|
|
223
|
+
|---|---|
|
|
224
|
+
| `aw start · aw dev · aw build` | Production server / dev server / build — ports from the effective config; first `start` builds once |
|
|
225
|
+
| `aw config list · get · set · unset · reset` | Read & write runtime settings (validated against the schema, atomic writes) |
|
|
226
|
+
| `aw home` | Inspect / initialize the config root `.AgentWorkShop` |
|
|
227
|
+
| `aw init <dir>` | Scaffold a runnable project (full config system + CLI included) |
|
|
228
|
+
| `aw register <path\|url\|npm:pkg>` | Register a new command — project-local or `--global` |
|
|
229
|
+
| `aw update` | Check npm for the latest release and self-update the global install |
|
|
230
|
+
| `aw doctor` | Environment + project health check (node, config, ports, keys) |
|
|
231
|
+
| `aw status` | Live overview: mode, config sources, running server, command table |
|
|
232
|
+
| `aw tui` | Terminal workbench: channel/agent management, task submission, live monitor pane, HITL answering (see `tui/README.md`) |
|
|
233
|
+
|
|
234
|
+
Global flags: `--help/-h` · `--version/-v` · `--json` (machine-readable) · `--root <dir>` · `--debug`.
|
|
235
|
+
|
|
236
|
+
### Command registration
|
|
237
|
+
|
|
238
|
+
Commands are plain modules exporting `{ meta, run }`. Drop one into a scanned directory and it's live on the next invocation — no registry bookkeeping, convention over configuration:
|
|
239
|
+
|
|
240
|
+
| Scope (highest wins) | Directory |
|
|
241
|
+
|---|---|
|
|
242
|
+
| project | `<root>/.AgentWorkShop/commands/` |
|
|
243
|
+
| user | `~/.AgentWorkShop/commands/` |
|
|
244
|
+
| built-in | packaged with the CLI (`cli/commands/`) |
|
|
245
|
+
|
|
246
|
+
`aw register <file|url|npm:pkg>` copies a command into the right scope (`--global` for user scope); `aw help` lists everything that's registered.
|
|
247
|
+
|
|
248
|
+
```js
|
|
249
|
+
// ~/.AgentWorkShop/commands/hello.mjs
|
|
250
|
+
export const meta = { name: 'hello', group: 'Custom', summary: 'Say hi', usage: 'aw hello [--name <n>]' }
|
|
251
|
+
export async function run(argv, ctx) {
|
|
252
|
+
console.log(`Hi ${argv.flags.name ?? 'AW'} — mode: ${ctx.mode}`)
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## The industrial stack in detail
|
|
259
|
+
|
|
260
|
+
### Data acquisition (DAQ)
|
|
261
|
+
|
|
262
|
+
- **Per-node edge runtimes**: independent sampling cadence, publish cadence, in-flight mutex per node — one slow driver never blocks its neighbors.
|
|
263
|
+
- **Pipeline**: driver → queue (in-process or MQTT, offline buffer on disconnect) → consumer with out-of-order defense → three-way fan-out: WS live push (gated), TSDB batch write, device-twin writeback.
|
|
264
|
+
- **Robustness**: TSDB single-in-flight writes with bounded retries, buffer backpressure with drop counters, real loss metrics exposed on `daq.controller` frames.
|
|
265
|
+
- **Alarms**: recipe-scoped monitoring windows with **2 % hysteresis + 3-tick debounce**; alarm/offline transitions are instant (safety first).
|
|
266
|
+
|
|
267
|
+
### Write control (DCW)
|
|
268
|
+
|
|
269
|
+
- Engineering-unit writes: `linear` calibration (scale/offset) PLC↔physical, **readback verification** with deadband tolerance, ACK states and write history.
|
|
270
|
+
- **Interlock**: with a line running, the active recipe's parameter window *replaces* the node's global safe range for that node.
|
|
271
|
+
- **HITL**: `manual`-mode bindings suspend the write for user approval (deduped per agent+node; re-validation at approval time — permission is re-checked when you click approve).
|
|
272
|
+
|
|
273
|
+
### Recipe & batch
|
|
274
|
+
|
|
275
|
+
`Line → Product → Recipe → Run`. Starting a run applies recipe params node-by-node (each write verified), gates acquisition per line, and tags every sample with `line/product/recipe/run` — per-product data isolation with five-dimension queries (line × product × recipe × time × node).
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## Usage
|
|
280
|
+
|
|
281
|
+
### Authentication
|
|
282
|
+
|
|
283
|
+
Email + password login issues a **bearer token** (multiple tokens per user, individually revocable).
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# register
|
|
287
|
+
curl -X POST http://localhost:3000/api/users/register \
|
|
288
|
+
-H 'content-type: application/json' \
|
|
289
|
+
-d '{"email":"you@example.com","password":"secret","name":"you"}'
|
|
290
|
+
|
|
291
|
+
# every workshop call
|
|
292
|
+
curl http://localhost:3000/api/workshop/channels \
|
|
293
|
+
-H 'authorization: Bearer <token>'
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Execution modes
|
|
297
|
+
|
|
298
|
+
Prefix the task description (or pick in the composer UI):
|
|
299
|
+
|
|
300
|
+
| Mode | Semantics | Config |
|
|
301
|
+
|---|---|---|
|
|
302
|
+
| `goal` | lead decomposes → workers deliver → **lead judges satisfaction**; unmet → more subtasks; met → parent completes. | `goalCriteria` |
|
|
303
|
+
| `loop` | replay the same task on a fixed interval. | `intervalMs` (default 60 000), `maxIterations` (default ∞) |
|
|
304
|
+
| `pipeline` | ordered stages; stage N+1 consumes stage N's output. | `stages: [{name, description, assigneeId?}]` |
|
|
305
|
+
|
|
306
|
+
### The four entry points
|
|
307
|
+
|
|
308
|
+
| Entry | Endpoint | Audience |
|
|
309
|
+
|---|---|---|
|
|
310
|
+
| **WS** | `/api/workshop/ws?channelId=…` | Dashboards / UI — AEP v1 envelopes, per-channel monotonic `seq`, 5 000-event ring, `lastSeq` resume, snapshot fallback. |
|
|
311
|
+
| **MCP** | in-process server, ~20 tools | Agents (omp host tools) — management + job-face tools, channel-scoped. |
|
|
312
|
+
| **A2A** | `POST /api/workshop/a2a/:agentId/rpc` | External agents — JSON-RPC 2.0, `AgentCard` at `/card`, `tasks/sendSubscribe` SSE. |
|
|
313
|
+
| **REST** | `/api/workshop/**` | Humans / scripts — full management face. |
|
|
314
|
+
|
|
315
|
+
### Task state machine
|
|
316
|
+
|
|
317
|
+
```
|
|
318
|
+
SUBMITTED ─▶ ASSIGNED ─▶ WORKING ─▶ WAITING ─▶ COMPLETED
|
|
319
|
+
│ │ │ │
|
|
320
|
+
└────────────┴───────────┴──▶ CANCELED / FAILED ─▶ (retry ≤ 3 or cancel)
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Verified end-to-end
|
|
326
|
+
|
|
327
|
+
The repo ships live E2E that exercises the full loop against a running server — the numbers below are from an actual run:
|
|
328
|
+
|
|
329
|
+
| Check | Result |
|
|
330
|
+
|---|---|
|
|
331
|
+
| Line start → recipe writes setpoint (180 °C) | ✅ |
|
|
332
|
+
| Interlock: write 170 (<176) and 200 (>188) → **400 rejected** | ✅ |
|
|
333
|
+
| Team deploy → goal dispatch (lead → omp worker) | ✅ t + 3 s |
|
|
334
|
+
| Worker reads real history: **mean 168.05 °C, 96 samples, min/max/latest** | ✅ |
|
|
335
|
+
| HITL approval → setpoint **180 → 182 °C** written & read back | ✅ |
|
|
336
|
+
| Goal closes with structured summary | ✅ |
|
|
337
|
+
| Batch tagging: samples carry product/recipe/run | ✅ |
|
|
338
|
+
|
|
339
|
+
Reproduce: `node scripts/_dbg-full-feature-e2e.mjs` (against a running server).
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## Project layout
|
|
344
|
+
|
|
345
|
+
```
|
|
346
|
+
AgentWorkShop/
|
|
347
|
+
├── bin/ · cli/ # aw CLI — command registry · built-in commands · config engine
|
|
348
|
+
├── app/ # Nuxt 4 frontend (srcDir)
|
|
349
|
+
│ ├── pages/ # / · /workshop · /town · /daq · /dcw · /monitor · /users · /tokens
|
|
350
|
+
│ ├── components/workshop/ # timeline · lanes · task board · memory panel · 3D town
|
|
351
|
+
│ └── stores/composables/ # Pinia + AEP client
|
|
352
|
+
├── server/
|
|
353
|
+
│ ├── api/ # REST + WS + A2A + MCP routes
|
|
354
|
+
│ ├── services/workshop/
|
|
355
|
+
│ │ ├── runtime/ # manager · scheduler-loop · task-engine · memory · mailbox
|
|
356
|
+
│ │ ├── agents/ # AgentInterface: mock · omp · claude (+ industrial tools)
|
|
357
|
+
│ │ ├── daq/ dcw/ # edge runtimes · drivers · bus · storage
|
|
358
|
+
│ │ └── db/ # repos over node:sqlite
|
|
359
|
+
│ ├── mcp/ # MCP server (tools)
|
|
360
|
+
│ └── plugins/ # runtime assembly (singletons)
|
|
361
|
+
├── shared/
|
|
362
|
+
│ └── config/ # schema.json (settings descriptors) + engine (merge/validate/persist) + mode/path resolver
|
|
363
|
+
├── config.yml # ⚙ single source of truth (factory defaults)
|
|
364
|
+
├── .AgentWorkShop/ # config root — prompts (versioned) + runtime overrides · data · logs · commands (git-ignored)
|
|
365
|
+
├── data/ # legacy pre-migration location (auto-migrated into the config root)
|
|
366
|
+
└── scripts/ # launchers · home bootstrap · E2E · verification suites
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
## Tech stack
|
|
370
|
+
|
|
371
|
+
| Layer | Tech |
|
|
372
|
+
|---|---|
|
|
373
|
+
| Framework | [Nuxt 4](https://nuxt.com) + Nitro (WebSocket) |
|
|
374
|
+
| UI | Vue 3.5 · Pinia · Ant Design Vue · UnoCSS · Three.js · ECharts |
|
|
375
|
+
| Language | TypeScript 5.7 across the stack; `shared/` used by both sides |
|
|
376
|
+
| CLI | Node ESM CLI with a pluggable command registry (`bin/aw.mjs`) |
|
|
377
|
+
| Persistence | `node:sqlite` (zero native deps) + FTS5 + optional `sqlite-vec`; TimescaleDB for time-series |
|
|
378
|
+
| Validation | `zod` at every message boundary |
|
|
379
|
+
| Interop | `@modelcontextprotocol/sdk` · A2A (JSON-RPC 2.0) · AEP v1 (in-house WS protocol) |
|
|
380
|
+
| Field bus | `modbus-serial` · `node-opcua` · `mqtt` |
|
|
381
|
+
|
|
382
|
+
## Development
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
pnpm dev # dev server (port from effective config)
|
|
386
|
+
pnpm aw … # the CLI is available in-repo too: pnpm aw config list
|
|
387
|
+
pnpm build && pnpm start
|
|
388
|
+
pnpm typecheck
|
|
389
|
+
pnpm lint
|
|
390
|
+
node scripts/_dbg-full-feature-e2e.mjs # full-feature live E2E (server must be running)
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
## Roadmap
|
|
394
|
+
|
|
395
|
+
| Capability | Status |
|
|
396
|
+
|---|---|
|
|
397
|
+
| Channel runtime, lead orchestration, 7-state task engine | Shipped |
|
|
398
|
+
| Four entry points: WS (AEP v1) · MCP · A2A · REST | Shipped |
|
|
399
|
+
| Persistent memory (FTS5 + optional vector hybrid) | Shipped |
|
|
400
|
+
| Industrial stack: DAQ · DCW write control · lines/recipes/runs | Shipped |
|
|
401
|
+
| Agent ↔ node binding + HITL approval + interlock | Shipped |
|
|
402
|
+
| 3D digital-twin town · line operations UI · dashboards | Shipped |
|
|
403
|
+
| Full-feature live E2E (agent reads/writes a real line, 23 checks) | Shipped |
|
|
404
|
+
| Runtime configuration system: settings persistence · hot reload · settings UI | Shipped |
|
|
405
|
+
| `aw` CLI: config · run · init · register · doctor | Shipped |
|
|
406
|
+
| Claude Agent SDK adapter — full parity with `mock`/`omp` | In progress |
|
|
407
|
+
| Production hardening: TLS, MQTT auth, OPC UA sign+encrypt defaults, structured audit log | Planned |
|
|
408
|
+
| Edge deployment shape: standalone edge-agent + central broker | Planned |
|
|
409
|
+
| Alarm outbound delivery (email/webhook) + ack workflow | Planned |
|
|
410
|
+
| CI pipeline (typecheck + lint + e2e) | Planned |
|
|
411
|
+
| License: PolyForm Noncommercial 1.0.0 (source-available, non-commercial) | Shipped |
|
|
412
|
+
|
|
413
|
+
## License
|
|
414
|
+
|
|
415
|
+
AgentWorkShop is an independent project and is **not an official product of Anthropic** or any LLM vendor. It integrates with agent harnesses (e.g. `omp`) through their public interfaces.
|
|
416
|
+
|
|
417
|
+
**AgentWorkShop is source-available software, licensed under the [PolyForm Noncommercial 1.0.0](./LICENSE).**
|
|
418
|
+
|
|
419
|
+
- ✅ **Permitted** — personal study, research, hobby projects, teaching, and use by noncommercial organizations (charities, education, public research, government).
|
|
420
|
+
- ❌ **Not permitted without prior written permission** — any **commercial use**: selling, paid services, integrating into commercial products, or production use serving a business. Commercial licenses are available from the copyright holder.
|
|
421
|
+
- 📌 When you redistribute the software, you must pass through the `Required Notice` line and these terms.
|
|
422
|
+
|
|
423
|
+
For commercial licensing, contact: [GitHub @kingdol666](https://github.com/kingdol666) · kingdol6080@gmail.com
|
|
424
|
+
|
|
425
|
+
<div align="center">
|
|
426
|
+
|
|
427
|
+
<a href="https://star-history.com/#kingdol666/AgentWorkShop&Date">
|
|
428
|
+
<picture>
|
|
429
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=kingdol666/AgentWorkShop&type=Date&theme=dark" />
|
|
430
|
+
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=kingdol666/AgentWorkShop&type=Date" />
|
|
431
|
+
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=kingdol666/AgentWorkShop&type=Date" width="80%" />
|
|
432
|
+
</picture>
|
|
433
|
+
</a>
|
|
434
|
+
|
|
435
|
+
</div>
|