@roackb2/heddle 0.0.12 → 0.0.14

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 (103) hide show
  1. package/README.md +327 -211
  2. package/dist/src/cli/chat/App.d.ts.map +1 -1
  3. package/dist/src/cli/chat/App.js +6 -0
  4. package/dist/src/cli/chat/App.js.map +1 -1
  5. package/dist/src/cli/chat/state/local-commands.d.ts +3 -1
  6. package/dist/src/cli/chat/state/local-commands.d.ts.map +1 -1
  7. package/dist/src/cli/chat/state/local-commands.js +178 -3
  8. package/dist/src/cli/chat/state/local-commands.js.map +1 -1
  9. package/dist/src/cli/chat/state/types.d.ts +6 -0
  10. package/dist/src/cli/chat/state/types.d.ts.map +1 -1
  11. package/dist/src/cli/chat/submit.d.ts +2 -0
  12. package/dist/src/cli/chat/submit.d.ts.map +1 -1
  13. package/dist/src/cli/chat/submit.js +10 -1
  14. package/dist/src/cli/chat/submit.js.map +1 -1
  15. package/dist/src/cli/chat/utils/runtime.d.ts +1 -0
  16. package/dist/src/cli/chat/utils/runtime.d.ts.map +1 -1
  17. package/dist/src/cli/chat/utils/runtime.js +1 -0
  18. package/dist/src/cli/chat/utils/runtime.js.map +1 -1
  19. package/dist/src/cli/daemon.d.ts +14 -0
  20. package/dist/src/cli/daemon.d.ts.map +1 -0
  21. package/dist/src/cli/daemon.js +61 -0
  22. package/dist/src/cli/daemon.js.map +1 -0
  23. package/dist/src/cli/heartbeat.d.ts.map +1 -1
  24. package/dist/src/cli/heartbeat.js +14 -5
  25. package/dist/src/cli/heartbeat.js.map +1 -1
  26. package/dist/src/cli/main.js +6 -0
  27. package/dist/src/cli/main.js.map +1 -1
  28. package/dist/src/index.d.ts +4 -0
  29. package/dist/src/index.d.ts.map +1 -1
  30. package/dist/src/index.js +2 -0
  31. package/dist/src/index.js.map +1 -1
  32. package/dist/src/runtime/heartbeat-lucid.d.ts +42 -0
  33. package/dist/src/runtime/heartbeat-lucid.d.ts.map +1 -0
  34. package/dist/src/runtime/heartbeat-lucid.js +188 -0
  35. package/dist/src/runtime/heartbeat-lucid.js.map +1 -0
  36. package/dist/src/runtime/heartbeat-scheduler.d.ts +13 -0
  37. package/dist/src/runtime/heartbeat-scheduler.d.ts.map +1 -1
  38. package/dist/src/runtime/heartbeat-scheduler.js +74 -4
  39. package/dist/src/runtime/heartbeat-scheduler.js.map +1 -1
  40. package/dist/src/runtime/heartbeat-views.d.ts +50 -0
  41. package/dist/src/runtime/heartbeat-views.d.ts.map +1 -0
  42. package/dist/src/runtime/heartbeat-views.js +60 -0
  43. package/dist/src/runtime/heartbeat-views.js.map +1 -0
  44. package/dist/src/server/app.d.ts +6 -0
  45. package/dist/src/server/app.d.ts.map +1 -0
  46. package/dist/src/server/app.js +36 -0
  47. package/dist/src/server/app.js.map +1 -0
  48. package/dist/src/server/dev.d.ts +2 -0
  49. package/dist/src/server/dev.d.ts.map +1 -0
  50. package/dist/src/server/dev.js +39 -0
  51. package/dist/src/server/dev.js.map +1 -0
  52. package/dist/src/server/features/control-plane/router.d.ts +37 -0
  53. package/dist/src/server/features/control-plane/router.d.ts.map +1 -0
  54. package/dist/src/server/features/control-plane/router.js +34 -0
  55. package/dist/src/server/features/control-plane/router.js.map +1 -0
  56. package/dist/src/server/features/control-plane/services/chat-sessions.d.ts +4 -0
  57. package/dist/src/server/features/control-plane/services/chat-sessions.d.ts.map +1 -0
  58. package/dist/src/server/features/control-plane/services/chat-sessions.js +63 -0
  59. package/dist/src/server/features/control-plane/services/chat-sessions.js.map +1 -0
  60. package/dist/src/server/features/control-plane/services/control-plane-state.d.ts +4 -0
  61. package/dist/src/server/features/control-plane/services/control-plane-state.d.ts.map +1 -0
  62. package/dist/src/server/features/control-plane/services/control-plane-state.js +19 -0
  63. package/dist/src/server/features/control-plane/services/control-plane-state.js.map +1 -0
  64. package/dist/src/server/features/control-plane/services/heartbeat.d.ts +7 -0
  65. package/dist/src/server/features/control-plane/services/heartbeat.d.ts.map +1 -0
  66. package/dist/src/server/features/control-plane/services/heartbeat.js +12 -0
  67. package/dist/src/server/features/control-plane/services/heartbeat.js.map +1 -0
  68. package/dist/src/server/features/control-plane/types.d.ts +31 -0
  69. package/dist/src/server/features/control-plane/types.d.ts.map +1 -0
  70. package/dist/src/server/features/control-plane/types.js +2 -0
  71. package/dist/src/server/features/control-plane/types.js.map +1 -0
  72. package/dist/src/server/index.d.ts +8 -0
  73. package/dist/src/server/index.d.ts.map +1 -0
  74. package/dist/src/server/index.js +42 -0
  75. package/dist/src/server/index.js.map +1 -0
  76. package/dist/src/server/logger.d.ts +8 -0
  77. package/dist/src/server/logger.d.ts.map +1 -0
  78. package/dist/src/server/logger.js +11 -0
  79. package/dist/src/server/logger.js.map +1 -0
  80. package/dist/src/server/middleware/request-logging.d.ts +4 -0
  81. package/dist/src/server/middleware/request-logging.d.ts.map +1 -0
  82. package/dist/src/server/middleware/request-logging.js +15 -0
  83. package/dist/src/server/middleware/request-logging.js.map +1 -0
  84. package/dist/src/server/router.d.ts +55 -0
  85. package/dist/src/server/router.d.ts.map +1 -0
  86. package/dist/src/server/router.js +14 -0
  87. package/dist/src/server/router.js.map +1 -0
  88. package/dist/src/server/static.d.ts +4 -0
  89. package/dist/src/server/static.d.ts.map +1 -0
  90. package/dist/src/server/static.js +25 -0
  91. package/dist/src/server/static.js.map +1 -0
  92. package/dist/src/server/trpc.d.ts +9 -0
  93. package/dist/src/server/trpc.d.ts.map +1 -0
  94. package/dist/src/server/trpc.js +5 -0
  95. package/dist/src/server/trpc.js.map +1 -0
  96. package/dist/src/server/types.d.ts +17 -0
  97. package/dist/src/server/types.d.ts.map +1 -0
  98. package/dist/src/server/types.js +2 -0
  99. package/dist/src/server/types.js.map +1 -0
  100. package/dist/src/web/assets/index-DmYQXJQf.css +1 -0
  101. package/dist/src/web/assets/index-xFJTOaTY.js +9 -0
  102. package/dist/src/web/index.html +13 -0
  103. package/package.json +18 -3
package/README.md CHANGED
@@ -10,6 +10,19 @@ Heddle is designed to make live agent runs more observable, not just easier to l
10
10
 
11
11
  If you are interested in the underlying methodology, Heddle's drift telemetry is powered by [CyberLoop on npm](https://www.npmjs.com/package/cyberloop). See the [CyberLoop repository](https://github.com/roackb2/cyberloop) and [paper](https://zenodo.org/records/18138161) for the geometric-control and trajectory-based details.
12
12
 
13
+ ## Agenda
14
+
15
+ - [Chat And CLI Usage](#chat-and-cli-usage)
16
+ - [Control Plane](#control-plane)
17
+ - [Knowledge Persistence](#knowledge-persistence)
18
+ - [Semantic Drift](#semantic-drift)
19
+ - [Heartbeat](#heartbeat)
20
+ - [Programmatic Use](#programmatic-use)
21
+ - [Capability Details](#capability-details)
22
+ - [Supported Providers And Models](#supported-providers-and-models)
23
+ - [Project Config](#project-config)
24
+ - [Design Direction](#design-direction)
25
+
13
26
  ## How Heddle Helps
14
27
 
15
28
  - daily development work in real coding projects
@@ -24,7 +37,9 @@ If you are interested in the underlying methodology, Heddle's drift telemetry is
24
37
  - provider-agnostic model support across OpenAI and Anthropic
25
38
  - embeddable `runAgentLoop` API for building non-CLI agent hosts
26
39
  - `runAgentHeartbeat` for scheduler-driven autonomous wake cycles without chat by default
40
+ - native React/Vite control plane served by `heddle daemon` for local browser-based oversight
27
41
  - serializable checkpoints for resume, background execution, and hosted workers
42
+ - host-facing heartbeat task/run views plus websocket-friendly status/progress/response adapters
28
43
  - provider-backed hosted web search through `web_search`
29
44
  - local image viewing from referenced file paths through `view_image`
30
45
  - inline `@file` mentions that tell the agent which workspace files to inspect first
@@ -69,7 +84,9 @@ If you are developing inside the Heddle repo itself, `yarn install` also install
69
84
 
70
85
  For local development against the full CLI entrypoint, use `yarn cli:dev`. The `chat:dev` scripts intentionally start chat mode directly and do not route subcommands such as `heartbeat`.
71
86
 
72
- ## Quick Start
87
+ ## Chat And CLI Usage
88
+
89
+ ### Quick Start
73
90
 
74
91
  1. Set an API key for a supported provider.
75
92
 
@@ -95,34 +112,165 @@ Heddle uses the current directory as the workspace root unless you pass `--cwd`.
95
112
 
96
113
  The default workflow is interactive chat, not one-shot prompts. You keep a session open, inspect the repo, switch models, run direct shell commands when needed, and continue earlier sessions later.
97
114
 
98
- ## Core Capabilities
115
+ ### Chat Workflow
99
116
 
100
- Heddle currently supports:
117
+ Start chat in the current repo:
101
118
 
102
- - repository inspection with `list_files`, `read_file`, and `search_files`
103
- - code and doc changes with `edit_file`
104
- - provider-backed hosted web search through `web_search`
105
- - local screenshot and image inspection through `view_image`
106
- - inline `@file` mentions for file-priority context without pasting file contents into the prompt
107
- - shell execution with inspect vs approval-gated mutate behavior
108
- - multi-turn chat sessions with saved history under `.heddle/`
109
- - session management with create, switch, continue, rename, and close flows
110
- - automatic conversation compaction so longer chats preserve context instead of growing unbounded
111
- - manual `/compact` to shrink the current session transcript on demand
112
- - persistent workspace memory notes under `.heddle/memory/`
113
- - serializable run checkpoints for programmatic hosts and later continuation
114
- - short working-plan support through `update_plan` for substantial multi-step tasks
115
- - remembered per-project approvals for repeated commands and edits
116
- - interrupt and resume support for longer-running coding workflows
117
- - request-size aware context tracking in chat so the footer reflects model input usage, not only raw history size
119
+ ```bash
120
+ heddle
121
+ heddle chat
122
+ heddle --cwd /path/to/project
123
+ heddle chat --model gpt-5.4-mini --max-steps 20
124
+ ```
118
125
 
119
- The image workflow is intentionally simple for now: users can reference a local image path in chat, and the agent can decide whether to inspect it with `view_image`. Heddle does not require a full multimodal attachment model for this first version.
126
+ Typical chat use cases:
120
127
 
121
- The file-mention workflow is also intentionally lightweight: `@path/to/file` tells Heddle that the file is important context and should be inspected before answering, but it does not automatically inline the file contents into the prompt.
128
+ - ask Heddle to explain architecture, code paths, tests, or build setup
129
+ - iterate on a fix over multiple prompts instead of fitting everything into one request
130
+ - inspect files, search the repo, and edit code inside one persistent session
131
+ - keep a long coding conversation usable through saved sessions, `/continue`, automatic history compaction, and manual `/compact`
132
+ - let the agent create and update a short working plan for a multi-step implementation
133
+ - search official docs or other current external references with provider-backed `web_search`
134
+ - mention important repo files with `@path/to/file` so the agent treats them as first-pass context
135
+ - reference a local screenshot path and have the agent inspect it with `view_image`
136
+ - run direct shell commands from chat with `!<command>`
137
+ - pause and later resume earlier sessions
122
138
 
123
- The planning workflow is also intentionally lightweight: Heddle does not force a heavyweight planner or a separate "plan mode," but it can automatically record and update a short plan when a task is substantial enough to benefit from visible progress tracking.
139
+ Useful chat commands:
124
140
 
125
- The web-search workflow is provider-backed rather than crawler-backed: OpenAI models use OpenAI-hosted web search, and Anthropic models use Anthropic-hosted web search when available through the selected model/tool path.
141
+ - `/help`: show local chat commands
142
+ - `/continue`: resume the current session from its last interrupted or prior run
143
+ - `/model`: show the active model
144
+ - `/model list`: show the built-in shortlist
145
+ - `/model set <query>`: open the interactive model picker
146
+ - `/model <name>`: switch models directly
147
+ - `/session list`: list recent saved sessions
148
+ - `/session choose <query>`: choose a recent session interactively
149
+ - `/session new [name]`: create a new session
150
+ - `/session switch <id>`: switch to another session
151
+ - `/session continue <id>`: switch and immediately continue that session
152
+ - `/session rename <name>`: rename the current session
153
+ - `/session close <id>`: remove a saved session
154
+ - `/clear`: clear the current transcript
155
+ - `/compact`: compact older session history immediately
156
+ - `/drift`: show CyberLoop semantic drift detection status
157
+ - `/drift on`: re-enable observe-only CyberLoop kinematics telemetry for chat runs
158
+ - `/drift off`: disable CyberLoop semantic drift detection
159
+ - `!<command>`: run a shell command directly in chat
160
+
161
+ Direct shell in chat:
162
+
163
+ ```bash
164
+ !pwd
165
+ !git status
166
+ !yarn test
167
+ ```
168
+
169
+ Read-oriented commands stay in inspect mode when possible. Workspace-changing or unclassified commands fall back to approval-gated execution.
170
+
171
+ Chat state is stored under `.heddle/`, including saved sessions, traces, approvals, and memory notes. The footer context indicator is an estimate of total request input against the active model's context window, not only the raw chat history length.
172
+
173
+ For local development against the sibling CyberLoop repo, run chat with the middleware module path:
174
+
175
+ ```bash
176
+ HEDDLE_CYBERLOOP_ADVANCED_MODULE=/Users/roackb2/Studio/projects/CyberLoop/src/advanced/kinematics-middleware.ts yarn chat:dev:openai
177
+ ```
178
+
179
+ Drift telemetry is enabled by default for new sessions. For installed usage, install the optional `cyberloop` peer dependency in the same environment as Heddle so it can dynamically import `cyberloop/advanced`.
180
+
181
+ ### CLI Commands
182
+
183
+ Supported commands:
184
+
185
+ - `heddle` or `heddle chat`: start interactive chat mode
186
+ - `heddle ask "<goal>"`: run a single prompt and exit
187
+ - `heddle heartbeat start [--every 30m] [--task "<durable task>"]`: create or enable the default heartbeat task and run the foreground scheduler
188
+ - `heddle heartbeat task add --id <id> --task "<durable task>" [--every 15m]`: create or update a scheduled heartbeat task
189
+ - `heddle heartbeat task list`: list local heartbeat tasks
190
+ - `heddle heartbeat task show <id>`: show a task's schedule, last decision, and last run summary
191
+ - `heddle heartbeat task enable <id>` / `heddle heartbeat task disable <id>`: toggle a heartbeat task
192
+ - `heddle heartbeat run --once`: run due heartbeat tasks once
193
+ - `heddle heartbeat run [--poll 60s]`: run the foreground heartbeat scheduler until interrupted; heartbeat runs print scheduler, agent, tool, decision, and checkpoint progress events
194
+ - `heddle heartbeat runs list [--task <id>] [--limit 10]`: list saved heartbeat run records
195
+ - `heddle heartbeat runs show <run-id|latest> [--task <id>]`: show the final agent output for a saved heartbeat run
196
+ - `heddle init`: create a `heddle.config.json` template in the current project
197
+
198
+ Common flags:
199
+
200
+ - `--cwd <path>`: run against another workspace root
201
+ - `--model <name>`: choose the active model
202
+ - `--max-steps <n>`: limit the agent loop length
203
+
204
+ ## Control Plane
205
+
206
+ Heddle includes an early local browser control plane for users who want a native UI instead of only terminal chat or third-party messaging apps.
207
+
208
+ This is still WIP. The current version is useful for read-only oversight, but it is not yet a full replacement for the TUI.
209
+
210
+ Current stack:
211
+
212
+ - `src/server`: Express-hosted tRPC server
213
+ - `src/web`: React/Vite web client
214
+ - `src/server/features/control-plane`: control-plane-specific server feature logic
215
+ - pino logs written locally for debugging
216
+
217
+ Start the daemon from a workspace:
218
+
219
+ ```bash
220
+ heddle daemon
221
+ ```
222
+
223
+ By default, the daemon binds to `127.0.0.1:8765` and serves the built web app plus the tRPC API. The first implementation surfaces:
224
+
225
+ - workspace and `.heddle/` state location
226
+ - saved chat session inventory
227
+ - heartbeat task status
228
+ - recent heartbeat run summaries and usage
229
+
230
+ You can override host and port:
231
+
232
+ ```bash
233
+ heddle daemon --host 127.0.0.1 --port 8765
234
+ ```
235
+
236
+ For local development, run the server and client separately:
237
+
238
+ ```bash
239
+ yarn server:dev
240
+ yarn client:dev
241
+ ```
242
+
243
+ `yarn server:dev` starts the tRPC server at `127.0.0.1:8765`. `yarn client:dev` starts the Vite client and proxies `/trpc` to the server.
244
+
245
+ The server writes pino logs to `.heddle/logs/server.log` by default. Override the path with:
246
+
247
+ ```bash
248
+ HEDDLE_SERVER_LOG_FILE=/path/to/server.log yarn server:dev
249
+ ```
250
+
251
+ This control plane is intentionally read-only at first. The next milestones are session detail views, chat continuation from the browser, heartbeat task actions, and live run updates.
252
+
253
+ ## Knowledge Persistence
254
+
255
+ Heddle can maintain durable workspace knowledge under `.heddle/memory/`.
256
+
257
+ The goal is to help Heddle learn from real project work over time instead of rediscovering the same stable facts every session.
258
+
259
+ Typical examples:
260
+
261
+ - architecture notes that future sessions should reuse
262
+ - recurring build, test, or environment quirks
263
+ - important repo conventions and command patterns
264
+ - durable findings from completed implementation work
265
+
266
+ The memory model is intentionally simple:
267
+
268
+ - memory is stored as readable markdown files in the project state directory
269
+ - Heddle can list, read, search, and edit those notes
270
+ - shell tools are still available when flexible retrieval or editing is needed
271
+ - memory is meant for stable, reusable knowledge, not scratch notes or speculative plans
272
+
273
+ This is one of Heddle's more distinctive host-side capabilities: the aim is not just to answer the current prompt, but to let the runtime accumulate project understanding from your operations and become more useful across sessions.
126
274
 
127
275
  ## Semantic Drift
128
276
 
@@ -195,6 +343,8 @@ heddle heartbeat runs show latest --task repo-gardener
195
343
 
196
344
  For an OpenClaw-like local experience, `heartbeat start` creates or enables a default periodic task and runs the foreground scheduler in one command. It prints the agent's final summary and decision after each run. Stop it with `Ctrl+C`.
197
345
 
346
+ For programmatic hosts, heartbeat now also exposes compact task/run views and a thin host-adapter layer, so external apps can consume stable status/progress/response payloads without parsing raw CLI output or full trace history.
347
+
198
348
  Inside this repository, use the dev CLI entrypoint instead:
199
349
 
200
350
  ```bash
@@ -237,199 +387,22 @@ await runHeartbeatScheduler({
237
387
  })
238
388
  ```
239
389
 
240
- ## Knowledge Persistence
241
-
242
- Heddle can maintain durable workspace knowledge under `.heddle/memory/`.
243
-
244
- The goal is to help Heddle learn from real project work over time instead of rediscovering the same stable facts every session.
245
-
246
- Typical examples:
247
-
248
- - architecture notes that future sessions should reuse
249
- - recurring build, test, or environment quirks
250
- - important repo conventions and command patterns
251
- - durable findings from completed implementation work
252
-
253
- The memory model is intentionally simple:
254
-
255
- - memory is stored as readable markdown files in the project state directory
256
- - Heddle can list, read, search, and edit those notes
257
- - shell tools are still available when flexible retrieval or editing is needed
258
- - memory is meant for stable, reusable knowledge, not scratch notes or speculative plans
259
-
260
- This is one of Heddle's more distinctive host-side capabilities: the aim is not just to answer the current prompt, but to let the runtime accumulate project understanding from your operations and become more useful across sessions.
261
-
262
- ## What Heddle Does
263
-
264
- Heddle runs an agent loop against your workspace:
265
-
266
- ```text
267
- goal
268
- -> send transcript + tool definitions to the model
269
- -> model answers or requests tool calls
270
- -> execute tools in the workspace
271
- -> append results to the transcript
272
- -> continue until done / max steps / error
273
- ```
274
-
275
- Current focus:
276
-
277
- - chat-first coding and repository workflows from the terminal
278
- - minimal runtime behavior instead of a large framework surface
279
- - traceability and operator control over hidden orchestration
280
-
281
- ## Chat Workflow
282
-
283
- Start chat in the current repo:
284
-
285
- ```bash
286
- heddle
287
- heddle chat
288
- heddle --cwd /path/to/project
289
- heddle chat --model gpt-5.4-mini --max-steps 20
290
- ```
291
-
292
- Typical chat use cases:
293
-
294
- - ask Heddle to explain architecture, code paths, tests, or build setup
295
- - iterate on a fix over multiple prompts instead of fitting everything into one request
296
- - inspect files, search the repo, and edit code inside one persistent session
297
- - keep a long coding conversation usable through saved sessions, `/continue`, automatic history compaction, and manual `/compact`
298
- - let the agent create and update a short working plan for a multi-step implementation
299
- - search official docs or other current external references with provider-backed `web_search`
300
- - mention important repo files with `@path/to/file` so the agent treats them as first-pass context
301
- - reference a local screenshot path and have the agent inspect it with `view_image`
302
- - run direct shell commands from chat with `!<command>`
303
- - pause and later resume earlier sessions
390
+ To read compact task/run state back out for dashboards or hosted controllers:
304
391
 
305
- Useful chat commands:
306
-
307
- - `/help`: show local chat commands
308
- - `/continue`: resume the current session from its last interrupted or prior run
309
- - `/model`: show the active model
310
- - `/model list`: show the built-in shortlist
311
- - `/model set <query>`: open the interactive model picker
312
- - `/model <name>`: switch models directly
313
- - `/session list`: list recent saved sessions
314
- - `/session choose <query>`: choose a recent session interactively
315
- - `/session new [name]`: create a new session
316
- - `/session switch <id>`: switch to another session
317
- - `/session continue <id>`: switch and immediately continue that session
318
- - `/session rename <name>`: rename the current session
319
- - `/session close <id>`: remove a saved session
320
- - `/clear`: clear the current transcript
321
- - `/compact`: compact older session history immediately
322
- - `/drift`: show CyberLoop semantic drift detection status
323
- - `/drift on`: re-enable observe-only CyberLoop kinematics telemetry for chat runs
324
- - `/drift off`: disable CyberLoop semantic drift detection
325
- - `!<command>`: run a shell command directly in chat
326
-
327
- Direct shell in chat:
328
-
329
- ```bash
330
- !pwd
331
- !git status
332
- !yarn test
333
- ```
334
-
335
- Read-oriented commands stay in inspect mode when possible. Workspace-changing or unclassified commands fall back to approval-gated execution.
336
-
337
- Chat state is stored under `.heddle/`, including saved sessions, traces, approvals, and memory notes. The footer context indicator is an estimate of total request input against the active model's context window, not only the raw chat history length.
338
-
339
- For local development against the sibling CyberLoop repo, run chat with the middleware module path:
340
-
341
- ```bash
342
- HEDDLE_CYBERLOOP_ADVANCED_MODULE=/Users/roackb2/Studio/projects/CyberLoop/src/advanced/kinematics-middleware.ts yarn chat:dev:openai
343
- ```
344
-
345
- Drift telemetry is enabled by default for new sessions. For installed usage, install the optional `cyberloop` peer dependency in the same environment as Heddle so it can dynamically import `cyberloop/advanced`.
346
-
347
- ## CLI Usage
348
-
349
- Supported commands:
350
-
351
- - `heddle` or `heddle chat`: start interactive chat mode
352
- - `heddle ask "<goal>"`: run a single prompt and exit
353
- - `heddle heartbeat start [--every 30m] [--task "<durable task>"]`: create or enable the default heartbeat task and run the foreground scheduler
354
- - `heddle heartbeat task add --id <id> --task "<durable task>" [--every 15m]`: create or update a scheduled heartbeat task
355
- - `heddle heartbeat task list`: list local heartbeat tasks
356
- - `heddle heartbeat task show <id>`: show a task's schedule, last decision, and last run summary
357
- - `heddle heartbeat task enable <id>` / `heddle heartbeat task disable <id>`: toggle a heartbeat task
358
- - `heddle heartbeat run --once`: run due heartbeat tasks once
359
- - `heddle heartbeat run [--poll 60s]`: run the foreground heartbeat scheduler until interrupted; heartbeat runs print scheduler, agent, tool, decision, and checkpoint progress events
360
- - `heddle heartbeat runs list [--task <id>] [--limit 10]`: list saved heartbeat run records
361
- - `heddle heartbeat runs show <run-id|latest> [--task <id>]`: show the final agent output for a saved heartbeat run
362
- - `heddle init`: create a `heddle.config.json` template in the current project
363
-
364
- Common flags:
365
-
366
- - `--cwd <path>`: run against another workspace root
367
- - `--model <name>`: choose the active model
368
- - `--max-steps <n>`: limit the agent loop length
369
-
370
- ## Supported Providers And Models
371
-
372
- Heddle currently has working adapters for:
373
-
374
- - OpenAI
375
- - Anthropic
376
-
377
- Environment variables:
378
-
379
- - `OPENAI_API_KEY` for OpenAI models
380
- - `ANTHROPIC_API_KEY` for Anthropic models
381
- - dev fallback env vars are also accepted: `PERSONAL_OPENAI_API_KEY` and `PERSONAL_ANTHROPIC_API_KEY`
382
-
383
- Default models:
384
-
385
- - OpenAI: `gpt-5.1-codex`
386
- - Anthropic: `claude-sonnet-4-6`
387
-
388
- Built-in model shortlist exposed by the CLI UI:
389
-
390
- - OpenAI: `gpt-5.4`, `gpt-5.4-pro`, `gpt-5.4-mini`, `gpt-5.4-nano`
391
- - OpenAI: `gpt-5`, `gpt-5-pro`, `gpt-5-mini`, `gpt-5-nano`
392
- - OpenAI: `gpt-5.2`, `gpt-5.2-pro`, `gpt-5.1`
393
- - OpenAI: `gpt-4.1`, `gpt-4.1-mini`, `gpt-4.1-nano`
394
- - OpenAI: `o3-pro`, `o3`, `o3-mini`, `o4-mini`
395
- - OpenAI coding models: `gpt-5.1-codex`, `gpt-5.1-codex-max`, `gpt-5.1-codex-mini`
396
- - Anthropic: `claude-opus-4-6`, `claude-sonnet-4-6`, `claude-haiku-4-5`
397
- - Anthropic: `claude-opus-4-1`, `claude-opus-4-0`, `claude-sonnet-4-0`
398
- - Anthropic: `claude-3-7-sonnet-latest`
399
- - Anthropic: `claude-3-5-sonnet-latest`, `claude-3-5-haiku-latest`
400
-
401
- Notes:
402
-
403
- - model selection is inferred from the model name prefix
404
- - Gemini model names are recognized by provider inference, but a Google adapter is not wired yet
405
- - you can pass another model name with `--model`, but it only works if the corresponding provider adapter supports it
406
-
407
- ## Project Config
392
+ ```ts
393
+ import {
394
+ createFileHeartbeatTaskStore,
395
+ listHeartbeatTaskViews,
396
+ listHeartbeatRunViews,
397
+ } from '@roackb2/heddle'
408
398
 
409
- You can store project defaults in `heddle.config.json`:
399
+ const store = createFileHeartbeatTaskStore({ dir: '.heddle/heartbeat' })
410
400
 
411
- ```json
412
- {
413
- "model": "gpt-5.1-codex",
414
- "maxSteps": 40,
415
- "stateDir": ".heddle",
416
- "directShellApproval": "never",
417
- "searchIgnoreDirs": [".git", "dist", "node_modules", ".heddle"],
418
- "agentContextPaths": ["AGENTS.md"]
419
- }
401
+ const tasks = await listHeartbeatTaskViews(store)
402
+ const runs = await listHeartbeatRunViews(store, { taskId: 'repo-gardener', limit: 5 })
420
403
  ```
421
404
 
422
- Precedence order:
423
-
424
- - CLI flags override `heddle.config.json`
425
- - `heddle.config.json` overrides environment-driven defaults
426
-
427
- Field notes:
428
-
429
- - `stateDir`: where traces, logs, approvals, and chat state are stored
430
- - `directShellApproval`: whether explicit `!command` input in chat still asks for approval
431
- - `searchIgnoreDirs`: directories excluded from `search_files`
432
- - `agentContextPaths`: project instruction files injected into the system prompt
405
+ Those views are intentionally smaller than full checkpoints or traces. They expose stable operator-facing fields such as task ID, status, progress, decision, outcome, resumability, usage, and latest summary.
433
406
 
434
407
  ## Programmatic Use
435
408
 
@@ -472,6 +445,36 @@ The loop emits structured events for:
472
445
 
473
446
  The returned result also includes a serializable `state` object with the model, provider, workspace root, outcome, transcript, trace, usage, and timestamps. This is the boundary future hosts can persist for background execution, dashboards, middleware, or heartbeat-style continuation.
474
447
 
448
+ For host UIs or controllers that do not want to understand Heddle's full trace/event model, the package also exports compact heartbeat views plus a thin status/progress/response adapter layer:
449
+
450
+ ```ts
451
+ import {
452
+ createFileHeartbeatTaskStore,
453
+ heartbeatSchedulerEventToLucidMessages,
454
+ heartbeatTaskViewToLucidMessages,
455
+ listHeartbeatTaskViews,
456
+ } from '@roackb2/heddle'
457
+
458
+ const store = createFileHeartbeatTaskStore({ dir: '.heddle/heartbeat' })
459
+ const tasks = await listHeartbeatTaskViews(store)
460
+
461
+ for (const task of tasks) {
462
+ const messages = heartbeatTaskViewToLucidMessages(task)
463
+ console.log(messages)
464
+ }
465
+
466
+ const schedulerMessages = heartbeatSchedulerEventToLucidMessages({
467
+ type: 'heartbeat.task.started',
468
+ taskId: 'repo-gardener',
469
+ loadedCheckpoint: true,
470
+ status: 'running',
471
+ progress: 'Resuming heartbeat wake from the last checkpoint.',
472
+ timestamp: new Date().toISOString(),
473
+ })
474
+ ```
475
+
476
+ The adapter names are Lucid-oriented because that is one target host, but the payload shape is generic: compact status, progress, and response messages that another app can publish over websockets, SSE, or logs.
477
+
475
478
  For passive semantic-drift experiments, `createCyberLoopObserver` can consume Heddle's event stream and run CyberLoop-compatible middleware over normalized runtime frames:
476
479
 
477
480
  ```ts
@@ -573,6 +576,119 @@ yarn example:cyberloop-observer
573
576
 
574
577
  The public API lives in [src/index.ts](/Users/roackb2/Studio/projects/ProjectHeddle/heddle/src/index.ts).
575
578
 
579
+ ## Capability Details
580
+
581
+ Heddle currently supports:
582
+
583
+ - repository inspection with `list_files`, `read_file`, and `search_files`
584
+ - code and doc changes with `edit_file`
585
+ - provider-backed hosted web search through `web_search`
586
+ - local screenshot and image inspection through `view_image`
587
+ - native browser control plane through `heddle daemon`
588
+ - inline `@file` mentions for file-priority context without pasting file contents into the prompt
589
+ - shell execution with inspect vs approval-gated mutate behavior
590
+ - multi-turn chat sessions with saved history under `.heddle/`
591
+ - session management with create, switch, continue, rename, and close flows
592
+ - automatic conversation compaction so longer chats preserve context instead of growing unbounded
593
+ - manual `/compact` to shrink the current session transcript on demand
594
+ - persistent workspace memory notes under `.heddle/memory/`
595
+ - serializable run checkpoints for programmatic hosts and later continuation
596
+ - short working-plan support through `update_plan` for substantial multi-step tasks
597
+ - remembered per-project approvals for repeated commands and edits
598
+ - interrupt and resume support for longer-running coding workflows
599
+ - request-size aware context tracking in chat so the footer reflects model input usage, not only raw history size
600
+
601
+ The image workflow is intentionally simple for now: users can reference a local image path in chat, and the agent can decide whether to inspect it with `view_image`. Heddle does not require a full multimodal attachment model for this first version.
602
+
603
+ The file-mention workflow is also intentionally lightweight: `@path/to/file` tells Heddle that the file is important context and should be inspected before answering, but it does not automatically inline the file contents into the prompt.
604
+
605
+ The planning workflow is also intentionally lightweight: Heddle does not force a heavyweight planner or a separate "plan mode," but it can automatically record and update a short plan when a task is substantial enough to benefit from visible progress tracking.
606
+
607
+ The web-search workflow is provider-backed rather than crawler-backed: OpenAI models use OpenAI-hosted web search, and Anthropic models use Anthropic-hosted web search when available through the selected model/tool path.
608
+
609
+ ## What Heddle Does
610
+
611
+ Heddle runs an agent loop against your workspace:
612
+
613
+ ```text
614
+ goal
615
+ -> send transcript + tool definitions to the model
616
+ -> model answers or requests tool calls
617
+ -> execute tools in the workspace
618
+ -> append results to the transcript
619
+ -> continue until done / max steps / error
620
+ ```
621
+
622
+ Current focus:
623
+
624
+ - chat-first coding and repository workflows from the terminal
625
+ - minimal runtime behavior instead of a large framework surface
626
+ - traceability and operator control over hidden orchestration
627
+
628
+ ## Supported Providers And Models
629
+
630
+ Heddle currently has working adapters for:
631
+
632
+ - OpenAI
633
+ - Anthropic
634
+
635
+ Environment variables:
636
+
637
+ - `OPENAI_API_KEY` for OpenAI models
638
+ - `ANTHROPIC_API_KEY` for Anthropic models
639
+ - dev fallback env vars are also accepted: `PERSONAL_OPENAI_API_KEY` and `PERSONAL_ANTHROPIC_API_KEY`
640
+
641
+ Default models:
642
+
643
+ - OpenAI: `gpt-5.1-codex`
644
+ - Anthropic: `claude-sonnet-4-6`
645
+
646
+ Built-in model shortlist exposed by the CLI UI:
647
+
648
+ - OpenAI: `gpt-5.4`, `gpt-5.4-pro`, `gpt-5.4-mini`, `gpt-5.4-nano`
649
+ - OpenAI: `gpt-5`, `gpt-5-pro`, `gpt-5-mini`, `gpt-5-nano`
650
+ - OpenAI: `gpt-5.2`, `gpt-5.2-pro`, `gpt-5.1`
651
+ - OpenAI: `gpt-4.1`, `gpt-4.1-mini`, `gpt-4.1-nano`
652
+ - OpenAI: `o3-pro`, `o3`, `o3-mini`, `o4-mini`
653
+ - OpenAI coding models: `gpt-5.1-codex`, `gpt-5.1-codex-max`, `gpt-5.1-codex-mini`
654
+ - Anthropic: `claude-opus-4-6`, `claude-sonnet-4-6`, `claude-haiku-4-5`
655
+ - Anthropic: `claude-opus-4-1`, `claude-opus-4-0`, `claude-sonnet-4-0`
656
+ - Anthropic: `claude-3-7-sonnet-latest`
657
+ - Anthropic: `claude-3-5-sonnet-latest`, `claude-3-5-haiku-latest`
658
+
659
+ Notes:
660
+
661
+ - model selection is inferred from the model name prefix
662
+ - Gemini model names are recognized by provider inference, but a Google adapter is not wired yet
663
+ - you can pass another model name with `--model`, but it only works if the corresponding provider adapter supports it
664
+
665
+ ## Project Config
666
+
667
+ You can store project defaults in `heddle.config.json`:
668
+
669
+ ```json
670
+ {
671
+ "model": "gpt-5.1-codex",
672
+ "maxSteps": 40,
673
+ "stateDir": ".heddle",
674
+ "directShellApproval": "never",
675
+ "searchIgnoreDirs": [".git", "dist", "node_modules", ".heddle"],
676
+ "agentContextPaths": ["AGENTS.md"]
677
+ }
678
+ ```
679
+
680
+ Precedence order:
681
+
682
+ - CLI flags override `heddle.config.json`
683
+ - `heddle.config.json` overrides environment-driven defaults
684
+
685
+ Field notes:
686
+
687
+ - `stateDir`: where traces, logs, approvals, and chat state are stored
688
+ - `directShellApproval`: whether explicit `!command` input in chat still asks for approval
689
+ - `searchIgnoreDirs`: directories excluded from `search_files`
690
+ - `agentContextPaths`: project instruction files injected into the system prompt
691
+
576
692
  ## Design Direction
577
693
 
578
694
  Heddle is currently optimized for coding and terminal workflows, but the long-term goal is broader: an open, provider-agnostic runtime for tool-using agents in real working environments.
@@ -1 +1 @@
1
- {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../src/cli/chat/App.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAI5D,wBAAgB,GAAG,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,iBAAiB,CAAA;CAAE,2CA0gB9D"}
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../src/cli/chat/App.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAI5D,wBAAgB,GAAG,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,iBAAiB,CAAA;CAAE,2CAghB9D"}
@@ -204,6 +204,8 @@ export function App({ runtime }) {
204
204
  driftEnabled,
205
205
  driftError,
206
206
  setDriftEnabled: applyDriftEnabled,
207
+ workspaceRoot: runtime.workspaceRoot,
208
+ stateRoot: runtime.stateRoot,
207
209
  preparePrompt: preparePromptWithMentions,
208
210
  executeTurn,
209
211
  executeDirectShellCommand,
@@ -236,6 +238,8 @@ export function App({ runtime }) {
236
238
  driftEnabled,
237
239
  driftError,
238
240
  setDriftEnabled: applyDriftEnabled,
241
+ workspaceRoot: runtime.workspaceRoot,
242
+ stateRoot: runtime.stateRoot,
239
243
  preparePrompt: preparePromptWithMentions,
240
244
  executeTurn,
241
245
  executeDirectShellCommand,
@@ -274,6 +278,8 @@ export function App({ runtime }) {
274
278
  driftEnabled,
275
279
  driftError,
276
280
  setDriftEnabled: applyDriftEnabled,
281
+ workspaceRoot: runtime.workspaceRoot,
282
+ stateRoot: runtime.stateRoot,
277
283
  preparePrompt: preparePromptWithMentions,
278
284
  executeTurn,
279
285
  executeDirectShellCommand,