@dreb/coding-agent 2.46.0 → 2.47.0

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 (48) hide show
  1. package/README.md +4 -2
  2. package/dist/core/agent-session.d.ts.map +1 -1
  3. package/dist/core/agent-session.js +19 -8
  4. package/dist/core/agent-session.js.map +1 -1
  5. package/dist/core/extensions/index.d.ts +1 -1
  6. package/dist/core/extensions/index.d.ts.map +1 -1
  7. package/dist/core/extensions/index.js.map +1 -1
  8. package/dist/core/extensions/runner.d.ts +7 -0
  9. package/dist/core/extensions/runner.d.ts.map +1 -1
  10. package/dist/core/extensions/runner.js +10 -0
  11. package/dist/core/extensions/runner.js.map +1 -1
  12. package/dist/core/extensions/types.d.ts +35 -0
  13. package/dist/core/extensions/types.d.ts.map +1 -1
  14. package/dist/core/extensions/types.js.map +1 -1
  15. package/dist/core/sdk.d.ts.map +1 -1
  16. package/dist/core/sdk.js +1 -0
  17. package/dist/core/sdk.js.map +1 -1
  18. package/dist/core/session-manager.d.ts.map +1 -1
  19. package/dist/core/session-manager.js +38 -2
  20. package/dist/core/session-manager.js.map +1 -1
  21. package/dist/core/tools/ask-user.d.ts +45 -0
  22. package/dist/core/tools/ask-user.d.ts.map +1 -0
  23. package/dist/core/tools/ask-user.js +210 -0
  24. package/dist/core/tools/ask-user.js.map +1 -0
  25. package/dist/core/tools/index.d.ts +11 -0
  26. package/dist/core/tools/index.d.ts.map +1 -1
  27. package/dist/core/tools/index.js +8 -0
  28. package/dist/core/tools/index.js.map +1 -1
  29. package/dist/modes/interactive/components/ask-user.d.ts +59 -0
  30. package/dist/modes/interactive/components/ask-user.d.ts.map +1 -0
  31. package/dist/modes/interactive/components/ask-user.js +240 -0
  32. package/dist/modes/interactive/components/ask-user.js.map +1 -0
  33. package/dist/modes/interactive/interactive-mode.d.ts +12 -0
  34. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  35. package/dist/modes/interactive/interactive-mode.js +92 -5
  36. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  37. package/dist/modes/rpc/rpc-mode.d.ts +16 -1
  38. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  39. package/dist/modes/rpc/rpc-mode.js +112 -59
  40. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  41. package/dist/modes/rpc/rpc-types.d.ts +24 -0
  42. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  43. package/dist/modes/rpc/rpc-types.js.map +1 -1
  44. package/docs/dashboard.md +1 -1
  45. package/docs/extensions.md +33 -3
  46. package/docs/rpc.md +45 -6
  47. package/docs/session.md +1 -1
  48. package/package.json +1 -1
package/docs/rpc.md CHANGED
@@ -224,17 +224,17 @@ The `model` field is a full [Model](#model) object or `null`. `scopedModels` is
224
224
 
225
225
  #### get_dashboard_snapshot
226
226
 
227
- Capture the dashboard-visible parent-session state, full parent transcript, and background-agent registry at one RPC command boundary. This is for authoritative recovery, not ordinary incremental refreshes.
227
+ Capture the dashboard-visible parent-session state, full parent transcript, background-agent registry, and blocking extension UI requests at one RPC command boundary. This is for authoritative recovery, not ordinary incremental refreshes.
228
228
 
229
229
  ```json
230
230
  {"id": "snapshot-7", "type": "get_dashboard_snapshot"}
231
231
  ```
232
232
 
233
- The `RpcDashboardSnapshot` result is a `snapshotId`, a complete `RpcSessionState` (including `tasks`), `messages`, and `backgroundAgents`. The RPC child writes a `RpcDashboardSnapshotBarrierEvent` to stdout **immediately before** the matching response line:
233
+ The `RpcDashboardSnapshot` result is a `snapshotId`, a complete `RpcSessionState` (including `tasks`), `messages`, `backgroundAgents`, and `pendingExtensionUiRequests`. The last field contains every blocking `select`, `confirm`, `input`, `editor`, or `ask` request still awaiting a host response, so a recovering Dashboard can restore the answer UI instead of leaving the runtime blocked. The RPC child writes a `RpcDashboardSnapshotBarrierEvent` to stdout **immediately before** the matching response line:
234
234
 
235
235
  ```json
236
236
  {"type":"dashboard_snapshot_barrier","snapshotId":"snapshot-7"}
237
- {"id":"snapshot-7","type":"response","command":"get_dashboard_snapshot","success":true,"data":{"snapshotId":"snapshot-7","state":{...},"messages":[...],"backgroundAgents":[...]}}
237
+ {"id":"snapshot-7","type":"response","command":"get_dashboard_snapshot","success":true,"data":{"snapshotId":"snapshot-7","state":{...},"messages":[...],"backgroundAgents":[...],"pendingExtensionUiRequests":[...]}}
238
238
  ```
239
239
 
240
240
  Stdout JSONL ordering is the contract: a relay records its current event-stream sequence when the marker arrives, before resolving the response, and pairs the snapshot only with that exact marker. The dashboard returns that captured sequence as `/api/resync.barrierSeq`; consumers discard queued events through it and replay only later events. The marker itself is not broadcast as another browser event, so one recovering client does not interrupt healthy clients. Do not infer ordering from request/response timing; see [dashboard recovery](dashboard.md#live-connection-and-recovery).
@@ -1925,7 +1925,7 @@ Extensions can request user interaction via `ctx.ui.select()`, `ctx.ui.confirm()
1925
1925
 
1926
1926
  There are two categories of extension UI methods:
1927
1927
 
1928
- - **Dialog methods** (`select`, `confirm`, `input`, `editor`): emit an `extension_ui_request` on stdout and block until the client sends back an `extension_ui_response` on stdin with the matching `id`.
1928
+ - **Dialog methods** (`select`, `confirm`, `input`, `editor`, `ask`): emit an `extension_ui_request` on stdout and block until the client sends back an `extension_ui_response` on stdin with the matching `id`.
1929
1929
  - **Fire-and-forget methods** (`notify`, `setStatus`, `setWidget`, `setTitle`, `set_editor_text`): emit an `extension_ui_request` on stdout but do not expect a response. The client can display the information or ignore it.
1930
1930
 
1931
1931
  If a dialog method includes a `timeout` field, the agent-side will auto-resolve with a default value when the timeout expires. The client does not need to track timeouts.
@@ -2012,6 +2012,34 @@ Open a multi-line text editor with optional prefilled content.
2012
2012
 
2013
2013
  Expected response: `extension_ui_response` with `value` (the edited text) or `cancelled: true`.
2014
2014
 
2015
+ #### ask
2016
+
2017
+ Ask the user a rich clarifying question with Markdown-formatted question text, optional single- or multi-select options, and an optional free-text field. This powers the built-in `ask_user` tool. `options` (2-4 nonblank strings) is optional; `allowFreeText` (default `true`), `multiSelect`, and `multiline` are optional booleans.
2018
+
2019
+ ```json
2020
+ {
2021
+ "type": "extension_ui_request",
2022
+ "id": "uuid-5",
2023
+ "method": "ask",
2024
+ "title": "Choose a database",
2025
+ "question": "Which persistence strategy should I use?",
2026
+ "options": ["SQLite", "PostgreSQL", "Keep the JSON file"],
2027
+ "allowFreeText": true,
2028
+ "multiSelect": false,
2029
+ "multiline": false,
2030
+ "timeout": 60000,
2031
+ "expiresAt": 1785434460000
2032
+ }
2033
+ ```
2034
+
2035
+ `timeout` is the original duration in milliseconds. `expiresAt` is the corresponding absolute Unix timestamp in milliseconds; Dashboard clients should use it for the visible countdown so reload, resync, or drill-in recovery does not restart the full duration.
2036
+
2037
+ Expected response: `extension_ui_response` with `selected` (an array of strings) and optional string `customText` (the typed answer). Sending `cancelled: true`, or an empty `selected` with no nonblank `customText`, stops the current agent turn rather than continuing without an answer. A timeout has the same stop semantics. Other malformed ask responses are rejected as protocol failures.
2038
+
2039
+ ```json
2040
+ { "type": "extension_ui_response", "id": "uuid-5", "selected": ["SQLite"], "customText": "with WAL enabled" }
2041
+ ```
2042
+
2015
2043
  #### notify
2016
2044
 
2017
2045
  Display a notification. Fire-and-forget, no response expected.
@@ -2089,7 +2117,7 @@ Set the text in the input editor. Fire-and-forget.
2089
2117
 
2090
2118
  ### Extension UI Responses (stdin)
2091
2119
 
2092
- Responses are sent for dialog methods only (`select`, `confirm`, `input`, `editor`). The `id` must match the request.
2120
+ Responses are sent for dialog methods only (`select`, `confirm`, `input`, `editor`, `ask`). The `id` must match the request.
2093
2121
 
2094
2122
  #### Value response (select, input, editor)
2095
2123
 
@@ -2105,12 +2133,23 @@ Responses are sent for dialog methods only (`select`, `confirm`, `input`, `edito
2105
2133
 
2106
2134
  #### Cancellation response (any dialog)
2107
2135
 
2108
- Dismiss any dialog method. The extension receives `undefined` (for select/input/editor) or `false` (for confirm).
2136
+ Dismiss any dialog method. The extension receives `undefined` (for select/input/editor) or `false` (for confirm). For `ask`, cancellation returns `undefined` while stopping the current agent turn.
2109
2137
 
2110
2138
  ```json
2111
2139
  {"type": "extension_ui_response", "id": "uuid-3", "cancelled": true}
2112
2140
  ```
2113
2141
 
2142
+ After any dialog settles, RPC emits a lifecycle event on stdout so hosts can
2143
+ remove the matching UI even when the dialog ended locally because of timeout,
2144
+ abort, or runtime shutdown:
2145
+
2146
+ ```json
2147
+ {"type": "extension_ui_response_handled", "id": "uuid-3"}
2148
+ ```
2149
+
2150
+ Hosts should treat this event as idempotent; it can arrive after the host has
2151
+ already removed a successfully answered request.
2152
+
2114
2153
  ## Error Handling
2115
2154
 
2116
2155
  Failed commands return a response with `success: false`:
package/docs/session.md CHANGED
@@ -388,7 +388,7 @@ Key methods for working with sessions programmatically.
388
388
  ### Instance Methods - Session Management
389
389
  - `newSession(options?)` - Start a new session (options: `{ parentSession?: string }`)
390
390
  - `setSessionFile(path)` - Switch to a different session file
391
- - `createBranchedSession(leafId)` - Extract branch to new session file
391
+ - `createBranchedSession(leafId)` - Extract a branch to a new session file while preserving the current session name metadata
392
392
 
393
393
  ### Instance Methods - Appending (all return entry ID)
394
394
  - `appendMessage(message)` - Add message
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreb/coding-agent",
3
- "version": "2.46.0",
3
+ "version": "2.47.0",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "drebConfig": {