@descryy/mcp 0.11.2 → 0.11.3
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/bin/descry-mcp.js +6 -0
- package/dist/bin/descry-mcp.js.map +1 -1
- package/dist/browser/auth.d.ts +8 -0
- package/dist/browser/auth.d.ts.map +1 -1
- package/dist/browser/auth.js +12 -2
- package/dist/browser/auth.js.map +1 -1
- package/dist/credential-store.d.ts +22 -0
- package/dist/credential-store.d.ts.map +1 -0
- package/dist/credential-store.js +33 -0
- package/dist/credential-store.js.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/planner/predict-then-propose.d.ts +34 -1
- package/dist/planner/predict-then-propose.d.ts.map +1 -1
- package/dist/planner/predict-then-propose.js +51 -1
- package/dist/planner/predict-then-propose.js.map +1 -1
- package/dist/planner/propose-journey.d.ts +15 -0
- package/dist/planner/propose-journey.d.ts.map +1 -1
- package/dist/planner/propose-journey.js.map +1 -1
- package/dist/scenarios/browser-run-plan-projection.d.ts +24 -6
- package/dist/scenarios/browser-run-plan-projection.d.ts.map +1 -1
- package/dist/scenarios/browser-run-plan-projection.js +45 -9
- package/dist/scenarios/browser-run-plan-projection.js.map +1 -1
- package/dist/tools/browser-start-session.d.ts.map +1 -1
- package/dist/tools/browser-start-session.js +57 -11
- package/dist/tools/browser-start-session.js.map +1 -1
- package/dist/tools/browser.d.ts.map +1 -1
- package/dist/tools/browser.js +9 -0
- package/dist/tools/browser.js.map +1 -1
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +5 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/observe-runtime.d.ts +27 -0
- package/dist/tools/observe-runtime.d.ts.map +1 -1
- package/dist/tools/observe-runtime.js +230 -4
- package/dist/tools/observe-runtime.js.map +1 -1
- package/dist/tools/observe.d.ts.map +1 -1
- package/dist/tools/observe.js +45 -0
- package/dist/tools/observe.js.map +1 -1
- package/dist/tools/prove-reach.d.ts +74 -0
- package/dist/tools/prove-reach.d.ts.map +1 -0
- package/dist/tools/prove-reach.js +286 -0
- package/dist/tools/prove-reach.js.map +1 -0
- package/package.json +25 -21
package/dist/bin/descry-mcp.js
CHANGED
|
@@ -10,6 +10,7 @@ import { createMcpServer, isOutOfBand } from "../server.js";
|
|
|
10
10
|
import { Session } from "../session.js";
|
|
11
11
|
import { serveStdio } from "../transport.js";
|
|
12
12
|
import { createPlaywrightBrowserDriver } from "../browser/playwright-driver.js";
|
|
13
|
+
import { createDefaultCredentialStore } from "../credential-store.js";
|
|
13
14
|
/** Read from the installed package, not hardcoded. It used to be literal `"0.0.0"` for every
|
|
14
15
|
* release, so no host could tell that 0.1.2 shipped from an off-main branch with an extra tool —
|
|
15
16
|
* a server that can't say what it is can't be caught drifting. */
|
|
@@ -43,6 +44,11 @@ async function main() {
|
|
|
43
44
|
// tool refuses unconditionally regardless of what's installed. createPlaywrightBrowserDriver
|
|
44
45
|
// still turns a missing package/binary into a named refusal, not a crash.
|
|
45
46
|
session.useBrowserDriverFactory((options) => createPlaywrightBrowserDriver(options));
|
|
47
|
+
// RG-1(4)'s remaining gap: `credentialStore` was settable but nothing outside a test ever
|
|
48
|
+
// set it, so `${credential:NAME}` refused unconditionally in real use. The documented
|
|
49
|
+
// default location is `~/.descry/credentials` (`credential-store.ts`'s own header) — the
|
|
50
|
+
// same store `descry credential set` writes into.
|
|
51
|
+
session.credentialStore = createDefaultCredentialStore();
|
|
46
52
|
const server = createMcpServer({ session, name: "descry", version: VERSION });
|
|
47
53
|
try {
|
|
48
54
|
await serveStdio({ stdin: process.stdin, stdout: process.stdout, stderr: process.stderr }, (line, transport) => server.dispatch(line, transport),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descry-mcp.js","sourceRoot":"","sources":["../../src/bin/descry-mcp.ts"],"names":[],"mappings":";A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rE,6DAA6D;QAC7D,EAAE,WAAW,EAAE,CAChB,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;YAAS,CAAC;QACT,8FAA8F;QAC9F,qFAAqF;QACrF,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,IAAI,CACT,CAAC,IAAI,EAAE,EAAE;IACP,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;AAC1B,CAAC,EACD,CAAC,KAAc,EAAE,EAAE;IACjB,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,eAAe,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CACzF,CAAC;IACF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CACF,CAAC"}
|
package/dist/browser/auth.d.ts
CHANGED
|
@@ -52,6 +52,14 @@ export interface StorageStateContext {
|
|
|
52
52
|
* changing an argument, and none of them is a bug in this server.
|
|
53
53
|
*/
|
|
54
54
|
export declare function loadStorageStateFile(path: string, context: StorageStateContext): BrowserStorageState;
|
|
55
|
+
/**
|
|
56
|
+
* The parse-and-narrow half of {@link loadStorageStateFile}, taken directly rather than read
|
|
57
|
+
* from a file — `browser-start-session.ts`'s `storageStateCredential` calls this against text
|
|
58
|
+
* retrieved from `Session.credentialStore` (RG-1(4), lane "signin"). `sourceLabel` replaces the
|
|
59
|
+
* file path in every message this can throw, so a credential-sourced refusal reads
|
|
60
|
+
* `credential "NAME"` rather than a nonexistent file path.
|
|
61
|
+
*/
|
|
62
|
+
export declare function parseStorageStateJson(text: string, sourceLabel: string, context: StorageStateContext): BrowserStorageState;
|
|
55
63
|
/**
|
|
56
64
|
* Where a saved state may be written.
|
|
57
65
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceR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ED,6FAA6F;AAC7F,wBAAgB,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,MAAM,EAAE,CAGjG"}
|
package/dist/browser/auth.js
CHANGED
|
@@ -80,6 +80,16 @@ export function loadStorageStateFile(path, context) {
|
|
|
80
80
|
"A relative path is resolved against the repository root. The usual way to produce this file is to " +
|
|
81
81
|
"start a session with headless false and saveStorageStateTo, log in by hand, and close it.");
|
|
82
82
|
}
|
|
83
|
+
return parseStorageStateJson(text, resolved, context);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The parse-and-narrow half of {@link loadStorageStateFile}, taken directly rather than read
|
|
87
|
+
* from a file — `browser-start-session.ts`'s `storageStateCredential` calls this against text
|
|
88
|
+
* retrieved from `Session.credentialStore` (RG-1(4), lane "signin"). `sourceLabel` replaces the
|
|
89
|
+
* file path in every message this can throw, so a credential-sourced refusal reads
|
|
90
|
+
* `credential "NAME"` rather than a nonexistent file path.
|
|
91
|
+
*/
|
|
92
|
+
export function parseStorageStateJson(text, sourceLabel, context) {
|
|
83
93
|
let parsed;
|
|
84
94
|
try {
|
|
85
95
|
parsed = JSON.parse(text);
|
|
@@ -87,9 +97,9 @@ export function loadStorageStateFile(path, context) {
|
|
|
87
97
|
catch {
|
|
88
98
|
// The parser's own message quotes the text around the failure, and in this
|
|
89
99
|
// one file that text is credential material.
|
|
90
|
-
throw new ToolInputError(`The storage state at ${
|
|
100
|
+
throw new ToolInputError(`The storage state at ${sourceLabel} is not valid JSON. Its contents are deliberately not quoted here.`);
|
|
91
101
|
}
|
|
92
|
-
return narrowToOrigin(parsed,
|
|
102
|
+
return narrowToOrigin(parsed, sourceLabel, context);
|
|
93
103
|
}
|
|
94
104
|
function narrowToOrigin(raw, path, context) {
|
|
95
105
|
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
package/dist/browser/auth.js.map
CHANGED
|
@@ -1 +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,MAAM,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,cAAc,CACtB,oCAAoC,IAAI,uCAAuC,QAAQ,oBAAoB;YACzG,wGAAwG;YACxG,0EAA0E,CAC7E,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAiC;IACnE,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IAC9B,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,CAAC;IACpH,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACnE,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,aAAa,CAAC,OAAgD;IAC5E,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IAChC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACnF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CredentialStoreLike } from "./scenarios/index.ts";
|
|
2
|
+
export interface CredentialStoreOptions {
|
|
3
|
+
/** Overrides the documented default (`~/.descry/credentials`) — for isolation in a test,
|
|
4
|
+
* never in production use, where the shared, documented location is the point: a
|
|
5
|
+
* credential stored once via `descry credential set` must be the same store a later
|
|
6
|
+
* `descry-mcp` process reads. */
|
|
7
|
+
readonly baseDir?: string;
|
|
8
|
+
}
|
|
9
|
+
/** The full three-method shape (`store`/`retrieve`/`delete`) — `CredentialStoreLike` only
|
|
10
|
+
* needs `retrieve` for a scenario replay, but `descry credential set` needs `store` too, and
|
|
11
|
+
* both callers share one factory rather than each constructing `EncryptedFileCredentialStore`
|
|
12
|
+
* directly. */
|
|
13
|
+
export interface WritableCredentialStore extends CredentialStoreLike {
|
|
14
|
+
store(credentialRef: string, secret: string): Promise<void>;
|
|
15
|
+
delete(credentialRef: string): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
/** Constructs the real, at-rest credential store — AES-256-GCM file backing, documented
|
|
18
|
+
* default location. Every real `descry-mcp` process calls this once at startup
|
|
19
|
+
* (`bin/descry-mcp.ts`) and sets it on the `Session`; `descry credential set` calls it to
|
|
20
|
+
* write into the exact same store. */
|
|
21
|
+
export declare function createDefaultCredentialStore(options?: CredentialStoreOptions): WritableCredentialStore;
|
|
22
|
+
//# sourceMappingURL=credential-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-store.d.ts","sourceRoot":"","sources":["../src/credential-store.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,MAAM,WAAW,sBAAsB;IACrC;;;sCAGkC;IAClC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;gBAGgB;AAChB,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IAClE,KAAK,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,MAAM,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C;AAED;;;uCAGuC;AACvC,wBAAgB,4BAA4B,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,uBAAuB,CAEtG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The real credential store a running `descry-mcp` server uses, not a test double.
|
|
3
|
+
*
|
|
4
|
+
* `Session.credentialStore` (`session.ts`) has been settable since the round that added
|
|
5
|
+
* `${credential:NAME}` scenario references, but nothing outside a test ever set it — every
|
|
6
|
+
* real server left it `undefined`, so `${credential:...}` refused unconditionally no matter
|
|
7
|
+
* what a person had stored. RG-1(4)'s remaining gap.
|
|
8
|
+
*
|
|
9
|
+
* `descry-runtime`'s `EncryptedFileCredentialStore` (`@descryy/runtime-environment-profile`,
|
|
10
|
+
* already one of this package's nine runtime dependencies — see `descry-core`'s CLAUDE.md,
|
|
11
|
+
* "Repo split") is the store: AES-256-GCM at rest, one file per credential named by the
|
|
12
|
+
* SHA-256 hash of its ref, key at `<baseDir>/master.key`, both directory and key chmod'd
|
|
13
|
+
* owner-only. Documented default location: `~/.descry/credentials` (`homedir()`, joined with
|
|
14
|
+
* `.descry/credentials` — see that package's own header for why this is a disclosed fallback
|
|
15
|
+
* rather than a real OS keychain, DEC-270). `baseDir` is exposed here, not hidden, so a test —
|
|
16
|
+
* or a future caller with a reason to isolate the store — can point it elsewhere without
|
|
17
|
+
* reaching past this module into the runtime package directly.
|
|
18
|
+
*
|
|
19
|
+
* This module is the one place `@descryy/mcp` constructs the real store; `bin/descry-mcp.ts`
|
|
20
|
+
* is the one place a real server calls it. `@descryy/cli`'s `descry credential set` (
|
|
21
|
+
* `packages/cli/src/commands/credential.ts`) calls it too, through this package's own export
|
|
22
|
+
* surface (`index.ts`) rather than adding a second, redundant dependency on the runtime
|
|
23
|
+
* package for a CLI that otherwise has no reason to know it exists.
|
|
24
|
+
*/
|
|
25
|
+
import { EncryptedFileCredentialStore } from "@descryy/runtime-environment-profile";
|
|
26
|
+
/** Constructs the real, at-rest credential store — AES-256-GCM file backing, documented
|
|
27
|
+
* default location. Every real `descry-mcp` process calls this once at startup
|
|
28
|
+
* (`bin/descry-mcp.ts`) and sets it on the `Session`; `descry credential set` calls it to
|
|
29
|
+
* write into the exact same store. */
|
|
30
|
+
export function createDefaultCredentialStore(options) {
|
|
31
|
+
return new EncryptedFileCredentialStore(options);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=credential-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-store.js","sourceRoot":"","sources":["../src/credential-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAqBpF;;;uCAGuC;AACvC,MAAM,UAAU,4BAA4B,CAAC,OAAgC;IAC3E,OAAO,IAAI,4BAA4B,CAAC,OAAO,CAAC,CAAC;AACnD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,11 @@ export { Session, loadConfig, writeConfig, writeSources, ConfigError, CONFIG_REL
|
|
|
7
7
|
export type { DescryConfig, SessionOptions, ConfigPatch } from "./session.ts";
|
|
8
8
|
export { loadSources, detectSources, normaliseSpec } from "./registry.ts";
|
|
9
9
|
export type { SourceSpec, LoadedSource, SourceLoadFailure, RegistryResult } from "./registry.ts";
|
|
10
|
+
/** The real, at-rest credential store — see the module's own header for why this is the one
|
|
11
|
+
* place `@descryy/cli` reaches this without depending on `@descryy/runtime-environment-profile`
|
|
12
|
+
* itself. */
|
|
13
|
+
export { createDefaultCredentialStore } from "./credential-store.ts";
|
|
14
|
+
export type { CredentialStoreOptions, WritableCredentialStore } from "./credential-store.ts";
|
|
10
15
|
export { renderAnswer, renderFailed, renderHandshake, renderTimedOut, renderToolError, DisclosureError, TOOL_TIERS, } from "./render.ts";
|
|
11
16
|
export type { AnswerEnvelope, CallToolResult, Provenance, ResultState, ToolAnswer, ToolTier, TruncationDetail, } from "./render.ts";
|
|
12
17
|
export { TOOLS, TOOLS_BY_NAME, ToolInputError, resolveOneNode } from "./tools/index.ts";
|
|
@@ -23,5 +28,5 @@ export type { RpcRequest, RpcNotification, RpcResponse, RpcMessage, RpcId } from
|
|
|
23
28
|
* doesn't reach past the package boundary — a second reader importing the relative path
|
|
24
29
|
* could drift from this one the day the schema changes. */
|
|
25
30
|
export { MIN_READABLE_SCHEMA_VERSION, SCENARIO_SCHEMA_VERSION, isSecretRef, isUnverifying, parseScenario, readSecretRef, referencedVariables, resolveSecretText, secretRefFor, serializeScenario, scenariosDirectory, scenarioPath, listScenarios, ScenarioListError, readScenario, writeScenario, projectScenarioToRunPlan, projectRunPlanToScenario, } from "./scenarios/index.ts";
|
|
26
|
-
export type { Scenario, SecretEnvironment, SecretRef, SecretResolution, ScenarioStep, ScenarioAssertion, ScenarioAssertionKind, ScenarioActionKind, ScenarioParseResult, TargetDescriptor, ProjectedStep, ProjectedStepKind, ProjectedBrowserRunPlan, ProjectionRefusal, ScenarioProjection, PlanProjection, RawProjectedStep, ScenarioMeta, } from "./scenarios/index.ts";
|
|
31
|
+
export type { CredentialStoreLike, Scenario, SecretEnvironment, SecretRef, SecretResolution, ScenarioStep, ScenarioAssertion, ScenarioAssertionKind, ScenarioActionKind, ScenarioParseResult, TargetDescriptor, ProjectedStep, ProjectedStepKind, ProjectedBrowserRunPlan, ProjectionRefusal, ScenarioProjection, PlanProjection, RawProjectedStep, ScenarioMeta, } from "./scenarios/index.ts";
|
|
27
32
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;yDAEyD;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,EACL,OAAO,EACP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eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EACX,SAAS,EACT,cAAc,EACd,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,2BAA2B,EAC3B,oBAAoB,EACpB,SAAS,EACT,eAAe,EACf,UAAU,EACV,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9D,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,gBAAgB,EAChB,YAAY,EACZ,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEjG;;4DAE4D;AAC5D,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,EACvB,WAAW,EACX,aAAa,EACb,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,YAAY,GACb,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;yDAEyD;AAEzD,OA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AqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,YAAY,GACb,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
export { createMcpServer } from "./server.js";
|
|
5
5
|
export { Session, loadConfig, writeConfig, writeSources, ConfigError, CONFIG_RELATIVE_PATH, DEFAULT_GRAPH_RELATIVE_PATH, } from "./session.js";
|
|
6
6
|
export { loadSources, detectSources, normaliseSpec } from "./registry.js";
|
|
7
|
+
/** The real, at-rest credential store — see the module's own header for why this is the one
|
|
8
|
+
* place `@descryy/cli` reaches this without depending on `@descryy/runtime-environment-profile`
|
|
9
|
+
* itself. */
|
|
10
|
+
export { createDefaultCredentialStore } from "./credential-store.js";
|
|
7
11
|
export { renderAnswer, renderFailed, renderHandshake, renderTimedOut, renderToolError, DisclosureError, TOOL_TIERS, } from "./render.js";
|
|
8
12
|
export { TOOLS, TOOLS_BY_NAME, ToolInputError, resolveOneNode } from "./tools/index.js";
|
|
9
13
|
export { serveStdio, guardStdout, createLineReader } from "./transport.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;yDAEyD;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EACL,OAAO,EACP,UAAU,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG1E,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,cAAc,EACd,eAAe,EACf,eAAe,EACf,UA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B,EAAE,MAAM,gBAAgB,CAAC;AAG3E,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,gBAAgB,EAChB,YAAY,EACZ,aAAa,GACd,MAAM,eAAe,CAAC;AAGvB;;4DAE4D;AAC5D,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,EACvB,WAAW,EACX,aAAa,EACb,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC"}
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
* of the cases that confirmed the prediction.
|
|
50
50
|
*/
|
|
51
51
|
import { type AdjacencyProvider } from "@descryy/core";
|
|
52
|
-
import { type JourneyCandidateNode, type ProposedJourney } from "./propose-journey.ts";
|
|
52
|
+
import { type JourneyCandidateNode, type JourneyPathHop, type ProposedJourney } from "./propose-journey.ts";
|
|
53
53
|
export interface PredictThenProposeOptions {
|
|
54
54
|
readonly targetUrl: string;
|
|
55
55
|
readonly name: string;
|
|
@@ -98,4 +98,37 @@ export interface ProvenReach {
|
|
|
98
98
|
* prediction as "not checked" once it has a real `ObservedReach` in hand.
|
|
99
99
|
*/
|
|
100
100
|
export declare function proveOrDisprove(predicted: PredictedReach, observed: ObservedReach): ProvenReach;
|
|
101
|
+
/** One real edge, in the shape `@descryy/ir`'s `GraphPathHop` needs — never invented, only
|
|
102
|
+
* ever a copy of a hop `reachablePages` actually walked (see `queries.ts`'s `ReachPathHop`). */
|
|
103
|
+
export type PredictedPathHop = JourneyPathHop;
|
|
104
|
+
/**
|
|
105
|
+
* `prove_reach`'s join into the finding funnel: the real path from `startNodeId` to whichever
|
|
106
|
+
* predicted pages a caller names (typically the ones a real drive proved), deduplicated by
|
|
107
|
+
* (from, to, edgeType) and ordered by first appearance. Pure — no I/O, no re-traversal; it only
|
|
108
|
+
* reassembles the `path` each `JourneyCandidateNode` already carries from `predictThenPropose`.
|
|
109
|
+
*
|
|
110
|
+
* Union, not intersection or average: rule 2 says omit an edge you are unsure of, not omit one
|
|
111
|
+
* two pages happen to share — every hop named here is a real edge on at least one named page's
|
|
112
|
+
* real path, and `minimumResolution` (the caller's next step) already takes the conservative
|
|
113
|
+
* floor across all of them.
|
|
114
|
+
*/
|
|
115
|
+
export declare function combinedGraphPath(predicted: PredictedReach, pageIds: readonly string[]): readonly PredictedPathHop[];
|
|
116
|
+
/** One proposed navigate step, resolved against how it actually replayed — structural, the same
|
|
117
|
+
* reasoning as `ObservedReach`: a real `ScenarioStepResult` (`browser/scenario-runner.ts`)
|
|
118
|
+
* already satisfies this without a cast, so this module still takes no dependency on the
|
|
119
|
+
* browser package (see this module's header). */
|
|
120
|
+
export interface ReplayedStep {
|
|
121
|
+
readonly url: string;
|
|
122
|
+
readonly status: "ran" | "unresolved" | "skipped";
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Which predicted pages a real drive of the proposed scenario actually navigated to —
|
|
126
|
+
* `prove_reach`'s own `ObservedReach.visitedNodeIds`, built without guessing: a page counts as
|
|
127
|
+
* visited only when a step whose `url` is byte-identical to the exact navigate URL
|
|
128
|
+
* `proposeJourney` built FROM that page's own route name came back `"ran"`. A step that never
|
|
129
|
+
* resolved (the app was down, the route 404'd before the browser could navigate) does not count
|
|
130
|
+
* — reaching a URL and having the navigation actually run are the same fact here, and this
|
|
131
|
+
* never inflates "predicted" into "visited" for a step that did not.
|
|
132
|
+
*/
|
|
133
|
+
export declare function visitedPageIds(predicted: PredictedReach, targetUrl: string, steps: readonly ReplayedStep[]): readonly string[];
|
|
101
134
|
//# sourceMappingURL=predict-then-propose.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predict-then-propose.d.ts","sourceRoot":"","sources":["../../src/planner/predict-then-propose.ts"],"names":[],"mappings":"AAAA;;;;;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,CAAC,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACjD;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACrD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,GAAG,WAAW,CAQ/F;AAED;iGACiG;AACjG,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,gBAAgB,EAAE,CAcpH;AAED;;;kDAGkD;AAClD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,YAAY,GAAG,SAAS,CAAC;CACnD;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,MAAM,EAAE,CAQ9H"}
|
|
@@ -58,11 +58,14 @@ import { proposeJourney } from "./propose-journey.js";
|
|
|
58
58
|
export function predictThenPropose(provider, startNodeId, options) {
|
|
59
59
|
const reach = reachablePages(provider, startNodeId);
|
|
60
60
|
// `reachablePages` already restricts itself to PAGE/COMPONENT nodes (see
|
|
61
|
-
// its own doc); no re-filtering needed here.
|
|
61
|
+
// its own doc); no re-filtering needed here. `path` — the real edge chain
|
|
62
|
+
// this walk used to reach this node — is carried through so a later caller
|
|
63
|
+
// (`prove_reach`) can build a real `graphPath` from it, never a guessed one.
|
|
62
64
|
const reachedPages = reach.data.map((r) => ({
|
|
63
65
|
id: r.node.id,
|
|
64
66
|
type: r.node.type,
|
|
65
67
|
name: r.node.name,
|
|
68
|
+
path: r.path,
|
|
66
69
|
}));
|
|
67
70
|
if (reachedPages.length === 0) {
|
|
68
71
|
return { reachedPages: [], proposal: null, notes: reach.notes };
|
|
@@ -85,4 +88,51 @@ export function proveOrDisprove(predicted, observed) {
|
|
|
85
88
|
}
|
|
86
89
|
return { proven, disproven };
|
|
87
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* `prove_reach`'s join into the finding funnel: the real path from `startNodeId` to whichever
|
|
93
|
+
* predicted pages a caller names (typically the ones a real drive proved), deduplicated by
|
|
94
|
+
* (from, to, edgeType) and ordered by first appearance. Pure — no I/O, no re-traversal; it only
|
|
95
|
+
* reassembles the `path` each `JourneyCandidateNode` already carries from `predictThenPropose`.
|
|
96
|
+
*
|
|
97
|
+
* Union, not intersection or average: rule 2 says omit an edge you are unsure of, not omit one
|
|
98
|
+
* two pages happen to share — every hop named here is a real edge on at least one named page's
|
|
99
|
+
* real path, and `minimumResolution` (the caller's next step) already takes the conservative
|
|
100
|
+
* floor across all of them.
|
|
101
|
+
*/
|
|
102
|
+
export function combinedGraphPath(predicted, pageIds) {
|
|
103
|
+
const wanted = new Set(pageIds);
|
|
104
|
+
const seen = new Set();
|
|
105
|
+
const hops = [];
|
|
106
|
+
for (const page of predicted.reachedPages) {
|
|
107
|
+
if (!wanted.has(page.id) || page.path === undefined)
|
|
108
|
+
continue;
|
|
109
|
+
for (const hop of page.path) {
|
|
110
|
+
const key = `${hop.from}::${hop.to}::${hop.edgeType}`;
|
|
111
|
+
if (seen.has(key))
|
|
112
|
+
continue;
|
|
113
|
+
seen.add(key);
|
|
114
|
+
hops.push(hop);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return hops;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Which predicted pages a real drive of the proposed scenario actually navigated to —
|
|
121
|
+
* `prove_reach`'s own `ObservedReach.visitedNodeIds`, built without guessing: a page counts as
|
|
122
|
+
* visited only when a step whose `url` is byte-identical to the exact navigate URL
|
|
123
|
+
* `proposeJourney` built FROM that page's own route name came back `"ran"`. A step that never
|
|
124
|
+
* resolved (the app was down, the route 404'd before the browser could navigate) does not count
|
|
125
|
+
* — reaching a URL and having the navigation actually run are the same fact here, and this
|
|
126
|
+
* never inflates "predicted" into "visited" for a step that did not.
|
|
127
|
+
*/
|
|
128
|
+
export function visitedPageIds(predicted, targetUrl, steps) {
|
|
129
|
+
const base = targetUrl.endsWith("/") ? targetUrl.slice(0, -1) : targetUrl;
|
|
130
|
+
const ranUrls = new Set(steps.filter((s) => s.status === "ran").map((s) => s.url));
|
|
131
|
+
const visited = [];
|
|
132
|
+
for (const page of predicted.reachedPages) {
|
|
133
|
+
if (ranUrls.has(`${base}${page.name}`))
|
|
134
|
+
visited.push(page.id);
|
|
135
|
+
}
|
|
136
|
+
return visited;
|
|
137
|
+
}
|
|
88
138
|
//# sourceMappingURL=predict-then-propose.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predict-then-propose.js","sourceRoot":"","sources":["../../src/planner/predict-then-propose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,EAAE,cAAc,EAA0B,MAAM,eAAe,CAAC;AAEvE,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"predict-then-propose.js","sourceRoot":"","sources":["../../src/planner/predict-then-propose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,EAAE,cAAc,EAA0B,MAAM,eAAe,CAAC;AAEvE,OAAO,EAAE,cAAc,EAAwE,MAAM,sBAAsB,CAAC;AAgB5H;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAA2B,EAC3B,WAAmB,EACnB,OAAkC;IAElC,MAAM,KAAK,GAAG,cAAc,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACpD,yEAAyE;IACzE,0EAA0E;IAC1E,2EAA2E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MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,YAAY,EAAE,CAAC;QAC1C,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -32,11 +32,26 @@
|
|
|
32
32
|
* `browser_run_scenario` can replay. See `propose-journey.test.ts`'s
|
|
33
33
|
* "nothing executes without an acceptance record" case.
|
|
34
34
|
*/
|
|
35
|
+
import type { EdgeType, ResolutionLevel } from "@descryy/ir";
|
|
35
36
|
import { type Scenario } from "../scenarios/index.ts";
|
|
37
|
+
/** One real, stored edge — see `@descryy/core`'s `ReachPathHop` (same shape, this planner takes
|
|
38
|
+
* no dependency on that package's query layer to declare it). Field-compatible with
|
|
39
|
+
* `@descryy/ir`'s `GraphPathHop` too, so a real array of these already satisfies it without a cast. */
|
|
40
|
+
export interface JourneyPathHop {
|
|
41
|
+
readonly from: string;
|
|
42
|
+
readonly to: string;
|
|
43
|
+
readonly edgeType: EdgeType;
|
|
44
|
+
readonly resolution: ResolutionLevel;
|
|
45
|
+
}
|
|
36
46
|
export interface JourneyCandidateNode {
|
|
37
47
|
readonly id: string;
|
|
38
48
|
readonly type: string;
|
|
39
49
|
readonly name: string;
|
|
50
|
+
/** The real edge chain `reachablePages` walked to reach this node, when the caller has one
|
|
51
|
+
* (`predictThenPropose` sets it; a plain diff-scope caller of this planner does not). Optional
|
|
52
|
+
* so this planner's own, unrelated callers are unaffected — it is never read here, only
|
|
53
|
+
* carried through for `prove_reach`'s join into the finding funnel. */
|
|
54
|
+
readonly path?: readonly JourneyPathHop[];
|
|
40
55
|
}
|
|
41
56
|
export interface ProposedJourney {
|
|
42
57
|
/** A `Scenario`-shaped proposal. `assertions` is always empty: this module has no evidence to assert against, and inventing one would be a confident false claim about a page it never observed. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propose-journey.d.ts","sourceRoot":"","sources":["../../src/planner/propose-journey.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAA2B,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE/E,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"propose-journey.d.ts","sourceRoot":"","sources":["../../src/planner/propose-journey.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAA2B,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE/E;;wGAEwG;AACxG,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC;CACtC;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;4EAGwE;IACxE,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,eAAe;IAC9B,oMAAoM;IACpM,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,iKAAiK;IACjK,QAAQ,CAAC,kBAAkB,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC7D,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAOD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,oBAAoB,EAAE,EACtC,OAAO,EAAE;IACP,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC,GACA,eAAe,CAwDjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propose-journey.js","sourceRoot":"","sources":["../../src/planner/propose-journey.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;
|
|
1
|
+
{"version":3,"file":"propose-journey.js","sourceRoot":"","sources":["../../src/planner/propose-journey.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAIH,OAAO,EAAE,uBAAuB,EAAiB,MAAM,uBAAuB,CAAC;AA+B/E,iRAAiR;AACjR,SAAS,kBAAkB,CAAC,IAAY;IACtC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC1E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAsC,EACtC,OAIC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WA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G,iGAAiG,CACpG,CAAC;IACF,IAAI,UAAU,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9C,KAAK,CAAC,IAAI,CACR,GAAG,UAAU,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,sBAAsB,UAAU,CAAC,MAAM,mBAAmB;YAChG,qBAAqB,UAAU,CAAC,MAAM,iEAAiE;YACvG,qDAAqD,CACxD,CAAC;IACJ,CAAC;IAED,OAAO;QACL,QAAQ,EAAE;YACR,aAAa,EAAE,uBAAuB;YACtC,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,WAAW,EAAE,0HAA0H;YACvI,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,OAAO,CAAC,SAAS;YAC7C,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACjC,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,KAAK;YACL,UAAU,EAAE,EAAE;SACf;QACD,kBAAkB,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,UAAU,CAAC;QAClD,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -43,11 +43,20 @@
|
|
|
43
43
|
* outside the seven above — `waitFor` and `screenshot` are the desktop's
|
|
44
44
|
* own verbs with no `Scenario` counterpart at all.
|
|
45
45
|
*
|
|
46
|
-
* A step whose stored `text` is a secret reference (`${env:VAR}`)
|
|
47
|
-
*
|
|
48
|
-
* a plan is something about to
|
|
49
|
-
* reference would type its literal
|
|
50
|
-
* `secret-ref.ts`).
|
|
46
|
+
* A step whose stored `text` is a secret reference (`${env:VAR}`) or a
|
|
47
|
+
* credential reference (`${credential:NAME}`) is resolved before the plan
|
|
48
|
+
* is built, never carried through unresolved — a plan is something about to
|
|
49
|
+
* be driven, and driving an unresolved reference would type its literal
|
|
50
|
+
* characters into the page (see `secret-ref.ts`/`credential-ref.ts`). A
|
|
51
|
+
* `${credential:NAME}` is resolved against the `credentials` map a caller
|
|
52
|
+
* passes in — this module has no store of its own (RG-1/"signin": the
|
|
53
|
+
* desktop resolves names against its own App-configuration secret store, an
|
|
54
|
+
* MCP server against `Session.credentialStore`; the caller already knows
|
|
55
|
+
* which, and does the async lookup before calling this synchronous
|
|
56
|
+
* function — see `resolveEitherRef` for why the two schemes are resolved by
|
|
57
|
+
* the same two-step shape, name first, value second, everywhere else in
|
|
58
|
+
* this package). An unresolved reference — of either scheme — is reported
|
|
59
|
+
* as a refusal
|
|
51
60
|
* naming the step's action and index, not as a defect in the application.
|
|
52
61
|
*
|
|
53
62
|
* ## The round trip
|
|
@@ -111,8 +120,17 @@ export type ScenarioProjection = {
|
|
|
111
120
|
* same way `replayScenario` does — defaulted to `process.env` so every
|
|
112
121
|
* caller that does not inject one behaves like driving the browser
|
|
113
122
|
* directly, and injectable so a test never has to mutate the process.
|
|
123
|
+
*
|
|
124
|
+
* `credentials` resolves any `${credential:NAME}` text — a plain, already-resolved
|
|
125
|
+
* name-to-value map rather than a live `CredentialStoreLike`, because this function is
|
|
126
|
+
* synchronous and a real store's `retrieve()` is not: the caller (an MCP tool against
|
|
127
|
+
* `Session.credentialStore`, the desktop against its own App-configuration secret store)
|
|
128
|
+
* does the async lookup for every name `referencedCredentials` finds before calling this,
|
|
129
|
+
* the same "resolve, then build" order `resolveEitherRef` uses everywhere else in this
|
|
130
|
+
* package. Defaulted to `{}` — every caller before RG-1/"signin" passed none, and a
|
|
131
|
+
* scenario using only `${env:...}` behaves exactly as before.
|
|
114
132
|
*/
|
|
115
|
-
export declare function projectScenarioToRunPlan(scenario: Scenario, env?: SecretEnvironment): ScenarioProjection;
|
|
133
|
+
export declare function projectScenarioToRunPlan(scenario: Scenario, env?: SecretEnvironment, credentials?: Readonly<Record<string, string>>): ScenarioProjection;
|
|
116
134
|
/** A step as a producer that is not this module (the desktop's own `BrowserStep`, for instance) would hand it in — `kind` is a plain string so an unprojectable verb (`waitFor`, `screenshot`, ...) is refused by name at the boundary rather than rejected by the type system before it can be named. */
|
|
117
135
|
export interface RawProjectedStep {
|
|
118
136
|
readonly kind: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-run-plan-projection.d.ts","sourceRoot":"","sources":["../../src/scenarios/browser-run-plan-projection.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"browser-run-plan-projection.d.ts","sourceRoot":"","sources":["../../src/scenarios/browser-run-plan-projection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AAEH,OAAO,EAAqB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAE5E,OAAO,EAA2B,KAAK,QAAQ,EAA6C,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEzI,sIAAsI;AACtI,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,eAAe,GAAG,YAAY,CAAC;AAIrH;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACzC,uBAAuB;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,wKAAwK;IACxK,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,KAAK,GAAG,IAAI,CAAC;CAC7C;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;CAC1C;AAED,yGAAyG;AACzG,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CA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iBAAiB,CAAC;AAEpG;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAA;CAAE,EAAE,IAAI,EAAE,YAAY,GAAG,cAAc,CAkF7J"}
|
|
@@ -43,11 +43,20 @@
|
|
|
43
43
|
* outside the seven above — `waitFor` and `screenshot` are the desktop's
|
|
44
44
|
* own verbs with no `Scenario` counterpart at all.
|
|
45
45
|
*
|
|
46
|
-
* A step whose stored `text` is a secret reference (`${env:VAR}`)
|
|
47
|
-
*
|
|
48
|
-
* a plan is something about to
|
|
49
|
-
* reference would type its literal
|
|
50
|
-
* `secret-ref.ts`).
|
|
46
|
+
* A step whose stored `text` is a secret reference (`${env:VAR}`) or a
|
|
47
|
+
* credential reference (`${credential:NAME}`) is resolved before the plan
|
|
48
|
+
* is built, never carried through unresolved — a plan is something about to
|
|
49
|
+
* be driven, and driving an unresolved reference would type its literal
|
|
50
|
+
* characters into the page (see `secret-ref.ts`/`credential-ref.ts`). A
|
|
51
|
+
* `${credential:NAME}` is resolved against the `credentials` map a caller
|
|
52
|
+
* passes in — this module has no store of its own (RG-1/"signin": the
|
|
53
|
+
* desktop resolves names against its own App-configuration secret store, an
|
|
54
|
+
* MCP server against `Session.credentialStore`; the caller already knows
|
|
55
|
+
* which, and does the async lookup before calling this synchronous
|
|
56
|
+
* function — see `resolveEitherRef` for why the two schemes are resolved by
|
|
57
|
+
* the same two-step shape, name first, value second, everywhere else in
|
|
58
|
+
* this package). An unresolved reference — of either scheme — is reported
|
|
59
|
+
* as a refusal
|
|
51
60
|
* naming the step's action and index, not as a defect in the application.
|
|
52
61
|
*
|
|
53
62
|
* ## The round trip
|
|
@@ -63,6 +72,7 @@
|
|
|
63
72
|
* alone once both are the last things a plan does.
|
|
64
73
|
*/
|
|
65
74
|
import { resolveSecretText } from "./secret-ref.js";
|
|
75
|
+
import { readCredentialRef } from "./credential-ref.js";
|
|
66
76
|
import { SCENARIO_SCHEMA_VERSION } from "./scenario.js";
|
|
67
77
|
const PROJECTED_KINDS = ["navigate", "click", "type", "select", "submit", "assertVisible", "assertText"];
|
|
68
78
|
function refuse(verb, index, reason) {
|
|
@@ -73,14 +83,23 @@ function refuse(verb, index, reason) {
|
|
|
73
83
|
* same way `replayScenario` does — defaulted to `process.env` so every
|
|
74
84
|
* caller that does not inject one behaves like driving the browser
|
|
75
85
|
* directly, and injectable so a test never has to mutate the process.
|
|
86
|
+
*
|
|
87
|
+
* `credentials` resolves any `${credential:NAME}` text — a plain, already-resolved
|
|
88
|
+
* name-to-value map rather than a live `CredentialStoreLike`, because this function is
|
|
89
|
+
* synchronous and a real store's `retrieve()` is not: the caller (an MCP tool against
|
|
90
|
+
* `Session.credentialStore`, the desktop against its own App-configuration secret store)
|
|
91
|
+
* does the async lookup for every name `referencedCredentials` finds before calling this,
|
|
92
|
+
* the same "resolve, then build" order `resolveEitherRef` uses everywhere else in this
|
|
93
|
+
* package. Defaulted to `{}` — every caller before RG-1/"signin" passed none, and a
|
|
94
|
+
* scenario using only `${env:...}` behaves exactly as before.
|
|
76
95
|
*/
|
|
77
|
-
export function projectScenarioToRunPlan(scenario, env = process.env) {
|
|
96
|
+
export function projectScenarioToRunPlan(scenario, env = process.env, credentials = {}) {
|
|
78
97
|
// One pass builds the real-step projections, keyed by their scenario index,
|
|
79
98
|
// so assertions anchored at that index can be spliced in right after it —
|
|
80
99
|
// mirroring `replayScenario`'s own `evaluateAnchored(index, ...)` timing.
|
|
81
100
|
const realSteps = new Map();
|
|
82
101
|
for (const [index, step] of scenario.steps.entries()) {
|
|
83
|
-
const projected = projectStep(step, index, env);
|
|
102
|
+
const projected = projectStep(step, index, env, credentials);
|
|
84
103
|
if (!projected.ok)
|
|
85
104
|
return projected;
|
|
86
105
|
realSteps.set(index, projected.step);
|
|
@@ -108,7 +127,7 @@ export function projectScenarioToRunPlan(scenario, env = process.env) {
|
|
|
108
127
|
steps.push(...endAssertions);
|
|
109
128
|
return { ok: true, plan: { startUrl: scenario.targetUrl, steps } };
|
|
110
129
|
}
|
|
111
|
-
function projectStep(step, index, env) {
|
|
130
|
+
function projectStep(step, index, env, credentials) {
|
|
112
131
|
if (step.action === "fill") {
|
|
113
132
|
return refuse("fill", index, `step ${index}: "fill" has no counterpart in the driveable step vocabulary — that vocabulary has only "type", ` +
|
|
114
133
|
"which fires real keystrokes, while fill sets the value directly and fires none. Collapsing one into the " +
|
|
@@ -123,7 +142,24 @@ function projectStep(step, index, env) {
|
|
|
123
142
|
return refuse(step.action, index, `step ${index}: "${step.action}" acts on an element and carries no target to project.`);
|
|
124
143
|
}
|
|
125
144
|
if (step.action === "type" || step.action === "select") {
|
|
126
|
-
const
|
|
145
|
+
const raw = step.text ?? "";
|
|
146
|
+
// `${credential:NAME}` is this scheme's own shape and nothing else recognises it —
|
|
147
|
+
// checked first, exactly as `resolveEitherRef` orders the two, so a well-formed
|
|
148
|
+
// credential reference is never misreported as a malformed `${env:...}` one.
|
|
149
|
+
const credentialRef = readCredentialRef(raw);
|
|
150
|
+
if (credentialRef.kind === "ref") {
|
|
151
|
+
const value = credentials[credentialRef.name];
|
|
152
|
+
if (value === undefined || value === "") {
|
|
153
|
+
return refuse(step.action, index, `step ${index}: this step needs the credential "${credentialRef.name}", and nothing was resolved for ` +
|
|
154
|
+
"it. Nothing was typed and the projection stopped here: a step that types the literal text of its " +
|
|
155
|
+
"own reference would fail against the application and be reported as the application's defect.");
|
|
156
|
+
}
|
|
157
|
+
return { ok: true, step: { kind: step.action, target, url: null, text: value, anchor: null } };
|
|
158
|
+
}
|
|
159
|
+
if (credentialRef.kind === "malformed") {
|
|
160
|
+
return refuse(step.action, index, `step ${index}: ${credentialRef.message}`);
|
|
161
|
+
}
|
|
162
|
+
const resolved = resolveSecretText(raw, env);
|
|
127
163
|
if (!resolved.resolved)
|
|
128
164
|
return refuse(step.action, index, `step ${index}: ${resolved.reason}`);
|
|
129
165
|
return { ok: true, step: { kind: step.action, target, url: null, text: resolved.value, anchor: null } };
|