@anweat/dsh-browser 0.1.17 → 0.2.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/README.md +266 -88
- package/assets/skills/dsh-browser/SKILL.md +120 -0
- package/assets/skills/dsh-browser/references/develop.md +48 -0
- package/assets/skills/dsh-browser/references/observe.md +91 -0
- package/assets/skills/dsh-browser/references/opencli.md +25 -0
- package/assets/skills/dsh-browser/references/recipes.md +149 -0
- package/assets/skills/dsh-browser/references/userscripts.md +44 -0
- package/cordis.patch.yml +11 -3
- package/lib/actions/act.d.ts +3 -0
- package/lib/actions/act.js +147 -0
- package/lib/actions/act.js.map +1 -0
- package/lib/actions/automation.d.ts +3 -0
- package/lib/actions/automation.js +356 -0
- package/lib/actions/automation.js.map +1 -0
- package/lib/actions/crawl.d.ts +3 -0
- package/lib/actions/crawl.js +28 -0
- package/lib/actions/crawl.js.map +1 -0
- package/lib/actions/errors.d.ts +53 -0
- package/lib/actions/errors.js +178 -0
- package/lib/actions/errors.js.map +1 -0
- package/lib/actions/index-view.d.ts +42 -0
- package/lib/actions/index-view.js +268 -0
- package/lib/actions/index-view.js.map +1 -0
- package/lib/actions/inspect.d.ts +3 -0
- package/lib/actions/inspect.js +35 -0
- package/lib/actions/inspect.js.map +1 -0
- package/lib/actions/observe.d.ts +3 -0
- package/lib/actions/observe.js +121 -0
- package/lib/actions/observe.js.map +1 -0
- package/lib/actions/opencli.d.ts +3 -0
- package/lib/actions/opencli.js +51 -0
- package/lib/actions/opencli.js.map +1 -0
- package/lib/actions/registry.d.ts +35 -0
- package/lib/actions/registry.js +89 -0
- package/lib/actions/registry.js.map +1 -0
- package/lib/actions/run.d.ts +34 -0
- package/lib/actions/run.js +226 -0
- package/lib/actions/run.js.map +1 -0
- package/lib/actions/runtime.d.ts +3 -0
- package/lib/actions/runtime.js +33 -0
- package/lib/actions/runtime.js.map +1 -0
- package/lib/actions/schema.d.ts +31 -0
- package/lib/actions/schema.js +309 -0
- package/lib/actions/schema.js.map +1 -0
- package/lib/actions/script.d.ts +3 -0
- package/lib/actions/script.js +97 -0
- package/lib/actions/script.js.map +1 -0
- package/lib/actions/shared.d.ts +31 -0
- package/lib/actions/shared.js +45 -0
- package/lib/actions/shared.js.map +1 -0
- package/lib/actions/surface.d.ts +22 -0
- package/lib/actions/surface.js +18 -0
- package/lib/actions/surface.js.map +1 -0
- package/lib/actions/target.d.ts +3 -0
- package/lib/actions/target.js +66 -0
- package/lib/actions/target.js.map +1 -0
- package/lib/actions/types.d.ts +181 -0
- package/lib/actions/types.js +48 -0
- package/lib/actions/types.js.map +1 -0
- package/lib/activation-rules.d.ts +29 -0
- package/lib/activation-rules.js +33 -0
- package/lib/activation-rules.js.map +1 -0
- package/lib/approval-policy.d.ts +40 -2
- package/lib/approval-policy.js +184 -97
- package/lib/approval-policy.js.map +1 -1
- package/lib/automation-assets-rpc.d.ts +8 -2
- package/lib/automation-assets-rpc.js +68 -10
- package/lib/automation-assets-rpc.js.map +1 -1
- package/lib/automation-assets.d.ts +152 -4
- package/lib/automation-assets.js +255 -15
- package/lib/automation-assets.js.map +1 -1
- package/lib/automation-convert.d.ts +23 -0
- package/lib/automation-convert.js +110 -0
- package/lib/automation-convert.js.map +1 -0
- package/lib/automation-development.d.ts +26 -0
- package/lib/automation-development.js +47 -0
- package/lib/automation-development.js.map +1 -1
- package/lib/automation-execution.d.ts +57 -1
- package/lib/automation-execution.js +167 -11
- package/lib/automation-execution.js.map +1 -1
- package/lib/automation-journal.d.ts +92 -0
- package/lib/automation-journal.js +449 -0
- package/lib/automation-journal.js.map +1 -0
- package/lib/automation-v2.d.ts +138 -0
- package/lib/automation-v2.js +631 -0
- package/lib/automation-v2.js.map +1 -0
- package/lib/automation.d.ts +82 -5
- package/lib/automation.js +239 -82
- package/lib/automation.js.map +1 -1
- package/lib/browser-service.d.ts +309 -32
- package/lib/browser-service.js +636 -182
- package/lib/browser-service.js.map +1 -1
- package/lib/client/SettingsCard.js +95 -57
- package/lib/client/SettingsCard.js.map +1 -1
- package/lib/client/asset-editor.d.ts +55 -0
- package/lib/client/asset-editor.js +101 -0
- package/lib/client/asset-editor.js.map +1 -0
- package/lib/client/automation-assets-client.d.ts +99 -2
- package/lib/client/automation-assets-client.js +243 -10
- package/lib/client/automation-assets-client.js.map +1 -1
- package/lib/client/form.d.ts +48 -4
- package/lib/client/form.js +142 -29
- package/lib/client/form.js.map +1 -1
- package/lib/client/index.d.ts +25 -2
- package/lib/client/index.js +5 -1
- package/lib/client/index.js.map +1 -1
- package/lib/client/locales.d.ts +85 -6
- package/lib/client/locales.js +64 -12
- package/lib/client/locales.js.map +1 -1
- package/lib/client/prompts-form.d.ts +67 -0
- package/lib/client/prompts-form.js +140 -0
- package/lib/client/prompts-form.js.map +1 -0
- package/lib/client/prompts-status-client.d.ts +34 -0
- package/lib/client/prompts-status-client.js +53 -0
- package/lib/client/prompts-status-client.js.map +1 -0
- package/lib/client/settings-namespace.d.ts +1 -1
- package/lib/client/settings-namespace.js +1 -1
- package/lib/client/settings-namespace.js.map +1 -1
- package/lib/client.js +1915 -330
- package/lib/client.js.map +1 -1
- package/lib/config.d.ts +50 -1
- package/lib/config.js +31 -1
- package/lib/config.js.map +1 -1
- package/lib/dialogs.d.ts +37 -0
- package/lib/dialogs.js +73 -0
- package/lib/dialogs.js.map +1 -0
- package/lib/freedom.d.ts +23 -7
- package/lib/freedom.js +48 -59
- package/lib/freedom.js.map +1 -1
- package/lib/index.d.ts +5 -13
- package/lib/index.js +51 -30
- package/lib/index.js.map +1 -1
- package/lib/journal.d.ts +109 -0
- package/lib/journal.js +238 -0
- package/lib/journal.js.map +1 -0
- package/lib/locator.d.ts +82 -0
- package/lib/locator.js +190 -0
- package/lib/locator.js.map +1 -0
- package/lib/observe-script.d.ts +27 -0
- package/lib/observe-script.js +565 -0
- package/lib/observe-script.js.map +1 -0
- package/lib/observe.d.ts +179 -0
- package/lib/observe.js +368 -0
- package/lib/observe.js.map +1 -0
- package/lib/policy-keys.d.ts +30 -0
- package/lib/policy-keys.js +34 -0
- package/lib/policy-keys.js.map +1 -0
- package/lib/prompt-limits.d.ts +30 -0
- package/lib/prompt-limits.js +31 -0
- package/lib/prompt-limits.js.map +1 -0
- package/lib/prompts.d.ts +131 -0
- package/lib/prompts.js +295 -0
- package/lib/prompts.js.map +1 -0
- package/lib/skill.d.ts +100 -0
- package/lib/skill.js +181 -0
- package/lib/skill.js.map +1 -0
- package/lib/tool-defs.d.ts +72 -0
- package/lib/tool-defs.js +67 -0
- package/lib/tool-defs.js.map +1 -0
- package/lib/tools.d.ts +19 -4
- package/lib/tools.js +124 -922
- package/lib/tools.js.map +1 -1
- package/package.json +15 -11
- package/scripts/check-host-rpc.mjs +11 -4
- package/scripts/dump-prompts.mjs +29 -0
- package/scripts/measure-tool-surface.mjs +190 -0
- package/lib/settings-scope.d.ts +0 -56
- package/lib/settings-scope.js +0 -51
- package/lib/settings-scope.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/actions/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,YAAY,GAAc;IAC9B,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,WAAW,EAAE,iDAAiD;IAC9D,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;QACxE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE;QACpD,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4BAA4B,EAAE;KACnE;CACF,CAAA;AAED,MAAM,cAAc,GAAc;IAChC,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,WAAW,EAAE,iKAAiK;IAC9K,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,IAAI,EAAE,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IAAI,CAAC,IAAI,GAAG,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QAC5E,KAAK,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC,CAAA;IAC/D,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/** `script` group: page JavaScript, built-in scripts, userscripts. @module dsh-browser/actions/script */
|
|
2
|
+
export const SCRIPT_ACTIONS = [
|
|
3
|
+
{
|
|
4
|
+
name: 'script.evaluate',
|
|
5
|
+
group: 'script',
|
|
6
|
+
summary: 'Evaluate one bounded JavaScript expression in the current page; returns capped JSON.',
|
|
7
|
+
notes: 'Runs with the page origin and login state, so it can read or mutate the DOM, access non-HttpOnly cookies/storage, and issue requests the browser allows. No Node.js or host-filesystem access.',
|
|
8
|
+
params: {
|
|
9
|
+
expression: { type: 'string', required: true, description: 'JavaScript expression up to 20,000 characters; the resolved value must be JSON-serializable.' },
|
|
10
|
+
timeoutMs: { type: 'number', description: 'Execution timeout 1000-30000 ms. Default 15000.' },
|
|
11
|
+
},
|
|
12
|
+
approval: 'evaluate', readOnly: false, mutating: true, concurrencySafe: false, timeoutMs: 35_000,
|
|
13
|
+
errors: ['POLICY_DENIED (empty or oversized expression)'],
|
|
14
|
+
examples: [{ args: { expression: 'document.title' } }],
|
|
15
|
+
async execute(args, ctx) {
|
|
16
|
+
return ctx.service.evaluate(args.expression, { ...args.timeoutMs !== undefined ? { timeoutMs: args.timeoutMs } : {}, session: ctx.session });
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'script.catalog',
|
|
21
|
+
group: 'script',
|
|
22
|
+
summary: 'List trusted built-in read-only scripts (article-clean, links, jsonld, forms).',
|
|
23
|
+
params: {},
|
|
24
|
+
approval: 'none', readOnly: true, mutating: false, concurrencySafe: true, timeoutMs: 10_000,
|
|
25
|
+
examples: [{ args: {} }],
|
|
26
|
+
async execute(_args, ctx) {
|
|
27
|
+
return { items: ctx.service.scriptCatalog() };
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'script.validate',
|
|
32
|
+
group: 'script',
|
|
33
|
+
summary: 'Validate Tampermonkey-style userscript source without running it: @match/@grant, SHA-256, capabilities.',
|
|
34
|
+
notes: 'Only @grant none is supported.',
|
|
35
|
+
params: {
|
|
36
|
+
source: { type: 'string', required: true, description: 'Complete userscript source including the metadata block. Never embed credentials.' },
|
|
37
|
+
url: { type: 'string', description: 'Optional target URL to verify against @match and @exclude-match.' },
|
|
38
|
+
},
|
|
39
|
+
approval: 'none', readOnly: true, mutating: false, concurrencySafe: true, timeoutMs: 10_000,
|
|
40
|
+
examples: [{ args: { source: '// ==UserScript==\n// @name T\n// @match https://example.com/*\n// @grant none\n// ==/UserScript==\nreturn document.title', url: 'https://example.com/' } }],
|
|
41
|
+
async execute(args, ctx) {
|
|
42
|
+
const result = ctx.service.validateUserscript(args.source, args.url);
|
|
43
|
+
return {
|
|
44
|
+
valid: result.valid, sha256: result.sha256, bytes: result.bytes, name: result.metadata.name,
|
|
45
|
+
matches: result.metadata.matches, grants: result.metadata.grants, capabilities: result.capabilities,
|
|
46
|
+
errors: result.errors, warnings: result.warnings,
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'script.run_builtin',
|
|
52
|
+
group: 'script',
|
|
53
|
+
summary: 'Run one trusted built-in read-only script in a fresh context and return bounded JSON.',
|
|
54
|
+
params: {
|
|
55
|
+
url: { type: 'string', required: true },
|
|
56
|
+
scriptId: { type: 'string', required: true, enum: ['article-clean', 'links', 'jsonld', 'forms'] },
|
|
57
|
+
authProfile: { type: 'string' },
|
|
58
|
+
rulePack: { type: 'string' },
|
|
59
|
+
timeoutMs: { type: 'number' },
|
|
60
|
+
},
|
|
61
|
+
approval: 'none', readOnly: true, mutating: false, concurrencySafe: false, timeoutMs: 60_000,
|
|
62
|
+
examples: [{ args: { url: 'https://example.com/', scriptId: 'links' } }],
|
|
63
|
+
async execute(args, ctx) {
|
|
64
|
+
return ctx.service.runBuiltinScript(args.url, args.scriptId, {
|
|
65
|
+
signal: ctx.signal,
|
|
66
|
+
...args.timeoutMs !== undefined ? { timeoutMs: args.timeoutMs } : {},
|
|
67
|
+
...args.authProfile ? { authProfile: args.authProfile } : {},
|
|
68
|
+
...args.rulePack ? { rulePack: args.rulePack } : {},
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'script.run_userscript',
|
|
74
|
+
group: 'script',
|
|
75
|
+
summary: 'Run an externally supplied userscript in a fresh context. Validate first.',
|
|
76
|
+
notes: 'Target @match, source/result caps, and no-GM_* validation always apply; approval follows automationMode.',
|
|
77
|
+
params: {
|
|
78
|
+
url: { type: 'string', required: true },
|
|
79
|
+
source: { type: 'string', required: true, description: 'Complete userscript source. Never embed credentials or tokens.' },
|
|
80
|
+
authProfile: { type: 'string' },
|
|
81
|
+
rulePack: { type: 'string' },
|
|
82
|
+
timeoutMs: { type: 'number' },
|
|
83
|
+
},
|
|
84
|
+
approval: 'userscript', readOnly: false, mutating: true, concurrencySafe: false, timeoutMs: 60_000,
|
|
85
|
+
errors: ['POLICY_DENIED (invalid userscript)'],
|
|
86
|
+
examples: [{ args: { url: 'https://example.com/', source: '// ==UserScript==\n// @name T\n// @match https://example.com/*\n// @grant none\n// ==/UserScript==\nreturn document.title' } }],
|
|
87
|
+
async execute(args, ctx) {
|
|
88
|
+
return ctx.service.runUserscript(args.url, args.source, {
|
|
89
|
+
signal: ctx.signal,
|
|
90
|
+
...args.timeoutMs !== undefined ? { timeoutMs: args.timeoutMs } : {},
|
|
91
|
+
...args.authProfile ? { authProfile: args.authProfile } : {},
|
|
92
|
+
...args.rulePack ? { rulePack: args.rulePack } : {},
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
//# sourceMappingURL=script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script.js","sourceRoot":"","sources":["../../src/actions/script.ts"],"names":[],"mappings":"AAAA,yGAAyG;AAIzG,MAAM,CAAC,MAAM,cAAc,GAAgB;IACzC;QACE,IAAI,EAAE,iBAAiB;QACvB,KAAK,EAAE,QAAQ;QACf,OAAO,EAAE,sFAAsF;QAC/F,KAAK,EAAE,gMAAgM;QACvM,MAAM,EAAE;YACN,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,8FAA8F,EAAE;YAC3J,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,iDAAiD,EAAE;SAC9F;QACD,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM;QAChG,MAAM,EAAE,CAAC,+CAA+C,CAAC;QACzD,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,EAAE,CAAC;QACtD,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG;YACrB,OAAO,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,GAAG,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;QAC9I,CAAC;KACF;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,QAAQ;QACf,OAAO,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AAG,CAAC,MAAM;gBAClB,GAAG,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE;gBACpE,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE;gBAC5D,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE;aACpD,CAAC,CAAA;QACJ,CAAC;KACF;CACF,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Helpers shared by the action group modules. @module dsh-browser/actions/shared */
|
|
2
|
+
import type { BrowserTarget } from '../browser-service.ts';
|
|
3
|
+
import type { RecipeRunResult } from '../automation.ts';
|
|
4
|
+
import { type ActionOutcome } from './types.ts';
|
|
5
|
+
export declare const COMPLIANCE_NOTICE = "The caller/operator must use this capability according to the target site rules and applicable requirements; dsh-browser only executes the requested browser operation and does not determine whether a particular use is permitted.";
|
|
6
|
+
/** Resolve the selector-or-locator pair every element-targeting action accepts. */
|
|
7
|
+
export declare function targetOf(args: {
|
|
8
|
+
selector?: unknown;
|
|
9
|
+
locator?: unknown;
|
|
10
|
+
}, required?: boolean): BrowserTarget | undefined;
|
|
11
|
+
/** The `expectGeneration` guard of an act.* call, ready to spread into the service options. */
|
|
12
|
+
export declare function expectOf(args: {
|
|
13
|
+
expectGeneration?: unknown;
|
|
14
|
+
}): {
|
|
15
|
+
expectGeneration?: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Serialize a value for the model with a hard size cap. Values under the cap
|
|
19
|
+
* are returned as-is (so they stay structured); larger ones are replaced by a
|
|
20
|
+
* truncated JSON string and flagged.
|
|
21
|
+
*/
|
|
22
|
+
export declare function capJson(value: unknown, limit: number): {
|
|
23
|
+
value: unknown;
|
|
24
|
+
truncated: boolean;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The envelope outcome of a recipe run. `ok` means the run completed and no
|
|
28
|
+
* assertion failed; a run that did less keeps its full report in `result` and
|
|
29
|
+
* gets an `error` that names what happened and what to do next.
|
|
30
|
+
*/
|
|
31
|
+
export declare function recipeOutcome(run: Pick<RecipeRunResult, 'executionStatus' | 'validationStatus' | 'failedStep' | 'message'>): ActionOutcome;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Helpers shared by the action group modules. @module dsh-browser/actions/shared */
|
|
2
|
+
import { hintFor } from "./errors.js";
|
|
3
|
+
import { ActionArgError } from "./types.js";
|
|
4
|
+
export const COMPLIANCE_NOTICE = 'The caller/operator must use this capability according to the target site rules and applicable requirements; dsh-browser only executes the requested browser operation and does not determine whether a particular use is permitted.';
|
|
5
|
+
/** Resolve the selector-or-locator pair every element-targeting action accepts. */
|
|
6
|
+
export function targetOf(args, required = true) {
|
|
7
|
+
if (typeof args.selector === 'string' && args.locator === undefined)
|
|
8
|
+
return args.selector;
|
|
9
|
+
if (args.selector === undefined && args.locator && typeof args.locator === 'object')
|
|
10
|
+
return args.locator;
|
|
11
|
+
if (!required && args.selector === undefined && args.locator === undefined)
|
|
12
|
+
return undefined;
|
|
13
|
+
throw new ActionArgError('provide exactly one of selector or locator', 'Pass either selector (CSS string) or locator (object), not both.');
|
|
14
|
+
}
|
|
15
|
+
/** The `expectGeneration` guard of an act.* call, ready to spread into the service options. */
|
|
16
|
+
export function expectOf(args) {
|
|
17
|
+
return typeof args.expectGeneration === 'number' ? { expectGeneration: args.expectGeneration } : {};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Serialize a value for the model with a hard size cap. Values under the cap
|
|
21
|
+
* are returned as-is (so they stay structured); larger ones are replaced by a
|
|
22
|
+
* truncated JSON string and flagged.
|
|
23
|
+
*/
|
|
24
|
+
export function capJson(value, limit) {
|
|
25
|
+
const raw = JSON.stringify(value);
|
|
26
|
+
if (raw === undefined || raw.length <= limit)
|
|
27
|
+
return { value, truncated: false };
|
|
28
|
+
return { value: raw.slice(0, limit), truncated: true };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The envelope outcome of a recipe run. `ok` means the run completed and no
|
|
32
|
+
* assertion failed; a run that did less keeps its full report in `result` and
|
|
33
|
+
* gets an `error` that names what happened and what to do next.
|
|
34
|
+
*/
|
|
35
|
+
export function recipeOutcome(run) {
|
|
36
|
+
if (run.executionStatus === 'completed' && run.validationStatus !== 'failed')
|
|
37
|
+
return { ok: true, executionStatus: 'completed' };
|
|
38
|
+
const code = run.executionStatus === 'outcome_unknown' ? 'OUTCOME_UNKNOWN'
|
|
39
|
+
: run.failedStep?.errorCode ?? (run.executionStatus === 'cancelled' ? 'CANCELLED' : run.validationStatus === 'failed' ? 'VALIDATION_FAILED' : 'ACTION_FAILED');
|
|
40
|
+
const original = run.failedStep ? ` [step ${run.failedStep.index} ${run.failedStep.action}, ${run.failedStep.errorCode}] ${run.failedStep.message}` : '';
|
|
41
|
+
const message = (run.message ?? 'The run did not complete.') + (run.message && original ? ' Original error:' + original : original);
|
|
42
|
+
const hint = hintFor(code) ?? 'The run did not complete; read completedSteps, failedStep and effects before deciding what to do.';
|
|
43
|
+
return { ok: false, executionStatus: run.executionStatus, error: { code, message, hint, ...run.failedStep?.candidates ? { candidates: run.failedStep.candidates } : {} } };
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/actions/shared.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAIrF,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,cAAc,EAAsB,MAAM,YAAY,CAAA;AAE/D,MAAM,CAAC,MAAM,iBAAiB,GAAG,sOAAsO,CAAA;AAEvQ,mFAAmF;AAC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22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps a model-visible tool call to the action it will run, so the Host
|
|
3
|
+
* approval hook can judge `browser_call` and flat tools by action rather than
|
|
4
|
+
* by tool name.
|
|
5
|
+
* @module dsh-browser/actions/surface
|
|
6
|
+
*/
|
|
7
|
+
export type ResolvedBrowserCall =
|
|
8
|
+
/** `browser_index`: read-only catalog, no side effects. */
|
|
9
|
+
{
|
|
10
|
+
kind: 'index';
|
|
11
|
+
}
|
|
12
|
+
/** A call that names a known action; `args` are the action's own arguments. */
|
|
13
|
+
| {
|
|
14
|
+
kind: 'action';
|
|
15
|
+
action: string;
|
|
16
|
+
args: unknown;
|
|
17
|
+
}
|
|
18
|
+
/** `browser_call` with a missing or unknown action; execution returns a structured error. */
|
|
19
|
+
| {
|
|
20
|
+
kind: 'unresolved';
|
|
21
|
+
};
|
|
22
|
+
export declare function resolveBrowserCall(toolName: string, rawArgs: unknown): ResolvedBrowserCall | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps a model-visible tool call to the action it will run, so the Host
|
|
3
|
+
* approval hook can judge `browser_call` and flat tools by action rather than
|
|
4
|
+
* by tool name.
|
|
5
|
+
* @module dsh-browser/actions/surface
|
|
6
|
+
*/
|
|
7
|
+
import { CALL_TOOL, INDEX_TOOL, findAction, findActionByFlatTool } from "./registry.js";
|
|
8
|
+
export function resolveBrowserCall(toolName, rawArgs) {
|
|
9
|
+
if (toolName === INDEX_TOOL)
|
|
10
|
+
return { kind: 'index' };
|
|
11
|
+
if (toolName === CALL_TOOL) {
|
|
12
|
+
const input = (rawArgs && typeof rawArgs === 'object' ? rawArgs : {});
|
|
13
|
+
return findAction(input.action) ? { kind: 'action', action: input.action, args: input.args ?? {} } : { kind: 'unresolved' };
|
|
14
|
+
}
|
|
15
|
+
const flat = findActionByFlatTool(toolName);
|
|
16
|
+
return flat ? { kind: 'action', action: flat.name, args: rawArgs ?? {} } : undefined;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=surface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface.js","sourceRoot":"","sources":["../../src/actions/surface.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAUvF,MAAM,UAAU,kBAAkB,CAAC,QAAgB,EAAE,OAAgB;IACnE,IAAI,QAAQ,KAAK,UAAU;QAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;IACrD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,KAAK,GAAG,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAyC,CAAA;QAC7G,OAAO,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,MAAgB,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAA;IACvI,CAAC;IACD,MAAM,IAAI,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAA;IAC3C,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACtF,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/** `target` group: open, close, and list this session's page. @module dsh-browser/actions/target */
|
|
2
|
+
export const TARGET_ACTIONS = [
|
|
3
|
+
{
|
|
4
|
+
name: 'target.open',
|
|
5
|
+
group: 'target',
|
|
6
|
+
summary: 'Open a URL in this session\'s own page; returns title, readable text, and a full-page screenshot path.',
|
|
7
|
+
notes: 'Each session gets its own page and context; sessions never see each other\'s page, cookies, or captured traffic. capture records console messages and failed/4xx/5xx requests in memory (no bodies or headers), capped, and resets on the next open.',
|
|
8
|
+
params: {
|
|
9
|
+
url: { type: 'string', required: true, description: 'The HTTP(S) URL to open.' },
|
|
10
|
+
waitMs: { type: 'number', description: 'Extra settle time in ms after load.' },
|
|
11
|
+
authProfile: { type: 'string', description: 'Named, domain-scoped auth profile from dsh-browser config.' },
|
|
12
|
+
rulePack: { type: 'string', description: 'Named, domain-scoped enhancement rule pack.' },
|
|
13
|
+
capture: { type: 'array', items: { type: 'string', enum: ['console', 'network'] }, description: 'In-memory capture channels for this navigation.' },
|
|
14
|
+
},
|
|
15
|
+
approval: 'none', readOnly: true, mutating: false, concurrencySafe: false, timeoutMs: 60_000,
|
|
16
|
+
examples: [{ args: { url: 'https://example.com/' } }, { args: { url: 'https://example.com/', capture: ['console', 'network'] }, note: 'enables inspect.console / inspect.requests' }],
|
|
17
|
+
async execute(args, ctx) {
|
|
18
|
+
return ctx.service.open(args.url, {
|
|
19
|
+
...args.waitMs !== undefined ? { waitMs: args.waitMs } : {},
|
|
20
|
+
...args.authProfile ? { authProfile: args.authProfile } : {},
|
|
21
|
+
...args.rulePack ? { rulePack: args.rulePack } : {},
|
|
22
|
+
...args.capture ? { capture: args.capture } : {},
|
|
23
|
+
session: ctx.session,
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'target.close',
|
|
29
|
+
group: 'target',
|
|
30
|
+
summary: 'Close this session\'s pages and context (popups included); the next target.open starts fresh. Other sessions are untouched.',
|
|
31
|
+
params: {},
|
|
32
|
+
approval: 'none', readOnly: true, mutating: false, concurrencySafe: false, timeoutMs: 15_000,
|
|
33
|
+
examples: [{ args: {} }],
|
|
34
|
+
async execute(_args, ctx) {
|
|
35
|
+
await ctx.service.closePage(ctx.service.sessionState(ctx.agent));
|
|
36
|
+
return { closed: true };
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'target.list',
|
|
41
|
+
group: 'target',
|
|
42
|
+
summary: 'List this session\'s open pages (the one it opened plus popups) with id, url, title, and which one is active.',
|
|
43
|
+
notes: 'A popup (window.open, a link with target=_blank) joins the list but does not become active by itself; switch with target.select. Other sessions\' pages are never listed.',
|
|
44
|
+
params: {},
|
|
45
|
+
approval: 'none', readOnly: true, mutating: false, concurrencySafe: true, timeoutMs: 15_000,
|
|
46
|
+
examples: [{ args: {} }],
|
|
47
|
+
async execute(_args, ctx) {
|
|
48
|
+
const { targets } = await ctx.service.listTargets({ session: ctx.session });
|
|
49
|
+
const status = targets.length ? await ctx.service.status({ session: ctx.session }) : undefined;
|
|
50
|
+
return { targets, ...status?.activeAuthProfile ? { authProfile: status.activeAuthProfile } : {} };
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'target.select',
|
|
55
|
+
group: 'target',
|
|
56
|
+
summary: 'Make one of this session\'s pages (id from target.list) the active page for act/observe/inspect actions.',
|
|
57
|
+
notes: 'Switches only within this session. A page that was closed returns TARGET_CLOSED; call target.list again. Returns the selected page\'s url, title and text.',
|
|
58
|
+
params: { id: { type: 'string', required: true, description: 'Target id from target.list, e.g. t2.' } },
|
|
59
|
+
approval: 'none', readOnly: true, mutating: false, concurrencySafe: false, timeoutMs: 20_000,
|
|
60
|
+
examples: [{ args: { id: 't2' } }],
|
|
61
|
+
async execute(args, ctx) {
|
|
62
|
+
return ctx.service.selectTarget(args.id, { session: ctx.session });
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
//# sourceMappingURL=target.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target.js","sourceRoot":"","sources":["../../src/actions/target.ts"],"names":[],"mappings":"AAAA,oGAAoG;AAIpG,MAAM,CAAC,MAAM,cAAc,GA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,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action registry types.
|
|
3
|
+
*
|
|
4
|
+
* Every model-visible browser capability is one {@link ActionDef}: a name of
|
|
5
|
+
* the form `group.action`, a one-line summary, a parameter schema, an approval
|
|
6
|
+
* class, an availability rule, and the function that runs it. The `indexed`
|
|
7
|
+
* and `flat` tool surfaces are both projections of this one registry, so a
|
|
8
|
+
* capability is defined, validated, approved, and executed in exactly one place.
|
|
9
|
+
* @module dsh-browser/actions/types
|
|
10
|
+
*/
|
|
11
|
+
import type { ResolvedConfig } from '../config.ts';
|
|
12
|
+
import type { BrowserService } from '../browser-service.ts';
|
|
13
|
+
import type { AutomationAssetStore } from '../automation-assets.ts';
|
|
14
|
+
import type { AutomationDevelopmentService } from '../automation-development.ts';
|
|
15
|
+
import type { LocatorAmbiguity, PageGeneration } from '../locator.ts';
|
|
16
|
+
export declare const ACTION_GROUPS: readonly ["runtime", "target", "observe", "act", "inspect", "script", "automation", "crawl", "opencli"];
|
|
17
|
+
export type ActionGroup = typeof ACTION_GROUPS[number];
|
|
18
|
+
/** Shared sub-schemas defined once and referenced by name from parameters. */
|
|
19
|
+
export type SharedSchemaName = 'locator' | 'frame' | 'recipeStep' | 'recipeLocator' | 'postcondition' | 'inputSpec' | 'outputSpec';
|
|
20
|
+
/**
|
|
21
|
+
* One parameter node. The shape is deliberately a subset of the Host's tool
|
|
22
|
+
* parameter DSL, so the same nodes feed the flat tool projection unchanged
|
|
23
|
+
* once `ref` nodes are expanded.
|
|
24
|
+
*/
|
|
25
|
+
export interface ParamNode {
|
|
26
|
+
type?: 'string' | 'number' | 'boolean' | 'array' | 'object';
|
|
27
|
+
description?: string;
|
|
28
|
+
enum?: readonly string[];
|
|
29
|
+
/** Marks a property of the enclosing object as required. */
|
|
30
|
+
required?: true;
|
|
31
|
+
items?: ParamNode;
|
|
32
|
+
properties?: Record<string, ParamNode>;
|
|
33
|
+
additionalProperties?: boolean;
|
|
34
|
+
/** Reference to a shared sub-schema, expanded on demand. */
|
|
35
|
+
ref?: SharedSchemaName;
|
|
36
|
+
}
|
|
37
|
+
export type ParamSchema = Record<string, ParamNode>;
|
|
38
|
+
/**
|
|
39
|
+
* How an action is approved. The classes mirror the pre-registry rules in
|
|
40
|
+
* `approval-policy.ts`; the policy interprets them per automationMode.
|
|
41
|
+
*/
|
|
42
|
+
export type ApprovalClass = 'none' | 'interaction' | 'install' | 'upload' | 'evaluate' | 'userscript' | 'opencli' | 'recipe' | 'asset-run' | 'asset-develop';
|
|
43
|
+
export interface ActionExample {
|
|
44
|
+
args: Record<string, unknown>;
|
|
45
|
+
note?: string;
|
|
46
|
+
}
|
|
47
|
+
/** What an executing action may touch. Built per call by the tool layer. */
|
|
48
|
+
export interface ActionContext {
|
|
49
|
+
service: BrowserService;
|
|
50
|
+
config: ResolvedConfig;
|
|
51
|
+
assets?: AutomationAssetStore;
|
|
52
|
+
development?: AutomationDevelopmentService;
|
|
53
|
+
/** Session bucket key ({@link import('../browser-service.ts').sessionKeyFor}). */
|
|
54
|
+
session: string;
|
|
55
|
+
/** Plain session id used to attribute drafts. */
|
|
56
|
+
sessionId: string;
|
|
57
|
+
/** The Host agent identity, for the few operations keyed on the agent itself. */
|
|
58
|
+
agent: unknown;
|
|
59
|
+
signal: AbortSignal;
|
|
60
|
+
}
|
|
61
|
+
/** The flags that differ per sub-action for an action that bundles several operations behind one `action` argument. */
|
|
62
|
+
export interface ActionTraits {
|
|
63
|
+
readOnly: boolean;
|
|
64
|
+
mutating: boolean;
|
|
65
|
+
concurrencySafe: boolean;
|
|
66
|
+
}
|
|
67
|
+
/** One operation of an action such as `automation.develop`: its own summary, parameters and traits. */
|
|
68
|
+
export interface SubActionDef {
|
|
69
|
+
summary: string;
|
|
70
|
+
/** Names from the action's `params` that this operation uses (the selector argument itself is implied). */
|
|
71
|
+
params: readonly string[];
|
|
72
|
+
/** Which of those must be present for this operation (the shared schema marks none required). */
|
|
73
|
+
required?: readonly string[];
|
|
74
|
+
/** Per-parameter description for this operation, replacing the action-level one. */
|
|
75
|
+
hints?: Record<string, string>;
|
|
76
|
+
/** Error codes this operation can return; when set, the detail lists these instead of the action-wide set. */
|
|
77
|
+
errors?: readonly string[];
|
|
78
|
+
/** Extra guidance shown only in this operation's detail. */
|
|
79
|
+
notes?: string;
|
|
80
|
+
examples?: ActionExample[];
|
|
81
|
+
/** Overrides the action-level flags for this operation. */
|
|
82
|
+
traits?: Partial<ActionTraits>;
|
|
83
|
+
}
|
|
84
|
+
export interface SubActionSet {
|
|
85
|
+
/** The argument that selects the operation (`action`). */
|
|
86
|
+
key: string;
|
|
87
|
+
/** Parameters every operation takes, listed once with the action. */
|
|
88
|
+
common: readonly string[];
|
|
89
|
+
items: Record<string, SubActionDef>;
|
|
90
|
+
}
|
|
91
|
+
/** An extra detail page of an action, read with `browser_index({action:"<action>.<topic>"})`. Keeps the action's own detail short. */
|
|
92
|
+
export interface ActionTopic {
|
|
93
|
+
summary: string;
|
|
94
|
+
text: string;
|
|
95
|
+
}
|
|
96
|
+
export interface ActionDef {
|
|
97
|
+
/** `group.action`. */
|
|
98
|
+
name: string;
|
|
99
|
+
group: ActionGroup;
|
|
100
|
+
/** One sentence shown in the L1 listing. */
|
|
101
|
+
summary: string;
|
|
102
|
+
/** Extra L2 guidance. */
|
|
103
|
+
notes?: string;
|
|
104
|
+
params: ParamSchema;
|
|
105
|
+
approval: ApprovalClass;
|
|
106
|
+
/**
|
|
107
|
+
* Whether the action may run in `read-only` automationMode. With {@link subActions} this is the
|
|
108
|
+
* strictest value (what an unknown or unlisted operation gets); operations that are safe say so in their traits.
|
|
109
|
+
*/
|
|
110
|
+
readOnly: boolean;
|
|
111
|
+
/** Whether it changes page, local, or remote state (drives OUTCOME handling). Strictest value when there are sub-actions. */
|
|
112
|
+
mutating: boolean;
|
|
113
|
+
/** Whether sibling calls may overlap (flat surface only; `browser_call` is serial). Strictest value when there are sub-actions. */
|
|
114
|
+
concurrencySafe: boolean;
|
|
115
|
+
/** Operations behind one `action` argument, each with its own flags, detail view, and approval. */
|
|
116
|
+
subActions?: SubActionSet;
|
|
117
|
+
/** Detail pages for parts of the result (observe.read: one per section), listed in the action detail. */
|
|
118
|
+
topics?: Record<string, ActionTopic>;
|
|
119
|
+
/** Per-call budget; exceeded budgets return DEADLINE. */
|
|
120
|
+
timeoutMs: number;
|
|
121
|
+
/**
|
|
122
|
+
* Set for an executor that honours the abort signal at safe points and returns a structured partial
|
|
123
|
+
* result (recipes). After the deadline aborts it, the call waits up to this many ms for it to return,
|
|
124
|
+
* so the browser is quiet again before the next call and the completed steps are not lost.
|
|
125
|
+
*/
|
|
126
|
+
settleMs?: number;
|
|
127
|
+
examples?: ActionExample[];
|
|
128
|
+
/** Which error codes callers should expect beyond the generic set. */
|
|
129
|
+
errors?: string[];
|
|
130
|
+
execute(args: Record<string, any>, ctx: ActionContext): Promise<unknown>;
|
|
131
|
+
}
|
|
132
|
+
/** Raised by an executor for a malformed call that schema validation cannot express. */
|
|
133
|
+
export declare class ActionArgError extends Error {
|
|
134
|
+
readonly hint?: string | undefined;
|
|
135
|
+
constructor(message: string, hint?: string | undefined);
|
|
136
|
+
}
|
|
137
|
+
/** Raised when an action cannot run in the current environment. */
|
|
138
|
+
export declare class ActionUnavailableError extends Error {
|
|
139
|
+
readonly hint?: string | undefined;
|
|
140
|
+
constructor(message: string, hint?: string | undefined);
|
|
141
|
+
}
|
|
142
|
+
export declare const ERROR_CODES: readonly ["INVALID_ARGS", "UNKNOWN_ACTION", "CAPABILITY_UNAVAILABLE", "POLICY_DENIED", "LOCATOR_NOT_FOUND", "LOCATOR_AMBIGUOUS", "NOT_ACTIONABLE", "TARGET_CLOSED", "TARGET_STALE", "DEADLINE", "CANCELLED", "NOT_FOUND", "ACTION_FAILED", "VALIDATION_FAILED", "OUTCOME_UNKNOWN", "INVALID_RECIPE", "VALIDATION_MISSING"];
|
|
143
|
+
export type ErrorCode = typeof ERROR_CODES[number];
|
|
144
|
+
export type ExecutionStatus = 'completed' | 'failed' | 'cancelled' | 'outcome_unknown';
|
|
145
|
+
export interface ActionErrorBody {
|
|
146
|
+
code: ErrorCode;
|
|
147
|
+
message: string;
|
|
148
|
+
hint?: string;
|
|
149
|
+
/** Compact parameter schema, attached to INVALID_ARGS so the model can fix the call at once. */
|
|
150
|
+
schema?: string;
|
|
151
|
+
/** The first matches of an ambiguous locator (LOCATOR_AMBIGUOUS): role, name, text snippet, visibility. */
|
|
152
|
+
candidates?: LocatorAmbiguity;
|
|
153
|
+
/** The page's current target id and generation (TARGET_STALE): what the next call should expect after observing again. */
|
|
154
|
+
current?: PageGeneration;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* How an executor tells the dispatcher that a returned value is not a plain
|
|
158
|
+
* success: a recipe that ran but failed still returns its full report, and the
|
|
159
|
+
* envelope carries `ok: false` and an error next to it.
|
|
160
|
+
*/
|
|
161
|
+
export interface ActionOutcome {
|
|
162
|
+
ok: boolean;
|
|
163
|
+
executionStatus: ExecutionStatus;
|
|
164
|
+
error?: ActionErrorBody;
|
|
165
|
+
}
|
|
166
|
+
/** Attach an outcome to a result object without changing its serialized form. */
|
|
167
|
+
export declare function withOutcome<T extends object>(value: T, outcome: ActionOutcome): T;
|
|
168
|
+
export declare function outcomeOf(value: unknown): ActionOutcome | undefined;
|
|
169
|
+
export interface ActionEnvelope {
|
|
170
|
+
ok: boolean;
|
|
171
|
+
action: string;
|
|
172
|
+
/** Sequence number in the session's exploration journal (page-touching actions only); `draft_from_journal` refers to it. */
|
|
173
|
+
seq?: number;
|
|
174
|
+
executionStatus: ExecutionStatus;
|
|
175
|
+
result?: Record<string, unknown>;
|
|
176
|
+
error?: ActionErrorBody;
|
|
177
|
+
truncation?: {
|
|
178
|
+
omitted: number;
|
|
179
|
+
reason: string;
|
|
180
|
+
};
|
|
181
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action registry types.
|
|
3
|
+
*
|
|
4
|
+
* Every model-visible browser capability is one {@link ActionDef}: a name of
|
|
5
|
+
* the form `group.action`, a one-line summary, a parameter schema, an approval
|
|
6
|
+
* class, an availability rule, and the function that runs it. The `indexed`
|
|
7
|
+
* and `flat` tool surfaces are both projections of this one registry, so a
|
|
8
|
+
* capability is defined, validated, approved, and executed in exactly one place.
|
|
9
|
+
* @module dsh-browser/actions/types
|
|
10
|
+
*/
|
|
11
|
+
export const ACTION_GROUPS = ['runtime', 'target', 'observe', 'act', 'inspect', 'script', 'automation', 'crawl', 'opencli'];
|
|
12
|
+
/** Raised by an executor for a malformed call that schema validation cannot express. */
|
|
13
|
+
export class ActionArgError extends Error {
|
|
14
|
+
hint;
|
|
15
|
+
constructor(message, hint) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.hint = hint;
|
|
18
|
+
this.name = 'ActionArgError';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** Raised when an action cannot run in the current environment. */
|
|
22
|
+
export class ActionUnavailableError extends Error {
|
|
23
|
+
hint;
|
|
24
|
+
constructor(message, hint) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.hint = hint;
|
|
27
|
+
this.name = 'ActionUnavailableError';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export const ERROR_CODES = [
|
|
31
|
+
'INVALID_ARGS', 'UNKNOWN_ACTION', 'CAPABILITY_UNAVAILABLE', 'POLICY_DENIED',
|
|
32
|
+
'LOCATOR_NOT_FOUND', 'LOCATOR_AMBIGUOUS', 'NOT_ACTIONABLE', 'TARGET_CLOSED', 'TARGET_STALE',
|
|
33
|
+
'DEADLINE', 'CANCELLED', 'NOT_FOUND', 'ACTION_FAILED',
|
|
34
|
+
// Recipe execution (B2): the failure says what already happened, not only that something failed.
|
|
35
|
+
'VALIDATION_FAILED', 'OUTCOME_UNKNOWN', 'INVALID_RECIPE',
|
|
36
|
+
// A draft test cannot pass because nothing in the asset verifies its result (B4).
|
|
37
|
+
'VALIDATION_MISSING',
|
|
38
|
+
];
|
|
39
|
+
const OUTCOMES = new WeakMap();
|
|
40
|
+
/** Attach an outcome to a result object without changing its serialized form. */
|
|
41
|
+
export function withOutcome(value, outcome) {
|
|
42
|
+
OUTCOMES.set(value, outcome);
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
export function outcomeOf(value) {
|
|
46
|
+
return value !== null && typeof value === 'object' ? OUTCOMES.get(value) : undefined;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/actions/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,CAAU,CAAA;AA0IpI,wFAAwF;AACxF,MAAM,OAAO,cAAe,SAAQ,KAAK;IACD;IAAtC,YAAY,OAAe,EAAW,IAAa;QACjD,KAAK,CAAC,OAAO,CAAC,CAAA;QADsB,SAAI,GAAJ,IAAI,CAAS;QAEjD,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;IAC9B,CAAC;CACF;AAED,mEAAmE;AACnE,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IACT;IAAtC,YAAY,OAAe,EAAW,IAAa;QACjD,KAAK,CAAC,OAAO,CAAC,CAAA;QADsB,SAAI,GAAJ,IAAI,CAAS;QAEjD,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAA;IACtC,CAAC;CACF;AAED,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,cAAc,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,eAAe;IAC3E,mBAAmB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc;IAC3F,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe;IACrD,iGAAiG;IACjG,mBAAmB,EAAE,iBAAiB,EAAE,gBAAgB;IACxD,kFAAkF;IAClF,oBAAoB;CACZ,CAAA;AA4BV,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAyB,CAAA;AAErD,iFAAiF;AACjF,MAAM,UAAU,WAAW,CAAmB,KAAQ,EAAE,OAAsB;IAC5E,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAC5B,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AACtF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The input-set requirement of activation, as pure functions over stored data.
|
|
3
|
+
*
|
|
4
|
+
* The store enforces it (`AutomationAssetStore.setStatus`) and the settings card explains it next to the Activate
|
|
5
|
+
* button; both call these, so what the card says is what the store will do. Types only, so the card can bundle it.
|
|
6
|
+
* @module dsh-browser/activation-rules
|
|
7
|
+
*/
|
|
8
|
+
import type { AutomationAsset, TestCredential } from './automation-assets.ts';
|
|
9
|
+
/** How many input sets one test takes. */
|
|
10
|
+
export declare const INPUT_SET_MIN = 2;
|
|
11
|
+
export declare const INPUT_SET_MAX = 5;
|
|
12
|
+
/**
|
|
13
|
+
* How many different input sets the credential's passing test covered: its passed sets, one for a plain single run,
|
|
14
|
+
* and enough for any requirement when it is a `legacy` credential synthesized from data written before input sets
|
|
15
|
+
* existed (so upgrading never strands an already-tested asset).
|
|
16
|
+
*/
|
|
17
|
+
export declare function inputSetsCovered(credential: Pick<TestCredential, 'legacy' | 'inputSets'>): number;
|
|
18
|
+
/** How many inputs the asset declares (typed `inputSchema` for v2, `inputNames` otherwise). Zero means the rule does not apply. */
|
|
19
|
+
export declare function declaredInputs(asset: Pick<AutomationAsset, 'inputSchema' | 'inputNames'>): number;
|
|
20
|
+
export interface InputSetShortfall {
|
|
21
|
+
/** Inputs the asset declares. */
|
|
22
|
+
declared: number;
|
|
23
|
+
/** Input sets the activation needs the passing test to have covered. */
|
|
24
|
+
required: number;
|
|
25
|
+
/** Input sets the test of the current revision covered. */
|
|
26
|
+
covered: number;
|
|
27
|
+
}
|
|
28
|
+
/** What stands between this asset and activation on input sets, or undefined when nothing does. `credential` is the latest of the current revision. */
|
|
29
|
+
export declare function inputSetShortfall(asset: Pick<AutomationAsset, 'inputSchema' | 'inputNames'>, credential: Pick<TestCredential, 'legacy' | 'inputSets'> | undefined, required: number): InputSetShortfall | undefined;
|