@trusty-squire/mcp 1.0.0 → 1.0.1-rc.1
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 +9 -15
- package/dist/bot/credential-text.d.ts +4 -0
- package/dist/bot/credential-text.d.ts.map +1 -0
- package/dist/bot/credential-text.js +297 -0
- package/dist/bot/credential-text.js.map +1 -0
- package/dist/bot/email-verification.d.ts +2 -0
- package/dist/bot/email-verification.d.ts.map +1 -0
- package/dist/bot/email-verification.js +47 -0
- package/dist/bot/email-verification.js.map +1 -0
- package/dist/bot/google-login.d.ts +1 -0
- package/dist/bot/google-login.d.ts.map +1 -1
- package/dist/bot/google-login.js +47 -2
- package/dist/bot/google-login.js.map +1 -1
- package/dist/bot/index.d.ts +0 -40
- package/dist/bot/index.d.ts.map +1 -1
- package/dist/bot/index.js +8 -156
- package/dist/bot/index.js.map +1 -1
- package/dist/bot/login-state.d.ts +2 -0
- package/dist/bot/login-state.d.ts.map +1 -1
- package/dist/bot/login-state.js +44 -0
- package/dist/bot/login-state.js.map +1 -1
- package/dist/bot/oauth-detect.d.ts +8 -0
- package/dist/bot/oauth-detect.d.ts.map +1 -0
- package/dist/bot/oauth-detect.js +329 -0
- package/dist/bot/oauth-detect.js.map +1 -0
- package/dist/bot/onboarding-capture.d.ts +1 -1
- package/dist/bot/onboarding-capture.d.ts.map +1 -1
- package/dist/bot/operator-recipe.d.ts +24 -24
- package/dist/bot/promote-to-skill.d.ts +1 -1
- package/dist/bot/promote-to-skill.d.ts.map +1 -1
- package/dist/bot/promote-to-skill.js +7 -5
- package/dist/bot/promote-to-skill.js.map +1 -1
- package/dist/bot/provision-session.d.ts +10 -0
- package/dist/bot/provision-session.d.ts.map +1 -1
- package/dist/bot/provision-session.js +126 -5
- package/dist/bot/provision-session.js.map +1 -1
- package/dist/bot/provision-types.d.ts +69 -0
- package/dist/bot/provision-types.d.ts.map +1 -0
- package/dist/bot/provision-types.js +9 -0
- package/dist/bot/provision-types.js.map +1 -0
- package/dist/bot/semantic-transition.d.ts +1 -1
- package/dist/bot/semantic-transition.d.ts.map +1 -1
- package/dist/skill-cli/cli.d.ts +1 -7
- package/dist/skill-cli/cli.d.ts.map +1 -1
- package/dist/skill-cli/cli.js +1 -69
- package/dist/skill-cli/cli.js.map +1 -1
- package/dist/tools/provision-drive.d.ts +48 -8
- package/dist/tools/provision-drive.d.ts.map +1 -1
- package/dist/tools/provision-drive.js +127 -2
- package/dist/tools/provision-drive.js.map +1 -1
- package/dist/tools/store-credential.d.ts +4 -4
- package/dist/tools/use-credential.d.ts +6 -6
- package/package.json +2 -6
- package/dist/bot/affordance-probe.d.ts +0 -15
- package/dist/bot/affordance-probe.d.ts.map +0 -1
- package/dist/bot/affordance-probe.js +0 -61
- package/dist/bot/affordance-probe.js.map +0 -1
- package/dist/bot/agent.d.ts +0 -449
- package/dist/bot/agent.d.ts.map +0 -1
- package/dist/bot/agent.js +0 -13634
- package/dist/bot/agent.js.map +0 -1
- package/dist/bot/debug.d.ts +0 -3
- package/dist/bot/debug.d.ts.map +0 -1
- package/dist/bot/debug.js +0 -35
- package/dist/bot/debug.js.map +0 -1
- package/dist/bot/email-code-fetcher.d.ts +0 -5
- package/dist/bot/email-code-fetcher.d.ts.map +0 -1
- package/dist/bot/email-code-fetcher.js +0 -33
- package/dist/bot/email-code-fetcher.js.map +0 -1
- package/dist/bot/flow-engine.d.ts +0 -7
- package/dist/bot/flow-engine.d.ts.map +0 -1
- package/dist/bot/flow-engine.js +0 -13
- package/dist/bot/flow-engine.js.map +0 -1
- package/dist/bot/form-fill.d.ts +0 -172
- package/dist/bot/form-fill.d.ts.map +0 -1
- package/dist/bot/form-fill.js +0 -444
- package/dist/bot/form-fill.js.map +0 -1
- package/dist/bot/inbox-client.d.ts +0 -45
- package/dist/bot/inbox-client.d.ts.map +0 -1
- package/dist/bot/inbox-client.js +0 -220
- package/dist/bot/inbox-client.js.map +0 -1
- package/dist/bot/llm-client.d.ts +0 -89
- package/dist/bot/llm-client.d.ts.map +0 -1
- package/dist/bot/llm-client.js +0 -493
- package/dist/bot/llm-client.js.map +0 -1
- package/dist/bot/nav-search.d.ts +0 -114
- package/dist/bot/nav-search.d.ts.map +0 -1
- package/dist/bot/nav-search.js +0 -670
- package/dist/bot/nav-search.js.map +0 -1
- package/dist/bot/notify-api.d.ts +0 -9
- package/dist/bot/notify-api.d.ts.map +0 -1
- package/dist/bot/notify-api.js +0 -49
- package/dist/bot/notify-api.js.map +0 -1
- package/dist/bot/oauth-flow.d.ts +0 -48
- package/dist/bot/oauth-flow.d.ts.map +0 -1
- package/dist/bot/oauth-flow.js +0 -111
- package/dist/bot/oauth-flow.js.map +0 -1
- package/dist/bot/observation-frame.d.ts +0 -16
- package/dist/bot/observation-frame.d.ts.map +0 -1
- package/dist/bot/observation-frame.js +0 -22
- package/dist/bot/observation-frame.js.map +0 -1
- package/dist/bot/post-signup-action-executor.d.ts +0 -53
- package/dist/bot/post-signup-action-executor.d.ts.map +0 -1
- package/dist/bot/post-signup-action-executor.js +0 -104
- package/dist/bot/post-signup-action-executor.js.map +0 -1
- package/dist/bot/post-signup-flow.d.ts +0 -51
- package/dist/bot/post-signup-flow.d.ts.map +0 -1
- package/dist/bot/post-signup-flow.js +0 -155
- package/dist/bot/post-signup-flow.js.map +0 -1
- package/dist/bot/post-signup-login-flow.d.ts +0 -28
- package/dist/bot/post-signup-login-flow.d.ts.map +0 -1
- package/dist/bot/post-signup-login-flow.js +0 -35
- package/dist/bot/post-signup-login-flow.js.map +0 -1
- package/dist/bot/post-signup-recovery-state.d.ts +0 -150
- package/dist/bot/post-signup-recovery-state.d.ts.map +0 -1
- package/dist/bot/post-signup-recovery-state.js +0 -253
- package/dist/bot/post-signup-recovery-state.js.map +0 -1
- package/dist/bot/post-signup-synthetic-capture.d.ts +0 -43
- package/dist/bot/post-signup-synthetic-capture.d.ts.map +0 -1
- package/dist/bot/post-signup-synthetic-capture.js +0 -84
- package/dist/bot/post-signup-synthetic-capture.js.map +0 -1
- package/dist/bot/prewarm-cache.d.ts +0 -3
- package/dist/bot/prewarm-cache.d.ts.map +0 -1
- package/dist/bot/prewarm-cache.js +0 -91
- package/dist/bot/prewarm-cache.js.map +0 -1
- package/dist/bot/read-otp.d.ts +0 -21
- package/dist/bot/read-otp.d.ts.map +0 -1
- package/dist/bot/read-otp.js +0 -170
- package/dist/bot/read-otp.js.map +0 -1
- package/dist/bot/redact.d.ts +0 -3
- package/dist/bot/redact.d.ts.map +0 -1
- package/dist/bot/redact.js +0 -132
- package/dist/bot/redact.js.map +0 -1
- package/dist/bot/rejection-record.d.ts +0 -70
- package/dist/bot/rejection-record.d.ts.map +0 -1
- package/dist/bot/rejection-record.js +0 -76
- package/dist/bot/rejection-record.js.map +0 -1
- package/dist/bot/replay-skill.d.ts +0 -180
- package/dist/bot/replay-skill.d.ts.map +0 -1
- package/dist/bot/replay-skill.js +0 -4361
- package/dist/bot/replay-skill.js.map +0 -1
- package/dist/bot/signup-lock.d.ts +0 -17
- package/dist/bot/signup-lock.d.ts.map +0 -1
- package/dist/bot/signup-lock.js +0 -174
- package/dist/bot/signup-lock.js.map +0 -1
- package/dist/bot/signup-oauth-flow.d.ts +0 -16
- package/dist/bot/signup-oauth-flow.d.ts.map +0 -1
- package/dist/bot/signup-oauth-flow.js +0 -31
- package/dist/bot/signup-oauth-flow.js.map +0 -1
- package/dist/bot/state-classifier.d.ts +0 -18
- package/dist/bot/state-classifier.d.ts.map +0 -1
- package/dist/bot/state-classifier.js +0 -127
- package/dist/bot/state-classifier.js.map +0 -1
- package/dist/bot/terminal-gate.d.ts +0 -22
- package/dist/bot/terminal-gate.d.ts.map +0 -1
- package/dist/bot/terminal-gate.js +0 -184
- package/dist/bot/terminal-gate.js.map +0 -1
- package/dist/bot/unwinnable-services.d.ts +0 -7
- package/dist/bot/unwinnable-services.d.ts.map +0 -1
- package/dist/bot/unwinnable-services.js +0 -69
- package/dist/bot/unwinnable-services.js.map +0 -1
- package/dist/data/service-categories.d.ts +0 -11
- package/dist/data/service-categories.d.ts.map +0 -1
- package/dist/data/service-categories.js +0 -149
- package/dist/data/service-categories.js.map +0 -1
- package/dist/provision-run.d.ts +0 -45
- package/dist/provision-run.d.ts.map +0 -1
- package/dist/provision-run.js +0 -99
- package/dist/provision-run.js.map +0 -1
- package/dist/tools/provision-any.d.ts +0 -207
- package/dist/tools/provision-any.d.ts.map +0 -1
- package/dist/tools/provision-any.js +0 -1519
- package/dist/tools/provision-any.js.map +0 -1
- package/dist/tools/signup-telemetry.d.ts +0 -38
- package/dist/tools/signup-telemetry.d.ts.map +0 -1
- package/dist/tools/signup-telemetry.js +0 -103
- package/dist/tools/signup-telemetry.js.map +0 -1
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { PromoteRejection } from "./promote-to-skill.js";
|
|
2
|
-
export interface WriteRejectionInput {
|
|
3
|
-
/** The structured rejection from the synthesizer. */
|
|
4
|
-
rejection: PromoteRejection;
|
|
5
|
-
/** Where the original captures lived. Used to copy them as evidence. */
|
|
6
|
-
captureDir: string;
|
|
7
|
-
/** Canonical service slug. */
|
|
8
|
-
service: string;
|
|
9
|
-
/** Which run produced this rejection. */
|
|
10
|
-
runId: string;
|
|
11
|
-
/**
|
|
12
|
-
* Root of the `corpus/skills-failed/` directory. Default:
|
|
13
|
-
* `~/.trusty-squire/corpus/skills-failed/`. Override for tests or
|
|
14
|
-
* non-standard installs.
|
|
15
|
-
*/
|
|
16
|
-
failedRoot: string;
|
|
17
|
-
/** Wall-clock for the rejection's `rejected_at` timestamp. */
|
|
18
|
-
now: Date;
|
|
19
|
-
}
|
|
20
|
-
export interface WriteRejectionResult {
|
|
21
|
-
/** Absolute path to the rejection directory. */
|
|
22
|
-
rejectionDir: string;
|
|
23
|
-
/** Absolute path to the rejection.json file. */
|
|
24
|
-
rejectionFile: string;
|
|
25
|
-
/** Absolute path to the captures/ subdirectory (may be empty). */
|
|
26
|
-
capturesDir: string;
|
|
27
|
-
/** Number of capture files copied as evidence. */
|
|
28
|
-
capturesCopied: number;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* The shape written to rejection.json. Strictly serialisable —
|
|
32
|
-
* everything in the file is a string, number, or null. Schema for
|
|
33
|
-
* parsing this back lives in the same place as the writer (here)
|
|
34
|
-
* so changes are colocated.
|
|
35
|
-
*
|
|
36
|
-
* Versioned (rejection_format_version) so future CLI commands can
|
|
37
|
-
* detect older rejection files and offer migration instead of failing
|
|
38
|
-
* silently.
|
|
39
|
-
*/
|
|
40
|
-
export interface RejectionFile {
|
|
41
|
-
rejection_format_version: 1;
|
|
42
|
-
rejected_at: string;
|
|
43
|
-
service: string;
|
|
44
|
-
run_id: string;
|
|
45
|
-
stage: PromoteRejection["stage"];
|
|
46
|
-
error_kind: PromoteRejection["error_kind"];
|
|
47
|
-
message: string;
|
|
48
|
-
offending_round: number | null;
|
|
49
|
-
offending_step: number | null;
|
|
50
|
-
detail: string | null;
|
|
51
|
-
synthesizer_version: number;
|
|
52
|
-
capture_evidence: {
|
|
53
|
-
/** Number of capture files preserved alongside this rejection. */
|
|
54
|
-
rounds_copied: number;
|
|
55
|
-
/** Filename prefix used when looking up captures (`<slug>-<runId>`). */
|
|
56
|
-
capture_prefix: string;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Persist a synthesizer rejection to disk. Creates the rejection
|
|
61
|
-
* directory under `failedRoot`, writes `rejection.json`, and copies
|
|
62
|
-
* any matching capture files into `captures/` as evidence.
|
|
63
|
-
*
|
|
64
|
-
* Returns paths so the CLI can echo them. Throws only on real I/O
|
|
65
|
-
* failures (parent dir unwritable, disk full); a missing capture
|
|
66
|
-
* directory is logged inside the rejection record itself rather than
|
|
67
|
-
* blocking the write.
|
|
68
|
-
*/
|
|
69
|
-
export declare function writeRejection(input: WriteRejectionInput): WriteRejectionResult;
|
|
70
|
-
//# sourceMappingURL=rejection-record.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rejection-record.d.ts","sourceRoot":"","sources":["../../src/bot/rejection-record.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,MAAM,WAAW,mBAAmB;IAClC,qDAAqD;IACrD,SAAS,EAAE,gBAAgB,CAAC;IAC5B,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,GAAG,EAAE,IAAI,CAAC;CACX;AAED,MAAM,WAAW,oBAAoB;IACnC,gDAAgD;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,aAAa,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B,wBAAwB,EAAE,CAAC,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACjC,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gBAAgB,EAAE;QAChB,kEAAkE;QAClE,aAAa,EAAE,MAAM,CAAC;QACtB,wEAAwE;QACxE,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,oBAAoB,CAqD/E"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// rejection-record.ts — write structured rejection records to
|
|
2
|
-
// `corpus/skills-failed/<id>/rejection.json` (T9 / D2).
|
|
3
|
-
//
|
|
4
|
-
// The synthesizer (promote-to-skill.ts) returns structured rejections;
|
|
5
|
-
// the CLI persists them so an operator can triage what went wrong
|
|
6
|
-
// without staring at promoter exit codes. Each failed promote produces
|
|
7
|
-
// one directory containing:
|
|
8
|
-
//
|
|
9
|
-
// rejection.json — the rejection itself, parseable
|
|
10
|
-
// captures/ — copies of the offending capture files (when
|
|
11
|
-
// available; an unreadable directory rejection
|
|
12
|
-
// has no captures to copy)
|
|
13
|
-
//
|
|
14
|
-
// Inputs and outputs are both filesystem-level so this module is
|
|
15
|
-
// thin glue, not load-bearing logic. The synthesizer remains a pure
|
|
16
|
-
// function; nothing here imports it directly.
|
|
17
|
-
import { copyFileSync, existsSync, mkdirSync, readdirSync, writeFileSync } from "node:fs";
|
|
18
|
-
import { join } from "node:path";
|
|
19
|
-
/**
|
|
20
|
-
* Persist a synthesizer rejection to disk. Creates the rejection
|
|
21
|
-
* directory under `failedRoot`, writes `rejection.json`, and copies
|
|
22
|
-
* any matching capture files into `captures/` as evidence.
|
|
23
|
-
*
|
|
24
|
-
* Returns paths so the CLI can echo them. Throws only on real I/O
|
|
25
|
-
* failures (parent dir unwritable, disk full); a missing capture
|
|
26
|
-
* directory is logged inside the rejection record itself rather than
|
|
27
|
-
* blocking the write.
|
|
28
|
-
*/
|
|
29
|
-
export function writeRejection(input) {
|
|
30
|
-
const { rejection, captureDir, service, runId, failedRoot, now } = input;
|
|
31
|
-
const slug = service.toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
32
|
-
const rejectionId = `${slug}-${runId}-${now.getTime().toString(36)}`;
|
|
33
|
-
const rejectionDir = join(failedRoot, rejectionId);
|
|
34
|
-
const capturesDir = join(rejectionDir, "captures");
|
|
35
|
-
const rejectionFile = join(rejectionDir, "rejection.json");
|
|
36
|
-
mkdirSync(capturesDir, { recursive: true });
|
|
37
|
-
// Copy captures as evidence. Best-effort: if the capture dir is
|
|
38
|
-
// unreadable (already gone, permissions, etc.) we skip the copy and
|
|
39
|
-
// record 0 rounds. The rejection itself is still useful — it
|
|
40
|
-
// carries the synthesizer's own analysis of what went wrong.
|
|
41
|
-
let capturesCopied = 0;
|
|
42
|
-
const prefix = `${slug}-${runId}-r`;
|
|
43
|
-
try {
|
|
44
|
-
if (existsSync(captureDir)) {
|
|
45
|
-
const files = readdirSync(captureDir).filter((f) => f.startsWith(prefix) && f.endsWith(".json"));
|
|
46
|
-
for (const file of files) {
|
|
47
|
-
copyFileSync(join(captureDir, file), join(capturesDir, file));
|
|
48
|
-
capturesCopied += 1;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
catch {
|
|
53
|
-
// Swallow — capture copy is evidence, not load-bearing. The
|
|
54
|
-
// rejection record gets written either way.
|
|
55
|
-
}
|
|
56
|
-
const payload = {
|
|
57
|
-
rejection_format_version: 1,
|
|
58
|
-
rejected_at: now.toISOString(),
|
|
59
|
-
service,
|
|
60
|
-
run_id: runId,
|
|
61
|
-
stage: rejection.stage,
|
|
62
|
-
error_kind: rejection.error_kind,
|
|
63
|
-
message: rejection.message,
|
|
64
|
-
offending_round: rejection.offending_round ?? null,
|
|
65
|
-
offending_step: rejection.offending_step ?? null,
|
|
66
|
-
detail: rejection.detail ?? null,
|
|
67
|
-
synthesizer_version: rejection.synthesizer_version,
|
|
68
|
-
capture_evidence: {
|
|
69
|
-
rounds_copied: capturesCopied,
|
|
70
|
-
capture_prefix: prefix,
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
writeFileSync(rejectionFile, JSON.stringify(payload, null, 2));
|
|
74
|
-
return { rejectionDir, rejectionFile, capturesDir, capturesCopied };
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=rejection-record.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rejection-record.js","sourceRoot":"","sources":["../../src/bot/rejection-record.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,wDAAwD;AACxD,EAAE;AACF,uEAAuE;AACvE,kEAAkE;AAClE,uEAAuE;AACvE,4BAA4B;AAC5B,EAAE;AACF,qDAAqD;AACrD,iEAAiE;AACjE,kEAAkE;AAClE,8CAA8C;AAC9C,EAAE;AACF,iEAAiE;AACjE,oEAAoE;AACpE,8CAA8C;AAE9C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1F,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AA+DjC;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;IAEzE,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;IAC/D,MAAM,WAAW,GAAG,GAAG,IAAI,IAAI,KAAK,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;IACrE,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IACnD,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACnD,MAAM,aAAa,GAAG,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;IAE3D,SAAS,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE5C,gEAAgE;IAChE,oEAAoE;IACpE,6DAA6D;IAC7D,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,CAAC,CAAC,CAAC,CAAC;IAE/D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;AACtE,CAAC"}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import type { Skill, SkillStep } from "@trusty-squire/skill-schema";
|
|
2
|
-
import type { BrowserController, InteractiveElement } from "./browser.js";
|
|
3
|
-
import { type OAuthProviderId } from "./oauth-providers.js";
|
|
4
|
-
export interface ReplayInput {
|
|
5
|
-
/** The Skill record to replay. Already-verified signed manifest. */
|
|
6
|
-
skill: Skill;
|
|
7
|
-
/** Live browser the replay drives. Must be started + ready. */
|
|
8
|
-
browser: BrowserController;
|
|
9
|
-
/**
|
|
10
|
-
* Replay mode. `dry` walks every step except the credential-creating
|
|
11
|
-
* click (the last click before extract); `full` executes the entire
|
|
12
|
-
* graph. Default: `dry`.
|
|
13
|
-
*/
|
|
14
|
-
mode?: "dry" | "full";
|
|
15
|
-
/**
|
|
16
|
-
* Per-step planner fallback. Called when a step's pre-validation
|
|
17
|
-
* fails. Receives the captured step + the current inventory + a
|
|
18
|
-
* reason. Should return either a substitute step the replay engine
|
|
19
|
-
* can execute, or null to signal "give up". The caller (router)
|
|
20
|
-
* usually wires this to the bot's existing planSignupForm / similar.
|
|
21
|
-
*/
|
|
22
|
-
llmFallback?: (input: LLMFallbackInput) => Promise<SkillStep | null>;
|
|
23
|
-
/**
|
|
24
|
-
* Where to write skill-update-candidates. When provided AND the
|
|
25
|
-
* llmFallback produces a different step than the captured one, the
|
|
26
|
-
* substitute is appended to `<dir>/<service>-<skill_id>-candidates.jsonl`.
|
|
27
|
-
* When absent (default), no write occurs — useful for the router
|
|
28
|
-
* which doesn't always want to accumulate candidates.
|
|
29
|
-
*/
|
|
30
|
-
candidatesDir?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Runtime values for `${TEMPLATE}` substitution in fill steps. Keys
|
|
33
|
-
* are uppercase (TOKEN_NAME, USER_DISPLAY_NAME, EMAIL_ALIAS,
|
|
34
|
-
* PROJECT_NAME). Missing keys fall back to the literal template
|
|
35
|
-
* string — the replay engine doesn't reject, but the resulting fill
|
|
36
|
-
* is probably wrong.
|
|
37
|
-
*/
|
|
38
|
-
templateValues?: Record<string, string>;
|
|
39
|
-
/**
|
|
40
|
-
* Override the global `fetch` used for the sentinel HTTP check
|
|
41
|
-
* (C5). Production leaves this undefined (uses globalThis.fetch).
|
|
42
|
-
* Tests inject a mock to avoid real network. Skills without a
|
|
43
|
-
* sentinel_http_check configured never invoke this.
|
|
44
|
-
*/
|
|
45
|
-
fetchFn?: typeof globalThis.fetch;
|
|
46
|
-
/**
|
|
47
|
-
* Fetches the email verification code for an `await_email_code` step.
|
|
48
|
-
* The replay engine has no inbox transport of its own (same separation
|
|
49
|
-
* as `llmFallback` / `templateValues`): the caller — verify mode or the
|
|
50
|
-
* live-provision router — wires this to an InboxClient poll + code
|
|
51
|
-
* extraction against the run's alias (`templateValues.EMAIL_ALIAS`).
|
|
52
|
-
* Resolves to the code, or null when no verification email arrived in
|
|
53
|
-
* time. A skill containing an `await_email_code` step that is replayed
|
|
54
|
-
* WITHOUT this callback fails that step cleanly (the caller forgot to
|
|
55
|
-
* provide inbox access).
|
|
56
|
-
*/
|
|
57
|
-
fetchEmailCode?: (input: {
|
|
58
|
-
alias: string;
|
|
59
|
-
}) => Promise<string | null>;
|
|
60
|
-
/**
|
|
61
|
-
* Drives an interactive provider sign-in when the OAuth walk lands on a
|
|
62
|
-
* login/identifier page instead of a chooser/consent. Replay otherwise bails
|
|
63
|
-
* `needs_login` here — but the full discover bot would just type the
|
|
64
|
-
* password, and a freshly-created robot account lands on the identifier page
|
|
65
|
-
* the first time a given relying party requests OAuth even with a live
|
|
66
|
-
* session. The verifier wires this to the robot's credentials
|
|
67
|
-
* (verify-passwords.json) + `browser.loginGoogleInline`; the live-user
|
|
68
|
-
* router omits it (no stored end-user password to drive). Resolves true when
|
|
69
|
-
* the sign-in progressed (walk continues), false to fall through to the
|
|
70
|
-
* existing needs_login bail. Same caller-injected-transport separation as
|
|
71
|
-
* `fetchEmailCode`.
|
|
72
|
-
*/
|
|
73
|
-
driveOAuthLogin?: (provider: OAuthProviderId) => Promise<boolean>;
|
|
74
|
-
/**
|
|
75
|
-
* Chrome profile whose OAuth-session marker should be trusted for
|
|
76
|
-
* replay-time provider checks. Fresh-identity verifier replays pass the
|
|
77
|
-
* robot profile; normal router replays omit this and use the default profile.
|
|
78
|
-
*/
|
|
79
|
-
profileDir?: string;
|
|
80
|
-
/**
|
|
81
|
-
* Preferred provider for replay-time OAuth recovery when a navigate step
|
|
82
|
-
* drifts to a login page and the stored skill has no explicit
|
|
83
|
-
* click_oauth_button step. Captured click_oauth_button steps remain
|
|
84
|
-
* authoritative; this only orders recovery candidates for legacy/post-auth
|
|
85
|
-
* skills whose provider metadata was inferred outside the step graph.
|
|
86
|
-
*/
|
|
87
|
-
preferredOAuthProvider?: OAuthProviderId;
|
|
88
|
-
/**
|
|
89
|
-
* Optional caller-visible diagnostics sink. The router wires this to
|
|
90
|
-
* check_provision_status recent_steps so returning-user skips and stale-route
|
|
91
|
-
* fallbacks are visible to the host agent instead of only stderr.
|
|
92
|
-
*/
|
|
93
|
-
log?: (message: string) => void;
|
|
94
|
-
/**
|
|
95
|
-
* 0.8.2-rc.19 — bypass the "skill must be active" guard. The verifier
|
|
96
|
-
* loop NEEDS to replay pending-review skills (and sometimes demoted
|
|
97
|
-
* ones) to gather the outcome data that drives promote/demote
|
|
98
|
-
* transitions; without this flag, the loop is dead-on-arrival.
|
|
99
|
-
*
|
|
100
|
-
* `superseded` is still rejected even with bypass — that status
|
|
101
|
-
* means a newer version is the canonical one; replaying the older
|
|
102
|
-
* one is wasted effort.
|
|
103
|
-
*
|
|
104
|
-
* Default: false. Router (live-user provision) MUST leave it false.
|
|
105
|
-
*/
|
|
106
|
-
bypassStatusGuard?: boolean;
|
|
107
|
-
}
|
|
108
|
-
export interface LLMFallbackInput {
|
|
109
|
-
/** The Skill step whose pre-validation failed. */
|
|
110
|
-
capturedStep: SkillStep;
|
|
111
|
-
/** Why pre-validation failed (human-readable). */
|
|
112
|
-
reason: string;
|
|
113
|
-
/** The page's current inventory. */
|
|
114
|
-
inventory: readonly InteractiveElement[];
|
|
115
|
-
/** Step index within the skill's `steps` array. */
|
|
116
|
-
stepIndex: number;
|
|
117
|
-
/** The full skill for context (provider may want service name). */
|
|
118
|
-
skill: Skill;
|
|
119
|
-
}
|
|
120
|
-
export type ReplayOutcome = {
|
|
121
|
-
kind: "ok";
|
|
122
|
-
credential: string;
|
|
123
|
-
via: "copy_button" | "regex" | "dry_skipped";
|
|
124
|
-
} | {
|
|
125
|
-
kind: "ok_multi";
|
|
126
|
-
credentials: Record<string, string>;
|
|
127
|
-
via: Record<string, "copy_button" | "regex" | "labeled">;
|
|
128
|
-
} | {
|
|
129
|
-
kind: "step_failed";
|
|
130
|
-
stepIndex: number;
|
|
131
|
-
reason: string;
|
|
132
|
-
capturedStep: SkillStep;
|
|
133
|
-
} | {
|
|
134
|
-
kind: "validator_failed";
|
|
135
|
-
stepIndex: number;
|
|
136
|
-
got: string;
|
|
137
|
-
reason: string;
|
|
138
|
-
} | {
|
|
139
|
-
kind: "extraction_failed";
|
|
140
|
-
stepIndex: number;
|
|
141
|
-
reason: string;
|
|
142
|
-
} | {
|
|
143
|
-
kind: "needs_login";
|
|
144
|
-
provider: "google" | "github";
|
|
145
|
-
stepIndex: number;
|
|
146
|
-
afterOAuth: boolean;
|
|
147
|
-
} | {
|
|
148
|
-
kind: "skill_demoted";
|
|
149
|
-
reason: string;
|
|
150
|
-
} | {
|
|
151
|
-
kind: "dry_pass";
|
|
152
|
-
stepsWalked: number;
|
|
153
|
-
};
|
|
154
|
-
export declare function revealPollMs(): number;
|
|
155
|
-
export declare function replaySkill(input: ReplayInput): Promise<ReplayOutcome>;
|
|
156
|
-
export declare function labelMatchesHint(label: string | null, hint: string): boolean;
|
|
157
|
-
export declare function normalizeNavPath(path: string): string[];
|
|
158
|
-
export declare function matchesDomHint(el: InteractiveElement, hint: {
|
|
159
|
-
name?: string | undefined;
|
|
160
|
-
id?: string | undefined;
|
|
161
|
-
testid?: string | undefined;
|
|
162
|
-
}): boolean;
|
|
163
|
-
export declare function matchesHrefHint(el: InteractiveElement, hrefHint: string): boolean;
|
|
164
|
-
export declare function rebaseHrefOntoCurrentUrl(hrefHint: string, currentUrl: string): string | null;
|
|
165
|
-
export declare function rebaseScopedHrefWithCandidate(hrefHint: string, currentUrl: string, candidate: string): string | null;
|
|
166
|
-
export declare function codeInputCandidates(inventory: readonly InteractiveElement[]): InteractiveElement[];
|
|
167
|
-
export declare function fixupOtpDistribution(browser: BrowserController, code: string, otpPageUrl: string): Promise<void>;
|
|
168
|
-
export declare function findCodeInput(inventory: readonly InteractiveElement[], labelHint?: string): InteractiveElement | null;
|
|
169
|
-
export declare function resolveReplayRecoveryEntryUrl(skill: Skill): string;
|
|
170
|
-
export declare function resolveReplayRecoveryTargetUrl(skill: Skill, targetUrl: string): string;
|
|
171
|
-
export declare function detectNavigationDrift(currentUrl: string, expectedUrl: string): string | null;
|
|
172
|
-
export declare function registrableDomain(hostname: string): string;
|
|
173
|
-
export declare function rebaseSubdomain(capturedUrl: string, liveUrl: string): string;
|
|
174
|
-
export declare function normalizeKindeReplayNavigateUrl(url: string): string;
|
|
175
|
-
export declare function stripVolatileIdentityParams(rawUrl: string): string;
|
|
176
|
-
export declare function settledOnProductPage(currentUrl: string, expectedHost: string): boolean;
|
|
177
|
-
export declare function pathHasOpaqueResourceId(path: string): boolean;
|
|
178
|
-
export declare function inferProviderFromUrl(url: string): "google" | "github" | null;
|
|
179
|
-
export declare function walkOAuthConsent(browser: BrowserController, providerId: OAuthProviderId, driveOAuthLogin?: (provider: OAuthProviderId) => Promise<boolean>): Promise<"ok" | "needs_login">;
|
|
180
|
-
//# sourceMappingURL=replay-skill.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"replay-skill.d.ts","source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