@dreb/coding-agent 2.46.0 → 2.48.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.
- package/README.md +4 -2
- package/dist/core/agent-session.d.ts +22 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +109 -20
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +7 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +10 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +35 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/k3-context-tier.d.ts +67 -0
- package/dist/core/k3-context-tier.d.ts.map +1 -0
- package/dist/core/k3-context-tier.js +76 -0
- package/dist/core/k3-context-tier.js.map +1 -0
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +6 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +38 -2
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/tools/ask-user.d.ts +45 -0
- package/dist/core/tools/ask-user.d.ts.map +1 -0
- package/dist/core/tools/ask-user.js +210 -0
- package/dist/core/tools/ask-user.js.map +1 -0
- package/dist/core/tools/index.d.ts +11 -0
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +8 -0
- package/dist/core/tools/index.js.map +1 -1
- package/dist/modes/interactive/components/ask-user.d.ts +59 -0
- package/dist/modes/interactive/components/ask-user.d.ts.map +1 -0
- package/dist/modes/interactive/components/ask-user.js +240 -0
- package/dist/modes/interactive/components/ask-user.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +12 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +99 -5
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +16 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +112 -59
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +24 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/docs/dashboard.md +1 -1
- package/docs/extensions.md +33 -3
- package/docs/providers.md +1 -0
- package/docs/rpc.md +46 -6
- package/docs/session.md +1 -1
- 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,
|
|
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 `
|
|
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).
|
|
@@ -1617,6 +1617,7 @@ Response:
|
|
|
1617
1617
|
| `length_retry` | Response hit the token limit; retrying with a larger budget |
|
|
1618
1618
|
| `auto_compaction_start` | Auto-compaction begins |
|
|
1619
1619
|
| `auto_compaction_end` | Auto-compaction completes |
|
|
1620
|
+
| `context_window_upgrade` | Wire model tier auto-upgraded (e.g. Kimi K3 256k → 1M); includes `provider`, `modelId`, `fromContextWindow`, `toContextWindow` |
|
|
1620
1621
|
| `auto_retry_start` | Auto-retry begins (after transient error) |
|
|
1621
1622
|
| `auto_retry_end` | Auto-retry completes (success or final failure) |
|
|
1622
1623
|
| `background_agent_start` | Background subagent launched (includes `sessionDir`) |
|
|
@@ -1925,7 +1926,7 @@ Extensions can request user interaction via `ctx.ui.select()`, `ctx.ui.confirm()
|
|
|
1925
1926
|
|
|
1926
1927
|
There are two categories of extension UI methods:
|
|
1927
1928
|
|
|
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`.
|
|
1929
|
+
- **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
1930
|
- **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
1931
|
|
|
1931
1932
|
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 +2013,34 @@ Open a multi-line text editor with optional prefilled content.
|
|
|
2012
2013
|
|
|
2013
2014
|
Expected response: `extension_ui_response` with `value` (the edited text) or `cancelled: true`.
|
|
2014
2015
|
|
|
2016
|
+
#### ask
|
|
2017
|
+
|
|
2018
|
+
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.
|
|
2019
|
+
|
|
2020
|
+
```json
|
|
2021
|
+
{
|
|
2022
|
+
"type": "extension_ui_request",
|
|
2023
|
+
"id": "uuid-5",
|
|
2024
|
+
"method": "ask",
|
|
2025
|
+
"title": "Choose a database",
|
|
2026
|
+
"question": "Which persistence strategy should I use?",
|
|
2027
|
+
"options": ["SQLite", "PostgreSQL", "Keep the JSON file"],
|
|
2028
|
+
"allowFreeText": true,
|
|
2029
|
+
"multiSelect": false,
|
|
2030
|
+
"multiline": false,
|
|
2031
|
+
"timeout": 60000,
|
|
2032
|
+
"expiresAt": 1785434460000
|
|
2033
|
+
}
|
|
2034
|
+
```
|
|
2035
|
+
|
|
2036
|
+
`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.
|
|
2037
|
+
|
|
2038
|
+
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.
|
|
2039
|
+
|
|
2040
|
+
```json
|
|
2041
|
+
{ "type": "extension_ui_response", "id": "uuid-5", "selected": ["SQLite"], "customText": "with WAL enabled" }
|
|
2042
|
+
```
|
|
2043
|
+
|
|
2015
2044
|
#### notify
|
|
2016
2045
|
|
|
2017
2046
|
Display a notification. Fire-and-forget, no response expected.
|
|
@@ -2089,7 +2118,7 @@ Set the text in the input editor. Fire-and-forget.
|
|
|
2089
2118
|
|
|
2090
2119
|
### Extension UI Responses (stdin)
|
|
2091
2120
|
|
|
2092
|
-
Responses are sent for dialog methods only (`select`, `confirm`, `input`, `editor`). The `id` must match the request.
|
|
2121
|
+
Responses are sent for dialog methods only (`select`, `confirm`, `input`, `editor`, `ask`). The `id` must match the request.
|
|
2093
2122
|
|
|
2094
2123
|
#### Value response (select, input, editor)
|
|
2095
2124
|
|
|
@@ -2105,12 +2134,23 @@ Responses are sent for dialog methods only (`select`, `confirm`, `input`, `edito
|
|
|
2105
2134
|
|
|
2106
2135
|
#### Cancellation response (any dialog)
|
|
2107
2136
|
|
|
2108
|
-
Dismiss any dialog method. The extension receives `undefined` (for select/input/editor) or `false` (for confirm).
|
|
2137
|
+
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
2138
|
|
|
2110
2139
|
```json
|
|
2111
2140
|
{"type": "extension_ui_response", "id": "uuid-3", "cancelled": true}
|
|
2112
2141
|
```
|
|
2113
2142
|
|
|
2143
|
+
After any dialog settles, RPC emits a lifecycle event on stdout so hosts can
|
|
2144
|
+
remove the matching UI even when the dialog ended locally because of timeout,
|
|
2145
|
+
abort, or runtime shutdown:
|
|
2146
|
+
|
|
2147
|
+
```json
|
|
2148
|
+
{"type": "extension_ui_response_handled", "id": "uuid-3"}
|
|
2149
|
+
```
|
|
2150
|
+
|
|
2151
|
+
Hosts should treat this event as idempotent; it can arrive after the host has
|
|
2152
|
+
already removed a successfully answered request.
|
|
2153
|
+
|
|
2114
2154
|
## Error Handling
|
|
2115
2155
|
|
|
2116
2156
|
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
|