Beispiel
chromium-bidi 2.1.2: Session
Verifiziertes Beispiel für npm chromium-bidi 2.1.2: Session. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand.
sha256:2d9f3563b584f898c3beda3ea652b06191be3c5d0a9248efcd735c1828d7f11a
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
linux 24 · ubuntu · glibc 2.39 x64 npm
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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 |
Fall
HOW- Ziel
- verify chromium-bidi.Session in pkg:npm/chromium-bidi@2.1.2
- Pakete
- Symbole
-
- chromium-bidi.Session
- Erstellt
- 2026-08-27T11:07:20Z
Contract
- Session.parseSubscribeParams parses valid subscription requests with events and contexts
- Session.parseSubscribeParams throws InvalidArgumentException when given invalid parameters
- Session.parseUnsubscribeParams parses subscription IDs list
- Session.parseUnsubscribeParams parses unsubscribe request by event attributes
- Session.parseUnsubscribeParams throws InvalidArgumentException on invalid parameters
- SubscriptionManager subscribes channels to unrolled module events
- SubscriptionManager checks active subscriptions and retrieves subscribed channels
- SubscriptionManager unrolls BiDi module events into atomic event names
- SubscriptionManager unsubscribes active subscriptions by subscription ID
Dateien
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.js
Quelltext
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.Session 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.Session
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:fcd856f351ac4b51ea417099f57572dd5a0a3332b53ed6e78da844c68616f8c4","contract":["Session.parseSubscribeParams parses valid subscription requests with events and contexts","Session.parseSubscribeParams throws InvalidArgumentException when given invalid parameters","Session.parseUnsubscribeParams parses subscription IDs list","Session.parseUnsubscribeParams parses unsubscribe request by event attributes","Session.parseUnsubscribeParams throws InvalidArgumentException on invalid parameters","SubscriptionManager subscribes channels to unrolled module events","SubscriptionManager checks active subscriptions and retrieves subscribed channels","SubscriptionManager unrolls BiDi module events into atomic event names","SubscriptionManager unsubscribes active subscriptions by subscription ID"],"goal":"verify chromium-bidi.Session in pkg:npm/chromium-bidi@2.1.2","kind":"HOW","packages":["pkg:npm/chromium-bidi@2.1.2"],"schemaVersion":1,"symbols":["chromium-bidi.Session"]},"contractCommand":["node","test/contract.js"],"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.Session"],"verifierAdapter":"node-typescript@1"}
'use strict';
const {
SubscriptionManager,
unrollEvents,
cartesianProduct,
difference,
} = require('chromium-bidi/lib/cjs/bidiMapper/modules/session/SubscriptionManager.js');
const {
BrowsingContextStorage,
} = require('chromium-bidi/lib/cjs/bidiMapper/modules/context/BrowsingContextStorage.js');
const {
Session,
} = require('chromium-bidi/lib/cjs/protocol-parser/protocol-parser.js');
const {
ChromiumBidi,
InvalidArgumentException,
} = require('chromium-bidi/lib/cjs/protocol/protocol.js');
function parseSubscribeParameters(params) {
return Session.parseSubscribeParams(params);
}
function parseUnsubscribeParameters(params) {
return Session.parseUnsubscribeParams(params);
}
function createSubscriptionManager(storage = new BrowsingContextStorage()) {
return new SubscriptionManager(storage);
}
module.exports = {
SubscriptionManager,
unrollEvents,
cartesianProduct,
difference,
BrowsingContextStorage,
Session,
ChromiumBidi,
InvalidArgumentException,
parseSubscribeParameters,
parseUnsubscribeParameters,
createSubscriptionManager,
};
{
"name": "sample-3365340674",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-3365340674",
"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.1684464",
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1684464.tgz",
"integrity": "sha512-QGCy1oIGCTLtFtJuNZaU6QhaUjMyvTmHWiL3fCiHpE4F2N8r6lyobhqFJQiEh1a6PoCBp/JkjckQy3Lx2i2lfg==",
"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-3365340674",
"version": "1.0.0",
"description": "Minimal sample verifying chromium-bidi.Session in pkg:npm/chromium-bidi@2.1.2",
"main": "index.js",
"scripts": {
"test": "node test/contract.js"
},
"keywords": [],
"author": "",
"license": "MIT-0",
"dependencies": {
"chromium-bidi": "2.1.2"
}
}
{
"schemaVersion": 1,
"goal": "verify chromium-bidi.Session in pkg:npm/chromium-bidi@2.1.2",
"kind": "HOW",
"packages": [
"pkg:npm/chromium-bidi@2.1.2"
],
"symbols": [
"chromium-bidi.Session"
]
}
'use strict';
const assert = require('assert');
const {
SubscriptionManager,
unrollEvents,
BrowsingContextStorage,
Session,
ChromiumBidi,
InvalidArgumentException,
parseSubscribeParameters,
parseUnsubscribeParameters,
createSubscriptionManager,
} = require('../index.js');
async function runContract() {
// 1. Session.parseSubscribeParams parses valid subscription requests with events and contexts
const validSubParams = {
events: ['log.entryAdded', 'browsingContext.domContentLoaded'],
contexts: ['context-1'],
};
const parsedSub = parseSubscribeParameters(validSubParams);
assert.deepStrictEqual(parsedSub.events, ['log.entryAdded', 'browsingContext.domContentLoaded']);
assert.deepStrictEqual(parsedSub.contexts, ['context-1']);
// 2. Session.parseSubscribeParams throws InvalidArgumentException when given invalid parameters
assert.throws(
() => {
parseSubscribeParameters({ events: 'invalid-events-type' });
},
(err) => {
assert(err instanceof InvalidArgumentException, 'Error must be InvalidArgumentException');
assert.strictEqual(err.error, 'invalid argument');
return true;
}
);
// 3. Session.parseUnsubscribeParams parses subscription IDs list
const validUnsubById = {
subscriptions: ['sub-id-100', 'sub-id-200'],
};
const parsedUnsubById = parseUnsubscribeParameters(validUnsubById);
assert.deepStrictEqual(parsedUnsubById.subscriptions, ['sub-id-100', 'sub-id-200']);
// 4. Session.parseUnsubscribeParams parses unsubscribe request by event attributes
const validUnsubByAttr = {
events: ['log.entryAdded'],
contexts: ['context-1'],
};
const parsedUnsubByAttr = parseUnsubscribeParameters(validUnsubByAttr);
assert.deepStrictEqual(parsedUnsubByAttr.events, ['log.entryAdded']);
assert.deepStrictEqual(parsedUnsubByAttr.contexts, ['context-1']);
// 5. Session.parseUnsubscribeParams throws InvalidArgumentException on invalid parameters
assert.throws(
() => {
parseUnsubscribeParameters({ unknownKey: 12345 });
},
(err) => {
assert(err instanceof InvalidArgumentException, 'Error must be InvalidArgumentException');
assert.strictEqual(err.error, 'invalid argument');
return true;
}
);
// 6. SubscriptionManager subscribes channels to unrolled module events
const storage = new BrowsingContextStorage();
const subManager = createSubscriptionManager(storage);
const channel = { 'goog:channel': 'session-test-channel' };
const subscription = subManager.subscribe([ChromiumBidi.BiDiModule.Log], [], [], channel);
assert(typeof subscription.id === 'string' && subscription.id.length > 0);
assert(subscription.eventNames.has('log.entryAdded'));
assert.deepStrictEqual(subscription.channel, channel);
// 7. SubscriptionManager checks active subscriptions and retrieves subscribed channels
assert.strictEqual(subManager.isSubscribedTo('log.entryAdded', null), true);
assert.strictEqual(subManager.isSubscribedTo('browsingContext.load', null), false);
const subscribedChannels = subManager.getChannelsSubscribedToEventGlobally('log.entryAdded');
assert.deepStrictEqual(subscribedChannels, [channel]);
// 8. SubscriptionManager unrolls BiDi module events into atomic event names
const unrolled = Array.from(unrollEvents([ChromiumBidi.BiDiModule.BrowsingContext]));
assert(unrolled.includes('browsingContext.domContentLoaded'));
assert(unrolled.includes('browsingContext.load'));
assert(unrolled.includes('browsingContext.contextCreated'));
// 9. SubscriptionManager unsubscribes active subscriptions by subscription ID
subManager.unsubscribeById([subscription.id]);
assert.strictEqual(subManager.isSubscribedTo('log.entryAdded', null), false);
const channelsAfterUnsub = subManager.getChannelsSubscribedToEventGlobally('log.entryAdded');
assert.deepStrictEqual(channelsAfterUnsub, []);
console.log('Contract tests passed successfully.');
}
runContract().catch((err) => {
console.error('Contract test failed:', err);
process.exit(1);
});
Ursprungs-Seeder
anonym