@soederpop/luca 0.0.5 → 0.0.7

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 (211) hide show
  1. package/CLAUDE.md +10 -1
  2. package/bun.lock +1 -1
  3. package/commands/build-bootstrap.ts +78 -0
  4. package/commands/build-scaffolds.ts +24 -2
  5. package/commands/try-all-challenges.ts +543 -0
  6. package/commands/try-challenge.ts +100 -0
  7. package/docs/README.md +52 -80
  8. package/docs/TABLE-OF-CONTENTS.md +82 -51
  9. package/docs/apis/clients/elevenlabs.md +232 -8
  10. package/docs/apis/clients/graph.md +59 -8
  11. package/docs/apis/clients/openai.md +362 -2
  12. package/docs/apis/clients/rest.md +122 -2
  13. package/docs/apis/clients/websocket.md +71 -17
  14. package/docs/apis/features/agi/assistant.md +9 -3
  15. package/docs/apis/features/agi/assistants-manager.md +2 -2
  16. package/docs/apis/features/agi/claude-code.md +153 -14
  17. package/docs/apis/features/agi/conversation-history.md +15 -3
  18. package/docs/apis/features/agi/conversation.md +133 -20
  19. package/docs/apis/features/agi/openai-codex.md +90 -12
  20. package/docs/apis/features/agi/skills-library.md +23 -5
  21. package/docs/apis/features/node/container-link.md +59 -0
  22. package/docs/apis/features/node/content-db.md +1 -1
  23. package/docs/apis/features/node/disk-cache.md +1 -1
  24. package/docs/apis/features/node/dns.md +1 -0
  25. package/docs/apis/features/node/docker.md +2 -1
  26. package/docs/apis/features/node/esbuild.md +4 -3
  27. package/docs/apis/features/node/file-manager.md +13 -4
  28. package/docs/apis/features/node/fs.md +726 -171
  29. package/docs/apis/features/node/git.md +1 -0
  30. package/docs/apis/features/node/google-auth.md +23 -4
  31. package/docs/apis/features/node/google-calendar.md +14 -2
  32. package/docs/apis/features/node/google-docs.md +15 -2
  33. package/docs/apis/features/node/google-drive.md +21 -3
  34. package/docs/apis/features/node/google-sheets.md +14 -2
  35. package/docs/apis/features/node/grep.md +2 -0
  36. package/docs/apis/features/node/helpers.md +29 -0
  37. package/docs/apis/features/node/ink.md +2 -2
  38. package/docs/apis/features/node/networking.md +39 -4
  39. package/docs/apis/features/node/os.md +28 -0
  40. package/docs/apis/features/node/postgres.md +26 -4
  41. package/docs/apis/features/node/proc.md +37 -28
  42. package/docs/apis/features/node/process-manager.md +33 -5
  43. package/docs/apis/features/node/repl.md +1 -1
  44. package/docs/apis/features/node/runpod.md +1 -0
  45. package/docs/apis/features/node/secure-shell.md +7 -0
  46. package/docs/apis/features/node/semantic-search.md +12 -5
  47. package/docs/apis/features/node/sqlite.md +26 -4
  48. package/docs/apis/features/node/telegram.md +30 -5
  49. package/docs/apis/features/node/tts.md +17 -2
  50. package/docs/apis/features/node/ui.md +1 -1
  51. package/docs/apis/features/node/vault.md +4 -9
  52. package/docs/apis/features/node/vm.md +3 -12
  53. package/docs/apis/features/node/window-manager.md +128 -20
  54. package/docs/apis/features/web/asset-loader.md +13 -1
  55. package/docs/apis/features/web/container-link.md +59 -0
  56. package/docs/apis/features/web/esbuild.md +4 -3
  57. package/docs/apis/features/web/helpers.md +29 -0
  58. package/docs/apis/features/web/network.md +16 -2
  59. package/docs/apis/features/web/speech.md +16 -2
  60. package/docs/apis/features/web/vault.md +4 -9
  61. package/docs/apis/features/web/vm.md +3 -12
  62. package/docs/apis/features/web/voice.md +18 -1
  63. package/docs/apis/servers/express.md +18 -2
  64. package/docs/apis/servers/mcp.md +29 -4
  65. package/docs/apis/servers/websocket.md +34 -6
  66. package/docs/bootstrap/CLAUDE.md +100 -0
  67. package/docs/bootstrap/SKILL.md +222 -0
  68. package/docs/bootstrap/templates/about-command.ts +41 -0
  69. package/docs/bootstrap/templates/docs-models.ts +22 -0
  70. package/docs/bootstrap/templates/docs-readme.md +43 -0
  71. package/docs/bootstrap/templates/example-feature.ts +53 -0
  72. package/docs/bootstrap/templates/health-endpoint.ts +15 -0
  73. package/docs/bootstrap/templates/luca-cli.ts +25 -0
  74. package/docs/challenges/caching-proxy.md +16 -0
  75. package/docs/challenges/content-db-round-trip.md +14 -0
  76. package/docs/challenges/custom-command.md +9 -0
  77. package/docs/challenges/file-watcher-pipeline.md +11 -0
  78. package/docs/challenges/grep-audit-report.md +15 -0
  79. package/docs/challenges/multi-feature-dashboard.md +14 -0
  80. package/docs/challenges/process-orchestrator.md +17 -0
  81. package/docs/challenges/rest-api-server-with-client.md +12 -0
  82. package/docs/challenges/script-runner-with-vm.md +11 -0
  83. package/docs/challenges/simple-rest-api.md +15 -0
  84. package/docs/challenges/websocket-serve-and-client.md +11 -0
  85. package/docs/challenges/yaml-config-system.md +14 -0
  86. package/docs/command-system-overhaul.md +94 -0
  87. package/docs/examples/assistant/CORE.md +18 -0
  88. package/docs/examples/assistant/hooks.ts +3 -0
  89. package/docs/examples/assistant/tools.ts +10 -0
  90. package/docs/examples/window-manager-layouts.md +180 -0
  91. package/docs/in-memory-fs.md +4 -0
  92. package/docs/models.ts +13 -10
  93. package/docs/philosophy.md +4 -3
  94. package/docs/reports/console-hmr-design.md +170 -0
  95. package/docs/reports/helper-semantic-search.md +72 -0
  96. package/docs/scaffolds/client.md +29 -20
  97. package/docs/scaffolds/command.md +64 -50
  98. package/docs/scaffolds/endpoint.md +31 -36
  99. package/docs/scaffolds/feature.md +28 -18
  100. package/docs/scaffolds/selector.md +91 -0
  101. package/docs/scaffolds/server.md +18 -9
  102. package/docs/selectors.md +115 -0
  103. package/docs/sessions/custom-command/attempt-log-2.md +195 -0
  104. package/docs/sessions/file-watcher-pipeline/attempt-log-1.md +728 -0
  105. package/docs/sessions/file-watcher-pipeline/attempt-log-2.md +555 -0
  106. package/docs/sessions/grep-audit-report/attempt-log-1.md +289 -0
  107. package/docs/sessions/multi-feature-dashboard/attempt-log-2.md +679 -0
  108. package/docs/sessions/rest-api-server-with-client/attempt-log-1.md +1 -0
  109. package/docs/sessions/rest-api-server-with-client/attempt-log-3.md +920 -0
  110. package/docs/sessions/simple-rest-api/attempt-log-1.md +593 -0
  111. package/docs/sessions/websocket-serve-and-client/attempt-log-2.md +995 -0
  112. package/docs/tutorials/00-bootstrap.md +148 -0
  113. package/docs/tutorials/07-endpoints.md +7 -7
  114. package/docs/tutorials/08-commands.md +153 -72
  115. package/luca.cli.ts +3 -0
  116. package/package.json +6 -5
  117. package/public/index.html +1430 -0
  118. package/scripts/examples/using-ollama.ts +2 -1
  119. package/scripts/update-introspection-data.ts +2 -2
  120. package/src/agi/endpoints/experts.ts +1 -1
  121. package/src/agi/features/assistant.ts +7 -0
  122. package/src/agi/features/assistants-manager.ts +5 -5
  123. package/src/agi/features/claude-code.ts +263 -3
  124. package/src/agi/features/conversation-history.ts +7 -1
  125. package/src/agi/features/conversation.ts +26 -3
  126. package/src/agi/features/openai-codex.ts +26 -2
  127. package/src/agi/features/openapi.ts +6 -1
  128. package/src/agi/features/skills-library.ts +9 -1
  129. package/src/bootstrap/generated.ts +540 -0
  130. package/src/cli/cli.ts +64 -21
  131. package/src/client.ts +23 -357
  132. package/src/clients/civitai/index.ts +1 -1
  133. package/src/clients/client-template.ts +1 -1
  134. package/src/clients/comfyui/index.ts +13 -2
  135. package/src/clients/elevenlabs/index.ts +2 -1
  136. package/src/clients/graph.ts +87 -0
  137. package/src/clients/openai/index.ts +10 -1
  138. package/src/clients/rest.ts +207 -0
  139. package/src/clients/websocket.ts +176 -0
  140. package/src/command.ts +281 -34
  141. package/src/commands/bootstrap.ts +181 -0
  142. package/src/commands/chat.ts +5 -4
  143. package/src/commands/describe.ts +225 -2
  144. package/src/commands/help.ts +35 -9
  145. package/src/commands/index.ts +3 -0
  146. package/src/commands/introspect.ts +92 -2
  147. package/src/commands/prompt.ts +5 -6
  148. package/src/commands/run.ts +33 -10
  149. package/src/commands/save-api-docs.ts +49 -0
  150. package/src/commands/scaffold.ts +169 -23
  151. package/src/commands/select.ts +94 -0
  152. package/src/commands/serve.ts +10 -1
  153. package/src/container.ts +15 -0
  154. package/src/endpoint.ts +19 -0
  155. package/src/graft.ts +181 -0
  156. package/src/introspection/generated.agi.ts +12458 -8968
  157. package/src/introspection/generated.node.ts +10573 -7145
  158. package/src/introspection/generated.web.ts +1 -1
  159. package/src/introspection/index.ts +26 -0
  160. package/src/node/container.ts +6 -7
  161. package/src/node/features/content-db.ts +49 -2
  162. package/src/node/features/disk-cache.ts +16 -9
  163. package/src/node/features/dns.ts +16 -3
  164. package/src/node/features/docker.ts +16 -4
  165. package/src/node/features/esbuild.ts +20 -0
  166. package/src/node/features/file-manager.ts +184 -29
  167. package/src/node/features/fs.ts +704 -248
  168. package/src/node/features/git.ts +21 -8
  169. package/src/node/features/grep.ts +23 -3
  170. package/src/node/features/helpers.ts +372 -43
  171. package/src/node/features/networking.ts +39 -4
  172. package/src/node/features/opener.ts +28 -15
  173. package/src/node/features/os.ts +76 -0
  174. package/src/node/features/port-exposer.ts +11 -1
  175. package/src/node/features/postgres.ts +17 -1
  176. package/src/node/features/proc.ts +4 -1
  177. package/src/node/features/python.ts +63 -14
  178. package/src/node/features/repl.ts +11 -7
  179. package/src/node/features/runpod.ts +16 -3
  180. package/src/node/features/secure-shell.ts +27 -2
  181. package/src/node/features/semantic-search.ts +12 -1
  182. package/src/node/features/ui.ts +5 -69
  183. package/src/node/features/vm.ts +17 -0
  184. package/src/node/features/window-manager.ts +68 -20
  185. package/src/node.ts +5 -0
  186. package/src/scaffolds/generated.ts +492 -290
  187. package/src/scaffolds/template.ts +9 -0
  188. package/src/schemas/base.ts +46 -5
  189. package/src/selector.ts +282 -0
  190. package/src/server.ts +11 -0
  191. package/src/servers/express.ts +27 -12
  192. package/src/servers/socket.ts +45 -11
  193. package/src/web/clients/socket.ts +4 -1
  194. package/src/web/container.ts +2 -1
  195. package/src/web/features/network.ts +7 -1
  196. package/src/web/features/voice-recognition.ts +16 -1
  197. package/test/clients-servers.test.ts +2 -1
  198. package/test/command.test.ts +267 -0
  199. package/test-integration/assistants-manager.test.ts +10 -20
  200. package/tmp/.cache/luca-disk-cache/content-v2/sha512/1b/b5/c75b28794f00f94c4d609a98978e9420e9b7146d204a7fbf5b0b30477292581705d207c0100dabaac27eef540aaaece3374af75104a93219d4ec8bfb44e7 +1 -0
  201. package/tmp/.cache/luca-disk-cache/content-v2/sha512/da/df/1d90ce4e042abeb035a197832c6d6893420a747a056be773eb00e4f745a037d505c8db13dde7d36b36b6b893addbb7df0f5fe9f0c13e665f20056447318b +1 -0
  202. package/tmp/.cache/luca-disk-cache/content-v2/sha512/ed/04/e1d0c2a58c2db29b3921ca2affb3ea4febe831c53b38ebc21019fb799823aba6ed5b4611873d2cd25d422d49955b852a9c326da0d678899bc1c2c2960901 +1 -0
  203. package/tmp/.cache/luca-disk-cache/index-v5/00/13/572aa4c9a94f99eda999695d050cdd0ca7fe2d23a50af03234d4c8ce0791 +2 -0
  204. package/tmp/.cache/luca-disk-cache/index-v5/75/a9/cb61dc0f0589e8ec10a9aca27b834bc73884c479941042d22a2b22324cd3 +2 -0
  205. package/tmp/.cache/luca-disk-cache/index-v5/9f/0f/8b1f915ee64cfff7667dd96acd7a5ac0a96aa91a346e19cefd45909a9c9c +2 -0
  206. package/docs/apis/features/node/launcher-app-command-listener.md +0 -145
  207. package/docs/examples/launcher-app-command-listener.md +0 -120
  208. package/docs/tasks/web-container-helper-discovery.md +0 -71
  209. package/docs/todos.md +0 -1
  210. package/scripts/test-command-listener.ts +0 -123
  211. package/src/node/features/launcher-app-command-listener.ts +0 -389
@@ -1,6 +1,6 @@
1
1
  # WebSocketClient (clients.websocket)
2
2
 
3
- No description provided
3
+ WebSocket client that bridges raw WebSocket events to Luca's Helper event bus, providing a clean interface for sending/receiving messages, tracking connection state, and optional auto-reconnection with exponential backoff. Events emitted: - `open` — connection established - `message` — message received (JSON-parsed when possible) - `close` — connection closed (with code and reason) - `error` — connection error - `reconnecting` — attempting reconnection (with attempt number)
4
4
 
5
5
  ## Usage
6
6
 
@@ -29,17 +29,61 @@ container.client('websocket', {
29
29
  | `reconnectInterval` | `number` | Base interval in milliseconds between reconnection attempts |
30
30
  | `maxReconnectAttempts` | `number` | Maximum number of reconnection attempts before giving up |
31
31
 
32
+ ## Methods
33
+
34
+ ### connect
35
+
36
+ Establish a WebSocket connection to the configured baseURL. Wires all raw WebSocket events (open, message, close, error) to the Helper event bus and updates connection state accordingly. Resolves once the connection is open; rejects on error.
37
+
38
+ **Returns:** `Promise<this>`
39
+
40
+
41
+
42
+ ### send
43
+
44
+ Send data over the WebSocket connection. Automatically JSON-serializes the payload. If not currently connected, attempts to connect first.
45
+
46
+ **Parameters:**
47
+
48
+ | Name | Type | Required | Description |
49
+ |------|------|----------|-------------|
50
+ | `data` | `any` | ✓ | The data to send (will be JSON.stringify'd) |
51
+
52
+ **Returns:** `Promise<void>`
53
+
54
+
55
+
56
+ ### disconnect
57
+
58
+ Gracefully close the WebSocket connection. Suppresses auto-reconnect and updates connection state to disconnected.
59
+
60
+ **Returns:** `Promise<this>`
61
+
62
+
63
+
64
+ ## Getters
65
+
66
+ | Property | Type | Description |
67
+ |----------|------|-------------|
68
+ | `hasError` | `any` | Whether the client is in an error state. |
69
+
32
70
  ## Events (Zod v4 schema)
33
71
 
34
- ### failure
72
+ ### open
35
73
 
36
- Emitted when a request fails
74
+ Emitted when the WebSocket connection is established
75
+
76
+
77
+
78
+ ### error
79
+
80
+ Emitted when a WebSocket error occurs
37
81
 
38
82
  **Event Arguments:**
39
83
 
40
84
  | Name | Type | Description |
41
85
  |------|------|-------------|
42
- | `arg0` | `any` | The error object |
86
+ | `arg0` | `any` | The error |
43
87
 
44
88
 
45
89
 
@@ -55,12 +99,6 @@ Emitted when a message is received
55
99
 
56
100
 
57
101
 
58
- ### open
59
-
60
- Emitted when the WebSocket connection is established
61
-
62
-
63
-
64
102
  ### close
65
103
 
66
104
  Emitted when the WebSocket connection is closed
@@ -74,27 +112,27 @@ Emitted when the WebSocket connection is closed
74
112
 
75
113
 
76
114
 
77
- ### error
115
+ ### reconnecting
78
116
 
79
- Emitted when a WebSocket error occurs
117
+ Emitted when attempting to reconnect
80
118
 
81
119
  **Event Arguments:**
82
120
 
83
121
  | Name | Type | Description |
84
122
  |------|------|-------------|
85
- | `arg0` | `any` | The error |
123
+ | `arg0` | `number` | Attempt number |
86
124
 
87
125
 
88
126
 
89
- ### reconnecting
127
+ ### failure
90
128
 
91
- Emitted when attempting to reconnect
129
+ Emitted when a request fails
92
130
 
93
131
  **Event Arguments:**
94
132
 
95
133
  | Name | Type | Description |
96
134
  |------|------|-------------|
97
- | `arg0` | `number` | Attempt number |
135
+ | `arg0` | `any` | The error object |
98
136
 
99
137
 
100
138
 
@@ -104,4 +142,20 @@ Emitted when attempting to reconnect
104
142
  |----------|------|-------------|
105
143
  | `connected` | `boolean` | Whether the client is currently connected |
106
144
  | `connectionError` | `any` | The last connection error, if any |
107
- | `reconnectAttempts` | `number` | Number of reconnection attempts made |
145
+ | `reconnectAttempts` | `number` | Number of reconnection attempts made |
146
+
147
+ ## Examples
148
+
149
+ **clients.websocket**
150
+
151
+ ```ts
152
+ const ws = container.client('websocket', {
153
+ baseURL: 'ws://localhost:8080',
154
+ reconnect: true,
155
+ maxReconnectAttempts: 5
156
+ })
157
+ ws.on('message', (data) => console.log('Received:', data))
158
+ await ws.connect()
159
+ await ws.send({ type: 'hello' })
160
+ ```
161
+
@@ -1,6 +1,6 @@
1
1
  # Assistant (features.assistant)
2
2
 
3
- No description provided
3
+ An Assistant is a combination of a system prompt and tool calls that has a conversation with an LLM. You define an assistant by creating a folder with CORE.md (system prompt), tools.ts (tool implementations), and hooks.ts (event handlers).
4
4
 
5
5
  ## Usage
6
6
 
@@ -22,6 +22,8 @@ container.feature('assistant', {
22
22
  model,
23
23
  // Maximum number of output tokens per completion
24
24
  maxTokens,
25
+ // Whether to use our local models for this
26
+ local,
25
27
  // Conversation history persistence mode
26
28
  historyMode,
27
29
  })
@@ -39,6 +41,7 @@ container.feature('assistant', {
39
41
  | `schemas` | `object` | Override or extend schemas whose keys match tool names |
40
42
  | `model` | `string` | OpenAI model to use |
41
43
  | `maxTokens` | `number` | Maximum number of output tokens per completion |
44
+ | `local` | `boolean` | Whether to use our local models for this |
42
45
  | `historyMode` | `string` | Conversation history persistence mode |
43
46
 
44
47
  ## Methods
@@ -242,6 +245,7 @@ Save the conversation to disk via conversationHistory.
242
245
 
243
246
  | Property | Type | Description |
244
247
  |----------|------|-------------|
248
+ | `name` | `any` | |
245
249
  | `resolvedFolder` | `string` | The absolute resolved path to the assistant folder. |
246
250
  | `corePromptPath` | `string` | The path to CORE.md which provides the system prompt. |
247
251
  | `toolsModulePath` | `string` | The path to tools.ts which provides tool implementations and schemas. |
@@ -290,7 +294,8 @@ Emitted when a new completion turn begins. isFollowUp is true when resuming afte
290
294
 
291
295
  | Name | Type | Description |
292
296
  |------|------|-------------|
293
- | `arg0` | `object` | |
297
+ | `turn` | `number` | |
298
+ | `isFollowUp` | `boolean` | |
294
299
 
295
300
 
296
301
 
@@ -302,7 +307,8 @@ Emitted when a completion turn ends. hasToolCalls indicates whether tool calls w
302
307
 
303
308
  | Name | Type | Description |
304
309
  |------|------|-------------|
305
- | `arg0` | `object` | |
310
+ | `turn` | `number` | |
311
+ | `hasToolCalls` | `boolean` | |
306
312
 
307
313
 
308
314
 
@@ -1,6 +1,6 @@
1
1
  # AssistantsManager (features.assistantsManager)
2
2
 
3
- No description provided
3
+ Discovers and manages assistant definitions by finding all CORE.md files in the project using the fileManager. Each directory containing a CORE.md is treated as an assistant definition that can also contain tools.ts, hooks.ts, voice.yaml, and a docs/ folder. Use `discover()` to scan for available assistants, `list()` to enumerate them, and `create(name)` to instantiate one as a running Assistant feature.
4
4
 
5
5
  ## Usage
6
6
 
@@ -29,7 +29,7 @@ container.feature('assistantsManager', {
29
29
 
30
30
  Discovers assistants by finding all CORE.md files in the project using the fileManager. Each directory containing a CORE.md is treated as an assistant definition.
31
31
 
32
- **Returns:** `this`
32
+ **Returns:** `Promise<this>`
33
33
 
34
34
 
35
35
 
@@ -1,11 +1,13 @@
1
1
  # ClaudeCode (features.claudeCode)
2
2
 
3
- No description provided
3
+ Claude Code CLI wrapper feature. Spawns and manages Claude Code sessions as subprocesses, streaming structured JSON events back through the container's event system. Sessions are long-lived: each call to `run()` spawns a `claude -p` process with `--output-format stream-json`, parses NDJSON from stdout line-by-line, and emits typed events on the feature's event bus.
4
4
 
5
5
  ## Usage
6
6
 
7
7
  ```ts
8
8
  container.feature('claudeCode', {
9
+ // Claude CLI session ID to resume by default
10
+ session,
9
11
  // Path to the claude CLI binary
10
12
  claudePath,
11
13
  // Default model to use for sessions
@@ -57,6 +59,7 @@ container.feature('claudeCode', {
57
59
 
58
60
  | Property | Type | Description |
59
61
  |----------|------|-------------|
62
+ | `session` | `string` | Claude CLI session ID to resume by default |
60
63
  | `claudePath` | `string` | Path to the claude CLI binary |
61
64
  | `model` | `string` | Default model to use for sessions |
62
65
  | `cwd` | `string` | Default working directory for sessions |
@@ -356,6 +359,31 @@ const sessionStats = cc.usage(sessionId)
356
359
 
357
360
 
358
361
 
362
+ ### sessionHistoryToMarkdown
363
+
364
+ Export session history as a readable markdown document. Reads from a raw JSONL file (Claude CLI session log or this feature's NDJSON log) so it works independently of in-memory state. Can also accept a local session ID to export from in-memory state as a fallback.
365
+
366
+ **Parameters:**
367
+
368
+ | Name | Type | Required | Description |
369
+ |------|------|----------|-------------|
370
+ | `source` | `string` | | Path to a JSONL file, a local session ID, or omit for the most recent session |
371
+
372
+ **Returns:** `Promise<string>`
373
+
374
+ ```ts
375
+ // From a JSONL file (works without any prior state)
376
+ const md = await cc.sessionHistoryToMarkdown('/path/to/session.jsonl')
377
+
378
+ // From the most recent in-memory session
379
+ const md = await cc.sessionHistoryToMarkdown()
380
+
381
+ // From a specific local session ID
382
+ const md = await cc.sessionHistoryToMarkdown(localSessionId)
383
+ ```
384
+
385
+
386
+
359
387
  ### cleanupMcpTempFiles
360
388
 
361
389
  Clean up any temp MCP config files created during sessions.
@@ -382,80 +410,166 @@ Initialize the feature.
382
410
 
383
411
  | Property | Type | Description |
384
412
  |----------|------|-------------|
385
- | `claudePath` | `string` | Resolve the path to the claude CLI binary. |
413
+ | `claudePath` | `string` | |
386
414
  | `parsedVersion` | `{ major: number; minor: number; patch: number } | undefined` | Parsed semver components from the detected CLI version, or undefined if not yet checked. |
415
+ | `sessionId` | `string | undefined` | The Claude CLI session ID of the most recently initialized session, or the session set via the `session` option. Useful for resuming later. |
387
416
 
388
417
  ## Events (Zod v4 schema)
389
418
 
390
419
  ### session:warning
391
420
 
392
- Event emitted by ClaudeCode
421
+ Fired when the log reader encounters a warning
422
+
423
+ **Event Arguments:**
424
+
425
+ | Name | Type | Description |
426
+ |------|------|-------------|
427
+ | `sessionId` | `string` | |
428
+ | `message` | `string` | |
393
429
 
394
430
 
395
431
 
396
432
  ### session:log-error
397
433
 
398
- Event emitted by ClaudeCode
434
+ Fired when the log reader encounters an error
435
+
436
+ **Event Arguments:**
437
+
438
+ | Name | Type | Description |
439
+ |------|------|-------------|
440
+ | `sessionId` | `string` | |
441
+ | `error` | `any` | |
399
442
 
400
443
 
401
444
 
402
445
  ### session:event
403
446
 
404
- Event emitted by ClaudeCode
447
+ Fired for every parsed JSON event from the CLI stream
448
+
449
+ **Event Arguments:**
450
+
451
+ | Name | Type | Description |
452
+ |------|------|-------------|
453
+ | `sessionId` | `string` | |
454
+ | `event` | `any` | |
405
455
 
406
456
 
407
457
 
408
458
  ### session:init
409
459
 
410
- Event emitted by ClaudeCode
460
+ Fired when the CLI emits its init system event
461
+
462
+ **Event Arguments:**
463
+
464
+ | Name | Type | Description |
465
+ |------|------|-------------|
466
+ | `sessionId` | `string` | |
467
+ | `init` | `any` | |
411
468
 
412
469
 
413
470
 
414
471
  ### session:delta
415
472
 
416
- Event emitted by ClaudeCode
473
+ Fired for each text delta from an assistant message
474
+
475
+ **Event Arguments:**
476
+
477
+ | Name | Type | Description |
478
+ |------|------|-------------|
479
+ | `sessionId` | `string` | |
480
+ | `text` | `string` | |
481
+ | `role` | `string` | |
417
482
 
418
483
 
419
484
 
420
485
  ### session:stream
421
486
 
422
- Event emitted by ClaudeCode
487
+ Fired for stream_event type events from the CLI
488
+
489
+ **Event Arguments:**
490
+
491
+ | Name | Type | Description |
492
+ |------|------|-------------|
493
+ | `sessionId` | `string` | |
494
+ | `streamEvent` | `any` | |
423
495
 
424
496
 
425
497
 
426
498
  ### session:message
427
499
 
428
- Event emitted by ClaudeCode
500
+ Fired when a complete assistant message is received
501
+
502
+ **Event Arguments:**
503
+
504
+ | Name | Type | Description |
505
+ |------|------|-------------|
506
+ | `sessionId` | `string` | |
507
+ | `message` | `any` | |
429
508
 
430
509
 
431
510
 
432
511
  ### session:result
433
512
 
434
- Event emitted by ClaudeCode
513
+ Fired when a session completes with a final result
514
+
515
+ **Event Arguments:**
516
+
517
+ | Name | Type | Description |
518
+ |------|------|-------------|
519
+ | `sessionId` | `string` | |
520
+ | `result` | `string` | |
435
521
 
436
522
 
437
523
 
438
524
  ### session:start
439
525
 
440
- Event emitted by ClaudeCode
526
+ Fired when a new Claude Code session is spawned
527
+
528
+ **Event Arguments:**
529
+
530
+ | Name | Type | Description |
531
+ |------|------|-------------|
532
+ | `sessionId` | `string` | |
533
+ | `prompt` | `string` | |
441
534
 
442
535
 
443
536
 
444
537
  ### session:error
445
538
 
446
- Event emitted by ClaudeCode
539
+ Fired when a session encounters an error
540
+
541
+ **Event Arguments:**
542
+
543
+ | Name | Type | Description |
544
+ |------|------|-------------|
545
+ | `sessionId` | `string` | |
546
+ | `error` | `any` | |
547
+ | `exitCode` | `number` | |
447
548
 
448
549
 
449
550
 
450
551
  ### session:parse-error
451
552
 
452
- Event emitted by ClaudeCode
553
+ Fired when a JSON line from the CLI cannot be parsed
554
+
555
+ **Event Arguments:**
556
+
557
+ | Name | Type | Description |
558
+ |------|------|-------------|
559
+ | `sessionId` | `string` | |
560
+ | `line` | `string` | |
453
561
 
454
562
 
455
563
 
456
564
  ### session:abort
457
565
 
458
- Event emitted by ClaudeCode
566
+ Fired when a session is aborted by the user
567
+
568
+ **Event Arguments:**
569
+
570
+ | Name | Type | Description |
571
+ |------|------|-------------|
572
+ | `sessionId` | `string` | |
459
573
 
460
574
 
461
575
 
@@ -600,3 +714,28 @@ console.log(`Tokens: ${stats.totalInputTokens} in / ${stats.totalOutputTokens} o
600
714
  const sessionStats = cc.usage(sessionId)
601
715
  ```
602
716
 
717
+
718
+
719
+ **sessionHistoryToMarkdown**
720
+
721
+ ```ts
722
+ // From a JSONL file (works without any prior state)
723
+ const md = await cc.sessionHistoryToMarkdown('/path/to/session.jsonl')
724
+
725
+ // From the most recent in-memory session
726
+ const md = await cc.sessionHistoryToMarkdown()
727
+
728
+ // From a specific local session ID
729
+ const md = await cc.sessionHistoryToMarkdown(localSessionId)
730
+ ```
731
+
732
+
733
+
734
+ **sessionId**
735
+
736
+ ```ts
737
+ const cc = container.feature('claudeCode')
738
+ await cc.run('Do something')
739
+ console.log(cc.sessionId) // the Claude CLI session ID
740
+ ```
741
+
@@ -1,6 +1,6 @@
1
1
  # ConversationHistory (features.conversationHistory)
2
2
 
3
- No description provided
3
+ Persists conversations to disk using the diskCache feature (cacache). Each conversation is stored as a JSON blob keyed by ID, with metadata stored alongside for efficient listing and search without loading full message arrays.
4
4
 
5
5
  ## Usage
6
6
 
@@ -314,13 +314,25 @@ Delete all conversations matching a thread prefix.
314
314
 
315
315
  ### saved
316
316
 
317
- Event emitted by ConversationHistory
317
+ Fired after a conversation record is persisted
318
+
319
+ **Event Arguments:**
320
+
321
+ | Name | Type | Description |
322
+ |------|------|-------------|
323
+ | `arg0` | `string` | The conversation ID that was saved |
318
324
 
319
325
 
320
326
 
321
327
  ### deleted
322
328
 
323
- Event emitted by ConversationHistory
329
+ Fired after a conversation record is deleted
330
+
331
+ **Event Arguments:**
332
+
333
+ | Name | Type | Description |
334
+ |------|------|-------------|
335
+ | `arg0` | `string` | The conversation ID that was deleted |
324
336
 
325
337
 
326
338