@jaimevalasek/aioson 1.4.0 → 1.5.1

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.
Files changed (199) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/LICENSE +661 -21
  3. package/README.md +3 -1
  4. package/docs/en/squad-dashboard.md +372 -0
  5. package/docs/openclaw-bridge.md +308 -0
  6. package/docs/pt/agentes.md +124 -10
  7. package/docs/pt/cenarios.md +46 -2
  8. package/docs/pt/comandos-cli.md +60 -1
  9. package/docs/pt/inicio-rapido.md +18 -2
  10. package/docs/pt/squad-dashboard.md +373 -0
  11. package/docs/testing/genome-2.0-matrix.md +5 -5
  12. package/docs/testing/genome-2.0-rollout.md +9 -9
  13. package/package.json +2 -2
  14. package/src/backup-local.js +74 -0
  15. package/src/cli.js +98 -0
  16. package/src/commands/backup-local-cmd.js +25 -0
  17. package/src/commands/runtime.js +242 -0
  18. package/src/commands/setup-context.js +7 -2
  19. package/src/commands/squad-daemon.js +209 -0
  20. package/src/commands/squad-dashboard.js +39 -0
  21. package/src/commands/squad-deploy.js +64 -0
  22. package/src/commands/squad-doctor.js +52 -0
  23. package/src/commands/squad-mcp.js +270 -0
  24. package/src/commands/squad-processes.js +56 -0
  25. package/src/commands/squad-recovery.js +42 -0
  26. package/src/commands/squad-roi.js +291 -0
  27. package/src/commands/squad-score.js +250 -0
  28. package/src/commands/squad-status.js +37 -1
  29. package/src/commands/squad-validate.js +62 -1
  30. package/src/commands/squad-webhook.js +160 -0
  31. package/src/commands/squad-worker.js +191 -0
  32. package/src/commands/squad-worktrees.js +75 -0
  33. package/src/commands/web-map.js +70 -0
  34. package/src/commands/web-scrape.js +71 -0
  35. package/src/constants.js +8 -0
  36. package/src/context-writer.js +45 -1
  37. package/src/i18n/messages/en.js +127 -1
  38. package/src/i18n/messages/es.js +117 -0
  39. package/src/i18n/messages/fr.js +117 -0
  40. package/src/i18n/messages/pt-BR.js +126 -1
  41. package/src/lib/webhook-server.js +328 -0
  42. package/src/mcp-connectors/registry.js +602 -0
  43. package/src/runtime-store.js +259 -2
  44. package/src/squad/external-session.js +180 -0
  45. package/src/squad/inter-squad.js +74 -0
  46. package/src/squad/recovery-context.js +201 -0
  47. package/src/squad/worktree-manager.js +114 -0
  48. package/src/squad-daemon.js +490 -0
  49. package/src/squad-dashboard/api.js +223 -0
  50. package/src/squad-dashboard/attachment-handler.js +93 -0
  51. package/src/squad-dashboard/context-monitor.js +157 -0
  52. package/src/squad-dashboard/execution-logs.js +115 -0
  53. package/src/squad-dashboard/hunk-review.js +209 -0
  54. package/src/squad-dashboard/metrics.js +133 -0
  55. package/src/squad-dashboard/process-monitor.js +125 -0
  56. package/src/squad-dashboard/renderer.js +858 -0
  57. package/src/squad-dashboard/server.js +232 -0
  58. package/src/squad-dashboard/styles.js +525 -0
  59. package/src/squad-dashboard/token-tracker.js +99 -0
  60. package/src/web.js +284 -0
  61. package/src/worker-runner.js +339 -0
  62. package/template/.aioson/agents/analyst.md +4 -0
  63. package/template/.aioson/agents/architect.md +4 -0
  64. package/template/.aioson/agents/dev.md +120 -11
  65. package/template/.aioson/agents/deyvin.md +8 -0
  66. package/template/.aioson/agents/neo.md +152 -0
  67. package/template/.aioson/agents/orache.md +17 -0
  68. package/template/.aioson/agents/orchestrator.md +26 -0
  69. package/template/.aioson/agents/product.md +60 -12
  70. package/template/.aioson/agents/qa.md +1 -0
  71. package/template/.aioson/agents/setup.md +63 -19
  72. package/template/.aioson/agents/sheldon.md +603 -0
  73. package/template/.aioson/agents/squad.md +191 -0
  74. package/template/.aioson/agents/tester.md +254 -0
  75. package/template/.aioson/agents/ux-ui.md +12 -0
  76. package/template/.aioson/config.md +6 -0
  77. package/template/.aioson/locales/en/agents/analyst.md +8 -0
  78. package/template/.aioson/locales/en/agents/architect.md +8 -0
  79. package/template/.aioson/locales/en/agents/dev.md +66 -7
  80. package/template/.aioson/locales/en/agents/deyvin.md +8 -0
  81. package/template/.aioson/locales/en/agents/neo.md +8 -0
  82. package/template/.aioson/locales/en/agents/orchestrator.md +26 -0
  83. package/template/.aioson/locales/en/agents/qa.md +49 -0
  84. package/template/.aioson/locales/en/agents/setup.md +2 -1
  85. package/template/.aioson/locales/en/agents/sheldon.md +340 -0
  86. package/template/.aioson/locales/en/agents/ux-ui.md +8 -0
  87. package/template/.aioson/locales/es/agents/analyst.md +8 -0
  88. package/template/.aioson/locales/es/agents/architect.md +8 -0
  89. package/template/.aioson/locales/es/agents/dev.md +66 -7
  90. package/template/.aioson/locales/es/agents/deyvin.md +8 -0
  91. package/template/.aioson/locales/es/agents/neo.md +48 -0
  92. package/template/.aioson/locales/es/agents/orchestrator.md +26 -0
  93. package/template/.aioson/locales/es/agents/qa.md +26 -0
  94. package/template/.aioson/locales/es/agents/setup.md +2 -1
  95. package/template/.aioson/locales/es/agents/sheldon.md +192 -0
  96. package/template/.aioson/locales/es/agents/squad.md +63 -0
  97. package/template/.aioson/locales/es/agents/ux-ui.md +8 -0
  98. package/template/.aioson/locales/fr/agents/analyst.md +8 -0
  99. package/template/.aioson/locales/fr/agents/architect.md +8 -0
  100. package/template/.aioson/locales/fr/agents/dev.md +66 -7
  101. package/template/.aioson/locales/fr/agents/deyvin.md +8 -0
  102. package/template/.aioson/locales/fr/agents/neo.md +48 -0
  103. package/template/.aioson/locales/fr/agents/orchestrator.md +26 -0
  104. package/template/.aioson/locales/fr/agents/qa.md +26 -0
  105. package/template/.aioson/locales/fr/agents/setup.md +2 -1
  106. package/template/.aioson/locales/fr/agents/sheldon.md +192 -0
  107. package/template/.aioson/locales/fr/agents/squad.md +63 -0
  108. package/template/.aioson/locales/fr/agents/ux-ui.md +8 -0
  109. package/template/.aioson/locales/pt-BR/agents/analyst.md +19 -0
  110. package/template/.aioson/locales/pt-BR/agents/architect.md +19 -0
  111. package/template/.aioson/locales/pt-BR/agents/dev.md +75 -12
  112. package/template/.aioson/locales/pt-BR/agents/deyvin.md +8 -0
  113. package/template/.aioson/locales/pt-BR/agents/neo.md +147 -0
  114. package/template/.aioson/locales/pt-BR/agents/orchestrator.md +26 -0
  115. package/template/.aioson/locales/pt-BR/agents/product.md +8 -3
  116. package/template/.aioson/locales/pt-BR/agents/qa.md +60 -0
  117. package/template/.aioson/locales/pt-BR/agents/setup.md +2 -1
  118. package/template/.aioson/locales/pt-BR/agents/sheldon.md +192 -0
  119. package/template/.aioson/locales/pt-BR/agents/squad.md +105 -0
  120. package/template/.aioson/locales/pt-BR/agents/ux-ui.md +8 -0
  121. package/template/.aioson/schemas/squad-blueprint.schema.json +21 -0
  122. package/template/.aioson/schemas/squad-manifest.schema.json +178 -1
  123. package/template/.aioson/skills/design/bold-editorial-ui/SKILL.md +205 -0
  124. package/template/.aioson/skills/design/bold-editorial-ui/references/art-direction.md +338 -0
  125. package/template/.aioson/skills/design/bold-editorial-ui/references/components.md +977 -0
  126. package/template/.aioson/skills/design/bold-editorial-ui/references/dashboards.md +218 -0
  127. package/template/.aioson/skills/design/bold-editorial-ui/references/design-tokens.md +326 -0
  128. package/template/.aioson/skills/design/bold-editorial-ui/references/motion.md +461 -0
  129. package/template/.aioson/skills/design/bold-editorial-ui/references/patterns.md +293 -0
  130. package/template/.aioson/skills/design/bold-editorial-ui/references/websites.md +352 -0
  131. package/template/.aioson/skills/design/clean-saas-ui/SKILL.md +210 -0
  132. package/template/.aioson/skills/design/clean-saas-ui/references/art-direction.md +319 -0
  133. package/template/.aioson/skills/design/clean-saas-ui/references/components.md +365 -0
  134. package/template/.aioson/skills/design/clean-saas-ui/references/dashboards.md +196 -0
  135. package/template/.aioson/skills/design/clean-saas-ui/references/design-tokens.md +244 -0
  136. package/template/.aioson/skills/design/clean-saas-ui/references/motion.md +235 -0
  137. package/template/.aioson/skills/design/clean-saas-ui/references/patterns.md +215 -0
  138. package/template/.aioson/skills/design/clean-saas-ui/references/websites.md +295 -0
  139. package/template/.aioson/skills/design/cognitive-core-ui/SKILL.md +55 -9
  140. package/template/.aioson/skills/design/cognitive-core-ui/references/art-direction.md +339 -0
  141. package/template/.aioson/skills/design/cognitive-core-ui/references/components.md +1 -1
  142. package/template/.aioson/skills/design/cognitive-core-ui/references/dashboards.md +100 -0
  143. package/template/.aioson/skills/design/cognitive-core-ui/references/design-tokens.md +43 -9
  144. package/template/.aioson/skills/design/cognitive-core-ui/references/motion.md +40 -0
  145. package/template/.aioson/skills/design/cognitive-core-ui/references/patterns.md +1 -1
  146. package/template/.aioson/skills/design/cognitive-core-ui/references/websites.md +99 -12
  147. package/template/.aioson/skills/design/warm-craft-ui/SKILL.md +209 -0
  148. package/template/.aioson/skills/design/warm-craft-ui/references/art-direction.md +324 -0
  149. package/template/.aioson/skills/design/warm-craft-ui/references/components.md +508 -0
  150. package/template/.aioson/skills/design/warm-craft-ui/references/dashboards.md +223 -0
  151. package/template/.aioson/skills/design/warm-craft-ui/references/design-tokens.md +374 -0
  152. package/template/.aioson/skills/design/warm-craft-ui/references/motion.md +356 -0
  153. package/template/.aioson/skills/design/warm-craft-ui/references/patterns.md +288 -0
  154. package/template/.aioson/skills/design/warm-craft-ui/references/websites.md +289 -0
  155. package/template/.aioson/skills/premium-visual-design/SKILL.md +83 -0
  156. package/template/.aioson/skills/premium-visual-design/components/agent-badge.md +92 -0
  157. package/template/.aioson/skills/premium-visual-design/components/dependency-node.md +102 -0
  158. package/template/.aioson/skills/premium-visual-design/components/mention-autocomplete.md +136 -0
  159. package/template/.aioson/skills/premium-visual-design/components/notification-center.md +136 -0
  160. package/template/.aioson/skills/premium-visual-design/components/review-action-bar.md +188 -0
  161. package/template/.aioson/skills/premium-visual-design/components/team-switcher.md +131 -0
  162. package/template/.aioson/skills/premium-visual-design/patterns/agent-message-thread.md +198 -0
  163. package/template/.aioson/skills/premium-visual-design/patterns/notification-panel.md +275 -0
  164. package/template/.aioson/skills/premium-visual-design/patterns/review-workflow-ui.md +234 -0
  165. package/template/.aioson/skills/premium-visual-design/patterns/task-dependency-graph.md +147 -0
  166. package/template/.aioson/skills/premium-visual-design/tokens/status-extended.md +142 -0
  167. package/template/.aioson/skills/squad/formats/catalog.json +15 -0
  168. package/template/.aioson/skills/squad/formats/content/blog-post.md +47 -0
  169. package/template/.aioson/skills/squad/formats/content/newsletter.md +47 -0
  170. package/template/.aioson/skills/squad/formats/creative/podcast-script.md +43 -0
  171. package/template/.aioson/skills/squad/formats/creative/video-script.md +41 -0
  172. package/template/.aioson/skills/squad/formats/social/instagram-feed.md +42 -0
  173. package/template/.aioson/skills/squad/formats/social/linkedin-post.md +42 -0
  174. package/template/.aioson/skills/squad/formats/social/tiktok.md +39 -0
  175. package/template/.aioson/skills/squad/formats/social/twitter-thread.md +39 -0
  176. package/template/.aioson/skills/squad/formats/social/youtube-long.md +47 -0
  177. package/template/.aioson/skills/squad/formats/social/youtube-shorts.md +39 -0
  178. package/template/.aioson/skills/squad/patterns/multi-platform-pattern.md +108 -0
  179. package/template/.aioson/skills/squad/patterns/persona-based-pattern.md +98 -0
  180. package/template/.aioson/skills/squad/patterns/pipeline-pattern.md +106 -0
  181. package/template/.aioson/skills/squad/patterns/review-loop-pattern.md +81 -0
  182. package/template/.aioson/skills/squad/references/checklist-templates.md +122 -0
  183. package/template/.aioson/skills/squad/references/executor-archetypes.md +123 -0
  184. package/template/.aioson/skills/squad/references/workflow-templates.md +169 -0
  185. package/template/.aioson/skills/static/debugging-protocol.md +42 -0
  186. package/template/.aioson/skills/static/git-worktrees.md +36 -0
  187. package/template/.aioson/tasks/implementation-plan.md +19 -0
  188. package/template/.aioson/tasks/squad-design.md +28 -0
  189. package/template/.aioson/tasks/squad-profile.md +48 -0
  190. package/template/.aioson/tasks/squad-review.md +61 -0
  191. package/template/.aioson/tasks/squad-task-decompose.md +66 -0
  192. package/template/.claude/commands/aioson/agent/neo.md +5 -0
  193. package/template/.claude/commands/aioson/agent/tester.md +5 -0
  194. package/template/.gemini/GEMINI.md +1 -0
  195. package/template/.gemini/commands/aios-neo.toml +4 -0
  196. package/template/.gemini/commands/aios-tester.toml +6 -0
  197. package/template/AGENTS.md +3 -0
  198. package/template/CLAUDE.md +5 -2
  199. package/template/OPENCODE.md +2 -0
package/README.md CHANGED
@@ -229,6 +229,7 @@ See the [Web3 guide](docs/en/web3.md) for the full reference.
229
229
  - [JSON schemas](docs/en/json-schemas.md) — `--json` output contracts for all commands
230
230
  - [AI clients guide (PT-BR)](docs/pt/clientes-ai.md) — tracked usage with Codex, Claude, Gemini, and OpenCode
231
231
  - [Runtime observability (PT-BR)](docs/pt/runtime-observability.md) — `live:start`, `runtime:emit`, `live:handoff`, `live:status`, `live:close`, and dashboard projections
232
+ - [Squad Dashboard](docs/en/squad-dashboard.md) — `squad:dashboard`, real-time monitoring of agents, context, tokens, logs and metrics
232
233
 
233
234
  **Release (internal)**
234
235
  - [Release guide](docs/en/release.md)
@@ -242,6 +243,7 @@ See the [Web3 guide](docs/en/web3.md) for the full reference.
242
243
  - [Cenários de uso](docs/pt/cenarios.md)
243
244
  - [Clientes AI](docs/pt/clientes-ai.md)
244
245
  - [Guia do engenheiro](docs/pt/guia-engineer.md)
246
+ - [Squad Dashboard](docs/pt/squad-dashboard.md) — monitoramento em tempo real de agentes, contexto, tokens, logs e métricas
245
247
 
246
248
  ## MCP bootstrap
247
249
  Generate a local MCP server recommendation file from `project.context.md`:
@@ -268,4 +270,4 @@ aioson mcp:doctor --strict-env
268
270
  - context compatibility for database and Web3 (`chain-rpc`)
269
271
 
270
272
  ## License
271
- MIT
273
+ GNU Affero General Public License v3.0 (`AGPL-3.0-only`)
@@ -0,0 +1,372 @@
1
+ # Squad Dashboard
2
+
3
+ The Squad Dashboard is a web panel built into the aioson CLI itself. It runs locally on the developer's machine and lets you monitor all squads in a project in real time — agents, active processes, context usage, tokens, execution logs, and metrics.
4
+
5
+ No additional installation required. It ships with aioson.
6
+
7
+ ---
8
+
9
+ ## Prerequisites
10
+
11
+ - aioson installed globally (`npm install -g @jaimevalasek/aioson`)
12
+ - At least one squad created in the project (`aioson squad:create`)
13
+ - Node.js ≥ 18 (already required by aioson)
14
+ - A modern browser (Chrome, Firefox, Safari, Edge)
15
+
16
+ ---
17
+
18
+ ## Starting the Dashboard
19
+
20
+ From the project root (where `.aioson/` lives):
21
+
22
+ ```bash
23
+ aioson squad:dashboard
24
+ ```
25
+
26
+ Expected output:
27
+ ```
28
+ Squad Dashboard running at http://localhost:4180 (port 4180)
29
+ Press Ctrl+C to stop.
30
+ ```
31
+
32
+ Open `http://localhost:4180` in your browser. Press `Ctrl+C` in the terminal to shut it down.
33
+
34
+ ---
35
+
36
+ ## Options
37
+
38
+ ```bash
39
+ aioson squad:dashboard [path] [--port=4180] [--squad=<slug>] [--locale=en]
40
+ ```
41
+
42
+ | Option | Default | Description |
43
+ |--------|---------|-------------|
44
+ | `path` | `.` (current directory) | Project root |
45
+ | `--port` | `4180` | HTTP port for the dashboard |
46
+ | `--squad` | — | Open directly on a specific squad page |
47
+ | `--locale` | `en` | Interface language |
48
+
49
+ ---
50
+
51
+ ## Examples
52
+
53
+ ### Start in the current project
54
+ ```bash
55
+ cd ~/projects/dental-clinic
56
+ aioson squad:dashboard
57
+ ```
58
+
59
+ ### Custom port
60
+ ```bash
61
+ aioson squad:dashboard --port=4200
62
+ ```
63
+
64
+ ### Point to another directory
65
+ ```bash
66
+ aioson squad:dashboard /home/user/projects/marketing
67
+ ```
68
+
69
+ ### Open directly on a specific squad
70
+ ```bash
71
+ aioson squad:dashboard --squad=marketing-odonto
72
+ # → Redirects automatically to http://localhost:4180/squad/marketing-odonto
73
+ ```
74
+
75
+ ### Multiple projects at the same time (different ports)
76
+ ```bash
77
+ # Terminal 1
78
+ aioson squad:dashboard ~/projects/clinic --port=4180
79
+
80
+ # Terminal 2
81
+ aioson squad:dashboard ~/projects/ecommerce --port=4181
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Navigating the Dashboard
87
+
88
+ ### Home — Squad List
89
+
90
+ At `http://localhost:4180` you see all squads in the project with:
91
+
92
+ - Name and mode (`content`, `software`, `mixed`)
93
+ - Number of executors (agents)
94
+ - Current status
95
+ - Link to the squad detail page
96
+
97
+ If no squads appear, check that `.aioson/squads/*/squad.manifest.json` exists.
98
+
99
+ ---
100
+
101
+ ### Squad Page — Panels
102
+
103
+ Each squad has its own URL: `http://localhost:4180/squad/{slug}`
104
+
105
+ Available panels depend on squad configuration:
106
+
107
+ #### Panel: Overview
108
+
109
+ Summary of the squad:
110
+ - Total content items produced
111
+ - Number of registered sessions
112
+ - Accumulated learnings
113
+ - Delivery rate
114
+ - Execution plan (if defined)
115
+ - Pipeline information
116
+
117
+ #### Panel: Agents (Processes)
118
+
119
+ Lists active Claude/AI agents:
120
+
121
+ | Column | What it shows |
122
+ |--------|---------------|
123
+ | Agent | Executor slug |
124
+ | PID | OS process ID |
125
+ | Elapsed | Session duration (`HH:MM:SS`) |
126
+ | Context | Context window usage % |
127
+ | URL | Link to open the AI session (if available) |
128
+ | Action | Button to stop the process via SIGTERM |
129
+
130
+ > Process data auto-refreshes every 5 seconds via SSE (Server-Sent Events).
131
+
132
+ #### Panel: Context
133
+
134
+ Context window monitor per agent:
135
+
136
+ - **Visual gauge** showing % usage
137
+ - **Alert level**:
138
+ - Green: 0–84% → Normal
139
+ - Yellow: 85–94% → Warning
140
+ - Red: 95–99% → Critical
141
+ - Purple: 100%+ → Overflow
142
+ - Automatic compact detection (a drop > 30% indicates context was compacted)
143
+ - Breakdown by category (system prompt, conversation history, tool outputs, etc.)
144
+
145
+ #### Panel: Tokens
146
+
147
+ Token usage and estimated cost per agent:
148
+
149
+ - Total tokens consumed in the session
150
+ - Estimated cost in USD (based on Sonnet-class model pricing)
151
+ - **Waste flag**: appears when `tool_outputs > 60%` of total
152
+ - Breakdown by category (input, output, tool_use_input, tool_outputs, cache_write, cache_read)
153
+
154
+ #### Panel: Execution Logs
155
+
156
+ Detailed history of task executions:
157
+
158
+ - Entries filterable by type:
159
+ - `tool_call` — tool calls with input/output
160
+ - `reasoning` — agent reasoning
161
+ - `milestone` — important checkpoints
162
+ - `error` — errors with optional stack trace
163
+ - Timeline ordered by timestamp
164
+ - Filter by session
165
+
166
+ #### Panel: Hunk Review
167
+
168
+ Code review in hunks (for software squads):
169
+
170
+ - List of hunks pending review
171
+ - Available actions: **Approve**, **Reject** (comment required), **Comment**
172
+ - Progress: `approved / rejected / pending / revised`
173
+ - Re-submit: approved hunks keep their status; only rejected ones return to pending
174
+
175
+ #### Panel: Content
176
+
177
+ Content items produced by the squad (for content squads):
178
+
179
+ - List of indexed outputs
180
+ - Type and layout of each item
181
+ - Responsible agent
182
+
183
+ #### Panel: Learnings
184
+
185
+ Learnings accumulated by the squad:
186
+
187
+ - Active, stale, and archived learnings
188
+ - Type: preference, process, domain, quality
189
+ - Confidence: high, medium, low
190
+
191
+ #### Panel: Metrics
192
+
193
+ Custom metrics configured via `aioson squad:roi`:
194
+
195
+ - Current value vs. baseline vs. target
196
+ - Period
197
+ - Visual progress bar
198
+ - Calculated ROI (when configured)
199
+
200
+ #### Panel: Integrations
201
+
202
+ Status of MCPs configured in the squad:
203
+
204
+ - Active connectors (WhatsApp, Telegram, Webhook, etc.)
205
+ - Status: connected / unconfigured / error
206
+ - Total calls and failures
207
+
208
+ #### Panel: Recovery Context
209
+
210
+ Recovery context generated for each agent (post-compact injection):
211
+
212
+ - Content of `recovery-context.md`
213
+ - Token estimate
214
+ - Generation timestamp
215
+
216
+ ---
217
+
218
+ ## Use Cases by Squad Type
219
+
220
+ ### Content Squad (e.g. Dental Clinic Marketing)
221
+
222
+ ```bash
223
+ # The squad is generating Instagram posts and blog content
224
+ aioson squad:dashboard --squad=marketing-odonto
225
+
226
+ # Most relevant panels:
227
+ # → Content: see generated posts
228
+ # → Agents: see copywriter and strategist running
229
+ # → Learnings: accumulated tone and format preferences
230
+ ```
231
+
232
+ ### Software Squad (e.g. Scheduling Feature)
233
+
234
+ ```bash
235
+ aioson squad:dashboard --squad=scheduling-v2
236
+
237
+ # Most relevant panels:
238
+ # → Hunk Review: review code before merging
239
+ # → Logs: follow agent tool_calls
240
+ # → Context: monitor if the agent is near the limit
241
+ ```
242
+
243
+ ### Squad with Workers and Daemon
244
+
245
+ ```bash
246
+ # First start the daemon (automated workers)
247
+ aioson squad:daemon start --squad=clinic
248
+
249
+ # In another terminal, start the dashboard
250
+ aioson squad:dashboard --squad=clinic
251
+
252
+ # Most relevant panels:
253
+ # → Metrics: no-show rate, ROI
254
+ # → Integrations: WhatsApp Business status
255
+ # → Agents: see live processes
256
+ ```
257
+
258
+ ---
259
+
260
+ ## Integration with Other Commands
261
+
262
+ The dashboard reads data generated by other aioson commands. For panels to show rich data:
263
+
264
+ | To see in the dashboard | Command that generates the data |
265
+ |-------------------------|---------------------------------|
266
+ | Metrics and ROI | `aioson squad:roi metric --squad=X` |
267
+ | MCP status | `aioson squad:mcp configure --squad=X` |
268
+ | Active processes | Agents running that write to `.aioson/squads/{slug}/processes/` |
269
+ | Context window | Agents that write to `.aioson/squads/{slug}/context-monitor.json` |
270
+ | Token usage | Agents that write to `.aioson/squads/{slug}/token-usage.json` |
271
+ | Learnings | `aioson squad:learning` and auto-registered sessions |
272
+ | Recovery context | `aioson squad:recovery --squad=X --agent=Y` |
273
+
274
+ ---
275
+
276
+ ## Data Requirements
277
+
278
+ The dashboard works even without all data present. What each panel needs:
279
+
280
+ ```
281
+ .aioson/
282
+ squads/
283
+ {slug}/
284
+ squad.manifest.json ← required (squad appears in the list)
285
+ context-monitor.json ← Context panel
286
+ token-usage.json ← Tokens panel
287
+ processes/
288
+ {agent}.json ← Agents panel
289
+ recovery-context.md ← Recovery panel
290
+ runtime/
291
+ aios.sqlite ← Content, Learnings, Metrics, Integrations panels
292
+ ```
293
+
294
+ If the SQLite database doesn't exist, dependent panels appear empty but the dashboard does not crash.
295
+
296
+ ---
297
+
298
+ ## Squad Dashboard vs. aioson-dashboard
299
+
300
+ | | Squad Dashboard | aioson-dashboard |
301
+ |---|---|---|
302
+ | **What it is** | HTTP server embedded in the CLI | Installable Next.js app (premium) |
303
+ | **How to access** | `aioson squad:dashboard` | Install and run separately |
304
+ | **Focus** | Project squads in real time | General management — projects, genomes, pipelines, cloud |
305
+ | **Port** | `localhost:4180` (configurable) | Defined by the app |
306
+ | **Extra install** | No — ships with aioson | Yes |
307
+ | **Cost** | Free | Premium |
308
+
309
+ When both are running, aioson-dashboard shows an **"Open Squad Dashboard"** button on each squad page, linking directly to the correct URL.
310
+
311
+ ---
312
+
313
+ ## Troubleshooting
314
+
315
+ ### Dashboard won't start — port in use
316
+
317
+ ```
318
+ Port 4180 is already in use. Try --port=<other>
319
+ ```
320
+
321
+ Use a different port:
322
+ ```bash
323
+ aioson squad:dashboard --port=4200
324
+ ```
325
+
326
+ ### No squads on the home page
327
+
328
+ Check that the manifest exists:
329
+ ```bash
330
+ ls .aioson/squads/*/squad.manifest.json
331
+ ```
332
+
333
+ If not, create the squad first:
334
+ ```bash
335
+ aioson squad:create . --squad=my-squad
336
+ ```
337
+
338
+ ### Panels appear empty
339
+
340
+ Normal for new projects or squads without runtime data. Panels populate as agents run and write their data files.
341
+
342
+ ### Process panel stops updating
343
+
344
+ The agents panel uses SSE with a 5-second interval. If it stops updating, refresh the page.
345
+
346
+ ### Command not found after updating aioson in a project
347
+
348
+ The global binary may be outdated:
349
+ ```bash
350
+ npm update -g @jaimevalasek/aioson
351
+ ```
352
+
353
+ ---
354
+
355
+ ## Quick Reference
356
+
357
+ ```bash
358
+ # Start
359
+ aioson squad:dashboard
360
+
361
+ # Custom port
362
+ aioson squad:dashboard --port=4200
363
+
364
+ # Specific squad
365
+ aioson squad:dashboard --squad=my-squad
366
+
367
+ # Project in another directory
368
+ aioson squad:dashboard /path/to/project
369
+
370
+ # Help
371
+ aioson squad:dashboard --help
372
+ ```
@@ -0,0 +1,308 @@
1
+ # OpenClaw + AIOSON Bridge
2
+
3
+ > AIOSON receives external triggers. OpenClaw delivers them. Neither system changes — the bridge is pure configuration.
4
+
5
+ ## Overview
6
+
7
+ ```
8
+ [External channel] [OpenClaw] [AIOSON squad-webhook]
9
+ WhatsApp, Telegram, → gateway de canal → POST /trigger
10
+ Slack, webhook ERP identifica sessão executa squad
11
+
12
+ ← callback HTTP ← POST callback_url
13
+ envia resposta
14
+ ao canal
15
+ ```
16
+
17
+ ## Quick start
18
+
19
+ ### 1. Start the webhook server
20
+
21
+ ```bash
22
+ export AIOSON_WEBHOOK_TOKEN=your-secret-token
23
+ aioson squad:webhook start --port 3210
24
+ ```
25
+
26
+ The server auto-discovers all squads in `.aioson/squads/`. Output:
27
+
28
+ ```
29
+ AIOSON squad webhook server started on port 3210
30
+ Available squads: atendimento, vendas, logistica
31
+ Endpoints: POST /trigger GET /status/:run_id GET /health
32
+ ```
33
+
34
+ ### 2. Generate the OpenClaw configuration
35
+
36
+ ```bash
37
+ aioson squad:webhook config --channel whatsapp --squad atendimento
38
+ ```
39
+
40
+ Copy the output into your `openclaw.json`.
41
+
42
+ ### 3. Verify
43
+
44
+ ```bash
45
+ curl http://localhost:3210/health
46
+ # {"ok":true,"version":"x.x.x","squads":["atendimento","vendas","logistica"]}
47
+ ```
48
+
49
+ ---
50
+
51
+ ## Endpoints
52
+
53
+ ### `GET /health`
54
+
55
+ No authentication required.
56
+
57
+ ```json
58
+ { "ok": true, "version": "1.4.0", "squads": ["atendimento", "vendas"] }
59
+ ```
60
+
61
+ ---
62
+
63
+ ### `POST /trigger`
64
+
65
+ Async squad execution. Returns immediately with a `run_id`.
66
+
67
+ **Headers:**
68
+ ```
69
+ Authorization: Bearer <AIOSON_WEBHOOK_TOKEN>
70
+ Content-Type: application/json
71
+ ```
72
+
73
+ **Body:**
74
+ ```json
75
+ {
76
+ "squad": "atendimento",
77
+ "input": "quero dipirona 500mg",
78
+ "session_id": "wa:5511999000",
79
+ "callback_url": "https://your-server/callback",
80
+ "metadata": {
81
+ "channel": "whatsapp",
82
+ "phone": "+5511999000",
83
+ "user_name": "João"
84
+ }
85
+ }
86
+ ```
87
+
88
+ | Field | Required | Description |
89
+ |----------------|----------|-------------|
90
+ | `squad` | yes | Squad slug to execute |
91
+ | `input` | yes | User message |
92
+ | `session_id` | no | Opaque string — enables conversation continuity |
93
+ | `callback_url` | no | Where to POST the response when done |
94
+ | `metadata` | no | Arbitrary key/value, echoed back in the callback |
95
+
96
+ **Response (202):**
97
+ ```json
98
+ { "run_id": "a1b2c3d4e5f6a7b8", "status": "queued" }
99
+ ```
100
+
101
+ **Callback payload (async POST to `callback_url`):**
102
+ ```json
103
+ {
104
+ "run_id": "a1b2c3d4e5f6a7b8",
105
+ "session_id": "wa:5511999000",
106
+ "response": "Temos dipirona 500mg por R$8,90. Deseja adicionar ao carrinho?",
107
+ "status": "completed",
108
+ "metadata": { "channel": "whatsapp", "phone": "+5511999000", "user_name": "João" }
109
+ }
110
+ ```
111
+
112
+ Callback delivery: 3 retries with exponential backoff (30s → 60s → 120s).
113
+
114
+ ---
115
+
116
+ ### `GET /status/:run_id`
117
+
118
+ Poll execution state when no `callback_url` was provided.
119
+
120
+ ```
121
+ GET /status/a1b2c3d4e5f6a7b8
122
+ Authorization: Bearer <token>
123
+ ```
124
+
125
+ ```json
126
+ {
127
+ "run_id": "a1b2c3d4e5f6a7b8",
128
+ "status": "running",
129
+ "response": null,
130
+ "error": null
131
+ }
132
+ ```
133
+
134
+ `status` values: `queued` → `running` → `completed` | `failed`
135
+
136
+ ---
137
+
138
+ ### `POST /query`
139
+
140
+ Synchronous query — for fast lookups that don't need a full squad session (e.g., product search from a website). Timeout: 10 seconds.
141
+
142
+ ```json
143
+ {
144
+ "squad": "catalogo",
145
+ "query": "dipirona 500mg",
146
+ "max_results": 10
147
+ }
148
+ ```
149
+
150
+ ```json
151
+ {
152
+ "results": [{ "id": 42, "name": "Dipirona 500mg", "price": 8.90 }],
153
+ "squad": "catalogo",
154
+ "latency_ms": 340
155
+ }
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Session continuity
161
+
162
+ When `session_id` is provided, AIOSON maintains conversation history across multiple calls.
163
+
164
+ **First call:**
165
+ ```json
166
+ { "squad": "atendimento", "input": "quero dipirona", "session_id": "wa:5511999000" }
167
+ ```
168
+ → Squad receives: `quero dipirona`
169
+
170
+ **Second call (same session):**
171
+ ```json
172
+ { "squad": "atendimento", "input": "qual o preço?", "session_id": "wa:5511999000" }
173
+ ```
174
+ → Squad receives:
175
+ ```
176
+ [Conversation history]
177
+ user: quero dipirona
178
+ assistant: Temos dipirona 500mg por R$8,90. Deseja adicionar ao carrinho?
179
+
180
+ [Current message]
181
+ qual o preço?
182
+ ```
183
+
184
+ Session files are stored in `.aioson/sessions/` and expire after 24 hours of inactivity (configurable via `AIOSON_SESSION_TTL_HOURS`).
185
+
186
+ ---
187
+
188
+ ## OpenClaw configuration
189
+
190
+ ### WhatsApp (full example)
191
+
192
+ ```yaml
193
+ # openclaw.json
194
+ hooks:
195
+ whatsapp:
196
+ auto_reply:
197
+ - pattern: ".*"
198
+ action: webhook
199
+ url: "http://localhost:3210/trigger"
200
+ headers:
201
+ Authorization: "Bearer ${AIOSON_WEBHOOK_TOKEN}"
202
+ body_template: |
203
+ {
204
+ "squad": "atendimento",
205
+ "input": "{{message.text}}",
206
+ "session_id": "wa:{{message.from}}",
207
+ "callback_url": "{{openclaw.callback_url}}",
208
+ "metadata": {
209
+ "channel": "whatsapp",
210
+ "phone": "{{message.from}}",
211
+ "user_name": "{{message.contact_name}}"
212
+ }
213
+ }
214
+ ```
215
+
216
+ ### Telegram
217
+
218
+ ```yaml
219
+ hooks:
220
+ telegram:
221
+ auto_reply:
222
+ - pattern: ".*"
223
+ action: webhook
224
+ url: "http://localhost:3210/trigger"
225
+ headers:
226
+ Authorization: "Bearer ${AIOSON_WEBHOOK_TOKEN}"
227
+ body_template: |
228
+ {
229
+ "squad": "suporte",
230
+ "input": "{{message.text}}",
231
+ "session_id": "tg:{{message.chat_id}}",
232
+ "callback_url": "{{openclaw.callback_url}}",
233
+ "metadata": { "channel": "telegram" }
234
+ }
235
+ ```
236
+
237
+ ### Multiple squads by intent
238
+
239
+ Route different message patterns to different squads:
240
+
241
+ ```yaml
242
+ hooks:
243
+ whatsapp:
244
+ auto_reply:
245
+ - pattern: "^(pedido|comprar|quero|carrinho)"
246
+ action: webhook
247
+ url: "http://localhost:3210/trigger"
248
+ headers:
249
+ Authorization: "Bearer ${AIOSON_WEBHOOK_TOKEN}"
250
+ body_template: |
251
+ { "squad": "vendas", "input": "{{message.text}}", "session_id": "wa:{{message.from}}", "callback_url": "{{openclaw.callback_url}}" }
252
+
253
+ - pattern: "^(onde|entrega|rastreio|pedido)"
254
+ action: webhook
255
+ url: "http://localhost:3210/trigger"
256
+ headers:
257
+ Authorization: "Bearer ${AIOSON_WEBHOOK_TOKEN}"
258
+ body_template: |
259
+ { "squad": "logistica", "input": "{{message.text}}", "session_id": "wa:{{message.from}}", "callback_url": "{{openclaw.callback_url}}" }
260
+
261
+ - pattern: ".*"
262
+ action: webhook
263
+ url: "http://localhost:3210/trigger"
264
+ headers:
265
+ Authorization: "Bearer ${AIOSON_WEBHOOK_TOKEN}"
266
+ body_template: |
267
+ { "squad": "atendimento", "input": "{{message.text}}", "session_id": "wa:{{message.from}}", "callback_url": "{{openclaw.callback_url}}" }
268
+ ```
269
+
270
+ ---
271
+
272
+ ## Security
273
+
274
+ | Concern | Mechanism |
275
+ |---------|-----------|
276
+ | Authentication | Bearer token (`AIOSON_WEBHOOK_TOKEN`) on all endpoints except `/health` |
277
+ | Rate limiting | 60 req/min per IP by default |
278
+ | Squad allowlist | Only squads in `.aioson/squads/` are accessible |
279
+ | Callback security | Callbacks only POST to URLs provided by the caller |
280
+ | Session isolation | Each `session_id` maps to a separate file; no cross-session access |
281
+
282
+ Set `AIOSON_WEBHOOK_TOKEN` to a random secret (minimum 32 chars):
283
+
284
+ ```bash
285
+ openssl rand -hex 32
286
+ ```
287
+
288
+ ---
289
+
290
+ ## Environment variables
291
+
292
+ | Variable | Default | Description |
293
+ |----------|---------|-------------|
294
+ | `AIOSON_WEBHOOK_TOKEN` | — | Bearer token (required for security) |
295
+ | `AIOSON_WEBHOOK_PORT` | `3210` | Server port |
296
+ | `AIOSON_SESSION_TTL_HOURS` | `24` | Session expiry in hours |
297
+
298
+ ---
299
+
300
+ ## CLI reference
301
+
302
+ ```bash
303
+ # Start webhook server
304
+ aioson squad:webhook start [path] [--port 3210] [--token TOKEN]
305
+
306
+ # Generate OpenClaw config snippet
307
+ aioson squad:webhook config [--channel whatsapp] [--squad atendimento] [--port 3210]
308
+ ```