@gate-forge/pack-playwright 0.7.1 → 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/README.md +31 -0
- package/dist/constants.d.ts +13 -140
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +13 -148
- package/dist/constants.js.map +1 -1
- package/dist/cypress/plugin.d.ts +53 -0
- package/dist/cypress/plugin.d.ts.map +1 -0
- package/dist/cypress/plugin.js +369 -0
- package/dist/cypress/plugin.js.map +1 -0
- package/dist/cypress/spec-scan.d.ts +39 -0
- package/dist/cypress/spec-scan.d.ts.map +1 -0
- package/dist/cypress/spec-scan.js +301 -0
- package/dist/cypress/spec-scan.js.map +1 -0
- package/dist/diagnosis.d.ts +39 -0
- package/dist/diagnosis.d.ts.map +1 -0
- package/dist/diagnosis.js +63 -0
- package/dist/diagnosis.js.map +1 -0
- package/dist/discovery/adapter-projection.d.ts +13 -0
- package/dist/discovery/adapter-projection.d.ts.map +1 -0
- package/dist/discovery/adapter-projection.js +84 -0
- package/dist/discovery/adapter-projection.js.map +1 -0
- package/dist/discovery/config-locations.d.ts +5 -0
- package/dist/discovery/config-locations.d.ts.map +1 -0
- package/dist/discovery/config-locations.js +19 -0
- package/dist/discovery/config-locations.js.map +1 -0
- package/dist/discovery/cypress-runner-adapter.d.ts +112 -0
- package/dist/discovery/cypress-runner-adapter.d.ts.map +1 -0
- package/dist/discovery/cypress-runner-adapter.js +501 -0
- package/dist/discovery/cypress-runner-adapter.js.map +1 -0
- package/dist/discovery/discover.d.ts +53 -1
- package/dist/discovery/discover.d.ts.map +1 -1
- package/dist/discovery/discover.js +290 -30
- package/dist/discovery/discover.js.map +1 -1
- package/dist/discovery/git-ignore.d.ts +13 -0
- package/dist/discovery/git-ignore.d.ts.map +1 -0
- package/dist/discovery/git-ignore.js +62 -0
- package/dist/discovery/git-ignore.js.map +1 -0
- package/dist/discovery/index.d.ts +10 -0
- package/dist/discovery/index.d.ts.map +1 -1
- package/dist/discovery/index.js +10 -0
- package/dist/discovery/index.js.map +1 -1
- package/dist/discovery/playwright-runner-adapter.d.ts +108 -0
- package/dist/discovery/playwright-runner-adapter.d.ts.map +1 -0
- package/dist/discovery/playwright-runner-adapter.js +185 -0
- package/dist/discovery/playwright-runner-adapter.js.map +1 -0
- package/dist/discovery/prepare-barrier.d.ts +522 -0
- package/dist/discovery/prepare-barrier.d.ts.map +1 -0
- package/dist/discovery/prepare-barrier.js +739 -0
- package/dist/discovery/prepare-barrier.js.map +1 -0
- package/dist/discovery/pytest-adapter.d.ts.map +1 -1
- package/dist/discovery/pytest-adapter.js +6 -2
- package/dist/discovery/pytest-adapter.js.map +1 -1
- package/dist/discovery/pytest-runner-adapter.d.ts +124 -0
- package/dist/discovery/pytest-runner-adapter.d.ts.map +1 -0
- package/dist/discovery/pytest-runner-adapter.js +454 -0
- package/dist/discovery/pytest-runner-adapter.js.map +1 -0
- package/dist/discovery/reconcile.d.ts +89 -11
- package/dist/discovery/reconcile.d.ts.map +1 -1
- package/dist/discovery/reconcile.js +440 -78
- package/dist/discovery/reconcile.js.map +1 -1
- package/dist/discovery/runner-env.d.ts +88 -2
- package/dist/discovery/runner-env.d.ts.map +1 -1
- package/dist/discovery/runner-env.js +142 -4
- package/dist/discovery/runner-env.js.map +1 -1
- package/dist/discovery/runner-file-scope.d.ts +114 -0
- package/dist/discovery/runner-file-scope.d.ts.map +1 -0
- package/dist/discovery/runner-file-scope.js +638 -0
- package/dist/discovery/runner-file-scope.js.map +1 -0
- package/dist/discovery/static-discovery.d.ts +49 -3
- package/dist/discovery/static-discovery.d.ts.map +1 -1
- package/dist/discovery/static-discovery.js +477 -18
- package/dist/discovery/static-discovery.js.map +1 -1
- package/dist/discovery/supervised-run.d.ts +199 -10
- package/dist/discovery/supervised-run.d.ts.map +1 -1
- package/dist/discovery/supervised-run.js +350 -39
- package/dist/discovery/supervised-run.js.map +1 -1
- package/dist/discovery/trusted-config.d.ts +180 -6
- package/dist/discovery/trusted-config.d.ts.map +1 -1
- package/dist/discovery/trusted-config.js +279 -10
- package/dist/discovery/trusted-config.js.map +1 -1
- package/dist/discovery/vitest-runner-adapter.d.ts +172 -0
- package/dist/discovery/vitest-runner-adapter.d.ts.map +1 -0
- package/dist/discovery/vitest-runner-adapter.js +607 -0
- package/dist/discovery/vitest-runner-adapter.js.map +1 -0
- package/dist/fixture/consumer-runner.d.ts +4 -0
- package/dist/fixture/consumer-runner.d.ts.map +1 -0
- package/dist/fixture/consumer-runner.js +38 -0
- package/dist/fixture/consumer-runner.js.map +1 -0
- package/dist/fixture/evidence.d.ts +27 -0
- package/dist/fixture/evidence.d.ts.map +1 -1
- package/dist/fixture/evidence.js +12 -0
- package/dist/fixture/evidence.js.map +1 -1
- package/dist/fixture/fixture.d.ts +2 -1
- package/dist/fixture/fixture.d.ts.map +1 -1
- package/dist/fixture/fixture.js +1 -17
- package/dist/fixture/fixture.js.map +1 -1
- package/dist/fixture/witness-client.d.ts +6 -174
- package/dist/fixture/witness-client.d.ts.map +1 -1
- package/dist/fixture/witness-client.js +6 -267
- package/dist/fixture/witness-client.js.map +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/json.d.ts +6 -12
- package/dist/json.d.ts.map +1 -1
- package/dist/json.js +6 -17
- package/dist/json.js.map +1 -1
- package/dist/reporter/project-graph-reporter.d.ts +121 -0
- package/dist/reporter/project-graph-reporter.d.ts.map +1 -0
- package/dist/reporter/project-graph-reporter.js +132 -0
- package/dist/reporter/project-graph-reporter.js.map +1 -0
- package/dist/reporter/reporter.cjs.map +1 -1
- package/dist/reporter/reporter.d.ts +93 -4
- package/dist/reporter/reporter.d.ts.map +1 -1
- package/dist/reporter/reporter.js +174 -18
- package/dist/reporter/reporter.js.map +1 -1
- package/dist/runner-claims.d.ts +13 -0
- package/dist/runner-claims.d.ts.map +1 -0
- package/dist/runner-claims.js +46 -0
- package/dist/runner-claims.js.map +1 -0
- package/dist/runner-resolution.d.ts +3 -0
- package/dist/runner-resolution.d.ts.map +1 -0
- package/dist/runner-resolution.js +14 -0
- package/dist/runner-resolution.js.map +1 -0
- package/dist/supervisor/client.d.ts +23 -1
- package/dist/supervisor/client.d.ts.map +1 -1
- package/dist/supervisor/client.js +49 -0
- package/dist/supervisor/client.js.map +1 -1
- package/dist/supervisor/drain.d.ts +65 -0
- package/dist/supervisor/drain.d.ts.map +1 -1
- package/dist/supervisor/drain.js +353 -9
- package/dist/supervisor/drain.js.map +1 -1
- package/dist/supervisor/index.d.ts +7 -3
- package/dist/supervisor/index.d.ts.map +1 -1
- package/dist/supervisor/index.js +7 -3
- package/dist/supervisor/index.js.map +1 -1
- package/dist/supervisor/spool.d.ts +65 -2
- package/dist/supervisor/spool.d.ts.map +1 -1
- package/dist/supervisor/spool.js +47 -0
- package/dist/supervisor/spool.js.map +1 -1
- package/dist/surface.d.ts +6 -207
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +6 -264
- package/dist/surface.js.map +1 -1
- package/dist/vitest/index.d.ts +23 -0
- package/dist/vitest/index.d.ts.map +1 -0
- package/dist/vitest/index.js +356 -0
- package/dist/vitest/index.js.map +1 -0
- package/dist/vitest/reporter.d.ts +83 -0
- package/dist/vitest/reporter.d.ts.map +1 -0
- package/dist/vitest/reporter.js +211 -0
- package/dist/vitest/reporter.js.map +1 -0
- package/dist/vitest/worker-slot.d.ts +36 -0
- package/dist/vitest/worker-slot.d.ts.map +1 -0
- package/dist/vitest/worker-slot.js +51 -0
- package/dist/vitest/worker-slot.js.map +1 -0
- package/dist/witness/adapter-registry.d.ts +6 -50
- package/dist/witness/adapter-registry.d.ts.map +1 -1
- package/dist/witness/adapter-registry.js +6 -257
- package/dist/witness/adapter-registry.js.map +1 -1
- package/dist/witness/behavior-request.d.ts +6 -76
- package/dist/witness/behavior-request.d.ts.map +1 -1
- package/dist/witness/behavior-request.js +6 -273
- package/dist/witness/behavior-request.js.map +1 -1
- package/dist/witness/behavior.d.ts +6 -48
- package/dist/witness/behavior.d.ts.map +1 -1
- package/dist/witness/behavior.js +6 -114
- package/dist/witness/behavior.js.map +1 -1
- package/dist/witness/bin.d.ts +6 -17
- package/dist/witness/bin.d.ts.map +1 -1
- package/dist/witness/bin.js +6 -168
- package/dist/witness/bin.js.map +1 -1
- package/dist/witness/browser.d.ts +14 -206
- package/dist/witness/browser.d.ts.map +1 -1
- package/dist/witness/browser.js +15 -654
- package/dist/witness/browser.js.map +1 -1
- package/dist/witness/classifications.d.ts +6 -38
- package/dist/witness/classifications.d.ts.map +1 -1
- package/dist/witness/classifications.js +6 -83
- package/dist/witness/classifications.js.map +1 -1
- package/dist/witness/env-attestation.d.ts +6 -94
- package/dist/witness/env-attestation.d.ts.map +1 -1
- package/dist/witness/env-attestation.js +6 -198
- package/dist/witness/env-attestation.js.map +1 -1
- package/dist/witness/fixture-provider.d.ts +6 -82
- package/dist/witness/fixture-provider.d.ts.map +1 -1
- package/dist/witness/fixture-provider.js +6 -105
- package/dist/witness/fixture-provider.js.map +1 -1
- package/dist/witness/loopback-pins.d.ts +6 -75
- package/dist/witness/loopback-pins.d.ts.map +1 -1
- package/dist/witness/loopback-pins.js +6 -240
- package/dist/witness/loopback-pins.js.map +1 -1
- package/dist/witness/server.d.ts +8 -26
- package/dist/witness/server.d.ts.map +1 -1
- package/dist/witness/server.js +24 -3761
- package/dist/witness/server.js.map +1 -1
- package/dist/witness/types.d.ts +6 -882
- package/dist/witness/types.d.ts.map +1 -1
- package/dist/witness/types.js +9 -1
- package/dist/witness/types.js.map +1 -1
- package/examples/overlay-proof.spec.js +75 -0
- package/package.json +12 -3
- package/python/gateforge_pytest_plugin.py +462 -0
- package/python/__pycache__/gateforge_persistence_intents.cpython-314.pyc +0 -0
package/dist/witness/bin.js
CHANGED
|
@@ -1,172 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* service.
|
|
2
|
+
* Compatibility re-export: `witness/bin` now lives in the runner-neutral
|
|
3
|
+
* `@gate-forge/witness` package (plan 2026-09-25 phase 1).
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* gateforge-witness [--help]
|
|
10
|
-
* [--proxy-target <url>] start the observation proxy against
|
|
11
|
-
* this loopback base URL (ADR 0004 D7)
|
|
12
|
-
* [--mount-path <prefix>] browser-facing mount prefix the proxy
|
|
13
|
-
* strips before forwarding AND recording
|
|
14
|
-
* (e.g. /api; requires --proxy-target)
|
|
15
|
-
* [--state-dir <dir>] manifest append at shutdown
|
|
16
|
-
* [--classifications <path>] classifications YAML input
|
|
17
|
-
* [--adapters-dir <dir>] reviewed adapters (default .gateforge/adapters)
|
|
18
|
-
* [--target-base-url <url>] attestation subject (GF-10, loopback)
|
|
19
|
-
* [--target-fingerprint <m>] expected marker (GF-13)
|
|
20
|
-
* [--adapter-base-url <url>] default adapter read base
|
|
21
|
-
*
|
|
22
|
-
* Env surface:
|
|
23
|
-
* GATEFORGE_RUN_ID, GATEFORGE_RUN_TOKEN (required; CLI contract)
|
|
24
|
-
* GATEFORGE_PROXY_TARGET, GATEFORGE_MOUNT_PATH (observation proxy)
|
|
25
|
-
* GATEFORGE_STATE_DIR (manifest append at shutdown)
|
|
26
|
-
* GATEFORGE_ADAPTERS_DIR (default .gateforge/adapters)
|
|
27
|
-
* GATEFORGE_CLASSIFICATIONS (classifications YAML path)
|
|
28
|
-
* GATEFORGE_TARGET_BASE_URL (attestation subject, GF-10)
|
|
29
|
-
* GATEFORGE_TARGET_FINGERPRINT (expected marker, GF-13)
|
|
30
|
-
* GATEFORGE_ADAPTER_BASE_URL (default adapter read base)
|
|
31
|
-
* GATEFORGE_WITNESS_VERIFIER_KEY (attestation verifier key)
|
|
32
|
-
*
|
|
33
|
-
* SECRETS NEVER TRAVEL ON ARGV (a process's cmdline is world-readable
|
|
34
|
-
* via /proc — the same rule `gateforge test-gates` applies): the run
|
|
35
|
-
* id/token are env-only (set by 'gateforge test-gates'), and the
|
|
36
|
-
* verifier key is read from GATEFORGE_WITNESS_VERIFIER_KEY only. With a
|
|
37
|
-
* verifier key the witness serves the MAC-attested ledger surface;
|
|
38
|
-
* without one it stays unauthenticated and downstream evaluation fails
|
|
39
|
-
* closed.
|
|
40
|
-
*
|
|
41
|
-
* The wrapper prints `GATEFORGE_WITNESS_URL=<url>` once listening — and
|
|
42
|
-
* `GATEFORGE_WITNESS_PROXY_URL=<url>` when an observation proxy is
|
|
43
|
-
* active; the process serves until SIGTERM/SIGINT.
|
|
44
|
-
*/
|
|
45
|
-
import { startWitness, WitnessStartupError } from './server.js';
|
|
46
|
-
import { ENV_ADAPTER_BASE_URL, ENV_ADAPTERS_DIR, ENV_CLASSIFICATIONS, ENV_MOUNT_PATH, ENV_PROXY_TARGET, ENV_RUN_ID, ENV_RUN_TOKEN, ENV_STATE_DIR, ENV_TARGET_BASE_URL, ENV_TARGET_FINGERPRINT, ENV_WITNESS_VERIFIER_KEY, } from '../constants.js';
|
|
47
|
-
/** One-line usage (the header comment above is the long form). */
|
|
48
|
-
export const WITNESS_BIN_USAGE = 'usage: gateforge-witness [--proxy-target <url>] [--mount-path <prefix>] ' +
|
|
49
|
-
'[--state-dir <dir>] [--classifications <path>] [--adapters-dir <dir>] ' +
|
|
50
|
-
'[--target-base-url <url>] [--target-fingerprint <marker>] [--adapter-base-url <url>] ' +
|
|
51
|
-
'(run id/token via GATEFORGE_RUN_ID/GATEFORGE_RUN_TOKEN; verifier key via ' +
|
|
52
|
-
'GATEFORGE_WITNESS_VERIFIER_KEY)';
|
|
53
|
-
/** Flags this bin accepts (values; `--help` is handled separately). */
|
|
54
|
-
const VALUE_FLAGS = new Set([
|
|
55
|
-
'proxy-target',
|
|
56
|
-
'mount-path',
|
|
57
|
-
'state-dir',
|
|
58
|
-
'classifications',
|
|
59
|
-
'adapters-dir',
|
|
60
|
-
'target-base-url',
|
|
61
|
-
'target-fingerprint',
|
|
62
|
-
'adapter-base-url',
|
|
63
|
-
'adapter-read-authorization',
|
|
64
|
-
]);
|
|
65
|
-
/**
|
|
66
|
-
* Parses the bin argv (`--flag value` and `--flag=value` shapes).
|
|
67
|
-
* Unknown flags and missing values fail closed with the usage line —
|
|
68
|
-
* a mis-wired harness must never silently start a half-configured
|
|
69
|
-
* witness.
|
|
70
|
-
*
|
|
71
|
-
* Args:
|
|
72
|
-
* argv: arguments after node/script.
|
|
73
|
-
*
|
|
74
|
-
* Returns:
|
|
75
|
-
* WitnessBinFlags: parsed flag values.
|
|
76
|
-
*
|
|
77
|
-
* Throws:
|
|
78
|
-
* WitnessStartupError: on any malformed argv.
|
|
79
|
-
*/
|
|
80
|
-
function parseFlags(argv) {
|
|
81
|
-
const values = new Map();
|
|
82
|
-
for (let index = 0; index < argv.length; index += 1) {
|
|
83
|
-
const token = argv[index] ?? '';
|
|
84
|
-
if (!token.startsWith('--')) {
|
|
85
|
-
throw new WitnessStartupError(`unexpected argument '${token}'\n${WITNESS_BIN_USAGE}`);
|
|
86
|
-
}
|
|
87
|
-
const body = token.slice(2);
|
|
88
|
-
const eq = body.indexOf('=');
|
|
89
|
-
const name = eq >= 0 ? body.slice(0, eq) : body;
|
|
90
|
-
if (name.length === 0) {
|
|
91
|
-
throw new WitnessStartupError(`invalid flag '${token}'\n${WITNESS_BIN_USAGE}`);
|
|
92
|
-
}
|
|
93
|
-
if (name === 'help') {
|
|
94
|
-
continue; // handled by the caller before parsing matters
|
|
95
|
-
}
|
|
96
|
-
if (!VALUE_FLAGS.has(name)) {
|
|
97
|
-
throw new WitnessStartupError(`unknown flag '--${name}'\n${WITNESS_BIN_USAGE}`);
|
|
98
|
-
}
|
|
99
|
-
let value = eq >= 0 ? body.slice(eq + 1) : undefined;
|
|
100
|
-
if (value === undefined) {
|
|
101
|
-
const next = argv[index + 1];
|
|
102
|
-
if (next === undefined || next.startsWith('--')) {
|
|
103
|
-
throw new WitnessStartupError(`flag '--${name}' requires a value\n${WITNESS_BIN_USAGE}`);
|
|
104
|
-
}
|
|
105
|
-
value = next;
|
|
106
|
-
index += 1;
|
|
107
|
-
}
|
|
108
|
-
if (values.has(name)) {
|
|
109
|
-
throw new WitnessStartupError(`flag '--${name}' may only be given once\n${WITNESS_BIN_USAGE}`);
|
|
110
|
-
}
|
|
111
|
-
values.set(name, value);
|
|
112
|
-
}
|
|
113
|
-
return { values };
|
|
114
|
-
}
|
|
115
|
-
/** Flag value or its env fallback (undefined when neither is set). */
|
|
116
|
-
function flagOrEnv(flags, name, envValue) {
|
|
117
|
-
const fromFlags = flags.values.get(name);
|
|
118
|
-
if (fromFlags !== undefined && fromFlags !== '')
|
|
119
|
-
return fromFlags;
|
|
120
|
-
if (envValue !== undefined && envValue !== '')
|
|
121
|
-
return envValue;
|
|
122
|
-
return undefined;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Reads env + argv and starts the witness.
|
|
126
|
-
*
|
|
127
|
-
* Args:
|
|
128
|
-
* argv: CLI flags (see the module header; `--help` prints usage and
|
|
129
|
-
* returns a never-started handle).
|
|
130
|
-
* env: process environment.
|
|
131
|
-
*
|
|
132
|
-
* Returns:
|
|
133
|
-
* WitnessHandle once listening (or a handle with an empty `url` for
|
|
134
|
-
* `--help`; the wrapper skips its URL banner in that case).
|
|
135
|
-
*
|
|
136
|
-
* Throws:
|
|
137
|
-
* WitnessStartupError / AttestationError / AdapterRegistryError:
|
|
138
|
-
* fail-closed startup problems (exit 2 via the wrapper).
|
|
5
|
+
* The move is physical, not behavioural: this module forwards every
|
|
6
|
+
* export unchanged so `@gate-forge/pack-playwright`'s published import
|
|
7
|
+
* paths — which consumers pin — keep resolving to the same values.
|
|
139
8
|
*/
|
|
140
|
-
export
|
|
141
|
-
if (argv.includes('--help') || argv.includes('-h')) {
|
|
142
|
-
process.stdout.write(`${WITNESS_BIN_USAGE}\n`);
|
|
143
|
-
return Object.freeze({ url: '', proxyUrl: null, stop: async () => { } });
|
|
144
|
-
}
|
|
145
|
-
const flags = parseFlags(argv);
|
|
146
|
-
const runId = env[ENV_RUN_ID];
|
|
147
|
-
const token = env[ENV_RUN_TOKEN];
|
|
148
|
-
if (runId === undefined || runId === '') {
|
|
149
|
-
throw new WitnessStartupError(`${ENV_RUN_ID} is required (set by 'gateforge test-gates')`);
|
|
150
|
-
}
|
|
151
|
-
if (token === undefined || token === '') {
|
|
152
|
-
throw new WitnessStartupError(`${ENV_RUN_TOKEN} is required (set by 'gateforge test-gates')`);
|
|
153
|
-
}
|
|
154
|
-
// Environment-only, deliberately absent from argv (world-readable
|
|
155
|
-
// /proc cmdline): the suite must never see the verifier key either way.
|
|
156
|
-
const verifierKey = env[ENV_WITNESS_VERIFIER_KEY] ?? null;
|
|
157
|
-
return startWitness({
|
|
158
|
-
runId,
|
|
159
|
-
token,
|
|
160
|
-
proxyTarget: flagOrEnv(flags, 'proxy-target', env[ENV_PROXY_TARGET]),
|
|
161
|
-
mountPath: flagOrEnv(flags, 'mount-path', env[ENV_MOUNT_PATH]),
|
|
162
|
-
stateDir: flagOrEnv(flags, 'state-dir', env[ENV_STATE_DIR]),
|
|
163
|
-
classificationsPath: flagOrEnv(flags, 'classifications', env[ENV_CLASSIFICATIONS]),
|
|
164
|
-
adaptersDir: flagOrEnv(flags, 'adapters-dir', env[ENV_ADAPTERS_DIR] ?? '.gateforge/adapters'),
|
|
165
|
-
targetBaseUrl: flagOrEnv(flags, 'target-base-url', env[ENV_TARGET_BASE_URL]),
|
|
166
|
-
targetFingerprint: flagOrEnv(flags, 'target-fingerprint', env[ENV_TARGET_FINGERPRINT]),
|
|
167
|
-
adapterBaseUrl: flagOrEnv(flags, 'adapter-base-url', env[ENV_ADAPTER_BASE_URL]),
|
|
168
|
-
adapterReadAuthorization: flagOrEnv(flags, 'adapter-read-authorization', env['GATEFORGE_ADAPTER_READ_AUTHORIZATION']) ?? null,
|
|
169
|
-
verifierKey,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
9
|
+
export * from '@gate-forge/witness/witness/bin';
|
|
172
10
|
//# sourceMappingURL=bin.js.map
|
package/dist/witness/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/witness/bin.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/witness/bin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,iCAAiC,CAAC"}
|
|
@@ -1,215 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* supervisor-opened test session, closed when the session seals.
|
|
2
|
+
* Compatibility re-export: `witness/browser` now lives in the runner-neutral
|
|
3
|
+
* `@gate-forge/witness` package (plan 2026-09-25 phase 1).
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* consumer-declared locators, and observes each step itself:
|
|
10
|
-
* - the rendered control it clicked and the values it typed;
|
|
11
|
-
* - the actual application request the action caused (captured from the
|
|
12
|
-
* engine page's own network, app-origin only);
|
|
13
|
-
* - the resulting navigation and the rendered row/form it read back.
|
|
14
|
-
*
|
|
15
|
-
* Forgery resistance (why this channel is proof):
|
|
16
|
-
* - fabricated DOM (`page.evaluate` in the worker page) is irrelevant:
|
|
17
|
-
* the engine reads its OWN page;
|
|
18
|
-
* - mocked responses (`page.route` in the worker) are irrelevant: the
|
|
19
|
-
* worker cannot route the engine's traffic;
|
|
20
|
-
* - direct API/Node mutations bypass the engine page entirely: no
|
|
21
|
-
* engine action runs, so no engine-observed action/visible records
|
|
22
|
-
* exist for them — invented suite-submitted records never satisfy;
|
|
23
|
-
* - HTTP-200-while-error: the engine asserts the rendered status
|
|
24
|
-
* itself (created/archived values) AND captures the app response
|
|
25
|
-
* status — a displayed error fails the action fail-closed.
|
|
26
|
-
*
|
|
27
|
-
* Surface selectors are LOCATORS, never proof: a lying descriptor only
|
|
28
|
-
* makes the engine fail to find elements (fail closed).
|
|
29
|
-
*/
|
|
30
|
-
import { type Browser, type Page } from 'playwright';
|
|
31
|
-
import { type SurfaceDescriptor, type SurfaceStep } from '../surface.js';
|
|
32
|
-
/** The UI operations the engine can perform (constrained subset). */
|
|
33
|
-
export type EngineOperation = 'create' | 'read' | 'update' | 'delete';
|
|
34
|
-
/** One app-origin exchange the engine captured during an action. */
|
|
35
|
-
export interface EngineCapturedExchange {
|
|
36
|
-
/** Uppercase method (GET, POST, ...). */
|
|
37
|
-
method: string;
|
|
38
|
-
/** Canonical observed path (query/fragment stripped). */
|
|
39
|
-
path: string;
|
|
40
|
-
/** Response status the app answered. */
|
|
41
|
-
status: number;
|
|
42
|
-
/** Response body bytes (bounded snapshot for hashing). */
|
|
43
|
-
body: Buffer;
|
|
44
|
-
}
|
|
45
|
-
/** What the engine observed performing one action. */
|
|
46
|
-
export interface EngineActionObservation {
|
|
47
|
-
/** Entity id OBSERVED from the rendered list (never declared). */
|
|
48
|
-
entityId: string;
|
|
49
|
-
/** The exact input values the engine typed (exact-value echo source). */
|
|
50
|
-
enteredFields: Record<string, string>;
|
|
51
|
-
/** The rendered fields the engine read back after the action. */
|
|
52
|
-
renderedFields: Record<string, string>;
|
|
53
|
-
/** App-origin exchanges captured inside the action window. */
|
|
54
|
-
exchanges: EngineCapturedExchange[];
|
|
55
|
-
/** Engine-side pre-observation marker (filled by the witness layer). */
|
|
56
|
-
preObservationId?: string;
|
|
57
|
-
}
|
|
58
|
-
/** Fail-closed engine browser error (surfaced as 409/503 downstream). */
|
|
59
|
-
export declare class EngineBrowserError extends Error {
|
|
60
|
-
constructor(message: string);
|
|
61
|
-
}
|
|
62
|
-
/** The browser launcher the engine drives (default: pinned Chromium). */
|
|
63
|
-
export interface EngineBrowserLauncher {
|
|
64
|
-
launch(options?: Record<string, unknown>): Promise<Browser>;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* The minimal page surface the wizard step driver needs. A real
|
|
68
|
-
* Playwright Page satisfies it structurally, and stub pages in tests
|
|
69
|
-
* implement exactly this — no browser required to prove the walk.
|
|
70
|
-
*/
|
|
71
|
-
export interface StepPage {
|
|
72
|
-
goto(url: string, options?: {
|
|
73
|
-
timeout?: number;
|
|
74
|
-
}): Promise<unknown>;
|
|
75
|
-
waitForSelector(selector: string, options?: {
|
|
76
|
-
timeout?: number;
|
|
77
|
-
}): Promise<unknown>;
|
|
78
|
-
locator(selector: string): {
|
|
79
|
-
click(options?: {
|
|
80
|
-
timeout?: number;
|
|
81
|
-
}): Promise<void>;
|
|
82
|
-
fill(value: string, options?: {
|
|
83
|
-
timeout?: number;
|
|
84
|
-
}): Promise<void>;
|
|
85
|
-
check(options?: {
|
|
86
|
-
timeout?: number;
|
|
87
|
-
}): Promise<void>;
|
|
88
|
-
};
|
|
89
|
-
keyboard: {
|
|
90
|
-
press(key: string): Promise<void>;
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Walks one validated wizard step list on the engine-owned page
|
|
95
|
-
* (surface v2 create). Every interaction runs here, engine-side: the
|
|
96
|
-
* test supplies intent (field values) only. A step referencing an
|
|
97
|
-
* input field the journey did not provide fails closed — the engine
|
|
98
|
-
* never invents values. Unknown shapes are unreachable post-
|
|
99
|
-
* validation, but still refused defensively (never silently skipped).
|
|
100
|
-
*
|
|
101
|
-
* Args:
|
|
102
|
-
* page: the engine-owned page (real or structural stub).
|
|
103
|
-
* appBase: the trusted attested subject origin (never suite input).
|
|
104
|
-
* steps: the validated wizard walk, in order.
|
|
105
|
-
* fields: the journey's declared input values, keyed by field name.
|
|
5
|
+
* The move is physical, not behavioural: this module forwards every
|
|
6
|
+
* export unchanged so `@gate-forge/pack-playwright`'s published import
|
|
7
|
+
* paths — which consumers pin — keep resolving to the same values.
|
|
106
8
|
*/
|
|
107
|
-
export
|
|
9
|
+
export * from '@gate-forge/witness/witness/browser';
|
|
10
|
+
import { EngineBrowserManager as RunnerNeutralBrowserManager, type EngineBrowserLauncher } from '@gate-forge/witness/witness/browser';
|
|
108
11
|
/**
|
|
109
|
-
*
|
|
12
|
+
* The Playwright-defaulting engine browser manager.
|
|
110
13
|
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
14
|
+
* The runner-neutral `EngineBrowserManager` REQUIRES a launcher: this
|
|
15
|
+
* package is the one that knows about Playwright, so the default lives
|
|
16
|
+
* here. Every construction site already passed a launcher explicitly,
|
|
17
|
+
* so nothing changes — but a consumer that relied on the default keeps
|
|
18
|
+
* getting Chromium from this path.
|
|
116
19
|
*/
|
|
117
|
-
export declare class EngineBrowserManager {
|
|
118
|
-
private readonly launcher;
|
|
119
|
-
private browser;
|
|
120
|
-
private launching;
|
|
121
|
-
private readonly sessions;
|
|
122
|
-
/**
|
|
123
|
-
* Pinned `--host-resolver-rules` value binding every attested hostname
|
|
124
|
-
* to its startup-approved loopback IPs. Set once at witness startup
|
|
125
|
-
* (before any launch); the browser is then incapable of resolving
|
|
126
|
-
* those names anywhere but loopback, regardless of later DNS changes.
|
|
127
|
-
*/
|
|
128
|
-
private dnsPinRules;
|
|
20
|
+
export declare class EngineBrowserManager extends RunnerNeutralBrowserManager {
|
|
129
21
|
constructor(launcher?: EngineBrowserLauncher);
|
|
130
|
-
/**
|
|
131
|
-
* Installs the DNS pin rules for the next (first) launch.
|
|
132
|
-
*
|
|
133
|
-
* Args:
|
|
134
|
-
* rules: the `--host-resolver-rules` value, or null when nothing is
|
|
135
|
-
* pinned (plain launch, previous behavior).
|
|
136
|
-
*
|
|
137
|
-
* Throws:
|
|
138
|
-
* EngineBrowserError: when the browser already launched — pins must
|
|
139
|
-
* precede every navigation (fail closed, never silently unbound).
|
|
140
|
-
*/
|
|
141
|
-
setDnsPinRules(rules: string | null): void;
|
|
142
|
-
/**
|
|
143
|
-
* Returns the engine page for one session, creating the isolated
|
|
144
|
-
* context on first use.
|
|
145
|
-
*
|
|
146
|
-
* Args:
|
|
147
|
-
* sessionId: the supervisor-opened session the context belongs to.
|
|
148
|
-
*
|
|
149
|
-
* Returns:
|
|
150
|
-
* Promise<Page>: the session's engine-owned page.
|
|
151
|
-
*
|
|
152
|
-
* Throws:
|
|
153
|
-
* EngineBrowserError: when Chromium cannot launch (fail closed —
|
|
154
|
-
* the capability is honestly unavailable at runtime).
|
|
155
|
-
*/
|
|
156
|
-
pageFor(sessionId: string): Promise<Page>;
|
|
157
|
-
/**
|
|
158
|
-
* Closes and forgets one session's engine context (session seal).
|
|
159
|
-
* Late engine calls for the session then recreate nothing — callers
|
|
160
|
-
* must refuse sealed sessions before driving (they do: every browser
|
|
161
|
-
* endpoint requires an OPEN session first).
|
|
162
|
-
*
|
|
163
|
-
* Args:
|
|
164
|
-
* sessionId: the sealed session.
|
|
165
|
-
*/
|
|
166
|
-
closeSession(sessionId: string): Promise<void>;
|
|
167
|
-
/** Closes every engine context and the browser (witness stop). */
|
|
168
|
-
closeAll(): Promise<void>;
|
|
169
|
-
/** Lazy Chromium launch (single flight; fail closed with the cause). */
|
|
170
|
-
private ensureBrowser;
|
|
171
22
|
}
|
|
172
|
-
/**
|
|
173
|
-
* Drives one constrained surface operation on the engine page and
|
|
174
|
-
* observes every step itself.
|
|
175
|
-
*
|
|
176
|
-
* Args:
|
|
177
|
-
* page: the session's engine-owned page.
|
|
178
|
-
* appBase: loopback app base the engine navigates (validated upstream).
|
|
179
|
-
* surface: the validated consumer descriptor (locators only).
|
|
180
|
-
* operation: the constrained operation to perform.
|
|
181
|
-
* input: entered fields (create/update) and/or the target entity id.
|
|
182
|
-
*
|
|
183
|
-
* Returns:
|
|
184
|
-
* Promise<EngineActionObservation>: the engine's own observation —
|
|
185
|
-
* observed entity id, entered + rendered fields, captured exchanges.
|
|
186
|
-
*
|
|
187
|
-
* Throws:
|
|
188
|
-
* EngineBrowserError: fail-closed on every untrusted outcome —
|
|
189
|
-
* missing rows, ambiguous creation, wrong rendered status, no
|
|
190
|
-
* application request, or an application error status.
|
|
191
|
-
*/
|
|
192
|
-
export declare function driveEngineAction(page: Page, appBase: string, surface: SurfaceDescriptor, operation: EngineOperation, input: {
|
|
193
|
-
fields?: Record<string, string>;
|
|
194
|
-
entityId?: string;
|
|
195
|
-
}): Promise<EngineActionObservation>;
|
|
196
|
-
/**
|
|
197
|
-
* Re-reads the rendered result for one entity on the engine page
|
|
198
|
-
* (the `visible.confirm` counterpart): row read for mutations, form
|
|
199
|
-
* read for reads.
|
|
200
|
-
*
|
|
201
|
-
* Args:
|
|
202
|
-
* page: the session's engine-owned page.
|
|
203
|
-
* appBase: loopback app base.
|
|
204
|
-
* surface: the validated consumer descriptor.
|
|
205
|
-
* operation: the original action (decides row vs form readback).
|
|
206
|
-
* entityId: the engine-observed entity id.
|
|
207
|
-
*
|
|
208
|
-
* Returns:
|
|
209
|
-
* Promise<Record<string, string>>: the rendered fields.
|
|
210
|
-
*
|
|
211
|
-
* Throws:
|
|
212
|
-
* EngineBrowserError: when the UI no longer exposes the entity.
|
|
213
|
-
*/
|
|
214
|
-
export declare function readEngineVisible(page: Page, appBase: string, surface: SurfaceDescriptor, operation: EngineOperation, entityId: string): Promise<Record<string, string>>;
|
|
215
23
|
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/witness/browser.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/witness/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,qCAAqC,CAAC;AAGpD,OAAO,EACL,oBAAoB,IAAI,2BAA2B,EACnD,KAAK,qBAAqB,EAC3B,MAAM,qCAAqC,CAAC;AAE7C;;;;;;;;GAQG;AACH,qBAAa,oBAAqB,SAAQ,2BAA2B;gBACvD,QAAQ,GAAE,qBAAgC;CAGvD"}
|