Exemplo
@webassemblyjs/ast 1.14.1: objectInstruction
Amostra verificada para npm @webassemblyjs/ast 1.14.1: objectInstruction. O contrato rodou em node 22 · linux debian/x64 · docker e passou.
sha256:781fc359b9b65989c5057466037c95a29819fb4521e5325444ac0e93a89ab76c
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-01 |
Caso
HOW- Objetivo
- verify objectInstruction in pkg:npm/%40webassemblyjs/ast@1.14.1
- Pacotes
- Símbolos
-
- objectInstruction
- Ambiente
- node 22.23.2
- Criado
- 2026-09-01T19:56:55Z
Contrato
- @webassemblyjs/ast exports objectInstruction builder function
- objectInstruction creates an Instr node with id and object properties and default empty args
- objectInstruction accepts custom instruction args and sets them on the Instr node
- objectInstruction accepts namedArgs options and sets them on the Instr node
- isInstr recognizes nodes created by objectInstruction as valid Instr nodes
- traverse visits Instr nodes created by objectInstruction
Arquivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Código-fonte
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 objectInstruction in pkg:npm/%40webassemblyjs/ast@1.14.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40webassemblyjs/ast@1.14.1
Demonstrate these symbols/APIs:
- objectInstruction
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
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:8c63d1b09e652455e54cfb470a59ad736fae08fbc98f07f463fe8974bd591ad7","constraints":{"executionContext":"node"},"contract":["@webassemblyjs/ast exports objectInstruction builder function","objectInstruction creates an Instr node with id and object properties and default empty args","objectInstruction accepts custom instruction args and sets them on the Instr node","objectInstruction accepts namedArgs options and sets them on the Instr node","isInstr recognizes nodes created by objectInstruction as valid Instr nodes","traverse visits Instr nodes created by objectInstruction"],"goal":"verify objectInstruction in pkg:npm/%40webassemblyjs/ast@1.14.1","kind":"HOW","packages":["pkg:npm/%40webassemblyjs/ast@1.14.1"],"schemaVersion":1,"symbols":["objectInstruction"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40webassemblyjs/ast@1.14.1"],"schemaVersion":1,"subject":"pkg:npm/%40webassemblyjs/ast@1.14.1","symbols":["objectInstruction"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-webassemblyjs-ast-object-instruction",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-webassemblyjs-ast-object-instruction",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@webassemblyjs/ast": "1.14.1"
}
},
"node_modules/@webassemblyjs/ast": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.14.1.tgz",
"integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==",
"license": "MIT",
"dependencies": {
"@webassemblyjs/helper-numbers": "1.13.2",
"@webassemblyjs/helper-wasm-bytecode": "1.13.2"
}
},
"node_modules/@webassemblyjs/floating-point-hex-parser": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz",
"integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==",
"license": "MIT"
},
"node_modules/@webassemblyjs/helper-api-error": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz",
"integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==",
"license": "MIT"
},
"node_modules/@webassemblyjs/helper-numbers": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz",
"integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==",
"license": "MIT",
"dependencies": {
"@webassemblyjs/floating-point-hex-parser": "1.13.2",
"@webassemblyjs/helper-api-error": "1.13.2",
"@xtuc/long": "4.2.2"
}
},
"node_modules/@webassemblyjs/helper-wasm-bytecode": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz",
"integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==",
"license": "MIT"
},
"node_modules/@xtuc/long": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz",
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
"license": "Apache-2.0"
}
}
}
{
"name": "sample-webassemblyjs-ast-object-instruction",
"version": "1.0.0",
"type": "module",
"private": true,
"license": "MIT-0",
"dependencies": {
"@webassemblyjs/ast": "1.14.1"
}
}
{
"schemaVersion": 1,
"goal": "verify objectInstruction in pkg:npm/%40webassemblyjs/ast@1.14.1",
"kind": "HOW",
"packages": [
"pkg:npm/%40webassemblyjs/ast@1.14.1"
],
"symbols": [
"objectInstruction"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import assert from 'node:assert/strict';
import {
objectInstruction,
isInstr,
traverse,
identifier,
numberLiteralFromRaw,
} from '@webassemblyjs/ast';
// 1. @webassemblyjs/ast exports objectInstruction builder function
assert.equal(typeof objectInstruction, 'function');
// 2. objectInstruction creates an Instr node with id and object properties and default empty args
const nopNode = objectInstruction('nop', 'test');
assert.equal(nopNode.type, 'Instr');
assert.equal(nopNode.id, 'nop');
assert.equal(nopNode.object, 'test');
assert.deepEqual(nopNode.args, []);
// 3. objectInstruction accepts custom instruction args and sets them on the Instr node
const constNode = objectInstruction('const', 'i32', [numberLiteralFromRaw(42)]);
assert.equal(constNode.type, 'Instr');
assert.equal(constNode.id, 'const');
assert.equal(constNode.object, 'i32');
assert.equal(constNode.args.length, 1);
assert.equal(constNode.args[0].type, 'NumberLiteral');
assert.equal(constNode.args[0].value, 42);
// 4. objectInstruction accepts namedArgs options and sets them on the Instr node
const offsetArg = numberLiteralFromRaw(4);
const loadNode = objectInstruction('load', 'i32', [numberLiteralFromRaw(0)], { offset: offsetArg });
assert.equal(loadNode.type, 'Instr');
assert.equal(loadNode.id, 'load');
assert.equal(loadNode.object, 'i32');
assert.ok(loadNode.namedArgs);
assert.equal(loadNode.namedArgs.offset, offsetArg);
// 5. isInstr recognizes nodes created by objectInstruction as valid Instr nodes
assert.equal(isInstr(nopNode), true);
assert.equal(isInstr(constNode), true);
assert.equal(isInstr(loadNode), true);
// 6. traverse visits Instr nodes created by objectInstruction
let visited = false;
traverse(constNode, {
Instr(path) {
if (path.node.id === 'const' && path.node.object === 'i32') {
visited = true;
}
},
});
assert.equal(visited, true);
console.log('All contract tests passed.');
Seeder de origem
anônimo