@sagmans/dsh-tui 0.1.2 → 0.2.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 +82 -8
- package/cordis.patch.yml +4 -2
- package/lib/agent/host.d.ts +14 -0
- package/lib/agent/host.d.ts.map +1 -1
- package/lib/agent/host.js +20 -4
- package/lib/agent/host.js.map +1 -1
- package/lib/agent/model.d.ts +24 -0
- package/lib/agent/model.d.ts.map +1 -1
- package/lib/agent/model.js +46 -1
- package/lib/agent/model.js.map +1 -1
- package/lib/agent/present.d.ts +7 -1
- package/lib/agent/present.d.ts.map +1 -1
- package/lib/agent/present.js +33 -4
- package/lib/agent/present.js.map +1 -1
- package/lib/agent/presets.d.ts +7 -1
- package/lib/agent/presets.d.ts.map +1 -1
- package/lib/agent/presets.js +7 -3
- package/lib/agent/presets.js.map +1 -1
- package/lib/cards.d.ts +127 -7
- package/lib/cards.d.ts.map +1 -1
- package/lib/cards.js +380 -52
- package/lib/cards.js.map +1 -1
- package/lib/export.d.ts +5 -4
- package/lib/export.d.ts.map +1 -1
- package/lib/export.js +62 -13
- package/lib/export.js.map +1 -1
- package/lib/fold-cursor.d.ts +23 -0
- package/lib/fold-cursor.d.ts.map +1 -0
- package/lib/fold-cursor.js +31 -0
- package/lib/fold-cursor.js.map +1 -0
- package/lib/index.d.ts +7 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +310 -32
- package/lib/index.js.map +1 -1
- package/lib/input/submission.d.ts +3 -1
- package/lib/input/submission.d.ts.map +1 -1
- package/lib/input/submission.js +5 -2
- package/lib/input/submission.js.map +1 -1
- package/lib/terminal/warning-screen.d.ts +8 -0
- package/lib/terminal/warning-screen.d.ts.map +1 -0
- package/lib/terminal/warning-screen.js +66 -0
- package/lib/terminal/warning-screen.js.map +1 -0
- package/lib/theme-capability.d.ts +36 -0
- package/lib/theme-capability.d.ts.map +1 -0
- package/lib/theme-capability.js +190 -0
- package/lib/theme-capability.js.map +1 -0
- package/lib/theme-command.d.ts +10 -0
- package/lib/theme-command.d.ts.map +1 -0
- package/lib/theme-command.js +61 -0
- package/lib/theme-command.js.map +1 -0
- package/lib/theme-settings.d.ts +161 -0
- package/lib/theme-settings.d.ts.map +1 -0
- package/lib/theme-settings.js +166 -0
- package/lib/theme-settings.js.map +1 -0
- package/lib/theme-tokens.d.ts +110 -0
- package/lib/theme-tokens.d.ts.map +1 -0
- package/lib/theme-tokens.js +401 -0
- package/lib/theme-tokens.js.map +1 -0
- package/lib/theme.d.ts +32 -35
- package/lib/theme.d.ts.map +1 -1
- package/lib/theme.js +112 -63
- package/lib/theme.js.map +1 -1
- package/lib/tokens.d.ts +15 -0
- package/lib/tokens.d.ts.map +1 -0
- package/lib/tokens.js +29 -0
- package/lib/tokens.js.map +1 -0
- package/lib/transcript.d.ts +26 -1
- package/lib/transcript.d.ts.map +1 -1
- package/lib/transcript.js +153 -25
- package/lib/transcript.js.map +1 -1
- package/lib/ui/dock.d.ts.map +1 -1
- package/lib/ui/dock.js +67 -28
- package/lib/ui/dock.js.map +1 -1
- package/lib/ui/editor.d.ts +34 -0
- package/lib/ui/editor.d.ts.map +1 -0
- package/lib/ui/editor.js +98 -0
- package/lib/ui/editor.js.map +1 -0
- package/lib/ui/markdown.d.ts +8 -0
- package/lib/ui/markdown.d.ts.map +1 -1
- package/lib/ui/markdown.js +12 -0
- package/lib/ui/markdown.js.map +1 -1
- package/lib/ui/picker.d.ts +37 -0
- package/lib/ui/picker.d.ts.map +1 -1
- package/lib/ui/picker.js +53 -0
- package/lib/ui/picker.js.map +1 -1
- package/lib/ui/status.d.ts +3 -1
- package/lib/ui/status.d.ts.map +1 -1
- package/lib/ui/status.js +76 -24
- package/lib/ui/status.js.map +1 -1
- package/lib/ui/view.d.ts +43 -0
- package/lib/ui/view.d.ts.map +1 -1
- package/lib/ui/view.js +254 -54
- package/lib/ui/view.js.map +1 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -88,6 +88,7 @@ Two facts explain most failures.
|
|
|
88
88
|
| `dsh: cannot resolve profile bundle "@sagmans/dsh-tui" ...` | the linked checkout moved or was deleted | `dsh plugin --profile tui add "$PLUGIN_CHECKOUT"` |
|
|
89
89
|
| `dsh --profile tui` prints nothing and never exits | the bundle left `dsh.profile.bundles`, usually after a broken link and a `plugin install` | confirm the layer list, then run the `add` command again |
|
|
90
90
|
| `dsh-tui: both stdin and stdout must be TTYs` | stdin or stdout is a pipe, a file, or a CI runner | run the command from a terminal |
|
|
91
|
+
| Node warnings, such as `ExperimentalWarning: stripTypeScriptTypes …`, appear after exit | the TUI holds runtime warnings until it returns the terminal to your shell; startup warnings remain visible before the TUI starts | read the warnings in your shell after exit; no warning-suppression flag is needed |
|
|
91
92
|
| Changes under `src/` have no effect | a linked profile loads `lib/`, not `src/` | `pnpm run build` in the plugin checkout |
|
|
92
93
|
| `pnpm dsh --profile tui` exits before the surface appears | pnpm's dependency check fails on the harness checkout's own postinstall | see [Launching from a harness checkout](#launching-from-a-harness-checkout) |
|
|
93
94
|
| `--preset <id>` is refused, because the session's agent preset is fixed | a session keeps the mode that composed it, and this session already took a turn | `/preset <id>` before the first turn, or resume without `--preset` |
|
|
@@ -110,7 +111,7 @@ node -p "require((process.env.DSH_HOME ?? require('node:os').homedir() + '/.dsh'
|
|
|
110
111
|
dsh --profile tui # new session in the current directory
|
|
111
112
|
dsh --profile tui --resume # pick a stored session, titled by its first prompt
|
|
112
113
|
dsh --profile tui --resume <session-id>
|
|
113
|
-
dsh --profile tui --preset
|
|
114
|
+
dsh --profile tui --preset minimal # start in a shipped mode other than the default (PTC)
|
|
114
115
|
dsh --profile tui --model deepseek-chat
|
|
115
116
|
dsh --profile tui --no-color
|
|
116
117
|
dsh --profile tui --no-bell # do not ring when a long turn finishes
|
|
@@ -120,8 +121,10 @@ dsh --profile tui --no-bell # do not ring when a long turn finishes
|
|
|
120
121
|
|---|---|
|
|
121
122
|
| Enter | submit the prompt |
|
|
122
123
|
| Ctrl+C | interrupt the running turn, or leave when idle |
|
|
123
|
-
| Ctrl+O |
|
|
124
|
-
| Ctrl+
|
|
124
|
+
| Ctrl+O | open every tool card: its header plus every retained row. Folded, a card is one line, and a shell card keeps its command plus the last 20 rows of output with a hint naming what it dropped |
|
|
125
|
+
| Ctrl+Y | show or hide the calls a PTC program dispatched: one two-space-indented entry per call under its `run_code` card, named and argued from the tool's own header and wrapped at the screen edge; shown by default |
|
|
126
|
+
| Shift+Tab | expand or fold the reasoning behind an answer: folded, the row names itself, its token count, and the key; opened, it adds the thought |
|
|
127
|
+
| Ctrl+T | pick the reasoning effort for the next step |
|
|
125
128
|
| `y` / `n` / Esc | allow once, reject, or cancel a pending approval |
|
|
126
129
|
| digits / space / ↑↓ / Enter / Esc | answer a question: pick or toggle, confirm, or skip one |
|
|
127
130
|
| `/` then Tab | complete commands, including every command this session registered |
|
|
@@ -136,6 +139,7 @@ dsh --profile tui --no-bell # do not ring when a long turn finishes
|
|
|
136
139
|
| `/model` | show the route the next step will use, and the providers available |
|
|
137
140
|
| `/model <provider>` | list that provider's advertised models |
|
|
138
141
|
| `/model <provider>/<model>` | use that route from the next step on (session only, nothing is written to settings) |
|
|
142
|
+
| `/model <provider>/<model>/<effort>` | use that route and reasoning effort (the effort must be one the route advertises) |
|
|
139
143
|
| `/preset` | pick the agent mode for this session from the roster |
|
|
140
144
|
| `/preset <id>` | switch to that mode, while the session is still blank |
|
|
141
145
|
| `/jobs` | list background jobs with their state and duration |
|
|
@@ -148,10 +152,69 @@ dsh --profile tui --no-bell # do not ring when a long turn finishes
|
|
|
148
152
|
| `/export [path]` | write the visible transcript as markdown (default `dsh-session-<id>.md`) |
|
|
149
153
|
| `/resume` | open another stored session without leaving the terminal |
|
|
150
154
|
| `/clear` | clear the visible transcript |
|
|
155
|
+
| `/theme` | list every styled element and the value in force |
|
|
151
156
|
| `/quit` | leave and print the resume command |
|
|
152
157
|
|
|
153
158
|
Any other `/command` goes to the command registry, so `/plan`, `/compact`, `/goal`, and `/feedback` behave as they do on the other surfaces.
|
|
154
159
|
|
|
160
|
+
## Theme
|
|
161
|
+
|
|
162
|
+
Every styled element is a named token with a shipped default, so the surface can
|
|
163
|
+
be restyled without touching code. Overrides live in the same user-settings
|
|
164
|
+
document as every other preference (`$DSH_HOME/settings.yaml`), under a
|
|
165
|
+
`dsh-tui:` section:
|
|
166
|
+
|
|
167
|
+
```yaml
|
|
168
|
+
dsh-tui:
|
|
169
|
+
subcalls: collapsed # fold the calls a PTC program dispatched (default inline)
|
|
170
|
+
palette:
|
|
171
|
+
muted: '#5c5c5c' # one shade quiets every receding element
|
|
172
|
+
tokens:
|
|
173
|
+
transcript.reasoning.body:
|
|
174
|
+
fg: '#7a7a7a'
|
|
175
|
+
italic: true
|
|
176
|
+
tool.title:
|
|
177
|
+
fg: accent # a palette name, a hex value, or an index 0-255
|
|
178
|
+
bold: true
|
|
179
|
+
dock.jobs.heading:
|
|
180
|
+
hidden: true # the element renders nothing at all
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Every field is optional, so a section that changes one shade is enough. The
|
|
184
|
+
document is hot-reloaded: an edit restyles a running session, and `/theme` shows
|
|
185
|
+
each element's effective value and whether it came from an override, the
|
|
186
|
+
palette, or the default.
|
|
187
|
+
|
|
188
|
+
The section is not only shades. By default every session draws the calls a PTC
|
|
189
|
+
program dispatched under their card, and `subcalls: collapsed` starts with the
|
|
190
|
+
card alone instead. `Ctrl+Y` toggles the same choice for the current session,
|
|
191
|
+
and an edit to the document re-seeds it. An unknown key or value is
|
|
192
|
+
refused with a notice naming it, so a typo cannot quietly do nothing.
|
|
193
|
+
|
|
194
|
+
`fg` and `bg` accept `#rrggbb`, a palette name (`default`, `muted`, `accent`,
|
|
195
|
+
`arg`, `warn`, `added`, `removed`, `user`, `assistant`), or an index. A colour is
|
|
196
|
+
emitted as 24-bit when the terminal advertises it (`COLORTERM`) and degraded to
|
|
197
|
+
the nearest 256-colour entry or 16-colour slot otherwise; a hue keeps its family
|
|
198
|
+
there, so an addition stays green instead of collapsing to black. Muted elements
|
|
199
|
+
name the palette rather than a terminal slot, so on anything but a 16-colour
|
|
200
|
+
terminal their contrast does not depend on what the reader's colour scheme maps
|
|
201
|
+
slot 8 to. `arg` is the pale blue a card gives the argument it was called with,
|
|
202
|
+
so `tool.args` is restyled on its own and stays distinct from the tool's own
|
|
203
|
+
label and from its output. `user` is the rose a submitted prompt takes, so a
|
|
204
|
+
reader's own turns stand apart from the reply without reading either.
|
|
205
|
+
|
|
206
|
+
`NO_COLOR` and `--no-color` disable styling entirely, attributes included, and
|
|
207
|
+
outrank everything in this section. A token or palette name the surface does not
|
|
208
|
+
have is refused with the offending name, and the surface prints the refusal as a
|
|
209
|
+
notice when the document loads, so a typo cannot quietly paint nothing.
|
|
210
|
+
|
|
211
|
+
One residual escapes that promise, and it is not the surface's to close. After a
|
|
212
|
+
component returns its rows, the framework appends a reset to each row and closes
|
|
213
|
+
the hyperlink it wraps them in, so a session can still receive a bare `ESC[0m`
|
|
214
|
+
with colour off. It paints nothing. It is recorded here because "no escapes at
|
|
215
|
+
all" is otherwise the claim, and because the surface cannot make good on it
|
|
216
|
+
alone.
|
|
217
|
+
|
|
155
218
|
## Modes
|
|
156
219
|
|
|
157
220
|
A mode is an **agent preset**: the plugin composition an agent's own scope joins. It decides that agent's tools, prompt sections, skills, and planning rows, which is why a mode is fixed once a session has produced a turn — it is what composed the agent that answered.
|
|
@@ -160,8 +223,8 @@ Four ship, under the ids a session log records:
|
|
|
160
223
|
|
|
161
224
|
| `--preset` | Mode | What the agent gets |
|
|
162
225
|
|---|---|---|
|
|
226
|
+
| `ptc` | PTC (default) | the same agent, reaching its tools through one TypeScript program |
|
|
163
227
|
| `standard` | standard | full agent: editing, shell, search, skills, planning, goals, subagents, workflows |
|
|
164
|
-
| `ptc` | PTC | the same agent, reaching its tools through one TypeScript program |
|
|
165
228
|
| `minimal` | minimal | one tool: a persistent shell |
|
|
166
229
|
| `cordis` | creator | harness authoring: runtime inspection and composition guidance |
|
|
167
230
|
|
|
@@ -169,7 +232,7 @@ A session takes its mode from the first of these that applies:
|
|
|
169
232
|
|
|
170
233
|
1. `--preset <id>`, refused before the terminal is taken over when the roster does not ship that id.
|
|
171
234
|
2. `/preset` while the session is still blank: a bare command opens the picker, `/preset <id>` switches directly, and the choice is written to the log.
|
|
172
|
-
3. The roster's default, `
|
|
235
|
+
3. The roster's default, `ptc`, when nobody names one.
|
|
173
236
|
|
|
174
237
|
The mode is re-read rather than remembered: resuming mounts what that session's own log recorded, resuming with a `--preset` that disagrees with it is refused instead of silently ignored, and forking inherits the mode of the conversation being branched. The status line names the mode, and `/status` lists it with the rest.
|
|
175
238
|
|
|
@@ -184,6 +247,12 @@ The package is a Cordis plugin bundle that stacks over `@deepseek-ai/dsh-base`:
|
|
|
184
247
|
|
|
185
248
|
The fold is durable-only: the live stream decorates the row that is still being written, and everything else — cards, reasoning, work state, compaction markers — comes from the log, so a resumed session renders what the live one did. Subagent start and finish are the exception: they arrive as service events, and the transcript shows them as decoration because the durable record of a delegation is the tool call that asked for it.
|
|
186
249
|
|
|
250
|
+
Tool cards are folded by default: a card draws its header and nothing else, so a long read, diff, or search cannot bury the conversation. A shell card is the exception, because its output is the answer the reader asked for: it names the tool in its header, always shows the command that ran, keeps the last 20 output rows, and adds a hint naming the rows it dropped. `Ctrl+O` opens every card to its header plus every retained row.
|
|
251
|
+
|
|
252
|
+
A PTC card is the one card with children: every call the `run_code` program dispatched hangs off the card that made it, and each draws under the header as the tool's own name and argument, wrapping rather than being cut. `Ctrl+Y` folds them away again, and `subcalls: collapsed` starts every session folded; see [Theme](#theme).
|
|
253
|
+
|
|
254
|
+
A card's header names the tool, then the argument the call was made with — a path or a command — in the `tool.args` colour, then the facts the result measured: a read reports its line range, line count, and token size; a file change that carried no prior content to compare against reports its lines and tokens; one that did reports added, changed, and removed lines as `+n ~n -n` in green, yellow, and red. Each stat is its own token, so any of them can be recoloured or hidden independently.
|
|
255
|
+
|
|
187
256
|
The bundle also takes the base's global agent rows out of the composition, twenty-three of them. Every one is a row the shipped modes supply per session instead, so leaving it mounted registers the same tool names in two layers and doubles each prompt section it owns. What stays mounted is the host: sessions, storage, models, permissions, jobs, and the command registry.
|
|
188
257
|
|
|
189
258
|
## Development
|
|
@@ -227,6 +296,10 @@ The automated checks drive a real PTY, but they run on this machine's terminal.
|
|
|
227
296
|
| `NO_COLOR=1 dsh --profile tui` | no styling anywhere, layout unchanged |
|
|
228
297
|
| `dsh --profile tui --no-bell` | a turn that runs for minutes still ends silently |
|
|
229
298
|
| `dsh --profile tui --preset ptc`, then a turn | the status line names `ptc`, and the agent reaches its tools through one TypeScript program rather than one shell call at a time |
|
|
299
|
+
| a PTC turn | one entry per dispatched call draws two spaces indented under the `run_code` header, from the first frame and with no keypress |
|
|
300
|
+
| that turn in a terminal narrower than a call's own argument | the argument wraps onto continuation rows indented to the same two spaces, with no ellipsis |
|
|
301
|
+
| that same turn, then `ctrl+y` | the lines fold away; `ctrl+y` again draws them back |
|
|
302
|
+
| `dsh-tui: { subcalls: collapsed }` in `$DSH_HOME/settings.yaml`, then a PTC turn | the card arrives alone, and editing the document to `inline` unfolds a running session |
|
|
230
303
|
| `/preset` on a fresh session | the picker lists four modes, marks the current one, and the switch survives a resume |
|
|
231
304
|
| `/preset minimal` after a turn | refused, naming the reason; the session keeps the mode it composed with |
|
|
232
305
|
| `--resume --preset <mode>` and then picking a session that runs another mode | the list stays open and says why that row cannot be taken; `esc` leaves the picker |
|
|
@@ -250,15 +323,16 @@ The workflow stores no npm token: the registry trusts `release.yml` on the `npm-
|
|
|
250
323
|
## Limitations
|
|
251
324
|
|
|
252
325
|
- Two different things are called a preset. The agent mode (`--preset`, `/preset`) is fixed once a session has produced a turn; the permission preset (`/permission <preset>`, named in the status line) can change at any time.
|
|
253
|
-
- `/model` changes the route for the running session only. Catalog membership is advisory — an adapter may accept an id it does not advertise.
|
|
326
|
+
- `/model` changes the route and reasoning effort for the running session only. Catalog membership is advisory — an adapter may accept an id it does not advertise, while an explicit effort is checked against the route's own levels before it is applied.
|
|
254
327
|
- Scrolling is the mouse wheel, or the terminal's own scrollback keys where it offers them.
|
|
255
328
|
- A turn that ran longer than ten seconds rings the terminal bell when it ends, because the reader may have walked away; `--no-bell` turns that off.
|
|
256
|
-
- The dock shows the goal, plan mode, the todo
|
|
329
|
+
- The dock shows the goal, plan mode, the todo items still to do, and any background job or delegation still running; a settled item leaves rather than turns into a completed row. The transcript marks where older history was compacted away. `/plan` toggles plan mode; `/plan <message>` also steers that message, which is the base command's own behaviour.
|
|
257
330
|
- Background jobs and subagent runs are live process state, not durable events: they disappear when the run ends, and a resumed session starts with an empty board and roster.
|
|
331
|
+
- A card reads its tool's own render intent through the agent whose session is on screen, so a stored session with no live agent — one this process is not running, or a child that has already finished — folds to the generic card instead of the tool's own.
|
|
258
332
|
- Reading a child's conversation does not move the terminal: commands, approvals, and the status line stay with the session you launched, and the transcript is the only thing that switches.
|
|
259
333
|
- Delete is unimplemented: the session store exposes no delete, and the surface does not reach around that seam into its files. `/fork` covers the case that needs it — it branches into a new session and leaves the original alone.
|
|
260
334
|
- Approvals and questions render inline and take the keyboard; a question batch is answered in order.
|
|
261
|
-
- Styling
|
|
335
|
+
- Styling is per element and overridable; see [Theme](#theme). Shipped defaults are emitted as 24-bit colour where the terminal advertises it and degraded to 256 or 16 colours otherwise, so a light or dark terminal still follows its own palette where it has one.
|
|
262
336
|
- Tool text, model text, and file content are escaped before rendering, so a hostile result cannot inject terminal control sequences; the cost is that a literal tab shows as \x09.
|
|
263
337
|
|
|
264
338
|
## License
|
package/cordis.patch.yml
CHANGED
|
@@ -98,11 +98,13 @@
|
|
|
98
98
|
bell: !!js ctx.tuiStartup.bell
|
|
99
99
|
|
|
100
100
|
# The roster of agent compositions, and the mode a session starts in when
|
|
101
|
-
# nobody names one.
|
|
101
|
+
# nobody names one. PTC leads because a flagless run should reach every tool
|
|
102
|
+
# through one program rather than one shell call at a time. A profile patch
|
|
103
|
+
# may override this row's config.
|
|
102
104
|
- id: agent-presets
|
|
103
105
|
name: '@deepseek-ai/dsh-agent-presets'
|
|
104
106
|
config:
|
|
105
|
-
default:
|
|
107
|
+
default: ptc
|
|
106
108
|
|
|
107
109
|
# A preset's subagent tool samples its delegation model from this host-owned
|
|
108
110
|
# settings row. It is host machinery rather than agent plane, which is why
|
package/lib/agent/host.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
2
|
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
3
3
|
import { type SessionId } from '@deepseek-ai/dsh-session';
|
|
4
|
+
import { ReasoningEffortId } from '@deepseek-ai/dsh-llm';
|
|
4
5
|
/** Everything the terminal surface needs to own one interactive agent. */
|
|
5
6
|
export interface TuiAgent {
|
|
6
7
|
readonly sessionId: SessionId;
|
|
@@ -47,6 +48,19 @@ export interface StartAgentOptions {
|
|
|
47
48
|
*/
|
|
48
49
|
readonly preset?: string | undefined;
|
|
49
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* The route an agent starts on.
|
|
53
|
+
*
|
|
54
|
+
* A launch flag is explicit, so it stands alone; otherwise the deployment
|
|
55
|
+
* default supplies the whole selection, effort included. The effort has to
|
|
56
|
+
* travel with the route here because an absent one is what the reader sees in
|
|
57
|
+
* the status line but never reaches a request.
|
|
58
|
+
*/
|
|
59
|
+
export declare function agentRoute(ctx: Context, options: Pick<StartAgentOptions, 'model' | 'provider'>): {
|
|
60
|
+
provider?: string;
|
|
61
|
+
model?: string;
|
|
62
|
+
reasoningEffort?: ReasoningEffortId;
|
|
63
|
+
};
|
|
50
64
|
/**
|
|
51
65
|
* Create or resume the one agent this surface drives.
|
|
52
66
|
*
|
package/lib/agent/host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/agent/host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAA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A;IACrC,8EAA8E;IAC9E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5C,iFAAiF;IACjF,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,CAAA;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACrC;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,UAAU,CAAC,GACrD;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,iBAAiB,CAAA;CAAE,CAiB5E;AAMD;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkC5F"}
|
package/lib/agent/host.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { SessionLogOffset } from '@deepseek-ai/dsh-session';
|
|
2
|
-
import { createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
3
|
-
|
|
2
|
+
import { ReasoningEffortId, createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
3
|
+
/**
|
|
4
|
+
* The route an agent starts on.
|
|
5
|
+
*
|
|
6
|
+
* A launch flag is explicit, so it stands alone; otherwise the deployment
|
|
7
|
+
* default supplies the whole selection, effort included. The effort has to
|
|
8
|
+
* travel with the route here because an absent one is what the reader sees in
|
|
9
|
+
* the status line but never reaches a request.
|
|
10
|
+
*/
|
|
11
|
+
export function agentRoute(ctx, options) {
|
|
4
12
|
if (options.model !== undefined || options.provider !== undefined) {
|
|
5
13
|
return {
|
|
6
14
|
...(options.provider === undefined ? {} : { provider: options.provider }),
|
|
@@ -8,7 +16,15 @@ function routeOf(ctx, options) {
|
|
|
8
16
|
};
|
|
9
17
|
}
|
|
10
18
|
const selection = ctx.get('agentDefaultModel')?.currentSelection();
|
|
11
|
-
return selection === undefined
|
|
19
|
+
return selection === undefined
|
|
20
|
+
? {}
|
|
21
|
+
: {
|
|
22
|
+
provider: selection.provider,
|
|
23
|
+
model: selection.model,
|
|
24
|
+
...(selection.reasoningEffort === undefined
|
|
25
|
+
? {}
|
|
26
|
+
: { reasoningEffort: ReasoningEffortId(selection.reasoningEffort) }),
|
|
27
|
+
};
|
|
12
28
|
}
|
|
13
29
|
function userMessage(text) {
|
|
14
30
|
return createUserMessage({ content: [{ type: 'text', text }], source: { kind: 'user' } });
|
|
@@ -21,7 +37,7 @@ function userMessage(text) {
|
|
|
21
37
|
* session is not an error the user should see, so creation is the fallback.
|
|
22
38
|
*/
|
|
23
39
|
export async function startAgent(ctx, options) {
|
|
24
|
-
const agentOptions =
|
|
40
|
+
const agentOptions = agentRoute(ctx, options);
|
|
25
41
|
const meta = { cwd: options.cwd };
|
|
26
42
|
const setup = options.setup === undefined ? {} : { setup: options.setup };
|
|
27
43
|
// A branch inherits a prefix of its parent's log, so the child is marked as
|
package/lib/agent/host.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../src/agent/host.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAqC,MAAM,0BAA0B,CAAA;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../src/agent/host.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAqC,MAAM,0BAA0B,CAAA;AAC9F,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAmD3E;;;;;;;GAOG;AACH,MAAM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K,EAAE,CAAC,CAAC;QACxH,CAAC,CAAC,MAAM,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC,CAAA;IAChH,IAAI,QAAQ,GAAG,KAAK,CAAA;IACpB,OAAO;QACL,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACxD,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACpD,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACtD,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,QAAQ;gBAAE,OAAM;YACpB,QAAQ,GAAG,IAAI,CAAA;YACf,MAAM,MAAM,CAAC,OAAO,EAAE,CAAA;QACxB,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/lib/agent/model.d.ts
CHANGED
|
@@ -30,6 +30,10 @@ export type ModelCommand = {
|
|
|
30
30
|
* lists that provider's models, `provider/model` switches, and anything else is
|
|
31
31
|
* taken as a model id inside the route already in use, because a reader
|
|
32
32
|
* switching between two models of one provider should not have to repeat it.
|
|
33
|
+
* A complete route may carry one more segment, the reasoning effort, so
|
|
34
|
+
* `provider/model/effort` selects both at once: the last segment is the effort
|
|
35
|
+
* and the model is everything between it and the provider, which reads a model
|
|
36
|
+
* id containing a slash as an effort the adapters in use do not mint.
|
|
33
37
|
*/
|
|
34
38
|
export declare function parseModelArgument(argument: string, providers: readonly ProviderEntry[], current: ModelChoice | undefined): ModelCommand;
|
|
35
39
|
/**
|
|
@@ -46,10 +50,29 @@ export declare class ModelSwitch {
|
|
|
46
50
|
install(agentCtx: Context): void;
|
|
47
51
|
choose(choice: ModelChoice): void;
|
|
48
52
|
current(): ModelChoice | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Take the deployment default as this session's route, unless the reader
|
|
55
|
+
* already named one.
|
|
56
|
+
*
|
|
57
|
+
* The default is settings-backed and only trustworthy once it is read, which
|
|
58
|
+
* is after the agent was created; adopting it here is what makes the effort
|
|
59
|
+
* the status line shows reach the request, and a reader's own `/model` or
|
|
60
|
+
* picker choice must never be overwritten by it.
|
|
61
|
+
*/
|
|
62
|
+
adopt(choice: ModelChoice): void;
|
|
49
63
|
/** Forget the choice, so the session returns to the composition default. */
|
|
50
64
|
reset(): void;
|
|
51
65
|
dispose(): void;
|
|
52
66
|
}
|
|
67
|
+
/** The reasoning levels one exact route offers, described structurally. */
|
|
68
|
+
export interface ModelEfforts {
|
|
69
|
+
readonly efforts: readonly {
|
|
70
|
+
readonly id: string;
|
|
71
|
+
readonly name: string;
|
|
72
|
+
readonly description?: string;
|
|
73
|
+
}[];
|
|
74
|
+
readonly defaultEffort?: string;
|
|
75
|
+
}
|
|
53
76
|
/** Read the advisory catalog of routes this composition can reach. */
|
|
54
77
|
export declare function createModelCatalog(ctx: Context): {
|
|
55
78
|
providers(): readonly ProviderEntry[];
|
|
@@ -57,5 +80,6 @@ export declare function createModelCatalog(ctx: Context): {
|
|
|
57
80
|
readonly id: string;
|
|
58
81
|
readonly name: string;
|
|
59
82
|
}[]>;
|
|
83
|
+
efforts(provider: string, model: string): Promise<ModelEfforts | undefined>;
|
|
60
84
|
} | undefined;
|
|
61
85
|
//# sourceMappingURL=model.d.ts.map
|
package/lib/agent/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/agent/model.ts"],"names":[],"mappings":"AAE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,CAAA;CAChC;AAcD,sEAAsE;AACtE,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG;IAChD,SAAS,IAAI,SAAS,aAAa,EAAE,CAAA;IACrC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC,CAAA;IAC5F,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAAA;CAC5E,GAAG,SAAS,CA+BZ"}
|
package/lib/agent/model.js
CHANGED
|
@@ -7,6 +7,10 @@ import { ReasoningEffortId } from '@deepseek-ai/dsh-llm';
|
|
|
7
7
|
* lists that provider's models, `provider/model` switches, and anything else is
|
|
8
8
|
* taken as a model id inside the route already in use, because a reader
|
|
9
9
|
* switching between two models of one provider should not have to repeat it.
|
|
10
|
+
* A complete route may carry one more segment, the reasoning effort, so
|
|
11
|
+
* `provider/model/effort` selects both at once: the last segment is the effort
|
|
12
|
+
* and the model is everything between it and the provider, which reads a model
|
|
13
|
+
* id containing a slash as an effort the adapters in use do not mint.
|
|
10
14
|
*/
|
|
11
15
|
export function parseModelArgument(argument, providers, current) {
|
|
12
16
|
const trimmed = argument.trim();
|
|
@@ -14,7 +18,16 @@ export function parseModelArgument(argument, providers, current) {
|
|
|
14
18
|
return { kind: 'current' };
|
|
15
19
|
const slash = trimmed.indexOf('/');
|
|
16
20
|
if (slash > 0 && slash < trimmed.length - 1) {
|
|
17
|
-
|
|
21
|
+
const provider = trimmed.slice(0, slash);
|
|
22
|
+
const rest = trimmed.slice(slash + 1);
|
|
23
|
+
const effortSlash = rest.lastIndexOf('/');
|
|
24
|
+
if (effortSlash > 0 && effortSlash < rest.length - 1) {
|
|
25
|
+
return {
|
|
26
|
+
kind: 'switch',
|
|
27
|
+
choice: { provider, model: rest.slice(0, effortSlash), reasoningEffort: rest.slice(effortSlash + 1) },
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return { kind: 'switch', choice: { provider, model: rest } };
|
|
18
31
|
}
|
|
19
32
|
if (providers.some(provider => provider.id === trimmed))
|
|
20
33
|
return { kind: 'list-models', provider: trimmed };
|
|
@@ -61,6 +74,20 @@ export class ModelSwitch {
|
|
|
61
74
|
...current.reasoningEffort === undefined ? {} : { reasoningEffort: String(current.reasoningEffort) },
|
|
62
75
|
};
|
|
63
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Take the deployment default as this session's route, unless the reader
|
|
79
|
+
* already named one.
|
|
80
|
+
*
|
|
81
|
+
* The default is settings-backed and only trustworthy once it is read, which
|
|
82
|
+
* is after the agent was created; adopting it here is what makes the effort
|
|
83
|
+
* the status line shows reach the request, and a reader's own `/model` or
|
|
84
|
+
* picker choice must never be overwritten by it.
|
|
85
|
+
*/
|
|
86
|
+
adopt(choice) {
|
|
87
|
+
if (this.selection.current !== undefined)
|
|
88
|
+
return;
|
|
89
|
+
this.choose(choice);
|
|
90
|
+
}
|
|
64
91
|
/** Forget the choice, so the session returns to the composition default. */
|
|
65
92
|
reset() {
|
|
66
93
|
this.selection.current = undefined;
|
|
@@ -87,6 +114,24 @@ export function createModelCatalog(ctx) {
|
|
|
87
114
|
? [{ id: entry.id, name: typeof entry.name === 'string' ? entry.name : entry.id }]
|
|
88
115
|
: []);
|
|
89
116
|
},
|
|
117
|
+
efforts: async (provider, model) => {
|
|
118
|
+
if (typeof llm.resolveModelInfo !== 'function')
|
|
119
|
+
return undefined;
|
|
120
|
+
const reasoning = (await llm.resolveModelInfo(provider, model)).reasoning;
|
|
121
|
+
if (reasoning === undefined)
|
|
122
|
+
return undefined;
|
|
123
|
+
const efforts = (reasoning.efforts ?? []).flatMap(entry => typeof entry.id === 'string'
|
|
124
|
+
? [{
|
|
125
|
+
id: entry.id,
|
|
126
|
+
name: typeof entry.name === 'string' ? entry.name : entry.id,
|
|
127
|
+
...(typeof entry.description === 'string' ? { description: entry.description } : {}),
|
|
128
|
+
}]
|
|
129
|
+
: []);
|
|
130
|
+
return {
|
|
131
|
+
efforts,
|
|
132
|
+
...(typeof reasoning.defaultEffort === 'string' ? { defaultEffort: reasoning.defaultEffort } : {}),
|
|
133
|
+
};
|
|
134
|
+
},
|
|
90
135
|
};
|
|
91
136
|
}
|
|
92
137
|
//# sourceMappingURL=model.js.map
|
package/lib/agent/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/agent/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAA0B,MAAM,wBAAwB,CAAA;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAuBxD
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/agent/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAA0B,MAAM,wBAAwB,CAAA;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAuBxD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAgB,EAChB,SAAmC,EACnC,OAAgC;IAEhC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAA;IAC/B,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;IAC9C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAClC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5C,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;QACxC,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG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
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
2
3
|
import { type ToolPresenter } from '../cards.ts';
|
|
3
4
|
/**
|
|
4
5
|
* Present tool calls and results through each tool's own render intent.
|
|
@@ -7,6 +8,11 @@ import { type ToolPresenter } from '../cards.ts';
|
|
|
7
8
|
* and result read. An unknown tool, a missing presenter, or a throwing one
|
|
8
9
|
* degrades to the generic card instead of breaking the transcript, because a
|
|
9
10
|
* broken card is recoverable and a broken transcript is not.
|
|
11
|
+
*
|
|
12
|
+
* The scope is the agent whose session is on screen, not the plugin's own
|
|
13
|
+
* composition. An agent preset registers its tools in the agent's scoped world,
|
|
14
|
+
* so a scope-less lookup sees none of them and every card degrades to a bare
|
|
15
|
+
* generic row — which is how a bash card lost its command.
|
|
10
16
|
*/
|
|
11
|
-
export declare function createToolPresenter(ctx: Context): ToolPresenter;
|
|
17
|
+
export declare function createToolPresenter(ctx: Context, scope?: () => Agent | undefined): ToolPresenter;
|
|
12
18
|
//# sourceMappingURL=present.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"present.d.ts","sourceRoot":"","sources":["../../src/agent/present.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAIL,KAAK,aAAa,EAEnB,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"present.d.ts","sourceRoot":"","sources":["../../src/agent/present.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAIL,KAAK,aAAa,EAEnB,MAAM,aAAa,CAAA;AA4BpB;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,GAAG,SAAS,GAAG,aAAa,CAqChG"}
|
package/lib/agent/present.js
CHANGED
|
@@ -7,6 +7,26 @@ function parseArguments(argumentsJson) {
|
|
|
7
7
|
return undefined;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* The content a tool returned, unwrapped from the durable result envelope.
|
|
12
|
+
*
|
|
13
|
+
* A `presentResult` is handed the tool's own {@link ContentBlock}s. The durable
|
|
14
|
+
* `tool/result` wraps them one level deeper, inside a `tool-result` block, so
|
|
15
|
+
* passing the envelope through makes every presenter that inspects its content
|
|
16
|
+
* decline — which is how a terminal result silently became a generic card.
|
|
17
|
+
*/
|
|
18
|
+
function toolResultContent(content) {
|
|
19
|
+
if (!Array.isArray(content))
|
|
20
|
+
return content;
|
|
21
|
+
for (const block of content) {
|
|
22
|
+
if (typeof block !== 'object' || block === null)
|
|
23
|
+
continue;
|
|
24
|
+
const record = block;
|
|
25
|
+
if (record.type === 'tool-result' && Array.isArray(record.content))
|
|
26
|
+
return record.content;
|
|
27
|
+
}
|
|
28
|
+
return content;
|
|
29
|
+
}
|
|
10
30
|
/**
|
|
11
31
|
* Present tool calls and results through each tool's own render intent.
|
|
12
32
|
*
|
|
@@ -14,11 +34,16 @@ function parseArguments(argumentsJson) {
|
|
|
14
34
|
* and result read. An unknown tool, a missing presenter, or a throwing one
|
|
15
35
|
* degrades to the generic card instead of breaking the transcript, because a
|
|
16
36
|
* broken card is recoverable and a broken transcript is not.
|
|
37
|
+
*
|
|
38
|
+
* The scope is the agent whose session is on screen, not the plugin's own
|
|
39
|
+
* composition. An agent preset registers its tools in the agent's scoped world,
|
|
40
|
+
* so a scope-less lookup sees none of them and every card degrades to a bare
|
|
41
|
+
* generic row — which is how a bash card lost its command.
|
|
17
42
|
*/
|
|
18
|
-
export function createToolPresenter(ctx) {
|
|
43
|
+
export function createToolPresenter(ctx, scope) {
|
|
19
44
|
const definition = (name) => {
|
|
20
45
|
try {
|
|
21
|
-
return ctx.tools.get(name);
|
|
46
|
+
return ctx.tools.get(name, scope?.());
|
|
22
47
|
}
|
|
23
48
|
catch {
|
|
24
49
|
return undefined;
|
|
@@ -28,7 +53,11 @@ export function createToolPresenter(ctx) {
|
|
|
28
53
|
call(name, argumentsJson) {
|
|
29
54
|
try {
|
|
30
55
|
const view = definition(name)?.presentCall?.(parseArguments(argumentsJson));
|
|
31
|
-
|
|
56
|
+
// No definition, or a tool that declares no call view: leave the row to
|
|
57
|
+
// the transcript's own fallback, which at least shows the raw arguments
|
|
58
|
+
// the call was made with. `cardOfCall(undefined, ...)` would return a
|
|
59
|
+
// generic card that silently drops them.
|
|
60
|
+
return view === undefined ? undefined : cardOfCall(view, name);
|
|
32
61
|
}
|
|
33
62
|
catch {
|
|
34
63
|
return undefined;
|
|
@@ -36,7 +65,7 @@ export function createToolPresenter(ctx) {
|
|
|
36
65
|
},
|
|
37
66
|
result(name, input) {
|
|
38
67
|
try {
|
|
39
|
-
const view = definition(name)?.presentResult?.(parseArguments(input.argumentsJson), { content: input.content, isError: input.isError, meta: input.meta });
|
|
68
|
+
const view = definition(name)?.presentResult?.(parseArguments(input.argumentsJson), { content: toolResultContent(input.content), isError: input.isError, meta: input.meta });
|
|
40
69
|
return cardOfResult(view, {
|
|
41
70
|
fallbackTitle: name,
|
|
42
71
|
failed: input.isError,
|
package/lib/agent/present.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"present.js","sourceRoot":"","sources":["../../src/agent/present.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"present.js","sourceRoot":"","sources":["../../src/agent/present.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EACV,YAAY,EACZ,YAAY,GAGb,MAAM,aAAa,CAAA;AAEpB,SAAS,cAAc,CAAC,aAAqB;IAC3C,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAY,CAAA;IAC7C,CAAC;IAAC,MAAM,CAAC;QAC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;YAClB,CAAC;QACH,CAAC;QACD,MAAM,CAAC,IAAI,EAAE,KAAsB;YACjC,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,EAAE,aAAa,EAAE,CAC5C,cAAc,CAAC,KAAK,CAAC,aAAa,CAAU,EAC5C,EAAE,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAW,CACjG,CAAA;gBACD,OAAO,YAAY,CAAC,IAAI,EAAE;oBACxB,aAAa,EAAE,IAAI;oBACnB,MAAM,EAAE,KAAK,CAAC,OAAO;oBACrB,YAAY,EAAE,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC;iBAC1C,CAAC,CAAA;YACJ,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,SAAS,CAAA;YAClB,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/lib/agent/presets.d.ts
CHANGED
|
@@ -37,7 +37,13 @@ export declare function parsePresetArgument(argument: string): PresetCommand;
|
|
|
37
37
|
export declare function describePreset(preset: PresetSummary, currentId: string | undefined): PickerRow;
|
|
38
38
|
/** The roster this surface reads, described structurally. */
|
|
39
39
|
export interface PresetRoster {
|
|
40
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* The preset a session starts on when nobody names one.
|
|
42
|
+
*
|
|
43
|
+
* Read per call rather than captured: the harness resolves it through the
|
|
44
|
+
* hot-reloaded settings document, so a default chosen while this surface is
|
|
45
|
+
* already running still reaches the next session it opens.
|
|
46
|
+
*/
|
|
41
47
|
readonly defaultId: string;
|
|
42
48
|
list(): Promise<readonly PresetSummary[]>;
|
|
43
49
|
resolve(id: string | undefined): Promise<PresetSummary>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/agent/presets.ts"],"names":[],"mappings":"AAAA,OA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E,OAAO,GAAG,OAAO,CAAA;CACnC;AAED,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,gBAAgB,CAAA;AAwC7C;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CAwCzE"}
|
package/lib/agent/presets.js
CHANGED
|
@@ -76,11 +76,15 @@ export function createPresetRoster(ctx) {
|
|
|
76
76
|
const service = ctx.get('agentPresets');
|
|
77
77
|
if (typeof service?.list !== 'function' || typeof service.mount !== 'function')
|
|
78
78
|
return undefined;
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
79
|
+
const fallbackId = textOr(service.defaultId);
|
|
80
|
+
if (fallbackId === undefined)
|
|
81
81
|
return undefined;
|
|
82
82
|
return {
|
|
83
|
-
|
|
83
|
+
// The harness answers a configured id on every read; the captured one is
|
|
84
|
+
// only there for a service that momentarily answers nothing.
|
|
85
|
+
get defaultId() {
|
|
86
|
+
return textOr(service.defaultId) ?? fallbackId;
|
|
87
|
+
},
|
|
84
88
|
list: async () => {
|
|
85
89
|
const rows = await service.list?.() ?? [];
|
|
86
90
|
return rows.flatMap(row => toSummary(row) ?? []);
|
package/lib/agent/presets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.js","sourceRoot":"","sources":["../../src/agent/presets.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AA4BrE;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAgB;IAClD,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAA;IAC1B,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;AAC9D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,aAAa,G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