Ejemplo
chromium-bidi 2.1.2: OutgoingMessage
Muestra verificada para npm chromium-bidi 2.1.2: OutgoingMessage. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó.
sha256:384e85a62fab9d38841e91553dc778853e4c299a46f2ba3958a86b97a0e83822
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 1
- Claves de firma que lo compilaron
- 1
Entorno declarado
linux 24 · ubuntu · glibc 2.39 x64 npm
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-27 |
Caso
HOW- Objetivo
- verify chromium-bidi.OutgoingMessage in pkg:npm/chromium-bidi@2.1.2
- Paquetes
- Símbolos
-
- chromium-bidi.OutgoingMessage
- Creado
- 2026-08-27T11:00:50Z
Contrato
- OutgoingMessage.createResolved wraps a message with the specified channel into a success result
- OutgoingMessage.createResolved creates an OutgoingMessage with null channel when no channel is specified
- OutgoingMessage.createFromPromise wraps a resolved success message into an OutgoingMessage instance
- OutgoingMessage.createFromPromise passes through error results unchanged without wrapping
- OutgoingMessage instance exposes message and channel through getter properties
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
Código fuente
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify chromium-bidi.OutgoingMessage in pkg:npm/chromium-bidi@2.1.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/chromium-bidi@2.1.2
Demonstrate these symbols/APIs:
- chromium-bidi.OutgoingMessage
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:3bfe79fff539b28bc49d8adf5711645a48271bd2fdf37111f30e68d51bb4fb0d","contract":["OutgoingMessage.createResolved wraps a message with the specified channel into a success result","OutgoingMessage.createResolved creates an OutgoingMessage with null channel when no channel is specified","OutgoingMessage.createFromPromise wraps a resolved success message into an OutgoingMessage instance","OutgoingMessage.createFromPromise passes through error results unchanged without wrapping","OutgoingMessage instance exposes message and channel through getter properties"],"goal":"verify chromium-bidi.OutgoingMessage in pkg:npm/chromium-bidi@2.1.2","kind":"HOW","packages":["pkg:npm/chromium-bidi@2.1.2"],"schemaVersion":1,"symbols":["chromium-bidi.OutgoingMessage"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/chromium-bidi@2.1.2"],"schemaVersion":1,"subject":"pkg:npm/chromium-bidi@2.1.2","symbols":["chromium-bidi.OutgoingMessage"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-chromium-bidi-outgoing-message",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-chromium-bidi-outgoing-message",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"chromium-bidi": "2.1.2"
}
},
"node_modules/chromium-bidi": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-2.1.2.tgz",
"integrity": "sha512-vtRWBK2uImo5/W2oG6/cDkkHSm+2t6VHgnj+Rcwhb0pP74OoUb4GipyRX/T/y39gYQPhioP0DPShn+A7P6CHNw==",
"license": "Apache-2.0",
"dependencies": {
"mitt": "^3.0.1",
"zod": "^3.24.1"
},
"peerDependencies": {
"devtools-protocol": "*"
}
},
"node_modules/devtools-protocol": {
"version": "0.0.1686980",
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1686980.tgz",
"integrity": "sha512-NnnxGO1/cRffXL29DqGysbfgCcsYoIxprtmXgh+UDXFvhTwhRBewcRdGlEXvc3cmROi04JRmd2PqCURsijW25A==",
"license": "BSD-3-Clause",
"peer": true
},
"node_modules/mitt": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz",
"integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==",
"license": "MIT"
},
"node_modules/zod": {
"version": "3.25.76",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}
}
}
}
{
"name": "sample-chromium-bidi-outgoing-message",
"version": "1.0.0",
"type": "module",
"private": true,
"description": "Clean-room verification sample for chromium-bidi.OutgoingMessage",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"chromium-bidi": "2.1.2"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify chromium-bidi.OutgoingMessage in pkg:npm/chromium-bidi@2.1.2",
"kind": "HOW",
"packages": [
"pkg:npm/chromium-bidi@2.1.2"
],
"symbols": [
"chromium-bidi.OutgoingMessage"
]
}
import { OutgoingMessage } from "chromium-bidi/lib/cjs/bidiMapper/BidiMapper.js";
/**
* Creates an outgoing message wrapper from a resolved message object and optional channel.
*
* @param {object} message - The BiDi message object.
* @param {string|null} [channel=null] - The target BiDi channel.
* @returns {Promise<{kind: string, value: OutgoingMessage}>}
*/
export async function createResolvedMessage(message, channel = null) {
return OutgoingMessage.createResolved(message, channel);
}
/**
* Creates an outgoing message wrapper from a promise resolving to a Result<Message>.
*
* @param {Promise<{kind: string, value?: object, error?: string}>} messagePromise
* @param {string|null} [channel=null]
* @returns {Promise<{kind: string, value?: OutgoingMessage, error?: string}>}
*/
export async function createMessageFromPromise(messagePromise, channel = null) {
return OutgoingMessage.createFromPromise(messagePromise, channel);
}
export { OutgoingMessage };
export default OutgoingMessage;
import assert from "node:assert/strict";
import {
OutgoingMessage,
createResolvedMessage,
createMessageFromPromise,
} from "../src/index.js";
// 1. OutgoingMessage.createResolved wraps a message with the specified channel into a success result
{
const rawMessage = { id: 101, result: { success: true, status: "connected" } };
const targetChannel = "channel-alpha";
const result = await OutgoingMessage.createResolved(rawMessage, targetChannel);
assert.strictEqual(result.kind, "success", "createResolved must return a success kind");
assert.ok(result.value instanceof OutgoingMessage, "value must be an OutgoingMessage instance");
assert.deepStrictEqual(result.value.message, rawMessage, "message getter must return the original message");
assert.strictEqual(result.value.channel, targetChannel, "channel getter must return the assigned channel");
const wrapped = await createResolvedMessage(rawMessage, targetChannel);
assert.strictEqual(wrapped.kind, "success");
assert.deepStrictEqual(wrapped.value.message, rawMessage);
assert.strictEqual(wrapped.value.channel, targetChannel);
}
// 2. OutgoingMessage.createResolved creates an OutgoingMessage with null channel when no channel is specified
{
const eventMessage = {
type: "event",
event: "log.entryAdded",
params: { level: "info", text: "mapper initialized" }
};
const result = await OutgoingMessage.createResolved(eventMessage, null);
assert.strictEqual(result.kind, "success", "result must be success");
assert.ok(result.value instanceof OutgoingMessage, "value must be an OutgoingMessage");
assert.deepStrictEqual(result.value.message, eventMessage, "message must match input event");
assert.strictEqual(result.value.channel, null, "channel must be null");
const helperResult = await createResolvedMessage(eventMessage, null);
assert.strictEqual(helperResult.kind, "success");
assert.strictEqual(helperResult.value.channel, null);
}
// 3. OutgoingMessage.createFromPromise wraps a resolved success message into an OutgoingMessage instance
{
const successPayload = { id: 202, result: { sessionId: "sess-xyz-123" } };
const successPromise = Promise.resolve({
kind: "success",
value: successPayload
});
const result = await OutgoingMessage.createFromPromise(successPromise, "session-channel");
assert.strictEqual(result.kind, "success", "createFromPromise must resolve to success for success kind");
assert.ok(result.value instanceof OutgoingMessage, "resolved value must be OutgoingMessage");
assert.deepStrictEqual(result.value.message, successPayload, "message must match success payload");
assert.strictEqual(result.value.channel, "session-channel", "channel must match provided channel");
const helperPromise = Promise.resolve({ kind: "success", value: successPayload });
const helperResult = await createMessageFromPromise(helperPromise, "session-channel");
assert.strictEqual(helperResult.kind, "success");
assert.deepStrictEqual(helperResult.value.message, successPayload);
}
// 4. OutgoingMessage.createFromPromise passes through error results unchanged without wrapping
{
const errorResult = {
kind: "error",
error: "invalid argument",
message: "Unknown browsing context"
};
const errorPromise = Promise.resolve(errorResult);
const result = await OutgoingMessage.createFromPromise(errorPromise, "error-channel");
assert.strictEqual(result.kind, "error", "createFromPromise must preserve error kind");
assert.strictEqual(result.error, "invalid argument", "error code must match");
assert.strictEqual(result.message, "Unknown browsing context", "error message must match");
assert.strictEqual(result, errorResult, "error result must be passed through unchanged");
const helperErrorResult = await createMessageFromPromise(Promise.resolve(errorResult), "error-channel");
assert.deepStrictEqual(helperErrorResult, errorResult);
}
// 5. OutgoingMessage instance exposes message and channel through getter properties
{
const responseData = { id: 303, result: { value: 42 } };
const customChannel = "custom-bidi-channel";
const res = await OutgoingMessage.createResolved(responseData, customChannel);
assert.strictEqual(res.kind, "success");
const instance = res.value;
assert.strictEqual(typeof instance.message, "object", "message property must be accessible as getter");
assert.strictEqual(instance.message.id, 303, "message property must return the message object");
assert.strictEqual(instance.channel, customChannel, "channel property must return the assigned channel");
}
console.log("Contract verification finished successfully.");
Seeder de origen
anónimo