@mostra/conformance 0.0.0-stage → 0.3.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reference-host-d6gs3Tal.js","names":[],"sources":["../src/harness/serve.ts","../src/reference-host.ts"],"sourcesContent":["/**\n * The host's side of the harness protocol, for hosts written in TypeScript: `serveHarness` reads\n * the kit's requests on stdin and answers them with the host's implementation, on stdout. A host\n * writes its shim as one small program around its real integration:\n *\n * ```ts\n * serveHarness({\n * initialize: () => ({ host: { name: \"my-host\", version: \"1.0.0\" }, ports: [\"submissions\"], features: [] }),\n * start: (params) => myHost.startMostra(params.home, params.env),\n * call: (method, params) => myHost.mostra.call(method, params),\n * stop: () => myHost.stopMostra(),\n * store: () => myHost.conformanceStore(),\n * });\n * ```\n *\n * Nothing but protocol messages may go to stdout; log to stderr.\n */\nimport { createDiagnostic, encodeLine, LineSplitter, RpcError, RpcPeer } from \"@mostra/protocol\";\nimport {\n CallParams,\n type CallResult,\n EventsParams,\n type EventsResult,\n HARNESS_METHODS,\n HARNESS_REVISIONS,\n type InitializeResult,\n ScriptParams,\n StartParams,\n type StartResult,\n type StoreResult,\n} from \"./protocol.ts\";\n\n/** What a TypeScript host implements to be driven by the kit. */\nexport interface HarnessImplementation {\n /** Who the host is, the ports it serves and its features. */\n initialize(): Omit<InitializeResult, \"revision\"> | Promise<Omit<InitializeResult, \"revision\">>;\n /** Starts (or attaches to) the host's instance for `params.home`, with its real ports. */\n start(params: StartParams): StartResult | Promise<StartResult>;\n /** Sends one host-protocol request through the host's client; throw an `RpcError` for an error answer. */\n call(method: string, params: unknown, timeoutMs?: number): unknown;\n /** Ends the host's session. */\n stop(): void | Promise<void>;\n /** What the host's own store holds. */\n store(): StoreResult | Promise<StoreResult>;\n /** Feature `faults`: answer a port as the kit asks. */\n script?(params: ScriptParams): void | Promise<void>;\n /** Feature `events`: read pages from the host's own named event stream. */\n events?(params: EventsParams): EventsResult | Promise<EventsResult>;\n}\n\nfunction invalid(method: string, message: string): RpcError {\n return new RpcError(\n createDiagnostic(\"MOSTRA_HOST_INVALID_PARAMS\", { message: `${method}: ${message}` }),\n -32602,\n );\n}\n\n/**\n * Serves the harness protocol on this process's stdin and stdout until stdin ends, then stops\n * the host's session and resolves.\n */\nexport function serveHarness(\n implementation: HarnessImplementation,\n io: { input?: NodeJS.ReadableStream; output?: NodeJS.WritableStream } = {},\n): Promise<void> {\n const input = io.input ?? process.stdin;\n const output = io.output ?? process.stdout;\n const peer = new RpcPeer({\n send: (message) => {\n output.write(encodeLine(message));\n },\n onRequest: async (method, params) => {\n switch (method) {\n case HARNESS_METHODS.initialize: {\n const revision = HARNESS_REVISIONS.at(-1) as string;\n return { revision, ...(await implementation.initialize()) };\n }\n case HARNESS_METHODS.start: {\n const parsed = StartParams.safeParse(params);\n if (!parsed.success) throw invalid(method, parsed.error.message);\n return await implementation.start(parsed.data);\n }\n case HARNESS_METHODS.call: {\n const parsed = CallParams.safeParse(params);\n if (!parsed.success) throw invalid(method, parsed.error.message);\n try {\n const result = await implementation.call(\n parsed.data.method,\n parsed.data.params,\n parsed.data.timeoutMs,\n );\n return { result: result ?? null } satisfies CallResult;\n } catch (error) {\n if (error instanceof RpcError)\n return {\n error: { code: error.code, data: { ...error.diagnostic } },\n } satisfies CallResult;\n throw error;\n }\n }\n case HARNESS_METHODS.stop:\n await implementation.stop();\n return {};\n case HARNESS_METHODS.store:\n return await implementation.store();\n case HARNESS_METHODS.script: {\n if (!implementation.script) break;\n const parsed = ScriptParams.safeParse(params);\n if (!parsed.success) throw invalid(method, parsed.error.message);\n await implementation.script(parsed.data);\n return {};\n }\n case HARNESS_METHODS.events: {\n if (!implementation.events) break;\n const parsed = EventsParams.safeParse(params);\n if (!parsed.success) throw invalid(method, parsed.error.message);\n return await implementation.events(parsed.data);\n }\n }\n throw new RpcError(\n createDiagnostic(\"MOSTRA_HOST_METHOD_UNKNOWN\", {\n message: `This host serves no harness method ${method}.`,\n }),\n -32601,\n );\n },\n onInternalError: (error, method) => {\n process.stderr.write(`harness: ${method} failed: ${(error as Error).stack ?? error}\\n`);\n },\n });\n const lines = new LineSplitter();\n (input as NodeJS.ReadStream).setEncoding?.(\"utf8\");\n input.on(\"data\", (chunk: string) => {\n for (const line of lines.push(chunk)) peer.receiveLine(line);\n });\n return new Promise((done) => {\n input.on(\"end\", () => {\n void Promise.resolve(implementation.stop())\n .catch(() => undefined)\n .finally(() => {\n peer.close();\n done();\n });\n });\n });\n}\n","#!/usr/bin/env node\n/**\n * `mostra-conformance-reference-host`: the TypeScript reference host (HO-05). A host built the way\n * the docs recommend, on `@mostra/sdk`, with a store that keeps each submission once by its\n * `deliveryId` (H-03), every port the SDK serves, and the harness shim the kit drives. It is the\n * model a TypeScript host copies, and the kit's own proof that its scenarios pass.\n *\n * mostra-conformance-reference-host every port\n * mostra-conformance-reference-host --standalone no port: Mostra's built-in adapters\n * mostra-conformance-reference-host --unscripted every port, without the `faults` feature:\n * its policy allows both channels and it names people by its own IDs (`user-1` …), so the\n * kit judges it by the answers it reports, as it must any host that can't be scripted\n * mostra-conformance-reference-host --break <fault,…> a deliberately broken host:\n * store-duplicates stores every delivery call, so a redelivery is stored twice\n * drafts-as-submissions takes draft mirrors for submissions\n * ignore-policy allows both channels whatever the kit scripted\n *\n * Its own runtime is found like any SDK host's (`MOSTRA_BUNDLE`, `MOSTRA_RUNTIME_BIN`, the pinned\n * bundle, a development checkout).\n */\nimport { parseArgs } from \"node:util\";\nimport {\n type ArtifactSummary,\n type ControlsPolicy,\n createDiagnostic,\n type DraftMirror,\n hostMethods,\n type PortIdentityResolveParams,\n type PortSecretsGetParams,\n type PortTrustedControlsActivatedParams,\n RpcError,\n type SubmissionEnvelope,\n type SubmissionsDeliverResult,\n} from \"@mostra/protocol\";\nimport { createMostra, type Mostra, type Ports } from \"@mostra/sdk\";\nimport type {\n EventsParams,\n EventsResult,\n ScriptParams,\n StartParams,\n StartResult,\n StoredDelivery,\n StoreResult,\n} from \"./harness/protocol.ts\";\nimport { serveHarness } from \"./harness/serve.ts\";\nimport { kitVersion } from \"./version.ts\";\n\n/** The faults a broken reference host can carry. */\nexport const REFERENCE_FAULTS: readonly string[] = [\n \"store-duplicates\",\n \"drafts-as-submissions\",\n \"ignore-policy\",\n];\n\n/** The reference host's store and port answers: what a real host keeps in its own database. */\nexport class ReferenceStore {\n readonly #deliveries = new Map<string, StoredDelivery & { attempts: number[] }>();\n readonly #drafts: StoreResult[\"drafts\"][number][] = [];\n readonly #activations: StoreResult[\"activations\"][number][] = [];\n readonly #identity: StoreResult[\"identity\"][number][] = [];\n readonly #policies: StoreResult[\"policies\"][number][] = [];\n readonly #secrets: StoreResult[\"secrets\"][number][] = [];\n readonly #faults: ReadonlySet<string>;\n #order = 0;\n /** How the scripted ports answer (feature `faults`). */\n #deliver: Extract<ScriptParams, { port: \"submissions\" }>[\"answer\"] = \"accept\";\n #policy: Extract<ScriptParams, { port: \"trustedControls\" }>[\"answer\"] = {\n submitChannels: [\"shell\"],\n controls: [\"submit\", \"choose\", \"approve\"],\n };\n #person: Extract<ScriptParams, { port: \"identity\" }>[\"answer\"] = \"headers\";\n #secretValues: Readonly<Record<string, string>> = {};\n\n /** People by the header that named them, for an unscripted host's own IDs. */\n readonly #people = new Map<string, string>();\n readonly #unscripted: boolean;\n\n constructor(faults: ReadonlySet<string> = new Set(), unscripted = false) {\n this.#faults = faults;\n this.#unscripted = unscripted;\n if (unscripted) this.#policy = { submitChannels: [\"artifact\", \"shell\"] };\n }\n\n /** Sets how a port answers from now on (feature `faults`). */\n script(params: ScriptParams): void {\n if (params.port === \"submissions\") this.#deliver = params.answer;\n else if (params.port === \"trustedControls\") this.#policy = params.answer;\n else if (params.port === \"identity\") this.#person = params.answer;\n else this.#secretValues = params.answer;\n }\n\n /** Records one delivery the way a host's database would: once per `deliveryId`. */\n #record(envelope: SubmissionEnvelope | (DraftMirror & { kind: string })): void {\n const id =\n \"deliveryId\" in envelope\n ? envelope.deliveryId\n : `draft-${envelope.viewerId}-${envelope.revision}`;\n const existing = this.#deliveries.get(id);\n const attempt = \"attempt\" in envelope ? envelope.attempt : 1;\n if (existing) {\n existing.attempts.push(attempt);\n (existing as { calls: number }).calls += 1;\n if (this.#faults.has(\"store-duplicates\")) (existing as { stored: number }).stored += 1;\n return;\n }\n const results = \"results\" in envelope ? envelope.results : undefined;\n this.#order += 1;\n this.#deliveries.set(id, {\n deliveryId: id,\n submissionId: results?.submission.id ?? \"\",\n artifactId: envelope.artifactId,\n calls: 1,\n stored: 1,\n attempts: [attempt],\n kind: envelope.kind,\n channel: results?.submission.channel ?? \"\",\n viewerKind: results?.submission.viewer.kind ?? \"\",\n ...(results?.submission.viewer.ref !== undefined\n ? { viewerRef: results.submission.viewer.ref }\n : {}),\n order: this.#order,\n });\n }\n\n /** The ports, as the SDK takes them. */\n ports(): Ports {\n return {\n submissions: {\n deliver: async (envelope: SubmissionEnvelope): Promise<SubmissionsDeliverResult> => {\n const answer = this.#deliver;\n if (answer === \"fail\") throw new Error(\"the host's store is unavailable\");\n if (answer === \"hang\") return new Promise(() => undefined);\n if (answer === \"retry\") return { accepted: false, reason: \"busy\", retry: true };\n if (answer === \"undeliverable\")\n return { accepted: false, reason: \"undeliverable\", retry: false };\n if (answer === \"reject\") return { accepted: false, reason: \"invalid\", retry: false };\n // A redelivery of a delivery the store holds is accepted again, never stored twice.\n this.#record(envelope);\n return { accepted: true };\n },\n },\n drafts: {\n mirror: (draft: DraftMirror) => {\n this.#drafts.push({\n artifactId: draft.artifactId,\n viewerId: draft.viewerId,\n revision: draft.revision,\n kind: draft.kind,\n });\n if (this.#faults.has(\"drafts-as-submissions\")) this.#record(draft);\n },\n },\n identity: {\n resolve: async (request: PortIdentityResolveParams) => {\n const call = {\n artifactId: request.artifactId,\n via: request.via,\n headers: Object.keys(request.headers).sort(),\n };\n const answer = this.#person;\n if (answer === \"fail\" || answer === \"hang\") {\n this.#identity.push(call);\n if (answer === \"fail\") throw new Error(\"the host's directory is unavailable\");\n return new Promise<never>(() => undefined);\n }\n let person: { ref: string; name?: string } | null = answer === \"headers\" ? null : answer;\n if (answer === \"headers\") {\n const user = request.headers[\"x-forwarded-user\"];\n if (user && this.#unscripted && !this.#people.has(user)) {\n this.#people.set(user, `user-${this.#people.size + 1}`);\n }\n const ref = user && this.#unscripted ? this.#people.get(user) : user;\n person = user && ref ? { ref, name: user.split(\"@\")[0] ?? user } : null;\n }\n this.#identity.push({ ...call, answer: person });\n return person;\n },\n },\n trustedControls: {\n policy: async (artifact: ArtifactSummary): Promise<ControlsPolicy> => {\n const answer = this.#policy;\n if (this.#faults.has(\"ignore-policy\")) {\n const both: ControlsPolicy = { submitChannels: [\"shell\", \"artifact\"] };\n this.#policies.push({ artifactId: artifact.id, answer: both });\n return both;\n }\n if (answer === \"fail\" || answer === \"hang\") {\n this.#policies.push({ artifactId: artifact.id });\n if (answer === \"fail\") throw new Error(\"the host's policy service is unavailable\");\n return new Promise<never>(() => undefined);\n }\n this.#policies.push({ artifactId: artifact.id, answer: answer as ControlsPolicy });\n return answer as ControlsPolicy;\n },\n activated: (event: PortTrustedControlsActivatedParams) => {\n this.#activations.push({\n artifactId: event.artifactId,\n control: event.control,\n viewId: event.viewId,\n });\n },\n },\n secrets: {\n get: (request: PortSecretsGetParams) => {\n this.#secrets.push({ artifactId: request.artifactId, name: request.name });\n return this.#secretValues[request.name] ?? null;\n },\n },\n };\n }\n\n /** What the store holds now. */\n snapshot(): StoreResult {\n return {\n deliveries: [...this.#deliveries.values()].sort((a, b) => a.order - b.order),\n drafts: [...this.#drafts],\n activations: [...this.#activations],\n identity: [...this.#identity],\n policies: [...this.#policies],\n secrets: [...this.#secrets],\n };\n }\n}\n\n/** Runs the reference host's harness on stdio. */\nexport async function runReferenceHost(\n options: { standalone?: boolean; unscripted?: boolean; faults?: readonly string[] } = {},\n): Promise<void> {\n const faults = new Set(options.faults ?? []);\n const unscripted = options.unscripted ?? false;\n const store = new ReferenceStore(faults, unscripted);\n let mostra: Mostra | undefined;\n const ports = options.standalone ? {} : store.ports();\n const portNames = Object.keys(ports);\n const name = options.standalone\n ? \"reference-host-ts-standalone\"\n : unscripted\n ? \"reference-host-ts-unscripted\"\n : faults.size > 0\n ? \"reference-host-ts-broken\"\n : \"reference-host-ts\";\n await serveHarness({\n initialize: () => ({\n host: { name, version: kitVersion() },\n ports: portNames,\n features: options.standalone || unscripted ? [\"events\"] : [\"faults\", \"events\"],\n }),\n async start(params: StartParams): Promise<StartResult> {\n if (params.mode === \"attach\") {\n throw new RpcError(\n createDiagnostic(\"MOSTRA_HOST_INVALID_PARAMS\", {\n message: \"The TypeScript reference host spawns its instance; it doesn't attach.\",\n }),\n );\n }\n await mostra?.close();\n mostra = await createMostra({\n home: params.home,\n client: { name, version: kitVersion() },\n ports,\n env: { ...process.env, ...params.env },\n onLog: () => undefined,\n });\n return {\n revision: mostra.revision,\n instance: mostra.instance,\n warnings: mostra.warnings,\n };\n },\n async call(method: string, params: unknown, timeoutMs?: number) {\n const definition = hostMethods.find((candidate) => candidate.method === method);\n if (!mostra) {\n throw new RpcError(\n createDiagnostic(\"MOSTRA_HOST_CONNECTION_CLOSED\", { message: \"No instance runs.\" }),\n );\n }\n if (!definition) {\n throw new RpcError(\n createDiagnostic(\"MOSTRA_HOST_METHOD_UNKNOWN\", { message: `No method ${method}.` }),\n -32601,\n );\n }\n return mostra.call(definition, params, timeoutMs !== undefined ? { timeoutMs } : {});\n },\n async stop() {\n const current = mostra;\n mostra = undefined;\n await current?.close();\n },\n store: () => store.snapshot(),\n ...(options.standalone || unscripted\n ? {}\n : { script: (params: ScriptParams) => store.script(params) }),\n async events(params: EventsParams): Promise<EventsResult> {\n if (!mostra) throw new Error(\"No instance runs.\");\n const pages: EventsResult[\"pages\"][number][] = [];\n const stream = mostra\n .events({\n name: params.name,\n filter: {\n ...(params.filter.artifacts ? { artifacts: [...params.filter.artifacts] } : {}),\n ...(params.filter.types ? { types: [...params.filter.types] } : {}),\n },\n })\n [Symbol.asyncIterator]();\n const deadline = Date.now() + params.timeoutMs;\n try {\n while (pages.length < params.pages) {\n const left = deadline - Date.now();\n if (left <= 0) break;\n const next = await Promise.race([\n stream.next(),\n new Promise<\"timeout\">((done) => setTimeout(() => done(\"timeout\"), left)),\n ]);\n if (next === \"timeout\" || next.done) break;\n pages.push({\n cursor: next.value.cursor,\n events: next.value.events.map((event) => ({ ...event })),\n });\n }\n } finally {\n // Asking for the next page is what tells the SDK the last one was handled: it acknowledges\n // it at once, then waits for a page this stream won't read, so the wait is cut short.\n await Promise.race([\n stream.next().catch(() => undefined),\n new Promise((done) => setTimeout(done, 1000)),\n ]);\n await stream.return?.();\n }\n return { pages };\n },\n });\n}\n\nif (\n import.meta.url === `file://${process.argv[1]}` ||\n process.argv[1]?.endsWith(\"reference-host.js\")\n) {\n const { values } = parseArgs({\n options: {\n standalone: { type: \"boolean\" },\n unscripted: { type: \"boolean\" },\n break: { type: \"string\" },\n },\n strict: true,\n });\n const faults = values.break ? values.break.split(\",\").filter(Boolean) : [];\n for (const fault of faults) {\n if (!REFERENCE_FAULTS.includes(fault)) {\n process.stderr.write(`Unknown fault ${fault}; known: ${REFERENCE_FAULTS.join(\", \")}\\n`);\n process.exit(2);\n }\n }\n void runReferenceHost({\n standalone: values.standalone ?? false,\n unscripted: values.unscripted ?? false,\n faults,\n }).then(() => process.exit(0));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAS,QAAQ,QAAgB,SAA2B;CAC1D,OAAO,IAAI,SACT,iBAAiB,8BAA8B,EAAE,SAAS,GAAG,OAAO,IAAI,UAAU,CAAC,GACnF,MACF;AACF;;;;;AAMA,SAAgB,aACd,gBACA,KAAwE,CAAC,GAC1D;CACf,MAAM,QAAQ,GAAG,SAAS,QAAQ;CAClC,MAAM,SAAS,GAAG,UAAU,QAAQ;CACpC,MAAM,OAAO,IAAI,QAAQ;EACvB,OAAO,YAAY;GACjB,OAAO,MAAM,WAA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AAE,EAAE,SAAS,mBAAmB,GAC7C;CACA,MAAM,EAAE,WAAW,UAAU;EAC3B,SAAS;GACP,YAAY,EAAE,MAAM,UAAU;GAC9B,YAAY,EAAE,MAAM,UAAU;GAC9B,OAAO,EAAE,MAAM,SAAS;EAC1B;EACA,QAAQ;CACV,CAAC;CACD,MAAM,SAAS,OAAO,QAAQ,OAAO,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO,IAAI,CAAC;CACzE,KAAK,MAAM,SAAS,QAClB,IAAI,CAAC,iBAAiB,SAAS,KAAK,GAAG;EACrC,QAAQ,OAAO,MAAM,iBAAiB,MAAM,WAAW,iBAAiB,KAAK,IAAI,EAAE,GAAG;EACtF,QAAQ,KAAK,CAAC;CAChB;CAEF,iBAAsB;EACpB,YAAY,OAAO,cAAc;EACjC,YAAY,OAAO,cAAc;EACjC;CACF,CAAC,CAAC,CAAC,WAAW,QAAQ,KAAK,CAAC,CAAC;AAC/B"}
@@ -0,0 +1,2 @@
1
+ import { n as ReferenceStore, r as runReferenceHost, t as REFERENCE_FAULTS } from "./reference-host-BJ-A_Qd_.js";
2
+ export { REFERENCE_FAULTS, ReferenceStore, runReferenceHost };
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { n as ReferenceStore, r as runReferenceHost, t as REFERENCE_FAULTS } from "./reference-host-d6gs3Tal.js";
3
+ export { REFERENCE_FAULTS, ReferenceStore, runReferenceHost };