@jevitate/cli 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-cli.d.ts +3 -1
- package/dist/ai-cli.js +60 -16
- package/dist/ai-cli.js.map +1 -1
- package/dist/approval-provenance.d.ts +136 -0
- package/dist/approval-provenance.js +317 -0
- package/dist/approval-provenance.js.map +1 -0
- package/dist/author-journey-cli.js +4 -2
- package/dist/author-journey-cli.js.map +1 -1
- package/dist/bin.js +30544 -20851
- package/dist/browser-cli.d.ts +10 -0
- package/dist/browser-cli.js +50 -0
- package/dist/browser-cli.js.map +1 -0
- package/dist/build-info.generated.js +2 -2
- package/dist/builtin-analyzers.d.ts +7 -0
- package/dist/builtin-analyzers.js +19 -0
- package/dist/builtin-analyzers.js.map +1 -0
- package/dist/campaign-cli.d.ts +6 -0
- package/dist/campaign-cli.js +9 -4
- package/dist/campaign-cli.js.map +1 -1
- package/dist/catalog-analysis.d.ts +70 -0
- package/dist/catalog-analysis.js +507 -0
- package/dist/catalog-analysis.js.map +1 -0
- package/dist/catalog-api.d.ts +73 -0
- package/dist/catalog-api.js +97 -0
- package/dist/catalog-api.js.map +1 -0
- package/dist/catalog-cli.d.ts +12 -0
- package/dist/catalog-cli.js +224 -0
- package/dist/catalog-cli.js.map +1 -0
- package/dist/catalog-review.d.ts +29 -0
- package/dist/catalog-review.js +290 -0
- package/dist/catalog-review.js.map +1 -0
- package/dist/catalog.d.ts +133 -0
- package/dist/catalog.js +352 -0
- package/dist/catalog.js.map +1 -0
- package/dist/change-context.d.ts +44 -0
- package/dist/change-context.js +203 -0
- package/dist/change-context.js.map +1 -0
- package/dist/check-api.d.ts +1 -1
- package/dist/check-api.js +68 -9
- package/dist/check-api.js.map +1 -1
- package/dist/check-cli.d.ts +5 -1
- package/dist/check-cli.js +64 -10
- package/dist/check-cli.js.map +1 -1
- package/dist/check-execute.d.ts +16 -1
- package/dist/check-execute.js +78 -31
- package/dist/check-execute.js.map +1 -1
- package/dist/check-plan.d.ts +14 -0
- package/dist/check-plan.js +28 -2
- package/dist/check-plan.js.map +1 -1
- package/dist/check-suite.js +6 -3
- package/dist/check-suite.js.map +1 -1
- package/dist/check-types.d.ts +51 -6
- package/dist/check-types.js +8 -0
- package/dist/check-types.js.map +1 -1
- package/dist/cli-output.js +85 -5
- package/dist/cli-output.js.map +1 -1
- package/dist/cli-shared.d.ts +22 -2
- package/dist/cli-shared.js +34 -5
- package/dist/cli-shared.js.map +1 -1
- package/dist/demo-aspect-api.d.ts +15 -0
- package/dist/demo-aspect-api.js +26 -1
- package/dist/demo-aspect-api.js.map +1 -1
- package/dist/demo-aspect-cli.js +64 -5
- package/dist/demo-aspect-cli.js.map +1 -1
- package/dist/exit-codes.d.ts +6 -3
- package/dist/exit-codes.js +13 -3
- package/dist/exit-codes.js.map +1 -1
- package/dist/explore-adversarial.d.ts +3 -1
- package/dist/explore-adversarial.js +4 -4
- package/dist/explore-adversarial.js.map +1 -1
- package/dist/explore-author.js +5 -2
- package/dist/explore-author.js.map +1 -1
- package/dist/explore-cli.js +145 -9
- package/dist/explore-cli.js.map +1 -1
- package/dist/explore-coverage.d.ts +6 -2
- package/dist/explore-coverage.js +7 -6
- package/dist/explore-coverage.js.map +1 -1
- package/dist/explore-feature.d.ts +3 -1
- package/dist/explore-feature.js +5 -5
- package/dist/explore-feature.js.map +1 -1
- package/dist/explore-goal.d.ts +37 -6
- package/dist/explore-goal.js +69 -50
- package/dist/explore-goal.js.map +1 -1
- package/dist/explore-shared.d.ts +12 -7
- package/dist/explore-shared.js +9 -1
- package/dist/explore-shared.js.map +1 -1
- package/dist/findings-filing.d.ts +6 -0
- package/dist/findings-filing.js +15 -1
- package/dist/findings-filing.js.map +1 -1
- package/dist/goal-run-flags.d.ts +2 -0
- package/dist/goal-run-flags.js +8 -1
- package/dist/goal-run-flags.js.map +1 -1
- package/dist/heal-probe-guard.d.ts +9 -0
- package/dist/heal-probe-guard.js +113 -0
- package/dist/heal-probe-guard.js.map +1 -0
- package/dist/host-health-run.d.ts +32 -1
- package/dist/host-health-run.js +38 -1
- package/dist/host-health-run.js.map +1 -1
- package/dist/http-5xx-outcome.d.ts +8 -3
- package/dist/http-5xx-outcome.js +5 -15
- package/dist/http-5xx-outcome.js.map +1 -1
- package/dist/init-cli.d.ts +7 -0
- package/dist/init-cli.js +79 -9
- package/dist/init-cli.js.map +1 -1
- package/dist/init-codeowners.d.ts +39 -0
- package/dist/init-codeowners.js +91 -0
- package/dist/init-codeowners.js.map +1 -0
- package/dist/init-keys.d.ts +3 -1
- package/dist/init-keys.js +20 -8
- package/dist/init-keys.js.map +1 -1
- package/dist/init-skills.d.ts +85 -7
- package/dist/init-skills.js +303 -36
- package/dist/init-skills.js.map +1 -1
- package/dist/jev-advisor.d.ts +72 -0
- package/dist/jev-advisor.js +172 -0
- package/dist/jev-advisor.js.map +1 -0
- package/dist/journey-api.d.ts +76 -5
- package/dist/journey-api.js +238 -29
- package/dist/journey-api.js.map +1 -1
- package/dist/journey-cli.js +257 -23
- package/dist/journey-cli.js.map +1 -1
- package/dist/journey-heal.d.ts +74 -0
- package/dist/journey-heal.js +180 -0
- package/dist/journey-heal.js.map +1 -0
- package/dist/journey-network-checks.d.ts +5 -1
- package/dist/journey-network-checks.js +15 -4
- package/dist/journey-network-checks.js.map +1 -1
- package/dist/journey-prefix.js +2 -2
- package/dist/journey-prefix.js.map +1 -1
- package/dist/journey-proposal-store.d.ts +100 -0
- package/dist/journey-proposal-store.js +342 -0
- package/dist/journey-proposal-store.js.map +1 -0
- package/dist/journey-result-record.d.ts +40 -0
- package/dist/journey-result-record.js +28 -0
- package/dist/journey-result-record.js.map +1 -0
- package/dist/journey-review-api.d.ts +19 -0
- package/dist/journey-review-api.js +53 -0
- package/dist/journey-review-api.js.map +1 -0
- package/dist/journey-review-store.d.ts +16 -0
- package/dist/journey-review-store.js +95 -0
- package/dist/journey-review-store.js.map +1 -0
- package/dist/journey-review.d.ts +54 -0
- package/dist/journey-review.js +538 -0
- package/dist/journey-review.js.map +1 -0
- package/dist/journey-verify.js +14 -1
- package/dist/journey-verify.js.map +1 -1
- package/dist/key-report.d.ts +20 -5
- package/dist/key-report.js +32 -9
- package/dist/key-report.js.map +1 -1
- package/dist/kill-signal.js +10 -2
- package/dist/kill-signal.js.map +1 -1
- package/dist/launch-armed.js +5 -1
- package/dist/launch-armed.js.map +1 -1
- package/dist/load-cli.js +4 -2
- package/dist/load-cli.js.map +1 -1
- package/dist/log-classes.d.ts +73 -0
- package/dist/log-classes.js +167 -0
- package/dist/log-classes.js.map +1 -0
- package/dist/log-correlation.d.ts +29 -10
- package/dist/log-correlation.js +44 -21
- package/dist/log-correlation.js.map +1 -1
- package/dist/login-cli.d.ts +17 -0
- package/dist/login-cli.js +161 -0
- package/dist/login-cli.js.map +1 -0
- package/dist/logs-cli.js +3 -1
- package/dist/logs-cli.js.map +1 -1
- package/dist/mcp-api.d.ts +6 -1
- package/dist/mcp-api.js +110 -16
- package/dist/mcp-api.js.map +1 -1
- package/dist/mcp-cli-runner.d.ts +2 -0
- package/dist/mcp-cli-runner.js +3 -1
- package/dist/mcp-cli-runner.js.map +1 -1
- package/dist/mcp-cli-tools.d.ts +5 -0
- package/dist/mcp-cli-tools.js +178 -23
- package/dist/mcp-cli-tools.js.map +1 -1
- package/dist/mission-cli.js +8 -4
- package/dist/mission-cli.js.map +1 -1
- package/dist/mission-journal.d.ts +4 -1
- package/dist/mission-journal.js +9 -3
- package/dist/mission-journal.js.map +1 -1
- package/dist/mission-queue-cli.js +21 -2
- package/dist/mission-queue-cli.js.map +1 -1
- package/dist/mission-queue-runner.d.ts +6 -0
- package/dist/mission-queue-runner.js +33 -3
- package/dist/mission-queue-runner.js.map +1 -1
- package/dist/multi-run-cli.d.ts +7 -1
- package/dist/multi-run-cli.js +10 -3
- package/dist/multi-run-cli.js.map +1 -1
- package/dist/multi-run.d.ts +44 -8
- package/dist/multi-run.js +118 -25
- package/dist/multi-run.js.map +1 -1
- package/dist/persona-login.d.ts +256 -0
- package/dist/persona-login.js +884 -0
- package/dist/persona-login.js.map +1 -0
- package/dist/pre-approval.d.ts +98 -0
- package/dist/pre-approval.js +175 -0
- package/dist/pre-approval.js.map +1 -0
- package/dist/program.js +12 -0
- package/dist/program.js.map +1 -1
- package/dist/project-dir.d.ts +2 -1
- package/dist/project-dir.js +3 -1
- package/dist/project-dir.js.map +1 -1
- package/dist/readiness.d.ts +29 -0
- package/dist/readiness.js +291 -0
- package/dist/readiness.js.map +1 -0
- package/dist/regression-cli.js +4 -2
- package/dist/regression-cli.js.map +1 -1
- package/dist/report-api.d.ts +25 -2
- package/dist/report-api.js +34 -5
- package/dist/report-api.js.map +1 -1
- package/dist/report-cli.js +8 -1
- package/dist/report-cli.js.map +1 -1
- package/dist/resource-preflight.js +5 -3
- package/dist/resource-preflight.js.map +1 -1
- package/dist/result-schema.d.ts +12 -0
- package/dist/result-schema.js +8 -0
- package/dist/result-schema.js.map +1 -1
- package/dist/run-index.d.ts +4 -2
- package/dist/run-index.js +3 -1
- package/dist/run-index.js.map +1 -1
- package/dist/run-key-preflight.d.ts +2 -1
- package/dist/run-key-preflight.js +3 -2
- package/dist/run-key-preflight.js.map +1 -1
- package/dist/run-metadata.d.ts +29 -0
- package/dist/run-metadata.js +48 -0
- package/dist/run-metadata.js.map +1 -0
- package/dist/run-tags-cli.d.ts +14 -0
- package/dist/run-tags-cli.js +41 -0
- package/dist/run-tags-cli.js.map +1 -0
- package/dist/self-heal-adapter.d.ts +43 -27
- package/dist/self-heal-adapter.js +196 -62
- package/dist/self-heal-adapter.js.map +1 -1
- package/dist/site-cli.d.ts +1 -1
- package/dist/site-cli.js +24 -1
- package/dist/site-cli.js.map +1 -1
- package/dist/source-cli.js +9 -5
- package/dist/source-cli.js.map +1 -1
- package/dist/suite-explore-options.d.ts +14 -0
- package/dist/suite-explore-options.js +8 -0
- package/dist/suite-explore-options.js.map +1 -1
- package/dist/sweep-api.d.ts +289 -0
- package/dist/sweep-api.js +859 -0
- package/dist/sweep-api.js.map +1 -0
- package/dist/sweep-cli.d.ts +9 -0
- package/dist/sweep-cli.js +117 -0
- package/dist/sweep-cli.js.map +1 -0
- package/dist/target-config.d.ts +5 -2
- package/dist/target-config.js +15 -0
- package/dist/target-config.js.map +1 -1
- package/dist/ux-cli.js +3 -1
- package/dist/ux-cli.js.map +1 -1
- package/dist/ux-usability.d.ts +9 -3
- package/dist/ux-usability.js +8 -5
- package/dist/ux-usability.js.map +1 -1
- package/dist/verify-fix-cli.js +4 -2
- package/dist/verify-fix-cli.js.map +1 -1
- package/package.json +9 -9
- package/skills/jevitate-ci-check/SKILL.md +9 -1
- package/skills/jevitate-demo/SKILL.md +5 -2
- package/skills/jevitate-getting-started/SKILL.md +14 -1
- package/skills/jevitate-mission-scope/SKILL.md +2 -2
- package/skills/jevitate-run-journey/SKILL.md +42 -9
- package/skills/jevitate-test-campaign/SKILL.md +26 -5
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import type { Page } from "playwright";
|
|
2
|
+
import type { BrowserPort } from "@jevitate/playwright";
|
|
3
|
+
import { type BrowserRunOptions } from "./browser-run-options.js";
|
|
4
|
+
/**
|
|
5
|
+
* #427 — persona sessions from credentials, and the pre-flight that proves a session is still alive.
|
|
6
|
+
*
|
|
7
|
+
* - `mintStorageState` (`jevitate login`, and the refresh below): opens a FRESH context (no
|
|
8
|
+
* storage state), fills the sign-in form with a username and password read from the NAMED
|
|
9
|
+
* environment variables, submits, checks success by code, and saves the context's storage state
|
|
10
|
+
* (mode 0600, written atomically). The login session records nothing: no trace, no video, no HAR,
|
|
11
|
+
* no screenshot, no transcript — and no message this module produces carries a credential (every
|
|
12
|
+
* error text passes through `redactText` with both values first).
|
|
13
|
+
* - `checkSession` (the pre-flight auth check): opens the start URL with the storage state and
|
|
14
|
+
* decides, by code, whether the app bounced it to a sign-in page.
|
|
15
|
+
* - `ensurePersonaSession`: the check, plus ONE re-mint when the persona has `login` parameters.
|
|
16
|
+
*
|
|
17
|
+
* Credentials are never accepted as literal values — only environment variable NAMES travel (flags,
|
|
18
|
+
* personas files, results). Values are typed only into a page whose origin the run authorizes.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* #449: a sign-in through an HTTP endpoint (`jevitate login --api`, a personas file's `login.api`):
|
|
22
|
+
* the credentials are POSTed as JSON, and the response's cookies and/or a token read from its JSON
|
|
23
|
+
* body (written into the app origin's localStorage) become the storage state. No form is driven.
|
|
24
|
+
*/
|
|
25
|
+
export interface ApiLogin {
|
|
26
|
+
/** The sign-in endpoint (absolute http(s) URL on an authorized origin). */
|
|
27
|
+
readonly url: string;
|
|
28
|
+
/** The JSON body key the username is sent under (default `username`). */
|
|
29
|
+
readonly userKey: string;
|
|
30
|
+
/** The JSON body key the password is sent under (default `password`). */
|
|
31
|
+
readonly passwordKey: string;
|
|
32
|
+
/** A simple dotted path into the JSON response (`token`, `data.accessToken`) whose value is the session token. */
|
|
33
|
+
readonly tokenPath?: string;
|
|
34
|
+
/** The localStorage key the token is written under (default: the token path's last segment). */
|
|
35
|
+
readonly storageKey?: string;
|
|
36
|
+
/** Where the token goes: only `local` (a Playwright storage state has no sessionStorage). */
|
|
37
|
+
readonly storage: "local";
|
|
38
|
+
/** The page that proves the session (`--verify-url`); default the endpoint's origin root. Its origin receives the token. */
|
|
39
|
+
readonly verifyUrl?: string;
|
|
40
|
+
}
|
|
41
|
+
/** A persona's login parameters (`jevitate login` flags, or a personas file entry's `login`). */
|
|
42
|
+
export interface PersonaLogin {
|
|
43
|
+
/** The sign-in page (absolute http(s) URL) — the form path. Exactly one of `url` and `api` is set. */
|
|
44
|
+
readonly url?: string;
|
|
45
|
+
/** #449: sign in through an HTTP endpoint instead of a form. */
|
|
46
|
+
readonly api?: ApiLogin;
|
|
47
|
+
/** Environment variable holding the username (its NAME — never the value). */
|
|
48
|
+
readonly userEnv: string;
|
|
49
|
+
/** Environment variable holding the password (its NAME — never the value). */
|
|
50
|
+
readonly passwordEnv: string;
|
|
51
|
+
/** The username field: a label, else a CSS selector. Default: found by autocomplete/type/name heuristics. */
|
|
52
|
+
readonly userField?: string;
|
|
53
|
+
/** The password field: a label, else a CSS selector. Default: the visible `input[type=password]`. */
|
|
54
|
+
readonly passwordField?: string;
|
|
55
|
+
/** The submit button's accessible name. Default: the form's submit button, else Enter. */
|
|
56
|
+
readonly submit?: string;
|
|
57
|
+
/** `urlIncludes:<text>` | `selector:<css>` | `text:<text>`. Default: no password field and no login-like URL. */
|
|
58
|
+
readonly success?: string;
|
|
59
|
+
}
|
|
60
|
+
export declare class LoginArgsError extends Error {
|
|
61
|
+
readonly code: "E_LOGIN_ARGS";
|
|
62
|
+
constructor(message: string);
|
|
63
|
+
}
|
|
64
|
+
/** The login did not succeed (credentials rejected, a field not found, the success check never held). */
|
|
65
|
+
export declare class LoginFailedError extends Error {
|
|
66
|
+
readonly code: "E_LOGIN_FAILED";
|
|
67
|
+
constructor(message: string);
|
|
68
|
+
}
|
|
69
|
+
/** Checks an environment variable NAME (a value pasted in its place is never echoed). */
|
|
70
|
+
export declare function assertEnvVarName(name: string, what: string): void;
|
|
71
|
+
/** The names an API login's settings go by in error messages (flags, or a personas file's `login.api.*`). */
|
|
72
|
+
interface ApiLoginLabels {
|
|
73
|
+
readonly url: string;
|
|
74
|
+
readonly userKey: string;
|
|
75
|
+
readonly passwordKey: string;
|
|
76
|
+
readonly tokenPath: string;
|
|
77
|
+
readonly storageKey: string;
|
|
78
|
+
readonly storage: string;
|
|
79
|
+
readonly verifyUrl: string;
|
|
80
|
+
}
|
|
81
|
+
/** `a.b.0.c` → its segments (strict: identifiers or indexes, no prototype keys). */
|
|
82
|
+
export declare function parseTokenPath(path: string, what: string): string[];
|
|
83
|
+
/** Validates an API login's settings (fail closed before any network). */
|
|
84
|
+
export declare function parseApiLogin(raw: {
|
|
85
|
+
readonly url: string;
|
|
86
|
+
readonly userKey?: string | undefined;
|
|
87
|
+
readonly passwordKey?: string | undefined;
|
|
88
|
+
readonly tokenPath?: string | undefined;
|
|
89
|
+
readonly storageKey?: string | undefined;
|
|
90
|
+
readonly storage?: string | undefined;
|
|
91
|
+
readonly verifyUrl?: string | undefined;
|
|
92
|
+
}, labels?: ApiLoginLabels): ApiLogin;
|
|
93
|
+
/** Validates a personas file entry's `login` object (`where` names it in errors). */
|
|
94
|
+
export declare function parsePersonaLogin(v: unknown, where: string): PersonaLogin;
|
|
95
|
+
/** `jevitate login`'s flags → a validated `PersonaLogin` (fail closed before any browser opens). */
|
|
96
|
+
export declare function loginFromFlags(f: {
|
|
97
|
+
readonly url?: string;
|
|
98
|
+
readonly api?: Parameters<typeof parseApiLogin>[0];
|
|
99
|
+
readonly userEnv: string;
|
|
100
|
+
readonly passwordEnv: string;
|
|
101
|
+
readonly userField?: string;
|
|
102
|
+
readonly passwordField?: string;
|
|
103
|
+
readonly submit?: string;
|
|
104
|
+
readonly success?: string;
|
|
105
|
+
}): PersonaLogin;
|
|
106
|
+
export type LoginSuccess = {
|
|
107
|
+
readonly kind: "urlIncludes";
|
|
108
|
+
readonly text: string;
|
|
109
|
+
} | {
|
|
110
|
+
readonly kind: "selector";
|
|
111
|
+
readonly selector: string;
|
|
112
|
+
} | {
|
|
113
|
+
readonly kind: "text";
|
|
114
|
+
readonly text: string;
|
|
115
|
+
};
|
|
116
|
+
/** `urlIncludes:<text>` | `selector:<css>` | `text:<text>`. */
|
|
117
|
+
export declare function parseLoginSuccess(spec: string): LoginSuccess;
|
|
118
|
+
export type AuthCheck = {
|
|
119
|
+
readonly mode: "off";
|
|
120
|
+
} | {
|
|
121
|
+
readonly mode: "auto";
|
|
122
|
+
} | {
|
|
123
|
+
readonly mode: "urlExcludes";
|
|
124
|
+
readonly text: string;
|
|
125
|
+
} | {
|
|
126
|
+
readonly mode: "selector";
|
|
127
|
+
readonly selector: string;
|
|
128
|
+
};
|
|
129
|
+
/** `--auth-check <off|auto|urlExcludes:<text>|selector:<css>>` (default `auto`). */
|
|
130
|
+
export declare function parseAuthCheck(spec: string | undefined): AuthCheck;
|
|
131
|
+
export interface LoginSecrets {
|
|
132
|
+
readonly username: string;
|
|
133
|
+
readonly password: string;
|
|
134
|
+
}
|
|
135
|
+
/** Reads the two credentials from the environment (fail closed: unset/empty refuses, naming the variable only). */
|
|
136
|
+
export declare function resolveLoginSecrets(login: PersonaLogin, env: Readonly<Record<string, string | undefined>>): LoginSecrets;
|
|
137
|
+
/**
|
|
138
|
+
* Drives the sign-in form on `page` (already open, no storage state): navigates to `login.url`, fills
|
|
139
|
+
* the fields, submits, and waits for the success check. Throws `LoginFailedError` (scrubbed).
|
|
140
|
+
* Supports a two-step form (username, then a password page): when no password field is visible yet,
|
|
141
|
+
* the username is submitted first.
|
|
142
|
+
*/
|
|
143
|
+
export declare function performLogin(page: Page, login: PersonaLogin, secrets: LoginSecrets, opts: {
|
|
144
|
+
readonly allowlist: readonly string[];
|
|
145
|
+
readonly timeoutMs: number;
|
|
146
|
+
}): Promise<string>;
|
|
147
|
+
/** Where a storage state goes: refused inside a repo's `.jevitate/`; a warning when it is in a repo and not ignored by git. */
|
|
148
|
+
export declare function checkSaveTarget(file: string, what: string): {
|
|
149
|
+
readonly path: string;
|
|
150
|
+
readonly warnings: string[];
|
|
151
|
+
};
|
|
152
|
+
/** Writes the storage state JSON atomically with mode 0600 (a temp file in the same directory, then rename). */
|
|
153
|
+
export declare function writeStorageStateFile(path: string, json: string): void;
|
|
154
|
+
export interface MintOptions {
|
|
155
|
+
readonly login: PersonaLogin;
|
|
156
|
+
/** The storage state file to write. */
|
|
157
|
+
readonly save: string;
|
|
158
|
+
/** Origins credentials may be typed into (the run's allowlist, the login URL's origin by default). */
|
|
159
|
+
readonly allowlist: readonly string[];
|
|
160
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
161
|
+
readonly port: BrowserPort;
|
|
162
|
+
readonly browser?: BrowserRunOptions;
|
|
163
|
+
readonly timeoutMs: number;
|
|
164
|
+
/**
|
|
165
|
+
* #449 (an API login only): prove the new session before it is saved — the state is checked against
|
|
166
|
+
* this URL with this rule (`checkSession`), and nothing is written when the check fails.
|
|
167
|
+
*/
|
|
168
|
+
readonly verify?: {
|
|
169
|
+
readonly url: string;
|
|
170
|
+
readonly check: AuthCheck;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
export interface MintResult {
|
|
174
|
+
/** Absolute path of the saved storage state. */
|
|
175
|
+
readonly saved: string;
|
|
176
|
+
/** Where the sign-in ended (credentials and token-like query values redacted). */
|
|
177
|
+
readonly landedUrl: string;
|
|
178
|
+
}
|
|
179
|
+
/** Signs in on a fresh, unrecorded session and saves its storage state (mode 0600). */
|
|
180
|
+
export declare function mintStorageState(o: MintOptions): Promise<MintResult>;
|
|
181
|
+
/** The app page an API login's session is proven on (and whose origin receives the token). */
|
|
182
|
+
export declare function apiVerifyUrl(api: ApiLogin): string;
|
|
183
|
+
export interface SessionCheckOptions {
|
|
184
|
+
readonly storageState: string;
|
|
185
|
+
/** The mission's start URL. */
|
|
186
|
+
readonly url: string;
|
|
187
|
+
readonly allowlist: readonly string[];
|
|
188
|
+
readonly check: AuthCheck;
|
|
189
|
+
readonly port: BrowserPort;
|
|
190
|
+
readonly browser?: BrowserRunOptions;
|
|
191
|
+
readonly timeoutMs: number;
|
|
192
|
+
}
|
|
193
|
+
export type SessionCheck = {
|
|
194
|
+
readonly ok: true;
|
|
195
|
+
readonly landedUrl?: string;
|
|
196
|
+
} | {
|
|
197
|
+
readonly ok: false;
|
|
198
|
+
readonly reason: string;
|
|
199
|
+
readonly landedUrl: string;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* Opens `url` with the storage state and decides by code whether the session is alive. A start URL
|
|
203
|
+
* that is itself a sign-in route is never judged (`auto`). An unreachable app is NOT an expired
|
|
204
|
+
* session: the check passes it on and the mission reports the app as unreachable, as before.
|
|
205
|
+
*/
|
|
206
|
+
export declare function checkSession(o: SessionCheckOptions): Promise<SessionCheck>;
|
|
207
|
+
export interface EnsureSessionOptions extends Omit<SessionCheckOptions, "storageState"> {
|
|
208
|
+
/** The persona's name, when the session is a persona's (it names the failure). */
|
|
209
|
+
readonly persona?: string;
|
|
210
|
+
readonly storageState: string;
|
|
211
|
+
/** The persona's login parameters: an expired session is re-minted ONCE from them. */
|
|
212
|
+
readonly login?: PersonaLogin;
|
|
213
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
214
|
+
/** A line for the operator (stderr): a refresh happened. */
|
|
215
|
+
readonly note?: (line: string) => void;
|
|
216
|
+
}
|
|
217
|
+
export type EnsureSession = {
|
|
218
|
+
readonly ok: true;
|
|
219
|
+
readonly refreshed: boolean;
|
|
220
|
+
} | {
|
|
221
|
+
readonly ok: false;
|
|
222
|
+
readonly reason: string;
|
|
223
|
+
readonly landedUrl?: string;
|
|
224
|
+
};
|
|
225
|
+
/** The pre-flight: check the session; when it is expired and login parameters exist, re-mint once and re-check. */
|
|
226
|
+
export declare function ensurePersonaSession(o: EnsureSessionOptions): Promise<EnsureSession>;
|
|
227
|
+
/** A run the pre-flight ended (exit 2): `inconclusive`, `failure.kind: "auth-expired"` — the login page was never explored. */
|
|
228
|
+
export interface AuthExpiredResult {
|
|
229
|
+
readonly strategy: string;
|
|
230
|
+
readonly outcome: "inconclusive";
|
|
231
|
+
readonly missionOutcome: "inconclusive";
|
|
232
|
+
readonly reason: string;
|
|
233
|
+
readonly failure: {
|
|
234
|
+
readonly kind: "auth-expired";
|
|
235
|
+
readonly message: string;
|
|
236
|
+
readonly persona?: string;
|
|
237
|
+
};
|
|
238
|
+
readonly persona?: string;
|
|
239
|
+
readonly startUrl: string;
|
|
240
|
+
/** Where the start URL landed (token-like query values redacted). */
|
|
241
|
+
readonly landedUrl?: string;
|
|
242
|
+
readonly exitCode: 2;
|
|
243
|
+
/** #423: a goal run's own ending (the shared `inconclusive`) and why — the run broke before it began. */
|
|
244
|
+
readonly goalOutcome?: "inconclusive";
|
|
245
|
+
readonly goalReason?: "broken-run";
|
|
246
|
+
/** #421/#423: nothing ran, so no defect: the defect verdict is present and `none`. */
|
|
247
|
+
readonly defects: readonly never[];
|
|
248
|
+
readonly defectOutcome: {
|
|
249
|
+
readonly status: "none";
|
|
250
|
+
readonly byKind: Readonly<Record<string, number>>;
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
export declare function authExpiredResult(strategy: string, startUrl: string, failed: Extract<EnsureSession, {
|
|
254
|
+
ok: false;
|
|
255
|
+
}>, persona?: string): AuthExpiredResult;
|
|
256
|
+
export {};
|