CodeSampleX

Ejemplo

@types/node 26.6.11

Muestra verificada para npm @types/node 26.6.11. El contrato se ejecutó en node 22 · linux debian/x64 · docker y pasó: @types/node@26.6.11 manifest exposes…

sha256:bf19ab08e8f79e295613abd0281daa66a04ee5d47e43f5940ecec72304da0ed9

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 node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Entornos de las ejecuciones de verificación

Entorno Contrato Etapas Ejecución
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-11-29

Caso

HOW
Objetivo
verify pkg:npm/%40types/node@26.6.11
Paquetes
Entorno
node 22.23.2
Creado
2026-11-29T23:37:52Z

Contrato

  1. @types/node@26.6.11 manifest exposes index.d.ts, TypeScript 5.6 metadata, typesVersions mappings for <=5.6 and <=5.7, and undici-types ~8.9.0
  2. undici-types 8.9.x resolves cleanly with a non-empty declaration entry point
  3. every triple-slash path reference in index.d.ts, ts5.6/index.d.ts, and ts5.7/index.d.ts resolves to an existing non-empty .d.ts file
  4. core declarations for node:events, node:fs, node:fs/promises, node:crypto, node:buffer, and node:sqlite are present
  5. Node 26 declarations for node:ffi, node:vfs, node:quic, node:stream/iter, node:zlib/iter, and web-globals/fetch.d.ts wired to undici-types are present

Archivos

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.cjs

Descargar el artefacto de código fuente (tar.gz)

Código fuente

PROMPT.md
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 pkg:npm/%40types/node@26.6.11
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40types/node@26.6.11
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.
csx.json
{"case":{"caseId":"case:sha256:ca4cd475e1ba387f311108c97b6dd47695ee60962712689b0de0ad8c77fc314a","constraints":{"executionContext":"node"},"contract":["@types/node@26.6.11 manifest exposes index.d.ts, TypeScript 5.6 metadata, typesVersions mappings for \u003c=5.6 and \u003c=5.7, and undici-types ~8.9.0","undici-types 8.9.x resolves cleanly with a non-empty declaration entry point","every triple-slash path reference in index.d.ts, ts5.6/index.d.ts, and ts5.7/index.d.ts resolves to an existing non-empty .d.ts file","core declarations for node:events, node:fs, node:fs/promises, node:crypto, node:buffer, and node:sqlite are present","Node 26 declarations for node:ffi, node:vfs, node:quic, node:stream/iter, node:zlib/iter, and web-globals/fetch.d.ts wired to undici-types are present"],"goal":"verify pkg:npm/%40types/node@26.6.11","kind":"HOW","packages":["pkg:npm/%40types/node@26.6.11"],"schemaVersion":1},"contractCommand":["node","test/contract.cjs"],"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/%40types/node@26.6.11"],"schemaVersion":1,"subject":"pkg:npm/%40types/node@26.6.11","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "types-node-26-6-11-verify",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "types-node-26-6-11-verify",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@types/node": "26.6.11"
      }
    },
    "node_modules/@types/node": {
      "version": "26.6.11",
      "resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.11.tgz",
      "integrity": "sha512-uUyQ2XLEz+EXh34lmS3GhKrkqn/8FU7KUiKRpk347At2bmnMVWss45yz8b4FG/tUtmV1tV/+TVkITItPROyeeQ==",
      "license": "MIT",
      "dependencies": {
        "undici-types": "~8.9.0"
      }
    },
    "node_modules/undici-types": {
      "version": "8.9.0",
      "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz",
      "integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==",
      "license": "MIT"
    }
  }
}
package.json
{
  "name": "types-node-26-6-11-verify",
  "version": "1.0.0",
  "private": true,
  "license": "MIT-0",
  "dependencies": {
    "@types/node": "26.6.11"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40types/node@26.6.11",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40types/node@26.6.11"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.cjs
'use strict';

const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');

// 1. Package manifest metadata and versioned TypeScript mappings
const pkgJsonPath = require.resolve('@types/node/package.json');
const pkgDir = path.dirname(pkgJsonPath);
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));

assert.equal(pkg.name, '@types/node');
assert.equal(pkg.version, '26.6.11');
assert.equal(pkg.types, 'index.d.ts');
assert.equal(pkg.typeScriptVersion, '5.6');
assert.deepEqual(pkg.typesVersions['<=5.6']['*'], ['ts5.6/*']);
assert.deepEqual(pkg.typesVersions['<=5.7']['*'], ['ts5.7/*']);
assert.equal(pkg.dependencies['undici-types'], '~8.9.0');

// 2. Transitive undici-types dependency resolution
const undiciPkgPath = require.resolve('undici-types/package.json');
const undiciDir = path.dirname(undiciPkgPath);
const undiciPkg = JSON.parse(fs.readFileSync(undiciPkgPath, 'utf8'));

assert.equal(undiciPkg.name, 'undici-types');
assert.match(undiciPkg.version, /^8\.9\./);
const undiciEntry = path.join(undiciDir, undiciPkg.types || 'index.d.ts');
assert.ok(fs.statSync(undiciEntry).size > 0, 'undici-types entry declaration must be non-empty');

// 3. Every triple-slash reference path in root, ts5.6, and ts5.7 index.d.ts resolves to a non-empty .d.ts file
function verifyReferenceTree(relIndexPath, minRefs) {
  const fullIndexPath = path.join(pkgDir, relIndexPath);
  const baseDir = path.dirname(fullIndexPath);
  const content = fs.readFileSync(fullIndexPath, 'utf8');
  const refs = [...content.matchAll(/^\/\/\/\s*<reference\s+path="([^"]+)"\s*\/>/gm)];
  assert.ok(refs.length >= minRefs, `${relIndexPath} should contain at least ${minRefs} path references`);

  for (const [, target] of refs) {
    const resolved = path.resolve(baseDir, target);
    assert.ok(fs.existsSync(resolved), `${relIndexPath} references missing file: ${target}`);
    assert.ok(fs.statSync(resolved).size > 0, `${relIndexPath} references empty file: ${target}`);
  }
}

verifyReferenceTree('index.d.ts', 70);
verifyReferenceTree(path.join('ts5.6', 'index.d.ts'), 70);
verifyReferenceTree(path.join('ts5.7', 'index.d.ts'), 70);

function readDecl(relPath) {
  return fs.readFileSync(path.join(pkgDir, relPath), 'utf8');
}

// 4. Core Node.js module declarations
const eventsDecl = readDecl('events.d.ts');
assert.ok(eventsDecl.includes('declare module "node:events"'));
assert.ok(eventsDecl.includes('declare module "events"'));
assert.ok(eventsDecl.includes('class EventEmitter'));

const fsDecl = readDecl('fs.d.ts');
assert.ok(fsDecl.includes('declare module "node:fs"'));
assert.ok(fsDecl.includes('declare module "fs"'));
assert.ok(fsDecl.includes('function readFileSync('));

const fsPromisesDecl = readDecl(path.join('fs', 'promises.d.ts'));
assert.ok(fsPromisesDecl.includes('declare module "node:fs/promises"'));
assert.ok(fsPromisesDecl.includes('declare module "fs/promises"'));

const cryptoDecl = readDecl('crypto.d.ts');
assert.ok(cryptoDecl.includes('declare module "node:crypto"'));
assert.ok(cryptoDecl.includes('function createHash('));

const bufferDecl = readDecl('buffer.d.ts');
assert.ok(bufferDecl.includes('declare module "node:buffer"'));
assert.ok(bufferDecl.includes('export function isUtf8('));

const sqliteDecl = readDecl('sqlite.d.ts');
assert.ok(sqliteDecl.includes('declare module "node:sqlite"'));
assert.ok(sqliteDecl.includes('interface DatabaseSyncOptions'));
assert.ok(sqliteDecl.includes('class DatabaseSync'));

// 5. Node 26 declarations and web-globals fetch integration
const ffiDecl = readDecl('ffi.d.ts');
assert.ok(ffiDecl.includes('declare module "node:ffi"'));
assert.ok(ffiDecl.includes('const suffix: string;'));
assert.ok(ffiDecl.includes('interface DynamicLibraryResult<'));

const vfsDecl = readDecl('vfs.d.ts');
assert.ok(vfsDecl.includes('declare module "node:vfs"'));
assert.ok(vfsDecl.includes('function create('));
assert.ok(vfsDecl.includes('class VirtualFileSystem'));

const quicDecl = readDecl('quic.d.ts');
assert.ok(quicDecl.includes('declare module "node:quic"'));
assert.ok(quicDecl.includes('type OnSessionCallback ='));

const streamIterDecl = readDecl(path.join('stream', 'iter.d.ts'));
assert.ok(streamIterDecl.includes('declare module "node:stream/iter"'));
assert.ok(streamIterDecl.includes('type BackpressurePolicy ='));

const zlibIterDecl = readDecl(path.join('zlib', 'iter.d.ts'));
assert.ok(zlibIterDecl.includes('declare module "node:zlib/iter"'));
assert.ok(zlibIterDecl.includes('function compressBrotli('));

const fetchDecl = readDecl(path.join('web-globals', 'fetch.d.ts'));
assert.ok(fetchDecl.includes('import * as undici from "undici-types";'));
assert.ok(fetchDecl.includes('function fetch('));

console.log('@types/node@26.6.11 contract verified');

Seeder de origen

anónimo