@getcirrus/space-conformance 0.0.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/base-D8a-ZK57.d.ts +249 -0
- package/dist/base-D8a-ZK57.d.ts.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +373 -0
- package/dist/cli.js.map +1 -0
- package/dist/coverage-DhJZu8P8.js +1914 -0
- package/dist/coverage-DhJZu8P8.js.map +1 -0
- package/dist/full-D4ufJLcw.js +409 -0
- package/dist/full-D4ufJLcw.js.map +1 -0
- package/dist/full.d.ts +59 -0
- package/dist/full.d.ts.map +1 -0
- package/dist/full.js +4 -0
- package/dist/index.d.ts +178 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +114 -0
- package/dist/index.js.map +1 -0
- package/dist/operator-BErXCDow.js +923 -0
- package/dist/operator-BErXCDow.js.map +1 -0
- package/lexicons/MANIFEST.json +7 -0
- package/lexicons/simplespace/addMember.json +37 -0
- package/lexicons/simplespace/checkUserAccess.json +43 -0
- package/lexicons/simplespace/createSpace.json +74 -0
- package/lexicons/simplespace/defs.json +47 -0
- package/lexicons/simplespace/deleteSpace.json +32 -0
- package/lexicons/simplespace/getSpace.json +53 -0
- package/lexicons/simplespace/listMembers.json +65 -0
- package/lexicons/simplespace/removeMember.json +37 -0
- package/lexicons/simplespace/updateSpace.json +57 -0
- package/lexicons/space/applyWrites.json +163 -0
- package/lexicons/space/createRecord.json +79 -0
- package/lexicons/space/defs.json +38 -0
- package/lexicons/space/deleteRecord.json +51 -0
- package/lexicons/space/getBlob.json +54 -0
- package/lexicons/space/getDelegationToken.json +34 -0
- package/lexicons/space/getLatestCommit.json +57 -0
- package/lexicons/space/getRecord.json +76 -0
- package/lexicons/space/getRepo.json +41 -0
- package/lexicons/space/getSpaceCredential.json +67 -0
- package/lexicons/space/listBlobs.json +59 -0
- package/lexicons/space/listRecords.json +108 -0
- package/lexicons/space/listRepoOps.json +111 -0
- package/lexicons/space/listRepos.json +75 -0
- package/lexicons/space/listSpaces.json +65 -0
- package/lexicons/space/notifySpaceDeleted.json +24 -0
- package/lexicons/space/notifyWrite.json +38 -0
- package/lexicons/space/putRecord.json +75 -0
- package/lexicons/space/registerNotify.json +49 -0
- package/lexicons/space/unregisterNotify.json +29 -0
- package/package.json +53 -0
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","names":["capabilities: Capability[]","context: Omit<CheckContext, \"state\" | \"log\">","resolveParams!: (params: URLSearchParams) => void","rejectParams!: (err: Error) => void","oauthOperator: OAuthOperator | undefined"],"sources":["../src/cli/run.ts","../src/cli/oauth.ts","../src/cli/main.ts"],"sourcesContent":["/**\n * The CLI's core: resolve a target, assemble a context from what the\n * invocation can provide, run the catalog. Exported separately from the\n * bin so it can be driven in tests against an injected fetch without\n * spawning a process.\n */\n\nimport { filterCatalog } from \"../registry.js\";\nimport { runChecks, type RunReport } from \"../runner.js\";\nimport { fullCatalog } from \"../full.js\";\nimport { KeypairIdentityProvider } from \"../identity.js\";\nimport type { Capability, CheckContext, Tier } from \"../model.js\";\n\n/** The alpha build the suite's verifiers are pinned to (from our deps). */\nconst ALPHA_BUILD = \"0.0.0-spaces-alpha-20260818163953\";\n\nexport interface RunConformanceOptions {\n\torigin: string;\n\t/** Target DID; resolved from the origin's did.json when omitted. */\n\tdid?: string;\n\timplementation?: string;\n\t/** Operator bearer token; enables the operator capability when present. */\n\toperatorToken?: string;\n\t/**\n\t * Mint the operator token by signing in: `com.atproto.server.createSession`\n\t * with this handle and {@link password}. Works against any standard PDS —\n\t * unlike a deployment-specific static token. Ignored when\n\t * {@link operatorToken} is set.\n\t */\n\thandle?: string;\n\t/**\n\t * The account password for {@link handle}. The bin only ever sources this\n\t * from the environment (`SPACE_CONFORMANCE_PASSWORD`) — never argv, which\n\t * leaks into shell history and process listings. Use the main password:\n\t * app passwords are refused on space routes.\n\t */\n\tpassword?: string;\n\t/**\n\t * An authenticated fetch for operator calls — a DPoP-bound OAuth session\n\t * from the loopback sign-in, which must sign each request individually\n\t * and so cannot be expressed as a bearer header. Takes precedence over\n\t * {@link operatorToken} and {@link handle}.\n\t */\n\toperatorFetch?: typeof fetch;\n\t/**\n\t * The target is a standalone space host rather than a full PDS: withhold\n\t * the `pds-blobs` and `pds-delegation` capabilities so the checks needing\n\t * `repo.uploadBlob` / `getDelegationToken` skip instead of false-failing.\n\t */\n\tstandaloneHost?: boolean;\n\t/**\n\t * Provide harness identities. Only meaningful when the target can\n\t * resolve them — either an in-process fixture wired to the provider, or\n\t * a live deployment publishing the DIDs. A bare CLI against a remote\n\t * host cannot, so identity-requiring checks skip by default.\n\t */\n\tidentities?: boolean;\n\ttiers?: Tier[];\n\tdestructive?: boolean;\n\tslow?: boolean;\n\tsuiteVersion: string;\n\t/** Injectable for tests; defaults to the global fetch. */\n\tfetch?: typeof fetch;\n}\n\nexport async function runConformance(\n\toptions: RunConformanceOptions,\n): Promise<RunReport> {\n\tconst doFetch = options.fetch ?? fetch;\n\t// A trailing slash on --target would otherwise produce a double slash in\n\t// the DID-document URL, which some hosts 404.\n\tconst origin = options.origin.replace(/\\/+$/, \"\");\n\tconst did = options.did ?? (await resolveDid(doFetch, origin));\n\n\tlet operatorToken = options.operatorToken;\n\tif (!operatorToken && !options.operatorFetch && options.handle) {\n\t\tif (!options.password) {\n\t\t\tthrow new Error(\n\t\t\t\t\"--handle needs a password: set SPACE_CONFORMANCE_PASSWORD in the environment (or use --oauth)\",\n\t\t\t);\n\t\t}\n\t\toperatorToken = await createSession(\n\t\t\tdoFetch,\n\t\t\torigin,\n\t\t\toptions.handle,\n\t\t\toptions.password,\n\t\t);\n\t}\n\n\tconst capabilities: Capability[] = [];\n\tif (operatorToken || options.operatorFetch) {\n\t\tcapabilities.push(\"operator\");\n\t\t// A full PDS exposes the blob endpoints and getDelegationToken; only a\n\t\t// standalone space host lacks them.\n\t\tif (!options.standaloneHost) {\n\t\t\tcapabilities.push(\"pds-blobs\", \"pds-delegation\");\n\t\t}\n\t}\n\tif (options.identities) capabilities.push(\"identities\");\n\n\tconst context: Omit<CheckContext, \"state\" | \"log\"> = {\n\t\ttarget: {\n\t\t\torigin,\n\t\t\tdid,\n\t\t\timplementation: options.implementation,\n\t\t},\n\t\tfetch: doFetch,\n\t\t...(options.operatorFetch\n\t\t\t? { operator: { oauth: true, fetch: options.operatorFetch } }\n\t\t\t: operatorToken\n\t\t\t\t? {\n\t\t\t\t\t\toperator: {\n\t\t\t\t\t\t\toauth: false,\n\t\t\t\t\t\t\tasync authorize(init) {\n\t\t\t\t\t\t\t\tinit.headers.set(\"Authorization\", `Bearer ${operatorToken}`);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t...(options.identities\n\t\t\t? { identities: new KeypairIdentityProvider() }\n\t\t\t: {}),\n\t};\n\n\tconst catalog = filterCatalog(fullCatalog, {\n\t\ttiers: options.tiers,\n\t\tcapabilities,\n\t\tdestructive: options.destructive,\n\t\tslow: options.slow,\n\t});\n\n\treturn runChecks({\n\t\tcatalog,\n\t\tcontext,\n\t\tsuiteVersion: options.suiteVersion,\n\t\talphaBuild: ALPHA_BUILD,\n\t});\n}\n\n/**\n * Sign in at the target and return the session's access token. This is the\n * portable way to get operator auth: every standard PDS implements\n * `com.atproto.server.createSession`, where a static bearer like Cirrus's\n * AUTH_TOKEN is deployment-specific.\n */\nasync function createSession(\n\tdoFetch: typeof fetch,\n\torigin: string,\n\tidentifier: string,\n\tpassword: string,\n): Promise<string> {\n\tconst res = await doFetch(`${origin}/xrpc/com.atproto.server.createSession`, {\n\t\tmethod: \"POST\",\n\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\tbody: JSON.stringify({ identifier, password }),\n\t});\n\tconst body = (await res.json().catch(() => ({}))) as {\n\t\taccessJwt?: string;\n\t\terror?: string;\n\t\tmessage?: string;\n\t};\n\tif (!res.ok || !body.accessJwt) {\n\t\tthrow new Error(\n\t\t\t`createSession failed for ${identifier} at ${origin}: ${res.status} ${body.error ?? \"\"} ${body.message ?? \"\"}`.trim(),\n\t\t);\n\t}\n\treturn body.accessJwt;\n}\n\nasync function resolveDid(\n\tdoFetch: typeof fetch,\n\torigin: string,\n): Promise<string> {\n\tconst res = await doFetch(`${origin}/.well-known/did.json`);\n\tif (!res.ok) {\n\t\tthrow new Error(\n\t\t\t`could not resolve target DID from ${origin}/.well-known/did.json (${res.status}); pass --did`,\n\t\t);\n\t}\n\tconst doc = (await res.json()) as { id?: string };\n\tif (!doc.id) throw new Error(\"did.json has no id; pass --did\");\n\treturn doc.id;\n}\n","/**\n * OAuth loopback sign-in for the CLI — the `gh auth login` shape: start an\n * ephemeral 127.0.0.1 callback server, register as an atproto loopback\n * client, open the authorization URL in the user's browser, and exchange\n * the callback for a DPoP-bound session.\n *\n * This is the auth path that involves no password at all and works against\n * any PDS with an atproto OAuth server. The session's tokens are DPoP-bound\n * — unusable as a plain bearer — so the run authenticates through\n * `operator.fetch`, with the client library signing every request (and\n * handling nonce challenges) rather than a static header.\n */\n\nimport { createServer } from \"node:http\";\nimport { spawn } from \"node:child_process\";\nimport {\n\tNodeOAuthClient,\n\ttype NodeSavedSession,\n\ttype NodeSavedState,\n\ttype OAuthSession,\n} from \"@atproto/oauth-client-node\";\n\n/**\n * The scope the conformance run signs in with: generic repo access (for\n * uploadBlob) plus full record actions and space management on the probe\n * space type under the user's own authority. Mirrors the web checker.\n */\nconst OAUTH_SCOPE =\n\t\"atproto transition:generic space:app.bsky.group?collection=*&manage=create&manage=update&manage=delete\";\n\n/** How long to wait for the user to complete the browser flow. */\nconst CALLBACK_TIMEOUT_MS = 5 * 60 * 1000;\n\nexport interface OAuthOperator {\n\t/** Signs same-origin requests with the session's DPoP key. */\n\tfetch: typeof fetch;\n\tdid: string;\n\t/** Best-effort token revocation once the run is done. */\n\tsignOut(): Promise<void>;\n}\n\n/**\n * A fetch that routes requests for `origin` through the session (which\n * signs them) and everything else through the plain global fetch — the\n * same shape as the web adapter, so checks keep their bare `ctx.fetch`\n * for deliberately-anonymous requests.\n */\nexport function originGatedFetch(\n\tsigning: (pathname: string, init?: RequestInit) => Promise<Response>,\n\torigin: string,\n): typeof fetch {\n\treturn (input, init) => {\n\t\tconst url = new URL(\n\t\t\ttypeof input === \"string\"\n\t\t\t\t? input\n\t\t\t\t: input instanceof URL\n\t\t\t\t\t? input.toString()\n\t\t\t\t\t: input.url,\n\t\t);\n\t\tif (url.origin === origin) {\n\t\t\treturn signing(url.pathname + url.search, init);\n\t\t}\n\t\treturn fetch(input, init);\n\t};\n}\n\n/** Open a URL in the platform browser, best-effort; never throws. */\nfunction openBrowser(url: string): void {\n\tconst [cmd, args] =\n\t\tprocess.platform === \"darwin\"\n\t\t\t? [\"open\", [url]]\n\t\t\t: process.platform === \"win32\"\n\t\t\t\t? [\"cmd\", [\"/c\", \"start\", \"\", url]]\n\t\t\t\t: [\"xdg-open\", [url]];\n\ttry {\n\t\tspawn(cmd, args, { stdio: \"ignore\", detached: true }).unref();\n\t} catch {\n\t\t// The URL is printed either way; opening is a convenience.\n\t}\n}\n\nexport async function oauthSignIn(options: {\n\thandle: string;\n\ttargetOrigin: string;\n\tlog?: (message: string) => void;\n}): Promise<OAuthOperator> {\n\tconst log = options.log ?? (() => {});\n\n\t// An ephemeral callback server; the OS picks the port, which then\n\t// becomes part of the loopback client's registration.\n\tlet resolveParams!: (params: URLSearchParams) => void;\n\tlet rejectParams!: (err: Error) => void;\n\tconst paramsPromise = new Promise<URLSearchParams>((resolve, reject) => {\n\t\tresolveParams = resolve;\n\t\trejectParams = reject;\n\t});\n\tconst server = createServer((req, res) => {\n\t\tconst url = new URL(req.url ?? \"/\", \"http://127.0.0.1\");\n\t\tif (url.pathname !== \"/callback\") {\n\t\t\tres.writeHead(404).end();\n\t\t\treturn;\n\t\t}\n\t\tres\n\t\t\t.writeHead(200, { \"Content-Type\": \"text/html; charset=utf-8\" })\n\t\t\t.end(\n\t\t\t\t\"<!doctype html><meta charset=utf-8><title>space-conformance</title>\" +\n\t\t\t\t\t\"<p style='font:16px system-ui;margin:3em'>Signed in — you can close this tab and return to the terminal.</p>\",\n\t\t\t);\n\t\tresolveParams(url.searchParams);\n\t});\n\tawait new Promise<void>((resolve) => server.listen(0, \"127.0.0.1\", resolve));\n\tconst address = server.address();\n\tif (address === null || typeof address !== \"object\") {\n\t\tserver.close();\n\t\tthrow new Error(\"could not bind the OAuth callback server\");\n\t}\n\tconst redirectUri = `http://127.0.0.1:${address.port}/callback`;\n\n\tconst timer = setTimeout(() => {\n\t\trejectParams(\n\t\t\tnew Error(\n\t\t\t\t`timed out after ${CALLBACK_TIMEOUT_MS / 60000} minutes waiting for the browser sign-in`,\n\t\t\t),\n\t\t);\n\t}, CALLBACK_TIMEOUT_MS);\n\n\ttry {\n\t\t// A loopback client: the client_id itself carries the registration.\n\t\t// One-shot in-memory stores — the session lives and dies with this\n\t\t// process, which is the point of a conformance run.\n\t\tconst clientId = `http://localhost?${new URLSearchParams({\n\t\t\tredirect_uri: redirectUri,\n\t\t\tscope: OAUTH_SCOPE,\n\t\t}).toString()}`;\n\t\tconst stateStore = new Map<string, NodeSavedState>();\n\t\tconst sessionStore = new Map<string, NodeSavedSession>();\n\t\tconst client = new NodeOAuthClient({\n\t\t\tclientMetadata: {\n\t\t\t\tclient_id: clientId,\n\t\t\t\tredirect_uris: [redirectUri as `http://127.0.0.1:${string}`],\n\t\t\t\tscope: OAUTH_SCOPE,\n\t\t\t\ttoken_endpoint_auth_method: \"none\",\n\t\t\t\tgrant_types: [\"authorization_code\", \"refresh_token\"],\n\t\t\t\tresponse_types: [\"code\"],\n\t\t\t\tdpop_bound_access_tokens: true,\n\t\t\t},\n\t\t\tstateStore: {\n\t\t\t\tset: async (key, value) => void stateStore.set(key, value),\n\t\t\t\tget: async (key) => stateStore.get(key),\n\t\t\t\tdel: async (key) => void stateStore.delete(key),\n\t\t\t},\n\t\t\tsessionStore: {\n\t\t\t\tset: async (key, value) => void sessionStore.set(key, value),\n\t\t\t\tget: async (key) => sessionStore.get(key),\n\t\t\t\tdel: async (key) => void sessionStore.delete(key),\n\t\t\t},\n\t\t\t// Local dev targets (wrangler dev, the reference harness) are http.\n\t\t\tallowHttp: options.targetOrigin.startsWith(\"http://\"),\n\t\t});\n\n\t\tconst authorizeUrl = await client.authorize(options.handle, {\n\t\t\tscope: OAUTH_SCOPE,\n\t\t});\n\t\tlog(`Opening browser to authorize ${options.handle}…`);\n\t\tlog(`If it does not open, visit:\\n ${authorizeUrl.toString()}`);\n\t\topenBrowser(authorizeUrl.toString());\n\n\t\tconst params = await paramsPromise;\n\t\tconst { session } = await client.callback(params);\n\t\tlog(`Signed in as ${session.did}`);\n\t\treturn {\n\t\t\tdid: session.did,\n\t\t\tfetch: originGatedFetch(\n\t\t\t\t(pathname, init) => session.fetchHandler(pathname, init),\n\t\t\t\toptions.targetOrigin,\n\t\t\t),\n\t\t\tsignOut: () => sessionSignOut(session),\n\t\t};\n\t} finally {\n\t\tclearTimeout(timer);\n\t\tserver.close();\n\t}\n}\n\nasync function sessionSignOut(session: OAuthSession): Promise<void> {\n\ttry {\n\t\tawait session.signOut();\n\t} catch {\n\t\t// Best-effort: the tokens die with the process either way.\n\t}\n}\n","#!/usr/bin/env node\n/**\n * space-conformance CLI.\n *\n * space-conformance run --target https://host [--did did:...] \\\n * [--handle alice.example.com] [--oauth] [--standalone-host] \\\n * [--destructive] [--tier must,should] [--report out.json] [--json]\n * space-conformance coverage [--json]\n *\n * Operator auth (any one of):\n * --oauth --handle you.example.com — browser sign-in via the atproto\n * OAuth loopback flow; no password ever touches this process. Works\n * against any PDS with an OAuth server.\n * --handle + password — signs in via com.atproto.server.createSession;\n * the password comes from SPACE_CONFORMANCE_PASSWORD or an interactive\n * hidden prompt, never argv. Use the main password: app passwords are\n * refused on space routes.\n * SPACE_CONFORMANCE_TOKEN env — a bearer the target accepts (a session\n * accessJwt, or a deployment-specific static token).\n * --operator-token TOKEN — same, via argv; prefer the env var, since\n * argv leaks into shell history and process listings.\n *\n * Exit code is non-zero when any `must` check fails or errors, so it\n * gates CI.\n */\n\nimport { parseArgs } from \"node:util\";\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\nimport { dirname, join } from \"node:path\";\nimport { createInterface } from \"node:readline\";\nimport { coverageReport } from \"../coverage.js\";\nimport { fullCatalog } from \"../full.js\";\nimport { renderReport } from \"../runner.js\";\nimport { runConformance } from \"./run.js\";\nimport { oauthSignIn, type OAuthOperator } from \"./oauth.js\";\nimport type { Tier } from \"../model.js\";\n\n/**\n * Read a password from the terminal with echo suppressed. Only offered on\n * a TTY — a piped stdin gets the env-var error instead, so scripts fail\n * loudly rather than hanging on a prompt nobody sees.\n */\nfunction promptPassword(prompt: string): Promise<string> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst stdin = process.stdin;\n\t\tconst stderr = process.stderr;\n\t\tstderr.write(prompt);\n\t\tconst rl = createInterface({ input: stdin, terminal: true });\n\t\t// Suppress echo: readline writes keystrokes via its output stream;\n\t\t// giving it none and muting is fiddly, so toggle raw handling simply —\n\t\t// print nothing per keypress by not attaching an output stream.\n\t\trl.question(\"\", (answer) => {\n\t\t\tstderr.write(\"\\n\");\n\t\t\trl.close();\n\t\t\tresolve(answer);\n\t\t});\n\t\trl.on(\"error\", reject);\n\t});\n}\n\nfunction suiteVersion(): string {\n\ttry {\n\t\tconst here = dirname(fileURLToPath(import.meta.url));\n\t\tconst pkg = JSON.parse(\n\t\t\treadFileSync(join(here, \"..\", \"package.json\"), \"utf8\"),\n\t\t) as { version?: string };\n\t\treturn pkg.version ?? \"0.0.0\";\n\t} catch {\n\t\treturn \"0.0.0\";\n\t}\n}\n\nfunction parseTiers(value: string | undefined): Tier[] | undefined {\n\tif (!value) return undefined;\n\tconst tiers = value.split(\",\").map((t) => t.trim()) as Tier[];\n\tfor (const tier of tiers) {\n\t\tif (tier !== \"must\" && tier !== \"should\" && tier !== \"info\") {\n\t\t\tthrow new Error(`unknown tier: ${tier}`);\n\t\t}\n\t}\n\treturn tiers;\n}\n\nasync function main(argv: string[]): Promise<number> {\n\tconst command = argv[0];\n\n\tif (command === \"coverage\") {\n\t\tconst { values } = parseArgs({\n\t\t\targs: argv.slice(1),\n\t\t\toptions: { json: { type: \"boolean\" } },\n\t\t});\n\t\tconst report = coverageReport(fullCatalog);\n\t\tif (values.json) {\n\t\t\tprocess.stdout.write(`${JSON.stringify(report, null, 2)}\\n`);\n\t\t} else {\n\t\t\tprocess.stdout.write(\n\t\t\t\t`${report.covered.length}/${report.requirements.length} requirements covered, ${report.gaps.length} gaps\\n`,\n\t\t\t);\n\t\t\tfor (const gap of report.gaps) {\n\t\t\t\tprocess.stdout.write(` gap: ${gap.ref}\\n`);\n\t\t\t}\n\t\t\tfor (const d of report.danglingCitations) {\n\t\t\t\tprocess.stdout.write(` dangling: ${d.checkId} → ${d.ref}\\n`);\n\t\t\t}\n\t\t}\n\t\treturn report.danglingCitations.length > 0 ? 1 : 0;\n\t}\n\n\tif (command === \"run\") {\n\t\tconst { values } = parseArgs({\n\t\t\targs: argv.slice(1),\n\t\t\toptions: {\n\t\t\t\ttarget: { type: \"string\" },\n\t\t\t\tdid: { type: \"string\" },\n\t\t\t\timplementation: { type: \"string\" },\n\t\t\t\t\"operator-token\": { type: \"string\" },\n\t\t\t\thandle: { type: \"string\" },\n\t\t\t\toauth: { type: \"boolean\" },\n\t\t\t\t\"standalone-host\": { type: \"boolean\" },\n\t\t\t\tidentities: { type: \"boolean\" },\n\t\t\t\tdestructive: { type: \"boolean\" },\n\t\t\t\tslow: { type: \"boolean\" },\n\t\t\t\ttier: { type: \"string\" },\n\t\t\t\treport: { type: \"string\" },\n\t\t\t\tjson: { type: \"boolean\" },\n\t\t\t},\n\t\t});\n\t\tif (!values.target) {\n\t\t\tprocess.stderr.write(\"run requires --target <origin>\\n\");\n\t\t\treturn 2;\n\t\t}\n\n\t\tconst origin = values.target.replace(/\\/+$/, \"\");\n\t\tconst operatorToken =\n\t\t\tvalues[\"operator-token\"] ?? process.env.SPACE_CONFORMANCE_TOKEN;\n\n\t\t// The browser OAuth flow: no password ever enters this process, and\n\t\t// the session is DPoP-bound (unusable as a plain bearer).\n\t\tlet oauthOperator: OAuthOperator | undefined;\n\t\tif (values.oauth) {\n\t\t\tif (!values.handle) {\n\t\t\t\tprocess.stderr.write(\"--oauth requires --handle <your handle>\\n\");\n\t\t\t\treturn 2;\n\t\t\t}\n\t\t\toauthOperator = await oauthSignIn({\n\t\t\t\thandle: values.handle,\n\t\t\t\ttargetOrigin: origin,\n\t\t\t\tlog: (message) => process.stderr.write(`${message}\\n`),\n\t\t\t});\n\t\t}\n\n\t\t// Secrets come from the environment or an interactive hidden prompt,\n\t\t// never argv — argv leaks into shell history and process listings.\n\t\t// (--operator-token remains for CI where the value already lives in a\n\t\t// secret store, but SPACE_CONFORMANCE_TOKEN is the recommended route.)\n\t\tlet password = process.env.SPACE_CONFORMANCE_PASSWORD;\n\t\tif (\n\t\t\t!password &&\n\t\t\tvalues.handle &&\n\t\t\t!values.oauth &&\n\t\t\t!operatorToken &&\n\t\t\tprocess.stdin.isTTY\n\t\t) {\n\t\t\tpassword = await promptPassword(`Password for ${values.handle}: `);\n\t\t}\n\n\t\tconst report = await runConformance({\n\t\t\torigin,\n\t\t\tdid: values.did,\n\t\t\timplementation: values.implementation,\n\t\t\toperatorToken,\n\t\t\toperatorFetch: oauthOperator?.fetch,\n\t\t\thandle: values.handle,\n\t\t\tpassword,\n\t\t\tstandaloneHost: values[\"standalone-host\"],\n\t\t\tidentities: values.identities,\n\t\t\tdestructive: values.destructive,\n\t\t\tslow: values.slow,\n\t\t\ttiers: parseTiers(values.tier),\n\t\t\tsuiteVersion: suiteVersion(),\n\t\t});\n\t\t// Conformance sessions are ephemeral: revoke the OAuth tokens once\n\t\t// the run is done, best-effort.\n\t\tif (oauthOperator) await oauthOperator.signOut();\n\t\tif (values.report) {\n\t\t\twriteFileSync(values.report, `${JSON.stringify(report, null, 2)}\\n`);\n\t\t}\n\t\tprocess.stdout.write(\n\t\t\tvalues.json\n\t\t\t\t? `${JSON.stringify(report, null, 2)}\\n`\n\t\t\t\t: `${renderReport(report)}\\n`,\n\t\t);\n\t\t// Gate on must-tier failures AND must-tier errors; should/info never\n\t\t// fail the run. A must check that errored (an unreachable, hung or\n\t\t// malformed target) must exit non-zero too — otherwise a target\n\t\t// whose XRPC surface is down but whose did.json resolves would pass\n\t\t// CI green.\n\t\treturn report.summary.mustFail > 0 || report.summary.mustError > 0 ? 1 : 0;\n\t}\n\n\tprocess.stderr.write(\"usage: space-conformance <run|coverage> [options]\\n\");\n\treturn 2;\n}\n\nmain(process.argv.slice(2)).then(\n\t(code) => {\n\t\tprocess.exitCode = code;\n\t},\n\t(err) => {\n\t\tprocess.stderr.write(`${err instanceof Error ? err.stack : String(err)}\\n`);\n\t\tprocess.exitCode = 1;\n\t},\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAcA,MAAM,cAAc;AAmDpB,eAAsB,eACrB,SACqB;CACrB,MAAM,UAAU,QAAQ,SAAS;CAGjC,MAAM,SAAS,QAAQ,OAAO,QAAQ,QAAQ,GAAG;CACjD,MAAM,MAAM,QAAQ,OAAQ,MAAM,WAAW,SAAS,OAAO;CAE7D,IAAI,gBAAgB,QAAQ;AAC5B,KAAI,CAAC,iBAAiB,CAAC,QAAQ,iBAAiB,QAAQ,QAAQ;AAC/D,MAAI,CAAC,QAAQ,SACZ,OAAM,IAAI,MACT,gGACA;AAEF,kBAAgB,MAAM,cACrB,SACA,QACA,QAAQ,QACR,QAAQ,SACR;;CAGF,MAAMA,eAA6B,EAAE;AACrC,KAAI,iBAAiB,QAAQ,eAAe;AAC3C,eAAa,KAAK,WAAW;AAG7B,MAAI,CAAC,QAAQ,eACZ,cAAa,KAAK,aAAa,iBAAiB;;AAGlD,KAAI,QAAQ,WAAY,cAAa,KAAK,aAAa;CAEvD,MAAMC,UAA+C;EACpD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