@descryy/mcp 0.6.0 → 0.7.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/dist/action-handshake.d.ts +8 -75
- package/dist/action-handshake.d.ts.map +1 -1
- package/dist/action-handshake.js +9 -79
- package/dist/action-handshake.js.map +1 -1
- package/dist/bin/descry-mcp.d.ts +4 -15
- package/dist/bin/descry-mcp.d.ts.map +1 -1
- package/dist/bin/descry-mcp.js +12 -42
- package/dist/bin/descry-mcp.js.map +1 -1
- package/dist/browser/driver.d.ts +59 -224
- package/dist/browser/driver.d.ts.map +1 -1
- package/dist/browser/driver.js +9 -55
- package/dist/browser/driver.js.map +1 -1
- package/dist/browser/evidence.d.ts +10 -43
- package/dist/browser/evidence.d.ts.map +1 -1
- package/dist/browser/evidence.js +20 -54
- package/dist/browser/evidence.js.map +1 -1
- package/dist/browser/fake-driver.d.ts +4 -16
- package/dist/browser/fake-driver.d.ts.map +1 -1
- package/dist/browser/fake-driver.js +6 -20
- package/dist/browser/fake-driver.js.map +1 -1
- package/dist/browser/graph-write.d.ts +4 -45
- package/dist/browser/graph-write.d.ts.map +1 -1
- package/dist/browser/graph-write.js +8 -53
- package/dist/browser/graph-write.js.map +1 -1
- package/dist/browser/playwright-driver.d.ts +7 -91
- package/dist/browser/playwright-driver.d.ts.map +1 -1
- package/dist/browser/playwright-driver.js +40 -194
- package/dist/browser/playwright-driver.js.map +1 -1
- package/dist/browser/provider.d.ts +5 -34
- package/dist/browser/provider.d.ts.map +1 -1
- package/dist/browser/provider.js +4 -24
- package/dist/browser/provider.js.map +1 -1
- package/dist/browser/registry.d.ts +26 -106
- package/dist/browser/registry.d.ts.map +1 -1
- package/dist/browser/registry.js +20 -77
- package/dist/browser/registry.js.map +1 -1
- package/dist/browser/scenario-resolve.d.ts +10 -44
- package/dist/browser/scenario-resolve.d.ts.map +1 -1
- package/dist/browser/scenario-resolve.js +10 -41
- package/dist/browser/scenario-resolve.js.map +1 -1
- package/dist/browser/scenario-runner.d.ts +12 -70
- package/dist/browser/scenario-runner.d.ts.map +1 -1
- package/dist/browser/scenario-runner.js +30 -90
- package/dist/browser/scenario-runner.js.map +1 -1
- package/dist/browser/stack-parser.d.ts +4 -28
- package/dist/browser/stack-parser.d.ts.map +1 -1
- package/dist/browser/stack-parser.js +12 -39
- package/dist/browser/stack-parser.js.map +1 -1
- package/dist/browser/tool-support.d.ts +20 -67
- package/dist/browser/tool-support.d.ts.map +1 -1
- package/dist/browser/tool-support.js +21 -65
- package/dist/browser/tool-support.js.map +1 -1
- package/dist/browser/url-scheme.d.ts +14 -0
- package/dist/browser/url-scheme.d.ts.map +1 -0
- package/dist/browser/url-scheme.js +38 -0
- package/dist/browser/url-scheme.js.map +1 -0
- package/dist/cancellation.d.ts +11 -46
- package/dist/cancellation.d.ts.map +1 -1
- package/dist/cancellation.js +11 -46
- package/dist/cancellation.js.map +1 -1
- package/dist/capped.d.ts +9 -33
- package/dist/capped.d.ts.map +1 -1
- package/dist/capped.js +7 -27
- package/dist/capped.js.map +1 -1
- package/dist/disclosure-ledger.d.ts +6 -30
- package/dist/disclosure-ledger.d.ts.map +1 -1
- package/dist/disclosure-ledger.js +4 -26
- package/dist/disclosure-ledger.js.map +1 -1
- package/dist/index.d.ts +10 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -17
- package/dist/index.js.map +1 -1
- package/dist/module-trust.d.ts +24 -0
- package/dist/module-trust.d.ts.map +1 -0
- package/dist/module-trust.js +60 -0
- package/dist/module-trust.js.map +1 -0
- package/dist/path-confinement.d.ts +31 -0
- package/dist/path-confinement.d.ts.map +1 -0
- package/dist/path-confinement.js +44 -0
- package/dist/path-confinement.js.map +1 -0
- package/dist/protocol.d.ts +10 -53
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +14 -60
- package/dist/protocol.js.map +1 -1
- package/dist/registry.d.ts +10 -58
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +38 -90
- package/dist/registry.js.map +1 -1
- package/dist/render.d.ts +42 -11
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +74 -10
- package/dist/render.js.map +1 -1
- package/dist/runtime-registry.d.ts +7 -66
- package/dist/runtime-registry.d.ts.map +1 -1
- package/dist/runtime-registry.js +39 -114
- package/dist/runtime-registry.js.map +1 -1
- package/dist/scenarios/index.d.ts +1 -1
- package/dist/scenarios/index.d.ts.map +1 -1
- package/dist/scenarios/index.js +1 -1
- package/dist/scenarios/index.js.map +1 -1
- package/dist/scenarios/parse.d.ts +4 -18
- package/dist/scenarios/parse.d.ts.map +1 -1
- package/dist/scenarios/parse.js +14 -34
- package/dist/scenarios/parse.js.map +1 -1
- package/dist/scenarios/scenario.d.ts +18 -74
- package/dist/scenarios/scenario.d.ts.map +1 -1
- package/dist/scenarios/scenario.js +7 -34
- package/dist/scenarios/scenario.js.map +1 -1
- package/dist/scenarios/storage.d.ts +11 -41
- package/dist/scenarios/storage.d.ts.map +1 -1
- package/dist/scenarios/storage.js +57 -47
- package/dist/scenarios/storage.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +37 -17
- package/dist/server.js.map +1 -1
- package/dist/session.d.ts +67 -259
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +69 -250
- package/dist/session.js.map +1 -1
- package/dist/tools/analyze.d.ts +24 -118
- package/dist/tools/analyze.d.ts.map +1 -1
- package/dist/tools/analyze.js +44 -166
- package/dist/tools/analyze.js.map +1 -1
- package/dist/tools/browser-click.d.ts +3 -21
- package/dist/tools/browser-click.d.ts.map +1 -1
- package/dist/tools/browser-click.js +10 -31
- package/dist/tools/browser-click.js.map +1 -1
- package/dist/tools/browser-close-session.d.ts +4 -13
- package/dist/tools/browser-close-session.d.ts.map +1 -1
- package/dist/tools/browser-close-session.js +4 -13
- package/dist/tools/browser-close-session.js.map +1 -1
- package/dist/tools/browser-fill.d.ts +5 -36
- package/dist/tools/browser-fill.d.ts.map +1 -1
- package/dist/tools/browser-fill.js +9 -44
- package/dist/tools/browser-fill.js.map +1 -1
- package/dist/tools/browser-navigate.d.ts +6 -27
- package/dist/tools/browser-navigate.d.ts.map +1 -1
- package/dist/tools/browser-navigate.js +6 -23
- package/dist/tools/browser-navigate.js.map +1 -1
- package/dist/tools/browser-run-scenario.d.ts +5 -31
- package/dist/tools/browser-run-scenario.d.ts.map +1 -1
- package/dist/tools/browser-run-scenario.js +10 -46
- package/dist/tools/browser-run-scenario.js.map +1 -1
- package/dist/tools/browser-save-scenario.d.ts +3 -28
- package/dist/tools/browser-save-scenario.d.ts.map +1 -1
- package/dist/tools/browser-save-scenario.js +15 -74
- package/dist/tools/browser-save-scenario.js.map +1 -1
- package/dist/tools/browser-snapshot.d.ts +6 -39
- package/dist/tools/browser-snapshot.d.ts.map +1 -1
- package/dist/tools/browser-snapshot.js +4 -31
- package/dist/tools/browser-snapshot.js.map +1 -1
- package/dist/tools/browser-start-session.d.ts +4 -23
- package/dist/tools/browser-start-session.d.ts.map +1 -1
- package/dist/tools/browser-start-session.js +33 -55
- package/dist/tools/browser-start-session.js.map +1 -1
- package/dist/tools/browser-type.d.ts +5 -35
- package/dist/tools/browser-type.d.ts.map +1 -1
- package/dist/tools/browser-type.js +10 -45
- package/dist/tools/browser-type.js.map +1 -1
- package/dist/tools/contracts.d.ts +9 -86
- package/dist/tools/contracts.d.ts.map +1 -1
- package/dist/tools/contracts.js +24 -80
- package/dist/tools/contracts.js.map +1 -1
- package/dist/tools/cross-pr.d.ts +42 -30
- package/dist/tools/cross-pr.d.ts.map +1 -1
- package/dist/tools/cross-pr.js +81 -62
- package/dist/tools/cross-pr.js.map +1 -1
- package/dist/tools/git-diff.d.ts +18 -2
- package/dist/tools/git-diff.d.ts.map +1 -1
- package/dist/tools/git-diff.js +118 -26
- package/dist/tools/git-diff.js.map +1 -1
- package/dist/tools/git-history.d.ts +5 -16
- package/dist/tools/git-history.d.ts.map +1 -1
- package/dist/tools/git-history.js +3 -10
- package/dist/tools/git-history.js.map +1 -1
- package/dist/tools/history.d.ts +4 -33
- package/dist/tools/history.d.ts.map +1 -1
- package/dist/tools/history.js +6 -31
- package/dist/tools/history.js.map +1 -1
- package/dist/tools/impact.d.ts +7 -51
- package/dist/tools/impact.d.ts.map +1 -1
- package/dist/tools/impact.js +15 -67
- package/dist/tools/impact.js.map +1 -1
- package/dist/tools/index.d.ts +3 -8
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +3 -8
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/kit.d.ts +66 -113
- package/dist/tools/kit.d.ts.map +1 -1
- package/dist/tools/kit.js +60 -28
- package/dist/tools/kit.js.map +1 -1
- package/dist/tools/link-workspace.d.ts +7 -45
- package/dist/tools/link-workspace.d.ts.map +1 -1
- package/dist/tools/link-workspace.js +10 -48
- package/dist/tools/link-workspace.js.map +1 -1
- package/dist/tools/lookup.d.ts +4 -14
- package/dist/tools/lookup.d.ts.map +1 -1
- package/dist/tools/lookup.js +4 -14
- package/dist/tools/lookup.js.map +1 -1
- package/dist/tools/mark-incident.d.ts +7 -54
- package/dist/tools/mark-incident.d.ts.map +1 -1
- package/dist/tools/mark-incident.js +15 -68
- package/dist/tools/mark-incident.js.map +1 -1
- package/dist/tools/observe-runtime.d.ts +27 -210
- package/dist/tools/observe-runtime.d.ts.map +1 -1
- package/dist/tools/observe-runtime.js +257 -435
- package/dist/tools/observe-runtime.js.map +1 -1
- package/dist/tools/observe-tests.d.ts +9 -100
- package/dist/tools/observe-tests.d.ts.map +1 -1
- package/dist/tools/observe-tests.js +24 -152
- package/dist/tools/observe-tests.js.map +1 -1
- package/dist/tools/pr-analysis.d.ts +18 -2
- package/dist/tools/pr-analysis.d.ts.map +1 -1
- package/dist/tools/pr-analysis.js +73 -23
- package/dist/tools/pr-analysis.js.map +1 -1
- package/dist/tools/pre-push.d.ts +68 -16
- package/dist/tools/pre-push.d.ts.map +1 -1
- package/dist/tools/pre-push.js +98 -35
- package/dist/tools/pre-push.js.map +1 -1
- package/dist/tools/propagation.d.ts +11 -53
- package/dist/tools/propagation.d.ts.map +1 -1
- package/dist/tools/propagation.js +14 -57
- package/dist/tools/propagation.js.map +1 -1
- package/dist/tools/questions.d.ts +13 -63
- package/dist/tools/questions.d.ts.map +1 -1
- package/dist/tools/questions.js +33 -105
- package/dist/tools/questions.js.map +1 -1
- package/dist/tools/refusal-fetch.d.ts +4 -40
- package/dist/tools/refusal-fetch.d.ts.map +1 -1
- package/dist/tools/refusal-fetch.js +4 -40
- package/dist/tools/refusal-fetch.js.map +1 -1
- package/dist/tools/runtime-incident.d.ts +4 -63
- package/dist/tools/runtime-incident.d.ts.map +1 -1
- package/dist/tools/runtime-incident.js +10 -87
- package/dist/tools/runtime-incident.js.map +1 -1
- package/dist/tools/scope.d.ts +7 -25
- package/dist/tools/scope.d.ts.map +1 -1
- package/dist/tools/scope.js +10 -29
- package/dist/tools/scope.js.map +1 -1
- package/dist/tools/similar-incidents.d.ts +11 -86
- package/dist/tools/similar-incidents.d.ts.map +1 -1
- package/dist/tools/similar-incidents.js +7 -71
- package/dist/tools/similar-incidents.js.map +1 -1
- package/dist/tools/validate.d.ts +14 -69
- package/dist/tools/validate.d.ts.map +1 -1
- package/dist/tools/validate.js +23 -74
- package/dist/tools/validate.js.map +1 -1
- package/dist/tools/verification-status.d.ts +9 -64
- package/dist/tools/verification-status.d.ts.map +1 -1
- package/dist/tools/verification-status.js +9 -62
- package/dist/tools/verification-status.js.map +1 -1
- package/dist/tools/verify-claim.d.ts +5 -52
- package/dist/tools/verify-claim.d.ts.map +1 -1
- package/dist/tools/verify-claim.js +6 -56
- package/dist/tools/verify-claim.js.map +1 -1
- package/dist/transport.d.ts +15 -52
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +16 -60
- package/dist/transport.js.map +1 -1
- package/package.json +30 -21
|
@@ -1,32 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `browser_save_scenario
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* ## Everything goes out through `writeScenario`
|
|
6
|
-
*
|
|
7
|
-
* There is deliberately no private path to disk here. `writeScenario`
|
|
8
|
-
* validates on the way *out* as well as in, and that is not redundant: a
|
|
9
|
-
* scenario is written once and read on every push afterwards, so a fault saved
|
|
10
|
-
* today surfaces during a check somebody is waiting on, long after the session
|
|
11
|
-
* that could have explained it is gone. A tool that serialized its own JSON
|
|
12
|
-
* would be a second writer with a first writer's rules, and the second one is
|
|
13
|
-
* the one that ships a file nothing can read.
|
|
14
|
-
*
|
|
15
|
-
* ## A step carries no ref, and this schema offers no way to send one
|
|
16
|
-
*
|
|
17
|
-
* The ref refusal is enforced twice on purpose. The format module rejects a
|
|
18
|
-
* step carrying a `ref` **by name**, with the reason in the message; this
|
|
19
|
-
* schema does not declare the field at all. A caller working from a
|
|
20
|
-
* `browser_snapshot` reply has the three durable fields already — every
|
|
21
|
-
* snapshot element carries `role`, `name` and `selector` — so the natural
|
|
22
|
-
* thing to copy is the right thing to store.
|
|
23
|
-
*
|
|
24
|
-
* ## What the session supplies
|
|
25
|
-
*
|
|
26
|
-
* The consented origin (a scenario may not be saved pointing somewhere this
|
|
27
|
-
* session was never allowed to drive), the URL to start from, and the
|
|
28
|
-
* provenance pair. The steps are the caller's: this server has no exploration
|
|
29
|
-
* planner and does not pretend to have recorded intent it never saw.
|
|
2
|
+
* `browser_save_scenario`: an explored session becomes a durable scenario,
|
|
3
|
+
* written only through `writeScenario` (validates in and out — no private
|
|
4
|
+
* disk path here). A step can't carry a `ref`: the schema omits the field entirely and the format module also rejects one by name.
|
|
30
5
|
*/
|
|
31
6
|
import { unlink } from "node:fs/promises";
|
|
32
7
|
import { gitHead } from "@descryy/core";
|
|
@@ -158,17 +133,7 @@ function findNullSelectorTarget(args) {
|
|
|
158
133
|
}
|
|
159
134
|
return scan("steps", "step") ?? scan("assertions", "assertion");
|
|
160
135
|
}
|
|
161
|
-
/**
|
|
162
|
-
* Every stored step's and assertion's target, resolved against a fresh
|
|
163
|
-
* snapshot of the page this scenario was just recorded on.
|
|
164
|
-
*
|
|
165
|
-
* This is what makes `browser_save_scenario`'s own claim — "validated before
|
|
166
|
-
* it is written, so a scenario that could not be read back is refused now" —
|
|
167
|
-
* actually true for *replay*, not only for *serialisation*. `writeScenario`
|
|
168
|
-
* proves the file parses back into the same shape; it has no way to prove
|
|
169
|
-
* the descriptors inside it still describe anything on the page, because it
|
|
170
|
-
* never sees a page. This costs one extra snapshot.
|
|
171
|
-
*/
|
|
136
|
+
/** Every stored target, resolved against a fresh snapshot — makes "validated before written" true for replay, not just serialisation. `writeScenario` only proves the file parses back; it never sees a page. */
|
|
172
137
|
function collectUnresolvedTargets(scenario, freshSnapshot) {
|
|
173
138
|
const failures = [];
|
|
174
139
|
scenario.steps.forEach((step, index) => {
|
|
@@ -198,14 +163,7 @@ function readObjectArray(args, key) {
|
|
|
198
163
|
}
|
|
199
164
|
return raw;
|
|
200
165
|
}
|
|
201
|
-
/**
|
|
202
|
-
* Shape the caller's arguments into a `Scenario` **without validating them**.
|
|
203
|
-
*
|
|
204
|
-
* Deliberate: `writeScenario` is the validator, and a second one here would be
|
|
205
|
-
* a second set of rules to keep in step with the first. Everything a caller
|
|
206
|
-
* got wrong comes back through the format module's own messages, which are the
|
|
207
|
-
* ones the file's future readers will see.
|
|
208
|
-
*/
|
|
166
|
+
/** Shapes args into a `Scenario` without validating — `writeScenario` is the validator, so a caller's mistakes surface through its own messages, not a second set of rules here. */
|
|
209
167
|
function shape(args, name, targetUrl, savedAtCommit) {
|
|
210
168
|
const steps = readObjectArray(args, "steps").map((step) => ({
|
|
211
169
|
action: step["action"],
|
|
@@ -230,16 +188,7 @@ function shape(args, name, targetUrl, savedAtCommit) {
|
|
|
230
188
|
assertions,
|
|
231
189
|
};
|
|
232
190
|
}
|
|
233
|
-
/**
|
|
234
|
-
* The commit this scenario was authored against.
|
|
235
|
-
*
|
|
236
|
-
* Provenance only — nothing expires on it and nothing refuses because of it.
|
|
237
|
-
* It exists so a replay failure can say *the scenario was written against a
|
|
238
|
-
* different revision of this application*, which is usually the answer to "why
|
|
239
|
-
* did this break". A directory that is not a git checkout records the empty
|
|
240
|
-
* string and the reply says so, rather than a plausible-looking placeholder
|
|
241
|
-
* that a later reader would try to `git show`.
|
|
242
|
-
*/
|
|
191
|
+
/** Provenance only — nothing expires or refuses on it. Says *"written against a different revision"* on replay failure. A non-git directory records "" and says so, rather than a placeholder a reader would try to `git show`. */
|
|
243
192
|
async function commitOf(repoPath) {
|
|
244
193
|
try {
|
|
245
194
|
return await gitHead(repoPath);
|
|
@@ -280,11 +229,9 @@ async function run(args, ctx) {
|
|
|
280
229
|
data: blank(sessionId, name),
|
|
281
230
|
});
|
|
282
231
|
}
|
|
283
|
-
// B1: an element with no id
|
|
284
|
-
//
|
|
285
|
-
//
|
|
286
|
-
// caller's honest copy of that reply ever reaches the format module's own
|
|
287
|
-
// generic "selector is missing" message.
|
|
232
|
+
// B1: an element with no id/test attribute/name comes back with
|
|
233
|
+
// `selector: null` rather than a fabricated value (rule 2). Refused here,
|
|
234
|
+
// by name, before reaching the format module's generic message.
|
|
288
235
|
const nullSelector = findNullSelectorTarget(args);
|
|
289
236
|
if (nullSelector !== null) {
|
|
290
237
|
return browserAnswer({
|
|
@@ -301,8 +248,7 @@ async function run(args, ctx) {
|
|
|
301
248
|
}
|
|
302
249
|
const scenario = shape(args, name, targetUrl, await commitOf(ctx.session.repoPath));
|
|
303
250
|
try {
|
|
304
|
-
// The one write path
|
|
305
|
-
// artifact that this reader could not read back never reaches disk.
|
|
251
|
+
// The one write path: `writeScenario` validates on the way out, so an unreadable artifact never reaches disk.
|
|
306
252
|
await writeScenario(ctx.session.repoPath, scenario);
|
|
307
253
|
}
|
|
308
254
|
catch (error) {
|
|
@@ -319,12 +265,9 @@ async function run(args, ctx) {
|
|
|
319
265
|
data: blank(sessionId, name),
|
|
320
266
|
});
|
|
321
267
|
}
|
|
322
|
-
// The check the
|
|
323
|
-
//
|
|
324
|
-
//
|
|
325
|
-
// parses back into the same shape — it never sees a page, so it cannot
|
|
326
|
-
// prove any of this actually replays. This is what would have caught B1
|
|
327
|
-
// on the day it shipped, and it costs one snapshot.
|
|
268
|
+
// The check the description claims: a fresh snapshot of the page just
|
|
269
|
+
// recorded on, every descriptor re-run through `resolveTarget`.
|
|
270
|
+
// `writeScenario` can't prove replay works — it never sees a page. Would have caught B1.
|
|
328
271
|
const freshSnapshot = await entry.page.snapshot();
|
|
329
272
|
const unresolved = collectUnresolvedTargets(scenario, freshSnapshot);
|
|
330
273
|
if (unresolved.length > 0) {
|
|
@@ -395,10 +338,8 @@ export const browserSaveScenarioTool = {
|
|
|
395
338
|
version: "1.0.0",
|
|
396
339
|
inputSchema: SCHEMA,
|
|
397
340
|
run,
|
|
398
|
-
// Undefined
|
|
399
|
-
//
|
|
400
|
-
// path they name, and the session it records was confirmed at
|
|
401
|
-
// browser_start_session.
|
|
341
|
+
// Undefined: this writes into the repo the developer already pointed
|
|
342
|
+
// Descry at, and the session was already confirmed at browser_start_session.
|
|
402
343
|
describeAction: () => undefined,
|
|
403
344
|
};
|
|
404
345
|
//# sourceMappingURL=browser-save-scenario.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-save-scenario.js","sourceRoot":"","sources":["../../src/tools/browser-save-scenario.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"browser-save-scenario.js","sourceRoot":"","sources":["../../src/tools/browser-save-scenario.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,aAAa,EAAiB,MAAM,uBAAuB,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es. `get_git_diff`
|
|
7
|
-
* shipped without an aggregate reply ceiling, returned 228,860 characters on
|
|
8
|
-
* an ordinary branch diff, and was rejected by the host before the caller saw
|
|
9
|
-
* any of it; the fix that followed bounded patch text and still failed at
|
|
10
|
-
* 84,516, because a reply is not only patch text. That lesson was paid for
|
|
11
|
-
* twice, and a brand-new tool whose payload grows with the user's application
|
|
12
|
-
* is precisely where it would be paid for a third time.
|
|
13
|
-
*
|
|
14
|
-
* So the budget hook is here from day one, and the test asserts the
|
|
15
|
-
* serialized `CallToolResult` rather than asserting that a cap ran.
|
|
16
|
-
*
|
|
17
|
-
* ## `totalElements` is never the capped number
|
|
18
|
-
*
|
|
19
|
-
* A snapshot that quietly returned the first forty elements would teach a
|
|
20
|
-
* calling agent that the page has forty elements. It would then conclude the
|
|
21
|
-
* button it needs is absent, which is a wrong answer produced by a correct
|
|
22
|
-
* tool. So the uncapped count is always present and always the real one, and
|
|
23
|
-
* a shortened reply says so in a note.
|
|
2
|
+
* `browser_snapshot`: page elements as refs, budget-fit from day one —
|
|
3
|
+
* `get_git_diff` hit 228,860 then 84,516 chars unbounded, paid for twice.
|
|
4
|
+
* `totalElements` is always the real, uncapped count — never confused with a shortened list.
|
|
24
5
|
*/
|
|
25
6
|
import type { BrowserEvidenceReport } from "../browser/evidence.ts";
|
|
26
7
|
import { type BrowserGraphWrite } from "../browser/graph-write.ts";
|
|
@@ -32,29 +13,15 @@ export interface BrowserPageData {
|
|
|
32
13
|
readonly url: string;
|
|
33
14
|
readonly title: string;
|
|
34
15
|
readonly elements: readonly SnapshotElement[];
|
|
35
|
-
/**
|
|
36
|
-
* How many elements the page has. **Never the number in `elements`** when
|
|
37
|
-
* the two differ — that is the whole point of carrying it.
|
|
38
|
-
*/
|
|
16
|
+
/** How many elements the page has — never the number in `elements` when they differ; that's the whole point. */
|
|
39
17
|
readonly totalElements: number;
|
|
40
18
|
readonly evidence: BrowserEvidenceReport;
|
|
41
19
|
/** Graph nodes this page's own requests reached, and any R4 edges witnessed. §5.3's "any graph node reached, surfaced in the same reply". */
|
|
42
20
|
readonly graph: BrowserGraphWrite;
|
|
43
21
|
}
|
|
44
|
-
/**
|
|
45
|
-
* What `browser_snapshot` returns. An alias of the shared page shape, so
|
|
46
|
-
* `browser_navigate` — which answers the same question — cannot drift from it.
|
|
47
|
-
*/
|
|
22
|
+
/** What `browser_snapshot` returns — aliased so `browser_navigate` (same question) can't drift from it. */
|
|
48
23
|
export type BrowserSnapshotData = BrowserPageData;
|
|
49
|
-
/**
|
|
50
|
-
* Shrink by dropping elements from the end of the window, never by dropping
|
|
51
|
-
* the count or the evidence.
|
|
52
|
-
*
|
|
53
|
-
* Evidence stays because it is the part a caller cannot re-request by paging —
|
|
54
|
-
* the observations were drained when this reply was built, and a second
|
|
55
|
-
* snapshot would return a different set. Elements can always be asked for
|
|
56
|
-
* again with `startAt`, so they are what gives way.
|
|
57
|
-
*/
|
|
24
|
+
/** Shrinks by dropping elements from the end, never the count or evidence. Evidence can't be re-requested (drained when built); elements can, via `startAt`. */
|
|
58
25
|
export declare function fitSnapshot(data: BrowserSnapshotData, budgetBytes: number): ReplyFit<BrowserSnapshotData>;
|
|
59
26
|
export declare const browserSnapshotTool: ToolDefinition;
|
|
60
27
|
//# sourceMappingURL=browser-snapshot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-snapshot.d.ts","sourceRoot":"","sources":["../../src/tools/browser-snapshot.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"browser-snapshot.d.ts","sourceRoot":"","sources":["../../src/tools/browser-snapshot.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAqD,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAClG,OAAO,KAAK,EAAE,QAAQ,EAAc,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC;IAC9C,gHAAgH;IAChH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;IACzC,6IAA6I;IAC7I,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;CACnC;AAED,2GAA2G;AAC3G,MAAM,MAAM,mBAAmB,GAAG,eAAe,CAAC;AA6ElD,gKAAgK;AAChK,wBAAgB,WAAW,CAAC,IAAI,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,GAAG,QAAQ,CAAC,mBAAmB,CAAC,CAwBzG;AAED,eAAO,MAAM,mBAAmB,EAAE,cAajC,CAAC"}
|
|
@@ -1,26 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `browser_snapshot
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* A real accessibility tree is tens of thousands of bytes. `get_git_diff`
|
|
7
|
-
* shipped without an aggregate reply ceiling, returned 228,860 characters on
|
|
8
|
-
* an ordinary branch diff, and was rejected by the host before the caller saw
|
|
9
|
-
* any of it; the fix that followed bounded patch text and still failed at
|
|
10
|
-
* 84,516, because a reply is not only patch text. That lesson was paid for
|
|
11
|
-
* twice, and a brand-new tool whose payload grows with the user's application
|
|
12
|
-
* is precisely where it would be paid for a third time.
|
|
13
|
-
*
|
|
14
|
-
* So the budget hook is here from day one, and the test asserts the
|
|
15
|
-
* serialized `CallToolResult` rather than asserting that a cap ran.
|
|
16
|
-
*
|
|
17
|
-
* ## `totalElements` is never the capped number
|
|
18
|
-
*
|
|
19
|
-
* A snapshot that quietly returned the first forty elements would teach a
|
|
20
|
-
* calling agent that the page has forty elements. It would then conclude the
|
|
21
|
-
* button it needs is absent, which is a wrong answer produced by a correct
|
|
22
|
-
* tool. So the uncapped count is always present and always the real one, and
|
|
23
|
-
* a shortened reply says so in a note.
|
|
2
|
+
* `browser_snapshot`: page elements as refs, budget-fit from day one —
|
|
3
|
+
* `get_git_diff` hit 228,860 then 84,516 chars unbounded, paid for twice.
|
|
4
|
+
* `totalElements` is always the real, uncapped count — never confused with a shortened list.
|
|
24
5
|
*/
|
|
25
6
|
import { browserAnswer, observeAndCorrelate, useSession } from "../browser/tool-support.js";
|
|
26
7
|
import { NO_GRAPH_WRITE } from "../browser/graph-write.js";
|
|
@@ -90,15 +71,7 @@ async function run(args, ctx) {
|
|
|
90
71
|
fitToBudget: (budgetBytes) => fitSnapshot(data, budgetBytes),
|
|
91
72
|
});
|
|
92
73
|
}
|
|
93
|
-
/**
|
|
94
|
-
* Shrink by dropping elements from the end of the window, never by dropping
|
|
95
|
-
* the count or the evidence.
|
|
96
|
-
*
|
|
97
|
-
* Evidence stays because it is the part a caller cannot re-request by paging —
|
|
98
|
-
* the observations were drained when this reply was built, and a second
|
|
99
|
-
* snapshot would return a different set. Elements can always be asked for
|
|
100
|
-
* again with `startAt`, so they are what gives way.
|
|
101
|
-
*/
|
|
74
|
+
/** Shrinks by dropping elements from the end, never the count or evidence. Evidence can't be re-requested (drained when built); elements can, via `startAt`. */
|
|
102
75
|
export function fitSnapshot(data, budgetBytes) {
|
|
103
76
|
const fits = (elements) => Buffer.byteLength(JSON.stringify({ ...data, elements }), "utf8") <= budgetBytes;
|
|
104
77
|
if (fits(data.elements))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-snapshot.js","sourceRoot":"","sources":["../../src/tools/browser-snapshot.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"browser-snapshot.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AE,GAAG,CAAC,CAAC;IACzC,OAAO;QACL,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;QACjC,KAAK,EAAE;YACL,oDAAoD,IAAI,CAAC,MAAM,OAAO,IAAI,CAAC,aAAa,iBAAiB;gBACvG,yFAAyF,IAAI,CAAC,MAAM,GAAG;gBACvG,qBAAqB;SACxB;QACD,eAAe,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE;KAC/E,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAmB;IACjD,IAAI,EAAE,kBAAkB;IACxB,KAAK,EAAE,uBAAuB;IAC9B,WAAW,EACT,sGAAsG;QACtG,yGAAyG;QACzG,wGAAwG;QACxG,qEAAqE;IACvE,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,MAAM;IACnB,GAAG;CACJ,CAAC"}
|
|
@@ -1,27 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `browser_start_session` —
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `DEC-380` puts consent here and nowhere
|
|
7
|
-
* else. This is the call where a target URL is named, so it is the only call
|
|
8
|
-
* where the fact a developer actually approves — *Descry may drive a browser
|
|
9
|
-
* against this application* — can be stated. A per-click confirmation would
|
|
10
|
-
* describe "click ref-14", which is a string the caller supplied one call
|
|
11
|
-
* earlier and can neither evaluate nor be surprised by, and it would train
|
|
12
|
-
* callers to confirm reflexively.
|
|
13
|
-
*
|
|
14
|
-
* The grant is bound to this URL's **origin**. `browser_navigate` refuses to
|
|
15
|
-
* leave it. Without that bound, "drive my local app" would silently become
|
|
16
|
-
* "drive anything".
|
|
17
|
-
*
|
|
18
|
-
* ## Class
|
|
19
|
-
*
|
|
20
|
-
* `action`, unambiguously: this launches a process and points it at a running
|
|
21
|
-
* application. It is the only browser tool that mints a token; the verbs it
|
|
22
|
-
* consents for redeem nothing, because the session they run in has already
|
|
23
|
-
* been confirmed.
|
|
24
|
-
*/
|
|
2
|
+
* `browser_start_session` — opens a real browser (DEC-380: consent lives here only,
|
|
3
|
+
* bound to the target URL's origin — `browser_navigate` refuses to leave it). Class
|
|
4
|
+
* `action`: the only browser tool that mints a token; the verbs it consents for
|
|
5
|
+
* redeem nothing, since the session is already confirmed. */
|
|
25
6
|
import type { BrowserEvidenceReport } from "../browser/evidence.ts";
|
|
26
7
|
import { type BrowserGraphWrite } from "../browser/graph-write.ts";
|
|
27
8
|
import { type ToolDefinition } from "./kit.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-start-session.d.ts","sourceRoot":"","sources":["../../src/tools/browser-start-session.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"browser-start-session.d.ts","sourceRoot":"","sources":["../../src/tools/browser-start-session.ts"],"names":[],"mappings":"AAAA;;;;6DAI6D;AAG7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAQnF,OAAO,EAAmG,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAGhJ,MAAM,WAAW,uBAAuB;IACtC,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,mFAAmF;IACnF,QAAQ,CAAC,WAAW,EAAE,UAAU,GAAG,OAAO,GAAG,yBAAyB,GAAG,IAAI,CAAC;IAC9E,+EAA+E;IAC/E,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;CACnC;AA0RD,eAAO,MAAM,uBAAuB,EAAE,cAgCrC,CAAC"}
|
|
@@ -1,32 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `browser_start_session` —
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `DEC-380` puts consent here and nowhere
|
|
7
|
-
* else. This is the call where a target URL is named, so it is the only call
|
|
8
|
-
* where the fact a developer actually approves — *Descry may drive a browser
|
|
9
|
-
* against this application* — can be stated. A per-click confirmation would
|
|
10
|
-
* describe "click ref-14", which is a string the caller supplied one call
|
|
11
|
-
* earlier and can neither evaluate nor be surprised by, and it would train
|
|
12
|
-
* callers to confirm reflexively.
|
|
13
|
-
*
|
|
14
|
-
* The grant is bound to this URL's **origin**. `browser_navigate` refuses to
|
|
15
|
-
* leave it. Without that bound, "drive my local app" would silently become
|
|
16
|
-
* "drive anything".
|
|
17
|
-
*
|
|
18
|
-
* ## Class
|
|
19
|
-
*
|
|
20
|
-
* `action`, unambiguously: this launches a process and points it at a running
|
|
21
|
-
* application. It is the only browser tool that mints a token; the verbs it
|
|
22
|
-
* consents for redeem nothing, because the session they run in has already
|
|
23
|
-
* been confirmed.
|
|
24
|
-
*/
|
|
2
|
+
* `browser_start_session` — opens a real browser (DEC-380: consent lives here only,
|
|
3
|
+
* bound to the target URL's origin — `browser_navigate` refuses to leave it). Class
|
|
4
|
+
* `action`: the only browser tool that mints a token; the verbs it consents for
|
|
5
|
+
* redeem nothing, since the session is already confirmed. */
|
|
25
6
|
import { CANCELLED_STATE, cancellationHeadline, cancellationNotes } from "../cancellation.js";
|
|
26
7
|
import { browserAnswer, emptyEvidence, observeAndCorrelate } from "../browser/tool-support.js";
|
|
27
8
|
import { NO_GRAPH_WRITE } from "../browser/graph-write.js";
|
|
28
9
|
import { isAbsolute, join } from "node:path";
|
|
29
10
|
import { loadStackParser, StackParserLoadError } from "../browser/stack-parser.js";
|
|
11
|
+
import { checkUrlScheme } from "../browser/url-scheme.js";
|
|
30
12
|
import { optionalBoolean, optionalEnum, optionalString, requiredString, ToolInputError } from "./kit.js";
|
|
31
13
|
const SCHEMA = {
|
|
32
14
|
type: "object",
|
|
@@ -96,15 +78,9 @@ const SCHEMA = {
|
|
|
96
78
|
additionalProperties: false,
|
|
97
79
|
};
|
|
98
80
|
const SAFETY_LEVELS = ["readOnly", "write", "destructiveWithApproval"];
|
|
99
|
-
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* Only the two fields this surface actually consults are read; everything
|
|
103
|
-
* else a caller sends is carried by the profile it came from and is none of
|
|
104
|
-
* this tool's business. `additionalProperties: true` on the schema is what
|
|
105
|
-
* lets a caller pass the same object it passes `observe_runtime` rather than
|
|
106
|
-
* trimming a second copy of it.
|
|
107
|
-
*/
|
|
81
|
+
/** Reads the profile, doesn't re-derive it — only the 2 fields this surface consults.
|
|
82
|
+
* `additionalProperties: true` lets a caller pass the same object it gives
|
|
83
|
+
* `observe_runtime` without trimming a second copy. */
|
|
108
84
|
function readProfile(args) {
|
|
109
85
|
const raw = args["environment"];
|
|
110
86
|
if (raw === undefined || raw === null)
|
|
@@ -133,13 +109,20 @@ function readStackParserSpec(args) {
|
|
|
133
109
|
}
|
|
134
110
|
function parseTarget(args) {
|
|
135
111
|
const raw = requiredString(args, "targetUrl");
|
|
112
|
+
let url;
|
|
136
113
|
try {
|
|
137
|
-
|
|
114
|
+
url = new URL(raw);
|
|
138
115
|
}
|
|
139
116
|
catch {
|
|
140
117
|
throw new ToolInputError(`"targetUrl" must be an absolute URL including scheme — got "${raw}". A bare host or path cannot be ` +
|
|
141
118
|
"opened, and cannot be turned into the origin this session's consent is bound to.");
|
|
142
119
|
}
|
|
120
|
+
// file:/data: (untrusted schemes) resolve to origin "null", collapsing
|
|
121
|
+
// tool-support.ts's same-origin containment — see url-scheme.ts.
|
|
122
|
+
const scheme = checkUrlScheme(url);
|
|
123
|
+
if (!scheme.allowed)
|
|
124
|
+
throw new ToolInputError(scheme.reason);
|
|
125
|
+
return url;
|
|
143
126
|
}
|
|
144
127
|
function cancelledBeforeLaunch(ctx, target, safetyLevel) {
|
|
145
128
|
return browserAnswer({
|
|
@@ -167,10 +150,9 @@ async function run(args, ctx) {
|
|
|
167
150
|
const parserSpec = readStackParserSpec(args);
|
|
168
151
|
const documentRoot = optionalString(args, "documentRoot");
|
|
169
152
|
const backend = ctx.session.browserBackend();
|
|
170
|
-
// Before anything launches
|
|
171
|
-
//
|
|
172
|
-
// the
|
|
173
|
-
// five-minute idle reaper is the only thing left that would.
|
|
153
|
+
// Before anything launches — a browser opened for a caller who's already gone is
|
|
154
|
+
// one nothing will ever close (its session id never reaches a suppressed reply);
|
|
155
|
+
// only the 5-minute idle reaper would eventually catch it.
|
|
174
156
|
if (ctx.signal.aborted)
|
|
175
157
|
return cancelledBeforeLaunch(ctx, target, null);
|
|
176
158
|
if (!backend.available) {
|
|
@@ -182,10 +164,9 @@ async function run(args, ctx) {
|
|
|
182
164
|
data: { sessionId: "", url: target.href, title: "", consentedOrigin: target.origin, safetyLevel: null, totalElements: 0, evidence: emptyEvidence(), graph: NO_GRAPH_WRITE },
|
|
183
165
|
});
|
|
184
166
|
}
|
|
185
|
-
//
|
|
186
|
-
//
|
|
187
|
-
//
|
|
188
|
-
// session that quietly cannot write the edge it was opened for.
|
|
167
|
+
// Parser loaded before anything launches — a bad parser is a fixable refusal here;
|
|
168
|
+
// discovering it after a browser is open means tearing it down or running a
|
|
169
|
+
// session that silently can't write the edge it opened for.
|
|
189
170
|
let parser;
|
|
190
171
|
try {
|
|
191
172
|
parser = parserSpec === null ? undefined : await loadStackParser(parserSpec);
|
|
@@ -201,10 +182,9 @@ async function run(args, ctx) {
|
|
|
201
182
|
data: { sessionId: "", url: target.href, title: "", consentedOrigin: target.origin, safetyLevel: null, totalElements: 0, evidence: emptyEvidence(), graph: NO_GRAPH_WRITE },
|
|
202
183
|
});
|
|
203
184
|
}
|
|
204
|
-
//
|
|
205
|
-
//
|
|
206
|
-
//
|
|
207
|
-
// `public/` case the schema describes.
|
|
185
|
+
// Closed here rather than left to a caller: the origin driven must map to
|
|
186
|
+
// the directory actually serving its scripts — `documentRoot` overrides the repo
|
|
187
|
+
// root for the `public/` case the schema describes.
|
|
208
188
|
const servedFrom = documentRoot === undefined
|
|
209
189
|
? ctx.session.repoPath
|
|
210
190
|
: isAbsolute(documentRoot)
|
|
@@ -223,8 +203,8 @@ async function run(args, ctx) {
|
|
|
223
203
|
if (!opened.opened) {
|
|
224
204
|
const notes = opened.kind === "atCapacity"
|
|
225
205
|
? [opened.reason]
|
|
226
|
-
: //
|
|
227
|
-
//
|
|
206
|
+
: // Remedy travels verbatim — "could not launch" and stopping there is a
|
|
207
|
+
// refusal the developer has to go research themselves.
|
|
228
208
|
[opened.message, `Remedy: ${opened.remedy}`, `Expected the browser at ${opened.expectedExecutablePath}.`];
|
|
229
209
|
return browserAnswer({
|
|
230
210
|
ctx,
|
|
@@ -234,10 +214,9 @@ async function run(args, ctx) {
|
|
|
234
214
|
data: { sessionId: "", url: target.href, title: "", consentedOrigin: target.origin, safetyLevel: profile?.safetyLevel ?? null, totalElements: 0, evidence: emptyEvidence(), graph: NO_GRAPH_WRITE },
|
|
235
215
|
});
|
|
236
216
|
}
|
|
237
|
-
// The race
|
|
238
|
-
//
|
|
239
|
-
//
|
|
240
|
-
// and the only one it may tear down.
|
|
217
|
+
// The race actually lost in practice: caller cancelled while Chromium was
|
|
218
|
+
// starting, so the launch succeeded for nobody. Closes the session just opened
|
|
219
|
+
// — the one resource this call started, the only one it may tear down.
|
|
241
220
|
if (ctx.signal.aborted) {
|
|
242
221
|
await ctx.session.browserSessions().close(opened.entry.sessionId);
|
|
243
222
|
return cancelledBeforeLaunch(ctx, target, profile?.safetyLevel ?? null);
|
|
@@ -298,10 +277,9 @@ export const browserStartSessionTool = {
|
|
|
298
277
|
run,
|
|
299
278
|
describeAction(args) {
|
|
300
279
|
const target = parseTarget(args);
|
|
301
|
-
//
|
|
302
|
-
//
|
|
303
|
-
//
|
|
304
|
-
// that is actually enforced cannot say two different things.
|
|
280
|
+
// Same parse the run path uses to enforce the gate (`mutationRefusal` in
|
|
281
|
+
// `tool-support.ts`) — read here, not re-derived, so what's confirmed matches
|
|
282
|
+
// what's enforced.
|
|
305
283
|
const safetyLevel = readProfile(args)?.safetyLevel;
|
|
306
284
|
if (safetyLevel === "readOnly") {
|
|
307
285
|
return (`Descry may navigate and snapshot anywhere on ${target.origin}. Clicking, typing and filling will be ` +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-start-session.js","sourceRoot":"","sources":["../../src/tools/browser-start-session.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"browser-start-session.js","sourceRoot":"","sources":["../../src/tools/browser-start-session.ts"],"names":[],"mappings":"AAAA;;;;6DAI6D;AAE7D,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE9F,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAC/F,OAAO,EAAE,cAAc,EAA0B,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAK7C,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAwB,MAAM,4BAA4B,CAAC;AACzG,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAyC,MAAM,UAAU,CAAC;AAkBhJ,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,6FAA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AAM,iDAAiD;YAClG,gEAAgE,CACjE,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1,38 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `DEC-380` grants consent once, at
|
|
7
|
-
* `browser_start_session`, bound to that call's origin. So this tool declares
|
|
8
|
-
* `class: "action"` — it does change a running application, and pretending
|
|
9
|
-
* otherwise would be the lie — while its `describeAction` returns `undefined`,
|
|
10
|
-
* the existing "this particular call has nothing to confirm" path that
|
|
11
|
-
* `questions` uses when asked to read rather than write.
|
|
12
|
-
*
|
|
13
|
-
* The property that makes that safe rather than merely cheap: **a verb cannot
|
|
14
|
-
* mint consent for itself.** Called against a session with no consent record,
|
|
15
|
-
* it refuses. There is deliberately no path from a click to a token.
|
|
16
|
-
*
|
|
17
|
-
* ## A ref, never a selector
|
|
18
|
-
*
|
|
19
|
-
* The element is named by a ref from a snapshot the calling agent actually
|
|
20
|
-
* saw. A raw selector would let an agent act on an element it never looked
|
|
21
|
-
* at, and a ref from a superseded snapshot refuses rather than resolving
|
|
22
|
-
* against whatever now matches — that is the same mistake, arriving later.
|
|
23
|
-
*/
|
|
24
|
-
/**
|
|
25
|
-
* ## Why this is not the same tool as `browser_fill`
|
|
26
|
-
*
|
|
27
|
-
* The visible difference is that this appends and `fill` replaces. The
|
|
28
|
-
* difference that decides which one is correct for a real page is that **this
|
|
29
|
-
* one fires key events and `fill` fires none.** A field that opens an
|
|
30
|
-
* autocomplete on keydown, validates per character, or debounces a search as
|
|
31
|
-
* you type sees nothing at all from a `fill`. An agent that reaches for
|
|
32
|
-
* `fill` on a search box gets a page that was never typed into — a wrong
|
|
33
|
-
* answer produced by entirely correct tool code, which is why the schema
|
|
34
|
-
* prose below says so rather than describing only the tidy half.
|
|
35
|
-
*/
|
|
1
|
+
/** `browser_type` — real keystrokes into a field. Consent is granted once, at
|
|
2
|
+
* `browser_start_session` (DEC-380) — `describeAction` returns undefined since a verb can't
|
|
3
|
+
* mint its own consent; called with none on record, it refuses. Takes a ref from a seen
|
|
4
|
+
* snapshot, never a selector — a stale ref refuses rather than resolving elsewhere. Fires
|
|
5
|
+
* real key events, unlike `browser_fill` (which fires none) — needed for autocomplete/validation/debounce fields fill would silently miss. */
|
|
36
6
|
import type { BrowserEvidenceReport } from "../browser/evidence.ts";
|
|
37
7
|
import { type BrowserGraphWrite } from "../browser/graph-write.ts";
|
|
38
8
|
import { type ToolDefinition } from "./kit.ts";
|