@xiangyixie/dsh-superagent 0.12.1 → 0.14.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/CHANGELOG.md +171 -8
- package/LICENSE +21 -21
- package/README.md +522 -40
- package/bin/doctor.js +1 -1
- package/cordis.patch.yml +9 -9
- package/lib/audit.js +8 -1
- package/lib/browser.js +795 -0
- package/lib/console.js +763 -0
- package/lib/cost.js +71 -11
- package/lib/cron.js +387 -0
- package/lib/desktop.js +507 -0
- package/lib/doctor.js +1 -0
- package/lib/goal.js +649 -0
- package/lib/guard.js +15 -0
- package/lib/index.js +1296 -42
- package/lib/ledger.js +26 -12
- package/lib/orchestrator.js +1765 -136
- package/lib/report.js +59 -29
- package/lib/runtime-control.js +1151 -0
- package/lib/schedule.js +1030 -0
- package/lib/store.js +6 -2
- package/lib/user-memory.js +587 -0
- package/lib/watch.js +25 -17
- package/lib/workbench.js +7 -7
- package/lib/workspace.js +88 -27
- package/package.json +101 -92
- package/public/console.html +1618 -0
package/CHANGELOG.md
CHANGED
|
@@ -8,18 +8,181 @@ along with the next code release. A doc-only version leaves `lib/` and `bin/`
|
|
|
8
8
|
byte-identical to the version before it, and the pinned install line in the
|
|
9
9
|
README is updated to the version being released.
|
|
10
10
|
|
|
11
|
-
## 0.
|
|
11
|
+
## 0.14.0 — 2026-11-15
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **Attach mode is complete.** With `runtime.browser.attachPort` set, every
|
|
16
|
+
browser tool — listing, clicking, typing, screenshots, scripts — runs on the
|
|
17
|
+
browser the user started with `--remote-debugging-port`, on the tab that is
|
|
18
|
+
already open. The tab keeps its own window size (no viewport override), and
|
|
19
|
+
`browser_close` detaches instead of terminating the user's browser (a blank tab
|
|
20
|
+
created only because no page existed is closed). A port that is not listening
|
|
21
|
+
now fails with the port, a Chrome/Edge start command, and an explicit
|
|
22
|
+
statement that no profile was launched in its place; attach never falls back
|
|
23
|
+
to a fresh profile.
|
|
24
|
+
- **Persistent profile option.** `runtime.browser.userDataDir` points a launched
|
|
25
|
+
browser at one dedicated profile, so a sign-in done once is reused on later
|
|
26
|
+
runs. The default is still a fresh temporary profile, which cannot see the
|
|
27
|
+
user's daily cookies; the README spells out the trade-off and ignores
|
|
28
|
+
`userDataDir` while `attachPort` is set.
|
|
29
|
+
- **Human checks hand back instead of failing.** `lib/browser.js` classifies
|
|
30
|
+
page text for a sign-in wall, CAPTCHA / "confirm you are human", SMS or
|
|
31
|
+
one-time code, two-factor, and QR login. `browser_open`, `browser_click`, and a
|
|
32
|
+
submitting `browser_type` stop at such a page and return `[attention]` with
|
|
33
|
+
the page, the check, where the person finishes it, and the next call — never a
|
|
34
|
+
failure. New `browser_await_human` polls until the check is gone and reports
|
|
35
|
+
ok, or hands back again at its timeout. It never solves, types, or scans the
|
|
36
|
+
check. A headless launch explains that it has no window and points at
|
|
37
|
+
`headless: false` or attach.
|
|
38
|
+
- **Audit distinguishes the connection.** Every browser audit line carries
|
|
39
|
+
`meta.session: "attach" | "launch"`, plus `meta.port` and the reused tab for
|
|
40
|
+
attach, or `meta.profile` / `meta.persistentProfile` / `meta.headless` for a
|
|
41
|
+
launch. Human hand-offs are recorded as `kind: "attention"`,
|
|
42
|
+
`decision: "attention"`, `result: "needs-human"`; attach failures record
|
|
43
|
+
`rule: "runtime/attach-failed"` with the actionable message rather than being
|
|
44
|
+
mistaken for a provider error.
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
|
|
48
|
+
- The domain allow-list, irreversible-action confirmation, file-upload refusal,
|
|
49
|
+
stop switch, and worker-tool guard all sit in the same call path as before, so
|
|
50
|
+
they apply unchanged on an attach connection; tests cover each one there.
|
|
51
|
+
- `browser_type` masks the read-back value for a password field.
|
|
12
52
|
|
|
13
53
|
### Fixed
|
|
14
54
|
|
|
15
|
-
- **
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
55
|
+
- **Costs are grouped by currency.** A run that used a USD-priced route and a
|
|
56
|
+
CNY-priced route used to add their micro-units and label the sum with the
|
|
57
|
+
first model's currency. It now keeps one subtotal per currency and prints
|
|
58
|
+
them separately (`¥0.0952 + $0.0248`) in the run line, `superagent_list`'s
|
|
59
|
+
ledger line, the `watch` footer, the exported `README.md`, and the HTML
|
|
60
|
+
report; a mixed window gets one cost curve per currency. Single-currency runs
|
|
61
|
+
keep the existing `¥0.3600` format, and an unpriced model stays `unpriced`
|
|
62
|
+
rather than becoming zero.
|
|
22
63
|
|
|
64
|
+
## 0.13.0 — 2026-11-15
|
|
65
|
+
|
|
66
|
+
### Added
|
|
67
|
+
|
|
68
|
+
- **Goal mode.** `superagent_start` accepts `goal_mode: true` with an
|
|
69
|
+
`acceptance` list, and the run no longer ends when its subtasks do. Each
|
|
70
|
+
condition is `{id?, text, check?}`; a `command` or `file` check is executed by
|
|
71
|
+
the plugin, so that verdict rests on a real exit code or a real file, and only
|
|
72
|
+
an unchecked condition goes to an independent acceptance model. A failed round
|
|
73
|
+
starts another with what is still missing, bounded by `max_rounds` (5),
|
|
74
|
+
`max_wall_clock_minutes` (60), and `no_progress_rounds` (2), and stops with a
|
|
75
|
+
written reason on the round cap, the wall clock, the deadline, a budget stop,
|
|
76
|
+
an open attention item, or two identical failing rounds. One notification when
|
|
77
|
+
the loop ends, none between rounds. `lib/goal.js`; off unless asked for, and it
|
|
78
|
+
adds no tool.
|
|
79
|
+
- **Scheduled runs.** New `superagent_schedule` tool (`create`, `list`, `pause`,
|
|
80
|
+
`resume`, `delete`, `run-now`) stores a plan — goal or expanded template, cron
|
|
81
|
+
or fixed interval, time zone, its own budget and concurrency policy — and
|
|
82
|
+
starts runs with nobody calling `superagent_start`. `lib/cron.js` is a
|
|
83
|
+
zero-dependency 5-field parser (`*`, `*/n`, ranges, lists, month and weekday
|
|
84
|
+
names, 0 or 7 for Sunday; seconds, `@`-macros, `L`, `W`, `#`, and `?` are
|
|
85
|
+
refused by field). Missed windows are not replayed: `latest` runs the newest
|
|
86
|
+
one and records the rest as missed, `none` skips them. A plan never overlaps
|
|
87
|
+
itself, one slot stays reserved for manual runs by default, and three
|
|
88
|
+
consecutive failures pause the plan and say so once. Plans survive a host
|
|
89
|
+
restart, and an install with no plans behaves exactly as before.
|
|
90
|
+
- **Plan honesty and capability preflight.** The planner now returns
|
|
91
|
+
`ambiguities` (phrases it cannot map to a concrete object), `needsInput`
|
|
92
|
+
(questions only the user can answer), per-subtask `assumptions`, and
|
|
93
|
+
`requires` capability tags. A plan that only raises questions stops the run as
|
|
94
|
+
one decision point instead of guessing; assumptions are stored on the subtask
|
|
95
|
+
and printed in status and the report. `preflightCapabilities` compares
|
|
96
|
+
`requires` with the tools the session actually has before a worker starts: a
|
|
97
|
+
missing capability blocks that subtask with the capability and the fix named,
|
|
98
|
+
cascades `skipped` to everything downstream, and is never counted as success.
|
|
99
|
+
When the host cannot list its tools the preflight records `unavailable` and
|
|
100
|
+
blocks nothing.
|
|
101
|
+
- **User profile.** Optional cross-task memory (`memoryUserProfile: true`) in
|
|
102
|
+
`lib/user-memory.js`: three categories (`fact`, `preference`, `decision`) in
|
|
103
|
+
three files, a decision stored only with its reason, `superagent_memory` with
|
|
104
|
+
`layer: "user"` reading and writing it, and forgetting as a real deletion
|
|
105
|
+
under a lock with no tombstone. Everything is redacted before it is written,
|
|
106
|
+
and nothing is constructed unless the operator turns it on.
|
|
107
|
+
- **Conversation console.** `lib/console.js` and `public/console.html` serve a
|
|
108
|
+
loopback page (`consolePort`) that talks to a real Host Session through
|
|
109
|
+
`sessionController` — create, prompt, follow, observe state — so a conversation
|
|
110
|
+
can be started, followed up, watched while its derived run works, and have its
|
|
111
|
+
attention questions answered from the page. Server-sent events stream updates;
|
|
112
|
+
the one-time token is written to `<stateDir>/console.json`. Without
|
|
113
|
+
`sessionController` the page says it is unavailable instead of drawing a
|
|
114
|
+
fake conversation.
|
|
115
|
+
- **Runtime control: a real browser and, on Windows, the real desktop.** New
|
|
116
|
+
opt-in layer (`lib/browser.js`, `lib/desktop.js`, `lib/runtime-control.js`)
|
|
117
|
+
that registers `browser_*` and `desktop_*` tools only when
|
|
118
|
+
`runtime.enabled` is true. The browser is driven over the DevTools protocol
|
|
119
|
+
through Node's built-in `WebSocket` and gets its own `--user-data-dir`, so
|
|
120
|
+
there is no npm dependency and no access to the user's cookies or logins. The
|
|
121
|
+
desktop half compiles a `user32.dll` helper with `Add-Type` inside
|
|
122
|
+
`powershell.exe`, posts input without activating the target window by default,
|
|
123
|
+
and only goes foreground on `activate: true` when the config allows it.
|
|
124
|
+
Element lookup accepts visible text, ARIA name, role, CSS selector, or the
|
|
125
|
+
index a previous `browser_elements` returned, and every click and typing call
|
|
126
|
+
screenshots afterwards.
|
|
127
|
+
- **Gates and audit.** An emergency stop file refuses every action while it
|
|
128
|
+
exists; `file://`, other non-HTTP schemes, and hosts outside the allowlist are
|
|
129
|
+
refused; file inputs are refused; labels that read submit/delete/pay (or 提交/
|
|
130
|
+
删除/支付) need `confirm: true`. Every attempt writes one audit event with
|
|
131
|
+
action, target, decision, result, rule, and duration — including refusals,
|
|
132
|
+
which used to be indistinguishable from failures.
|
|
133
|
+
- **Guard coverage for worker agents.** `lib/guard.js` refuses `browser_*` and
|
|
134
|
+
`desktop_*` calls from bound child agents with rule `guard/runtime-tool`,
|
|
135
|
+
unless `guard.allowRuntimeTools` is set. Runtime control belongs to the
|
|
136
|
+
session that mounted the plugin; a worker driving the user's screen is not
|
|
137
|
+
something to allow by default.
|
|
138
|
+
- **Two runnable proofs.** `scripts/runtime-demo.mjs` and
|
|
139
|
+
`scripts/runtime-desktop-demo.mjs` assert against the target's own state (a
|
|
140
|
+
DOM counter, a window's click counter and received characters) rather than
|
|
141
|
+
against the tool's own report.
|
|
142
|
+
|
|
143
|
+
### Changed
|
|
144
|
+
|
|
145
|
+
- The default tool set is twelve: `superagent_schedule` joins the existing
|
|
146
|
+
eleven. `bin/doctor.js` and its test expect twelve, and a profile that never
|
|
147
|
+
enables runtime control still sees exactly these twelve.
|
|
148
|
+
- `README.md` gained "Goal mode", "Scheduled runs", "Conversation console",
|
|
149
|
+
"User profile", and the plan-honesty and preflight entries under
|
|
150
|
+
"Progress, decisions, and artifacts", and its tool table matches the twelve
|
|
151
|
+
registered tools.
|
|
152
|
+
|
|
153
|
+
### Fixed
|
|
154
|
+
|
|
155
|
+
- **Worker checkouts and deliverable verdicts.** A worker starts in its own
|
|
156
|
+
worktree and its prompt names the root that relative paths resolve against.
|
|
157
|
+
A deliverable found only in the base checkout is reported as `misplaced`, not
|
|
158
|
+
`missing` — one means the file was produced in the wrong root, the other means
|
|
159
|
+
it was not produced at all. The worktree pool is anchored to the session's
|
|
160
|
+
sandbox boundary, so a host started from another directory no longer creates
|
|
161
|
+
checkouts outside the workspace it guards.
|
|
162
|
+
|
|
163
|
+
### Notes
|
|
164
|
+
|
|
165
|
+
- `README.md` gained a "Runtime control" section that lists the tools, the
|
|
166
|
+
gates, and the boundaries that are real: no borrowing of existing browser
|
|
167
|
+
logins, no CAPTCHA solving, no anti-detection, and no background typing into
|
|
168
|
+
Chromium or Electron content.
|
|
169
|
+
- `Add-Type` needs a writable `%TEMP%`. The desktop helper points `TEMP`/`TMP`
|
|
170
|
+
at `%LOCALAPPDATA%/Temp/dsh-runtime-control`, because a restricted token that
|
|
171
|
+
can read `C:\Windows\TEMP` but not write there makes the C# compiler report a
|
|
172
|
+
misleading "source file not found".
|
|
173
|
+
|
|
174
|
+
## 0.12.1 — 2026-11-15
|
|
175
|
+
|
|
176
|
+
### Fixed
|
|
177
|
+
|
|
178
|
+
- **Line endings in `bin/` and `lib/`.** Added `.gitattributes` with
|
|
179
|
+
`*.js text eol=lf` for both directories and normalized the tracked files to
|
|
180
|
+
LF. npm rewrites the shebang line of bin scripts during install (CRLF → LF,
|
|
181
|
+
one byte per file), which made `doctor`'s registry checksum comparison report
|
|
182
|
+
a false `Registry match` failure for `bin/*.js` on npm-installed copies. With
|
|
183
|
+
the tarball now shipping LF, installed files match the published package
|
|
184
|
+
byte-for-byte.
|
|
185
|
+
|
|
23
186
|
## 0.12.0 — 2026-11-15
|
|
24
187
|
|
|
25
188
|
### Added
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Admire (LittleChenLiya)
|
|
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.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Admire (LittleChenLiya)
|
|
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.
|