@sagmans/dsh-tui 0.9.0 → 0.11.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/.agents/skills/dsh-tui-dogfood/SKILL.md +6 -1
- package/.agents/skills/dsh-tui-dogfood/scripts/run-plugin-from-worktree.sh +8 -0
- package/.agents/skills/dsh-tui-update-models/references/model-wiring.md +2 -2
- package/README.md +30 -19
- package/cordis.patch.yml +23 -100
- package/lib/agent/presets.d.ts.map +1 -1
- package/lib/agent/presets.js +8 -3
- package/lib/agent/presets.js.map +1 -1
- package/lib/compat/probe.js +1 -1
- package/lib/compat/probe.js.map +1 -1
- package/lib/compat/section.d.ts +8 -1
- package/lib/compat/section.d.ts.map +1 -1
- package/lib/compat/section.js +3 -2
- package/lib/compat/section.js.map +1 -1
- package/lib/herdr/client.d.ts +16 -0
- package/lib/herdr/client.d.ts.map +1 -1
- package/lib/herdr/client.js +60 -19
- package/lib/herdr/client.js.map +1 -1
- package/lib/herdr/constants.d.ts +11 -0
- package/lib/herdr/constants.d.ts.map +1 -1
- package/lib/herdr/constants.js +11 -0
- package/lib/herdr/constants.js.map +1 -1
- package/lib/herdr/reporter.d.ts +8 -0
- package/lib/herdr/reporter.d.ts.map +1 -1
- package/lib/herdr/reporter.js +58 -1
- package/lib/herdr/reporter.js.map +1 -1
- package/lib/herdr/state.d.ts +8 -4
- package/lib/herdr/state.d.ts.map +1 -1
- package/lib/herdr/state.js +10 -6
- package/lib/herdr/state.js.map +1 -1
- package/lib/host/preset-files.d.ts +27 -0
- package/lib/host/preset-files.d.ts.map +1 -0
- package/lib/host/preset-files.js +40 -0
- package/lib/host/preset-files.js.map +1 -0
- package/lib/host/roster.d.ts +17 -0
- package/lib/host/roster.d.ts.map +1 -0
- package/lib/host/roster.js +42 -0
- package/lib/host/roster.js.map +1 -0
- package/lib/host/runner.d.ts +15 -0
- package/lib/host/runner.d.ts.map +1 -0
- package/lib/host/runner.js +17 -0
- package/lib/host/runner.js.map +1 -0
- package/lib/index.d.ts +4 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -2
- package/lib/index.js.map +1 -1
- package/lib/surface/appearance-preferences.d.ts.map +1 -1
- package/lib/surface/appearance-preferences.js +3 -2
- package/lib/surface/appearance-preferences.js.map +1 -1
- package/lib/surface/preset-choice.d.ts.map +1 -1
- package/lib/surface/preset-choice.js +38 -2
- package/lib/surface/preset-choice.js.map +1 -1
- package/lib/todo-guard.d.ts +17 -0
- package/lib/todo-guard.d.ts.map +1 -1
- package/lib/todo-guard.js +3 -1
- package/lib/todo-guard.js.map +1 -1
- package/lib/transcript/tool-calls.d.ts.map +1 -1
- package/lib/transcript/tool-calls.js +16 -2
- package/lib/transcript/tool-calls.js.map +1 -1
- package/package.json +40 -29
- package/presets/cordis.patch.yml +14 -0
- package/presets/minimal.patch.yml +14 -0
- package/presets/ptc.patch.yml +24 -0
- package/presets/standard.patch.yml +14 -0
- package/themes/deepseek-blue.yaml +6 -4
- package/themes/marine-static.yaml +201 -0
- package/themes/pine-slope.yaml +203 -0
- package/themes/polar-drift.yaml +194 -0
- package/themes/wine-thicket.yaml +205 -0
|
@@ -24,7 +24,7 @@ the bundle once if absent from the cloned profile, updates only its dependency,
|
|
|
24
24
|
restores local links from `link:` specifications, and launches
|
|
25
25
|
`dsh --profile tui` by default. For this TUI, the packaged helper checks
|
|
26
26
|
the launcher against compatible releases in the checkout’s `package.json` before
|
|
27
|
-
cloning. This checkout uses installed `dsh 0.
|
|
27
|
+
cloning. This checkout uses the installed `dsh 0.2.0-rc.2` line for PTY tests. Never
|
|
28
28
|
substitute `pnpm dsh` or a `--dsh` path from a Harness source checkout: that
|
|
29
29
|
host may migrate the cloned `settings.yaml`. The legacy
|
|
30
30
|
`scripts/dogfood/run-tui-from-worktree.sh` remains available in dsh-tui and
|
|
@@ -63,6 +63,11 @@ state through a package link.
|
|
|
63
63
|
The old dsh-tui entry point still requires a prelisted bundle. Do not use
|
|
64
64
|
`dsh plugin add` on a cloned profile with other bundles; it can drop them.
|
|
65
65
|
|
|
66
|
+
Use the active model in current session for dogfooding: pass `--model` and
|
|
67
|
+
`--provider` through to the run, because a fixed route either has no credit and
|
|
68
|
+
stops at `error: Insufficient Balance` after the surface is ready, or bills work
|
|
69
|
+
only the plugin under test needed.
|
|
70
|
+
|
|
66
71
|
Use `--status` to verify the existing bundles and the checkout `link:`
|
|
67
72
|
dependency. In dsh-tui, drive a cloned profile with:
|
|
68
73
|
|
|
@@ -427,6 +427,14 @@ printf 'home: %s\n' "$home" >&2
|
|
|
427
427
|
printf 'target: %s\n' "$target_path" >&2
|
|
428
428
|
printf 'profile: %s (%s)\n' "$profile" "$bundles" >&2
|
|
429
429
|
|
|
430
|
+
# Herdr exports its pane coordinates into every process in a pane, and a surface
|
|
431
|
+
# started with them claims that pane's agent row for this run: the row comes back
|
|
432
|
+
# released, and the pane's real agent disappears from Herdr's pickers until it is
|
|
433
|
+
# restarted. The clone is launched as a surface in a bare terminal instead.
|
|
434
|
+
while IFS= read -r herdr_var; do
|
|
435
|
+
unset "$herdr_var"
|
|
436
|
+
done < <(env | sed -n 's/^\(HERDR_[A-Za-z0-9_]*\)=.*/\1/p')
|
|
437
|
+
|
|
430
438
|
run_command=(env "DSH_HOME=$home" "$dsh_bin" --profile "$profile")
|
|
431
439
|
if [[ "${#passthrough[@]}" -gt 0 ]]; then
|
|
432
440
|
run_command+=("${passthrough[@]}")
|
|
@@ -188,8 +188,8 @@ host ignores its `reasoningEffort`, so effort is chosen in the surface.
|
|
|
188
188
|
`saveSelection(next)` validates first, then writes through the host's
|
|
189
189
|
`configEditor.edit(entry, updater)` so only `catalog.default` changes and
|
|
190
190
|
membership is re-checked inside the editor's lock. A host with no addressable
|
|
191
|
-
entry or no such editor rejects with `CONFIG_PERSISTENCE_UNAVAILABLE` -
|
|
192
|
-
|
|
191
|
+
entry or no such editor rejects with `CONFIG_PERSISTENCE_UNAVAILABLE` - a host older
|
|
192
|
+
than the supported line does - and nothing falls back to legacy
|
|
193
193
|
`agent-default-model` settings. Edit the profile patch there.
|
|
194
194
|
|
|
195
195
|
`compileCatalog(config)` and `buildCatalogProfile(provider)` are public: the
|
package/README.md
CHANGED
|
@@ -108,7 +108,7 @@ The profile then keeps `@deepseek-ai/dsh-base` and no application, so `dsh --pro
|
|
|
108
108
|
|
|
109
109
|
### Use the installed Harness launcher
|
|
110
110
|
|
|
111
|
-
Run `dsh --version` and confirm
|
|
111
|
+
Run `dsh --version` and confirm the release is inside the supported window (`>=0.2.0-rc.2 <0.3.0`) before launching this plugin. `pnpm dsh` from a Harness source checkout runs its development host, not the installed release. That host can migrate `settings.yaml` and is outside this plugin's supported range; do not use it for TUI dogfooding.
|
|
112
112
|
|
|
113
113
|
## Troubleshooting
|
|
114
114
|
|
|
@@ -127,7 +127,7 @@ Two facts explain most failures.
|
|
|
127
127
|
| `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 |
|
|
128
128
|
| 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 |
|
|
129
129
|
| Changes under `src/` have no effect | a linked profile loads `lib/`, not `src/` | `pnpm run build` in the plugin checkout |
|
|
130
|
-
| TUI preferences disappear after launching a Harness source checkout | that host treats `settings.yaml` as migration input, not live preferences | use installed
|
|
130
|
+
| TUI preferences disappear after launching a Harness source checkout | that host treats `settings.yaml` as migration input, not live preferences | use an installed release inside the supported window with a cloned home; preserve the original settings file |
|
|
131
131
|
| `--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` |
|
|
132
132
|
| `--resume <id>` starts a new session | the id is a bare UUID | pass the stored id, `tui-session-…` included; a bare `--resume` opens the picker |
|
|
133
133
|
| `dsh: profile "tui" does not exist` | the profile is not created yet | the `add` command creates it |
|
|
@@ -559,9 +559,17 @@ leaving a gap, and `NO_COLOR` draws the fence as plain text. `/export` and the
|
|
|
559
559
|
session file still keep the fence exactly as the model wrote it.
|
|
560
560
|
|
|
561
561
|
A theme restyles the whole surface by name, and a theme is a file. The package
|
|
562
|
-
ships
|
|
563
|
-
the elements it draws its own way —
|
|
564
|
-
in full in the colours the project answers to
|
|
562
|
+
ships six: `violet-orbit`, a port of pi's theme of that name — its palette,
|
|
563
|
+
plus the elements it draws its own way — `deepseek-blue`, the table written out
|
|
564
|
+
in full in the colours the project answers to, `polar-drift`, that table anchored
|
|
565
|
+
on the cyan `#27CFF5`, `pine-slope`, the same table around the pine `#173802`,
|
|
566
|
+
`wine-thicket`, the same table around the plum `#240413`, and `marine-static`,
|
|
567
|
+
the same table around the deep teal `#041F21`. The pine, the plum, and the teal
|
|
568
|
+
are dark enough that they mark the band under a selected row by hue alone, while
|
|
569
|
+
the accent is lifted out of their own hue to where text reads. Each of them tints
|
|
570
|
+
its neutrals through that hue, holds the same relative ladder of shades, and
|
|
571
|
+
leaves the semantic shades where a reader already reads them. `violet-orbit` is
|
|
572
|
+
also what a
|
|
565
573
|
document naming no theme draws, so the default look is a file you can read, list,
|
|
566
574
|
and copy rather than a table compiled in. Your own themes live in
|
|
567
575
|
`$DSH_HOME/themes/`, which the surface creates at start-up and watches, so saving
|
|
@@ -572,11 +580,12 @@ is written until one is taken, so leaving the list puts back the theme that was
|
|
|
572
580
|
force. `theme: violet-orbit` applies one from the document, and a name nothing
|
|
573
581
|
answers to is reported with the names that do, drawing the default while you fix it.
|
|
574
582
|
|
|
575
|
-
|
|
576
|
-
complete theme rather than a diff against something you cannot see.
|
|
577
|
-
`deepseek-blue` is
|
|
578
|
-
|
|
579
|
-
|
|
583
|
+
Every shipped file names every element and every palette entry, so a copy of one
|
|
584
|
+
is a complete theme rather than a diff against something you cannot see. Copying
|
|
585
|
+
`deepseek-blue` is how to move a single shade, because every element follows one
|
|
586
|
+
of its ten palette entries, each taken from DeepSeek's own design tokens with the
|
|
587
|
+
token named beside it — and the accent is one line. `polar-drift` reads the same
|
|
588
|
+
way, with the anchor as its own one line.
|
|
580
589
|
`/theme export <built-in>` writes that copy into your own directory as
|
|
581
590
|
`<built-in>_export_<n>.yaml`, adding one comment naming the release it came from:
|
|
582
591
|
the package's own file is replaced whenever the package updates, so the copy is the
|
|
@@ -720,16 +729,18 @@ alone.
|
|
|
720
729
|
|
|
721
730
|
## Modes
|
|
722
731
|
|
|
723
|
-
A mode is an **agent preset**: the
|
|
732
|
+
A mode is an **agent preset**: the seat an agent's own scope takes in this profile's roster. The rows that make up that agent — its tools, prompt sections, skills, and planning — belong to the bundle shipping each of them, and the profile's own layers compose them, so a mode names a composition rather than assembling one. A mode is fixed once a session has produced a turn, because the log records the seat the agent that answered ran in.
|
|
724
733
|
|
|
725
734
|
Four ship, under the ids a session log records:
|
|
726
735
|
|
|
727
|
-
| `--preset` | Mode | What the
|
|
736
|
+
| `--preset` | Mode | What this bundle makes of the id |
|
|
728
737
|
|---|---|---|
|
|
729
|
-
| `ptc` | PTC (default) | the
|
|
730
|
-
| `standard` | standard |
|
|
731
|
-
| `minimal` | minimal |
|
|
732
|
-
| `cordis` | creator |
|
|
738
|
+
| `ptc` | PTC (default) | the agent this profile composes, with its tools reached through one TypeScript program |
|
|
739
|
+
| `standard` | standard | the same agent, its tools called directly |
|
|
740
|
+
| `minimal` | minimal | the same agent, as this profile composes it |
|
|
741
|
+
| `cordis` | creator | the same agent, for authoring the composition itself |
|
|
742
|
+
|
|
743
|
+
Only PTC declares anything of its own: the presentation its tools take. The other three ids are the harness's own mode names, kept so a session log reads the same here as in the browser profile, and what each of them runs is the profile's composition — a profile that wants a smaller `minimal` declares that composition in its own layers.
|
|
733
744
|
|
|
734
745
|
A session takes its mode from the first of these that applies:
|
|
735
746
|
|
|
@@ -744,8 +755,8 @@ The mode is re-read rather than remembered: resuming mounts what that session's
|
|
|
744
755
|
The package is a Cordis plugin bundle that stacks over `@deepseek-ai/dsh-base`:
|
|
745
756
|
|
|
746
757
|
- `@sagmans/dsh-tui/startup` parses this app's own flags and publishes the launch identity.
|
|
747
|
-
- `@deepseek-ai/dsh-agent-
|
|
748
|
-
- `@deepseek-ai/dsh-
|
|
758
|
+
- The roster of modes holds the id a session starts in when nobody names one: `@deepseek-ai/dsh-agent-preset-registry` owns that service on the supported line, and each mode arrives as a row of `@deepseek-ai/dsh-agent-preset`, so this bundle declares the four modes itself. Both are mounted through this bundle's own `host/roster` entry point, because a patch row is applied before any service exists and the registry and the modes arrive with the harness's own agent services — after the surface that needs the roster. A mode names a selection rather than a composition: the plugins an agent runs on belong to the bundle shipping each of them, and the profile's own layers compose them, so a mode here declares no plugin row and the patch disables none. The one row a mode does own is its presentation: `ptc` mounts `@deepseek-ai/dsh-agent-tool-presentation` with `mode: ptc`, because the form an agent's tools take is declared per agent — a session's own row cannot say it, and a mode without the row presents natively whatever its id says.
|
|
759
|
+
- `@deepseek-ai/dsh-cordis-host-runner` is the host machinery creator mode needs, and the base mounts no such row, so a terminal profile mounts it through this bundle's own `host/runner` entry point. The code runtime PTC mode runs programs against is a base row of its own (`ptc-runtime`) on the supported line, so this bundle mounts none of its own. Both packages are plain dependencies: a profile resolves exactly one copy of each, and the harness reads its runtime version off the runner it mounts.
|
|
749
760
|
- `@sagmans/dsh-tui` owns the terminal: it creates or resumes one agent through `ctx.agents`, folds `session/event` into transcript rows and work state, renders them with `@earendil-works/pi-tui`, and releases the terminal on exit, on a boot failure, and on a signal.
|
|
750
761
|
- `@sagmans/dsh-tui/todo-guard` is the one advisory row this bundle adds to the agent plane: it watches the harness's own `todos` and `plan` projections and rides the next tool result with a reminder when a plan ages. See [Todo discipline](#todo-discipline).
|
|
751
762
|
|
|
@@ -831,7 +842,7 @@ pnpm test
|
|
|
831
842
|
pnpm run build
|
|
832
843
|
```
|
|
833
844
|
|
|
834
|
-
**A linked profile loads the built entry point**, so edits under `src/` are invisible to `dsh --profile tui` until `pnpm run build` runs. The PTY driver rebuilds, checks nested links in the isolated `--home`, and rejects
|
|
845
|
+
**A linked profile loads the built entry point**, so edits under `src/` are invisible to `dsh --profile tui` until `pnpm run build` runs. The PTY driver rebuilds, checks nested links in the isolated `--home`, and rejects a launcher whose version `dsh.compatibility.dshReleases` does not list.
|
|
835
846
|
|
|
836
847
|
Clone your configured home with the dogfood helper for realistic runs. A minimal throwaway home can also expose startup failures without touching your real state:
|
|
837
848
|
|
package/cordis.patch.yml
CHANGED
|
@@ -1,86 +1,30 @@
|
|
|
1
1
|
# dsh-tui — the terminal agent plane, over dsh-base.
|
|
2
2
|
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
# The
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
|
|
15
|
-
disabled: true
|
|
16
|
-
|
|
17
|
-
- id: command-compact
|
|
18
|
-
disabled: true
|
|
19
|
-
|
|
20
|
-
- id: command-goal
|
|
21
|
-
disabled: true
|
|
22
|
-
|
|
23
|
-
- id: compaction-basic
|
|
24
|
-
disabled: true
|
|
25
|
-
|
|
26
|
-
- id: plan-mode
|
|
27
|
-
disabled: true
|
|
28
|
-
|
|
29
|
-
- id: skill-filesystem
|
|
30
|
-
disabled: true
|
|
31
|
-
|
|
32
|
-
- id: tool-bash
|
|
33
|
-
disabled: true
|
|
34
|
-
|
|
35
|
-
- id: tool-fs
|
|
36
|
-
disabled: true
|
|
37
|
-
|
|
38
|
-
- id: tool-fs-search
|
|
39
|
-
disabled: true
|
|
40
|
-
|
|
41
|
-
- id: tool-goal
|
|
42
|
-
disabled: true
|
|
43
|
-
|
|
44
|
-
- id: tool-jobs
|
|
45
|
-
disabled: true
|
|
46
|
-
|
|
47
|
-
- id: tool-pwsh
|
|
48
|
-
disabled: true
|
|
49
|
-
|
|
50
|
-
- id: tool-ralph
|
|
51
|
-
disabled: true
|
|
52
|
-
|
|
53
|
-
- id: tool-result-pruner
|
|
54
|
-
disabled: true
|
|
55
|
-
|
|
56
|
-
- id: tool-skill
|
|
57
|
-
disabled: true
|
|
58
|
-
|
|
59
|
-
- id: tool-subagent
|
|
60
|
-
disabled: true
|
|
61
|
-
|
|
62
|
-
- id: tool-subagent-control
|
|
63
|
-
disabled: true
|
|
64
|
-
|
|
65
|
-
- id: tool-subagent-fork
|
|
66
|
-
disabled: true
|
|
67
|
-
|
|
68
|
-
- id: tool-subagent-list-agents
|
|
69
|
-
disabled: true
|
|
70
|
-
|
|
71
|
-
- id: tool-todo
|
|
72
|
-
disabled: true
|
|
73
|
-
|
|
74
|
-
- id: tool-web
|
|
75
|
-
disabled: true
|
|
3
|
+
# This layer inserts only rows that mount this plugin's own entry points, and it
|
|
4
|
+
# disables no base row. The agent plane itself — the tools, prompt sections,
|
|
5
|
+
# skills, commands, and planning rows a session runs on — belongs to the bundle
|
|
6
|
+
# that ships each of those plugins, and the profile's own bundle layers compose
|
|
7
|
+
# it. A row mounted from here would register what the profile already
|
|
8
|
+
# registered, which is the "already registered" wall this file used to produce
|
|
9
|
+
# once the profile's own layer supplied the same plugins.
|
|
10
|
+
- insert:
|
|
11
|
+
# The two rows below sit ahead of the surface on purpose: a row applies as
|
|
12
|
+
# soon as its own dependencies are up, the surface builds as soon as the
|
|
13
|
+
# harness's agent services are up, and the roster arrives only after settings
|
|
14
|
+
# — later than both.
|
|
76
15
|
|
|
77
|
-
|
|
78
|
-
|
|
16
|
+
# The roster of agent compositions, and the mode a session starts in when
|
|
17
|
+
# nobody names one. PTC leads because a flagless run should reach every tool
|
|
18
|
+
# through one program rather than one shell call at a time.
|
|
19
|
+
- id: agent-presets
|
|
20
|
+
name: '@sagmans/dsh-tui/host/roster'
|
|
79
21
|
|
|
80
|
-
-
|
|
81
|
-
|
|
22
|
+
# Creator mode inspects and re-composes the running harness, which needs the
|
|
23
|
+
# host half of the dynamic-plugin runner. Only the Web bundle ships this
|
|
24
|
+
# row, so a terminal profile has to mount it to offer that mode at all.
|
|
25
|
+
- id: cordis-host-runner
|
|
26
|
+
name: '@sagmans/dsh-tui/host/runner'
|
|
82
27
|
|
|
83
|
-
- insert:
|
|
84
28
|
- id: tui-startup
|
|
85
29
|
name: '@sagmans/dsh-tui/startup'
|
|
86
30
|
|
|
@@ -111,29 +55,8 @@
|
|
|
111
55
|
maxRemindersPerTurn: 3
|
|
112
56
|
previewItems: 5
|
|
113
57
|
|
|
114
|
-
# The roster of agent compositions, and the mode a session starts in when
|
|
115
|
-
# nobody names one. PTC leads because a flagless run should reach every tool
|
|
116
|
-
# through one program rather than one shell call at a time. A profile patch
|
|
117
|
-
# may override this row's config.
|
|
118
|
-
- id: agent-presets
|
|
119
|
-
name: '@deepseek-ai/dsh-agent-presets'
|
|
120
|
-
config:
|
|
121
|
-
default: ptc
|
|
122
|
-
|
|
123
58
|
# A preset's subagent tool samples its delegation model from this host-owned
|
|
124
59
|
# settings row. It is host machinery rather than agent plane, which is why
|
|
125
|
-
# the Web bundle inserts it too instead of leaving it to
|
|
60
|
+
# the Web bundle inserts it too instead of leaving it to a preset.
|
|
126
61
|
- id: subagent-model-selection-settings
|
|
127
62
|
name: '@deepseek-ai/dsh-tool-subagent/model-selection-settings'
|
|
128
|
-
|
|
129
|
-
# Creator mode inspects and re-composes the running harness, which needs the
|
|
130
|
-
# host half of the dynamic-plugin runner. Only the Web bundle ships this
|
|
131
|
-
# row, so a terminal profile has to mount it to offer that mode at all.
|
|
132
|
-
- id: cordis-host-runner
|
|
133
|
-
name: '@deepseek-ai/dsh-cordis-host-runner'
|
|
134
|
-
|
|
135
|
-
# PTC mode runs its programs against a code runtime. The Web bundle mounts
|
|
136
|
-
# this at host level for the same reason: the runtime is machinery, while
|
|
137
|
-
# the preset decides whether an agent uses it.
|
|
138
|
-
- id: code-runtime
|
|
139
|
-
name: '@deepseek-ai/dsh-code-runtime-worker-thread'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/agent/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAGhD;;;;;;;;GAQG;AAEH,6CAA6C;AAC7C,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAAA;IACjC,uEAAuE;IACvE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IACxC,oEAAoE;IACpE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CACpC;AAED,wDAAwD;AACxD,MAAM,MAAM,aAAa,GACrB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CAGnE;
|
|
1
|
+
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../src/agent/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAGhD;;;;;;;;GAQG;AAEH,6CAA6C;AAC7C,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAAA;IACjC,uEAAuE;IACvE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAA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AOG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CAwCzE"}
|
package/lib/agent/presets.js
CHANGED
|
@@ -15,12 +15,17 @@ export function parsePresetArgument(argument) {
|
|
|
15
15
|
* The Web app translates the same four ids from its own locale bundle; a
|
|
16
16
|
* terminal has no such bundle, so the copy lives here. A preset this table does
|
|
17
17
|
* not name is not ours to describe: it speaks for itself through its metadata.
|
|
18
|
+
*
|
|
19
|
+
* A gloss says what this bundle makes of an id, not what the harness's own
|
|
20
|
+
* bundles once composed for it: the agent plane belongs to the profile's own
|
|
21
|
+
* layers, so `standard`, `minimal`, and `cordis` are seats in one composition
|
|
22
|
+
* rather than three, and PTC is the one id whose tools are presented differently.
|
|
18
23
|
*/
|
|
19
24
|
const SHIPPED_GLOSS = {
|
|
20
|
-
standard: '
|
|
25
|
+
standard: 'the agent this profile composes, its tools called directly',
|
|
21
26
|
ptc: 'the same agent, with its tools reached through one TypeScript program',
|
|
22
|
-
minimal: '
|
|
23
|
-
cordis: '
|
|
27
|
+
minimal: 'the same agent, as this profile composes it',
|
|
28
|
+
cordis: 'the same agent, for authoring the composition itself',
|
|
24
29
|
};
|
|
25
30
|
/** How one preset appears in the picker. */
|
|
26
31
|
export function describePreset(preset, currentId) {
|
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,E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;QAChB,CAAC;QACD,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE;YAC5B,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;QACrC,CAAC;QACD,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;YAC1B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;YAC7B,IAAI,OAAO,MAAM,KAAK,UAAU;gBAAE,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAA;YACtG,OAAO,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAAA;QAC9C,CAAC;QACD,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,gBAAgB,CAAC;QACpE,OAAO,EAAE,OAAO,CAAC,EAAE;YACjB,MAAM,QAAQ,GAAG,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAA;YAClE,IAAI,QAAQ,KAAK,SAAS;gBAAE,OAAO,KAAK,CAAA;YACxC,MAAM,IAAI,GAAG,QAAQ,CAAC,gBAAgB,CAAA;YACtC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS;gBAAE,OAAO,IAAI,CAAA;YACpD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAA;QAC/C,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/lib/compat/probe.js
CHANGED
|
@@ -16,7 +16,7 @@ export const REQUIRED_CAPABILITIES = [
|
|
|
16
16
|
{
|
|
17
17
|
service: 'agentPresets',
|
|
18
18
|
use: 'choosing the composition an agent runs, which owns its tools and prompt',
|
|
19
|
-
fix: 'mount @deepseek-ai/dsh-agent-presets, which this bundle inserts',
|
|
19
|
+
fix: 'mount @deepseek-ai/dsh-agent-presets or @deepseek-ai/dsh-agent-preset-registry, which this bundle inserts for the host line',
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
service: 'appExit',
|
package/lib/compat/probe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probe.js","sourceRoot":"","sources":["../../src/compat/probe.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,mDAAmD;AACnD,MAAM,CAAC,MAAM,qBAAqB,GAA0B;IAC1D;QACE,OAAO,EAAE,QAAQ;QACjB,GAAG,EAAE,sDAAsD;QAC3D,GAAG,EAAE,gEAAgE;KACtE;IACD;QACE,OAAO,EAAE,cAAc;QACvB,GAAG,EAAE,yEAAyE;QAC9E,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"probe.js","sourceRoot":"","sources":["../../src/compat/probe.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,mDAAmD;AACnD,MAAM,CAAC,MAAM,qBAAqB,GAA0B;IAC1D;QACE,OAAO,EAAE,QAAQ;QACjB,GAAG,EAAE,sDAAsD;QAC3D,GAAG,EAAE,gEAAgE;KACtE;IACD;QACE,OAAO,EAAE,cAAc;QACvB,GAAG,EAAE,yEAAyE;QAC9E,GAAG,EAAE,6HAA6H;KACnI;IACD;QACE,OAAO,EAAE,SAAS;QAClB,GAAG,EAAE,8CAA8C;QACnD,GAAG,EAAE,2CAA2C;KACjD;CACF,CAAA;AAED,mEAAmE;AACnE,MAAM,CAAC,MAAM,qBAAqB,GAA0B;IAC1D;QACE,OAAO,EAAE,OAAO;QAChB,GAAG,EAAE,yDAAyD;QAC9D,GAAG,EAAE,8BAA8B;KACpC;IACD;QACE,OAAO,EAAE,UAAU;QACnB,GAAG,EAAE,0CAA0C;QAC/C,GAAG,EAAE,iCAAiC;KACvC;IACD;QACE,OAAO,EAAE,oBAAoB;QAC7B,GAAG,EAAE,uCAAuC;QAC5C,GAAG,EAAE,kDAAkD;KACxD;IACD;QACE,OAA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 'register' | 'config' | 'unsupported';
|
|
6
6
|
get(): unknown;
|
|
7
7
|
update(patch: object): Promise<void>;
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Raw opt-outs can precede a valid commit and therefore never reach get() or notifications.
|
|
10
|
+
*
|
|
11
|
+
* A row the document holds no section for reads as `undefined`, the same as a
|
|
12
|
+
* row whose section is empty: neither is an opt-out, and the switches a Config
|
|
13
|
+
* patch or the entry itself declares stand. Only a section the service cannot
|
|
14
|
+
* describe at all is unreadable, which is a refusal rather than an absence.
|
|
15
|
+
*/
|
|
9
16
|
readUser(): {
|
|
10
17
|
readonly value: unknown;
|
|
11
18
|
readonly revision: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../../src/compat/section.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAMlD,oFAAoF;AACpF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,UAAU,GAAG,QAAQ,GAAG,aAAa,CAAA;IACvE,GAAG,IAAI,OAAO,CAAA;IACd,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACpC
|
|
1
|
+
{"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../../src/compat/section.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAMlD,oFAAoF;AACpF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,UAAU,GAAG,QAAQ,GAAG,aAAa,CAAA;IACvE,GAAG,IAAI,OAAO,CAAA;IACd,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACpC;;;;;;;OAOG;IACH,QAAQ,IAAI;QAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAA;CAC/E;AAyBD,iFAAiF;AACjF,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;IACjB,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAA;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,OAAO,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAAA;CAC3G;AAED,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,YAAY,CAqEzF"}
|
package/lib/compat/section.js
CHANGED
|
@@ -9,9 +9,10 @@ export function openSection(service, request) {
|
|
|
9
9
|
if (typeof settings.describe !== 'function')
|
|
10
10
|
return undefined;
|
|
11
11
|
const descriptor = settings.describe().find(row => row.ns === ns);
|
|
12
|
-
if (descriptor === undefined
|
|
12
|
+
if (descriptor === undefined)
|
|
13
|
+
return undefined;
|
|
14
|
+
if (!Number.isSafeInteger(descriptor.revision) || descriptor.revision < 0)
|
|
13
15
|
throw new Error(READ_UNSUPPORTED);
|
|
14
|
-
}
|
|
15
16
|
return { value: descriptor.user, revision: descriptor.revision };
|
|
16
17
|
};
|
|
17
18
|
if (typeof settings.installSection === 'function') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section.js","sourceRoot":"","sources":["../../src/compat/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OAAO,KAAK,SAAS,IAAI,QAAQ,CAAC,QAAQ,KAAK,KAAK,IAAI,OAAO,QAAQ,CAAC,MAAM,KAAK,UAAU;uBAC5F,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC,QAAQ,GAAG,CAAC;oBAAE,OAAO,WAAW,EAAE,CAAA;gBAC1F,MAAM,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;YAC5D,CAAC;SACF,CAAA;IACH,CAAC;IACD,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,GAAG,EAAE,GAAG,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAA,CAAC,CAAC;QACrD,GAAG,EAAE,GAAG,EAAE,GAAG,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAA,CAAC,CAAC;QAChD,MAAM,EAAE,WAAW;KACpB,CAAA;AACH,CAAC"}
|
package/lib/herdr/client.d.ts
CHANGED
|
@@ -23,9 +23,25 @@ export interface SessionReport {
|
|
|
23
23
|
readonly seq: number;
|
|
24
24
|
readonly reason: SessionStartReason;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* What a pane's agent row reads as, from the outside.
|
|
28
|
+
*
|
|
29
|
+
* `none` and `unknown` are the distinction the reclaim loop rests on: a pane
|
|
30
|
+
* with no row is one this surface has to claim again, while a pane Herdr could
|
|
31
|
+
* not be asked about is one it has to leave alone.
|
|
32
|
+
*/
|
|
33
|
+
export type PaneRow = 'ours' | 'other' | 'none' | 'unknown';
|
|
26
34
|
export interface HerdrClient {
|
|
27
35
|
/** Whether Herdr started this process and asked to be told about it. */
|
|
28
36
|
readonly enabled: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Whether Herdr still shows this pane's row.
|
|
39
|
+
*
|
|
40
|
+
* Herdr accepts a stale report the same way it accepts a fresh one, so the
|
|
41
|
+
* pane is the only proof a claim survived: this is the read that turns a
|
|
42
|
+
* silent loss of the row into something the surface can answer.
|
|
43
|
+
*/
|
|
44
|
+
readRow(): Promise<PaneRow>;
|
|
29
45
|
reportState(report: StateReport): Promise<boolean>;
|
|
30
46
|
reportSession(report: SessionReport): Promise<boolean>;
|
|
31
47
|
reportMetadata(tokens: Readonly<Record<string, string | undefined>>): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/herdr/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAaL,KAAK,UAAU,EACf,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAA;AAEvB,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;AAE3E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IACpC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;CACvC;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;CACpC;AAED,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC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S,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;CACpC;AAED;;;;;;GAMG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;AAE3D,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB;;;;;;OAMG;IACH,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;IAC3B,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAClD,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACtD,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACtF;;;;;;OAMG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC7D,8DAA8D;IAC9D,IAAI,IAAI,IAAI,CAAA;IACZ,mEAAmE;IACnE,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACxB;AAsBD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,gBAA8B,EAAE,OAAO,GAAE,kBAAuB,GAAG,WAAW,CAqIpH;AAkBD,iDAAiD;AACjD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
package/lib/herdr/client.js
CHANGED
|
@@ -78,6 +78,23 @@ export function createHerdrClient(env = process.env, options = {}) {
|
|
|
78
78
|
});
|
|
79
79
|
return {
|
|
80
80
|
enabled,
|
|
81
|
+
async readRow() {
|
|
82
|
+
if (closed || !enabled || paneId === undefined || socketPath === undefined)
|
|
83
|
+
return 'unknown';
|
|
84
|
+
const answer = await requestWithRetry(socketPath, {
|
|
85
|
+
id: `${HERDR_SOURCE}:${String(process.pid)}:${String(++requestNumber)}`,
|
|
86
|
+
method: 'pane.get',
|
|
87
|
+
params: { pane_id: paneId },
|
|
88
|
+
}, attempts, timeoutMs, () => closed);
|
|
89
|
+
if (!answer.ok)
|
|
90
|
+
return 'unknown';
|
|
91
|
+
const agent = paneAgent(answer.result);
|
|
92
|
+
if (agent === undefined)
|
|
93
|
+
return 'unknown';
|
|
94
|
+
if (agent === null)
|
|
95
|
+
return 'none';
|
|
96
|
+
return agent === HERDR_AGENT ? 'ours' : 'other';
|
|
97
|
+
},
|
|
81
98
|
reportState(report) {
|
|
82
99
|
return enqueue('pane.report_agent', {
|
|
83
100
|
state: report.state,
|
|
@@ -156,53 +173,58 @@ function acceptedTokens(tokens) {
|
|
|
156
173
|
export function socketEndpoint(path) {
|
|
157
174
|
return process.platform === 'win32' ? `\\\\.\\pipe\\${path}` : path;
|
|
158
175
|
}
|
|
176
|
+
const NO_ANSWER = { ok: false, result: undefined };
|
|
159
177
|
/**
|
|
160
|
-
* Spend one
|
|
178
|
+
* Spend one request's budget, not one per attempt.
|
|
161
179
|
*
|
|
162
|
-
* The deadline covers the whole
|
|
180
|
+
* The deadline covers the whole request: a server that accepts a connection and
|
|
163
181
|
* answers slowly, but always within the idle timeout, would otherwise hold the
|
|
164
182
|
* queue open packet by packet for as long as it liked.
|
|
165
183
|
*/
|
|
166
184
|
async function sendWithRetry(path, request, attempts, timeoutMs, stopped) {
|
|
185
|
+
return (await requestWithRetry(path, request, attempts, timeoutMs, stopped)).ok;
|
|
186
|
+
}
|
|
187
|
+
async function requestWithRetry(path, request, attempts, timeoutMs, stopped) {
|
|
167
188
|
const deadline = Date.now() + timeoutMs;
|
|
168
189
|
for (let attempt = 0; attempt < attempts; attempt += 1) {
|
|
169
190
|
// A stopped transport does not try again: the pane is no longer an agent,
|
|
170
191
|
// and an attempt that landed after the release would claim the row back.
|
|
171
192
|
if (stopped())
|
|
172
|
-
return
|
|
193
|
+
return NO_ANSWER;
|
|
173
194
|
const remaining = deadline - Date.now();
|
|
174
195
|
if (remaining <= 0)
|
|
175
|
-
return
|
|
176
|
-
|
|
177
|
-
|
|
196
|
+
return NO_ANSWER;
|
|
197
|
+
const answer = await requestAttempt(path, request, remaining);
|
|
198
|
+
if (answer.ok)
|
|
199
|
+
return answer;
|
|
178
200
|
}
|
|
179
|
-
return
|
|
201
|
+
return NO_ANSWER;
|
|
180
202
|
}
|
|
181
|
-
function
|
|
203
|
+
function requestAttempt(path, request, timeoutMs) {
|
|
182
204
|
return new Promise(resolve => {
|
|
183
205
|
const socket = createConnection(socketEndpoint(path));
|
|
184
206
|
const chunks = [];
|
|
185
207
|
let received = 0;
|
|
186
208
|
let settled = false;
|
|
187
|
-
const finish = (
|
|
209
|
+
const finish = (answer) => {
|
|
188
210
|
if (settled)
|
|
189
211
|
return;
|
|
190
212
|
settled = true;
|
|
191
213
|
clearTimeout(expiry);
|
|
192
214
|
socket.destroy();
|
|
193
|
-
resolve(
|
|
215
|
+
resolve(answer);
|
|
194
216
|
};
|
|
195
217
|
// Idle time is the fast signal; the hard deadline is what a peer that keeps
|
|
196
218
|
// the socket busy cannot postpone.
|
|
197
|
-
const expiry = setTimeout(() => finish(
|
|
198
|
-
socket.setTimeout(timeoutMs, () => finish(
|
|
199
|
-
socket.once('error', () => finish(
|
|
200
|
-
socket.once('end', () => finish(
|
|
219
|
+
const expiry = setTimeout(() => finish(NO_ANSWER), timeoutMs);
|
|
220
|
+
socket.setTimeout(timeoutMs, () => finish(NO_ANSWER));
|
|
221
|
+
socket.once('error', () => finish(NO_ANSWER));
|
|
222
|
+
socket.once('end', () => finish(NO_ANSWER));
|
|
201
223
|
socket.once('connect', () => socket.write(`${JSON.stringify(request)}${RESPONSE_DELIMITER}`));
|
|
202
224
|
socket.on('data', (chunk) => {
|
|
203
225
|
received += chunk.byteLength;
|
|
204
226
|
if (received > MAX_RESPONSE_BYTES) {
|
|
205
|
-
finish(
|
|
227
|
+
finish(NO_ANSWER);
|
|
206
228
|
return;
|
|
207
229
|
}
|
|
208
230
|
chunks.push(chunk);
|
|
@@ -211,19 +233,38 @@ function sendAttempt(path, request, timeoutMs) {
|
|
|
211
233
|
// A report is only delivered when Herdr says so: a write into a socket
|
|
212
234
|
// that closed on the far side would otherwise look like success.
|
|
213
235
|
if (end >= 0)
|
|
214
|
-
finish(
|
|
236
|
+
finish(answerFor(response.slice(0, end), request.id));
|
|
215
237
|
});
|
|
216
238
|
});
|
|
217
239
|
}
|
|
218
|
-
function
|
|
240
|
+
function answerFor(response, requestId) {
|
|
219
241
|
try {
|
|
220
242
|
const parsed = JSON.parse(response);
|
|
221
|
-
|
|
243
|
+
if (!isRecord(parsed) || parsed.id !== requestId || 'error' in parsed)
|
|
244
|
+
return NO_ANSWER;
|
|
245
|
+
return 'result' in parsed ? { ok: true, result: parsed.result } : NO_ANSWER;
|
|
222
246
|
}
|
|
223
247
|
catch {
|
|
224
|
-
return
|
|
248
|
+
return NO_ANSWER;
|
|
225
249
|
}
|
|
226
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* The agent label a `pane.get` answer carries.
|
|
253
|
+
*
|
|
254
|
+
* Herdr drops the field entirely once the row is gone rather than sending a
|
|
255
|
+
* null, so a pane object that names no agent is the answer the reclaim loop
|
|
256
|
+
* acts on. An answer without a pane object at all is one this code cannot read,
|
|
257
|
+
* and a read that cannot be read must never be the reason for a write.
|
|
258
|
+
*/
|
|
259
|
+
function paneAgent(result) {
|
|
260
|
+
if (!isRecord(result))
|
|
261
|
+
return undefined;
|
|
262
|
+
const pane = result.pane;
|
|
263
|
+
if (!isRecord(pane))
|
|
264
|
+
return undefined;
|
|
265
|
+
const agent = pane.agent;
|
|
266
|
+
return typeof agent === 'string' ? agent : null;
|
|
267
|
+
}
|
|
227
268
|
function isRecord(value) {
|
|
228
269
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
229
270
|
}
|