Sample
bare-os 3.9.3: availableParallelism
Verified sample for npm bare-os 3.9.3: availableParallelism. The contract ran on node 22 · linux alpine/x64 · docker and passed.
sha256:3fd1f7b2eb624329d892e3ad7b9a428446e468a0f8e01871e75c409668c5a150
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 npm
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| 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 |
Case
HOW- Goal
- verify availableParallelism in pkg:npm/bare-os@3.9.3
- Packages
- Symbols
-
- availableParallelism
- Created
- 2026-08-27T05:46:29Z
Contract
- bare-os package manifest specifies Bare addon configuration, Bare engine requirement >=1.14.0, and root export with index.d.ts types and index.js default
- index.d.ts exports availableParallelism function returning a number representing logical CPU core count
- binding.c implements bare_os_available_parallelism wrapping uv_available_parallelism and exports availableParallelism in addon definition
- index.js exports availableParallelism delegating to binding.availableParallelism and returns integer parallelism count
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Source
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 availableParallelism in pkg:npm/bare-os@3.9.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/bare-os@3.9.3
Demonstrate these symbols/APIs:
- availableParallelism
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:7fe90b35ab9c44786212534985bc6a9fb58e41420dec92b950d5867847a34698","contract":["bare-os package manifest specifies Bare addon configuration, Bare engine requirement \u003e=1.14.0, and root export with index.d.ts types and index.js default","index.d.ts exports availableParallelism function returning a number representing logical CPU core count","binding.c implements bare_os_available_parallelism wrapping uv_available_parallelism and exports availableParallelism in addon definition","index.js exports availableParallelism delegating to binding.availableParallelism and returns integer parallelism count"],"goal":"verify availableParallelism in pkg:npm/bare-os@3.9.3","kind":"HOW","packages":["pkg:npm/bare-os@3.9.3"],"schemaVersion":1,"symbols":["availableParallelism"]},"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/bare-os@3.9.3"],"schemaVersion":1,"subject":"pkg:npm/bare-os@3.9.3","symbols":["availableParallelism"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-bare-os-availableparallelism",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-bare-os-availableparallelism",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"bare-os": "3.9.3"
}
},
"node_modules/bare-os": {
"version": "3.9.3",
"resolved": "https://registry.npmjs.org/bare-os/-/bare-os-3.9.3.tgz",
"integrity": "sha512-fF4Q7QsyKVF5Rj0qvI8BgUNjqzC2JvQlpTaPLjVJVxYVUX5Zr9un+y3w1HmA4nNKdFmRBT8z/WmrjvXzXVerKQ==",
"license": "Apache-2.0",
"engines": {
"bare": ">=1.14.0"
}
}
}
}
{
"name": "sample-bare-os-availableparallelism",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"bare-os": "3.9.3"
}
}
{
"schemaVersion": 1,
"goal": "verify availableParallelism in pkg:npm/bare-os@3.9.3",
"kind": "HOW",
"packages": [
"pkg:npm/bare-os@3.9.3"
],
"symbols": [
"availableParallelism"
]
}
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
import fs from 'node:fs';
import path from 'node:path';
const require = createRequire(import.meta.url);
// 1. Verify package manifest and exports
const pkgPath = require.resolve('bare-os/package');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
assert.equal(pkg.name, 'bare-os', 'Package name must be bare-os');
assert.equal(pkg.version, '3.9.3', 'Package version must be 3.9.3');
assert.equal(pkg.addon, true, 'Package must be marked as Bare addon');
assert.equal(pkg.engines?.bare, '>=1.14.0', 'Package must specify Bare engine requirement');
assert.ok(pkg.exports, 'Package must define exports');
assert.equal(pkg.exports['.'].types, './index.d.ts', 'Root export must specify index.d.ts');
assert.equal(pkg.exports['.'].default, './index.js', 'Root export must specify index.js');
const pkgDir = path.dirname(pkgPath);
// 2. Verify TypeScript type definitions for availableParallelism
const indexDts = fs.readFileSync(path.join(pkgDir, 'index.d.ts'), 'utf8');
assert.match(
indexDts,
/export function availableParallelism\(\):\s*number/,
'index.d.ts must declare availableParallelism returning a number'
);
// 3. Verify C native binding implementation for availableParallelism
const bindingC = fs.readFileSync(path.join(pkgDir, 'binding.c'), 'utf8');
assert.ok(
bindingC.includes('bare_os_available_parallelism'),
'binding.c must implement bare_os_available_parallelism'
);
assert.ok(
bindingC.includes('uv_available_parallelism()'),
'bare_os_available_parallelism must invoke uv_available_parallelism'
);
assert.ok(
bindingC.includes('V("availableParallelism", bare_os_available_parallelism)'),
'binding.c must register availableParallelism in addon exports'
);
// 4. Verify JavaScript API wrapper behavior in index.js via mocked addon binding
const bindingJsPath = path.join(pkgDir, 'binding.js');
let called = false;
require.cache[bindingJsPath] = {
id: bindingJsPath,
filename: bindingJsPath,
loaded: true,
exports: {
platform: process.platform,
arch: process.arch,
availableParallelism: () => {
called = true;
return 16;
}
}
};
const bareOs = require('bare-os');
assert.equal(typeof bareOs.availableParallelism, 'function', 'bare-os must export availableParallelism function');
const result = bareOs.availableParallelism();
assert.equal(called, true, 'availableParallelism must delegate to binding.availableParallelism');
assert.equal(result, 16, 'availableParallelism must return the parallelism count from binding');
console.log('Contract test passed successfully.');
Origin Seeder
anonymous