@gate-forge/pack-playwright 0.1.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.
Files changed (140) hide show
  1. package/LICENSE +202 -0
  2. package/bin/gateforge-witness.js +40 -0
  3. package/dist/attestation/proxy.d.ts +40 -0
  4. package/dist/attestation/proxy.d.ts.map +1 -0
  5. package/dist/attestation/proxy.js +78 -0
  6. package/dist/attestation/proxy.js.map +1 -0
  7. package/dist/constants.d.ts +130 -0
  8. package/dist/constants.d.ts.map +1 -0
  9. package/dist/constants.js +138 -0
  10. package/dist/constants.js.map +1 -0
  11. package/dist/discovery/adapters.d.ts +167 -0
  12. package/dist/discovery/adapters.d.ts.map +1 -0
  13. package/dist/discovery/adapters.js +276 -0
  14. package/dist/discovery/adapters.js.map +1 -0
  15. package/dist/discovery/discover.d.ts +57 -0
  16. package/dist/discovery/discover.d.ts.map +1 -0
  17. package/dist/discovery/discover.js +544 -0
  18. package/dist/discovery/discover.js.map +1 -0
  19. package/dist/discovery/index.d.ts +15 -0
  20. package/dist/discovery/index.d.ts.map +1 -0
  21. package/dist/discovery/index.js +15 -0
  22. package/dist/discovery/index.js.map +1 -0
  23. package/dist/discovery/inference.d.ts +63 -0
  24. package/dist/discovery/inference.d.ts.map +1 -0
  25. package/dist/discovery/inference.js +173 -0
  26. package/dist/discovery/inference.js.map +1 -0
  27. package/dist/discovery/pytest-adapter.d.ts +205 -0
  28. package/dist/discovery/pytest-adapter.d.ts.map +1 -0
  29. package/dist/discovery/pytest-adapter.js +548 -0
  30. package/dist/discovery/pytest-adapter.js.map +1 -0
  31. package/dist/discovery/reconcile.d.ts +106 -0
  32. package/dist/discovery/reconcile.d.ts.map +1 -0
  33. package/dist/discovery/reconcile.js +268 -0
  34. package/dist/discovery/reconcile.js.map +1 -0
  35. package/dist/discovery/runner-env.d.ts +80 -0
  36. package/dist/discovery/runner-env.d.ts.map +1 -0
  37. package/dist/discovery/runner-env.js +139 -0
  38. package/dist/discovery/runner-env.js.map +1 -0
  39. package/dist/discovery/static-discovery.d.ts +121 -0
  40. package/dist/discovery/static-discovery.d.ts.map +1 -0
  41. package/dist/discovery/static-discovery.js +1028 -0
  42. package/dist/discovery/static-discovery.js.map +1 -0
  43. package/dist/discovery/supervised-run.d.ts +110 -0
  44. package/dist/discovery/supervised-run.d.ts.map +1 -0
  45. package/dist/discovery/supervised-run.js +328 -0
  46. package/dist/discovery/supervised-run.js.map +1 -0
  47. package/dist/discovery/trusted-config.d.ts +103 -0
  48. package/dist/discovery/trusted-config.d.ts.map +1 -0
  49. package/dist/discovery/trusted-config.js +117 -0
  50. package/dist/discovery/trusted-config.js.map +1 -0
  51. package/dist/fixture/evidence.d.ts +191 -0
  52. package/dist/fixture/evidence.d.ts.map +1 -0
  53. package/dist/fixture/evidence.js +366 -0
  54. package/dist/fixture/evidence.js.map +1 -0
  55. package/dist/fixture/fixture.d.ts +37 -0
  56. package/dist/fixture/fixture.d.ts.map +1 -0
  57. package/dist/fixture/fixture.js +38 -0
  58. package/dist/fixture/fixture.js.map +1 -0
  59. package/dist/fixture/witness-client.d.ts +164 -0
  60. package/dist/fixture/witness-client.d.ts.map +1 -0
  61. package/dist/fixture/witness-client.js +253 -0
  62. package/dist/fixture/witness-client.js.map +1 -0
  63. package/dist/index.d.ts +64 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +55 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/json.d.ts +16 -0
  68. package/dist/json.d.ts.map +1 -0
  69. package/dist/json.js +21 -0
  70. package/dist/json.js.map +1 -0
  71. package/dist/reporter/ledger.d.ts +105 -0
  72. package/dist/reporter/ledger.d.ts.map +1 -0
  73. package/dist/reporter/ledger.js +197 -0
  74. package/dist/reporter/ledger.js.map +1 -0
  75. package/dist/reporter/reporter.cjs +105 -0
  76. package/dist/reporter/reporter.cjs.map +1 -0
  77. package/dist/reporter/reporter.d.cts +35 -0
  78. package/dist/reporter/reporter.d.cts.map +1 -0
  79. package/dist/reporter/reporter.d.ts +167 -0
  80. package/dist/reporter/reporter.d.ts.map +1 -0
  81. package/dist/reporter/reporter.js +673 -0
  82. package/dist/reporter/reporter.js.map +1 -0
  83. package/dist/setup.d.ts +49 -0
  84. package/dist/setup.d.ts.map +1 -0
  85. package/dist/setup.js +167 -0
  86. package/dist/setup.js.map +1 -0
  87. package/dist/supervisor/client.d.ts +73 -0
  88. package/dist/supervisor/client.d.ts.map +1 -0
  89. package/dist/supervisor/client.js +164 -0
  90. package/dist/supervisor/client.js.map +1 -0
  91. package/dist/supervisor/drain.d.ts +45 -0
  92. package/dist/supervisor/drain.d.ts.map +1 -0
  93. package/dist/supervisor/drain.js +235 -0
  94. package/dist/supervisor/drain.js.map +1 -0
  95. package/dist/supervisor/index.d.ts +16 -0
  96. package/dist/supervisor/index.d.ts.map +1 -0
  97. package/dist/supervisor/index.js +13 -0
  98. package/dist/supervisor/index.js.map +1 -0
  99. package/dist/supervisor/spool.d.ts +137 -0
  100. package/dist/supervisor/spool.d.ts.map +1 -0
  101. package/dist/supervisor/spool.js +263 -0
  102. package/dist/supervisor/spool.js.map +1 -0
  103. package/dist/surface.d.ts +134 -0
  104. package/dist/surface.d.ts.map +1 -0
  105. package/dist/surface.js +139 -0
  106. package/dist/surface.js.map +1 -0
  107. package/dist/witness/adapter-registry.d.ts +38 -0
  108. package/dist/witness/adapter-registry.d.ts.map +1 -0
  109. package/dist/witness/adapter-registry.js +158 -0
  110. package/dist/witness/adapter-registry.js.map +1 -0
  111. package/dist/witness/bin.d.ts +21 -0
  112. package/dist/witness/bin.d.ts.map +1 -0
  113. package/dist/witness/bin.js +172 -0
  114. package/dist/witness/bin.js.map +1 -0
  115. package/dist/witness/browser.d.ts +173 -0
  116. package/dist/witness/browser.d.ts.map +1 -0
  117. package/dist/witness/browser.js +580 -0
  118. package/dist/witness/browser.js.map +1 -0
  119. package/dist/witness/classifications.d.ts +42 -0
  120. package/dist/witness/classifications.d.ts.map +1 -0
  121. package/dist/witness/classifications.js +87 -0
  122. package/dist/witness/classifications.js.map +1 -0
  123. package/dist/witness/env-attestation.d.ts +98 -0
  124. package/dist/witness/env-attestation.d.ts.map +1 -0
  125. package/dist/witness/env-attestation.js +202 -0
  126. package/dist/witness/env-attestation.js.map +1 -0
  127. package/dist/witness/loopback-pins.d.ts +79 -0
  128. package/dist/witness/loopback-pins.d.ts.map +1 -0
  129. package/dist/witness/loopback-pins.js +244 -0
  130. package/dist/witness/loopback-pins.js.map +1 -0
  131. package/dist/witness/server.d.ts +34 -0
  132. package/dist/witness/server.d.ts.map +1 -0
  133. package/dist/witness/server.js +2539 -0
  134. package/dist/witness/server.js.map +1 -0
  135. package/dist/witness/types.d.ts +643 -0
  136. package/dist/witness/types.d.ts.map +1 -0
  137. package/dist/witness/types.js +2 -0
  138. package/dist/witness/types.js.map +1 -0
  139. package/package.json +64 -0
  140. package/python/gateforge_persistence_intents.py +100 -0
@@ -0,0 +1,253 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { ENV_RUN_TOKEN, ENV_STATE_DIR, ENV_WITNESS_URL, RUN_HEADER, WITNESS_URL_FILE, } from '../constants.js';
4
+ /** A witness call that failed (status + single-cause diagnostic). */
5
+ export class WitnessRequestError extends Error {
6
+ status;
7
+ detail;
8
+ constructor(status, message, detail = null) {
9
+ super(detail === null ? message : `${message}: ${detail}`);
10
+ this.name = 'WitnessRequestError';
11
+ this.status = status;
12
+ this.detail = detail;
13
+ }
14
+ }
15
+ /**
16
+ * Resolves the witness base URL: env first, then the spawned-witness
17
+ * file in the run-state dir (written by the reporter when it auto-spawns
18
+ * a witness without `--witness-url`).
19
+ *
20
+ * Returns:
21
+ * string: the witness base URL.
22
+ *
23
+ * Throws:
24
+ * Error: with the exact setup step required when no witness is wired.
25
+ */
26
+ export function resolveWitnessUrl() {
27
+ const fromEnv = process.env[ENV_WITNESS_URL];
28
+ if (fromEnv !== undefined && fromEnv !== '')
29
+ return fromEnv;
30
+ const stateDir = process.env[ENV_STATE_DIR];
31
+ if (stateDir !== undefined && stateDir !== '') {
32
+ try {
33
+ const record = JSON.parse(readFileSync(join(stateDir, WITNESS_URL_FILE), 'utf8'));
34
+ if (typeof record.url === 'string' && record.url !== '')
35
+ return record.url;
36
+ }
37
+ catch {
38
+ // fall through to the actionable error
39
+ }
40
+ }
41
+ throw new Error(`no witness service is wired: set ${ENV_WITNESS_URL} (or run under 'gateforge test-gates', ` +
42
+ 'which exports it) so evidence primitives can submit records');
43
+ }
44
+ /**
45
+ * The fixture's witness transport.
46
+ *
47
+ * Args:
48
+ * url: witness base URL (default: resolved from env/state file).
49
+ * token: run token (default: GATEFORGE_RUN_TOKEN).
50
+ * timeoutMs: per-call timeout.
51
+ */
52
+ export class WitnessClient {
53
+ url;
54
+ token;
55
+ timeoutMs;
56
+ constructor(url = resolveWitnessUrl(), token = process.env[ENV_RUN_TOKEN], timeoutMs = 5000) {
57
+ this.url = url;
58
+ if (token === undefined || token === '') {
59
+ throw new Error(`${ENV_RUN_TOKEN} is required to talk to the witness service`);
60
+ }
61
+ this.token = token;
62
+ this.timeoutMs = timeoutMs;
63
+ }
64
+ /** POST /records (pin #7; Phase 1: requires the supervisor-issued session credential). */
65
+ async postRecords(request) {
66
+ const body = await this.request('/records', request);
67
+ return body;
68
+ }
69
+ /**
70
+ * POST /sessions/resolve (Phase 1, worker side): asks for the OPEN
71
+ * session bound to the exact (workerIndex, testId) pair.
72
+ *
73
+ * Deliberately the ONLY session-lifecycle call on the suite-side
74
+ * client (enforcement-review fix 3): open and close live on the
75
+ * supervisor channel (`SupervisorClient`, verifier-key authenticated)
76
+ * and are dispatched by the trusted CLI's spool drain — the tested
77
+ * suite has NO reachable path to mint, seal, or re-seal a session,
78
+ * and with it no path to forge the execution record supervision
79
+ * grades. Resolve only ever answers for a session the supervisor
80
+ * already opened; it cannot create or extend one.
81
+ *
82
+ * Returns:
83
+ * SessionResolveResponse when an open session answers; null when the
84
+ * witness answers 404 (not yet opened, or sealed).
85
+ */
86
+ async resolveSession(request) {
87
+ try {
88
+ return await this.request('/sessions/resolve', request);
89
+ }
90
+ catch (error) {
91
+ if (error instanceof WitnessRequestError && error.status === 404)
92
+ return null;
93
+ throw error;
94
+ }
95
+ }
96
+ /**
97
+ * POST /sessions/intervals/open (Phase 1): marks the start of a
98
+ * UI-action observation interval on the witness's monotonic clock.
99
+ * Proxy exchanges completing inside the interval are the session's
100
+ * browser evidence; everything outside (setup traffic) is never
101
+ * credited.
102
+ */
103
+ async beginActionInterval(request) {
104
+ return this.request('/sessions/intervals/open', request);
105
+ }
106
+ /**
107
+ * POST /sessions/intervals/close (Phase 1): seals the interval. A
108
+ * closed interval can never be stretched later (409 on re-close).
109
+ */
110
+ async endActionInterval(request) {
111
+ return this.request('/sessions/intervals/close', request);
112
+ }
113
+ /**
114
+ * POST /witness/pre-observation (audit round 4): engine-side id-set
115
+ * snapshot BEFORE a claimed create; pass the returned
116
+ * `observationId` to `verifyPersistence` so the issued record carries
117
+ * `before: {entityAbsent}`. Phase 1: requires the supervisor-issued
118
+ * session credential — the snapshot belongs to the open test session.
119
+ */
120
+ async preObserve(request) {
121
+ return this.request('/witness/pre-observation', request);
122
+ }
123
+ /**
124
+ * POST /witness/http-observation (ADR 0004 D7, plan §8 / D1):
125
+ * consumes one witness-observed HTTP exchange matching (method, path)
126
+ * and issues witnessed `http.request` records for the declaring
127
+ * test's claimed obligations. Phase 1: the caller must hold a valid
128
+ * OPEN session and only an exchange observed through THAT session's
129
+ * proxy prefix within one of its recorded action intervals can be
130
+ * consumed — the claim set may be given as `claimIds`, or as the
131
+ * singular legacy `claimId`/`obligationId` pair (folded in by the
132
+ * server; a split assignment with distinct values is refused with 400).
133
+ */
134
+ async observeHttp(request) {
135
+ const body = await this.request('/witness/http-observation', request);
136
+ const records = Array.isArray(body['records'])
137
+ ? body['records']
138
+ : // Legacy single-record response shape.
139
+ [{ recordId: String(body['recordId'] ?? ''), obligationId: String(request.claimId ?? request.obligationId ?? '') }];
140
+ return {
141
+ recordId: String(body['recordId'] ?? records[0]?.recordId ?? ''),
142
+ runId: String(body['runId'] ?? ''),
143
+ trust: String(body['trust'] ?? ''),
144
+ status: typeof body['status'] === 'number' ? body['status'] : 0,
145
+ records,
146
+ };
147
+ }
148
+ /**
149
+ * POST /witness/persistence (Phase 1): runs the engine-side adapter
150
+ * read under the supervisor-opened session, so the persistence record
151
+ * binds to the same channel the UI action used.
152
+ */
153
+ async verifyPersistence(request) {
154
+ return this.request('/witness/persistence', request);
155
+ }
156
+ /**
157
+ * POST /browser/surface (plan Phase 1 item 4): registers the
158
+ * consumer-declared surface descriptor + the app base the ENGINE must
159
+ * drive for this session. Validated engine-side (structure, loopback,
160
+ * fingerprint); selectors are locators only.
161
+ */
162
+ async registerBrowserSurface(request) {
163
+ return this.request('/browser/surface', request);
164
+ }
165
+ /**
166
+ * POST /browser/action (plan Phase 1 item 4): the ENGINE performs one
167
+ * constrained surface operation on its own page and returns its own
168
+ * observation (observed entity id, entered + rendered fields, app
169
+ * status, pre-observation id, issued record ids). Test code supplies
170
+ * intent only — it never touches the engine page.
171
+ */
172
+ async browserAction(request) {
173
+ return this.request('/browser/action', request);
174
+ }
175
+ /**
176
+ * POST /browser/visible (plan Phase 1 item 4): the ENGINE re-reads
177
+ * the rendered result for the engine-observed entity and returns the
178
+ * rendered fields.
179
+ */
180
+ async browserVisible(request) {
181
+ return this.request('/browser/visible', request);
182
+ }
183
+ /** GET /records — the issued ledger for this run. */
184
+ async listRecords() {
185
+ const controller = new AbortController();
186
+ const timer = setTimeout(() => controller.abort(), this.timeoutMs);
187
+ let response;
188
+ try {
189
+ response = await fetch(`${this.url}/records`, {
190
+ method: 'GET',
191
+ headers: { [RUN_HEADER]: this.token, accept: 'application/json' },
192
+ signal: controller.signal,
193
+ });
194
+ }
195
+ catch (error) {
196
+ throw new WitnessRequestError(0, `witness call to /records failed: ${error.message}`);
197
+ }
198
+ finally {
199
+ clearTimeout(timer);
200
+ }
201
+ let body;
202
+ try {
203
+ body = await response.json();
204
+ }
205
+ catch {
206
+ body = null;
207
+ }
208
+ if (!response.ok) {
209
+ const record = isObject(body) ? body : {};
210
+ throw new WitnessRequestError(response.status, typeof record['error'] === 'string' ? record['error'] : `witness answered HTTP ${response.status}`, typeof record['detail'] === 'string' ? record['detail'] : null);
211
+ }
212
+ const records = isObject(body) && Array.isArray(body['records']) ? body['records'] : [];
213
+ return { records: records };
214
+ }
215
+ async request(path, payload) {
216
+ const controller = new AbortController();
217
+ const timer = setTimeout(() => controller.abort(), this.timeoutMs);
218
+ let response;
219
+ try {
220
+ response = await fetch(`${this.url}${path}`, {
221
+ method: 'POST',
222
+ headers: {
223
+ [RUN_HEADER]: this.token,
224
+ 'content-type': 'application/json',
225
+ accept: 'application/json',
226
+ },
227
+ body: JSON.stringify(payload),
228
+ signal: controller.signal,
229
+ });
230
+ }
231
+ catch (error) {
232
+ clearTimeout(timer);
233
+ throw new WitnessRequestError(0, `witness call to ${path} failed: ${error.message}`);
234
+ }
235
+ clearTimeout(timer);
236
+ let body;
237
+ try {
238
+ body = await response.json();
239
+ }
240
+ catch {
241
+ body = null;
242
+ }
243
+ if (!response.ok) {
244
+ const record = isObject(body) ? body : {};
245
+ throw new WitnessRequestError(response.status, typeof record['error'] === 'string' ? record['error'] : `witness answered HTTP ${response.status}`, typeof record['detail'] === 'string' ? record['detail'] : null);
246
+ }
247
+ return body;
248
+ }
249
+ }
250
+ function isObject(value) {
251
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
252
+ }
253
+ //# sourceMappingURL=witness-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"witness-client.js","sourceRoot":"","sources":["../../src/fixture/witness-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,aAAa,EACb,aAAa,EACb,eAAe,EACf,UAAU,EACV,gBAAgB,GACj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ack-playwright — the Playwright evidence pack.
3
+ *
4
+ * Public surface:
5
+ *
6
+ * - Fixture: `{ test, expect }` — the extended runner exposing the
7
+ * trusted `evidence` primitives (tests import from THIS package,
8
+ * never raw `playwright/test` — GF-24).
9
+ * - Reporter: `GateforgeReporter` — annotations → claims.json +
10
+ * records.json into the run-state dir, per-claim verdicts via the
11
+ * engine, gate pass/fail summary (GF-23 enforcement).
12
+ * - Witness: `startWitness` + `startWitnessProcess` — loopback
13
+ * engine-side service (GF-10/11/13), plus the `gateforge-witness`
14
+ * bin.
15
+ * - Attestation: `startAttestationProxy` — stamps a disposable loopback
16
+ * app with the env-fingerprint markers (GF-13).
17
+ * - Setup: `gateforgeGlobalSetup` / `gateforgeGlobalTeardown` — spawn
18
+ * the witness deterministically before workers (no races).
19
+ */
20
+ export { test, expect } from './fixture/fixture.js';
21
+ export type { EvidenceFixtures } from './fixture/fixture.js';
22
+ export { createEvidence, claimsFromAnnotations, resourceIdOfClaim, SURFACE_DESCRIPTOR_VERSION, type EvidenceApi, type Receipt, type PersistenceOutcome, type WitnessRecord, type SurfaceDescriptor, } from './fixture/evidence.js';
23
+ export { WitnessClient, WitnessRequestError, resolveWitnessUrl } from './fixture/witness-client.js';
24
+ export type { IssuedLedgerRecord } from './fixture/witness-client.js';
25
+ export { GateforgeReporter, gateSummaryLine } from './reporter/reporter.js';
26
+ export type { GateforgeReporterOptions, LedgerRow, ReporterTest } from './reporter/reporter.js';
27
+ export { startWitness, WitnessStartupError, recordIdOf } from './witness/server.js';
28
+ export { loadAdapters, validateAdapter, AdapterRegistryError } from './witness/adapter-registry.js';
29
+ export { isLoopbackUrl, isLoopbackUrlResolving, clearLoopbackCacheForTests, probeEnvFingerprint, envFingerprintMismatch, AttestationError, } from './witness/env-attestation.js';
30
+ export type { DnsLookup } from './witness/env-attestation.js';
31
+ export { loadClassifications, toClassificationView } from './witness/classifications.js';
32
+ export type { WitnessOptions, WitnessHandle, EvidenceAdapter, AdapterContext, RecordsRequest, RecordsResponse, PersistenceRequest, PersistenceResponse, SessionCredential, SessionOpenRequest, SessionOpenResponse, SessionCloseRequest, SessionCloseResponse, ExpectedSetRequest, ExpectedSetResponse, ExpectedTestRegistration, ExecutionTraceResponse, } from './witness/types.js';
33
+ export { startAttestationProxy } from './attestation/proxy.js';
34
+ export type { AttestationProxyHandle } from './attestation/proxy.js';
35
+ export { gateforgeGlobalSetup, gateforgeGlobalTeardown, startWitnessProcess } from './setup.js';
36
+ /**
37
+ * Supervisor surface (enforcement-review fixes 2a/3): the lifecycle
38
+ * spool (runner → CLI), the verifier-key-authenticated supervisor
39
+ * client, and the spool drain the trusted CLI runs while the suite
40
+ * executes. The runner child itself holds no supervisor rights.
41
+ *
42
+ * Server-witnessed persistence channel: `appendPersistenceIntent` is the
43
+ * documented TS writer for the suite-side intents spool (the CONTRACT is
44
+ * the JSONL line — a ~30-line Python equivalent ships in
45
+ * `packages/pack-playwright/python/gateforge_persistence_intents.py`);
46
+ * the drain forwards intents to the witness, whose adapter SERVER PROBE
47
+ * (probeServer) runs witness-side and stamps `channel: 'server'`
48
+ * records for obligations registered `kind: server-e2e`.
49
+ */
50
+ export { appendSpoolEvent, readSpoolEvents, spoolPathFor, appendPersistenceIntent, readPersistenceIntents, persistenceIntentsPathFor, startSupervisorSpoolDrain, SupervisorClient, DEFAULT_DRAIN_POLL_MS, } from './supervisor/index.js';
51
+ export type { SpoolEvent, SpoolEventKind, SpoolDrainHandle, PersistenceIntent, PersistenceIntentOperation, PersistenceIntentPhase, PersistenceIntentExpectation, } from './supervisor/index.js';
52
+ export { buildRunnerChildEnv, RunnerEnvError, RUNNER_SECRET_ENV, RUNNER_PARENT_SIDE_ENV, RUNNER_GATEFORGE_ALLOWLIST, RUNNER_SYSTEM_ALLOWLIST, } from './discovery/runner-env.js';
53
+ export { synthesizeTrustedConfig, trustedReporterEntry, TRUSTED_CONFIG_FILE, TRUSTED_REPORTER_OPTIONS_FILE, } from './discovery/trusted-config.js';
54
+ export type { TrustedConfigInput, TrustedReporterOptions } from './discovery/trusted-config.js';
55
+ /**
56
+ * Test discovery (plan 2026-09-13 phase 2): bounded static scanning,
57
+ * native `--list` reconciliation, kind/category inference, the
58
+ * runner-adapter implementations, and the bounded pytest diagnostic
59
+ * adapter.
60
+ */
61
+ export { discoverTestCatalog, inferTestKind, listNativePlaywrightTests, findPlaywrightConfig, untrustedEnv, reconciliationKey, splitPytestNodeId, fileDigest, scanTestFiles, parseJunitXml, pytestCollectArgv, pytestExecutionArgv, collectPytestSuite, executePytestSuite, executeSupervisedPlaywright, readRunnerOutcomes, playwrightVersion, PlaywrightAdapter, PytestAdapter, TestDiscoveryError, JunitParseError, AdapterCapabilityError, DEFAULT_LIST_TIMEOUT_MS, DEFAULT_RUN_TIMEOUT_MS, UNRESOLVED_TITLE_PLACEHOLDER, DEFAULT_MAX_TRAVERSED_FILES, DEFAULT_MAX_IMPORT_DEPTH, BROWSER_FIXTURE_PARAMS, API_FIXTURE_PARAMS, } from './discovery/index.js';
62
+ export type { StaticScanOptions, StaticScanResult, StaticTestEntry, StaticTestFacts, StaticUnresolved, StaticParseError, NativeInstance, NativeListResult, InferenceFacts, InferenceResult, JunitDocument, JunitTestCase, PytestCollectedCase, PytestCollectionResult, DiscoverOptions, DiscoverResult, AdapterOptions, DiagnosticRunResult, DiagnosticRunStatus, DiagnosticCause, RunnerOutcomesDocument, SupervisedRunOptions, } from './discovery/index.js';
63
+ export { CLAIM_ANNOTATION_TYPE, RUN_HEADER, VERIFIER_HEADER, ENV_FINGERPRINT_HEADER, ATTESTATION_SCOPE_HEADER, UI_ACTION_KIND, UI_VISIBLE_RESULT_KIND, PERSISTENCE_KIND, ENV_RUN_ID, ENV_RUN_TOKEN, ENV_STATE_DIR, ENV_OBLIGATIONS, ENV_WITNESS_URL, ENV_APP_BASE_URL, ENV_TARGET_BASE_URL, ENV_TARGET_FINGERPRINT, ENV_ADAPTERS_DIR, ENV_CLASSIFICATIONS, ENV_ADAPTER_BASE_URL, WITNESS_URL_FILE, ENV_REPORTER_FAIL_RUN, ENV_OUTCOMES_FILE, CLAIM_INJECTIONS_FILE, EXECUTION_RESULT_FILE, GATE_RECEIPT_FILE, DIAGNOSTICS_REPORT_FILE, SPOOL_DIR_NAME, SPOOL_EVENTS_FILE, SPOOL_INTENTS_FILE, SERVER_CHANNEL, SERVER_E2E_TEST_KIND, DEFAULT_REQUEST_TIMEOUT_MS, } from './constants.js';
64
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACpD,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,0BAA0B,EAC1B,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,iBAAiB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACpG,YAAY,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC5E,YAAY,EAAE,wBAAwB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEhG,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACpG,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,0BAA0B,EAC1B,mBAAmB,EACnB,sBAAsB,EACtB,gBAA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0,0 +1,55 @@
1
+ /**
2
+ * @gate-forge/pack-playwright — the Playwright evidence pack.
3
+ *
4
+ * Public surface:
5
+ *
6
+ * - Fixture: `{ test, expect }` — the extended runner exposing the
7
+ * trusted `evidence` primitives (tests import from THIS package,
8
+ * never raw `playwright/test` — GF-24).
9
+ * - Reporter: `GateforgeReporter` — annotations → claims.json +
10
+ * records.json into the run-state dir, per-claim verdicts via the
11
+ * engine, gate pass/fail summary (GF-23 enforcement).
12
+ * - Witness: `startWitness` + `startWitnessProcess` — loopback
13
+ * engine-side service (GF-10/11/13), plus the `gateforge-witness`
14
+ * bin.
15
+ * - Attestation: `startAttestationProxy` — stamps a disposable loopback
16
+ * app with the env-fingerprint markers (GF-13).
17
+ * - Setup: `gateforgeGlobalSetup` / `gateforgeGlobalTeardown` — spawn
18
+ * the witness deterministically before workers (no races).
19
+ */
20
+ export { test, expect } from './fixture/fixture.js';
21
+ export { createEvidence, claimsFromAnnotations, resourceIdOfClaim, SURFACE_DESCRIPTOR_VERSION, } from './fixture/evidence.js';
22
+ export { WitnessClient, WitnessRequestError, resolveWitnessUrl } from './fixture/witness-client.js';
23
+ export { GateforgeReporter, gateSummaryLine } from './reporter/reporter.js';
24
+ export { startWitness, WitnessStartupError, recordIdOf } from './witness/server.js';
25
+ export { loadAdapters, validateAdapter, AdapterRegistryError } from './witness/adapter-registry.js';
26
+ export { isLoopbackUrl, isLoopbackUrlResolving, clearLoopbackCacheForTests, probeEnvFingerprint, envFingerprintMismatch, AttestationError, } from './witness/env-attestation.js';
27
+ export { loadClassifications, toClassificationView } from './witness/classifications.js';
28
+ export { startAttestationProxy } from './attestation/proxy.js';
29
+ export { gateforgeGlobalSetup, gateforgeGlobalTeardown, startWitnessProcess } from './setup.js';
30
+ /**
31
+ * Supervisor surface (enforcement-review fixes 2a/3): the lifecycle
32
+ * spool (runner → CLI), the verifier-key-authenticated supervisor
33
+ * client, and the spool drain the trusted CLI runs while the suite
34
+ * executes. The runner child itself holds no supervisor rights.
35
+ *
36
+ * Server-witnessed persistence channel: `appendPersistenceIntent` is the
37
+ * documented TS writer for the suite-side intents spool (the CONTRACT is
38
+ * the JSONL line — a ~30-line Python equivalent ships in
39
+ * `packages/pack-playwright/python/gateforge_persistence_intents.py`);
40
+ * the drain forwards intents to the witness, whose adapter SERVER PROBE
41
+ * (probeServer) runs witness-side and stamps `channel: 'server'`
42
+ * records for obligations registered `kind: server-e2e`.
43
+ */
44
+ export { appendSpoolEvent, readSpoolEvents, spoolPathFor, appendPersistenceIntent, readPersistenceIntents, persistenceIntentsPathFor, startSupervisorSpoolDrain, SupervisorClient, DEFAULT_DRAIN_POLL_MS, } from './supervisor/index.js';
45
+ export { buildRunnerChildEnv, RunnerEnvError, RUNNER_SECRET_ENV, RUNNER_PARENT_SIDE_ENV, RUNNER_GATEFORGE_ALLOWLIST, RUNNER_SYSTEM_ALLOWLIST, } from './discovery/runner-env.js';
46
+ export { synthesizeTrustedConfig, trustedReporterEntry, TRUSTED_CONFIG_FILE, TRUSTED_REPORTER_OPTIONS_FILE, } from './discovery/trusted-config.js';
47
+ /**
48
+ * Test discovery (plan 2026-09-13 phase 2): bounded static scanning,
49
+ * native `--list` reconciliation, kind/category inference, the
50
+ * runner-adapter implementations, and the bounded pytest diagnostic
51
+ * adapter.
52
+ */
53
+ export { discoverTestCatalog, inferTestKind, listNativePlaywrightTests, findPlaywrightConfig, untrustedEnv, reconciliationKey, splitPytestNodeId, fileDigest, scanTestFiles, parseJunitXml, pytestCollectArgv, pytestExecutionArgv, collectPytestSuite, executePytestSuite, executeSupervisedPlaywright, readRunnerOutcomes, playwrightVersion, PlaywrightAdapter, PytestAdapter, TestDiscoveryError, JunitParseError, AdapterCapabilityError, DEFAULT_LIST_TIMEOUT_MS, DEFAULT_RUN_TIMEOUT_MS, UNRESOLVED_TITLE_PLACEHOLDER, DEFAULT_MAX_TRAVERSED_FILES, DEFAULT_MAX_IMPORT_DEPTH, BROWSER_FIXTURE_PARAMS, API_FIXTURE_PARAMS, } from './discovery/index.js';
54
+ export { CLAIM_ANNOTATION_TYPE, RUN_HEADER, VERIFIER_HEADER, ENV_FINGERPRINT_HEADER, ATTESTATION_SCOPE_HEADER, UI_ACTION_KIND, UI_VISIBLE_RESULT_KIND, PERSISTENCE_KIND, ENV_RUN_ID, ENV_RUN_TOKEN, ENV_STATE_DIR, ENV_OBLIGATIONS, ENV_WITNESS_URL, ENV_APP_BASE_URL, ENV_TARGET_BASE_URL, ENV_TARGET_FINGERPRINT, ENV_ADAPTERS_DIR, ENV_CLASSIFICATIONS, ENV_ADAPTER_BASE_URL, WITNESS_URL_FILE, ENV_REPORTER_FAIL_RUN, ENV_OUTCOMES_FILE, CLAIM_INJECTIONS_FILE, EXECUTION_RESULT_FILE, GATE_RECEIPT_FILE, DIAGNOSTICS_REPORT_FILE, SPOOL_DIR_NAME, SPOOL_EVENTS_FILE, SPOOL_INTENTS_FILE, SERVER_CHANNEL, SERVER_E2E_TEST_KIND, DEFAULT_REQUEST_TIMEOUT_MS, } from './constants.js';
55
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,0BAA0B,GAM3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAGpG,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG5E,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACp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EACf,sBAAsB,EACtB,wBAAwB,EACxB,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,aAAa,EACb,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC"}
package/dist/json.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * GF-canonical-JSON serialization for witness/reporter payloads.
3
+ *
4
+ * All hashes, state artifacts, and comparisons in the pack must go
5
+ * through the pin-#1 canonical form. The frozen core `canonicalJson`
6
+ * requires a compile-time `JsonValue`; wire payloads and adapter
7
+ * responses arrive as `unknown`, so this module re-checks with the core
8
+ * `isJsonValue` guard and renders the canonical form (or throws — a
9
+ * non-JSON payload is a contract violation, never a silent truncation).
10
+ */
11
+ import { isJsonValue } from '@gate-forge/core';
12
+ /** Throws unless the value is JSON-representable, then canonicalizes it. */
13
+ export declare function canonicalOf(value: unknown): string;
14
+ /** JSON-representable check for wire payloads before hashing. */
15
+ export { isJsonValue };
16
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAiB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE9D,4EAA4E;AAC5E,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKlD;AAED,iEAAiE;AACjE,OAAO,EAAE,WAAW,EAAE,CAAC"}
package/dist/json.js ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * GF-canonical-JSON serialization for witness/reporter payloads.
3
+ *
4
+ * All hashes, state artifacts, and comparisons in the pack must go
5
+ * through the pin-#1 canonical form. The frozen core `canonicalJson`
6
+ * requires a compile-time `JsonValue`; wire payloads and adapter
7
+ * responses arrive as `unknown`, so this module re-checks with the core
8
+ * `isJsonValue` guard and renders the canonical form (or throws — a
9
+ * non-JSON payload is a contract violation, never a silent truncation).
10
+ */
11
+ import { canonicalJson, isJsonValue } from '@gate-forge/core';
12
+ /** Throws unless the value is JSON-representable, then canonicalizes it. */
13
+ export function canonicalOf(value) {
14
+ if (!isJsonValue(value)) {
15
+ throw new TypeError('value is not GF-canonical-JSON-representable');
16
+ }
17
+ return canonicalJson(value);
18
+ }
19
+ /** JSON-representable check for wire payloads before hashing. */
20
+ export { isJsonValue };
21
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE9D,4EAA4E;AAC5E,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,SAAS,CAAC,8CAA8C,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,iEAAiE;AACjE,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Reporter ledger computation (pure helpers).
3
+ *
4
+ * Per-claim verdicts are computed with the REAL verdict engine
5
+ * (`evaluateObligation`, G3 pin #9) — the reporter never trusts a test's
6
+ * own conclusion. Per-claim isolation: each row evaluates exactly that
7
+ * test's claim against the run's witness ledger; the engine attributes
8
+ * records by (obligationId, testId), so a claim cannot borrow another
9
+ * test's evidence.
10
+ *
11
+ * The ledger needs the run's obligations (from `GATEFORGE_OBLIGATIONS`)
12
+ * and each resource's classification (primaryKey etc.) from the witness
13
+ * (`GET /classifications`). When either is unavailable the row carries
14
+ * `verdict: null` and the reason says exactly what is missing.
15
+ */
16
+ import { type Classification, type HttpRouteCandidate, type Verdict } from '@gate-forge/core';
17
+ import type { IssuedLedgerRecord } from '../fixture/witness-client.js';
18
+ /** One suite-visible obligation from `obligations.json` (state contract). */
19
+ export interface StateObligationEntry {
20
+ id: string;
21
+ resourceId: string;
22
+ contract: string;
23
+ policyId: string;
24
+ lifecycle: {
25
+ create: boolean;
26
+ read: boolean;
27
+ update: boolean;
28
+ delete: boolean;
29
+ deleteSemantics?: 'hard' | 'archive';
30
+ archiveFields?: Record<string, string | number | boolean>;
31
+ updateableFields?: string[];
32
+ };
33
+ fingerprint: string;
34
+ source: string;
35
+ location: {
36
+ file: string;
37
+ line: number;
38
+ col: number;
39
+ } | null;
40
+ }
41
+ /** The obligations document the CLI writes (`{schemaVersion, obligations}`). */
42
+ export interface ObligationsDocument {
43
+ schemaVersion: number;
44
+ obligations: StateObligationEntry[];
45
+ }
46
+ /** A claim extracted from one test's annotations. */
47
+ export interface LedgerClaim {
48
+ obligationId: string;
49
+ testId: string;
50
+ testFile: string;
51
+ location: {
52
+ file: string;
53
+ line: number;
54
+ col: number;
55
+ } | null;
56
+ }
57
+ /** One ledger row: one test's claim judged by the engine. */
58
+ export interface LedgerRow {
59
+ claim: string;
60
+ testId: string;
61
+ testFile: string;
62
+ verdict: Verdict | null;
63
+ reason: string | null;
64
+ recordIds: string[];
65
+ trustTier: 'witnessed' | 'claimed' | null;
66
+ }
67
+ /** Load a valid claim-shaped object from the annotation source. */
68
+ export declare function claimOf(obligationId: string, test: {
69
+ id: string;
70
+ location?: {
71
+ file: string;
72
+ line: number;
73
+ column: number;
74
+ } | null;
75
+ }): LedgerClaim;
76
+ /** Parses the obligations document (fail-lenient: missing → null). */
77
+ export declare function parseObligationsDocument(raw: string): ObligationsDocument | null;
78
+ /**
79
+ * Computes one ledger row for a claim.
80
+ *
81
+ * Advisory only (plan §9): the reporter runs inside the suite-side
82
+ * runtime, so its rows can never be authoritative. HTTP rows grade
83
+ * against the CLI-derived route inventory when the caller supplies it;
84
+ * without route context the core resolver blocks with a missing-context
85
+ * result — the reporter never shows an authoritative pass merely
86
+ * because it lacked the inventory.
87
+ *
88
+ * Args:
89
+ * claim: the claim under judgment.
90
+ * obligations: the run's obligations (state doc).
91
+ * classifications: per-resource classification map (witness surface).
92
+ * records: the full run ledger.
93
+ * now: injected instant for the verdict engine.
94
+ * httpRoutes: advisory route inventory (CLI-derived `http-routes.json`
95
+ * when present, else null). The authoritative CLI recomputes this
96
+ * from source and never trusts a reporter-supplied list.
97
+ *
98
+ * Returns:
99
+ * LedgerRow: verdict + reason + considered record ids. `verdict:
100
+ * null` (with reason) when required context is missing.
101
+ */
102
+ export declare function ledgerRowFor(claim: LedgerClaim, obligations: ObligationsDocument | null, classifications: Record<string, Classification>, records: readonly IssuedLedgerRecord[], now: string, httpRoutes?: readonly HttpRouteCandidate[] | null): LedgerRow;
103
+ /** Blocks the run? (satisfied/waived are clean.) */
104
+ export declare function isBlocking(verdict: Verdict | null): boolean;
105
+ //# sourceMappingURL=ledger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../../src/reporter/ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,kBAAkB,EAEvB,KAAK,OAAO,EACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,6EAA6E;AAC7E,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EA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