@chrok/dsh-braid 0.0.0-stage → 0.3.1
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/LICENSE +21 -0
- package/README.md +264 -2
- package/cordis.patch.yml +3 -0
- package/dist/client/Panel.d.ts +16 -0
- package/dist/client/ToolCall.d.ts +7 -0
- package/dist/client/index.d.ts +9 -0
- package/dist/client/layout.d.ts +10 -0
- package/dist/client/navigation.d.ts +24 -0
- package/dist/client/styles.d.ts +3 -0
- package/dist/client.js +732 -0
- package/dist/client.js.map +7 -0
- package/dist/display.d.ts +3 -0
- package/dist/display.js +22 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +162 -0
- package/dist/jobs.d.ts +68 -0
- package/dist/jobs.js +146 -0
- package/dist/panel-contract.d.ts +20 -0
- package/dist/panel-contract.js +29 -0
- package/dist/panel-types.d.ts +100 -0
- package/dist/panel-types.js +1 -0
- package/dist/panel.d.ts +16 -0
- package/dist/panel.js +169 -0
- package/dist/runner.d.ts +27 -0
- package/dist/runner.js +176 -0
- package/dist/schema.d.ts +64 -0
- package/dist/schema.js +93 -0
- package/dist/shell-tools.d.ts +2 -0
- package/dist/shell-tools.js +90 -0
- package/dist/tools.d.ts +46 -0
- package/dist/tools.js +86 -0
- package/dist/worker-tools.d.ts +9 -0
- package/dist/worker-tools.js +81 -0
- package/dist/write-tools.d.ts +5 -0
- package/dist/write-tools.js +70 -0
- package/package.json +117 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Epsirom
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,265 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Braid for DeepSeek Harness (`@chrok/dsh-braid`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@chrok/dsh-braid)
|
|
4
|
+
|
|
5
|
+
A native DeepSeek Harness plugin for background Braid graphs, bounded loops,
|
|
6
|
+
isolated Git worktrees, live updates, pause/resume, and completion reminders.
|
|
7
|
+
It uses DSH's provider routing and credentials through `ctx.llm`; it has no Pi
|
|
8
|
+
runtime dependency. Tested against **DSH 0.2.0-rc.2** and Node.js **22.19+**.
|
|
9
|
+
DSH is in developer preview, so host peer versions are pinned to this baseline.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
DSH support starts with Braid 0.3.1; the npm badge shows availability.
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
dsh plugin --profile web add @chrok/dsh-braid
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
For development, install this repository checkout instead:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
npm ci
|
|
23
|
+
npm run build:dsh
|
|
24
|
+
dsh plugin --profile web add ./integrations/dsh
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Restart the DSH profile after installation or rebuilding. The package includes
|
|
28
|
+
`dsh.bundle` metadata and `cordis.patch.yml`, so installation activates the plugin.
|
|
29
|
+
It requires the `tools`, `llm`, `commands`, `systemPrompt`, and `jobs` services,
|
|
30
|
+
which the standard DSH composition provides. Custom profiles must provide them.
|
|
31
|
+
|
|
32
|
+
Use your own profile name in place of `web`. Core `@chrok/braid` is installed
|
|
33
|
+
automatically at the matching version. No API keys belong in plugin configuration;
|
|
34
|
+
configure models through DSH. A node's `model` is an exact `provider/model-id`,
|
|
35
|
+
including any additional slashes in the model ID; omitted overrides use the parent
|
|
36
|
+
agent's model captured at submission.
|
|
37
|
+
|
|
38
|
+
## Tools and live control
|
|
39
|
+
|
|
40
|
+
| Capability | DSH interface |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| Submit a graph | `braid({ goal, nodes, edges, promptTemplates?, loops?, options? })` |
|
|
43
|
+
| List this agent's jobs | `braid_status({})` |
|
|
44
|
+
| Read a job | `braid_status({ jobId })` |
|
|
45
|
+
| Read a specific invocation | `braid_status({ jobId, executionId })` |
|
|
46
|
+
| Read a node's latest invocation | `braid_status({ jobId, nodeId })` |
|
|
47
|
+
| Atomically edit/resume | `braid_update({ jobId, expectedRevision, ...patch })` |
|
|
48
|
+
| Resume without edits | `braid_resume({ jobId, expectedRevision, executionIds })` |
|
|
49
|
+
| Cancel | `braid_cancel({ jobId })` or `/braid cancel <jobId>` |
|
|
50
|
+
| Human progress snapshot | `/braid [jobId]`, `/braid list` |
|
|
51
|
+
| Graph, execution details and controls | **Braid** in the session header or right-sidebar guide |
|
|
52
|
+
| Generic job progress and cancellation | DSH's native **Jobs** panel |
|
|
53
|
+
|
|
54
|
+
Submission immediately returns a short `job-1` handle, a canonical UUID, and
|
|
55
|
+
`nativeJobId` (for DSH's generic job tools/panel). Braid tools accept the short
|
|
56
|
+
handle or UUID, exactly. Handles are scoped to the live agent; another agent or
|
|
57
|
+
session cannot retrieve them. Native job IDs belong to DSH's separate registry.
|
|
58
|
+
Receipts echo accepted node types, policies, overrides, and edges without prompts.
|
|
59
|
+
|
|
60
|
+
## Braid Web panel
|
|
61
|
+
|
|
62
|
+
Click **Braid** in a session's header, or choose **Braid** from the right-sidebar
|
|
63
|
+
guide. Braid's five tool calls also render as clickable transcript cards:
|
|
64
|
+
|
|
65
|
+
| Tool card | Recorded summary and navigation |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| `braid` | Submission receipt and node count; opens the submitted graph once the receipt arrives |
|
|
68
|
+
| `braid_status` | Recorded status, revision and execution progress; focuses a requested node/execution; list results provide a link for each job |
|
|
69
|
+
| `braid_update` | Before/after revision, upserted/removed nodes, edge counts and resumed executions; rejected updates are marked as not applied |
|
|
70
|
+
| `braid_resume` | Requested execution IDs and remaining pauses; a single execution links directly to its history |
|
|
71
|
+
| `braid_cancel` | Cancellation requested or job already finished; opens the original job |
|
|
72
|
+
|
|
73
|
+
The main card opens the right-sidebar Braid tab in the call's owning session.
|
|
74
|
+
Cards retain the result recorded at the time of the call; the sidebar shows the
|
|
75
|
+
**current** graph and status. Raw arguments, results and errors remain accessible
|
|
76
|
+
under **Show tool details**, along with DSH's inspector when available. Failed
|
|
77
|
+
submissions and calls still preparing a new graph do not link to an unrelated
|
|
78
|
+
latest job. Short handles in older receipts are fenced by the call timestamp;
|
|
79
|
+
a job missing after a Host restart is reported as unavailable.
|
|
80
|
+
|
|
81
|
+
The panel is a native DSH tab: the sidebar provides docking, splitting,
|
|
82
|
+
floating and fullscreen. It follows the session that owns the tab.
|
|
83
|
+
|
|
84
|
+
- Select a Braid job and inspect its live graph. Nodes show their type and state;
|
|
85
|
+
edge labels show decisions, and dashed back-edges show bounded loops. Zoom and
|
|
86
|
+
scrolling accommodate larger graphs.
|
|
87
|
+
- Click a node to select an exact execution, including earlier loop iterations.
|
|
88
|
+
Inspect output, decisions, errors, context usage, tool counts, latency, workspace
|
|
89
|
+
details and recovery refs. Output is paged in 32,768-character chunks.
|
|
90
|
+
- View the latest 80 lifecycle events and input/output/cache token totals.
|
|
91
|
+
- Cancel the job, resume one paused execution, or resume all paused executions.
|
|
92
|
+
Resume submits the revision currently displayed; stale revisions are rejected
|
|
93
|
+
and surfaced in the panel. Editing a graph remains a model-tool operation.
|
|
94
|
+
|
|
95
|
+
The Host sends structured snapshots through DSH's authenticated Remote transport,
|
|
96
|
+
coalesced to at most one update per 150 ms per observer. Prompts, provider messages
|
|
97
|
+
and node outputs are excluded from that stream; selected outputs are read
|
|
98
|
+
separately. Switching sessions or closing the tab stops observation, while jobs
|
|
99
|
+
continue. Disconnected controls are disabled; the panel retries the stream, then
|
|
100
|
+
offers manual reconnect if retries fail.
|
|
101
|
+
|
|
102
|
+
The package declares `dsh.client` and exports `./client`, a DSH module-loader
|
|
103
|
+
factory sharing the shell's React instance. The Web profile must provide
|
|
104
|
+
`typert`, `remote`, the slot renderer, conversation header, tool views and right sidebar.
|
|
105
|
+
Custom headless profiles can omit these services and retain the tools/commands.
|
|
106
|
+
Unloading the plugin removes its tab type, slots, styles and Remote methods.
|
|
107
|
+
|
|
108
|
+
The generic Jobs panel also streams a text flow diagram, node states, elapsed times, context
|
|
109
|
+
token estimates/provider reports, context capacity when available, tool counts,
|
|
110
|
+
and recent events. Its own stop action cancels the Braid run. Closing the panel
|
|
111
|
+
leaves it running. `/braid` returns a snapshot in the command UI; it does not open
|
|
112
|
+
Pi's terminal overlay or bind Pi's keyboard shortcuts. Headless profiles can use
|
|
113
|
+
the tools and commands without a Web UI.
|
|
114
|
+
|
|
115
|
+
The five graph tools expose the same execution controls as the Pi integration.
|
|
116
|
+
DSH presentation uses a native Web graph panel, jobs and commands; it does not
|
|
117
|
+
include Pi's Mermaid terminal renderer. Tool results are canonical JSON for both native and PTC mode.
|
|
118
|
+
|
|
119
|
+
## Graphs and workspaces
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"goal": "Implement a fix, review it, and apply it",
|
|
124
|
+
"nodes": [
|
|
125
|
+
{ "type": "execute", "id": "implement", "prompt": "Implement and test the fix." },
|
|
126
|
+
{ "type": "execute", "id": "review", "prompt": "Review the implementation and report evidence.", "workspace": "read-only", "pauseAfter": true },
|
|
127
|
+
{ "type": "integrate", "id": "apply", "requireSuccess": true }
|
|
128
|
+
],
|
|
129
|
+
"edges": [
|
|
130
|
+
{ "from": "implement", "to": "review" },
|
|
131
|
+
{ "from": "review", "to": "apply" }
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`execute` and `decision` require `prompt`; only decisions declare nonempty,
|
|
137
|
+
distinct `choices` and call `decide`. `merge` and `integrate` allow an optional
|
|
138
|
+
prompt and forbid `workspace`/`choices`. All four types accept `model`,
|
|
139
|
+
`notifyOnCompletion`, `pauseAfter`, and `requireSuccess`. Core validates every
|
|
140
|
+
submission and update before it takes effect.
|
|
141
|
+
|
|
142
|
+
Inside Git, each execution gets a fresh snapshot of its predecessor checkpoints;
|
|
143
|
+
roots include tracked and non-ignored untracked caller changes. Execute/decision
|
|
144
|
+
nodes default to writable worktrees. `workspace: "read-only"` keeps snapshot
|
|
145
|
+
isolation while removing write/edit/shell tools. Outside Git all workers are
|
|
146
|
+
read-only. Independent changed snapshots need an explicit merge node before
|
|
147
|
+
another ordinary worker can consume their combined code.
|
|
148
|
+
|
|
149
|
+
`merge` combines snapshots in an isolated worktree. `integrate` applies selected
|
|
150
|
+
changes to the invoking checkout, preserving user edits. Nothing automatically
|
|
151
|
+
integrates at job completion. Both expose constrained Git operations and require
|
|
152
|
+
`finish_merge` dispositions for every source execution ID. Checkpoints and
|
|
153
|
+
integration backup refs remain recoverable after worktree cleanup. A failed
|
|
154
|
+
integration can leave partial changes or conflicts; core never resets the caller.
|
|
155
|
+
|
|
156
|
+
Workers receive a fresh DSH context containing the goal, rendered node prompt,
|
|
157
|
+
direct predecessor outputs, execution identity, and workspace/merge metadata.
|
|
158
|
+
They do not inherit the parent transcript, skills, extension/MCP tools, or Braid
|
|
159
|
+
itself. Fixed local tools are:
|
|
160
|
+
|
|
161
|
+
- `read` and `ls`; `grep` and `find` when `rg` is installed. Missing search
|
|
162
|
+
dependencies are not downloaded; use `ls`/`read` instead.
|
|
163
|
+
- `write`, `edit`, and `bash` for writable Git workspaces; `powershell` on Windows.
|
|
164
|
+
- `git` when core provides Git access; `finish_merge` for merge/integrate nodes.
|
|
165
|
+
- `decide` only for decision nodes, with exactly one declared choice.
|
|
166
|
+
|
|
167
|
+
Guarded writes reject paths outside the assigned workspace, Git metadata,
|
|
168
|
+
submodules, symlinks, hard links, and special files. Shell commands use host
|
|
169
|
+
permissions and can bypass file guards; worktrees are not an OS sandbox. Workers
|
|
170
|
+
are instructed to keep writes local, preserve shared Git state, and avoid global
|
|
171
|
+
or externally visible actions unless requested. Commands run in the foreground;
|
|
172
|
+
completion, timeout, and cancellation terminate their process group. Ignored new
|
|
173
|
+
dependencies, caches, and build outputs are not checkpointed and disappear during
|
|
174
|
+
cleanup. Shared services and ports require execution-specific resources.
|
|
175
|
+
|
|
176
|
+
## Pauses, updates, loops, and reminders
|
|
177
|
+
|
|
178
|
+
`notifyOnCompletion: true` sends an intermediate success/failure reminder.
|
|
179
|
+
`pauseAfter: true` additionally holds outgoing scheduling; independent branches
|
|
180
|
+
continue. Reminders identify the exact invocation and loop iteration in the job
|
|
181
|
+
data. Fetch `braid_status`, then use its **current** `execution.revision` and
|
|
182
|
+
`execution.pausedExecutionIds`:
|
|
183
|
+
|
|
184
|
+
```json
|
|
185
|
+
{
|
|
186
|
+
"jobId": "job-1",
|
|
187
|
+
"expectedRevision": 0,
|
|
188
|
+
"executionIds": ["<paused-execution-id>"]
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Pass this to `braid_resume`. `braid_update` accepts complete `upsertNodes`,
|
|
193
|
+
`removeNodeIds`, `addEdges`, `removeEdges`, `promptTemplates`, `loops`, and
|
|
194
|
+
`resume`. Use historical `edge.executionId` pins only in updates. Include new
|
|
195
|
+
nodes and their dependencies in the same update: a disconnected root can start
|
|
196
|
+
immediately. Rejected revisions/patches change nothing. Upserts replace whole
|
|
197
|
+
node definitions; supplied templates/loops replace their whole map/list.
|
|
198
|
+
`removeEdges` matches every identity field exactly; omitted fields are not
|
|
199
|
+
wildcards. Existing invocations retain their captured inputs and policies.
|
|
200
|
+
Finalized jobs cannot be reopened.
|
|
201
|
+
|
|
202
|
+
Bounded loops use a `loops` entry `{ id, entry, maxIterations }` and one feedback
|
|
203
|
+
edge from a decision to that entry carrying `choice` and `feedback: "<loop-id>"`.
|
|
204
|
+
`maxIterations` includes the first round. Loops cannot overlap or nest. Prompt
|
|
205
|
+
templates use `{{name}}` placeholders and node prompts such as
|
|
206
|
+
`{ "template": "review", "variables": { "target": "src/runtime.ts" } }`.
|
|
207
|
+
Variable names must match exactly; values are inserted literally.
|
|
208
|
+
See the [execution-control guide](https://github.com/Epsirom/braid/blob/main/docs/execution-control.md)
|
|
209
|
+
for the shared graph semantics.
|
|
210
|
+
|
|
211
|
+
Completion and pause messages use DSH `agent.steer`: a running agent consumes
|
|
212
|
+
them at the next step, and an idle agent wakes. Acknowledged messages are removed;
|
|
213
|
+
discarded messages retry when the agent returns to idle. DSH's generic job
|
|
214
|
+
controller may also show its native job completion notice. Retrieve results after
|
|
215
|
+
the reminder instead of polling. Stopping a foreground response does not cancel
|
|
216
|
+
submitted jobs. Plugin or owning-agent disposal aborts workers, awaits cleanup,
|
|
217
|
+
and suppresses Braid reminders. Switching the UI to another still-live agent does
|
|
218
|
+
not dispose the original owner or redirect its reminders. Jobs are in memory;
|
|
219
|
+
they do not survive a DSH restart.
|
|
220
|
+
|
|
221
|
+
## Budgets and accounting
|
|
222
|
+
|
|
223
|
+
`options` accepts `maxConcurrency` (default 4), `maxExecutions` (default 1000),
|
|
224
|
+
`maxToolRounds`, `maxToolCalls`, `nodeTimeoutMs`, and `graphTimeoutMs`. Tool/time
|
|
225
|
+
budgets are unlimited when omitted. Limits count rejected tool calls too. Workers
|
|
226
|
+
receive remaining budget/deadline reminders before model requests. Graph deadlines
|
|
227
|
+
continue during pauses and do not reset on resume or update.
|
|
228
|
+
|
|
229
|
+
`braid_status.usage` aggregates DSH usage, including completed provider rounds
|
|
230
|
+
from workers that later fail or time out. Input/cache fields are disjoint;
|
|
231
|
+
`totalTokens` includes input, output, cache reads, and cache writes. Core runner
|
|
232
|
+
usage combines input/cache into `inputTokens`. DSH does not offer Pi's external
|
|
233
|
+
tool-cost accounting contract: repeated status reads return the same totals
|
|
234
|
+
without adding charges to the foreground agent. No dollar cost is inferred.
|
|
235
|
+
|
|
236
|
+
Results over 50 KB are saved as private JSON files in the host's temporary
|
|
237
|
+
directory. The bounded response preserves status/control fields and includes
|
|
238
|
+
`fullOutputPath`, including for running graphs and focused execution reads.
|
|
239
|
+
Running status retains the latest 80 events; finalized `result.events` contains
|
|
240
|
+
the complete core event log. Saved files remain available after job cleanup.
|
|
241
|
+
|
|
242
|
+
## Development
|
|
243
|
+
|
|
244
|
+
```sh
|
|
245
|
+
npm run check:dsh
|
|
246
|
+
npm run test:dsh
|
|
247
|
+
npm run build:dsh
|
|
248
|
+
npm run test:package
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Tests use scripted providers without network model calls. They exercise real
|
|
252
|
+
Cordis/DSH registration, native job ownership/control, canonical tool outputs,
|
|
253
|
+
reminder delivery and cleanup, graph controls, loops, budgets, filesystem guards,
|
|
254
|
+
and process cancellation. Web tests cover the native Gateway, the built browser
|
|
255
|
+
factory and Remote mounting, slot registration/unload, session switching, safe
|
|
256
|
+
text rendering, controls, revision checks, paging and disconnect cleanup. Package
|
|
257
|
+
smoke tests install the packed package outside the checkout, load its browser
|
|
258
|
+
factory and run a background worker. All dependencies share the root lockfile.
|
|
259
|
+
Use `npm install --workspace @chrok/dsh-braid <dependency>` for dependency updates.
|
|
260
|
+
|
|
261
|
+
Host contracts: [DSH plugin packaging](https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.0-rc.2/docs/user/develop/basic/publish.md),
|
|
262
|
+
[tool authoring](https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.0-rc.2/docs/cookbook/adding-a-tool.md),
|
|
263
|
+
[client modules](https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.0-rc.2/docs/subsystems/client-modules.md),
|
|
264
|
+
[right-sidebar extensions](https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.0-rc.2/packages/client/ui-sidebar-right/README.md),
|
|
265
|
+
and [native jobs](https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.2.0-rc.2/packages/jobs/jobs/README.md).
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PanelApi, PanelJob } from "../panel-types.js";
|
|
2
|
+
import type { BraidNavigation } from "./navigation.js";
|
|
3
|
+
export declare function Status({ status }: {
|
|
4
|
+
status: string;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function Graph({ job, selected, select }: {
|
|
7
|
+
job: PanelJob;
|
|
8
|
+
selected: string;
|
|
9
|
+
select: (id: string) => void;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
/** The session key deliberately resets every local selection and request generation. */
|
|
12
|
+
export declare function BraidPanelView(props: {
|
|
13
|
+
sessionId: string;
|
|
14
|
+
api: PanelApi;
|
|
15
|
+
target?: BraidNavigation;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ToolCallOwnerProps } from "@deepseek-ai/dsh-client-ui-tool/client";
|
|
2
|
+
import { type BraidNavigation } from "./navigation.js";
|
|
3
|
+
export type BraidToolCallProps = ToolCallOwnerProps & {
|
|
4
|
+
openBraid: (target: BraidNavigation) => void;
|
|
5
|
+
};
|
|
6
|
+
/** The main row opens the graph; a separate disclosure preserves the raw tool evidence. */
|
|
7
|
+
export declare function BraidToolCall(props: BraidToolCallProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import { type BraidNavigation } from "./navigation.js";
|
|
3
|
+
declare module "@deepseek-ai/dsh-client-ui-sidebar-right/client" {
|
|
4
|
+
interface SidebarRightTabParamsMap {
|
|
5
|
+
braid: BraidNavigation;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export declare const inject: string[];
|
|
9
|
+
export declare function apply(ctx: Context): Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PanelJob } from "../panel-types.js";
|
|
2
|
+
/** Longest-path ranks in the forward DAG. Feedback is drawn separately. */
|
|
3
|
+
export declare function layoutGraph(nodes: PanelJob["nodes"], edges: PanelJob["edges"]): {
|
|
4
|
+
positions: Map<string, {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
}>;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ToolCallPhaseProps } from "@deepseek-ai/dsh-client-ui-tool/client";
|
|
2
|
+
export interface BraidNavigation {
|
|
3
|
+
jobId?: string;
|
|
4
|
+
nodeId?: string;
|
|
5
|
+
executionId?: string;
|
|
6
|
+
createdBefore?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const braidToolNames: readonly ["braid", "braid_status", "braid_update", "braid_resume", "braid_cancel"];
|
|
9
|
+
/** Sidebar navigation also survives layout restoration, so validate its loose JSON boundary. */
|
|
10
|
+
export declare function readNavigation(value: unknown): BraidNavigation;
|
|
11
|
+
/** Read only envelope identifiers, never the result preview, prompts, or worker output. */
|
|
12
|
+
export declare function toolNavigation(toolName: string, props: ToolCallPhaseProps): BraidNavigation | null;
|
|
13
|
+
export interface ToolPresentation {
|
|
14
|
+
label: string;
|
|
15
|
+
summary: string;
|
|
16
|
+
changes: string[];
|
|
17
|
+
jobs: {
|
|
18
|
+
label: string;
|
|
19
|
+
status: string;
|
|
20
|
+
target: BraidNavigation;
|
|
21
|
+
}[];
|
|
22
|
+
}
|
|
23
|
+
/** Each tool card describes its recorded operation; the sidebar is explicitly live. */
|
|
24
|
+
export declare function toolPresentation(toolName: string, props: ToolCallPhaseProps): ToolPresentation;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Scoped styles share the Host's fonts and honor both system and DSH dark themes. */
|
|
2
|
+
export declare const styles = "\n.braid-panel{--br-bg:var(--dsw-alias-bg-base,#fff);--br-fg:var(--dsw-alias-label-primary,#222b38);--br-soft:var(--dsw-alias-bg-module-platform,#f4f6f8);--br-line:var(--dsw-alias-border-l2,#dce2e8);--br-muted:var(--dsw-alias-label-secondary,#667384);--br-accent:#336dbe;--br-green:var(--dsw-alias-state-success-primary,#18794e);--br-red:var(--dsw-alias-state-error-primary,#ba3340);color:var(--br-fg);background:var(--br-bg);font:inherit;font-size:13px;line-height:1.5;box-sizing:border-box;height:100%;overflow:auto;min-width:0;container-type:inline-size}\n.braid-panel *{box-sizing:border-box}.braid-panel button,.braid-panel select{font:inherit;color:inherit}.braid-panel button,.braid-panel select{border:1px solid var(--br-line);border-radius:7px;background:var(--br-bg);padding:6px 10px}.braid-panel button{cursor:pointer}.braid-panel button:hover:not(:disabled){border-color:var(--br-accent)}.braid-panel button:focus-visible,.braid-panel select:focus-visible{outline:2px solid var(--br-accent);outline-offset:2px}.braid-panel button:disabled{opacity:.45;cursor:default}.braid-panel .br-primary{background:var(--br-accent);color:white;border-color:transparent}.braid-panel .br-danger{color:var(--br-red)}\n.br-header{padding:20px 18px 12px;border-bottom:1px solid var(--br-line)}.br-heading{display:flex;align-items:center;gap:9px}.br-heading h2{font-size:18px;letter-spacing:-.4px;margin:0}.br-heading small{margin-left:auto;color:var(--br-muted)}.br-eyebrow{text-transform:uppercase;letter-spacing:1.4px;font-size:10px;color:var(--br-muted);margin-bottom:5px}.br-select{width:100%;margin:14px 0 8px}.br-goal{margin:8px 0;overflow-wrap:anywhere}.br-muted{color:var(--br-muted)}.br-toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.br-status{display:inline-flex;align-items:center;gap:5px;font-size:11px;white-space:nowrap}.br-status:before{content:'';width:6px;height:6px;border-radius:50%;background:var(--br-muted)}.br-status[data-status=running]:before,.br-status[data-status=runnable]:before{background:var(--br-accent)}.br-status[data-status=completed]:before{background:var(--br-green)}.br-status[data-status=failed]:before,.br-status[data-status=cancelled]:before{background:var(--br-red)}.br-status[data-status=waiting]:before{background:#ba861a}\n.br-stats{display:grid;grid-template-columns:repeat(4,1fr);padding:14px 18px;gap:8px;border-bottom:1px solid var(--br-line)}.br-stats strong{display:block;font-size:16px;font-variant-numeric:tabular-nums}.br-stats span{font-size:10px;color:var(--br-muted)}.br-section{padding:14px 18px;border-bottom:1px solid var(--br-line)}.br-section h3{font-size:12px;margin:0 0 10px}.br-section-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:10px}.br-section-head h3{margin:0}.br-section-head button{padding:2px 8px}.br-graph{overflow:auto;background:var(--br-soft);border:1px solid var(--br-line);border-radius:9px;max-height:420px}.br-graph-canvas{position:relative}.br-graph svg{position:absolute;inset:0;overflow:visible}.br-graph path{fill:none;stroke:var(--br-muted);stroke-width:1.2}.br-graph text{font-size:10px;fill:var(--br-muted)}.br-node{position:absolute;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;width:154px;height:72px;text-align:left;gap:2px;box-shadow:0 2px 5px #00000006}.br-node[aria-pressed=true]{outline:2px solid var(--br-accent);outline-offset:2px}.br-node strong{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.br-node small{font-size:10px;color:var(--br-muted)}.br-legend{display:flex;gap:12px;flex-wrap:wrap;font-size:10px;color:var(--br-muted);margin-top:8px}.br-note{font-size:11px;color:var(--br-muted);margin:8px 0 0;overflow-wrap:anywhere}\n.br-notice{margin:12px 18px;padding:10px 12px;border:1px solid var(--br-line);border-radius:8px;background:var(--br-soft);overflow-wrap:anywhere}.br-notice[role=alert]{color:var(--br-red)}.br-empty{padding:48px 24px;text-align:center}.br-empty h3{font-size:15px}.br-empty p{color:var(--br-muted);max-width:36em;margin:12px auto}.br-detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px 16px;font-size:11px;margin:12px 0}.br-detail-grid span{color:var(--br-muted);display:block}.br-output{white-space:pre-wrap;overflow-wrap:anywhere;background:var(--br-soft);border:1px solid var(--br-line);padding:12px;border-radius:8px;max-height:340px;overflow:auto;font:11px/1.65 ui-monospace,SFMono-Regular,monospace;margin:8px 0}.br-tabs{display:flex;gap:5px;margin:14px 0 10px}.br-tabs button[aria-pressed=true]{border-color:var(--br-accent);color:var(--br-accent)}.br-events{list-style:none;padding:0;margin:0;max-height:320px;overflow:auto}.br-events li{padding:8px 0;display:grid;grid-template-columns:64px 1fr;gap:8px;border-bottom:1px solid var(--br-line);font-size:11px}.br-events time{color:var(--br-muted);font-variant-numeric:tabular-nums}.br-events p{margin:0;overflow-wrap:anywhere}.br-events small{color:var(--br-muted)}.br-header-action{font:inherit;border:0;border-radius:6px;padding:5px 9px;background:transparent;color:inherit;cursor:pointer}.br-header-action:hover{background:#8882}\n@container (max-width:330px){.br-stats{grid-template-columns:repeat(2,1fr)}.br-header,.br-section{padding-left:12px;padding-right:12px}}\n@media(prefers-color-scheme:dark){.braid-panel{--br-bg:var(--dsw-alias-bg-base,#171b22);--br-fg:var(--dsw-alias-label-primary,#e0e6ee);--br-soft:var(--dsw-alias-bg-module-platform,#202630);--br-line:var(--dsw-alias-border-l2,#354050);--br-muted:var(--dsw-alias-label-secondary,#a0adbe);--br-accent:#80b6ff;--br-green:var(--dsw-alias-state-success-primary,#69d6a0);--br-red:var(--dsw-alias-state-error-primary,#ff919a)}.braid-panel .br-primary{color:#162336}}\n[data-theme=dark] .braid-panel,.dark .braid-panel{--br-bg:var(--dsw-alias-bg-base,#171b22);--br-fg:var(--dsw-alias-label-primary,#e0e6ee);--br-soft:var(--dsw-alias-bg-module-platform,#202630);--br-line:var(--dsw-alias-border-l2,#354050);--br-muted:var(--dsw-alias-label-secondary,#a0adbe);--br-accent:#80b6ff;--br-green:var(--dsw-alias-state-success-primary,#69d6a0);--br-red:var(--dsw-alias-state-error-primary,#ff919a)}\n";
|
|
3
|
+
export declare const toolStyles = "\n.br-tool-call{font:inherit;font-size:12px;color:var(--dsw-alias-label-primary,inherit);border:1px solid var(--dsw-alias-border-l2,#8884);border-radius:9px;margin:8px 0;overflow:hidden}\n.br-tool-call button{font:inherit;color:inherit;cursor:pointer}.br-tool-call button:focus-visible{outline:2px solid #639be6;outline-offset:-2px}.br-tool-call button:disabled{cursor:default;opacity:.6}\n.br-tool-open{display:flex;width:100%;align-items:center;gap:10px;padding:12px;border:0;background:var(--dsw-alias-bg-module-platform,#8881);text-align:left}.br-tool-open:hover:not(:disabled){background:var(--dsw-alias-fill-l1,#8882)}.br-tool-open>span:last-child{margin-left:auto}\n.br-tool-main{display:flex;flex-wrap:wrap;align-items:baseline;gap:3px 8px;min-width:0}.br-tool-target{overflow-wrap:anywhere;color:var(--dsw-alias-label-secondary,inherit)}.br-tool-summary{flex-basis:100%;font-size:11px}.br-tool-call[data-state=failed] .br-tool-summary,.br-tool-error{color:var(--dsw-alias-state-error-primary,#c34e59)}\n.br-tool-actions{display:flex;gap:8px;padding:6px 12px}.br-tool-actions button{border:0;background:transparent;font-size:11px;text-decoration:underline;text-underline-offset:3px;padding:3px 0}.br-tool-details{padding:8px 12px;border-top:1px solid var(--dsw-alias-border-l2,#8884)}.br-tool-details pre{font:11px/1.6 ui-monospace,monospace;white-space:pre-wrap;overflow-wrap:anywhere;max-height:220px;overflow:auto}.br-tool-error{padding:0 12px;white-space:pre-wrap;overflow-wrap:anywhere;font-size:11px}\n.br-tool-note{margin:4px 12px;color:var(--dsw-alias-label-secondary,inherit);font-size:10px;opacity:.8}.br-tool-changes{display:flex;flex-wrap:wrap;gap:5px;padding:8px 12px}.br-tool-changes span{padding:3px 6px;border-radius:4px;background:var(--dsw-alias-bg-module-platform,#8881);font-size:10px;overflow-wrap:anywhere}.br-tool-jobs{list-style:none;margin:0;padding:6px 12px;max-height:230px;overflow:auto}.br-tool-jobs button{display:flex;gap:12px;width:100%;padding:6px 0;border:0;background:transparent;text-align:left}.br-tool-jobs span{margin-left:auto}\n";
|