@newsails/veil-cli 1.0.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.
- package/.veil/agents/analyst/AGENT.md +21 -0
- package/.veil/agents/analyst/agent.json +23 -0
- package/.veil/agents/assistant/AGENT.md +15 -0
- package/.veil/agents/assistant/agent.json +19 -0
- package/.veil/agents/coder/AGENT.md +18 -0
- package/.veil/agents/coder/agent.json +19 -0
- package/.veil/agents/hello/AGENT.md +5 -0
- package/.veil/agents/hello/agent.json +13 -0
- package/.veil/agents/writer/AGENT.md +12 -0
- package/.veil/agents/writer/agent.json +17 -0
- package/.veil/memory/MEMORY.md +343 -0
- package/.veil/memory/agents/analyst/MEMORY.md +55 -0
- package/.veil/memory/agents/hello/MEMORY.md +12 -0
- package/.veil/runtime.pid +1 -0
- package/.veil/settings.json +10 -0
- package/.veil-studio/studio.db +0 -0
- package/.veil-studio/studio.db-shm +0 -0
- package/.veil-studio/studio.db-wal +0 -0
- package/PLAN/01-vision.md +26 -0
- package/PLAN/02-tech-stack.md +94 -0
- package/PLAN/03-agents.md +232 -0
- package/PLAN/04-runtime.md +171 -0
- package/PLAN/05-tools.md +211 -0
- package/PLAN/06-communication.md +243 -0
- package/PLAN/07-storage.md +218 -0
- package/PLAN/08-api-cli.md +153 -0
- package/PLAN/09-permissions.md +108 -0
- package/PLAN/10-ably.md +105 -0
- package/PLAN/11-file-formats.md +442 -0
- package/PLAN/12-folder-structure.md +205 -0
- package/PLAN/13-operations.md +212 -0
- package/PLAN/README.md +23 -0
- package/README.md +128 -0
- package/REPORT.md +174 -0
- package/TODO.md +45 -0
- package/ai-tests/FRONTEND_PROMPT.md +220 -0
- package/ai-tests/Research & Planning.md +814 -0
- package/ai-tests/prompt-001-basic-api.md +230 -0
- package/ai-tests/prompt-002-basic-flows.md +230 -0
- package/ai-tests/prompt-003-agent-behaviors.md +220 -0
- package/api/middleware.js +60 -0
- package/api/routes/agents.js +193 -0
- package/api/routes/chat.js +93 -0
- package/api/routes/completions.js +122 -0
- package/api/routes/daemons.js +80 -0
- package/api/routes/memory.js +169 -0
- package/api/routes/models.js +40 -0
- package/api/routes/remote-methods.js +74 -0
- package/api/routes/sessions.js +208 -0
- package/api/routes/settings.js +108 -0
- package/api/routes/system.js +50 -0
- package/api/routes/tasks.js +270 -0
- package/api/server.js +120 -0
- package/cli/formatter.js +70 -0
- package/cli/index.js +443 -0
- package/cli/parser.js +113 -0
- package/config/config.json +10 -0
- package/config/models.json +6826 -0
- package/core/agent.js +329 -0
- package/core/cancel.js +38 -0
- package/core/compaction.js +176 -0
- package/core/events.js +13 -0
- package/core/loop.js +564 -0
- package/core/memory.js +51 -0
- package/core/prompt.js +185 -0
- package/core/queue.js +96 -0
- package/core/registry.js +291 -0
- package/core/remote-methods.js +124 -0
- package/core/router.js +386 -0
- package/core/running-sessions.js +18 -0
- package/docs/api/01-system.md +84 -0
- package/docs/api/02-agents.md +374 -0
- package/docs/api/03-chat.md +269 -0
- package/docs/api/04-tasks.md +470 -0
- package/docs/api/05-sessions.md +444 -0
- package/docs/api/06-daemons.md +142 -0
- package/docs/api/07-memory.md +186 -0
- package/docs/api/08-settings.md +133 -0
- package/docs/api/09-models.md +119 -0
- package/docs/api/09-websocket.md +350 -0
- package/docs/api/10-completions.md +134 -0
- package/docs/api/README.md +116 -0
- package/docs/guide/01-quickstart.md +220 -0
- package/docs/guide/02-folder-structure.md +185 -0
- package/docs/guide/03-configuration.md +252 -0
- package/docs/guide/04-agents.md +267 -0
- package/docs/guide/05-cli.md +290 -0
- package/docs/guide/06-tools.md +643 -0
- package/docs/guide/07-permissions.md +236 -0
- package/docs/guide/08-memory.md +139 -0
- package/docs/guide/09-multi-agent.md +271 -0
- package/docs/guide/10-daemons.md +226 -0
- package/docs/guide/README.md +53 -0
- package/docs/index.html +623 -0
- package/examples/README.md +151 -0
- package/examples/agents/assistant/AGENT.md +31 -0
- package/examples/agents/assistant/SOUL.md +9 -0
- package/examples/agents/assistant/agent.json +74 -0
- package/examples/agents/hello/AGENT.md +15 -0
- package/examples/agents/hello/agent.json +14 -0
- package/examples/agents/monitor/AGENT.md +51 -0
- package/examples/agents/monitor/agent.json +33 -0
- package/examples/agents/monitor/heartbeats/monitor.md +24 -0
- package/examples/agents/orchestrator/AGENT.md +70 -0
- package/examples/agents/orchestrator/agent.json +30 -0
- package/examples/agents/researcher/AGENT.md +52 -0
- package/examples/agents/researcher/agent.json +49 -0
- package/examples/agents/researcher/skills/web-research.md +28 -0
- package/examples/skills/code-review.md +72 -0
- package/examples/skills/summarise.md +59 -0
- package/examples/skills/web-research.md +42 -0
- package/examples/tools/word-count/index.js +27 -0
- package/examples/tools/word-count/tool.json +18 -0
- package/infrastructure/database.js +563 -0
- package/infrastructure/scheduler.js +122 -0
- package/llm/client.js +206 -0
- package/migrations/001-initial.sql +121 -0
- package/migrations/002-debuggability.sql +13 -0
- package/migrations/003-drop-orphaned-columns.sql +72 -0
- package/migrations/004-session-message-token-fields.sql +78 -0
- package/migrations/005-session-thinking.sql +5 -0
- package/package.json +30 -0
- package/schemas/agent.json +143 -0
- package/schemas/settings.json +111 -0
- package/scripts/fetch-models.js +93 -0
- package/session-debug-scenario.md +248 -0
- package/settings/fields.js +52 -0
- package/system-prompts/base-core.md +7 -0
- package/system-prompts/environment.md +13 -0
- package/system-prompts/reminders/anti-drift.md +6 -0
- package/system-prompts/reminders/stall-recovery.md +10 -0
- package/system-prompts/safety-rules.md +25 -0
- package/system-prompts/task-heuristics.md +27 -0
- package/test/client.js +71 -0
- package/test/integration/01-health.test.js +25 -0
- package/test/integration/02-agents.test.js +80 -0
- package/test/integration/03-chat-hello.test.js +48 -0
- package/test/integration/04-chat-multiturn.test.js +61 -0
- package/test/integration/05-chat-writer.test.js +48 -0
- package/test/integration/06-task-basic.test.js +68 -0
- package/test/integration/07-task-tools.test.js +74 -0
- package/test/integration/08-task-code-analysis.test.js +69 -0
- package/test/integration/09-memory-analyst.test.js +63 -0
- package/test/integration/10-task-advanced.test.js +85 -0
- package/test/integration/11-sessions-advanced.test.js +84 -0
- package/test/integration/12-assistant-chat-tools.test.js +75 -0
- package/test/integration/13-edge-cases.test.js +99 -0
- package/test/integration/14-cancel.test.js +62 -0
- package/test/integration/15-debug.test.js +106 -0
- package/test/integration/16-memory-api.test.js +83 -0
- package/test/integration/17-settings-api.test.js +41 -0
- package/test/integration/18-tool-search-activation.test.js +119 -0
- package/test/results/.gitkeep +0 -0
- package/test/runner.js +206 -0
- package/test/smoke.js +216 -0
- package/tools/agent_message.js +85 -0
- package/tools/agent_send.js +80 -0
- package/tools/agent_spawn.js +44 -0
- package/tools/bash.js +49 -0
- package/tools/edit_file.js +41 -0
- package/tools/glob.js +64 -0
- package/tools/grep.js +82 -0
- package/tools/list_dir.js +63 -0
- package/tools/log_write.js +31 -0
- package/tools/memory_read.js +38 -0
- package/tools/memory_search.js +65 -0
- package/tools/memory_write.js +42 -0
- package/tools/read_file.js +48 -0
- package/tools/sleep.js +22 -0
- package/tools/task_create.js +41 -0
- package/tools/task_respond.js +37 -0
- package/tools/task_spawn.js +64 -0
- package/tools/task_status.js +39 -0
- package/tools/task_subscribe.js +37 -0
- package/tools/todo_read.js +26 -0
- package/tools/todo_write.js +38 -0
- package/tools/tool_activate.js +24 -0
- package/tools/tool_search.js +24 -0
- package/tools/web_fetch.js +50 -0
- package/tools/web_search.js +52 -0
- package/tools/write_file.js +28 -0
- package/ui/api.js +190 -0
- package/ui/app.js +281 -0
- package/ui/index.html +382 -0
- package/ui/views/agents.js +377 -0
- package/ui/views/chat.js +610 -0
- package/ui/views/connection.js +96 -0
- package/ui/views/daemons.js +129 -0
- package/ui/views/feed.js +194 -0
- package/ui/views/memory.js +263 -0
- package/ui/views/models.js +146 -0
- package/ui/views/sessions.js +314 -0
- package/ui/views/settings.js +142 -0
- package/ui/views/tasks.js +415 -0
- package/utils/context.js +49 -0
- package/utils/id.js +16 -0
- package/utils/models.js +88 -0
- package/utils/paths.js +213 -0
- package/utils/settings.js +172 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# Build Prompt — VeilCLI Dashboard (Frontend GUI + CLI Command)
|
|
2
|
+
|
|
3
|
+
## What You Are Building
|
|
4
|
+
|
|
5
|
+
A browser-based GUI for VeilCLI — a local autonomous AI agent runtime with a REST API. The goal is a clean, functional interface that exposes every meaningful feature of the API. Think of it as a developer dashboard / agent dashboard: you can chat with agents, monitor tasks, browse sessions, manage memory, trigger daemons, and watch the live event stream.
|
|
6
|
+
|
|
7
|
+
This is not a demo page — it needs to be genuinely usable as a day-to-day control surface for someone running VeilCLI in production.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Read the API Docs First
|
|
12
|
+
|
|
13
|
+
Before writing a single line of code, read the full API reference:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/home/ixi/khacloud/drive/Plugins/VeilCli/docs/
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The `api/` subfolder has one file per API area. The `guide/` subfolder explains concepts (agents, sessions, tasks, daemons, memory, tools, permissions). Read both. Do not guess field names or endpoint shapes — they are all documented.
|
|
20
|
+
|
|
21
|
+
Also read the existing CLI entry point to understand how to add the new command:
|
|
22
|
+
```
|
|
23
|
+
/home/ixi/khacloud/drive/Plugins/VeilCli/cli/index.js
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Deliverables
|
|
29
|
+
|
|
30
|
+
### 1. Frontend — `ui/` folder
|
|
31
|
+
|
|
32
|
+
Create a `ui/` folder at the root of the VeilCLI repo:
|
|
33
|
+
```
|
|
34
|
+
/home/ixi/khacloud/drive/Plugins/VeilCli/ui/
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
This folder is served as-is by a static file server. No build step. No compilation. The AI agent running this opens `index.html` in a browser and it works immediately.
|
|
38
|
+
|
|
39
|
+
Tech choices are yours — vanilla JS, React via CDN, Vue via CDN, whatever produces the cleanest result. The constraint is: **no build pipeline required**. If you use a framework, load it from a CDN. Use Tailwind via CDN for styling if you want fast, clean UI without writing raw CSS.
|
|
40
|
+
|
|
41
|
+
### 2. New CLI command — `veil dashboard`
|
|
42
|
+
|
|
43
|
+
Add a `dashboard` command to the existing CLI (`cli/index.js`). When invoked, it starts a lightweight static file server that serves the `ui/` folder.
|
|
44
|
+
|
|
45
|
+
Behavior:
|
|
46
|
+
- Default port: **5077**
|
|
47
|
+
- Accepts a `--port` flag to override
|
|
48
|
+
- Prints the URL to the console on startup (e.g. `Dashboard available at http://localhost:5077`)
|
|
49
|
+
- Serves `ui/index.html` for all routes (SPA-style fallback)
|
|
50
|
+
- No auth on the dashboard server itself — it's local-only
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Connection Screen
|
|
55
|
+
|
|
56
|
+
The very first thing the user sees when opening the dashboard (no prior config, or after clearing) is a connection screen with:
|
|
57
|
+
- **Server URL** field — e.g. `http://localhost:5050`
|
|
58
|
+
- **Secret token** field — optional, shown as password input
|
|
59
|
+
- A **Connect** button that tests the connection by calling `GET /health` before proceeding
|
|
60
|
+
- If the connection fails, show a clear error with the actual response or network error
|
|
61
|
+
|
|
62
|
+
Once connected, persist the URL and secret in `localStorage` so the user doesn't re-enter them on reload. Provide a way to disconnect / switch server from anywhere in the app (a small "connected to X" indicator that's clickable).
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Feature Coverage
|
|
67
|
+
|
|
68
|
+
Cover all of the following. Each area should be a distinct view/section in the UI.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
### Agents
|
|
73
|
+
|
|
74
|
+
The central entity. This view should be the default home screen after connecting.
|
|
75
|
+
|
|
76
|
+
- List all agents with their name, model, enabled modes, and description
|
|
77
|
+
- Select an agent to open its detail panel
|
|
78
|
+
- Agent detail: show full config (model, modes, tools, description), with options to:
|
|
79
|
+
- **Edit** — update the agent config (PUT /agents/:name)
|
|
80
|
+
- **Delete** — with a confirmation step
|
|
81
|
+
- **Reload** — hot-reload from disk (POST /agents/:name/reload)
|
|
82
|
+
- **Create new agent** — a form for the essential fields (name, model, modes, description). Check the agent schema for what fields are valid and required. Do not create a form that produces invalid JSON.
|
|
83
|
+
- From agent detail, navigate directly into: Chat, Tasks, Sessions, Skills for that agent
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
### Chat
|
|
88
|
+
|
|
89
|
+
A real chat interface, not a form.
|
|
90
|
+
|
|
91
|
+
- Select an agent and start chatting
|
|
92
|
+
- Messages rendered in a conversation layout (user right, assistant left, or whatever feels natural)
|
|
93
|
+
- **SSE streaming**: connect with `sse: true` and render tokens as they arrive — do not wait for the full response before displaying
|
|
94
|
+
- **Tool calls**: when the SSE stream emits tool events (`tool.start`, `tool.end`), display them inline in the conversation as a collapsible block (tool name, input, output, duration)
|
|
95
|
+
- **Session continuity**: the chat view uses a `sessionId` and sends it with each message so the conversation continues correctly
|
|
96
|
+
- Show token usage per response (input tokens, output tokens, cost if available)
|
|
97
|
+
- Button to start a fresh session (clears the view and drops the sessionId)
|
|
98
|
+
- Optionally: show the current session ID and allow pasting one to resume a specific session
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
### Tasks
|
|
103
|
+
|
|
104
|
+
Async task management.
|
|
105
|
+
|
|
106
|
+
- List all tasks (paginated if many) with status, agent name, created time, and a truncated input preview
|
|
107
|
+
- Color-code by status: pending (grey), processing (blue/animated), finished (green), failed (red), waiting (yellow), canceled (muted)
|
|
108
|
+
- Task detail view:
|
|
109
|
+
- Full input, full output
|
|
110
|
+
- Status, iterations, token counts, cost, duration
|
|
111
|
+
- **Event timeline**: render `GET /tasks/:id/events` as a chronological log — status changes, tool calls (with name + result), limit.reached events
|
|
112
|
+
- If status is `waiting`: show a text input and **Respond** button (`POST /tasks/:id/respond`)
|
|
113
|
+
- If status is `processing` or `pending`: show a **Cancel** button
|
|
114
|
+
- **Stream view**: button to open `GET /tasks/:id/stream` (SSE) and watch a running task live
|
|
115
|
+
- Create new task: pick an agent, enter input, optional priority and token budget
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
### Sessions
|
|
120
|
+
|
|
121
|
+
- List sessions with agent name, status, message count, created time
|
|
122
|
+
- Session detail: render full message history with roles, token counts per message, and cost
|
|
123
|
+
- **Reset** button (clears messages, keeps session)
|
|
124
|
+
- **Delete** (soft and hard options)
|
|
125
|
+
- Pagination on messages if the history is long
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### Daemons
|
|
130
|
+
|
|
131
|
+
- List active daemon schedulers with agent name, schedule (cron), next run time if available
|
|
132
|
+
- Per daemon: **Start**, **Stop**, **Trigger** (manual immediate tick) buttons
|
|
133
|
+
- After triggering, show the resulting task ID and link to task detail
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### Memory
|
|
138
|
+
|
|
139
|
+
Two sections: agent memory and global memory.
|
|
140
|
+
|
|
141
|
+
- For each agent: list its memory files (`GET /agents/:name/memory`), open a file for viewing/editing, save changes (`PUT /agents/:name/memory/:file`), delete a file
|
|
142
|
+
- Global memory: same CRUD operations on `GET /memory` and `PUT /memory/:file`
|
|
143
|
+
- The editor should handle markdown — at minimum a `<textarea>` with monospace font; optionally a simple markdown preview
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### Settings
|
|
148
|
+
|
|
149
|
+
- Show current settings at the `merged` level — what the server is actually running with
|
|
150
|
+
- Toggle to show `project` level only (what's in the workspace settings.json)
|
|
151
|
+
- Inline editing of safe fields with a **Save** button (`PUT /settings`)
|
|
152
|
+
- API keys must be displayed as redacted (treat any field path containing `api_key` as sensitive)
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### Models
|
|
157
|
+
|
|
158
|
+
- List all models from `GET /models` — show name, provider, context length, pricing
|
|
159
|
+
- Search/filter by name or provider
|
|
160
|
+
- **Refresh** button (`POST /models/refresh`) to re-fetch from OpenRouter
|
|
161
|
+
- Click a model to see full detail
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
### Live Event Feed
|
|
166
|
+
|
|
167
|
+
A real-time view connected to the WebSocket (`ws://host:port/ws`).
|
|
168
|
+
|
|
169
|
+
- Scrolling log of all events as they arrive
|
|
170
|
+
- Each event shows its type, timestamp, and relevant data (task ID, agent name, status, etc.)
|
|
171
|
+
- Filters by event type (task events, chat events, daemon events)
|
|
172
|
+
- Pause/resume button
|
|
173
|
+
- Auto-scroll to latest (with a way to lock scroll for reading)
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## UX Requirements
|
|
178
|
+
|
|
179
|
+
- **Navigation**: sidebar or top nav with all sections. Current agent context (if any) should be visible globally.
|
|
180
|
+
- **Responsiveness**: doesn't need to be mobile-friendly, but should work at common desktop widths (1280px+)
|
|
181
|
+
- **Error handling**: every API call that fails should show a useful error message — not just "Error" but the actual response body. The user is a developer; show them everything.
|
|
182
|
+
- **Loading states**: spinners or skeletons on async operations — do not leave the user staring at a blank panel
|
|
183
|
+
- **Empty states**: when there are no agents, no tasks, no sessions, say so clearly with a prompt to create one
|
|
184
|
+
- **Dark mode**: preferred, but not mandatory if it complicates the build significantly
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## What NOT to Do
|
|
189
|
+
|
|
190
|
+
- Do not hardcode `localhost:5050` anywhere — all API calls must go through the configured server URL from the connection screen
|
|
191
|
+
- Do not require a build step
|
|
192
|
+
- Do not implement authentication within the dashboard itself — the secret is just passed as a header on every API call
|
|
193
|
+
- Do not create a read-only dashboard — all write operations (create, edit, delete, trigger) must be available
|
|
194
|
+
- Do not skip error display to "keep the UI clean"
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## File Structure Suggestion
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
ui/
|
|
202
|
+
├── index.html ← entry point, loads everything
|
|
203
|
+
├── app.js ← main app logic / router
|
|
204
|
+
├── api.js ← API client (all fetch calls, secret header injection, error handling)
|
|
205
|
+
├── views/
|
|
206
|
+
│ ├── connection.js
|
|
207
|
+
│ ├── agents.js
|
|
208
|
+
│ ├── chat.js
|
|
209
|
+
│ ├── tasks.js
|
|
210
|
+
│ ├── sessions.js
|
|
211
|
+
│ ├── daemons.js
|
|
212
|
+
│ ├── memory.js
|
|
213
|
+
│ ├── settings.js
|
|
214
|
+
│ ├── models.js
|
|
215
|
+
│ └── feed.js
|
|
216
|
+
└── style.css ← global styles (if not using Tailwind CDN)
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
This is a suggestion, not a requirement. Organize it however makes sense for your implementation. If you prefer a single-file approach for simplicity, that is acceptable as long as the code stays readable.
|
|
220
|
+
dont forget to save secret and url:port to localStorage with a logout button to clear them
|