@thready-web/dsh-bot-plugin 0.1.0-beta.1 → 0.1.0-beta.11
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 +109 -1
- package/client.js +646 -621
- package/dist/approvals.js +160 -0
- package/dist/authorization.js +225 -0
- package/dist/canvas-http.js +248 -0
- package/dist/canvas-skills.js +56 -0
- package/dist/canvas-store.js +794 -0
- package/dist/canvas-tools.js +211 -0
- package/dist/cli.js +32 -12
- package/dist/context.js +60 -17
- package/dist/cron.js +1 -1
- package/dist/cua-access.js +79 -0
- package/dist/desk.js +314 -37
- package/dist/engine.js +178 -84
- package/dist/fs-safe.js +1 -1
- package/dist/host.js +1 -0
- package/dist/http-plugin.js +14 -4
- package/dist/http.js +402 -85
- package/dist/inbox.js +51 -40
- package/dist/index.js +201 -47
- package/dist/live-diff.js +3 -1
- package/dist/live-snapshot.js +2 -13
- package/dist/log/canonical.js +37 -0
- package/dist/log/plan.js +62 -0
- package/dist/log/routes.js +144 -0
- package/dist/log/snapshot-service.js +76 -0
- package/dist/log/source.js +173 -0
- package/dist/memory-catalog.js +798 -0
- package/dist/permissions.js +86 -0
- package/dist/provision.js +2 -0
- package/dist/questions.js +407 -0
- package/dist/runtime-registry.js +4 -4
- package/dist/session-files.js +2 -2
- package/dist/session-previews.js +5 -1
- package/dist/store.js +20 -5
- package/dist/tools.js +150 -32
- package/dist/triggers.js +83 -39
- package/dist/work-admit.js +222 -25
- package/dist/work-child.js +17 -9
- package/dist/work-http.js +52 -2
- package/dist/work-ledger.js +256 -16
- package/dist/work-mock-host.js +9 -6
- package/dist/work-mock.js +29 -19
- package/dist/work-tickets.js +423 -96
- package/dist/work-tools.js +43 -6
- package/dist/work-worker.js +1033 -207
- package/dist/workspace-files.js +319 -0
- package/dist/workspace-image.js +91 -0
- package/fixtures/mock-llm.mjs +17 -2
- package/package.json +16 -5
- package/public/assets/SourceEditor-CJwK846Z.css +1 -0
- package/public/assets/SourceEditor-uu0G7jsM.js +669 -0
- package/public/assets/abap-CRCWOmpq.js +1 -0
- package/public/assets/apex-DnsZk_dE.js +1 -0
- package/public/assets/azcli-1IWB1ccx.js +1 -0
- package/public/assets/bat-DPkNLes8.js +1 -0
- package/public/assets/bicep-Corcdgou.js +2 -0
- package/public/assets/cameligo-CGrWLZr3.js +1 -0
- package/public/assets/clojure-D9WOWImG.js +1 -0
- package/public/assets/codicon-DCmgc-ay.ttf +0 -0
- package/public/assets/coffee-B7EJu28W.js +1 -0
- package/public/assets/cpp-SEyurbux.js +1 -0
- package/public/assets/csharp-BoL64M5l.js +1 -0
- package/public/assets/csp-C46ZqvIl.js +1 -0
- package/public/assets/css-DQU6DXDx.js +3 -0
- package/public/assets/css.worker-DYpkewsP.js +79 -0
- package/public/assets/cssMode-C5DAFF5H.js +4 -0
- package/public/assets/cypher-D84EuPTj.js +1 -0
- package/public/assets/dart-D8lhlL1r.js +1 -0
- package/public/assets/dockerfile-DLk6rpji.js +1 -0
- package/public/assets/ecl-BO6FnfXk.js +1 -0
- package/public/assets/editor.worker-B4pQIWZD.js +12 -0
- package/public/assets/elixir-BRjLKONM.js +1 -0
- package/public/assets/flow9-Cac8vKd7.js +1 -0
- package/public/assets/freemarker2-DExNwSiZ.js +3 -0
- package/public/assets/fsharp-fd1GTHhf.js +1 -0
- package/public/assets/go-O9LJTZXk.js +1 -0
- package/public/assets/graphql-LQdxqEYJ.js +1 -0
- package/public/assets/handlebars-BK7YAvpQ.js +1 -0
- package/public/assets/hcl-DxDQ3s82.js +1 -0
- package/public/assets/html-CdDm_zae.js +1 -0
- package/public/assets/html.worker-tnXziJOq.js +456 -0
- package/public/assets/htmlMode-CLdn9oa1.js +4 -0
- package/public/assets/index-BB-QDSf2.css +1 -0
- package/public/assets/index-CsX-_qbo.js +62 -0
- package/public/assets/ini-BvajGCUy.js +1 -0
- package/public/assets/java-SYsfObOQ.js +1 -0
- package/public/assets/javascript-mLl83_3W.js +1 -0
- package/public/assets/json.worker-aFakAbRR.js +44 -0
- package/public/assets/jsonMode-B1-bihFd.js +10 -0
- package/public/assets/julia-DQXNmw_w.js +1 -0
- package/public/assets/kotlin-qQ0MG-9I.js +1 -0
- package/public/assets/less-GGFNNJHn.js +2 -0
- package/public/assets/lexon-Canl7DCW.js +1 -0
- package/public/assets/liquid-Cv8m0HUb.js +1 -0
- package/public/assets/lua-D28Ae8-K.js +1 -0
- package/public/assets/m3-DPitgjJI.js +1 -0
- package/public/assets/markdown-B811l8j2.js +1 -0
- package/public/assets/mdx-Q12b91rL.js +1 -0
- package/public/assets/mips-CdjsipkG.js +1 -0
- package/public/assets/msdax-CYqgjx_P.js +1 -0
- package/public/assets/mysql-BHd6q0vd.js +1 -0
- package/public/assets/objective-c-B1aVtJYH.js +1 -0
- package/public/assets/pascal-BhNW15KB.js +1 -0
- package/public/assets/pascaligo-5jv8CcQD.js +1 -0
- package/public/assets/perl-DlYyT36c.js +1 -0
- package/public/assets/pgsql-Dy0bjov7.js +1 -0
- package/public/assets/php-120yhfDK.js +1 -0
- package/public/assets/pla-CjnFlu4u.js +1 -0
- package/public/assets/postiats-CQpG440k.js +1 -0
- package/public/assets/powerquery-DdJtto1Z.js +1 -0
- package/public/assets/powershell-Bu_VLpJB.js +1 -0
- package/public/assets/protobuf-IBS6jZEB.js +2 -0
- package/public/assets/pug-kFxLfcjb.js +1 -0
- package/public/assets/python-Kda811W0.js +1 -0
- package/public/assets/qsharp-q7JyzKFN.js +1 -0
- package/public/assets/r-BIFz-_sK.js +1 -0
- package/public/assets/razor-CRuCpdOW.js +1 -0
- package/public/assets/redis-CHOsPHWR.js +1 -0
- package/public/assets/redshift-CBifECDb.js +1 -0
- package/public/assets/restructuredtext-CghPJEOS.js +1 -0
- package/public/assets/ruby-CYWGW-b1.js +1 -0
- package/public/assets/rust-DMDD0SHb.js +1 -0
- package/public/assets/sb-BYAiYHFx.js +1 -0
- package/public/assets/scala-Bqvq8jcR.js +1 -0
- package/public/assets/scheme-Dhb-2j9p.js +1 -0
- package/public/assets/scss-CTwUZ5N7.js +3 -0
- package/public/assets/shell-CsDZo4DB.js +1 -0
- package/public/assets/solidity-CME5AdoB.js +1 -0
- package/public/assets/sophia-RYC1BQQz.js +1 -0
- package/public/assets/sparql-KEyrF7De.js +1 -0
- package/public/assets/sql-BdTr02Mf.js +1 -0
- package/public/assets/st-C7iG7M4S.js +1 -0
- package/public/assets/swift-D7IUmUK8.js +1 -0
- package/public/assets/systemverilog-DgMryOEJ.js +1 -0
- package/public/assets/tcl-PloMZuKG.js +1 -0
- package/public/assets/ts.worker-Bij5J2kb.js +51316 -0
- package/public/assets/tsMode-BGHcz-M3.js +11 -0
- package/public/assets/twig-BfRIq3la.js +1 -0
- package/public/assets/typescript-Db1e0DCT.js +1 -0
- package/public/assets/typespec-CzxlYoT_.js +1 -0
- package/public/assets/vb-BwAE3J76.js +1 -0
- package/public/assets/wgsl-B_1kOXbF.js +298 -0
- package/public/assets/xml-H3zzFmnd.js +1 -0
- package/public/assets/yaml-BQrKvmTF.js +1 -0
- package/public/index.html +2 -2
- package/skills/ui/baseline-ui/SKILL.md +85 -0
- package/skills/ui/bencium-innovative-ux-designer/SKILL.md +227 -0
- package/skills/ui/better-ui/SKILL.md +133 -0
- package/skills/ui/design-lab/SKILL.md +920 -0
- package/skills/ui/frontend-design/SKILL.md +71 -0
- package/skills/ui/impeccable/SKILL.md +93 -0
- package/skills/ui/interface-design/SKILL.md +320 -0
- package/skills/ui/sources.json +66 -0
- package/skills/ui/ui-design/SKILL.md +35 -0
- package/skills/ui/ui-skills-root/SKILL.md +59 -0
- package/skills/ui/visual-design-foundations/SKILL.md +318 -0
- package/skills/ui/web-design-guidelines/SKILL.md +39 -0
- package/public/assets/index-Be82iGwe.css +0 -1
- package/public/assets/index-ByU9a3Lh.js +0 -61
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Cordis plugin for the DSH bot. `@thready-web/dsh-bot` is the launcher that start
|
|
|
9
9
|
| `@thready-web/dsh-bot-plugin/router` | Hash routing for the official web client |
|
|
10
10
|
| `@thready-web/dsh-bot-plugin/cli` | Admin commands. The `dsh-bot` binary calls this. |
|
|
11
11
|
|
|
12
|
-
Prompts, tool descriptions, and API messages are English. A stored persona may still start with a legacy CJK name label. New persona text uses `Name:`, `Style:`, and `Task:`. The workbench defaults to English. The language control switches the whole UI through the message catalog in `ui/src/i18n
|
|
12
|
+
Prompts, tool descriptions, and API messages are English. A stored persona may still start with a legacy CJK name label. New persona text uses `Name:`, `Style:`, and `Task:`. The workbench defaults to English. The language control switches the whole UI through the message catalog in `ui/src/i18n/`.
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
15
|
npm install
|
|
@@ -37,6 +37,114 @@ In `cordis.patch.yml` every new entry must be wrapped in `- insert:`:
|
|
|
37
37
|
|
|
38
38
|
Start the host with `dsh --profile <name> --host 127.0.0.1 --port <port> --no-open` after the patch lists these entries. The official client is `/`. The workbench is `/dsh-bot/`. From the `dsh-plugins` repository, `npx dsh-bot` writes that patch and starts the process.
|
|
39
39
|
|
|
40
|
+
## Main-session budget
|
|
41
|
+
|
|
42
|
+
A bot main session may do the work itself (bash, write, ...) or hand it to a worker with `foundations_dispatch`. The host keeps a runaway guard on each main turn:
|
|
43
|
+
|
|
44
|
+
| Field | Default | Meaning |
|
|
45
|
+
| --- | --- | --- |
|
|
46
|
+
| `chatMaxSteps` / `chatWallMs` | 80 / 30 min | Cap for every main turn |
|
|
47
|
+
| `mainMaxSteps` / `mainWallMs` | 80 / 30 min | Cap after a dispatch or a host tool. It can only tighten the chat cap; with the defaults it changes nothing. Set it lower to push long work onto workers. |
|
|
48
|
+
|
|
49
|
+
- The step cap is checked in `agent/pre-step`: the next step is refused and the turn ends `blocked`. A step that already ended is never cancelled, so a turn whose last step answered the user ends `completed`.
|
|
50
|
+
- The wall cap stops a still-running step with `agent.cancel({ kind: 'hook', reason: 'main-budget:wall' })`. Host cancels never use `{ kind: 'user' }` (worker caps use `worker-budget:*`, ticket cancels `ticket-cancel`).
|
|
51
|
+
- Each trip is written to stderr (`session-foundations: main budget main-budget:steps session=… turn=… steps=…`) and posts one `[foundations:budget]` next-turn message. The model then tells the user the turn was cut off and may dispatch the rest to a worker. Set `budgetNotice: false` to skip the message.
|
|
52
|
+
|
|
53
|
+
Override in the patch (`config.work`) or with the `DSH_BOT_WORK_BUDGET` environment variable (the launcher's `--work-budget`). Config wins over the environment. Both accept `steps` / `wall` shorthands and duration strings:
|
|
54
|
+
|
|
55
|
+
```yaml
|
|
56
|
+
- insert:
|
|
57
|
+
- id: session-foundations
|
|
58
|
+
name: "@thready-web/dsh-bot-plugin"
|
|
59
|
+
config:
|
|
60
|
+
work: { steps: 120, wall: 45m }
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
DSH_BOT_WORK_BUDGET='steps=120,wall=45m,mainMaxSteps=10'
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Worker slots and queue
|
|
68
|
+
|
|
69
|
+
Each bot may run more than one worker at a time. These four fields are formal budget keys, not source-only constants. They reach the scheduler through the same path as the main-session caps: plugin `config.work`, then `DSH_BOT_WORK_BUDGET` (the launcher `--work-budget`), then the defaults below.
|
|
70
|
+
|
|
71
|
+
| Field | Default | Max | Meaning |
|
|
72
|
+
| --- | --- | --- | --- |
|
|
73
|
+
| `perBot` / `global` | 2 / 4 | 64 | Running slots: `enqueued`, `started`, or a reserved start. A ticket in `needs_user` does not occupy a slot unless a resume has already reserved one. |
|
|
74
|
+
| `perBotQueue` / `globalQueue` | 8 / 16 | 256 | Accepted tickets waiting for a slot. When both the slot cap and the matching queue cap are full, `foundations_dispatch` returns `BUDGET` and inserts no row. |
|
|
75
|
+
|
|
76
|
+
`perBot` and `perBotQueue` must be positive integers. Values that are missing, zero, negative, non-integer, infinite, or unknown are ignored and the default is kept — a typo never raises a cap to infinity. Values above the max are clamped to the max and logged. If `perBot` is greater than `global`, the effective running cap for one bot is `min(perBot, global)`. The same rule applies to the queue caps. The configured numbers are kept as written; only admission uses the effective minimum, and startup logs it.
|
|
77
|
+
|
|
78
|
+
Limits are read when the work runtime is created (process start or plugin load). They are not hot-reloaded into a process that is already running. After a restart with a lower cap, workers that are already running are not cancelled; later `foundations_dispatch` and queue promotion use the new caps.
|
|
79
|
+
|
|
80
|
+
When a running ticket completes, fails, is cancelled, or parks in `needs_user`, the oldest waiting ticket that still fits the caps starts automatically (global FIFO by `created_at`, then insertion order). First-phase scheduling is not a weighted fair share across bots.
|
|
81
|
+
|
|
82
|
+
Parked `needs_user` tickets still count toward the combined unfinished cap (`slots + queue`), so they cannot grow without bound or block every new dispatch by filling running slots. Idempotent dispatch of the same owner and key replays the existing ticket.
|
|
83
|
+
|
|
84
|
+
Workers share the owner's workspace. There is no filesystem isolation; briefings should state file boundaries, or dependent work should stay serial.
|
|
85
|
+
|
|
86
|
+
Workers use the `foundations-files` preset: official file tools plus official `@deepseek-ai/dsh-tool-bash` and `@deepseek-ai/dsh-tool-jobs`. The host sandbox stays `workspace-write` with the existing approval policy. This does not mount the web preset, add writable roots, or switch the sandbox to `danger-full-access`. A reserved start that does not create a worker within `min(ticket wallMs, 10m)` fails with `reserve-wall` and frees the slot; a late `createChild` is cancelled instead of attached.
|
|
87
|
+
|
|
88
|
+
Runnable examples (any one of these is enough; `config.work` wins over the environment):
|
|
89
|
+
|
|
90
|
+
```yaml
|
|
91
|
+
# DSH patch, under the session-foundations plugin
|
|
92
|
+
- insert:
|
|
93
|
+
- id: session-foundations
|
|
94
|
+
name: "@thready-web/dsh-bot-plugin"
|
|
95
|
+
config:
|
|
96
|
+
work:
|
|
97
|
+
perBot: 3
|
|
98
|
+
global: 6
|
|
99
|
+
perBotQueue: 8
|
|
100
|
+
globalQueue: 16
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Environment the plugin reads directly
|
|
105
|
+
DSH_BOT_WORK_BUDGET='perBot=3,global=6,perBotQueue=8,globalQueue=16'
|
|
106
|
+
|
|
107
|
+
# Same text through the launcher (also accepts JSON)
|
|
108
|
+
dsh-bot start --work-budget perBot=3,global=6,perBotQueue=8,globalQueue=16
|
|
109
|
+
dsh-bot start --work-budget '{"perBot":1,"global":4}'
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`perBot` and `global` are already on the published launcher `--work-budget` allowlist. `perBotQueue` and `globalQueue` need a launcher that includes those keys; until then set the queue caps in `config.work` or `DSH_BOT_WORK_BUDGET` when starting `dsh` without the launcher flag.
|
|
113
|
+
|
|
114
|
+
## Worker budget waiting
|
|
115
|
+
|
|
116
|
+
A granted worker token/runtime cap pauses admission at the official asynchronous `agent/pre-step` waterfall. The listener waits on an abortable promise; it does not cancel the turn, refuse it as failed, spawn a replacement or invoke a model. A request/tool batch already admitted can finish (and overshoot a quota); no subsequent model request or tool batch is admitted until a sufficient explicit `foundations_grant`.
|
|
117
|
+
|
|
118
|
+
The ticket retains its attempt, fencing token and child session. `budget_json.quota` durably records cumulative committed `usage.totalTokens`, deduplication sequence, active elapsed time, and requested/waiting phase. Active time includes finishing in-flight work until the safe boundary; suspended-boundary waiting time is excluded. Waiting is exempt from lease/enqueue expiry and has no hard-wall failure timer. It retains a worker slot to preserve capacity accounting; the main bot is not in this worker gate or slot pool and can always grant, deny or cancel. Explicit cancellation releases the slot normally.
|
|
119
|
+
|
|
120
|
+
A grant adds amounts, never resets usage, and must exceed both current token usage and active time. An insufficient grant leaves the gate closed without another noisy extension event; its response includes usage, required totals, and the minimum additional amounts. One slice is 1,000,000 tokens and 30 minutes. The first dispatch uses that slice, and every later grant adds at least another slice. There is no cumulative ceiling and no limit on how many times a ticket can be extended. A refusal from the main session is ignored: another full slice is granted instead.
|
|
121
|
+
|
|
122
|
+
Budget requests are urgent next-turn inbox notices, bypassing stale notice/user/delivery admission barriers without steering or interrupting the main turn. Admission is single-flight per owner and rechecks grant/cancellation races before persisting a notice. Ordinary progress retains its existing admission policy. The workbench labels suspended workers “Waiting for budget”.
|
|
123
|
+
|
|
124
|
+
A process restart cannot preserve an in-memory DSH turn: the durable wait survives and reconciliation alone does not dispatch a model or recreate a child. In the resident host, a sufficient explicit grant durably queues one continuation input into the existing child session, preserving the ticket/attempt/fence and reporting `continuation: same-session-new-turn`, not falsely claiming seamless same-turn resumption. Only this detached continuation advances the input/briefing generation, fencing old disposed turn-end replay from new results. A runtime without this host capability reports `awaiting-host-turn` and keeps expiry protection until a real host boundary; mere restoration never wakes a model. Restoring a ticket never revives a previously failed/cancelled ticket. No automatic workspace recovery is performed.
|
|
125
|
+
|
|
126
|
+
## Session working directory
|
|
127
|
+
|
|
128
|
+
Workbench sessions start in `THREADY_SESSION_CWD` when set, otherwise in `<DSH_HOME>/workspace` (created on first use), never in `DSH_HOME` itself, which holds the owner token and profiles.
|
|
129
|
+
|
|
130
|
+
Generated raster previews can be embedded at `/dsh-bot/<project>/preview/<image>` or `/dsh-bot/<project>/artifacts/<image>`. These are deliberate artifact directories under that configured workspace, not a general file server or a per-session sharing boundary: authenticated workbench users can view their images. Only JPEG, PNG, GIF and WebP with matching signatures are served, with private/no-store caching. Dotfiles, traversal, symlink escapes, other workspace locations and active HTML/SVG are rejected. With no configured workspace this fallback is disabled. Relative Markdown image paths resolve under `/dsh-bot/`; existing absolute URLs remain unchanged.
|
|
131
|
+
|
|
132
|
+
Markdown images use bounded, aspect-preserving thumbnails. Click to open a viewport-fit dialog, then choose Original size to scroll through screenshot details. Escape, the close button or the backdrop dismisses it, restoring focus and body scrolling. Linked images expose their link separately from the preview control. Preview and unavailable-state labels follow the English/Chinese UI catalog.
|
|
133
|
+
|
|
134
|
+
A failed thumbnail or viewer image is removed and replaced with a neutral unavailable message and an explicit Retry image button; status/interaction polling does not retry it. Markdown renderer identities stay stable when file callbacks or streaming state change. Failure memory belongs to the current mounted session view (up to 128 URLs, each at most 4096 characters), not global state or browser storage; mounted images also retain local failure state. Session navigation/reload clears it. A cache-evicted image can be attempted again if later remounted. Nothing restores deleted workspace files or retains artifact copies.
|
|
135
|
+
|
|
136
|
+
Actions folds keep their initial view until the user toggles them. Streaming updates, new actions, live-to-durable event replacement and completion do not automatically open or close an existing fold. Text and question boundaries still separate action groups in transcript order.
|
|
137
|
+
|
|
138
|
+
## Interaction synchronization
|
|
139
|
+
|
|
140
|
+
The workbench opts into `/dsh-bot/api/interactions?compact=1&sessionId=...`: official questions, tool approvals, authorization prompts/notices and active authorization flow keys, without enumerating providers. Requests without `compact=1` and `/api/authorization` keep their full catalog responses for older clients.
|
|
141
|
+
|
|
142
|
+
The existing authenticated `/api/live` SSE transport emits `interactions` only when the compact snapshot changes. Native services do not all expose reliable change events, so this is hybrid synchronization: an independent in-process one-second snapshot sampler (no provider listing), not pure native push. Desk RPC stalls do not block interaction delivery. Snapshot failures signal REST fallback without disconnecting the desk stream.
|
|
143
|
+
|
|
144
|
+
A visible connected view reconciles once on entry and every 60 seconds. Unsupported/disconnected streams use bounded 2–15-second backoff; pending questions, open tool approvals or authorization flows keep the fallback at 1.5 seconds. Requests are single-flight with a 10-second abort deadline; newer SSE state wins over late REST results. Session switches discard stale results. Hidden views pause reconciliation and close SSE; resume reconciles immediately and reconnects. These rules do not stop unrelated resource/status updates.
|
|
145
|
+
|
|
146
|
+
The authorization drawer loads the provider directory only on demand, with a per-App single-flight 30-second cache, no browser storage or cross-App cache. Local authorization lifecycle changes and mutations invalidate it. An open drawer revalidates every 30 seconds and on background resume: native provider registration has no complete event hook, so these changes are eventually reconciled rather than falsely treated as push-complete. Dynamic prompts/notices remain on the compact channel even when the drawer is closed.
|
|
147
|
+
|
|
40
148
|
DSH loads `dist/`. Rebuild after changing `src/`. Until `npm --prefix ui run build` has run, `/dsh-bot/` is 404.
|
|
41
149
|
|
|
42
150
|
Host integration needs Node `>= 24.9` and `DSH_BIN`:
|