From dcab21fa5581cd0db5830ba21a7d5076168b0242 Mon Sep 17 00:00:00 2001 From: Reuven Cohen Date: Wed, 11 Nov 2026 03:45:24 +0000 Subject: [PATCH 01/20] feat: add bounded WSP swarm toolkit and constellation tooling Add twelve independently packaged adapters, revision-safe evolution, shared contracts, a lightweight onramp, and public metrics reporting. Make the protected WSP publisher tokenless while preserving exact-source and archive verification. Validated 142 tests on Node 22.13.0 and 24.22.1, strict declarations, packed consumers, real Chromium/workerd, and both dependency audits. --- .../workflows/constellation-observatory.yml | 40 + .github/workflows/protected-wsp-release.yml | 11 +- .github/workflows/wsp-modules.yml | 3 + .github/workflows/wsp-toolkit.yml | 51 + docs/constellation-design.md | 46 + docs/constellation-release.md | 64 + docs/constellation.md | 91 + packages/wsp-toolkit/.gitignore | 2 + packages/wsp-toolkit/README.md | 111 + packages/wsp-toolkit/docs/design.md | 26 + .../evidence/constellation-live-summary.json | 115 + .../constellation-node-22-validation.json | 654 ++ .../constellation-node-24-validation.json | 654 ++ .../constellation-package-archives.json | 86 + .../docs/evidence/huggingface-live.json | 20 + .../wsp-toolkit/docs/evidence/loop-demo.json | 205 + .../evidence/loop-node-22-validation.json | 426 ++ .../evidence/loop-node-24-validation.json | 426 ++ .../docs/evidence/loop-package-archives.json | 65 + .../docs/evidence/node-22-validation.json | 266 + .../docs/evidence/node-24-validation.json | 266 + .../docs/evidence/package-archives.json | 37 + .../docs/evidence/ruos-validation.json | 23 + .../wsp-toolkit/docs/huggingface-source.json | 7 + packages/wsp-toolkit/docs/loop-design.md | 44 + packages/wsp-toolkit/docs/loop-validation.md | 58 + packages/wsp-toolkit/docs/validation.md | 47 + packages/wsp-toolkit/package-lock.json | 1714 +++++ packages/wsp-toolkit/package.json | 44 + .../wsp-toolkit/packages/cloudflare/LICENSE | 21 + .../wsp-toolkit/packages/cloudflare/README.md | 47 + .../packages/cloudflare/constellation.json | 16 + .../packages/cloudflare/package.json | 47 + .../packages/cloudflare/scripts/build.mjs | 3 + .../packages/cloudflare/src/build.d.ts | 3 + .../packages/cloudflare/src/build.js | 62 + .../packages/cloudflare/src/index.d.ts | 12 + .../packages/cloudflare/src/index.js | 136 + .../packages/cloudflare/src/worker.js | 7 + .../packages/cloudflare/test/handler.test.mjs | 101 + .../packages/cloudflare/test/workerd.test.mjs | 67 + .../packages/cloudflare/wrangler.jsonc | 9 + .../packages/constellation/LICENSE | 21 + .../packages/constellation/README.md | 27 + .../packages/constellation/catalog.json | 411 + .../packages/constellation/constellation.json | 12 + .../packages/constellation/package.json | 43 + .../packages/constellation/src/cli.js | 47 + .../packages/constellation/src/index.d.ts | 12 + .../packages/constellation/src/index.js | 203 + .../constellation/test/onramp.test.mjs | 115 + .../wsp-toolkit/packages/contracts/LICENSE | 21 + .../wsp-toolkit/packages/contracts/README.md | 19 + .../packages/contracts/constellation.json | 10 + .../packages/contracts/package.json | 37 + .../contracts/schemas/catalog.schema.json | 169 + .../contracts/schemas/module.schema.json | 73 + .../schemas/wsp-references.schema.json | 22 + .../packages/contracts/src/index.d.ts | 18 + .../packages/contracts/src/index.js | 153 + .../contracts/test/contracts.test.mjs | 70 + .../wsp-toolkit/packages/huggingface/LICENSE | 21 + .../packages/huggingface/README.md | 63 + .../packages/huggingface/constellation.json | 13 + .../packages/huggingface/package.json | 38 + .../packages/huggingface/src/index.d.ts | 38 + .../packages/huggingface/src/index.js | 165 + .../packages/huggingface/test/hub.test.mjs | 210 + .../wsp-toolkit/packages/invariants/LICENSE | 21 + .../wsp-toolkit/packages/invariants/README.md | 39 + .../packages/invariants/constellation.json | 14 + .../packages/invariants/package.json | 39 + .../packages/invariants/src/data.js | 91 + .../packages/invariants/src/index.d.ts | 62 + .../packages/invariants/src/index.js | 127 + .../invariants/test/invariants.test.mjs | 154 + .../wsp-toolkit/packages/lifecycle/LICENSE | 21 + .../wsp-toolkit/packages/lifecycle/README.md | 15 + .../packages/lifecycle/constellation.json | 15 + .../packages/lifecycle/package.json | 36 + .../wsp-toolkit/packages/lifecycle/src/cli.js | 28 + .../packages/lifecycle/src/index.d.ts | 7 + .../packages/lifecycle/src/index.js | 101 + .../packages/lifecycle/test/gate.test.mjs | 45 + packages/wsp-toolkit/packages/loop/LICENSE | 21 + packages/wsp-toolkit/packages/loop/README.md | 40 + .../packages/loop/constellation.json | 18 + .../wsp-toolkit/packages/loop/package.json | 36 + .../wsp-toolkit/packages/loop/src/data.js | 73 + .../wsp-toolkit/packages/loop/src/index.d.ts | 52 + .../wsp-toolkit/packages/loop/src/index.js | 221 + .../packages/loop/test/loop.test.mjs | 155 + .../wsp-toolkit/packages/registry/LICENSE | 21 + .../wsp-toolkit/packages/registry/README.md | 36 + .../packages/registry/constellation.json | 16 + .../packages/registry/package.json | 46 + .../packages/registry/src/index.d.ts | 44 + .../packages/registry/src/index.js | 190 + .../packages/registry/test/registry.test.mjs | 207 + packages/wsp-toolkit/packages/ruos/LICENSE | 21 + packages/wsp-toolkit/packages/ruos/README.md | 15 + .../packages/ruos/constellation.json | 14 + .../wsp-toolkit/packages/ruos/package.json | 33 + .../wsp-toolkit/packages/ruos/src/index.d.ts | 4 + .../wsp-toolkit/packages/ruos/src/index.js | 61 + .../packages/ruos/test/ruos.test.mjs | 24 + packages/wsp-toolkit/packages/search/LICENSE | 21 + .../wsp-toolkit/packages/search/README.md | 55 + .../packages/search/constellation.json | 15 + .../wsp-toolkit/packages/search/package.json | 39 + .../wsp-toolkit/packages/search/src/data.js | 92 + .../packages/search/src/index.d.ts | 62 + .../wsp-toolkit/packages/search/src/index.js | 176 + .../packages/search/test/search.test.mjs | 202 + packages/wsp-toolkit/packages/swarm/LICENSE | 21 + packages/wsp-toolkit/packages/swarm/README.md | 30 + .../packages/swarm/constellation.json | 15 + .../wsp-toolkit/packages/swarm/package.json | 36 + .../wsp-toolkit/packages/swarm/src/data.js | 209 + .../wsp-toolkit/packages/swarm/src/index.d.ts | 31 + .../wsp-toolkit/packages/swarm/src/index.js | 97 + .../wsp-toolkit/packages/swarm/src/worker.js | 19 + .../packages/swarm/test/swarm.test.mjs | 154 + .../wsp-toolkit/packages/telemetry/LICENSE | 21 + .../wsp-toolkit/packages/telemetry/README.md | 42 + .../packages/telemetry/constellation.json | 10 + .../packages/telemetry/package.json | 33 + .../packages/telemetry/src/analyze.js | 159 + .../packages/telemetry/src/collect.js | 121 + .../packages/telemetry/src/dashboard.js | 56 + .../packages/telemetry/src/data.js | 127 + .../packages/telemetry/src/index.d.ts | 76 + .../packages/telemetry/src/index.js | 4 + .../telemetry/test/dashboard.test.mjs | 35 + .../packages/telemetry/test/fixtures.mjs | 13 + .../telemetry/test/telemetry.test.mjs | 116 + packages/wsp-toolkit/scripts/benchmark.mjs | 41 + .../scripts/constellation-links.mjs | 37 + .../scripts/constellation-report.mjs | 52 + .../wsp-toolkit/scripts/evolution-demo.mjs | 13 + .../wsp-toolkit/scripts/huggingface-live.mjs | 25 + .../wsp-toolkit/scripts/packed-consumer.mjs | 44 + packages/wsp-toolkit/scripts/validate.mjs | 46 + packages/wsp-toolkit/test/browser.test.mjs | 37 + .../test/constellation-browser.test.mjs | 33 + .../test/constellation-fixture.mjs | 20 + .../test/constellation-scenario.mjs | 33 + .../wsp-toolkit/test/constellation.test.mjs | 33 + packages/wsp-toolkit/test/consumer.test.mjs | 14 + .../wsp-toolkit/test/evolution-scenario.mjs | 56 + .../wsp-toolkit/test/integration.test.mjs | 35 + packages/wsp-toolkit/test/scenario.mjs | 53 + packages/wsp-toolkit/test/types.ts | 41 + packages/wsp-toolkit/tooling/agentdb/.npmrc | 2 + .../wsp-toolkit/tooling/agentdb/README.md | 12 + .../tooling/agentdb/package-lock.json | 6736 +++++++++++++++++ .../wsp-toolkit/tooling/agentdb/package.json | 9 + .../wsp-toolkit/tooling/agentdb/runtime.mjs | 37 + packages/wsp-toolkit/tsconfig.json | 4 + scripts/constellation-oidc.mjs | 127 + scripts/constellation-oidc.test.mjs | 128 + scripts/wsp-release-lane.mjs | 33 +- 162 files changed, 20104 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/constellation-observatory.yml create mode 100644 .github/workflows/wsp-toolkit.yml create mode 100644 docs/constellation-design.md create mode 100644 docs/constellation-release.md create mode 100644 docs/constellation.md create mode 100644 packages/wsp-toolkit/.gitignore create mode 100644 packages/wsp-toolkit/README.md create mode 100644 packages/wsp-toolkit/docs/design.md create mode 100644 packages/wsp-toolkit/docs/evidence/constellation-live-summary.json create mode 100644 packages/wsp-toolkit/docs/evidence/constellation-node-22-validation.json create mode 100644 packages/wsp-toolkit/docs/evidence/constellation-node-24-validation.json create mode 100644 packages/wsp-toolkit/docs/evidence/constellation-package-archives.json create mode 100644 packages/wsp-toolkit/docs/evidence/huggingface-live.json create mode 100644 packages/wsp-toolkit/docs/evidence/loop-demo.json create mode 100644 packages/wsp-toolkit/docs/evidence/loop-node-22-validation.json create mode 100644 packages/wsp-toolkit/docs/evidence/loop-node-24-validation.json create mode 100644 packages/wsp-toolkit/docs/evidence/loop-package-archives.json create mode 100644 packages/wsp-toolkit/docs/evidence/node-22-validation.json create mode 100644 packages/wsp-toolkit/docs/evidence/node-24-validation.json create mode 100644 packages/wsp-toolkit/docs/evidence/package-archives.json create mode 100644 packages/wsp-toolkit/docs/evidence/ruos-validation.json create mode 100644 packages/wsp-toolkit/docs/huggingface-source.json create mode 100644 packages/wsp-toolkit/docs/loop-design.md create mode 100644 packages/wsp-toolkit/docs/loop-validation.md create mode 100644 packages/wsp-toolkit/docs/validation.md create mode 100644 packages/wsp-toolkit/package-lock.json create mode 100644 packages/wsp-toolkit/package.json create mode 100644 packages/wsp-toolkit/packages/cloudflare/LICENSE create mode 100644 packages/wsp-toolkit/packages/cloudflare/README.md create mode 100644 packages/wsp-toolkit/packages/cloudflare/constellation.json create mode 100644 packages/wsp-toolkit/packages/cloudflare/package.json create mode 100644 packages/wsp-toolkit/packages/cloudflare/scripts/build.mjs create mode 100644 packages/wsp-toolkit/packages/cloudflare/src/build.d.ts create mode 100644 packages/wsp-toolkit/packages/cloudflare/src/build.js create mode 100644 packages/wsp-toolkit/packages/cloudflare/src/index.d.ts create mode 100644 packages/wsp-toolkit/packages/cloudflare/src/index.js create mode 100644 packages/wsp-toolkit/packages/cloudflare/src/worker.js create mode 100644 packages/wsp-toolkit/packages/cloudflare/test/handler.test.mjs create mode 100644 packages/wsp-toolkit/packages/cloudflare/test/workerd.test.mjs create mode 100644 packages/wsp-toolkit/packages/cloudflare/wrangler.jsonc create mode 100644 packages/wsp-toolkit/packages/constellation/LICENSE create mode 100644 packages/wsp-toolkit/packages/constellation/README.md create mode 100644 packages/wsp-toolkit/packages/constellation/catalog.json create mode 100644 packages/wsp-toolkit/packages/constellation/constellation.json create mode 100644 packages/wsp-toolkit/packages/constellation/package.json create mode 100755 packages/wsp-toolkit/packages/constellation/src/cli.js create mode 100644 packages/wsp-toolkit/packages/constellation/src/index.d.ts create mode 100644 packages/wsp-toolkit/packages/constellation/src/index.js create mode 100644 packages/wsp-toolkit/packages/constellation/test/onramp.test.mjs create mode 100644 packages/wsp-toolkit/packages/contracts/LICENSE create mode 100644 packages/wsp-toolkit/packages/contracts/README.md create mode 100644 packages/wsp-toolkit/packages/contracts/constellation.json create mode 100644 packages/wsp-toolkit/packages/contracts/package.json create mode 100644 packages/wsp-toolkit/packages/contracts/schemas/catalog.schema.json create mode 100644 packages/wsp-toolkit/packages/contracts/schemas/module.schema.json create mode 100644 packages/wsp-toolkit/packages/contracts/schemas/wsp-references.schema.json create mode 100644 packages/wsp-toolkit/packages/contracts/src/index.d.ts create mode 100644 packages/wsp-toolkit/packages/contracts/src/index.js create mode 100644 packages/wsp-toolkit/packages/contracts/test/contracts.test.mjs create mode 100644 packages/wsp-toolkit/packages/huggingface/LICENSE create mode 100644 packages/wsp-toolkit/packages/huggingface/README.md create mode 100644 packages/wsp-toolkit/packages/huggingface/constellation.json create mode 100644 packages/wsp-toolkit/packages/huggingface/package.json create mode 100644 packages/wsp-toolkit/packages/huggingface/src/index.d.ts create mode 100644 packages/wsp-toolkit/packages/huggingface/src/index.js create mode 100644 packages/wsp-toolkit/packages/huggingface/test/hub.test.mjs create mode 100644 packages/wsp-toolkit/packages/invariants/LICENSE create mode 100644 packages/wsp-toolkit/packages/invariants/README.md create mode 100644 packages/wsp-toolkit/packages/invariants/constellation.json create mode 100644 packages/wsp-toolkit/packages/invariants/package.json create mode 100644 packages/wsp-toolkit/packages/invariants/src/data.js create mode 100644 packages/wsp-toolkit/packages/invariants/src/index.d.ts create mode 100644 packages/wsp-toolkit/packages/invariants/src/index.js create mode 100644 packages/wsp-toolkit/packages/invariants/test/invariants.test.mjs create mode 100644 packages/wsp-toolkit/packages/lifecycle/LICENSE create mode 100644 packages/wsp-toolkit/packages/lifecycle/README.md create mode 100644 packages/wsp-toolkit/packages/lifecycle/constellation.json create mode 100644 packages/wsp-toolkit/packages/lifecycle/package.json create mode 100755 packages/wsp-toolkit/packages/lifecycle/src/cli.js create mode 100644 packages/wsp-toolkit/packages/lifecycle/src/index.d.ts create mode 100644 packages/wsp-toolkit/packages/lifecycle/src/index.js create mode 100644 packages/wsp-toolkit/packages/lifecycle/test/gate.test.mjs create mode 100644 packages/wsp-toolkit/packages/loop/LICENSE create mode 100644 packages/wsp-toolkit/packages/loop/README.md create mode 100644 packages/wsp-toolkit/packages/loop/constellation.json create mode 100644 packages/wsp-toolkit/packages/loop/package.json create mode 100644 packages/wsp-toolkit/packages/loop/src/data.js create mode 100644 packages/wsp-toolkit/packages/loop/src/index.d.ts create mode 100644 packages/wsp-toolkit/packages/loop/src/index.js create mode 100644 packages/wsp-toolkit/packages/loop/test/loop.test.mjs create mode 100644 packages/wsp-toolkit/packages/registry/LICENSE create mode 100644 packages/wsp-toolkit/packages/registry/README.md create mode 100644 packages/wsp-toolkit/packages/registry/constellation.json create mode 100644 packages/wsp-toolkit/packages/registry/package.json create mode 100644 packages/wsp-toolkit/packages/registry/src/index.d.ts create mode 100644 packages/wsp-toolkit/packages/registry/src/index.js create mode 100644 packages/wsp-toolkit/packages/registry/test/registry.test.mjs create mode 100644 packages/wsp-toolkit/packages/ruos/LICENSE create mode 100644 packages/wsp-toolkit/packages/ruos/README.md create mode 100644 packages/wsp-toolkit/packages/ruos/constellation.json create mode 100644 packages/wsp-toolkit/packages/ruos/package.json create mode 100644 packages/wsp-toolkit/packages/ruos/src/index.d.ts create mode 100644 packages/wsp-toolkit/packages/ruos/src/index.js create mode 100644 packages/wsp-toolkit/packages/ruos/test/ruos.test.mjs create mode 100644 packages/wsp-toolkit/packages/search/LICENSE create mode 100644 packages/wsp-toolkit/packages/search/README.md create mode 100644 packages/wsp-toolkit/packages/search/constellation.json create mode 100644 packages/wsp-toolkit/packages/search/package.json create mode 100644 packages/wsp-toolkit/packages/search/src/data.js create mode 100644 packages/wsp-toolkit/packages/search/src/index.d.ts create mode 100644 packages/wsp-toolkit/packages/search/src/index.js create mode 100644 packages/wsp-toolkit/packages/search/test/search.test.mjs create mode 100644 packages/wsp-toolkit/packages/swarm/LICENSE create mode 100644 packages/wsp-toolkit/packages/swarm/README.md create mode 100644 packages/wsp-toolkit/packages/swarm/constellation.json create mode 100644 packages/wsp-toolkit/packages/swarm/package.json create mode 100644 packages/wsp-toolkit/packages/swarm/src/data.js create mode 100644 packages/wsp-toolkit/packages/swarm/src/index.d.ts create mode 100644 packages/wsp-toolkit/packages/swarm/src/index.js create mode 100644 packages/wsp-toolkit/packages/swarm/src/worker.js create mode 100644 packages/wsp-toolkit/packages/swarm/test/swarm.test.mjs create mode 100644 packages/wsp-toolkit/packages/telemetry/LICENSE create mode 100644 packages/wsp-toolkit/packages/telemetry/README.md create mode 100644 packages/wsp-toolkit/packages/telemetry/constellation.json create mode 100644 packages/wsp-toolkit/packages/telemetry/package.json create mode 100644 packages/wsp-toolkit/packages/telemetry/src/analyze.js create mode 100644 packages/wsp-toolkit/packages/telemetry/src/collect.js create mode 100644 packages/wsp-toolkit/packages/telemetry/src/dashboard.js create mode 100644 packages/wsp-toolkit/packages/telemetry/src/data.js create mode 100644 packages/wsp-toolkit/packages/telemetry/src/index.d.ts create mode 100644 packages/wsp-toolkit/packages/telemetry/src/index.js create mode 100644 packages/wsp-toolkit/packages/telemetry/test/dashboard.test.mjs create mode 100644 packages/wsp-toolkit/packages/telemetry/test/fixtures.mjs create mode 100644 packages/wsp-toolkit/packages/telemetry/test/telemetry.test.mjs create mode 100644 packages/wsp-toolkit/scripts/benchmark.mjs create mode 100644 packages/wsp-toolkit/scripts/constellation-links.mjs create mode 100644 packages/wsp-toolkit/scripts/constellation-report.mjs create mode 100644 packages/wsp-toolkit/scripts/evolution-demo.mjs create mode 100644 packages/wsp-toolkit/scripts/huggingface-live.mjs create mode 100644 packages/wsp-toolkit/scripts/packed-consumer.mjs create mode 100644 packages/wsp-toolkit/scripts/validate.mjs create mode 100644 packages/wsp-toolkit/test/browser.test.mjs create mode 100644 packages/wsp-toolkit/test/constellation-browser.test.mjs create mode 100644 packages/wsp-toolkit/test/constellation-fixture.mjs create mode 100644 packages/wsp-toolkit/test/constellation-scenario.mjs create mode 100644 packages/wsp-toolkit/test/constellation.test.mjs create mode 100644 packages/wsp-toolkit/test/consumer.test.mjs create mode 100644 packages/wsp-toolkit/test/evolution-scenario.mjs create mode 100644 packages/wsp-toolkit/test/integration.test.mjs create mode 100644 packages/wsp-toolkit/test/scenario.mjs create mode 100644 packages/wsp-toolkit/test/types.ts create mode 100644 packages/wsp-toolkit/tooling/agentdb/.npmrc create mode 100644 packages/wsp-toolkit/tooling/agentdb/README.md create mode 100644 packages/wsp-toolkit/tooling/agentdb/package-lock.json create mode 100644 packages/wsp-toolkit/tooling/agentdb/package.json create mode 100644 packages/wsp-toolkit/tooling/agentdb/runtime.mjs create mode 100644 packages/wsp-toolkit/tsconfig.json create mode 100644 scripts/constellation-oidc.mjs create mode 100644 scripts/constellation-oidc.test.mjs diff --git a/.github/workflows/constellation-observatory.yml b/.github/workflows/constellation-observatory.yml new file mode 100644 index 000000000..dc1e43331 --- /dev/null +++ b/.github/workflows/constellation-observatory.yml @@ -0,0 +1,40 @@ +name: Constellation observatory + +on: + workflow_dispatch: + inputs: + end: + description: Last complete UTC day (YYYY-MM-DD); blank uses yesterday + required: false + type: string + +permissions: + contents: read + +jobs: + report: + runs-on: ubuntu-24.04 + timeout-minutes: 10 + defaults: + run: + working-directory: packages/wsp-toolkit + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: '24.22.1' + package-manager-cache: false + - name: Install locked runtime packages without lifecycle scripts + run: npm ci --omit=dev --ignore-scripts --no-audit --no-fund + - name: Build public-only report without project adoption data + env: + CONSTELLATION_REPORT_END: ${{ inputs.end || '' }} + run: node scripts/constellation-report.mjs --output "$RUNNER_TEMP/constellation" + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: constellation-${{ github.sha }}-${{ github.run_id }} + path: ${{ runner.temp }}/constellation/ + if-no-files-found: error + retention-days: 30 diff --git a/.github/workflows/protected-wsp-release.yml b/.github/workflows/protected-wsp-release.yml index ccba5bf92..66e7f0a5d 100644 --- a/.github/workflows/protected-wsp-release.yml +++ b/.github/workflows/protected-wsp-release.yml @@ -34,7 +34,7 @@ jobs: persist-credentials: false - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: - node-version: '24.0.0' + node-version: '24.22.1' registry-url: https://registry.npmjs.org package-manager-cache: false - name: Require exact current main and reviewed SHA @@ -47,14 +47,19 @@ jobs: test "$(git rev-parse HEAD)" = "$EXPECTED_SHA" test "$(gh api repos/${GITHUB_REPOSITORY}/commits/main --jq .sha)" = "$EXPECTED_SHA" test "$(gh api "repos/${GITHUB_REPOSITORY}/issues?labels=release-blocker&state=open&per_page=1" --jq length)" = 0 + - name: Pin npm CLI with trusted publishing support + run: | + npm install --prefix "$RUNNER_TEMP/wsp-npm-cli" --ignore-scripts --no-audit --no-fund npm@11.9.0 + echo "$RUNNER_TEMP/wsp-npm-cli/node_modules/.bin" >> "$GITHUB_PATH" - name: Download and verify only the exact successful qualification artifact env: GH_TOKEN: ${{ github.token }} run: node scripts/wsp-candidate-download.mjs --expected-sha "${{ inputs.expected_sha }}" --output "$RUNNER_TEMP/wsp-candidate" - - name: Publish exact archive with npm provenance or verify identical existing version + - name: Publish exact archive using npm OIDC and provenance or verify identical existing version env: GH_TOKEN: ${{ github.token }} - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: '' + NPM_TOKEN: '' run: node scripts/wsp-release-lane.mjs publish --seal "$RUNNER_TEMP/wsp-candidate/candidate-seal.json" --output "$RUNNER_TEMP/wsp-publication.json" - name: Verify fresh-cache public install and full real-WASM consumer env: diff --git a/.github/workflows/wsp-modules.yml b/.github/workflows/wsp-modules.yml index 68e705d16..f4a57ff97 100644 --- a/.github/workflows/wsp-modules.yml +++ b/.github/workflows/wsp-modules.yml @@ -6,6 +6,7 @@ on: paths: - 'packages/wsp/**' - 'scripts/wsp-*.mjs' + - 'scripts/constellation-oidc*.mjs' - 'scripts/wsp-benchmark-tree.py' - '.github/workflows/wsp-modules.yml' - '.github/workflows/protected-wsp-release.yml' @@ -50,6 +51,8 @@ jobs: run: | python -m venv "$RUNNER_TEMP/wsp-benchmark-python" "$RUNNER_TEMP/wsp-benchmark-python/bin/python" -m pip install --require-hashes --only-binary=:all: -r packages/wsp/benchmarks/requirements.lock + - name: Validate tokenless publication context and existing release evidence guards + run: node --test scripts/constellation-oidc.test.mjs scripts/wsp-release-evidence.test.mjs - name: Run source tests and require zero skips or todos on Node 22 run: node scripts/wsp-release-lane.mjs unit --output "$RUNNER_TEMP/wsp-receipts/node-22-unit.json" - name: Pack candidate exactly once diff --git a/.github/workflows/wsp-toolkit.yml b/.github/workflows/wsp-toolkit.yml new file mode 100644 index 000000000..09ede5635 --- /dev/null +++ b/.github/workflows/wsp-toolkit.yml @@ -0,0 +1,51 @@ +name: WSP toolkit qualification + +on: + pull_request: + branches: [main] + paths: + - 'packages/wsp-toolkit/**' + - 'scripts/constellation-oidc*.mjs' + - 'scripts/wsp-release-lane.mjs' + - '.github/workflows/protected-wsp-release.yml' + - '.github/workflows/constellation-observatory.yml' + - '.github/workflows/wsp-toolkit.yml' + workflow_dispatch: + +permissions: + contents: read + +jobs: + qualify: + runs-on: ubuntu-24.04 + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + node: ['22.13.0', '24.22.1'] + defaults: + run: + working-directory: packages/wsp-toolkit + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: ${{ matrix.node }} + package-manager-cache: false + - name: Install locked dependencies without lifecycle scripts + run: npm ci --ignore-scripts --no-audit --no-fund + - name: Install locked real AgentDB integration runtime + run: npm run setup:agentdb + - name: Install real Chromium + run: npx --no-install playwright install --with-deps chromium + - name: Require types, zero-skip tests, real WASM, packed consumers, benchmark and clean audit + run: npm run validate + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: wsp-toolkit-node-${{ matrix.node }}-${{ github.sha }} + path: packages/wsp-toolkit/.artifacts/ + include-hidden-files: true + if-no-files-found: error + retention-days: 30 diff --git a/docs/constellation-design.md b/docs/constellation-design.md new file mode 100644 index 000000000..71999c0ec --- /dev/null +++ b/docs/constellation-design.md @@ -0,0 +1,46 @@ +# Growth constellation implementation contract + +## Outcome and acceptance + +Extend the local WSP toolkit into a concrete constellation reference: a lightweight discover/plan/scaffold CLI, dependency-free shared module/contracts metadata, an explicit catalog with verified public anchors and local candidates, a standalone interactive telemetry dashboard, deterministic README cross-links, and a genuinely tokenless OIDC path for the existing protected WSP release. Preserve previous uncommitted work and package names. No registry publication, scope claim, remote repository change or scheduled collection is performed by this task. + +Acceptance: a fresh packed consumer runs the onramp without pulling an ML stack; scaffolds a package in a new temporary directory; runs its built-in checks; the telemetry aggregator handles a real public cohort and an explicit local adoption sample without inventing attach rates; its HTML works in Chromium; the existing release's source/archive checks remain intact while token fallback is eliminated; all existing toolkit tests and new contract/security checks pass. + +## Ownership + +- Onramp worker: `packages/wsp-toolkit/packages/contracts/**` and `packages/wsp-toolkit/packages/constellation/**`, EXCEPT `packages/constellation/catalog.json` owned by coordinator. Packages `ruvnet-constellation-contracts@0.1.0` and `ruvnet-constellation@0.1.0`. +- Telemetry worker: `packages/wsp-toolkit/packages/telemetry/**` only. Package `ruvnet-constellation-telemetry@0.1.0`. +- Release worker: `.github/workflows/protected-wsp-release.yml`, `scripts/wsp-release-lane.mjs`, new `scripts/constellation-oidc.mjs`, `scripts/constellation-oidc.test.mjs`, `docs/constellation-release.md` only. +- Coordinator: catalog.json, root manifests/lockfiles, root integration/CLI/report/readme scripts, toolkit E2E/browser/type tests, other documentation/qualification workflow. + +Workers own their source/declarations/README/LICENSE/package manifest/tests; no root lockfile edits. New packages ESM, src/index.js and src/index.d.ts, version0.1.0, Node20.9+ (qualification Node22.13+). Dependency-free contracts and telemetry; CLI depends only on contracts0.1.0. No lifecycle install hooks or default data collection. + +## Catalog and contract + +Catalog schema `ruvnet.constellation-catalog/1` has `{schema, repository:'ruvnet/ruv-FANN', packages:[...], profiles:[...]}`. Package record is `{name, role:'nucleus'|'primitive'|'satellite', family, status:'published'|'candidate', version, repository:'owner/repo', directory?:relativeRepoPath, description, contracts?:string[], links?:{npm?:httpsURL,source?:httpsURL}, proposedScope?:string}`. Only verified actual public names have status published. Candidate means local source, not a claim about npm ownership/existence. Unique names, bounded counts<=1000, safe names/paths and explicit schema IDs. No renaming published packages or adding irrelevant peer dependencies to manufacture volume. + +Profile record `{id,description,packages:string[]}`; allow only known catalog package names. CLI planning returns package specs/links/availability, does not install them. Catalog lives in CLI package as `catalog.json`, coordinator will populate it. Actual public anchors include metaharness0.4.23, @metaharness/router0.4.1, @claude-flow/cli3.25.6 validated pin (registry latest observed3.75.3), ruflo3.75.3, ruvector0.3.24, agentdb3.10.0, agentic-flow3.5.4, @ruvector/attention2.3.1, @ruvector/ruvllm4.2.2, ruv-fann-wsp0.2.0, ruv-fann0.1.2, ruv-fann-wasm0.1.2. @metaharness/cli returns404 and is not listed as published. + +Contracts library exports CONTRACTS exact IDs (model dense-layers/1, patch weight-patch/1, evaluation weight-evaluation/1, module ruvnet.constellation-module/1), `validateCatalog(catalog)` returning owned validated data, and `validateModuleManifest({schema:'ruvnet.constellation-module/1',name,version,role,contracts,integrations:string[]})`. Include JSON schemas for module manifest/catalog and references to canonical existing WSP formats; schema/metadata validation does not replace real WSP numerical validation. Strict plain data, bounds, unknown fields/accessors/unsafe paths refusal, snapshots. No SDK/network dependencies. + +## CLI + +Expose `readCatalog()` and `planProfile(catalog,id)`, `scaffoldSatellite({directory,name,description?,integrations?})`, plus bin `constellation`. Commands help/catalog/plan /scaffold --name . Help links nucleus and core packages. No shell interpolation, provider calls, registry publication, automatic install or hidden telemetry. Scaffold to a new directory only, refuse existing path/symlink and traversal; produce standalone ESM package, tests, README crosslinks, module manifest. Use explicit optional integration metadata; do not force nucleus dependencies into every satellite. Include package quality scripts and draft protected-publication guidance. Only write files below the explicit new target. Tests cover fresh scaffold/npm test, refusal existing files, safe names and paths, no exec/telemetry, packed catalog access. Catalog import validation must work after installation. + +## Telemetry interfaces + +`collectPublicMetrics(catalog,{start,end,fetch?,timeoutMs?,concurrency?})` returns owned observations with schema `ruvnet.constellation-observations/1`, observedAt, start,end, packages entries `{name,status:'ok'|'unavailable'|'candidate',days:[{day,downloads}],version?,dependencies?:string[],peerDependencies?:string[],optionalDependencies?:string[],error?,repository?}`, and repositories array `{repository,status,stars?,openIssuesAndPRs?,error?}`. Fixed HTTPS hosts registry.npmjs.org, api.npmjs.org, api.github.com; validate catalog and names/dates; finite byte/deadline/concurrency caps, explicit per-source unavailable status, no token/cookie persistence, no hidden model calls. Per-package downloads use `/downloads/range/YYYY-MM-DD:YYYY-MM-DD/`. Repo metadata `open_issues_count` includes PRs and must be labeled correctly. Query only published entries; candidate stats unknown, never zero-filled. + +`analyzeConstellation(catalog,observations,{adoption?}?)` returns report schema `ruvnet.constellation-report/1`, observedAt,start,end, packages rows, totals, correlations/weekday summaries if data permits, repositories, attach. Package row has name,role,family,status, latestDayDownloads,last7Downloads,last30Downloads,weekdayBaseline,weekdayDeltaPercent (nullable when incomplete/zero denominator) plus actual declared dependency links. Do not conflate transitive downloads with independent users or sum overlapping anchor cohorts as unique adoption. + +Optional adoption schema `{schema:'ruvnet.constellation-adoption/1',consent:true,samples:[{sampleId:64hex,observedAt:ISO8601,packages:string[]}]}`. Process explicit local data only; deduplicate by sampleId and latest observation, conflicting duplicates reject. Attach is a percentage of observed consenting project snapshots containing a nucleus and a primitive, never users. Without adoption input return attach.status:'unavailable' and null percentages. Returned reports must not contain sample IDs/raw snapshots. No auto scanning or upload. Include coverage/denominators and metric definitions. + +`renderConstellationDashboard(report)` returns self-contained HTML with family/role/search/period controls, package table/trend visualization, repository issue signal, candidate/unavailable states, source/coverage labels and attach explanation. Use no external JS/fonts/trackers, escape all untrusted fields/embedded JSON, textContent for dynamic data, safe links only. Browser errors/XSS regression and controls must be tested with actual Chromium by coordinator. A locally generated dashboard is the deliverable; no hosting operation is implicit. + +## Release changes + +Official npm docs currently require npm>=11.5.1 and Node>=22.14.0 for trusted publishing. Existing workflow grants id-token:write but injects NPM_TOKEN, and existing WSP publisher refuses missing NODE_AUTH_TOKEN. Remove token requirement/fallback for this protected lane, keep exact-main/source/archive/provenance checks, add explicit runtime/OIDC-context checks and pin supported Node/npm versions. No live publish or trusted-publisher configuration change. Record npm per-package trusted publisher owner/repository/workflow/environment setup as external prerequisite; inability to verify it is not success. Do not assume scoped names establish enterprise trust or replace dependency review. + +## Evidence boundaries + +The user-provided cohort/download figures are hypotheses until their source cohort/window is supplied. Start with verified repo packages and public anchors; support a supplied full catalog later. Aggregate npm download series measure downloads, including CI/transitive activity. Synchronization is correlation, not proof of attach or causal cross-pollination. Shared standards support compatibility; exact numerical evaluation/hash/revision authority stays with the existing WSP/AgentDB components. Historical validation receipts remain historical; create separate constellation receipts. diff --git a/docs/constellation-release.md b/docs/constellation-release.md new file mode 100644 index 000000000..a4dd70162 --- /dev/null +++ b/docs/constellation-release.md @@ -0,0 +1,64 @@ +# Tokenless trusted publishing for constellation packages + +The protected WSP release now uses npm's GitHub OIDC path without a long-lived npm token fallback. This changes repository code only. No npm name, scope, publisher registration, GitHub environment or release was created or changed, and no live publish was attempted. + +## Existing WSP lane + +The publication entry point remains [protected-wsp-release.yml](../.github/workflows/protected-wsp-release.yml), with workflow name `protected-release`, job `publish`, a manual exact-SHA input and the upstream main-branch restriction. Its toolchain is pinned to Node `24.22.1` and npm `11.9.0`. npm is installed into a runner-temporary prefix without lifecycle scripts; the release PATH selects that explicit CLI. Official npm documentation currently requires npm `11.5.1+` and Node `22.14.0+` for trusted publishing. + +The protected script retains the existing checks: + +- The checkout, reviewed input, GitHub SHA, workflow ref and current upstream main must agree. +- Open `release-blocker` issues prevent publication. +- Only the successful qualification run's exact artifact is downloaded. +- The source-bound seal, tarball SHA-256/SHA-512, Node 22/24 receipts, browser proof, mutation checks, benchmark and dependency audit are revalidated. +- npm receives the exact verified archive bytes, copied into a private temporary publication directory without repacking, plus `--ignore-scripts --access public --provenance` and the fixed public registry. +- Public bytes are downloaded and compared; an already published version is accepted only when its bytes match. Public installation and GitHub release-asset checks still run afterward. + +[scripts/constellation-oidc.mjs](../scripts/constellation-oidc.mjs) adds a reusable, side-effect-free configuration guard. It requires the expected repository, workflow filename/name, branch, job, dispatch event, reviewed SHA and matching checkout; supported stable Node/npm versions; and the GitHub Actions OIDC request URL/capability. A fork, PR event, different job, missing OIDC permission, stale checkout or npm credential fallback fails before npm can publish. Error messages never include credential values. + +Environment strings are not an identity attestation. The helper reports `configuration-validated`, and npm must still obtain the actual GitHub token and match its claims against the package's registered trusted publisher. An identical-existing-version receipt can succeed without issuing any new OIDC upload. The receipt records `oidc-only` policy and whether it verified existing bytes or published/recovered an upload; it does not invent an OIDC exchange proof. + +The child npm process runs outside the checkout with controlled project, user and global `.npmrc` files and a fresh cache. Its environment omits npm auth values and inherited GitHub API tokens while retaining the short-lived Actions OIDC capability, proxy configuration and CA trust. The parent still uses the job's GitHub token for read-only source/blocker/artifact checks and the later release step. Auth files and environment objects are never written to receipts or logs. + +## Required external npm setup + +An authorized package owner must configure and verify the package's trusted-publisher relationship on npm before this lane can make a new upload. This task did not inspect or assert that registration. + +For the current WSP package, the registration must match: + +| npm field | Expected value | +| --- | --- | +| CI/CD provider | GitHub Actions on a GitHub-hosted runner | +| Organization or user | `ruvnet` | +| Repository | `ruv-FANN` | +| Workflow filename | `protected-wsp-release.yml` (filename only) | +| Environment name | None is declared by this workflow; any configured environment must agree with a deliberately reviewed job configuration | +| Allowed actions | Direct `npm publish` must be permitted; permission for staged publishing alone does not enable this command | + +The package's `repository.url` must match the upstream GitHub repository. Public-package provenance also requires a public repository. Names, scopes, ownership, access policy and initial-publication/bootstrap requirements for new satellites must be confirmed independently; local candidate manifests and scope suggestions do not establish npm ownership. Do not add a token fallback to bypass missing trusted-publisher setup. A registry authentication failure is an incomplete external setup result, not a successful release. + +Official reference: [npm trusted publishers](https://docs.npmjs.com/trusted-publishers/), inspected 2026-11-11. npm does not validate a saved publisher configuration automatically; its precise values and the first actual authorized publish require verification. + +## Applying the standard to satellites + +Keep independent package names and useful optional integrations. Scope branding alone does not establish security-scanner trust, ownership, a clean dependency tree or adoption. + +For each reviewed release: + +1. Establish package-name/scope ownership and exact repository metadata. +2. Run qualification on the exact reviewed source. Test the actual packed archive, declared integrations and fresh public consumer behavior. +3. Store the archive and evidence hashes in a source-bound seal. Carry those exact bytes through publication; do not rebuild during the privileged job. +4. Configure the package-specific npm trusted publisher to the reviewed repository/workflow/environment and permitted operation. +5. Use GitHub-hosted publication with minimal permissions, `id-token: write`, supported pinned Node/npm versions and tokenless isolated npm configuration. +6. Validate identity/context independently of the artifact checks, publish with provenance, and verify public bytes and consumers. Preserve partial/failure results rather than treating an existing version or coordination record as proof of a new upload. + +The helper can receive an explicit reviewed policy for another workflow. Changing the policy is a source change requiring the same review as the workflow; it is not a remote capability discovery or authorization mechanism. The existing WSP source/archive invariants are not automatically inherited by another package merely because it imports the helper. + +## Local validation + +```sh +node --test scripts/constellation-oidc.test.mjs scripts/wsp-release-evidence.test.mjs +``` + +Tests cover minimum/unsupported toolchains, fork/PR/job/event/source mismatches, missing or external OIDC endpoints, credential fallback spellings, getters and malformed data, child-environment isolation, and actual publication-entry rejection before any registry or GitHub operation. They also verify that the protected workflow retains OIDC permissions, explicit tool pins and source/archive checks. These are configuration and failure-path tests; no live OIDC exchange or publication is claimed. diff --git a/docs/constellation.md b/docs/constellation.md new file mode 100644 index 000000000..e22005d44 --- /dev/null +++ b/docs/constellation.md @@ -0,0 +1,91 @@ +# Growth constellation reference + +This checkout now implements the operational pieces of the constellation strategy: a small discover/plan/scaffold entry point, common module metadata, explicit optional integrations, consistent documentation links, public cohort reporting and a protected tokenless WSP publication path. It extends the existing WSP swarm loop without renaming its packages or adding orchestration dependencies to every primitive. + +## Start here + +```sh +cd packages/wsp-toolkit +npm ci --ignore-scripts --no-audit --no-fund +npm run constellation -- help +npm run constellation -- plan weights +npm run constellation -- plan local-loop +``` + +The `weights` profile returns the verified published pin `ruv-fann-wsp@0.2.0`. The `local-loop` profile returns candidate source locations and explicitly declines to represent those candidates as public npm install specs. Planning installs nothing and sends no telemetry. The CLI depends only on the dependency-free contracts package; the fresh-consumer test verifies that installing the onramp installs exactly those two packages and no ML stack. + +Create a local, independently useful satellite template in a new directory: + +```sh +npm run constellation -- scaffold /tmp/my-constellation-adapter --name my-constellation-adapter +cd /tmp/my-constellation-adapter +npm test +npm run benchmark +npm run pack:check +``` + +The scaffold is a bounded JSON-copy adapter template with independent validation cases. It does not generate arbitrary domain logic or prove domain accuracy. It adds module metadata, tests, documentation and publication guidance, with no forced nucleus dependency. Scaffolding uses held directory handles on Linux; catalog/planning remain portable Node APIs. The CLI refuses unsupported secure-scaffold routes instead of silently falling back to pathname-only writes. Concurrent same-user code is not a hardened isolation boundary. + +## Catalog and scopes + +The authoritative [catalog](../packages/wsp-toolkit/packages/constellation/catalog.json) contains 24 entries: 12 verified public anchors/specialists and 12 local package candidates. It records roles, families, exact planning pins, repositories, source directories, existing shared formats and four profiles. Collection can accept another validated catalog of up to 1,000 entries, so a full cohort can be supplied without changing code. + +The supplied 405-package cohort and its original measurement windows were not present in this checkout. The default catalog therefore does not claim to cover that cohort or reproduce its aggregate figures. The public `metaharness` entry exists; `@metaharness/cli` returned npm404 and is not offered as a published package. GitHub's former `ruvnet/claude-flow` repository resolves to `ruvnet/ruflo`, which the catalog uses. The validated Ruflo CLI planning pin remains 3.25.6 even when registry metadata observes a newer version. + +`proposedScope` values are migration proposals, not assertions of namespace ownership. Existing published identities remain compatible. Before any scoped migration, verify account ownership, choose a version/alias/deprecation plan, preserve downstream imports and separately configure the new package's trusted publisher. A scope is an organizational label; provenance, dependency review and runtime behavior establish the relevant security evidence. + +Every local candidate includes a `constellation.json` module manifest. The new contracts package publishes catalog/module JSON schemas and identifiers for the existing WSP model, patch, evaluation and related formats. These metadata contracts do not replace WSP's bounded numerical validation, SHA-256 model checks or AgentDB revision authority. Actual core packages retain their existing dependency requirements; this work does not claim that AgentDB, RuVector or WSP are dependency-free. + +## README routing and optional integration + +```sh +cd packages/wsp-toolkit +npm run constellation:links +npm run constellation:check +``` + +The generator writes marked, deterministic cross-links and module manifests for the 12 workspace candidates. Qualification checks for drift. Cross-links point to the onramp, shared standards, relevant primitives and optional orchestration. Integration metadata derives from actual declared dependencies/peers; the generator adds no runtime dependencies. This provides discoverability without manufacturing package downloads through unrelated peer dependencies. + +## Public telemetry dashboard + +```sh +cd packages/wsp-toolkit +npm run constellation:report +# For inherited proxy settings on managed Node24: +NODE_USE_ENV_PROXY=1 npm run constellation:report +``` + +The command writes `.artifacts/constellation/{observations.json,report.json,dashboard.html}`. Open the HTML locally; it has no external scripts, fonts, trackers or runtime network requests. Family/role/search/window controls and per-package trends operate entirely on the embedded report. Collection is an explicit read of public npm/GitHub endpoints, with fixed hosts, bounded responses, a finite deadline and concurrency limits. + +Collection defaults to 42 complete UTC days ending yesterday. Download totals require complete coverage; missing packages/days remain unknown. The live reference collected through 2026-11-10 has nine measured download series, three FANN download endpoints returning404, 12 source candidates and six observed repositories. All 12 public package metadata requests succeeded. Registry metadata confirms those FANN packages exist; an unavailable downloads endpoint is not evidence of zero downloads. The report retains this distinction. + +Repository counts use GitHub's `open_issues_count`, which includes open pull requests. Declared dependency links describe manifests, not measured co-installation. Weekday comparisons use the preceding four matching weekdays; correlations are descriptive and cannot establish causal cross-pollination or distinct users. The manually dispatched [observatory workflow](../.github/workflows/constellation-observatory.yml) uploads report artifacts only. No recurring job, public dashboard hosting or remote configuration has been enabled here. + +## Measured attach requires a separate input + +Without explicit joint-adoption data, attach is unavailable. Aggregate downloads and correlations cannot supply its denominator. To analyze a consenting local sample: + +```sh +npm run constellation:report -- --adoption /path/to/consenting-project-snapshots.json +``` + +The input schema is `ruvnet.constellation-adoption/1`, with `consent:true` and samples containing a pseudonymous lowercase SHA-256 `sampleId`, an ISO UTC `observedAt`, and package names. Keep raw project identifiers out of this file. Consent is the caller's assertion, not a cryptographic proof or permission grant. + +The analyzer deduplicates snapshots by project and timestamp, rejects contradictory duplicates even out of order, and keeps the latest valid snapshot per project in the window. The denominator is sampled projects containing any nucleus; the numerator contains a primitive as well. It reports overall/per-primitive attach with explicit denominators and the unit `consenting-project-snapshots`. This is a sample statistic, not a percentage of npm users or developers. Sample IDs and raw snapshots stay out of reports and network requests. No workspace scanning or automatic collection is added. + +## Trusted publishing + +The existing WSP protected lane previously granted OIDC permissions while still requiring `NPM_TOKEN`. The revised path pins supported Node/npm, rejects token fallback, retains exact-main/sealed-archive/provenance checks and publishes from isolated auth-free npm configuration. A registration matching the exact package/owner/repository/workflow/environment is still required at npm. No registration, scope claim, initial publication, live OIDC exchange or package upload was performed. See [release setup and boundaries](constellation-release.md). + +## Qualification + +```sh +cd packages/wsp-toolkit +npm run setup:agentdb +npx --no-install playwright install --with-deps chromium +npm run validate +``` + +Qualification includes the existing real-WASM/swarm/AgentDB scenarios, all new contracts/onramp/telemetry tests, the root OIDC-context/release-evidence tests, strict types, deterministic documentation metadata, standalone browser controls and a fresh consumer of all12 archives. A separate consumer proves the two-package onramp footprint. Security regressions cover conflicting adoption snapshots, embedded HTML/script injection, report-output symlink replacement and concurrent scaffold directory substitution. + +Historical WSP/loop receipts remain unchanged. New source-bound qualification receipts are stored as `constellation-node-22-validation.json` and `constellation-node-24-validation.json` under the toolkit's `docs/evidence` directory. Live observations and summary evidence are separate from synthetic test fixtures. Successful local qualification does not assert that GitHub CI, npm trusted-publisher registration or hosted publication has executed. diff --git a/packages/wsp-toolkit/.gitignore b/packages/wsp-toolkit/.gitignore new file mode 100644 index 000000000..856494c32 --- /dev/null +++ b/packages/wsp-toolkit/.gitignore @@ -0,0 +1,2 @@ +.artifacts/ +packages/cloudflare/dist/ diff --git a/packages/wsp-toolkit/README.md b/packages/wsp-toolkit/README.md new file mode 100644 index 000000000..37d3c8f0b --- /dev/null +++ b/packages/wsp-toolkit/README.md @@ -0,0 +1,111 @@ +# ruv-fann-wsp toolkit + +Twelve independent ESM subpackages extend `ruv-fann-wsp@0.2.0` with regression gates, bounded search, checkpoint transport and platform adapters. They use the published `ruv-fann@0.1.2` / `ruv-fann-wasm@0.1.2` runtime. The existing core package and its release lanes remain unchanged. This workspace prepares candidate packages; version `0.1.0` has not been published. + +| Package | Purpose | Public API | +| --- | --- | --- | +| [ruv-fann-wsp-lifecycle](packages/lifecycle/README.md) | CI regression suites and isolated candidate snapshots | `runRegressionGate`, `evaluatePatchBranches`, `wsp-gate` CLI | +| [ruv-fann-wsp-search](packages/search/README.md) | Bounded discrete optimization; experimental symbolic/plasticity proposals | `searchWeightPatch`, `compileBooleanTable`, `createHebbianPatch` | +| [ruv-fann-wsp-huggingface](packages/huggingface/README.md) | Commit-pinned, digest-verified public Hub JSON | `loadHubModel`, `loadHubLinearHead` | +| [ruv-fann-wsp-cloudflare](packages/cloudflare/README.md) | Authenticated stateless HTTP operations and static WASM build | `createWorkerHandler`, `buildWorker` | +| [ruv-fann-wsp-ruos](packages/ruos/README.md) | WASM lifecycle canary, shell plan, executor completion checks | `runWasmCanary`, `createValidationCommand`, `assertRuOSCompletion` | +| [ruv-fann-wsp-invariants](packages/invariants/README.md) | Finite-domain output constraints and exhaustive Boolean checks | `checkModelInvariants`, `estimateInvariantWork`, `createBooleanInvariant` | +| [ruv-fann-wsp-swarm](packages/swarm/README.md) | Real bounded proposal workers with separate WASM instances | `runProposalSwarm`, `estimateSwarmWork` | +| [ruv-fann-wsp-registry](packages/registry/README.md) | AgentDB revision authority with durable acknowledgements | `createAgentDBRegistry` | +| [ruv-fann-wsp-loop](packages/loop/README.md) | Autonomous local proposal/evaluation/promotion loop | `runEvolutionLoop` | +| [ruvnet-constellation-contracts](packages/contracts/README.md) | Dependency-free catalog/module contracts and canonical IDs | `CONTRACTS`, `validateCatalog`, `validateModuleManifest` | +| [ruvnet-constellation](packages/constellation/README.md) | Lightweight explicit discover/plan/scaffold onramp | `readCatalog`, `planProfile`, `scaffoldSatellite` | +| [ruvnet-constellation-telemetry](packages/telemetry/README.md) | Public cohort metrics, sampled project attach and standalone dashboard | `collectPublicMetrics`, `analyzeConstellation`, `renderConstellationDashboard` | + +## Constellation onramp and dashboard + +```sh +cd packages/wsp-toolkit +npm run constellation -- plan weights +npm run constellation -- plan local-loop +npm run constellation:report +``` + +The onramp plans explicit installs or source candidates and scaffolds reviewable local satellites. It installs no ML stack and collects no telemetry. The dashboard collects public metrics only when invoked; its HTML works offline. Default coverage is 12 verified public packages plus 12 local candidates. Measured project attach needs a separate consenting snapshot input; download correlations cannot establish it. See the [growth constellation guide](../../docs/constellation.md), [catalog](packages/constellation/catalog.json) and [protected OIDC setup](../../docs/constellation-release.md). + +## Run + +The qualification workspace needs Node 22.13+ (Miniflare requires Node 22). Published package candidates support Node 20.9+; the original five-package scenarios were also run on Node 20.20.2 through ruOS. The new loop uses Node worker threads; it does not run inside a browser or Cloudflare Worker. + +```sh +cd packages/wsp-toolkit +npm ci --ignore-scripts --no-audit --no-fund +npm run setup:agentdb +npx playwright install --with-deps chromium +npm run validate +npm run demo:loop +``` + +Validation requires strict declarations, passing tests with zero skips/todos, matching packed-consumer behavior, a benchmark oracle and zero npm advisories across both installed locked dependency trees. The real AgentDB integration runtime is isolated under `tooling/agentdb`; setup omits its unrelated optional native/model packages and never downloads a model. `.artifacts/validation.json` records the test counts, benchmark, lockfile digest and source-file digests. `npm test`, `npm run test:unit`, `npm run test:e2e`, `npm run check:types`, `npm run benchmark`, `npm run audit` and `npm run test:loop` are also available separately. + +The opt-in live Hub check uses a pinned public [source record](docs/huggingface-source.json): + +```sh +npm run test:hub:live +# In managed Node 24 environments using an inherited HTTP proxy: +NODE_USE_ENV_PROXY=1 npm run test:hub:live +``` + +`ruv/ruview/presence-head.json` is an affine vector and bias. The explicit adapter maps these to a Linear layer and tests its arithmetic with synthetic inputs. This validates transport and declared affine semantics; it does not measure WiFi presence accuracy or reconstruct the source pipeline. No Hub token, upload or GPU job is needed. + +## Run an autonomous loop + +`npm run demo:loop` executes five proposal jobs with concurrency three against two small models. Search workers find shortcuts on development cases; the coordinator rejects three of them using held-out suites, validates the useful candidates against independent output constraints, then promotes two checkpoints through real AgentDB. The demo closes and reopens its SQLite file, verifies the exact revisions, rolls both models back, and reopens again to check persistence. It writes an inspectable report and database in a unique `.artifacts/evolution-*` directory. + +```text +active AgentDB revision → fixed-operation proposal workers + → independent regression + invariant gates + → fresh AgentDB proposal → revision CAS promotion + → next bounded generation / restart / rollback +``` + +The loop has explicit round, proposal, work, worker, timeout and cancellation limits. Workers receive development cases only. Held-out data and acceptance rules remain with the coordinator. A worker result cannot authorize a commit. Active hashes are refreshed before declaring goals met, so another coordinator's rollback invalidates cached goal evidence. Tests exercise multiple generations, two concurrent loops, stale results, aborts and a real post-promotion disk-flush failure. See the [runnable scenario](test/evolution-scenario.mjs), [loop API](packages/loop/README.md), [delivery contract](docs/loop-design.md), and [loop validation](docs/loop-validation.md). + +AgentDB 3.10.0/sql.js performs actual persistence in this implementation. The registry adapter accepts a caller-owned controller, serializes operations across awaits, and acknowledges writes only after its persistence callback succeeds. Failed persistence blocks further work until reopen. The fixture uses AgentDB's own WSP 0.1.0 controller dependency, while the coordinator independently checks candidates with WSP 0.2.0. There are no automatic provider calls, generated-code execution, public package publication or billing actions. RuVector/MetaHarness/Agentic Flow routing and universal verification remain extension points. + +## Repair and gate + +```js +import { searchWeightPatch } from 'ruv-fann-wsp-search'; +import { runRegressionGate } from 'ruv-fann-wsp-lifecycle'; +import { createWeightWorkspace } from 'ruv-fann-wsp'; + +// model, dataset and policy are application-owned inputs. +const result = await searchWeightPatch(model, dataset, policy, { + locations: [0, 1].map(index => ({layer: 1, parameter: 'weights', index, values: [0, 1]})), + maxEvaluations: 8, + maxPasses: 2 +}); +if (result.patch && result.evaluation.accepted) { + const gate = await runRegressionGate({model, patch: result.patch, suites: [ + {name: 'heldout', dataset: independentDataset, policy} + ]}); + if (gate.accepted) { + const workspace = await createWeightWorkspace(model); + const original = workspace.snapshot(); + // Re-evaluate the promotion policy inside the workspace; a gate receipt is not authority. + const proposal = await workspace.propose(result.patch, independentDataset, policy); + if (proposal.evaluation.accepted) { + const next = workspace.promote(proposal.id, original.revision); + workspace.rollback(original.revision, next.revision); + } + } +} +``` + +For a PR gate, write `{model,patch,suites:[{name,dataset,policy}]}` to JSON and run `wsp-gate file.json`: exit 0 accepts, 1 rejects, 2 reports invalid input/runtime failure. The [complete executable scenario](test/scenario.mjs) covers two-weight XOR repair, activation and derivative oracles, rejected ablation, branching, compiled Boolean logic, localized plasticity, a Hub transport fixture and rollback in Node and real Chromium. + +## Platforms and boundaries + +Cloudflare's builder statically imports both precompiled WASM modules. Its actual `workerd` tests verify scalar/SIMD evaluation, tracing, sensitivity, ablation and authentication. Default configuration denies operations without a bearer secret. The Worker has no persistence, promotion, outbound model fetch or code execution endpoint. See its package README for building and optional deployment; no live Worker was deployed by this task. + +ruOS validation uses the observed Work Desktop executor, installs the same SHA-256-checked npm archives into a fresh temporary directory, builds the Worker, runs both packed WASM scenarios and repeats the live Hub check. The completion helper requires host-owned structured completion and never grants success from stdout text. It is a consistency check, not a cryptographic attestation or deployment permission. + +The Boolean compiler covers complete truth tables of at most six binary inputs. Hebbian updates are bounded proposals requiring independent evaluation. Search allows trusted synchronous local objective callbacks, including discontinuous scores; its winner can still fail the authoritative regression policy. Callbacks are not sandboxes. Candidate branches share a runtime and are evaluated sequentially; they do not provide process isolation. No generalization, arbitrary safety-input repair, transformer editing, hidden behavioral keys or autonomous provider execution is claimed. + +Performance qualification compares an identical 16-candidate one-coordinate sequence: cached baseline screening plus final authoritative validation uses 19 inference passes versus 32 for repeatedly evaluating both models. Timings are local observations. See the [original five-package validation](docs/validation.md), [current loop qualification](docs/loop-validation.md) and [delivery contract](docs/design.md). diff --git a/packages/wsp-toolkit/docs/design.md b/packages/wsp-toolkit/docs/design.md new file mode 100644 index 000000000..fa2cc1946 --- /dev/null +++ b/packages/wsp-toolkit/docs/design.md @@ -0,0 +1,26 @@ +# WSP toolkit delivery contract + +## Outcome and scope + +Deliver independent ESM/TypeScript subpackages around published `ruv-fann-wsp@0.2.0` with real WASM validation. Keep the existing WSP API unchanged. Actors are local developers, checkpoint reviewers and bounded patch generators. No generated code execution or implicit model promotion. No claim to edit transformer/safetensors checkpoints or validate arbitrary safety tasks. + +## Boundaries and owners + +- Coordinator: `packages/lifecycle`, `packages/ruos`, workspace integration, browser/packed E2E, CI, benchmarks, docs. +- Search worker: `packages/search` only; bounded deterministic derivative-free search, truth-table compilation and localized plasticity proposals. Experimental features must be explicit. +- Hub worker: `packages/huggingface` only; immutable-revision dense JSON fetch with SHA-256 and bounded downloads, metadata, tests. +- Cloudflare worker: `packages/cloudflare` only; stateless request handler, WASM Worker build and workerd E2E, no account mutations. + +Each worker owns its source, declarations, manifest, README and tests. Shared dependency is exact `ruv-fann-wsp@0.2.0`. All packages start at 0.1.0, use ESM, export `src/index.js` and `src/index.d.ts`, and include an MIT license. No worker edits workspace lockfile or root files. + +## Control flow and invariants + +Snapshot inputs → bound work → hash base/data/policy → propose candidate → evaluate with real WASM → return evidence → explicitly promote against expected revision. Rejected or stale candidates never change live state. Rollback increments revision and invalidates old proposals. Remote JSON is untrusted data; pin a Hub revision and verify bytes before validating model schema. Requests cannot select arbitrary URLs or shell commands. Never transfer host credentials. + +## Acceptance + +Unit tests cover malformed data, bounds, stale revisions and regression rejection. E2E composes a two-weight XOR repair, activation trace, sensitivity, neuron ablation and rollback. Independent analytic or exhaustive boolean oracles check numerical outputs. A real Chromium run and Cloudflare workerd run use real WASM. Package archives are installed into a fresh consumer and checked with TypeScript. Run ruOS validation using the observed Work Desktop ID and only trust executor-owned completion metadata. Record live Hub fetch evidence separately from local fixtures and account capability reads. Performance benchmarks compare bounded search with exhaustive candidate evaluation and report timing as observations, not guarantees. + +## Architecture decision + +Use an isolated npm workspace under `packages/wsp-toolkit` rather than adding experimental dependencies to the repository's native/swarm root workspace. Independent packages allow platform adapters and experiments to evolve without inflating the core runtime or changing protected release lanes. Cloudflare operations are stateless; application owners must supply authentication and durable state before exposing a production mutation API. This task prepares and validates artifacts; it does not publish packages or replace existing deployments. diff --git a/packages/wsp-toolkit/docs/evidence/constellation-live-summary.json b/packages/wsp-toolkit/docs/evidence/constellation-live-summary.json new file mode 100644 index 000000000..cfffb6381 --- /dev/null +++ b/packages/wsp-toolkit/docs/evidence/constellation-live-summary.json @@ -0,0 +1,115 @@ +{ + "schema": "ruvnet.constellation-live-evidence/1", + "observedAt": "2026-11-11T03:22:56.172Z", + "start": "2026-09-30", + "end": "2026-11-10", + "catalog": { + "catalogPackages": 24, + "publishedPackages": 12, + "candidatePackages": 12, + "packagesWithLatestDay": 9, + "packagesWithLast7": 9, + "packagesWithLast30": 9, + "unavailablePackages": 3 + }, + "observedLast30Downloads": 3826043, + "fullCohortLast30Downloads": null, + "unavailablePackages": [ + { + "name": "ruv-fann", + "error": "public source returned HTTP 404 or a redirect", + "metadataStatus": "ok" + }, + { + "name": "ruv-fann-wasm", + "error": "public source returned HTTP 404 or a redirect", + "metadataStatus": "ok" + }, + { + "name": "ruv-fann-wsp", + "error": "public source returned HTTP 404 or a redirect", + "metadataStatus": "ok" + } + ], + "metadataCoverage": { + "observed": 12, + "expected": 12 + }, + "repositories": [ + { + "repository": "ruvnet/RuVector", + "status": "ok", + "stars": 4685, + "openIssuesAndPRs": 273, + "source": "https://api.github.com/repos/ruvnet/RuVector" + }, + { + "repository": "ruvnet/agentdb", + "status": "ok", + "stars": 97, + "openIssuesAndPRs": 17, + "source": "https://api.github.com/repos/ruvnet/agentdb" + }, + { + "repository": "ruvnet/agentic-flow", + "status": "ok", + "stars": 840, + "openIssuesAndPRs": 112, + "source": "https://api.github.com/repos/ruvnet/agentic-flow" + }, + { + "repository": "ruvnet/metaharness", + "status": "ok", + "stars": 744, + "openIssuesAndPRs": 219, + "source": "https://api.github.com/repos/ruvnet/metaharness" + }, + { + "repository": "ruvnet/ruflo", + "status": "ok", + "stars": 81443, + "openIssuesAndPRs": 580, + "source": "https://api.github.com/repos/ruvnet/ruflo" + }, + { + "repository": "ruvnet/ruv-FANN", + "status": "ok", + "stars": 390, + "openIssuesAndPRs": 41, + "source": "https://api.github.com/repos/ruvnet/ruv-FANN" + } + ], + "attach": { + "status": "unavailable", + "percentage": null, + "unit": "consenting-project-snapshots" + }, + "artifacts": [ + { + "path": ".artifacts/constellation/observations.json", + "bytes": 44504, + "sha256": "d8bda3b07345e196ab9f4311af5d100c5c5bd0bbb4a334fa183ea13b81726c23" + }, + { + "path": ".artifacts/constellation/report.json", + "bytes": 79030, + "sha256": "6e3cd8da3451da2330a2ab711ae7d26322662d4b9b3edcb54add92e4089a5494" + }, + { + "path": ".artifacts/constellation/dashboard.html", + "bytes": 68583, + "sha256": "333e79f65706f9dbbad68d5be7927bfd66d5ec61919fabb87acc557ed32d9823" + }, + { + "path": ".artifacts/constellation/dashboard.png", + "bytes": 510509, + "sha256": "4ad9cdaf035eb3750403ebaf5e7a71b001a8cf3ce95e80a6b78580a0977c3a5e" + } + ], + "limits": [ + "This is a verified subset, not the user-provided405-package cohort.", + "Downloads include CI/transitive activity; no user attach rate is inferred.", + "No adoption sample was provided; public report contains no project identifiers.", + "Npm publisher registration and live OIDC publication were not performed." + ] +} diff --git a/packages/wsp-toolkit/docs/evidence/constellation-node-22-validation.json b/packages/wsp-toolkit/docs/evidence/constellation-node-22-validation.json new file mode 100644 index 000000000..6f066dfd0 --- /dev/null +++ b/packages/wsp-toolkit/docs/evidence/constellation-node-22-validation.json @@ -0,0 +1,654 @@ +{ + "schema": "ruv-fann.toolkit-validation/1", + "createdAt": "2026-11-11T03:29:53.662Z", + "node": "v22.13.0", + "typecheck": "passed", + "tests": { + "tests": 142, + "pass": 142, + "fail": 0, + "cancelled": 0, + "skipped": 0, + "todo": 0 + }, + "benchmark": { + "schema": "ruv-fann.search-benchmark/1", + "node": "v22.13.0", + "backend": "wasm", + "rows": 32, + "candidateCount": 16, + "repetitions": 9, + "equivalentCandidateHash": "721c85d1df903af2ca8fe07b29bc590e4aff2f5bf4b55291b91f214c9addfd67", + "candidateMSE": 0, + "referenceInferencePasses": 32, + "screenedInferencePasses": 19, + "inferencePassReductionPercent": 40.625, + "referenceMedianMs": 4.930079000000006, + "screenedMedianMs": 2.006643000000011, + "note": "Identical 16-candidate monotonic one-coordinate sequence. Timing is a local observation; work reduction includes final authoritative baseline/candidate revalidation. Not an accuracy or generalization benchmark." + }, + "audit": { + "vulnerabilities": { + "info": 0, + "low": 0, + "moderate": 0, + "high": 0, + "critical": 0, + "total": 0 + }, + "scope": "all production and development dependencies", + "lockfileSHA256": "e63f4d954bc3447ac6594b1ea0a2670bab38451f98366f36487a2a6668b2b9d3" + }, + "agentdbIntegrationAudit": { + "vulnerabilities": { + "info": 0, + "low": 0, + "moderate": 0, + "high": 0, + "critical": 0, + "total": 0 + }, + "scope": "installed integration tree, optional dependencies omitted", + "lockfileSHA256": "229e110861a135c36cf495692d92e300f45e1d74d5609b4803aedd1f0a4815d1" + }, + "sourceTreeSHA256": "4c6135e211fe3d3ea33e95f850fd7c72c7fa4fa3eef01a5022ddf3f2457ae2bc", + "sourceFiles": [ + { + "path": ".gitignore", + "sha256": "f0511d87b6daff32b51effec85f397ff36e7914c7849880d3d0c1d1c4eba600a" + }, + { + "path": "docs/design.md", + "sha256": "57c6b8f947f6c365a111b6d5052389b53ef2285e1561d81934faefcfa643cb70" + }, + { + "path": "docs/huggingface-source.json", + "sha256": "935e180aaae0f271ab5b01e20c612a221110c39bba94f74b73c6fd028546c2e4" + }, + { + "path": "docs/loop-design.md", + "sha256": "4553a75cea747adde3be0f02bdec2a6202edf68d1ae2f684a9b30c903116281d" + }, + { + "path": "docs/loop-validation.md", + "sha256": "bb94013322c53728593168c8f49645a061f183c75c178232136e749016647adc" + }, + { + "path": "docs/validation.md", + "sha256": "54495f5c0b64fd674c408c76b90f1231ea7fb45078898dc59dec181fffa6ea2f" + }, + { + "path": "package-lock.json", + "sha256": "e63f4d954bc3447ac6594b1ea0a2670bab38451f98366f36487a2a6668b2b9d3" + }, + { + "path": "package.json", + "sha256": "02ae927dd9f8c45b5ac6c616a6880527a381d27054720e2b151b49a9a25d310a" + }, + { + "path": "packages/cloudflare/constellation.json", + "sha256": "d99a5312a2f444b7f90a35e544dd7f9c677bad0d9c83a3798b8f2fd9165058fa" + }, + { + "path": "packages/cloudflare/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/cloudflare/package.json", + "sha256": "9dbb4b75dc63690336c26cd8aed71865507b80d03ea56c35bad768be2dab992c" + }, + { + "path": "packages/cloudflare/README.md", + "sha256": "171b17cec61440e71769780252ba2266f88c3a8a97fa94d41e5a33a3dea33698" + }, + { + "path": "packages/cloudflare/scripts/build.mjs", + "sha256": "7cadbdf90d4a57ce78166b0b789e36ff0dad3aac0e15c2c6f148ce41785a8269" + }, + { + "path": "packages/cloudflare/src/build.d.ts", + "sha256": "8b24c9683ba896cbd2fa207d8493e280937a6e87e63c81330df5e112c1630cfc" + }, + { + "path": "packages/cloudflare/src/build.js", + "sha256": "173edfd8dc82aeaee140ab216c10d17dfd76105f281d32097388944f2444043f" + }, + { + "path": "packages/cloudflare/src/index.d.ts", + "sha256": "d93c5133c21cd2cfcca7ad620c1c7a538007e23c6c3ed3d3ce059002e7ae4af4" + }, + { + "path": "packages/cloudflare/src/index.js", + "sha256": "1d8cdc902da54f54fa12fc8bc0a60537aaa6fcdfc278a99dd6c911ad0fc9bba7" + }, + { + "path": "packages/cloudflare/src/worker.js", + "sha256": "d93c4088089aa3f16488484017cde5caaf978782ebe2b7c2058a77d40f9fd390" + }, + { + "path": "packages/cloudflare/test/handler.test.mjs", + "sha256": "e45b2209c08b6afaefe5cd0fdb56e4160e165f9d6b91061df6e7c6bb9605f54f" + }, + { + "path": "packages/cloudflare/test/workerd.test.mjs", + "sha256": "8a5664be4b9ace08118af8887d7cab8623bad5f5e90fab28e810b4d9fe47b1b3" + }, + { + "path": "packages/cloudflare/wrangler.jsonc", + "sha256": "7cda0f7788937ccbbd63d250ef11a4d0b98c66b25872dcc02ecbdef807b814bd" + }, + { + "path": "packages/constellation/catalog.json", + "sha256": "0633f5a1cb45c7eb9da5c67b5d80639e83ac61cc5229cbe7ea30f80cdc9e1c64" + }, + { + "path": "packages/constellation/constellation.json", + "sha256": "4cfb443b03c5e40f59dc0c9c5ca956471b4e11f0c712a2f00987a982cf8183f6" + }, + { + "path": "packages/constellation/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/constellation/package.json", + "sha256": "4732d64dee62e847597078c13eb5af87ca258416d776b89bc034b01f0beae129" + }, + { + "path": "packages/constellation/README.md", + "sha256": "f544a922b6fd9121d987abb75ccbd9f61e4a7d8d2af59829eb16afe1dce641f2" + }, + { + "path": "packages/constellation/src/cli.js", + "sha256": "3a842f0afb00597154864556e0dbadcc8e9add3417cffc3bbe80f163953a0925" + }, + { + "path": "packages/constellation/src/index.d.ts", + "sha256": "60bb9608a3c7990bcbcd433df470920ba708a2fdb10adc6bbb115511bd9a40c2" + }, + { + "path": "packages/constellation/src/index.js", + "sha256": "34ced21ae26ba9bdb8cd88d85db3beeab24af3fe65c0958930f106c87f453e63" + }, + { + "path": "packages/constellation/test/onramp.test.mjs", + "sha256": "27b5af30c0f42e082cd86ef150e354ba12232668df796d11d75dd25edfa30370" + }, + { + "path": "packages/contracts/constellation.json", + "sha256": "33f7301852efaa58eee9e951d6e83f326704bf61c44c5aa2ade78cbfa7a2a254" + }, + { + "path": "packages/contracts/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/contracts/package.json", + "sha256": "d2c2b28c4e4c97587758b6889970899acb9efa1864367920196bc1fcd1da0afe" + }, + { + "path": "packages/contracts/README.md", + "sha256": "b6cd87fe923c2076b47c99c5fdcad6638bae5c8a47f179332b2ed69c6ac562df" + }, + { + "path": "packages/contracts/schemas/catalog.schema.json", + "sha256": "0feec53059830bacb43532220f5bde9a2816d26a496b197c9bba72d973981fcd" + }, + { + "path": "packages/contracts/schemas/module.schema.json", + "sha256": "c88516bae0695e24350ba64163aa90ea7fc4d285d92a2e6a7d8560fd8cb46bfa" + }, + { + "path": "packages/contracts/schemas/wsp-references.schema.json", + "sha256": "54c28210ad3347381d51ce3d99a1c6439853a0f3e8acd2381b68e2eac64d94a2" + }, + { + "path": "packages/contracts/src/index.d.ts", + "sha256": "e1003bde5d3f7706a8a312c30a13ec63b5003ab4190c96a7e9440ac3bd229b31" + }, + { + "path": "packages/contracts/src/index.js", + "sha256": "2710347555918ef964c85d190bbd94713668b491a8dee978c48ba2a8ae12e875" + }, + { + "path": "packages/contracts/test/contracts.test.mjs", + "sha256": "d147c3cae1b2939b389ee45254254ecf61c7d4a72cbc9d7dedd96fc55352b8b0" + }, + { + "path": "packages/huggingface/constellation.json", + "sha256": "753fa911a59bfef2a3945cb87c86c0d7f9b71bb0cb849ccbd39f9cd2f6e657f8" + }, + { + "path": "packages/huggingface/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/huggingface/package.json", + "sha256": "03814c0d7d8496ecc78ac4e0dfab372dbfbfe0942acceedae6665049094f6b8f" + }, + { + "path": "packages/huggingface/README.md", + "sha256": "74deee9fe4328e6cf985b4e241923f1157aa74164a133157fe912a1bed683b7f" + }, + { + "path": "packages/huggingface/src/index.d.ts", + "sha256": "cd4129715700e7d5aae1bab3953a5d9df99931e688b3835b26b6207b457f6465" + }, + { + "path": "packages/huggingface/src/index.js", + "sha256": "baf61b469ef682e49b94003ebf5ab2e19a2938fb166891ace145f6dc532329e9" + }, + { + "path": "packages/huggingface/test/hub.test.mjs", + "sha256": "a3f5c794a701b51aebb66d480054cb401ae2ca7ab34f86330f1de8d2889b2450" + }, + { + "path": "packages/invariants/constellation.json", + "sha256": "3764c56d87cd729045922dcdd9996900418947b756818cf3a807132f09597586" + }, + { + "path": "packages/invariants/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/invariants/package.json", + "sha256": "f4eaf71f1cc8d6ca1515824b66b16e55c67d87e14509203e941fce2eb220bb66" + }, + { + "path": "packages/invariants/README.md", + "sha256": "6373959949f6eeb46863e8c1382c5ebbe43e01287096d0b262ed4842e9d81b98" + }, + { + "path": "packages/invariants/src/data.js", + "sha256": "4b45398e0a1525c78f9c5cdc1983763945a2029972776d4c6199b2f4a3ac3292" + }, + { + "path": "packages/invariants/src/index.d.ts", + "sha256": "46e18b0082849240ea5601fcefc0dc0a8dc06b4ab5e0b1aa61cb6b58fa74189d" + }, + { + "path": "packages/invariants/src/index.js", + "sha256": "9718f48ae873ba67e376928b94f87e0af5ce33de7e3f0479f19be6f5cc0214bd" + }, + { + "path": "packages/invariants/test/invariants.test.mjs", + "sha256": "9a9a5222572a54576d3beb13ca61a92da0319e96ae3f74f94d085fde9aed0f19" + }, + { + "path": "packages/lifecycle/constellation.json", + "sha256": "928664028e8eb182f9d5dd3fe5e581dea646fbb19e6e2afc32226f00389f5aeb" + }, + { + "path": "packages/lifecycle/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/lifecycle/package.json", + "sha256": "7bd10ec8deb81acf3e8f1a2a5a4b6dece13faae894eb758ab3eb4ba88e2968f7" + }, + { + "path": "packages/lifecycle/README.md", + "sha256": "5282461ba136d764c5bfb79c5dba2675c41b256d8287690b9588e565c668821d" + }, + { + "path": "packages/lifecycle/src/cli.js", + "sha256": "821c40e837d45bfb5a19911361dc4a60d8cf3e6a2214091a0fe3db266ecd8bb1" + }, + { + "path": "packages/lifecycle/src/index.d.ts", + "sha256": "79186a80097d7e27b1e570f4f898af303b5c2c5a08fa493a829d0c8e416ed957" + }, + { + "path": "packages/lifecycle/src/index.js", + "sha256": "2c8fb836ce2e3e41e188e936a6a46c49e7bcd6aa8d73e4aefae4e0e1143357c4" + }, + { + "path": "packages/lifecycle/test/gate.test.mjs", + "sha256": "0f97063fa4945a7832488306be247689288e4ad5557909324bb811a5811744e1" + }, + { + "path": "packages/loop/constellation.json", + "sha256": "157a11a730c59e4d33c7845a0d5c777a2ddc8bf4c737900169975c425ff16cba" + }, + { + "path": "packages/loop/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/loop/package.json", + "sha256": "7f2c102e58c76d387c4b3da63083fadc0b2a4f5abf5709e28a62dfc5e68829ff" + }, + { + "path": "packages/loop/README.md", + "sha256": "5167f498a083d1434a855d21d985d8ca8c1e088da402176522beb1507491d7c9" + }, + { + "path": "packages/loop/src/data.js", + "sha256": "8fdd1b327292822de676f95182206029581ae6c2cb37849fb554ceba10871e1f" + }, + { + "path": "packages/loop/src/index.d.ts", + "sha256": "d68496882f83d9dff9a225fd17eac00192917ccc32ac5e54ed5d5392ddd681f9" + }, + { + "path": "packages/loop/src/index.js", + "sha256": "31fb38d2e058676a2c02f90a8417a6ecaa3daf5d63ac811423d1881cd88e63ca" + }, + { + "path": "packages/loop/test/loop.test.mjs", + "sha256": "a1235579700e94475dd87da69b7049150cccba7282d618dcf00ed6afbd0ba2a1" + }, + { + "path": "packages/registry/constellation.json", + "sha256": "9b52e18cd5fc1d81472b04047ea7de1e413acc1e88df318815802cb60e7b90e3" + }, + { + "path": "packages/registry/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/registry/package.json", + "sha256": "1fc1ed65ef56162b4236fabf464611c3955fe506c2da9ebf0216602fc76ee9fc" + }, + { + "path": "packages/registry/README.md", + "sha256": "048b603ed01ffc1f7396e9365976c98bb7603b531443ca82a9bbd52fafd69871" + }, + { + "path": "packages/registry/src/index.d.ts", + "sha256": "1b554b60dd06c441ae59fb32a4c84cec0ea9b8bcb6bab736b3e4ba899fa1f20a" + }, + { + "path": "packages/registry/src/index.js", + "sha256": "21760a5c802f6cffed836e3c707a4a0f61465e207cc72e9692ba220d68017ce9" + }, + { + "path": "packages/registry/test/registry.test.mjs", + "sha256": "9dc720e1e1685cfede279c89a973929ac68f749777a230cbc1fc1a119c6a7e9c" + }, + { + "path": "packages/ruos/constellation.json", + "sha256": "9d989415e05fec1625b553a9823b4f33c63cffca6600e477269d74bd1e5d36f2" + }, + { + "path": "packages/ruos/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/ruos/package.json", + "sha256": "a8c7d114adfe8b5ee54732074dcee1a0c4ea901f770b7fb1b916f6bdbeab19cf" + }, + { + "path": "packages/ruos/README.md", + "sha256": "158b714f16d8b343eb2eb7db0f1a36edb7dafe94fb076adeab9b2503d6c6aaf8" + }, + { + "path": "packages/ruos/src/index.d.ts", + "sha256": "780094ec3f3d4ae984b1ccc69f52b84261c42f0749a652df0b8e881878bc697a" + }, + { + "path": "packages/ruos/src/index.js", + "sha256": "0c9a6070bc1b70af58934b47d6b9be0e49ce884eb2839a2e3580118343d31f39" + }, + { + "path": "packages/ruos/test/ruos.test.mjs", + "sha256": "2bfac47783a83a569ebfc3526aea4665949eebcb3f147afeaa3047305e50549c" + }, + { + "path": "packages/search/constellation.json", + "sha256": "9c61e6a5a980228a843ccf171305c2e11475f8f495dfbf695486bcf6f460102d" + }, + { + "path": "packages/search/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/search/package.json", + "sha256": "50d1d890629220a2458ca9f7abcb477c81ee62aeb53735a4cb7d43487eb9de43" + }, + { + "path": "packages/search/README.md", + "sha256": "3b71e25adddff2e155eb7c9e89f68e9909a4a922bb53a6e17e3eb393e9749440" + }, + { + "path": "packages/search/src/data.js", + "sha256": "5825e0aea30189d3d808dd2e932fadfe20dedad0df574ae1288b97fa3b339a38" + }, + { + "path": "packages/search/src/index.d.ts", + "sha256": "a28f37a50281e88d31f275dde4ff5f40b90afdf15c6ad9dfe4b4b4b2f6dd947c" + }, + { + "path": "packages/search/src/index.js", + "sha256": "7bce3367ab680b3e377f0b8eeaae6194f25ee38368c7e5e4f51d9f04771df62c" + }, + { + "path": "packages/search/test/search.test.mjs", + "sha256": "215740fd17e384c41f9afe47326bf8cfa07a74a48d0f468c319e2f03e846b11d" + }, + { + "path": "packages/swarm/constellation.json", + "sha256": "200418fdac98c93db675756a0537aa42d355c255f0c39b8bc2fb14ff6d99a408" + }, + { + "path": "packages/swarm/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/swarm/package.json", + "sha256": "828d1b8a46dba7d51308de75aa66817b3b42a943709b07e4b460e89f6ad43968" + }, + { + "path": "packages/swarm/README.md", + "sha256": "5a75c847d5ca551d2d0040d6a19008ed0bef2911d9fe9d5207e8c6cba23f7b57" + }, + { + "path": "packages/swarm/src/data.js", + "sha256": "c97ed1d82314ee61eeefcefec7d483392f5fc09bd9bebe32f9f2145c731788dd" + }, + { + "path": "packages/swarm/src/index.d.ts", + "sha256": "5ad45898469848d7533b42a15a69fc8fc91e181502d7cb54413f7153cadd62f3" + }, + { + "path": "packages/swarm/src/index.js", + "sha256": "a03df0a7a2381a3011135900ab2fd9e71f34332e6781918f75feb8f2880d52b0" + }, + { + "path": "packages/swarm/src/worker.js", + "sha256": "134945bf9cfc082a0e690bc49e105ec64a29b32c59ef12da3d4b270916d4fa2d" + }, + { + "path": "packages/swarm/test/swarm.test.mjs", + "sha256": "6a2873c9604d2eda518180f025b1bbd68fad8f4a5889d028995fa5bcb1989c81" + }, + { + "path": "packages/telemetry/constellation.json", + "sha256": "4d5288acf59314f0234ef2a5850a80ee4fbb31939cec2c8d408727919ecd259a" + }, + { + "path": "packages/telemetry/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/telemetry/package.json", + "sha256": "30ff2e5e0e0c3fe73a370b81e6df88c096d255262a854b4711f9fd585b2d77db" + }, + { + "path": "packages/telemetry/README.md", + "sha256": "cc0f056f73225c1a04732888ae57ac65e014c20ac08346df2e1834fd983351f3" + }, + { + "path": "packages/telemetry/src/analyze.js", + "sha256": "48905b778211a73195c490e4a2a9fadb7eb690425930c7c6fe7c25adc5f7fc2b" + }, + { + "path": "packages/telemetry/src/collect.js", + "sha256": "a46060648487c795671c59ba1552e52c455c03bde7fd9a86d163212cca498de2" + }, + { + "path": "packages/telemetry/src/dashboard.js", + "sha256": "2b4e67011f12030eb538de7a887ba32aea0d85ce111bda05e466f778c45b5dac" + }, + { + "path": "packages/telemetry/src/data.js", + "sha256": "37a6121f72a672b63f51df079245f3a3fef45f730255f44de19b80a6b7e59233" + }, + { + "path": "packages/telemetry/src/index.d.ts", + "sha256": "d92397dc00dab8166b3b689cbe54530069635af87dd8efcfb6f29d9889fd3980" + }, + { + "path": "packages/telemetry/src/index.js", + "sha256": "ab8503ef70c9aadbc26177fefc5989d3405cecf07894ea58ab3d63cbe01fa2dd" + }, + { + "path": "packages/telemetry/test/dashboard.test.mjs", + "sha256": "2ebf309ff4c40ab692ebc553741c177f4939f62fc84060d14ed2f45718ba6d73" + }, + { + "path": "packages/telemetry/test/fixtures.mjs", + "sha256": "459fcc61a3bd0aed8dca3d5c65254fc1f7e63aef3ef3ea19a1fae308f502de05" + }, + { + "path": "packages/telemetry/test/telemetry.test.mjs", + "sha256": "cd49eec775edb40dfa2aad536d42caf6f6b9e22b11e1d7dacd09203702372bbe" + }, + { + "path": "README.md", + "sha256": "cfd1fb79b30489d083f6686effff43a224e1ff375ca8da67d9fdd4c021daa782" + }, + { + "path": "scripts/benchmark.mjs", + "sha256": "a05680d508d739b6dea6e53196cff1efd6f81d3065e5f08eb980d2f19e3ab289" + }, + { + "path": "scripts/constellation-links.mjs", + "sha256": "574a389aa43ee80f723aa11e984df060523ff6a5d11038182b36dcb356691e74" + }, + { + "path": "scripts/constellation-report.mjs", + "sha256": "5e9cba3857032e28596b938f914ee9cfcfd8bf6ec39c16b390a03c05ab905609" + }, + { + "path": "scripts/evolution-demo.mjs", + "sha256": "5c34517bf65a1383ec85e3634bf5ab42b3e6ef4b993cea905f2391a9edf6e9c1" + }, + { + "path": "scripts/huggingface-live.mjs", + "sha256": "aa98b72185421cde24a8d45f2db47937724b1429689943fce3e6a9a7cb32ba46" + }, + { + "path": "scripts/packed-consumer.mjs", + "sha256": "a9077073770554d5a2e6b3eb75e7ed466b16a303df3656cc22e0f532bf31149a" + }, + { + "path": "scripts/validate.mjs", + "sha256": "6ac16864a99e730684546dbe99d9944ba9272ba320102d9b0c178bc3e767df3c" + }, + { + "path": "test/browser.test.mjs", + "sha256": "8e8383ab9a9d5f974f936a4e97772b88c1411fa5d9c7635bd794f0f1a4e74b71" + }, + { + "path": "test/constellation-browser.test.mjs", + "sha256": "ba0b34ef215e2c1c83960467963a655d484e0d9712a8409a34bd5c8a642af821" + }, + { + "path": "test/constellation-fixture.mjs", + "sha256": "6a191c92a77be72b53bef89e0c0aedba3811ee1d99b16afdd9ac442cd0b191d7" + }, + { + "path": "test/constellation-scenario.mjs", + "sha256": "8f402b7ba363c68c50b011b4e96b78865e4c3714fc47eb7d14d86c454ccd58ae" + }, + { + "path": "test/constellation.test.mjs", + "sha256": "51dbf275f55c5c264e3478a48241d8e7dc90f5afb5e088c2c586b93e34013f6c" + }, + { + "path": "test/consumer.test.mjs", + "sha256": "5442aa6299d40b328521c16f7aeacb32027224ecb9bec5d4a4b11fa8151c6efb" + }, + { + "path": "test/evolution-scenario.mjs", + "sha256": "6cc1855bb73e3483d8414a29ecfb50f30a05401f50080f3bd3fce56a7d4bdc97" + }, + { + "path": "test/integration.test.mjs", + "sha256": "403ca92aeaf3ea7c0466989c6fba202fcce8b1c594aa1783b39636dc9041ead2" + }, + { + "path": "test/scenario.mjs", + "sha256": "9884b953d21aff57f48e0d06de900679cf7d4c41928b67af0cc0d018d2460c45" + }, + { + "path": "test/types.ts", + "sha256": "b4cb8edbe86f3949d18151ac5e31e8c805c2bc11154389c3dbeed34fce2ea867" + }, + { + "path": "tooling/agentdb/.npmrc", + "sha256": "4afddb3b717898468cfc68f97a3732ed2abf16df5de65925de4bc471a0f6780f" + }, + { + "path": "tooling/agentdb/package-lock.json", + "sha256": "229e110861a135c36cf495692d92e300f45e1d74d5609b4803aedd1f0a4815d1" + }, + { + "path": "tooling/agentdb/package.json", + "sha256": "200138975eb9dc4d08436bd03e975e3581d53d497a4add435271464753a64b50" + }, + { + "path": "tooling/agentdb/README.md", + "sha256": "33303ad2758db41d6ef5dce5042aa7d80c8780d73c54621e32924862e1337d58" + }, + { + "path": "tooling/agentdb/runtime.mjs", + "sha256": "9bd88f81c48ec2c365f67e94bf6095d005f2f5cf0d9a7889570ca72e2338d690" + }, + { + "path": "tsconfig.json", + "sha256": "daf2b629ec6c113c62f3c4ee10f1e1632d301575f98b11d1fd6013c5ab717b54" + }, + { + "path": "../../scripts/constellation-oidc.mjs", + "sha256": "fbbf8e0c392cd379c602409ab5f39c6c7b420403bbce1d7b4f4ea765c20b1609" + }, + { + "path": "../../scripts/constellation-oidc.test.mjs", + "sha256": "c9c4b7562697f3acb8663326cfc5b4efbd8ef1dae698b8dc1cc36be7a9bafcff" + }, + { + "path": "../../scripts/wsp-release-lane.mjs", + "sha256": "799301a1f16d5ca9f70d68da5bd6a5598073da4364cb23076883ab1913261ef2" + }, + { + "path": "../../.github/workflows/protected-wsp-release.yml", + "sha256": "b544fc2fd69275740ae9bdd4c96aeda5456acb6337ecdc9a71284c5f81d21033" + }, + { + "path": "../../.github/workflows/wsp-modules.yml", + "sha256": "9d48c01f977c55c82c1dd3c146e9980eb295e810d02de7833f0c9163e62285d5" + }, + { + "path": "../../.github/workflows/wsp-toolkit.yml", + "sha256": "c5a207afb2f521b90a1dc03d1813e270380d4831c4e9c3a43c176a82cd6c4423" + }, + { + "path": "../../.github/workflows/constellation-observatory.yml", + "sha256": "c04cb34c141b31e08ec52125d97c34912ee8037bf4e212af2fb347ca538d7d13" + }, + { + "path": "../../docs/constellation-design.md", + "sha256": "2d568aea0f286a21c49a6adab06535a171399cd35b7fdfa332a75060883cc622" + }, + { + "path": "../../docs/constellation-release.md", + "sha256": "01001c532e11a401a39d5a0acb7f55755fcf6a9f2568a5ac3e2938ed36e7bf12" + }, + { + "path": "../../docs/constellation.md", + "sha256": "b6c0001e91772f5bee1427481d2b78cf197f0c4ad66bdf99d6c50e4680ec7534" + } + ], + "limits": "Local validation only. Source digest excludes generated .artifacts and docs/evidence. This is not a signature or deployment authorization." +} diff --git a/packages/wsp-toolkit/docs/evidence/constellation-node-24-validation.json b/packages/wsp-toolkit/docs/evidence/constellation-node-24-validation.json new file mode 100644 index 000000000..1fe3c8fbd --- /dev/null +++ b/packages/wsp-toolkit/docs/evidence/constellation-node-24-validation.json @@ -0,0 +1,654 @@ +{ + "schema": "ruv-fann.toolkit-validation/1", + "createdAt": "2026-11-11T03:30:04.835Z", + "node": "v24.22.1", + "typecheck": "passed", + "tests": { + "tests": 142, + "pass": 142, + "fail": 0, + "cancelled": 0, + "skipped": 0, + "todo": 0 + }, + "benchmark": { + "schema": "ruv-fann.search-benchmark/1", + "node": "v24.22.1", + "backend": "wasm", + "rows": 32, + "candidateCount": 16, + "repetitions": 9, + "equivalentCandidateHash": "721c85d1df903af2ca8fe07b29bc590e4aff2f5bf4b55291b91f214c9addfd67", + "candidateMSE": 0, + "referenceInferencePasses": 32, + "screenedInferencePasses": 19, + "inferencePassReductionPercent": 40.625, + "referenceMedianMs": 3.9316379999999924, + "screenedMedianMs": 1.4328490000000045, + "note": "Identical 16-candidate monotonic one-coordinate sequence. Timing is a local observation; work reduction includes final authoritative baseline/candidate revalidation. Not an accuracy or generalization benchmark." + }, + "audit": { + "vulnerabilities": { + "info": 0, + "low": 0, + "moderate": 0, + "high": 0, + "critical": 0, + "total": 0 + }, + "scope": "all production and development dependencies", + "lockfileSHA256": "e63f4d954bc3447ac6594b1ea0a2670bab38451f98366f36487a2a6668b2b9d3" + }, + "agentdbIntegrationAudit": { + "vulnerabilities": { + "info": 0, + "low": 0, + "moderate": 0, + "high": 0, + "critical": 0, + "total": 0 + }, + "scope": "installed integration tree, optional dependencies omitted", + "lockfileSHA256": "229e110861a135c36cf495692d92e300f45e1d74d5609b4803aedd1f0a4815d1" + }, + "sourceTreeSHA256": "4c6135e211fe3d3ea33e95f850fd7c72c7fa4fa3eef01a5022ddf3f2457ae2bc", + "sourceFiles": [ + { + "path": ".gitignore", + "sha256": "f0511d87b6daff32b51effec85f397ff36e7914c7849880d3d0c1d1c4eba600a" + }, + { + "path": "docs/design.md", + "sha256": "57c6b8f947f6c365a111b6d5052389b53ef2285e1561d81934faefcfa643cb70" + }, + { + "path": "docs/huggingface-source.json", + "sha256": "935e180aaae0f271ab5b01e20c612a221110c39bba94f74b73c6fd028546c2e4" + }, + { + "path": "docs/loop-design.md", + "sha256": "4553a75cea747adde3be0f02bdec2a6202edf68d1ae2f684a9b30c903116281d" + }, + { + "path": "docs/loop-validation.md", + "sha256": "bb94013322c53728593168c8f49645a061f183c75c178232136e749016647adc" + }, + { + "path": "docs/validation.md", + "sha256": "54495f5c0b64fd674c408c76b90f1231ea7fb45078898dc59dec181fffa6ea2f" + }, + { + "path": "package-lock.json", + "sha256": "e63f4d954bc3447ac6594b1ea0a2670bab38451f98366f36487a2a6668b2b9d3" + }, + { + "path": "package.json", + "sha256": "02ae927dd9f8c45b5ac6c616a6880527a381d27054720e2b151b49a9a25d310a" + }, + { + "path": "packages/cloudflare/constellation.json", + "sha256": "d99a5312a2f444b7f90a35e544dd7f9c677bad0d9c83a3798b8f2fd9165058fa" + }, + { + "path": "packages/cloudflare/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/cloudflare/package.json", + "sha256": "9dbb4b75dc63690336c26cd8aed71865507b80d03ea56c35bad768be2dab992c" + }, + { + "path": "packages/cloudflare/README.md", + "sha256": "171b17cec61440e71769780252ba2266f88c3a8a97fa94d41e5a33a3dea33698" + }, + { + "path": "packages/cloudflare/scripts/build.mjs", + "sha256": "7cadbdf90d4a57ce78166b0b789e36ff0dad3aac0e15c2c6f148ce41785a8269" + }, + { + "path": "packages/cloudflare/src/build.d.ts", + "sha256": "8b24c9683ba896cbd2fa207d8493e280937a6e87e63c81330df5e112c1630cfc" + }, + { + "path": "packages/cloudflare/src/build.js", + "sha256": "173edfd8dc82aeaee140ab216c10d17dfd76105f281d32097388944f2444043f" + }, + { + "path": "packages/cloudflare/src/index.d.ts", + "sha256": "d93c5133c21cd2cfcca7ad620c1c7a538007e23c6c3ed3d3ce059002e7ae4af4" + }, + { + "path": "packages/cloudflare/src/index.js", + "sha256": "1d8cdc902da54f54fa12fc8bc0a60537aaa6fcdfc278a99dd6c911ad0fc9bba7" + }, + { + "path": "packages/cloudflare/src/worker.js", + "sha256": "d93c4088089aa3f16488484017cde5caaf978782ebe2b7c2058a77d40f9fd390" + }, + { + "path": "packages/cloudflare/test/handler.test.mjs", + "sha256": "e45b2209c08b6afaefe5cd0fdb56e4160e165f9d6b91061df6e7c6bb9605f54f" + }, + { + "path": "packages/cloudflare/test/workerd.test.mjs", + "sha256": "8a5664be4b9ace08118af8887d7cab8623bad5f5e90fab28e810b4d9fe47b1b3" + }, + { + "path": "packages/cloudflare/wrangler.jsonc", + "sha256": "7cda0f7788937ccbbd63d250ef11a4d0b98c66b25872dcc02ecbdef807b814bd" + }, + { + "path": "packages/constellation/catalog.json", + "sha256": "0633f5a1cb45c7eb9da5c67b5d80639e83ac61cc5229cbe7ea30f80cdc9e1c64" + }, + { + "path": "packages/constellation/constellation.json", + "sha256": "4cfb443b03c5e40f59dc0c9c5ca956471b4e11f0c712a2f00987a982cf8183f6" + }, + { + "path": "packages/constellation/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/constellation/package.json", + "sha256": "4732d64dee62e847597078c13eb5af87ca258416d776b89bc034b01f0beae129" + }, + { + "path": "packages/constellation/README.md", + "sha256": "f544a922b6fd9121d987abb75ccbd9f61e4a7d8d2af59829eb16afe1dce641f2" + }, + { + "path": "packages/constellation/src/cli.js", + "sha256": "3a842f0afb00597154864556e0dbadcc8e9add3417cffc3bbe80f163953a0925" + }, + { + "path": "packages/constellation/src/index.d.ts", + "sha256": "60bb9608a3c7990bcbcd433df470920ba708a2fdb10adc6bbb115511bd9a40c2" + }, + { + "path": "packages/constellation/src/index.js", + "sha256": "34ced21ae26ba9bdb8cd88d85db3beeab24af3fe65c0958930f106c87f453e63" + }, + { + "path": "packages/constellation/test/onramp.test.mjs", + "sha256": "27b5af30c0f42e082cd86ef150e354ba12232668df796d11d75dd25edfa30370" + }, + { + "path": "packages/contracts/constellation.json", + "sha256": "33f7301852efaa58eee9e951d6e83f326704bf61c44c5aa2ade78cbfa7a2a254" + }, + { + "path": "packages/contracts/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/contracts/package.json", + "sha256": "d2c2b28c4e4c97587758b6889970899acb9efa1864367920196bc1fcd1da0afe" + }, + { + "path": "packages/contracts/README.md", + "sha256": "b6cd87fe923c2076b47c99c5fdcad6638bae5c8a47f179332b2ed69c6ac562df" + }, + { + "path": "packages/contracts/schemas/catalog.schema.json", + "sha256": "0feec53059830bacb43532220f5bde9a2816d26a496b197c9bba72d973981fcd" + }, + { + "path": "packages/contracts/schemas/module.schema.json", + "sha256": "c88516bae0695e24350ba64163aa90ea7fc4d285d92a2e6a7d8560fd8cb46bfa" + }, + { + "path": "packages/contracts/schemas/wsp-references.schema.json", + "sha256": "54c28210ad3347381d51ce3d99a1c6439853a0f3e8acd2381b68e2eac64d94a2" + }, + { + "path": "packages/contracts/src/index.d.ts", + "sha256": "e1003bde5d3f7706a8a312c30a13ec63b5003ab4190c96a7e9440ac3bd229b31" + }, + { + "path": "packages/contracts/src/index.js", + "sha256": "2710347555918ef964c85d190bbd94713668b491a8dee978c48ba2a8ae12e875" + }, + { + "path": "packages/contracts/test/contracts.test.mjs", + "sha256": "d147c3cae1b2939b389ee45254254ecf61c7d4a72cbc9d7dedd96fc55352b8b0" + }, + { + "path": "packages/huggingface/constellation.json", + "sha256": "753fa911a59bfef2a3945cb87c86c0d7f9b71bb0cb849ccbd39f9cd2f6e657f8" + }, + { + "path": "packages/huggingface/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/huggingface/package.json", + "sha256": "03814c0d7d8496ecc78ac4e0dfab372dbfbfe0942acceedae6665049094f6b8f" + }, + { + "path": "packages/huggingface/README.md", + "sha256": "74deee9fe4328e6cf985b4e241923f1157aa74164a133157fe912a1bed683b7f" + }, + { + "path": "packages/huggingface/src/index.d.ts", + "sha256": "cd4129715700e7d5aae1bab3953a5d9df99931e688b3835b26b6207b457f6465" + }, + { + "path": "packages/huggingface/src/index.js", + "sha256": "baf61b469ef682e49b94003ebf5ab2e19a2938fb166891ace145f6dc532329e9" + }, + { + "path": "packages/huggingface/test/hub.test.mjs", + "sha256": "a3f5c794a701b51aebb66d480054cb401ae2ca7ab34f86330f1de8d2889b2450" + }, + { + "path": "packages/invariants/constellation.json", + "sha256": "3764c56d87cd729045922dcdd9996900418947b756818cf3a807132f09597586" + }, + { + "path": "packages/invariants/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/invariants/package.json", + "sha256": "f4eaf71f1cc8d6ca1515824b66b16e55c67d87e14509203e941fce2eb220bb66" + }, + { + "path": "packages/invariants/README.md", + "sha256": "6373959949f6eeb46863e8c1382c5ebbe43e01287096d0b262ed4842e9d81b98" + }, + { + "path": "packages/invariants/src/data.js", + "sha256": "4b45398e0a1525c78f9c5cdc1983763945a2029972776d4c6199b2f4a3ac3292" + }, + { + "path": "packages/invariants/src/index.d.ts", + "sha256": "46e18b0082849240ea5601fcefc0dc0a8dc06b4ab5e0b1aa61cb6b58fa74189d" + }, + { + "path": "packages/invariants/src/index.js", + "sha256": "9718f48ae873ba67e376928b94f87e0af5ce33de7e3f0479f19be6f5cc0214bd" + }, + { + "path": "packages/invariants/test/invariants.test.mjs", + "sha256": "9a9a5222572a54576d3beb13ca61a92da0319e96ae3f74f94d085fde9aed0f19" + }, + { + "path": "packages/lifecycle/constellation.json", + "sha256": "928664028e8eb182f9d5dd3fe5e581dea646fbb19e6e2afc32226f00389f5aeb" + }, + { + "path": "packages/lifecycle/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/lifecycle/package.json", + "sha256": "7bd10ec8deb81acf3e8f1a2a5a4b6dece13faae894eb758ab3eb4ba88e2968f7" + }, + { + "path": "packages/lifecycle/README.md", + "sha256": "5282461ba136d764c5bfb79c5dba2675c41b256d8287690b9588e565c668821d" + }, + { + "path": "packages/lifecycle/src/cli.js", + "sha256": "821c40e837d45bfb5a19911361dc4a60d8cf3e6a2214091a0fe3db266ecd8bb1" + }, + { + "path": "packages/lifecycle/src/index.d.ts", + "sha256": "79186a80097d7e27b1e570f4f898af303b5c2c5a08fa493a829d0c8e416ed957" + }, + { + "path": "packages/lifecycle/src/index.js", + "sha256": "2c8fb836ce2e3e41e188e936a6a46c49e7bcd6aa8d73e4aefae4e0e1143357c4" + }, + { + "path": "packages/lifecycle/test/gate.test.mjs", + "sha256": "0f97063fa4945a7832488306be247689288e4ad5557909324bb811a5811744e1" + }, + { + "path": "packages/loop/constellation.json", + "sha256": "157a11a730c59e4d33c7845a0d5c777a2ddc8bf4c737900169975c425ff16cba" + }, + { + "path": "packages/loop/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/loop/package.json", + "sha256": "7f2c102e58c76d387c4b3da63083fadc0b2a4f5abf5709e28a62dfc5e68829ff" + }, + { + "path": "packages/loop/README.md", + "sha256": "5167f498a083d1434a855d21d985d8ca8c1e088da402176522beb1507491d7c9" + }, + { + "path": "packages/loop/src/data.js", + "sha256": "8fdd1b327292822de676f95182206029581ae6c2cb37849fb554ceba10871e1f" + }, + { + "path": "packages/loop/src/index.d.ts", + "sha256": "d68496882f83d9dff9a225fd17eac00192917ccc32ac5e54ed5d5392ddd681f9" + }, + { + "path": "packages/loop/src/index.js", + "sha256": "31fb38d2e058676a2c02f90a8417a6ecaa3daf5d63ac811423d1881cd88e63ca" + }, + { + "path": "packages/loop/test/loop.test.mjs", + "sha256": "a1235579700e94475dd87da69b7049150cccba7282d618dcf00ed6afbd0ba2a1" + }, + { + "path": "packages/registry/constellation.json", + "sha256": "9b52e18cd5fc1d81472b04047ea7de1e413acc1e88df318815802cb60e7b90e3" + }, + { + "path": "packages/registry/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/registry/package.json", + "sha256": "1fc1ed65ef56162b4236fabf464611c3955fe506c2da9ebf0216602fc76ee9fc" + }, + { + "path": "packages/registry/README.md", + "sha256": "048b603ed01ffc1f7396e9365976c98bb7603b531443ca82a9bbd52fafd69871" + }, + { + "path": "packages/registry/src/index.d.ts", + "sha256": "1b554b60dd06c441ae59fb32a4c84cec0ea9b8bcb6bab736b3e4ba899fa1f20a" + }, + { + "path": "packages/registry/src/index.js", + "sha256": "21760a5c802f6cffed836e3c707a4a0f61465e207cc72e9692ba220d68017ce9" + }, + { + "path": "packages/registry/test/registry.test.mjs", + "sha256": "9dc720e1e1685cfede279c89a973929ac68f749777a230cbc1fc1a119c6a7e9c" + }, + { + "path": "packages/ruos/constellation.json", + "sha256": "9d989415e05fec1625b553a9823b4f33c63cffca6600e477269d74bd1e5d36f2" + }, + { + "path": "packages/ruos/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/ruos/package.json", + "sha256": "a8c7d114adfe8b5ee54732074dcee1a0c4ea901f770b7fb1b916f6bdbeab19cf" + }, + { + "path": "packages/ruos/README.md", + "sha256": "158b714f16d8b343eb2eb7db0f1a36edb7dafe94fb076adeab9b2503d6c6aaf8" + }, + { + "path": "packages/ruos/src/index.d.ts", + "sha256": "780094ec3f3d4ae984b1ccc69f52b84261c42f0749a652df0b8e881878bc697a" + }, + { + "path": "packages/ruos/src/index.js", + "sha256": "0c9a6070bc1b70af58934b47d6b9be0e49ce884eb2839a2e3580118343d31f39" + }, + { + "path": "packages/ruos/test/ruos.test.mjs", + "sha256": "2bfac47783a83a569ebfc3526aea4665949eebcb3f147afeaa3047305e50549c" + }, + { + "path": "packages/search/constellation.json", + "sha256": "9c61e6a5a980228a843ccf171305c2e11475f8f495dfbf695486bcf6f460102d" + }, + { + "path": "packages/search/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/search/package.json", + "sha256": "50d1d890629220a2458ca9f7abcb477c81ee62aeb53735a4cb7d43487eb9de43" + }, + { + "path": "packages/search/README.md", + "sha256": "3b71e25adddff2e155eb7c9e89f68e9909a4a922bb53a6e17e3eb393e9749440" + }, + { + "path": "packages/search/src/data.js", + "sha256": "5825e0aea30189d3d808dd2e932fadfe20dedad0df574ae1288b97fa3b339a38" + }, + { + "path": "packages/search/src/index.d.ts", + "sha256": "a28f37a50281e88d31f275dde4ff5f40b90afdf15c6ad9dfe4b4b4b2f6dd947c" + }, + { + "path": "packages/search/src/index.js", + "sha256": "7bce3367ab680b3e377f0b8eeaae6194f25ee38368c7e5e4f51d9f04771df62c" + }, + { + "path": "packages/search/test/search.test.mjs", + "sha256": "215740fd17e384c41f9afe47326bf8cfa07a74a48d0f468c319e2f03e846b11d" + }, + { + "path": "packages/swarm/constellation.json", + "sha256": "200418fdac98c93db675756a0537aa42d355c255f0c39b8bc2fb14ff6d99a408" + }, + { + "path": "packages/swarm/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/swarm/package.json", + "sha256": "828d1b8a46dba7d51308de75aa66817b3b42a943709b07e4b460e89f6ad43968" + }, + { + "path": "packages/swarm/README.md", + "sha256": "5a75c847d5ca551d2d0040d6a19008ed0bef2911d9fe9d5207e8c6cba23f7b57" + }, + { + "path": "packages/swarm/src/data.js", + "sha256": "c97ed1d82314ee61eeefcefec7d483392f5fc09bd9bebe32f9f2145c731788dd" + }, + { + "path": "packages/swarm/src/index.d.ts", + "sha256": "5ad45898469848d7533b42a15a69fc8fc91e181502d7cb54413f7153cadd62f3" + }, + { + "path": "packages/swarm/src/index.js", + "sha256": "a03df0a7a2381a3011135900ab2fd9e71f34332e6781918f75feb8f2880d52b0" + }, + { + "path": "packages/swarm/src/worker.js", + "sha256": "134945bf9cfc082a0e690bc49e105ec64a29b32c59ef12da3d4b270916d4fa2d" + }, + { + "path": "packages/swarm/test/swarm.test.mjs", + "sha256": "6a2873c9604d2eda518180f025b1bbd68fad8f4a5889d028995fa5bcb1989c81" + }, + { + "path": "packages/telemetry/constellation.json", + "sha256": "4d5288acf59314f0234ef2a5850a80ee4fbb31939cec2c8d408727919ecd259a" + }, + { + "path": "packages/telemetry/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/telemetry/package.json", + "sha256": "30ff2e5e0e0c3fe73a370b81e6df88c096d255262a854b4711f9fd585b2d77db" + }, + { + "path": "packages/telemetry/README.md", + "sha256": "cc0f056f73225c1a04732888ae57ac65e014c20ac08346df2e1834fd983351f3" + }, + { + "path": "packages/telemetry/src/analyze.js", + "sha256": "48905b778211a73195c490e4a2a9fadb7eb690425930c7c6fe7c25adc5f7fc2b" + }, + { + "path": "packages/telemetry/src/collect.js", + "sha256": "a46060648487c795671c59ba1552e52c455c03bde7fd9a86d163212cca498de2" + }, + { + "path": "packages/telemetry/src/dashboard.js", + "sha256": "2b4e67011f12030eb538de7a887ba32aea0d85ce111bda05e466f778c45b5dac" + }, + { + "path": "packages/telemetry/src/data.js", + "sha256": "37a6121f72a672b63f51df079245f3a3fef45f730255f44de19b80a6b7e59233" + }, + { + "path": "packages/telemetry/src/index.d.ts", + "sha256": "d92397dc00dab8166b3b689cbe54530069635af87dd8efcfb6f29d9889fd3980" + }, + { + "path": "packages/telemetry/src/index.js", + "sha256": "ab8503ef70c9aadbc26177fefc5989d3405cecf07894ea58ab3d63cbe01fa2dd" + }, + { + "path": "packages/telemetry/test/dashboard.test.mjs", + "sha256": "2ebf309ff4c40ab692ebc553741c177f4939f62fc84060d14ed2f45718ba6d73" + }, + { + "path": "packages/telemetry/test/fixtures.mjs", + "sha256": "459fcc61a3bd0aed8dca3d5c65254fc1f7e63aef3ef3ea19a1fae308f502de05" + }, + { + "path": "packages/telemetry/test/telemetry.test.mjs", + "sha256": "cd49eec775edb40dfa2aad536d42caf6f6b9e22b11e1d7dacd09203702372bbe" + }, + { + "path": "README.md", + "sha256": "cfd1fb79b30489d083f6686effff43a224e1ff375ca8da67d9fdd4c021daa782" + }, + { + "path": "scripts/benchmark.mjs", + "sha256": "a05680d508d739b6dea6e53196cff1efd6f81d3065e5f08eb980d2f19e3ab289" + }, + { + "path": "scripts/constellation-links.mjs", + "sha256": "574a389aa43ee80f723aa11e984df060523ff6a5d11038182b36dcb356691e74" + }, + { + "path": "scripts/constellation-report.mjs", + "sha256": "5e9cba3857032e28596b938f914ee9cfcfd8bf6ec39c16b390a03c05ab905609" + }, + { + "path": "scripts/evolution-demo.mjs", + "sha256": "5c34517bf65a1383ec85e3634bf5ab42b3e6ef4b993cea905f2391a9edf6e9c1" + }, + { + "path": "scripts/huggingface-live.mjs", + "sha256": "aa98b72185421cde24a8d45f2db47937724b1429689943fce3e6a9a7cb32ba46" + }, + { + "path": "scripts/packed-consumer.mjs", + "sha256": "a9077073770554d5a2e6b3eb75e7ed466b16a303df3656cc22e0f532bf31149a" + }, + { + "path": "scripts/validate.mjs", + "sha256": "6ac16864a99e730684546dbe99d9944ba9272ba320102d9b0c178bc3e767df3c" + }, + { + "path": "test/browser.test.mjs", + "sha256": "8e8383ab9a9d5f974f936a4e97772b88c1411fa5d9c7635bd794f0f1a4e74b71" + }, + { + "path": "test/constellation-browser.test.mjs", + "sha256": "ba0b34ef215e2c1c83960467963a655d484e0d9712a8409a34bd5c8a642af821" + }, + { + "path": "test/constellation-fixture.mjs", + "sha256": "6a191c92a77be72b53bef89e0c0aedba3811ee1d99b16afdd9ac442cd0b191d7" + }, + { + "path": "test/constellation-scenario.mjs", + "sha256": "8f402b7ba363c68c50b011b4e96b78865e4c3714fc47eb7d14d86c454ccd58ae" + }, + { + "path": "test/constellation.test.mjs", + "sha256": "51dbf275f55c5c264e3478a48241d8e7dc90f5afb5e088c2c586b93e34013f6c" + }, + { + "path": "test/consumer.test.mjs", + "sha256": "5442aa6299d40b328521c16f7aeacb32027224ecb9bec5d4a4b11fa8151c6efb" + }, + { + "path": "test/evolution-scenario.mjs", + "sha256": "6cc1855bb73e3483d8414a29ecfb50f30a05401f50080f3bd3fce56a7d4bdc97" + }, + { + "path": "test/integration.test.mjs", + "sha256": "403ca92aeaf3ea7c0466989c6fba202fcce8b1c594aa1783b39636dc9041ead2" + }, + { + "path": "test/scenario.mjs", + "sha256": "9884b953d21aff57f48e0d06de900679cf7d4c41928b67af0cc0d018d2460c45" + }, + { + "path": "test/types.ts", + "sha256": "b4cb8edbe86f3949d18151ac5e31e8c805c2bc11154389c3dbeed34fce2ea867" + }, + { + "path": "tooling/agentdb/.npmrc", + "sha256": "4afddb3b717898468cfc68f97a3732ed2abf16df5de65925de4bc471a0f6780f" + }, + { + "path": "tooling/agentdb/package-lock.json", + "sha256": "229e110861a135c36cf495692d92e300f45e1d74d5609b4803aedd1f0a4815d1" + }, + { + "path": "tooling/agentdb/package.json", + "sha256": "200138975eb9dc4d08436bd03e975e3581d53d497a4add435271464753a64b50" + }, + { + "path": "tooling/agentdb/README.md", + "sha256": "33303ad2758db41d6ef5dce5042aa7d80c8780d73c54621e32924862e1337d58" + }, + { + "path": "tooling/agentdb/runtime.mjs", + "sha256": "9bd88f81c48ec2c365f67e94bf6095d005f2f5cf0d9a7889570ca72e2338d690" + }, + { + "path": "tsconfig.json", + "sha256": "daf2b629ec6c113c62f3c4ee10f1e1632d301575f98b11d1fd6013c5ab717b54" + }, + { + "path": "../../scripts/constellation-oidc.mjs", + "sha256": "fbbf8e0c392cd379c602409ab5f39c6c7b420403bbce1d7b4f4ea765c20b1609" + }, + { + "path": "../../scripts/constellation-oidc.test.mjs", + "sha256": "c9c4b7562697f3acb8663326cfc5b4efbd8ef1dae698b8dc1cc36be7a9bafcff" + }, + { + "path": "../../scripts/wsp-release-lane.mjs", + "sha256": "799301a1f16d5ca9f70d68da5bd6a5598073da4364cb23076883ab1913261ef2" + }, + { + "path": "../../.github/workflows/protected-wsp-release.yml", + "sha256": "b544fc2fd69275740ae9bdd4c96aeda5456acb6337ecdc9a71284c5f81d21033" + }, + { + "path": "../../.github/workflows/wsp-modules.yml", + "sha256": "9d48c01f977c55c82c1dd3c146e9980eb295e810d02de7833f0c9163e62285d5" + }, + { + "path": "../../.github/workflows/wsp-toolkit.yml", + "sha256": "c5a207afb2f521b90a1dc03d1813e270380d4831c4e9c3a43c176a82cd6c4423" + }, + { + "path": "../../.github/workflows/constellation-observatory.yml", + "sha256": "c04cb34c141b31e08ec52125d97c34912ee8037bf4e212af2fb347ca538d7d13" + }, + { + "path": "../../docs/constellation-design.md", + "sha256": "2d568aea0f286a21c49a6adab06535a171399cd35b7fdfa332a75060883cc622" + }, + { + "path": "../../docs/constellation-release.md", + "sha256": "01001c532e11a401a39d5a0acb7f55755fcf6a9f2568a5ac3e2938ed36e7bf12" + }, + { + "path": "../../docs/constellation.md", + "sha256": "b6c0001e91772f5bee1427481d2b78cf197f0c4ad66bdf99d6c50e4680ec7534" + } + ], + "limits": "Local validation only. Source digest excludes generated .artifacts and docs/evidence. This is not a signature or deployment authorization." +} diff --git a/packages/wsp-toolkit/docs/evidence/constellation-package-archives.json b/packages/wsp-toolkit/docs/evidence/constellation-package-archives.json new file mode 100644 index 000000000..81a945bde --- /dev/null +++ b/packages/wsp-toolkit/docs/evidence/constellation-package-archives.json @@ -0,0 +1,86 @@ +[ + { + "name": "ruv-fann-wsp-lifecycle", + "version": "0.1.0", + "filename": "ruv-fann-wsp-lifecycle-0.1.0.tgz", + "bytes": 4855, + "sha256": "13859e6d7e22bec95c21388878d17572b3df83ea7f14120538a3e5b4d216d1f5" + }, + { + "name": "ruv-fann-wsp-search", + "version": "0.1.0", + "filename": "ruv-fann-wsp-search-0.1.0.tgz", + "bytes": 9317, + "sha256": "97077fdc06e4a855a7bdbcc53cc623c2aa90222d022b83a2188e0919c3b9c8ce" + }, + { + "name": "ruv-fann-wsp-huggingface", + "version": "0.1.0", + "filename": "ruv-fann-wsp-huggingface-0.1.0.tgz", + "bytes": 6370, + "sha256": "3b7d938b2204b11cad79906e25e4d9d5060a938536cd672ffa7ab9b69028164f" + }, + { + "name": "ruv-fann-wsp-cloudflare", + "version": "0.1.0", + "filename": "ruv-fann-wsp-cloudflare-0.1.0.tgz", + "bytes": 7508, + "sha256": "12e7f4b0020ca9bd486f858bffa5c981e4d4df998760863dbb9aa7a8719f4df0" + }, + { + "name": "ruv-fann-wsp-ruos", + "version": "0.1.0", + "filename": "ruv-fann-wsp-ruos-0.1.0.tgz", + "bytes": 4124, + "sha256": "cf4caee95ea91ed67270eddb20dc42d04499fcfd646c34f61b5a07eb7854cc05" + }, + { + "name": "ruv-fann-wsp-invariants", + "version": "0.1.0", + "filename": "ruv-fann-wsp-invariants-0.1.0.tgz", + "bytes": 7679, + "sha256": "268bf9b3f8b7f13fc21a639f0be7fa11e1f26eeda0252d1ad1c29c09d3e47ee4" + }, + { + "name": "ruv-fann-wsp-swarm", + "version": "0.1.0", + "filename": "ruv-fann-wsp-swarm-0.1.0.tgz", + "bytes": 9086, + "sha256": "b8ca6c95776645a2e284cc7c34d773b48bdbc0baba0ee3b959bf2dd449645a25" + }, + { + "name": "ruv-fann-wsp-registry", + "version": "0.1.0", + "filename": "ruv-fann-wsp-registry-0.1.0.tgz", + "bytes": 6368, + "sha256": "7bb4e5c628c5aeb89d001605a215917b11050013ba752882f674c34c852e56ed" + }, + { + "name": "ruv-fann-wsp-loop", + "version": "0.1.0", + "filename": "ruv-fann-wsp-loop-0.1.0.tgz", + "bytes": 10023, + "sha256": "906d01e14986ef833655a38539818e76183289a2879aba49b9364fcf150bafea" + }, + { + "name": "ruvnet-constellation-contracts", + "version": "0.1.0", + "filename": "ruvnet-constellation-contracts-0.1.0.tgz", + "bytes": 6778, + "sha256": "c776adc7055b9389eef1a7f3dca1ed9c3012f5e68545f039c7ccc0e0eb968b31" + }, + { + "name": "ruvnet-constellation", + "version": "0.1.0", + "filename": "ruvnet-constellation-0.1.0.tgz", + "bytes": 10887, + "sha256": "b0e184ad8b7740d1bfd7d4306b9a49b7391b1a5dd971869ada19cc50718cd2c5" + }, + { + "name": "ruvnet-constellation-telemetry", + "version": "0.1.0", + "filename": "ruvnet-constellation-telemetry-0.1.0.tgz", + "bytes": 20135, + "sha256": "f649aeff3c3bf51a0a0792f3f787f444ef54bc3527748ad8f919938d93896fe7" + } +] diff --git a/packages/wsp-toolkit/docs/evidence/huggingface-live.json b/packages/wsp-toolkit/docs/evidence/huggingface-live.json new file mode 100644 index 000000000..647cbc6ce --- /dev/null +++ b/packages/wsp-toolkit/docs/evidence/huggingface-live.json @@ -0,0 +1,20 @@ +{ + "schema": "ruv-fann.hub-live-validation/1", + "source": { + "repo": "ruv/ruview", + "revision": "544fb5d07c15733a12dbf16c562e73cb7f75eb71", + "path": "presence-head.json", + "sha256": "9a6ddce665dbc1734d837ae38398f387782f5a40bd2ce36bcbe795d083badeaf", + "bytes": 2619, + "url": "https://huggingface.co/ruv/ruview/resolve/544fb5d07c15733a12dbf16c562e73cb7f75eb71/presence-head.json" + }, + "interpretation": "affine-projection", + "modelHash": "cdede57a587384bb7e45a38c2a4c79c172f7ce81a0a18612d67e39304e5f51f2", + "parameters": 129, + "backend": "wasm", + "maxAffineOracleDifference": 1.7763568394002505e-15, + "acceptedControlledMSE": 0.00999999999999984, + "rejectedControlledMSE": 0.9999999999999991, + "taskAccuracyMeasured": false, + "note": "Live public Hub download and real WASM affine-head contract. Controlled synthetic inputs are not a WiFi sensing accuracy benchmark." +} diff --git a/packages/wsp-toolkit/docs/evidence/loop-demo.json b/packages/wsp-toolkit/docs/evidence/loop-demo.json new file mode 100644 index 000000000..fe28e6d37 --- /dev/null +++ b/packages/wsp-toolkit/docs/evidence/loop-demo.json @@ -0,0 +1,205 @@ +{ + "schema": "ruv-fann.evolution-demo/1", + "report": { + "schema": "ruv-fann.evolution-loop/1", + "stopReason": "goals-met", + "rounds": 1, + "promotions": 2, + "budget": { + "maxRounds": 3, + "maxProposals": 12, + "maxWork": 100000, + "concurrency": 3, + "jobTimeoutMs": 5000, + "maxDurationMs": 30000, + "proposals": 5, + "reservedWork": 596, + "elapsedMs": 296.98833 + }, + "workerThreadIds": [ + 1, + 2, + 3, + 4, + 5 + ], + "modules": [ + { + "id": "xor", + "initialRevision": 1, + "initialHash": "03b14212bc91c32aefa02c640c93a53db09ce084e35aad796c50bec5822ab087", + "finalRevision": 2, + "finalHash": "4c643b91803920f831cc90ae823187b86deabb6a9f48440cba2aa0071955be36", + "promotions": 1, + "goalReached": true + }, + { + "id": "linear", + "initialRevision": 1, + "initialHash": "d55c8b06fa0476feb8b14bf358acc2391bdaa3aadcadcfe093c017717b9e4d44", + "finalRevision": 2, + "finalHash": "721c85d1df903af2ca8fe07b29bc590e4aff2f5bf4b55291b91f214c9addfd67", + "promotions": 1, + "goalReached": true + } + ], + "events": [ + { + "round": 1, + "moduleId": "xor", + "revision": 1, + "strategy": "slice-search", + "type": "proposed" + }, + { + "round": 1, + "moduleId": "xor", + "revision": 1, + "strategy": "slice-search", + "type": "rejected", + "reason": "regression-gate", + "candidateHash": "6bb101509fd4011b355d445a9728963dd3ee864be9a1e05ea734bc5398a8ff60", + "failedSuites": [ + "complete-xor" + ] + }, + { + "round": 1, + "moduleId": "xor", + "revision": 1, + "strategy": "bias-shortcut", + "type": "proposed" + }, + { + "round": 1, + "moduleId": "xor", + "revision": 1, + "strategy": "bias-shortcut", + "type": "rejected", + "reason": "regression-gate", + "candidateHash": "79dfdd52e6b910a67627f69987bd0152cbedf0aae78d8ea4786d103e3a814d9d", + "failedSuites": [ + "complete-xor" + ] + }, + { + "round": 1, + "moduleId": "xor", + "revision": 1, + "strategy": "symbolic-repair", + "type": "proposed" + }, + { + "round": 1, + "moduleId": "xor", + "revision": 1, + "strategy": "symbolic-repair", + "type": "validated", + "candidateHash": "4c643b91803920f831cc90ae823187b86deabb6a9f48440cba2aa0071955be36", + "baselineMSE": 1, + "candidateMSE": 0, + "suiteHashes": [ + { + "name": "development", + "datasetHash": "4e75640bc15752d9dfbfdfadafb82ae50d617fd259fbfc552785a0d2b311e2a8", + "policyHash": "7fc67d988dbd6d241946fb23dbd43c6cee4236407ae468ac6ec8d4b031238bff" + }, + { + "name": "complete-xor", + "datasetHash": "b1142d12b221048c3977dca6074866bed27b06d03930b6be6dc61187c246dc4d", + "policyHash": "7fc67d988dbd6d241946fb23dbd43c6cee4236407ae468ac6ec8d4b031238bff" + } + ], + "invariantSuiteHash": "ed48f6221b84ff7b4123262a6fa8d6f66739e1e2eb3c386c45a5776c7866e548" + }, + { + "round": 1, + "moduleId": "xor", + "revision": 1, + "strategy": "symbolic-repair", + "type": "promoted", + "nextRevision": 2, + "candidateHash": "4c643b91803920f831cc90ae823187b86deabb6a9f48440cba2aa0071955be36", + "candidateMSE": 0 + }, + { + "round": 1, + "moduleId": "linear", + "revision": 1, + "strategy": "weight-search", + "type": "proposed" + }, + { + "round": 1, + "moduleId": "linear", + "revision": 1, + "strategy": "weight-search", + "type": "validated", + "candidateHash": "721c85d1df903af2ca8fe07b29bc590e4aff2f5bf4b55291b91f214c9addfd67", + "baselineMSE": 4, + "candidateMSE": 0, + "suiteHashes": [ + { + "name": "development", + "datasetHash": "f2065a9907443b81fa8f23df4e0927f538fa9e8db5bea0ea33c99ca2525fee51", + "policyHash": "7fc67d988dbd6d241946fb23dbd43c6cee4236407ae468ac6ec8d4b031238bff" + }, + { + "name": "independent-linear", + "datasetHash": "8f5ef59e1e99d3f17e3af3d605b6d34936a020a5e2fcededa2c70d211cdf989e", + "policyHash": "7fc67d988dbd6d241946fb23dbd43c6cee4236407ae468ac6ec8d4b031238bff" + } + ], + "invariantSuiteHash": "fc70fa29c8a894d04f02ad5da5222807d596ba167bf4142bfdaf1630bf16b20d" + }, + { + "round": 1, + "moduleId": "linear", + "revision": 1, + "strategy": "bias-shortcut", + "type": "proposed" + }, + { + "round": 1, + "moduleId": "linear", + "revision": 1, + "strategy": "bias-shortcut", + "type": "rejected", + "reason": "regression-gate", + "candidateHash": "95cc18868a74096a16539c47f82ba6ee6920d4e715d51d3a9a9144e007595bc5", + "failedSuites": [ + "independent-linear" + ] + }, + { + "round": 1, + "moduleId": "linear", + "revision": 1, + "strategy": "weight-search", + "type": "promoted", + "nextRevision": 2, + "candidateHash": "721c85d1df903af2ca8fe07b29bc590e4aff2f5bf4b55291b91f214c9addfd67", + "candidateMSE": 0 + } + ] + }, + "durability": { + "reopened": true, + "rollbackPersisted": true + }, + "rollback": [ + { + "id": "xor", + "revision": 3, + "hash": "03b14212bc91c32aefa02c640c93a53db09ce084e35aad796c50bec5822ab087", + "historyEntries": 3 + }, + { + "id": "linear", + "revision": 3, + "hash": "d55c8b06fa0476feb8b14bf358acc2391bdaa3aadcadcfe093c017717b9e4d44", + "historyEntries": 3 + } + ], + "database": ".artifacts/evolution-xi9k33/evolution.sqlite" +} diff --git a/packages/wsp-toolkit/docs/evidence/loop-node-22-validation.json b/packages/wsp-toolkit/docs/evidence/loop-node-22-validation.json new file mode 100644 index 000000000..46db0ed07 --- /dev/null +++ b/packages/wsp-toolkit/docs/evidence/loop-node-22-validation.json @@ -0,0 +1,426 @@ +{ + "schema": "ruv-fann.toolkit-validation/1", + "createdAt": "2026-11-11T02:50:55.602Z", + "node": "v22.13.0", + "typecheck": "passed", + "tests": { + "tests": 94, + "pass": 94, + "fail": 0, + "cancelled": 0, + "skipped": 0, + "todo": 0 + }, + "benchmark": { + "schema": "ruv-fann.search-benchmark/1", + "node": "v22.13.0", + "backend": "wasm", + "rows": 32, + "candidateCount": 16, + "repetitions": 9, + "equivalentCandidateHash": "721c85d1df903af2ca8fe07b29bc590e4aff2f5bf4b55291b91f214c9addfd67", + "candidateMSE": 0, + "referenceInferencePasses": 32, + "screenedInferencePasses": 19, + "inferencePassReductionPercent": 40.625, + "referenceMedianMs": 4.587152000000003, + "screenedMedianMs": 1.5939149999999955, + "note": "Identical 16-candidate monotonic one-coordinate sequence. Timing is a local observation; work reduction includes final authoritative baseline/candidate revalidation. Not an accuracy or generalization benchmark." + }, + "audit": { + "vulnerabilities": { + "info": 0, + "low": 0, + "moderate": 0, + "high": 0, + "critical": 0, + "total": 0 + }, + "scope": "all production and development dependencies", + "lockfileSHA256": "df2cbfb75ac2cf74b00e3f0803f23d6a8d977d77197ad06ccf2ee3adb27455ac" + }, + "agentdbIntegrationAudit": { + "vulnerabilities": { + "info": 0, + "low": 0, + "moderate": 0, + "high": 0, + "critical": 0, + "total": 0 + }, + "scope": "installed integration tree, optional dependencies omitted", + "lockfileSHA256": "229e110861a135c36cf495692d92e300f45e1d74d5609b4803aedd1f0a4815d1" + }, + "sourceTreeSHA256": "1087be6d483b34328ebaf0e33f03d23a777c5b6a15682d544141f580e051da60", + "sourceFiles": [ + { + "path": ".gitignore", + "sha256": "f0511d87b6daff32b51effec85f397ff36e7914c7849880d3d0c1d1c4eba600a" + }, + { + "path": "docs/design.md", + "sha256": "57c6b8f947f6c365a111b6d5052389b53ef2285e1561d81934faefcfa643cb70" + }, + { + "path": "docs/huggingface-source.json", + "sha256": "935e180aaae0f271ab5b01e20c612a221110c39bba94f74b73c6fd028546c2e4" + }, + { + "path": "docs/loop-design.md", + "sha256": "4553a75cea747adde3be0f02bdec2a6202edf68d1ae2f684a9b30c903116281d" + }, + { + "path": "docs/loop-validation.md", + "sha256": "bb94013322c53728593168c8f49645a061f183c75c178232136e749016647adc" + }, + { + "path": "docs/validation.md", + "sha256": "54495f5c0b64fd674c408c76b90f1231ea7fb45078898dc59dec181fffa6ea2f" + }, + { + "path": "package-lock.json", + "sha256": "df2cbfb75ac2cf74b00e3f0803f23d6a8d977d77197ad06ccf2ee3adb27455ac" + }, + { + "path": "package.json", + "sha256": "63b1e9b1f43d49bbf592b011cdacfcf20fbfce2d6d966114205ffc073d0f0cf5" + }, + { + "path": "packages/cloudflare/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/cloudflare/package.json", + "sha256": "b7495438311fe4808561548298eb62a29b358756cb20e850190620e648c1460a" + }, + { + "path": "packages/cloudflare/README.md", + "sha256": "f6bcca9a3605a7e9d8276cf22c02670ccbf36314a01dd16dd374c0a0a0a91793" + }, + { + "path": "packages/cloudflare/scripts/build.mjs", + "sha256": "7cadbdf90d4a57ce78166b0b789e36ff0dad3aac0e15c2c6f148ce41785a8269" + }, + { + "path": "packages/cloudflare/src/build.d.ts", + "sha256": "8b24c9683ba896cbd2fa207d8493e280937a6e87e63c81330df5e112c1630cfc" + }, + { + "path": "packages/cloudflare/src/build.js", + "sha256": "173edfd8dc82aeaee140ab216c10d17dfd76105f281d32097388944f2444043f" + }, + { + "path": "packages/cloudflare/src/index.d.ts", + "sha256": "d93c5133c21cd2cfcca7ad620c1c7a538007e23c6c3ed3d3ce059002e7ae4af4" + }, + { + "path": "packages/cloudflare/src/index.js", + "sha256": "1d8cdc902da54f54fa12fc8bc0a60537aaa6fcdfc278a99dd6c911ad0fc9bba7" + }, + { + "path": "packages/cloudflare/src/worker.js", + "sha256": "d93c4088089aa3f16488484017cde5caaf978782ebe2b7c2058a77d40f9fd390" + }, + { + "path": "packages/cloudflare/test/handler.test.mjs", + "sha256": "e45b2209c08b6afaefe5cd0fdb56e4160e165f9d6b91061df6e7c6bb9605f54f" + }, + { + "path": "packages/cloudflare/test/workerd.test.mjs", + "sha256": "8a5664be4b9ace08118af8887d7cab8623bad5f5e90fab28e810b4d9fe47b1b3" + }, + { + "path": "packages/cloudflare/wrangler.jsonc", + "sha256": "7cda0f7788937ccbbd63d250ef11a4d0b98c66b25872dcc02ecbdef807b814bd" + }, + { + "path": "packages/huggingface/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/huggingface/package.json", + "sha256": "c5a92b787ca8631874e0f5ff04d5e132ab4032932d5ed1a996e2a3dab511eea6" + }, + { + "path": "packages/huggingface/README.md", + "sha256": "a78e91609e12a49e74e7a3d3170f9f427da8575f1ac4a4864ded9778d5242775" + }, + { + "path": "packages/huggingface/src/index.d.ts", + "sha256": "cd4129715700e7d5aae1bab3953a5d9df99931e688b3835b26b6207b457f6465" + }, + { + "path": "packages/huggingface/src/index.js", + "sha256": "baf61b469ef682e49b94003ebf5ab2e19a2938fb166891ace145f6dc532329e9" + }, + { + "path": "packages/huggingface/test/hub.test.mjs", + "sha256": "a3f5c794a701b51aebb66d480054cb401ae2ca7ab34f86330f1de8d2889b2450" + }, + { + "path": "packages/invariants/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/invariants/package.json", + "sha256": "50489697b5cac0be86225a36994bc40511ecc2d1ce9ffff7454ca701b553d657" + }, + { + "path": "packages/invariants/README.md", + "sha256": "adf095c3c305a4a281f3685868727c2e13e5b037dad2aee870ae2f37e631ef4b" + }, + { + "path": "packages/invariants/src/data.js", + "sha256": "4b45398e0a1525c78f9c5cdc1983763945a2029972776d4c6199b2f4a3ac3292" + }, + { + "path": "packages/invariants/src/index.d.ts", + "sha256": "46e18b0082849240ea5601fcefc0dc0a8dc06b4ab5e0b1aa61cb6b58fa74189d" + }, + { + "path": "packages/invariants/src/index.js", + "sha256": "9718f48ae873ba67e376928b94f87e0af5ce33de7e3f0479f19be6f5cc0214bd" + }, + { + "path": "packages/invariants/test/invariants.test.mjs", + "sha256": "9a9a5222572a54576d3beb13ca61a92da0319e96ae3f74f94d085fde9aed0f19" + }, + { + "path": "packages/lifecycle/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/lifecycle/package.json", + "sha256": "fa434108ddbd96a20ba84e5fdf2e5cd4b95894b50348ff0c2194a762a8d0f573" + }, + { + "path": "packages/lifecycle/README.md", + "sha256": "af428aa418c392e5abcc638d8178ee3a99778ea337e574c744880c1152fd18f1" + }, + { + "path": "packages/lifecycle/src/cli.js", + "sha256": "821c40e837d45bfb5a19911361dc4a60d8cf3e6a2214091a0fe3db266ecd8bb1" + }, + { + "path": "packages/lifecycle/src/index.d.ts", + "sha256": "79186a80097d7e27b1e570f4f898af303b5c2c5a08fa493a829d0c8e416ed957" + }, + { + "path": "packages/lifecycle/src/index.js", + "sha256": "2c8fb836ce2e3e41e188e936a6a46c49e7bcd6aa8d73e4aefae4e0e1143357c4" + }, + { + "path": "packages/lifecycle/test/gate.test.mjs", + "sha256": "0f97063fa4945a7832488306be247689288e4ad5557909324bb811a5811744e1" + }, + { + "path": "packages/loop/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/loop/package.json", + "sha256": "78cbf7070cfe661df63803cc967a67d5f6d8a708db18539592385023c8e6704a" + }, + { + "path": "packages/loop/README.md", + "sha256": "34f659bf012a088dd37a32a30eade078a8e1598943dc82db78c21e4de21a967d" + }, + { + "path": "packages/loop/src/data.js", + "sha256": "8fdd1b327292822de676f95182206029581ae6c2cb37849fb554ceba10871e1f" + }, + { + "path": "packages/loop/src/index.d.ts", + "sha256": "d68496882f83d9dff9a225fd17eac00192917ccc32ac5e54ed5d5392ddd681f9" + }, + { + "path": "packages/loop/src/index.js", + "sha256": "31fb38d2e058676a2c02f90a8417a6ecaa3daf5d63ac811423d1881cd88e63ca" + }, + { + "path": "packages/loop/test/loop.test.mjs", + "sha256": "a1235579700e94475dd87da69b7049150cccba7282d618dcf00ed6afbd0ba2a1" + }, + { + "path": "packages/registry/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/registry/package.json", + "sha256": "c0688eb083ca37a407c213c5226fb4ab6a056a8e7cc381e8ed05bb8924501d38" + }, + { + "path": "packages/registry/README.md", + "sha256": "ecf88f90c9c15910b7ecf80b398f127fd95f8cc8dbd0d6178babac73bcee98af" + }, + { + "path": "packages/registry/src/index.d.ts", + "sha256": "1b554b60dd06c441ae59fb32a4c84cec0ea9b8bcb6bab736b3e4ba899fa1f20a" + }, + { + "path": "packages/registry/src/index.js", + "sha256": "21760a5c802f6cffed836e3c707a4a0f61465e207cc72e9692ba220d68017ce9" + }, + { + "path": "packages/registry/test/registry.test.mjs", + "sha256": "9dc720e1e1685cfede279c89a973929ac68f749777a230cbc1fc1a119c6a7e9c" + }, + { + "path": "packages/ruos/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/ruos/package.json", + "sha256": "3d1fc67c5464789128d370dce35777902cb23aaee90f0bdc844ecfe61e49e328" + }, + { + "path": "packages/ruos/README.md", + "sha256": "e0a845b2fe55e69c41b285c154b096b49c61eab4d0234fe049522ff4761fab4d" + }, + { + "path": "packages/ruos/src/index.d.ts", + "sha256": "780094ec3f3d4ae984b1ccc69f52b84261c42f0749a652df0b8e881878bc697a" + }, + { + "path": "packages/ruos/src/index.js", + "sha256": "0c9a6070bc1b70af58934b47d6b9be0e49ce884eb2839a2e3580118343d31f39" + }, + { + "path": "packages/ruos/test/ruos.test.mjs", + "sha256": "2bfac47783a83a569ebfc3526aea4665949eebcb3f147afeaa3047305e50549c" + }, + { + "path": "packages/search/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/search/package.json", + "sha256": "ba1085c32fe794e9213e0d9b319208d514c1ad12d0f25bffcfa98d586abe7ebc" + }, + { + "path": "packages/search/README.md", + "sha256": "173e7c5449e3c914c9e8c2311fa6959964715cbec0e2bc4799163ee8d0496b4d" + }, + { + "path": "packages/search/src/data.js", + "sha256": "5825e0aea30189d3d808dd2e932fadfe20dedad0df574ae1288b97fa3b339a38" + }, + { + "path": "packages/search/src/index.d.ts", + "sha256": "a28f37a50281e88d31f275dde4ff5f40b90afdf15c6ad9dfe4b4b4b2f6dd947c" + }, + { + "path": "packages/search/src/index.js", + "sha256": "7bce3367ab680b3e377f0b8eeaae6194f25ee38368c7e5e4f51d9f04771df62c" + }, + { + "path": "packages/search/test/search.test.mjs", + "sha256": "215740fd17e384c41f9afe47326bf8cfa07a74a48d0f468c319e2f03e846b11d" + }, + { + "path": "packages/swarm/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/swarm/package.json", + "sha256": "6842fd78448f40819bc1a58e2160fb1b19ebd87da1487c7beaff0d8a7b9bef54" + }, + { + "path": "packages/swarm/README.md", + "sha256": "134c6c668fd84b8db84b6de0851d5d2b4ff04c381f52e962db7cb35b976c5671" + }, + { + "path": "packages/swarm/src/data.js", + "sha256": "c97ed1d82314ee61eeefcefec7d483392f5fc09bd9bebe32f9f2145c731788dd" + }, + { + "path": "packages/swarm/src/index.d.ts", + "sha256": "5ad45898469848d7533b42a15a69fc8fc91e181502d7cb54413f7153cadd62f3" + }, + { + "path": "packages/swarm/src/index.js", + "sha256": "a03df0a7a2381a3011135900ab2fd9e71f34332e6781918f75feb8f2880d52b0" + }, + { + "path": "packages/swarm/src/worker.js", + "sha256": "134945bf9cfc082a0e690bc49e105ec64a29b32c59ef12da3d4b270916d4fa2d" + }, + { + "path": "packages/swarm/test/swarm.test.mjs", + "sha256": "6a2873c9604d2eda518180f025b1bbd68fad8f4a5889d028995fa5bcb1989c81" + }, + { + "path": "README.md", + "sha256": "ad1afb8f70705abcb6642d82697b76d5c2a9d699c5da8256b38b131d318df255" + }, + { + "path": "scripts/benchmark.mjs", + "sha256": "a05680d508d739b6dea6e53196cff1efd6f81d3065e5f08eb980d2f19e3ab289" + }, + { + "path": "scripts/evolution-demo.mjs", + "sha256": "5c34517bf65a1383ec85e3634bf5ab42b3e6ef4b993cea905f2391a9edf6e9c1" + }, + { + "path": "scripts/huggingface-live.mjs", + "sha256": "aa98b72185421cde24a8d45f2db47937724b1429689943fce3e6a9a7cb32ba46" + }, + { + "path": "scripts/packed-consumer.mjs", + "sha256": "ed5f18a6e6399bd1372337fbe81d9bf8ef92bffe839dd28d6b791544176cda07" + }, + { + "path": "scripts/validate.mjs", + "sha256": "bc8ebe777c92535594960a7ead8a3ee7428fe0c08cc4d47a3885c69db0b25ee2" + }, + { + "path": "test/browser.test.mjs", + "sha256": "8e8383ab9a9d5f974f936a4e97772b88c1411fa5d9c7635bd794f0f1a4e74b71" + }, + { + "path": "test/consumer.test.mjs", + "sha256": "eb80d242fea0b75faf7ec2a87557b0e70b0a7b5a5cd703209f010aa1477da08a" + }, + { + "path": "test/evolution-scenario.mjs", + "sha256": "6cc1855bb73e3483d8414a29ecfb50f30a05401f50080f3bd3fce56a7d4bdc97" + }, + { + "path": "test/integration.test.mjs", + "sha256": "403ca92aeaf3ea7c0466989c6fba202fcce8b1c594aa1783b39636dc9041ead2" + }, + { + "path": "test/scenario.mjs", + "sha256": "9884b953d21aff57f48e0d06de900679cf7d4c41928b67af0cc0d018d2460c45" + }, + { + "path": "test/types.ts", + "sha256": "3e3e5dc8638f75d136091db4f7c1462995421de123e6b93d26e79207b0198c60" + }, + { + "path": "tooling/agentdb/.npmrc", + "sha256": "4afddb3b717898468cfc68f97a3732ed2abf16df5de65925de4bc471a0f6780f" + }, + { + "path": "tooling/agentdb/package-lock.json", + "sha256": "229e110861a135c36cf495692d92e300f45e1d74d5609b4803aedd1f0a4815d1" + }, + { + "path": "tooling/agentdb/package.json", + "sha256": "200138975eb9dc4d08436bd03e975e3581d53d497a4add435271464753a64b50" + }, + { + "path": "tooling/agentdb/README.md", + "sha256": "33303ad2758db41d6ef5dce5042aa7d80c8780d73c54621e32924862e1337d58" + }, + { + "path": "tooling/agentdb/runtime.mjs", + "sha256": "9bd88f81c48ec2c365f67e94bf6095d005f2f5cf0d9a7889570ca72e2338d690" + }, + { + "path": "tsconfig.json", + "sha256": "daf2b629ec6c113c62f3c4ee10f1e1632d301575f98b11d1fd6013c5ab717b54" + } + ], + "limits": "Local validation only. Source digest excludes generated .artifacts and docs/evidence. This is not a signature or deployment authorization." +} diff --git a/packages/wsp-toolkit/docs/evidence/loop-node-24-validation.json b/packages/wsp-toolkit/docs/evidence/loop-node-24-validation.json new file mode 100644 index 000000000..17618929c --- /dev/null +++ b/packages/wsp-toolkit/docs/evidence/loop-node-24-validation.json @@ -0,0 +1,426 @@ +{ + "schema": "ruv-fann.toolkit-validation/1", + "createdAt": "2026-11-11T02:51:03.332Z", + "node": "v24.22.1", + "typecheck": "passed", + "tests": { + "tests": 94, + "pass": 94, + "fail": 0, + "cancelled": 0, + "skipped": 0, + "todo": 0 + }, + "benchmark": { + "schema": "ruv-fann.search-benchmark/1", + "node": "v24.22.1", + "backend": "wasm", + "rows": 32, + "candidateCount": 16, + "repetitions": 9, + "equivalentCandidateHash": "721c85d1df903af2ca8fe07b29bc590e4aff2f5bf4b55291b91f214c9addfd67", + "candidateMSE": 0, + "referenceInferencePasses": 32, + "screenedInferencePasses": 19, + "inferencePassReductionPercent": 40.625, + "referenceMedianMs": 4.358916000000008, + "screenedMedianMs": 1.3487779999999958, + "note": "Identical 16-candidate monotonic one-coordinate sequence. Timing is a local observation; work reduction includes final authoritative baseline/candidate revalidation. Not an accuracy or generalization benchmark." + }, + "audit": { + "vulnerabilities": { + "info": 0, + "low": 0, + "moderate": 0, + "high": 0, + "critical": 0, + "total": 0 + }, + "scope": "all production and development dependencies", + "lockfileSHA256": "df2cbfb75ac2cf74b00e3f0803f23d6a8d977d77197ad06ccf2ee3adb27455ac" + }, + "agentdbIntegrationAudit": { + "vulnerabilities": { + "info": 0, + "low": 0, + "moderate": 0, + "high": 0, + "critical": 0, + "total": 0 + }, + "scope": "installed integration tree, optional dependencies omitted", + "lockfileSHA256": "229e110861a135c36cf495692d92e300f45e1d74d5609b4803aedd1f0a4815d1" + }, + "sourceTreeSHA256": "1087be6d483b34328ebaf0e33f03d23a777c5b6a15682d544141f580e051da60", + "sourceFiles": [ + { + "path": ".gitignore", + "sha256": "f0511d87b6daff32b51effec85f397ff36e7914c7849880d3d0c1d1c4eba600a" + }, + { + "path": "docs/design.md", + "sha256": "57c6b8f947f6c365a111b6d5052389b53ef2285e1561d81934faefcfa643cb70" + }, + { + "path": "docs/huggingface-source.json", + "sha256": "935e180aaae0f271ab5b01e20c612a221110c39bba94f74b73c6fd028546c2e4" + }, + { + "path": "docs/loop-design.md", + "sha256": "4553a75cea747adde3be0f02bdec2a6202edf68d1ae2f684a9b30c903116281d" + }, + { + "path": "docs/loop-validation.md", + "sha256": "bb94013322c53728593168c8f49645a061f183c75c178232136e749016647adc" + }, + { + "path": "docs/validation.md", + "sha256": "54495f5c0b64fd674c408c76b90f1231ea7fb45078898dc59dec181fffa6ea2f" + }, + { + "path": "package-lock.json", + "sha256": "df2cbfb75ac2cf74b00e3f0803f23d6a8d977d77197ad06ccf2ee3adb27455ac" + }, + { + "path": "package.json", + "sha256": "63b1e9b1f43d49bbf592b011cdacfcf20fbfce2d6d966114205ffc073d0f0cf5" + }, + { + "path": "packages/cloudflare/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/cloudflare/package.json", + "sha256": "b7495438311fe4808561548298eb62a29b358756cb20e850190620e648c1460a" + }, + { + "path": "packages/cloudflare/README.md", + "sha256": "f6bcca9a3605a7e9d8276cf22c02670ccbf36314a01dd16dd374c0a0a0a91793" + }, + { + "path": "packages/cloudflare/scripts/build.mjs", + "sha256": "7cadbdf90d4a57ce78166b0b789e36ff0dad3aac0e15c2c6f148ce41785a8269" + }, + { + "path": "packages/cloudflare/src/build.d.ts", + "sha256": "8b24c9683ba896cbd2fa207d8493e280937a6e87e63c81330df5e112c1630cfc" + }, + { + "path": "packages/cloudflare/src/build.js", + "sha256": "173edfd8dc82aeaee140ab216c10d17dfd76105f281d32097388944f2444043f" + }, + { + "path": "packages/cloudflare/src/index.d.ts", + "sha256": "d93c5133c21cd2cfcca7ad620c1c7a538007e23c6c3ed3d3ce059002e7ae4af4" + }, + { + "path": "packages/cloudflare/src/index.js", + "sha256": "1d8cdc902da54f54fa12fc8bc0a60537aaa6fcdfc278a99dd6c911ad0fc9bba7" + }, + { + "path": "packages/cloudflare/src/worker.js", + "sha256": "d93c4088089aa3f16488484017cde5caaf978782ebe2b7c2058a77d40f9fd390" + }, + { + "path": "packages/cloudflare/test/handler.test.mjs", + "sha256": "e45b2209c08b6afaefe5cd0fdb56e4160e165f9d6b91061df6e7c6bb9605f54f" + }, + { + "path": "packages/cloudflare/test/workerd.test.mjs", + "sha256": "8a5664be4b9ace08118af8887d7cab8623bad5f5e90fab28e810b4d9fe47b1b3" + }, + { + "path": "packages/cloudflare/wrangler.jsonc", + "sha256": "7cda0f7788937ccbbd63d250ef11a4d0b98c66b25872dcc02ecbdef807b814bd" + }, + { + "path": "packages/huggingface/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/huggingface/package.json", + "sha256": "c5a92b787ca8631874e0f5ff04d5e132ab4032932d5ed1a996e2a3dab511eea6" + }, + { + "path": "packages/huggingface/README.md", + "sha256": "a78e91609e12a49e74e7a3d3170f9f427da8575f1ac4a4864ded9778d5242775" + }, + { + "path": "packages/huggingface/src/index.d.ts", + "sha256": "cd4129715700e7d5aae1bab3953a5d9df99931e688b3835b26b6207b457f6465" + }, + { + "path": "packages/huggingface/src/index.js", + "sha256": "baf61b469ef682e49b94003ebf5ab2e19a2938fb166891ace145f6dc532329e9" + }, + { + "path": "packages/huggingface/test/hub.test.mjs", + "sha256": "a3f5c794a701b51aebb66d480054cb401ae2ca7ab34f86330f1de8d2889b2450" + }, + { + "path": "packages/invariants/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/invariants/package.json", + "sha256": "50489697b5cac0be86225a36994bc40511ecc2d1ce9ffff7454ca701b553d657" + }, + { + "path": "packages/invariants/README.md", + "sha256": "adf095c3c305a4a281f3685868727c2e13e5b037dad2aee870ae2f37e631ef4b" + }, + { + "path": "packages/invariants/src/data.js", + "sha256": "4b45398e0a1525c78f9c5cdc1983763945a2029972776d4c6199b2f4a3ac3292" + }, + { + "path": "packages/invariants/src/index.d.ts", + "sha256": "46e18b0082849240ea5601fcefc0dc0a8dc06b4ab5e0b1aa61cb6b58fa74189d" + }, + { + "path": "packages/invariants/src/index.js", + "sha256": "9718f48ae873ba67e376928b94f87e0af5ce33de7e3f0479f19be6f5cc0214bd" + }, + { + "path": "packages/invariants/test/invariants.test.mjs", + "sha256": "9a9a5222572a54576d3beb13ca61a92da0319e96ae3f74f94d085fde9aed0f19" + }, + { + "path": "packages/lifecycle/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/lifecycle/package.json", + "sha256": "fa434108ddbd96a20ba84e5fdf2e5cd4b95894b50348ff0c2194a762a8d0f573" + }, + { + "path": "packages/lifecycle/README.md", + "sha256": "af428aa418c392e5abcc638d8178ee3a99778ea337e574c744880c1152fd18f1" + }, + { + "path": "packages/lifecycle/src/cli.js", + "sha256": "821c40e837d45bfb5a19911361dc4a60d8cf3e6a2214091a0fe3db266ecd8bb1" + }, + { + "path": "packages/lifecycle/src/index.d.ts", + "sha256": "79186a80097d7e27b1e570f4f898af303b5c2c5a08fa493a829d0c8e416ed957" + }, + { + "path": "packages/lifecycle/src/index.js", + "sha256": "2c8fb836ce2e3e41e188e936a6a46c49e7bcd6aa8d73e4aefae4e0e1143357c4" + }, + { + "path": "packages/lifecycle/test/gate.test.mjs", + "sha256": "0f97063fa4945a7832488306be247689288e4ad5557909324bb811a5811744e1" + }, + { + "path": "packages/loop/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/loop/package.json", + "sha256": "78cbf7070cfe661df63803cc967a67d5f6d8a708db18539592385023c8e6704a" + }, + { + "path": "packages/loop/README.md", + "sha256": "34f659bf012a088dd37a32a30eade078a8e1598943dc82db78c21e4de21a967d" + }, + { + "path": "packages/loop/src/data.js", + "sha256": "8fdd1b327292822de676f95182206029581ae6c2cb37849fb554ceba10871e1f" + }, + { + "path": "packages/loop/src/index.d.ts", + "sha256": "d68496882f83d9dff9a225fd17eac00192917ccc32ac5e54ed5d5392ddd681f9" + }, + { + "path": "packages/loop/src/index.js", + "sha256": "31fb38d2e058676a2c02f90a8417a6ecaa3daf5d63ac811423d1881cd88e63ca" + }, + { + "path": "packages/loop/test/loop.test.mjs", + "sha256": "a1235579700e94475dd87da69b7049150cccba7282d618dcf00ed6afbd0ba2a1" + }, + { + "path": "packages/registry/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/registry/package.json", + "sha256": "c0688eb083ca37a407c213c5226fb4ab6a056a8e7cc381e8ed05bb8924501d38" + }, + { + "path": "packages/registry/README.md", + "sha256": "ecf88f90c9c15910b7ecf80b398f127fd95f8cc8dbd0d6178babac73bcee98af" + }, + { + "path": "packages/registry/src/index.d.ts", + "sha256": "1b554b60dd06c441ae59fb32a4c84cec0ea9b8bcb6bab736b3e4ba899fa1f20a" + }, + { + "path": "packages/registry/src/index.js", + "sha256": "21760a5c802f6cffed836e3c707a4a0f61465e207cc72e9692ba220d68017ce9" + }, + { + "path": "packages/registry/test/registry.test.mjs", + "sha256": "9dc720e1e1685cfede279c89a973929ac68f749777a230cbc1fc1a119c6a7e9c" + }, + { + "path": "packages/ruos/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/ruos/package.json", + "sha256": "3d1fc67c5464789128d370dce35777902cb23aaee90f0bdc844ecfe61e49e328" + }, + { + "path": "packages/ruos/README.md", + "sha256": "e0a845b2fe55e69c41b285c154b096b49c61eab4d0234fe049522ff4761fab4d" + }, + { + "path": "packages/ruos/src/index.d.ts", + "sha256": "780094ec3f3d4ae984b1ccc69f52b84261c42f0749a652df0b8e881878bc697a" + }, + { + "path": "packages/ruos/src/index.js", + "sha256": "0c9a6070bc1b70af58934b47d6b9be0e49ce884eb2839a2e3580118343d31f39" + }, + { + "path": "packages/ruos/test/ruos.test.mjs", + "sha256": "2bfac47783a83a569ebfc3526aea4665949eebcb3f147afeaa3047305e50549c" + }, + { + "path": "packages/search/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/search/package.json", + "sha256": "ba1085c32fe794e9213e0d9b319208d514c1ad12d0f25bffcfa98d586abe7ebc" + }, + { + "path": "packages/search/README.md", + "sha256": "173e7c5449e3c914c9e8c2311fa6959964715cbec0e2bc4799163ee8d0496b4d" + }, + { + "path": "packages/search/src/data.js", + "sha256": "5825e0aea30189d3d808dd2e932fadfe20dedad0df574ae1288b97fa3b339a38" + }, + { + "path": "packages/search/src/index.d.ts", + "sha256": "a28f37a50281e88d31f275dde4ff5f40b90afdf15c6ad9dfe4b4b4b2f6dd947c" + }, + { + "path": "packages/search/src/index.js", + "sha256": "7bce3367ab680b3e377f0b8eeaae6194f25ee38368c7e5e4f51d9f04771df62c" + }, + { + "path": "packages/search/test/search.test.mjs", + "sha256": "215740fd17e384c41f9afe47326bf8cfa07a74a48d0f468c319e2f03e846b11d" + }, + { + "path": "packages/swarm/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/swarm/package.json", + "sha256": "6842fd78448f40819bc1a58e2160fb1b19ebd87da1487c7beaff0d8a7b9bef54" + }, + { + "path": "packages/swarm/README.md", + "sha256": "134c6c668fd84b8db84b6de0851d5d2b4ff04c381f52e962db7cb35b976c5671" + }, + { + "path": "packages/swarm/src/data.js", + "sha256": "c97ed1d82314ee61eeefcefec7d483392f5fc09bd9bebe32f9f2145c731788dd" + }, + { + "path": "packages/swarm/src/index.d.ts", + "sha256": "5ad45898469848d7533b42a15a69fc8fc91e181502d7cb54413f7153cadd62f3" + }, + { + "path": "packages/swarm/src/index.js", + "sha256": "a03df0a7a2381a3011135900ab2fd9e71f34332e6781918f75feb8f2880d52b0" + }, + { + "path": "packages/swarm/src/worker.js", + "sha256": "134945bf9cfc082a0e690bc49e105ec64a29b32c59ef12da3d4b270916d4fa2d" + }, + { + "path": "packages/swarm/test/swarm.test.mjs", + "sha256": "6a2873c9604d2eda518180f025b1bbd68fad8f4a5889d028995fa5bcb1989c81" + }, + { + "path": "README.md", + "sha256": "ad1afb8f70705abcb6642d82697b76d5c2a9d699c5da8256b38b131d318df255" + }, + { + "path": "scripts/benchmark.mjs", + "sha256": "a05680d508d739b6dea6e53196cff1efd6f81d3065e5f08eb980d2f19e3ab289" + }, + { + "path": "scripts/evolution-demo.mjs", + "sha256": "5c34517bf65a1383ec85e3634bf5ab42b3e6ef4b993cea905f2391a9edf6e9c1" + }, + { + "path": "scripts/huggingface-live.mjs", + "sha256": "aa98b72185421cde24a8d45f2db47937724b1429689943fce3e6a9a7cb32ba46" + }, + { + "path": "scripts/packed-consumer.mjs", + "sha256": "ed5f18a6e6399bd1372337fbe81d9bf8ef92bffe839dd28d6b791544176cda07" + }, + { + "path": "scripts/validate.mjs", + "sha256": "bc8ebe777c92535594960a7ead8a3ee7428fe0c08cc4d47a3885c69db0b25ee2" + }, + { + "path": "test/browser.test.mjs", + "sha256": "8e8383ab9a9d5f974f936a4e97772b88c1411fa5d9c7635bd794f0f1a4e74b71" + }, + { + "path": "test/consumer.test.mjs", + "sha256": "eb80d242fea0b75faf7ec2a87557b0e70b0a7b5a5cd703209f010aa1477da08a" + }, + { + "path": "test/evolution-scenario.mjs", + "sha256": "6cc1855bb73e3483d8414a29ecfb50f30a05401f50080f3bd3fce56a7d4bdc97" + }, + { + "path": "test/integration.test.mjs", + "sha256": "403ca92aeaf3ea7c0466989c6fba202fcce8b1c594aa1783b39636dc9041ead2" + }, + { + "path": "test/scenario.mjs", + "sha256": "9884b953d21aff57f48e0d06de900679cf7d4c41928b67af0cc0d018d2460c45" + }, + { + "path": "test/types.ts", + "sha256": "3e3e5dc8638f75d136091db4f7c1462995421de123e6b93d26e79207b0198c60" + }, + { + "path": "tooling/agentdb/.npmrc", + "sha256": "4afddb3b717898468cfc68f97a3732ed2abf16df5de65925de4bc471a0f6780f" + }, + { + "path": "tooling/agentdb/package-lock.json", + "sha256": "229e110861a135c36cf495692d92e300f45e1d74d5609b4803aedd1f0a4815d1" + }, + { + "path": "tooling/agentdb/package.json", + "sha256": "200138975eb9dc4d08436bd03e975e3581d53d497a4add435271464753a64b50" + }, + { + "path": "tooling/agentdb/README.md", + "sha256": "33303ad2758db41d6ef5dce5042aa7d80c8780d73c54621e32924862e1337d58" + }, + { + "path": "tooling/agentdb/runtime.mjs", + "sha256": "9bd88f81c48ec2c365f67e94bf6095d005f2f5cf0d9a7889570ca72e2338d690" + }, + { + "path": "tsconfig.json", + "sha256": "daf2b629ec6c113c62f3c4ee10f1e1632d301575f98b11d1fd6013c5ab717b54" + } + ], + "limits": "Local validation only. Source digest excludes generated .artifacts and docs/evidence. This is not a signature or deployment authorization." +} diff --git a/packages/wsp-toolkit/docs/evidence/loop-package-archives.json b/packages/wsp-toolkit/docs/evidence/loop-package-archives.json new file mode 100644 index 000000000..bd1413953 --- /dev/null +++ b/packages/wsp-toolkit/docs/evidence/loop-package-archives.json @@ -0,0 +1,65 @@ +[ + { + "name": "ruv-fann-wsp-lifecycle", + "version": "0.1.0", + "filename": "ruv-fann-wsp-lifecycle-0.1.0.tgz", + "bytes": 4474, + "sha256": "24b0d3f4c0acf0097e0ca3b067674700776df27b38d4ba6c8d6e05869a29706e" + }, + { + "name": "ruv-fann-wsp-search", + "version": "0.1.0", + "filename": "ruv-fann-wsp-search-0.1.0.tgz", + "bytes": 8964, + "sha256": "eb9ff647bfe527e4a646164bd0a3492348100181e9cb43511057a91c1749cd79" + }, + { + "name": "ruv-fann-wsp-huggingface", + "version": "0.1.0", + "filename": "ruv-fann-wsp-huggingface-0.1.0.tgz", + "bytes": 6023, + "sha256": "b755144a2865beb8b9a1446c96ed4195f42fea872d6d1c3a9b2020ea85c26775" + }, + { + "name": "ruv-fann-wsp-cloudflare", + "version": "0.1.0", + "filename": "ruv-fann-wsp-cloudflare-0.1.0.tgz", + "bytes": 7106, + "sha256": "172c5120dcccf7224420d34ae0f3f7638a0c075397faa0e35652777d105879a2" + }, + { + "name": "ruv-fann-wsp-ruos", + "version": "0.1.0", + "filename": "ruv-fann-wsp-ruos-0.1.0.tgz", + "bytes": 3755, + "sha256": "f4a773ad61801ca7c7a5f94339fc53516beeddc15a4fb08705c975f367d132d5" + }, + { + "name": "ruv-fann-wsp-invariants", + "version": "0.1.0", + "filename": "ruv-fann-wsp-invariants-0.1.0.tgz", + "bytes": 7311, + "sha256": "b2acc93847d13231c604f6913150b99e504f326eeb7cdede0b4b81051d8837d8" + }, + { + "name": "ruv-fann-wsp-swarm", + "version": "0.1.0", + "filename": "ruv-fann-wsp-swarm-0.1.0.tgz", + "bytes": 8713, + "sha256": "e3a14e7c4d5625838709586b14d393e9394d721f5f46cfa90f966c90c1faabf9" + }, + { + "name": "ruv-fann-wsp-registry", + "version": "0.1.0", + "filename": "ruv-fann-wsp-registry-0.1.0.tgz", + "bytes": 5983, + "sha256": "952c966b4500fcb7837d1383b0a3ebc3b32459a9d1a13d436b7c1bd357a46603" + }, + { + "name": "ruv-fann-wsp-loop", + "version": "0.1.0", + "filename": "ruv-fann-wsp-loop-0.1.0.tgz", + "bytes": 9639, + "sha256": "b4df5c4ccdaf921f1300a919349424942c8eb9ee7291930d7d99c05f6d144d6a" + } +] diff --git a/packages/wsp-toolkit/docs/evidence/node-22-validation.json b/packages/wsp-toolkit/docs/evidence/node-22-validation.json new file mode 100644 index 000000000..cdfe5b176 --- /dev/null +++ b/packages/wsp-toolkit/docs/evidence/node-22-validation.json @@ -0,0 +1,266 @@ +{ + "schema": "ruv-fann.toolkit-validation/1", + "createdAt": "2026-11-11T02:02:34.273Z", + "node": "v22.13.0", + "typecheck": "passed", + "tests": { + "tests": 47, + "pass": 47, + "fail": 0, + "cancelled": 0, + "skipped": 0, + "todo": 0 + }, + "benchmark": { + "schema": "ruv-fann.search-benchmark/1", + "node": "v22.13.0", + "backend": "wasm", + "rows": 32, + "candidateCount": 16, + "repetitions": 9, + "equivalentCandidateHash": "721c85d1df903af2ca8fe07b29bc590e4aff2f5bf4b55291b91f214c9addfd67", + "candidateMSE": 0, + "referenceInferencePasses": 32, + "screenedInferencePasses": 19, + "inferencePassReductionPercent": 40.625, + "referenceMedianMs": 4.723240000000004, + "screenedMedianMs": 1.3218790000000098, + "note": "Identical 16-candidate monotonic one-coordinate sequence. Timing is a local observation; work reduction includes final authoritative baseline/candidate revalidation. Not an accuracy or generalization benchmark." + }, + "audit": { + "vulnerabilities": { + "info": 0, + "low": 0, + "moderate": 0, + "high": 0, + "critical": 0, + "total": 0 + }, + "scope": "all production and development dependencies", + "lockfileSHA256": "0be668c6142857115029469b5e5a4d7581792d99dfe478d4a6fe0e734fcbe3c9" + }, + "sourceTreeSHA256": "da6e9a00dc86d3296b58c963f276df5c6229f6cb0fa42a86db6d8178e55d73ef", + "sourceFiles": [ + { + "path": ".gitignore", + "sha256": "f0511d87b6daff32b51effec85f397ff36e7914c7849880d3d0c1d1c4eba600a" + }, + { + "path": "docs/design.md", + "sha256": "57c6b8f947f6c365a111b6d5052389b53ef2285e1561d81934faefcfa643cb70" + }, + { + "path": "docs/huggingface-source.json", + "sha256": "935e180aaae0f271ab5b01e20c612a221110c39bba94f74b73c6fd028546c2e4" + }, + { + "path": "docs/validation.md", + "sha256": "9a1857d074025719b5a00808b41b3101b2ab5e738aeae74182658dbc07c14051" + }, + { + "path": "package-lock.json", + "sha256": "0be668c6142857115029469b5e5a4d7581792d99dfe478d4a6fe0e734fcbe3c9" + }, + { + "path": "package.json", + "sha256": "91f0b1741ae34914478dc16c8ed8577615f04b7f477564ac42f35a4790d97e9d" + }, + { + "path": "packages/cloudflare/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/cloudflare/package.json", + "sha256": "b7495438311fe4808561548298eb62a29b358756cb20e850190620e648c1460a" + }, + { + "path": "packages/cloudflare/README.md", + "sha256": "f6bcca9a3605a7e9d8276cf22c02670ccbf36314a01dd16dd374c0a0a0a91793" + }, + { + "path": "packages/cloudflare/scripts/build.mjs", + "sha256": "7cadbdf90d4a57ce78166b0b789e36ff0dad3aac0e15c2c6f148ce41785a8269" + }, + { + "path": "packages/cloudflare/src/build.d.ts", + "sha256": "8b24c9683ba896cbd2fa207d8493e280937a6e87e63c81330df5e112c1630cfc" + }, + { + "path": "packages/cloudflare/src/build.js", + "sha256": "173edfd8dc82aeaee140ab216c10d17dfd76105f281d32097388944f2444043f" + }, + { + "path": "packages/cloudflare/src/index.d.ts", + "sha256": "d93c5133c21cd2cfcca7ad620c1c7a538007e23c6c3ed3d3ce059002e7ae4af4" + }, + { + "path": "packages/cloudflare/src/index.js", + "sha256": "1d8cdc902da54f54fa12fc8bc0a60537aaa6fcdfc278a99dd6c911ad0fc9bba7" + }, + { + "path": "packages/cloudflare/src/worker.js", + "sha256": "d93c4088089aa3f16488484017cde5caaf978782ebe2b7c2058a77d40f9fd390" + }, + { + "path": "packages/cloudflare/test/handler.test.mjs", + "sha256": "e45b2209c08b6afaefe5cd0fdb56e4160e165f9d6b91061df6e7c6bb9605f54f" + }, + { + "path": "packages/cloudflare/test/workerd.test.mjs", + "sha256": "8a5664be4b9ace08118af8887d7cab8623bad5f5e90fab28e810b4d9fe47b1b3" + }, + { + "path": "packages/cloudflare/wrangler.jsonc", + "sha256": "7cda0f7788937ccbbd63d250ef11a4d0b98c66b25872dcc02ecbdef807b814bd" + }, + { + "path": "packages/huggingface/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/huggingface/package.json", + "sha256": "c5a92b787ca8631874e0f5ff04d5e132ab4032932d5ed1a996e2a3dab511eea6" + }, + { + "path": "packages/huggingface/README.md", + "sha256": "a78e91609e12a49e74e7a3d3170f9f427da8575f1ac4a4864ded9778d5242775" + }, + { + "path": "packages/huggingface/src/index.d.ts", + "sha256": "cd4129715700e7d5aae1bab3953a5d9df99931e688b3835b26b6207b457f6465" + }, + { + "path": "packages/huggingface/src/index.js", + "sha256": "baf61b469ef682e49b94003ebf5ab2e19a2938fb166891ace145f6dc532329e9" + }, + { + "path": "packages/huggingface/test/hub.test.mjs", + "sha256": "a3f5c794a701b51aebb66d480054cb401ae2ca7ab34f86330f1de8d2889b2450" + }, + { + "path": "packages/lifecycle/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/lifecycle/package.json", + "sha256": "fa434108ddbd96a20ba84e5fdf2e5cd4b95894b50348ff0c2194a762a8d0f573" + }, + { + "path": "packages/lifecycle/README.md", + "sha256": "af428aa418c392e5abcc638d8178ee3a99778ea337e574c744880c1152fd18f1" + }, + { + "path": "packages/lifecycle/src/cli.js", + "sha256": "821c40e837d45bfb5a19911361dc4a60d8cf3e6a2214091a0fe3db266ecd8bb1" + }, + { + "path": "packages/lifecycle/src/index.d.ts", + "sha256": "79186a80097d7e27b1e570f4f898af303b5c2c5a08fa493a829d0c8e416ed957" + }, + { + "path": "packages/lifecycle/src/index.js", + "sha256": "2c8fb836ce2e3e41e188e936a6a46c49e7bcd6aa8d73e4aefae4e0e1143357c4" + }, + { + "path": "packages/lifecycle/test/gate.test.mjs", + "sha256": "0f97063fa4945a7832488306be247689288e4ad5557909324bb811a5811744e1" + }, + { + "path": "packages/ruos/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/ruos/package.json", + "sha256": "3d1fc67c5464789128d370dce35777902cb23aaee90f0bdc844ecfe61e49e328" + }, + { + "path": "packages/ruos/README.md", + "sha256": "e0a845b2fe55e69c41b285c154b096b49c61eab4d0234fe049522ff4761fab4d" + }, + { + "path": "packages/ruos/src/index.d.ts", + "sha256": "780094ec3f3d4ae984b1ccc69f52b84261c42f0749a652df0b8e881878bc697a" + }, + { + "path": "packages/ruos/src/index.js", + "sha256": "0c9a6070bc1b70af58934b47d6b9be0e49ce884eb2839a2e3580118343d31f39" + }, + { + "path": "packages/ruos/test/ruos.test.mjs", + "sha256": "2bfac47783a83a569ebfc3526aea4665949eebcb3f147afeaa3047305e50549c" + }, + { + "path": "packages/search/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/search/package.json", + "sha256": "ba1085c32fe794e9213e0d9b319208d514c1ad12d0f25bffcfa98d586abe7ebc" + }, + { + "path": "packages/search/README.md", + "sha256": "173e7c5449e3c914c9e8c2311fa6959964715cbec0e2bc4799163ee8d0496b4d" + }, + { + "path": "packages/search/src/data.js", + "sha256": "5825e0aea30189d3d808dd2e932fadfe20dedad0df574ae1288b97fa3b339a38" + }, + { + "path": "packages/search/src/index.d.ts", + "sha256": "a28f37a50281e88d31f275dde4ff5f40b90afdf15c6ad9dfe4b4b4b2f6dd947c" + }, + { + "path": "packages/search/src/index.js", + "sha256": "7bce3367ab680b3e377f0b8eeaae6194f25ee38368c7e5e4f51d9f04771df62c" + }, + { + "path": "packages/search/test/search.test.mjs", + "sha256": "215740fd17e384c41f9afe47326bf8cfa07a74a48d0f468c319e2f03e846b11d" + }, + { + "path": "README.md", + "sha256": "9b3782b08bfc29bc07cb41dc54e6e4ec136ee1c65c2bc976616e28f53a2aeef7" + }, + { + "path": "scripts/benchmark.mjs", + "sha256": "a05680d508d739b6dea6e53196cff1efd6f81d3065e5f08eb980d2f19e3ab289" + }, + { + "path": "scripts/huggingface-live.mjs", + "sha256": "aa98b72185421cde24a8d45f2db47937724b1429689943fce3e6a9a7cb32ba46" + }, + { + "path": "scripts/packed-consumer.mjs", + "sha256": "dfcb8b424980a6077ac1b0812a6d165512af1d03846a01cb676fc756af2e5ba7" + }, + { + "path": "scripts/validate.mjs", + "sha256": "7191e7f1952a85417f829accd7a5e04d97c24d1e729c803078f57092e4da686b" + }, + { + "path": "test/browser.test.mjs", + "sha256": "8e8383ab9a9d5f974f936a4e97772b88c1411fa5d9c7635bd794f0f1a4e74b71" + }, + { + "path": "test/consumer.test.mjs", + "sha256": "0c90dff8143b505b6df036d7d6335440ad1dcf62de62fa5e95bc761ed07a3d54" + }, + { + "path": "test/integration.test.mjs", + "sha256": "403ca92aeaf3ea7c0466989c6fba202fcce8b1c594aa1783b39636dc9041ead2" + }, + { + "path": "test/scenario.mjs", + "sha256": "9884b953d21aff57f48e0d06de900679cf7d4c41928b67af0cc0d018d2460c45" + }, + { + "path": "test/types.ts", + "sha256": "fbb5e9c2a990e92a3d38c87c9ec30ea55085ff02e455c4026fc891cb01564678" + }, + { + "path": "tsconfig.json", + "sha256": "daf2b629ec6c113c62f3c4ee10f1e1632d301575f98b11d1fd6013c5ab717b54" + } + ], + "limits": "Local validation only. Source digest excludes generated .artifacts and docs/evidence. This is not a signature or deployment authorization." +} diff --git a/packages/wsp-toolkit/docs/evidence/node-24-validation.json b/packages/wsp-toolkit/docs/evidence/node-24-validation.json new file mode 100644 index 000000000..596dd7041 --- /dev/null +++ b/packages/wsp-toolkit/docs/evidence/node-24-validation.json @@ -0,0 +1,266 @@ +{ + "schema": "ruv-fann.toolkit-validation/1", + "createdAt": "2026-11-11T02:02:59.966Z", + "node": "v24.22.1", + "typecheck": "passed", + "tests": { + "tests": 47, + "pass": 47, + "fail": 0, + "cancelled": 0, + "skipped": 0, + "todo": 0 + }, + "benchmark": { + "schema": "ruv-fann.search-benchmark/1", + "node": "v24.22.1", + "backend": "wasm", + "rows": 32, + "candidateCount": 16, + "repetitions": 9, + "equivalentCandidateHash": "721c85d1df903af2ca8fe07b29bc590e4aff2f5bf4b55291b91f214c9addfd67", + "candidateMSE": 0, + "referenceInferencePasses": 32, + "screenedInferencePasses": 19, + "inferencePassReductionPercent": 40.625, + "referenceMedianMs": 4.855581999999998, + "screenedMedianMs": 1.4889709999999923, + "note": "Identical 16-candidate monotonic one-coordinate sequence. Timing is a local observation; work reduction includes final authoritative baseline/candidate revalidation. Not an accuracy or generalization benchmark." + }, + "audit": { + "vulnerabilities": { + "info": 0, + "low": 0, + "moderate": 0, + "high": 0, + "critical": 0, + "total": 0 + }, + "scope": "all production and development dependencies", + "lockfileSHA256": "0be668c6142857115029469b5e5a4d7581792d99dfe478d4a6fe0e734fcbe3c9" + }, + "sourceTreeSHA256": "da6e9a00dc86d3296b58c963f276df5c6229f6cb0fa42a86db6d8178e55d73ef", + "sourceFiles": [ + { + "path": ".gitignore", + "sha256": "f0511d87b6daff32b51effec85f397ff36e7914c7849880d3d0c1d1c4eba600a" + }, + { + "path": "docs/design.md", + "sha256": "57c6b8f947f6c365a111b6d5052389b53ef2285e1561d81934faefcfa643cb70" + }, + { + "path": "docs/huggingface-source.json", + "sha256": "935e180aaae0f271ab5b01e20c612a221110c39bba94f74b73c6fd028546c2e4" + }, + { + "path": "docs/validation.md", + "sha256": "9a1857d074025719b5a00808b41b3101b2ab5e738aeae74182658dbc07c14051" + }, + { + "path": "package-lock.json", + "sha256": "0be668c6142857115029469b5e5a4d7581792d99dfe478d4a6fe0e734fcbe3c9" + }, + { + "path": "package.json", + "sha256": "91f0b1741ae34914478dc16c8ed8577615f04b7f477564ac42f35a4790d97e9d" + }, + { + "path": "packages/cloudflare/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/cloudflare/package.json", + "sha256": "b7495438311fe4808561548298eb62a29b358756cb20e850190620e648c1460a" + }, + { + "path": "packages/cloudflare/README.md", + "sha256": "f6bcca9a3605a7e9d8276cf22c02670ccbf36314a01dd16dd374c0a0a0a91793" + }, + { + "path": "packages/cloudflare/scripts/build.mjs", + "sha256": "7cadbdf90d4a57ce78166b0b789e36ff0dad3aac0e15c2c6f148ce41785a8269" + }, + { + "path": "packages/cloudflare/src/build.d.ts", + "sha256": "8b24c9683ba896cbd2fa207d8493e280937a6e87e63c81330df5e112c1630cfc" + }, + { + "path": "packages/cloudflare/src/build.js", + "sha256": "173edfd8dc82aeaee140ab216c10d17dfd76105f281d32097388944f2444043f" + }, + { + "path": "packages/cloudflare/src/index.d.ts", + "sha256": "d93c5133c21cd2cfcca7ad620c1c7a538007e23c6c3ed3d3ce059002e7ae4af4" + }, + { + "path": "packages/cloudflare/src/index.js", + "sha256": "1d8cdc902da54f54fa12fc8bc0a60537aaa6fcdfc278a99dd6c911ad0fc9bba7" + }, + { + "path": "packages/cloudflare/src/worker.js", + "sha256": "d93c4088089aa3f16488484017cde5caaf978782ebe2b7c2058a77d40f9fd390" + }, + { + "path": "packages/cloudflare/test/handler.test.mjs", + "sha256": "e45b2209c08b6afaefe5cd0fdb56e4160e165f9d6b91061df6e7c6bb9605f54f" + }, + { + "path": "packages/cloudflare/test/workerd.test.mjs", + "sha256": "8a5664be4b9ace08118af8887d7cab8623bad5f5e90fab28e810b4d9fe47b1b3" + }, + { + "path": "packages/cloudflare/wrangler.jsonc", + "sha256": "7cda0f7788937ccbbd63d250ef11a4d0b98c66b25872dcc02ecbdef807b814bd" + }, + { + "path": "packages/huggingface/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/huggingface/package.json", + "sha256": "c5a92b787ca8631874e0f5ff04d5e132ab4032932d5ed1a996e2a3dab511eea6" + }, + { + "path": "packages/huggingface/README.md", + "sha256": "a78e91609e12a49e74e7a3d3170f9f427da8575f1ac4a4864ded9778d5242775" + }, + { + "path": "packages/huggingface/src/index.d.ts", + "sha256": "cd4129715700e7d5aae1bab3953a5d9df99931e688b3835b26b6207b457f6465" + }, + { + "path": "packages/huggingface/src/index.js", + "sha256": "baf61b469ef682e49b94003ebf5ab2e19a2938fb166891ace145f6dc532329e9" + }, + { + "path": "packages/huggingface/test/hub.test.mjs", + "sha256": "a3f5c794a701b51aebb66d480054cb401ae2ca7ab34f86330f1de8d2889b2450" + }, + { + "path": "packages/lifecycle/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/lifecycle/package.json", + "sha256": "fa434108ddbd96a20ba84e5fdf2e5cd4b95894b50348ff0c2194a762a8d0f573" + }, + { + "path": "packages/lifecycle/README.md", + "sha256": "af428aa418c392e5abcc638d8178ee3a99778ea337e574c744880c1152fd18f1" + }, + { + "path": "packages/lifecycle/src/cli.js", + "sha256": "821c40e837d45bfb5a19911361dc4a60d8cf3e6a2214091a0fe3db266ecd8bb1" + }, + { + "path": "packages/lifecycle/src/index.d.ts", + "sha256": "79186a80097d7e27b1e570f4f898af303b5c2c5a08fa493a829d0c8e416ed957" + }, + { + "path": "packages/lifecycle/src/index.js", + "sha256": "2c8fb836ce2e3e41e188e936a6a46c49e7bcd6aa8d73e4aefae4e0e1143357c4" + }, + { + "path": "packages/lifecycle/test/gate.test.mjs", + "sha256": "0f97063fa4945a7832488306be247689288e4ad5557909324bb811a5811744e1" + }, + { + "path": "packages/ruos/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/ruos/package.json", + "sha256": "3d1fc67c5464789128d370dce35777902cb23aaee90f0bdc844ecfe61e49e328" + }, + { + "path": "packages/ruos/README.md", + "sha256": "e0a845b2fe55e69c41b285c154b096b49c61eab4d0234fe049522ff4761fab4d" + }, + { + "path": "packages/ruos/src/index.d.ts", + "sha256": "780094ec3f3d4ae984b1ccc69f52b84261c42f0749a652df0b8e881878bc697a" + }, + { + "path": "packages/ruos/src/index.js", + "sha256": "0c9a6070bc1b70af58934b47d6b9be0e49ce884eb2839a2e3580118343d31f39" + }, + { + "path": "packages/ruos/test/ruos.test.mjs", + "sha256": "2bfac47783a83a569ebfc3526aea4665949eebcb3f147afeaa3047305e50549c" + }, + { + "path": "packages/search/LICENSE", + "sha256": "50fefb93560af4421369c99c93cc214cd835b3181ab7f16323f9e6f2ded870e3" + }, + { + "path": "packages/search/package.json", + "sha256": "ba1085c32fe794e9213e0d9b319208d514c1ad12d0f25bffcfa98d586abe7ebc" + }, + { + "path": "packages/search/README.md", + "sha256": "173e7c5449e3c914c9e8c2311fa6959964715cbec0e2bc4799163ee8d0496b4d" + }, + { + "path": "packages/search/src/data.js", + "sha256": "5825e0aea30189d3d808dd2e932fadfe20dedad0df574ae1288b97fa3b339a38" + }, + { + "path": "packages/search/src/index.d.ts", + "sha256": "a28f37a50281e88d31f275dde4ff5f40b90afdf15c6ad9dfe4b4b4b2f6dd947c" + }, + { + "path": "packages/search/src/index.js", + "sha256": "7bce3367ab680b3e377f0b8eeaae6194f25ee38368c7e5e4f51d9f04771df62c" + }, + { + "path": "packages/search/test/search.test.mjs", + "sha256": "215740fd17e384c41f9afe47326bf8cfa07a74a48d0f468c319e2f03e846b11d" + }, + { + "path": "README.md", + "sha256": "9b3782b08bfc29bc07cb41dc54e6e4ec136ee1c65c2bc976616e28f53a2aeef7" + }, + { + "path": "scripts/benchmark.mjs", + "sha256": "a05680d508d739b6dea6e53196cff1efd6f81d3065e5f08eb980d2f19e3ab289" + }, + { + "path": "scripts/huggingface-live.mjs", + "sha256": "aa98b72185421cde24a8d45f2db47937724b1429689943fce3e6a9a7cb32ba46" + }, + { + "path": "scripts/packed-consumer.mjs", + "sha256": "dfcb8b424980a6077ac1b0812a6d165512af1d03846a01cb676fc756af2e5ba7" + }, + { + "path": "scripts/validate.mjs", + "sha256": "7191e7f1952a85417f829accd7a5e04d97c24d1e729c803078f57092e4da686b" + }, + { + "path": "test/browser.test.mjs", + "sha256": "8e8383ab9a9d5f974f936a4e97772b88c1411fa5d9c7635bd794f0f1a4e74b71" + }, + { + "path": "test/consumer.test.mjs", + "sha256": "0c90dff8143b505b6df036d7d6335440ad1dcf62de62fa5e95bc761ed07a3d54" + }, + { + "path": "test/integration.test.mjs", + "sha256": "403ca92aeaf3ea7c0466989c6fba202fcce8b1c594aa1783b39636dc9041ead2" + }, + { + "path": "test/scenario.mjs", + "sha256": "9884b953d21aff57f48e0d06de900679cf7d4c41928b67af0cc0d018d2460c45" + }, + { + "path": "test/types.ts", + "sha256": "fbb5e9c2a990e92a3d38c87c9ec30ea55085ff02e455c4026fc891cb01564678" + }, + { + "path": "tsconfig.json", + "sha256": "daf2b629ec6c113c62f3c4ee10f1e1632d301575f98b11d1fd6013c5ab717b54" + } + ], + "limits": "Local validation only. Source digest excludes generated .artifacts and docs/evidence. This is not a signature or deployment authorization." +} diff --git a/packages/wsp-toolkit/docs/evidence/package-archives.json b/packages/wsp-toolkit/docs/evidence/package-archives.json new file mode 100644 index 000000000..b3b47e0e9 --- /dev/null +++ b/packages/wsp-toolkit/docs/evidence/package-archives.json @@ -0,0 +1,37 @@ +[ + { + "name": "ruv-fann-wsp-lifecycle", + "version": "0.1.0", + "filename": "ruv-fann-wsp-lifecycle-0.1.0.tgz", + "bytes": 4474, + "sha256": "24b0d3f4c0acf0097e0ca3b067674700776df27b38d4ba6c8d6e05869a29706e" + }, + { + "name": "ruv-fann-wsp-search", + "version": "0.1.0", + "filename": "ruv-fann-wsp-search-0.1.0.tgz", + "bytes": 8964, + "sha256": "eb9ff647bfe527e4a646164bd0a3492348100181e9cb43511057a91c1749cd79" + }, + { + "name": "ruv-fann-wsp-huggingface", + "version": "0.1.0", + "filename": "ruv-fann-wsp-huggingface-0.1.0.tgz", + "bytes": 6023, + "sha256": "b755144a2865beb8b9a1446c96ed4195f42fea872d6d1c3a9b2020ea85c26775" + }, + { + "name": "ruv-fann-wsp-cloudflare", + "version": "0.1.0", + "filename": "ruv-fann-wsp-cloudflare-0.1.0.tgz", + "bytes": 7106, + "sha256": "172c5120dcccf7224420d34ae0f3f7638a0c075397faa0e35652777d105879a2" + }, + { + "name": "ruv-fann-wsp-ruos", + "version": "0.1.0", + "filename": "ruv-fann-wsp-ruos-0.1.0.tgz", + "bytes": 3755, + "sha256": "f4a773ad61801ca7c7a5f94339fc53516beeddc15a4fb08705c975f367d132d5" + } +] \ No newline at end of file diff --git a/packages/wsp-toolkit/docs/evidence/ruos-validation.json b/packages/wsp-toolkit/docs/evidence/ruos-validation.json new file mode 100644 index 000000000..0ca3e233f --- /dev/null +++ b/packages/wsp-toolkit/docs/evidence/ruos-validation.json @@ -0,0 +1,23 @@ +{ + "schema": "ruv-fann.ruos-validation/1", + "selection": "Work Desktop", + "executor": { + "completionVersion": 1, + "completionVerified": true, + "status": "ok", + "exitCode": 0, + "machineId": "85050dc77130e8" + }, + "stagingDirectory": "/tmp/wsp-toolkit-validation.TK3i2y", + "archiveSHA256": "ce2b501e0905be316fbeecd2e1d05c237b9d5e578735937193de9a9806bdf718", + "transferParts": 13, + "commandsCompleted": [ + "SHA-256-verified archive transfer", + "npm install --ignore-scripts of five candidate tarballs", + "archive digest comparisons and Worker build", + "scalar and SIMD packed integration scenarios", + "live Hugging Face affine head validation" + ], + "runtime": "Node v20.20.2", + "limitations": "Trusted host reports verified exit completion. Application results were compared with local WASM oracles. No cryptographic attestation, run binding or deployment authorization is claimed." +} diff --git a/packages/wsp-toolkit/docs/huggingface-source.json b/packages/wsp-toolkit/docs/huggingface-source.json new file mode 100644 index 000000000..17fcefcae --- /dev/null +++ b/packages/wsp-toolkit/docs/huggingface-source.json @@ -0,0 +1,7 @@ +{ + "repo": "ruv/ruview", + "revision": "544fb5d07c15733a12dbf16c562e73cb7f75eb71", + "path": "presence-head.json", + "sha256": "9a6ddce665dbc1734d837ae38398f387782f5a40bd2ce36bcbe795d083badeaf", + "maxBytes": 16384 +} diff --git a/packages/wsp-toolkit/docs/loop-design.md b/packages/wsp-toolkit/docs/loop-design.md new file mode 100644 index 000000000..dbf54829b --- /dev/null +++ b/packages/wsp-toolkit/docs/loop-design.md @@ -0,0 +1,44 @@ +# Bounded autonomous loop and swarm + +## Outcome and executable acceptance + +Extend the existing toolkit with a runnable local evolution loop: multiple worker threads propose surgical weight changes, an independent coordinator re-evaluates selection and held-out suites plus output invariants, and AgentDB owns durable proposal IDs, compare-and-swap revisions and rollback. The acceptance demo repairs XOR, rejects a tempting local-only candidate using an independent gate, preserves rejected/stale revisions, stops within explicit budgets, reopens durable state and rolls back exactly. This is a present-day bounded implementation; no physical neuromorphic hardware, universal alignment proof, public registry publication, provider call or financial action is in scope. + +## Ownership + +- Registry worker owns `packages/registry/**` and `tooling/agentdb/**`: AgentDB capability adapter, real fixture installer/lockfile and integration tests. Package name `ruv-fann-wsp-registry@0.1.0`. +- Swarm worker owns `packages/swarm/**`: fixed-operation worker threads and bounded scheduler. Package name `ruv-fann-wsp-swarm@0.1.0`. +- Invariants worker owns `packages/invariants/**`: real WASM finite-domain output constraints. Package name `ruv-fann-wsp-invariants@0.1.0`. +- Coordinator owns `packages/loop/**`, root manifests/lockfiles, scripts, E2E, examples, docs and integration. Package name `ruv-fann-wsp-loop@0.1.0`. + +No overlapping edits. All libraries ESM with public src/index.js and src/index.d.ts, README, MIT LICENSE and test/*.test.mjs. Runtime dependency WSP exact 0.2.0; sibling packages 0.1.0. No worker edits toolkit root lockfile. Existing uncommitted toolkit work is retained. + +## Shared interfaces + +### Registry + +`createAgentDBRegistry(programs, {flush?, close?}?)` receives a real AgentDB WeightPrograms capability (AgentDB 3.10.0); wrapper returns promise methods `create(id,model)`, `get(id)`, `list(limit?)`, `propose(id,patch,dataset,policy)`, `promote(id,proposalId,expectedRevision)`, `rollback(id,targetRevision,expectedRevision)`, `close()`. Serialize mutations across awaits. Snapshot inputs before queueing; do not accept caller-authored receipts as promotion authority. Flush durable mutations before acknowledging. Failed flush poisons mutations until reopen; report failure. Accessors/getters/unknown arguments/bounds must fail safely. AgentDB is an optional peer, not auto-installed by the library. + +`tooling/agentdb/package.json` pins agentdb 3.10.0, private, with its own lockfile and `.npmrc` omitting optional dependencies to avoid unrelated native/model packages. `tooling/agentdb/runtime.mjs` exports `openDemoRegistry(filename)` using the real package's WeightPrograms and db-fallback, with explicit flush/close. Root setup command will run npm ci in this fixture; tests must fail with actionable error if absent, never silently skip. Node 20.9+ runtime; do not mutate process-wide environment. + +### Swarm + +`runProposalSwarm(jobs, {concurrency?, timeoutMs?, signal?}?)` runs fixed trusted library code in actual Node worker_threads. Each job has `{id, kind:'search', model, dataset, policy, searchOptions}` or `{id, kind:'patch', patch}`. Search uses ruv-fann-wsp-search with real WASM; patch simply transports an untrusted candidate. Result shape per input order: `{id,status:'ok'|'error'|'timeout'|'cancelled', patch?:WeightPatch|null, workerThreadId?:number, search?:{evaluations,inferencePasses,reservedWork,backend}, error?:string}`. SearchOptions are data-only: objective callbacks disallowed in workers. Hard caps <=4 concurrent workers, <=64 jobs, <=10MiB aggregate JSON, <=60000ms per job, aggregate candidate-work cap. Snapshot all inputs before awaits, validate IDs and options, bound error text, terminate and await every worker on all paths. Worker threads are not a security sandbox. Unknown operations/code/shell/functions refused. Coordinator distrusts all worker results and recomputes authoritative evidence. + +### Invariants + +`checkModelInvariants(model, suite, {simd?}?)` uses real WASM and returns `{schema:'ruv-fann.invariant-check/1', modelHash, suiteHash, accepted, checks, violations, backend, work}`. Suite shape `{schema:'ruv-fann.invariants/1', cases:[{name,inputs,rows,minimum?:number[],maximum?:number[],expected?:number[],tolerance?:number}]}`; bounds are per-output; expected is flattened row-major. At least one constraint per case. Bounds/exact shapes, finite numbers, source ownership, cumulative work <=1e7 and all rows <=1024. `createBooleanInvariant({inputs,outputs,targets,tolerance?})` emits a suite covering every binary input (1..6 input bits); returned case name `boolean-domain`. Finite-domain evidence is not a proof over all real inputs or cryptographic alignment. No arbitrary callbacks. + +### Loop coordinator + +Expose a bounded `runEvolutionLoop` driven by trusted module configuration and an injected registry. Each generation snapshots a module's active revision; dispatches immutable worker proposals; independently applies/checks each patch against trusted suites and invariants; ranks only comparable accepted candidates; re-proposes the selected candidate inside AgentDB; promotes using its internal ID and original expected revision. Worker receipts never authorize promotion. Stale state is rejected without overwriting newer state. Loss must improve by a configured threshold. Max rounds, proposals, aggregate work, workers, deadlines and AbortSignal bound the run; failures are visible and leave live checkpoints unchanged. No provider requests or automatic public publication. Durable models/history can resume from AgentDB; counters describe each invocation, not a global metering service. + +## Success and failure walks + +Success: broken XOR r1 → two search workers → two-weight candidate → held-out/exhaustive constraints → AgentDB proposal → CAS promote r2 → reopen r2 → rollback to r1 content as r3. + +Failure: a candidate fitting the development slice fails held-out/output constraints → record rejection in loop report → no promote. A revision changed by another coordinator before promotion causes a stale result, never an overwrite. Worker timeout/abort terminates the worker and prevents later results from committing. A durability failure cannot be reported as a successful promotion. + +## Architecture decisions and limitations + +Use fixed-operation Node workers for real concurrent execution and separate WASM instances; use platform subagents only to build/review this implementation. Keep AgentDB's large optional dependency tree in a separate pinned integration fixture; the registry library accepts a caller-owned real controller. No mocked database success is called persistence evidence. Hosted runtime connectors are currently unavailable; no remote execution is inferred from coordination records. Universal verification, learned semantic routing, code-generation providers, npm publication and physical actuation remain explicit extensions requiring their own contracts. diff --git a/packages/wsp-toolkit/docs/loop-validation.md b/packages/wsp-toolkit/docs/loop-validation.md new file mode 100644 index 000000000..a7a597d87 --- /dev/null +++ b/packages/wsp-toolkit/docs/loop-validation.md @@ -0,0 +1,58 @@ +# Autonomous loop qualification + +The implementation adds four local packages to the original five-package toolkit: `invariants`, `swarm`, `registry`, and `loop`, each version 0.1.0. The selected architecture and control-flow contract are in [loop-design.md](loop-design.md). Existing uncommitted toolkit work and the core WSP API are preserved. + +## Run + +```sh +cd packages/wsp-toolkit +npm ci --ignore-scripts --no-audit --no-fund +npm run setup:agentdb +npx --no-install playwright install --with-deps chromium +npm run validate +npm run demo:loop +``` + +Setup explicitly installs the separate locked AgentDB runtime with optional dependencies omitted. The library never auto-installs anything. `validate` requires strict declarations, zero failed/cancelled/skipped/todo tests, the original numerical optimization benchmark and clean audits of both installed dependency trees. It records source-file and both lockfile digests in `.artifacts/validation.json`. CI installs the same fixture explicitly before qualification. + +## Requirement-to-evidence trace + +| Requirement | Executable evidence | Acceptance | +| --- | --- | --- | +| Actual concurrent proposal agents | `packages/swarm/test/swarm.test.mjs` | Distinct overlapping worker threads, bounded concurrency, real scalar/SIMD WASM; fixed operations only | +| Autonomous proposal/evaluation/selection/promotion | `packages/loop/test/loop.test.mjs`, `test/evolution-scenario.mjs` | Two models repaired, three development-only shortcuts independently rejected, fresh stored AgentDB proposal IDs authorize commits | +| Continuous bounded generations | `loop.test.mjs` | Successive proposals bind revisions 1 and 2; accepted updates reach revision 3 without reusing a stale base | +| Independent output constraints | `packages/invariants/test/invariants.test.mjs` | Exhaustive small Boolean-domain and affine oracles, inclusive bounds, finite outputs, scalar/SIMD agreement | +| Valid criteria before dispatch | Invariant work estimator and loop validation tests | Invalid names, shapes, tolerance use and budgets reject as configuration errors rather than candidate quality | +| Persistent state and revision history | `packages/registry/test/registry.test.mjs` | Actual AgentDB/sql.js create/propose/promote/rollback and close/reopen, preserved hashes and monotonic history | +| Concurrent revision authority | Registry and loop tests | Exactly one competing promotion succeeds; same-hash revision changes still invalidate stale CAS | +| Correct goal tracking under interference | Loop two-module rollback test | External rollback clears cached goal evidence; active state is refreshed before declaring goals met | +| Failed durability acknowledgement | Real-controller flush tests | Controller mutates memory, disk flush fails, run rejects, registry is poisoned; reopen recovers the persisted checkpoint | +| Cancellation and resource bounds | Swarm and loop tests | Per-job deadline/AbortSignal cleanup, no queued work after abort, bounded pending operations, conservative cumulative inference reservations | +| Installed package boundaries | `test/consumer.test.mjs` | Nine tarballs installed in a fresh consumer, strict TypeScript, Worker build, original scenarios and complete evolution/restart/rollback scenario | +| Existing edge compatibility | Original Chromium and workerd tests | Existing browser/Cloudflare operations still run actual WASM; the Node-only loop is not bundled into them | +| Supply-chain qualification | `scripts/validate.mjs` | Root audit and isolated AgentDB installed-tree audit report zero known advisories | + +The loop-specific suite contains 47 tests: 14 invariants, 10 swarm, 8 registry and 15 coordinator tests. The integrated workspace contains 94 tests, including the original 47. Final Node 22/24 receipts are saved separately under `docs/evidence/loop-node-*-validation.json`; initial five-package receipts remain historical evidence. Live Hub/ruOS results from the earlier task apply to the original packages and are not presented as a remote run of this loop. + +## Demonstrated loop + +The development slice for XOR contains one input. A search worker changes a single useful output edge and another changes the output bias; both fit that slice, and both fail the protected full-domain suite. A separate two-edge symbolic proposal passes the exhaustive XOR constraints. The linear task similarly rejects a constant-output shortcut and accepts the useful weight update. The coordinator promotes both passing checkpoints through AgentDB, then the demo reopens the database, verifies exact hashes/revisions, rolls back both to original content at revision 3, and reopens again. + +The demo uses five real job threads with concurrency three, reserves 596 parameter-row work units, and makes two promotions in one generation. A separate test requires two generations to reach a goal. Worker-startup and elapsed-time observations are not nanosecond or zero-latency claims. The fixture is synthetic; it does not establish task generalization or useful adaptation on arbitrary models. + +## Trust boundaries and review + +Proposer → coordinator: only fixed search operations and candidate JSON cross worker boundaries. Worker-reported losses are diagnostic; the coordinator recomputes acceptance with real WASM. Neither held-out datasets nor acceptance rules are sent to workers. Input trees are bounded snapshots; functions, getters, unknown fields and executable payloads reject. + +Coordinator → registry: every candidate binds the source model hash, independent dataset/policy hashes and invariant suite hash. A fresh AgentDB evaluation creates an internal proposal ID, and expected-revision CAS controls activation. The adapter serializes operations, flushes acknowledged mutations, detects stale SQLJS writers, and blocks reads/writes after uncertain persistence. Atomic commits already entered are awaited; abort cannot retroactively undo a committed transaction. Injected registry I/O requires its own operational timeouts. Budgets apply per invocation; multiple coordinators need an external shared budget authority. + +Review reproduced and fixed malformed holdout-name and invariant preflight behavior, inaccurate same-hash revision reporting, cached-goal false success after a competing rollback, and cancellation during the final state refresh. Regression tests use actual AgentDB mutations. A stronger persistence test forces a failure after the real promotion transaction, verifies the error reaches the loop, and verifies the original disk checkpoint on reopen. + +The AgentDB capability is a local trusted dependency, not an identity or authorization boundary against arbitrary code in the same process. Node workers provide separate execution contexts and WASM instances; they are not hardened sandboxes. Finite-domain constraints and SHA-256 bindings are not universal alignment proofs, signatures or publication authorization. Continuous mutation does not imply globally safe composition. + +## Live tool and integration scope + +The cloud executor is current and available. Live Ruflo and AgentDB runtime connector probes returned internal errors, so no execution or persistence is attributed to those connectors. Platform subagents performed the engineering work; the implementation itself uses real local Node workers and real `agentdb@3.10.0` with sql.js. The fixture omits optional native drivers, embedding/model packages and telemetry integrations. No provider credentials are copied, no model downloaded, and no external agent jobs or public federation messages are started. + +RuVector semantic retrieval, MetaHarness/Agentic Flow routing, generated source packages, public npm publication, hardware actuation, cryptographic alignment guarantees and autonomous financial contracting remain outside this implementation. The adapter/capability boundaries leave room for those integrations without pretending that absent runtimes executed them. diff --git a/packages/wsp-toolkit/docs/validation.md b/packages/wsp-toolkit/docs/validation.md new file mode 100644 index 000000000..1b93477a5 --- /dev/null +++ b/packages/wsp-toolkit/docs/validation.md @@ -0,0 +1,47 @@ +# Initial five-package validation evidence + +This records the original five-package qualification. The expanded nine-package loop is documented in [loop validation](loop-validation.md); its source-bound receipts are separate from the initial records below. + +The toolkit was implemented against `ruvnet/ruv-FANN` base commit `4ae155ad300e92fb38bb234bce514e24da2f3cdc` on branch `feat/wsp-toolkit`. Candidate versions are 0.1.0. This is validation of the new workspace, not a release qualification of every native/swarm component in the repository. + +## Requirement-to-evidence trace + +| Requirement | Executable evidence | Result | +| --- | --- | --- | +| Preserve core patch, diagnostics and lifecycle behavior | `npm test --prefix packages/wsp` from repository root | 37 passed, zero skips | +| Subpackage contracts, bounds, snapshots and failures | `npm run test:unit` | 42 passed, zero skips | +| End-to-end repair, regression rejection, branching and rollback | `test/integration.test.mjs`, `test/scenario.mjs` | Real scalar/SIMD WASM; XOR MSE 0.5 → 0, ablation MSE 0.25 rejected, rollback revision 3 | +| Browser/edge adaptation | `test/browser.test.mjs` | Real Chromium 141.0.7390.37; both WASM backends | +| Cloudflare compatibility | `packages/cloudflare/test/workerd.test.mjs` | Real `workerd@1.20260730.1`; static scalar/SIMD WASM, auth and HTTP failures | +| Published-package shape | `test/consumer.test.mjs` | All five tarballs installed into fresh consumer; strict types, real WASM scenarios and Worker build | +| Public Hub checkpoint transport | `npm run test:hub:live`, [source pin](huggingface-source.json), [result](evidence/huggingface-live.json) | Live 2,619-byte affine head, 129 parameters; digest pinned; oracle error 1.78e-15 | +| ruOS execution | [host completion summary](evidence/ruos-validation.json), [tested archive hashes](evidence/package-archives.json) | Observed Work Desktop, Node 20.20.2; five archives verified; Worker build; scalar/SIMD lifecycle and live Hub check passed | +| Bounded optimization | `npm run benchmark` | Same selected candidate, 19 versus 32 inference passes (40.625% fewer), zero final MSE | +| Dependency security | `npm run audit`, `npm run validate` | Zero known advisories in full locked tree after pinned Miniflare dependency fixes | +| Repeatable qualification | `.github/workflows/wsp-toolkit.yml` | Node 22.13/24.22 matrix configured; not yet run on GitHub | + +The full new-suite count is 47 tests: 42 package tests, one browser test, one packed-consumer test and three integration/CLI tests. `npm run validate` additionally requires a strict declaration check, zero cancelled/skipped/todo tests, benchmark equality and a clean npm audit. It writes `.artifacts/validation.json` with exact source and lockfile hashes. Captured local qualification reports are stored under `docs/evidence` after final execution; these are evidence records, not signatures. + +## What the platform evidence establishes + +Cloudflare's connected plugin successfully supplied documentation and a read of the authorized account. No Worker or account configuration was changed. Runtime testing is local Cloudflare `workerd`, not a hosted Cloudflare deployment. Miniflare is a development runtime and is not used as an isolation boundary for untrusted code. + +Hugging Face's connected identity read succeeded. Its advertised model/dataset/documentation discovery methods returned `UNAVAILABLE`; discovery and the live file fetch used the public Hub HTTP API instead. Both this cloud workspace and ruOS fetched the same immutable revision and file digest. Hub validation explicitly maps a public weight vector to an affine layer; synthetic arithmetic tests do not establish accuracy on the source model's real sensing task. The Hub unit tests and the main integration scenario also contain clearly labeled synthetic fetch fixtures, separate from live evidence. + +ruOS's live desktop/fleet reads identified the active Work Desktop. A harmless Node/npm/git probe established its executor route. Candidate tarballs were transferred into a unique temporary directory, verified against the cloud archive SHA-256 and per-package manifest, and installed without lifecycle scripts. Host-owned structured responses reported completion version 1, verified true, status ok and integer exit 0 for the actual validation commands. Local and remote checkpoint hashes and numerical results agreed. The helper and this report do not claim cryptographic attestation or independent proof of remote assertions. Desktop output was short and complete enough to inspect; missing optional completeness fields are not treated as an affirmative completeness attestation. + +## Security review and changes + +Trust boundaries reviewed: local callback → search, untrusted JSON → WASM, public Hub response → model, HTTP caller → Worker, and remote executor → completion consumer. Model/data/patch limits, cumulative work budgets, pre-await copies, finite metrics, no generated code evaluation, explicit promotion and hash/revision comparisons remain enforced. + +Review reproduced and fixed a FIFO input hang in the CLI by opening nonblocking before checking for a regular file, and malformed truncation/timeout flags in the completion checker by requiring absent or false flags. Regression tests exercise both. The Worker defaults to denying operations without its bearer secret, refuses unknown routes/fields, and bounds streamed bytes even with fragmented or misleading content lengths. The Hub loader requires commit and raw digest pins, rejects external redirects, bounds downloads and validates model structure before use. + +The full dependency audit initially flagged Miniflare's pinned `sharp@0.35.2` and `undici@7.28.0`. The isolated qualification workspace now overrides those development dependencies to `sharp@0.35.5` and `undici@7.30.1`. Real workerd tests were rerun after the overrides. Production dependencies were already clean. The npm audit result is a point-in-time advisory-feed check, not a general security certification. + +## Performance interpretation + +The benchmark evaluates the identical sequence of sixteen monotonically improving single-coordinate candidates. Its reference calls the original WSP baseline-plus-candidate evaluator for every proposal (32 inference passes). Search caches its initial baseline, screens each candidate once, and finally performs the original authoritative two-pass evaluation (19 total). Warm-up is excluded; nine repetitions alternate execution order. It requires an identical candidate hash and zero final loss. Local median times are recorded in the qualification JSON and may vary; the deterministic result is the reduced inference count. This small controlled case does not measure task accuracy, arbitrary-model repair success or generalization. + +## Remaining boundaries + +Packages are prepared and packed, not published to npm. CI is authored but has not executed on GitHub. No hosted Worker was deployed, no Hub model uploaded, and no production checkpoint promoted. Applications must choose appropriate held-out data, provide production authentication/durable state where needed, bound concurrent calls and keep trusted callback execution within their own security boundary. Experimental Boolean compilation, Hebbian proposals and branching remain explicitly scoped to small dense models. diff --git a/packages/wsp-toolkit/package-lock.json b/packages/wsp-toolkit/package-lock.json new file mode 100644 index 000000000..718e10b53 --- /dev/null +++ b/packages/wsp-toolkit/package-lock.json @@ -0,0 +1,1714 @@ +{ + "name": "ruv-fann-wsp-toolkit", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "ruv-fann-wsp-toolkit", + "version": "0.1.0", + "workspaces": [ + "packages/*" + ], + "dependencies": { + "ruv-fann-wsp": "0.2.0" + }, + "devDependencies": { + "esbuild": "0.28.2", + "miniflare": "4.20260730.0", + "playwright": "1.56.1", + "typescript": "5.9.3" + }, + "engines": { + "node": ">=22.13.0" + } + }, + "node_modules/@cloudflare/workerd-darwin-64": { + "version": "1.20260730.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20260730.1.tgz", + "integrity": "sha512-+MBHmPaiTe2KajryW0T24rZvWFxb41hD3d8anNzQqHzft6vSEb18+sp0znSwxgij7ApPhSM1+vhkNg4f3YMguA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-darwin-arm64": { + "version": "1.20260730.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20260730.1.tgz", + "integrity": "sha512-SBHKntPkKvNPgaCrTe99xC1CAl8ygJDzlYfK0LbuJ1muKadIw35WnhO0wu894fKBtllsVQdNzDLee+cm0ppLSQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-linux-64": { + "version": "1.20260730.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20260730.1.tgz", + "integrity": "sha512-ouyPOSMbiKPeSwUJUvxtMcxGAXs2J4aPE4T5ABIYX5ClcQx5j5bbHTmnqOQEY8sAuLTPjH7dY+iB6UI5ISlwwA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-linux-arm64": { + "version": "1.20260730.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20260730.1.tgz", + "integrity": "sha512-YQ+Mi78U3TPdgBPtwq+Sm6rJU+Ihl2y0pjYtuuKkdmUbYzL7oLR6Xqq9wljhasnuCFICssDJaqhMep5WizYoEQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cloudflare/workerd-windows-64": { + "version": "1.20260730.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20260730.1.tgz", + "integrity": "sha512-27fAN+vUECW1oYVc1KOcHYpkL8COM2Uxtxql7TL595kxbjoqS5yckw7NLz7bTf2pALFCZWjqXDjZGJ/xbG4ZKQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz", + "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", + "cpu": [ + "mips64el" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/colour": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz", + "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.5.tgz", + "integrity": "sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.5.tgz", + "integrity": "sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-freebsd-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.5.tgz", + "integrity": "sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "dependencies": { + "@img/sharp-wasm32": "0.35.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.4.tgz", + "integrity": "sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.4.tgz", + "integrity": "sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.4.tgz", + "integrity": "sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.4.tgz", + "integrity": "sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-ppc64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.4.tgz", + "integrity": "sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-riscv64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.4.tgz", + "integrity": "sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.4.tgz", + "integrity": "sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.4.tgz", + "integrity": "sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.4.tgz", + "integrity": "sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.4.tgz", + "integrity": "sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.5.tgz", + "integrity": "sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.5.tgz", + "integrity": "sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-ppc64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.5.tgz", + "integrity": "sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-ppc64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-riscv64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.5.tgz", + "integrity": "sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-riscv64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.5.tgz", + "integrity": "sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.5.tgz", + "integrity": "sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.5.tgz", + "integrity": "sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.5.tgz", + "integrity": "sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.5.tgz", + "integrity": "sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==", + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.11.3" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-webcontainers-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.5.tgz", + "integrity": "sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@img/sharp-wasm32": "0.35.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.5.tgz", + "integrity": "sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.5.tgz", + "integrity": "sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.5.tgz", + "integrity": "sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@poppinss/colors": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@poppinss/colors/-/colors-4.1.6.tgz", + "integrity": "sha512-H9xkIdFswbS8n1d6vmRd8+c10t2Qe+rZITbbDHHkQixH5+2x1FDGmi/0K+WgWiqQFKPSlIYB7jlH6Kpfn6Fleg==", + "dev": true, + "license": "MIT", + "dependencies": { + "kleur": "^4.1.5" + } + }, + "node_modules/@poppinss/dumper": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/@poppinss/dumper/-/dumper-0.6.5.tgz", + "integrity": "sha512-NBdYIb90J7LfOI32dOewKI1r7wnkiH6m920puQ3qHUeZkxNkQiFnXVWoE6YtFSv6QOiPPf7ys6i+HWWecDz7sw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@poppinss/colors": "^4.1.5", + "@sindresorhus/is": "^7.0.2", + "supports-color": "^10.0.0" + } + }, + "node_modules/@poppinss/exception": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@poppinss/exception/-/exception-1.2.3.tgz", + "integrity": "sha512-dCED+QRChTVatE9ibtoaxc+WkdzOSjYTKi/+uacHWIsfodVfpsueo3+DKpgU5Px8qXjgmXkSvhXvSCz3fnP9lw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@sindresorhus/is": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-7.2.0.tgz", + "integrity": "sha512-P1Cz1dWaFfR4IR+U13mqqiGsLFf1KbayybWwdd2vfctdV6hDpUkgCY0nKOLLTMSoRd/jJNjtbqzf13K8DCCXQw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@speed-highlight/core": { + "version": "1.2.24", + "resolved": "https://registry.npmjs.org/@speed-highlight/core/-/core-1.2.24.tgz", + "integrity": "sha512-qeW2e1l78afw8VhRPfPQ1Gjj+KU5XFQ/OFV5ti6eTa9bruO7mJyZtA4vw0ofqmA3tKCkROE9xLk3VZoeRc98nw==", + "dev": true, + "license": "CC0-1.0" + }, + "node_modules/cookie": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", + "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/error-stack-parser-es": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/error-stack-parser-es/-/error-stack-parser-es-1.0.5.tgz", + "integrity": "sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/esbuild": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + } + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/kleur": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/miniflare": { + "version": "4.20260730.0", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-4.20260730.0.tgz", + "integrity": "sha512-1Z9SB9r/o//80UA02Re3QhtcecSHAyAjf5EcKBfQVlQrCg7Miy79hl2PvtkwFLIaJ5rcrOPdDcRr577okwZPsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-support": "0.8.1", + "sharp": "0.35.2", + "undici": "7.28.0", + "workerd": "1.20260730.1", + "ws": "8.21.0", + "youch": "4.1.0-beta.10" + }, + "bin": { + "miniflare": "bootstrap.js" + }, + "engines": { + "node": ">=22.0.0" + } + }, + "node_modules/playwright": { + "version": "1.56.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.56.1.tgz", + "integrity": "sha512-aFi5B0WovBHTEvpM3DzXTUaeN6eN0qWnTkKx4NQaH4Wvcmc153PdaY2UBdSYKaGYw+UyWXSVyxDUg5DoPEttjw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright-core": "1.56.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, + "node_modules/playwright-core": { + "version": "1.56.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.56.1.tgz", + "integrity": "sha512-hutraynyn31F+Bifme+Ps9Vq59hKuUCz7H1kDOcBs+2oGguKkWTU50bBWrtz34OUWmIwpBTWDxaRPXrIXkgvmQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/ruv-fann": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ruv-fann/-/ruv-fann-0.1.2.tgz", + "integrity": "sha512-gdHjT8EUz4tSPpBYkCjbpISwW7bcB5XvtDPeRqZps8M9DcDF+I3deiIBt9aw6hxqKphrnbzQSltiFYLUYc0vjQ==", + "license": "MIT", + "dependencies": { + "ruv-fann-wasm": "0.1.2" + }, + "engines": { + "node": ">=20.9.0" + } + }, + "node_modules/ruv-fann-wasm": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ruv-fann-wasm/-/ruv-fann-wasm-0.1.2.tgz", + "integrity": "sha512-wV0xT+yMoidjs6ndeTkTO0rNUiDAZ4H7aP6slbVbdM1vG3xS6iCS1/jDwknNBo+m37GBXN4kgFXHZ0yRmMP7oQ==", + "license": "MIT", + "engines": { + "node": ">=20.9.0" + } + }, + "node_modules/ruv-fann-wsp": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/ruv-fann-wsp/-/ruv-fann-wsp-0.2.0.tgz", + "integrity": "sha512-vCHGNiMUuxvCycd58gIOdlXTy1e2Tw6J1MD3FV9ri2ljkS534sk90c3h2mS4bBJozpebQu/fB6iDwKvdp09xIQ==", + "license": "MIT", + "dependencies": { + "ruv-fann": "0.1.2" + }, + "engines": { + "node": ">=20.9.0" + } + }, + "node_modules/ruv-fann-wsp-cloudflare": { + "resolved": "packages/cloudflare", + "link": true + }, + "node_modules/ruv-fann-wsp-huggingface": { + "resolved": "packages/huggingface", + "link": true + }, + "node_modules/ruv-fann-wsp-invariants": { + "resolved": "packages/invariants", + "link": true + }, + "node_modules/ruv-fann-wsp-lifecycle": { + "resolved": "packages/lifecycle", + "link": true + }, + "node_modules/ruv-fann-wsp-loop": { + "resolved": "packages/loop", + "link": true + }, + "node_modules/ruv-fann-wsp-registry": { + "resolved": "packages/registry", + "link": true + }, + "node_modules/ruv-fann-wsp-ruos": { + "resolved": "packages/ruos", + "link": true + }, + "node_modules/ruv-fann-wsp-search": { + "resolved": "packages/search", + "link": true + }, + "node_modules/ruv-fann-wsp-swarm": { + "resolved": "packages/swarm", + "link": true + }, + "node_modules/ruvnet-constellation": { + "resolved": "packages/constellation", + "link": true + }, + "node_modules/ruvnet-constellation-contracts": { + "resolved": "packages/contracts", + "link": true + }, + "node_modules/ruvnet-constellation-telemetry": { + "resolved": "packages/telemetry", + "link": true + }, + "node_modules/semver": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.6.tgz", + "integrity": "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sharp": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.5.tgz", + "integrity": "sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@img/colour": "^1.1.0", + "detect-libc": "^2.1.2", + "semver": "^7.8.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.35.5", + "@img/sharp-darwin-x64": "0.35.5", + "@img/sharp-freebsd-wasm32": "0.35.5", + "@img/sharp-libvips-darwin-arm64": "1.3.4", + "@img/sharp-libvips-darwin-x64": "1.3.4", + "@img/sharp-libvips-linux-arm": "1.3.4", + "@img/sharp-libvips-linux-arm64": "1.3.4", + "@img/sharp-libvips-linux-ppc64": "1.3.4", + "@img/sharp-libvips-linux-riscv64": "1.3.4", + "@img/sharp-libvips-linux-s390x": "1.3.4", + "@img/sharp-libvips-linux-x64": "1.3.4", + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4", + "@img/sharp-libvips-linuxmusl-x64": "1.3.4", + "@img/sharp-linux-arm": "0.35.5", + "@img/sharp-linux-arm64": "0.35.5", + "@img/sharp-linux-ppc64": "0.35.5", + "@img/sharp-linux-riscv64": "0.35.5", + "@img/sharp-linux-s390x": "0.35.5", + "@img/sharp-linux-x64": "0.35.5", + "@img/sharp-linuxmusl-arm64": "0.35.5", + "@img/sharp-linuxmusl-x64": "0.35.5", + "@img/sharp-webcontainers-wasm32": "0.35.5", + "@img/sharp-win32-arm64": "0.35.5", + "@img/sharp-win32-ia32": "0.35.5", + "@img/sharp-win32-x64": "0.35.5" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/supports-color": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-10.2.2.tgz", + "integrity": "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/tslib": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz", + "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==", + "dev": true, + "license": "0BSD", + "optional": true + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici": { + "version": "7.30.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.30.1.tgz", + "integrity": "sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.18.1" + } + }, + "node_modules/workerd": { + "version": "1.20260730.1", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20260730.1.tgz", + "integrity": "sha512-zmfNIjwYSWFY5chGBOjWtH3xAE7p97FTC6vR4Ep98290ho6AeAR/NVcBD274YCLEUYzqm8yxdtZlxMybU8a3jA==", + "dev": true, + "hasInstallScript": true, + "license": "Apache-2.0", + "bin": { + "workerd": "bin/workerd" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "@cloudflare/workerd-darwin-64": "1.20260730.1", + "@cloudflare/workerd-darwin-arm64": "1.20260730.1", + "@cloudflare/workerd-linux-64": "1.20260730.1", + "@cloudflare/workerd-linux-arm64": "1.20260730.1", + "@cloudflare/workerd-windows-64": "1.20260730.1" + } + }, + "node_modules/ws": { + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz", + "integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/youch": { + "version": "4.1.0-beta.10", + "resolved": "https://registry.npmjs.org/youch/-/youch-4.1.0-beta.10.tgz", + "integrity": "sha512-rLfVLB4FgQneDr0dv1oddCVZmKjcJ6yX6mS4pU82Mq/Dt9a3cLZQ62pDBL4AUO+uVrCvtWz3ZFUL2HFAFJ/BXQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@poppinss/colors": "^4.1.5", + "@poppinss/dumper": "^0.6.4", + "@speed-highlight/core": "^1.2.7", + "cookie": "^1.0.2", + "youch-core": "^0.3.3" + } + }, + "node_modules/youch-core": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/youch-core/-/youch-core-0.3.3.tgz", + "integrity": "sha512-ho7XuGjLaJ2hWHoK8yFnsUGy2Y5uDpqSTq1FkHLK4/oqKtyUU1AFbOOxY4IpC9f0fTLjwYbslUz0Po5BpD1wrA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@poppinss/exception": "^1.2.2", + "error-stack-parser-es": "^1.0.5" + } + }, + "packages/cloudflare": { + "name": "ruv-fann-wsp-cloudflare", + "version": "0.1.0", + "license": "MIT", + "dependencies": { + "esbuild": "0.28.2", + "ruv-fann-wasm": "0.1.2", + "ruv-fann-wsp": "0.2.0" + }, + "engines": { + "node": ">=20.9.0" + } + }, + "packages/constellation": { + "name": "ruvnet-constellation", + "version": "0.1.0", + "license": "MIT", + "dependencies": { + "ruvnet-constellation-contracts": "0.1.0" + }, + "bin": { + "constellation": "src/cli.js" + }, + "engines": { + "node": ">=20.9.0" + } + }, + "packages/contracts": { + "name": "ruvnet-constellation-contracts", + "version": "0.1.0", + "license": "MIT", + "engines": { + "node": ">=20.9.0" + } + }, + "packages/huggingface": { + "name": "ruv-fann-wsp-huggingface", + "version": "0.1.0", + "license": "MIT", + "dependencies": { + "ruv-fann-wsp": "0.2.0" + }, + "engines": { + "node": ">=20.9.0" + } + }, + "packages/invariants": { + "name": "ruv-fann-wsp-invariants", + "version": "0.1.0", + "license": "MIT", + "dependencies": { + "ruv-fann": "0.1.2", + "ruv-fann-wsp": "0.2.0" + }, + "engines": { + "node": ">=20.9.0" + } + }, + "packages/lifecycle": { + "name": "ruv-fann-wsp-lifecycle", + "version": "0.1.0", + "license": "MIT", + "dependencies": { + "ruv-fann-wsp": "0.2.0" + }, + "bin": { + "wsp-gate": "src/cli.js" + }, + "engines": { + "node": ">=20.9.0" + } + }, + "packages/loop": { + "name": "ruv-fann-wsp-loop", + "version": "0.1.0", + "license": "MIT", + "dependencies": { + "ruv-fann-wsp": "0.2.0", + "ruv-fann-wsp-invariants": "0.1.0", + "ruv-fann-wsp-lifecycle": "0.1.0", + "ruv-fann-wsp-swarm": "0.1.0" + }, + "engines": { + "node": ">=20.9.0" + } + }, + "packages/registry": { + "name": "ruv-fann-wsp-registry", + "version": "0.1.0", + "license": "MIT", + "dependencies": { + "ruv-fann-wsp": "0.2.0" + }, + "engines": { + "node": ">=20.9.0" + }, + "peerDependencies": { + "agentdb": "3.10.0" + }, + "peerDependenciesMeta": { + "agentdb": { + "optional": true + } + } + }, + "packages/ruos": { + "name": "ruv-fann-wsp-ruos", + "version": "0.1.0", + "license": "MIT", + "dependencies": { + "ruv-fann-wsp": "0.2.0" + }, + "engines": { + "node": ">=20.9.0" + } + }, + "packages/search": { + "name": "ruv-fann-wsp-search", + "version": "0.1.0", + "license": "MIT", + "dependencies": { + "ruv-fann": "0.1.2", + "ruv-fann-wsp": "0.2.0" + }, + "engines": { + "node": ">=20.9.0" + } + }, + "packages/swarm": { + "name": "ruv-fann-wsp-swarm", + "version": "0.1.0", + "license": "MIT", + "dependencies": { + "ruv-fann-wsp": "0.2.0", + "ruv-fann-wsp-search": "0.1.0" + }, + "engines": { + "node": ">=20.9.0" + } + }, + "packages/telemetry": { + "name": "ruvnet-constellation-telemetry", + "version": "0.1.0", + "license": "MIT", + "engines": { + "node": ">=20.9.0" + } + } + } +} diff --git a/packages/wsp-toolkit/package.json b/packages/wsp-toolkit/package.json new file mode 100644 index 000000000..58ae83bd9 --- /dev/null +++ b/packages/wsp-toolkit/package.json @@ -0,0 +1,44 @@ +{ + "name": "ruv-fann-wsp-toolkit", + "private": true, + "version": "0.1.0", + "type": "module", + "engines": { + "node": ">=22.13.0" + }, + "workspaces": [ + "packages/*" + ], + "scripts": { + "test": "node --test packages/*/test/*.test.mjs test/*.test.mjs", + "test:unit": "node --test packages/*/test/*.test.mjs", + "test:e2e": "node --test test/*.test.mjs", + "check:types": "tsc --noEmit -p tsconfig.json", + "benchmark": "node scripts/benchmark.mjs", + "validate": "node scripts/validate.mjs", + "test:hub:live": "node scripts/huggingface-live.mjs", + "audit": "npm audit --audit-level=high && npm --prefix tooling/agentdb run audit", + "setup:agentdb": "npm ci --prefix tooling/agentdb --omit=optional --ignore-scripts --no-audit --no-fund", + "demo:loop": "node scripts/evolution-demo.mjs", + "test:loop": "node --test packages/loop/test/*.test.mjs packages/swarm/test/*.test.mjs packages/invariants/test/*.test.mjs packages/registry/test/*.test.mjs", + "constellation": "node packages/constellation/src/cli.js", + "constellation:report": "node scripts/constellation-report.mjs", + "constellation:links": "node scripts/constellation-links.mjs", + "constellation:check": "node scripts/constellation-links.mjs --check" + }, + "dependencies": { + "ruv-fann-wsp": "0.2.0" + }, + "devDependencies": { + "typescript": "5.9.3", + "playwright": "1.56.1", + "miniflare": "4.20260730.0", + "esbuild": "0.28.2" + }, + "overrides": { + "miniflare": { + "sharp": "0.35.5", + "undici": "7.30.1" + } + } +} diff --git a/packages/wsp-toolkit/packages/cloudflare/LICENSE b/packages/wsp-toolkit/packages/cloudflare/LICENSE new file mode 100644 index 000000000..2dd524ac3 --- /dev/null +++ b/packages/wsp-toolkit/packages/cloudflare/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 rUv + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/wsp-toolkit/packages/cloudflare/README.md b/packages/wsp-toolkit/packages/cloudflare/README.md new file mode 100644 index 000000000..088298fd9 --- /dev/null +++ b/packages/wsp-toolkit/packages/cloudflare/README.md @@ -0,0 +1,47 @@ +# ruv-fann-wsp-cloudflare + +Stateless HTTP operations over `ruv-fann-wsp@0.2.0`, with a build adapter that imports real precompiled WebAssembly modules into Cloudflare Workers. Reuses one initialized runtime per backend. It never downloads Wasm at runtime and has no JavaScript numerical fallback. + +```js +import { createWorkerHandler } from 'ruv-fann-wsp-cloudflare'; + +export default { + fetch(request, env) { + return createWorkerHandler({ bearerToken: env.WSP_BEARER_TOKEN }).fetch(request); + } +}; +``` + +Use the provided static-Wasm build for deployment. Bundling the handler with a generic browser build leaves the underlying runtime's asset loader unsuitable for Workers. + +```sh +npm run build --workspace ruv-fann-wsp-cloudflare +``` + +The build emits `dist/worker.js`, `dist/core.wasm` and `dist/simd.wasm` within this package. `buildWorker(directory)` is also available from `ruv-fann-wsp-cloudflare/build` for custom output directories. The included `wrangler.jsonc` prepares a Worker named `ruv-fann-wsp-validation`; review the name and deployment account before deployment. Set `WSP_BEARER_TOKEN` with the Cloudflare secret flow. Tokens must contain 24..1024 printable non-space ASCII characters. Nothing in the build command deploys resources. + +Cloudflare's current Workers runtime supports the imported SIMD module. `simd: false` selects the scalar module, and `true` or `auto` selects SIMD. Both backends are exercised in real local `workerd`, with independent XOR and derivative oracles. There is no runtime compilation or Node compatibility requirement. + +| Route | Method | JSON body | +| --- | --- | --- | +| `/health` | GET | No body. Public, reports configuration and byte limit. | +| `/evaluate` | POST | `{model, patch, dataset, policy, options?}` | +| `/trace` | POST | `{model, batch, options?}` | +| `/sensitivity` | POST | `{model, dataset, locations, options?}` | +| `/ablation` | POST | `{model, layer, neuron, limits?}` | + +Authenticated operations require `Authorization: Bearer …` and `Content-Type: application/json`. Their payloads and successful responses use the WSP types and schemas. `/evaluate` returns HTTP 200 with `accepted: false` when a valid patch fails its supplied evaluation policy. A caller-selected policy is evidence for that request, not authorization to change a live model. + +Unknown paths return 404, unsupported methods 405, missing configuration 503, invalid credentials 401, malformed UTF-8/JSON 400, unsupported media types 415, oversized bodies 413, and bounded WSP input errors 422. Unexpected execution failures return a generic 500 without a stack trace. Responses set `Cache-Control: no-store`. Query parameters and unknown payload fields are rejected. There is no CORS policy or outbound URL selection. + +`createWorkerHandler` accepts `maxRequestBytes` to tighten the default 512 KiB request cap, up to the hard 1 MiB maximum. It counts streamed bytes independently of `Content-Length`. Existing WSP limits additionally bound dimensions, rows, parameters, numerical sensitivity and aggregate work. Authentication fails closed unless a token is configured; `allowUnauthenticated: true` is an explicit option for controlled local tests. + +This package stores no checkpoints, accepts no generated code, and exposes no promotion, rollback or shell endpoint. Application owners must provide trusted datasets and policies, request rate/concurrency controls and a durable revision authority if they add state. Hosted deployment has not been implied by successful local `workerd` validation. + + + +Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). + +These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. + + diff --git a/packages/wsp-toolkit/packages/cloudflare/constellation.json b/packages/wsp-toolkit/packages/cloudflare/constellation.json new file mode 100644 index 000000000..ea8c6ac97 --- /dev/null +++ b/packages/wsp-toolkit/packages/cloudflare/constellation.json @@ -0,0 +1,16 @@ +{ + "schema": "ruvnet.constellation-module/1", + "name": "ruv-fann-wsp-cloudflare", + "version": "0.1.0", + "role": "satellite", + "contracts": [ + "ruvnet.constellation-module/1", + "ruv-fann.dense-layers/1", + "ruv-fann.weight-patch/1", + "ruv-fann.weight-evaluation/1" + ], + "integrations": [ + "ruv-fann-wasm", + "ruv-fann-wsp" + ] +} diff --git a/packages/wsp-toolkit/packages/cloudflare/package.json b/packages/wsp-toolkit/packages/cloudflare/package.json new file mode 100644 index 000000000..489ef1aa8 --- /dev/null +++ b/packages/wsp-toolkit/packages/cloudflare/package.json @@ -0,0 +1,47 @@ +{ + "name": "ruv-fann-wsp-cloudflare", + "version": "0.1.0", + "description": "Bounded stateless WSP operations with static WebAssembly modules for Cloudflare Workers", + "type": "module", + "main": "./src/index.js", + "types": "./src/index.d.ts", + "exports": { + ".": { + "types": "./src/index.d.ts", + "import": "./src/index.js" + }, + "./build": { + "types": "./src/build.d.ts", + "import": "./src/build.js" + } + }, + "files": [ + "src", + "scripts", + "README.md", + "LICENSE", + "wrangler.jsonc", + "constellation.json" + ], + "engines": { + "node": ">=20.9.0" + }, + "dependencies": { + "ruv-fann-wsp": "0.2.0", + "ruv-fann-wasm": "0.1.2", + "esbuild": "0.28.2" + }, + "scripts": { + "test": "node --test test/*.test.mjs", + "build": "node scripts/build.mjs" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/ruvnet/ruv-FANN.git", + "directory": "packages/wsp-toolkit/packages/cloudflare" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/wsp-toolkit/packages/cloudflare/scripts/build.mjs b/packages/wsp-toolkit/packages/cloudflare/scripts/build.mjs new file mode 100644 index 000000000..550db3399 --- /dev/null +++ b/packages/wsp-toolkit/packages/cloudflare/scripts/build.mjs @@ -0,0 +1,3 @@ +import { buildWorker } from '../src/build.js'; +const output = process.argv[2] ?? new URL('../dist', import.meta.url).pathname; +console.log(JSON.stringify(await buildWorker(output), null, 2)); diff --git a/packages/wsp-toolkit/packages/cloudflare/src/build.d.ts b/packages/wsp-toolkit/packages/cloudflare/src/build.d.ts new file mode 100644 index 000000000..f492d4622 --- /dev/null +++ b/packages/wsp-toolkit/packages/cloudflare/src/build.d.ts @@ -0,0 +1,3 @@ +export interface WorkerBuild { script: string; coreWasm: string; simdWasm: string } +/** Node-only build helper. Bundles installed WSP and wasm-bindgen bindings, with static Wasm imports. */ +export function buildWorker(outDirectory: string): Promise>; diff --git a/packages/wsp-toolkit/packages/cloudflare/src/build.js b/packages/wsp-toolkit/packages/cloudflare/src/build.js new file mode 100644 index 000000000..8fea7e61b --- /dev/null +++ b/packages/wsp-toolkit/packages/cloudflare/src/build.js @@ -0,0 +1,62 @@ +import { build } from 'esbuild'; +import { mkdir, copyFile, stat } from 'node:fs/promises'; +import { dirname, join, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +/** Bundle the exact installed bindings and statically import both precompiled Wasm modules. */ +export async function buildWorker(outDirectory) { + if (typeof outDirectory !== 'string' || !outDirectory.length) throw new TypeError('outDirectory is required'); + const output = resolve(outDirectory); + const wasmRoot = resolve(dirname(fileURLToPath(import.meta.resolve('ruv-fann-wasm'))), '..'); + const assets = [ + [join(wasmRoot, 'dist', 'ruv_swarm_wasm_bg.wasm'), join(output, 'core.wasm')], + [join(wasmRoot, 'dist', 'ruv_swarm_simd.wasm'), join(output, 'simd.wasm')] + ]; + // Fail before touching output if an installed runtime is incomplete. + await Promise.all(assets.map(([source]) => stat(source))); + await mkdir(output, { recursive: true }); + await Promise.all(assets.map(([source, destination]) => copyFile(source, destination))); + const loader = ` +import * as core from ${JSON.stringify(join(wasmRoot, 'dist', 'core.js'))}; +import * as simd from ${JSON.stringify(join(wasmRoot, 'dist', 'simd.js'))}; +import coreModule from './core.wasm'; +import simdModule from './simd.wasm'; +const flights = new Map(); +export function supportsSIMD() { return true; } +export function validateRuntimeOptions(options = {}) { + if (!options || typeof options !== 'object' || Array.isArray(options) || Object.keys(options).some(k => k !== 'simd')) + throw new TypeError('unknown runtime options'); + const value = options.simd === undefined ? 'auto' : options.simd; + if (value !== true && value !== false && value !== 'auto') throw new TypeError('simd must be boolean or auto'); + return value; +} +export async function loadWasm(options = {}) { + const requested = validateRuntimeOptions(options); + const accelerated = requested !== false; + const key = accelerated ? 'simd' : 'core'; + if (!flights.has(key)) { + const bindings = accelerated ? simd : core; + const module = accelerated ? simdModule : coreModule; + const flight = Promise.resolve().then(() => { + const wasm = bindings.initSync({ module }); + if (!(wasm.memory instanceof WebAssembly.Memory)) throw new Error('WASM memory export missing'); + return Object.freeze({ backend: accelerated ? 'wasm-simd' : 'wasm', bindings, memory: wasm.memory }); + }); + flights.set(key, flight); + flight.catch(() => { if (flights.get(key) === flight) flights.delete(key); }); + } + return flights.get(key); +} +`; + await build({ + entryPoints: [fileURLToPath(new URL('./worker.js', import.meta.url))], + outfile: join(output, 'worker.js'), bundle: true, format: 'esm', platform: 'browser', + target: 'es2022', minify: true, legalComments: 'none', define: { process: 'undefined' }, + plugins: [{ name: 'wsp-static-wasm', setup(builder) { + builder.onResolve({ filter: /^ruv-fann-wasm$/ }, () => ({ path: 'runtime', namespace: 'wsp-static-wasm' })); + builder.onLoad({ filter: /.*/, namespace: 'wsp-static-wasm' }, () => ({ contents: loader, resolveDir: wasmRoot })); + builder.onResolve({ filter: /^\.\/(core|simd)\.wasm$/ }, args => ({ path: args.path, external: true })); + } }] + }); + return Object.freeze({ script: join(output, 'worker.js'), coreWasm: join(output, 'core.wasm'), simdWasm: join(output, 'simd.wasm') }); +} diff --git a/packages/wsp-toolkit/packages/cloudflare/src/index.d.ts b/packages/wsp-toolkit/packages/cloudflare/src/index.d.ts new file mode 100644 index 000000000..0cab3bca3 --- /dev/null +++ b/packages/wsp-toolkit/packages/cloudflare/src/index.d.ts @@ -0,0 +1,12 @@ +export interface WorkerHandlerOptions { + /** 24..1024 printable non-space ASCII characters. Store as a Worker secret. */ + bearerToken?: string; + /** Explicitly opts out of authentication; defaults to false. Use only for local tests. */ + allowUnauthenticated?: boolean; + /** May tighten the hard 1 MiB limit. Defaults to 512 KiB. */ + maxRequestBytes?: number; +} +export interface WorkerHandler { fetch(request: Request): Promise } +export const MAX_REQUEST_BYTES: number; +/** POST /evaluate, /trace, /sensitivity, /ablation; GET /health. No durable state or promotion. */ +export function createWorkerHandler(options?: WorkerHandlerOptions): Readonly; diff --git a/packages/wsp-toolkit/packages/cloudflare/src/index.js b/packages/wsp-toolkit/packages/cloudflare/src/index.js new file mode 100644 index 000000000..f1920cca7 --- /dev/null +++ b/packages/wsp-toolkit/packages/cloudflare/src/index.js @@ -0,0 +1,136 @@ +import { + evaluateWeightPatch, traceWeightModel, analyzeWeightSensitivity, createNeuronAblationPatch +} from 'ruv-fann-wsp'; + +export const MAX_REQUEST_BYTES = 1024 * 1024; + +class HTTPError extends Error { + constructor(status, code, message) { super(message); this.status = status; this.code = code; } +} + +function plain(value, allowed, required, name) { + if (!value || typeof value !== 'object' || Array.isArray(value) || + ![Object.prototype, null].includes(Object.getPrototypeOf(value))) + throw new TypeError(`${name} must be a plain object`); + const output = Object.create(null); + for (const key of Reflect.ownKeys(value)) { + const descriptor = Object.getOwnPropertyDescriptor(value, key); + if (typeof key !== 'string' || !allowed.includes(key) || !Object.hasOwn(descriptor, 'value')) + throw new TypeError(`unknown or accessor ${name} field`); + output[key] = descriptor.value; + } + if (required.some(key => !Object.hasOwn(output, key))) throw new TypeError(`missing ${name} field`); + return output; +} + +function response(body, status = 200, extra = {}) { + return new Response(JSON.stringify(body), { + status, + headers: { 'Content-Type': 'application/json; charset=utf-8', 'Cache-Control': 'no-store', + 'X-Content-Type-Options': 'nosniff', ...extra } + }); +} + +// Equal-length token comparison without an early exit on a mismatched character. +function tokenMatches(value, token) { + if (typeof value !== 'string' || value.length !== token.length) return false; + let different = 0; + for (let index = 0; index < token.length; index++) different |= value.charCodeAt(index) ^ token.charCodeAt(index); + return different === 0; +} + +async function readJSON(request, limit) { + const type = request.headers.get('content-type'); + if (!type || !/^application\/json(?:\s*;\s*charset\s*=\s*(?:utf-8|"utf-8"))?\s*$/i.test(type)) + throw new HTTPError(415, 'unsupported_media_type', 'Content-Type must be application/json with UTF-8 encoding'); + const declared = request.headers.get('content-length'); + if (declared !== null && (!/^(0|[1-9][0-9]*)$/.test(declared) || Number(declared) > limit)) + throw new HTTPError(413, 'body_too_large', 'Request body exceeds byte limit'); + if (!request.body) throw new HTTPError(400, 'invalid_json', 'A JSON body is required'); + const reader = request.body.getReader(); + // Geometric storage bounds overhead even if a client fragments into one-byte chunks. + let bytes = new Uint8Array(Math.min(limit, 8192)); + let size = 0; + try { + for (;;) { + const { value, done } = await reader.read(); + if (done) break; + size += value.byteLength; + if (size > limit) { + await reader.cancel('request body exceeds byte limit'); + throw new HTTPError(413, 'body_too_large', 'Request body exceeds byte limit'); + } + if (size > bytes.length) { + const grown = new Uint8Array(Math.min(limit, Math.max(size, bytes.length * 2))); + grown.set(bytes); + bytes = grown; + } + bytes.set(value, size - value.byteLength); + } + } finally { reader.releaseLock(); } + try { return JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes.subarray(0, size))); } + catch { throw new HTTPError(400, 'invalid_json', 'Request must contain valid UTF-8 JSON'); } +} + +const shapes = Object.freeze({ + '/evaluate': ['model', 'patch', 'dataset', 'policy', 'options'], + '/trace': ['model', 'batch', 'options'], + '/sensitivity': ['model', 'dataset', 'locations', 'options'], + '/ablation': ['model', 'layer', 'neuron', 'limits'] +}); +const required = Object.freeze({ + '/evaluate': ['model', 'patch', 'dataset', 'policy'], + '/trace': ['model', 'batch'], + '/sensitivity': ['model', 'dataset', 'locations'], + '/ablation': ['model', 'layer', 'neuron'] +}); + +/** Stateless adapter. Authentication defaults to unavailable until a token is configured. */ +export function createWorkerHandler(options = {}) { + const config = plain(options, ['bearerToken', 'allowUnauthenticated', 'maxRequestBytes'], [], 'handler options'); + if (config.bearerToken !== undefined && + (typeof config.bearerToken !== 'string' || config.bearerToken.length < 24 || config.bearerToken.length > 1024 || + !/^[\x21-\x7e]+$/.test(config.bearerToken))) + throw new TypeError('bearerToken must be 24..1024 printable non-space ASCII characters'); + if (config.allowUnauthenticated !== undefined && typeof config.allowUnauthenticated !== 'boolean') + throw new TypeError('allowUnauthenticated must be boolean'); + const maxBytes = config.maxRequestBytes ?? 512 * 1024; + if (!Number.isSafeInteger(maxBytes) || maxBytes < 1 || maxBytes > MAX_REQUEST_BYTES) + throw new RangeError(`maxRequestBytes must be an integer in 1..${MAX_REQUEST_BYTES}`); + const token = config.bearerToken; + const allowUnauthenticated = config.allowUnauthenticated === true; + return Object.freeze({ + async fetch(request) { + try { + if (!(request instanceof Request)) throw new TypeError('request must be a Request'); + const url = new URL(request.url); + if (url.search) throw new HTTPError(400, 'invalid_query', 'Query parameters are not supported'); + if (url.pathname === '/health') { + if (request.method !== 'GET') return response({ error: 'method_not_allowed' }, 405, { Allow: 'GET' }); + return response({ schema: 'ruv-fann.wsp-worker-health/1', stateless: true, + authenticatedOperations: Boolean(token), maxRequestBytes: maxBytes }); + } + if (!Object.hasOwn(shapes, url.pathname)) throw new HTTPError(404, 'not_found', 'Unknown operation'); + if (request.method !== 'POST') return response({ error: 'method_not_allowed' }, 405, { Allow: 'POST' }); + if (!token && !allowUnauthenticated) + throw new HTTPError(503, 'authentication_unconfigured', 'Configure WSP_BEARER_TOKEN before using operations'); + if (token && !tokenMatches(request.headers.get('authorization'), `Bearer ${token}`)) + throw new HTTPError(401, 'unauthorized', 'A valid bearer token is required'); + const body = plain(await readJSON(request, maxBytes), shapes[url.pathname], required[url.pathname], 'request'); + switch (url.pathname) { + case '/evaluate': return response(await evaluateWeightPatch(body.model, body.patch, body.dataset, body.policy, body.options)); + case '/trace': return response(await traceWeightModel(body.model, body.batch, body.options)); + case '/sensitivity': return response(await analyzeWeightSensitivity(body.model, body.dataset, body.locations, body.options)); + case '/ablation': return response(await createNeuronAblationPatch(body.model, body.layer, body.neuron, body.limits)); + } + } catch (error) { + if (error instanceof HTTPError) return response({ error: error.code, message: error.message }, error.status); + if (error instanceof TypeError || error instanceof RangeError || + /^patch baseHash does not match source model$/.test(error?.message)) + return response({ error: 'invalid_input', message: error.message }, 422); + // Do not return stack traces or unexpected runtime details over the network. + return response({ error: 'execution_failed', message: 'WSP execution failed' }, 500); + } + } + }); +} diff --git a/packages/wsp-toolkit/packages/cloudflare/src/worker.js b/packages/wsp-toolkit/packages/cloudflare/src/worker.js new file mode 100644 index 000000000..2136e21f2 --- /dev/null +++ b/packages/wsp-toolkit/packages/cloudflare/src/worker.js @@ -0,0 +1,7 @@ +import { createWorkerHandler } from './index.js'; + +export default { + fetch(request, env) { + return createWorkerHandler({ bearerToken: env.WSP_BEARER_TOKEN }).fetch(request); + } +}; diff --git a/packages/wsp-toolkit/packages/cloudflare/test/handler.test.mjs b/packages/wsp-toolkit/packages/cloudflare/test/handler.test.mjs new file mode 100644 index 000000000..5a16beb20 --- /dev/null +++ b/packages/wsp-toolkit/packages/cloudflare/test/handler.test.mjs @@ -0,0 +1,101 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { createWorkerHandler, MAX_REQUEST_BYTES } from '../src/index.js'; +import { fingerprintModel } from 'ruv-fann-wsp'; + +const token = 'test-secret-do-not-use-in-production'; +const model = () => ({ schema: 'ruv-fann.dense-layers/1', layers: [ + { inputs: 1, outputs: 1, weights: [0], bias: [0], activation: 'Linear', steepness: 1 } +] }); +const data = { inputs: [1, 2], targets: [2, 4], rows: 2 }; +const request = (path, body, headers = {}) => new Request(`https://worker.test${path}`, { + method: 'POST', headers: { 'content-type': 'application/json', authorization: `Bearer ${token}`, ...headers }, + body: typeof body === 'string' ? body : JSON.stringify(body) +}); + +test('handler requires configured authentication and never evaluates unauthorized requests', async () => { + assert.equal((await createWorkerHandler().fetch(request('/evaluate', {}))).status, 503); + const handler = createWorkerHandler({ bearerToken: token }); + assert.equal((await handler.fetch(request('/evaluate', {}, { authorization: 'Bearer wrong' }))).status, 401); + assert.equal((await handler.fetch(request('/evaluate', {}, { authorization: '' }))).status, 401); + const health = await handler.fetch(new Request('https://worker.test/health')); + assert.equal(health.status, 200); + assert.equal((await health.json()).authenticatedOperations, true); + assert.equal(health.headers.get('cache-control'), 'no-store'); + assert.throws(() => createWorkerHandler({ bearerToken: 'short' }), /24/); + assert.throws(() => createWorkerHandler({ bearerToken: 'x'.repeat(23) + '\n' }), /ASCII/); + assert.throws(() => createWorkerHandler({ allowUnauthenticated: 'yes' }), /boolean/); + assert.throws(() => createWorkerHandler({ maxRequestBytes: MAX_REQUEST_BYTES + 1 }), /maxRequestBytes/); + let getterCalls = 0; + assert.throws(() => createWorkerHandler({ get bearerToken() { getterCalls++; return token; } }), /accessor/); + assert.equal(getterCalls, 0); +}); + +test('HTTP routing, JSON encoding and unknown fields fail before WASM', async () => { + const handler = createWorkerHandler({ bearerToken: token }); + assert.equal((await handler.fetch(new Request('https://worker.test/evaluate'))).status, 405); + assert.equal((await handler.fetch(request('/promote', {}))).status, 404); + assert.equal((await handler.fetch(request('/evaluate?url=https://elsewhere.test', {}))).status, 400); + assert.equal((await handler.fetch(request('/evaluate', '{}', { 'content-type': 'text/plain' }))).status, 415); + assert.equal((await handler.fetch(request('/evaluate', 'not-json'))).status, 400); + assert.equal((await handler.fetch(request('/evaluate', { unknown: true }))).status, 422); + const invalidUTF8 = new Request('https://worker.test/trace', { + method: 'POST', headers: { 'content-type': 'application/json', authorization: `Bearer ${token}` }, + body: Uint8Array.of(0xff) + }); + assert.equal((await handler.fetch(invalidUTF8)).status, 400); +}); + +test('streamed requests are bounded independently of content-length', async () => { + let canceled = false; + const handler = createWorkerHandler({ bearerToken: token, maxRequestBytes: 20 }); + const stream = new ReadableStream({ + start(controller) { controller.enqueue(new Uint8Array(21)); }, + cancel() { canceled = true; } + }); + const body = new Request('https://worker.test/trace', { + method: 'POST', duplex: 'half', headers: { 'content-type': 'application/json', authorization: `Bearer ${token}` }, body: stream + }); + assert.equal((await handler.fetch(body)).status, 413); + assert.equal(canceled, true); + assert.equal((await handler.fetch(request('/trace', '{}', { 'content-length': '21' }))).status, 413); +}); + +test('fragmented body grows bounded storage without retaining per-chunk objects', async () => { + const handler = createWorkerHandler({ bearerToken: token }); + const bytes = new TextEncoder().encode(JSON.stringify({ model: model(), batch: { inputs: [1], rows: 1 } }) + ' '.repeat(9000)); + let offset = 0; + const stream = new ReadableStream({ + pull(controller) { + if (offset === bytes.length) controller.close(); + else controller.enqueue(bytes.slice(offset, ++offset)); + } + }); + const request = new Request('https://worker.test/trace', { method: 'POST', duplex: 'half', body: stream, + headers: { 'content-type': 'application/json', authorization: `Bearer ${token}` } }); + const result = await handler.fetch(request); + assert.equal(result.status, 200); + assert.deepEqual((await result.json()).layers[0].activations, [0]); +}); + +test('real WASM evaluation distinguishes acceptance and regression without state mutation', async () => { + const source = model(); + const baseHash = await fingerprintModel(source); + const patch = { schema: 'ruv-fann.weight-patch/1', baseHash, + edits: [{ layer: 0, parameter: 'weights', index: 0, value: 2 }] }; + const handler = createWorkerHandler({ bearerToken: token }); + const result = await handler.fetch(request('/evaluate', { model: source, patch, dataset: data, + policy: { maxMSE: 0, maxRegressionMSE: 0 }, options: { simd: false } })); + assert.equal(result.status, 200); + const accepted = await result.json(); + assert.equal(accepted.accepted, true); + assert.equal(accepted.backend, 'wasm'); + assert.equal(accepted.candidate.mse, 0); + const rejected = await handler.fetch(request('/evaluate', { model: source, patch, dataset: { ...data, targets: [0, 0] }, + policy: { maxMSE: 100, maxRegressionMSE: 0 } })); + assert.equal((await rejected.json()).accepted, false); + assert.equal(source.layers[0].weights[0], 0); + const stale = await handler.fetch(request('/evaluate', { model: source, patch: { ...patch, baseHash: '0'.repeat(64) }, + dataset: data, policy: { maxMSE: 0, maxRegressionMSE: 0 } })); + assert.equal(stale.status, 422); +}); diff --git a/packages/wsp-toolkit/packages/cloudflare/test/workerd.test.mjs b/packages/wsp-toolkit/packages/cloudflare/test/workerd.test.mjs new file mode 100644 index 000000000..b73ecd9cb --- /dev/null +++ b/packages/wsp-toolkit/packages/cloudflare/test/workerd.test.mjs @@ -0,0 +1,67 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { mkdtemp, rm, readFile } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { Miniflare } from 'miniflare'; +import { buildWorker } from '../src/build.js'; +import { fingerprintModel } from 'ruv-fann-wsp'; + +const token = 'workerd-test-token-do-not-use-in-production'; +const model = { schema: 'ruv-fann.dense-layers/1', layers: [ + { inputs: 2, outputs: 2, weights: [1, -1, -1, 1], bias: [0, 0], activation: 'ReLU', steepness: 1 }, + { inputs: 2, outputs: 1, weights: [0, 0], bias: [0], activation: 'Linear', steepness: 1 } +] }; +const dataset = { inputs: [0, 0, 0, 1, 1, 0, 1, 1], targets: [0, 1, 1, 0], rows: 4 }; + +test('built Worker executes both static Wasm backends in real workerd', { timeout: 60000 }, async t => { + const output = await mkdtemp(join(tmpdir(), 'wsp-workerd-')); + const artifact = await buildWorker(output); + const code = await readFile(artifact.script, 'utf8'); + assert.match(code, /core\.wasm/); + assert.match(code, /simd\.wasm/); + assert.doesNotMatch(code, /node:fs/); + const worker = new Miniflare({ + modules: true, modulesRoot: output, scriptPath: artifact.script, compatibilityDate: '2026-07-30', + modulesRules: [{ type: 'CompiledWasm', include: ['**/*.wasm'], fallthrough: true }], + bindings: { WSP_BEARER_TOKEN: token } + }); + t.after(async () => { await worker.dispose(); await rm(output, { recursive: true, force: true }); }); + const invoke = (path, body, authorization = `Bearer ${token}`) => worker.dispatchFetch(`https://worker.test${path}`, { + method: 'POST', headers: { 'content-type': 'application/json', authorization }, body: JSON.stringify(body) + }); + const baseHash = await fingerprintModel(model); + const patch = { schema: 'ruv-fann.weight-patch/1', baseHash, edits: [ + { layer: 1, parameter: 'weights', index: 0, value: 1 }, + { layer: 1, parameter: 'weights', index: 1, value: 1 } + ] }; + for (const simd of [false, true]) { + const response = await invoke('/evaluate', { model, patch, dataset, + policy: { maxMSE: 0, maxRegressionMSE: 0, maxAbsoluteError: 0 }, options: { simd } }); + const result = await response.json(); + assert.equal(response.status, 200, JSON.stringify(result)); + assert.equal(result.backend, simd ? 'wasm-simd' : 'wasm'); + assert.equal(result.accepted, true); + assert.equal(result.baseline.mse, 0.5); + assert.equal(result.candidate.mse, 0); + assert.equal(result.baseHash, baseHash); + const trace = await (await invoke('/trace', { model: result.model, + batch: { inputs: dataset.inputs, rows: 4 }, options: { simd } })).json(); + assert.deepEqual(trace.layers[1].activations, dataset.targets); + const ablation = await (await invoke('/ablation', { model: result.model, layer: 0, neuron: 0 })).json(); + assert.equal(ablation.edits[0].value, 0); + const rejection = await (await invoke('/evaluate', { model: result.model, patch: ablation, dataset, + policy: { maxMSE: 0, maxRegressionMSE: 0 }, options: { simd } })).json(); + assert.equal(rejection.accepted, false); + assert.equal(rejection.candidate.mse, 0.25); + } + const linear = { schema: 'ruv-fann.dense-layers/1', layers: [ + { inputs: 1, outputs: 1, weights: [1], bias: [0], activation: 'Linear', steepness: 1 } + ] }; + const derivative = await (await invoke('/sensitivity', { model: linear, + dataset: { inputs: [1, 2], targets: [2, 4], rows: 2 }, + locations: [{ layer: 0, parameter: 'weights', index: 0 }], options: { simd: false } })).json(); + assert.ok(Math.abs(derivative.entries[0].derivative + 5) < 1e-8); + assert.equal((await invoke('/trace', {}, 'Bearer incorrect')).status, 401); + assert.equal((await invoke('/promote', {})).status, 404); +}); diff --git a/packages/wsp-toolkit/packages/cloudflare/wrangler.jsonc b/packages/wsp-toolkit/packages/cloudflare/wrangler.jsonc new file mode 100644 index 000000000..6e89e73d2 --- /dev/null +++ b/packages/wsp-toolkit/packages/cloudflare/wrangler.jsonc @@ -0,0 +1,9 @@ +{ + "name": "ruv-fann-wsp-validation", + "main": "dist/worker.js", + "compatibility_date": "2026-07-30", + "no_bundle": true, + "find_additional_modules": true, + "rules": [{ "type": "CompiledWasm", "globs": ["**/*.wasm"], "fallthrough": true }], + "observability": { "enabled": false } +} diff --git a/packages/wsp-toolkit/packages/constellation/LICENSE b/packages/wsp-toolkit/packages/constellation/LICENSE new file mode 100644 index 000000000..2dd524ac3 --- /dev/null +++ b/packages/wsp-toolkit/packages/constellation/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 rUv + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/wsp-toolkit/packages/constellation/README.md b/packages/wsp-toolkit/packages/constellation/README.md new file mode 100644 index 000000000..e4d126ddf --- /dev/null +++ b/packages/wsp-toolkit/packages/constellation/README.md @@ -0,0 +1,27 @@ +# ruvnet-constellation + +A lightweight explicit onramp for a constellation of independently useful packages. ESM, Node 20.9+. Its only runtime dependency is `ruvnet-constellation-contracts@0.1.0`; no ML runtime, model, provider or telemetry collector is pulled in by this package. This source candidate has not been published. + +```sh +constellation help +constellation catalog +constellation plan weights +constellation plan local-loop +constellation scaffold ./new-json-adapter --name @your-scope/json-adapter --integration ruv-fann-wsp +``` + +`readCatalog(path?)` reads a bounded local JSON file; by default it uses the packaged `catalog.json`. `planProfile(catalog,id)` validates and owns the catalog, and returns `registrySpecs` for declared published packages, `localCandidates` separately, and `publicInstallAvailable:false` if any profile member is only a candidate. Planning executes no install command and never substitutes candidates for public packages. Catalog status and proposed scopes are metadata, not namespace ownership proofs. + +`scaffoldSatellite({directory,name,description?,integrations?})` creates a new explicit directory containing a bounded identity JSON adapter, TypeScript declaration, module manifest, independent malformed-input/snapshot tests, a small local benchmark and publication-preparation guidance. It refuses existing targets, symlinks, traversal and unknown/executable options. Parents must already exist and consist of real directories. Scaffolding requires Linux with `O_DIRECTORY`, `O_NOFOLLOW` and `/proc/self/fd`; it fails closed on unsupported platforms, while catalog and planning remain portable. It opens every parent/child directory through a held directory descriptor, anchors exclusive leaf writes to those descriptors, and verifies directory inode relationships before writes and completion. Child-directory substitution by symlinks cannot redirect output into an existing outside path. It performs no recursive cleanup on failure. These controls do not make a hardened sandbox against arbitrary same-UID code, privileged mount changes, or an attacker moving entire owned directory trees. An I/O or detected namespace-change failure can leave an inspectable partial candidate rather than risk deleting unrelated paths. + +The scaffold is a template, not an AI-generated domain solution. Its default checks do not establish WSP correctness, task accuracy or benchmark superiority. Add useful domain mapping and independent cases before publication. Optional integrations are metadata; no irrelevant peer dependencies or nucleus installs are added to inflate dependency volume. + +All commands are local unless the user separately runs a package manager or provider. No automatic install, provider request, background telemetry, registry publication, scope claim or credential configuration occurs. `--json` is accepted for catalog/plan/scaffold; data output is JSON by default. CLI usage/input failures exit 2. + + + +Explore the [constellation onramp](README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). + +These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. + + diff --git a/packages/wsp-toolkit/packages/constellation/catalog.json b/packages/wsp-toolkit/packages/constellation/catalog.json new file mode 100644 index 000000000..08741f175 --- /dev/null +++ b/packages/wsp-toolkit/packages/constellation/catalog.json @@ -0,0 +1,411 @@ +{ + "schema": "ruvnet.constellation-catalog/1", + "repository": "ruvnet/ruv-FANN", + "packages": [ + { + "name": "metaharness", + "version": "0.4.23", + "role": "nucleus", + "family": "metaharness", + "status": "published", + "repository": "ruvnet/metaharness", + "description": "Developer harness scaffolding and orchestration", + "links": { + "npm": "https://www.npmjs.com/package/metaharness", + "source": "https://github.com/ruvnet/metaharness" + }, + "proposedScope": "@metaharness" + }, + { + "name": "@metaharness/router", + "version": "0.4.1", + "role": "nucleus", + "family": "metaharness", + "status": "published", + "repository": "ruvnet/metaharness", + "description": "Harness routing entry point", + "links": { + "npm": "https://www.npmjs.com/package/@metaharness/router", + "source": "https://github.com/ruvnet/metaharness" + } + }, + { + "name": "@claude-flow/cli", + "version": "3.25.6", + "role": "nucleus", + "family": "ruflo", + "status": "published", + "repository": "ruvnet/ruflo", + "description": "Validated Ruflo coordination CLI pin; latest version is observed separately", + "links": { + "npm": "https://www.npmjs.com/package/@claude-flow/cli", + "source": "https://github.com/ruvnet/ruflo" + } + }, + { + "name": "ruflo", + "version": "3.75.3", + "role": "nucleus", + "family": "ruflo", + "status": "published", + "repository": "ruvnet/ruflo", + "description": "Public Ruflo convenience entry point", + "links": { + "npm": "https://www.npmjs.com/package/ruflo", + "source": "https://github.com/ruvnet/ruflo" + } + }, + { + "name": "agentdb", + "version": "3.10.0", + "role": "primitive", + "family": "agentdb", + "status": "published", + "repository": "ruvnet/agentdb", + "description": "Persistent model programs, proposals and revision histories", + "links": { + "npm": "https://www.npmjs.com/package/agentdb", + "source": "https://github.com/ruvnet/agentdb" + }, + "contracts": [ + "ruv-fann.dense-layers/1", + "ruv-fann.weight-patch/1", + "ruv-fann.weight-evaluation/1" + ], + "proposedScope": "@agentdb" + }, + { + "name": "ruvector", + "version": "0.3.24", + "role": "primitive", + "family": "ruvector", + "status": "published", + "repository": "ruvnet/RuVector", + "description": "Independent vector retrieval primitive", + "links": { + "npm": "https://www.npmjs.com/package/ruvector", + "source": "https://github.com/ruvnet/RuVector" + }, + "proposedScope": "@ruvector" + }, + { + "name": "ruv-fann", + "version": "0.1.2", + "role": "primitive", + "family": "ruv-fann", + "status": "published", + "repository": "ruvnet/ruv-FANN", + "description": "Dense neural-network WebAssembly facade", + "links": { + "npm": "https://www.npmjs.com/package/ruv-fann", + "source": "https://github.com/ruvnet/ruv-FANN" + }, + "contracts": [ + "ruv-fann.dense-layers/1" + ] + }, + { + "name": "ruv-fann-wasm", + "version": "0.1.2", + "role": "primitive", + "family": "ruv-fann", + "status": "published", + "repository": "ruvnet/ruv-FANN", + "description": "Precompiled scalar and SIMD WebAssembly runtime", + "links": { + "npm": "https://www.npmjs.com/package/ruv-fann-wasm", + "source": "https://github.com/ruvnet/ruv-FANN" + }, + "contracts": [ + "ruv-fann.dense-layers/1" + ] + }, + { + "name": "ruv-fann-wsp", + "version": "0.2.0", + "role": "primitive", + "family": "ruv-fann", + "status": "published", + "repository": "ruvnet/ruv-FANN", + "description": "Bounded parameter patches, diagnostics and regression gates", + "links": { + "npm": "https://www.npmjs.com/package/ruv-fann-wsp", + "source": "https://github.com/ruvnet/ruv-FANN" + }, + "contracts": [ + "ruv-fann.dense-layers/1", + "ruv-fann.weight-patch/1", + "ruv-fann.weight-evaluation/1" + ] + }, + { + "name": "agentic-flow", + "version": "3.5.4", + "role": "satellite", + "family": "agentic-flow", + "status": "published", + "repository": "ruvnet/agentic-flow", + "description": "Optional agent workflow integration", + "links": { + "npm": "https://www.npmjs.com/package/agentic-flow", + "source": "https://github.com/ruvnet/agentic-flow" + } + }, + { + "name": "@ruvector/attention", + "version": "2.3.1", + "role": "satellite", + "family": "ruvector", + "status": "published", + "repository": "ruvnet/RuVector", + "description": "Specialized attention integration", + "links": { + "npm": "https://www.npmjs.com/package/@ruvector/attention", + "source": "https://github.com/ruvnet/RuVector" + } + }, + { + "name": "@ruvector/ruvllm", + "version": "4.2.2", + "role": "satellite", + "family": "ruvector", + "status": "published", + "repository": "ruvnet/RuVector", + "description": "Specialized language-model integration", + "links": { + "npm": "https://www.npmjs.com/package/@ruvector/ruvllm", + "source": "https://github.com/ruvnet/RuVector" + } + }, + { + "name": "ruv-fann-wsp-lifecycle", + "version": "0.1.0", + "role": "satellite", + "family": "ruv-fann", + "status": "candidate", + "repository": "ruvnet/ruv-FANN", + "directory": "packages/wsp-toolkit/packages/lifecycle", + "description": "Bounded multi-suite regression gates and checkpoint branch evaluation for WSP", + "contracts": [ + "ruv-fann.dense-layers/1", + "ruv-fann.weight-patch/1", + "ruv-fann.weight-evaluation/1" + ], + "links": { + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/lifecycle" + } + }, + { + "name": "ruv-fann-wsp-search", + "version": "0.1.0", + "role": "satellite", + "family": "ruv-fann", + "status": "candidate", + "repository": "ruvnet/ruv-FANN", + "directory": "packages/wsp-toolkit/packages/search", + "description": "Bounded derivative-free weight search and experimental symbolic/plasticity proposals for ruv-fann-wsp", + "contracts": [ + "ruv-fann.dense-layers/1", + "ruv-fann.weight-patch/1" + ], + "links": { + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/search" + } + }, + { + "name": "ruv-fann-wsp-huggingface", + "version": "0.1.0", + "role": "satellite", + "family": "ruv-fann", + "status": "candidate", + "repository": "ruvnet/ruv-FANN", + "directory": "packages/wsp-toolkit/packages/huggingface", + "description": "Integrity-pinned public Hugging Face dense JSON checkpoints for ruv-FANN WSP", + "contracts": [ + "ruv-fann.dense-layers/1" + ], + "links": { + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/huggingface" + } + }, + { + "name": "ruv-fann-wsp-cloudflare", + "version": "0.1.0", + "role": "satellite", + "family": "ruv-fann", + "status": "candidate", + "repository": "ruvnet/ruv-FANN", + "directory": "packages/wsp-toolkit/packages/cloudflare", + "description": "Bounded stateless WSP operations with static WebAssembly modules for Cloudflare Workers", + "contracts": [ + "ruv-fann.dense-layers/1", + "ruv-fann.weight-patch/1", + "ruv-fann.weight-evaluation/1" + ], + "links": { + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/cloudflare" + } + }, + { + "name": "ruv-fann-wsp-ruos", + "version": "0.1.0", + "role": "satellite", + "family": "ruv-fann", + "status": "candidate", + "repository": "ruvnet/ruv-FANN", + "directory": "packages/wsp-toolkit/packages/ruos", + "description": "Real WASM canary and trusted executor completion checks for ruOS", + "contracts": [ + "ruv-fann.dense-layers/1", + "ruv-fann.weight-patch/1" + ], + "links": { + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/ruos" + } + }, + { + "name": "ruv-fann-wsp-invariants", + "version": "0.1.0", + "role": "satellite", + "family": "ruv-fann", + "status": "candidate", + "repository": "ruvnet/ruv-FANN", + "directory": "packages/wsp-toolkit/packages/invariants", + "description": "Bounded real-WASM finite-domain output invariants for surgical weight evolution", + "contracts": [ + "ruv-fann.dense-layers/1" + ], + "links": { + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/invariants" + } + }, + { + "name": "ruv-fann-wsp-swarm", + "version": "0.1.0", + "role": "satellite", + "family": "ruv-fann", + "status": "candidate", + "repository": "ruvnet/ruv-FANN", + "directory": "packages/wsp-toolkit/packages/swarm", + "description": "Bounded fixed-operation proposal workers using real Node worker threads and WASM", + "contracts": [ + "ruv-fann.dense-layers/1", + "ruv-fann.weight-patch/1" + ], + "links": { + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/swarm" + } + }, + { + "name": "ruv-fann-wsp-registry", + "version": "0.1.0", + "role": "satellite", + "family": "ruv-fann", + "status": "candidate", + "repository": "ruvnet/ruv-FANN", + "directory": "packages/wsp-toolkit/packages/registry", + "description": "Serialized AgentDB weight-program authority with explicit durable acknowledgement", + "contracts": [ + "ruv-fann.dense-layers/1", + "ruv-fann.weight-patch/1", + "ruv-fann.weight-evaluation/1" + ], + "links": { + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/registry" + } + }, + { + "name": "ruv-fann-wsp-loop", + "version": "0.1.0", + "role": "satellite", + "family": "ruv-fann", + "status": "candidate", + "repository": "ruvnet/ruv-FANN", + "directory": "packages/wsp-toolkit/packages/loop", + "description": "Bounded autonomous weight evolution with worker swarms, independent gates and durable revision authority", + "contracts": [ + "ruv-fann.dense-layers/1", + "ruv-fann.weight-patch/1", + "ruv-fann.weight-evaluation/1" + ], + "links": { + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/loop" + } + }, + { + "name": "ruvnet-constellation-contracts", + "version": "0.1.0", + "role": "primitive", + "family": "constellation", + "status": "candidate", + "repository": "ruvnet/ruv-FANN", + "directory": "packages/wsp-toolkit/packages/contracts", + "description": "Dependency-free module and catalog contracts", + "links": { + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/contracts" + } + }, + { + "name": "ruvnet-constellation", + "version": "0.1.0", + "role": "nucleus", + "family": "constellation", + "status": "candidate", + "repository": "ruvnet/ruv-FANN", + "directory": "packages/wsp-toolkit/packages/constellation", + "description": "Lightweight explicit discover, plan and scaffold onramp", + "links": { + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/constellation" + } + }, + { + "name": "ruvnet-constellation-telemetry", + "version": "0.1.0", + "role": "satellite", + "family": "constellation", + "status": "candidate", + "repository": "ruvnet/ruv-FANN", + "directory": "packages/wsp-toolkit/packages/telemetry", + "description": "Public cohort metrics and explicit local adoption analysis", + "links": { + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/telemetry" + } + } + ], + "profiles": [ + { + "id": "weights", + "description": "Use the independently installable published weight-editing primitive", + "packages": [ + "ruv-fann-wsp" + ] + }, + { + "id": "memory", + "description": "Combine durable model programs with bounded parameter edits", + "packages": [ + "agentdb", + "ruv-fann-wsp" + ] + }, + { + "id": "orchestration", + "description": "Optional public harness and validated CLI entry points", + "packages": [ + "metaharness", + "@metaharness/router", + "@claude-flow/cli" + ] + }, + { + "id": "local-loop", + "description": "Inspect the local autonomous-loop candidates; these are source artifacts", + "packages": [ + "ruv-fann-wsp-loop", + "ruv-fann-wsp-registry", + "ruv-fann-wsp-swarm", + "ruv-fann-wsp-invariants" + ] + } + ] +} diff --git a/packages/wsp-toolkit/packages/constellation/constellation.json b/packages/wsp-toolkit/packages/constellation/constellation.json new file mode 100644 index 000000000..b48e15a86 --- /dev/null +++ b/packages/wsp-toolkit/packages/constellation/constellation.json @@ -0,0 +1,12 @@ +{ + "schema": "ruvnet.constellation-module/1", + "name": "ruvnet-constellation", + "version": "0.1.0", + "role": "nucleus", + "contracts": [ + "ruvnet.constellation-module/1" + ], + "integrations": [ + "ruvnet-constellation-contracts" + ] +} diff --git a/packages/wsp-toolkit/packages/constellation/package.json b/packages/wsp-toolkit/packages/constellation/package.json new file mode 100644 index 000000000..ccb2c9db5 --- /dev/null +++ b/packages/wsp-toolkit/packages/constellation/package.json @@ -0,0 +1,43 @@ +{ + "name": "ruvnet-constellation", + "version": "0.1.0", + "type": "module", + "description": "Explicit lightweight constellation discovery, planning and satellite scaffolding", + "main": "./src/index.js", + "types": "./src/index.d.ts", + "exports": { + ".": { + "types": "./src/index.d.ts", + "import": "./src/index.js" + }, + "./catalog.json": "./catalog.json" + }, + "bin": { + "constellation": "./src/cli.js" + }, + "files": [ + "src", + "catalog.json", + "README.md", + "LICENSE", + "constellation.json" + ], + "engines": { + "node": ">=20.9.0" + }, + "dependencies": { + "ruvnet-constellation-contracts": "0.1.0" + }, + "scripts": { + "test": "node --test test/*.test.mjs" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/ruvnet/ruv-FANN.git", + "directory": "packages/wsp-toolkit/packages/constellation" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/wsp-toolkit/packages/constellation/src/cli.js b/packages/wsp-toolkit/packages/constellation/src/cli.js new file mode 100755 index 000000000..138dd587d --- /dev/null +++ b/packages/wsp-toolkit/packages/constellation/src/cli.js @@ -0,0 +1,47 @@ +#!/usr/bin/env node +import {readCatalog,planProfile,scaffoldSatellite} from './index.js'; +const help=`constellation — explicit local discovery, planning and satellite scaffolding + +Usage: + constellation help + constellation catalog [--json] + constellation plan [--json] + constellation scaffold --name [--description ] [--integration ...] [--json] + +Plans describe verified published pins and local candidates separately. No command +installs dependencies, starts an agent, collects telemetry or publishes a package. +Scaffolding requires Linux with /proc/self/fd, creates a new directory only, +and refuses existing targets and symlinks. Catalog and planning remain portable. + +Nucleus: https://www.npmjs.com/package/metaharness + https://www.npmjs.com/package/@claude-flow/cli +Memory: https://www.npmjs.com/package/agentdb +Vectors: https://www.npmjs.com/package/ruvector +Weights: https://www.npmjs.com/package/ruv-fann-wsp +`; +try { + const args=process.argv.slice(2),command=args.shift()??'help'; + if(command==='help'||command==='--help'||command==='-h'){ + if(args.length)throw new Error('help accepts no arguments'); + process.stdout.write(help); + }else if(command==='catalog'){ + if(args.length&&!(args.length===1&&args[0]==='--json'))throw new Error('catalog accepts only --json'); + process.stdout.write(JSON.stringify(await readCatalog(),null,2)+'\n'); + }else if(command==='plan'){ + const profile=args.shift();if(!profile||(args.length&&!(args.length===1&&args[0]==='--json')))throw new Error('usage: constellation plan [--json]'); + process.stdout.write(JSON.stringify(planProfile(await readCatalog(),profile),null,2)+'\n'); + }else if(command==='scaffold'){ + const directory=args.shift();if(!directory||directory.startsWith('--'))throw new Error('scaffold requires an explicit new directory'); + const config={directory},integrations=[];const seen=new Set(); + while(args.length){ + const flag=args.shift(); + if(flag==='--json'){if(seen.has(flag))throw new Error('duplicate --json');seen.add(flag);continue;} + if(!['--name','--description','--integration'].includes(flag))throw new Error('unknown scaffold option'); + const value=args.shift();if(!value||value.startsWith('--'))throw new Error(`missing value for ${flag}`); + if(flag==='--integration')integrations.push(value); + else {if(seen.has(flag))throw new Error(`duplicate ${flag}`);seen.add(flag);config[flag.slice(2)]=value;} + } + if(integrations.length)config.integrations=integrations; + process.stdout.write(JSON.stringify(await scaffoldSatellite(config),null,2)+'\n'); + }else throw new Error('unknown command; use constellation help'); +}catch(error){process.stderr.write(`constellation: ${error.message}\n`);process.exitCode=2;} diff --git a/packages/wsp-toolkit/packages/constellation/src/index.d.ts b/packages/wsp-toolkit/packages/constellation/src/index.d.ts new file mode 100644 index 000000000..928ae6420 --- /dev/null +++ b/packages/wsp-toolkit/packages/constellation/src/index.d.ts @@ -0,0 +1,12 @@ +import type {ConstellationCatalog,CatalogPackage} from 'ruvnet-constellation-contracts'; +export interface ConstellationPlan { + schema:'ruvnet.constellation-plan/1'; profile:string; description:string; packages:CatalogPackage[]; + registrySpecs:string[]; localCandidates:{name:string;directory?:string;repository:string}[]; + publicInstallAvailable:boolean; automaticInstall:false; telemetry:'disabled'; +} +export interface SatelliteScaffoldOptions {directory:string;name:string;description?:string;integrations?:string[]} +export interface SatelliteScaffold {schema:'ruvnet.constellation-scaffold/1';directory:string;name:string;status:'candidate';files:string[];automaticInstall:false;telemetry:'disabled';published:false} +export function readCatalog(path?:string|URL):Promise; +export function planProfile(catalog:ConstellationCatalog,id:string):ConstellationPlan; +/** Scaffolding requires Linux directory descriptors and /proc/self/fd; fails closed elsewhere. */ +export function scaffoldSatellite(options:SatelliteScaffoldOptions):Promise; diff --git a/packages/wsp-toolkit/packages/constellation/src/index.js b/packages/wsp-toolkit/packages/constellation/src/index.js new file mode 100644 index 000000000..8d62cb42c --- /dev/null +++ b/packages/wsp-toolkit/packages/constellation/src/index.js @@ -0,0 +1,203 @@ +import { open, mkdir, lstat } from 'node:fs/promises'; +import { constants } from 'node:fs'; +import { resolve, dirname, basename, parse, relative, join, sep } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { CONTRACTS, CONTRACT_LIMITS, validateCatalog, validateModuleManifest } from 'ruvnet-constellation-contracts'; + +/** Read only an explicitly selected local catalog; no registry or network access. */ +export async function readCatalog(path = new URL('../catalog.json', import.meta.url)) { + if (path instanceof URL) path = fileURLToPath(path); + if (typeof path !== 'string' || !path.length || path.length > 4096 || /[\x00-\x1f\x7f]/.test(path)) throw new TypeError('catalog path must be bounded local text'); + const handle = await open(path, constants.O_RDONLY | constants.O_NONBLOCK); + try { + if (!(await handle.stat()).isFile()) throw new TypeError('catalog must be a regular file'); + const bytes = Buffer.alloc(CONTRACT_LIMITS.maxBytes + 1); + let length = 0; + while (length < bytes.length) { + const { bytesRead } = await handle.read(bytes, length, bytes.length - length, null); + if (!bytesRead) break; + length += bytesRead; + } + if (length > CONTRACT_LIMITS.maxBytes) throw new RangeError('catalog exceeds byte limit'); + return validateCatalog(JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes.subarray(0, length)))); + } finally { await handle.close(); } +} + +/** Planning is data only. Candidate sources never become purported public install specs. */ +export function planProfile(input, id) { + const catalog = validateCatalog(input); + if (typeof id !== 'string' || !/^[a-z][a-z0-9-]{0,47}$/.test(id)) throw new TypeError('profile must be a bounded identifier'); + const profile = catalog.profiles.find(profile => profile.id === id); + if (!profile) throw new Error(`unknown constellation profile: ${id}`); + const entries = new Map(catalog.packages.map(entry => [entry.name, entry])); + const packages = profile.packages.map(name => entries.get(name)); + return { schema: 'ruvnet.constellation-plan/1', profile: id, description: profile.description, + packages, registrySpecs: packages.filter(entry => entry.status === 'published').map(entry => `${entry.name}@${entry.version}`), + localCandidates: packages.filter(entry => entry.status === 'candidate').map(entry => ({name:entry.name, directory:entry.directory, repository:entry.repository})), + publicInstallAvailable: packages.every(entry => entry.status === 'published'), automaticInstall: false, telemetry: 'disabled' }; +} +function argumentsRecord(value) { + if (!value || typeof value !== 'object' || Array.isArray(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) throw new TypeError('scaffold options must be a plain record'); + const result = {}; + for (const key of Reflect.ownKeys(value)) { + const property = Object.getOwnPropertyDescriptor(value, key); + if (typeof key !== 'string' || !['directory','name','description','integrations'].includes(key) || !property || !Object.hasOwn(property,'value')) + throw new TypeError('unknown scaffold option or accessor'); + result[key] = property.value; + } + if (!Object.hasOwn(result, 'directory') || !Object.hasOwn(result, 'name')) throw new TypeError('scaffold requires directory and name'); + return result; +} +function markdown(value) { return value.replaceAll('&','&').replaceAll('<','<').replaceAll('>','>').replace(/[\\`*_{}\[\]()#+.!|]/g, '\\$&'); } +function directoryAlias(handle) { return `/proc/self/fd/${handle.fd}`; } +async function closeDirectories(resources) { + const results = await Promise.allSettled([...resources].reverse().map(resource => resource.handle.close())); + const failed = results.find(result => result.status === 'rejected'); + if (failed) throw failed.reason; +} +async function verifyDirectories(resources) { + for (const resource of resources) { + const held = await resource.handle.stat(); + const entry = await lstat(resource.parent ? `${directoryAlias(resource.parent)}/${resource.name}` : resource.root); + if (!held.isDirectory() || entry.isSymbolicLink() || !entry.isDirectory() || entry.dev !== held.dev || entry.ino !== held.ino) + throw new Error('scaffold directory relationship changed during creation'); + } +} +async function openParentDirectories(path) { + if (process.platform !== 'linux' || typeof constants.O_DIRECTORY !== 'number' || typeof constants.O_NOFOLLOW !== 'number') + throw new Error('scaffolding requires Linux directory descriptors and /proc/self/fd; catalog and planning remain portable'); + const root = parse(path).root, parts = relative(root, path).split(sep).filter(Boolean), resources = []; + if (parts.length > 64) throw new RangeError('scaffold parent path exceeds directory depth limit'); + const flags = constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW; + try { + // Each next component resolves through a held descriptor. No unverified ancestor + // path is reused, and O_NOFOLLOW applies to the newly opened component. + let current = await open(root, flags); + resources.push({ handle: current, root }); + // Verify the kernel-provided descriptor namespace before creating any output. + const proc = await lstat('/proc/self/fd'); + if (!proc.isDirectory()) throw new Error('Linux /proc/self/fd directory is unavailable'); + for (const name of parts) { + const parent = current; + try { current = await open(`${directoryAlias(parent)}/${name}`, flags); } + catch (error) { throw new TypeError('scaffold parent path must consist of existing real directories', {cause:error}); } + resources.push({ handle: current, parent, name }); + } + await verifyDirectories(resources); + return resources; + } catch (error) { await closeDirectories(resources); throw error; } +} +async function createDirectory(resources, parent, name) { + await verifyDirectories(resources); + const path = `${directoryAlias(parent)}/${name}`; + // mkdir refuses an existing target, including dangling symlinks. Opening the + // result refuses substitution by a symlink before its descriptor is acquired. + await mkdir(path, {mode:0o700}); + const handle = await open(path, constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW); + resources.push({handle,parent,name}); + await verifyDirectories(resources); + return handle; +} +async function writeNew(directoryHandle, name, content) { + // Only fixed leaf names reach this function. O_EXCL prevents existing leaf + // replacement; the held parent descriptor prevents intermediate symlink races. + const path = `${directoryAlias(directoryHandle)}/${name}`; + const handle = await open(path, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600); + try { await handle.writeFile(content); } finally { await handle.close(); } +} +const adapterSource = `// Bounded JSON adapter template. Define and independently test domain mapping before release. +export function adaptRecord(input) { + let nodes = 0, text = 0; + const ancestors = new Set(); + function copy(value, depth) { + if (++nodes > 8192 || depth > 8) throw new RangeError('adapter structure exceeds limits'); + if (value === null || typeof value === 'boolean') return value; + if (typeof value === 'number' && Number.isFinite(value)) return value === 0 ? 0 : value; + if (typeof value === 'string') { text += value.length; if (text > 65536) throw new RangeError('adapter text exceeds limit'); return value; } + if (!value || typeof value !== 'object' || ancestors.has(value)) throw new TypeError('adapter accepts finite acyclic JSON data only'); + const array = Array.isArray(value); + if (!(array ? Object.getPrototypeOf(value) === Array.prototype : [Object.prototype, null].includes(Object.getPrototypeOf(value)))) throw new TypeError('adapter requires plain data'); + if (array && value.length > 8192) throw new RangeError('adapter array exceeds limit'); + const result = array ? [] : Object.create(null); ancestors.add(value); + for (const key of Reflect.ownKeys(value)) { + if (array && key === 'length') continue; + if (typeof key !== 'string' || ['__proto__','constructor','prototype'].includes(key) || (array && (!/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= value.length))) throw new TypeError('adapter contains unsafe properties'); + text += key.length; if (text > 65536) throw new RangeError('adapter text exceeds limit'); + const property = Object.getOwnPropertyDescriptor(value, key); + if (!property || !Object.hasOwn(property, 'value')) throw new TypeError('adapter accessors are forbidden'); + result[key] = copy(property.value, depth + 1); + } + ancestors.delete(value); + if (array && (result.length !== value.length || Object.keys(result).length !== value.length)) throw new TypeError('adapter arrays must be dense'); + return result; + } + const result = copy(input, 0); + if (new TextEncoder().encode(JSON.stringify(result)).length > 65536) throw new RangeError('adapter bytes exceed limit'); + return result; +} +`; +const templateTests = `import test from 'node:test'; +import assert from 'node:assert/strict'; +import { adaptRecord } from '../src/index.js'; +test('copies JSON without retaining caller objects', () => { + const input = {format:'example', values:[1,2,null]}; const output = adaptRecord(input); + input.values[0] = 10; assert.equal(output.values[0],1); assert.equal(output.format,'example'); +}); +test('rejects executable, nonfinite and unsafe inputs without invoking getters', () => { + let calls=0; const input={get value(){calls++; return 1;}}; + assert.throws(()=>adaptRecord(input));assert.equal(calls,0); + for(const value of [Infinity,()=>{},new Array(2),JSON.parse('{"__proto__":{"polluted":true}}')]) assert.throws(()=>adaptRecord(value)); + assert.equal({}.polluted,undefined); +}); +test('bounds copied data and refuses cycles', () => { + const cycle={};cycle.self=cycle; + assert.throws(()=>adaptRecord(cycle));assert.throws(()=>adaptRecord('x'.repeat(65537))); +}); +`; +const benchmarkSource = `import {performance} from 'node:perf_hooks'; +import assert from 'node:assert/strict'; +import {adaptRecord} from './src/index.js'; +const input={format:'example',values:[1,2,3]},iterations=1000,start=performance.now(); +for(let index=0;index 4096 || /[\x00-\x1f\x7f]/.test(directory) || + directory.split(/[\\/]/).some(part => part === '..') || (sep === '/' && directory.includes('\\'))) + throw new TypeError('directory must be bounded text without traversal, control characters or ambiguous separators'); + const module = validateModuleManifest({schema:CONTRACTS.module,name:config.name,version:'0.1.0',role:'satellite',contracts:[CONTRACTS.module],integrations:config.integrations === undefined ? [] : config.integrations}); + const description = config.description === undefined ? 'Bounded JSON adapter candidate; replace mapping with independently tested domain logic.' : config.description; + if (typeof description !== 'string' || !description.length || description.length > 2000 || /[\x00-\x1f\x7f]/.test(description)) throw new TypeError('description must be bounded plain text'); + const target = resolve(directory), parent = dirname(target); + if (target === parent) throw new TypeError('scaffold target cannot be a filesystem root'); + const resources = await openParentDirectories(parent); + try { + const parentHandle = resources.at(-1).handle; + const rootHandle = await createDirectory(resources, parentHandle, basename(target)); + const sourceHandle = await createDirectory(resources, rootHandle, 'src'); + const testHandle = await createDirectory(resources, rootHandle, 'test'); + const manifest = {name:module.name,version:module.version,description,type:'module',main:'./src/index.js',types:'./src/index.d.ts', + exports:{'.':{types:'./src/index.d.ts',import:'./src/index.js'}},files:['src','constellation.json','README.md','LICENSE'], + engines:{node:'>=20.9.0'},scripts:{test:'node --test test/*.test.mjs',check:'npm test',benchmark:'node benchmark.mjs','pack:check':'npm pack --dry-run --ignore-scripts'},license:'MIT',publishConfig:{access:'public'}}; + const integrationLinks = module.integrations.length ? module.integrations.map(name => `- [${name}](https://www.npmjs.com/package/${name}) — optional integration metadata; no dependency is installed.`).join('\n') : 'No integration is selected. Add only integrations the module actually uses.'; + const readme = `# ${markdown(module.name)}\n\n${markdown(description)}\n\nThis is a local candidate with a bounded identity JSON adapter template. It has not been published or proven useful for a domain. Replace the mapping and add independent domain cases before release.\n\n\`adaptRecord(value)\` owns finite acyclic JSON, rejects accessors/prototype keys, and bounds depth, elements and bytes. It executes no callbacks and performs no network requests. These checks are not a WSP or domain-accuracy benchmark.\n\nRun \`npm test\`, \`npm run benchmark\` and \`npm run pack:check\`. No install or provider is required for the template.\n\n## Optional constellation integrations\n\n${integrationLinks}\n\nDiscover [MetaHarness](https://www.npmjs.com/package/metaharness), [Ruflo](https://www.npmjs.com/package/@claude-flow/cli), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector) and [WSP](https://www.npmjs.com/package/ruv-fann-wsp) independently. The template does not force any nucleus dependency.\n\n## Publication preparation\n\nReview the generated files, package name/namespace ownership, license and quality evidence. Configure this package's npm trusted publisher for the exact owner, repository, workflow and optional environment; use a protected exact-source/archive release with supported Node/npm and OIDC provenance. The scaffold neither configures a publisher nor publishes. See [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/).\n`; + const files = new Map([ + ['package.json',JSON.stringify(manifest,null,2)+'\n'],['constellation.json',JSON.stringify(module,null,2)+'\n'], + ['README.md',readme],['src/index.js',adapterSource],['src/index.d.ts','/** Owns bounded finite JSON data. Replace this template with domain-specific types. */\nexport function adaptRecord(input: unknown): unknown;\n'], + ['test/adapter.test.mjs',templateTests],['benchmark.mjs',benchmarkSource], + ['LICENSE',`MIT License\n\nCopyright (c) ${new Date().getUTCFullYear()} contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n`] + ]); + for (const [path,content] of files) { + await verifyDirectories(resources); + const parts = path.split('/'); + const directoryHandle = parts.length === 1 ? rootHandle : parts[0] === 'src' ? sourceHandle : testHandle; + await writeNew(directoryHandle, parts.at(-1), content); + } + await verifyDirectories(resources); + return {schema:'ruvnet.constellation-scaffold/1',directory:target,name:module.name,status:'candidate',files:[...files.keys()],automaticInstall:false,telemetry:'disabled',published:false}; + } finally { await closeDirectories(resources); } +} diff --git a/packages/wsp-toolkit/packages/constellation/test/onramp.test.mjs b/packages/wsp-toolkit/packages/constellation/test/onramp.test.mjs new file mode 100644 index 000000000..2655f3204 --- /dev/null +++ b/packages/wsp-toolkit/packages/constellation/test/onramp.test.mjs @@ -0,0 +1,115 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import {mkdtemp,readFile,writeFile,rm,mkdir,symlink,readdir} from 'node:fs/promises'; +import {tmpdir} from 'node:os'; +import {join} from 'node:path'; +import {pathToFileURL} from 'node:url'; +import {execFileSync,spawnSync} from 'node:child_process'; +import {Worker} from 'node:worker_threads'; +import {readCatalog,planProfile,scaffoldSatellite} from '../src/index.js'; +const cli=new URL('../src/cli.js',import.meta.url).pathname; +async function temp(t){const root=await mkdtemp(join(tmpdir(),'constellation-onramp-'));t.after(()=>rm(root,{recursive:true,force:true}));return root;} + +test('default installed catalog plans published pins separately from local candidates',async()=>{ + const catalog=await readCatalog(),weights=planProfile(catalog,'weights'),local=planProfile(catalog,'local-loop'); + assert.deepEqual(weights.registrySpecs,['ruv-fann-wsp@0.2.0']);assert.equal(weights.publicInstallAvailable,true); + assert.equal(local.registrySpecs.length,0);assert.equal(local.localCandidates.length,4);assert.equal(local.publicInstallAvailable,false); + assert.equal(local.automaticInstall,false);assert.equal(local.telemetry,'disabled'); + catalog.profiles[0].description='changed';assert.notEqual(weights.description,'changed'); + assert.throws(()=>planProfile(catalog,'absent')); +}); +test('local catalog reader rejects oversized, nonregular, invalid UTF-8 and HTTP inputs',async t=>{ + const root=await temp(t),file=join(root,'catalog.json'); + await writeFile(file,JSON.stringify(await readCatalog()));assert.ok((await readCatalog(pathToFileURL(file))).packages.length>0); + await writeFile(file,'x'.repeat(2*1024*1024+1));await assert.rejects(readCatalog(file),/byte/); + await writeFile(file,Uint8Array.of(0xc3,0x28));await assert.rejects(readCatalog(file)); + await assert.rejects(readCatalog(root),/regular/);await assert.rejects(readCatalog(new URL('https://example.test/catalog.json'))); + const pipe=join(root,'fifo');execFileSync('mkfifo',[pipe]); + const attempt=spawnSync(process.execPath,['--input-type=module','-e',`import{readCatalog}from ${JSON.stringify(new URL('../src/index.js',import.meta.url).href)}; await readCatalog(${JSON.stringify(pipe)});`],{timeout:2000,encoding:'utf8'}); + assert.notEqual(attempt.status,0);assert.equal(attempt.signal,null);assert.match(attempt.stderr,/regular file/); +}); +test('CLI help/catalog/plan produce explicit local output and refuse unknown commands',()=>{ + const help=execFileSync(process.execPath,[cli,'help'],{encoding:'utf8'}); + assert.match(help,/https:\/\/www.npmjs.com\/package\/agentdb/);assert.match(help,/No command/); + const output=JSON.parse(execFileSync(process.execPath,[cli,'catalog','--json'],{encoding:'utf8'}));assert.ok(output.packages.length>0); + const plan=JSON.parse(execFileSync(process.execPath,[cli,'plan','local-loop'],{encoding:'utf8'}));assert.equal(plan.publicInstallAvailable,false); + for(const args of [['publish'],['plan'],['catalog','--token','example'],['scaffold','x','--name','ok','--exec','id']]) { + const rejected=spawnSync(process.execPath,[cli,...args],{encoding:'utf8'});assert.equal(rejected.status,2); + } +}); +test('fresh scoped scaffold runs its independent checks and benchmark without installing a stack',async t=>{ + const root=await temp(t),directory=join(root,'adapter'); + const result=await scaffoldSatellite({directory,name:'@example/adapter',description:'Fixture adapter',integrations:['ruv-fann-wsp']}); + assert.equal(result.published,false);assert.equal(result.automaticInstall,false);assert.equal(result.files.length,8); + const manifest=JSON.parse(await readFile(join(directory,'package.json'),'utf8')); + assert.equal(manifest.name,'@example/adapter');assert.equal(manifest.dependencies,undefined);assert.equal(manifest.peerDependencies,undefined); + const module=JSON.parse(await readFile(join(directory,'constellation.json'),'utf8'));assert.deepEqual(module.integrations,['ruv-fann-wsp']); + const childEnv={...process.env};delete childEnv.NODE_TEST_CONTEXT; + const tests=execFileSync('npm',['test'],{cwd:directory,encoding:'utf8',env:childEnv});assert.match(tests,/(?:pass 3|✔)/); + const benchmark=execFileSync(process.execPath,['benchmark.mjs'],{cwd:directory,encoding:'utf8'});assert.equal(JSON.parse(benchmark).iterations,1000); + const {adaptRecord}=await import(pathToFileURL(join(directory,'src/index.js')).href); + const source={x:[1,2]};const owned=adaptRecord(source);source.x[0]=9;assert.equal(owned.x[0],1); + assert.equal((await readdir(directory)).includes('node_modules'),false); +}); +test('existing targets, symlinks and traversal cannot overwrite sentinels or escape explicit target',async t=>{ + const root=await temp(t),existing=join(root,'existing'),outside=join(root,'outside');await mkdir(existing);await mkdir(outside); + await writeFile(join(existing,'sentinel'),'keep');await writeFile(join(outside,'sentinel'),'outside'); + await assert.rejects(scaffoldSatellite({directory:existing,name:'test-adapter'})); + const link=join(root,'link');await symlink(outside,link,'dir'); + await assert.rejects(scaffoldSatellite({directory:link,name:'test-adapter'})); + await assert.rejects(scaffoldSatellite({directory:join(link,'child'),name:'test-adapter'}),/parent/); + await assert.rejects(scaffoldSatellite({directory:existing+'/../escape',name:'test-adapter'}),/traversal/); + assert.equal(await readFile(join(existing,'sentinel'),'utf8'),'keep');assert.equal(await readFile(join(outside,'sentinel'),'utf8'),'outside'); + assert.deepEqual((await readdir(outside)).sort(),['sentinel']); +}); +test('configuration is snapshotted before filesystem awaits and accessors never execute',async t=>{ + const root=await temp(t),options={directory:join(root,'snapshot'),name:'original-adapter',integrations:['agentdb']}; + const pending=scaffoldSatellite(options);options.name='changed-adapter';options.integrations.push('ruvector'); + const result=await pending;assert.equal(result.name,'original-adapter'); + const manifest=JSON.parse(await readFile(join(result.directory,'constellation.json'),'utf8'));assert.deepEqual(manifest.integrations,['agentdb']); + let calls=0;const accessor={directory:join(root,'getter'),get name(){calls++;return 'bad';}}; + await assert.rejects(scaffoldSatellite(accessor));assert.equal(calls,0); + for(const name of ['../escape','BadName','a;$(id)'])await assert.rejects(scaffoldSatellite({directory:join(root,'bad'),name})); + await assert.rejects(scaffoldSatellite({directory:join(root,'bad'),name:'safe',exec:()=>{calls++;}}));assert.equal(calls,0); +}); +test('CLI scaffold handles literal shell metacharacters as path data without shell execution',async t=>{ + const root=await temp(t),directory=join(root,"literal;$(touch escaped)"); + const result=JSON.parse(execFileSync(process.execPath,[cli,'scaffold',directory,'--name','literal-adapter','--json'],{encoding:'utf8'})); + assert.equal(result.directory,directory);assert.deepEqual((await readdir(root)).sort(),["literal;$(touch escaped)"]); +}); +test('concurrent child directory symlink substitution cannot redirect writes outside the new target',{timeout:12000},async t=>{ + const root=await temp(t); + for(const child of ['src','test']) { + const target=join(root,`raced-${child}`),outside=join(root,`outside-${child}`);await mkdir(outside); + await writeFile(join(outside,'sentinel'),'keep'); + let readyResolve,resultResolve,rejectReady,rejectResult; + const ready=new Promise((resolve,reject)=>{readyResolve=resolve;rejectReady=reject;}); + const result=new Promise((resolve,reject)=>{resultResolve=resolve;rejectResult=reject;}); + const worker=new Worker(` + const {parentPort,workerData}=require('node:worker_threads'); + const fs=require('node:fs');const target=workerData.target+'/'+workerData.child; + parentPort.postMessage({ready:true});const deadline=Date.now()+5000;let swapped=false; + while(Date.now()message.ready?readyResolve():resultResolve(message)); + worker.on('error',error=>{rejectReady(error);rejectResult(error);}); + try { + await ready; + const scaffold=scaffoldSatellite({directory:target,name:'raced-adapter'}).then(value=>({ok:true,value}),error=>({ok:false,error})); + const attack=await result,outcome=await scaffold; + assert.equal(attack.swapped,true,'the worker actually replaced the created child directory'); + assert.equal(outcome.ok,false,'namespace substitution must fail scaffold acknowledgement'); + assert.deepEqual((await readdir(outside)).sort(),['sentinel']); + assert.equal(await readFile(join(outside,'sentinel'),'utf8'),'keep'); + } finally {await worker.terminate();} + } +}); +test('scaffolding fails before creating output when directory-descriptor support is unavailable',async t=>{ + const root=await temp(t),directory=join(root,'unsupported'); + const source=new URL('../src/index.js',import.meta.url).href; + const program=`Object.defineProperty(process,'platform',{value:'unsupported'}); const {readCatalog,scaffoldSatellite}=await import(${JSON.stringify(source)});await readCatalog(); try{await scaffoldSatellite({directory:${JSON.stringify(directory)},name:'adapter'});process.exitCode=2;}catch(error){if(!/requires Linux/.test(error.message))throw error;}`; + const output=spawnSync(process.execPath,['--input-type=module','-e',program],{encoding:'utf8'}); + assert.equal(output.status,0,output.stderr);assert.deepEqual(await readdir(root),[]); +}); diff --git a/packages/wsp-toolkit/packages/contracts/LICENSE b/packages/wsp-toolkit/packages/contracts/LICENSE new file mode 100644 index 000000000..2dd524ac3 --- /dev/null +++ b/packages/wsp-toolkit/packages/contracts/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 rUv + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/wsp-toolkit/packages/contracts/README.md b/packages/wsp-toolkit/packages/contracts/README.md new file mode 100644 index 000000000..c392cd554 --- /dev/null +++ b/packages/wsp-toolkit/packages/contracts/README.md @@ -0,0 +1,19 @@ +# ruvnet-constellation-contracts + +Dependency-free ESM metadata contracts for the constellation catalog and satellite module manifests. Node 20.9+ or browsers with `TextEncoder`/`URL`. This candidate has not been published. + +`validateCatalog(value)` and `validateModuleManifest(value)` return owned, validated JSON data. They reject unknown fields, accessors, sparse arrays, duplicate identifiers, unsafe npm names/paths/URLs, unversioned schema IDs and excessive data. A catalog can contain up to 1,000 packages and 64 profiles within a 2 MiB canonical byte budget. `published` is caller-supplied status; validation does not prove namespace ownership or check a registry. + +`CONTRACTS` names the existing WSP dense model, patch, evaluation, policy, dataset and finite-domain formats alongside the catalog/module metadata schemas. Versioned custom schema IDs are permitted; listing a contract does not establish behavioral compatibility. Real WSP validation, model hashing, evaluation and AgentDB revision authority remain separate. + +JSON Schema documents are exported under `ruvnet-constellation-contracts/schemas/`. `module.schema.json` and `catalog.schema.json` describe metadata structure; JavaScript additionally enforces cross-field references, aggregate byte budgets and safe own data properties. `wsp-references.schema.json` records canonical schema references without reimplementing numerical/model limits. + +No SDK, native driver, provider, telemetry collector, network client or install hook is included. + + + +Explore the [constellation onramp](../constellation/README.md) and [shared contracts](README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). + +These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. + + diff --git a/packages/wsp-toolkit/packages/contracts/constellation.json b/packages/wsp-toolkit/packages/contracts/constellation.json new file mode 100644 index 000000000..6e64dced3 --- /dev/null +++ b/packages/wsp-toolkit/packages/contracts/constellation.json @@ -0,0 +1,10 @@ +{ + "schema": "ruvnet.constellation-module/1", + "name": "ruvnet-constellation-contracts", + "version": "0.1.0", + "role": "primitive", + "contracts": [ + "ruvnet.constellation-module/1" + ], + "integrations": [] +} diff --git a/packages/wsp-toolkit/packages/contracts/package.json b/packages/wsp-toolkit/packages/contracts/package.json new file mode 100644 index 000000000..9835cdb3e --- /dev/null +++ b/packages/wsp-toolkit/packages/contracts/package.json @@ -0,0 +1,37 @@ +{ + "name": "ruvnet-constellation-contracts", + "version": "0.1.0", + "description": "Dependency-free bounded constellation catalog and module contracts", + "type": "module", + "main": "./src/index.js", + "types": "./src/index.d.ts", + "exports": { + ".": { + "types": "./src/index.d.ts", + "import": "./src/index.js" + }, + "./schemas/*": "./schemas/*" + }, + "files": [ + "src", + "schemas", + "README.md", + "LICENSE", + "constellation.json" + ], + "engines": { + "node": ">=20.9.0" + }, + "scripts": { + "test": "node --test test/*.test.mjs" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/ruvnet/ruv-FANN.git", + "directory": "packages/wsp-toolkit/packages/contracts" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/wsp-toolkit/packages/contracts/schemas/catalog.schema.json b/packages/wsp-toolkit/packages/contracts/schemas/catalog.schema.json new file mode 100644 index 000000000..9903bf14c --- /dev/null +++ b/packages/wsp-toolkit/packages/contracts/schemas/catalog.schema.json @@ -0,0 +1,169 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/ruvnet/ruv-FANN/packages/wsp-toolkit/packages/contracts/schemas/catalog.schema.json", + "title": "Constellation catalog", + "description": "Published status and proposed scopes are declarations, not verified namespace ownership. JS validates cross-references and aggregate byte budgets.", + "type": "object", + "additionalProperties": false, + "required": [ + "schema", + "repository", + "packages", + "profiles" + ], + "properties": { + "schema": { + "const": "ruvnet.constellation-catalog/1" + }, + "repository": { + "type": "string", + "maxLength": 201, + "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,99}/[A-Za-z0-9][A-Za-z0-9_.-]{0,99}$" + }, + "packages": { + "type": "array", + "minItems": 1, + "maxItems": 1000, + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "role", + "family", + "status", + "version", + "repository", + "description" + ], + "properties": { + "name": { + "type": "string", + "minLength": 1, + "maxLength": 214, + "pattern": "^(?:@[a-z0-9][a-z0-9._-]*/)?[a-z0-9][a-z0-9._-]*$", + "not": { + "enum": [ + "node_modules", + "favicon.ico" + ] + } + }, + "role": { + "enum": [ + "nucleus", + "primitive", + "satellite" + ] + }, + "family": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,47}$" + }, + "status": { + "enum": [ + "published", + "candidate" + ] + }, + "version": { + "type": "string", + "maxLength": 64, + "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-[A-Za-z0-9-]+(?:\\.[A-Za-z0-9-]+)*)?(?:\\+[A-Za-z0-9-]+(?:\\.[A-Za-z0-9-]+)*)?$" + }, + "repository": { + "type": "string", + "maxLength": 201, + "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,99}/[A-Za-z0-9][A-Za-z0-9_.-]{0,99}$" + }, + "description": { + "type": "string", + "minLength": 1, + "maxLength": 2000, + "pattern": "^[^\\u0000-\\u001f\\u007f]+$" + }, + "directory": { + "type": "string", + "maxLength": 512, + "pattern": "^(?!/)(?!.*(?:^|/)\\.{1,2}(?:/|$))[A-Za-z0-9_.-]+(?:/[A-Za-z0-9_.-]+)*$" + }, + "contracts": { + "type": "array", + "maxItems": 32, + "uniqueItems": true, + "items": { + "type": "string", + "maxLength": 128, + "pattern": "^[a-z][a-z0-9.-]*(?:/[a-z][a-z0-9.-]*)*/[1-9][0-9]*$" + } + }, + "proposedScope": { + "type": "string", + "maxLength": 100, + "pattern": "^@[a-z0-9][a-z0-9._-]*$" + }, + "links": { + "type": "object", + "minProperties": 1, + "additionalProperties": false, + "properties": { + "npm": { + "type": "string", + "maxLength": 2048, + "pattern": "^https://(?:www\\.)?npmjs\\.com/[^?\\s]*$" + }, + "source": { + "type": "string", + "maxLength": 2048, + "pattern": "^https://github\\.com/[^?\\s]*$" + } + } + } + } + } + }, + "profiles": { + "type": "array", + "maxItems": 64, + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "description", + "packages" + ], + "properties": { + "id": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,47}$" + }, + "description": { + "type": "string", + "minLength": 1, + "maxLength": 2000, + "pattern": "^[^\\u0000-\\u001f\\u007f]+$" + }, + "packages": { + "type": "array", + "minItems": 1, + "maxItems": 1000, + "uniqueItems": true, + "items": { + "type": "string", + "minLength": 1, + "maxLength": 214, + "pattern": "^(?:@[a-z0-9][a-z0-9._-]*/)?[a-z0-9][a-z0-9._-]*$", + "not": { + "enum": [ + "node_modules", + "favicon.ico" + ] + } + } + } + } + } + } + } +} diff --git a/packages/wsp-toolkit/packages/contracts/schemas/module.schema.json b/packages/wsp-toolkit/packages/contracts/schemas/module.schema.json new file mode 100644 index 000000000..74866ff6c --- /dev/null +++ b/packages/wsp-toolkit/packages/contracts/schemas/module.schema.json @@ -0,0 +1,73 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/ruvnet/ruv-FANN/packages/wsp-toolkit/packages/contracts/schemas/module.schema.json", + "title": "Constellation module metadata", + "description": "Metadata only. Does not validate numerical models, establish compatibility, or authorize publication.", + "type": "object", + "additionalProperties": false, + "required": [ + "schema", + "name", + "version", + "role", + "contracts", + "integrations" + ], + "properties": { + "schema": { + "const": "ruvnet.constellation-module/1" + }, + "name": { + "type": "string", + "minLength": 1, + "maxLength": 214, + "pattern": "^(?:@[a-z0-9][a-z0-9._-]*/)?[a-z0-9][a-z0-9._-]*$", + "not": { + "enum": [ + "node_modules", + "favicon.ico" + ] + } + }, + "version": { + "type": "string", + "maxLength": 64, + "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-[A-Za-z0-9-]+(?:\\.[A-Za-z0-9-]+)*)?(?:\\+[A-Za-z0-9-]+(?:\\.[A-Za-z0-9-]+)*)?$" + }, + "role": { + "enum": [ + "nucleus", + "primitive", + "satellite" + ] + }, + "contracts": { + "type": "array", + "maxItems": 32, + "uniqueItems": true, + "items": { + "type": "string", + "maxLength": 128, + "pattern": "^[a-z][a-z0-9.-]*(?:/[a-z][a-z0-9.-]*)*/[1-9][0-9]*$" + }, + "minItems": 1 + }, + "integrations": { + "type": "array", + "maxItems": 64, + "uniqueItems": true, + "items": { + "type": "string", + "minLength": 1, + "maxLength": 214, + "pattern": "^(?:@[a-z0-9][a-z0-9._-]*/)?[a-z0-9][a-z0-9._-]*$", + "not": { + "enum": [ + "node_modules", + "favicon.ico" + ] + } + } + } + } +} diff --git a/packages/wsp-toolkit/packages/contracts/schemas/wsp-references.schema.json b/packages/wsp-toolkit/packages/contracts/schemas/wsp-references.schema.json new file mode 100644 index 000000000..485366180 --- /dev/null +++ b/packages/wsp-toolkit/packages/contracts/schemas/wsp-references.schema.json @@ -0,0 +1,22 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://github.com/ruvnet/ruv-FANN/packages/wsp-toolkit/packages/contracts/schemas/wsp-references.schema.json", + "title": "Canonical WSP format identifiers", + "description": "Validates a reference identifier only, never a neural model, patch, or evaluation receipt. Use the WSP SDK for numerical limits and SHA-bound evaluation.", + "type": "string", + "enum": [ + "ruv-fann.dense-layers/1", + "ruv-fann.weight-patch/1", + "ruv-fann.weight-evaluation/1", + "ruv-fann.weight-dataset/1", + "ruv-fann.weight-policy/1", + "ruv-fann.invariants/1", + "ruv-fann.invariant-check/1", + "ruv-fann.evolution-loop/1" + ], + "x-canonicalSources": { + "model": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/core", + "patchAndEvaluation": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp", + "invariantsAndLoop": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit" + } +} diff --git a/packages/wsp-toolkit/packages/contracts/src/index.d.ts b/packages/wsp-toolkit/packages/contracts/src/index.d.ts new file mode 100644 index 000000000..19f4c53ba --- /dev/null +++ b/packages/wsp-toolkit/packages/contracts/src/index.d.ts @@ -0,0 +1,18 @@ +export type ConstellationRole = 'nucleus' | 'primitive' | 'satellite'; +export interface CatalogPackage { + name: string; role: ConstellationRole; family: string; status: 'published' | 'candidate'; version: string; + repository: string; description: string; directory?: string; contracts?: string[]; + links?: { npm?: string; source?: string }; proposedScope?: string; +} +export interface CatalogProfile { id: string; description: string; packages: string[] } +export interface ConstellationCatalog { schema: 'ruvnet.constellation-catalog/1'; repository: string; packages: CatalogPackage[]; profiles: CatalogProfile[] } +export interface ConstellationModuleManifest { schema: 'ruvnet.constellation-module/1'; name: string; version: string; role: ConstellationRole; contracts: string[]; integrations: string[] } +export const CONTRACTS: Readonly<{ + model: 'ruv-fann.dense-layers/1'; patch: 'ruv-fann.weight-patch/1'; evaluation: 'ruv-fann.weight-evaluation/1'; + dataset: 'ruv-fann.weight-dataset/1'; policy: 'ruv-fann.weight-policy/1'; invariants: 'ruv-fann.invariants/1'; + invariantCheck: 'ruv-fann.invariant-check/1'; loop: 'ruv-fann.evolution-loop/1'; + module: 'ruvnet.constellation-module/1'; catalog: 'ruvnet.constellation-catalog/1'; +}>; +export const CONTRACT_LIMITS: Readonly<{maxPackages: number; maxProfiles: number; maxContracts: number; maxIntegrations: number; maxBytes: number}>; +export function validateCatalog(value: unknown): ConstellationCatalog; +export function validateModuleManifest(value: unknown): ConstellationModuleManifest; diff --git a/packages/wsp-toolkit/packages/contracts/src/index.js b/packages/wsp-toolkit/packages/contracts/src/index.js new file mode 100644 index 000000000..57eae830e --- /dev/null +++ b/packages/wsp-toolkit/packages/contracts/src/index.js @@ -0,0 +1,153 @@ +/** Identifiers describe shared formats; numerical WSP validation remains authoritative. */ +export const CONTRACTS = Object.freeze({ + model: 'ruv-fann.dense-layers/1', patch: 'ruv-fann.weight-patch/1', + evaluation: 'ruv-fann.weight-evaluation/1', dataset: 'ruv-fann.weight-dataset/1', + policy: 'ruv-fann.weight-policy/1', invariants: 'ruv-fann.invariants/1', + invariantCheck: 'ruv-fann.invariant-check/1', loop: 'ruv-fann.evolution-loop/1', + module: 'ruvnet.constellation-module/1', catalog: 'ruvnet.constellation-catalog/1' +}); +export const CONTRACT_LIMITS = Object.freeze({ maxPackages: 1000, maxProfiles: 64, + maxContracts: 32, maxIntegrations: 64, maxBytes: 2 * 1024 * 1024 }); +const own = Object.getOwnPropertyDescriptor; +const npmPart = '[a-z0-9][a-z0-9._-]*'; +const npmPattern = new RegExp(`^(?:@${npmPart}/)?${npmPart}$`); +const roles = ['nucleus', 'primitive', 'satellite']; + +function record(value, allowed, required, name) { + if (!value || typeof value !== 'object' || Array.isArray(value) || + ![Object.prototype, null].includes(Object.getPrototypeOf(value))) throw new TypeError(`${name} must be a plain data record`); + const keys = Reflect.ownKeys(value), out = {}; + if (keys.length > allowed.length) throw new TypeError(`unknown ${name} fields`); + for (const key of keys) { + const property = own(value, key); + if (typeof key !== 'string' || !allowed.includes(key) || !property || !Object.hasOwn(property, 'value')) + throw new TypeError(`unknown ${name} field or accessor`); + out[key] = property.value; + } + if (required.some(key => !Object.hasOwn(out, key))) throw new TypeError(`missing ${name} field`); + return out; +} +function text(value, maximum, name, budget) { + if (typeof value !== 'string' || !value.length || value.length > maximum || /[\x00-\x1f\x7f]/.test(value)) + throw new TypeError(`${name} must be bounded nonempty text without control characters`); + budget?.(new TextEncoder().encode(value).length + 4); + return value; +} +function list(value, maximum, name, transform, minimum = 0) { + if (!Array.isArray(value) || Object.getPrototypeOf(value) !== Array.prototype) throw new TypeError(`${name} must be a plain array`); + const length = own(value, 'length')?.value; + if (!Number.isSafeInteger(length) || length < minimum || length > maximum) throw new RangeError(`${name} count exceeds limits`); + const keys = Reflect.ownKeys(value); + if (keys.length !== length + 1 || keys.some(key => key !== 'length' && + (typeof key !== 'string' || !/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= length))) throw new TypeError(`${name} must contain only dense data elements`); + const result = new Array(length); + for (let index = 0; index < length; index++) { + const property = own(value, String(index)); + if (!property || !Object.hasOwn(property, 'value')) throw new TypeError(`${name} accessors and holes are forbidden`); + result[index] = transform(property.value, index); + } + return result; +} +function unique(values, name) { + if (new Set(values).size !== values.length) throw new TypeError(`duplicate ${name}`); + return values; +} +function name(value, label, budget) { + const valueText = text(value, 214, label, budget); + if (!npmPattern.test(valueText) || ['node_modules', 'favicon.ico'].includes(valueText)) throw new TypeError(`${label} must be a safe lowercase npm name`); + return valueText; +} +function version(value, budget) { + const result = text(value, 64, 'version', budget); + const match = /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(?:-([A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*))?(?:\+([A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*))?$/.exec(result); + if (!match || match[4]?.split('.').some(part => /^[0-9]+$/.test(part) && part.length > 1 && part[0] === '0')) throw new TypeError('version must be exact SemVer'); + return result; +} +function repository(value, budget) { + const result = text(value, 201, 'repository', budget); + if (!/^[A-Za-z0-9][A-Za-z0-9_.-]{0,99}\/[A-Za-z0-9][A-Za-z0-9_.-]{0,99}$/.test(result) || result.split('/').some(part => part === '.' || part === '..')) + throw new TypeError('repository must be owner/name'); + return result; +} +function directory(value, budget) { + const result = text(value, 512, 'directory', budget); + if (result.split('/').some(part => !/^[A-Za-z0-9_.-]+$/.test(part) || part === '.' || part === '..')) throw new TypeError('directory must be a relative repository path without traversal'); + return result; +} +function contract(value, budget) { + const result = text(value, 128, 'contract identifier', budget); + if (!/^[a-z][a-z0-9.-]*(?:\/[a-z][a-z0-9.-]*)*\/[1-9][0-9]*$/.test(result)) throw new TypeError('contract identifier must be an explicit versioned schema ID'); + return result; +} +function links(value, budget) { + const raw = record(value, ['npm', 'source'], [], 'links'), result = {}; + if (!Object.keys(raw).length) throw new TypeError('links must declare npm or source'); + for (const key of ['npm', 'source']) if (Object.hasOwn(raw, key)) { + const item = text(raw[key], 2048, `${key} URL`, budget); + let url; + try { url = new URL(item); } catch { throw new TypeError('invalid link URL'); } + const hosts = key === 'npm' ? ['www.npmjs.com', 'npmjs.com'] : ['github.com']; + if (url.protocol !== 'https:' || !hosts.includes(url.hostname) || url.username || url.password || url.port || url.search) + throw new TypeError('catalog links must use approved HTTPS hosts without credentials or queries'); + result[key] = url.href; + } + return result; +} +function byteBudget() { + let estimated = 256; + return size => { estimated += size; if (estimated > CONTRACT_LIMITS.maxBytes) throw new RangeError('contract data exceeds byte budget'); }; +} +function finish(value) { + if (new TextEncoder().encode(JSON.stringify(value)).length > CONTRACT_LIMITS.maxBytes) throw new RangeError('contract data exceeds canonical byte budget'); + return value; +} + +/** Validate and own catalog data. Published status is a declaration, not proof of namespace ownership. */ +export function validateCatalog(value) { + const raw = record(value, ['schema', 'repository', 'packages', 'profiles'], ['schema', 'repository', 'packages', 'profiles'], 'catalog'); + if (raw.schema !== CONTRACTS.catalog) throw new TypeError('unsupported constellation catalog schema'); + const budget = byteBudget(), packages = list(raw.packages, CONTRACT_LIMITS.maxPackages, 'packages', value => { + const entry = record(value, ['name', 'role', 'family', 'status', 'version', 'repository', 'directory', 'description', 'contracts', 'links', 'proposedScope'], + ['name', 'role', 'family', 'status', 'version', 'repository', 'description'], 'package'); + if (!roles.includes(entry.role) || !['published', 'candidate'].includes(entry.status)) throw new TypeError('invalid package role or status'); + const family = text(entry.family, 48, 'family', budget); + if (!/^[a-z][a-z0-9-]{0,47}$/.test(family)) throw new TypeError('family must be a bounded lowercase identifier'); + const result = { name: name(entry.name, 'package name', budget), role: entry.role, family, status: entry.status, + version: version(entry.version, budget), repository: repository(entry.repository, budget), description: text(entry.description, 2000, 'description', budget) }; + if (Object.hasOwn(entry, 'directory')) result.directory = directory(entry.directory, budget); + if (Object.hasOwn(entry, 'contracts')) result.contracts = unique(list(entry.contracts, CONTRACT_LIMITS.maxContracts, 'contracts', item => contract(item, budget)), 'contract identifiers'); + if (Object.hasOwn(entry, 'links')) result.links = links(entry.links, budget); + if (Object.hasOwn(entry, 'proposedScope')) { + const scope = text(entry.proposedScope, 100, 'proposed scope', budget); + if (!new RegExp(`^@${npmPart}$`).test(scope)) throw new TypeError('proposedScope must be an npm scope, not a published-name claim'); + result.proposedScope = scope; + } + budget(128); + return result; + }, 1); + unique(packages.map(entry => entry.name), 'package names'); + const known = new Set(packages.map(entry => entry.name)); + const profiles = list(raw.profiles, CONTRACT_LIMITS.maxProfiles, 'profiles', value => { + const entry = record(value, ['id', 'description', 'packages'], ['id', 'description', 'packages'], 'profile'); + const id = text(entry.id, 48, 'profile id', budget); + if (!/^[a-z][a-z0-9-]{0,47}$/.test(id)) throw new TypeError('invalid profile id'); + const members = unique(list(entry.packages, CONTRACT_LIMITS.maxPackages, 'profile packages', value => { + const member = name(value, 'profile package name', budget); + if (!known.has(member)) throw new TypeError('profile refers to an unknown package'); + return member; + }, 1), 'profile members'); + return { id, description: text(entry.description, 2000, 'profile description', budget), packages: members }; + }); + unique(profiles.map(profile => profile.id), 'profile ids'); + return finish({ schema: CONTRACTS.catalog, repository: repository(raw.repository, budget), packages, profiles }); +} + +/** Metadata contract only: does not evaluate a model, authorize promotion or prove compatibility. */ +export function validateModuleManifest(value) { + const raw = record(value, ['schema', 'name', 'version', 'role', 'contracts', 'integrations'], ['schema', 'name', 'version', 'role', 'contracts', 'integrations'], 'module manifest'); + if (raw.schema !== CONTRACTS.module || !roles.includes(raw.role)) throw new TypeError('unsupported module schema or role'); + const budget = byteBudget(); + return finish({ schema: CONTRACTS.module, name: name(raw.name, 'module name', budget), version: version(raw.version, budget), role: raw.role, + contracts: unique(list(raw.contracts, CONTRACT_LIMITS.maxContracts, 'contracts', item => contract(item, budget), 1), 'contract identifiers'), + integrations: unique(list(raw.integrations, CONTRACT_LIMITS.maxIntegrations, 'integrations', item => name(item, 'integration name', budget)), 'integrations') }); +} diff --git a/packages/wsp-toolkit/packages/contracts/test/contracts.test.mjs b/packages/wsp-toolkit/packages/contracts/test/contracts.test.mjs new file mode 100644 index 000000000..3d72888a8 --- /dev/null +++ b/packages/wsp-toolkit/packages/contracts/test/contracts.test.mjs @@ -0,0 +1,70 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import {readFile} from 'node:fs/promises'; +import {CONTRACTS,CONTRACT_LIMITS,validateCatalog,validateModuleManifest} from '../src/index.js'; +const module=()=>({schema:CONTRACTS.module,name:'@example/adapter',version:'0.1.0',role:'satellite',contracts:[CONTRACTS.model,CONTRACTS.patch],integrations:['agentdb']}); +const catalog=()=>({schema:CONTRACTS.catalog,repository:'example/repository',packages:[{name:'anchor',version:'1.2.3',role:'nucleus',family:'example',status:'published',repository:'example/repository',description:'Example anchor',links:{npm:'https://www.npmjs.com/package/anchor',source:'https://github.com/example/repository'},proposedScope:'@example'},{name:'candidate',version:'0.1.0',role:'satellite',family:'example',status:'candidate',repository:'example/repository',directory:'packages/candidate',description:'Local candidate',contracts:[CONTRACTS.module]}],profiles:[{id:'example',description:'Explicit selection',packages:['anchor','candidate']}]}); + +test('catalog/module contracts own the data and preserve status without claiming namespace authority',()=>{ + const input=catalog(),result=validateCatalog(input);input.packages[0].description='changed';input.profiles[0].packages.pop(); + assert.equal(result.packages[0].description,'Example anchor');assert.equal(result.profiles[0].packages.length,2); + assert.equal(result.packages[1].status,'candidate');assert.equal(result.packages[0].proposedScope,'@example'); + const source=module(),manifest=validateModuleManifest(source);source.contracts[0]='changed';source.integrations.push('other'); + assert.equal(manifest.contracts[0],CONTRACTS.model);assert.deepEqual(manifest.integrations,['agentdb']); +}); +test('the actual default catalog uses versioned contracts and known profile members',async()=>{ + const value=JSON.parse(await readFile(new URL('../../constellation/catalog.json',import.meta.url),'utf8')); + const result=validateCatalog(value); + assert.ok(result.packages.some(pkg=>pkg.name==='ruv-fann-wsp'&&pkg.status==='published')); + assert.ok(result.packages.some(pkg=>pkg.name==='ruvnet-constellation'&&pkg.status==='candidate')); + assert.ok(result.profiles.some(profile=>profile.id==='local-loop')); +}); +test('unknown fields, classes, getters, symbols and hostile arrays reject without invocation',()=>{ + let calls=0; + for(const mutate of [x=>x.unknown=true,x=>Object.defineProperty(x,'name',{get(){calls++;return 'bad';}}),x=>x[Symbol('extra')]=true, + x=>x.contracts=new Array(2),x=>Object.defineProperty(x.contracts,0,{get(){calls++;return CONTRACTS.model;}}), + x=>x.integrations[Symbol.iterator]=function*(){calls++;yield 'agentdb';}]) { + const input=module();mutate(input);assert.throws(()=>validateModuleManifest(input)); + } + class Custom{constructor(){Object.assign(this,module());}} + assert.throws(()=>validateModuleManifest(new Custom()));assert.equal(calls,0); +}); +test('safe lowercase names, SemVer, schema IDs and required fields fail closed',()=>{ + for(const name of ['BadName','../escape','@bad/../escape','a b','a;$(id)','_hidden','node_modules','favicon.ico','@/missing','@x/','a'.repeat(215)])assert.throws(()=>validateModuleManifest({...module(),name})); + for(const version of ['latest','1.0','01.2.3','1.2.3-alpha.01','1.2.3;cmd'])assert.throws(()=>validateModuleManifest({...module(),version})); + assert.equal(validateModuleManifest({...module(),version:'1.2.3-alpha.1+build.20'}).version,'1.2.3-alpha.1+build.20'); + for(const contracts of [[],['unversioned'],['javascript:bad/1'],[CONTRACTS.model,CONTRACTS.model]])assert.throws(()=>validateModuleManifest({...module(),contracts})); + for(const role of ['admin','unknown',null])assert.throws(()=>validateModuleManifest({...module(),role})); + const missing=module();delete missing.integrations;assert.throws(()=>validateModuleManifest(missing)); +}); +test('relative repository paths and approved HTTPS links reject traversal and credential-bearing URLs',()=>{ + for(const path of ['/etc/passwd','a/../b','../b','a/./b','a\\b','a//b','a/%2e%2e/b','https://other/path']) { + const input=catalog();input.packages[1].directory=path;assert.throws(()=>validateCatalog(input)); + } + for(const source of ['http://github.com/example/repository','https://evil.test','javascript:alert(1)','https://user:secret@github.com/example/repository','https://github.com:8443/example/repository','https://github.com/example/repository?token=example']) { + const input=catalog();input.packages[0].links.source=source;assert.throws(()=>validateCatalog(input)); + } + const input=catalog();input.packages[0].links.npm='https://github.com/elsewhere';assert.throws(()=>validateCatalog(input)); +}); +test('duplicate package/profile/member identities, invalid roles and unknown references reject',()=>{ + for(const mutate of [x=>x.packages.push(x.packages[0]),x=>x.profiles.push(x.profiles[0]),x=>x.profiles[0].packages.push('anchor'), + x=>x.profiles[0].packages.push('absent'),x=>x.packages[0].role='hidden',x=>x.packages[0].status='verified', + x=>x.profiles[0].id='bad:id',x=>x.packages[0].proposedScope='@example/name']) { + const input=catalog();mutate(input);assert.throws(()=>validateCatalog(input)); + } +}); +test('aggregate bounds reject before reading oversized array elements and limit text bytes',()=>{ + let calls=0;const value=catalog();value.packages=new Array(CONTRACT_LIMITS.maxPackages+1); + Object.defineProperty(value.packages,0,{get(){calls++;return catalog().packages[0];}}); + assert.throws(()=>validateCatalog(value));assert.equal(calls,0); + const large=catalog();large.packages=Array.from({length:1000},(_,index)=>({...large.packages[0],name:`pkg-${index}`,description:'界'.repeat(1000)})); + large.profiles=[];assert.throws(()=>validateCatalog(large),/byte/); +}); +test('schema references name canonical formats without claiming arbitrary model validation',async()=>{ + const moduleSchema=JSON.parse(await readFile(new URL('../schemas/module.schema.json',import.meta.url),'utf8')); + const catalogSchema=JSON.parse(await readFile(new URL('../schemas/catalog.schema.json',import.meta.url),'utf8')); + const refs=JSON.parse(await readFile(new URL('../schemas/wsp-references.schema.json',import.meta.url),'utf8')); + assert.equal(moduleSchema.properties.schema.const,CONTRACTS.module);assert.equal(catalogSchema.properties.schema.const,CONTRACTS.catalog); + assert.equal(moduleSchema.additionalProperties,false);assert.equal(catalogSchema.additionalProperties,false); + assert.ok(refs.enum.includes(CONTRACTS.model));assert.match(refs.description,/never a neural model/); +}); diff --git a/packages/wsp-toolkit/packages/huggingface/LICENSE b/packages/wsp-toolkit/packages/huggingface/LICENSE new file mode 100644 index 000000000..2dd524ac3 --- /dev/null +++ b/packages/wsp-toolkit/packages/huggingface/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 rUv + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/wsp-toolkit/packages/huggingface/README.md b/packages/wsp-toolkit/packages/huggingface/README.md new file mode 100644 index 000000000..e35e8d4f4 --- /dev/null +++ b/packages/wsp-toolkit/packages/huggingface/README.md @@ -0,0 +1,63 @@ +# ruv-fann-wsp-huggingface + +Load a public Hugging Face **dense-layers JSON** checkpoint using an immutable +commit revision and a caller-supplied SHA-256. The adapter verifies downloaded +bytes before parsing and validates the model with `ruv-fann-wsp@0.2.0`. + +```js +import { loadHubModel } from 'ruv-fann-wsp-huggingface'; + +const checkpoint = await loadHubModel({ + repo: 'your-owner/your-dense-model', + revision: '<40 lowercase hexadecimal commit characters>', + path: 'model.json', + sha256: '<64 lowercase hexadecimal raw-file digest characters>' +}); +console.log(checkpoint.inspection.baseHash); // Canonical WSP model hash. +``` + +Supply an independently reviewed digest and commit SHA in application +configuration. Neither metadata field establishes who authored the model. The +raw-file digest can differ from the canonical WSP model hash because whitespace +and absent zero biases affect file bytes. The returned provenance records both +through `provenance.sha256` and `inspection.baseHash`. + +`maxBytes` can tighten the 1 MiB download cap. `timeoutMs` defaults to 15000 and +cannot exceed 60000. `signal` supports cancellation. A trusted `fetch` function +can be injected for transport integration or deterministic contract tests; it +must honor `AbortSignal` and manual redirect mode. + +At most three redirects may stay on `https://huggingface.co`. Requests omit +cookies, credentials and referrers; this package accepts no API token. External +CDN/LFS redirects are rejected. Place a small JSON file directly in the Hub +repository rather than using LFS. Server-side integrity checks also require a +readable response stream; opaque browser redirects fail closed. + +`loadHubLinearHead(source, options?)` explicitly loads a different JSON format: +exactly `{ "weights": [/* nonempty finite numbers */], "bias": 0 }`. It interprets +these parameters as **one affine projection** `sum(weights[i] * input[i]) + bias` +and constructs a single-output `Linear` layer with steepness 1. Its result has +schema `ruv-fann.hub-linear-head/1` and `interpretation: 'affine-projection'`. +The same pinned download, digest, byte and redirect restrictions apply. Unknown +keys, nonfinite numbers and more than 65535 weights are rejected. The generic +`loadHubModel()` does not infer or convert this format automatically. + +This explicit affine interpretation does not reproduce the source model's +activations, feature extraction, preprocessing or complete inference pipeline, +and it establishes no task accuracy. Supply the appropriate feature vector and +independent evaluation cases for the behavior you intend to test. + +This adapter does not convert transformer checkpoints, load pickle, interpret +safetensors, call inference endpoints, upload repositories or promote patches. +Node.js 20.9+ and secure-context browsers with Web Crypto are supported. + +Run `npm test` inside this package after installing workspace dependencies. Tests +use injected transports and explicitly do not claim live Hub execution. + + + +Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). + +These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. + + diff --git a/packages/wsp-toolkit/packages/huggingface/constellation.json b/packages/wsp-toolkit/packages/huggingface/constellation.json new file mode 100644 index 000000000..a56f94b3d --- /dev/null +++ b/packages/wsp-toolkit/packages/huggingface/constellation.json @@ -0,0 +1,13 @@ +{ + "schema": "ruvnet.constellation-module/1", + "name": "ruv-fann-wsp-huggingface", + "version": "0.1.0", + "role": "satellite", + "contracts": [ + "ruvnet.constellation-module/1", + "ruv-fann.dense-layers/1" + ], + "integrations": [ + "ruv-fann-wsp" + ] +} diff --git a/packages/wsp-toolkit/packages/huggingface/package.json b/packages/wsp-toolkit/packages/huggingface/package.json new file mode 100644 index 000000000..45f6793a6 --- /dev/null +++ b/packages/wsp-toolkit/packages/huggingface/package.json @@ -0,0 +1,38 @@ +{ + "name": "ruv-fann-wsp-huggingface", + "version": "0.1.0", + "description": "Integrity-pinned public Hugging Face dense JSON checkpoints for ruv-FANN WSP", + "type": "module", + "main": "./src/index.js", + "types": "./src/index.d.ts", + "exports": { + ".": { + "types": "./src/index.d.ts", + "import": "./src/index.js" + } + }, + "files": [ + "src", + "README.md", + "LICENSE", + "constellation.json" + ], + "engines": { + "node": ">=20.9.0" + }, + "dependencies": { + "ruv-fann-wsp": "0.2.0" + }, + "scripts": { + "test": "node --test test/*.test.mjs" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/ruvnet/ruv-FANN.git", + "directory": "packages/wsp-toolkit/packages/huggingface" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/wsp-toolkit/packages/huggingface/src/index.d.ts b/packages/wsp-toolkit/packages/huggingface/src/index.d.ts new file mode 100644 index 000000000..726ba53ad --- /dev/null +++ b/packages/wsp-toolkit/packages/huggingface/src/index.d.ts @@ -0,0 +1,38 @@ +import type { DenseModel, WeightModelInspection } from 'ruv-fann-wsp'; + +export interface HubModelSource { + /** Public model repository in owner/name form. */ + repo: string; + /** Immutable lowercase 40-character commit SHA; branches and tags are rejected. */ + revision: string; + /** Relative .json file path. */ + path: string; + /** SHA-256 of the raw downloaded bytes, distinct from the canonical model hash. */ + sha256: string; + /** May tighten the 1 MiB maximum. */ + maxBytes?: number; +} +export interface HubLoadOptions { + /** Trusted fetch capability; defaults to globalThis.fetch. */ + fetch?: typeof globalThis.fetch; + signal?: AbortSignal; + /** Download deadline, 1..60000 ms; default 15000. */ + timeoutMs?: number; +} +export interface HubModel { + schema: 'ruv-fann.hub-model/1'; + model: DenseModel; + inspection: WeightModelInspection; + provenance: { repo: string; revision: string; path: string; sha256: string; bytes: number; url: string }; +} +/** Public dense-layers JSON only. At most three same-origin redirects, no cookies or tokens. */ +export function loadHubModel(source: HubModelSource, options?: HubLoadOptions): Promise; + +export interface HubLinearHead extends Omit { + schema: 'ruv-fann.hub-linear-head/1'; + interpretation: 'affine-projection'; +} +/** Strict {weights:number[],bias:number} → one Linear output with steepness 1. + * This affine projection does not reconstruct an originating model's activations or preprocessing. + */ +export function loadHubLinearHead(source: HubModelSource, options?: HubLoadOptions): Promise; diff --git a/packages/wsp-toolkit/packages/huggingface/src/index.js b/packages/wsp-toolkit/packages/huggingface/src/index.js new file mode 100644 index 000000000..0c24ae799 --- /dev/null +++ b/packages/wsp-toolkit/packages/huggingface/src/index.js @@ -0,0 +1,165 @@ +import { inspectWeightModel, WSP_LIMITS } from 'ruv-fann-wsp'; + +const ORIGIN = 'https://huggingface.co'; +const MAX_REDIRECTS = 3; +const MAX_TIMEOUT_MS = 60_000; + +function record(value, allowed, required, name) { + if (!value || typeof value !== 'object' || Array.isArray(value) || + ![Object.prototype, null].includes(Object.getPrototypeOf(value))) + throw new TypeError(`${name} must be a plain data object`); + const result = Object.create(null); + for (const key of Reflect.ownKeys(value)) { + const descriptor = Object.getOwnPropertyDescriptor(value, key); + if (typeof key !== 'string' || !allowed.includes(key) || !descriptor || !Object.hasOwn(descriptor, 'value')) + throw new TypeError(`${name} contains unknown fields or accessors`); + result[key] = descriptor.value; + } + if (required.some(key => !Object.hasOwn(result, key))) throw new TypeError(`missing ${name} field`); + return result; +} + +function snapshotSource(value) { + const source = record(value, ['repo', 'revision', 'path', 'sha256', 'maxBytes'], + ['repo', 'revision', 'path', 'sha256'], 'Hub source'); + if (typeof source.repo !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._-]{0,95}\/[A-Za-z0-9][A-Za-z0-9._-]{0,95}$/.test(source.repo)) + throw new TypeError('repo must be a Hugging Face owner/name'); + if (typeof source.revision !== 'string' || !/^[a-f0-9]{40}$/.test(source.revision)) + throw new TypeError('revision must be an immutable lowercase 40-character commit SHA'); + if (typeof source.sha256 !== 'string' || !/^[a-f0-9]{64}$/.test(source.sha256)) + throw new TypeError('sha256 must be a lowercase 64-character raw-file SHA-256'); + if (typeof source.path !== 'string' || source.path.length > 1024 || !source.path.endsWith('.json') || + source.path.split('/').some(part => !/^[A-Za-z0-9_.-]+$/.test(part) || part === '.' || part === '..')) + throw new TypeError('path must be a relative JSON file path without traversal or URL syntax'); + const maxBytes = source.maxBytes === undefined ? WSP_LIMITS.maxModelBytes : source.maxBytes; + if (!Number.isSafeInteger(maxBytes) || maxBytes < 1 || maxBytes > WSP_LIMITS.maxModelBytes) + throw new RangeError(`maxBytes must be in 1..${WSP_LIMITS.maxModelBytes}`); + return { repo: source.repo, revision: source.revision, path: source.path, sha256: source.sha256, maxBytes }; +} + +async function fileHash(bytes) { + let provider = globalThis.crypto; + if (!provider?.subtle && typeof process === 'object' && process.versions?.node) { + const moduleName = 'node:crypto'; + provider = (await import(moduleName)).webcrypto; + } + if (!provider?.subtle) throw new Error('WebCrypto is required in a secure context'); + const digest = await provider.subtle.digest('SHA-256', bytes); + return Array.from(new Uint8Array(digest), byte => byte.toString(16).padStart(2, '0')).join(''); +} + +async function readBytes(response, maximum) { + if (!response.body || typeof response.body.getReader !== 'function') throw new TypeError('Hub response requires a readable stream'); + const reader = response.body.getReader(); + try { + const length = response.headers.get('content-length'); + if (length !== null && (!/^\d+$/.test(length) || Number(length) > maximum)) + throw new RangeError('Hub response Content-Length exceeds the byte limit or is invalid'); + const bytes = new Uint8Array(maximum); + let count = 0; + for (;;) { + const { done, value } = await reader.read(); + if (done) break; + if (!(value instanceof Uint8Array)) throw new TypeError('Hub response stream must contain bytes'); + if (value.byteLength > maximum - count) throw new RangeError('Hub response exceeds the streamed byte limit'); + bytes.set(value, count); + count += value.byteLength; + } + return bytes.subarray(0, count); + } catch (error) { + await reader.cancel().catch(() => {}); + throw error; + } finally { reader.releaseLock(); } +} + +function redirectTarget(location, current) { + let target; + try { target = new URL(location, current); } catch { throw new TypeError('invalid Hub redirect'); } + if (target.origin !== ORIGIN || target.username || target.password || target.hash) + throw new TypeError('Hub redirects must stay on https://huggingface.co without credentials'); + return target.href; +} + +/** Common pinned public-JSON transport. No provider authentication or executable formats. */ +async function loadPinnedJSON(source, options = {}) { + // Snapshot every source/configuration field before the first await. + const pinned = snapshotSource(source); + const configuration = record(options, ['fetch', 'signal', 'timeoutMs'], [], 'Hub options'); + const fetcher = configuration.fetch === undefined ? globalThis.fetch : configuration.fetch; + if (typeof fetcher !== 'function') throw new TypeError('fetch must be a function'); + const timeoutMs = configuration.timeoutMs === undefined ? 15_000 : configuration.timeoutMs; + if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > MAX_TIMEOUT_MS) + throw new RangeError(`timeoutMs must be in 1..${MAX_TIMEOUT_MS}`); + const signal = configuration.signal; + if (signal !== undefined && !(signal instanceof AbortSignal)) throw new TypeError('signal must be an AbortSignal'); + const controller = new AbortController(); + const abort = () => controller.abort(signal.reason); + if (signal?.aborted) abort(); + else signal?.addEventListener('abort', abort, { once: true }); + const timer = setTimeout(() => controller.abort(new Error('Hub download timeout')), timeoutMs); + const url = `${ORIGIN}/${pinned.repo}/resolve/${pinned.revision}/${pinned.path.split('/').map(encodeURIComponent).join('/')}`; + let current = url; + try { + let response; + for (let redirects = 0; ; redirects++) { + controller.signal.throwIfAborted(); + response = await fetcher(current, { redirect: 'manual', credentials: 'omit', referrerPolicy: 'no-referrer', signal: controller.signal }); + if (!response || !response.headers || response.redirected || response.type === 'opaqueredirect') + throw new TypeError('fetch must expose manual redirect responses'); + if (response.url && new URL(response.url).origin !== ORIGIN) + throw new TypeError('unexpected cross-origin Hub response'); + if (response.status >= 300 && response.status < 400) { + await response.body?.cancel(); + const location = response.headers.get('location'); + if (!location || redirects >= MAX_REDIRECTS) throw new Error('Hub redirect is missing a location or exceeds the redirect limit'); + current = redirectTarget(location, current); + continue; + } + if (response.status !== 200) { + await response.body?.cancel(); + throw new Error(`Hub download failed with HTTP ${response.status}`); + } + break; + } + const bytes = await readBytes(response, pinned.maxBytes); + controller.signal.throwIfAborted(); + const sha256 = await fileHash(bytes); + if (sha256 !== pinned.sha256) throw new Error('Hub file SHA-256 mismatch'); + let text; + try { text = new TextDecoder('utf-8', { fatal: true }).decode(bytes); } + catch { throw new TypeError('Hub file must contain valid UTF-8'); } + const document = JSON.parse(text); + controller.signal.throwIfAborted(); + return { document, + provenance: { repo: pinned.repo, revision: pinned.revision, path: pinned.path, sha256, bytes: bytes.length, url } }; + } finally { + clearTimeout(timer); + signal?.removeEventListener('abort', abort); + } +} + + +/** Fetch and validate an already explicit ruv-fann.dense-layers/1 document. */ +export async function loadHubModel(source, options) { + const { document: model, provenance } = await loadPinnedJSON(source, options); + const inspection = await inspectWeightModel(model); + return { schema: 'ruv-fann.hub-model/1', model, inspection, provenance }; +} + +/** Explicit affine interpretation only: sum(weights[i]*input[i])+bias. */ +export async function loadHubLinearHead(source, options) { + const { document, provenance } = await loadPinnedJSON(source, options); + const head = record(document, ['weights', 'bias'], ['weights', 'bias'], 'linear head'); + if (!Array.isArray(head.weights) || head.weights.length < 1 || head.weights.length > WSP_LIMITS.maxParameters - 1) + throw new RangeError(`linear head weights must contain 1..${WSP_LIMITS.maxParameters - 1} values`); + const finite = value => { + if (typeof value !== 'number' || !Number.isFinite(value)) throw new TypeError('linear head parameters must be finite numbers'); + return value === 0 ? 0 : value; + }; + const weights = head.weights.map(finite), bias = finite(head.bias); + const model = { schema: 'ruv-fann.dense-layers/1', layers: [{ + inputs: weights.length, outputs: 1, weights, bias: [bias], activation: 'Linear', steepness: 1 + }] }; + const inspection = await inspectWeightModel(model); + return { schema: 'ruv-fann.hub-linear-head/1', interpretation: 'affine-projection', model, inspection, provenance }; +} diff --git a/packages/wsp-toolkit/packages/huggingface/test/hub.test.mjs b/packages/wsp-toolkit/packages/huggingface/test/hub.test.mjs new file mode 100644 index 000000000..40da03148 --- /dev/null +++ b/packages/wsp-toolkit/packages/huggingface/test/hub.test.mjs @@ -0,0 +1,210 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { createHash } from 'node:crypto'; +import { loadHubModel, loadHubLinearHead } from '../src/index.js'; +import { traceWeightModel } from 'ruv-fann-wsp'; + +const model = { schema: 'ruv-fann.dense-layers/1', layers: [ + { inputs: 1, outputs: 1, weights: [2], bias: [0], activation: 'Linear', steepness: 1 } +] }; +const encode = value => new TextEncoder().encode(value); +const digest = bytes => createHash('sha256').update(bytes).digest('hex'); +const payload = encode(JSON.stringify(model, null, 2)); +const source = (bytes = payload) => ({ repo: 'example/dense', revision: 'a'.repeat(40), path: 'checkpoints/model.json', sha256: digest(bytes) }); +const response = bytes => new Response(bytes, { status: 200, headers: { 'content-type': 'text/plain' } }); + +// These are contract tests against an injectable transport, not a live Hub receipt. +test('loads raw-byte pinned JSON, validates model and records independent hashes', async () => { + let calls = 0; + const result = await loadHubModel(source(), { fetch: async (url, init) => { + calls++; + assert.equal(url, `https://huggingface.co/example/dense/resolve/${'a'.repeat(40)}/checkpoints/model.json`); + assert.equal(init.redirect, 'manual'); + assert.equal(init.credentials, 'omit'); + assert.equal(init.referrerPolicy, 'no-referrer'); + assert.ok(init.signal instanceof AbortSignal); + assert.equal(init.headers, undefined); + return response(payload); + } }); + assert.equal(calls, 1); + assert.deepEqual(result.model, model); + assert.equal(result.schema, 'ruv-fann.hub-model/1'); + assert.equal(result.provenance.sha256, digest(payload)); + assert.equal(result.provenance.bytes, payload.length); + assert.notEqual(result.provenance.sha256, result.inspection.baseHash); + assert.equal(result.inspection.parameterCount, 2); +}); + +test('source and options are snapshotted before fetch yields', async () => { + const mutable = source(), options = { timeoutMs: 1000 }; + options.fetch = async () => { + mutable.sha256 = 'f'.repeat(64); mutable.repo = 'evil/replacement'; mutable.revision = 'b'.repeat(40); + options.timeoutMs = 0; + return response(payload); + }; + const result = await loadHubModel(mutable, options); + assert.equal(result.provenance.repo, 'example/dense'); + assert.equal(result.provenance.revision, 'a'.repeat(40)); + assert.equal(result.provenance.sha256, digest(payload)); +}); + +test('rejects mutable revisions, traversal, URL syntax, credentials and raised limits before networking', async () => { + const mutations = [ + { revision: 'main' }, { revision: 'a'.repeat(39) }, { revision: 'A'.repeat(40) }, + { path: '../model.json' }, { path: 'a/../model.json' }, { path: '/model.json' }, + { path: 'a//model.json' }, { path: 'a\\model.json' }, { path: '%2e%2e/model.json' }, + { path: 'model.json?token=secret' }, { path: 'model.json#fragment' }, { path: 'model.safetensors' }, + { repo: 'https://evil.test/model' }, { repo: 'user/repo/extra' }, { repo: 'a@b/c' }, + { sha256: '' }, { sha256: 'A'.repeat(64) }, { maxBytes: 0 }, { maxBytes: 1024 * 1024 + 1 }, + { maxBytes: Infinity }, { headers: { Authorization: 'unused' } } + ]; + let called = false; + for (const fields of mutations) await assert.rejects(loadHubModel({ ...source(), ...fields }, { + fetch: async () => { called = true; return response(payload); } + })); + assert.equal(called, false); +}); + +test('rejects accessors and symbols without invoking application getters', async () => { + let reads = 0; + const spec = source(); + Object.defineProperty(spec, 'path', { get() { reads++; return 'model.json'; } }); + await assert.rejects(loadHubModel(spec), /accessors/); + await assert.rejects(loadHubModel(source(), { get fetch() { reads++; return async () => response(payload); } }), /accessors/); + const symbol = source(); symbol[Symbol('hidden')] = true; + await assert.rejects(loadHubModel(symbol), /unknown/); + assert.equal(reads, 0); +}); + +test('detects digest mismatch before decoding or parsing', async () => { + const invalid = encode('this is not JSON'); + await assert.rejects(loadHubModel(source(), { fetch: async () => response(invalid) }), /SHA-256 mismatch/); +}); + +test('rejects invalid UTF-8, malformed JSON and unsupported checkpoints after matching bytes', async () => { + const cases = [ + [new Uint8Array([0xc3, 0x28]), /valid UTF-8/], + [encode('{'), /JSON|position|property|end/i], + [encode('{"schema":"pytorch","state_dict":{}}'), /unknown|schema|missing/], + [encode(JSON.stringify({ ...model, ignored: true })), /unknown/], + [encode(JSON.stringify({ ...model, layers: [{ ...model.layers[0], weights: ['2'] }] })), /finite/] + ]; + for (const [bytes, pattern] of cases) + await assert.rejects(loadHubModel(source(bytes), { fetch: async () => response(bytes) }), pattern); +}); + +test('bounds declared Content-Length and cancels before reading', async () => { + let canceled = false; + const body = new ReadableStream({ cancel() { canceled = true; } }); + await assert.rejects(loadHubModel({ ...source(), maxBytes: 10 }, { + fetch: async () => new Response(body, { headers: { 'content-length': '1000000000' } }) + }), /Content-Length/); + assert.equal(canceled, true); +}); + +test('bounds streamed bytes with missing or misleading Content-Length', async () => { + for (const length of [undefined, '1']) { + let canceled = false; + const body = new ReadableStream({ start(controller) { + controller.enqueue(new Uint8Array(4)); controller.enqueue(new Uint8Array(7)); + }, cancel() { canceled = true; } }); + await assert.rejects(loadHubModel({ ...source(), maxBytes: 10 }, { + fetch: async () => new Response(body, { headers: length === undefined ? {} : { 'content-length': length } }) + }), /streamed byte limit/); + assert.equal(canceled, true); + } +}); + +test('permits bounded same-origin resolve-cache redirects and preserves immutable source URL', async () => { + const calls = []; + const result = await loadHubModel(source(), { fetch: async (url, init) => { + calls.push(url); assert.equal(init.credentials, 'omit'); + return calls.length === 1 ? new Response(null, { status: 307, headers: { location: '/api/resolve-cache/models/example/dense/file' } }) : response(payload); + } }); + assert.equal(calls.length, 2); + assert.match(calls[1], /^https:\/\/huggingface.co\/api\/resolve-cache\//); + assert.equal(result.provenance.url, calls[0]); +}); + +test('refuses cross-origin, credentialed, fragment and opaque redirects', async () => { + for (const location of ['https://cdn-lfs.hf.co/model.json', 'http://huggingface.co/model.json', + 'https://user:secret@huggingface.co/model.json', '/model.json#fragment']) { + let count = 0; + await assert.rejects(loadHubModel(source(), { fetch: async () => { + count++; return new Response(null, { status: 302, headers: { location } }); + } }), /redirects must stay/); + assert.equal(count, 1); + } + const followed = response(payload); Object.defineProperty(followed, 'redirected', { value: true }); + await assert.rejects(loadHubModel(source(), { fetch: async () => followed }), /manual redirect/); +}); + +test('rejects redirect loops, partial responses and failed fetches', async () => { + let calls = 0; + await assert.rejects(loadHubModel(source(), { fetch: async () => { + calls++; return new Response(null, { status: 307, headers: { location: '/loop' } }); + } }), /redirect limit/); + assert.equal(calls, 4); + for (const status of [206, 401, 404, 500]) await assert.rejects(loadHubModel(source(), { + fetch: async () => new Response(null, { status }) + }), new RegExp(`HTTP ${status}`)); + await assert.rejects(loadHubModel(source(), { fetch: async () => { throw new Error('offline'); } }), /offline/); +}); + +test('supports pre-abort and enforces a finite download deadline', async () => { + const controller = new AbortController(); controller.abort(new Error('cancelled')); + let called = false; + await assert.rejects(loadHubModel(source(), { signal: controller.signal, fetch: async () => { + called = true; return response(payload); + } }), /cancelled/); + assert.equal(called, false); + await assert.rejects(loadHubModel(source(), { timeoutMs: 5, fetch: async (_url, { signal }) => + new Promise((_resolve, reject) => signal.addEventListener('abort', () => reject(signal.reason), { once: true })) + }), /timeout/); + for (const timeoutMs of [0, 60_001, Infinity, 1.1]) + await assert.rejects(loadHubModel(source(), { timeoutMs }), /timeoutMs/); +}); + + +test('explicit linear-head adapter matches independent affine oracle using real WASM', async () => { + const bytes = encode(JSON.stringify({ weights: [2, -3, 0.5], bias: 4 })); + const result = await loadHubLinearHead(source(bytes), { fetch: async () => response(bytes) }); + assert.equal(result.schema, 'ruv-fann.hub-linear-head/1'); + assert.equal(result.interpretation, 'affine-projection'); + assert.equal(result.provenance.sha256, digest(bytes)); + assert.equal(result.inspection.inputSize, 3); + assert.equal(result.inspection.parameterCount, 4); + assert.deepEqual(result.model.layers[0], { inputs: 3, outputs: 1, weights: [2, -3, 0.5], bias: [4], activation: 'Linear', steepness: 1 }); + const inputs = [1, 2, 3, -2, 4, 0, 0, 0, 0]; + const trace = await traceWeightModel(result.model, { inputs, rows: 3 }, { simd: false }); + assert.equal(trace.backend, 'wasm'); + const oracle = [2 * 1 - 3 * 2 + 0.5 * 3 + 4, 2 * -2 - 3 * 4 + 0.5 * 0 + 4, 4]; + assert.deepEqual(trace.layers[0].preactivations, oracle); + assert.deepEqual(trace.layers[0].activations, oracle); + // The generic dense loader never silently infers this different document format. + await assert.rejects(loadHubModel(source(bytes), { fetch: async () => response(bytes) }), /unknown|missing/); +}); + +test('linear-head adapter rejects unknown fields, nonfinite parameters and invalid lengths', async () => { + const invalid = [ + '{"weights":[1],"bias":0,"activation":"Sigmoid"}', + '{"weights":[1]}', '{"weights":[],"bias":0}', + '{"weights":["1"],"bias":0}', '{"weights":[1e309],"bias":0}', + '{"weights":[1],"bias":1e309}', '{"weights":[1],"bias":null}', + '{"weights":null,"bias":0}', '{"weights":[1],"bias":[0]}', + JSON.stringify({ weights: Array(65536).fill(0), bias: 0 }) + ]; + for (const text of invalid) { + const bytes = encode(text); + await assert.rejects(loadHubLinearHead(source(bytes), { fetch: async () => response(bytes) })); + } +}); + +test('linear-head adapter shares digest, redirect and byte-limit enforcement', async () => { + const bytes = encode('{"weights":[1],"bias":0}'); + await assert.rejects(loadHubLinearHead(source(bytes), { fetch: async () => response(payload) }), /SHA-256 mismatch/); + await assert.rejects(loadHubLinearHead({ ...source(bytes), maxBytes: 1 }, { fetch: async () => response(bytes) }), /byte limit/); + await assert.rejects(loadHubLinearHead(source(bytes), { fetch: async () => new Response(null, { + status: 307, headers: { location: 'https://other.example/model.json' } + }) }), /redirects must stay/); +}); diff --git a/packages/wsp-toolkit/packages/invariants/LICENSE b/packages/wsp-toolkit/packages/invariants/LICENSE new file mode 100644 index 000000000..2dd524ac3 --- /dev/null +++ b/packages/wsp-toolkit/packages/invariants/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 rUv + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/wsp-toolkit/packages/invariants/README.md b/packages/wsp-toolkit/packages/invariants/README.md new file mode 100644 index 000000000..38f73fdd3 --- /dev/null +++ b/packages/wsp-toolkit/packages/invariants/README.md @@ -0,0 +1,39 @@ +# ruv-fann-wsp-invariants + +Bounded output constraints evaluated with real `ruv-fann@0.1.2` scalar/SIMD WebAssembly. ESM, Node 20.9+ and secure-context browsers; no gradients, providers or automatic promotion. + +```js +import { checkModelInvariants, createBooleanInvariant } from 'ruv-fann-wsp-invariants'; + +const suite = createBooleanInvariant({inputs: 2, outputs: 1, targets: [0, 1, 1, 0]}); +const result = await checkModelInvariants(candidateModel, suite, {simd: false}); +if (!result.accepted) console.log(result.violations); +``` + +`checkModelInvariants(model, suite, options?)` accepts a dense model object or JSON string and a suite: + +```js +{ + schema: 'ruv-fann.invariants/1', + cases: [{name: 'output-envelope', inputs: [0, 1, 2], rows: 3, + minimum: [0], maximum: [4], expected: [0, 2, 4], tolerance: 1e-12}] +} +``` + +Each case needs at least one of `minimum`, `maximum` or `expected`. Inclusive bounds have one value per model output; expected values are flattened row-major. Absolute tolerance applies only to expected values and defaults to zero. Names must be unique bounded ASCII identifiers. Caller-owned objects/arrays are copied before the first await. Unknown properties, accessors, sparse arrays, nonfinite numbers, mismatched dimensions and relaxed options are rejected. + +`estimateInvariantWork(model, suite)` synchronously validates the complete model and suite using the same structural, shape, name, tolerance and aggregate budget checks. It returns `parameterCount * sum(case.rows)` without inference, hashing or runtime initialization. A coordinator can reject malformed trusted criteria and reserve work before dispatching proposal workers. Numerical overflow is detected during the later real-WASM check. + +The receipt binds the canonical model hash and a suite hash including input/output dimensions. `checks` counts scalar comparisons; `violationCount` counts every failing comparison. At most 128 `{case,row,output,constraint,actual,bound}` entries are retained, with `truncatedViolations` signaling additional failures. Overflow/nonfinite inference fails closed with an exception. This evidence is caller-owned, unsigned and never authorizes promotion. + +There are at most 16 cases, 1,024 total rows, 131,072 scalar suite elements, 2 MiB canonical suite JSON and 10 million aggregate `parameterCount * rows` operations. Model limits come from WSP. Each case uses one full-model inference pass in bounded batches of 32, and every prepared resource is disposed on success and failure. No layer-by-layer trace storage is retained. + +`createBooleanInvariant({inputs, outputs, targets, tolerance?})` enumerates every input in a complete 1..6-bit domain, in most-significant-bit-first order. It returns one `boolean-domain` case. Outputs must be a complete numeric 0/1 truth table, up to 16 outputs. A zero-tolerance passing check exhausts that finite binary domain. It provides no guarantee for nonbinary inputs, physical deployment conditions, unseen distributions or alignment. Choose protected independent cases and a promotion authority outside the proposal workers; cryptographic integrity does not establish behavioral safety. + + + +Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). + +These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. + + diff --git a/packages/wsp-toolkit/packages/invariants/constellation.json b/packages/wsp-toolkit/packages/invariants/constellation.json new file mode 100644 index 000000000..6d7dc216c --- /dev/null +++ b/packages/wsp-toolkit/packages/invariants/constellation.json @@ -0,0 +1,14 @@ +{ + "schema": "ruvnet.constellation-module/1", + "name": "ruv-fann-wsp-invariants", + "version": "0.1.0", + "role": "satellite", + "contracts": [ + "ruvnet.constellation-module/1", + "ruv-fann.dense-layers/1" + ], + "integrations": [ + "ruv-fann", + "ruv-fann-wsp" + ] +} diff --git a/packages/wsp-toolkit/packages/invariants/package.json b/packages/wsp-toolkit/packages/invariants/package.json new file mode 100644 index 000000000..7c49c940a --- /dev/null +++ b/packages/wsp-toolkit/packages/invariants/package.json @@ -0,0 +1,39 @@ +{ + "name": "ruv-fann-wsp-invariants", + "version": "0.1.0", + "description": "Bounded real-WASM finite-domain output invariants for surgical weight evolution", + "type": "module", + "main": "./src/index.js", + "types": "./src/index.d.ts", + "exports": { + ".": { + "types": "./src/index.d.ts", + "import": "./src/index.js" + } + }, + "files": [ + "src", + "README.md", + "LICENSE", + "constellation.json" + ], + "engines": { + "node": ">=20.9.0" + }, + "dependencies": { + "ruv-fann-wsp": "0.2.0", + "ruv-fann": "0.1.2" + }, + "scripts": { + "test": "node --test test/*.test.mjs" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ruvnet/ruv-FANN.git", + "directory": "packages/wsp-toolkit/packages/invariants" + }, + "license": "MIT", + "publishConfig": { + "access": "public" + } +} diff --git a/packages/wsp-toolkit/packages/invariants/src/data.js b/packages/wsp-toolkit/packages/invariants/src/data.js new file mode 100644 index 000000000..3a0f0f2c1 --- /dev/null +++ b/packages/wsp-toolkit/packages/invariants/src/data.js @@ -0,0 +1,91 @@ +import { WSP_LIMITS } from 'ruv-fann-wsp'; + +export function record(value, allowed, required, name) { + if (!value || typeof value !== 'object' || Array.isArray(value) || + ![Object.prototype, null].includes(Object.getPrototypeOf(value))) throw new TypeError(`${name} must be a plain data object`); + const result = Object.create(null); + for (const key of Reflect.ownKeys(value)) { + if (typeof key !== 'string' || !allowed.includes(key)) throw new TypeError(`unknown ${name} field`); + const descriptor = Object.getOwnPropertyDescriptor(value, key); + if (!descriptor || !Object.hasOwn(descriptor, 'value')) throw new TypeError(`${name} accessors are forbidden`); + result[key] = descriptor.value; + } + if (required.some(key => !Object.hasOwn(result, key))) throw new TypeError(`missing ${name} field`); + return result; +} +export function integer(value, minimum, maximum, name) { + if (!Number.isSafeInteger(value) || value < minimum || value > maximum) throw new RangeError(`${name} must be an integer in ${minimum}..${maximum}`); + return value; +} +export function finite(value, name, minimum = -Number.MAX_VALUE, maximum = Number.MAX_VALUE) { + if (typeof value !== 'number' || !Number.isFinite(value) || value < minimum || value > maximum) + throw new RangeError(`${name} must be a finite number in bounds`); + return value === 0 ? 0 : value; +} +export function arrayLength(value, maximum, name) { + if (!Array.isArray(value) || ![Array.prototype, null].includes(Object.getPrototypeOf(value))) throw new TypeError(`${name} must be an array`); + const length = integer(Object.getOwnPropertyDescriptor(value, 'length')?.value, 0, maximum, `${name} length`); + for (const key of Reflect.ownKeys(value)) { + if (key !== 'length' && (typeof key !== 'string' || !/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= length)) + throw new TypeError(`${name} contains unknown array properties`); + } + return length; +} +export function element(value, index, name) { + const descriptor = Object.getOwnPropertyDescriptor(value, String(index)); + if (!descriptor || !Object.hasOwn(descriptor, 'value')) throw new TypeError(`${name} requires own dense data elements`); + return descriptor.value; +} +export function numbers(value, length, maximum, name, budget = () => {}) { + if (arrayLength(value, maximum, name) !== length) throw new RangeError(`${name} length disagrees with dimensions`); + const output = new Array(length); + for (let index = 0; index < length; index++) { + output[index] = finite(element(value, index, name), name); + budget(String(output[index]).length + 1); + } + return output; +} +const ACTIVATIONS = new Set(['Linear', 'Threshold', 'ThresholdSymmetric', 'Sigmoid', + 'SigmoidSymmetric', 'Tanh', 'Gaussian', 'GaussianSymmetric', 'Elliot', 'ElliotSymmetric', + 'LinearPiece', 'LinearPieceSymmetric', 'ReLU', 'ReLULeaky', 'Sin', 'Cos', 'SinSymmetric', + 'CosSymmetric', 'Gelu', 'Swish', 'LeakyRelu']); +export function modelSnapshot(value) { + if (typeof value === 'string') { + if (value.length > WSP_LIMITS.maxModelBytes || new TextEncoder().encode(value).length > WSP_LIMITS.maxModelBytes) + throw new RangeError('model exceeds byte limit'); + value = JSON.parse(value); + } + const raw = record(value, ['schema', 'layers'], ['schema', 'layers'], 'model'); + if (raw.schema !== 'ruv-fann.dense-layers/1') throw new TypeError('unsupported model schema'); + const count = integer(arrayLength(raw.layers, WSP_LIMITS.maxLayers, 'layers'), 1, WSP_LIMITS.maxLayers, 'layers'); + const layers = []; + let parameters = 0, previous, bytes = 48; + const budget = size => { bytes += size; if (bytes > WSP_LIMITS.maxModelBytes) throw new RangeError('model exceeds byte limit'); }; + for (let index = 0; index < count; index++) { + const layer = record(element(raw.layers, index, 'layers'), ['inputs', 'outputs', 'weights', 'bias', 'activation', 'steepness'], + ['inputs', 'outputs', 'weights', 'activation', 'steepness'], 'layer'); + const inputs = integer(layer.inputs, 1, WSP_LIMITS.maxDimension, 'inputs'); + const outputs = integer(layer.outputs, 1, WSP_LIMITS.maxDimension, 'outputs'); + if (previous !== undefined && previous !== inputs) throw new RangeError('adjacent layer dimensions disagree'); + previous = outputs; + parameters += inputs * outputs + outputs; + integer(parameters, 1, WSP_LIMITS.maxParameters, 'parameters'); + if (!ACTIVATIONS.has(layer.activation)) throw new TypeError('unsupported activation'); + const steepness = finite(layer.steepness, 'steepness'); + budget(160 + layer.activation.length + String(steepness).length); + const weights = numbers(layer.weights, inputs * outputs, WSP_LIMITS.maxParameters, 'weights', budget); + const bias = layer.bias === undefined || layer.bias === null ? Array(outputs).fill(0) : + numbers(layer.bias, outputs, WSP_LIMITS.maxParameters, 'bias', budget); + if (layer.bias === undefined || layer.bias === null) budget(outputs * 2); + layers.push({ inputs, outputs, weights, bias, activation: layer.activation, steepness }); + } + const model = { schema: raw.schema, layers }; + if (new TextEncoder().encode(JSON.stringify(model)).length > WSP_LIMITS.maxModelBytes) throw new RangeError('model exceeds canonical byte limit'); + return { model, parameters, inputSize: layers[0].inputs, outputSize: layers.at(-1).outputs }; +} +export function simdOptions(value = {}) { + const options = record(value, ['simd'], [], 'invariant options'); + const simd = options.simd === undefined ? 'auto' : options.simd; + if (simd !== true && simd !== false && simd !== 'auto') throw new TypeError('simd must be boolean or auto'); + return { simd }; +} diff --git a/packages/wsp-toolkit/packages/invariants/src/index.d.ts b/packages/wsp-toolkit/packages/invariants/src/index.d.ts new file mode 100644 index 000000000..70e90b248 --- /dev/null +++ b/packages/wsp-toolkit/packages/invariants/src/index.d.ts @@ -0,0 +1,62 @@ +import type { DenseModel } from 'ruv-fann-wsp'; + +export interface InvariantCase { + /** Unique 1..64 ASCII letters, digits, underscore, dot or hyphen. */ + name: string; + /** Flattened row-major inputs. */ + inputs: number[]; + rows: number; + /** Inclusive lower output bounds, one value per model output. */ + minimum?: number[]; + /** Inclusive upper output bounds, one value per model output. */ + maximum?: number[]; + /** Flattened row-major expected outputs. */ + expected?: number[]; + /** Absolute tolerance for expected outputs only; default 0. */ + tolerance?: number; +} +export interface InvariantSuite { + schema: 'ruv-fann.invariants/1'; + cases: InvariantCase[]; +} +export interface InvariantOptions { simd?: boolean | 'auto' } +export interface InvariantViolation { + case: string; + row: number; + output: number; + constraint: 'minimum' | 'maximum' | 'expected'; + actual: number; + /** Expected value for an expected-output constraint, otherwise its inclusive bound. */ + bound: number; +} +export interface InvariantCheck { + schema: 'ruv-fann.invariant-check/1'; + modelHash: string; + /** Hash of canonical suite plus the model's input/output dimensions. */ + suiteHash: string; + accepted: boolean; + /** Total scalar comparisons, including comparisons beyond the retained violation cap. */ + checks: number; + violations: InvariantViolation[]; + violationCount: number; + truncatedViolations: boolean; + backend: 'wasm' | 'wasm-simd'; + /** parameterCount * sum(case.rows), with one full-model inference pass per case. */ + work: number; +} +/** Synchronous complete model/suite preflight; no inference, hash or runtime initialization. */ +export function estimateInvariantWork(model: DenseModel | string, suite: InvariantSuite): number; +/** Finite-domain evidence only; no promotion authority or proof over arbitrary inputs. */ +export function checkModelInvariants(model: DenseModel | string, suite: InvariantSuite, options?: InvariantOptions): Promise; +export interface BooleanInvariant { + /** 1..6 input bits, most-significant-bit-first row order. */ + inputs: number; + /** 1..16 binary outputs. */ + outputs: number; + /** Complete flattened numeric 0/1 truth table, length (2 ** inputs) * outputs. */ + targets: number[]; + /** Absolute tolerance; default 0. */ + tolerance?: number; +} +export function createBooleanInvariant(table: BooleanInvariant): InvariantSuite; +export const INVARIANT_LIMITS: Readonly<{ maxCases: 16; maxRows: 1024; maxElements: 131072; maxWork: 10000000; maxSuiteBytes: number; maxViolations: 128 }>; diff --git a/packages/wsp-toolkit/packages/invariants/src/index.js b/packages/wsp-toolkit/packages/invariants/src/index.js new file mode 100644 index 000000000..7866089cb --- /dev/null +++ b/packages/wsp-toolkit/packages/invariants/src/index.js @@ -0,0 +1,127 @@ +import { loadRuntime } from 'ruv-fann'; +import { inspectWeightModel, WSP_LIMITS } from 'ruv-fann-wsp'; +import { record, integer, finite, arrayLength, element, numbers, modelSnapshot, simdOptions } from './data.js'; + +export const INVARIANT_LIMITS = Object.freeze({ maxCases: 16, maxRows: 1024, maxElements: 131072, + maxWork: 10_000_000, maxSuiteBytes: 2 * 1024 * 1024, maxViolations: 128 }); + +function suiteSnapshot(value, source) { + const raw = record(value, ['schema', 'cases'], ['schema', 'cases'], 'invariant suite'); + if (raw.schema !== 'ruv-fann.invariants/1') throw new TypeError('unsupported invariant suite schema'); + const count = integer(arrayLength(raw.cases, INVARIANT_LIMITS.maxCases, 'cases'), 1, INVARIANT_LIMITS.maxCases, 'cases'); + const pending = [], names = new Set(); + let rows = 0, elements = 0, work = 0; + // Reserve all aggregate work and scalar storage before copying case arrays. + for (let index = 0; index < count; index++) { + const item = record(element(raw.cases, index, 'cases'), ['name', 'inputs', 'rows', 'minimum', 'maximum', 'expected', 'tolerance'], + ['name', 'inputs', 'rows'], 'invariant case'); + if (typeof item.name !== 'string' || !/^[A-Za-z0-9_.-]{1,64}$/.test(item.name) || names.has(item.name)) + throw new TypeError('invariant names must be unique bounded identifiers'); + names.add(item.name); + const caseRows = integer(item.rows, 1, INVARIANT_LIMITS.maxRows, 'case rows'); + rows += caseRows; + if (rows > INVARIANT_LIMITS.maxRows) throw new RangeError('invariant suite exceeds aggregate row limit'); + work += caseRows * source.parameters; + if (work > INVARIANT_LIMITS.maxWork) throw new RangeError('invariant suite exceeds aggregate work limit'); + const constraints = ['minimum', 'maximum', 'expected'].filter(key => Object.hasOwn(item, key)); + if (!constraints.length) throw new TypeError('each invariant case requires at least one constraint'); + if (Object.hasOwn(item, 'tolerance') && !Object.hasOwn(item, 'expected')) throw new TypeError('tolerance requires expected outputs'); + const inputCount = caseRows * source.inputSize, outputCount = caseRows * source.outputSize; + elements += inputCount + (Object.hasOwn(item, 'expected') ? outputCount : 0) + + (Object.hasOwn(item, 'minimum') ? source.outputSize : 0) + (Object.hasOwn(item, 'maximum') ? source.outputSize : 0); + if (elements > INVARIANT_LIMITS.maxElements) throw new RangeError('invariant suite exceeds aggregate element limit'); + // Each output is materialized in a bounded batch and never retained in the receipt. + if (inputCount > WSP_LIMITS.maxElements || outputCount > WSP_LIMITS.maxElements) + throw new RangeError('invariant case exceeds scalar element limit'); + pending.push({ item, rows: caseRows, inputCount, outputCount }); + } + let bytes = 128; + const budget = size => { bytes += size; if (bytes > INVARIANT_LIMITS.maxSuiteBytes) throw new RangeError('invariant suite exceeds byte limit'); }; + const cases = pending.map(({ item, rows, inputCount, outputCount }) => { + budget(item.name.length + 128); + const result = { name: item.name, inputs: numbers(item.inputs, inputCount, WSP_LIMITS.maxElements, 'case inputs', budget), rows }; + for (const key of ['minimum', 'maximum', 'expected']) { + if (Object.hasOwn(item, key)) result[key] = numbers(item[key], key === 'expected' ? outputCount : source.outputSize, + WSP_LIMITS.maxElements, key, budget); + } + if (result.minimum && result.maximum && result.minimum.some((value, i) => value > result.maximum[i])) + throw new RangeError('minimum must not exceed maximum'); + if (result.expected) { + result.tolerance = item.tolerance === undefined ? 0 : finite(item.tolerance, 'tolerance', 0); + budget(String(result.tolerance).length); + } + return result; + }); + const canonical = { schema: raw.schema, inputSize: source.inputSize, outputSize: source.outputSize, cases }; + const json = JSON.stringify(canonical); + if (new TextEncoder().encode(json).length > INVARIANT_LIMITS.maxSuiteBytes) throw new RangeError('invariant suite exceeds canonical byte limit'); + return { cases, work, json }; +} +async function hashJSON(json) { + let provider = globalThis.crypto; + if (!provider?.subtle && typeof process === 'object' && process.versions?.node) { + const moduleName = 'node:crypto'; provider = (await import(moduleName)).webcrypto; + } + if (!provider?.subtle) throw new Error('secure-context WebCrypto is required'); + const bytes = await provider.subtle.digest('SHA-256', new TextEncoder().encode(json)); + return Array.from(new Uint8Array(bytes), byte => byte.toString(16).padStart(2, '0')).join(''); +} + +/** Pure synchronous preflight. Returns a work reservation after complete model/suite validation. */ +export function estimateInvariantWork(model, suite) { + const source = modelSnapshot(model); + return suiteSnapshot(suite, source).work; +} + +/** Finite-domain evidence only. This does not authorize promotion or prove arbitrary-input safety. */ +export async function checkModelInvariants(model, suite, options) { + // All caller-owned model/suite/configuration data is copied before yielding. + const source = modelSnapshot(model), preparedSuite = suiteSnapshot(suite, source), configuration = simdOptions(options); + const [inspection, suiteHash] = await Promise.all([inspectWeightModel(source.model), hashJSON(preparedSuite.json)]); + const runtime = await loadRuntime(configuration); + const violations = []; + let checks = 0, violationCount = 0; + const compare = (item, row, output, constraint, actual, bound, accepted) => { + checks++; + if (accepted) return; + violationCount++; + if (violations.length < INVARIANT_LIMITS.maxViolations) violations.push({ case: item.name, row, output, constraint, actual, bound }); + }; + for (const item of preparedSuite.cases) { + const batchRows = Math.min(32, item.rows); + const prepared = runtime.prepare(source.model, { maxRows: batchRows }); + try { + const inputs = Float64Array.from(item.inputs); + for (let first = 0; first < item.rows; first += batchRows) { + const rows = Math.min(batchRows, item.rows - first); + const predictions = prepared.predict(inputs.subarray(first * source.inputSize, (first + rows) * source.inputSize), rows); + for (let index = 0; index < predictions.length; index++) { + const actual = finite(predictions[index], 'invariant prediction'); + const row = first + Math.floor(index / source.outputSize), output = index % source.outputSize; + if (item.minimum) compare(item, row, output, 'minimum', actual, item.minimum[output], actual >= item.minimum[output]); + if (item.maximum) compare(item, row, output, 'maximum', actual, item.maximum[output], actual <= item.maximum[output]); + if (item.expected) { + const expected = item.expected[row * source.outputSize + output]; + const error = finite(Math.abs(actual - expected), 'invariant absolute error'); + compare(item, row, output, 'expected', actual, expected, error <= item.tolerance); + } + } + } + } finally { prepared.dispose(); } + } + return { schema: 'ruv-fann.invariant-check/1', modelHash: inspection.baseHash, suiteHash, accepted: violationCount === 0, + checks, violations, violationCount, truncatedViolations: violationCount > violations.length, backend: runtime.backend, work: preparedSuite.work }; +} + +/** Exhaustively enumerate 1..6 input bits in most-significant-bit-first order. */ +export function createBooleanInvariant(table) { + const raw = record(table, ['inputs', 'outputs', 'targets', 'tolerance'], ['inputs', 'outputs', 'targets'], 'Boolean invariant'); + const inputs = integer(raw.inputs, 1, 6, 'Boolean inputs'), outputs = integer(raw.outputs, 1, 16, 'Boolean outputs'); + const rows = 2 ** inputs; + const expected = numbers(raw.targets, rows * outputs, rows * outputs, 'Boolean targets'); + if (expected.some(value => value !== 0 && value !== 1)) throw new RangeError('Boolean targets must contain only numeric 0 or 1'); + const tolerance = raw.tolerance === undefined ? 0 : finite(raw.tolerance, 'Boolean tolerance', 0); + const values = []; + for (let row = 0; row < rows; row++) for (let bit = 0; bit < inputs; bit++) values.push((row >> (inputs - bit - 1)) & 1); + return { schema: 'ruv-fann.invariants/1', cases: [{ name: 'boolean-domain', inputs: values, rows, expected, tolerance }] }; +} diff --git a/packages/wsp-toolkit/packages/invariants/test/invariants.test.mjs b/packages/wsp-toolkit/packages/invariants/test/invariants.test.mjs new file mode 100644 index 000000000..22232e485 --- /dev/null +++ b/packages/wsp-toolkit/packages/invariants/test/invariants.test.mjs @@ -0,0 +1,154 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { fingerprintModel } from 'ruv-fann-wsp'; +import { checkModelInvariants, createBooleanInvariant, estimateInvariantWork, INVARIANT_LIMITS } from '../src/index.js'; +const linear = (weight = 2, bias = 0) => ({schema:'ruv-fann.dense-layers/1',layers:[ + {inputs:1,outputs:1,weights:[weight],bias:[bias],activation:'Linear',steepness:1} +]}); +const xor = (weights = [1,1]) => ({schema:'ruv-fann.dense-layers/1',layers:[ + {inputs:2,outputs:2,weights:[1,-1,-1,1],bias:[0,0],activation:'ReLU',steepness:1}, + {inputs:2,outputs:1,weights,bias:[0],activation:'Linear',steepness:1} +]}); +const suite = item => ({schema:'ruv-fann.invariants/1',cases:[item]}); +const affineCase = () => ({name:'affine',inputs:[0,1,2],rows:3,minimum:[0],maximum:[4],expected:[0,2,4]}); + +for (const simd of [false,true]) test(`full Boolean-domain oracle and independent regression rejection (SIMD=${simd})`, async () => { + const invariant = createBooleanInvariant({inputs:2,outputs:1,targets:[0,1,1,0]}); + assert.deepEqual(invariant.cases[0].inputs,[0,0,0,1,1,0,1,1]); + const accepted = await checkModelInvariants(xor(),invariant,{simd}); + assert.equal(accepted.accepted,true); + assert.equal(accepted.backend,simd?'wasm-simd':'wasm'); + assert.equal(accepted.checks,4); assert.equal(accepted.violationCount,0); + assert.equal(accepted.work,36); assert.equal(accepted.modelHash,await fingerprintModel(xor())); + const failed = await checkModelInvariants(xor([1,0]),invariant,{simd}); + assert.equal(failed.accepted,false); + assert.deepEqual(failed.violations,[{case:'boolean-domain',row:1,output:0,constraint:'expected',actual:0,bound:1}]); + assert.equal(failed.suiteHash,accepted.suiteHash); +}); + +test('affine bounds are inclusive; expected tolerance and multi-output batch ordering match an independent oracle', async () => { + const model={schema:'ruv-fann.dense-layers/1',layers:[{inputs:2,outputs:2,weights:[2,-1,0.5,3],bias:[1,-2],activation:'Linear',steepness:1}]}; + const inputs=Array.from({length:66},(_,index)=>index%7-3); + const expected=Array.from({length:33},(_,row)=>[2*inputs[2*row]-inputs[2*row+1]+1,0.5*inputs[2*row]+3*inputs[2*row+1]-2]).flat(); + const minimum=[Math.min(...expected.filter((_,i)=>i%2===0)),Math.min(...expected.filter((_,i)=>i%2===1))]; + const maximum=[Math.max(...expected.filter((_,i)=>i%2===0)),Math.max(...expected.filter((_,i)=>i%2===1))]; + const result=await checkModelInvariants(model,suite({name:'affine-oracle',inputs,rows:33,minimum,maximum,expected,tolerance:0}),{simd:false}); + assert.equal(result.accepted,true); assert.equal(result.checks,198); assert.equal(result.work,198); + const tolerant=await checkModelInvariants(linear(),suite({...affineCase(),expected:[0,2.001,4],tolerance:0.0011})); + assert.equal(tolerant.accepted,true); + const failed=await checkModelInvariants(linear(),suite({...affineCase(),expected:[0,2.001,4],tolerance:0.0009})); + assert.equal(failed.accepted,false);assert.equal(failed.violationCount,1); +}); + +test('independent cases catch a candidate whose development slice contains no weight information', async () => { + const development=suite({name:'development',inputs:[0],rows:1,expected:[0]}); + assert.equal((await checkModelInvariants(linear(99),development)).accepted,true); + const holdout=suite({name:'holdout',inputs:[1],rows:1,minimum:[1.9],maximum:[2.1]}); + const result=await checkModelInvariants(linear(99),holdout); + assert.equal(result.accepted,false); assert.equal(result.violations[0].constraint,'maximum'); +}); + +test('suite/model hashes normalize key order, absent zero bias, negative zero and default tolerance', async () => { + const first=linear(); const second={layers:[{activation:'Linear',steepness:1,weights:[2],outputs:1,inputs:1}],schema:'ruv-fann.dense-layers/1'}; + const a=await checkModelInvariants(first,suite(affineCase())); + const b=await checkModelInvariants(second,{cases:[{expected:[-0,2,4],maximum:[4],minimum:[-0],rows:3,inputs:[-0,1,2],name:'affine',tolerance:0}],schema:'ruv-fann.invariants/1'}); + assert.equal(a.modelHash,b.modelHash);assert.equal(a.suiteHash,b.suiteHash); + const changed=await checkModelInvariants(first,suite({...affineCase(),expected:[0,2,3.9]})); + assert.notEqual(a.suiteHash,changed.suiteHash); +}); + +test('all caller data is snapshotted before asynchronous work starts', async () => { + const model=linear(), value=suite(affineCase()), options={simd:false}; + const pending=checkModelInvariants(model,value,options); + model.layers[0].weights[0]=100;value.cases[0].inputs[1]=100;value.cases[0].expected[0]=100;options.simd=true; + const result=await pending;assert.equal(result.accepted,true);assert.equal(result.backend,'wasm'); + assert.equal(result.modelHash,await fingerprintModel(linear())); +}); + +test('violation retention is bounded while every scalar comparison is checked', async () => { + const result=await checkModelInvariants(linear(0),suite({name:'many',inputs:Array(1024).fill(0),rows:1024,expected:Array(1024).fill(1)})); + assert.equal(result.accepted,false);assert.equal(result.checks,1024);assert.equal(result.violationCount,1024); + assert.equal(result.violations.length,INVARIANT_LIMITS.maxViolations);assert.equal(result.truncatedViolations,true); + assert.equal(JSON.parse(JSON.stringify(result)).violationCount,1024); +}); + +test('plain data validation rejects unknown fields, getters and hostile arrays without invoking them', async () => { + let calls=0; + const withGetter=suite(affineCase());Object.defineProperty(withGetter.cases[0],'inputs',{get(){calls++;return [0,1,2];}}); + await assert.rejects(checkModelInvariants(linear(),withGetter),/accessors/); + const values=[0,1,2];Object.defineProperty(values,'0',{get(){calls++;return 0;}}); + await assert.rejects(checkModelInvariants(linear(),suite({...affineCase(),inputs:values})),/dense data/); + const model=linear();Object.defineProperty(model.layers[0],'weights',{get(){calls++;return [2];}}); + await assert.rejects(checkModelInvariants(model,suite(affineCase())),/accessors/); + const unknown=[0,1,2];unknown[Symbol.iterator]=function*(){calls++;yield 0;}; + await assert.rejects(checkModelInvariants(linear(),suite({...affineCase(),inputs:unknown})),/unknown array/); + assert.equal(calls,0); + await assert.rejects(checkModelInvariants(linear(),{...suite(affineCase()),provider:'remote'}),/unknown/); + await assert.rejects(checkModelInvariants(linear(),suite(affineCase()),{simd:false,maxWork:Infinity}),/unknown/); + await assert.rejects(checkModelInvariants(linear(),suite({...affineCase(),inputs:new Array(3)})),/dense data/); +}); + +test('malformed constraints, dimensions and nonfinite data fail closed', async () => { + for(const item of [ + {name:'empty',inputs:[0],rows:1}, {...affineCase(),minimum:[5]}, {...affineCase(),maximum:[Infinity]}, + {...affineCase(),expected:[0]}, {...affineCase(),minimum:[0,1]}, {...affineCase(),inputs:[0,NaN,2]}, + {...affineCase(),tolerance:-1}, {name:'tol',inputs:[0],rows:1,minimum:[0],tolerance:1}, + {...affineCase(),name:'invalid name'}, {...affineCase(),rows:0}, {...affineCase(),expected:null} + ])await assert.rejects(checkModelInvariants(linear(),suite(item))); + await assert.rejects(checkModelInvariants(linear(),{schema:'ruv-fann.invariants/1',cases:[affineCase(),affineCase()]}),/unique/); + await assert.rejects(checkModelInvariants(linear(),{schema:'ruv-fann.invariants/1',cases:[]}),/cases/); + await assert.rejects(checkModelInvariants(linear(),suite(affineCase()),{simd:'yes'}),/simd/); + await assert.rejects(checkModelInvariants({...linear(),schema:'other'},suite(affineCase())),/schema/); +}); + +test('aggregate rows, elements and work reject before reading adversarial input elements', async () => { + let calls=0;const hostile=[0];Object.defineProperty(hostile,'0',{get(){calls++;return 0;}}); + const cases=Array.from({length:16},(_,i)=>({name:`case${i}`,inputs:hostile,rows:65,minimum:[0]})); + await assert.rejects(checkModelInvariants(linear(),{schema:'ruv-fann.invariants/1',cases}),/aggregate row/); + const wide={schema:'ruv-fann.dense-layers/1',layers:[{inputs:1,outputs:10000,weights:Array(10000).fill(0),bias:Array(10000).fill(0),activation:'Linear',steepness:1}]}; + await assert.rejects(checkModelInvariants(wide,suite({name:'work',inputs:hostile,rows:501,minimum:[0]})),/aggregate work/); + const inputWide={schema:'ruv-fann.dense-layers/1',layers:[{inputs:128,outputs:1,weights:Array(128).fill(0),bias:[0],activation:'Linear',steepness:1}]}; + const elementCases=Array.from({length:4},(_,i)=>({name:`elements${i}`,inputs:hostile,rows:256,minimum:[0]})); + await assert.rejects(checkModelInvariants(inputWide,{schema:'ruv-fann.invariants/1',cases:elementCases}),/aggregate element/); + assert.equal(calls,0); +}); + +test('canonical model and suite byte limits reject finite but oversized data', async () => { + const long=Number.MAX_VALUE; + const model={schema:'ruv-fann.dense-layers/1',layers:[{inputs:65535,outputs:1,weights:Array(65535).fill(long),bias:[0],activation:'Linear',steepness:1}]}; + await assert.rejects(checkModelInvariants(model,suite({name:'unused',inputs:[0],rows:1,expected:[0]})),/model exceeds.*byte/); + const dense={schema:'ruv-fann.dense-layers/1',layers:[{inputs:64,outputs:64,weights:Array(4096).fill(0),bias:Array(64).fill(0),activation:'Linear',steepness:1}]}; + await assert.rejects(checkModelInvariants(dense,suite({name:'large',inputs:Array(65536).fill(long),rows:1024,expected:Array(65536).fill(long)})),/suite exceeds byte/); +}); + +test('overflow rejects, disposes prepared inference and subsequent checks stay healthy', async () => { + await assert.rejects(checkModelInvariants(linear(Number.MAX_VALUE,Number.MAX_VALUE),suite({name:'overflow',inputs:[1],rows:1,minimum:[0]})),/finite|overflow/); + await assert.rejects(checkModelInvariants(linear(Number.MAX_VALUE),suite({name:'error-overflow',inputs:[1],rows:1,expected:[-Number.MAX_VALUE]})),/finite/); + assert.equal((await checkModelInvariants(linear(),suite(affineCase()))).accepted,true); +}); + +test('Boolean helper enforces a complete small binary domain and owns caller targets', () => { + const targets=[0,1,1,0];const value=createBooleanInvariant({inputs:2,outputs:1,targets});targets[0]=1; + assert.equal(value.cases[0].expected[0],0); + for(const table of [{inputs:0,outputs:1,targets:[0]},{inputs:7,outputs:1,targets:[]},{inputs:1,outputs:17,targets:[]}, + {inputs:2,outputs:1,targets:[0,1]},{inputs:1,outputs:1,targets:[0,0.5]},{inputs:1,outputs:1,targets:[0,1],extra:true}, + {inputs:1,outputs:1,targets:[0,1],tolerance:Infinity}])assert.throws(()=>createBooleanInvariant(table)); + let calls=0;const hostile=[0,1];Object.defineProperty(hostile,'0',{get(){calls++;return 0;}}); + assert.throws(()=>createBooleanInvariant({inputs:1,outputs:1,targets:hostile}));assert.equal(calls,0); +}); + + +test('synchronous preflight reserves exact work and rejects malformed trusted criteria before inference', () => { + const cases = {schema:'ruv-fann.invariants/1',cases:[affineCase(),{name:'second',inputs:[3,4],rows:2,minimum:[0]}]}; + assert.equal(estimateInvariantWork(linear(),cases),10); // one weight + one bias, five total rows + // This model overflows actual inference, but planning performs no inference or metric calculation. + assert.equal(estimateInvariantWork(linear(Number.MAX_VALUE,Number.MAX_VALUE),suite({name:'plan-only',inputs:[1],rows:1,expected:[0]})),2); + for(const item of [{...affineCase(),name:''},{...affineCase(),name:'bad:name'}, + {...affineCase(),expected:[0,2]},{...affineCase(),minimum:[0,1]}, + {...affineCase(),tolerance:-1},{name:'unbound',inputs:[1],rows:1}, + {name:'tolerance-only',inputs:[1],rows:1,minimum:[0],tolerance:1}]) + assert.throws(()=>estimateInvariantWork(linear(),suite(item))); + assert.throws(()=>estimateInvariantWork(linear(),{schema:'ruv-fann.invariants/1',cases:[affineCase(),affineCase()]}),/unique/); + const wide={schema:'ruv-fann.dense-layers/1',layers:[{inputs:1,outputs:10000,weights:Array(10000).fill(0),bias:Array(10000).fill(0),activation:'Linear',steepness:1}]}; + assert.throws(()=>estimateInvariantWork(wide,suite({name:'work',inputs:[],rows:501,minimum:[]})),/aggregate work/); +}); diff --git a/packages/wsp-toolkit/packages/lifecycle/LICENSE b/packages/wsp-toolkit/packages/lifecycle/LICENSE new file mode 100644 index 000000000..2dd524ac3 --- /dev/null +++ b/packages/wsp-toolkit/packages/lifecycle/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 rUv + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/wsp-toolkit/packages/lifecycle/README.md b/packages/wsp-toolkit/packages/lifecycle/README.md new file mode 100644 index 000000000..a0fe30197 --- /dev/null +++ b/packages/wsp-toolkit/packages/lifecycle/README.md @@ -0,0 +1,15 @@ +# ruv-fann-wsp-lifecycle + +Multi-suite regression gates and in-memory candidate branch evaluation around `ruv-fann-wsp@0.2.0`. ESM; Node 20.9+; browser-compatible library, Node-only CLI. + +`runRegressionGate({model, patch, suites:[{name,dataset,policy}]}, options?)` returns hash-bound, real WASM evidence and accepts only if every suite accepts. A maximum of 16 suites, 2 MiB input and 10 million aggregate baseline/candidate parameter-row operations apply. `evaluatePatchBranches(model, patches, dataset, policy, options?)` evaluates at most 16 branches against the same snapshotted base, with the same aggregate budget. Sequential allocation bounds memory. Branches are data snapshots, not security sandboxes or separate runtime instances. + +`wsp-gate bundle.json` writes compact JSON evidence; exit 0 accepts, 1 rejects, 2 reports malformed input/runtime failure. This is suitable for a pull-request checkpoint gate. Evidence is not signed and cannot authorize promotion. Use the WSP workspace's internal proposal ID and expected revision for explicit promotion and monotonic rollback. Choose independent validation cases appropriate to the application; passing a small suite does not prove generalization or safety. + + + +Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). + +These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. + + diff --git a/packages/wsp-toolkit/packages/lifecycle/constellation.json b/packages/wsp-toolkit/packages/lifecycle/constellation.json new file mode 100644 index 000000000..147c9affe --- /dev/null +++ b/packages/wsp-toolkit/packages/lifecycle/constellation.json @@ -0,0 +1,15 @@ +{ + "schema": "ruvnet.constellation-module/1", + "name": "ruv-fann-wsp-lifecycle", + "version": "0.1.0", + "role": "satellite", + "contracts": [ + "ruvnet.constellation-module/1", + "ruv-fann.dense-layers/1", + "ruv-fann.weight-patch/1", + "ruv-fann.weight-evaluation/1" + ], + "integrations": [ + "ruv-fann-wsp" + ] +} diff --git a/packages/wsp-toolkit/packages/lifecycle/package.json b/packages/wsp-toolkit/packages/lifecycle/package.json new file mode 100644 index 000000000..d7848fd2a --- /dev/null +++ b/packages/wsp-toolkit/packages/lifecycle/package.json @@ -0,0 +1,36 @@ +{ + "name": "ruv-fann-wsp-lifecycle", + "version": "0.1.0", + "type": "module", + "description": "Bounded multi-suite regression gates and checkpoint branch evaluation for WSP", + "engines": { + "node": ">=20.9.0" + }, + "license": "MIT", + "exports": { + ".": { + "types": "./src/index.d.ts", + "import": "./src/index.js" + } + }, + "bin": { + "wsp-gate": "./src/cli.js" + }, + "files": [ + "src", + "README.md", + "LICENSE", + "constellation.json" + ], + "dependencies": { + "ruv-fann-wsp": "0.2.0" + }, + "scripts": { + "test": "node --test test/*.test.mjs" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ruvnet/ruv-FANN.git", + "directory": "packages/wsp-toolkit/packages/lifecycle" + } +} diff --git a/packages/wsp-toolkit/packages/lifecycle/src/cli.js b/packages/wsp-toolkit/packages/lifecycle/src/cli.js new file mode 100755 index 000000000..9337ddbe3 --- /dev/null +++ b/packages/wsp-toolkit/packages/lifecycle/src/cli.js @@ -0,0 +1,28 @@ +#!/usr/bin/env node +import { constants } from 'node:fs'; +import { open } from 'node:fs/promises'; +import { runRegressionGate, LIFECYCLE_LIMITS } from './index.js'; +try { + if (process.argv.length !== 3 || process.argv[2].startsWith('-')) throw new Error('usage: wsp-gate '); + const file = await open(process.argv[2], constants.O_RDONLY | constants.O_NONBLOCK); + let bytes; + try { + if (!(await file.stat()).isFile()) throw new Error('bundle must be a regular file'); + // Bounded read, including when the file grows after stat. + const buffer = Buffer.alloc(LIFECYCLE_LIMITS.maxBytes + 1); + let offset = 0; + while (offset < buffer.length) { + const { bytesRead } = await file.read(buffer, offset, buffer.length - offset, null); + if (!bytesRead) break; + offset += bytesRead; + } + if (offset > LIFECYCLE_LIMITS.maxBytes) throw new RangeError('bundle exceeds byte limit'); + bytes = buffer.subarray(0, offset); + } finally { await file.close(); } + const result = await runRegressionGate(JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes))); + process.stdout.write(`${JSON.stringify(result)}\n`); + process.exitCode = result.accepted ? 0 : 1; +} catch (error) { + process.stderr.write(`wsp-gate: ${error.message}\n`); + process.exitCode = 2; +} diff --git a/packages/wsp-toolkit/packages/lifecycle/src/index.d.ts b/packages/wsp-toolkit/packages/lifecycle/src/index.d.ts new file mode 100644 index 000000000..0fc92bb62 --- /dev/null +++ b/packages/wsp-toolkit/packages/lifecycle/src/index.d.ts @@ -0,0 +1,7 @@ +import type { DenseModel, WeightPatch, EvaluationDataset, EvaluationPolicy, EvaluationOptions, WeightEvaluation } from 'ruv-fann-wsp'; +export type GateEvaluation = Omit; +export interface RegressionSuite { name: string; dataset: EvaluationDataset; policy: EvaluationPolicy } +export interface RegressionGate { schema: 'ruv-fann.regression-gate/1'; baseHash: string; candidateHash: string; accepted: boolean; suites: { name: string; evaluation: GateEvaluation }[] } +export function runRegressionGate(bundle: {model: DenseModel | string; patch: WeightPatch; suites: RegressionSuite[]}, options?: EvaluationOptions): Promise; +export function evaluatePatchBranches(model: DenseModel | string, patches: WeightPatch[], dataset: EvaluationDataset, policy: EvaluationPolicy, options?: EvaluationOptions): Promise<{schema: 'ruv-fann.patch-branches/1'; baseHash: string; branches: {index: number; evaluation: WeightEvaluation}[]}>; +export const LIFECYCLE_LIMITS: Readonly<{maxSuites: number; maxBranches: number; maxBytes: number; maxTotalWork: number; maxTotalElements: number}>; diff --git a/packages/wsp-toolkit/packages/lifecycle/src/index.js b/packages/wsp-toolkit/packages/lifecycle/src/index.js new file mode 100644 index 000000000..46f811d34 --- /dev/null +++ b/packages/wsp-toolkit/packages/lifecycle/src/index.js @@ -0,0 +1,101 @@ +import { inspectWeightModel, evaluateWeightPatch, WSP_LIMITS } from 'ruv-fann-wsp'; + +export const LIFECYCLE_LIMITS = Object.freeze({ maxSuites: 16, maxBranches: 16, maxBytes: 2 * 1024 * 1024, + maxTotalWork: 10_000_000, maxTotalElements: 262144 }); + +// Copy only own data. Refuse getters, toJSON hooks, cycles and excessive trees. +function snapshot(value) { + let elements = 0, chars = 0; + const ancestors = new Set(); + function copy(item, depth) { + if (++elements > LIFECYCLE_LIMITS.maxTotalElements || depth > 16) throw new RangeError('input tree exceeds limits'); + if (item === null || typeof item === 'boolean') return item; + if (typeof item === 'number') { + if (!Number.isFinite(item)) throw new TypeError('input numbers must be finite'); + return item; + } + if (typeof item === 'string') { + chars += item.length; + if (chars > LIFECYCLE_LIMITS.maxBytes) throw new RangeError('input text exceeds limits'); + return item; + } + if (!item || typeof item !== 'object' || ancestors.has(item)) throw new TypeError('input must be an acyclic JSON data tree'); + const array = Array.isArray(item); + if (!(array ? Object.getPrototypeOf(item) === Array.prototype : + [Object.prototype, null].includes(Object.getPrototypeOf(item)))) throw new TypeError('input must contain plain data'); + ancestors.add(item); + const out = array ? [] : Object.create(null); + if (array && item.length > LIFECYCLE_LIMITS.maxTotalElements) throw new RangeError('array exceeds limits'); + for (const key of Reflect.ownKeys(item)) { + if (array && key === 'length') continue; + if (typeof key !== 'string' || key === '__proto__' || (array && !/^(0|[1-9][0-9]*)$/.test(key))) + throw new TypeError('unknown input property'); + const descriptor = Object.getOwnPropertyDescriptor(item, key); + if (!descriptor || !Object.hasOwn(descriptor, 'value')) throw new TypeError('input accessors are forbidden'); + chars += key.length; + if (chars > LIFECYCLE_LIMITS.maxBytes) throw new RangeError('input text exceeds limits'); + out[key] = copy(descriptor.value, depth + 1); + } + if (array && (out.length !== item.length || Object.keys(out).length !== item.length)) throw new TypeError('sparse input arrays are forbidden'); + ancestors.delete(item); + return out; + } + const result = copy(value, 0); + if (new TextEncoder().encode(JSON.stringify(result)).length > LIFECYCLE_LIMITS.maxBytes) throw new RangeError('input exceeds byte limit'); + return result; +} +function fields(value, allowed, required, label) { + if (!value || Array.isArray(value) || typeof value !== 'object' || Object.keys(value).some(k => !allowed.includes(k)) || + required.some(k => !Object.hasOwn(value, k))) throw new TypeError(`invalid ${label} fields`); +} +function count(value, max, label) { + if (!Array.isArray(value) || value.length < 1 || value.length > max) throw new RangeError(`invalid ${label} count`); +} +function budget(info, datasets, multiplicity = 1) { + let work = 0; + for (const dataset of datasets) { + if (!dataset || !Number.isSafeInteger(dataset.rows) || dataset.rows < 1 || dataset.rows > WSP_LIMITS.maxRows) + throw new RangeError('invalid dataset rows'); + work += 2 * info.parameterCount * dataset.rows * multiplicity; + } + if (work > LIFECYCLE_LIMITS.maxTotalWork) throw new RangeError('aggregate evaluation work exceeds limit'); +} +function receipt(evaluation) { + const { model: _model, patch: _patch, ...evidence } = evaluation; + return evidence; +} + +/** Check every named suite. This evidence never authorizes promotion. */ +export async function runRegressionGate(bundle, options) { + const input = snapshot(bundle), configuration = options === undefined ? undefined : snapshot(options); + fields(input, ['model', 'patch', 'suites'], ['model', 'patch', 'suites'], 'gate'); + count(input.suites, LIFECYCLE_LIMITS.maxSuites, 'suite'); + const names = new Set(); + for (const suite of input.suites) { + fields(suite, ['name', 'dataset', 'policy'], ['name', 'dataset', 'policy'], 'suite'); + if (typeof suite.name !== 'string' || !/^[a-zA-Z0-9_.-]{1,64}$/.test(suite.name) || names.has(suite.name)) + throw new TypeError('suite names must be unique bounded identifiers'); + names.add(suite.name); + } + const info = await inspectWeightModel(input.model); + budget(info, input.suites.map(s => s.dataset)); + const suites = []; + for (const suite of input.suites) suites.push({ name: suite.name, + evaluation: receipt(await evaluateWeightPatch(input.model, input.patch, suite.dataset, suite.policy, configuration)) }); + return { schema: 'ruv-fann.regression-gate/1', baseHash: info.baseHash, + candidateHash: suites[0].evaluation.candidateHash, accepted: suites.every(s => s.evaluation.accepted), suites }; +} + +/** Candidate branches share the same immutable base and cannot mutate a live workspace. */ +export async function evaluatePatchBranches(model, patches, dataset, policy, options) { + const input = snapshot({ model, patches, dataset, policy }); + const configuration = options === undefined ? undefined : snapshot(options); + count(input.patches, LIFECYCLE_LIMITS.maxBranches, 'branch'); + const info = await inspectWeightModel(input.model); + budget(info, [input.dataset], input.patches.length); + const branches = []; + // Sequential allocation keeps WASM memory bounded. This is not a security sandbox. + for (let index = 0; index < input.patches.length; index++) branches.push({ index, + evaluation: await evaluateWeightPatch(input.model, input.patches[index], input.dataset, input.policy, configuration) }); + return { schema: 'ruv-fann.patch-branches/1', baseHash: info.baseHash, branches }; +} diff --git a/packages/wsp-toolkit/packages/lifecycle/test/gate.test.mjs b/packages/wsp-toolkit/packages/lifecycle/test/gate.test.mjs new file mode 100644 index 000000000..97c6eba89 --- /dev/null +++ b/packages/wsp-toolkit/packages/lifecycle/test/gate.test.mjs @@ -0,0 +1,45 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { fingerprintModel } from 'ruv-fann-wsp'; +import { runRegressionGate, evaluatePatchBranches } from '../src/index.js'; +const model = () => ({ schema:'ruv-fann.dense-layers/1',layers:[{ inputs:1,outputs:1,weights:[0],bias:[0],activation:'Linear',steepness:1 }] }); +const data = () => ({inputs:[1,2],targets:[2,4],rows:2}); +const policy = {maxMSE:0,maxRegressionMSE:0}; +async function bundle(value=2) { const m=model(); return { model:m,patch:{schema:'ruv-fann.weight-patch/1',baseHash:await fingerprintModel(m),edits:[{layer:0,parameter:'weights',index:0,value}]}, + suites:[{name:'repair',dataset:data(),policy}] }; } + +test('all suites gate one hash-bound candidate and reject an independent regression', async () => { + const input=await bundle(); + const good=await runRegressionGate(input,{simd:false}); + assert.equal(good.accepted,true); assert.equal(good.suites[0].evaluation.candidate.mse,0); + assert.equal(good.suites[0].evaluation.backend,'wasm'); + assert.equal('model' in good.suites[0].evaluation,false); + input.suites.push({name:'holdout',dataset:{inputs:[1],targets:[0],rows:1},policy}); + const mixed=await runRegressionGate(input); + assert.equal(mixed.accepted,false); assert.equal(mixed.suites[0].evaluation.accepted,true); + assert.equal(mixed.suites[1].evaluation.candidateHash,mixed.candidateHash); +}); +test('branch candidates remain independent of one another and of the base', async () => { + const input=await bundle(), bad=structuredClone(input.patch); bad.edits[0].value=-1; + const result=await evaluatePatchBranches(input.model,[bad,input.patch],data(),policy); + assert.deepEqual(result.branches.map(b=>b.evaluation.accepted),[false,true]); + assert.equal(input.model.layers[0].weights[0],0); + result.branches[0].evaluation.model.layers[0].weights[0]=50; + assert.equal(result.branches[1].evaluation.model.layers[0].weights[0],2); +}); +test('snapshot isolation precedes async execution', async () => { + const input=await bundle(); const pending=runRegressionGate(input); + input.patch.edits[0].value=100; input.suites[0].dataset.targets[0]=-100; + assert.equal((await pending).accepted,true); +}); +test('reject malformed fields, forged base, accessors, sparse arrays and aggregate budgets', async () => { + for (const mutate of [x=>x.extra=true,x=>x.suites=[],x=>x.suites.push(x.suites[0]),x=>x.patch.baseHash='0'.repeat(64), + x=>x.suites[0].dataset.inputs=[1,Infinity],x=>x.suites=new Array(2),x=>Object.defineProperty(x,'patch',{get(){throw Error('getter executed');}})]) { + const input=await bundle(); mutate(input); await assert.rejects(runRegressionGate(input)); + } + const input=await bundle(); let calls=0; Object.defineProperty(input,'model',{get(){calls++;}}); + await assert.rejects(runRegressionGate(input),/accessors/); assert.equal(calls,0); + const large=model(); large.layers[0]={inputs:1,outputs:4096,weights:Array(4096).fill(0),bias:Array(4096).fill(0),activation:'Linear',steepness:1}; + const patch={schema:'ruv-fann.weight-patch/1',baseHash:await fingerprintModel(large),edits:[{layer:0,parameter:'weights',index:0,value:1}]}; + await assert.rejects(runRegressionGate({model:large,patch,suites:[{name:'large',dataset:{inputs:[],targets:[],rows:1024},policy}]}),/aggregate/); +}); diff --git a/packages/wsp-toolkit/packages/loop/LICENSE b/packages/wsp-toolkit/packages/loop/LICENSE new file mode 100644 index 000000000..2dd524ac3 --- /dev/null +++ b/packages/wsp-toolkit/packages/loop/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 rUv + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/wsp-toolkit/packages/loop/README.md b/packages/wsp-toolkit/packages/loop/README.md new file mode 100644 index 000000000..2ba4e34c4 --- /dev/null +++ b/packages/wsp-toolkit/packages/loop/README.md @@ -0,0 +1,40 @@ +# ruv-fann-wsp-loop + +A bounded, local autonomous weight-evolution coordinator. Fixed-operation worker threads propose patches; the coordinator independently evaluates trusted regression suites and output constraints; AgentDB's internal proposal IDs and expected revisions authorize local checkpoint promotion. The loop runs no generated code, provider requests, shell commands, public publishing or financial transactions. + +```js +import { runEvolutionLoop } from 'ruv-fann-wsp-loop'; +const report = await runEvolutionLoop({ + registry, // Caller-owned durable registry, e.g. ruv-fann-wsp-registry over AgentDB. + modules: [{ + id: 'router', + development: {dataset: developmentCases, policy}, + holdouts: [{name: 'heldout', dataset: heldoutCases, policy}], + invariants: outputConstraints, + strategies: [{name: 'coordinate-search', kind: 'search', options: { + locations: [{layer: 0, parameter: 'weights', index: 0, values: [0, 1, 2]}], + maxEvaluations: 8, maxPasses: 2 + }}] + }], + concurrency: 2, maxRounds: 4, maxProposals: 16, maxWork: 1_000_000, + jobTimeoutMs: 5000, maxDurationMs: 30000 +}); +``` + +The registry must already contain each module. The full module configuration is snapshotted before awaiting. Proposers receive the active model and development cases; held-out data and invariant definitions stay with the coordinator. A worker's score, acceptance flag or model never authorizes a commit. Each candidate is re-applied against the source hash, re-evaluated using real WASM, checked for strict development-loss improvement, and checked against the independent invariant suite. Duplicate candidate hashes share validation. Candidates are ranked within the same task by development MSE and stable hash/strategy tie-breaks; unrelated tasks are not compared by raw loss. + +Only then does the coordinator ask AgentDB to create a fresh stored proposal and promote it against the original revision. Stale proposals cannot replace newer state. No retry silently broadens the acceptance policy. The run stops at goals, lack of progress, round/proposal/work limits, cancellation or deadline. Registry or durability failures reject the run instead of becoming successful evolution reports. + +`reservedWork` is a conservative parameter-row upper bound: each scheduled proposal reserves its complete planned search, two-pass regression suites, one-pass output constraints, and a possible two-pass AgentDB evaluation. It counts unused reservations and is not a wall-clock measurement. Limits apply to one invocation; applications need a shared external budget authority for several coordinators. CPU time includes hashing, memory allocation, persistence and worker startup outside that arithmetic estimate. + +Abort/deadline stops new steps and terminates pending proposal workers. A registry operation already entered is awaited; an atomic commit already started can finish and is reported. Arbitrary injected registry I/O must honor its own operational timeouts. Worker threads run trusted shipped code with separate WASM instances; they are not hardened sandboxes. + +Output invariants provide finite-domain evidence. This package claims no universal alignment proof, physical actuation safety, arbitrary-model improvement, semantic routing, self-funding or decentralized consensus. The runnable toolkit demo shows actual AgentDB persistence, worker execution and rollback on small synthetic models. + + + +Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). + +These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. + + diff --git a/packages/wsp-toolkit/packages/loop/constellation.json b/packages/wsp-toolkit/packages/loop/constellation.json new file mode 100644 index 000000000..a65720961 --- /dev/null +++ b/packages/wsp-toolkit/packages/loop/constellation.json @@ -0,0 +1,18 @@ +{ + "schema": "ruvnet.constellation-module/1", + "name": "ruv-fann-wsp-loop", + "version": "0.1.0", + "role": "satellite", + "contracts": [ + "ruvnet.constellation-module/1", + "ruv-fann.dense-layers/1", + "ruv-fann.weight-patch/1", + "ruv-fann.weight-evaluation/1" + ], + "integrations": [ + "ruv-fann-wsp", + "ruv-fann-wsp-invariants", + "ruv-fann-wsp-lifecycle", + "ruv-fann-wsp-swarm" + ] +} diff --git a/packages/wsp-toolkit/packages/loop/package.json b/packages/wsp-toolkit/packages/loop/package.json new file mode 100644 index 000000000..b64b700d8 --- /dev/null +++ b/packages/wsp-toolkit/packages/loop/package.json @@ -0,0 +1,36 @@ +{ + "name": "ruv-fann-wsp-loop", + "version": "0.1.0", + "type": "module", + "license": "MIT", + "description": "Bounded autonomous weight evolution with worker swarms, independent gates and durable revision authority", + "engines": { + "node": ">=20.9.0" + }, + "exports": { + ".": { + "types": "./src/index.d.ts", + "import": "./src/index.js" + } + }, + "files": [ + "src", + "README.md", + "LICENSE", + "constellation.json" + ], + "dependencies": { + "ruv-fann-wsp": "0.2.0", + "ruv-fann-wsp-lifecycle": "0.1.0", + "ruv-fann-wsp-swarm": "0.1.0", + "ruv-fann-wsp-invariants": "0.1.0" + }, + "scripts": { + "test": "node --test test/*.test.mjs" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ruvnet/ruv-FANN.git", + "directory": "packages/wsp-toolkit/packages/loop" + } +} diff --git a/packages/wsp-toolkit/packages/loop/src/data.js b/packages/wsp-toolkit/packages/loop/src/data.js new file mode 100644 index 000000000..626d0435a --- /dev/null +++ b/packages/wsp-toolkit/packages/loop/src/data.js @@ -0,0 +1,73 @@ +export function record(value, allowed, required, name) { + if (!value || typeof value !== 'object' || Array.isArray(value) || ![Object.prototype,null].includes(Object.getPrototypeOf(value))) + throw new TypeError(`${name} must be a plain data object`); + const out=Object.create(null); + for(const key of Reflect.ownKeys(value)) { + const descriptor=Object.getOwnPropertyDescriptor(value,key); + if(typeof key!=='string'||!allowed.includes(key)||!descriptor||!Object.hasOwn(descriptor,'value'))throw new TypeError(`unknown field or accessor in ${name}`); + out[key]=descriptor.value; + } + if(required.some(key=>!Object.hasOwn(out,key)))throw new TypeError(`missing ${name} field`); + return out; +} +export function integer(value,min,max,name) { + if(!Number.isSafeInteger(value)||valuemax)throw new RangeError(`${name} must be an integer in ${min}..${max}`); + return value; +} +export function finite(value,min,name) { + if(typeof value!=='number'||!Number.isFinite(value)||value= ${min}`); + return value===0?0:value; +} +export function identifier(value,name) { + if(typeof value!=='string'||!/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,47}$/.test(value))throw new TypeError(`${name} must be a 1..48 character identifier`); + return value; +} +export function snapshot(value) { + const parents=new Set();let nodes=0,chars=0; + function copy(item,depth) { + if(++nodes>524288||depth>20)throw new RangeError('loop input tree exceeds limits'); + if(item===null||typeof item==='boolean')return item; + if(typeof item==='number')return finite(item,-Number.MAX_VALUE,'input'); + if(typeof item==='string') { + chars+=item.length;if(chars>10*1024*1024)throw new RangeError('loop input text exceeds limits'); + return item; + } + if(!item||typeof item!=='object'||parents.has(item))throw new TypeError('loop inputs must be acyclic JSON data'); + const array=Array.isArray(item); + if(!(array?Object.getPrototypeOf(item)===Array.prototype:[Object.prototype,null].includes(Object.getPrototypeOf(item))))throw new TypeError('loop inputs must be plain data'); + if(array&&item.length>262144)throw new RangeError('loop input array exceeds limits'); + const out=array?[]:Object.create(null);parents.add(item); + for(const key of Reflect.ownKeys(item)) { + if(array&&key==='length')continue; + if(typeof key!=='string'||['__proto__','prototype','constructor'].includes(key)||(array&&!/^(0|[1-9][0-9]*)$/.test(key)))throw new TypeError('unsafe loop input property'); + chars+=key.length;if(chars>10*1024*1024)throw new RangeError('loop input text exceeds limits'); + const descriptor=Object.getOwnPropertyDescriptor(item,key); + if(!descriptor||!Object.hasOwn(descriptor,'value'))throw new TypeError('loop input accessors are forbidden'); + out[key]=copy(descriptor.value,depth+1); + } + parents.delete(item); + if(array&&(out.length!==item.length||Object.keys(out).length!==item.length))throw new TypeError('loop arrays must be dense'); + return out; + } + const out=copy(value,0); + if(new TextEncoder().encode(JSON.stringify(out)).length>10*1024*1024)throw new RangeError('loop inputs exceed byte limit'); + return out; +} +export function dataset(value,name) { + const out=record(value,['inputs','targets','rows'],['inputs','targets','rows'],name); + integer(out.rows,1,1024,`${name} rows`); + for(const key of ['inputs','targets'])if(!Array.isArray(out[key])||out[key].length<1||out[key].length>65536)throw new RangeError(`${name} ${key} size invalid`); + return out; +} +export function policy(value) { + const out=record(value,['maxMSE','maxRegressionMSE','maxAbsoluteError'],['maxMSE','maxRegressionMSE'],'policy'); + finite(out.maxMSE,0,'maxMSE');finite(out.maxRegressionMSE,0,'maxRegressionMSE'); + if(out.maxAbsoluteError!==undefined)finite(out.maxAbsoluteError,0,'maxAbsoluteError'); + return out; +} +export function limits(value={}) { + const out=record(value,['maxEdits','maxAbsValue','maxAbsDelta'],[],'limits'); + if(out.maxEdits!==undefined)integer(out.maxEdits,1,128,'maxEdits'); + for(const [key,max]of [['maxAbsValue',1e6],['maxAbsDelta',1000]])if(out[key]!==undefined&&(finite(out[key],0,key)>max))throw new RangeError(`${key} cannot raise core limits`); + return out; +} diff --git a/packages/wsp-toolkit/packages/loop/src/index.d.ts b/packages/wsp-toolkit/packages/loop/src/index.d.ts new file mode 100644 index 000000000..4be941e1e --- /dev/null +++ b/packages/wsp-toolkit/packages/loop/src/index.d.ts @@ -0,0 +1,52 @@ +import type { DenseModel, WeightPatch, WeightEdit, EvaluationDataset, EvaluationPolicy, PatchLimits, WeightEvaluation } from 'ruv-fann-wsp'; +import type { SearchOptions } from 'ruv-fann-wsp-search'; +import type { InvariantSuite } from 'ruv-fann-wsp-invariants'; +export interface LoopProgram { revision: number; hash: string; model: DenseModel } +export interface LoopRegistry { + get(id: string): Promise; + propose(id: string, patch: WeightPatch, dataset: EvaluationDataset, policy: EvaluationPolicy): Promise<{revision: number; proposalId: string; evaluation: WeightEvaluation}>; + promote(id: string, proposalId: string, expectedRevision: number): Promise; +} +export interface LoopSuite { name: string; dataset: EvaluationDataset; policy: EvaluationPolicy } +export type LoopStrategy = { name: string; kind: 'search'; options: Omit } | {name: string; kind: 'patch'; edits: WeightEdit[]}; +export interface EvolutionModule { + id: string; + development: {dataset: EvaluationDataset; policy: EvaluationPolicy}; + /** Trusted coordinator inputs; these datasets are never dispatched to proposers. */ + holdouts: LoopSuite[]; + invariants: InvariantSuite; + strategies: LoopStrategy[]; + minImprovement?: number; + goalMSE?: number; + limits?: PatchLimits; +} +export interface EvolutionLoopOptions { + registry: LoopRegistry; + modules: EvolutionModule[]; + maxRounds?: number; + maxProposals?: number; + maxWork?: number; + concurrency?: number; + jobTimeoutMs?: number; + maxDurationMs?: number; + simd?: boolean | 'auto'; + signal?: AbortSignal; +} +export interface EvolutionEvent { + round: number; moduleId: string; revision: number; strategy: string; + type: 'worker-error' | 'no-candidate' | 'proposed' | 'duplicate' | 'rejected' | 'validated' | 'stale' | 'promoted'; + reason?: string; candidateHash?: string; baselineMSE?: number; candidateMSE?: number; nextRevision?: number; + failedSuites?: string[]; invariantSuiteHash?: string; + suiteHashes?: {name: string; datasetHash: string; policyHash: string}[]; +} +export interface EvolutionLoopReport { + schema: 'ruv-fann.evolution-loop/1'; + stopReason: 'round-limit' | 'proposal-limit' | 'work-limit' | 'deadline' | 'aborted' | 'goals-met' | 'no-progress'; + rounds: number; promotions: number; + budget: { maxRounds: number; maxProposals: number; maxWork: number; concurrency: number; jobTimeoutMs: number; maxDurationMs: number; proposals: number; reservedWork: number; elapsedMs: number }; + workerThreadIds: number[]; + modules: { id: string; initialRevision: number; initialHash: string; finalRevision: number; finalHash: string; promotions: number; goalReached: boolean }[]; + events: EvolutionEvent[]; +} +export const LOOP_LIMITS: Readonly<{maxModules: number; maxRounds: number; maxProposals: number; maxWork: number; maxConcurrency: number; maxDurationMs: number}>; +export function runEvolutionLoop(options: EvolutionLoopOptions): Promise; diff --git a/packages/wsp-toolkit/packages/loop/src/index.js b/packages/wsp-toolkit/packages/loop/src/index.js new file mode 100644 index 000000000..113199e38 --- /dev/null +++ b/packages/wsp-toolkit/packages/loop/src/index.js @@ -0,0 +1,221 @@ +import { inspectWeightModel, applyWeightPatch, fingerprintModel } from 'ruv-fann-wsp'; +import { runRegressionGate } from 'ruv-fann-wsp-lifecycle'; +import { runProposalSwarm } from 'ruv-fann-wsp-swarm'; +import { checkModelInvariants, estimateInvariantWork } from 'ruv-fann-wsp-invariants'; +import { record, integer, finite, identifier, snapshot, dataset, policy, limits } from './data.js'; + +export const LOOP_LIMITS=Object.freeze({maxModules:16,maxRounds:16,maxProposals:64,maxWork:100_000_000,maxConcurrency:4,maxDurationMs:300_000}); +function modulesSnapshot(value) { + const modules=snapshot(value); + if(!Array.isArray(modules)||modules.length<1||modules.length>LOOP_LIMITS.maxModules)throw new RangeError('modules must contain 1..16 entries'); + const ids=new Set(); + return modules.map(value=>{ + const item=record(value,['id','development','holdouts','invariants','strategies','minImprovement','goalMSE','limits'],['id','development','holdouts','invariants','strategies'],'module'); + const id=identifier(item.id,'module id');if(ids.has(id))throw new TypeError('duplicate module id');ids.add(id); + const dev=record(item.development,['dataset','policy'],['dataset','policy'],'development'); + const development={dataset:dataset(dev.dataset,'development dataset'),policy:policy(dev.policy)}; + if(!Array.isArray(item.holdouts)||item.holdouts.length<1||item.holdouts.length>15)throw new RangeError('each module requires 1..15 trusted holdout suites'); + const names=new Set(['development']); + const holdouts=item.holdouts.map(value=>{ + const suite=record(value,['name','dataset','policy'],['name','dataset','policy'],'holdout'); + const name=suite.name; + if(typeof name!=='string'||!/^[A-Za-z0-9_.-]{1,64}$/.test(name))throw new TypeError('invalid holdout suite name'); + if(names.has(name))throw new TypeError('duplicate suite name');names.add(name); + return {name,dataset:dataset(suite.dataset,'holdout dataset'),policy:policy(suite.policy)}; + }); + const invariant=record(item.invariants,['schema','cases'],['schema','cases'],'invariant suite'); + if(invariant.schema!=='ruv-fann.invariants/1'||!Array.isArray(invariant.cases)||invariant.cases.length<1||invariant.cases.length>16)throw new TypeError('invalid invariant suite'); + let invariantRows=0; + for(const value of invariant.cases) { + const c=record(value,['name','inputs','rows','minimum','maximum','expected','tolerance'],['name','inputs','rows'],'invariant case'); + invariantRows+=integer(c.rows,1,1024,'invariant rows'); + if(!Array.isArray(c.inputs)||c.inputs.length<1||c.inputs.length>65536)throw new RangeError('invalid invariant inputs'); + if(c.minimum===undefined&&c.maximum===undefined&&c.expected===undefined)throw new TypeError('invariant case needs an output constraint'); + } + if(invariantRows>1024)throw new RangeError('aggregate invariant rows exceed limit'); + if(!Array.isArray(item.strategies)||item.strategies.length<1||item.strategies.length>16)throw new RangeError('strategies must contain 1..16 entries'); + const strategyNames=new Set(); + const strategies=item.strategies.map(value=>{ + const strategy=record(value,['name','kind','options','edits'],['name','kind'],'strategy'); + const name=identifier(strategy.name,'strategy name');if(strategyNames.has(name))throw new TypeError('duplicate strategy name');strategyNames.add(name); + if(strategy.kind==='patch') { + if(strategy.options!==undefined||!Array.isArray(strategy.edits)||strategy.edits.length<1||strategy.edits.length>128)throw new TypeError('patch strategy needs 1..128 edits only'); + return {name,kind:'patch',edits:strategy.edits}; + } + if(strategy.kind!=='search'||strategy.edits!==undefined)throw new TypeError('unknown proposal strategy'); + const options=record(strategy.options,['locations','maxEvaluations','maxPasses','maxWork','simd','limits'],['locations'],'search strategy'); + if(!Array.isArray(options.locations)||options.locations.length<1||options.locations.length>16)throw new RangeError('search locations must contain 1..16 entries'); + for(const location of options.locations) { + const entry=record(location,['layer','parameter','index','values'],['layer','parameter','index','values'],'search location'); + integer(entry.layer,0,63,'location layer');integer(entry.index,0,65535,'location index'); + if(!['weights','bias'].includes(entry.parameter)||!Array.isArray(entry.values)||entry.values.length<1||entry.values.length>32)throw new TypeError('invalid search location'); + } + integer(options.maxEvaluations??64,1,256,'maxEvaluations');integer(options.maxPasses??4,1,16,'maxPasses'); + if(options.maxWork!==undefined)integer(options.maxWork,1,10_000_000,'search maxWork'); + if(options.simd!==undefined&&![true,false,'auto'].includes(options.simd))throw new TypeError('invalid search SIMD option'); + if(options.limits!==undefined)limits(options.limits); + return {name,kind:'search',options}; + }); + return {id,development,holdouts,invariants:invariant,invariantRows,strategies, + minImprovement:finite(item.minImprovement??0,0,'minImprovement'),goalMSE:finite(item.goalMSE??0,0,'goalMSE'),limits:limits(item.limits)}; + }); +} +function searchWork(strategy,parameters,rows) { + if(strategy.kind!=='search')return 0; + const opt=strategy.options; + const candidates=Math.min(opt.maxEvaluations??64,(opt.maxPasses??4)*opt.locations.reduce((sum,loc)=>sum+loc.values.length,0)); + const work=(candidates+3)*parameters*rows; + if(work>(opt.maxWork??10_000_000))throw new RangeError('search exceeds its work limit'); + return work; +} +function gateWork(module,parameters,invariantWork) { + // Every candidate reserves independent validation and a possible AgentDB re-evaluation. + const suiteRows=module.development.dataset.rows+module.holdouts.reduce((sum,s)=>sum+s.dataset.rows,0); + const work=2*suiteRows*parameters; + if(work>10_000_000)throw new RangeError('regression suites exceed aggregate work limit'); + if(invariantWork>10_000_000)throw new RangeError('invariants exceed aggregate work limit'); + return work+invariantWork+2*module.development.dataset.rows*parameters; +} +function cleanError(error) {return String(error?.message??error).slice(0,256);} + +/** Execute a finite local loop. Only trusted coordinator data can define acceptance criteria. */ +export async function runEvolutionLoop(configuration) { + const raw=record(configuration,['registry','modules','maxRounds','maxProposals','maxWork','concurrency','jobTimeoutMs','maxDurationMs','simd','signal'],['registry','modules'],'loop configuration'); + const registry=raw.registry; + for(const name of ['get','propose','promote'])if(typeof registry?.[name]!=='function')throw new TypeError(`registry.${name} capability is required`); + const modules=modulesSnapshot(raw.modules); + const budget={maxRounds:integer(raw.maxRounds??4,1,LOOP_LIMITS.maxRounds,'maxRounds'),maxProposals:integer(raw.maxProposals??32,1,LOOP_LIMITS.maxProposals,'maxProposals'), + maxWork:integer(raw.maxWork??LOOP_LIMITS.maxWork,1,LOOP_LIMITS.maxWork,'maxWork'),concurrency:integer(raw.concurrency??2,1,LOOP_LIMITS.maxConcurrency,'concurrency'), + jobTimeoutMs:integer(raw.jobTimeoutMs??10000,1,60000,'jobTimeoutMs'),maxDurationMs:integer(raw.maxDurationMs??60000,1,LOOP_LIMITS.maxDurationMs,'maxDurationMs')}; + const simd=raw.simd??'auto';if(![true,false,'auto'].includes(simd))throw new TypeError('simd must be boolean or auto'); + const signal=raw.signal;if(signal!==undefined&&!(signal instanceof AbortSignal))throw new TypeError('signal must be an AbortSignal'); + const controller=new AbortController();let abortReason='aborted'; + const abort=()=>controller.abort(signal?.reason); + if(signal?.aborted)abort();else signal?.addEventListener('abort',abort,{once:true}); + const started=performance.now(); + const timer=setTimeout(()=>{abortReason='deadline';controller.abort(new Error('loop deadline'));},budget.maxDurationMs); + const events=[],states=new Map(),threadIds=new Set();let proposals=0,reservedWork=0,rounds=0,promotions=0,stopReason='round-limit'; + let exhausted; + const interrupted=()=>{ + if(!controller.signal.aborted&&performance.now()-started>=budget.maxDurationMs){abortReason='deadline';controller.abort(new Error('loop deadline'));} + return controller.signal.aborted; + }; + const emit=event=>events.push(event); + const observe=(id,current)=>{ + const state=states.get(id); + if(state&¤t){if(state.finalHash!==current.hash)state.goalReached=false;state.finalRevision=current.revision;state.finalHash=current.hash;} + }; + try { + outer: for(let round=1;round<=budget.maxRounds;round++) { + if(interrupted()){stopReason=abortReason;break;} + rounds=round;let roundPromotions=0; + for(const module of modules) { + if(interrupted()){stopReason=abortReason;break outer;} + const source=await registry.get(module.id); + if(interrupted()){stopReason=abortReason;break outer;} + if(!source)throw new Error(`module ${module.id} is not registered`); + const info=await inspectWeightModel(source.model); + if(info.baseHash!==source.hash||!Number.isSafeInteger(source.revision)||source.revision<1)throw new Error('registry returned inconsistent model lineage'); + if(!states.has(module.id))states.set(module.id,{id:module.id,initialRevision:source.revision,initialHash:source.hash,finalRevision:source.revision,finalHash:source.hash,promotions:0,goalReached:false}); + else observe(module.id,source); + if(states.get(module.id).goalReached)continue; + for(const suite of [module.development,...module.holdouts]) { + if(suite.dataset.inputs.length!==suite.dataset.rows*info.inputSize||suite.dataset.targets.length!==suite.dataset.rows*info.outputSize)throw new RangeError('trusted suite dimensions disagree with module'); + } + const invariantWork=estimateInvariantWork(source.model,module.invariants); + const verificationWork=gateWork(module,info.parameterCount,invariantWork),jobs=[],strategies=[]; + for(const strategy of module.strategies) { + if(proposals>=budget.maxProposals){exhausted='proposal-limit';break;} + const work=searchWork(strategy,info.parameterCount,module.development.dataset.rows)+verificationWork; + if(reservedWork+work>budget.maxWork){exhausted='work-limit';break;} + proposals++;reservedWork+=work; + const id=`r${round}:${module.id}:${strategy.name}`; + jobs.push(strategy.kind==='patch'?{id,kind:'patch',patch:{schema:'ruv-fann.weight-patch/1',baseHash:source.hash,edits:strategy.edits}}: + {id,kind:'search',model:source.model,dataset:module.development.dataset,policy:module.development.policy, + searchOptions:{...strategy.options,simd:strategy.options.simd??simd}}); + strategies.push(strategy.name); + } + if(!jobs.length){stopReason=exhausted??'no-progress';break outer;} + const results=await runProposalSwarm(jobs,{concurrency:budget.concurrency,timeoutMs:budget.jobTimeoutMs,signal:controller.signal}); + if(interrupted()){stopReason=abortReason;break outer;} + if(!Array.isArray(results)||results.length!==jobs.length)throw new Error('swarm returned malformed result count'); + const candidates=[],seen=new Set(); + for(let index=0;index0)threadIds.add(result.workerThreadId); + if(result.status!=='ok'){emit({...context,type:'worker-error',reason:cleanError(result.error??result.status)});continue;} + if(!result.patch){emit({...context,type:'no-candidate'});continue;} + emit({...context,type:'proposed'}); + try { + // Never use a worker's score, acceptance flag or model as promotion evidence. + const model=await applyWeightPatch(source.model,result.patch,module.limits); + const candidateHash=await fingerprintModel(model); + if(seen.has(candidateHash)){emit({...context,type:'duplicate',candidateHash});continue;} + seen.add(candidateHash); + if(interrupted()){stopReason=abortReason;break outer;} + const gate=await runRegressionGate({model:source.model,patch:result.patch, + suites:[{name:'development',...module.development},...module.holdouts]},{simd,limits:module.limits}); + const development=gate.suites[0].evaluation; + if(!gate.accepted){emit({...context,type:'rejected',reason:'regression-gate',candidateHash, + failedSuites:gate.suites.filter(s=>!s.evaluation.accepted).map(s=>s.name)});continue;} + if(!(development.baseline.mse-development.candidate.mse>module.minImprovement)) { + emit({...context,type:'rejected',reason:'no-strict-improvement',candidateHash});continue; + } + if(interrupted()){stopReason=abortReason;break outer;} + const invariants=await checkModelInvariants(model,module.invariants,{simd}); + if(invariants.modelHash!==candidateHash||gate.candidateHash!==candidateHash||gate.baseHash!==source.hash)throw new Error('independent evidence hash mismatch'); + if(!invariants.accepted){emit({...context,type:'rejected',reason:'invariant-gate',candidateHash});continue;} + emit({...context,type:'validated',candidateHash,baselineMSE:development.baseline.mse,candidateMSE:development.candidate.mse, + suiteHashes:gate.suites.map(s=>({name:s.name,datasetHash:s.evaluation.datasetHash,policyHash:s.evaluation.policyHash})),invariantSuiteHash:invariants.suiteHash}); + candidates.push({strategy,patch:result.patch,candidateHash,score:development.candidate.mse}); + } catch(error) {emit({...context,type:'rejected',reason:cleanError(error)});} + } + candidates.sort((a,b)=>a.score-b.score||a.candidateHash.localeCompare(b.candidateHash)||a.strategy.localeCompare(b.strategy)); + const winner=candidates[0]; + if(winner&&!interrupted()) { + const context={round,moduleId:module.id,revision:source.revision,strategy:winner.strategy}; + let commitEntered=false; + try { + const current=await registry.get(module.id); + if(current?.revision!==source.revision||current?.hash!==source.hash){observe(module.id,current);emit({...context,type:'stale'});continue;} + if(interrupted()){stopReason=abortReason;break outer;} + const proposal=await registry.propose(module.id,winner.patch,module.development.dataset,module.development.policy); + if(interrupted()){stopReason=abortReason;break outer;} + if(proposal.revision!==source.revision||!proposal.evaluation?.accepted||proposal.evaluation.candidateHash!==winner.candidateHash) + throw new Error('registry proposal disagrees with independent evidence'); + // Abort prevents entering a commit. A commit already entered is awaited and reported. + commitEntered=true; + const next=await registry.promote(module.id,proposal.proposalId,source.revision); + if(next.hash!==winner.candidateHash||next.revision!==source.revision+1)throw new Error('registry promotion returned inconsistent lineage'); + const state=states.get(module.id);state.finalRevision=next.revision;state.finalHash=next.hash;state.promotions++; + state.goalReached=winner.score<=module.goalMSE;promotions++;roundPromotions++; + emit({...context,type:'promoted',nextRevision:next.revision,candidateHash:next.hash,candidateMSE:winner.score}); + } catch(error) { + if(error?.code==='WSP_REGISTRY_PERSISTENCE'||(commitEntered&&error?.code!=='WSP_REGISTRY_STALE'))throw error; + const current=await registry.get(module.id); + if(error?.code==='WSP_REGISTRY_STALE'||current?.revision!==source.revision||current?.hash!==source.hash){observe(module.id,current);emit({...context,type:'stale',reason:cleanError(error)});} + else throw error; // Durability/runtime failures cannot be hidden as rejected mutations. + } + } + } + if(interrupted()){stopReason=abortReason;break;} + if(exhausted){stopReason=exhausted;break;} + // Refresh behavioral goal evidence against active content before claiming convergence. + for(const state of states.values()) { + if(interrupted()){stopReason=abortReason;break outer;} + const current=await registry.get(state.id); + if(interrupted()){stopReason=abortReason;break outer;} + if(!current)throw new Error('registered module disappeared during loop'); + observe(state.id,current); + } + if(states.size===modules.length&&[...states.values()].every(s=>s.goalReached)){stopReason='goals-met';break;} + if(roundPromotions===0){stopReason='no-progress';break;} + } + return {schema:'ruv-fann.evolution-loop/1',stopReason,rounds,promotions, + budget:{...budget,proposals,reservedWork,elapsedMs:performance.now()-started}, + workerThreadIds:[...threadIds].sort((a,b)=>a-b),modules:[...states.values()],events}; + } finally {clearTimeout(timer);signal?.removeEventListener('abort',abort);} +} diff --git a/packages/wsp-toolkit/packages/loop/test/loop.test.mjs b/packages/wsp-toolkit/packages/loop/test/loop.test.mjs new file mode 100644 index 000000000..1d5296147 --- /dev/null +++ b/packages/wsp-toolkit/packages/loop/test/loop.test.mjs @@ -0,0 +1,155 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { mkdtemp,rm } from 'node:fs/promises'; +import { join } from 'node:path'; +import { tmpdir } from 'node:os'; +import { openDemoRegistry } from '../../../tooling/agentdb/runtime.mjs'; +import { fingerprintModel } from 'ruv-fann-wsp'; +import { createAgentDBRegistry } from 'ruv-fann-wsp-registry'; +import { runEvolutionLoop } from '../src/index.js'; +import { evolutionModels,evolutionModules,runEvolutionScenario } from '../../../test/evolution-scenario.mjs'; +async function setup(t) { + const dir=await mkdtemp(join(tmpdir(),'wsp-loop-')),registry=await openDemoRegistry(join(dir,'state.sqlite')); + await registry.create('xor',evolutionModels().xor); + t.after(async()=>{await registry.close();await rm(dir,{recursive:true,force:true});}); + return registry; +} + +test('real swarm loop rejects shortcuts, persists improvements and rolls back after restart',async()=>{ + const dir=await mkdtemp(join(tmpdir(),'wsp-loop-e2e-')); + try {const result=await runEvolutionScenario(openDemoRegistry,dir);assert.equal(result.report.promotions,2);assert.equal(result.durability.rollbackPersisted,true);} + finally {await rm(dir,{recursive:true,force:true});} +}); +test('proposal and work budgets stop without unreviewed model changes',async t=>{ + const registry=await setup(t),before=await registry.get('xor'); + const module=evolutionModules()[0]; + const limited=await runEvolutionLoop({registry,modules:[module],maxProposals:1,maxRounds:3,simd:false}); + assert.equal(limited.stopReason,'proposal-limit');assert.equal(limited.budget.proposals,1); + assert.equal(limited.promotions,0);assert.equal((await registry.get('xor')).hash,before.hash); + const work=await runEvolutionLoop({registry,modules:[module],maxWork:1}); + assert.equal(work.stopReason,'work-limit');assert.equal(work.budget.proposals,0);assert.equal(work.budget.reservedWork,0); +}); +test('finite-domain invariants independently reject a patch accepted by supplied MSE suites',async t=>{ + const registry=await setup(t),module=evolutionModules()[0]; + module.holdouts=[{name:'slice-agreement',...module.development}];module.strategies=[module.strategies[0]]; + const result=await runEvolutionLoop({registry,modules:[module],simd:false}); + assert.equal(result.promotions,0);assert.ok(result.events.some(e=>e.type==='rejected'&&e.reason==='invariant-gate')); + assert.equal((await registry.get('xor')).revision,1); +}); +test('configuration snapshots precede queueing and worker execution',async t=>{ + const registry=await setup(t),modules=[evolutionModules()[0]],pending=runEvolutionLoop({registry,modules,simd:false}); + modules[0].holdouts[0].dataset.targets.fill(100);modules[0].strategies[2].edits[0].value=100; + assert.equal((await pending).promotions,1);assert.equal((await registry.get('xor')).model.layers[1].weights[0],1); +}); +test('abort and deadline terminate workers and prevent new promotion',async t=>{ + const registry=await setup(t),controller=new AbortController();controller.abort(); + const pre=await runEvolutionLoop({registry,modules:[evolutionModules()[0]],signal:controller.signal}); + assert.equal(pre.stopReason,'aborted');assert.equal(pre.budget.proposals,0); + const deadline=await runEvolutionLoop({registry,modules:[evolutionModules()[0]],maxDurationMs:1}); + assert.equal(deadline.stopReason,'deadline');assert.equal(deadline.promotions,0);assert.equal((await registry.get('xor')).revision,1); +}); +test('newer revision wins when a competing coordinator changes state during proposal',async t=>{ + const registry=await setup(t);let changed=false; + const authority={ + get:id=>registry.get(id), + async propose(...args){if(!changed){changed=true;await registry.rollback('xor',1,1);}return registry.propose(...args);}, + promote:(...args)=>registry.promote(...args) + }; + const result=await runEvolutionLoop({registry:authority,modules:[evolutionModules()[0]],simd:false}); + assert.equal(result.promotions,0);assert.ok(result.events.some(e=>e.type==='stale')); + const current=await registry.get('xor');assert.equal(current.revision,2);assert.equal(current.hash,await fingerprintModel(evolutionModels().xor));assert.equal(result.modules[0].finalRevision,2); +}); +test('durability failure rejects the run instead of claiming successful evolution',async t=>{ + const registry=await setup(t),failure=Object.assign(new Error('disk full'),{code:'WSP_REGISTRY_PERSISTENCE'}); + const broken={get:id=>registry.get(id),propose:(...args)=>registry.propose(...args),promote:async()=>{throw failure;}}; + await assert.rejects(runEvolutionLoop({registry:broken,modules:[evolutionModules()[0]],simd:false}),e=>e===failure); + assert.equal((await registry.get('xor')).revision,1); +}); +test('unknown code callbacks, invalid limits, malformed suites and accessors fail before dispatch',async t=>{ + const registry=await setup(t); + for(const mutate of [m=>m.strategies[0].options.objective=()=>0,m=>m.holdouts=[],m=>m.invariants.cases[0].rows=2048, + m=>m.holdouts[0].policy.maxRegressionMSE=-1,m=>m.strategies[0].options.maxWork=Infinity]) { + const module=evolutionModules()[0];mutate(module);await assert.rejects(runEvolutionLoop({registry,modules:[module]})); + } + let calls=0;const module=evolutionModules()[0];Object.defineProperty(module,'strategies',{get(){calls++;return [];}}); + await assert.rejects(runEvolutionLoop({registry,modules:[module]}));assert.equal(calls,0); + await assert.rejects(runEvolutionLoop({registry,modules:[evolutionModules()[0]],maxRounds:17})); + assert.equal((await registry.get('xor')).revision,1); +}); +test('continuous generations rebase proposals onto each newly persisted revision',async t=>{ + const registry=await setup(t);await registry.create('linear',evolutionModels().linear); + const module=evolutionModules()[1]; + module.development.policy={maxMSE:10,maxRegressionMSE:0};module.holdouts[0].policy={maxMSE:10,maxRegressionMSE:0}; + delete module.invariants.cases[0].expected; + module.strategies=[{name:'one-step',kind:'search',options:{locations:[{layer:0,parameter:'weights',index:0,values:[1,2]}],maxEvaluations:1,maxPasses:1}}]; + const result=await runEvolutionLoop({registry,modules:[module],maxRounds:3,simd:false}); + assert.equal(result.stopReason,'goals-met');assert.equal(result.rounds,2);assert.equal(result.promotions,2); + assert.deepEqual(result.events.filter(e=>e.type==='promoted').map(e=>[e.revision,e.nextRevision]),[[1,2],[2,3]]); + assert.equal((await registry.get('linear')).model.layers[0].weights[0],2); +}); +test('two actual concurrent loops share one AgentDB CAS authority',async t=>{ + const registry=await setup(t),configuration={registry,modules:[evolutionModules()[0]],simd:false}; + const reports=await Promise.all([runEvolutionLoop(configuration),runEvolutionLoop(configuration)]); + assert.equal(reports.reduce((sum,r)=>sum+r.promotions,0),1); + assert.ok(reports.some(r=>r.events.some(e=>e.type==='stale'))); + const current=await registry.get('xor');assert.equal(current.revision,2);assert.deepEqual([...current.model.layers[1].weights],[1,1]); +}); +test('completed goals are invalidated when another actor rolls a module back',async t=>{ + const registry=await setup(t);await registry.create('linear',evolutionModels().linear); + const modules=evolutionModules(); + modules[0].strategies=[modules[0].strategies[2]]; + modules[1].development.policy={maxMSE:10,maxRegressionMSE:0};modules[1].holdouts[0].policy={maxMSE:10,maxRegressionMSE:0}; + delete modules[1].invariants.cases[0].expected; + modules[1].strategies=[{name:'one-step',kind:'search',options:{locations:[{layer:0,parameter:'weights',index:0,values:[1,2]}],maxEvaluations:1,maxPasses:1}}]; + let rolled=false; + const authority={get:id=>registry.get(id),propose:(...args)=>registry.propose(...args),async promote(...args){ + const next=await registry.promote(...args); + if(args[0]==='linear'&&!rolled){rolled=true;await registry.rollback('xor',1,2);} + return next; + }}; + const result=await runEvolutionLoop({registry:authority,modules,maxRounds:3,simd:false}); + assert.equal(result.stopReason,'goals-met');assert.equal(result.promotions,4); + assert.equal((await registry.get('xor')).revision,4);assert.deepEqual([...(await registry.get('xor')).model.layers[1].weights],[1,1]); + assert.equal(result.modules.find(m=>m.id==='xor').finalRevision,4); +}); +test('same-content external revisions update report lineage while preserving valid goal evidence',async t=>{ + const registry=await setup(t),module=evolutionModules()[0];module.strategies=[module.strategies[2]]; + const authority={get:id=>registry.get(id),propose:(...args)=>registry.propose(...args),async promote(...args){ + const next=await registry.promote(...args);await registry.rollback('xor',next.revision,next.revision);return next; + }}; + const result=await runEvolutionLoop({registry:authority,modules:[module],simd:false}); + assert.equal(result.stopReason,'goals-met');assert.equal(result.modules[0].goalReached,true); + assert.equal(result.modules[0].finalRevision,3);assert.equal((await registry.get('xor')).revision,3); +}); +test('trusted invariant and holdout configuration fails before any proposal or mutation',async t=>{ + const registry=await setup(t); + for(const mutate of [m=>m.holdouts[0].name='invalid:name',m=>m.invariants.cases[0].name='', + m=>m.invariants.cases[0].expected=[0],m=>m.invariants.cases[0].minimum=[0,1], + m=>{delete m.invariants.cases[0].expected;m.invariants.cases[0].minimum=[0];m.invariants.cases[0].tolerance=1;}]) { + const module=evolutionModules()[0];mutate(module); + await assert.rejects(runEvolutionLoop({registry,modules:[module],simd:false})); + } + const current=await registry.get('xor');assert.equal(current.revision,1);assert.equal(current.proposals.length,0); +}); +test('real AgentDB promotion followed by failed disk flush never acknowledges a new checkpoint',async()=>{ + const dir=await mkdtemp(join(tmpdir(),'wsp-loop-disk-failure-'));let registry,calls=0; + try { + registry=await openDemoRegistry(join(dir,'state.sqlite'),(programs,options)=>createAgentDBRegistry(programs,{...options,flush:()=>{ + if(++calls===3)throw new Error('simulated disk full after promotion transaction');return options.flush(); + }})); + await registry.create('xor',evolutionModels().xor); + await assert.rejects(runEvolutionLoop({registry,modules:[evolutionModules()[0]],simd:false}),error=>error.code==='WSP_REGISTRY_PERSISTENCE'); + assert.equal(calls,3);assert.equal(registry.status().poisoned,true); + await registry.close();registry=await openDemoRegistry(join(dir,'state.sqlite')); + const restored=await registry.get('xor');assert.equal(restored.revision,1);assert.deepEqual([...restored.model.layers[1].weights],[0,0]); + } finally {await registry?.close();await rm(dir,{recursive:true,force:true});} +}); +test('cancellation during final registry refresh preserves commits and reports cancellation',async t=>{ + const registry=await setup(t),controller=new AbortController(),module=evolutionModules()[0]; + module.strategies=[module.strategies[2]];let reads=0; + const authority={async get(id){const value=await registry.get(id);if(++reads===3)controller.abort();return value;}, + propose:(...args)=>registry.propose(...args),promote:(...args)=>registry.promote(...args)}; + const report=await runEvolutionLoop({registry:authority,modules:[module],signal:controller.signal,simd:false}); + assert.equal(report.stopReason,'aborted');assert.equal(report.promotions,1); + assert.equal((await registry.get('xor')).revision,2);assert.ok(report.events.some(e=>e.type==='promoted')); +}); diff --git a/packages/wsp-toolkit/packages/registry/LICENSE b/packages/wsp-toolkit/packages/registry/LICENSE new file mode 100644 index 000000000..2dd524ac3 --- /dev/null +++ b/packages/wsp-toolkit/packages/registry/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 rUv + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/wsp-toolkit/packages/registry/README.md b/packages/wsp-toolkit/packages/registry/README.md new file mode 100644 index 000000000..5027be0c9 --- /dev/null +++ b/packages/wsp-toolkit/packages/registry/README.md @@ -0,0 +1,36 @@ +# ruv-fann-wsp-registry + +Adapt a caller-owned real AgentDB `WeightPrograms` controller into a serialized promise API with explicit persistence acknowledgement. ESM, Node 20.9+. AgentDB 3.10.0 is an optional peer; the library never installs it or opens a database automatically. + +```js +import { createDatabase } from 'agentdb/db-fallback'; +import { WeightPrograms } from 'agentdb/controllers/WeightPrograms'; +import { createAgentDBRegistry } from 'ruv-fann-wsp-registry'; +const db = await createDatabase('weights.db'); +const programs = new WeightPrograms(db); +const registry = createAgentDBRegistry(programs, { + flush: () => db.save?.(), + close: () => { + programs.dispose(); + // Every acknowledged write was already flushed; avoid close() saving again. + if (typeof db.save === 'function') db.save = () => {}; + db.close(); + } +}); +``` + +Promise methods: `create(id,model)`, `get(id)`, `list(limit?)`, `propose(id,patch,dataset,policy)`, `promote(id,proposalId,expectedRevision)`, `rollback(id,targetRevision,expectedRevision)`, and `close()`. `status()` reports queue/close/poison state and whether a flush hook is configured. AgentDB revision conflicts are reported as `RegistryStaleError` (`WSP_REGISTRY_STALE`). Promotion only accepts an internal proposal ID; a detached evaluation object is never authority. AgentDB supplies real WASM evaluation, revision CAS, retained history and monotonic rollback. + +All operations share one queue, including reads, so acknowledged reads follow preceding flushes. Each input is copied synchronously before queueing without invoking getters, iterators or toJSON. The hard queue limit is 16 operations and can only be tightened with `maxPending`. Each copied JSON argument/result is bounded to 2 MiB, 262,144 tree nodes and depth 16. Controller methods and callback capabilities are trusted local code, not a sandbox. Do not mutate the same controller outside its adapter. + +Writes resolve only after the optional flush hook completes. Without `flush`, status explicitly reports `memory-only`; this does not establish durability. Failed flushes reject with `RegistryPersistenceError` (`WSP_REGISTRY_PERSISTENCE`), poison the adapter and block further reads/mutations until close/reopen. The `options.close(state)` cleanup hook receives `{poisoned}` and should discard unflushed memory rather than silently retry persistence. A failed acknowledgement can have reached disk; inspect reopened state before deciding whether to retry. Cleanup is awaited once after all queued work settles. + +The toolkit's separate `tooling/agentdb` fixture installs the real controller and exercises reopen, stale CAS, rejection, snapshots, persistence failure and cleanup. File-backed sql.js usage assumes one registry owner per file; this adapter does not add distributed locking. Hashes and accepted evaluations are neither signatures nor generalization guarantees. Application owners still provide independent suites, invariants and promotion policy. + + + +Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). + +These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. + + diff --git a/packages/wsp-toolkit/packages/registry/constellation.json b/packages/wsp-toolkit/packages/registry/constellation.json new file mode 100644 index 000000000..fece6e5fd --- /dev/null +++ b/packages/wsp-toolkit/packages/registry/constellation.json @@ -0,0 +1,16 @@ +{ + "schema": "ruvnet.constellation-module/1", + "name": "ruv-fann-wsp-registry", + "version": "0.1.0", + "role": "satellite", + "contracts": [ + "ruvnet.constellation-module/1", + "ruv-fann.dense-layers/1", + "ruv-fann.weight-patch/1", + "ruv-fann.weight-evaluation/1" + ], + "integrations": [ + "agentdb", + "ruv-fann-wsp" + ] +} diff --git a/packages/wsp-toolkit/packages/registry/package.json b/packages/wsp-toolkit/packages/registry/package.json new file mode 100644 index 000000000..559ba39ae --- /dev/null +++ b/packages/wsp-toolkit/packages/registry/package.json @@ -0,0 +1,46 @@ +{ + "name": "ruv-fann-wsp-registry", + "version": "0.1.0", + "description": "Serialized AgentDB weight-program authority with explicit durable acknowledgement", + "type": "module", + "main": "./src/index.js", + "types": "./src/index.d.ts", + "exports": { + ".": { + "types": "./src/index.d.ts", + "import": "./src/index.js" + } + }, + "files": [ + "src", + "README.md", + "LICENSE", + "constellation.json" + ], + "engines": { + "node": ">=20.9.0" + }, + "dependencies": { + "ruv-fann-wsp": "0.2.0" + }, + "peerDependencies": { + "agentdb": "3.10.0" + }, + "peerDependenciesMeta": { + "agentdb": { + "optional": true + } + }, + "scripts": { + "test": "node --test test/*.test.mjs" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ruvnet/ruv-FANN.git", + "directory": "packages/wsp-toolkit/packages/registry" + }, + "license": "MIT", + "publishConfig": { + "access": "public" + } +} diff --git a/packages/wsp-toolkit/packages/registry/src/index.d.ts b/packages/wsp-toolkit/packages/registry/src/index.d.ts new file mode 100644 index 000000000..3b1199c3d --- /dev/null +++ b/packages/wsp-toolkit/packages/registry/src/index.d.ts @@ -0,0 +1,44 @@ +import type { DenseModel, WeightPatch, EvaluationDataset, EvaluationPolicy, WeightEvaluation } from 'ruv-fann-wsp'; +export type StoredWeightEvaluation = Omit; +export interface WeightProgramMetadata { id: string; revision: number; hash: string; createdAt: string; updatedAt: string } +export interface WeightProgramHistory { + revision: number; hash: string; operation: 'create' | 'promote' | 'rollback'; sourceRevision: number | null; + proposalId: string | null; createdAt: string; evaluation: StoredWeightEvaluation | null; +} +export interface WeightProgramProposal { + id: string; revision: number; baseHash: string; candidateHash: string; accepted: boolean; + status: 'pending' | 'rejected' | 'stale' | 'promoted' | 'expired'; createdAt: string; expiresAt: string; + evaluation: StoredWeightEvaluation; +} +export interface WeightProgramRecord extends WeightProgramMetadata { model: DenseModel; history: WeightProgramHistory[]; proposals: WeightProgramProposal[] } +export interface WeightProgramProposed { id: string; proposalId: string; revision: number; evaluation: WeightEvaluation; createdAt: string; expiresAt: string } +export interface WeightProgramsCapability { + create(id: string, model: DenseModel | string): Promise; + get(id: string): WeightProgramRecord | null | Promise; + list(limit?: number): WeightProgramMetadata[] | Promise; + propose(id: string, patch: WeightPatch, dataset: EvaluationDataset, policy: EvaluationPolicy): Promise; + promote(id: string, proposalId: string, expectedRevision: number): Promise; + rollback(id: string, targetRevision: number, expectedRevision: number): WeightProgramRecord | Promise; +} +export interface RegistryOptions { + /** Trusted persistence hook. Omitting this yields explicitly memory-only acknowledgements. */ + flush?: () => void | Promise; + /** Called once after queued work settles, including after failed persistence. */ + close?: (state: Readonly<{poisoned: boolean}>) => void | Promise; + /** May tighten the hard 16 queued-operation limit. */ + maxPending?: number; +} +export interface AgentDBRegistry { + create(id: string, model: DenseModel | string): Promise; + get(id: string): Promise; + list(limit?: number): Promise; + propose(id: string, patch: WeightPatch, dataset: EvaluationDataset, policy: EvaluationPolicy): Promise; + promote(id: string, proposalId: string, expectedRevision: number): Promise; + rollback(id: string, targetRevision: number, expectedRevision: number): Promise; + close(): Promise; + status(): Readonly<{pending: number; closing: boolean; closed: boolean; poisoned: boolean; durability: 'caller-flush' | 'memory-only'}>; +} +export function createAgentDBRegistry(programs: WeightProgramsCapability, options?: RegistryOptions): Readonly; +export const REGISTRY_LIMITS: Readonly<{maxPending: number; maxBytes: number; maxNodes: number; maxDepth: number}>; +export class RegistryPersistenceError extends Error { readonly code: 'WSP_REGISTRY_PERSISTENCE'; constructor(cause: unknown) } +export class RegistryStaleError extends Error { readonly code: 'WSP_REGISTRY_STALE'; constructor(cause: unknown) } diff --git a/packages/wsp-toolkit/packages/registry/src/index.js b/packages/wsp-toolkit/packages/registry/src/index.js new file mode 100644 index 000000000..627723c2a --- /dev/null +++ b/packages/wsp-toolkit/packages/registry/src/index.js @@ -0,0 +1,190 @@ +/** Hard bounds apply to each copied argument/result and to queued operations. */ +export const REGISTRY_LIMITS = Object.freeze({ maxPending: 16, maxBytes: 2 * 1024 * 1024, + maxNodes: 262144, maxDepth: 16 }); + +function identifier(value, name = 'id') { + if (typeof value !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/.test(value)) + throw new TypeError(`${name} must contain 1..128 safe ASCII characters`); + return value; +} +function integer(value, maximum, name) { + if (!Number.isSafeInteger(value) || value < 1 || value > maximum) throw new RangeError(`invalid ${name}`); + return value; +} +function snapshot(value) { + let nodes = 0, stringChars = 0; + const ancestors = new Set(); + function copy(item, depth) { + if (++nodes > REGISTRY_LIMITS.maxNodes || depth > REGISTRY_LIMITS.maxDepth) + throw new RangeError('registry data exceeds structural bounds'); + if (item === null || typeof item === 'boolean') return item; + if (typeof item === 'string') { + stringChars += item.length; + if (stringChars > REGISTRY_LIMITS.maxBytes) throw new RangeError('registry text exceeds byte bound'); + return item; + } + if (typeof item === 'number' && Number.isFinite(item)) return item === 0 ? 0 : item; + if (!item || typeof item !== 'object' || ancestors.has(item)) throw new TypeError('registry data must be an acyclic finite JSON tree'); + const isArray = Array.isArray(item); + if (!(isArray ? Object.getPrototypeOf(item) === Array.prototype : + [Object.prototype, null].includes(Object.getPrototypeOf(item)))) throw new TypeError('registry data must contain plain records and arrays'); + if (isArray && item.length > REGISTRY_LIMITS.maxNodes) throw new RangeError('registry array exceeds bounds'); + ancestors.add(item); + const result = isArray ? [] : Object.create(null); + let arrayItems = 0; + for (const key of Reflect.ownKeys(item)) { + if (isArray && key === 'length') continue; + if (typeof key !== 'string' || ['__proto__', 'constructor', 'prototype'].includes(key) || + (isArray && (!/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= item.length))) + throw new TypeError('registry data contains unsafe or unknown properties'); + stringChars += key.length; + if (stringChars > REGISTRY_LIMITS.maxBytes) throw new RangeError('registry text exceeds byte bound'); + const descriptor = Object.getOwnPropertyDescriptor(item, key); + if (!descriptor || !Object.hasOwn(descriptor, 'value')) throw new TypeError('registry data accessors are forbidden'); + result[key] = copy(descriptor.value, depth + 1); + arrayItems++; + } + if (isArray && (arrayItems !== item.length || result.length !== item.length)) throw new TypeError('registry arrays must be dense'); + ancestors.delete(item); + return result; + } + const owned = copy(value, 0); + if (new TextEncoder().encode(JSON.stringify(owned)).length > REGISTRY_LIMITS.maxBytes) + throw new RangeError('registry data exceeds byte bound'); + return owned; +} +function options(value) { + if (!value || typeof value !== 'object' || Array.isArray(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) + throw new TypeError('registry options must be a plain record'); + const owned = Object.create(null); + for (const key of Reflect.ownKeys(value)) { + const descriptor = Object.getOwnPropertyDescriptor(value, key); + if (typeof key !== 'string' || !['flush', 'close', 'maxPending'].includes(key) || !descriptor || !Object.hasOwn(descriptor, 'value')) + throw new TypeError('unknown registry option or accessor'); + owned[key] = descriptor.value; + } + for (const key of ['flush', 'close']) if (owned[key] !== undefined && typeof owned[key] !== 'function') + throw new TypeError(`${key} must be a trusted callback`); + return owned; +} +function capability(target, key) { + let owner = target; + while (owner && owner !== Object.prototype) { + const descriptor = Object.getOwnPropertyDescriptor(owner, key); + if (descriptor) { + if (!Object.hasOwn(descriptor, 'value') || typeof descriptor.value !== 'function') + throw new TypeError(`WeightPrograms ${key} must be a data method`); + return descriptor.value.bind(target); + } + owner = Object.getPrototypeOf(owner); + } + throw new TypeError(`WeightPrograms capability lacks ${key}`); +} +function arity(args, expected) { + if (args.length !== expected) throw new TypeError(`expected ${expected} registry arguments`); +} + +export class RegistryPersistenceError extends Error { + constructor(cause) { + super('registry persistence failed; state is uncertain, close and reopen before continuing', { cause }); + this.name = 'RegistryPersistenceError'; + this.code = 'WSP_REGISTRY_PERSISTENCE'; + } +} + +export class RegistryStaleError extends Error { + constructor(cause) { + super('registry revision changed; candidate is stale', { cause }); + this.name = 'RegistryStaleError'; + this.code = 'WSP_REGISTRY_STALE'; + } +} + +/** + * Adapt a caller-owned real AgentDB WeightPrograms controller. The capability and + * persistence callbacks are trusted local code, not a security sandbox. + */ +export function createAgentDBRegistry(programs, configuration = {}) { + if (!programs || typeof programs !== 'object') throw new TypeError('a WeightPrograms capability is required'); + const methods = Object.fromEntries(['create', 'get', 'list', 'propose', 'promote', 'rollback'].map(key => [key, capability(programs, key)])); + const config = options(configuration); + const maximum = config.maxPending === undefined ? REGISTRY_LIMITS.maxPending : integer(config.maxPending, REGISTRY_LIMITS.maxPending, 'maxPending'); + const flush = config.flush, cleanup = config.close; + let tail = Promise.resolve(), closing = false, closed = false, poisoned = false, pending = 0, closePromise; + function healthy() { + if (poisoned) throw new Error('registry is poisoned after a persistence failure; close and reopen'); + if (closed) throw new Error('registry is closed'); + } + function enqueue(operation, write) { + healthy(); + if (closing) throw new Error('registry is closing'); + if (pending >= maximum) throw new RangeError('registry operation queue is full'); + pending++; + const result = tail.then(async () => { + healthy(); + let value; + try { value = await operation(); } + catch (error) { + if (error instanceof Error && /^(?:Program revision changed; stale (?:promotion|rollback)|Program changed during evaluation; proposal is stale|Program changed during update; retry with latest revision|Proposal is stale)$/.test(error.message)) + throw new RegistryStaleError(error); + throw error; + } + // Copy while still owning the queue, before callbacks can yield/mutate results. + let owned; + try { owned = snapshot(value); } + catch (error) { + if (write) { poisoned = true; throw new RegistryPersistenceError(error); } + throw error; + } + if (write && flush) { + try { await flush(); } + catch (error) { poisoned = true; throw new RegistryPersistenceError(error); } + } + return owned; + }); + const settled = result.finally(() => { pending--; }); + tail = settled.then(() => undefined, () => undefined); + return settled; + } + return Object.freeze({ + async create(...args) { + arity(args, 2); const id = identifier(args[0]), model = snapshot(args[1]); + return enqueue(() => methods.create(id, model), true); + }, + async get(...args) { + arity(args, 1); const id = identifier(args[0]); + return enqueue(() => methods.get(id), false); + }, + async list(...args) { + if (args.length > 1) throw new TypeError('list accepts at most one argument'); + const limit = args[0] === undefined ? 50 : integer(args[0], 100, 'list limit'); + return enqueue(() => methods.list(limit), false); + }, + async propose(...args) { + arity(args, 4); const id = identifier(args[0]); + const patch = snapshot(args[1]), dataset = snapshot(args[2]), policy = snapshot(args[3]); + return enqueue(() => methods.propose(id, patch, dataset, policy), true); + }, + async promote(...args) { + arity(args, 3); const id = identifier(args[0]), proposalId = identifier(args[1], 'proposalId'); + const revision = integer(args[2], Number.MAX_SAFE_INTEGER, 'expectedRevision'); + return enqueue(() => methods.promote(id, proposalId, revision), true); + }, + async rollback(...args) { + arity(args, 3); const id = identifier(args[0]); + const target = integer(args[1], Number.MAX_SAFE_INTEGER, 'targetRevision'), expected = integer(args[2], Number.MAX_SAFE_INTEGER, 'expectedRevision'); + return enqueue(() => methods.rollback(id, target, expected), true); + }, + close(...args) { + try { arity(args, 0); } catch (error) { return Promise.reject(error); } + if (closePromise) return closePromise; + closing = true; + closePromise = tail.then(async () => { + try { if (cleanup) await cleanup(Object.freeze({ poisoned })); } + finally { closed = true; } + }); + return closePromise; + }, + status() { return Object.freeze({ pending, closing, closed, poisoned, durability: flush ? 'caller-flush' : 'memory-only' }); } + }); +} diff --git a/packages/wsp-toolkit/packages/registry/test/registry.test.mjs b/packages/wsp-toolkit/packages/registry/test/registry.test.mjs new file mode 100644 index 000000000..daaf93939 --- /dev/null +++ b/packages/wsp-toolkit/packages/registry/test/registry.test.mjs @@ -0,0 +1,207 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { mkdtemp, rm } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { fingerprintModel } from 'ruv-fann-wsp'; +import { createAgentDBRegistry, RegistryPersistenceError } from '../src/index.js'; +import { openDemoRegistry } from '../../../tooling/agentdb/runtime.mjs'; + +const model = () => ({ schema: 'ruv-fann.dense-layers/1', layers: [{ + inputs: 1, outputs: 1, weights: [0], bias: [0], activation: 'Linear', steepness: 1 +}] }); +const data = () => ({ inputs: [1, 2], targets: [2, 4], rows: 2 }); +const policy = () => ({ maxMSE: 0, maxRegressionMSE: 0 }); +const patch = (hash, value = 2) => ({ schema: 'ruv-fann.weight-patch/1', baseHash: hash, + edits: [{ layer: 0, parameter: 'weights', index: 0, value }] }); +const deferred = () => { let resolve; const promise = new Promise(done => { resolve = done; }); return { promise, resolve }; }; +async function fixture(t) { + const directory = await mkdtemp(join(tmpdir(), 'wsp-agentdb-')); + t.after(() => rm(directory, { recursive: true, force: true })); + return join(directory, 'weights.db'); +} +async function raw(filename) { + let createDatabase, WeightPrograms; + try { + ({ createDatabase } = await import('../../../tooling/agentdb/node_modules/agentdb/dist/src/db-fallback.js')); + ({ WeightPrograms } = await import('../../../tooling/agentdb/node_modules/agentdb/dist/src/controllers/WeightPrograms.js')); + } catch (error) { + throw new Error('AgentDB test fixture missing; npm ci --prefix tooling/agentdb --ignore-scripts --omit=optional', { cause: error }); + } + const db = await createDatabase(filename), programs = new WeightPrograms(db, { simd: false }); + return { db, programs, + cleanup({ poisoned }) { programs.dispose(); if (db.save) db.save = () => {}; db.close(); } }; +} + +test('real AgentDB create, proposal, promotion and rollback survive each close/reopen', async t => { + const filename = await fixture(t); + let registry = await openDemoRegistry(filename); + const initial = await registry.create('linear', model()); + assert.equal(initial.revision, 1); + assert.equal(registry.status().durability, 'caller-flush'); + await registry.close(); + registry = await openDemoRegistry(filename); + assert.equal((await registry.get('linear')).hash, initial.hash); + const proposed = await registry.propose('linear', patch(initial.hash), data(), policy()); + assert.equal(proposed.evaluation.accepted, true); + assert.equal(proposed.evaluation.backend, 'wasm'); + assert.equal(proposed.evaluation.baseline.mse, 10); + assert.equal(proposed.evaluation.candidate.mse, 0); + await registry.close(); + registry = await openDemoRegistry(filename); + const promoted = await registry.promote('linear', proposed.proposalId, 1); + assert.equal(promoted.revision, 2); + assert.equal(promoted.model.layers[0].weights[0], 2); + assert.equal(promoted.hash, await fingerprintModel(promoted.model)); + await registry.close(); + registry = await openDemoRegistry(filename); + const restored = await registry.rollback('linear', 1, 2); + assert.equal(restored.hash, initial.hash); + assert.equal(restored.revision, 3); + await registry.close(); + registry = await openDemoRegistry(filename); + t.after(() => registry.close()); + const final = await registry.get('linear'); + assert.deepEqual(final.history.map(row => row.operation), ['rollback', 'promote', 'create']); + assert.equal(final.revision, 3); + assert.equal(final.model.layers[0].weights[0], 0); + assert.equal((await registry.list())[0].hash, initial.hash); +}); + +test('rejected proposals, forged receipts/IDs and detached result edits cannot promote', async t => { + const registry = await openDemoRegistry(await fixture(t)); t.after(() => registry.close()); + const initial = await registry.create('test', model()); + const rejected = await registry.propose('test', patch(initial.hash, -1), data(), policy()); + assert.equal(rejected.evaluation.accepted, false); + rejected.evaluation.accepted = true; + await assert.rejects(registry.promote('test', rejected.proposalId, 1), /rejected/); + await assert.rejects(registry.promote('test', { accepted: true }, 1), /proposalId/); + await assert.rejects(registry.promote('test', 'forged-internal-id', 1), /not found/); + const good = await registry.propose('test', patch(initial.hash), data(), policy()); + good.evaluation.model.layers[0].weights[0] = 100; + const promoted = await registry.promote('test', good.proposalId, 1); + assert.equal(promoted.model.layers[0].weights[0], 2); + assert.equal(promoted.hash, good.evaluation.candidateHash); +}); + +test('concurrent promotions serialize; exactly one expected revision succeeds', async t => { + const registry = await openDemoRegistry(await fixture(t)); t.after(() => registry.close()); + const initial = await registry.create('cas', model()); + const first = await registry.propose('cas', patch(initial.hash), data(), policy()); + const second = await registry.propose('cas', patch(initial.hash), data(), policy()); + const results = await Promise.allSettled([ + registry.promote('cas', first.proposalId, 1), registry.promote('cas', second.proposalId, 1) + ]); + assert.deepEqual(results.map(r => r.status), ['fulfilled', 'rejected']); + assert.match(results[1].reason.message, /stale|revision/i); + assert.equal(results[1].reason.code, 'WSP_REGISTRY_STALE'); + assert.equal((await registry.get('cas')).revision, 2); + await assert.rejects(registry.rollback('cas', 1, 1), /stale|revision/i); +}); + +test('queued inputs snapshot before awaiting preceding persistence; reads wait for flush', async t => { + const source = await raw(await fixture(t)), entered = deferred(), release = deferred(); + let flushes = 0; + const registry = createAgentDBRegistry(source.programs, { + flush: async () => { if (++flushes === 1) { entered.resolve(); await release.promise; } source.db.save?.(); }, + close: state => source.cleanup(state) + }); + t.after(() => registry.close()); + const initial = model(), hash = await fingerprintModel(initial); + const creating = registry.create('snapshot', initial); + await entered.promise; + const candidate = patch(hash), dataset = data(), criteria = policy(); + const proposing = registry.propose('snapshot', candidate, dataset, criteria); + let readFinished = false; + const reading = registry.get('snapshot').then(record => { readFinished = true; return record; }); + candidate.edits[0].value = 100; dataset.targets[0] = -100; criteria.maxMSE = 100; + initial.layers[0].weights[0] = 100; + await Promise.resolve(); assert.equal(readFinished, false); + release.resolve(); + await creating; + const proposal = await proposing; + assert.equal(proposal.evaluation.accepted, true); + assert.equal(proposal.evaluation.candidate.mse, 0); + assert.equal(proposal.evaluation.model.layers[0].weights[0], 2); + assert.equal((await reading).model.layers[0].weights[0], 0); +}); + +test('failed real-controller flush rejects acknowledgement and poisons subsequent work', async t => { + const filename = await fixture(t), source = await raw(filename); + let count = 0, closeState; + const registry = createAgentDBRegistry(source.programs, { + flush: () => { if (++count === 3) throw new Error('controlled disk flush failure'); source.db.save?.(); }, + close: state => { closeState = state; source.cleanup(state); } + }); + const initial = await registry.create('failure', model()); + const proposal = await registry.propose('failure', patch(initial.hash), data(), policy()); + await assert.rejects(registry.promote('failure', proposal.proposalId, 1), error => + error instanceof RegistryPersistenceError && error.code === 'WSP_REGISTRY_PERSISTENCE'); + assert.equal(registry.status().poisoned, true); + await assert.rejects(registry.get('failure'), /poisoned/); + await assert.rejects(registry.rollback('failure', 1, 2), /poisoned/); + await registry.close(); + assert.equal(closeState.poisoned, true); + const reopened = await openDemoRegistry(filename); t.after(() => reopened.close()); + // This injected failure happened before save, and cleanup deliberately did not retry. + assert.equal((await reopened.get('failure')).revision, 1); + assert.equal((await reopened.get('failure')).hash, initial.hash); +}); + +test('queue capacity and close are bounded; cleanup runs once after queued work', async t => { + const source = await raw(await fixture(t)), entered = deferred(), release = deferred(); + let cleanups = 0; + const registry = createAgentDBRegistry(source.programs, { + maxPending: 1, + flush: async () => { entered.resolve(); await release.promise; source.db.save?.(); }, + close: state => { cleanups++; source.cleanup(state); } + }); + const creating = registry.create('bounded', model()); + await entered.promise; + await assert.rejects(registry.get('bounded'), /queue is full/); + const closing = registry.close(), again = registry.close(); + assert.equal(closing, again); + await assert.rejects(registry.get('bounded'), /closing/); + release.resolve(); await creating; await closing; + assert.equal(cleanups, 1); + assert.equal(registry.status().closed, true); + await assert.rejects(registry.list(), /closed/); +}); + +test('plain data, identifiers, queue options, unknown fields and accessors fail safely', async t => { + const registry = await openDemoRegistry(await fixture(t)); t.after(() => registry.close()); + let getters = 0; + const source = model(); Object.defineProperty(source.layers[0].weights, '0', { get() { getters++; return 0; } }); + await assert.rejects(registry.create('getter', source), /accessors/); assert.equal(getters, 0); + for (const bad of ['bad/id', '', 'x'.repeat(129), null]) await assert.rejects(registry.get(bad)); + for (const limit of [0, 101, NaN, '1']) await assert.rejects(registry.list(limit)); + await assert.rejects(registry.create('huge', 'x'.repeat(2 * 1024 * 1024 + 1)), /bound/); + await assert.rejects(registry.create('unsafe', Object.assign(model(), { toJSON() { throw Error('executed'); } })), /JSON tree/); + await assert.rejects(registry.create('unknown', { ...model(), unrecognized: true }), /unknown|field/i); + await assert.rejects(registry.create('missing'), /arguments/); + assert.throws(() => createAgentDBRegistry({ get get() { getters++; return () => {}; } }), /lacks create/); + const rawSource = await raw(':memory:'); + try { + for (const config of [{ maxPending: 17 }, { maxPending: 0 }, { extra: true }, { flush: true }]) + assert.throws(() => createAgentDBRegistry(rawSource.programs, config)); + const getterOptions = { get flush() { getters++; return () => {}; } }; + assert.throws(() => createAgentDBRegistry(rawSource.programs, getterOptions), /accessor/); + assert.equal(getters, 0); + } finally { rawSource.cleanup({ poisoned: false }); } +}); + +test('real sql.js concurrent file change is rejected rather than overwriting another owner', async t => { + const filename = await fixture(t); + const first = await openDemoRegistry(filename), initial = await first.create('shared', model()); + const stale = await openDemoRegistry(filename); + try { + await first.propose('shared', patch(initial.hash), data(), policy()); + await assert.rejects(stale.create('other', model()), /persistence failed/); + assert.equal(stale.status().poisoned, true); + await stale.close(); + await first.close(); + const reopened = await openDemoRegistry(filename); t.after(() => reopened.close()); + assert.equal(await reopened.get('other'), null); + assert.equal((await reopened.get('shared')).proposals.length, 1); + } finally { await stale.close(); await first.close(); } +}); diff --git a/packages/wsp-toolkit/packages/ruos/LICENSE b/packages/wsp-toolkit/packages/ruos/LICENSE new file mode 100644 index 000000000..2dd524ac3 --- /dev/null +++ b/packages/wsp-toolkit/packages/ruos/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 rUv + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/wsp-toolkit/packages/ruos/README.md b/packages/wsp-toolkit/packages/ruos/README.md new file mode 100644 index 000000000..889a7acba --- /dev/null +++ b/packages/wsp-toolkit/packages/ruos/README.md @@ -0,0 +1,15 @@ +# ruv-fann-wsp-ruos + +`runWasmCanary()` exercises the real scalar WASM backend: two-weight XOR repair, exhaustive activation oracle, rejected neuron ablation, numerical sensitivity and revision-safe rollback. It throws on any failed assertion. This Node/browser function has no desktop connection or credentials. + +`createValidationCommand(absoluteDirectory)` returns a shell-quoted `npm ci --ignore-scripts && npm run validate` plan for a trusted toolkit checkout. It does not execute anything. Select an exact observed desktop with ruOS's live `desktop_status`, then invoke its supported `desktop_exec` route. `ready` describes provisioning, not liveness; check heartbeat and execution separately. Do not wake or select a different computer implicitly. + +`assertRuOSCompletion(actualToolResult, expectedExecutorMachineId)` requires executor-owned structured completion version 1, verified true, status ok, integer exit 0, matching executor identity and no reported truncation, timeout or transport error. Use the executor machine identity reported by a harmless connection probe; it may differ from the desktop selection ID. The helper rejects success strings/JSON in stdout. Its result explicitly does not independently attest assertions or cryptographically bind code to a run. Missing output completeness metadata still requires caller review. Never pass a fabricated tool envelope or use success to authorize deployment. No credentials or host tokens are exported. + + + +Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). + +These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. + + diff --git a/packages/wsp-toolkit/packages/ruos/constellation.json b/packages/wsp-toolkit/packages/ruos/constellation.json new file mode 100644 index 000000000..3bf961db9 --- /dev/null +++ b/packages/wsp-toolkit/packages/ruos/constellation.json @@ -0,0 +1,14 @@ +{ + "schema": "ruvnet.constellation-module/1", + "name": "ruv-fann-wsp-ruos", + "version": "0.1.0", + "role": "satellite", + "contracts": [ + "ruvnet.constellation-module/1", + "ruv-fann.dense-layers/1", + "ruv-fann.weight-patch/1" + ], + "integrations": [ + "ruv-fann-wsp" + ] +} diff --git a/packages/wsp-toolkit/packages/ruos/package.json b/packages/wsp-toolkit/packages/ruos/package.json new file mode 100644 index 000000000..fda5fbb5a --- /dev/null +++ b/packages/wsp-toolkit/packages/ruos/package.json @@ -0,0 +1,33 @@ +{ + "name": "ruv-fann-wsp-ruos", + "version": "0.1.0", + "type": "module", + "license": "MIT", + "description": "Real WASM canary and trusted executor completion checks for ruOS", + "engines": { + "node": ">=20.9.0" + }, + "exports": { + ".": { + "types": "./src/index.d.ts", + "import": "./src/index.js" + } + }, + "files": [ + "src", + "README.md", + "LICENSE", + "constellation.json" + ], + "dependencies": { + "ruv-fann-wsp": "0.2.0" + }, + "scripts": { + "test": "node --test test/*.test.mjs" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ruvnet/ruv-FANN.git", + "directory": "packages/wsp-toolkit/packages/ruos" + } +} diff --git a/packages/wsp-toolkit/packages/ruos/src/index.d.ts b/packages/wsp-toolkit/packages/ruos/src/index.d.ts new file mode 100644 index 000000000..a0a9f2e66 --- /dev/null +++ b/packages/wsp-toolkit/packages/ruos/src/index.d.ts @@ -0,0 +1,4 @@ +export function createValidationCommand(directory: string): string; +/** Supply only an authentic host tool response. This is not a cryptographic attestation. */ +export function assertRuOSCompletion(toolResult: {isError?: boolean; structuredContent?: Record}, expectedMachineId: string): Readonly<{completionVersion: 1; completionVerified: true; exitCode: 0; machineId: string; assertionsIndependentlyVerified: false}>; +export function runWasmCanary(): Promise<{schema: 'ruv-fann.wasm-canary/1'; backend: 'wasm' | 'wasm-simd'; baselineHash: string; repairedHash: string; restoredHash: string; baselineMSE: number; repairedMSE: number; rejectedMSE: number; finalRevision: number; assertions: number}>; diff --git a/packages/wsp-toolkit/packages/ruos/src/index.js b/packages/wsp-toolkit/packages/ruos/src/index.js new file mode 100644 index 000000000..77d6721c8 --- /dev/null +++ b/packages/wsp-toolkit/packages/ruos/src/index.js @@ -0,0 +1,61 @@ +import { createWeightWorkspace, traceWeightModel, createNeuronAblationPatch, + analyzeWeightSensitivity } from 'ruv-fann-wsp'; + +/** Shell plan only: the caller chooses an observed desktop and invokes its supported executor. */ +export function createValidationCommand(directory) { + if (typeof directory !== 'string' || !directory.startsWith('/') || directory.length > 1024 || /[\x00-\x1f\x7f]/.test(directory)) + throw new TypeError('directory must be a bounded absolute path'); + const quoted = `'${directory.replaceAll("'", "'\\''")}'`; + return `cd -- ${quoted} && npm ci --ignore-scripts --no-audit --no-fund && npm run validate`; +} + +/** Check the host executor's structured completion. Never parse completion from stdout. */ +export function assertRuOSCompletion(toolResult, expectedMachineId) { + if (typeof expectedMachineId !== 'string' || !/^[a-zA-Z0-9_-]{1,128}$/.test(expectedMachineId)) + throw new TypeError('expectedMachineId must identify the selected executor'); + const result = toolResult?.structuredContent; + if (toolResult?.isError || !result || result.completionVersion !== 1 || result.completionVerified !== true || + result.status !== 'ok' || !Number.isInteger(result.exitCode) || result.exitCode !== 0 || + result.machineId !== expectedMachineId || result.truncated === true || result.outputTruncated === true || + result.transportError || result.signal || + ['truncated', 'outputTruncated', 'timedOut', 'timeout'].some(key => + result[key] !== undefined && result[key] !== false)) + throw new Error('unverified, failed, mismatched or incomplete ruOS executor completion'); + return Object.freeze({ completionVersion: 1, completionVerified: true, exitCode: 0, machineId: expectedMachineId, + // Exit success alone does not independently attest every application assertion. + assertionsIndependentlyVerified: false }); +} + +/** Exhaustive binary XOR lifecycle canary; throws on any failed assertion. */ +export async function runWasmCanary() { + const assert = (condition, name) => { if (!condition) throw new Error(`WSP canary failed: ${name}`); }; + const model = { schema: 'ruv-fann.dense-layers/1', layers: [ + { inputs: 2, outputs: 2, weights: [1, -1, -1, 1], bias: [0, 0], activation: 'ReLU', steepness: 1 }, + { inputs: 2, outputs: 1, weights: [0, 0], bias: [0], activation: 'Linear', steepness: 1 } + ] }; + const dataset = { inputs: [0, 0, 0, 1, 1, 0, 1, 1], targets: [0, 1, 1, 0], rows: 4 }; + const policy = { maxMSE: 0, maxRegressionMSE: 0, maxAbsoluteError: 0 }; + const workspace = await createWeightWorkspace(model, { simd: false }); + const baseline = workspace.snapshot(); + const proposal = await workspace.propose({ schema: 'ruv-fann.weight-patch/1', baseHash: baseline.hash, + edits: [0, 1].map(index => ({ layer: 1, parameter: 'weights', index, value: 1 })) }, dataset, policy); + assert(proposal.evaluation.backend === 'wasm' && proposal.evaluation.accepted && + proposal.evaluation.baseline.mse === 0.5 && proposal.evaluation.candidate.mse === 0, 'real WASM repair'); + const promoted = workspace.promote(proposal.id, baseline.revision); + const trace = await traceWeightModel(promoted.model, { inputs: dataset.inputs, rows: dataset.rows }, { simd: false }); + assert(trace.layers[1].activations.every((v, i) => v === dataset.targets[i]), 'exhaustive XOR oracle'); + const ablation = await createNeuronAblationPatch(promoted.model, 0, 0); + const rejected = await workspace.propose(ablation, dataset, policy); + assert(!rejected.evaluation.accepted && rejected.evaluation.candidate.mse === 0.25, 'regression rejected'); + let denied = false; + try { workspace.promote(rejected.id, promoted.revision); } catch { denied = true; } + assert(denied && workspace.snapshot().hash === promoted.hash, 'rejection preserves state'); + const sensitivity = await analyzeWeightSensitivity(promoted.model, dataset, + [{ layer: 1, parameter: 'weights', index: 0 }], { epsilon: 0.001, simd: false }); + assert(Math.abs(sensitivity.entries[0].derivative) < 1e-12, 'finite difference oracle'); + const restored = workspace.rollback(1, promoted.revision); + assert(restored.revision === 3 && restored.hash === baseline.hash, 'exact rollback'); + return { schema: 'ruv-fann.wasm-canary/1', backend: proposal.evaluation.backend, + baselineHash: baseline.hash, repairedHash: promoted.hash, restoredHash: restored.hash, + baselineMSE: 0.5, repairedMSE: 0, rejectedMSE: 0.25, finalRevision: restored.revision, assertions: 6 }; +} diff --git a/packages/wsp-toolkit/packages/ruos/test/ruos.test.mjs b/packages/wsp-toolkit/packages/ruos/test/ruos.test.mjs new file mode 100644 index 000000000..a4da2a382 --- /dev/null +++ b/packages/wsp-toolkit/packages/ruos/test/ruos.test.mjs @@ -0,0 +1,24 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { createValidationCommand, assertRuOSCompletion, runWasmCanary } from '../src/index.js'; + +test('shell plans quote metacharacters without executing them', () => { + assert.equal(createValidationCommand("/tmp/a'b;$(id)"), "cd -- '/tmp/a'\\''b;$(id)' && npm ci --ignore-scripts --no-audit --no-fund && npm run validate"); + for (const value of ['relative', '/tmp/a\nwhoami', null, '/'.repeat(1025)]) assert.throws(() => createValidationCommand(value)); +}); +test('only complete executor-owned metadata passes; stdout cannot grant completion', () => { + const valid = { structuredContent: { completionVersion: 1, completionVerified: true, status: 'ok', exitCode: 0, machineId: 'observed-id' } }; + assert.equal(assertRuOSCompletion(valid, 'observed-id').assertionsIndependentlyVerified, false); + for (const change of [{ completionVersion: 2 }, { completionVerified: false }, { status: 'timeout' }, { exitCode: '0' }, { exitCode: 1 }, + { truncated: true }, { truncated: 'true' }, { outputTruncated: 1 }, { timeout: 'true' }, { outputTruncated: true }, { signal: 'SIGTERM' }, { transportError: 'lost' }, { timedOut: true }, { machineId: 'other' }]) + assert.throws(() => assertRuOSCompletion({ structuredContent: { ...valid.structuredContent, ...change } }, 'observed-id')); + assert.throws(() => assertRuOSCompletion({content:[{type:'text', text:JSON.stringify(valid.structuredContent)}]}, 'observed-id')); + assert.throws(() => assertRuOSCompletion({...valid, isError:true}, 'observed-id')); +}); +test('real WASM canary verifies exhaustive truth table and rollback', async () => { + const result = await runWasmCanary(); + assert.equal(result.backend, 'wasm'); + assert.equal(result.restoredHash, result.baselineHash); + assert.notEqual(result.repairedHash, result.baselineHash); + assert.equal(result.finalRevision, 3); +}); diff --git a/packages/wsp-toolkit/packages/search/LICENSE b/packages/wsp-toolkit/packages/search/LICENSE new file mode 100644 index 000000000..2dd524ac3 --- /dev/null +++ b/packages/wsp-toolkit/packages/search/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 rUv + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/wsp-toolkit/packages/search/README.md b/packages/wsp-toolkit/packages/search/README.md new file mode 100644 index 000000000..b9ab5fc12 --- /dev/null +++ b/packages/wsp-toolkit/packages/search/README.md @@ -0,0 +1,55 @@ +# ruv-fann-wsp-search + +Bounded discrete coordinate search with real WASM inference, plus explicit experimental truth-table compilation and Hebbian patch proposals. ESM, Node 20.9+ and secure-context browsers. Depends on `ruv-fann-wsp@0.2.0` and `ruv-fann@0.1.2`. + +```js +import { searchWeightPatch } from 'ruv-fann-wsp-search'; + +const result = await searchWeightPatch(model, heldOutCases, { + maxMSE: 0, maxRegressionMSE: 0 +}, { + locations: [ + { layer: 1, parameter: 'weights', index: 0, values: [0, 1] }, + { layer: 1, parameter: 'weights', index: 1, values: [0, 1] } + ], + maxEvaluations: 16 +}); +// A result is a proposal. Explicitly submit result.patch to a WeightWorkspace +// with your acceptance dataset/policy and promote its accepted proposal separately. +console.log(result.evaluation?.accepted, result.evaluations); +``` + +Search minimizes MSE by default. A trusted synchronous `objective({predictions, metrics, model})` callback may instead return a finite discontinuous score, for example the count of misclassifications. Callbacks receive recursively frozen snapshots; they execute as ordinary application code and their runtime is not bounded by the neural work budget. Custom objectives never override the final MSE/regression policy. Candidate screens share one baseline measurement. The winner receives an independent authoritative `evaluateWeightPatch` against the original baseline. There is no automatic promotion, backpropagation, provider call or global optimum guarantee. Ties preserve the earlier model; no strict improvement returns `patch: null, evaluation: null`. + +Limits: 16 unique locations, 32 unique absolute values per location, 256 candidate evaluations (default 64), 16 passes (default 4), and at most 10 million aggregate parameter-row operations reserved before execution. `maxWork` may tighten that ceiling; the reservation includes the baseline and both authoritative final inference passes. WSP patch bounds and dataset limits still apply. Inputs, choices, bounds and policies are snapshotted before the first await. Browser use needs the core runtime's WASM asset layout. + +## Experimental direct compilation + +```js +import { compileBooleanTable } from 'ruv-fann-wsp-search'; +const xor = compileBooleanTable({ inputs: 2, outputs: 1, targets: [0, 1, 1, 0] }); +``` + +Rows enumerate binary inputs from `00..0` to `11..1`, with the most significant bit first. The compiler builds one Threshold pattern detector per row and a Threshold output layer. It accepts complete numeric 0/1 tables for 1–6 inputs and 1–16 outputs. It reproduces the complete binary truth table by construction; behavior on nonbinary inputs is unspecified. This is direct model construction, not a claim that business rules can be compiled into arbitrary pretrained networks. + +## Experimental localized plasticity + +```js +import { createHebbianPatch } from 'ruv-fann-wsp-search'; +const patch = await createHebbianPatch(model, { inputs: [1, 2], rows: 2 }, { + layer: 0, indices: [0], learningRate: 0.1, + limits: { maxAbsDelta: 0.25 } +}); +``` + +For each explicit weight, propose `rate * mean(pre * post)` from actual WASM activations. Clip to patch bounds, preserve topology, and independently evaluate before promotion. This synthetic correlation rule is an experiment; it does not establish useful biological learning, drift correction, safety, or generalization. Zero/underflow updates are rejected. No arbitrary code or remote objective is loaded. + +Run `npm test` in the package or `npm test` from the toolkit workspace after installation. Tests use exhaustive Boolean oracles, independent analytic MSE/correlation calculations, custom classification scores, and malformed/budget/ownership checks. + + + +Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). + +These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. + + diff --git a/packages/wsp-toolkit/packages/search/constellation.json b/packages/wsp-toolkit/packages/search/constellation.json new file mode 100644 index 000000000..629ebe00f --- /dev/null +++ b/packages/wsp-toolkit/packages/search/constellation.json @@ -0,0 +1,15 @@ +{ + "schema": "ruvnet.constellation-module/1", + "name": "ruv-fann-wsp-search", + "version": "0.1.0", + "role": "satellite", + "contracts": [ + "ruvnet.constellation-module/1", + "ruv-fann.dense-layers/1", + "ruv-fann.weight-patch/1" + ], + "integrations": [ + "ruv-fann", + "ruv-fann-wsp" + ] +} diff --git a/packages/wsp-toolkit/packages/search/package.json b/packages/wsp-toolkit/packages/search/package.json new file mode 100644 index 000000000..fc7480b12 --- /dev/null +++ b/packages/wsp-toolkit/packages/search/package.json @@ -0,0 +1,39 @@ +{ + "name": "ruv-fann-wsp-search", + "version": "0.1.0", + "description": "Bounded derivative-free weight search and experimental symbolic/plasticity proposals for ruv-fann-wsp", + "type": "module", + "main": "./src/index.js", + "types": "./src/index.d.ts", + "exports": { + ".": { + "types": "./src/index.d.ts", + "import": "./src/index.js" + } + }, + "files": [ + "src", + "README.md", + "LICENSE", + "constellation.json" + ], + "engines": { + "node": ">=20.9.0" + }, + "dependencies": { + "ruv-fann-wsp": "0.2.0", + "ruv-fann": "0.1.2" + }, + "scripts": { + "test": "node --test test/*.test.mjs" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ruvnet/ruv-FANN.git", + "directory": "packages/wsp-toolkit/packages/search" + }, + "license": "MIT", + "publishConfig": { + "access": "public" + } +} diff --git a/packages/wsp-toolkit/packages/search/src/data.js b/packages/wsp-toolkit/packages/search/src/data.js new file mode 100644 index 000000000..d1b5fcd76 --- /dev/null +++ b/packages/wsp-toolkit/packages/search/src/data.js @@ -0,0 +1,92 @@ +import { WSP_LIMITS } from 'ruv-fann-wsp'; + +export function record(value, allowed, required, name) { + if (!value || typeof value !== 'object' || Array.isArray(value) || + ![Object.prototype, null].includes(Object.getPrototypeOf(value))) throw new TypeError(`${name} must be a plain data object`); + const result = Object.create(null); + for (const key of Reflect.ownKeys(value)) { + if (typeof key !== 'string' || !allowed.includes(key)) throw new TypeError(`unknown ${name} field`); + const descriptor = Object.getOwnPropertyDescriptor(value, key); + if (!descriptor || !Object.hasOwn(descriptor, 'value')) throw new TypeError(`${name} accessors are not allowed`); + result[key] = descriptor.value; + } + if (required.some(key => !Object.hasOwn(result, key))) throw new TypeError(`missing ${name} field`); + return result; +} +export function integer(value, min, max, name) { + if (!Number.isSafeInteger(value) || value < min || value > max) throw new RangeError(`${name} must be an integer in ${min}..${max}`); + return value; +} +export function finite(value, name, min = -Number.MAX_VALUE, max = Number.MAX_VALUE) { + if (typeof value !== 'number' || !Number.isFinite(value) || value < min || value > max) throw new RangeError(`${name} must be finite and in bounds`); + return value === 0 ? 0 : value; +} +export function array(value, max, name, item = x => x) { + if (!Array.isArray(value) || ![Array.prototype, null].includes(Object.getPrototypeOf(value))) throw new TypeError(`${name} must be an array`); + const length = integer(Object.getOwnPropertyDescriptor(value, 'length')?.value, 0, max, `${name} length`); + for (const key of Reflect.ownKeys(value)) { + if (key !== 'length' && (typeof key !== 'string' || !/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= length)) + throw new TypeError(`${name} contains unknown array fields`); + } + const result = new Array(length); + for (let index = 0; index < length; index++) { + const descriptor = Object.getOwnPropertyDescriptor(value, String(index)); + if (!descriptor || !Object.hasOwn(descriptor, 'value')) throw new TypeError(`${name} requires own data elements`); + result[index] = item(descriptor.value, index); + } + return result; +} +export const numbers = (value, max, name) => array(value, max, name, x => finite(x, name)); +export function modelSnapshot(value) { + if (typeof value === 'string') { + if (value.length > WSP_LIMITS.maxModelBytes || new TextEncoder().encode(value).length > WSP_LIMITS.maxModelBytes) throw new RangeError('model exceeds byte limit'); + value = JSON.parse(value); + } + const source = record(value, ['schema', 'layers'], ['schema', 'layers'], 'model'); + if (source.schema !== 'ruv-fann.dense-layers/1') throw new TypeError('unsupported model schema'); + let parameters = 0; + const layers = array(source.layers, WSP_LIMITS.maxLayers, 'layers', value => { + const layer = record(value, ['inputs', 'outputs', 'weights', 'bias', 'activation', 'steepness'], + ['inputs', 'outputs', 'weights', 'activation', 'steepness'], 'layer'); + const inputs = integer(layer.inputs, 1, WSP_LIMITS.maxDimension, 'inputs'); + const outputs = integer(layer.outputs, 1, WSP_LIMITS.maxDimension, 'outputs'); + parameters += inputs * outputs + outputs; + integer(parameters, 1, WSP_LIMITS.maxParameters, 'parameter count'); + const weights = numbers(layer.weights, inputs * outputs, 'weights'); + const bias = layer.bias === undefined || layer.bias === null ? Array(outputs).fill(0) : numbers(layer.bias, outputs, 'bias'); + if (weights.length !== inputs * outputs || bias.length !== outputs) throw new RangeError('layer dimensions disagree'); + // Authoritative WSP inspection checks activation names, adjacent shapes and canonical size before execution. + if (typeof layer.activation !== 'string' || layer.activation.length > 32) throw new TypeError('invalid activation'); + return { inputs, outputs, weights, bias, activation: layer.activation, steepness: finite(layer.steepness, 'steepness') }; + }); + if (!layers.length) throw new RangeError('model requires layers'); + return { model: { schema: source.schema, layers }, parameters }; +} +export function dataSnapshot(value, model, targets = true) { + const source = record(value, targets ? ['inputs', 'targets', 'rows'] : ['inputs', 'rows'], + targets ? ['inputs', 'targets', 'rows'] : ['inputs', 'rows'], 'dataset'); + const rows = integer(source.rows, 1, WSP_LIMITS.maxRows, 'rows'); + const inputs = numbers(source.inputs, WSP_LIMITS.maxElements, 'inputs'); + if (inputs.length !== rows * model.layers[0].inputs) throw new RangeError('input dimensions disagree'); + if (!targets) return { inputs, rows }; + const output = numbers(source.targets, WSP_LIMITS.maxElements, 'targets'); + if (output.length !== rows * model.layers.at(-1).outputs) throw new RangeError('target dimensions disagree'); + return { inputs, targets: output, rows }; +} +export function limitsSnapshot(value = {}) { + const raw = record(value, ['maxEdits', 'maxAbsValue', 'maxAbsDelta'], [], 'limits'); + return { + maxEdits: raw.maxEdits === undefined ? WSP_LIMITS.maxEdits : integer(raw.maxEdits, 1, WSP_LIMITS.maxEdits, 'maxEdits'), + maxAbsValue: finite(raw.maxAbsValue === undefined ? WSP_LIMITS.maxAbsValue : raw.maxAbsValue, 'maxAbsValue', 0, WSP_LIMITS.maxAbsValue), + maxAbsDelta: finite(raw.maxAbsDelta === undefined ? WSP_LIMITS.maxAbsDelta : raw.maxAbsDelta, 'maxAbsDelta', 0, WSP_LIMITS.maxAbsDelta) + }; +} +export function simdOption(value = 'auto') { + if (value !== true && value !== false && value !== 'auto') throw new TypeError('simd must be boolean or auto'); + return value; +} +export function deepFreeze(value) { + for (const child of Object.values(value)) if (child && typeof child === 'object') deepFreeze(child); + return Object.freeze(value); +} +export const clone = value => JSON.parse(JSON.stringify(value)); diff --git a/packages/wsp-toolkit/packages/search/src/index.d.ts b/packages/wsp-toolkit/packages/search/src/index.d.ts new file mode 100644 index 000000000..f916a6bc8 --- /dev/null +++ b/packages/wsp-toolkit/packages/search/src/index.d.ts @@ -0,0 +1,62 @@ +import type { DenseModel, EvaluationDataset, EvaluationPolicy, EvaluationOptions, PatchLimits, WeightPatch, WeightEvaluation, WeightMetrics, WeightBatch, WeightLocation } from 'ruv-fann-wsp'; + +export interface DiscreteWeightLocation extends WeightLocation { values: number[] } +export type Immutable = { readonly [K in keyof T]: T[K] extends object ? Immutable : T[K] }; +export interface ObjectiveInput { + readonly predictions: readonly number[]; + readonly metrics: Readonly; + /** A separate recursively frozen snapshot. Callback code is trusted and is not a sandbox. */ + readonly model: Immutable; +} +export interface SearchOptions extends EvaluationOptions { + locations: DiscreteWeightLocation[]; + /** Candidate inference screens, excluding the baseline and final two-pass authoritative evaluation; default 64, maximum 256. */ + maxEvaluations?: number; + /** Default 4; maximum 16. */ + maxPasses?: number; + /** May tighten the 10,000,000 aggregate parameter-row work ceiling. */ + maxWork?: number; + /** Synchronous trusted local callback; lower finite scores win. Default is MSE. No provider or generated code is executed. */ + objective?: (input: ObjectiveInput) => number; +} +export interface SearchResult { + schema: 'ruv-fann.weight-search/1'; + method: 'discrete-coordinate-search'; + baseHash: string; + objective: 'custom' | 'mse'; + baselineScore: number; + bestScore: number; + /** Null if no strictly better nonempty patch was found. */ + patch: WeightPatch | null; + /** Real-WASM evaluation of the winner against the original baseline and supplied policy. May reject the custom objective's preferred candidate. */ + evaluation: WeightEvaluation | null; + evaluations: number; + inferencePasses: number; + passes: number; + budgetExhausted: boolean; + reservedWork: number; + backend: 'wasm' | 'wasm-simd'; +} +export function searchWeightPatch(model: DenseModel | string, dataset: EvaluationDataset, policy: EvaluationPolicy, options: SearchOptions): Promise; +export const SEARCH_LIMITS: Readonly<{ maxLocations: 16; maxValues: 32; maxEvaluations: 256; maxPasses: 16; maxWork: number }>; +export interface BooleanTable { + /** 1..6 binary inputs. Rows are ordered as 00..0, 00..1, ... 11..1, most significant bit first. */ + inputs: number; + /** 1..16 binary outputs. */ + outputs: number; + /** Complete flattened row-major table of length (2 ** inputs) * outputs, containing only numeric 0 and 1. */ + targets: number[]; +} +/** Experimental direct compilation. Exact on the complete binary domain; unconstrained behavior for nonbinary inputs. */ +export function compileBooleanTable(table: BooleanTable): DenseModel; +export interface HebbianOptions { + layer: number; + /** Explicit flattened row-major weight indices; at most 128, no bias edits. */ + indices: number[]; + /** In (0,1]. Correlation updates are clipped to maxAbsDelta and maxAbsValue. */ + learningRate: number; + limits?: PatchLimits; + simd?: boolean | 'auto'; +} +/** Experimental correlation proposal using real-WASM activations. Always evaluate independently before promotion. */ +export function createHebbianPatch(model: DenseModel | string, batch: WeightBatch, options: HebbianOptions): Promise; diff --git a/packages/wsp-toolkit/packages/search/src/index.js b/packages/wsp-toolkit/packages/search/src/index.js new file mode 100644 index 000000000..8c1190f0b --- /dev/null +++ b/packages/wsp-toolkit/packages/search/src/index.js @@ -0,0 +1,176 @@ +import { loadRuntime } from 'ruv-fann'; +import { WSP_LIMITS, inspectWeightModel, evaluateWeightPatch, applyWeightPatch, traceWeightModel } from 'ruv-fann-wsp'; +import { record, integer, finite, array, numbers, modelSnapshot, dataSnapshot, limitsSnapshot, simdOption, clone, deepFreeze } from './data.js'; + +export const SEARCH_LIMITS = Object.freeze({ maxLocations: 16, maxValues: 32, maxEvaluations: 256, maxPasses: 16, maxWork: WSP_LIMITS.maxWork }); +function policySnapshot(value) { + const raw = record(value, ['maxMSE', 'maxRegressionMSE', 'maxAbsoluteError'], ['maxMSE', 'maxRegressionMSE'], 'policy'); + const policy = { maxMSE: finite(raw.maxMSE, 'maxMSE', 0), maxRegressionMSE: finite(raw.maxRegressionMSE, 'maxRegressionMSE', 0) }; + if (raw.maxAbsoluteError !== undefined) policy.maxAbsoluteError = finite(raw.maxAbsoluteError, 'maxAbsoluteError', 0); + return policy; +} +function locationsSnapshot(values, model, bounds) { + const seen = new Set(); + const locations = array(values, SEARCH_LIMITS.maxLocations, 'locations', value => { + const raw = record(value, ['layer', 'parameter', 'index', 'values'], ['layer', 'parameter', 'index', 'values'], 'location'); + const layer = integer(raw.layer, 0, model.layers.length - 1, 'location layer'); + if (raw.parameter !== 'weights' && raw.parameter !== 'bias') throw new TypeError('location parameter must be weights or bias'); + const index = integer(raw.index, 0, model.layers[layer][raw.parameter].length - 1, 'location index'); + const key = `${layer}:${raw.parameter}:${index}`; + if (seen.has(key)) throw new TypeError('duplicate location'); + seen.add(key); + const old = model.layers[layer][raw.parameter][index]; + const candidates = numbers(raw.values, SEARCH_LIMITS.maxValues, 'values'); + if (!candidates.length || new Set(candidates).size !== candidates.length) throw new RangeError('values must be nonempty and unique'); + for (const next of candidates) { + if (Math.abs(next) > bounds.maxAbsValue || Math.abs(next - old) > bounds.maxAbsDelta) throw new RangeError('candidate exceeds patch limits'); + } + return { layer, parameter: raw.parameter, index, values: candidates }; + }); + if (!locations.length || locations.length > bounds.maxEdits) throw new RangeError('locations exceed edit limits'); + return locations; +} +function measure(runtime, model, data, objective) { + const inputSize = model.layers[0].inputs, outputSize = model.layers.at(-1).outputs; + const maxRows = Math.min(data.rows, 32), prepared = runtime.prepare(model, { maxRows }); + const predictions = new Array(data.rows * outputSize); + const input = Float64Array.from(data.inputs); + let mse = 0, maxAbsoluteError = 0, count = 0; + try { + for (let first = 0; first < data.rows; first += maxRows) { + const rows = Math.min(maxRows, data.rows - first); + const output = prepared.predict(input.subarray(first * inputSize, (first + rows) * inputSize), rows); + for (let offset = 0; offset < output.length; offset++) { + const index = first * outputSize + offset; + predictions[index] = finite(output[offset], 'prediction'); + const error = finite(output[offset] - data.targets[index], 'prediction error'); + const square = finite(error * error, 'squared error'); + mse = finite(mse + (square - mse) / ++count, 'MSE'); + maxAbsoluteError = Math.max(maxAbsoluteError, Math.abs(error)); + } + } + } finally { prepared.dispose(); } + const metrics = { mse, maxAbsoluteError }; + const score = objective ? finite(objective(deepFreeze({ predictions, metrics: { ...metrics }, model: clone(model) })), 'objective score') : mse; + return { score, metrics }; +} +function patchFor(base, current, locations, baseHash) { + const edits = []; + for (const location of locations) { + const { layer, parameter, index } = location; + const value = current.layers[layer][parameter][index]; + if (value !== base.layers[layer][parameter][index]) edits.push({ layer, parameter, index, value }); + } + return edits.length ? { schema: 'ruv-fann.weight-patch/1', baseHash, edits } : null; +} + +/** Deterministic coordinate descent over explicit discrete values. Lower objective scores win; ties preserve the earlier model. */ +export async function searchWeightPatch(model, dataset, policy, options) { + const source = modelSnapshot(model), data = dataSnapshot(dataset, source.model), criteria = policySnapshot(policy); + const settings = record(options, ['locations', 'maxEvaluations', 'maxPasses', 'maxWork', 'objective', 'simd', 'limits'], ['locations'], 'search options'); + const bounds = limitsSnapshot(settings.limits), locations = locationsSnapshot(settings.locations, source.model, bounds); + const maxEvaluations = integer(settings.maxEvaluations === undefined ? 64 : settings.maxEvaluations, 1, SEARCH_LIMITS.maxEvaluations, 'maxEvaluations'); + const maxPasses = integer(settings.maxPasses === undefined ? 4 : settings.maxPasses, 1, SEARCH_LIMITS.maxPasses, 'maxPasses'); + const maxWork = integer(settings.maxWork === undefined ? SEARCH_LIMITS.maxWork : settings.maxWork, 1, SEARCH_LIMITS.maxWork, 'maxWork'); + const simd = simdOption(settings.simd); + const objective = settings.objective; + if (objective !== undefined && typeof objective !== 'function') throw new TypeError('objective must be a trusted synchronous callback'); + const plannedEvaluations = Math.min(maxEvaluations, maxPasses * locations.reduce((sum, x) => sum + x.values.length, 0)); + // Baseline + candidate screens + the authoritative final baseline/candidate evaluation. + const reservedWork = (plannedEvaluations + 3) * data.rows * source.parameters; + if (reservedWork > maxWork) throw new RangeError('search exceeds aggregate work budget'); + const inspection = await inspectWeightModel(source.model); + const runtime = await loadRuntime({ simd }); + let current = clone(source.model), best = measure(runtime, current, data, objective), evaluations = 0, passes = 0; + const baselineScore = best.score; + outer: for (; passes < maxPasses;) { + passes++; + let improved = false; + for (const location of locations) { + for (const next of location.values) { + if (next === current.layers[location.layer][location.parameter][location.index]) continue; + if (evaluations >= maxEvaluations) break outer; + const candidate = clone(current); + candidate.layers[location.layer][location.parameter][location.index] = next; + const result = measure(runtime, candidate, data, objective); + evaluations++; + if (result.score < best.score) { current = candidate; best = result; improved = true; } + } + } + if (!improved || (!objective && best.score === 0)) break; + } + const patch = patchFor(source.model, current, locations, inspection.baseHash); + const evaluation = patch ? await evaluateWeightPatch(source.model, patch, data, criteria, { simd, limits: bounds }) : null; + return { schema: 'ruv-fann.weight-search/1', method: 'discrete-coordinate-search', baseHash: inspection.baseHash, + objective: objective ? 'custom' : 'mse', baselineScore, bestScore: best.score, patch, evaluation, + evaluations, inferencePasses: 1 + evaluations + (patch ? 2 : 0), passes, + budgetExhausted: evaluations >= maxEvaluations, reservedWork, backend: runtime.backend }; +} + +/** Experimental: compile a complete binary truth table into exact pattern-detector Threshold layers. */ +export function compileBooleanTable(table) { + const raw = record(table, ['inputs', 'outputs', 'targets'], ['inputs', 'outputs', 'targets'], 'boolean table'); + const inputs = integer(raw.inputs, 1, 6, 'boolean inputs'), outputs = integer(raw.outputs, 1, 16, 'boolean outputs'); + const rows = 2 ** inputs; + const targets = numbers(raw.targets, rows * outputs, 'boolean targets'); + if (targets.length !== rows * outputs || targets.some(x => x !== 0 && x !== 1)) throw new RangeError('targets must contain the complete 0/1 truth table'); + const weights = [], bias = [], outputWeights = []; + for (let row = 0; row < rows; row++) { + let ones = 0; + for (let input = 0; input < inputs; input++) { + const bit = (row >> (inputs - input - 1)) & 1; + weights.push(bit ? 1 : -1); ones += bit; + } + bias.push(0.5 - ones); + } + for (let output = 0; output < outputs; output++) for (let row = 0; row < rows; row++) outputWeights.push(targets[row * outputs + output]); + return { schema: 'ruv-fann.dense-layers/1', layers: [ + { inputs, outputs: rows, weights, bias, activation: 'Threshold', steepness: 1 }, + { inputs: rows, outputs, weights: outputWeights, bias: Array(outputs).fill(-0.5), activation: 'Threshold', steepness: 1 } + ] }; +} + +/** Experimental: propose Δw = rate * mean(pre * post) at explicit weight indices, clipped to edit bounds. No training or promotion. */ +export async function createHebbianPatch(model, batch, options) { + const source = modelSnapshot(model), data = dataSnapshot(batch, source.model, false); + const raw = record(options, ['layer', 'indices', 'learningRate', 'limits', 'simd'], ['layer', 'indices', 'learningRate'], 'Hebbian options'); + const layer = integer(raw.layer, 0, source.model.layers.length - 1, 'Hebbian layer'); + const indices = array(raw.indices, WSP_LIMITS.maxEdits, 'indices', x => integer(x, 0, source.model.layers[layer].weights.length - 1, 'weight index')); + if (!indices.length || new Set(indices).size !== indices.length) throw new RangeError('indices must be nonempty and unique'); + const rate = finite(raw.learningRate, 'learningRate', Number.MIN_VALUE, 1), bounds = limitsSnapshot(raw.limits), simd = simdOption(raw.simd); + if (indices.length > bounds.maxEdits) throw new RangeError('indices exceed maxEdits'); + if ((2 * source.parameters + indices.length) * data.rows > WSP_LIMITS.maxWork) throw new RangeError('Hebbian proposal exceeds aggregate work budget'); + // traceWeightModel separately enforces aggregate trace storage and two-pass work limits. + const trace = await traceWeightModel(source.model, data, { simd }); + const info = source.model.layers[layer], pre = layer === 0 ? data.inputs : trace.layers[layer - 1].activations; + const post = trace.layers[layer].activations, edits = []; + for (const index of indices) { + const input = index % info.inputs, output = Math.floor(index / info.inputs); + let correlation = 0; + for (let row = 0; row < data.rows; row++) { + const product = finite(pre[row * info.inputs + input] * post[row * info.outputs + output], 'Hebbian product'); + correlation = finite(correlation + (product - correlation) / (row + 1), 'Hebbian mean'); + } + const old = info.weights[index], delta = Math.max(-bounds.maxAbsDelta, Math.min(bounds.maxAbsDelta, finite(rate * correlation, 'Hebbian delta'))); + let next = Math.max(-bounds.maxAbsValue, Math.min(bounds.maxAbsValue, old + delta)); + // Adding the clipped delta may round just outside the strict represented-delta bound. + // Move a few ULPs toward the source rather than weakening the authoritative patch check. + for (let attempt = 0; Math.abs(next - old) > bounds.maxAbsDelta && attempt < 4; attempt++) next = nextToward(next, old); + if (Math.abs(next - old) > bounds.maxAbsDelta) throw new RangeError('source weight is outside admissible Hebbian patch bounds'); + if (next !== old) edits.push({ layer, parameter: 'weights', index, value: next }); + } + if (!edits.length) throw new RangeError('Hebbian proposal has no representable edits'); + const patch = { schema: 'ruv-fann.weight-patch/1', baseHash: trace.baseHash, edits }; + await applyWeightPatch(source.model, patch, bounds); + return patch; +} + +function nextToward(value, target) { + if (value === target) return value; + if (value === 0) return target > 0 ? Number.MIN_VALUE : -Number.MIN_VALUE; + const view = new DataView(new ArrayBuffer(8)); + view.setFloat64(0, value); + const bits = view.getBigUint64(0); + view.setBigUint64(0, bits + ((value > 0) === (target > value) ? 1n : -1n)); + return view.getFloat64(0); +} diff --git a/packages/wsp-toolkit/packages/search/test/search.test.mjs b/packages/wsp-toolkit/packages/search/test/search.test.mjs new file mode 100644 index 000000000..949d22273 --- /dev/null +++ b/packages/wsp-toolkit/packages/search/test/search.test.mjs @@ -0,0 +1,202 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { loadRuntime } from 'ruv-fann'; +import { applyWeightPatch, createWeightWorkspace, fingerprintModel } from 'ruv-fann-wsp'; +import { searchWeightPatch, compileBooleanTable, createHebbianPatch, SEARCH_LIMITS } from '../src/index.js'; +const linear = (weight = 0) => ({ schema: 'ruv-fann.dense-layers/1', layers: [ + { inputs: 1, outputs: 1, weights: [weight], bias: [0], activation: 'Linear', steepness: 1 } +] }); +const data = () => ({ inputs: [1, 2], targets: [2, 4], rows: 2 }); +const policy = () => ({ maxMSE: 0, maxRegressionMSE: 0 }); +const location = (values = [0, 1, 2]) => ({ layer: 0, parameter: 'weights', index: 0, values }); +const options = extra => ({ locations: [location()], simd: false, ...extra }); +function predict(runtime, model, inputs, rows) { + const prepared = runtime.prepare(model, { maxRows: rows }); + try { return Array.from(prepared.predict(Float64Array.from(inputs), rows)); } + finally { prepared.dispose(); } +} + +test('deterministic search caches baseline, matches analytic MSE and requires explicit promotion', async () => { + const model = linear(), original = structuredClone(model); + const result = await searchWeightPatch(model, data(), policy(), options()); + assert.equal(result.baselineScore, 10); // mean([(-2)^2,(-4)^2]) + assert.equal(result.bestScore, 0); + assert.equal(result.evaluation.candidate.mse, 0); + assert.equal(result.evaluation.accepted, true); + assert.equal(result.backend, 'wasm'); + assert.equal(result.evaluations, 2); + assert.equal(result.inferencePasses, 5); + assert.deepEqual(result.patch.edits, [{ layer: 0, parameter: 'weights', index: 0, value: 2 }]); + assert.deepEqual(model, original); + const workspace = await createWeightWorkspace(model, { simd: false }); + assert.equal(workspace.snapshot().revision, 1); + const proposal = await workspace.propose(result.patch, data(), policy()); + assert.equal(workspace.promote(proposal.id, 1).revision, 2); +}); + +test('two-coordinate XOR repair, bounded no-gradient search', async () => { + const model = { schema: 'ruv-fann.dense-layers/1', layers: [ + { inputs: 2, outputs: 2, weights: [1,-1,-1,1], bias: [0,0], activation: 'ReLU', steepness: 1 }, + { inputs: 2, outputs: 1, weights: [0,0], bias: [0], activation: 'Linear', steepness: 1 } + ] }; + const result = await searchWeightPatch(model, { inputs: [0,0,0,1,1,0,1,1], targets: [0,1,1,0], rows: 4 }, policy(), { + locations: [0,1].map(index => ({ layer: 1, parameter: 'weights', index, values: [0,1] })), simd: true + }); + assert.equal(result.evaluation.accepted, true); + assert.equal(result.evaluation.candidate.mse, 0); + assert.equal(result.patch.edits.length, 2); + assert.equal(result.backend, 'wasm-simd'); +}); + +test('discontinuous trusted objective can prefer a candidate rejected by authoritative MSE gate', async () => { + let calls = 0; + const result = await searchWeightPatch(linear(), data(), policy(), options({ + locations: [location([0,1])], objective(frame) { + calls++; + assert(Object.isFrozen(frame) && Object.isFrozen(frame.predictions) && Object.isFrozen(frame.model.layers[0].weights)); + return frame.predictions.filter(x => x < 0.5).length; + } + })); + assert.equal(result.objective, 'custom'); + assert.equal(result.bestScore, 0); + assert.equal(result.evaluation.accepted, false); + assert.equal(result.evaluation.candidate.mse, 2.5); + assert.equal(calls, 1 + result.evaluations); +}); + +test('no improvement returns no patch; strict ties are stable', async () => { + const result = await searchWeightPatch(linear(2), data(), policy(), options({ locations: [location([1,2,3])] })); + assert.equal(result.patch, null); assert.equal(result.evaluation, null); + assert.equal(result.bestScore, 0); assert.equal(result.evaluations, 2); + const constant = await searchWeightPatch(linear(), data(), policy(), options({ objective: () => 1 })); + assert.equal(constant.patch, null); +}); + +test('snapshots all mutable caller data before first await', async () => { + const model = linear(), dataset = data(), criteria = policy(), config = options(); + const pending = searchWeightPatch(model, dataset, criteria, config); + model.layers[0].weights[0] = 100; + dataset.inputs[0] = 100; dataset.targets[0] = 100; + criteria.maxMSE = 1000; config.locations[0].values[2] = 100; + const result = await pending; + assert.equal(result.baselineScore, 10); assert.equal(result.bestScore, 0); + assert.equal(result.patch.edits[0].value, 2); +}); + +test('budget is global and cannot be raised; candidate evaluation cap is exact', async () => { + const result = await searchWeightPatch(linear(), data(), policy(), options({ maxEvaluations: 1 })); + assert.equal(result.evaluations, 1); assert.equal(result.budgetExhausted, true); + assert.equal(result.evaluation.accepted, false); + await assert.rejects(searchWeightPatch(linear(), data(), policy(), options({ maxWork: 1 })), /aggregate work/); + await assert.rejects(searchWeightPatch(linear(), data(), policy(), options({ maxWork: SEARCH_LIMITS.maxWork + 1 })), /maxWork/); + await assert.rejects(searchWeightPatch(linear(), data(), policy(), options({ maxEvaluations: 257 })), /maxEvaluations/); + await assert.rejects(searchWeightPatch(linear(), data(), policy(), options({ maxPasses: 17 })), /maxPasses/); +}); + +test('malformed choices, nonfinite scores, getters, sparse arrays and relaxed patch bounds reject', async () => { + const bad = [ + { locations: [] }, { locations: [location([])] }, { locations: [location([1,1])] }, + { locations: [location(), location()] }, { locations: [location([Infinity])] }, + { locations: [{ ...location(), index: 1 }] }, { locations: [{ ...location(), parameter: 'activation' }] }, + { locations: [location([1001])] }, { maxEvaluations: 0 }, { maxEvaluations: null }, { maxPasses: null }, { maxWork: null }, { limits: { maxAbsDelta: null } }, { simd: 'yes' }, { unknown: true }, + { limits: { maxEdits: 129 } }, { limits: { maxAbsDelta: 1001 } }, { objective: 'return 0' } + ]; + for (const config of bad) await assert.rejects(searchWeightPatch(linear(), data(), policy(), options(config))); + await assert.rejects(searchWeightPatch(linear(), data(), policy(), options({ objective: () => Infinity })), /objective score/); + await assert.rejects(searchWeightPatch(linear(), data(), policy(), options({ objective: async () => 1 })), /objective score/); + let called = 0; + const accessor = { get locations() { called++; return [location()]; } }; + await assert.rejects(searchWeightPatch(linear(), data(), policy(), accessor), /accessors/); + const sparse = options({ locations: new Array(1) }); + await assert.rejects(searchWeightPatch(linear(), data(), policy(), sparse), /own data/); + const values = [0,1]; Object.defineProperty(values, '1', { get() { called++; return 2; } }); + await assert.rejects(searchWeightPatch(linear(), data(), policy(), options({ locations: [location(values)] })), /own data/); + assert.equal(called, 0); +}); + +test('complete Boolean compilation agrees with exhaustive independent parity and conjunction oracles', async () => { + const runtime = await loadRuntime({ simd: false }); + for (const n of [1,2,3,6]) { + const inputs = [], targets = []; + for (let row = 0; row < 2 ** n; row++) { + const bits = Array.from({ length: n }, (_, i) => (row >> (n - i - 1)) & 1); + inputs.push(...bits); + targets.push(bits.reduce((sum, x) => sum + x, 0) % 2, bits.every(Boolean) ? 1 : 0); + } + const model = compileBooleanTable({ inputs: n, outputs: 2, targets }); + assert.deepEqual(predict(runtime, model, inputs, 2 ** n), targets); + } +}); + +test('Boolean compiler rejects partial, nonbinary and oversized tables without reading getters', () => { + for (const table of [ + { inputs: 0, outputs: 1, targets: [] }, { inputs: 7, outputs: 1, targets: [] }, + { inputs: 1, outputs: 17, targets: [] }, { inputs: 1, outputs: 1, targets: [0] }, + { inputs: 1, outputs: 1, targets: [0,2] }, { inputs: 1, outputs: 1, targets: [false,true] } + ]) assert.throws(() => compileBooleanTable(table)); + let calls = 0; + assert.throws(() => compileBooleanTable({ inputs: 1, outputs: 1, get targets() { calls++; return [0,1]; } }), /accessors/); + assert.equal(calls, 0); +}); + +test('Hebbian correlation matches analytic oracle, clips limits and leaves model untouched', async () => { + const model = linear(1), original = structuredClone(model); + const patch = await createHebbianPatch(model, { inputs: [1,2], rows: 2 }, { layer: 0, indices: [0], learningRate: 0.1, simd: false }); + // pre=post=[1,2]; mean(pre*post)=2.5; delta=0.25. + assert.equal(patch.edits[0].value, 1.25); + assert.equal(patch.baseHash, await fingerprintModel(model)); + assert.equal((await applyWeightPatch(model, patch)).layers[0].weights[0], 1.25); + assert.deepEqual(model, original); + const clipped = await createHebbianPatch(model, { inputs: [1,2], rows: 2 }, { + layer: 0, indices: [0], learningRate: 1, limits: { maxAbsDelta: 0.1 }, simd: false + }); + assert(Math.abs(clipped.edits[0].value - 1.1) < 1e-14); + assert(Math.abs(clipped.edits[0].value - 1) <= 0.1); +}); + +test('Hebbian hidden-layer inputs use prior actual activations and snapshot caller values', async () => { + const model = { schema: 'ruv-fann.dense-layers/1', layers: [ + { inputs: 1, outputs: 1, weights: [-1], bias: [0], activation: 'ReLU', steepness: 1 }, + { inputs: 1, outputs: 1, weights: [1], bias: [0], activation: 'Linear', steepness: 1 } + ] }; + const batch = { inputs: [-2,1], rows: 2 }, config = { layer: 1, indices: [0], learningRate: 0.1, simd: false }; + const pending = createHebbianPatch(model, batch, config); + model.layers[1].weights[0] = 100; batch.inputs[0] = 100; config.indices[0] = 100; + const patch = await pending; + assert(Math.abs(patch.edits[0].value - 1.2) < 1e-14); // pre=post=[2,0], mean product=2. +}); + +test('Hebbian invalid, duplicate, overflow and zero updates reject', async () => { + for (const config of [ + { layer: 1, indices: [0], learningRate: 1 }, { layer: 0, indices: [1], learningRate: 1 }, + { layer: 0, indices: [0,0], learningRate: 1 }, { layer: 0, indices: [], learningRate: 1 }, + { layer: 0, indices: [0], learningRate: 0 }, { layer: 0, indices: [0], learningRate: 2 } + ]) await assert.rejects(createHebbianPatch(linear(1), { inputs: [1], rows: 1 }, config)); + await assert.rejects(createHebbianPatch(linear(0), { inputs: [1], rows: 1 }, { layer: 0, indices: [0], learningRate: 1 }), /no representable/); + await assert.rejects(createHebbianPatch(linear(1), { inputs: [1e200], rows: 1 }, { layer: 0, indices: [0], learningRate: 1 }), /finite|overflow/); +}); + +test('custom objective cannot bypass the regression policy', async () => { + const result = await searchWeightPatch(linear(2), data(), { maxMSE: 100, maxRegressionMSE: 0 }, options({ + locations: [location([2,3])], objective: ({ predictions }) => -predictions[0] + })); + assert.equal(result.bestScore, -3); + assert.equal(result.evaluation.baseline.mse, 0); + assert.equal(result.evaluation.candidate.mse, 2.5); + assert.equal(result.evaluation.accepted, false); + assert.deepEqual(result.evaluation.reasons, ['candidate MSE regression exceeds maxRegressionMSE']); +}); + +test('source schema and aggregate multi-candidate work reject before callbacks execute', async () => { + let calls = 0; + const big = { schema: 'ruv-fann.dense-layers/1', layers: [ + { inputs: 1, outputs: 64, weights: Array(64).fill(0), bias: Array(64).fill(0), activation: 'Linear', steepness: 1 }, + { inputs: 64, outputs: 1, weights: Array(64).fill(0), bias: [0], activation: 'Linear', steepness: 1 } + ] }; + await assert.rejects(searchWeightPatch(big, { inputs: Array(1024).fill(0), targets: Array(1024).fill(0), rows: 1024 }, policy(), { + locations: [location(Array.from({ length: 32 }, (_, i) => i))], maxPasses: 16, objective: () => { calls++; return 0; } + }), /aggregate work/); + const malformed = linear(); malformed.layers[0].activation = 'made-up'; + await assert.rejects(searchWeightPatch(malformed, data(), policy(), options({ objective: () => { calls++; return 0; } })), /activation/); + assert.equal(calls, 0); +}); diff --git a/packages/wsp-toolkit/packages/swarm/LICENSE b/packages/wsp-toolkit/packages/swarm/LICENSE new file mode 100644 index 000000000..2dd524ac3 --- /dev/null +++ b/packages/wsp-toolkit/packages/swarm/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 rUv + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/wsp-toolkit/packages/swarm/README.md b/packages/wsp-toolkit/packages/swarm/README.md new file mode 100644 index 000000000..59149a752 --- /dev/null +++ b/packages/wsp-toolkit/packages/swarm/README.md @@ -0,0 +1,30 @@ +# ruv-fann-wsp-swarm + +A bounded scheduler for actual Node `worker_threads`. Each worker executes a shipped, fixed operation with its own JavaScript/WASM runtime. No provider call, generated JavaScript, shell command, model publication or checkpoint promotion is exposed. Worker threads are **not a security sandbox**. + +```js +import { runProposalSwarm, estimateSwarmWork } from 'ruv-fann-wsp-swarm'; + +const jobs = [false, true].map((simd, index) => ({ + id: `candidate-${index}`, kind: 'search', model, dataset, policy, + searchOptions: { locations, maxEvaluations: 8, maxPasses: 2, simd } +})); +const reservedWork = estimateSwarmWork(jobs); +const results = await runProposalSwarm(jobs, { concurrency: 2, timeoutMs: 5000, maxTotalWork: reservedWork }); +``` + +`runProposalSwarm(jobs, options?)` returns one result per input job in the same order. Search jobs run `ruv-fann-wsp-search@0.1.0` with real scalar/SIMD WASM. `{id,kind:'patch',patch}` jobs transport a bounded candidate without evaluating it. A successful result is `{id,status:'ok',patch,workerThreadId,search?}`; search summaries contain `evaluations`, `inferencePasses`, `reservedWork` and `backend`. A search with no strictly improving patch returns `patch: null`. Runtime failure, timeout and cancellation return statuses `error`, `timeout` and `cancelled`; errors contain at most 512 characters. Parent-process monotonic `startedAtMs`/`finishedAtMs` timestamps describe started workers and include awaited cleanup. + +Every caller-owned data value is snapshotted before the first asynchronous yield. Unknown operations/options, objective callbacks, functions, accessors, sparse arrays, cycles and executable fields are rejected. Hard limits: 64 jobs, 4 concurrent workers, 10 MiB aggregate JSON input, 60-second per-worker deadline, 10 million parameter-row work per search and 100 million across the swarm. `maxTotalWork` may tighten the total bound. Search work uses the same conservative baseline/screens/final-evaluation reservation as the search library; patch transport reserves zero inference work, so the coordinator must separately budget its authoritative evaluation. `estimateSwarmWork(jobs)` validates the same input contract and returns this reservation without starting workers. Data/model limits from the base WSP SDK also apply. + +Abort signals prevent queued jobs from starting and terminate active workers. Deadline measurement includes worker startup. The scheduler awaits termination after successful messages, errors, exits, timeouts and aborts, and ignores late messages. Operations within one job are synchronous WASM, so cancellation terminates its worker rather than depending on cooperative polling. + +All results remain untrusted proposals. An independent coordinator must apply patches to the expected base, re-evaluate trusted selection/held-out data and invariants, then use its own durable proposal authority and expected revision. Worker metadata and receipts never grant promotion authority. Runtime resource limits are supplemental V8 limits; they are not hard limits on all native/WASM memory or a boundary for hostile library code. + + + +Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). + +These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. + + diff --git a/packages/wsp-toolkit/packages/swarm/constellation.json b/packages/wsp-toolkit/packages/swarm/constellation.json new file mode 100644 index 000000000..add04c250 --- /dev/null +++ b/packages/wsp-toolkit/packages/swarm/constellation.json @@ -0,0 +1,15 @@ +{ + "schema": "ruvnet.constellation-module/1", + "name": "ruv-fann-wsp-swarm", + "version": "0.1.0", + "role": "satellite", + "contracts": [ + "ruvnet.constellation-module/1", + "ruv-fann.dense-layers/1", + "ruv-fann.weight-patch/1" + ], + "integrations": [ + "ruv-fann-wsp", + "ruv-fann-wsp-search" + ] +} diff --git a/packages/wsp-toolkit/packages/swarm/package.json b/packages/wsp-toolkit/packages/swarm/package.json new file mode 100644 index 000000000..c9bee6eb3 --- /dev/null +++ b/packages/wsp-toolkit/packages/swarm/package.json @@ -0,0 +1,36 @@ +{ + "name": "ruv-fann-wsp-swarm", + "version": "0.1.0", + "description": "Bounded fixed-operation proposal workers using real Node worker threads and WASM", + "type": "module", + "main": "./src/index.js", + "types": "./src/index.d.ts", + "engines": { + "node": ">=20.9.0" + }, + "exports": { + ".": { + "types": "./src/index.d.ts", + "import": "./src/index.js" + } + }, + "files": [ + "src", + "README.md", + "LICENSE", + "constellation.json" + ], + "dependencies": { + "ruv-fann-wsp": "0.2.0", + "ruv-fann-wsp-search": "0.1.0" + }, + "scripts": { + "test": "node --test test/*.test.mjs" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/ruvnet/ruv-FANN.git", + "directory": "packages/wsp-toolkit/packages/swarm" + } +} diff --git a/packages/wsp-toolkit/packages/swarm/src/data.js b/packages/wsp-toolkit/packages/swarm/src/data.js new file mode 100644 index 000000000..610395721 --- /dev/null +++ b/packages/wsp-toolkit/packages/swarm/src/data.js @@ -0,0 +1,209 @@ +import { WSP_LIMITS } from 'ruv-fann-wsp'; + +export const SWARM_LIMITS = Object.freeze({ maxJobs: 64, maxConcurrency: 4, maxBytes: 10 * 1024 * 1024, + maxTimeoutMs: 60_000, maxTotalWork: 100_000_000 }); +const activationNames = new Set(['Linear', 'Threshold', 'ThresholdSymmetric', 'Sigmoid', 'SigmoidSymmetric', + 'Tanh', 'Gaussian', 'GaussianSymmetric', 'Elliot', 'ElliotSymmetric', 'LinearPiece', 'LinearPieceSymmetric', + 'ReLU', 'ReLULeaky', 'Sin', 'Cos', 'SinSymmetric', 'CosSymmetric', 'Gelu', 'Swish', 'LeakyRelu']); + +export function record(value, allowed, required, name) { + if (!value || typeof value !== 'object' || Array.isArray(value) || + ![Object.prototype, null].includes(Object.getPrototypeOf(value))) throw new TypeError(`${name} must be plain data`); + const out = Object.create(null); + for (const key of Reflect.ownKeys(value)) { + if (typeof key !== 'string' || !allowed.includes(key)) throw new TypeError(`unknown ${name} field`); + const descriptor = Object.getOwnPropertyDescriptor(value, key); + if (!descriptor || !Object.hasOwn(descriptor, 'value')) throw new TypeError(`${name} accessors are forbidden`); + out[key] = descriptor.value; + } + if (required.some(key => !Object.hasOwn(out, key))) throw new TypeError(`missing ${name} field`); + return out; +} +export function integer(value, minimum, maximum, name) { + if (!Number.isSafeInteger(value) || value < minimum || value > maximum) throw new RangeError(`${name} must be in ${minimum}..${maximum}`); + return value; +} +function finite(value, name, minimum = -Number.MAX_VALUE, maximum = Number.MAX_VALUE) { + if (typeof value !== 'number' || !Number.isFinite(value) || value < minimum || value > maximum) throw new RangeError(`${name} must be finite and in bounds`); + return value === 0 ? 0 : value; +} +function shape(value, allowed, required, name) { + return record(value, allowed, required, name); +} +function numbers(value, expected, name) { + if (!Array.isArray(value) || value.length !== expected || value.length > WSP_LIMITS.maxElements) + throw new RangeError(`${name} dimensions disagree`); + for (const item of value) finite(item, name); + return value; +} + +/** Bounded deep snapshot; no caller getters, iterators, toJSON or functions are invoked. */ +export function snapshotJobs(value) { + let bytes = 0, nodes = 0; + const ancestors = new Set(); + const budget = count => { bytes += count; if (bytes > SWARM_LIMITS.maxBytes) throw new RangeError('swarm input exceeds aggregate byte limit'); }; + function string(value) { + if (value.length > WSP_LIMITS.maxModelBytes) throw new RangeError('swarm input string exceeds byte limit'); + // A string is capped before escaping; this allocation is at most 6 MiB. + budget(Buffer.byteLength(JSON.stringify(value))); + return value; + } + function copy(item, depth) { + if (++nodes > 700_000 || depth > 16) throw new RangeError('swarm input exceeds structural limits'); + if (typeof item === 'number') { const result = finite(item, 'input number'); budget(String(result).length); return result; } + if (typeof item === 'string') return string(item); + if (item === null || typeof item === 'boolean') { budget(item === null ? 4 : item ? 4 : 5); return item; } + if (!item || typeof item !== 'object' || ancestors.has(item)) throw new TypeError('swarm jobs must be acyclic JSON data'); + const array = Array.isArray(item); + if (!(array ? [Array.prototype, null].includes(Object.getPrototypeOf(item)) : + [Object.prototype, null].includes(Object.getPrototypeOf(item)))) throw new TypeError('swarm jobs must contain plain data'); + ancestors.add(item); + const keys = Reflect.ownKeys(item); + let out; + if (array) { + const length = integer(Object.getOwnPropertyDescriptor(item, 'length')?.value, 0, WSP_LIMITS.maxElements, 'array length'); + if (keys.length !== length + 1) throw new TypeError('swarm arrays must have dense own elements only'); + out = new Array(length); + budget(length ? length + 1 : 2); + for (let index = 0; index < length; index++) { + const descriptor = Object.getOwnPropertyDescriptor(item, String(index)); + if (!descriptor || !Object.hasOwn(descriptor, 'value')) throw new TypeError('swarm arrays cannot contain holes or accessors'); + out[index] = copy(descriptor.value, depth + 1); + } + } else { + if (keys.length > 64) throw new RangeError('swarm object has too many fields'); + out = Object.create(null); + budget(keys.length ? keys.length + 1 : 2); + for (const key of keys) { + if (typeof key !== 'string' || key.length > 128 || ['__proto__', 'constructor', 'prototype'].includes(key)) + throw new TypeError('swarm object contains an unsafe field'); + string(key); budget(1); + const descriptor = Object.getOwnPropertyDescriptor(item, key); + if (!descriptor || !Object.hasOwn(descriptor, 'value')) throw new TypeError('swarm accessors are forbidden'); + out[key] = copy(descriptor.value, depth + 1); + } + } + ancestors.delete(item); + return out; + } + if (!Array.isArray(value)) throw new TypeError('jobs must be an array'); + integer(Object.getOwnPropertyDescriptor(value, 'length')?.value, 1, SWARM_LIMITS.maxJobs, 'job count'); + return copy(value, 0); +} + +function modelInfo(input) { + let value = input; + if (typeof value === 'string') { + if (Buffer.byteLength(value) > WSP_LIMITS.maxModelBytes) throw new RangeError('model exceeds byte limit'); + value = JSON.parse(value); + } + const source = shape(value, ['schema', 'layers'], ['schema', 'layers'], 'model'); + if (source.schema !== 'ruv-fann.dense-layers/1' || !Array.isArray(source.layers)) throw new TypeError('invalid dense model schema'); + integer(source.layers.length, 1, WSP_LIMITS.maxLayers, 'layer count'); + let parameters = 0, previous; + const layers = source.layers.map(value => { + const layer = shape(value, ['inputs', 'outputs', 'weights', 'bias', 'activation', 'steepness'], + ['inputs', 'outputs', 'weights', 'activation', 'steepness'], 'layer'); + const inputs = integer(layer.inputs, 1, WSP_LIMITS.maxDimension, 'inputs'); + const outputs = integer(layer.outputs, 1, WSP_LIMITS.maxDimension, 'outputs'); + if (previous !== undefined && previous !== inputs) throw new RangeError('adjacent model dimensions disagree'); + previous = outputs; + parameters += inputs * outputs + outputs; + integer(parameters, 1, WSP_LIMITS.maxParameters, 'parameter count'); + if (!activationNames.has(layer.activation)) throw new TypeError('unsupported activation'); + const weights = numbers(layer.weights, inputs * outputs, 'weights'); + const bias = layer.bias == null ? Array(outputs).fill(0) : numbers(layer.bias, outputs, 'bias'); + return { inputs, outputs, weights, bias, activation: layer.activation, steepness: finite(layer.steepness, 'steepness') }; + }); + const model = { schema: source.schema, layers }; + if (Buffer.byteLength(JSON.stringify(model)) > WSP_LIMITS.maxModelBytes) throw new RangeError('model exceeds canonical byte limit'); + return { model, parameters }; +} +function datasetInfo(value, model) { + const source = shape(value, ['inputs', 'targets', 'rows'], ['inputs', 'targets', 'rows'], 'dataset'); + const rows = integer(source.rows, 1, WSP_LIMITS.maxRows, 'rows'); + numbers(source.inputs, rows * model.layers[0].inputs, 'dataset inputs'); + numbers(source.targets, rows * model.layers.at(-1).outputs, 'dataset targets'); + return source; +} +function policyInfo(value) { + const source = shape(value, ['maxMSE', 'maxRegressionMSE', 'maxAbsoluteError'], ['maxMSE', 'maxRegressionMSE'], 'policy'); + finite(source.maxMSE, 'maxMSE', 0); finite(source.maxRegressionMSE, 'maxRegressionMSE', 0); + if (Object.hasOwn(source, 'maxAbsoluteError')) finite(source.maxAbsoluteError, 'maxAbsoluteError', 0); + return source; +} +function searchInfo(value, model) { + const source = shape(value, ['locations', 'maxEvaluations', 'maxPasses', 'maxWork', 'simd', 'limits'], ['locations'], 'search options'); + const limits = shape(source.limits === undefined ? {} : source.limits, ['maxEdits', 'maxAbsValue', 'maxAbsDelta'], [], 'limits'); + const maxEdits = limits.maxEdits === undefined ? WSP_LIMITS.maxEdits : integer(limits.maxEdits, 1, WSP_LIMITS.maxEdits, 'maxEdits'); + const maxAbsValue = limits.maxAbsValue === undefined ? WSP_LIMITS.maxAbsValue : finite(limits.maxAbsValue, 'maxAbsValue', 0, WSP_LIMITS.maxAbsValue); + const maxAbsDelta = limits.maxAbsDelta === undefined ? WSP_LIMITS.maxAbsDelta : finite(limits.maxAbsDelta, 'maxAbsDelta', 0, WSP_LIMITS.maxAbsDelta); + if (source.simd !== undefined && source.simd !== false && source.simd !== true && source.simd !== 'auto') throw new TypeError('simd must be boolean or auto'); + if (!Array.isArray(source.locations)) throw new TypeError('locations must be an array'); + integer(source.locations.length, 1, Math.min(16, maxEdits), 'location count'); + const seen = new Set(); let choices = 0; + for (const item of source.locations) { + const location = shape(item, ['layer', 'parameter', 'index', 'values'], ['layer', 'parameter', 'index', 'values'], 'location'); + const layer = integer(location.layer, 0, model.layers.length - 1, 'location layer'); + if (location.parameter !== 'weights' && location.parameter !== 'bias') throw new TypeError('invalid location parameter'); + const index = integer(location.index, 0, model.layers[layer][location.parameter].length - 1, 'location index'); + const key = `${layer}:${location.parameter}:${index}`; + if (seen.has(key)) throw new TypeError('duplicate search location'); + seen.add(key); + if (!Array.isArray(location.values)) throw new TypeError('location values must be an array'); + integer(location.values.length, 1, 32, 'choice count'); + if (new Set(location.values).size !== location.values.length) throw new TypeError('duplicate search value'); + const old = model.layers[layer][location.parameter][index]; + for (const value of location.values) { + finite(value, 'candidate value', -maxAbsValue, maxAbsValue); + if (Math.abs(value - old) > maxAbsDelta) throw new RangeError('candidate exceeds maxAbsDelta'); + } + choices += location.values.length; + } + const maxEvaluations = source.maxEvaluations === undefined ? 64 : integer(source.maxEvaluations, 1, 256, 'maxEvaluations'); + const maxPasses = source.maxPasses === undefined ? 4 : integer(source.maxPasses, 1, 16, 'maxPasses'); + const maxWork = source.maxWork === undefined ? WSP_LIMITS.maxWork : integer(source.maxWork, 1, WSP_LIMITS.maxWork, 'search maxWork'); + return { options: source, plannedPasses: Math.min(maxEvaluations, maxPasses * choices) + 3, maxWork }; +} +export function patchInfo(value) { + const patch = shape(value, ['schema', 'baseHash', 'edits'], ['schema', 'baseHash', 'edits'], 'patch'); + if (patch.schema !== 'ruv-fann.weight-patch/1' || typeof patch.baseHash !== 'string' || !/^[a-f0-9]{64}$/.test(patch.baseHash)) + throw new TypeError('invalid patch schema or baseHash'); + if (!Array.isArray(patch.edits)) throw new TypeError('patch edits must be an array'); + integer(patch.edits.length, 1, WSP_LIMITS.maxEdits, 'edit count'); + const seen = new Set(); + for (const item of patch.edits) { + const edit = shape(item, ['layer', 'parameter', 'index', 'value'], ['layer', 'parameter', 'index', 'value'], 'edit'); + integer(edit.layer, 0, WSP_LIMITS.maxLayers - 1, 'edit layer'); + integer(edit.index, 0, WSP_LIMITS.maxParameters - 1, 'edit index'); + if (edit.parameter !== 'weights' && edit.parameter !== 'bias') throw new TypeError('invalid edit parameter'); + finite(edit.value, 'edit value', -WSP_LIMITS.maxAbsValue, WSP_LIMITS.maxAbsValue); + const key = `${edit.layer}:${edit.parameter}:${edit.index}`; + if (seen.has(key)) throw new TypeError('duplicate patch location'); + seen.add(key); + } + return patch; +} + +/** Called only after snapshotJobs; returns normalized job data and conservative work reservation. */ +export function prepareJobs(input) { + const identifiers = new Set(); let reservedWork = 0; + const jobs = input.map(value => { + if (!value || (value.kind !== 'search' && value.kind !== 'patch')) throw new TypeError('job kind must be search or patch'); + const source = value.kind === 'search' ? shape(value, + ['id', 'kind', 'model', 'dataset', 'policy', 'searchOptions'], ['id', 'kind', 'model', 'dataset', 'policy', 'searchOptions'], 'search job') : + shape(value, ['id', 'kind', 'patch'], ['id', 'kind', 'patch'], 'patch job'); + if (typeof source.id !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/.test(source.id) || identifiers.has(source.id)) + throw new TypeError('job IDs must be unique bounded identifiers'); + identifiers.add(source.id); + if (source.kind === 'patch') return { id: source.id, kind: source.kind, patch: patchInfo(source.patch) }; + const info = modelInfo(source.model), dataset = datasetInfo(source.dataset, info.model), policy = policyInfo(source.policy); + const settings = searchInfo(source.searchOptions, info.model); + const work = settings.plannedPasses * dataset.rows * info.parameters; + if (work > settings.maxWork) throw new RangeError('search job exceeds aggregate work budget'); + reservedWork += work; + if (reservedWork > SWARM_LIMITS.maxTotalWork) throw new RangeError('swarm exceeds aggregate work budget'); + return { id: source.id, kind: source.kind, model: info.model, dataset, policy, searchOptions: settings.options }; + }); + return { jobs, reservedWork }; +} diff --git a/packages/wsp-toolkit/packages/swarm/src/index.d.ts b/packages/wsp-toolkit/packages/swarm/src/index.d.ts new file mode 100644 index 000000000..6a955142c --- /dev/null +++ b/packages/wsp-toolkit/packages/swarm/src/index.d.ts @@ -0,0 +1,31 @@ +import type { DenseModel, EvaluationDataset, EvaluationPolicy, WeightPatch } from 'ruv-fann-wsp'; +import type { SearchOptions } from 'ruv-fann-wsp-search'; +export type WorkerSearchOptions = Omit; +export interface SearchProposalJob { id: string; kind: 'search'; model: DenseModel | string; dataset: EvaluationDataset; policy: EvaluationPolicy; searchOptions: WorkerSearchOptions } +export interface PatchProposalJob { id: string; kind: 'patch'; patch: WeightPatch } +export type ProposalJob = SearchProposalJob | PatchProposalJob; +export interface ProposalSwarmOptions { + /** 1..4 workers; default 2. */ + concurrency?: number; + /** Per-job lifetime including startup; 1..60000 ms, default 5000. */ + timeoutMs?: number; + /** May tighten the 100 million aggregate parameter-row reservation. */ + maxTotalWork?: number; + signal?: AbortSignal; +} +export interface ProposalSwarmResult { + id: string; + status: 'ok' | 'error' | 'timeout' | 'cancelled'; + patch?: WeightPatch | null; + workerThreadId?: number; + search?: { evaluations: number; inferencePasses: number; reservedWork: number; backend: 'wasm' | 'wasm-simd' }; + error?: string; + /** Monotonic parent-process performance.now() timestamps. Aborted queued jobs omit them. */ + startedAtMs?: number; + finishedAtMs?: number; +} +export const SWARM_LIMITS: Readonly<{ maxJobs: 64; maxConcurrency: 4; maxBytes: number; maxTimeoutMs: 60000; maxTotalWork: number }>; +/** Validates data and returns conservative search work; patch transport reserves zero inference work. */ +export function estimateSwarmWork(jobs: ProposalJob[]): number; +/** Resolves in input order only after every started worker has terminated. No checkpoint authority. */ +export function runProposalSwarm(jobs: ProposalJob[], options?: ProposalSwarmOptions): Promise; diff --git a/packages/wsp-toolkit/packages/swarm/src/index.js b/packages/wsp-toolkit/packages/swarm/src/index.js new file mode 100644 index 000000000..facf7e882 --- /dev/null +++ b/packages/wsp-toolkit/packages/swarm/src/index.js @@ -0,0 +1,97 @@ +import { Worker } from 'node:worker_threads'; +import { performance } from 'node:perf_hooks'; +import { SWARM_LIMITS, record, integer, snapshotJobs, prepareJobs, patchInfo } from './data.js'; +export { SWARM_LIMITS } from './data.js'; + +/** Pure preflight: snapshots/validates the same data as execution and reserves full search work. */ +export function estimateSwarmWork(jobs) { + return prepareJobs(snapshotJobs(jobs)).reservedWork; +} + +function configuration(value = {}) { + const options = record(value, ['concurrency', 'timeoutMs', 'signal', 'maxTotalWork'], [], 'swarm options'); + const concurrency = options.concurrency === undefined ? 2 : integer(options.concurrency, 1, SWARM_LIMITS.maxConcurrency, 'concurrency'); + const timeoutMs = options.timeoutMs === undefined ? 5000 : integer(options.timeoutMs, 1, SWARM_LIMITS.maxTimeoutMs, 'timeoutMs'); + const maxTotalWork = options.maxTotalWork === undefined ? SWARM_LIMITS.maxTotalWork : + integer(options.maxTotalWork, 0, SWARM_LIMITS.maxTotalWork, 'maxTotalWork'); + if (options.signal !== undefined && !(options.signal instanceof AbortSignal)) throw new TypeError('signal must be an AbortSignal'); + return { concurrency, timeoutMs, maxTotalWork, signal: options.signal }; +} +function errorText(value) { return typeof value?.message === 'string' ? value.message.slice(0, 512) : 'proposal worker failed'; } + +function execute(job, options) { + const startedAtMs = performance.now(); + let worker; + try { + worker = new Worker(new URL('./worker.js', import.meta.url), { workerData: job, execArgv: [], + resourceLimits: { maxOldGenerationSizeMb: 64, maxYoungGenerationSizeMb: 16, stackSizeMb: 4 } }); + } catch (error) { + return Promise.resolve({ id: job.id, status: 'error', error: errorText(error), startedAtMs, finishedAtMs: performance.now() }); + } + const workerThreadId = worker.threadId; + return new Promise((resolve, reject) => { + let settled = false; + let timer; + const finish = result => { + if (settled) return; + settled = true; + clearTimeout(timer); + options.signal?.removeEventListener('abort', onAbort); + // Keep listeners until termination resolves so an error during cleanup cannot become unhandled. + worker.terminate().then(() => { + worker.removeListener('message', onMessage); + worker.removeListener('error', onError); + worker.removeListener('exit', onExit); + resolve({ id: job.id, ...result, workerThreadId, startedAtMs, finishedAtMs: performance.now() }); + }, reject); + }; + const onAbort = () => finish({ status: 'cancelled', error: 'swarm aborted' }); + const onError = error => finish({ status: 'error', error: errorText(error) }); + const onExit = code => finish({ status: 'error', error: `proposal worker exited before a result (code ${code})` }); + const onMessage = message => { + try { + if (!message || message.workerThreadId !== workerThreadId || !['ok', 'error'].includes(message.status)) + throw new Error('invalid proposal worker result'); + if (message.status === 'error') { finish({ status: 'error', error: String(message.error || 'proposal execution failed').slice(0, 512) }); return; } + const patch = message.patch === null ? null : patchInfo(message.patch); + if (job.kind === 'search') { + const summary = message.search; + if (!summary || !['wasm', 'wasm-simd'].includes(summary.backend) || + !Number.isSafeInteger(summary.evaluations) || summary.evaluations < 0 || summary.evaluations > 256 || + !Number.isSafeInteger(summary.inferencePasses) || summary.inferencePasses < 1 || summary.inferencePasses > 259 || + !Number.isSafeInteger(summary.reservedWork) || summary.reservedWork < 1 || summary.reservedWork > 10_000_000) + throw new Error('invalid proposal search result'); + finish({ status: 'ok', patch, search: { evaluations: summary.evaluations, inferencePasses: summary.inferencePasses, + reservedWork: summary.reservedWork, backend: summary.backend } }); + } else finish({ status: 'ok', patch }); + } catch (error) { finish({ status: 'error', error: errorText(error) }); } + }; + worker.on('message', onMessage); + worker.on('error', onError); + worker.on('exit', onExit); + options.signal?.addEventListener('abort', onAbort, { once: true }); + timer = setTimeout(() => finish({ status: 'timeout', error: 'proposal worker deadline exceeded' }), options.timeoutMs); + // Also handle an abort that occurred during Worker construction. + if (options.signal?.aborted) onAbort(); + }); +} + +/** Fixed trusted operations only. Worker proposals are untrusted data and cannot promote checkpoints. */ +export async function runProposalSwarm(jobs, options) { + // All caller-owned job/configuration data are captured before the first await. + const prepared = prepareJobs(snapshotJobs(jobs)), config = configuration(options); + if (prepared.reservedWork > config.maxTotalWork) throw new RangeError('swarm exceeds configured aggregate work budget'); + const results = new Array(prepared.jobs.length); + let next = 0; + async function runner() { + while (next < prepared.jobs.length) { + const index = next++, job = prepared.jobs[index]; + if (config.signal?.aborted) { results[index] = { id: job.id, status: 'cancelled', error: 'swarm aborted before job start' }; continue; } + results[index] = await execute(job, config); + } + } + const settled = await Promise.allSettled(Array.from({ length: Math.min(config.concurrency, prepared.jobs.length) }, runner)); + const failed = settled.find(item => item.status === 'rejected'); + if (failed) throw failed.reason; // Other started workers have already finished cleanup. + return results; +} diff --git a/packages/wsp-toolkit/packages/swarm/src/worker.js b/packages/wsp-toolkit/packages/swarm/src/worker.js new file mode 100644 index 000000000..9eafa5921 --- /dev/null +++ b/packages/wsp-toolkit/packages/swarm/src/worker.js @@ -0,0 +1,19 @@ +import { parentPort, workerData, threadId } from 'node:worker_threads'; +import { searchWeightPatch } from 'ruv-fann-wsp-search'; + +try { + if (!parentPort) throw new Error('proposal worker requires a parent port'); + if (workerData.kind === 'patch') { + parentPort.postMessage({ status: 'ok', patch: workerData.patch, workerThreadId: threadId }); + } else if (workerData.kind === 'search') { + const result = await searchWeightPatch(workerData.model, workerData.dataset, workerData.policy, workerData.searchOptions); + parentPort.postMessage({ status: 'ok', patch: result.patch, workerThreadId: threadId, + search: { evaluations: result.evaluations, inferencePasses: result.inferencePasses, + reservedWork: result.reservedWork, backend: result.backend } }); + } else { + throw new Error('unsupported proposal worker operation'); + } +} catch (error) { + parentPort?.postMessage({ status: 'error', workerThreadId: threadId, + error: typeof error?.message === 'string' ? error.message.slice(0, 512) : 'proposal execution failed' }); +} finally { parentPort?.close(); } diff --git a/packages/wsp-toolkit/packages/swarm/test/swarm.test.mjs b/packages/wsp-toolkit/packages/swarm/test/swarm.test.mjs new file mode 100644 index 000000000..fef2c47e8 --- /dev/null +++ b/packages/wsp-toolkit/packages/swarm/test/swarm.test.mjs @@ -0,0 +1,154 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { execFileSync } from 'node:child_process'; +import { fingerprintModel, evaluateWeightPatch } from 'ruv-fann-wsp'; +import { runProposalSwarm, estimateSwarmWork, SWARM_LIMITS } from '../src/index.js'; +const makeModel = () => ({ schema: 'ruv-fann.dense-layers/1', layers: [ + { inputs: 2, outputs: 2, weights: [1,-1,-1,1], bias:[0,0], activation:'ReLU', steepness:1 }, + { inputs: 2, outputs: 1, weights: [0,0], bias:[0], activation:'Linear', steepness:1 } +] }); +const dataset = () => ({inputs:[0,0,0,1,1,0,1,1], targets:[0,1,1,0], rows:4}); +const policy = () => ({maxMSE:0,maxRegressionMSE:0,maxAbsoluteError:0}); +const job = (id='search',simd=false) => ({id,kind:'search',model:makeModel(),dataset:dataset(),policy:policy(), + searchOptions:{locations:[0,1].map(index=>({layer:1,parameter:'weights',index,values:[0,1]})),maxEvaluations:8,maxPasses:2,simd}}); +const patchJob = id => ({id,kind:'patch',patch:{schema:'ruv-fann.weight-patch/1',baseHash:'a'.repeat(64),edits:[{layer:0,parameter:'weights',index:0,value:2}]}}); +function concurrency(results) { + const events=results.flatMap(r=>r.startedAtMs===undefined?[]:[{time:r.startedAtMs,delta:1},{time:r.finishedAtMs,delta:-1}]); + events.sort((a,b)=>a.time-b.time||a.delta-b.delta); + let active=0,max=0; + for(const event of events){active+=event.delta;max=Math.max(max,active);} + assert.equal(active,0); + return max; +} + +test('real worker threads overlap within configured concurrency and repair XOR on scalar/SIMD WASM', {timeout:20000}, async()=>{ + const jobs=[job('scalar',false),job('simd',true),job('scalar-next',false),job('simd-next',true)]; + assert.equal(estimateSwarmWork(jobs),4*396); + const results=await runProposalSwarm(jobs,{concurrency:2,maxTotalWork:4*396}); + assert.deepEqual(results.map(r=>r.id),jobs.map(j=>j.id)); + assert.ok(results.every(r=>r.status==='ok'),JSON.stringify(results)); + assert.equal(new Set(results.map(r=>r.workerThreadId)).size,4); + assert.ok(results.every(r=>Number.isInteger(r.workerThreadId)&&r.workerThreadId>0)); + assert.equal(concurrency(results),2); + assert.deepEqual(results.map(r=>r.search.backend),['wasm','wasm-simd','wasm','wasm-simd']); + for(let i=0;i{ + const input=job('optimal');input.model.layers[1].weights=[1,1]; + const [result]=await runProposalSwarm([input]); + assert.equal(result.status,'ok');assert.equal(result.patch,null); + assert.equal(result.search.inferencePasses,result.search.evaluations+1); +}); + +test('all caller job and configuration data are snapshotted before yielding',async()=>{ + const input=[job('owned'),job('owned-next')], options={concurrency:1}; + const baseHash=await fingerprintModel(input[0].model); + const pending=runProposalSwarm(input,options); + input[0].id='mutated';input[0].model.layers[0].weights[0]=1000; + input[0].dataset.targets.fill(10);input[0].searchOptions.locations[0].values[1]=500; + options.concurrency=4; + const results=await pending; + assert.deepEqual(results.map(r=>r.id),['owned','owned-next']); + assert.ok(results.every(r=>r.status==='ok')); + assert.equal(results[0].patch.baseHash,baseHash); + assert.deepEqual(results[0].patch.edits.map(e=>e.value),[1,1]); + assert.equal(concurrency(results),1); +}); + +test('patch workers only transport snapshots and cannot authorize the supplied hash',async()=>{ + const input=patchJob('transport'), pending=runProposalSwarm([input],{maxTotalWork:0}); + input.patch.edits[0].value=20; + const [result]=await pending; + assert.equal(result.status,'ok');assert.equal(result.patch.edits[0].value,2); + assert.equal(estimateSwarmWork([patchJob('zero')]),0); + await assert.rejects(evaluateWeightPatch(makeModel(),result.patch,dataset(),policy()),/baseHash|layer|index/); +}); + +test('numerical worker failures remain bounded results and do not poison following jobs',async()=>{ + const overflow=job('overflow'); + overflow.model={schema:'ruv-fann.dense-layers/1',layers:[{inputs:1,outputs:1,weights:[1e308],bias:[0],activation:'Linear',steepness:1}]}; + overflow.dataset={inputs:[2],targets:[0],rows:1}; + overflow.searchOptions={locations:[{layer:0,parameter:'bias',index:0,values:[1]}],maxEvaluations:1,maxPasses:1}; + const results=await runProposalSwarm([overflow,patchJob('next')],{concurrency:1}); + assert.equal(results[0].status,'error');assert.ok(results[0].error.length<=512); + assert.ok(results[0].error.length>0); + assert.equal(results[1].status,'ok'); +}); + +test('per-worker timeout stays responsive and cleans up before resolving',async()=>{ + let tick=false;const timer=setTimeout(()=>{tick=true;},0); + const results=await runProposalSwarm([job('deadline'),job('deadline-next')],{concurrency:1,timeoutMs:1}); + clearTimeout(timer); + assert.equal(tick,true); + assert.ok(results.every(r=>r.status==='timeout'),JSON.stringify(results)); + assert.ok(results.every(r=>r.workerThreadId>0&&r.finishedAtMs>=r.startedAtMs)); + assert.equal(concurrency(results),1); + // A new worker still runs after terminated searches. + assert.equal((await runProposalSwarm([patchJob('after-timeout')]))[0].status,'ok'); +}); + +test('abort terminates active workers, never starts queued jobs and ignores late work',async()=>{ + const controller=new AbortController(); + const jobs=Array.from({length:6},(_,i)=>job(`abort-${i}`)); + const pending=runProposalSwarm(jobs,{concurrency:2,signal:controller.signal}); + controller.abort(); + const results=await pending; + assert.ok(results.every(r=>r.status==='cancelled'),JSON.stringify(results)); + assert.equal(results.filter(r=>r.workerThreadId!==undefined).length,2); + assert.ok(results.slice(2).every(r=>r.startedAtMs===undefined)); + const already=new AbortController();already.abort(); + const queued=await runProposalSwarm([patchJob('never-started')],{signal:already.signal}); + assert.equal(queued[0].status,'cancelled');assert.equal(queued[0].workerThreadId,undefined); +}); + +test('unknown operations/options, executable values, accessors and malformed data reject without executing getters',async()=>{ + let invoked=0; + for(const mutate of [ + x=>x.kind='shell', x=>x.command='touch should-not-exist', x=>x.searchOptions.objective=()=>{invoked++;return 0;}, + x=>x.searchOptions.objective=0, x=>x.searchOptions.locations[0].values=[1,Infinity], + x=>x.searchOptions.locations.push(x.searchOptions.locations[0]), + x=>x.model.layers[0].activation='Unknown',x=>x.model.layers[1].inputs=3, + x=>x.dataset.inputs=new Array(8),x=>x.dataset.rows=1025, + x=>Object.defineProperty(x,'model',{get(){invoked++;return makeModel();}}) + ]){ + const input=job();mutate(input);await assert.rejects(runProposalSwarm([input])); + } + const array=[job()];array[Symbol.iterator]=function*(){invoked++;yield job();}; + await assert.rejects(runProposalSwarm(array)); + for(const options of [{concurrency:5},{concurrency:0},{timeoutMs:0},{timeoutMs:60001},{maxTotalWork:100000001},{signal:{}},{code:'1+1'}]) + await assert.rejects(runProposalSwarm([job()],options)); + await assert.rejects(runProposalSwarm([job('duplicate'),job('duplicate')])); + await assert.rejects(runProposalSwarm([])); + await assert.rejects(runProposalSwarm(Array.from({length:65},(_,i)=>patchJob(`too-many-${i}`)))); + assert.equal(invoked,0); +}); + +test('aggregate byte and inference budgets reject before work can start',async()=>{ + await assert.rejects(runProposalSwarm([job()],{maxTotalWork:395}),/aggregate work/); + const huge=Array.from({length:11},(_,i)=>({...patchJob(`large-${i}`),padding:'x'.repeat(1024*1024)})); + await assert.rejects(runProposalSwarm(huge),/byte limit/); + const many=Array.from({length:64},(_,i)=>({ + id:`work-${i}`,kind:'search', + model:{schema:'ruv-fann.dense-layers/1',layers:[ + {inputs:1,outputs:256,weights:Array(256).fill(0),bias:Array(256).fill(0),activation:'Linear',steepness:1}, + {inputs:256,outputs:1,weights:Array(256).fill(0),bias:[0],activation:'Linear',steepness:1} + ]}, + dataset:{inputs:Array(512).fill(0),targets:Array(512).fill(0),rows:512},policy:policy(), + searchOptions:{locations:[{layer:0,parameter:'weights',index:0,values:[0,1]}],maxEvaluations:1,maxPasses:1} + })); + assert.throws(()=>estimateSwarmWork(many),/aggregate work/); + assert.equal(SWARM_LIMITS.maxConcurrency,4); +}); + +test('packed-consumer style node --input-type=module -e cannot leak flags into file workers', {timeout:15000},()=>{ + const source=`import {runProposalSwarm} from ${JSON.stringify(new URL('../src/index.js',import.meta.url).href)}; console.log(JSON.stringify(await runProposalSwarm(${JSON.stringify([job('subprocess')])})));`; + const results=JSON.parse(execFileSync(process.execPath,['--input-type=module','-e',source],{encoding:'utf8',timeout:10000})); + assert.equal(results[0].status,'ok',JSON.stringify(results)); + assert.equal(results[0].search.backend,'wasm'); +}); diff --git a/packages/wsp-toolkit/packages/telemetry/LICENSE b/packages/wsp-toolkit/packages/telemetry/LICENSE new file mode 100644 index 000000000..2dd524ac3 --- /dev/null +++ b/packages/wsp-toolkit/packages/telemetry/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 rUv + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/wsp-toolkit/packages/telemetry/README.md b/packages/wsp-toolkit/packages/telemetry/README.md new file mode 100644 index 000000000..3faded215 --- /dev/null +++ b/packages/wsp-toolkit/packages/telemetry/README.md @@ -0,0 +1,42 @@ +# ruvnet-constellation-telemetry + +Dependency-free public package observations, explicitly sampled project attach metrics, and a standalone interactive dashboard. ESM; Node 20.9+; no install hooks, SDKs, provider calls, hidden collection or uploads. + +```js +import { collectPublicMetrics, analyzeConstellation, renderConstellationDashboard } + from 'ruvnet-constellation-telemetry'; +const observations = await collectPublicMetrics(catalog, { + start: '2026-09-30', end: '2026-11-10', timeoutMs: 20000, concurrency: 4 +}); +const report = analyzeConstellation(catalog, observations); +const html = renderConstellationDashboard(report); +``` + +`collectPublicMetrics` reads only fixed HTTPS endpoints on `api.npmjs.org`, `registry.npmjs.org`, and `api.github.com`. Package and repository names are validated before URL construction. Redirects, credentials and cookies are excluded. Each response is limited to 2 MiB, concurrency to eight tasks, date windows to 366 completed UTC days, and the whole collection to at most 60 seconds. Its injected fetch capability must honor AbortSignal for transport cleanup. Failures are explicit observations; a failed metadata fetch does not discard independently fetched download data. Candidate packages are never queried. GitHub's `open_issues_count` is labeled **open issues + pull requests**. + +`analyzeConstellation` returns owned data, complete-window daily/7-day/30-day counts, coverage, the previous four matching weekdays, declared registry dependency links and bounded Pearson download correlations. Missing points and candidate observations remain unknown; incomplete cohort totals are null. Observed partial sums are separately labeled. Correlations examine at most 32 measured packages and retain ten pairs with at least seven shared days. Correlated download counts, dependency links and transitive installs do not establish distinct users, causality or attach rates. + +Attach is available only with an explicit local adoption input: + +```js +const report = analyzeConstellation(catalog, observations, { + adoption: { + schema: 'ruvnet.constellation-adoption/1', consent: true, + samples: [{sampleId: projectHash, observedAt: '2026-11-10T12:00:00Z', packages: ['metaharness', 'agentdb']}] + } +}); +``` + +The library does not generate identifiers, inspect project files or send these samples anywhere. It keeps the latest snapshot per caller-supplied SHA-256 project identifier within the report window. Conflicting snapshots at the same instant reject. The denominator is **observed consenting project snapshots containing any catalog nucleus**; per-primitive and any-primitive percentages use that same denominator. This is not a percentage of developers or npm users. Sample IDs and raw snapshots never enter the returned report. No supplied sample, or no qualifying denominator, means `attach.status: 'unavailable'` and null percentages. + +`renderConstellationDashboard` returns a portable HTML artifact with no external scripts, fonts, trackers or network fetches. Controls: `#period-filter` (1/7/30), `#family-filter`, `#role-filter`, `#package-search`, and `#trend-package`. Package rows in `#package-table` carry `data-package`; the chart is `#trend-chart`. `#attach-rate`, `#download-total`, and `#coverage-text` expose summary values. Dynamic text uses textContent, embedded JSON escapes HTML delimiters, and links allow only HTTPS npm/GitHub targets. The page supports local report export. + +Public metrics are point-in-time observations. Users must supply an accurate catalog and an appropriately consented, representative adoption sample; the library cannot prove consent or correct sample selection. No claim is made that scoped names establish security or that download volume measures unique adoption. + + + +Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). + +These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. + + diff --git a/packages/wsp-toolkit/packages/telemetry/constellation.json b/packages/wsp-toolkit/packages/telemetry/constellation.json new file mode 100644 index 000000000..87daf8ae4 --- /dev/null +++ b/packages/wsp-toolkit/packages/telemetry/constellation.json @@ -0,0 +1,10 @@ +{ + "schema": "ruvnet.constellation-module/1", + "name": "ruvnet-constellation-telemetry", + "version": "0.1.0", + "role": "satellite", + "contracts": [ + "ruvnet.constellation-module/1" + ], + "integrations": [] +} diff --git a/packages/wsp-toolkit/packages/telemetry/package.json b/packages/wsp-toolkit/packages/telemetry/package.json new file mode 100644 index 000000000..b94ef6751 --- /dev/null +++ b/packages/wsp-toolkit/packages/telemetry/package.json @@ -0,0 +1,33 @@ +{ + "name": "ruvnet-constellation-telemetry", + "version": "0.1.0", + "type": "module", + "description": "Public package observations and explicitly sampled project attach metrics with a standalone constellation dashboard", + "engines": { + "node": ">=20.9.0" + }, + "exports": { + ".": { + "types": "./src/index.d.ts", + "import": "./src/index.js" + } + }, + "files": [ + "src", + "README.md", + "LICENSE", + "constellation.json" + ], + "scripts": { + "test": "node --test test/*.test.mjs" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/ruvnet/ruv-FANN.git", + "directory": "packages/wsp-toolkit/packages/telemetry" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/wsp-toolkit/packages/telemetry/src/analyze.js b/packages/wsp-toolkit/packages/telemetry/src/analyze.js new file mode 100644 index 000000000..8285239a5 --- /dev/null +++ b/packages/wsp-toolkit/packages/telemetry/src/analyze.js @@ -0,0 +1,159 @@ +import { LIMITS, record, integer, text, array, snapshot, catalogSnapshot, isoDay, isoStamp, addDays, range, names, safeSum } from './data.js'; + +function observationsSnapshot(value, catalog) { + const raw = record(snapshot(value), ['schema', 'observedAt', 'start', 'end', 'packages', 'repositories'], + ['schema', 'observedAt', 'start', 'end', 'packages', 'repositories'], 'observations'); + if (raw.schema !== 'ruvnet.constellation-observations/1') throw new TypeError('unsupported observations schema'); + isoStamp(raw.observedAt); range(raw.start, raw.end); + if (raw.end >= raw.observedAt.slice(0, 10)) throw new RangeError('observations must end before their UTC collection date'); + const catalogByName = new Map(catalog.packages.map(p => [p.name, p])), seen = new Set(); + const packages = array(raw.packages, LIMITS.maxPackages, 'observed packages').map(value => { + const p = record(value, ['name', 'status', 'days', 'version', 'dependencies', 'peerDependencies', 'optionalDependencies', 'metadataStatus', 'metadataError', 'error', 'repository', 'sources'], + ['name', 'status', 'days'], 'package observation'); + const declared = catalogByName.get(p.name); + if (!declared || seen.has(p.name)) throw new TypeError('duplicate or unknown observed package'); seen.add(p.name); + if (!['ok', 'unavailable', 'candidate'].includes(p.status) || (declared.status === 'candidate') !== (p.status === 'candidate')) throw new TypeError('observation status contradicts catalog'); + const daySeen = new Set(); + const days = array(p.days, LIMITS.maxDays, 'observed days').map(value => { + const day = record(value, ['day', 'downloads'], ['day', 'downloads'], 'day observation'); isoDay(day.day); + if (day.day < raw.start || day.day > raw.end || daySeen.has(day.day)) throw new TypeError('duplicate or out-of-range observed day'); + daySeen.add(day.day); return { day: day.day, downloads: integer(day.downloads, 0, Number.MAX_SAFE_INTEGER, 'daily downloads') }; + }).sort((a, b) => a.day.localeCompare(b.day)); + if (p.status !== 'ok' && days.length) throw new TypeError('unavailable or candidate observations cannot carry measured downloads'); + if (p.version !== undefined) text(p.version, 128, 'observed version'); + if (p.metadataStatus !== undefined && !['ok', 'unavailable'].includes(p.metadataStatus)) throw new TypeError('invalid metadata status'); + return { ...p, days, + dependencies: p.dependencies === undefined ? [] : names(p.dependencies), + peerDependencies: p.peerDependencies === undefined ? [] : names(p.peerDependencies), + optionalDependencies: p.optionalDependencies === undefined ? [] : names(p.optionalDependencies) }; + }); + const repositories = [], repoSeen = new Set(), allowedRepos = new Set(catalog.packages.map(p => p.repository)); + for (const value of array(raw.repositories, LIMITS.maxPackages, 'repositories')) { + const item = record(value, ['repository', 'status', 'stars', 'openIssuesAndPRs', 'error', 'source'], ['repository', 'status'], 'repository observation'); + if (!allowedRepos.has(item.repository) || repoSeen.has(item.repository) || !['ok', 'unavailable'].includes(item.status)) throw new TypeError('invalid repository observation'); + repoSeen.add(item.repository); + if (item.status === 'ok') { + integer(item.stars, 0, Number.MAX_SAFE_INTEGER, 'stars'); integer(item.openIssuesAndPRs, 0, Number.MAX_SAFE_INTEGER, 'issues and PRs'); + } else if (item.stars !== undefined || item.openIssuesAndPRs !== undefined) throw new TypeError('unavailable repository cannot carry counts'); + repositories.push({ repository: item.repository, status: item.status, + stars: item.status === 'ok' ? item.stars : null, openIssuesAndPRs: item.status === 'ok' ? item.openIssuesAndPRs : null, + source: `https://api.github.com/repos/${item.repository}`, ...(item.error ? { error: text(item.error, 1000, 'repository error') } : {}) }); + } + return { ...raw, packages, repositories }; +} +function completeWindow(days, end, length) { + const values = []; + for (let offset = 0; offset < length; offset++) { + const value = days.get(addDays(end, -offset)); if (value === undefined) return null; values.push(value); + } + return safeSum(values); +} +function attachMetrics(value, catalog, start, end) { + const primitives = catalog.packages.filter(p => p.role === 'primitive').map(p => p.name); + const unavailable = { status: 'unavailable', unit: 'consenting-project-snapshots', denominator: 0, numerator: 0, percentage: null, + projects: 0, perPrimitive: primitives.map(name => ({ name, numerator: 0, denominator: 0, percentage: null })), + source: { provided: false, samplesReceived: 0, snapshotsInWindow: 0, duplicateSnapshotsRemoved: 0 }, + note: 'Attach requires explicit consenting project snapshots. npm download counts do not identify users or joint installations.' }; + if (value === undefined) return unavailable; + const raw = record(value, ['schema', 'consent', 'samples'], ['schema', 'consent', 'samples'], 'adoption'); + if (raw.schema !== 'ruvnet.constellation-adoption/1' || raw.consent !== true) throw new TypeError('adoption requires the supported schema and explicit consent:true'); + const samples = array(raw.samples, LIMITS.maxSamples, 'adoption samples'), latest = new Map(), seenSnapshots = new Map(); let inWindow = 0; + for (const value of samples) { + const sample = record(value, ['sampleId', 'observedAt', 'packages'], ['sampleId', 'observedAt', 'packages'], 'adoption sample'); + if (typeof sample.sampleId !== 'string' || !/^[a-f0-9]{64}$/.test(sample.sampleId)) throw new TypeError('sampleId must be an anonymized lowercase SHA-256 identifier'); + isoStamp(sample.observedAt); const packages = names(sample.packages, LIMITS.maxSamplePackages); + const stamp = Date.parse(sample.observedAt), key = `${sample.sampleId}:${stamp}`, content = JSON.stringify(packages); + if (seenSnapshots.has(key) && seenSnapshots.get(key) !== content) throw new TypeError('conflicting duplicate project snapshot'); + // Check every declared instant, including older snapshots, before selecting a latest in-window observation. + seenSnapshots.set(key, content); + const day = sample.observedAt.slice(0, 10); if (day < start || day > end) continue; + inWindow++; const previous = latest.get(sample.sampleId); + if (!previous || stamp > previous.stamp) latest.set(sample.sampleId, { stamp, packages }); + } + const nuclei = new Set(catalog.packages.filter(p => p.role === 'nucleus').map(p => p.name)); + const projects = [...latest.values()], eligible = projects.filter(p => p.packages.some(name => nuclei.has(name))); + const denominator = eligible.length, numerator = eligible.filter(p => p.packages.some(name => primitives.includes(name))).length; + return { status: denominator ? 'available' : 'unavailable', unit: 'consenting-project-snapshots', denominator, numerator, + percentage: denominator ? 100 * numerator / denominator : null, projects: projects.length, + perPrimitive: primitives.map(name => { const numerator = eligible.filter(p => p.packages.includes(name)).length; + return { name, numerator, denominator, percentage: denominator ? 100 * numerator / denominator : null }; }), + source: { provided: true, samplesReceived: samples.length, snapshotsInWindow: inWindow, duplicateSnapshotsRemoved: inWindow - projects.length }, + note: 'Latest consenting snapshot per project in this window. Denominator: sampled projects containing any catalog nucleus. This is not a percentage of developers or npm users.' }; +} +function correlation(left, right) { + const r = new Map(right.days.map(d => [d.day, d.downloads])); + const pairs = left.days.filter(d => r.has(d.day)).map(d => [d.downloads, r.get(d.day)]); + if (pairs.length < 7) return null; + const mx = pairs.reduce((sum, p) => sum + p[0], 0) / pairs.length, my = pairs.reduce((sum, p) => sum + p[1], 0) / pairs.length; + let cross = 0, xx = 0, yy = 0; + for (const [x, y] of pairs) { cross += (x - mx) * (y - my); xx += (x - mx) ** 2; yy += (y - my) ** 2; } + if (xx === 0 || yy === 0) return null; + return { left: left.name, right: right.name, r: Math.max(-1, Math.min(1, cross / Math.sqrt(xx * yy))), samples: pairs.length }; +} + +/** Download correlation is observational; attach is computed only from an explicit local adoption sample. */ +export function analyzeConstellation(inputCatalog, inputObservations, configuration = {}) { + const catalog = catalogSnapshot(inputCatalog), observations = observationsSnapshot(inputObservations, catalog); + const options = record(configuration, ['adoption'], [], 'analysis options'); + const adoption = options.adoption === undefined ? undefined : snapshot(options.adoption); + const observed = new Map(observations.packages.map(p => [p.name, p])), known = new Set(catalog.packages.map(p => p.name)); + const packages = catalog.packages.map(p => { + const data = observed.get(p.name) ?? { name: p.name, status: p.status === 'candidate' ? 'candidate' : 'unavailable', days: [], dependencies: [], peerDependencies: [], optionalDependencies: [] }; + const days = new Map(data.days.map(d => [d.day, d.downloads])); + const baselineValues = [7, 14, 21, 28].map(offset => days.get(addDays(observations.end, -offset))); + const weekdayBaseline = baselineValues.every(v => v !== undefined) ? safeSum(baselineValues) / 4 : null; + const latestDayDownloads = days.get(observations.end) ?? null; + const weekdayDeltaPercent = latestDayDownloads !== null && weekdayBaseline !== null && weekdayBaseline > 0 ? 100 * (latestDayDownloads - weekdayBaseline) / weekdayBaseline : null; + const edges = []; + for (const [key, kind] of [['dependencies', 'runtime'], ['peerDependencies', 'peer'], ['optionalDependencies', 'optional']]) + for (const target of data.metadataStatus === 'ok' ? data[key] ?? [] : []) if (known.has(target)) edges.push({ source: p.name, target, kind }); + return { name: p.name, role: p.role, family: p.family, catalogStatus: p.status, status: data.status, + catalogVersion: p.version, version: data.version ?? null, description: p.description, repository: p.repository, + npmURL: p.status === 'published' ? `https://www.npmjs.com/package/${p.name}` : null, + sourceURL: `https://github.com/${p.repository}${p.directory ? `/tree/main/${p.directory}` : ''}`, + latestDayDownloads, last7Downloads: completeWindow(days, observations.end, 7), last30Downloads: completeWindow(days, observations.end, 30), + weekdayBaseline, weekdayDeltaPercent, weekdayBaselineDays: baselineValues.filter(v => v !== undefined).length, + days: data.days, coverage: { observedDays: days.size, expectedDays: range(observations.start, observations.end).length }, + metadataStatus: data.metadataStatus ?? 'unavailable', dependencies: data.dependencies ?? [], peerDependencies: data.peerDependencies ?? [], optionalDependencies: data.optionalDependencies ?? [], + runtimeDependencyCount: data.metadataStatus === 'ok' ? (data.dependencies ?? []).length : null, + peerDependencyCount: data.metadataStatus === 'ok' ? (data.peerDependencies ?? []).length : null, + optionalDependencyCount: data.metadataStatus === 'ok' ? (data.optionalDependencies ?? []).length : null, + declaredLinks: edges, ...(data.error ? { error: text(data.error, 1000, 'package error') } : {}) }; + }); + const published = packages.filter(p => p.catalogStatus === 'published'), candidates = packages.length - published.length; + const total = key => published.length && published.every(p => p[key] !== null) ? safeSum(published.map(p => p[key])) : null; + const coverage = { catalogPackages: packages.length, publishedPackages: published.length, candidatePackages: candidates, + packagesWithLatestDay: published.filter(p => p.latestDayDownloads !== null).length, + packagesWithLast7: published.filter(p => p.last7Downloads !== null).length, packagesWithLast30: published.filter(p => p.last30Downloads !== null).length, + unavailablePackages: published.filter(p => p.status !== 'ok').length }; + const dayMaps = published.map(p => new Map(p.days.map(d => [d.day, d.downloads]))); + const dailySeries = range(observations.start, observations.end).map(day => { + const values = dayMaps.map(days => days.get(day)).filter(v => v !== undefined); + return { day, downloads: published.length && values.length === published.length ? safeSum(values) : null, + observedDownloads: safeSum(values), observedPackages: values.length, expectedPackages: published.length }; + }); + const eligible = published.filter(p => p.latestDayDownloads !== null && p.weekdayBaseline !== null), families = [...new Set(eligible.map(p => p.family))].sort(); + const netChange = eligible.reduce((sum, p) => sum + p.latestDayDownloads - p.weekdayBaseline, 0); + const weekdaySummary = { eligiblePackages: eligible.length, aboveBaseline: eligible.filter(p => p.latestDayDownloads > p.weekdayBaseline).length, netChange, + families: families.map(family => { const change = eligible.filter(p => p.family === family).reduce((sum, p) => sum + p.latestDayDownloads - p.weekdayBaseline, 0); + return { family, netChange: change, shareOfNetChangePercent: netChange > 0 ? 100 * change / netChange : null }; }), + note: 'Previous four matching weekdays, compared with the final complete UTC day. Synchronized downloads do not prove co-installation or causal cross-pollination.' }; + const considered = published.filter(p => p.status === 'ok').sort((a, b) => (b.last30Downloads ?? -1) - (a.last30Downloads ?? -1) || a.name.localeCompare(b.name)).slice(0, 32); + const pairs = []; + for (let i = 0; i < considered.length; i++) for (let j = i + 1; j < considered.length; j++) { const value = correlation(considered[i], considered[j]); if (value) pairs.push(value); } + pairs.sort((a, b) => Math.abs(b.r) - Math.abs(a.r) || a.left.localeCompare(b.left) || a.right.localeCompare(b.right)); + return { schema: 'ruvnet.constellation-report/1', observedAt: observations.observedAt, start: observations.start, end: observations.end, + packages, totals: { latestDayDownloads: total('latestDayDownloads'), last7Downloads: total('last7Downloads'), last30Downloads: total('last30Downloads'), + observedLast7Downloads: safeSum(published.filter(p => p.last7Downloads !== null).map(p => p.last7Downloads)), + observedLast30Downloads: safeSum(published.filter(p => p.last30Downloads !== null).map(p => p.last30Downloads)), coverage }, + dailySeries, repositories: observations.repositories, weekdaySummary, + correlations: { kind: 'daily-download-correlation', consideredPackages: considered.length, eligiblePairs: pairs.length, pairs: pairs.slice(0, 10), + note: 'Pearson correlation on shared observed days, at least seven points; limited to the 32 highest-volume measured packages. Correlation is not attach rate.' }, + declaredLinks: packages.flatMap(p => p.declaredLinks), + declaredLinksCoverage: { observedManifests: published.filter(p => p.metadataStatus === 'ok').length, expectedManifests: published.length }, attach: attachMetrics(adoption, catalog, observations.start, observations.end), + definitions: { downloads: 'npm registry download events, including CI and transitive installs; not distinct developers.', + totals: 'Only complete published-package windows are totaled. Candidate and unavailable observations stay unknown; overlapping cohorts are not unique users.', + weekday: 'Mean of the previous four matching weekdays; percentage unknown when coverage is incomplete or baseline is zero.', + repositories: 'GitHub open_issues_count includes open pull requests as well as issues.', + adoption: 'Explicit local consenting project snapshots only; no automatic collection or upload.' } }; +} diff --git a/packages/wsp-toolkit/packages/telemetry/src/collect.js b/packages/wsp-toolkit/packages/telemetry/src/collect.js new file mode 100644 index 000000000..54f70c792 --- /dev/null +++ b/packages/wsp-toolkit/packages/telemetry/src/collect.js @@ -0,0 +1,121 @@ +import { LIMITS, record, integer, catalogSnapshot, range, isoDay, npmName } from './data.js'; +class SourceError extends Error {} +function abortable(promise, signal) { + if (signal.aborted) return Promise.reject(signal.reason); + return new Promise((resolve, reject) => { + const abort = () => { cleanup(); reject(signal.reason); }; + const cleanup = () => signal.removeEventListener('abort', abort); + signal.addEventListener('abort', abort, { once: true }); + Promise.resolve(promise).then(value => { cleanup(); resolve(value); }, error => { cleanup(); reject(error); }); + }); +} +async function jsonFrom(response, signal) { + if (!response || response.status !== 200 || response.redirected || response.type === 'opaqueredirect') { + response?.body?.cancel().catch(() => {}); + throw new SourceError(`public source returned HTTP ${Number.isInteger(response?.status) ? response.status : 'unknown'} or a redirect`); + } + const declared = response.headers?.get('content-length'); + if (declared !== null && declared !== undefined && (!/^\d+$/.test(declared) || Number(declared) > LIMITS.maxBytes)) { + response.body?.cancel().catch(() => {}); throw new SourceError('public source exceeds declared byte limit'); + } + if (!response.body?.getReader) throw new SourceError('public source has no readable body'); + const reader = response.body.getReader(); let bytes = new Uint8Array(8192), size = 0; + try { + for (;;) { + const { value, done } = await abortable(reader.read(), signal); + if (done) break; + if (!(value instanceof Uint8Array) || value.byteLength > LIMITS.maxBytes - size) throw new SourceError('public source exceeds streamed byte limit'); + if (size + value.byteLength > bytes.length) { + const grown = new Uint8Array(Math.min(LIMITS.maxBytes, Math.max(size + value.byteLength, bytes.length * 2))); + grown.set(bytes); bytes = grown; + } + bytes.set(value, size); size += value.byteLength; + } + try { return JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes.subarray(0, size))); } + catch { throw new SourceError('public source is not valid UTF-8 JSON'); } + } catch (error) { reader.cancel().catch(() => {}); throw error; } + finally { try { reader.releaseLock(); } catch { /* Abort can leave an uncooperative trusted stream pending. */ } } +} +function dependencies(value) { + if (value === undefined) return []; + if (!value || typeof value !== 'object' || Array.isArray(value)) throw new SourceError('invalid package dependency metadata'); + const keys = Object.keys(value); if (keys.length > 4096) throw new SourceError('package dependency metadata exceeds limit'); + return keys.map(npmName).sort(); +} +function daysFrom(value, name, start, end) { + if (value?.package !== name || value.start !== start || value.end !== end || !Array.isArray(value.downloads) || value.downloads.length > LIMITS.maxDays) + throw new SourceError('public download identity or date range mismatch'); + const seen = new Set(); + return value.downloads.map(entry => { + const day = isoDay(entry?.day); + if (day < start || day > end || seen.has(day)) throw new SourceError('public source contains duplicate or out-of-range dates'); + seen.add(day); + return { day, downloads: integer(entry.downloads, 0, Number.MAX_SAFE_INTEGER, 'daily downloads') }; + }).sort((a, b) => a.day.localeCompare(b.day)); +} +function errorText(error, signal) { return signal.aborted ? 'collection deadline exceeded' : error instanceof SourceError ? error.message.slice(0, 200) : 'public source request or validation failed'; } + +/** Public read-only collection. No credentials, local scanning or background collection. */ +export async function collectPublicMetrics(input, configuration) { + const catalog = catalogSnapshot(input); + const options = record(configuration, ['start', 'end', 'fetch', 'timeoutMs', 'concurrency'], ['start', 'end'], 'collection options'); + const start = options.start, end = options.end; range(start, end); + if (end >= new Date().toISOString().slice(0, 10)) throw new RangeError('collect only completed UTC days'); + const fetcher = options.fetch === undefined ? globalThis.fetch : options.fetch; + if (typeof fetcher !== 'function') throw new TypeError('fetch must be a trusted function'); + const timeoutMs = options.timeoutMs === undefined ? 20000 : integer(options.timeoutMs, 1, LIMITS.maxTimeoutMs, 'collection timeout'); + const concurrency = options.concurrency === undefined ? 4 : integer(options.concurrency, 1, LIMITS.maxConcurrency, 'collection concurrency'); + const controller = new AbortController(), observedAt = new Date().toISOString(); + const timer = setTimeout(() => controller.abort(new Error('collection deadline exceeded')), timeoutMs); + const request = async url => { + controller.signal.throwIfAborted(); + const parsed = new URL(url); + if (parsed.protocol !== 'https:' || !['registry.npmjs.org', 'api.npmjs.org', 'api.github.com'].includes(parsed.hostname) || parsed.username || parsed.password) + throw new SourceError('unsupported public source URL'); + const response = await abortable(fetcher(url, { redirect: 'error', credentials: 'omit', referrerPolicy: 'no-referrer', signal: controller.signal, + headers: { Accept: 'application/json' } }), controller.signal); + if (response.url && new URL(response.url).origin !== parsed.origin) throw new SourceError('public source changed origin'); + return jsonFrom(response, controller.signal); + }; + const packages = catalog.packages.map(p => ({ name: p.name, status: p.status === 'candidate' ? 'candidate' : 'unavailable', days: [], repository: p.repository })); + const repositoryNames = [...new Set(catalog.packages.filter(p => p.status === 'published').map(p => p.repository))].sort(); + const repositories = repositoryNames.map(repository => ({ repository, status: 'unavailable' })); + const tasks = []; + for (let index = 0; index < catalog.packages.length; index++) { + const p = catalog.packages[index]; if (p.status === 'candidate') continue; + tasks.push(async () => { + const result = packages[index]; + const downloadsURL = `https://api.npmjs.org/downloads/range/${start}:${end}/${encodeURIComponent(p.name)}`; + const metadataURL = `https://registry.npmjs.org/${encodeURIComponent(p.name)}/latest`; + result.sources = { downloads: downloadsURL, metadata: metadataURL }; + try { result.days = daysFrom(await request(downloadsURL), p.name, start, end); result.status = 'ok'; } + catch (error) { result.error = errorText(error, controller.signal); } + try { + const data = await request(metadataURL); + if (data?.name !== p.name || typeof data.version !== 'string' || data.version.length < 1 || data.version.length > 128) + throw new SourceError('public package metadata identity mismatch'); + result.version = data.version; result.dependencies = dependencies(data.dependencies); + result.peerDependencies = dependencies(data.peerDependencies); result.optionalDependencies = dependencies(data.optionalDependencies); + result.metadataStatus = 'ok'; + } catch (error) { result.metadataStatus = 'unavailable'; result.metadataError = errorText(error, controller.signal); } + }); + } + for (let index = 0; index < repositoryNames.length; index++) tasks.push(async () => { + const repository = repositoryNames[index], result = repositories[index]; + result.source = `https://api.github.com/repos/${repository}`; + try { + const data = await request(result.source); + if (typeof data?.full_name !== 'string' || data.full_name.toLowerCase() !== repository.toLowerCase()) throw new SourceError('public repository identity mismatch'); + result.stars = integer(data.stargazers_count, 0, Number.MAX_SAFE_INTEGER, 'repository stars'); + result.openIssuesAndPRs = integer(data.open_issues_count, 0, Number.MAX_SAFE_INTEGER, 'open issues and PRs'); + result.status = 'ok'; + } catch (error) { result.error = errorText(error, controller.signal); } + }); + let next = 0; + try { + await Promise.all(Array.from({ length: Math.min(concurrency, tasks.length) }, async () => { + while (next < tasks.length) await tasks[next++](); + })); + return { schema: 'ruvnet.constellation-observations/1', observedAt, start, end, packages, repositories }; + } finally { clearTimeout(timer); } +} diff --git a/packages/wsp-toolkit/packages/telemetry/src/dashboard.js b/packages/wsp-toolkit/packages/telemetry/src/dashboard.js new file mode 100644 index 000000000..b95279a6f --- /dev/null +++ b/packages/wsp-toolkit/packages/telemetry/src/dashboard.js @@ -0,0 +1,56 @@ +import { snapshot, array } from './data.js'; + +/** A portable report artifact. All interaction is local; no external assets or data collection. */ +export function renderConstellationDashboard(input) { + const report = snapshot(input); + if (report?.schema !== 'ruvnet.constellation-report/1' || !report.totals?.coverage || !report.attach || !report.definitions || !report.weekdaySummary || !report.correlations) + throw new TypeError('a constellation report is required'); + array(report.packages, 1000, 'report packages'); array(report.dailySeries, 366, 'daily series'); array(report.repositories, 1000, 'repositories'); + const json = JSON.stringify(report).replaceAll('<', '\\u003c').replaceAll('>', '\\u003e').replaceAll('&', '\\u0026').replaceAll('\u2028', '\\u2028').replaceAll('\u2029', '\\u2029'); + return ` +Growth Constellation — package observatory +
+
Growth constellation / Observatory

One ecosystem. Clear evidence.

Public package signals, declared dependency links, and explicitly sampled project adoption. Download volume stays separate from people and joint usage.

LOCAL REPORT · NO TRACKERS
+
Catalog coverage
—
30-day downloads
Unknown
Above weekday baseline
—
Final day versus four preceding matching weekdays. An observational signal.
Observed project attach
Not measured
+

Download trajectory

+

Package constellation

Package / public versionRoleDownloadsWeekday ΔCoverageStatus
+
+
+ +'; +} diff --git a/packages/wsp-toolkit/packages/telemetry/src/data.js b/packages/wsp-toolkit/packages/telemetry/src/data.js new file mode 100644 index 000000000..3d5d54bc2 --- /dev/null +++ b/packages/wsp-toolkit/packages/telemetry/src/data.js @@ -0,0 +1,127 @@ +export const LIMITS = Object.freeze({ maxPackages: 1000, maxDays: 366, maxBytes: 2 * 1024 * 1024, + maxInputBytes: 24 * 1024 * 1024, maxConcurrency: 8, maxTimeoutMs: 60000, maxSamples: 10000, maxSamplePackages: 4096 }); +const npmPattern = /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/; +export function npmName(value) { + if (typeof value !== 'string' || value.length > 214 || !npmPattern.test(value)) throw new TypeError('invalid npm package name'); + return value; +} +export function repoName(value) { + if (typeof value !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9_.-]{0,99}\/[A-Za-z0-9][A-Za-z0-9_.-]{0,99}$/.test(value)) + throw new TypeError('invalid GitHub repository name'); + return value; +} +export function record(value, allowed, required, name) { + if (!value || typeof value !== 'object' || Array.isArray(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) + throw new TypeError(`${name} must be a plain record`); + const out = Object.create(null); + for (const key of Reflect.ownKeys(value)) { + const descriptor = Object.getOwnPropertyDescriptor(value, key); + if (typeof key !== 'string' || !allowed.includes(key) || !descriptor || !Object.hasOwn(descriptor, 'value')) + throw new TypeError(`unknown field or accessor in ${name}`); + out[key] = descriptor.value; + } + if (required.some(key => !Object.hasOwn(out, key))) throw new TypeError(`missing ${name} field`); + return out; +} +export function integer(value, min, max, name) { + if (!Number.isSafeInteger(value) || value < min || value > max) throw new RangeError(`${name} must be an integer in ${min}..${max}`); + return value; +} +export function text(value, max, name) { + if (typeof value !== 'string' || value.length < 1 || value.length > max) throw new TypeError(`invalid ${name}`); + return value; +} +export function array(value, maximum, name) { + if (!Array.isArray(value) || value.length > maximum) throw new RangeError(`invalid ${name} array`); + return value; +} +export function snapshot(value) { + const ancestors = new Set(); let nodes = 0, chars = 0; + function copy(item, depth) { + if (++nodes > 2_000_000 || depth > 20) throw new RangeError('telemetry input exceeds structural limit'); + if (item === null || typeof item === 'boolean') return item; + if (typeof item === 'number') { + if (!Number.isFinite(item)) throw new TypeError('telemetry numbers must be finite'); + return item; + } + if (typeof item === 'string') { + chars += item.length; + if (chars > LIMITS.maxInputBytes) throw new RangeError('telemetry input exceeds text limit'); + return item; + } + if (!item || typeof item !== 'object' || ancestors.has(item)) throw new TypeError('telemetry input must be acyclic JSON data'); + const isArray = Array.isArray(item); + if (!(isArray ? Object.getPrototypeOf(item) === Array.prototype : [Object.prototype, null].includes(Object.getPrototypeOf(item)))) + throw new TypeError('telemetry input must contain plain data'); + if (isArray && item.length > 1_000_000) throw new RangeError('telemetry array exceeds limit'); + ancestors.add(item); const out = isArray ? [] : Object.create(null); let count = 0; + for (const key of Reflect.ownKeys(item)) { + if (isArray && key === 'length') continue; + if (typeof key !== 'string' || ['__proto__', 'constructor', 'prototype'].includes(key) || + (isArray && (!/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= item.length))) throw new TypeError('unsafe telemetry property'); + chars += key.length; + if (chars > LIMITS.maxInputBytes) throw new RangeError('telemetry input exceeds text limit'); + const descriptor = Object.getOwnPropertyDescriptor(item, key); + if (!descriptor || !Object.hasOwn(descriptor, 'value')) throw new TypeError('telemetry input accessors are forbidden'); + out[key] = copy(descriptor.value, depth + 1); count++; + } + if (isArray && (out.length !== item.length || count !== item.length)) throw new TypeError('telemetry arrays must be dense'); + ancestors.delete(item); return out; + } + const out = copy(value, 0); + if (new TextEncoder().encode(JSON.stringify(out)).length > LIMITS.maxInputBytes) throw new RangeError('telemetry input exceeds byte limit'); + return out; +} +export function isoDay(value) { + if (typeof value !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(value)) throw new TypeError('dates must use YYYY-MM-DD'); + const stamp = Date.parse(`${value}T00:00:00.000Z`); + if (!Number.isFinite(stamp) || new Date(stamp).toISOString().slice(0, 10) !== value) throw new TypeError('invalid calendar date'); + return value; +} +export function isoStamp(value) { + const parts = typeof value === 'string' && value.match(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(?:\.(\d{1,3}))?Z$/); + if (!parts || !Number.isFinite(Date.parse(value)) || + new Date(Date.parse(value)).toISOString() !== `${parts[1]}.${(parts[2] || '').padEnd(3, '0')}Z`) + throw new TypeError('observedAt must be a valid UTC ISO timestamp'); + return value; +} +export function addDays(day, amount) { return new Date(Date.parse(`${day}T00:00:00Z`) + amount * 86400000).toISOString().slice(0, 10); } +export function range(start, end) { + isoDay(start); isoDay(end); + const count = (Date.parse(`${end}T00:00:00Z`) - Date.parse(`${start}T00:00:00Z`)) / 86400000 + 1; + integer(count, 1, LIMITS.maxDays, 'date range length'); + return Array.from({ length: count }, (_, i) => addDays(start, i)); +} +export function catalogSnapshot(input) { + const catalog = snapshot(input); + const raw = record(catalog, ['schema', 'repository', 'packages', 'profiles'], ['schema', 'repository', 'packages', 'profiles'], 'catalog'); + if (raw.schema !== 'ruvnet.constellation-catalog/1') throw new TypeError('unsupported catalog schema'); + repoName(raw.repository); const seen = new Set(); + const packages = array(raw.packages, LIMITS.maxPackages, 'catalog packages').map(value => { + const p = record(value, ['name', 'role', 'family', 'status', 'version', 'repository', 'directory', 'description', 'contracts', 'links', 'proposedScope'], + ['name', 'role', 'family', 'status', 'version', 'repository', 'description'], 'package'); + npmName(p.name); if (seen.has(p.name)) throw new TypeError('duplicate catalog package'); seen.add(p.name); + if (!['nucleus', 'primitive', 'satellite'].includes(p.role) || !['published', 'candidate'].includes(p.status)) throw new TypeError('invalid catalog role or status'); + text(p.family, 64, 'package family'); text(p.version, 128, 'package version'); text(p.description, 2000, 'package description'); repoName(p.repository); + if (p.directory !== undefined && (typeof p.directory !== 'string' || p.directory.length > 512 || p.directory.split('/').some(v => !/^[A-Za-z0-9_.@-]+$/.test(v) || ['.', '..'].includes(v)))) + throw new TypeError('unsafe package directory'); + return p; + }); + if (!packages.length) throw new RangeError('catalog requires packages'); + for (const p of array(raw.profiles, 100, 'profiles')) { + const profile = record(p, ['id', 'description', 'packages'], ['id', 'description', 'packages'], 'profile'); + text(profile.id, 64, 'profile id'); text(profile.description, 2000, 'profile description'); + for (const name of array(profile.packages, LIMITS.maxPackages, 'profile packages')) if (!seen.has(npmName(name))) throw new TypeError('profile names unknown package'); + } + return { schema: raw.schema, repository: raw.repository, packages, profiles: raw.profiles }; +} +export function names(value, maximum = 4096) { + const values = array(value, maximum, 'package names'); + if (new Set(values).size !== values.length) throw new TypeError('duplicate package names'); + return values.map(npmName).sort(); +} +export function safeSum(values) { + let sum = 0; + for (const value of values) sum = integer(sum + value, 0, Number.MAX_SAFE_INTEGER, 'download total'); + return sum; +} diff --git a/packages/wsp-toolkit/packages/telemetry/src/index.d.ts b/packages/wsp-toolkit/packages/telemetry/src/index.d.ts new file mode 100644 index 000000000..91d2e71e2 --- /dev/null +++ b/packages/wsp-toolkit/packages/telemetry/src/index.d.ts @@ -0,0 +1,76 @@ +export interface CatalogPackage { + name: string; role: 'nucleus' | 'primitive' | 'satellite'; family: string; status: 'published' | 'candidate'; + version: string; repository: string; description: string; directory?: string; + contracts?: string[]; links?: {npm?: string; source?: string}; proposedScope?: string; +} +export interface ConstellationCatalog { + schema: 'ruvnet.constellation-catalog/1'; repository: string; packages: CatalogPackage[]; + profiles: {id: string; description: string; packages: string[]}[]; +} +export interface DownloadDay { day: string; downloads: number } +export interface PackageObservation { + name: string; status: 'ok' | 'unavailable' | 'candidate'; days: DownloadDay[]; + version?: string; dependencies?: string[]; peerDependencies?: string[]; optionalDependencies?: string[]; + metadataStatus?: 'ok' | 'unavailable'; metadataError?: string; error?: string; repository?: string; + sources?: {downloads: string; metadata: string}; +} +export interface RepositoryObservation { + repository: string; status: 'ok' | 'unavailable'; stars?: number; openIssuesAndPRs?: number; source?: string; error?: string; +} +export interface ConstellationObservations { + schema: 'ruvnet.constellation-observations/1'; observedAt: string; start: string; end: string; + packages: PackageObservation[]; repositories: RepositoryObservation[]; +} +export interface CollectionOptions { + start: string; end: string; + /** Trusted fetch capability; defaults to global fetch. Must honor AbortSignal for transport cleanup. */ + fetch?: typeof globalThis.fetch; + /** Whole-collection deadline, default 20000 ms, maximum 60000. */ + timeoutMs?: number; + /** 1..8 task runners; default 4. */ + concurrency?: number; +} +export interface AdoptionSample { + /** Caller-supplied pseudonymous SHA-256 project identifier, never copied into the report. */ + sampleId: string; + observedAt: string; + packages: string[]; +} +export interface ConstellationAdoption { + schema: 'ruvnet.constellation-adoption/1'; consent: true; samples: AdoptionSample[]; +} +export interface DeclaredLink { source: string; target: string; kind: 'runtime' | 'peer' | 'optional' } +export interface PackageMetrics { + name: string; role: CatalogPackage['role']; family: string; catalogStatus: CatalogPackage['status']; status: PackageObservation['status']; + catalogVersion: string; version: string | null; description: string; repository: string; npmURL: string | null; sourceURL: string; + latestDayDownloads: number | null; last7Downloads: number | null; last30Downloads: number | null; + weekdayBaseline: number | null; weekdayDeltaPercent: number | null; weekdayBaselineDays: number; + days: DownloadDay[]; coverage: {observedDays: number; expectedDays: number}; metadataStatus: 'ok' | 'unavailable'; + dependencies: string[]; peerDependencies: string[]; optionalDependencies: string[]; + runtimeDependencyCount: number | null; peerDependencyCount: number | null; optionalDependencyCount: number | null; declaredLinks: DeclaredLink[]; error?: string; +} +export interface AttachMetrics { + status: 'available' | 'unavailable'; unit: 'consenting-project-snapshots'; denominator: number; numerator: number; percentage: number | null; projects: number; + perPrimitive: {name: string; numerator: number; denominator: number; percentage: number | null}[]; + source: {provided: boolean; samplesReceived: number; snapshotsInWindow: number; duplicateSnapshotsRemoved: number}; note: string; +} +export interface ConstellationReport { + schema: 'ruvnet.constellation-report/1'; observedAt: string; start: string; end: string; packages: PackageMetrics[]; + totals: { + latestDayDownloads: number | null; last7Downloads: number | null; last30Downloads: number | null; + observedLast7Downloads: number; observedLast30Downloads: number; + coverage: {catalogPackages: number; publishedPackages: number; candidatePackages: number; packagesWithLatestDay: number; packagesWithLast7: number; packagesWithLast30: number; unavailablePackages: number}; + }; + dailySeries: {day: string; downloads: number | null; observedDownloads: number; observedPackages: number; expectedPackages: number}[]; + repositories: {repository: string; status: 'ok' | 'unavailable'; stars: number | null; openIssuesAndPRs: number | null; source: string; error?: string}[]; + weekdaySummary: {eligiblePackages: number; aboveBaseline: number; netChange: number; families: {family: string; netChange: number; shareOfNetChangePercent: number | null}[]; note: string}; + correlations: {kind: 'daily-download-correlation'; consideredPackages: number; eligiblePairs: number; pairs: {left: string; right: string; r: number; samples: number}[]; note: string}; + declaredLinks: DeclaredLink[]; declaredLinksCoverage: {observedManifests: number; expectedManifests: number}; attach: AttachMetrics; definitions: {downloads: string; totals: string; weekday: string; repositories: string; adoption: string}; +} +/** Read-only explicit collection; candidates are not queried and unknown metrics are never zero-filled. */ +export function collectPublicMetrics(catalog: ConstellationCatalog, options: CollectionOptions): Promise; +/** Synchronous, owned report. Aggregate downloads cannot identify install attach or distinct users. */ +export function analyzeConstellation(catalog: ConstellationCatalog, observations: ConstellationObservations, options?: {adoption?: ConstellationAdoption}): ConstellationReport; +/** Standalone HTML with local controls, safe DOM construction and no trackers or remote assets. */ +export function renderConstellationDashboard(report: ConstellationReport): string; +export const TELEMETRY_LIMITS: Readonly<{maxPackages: number; maxDays: number; maxBytes: number; maxInputBytes: number; maxConcurrency: number; maxTimeoutMs: number; maxSamples: number; maxSamplePackages: number}>; diff --git a/packages/wsp-toolkit/packages/telemetry/src/index.js b/packages/wsp-toolkit/packages/telemetry/src/index.js new file mode 100644 index 000000000..8d72f4c21 --- /dev/null +++ b/packages/wsp-toolkit/packages/telemetry/src/index.js @@ -0,0 +1,4 @@ +export { collectPublicMetrics } from './collect.js'; +export { analyzeConstellation } from './analyze.js'; +export { renderConstellationDashboard } from './dashboard.js'; +export { LIMITS as TELEMETRY_LIMITS } from './data.js'; diff --git a/packages/wsp-toolkit/packages/telemetry/test/dashboard.test.mjs b/packages/wsp-toolkit/packages/telemetry/test/dashboard.test.mjs new file mode 100644 index 000000000..f2073e070 --- /dev/null +++ b/packages/wsp-toolkit/packages/telemetry/test/dashboard.test.mjs @@ -0,0 +1,35 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { chromium } from 'playwright'; +import { analyzeConstellation,renderConstellationDashboard } from '../src/index.js'; +import { catalog,observations } from './fixtures.mjs'; + +test('real Chromium presents explicitly labelled observed subtotals while cohort totals stay unknown',async()=>{ + const input=observations();input.packages[1].status='unavailable';input.packages[1].days=[]; + const report=analyzeConstellation(catalog(),input);assert.equal(report.totals.last30Downloads,null);assert.equal(report.totals.observedLast30Downloads,825); + const browser=await chromium.launch({headless:true}); + try{ + const page=await browser.newPage(),errors=[];page.on('pageerror',error=>errors.push(error.message)); + await page.setContent(renderConstellationDashboard(report)); + assert.equal(await page.locator('#download-label').textContent(),'30-day observed subtotal');assert.equal(await page.locator('#download-total').textContent(),'825'); + assert.match(await page.locator('#download-detail').textContent(),/1\/2.*Full-cohort total is unknown/); + assert.match(await page.locator('#trend-caption').textContent(),/Gold dashed.*1\/2/);assert.equal(await page.locator('#trend-chart path.partial').count(),1); + assert.equal(await page.locator('#trend-legend-dot.partial').count(),1); + await page.selectOption('#period-filter','7');assert.equal(await page.locator('#download-total').textContent(),'273');assert.equal(await page.locator('#download-label').textContent(),'7-day observed subtotal'); + await page.selectOption('#period-filter','1');assert.equal(await page.locator('#download-total').textContent(),'42');assert.equal(await page.locator('#download-label').textContent(),'Final-day observed subtotal'); + assert.equal(await page.locator('#trend-chart circle').count(),1);assert.match(await page.locator('#trend-caption').textContent(),/1\/2/); + await page.selectOption('#trend-package','core');assert.equal(await page.locator('#trend-chart circle').count(),0);assert.match(await page.locator('#trend-caption').textContent(),/No observed daily series/); + assert.deepEqual(errors,[]);assert.equal(report.totals.last30Downloads,null); + }finally{await browser.close();} +}); +test('real Chromium keeps no-observation windows unknown instead of displaying a zero subtotal',async()=>{ + const input=observations();for(const item of input.packages.filter(p=>p.status!=='candidate')){item.status='unavailable';item.days=[];} + const report=analyzeConstellation(catalog(),input),browser=await chromium.launch({headless:true}); + try{ + const page=await browser.newPage();await page.setContent(renderConstellationDashboard(report)); + assert.equal(await page.locator('#download-total').textContent(),'Unknown');assert.equal(await page.locator('#download-label').textContent(),'30-day downloads'); + assert.match(await page.locator('#download-detail').textContent(),/0\/2.*Full-cohort total is unknown/);assert.equal(await page.locator('#trend-chart path').count(),0);assert.equal(await page.locator('#trend-chart circle').count(),0); + assert.match(await page.locator('#trend-caption').textContent(),/No observed daily series/); + await page.selectOption('#period-filter','1');assert.equal(await page.locator('#download-total').textContent(),'Unknown');assert.equal(await page.locator('#download-label').textContent(),'Final-day downloads'); + }finally{await browser.close();} +}); diff --git a/packages/wsp-toolkit/packages/telemetry/test/fixtures.mjs b/packages/wsp-toolkit/packages/telemetry/test/fixtures.mjs new file mode 100644 index 000000000..e8bc4e975 --- /dev/null +++ b/packages/wsp-toolkit/packages/telemetry/test/fixtures.mjs @@ -0,0 +1,13 @@ +export const start='2024-01-01',end='2024-02-11'; +export const days=Array.from({length:42},(_,i)=>({day:new Date(Date.parse(start+'T00:00:00Z')+i*86400000).toISOString().slice(0,10),downloads:i+1})); +export function catalog(){return {schema:'ruvnet.constellation-catalog/1',repository:'owner/repo',packages:[ + {name:'hub',role:'nucleus',family:'entry',status:'published',version:'1.0.0',repository:'owner/repo',description:'Entry'}, + {name:'core',role:'primitive',family:'compute',status:'published',version:'2.0.0',repository:'owner/repo',description:'Core'}, + {name:'candidate',role:'satellite',family:'compute',status:'candidate',version:'0.1.0',repository:'owner/repo',description:'Local source'} +],profiles:[{id:'all',description:'Both',packages:['hub','core']}]};} +export function observations(){return {schema:'ruvnet.constellation-observations/1',observedAt:'2024-02-12T00:00:00Z',start,end,packages:[ + {name:'hub',status:'ok',days:structuredClone(days),version:'1.1.0',metadataStatus:'ok',dependencies:['core']}, + {name:'core',status:'ok',days:days.map(d=>({...d,downloads:d.downloads*2})),version:'2.0.0',metadataStatus:'ok',dependencies:[]}, + {name:'candidate',status:'candidate',days:[]} +],repositories:[{repository:'owner/repo',status:'ok',stars:10,openIssuesAndPRs:3}]};} +export function fixtureFetch(calls=[]){return async(url,options)=>{calls.push({url,options});const u=new URL(url);if(u.hostname==='api.npmjs.org'){const name=decodeURIComponent(u.pathname.split('/').at(-1));return Response.json({package:name,start,end,downloads:days.map(d=>({...d,downloads:d.downloads*(name==='core'?2:1)}))});}if(u.hostname==='registry.npmjs.org'){const name=decodeURIComponent(u.pathname.slice(1,-'/latest'.length));return Response.json({name,version:'1.0.0',dependencies:name==='hub'?{core:'^2'}:{}});}return Response.json({full_name:'owner/repo',stargazers_count:10,open_issues_count:3});};} diff --git a/packages/wsp-toolkit/packages/telemetry/test/telemetry.test.mjs b/packages/wsp-toolkit/packages/telemetry/test/telemetry.test.mjs new file mode 100644 index 000000000..5c5a37ea4 --- /dev/null +++ b/packages/wsp-toolkit/packages/telemetry/test/telemetry.test.mjs @@ -0,0 +1,116 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import {collectPublicMetrics,analyzeConstellation,renderConstellationDashboard}from'../src/index.js'; +import{catalog,observations,fixtureFetch,start,end,days}from'./fixtures.mjs'; + +test('complete-window sums and independent weekday/correlation oracles',()=>{ + const report=analyzeConstellation(catalog(),observations()),hub=report.packages[0]; + assert.equal(hub.latestDayDownloads,42);assert.equal(hub.last7Downloads,273);assert.equal(hub.last30Downloads,825); + assert.equal(hub.weekdayBaseline,24.5);assert.ok(Math.abs(hub.weekdayDeltaPercent-100*17.5/24.5)<1e-10); + assert.equal(report.totals.last7Downloads,819);assert.equal(report.totals.last30Downloads,2475); + assert.equal(report.correlations.pairs[0].r,1);assert.equal(report.correlations.pairs[0].samples,42); + assert.equal(report.declaredLinks[0].target,'core');assert.equal(hub.runtimeDependencyCount,1);assert.equal(report.packages[2].runtimeDependencyCount,null);assert.equal(report.attach.status,'unavailable');assert.equal(report.attach.percentage,null); + assert.equal(report.repositories[0].openIssuesAndPRs,3);assert.match(report.definitions.repositories,/pull requests/); +}); +test('missing days, sources and candidates remain unknown rather than zero-filled',()=>{ + const input=observations();input.packages[0].days.splice(39,1); + const report=analyzeConstellation(catalog(),input); + assert.equal(report.packages[0].last7Downloads,null);assert.equal(report.totals.last7Downloads,null); + assert.equal(report.totals.observedLast7Downloads,546);assert.equal(report.totals.coverage.packagesWithLast7,1); + assert.equal(report.dailySeries[39].downloads,null);assert.equal(report.packages[2].latestDayDownloads,null); + input.packages=[];const missing=analyzeConstellation(catalog(),input); + assert.equal(missing.totals.last30Downloads,null);assert.equal(missing.totals.coverage.unavailablePackages,2); +}); +test('zero baselines, short windows and constant series have no invented percentages or correlations',()=>{ + const input=observations();for(const p of input.packages)for(const d of p.days)d.downloads=0; + const report=analyzeConstellation(catalog(),input); + assert.equal(report.packages[0].last30Downloads,0);assert.equal(report.packages[0].weekdayDeltaPercent,null);assert.deepEqual(report.correlations.pairs,[]); + input.start='2024-02-05';for(const p of input.packages)p.days=p.days.slice(-7); + const short=analyzeConstellation(catalog(),input);assert.equal(short.packages[0].last30Downloads,null);assert.equal(short.packages[0].weekdayBaseline,null); +}); +test('explicit adoption deduplicates latest project snapshots and exposes only aggregate project attach',()=>{ + const adoption={schema:'ruvnet.constellation-adoption/1',consent:true,samples:[ + {sampleId:'a'.repeat(64),observedAt:'2024-02-10T12:00:00Z',packages:['hub']}, + {sampleId:'a'.repeat(64),observedAt:'2024-02-11T12:00:00Z',packages:['hub','core']}, + {sampleId:'b'.repeat(64),observedAt:'2024-02-11T12:00:00Z',packages:['hub']}, + {sampleId:'c'.repeat(64),observedAt:'2024-02-11T12:00:00Z',packages:['core']} + ]}; + const report=analyzeConstellation(catalog(),observations(),{adoption}); + assert.equal(report.attach.unit,'consenting-project-snapshots');assert.equal(report.attach.denominator,2);assert.equal(report.attach.numerator,1);assert.equal(report.attach.percentage,50); + assert.equal(report.attach.projects,3);assert.equal(report.attach.source.duplicateSnapshotsRemoved,1);assert.equal(report.attach.perPrimitive[0].percentage,50); + assert.ok(!JSON.stringify(report).includes('a'.repeat(64)));assert.ok(!JSON.stringify(report).includes('sampleId')); + adoption.samples[1].packages=[];assert.equal(report.attach.percentage,50); +}); +test('consent, identifiers, duplicate conflicts and empty denominators are explicit',()=>{ + const sample={sampleId:'a'.repeat(64),observedAt:'2024-02-11T12:00:00Z',packages:['hub','core']}; + for(const adoption of [ + {schema:'ruvnet.constellation-adoption/1',consent:false,samples:[]}, + {schema:'ruvnet.constellation-adoption/1',consent:true,samples:[{...sample,sampleId:'personal@example.test'}]}, + {schema:'ruvnet.constellation-adoption/1',consent:true,samples:[sample,{...sample,observedAt:'2024-02-11T12:00:00.000Z',packages:['hub']}]} + ])assert.throws(()=>analyzeConstellation(catalog(),observations(),{adoption})); + const report=analyzeConstellation(catalog(),observations(),{adoption:{schema:'ruvnet.constellation-adoption/1',consent:true,samples:[{...sample,packages:['core']}]}}); + assert.equal(report.attach.status,'unavailable');assert.equal(report.attach.percentage,null);assert.equal(report.attach.denominator,0); +}); +test('analysis rejects duplicate/out-of-range points, unsafe counters, unknown fields and getters',()=>{ + for(const mutate of [x=>x.packages[0].days.push(x.packages[0].days[0]),x=>x.packages[0].days[0].day='2024-02-30', + x=>x.packages[0].days[0].downloads=Infinity,x=>x.packages[2].days=[{day:start,downloads:0}],x=>x.extra=true]){ + const input=observations();mutate(input);assert.throws(()=>analyzeConstellation(catalog(),input)); + } + let calls=0;const input=observations();Object.defineProperty(input,'packages',{get(){calls++;return [];}}); + assert.throws(()=>analyzeConstellation(catalog(),input),/accessors/);assert.equal(calls,0); + const overflow=observations();overflow.packages[0].days[0].downloads=Number.MAX_SAFE_INTEGER;assert.throws(()=>analyzeConstellation(catalog(),overflow),/total/); +}); +test('public collection uses fixed public sources, bounded runners and never queries candidates',async()=>{ + const calls=[],input=catalog();const pending=collectPublicMetrics(input,{start,end,fetch:fixtureFetch(calls),concurrency:2});input.packages[0].name='changed'; + const result=await pending;assert.equal(result.packages[0].name,'hub');assert.equal(result.packages[0].status,'ok');assert.equal(result.packages[2].status,'candidate'); + assert.equal(result.repositories[0].openIssuesAndPRs,3);assert.equal(calls.length,5); + assert.ok(calls.every(c=>['api.npmjs.org','registry.npmjs.org','api.github.com'].includes(new URL(c.url).hostname))); + assert.ok(calls.every(c=>c.options.credentials==='omit'&&c.options.redirect==='error'&&!('Authorization'in c.options.headers))); + assert.ok(!calls.some(c=>c.url.includes('candidate'))); +}); +test('metadata failure does not erase independent downloads; source failures stay unavailable',async()=>{ + const good=fixtureFetch();const result=await collectPublicMetrics(catalog(),{start,end,fetch:async(url,options)=>new URL(url).hostname==='registry.npmjs.org'?new Response('',{status:503}):good(url,options)}); + assert.equal(result.packages[0].status,'ok');assert.equal(result.packages[0].metadataStatus,'unavailable');assert.equal(result.packages[0].days.length,42); + const report=analyzeConstellation(catalog(),result);assert.equal(report.packages[0].runtimeDependencyCount,null);assert.equal(report.declaredLinksCoverage.observedManifests,0);assert.equal(report.declaredLinks.length,0); + const failed=await collectPublicMetrics(catalog(),{start,end,fetch:async()=>new Response('',{status:429})}); + assert.equal(failed.packages[0].status,'unavailable');assert.equal(failed.packages[0].days.length,0);assert.equal(failed.repositories[0].status,'unavailable'); + assert.match(failed.packages[0].error,/429/); +}); +test('malformed names, traversal, dates, raised limits and options reject before fetching',async()=>{ + let requests=0;const fetch=async()=>{requests++;return Response.json({});}; + for(const mutate of [x=>x.packages[0].name='hub?token=secret',x=>x.packages[0].repository='owner/../../internal',x=>x.packages[0].directory='../other']){ + const input=catalog();mutate(input);await assert.rejects(collectPublicMetrics(input,{start,end,fetch})); + } + for(const extra of [{start:'2024-02-30'}, {concurrency:9},{timeoutMs:60001},{url:'https://internal.test'}])await assert.rejects(collectPublicMetrics(catalog(),{start,end,fetch,...extra})); + assert.equal(requests,0); +}); +test('deadline bounds uncooperative fetches and no later task issues requests',async()=>{ + let calls=0;const started=performance.now();const result=await collectPublicMetrics(catalog(),{start,end,timeoutMs:10,concurrency:1,fetch:()=>{calls++;return new Promise(()=>{});}}); + assert.ok(performance.now()-started<1000);assert.equal(calls,1);assert.match(result.packages[0].error,/deadline/);assert.equal(result.repositories[0].status,'unavailable'); +}); +test('response byte limits reject declared and streamed overflow, origin changes and redirects',async()=>{ + for(const fetch of [async()=>new Response('{}',{headers:{'content-length':'3000000'}}), + async()=>new Response(new Uint8Array(2*1024*1024+1)), + async()=>{const response=Response.json({});Object.defineProperty(response,'url',{value:'https://internal.test/'});return response;}, + async()=>new Response('',{status:302,headers:{location:'https://internal.test/'}})]){ + const result=await collectPublicMetrics(catalog(),{start,end,fetch});assert.equal(result.packages[0].status,'unavailable');assert.equal(result.repositories[0].status,'unavailable'); + } +}); +test('standalone dashboard escapes hostile text, uses safe DOM and disables network collection',()=>{ + const input=catalog();input.packages[0].description=' & \u2028'; + const report=analyzeConstellation(input,observations()),html=renderConstellationDashboard(report); + assert.ok(!html.includes(']+src=/.test(html));assert.ok(!html.includes('innerHTML'));assert.match(html,/id="period-filter"/);assert.match(html,/id="package-table"/); + assert.throws(()=>renderConstellationDashboard({schema:'other'})); +}); +test('out-of-order contradictions reject at any prior instant with normalized fractional timestamps',()=>{ + const first={sampleId:'a'.repeat(64),observedAt:'2024-02-10T12:00:00.1Z',packages:['hub','core']}; + const newer={...first,observedAt:'2024-02-11T12:00:00Z',packages:['hub']}; + const conflicting={...first,observedAt:'2024-02-10T12:00:00.100Z',packages:['hub']}; + const run=samples=>analyzeConstellation(catalog(),observations(),{adoption:{schema:'ruvnet.constellation-adoption/1',consent:true,samples}}); + for(const samples of [[first,newer,conflicting],[newer,first,conflicting],[conflicting,newer,first]])assert.throws(()=>run(samples),/conflicting duplicate project snapshot/); + const consistent=run([first,newer,{...first,observedAt:'2024-02-10T12:00:00.100Z',packages:['core','hub']}]); + assert.equal(consistent.attach.projects,1);assert.equal(consistent.attach.denominator,1);assert.equal(consistent.attach.percentage,0); + assert.equal(consistent.attach.source.duplicateSnapshotsRemoved,2); + assert.throws(()=>run([{...first,observedAt:'2023-12-31T12:00:00Z'},newer,{...conflicting,observedAt:'2023-12-31T12:00:00.000Z'}]),/conflicting duplicate project snapshot/); +}); diff --git a/packages/wsp-toolkit/scripts/benchmark.mjs b/packages/wsp-toolkit/scripts/benchmark.mjs new file mode 100644 index 000000000..208d15727 --- /dev/null +++ b/packages/wsp-toolkit/scripts/benchmark.mjs @@ -0,0 +1,41 @@ +import { performance } from 'node:perf_hooks'; +import assert from 'node:assert/strict'; +import { fingerprintModel, applyWeightPatch, evaluateWeightPatch } from 'ruv-fann-wsp'; +import { searchWeightPatch } from 'ruv-fann-wsp-search'; +// Compare identical coordinate-search proposals. Reference repeats the baseline per screen. +const model={schema:'ruv-fann.dense-layers/1',layers:[{inputs:1,outputs:1,weights:[0],bias:[0],activation:'Linear',steepness:1}]}; +const data={inputs:Array.from({length:32},(_,i)=>i/31),targets:Array.from({length:32},(_,i)=>2*i/31),rows:32}; +const policy={maxMSE:0,maxRegressionMSE:0}, values=Array.from({length:16},(_,i)=>(i+1)/8); +const options={locations:[{layer:0,parameter:'weights',index:0,values}],maxEvaluations:16,maxPasses:1,simd:false}; +const baseHash=await fingerprintModel(model); +async function reference() { + let best=Infinity, selected; + for(const value of values) { + const patch={schema:'ruv-fann.weight-patch/1',baseHash,edits:[{layer:0,parameter:'weights',index:0,value}]}; + const result=await evaluateWeightPatch(model,patch,data,policy,{simd:false}); + if(result.candidate.msesearchWeightPatch(model,data,policy,options); +await reference();await run(); // Exclude module loading/WASM initialization from both timings. +const durations={reference:[],screened:[]};let baseline,optimized; +for(let repetition=0;repetition<9;repetition++) { + // Alternate execution order to reduce systematic warm-cache bias. + for(const variant of repetition%2?['screened','reference']:['reference','screened']) { + const start=performance.now();const result=await(variant==='reference'?reference():run()); + durations[variant].push(performance.now()-start); + if(variant==='reference')baseline=result;else optimized=result; + } +} +assert.equal(optimized.evaluation.candidateHash,baseline.evaluation.candidateHash); +assert.equal(optimized.evaluation.candidate.mse,0); +assert.equal(optimized.inferencePasses,19);assert.equal(baseline.inferencePasses,32); +assert.equal((await applyWeightPatch(model,optimized.patch)).layers[0].weights[0],2); +const median=values=>[...values].sort((a,b)=>a-b)[Math.floor(values.length/2)]; +console.log(JSON.stringify({schema:'ruv-fann.search-benchmark/1',node:process.version,backend:optimized.backend,rows:32,candidateCount:16,repetitions:9, + equivalentCandidateHash:optimized.evaluation.candidateHash,candidateMSE:optimized.evaluation.candidate.mse, + referenceInferencePasses:baseline.inferencePasses,screenedInferencePasses:optimized.inferencePasses, + inferencePassReductionPercent:100*(1-optimized.inferencePasses/baseline.inferencePasses), + referenceMedianMs:median(durations.reference),screenedMedianMs:median(durations.screened), + note:'Identical 16-candidate monotonic one-coordinate sequence. Timing is a local observation; work reduction includes final authoritative baseline/candidate revalidation. Not an accuracy or generalization benchmark.'},null,2)); diff --git a/packages/wsp-toolkit/scripts/constellation-links.mjs b/packages/wsp-toolkit/scripts/constellation-links.mjs new file mode 100644 index 000000000..524c1d5cc --- /dev/null +++ b/packages/wsp-toolkit/scripts/constellation-links.mjs @@ -0,0 +1,37 @@ +import {readFile,writeFile} from 'node:fs/promises'; +import {resolve,dirname,relative,join} from 'node:path'; +import {fileURLToPath} from 'node:url'; +import {validateCatalog,validateModuleManifest,CONTRACTS} from 'ruvnet-constellation-contracts'; +const root=resolve(dirname(fileURLToPath(import.meta.url)),'..'); +const catalog=validateCatalog(JSON.parse(await readFile(join(root,'packages/constellation/catalog.json'),'utf8'))); +const check=process.argv.slice(2).includes('--check'); +if(process.argv.slice(2).some(arg=>arg!=='--check'))throw new Error('usage: node scripts/constellation-links.mjs [--check]'); +const entries=catalog.packages.filter(p=>p.status==='candidate'&&p.repository===catalog.repository&&p.directory?.startsWith('packages/wsp-toolkit/packages/')); +const start='',end=''; +let changes=0; +for(const entry of entries) { + const directory=resolve(root,'../..',entry.directory); + if(!directory.startsWith(join(root,'packages')+'/'))throw new Error('candidate directory escapes workspace'); + const readmePath=join(directory,'README.md'),manifestPath=join(directory,'package.json'); + const manifest=JSON.parse(await readFile(manifestPath,'utf8')); + if(manifest.name!==entry.name||manifest.version!==entry.version)throw new Error('catalog package identity differs from source'); + const sourceLink=target=>relative(directory,join(root,'packages',target,'README.md')).split('\\').join('/'); + const block=`${start}\n\nExplore the [constellation onramp](${sourceLink('constellation')}) and [shared contracts](${sourceLink('contracts')}). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo).\n\nThese links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog.\n\n${end}`; + const before=await readFile(readmePath,'utf8'); + if((before.includes(start)||before.includes(end))&&!(before.includes(start)&&before.includes(end)))throw new Error('incomplete constellation README markers'); + const after=before.includes(start)?before.slice(0,before.indexOf(start))+block+before.slice(before.indexOf(end)+end.length):before.trimEnd()+'\n\n'+block+'\n'; + const dependencies={...manifest.dependencies,...manifest.peerDependencies,...manifest.optionalDependencies}; + const module=validateModuleManifest({schema:CONTRACTS.module,name:entry.name,version:entry.version,role:entry.role, + contracts:[...new Set([CONTRACTS.module,...(entry.contracts??[])])],integrations:Object.keys(dependencies).filter(name=>catalog.packages.some(p=>p.name===name)).sort()}); + const modulePath=join(directory,'constellation.json');let oldModule; + try{oldModule=await readFile(modulePath,'utf8');}catch(error){if(error.code!=='ENOENT')throw error;} + const moduleJSON=JSON.stringify(module,null,2)+'\n'; + const nextManifest={...manifest,files:[...new Set([...(manifest.files??[]),'constellation.json'])]}; + const changed=after!==before||oldModule!==moduleJSON||!manifest.files?.includes('constellation.json'); + if(changed) { + changes++; + if(!check){await writeFile(readmePath,after);await writeFile(modulePath,moduleJSON);await writeFile(manifestPath,JSON.stringify(nextManifest,null,2)+'\n');} + } +} +if(check&&changes)throw new Error(`${changes} constellation metadata/README blocks need regeneration`); +console.log(JSON.stringify({packages:entries.length,changes,mode:check?'check':'write'})); diff --git a/packages/wsp-toolkit/scripts/constellation-report.mjs b/packages/wsp-toolkit/scripts/constellation-report.mjs new file mode 100644 index 000000000..f0b9bbe0f --- /dev/null +++ b/packages/wsp-toolkit/scripts/constellation-report.mjs @@ -0,0 +1,52 @@ +import { constants } from 'node:fs'; +import { open,mkdir,rename,unlink,lstat } from 'node:fs/promises'; +import { randomUUID } from 'node:crypto'; +import { resolve,join,dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { validateCatalog } from 'ruvnet-constellation-contracts'; +import { collectPublicMetrics,analyzeConstellation,renderConstellationDashboard } from 'ruvnet-constellation-telemetry'; +const root=resolve(dirname(fileURLToPath(import.meta.url)),'..'); +const args=process.argv.slice(2),options={}; +for(let i=0;imaxBytes)throw new RangeError('input file exceeds byte limit'); + try{return JSON.parse(new TextDecoder('utf-8',{fatal:true}).decode(bytes.subarray(0,length)));}catch{throw new TypeError('input must contain valid UTF-8 JSON');} + }finally{await file.close();} +} +const configuredEnd=options['--end']??(process.env.CONSTELLATION_REPORT_END||undefined); +if(configuredEnd!==undefined&&(!/^\d{4}-\d{2}-\d{2}$/.test(configuredEnd)||new Date(configuredEnd+'T00:00:00Z').toISOString().slice(0,10)!==configuredEnd))throw new TypeError('end must be a valid UTC calendar day'); +const end=configuredEnd??new Date(Date.UTC(new Date().getUTCFullYear(),new Date().getUTCMonth(),new Date().getUTCDate()-1)).toISOString().slice(0,10); +const start=options['--start']??new Date(Date.parse(end+'T00:00:00Z')-41*86400000).toISOString().slice(0,10); +const catalog=validateCatalog(await readJSON(resolve(options['--catalog']??join(root,'packages/constellation/catalog.json')),2*1024*1024)); +const adoption=options['--adoption']===undefined?undefined:await readJSON(resolve(options['--adoption']),8*1024*1024); +const observations=await collectPublicMetrics(catalog,{start,end,timeoutMs:60000,concurrency:4}); +const report=analyzeConstellation(catalog,observations,adoption===undefined?undefined:{adoption}); +const output=resolve(options['--output']??join(root,'.artifacts/constellation')); +await mkdir(output,{recursive:true}); +if((await lstat(output)).isSymbolicLink())throw new TypeError('output must be a real directory'); +async function atomicWrite(name,content) { + const temporary=join(output,'.'+name+'.'+randomUUID()+'.tmp'); + let created=false; + try{ + const file=await open(temporary,constants.O_WRONLY|constants.O_CREAT|constants.O_EXCL|(constants.O_NOFOLLOW??0),0o600);created=true; + try{await file.writeFile(content);}finally{await file.close();} + await rename(temporary,join(output,name)); + }finally{if(created)await unlink(temporary).catch(error=>{if(error.code!=='ENOENT')throw error;});} +} +await atomicWrite('observations.json',JSON.stringify(observations,null,2)+'\n'); +await atomicWrite('report.json',JSON.stringify(report,null,2)+'\n'); +await atomicWrite('dashboard.html',renderConstellationDashboard(report)); +console.log(JSON.stringify({catalogEntries:catalog.packages.length,published:catalog.packages.filter(p=>p.status==='published').length, + packageCoverage:observations.packages.reduce((counts,p)=>({...counts,[p.status]:(counts[p.status]??0)+1}),{}), + repositoryCoverage:observations.repositories.reduce((counts,r)=>({...counts,[r.status]:(counts[r.status]??0)+1}),{}), + start,end,attachStatus:report.attach.status,unit:report.attach.unit,output},null,2)); diff --git a/packages/wsp-toolkit/scripts/evolution-demo.mjs b/packages/wsp-toolkit/scripts/evolution-demo.mjs new file mode 100644 index 000000000..60b3dd9f3 --- /dev/null +++ b/packages/wsp-toolkit/scripts/evolution-demo.mjs @@ -0,0 +1,13 @@ +import { mkdtemp,mkdir,writeFile } from 'node:fs/promises'; +import { resolve,join } from 'node:path'; +import { openDemoRegistry } from '../tooling/agentdb/runtime.mjs'; +import { runEvolutionScenario } from '../test/evolution-scenario.mjs'; +const root=resolve(new URL('..',import.meta.url).pathname); +await mkdir(join(root,'.artifacts'),{recursive:true}); +const directory=await mkdtemp(join(root,'.artifacts','evolution-')); +const result=await runEvolutionScenario(openDemoRegistry,directory); +const filename=join(directory,'report.json'); +await writeFile(filename,JSON.stringify({...result,database:join(directory,'evolution.sqlite')},null,2)+'\n'); +console.log(JSON.stringify({stopReason:result.report.stopReason,rounds:result.report.rounds,promotions:result.report.promotions, + proposalWorkers:result.report.workerThreadIds.length,independentRejections:result.report.events.filter(e=>e.type==='rejected').length, + reservedWork:result.report.budget.reservedWork,durability:result.durability,rollback:result.rollback,report:filename},null,2)); diff --git a/packages/wsp-toolkit/scripts/huggingface-live.mjs b/packages/wsp-toolkit/scripts/huggingface-live.mjs new file mode 100644 index 000000000..6966972f1 --- /dev/null +++ b/packages/wsp-toolkit/scripts/huggingface-live.mjs @@ -0,0 +1,25 @@ +import { loadHubLinearHead } from 'ruv-fann-wsp-huggingface'; +import { traceWeightModel, evaluateWeightPatch } from 'ruv-fann-wsp'; +import assert from 'node:assert/strict'; +import { readFile } from 'node:fs/promises'; +const source=JSON.parse(await readFile(new URL('../docs/huggingface-source.json',import.meta.url),'utf8')); +const loaded=await loadHubLinearHead(source,{timeoutMs:30000}); +const layer=loaded.model.layers[0]; +const inputs=Array.from({length:layer.inputs*4},(_,i)=>Math.sin(i)/layer.inputs); +// Independently compute the declared affine interpretation, not the source task's outputs. +const targets=Array.from({length:4},(_,row)=>layer.weights.reduce((sum,w,i)=>sum+w*inputs[row*layer.inputs+i],layer.bias[0])); +const trace=await traceWeightModel(loaded.model,{inputs,rows:4},{simd:false}); +const maxDifference=Math.max(...trace.layers[0].activations.map((v,i)=>Math.abs(v-targets[i]))); +assert.ok(maxDifference<1e-12); +const patch={schema:'ruv-fann.weight-patch/1',baseHash:loaded.inspection.baseHash, + edits:[{layer:0,parameter:'bias',index:0,value:layer.bias[0]+0.1}]}; +const evaluation=await evaluateWeightPatch(loaded.model,patch,{inputs,targets,rows:4},{maxMSE:0.011,maxRegressionMSE:0.011},{simd:false}); +assert.equal(evaluation.accepted,true); +assert.ok(Math.abs(evaluation.candidate.mse-0.01)<1e-12); +patch.edits[0].value=layer.bias[0]+1; +const rejected=await evaluateWeightPatch(loaded.model,patch,{inputs,targets,rows:4},{maxMSE:0.011,maxRegressionMSE:0.011},{simd:false}); +assert.equal(rejected.accepted,false); +console.log(JSON.stringify({schema:'ruv-fann.hub-live-validation/1',source:loaded.provenance,interpretation:loaded.interpretation, + modelHash:loaded.inspection.baseHash,parameters:loaded.inspection.parameterCount,backend:evaluation.backend, + maxAffineOracleDifference:maxDifference,acceptedControlledMSE:evaluation.candidate.mse,rejectedControlledMSE:rejected.candidate.mse, + taskAccuracyMeasured:false,note:'Live public Hub download and real WASM affine-head contract. Controlled synthetic inputs are not a WiFi sensing accuracy benchmark.'},null,2)); diff --git a/packages/wsp-toolkit/scripts/packed-consumer.mjs b/packages/wsp-toolkit/scripts/packed-consumer.mjs new file mode 100644 index 000000000..a3f1fb53f --- /dev/null +++ b/packages/wsp-toolkit/scripts/packed-consumer.mjs @@ -0,0 +1,44 @@ +import { mkdtemp, readFile, writeFile, copyFile, rm } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import { join, resolve, dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { execFileSync } from 'node:child_process'; +import { createHash } from 'node:crypto'; +export const toolkitRoot=resolve(dirname(fileURLToPath(import.meta.url)),'..'); +export const names=['lifecycle','search','huggingface','cloudflare','ruos','invariants','swarm','registry','loop'].map(p=>`ruv-fann-wsp-${p}`).concat(['ruvnet-constellation-contracts','ruvnet-constellation','ruvnet-constellation-telemetry']); +export async function packToolkit(directory) { + const output=JSON.parse(execFileSync('npm',['pack','--ignore-scripts','--json','--pack-destination',directory,...names.flatMap(n=>['--workspace',n])],{cwd:toolkitRoot,encoding:'utf8'})); + return Promise.all(output.map(async p=>({name:p.name,version:p.version,filename:p.filename,bytes:p.size, + sha256:createHash('sha256').update(await readFile(join(directory,p.filename))).digest('hex')}))); +} +export async function verifyPackedConsumer() { + const directory=await mkdtemp(join(tmpdir(),'wsp-consumer-')); + try { + const archives=await packToolkit(directory); + await writeFile(join(directory,'package.json'),JSON.stringify({private:true,type:'module'})); + execFileSync('npm',['install','--ignore-scripts','--prefer-offline','--no-audit','--no-fund',...archives.map(p=>join(directory,p.filename))],{cwd:directory,encoding:'utf8'}); + await copyFile(join(toolkitRoot,'test','scenario.mjs'),join(directory,'scenario.mjs')); + await copyFile(join(toolkitRoot,'test','types.ts'),join(directory,'types.ts')); + await copyFile(join(toolkitRoot,'test','evolution-scenario.mjs'),join(directory,'evolution-scenario.mjs')); + for(const file of ['constellation-scenario.mjs','constellation-fixture.mjs'])await copyFile(join(toolkitRoot,'test',file),join(directory,file)); + execFileSync(process.execPath,[join(toolkitRoot,'node_modules/typescript/bin/tsc'),'--noEmit','--strict','--module','nodenext','--target','es2023','--lib','es2023,dom','types.ts'],{cwd:directory,encoding:'utf8'}); + const stdout=execFileSync(process.execPath,['--input-type=module','-e', + "import {pathToFileURL} from 'node:url'; import {runScenario} from './scenario.mjs'; import {runEvolutionScenario} from './evolution-scenario.mjs'; import {runConstellationScenario} from './constellation-scenario.mjs'; import {createAgentDBRegistry} from 'ruv-fann-wsp-registry'; import {buildWorker} from 'ruv-fann-wsp-cloudflare/build'; const {openDemoRegistry}=await import(pathToFileURL(process.argv[1]).href); await buildWorker('./worker'); const evolution=await runEvolutionScenario(path=>openDemoRegistry(path,createAgentDBRegistry),'.'); console.log('WSP_CONSUMER_RESULT '+JSON.stringify({results:[await runScenario(false),await runScenario(true)],evolution,constellation:await runConstellationScenario()}));",join(toolkitRoot,'tooling/agentdb/runtime.mjs')],{cwd:directory,encoding:'utf8'}); + const line=stdout.split('\n').find(line=>line.startsWith('WSP_CONSUMER_RESULT ')); + if(!line)throw new Error('packed consumer result is missing'); + const result=JSON.parse(line.slice('WSP_CONSUMER_RESULT '.length)); + const light=await mkdtemp(join(tmpdir(),'constellation-light-')); + let lightweight; + try { + await writeFile(join(light,'package.json'),JSON.stringify({private:true,type:'module'})); + const small=archives.filter(p=>['ruvnet-constellation','ruvnet-constellation-contracts'].includes(p.name)); + execFileSync('npm',['install','--ignore-scripts','--prefer-offline','--no-audit','--no-fund',...small.map(p=>join(directory,p.filename))],{cwd:light,encoding:'utf8'}); + const tree=JSON.parse(execFileSync('npm',['ls','--all','--json'],{cwd:light,encoding:'utf8'})); + const found=new Set();const walk=tree=>{for(const [name,value]of Object.entries(tree.dependencies??{})){found.add(name);walk(value);}};walk(tree); + if(found.size!==2||!found.has('ruvnet-constellation')||!found.has('ruvnet-constellation-contracts'))throw Error('lightweight onramp installed unexpected dependencies'); + execFileSync(process.execPath,['--input-type=module','-e',"import {readCatalog,planProfile} from 'ruvnet-constellation'; if(planProfile(await readCatalog(),'weights').registrySpecs[0]!=='ruv-fann-wsp@0.2.0')throw Error('light profile');"],{cwd:light,encoding:'utf8'}); + lightweight={packageCount:found.size,mlStackInstalled:false}; + }finally{await rm(light,{recursive:true,force:true});} + return {schema:'ruv-fann.packed-consumer/1',archives,...result,lightweight}; + }finally{await rm(directory,{recursive:true,force:true});} +} diff --git a/packages/wsp-toolkit/scripts/validate.mjs b/packages/wsp-toolkit/scripts/validate.mjs new file mode 100644 index 000000000..d1a090010 --- /dev/null +++ b/packages/wsp-toolkit/scripts/validate.mjs @@ -0,0 +1,46 @@ +import { execFileSync } from 'node:child_process'; +import { mkdir, readdir, readFile, writeFile } from 'node:fs/promises'; +import { createHash } from 'node:crypto'; +import { join } from 'node:path'; +import { fileURLToPath } from 'node:url'; +const root=fileURLToPath(new URL('..',import.meta.url)); +const output=join(root,'.artifacts');await mkdir(output,{recursive:true}); +const run=(command,args)=>execFileSync(command,args,{cwd:root,encoding:'utf8',maxBuffer:8*1024*1024}); +run(process.execPath,['node_modules/typescript/bin/tsc','--noEmit','-p','tsconfig.json']); +run(process.execPath,['scripts/constellation-links.mjs','--check']); +const tests=[]; +for(const pkg of (await readdir(join(root,'packages'))).sort()) { + const dir=`packages/${pkg}/test`; + for(const file of (await readdir(join(root,dir))).sort())if(file.endsWith('.test.mjs'))tests.push(`${dir}/${file}`); +} +for(const file of (await readdir(join(root,'test'))).sort())if(file.endsWith('.test.mjs'))tests.push(`test/${file}`); +tests.push('../../scripts/constellation-oidc.test.mjs','../../scripts/wsp-release-evidence.test.mjs'); +const tap=run(process.execPath,['--test','--test-reporter=tap',...tests]); +await writeFile(join(output,'tests.tap'),tap); +const count=name=>Number(tap.match(new RegExp(`^# ${name} (\\d+)$`,'m'))?.[1]??NaN); +const summary=Object.fromEntries(['tests','pass','fail','cancelled','skipped','todo'].map(name=>[name,count(name)])); +if(!Number.isInteger(summary.tests)||summary.tests<1||summary.pass!==summary.tests||['fail','cancelled','skipped','todo'].some(k=>summary[k]!==0))throw Error('tests must pass with zero cancellations, skips or todos'); +const benchmark=JSON.parse(run(process.execPath,['scripts/benchmark.mjs'])); +const audit=JSON.parse(run('npm',['audit','--json'])); +if(audit.metadata?.vulnerabilities?.total!==0)throw Error('dependency audit must report zero known vulnerabilities'); +const agentdbAudit=JSON.parse(run('npm',['audit','--json','--prefix','tooling/agentdb','--omit=optional'])); +if(agentdbAudit.metadata?.vulnerabilities?.total!==0)throw Error('AgentDB integration dependency audit must report zero known vulnerabilities'); +const files=[]; +async function walk(relative='') { + for(const item of (await readdir(join(root,relative),{withFileTypes:true})).sort((a,b)=>a.name.localeCompare(b.name))) { + if(['node_modules','.artifacts','evidence'].includes(item.name))continue; + const name=relative?`${relative}/${item.name}`:item.name; + if(item.isDirectory())await walk(name); + else if(item.isFile())files.push({path:name,sha256:createHash('sha256').update(await readFile(join(root,name))).digest('hex')}); + } +} +await walk(); +for(const external of ['../../scripts/constellation-oidc.mjs','../../scripts/constellation-oidc.test.mjs','../../scripts/wsp-release-lane.mjs','../../.github/workflows/protected-wsp-release.yml','../../.github/workflows/wsp-modules.yml','../../.github/workflows/wsp-toolkit.yml','../../.github/workflows/constellation-observatory.yml','../../docs/constellation-design.md','../../docs/constellation-release.md','../../docs/constellation.md'])files.push({path:external,sha256:createHash('sha256').update(await readFile(join(root,external))).digest('hex')}); +const report={schema:'ruv-fann.toolkit-validation/1',createdAt:new Date().toISOString(),node:process.version, + typecheck:'passed',tests:summary,benchmark,audit:{vulnerabilities:audit.metadata.vulnerabilities,scope:'all production and development dependencies',lockfileSHA256:createHash('sha256').update(await readFile(join(root,'package-lock.json'))).digest('hex')}, + agentdbIntegrationAudit:{vulnerabilities:agentdbAudit.metadata.vulnerabilities,scope:'installed integration tree, optional dependencies omitted',lockfileSHA256:createHash('sha256').update(await readFile(join(root,'tooling/agentdb/package-lock.json'))).digest('hex')}, + sourceTreeSHA256:createHash('sha256').update(JSON.stringify(files)).digest('hex'),sourceFiles:files, + limits:'Local validation only. Source digest excludes generated .artifacts and docs/evidence. This is not a signature or deployment authorization.'}; +await writeFile(join(output,'validation.json'),JSON.stringify(report,null,2)+'\n'); +console.log(JSON.stringify({typecheck:report.typecheck,tests:summary,audit:audit.metadata.vulnerabilities,agentdbIntegrationAudit:agentdbAudit.metadata.vulnerabilities, + inferencePassReductionPercent:benchmark.inferencePassReductionPercent,sourceTreeSHA256:report.sourceTreeSHA256,report:'.artifacts/validation.json'},null,2)); diff --git a/packages/wsp-toolkit/test/browser.test.mjs b/packages/wsp-toolkit/test/browser.test.mjs new file mode 100644 index 000000000..04b884d83 --- /dev/null +++ b/packages/wsp-toolkit/test/browser.test.mjs @@ -0,0 +1,37 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { createServer } from 'node:http'; +import { readFile, realpath } from 'node:fs/promises'; +import { resolve, sep, extname } from 'node:path'; +import { chromium } from 'playwright'; +const root=resolve(new URL('..',import.meta.url).pathname); +const importmap={imports:{'ruv-fann-wsp':'/node_modules/ruv-fann-wsp/src/index.js','ruv-fann':'/node_modules/ruv-fann/src/index.js','ruv-fann-wasm':'/node_modules/ruv-fann-wasm/src/index.js', + ...Object.fromEntries(['lifecycle','search','huggingface','ruos'].map(p=>[`ruv-fann-wsp-${p}`,`/packages/${p}/src/index.js`]))}}; + +test('real Chromium executes surgical repair, diagnostics, search, Hub fixture and rollback',async()=>{ + const server=createServer(async(req,res)=>{ + try { + const path=new URL(req.url,'http://localhost').pathname; + if (path==='/') {res.setHeader('Content-Type','text/html');res.end(``);return;} + const file=await realpath(resolve(root,`.${decodeURIComponent(path)}`)); + if(!file.startsWith(root+sep)) {res.writeHead(403).end();return;} + res.setHeader('Content-Type',extname(file)==='.wasm'?'application/wasm':'text/javascript'); + res.end(await readFile(file)); + }catch{res.writeHead(404).end();} + }); + await new Promise(resolve=>server.listen(0,'127.0.0.1',resolve)); + let browser; + try { + browser=await chromium.launch({headless:true}); + const page=await browser.newPage(); + const errors=[];page.on('pageerror',e=>errors.push(e.message)); + await page.goto(`http://127.0.0.1:${server.address().port}/`); + const results=await page.evaluate(async()=>{ + const {runScenario}=await import('/test/scenario.mjs'); + return [await runScenario(false),await runScenario(true)]; + }); + assert.deepEqual(errors,[]); + assert.deepEqual(results.map(r=>r.backend),['wasm','wasm-simd']); + assert.ok(results.every(r=>r.candidateMSE===0 && r.regressionRejected && r.compiledXor && r.rollbackRevision===3)); + }finally{await browser?.close();await new Promise(resolve=>server.close(resolve));} +}); diff --git a/packages/wsp-toolkit/test/constellation-browser.test.mjs b/packages/wsp-toolkit/test/constellation-browser.test.mjs new file mode 100644 index 000000000..49f3809bf --- /dev/null +++ b/packages/wsp-toolkit/test/constellation-browser.test.mjs @@ -0,0 +1,33 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import {createServer} from 'node:http'; +import {chromium} from 'playwright'; +import {renderConstellationDashboard} from 'ruvnet-constellation-telemetry'; +import {constellationFixture} from './constellation-fixture.mjs'; +test('standalone dashboard filters real report shapes without external requests or executable metadata',async()=>{ + const fixture=await constellationFixture({adoption:true,hostile:true}); + const unsampled=await constellationFixture(); + const pages=new Map([['/',renderConstellationDashboard(fixture.report)],['/unsampled',renderConstellationDashboard(unsampled.report)]]); + const server=createServer((req,res)=>{if(pages.has(req.url)){res.writeHead(200,{'Content-Type':'text/html'});res.end(pages.get(req.url));}else res.writeHead(404).end();}); + await new Promise(resolve=>server.listen(0,'127.0.0.1',resolve));let browser; + try { + browser=await chromium.launch({headless:true});const page=await browser.newPage(),errors=[],external=[]; + page.on('pageerror',e=>errors.push(e.message));page.on('request',r=>{if(!r.url().startsWith('http://127.0.0.1:'))external.push(r.url());}); + const origin=`http://127.0.0.1:${server.address().port}`;await page.goto(origin); + await page.waitForSelector('#package-table tr[data-package]'); + assert.equal(await page.locator('#package-table tr[data-package]').count(),24); + assert.match(await page.locator('#attach-rate').innerText(),/66\.7|66\.67|67/); + assert.equal(await page.evaluate(()=>window.constellationPwned),undefined); + assert.equal(await page.locator('img').count(),0); + const monthly=await page.locator('#download-total').innerText();await page.selectOption('#period-filter','7'); + assert.notEqual(await page.locator('#download-total').innerText(),monthly); + await page.selectOption('#family-filter','ruv-fann');await page.selectOption('#role-filter','satellite'); + assert.equal(await page.locator('#package-table tr[data-package]').count(),9); + await page.fill('#package-search','loop');assert.equal(await page.locator('#package-table tr[data-package]').count(),1); + assert.equal(await page.locator('#package-table tr[data-package]').getAttribute('data-package'),'ruv-fann-wsp-loop'); + assert.match(await page.locator('#package-table').innerText(),/Local candidate/); + await page.fill('#package-search','no-such-package');assert.match(await page.locator('#package-table').innerText(),/No packages match/); + await page.goto(origin+'/unsampled');assert.match(await page.locator('#attach-rate').innerText(),/Not measured/); + assert.deepEqual(errors,[]);assert.deepEqual(external,[]); + } finally {await browser?.close();await new Promise(resolve=>server.close(resolve));} +}); diff --git a/packages/wsp-toolkit/test/constellation-fixture.mjs b/packages/wsp-toolkit/test/constellation-fixture.mjs new file mode 100644 index 000000000..268683fc6 --- /dev/null +++ b/packages/wsp-toolkit/test/constellation-fixture.mjs @@ -0,0 +1,20 @@ +import {readCatalog} from 'ruvnet-constellation'; +import {analyzeConstellation} from 'ruvnet-constellation-telemetry'; +export async function constellationFixture({adoption=false,hostile=false}={}) { + const catalog=await readCatalog(); + if(hostile)catalog.packages[0].description=''; + const start='2026-09-30',end='2026-11-10'; + const observations={schema:'ruvnet.constellation-observations/1',observedAt:'2026-11-11T12:00:00.000Z',start,end, + packages:catalog.packages.map((p,index)=>p.status==='candidate'?{name:p.name,status:'candidate',days:[]}: + {name:p.name,status:'ok',version:p.version,metadataStatus:'ok',dependencies:p.name==='agentdb'?['ruv-fann-wsp']:[],peerDependencies:[],optionalDependencies:[], + days:Array.from({length:42},(_,day)=>({day:new Date(Date.parse(start+'T00:00:00Z')+day*86400000).toISOString().slice(0,10),downloads:(index+1)*100+day}))}), + repositories:[...new Set(catalog.packages.filter(p=>p.status==='published').map(p=>p.repository))].map(repository=>({repository,status:'ok',stars:100,openIssuesAndPRs:3}))}; + const input={schema:'ruvnet.constellation-adoption/1',consent:true,samples:[ + {sampleId:'1'.repeat(64),observedAt:end+'T01:00:00.000Z',packages:['metaharness','agentdb','ruvector']}, + {sampleId:'2'.repeat(64),observedAt:end+'T02:00:00.000Z',packages:['ruflo','ruvector']}, + {sampleId:'3'.repeat(64),observedAt:end+'T03:00:00.000Z',packages:['metaharness']}, + {sampleId:'4'.repeat(64),observedAt:end+'T04:00:00.000Z',packages:['ruv-fann-wsp']} + ]}; + const report=analyzeConstellation(catalog,observations,adoption?{adoption:input}:undefined); + return {catalog,observations,report}; +} diff --git a/packages/wsp-toolkit/test/constellation-scenario.mjs b/packages/wsp-toolkit/test/constellation-scenario.mjs new file mode 100644 index 000000000..47bd0ca74 --- /dev/null +++ b/packages/wsp-toolkit/test/constellation-scenario.mjs @@ -0,0 +1,33 @@ +import {mkdtemp,readFile,access,rm} from 'node:fs/promises'; +import {join} from 'node:path'; +import {tmpdir} from 'node:os'; +import {execFileSync} from 'node:child_process'; +import {readCatalog,planProfile,scaffoldSatellite} from 'ruvnet-constellation'; +import {validateModuleManifest} from 'ruvnet-constellation-contracts'; +import {constellationFixture} from './constellation-fixture.mjs'; +const check=(ok,message)=>{if(!ok)throw new Error(`constellation scenario: ${message}`);}; +export async function runConstellationScenario() { + const catalog=await readCatalog(),plan=planProfile(catalog,'weights'),local=planProfile(catalog,'local-loop'); + check(plan.registrySpecs.length===1&&plan.registrySpecs[0]==='ruv-fann-wsp@0.2.0','verified primitive profile'); + check(local.publicInstallAvailable===false&&local.registrySpecs.length===0,'source candidates cannot masquerade as registry installs'); + const directory=await mkdtemp(join(tmpdir(),'constellation-scenario-')); + try { + const scaffold=await scaffoldSatellite({directory:join(directory,'satellite'),name:'constellation-review-fixture',integrations:['ruv-fann-wsp']}); + check(scaffold.telemetry==='disabled'&&!scaffold.published,'scaffold remains an explicit local candidate'); + const module=validateModuleManifest(JSON.parse(await readFile(join(scaffold.directory,'constellation.json'),'utf8'))); + check(module.integrations.includes('ruv-fann-wsp'),'explicit integration contract'); + const manifest=JSON.parse(await readFile(join(scaffold.directory,'package.json'),'utf8')); + check(!manifest.dependencies&&!manifest.peerDependencies,'no forced nucleus dependencies'); + const env={...process.env};delete env.NODE_TEST_CONTEXT; + const output=execFileSync('npm',['test'],{cwd:scaffold.directory,encoding:'utf8',env}); + check(/(?:# pass 3|ℹ pass 3)/.test(output)&&!/(?:# fail [1-9]|ℹ fail [1-9]|# skipped [1-9]|ℹ skipped [1-9])/.test(output),'generated satellite tests actually execute'); + let installed=false;try{await access(join(scaffold.directory,'node_modules'));installed=true;}catch{} + check(!installed,'scaffold works without install'); + const fixture=await constellationFixture({adoption:true}),unsampled=await constellationFixture(); + check(fixture.report.attach.denominator===3&&fixture.report.attach.numerator===2,'attach measures sampled projects'); + check(unsampled.report.attach.status==='unavailable'&&unsampled.report.attach.percentage===null,'downloads do not invent attach'); + check(!JSON.stringify(fixture.report).includes('1'.repeat(64)),'sample IDs are not published'); + return {schema:'ruvnet.constellation-acceptance/1',catalogEntries:catalog.packages.length,published:catalog.packages.filter(p=>p.status==='published').length, + candidateProfileBlocked:true,scaffoldTests:3,scaffoldNoInstall:true,attachUnit:fixture.report.attach.unit,attachDenominator:3,attachNumerator:2,unsampledAttach:'unavailable',sampleIDsExcluded:true}; + } finally {await rm(directory,{recursive:true,force:true});} +} diff --git a/packages/wsp-toolkit/test/constellation.test.mjs b/packages/wsp-toolkit/test/constellation.test.mjs new file mode 100644 index 000000000..2be1b0833 --- /dev/null +++ b/packages/wsp-toolkit/test/constellation.test.mjs @@ -0,0 +1,33 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import {mkdtemp,writeFile,readFile,rm,open,mkdir,symlink,lstat} from 'node:fs/promises'; +import {tmpdir} from 'node:os'; +import {join} from 'node:path'; +import {spawnSync,execFileSync} from 'node:child_process'; +import {runConstellationScenario} from './constellation-scenario.mjs'; +test('catalog planning, satellite quality checks and privacy-aware attach compose end-to-end',async()=>{ + const result=await runConstellationScenario();assert.equal(result.catalogEntries,24);assert.equal(result.published,12);assert.equal(result.scaffoldNoInstall,true); +}); +test('public report command rejects malformed, oversized and nonregular catalog input before network',async()=>{ + const directory=await mkdtemp(join(tmpdir(),'constellation-cli-')),script=new URL('../scripts/constellation-report.mjs',import.meta.url).pathname; + try { + const malformed=join(directory,'bad.json');await writeFile(malformed,'{}'); + assert.notEqual(spawnSync(process.execPath,[script,'--catalog',malformed],{timeout:3000}).status,0); + const oversized=join(directory,'big.json'),file=await open(oversized,'w');await file.truncate(3*1024*1024);await file.close(); + const big=spawnSync(process.execPath,[script,'--catalog',oversized],{timeout:3000,encoding:'utf8'});assert.notEqual(big.status,0);assert.match(big.stderr,/byte limit/); + const fifo=join(directory,'pipe');execFileSync('mkfifo',[fifo]);const nonregular=spawnSync(process.execPath,[script,'--catalog',fifo],{timeout:3000,encoding:'utf8'}); + assert.notEqual(nonregular.status,0);assert.match(nonregular.stderr,/regular file/); + const help=spawnSync(process.execPath,[script,'--help'],{timeout:3000,encoding:'utf8'});assert.equal(help.status,0);assert.match(help.stdout,/no identifiers|no scheduled|no.*upload/i); + } finally {await rm(directory,{recursive:true,force:true});} +}); +test('report output atomically replaces leaf symlinks without overwriting their destinations',async()=>{ + const directory=await mkdtemp(join(tmpdir(),'constellation-output-')),output=join(directory,'report');await mkdir(output); + const preload=join(directory,'public-fixture.mjs'),script=new URL('../scripts/constellation-report.mjs',import.meta.url).pathname; + try { + await writeFile(preload,`globalThis.fetch=async input=>{const u=new URL(String(input));let data;if(u.hostname==='api.npmjs.org'){const parts=u.pathname.split('/');const [start,end]=parts[3].split(':');data={package:decodeURIComponent(parts[4]),start,end,downloads:[]};}else if(u.hostname==='registry.npmjs.org'){data={name:decodeURIComponent(u.pathname.split('/')[1]),version:'0.1.0'};}else if(u.hostname==='api.github.com'){data={full_name:u.pathname.slice('/repos/'.length),stargazers_count:1,open_issues_count:0};}else throw Error('unexpected host');return new Response(JSON.stringify(data));};`); + for(const name of ['report.json','observations.json','dashboard.html']){const sentinel=join(directory,'sentinel-'+name);await writeFile(sentinel,'preserve-me');await symlink(sentinel,join(output,name));} + const child=spawnSync(process.execPath,['--import',preload,script,'--start','2026-10-01','--end','2026-11-10','--output',output],{timeout:10000,encoding:'utf8'}); + assert.equal(child.status,0,child.stderr); + for(const name of ['report.json','observations.json','dashboard.html']){assert.equal(await readFile(join(directory,'sentinel-'+name),'utf8'),'preserve-me');assert.equal((await lstat(join(output,name))).isSymbolicLink(),false);} + }finally{await rm(directory,{recursive:true,force:true});} +}); diff --git a/packages/wsp-toolkit/test/consumer.test.mjs b/packages/wsp-toolkit/test/consumer.test.mjs new file mode 100644 index 000000000..c161a7720 --- /dev/null +++ b/packages/wsp-toolkit/test/consumer.test.mjs @@ -0,0 +1,14 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { verifyPackedConsumer } from '../scripts/packed-consumer.mjs'; +test('all twelve packed packages install, typecheck and run in a fresh consumer', {timeout:60000},async()=>{ + const result=await verifyPackedConsumer(); + assert.equal(result.archives.length,12); + assert.deepEqual(result.results.map(r=>r.backend),['wasm','wasm-simd']); + assert.ok(result.results.every(r=>r.candidateMSE===0 && r.regressionRejected)); + assert.equal(result.evolution.report.promotions,2); + assert.equal(result.constellation.catalogEntries,24);assert.equal(result.constellation.scaffoldTests,3); + assert.equal(result.lightweight.mlStackInstalled,false);assert.equal(result.lightweight.packageCount,2); + assert.equal(result.evolution.durability.rollbackPersisted,true); + assert.ok(result.archives.every(a=>/^[a-f0-9]{64}$/.test(a.sha256))); +}); diff --git a/packages/wsp-toolkit/test/evolution-scenario.mjs b/packages/wsp-toolkit/test/evolution-scenario.mjs new file mode 100644 index 000000000..822f404dc --- /dev/null +++ b/packages/wsp-toolkit/test/evolution-scenario.mjs @@ -0,0 +1,56 @@ +import { join } from 'node:path'; +import { fingerprintModel } from 'ruv-fann-wsp'; +import { createBooleanInvariant } from 'ruv-fann-wsp-invariants'; +import { runEvolutionLoop } from 'ruv-fann-wsp-loop'; +const check=(ok,message)=>{if(!ok)throw new Error(`evolution scenario: ${message}`);}; +export function evolutionModels() { + return {xor:{schema:'ruv-fann.dense-layers/1',layers:[ + {inputs:2,outputs:2,weights:[1,-1,-1,1],bias:[0,0],activation:'ReLU',steepness:1}, + {inputs:2,outputs:1,weights:[0,0],bias:[0],activation:'Linear',steepness:1}]}, + linear:{schema:'ruv-fann.dense-layers/1',layers:[{inputs:1,outputs:1,weights:[0],bias:[0],activation:'Linear',steepness:1}]}}; +} +export function evolutionModules() { + const policy={maxMSE:0,maxRegressionMSE:0,maxAbsoluteError:0}; + return [{id:'xor',development:{dataset:{inputs:[0,1],targets:[1],rows:1},policy}, + holdouts:[{name:'complete-xor',dataset:{inputs:[0,0,0,1,1,0,1,1],targets:[0,1,1,0],rows:4},policy}], + invariants:createBooleanInvariant({inputs:2,outputs:1,targets:[0,1,1,0]}), + strategies:[ + {name:'slice-search',kind:'search',options:{locations:[{layer:1,parameter:'weights',index:1,values:[0,1]}],maxEvaluations:4,maxPasses:1}}, + {name:'bias-shortcut',kind:'search',options:{locations:[{layer:1,parameter:'bias',index:0,values:[0,1]}],maxEvaluations:4,maxPasses:1}}, + {name:'symbolic-repair',kind:'patch',edits:[0,1].map(index=>({layer:1,parameter:'weights',index,value:1}))} + ]}, + {id:'linear',development:{dataset:{inputs:[1],targets:[2],rows:1},policy}, + holdouts:[{name:'independent-linear',dataset:{inputs:[0,2,3],targets:[0,4,6],rows:3},policy}], + invariants:{schema:'ruv-fann.invariants/1',cases:[{name:'operating-cases',inputs:[0,2,3],rows:3,minimum:[0],maximum:[6],expected:[0,4,6]}]}, + strategies:[ + {name:'weight-search',kind:'search',options:{locations:[{layer:0,parameter:'weights',index:0,values:[0,1,2]}],maxEvaluations:4,maxPasses:1}}, + {name:'bias-shortcut',kind:'search',options:{locations:[{layer:0,parameter:'bias',index:0,values:[0,2]}],maxEvaluations:4,maxPasses:1}} + ]}]; +} +export async function runEvolutionScenario(openRegistry,directory) { + const filename=join(directory,'evolution.sqlite'),models=evolutionModels(); + let registry=await openRegistry(filename); + try { + await registry.create('xor',models.xor);await registry.create('linear',models.linear); + const originalHashes=Object.fromEntries(await Promise.all(Object.entries(models).map(async([id,model])=>[id,await fingerprintModel(model)]))); + const report=await runEvolutionLoop({registry,modules:evolutionModules(),maxRounds:3,maxProposals:12,maxWork:100000,concurrency:3,jobTimeoutMs:5000,maxDurationMs:30000,simd:false}); + check(report.stopReason==='goals-met'&&report.promotions===2,'two independent improvements'); + check(report.workerThreadIds.length>=2,'actual concurrent worker execution'); + check(report.events.filter(e=>e.type==='rejected'&&e.reason==='regression-gate').length>=3,'independent holdouts reject development shortcuts'); + check(report.events.filter(e=>e.type==='validated').every(e=>e.invariantSuiteHash?.length===64),'invariants bind validation'); + const promoted=await Promise.all(['xor','linear'].map(id=>registry.get(id))); + check(promoted.every(p=>p.revision===2),'each module promoted exactly once'); + await registry.close();registry=await openRegistry(filename); + const reopened=await Promise.all(['xor','linear'].map(id=>registry.get(id))); + check(reopened.every((p,i)=>p.revision===2&&p.hash===promoted[i].hash),'durable restart resumes exact checkpoints'); + const rollback=[]; + for(const id of ['xor','linear']) { + const restored=await registry.rollback(id,1,2); + check(restored.revision===3&&restored.hash===originalHashes[id],'monotonic exact rollback'); + rollback.push({id,revision:restored.revision,hash:restored.hash,historyEntries:restored.history.length}); + } + await registry.close();registry=await openRegistry(filename); + check((await registry.get('xor')).revision===3,'rollback persists across another restart'); + return {schema:'ruv-fann.evolution-demo/1',report,durability:{reopened:true,rollbackPersisted:true},rollback}; + } finally {await registry.close();} +} diff --git a/packages/wsp-toolkit/test/integration.test.mjs b/packages/wsp-toolkit/test/integration.test.mjs new file mode 100644 index 000000000..c8ae005c9 --- /dev/null +++ b/packages/wsp-toolkit/test/integration.test.mjs @@ -0,0 +1,35 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { mkdtemp, writeFile, rm } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { execFileSync, spawnSync } from 'node:child_process'; +import { fingerprintModel } from 'ruv-fann-wsp'; +import { runScenario, xorModel, xorData, strictPolicy } from './scenario.mjs'; +for (const simd of [false,true]) test(`complete platform-neutral WSP scenario with real WASM simd=${simd}`,async()=>{ + const result=await runScenario(simd); + assert.equal(result.backend,simd?'wasm-simd':'wasm'); + assert.equal(result.baselineMSE,0.5); + assert.equal(result.candidateMSE,0); +}); +test('checkpoint CLI returns distinct acceptance, rejection and malformed statuses', async()=>{ + const directory=await mkdtemp(join(tmpdir(),'wsp-gate-')); + try { + const model=xorModel(), baseHash=await fingerprintModel(model); + const bundle={model,patch:{schema:'ruv-fann.weight-patch/1',baseHash,edits:[0,1].map(index=>({layer:1,parameter:'weights',index,value:1}))},suites:[{name:'xor',dataset:xorData(),policy:strictPolicy()}]}; + const file=join(directory,'gate.json'), cli=new URL('../packages/lifecycle/src/cli.js',import.meta.url); + await writeFile(file,JSON.stringify(bundle)); + const accepted=JSON.parse(execFileSync(process.execPath,[cli.pathname,file],{encoding:'utf8'})); + assert.equal(accepted.accepted,true); + bundle.patch.edits[1].value=0; + await writeFile(file,JSON.stringify(bundle)); + const rejected=spawnSync(process.execPath,[cli.pathname,file],{encoding:'utf8'}); + assert.equal(rejected.status,1);assert.equal(JSON.parse(rejected.stdout).accepted,false); + const fifo=join(directory,'pipe'); + execFileSync('mkfifo',[fifo]); + const nonregular=spawnSync(process.execPath,[cli.pathname,fifo],{timeout:2000,encoding:'utf8'}); + assert.equal(nonregular.status,2);assert.match(nonregular.stderr,/regular file/); + await writeFile(file,'{'); + assert.equal(spawnSync(process.execPath,[cli.pathname,file]).status,2); + } finally { await rm(directory,{recursive:true,force:true}); } +}); diff --git a/packages/wsp-toolkit/test/scenario.mjs b/packages/wsp-toolkit/test/scenario.mjs new file mode 100644 index 000000000..20ed6cf0b --- /dev/null +++ b/packages/wsp-toolkit/test/scenario.mjs @@ -0,0 +1,53 @@ +import { createWeightWorkspace, traceWeightModel, analyzeWeightSensitivity, createNeuronAblationPatch, applyWeightPatch } from 'ruv-fann-wsp'; +import { runRegressionGate, evaluatePatchBranches } from 'ruv-fann-wsp-lifecycle'; +import { searchWeightPatch, compileBooleanTable, createHebbianPatch } from 'ruv-fann-wsp-search'; +import { loadHubModel } from 'ruv-fann-wsp-huggingface'; +import { runWasmCanary } from 'ruv-fann-wsp-ruos'; +export const xorModel = () => ({ schema: 'ruv-fann.dense-layers/1', layers: [ + {inputs:2,outputs:2,weights:[1,-1,-1,1],bias:[0,0],activation:'ReLU',steepness:1}, + {inputs:2,outputs:1,weights:[0,0],bias:[0],activation:'Linear',steepness:1} +] }); +export const xorData = () => ({inputs:[0,0,0,1,1,0,1,1],targets:[0,1,1,0],rows:4}); +export const strictPolicy = () => ({maxMSE:0,maxRegressionMSE:0,maxAbsoluteError:0}); +const check = (ok, message) => { if (!ok) throw new Error(message); }; +export async function runScenario(simd=false) { + const model=xorModel(), data=xorData(), policy=strictPolicy(); + const search=await searchWeightPatch(model,data,policy,{simd,locations:[0,1].map(index=>({layer:1,parameter:'weights',index,values:[0,1]})),maxEvaluations:8,maxPasses:2}); + check(search.evaluation?.accepted && search.evaluation.candidate.mse===0,'search must repair XOR'); + check(search.patch.edits.length===2,'two surgical weight edits'); + const gate=await runRegressionGate({model,patch:search.patch,suites:[{name:'exhaustive-xor',dataset:data,policy}]},{simd}); + check(gate.accepted,'gate acceptance'); + const workspace=await createWeightWorkspace(model,{simd}); + const proposal=await workspace.propose(search.patch,data,policy); + const repaired=workspace.promote(proposal.id,1); + const trace=await traceWeightModel(repaired.model,{inputs:data.inputs,rows:data.rows},{simd}); + check(trace.layers[1].activations.every((x,i)=>x===data.targets[i]),'independent XOR oracle'); + const sensitivity=await analyzeWeightSensitivity(repaired.model,data,[{layer:1,parameter:'weights',index:0}],{epsilon:0.001,simd}); + check(Math.abs(sensitivity.entries[0].derivative)<1e-12,'optimum sensitivity'); + const ablation=await createNeuronAblationPatch(repaired.model,0,0); + const rejected=await workspace.propose(ablation,data,policy); + check(!rejected.evaluation.accepted,'ablation regression rejected'); + let denied=false; try {workspace.promote(rejected.id,2);} catch {denied=true;} + check(denied && workspace.snapshot().hash===repaired.hash,'rejection preserves live state'); + const branches=await evaluatePatchBranches(repaired.model,[ablation,{...ablation,edits:ablation.edits.map(e=>({...e,value:1}))}],data,policy,{simd}); + check(!branches.branches[0].evaluation.accepted && branches.branches[1].evaluation.accepted,'forks isolated'); + const hebbian=await createHebbianPatch(repaired.model,{inputs:data.inputs,rows:data.rows},{layer:1,indices:[0],learningRate:0.1,simd,limits:{maxAbsDelta:0.01}}); + const proposedPlasticity=await applyWeightPatch(repaired.model,hebbian,{maxAbsDelta:0.01}); + check(Math.abs(proposedPlasticity.layers[1].weights[0]-1)<=0.0100000001,'bounded plasticity proposal'); + check(workspace.snapshot().hash===repaired.hash,'plasticity does not promote'); + const table=compileBooleanTable({inputs:2,outputs:1,targets:data.targets}); + const compiled=await traceWeightModel(table,{inputs:data.inputs,rows:4},{simd}); + check(compiled.layers.at(-1).activations.every((v,i)=>v===data.targets[i]),'truth table compiler oracle'); + const bytes=new TextEncoder().encode(JSON.stringify(repaired.model)); + const digest=Array.from(new Uint8Array(await crypto.subtle.digest('SHA-256',bytes)),x=>x.toString(16).padStart(2,'0')).join(''); + const loaded=await loadHubModel({repo:'fixture/xor',revision:'a'.repeat(40),path:'xor.json',sha256:digest},{fetch:async()=>new Response(bytes)}); + check(loaded.inspection.baseHash===repaired.hash,'Hub contract fixture fingerprint'); + const rolled=workspace.rollback(1,2); + check(rolled.revision===3 && rolled.hash===search.baseHash,'rollback exact'); + const canary=await runWasmCanary(); + check(canary.restoredHash===rolled.hash,'platform canary agrees'); + return {schema:'ruv-fann.toolkit-e2e/1',backend:trace.backend,baseHash:search.baseHash,candidateHash:repaired.hash, + baselineMSE:search.evaluation.baseline.mse,candidateMSE:0,gateAccepted:true,regressionRejected:true, + rollbackRevision:rolled.revision,compiledXor:true,plasticityBounded:true,hubFixtureVerified:true, + searchEvaluations:search.evaluations,searchInferencePasses:search.inferencePasses}; +} diff --git a/packages/wsp-toolkit/test/types.ts b/packages/wsp-toolkit/test/types.ts new file mode 100644 index 000000000..951371dd2 --- /dev/null +++ b/packages/wsp-toolkit/test/types.ts @@ -0,0 +1,41 @@ +import { CONTRACTS, validateCatalog, validateModuleManifest } from 'ruvnet-constellation-contracts'; +import { readCatalog, planProfile, scaffoldSatellite } from 'ruvnet-constellation'; +import { collectPublicMetrics, analyzeConstellation, renderConstellationDashboard } from 'ruvnet-constellation-telemetry'; +import { fingerprintModel, type DenseModel } from 'ruv-fann-wsp'; +import { runRegressionGate, evaluatePatchBranches } from 'ruv-fann-wsp-lifecycle'; +import { searchWeightPatch, compileBooleanTable, createHebbianPatch } from 'ruv-fann-wsp-search'; +import { loadHubModel } from 'ruv-fann-wsp-huggingface'; +import { createWorkerHandler } from 'ruv-fann-wsp-cloudflare'; +import { checkModelInvariants, createBooleanInvariant, estimateInvariantWork } from 'ruv-fann-wsp-invariants'; +import { runProposalSwarm, estimateSwarmWork } from 'ruv-fann-wsp-swarm'; +import { createAgentDBRegistry, type WeightProgramsCapability } from 'ruv-fann-wsp-registry'; +import { runEvolutionLoop } from 'ruv-fann-wsp-loop'; +import { createValidationCommand, assertRuOSCompletion, runWasmCanary } from 'ruv-fann-wsp-ruos'; +async function consumer() { + const model: DenseModel=compileBooleanTable({inputs:2,outputs:1,targets:[0,1,1,0]}); + const baseHash=await fingerprintModel(model), patch={schema:'ruv-fann.weight-patch/1' as const,baseHash,edits:[{layer:1,parameter:'weights' as const,index:0,value:0}]}; + const dataset={inputs:[0,0,0,1,1,0,1,1],targets:[0,1,1,0],rows:4}; + const policy={maxMSE:0,maxRegressionMSE:0}; + const gate=await runRegressionGate({model,patch,suites:[{name:'xor',dataset,policy}]}); + const forks=await evaluatePatchBranches(model,[patch],dataset,policy); + const search=await searchWeightPatch(model,dataset,policy,{locations:[{layer:1,parameter:'weights',index:0,values:[0,1]}]}); + const correlation=await createHebbianPatch(model,{inputs:dataset.inputs,rows:4},{layer:0,indices:[0],learningRate:0.1}); + const hub=await loadHubModel({repo:'example/model',revision:'a'.repeat(40),path:'model.json',sha256:'a'.repeat(64)}); + const response: Response=await createWorkerHandler().fetch(new Request('https://example.test/health')); + const command: string=createValidationCommand('/work/toolkit'); + const completion=assertRuOSCompletion({structuredContent:{}},'observed-id'); + const canary=await runWasmCanary(); + const invariants=createBooleanInvariant({inputs:2,outputs:1,targets:[0,1,1,0]}); + const guard=await checkModelInvariants(model,invariants), invariantWork=estimateInvariantWork(model,invariants); + const jobs=[{id:'candidate',kind:'patch' as const,patch}]; + const workerWork=estimateSwarmWork(jobs), proposals=await runProposalSwarm(jobs,{concurrency:2}); + const registry=createAgentDBRegistry({} as WeightProgramsCapability); + const evolution=await runEvolutionLoop({registry,modules:[{id:'xor',development:{dataset,policy},holdouts:[{name:'heldout',dataset,policy}],invariants,strategies:[{name:'patch',kind:'patch',edits:patch.edits}]}]}); + const catalog=validateCatalog(await readCatalog()), plan=planProfile(catalog,'weights'); + const module=validateModuleManifest({schema:CONTRACTS.module,name:'candidate',version:'0.1.0',role:'satellite',contracts:[CONTRACTS.patch],integrations:['ruv-fann-wsp']}); + const scaffold=await scaffoldSatellite({directory:'/tmp/explicit-new-candidate',name:module.name}); + const observations=await collectPublicMetrics(catalog,{start:'2026-10-01',end:'2026-10-31'}); + const report=analyzeConstellation(catalog,observations);const html:string=renderConstellationDashboard(report); + return {gate,forks,search,correlation,hub,response,command,completion,canary,guard,invariantWork,workerWork,proposals,evolution,plan,scaffold,html}; +} +void consumer; diff --git a/packages/wsp-toolkit/tooling/agentdb/.npmrc b/packages/wsp-toolkit/tooling/agentdb/.npmrc new file mode 100644 index 000000000..0933ed75c --- /dev/null +++ b/packages/wsp-toolkit/tooling/agentdb/.npmrc @@ -0,0 +1,2 @@ +omit=optional +ignore-scripts=true diff --git a/packages/wsp-toolkit/tooling/agentdb/README.md b/packages/wsp-toolkit/tooling/agentdb/README.md new file mode 100644 index 000000000..c96d17fc6 --- /dev/null +++ b/packages/wsp-toolkit/tooling/agentdb/README.md @@ -0,0 +1,12 @@ +# AgentDB integration runtime + +This private fixture pins real `agentdb@3.10.0` and omits its optional native, model and telemetry dependencies. It uses AgentDB's published `WeightPrograms` and `db-fallback` modules, including the actual `sql.js` persistence path. No code is vendored or substituted. AgentDB retains its declared `ruv-fann-wsp@0.1.0` internally; the toolkit coordinator independently evaluates with its exact `ruv-fann-wsp@0.2.0` API. + +```sh +npm ci --prefix tooling/agentdb --ignore-scripts --omit=optional --no-audit --no-fund +npm audit --prefix tooling/agentdb +``` + +`openDemoRegistry(filename, registryFactory?)` opens a serialized registry and flushes each acknowledged mutation. The optional factory is a trusted adapter constructor for installed-package consumer tests; it defaults to this workspace registry. It never installs dependencies or changes process-wide environment. Tests fail with a setup instruction when the fixture is absent. The demo path uses one registry owner for a file; independent `sql.js` file writers are detected by AgentDB's optimistic persistence check, not coordinated as a distributed database. + +A failed flush marks the adapter poisoned and blocks further state reads or mutations. Cleanup never rewrites `sql.js` files because all acknowledged mutations were already flushed; after poison it discards unflushed memory instead of retrying save automatically. A failed filesystem acknowledgement can still have reached disk; reopen and inspect rather than assuming the mutation was absent or retrying it automatically. This fixture supplies no server or remote connection. diff --git a/packages/wsp-toolkit/tooling/agentdb/package-lock.json b/packages/wsp-toolkit/tooling/agentdb/package-lock.json new file mode 100644 index 000000000..c6a7f0073 --- /dev/null +++ b/packages/wsp-toolkit/tooling/agentdb/package-lock.json @@ -0,0 +1,6736 @@ +{ + "name": "wsp-agentdb-integration-runtime", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "wsp-agentdb-integration-runtime", + "version": "0.1.0", + "dependencies": { + "agentdb": "3.10.0" + }, + "engines": { + "node": ">=20.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.29.13", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.13.tgz", + "integrity": "sha512-fWegr+WsEsiMVW4KUNdIIzzMTZSzNiqhy0//6+2MRi2d5NFNsL/AYwBQW8eBnRbTBVRnDVzjaJEUqKaCWjMMdQ==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.13", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.13.tgz", + "integrity": "sha512-fJM50YYjlTiBhgdkGmC1tBpv+FMAyo4annf2X6Aks+0yRlaiVkYW/3f07xAfVVkYIoZ9fFZp+mEThUFnuybhkQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "@babel/types": "^7.29.11" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.11", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.11.tgz", + "integrity": "sha512-WCsemW40Cpc6gouC1SrY6PBaZ+oLRlEVY9XBvZBI7il/HyUrb2nJ505wE1MHEFyDZNnrWDEuy4jL50WVHfTTSQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "@babel/helper-string-parser": "^7.29.11", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@colors/colors": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.6.1.tgz", + "integrity": "sha512-dTmUJzXSuayBK+hZydEaXd2mhx61qWQwkwaBBY6LyEOVx/L9aQU5ac8eFNEsd9nrD1+zb9zvDCphLSe8g1F4Qw==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/@dabh/diagnostics": { + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.9.tgz", + "integrity": "sha512-R6siwR65Hm+3yfgP7o8DKhNvputQAwfoz9zTc3kyDudnomj2/BcLmD+uGQQPICjuFUp8ounPBU+jmKsocwVVAg==", + "license": "MIT", + "optional": true, + "dependencies": { + "@so-ric/colorspace": "^1.1.6", + "enabled": "2.0.x", + "kuler": "^2.0.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz", + "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@epic-web/invariant": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@epic-web/invariant/-/invariant-1.0.0.tgz", + "integrity": "sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA==", + "license": "MIT", + "optional": true + }, + "node_modules/@grpc/grpc-js": { + "version": "1.14.7", + "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.14.7.tgz", + "integrity": "sha512-W4W/fcBMGRVtG6dW2c7cw2mnpS3hvbBd+oQXjh2iYFTZDk1JJmcNqkM5KSaPubQpamlUUurrlb7G1s9NJeERmQ==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@grpc/proto-loader": "^0.8.0", + "@js-sdsl/ordered-map": "^4.4.2" + }, + "engines": { + "node": ">=12.10.0" + } + }, + "node_modules/@grpc/proto-loader": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.8.1.tgz", + "integrity": "sha512-wtF6h+DY6M3YaDBPAmvuuA6jV8Sif9MjtOI5euKFWRgCDl5PeDpPsHR9u2l6St5ceY8AZgoNDww5+HvEsXFsGg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "lodash.camelcase": "^4.3.0", + "long": "^5.0.0", + "protobufjs": "^7.5.5", + "yargs": "^17.7.2" + }, + "bin": { + "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@hono/node-server": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.6.tgz", + "integrity": "sha512-p/KH9MnfNcsm3sR6x4lNgm5j+QN4Et8srKredl9DZfXiyZ1UQ3aQ2YVpFLbqktYN5JI+DB+VZFKM2PqE5hLKjQ==", + "license": "MIT", + "engines": { + "node": ">=20" + }, + "peerDependencies": { + "hono": "^4 || ^5.0.0-0" + } + }, + "node_modules/@huggingface/jinja": { + "version": "0.5.12", + "resolved": "https://registry.npmjs.org/@huggingface/jinja/-/jinja-0.5.12.tgz", + "integrity": "sha512-o0aIdtHrSBmNgUC3zVHSRBReUZO87679tK9sQztp683pu6cbidcWnHivJYChYf/aDpGdlwxbTfs4pRQ1MhBGkQ==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@huggingface/tokenizers": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@huggingface/tokenizers/-/tokenizers-0.2.0.tgz", + "integrity": "sha512-LidMHe1FpcSYH4vcSjXooda34pC0M8m1gmDOv7SQi6Iv+ib1zX7J3sHBCC9/3FPCkn2k1b55FneVqMRxrr99pg==", + "license": "Apache-2.0", + "optional": true + }, + "node_modules/@huggingface/transformers": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/@huggingface/transformers/-/transformers-4.3.2.tgz", + "integrity": "sha512-V3+dqf3iWlRYJ9I9GreM3zGQd0lAXnnoPeddmkOQYWAEE4l/+Fi6p7tx/qVUJlKQgLXGim2W76rTOzz+eC0i7g==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@huggingface/jinja": "^0.5.10", + "@huggingface/tokenizers": "^0.2.0", + "onnxruntime-node": "1.30.0", + "onnxruntime-web": "1.31.0-dev.20260914-8d85527a0", + "sharp": "^0.35.4" + } + }, + "node_modules/@img/colour": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz", + "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.5.tgz", + "integrity": "sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.5.tgz", + "integrity": "sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-freebsd-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.5.tgz", + "integrity": "sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw==", + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "dependencies": { + "@img/sharp-wasm32": "0.35.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.4.tgz", + "integrity": "sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.4.tgz", + "integrity": "sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.4.tgz", + "integrity": "sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw==", + "cpu": [ + "arm" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.4.tgz", + "integrity": "sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-ppc64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.4.tgz", + "integrity": "sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ==", + "cpu": [ + "ppc64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-riscv64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.4.tgz", + "integrity": "sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q==", + "cpu": [ + "riscv64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.4.tgz", + "integrity": "sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ==", + "cpu": [ + "s390x" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.4.tgz", + "integrity": "sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.4.tgz", + "integrity": "sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.4.tgz", + "integrity": "sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.5.tgz", + "integrity": "sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==", + "cpu": [ + "arm" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.5.tgz", + "integrity": "sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-ppc64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.5.tgz", + "integrity": "sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==", + "cpu": [ + "ppc64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-ppc64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-riscv64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.5.tgz", + "integrity": "sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==", + "cpu": [ + "riscv64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-riscv64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.5.tgz", + "integrity": "sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==", + "cpu": [ + "s390x" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.5.tgz", + "integrity": "sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.5.tgz", + "integrity": "sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.5.tgz", + "integrity": "sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.5.tgz", + "integrity": "sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==", + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.11.3" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-webcontainers-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.5.tgz", + "integrity": "sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA==", + "cpu": [ + "wasm32" + ], + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@img/sharp-wasm32": "0.35.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.5.tgz", + "integrity": "sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.5.tgz", + "integrity": "sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A==", + "cpu": [ + "ia32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.5.tgz", + "integrity": "sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@inquirer/external-editor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@inquirer/external-editor/-/external-editor-1.0.3.tgz", + "integrity": "sha512-RWbSrDiYmO4LbejWY7ttpxczuwQyZLBUyygsA9Nsv95hpzUWwnNTVQmAq3xuh7vNwCp07UTmE5i11XAEExx4RA==", + "license": "MIT", + "optional": true, + "dependencies": { + "chardet": "^2.1.1", + "iconv-lite": "^0.7.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@types/node": ">=18" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@inquirer/figures": { + "version": "1.0.15", + "resolved": "https://registry.npmjs.org/@inquirer/figures/-/figures-1.0.15.tgz", + "integrity": "sha512-t2IEY+unGHOzAaVM5Xx6DEWKeXlDDcNPeDyUpsRc6CUhBfU3VQOEl+Vssh7VNp1dR8MdUJBWhuObjXCsVpjN5g==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@js-sdsl/ordered-map": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz", + "integrity": "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==", + "license": "MIT", + "optional": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" + } + }, + "node_modules/@metaharness/avo": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@metaharness/avo/-/avo-0.2.1.tgz", + "integrity": "sha512-sKGecb3MTd9MsFgli086KBfSLFWJ8JauxPxGJ4PjPJqgNZJYgGkIjjRU1tAfSbrNfcUZcsbhCUcgXy2AUcBedw==", + "license": "MIT", + "optional": true, + "dependencies": { + "@metaharness/horizon": "^0.2.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "agenticow": "^0.2.3" + }, + "peerDependenciesMeta": { + "agenticow": { + "optional": true + } + } + }, + "node_modules/@metaharness/darwin": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@metaharness/darwin/-/darwin-0.13.1.tgz", + "integrity": "sha512-PrKFLMblkmMs55KlcWq/n2rO0Rfq8qPbR/Vo0Zui/KjYu1yEuMbdH2ZoMdi9733ZkLk7eo8qc3lIGD2/Lyof8Q==", + "license": "MIT", + "optional": true, + "dependencies": { + "@babel/parser": "^7.29.13" + }, + "bin": { + "metaharness-darwin": "dist/cli.js" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@metaharness/flywheel": { + "version": "0.1.14", + "resolved": "https://registry.npmjs.org/@metaharness/flywheel/-/flywheel-0.1.14.tgz", + "integrity": "sha512-eeEvDLPFV/nUo9oC7NFqUaoomQ00OmUGPgFV1k+LOpi4+G7r8MtXa92aU4t+aj/jIl3TMYipultX1Twyc1zGUg==", + "license": "MIT", + "optional": true + }, + "node_modules/@metaharness/harness": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@metaharness/harness/-/harness-0.2.1.tgz", + "integrity": "sha512-ZkLfuQAltG0RkBd0NHqI5bLCSoIXAOmXRcCXPo46WEwNEqcw5sz2McZo6b9Tg2L4CD+4mQSsrWW9gm16hVAswQ==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@metaharness/horizon": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@metaharness/horizon/-/horizon-0.2.2.tgz", + "integrity": "sha512-Hqex5VK0oruaSv+l/ITSnqmMW/PfIffyXXjnRmukfh8Nq4P29PQD+tbjfCSczUlqiHJiuJyFvU5RH2Mofvn0Jg==", + "license": "Apache-2.0", + "optional": true + }, + "node_modules/@metaharness/redblue": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/@metaharness/redblue/-/redblue-0.1.7.tgz", + "integrity": "sha512-+SpFuMUpDJf1DIs08kiBB5QzMJLppzhe7lzTE7Ma7cdc9NBMbyHNHpShLeHDFZqyNBsKxEEDKjiKWATilj2zAA==", + "license": "MIT", + "optional": true, + "bin": { + "metaharness-redblue": "dist/cli/index.js", + "redblue": "dist/cli/index.js" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@metaharness/router": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@metaharness/router/-/router-0.4.1.tgz", + "integrity": "sha512-fs3vUcCcw9fJwHeEpaA3EDV+37XpDcWPDzgkz1mrH5q18ssKvYEFDS4kn5JBfyFFJDRd2wMLP37dUBWc6ThICw==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "@ruvector/tiny-dancer": "^0.1.21" + }, + "peerDependenciesMeta": { + "@ruvector/tiny-dancer": { + "optional": true + } + } + }, + "node_modules/@metaharness/turn-credit": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@metaharness/turn-credit/-/turn-credit-0.1.1.tgz", + "integrity": "sha512-mWz5HA+WiYx7N5a9W1XtWpSICC7QjRgKqw7dik2EqqZjbO7tgTUkQxwdetldSbm5Or4Bp0WfB8Hw5IRkS9Wpzw==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@metaharness/weight-eft": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@metaharness/weight-eft/-/weight-eft-0.1.3.tgz", + "integrity": "sha512-iatfTuDOgiAx1rhZlc6ez5IEXV9PSXWP0+r5mDJrpkNRKmYeCKt3tubBf14nbx2R6/vUKho+QmlCI+89RrG7sQ==", + "license": "MIT", + "optional": true, + "bin": { + "weight-eft": "dist/cli.js" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@metaharness/workspace-lens": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@metaharness/workspace-lens/-/workspace-lens-0.1.3.tgz", + "integrity": "sha512-z9TcDY9LI7TvqUuT48Ww6pgaIZQxW6r85KIJpH9Tcre6NaCppmWDvlVbLyKVwuacydJKjcqYEMDA2eu1faVm5Q==", + "license": "MIT", + "optional": true + }, + "node_modules/@metaharness/workspace-probe": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@metaharness/workspace-probe/-/workspace-probe-0.1.2.tgz", + "integrity": "sha512-VePs84ZfrgeWoezrlGr+LwJZlOc2klzsYEl1MKWXjN0JuvaAO/m71/y7dcGgSi1Nhn46fsLk36hPzGfkqudayQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "@metaharness/workspace-lens": "^0.1.0" + }, + "bin": { + "workspace-probe": "bin/workspace-probe.mjs" + } + }, + "node_modules/@modelcontextprotocol/sdk": { + "version": "1.32.2", + "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.32.2.tgz", + "integrity": "sha512-SWsVtH/0vULSQStoZ6xxH2K09Li8fXYTMC64ZeogCdpZ3XSi1eCPOByV1OpuJxuI3OcmHhosDWYyii07tpPsLw==", + "license": "MIT", + "dependencies": { + "@hono/node-server": "^1.19.9 || ^2.0.5", + "ajv": "^8.17.1", + "ajv-formats": "^3.0.1", + "content-type": "^1.0.5", + "cors": "^2.8.5", + "cross-spawn": "^7.0.5", + "eventsource": "^3.0.2", + "eventsource-parser": "^3.0.0", + "express": "^5.2.1", + "express-rate-limit": "^8.2.1", + "hono": "^4.11.4", + "jose": "^6.1.3", + "json-schema-typed": "^8.0.2", + "pkce-challenge": "^5.0.0", + "raw-body": "^3.0.0", + "zod": "^3.25 || ^4.0", + "zod-to-json-schema": "^3.25.1" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@cfworker/json-schema": "^4.1.1", + "zod": "^3.25 || ^4.0" + }, + "peerDependenciesMeta": { + "@cfworker/json-schema": { + "optional": true + }, + "zod": { + "optional": false + } + } + }, + "node_modules/@opentelemetry/api": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.1.tgz", + "integrity": "sha512-gLyJlPHPZYdAk1JENA9LeHejZe1Ti77/pTeFm/nMXmQH/HFZlcS/O2XJB+L8fkbrNSqhdtlvjBVjxwUYanNH5Q==", + "license": "Apache-2.0", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@opentelemetry/api-logs": { + "version": "0.220.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.220.0.tgz", + "integrity": "sha512-CmVa4ImJ+ynfrPMNaAXHET6Bhb44SwzmfyVJFq9ni2jgXJR/l7C6gfVFddNmHP+ZOkP9cf4f9DBe68qVLTHc9w==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/api": "^1.3.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@opentelemetry/configuration": { + "version": "0.220.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/configuration/-/configuration-0.220.0.tgz", + "integrity": "sha512-glfIVKnZevRin8fY/9uES/mhRtMT1lGINLHc9MIo5fTQZXswEEHamJtgjv4MTtzgnhHGC92mIS/0lzAUZMyE0w==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "yaml": "^2.8.3" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.9.0" + } + }, + "node_modules/@opentelemetry/configuration/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/context-async-hooks": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/context-async-hooks/-/context-async-hooks-2.9.0.tgz", + "integrity": "sha512-OQ0vzvbZBiUhjqLnUaoNfYmP8553Crr3aggB4y0ZUi815mZ7idpdJXQmoKdeBKJelYttoBlLSSHubmyw3wvX4w==", + "license": "Apache-2.0", + "optional": true, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/core": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.12.1.tgz", + "integrity": "sha512-3hr6Pj0/G0oVgIGb97IVcw9BjZ6eudonKjrmQxw7JquyU/XmVbJelkmyoU0sT/OvHGkv+r1tcrwv8MbSX7aKHw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/exporter-logs-otlp-grpc": { + "version": "0.220.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-logs-otlp-grpc/-/exporter-logs-otlp-grpc-0.220.0.tgz", + "integrity": "sha512-s0sRPCSlXYqlgObOpCftomJllp3LfUL9FobQ5csg2172ydVhSEnu1ptpsVBJadazs5nUNp7vDuLE03FAFWTLOQ==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@grpc/grpc-js": "^1.14.3", + "@opentelemetry/core": "2.9.0", + "@opentelemetry/otlp-exporter-base": "0.220.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.220.0", + "@opentelemetry/otlp-transformer": "0.220.0", + "@opentelemetry/sdk-logs": "0.220.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/exporter-logs-otlp-grpc/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/exporter-logs-otlp-http": { + "version": "0.220.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-logs-otlp-http/-/exporter-logs-otlp-http-0.220.0.tgz", + "integrity": "sha512-8186thl+pTw64iz/qEEen5oJZoZ/gO73XruChdaGlYdWOdBIQ42r+vHLf6a7vIDqTD4b8ZOoMlyxptanECaI9A==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/api-logs": "0.220.0", + "@opentelemetry/core": "2.9.0", + "@opentelemetry/otlp-exporter-base": "0.220.0", + "@opentelemetry/otlp-transformer": "0.220.0", + "@opentelemetry/sdk-logs": "0.220.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/exporter-logs-otlp-http/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/exporter-logs-otlp-proto": { + "version": "0.220.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-logs-otlp-proto/-/exporter-logs-otlp-proto-0.220.0.tgz", + "integrity": "sha512-8LZAxdJ0ENDAFwr4j0oY35mHBltiSzvlhdQAPGiC7p9VnxtuSq4SW1gfBAdW6t6hiQG6OwUl8w7KHaOdJPKHWg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/otlp-exporter-base": "0.220.0", + "@opentelemetry/otlp-transformer": "0.220.0", + "@opentelemetry/sdk-logs": "0.220.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/exporter-metrics-otlp-grpc": { + "version": "0.220.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-metrics-otlp-grpc/-/exporter-metrics-otlp-grpc-0.220.0.tgz", + "integrity": "sha512-U128izvJfX/dW9jRGP0gIfadR1Hg7ft3UEGIeRxLFK70m2BWw6AtNCOnsUygpw2zCgR/ygdWbGpcL6TmhW0ZGw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@grpc/grpc-js": "^1.14.3", + "@opentelemetry/core": "2.9.0", + "@opentelemetry/exporter-metrics-otlp-http": "0.220.0", + "@opentelemetry/otlp-exporter-base": "0.220.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.220.0", + "@opentelemetry/otlp-transformer": "0.220.0", + "@opentelemetry/resources": "2.9.0", + "@opentelemetry/sdk-metrics": "2.9.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/exporter-metrics-otlp-grpc/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/exporter-metrics-otlp-grpc/node_modules/@opentelemetry/resources": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-2.9.0.tgz", + "integrity": "sha512-jyA5MBLQ+Dkl3+JsZkUoUvL7yHvU64kLsvpXKarWm6347Sl1t1bXFTFykUePNpT5WH5pm9a2Qtt03iIYQhZ1Fg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/exporter-metrics-otlp-http": { + "version": "0.220.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-metrics-otlp-http/-/exporter-metrics-otlp-http-0.220.0.tgz", + "integrity": "sha512-Yqt3RBw/bRVncaE9qIIhk4WfjbAQqXuP9FgAaU+IKPndnLEp/cUqZlSC324+bpmduRz7DoTjig8Ub0PeILWXUA==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/otlp-exporter-base": "0.220.0", + "@opentelemetry/otlp-transformer": "0.220.0", + "@opentelemetry/resources": "2.9.0", + "@opentelemetry/sdk-metrics": "2.9.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/exporter-metrics-otlp-http/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/exporter-metrics-otlp-http/node_modules/@opentelemetry/resources": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-2.9.0.tgz", + "integrity": "sha512-jyA5MBLQ+Dkl3+JsZkUoUvL7yHvU64kLsvpXKarWm6347Sl1t1bXFTFykUePNpT5WH5pm9a2Qtt03iIYQhZ1Fg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/exporter-metrics-otlp-proto": { + "version": "0.220.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-metrics-otlp-proto/-/exporter-metrics-otlp-proto-0.220.0.tgz", + "integrity": "sha512-lyO+IQBdSvqHN/ZOW/OzrSWemtfD+HgWngn+HBNLhjy0YrCQQTz0OE/kSekH2Pl340dn9DWzhqHdz5Eftr+HLA==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/exporter-metrics-otlp-http": "0.220.0", + "@opentelemetry/otlp-exporter-base": "0.220.0", + "@opentelemetry/otlp-transformer": "0.220.0", + "@opentelemetry/resources": "2.9.0", + "@opentelemetry/sdk-metrics": "2.9.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/exporter-metrics-otlp-proto/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/exporter-metrics-otlp-proto/node_modules/@opentelemetry/resources": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-2.9.0.tgz", + "integrity": "sha512-jyA5MBLQ+Dkl3+JsZkUoUvL7yHvU64kLsvpXKarWm6347Sl1t1bXFTFykUePNpT5WH5pm9a2Qtt03iIYQhZ1Fg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/exporter-prometheus": { + "version": "0.220.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-prometheus/-/exporter-prometheus-0.220.0.tgz", + "integrity": "sha512-JZD5DL/NBpVd2BHefvYosm3G40UZ/KzExLv5tc0eZe0CtrsHHtcOk3YPUxR2EINmUeBf8+w5UReTV8fFPn95lA==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/resources": "2.9.0", + "@opentelemetry/sdk-metrics": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/exporter-prometheus/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/exporter-prometheus/node_modules/@opentelemetry/resources": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-2.9.0.tgz", + "integrity": "sha512-jyA5MBLQ+Dkl3+JsZkUoUvL7yHvU64kLsvpXKarWm6347Sl1t1bXFTFykUePNpT5WH5pm9a2Qtt03iIYQhZ1Fg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/exporter-trace-otlp-grpc": { + "version": "0.220.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-grpc/-/exporter-trace-otlp-grpc-0.220.0.tgz", + "integrity": "sha512-bv1xmNhmNwIM6MdUBw4yYuJeVcEViVLk3uD69vOQMwueHBnfyl/u0HnBlB1FNY/Te0UOzJzvcbyR8wN6b+iGbA==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@grpc/grpc-js": "^1.14.3", + "@opentelemetry/otlp-exporter-base": "0.220.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.220.0", + "@opentelemetry/otlp-transformer": "0.220.0", + "@opentelemetry/sdk-trace": "2.9.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/exporter-trace-otlp-http": { + "version": "0.220.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-http/-/exporter-trace-otlp-http-0.220.0.tgz", + "integrity": "sha512-/+ExB3lRkf+erv4PnoywyL7RHKITidxtUpUTS55k7OQ0dB42S7gEF1gry7swb9MSm1hYLUhJg4QQh9W8SpwwqA==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/otlp-exporter-base": "0.220.0", + "@opentelemetry/otlp-transformer": "0.220.0", + "@opentelemetry/resources": "2.9.0", + "@opentelemetry/sdk-trace": "2.9.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/exporter-trace-otlp-http/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/exporter-trace-otlp-http/node_modules/@opentelemetry/resources": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-2.9.0.tgz", + "integrity": "sha512-jyA5MBLQ+Dkl3+JsZkUoUvL7yHvU64kLsvpXKarWm6347Sl1t1bXFTFykUePNpT5WH5pm9a2Qtt03iIYQhZ1Fg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/exporter-trace-otlp-proto": { + "version": "0.220.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-trace-otlp-proto/-/exporter-trace-otlp-proto-0.220.0.tgz", + "integrity": "sha512-voTAD8XgJxlK7zLkXh8EzMB09zrQr3tyY/BsnDTlDiQU/UdK58MZ63A3mUjdEDrxMjCVmBHU3WQJhRmQe+Dvzg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/otlp-exporter-base": "0.220.0", + "@opentelemetry/otlp-transformer": "0.220.0", + "@opentelemetry/resources": "2.9.0", + "@opentelemetry/sdk-trace": "2.9.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/exporter-trace-otlp-proto/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/exporter-trace-otlp-proto/node_modules/@opentelemetry/resources": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-2.9.0.tgz", + "integrity": "sha512-jyA5MBLQ+Dkl3+JsZkUoUvL7yHvU64kLsvpXKarWm6347Sl1t1bXFTFykUePNpT5WH5pm9a2Qtt03iIYQhZ1Fg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/exporter-zipkin": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/exporter-zipkin/-/exporter-zipkin-2.9.0.tgz", + "integrity": "sha512-RwINoce2BH8T4obT5pMcAla2sWma1YZvYuaktWmTluQ0PkQdvv5D060rWI1+kawX+J2qBRcMbwrZJJNcMJUauQ==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/resources": "2.9.0", + "@opentelemetry/sdk-trace": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.0.0" + } + }, + "node_modules/@opentelemetry/exporter-zipkin/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/exporter-zipkin/node_modules/@opentelemetry/resources": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-2.9.0.tgz", + "integrity": "sha512-jyA5MBLQ+Dkl3+JsZkUoUvL7yHvU64kLsvpXKarWm6347Sl1t1bXFTFykUePNpT5WH5pm9a2Qtt03iIYQhZ1Fg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/instrumentation": { + "version": "0.220.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.220.0.tgz", + "integrity": "sha512-xQx3E2WxP1mDvKzxLxX+CTCtNLa560YJZ3087qYHerl2YmiKpv7AH+dAy7vmx+eVrZ5BwhfWUAVoKOoxCNHcpw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/api-logs": "0.220.0", + "import-in-the-middle": "^3.0.0", + "require-in-the-middle": "^8.0.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/otlp-exporter-base": { + "version": "0.220.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-exporter-base/-/otlp-exporter-base-0.220.0.tgz", + "integrity": "sha512-CXYo8UD5Mn9YbgebO2EL4wejtA+gxLmLiu6HCk2KH2BR7XhFN6/6p1UlCb23DYCjeYkndevLHuejCCN1yx4+OQ==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/otlp-transformer": "0.220.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/otlp-exporter-base/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/otlp-grpc-exporter-base": { + "version": "0.220.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-grpc-exporter-base/-/otlp-grpc-exporter-base-0.220.0.tgz", + "integrity": "sha512-/eIkBPMBTIvM3x/0mDX4aJeSkYifYClnBPr68PL1h5LV4VQv4+SV6CGrpiZ4fIWDnobVmhTWCm1J/QRdAWUfvA==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@grpc/grpc-js": "^1.14.3", + "@opentelemetry/core": "2.9.0", + "@opentelemetry/otlp-exporter-base": "0.220.0", + "@opentelemetry/otlp-transformer": "0.220.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/otlp-grpc-exporter-base/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/otlp-transformer": { + "version": "0.220.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/otlp-transformer/-/otlp-transformer-0.220.0.tgz", + "integrity": "sha512-lXGrv7KXZ0gNH9SVNUaa6vv6phVYGvJxfXAlMbzbakiXru75f5MZl8Z7oqiMMQD77riVHJCFlQvbZs/VVN2/4A==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/api-logs": "0.220.0", + "@opentelemetry/core": "2.9.0", + "@opentelemetry/resources": "2.9.0", + "@opentelemetry/sdk-logs": "0.220.0", + "@opentelemetry/sdk-metrics": "2.9.0", + "@opentelemetry/sdk-trace": "2.9.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.3.0" + } + }, + "node_modules/@opentelemetry/otlp-transformer/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/otlp-transformer/node_modules/@opentelemetry/resources": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-2.9.0.tgz", + "integrity": "sha512-jyA5MBLQ+Dkl3+JsZkUoUvL7yHvU64kLsvpXKarWm6347Sl1t1bXFTFykUePNpT5WH5pm9a2Qtt03iIYQhZ1Fg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/propagator-b3": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-b3/-/propagator-b3-2.9.0.tgz", + "integrity": "sha512-WrOT1WsOUG+B7hstD2RYoMPIOK76G8E9AQHhMjUvrQaGx/oA7rPWQvvr1Rqv7+yy4R0ZMVwWLC4vW2xnkgWPAQ==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/propagator-b3/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/propagator-jaeger": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/propagator-jaeger/-/propagator-jaeger-2.9.0.tgz", + "integrity": "sha512-4mYGty27rYvSM0jtp1ZUOqd3LfVRCYg9H5G9OFzSx5HViYToU21MFhWfco7x1HwXr7ER8yGOiCIHZUwjPksc0Q==", + "deprecated": "Package no longer supported. See https://github.com/open-telemetry/opentelemetry-js/pull/7077", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/propagator-jaeger/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/resources": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-2.12.1.tgz", + "integrity": "sha512-IwrNcuLCvnJAnNLkXxx0Uw+rjBkVW6VGQrhd7PanNf0LavOzkTk9sDAjdqegM7p/VdxefNRrii6d+wBRJfz35g==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.12.1", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-logs": { + "version": "0.220.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-logs/-/sdk-logs-0.220.0.tgz", + "integrity": "sha512-WywcTkQtv2iNmt+6y5Kcd4rzvx9bLVsBa2Nwcmg01IUaBTkTow3W4d9KE5vNBpEDtb9tp21WcRBY/lANRrApYA==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/api-logs": "0.220.0", + "@opentelemetry/core": "2.9.0", + "@opentelemetry/resources": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.4.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-logs/node_modules/@opentelemetry/resources": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-2.9.0.tgz", + "integrity": "sha512-jyA5MBLQ+Dkl3+JsZkUoUvL7yHvU64kLsvpXKarWm6347Sl1t1bXFTFykUePNpT5WH5pm9a2Qtt03iIYQhZ1Fg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-metrics": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-metrics/-/sdk-metrics-2.9.0.tgz", + "integrity": "sha512-Xx8RGS4H5XEBl01WuCreMIpiah9cCXMbSkeuIePPdD2cUpq/vUzYmj8E/MK1OsbOc93FuAD4jfn2WOacKwLn7Q==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/resources": "2.9.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.9.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-metrics/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-metrics/node_modules/@opentelemetry/resources": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-2.9.0.tgz", + "integrity": "sha512-jyA5MBLQ+Dkl3+JsZkUoUvL7yHvU64kLsvpXKarWm6347Sl1t1bXFTFykUePNpT5WH5pm9a2Qtt03iIYQhZ1Fg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-node": { + "version": "0.220.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-node/-/sdk-node-0.220.0.tgz", + "integrity": "sha512-wHtGyHhSKHNH3fym33xRu4Ef/HXTFvX8eQ42xdQdEO9LYx9Y2qNyBDJytyqVlvmo6abWZlNYTUthuAGUMYqYnQ==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/api-logs": "0.220.0", + "@opentelemetry/configuration": "0.220.0", + "@opentelemetry/context-async-hooks": "2.9.0", + "@opentelemetry/core": "2.9.0", + "@opentelemetry/exporter-logs-otlp-grpc": "0.220.0", + "@opentelemetry/exporter-logs-otlp-http": "0.220.0", + "@opentelemetry/exporter-logs-otlp-proto": "0.220.0", + "@opentelemetry/exporter-metrics-otlp-grpc": "0.220.0", + "@opentelemetry/exporter-metrics-otlp-http": "0.220.0", + "@opentelemetry/exporter-metrics-otlp-proto": "0.220.0", + "@opentelemetry/exporter-prometheus": "0.220.0", + "@opentelemetry/exporter-trace-otlp-grpc": "0.220.0", + "@opentelemetry/exporter-trace-otlp-http": "0.220.0", + "@opentelemetry/exporter-trace-otlp-proto": "0.220.0", + "@opentelemetry/exporter-zipkin": "2.9.0", + "@opentelemetry/instrumentation": "0.220.0", + "@opentelemetry/otlp-exporter-base": "0.220.0", + "@opentelemetry/otlp-grpc-exporter-base": "0.220.0", + "@opentelemetry/propagator-b3": "2.9.0", + "@opentelemetry/propagator-jaeger": "2.9.0", + "@opentelemetry/resources": "2.9.0", + "@opentelemetry/sdk-logs": "0.220.0", + "@opentelemetry/sdk-metrics": "2.9.0", + "@opentelemetry/sdk-trace": "2.9.0", + "@opentelemetry/sdk-trace-base": "2.9.0", + "@opentelemetry/sdk-trace-node": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-node/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-node/node_modules/@opentelemetry/resources": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-2.9.0.tgz", + "integrity": "sha512-jyA5MBLQ+Dkl3+JsZkUoUvL7yHvU64kLsvpXKarWm6347Sl1t1bXFTFykUePNpT5WH5pm9a2Qtt03iIYQhZ1Fg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-trace": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace/-/sdk-trace-2.9.0.tgz", + "integrity": "sha512-sGA19HvtrrSKYsseHphluH6j3p6Xa3fqc7c7y8f/7mYWejc1lyDFcpSdD1kYa50HCLUeEo4zA5bW0pniaPszuw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/resources": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-trace-base": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-2.9.0.tgz", + "integrity": "sha512-cp9zmTl62R8PJrpvFcmc8N2JQU/xfa0S+61q511Nji+QxCfZ8Ifvg7H27G8cANe4crg4RTrWsVvanHiXjSp6ag==", + "deprecated": "Use @opentelemetry/sdk-trace package", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/resources": "2.9.0", + "@opentelemetry/sdk-trace": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-trace-base/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-trace-base/node_modules/@opentelemetry/resources": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-2.9.0.tgz", + "integrity": "sha512-jyA5MBLQ+Dkl3+JsZkUoUvL7yHvU64kLsvpXKarWm6347Sl1t1bXFTFykUePNpT5WH5pm9a2Qtt03iIYQhZ1Fg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-trace-node": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-node/-/sdk-trace-node-2.9.0.tgz", + "integrity": "sha512-ec9a7ps37huy5itYk0MalaZdSLlM6AXWp/FhtEjgMpp5leEGojBDvAl/UWttQnkMZOvFHKzRESn8TD3yKTF5nQ==", + "deprecated": "Use @opentelemetry/sdk-trace package", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/context-async-hooks": "2.9.0", + "@opentelemetry/core": "2.9.0", + "@opentelemetry/sdk-trace-base": "2.9.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-trace-node/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-trace/node_modules/@opentelemetry/core": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.9.0.tgz", + "integrity": "sha512-m2nckMT80NnmjTYSPjJQObBJ+8dgkoajEOUbznL8AHZ3T3yHRk2P7gI1PhEBc1+lOnrYE9UWrWHqJDsmqjmNbw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-trace/node_modules/@opentelemetry/resources": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-2.9.0.tgz", + "integrity": "sha512-jyA5MBLQ+Dkl3+JsZkUoUvL7yHvU64kLsvpXKarWm6347Sl1t1bXFTFykUePNpT5WH5pm9a2Qtt03iIYQhZ1Fg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/core": "2.9.0", + "@opentelemetry/semantic-conventions": "^1.29.0" + }, + "engines": { + "node": "^18.19.0 || >=20.6.0" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.3.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/semantic-conventions": { + "version": "1.45.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.45.0.tgz", + "integrity": "sha512-aOP45mbcOKbQVvFWfQmgoOPT8R2iwbbbgl83k4CujGV9BrJhFr3qG55MFpwFs4YLabpuW3HhzUY9eQxPlDqaZw==", + "license": "Apache-2.0", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@phc/format": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@phc/format/-/format-1.0.0.tgz", + "integrity": "sha512-m7X9U6BG2+J+R1lSOdCiITLLrxm+cWlNI3HUFA92oLO77ObGNzaKdh8pMLqdZcshtkKuV84olNNXDfMc4FezBQ==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", + "license": "BSD-3-Clause", + "optional": true + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "license": "BSD-3-Clause", + "optional": true + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.5.tgz", + "integrity": "sha512-zgXFLzW3Ap33e6d0Wlj4MGIm6Ce8O89n/apUaGNB/jx+hw+ruWEp7EwGUshdLKVRCxZW12fp9r40E1mQrf/34g==", + "license": "BSD-3-Clause", + "optional": true + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.1.tgz", + "integrity": "sha512-vW1GmwMZNnL+gMRaovlh9yZX74kc+TTU3FObkkurpMaRtBfLP3ldjS9KQWlwZgraRE0+dheEEoAxdzcJQ8eXZg==", + "license": "BSD-3-Clause", + "optional": true + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.1.tgz", + "integrity": "sha512-GpptLrs57adMSuHi3VNj0mAF8dwh36LMaYF6XyJ6JMWlVsc+t42tm1HSEDmOs3A8fC9yyeisgLhsTVQokOZ0zw==", + "license": "BSD-3-Clause", + "optional": true, + "dependencies": { + "@protobufjs/aspromise": "^1.1.1" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", + "license": "BSD-3-Clause", + "optional": true + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", + "license": "BSD-3-Clause", + "optional": true + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", + "license": "BSD-3-Clause", + "optional": true + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.2.tgz", + "integrity": "sha512-b1UQwcEZ4yCnMCD8DAL1VlbvBJE9/IX4FTIp7BG1xYpf29SLazLSrqUkj4w7Y5y7cCVP6E5tcqqcI0xemPkHug==", + "license": "BSD-3-Clause", + "optional": true + }, + "node_modules/@ruvector/attention": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@ruvector/attention/-/attention-2.3.1.tgz", + "integrity": "sha512-9cOwBT7Y9MZ6G9k/l0uQaxOj0fPLy2AAncmxzTWquHCEUxuKuckOyChxeb1TJTUunveBNjiGMG7CZOGn98bAfA==", + "license": "MIT OR Apache-2.0", + "optional": true, + "engines": { + "node": ">= 10" + }, + "optionalDependencies": { + "@ruvector/attention-darwin-arm64": "2.3.1", + "@ruvector/attention-darwin-x64": "2.3.1", + "@ruvector/attention-linux-arm64-gnu": "2.3.1", + "@ruvector/attention-linux-x64-gnu": "2.3.1", + "@ruvector/attention-win32-x64-msvc": "2.3.1" + } + }, + "node_modules/@ruvector/attention-darwin-arm64": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@ruvector/attention-darwin-arm64/-/attention-darwin-arm64-2.3.1.tgz", + "integrity": "sha512-O9Tc+RXD0b370SpySiDcDlH0ZZaxlaJQ0Zw0AusAnj4DHVnOI1gS4s/yx7jwxVmzZF2oLjs3qNNRn90TrXL/eQ==", + "cpu": [ + "arm64" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ruvector/attention-darwin-x64": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@ruvector/attention-darwin-x64/-/attention-darwin-x64-2.3.1.tgz", + "integrity": "sha512-lw8TiRvZ6jXBnC6fY9du3ebpMjCBEpagB5Od74r0WyXKSqJu9XRoJufWl4h5vc/6Rsktf6l68cIsWGZLHA+6Jg==", + "cpu": [ + "x64" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ruvector/attention-linux-arm64-gnu": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@ruvector/attention-linux-arm64-gnu/-/attention-linux-arm64-gnu-2.3.1.tgz", + "integrity": "sha512-RG/tvfax/8VGrf5eJuVxGh8GzxgFSGAEReW6KK0D+OZ3tEAZ/JuoUpwCcy3Ate9UfLWyL7YqG1H20ZsTbCNHig==", + "cpu": [ + "arm64" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ruvector/attention-linux-x64-gnu": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@ruvector/attention-linux-x64-gnu/-/attention-linux-x64-gnu-2.3.1.tgz", + "integrity": "sha512-A8qIObZDGx4n1tipyJCMaxalUukKYNjmZh+UafrX2vCUl2Z48veqPHwx2Eg6T/GU0vNhX8R/zK6HUJJ64eqb3w==", + "cpu": [ + "x64" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ruvector/attention-win32-x64-msvc": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@ruvector/attention-win32-x64-msvc/-/attention-win32-x64-msvc-2.3.1.tgz", + "integrity": "sha512-9EoTn48xBemDSuqq8L5RUV0bfnlwjnDVTZzAOp+gKGsFg6H1q74MDHWZcktlixVMl9WSUyV2Xk9RAduS+flNLA==", + "cpu": [ + "x64" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ruvector/core": { + "version": "0.1.38", + "resolved": "https://registry.npmjs.org/@ruvector/core/-/core-0.1.38.tgz", + "integrity": "sha512-c1OToF8mHc2TDOKXznNzk6sKegznswKF7OehPllkRYIB+R9KSJYZd71q8UneFaf2KCQsrGhptj7MBwXLP/tg6Q==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "ruvector-core-darwin-arm64": "0.1.35", + "ruvector-core-darwin-x64": "0.1.35", + "ruvector-core-linux-arm64-gnu": "0.1.35", + "ruvector-core-linux-x64-gnu": "0.1.35", + "ruvector-core-win32-x64-msvc": "0.1.35" + } + }, + "node_modules/@ruvector/gnn": { + "version": "0.1.28", + "resolved": "https://registry.npmjs.org/@ruvector/gnn/-/gnn-0.1.28.tgz", + "integrity": "sha512-YsEXZll7FciXf43yCQ6TyC5r1KDieeL5p+QCLFkaf3gS1fJ+Lyoiv/pV/DO2NZI0YYPZ1A/n+M4JMwkhabnDAA==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 10" + }, + "optionalDependencies": { + "@ruvector/gnn-darwin-arm64": "0.1.28", + "@ruvector/gnn-darwin-x64": "0.1.28", + "@ruvector/gnn-linux-arm64-gnu": "0.1.28", + "@ruvector/gnn-linux-x64-gnu": "0.1.28", + "@ruvector/gnn-linux-x64-musl": "0.1.28", + "@ruvector/gnn-win32-x64-msvc": "0.1.28" + } + }, + "node_modules/@ruvector/gnn-darwin-arm64": { + "version": "0.1.28", + "resolved": "https://registry.npmjs.org/@ruvector/gnn-darwin-arm64/-/gnn-darwin-arm64-0.1.28.tgz", + "integrity": "sha512-k4ULdkOcC9Q6COUZo+Ss09aF3q0WSZPZN/Iy2oPV3UymTyXu67Gpmuzs+ygmN2Q6dw+8Z3TCUBUNeMr8ONlRdg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ruvector/gnn-darwin-x64": { + "version": "0.1.28", + "resolved": "https://registry.npmjs.org/@ruvector/gnn-darwin-x64/-/gnn-darwin-x64-0.1.28.tgz", + "integrity": "sha512-TCuId9ErPOzpd4b8jbvxbMpngIKViJ7vmEiTMatbVLOIr9uxL+T6gi+9An2hPyLeMpI49ZXjBLOzgWPggjAVGw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ruvector/gnn-linux-arm64-gnu": { + "version": "0.1.28", + "resolved": "https://registry.npmjs.org/@ruvector/gnn-linux-arm64-gnu/-/gnn-linux-arm64-gnu-0.1.28.tgz", + "integrity": "sha512-a0d56uhGaCc79xqlTStGbh0HRSGw3RLCTtzPAiAVN5lWKHInRFG+r4ZVK6SoGd2wmVCDFV9yAeZr5XvUHT8XoA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ruvector/gnn-linux-x64-gnu": { + "version": "0.1.28", + "resolved": "https://registry.npmjs.org/@ruvector/gnn-linux-x64-gnu/-/gnn-linux-x64-gnu-0.1.28.tgz", + "integrity": "sha512-HT3PM6YAeunDDfb1fOgIHPc6VKH9zHeinvXwCYxxb1rjz1lzncRai+Y3DQYh3knzZj69/V5V3jXCUxRJQtADeQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ruvector/gnn-linux-x64-musl": { + "version": "0.1.28", + "resolved": "https://registry.npmjs.org/@ruvector/gnn-linux-x64-musl/-/gnn-linux-x64-musl-0.1.28.tgz", + "integrity": "sha512-MTlpgmAWsNhFnRX3N2DfeyBmhdVprSB/TvhnH1siI69aronNpt4z411wrMS2+wfP7x27g3+YmTpRXsyT9tx6gg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ruvector/gnn-win32-x64-msvc": { + "version": "0.1.28", + "resolved": "https://registry.npmjs.org/@ruvector/gnn-win32-x64-msvc/-/gnn-win32-x64-msvc-0.1.28.tgz", + "integrity": "sha512-NRo0diAm4Dka1mjNdfpx7IdOEmBpdZKYdDV/oQ7n7mybkJ/m0lnqa18GmcqZ9GcVFWDjlNeCFaUCUxBPuSvanA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ruvector/graph-node": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@ruvector/graph-node/-/graph-node-2.1.4.tgz", + "integrity": "sha512-U+r8m/ymKLaqTBklzd7qjknG3/B2ZyAna/bWS8HbsJzkkXMk3rpA25Ag1+rIMpn9aJtinxRhgenhvww7J09Pig==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "@ruvector/graph-node-darwin-arm64": "2.1.4", + "@ruvector/graph-node-darwin-x64": "2.1.4", + "@ruvector/graph-node-linux-arm64-gnu": "2.1.4", + "@ruvector/graph-node-linux-x64-gnu": "2.1.4", + "@ruvector/graph-node-win32-x64-msvc": "2.1.4" + } + }, + "node_modules/@ruvector/graph-node-darwin-arm64": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@ruvector/graph-node-darwin-arm64/-/graph-node-darwin-arm64-2.1.4.tgz", + "integrity": "sha512-JyAQVv201oSC24MrpdCp0n9RPNL2L5xuqL7x4Lj8wScMtKLpehUYkHqzGanAXhzuSlfSd1PUTE7jqebr+n7iUA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@ruvector/graph-node-darwin-x64": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@ruvector/graph-node-darwin-x64/-/graph-node-darwin-x64-2.1.4.tgz", + "integrity": "sha512-4w4ZEPTKExVmfamSHlp7cMdqkv17r743UF989q9Mf/MipNsAXQLqZCkG9GJBEXHdoB7ozSQnbVev78hyGEAISw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@ruvector/graph-node-linux-arm64-gnu": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@ruvector/graph-node-linux-arm64-gnu/-/graph-node-linux-arm64-gnu-2.1.4.tgz", + "integrity": "sha512-zDCb9ye9v1VYqMnAdTIfWz2An9+VB19LQ1yDEZwlhIH1RzqWMuVUgqFO5hPIKQ6aZVkWjMKf2yuZO9PhpTAH+A==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@ruvector/graph-node-linux-x64-gnu": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@ruvector/graph-node-linux-x64-gnu/-/graph-node-linux-x64-gnu-2.1.4.tgz", + "integrity": "sha512-SSwOcW2qij7HngnkIUaLXgbwTLHWI3uRPAI1AhlIPthOZDAagKpPemeqs85ex9M4uuIsoluOcCqnqNGbdDZKhg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@ruvector/graph-node-win32-x64-msvc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@ruvector/graph-node-win32-x64-msvc/-/graph-node-win32-x64-msvc-2.1.4.tgz", + "integrity": "sha512-6s47rR4JN0N3ku87O5zQpNpHNN7F5QHmzZDf+gSMQHFuxrg0p6oZDMIgi041+kpEnRM0FEXodcqfh4UJfqU+Og==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@ruvector/graph-transformer": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@ruvector/graph-transformer/-/graph-transformer-2.0.4.tgz", + "integrity": "sha512-Ep7nCq4vwJ41CR/yl+isYXZAxi1qOLoDIJPVrM//zDx9aixRm4n1TWu9PSsv7GSXizSusQwv+n9hUeZrJ2muTg==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 10" + }, + "optionalDependencies": { + "@ruvector/graph-transformer-darwin-arm64": "2.0.4", + "@ruvector/graph-transformer-darwin-x64": "2.0.4", + "@ruvector/graph-transformer-linux-arm64-gnu": "2.0.4", + "@ruvector/graph-transformer-linux-arm64-musl": "2.0.4", + "@ruvector/graph-transformer-linux-x64-gnu": "2.0.4", + "@ruvector/graph-transformer-linux-x64-musl": "2.0.4", + "@ruvector/graph-transformer-win32-x64-msvc": "2.0.4" + } + }, + "node_modules/@ruvector/graph-transformer-darwin-arm64": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@ruvector/graph-transformer-darwin-arm64/-/graph-transformer-darwin-arm64-2.0.4.tgz", + "integrity": "sha512-VbPWnJHN//1MD5SIn5tEbgV+AUOUtEXpN6q648J+OKjEqJykGVyCg7TKrMOgNtAsAY3vU1S3BlaKIcj2O3ijEw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ruvector/graph-transformer-darwin-x64": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@ruvector/graph-transformer-darwin-x64/-/graph-transformer-darwin-x64-2.0.4.tgz", + "integrity": "sha512-Ol4HYLHV93Scy7GT3kSFFPCmnYiZvDigUaq2l4sVLrGav8BGLMfFcnSRrY9imL3Pq5zFw8bilfaFCg1GF6ntxw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ruvector/graph-transformer-linux-arm64-gnu": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@ruvector/graph-transformer-linux-arm64-gnu/-/graph-transformer-linux-arm64-gnu-2.0.4.tgz", + "integrity": "sha512-f8GatsWNtQWGkYQ4ZXsqnQZ1//5S/sH+5j2Kc6sC2DLIgN0PJamhNN4f2VBwu3toIZHbvk/O/3SQhlIYgBGtAg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ruvector/graph-transformer-linux-arm64-musl": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@ruvector/graph-transformer-linux-arm64-musl/-/graph-transformer-linux-arm64-musl-2.0.4.tgz", + "integrity": "sha512-AMrLREncC4RBQqWMGSZRAaXyP9BrbZG7DDKbSBI86ov1+NvzJs8uoCI1U+x/vSnFcAGB4rq/Z3lDnrj2NP6fpg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ruvector/graph-transformer-linux-x64-gnu": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@ruvector/graph-transformer-linux-x64-gnu/-/graph-transformer-linux-x64-gnu-2.0.4.tgz", + "integrity": "sha512-daXYvA8eG6kKM42gQYvVXUKdgOq6mJmvqHbf024E8M68dFLQaQP6RepAn6CrhUo+dth7AC/pCzcl0YPf2yTVyg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ruvector/graph-transformer-linux-x64-musl": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@ruvector/graph-transformer-linux-x64-musl/-/graph-transformer-linux-x64-musl-2.0.4.tgz", + "integrity": "sha512-w2lbMFm0cBKP12/cheGs16Yb+QQldRS79iBGeaWUnGfUBSZxQS2XryVUMnq60B8R807y6Kv8y5JIOx1ZAeKfRA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ruvector/graph-transformer-win32-x64-msvc": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@ruvector/graph-transformer-win32-x64-msvc/-/graph-transformer-win32-x64-msvc-2.0.4.tgz", + "integrity": "sha512-dPnAdkr9n9g2FttFpmxtoffHNQVHxkbvZbEn3diot2IqTjXHHMJQYizVxTdZ6Dtur0T95PLpMz+XoW/qxus2xQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@ruvector/mincut-wasm": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ruvector/mincut-wasm/-/mincut-wasm-2.3.0.tgz", + "integrity": "sha512-vCksKzgzlLiN6tMWC9FBAuXaam3HzAh4Xr+Wgydc4OjuDLUstWb2tgtitEUfPm0NI0W2nILMJ0Jypg1i0hJl7Q==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=22" + } + }, + "node_modules/@ruvector/rabitq-wasm": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@ruvector/rabitq-wasm/-/rabitq-wasm-0.1.2.tgz", + "integrity": "sha512-SFJK59QPaT4l9IB/7xD6EITzYRB5A/S1LItkOMQ5pGP73mDprJybEjnMxzg+mvp3HHiEF9g4+R//FFo9PXn49A==", + "license": "MIT OR Apache-2.0", + "optional": true + }, + "node_modules/@ruvector/router": { + "version": "0.1.34", + "resolved": "https://registry.npmjs.org/@ruvector/router/-/router-0.1.34.tgz", + "integrity": "sha512-vsV0EYBdrX6UXQ2zMolkHnbmfEHngOf17485/bfhwO2btg6T3z/32Z0Bl1NmAbtFX7g+xUbN3BBYdKrgM1+KMA==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "@ruvector/router-darwin-arm64": "0.1.34", + "@ruvector/router-darwin-x64": "0.1.34", + "@ruvector/router-linux-arm64-gnu": "0.1.34", + "@ruvector/router-linux-x64-gnu": "0.1.34", + "@ruvector/router-win32-x64-msvc": "0.1.34" + } + }, + "node_modules/@ruvector/router-darwin-arm64": { + "version": "0.1.34", + "resolved": "https://registry.npmjs.org/@ruvector/router-darwin-arm64/-/router-darwin-arm64-0.1.34.tgz", + "integrity": "sha512-o8kf5ieg4wpiwZnj8/bJOLlNdgJ5NXmW/FbrfG8JGokgLj5fCYQ4CwuDmUZ1zQZyWirplX95RlPeF5XHBW3n6g==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/@ruvector/router-darwin-x64": { + "version": "0.1.34", + "resolved": "https://registry.npmjs.org/@ruvector/router-darwin-x64/-/router-darwin-x64-0.1.34.tgz", + "integrity": "sha512-vEHFHyn8/0FDdsdl7/VgVNJ62uxzHjMg7lBxobTEQkH3vkUrnDLNW69iulm3rdjaUCke9QNKPm2zEPy9JdF5Kw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/@ruvector/router-linux-arm64-gnu": { + "version": "0.1.34", + "resolved": "https://registry.npmjs.org/@ruvector/router-linux-arm64-gnu/-/router-linux-arm64-gnu-0.1.34.tgz", + "integrity": "sha512-xrFtrhC0PyPkRC121EpZKfmguMGeEQi0B1D9tfJvnO5s6DfqB6peBFa3y7+IeYovzk/wfDJZKx5lYCZ/PdbgzA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/@ruvector/router-linux-x64-gnu": { + "version": "0.1.34", + "resolved": "https://registry.npmjs.org/@ruvector/router-linux-x64-gnu/-/router-linux-x64-gnu-0.1.34.tgz", + "integrity": "sha512-qkb1Mg/5+Q+rw2PMire8mgUsSz03vU3XmAjYSW3D7azyORgHZZDMlZ2JntYjx1g1mjy8VDFrPQOzky9ifJmQcQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/@ruvector/router-win32-x64-msvc": { + "version": "0.1.34", + "resolved": "https://registry.npmjs.org/@ruvector/router-win32-x64-msvc/-/router-win32-x64-msvc-0.1.34.tgz", + "integrity": "sha512-MPf0seZ0awzHKserRd/FnGxZWm0McjCYEYBgxQhjlvOqog8tSdMGG6BtpTxLt6CDRqmZ+x27AsVx3f6UQWW/5g==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/@ruvector/ruqu-wasm": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@ruvector/ruqu-wasm/-/ruqu-wasm-2.2.0.tgz", + "integrity": "sha512-NlUh6ARekBruaEAqJVZqrv3tZjdRmC0bnblH6LwZ4NOEwmmMxW+4MNqMLPjXnsAk6s7jF7+NckTrWEtLePUq0g==", + "license": "MIT", + "optional": true + }, + "node_modules/@ruvector/ruvllm": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@ruvector/ruvllm/-/ruvllm-4.2.2.tgz", + "integrity": "sha512-kVX1f9CFG7t87QxGtE4N3o4enmrXo4LYbMoNY3fjunidJDViXDDPMTUPJyozyyhrV0L+VRERVo4SNiSWw62nKQ==", + "license": "MIT OR Apache-2.0", + "optional": true, + "dependencies": { + "chalk": "^4.1.2", + "commander": "^12.0.0", + "ora": "^5.4.1" + }, + "bin": { + "ruvllm": "bin/cli.js", + "ruvllm-adapters": "bin/ruvllm-adapters.js", + "ruvllm-gpu-loop": "bin/ruvllm-gpu-loop.js" + }, + "engines": { + "node": ">= 18" + }, + "optionalDependencies": { + "@ruvector/ruvllm-darwin-arm64": "2.1.1", + "@ruvector/ruvllm-darwin-x64": "2.1.1", + "@ruvector/ruvllm-gpu-loop": "^1.1.1", + "@ruvector/ruvllm-linux-arm64-gnu": "2.1.1", + "@ruvector/ruvllm-linux-x64-gnu": "2.1.1", + "@ruvector/ruvllm-win32-x64-msvc": "2.1.1" + } + }, + "node_modules/@ruvector/ruvllm-darwin-arm64": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@ruvector/ruvllm-darwin-arm64/-/ruvllm-darwin-arm64-2.1.1.tgz", + "integrity": "sha512-sWNxPTGB1pf4BD+SqI8qrlcrzygNDLiIUQOnwJxtScKvDUyBxfp/OOMnP92TjnqyIAK3Ciuzzvk6dTe+nayxpA==", + "cpu": [ + "arm64" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/@ruvector/ruvllm-darwin-x64": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@ruvector/ruvllm-darwin-x64/-/ruvllm-darwin-x64-2.1.1.tgz", + "integrity": "sha512-qOGVHbhmVBlsEDsMt0XCsTHDeNSLfZ6tviBDAx2/Ln97W52gUGDuJjJKKOl+cfCGTiMskSmN4Yx0d7Zx7WTKcA==", + "cpu": [ + "x64" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/@ruvector/ruvllm-gpu-loop": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ruvector/ruvllm-gpu-loop/-/ruvllm-gpu-loop-1.1.2.tgz", + "integrity": "sha512-HodbzqroGmrjhCJz3F4X0X1wkFWYYDiAiGJJA2zOnHrZUtkG6WM8PMoWZ2hH5EE2pVNbZzMVsZVrJW5mLjsQoQ==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@metaharness/darwin": "^0.13.0", + "@metaharness/flywheel": "^0.1.13", + "@metaharness/weight-eft": "^0.1.2" + }, + "bin": { + "ruvllm-adapters": "src/adapters-cli.mjs", + "ruvllm-gpu": "src/cli.mjs", + "ruvllm-gpu-loop": "src/gpu-loop-cli.mjs" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@ruvector/ruvllm-linux-arm64-gnu": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@ruvector/ruvllm-linux-arm64-gnu/-/ruvllm-linux-arm64-gnu-2.1.1.tgz", + "integrity": "sha512-JAfGJ73+FrsV3vxXEg0wYlxrrk+GKL3x1NtaeUrvlIWV/+jS2whq8eKzss8AOBLF2QeT3npxEtTnzbjIMC3CLg==", + "cpu": [ + "arm64" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/@ruvector/ruvllm-linux-x64-gnu": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@ruvector/ruvllm-linux-x64-gnu/-/ruvllm-linux-x64-gnu-2.1.1.tgz", + "integrity": "sha512-po/bs7dJHm/DPfx5HjhluXdz9Be/WCQXy0Tv6JYotICqKvaDTYm10lSNsUD65i6ievArADXbDqSkde6y9TjHiQ==", + "cpu": [ + "x64" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/@ruvector/ruvllm-win32-x64-msvc": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@ruvector/ruvllm-win32-x64-msvc/-/ruvllm-win32-x64-msvc-2.1.1.tgz", + "integrity": "sha512-lhOu92netWO3VoaWdys0gL2IJYxRmzg/IoIWitW6mJEDo21HBp+ZQF187POQBCnte98mULMFU3yomPEUH4Lsfw==", + "cpu": [ + "x64" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/@ruvector/ruvllm/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "optional": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@ruvector/rvf": { + "version": "0.4.12", + "resolved": "https://registry.npmjs.org/@ruvector/rvf/-/rvf-0.4.12.tgz", + "integrity": "sha512-6rreuJqzmbCEZtnUD7Qe1o0NuoitSi6cKffW3zU8bPovl2fVP8h7nFFQaJTI993+ui/kN4BKIDY0UuxjsP25yw==", + "license": "MIT", + "optional": true, + "dependencies": { + "@ruvector/rvf-node": "^0.4.7" + }, + "optionalDependencies": { + "@ruvector/rvf-solver": "^0.1.0", + "@ruvector/rvf-wasm": "^0.1.7" + } + }, + "node_modules/@ruvector/rvf-node": { + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/@ruvector/rvf-node/-/rvf-node-0.4.7.tgz", + "integrity": "sha512-9q/tD33rSXLfXnuXK1DR4eg/zCa1x3vHgLFL4mJ4zyO+8Oe1hDIuGQ7Q6R8vnV+J7Whd7OrrWJfRRuZGFDK+yA==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 16" + } + }, + "node_modules/@ruvector/rvf-solver": { + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/@ruvector/rvf-solver/-/rvf-solver-0.1.11.tgz", + "integrity": "sha512-O+3TieJ/bZD5BNz5QivwsFKU39thasgLXzcD52ns/Ci10XEfDR3JwGK4YVXoY1LEJttavoCZDifoEGO0hFIhyg==", + "license": "MIT", + "optional": true + }, + "node_modules/@ruvector/rvf-wasm": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/@ruvector/rvf-wasm/-/rvf-wasm-0.1.13.tgz", + "integrity": "sha512-oonKlXA2xtpao9qgGoq5JlvotKjtCuRve/0CbU3G22CnHC72STMnZLCGNoqM6Q4eL+Gh41iF5X9yRbFbF0QsRg==", + "license": "MIT", + "optional": true + }, + "node_modules/@ruvector/sona": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/@ruvector/sona/-/sona-0.1.13.tgz", + "integrity": "sha512-yc2BBbFzM3lo7jMi2DwRcV5JtHNgqs8ozKS+YbLawBxSqOlhJJSG1I4pjsJHfRLUCVeq9tYuEkIb0+n/xFnYug==", + "license": "MIT OR Apache-2.0", + "optional": true, + "engines": { + "node": ">= 16" + }, + "optionalDependencies": { + "@ruvector/sona-darwin-arm64": "0.1.13", + "@ruvector/sona-darwin-x64": "0.1.13", + "@ruvector/sona-linux-arm64-gnu": "0.1.13", + "@ruvector/sona-linux-x64-gnu": "0.1.13", + "@ruvector/sona-linux-x64-musl": "0.1.13", + "@ruvector/sona-win32-arm64-msvc": "0.1.13", + "@ruvector/sona-win32-x64-msvc": "0.1.13" + } + }, + "node_modules/@ruvector/sona-darwin-arm64": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/@ruvector/sona-darwin-arm64/-/sona-darwin-arm64-0.1.13.tgz", + "integrity": "sha512-5TT0cOoG4KZu2Y3Nk39kRl4ZPugerkzVXl3PFKuKRc44u0NTHPlNDN89A1bsH4gumiOa4lEH0TMHzm5vuTrczA==", + "cpu": [ + "arm64" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@ruvector/sona-darwin-x64": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/@ruvector/sona-darwin-x64/-/sona-darwin-x64-0.1.13.tgz", + "integrity": "sha512-D6pPYMg+lj0LKOlsPPW7pu3aZmlvVw892SeRmqrA6w3tWJMqDxuJJZdVoHRnXXWX2dhJJptYis4ykNym4e9ERg==", + "cpu": [ + "x64" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@ruvector/sona-linux-arm64-gnu": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/@ruvector/sona-linux-arm64-gnu/-/sona-linux-arm64-gnu-0.1.13.tgz", + "integrity": "sha512-tuA2S6Km14VuG1mwVRN+0BZiklm9olhWu149JEOvJHlpkzddsBjTZT8//z7ZKEHkrl80lkqBhvNooLvXSe7Q7A==", + "cpu": [ + "arm64" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@ruvector/sona-linux-x64-gnu": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/@ruvector/sona-linux-x64-gnu/-/sona-linux-x64-gnu-0.1.13.tgz", + "integrity": "sha512-ra3Hr0gsS/s6Q6AMHSosDreEo5ZtOWtj2xUbHcp8zYx9jZKiD2M90HKEkfhMRGSQ82kWF+IxciTO2VnKeGFfqQ==", + "cpu": [ + "x64" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@ruvector/sona-linux-x64-musl": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/@ruvector/sona-linux-x64-musl/-/sona-linux-x64-musl-0.1.13.tgz", + "integrity": "sha512-lEieKOW4Fwa6PO6W/CPwhCX9JXdbxcqEN69lwBrLjIzt0DZkQkH+UU77Zs8i5Gfd44HJp+P0BHdJeyLoBQlp3w==", + "cpu": [ + "x64" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@ruvector/sona-win32-arm64-msvc": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/@ruvector/sona-win32-arm64-msvc/-/sona-win32-arm64-msvc-0.1.13.tgz", + "integrity": "sha512-SWOFaIeFFboV3grERwguvpKCc+HZZ/MoeN2cFkxd2rBQQA+bXEKz81PSbnO4nBSa1xzk/LgCsB/xVu4MEkZBMA==", + "cpu": [ + "arm64" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@ruvector/sona-win32-x64-msvc": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/@ruvector/sona-win32-x64-msvc/-/sona-win32-x64-msvc-0.1.13.tgz", + "integrity": "sha512-pD3ZxAsG+sGuCCXLlocTDGyuYyt6uAv1IqTwqD8g7niZwCTp837ukMA1D1zqkeY5hmKEto4BPmSISi3iiMCx5Q==", + "cpu": [ + "x64" + ], + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@ruvector/tiny-dancer": { + "version": "0.1.26", + "resolved": "https://registry.npmjs.org/@ruvector/tiny-dancer/-/tiny-dancer-0.1.26.tgz", + "integrity": "sha512-tJFvmCNOdyRCwJ5skFbkD1lkVqGSQ8Odn4iLXI+YUSxqHYwviG4fDyheoxD4ekNTBUB8zZ/fmGGhS8gr8r9j/w==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "@ruvector/tiny-dancer-darwin-arm64": "0.1.26", + "@ruvector/tiny-dancer-darwin-x64": "0.1.26", + "@ruvector/tiny-dancer-linux-arm64-gnu": "0.1.26", + "@ruvector/tiny-dancer-linux-arm64-musl": "0.1.26", + "@ruvector/tiny-dancer-linux-x64-gnu": "0.1.26", + "@ruvector/tiny-dancer-linux-x64-musl": "0.1.26", + "@ruvector/tiny-dancer-win32-arm64-msvc": "0.1.26", + "@ruvector/tiny-dancer-win32-x64-msvc": "0.1.26" + } + }, + "node_modules/@ruvector/tiny-dancer-darwin-arm64": { + "version": "0.1.26", + "resolved": "https://registry.npmjs.org/@ruvector/tiny-dancer-darwin-arm64/-/tiny-dancer-darwin-arm64-0.1.26.tgz", + "integrity": "sha512-PS05103JUNJHozyCcJMXf7UdP0R3/nVsRMGgkar0onm3LHZVO4PHXG1x0x+snVZwCrVwlyBfDiT3jLmkAkD9cw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/@ruvector/tiny-dancer-darwin-x64": { + "version": "0.1.26", + "resolved": "https://registry.npmjs.org/@ruvector/tiny-dancer-darwin-x64/-/tiny-dancer-darwin-x64-0.1.26.tgz", + "integrity": "sha512-PXAYF8JAgqgON2dntr5nb014Tg4CCbR4tSayqBvBvz5LVhNu4jyjT/cLgzJEIkCDvJsfQOpUBB6/nUZZ8QE0lA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/@ruvector/tiny-dancer-linux-arm64-gnu": { + "version": "0.1.26", + "resolved": "https://registry.npmjs.org/@ruvector/tiny-dancer-linux-arm64-gnu/-/tiny-dancer-linux-arm64-gnu-0.1.26.tgz", + "integrity": "sha512-/GB4iOMJGIG166lldVBYkinh336QVgfL6qkfI1B00MFTGf86K7AomaipsSfGr2+liASzUHe21UnpBMQuf7kdqA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/@ruvector/tiny-dancer-linux-arm64-musl": { + "version": "0.1.26", + "resolved": "https://registry.npmjs.org/@ruvector/tiny-dancer-linux-arm64-musl/-/tiny-dancer-linux-arm64-musl-0.1.26.tgz", + "integrity": "sha512-aRj9XZsMJU5SbSa92OH28YKSJC1zrhDLjH3dCr4feYyCvG6NE84xsL/57RLPWDB2yeut4OEkAVwYPTHoDsBhyg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/@ruvector/tiny-dancer-linux-x64-gnu": { + "version": "0.1.26", + "resolved": "https://registry.npmjs.org/@ruvector/tiny-dancer-linux-x64-gnu/-/tiny-dancer-linux-x64-gnu-0.1.26.tgz", + "integrity": "sha512-Rpsm17jqMnWzz2XQT3IEhreIDdg0DLMU0WvVfNdseOckkotOLy+EiM4Rtaav2YSz8KQRegCY2i9Fzx30KuhSLw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/@ruvector/tiny-dancer-linux-x64-musl": { + "version": "0.1.26", + "resolved": "https://registry.npmjs.org/@ruvector/tiny-dancer-linux-x64-musl/-/tiny-dancer-linux-x64-musl-0.1.26.tgz", + "integrity": "sha512-H/OwJo4NWo4eKkAt0HNnrsajzy0d1B32iLsMbp+EghPKl1iptIbvvM1KinVDoqpc5oJ4Jc4TCyD95iTKg60Qdg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/@ruvector/tiny-dancer-win32-arm64-msvc": { + "version": "0.1.26", + "resolved": "https://registry.npmjs.org/@ruvector/tiny-dancer-win32-arm64-msvc/-/tiny-dancer-win32-arm64-msvc-0.1.26.tgz", + "integrity": "sha512-ssGjC4PQDN7EPrHIgGoXyp03ym2y3W5WB+Te/T73BIOQ+s29ea71xaj82h7Pkvt8PcVUOrSsFHEuO/8wfvH1Xw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/@ruvector/tiny-dancer-win32-x64-msvc": { + "version": "0.1.26", + "resolved": "https://registry.npmjs.org/@ruvector/tiny-dancer-win32-x64-msvc/-/tiny-dancer-win32-x64-msvc-0.1.26.tgz", + "integrity": "sha512-Gl2IsBJGUJjuNX4x16wz+eizOAh4vX96SyK0hR+JQNzD9rIVc7lNCeuvEdfor2DaA26+85vdgaDpMoaerok7KQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/@ruvnet/sublinear-core": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@ruvnet/sublinear-core/-/sublinear-core-1.0.1.tgz", + "integrity": "sha512-3QkspuVBijsNA+F2ZY+Z8Goq5uNfd26MW0QHpRx1LdOAMvyq7SZja1Jw6SdAohwve/9OcaXiou2x9vw2R+dY6Q==", + "license": "MIT OR Apache-2.0", + "optional": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/@so-ric/colorspace": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/@so-ric/colorspace/-/colorspace-1.1.6.tgz", + "integrity": "sha512-/KiKkpHNOBgkFJwu9sh48LkHSMYGyuTcSFK/qMBdnOAlrRJzRSXAOFB5qwzaVQuDl8wAvHVMkaASQDReTahxuw==", + "license": "MIT", + "optional": true, + "dependencies": { + "color": "^5.0.2", + "text-hex": "1.0.x" + } + }, + "node_modules/@types/node": { + "version": "26.6.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.6.tgz", + "integrity": "sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==", + "license": "MIT", + "optional": true, + "dependencies": { + "undici-types": "~8.9.0" + } + }, + "node_modules/@types/triple-beam": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz", + "integrity": "sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==", + "license": "MIT", + "optional": true + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/accepts/node_modules/content-type": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz", + "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/accepts/node_modules/negotiator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.1.0.tgz", + "integrity": "sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg==", + "license": "MIT", + "dependencies": { + "content-type": "^2.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/adm-zip": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.6.1.tgz", + "integrity": "sha512-Xwrja8nx9e5o2N1my4DsKCeKpdrnACyr1wtbPxBDgGzKzKyE9kRtBFA8mWldI+RVlD7CBZNWY/wQ2+ydwOR6kQ==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14.0" + } + }, + "node_modules/agentdb": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/agentdb/-/agentdb-3.10.0.tgz", + "integrity": "sha512-aKgnOMJsV3Ae+OEaE2em2241VBz8eawAuXnfkRAqMDjgTRTrUD7GF2h20aarcEWj7otENeTvLgoHUQbOVR8R6Q==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@modelcontextprotocol/sdk": "^1.20.1", + "@opentelemetry/api": "^1.9.0", + "ajv": "^8.18.0", + "chalk": "^5.3.0", + "commander": "^12.1.0", + "ruv-fann": "0.1.2", + "ruv-fann-wsp": "0.1.0", + "semver": "^7.7.0", + "sql.js": "^1.13.0" + }, + "bin": { + "agentdb": "dist/src/cli/agentdb-cli.js" + }, + "engines": { + "node": ">=20.9.0" + }, + "optionalDependencies": { + "@huggingface/transformers": "^4.2.0", + "@opentelemetry/resources": "^2.8.0", + "@opentelemetry/sdk-node": "^0.220.0", + "@opentelemetry/semantic-conventions": "^1.25.0", + "@ruvector/attention": "^2.3.1", + "@ruvector/core": "0.1.38", + "@ruvector/gnn": "0.1.28", + "@ruvector/graph-node": "^2.1.4", + "@ruvector/graph-transformer": "^2.0.4", + "@ruvector/mincut-wasm": "^2.3.0", + "@ruvector/rabitq-wasm": "0.1.2", + "@ruvector/router": "0.1.34", + "@ruvector/ruvllm": "^4.2.2", + "@ruvector/rvf": "0.4.12", + "@ruvector/rvf-node": "0.4.7", + "@ruvector/rvf-solver": "0.1.11", + "@ruvector/rvf-wasm": "0.1.13", + "@ruvector/sona": "0.1.13", + "@ruvnet/sublinear-core": "^1.0.1", + "aidefence": "^3.0.1", + "argon2": "^0.44.0", + "better-sqlite3": "^12.8.0", + "hnswlib-node": "^3.0.0", + "inquirer": "^9.3.8", + "ruvector": "0.3.20", + "ruvector-attention-wasm": "^2.1.0", + "ruvector-graph-transformer-wasm": "^2.0.4" + } + }, + "node_modules/aidefence": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/aidefence/-/aidefence-3.2.0.tgz", + "integrity": "sha512-MIwASK+TqpvXisUnlSJTwIKwevKjli1EbGEojR87H8aXOkjUHnsjrYVB1GRAL1BLUQjkILYVD4tPmlZT4pASLA==", + "license": "MIT", + "optional": true, + "dependencies": { + "compression": "^1.7.4", + "cors": "^2.8.5", + "dotenv": "^16.3.1", + "express": "^5.2.1", + "express-rate-limit": "^7.1.5", + "helmet": "^7.1.0", + "prom-client": "^15.1.0", + "winston": "^3.11.0", + "zod": "^4.6.7" + }, + "bin": { + "aidefence": "dist/server.js" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "@ruvector/rvf": "^0.4.7" + } + }, + "node_modules/aidefence/node_modules/express-rate-limit": { + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-7.5.1.tgz", + "integrity": "sha512-7iN8iPMDzOMHPUYllBEsQdWVB6fPDMPqwjBaFrgr4Jgr/+okjvzAy+UHlYYL/Vs0OsOrMkwS6PJDkFlJwoxUnw==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": ">= 4.11" + } + }, + "node_modules/ajv": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz", + "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz", + "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==", + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "optional": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/ansi-styles/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/ansi-styles/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT", + "optional": true + }, + "node_modules/argon2": { + "version": "0.44.0", + "resolved": "https://registry.npmjs.org/argon2/-/argon2-0.44.0.tgz", + "integrity": "sha512-zHPGN3S55sihSQo0dBbK0A5qpi2R31z7HZDZnry3ifOyj8bZZnpZND2gpmhnRGO1V/d555RwBqIK5W4Mrmv3ig==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@phc/format": "^1.0.0", + "cross-env": "^10.0.0", + "node-addon-api": "^8.5.0", + "node-gyp-build": "^4.8.4" + }, + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/async": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "license": "MIT", + "optional": true + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "optional": true + }, + "node_modules/better-sqlite3": { + "version": "12.11.1", + "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-12.11.1.tgz", + "integrity": "sha512-dq9AtApgg5PGFtBzPFSBl3HZQjHok5gaQCM6zh2Yk0aSmDCs1CbnVI8/HgASQkNKsWFpseIO9beg5xxpYhbIfA==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "dependencies": { + "bindings": "^1.5.0", + "prebuild-install": "^7.1.1" + }, + "engines": { + "node": "20.x || 22.x || 23.x || 24.x || 25.x || 26.x" + } + }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, + "node_modules/bintrees": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.2.tgz", + "integrity": "sha512-VOMgTMwjAaUG580SXn3LacVgjurrbMme7ZZNYGSSV7mmtY6QQRh0Eg3pwIcntQ77DErK1L0NxkbetjcoXzVwKw==", + "license": "MIT", + "optional": true + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "license": "MIT", + "optional": true, + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/body-parser": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.4.0.tgz", + "integrity": "sha512-Ifk1KcLrxaGt1occQagQNFNNOqRt1LFuehEnHHzB8Z6cRgIxRU1TBaiIsUiCdA+gy5PL7Y1IX31DNKkRmxtXjQ==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^2.1.0", + "debug": "^4.4.3", + "http-errors": "^2.0.1", + "iconv-lite": "^0.7.3", + "on-finished": "^2.4.1", + "qs": "^6.16.1", + "raw-body": "^3.0.2", + "type-is": "^2.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/body-parser/node_modules/content-type": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz", + "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/body-parser/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/body-parser/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "optional": true, + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chalk": { + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", + "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chardet": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-2.2.0.tgz", + "integrity": "sha512-rddelWYNPRrXq6PtNEN2S3f6t9ILzvqaN5pVgi4kqt9jHQaXIial9PznB5iSPVlQSLNaaH22ItWz3EJtQ10+OA==", + "license": "MIT", + "optional": true + }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "license": "ISC", + "optional": true + }, + "node_modules/cjs-module-lexer": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-2.3.0.tgz", + "integrity": "sha512-lmNyBzi6iYiqyrExTctfmjd8tInx+dHu9PBomTfH5RXS53c27JMFJgzNv5TyAnm3PgGf+MLy0+Ws41/HlVxdKQ==", + "license": "MIT", + "optional": true + }, + "node_modules/cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "license": "MIT", + "optional": true, + "dependencies": { + "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-spinners": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-width": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz", + "integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==", + "license": "ISC", + "optional": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "license": "ISC", + "optional": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/cliui/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "optional": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/color": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/color/-/color-5.0.3.tgz", + "integrity": "sha512-ezmVcLR3xAVp8kYOm4GS45ZLLgIE6SPAFoduLr6hTDajwb3KZ2F46gulK3XpcwRFb5KKGCSezCBAY4Dw4HsyXA==", + "license": "MIT", + "optional": true, + "dependencies": { + "color-convert": "^3.1.3", + "color-string": "^2.1.3" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/color-convert": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-3.1.3.tgz", + "integrity": "sha512-fasDH2ont2GqF5HpyO4w0+BcewlhHEZOFn9c1ckZdHpJ56Qb7MHhH/IcJZbBGgvdtwdwNbLvxiBEdg336iA9Sg==", + "license": "MIT", + "optional": true, + "dependencies": { + "color-name": "^2.0.0" + }, + "engines": { + "node": ">=14.6" + } + }, + "node_modules/color-name": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-2.1.1.tgz", + "integrity": "sha512-p2FdgwVx1a9yWBHP2wI0VgShkDpgN4kZISkxdNipGBJWpa5G6b04OINlVWCyJj0JmfvcPrgqt95E9k8yvaOJFg==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=12.20" + } + }, + "node_modules/color-string": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-2.1.4.tgz", + "integrity": "sha512-Bb6Cq8oq0IjDOe8wJmi4JeNn763Xs9cfrBcaylK1tPypWzyoy2G3l90v9k64kjphl/ZJjPIShFztenRomi8WTg==", + "license": "MIT", + "optional": true, + "dependencies": { + "color-name": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/commander": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/compressible": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", + "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "license": "MIT", + "optional": true, + "dependencies": { + "mime-db": ">= 1.43.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/compression": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.8.2.tgz", + "integrity": "sha512-o8vI5RE5A6EVVOd9o41jKp41aJom+QTEO/Bx8MYNjexMo/Bv2WOjUfZr+aL0WnYSgymUy6zeguqLTsIhV0gMvQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "bytes": "3.1.2", + "compressible": "~2.0.18", + "debug": "2.6.9", + "destroy": "1.2.0", + "negotiator": "~0.6.4", + "on-headers": "~1.1.0", + "safe-buffer": "5.2.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-disposition": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-2.0.1.tgz", + "integrity": "sha512-e+H0ZXHSWYrENhQzw1LPuP4oF5MzVKmDU6d3hxlvaPEYLLg62MxtQNPRx4SYSuYJSBUgnQIG4HIN2tEtNv7Dog==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/cors": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz", + "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/cross-env": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-10.1.0.tgz", + "integrity": "sha512-GsYosgnACZTADcmEyJctkJIoqAhHjttw7RsFrVoJNXbsWWqaq6Ym+7kZjq6mS45O0jij6vtiReppKQEtqWy6Dw==", + "license": "MIT", + "optional": true, + "dependencies": { + "@epic-web/invariant": "^1.0.0", + "cross-spawn": "^7.0.6" + }, + "bin": { + "cross-env": "dist/bin/cross-env.js", + "cross-env-shell": "dist/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "optional": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/defaults": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", + "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", + "license": "MIT", + "optional": true, + "dependencies": { + "clone": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "license": "MIT", + "optional": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "license": "MIT", + "optional": true, + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "license": "Apache-2.0", + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/dotenv": { + "version": "16.6.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz", + "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==", + "license": "BSD-2-Clause", + "optional": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT", + "optional": true + }, + "node_modules/enabled": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/enabled/-/enabled-2.0.0.tgz", + "integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==", + "license": "MIT", + "optional": true + }, + "node_modules/encodeurl": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.1.tgz", + "integrity": "sha512-Ev/hIyePLZtpL98x562lvPtenrUfGr0lfaf44HFZ+hDEwso7ccV9QAZrEVLg0hxNAzygaAFxy2dYaAKKM0G06A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "license": "MIT", + "optional": true, + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-module-lexer": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-3.0.4.tgz", + "integrity": "sha512-BldNY5mwkVu+cQ5Ymn3e6hB9Sx8XHx4ZevWbiUyZbfKxJxYO27Hf0wfzkxIaD5CAJMaGl3YspKELj0ff/7nCMA==", + "license": "MIT", + "optional": true + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eventsource": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.7.tgz", + "integrity": "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==", + "license": "MIT", + "dependencies": { + "eventsource-parser": "^3.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/eventsource-parser": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.1.1.tgz", + "integrity": "sha512-EKN1vKAMcZ8MlYMpaNuxN6R9yakzH6uajHcHVTqWJzvu5pWw9DyhbP35HH8MVBQ+dZjAfDxk+A8NiR9KWaXiyQ==", + "license": "MIT", + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "license": "(MIT OR WTFPL)", + "optional": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/express": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/express/-/express-5.3.0.tgz", + "integrity": "sha512-qCqy1xSoaugxOD4IVHb1ZWdkvCF2W3aE2okKouWj8VwJ+ztskSiXoBnCSJqfKT+cVPJhuJqe9YLbY425+Zh00g==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.3.0", + "content-disposition": "^2.0.1", + "content-type": "^2.0.0", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.8", + "qs": "^6.16.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.1.0", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express-rate-limit": { + "version": "8.7.4", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.7.4.tgz", + "integrity": "sha512-LKBXzX700wz3zAGNNmVnjRI5mEbYkLv7UbMI4+9Xa+JPcg2UZh6AgY/2CZh9RrJjFM5ttC/N1lD+KzyFoZITCw==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "ip-address": "^10.2.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": ">= 4.11" + } + }, + "node_modules/express-rate-limit/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/express-rate-limit/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/express/node_modules/content-type": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz", + "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/express/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.9.tgz", + "integrity": "sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/fecha": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz", + "integrity": "sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==", + "license": "MIT", + "optional": true + }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "license": "MIT", + "optional": true + }, + "node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/finalhandler/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/finalhandler/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/flatbuffers": { + "version": "25.9.23", + "resolved": "https://registry.npmjs.org/flatbuffers/-/flatbuffers-25.9.23.tgz", + "integrity": "sha512-MI1qs7Lo4Syw0EOzUl0xjs2lsoeqFku44KpngfIduHBYvzm8h2+7K8YMQh1JtVVVrUvhLpNwqVi4DERegUJhPQ==", + "license": "Apache-2.0", + "optional": true + }, + "node_modules/fn.name": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", + "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==", + "license": "MIT", + "optional": true + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "license": "MIT", + "optional": true + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "optional": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", + "license": "MIT", + "optional": true + }, + "node_modules/global-agent": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/global-agent/-/global-agent-4.1.7.tgz", + "integrity": "sha512-pxaZqdsMwPA4i7TuRKpDUONm2xGRjvYdRoidCQz7VleUKVuUfh/4p5Q3QDTGrpAE5Kz5TxxcZ+uqEgTkoKRNtg==", + "license": "BSD-3-Clause", + "optional": true, + "dependencies": { + "globalthis": "^1.0.2", + "matcher": "^4.0.0", + "semver": "^7.3.5", + "serialize-error": "^8.1.0" + }, + "engines": { + "node": ">=10.0" + } + }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/guid-typescript": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/guid-typescript/-/guid-typescript-1.0.9.tgz", + "integrity": "sha512-Y8T4vYhEfwJOTbouREvG+3XDsjr8E3kIr7uf+JZ0BYloFsttiHU0WfvANVsR7TxNUJa/WpCnw/Ino/p+DeBhBQ==", + "license": "ISC", + "optional": true + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "license": "MIT", + "optional": true, + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/helmet": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/helmet/-/helmet-7.2.0.tgz", + "integrity": "sha512-ZRiwvN089JfMXokizgqEPXsl2Guk094yExfoDXR0cBYWxtBbaSww/w+vT4WEJsBW2iTUi1GgZ6swmoug3Oy4Xw==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/hnswlib-node": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hnswlib-node/-/hnswlib-node-3.0.0.tgz", + "integrity": "sha512-fypn21qvVORassppC8/qNfZ5KAOspZpm/IbUkAtlqvbtDNnF5VVk5RWF7O5V6qwr7z+T3s1ePej6wQt5wRQ4Cg==", + "hasInstallScript": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "bindings": "^1.5.0", + "node-addon-api": "^8.0.0" + } + }, + "node_modules/hono": { + "version": "4.13.17", + "resolved": "https://registry.npmjs.org/hono/-/hono-4.13.17.tgz", + "integrity": "sha512-vZIcbkvjOR5hHRWERbGkr8fGfF0GGM1ooYkuH448iO3b2AdVEr3AXZSw4Z3Kn+1L5z0CVoVeyV29VGYmFh05kQ==", + "license": "MIT", + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.3.tgz", + "integrity": "sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause", + "optional": true + }, + "node_modules/import-in-the-middle": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/import-in-the-middle/-/import-in-the-middle-3.6.0.tgz", + "integrity": "sha512-xRU7hI24S2FhucXtuZXn8EpcOjfVP6iiEQyR0USayPeaOroEmSsNlqnl95866iRdRtkHrd6Q/Z4D14R60au0+A==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "cjs-module-lexer": "^2.2.0", + "es-module-lexer": "^3.0.4", + "module-details-from-path": "^1.0.4" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "license": "ISC", + "optional": true + }, + "node_modules/inquirer": { + "version": "9.3.8", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-9.3.8.tgz", + "integrity": "sha512-pFGGdaHrmRKMh4WoDDSowddgjT1Vkl90atobmTeSmcPGdYiwikch/m/Ef5wRaiamHejtw0cUUMMerzDUXCci2w==", + "license": "MIT", + "optional": true, + "dependencies": { + "@inquirer/external-editor": "^1.0.2", + "@inquirer/figures": "^1.0.3", + "ansi-escapes": "^4.3.2", + "cli-width": "^4.1.0", + "mute-stream": "1.0.0", + "ora": "^5.4.1", + "run-async": "^3.0.0", + "rxjs": "^7.8.1", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^6.2.0", + "yoctocolors-cjs": "^2.1.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/ip-address": { + "version": "10.7.6", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.7.6.tgz", + "integrity": "sha512-00LYkM6byILa9eQIx6qoaXCM40xTLd56AZ4vyaPW3YTyb49VZYPo5xsiAq4tuQ54GH4R7gVdYScJ1B7B77PuTg==", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/jose": { + "version": "6.2.17", + "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.17.tgz", + "integrity": "sha512-wOuK9V1yujQFH5S0ZWmLcDZN7+IKh9bUCC2ZPCf2HDlol3WWHy+PPyNjEI75FXRLMp3vDKQcupP59xhVU95hcg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, + "node_modules/json-schema-typed": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/json-schema-typed/-/json-schema-typed-8.0.2.tgz", + "integrity": "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==", + "license": "BSD-2-Clause" + }, + "node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/kolorist": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/kolorist/-/kolorist-1.8.0.tgz", + "integrity": "sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==", + "license": "MIT", + "optional": true + }, + "node_modules/kuler": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz", + "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==", + "license": "MIT", + "optional": true + }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", + "license": "MIT", + "optional": true + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "license": "MIT", + "optional": true, + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-symbols/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "optional": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/logform": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/logform/-/logform-2.7.0.tgz", + "integrity": "sha512-TFYA4jnP7PVbmlBIfhlSe+WKxs9dklXMTEGcBCIvLhE/Tn3H6Gk1norupVW7m5Cnd4bLcr08AytbyV/xj7f/kQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "@colors/colors": "1.6.0", + "@types/triple-beam": "^1.3.2", + "fecha": "^4.2.0", + "ms": "^2.1.1", + "safe-stable-stringify": "^2.3.1", + "triple-beam": "^1.3.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/logform/node_modules/@colors/colors": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz", + "integrity": "sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/logform/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT", + "optional": true + }, + "node_modules/long": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", + "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==", + "license": "Apache-2.0", + "optional": true + }, + "node_modules/matcher": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/matcher/-/matcher-4.0.0.tgz", + "integrity": "sha512-S6x5wmcDmsDRRU/c2dkccDwQPXoFczc5+HpQ2lON8pnvHlnvHAHj5WlLVvw6n6vNyHuVugYrFohYxbS+pvFpKQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "escape-string-regexp": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.1.tgz", + "integrity": "sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/metaharness": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/metaharness/-/metaharness-0.4.23.tgz", + "integrity": "sha512-1CheEEM0BddhPCUWm57DWviDvN88k8n0nm1bpGrsM/97En7nHY85ifQtSZp8k4xSxYPHRMsAS9UYA34XVccPKw==", + "license": "MIT", + "optional": true, + "dependencies": { + "@metaharness/avo": "0.2.1", + "@metaharness/darwin": "0.13.1", + "@metaharness/flywheel": "0.1.14", + "@metaharness/redblue": "0.1.7", + "@metaharness/turn-credit": "0.1.1", + "@metaharness/weight-eft": "0.1.3", + "kolorist": "^1.8.0", + "prompts": "^2.4.2" + }, + "bin": { + "harness": "dist/harness-bin.js", + "metaharness": "dist/bin.js" + }, + "engines": { + "node": ">=20.0.0" + }, + "optionalDependencies": { + "@ruvector/ruvllm": "^4.1.0" + }, + "peerDependencies": { + "@metaharness/kernel": "^0.1.0" + }, + "peerDependenciesMeta": { + "@metaharness/kernel": { + "optional": true + } + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "optional": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "license": "MIT", + "optional": true + }, + "node_modules/module-details-from-path": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/module-details-from-path/-/module-details-from-path-1.0.4.tgz", + "integrity": "sha512-EGWKgxALGMgzvxYF1UyGTy0HXX/2vHLkw6+NvDKW2jypWbHpjQuj4UMcqQWXHERJhVGKikolT06G3bcKe4fi7w==", + "license": "MIT", + "optional": true + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT", + "optional": true + }, + "node_modules/mute-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz", + "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==", + "license": "ISC", + "optional": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/napi-build-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz", + "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==", + "license": "MIT", + "optional": true + }, + "node_modules/negotiator": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.4.tgz", + "integrity": "sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-abi": { + "version": "3.101.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.101.0.tgz", + "integrity": "sha512-bkb/RkuWCE64eWu1PCh3Fu2pGc9mKRs+kOE+FU2bGHRYlQa86/D321DSATV54AsCQMKz3/xSt9sRgraZTpqdhQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-addon-api": { + "version": "8.9.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.9.2.tgz", + "integrity": "sha512-VijLXbi3UACN69I0JVXJsX4tjACjNoQDgv2gTF6sx2wWEi8tkSg2eX8p5gSIFi8z2+DL3oHmY6OyKce38SDolg==", + "license": "MIT", + "optional": true, + "engines": { + "node": "^18 || ^20 || >= 21" + } + }, + "node_modules/node-gyp-build": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", + "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", + "license": "MIT", + "optional": true, + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/on-finished": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.2.tgz", + "integrity": "sha512-ATWUv387i+nLD49EiDoOft5scf32Vsdz3ktrQJG9bi7jRFmaXTssvyvj1EmeKVVgvesbqUtvQQvaS2TpTukAZQ==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/on-headers": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.1.0.tgz", + "integrity": "sha512-737ZY3yNnXy37FHkQxPzt4UZ2UWPWiCZWLvFZ4fu5cueciegX0zGPnrlY6bwRg4FdQOe9YU8MkmJwGhoMybl8A==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/one-time": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz", + "integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==", + "license": "MIT", + "optional": true, + "dependencies": { + "fn.name": "1.x.x" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "license": "MIT", + "optional": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/onnxruntime-common": { + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/onnxruntime-common/-/onnxruntime-common-1.30.0.tgz", + "integrity": "sha512-7fdVWjAID1dVhH/G8qK3APARunV4VkBFoCQAP7qp4Wkab0mrorvmc+sqiT+mKXOzDqdjN5j+/Z9nb4gzNPWcyA==", + "license": "MIT", + "optional": true + }, + "node_modules/onnxruntime-node": { + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/onnxruntime-node/-/onnxruntime-node-1.30.0.tgz", + "integrity": "sha512-twhs1C2C/BFkz1yc5OY0KIU2GUq6DURO7hD4bx5Q2Qy3nAMJwRXW8xU3NVczE29VA9lolLOYepoD8fjTGOfIqw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "win32", + "darwin", + "linux" + ], + "dependencies": { + "adm-zip": "^0.6.0", + "global-agent": "^4.1.3", + "onnxruntime-common": "1.30.0" + } + }, + "node_modules/onnxruntime-web": { + "version": "1.31.0-dev.20260914-8d85527a0", + "resolved": "https://registry.npmjs.org/onnxruntime-web/-/onnxruntime-web-1.31.0-dev.20260914-8d85527a0.tgz", + "integrity": "sha512-Iy7rtadoBgxS/LLvDr3QW38DB1PNXRnr0GJMcL0TAt7c9qjgVQl83UlGCVyeAnK2InpmW8Uc3PL8XIuqtDeF6g==", + "license": "MIT", + "optional": true, + "dependencies": { + "flatbuffers": "^25.1.24", + "guid-typescript": "^1.0.9", + "long": "^5.2.3", + "onnxruntime-common": "1.31.0-dev.20260911-2a43ec07e", + "platform": "^1.3.6", + "protobufjs": "^7.2.4" + } + }, + "node_modules/onnxruntime-web/node_modules/onnxruntime-common": { + "version": "1.31.0-dev.20260911-2a43ec07e", + "resolved": "https://registry.npmjs.org/onnxruntime-common/-/onnxruntime-common-1.31.0-dev.20260911-2a43ec07e.tgz", + "integrity": "sha512-gBuF6U32YErKIAt+yD7DeGBpjRxhJ1uJwako6ygjokSZULDU6Pd+KWComX8Tumk1hYVHRxjPj7mdMnD0ryAPOw==", + "license": "MIT", + "optional": true + }, + "node_modules/ora": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "bl": "^4.1.0", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "optional": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.4.2.tgz", + "integrity": "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/pkce-challenge": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz", + "integrity": "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==", + "license": "MIT", + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/platform": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", + "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==", + "license": "MIT", + "optional": true + }, + "node_modules/prebuild-install": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", + "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==", + "deprecated": "No longer maintained. Please contact the author of the relevant native addon; alternatives are available.", + "license": "MIT", + "optional": true, + "dependencies": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^2.0.0", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/prom-client": { + "version": "15.1.3", + "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-15.1.3.tgz", + "integrity": "sha512-6ZiOBfCywsD4k1BN9IX0uZhF+tJkV8q8llP64G5Hajs4JOeVLPCwpPVcpXy3BwYiUGgyJzsJJQeOIv7+hDSq8g==", + "deprecated": "prom-client has been replaced by @prometheus-io/client", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/api": "^1.4.0", + "tdigest": "^0.1.1" + }, + "engines": { + "node": "^16 || ^18 || >=20" + } + }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "license": "MIT", + "optional": true, + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/protobufjs": { + "version": "7.6.6", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.6.6.tgz", + "integrity": "sha512-dYDWdjSl5RNb7SgPxGQcRU+GtvP7s2fpkrY0r432PcOIaZ0/rBcxEZnQN67iJhFuQiVw754JDoPruPCNdGsbjg==", + "hasInstallScript": true, + "license": "BSD-3-Clause", + "optional": true, + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.5", + "@protobufjs/eventemitter": "^1.1.1", + "@protobufjs/fetch": "^1.1.1", + "@protobufjs/float": "^1.0.2", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.1", + "@types/node": ">=13.7.0", + "long": "^5.3.2" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz", + "integrity": "sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/pump": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz", + "integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==", + "license": "MIT", + "optional": true, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/qs": { + "version": "6.17.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.17.1.tgz", + "integrity": "sha512-jd3COkaKVgGUW+ZHyEHCG9bH7RoaaiWuMgzsIBjUMVjLAaWGWpoUAVwljVvBHxRu/2qEHnadLGZrkutYUBPQJA==", + "license": "BSD-3-Clause", + "dependencies": { + "es-define-property": "^1.0.1", + "side-channel": "^1.1.1" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.3.0.tgz", + "integrity": "sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "optional": true, + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "optional": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-in-the-middle": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/require-in-the-middle/-/require-in-the-middle-8.0.1.tgz", + "integrity": "sha512-QT7FVMXfWOYFbeRBF6nu+I6tr2Tf3u0q8RIEjNob/heKY/nh7drD/k7eeMFmSQgnTtCzLDcCu/XEnpW2wk4xCQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "debug": "^4.3.5", + "module-details-from-path": "^1.0.3" + }, + "engines": { + "node": ">=9.3.0 || >=8.10.0 <9.0.0" + } + }, + "node_modules/require-in-the-middle/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "optional": true, + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/require-in-the-middle/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT", + "optional": true + }, + "node_modules/restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "license": "MIT", + "optional": true, + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/router/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/router/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/run-async": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-3.0.0.tgz", + "integrity": "sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/ruv-fann": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ruv-fann/-/ruv-fann-0.1.2.tgz", + "integrity": "sha512-gdHjT8EUz4tSPpBYkCjbpISwW7bcB5XvtDPeRqZps8M9DcDF+I3deiIBt9aw6hxqKphrnbzQSltiFYLUYc0vjQ==", + "license": "MIT", + "dependencies": { + "ruv-fann-wasm": "0.1.2" + }, + "engines": { + "node": ">=20.9.0" + } + }, + "node_modules/ruv-fann-wasm": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ruv-fann-wasm/-/ruv-fann-wasm-0.1.2.tgz", + "integrity": "sha512-wV0xT+yMoidjs6ndeTkTO0rNUiDAZ4H7aP6slbVbdM1vG3xS6iCS1/jDwknNBo+m37GBXN4kgFXHZ0yRmMP7oQ==", + "license": "MIT", + "engines": { + "node": ">=20.9.0" + } + }, + "node_modules/ruv-fann-wsp": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/ruv-fann-wsp/-/ruv-fann-wsp-0.1.0.tgz", + "integrity": "sha512-nFnbETlTYq3QmvobCWfIVbuuEDKuVK89FBrsv9+yhX4baabzLsfib5g2fLkShhZ1GLyA84KKKn+uALSp/F1Rww==", + "license": "MIT", + "dependencies": { + "ruv-fann": "0.1.2" + }, + "engines": { + "node": ">=20.9.0" + } + }, + "node_modules/ruvector": { + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/ruvector/-/ruvector-0.3.20.tgz", + "integrity": "sha512-2vtcLLtOyowVdjrkFuzIdQMgAVengcWUswlO4SA7GJVJ1okOfxwJbeYl/HfPfQaif3LzDA7TIJlEu8tBsE/axw==", + "license": "MIT", + "optional": true, + "dependencies": { + "@modelcontextprotocol/sdk": "^1.32.1", + "@ruvector/attention": "^2.3.0", + "@ruvector/core": "^0.1.36", + "@ruvector/gnn": "^0.1.22", + "@ruvector/sona": "^0.1.11", + "chalk": "^4.1.2", + "commander": "^11.1.0", + "ora": "^5.4.1" + }, + "bin": { + "ruvector": "bin/cli.js" + }, + "engines": { + "node": ">=20.0.0" + }, + "optionalDependencies": { + "@metaharness/darwin": "^0.13.0", + "@metaharness/flywheel": "^0.1.10", + "@metaharness/harness": "^0.2.0", + "@metaharness/redblue": "^0.1.6", + "@metaharness/router": "^0.4.0", + "@metaharness/weight-eft": "^0.1.1", + "@metaharness/workspace-lens": "^0.1.2", + "@metaharness/workspace-probe": "^0.1.1", + "@ruvector/mincut-wasm": "^2.3.0", + "@ruvector/rabitq-wasm": "^0.1.1", + "@ruvector/ruqu-wasm": "^2.2.0", + "@ruvector/rvf": "^0.4.7", + "@ruvector/tiny-dancer": "^0.1.22", + "metaharness": "^0.4.20" + }, + "peerDependencies": { + "@metaharness/darwin": "^0.13.0", + "@metaharness/flywheel": "^0.1.10", + "@metaharness/harness": "^0.2.0", + "@metaharness/redblue": "^0.1.6", + "@metaharness/router": "^0.4.0", + "@metaharness/weight-eft": "^0.1.1", + "@metaharness/workspace-lens": "^0.1.2", + "@metaharness/workspace-probe": "^0.1.1", + "@ruvector/diskann": "^0.1.0", + "@ruvector/pi-brain": "^0.1.0", + "@ruvector/rabitq-wasm": "^0.1.1", + "@ruvector/router": "^0.1.0", + "@ruvector/ruvllm": "^4.1.0", + "metaharness": "^0.4.20", + "rvlite": "^0.2.0" + }, + "peerDependenciesMeta": { + "@metaharness/darwin": { + "optional": true + }, + "@metaharness/flywheel": { + "optional": true + }, + "@metaharness/harness": { + "optional": true + }, + "@metaharness/redblue": { + "optional": true + }, + "@metaharness/router": { + "optional": true + }, + "@metaharness/weight-eft": { + "optional": true + }, + "@metaharness/workspace-lens": { + "optional": true + }, + "@metaharness/workspace-probe": { + "optional": true + }, + "@ruvector/diskann": { + "optional": true + }, + "@ruvector/pi-brain": { + "optional": true + }, + "@ruvector/rabitq-wasm": { + "optional": true + }, + "@ruvector/router": { + "optional": true + }, + "@ruvector/ruvllm": { + "optional": true + }, + "metaharness": { + "optional": true + }, + "rvlite": { + "optional": true + } + } + }, + "node_modules/ruvector-attention-wasm": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ruvector-attention-wasm/-/ruvector-attention-wasm-2.1.0.tgz", + "integrity": "sha512-swnpHBvlV6SWRaRP6GqGhTytj56dg5WnbBlShSNoOmfLLfc01oJUTeZuAepVDcfF8Z5ENKaWeHmGZPaBAReQrA==", + "license": "MIT", + "optional": true + }, + "node_modules/ruvector-core-darwin-arm64": { + "version": "0.1.35", + "resolved": "https://registry.npmjs.org/ruvector-core-darwin-arm64/-/ruvector-core-darwin-arm64-0.1.35.tgz", + "integrity": "sha512-KgQ3Ca1EERmjzdK5UwRRZ1+IibcPE2JyRi5j7mhEe8zd8IYBZmUASyV54+W/uPhEEOthr2l/pL/fFdACCpQkWw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/ruvector-core-darwin-x64": { + "version": "0.1.35", + "resolved": "https://registry.npmjs.org/ruvector-core-darwin-x64/-/ruvector-core-darwin-x64-0.1.35.tgz", + "integrity": "sha512-ff7tGlMtl46ggk8lS4uCyqh3u2D74Sls9oHhedgJfGVZxZWhrK067eXG6hybQEoZ0AOrrR4DMTtZ00Qf0QOVuQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/ruvector-core-linux-arm64-gnu": { + "version": "0.1.35", + "resolved": "https://registry.npmjs.org/ruvector-core-linux-arm64-gnu/-/ruvector-core-linux-arm64-gnu-0.1.35.tgz", + "integrity": "sha512-PS/AdTDQABPlJQVgHF+wtnP/qNwez/JQ9W2BhmXzWy36SzSkti8AQgVr/yxjPyLFU7dN0fnoVFHzXGx/V1+9Xw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/ruvector-core-linux-x64-gnu": { + "version": "0.1.35", + "resolved": "https://registry.npmjs.org/ruvector-core-linux-x64-gnu/-/ruvector-core-linux-x64-gnu-0.1.35.tgz", + "integrity": "sha512-hQ1d/OhNbqWePnFeNV6Zj8zafxS78sW+U8rlEIxDFs0v1ossVQN3VMa2aCUIVJIgNCKsnFf+k07MUK4yek05Yw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/ruvector-core-win32-x64-msvc": { + "version": "0.1.35", + "resolved": "https://registry.npmjs.org/ruvector-core-win32-x64-msvc/-/ruvector-core-win32-x64-msvc-0.1.35.tgz", + "integrity": "sha512-YxYkLBI1K+DNqz12Jw/IpWDV61MpNwceP5WjeT8XTmZyV/T/Wx06B8HdmWsIybCYoKMfMs2mugxYGkm1l3Crzg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 18" + } + }, + "node_modules/ruvector-graph-transformer-wasm": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/ruvector-graph-transformer-wasm/-/ruvector-graph-transformer-wasm-2.0.4.tgz", + "integrity": "sha512-O2u2OnE89YCa/0y2wmo6EkxXOFAPagDcjZ2HSx8kV7rvDLsgk+CQgoYGk4L/X8FM06Moiu09/P8/sWnjEv16/A==", + "license": "MIT", + "optional": true + }, + "node_modules/ruvector/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "optional": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ruvector/node_modules/commander": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", + "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "optional": true + }, + "node_modules/safe-stable-stringify": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", + "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.6.tgz", + "integrity": "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/send/node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/serialize-error": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-8.1.0.tgz", + "integrity": "sha512-3NnuWfM6vBYoy5gZFvHiYsVbafvI9vZv/+jlIigFn4oP4zjNPK3LhcY0xSCgeb1a5L8jO71Mit9LlNoi2UfDDQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/serialize-error/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "license": "(MIT OR CC0-1.0)", + "optional": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/sharp": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.5.tgz", + "integrity": "sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@img/colour": "^1.1.0", + "detect-libc": "^2.1.2", + "semver": "^7.8.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.35.5", + "@img/sharp-darwin-x64": "0.35.5", + "@img/sharp-freebsd-wasm32": "0.35.5", + "@img/sharp-libvips-darwin-arm64": "1.3.4", + "@img/sharp-libvips-darwin-x64": "1.3.4", + "@img/sharp-libvips-linux-arm": "1.3.4", + "@img/sharp-libvips-linux-arm64": "1.3.4", + "@img/sharp-libvips-linux-ppc64": "1.3.4", + "@img/sharp-libvips-linux-riscv64": "1.3.4", + "@img/sharp-libvips-linux-s390x": "1.3.4", + "@img/sharp-libvips-linux-x64": "1.3.4", + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4", + "@img/sharp-libvips-linuxmusl-x64": "1.3.4", + "@img/sharp-linux-arm": "0.35.5", + "@img/sharp-linux-arm64": "0.35.5", + "@img/sharp-linux-ppc64": "0.35.5", + "@img/sharp-linux-riscv64": "0.35.5", + "@img/sharp-linux-s390x": "0.35.5", + "@img/sharp-linux-x64": "0.35.5", + "@img/sharp-linuxmusl-arm64": "0.35.5", + "@img/sharp-linuxmusl-x64": "0.35.5", + "@img/sharp-webcontainers-wasm32": "0.35.5", + "@img/sharp-win32-arm64": "0.35.5", + "@img/sharp-win32-ia32": "0.35.5", + "@img/sharp-win32-x64": "0.35.5" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", + "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4", + "side-channel-list": "^1.0.1", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz", + "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "license": "ISC", + "optional": true + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "optional": true + }, + "node_modules/simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "optional": true, + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "license": "MIT", + "optional": true + }, + "node_modules/sql.js": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/sql.js/-/sql.js-1.16.0.tgz", + "integrity": "sha512-q/JOZuJfmVh8Zf8Eo+cMJvtxAWeWBqTfJ6AQYGXZmcaLGHMwhA2niH3fQYHrBtPeOss1ttzHec07K5+rHaMRMw==", + "license": "MIT" + }, + "node_modules/stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==", + "license": "MIT", + "optional": true, + "engines": { + "node": "*" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "optional": true, + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "optional": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "optional": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "license": "MIT", + "optional": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tar-fs": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.5.tgz", + "integrity": "sha512-OboTd8mmMhZDNPV+UjQcK9yKAatXu2aJ+r1w4im1Otd4M4fl2hwvdoXUxIYHFTHWK/3y3FarBP70v3vwmGlOxw==", + "license": "MIT", + "optional": true, + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tdigest": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.3.tgz", + "integrity": "sha512-zbRt+lT+/H4fRItHshczHErVCQnitJk8MfMT24MqFJf3YL7SJJPqGIGeuOdvxXxM/AHFzKBl7WoyaYwqO9s3Kw==", + "license": "MIT", + "optional": true, + "dependencies": { + "bintrees": "1.0.2" + } + }, + "node_modules/text-hex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", + "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==", + "license": "MIT", + "optional": true + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/triple-beam": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.4.1.tgz", + "integrity": "sha512-aZbgViZrg1QNcG+LULa7nhZpJTZSLm/mXnHXnbAbjmN5aSa0y7V+wvv6+4WaBtpISJzThKy+PIPxc1Nq1EJ9mg==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/tslib": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz", + "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==", + "license": "0BSD", + "optional": true + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "license": "(MIT OR CC0-1.0)", + "optional": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/type-is": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz", + "integrity": "sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==", + "license": "MIT", + "dependencies": { + "content-type": "^2.0.0", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/type-is/node_modules/content-type": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-2.1.0.tgz", + "integrity": "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "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", + "optional": true + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT", + "optional": true + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "license": "MIT", + "optional": true, + "dependencies": { + "defaults": "^1.0.3" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/winston": { + "version": "3.19.0", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.19.0.tgz", + "integrity": "sha512-LZNJgPzfKR+/J3cHkxcpHKpKKvGfDZVPS4hfJCc4cCG0CgYzvlD6yE/S3CIL/Yt91ak327YCpiF/0MyeZHEHKA==", + "license": "MIT", + "optional": true, + "dependencies": { + "@colors/colors": "^1.6.0", + "@dabh/diagnostics": "^2.0.8", + "async": "^3.2.3", + "is-stream": "^2.0.0", + "logform": "^2.7.0", + "one-time": "^1.0.0", + "readable-stream": "^3.4.0", + "safe-stable-stringify": "^2.3.1", + "stack-trace": "0.0.x", + "triple-beam": "^1.3.0", + "winston-transport": "^4.9.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/winston-transport": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.9.0.tgz", + "integrity": "sha512-8drMJ4rkgaPo1Me4zD/3WLfI/zPdA9o2IipKODunnGDcuqbHwjsbB79ylv04LCGGzU0xQ6vTznOMpQGaLhhm6A==", + "license": "MIT", + "optional": true, + "dependencies": { + "logform": "^2.7.0", + "readable-stream": "^3.6.2", + "triple-beam": "^1.3.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, + "node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "license": "MIT", + "optional": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "optional": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yaml": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.1.tgz", + "integrity": "sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw==", + "license": "ISC", + "optional": true, + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14.6" + }, + "funding": { + "url": "https://github.com/sponsors/eemeli" + } + }, + "node_modules/yargs": { + "version": "17.7.3", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.3.tgz", + "integrity": "sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g==", + "license": "MIT", + "optional": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "license": "ISC", + "optional": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/yoctocolors-cjs": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/yoctocolors-cjs/-/yoctocolors-cjs-2.1.3.tgz", + "integrity": "sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "4.6.7", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz", + "integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-to-json-schema": { + "version": "3.25.2", + "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.2.tgz", + "integrity": "sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA==", + "license": "ISC", + "peerDependencies": { + "zod": "^3.25.28 || ^4" + } + } + } +} diff --git a/packages/wsp-toolkit/tooling/agentdb/package.json b/packages/wsp-toolkit/tooling/agentdb/package.json new file mode 100644 index 000000000..74d6fc5ae --- /dev/null +++ b/packages/wsp-toolkit/tooling/agentdb/package.json @@ -0,0 +1,9 @@ +{ + "name": "wsp-agentdb-integration-runtime", + "private": true, + "version": "0.1.0", + "type": "module", + "engines": { "node": ">=20.9.0" }, + "dependencies": { "agentdb": "3.10.0" }, + "scripts": { "audit": "npm audit --audit-level=high" } +} diff --git a/packages/wsp-toolkit/tooling/agentdb/runtime.mjs b/packages/wsp-toolkit/tooling/agentdb/runtime.mjs new file mode 100644 index 000000000..0b0cb6ea0 --- /dev/null +++ b/packages/wsp-toolkit/tooling/agentdb/runtime.mjs @@ -0,0 +1,37 @@ +import { createAgentDBRegistry } from '../../packages/registry/src/index.js'; + +/** Explicit integration fixture. Dependencies are installed by setup, never here. */ +export async function openDemoRegistry(filename, registryFactory = createAgentDBRegistry) { + if (typeof filename !== 'string' || filename.length < 1 || filename.length > 4096 || /[\x00-\x1f]/.test(filename)) + throw new TypeError('filename must be a bounded local database path'); + if (typeof registryFactory !== 'function') throw new TypeError('registryFactory must be a trusted constructor function'); + let createDatabase, WeightPrograms; + try { + ({ createDatabase } = await import('agentdb/db-fallback')); + ({ WeightPrograms } = await import('agentdb/controllers/WeightPrograms')); + } catch (error) { + throw new Error('AgentDB integration runtime is missing; run npm ci --prefix tooling/agentdb --ignore-scripts --omit=optional', { cause: error }); + } + const db = await createDatabase(filename); + let programs; + try { + programs = new WeightPrograms(db, { simd: false }); + return registryFactory(programs, { + flush: () => db.save?.(), + close: ({ poisoned }) => { + programs.dispose(); + // Every acknowledged mutation was already flushed. Avoid sql.js close() + // performing another write, including from a stale read-only instance. + // On poison this also discards uncertain unflushed memory; inspect disk + // after reopen rather than assuming a failed acknowledgement was absent. + if (typeof db.save === 'function') db.save = () => {}; + db.close(); + } + }); + } catch (error) { + programs?.dispose(); + if (typeof db.save === 'function') db.save = () => {}; + try { db.close(); } catch { /* preserve setup error */ } + throw error; + } +} diff --git a/packages/wsp-toolkit/tsconfig.json b/packages/wsp-toolkit/tsconfig.json new file mode 100644 index 000000000..7a7d3ba01 --- /dev/null +++ b/packages/wsp-toolkit/tsconfig.json @@ -0,0 +1,4 @@ +{ + "compilerOptions": { "target": "ES2023", "module": "NodeNext", "moduleResolution": "NodeNext", "strict": true, "noEmit": true, "lib": ["ES2023", "DOM"], "skipLibCheck": false }, + "include": ["packages/*/src/*.d.ts", "test/types.ts"] +} diff --git a/scripts/constellation-oidc.mjs b/scripts/constellation-oidc.mjs new file mode 100644 index 000000000..7c0455a6b --- /dev/null +++ b/scripts/constellation-oidc.mjs @@ -0,0 +1,127 @@ +/** Local configuration guards for npm trusted publishing; npm verifies the actual OIDC identity. */ +export const WSP_OIDC_POLICY = Object.freeze({ + repository: 'ruvnet/ruv-FANN', + workflowFile: 'protected-wsp-release.yml', + workflowName: 'protected-release', + job: 'publish', + eventName: 'workflow_dispatch', + ref: 'refs/heads/main' +}); + +const own = Object.getOwnPropertyDescriptor; +function data(object, key, label) { + const descriptor = own(object, key); + if (!descriptor) return undefined; + if (!Object.hasOwn(descriptor, 'value')) throw new TypeError(`${label} must contain data fields only`); + return descriptor.value; +} +function plain(value, allowed, required, label) { + if (!value || typeof value !== 'object' || Array.isArray(value) || + ![Object.prototype, null].includes(Object.getPrototypeOf(value))) throw new TypeError(`${label} must be a plain data object`); + const out = Object.create(null); + for (const key of Reflect.ownKeys(value)) { + if (typeof key !== 'string' || !allowed.includes(key)) throw new TypeError(`unknown ${label} field`); + out[key] = data(value, key, label); + } + if (required.some(key => !Object.hasOwn(out, key))) throw new TypeError(`missing ${label} field`); + return out; +} +function version(value, label) { + if (typeof value !== 'string' || value.length > 40 || !/^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(value)) + throw new TypeError(`${label} must be a stable three-part version`); + const numbers = value.replace(/^v/, '').split('.').map(Number); + if (numbers.some(value => !Number.isSafeInteger(value))) throw new TypeError(`invalid ${label} version`); + return numbers; +} +function atLeast(actual, minimum) { + for (let index = 0; index < minimum.length; index++) { + if (actual[index] > minimum[index]) return true; + if (actual[index] < minimum[index]) return false; + } + return true; +} +function fallbackKey(key) { + const normalized = key.toLowerCase(); + if (normalized === 'npm_token' || normalized === 'node_auth_token') return true; + return normalized.startsWith('npm_config_') && /(?:^|[_/:])(?:auth|authtoken|password|username)(?:$|[_:])/.test(normalized.slice('npm_config_'.length)); +} +function envValue(env, key) { + const value = data(env, key, 'publish environment'); + if (value !== undefined && typeof value !== 'string') throw new TypeError('publish environment values must be strings'); + return value; +} +function string(value, label, maximum = 4096) { + if (typeof value !== 'string' || value.length < 1 || value.length > maximum || /[\x00-\x1f\x7f]/.test(value)) + throw new TypeError(`${label} must be a bounded nonempty string`); + return value; +} +function policySnapshot(value) { + const out = plain(value, ['repository', 'workflowFile', 'workflowName', 'job', 'eventName', 'ref'], + ['repository', 'workflowFile', 'workflowName', 'job', 'eventName', 'ref'], 'OIDC policy'); + if (typeof out.repository !== 'string' || !/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(out.repository)) throw new TypeError('invalid OIDC repository policy'); + if (typeof out.workflowFile !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}\.ya?ml$/.test(out.workflowFile)) throw new TypeError('invalid OIDC workflow policy'); + for (const key of ['workflowName', 'job', 'eventName', 'ref']) string(out[key], `OIDC ${key} policy`, 256); + if (!/^refs\/heads\/[A-Za-z0-9_.\/-]+$/.test(out.ref)) throw new TypeError('OIDC policy must select a branch'); + return out; +} + +/** + * Configuration guard only. Environment strings are not an attestation; npm must + * exchange the real GitHub token and match the package's trusted-publisher registration. + */ +export function validateOIDCPublishContext(configuration, policy = WSP_OIDC_POLICY) { + const input = plain(configuration, ['env', 'sourceSha', 'checkoutSha', 'nodeVersion', 'npmVersion'], + ['env', 'sourceSha', 'checkoutSha', 'nodeVersion', 'npmVersion'], 'OIDC publish context'); + const expected = policySnapshot(policy), env = input.env; + if (!env || typeof env !== 'object' || Array.isArray(env)) throw new TypeError('publish environment is required'); + for (const key of Reflect.ownKeys(env)) { + if (typeof key !== 'string') throw new TypeError('publish environment contains invalid fields'); + const value = envValue(env, key); + if (fallbackKey(key) && value !== undefined && value !== '') + throw new Error('Tokenless publishing refuses npm credential fallback; remove npm auth environment values'); + } + if (!atLeast(version(input.nodeVersion, 'Node'), [22, 14, 0])) throw new Error('npm OIDC publishing requires Node >=22.14.0'); + if (!atLeast(version(input.npmVersion, 'npm'), [11, 5, 1])) throw new Error('npm OIDC publishing requires npm >=11.5.1'); + if (typeof input.sourceSha !== 'string' || !/^[a-f0-9]{40}$/.test(input.sourceSha) || input.checkoutSha !== input.sourceSha) + throw new Error('OIDC publishing requires the exact reviewed checkout SHA'); + const workflowRef = `${expected.repository}/.github/workflows/${expected.workflowFile}@${expected.ref}`; + const checks = { GITHUB_ACTIONS: 'true', GITHUB_REPOSITORY: expected.repository, GITHUB_REF: expected.ref, + GITHUB_WORKFLOW_REF: workflowRef, GITHUB_WORKFLOW: expected.workflowName, GITHUB_JOB: expected.job, + GITHUB_EVENT_NAME: expected.eventName, GITHUB_SHA: input.sourceSha }; + for (const [key, value] of Object.entries(checks)) if (envValue(env, key) !== value) + throw new Error('OIDC publishing requires the exact protected repository, workflow, job, event, branch and source'); + const urlValue = string(envValue(env, 'ACTIONS_ID_TOKEN_REQUEST_URL'), 'GitHub OIDC request URL', 8192); + let url; + try { url = new URL(urlValue); } catch { throw new Error('invalid GitHub OIDC request endpoint'); } + if (url.protocol !== 'https:' || url.username || url.password || url.hash || url.port || + !(url.hostname === 'actions.githubusercontent.com' || url.hostname.endsWith('.actions.githubusercontent.com'))) + throw new Error('GitHub OIDC request endpoint must use HTTPS on the GitHub Actions token host'); + string(envValue(env, 'ACTIONS_ID_TOKEN_REQUEST_TOKEN'), 'GitHub OIDC request capability', 32768); + return Object.freeze({ schema: 'ruvnet.oidc-publish-context/1', provider: 'github-actions', mode: 'oidc-only', + evidence: 'configuration-validated', repository: expected.repository, workflowRef, job: expected.job, + eventName: expected.eventName, sourceSha: input.sourceSha, + nodeVersion: input.nodeVersion, npmVersion: input.npmVersion }); +} + +/** + * Build a child environment for an isolated auth-free npm working directory. + * Never serialize this object: it preserves the short-lived Actions OIDC capability. + */ +export function createTokenlessPublishEnvironment(environment, configuration) { + if (!environment || typeof environment !== 'object' || Array.isArray(environment)) throw new TypeError('publish environment is required'); + const settings = plain(configuration, ['userConfig', 'globalConfig', 'cache'], ['userConfig', 'globalConfig', 'cache'], 'npm isolation'); + for (const key of Object.keys(settings)) string(settings[key], `npm ${key} path`); + const owned = Object.create(null); + for (const key of Reflect.ownKeys(environment)) { + if (typeof key !== 'string') throw new TypeError('publish environment contains invalid fields'); + const value = envValue(environment, key); + if (fallbackKey(key) || ['gh_token', 'github_token', 'npm_config_userconfig', 'npm_config_globalconfig', 'npm_config_cache', 'npm_config_registry', 'npm_config_provenance'].includes(key.toLowerCase())) continue; + if (value !== undefined) owned[key] = value; + } + owned.NPM_CONFIG_USERCONFIG = settings.userConfig; + owned.NPM_CONFIG_GLOBALCONFIG = settings.globalConfig; + owned.NPM_CONFIG_CACHE = settings.cache; + owned.NPM_CONFIG_REGISTRY = 'https://registry.npmjs.org'; + owned.NPM_CONFIG_PROVENANCE = 'true'; + return owned; +} diff --git a/scripts/constellation-oidc.test.mjs b/scripts/constellation-oidc.test.mjs new file mode 100644 index 000000000..7dbb67b01 --- /dev/null +++ b/scripts/constellation-oidc.test.mjs @@ -0,0 +1,128 @@ +import assert from 'node:assert/strict'; +import test from 'node:test'; +import { readFile, mkdtemp, writeFile, rm } from 'node:fs/promises'; +import { join } from 'node:path'; +import { tmpdir } from 'node:os'; +import { spawnSync, execFileSync } from 'node:child_process'; +import { validateOIDCPublishContext, createTokenlessPublishEnvironment, WSP_OIDC_POLICY } from './constellation-oidc.mjs'; + +const sourceSha = 'a'.repeat(40), oidcCapability = 'test-only-ephemeral-capability'; +function context() { + return { sourceSha, checkoutSha: sourceSha, nodeVersion: 'v24.22.1', npmVersion: '11.9.0', env: { + GITHUB_ACTIONS: 'true', GITHUB_REPOSITORY: 'ruvnet/ruv-FANN', GITHUB_REF: 'refs/heads/main', + GITHUB_WORKFLOW_REF: 'ruvnet/ruv-FANN/.github/workflows/protected-wsp-release.yml@refs/heads/main', + GITHUB_WORKFLOW: 'protected-release', GITHUB_JOB: 'publish', GITHUB_EVENT_NAME: 'workflow_dispatch', GITHUB_SHA: sourceSha, + ACTIONS_ID_TOKEN_REQUEST_URL: 'https://run-actions-1.actions.githubusercontent.com/example/_apis/distributedtask/hubs/build/plans/plan/jobs/job/idtoken?api-version=2.0', + ACTIONS_ID_TOKEN_REQUEST_TOKEN: oidcCapability, + NODE_AUTH_TOKEN: '', NPM_TOKEN: '' + } }; +} + +test('protected stable OIDC context accepts minimum tool versions without claiming token attestation', () => { + const input = context();input.nodeVersion = 'v22.14.0';input.npmVersion = '11.5.1'; + const proof = validateOIDCPublishContext(input); + assert.equal(proof.mode, 'oidc-only');assert.equal(proof.evidence, 'configuration-validated'); + assert.equal(proof.sourceSha, sourceSha);assert.equal(proof.repository, WSP_OIDC_POLICY.repository); + assert.equal(Object.isFrozen(proof), true); + const text = JSON.stringify(proof); + assert.equal(text.includes(oidcCapability), false);assert.equal(text.includes('idtoken?'), false); + assert.equal('ACTIONS_ID_TOKEN_REQUEST_TOKEN' in proof, false); + input.env.GITHUB_REPOSITORY = 'changed/repo';assert.equal(proof.repository, 'ruvnet/ruv-FANN'); +}); + +test('runtime floor rejects unsupported, prerelease and malformed versions', () => { + for (const value of ['v20.20.2', 'v22.13.0', 'v22.14.0-rc.1', 'v022.14.0', 'v24', null]) { + const input=context();input.nodeVersion=value;assert.throws(() => validateOIDCPublishContext(input)); + } + for (const value of ['10.9.0', '11.5.0', '11.5.1-beta.1', '11.09.0', 'latest', null]) { + const input=context();input.npmVersion=value;assert.throws(() => validateOIDCPublishContext(input)); + } + const input=context();input.nodeVersion='v26.1.0';input.npmVersion='12.0.0';validateOIDCPublishContext(input); +}); + +test('local, fork, PR, wrong job/workflow/event, unreviewed source and stale checkout all fail closed', () => { + const changes = { GITHUB_ACTIONS: 'false', GITHUB_REPOSITORY: 'fork/ruv-FANN', GITHUB_REF: 'refs/pull/17/merge', + GITHUB_WORKFLOW_REF: 'ruvnet/ruv-FANN/.github/workflows/other.yml@refs/heads/main', GITHUB_WORKFLOW: 'qualification', + GITHUB_JOB: 'qualify', GITHUB_EVENT_NAME: 'pull_request_target', GITHUB_SHA: 'b'.repeat(40) }; + for (const [key,value] of Object.entries(changes)) { + const input=context();input.env[key]=value;assert.throws(() => validateOIDCPublishContext(input)); + } + const wrongCheckout=context();wrongCheckout.checkoutSha='b'.repeat(40);assert.throws(() => validateOIDCPublishContext(wrongCheckout)); + const invalidSha=context();invalidSha.sourceSha='not-reviewed';assert.throws(() => validateOIDCPublishContext(invalidSha)); + const absent=context();delete absent.env.GITHUB_EVENT_NAME;assert.throws(() => validateOIDCPublishContext(absent)); +}); + +test('OIDC endpoint and capability must exist and cannot select an external or credentialed host', () => { + for (const url of ['http://run-actions.actions.githubusercontent.com/token', 'https://actions.githubusercontent.com.evil.test/token', + 'https://user:secret@run-actions.actions.githubusercontent.com/token', 'https://run-actions.actions.githubusercontent.com:8443/token', + 'https://run-actions.actions.githubusercontent.com/token#fragment', 'not a URL', '', null]) { + const input=context();input.env.ACTIONS_ID_TOKEN_REQUEST_URL=url;assert.throws(() => validateOIDCPublishContext(input)); + } + for (const value of ['', undefined, null, 'line\nbreak']) { + const input=context();input.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN=value;assert.throws(() => validateOIDCPublishContext(input)); + } +}); + +test('credential fallback is refused in all supported environment spellings without disclosing values', () => { + for (const key of ['NPM_TOKEN', 'NODE_AUTH_TOKEN', 'npm_token', 'npm_config__auth', 'NPM_CONFIG__AUTHTOKEN', + 'npm_config_//registry.npmjs.org/:_authToken', 'npm_config_//registry.npmjs.org/:_password', 'npm_config_username']) { + const input=context();input.env[key]='credential-value-must-not-appear'; + assert.throws(() => validateOIDCPublishContext(input), error => { + assert.equal(error.message.includes('credential-value-must-not-appear'), false); + return /refuses npm credential fallback/.test(error.message); + }); + } +}); + +test('data-only configuration never invokes getters and refuses unknown fields', () => { + let calls=0; + const input=context();Object.defineProperty(input.env,'NODE_AUTH_TOKEN',{get(){calls++;return 'hidden';}}); + assert.throws(() => validateOIDCPublishContext(input), /data fields/);assert.equal(calls,0); + const top=context();Object.defineProperty(top,'sourceSha',{get(){calls++;return sourceSha;}}); + assert.throws(() => validateOIDCPublishContext(top));assert.equal(calls,0); + assert.throws(() => validateOIDCPublishContext({...context(),allowTokenFallback:true})); + const wrongType=context();wrongType.env.UNRELATED={toString(){calls++;return 'side effect';}}; + assert.throws(() => validateOIDCPublishContext(wrongType));assert.equal(calls,0); +}); + +test('isolated publish environment removes token/config fallback, retains proxy/CA and OIDC, and owns its copy', () => { + const input={...context().env, NPM_TOKEN:'npm-secret', GH_TOKEN:'github-secret', GITHUB_TOKEN:'github-secret', + npm_config__auth:'basic-secret', 'npm_config_//registry.npmjs.org/:_authToken':'other-secret', + npm_config_userconfig:'/ambient/secret.npmrc', NPM_CONFIG_GLOBALCONFIG:'/ambient/global.npmrc', + npm_config_registry:'https://untrusted.invalid', npm_config_cache:'/ambient/cache', + HTTPS_PROXY:'http://approved-proxy:8080', NODE_EXTRA_CA_CERTS:'/approved/ca.pem'}; + const env=createTokenlessPublishEnvironment(input,{userConfig:'/isolated/user.npmrc',globalConfig:'/isolated/global.npmrc',cache:'/isolated/cache'}); + for(const key of ['NPM_TOKEN','NODE_AUTH_TOKEN','GH_TOKEN','GITHUB_TOKEN','npm_config__auth','npm_config_//registry.npmjs.org/:_authToken','npm_config_userconfig','npm_config_registry','npm_config_cache']) + assert.equal(Object.hasOwn(env,key),false,key); + assert.equal(env.NPM_CONFIG_USERCONFIG,'/isolated/user.npmrc');assert.equal(env.NPM_CONFIG_GLOBALCONFIG,'/isolated/global.npmrc'); + assert.equal(env.NPM_CONFIG_REGISTRY,'https://registry.npmjs.org');assert.equal(env.NPM_CONFIG_PROVENANCE,'true'); + assert.equal(env.NPM_CONFIG_CACHE,'/isolated/cache');assert.equal(env.HTTPS_PROXY,input.HTTPS_PROXY);assert.equal(env.NODE_EXTRA_CA_CERTS,input.NODE_EXTRA_CA_CERTS); + assert.equal(env.ACTIONS_ID_TOKEN_REQUEST_TOKEN,oidcCapability);assert.equal(input.NPM_TOKEN,'npm-secret'); + env.PATH='changed';assert.equal(input.PATH,undefined); +}); + +test('actual publication entry point rejects a foreign context before registry or gh operations', async () => { + const directory=await mkdtemp(join(tmpdir(),'wsp-oidc-entry-')); + try { + const checkoutSha=execFileSync('git',['rev-parse','HEAD'],{encoding:'utf8',cwd:new URL('..',import.meta.url)}).trim(); + const file=join(directory,'seal.json');await writeFile(file,JSON.stringify({sourceSha:checkoutSha})); + const env={...process.env,...context().env,GITHUB_REPOSITORY:'foreign/forbidden',GITHUB_SHA:checkoutSha}; + const result=spawnSync(process.execPath,[new URL('./wsp-release-lane.mjs',import.meta.url).pathname,'publish','--seal',file,'--output',join(directory,'publication.json')], + {encoding:'utf8',env,timeout:10000}); + assert.notEqual(result.status,0);assert.match(result.stderr,/OIDC publishing requires (?:the exact protected|Node >=22\.14\.0)/); + assert.equal(result.stderr.includes(oidcCapability),false); + await assert.rejects(readFile(join(directory,'publication.json')),error=>error.code==='ENOENT'); + } finally {await rm(directory,{recursive:true,force:true});} +}); + +test('protected workflow pins tools, grants OIDC and preserves exact-archive qualification without npm secrets', async () => { + const workflow=await readFile(new URL('../.github/workflows/protected-wsp-release.yml',import.meta.url),'utf8'); + const lane=await readFile(new URL('./wsp-release-lane.mjs',import.meta.url),'utf8'); + assert.match(workflow,/id-token: write/);assert.match(workflow,/node-version: '24\.22\.1'/);assert.match(workflow,/npm@11\.9\.0/); + assert.doesNotMatch(workflow,/secrets\.NPM_TOKEN/);assert.match(workflow,/NODE_AUTH_TOKEN: ''/);assert.match(workflow,/NPM_TOKEN: ''/); + assert.match(workflow,/wsp-candidate-download\.mjs --expected-sha/); + assert.match(lane,/validateOIDCPublishContext\(/);assert.match(lane,/await verifySeal\(seal, dirname\(sealPath\)\)/); + assert.match(lane,/'--ignore-scripts', '--access', 'public', '--provenance'/); + assert.match(lane,/createTokenlessPublishEnvironment\(process\.env/); + assert.doesNotMatch(lane,/Missing NPM_TOKEN/); +}); diff --git a/scripts/wsp-release-lane.mjs b/scripts/wsp-release-lane.mjs index b691c32ac..3f606dc7d 100644 --- a/scripts/wsp-release-lane.mjs +++ b/scripts/wsp-release-lane.mjs @@ -9,6 +9,7 @@ import { join, resolve, basename, dirname, extname, sep } from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; import { runWorkbenchProbe, runWorkbenchSecurityProbe } from './wsp-workbench-probes.mjs'; import { validateWorkbenchProof, validateSecurity, validateBenchmark } from './wsp-release-evidence.mjs'; +import { validateOIDCPublishContext, createTokenlessPublishEnvironment } from './constellation-oidc.mjs'; const root = resolve(fileURLToPath(new URL('..', import.meta.url))); const argv = process.argv.slice(2); @@ -429,26 +430,42 @@ async function verifySeal(seal, directory) { async function publish() { const sealPath = resolve(required('seal')); const seal = await json(sealPath); + const publishContext = validateOIDCPublishContext({ env: process.env, sourceSha: seal.sourceSha, checkoutSha: gitSha(), + nodeVersion: process.version, npmVersion: exec('npm', ['--version']) }); protectedContext(seal.sourceSha); - if (seal.name !== identity.name || seal.version !== identity.version || seal.releaseTag !== identity.tag || !process.env.NODE_AUTH_TOKEN) - throw new Error('Missing NPM_TOKEN or invalid WSP sealed identity'); + if (seal.name !== identity.name || seal.version !== identity.version || seal.releaseTag !== identity.tag) + throw new Error('Invalid WSP sealed publication identity'); const archivePath = join(dirname(sealPath), seal.tarball); const archiveBytes = await verifySeal(seal, dirname(sealPath)); const existing = await publicTarball(seal); if (existing) { if (sha256(existing) !== seal.sha256) throw new Error('The public WSP version already exists with different bytes'); } else { - try { exec('npm', ['publish', archivePath, '--ignore-scripts', '--access', 'public', '--provenance', '--registry=https://registry.npmjs.org'], root); } - catch (error) { - // An earlier protected attempt may have completed its upload; accept it only after exact-byte proof. - try { await awaitPublic(seal); } catch { throw error; } - } + // Run outside the checkout with both npm config files under our control. The + // only publication credential inherited by npm is the ephemeral Actions OIDC capability. + const publishDirectory = await mkdtemp(join(tmpdir(), 'wsp-tokenless-publish-')); + try { + const userConfig = join(publishDirectory, 'user.npmrc'), globalConfig = join(publishDirectory, 'global.npmrc'); + await writeFile(userConfig, 'registry=https://registry.npmjs.org\nprovenance=true\n', { mode: 0o600, flag: 'wx' }); + await writeFile(globalConfig, '', { mode: 0o600, flag: 'wx' }); + await writeFile(join(publishDirectory, '.npmrc'), 'registry=https://registry.npmjs.org\nprovenance=true\n', { mode: 0o600, flag: 'wx' }); + await writeFile(join(publishDirectory, 'package.json'), JSON.stringify({ private: true }), { mode: 0o600, flag: 'wx' }); + const publishArchive = join(publishDirectory, basename(archivePath)); + await writeFile(publishArchive, archiveBytes, { mode: 0o600, flag: 'wx' }); + const publishEnvironment = createTokenlessPublishEnvironment(process.env, { userConfig, globalConfig, cache: join(publishDirectory, 'cache') }); + try { exec('npm', ['publish', publishArchive, '--ignore-scripts', '--access', 'public', '--provenance', '--registry=https://registry.npmjs.org'], publishDirectory, publishEnvironment); } + catch (error) { + // An earlier protected attempt may have completed its upload; accept it only after exact-byte proof. + try { await awaitPublic(seal); } catch { throw error; } + } + } finally { await rm(publishDirectory, { recursive: true, force: true }); } } await awaitPublic(seal); const output = resolve(required('output')); await mkdir(dirname(output), { recursive: true }); await saveNew(output, { schema: 'ruv-fann-wsp.npm-publication/1', sourceSha: seal.sourceSha, - releaseTag: seal.releaseTag, package: seal.name, version: seal.version, sha256: seal.sha256, status: 'public-byte-verified' }); + releaseTag: seal.releaseTag, package: seal.name, version: seal.version, sha256: seal.sha256, status: 'public-byte-verified', + authentication: publishContext, publication: existing ? 'identical-existing-version' : 'published-or-recovered' }); } async function publicConsumer() { From a1f65d8e5b65b09c0d378d2ea5736f71eb85fefe Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 22:55:20 -0500 Subject: [PATCH 02/20] fix(huggingface): enforce deadlines for stalled transports and streams --- .../packages/huggingface/src/index.js | 29 ++++++++++++----- .../packages/huggingface/test/hub.test.mjs | 31 +++++++++++++++++++ 2 files changed, 52 insertions(+), 8 deletions(-) diff --git a/packages/wsp-toolkit/packages/huggingface/src/index.js b/packages/wsp-toolkit/packages/huggingface/src/index.js index 0c24ae799..512111dbf 100644 --- a/packages/wsp-toolkit/packages/huggingface/src/index.js +++ b/packages/wsp-toolkit/packages/huggingface/src/index.js @@ -48,7 +48,19 @@ async function fileHash(bytes) { return Array.from(new Uint8Array(digest), byte => byte.toString(16).padStart(2, '0')).join(''); } -async function readBytes(response, maximum) { +// Enforce our deadline even when a caller's trusted transport does not honor +// AbortSignal. Cancellation is cooperative; the caller-facing promise is bounded. +function abortable(promise, signal) { + if (signal.aborted) return Promise.reject(signal.reason); + return new Promise((resolve, reject) => { + const cleanup = () => signal.removeEventListener('abort', abort); + const abort = () => { cleanup(); reject(signal.reason); }; + signal.addEventListener('abort', abort, { once: true }); + Promise.resolve(promise).then(value => { cleanup(); resolve(value); }, error => { cleanup(); reject(error); }); + }); +} + +async function readBytes(response, maximum, signal) { if (!response.body || typeof response.body.getReader !== 'function') throw new TypeError('Hub response requires a readable stream'); const reader = response.body.getReader(); try { @@ -58,7 +70,7 @@ async function readBytes(response, maximum) { const bytes = new Uint8Array(maximum); let count = 0; for (;;) { - const { done, value } = await reader.read(); + const { done, value } = await abortable(reader.read(), signal); if (done) break; if (!(value instanceof Uint8Array)) throw new TypeError('Hub response stream must contain bytes'); if (value.byteLength > maximum - count) throw new RangeError('Hub response exceeds the streamed byte limit'); @@ -67,9 +79,10 @@ async function readBytes(response, maximum) { } return bytes.subarray(0, count); } catch (error) { - await reader.cancel().catch(() => {}); + // An injected transport may also ignore cancellation; do not await it. + try { Promise.resolve(reader.cancel()).catch(() => {}); } catch { /* preserve failure */ } throw error; - } finally { reader.releaseLock(); } + } finally { try { reader.releaseLock(); } catch { /* an aborted custom read may still be pending */ } } } function redirectTarget(location, current) { @@ -103,25 +116,25 @@ async function loadPinnedJSON(source, options = {}) { let response; for (let redirects = 0; ; redirects++) { controller.signal.throwIfAborted(); - response = await fetcher(current, { redirect: 'manual', credentials: 'omit', referrerPolicy: 'no-referrer', signal: controller.signal }); + response = await abortable(fetcher(current, { redirect: 'manual', credentials: 'omit', referrerPolicy: 'no-referrer', signal: controller.signal }), controller.signal); if (!response || !response.headers || response.redirected || response.type === 'opaqueredirect') throw new TypeError('fetch must expose manual redirect responses'); if (response.url && new URL(response.url).origin !== ORIGIN) throw new TypeError('unexpected cross-origin Hub response'); if (response.status >= 300 && response.status < 400) { - await response.body?.cancel(); + await abortable(response.body?.cancel(), controller.signal); const location = response.headers.get('location'); if (!location || redirects >= MAX_REDIRECTS) throw new Error('Hub redirect is missing a location or exceeds the redirect limit'); current = redirectTarget(location, current); continue; } if (response.status !== 200) { - await response.body?.cancel(); + await abortable(response.body?.cancel(), controller.signal); throw new Error(`Hub download failed with HTTP ${response.status}`); } break; } - const bytes = await readBytes(response, pinned.maxBytes); + const bytes = await readBytes(response, pinned.maxBytes, controller.signal); controller.signal.throwIfAborted(); const sha256 = await fileHash(bytes); if (sha256 !== pinned.sha256) throw new Error('Hub file SHA-256 mismatch'); diff --git a/packages/wsp-toolkit/packages/huggingface/test/hub.test.mjs b/packages/wsp-toolkit/packages/huggingface/test/hub.test.mjs index 40da03148..cb750964c 100644 --- a/packages/wsp-toolkit/packages/huggingface/test/hub.test.mjs +++ b/packages/wsp-toolkit/packages/huggingface/test/hub.test.mjs @@ -208,3 +208,34 @@ test('linear-head adapter shares digest, redirect and byte-limit enforcement', a status: 307, headers: { location: 'https://other.example/model.json' } }) }), /redirects must stay/); }); + + +test('download deadline bounds an injected fetch that ignores AbortSignal', { timeout: 1000 }, async () => { + await assert.rejects(loadHubModel(source(), { + timeoutMs: 10, fetch: () => new Promise(() => {}) + }), /timeout/); +}); + +test('deadline bounds stalled body reads and uncooperative cancellation', { timeout: 1000 }, async () => { + let canceled = false; + const stream = new ReadableStream({ + pull() { return new Promise(() => {}); }, + cancel() { canceled = true; return new Promise(() => {}); } + }); + await assert.rejects(loadHubModel(source(), { + timeoutMs: 10, fetch: async () => new Response(stream) + }), /timeout/); + assert.equal(canceled, true); +}); + +test('external abort bounds a custom body read and redirect body cleanup', { timeout: 1000 }, async () => { + const controller = new AbortController(); + const operation = loadHubModel(source(), { signal: controller.signal, fetch: async () => + new Response(new ReadableStream({ pull() { return new Promise(() => {}); } })) }); + setTimeout(() => controller.abort(new Error('caller stopped transfer')), 10); + await assert.rejects(operation, /caller stopped transfer/); + await assert.rejects(loadHubModel(source(), { timeoutMs: 10, fetch: async () => + new Response(new ReadableStream({ cancel() { return new Promise(() => {}); } }), { + status: 307, headers: { location: '/same-origin-redirect' } + }) }), /timeout/); +}); From 49327ebaff0bf206b35a9c145fab17a87bd08783 Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 22:55:20 -0500 Subject: [PATCH 03/20] test(toolkit): select SQL.js explicitly for buffered persistence probes --- packages/wsp-toolkit/tooling/agentdb/runtime.mjs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/wsp-toolkit/tooling/agentdb/runtime.mjs b/packages/wsp-toolkit/tooling/agentdb/runtime.mjs index 0b0cb6ea0..21959bdbb 100644 --- a/packages/wsp-toolkit/tooling/agentdb/runtime.mjs +++ b/packages/wsp-toolkit/tooling/agentdb/runtime.mjs @@ -1,5 +1,10 @@ import { createAgentDBRegistry } from '../../packages/registry/src/index.js'; +// This private fixture deliberately exercises AgentDB's buffered WASM backend. +// Optional native SQLite availability must not change disk-flush failure oracles. +// Published registry adapters never select or alter the caller's database backend. +process.env.AGENTDB_FORCE_SQLJS = '1'; + /** Explicit integration fixture. Dependencies are installed by setup, never here. */ export async function openDemoRegistry(filename, registryFactory = createAgentDBRegistry) { if (typeof filename !== 'string' || filename.length < 1 || filename.length > 4096 || /[\x00-\x1f]/.test(filename)) From 0495d6f608291616d924fd0cc0ac7fa1f6dd3a79 Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 22:55:06 -0500 Subject: [PATCH 04/20] feat(core): expose validated weight toolkit through explicit subpaths --- packages/core/package.json | 81 ++++++- .../core/src/capabilities/cloudflare.d.ts | 2 + packages/core/src/capabilities/cloudflare.js | 2 + .../src/capabilities/cloudflare/build.d.ts | 2 + .../core/src/capabilities/cloudflare/build.js | 2 + .../core/src/capabilities/constellation.d.ts | 2 + .../core/src/capabilities/constellation.js | 2 + packages/core/src/capabilities/contracts.d.ts | 2 + packages/core/src/capabilities/contracts.js | 2 + .../core/src/capabilities/huggingface.d.ts | 2 + packages/core/src/capabilities/huggingface.js | 2 + .../core/src/capabilities/invariants.d.ts | 2 + packages/core/src/capabilities/invariants.js | 2 + packages/core/src/capabilities/lifecycle.d.ts | 2 + packages/core/src/capabilities/lifecycle.js | 2 + packages/core/src/capabilities/loop.d.ts | 2 + packages/core/src/capabilities/loop.js | 2 + packages/core/src/capabilities/registry.d.ts | 2 + packages/core/src/capabilities/registry.js | 2 + packages/core/src/capabilities/ruos.d.ts | 2 + packages/core/src/capabilities/ruos.js | 2 + packages/core/src/capabilities/search.d.ts | 2 + packages/core/src/capabilities/search.js | 2 + packages/core/src/capabilities/swarm.d.ts | 2 + packages/core/src/capabilities/swarm.js | 2 + packages/core/src/capabilities/telemetry.d.ts | 2 + packages/core/src/capabilities/telemetry.js | 2 + packages/core/src/capabilities/wsp.d.ts | 2 + packages/core/src/capabilities/wsp.js | 2 + packages/core/test/installed-consumer.mjs | 199 ++++++++++++++++++ 30 files changed, 332 insertions(+), 4 deletions(-) create mode 100644 packages/core/src/capabilities/cloudflare.d.ts create mode 100644 packages/core/src/capabilities/cloudflare.js create mode 100644 packages/core/src/capabilities/cloudflare/build.d.ts create mode 100644 packages/core/src/capabilities/cloudflare/build.js create mode 100644 packages/core/src/capabilities/constellation.d.ts create mode 100644 packages/core/src/capabilities/constellation.js create mode 100644 packages/core/src/capabilities/contracts.d.ts create mode 100644 packages/core/src/capabilities/contracts.js create mode 100644 packages/core/src/capabilities/huggingface.d.ts create mode 100644 packages/core/src/capabilities/huggingface.js create mode 100644 packages/core/src/capabilities/invariants.d.ts create mode 100644 packages/core/src/capabilities/invariants.js create mode 100644 packages/core/src/capabilities/lifecycle.d.ts create mode 100644 packages/core/src/capabilities/lifecycle.js create mode 100644 packages/core/src/capabilities/loop.d.ts create mode 100644 packages/core/src/capabilities/loop.js create mode 100644 packages/core/src/capabilities/registry.d.ts create mode 100644 packages/core/src/capabilities/registry.js create mode 100644 packages/core/src/capabilities/ruos.d.ts create mode 100644 packages/core/src/capabilities/ruos.js create mode 100644 packages/core/src/capabilities/search.d.ts create mode 100644 packages/core/src/capabilities/search.js create mode 100644 packages/core/src/capabilities/swarm.d.ts create mode 100644 packages/core/src/capabilities/swarm.js create mode 100644 packages/core/src/capabilities/telemetry.d.ts create mode 100644 packages/core/src/capabilities/telemetry.js create mode 100644 packages/core/src/capabilities/wsp.d.ts create mode 100644 packages/core/src/capabilities/wsp.js create mode 100644 packages/core/test/installed-consumer.mjs diff --git a/packages/core/package.json b/packages/core/package.json index c6e28eca0..530a6de96 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "ruv-fann", - "version": "0.1.2", - "description": "Neural networks for JavaScript and TypeScript: WebAssembly batch inference and SGD/AdamW training in Node.js and browsers.", + "version": "0.2.0", + "description": "Rust/WASM neural inference and training with explicit weight editing, bounded search, invariant gates, evolution loops and AgentDB registry integrations.", "type": "module", "engines": { "node": ">=20.9.0" @@ -10,6 +10,62 @@ ".": { "types": "./src/index.d.ts", "import": "./src/index.js" + }, + "./wsp": { + "types": "./src/capabilities/wsp.d.ts", + "import": "./src/capabilities/wsp.js" + }, + "./lifecycle": { + "types": "./src/capabilities/lifecycle.d.ts", + "import": "./src/capabilities/lifecycle.js" + }, + "./search": { + "types": "./src/capabilities/search.d.ts", + "import": "./src/capabilities/search.js" + }, + "./huggingface": { + "types": "./src/capabilities/huggingface.d.ts", + "import": "./src/capabilities/huggingface.js" + }, + "./cloudflare": { + "types": "./src/capabilities/cloudflare.d.ts", + "import": "./src/capabilities/cloudflare.js" + }, + "./cloudflare/build": { + "types": "./src/capabilities/cloudflare/build.d.ts", + "import": "./src/capabilities/cloudflare/build.js" + }, + "./ruos": { + "types": "./src/capabilities/ruos.d.ts", + "import": "./src/capabilities/ruos.js" + }, + "./invariants": { + "types": "./src/capabilities/invariants.d.ts", + "import": "./src/capabilities/invariants.js" + }, + "./swarm": { + "types": "./src/capabilities/swarm.d.ts", + "import": "./src/capabilities/swarm.js" + }, + "./registry": { + "types": "./src/capabilities/registry.d.ts", + "import": "./src/capabilities/registry.js" + }, + "./loop": { + "types": "./src/capabilities/loop.d.ts", + "import": "./src/capabilities/loop.js" + }, + "./constellation": { + "types": "./src/capabilities/constellation.d.ts", + "import": "./src/capabilities/constellation.js" + }, + "./contracts": { + "types": "./src/capabilities/contracts.d.ts", + "import": "./src/capabilities/contracts.js" + }, + "./telemetry": { + "types": "./src/capabilities/telemetry.d.ts", + "import": "./src/capabilities/telemetry.js" } }, "files": [ @@ -19,7 +75,20 @@ "assets" ], "dependencies": { - "ruv-fann-wasm": "0.1.2" + "ruv-fann-wasm": "0.1.2", + "ruv-fann-wsp": "0.2.0", + "ruv-fann-wsp-lifecycle": "0.1.0", + "ruv-fann-wsp-search": "0.1.0", + "ruv-fann-wsp-huggingface": "0.1.0", + "ruv-fann-wsp-cloudflare": "0.1.0", + "ruv-fann-wsp-ruos": "0.1.0", + "ruv-fann-wsp-invariants": "0.1.0", + "ruv-fann-wsp-swarm": "0.1.0", + "ruv-fann-wsp-registry": "0.1.0", + "ruv-fann-wsp-loop": "0.1.0", + "ruvnet-constellation": "0.1.0", + "ruvnet-constellation-contracts": "0.1.0", + "ruvnet-constellation-telemetry": "0.1.0" }, "scripts": { "test": "node --test test/*.test.mjs", @@ -51,7 +120,11 @@ "training", "sgd", "adamw", - "agentdb" + "agentdb", + "weight-space-programming", + "weight-editing", + "bounded-search", + "invariants" ], "main": "./src/index.js", "types": "./src/index.d.ts", diff --git a/packages/core/src/capabilities/cloudflare.d.ts b/packages/core/src/capabilities/cloudflare.d.ts new file mode 100644 index 000000000..c479677ff --- /dev/null +++ b/packages/core/src/capabilities/cloudflare.d.ts @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-cloudflare'; diff --git a/packages/core/src/capabilities/cloudflare.js b/packages/core/src/capabilities/cloudflare.js new file mode 100644 index 000000000..c479677ff --- /dev/null +++ b/packages/core/src/capabilities/cloudflare.js @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-cloudflare'; diff --git a/packages/core/src/capabilities/cloudflare/build.d.ts b/packages/core/src/capabilities/cloudflare/build.d.ts new file mode 100644 index 000000000..408af4da4 --- /dev/null +++ b/packages/core/src/capabilities/cloudflare/build.d.ts @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-cloudflare/build'; diff --git a/packages/core/src/capabilities/cloudflare/build.js b/packages/core/src/capabilities/cloudflare/build.js new file mode 100644 index 000000000..408af4da4 --- /dev/null +++ b/packages/core/src/capabilities/cloudflare/build.js @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-cloudflare/build'; diff --git a/packages/core/src/capabilities/constellation.d.ts b/packages/core/src/capabilities/constellation.d.ts new file mode 100644 index 000000000..81267c91a --- /dev/null +++ b/packages/core/src/capabilities/constellation.d.ts @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruvnet-constellation'; diff --git a/packages/core/src/capabilities/constellation.js b/packages/core/src/capabilities/constellation.js new file mode 100644 index 000000000..81267c91a --- /dev/null +++ b/packages/core/src/capabilities/constellation.js @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruvnet-constellation'; diff --git a/packages/core/src/capabilities/contracts.d.ts b/packages/core/src/capabilities/contracts.d.ts new file mode 100644 index 000000000..b0fc90a94 --- /dev/null +++ b/packages/core/src/capabilities/contracts.d.ts @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruvnet-constellation-contracts'; diff --git a/packages/core/src/capabilities/contracts.js b/packages/core/src/capabilities/contracts.js new file mode 100644 index 000000000..b0fc90a94 --- /dev/null +++ b/packages/core/src/capabilities/contracts.js @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruvnet-constellation-contracts'; diff --git a/packages/core/src/capabilities/huggingface.d.ts b/packages/core/src/capabilities/huggingface.d.ts new file mode 100644 index 000000000..bca7062de --- /dev/null +++ b/packages/core/src/capabilities/huggingface.d.ts @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-huggingface'; diff --git a/packages/core/src/capabilities/huggingface.js b/packages/core/src/capabilities/huggingface.js new file mode 100644 index 000000000..bca7062de --- /dev/null +++ b/packages/core/src/capabilities/huggingface.js @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-huggingface'; diff --git a/packages/core/src/capabilities/invariants.d.ts b/packages/core/src/capabilities/invariants.d.ts new file mode 100644 index 000000000..94bb97b26 --- /dev/null +++ b/packages/core/src/capabilities/invariants.d.ts @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-invariants'; diff --git a/packages/core/src/capabilities/invariants.js b/packages/core/src/capabilities/invariants.js new file mode 100644 index 000000000..94bb97b26 --- /dev/null +++ b/packages/core/src/capabilities/invariants.js @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-invariants'; diff --git a/packages/core/src/capabilities/lifecycle.d.ts b/packages/core/src/capabilities/lifecycle.d.ts new file mode 100644 index 000000000..d1ac1eba4 --- /dev/null +++ b/packages/core/src/capabilities/lifecycle.d.ts @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-lifecycle'; diff --git a/packages/core/src/capabilities/lifecycle.js b/packages/core/src/capabilities/lifecycle.js new file mode 100644 index 000000000..d1ac1eba4 --- /dev/null +++ b/packages/core/src/capabilities/lifecycle.js @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-lifecycle'; diff --git a/packages/core/src/capabilities/loop.d.ts b/packages/core/src/capabilities/loop.d.ts new file mode 100644 index 000000000..2356b8674 --- /dev/null +++ b/packages/core/src/capabilities/loop.d.ts @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-loop'; diff --git a/packages/core/src/capabilities/loop.js b/packages/core/src/capabilities/loop.js new file mode 100644 index 000000000..2356b8674 --- /dev/null +++ b/packages/core/src/capabilities/loop.js @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-loop'; diff --git a/packages/core/src/capabilities/registry.d.ts b/packages/core/src/capabilities/registry.d.ts new file mode 100644 index 000000000..f351e0083 --- /dev/null +++ b/packages/core/src/capabilities/registry.d.ts @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-registry'; diff --git a/packages/core/src/capabilities/registry.js b/packages/core/src/capabilities/registry.js new file mode 100644 index 000000000..f351e0083 --- /dev/null +++ b/packages/core/src/capabilities/registry.js @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-registry'; diff --git a/packages/core/src/capabilities/ruos.d.ts b/packages/core/src/capabilities/ruos.d.ts new file mode 100644 index 000000000..3e1c3dac5 --- /dev/null +++ b/packages/core/src/capabilities/ruos.d.ts @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-ruos'; diff --git a/packages/core/src/capabilities/ruos.js b/packages/core/src/capabilities/ruos.js new file mode 100644 index 000000000..3e1c3dac5 --- /dev/null +++ b/packages/core/src/capabilities/ruos.js @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-ruos'; diff --git a/packages/core/src/capabilities/search.d.ts b/packages/core/src/capabilities/search.d.ts new file mode 100644 index 000000000..27f582ee3 --- /dev/null +++ b/packages/core/src/capabilities/search.d.ts @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-search'; diff --git a/packages/core/src/capabilities/search.js b/packages/core/src/capabilities/search.js new file mode 100644 index 000000000..27f582ee3 --- /dev/null +++ b/packages/core/src/capabilities/search.js @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-search'; diff --git a/packages/core/src/capabilities/swarm.d.ts b/packages/core/src/capabilities/swarm.d.ts new file mode 100644 index 000000000..e98e1aeb7 --- /dev/null +++ b/packages/core/src/capabilities/swarm.d.ts @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-swarm'; diff --git a/packages/core/src/capabilities/swarm.js b/packages/core/src/capabilities/swarm.js new file mode 100644 index 000000000..e98e1aeb7 --- /dev/null +++ b/packages/core/src/capabilities/swarm.js @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp-swarm'; diff --git a/packages/core/src/capabilities/telemetry.d.ts b/packages/core/src/capabilities/telemetry.d.ts new file mode 100644 index 000000000..65d11364f --- /dev/null +++ b/packages/core/src/capabilities/telemetry.d.ts @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruvnet-constellation-telemetry'; diff --git a/packages/core/src/capabilities/telemetry.js b/packages/core/src/capabilities/telemetry.js new file mode 100644 index 000000000..65d11364f --- /dev/null +++ b/packages/core/src/capabilities/telemetry.js @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruvnet-constellation-telemetry'; diff --git a/packages/core/src/capabilities/wsp.d.ts b/packages/core/src/capabilities/wsp.d.ts new file mode 100644 index 000000000..6cfc6bbc5 --- /dev/null +++ b/packages/core/src/capabilities/wsp.d.ts @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp'; diff --git a/packages/core/src/capabilities/wsp.js b/packages/core/src/capabilities/wsp.js new file mode 100644 index 000000000..6cfc6bbc5 --- /dev/null +++ b/packages/core/src/capabilities/wsp.js @@ -0,0 +1,2 @@ +/** Explicit capability entrypoint; the root runtime does not load this module. */ +export * from 'ruv-fann-wsp'; diff --git a/packages/core/test/installed-consumer.mjs b/packages/core/test/installed-consumer.mjs new file mode 100644 index 000000000..473eb130b --- /dev/null +++ b/packages/core/test/installed-consumer.mjs @@ -0,0 +1,199 @@ +/** Qualify the already-installed exact core archive, never a source/workspace link. */ +import assert from 'node:assert/strict'; +import { readFile, writeFile, lstat, realpath, rm } from 'node:fs/promises'; +import { join, resolve, dirname, extname, sep } from 'node:path'; +import { pathToFileURL } from 'node:url'; +import { createServer } from 'node:http'; +import { execFileSync } from 'node:child_process'; + +if (process.argv[3]) assert.match(process.env.EXPECTED_SHA ?? '', /^[a-f0-9]{40}$/, 'receipts require the full exact source SHA'); +const directory = resolve(process.argv[2] ?? ''); +assert.ok(process.argv[2], 'pass the fresh archive installation directory'); +const coreDirectory = join(directory, 'node_modules/ruv-fann'); +assert.equal((await lstat(coreDirectory)).isSymbolicLink(), false, 'core must be an installed archive'); +const metadata = JSON.parse(await readFile(join(coreDirectory, 'package.json'), 'utf8')); +assert.equal(metadata.version, '0.2.0'); +const mappings = { + wsp: 'ruv-fann-wsp', lifecycle: 'ruv-fann-wsp-lifecycle', search: 'ruv-fann-wsp-search', + huggingface: 'ruv-fann-wsp-huggingface', cloudflare: 'ruv-fann-wsp-cloudflare', + 'cloudflare/build': 'ruv-fann-wsp-cloudflare/build', ruos: 'ruv-fann-wsp-ruos', + invariants: 'ruv-fann-wsp-invariants', swarm: 'ruv-fann-wsp-swarm', registry: 'ruv-fann-wsp-registry', + loop: 'ruv-fann-wsp-loop', constellation: 'ruvnet-constellation', contracts: 'ruvnet-constellation-contracts', + telemetry: 'ruvnet-constellation-telemetry' +}; +assert.equal(Object.keys(metadata.dependencies).length, 14); +for (const [subpath, dependency] of Object.entries(mappings)) { + const name = dependency.split('/')[0]; + assert.equal(metadata.dependencies[name], name === 'ruv-fann-wsp' ? '0.2.0' : '0.1.0'); + assert.deepEqual(Object.keys(metadata.exports[`./${subpath}`]).sort(), ['import', 'types']); +} + +// The same independent numerical oracle runs under Node and real Chromium. +async function qualify(core, wsp, search, invariants, lifecycle, simd) { + let checks = 0; + const check = (ok, message) => { if (!ok) throw new Error(message); checks++; }; + const equal = (a, b) => JSON.stringify(a) === JSON.stringify(b); + check(equal(Object.keys(core).sort(), ['LIMITS', 'loadRuntime']), 'root remains an inference-only import'); + const runtime = await core.loadRuntime({ simd }); + check(runtime.backend === (simd ? 'wasm-simd' : 'wasm'), 'requested real WASM backend'); + const linear = { schema: 'ruv-fann.dense-layers/1', layers: [{inputs: 1, outputs: 1, weights: [2], bias: [1], activation: 'Linear', steepness: 1}] }; + const prepared = runtime.prepare(linear, {maxRows: 3}); + check(equal([...prepared.predict(Float64Array.of(1, 2, 3))], [3, 5, 7]), 'core archive exact linear oracle'); + prepared.dispose(); + const trained = runtime.train({...linear, layers: [{...linear.layers[0], weights: [0], bias: [0]}]}, { + inputs: Float64Array.of(0, 1, 2), targets: Float64Array.of(1, 3, 5), rows: 3, + epochs: 300, learningRate: 0.05, optimizer: 'adamw' + }); + check(trained.finalLoss < trained.initialLoss / 1000, 'core training preserves actual loss reduction'); + const model = {schema: 'ruv-fann.dense-layers/1', layers: [ + {inputs: 2, outputs: 2, weights: [1, -1, -1, 1], bias: [0, 0], activation: 'ReLU', steepness: 1}, + {inputs: 2, outputs: 1, weights: [0, 0], bias: [0], activation: 'Linear', steepness: 1} + ]}; + const dataset = {inputs: [0, 0, 0, 1, 1, 0, 1, 1], targets: [0, 1, 1, 0], rows: 4}; + const policy = {maxMSE: 0, maxRegressionMSE: 0, maxAbsoluteError: 0}; + const found = await search.searchWeightPatch(model, dataset, policy, {simd, locations: [0, 1].map(index => ({layer: 1, parameter: 'weights', index, values: [0, 1]})), maxEvaluations: 8, maxPasses: 2}); + check(found.patch !== null && found.evaluation.accepted && found.evaluation.candidate.mse === 0, 'search subpath repairs XOR with actual inference'); + const gate = await lifecycle.runRegressionGate({model, patch: found.patch, suites: [{name: 'complete-xor', dataset, policy}]}, {simd}); + check(gate.accepted, 'lifecycle subpath independently accepts strict complete-XOR gate'); + const workspace = await wsp.createWeightWorkspace(model, {simd}); + const initial = workspace.snapshot(); + const proposal = await workspace.propose(found.patch, dataset, policy); + check(workspace.snapshot().hash === initial.hash, 'accepted proposal never implicitly promotes'); + const repaired = workspace.promote(proposal.id, 1); + const trace = await wsp.traceWeightModel(repaired.model, {inputs: dataset.inputs, rows: 4}, {simd}); + check(equal(trace.layers.at(-1).activations, dataset.targets), 'weight subpath trace matches independent XOR oracle'); + const invariant = invariants.createBooleanInvariant({inputs: 2, outputs: 1, targets: dataset.targets}); + const bounded = await invariants.checkModelInvariants(repaired.model, invariant, {simd}); + check(bounded.accepted && bounded.checks === 4, 'invariants subpath checks all finite-domain rows'); + const bad = await wsp.createNeuronAblationPatch(repaired.model, 0, 0); + const rejected = await workspace.propose(bad, dataset, policy); + check(!rejected.evaluation.accepted, 'ablation regression rejected'); + let denied = false; + try { workspace.promote(rejected.id, 2); } catch { denied = true; } + check(denied && workspace.snapshot().hash === repaired.hash, 'rejected proposal cannot change live weights'); + const restored = workspace.rollback(1, 2); + check(restored.revision === 3 && restored.hash === initial.hash, 'explicit rollback restores original model'); + return {backend: runtime.backend, checks, inference: true, training: true, search: true, gate: true, invariants: true, rejectedPromotion: true, rollbackRevision: restored.revision}; +} + +const token = `core-facade-${process.pid}-${Date.now()}`; +const consumerFile = join(directory, `.${token}.mjs`); +const typeFile = join(directory, `.${token}.ts`); +const browserImports = ['wsp', 'search', 'lifecycle', 'invariants', 'registry', 'huggingface', 'cloudflare', 'ruos', 'contracts', 'telemetry']; +let server, browser; +try { + await writeFile(consumerFile, `import assert from 'node:assert/strict'; +import * as core from 'ruv-fann'; +import * as wsp from 'ruv-fann/wsp'; +import * as search from 'ruv-fann/search'; +import * as invariants from 'ruv-fann/invariants'; +import * as lifecycle from 'ruv-fann/lifecycle'; +const mappings = ${JSON.stringify(mappings)}; +for (const [subpath, dependency] of Object.entries(mappings)) { + const facade = await import('ruv-fann/' + subpath), satellite = await import(dependency); + assert.deepEqual(Object.keys(facade), Object.keys(satellite), 'complete export surface: ' + subpath); + for (const key of Object.keys(satellite)) assert.equal(facade[key], satellite[key], 'direct usable export: ' + subpath + '/' + key); +} +const qualify = ${qualify.toString()}; +console.log('CORE_FACADE_RESULT ' + JSON.stringify(await Promise.all([false, true].map(simd => qualify(core, wsp, search, invariants, lifecycle, simd))))); +`); + const stdout = execFileSync(process.execPath, [consumerFile], {cwd: directory, encoding: 'utf8'}); + const backendChecks = JSON.parse(stdout.split('\n').find(line => line.startsWith('CORE_FACADE_RESULT ')).slice('CORE_FACADE_RESULT '.length)); + assert.deepEqual(backendChecks.map(row => row.backend), ['wasm', 'wasm-simd']); + + // Verify the actual nested dependency that WSP resolves, rather than globally remapping it. + const findPackage = async (name, start) => { + let parent = start; + for (;;) { + const candidate = join(parent, 'node_modules', name, 'package.json'); + try { return {directory: dirname(candidate), metadata: JSON.parse(await readFile(candidate, 'utf8'))}; } + catch (error) { if (error.code !== 'ENOENT') throw error; } + const next = dirname(parent); if (next === parent) throw new Error(`missing installed dependency ${name}`); parent = next; + } + }; + const wspPackage = await findPackage('ruv-fann-wsp', coreDirectory); + const legacyCore = await findPackage('ruv-fann', wspPackage.directory); + assert.equal(legacyCore.metadata.version, '0.1.2', 'satellites intentionally use published legacy runtime'); + assert.deepEqual(legacyCore.metadata.dependencies, {'ruv-fann-wasm': '0.1.2'}, 'finite version graph terminates at WASM'); + const wasm = await findPackage('ruv-fann-wasm', coreDirectory); + assert.equal(wasm.metadata.version, '0.1.2'); + const graph = {core: metadata.version, legacyCore: legacyCore.metadata.version, finite: true}; + + const typeImports = Object.keys(mappings).map((subpath, index) => `import * as capability${index} from 'ruv-fann/${subpath}';\nvoid capability${index};`).join('\n'); + await writeFile(typeFile, `import {loadRuntime, type DenseModel} from 'ruv-fann'; +import {createWeightWorkspace, type WeightPatch} from 'ruv-fann/wsp'; +import {searchWeightPatch, type SearchOptions} from 'ruv-fann/search'; +import {checkModelInvariants, type InvariantSuite} from 'ruv-fann/invariants'; +${typeImports} +const model: DenseModel = {schema:'ruv-fann.dense-layers/1',layers:[{inputs:1,outputs:1,weights:[1],activation:'Linear',steepness:1}]}; +const patch: WeightPatch = {schema:'ruv-fann.weight-patch/1',baseHash:'0'.repeat(64),edits:[{layer:0,parameter:'weights',index:0,value:2}]}; +const search: SearchOptions = {locations:[{layer:0,parameter:'weights',index:0,values:[1,2]}]}; +const suite: InvariantSuite = {schema:'ruv-fann.invariants/1',cases:[{name:'identity',inputs:[1],rows:1,expected:[1]}]}; +void loadRuntime().then(runtime => runtime.prepare(model)); void createWeightWorkspace(model); void patch; void searchWeightPatch; void search; void checkModelInvariants(model,suite); +// @ts-expect-error explicit finite numerical inputs remain required +const invalid: DenseModel = {schema:'ruv-fann.dense-layers/1',layers:[{inputs:1,outputs:1,weights:['bad'],activation:'Linear',steepness:1}]}; +void invalid; +`); + const tsc = process.env.RUV_FANN_TSC; + assert.ok(tsc, 'RUV_FANN_TSC must identify the pinned TypeScript compiler'); + execFileSync(process.execPath, [tsc, '--noEmit', '--strict', '--skipLibCheck', 'false', '--target', 'ES2022', '--module', 'NodeNext', '--moduleResolution', 'NodeNext', '--lib', 'ES2022,DOM', typeFile], {cwd: directory, encoding: 'utf8'}); + + const toWeb = path => '/' + path.slice(directory.length + 1).split(sep).join('/'); + const imports = {'ruv-fann': toWeb(join(coreDirectory, 'src/index.js')), 'ruv-fann-wasm': toWeb(join(wasm.directory, 'src/index.js'))}; + const scopes = {}; + const legacyWeb = toWeb(join(legacyCore.directory, 'src/index.js')); + for (const [subpath, dependency] of Object.entries(mappings)) { + imports[`ruv-fann/${subpath}`] = toWeb(join(coreDirectory, metadata.exports[`./${subpath}`].import)); + const name = dependency.split('/')[0]; + const pkg = await findPackage(name, coreDirectory); + assert.equal((await lstat(pkg.directory)).isSymbolicLink(), false, 'capability must be an installed archive: ' + name); + assert.ok((await realpath(pkg.directory)).startsWith(directory + sep), 'capability must be inside the fresh installation: ' + name); + const suffix = dependency.includes('/') ? './' + dependency.split('/').slice(1).join('/') : '.'; + const entry = pkg.metadata.exports?.[suffix]; + if (typeof entry === 'object') imports[dependency] = toWeb(join(pkg.directory, entry.import)); + scopes[toWeb(pkg.directory) + '/'] = {'ruv-fann': legacyWeb}; + } + // The WASM URL inside both core generations must resolve to the bundled archive bytes. + scopes[toWeb(legacyCore.directory) + '/'] = {'ruv-fann-wasm': imports['ruv-fann-wasm']}; + const importmap = {imports, scopes}; + const errors = []; + const mime = {'.js': 'text/javascript', '.mjs': 'text/javascript', '.wasm': 'application/wasm', '.json': 'application/json'}; + server = createServer(async (req, res) => { + try { + const url = new URL(req.url, 'http://localhost'); + if (url.pathname === '/') {res.setHeader('Content-Type', 'text/html'); return res.end(`Installed core consumer`);} + const file = resolve(directory, '.' + decodeURIComponent(url.pathname)); + if (!file.startsWith(directory + sep)) {res.writeHead(403); return res.end();} + const canonical = await realpath(file); + if (!canonical.startsWith(directory + sep)) {res.writeHead(403); return res.end();} + res.setHeader('Content-Type', mime[extname(file)] ?? 'application/octet-stream'); + res.end(await readFile(file)); + } catch {res.writeHead(404); res.end();} + }); + await new Promise(resolve => server.listen(0, '127.0.0.1', resolve)); + const playwrightPath = process.env.RUV_FANN_PLAYWRIGHT; + assert.ok(playwrightPath, 'RUV_FANN_PLAYWRIGHT must identify pinned Playwright'); + const playwright = await import(pathToFileURL(join(playwrightPath, 'index.mjs')).href); + browser = await playwright.chromium.launch({headless: true}); + const page = await browser.newPage(); + page.on('pageerror', error => errors.push(error.message)); + await page.goto(`http://127.0.0.1:${server.address().port}/`); + const browserChecks = await page.evaluate(async ({fn, subpaths}) => { + const modules = await Promise.all(['ruv-fann', 'ruv-fann/wsp', 'ruv-fann/search', 'ruv-fann/invariants', 'ruv-fann/lifecycle'].map(name => import(name))); + for (const subpath of subpaths) await import('ruv-fann/' + subpath); + const qualify = (0, eval)('(' + fn + ')'); + return await Promise.all([false, true].map(simd => qualify(...modules, simd))); + }, {fn: qualify.toString(), subpaths: browserImports}); + assert.deepEqual(browserChecks.map(row => row.backend), ['wasm', 'wasm-simd']); + assert.deepEqual(errors, []); + const receipt = {schema: 'ruv-fann.core-consumer/1', status: 'passed', sourceSha: process.env.EXPECTED_SHA ?? null, + testCount: backendChecks.reduce((sum, row) => sum + row.checks, 0) + browserChecks.reduce((sum, row) => sum + row.checks, 0) + Object.keys(mappings).length + 4, + skipped: 0, todo: 0, runtime: process.version, backendChecks, browser: {engine: 'Chromium', realWasm: true, checks: browserChecks, importedSubpaths: browserImports, pageErrors: errors}, + types: {strict: true, subpaths: Object.keys(mappings).length}, graph}; + if (process.argv[3]) await writeFile(resolve(process.argv[3]), JSON.stringify(receipt, null, 2) + '\n'); + console.log(JSON.stringify(receipt, null, 2)); +} finally { + await browser?.close(); + if (server) await new Promise(resolve => server.close(resolve)); + await rm(consumerFile, {force: true}); await rm(typeFile, {force: true}); +} From dc4d0918665e046489f1a4fca49be3b314b69c44 Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 22:59:24 -0500 Subject: [PATCH 05/20] test(toolkit): isolate declaration checks from ancestor ambient types --- packages/wsp-toolkit/tsconfig.json | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/wsp-toolkit/tsconfig.json b/packages/wsp-toolkit/tsconfig.json index 7a7d3ba01..1037edcbe 100644 --- a/packages/wsp-toolkit/tsconfig.json +++ b/packages/wsp-toolkit/tsconfig.json @@ -1,4 +1,19 @@ { - "compilerOptions": { "target": "ES2023", "module": "NodeNext", "moduleResolution": "NodeNext", "strict": true, "noEmit": true, "lib": ["ES2023", "DOM"], "skipLibCheck": false }, - "include": ["packages/*/src/*.d.ts", "test/types.ts"] + "compilerOptions": { + "target": "ES2023", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "strict": true, + "noEmit": true, + "lib": [ + "ES2023", + "DOM" + ], + "skipLibCheck": false, + "types": [] + }, + "include": [ + "packages/*/src/*.d.ts", + "test/types.ts" + ] } From 56ec9f5629cd6ad21995f639b641a4715887b9aa Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 22:57:26 -0500 Subject: [PATCH 06/20] fix(wsp): preserve loop authority and contain invalid callbacks --- .../wsp-toolkit/packages/loop/src/index.js | 55 ++++++++++++++++--- .../packages/loop/test/loop.test.mjs | 44 +++++++++++++++ .../wsp-toolkit/packages/search/src/index.js | 12 +++- .../packages/search/test/search.test.mjs | 21 +++++++ .../wsp-toolkit/packages/swarm/src/index.js | 12 +++- .../packages/swarm/test/swarm.test.mjs | 9 +++ 6 files changed, 143 insertions(+), 10 deletions(-) diff --git a/packages/wsp-toolkit/packages/loop/src/index.js b/packages/wsp-toolkit/packages/loop/src/index.js index 113199e38..161fb1f1d 100644 --- a/packages/wsp-toolkit/packages/loop/src/index.js +++ b/packages/wsp-toolkit/packages/loop/src/index.js @@ -77,18 +77,59 @@ function gateWork(module,parameters,invariantWork) { return work+invariantWork+2*module.development.dataset.rows*parameters; } function cleanError(error) {return String(error?.message??error).slice(0,256);} +function registryCapabilities(registry) { + if(!registry||typeof registry!=='object')throw new TypeError('registry capabilities are required'); + const methods=Object.create(null); + for(const name of ['get','propose','promote']) { + let owner=registry,descriptor; + while(owner&&owner!==Object.prototype) { + descriptor=Object.getOwnPropertyDescriptor(owner,name); + if(descriptor)break; + owner=Object.getPrototypeOf(owner); + } + if(!descriptor||!Object.hasOwn(descriptor,'value')||typeof descriptor.value!=='function') + throw new TypeError(`registry.${name} must be a data method`); + methods[name]=descriptor.value.bind(registry); + } + return methods; +} +function programSnapshot(value) { + if(value===null)return null; + if(!value||typeof value!=='object'||Array.isArray(value))throw new TypeError('registry program must be a data record'); + const program=Object.create(null); + // Ignore registry metadata while detaching the fields that define CAS authority. + // A registry may return a live record that another coordinator updates in place. + for(const key of ['revision','hash','model']) { + const descriptor=Object.getOwnPropertyDescriptor(value,key); + if(!descriptor||!Object.hasOwn(descriptor,'value'))throw new TypeError(`registry program ${key} must be own data`); + program[key]=descriptor.value; + } + integer(program.revision,1,Number.MAX_SAFE_INTEGER,'registry revision'); + if(typeof program.hash!=='string'||!/^[a-f0-9]{64}$/.test(program.hash))throw new TypeError('invalid registry model hash'); + program.model=snapshot(program.model); + return program; +} +function abortCapability(source) { + if(source===undefined)return undefined; + if(!(source instanceof AbortSignal))throw new TypeError('signal must be an AbortSignal'); + const aborted=Object.getOwnPropertyDescriptor(AbortSignal.prototype,'aborted').get; + const reason=Object.getOwnPropertyDescriptor(AbortSignal.prototype,'reason').get; + aborted.call(source); // Do not trust shadow properties or forged prototype chains. + return {get aborted(){return aborted.call(source);},get reason(){return reason.call(source);}, + addEventListener:EventTarget.prototype.addEventListener.bind(source), + removeEventListener:EventTarget.prototype.removeEventListener.bind(source)}; +} /** Execute a finite local loop. Only trusted coordinator data can define acceptance criteria. */ export async function runEvolutionLoop(configuration) { const raw=record(configuration,['registry','modules','maxRounds','maxProposals','maxWork','concurrency','jobTimeoutMs','maxDurationMs','simd','signal'],['registry','modules'],'loop configuration'); - const registry=raw.registry; - for(const name of ['get','propose','promote'])if(typeof registry?.[name]!=='function')throw new TypeError(`registry.${name} capability is required`); + const registry=registryCapabilities(raw.registry); const modules=modulesSnapshot(raw.modules); const budget={maxRounds:integer(raw.maxRounds??4,1,LOOP_LIMITS.maxRounds,'maxRounds'),maxProposals:integer(raw.maxProposals??32,1,LOOP_LIMITS.maxProposals,'maxProposals'), maxWork:integer(raw.maxWork??LOOP_LIMITS.maxWork,1,LOOP_LIMITS.maxWork,'maxWork'),concurrency:integer(raw.concurrency??2,1,LOOP_LIMITS.maxConcurrency,'concurrency'), jobTimeoutMs:integer(raw.jobTimeoutMs??10000,1,60000,'jobTimeoutMs'),maxDurationMs:integer(raw.maxDurationMs??60000,1,LOOP_LIMITS.maxDurationMs,'maxDurationMs')}; const simd=raw.simd??'auto';if(![true,false,'auto'].includes(simd))throw new TypeError('simd must be boolean or auto'); - const signal=raw.signal;if(signal!==undefined&&!(signal instanceof AbortSignal))throw new TypeError('signal must be an AbortSignal'); + const signal=abortCapability(raw.signal); const controller=new AbortController();let abortReason='aborted'; const abort=()=>controller.abort(signal?.reason); if(signal?.aborted)abort();else signal?.addEventListener('abort',abort,{once:true}); @@ -111,7 +152,7 @@ export async function runEvolutionLoop(configuration) { rounds=round;let roundPromotions=0; for(const module of modules) { if(interrupted()){stopReason=abortReason;break outer;} - const source=await registry.get(module.id); + const source=programSnapshot(await registry.get(module.id)); if(interrupted()){stopReason=abortReason;break outer;} if(!source)throw new Error(`module ${module.id} is not registered`); const info=await inspectWeightModel(source.model); @@ -179,7 +220,7 @@ export async function runEvolutionLoop(configuration) { const context={round,moduleId:module.id,revision:source.revision,strategy:winner.strategy}; let commitEntered=false; try { - const current=await registry.get(module.id); + const current=programSnapshot(await registry.get(module.id)); if(current?.revision!==source.revision||current?.hash!==source.hash){observe(module.id,current);emit({...context,type:'stale'});continue;} if(interrupted()){stopReason=abortReason;break outer;} const proposal=await registry.propose(module.id,winner.patch,module.development.dataset,module.development.policy); @@ -195,7 +236,7 @@ export async function runEvolutionLoop(configuration) { emit({...context,type:'promoted',nextRevision:next.revision,candidateHash:next.hash,candidateMSE:winner.score}); } catch(error) { if(error?.code==='WSP_REGISTRY_PERSISTENCE'||(commitEntered&&error?.code!=='WSP_REGISTRY_STALE'))throw error; - const current=await registry.get(module.id); + const current=programSnapshot(await registry.get(module.id)); if(error?.code==='WSP_REGISTRY_STALE'||current?.revision!==source.revision||current?.hash!==source.hash){observe(module.id,current);emit({...context,type:'stale',reason:cleanError(error)});} else throw error; // Durability/runtime failures cannot be hidden as rejected mutations. } @@ -206,7 +247,7 @@ export async function runEvolutionLoop(configuration) { // Refresh behavioral goal evidence against active content before claiming convergence. for(const state of states.values()) { if(interrupted()){stopReason=abortReason;break outer;} - const current=await registry.get(state.id); + const current=programSnapshot(await registry.get(state.id)); if(interrupted()){stopReason=abortReason;break outer;} if(!current)throw new Error('registered module disappeared during loop'); observe(state.id,current); diff --git a/packages/wsp-toolkit/packages/loop/test/loop.test.mjs b/packages/wsp-toolkit/packages/loop/test/loop.test.mjs index 1d5296147..a932aea1d 100644 --- a/packages/wsp-toolkit/packages/loop/test/loop.test.mjs +++ b/packages/wsp-toolkit/packages/loop/test/loop.test.mjs @@ -48,6 +48,15 @@ test('abort and deadline terminate workers and prevent new promotion',async t=>{ const deadline=await runEvolutionLoop({registry,modules:[evolutionModules()[0]],maxDurationMs:1}); assert.equal(deadline.stopReason,'deadline');assert.equal(deadline.promotions,0);assert.equal((await registry.get('xor')).revision,1); }); + +test('native abort state is honored without executing shadow signal properties',async t=>{ + const registry=await setup(t),controller=new AbortController();controller.abort();let getters=0; + Object.defineProperty(controller.signal,'aborted',{get(){getters++;return false;}}); + Object.defineProperty(controller.signal,'addEventListener',{get(){getters++;throw new Error('shadow event getter');}}); + const result=await runEvolutionLoop({registry,modules:[evolutionModules()[0]],signal:controller.signal,simd:false}); + assert.equal(result.stopReason,'aborted');assert.equal(result.budget.proposals,0);assert.equal(getters,0); + await assert.rejects(runEvolutionLoop({registry,modules:[evolutionModules()[0]],signal:Object.create(AbortSignal.prototype)}),/signal|AbortSignal/); +}); test('newer revision wins when a competing coordinator changes state during proposal',async t=>{ const registry=await setup(t);let changed=false; const authority={ @@ -153,3 +162,38 @@ test('cancellation during final registry refresh preserves commits and reports c assert.equal(report.stopReason,'aborted');assert.equal(report.promotions,1); assert.equal((await registry.get('xor')).revision,2);assert.ok(report.events.some(e=>e.type==='promoted')); }); + +test('registry capability accessors are rejected without executing them',async t=>{ + const registry=await setup(t),module=evolutionModules()[0];module.strategies=[module.strategies[2]]; + let getters=0; + const accessor={get get(){getters++;return id=>registry.get(id);},propose:(...args)=>registry.propose(...args),promote:(...args)=>registry.promote(...args)}; + await assert.rejects(runEvolutionLoop({registry:accessor,modules:[module],simd:false}),/data method/); + assert.equal(getters,0); +}); + +test('registry capability replacement during an await cannot change promotion authority',async t=>{ + const registry=await setup(t),module=evolutionModules()[0];module.strategies=[module.strategies[2]]; + let release,changedCalls=0; + const entered=new Promise(resolve=>{release=resolve;}); + const authority={async get(id){await entered;return registry.get(id);},propose:(...args)=>registry.propose(...args),promote:(...args)=>registry.promote(...args)}; + const pending=runEvolutionLoop({registry:authority,modules:[module],simd:false}); + authority.propose=authority.promote=()=>{changedCalls++;throw new Error('replaced capability');}; + release(); + assert.equal((await pending).promotions,1); + assert.equal(changedCalls,0); +}); + +test('live registry results cannot rewrite the original same-hash CAS revision',async t=>{ + const registry=await setup(t),module=evolutionModules()[0];module.strategies=[module.strategies[2]]; + let reads=0,live; + const authority={async get(id){ + if(++reads===1){live=await registry.get(id);return live;} + if(reads===2){await registry.rollback(id,1,1);Object.assign(live,await registry.get(id));} + return registry.get(id); + },propose:(...args)=>registry.propose(...args),promote:(...args)=>registry.promote(...args)}; + const result=await runEvolutionLoop({registry:authority,modules:[module],maxRounds:1,simd:false}); + assert.equal(result.promotions,0); + assert.ok(result.events.some(event=>event.type==='stale')); + assert.equal(result.modules[0].initialRevision,1); + assert.equal((await registry.get('xor')).revision,2); +}); diff --git a/packages/wsp-toolkit/packages/search/src/index.js b/packages/wsp-toolkit/packages/search/src/index.js index 8c1190f0b..dd21d50dc 100644 --- a/packages/wsp-toolkit/packages/search/src/index.js +++ b/packages/wsp-toolkit/packages/search/src/index.js @@ -51,7 +51,17 @@ function measure(runtime, model, data, objective) { } } finally { prepared.dispose(); } const metrics = { mse, maxAbsoluteError }; - const score = objective ? finite(objective(deepFreeze({ predictions, metrics: { ...metrics }, model: clone(model) })), 'objective score') : mse; + let score = mse; + if (objective) { + const proposedScore = objective(deepFreeze({ predictions, metrics: { ...metrics }, model: clone(model) })); + if (proposedScore && typeof proposedScore === 'object') { + // Async objectives are invalid, but their rejection must not crash the host + // after it catches our validation error. The intrinsic brand-check refuses + // ordinary thenables without reading or calling their `then` property. + try { Promise.prototype.then.call(proposedScore, undefined, () => {}); } catch { /* not a native promise */ } + } + score = finite(proposedScore, 'objective score'); + } return { score, metrics }; } function patchFor(base, current, locations, baseHash) { diff --git a/packages/wsp-toolkit/packages/search/test/search.test.mjs b/packages/wsp-toolkit/packages/search/test/search.test.mjs index 949d22273..d0a3df5f6 100644 --- a/packages/wsp-toolkit/packages/search/test/search.test.mjs +++ b/packages/wsp-toolkit/packages/search/test/search.test.mjs @@ -1,5 +1,6 @@ import test from 'node:test'; import assert from 'node:assert/strict'; +import { execFileSync } from 'node:child_process'; import { loadRuntime } from 'ruv-fann'; import { applyWeightPatch, createWeightWorkspace, fingerprintModel } from 'ruv-fann-wsp'; import { searchWeightPatch, compileBooleanTable, createHebbianPatch, SEARCH_LIMITS } from '../src/index.js'; @@ -200,3 +201,23 @@ test('source schema and aggregate multi-candidate work reject before callbacks e await assert.rejects(searchWeightPatch(malformed, data(), policy(), options({ objective: () => { calls++; return 0; } })), /activation/); assert.equal(calls, 0); }); + +test('invalid objective thenables reject without reading their executable then getter', async () => { + let calls=0; + const thenable=Object.defineProperty({},'then',{get(){calls++;throw new Error('then getter executed');}}); + await assert.rejects(searchWeightPatch(linear(),data(),policy(),options({objective:()=>thenable})),/objective score/); + assert.equal(calls,0); +}); + +test('invalid asynchronous objective rejection is contained after the caller catches validation', () => { + const source = `import assert from 'node:assert/strict'; + import {searchWeightPatch} from ${JSON.stringify(new URL('../src/index.js', import.meta.url).href)}; + const model=${JSON.stringify(linear())}, dataset=${JSON.stringify(data())}, policy=${JSON.stringify(policy())}; + for (const objective of [async()=>{throw new Error('async failure');},()=>Promise.reject(new Error('promise failure'))]) { + await assert.rejects(searchWeightPatch(model,dataset,policy,{...${JSON.stringify(options())},objective}),/objective score/); + } + await new Promise(resolve=>setTimeout(resolve,10)); + const valid=await searchWeightPatch(model,dataset,policy,${JSON.stringify(options())}); + assert.equal(valid.evaluation.accepted,true);console.log('contained');`; + assert.equal(execFileSync(process.execPath,['--input-type=module','-e',source],{encoding:'utf8',timeout:10000}).trim(),'contained'); +}); diff --git a/packages/wsp-toolkit/packages/swarm/src/index.js b/packages/wsp-toolkit/packages/swarm/src/index.js index facf7e882..43f3c3b5d 100644 --- a/packages/wsp-toolkit/packages/swarm/src/index.js +++ b/packages/wsp-toolkit/packages/swarm/src/index.js @@ -14,8 +14,16 @@ function configuration(value = {}) { const timeoutMs = options.timeoutMs === undefined ? 5000 : integer(options.timeoutMs, 1, SWARM_LIMITS.maxTimeoutMs, 'timeoutMs'); const maxTotalWork = options.maxTotalWork === undefined ? SWARM_LIMITS.maxTotalWork : integer(options.maxTotalWork, 0, SWARM_LIMITS.maxTotalWork, 'maxTotalWork'); - if (options.signal !== undefined && !(options.signal instanceof AbortSignal)) throw new TypeError('signal must be an AbortSignal'); - return { concurrency, timeoutMs, maxTotalWork, signal: options.signal }; + let signal; + if (options.signal !== undefined) { + const source = options.signal, aborted = Object.getOwnPropertyDescriptor(AbortSignal.prototype, 'aborted').get; + if (!(source instanceof AbortSignal)) throw new TypeError('signal must be an AbortSignal'); + aborted.call(source); // Native brand check also rejects forged prototype chains. + signal = { get aborted() { return aborted.call(source); }, + addEventListener: EventTarget.prototype.addEventListener.bind(source), + removeEventListener: EventTarget.prototype.removeEventListener.bind(source) }; + } + return { concurrency, timeoutMs, maxTotalWork, signal }; } function errorText(value) { return typeof value?.message === 'string' ? value.message.slice(0, 512) : 'proposal worker failed'; } diff --git a/packages/wsp-toolkit/packages/swarm/test/swarm.test.mjs b/packages/wsp-toolkit/packages/swarm/test/swarm.test.mjs index fef2c47e8..fbcca6ffa 100644 --- a/packages/wsp-toolkit/packages/swarm/test/swarm.test.mjs +++ b/packages/wsp-toolkit/packages/swarm/test/swarm.test.mjs @@ -107,6 +107,15 @@ test('abort terminates active workers, never starts queued jobs and ignores late assert.equal(queued[0].status,'cancelled');assert.equal(queued[0].workerThreadId,undefined); }); +test('native abort state cannot be hidden by shadow getters or forged signal prototypes',async()=>{ + const controller=new AbortController();controller.abort();let getters=0; + Object.defineProperty(controller.signal,'aborted',{get(){getters++;return false;}}); + Object.defineProperty(controller.signal,'addEventListener',{get(){getters++;throw new Error('shadow event getter');}}); + const [result]=await runProposalSwarm([patchJob('pre-aborted')],{signal:controller.signal}); + assert.equal(result.status,'cancelled');assert.equal(result.workerThreadId,undefined);assert.equal(getters,0); + await assert.rejects(runProposalSwarm([patchJob('forged')],{signal:Object.create(AbortSignal.prototype)}),/signal|AbortSignal/); +}); + test('unknown operations/options, executable values, accessors and malformed data reject without executing getters',async()=>{ let invoked=0; for(const mutate of [ From b5faf4cdcaf0dc4f81ef5d21d5b4872fd234a75c Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 22:59:45 -0500 Subject: [PATCH 07/20] docs(core): illustrate the validated weight programming workflow --- packages/core/assets/weight-toolkit.svg | 64 +++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 packages/core/assets/weight-toolkit.svg diff --git a/packages/core/assets/weight-toolkit.svg b/packages/core/assets/weight-toolkit.svg new file mode 100644 index 000000000..5fe2be08b --- /dev/null +++ b/packages/core/assets/weight-toolkit.svg @@ -0,0 +1,64 @@ + + ruv-fann: train, inspect, test and explicitly promote small neural networks + Four illustrated cards show a small neural network, a proposed weight edit, independent validation gates and an explicit promotion to revision two. Proposals do not change the active model. This illustration is conceptual; the README links to a real WASM demonstration. + + + + + + + + + RUV-FANN · JAVASCRIPT + RUST + WASM + Small networks. Visible decisions. + Train a model. Inspect its weights. Test a change. Choose what becomes active. + + + 01 / RUN + TRAIN + + + + + + + Local neural inference + Batches · SGD · AdamW + + + + + 02 / PROPOSE + + weight[0] + 0 → 1 + + A bounded weight edit + Inspect · trace · search · ablate + + + + + 03 / VALIDATE + + + Development dataIndependent holdoutFinite-domain checks + Evidence before action + Failures preserve live weights + + + + + 04 / PROMOTE + + + v2 + Explicit revision change + History + explicit rollback + + + + A proposal stays separate from the active model until you promote it. + EXPLORE THE FIELD GUIDE ↗ + From 2be509d43ed46d35d48445b37976af36090085c1 Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 22:59:52 -0500 Subject: [PATCH 08/20] docs(core): explain toolkit capabilities, environments and safe weight edits --- packages/core/README.md | 146 ++++++++++++++++++++++++++++++++----- packages/core/package.json | 11 ++- 2 files changed, 132 insertions(+), 25 deletions(-) diff --git a/packages/core/README.md b/packages/core/README.md index 5b1fcf906..4b810c4ef 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -1,37 +1,51 @@ -# ruv-fann — neural networks for JavaScript and TypeScript +# ruv-fann — neural networks, WebAssembly and weight-space programming -Train and run dense neural networks in **Node.js and the browser** with a typed JavaScript API backed by **Rust and WebAssembly**. Use reusable batch inference, SGD or AdamW training, and automatic SIMD detection with one runtime dependency: `ruv-fann-wasm`. +Build small neural networks you can **run, train, inspect and change locally**. `ruv-fann` combines Rust-backed WebAssembly inference and SGD/AdamW training with explicit tools for weight-space programming: trace activations, search bounded edits, test independent holdouts and promote a model revision by choice.

- - Animated ruv-fann diagram: input data flows through a dense neural network to predictions, with an SGD or AdamW training loop. + + Animated ruv-fann weight programming diagram: run a neural network, propose a bounded weight edit, validate independent gates and explicitly promote a revision.

-[View animated diagram](https://raw.githubusercontent.com/ruvnet/ruv-FANN/a482ab31934257e8b6b25c9b9bbaac9e341ae27c/packages/core/assets/neural-network.svg) +[Explore the interactive field guide and live WASM demo](https://ruvnet.github.io/ruv-FANN/) · [View the illustrated workflow](https://raw.githubusercontent.com/ruvnet/ruv-FANN/main/packages/core/assets/weight-toolkit.svg) -[![npm version](https://img.shields.io/npm/v/ruv-fann?color=14b8a6)](https://www.npmjs.com/package/ruv-fann) -[![License: MIT](https://img.shields.io/badge/license-MIT-6366f1)](https://github.com/ruvnet/ruv-FANN/blob/main/packages/core/LICENSE) +[![npm version](https://img.shields.io/npm/v/ruv-fann?color=2d7068)](https://www.npmjs.com/package/ruv-fann) +[![License: MIT](https://img.shields.io/badge/license-MIT-172c2b)](https://github.com/ruvnet/ruv-FANN/blob/main/packages/core/LICENSE) [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D20.9-339933)](https://nodejs.org/) -[Quick start](#quick-start) · [Training](#train-a-neural-network) · [API reference](#api-reference) · [Browser setup](#browser-setup) · [AgentDB](#persist-models-with-agentdb) +[Quick start](#quick-start) · [Weight editing](#edit-weights-test-holdouts-and-promote-explicitly) · [Capabilities](#capability-entrypoints) · [Training](#train-a-neural-network) · [Browser setup](#browser-setup) · [AgentDB](#persist-models-with-agentdb) + +## What can you build? + +- **Local scoring and agent components:** reusable batch inference for small dense models, reranking features and application-specific numeric decisions. +- **Inspectable neural experiments:** real WASM activation traces, hidden-neuron ablation and numerical sensitivity to selected weights. +- **Controlled model improvement:** bounded coordinate search, regression suites, finite-domain invariants, explicit promotion and rollback. +- **AgentDB workflows:** persisted weight programs behind a caller-owned authority, with serialized revisions and explicit durability acknowledgement. +- **Deployment tools:** public Hugging Face dense JSON checkpoint loading, Cloudflare Worker handlers and bounded Node.js proposal workers. + +These tools operate on the versioned dense-layer model format. They do not turn this package into an LLM, general transformer loader, distributed training system or automatic production optimizer. Finite-domain tests give evidence for the inputs you tested; numerical sensitivity is a finite-difference estimate, not autograd. ## Choose your package -| Package | Use it for | Runtime dependencies | +| Package | Choose it when | Installed dependencies | | --- | --- | --- | -| **[ruv-fann](https://www.npmjs.com/package/ruv-fann)** | Typed models, batch predictions, SGD/AdamW training, validation and managed allocations | `ruv-fann-wasm` (exact version) | -| [ruv-fann-wasm](https://www.npmjs.com/package/ruv-fann-wasm) | Direct wasm-bindgen access, backend memory and manual object ownership | None | +| **[ruv-fann](https://www.npmjs.com/package/ruv-fann) 0.2.0** | You want inference/training plus the toolkit available through explicit `ruv-fann/*` imports | WASM, WSP and twelve toolkit packages, at exact versions | +| [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp) 0.2.0 | You need only weight inspection, edits, evaluation and local revision workspaces | Published core 0.1.2 → WASM 0.1.2 | +| [ruv-fann-wasm](https://www.npmjs.com/package/ruv-fann-wasm) 0.1.2 | You want direct wasm-bindgen objects and manual memory ownership | No runtime dependencies | +| [Individual toolkit packages](https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit#readme) | You want a particular integration with a smaller installation | Only that package's declared dependencies | + +The root import remains small and loads only the numerical runtime. Installing core 0.2.0 installs the complete toolkit; choosing a subpath controls what your application imports, not what npm downloads. The Cloudflare build integration brings `esbuild` and its platform-specific optional executable. The neural runtime itself requires no native addon build or Rust toolchain. AgentDB is an optional integration and is not installed automatically. -This SDK is useful for small dense models, local numeric scoring, learning experiments, and neural components in JavaScript agents. It runs model computation locally; Node loads the bundled WASM binaries from disk without a runtime download. ESM only; Node.js 20.9+ or a browser with WebAssembly support. +ESM only; Node.js 20.9+ or a browser with WebAssembly support. Model inference and training run locally. Node reads bundled WASM from disk without a runtime download; fetching a Hub model or public package metrics happens only when you explicitly invoke those integrations. ## Install ```sh -npm install ruv-fann +npm install ruv-fann@0.2.0 ``` -The WASM runtime is installed automatically. TypeScript declarations are included. No native addon build or Rust toolchain is needed to consume the npm package. +TypeScript declarations, the WASM runtime and toolkit dependencies are included. Start with `import { loadRuntime } from 'ruv-fann'`; import other capabilities only where needed. ## Quick start @@ -98,9 +112,101 @@ const checkpoint = JSON.stringify(result.model); Training supports `Linear`, `Sigmoid`, `SigmoidSymmetric`, `Tanh` and `ReLU`. Calls are synchronous and bounded; use a Worker for longer browser tasks. Optimizer state starts fresh on each call and is not part of the JSON checkpoint. +## Edit weights, test holdouts and promote explicitly + +Weight-space programming changes selected parameters directly instead of running an optimizer. A proposal stays separate from the active model until an explicit promotion succeeds. Save this complete example as `edit.mjs` and run `node edit.mjs`: + +```js +import { createWeightWorkspace, fingerprintModel } from 'ruv-fann/wsp'; +import { runRegressionGate } from 'ruv-fann/lifecycle'; + +const model = { + schema: 'ruv-fann.dense-layers/1', + layers: [{ + inputs: 1, outputs: 1, weights: [0], bias: [0], + activation: 'Linear', steepness: 1 + }] +}; +const development = { inputs: [0, 1, 2], targets: [1, 3, 5], rows: 3 }; +// Separate inputs, never used to choose this proposed edit. +const holdout = { inputs: [0.5, 1.5], targets: [2, 4], rows: 2 }; +const policy = { maxMSE: 0, maxRegressionMSE: 0, maxAbsoluteError: 0 }; +const workspace = await createWeightWorkspace(model); +const baseline = workspace.snapshot(); +const patch = { + schema: 'ruv-fann.weight-patch/1', + baseHash: await fingerprintModel(baseline.model), + edits: [ + { layer: 0, parameter: 'weights', index: 0, value: 2 }, + { layer: 0, parameter: 'bias', index: 0, value: 1 } + ] +}; + +const gate = await runRegressionGate({ + model: baseline.model, patch, + suites: [ + { name: 'development', dataset: development, policy }, + { name: 'held-out-inputs', dataset: holdout, policy } + ] +}); +if (!gate.accepted) throw new Error('Independent regression gate rejected the edit'); + +const proposal = await workspace.propose(patch, development, policy); +if (!proposal.evaluation.accepted || + proposal.evaluation.baseHash !== gate.baseHash || + proposal.evaluation.candidateHash !== gate.candidateHash) { + throw new Error('Proposal does not match the independently gated candidate'); +} +// Expected revision rejects a stale update. No promotion occurs before this call. +const active = workspace.promote(proposal.id, baseline.revision); +console.log(active.revision, active.model.layers[0].weights); // 2 [2] +const restored = workspace.rollback(baseline.revision, active.revision); +console.log(restored.revision, restored.model.layers[0].weights); // 3 [0] +``` + +A hash binds model contents; it does not authenticate a caller. This local workspace is in memory. Your application must keep holdout data away from proposal selection, enforce its own access policy and choose when a passing gate authorizes promotion. Use the registry and loop entrypoints when you need explicit persistent authority and coordinated workers. + +## Capability entrypoints + +Core 0.2.0 provides fourteen explicit, typed subpaths. Each re-exports its corresponding package API; none is eagerly imported by `ruv-fann`. + +| Import | Main capabilities | Environment | +| --- | --- | --- | +| `ruv-fann` | `loadRuntime`, reusable inference, SGD/AdamW training, `LIMITS` | Node.js and browsers | +| `ruv-fann/wsp` | `inspectWeightModel`, `traceWeightModel`, `analyzeWeightSensitivity`, patches, evaluation, workspaces | Node.js and secure-context browsers | +| `ruv-fann/search` | `searchWeightPatch`, experimental Boolean compilation and bounded Hebbian proposals | Node.js and secure-context browsers | +| `ruv-fann/lifecycle` | `runRegressionGate`, isolated `evaluatePatchBranches` | Node.js and secure-context browsers | +| `ruv-fann/invariants` | `checkModelInvariants`, finite Boolean-domain checks | Node.js and secure-context browsers | +| `ruv-fann/registry` | `createAgentDBRegistry`, serialized revisions and durability callbacks | Node.js; browser import with a supplied compatible authority | +| `ruv-fann/huggingface` | `loadHubModel`, `loadHubLinearHead`, integrity-pinned public dense JSON | Node.js; browsers subject to fetch/CORS policy | +| `ruv-fann/cloudflare` | `createWorkerHandler`, bounded stateless WSP requests | Cloudflare Workers; caller supplies authentication/runtime configuration | +| `ruv-fann/cloudflare/build` | `buildWorker`, bundled static WASM assets | Node.js build tooling | +| `ruv-fann/swarm` | `runProposalSwarm`, bounded fixed-operation worker proposals | Node.js worker threads | +| `ruv-fann/loop` | `runEvolutionLoop`, budgets, independent gates and authority-based promotion | Node.js worker threads | +| `ruv-fann/ruos` | `runWasmCanary`, validation commands and trusted host-result checks | Canary: Node.js/browsers; host commands: caller-controlled ruOS workflow | +| `ruv-fann/contracts` | Bounded constellation catalog and module validation | Node.js and browsers | +| `ruv-fann/constellation` | `readCatalog`, `planProfile`, explicit satellite scaffolding | Node.js filesystem tooling | +| `ruv-fann/telemetry` | Explicit public metric collection, analysis and HTML dashboard rendering | Node.js; browser imports, with fetch/CORS restrictions | + +WSP imposes its own bounded edit, model, dataset and compute limits. Search, invariants, gates and loops add separate budgets; see each [toolkit package's API and limits](https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages). Experimental Boolean compilation is exact only on its complete binary input domain. Custom search objectives and registry callbacks are trusted application code, not a sandbox. The loop selects among fixed operations; it does not execute generated code or call an LLM provider. + +### Dependency versions and compatibility + +The new facade preserves already-published dependency contracts: + +```text +ruv-fann@0.2.0 +├─ ruv-fann-wasm@0.1.2 +├─ ruv-fann-wsp@0.2.0 ─ ruv-fann@0.1.2 ─ ruv-fann-wasm@0.1.2 +└─ twelve toolkit packages@0.1.0 + └─ WSP@0.2.0 and, where declared, core@0.1.2 +``` + +This is a finite, versioned dependency graph: core 0.1.2 depends only on WASM, so it never imports core 0.2.0 or the facade. npm may install nested copies of core 0.1.2 to satisfy exact pins. Both generations share the dense-layer JSON format. The facade does not silently repoint old toolkit dependencies or promise a single JavaScript runtime cache across package generations. Keep their separate resolution when constructing a browser import map. + ## Browser setup -The same API runs in browsers. For a bundler-free deployment, copy the installed packages' `src` directories and the WASM package's `dist` directory into this layout: +The root inference/training API runs in browsers without loading Node-only capabilities. For a bundler-free deployment, copy the installed packages' `src` directories and the WASM package's `dist` directory into this layout: ```text vendor/ @@ -125,7 +231,9 @@ vendor/ ``` -Serve over HTTP(S), with `.wasm` files as `application/wasm`. Keep the WASM package's relative `src`/`dist` paths intact. Bundlers must preserve the dynamic binding imports and WASM asset URLs. Your Content Security Policy must allow WebAssembly compilation. +Serve over HTTP(S), with `.wasm` files as `application/wasm`. Keep the WASM package's relative `src`/`dist` paths intact. Bundlers must preserve the dynamic binding imports and WASM asset URLs. Your Content Security Policy must allow WebAssembly compilation. The root-only map above needs no toolkit or legacy-core entries. + +For browser WSP/search/gates, also copy the chosen packages and their transitive dependencies, map each `ruv-fann/*` wrapper and bare package name, and use import-map **scopes** so WSP/toolkit package URLs resolve their pinned `ruv-fann` to core 0.1.2. Do not globally replace that pin with core 0.2.0. A bundler can resolve these installed dependency versions for you, but still needs to preserve WASM assets. Use HTTPS or localhost for WebCrypto; do not import the Node-only worker, scaffold or build entrypoints into a browser bundle. ## API reference @@ -204,13 +312,13 @@ inference/training. WASM memory views, proxies and spoofed arrays reject. ## Persist models with AgentDB -[AgentDB 3.8.0](https://www.npmjs.com/package/agentdb/v/3.8.0) integrates the FANN SDK for persisted model checkpoints, revision-safe training updates and cached predictions. It provides six neural MCP tools: `agentdb_neural_create`, `agentdb_neural_get`, `agentdb_neural_list`, `agentdb_neural_predict`, `agentdb_neural_train` and `agentdb_neural_delete`. +[AgentDB 3.10.0](https://www.npmjs.com/package/agentdb/v/3.10.0) supports persisted neural checkpoints, revision-safe updates and weight-program workflows. Use the [neural model guide](https://github.com/ruvnet/agentdb/blob/main/docs/neural/ruv-fann.md) for controllers and MCP access policies. -See the [AgentDB neural model guide](https://github.com/ruvnet/agentdb/blob/main/docs/neural/ruv-fann.md) for controller usage and MCP access policies. AgentDB is an optional integration; it is not a dependency of this SDK. +`ruv-fann/registry` exposes `createAgentDBRegistry(programs, options)`. Supply your application's trusted `WeightPrograms` capability and explicit durability callbacks; the adapter serializes operations and reports persistence failures rather than treating an in-memory change as a durable acknowledgement. `ruv-fann/loop` consumes that authority through its registry interface. Neither importing core nor importing the registry opens a database, grants a model permission or installs AgentDB. Install/configure AgentDB separately if your application uses it, and close resources through their owning application. ## Validation and performance -The release workflow exercises real WASM inference and training on Node.js 22 and 24, Chromium, strict installed TypeScript declarations, mutation checks and fresh packed/public npm consumers. Both core and SIMD backends are exercised on capable hosts. +Qualification uses fresh installed archives, real Node.js and Chromium WASM/SIMD inference and training, strict TypeScript for all fourteen capability subpaths, and independent numerical oracles for weight search, holdout gates, finite-domain checks, rejection and rollback. Browser import checks cover ten portable subpaths; Node-only integrations are tested in their own environments. A removed search wrapper must make installed-consumer qualification fail. Release publication separately requires the protected workflow and public archive byte verification; local source tests alone are not release evidence. For a benchmark on your own machine, run `npm run benchmark` in `packages/core` of the [source repository](https://github.com/ruvnet/ruv-FANN). It compares batched calls with per-row calls and verifies matching outputs. Performance depends on model shape, batch size and hardware; SIMD availability alone does not guarantee a speedup. diff --git a/packages/core/package.json b/packages/core/package.json index 530a6de96..6f561e68a 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -105,9 +105,7 @@ }, "keywords": [ "ruv-fann", - "fann", "neural-network", - "neural-networks", "machine-learning", "webassembly", "wasm", @@ -120,15 +118,16 @@ "training", "sgd", "adamw", - "agentdb", "weight-space-programming", - "weight-editing", + "model-editing", "bounded-search", - "invariants" + "model-evaluation", + "agentdb", + "cloudflare-workers" ], "main": "./src/index.js", "types": "./src/index.d.ts", - "homepage": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/core#readme", + "homepage": "https://ruvnet.github.io/ruv-FANN/", "bugs": { "url": "https://github.com/ruvnet/ruv-FANN/issues" } From fd7943cd240361b0bc464a5dc9c2bb5d3fb0aafc Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 22:57:45 -0500 Subject: [PATCH 09/20] ci: seal and publish thirteen exact toolkit and core archives --- .../workflows/protected-toolkit-release.yml | 84 +++++++++ .github/workflows/protected-wsp-release.yml | 11 +- .github/workflows/wsp-toolkit.yml | 66 +++++-- .../wsp-toolkit/scripts/packed-consumer.mjs | 17 +- scripts/constellation-oidc.test.mjs | 14 +- scripts/toolkit-candidate-download.mjs | 30 +++ scripts/toolkit-release-lane.mjs | 178 ++++++++++++++++++ scripts/toolkit-release-lib.mjs | 86 +++++++++ scripts/toolkit-release.test.mjs | 29 +++ scripts/wsp-release-lane.mjs | 33 +--- 10 files changed, 486 insertions(+), 62 deletions(-) create mode 100644 .github/workflows/protected-toolkit-release.yml create mode 100644 scripts/toolkit-candidate-download.mjs create mode 100644 scripts/toolkit-release-lane.mjs create mode 100644 scripts/toolkit-release-lib.mjs create mode 100644 scripts/toolkit-release.test.mjs diff --git a/.github/workflows/protected-toolkit-release.yml b/.github/workflows/protected-toolkit-release.yml new file mode 100644 index 000000000..a27b69d6c --- /dev/null +++ b/.github/workflows/protected-toolkit-release.yml @@ -0,0 +1,84 @@ +name: protected-toolkit-release + +on: + workflow_dispatch: + inputs: + expected_sha: + description: Exact qualified current main commit to publish + required: true + type: string + +permissions: + contents: read + issues: read + actions: read + +concurrency: + group: protected-toolkit-release + cancel-in-progress: false + +jobs: + publish: + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-24.04 + timeout-minutes: 60 + permissions: + contents: write + issues: read + actions: read + id-token: write + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ inputs.expected_sha }} + persist-credentials: false + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: '24.22.1' + registry-url: https://registry.npmjs.org + package-manager-cache: false + - name: Require exact current main and zero release blockers + env: + EXPECTED_SHA: ${{ inputs.expected_sha }} + GH_TOKEN: ${{ github.token }} + run: | + test "$GITHUB_REF" = refs/heads/main + test "$GITHUB_SHA" = "$EXPECTED_SHA" + test "$(git rev-parse HEAD)" = "$EXPECTED_SHA" + test "$(gh api repos/${GITHUB_REPOSITORY}/commits/main --jq .sha)" = "$EXPECTED_SHA" + test "$(gh api "repos/${GITHUB_REPOSITORY}/issues?labels=release-blocker&state=open&per_page=1" --jq length)" = 0 + - name: Download and fully verify the successful exact-source qualification artifact + env: + GH_TOKEN: ${{ github.token }} + run: node scripts/toolkit-candidate-download.mjs --expected-sha "${{ inputs.expected_sha }}" --output "$RUNNER_TEMP/toolkit-candidate" + - name: Publish only sealed archives in dependency order with provenance + env: + GH_TOKEN: ${{ github.token }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: node scripts/toolkit-release-lane.mjs publish --directory "$RUNNER_TEMP/toolkit-candidate" --output "$RUNNER_TEMP/toolkit-publication" + - name: Install public-consumer tooling without executing lifecycle scripts + env: + NODE_AUTH_TOKEN: '' + run: | + npm ci --prefix packages/wsp-toolkit --ignore-scripts --no-audit --no-fund + packages/wsp-toolkit/node_modules/.bin/playwright install --with-deps chromium + - name: Require fresh-cache public bytes, sealed dependency lock, strict types and real Chromium/WASM consumer + env: + NODE_AUTH_TOKEN: '' + NPM_TOKEN: '' + run: node scripts/toolkit-release-lane.mjs public-consumer --directory "$RUNNER_TEMP/toolkit-candidate" --publication "$RUNNER_TEMP/toolkit-publication/publication.json" --output "$RUNNER_TEMP/toolkit-public-consumer.json" + - name: Create and download-verify the exact-source GitHub release and all sealed assets + env: + GH_TOKEN: ${{ github.token }} + run: node scripts/toolkit-release-lane.mjs github-release --directory "$RUNNER_TEMP/toolkit-candidate" --publication "$RUNNER_TEMP/toolkit-publication/publication.json" --public-consumer "$RUNNER_TEMP/toolkit-public-consumer.json" --output "$RUNNER_TEMP/toolkit-release-receipt.json" + - if: always() + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: toolkit-publication-${{ inputs.expected_sha }} + path: | + ${{ runner.temp }}/toolkit-candidate/ + ${{ runner.temp }}/toolkit-publication/ + ${{ runner.temp }}/toolkit-public-consumer.json + ${{ runner.temp }}/toolkit-release-receipt.json + if-no-files-found: error + retention-days: 90 diff --git a/.github/workflows/protected-wsp-release.yml b/.github/workflows/protected-wsp-release.yml index 66e7f0a5d..ccba5bf92 100644 --- a/.github/workflows/protected-wsp-release.yml +++ b/.github/workflows/protected-wsp-release.yml @@ -34,7 +34,7 @@ jobs: persist-credentials: false - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: - node-version: '24.22.1' + node-version: '24.0.0' registry-url: https://registry.npmjs.org package-manager-cache: false - name: Require exact current main and reviewed SHA @@ -47,19 +47,14 @@ jobs: test "$(git rev-parse HEAD)" = "$EXPECTED_SHA" test "$(gh api repos/${GITHUB_REPOSITORY}/commits/main --jq .sha)" = "$EXPECTED_SHA" test "$(gh api "repos/${GITHUB_REPOSITORY}/issues?labels=release-blocker&state=open&per_page=1" --jq length)" = 0 - - name: Pin npm CLI with trusted publishing support - run: | - npm install --prefix "$RUNNER_TEMP/wsp-npm-cli" --ignore-scripts --no-audit --no-fund npm@11.9.0 - echo "$RUNNER_TEMP/wsp-npm-cli/node_modules/.bin" >> "$GITHUB_PATH" - name: Download and verify only the exact successful qualification artifact env: GH_TOKEN: ${{ github.token }} run: node scripts/wsp-candidate-download.mjs --expected-sha "${{ inputs.expected_sha }}" --output "$RUNNER_TEMP/wsp-candidate" - - name: Publish exact archive using npm OIDC and provenance or verify identical existing version + - name: Publish exact archive with npm provenance or verify identical existing version env: GH_TOKEN: ${{ github.token }} - NODE_AUTH_TOKEN: '' - NPM_TOKEN: '' + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} run: node scripts/wsp-release-lane.mjs publish --seal "$RUNNER_TEMP/wsp-candidate/candidate-seal.json" --output "$RUNNER_TEMP/wsp-publication.json" - name: Verify fresh-cache public install and full real-WASM consumer env: diff --git a/.github/workflows/wsp-toolkit.yml b/.github/workflows/wsp-toolkit.yml index 09ede5635..40e1475a7 100644 --- a/.github/workflows/wsp-toolkit.yml +++ b/.github/workflows/wsp-toolkit.yml @@ -5,47 +5,73 @@ on: branches: [main] paths: - 'packages/wsp-toolkit/**' + - 'packages/core/**' + - 'scripts/toolkit-*.mjs' - 'scripts/constellation-oidc*.mjs' - 'scripts/wsp-release-lane.mjs' - '.github/workflows/protected-wsp-release.yml' + - '.github/workflows/protected-toolkit-release.yml' - '.github/workflows/constellation-observatory.yml' - '.github/workflows/wsp-toolkit.yml' workflow_dispatch: + inputs: + expected_sha: + description: Exact reviewed commit to qualify + required: true + type: string permissions: contents: read +concurrency: + group: toolkit-qualification-${{ github.event.pull_request.head.sha || inputs.expected_sha || github.sha }} + cancel-in-progress: false + jobs: qualify: + name: Node 22/24 and Chromium, thirteen sealed archives runs-on: ubuntu-24.04 - timeout-minutes: 20 - strategy: - fail-fast: false - matrix: - node: ['22.13.0', '24.22.1'] - defaults: - run: - working-directory: packages/wsp-toolkit + timeout-minutes: 50 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: + ref: ${{ github.event.pull_request.head.sha || inputs.expected_sha || github.sha }} persist-credentials: false + - name: Require exact requested source + env: + EXPECTED_SHA: ${{ github.event.pull_request.head.sha || inputs.expected_sha || github.sha }} + run: test "$(git rev-parse HEAD)" = "$EXPECTED_SHA" + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: '22.23.2' + package-manager-cache: false + - name: Install locked tooling and real AgentDB integration without lifecycle scripts + run: | + npm ci --prefix packages/wsp-toolkit --ignore-scripts --no-audit --no-fund + npm run --prefix packages/wsp-toolkit setup:agentdb + packages/wsp-toolkit/node_modules/.bin/playwright install --with-deps chromium + - name: Require release guard mutation tests + run: node --test scripts/toolkit-release.test.mjs + - name: Pack all thirteen archives exactly once from clean source + run: node scripts/toolkit-release-lane.mjs pack --directory "$RUNNER_TEMP/toolkit-candidate" + - name: Qualify canonical archives, strict types, browser, integration, work benchmark and audits on Node 22 + run: node scripts/toolkit-release-lane.mjs qualify --directory "$RUNNER_TEMP/toolkit-candidate" - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: - node-version: ${{ matrix.node }} + node-version: '24.22.1' package-manager-cache: false - - name: Install locked dependencies without lifecycle scripts - run: npm ci --ignore-scripts --no-audit --no-fund - - name: Install locked real AgentDB integration runtime - run: npm run setup:agentdb - - name: Install real Chromium - run: npx --no-install playwright install --with-deps chromium - - name: Require types, zero-skip tests, real WASM, packed consumers, benchmark and clean audit - run: npm run validate + - name: Qualify the same archives and Node 22 dependency resolution on Node 24 + run: node scripts/toolkit-release-lane.mjs qualify --directory "$RUNNER_TEMP/toolkit-candidate" + - name: Seal source, dependency graph, package SRI and both non-skipped qualifications + env: + EXPECTED_SHA: ${{ github.event.pull_request.head.sha || inputs.expected_sha || github.sha }} + run: | + node scripts/toolkit-release-lane.mjs seal --expected-sha "$EXPECTED_SHA" --directory "$RUNNER_TEMP/toolkit-candidate" + node scripts/toolkit-release-lane.mjs verify --directory "$RUNNER_TEMP/toolkit-candidate" - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: - name: wsp-toolkit-node-${{ matrix.node }}-${{ github.sha }} - path: packages/wsp-toolkit/.artifacts/ + name: toolkit-candidate-${{ github.event.pull_request.head.sha || inputs.expected_sha || github.sha }} + path: ${{ runner.temp }}/toolkit-candidate/ include-hidden-files: true if-no-files-found: error - retention-days: 30 + retention-days: 90 diff --git a/packages/wsp-toolkit/scripts/packed-consumer.mjs b/packages/wsp-toolkit/scripts/packed-consumer.mjs index a3f1fb53f..22531c295 100644 --- a/packages/wsp-toolkit/scripts/packed-consumer.mjs +++ b/packages/wsp-toolkit/scripts/packed-consumer.mjs @@ -14,7 +14,22 @@ export async function packToolkit(directory) { export async function verifyPackedConsumer() { const directory=await mkdtemp(join(tmpdir(),'wsp-consumer-')); try { - const archives=await packToolkit(directory); + // Protected qualification reuses the one canonical candidate pack on both runtimes. + // Developer npm test retains the standalone packing smoke test. + let archives; + if(process.env.WSP_TOOLKIT_CANDIDATE) { + const manifestPath=resolve(process.env.WSP_TOOLKIT_CANDIDATE); + const manifest=JSON.parse(await readFile(manifestPath,'utf8')); + if(manifest.sourceSha!==process.env.EXPECTED_SHA||manifest.packages?.length!==13)throw Error('Canonical candidate source/package count mismatch'); + archives=manifest.packages.filter(p=>names.includes(p.name)).map(p=>({...p,filename:p.tarball})); + if(archives.length!==12)throw Error('Canonical candidate must contain all twelve toolkit packages'); + for(const item of archives) { + if(!/^[A-Za-z0-9][A-Za-z0-9._-]*\.tgz$/.test(item.filename)||item.filename.includes('..'))throw Error('Unsafe candidate archive filename'); + const bytes=await readFile(join(dirname(manifestPath),item.filename)); + if(createHash('sha256').update(bytes).digest('hex')!==item.sha256)throw Error('Canonical archive digest mismatch'); + await copyFile(join(dirname(manifestPath),item.filename),join(directory,item.filename)); + } + } else archives=await packToolkit(directory); await writeFile(join(directory,'package.json'),JSON.stringify({private:true,type:'module'})); execFileSync('npm',['install','--ignore-scripts','--prefer-offline','--no-audit','--no-fund',...archives.map(p=>join(directory,p.filename))],{cwd:directory,encoding:'utf8'}); await copyFile(join(toolkitRoot,'test','scenario.mjs'),join(directory,'scenario.mjs')); diff --git a/scripts/constellation-oidc.test.mjs b/scripts/constellation-oidc.test.mjs index 7dbb67b01..72fb75629 100644 --- a/scripts/constellation-oidc.test.mjs +++ b/scripts/constellation-oidc.test.mjs @@ -101,7 +101,7 @@ test('isolated publish environment removes token/config fallback, retains proxy/ env.PATH='changed';assert.equal(input.PATH,undefined); }); -test('actual publication entry point rejects a foreign context before registry or gh operations', async () => { +test('current publication entry point rejects a foreign context before registry or gh operations', async () => { const directory=await mkdtemp(join(tmpdir(),'wsp-oidc-entry-')); try { const checkoutSha=execFileSync('git',['rev-parse','HEAD'],{encoding:'utf8',cwd:new URL('..',import.meta.url)}).trim(); @@ -109,20 +109,18 @@ test('actual publication entry point rejects a foreign context before registry o const env={...process.env,...context().env,GITHUB_REPOSITORY:'foreign/forbidden',GITHUB_SHA:checkoutSha}; const result=spawnSync(process.execPath,[new URL('./wsp-release-lane.mjs',import.meta.url).pathname,'publish','--seal',file,'--output',join(directory,'publication.json')], {encoding:'utf8',env,timeout:10000}); - assert.notEqual(result.status,0);assert.match(result.stderr,/OIDC publishing requires (?:the exact protected|Node >=22\.14\.0)/); + assert.notEqual(result.status,0);assert.match(result.stderr,/publication requires/); assert.equal(result.stderr.includes(oidcCapability),false); await assert.rejects(readFile(join(directory,'publication.json')),error=>error.code==='ENOENT'); } finally {await rm(directory,{recursive:true,force:true});} }); -test('protected workflow pins tools, grants OIDC and preserves exact-archive qualification without npm secrets', async () => { +test('existing protected workflow retains explicit token auth until trusted publisher setup is verified', async () => { const workflow=await readFile(new URL('../.github/workflows/protected-wsp-release.yml',import.meta.url),'utf8'); const lane=await readFile(new URL('./wsp-release-lane.mjs',import.meta.url),'utf8'); - assert.match(workflow,/id-token: write/);assert.match(workflow,/node-version: '24\.22\.1'/);assert.match(workflow,/npm@11\.9\.0/); - assert.doesNotMatch(workflow,/secrets\.NPM_TOKEN/);assert.match(workflow,/NODE_AUTH_TOKEN: ''/);assert.match(workflow,/NPM_TOKEN: ''/); + assert.match(workflow,/id-token: write/);assert.match(workflow,/secrets\.NPM_TOKEN/); assert.match(workflow,/wsp-candidate-download\.mjs --expected-sha/); - assert.match(lane,/validateOIDCPublishContext\(/);assert.match(lane,/await verifySeal\(seal, dirname\(sealPath\)\)/); + assert.match(lane,/protectedContext\(seal.sourceSha\)/);assert.match(lane,/await verifySeal\(seal, dirname\(sealPath\)\)/); assert.match(lane,/'--ignore-scripts', '--access', 'public', '--provenance'/); - assert.match(lane,/createTokenlessPublishEnvironment\(process\.env/); - assert.doesNotMatch(lane,/Missing NPM_TOKEN/); + assert.match(lane,/Missing NPM_TOKEN/); }); diff --git a/scripts/toolkit-candidate-download.mjs b/scripts/toolkit-candidate-download.mjs new file mode 100644 index 000000000..92774832b --- /dev/null +++ b/scripts/toolkit-candidate-download.mjs @@ -0,0 +1,30 @@ +#!/usr/bin/env node +// Never accept a caller-supplied run id: select successful upstream exact-head qualification. +import {execFileSync} from 'node:child_process'; +import {mkdtemp,mkdir,readdir,rename,rm,readFile} from 'node:fs/promises'; +import {join,resolve} from 'node:path'; +import {tmpdir} from 'node:os'; +import {assertSourceSha,safeFilename} from './toolkit-release-lib.mjs'; +const args=process.argv.slice(2),options=Object.create(null); +for(let i=0;iexecFileSync(bin,args,{encoding:'utf8',stdio:['ignore','pipe','inherit'],timeout:5*60_000,maxBuffer:10*1024*1024}).trim(); +const api=path=>JSON.parse(run('gh',['api',path])),repo='ruvnet/ruv-FANN'; +const runs=api(`repos/${repo}/actions/workflows/wsp-toolkit.yml/runs?head_sha=${sha}&status=completed&per_page=100`).workflow_runs + .filter(row=>row.head_sha===sha&&row.head_repository?.full_name===repo&&row.conclusion==='success'&&['pull_request','workflow_dispatch'].includes(row.event)) + .sort((a,b)=>b.run_number-a.run_number); +let selected;const name=`toolkit-candidate-${sha}`; +for(const item of runs){const matches=api(`repos/${repo}/actions/runs/${item.id}/artifacts?per_page=100`).artifacts.filter(row=>row.name===name&&!row.expired);if(matches.length===1){selected=item;break;}} +if(!selected)throw Error('No successful upstream exact-source sealed candidate artifact'); +const temp=await mkdtemp(join(tmpdir(),'toolkit-candidate-download-')); +try{ + run('gh',['run','download',String(selected.id),'-R',repo,'-n',name,'-D',temp]); + const files=await readdir(temp);files.forEach(safeFilename); + const seal=JSON.parse(await readFile(join(temp,'candidate-seal.json'),'utf8')); + if(seal.sourceSha!==sha)throw Error('Downloaded seal source mismatch'); + run(process.execPath,['scripts/toolkit-release-lane.mjs','verify','--directory',temp]); + await mkdir(output,{recursive:true});if((await readdir(output)).length)throw Error('Candidate output must be empty'); + for(const file of files)await rename(join(temp,file),join(output,file)); + console.log(JSON.stringify({status:'verified',sourceSha:sha,runId:selected.id,artifact:name})); +}finally{await rm(temp,{recursive:true,force:true});} diff --git a/scripts/toolkit-release-lane.mjs b/scripts/toolkit-release-lane.mjs new file mode 100644 index 000000000..70af3be6c --- /dev/null +++ b/scripts/toolkit-release-lane.mjs @@ -0,0 +1,178 @@ +#!/usr/bin/env node +// One canonical pack, two installed-runtime qualifications, protected publication, public-byte proof. +import { execFileSync } from 'node:child_process'; +import { readFile,writeFile,readdir,mkdir,mkdtemp,rm,copyFile } from 'node:fs/promises'; +import { join,resolve,dirname,basename } from 'node:path'; +import { tmpdir } from 'node:os'; +import { fileURLToPath } from 'node:url'; +import { schema,releaseTag,packageSpecs,sha256,integrity,tarballURL,safeFilename,assertSourceSha,topologicalOrder,validateRows,validateCoreReceipt,validateQualification,publicLock } from './toolkit-release-lib.mjs'; +const root=resolve(fileURLToPath(new URL('..',import.meta.url))),toolkit=join(root,'packages/wsp-toolkit'); +const args=process.argv.slice(2),mode=args.shift(),options=Object.create(null); +for(let i=0;i{if(!options[name])throw Error(`Missing --${name}`);return options[name];}; +const run=(command,argv,cwd=root,env=process.env)=>execFileSync(command,argv,{cwd,env,encoding:'utf8',stdio:['ignore','pipe','inherit'],maxBuffer:32*1024*1024,timeout:40*60_000}).trim(); +const json=async path=>JSON.parse(await readFile(path,'utf8')); +const save=async(path,data)=>{await mkdir(dirname(path),{recursive:true});await writeFile(path,JSON.stringify(data,null,2)+'\n',{flag:'wx'});}; +const gitSha=()=>run('git',['rev-parse','HEAD']); +const clean=()=>{if(run('git',['status','--porcelain']))throw Error('Release source must be clean');}; +const source=()=>assertSourceSha(gitSha()); +const cleanEnv=()=>Object.fromEntries(Object.entries(process.env).filter(([key])=>!/^(?:NPM_TOKEN|NODE_AUTH_TOKEN|GH_TOKEN|GITHUB_TOKEN|CARGO_REGISTRY_TOKEN|ACTIONS_ID_TOKEN_REQUEST_TOKEN|ACTIONS_ID_TOKEN_REQUEST_URL|npm_config_.*auth.*)$/i.test(key))); +async function isolatedEnv(target){ + const env=cleanEnv(),config=join(target,'consumer.npmrc'),globalConfig=join(target,'global.npmrc'); + await writeFile(config,'registry=https://registry.npmjs.org\n');await writeFile(globalConfig,''); + for(const key of Object.keys(env))if(/^npm_config_(userconfig|globalconfig|cache|registry)$/i.test(key))delete env[key]; + return {...env,NPM_CONFIG_USERCONFIG:config,NPM_CONFIG_GLOBALCONFIG:globalConfig,NPM_CONFIG_REGISTRY:'https://registry.npmjs.org'}; +} +async function metadata(path){ + const names=run('tar',['-tzf',path]).split('\n'); + if(names.length>2000||names.some(name=>!name.startsWith('package/')||name.includes('..')||name.includes('\\')||name.startsWith('/')))throw Error('Unsafe package archive paths'); + if(run('tar',['-tvzf',path]).split('\n').some(line=>!/^[-d]/.test(line)))throw Error('Archive links and special files forbidden'); + return JSON.parse(run('tar',['-xOzf',path,'package/package.json'])); +} +async function inspectRows(directory,rows){ + validateRows(rows); + for(const row of rows){ + const path=join(directory,safeFilename(row.tarball)),bytes=await readFile(path),pkg=await metadata(path); + if(sha256(bytes)!==row.sha256||integrity(bytes)!==row.integrity||pkg.name!==row.name||pkg.version!==row.version||pkg.private||JSON.stringify(pkg.dependencies??{})!==JSON.stringify(row.dependencies))throw Error(`Archive identity, dependency or digest mismatch: ${row.name}`); + const spec=packageSpecs.find(spec=>spec.name===row.name),tracked=await json(join(root,spec.directory,'package.json')); + if(pkg.name!==tracked.name||pkg.version!==tracked.version||JSON.stringify(pkg.dependencies??{})!==JSON.stringify(tracked.dependencies??{}))throw Error('Archive differs from source package identity/dependencies'); + } +} +async function pack(){ + clean();const directory=resolve(need('directory'));await mkdir(directory,{recursive:true}); + if((await readdir(directory)).length)throw Error('Canonical pack directory must be empty'); + const rows=[]; + for(const spec of packageSpecs){ + const pkg=await json(join(root,spec.directory,'package.json'));if(pkg.name!==spec.name||pkg.version!==spec.version||pkg.private)throw Error(`Unexpected source package: ${spec.name}`); + const result=JSON.parse(run('npm',['pack','--json','--ignore-scripts','--pack-destination',directory],join(root,spec.directory),cleanEnv())); + if(result.length!==1)throw Error('Pack must emit exactly one archive'); + const tarball=safeFilename(result[0].filename),bytes=await readFile(join(directory,tarball)); + rows.push({name:pkg.name,version:pkg.version,tarball,sha256:sha256(bytes),integrity:integrity(bytes),dependencies:pkg.dependencies??{}}); + } + const manifest={schema:`${schema}.candidate/1`,sourceSha:source(),sourceTree:run('git',['rev-parse','HEAD^{tree}']),releaseTag,packages:topologicalOrder(rows)}; + await inspectRows(directory,manifest.packages);await save(join(directory,'package-manifest.json'),manifest); +} +async function candidate(directory){ + const manifest=await json(join(directory,'package-manifest.json')); + if(manifest.schema!==`${schema}.candidate/1`||manifest.sourceSha!==source()||manifest.sourceTree!==run('git',['rev-parse','HEAD^{tree}'])||manifest.releaseTag!==releaseTag)throw Error('Candidate source/identity mismatch'); + await inspectRows(directory,manifest.packages);return manifest; +} +async function installCandidate(directory,target,env){ + const manifest=await candidate(directory); + await writeFile(join(target,'package.json'),JSON.stringify({name:'toolkit-release-consumer',version:'1.0.0',private:true,type:'module'})); + run('npm',['install','--ignore-scripts','--no-audit','--no-fund','--cache',join(target,'npm-cache'),...manifest.packages.map(row=>join(directory,row.tarball))],target,env); + for(const row of manifest.packages){const pkg=await json(join(target,'node_modules',row.name,'package.json'));if(pkg.version!==row.version)throw Error('Wrong installed candidate version');} + return manifest; +} +async function coreConsumer(target,output,sourceSha,env){ + run(process.execPath,[join(root,'packages/core/test/installed-consumer.mjs'),target,output],root,{...env,EXPECTED_SHA:sourceSha,RUV_FANN_PLAYWRIGHT:join(toolkit,'node_modules/playwright'),RUV_FANN_TSC:join(toolkit,'node_modules/typescript/bin/tsc')}); + const report=await json(output);validateCoreReceipt(report,sourceSha);return report; +} +async function qualify(){ + clean();const directory=resolve(need('directory')),manifest=await candidate(directory),major=Number(process.versions.node.split('.')[0]); + if(![22,24].includes(major))throw Error('Qualification requires Node22 or24'); + const env={...cleanEnv(),EXPECTED_SHA:manifest.sourceSha,WSP_TOOLKIT_CANDIDATE:join(directory,'package-manifest.json')}; + run(process.execPath,['scripts/validate.mjs'],toolkit,env); + const validation=await json(join(toolkit,'.artifacts/validation.json')); + const target=await mkdtemp(join(tmpdir(),'toolkit-exact-consumer-')); + try{ + const consumerEnv={...await isolatedEnv(target),EXPECTED_SHA:manifest.sourceSha}; + await installCandidate(directory,target,consumerEnv); + const lock=publicLock(await json(join(target,'package-lock.json')),manifest.packages),lockPath=join(directory,'public-package-lock.json'); + if(major===22)await save(lockPath,lock); + else { + // Node24 must accept the Node22 resolution as well, rather than silently selecting a different dependency tree. + const sealedLock=await json(lockPath);await writeFile(join(target,'package-lock.json'),JSON.stringify(sealedLock)); + // Candidate package entries continue to use the canonical archives until public publication. + const local=structuredClone(sealedLock);for(const row of manifest.packages)local.packages[`node_modules/${row.name}`].resolved=`file:${join(directory,row.tarball)}`; + await writeFile(join(target,'package-lock.json'),JSON.stringify(local)); + await writeFile(join(target,'package.json'),JSON.stringify({name:'toolkit-release-consumer',version:'1.0.0',private:true,type:'module',dependencies:sealedLock.packages[''].dependencies})); + run('npm',['ci','--ignore-scripts','--no-audit','--no-fund','--cache',join(target,'ci-cache')],target,consumerEnv); + } + const core=await coreConsumer(target,join(target,'core-receipt.json'),manifest.sourceSha,consumerEnv); + const receipt={schema:`${schema}.qualification/1`,status:'passed',sourceSha:manifest.sourceSha,manifestSha256:sha256(await readFile(join(directory,'package-manifest.json'))),runtime:process.version,validation,core,publicLockSha256:sha256(await readFile(lockPath))}; + validateQualification(receipt,manifest.sourceSha,receipt.manifestSha256); + await save(join(directory,`node-${major}-qualification.json`),receipt); + }finally{await rm(target,{recursive:true,force:true});} + clean(); +} +async function seal(){ + clean();const directory=resolve(need('directory')),manifest=await candidate(directory),manifestHash=sha256(await readFile(join(directory,'package-manifest.json'))),lockHash=sha256(await readFile(join(directory,'public-package-lock.json'))); + if(assertSourceSha(need('expected-sha'))!==manifest.sourceSha)throw Error('Seal requested wrong source'); + for(const major of [22,24]){ + const receipt=await json(join(directory,`node-${major}-qualification.json`));validateQualification(receipt,manifest.sourceSha,manifestHash); + if(Number(receipt.runtime.split('.')[0].slice(1))!==major||receipt.publicLockSha256!==lockHash)throw Error('Qualification runtime/lock binding mismatch'); + } + const files=[];for(const filename of ['package-manifest.json','public-package-lock.json','node-22-qualification.json','node-24-qualification.json',...manifest.packages.map(row=>row.tarball)])files.push({filename,sha256:sha256(await readFile(join(directory,filename)))}); + await save(join(directory,'candidate-seal.json'),{schema:`${schema}.seal/1`,status:'passed',sourceSha:manifest.sourceSha,sourceTree:manifest.sourceTree,releaseTag,files}); + await verify(directory); +} +async function verify(directory){ + const seal=await json(join(directory,'candidate-seal.json')); + if(seal.schema!==`${schema}.seal/1`||seal.status!=='passed'||seal.sourceSha!==source()||seal.releaseTag!==releaseTag||seal.sourceTree!==run('git',['rev-parse','HEAD^{tree}']))throw Error('Seal source/generation mismatch'); + const manifest=await candidate(directory),expected=['package-manifest.json','public-package-lock.json','node-22-qualification.json','node-24-qualification.json',...manifest.packages.map(row=>row.tarball)]; + if(!Array.isArray(seal.files)||seal.files.length!==expected.length||new Set(seal.files.map(row=>row.filename)).size!==expected.length)throw Error('Seal file set incomplete'); + for(const filename of expected){const row=seal.files.find(row=>row.filename===filename);if(!row||row.sha256!==sha256(await readFile(join(directory,safeFilename(filename)))))throw Error(`Sealed bytes changed: ${filename}`);} + const manifestHash=sha256(await readFile(join(directory,'package-manifest.json'))),lockHash=sha256(await readFile(join(directory,'public-package-lock.json'))); + const lock=await json(join(directory,'public-package-lock.json'));publicLock(lock,manifest.packages); + for(const row of manifest.packages)if(lock.packages[`node_modules/${row.name}`]?.integrity!==row.integrity||lock.packages[`node_modules/${row.name}`]?.resolved!==tarballURL(row))throw Error('Sealed public lock SRI mismatch'); + for(const major of [22,24]){const receipt=await json(join(directory,`node-${major}-qualification.json`));validateQualification(receipt,source(),manifestHash);if(receipt.publicLockSha256!==lockHash||Number(receipt.runtime.split('.')[0].slice(1))!==major)throw Error('Sealed runtime/lock receipt mismatch');} + return {seal,manifest}; +} +function protectedContext(sha){ + const expected={GITHUB_ACTIONS:'true',GITHUB_REPOSITORY:'ruvnet/ruv-FANN',GITHUB_REF:'refs/heads/main',GITHUB_SHA:sha,GITHUB_WORKFLOW:'protected-toolkit-release',GITHUB_WORKFLOW_REF:'ruvnet/ruv-FANN/.github/workflows/protected-toolkit-release.yml@refs/heads/main',GITHUB_EVENT_NAME:'workflow_dispatch',GITHUB_JOB:'publish'}; + for(const [key,value]of Object.entries(expected))if(process.env[key]!==value)throw Error('Publication requires exact upstream protected main workflow'); + if(source()!==sha||run('gh',['api','repos/ruvnet/ruv-FANN/commits/main','--jq','.sha'])!==sha)throw Error('Main advanced beyond sealed source'); + if(run('gh',['api','repos/ruvnet/ruv-FANN/issues?labels=release-blocker&state=open&per_page=1','--jq','length'])!=='0')throw Error('Release blockers prevent publication'); + clean(); +} +async function publicBytes(row){const response=await fetch(tarballURL(row),{redirect:'error',signal:AbortSignal.timeout(30_000)});if(response.status===404)return null;if(!response.ok)throw Error(`Registry HTTP${response.status}`);const bytes=Buffer.from(await response.arrayBuffer());if(bytes.length>20*1024*1024)throw Error('Oversized registry tarball');return bytes;} +async function awaitPublic(row,timeout=180_000){const deadline=Date.now()+timeout;while(Date.now()setTimeout(resolve,5000));}throw Error(`Registry propagation timeout: ${row.name}`);} +async function publish(){ + const directory=resolve(need('directory')),{seal,manifest}=await verify(directory);protectedContext(seal.sourceSha); + if(!process.env.NODE_AUTH_TOKEN)throw Error('Explicit protected NPM_TOKEN required; OIDC-only registration has not been verified'); + // Preflight every name before making any upload, so known collisions do not leave a partial release. + for(const row of manifest.packages){const bytes=await publicBytes(row);if(bytes&&sha256(bytes)!==row.sha256)throw Error(`Existing version has different bytes: ${row.name}`);} + const results=[]; + for(const row of manifest.packages){ + protectedContext(seal.sourceSha);const previous=await publicBytes(row); + if(!previous){try{run('npm',['publish',join(directory,row.tarball),'--ignore-scripts','--access','public','--provenance','--registry=https://registry.npmjs.org']);}catch(error){try{await awaitPublic(row);}catch{throw error;}}} + await awaitPublic(row);results.push({name:row.name,version:row.version,sha256:row.sha256,integrity:row.integrity,status:previous?'identical-existing-version':'published-and-byte-verified'}); + // Append-only progress survives a later package failure. + await save(join(resolve(need('output')),`${row.name}.json`),{schema:`${schema}.package-publication/1`,sourceSha:seal.sourceSha,...results.at(-1)}); + } + await save(join(resolve(need('output')),'publication.json'),{schema:`${schema}.publication/1`,status:'passed',sourceSha:seal.sourceSha,releaseTag,sealSha256:sha256(await readFile(join(directory,'candidate-seal.json'))),packages:results}); +} +async function publicConsumer(){ + const directory=resolve(need('directory')),{seal,manifest}=await verify(directory),publication=await json(need('publication')); + if(publication.status!=='passed'||publication.sourceSha!==seal.sourceSha||publication.sealSha256!==sha256(await readFile(join(directory,'candidate-seal.json')))||publication.packages.length!==manifest.packages.length)throw Error('Publication receipt does not match seal'); + for(const row of manifest.packages)await awaitPublic(row); + const target=await mkdtemp(join(tmpdir(),'toolkit-public-consumer-')),env=await isolatedEnv(target); + try{ + const lock=await json(join(directory,'public-package-lock.json')); + await copyFile(join(directory,'public-package-lock.json'),join(target,'package-lock.json')); + await writeFile(join(target,'package.json'),JSON.stringify({name:lock.name,version:lock.version,private:true,type:'module',dependencies:lock.packages[''].dependencies})); + run('npm',['ci','--ignore-scripts','--no-audit','--no-fund','--registry=https://registry.npmjs.org','--cache',join(target,'fresh-cache')],target,env); + for(const row of manifest.packages)if((await json(join(target,'node_modules',row.name,'package.json'))).version!==row.version)throw Error('Wrong public installed version'); + const core=await coreConsumer(target,join(target,'core-public.json'),seal.sourceSha,env); + await save(need('output'),{schema:`${schema}.public-consumer/1`,status:'passed',sourceSha:seal.sourceSha,releaseTag,sealSha256:sha256(await readFile(join(directory,'candidate-seal.json'))),publicLockSha256:sha256(await readFile(join(directory,'public-package-lock.json'))),packages:manifest.packages.map(({name,version,sha256,integrity})=>({name,version,sha256,integrity})),core}); + }finally{await rm(target,{recursive:true,force:true});} +} +function tagCommit(tag){let item=JSON.parse(run('gh',['api',`repos/ruvnet/ruv-FANN/git/ref/tags/${tag}`])).object;for(let i=0;i<5;i++){if(item.type==='commit')return item.sha;if(item.type!=='tag')throw Error('Tag does not resolve to commit');item=JSON.parse(run('gh',['api',`repos/ruvnet/ruv-FANN/git/tags/${item.sha}`])).object;}throw Error('Tag nesting exceeds limit');} +async function githubRelease(){ + const directory=resolve(need('directory')),{seal,manifest}=await verify(directory);protectedContext(seal.sourceSha); + const publication=await json(need('publication')),consumer=await json(need('public-consumer')); + if(publication.status!=='passed'||consumer.status!=='passed'||publication.sourceSha!==seal.sourceSha||consumer.sourceSha!==seal.sourceSha||consumer.sealSha256!==sha256(await readFile(join(directory,'candidate-seal.json'))))throw Error('Public release evidence mismatch'); + validateCoreReceipt(consumer.core,seal.sourceSha);for(const row of manifest.packages)await awaitPublic(row); + const receipt={schema:`${schema}.release/1`,status:'passed',sourceSha:seal.sourceSha,releaseTag,sealSha256:sha256(await readFile(join(directory,'candidate-seal.json'))),publicationSha256:sha256(await readFile(need('publication'))),publicConsumerSha256:sha256(await readFile(need('public-consumer'))),packages:manifest.packages}; + await save(need('output'),receipt); + const paths=[...seal.files.map(row=>join(directory,row.filename)),join(directory,'candidate-seal.json'),resolve(need('publication')),resolve(need('public-consumer')),resolve(need('output'))]; + let existing;try{existing=JSON.parse(run('gh',['release','view',releaseTag,'--json','assets']));}catch{ + run('gh',['release','create',releaseTag,...paths,'--target',seal.sourceSha,'--title','ruv-fann core 0.2.0 and WSP toolkit 0.1.0','--notes',`Thirteen exact npm archives from source ${seal.sourceSha}. Core subpaths expose bounded WSP lifecycle, search, invariants, workers, registry and constellation capabilities. Node22/24 installed consumers, real Chromium/WASM, strict types, public dependency lock and exact-byte receipts attached. No generalization or SOTA claim.`]); + } + if(tagCommit(releaseTag)!==seal.sourceSha)throw Error('GitHub tag source mismatch'); + if(existing&&JSON.stringify(existing.assets.map(a=>a.name).sort())!==JSON.stringify(paths.map(basename).sort()))throw Error('GitHub release asset set differs'); + const target=await mkdtemp(join(tmpdir(),'toolkit-github-public-'));try{run('gh',['release','download',releaseTag,'--dir',target]);for(const path of paths)if(sha256(await readFile(path))!==sha256(await readFile(join(target,basename(path)))))throw Error('GitHub release asset bytes differ');}finally{await rm(target,{recursive:true,force:true});} +} +const modes={pack,qualify,seal,verify:()=>verify(resolve(need('directory'))),publish,'public-consumer':publicConsumer,'github-release':githubRelease}; +if(!modes[mode])throw Error('Unsupported toolkit release mode');await modes[mode](); diff --git a/scripts/toolkit-release-lib.mjs b/scripts/toolkit-release-lib.mjs new file mode 100644 index 000000000..16ef00e73 --- /dev/null +++ b/scripts/toolkit-release-lib.mjs @@ -0,0 +1,86 @@ +// Shared, side-effect-free validation for the exact-artifact toolkit release lane. +import { createHash } from 'node:crypto'; +export const schema = 'ruv-fann.toolkit'; +export const releaseTag = 'ruv-fann-toolkit-v0.2.0'; +export const packageSpecs = [ + ...['contracts','constellation','telemetry','lifecycle','search','huggingface','cloudflare','ruos','invariants','swarm','registry','loop'].map(directory => ({ + name: {contracts:'ruvnet-constellation-contracts',constellation:'ruvnet-constellation',telemetry:'ruvnet-constellation-telemetry'}[directory] ?? `ruv-fann-wsp-${directory}`, + version:'0.1.0', directory:`packages/wsp-toolkit/packages/${directory}` + })), {name:'ruv-fann',version:'0.2.0',directory:'packages/core'} +]; +export const sha256 = bytes => createHash('sha256').update(bytes).digest('hex'); +export const integrity = bytes => `sha512-${createHash('sha512').update(bytes).digest('base64')}`; +export const tarballURL = row => `https://registry.npmjs.org/${row.name}/-/${row.name}-${row.version}.tgz`; +export function safeFilename(name) { + if (typeof name !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9._-]{0,180}$/.test(name) || name.includes('..')) throw Error('Unsafe candidate filename'); + return name; +} +export function assertSourceSha(value) {if(typeof value!=='string'||!/^[a-f0-9]{40}$/.test(value))throw Error('Expected full source SHA');return value;} +export function topologicalOrder(rows) { + const byName=new Map(rows.map(row=>[row.name,row])); + if(byName.size!==rows.length)throw Error('Duplicate candidate package'); + const done=new Set(),active=new Set(),ordered=[]; + function visit(row) { + if(done.has(row.name))return; + if(active.has(row.name))throw Error('Candidate dependency cycle'); + active.add(row.name); + for(const [name,version]of Object.entries(row.dependencies??{})) { + const dependency=byName.get(name); + // Legacy core0.1.2 stays nested under published WSP0.2.0 and satellites. + if(dependency && version===dependency.version)visit(dependency); + else if(dependency && !(name==='ruv-fann'&&version==='0.1.2'))throw Error(`Internal dependency must pin candidate version: ${row.name} -> ${name}`); + } + active.delete(row.name);done.add(row.name);ordered.push(row); + } + rows.forEach(visit);return ordered; +} +export function validateRows(rows) { + if(!Array.isArray(rows)||rows.length!==packageSpecs.length)throw Error('Expected all thirteen candidate packages'); + for(const spec of packageSpecs) { + const found=rows.filter(row=>row.name===spec.name); + if(found.length!==1||found[0].version!==spec.version)throw Error(`Candidate identity mismatch: ${spec.name}`); + const row=found[0];safeFilename(row.tarball); + if(!/^[a-f0-9]{64}$/.test(row.sha256)||!/^sha512-[A-Za-z0-9+/]{86}==$/.test(row.integrity))throw Error('Candidate digest missing'); + if(!row.dependencies||typeof row.dependencies!=='object'||Array.isArray(row.dependencies))throw Error('Candidate dependencies missing'); + } + const ordered=topologicalOrder(rows); + if(JSON.stringify(ordered.map(r=>r.name))!==JSON.stringify(rows.map(r=>r.name)))throw Error('Candidate packages are not in dependency order'); + return rows; +} +export function validateCoreReceipt(receipt,sourceSha) { + if(receipt?.schema!=='ruv-fann.core-consumer/1'||receipt.status!=='passed'||receipt.sourceSha!==sourceSha|| + !Number.isInteger(receipt.testCount)||receipt.testCount<1||receipt.skipped!==0||receipt.todo!==0|| + receipt.browser?.engine!=='Chromium'||receipt.browser.realWasm!==true||receipt.types?.strict!==true|| + receipt.graph?.core!=='0.2.0'||receipt.graph.legacyCore!=='0.1.2'||receipt.graph.finite!==true|| + receipt.types.subpaths!==14||receipt.browser.pageErrors?.length!==0|| + !['wasm','wasm-simd'].every(name=>[receipt.backendChecks,receipt.browser.checks].every(checks=> + checks?.some(row=>row.backend===name&&row.checks>0&&['inference','training','search','gate','invariants','rejectedPromotion'].every(key=>row[key]===true)&&row.rollbackRevision===3))))throw Error('Installed core receipt must prove nonzero tests, strict types, finite graph and real WASM/Chromium'); +} +export function validateQualification(receipt,sourceSha,manifestHash) { + if(receipt?.schema!==`${schema}.qualification/1`||receipt.status!=='passed'||receipt.sourceSha!==sourceSha||receipt.manifestSha256!==manifestHash)throw Error('Qualification source/archive binding mismatch'); + const report=receipt.validation; + if(report?.typecheck!=='passed'||!(report.tests?.tests>0)||report.tests.pass!==report.tests.tests|| + ['fail','cancelled','skipped','todo'].some(key=>report.tests[key]!==0)||report.audit?.vulnerabilities?.total!==0||report.agentdbIntegrationAudit?.vulnerabilities?.total!==0) + throw Error('Qualification requires nonzero no-skip tests, types and zero-advisory audits'); + validateCoreReceipt(receipt.core,sourceSha); + if(report.benchmark?.schema!=='ruv-fann.search-benchmark/1'||report.benchmark.candidateMSE!==0|| + report.benchmark.referenceInferencePasses!==32||report.benchmark.screenedInferencePasses!==19|| + !/^[a-f0-9]{64}$/.test(report.benchmark.equivalentCandidateHash))throw Error('Search benchmark must preserve the exact candidate and measured work counts'); + if(receipt.runtime!==report.node||receipt.runtime!==receipt.core.runtime)throw Error('Qualification runtimes disagree'); +} +export function publicLock(candidateLock,rows) { + const lock=structuredClone(candidateLock),root=lock.packages?.['']; + if(!root)throw Error('Installed candidate lock missing root'); + root.dependencies=Object.fromEntries(rows.map(row=>[row.name,row.version])); + delete root.devDependencies; + for(const row of rows) { + const entry=lock.packages[`node_modules/${row.name}`]; + if(!entry||entry.version!==row.version||entry.link)throw Error(`Candidate not installed at root: ${row.name}`); + entry.resolved=tarballURL(row);entry.integrity=row.integrity; + delete entry.inBundle; + } + for(const [path,entry]of Object.entries(lock.packages)) { + if(path&&entry.resolved&&(!entry.resolved.startsWith('https://registry.npmjs.org/')||entry.link))throw Error('Public lock contains a non-registry dependency'); + } + return lock; +} diff --git a/scripts/toolkit-release.test.mjs b/scripts/toolkit-release.test.mjs new file mode 100644 index 000000000..f0d0f96f3 --- /dev/null +++ b/scripts/toolkit-release.test.mjs @@ -0,0 +1,29 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { readFile } from 'node:fs/promises'; +import {execFileSync,spawnSync} from 'node:child_process'; +import {packageSpecs,topologicalOrder,validateRows,validateCoreReceipt,validateQualification,publicLock,safeFilename,sha256,integrity,tarballURL} from './toolkit-release-lib.mjs'; +const sha='a'.repeat(40),manifestHash='b'.repeat(64); +const rows=()=>topologicalOrder(packageSpecs.map(spec=>({name:spec.name,version:spec.version,tarball:`${spec.name}-${spec.version}.tgz`,sha256:sha256('archive'),integrity:integrity('archive'),dependencies:{}}))); +const backend=name=>({backend:name,checks:12,inference:true,training:true,search:true,gate:true,invariants:true,rejectedPromotion:true,rollbackRevision:3}); +const core=()=>({schema:'ruv-fann.core-consumer/1',status:'passed',sourceSha:sha,testCount:66,skipped:0,todo:0,runtime:'v22.23.2',backendChecks:['wasm','wasm-simd'].map(backend),browser:{engine:'Chromium',realWasm:true,checks:['wasm','wasm-simd'].map(backend),pageErrors:[]},types:{strict:true,subpaths:14},graph:{core:'0.2.0',legacyCore:'0.1.2',finite:true}}); +const qualification=()=>({schema:'ruv-fann.toolkit.qualification/1',status:'passed',sourceSha:sha,manifestSha256:manifestHash,runtime:'v22.23.2',core:core(),validation:{typecheck:'passed',node:'v22.23.2',tests:{tests:100,pass:100,fail:0,cancelled:0,skipped:0,todo:0},audit:{vulnerabilities:{total:0}},agentdbIntegrationAudit:{vulnerabilities:{total:0}},benchmark:{schema:'ruv-fann.search-benchmark/1',candidateMSE:0,referenceInferencePasses:32,screenedInferencePasses:19,equivalentCandidateHash:'c'.repeat(64)}}}); +test('candidate includes exactly twelve satellites and new core with SHA256/SRI',()=>{assert.equal(validateRows(rows()).length,13);for(const mutate of [r=>r.pop(),r=>r.push(r[0]),r=>r[0].version='1.0.0',r=>r[0].sha256='wrong',r=>r[0].integrity='sha512-wrong',r=>r[0].tarball='../escape.tgz']){const data=rows();mutate(data);assert.throws(()=>validateRows(data));}}); +test('dependency order puts prerequisites first and tolerates explicit nested legacy core only',()=>{ + const data=rows(),coreRow=data.find(r=>r.name==='ruv-fann'),loop=data.find(r=>r.name==='ruv-fann-wsp-loop');coreRow.dependencies={'ruv-fann-wsp-loop':'0.1.0'};loop.dependencies={'ruv-fann':'0.1.2'}; + const ordered=topologicalOrder(data);assert.ok(ordered.indexOf(loop)topologicalOrder(data),/cycle/); + loop.dependencies={'ruv-fann':'^0.1.2'};assert.throws(()=>topologicalOrder(data),/pin/); +}); +test('rejects unknown, skipped, zero, failed and mismatched-source qualification',()=>{validateQualification(qualification(),sha,manifestHash);for(const mutate of [r=>r.status='unknown',r=>r.sourceSha='d'.repeat(40),r=>r.manifestSha256='e'.repeat(64),r=>r.validation.tests.tests=0,r=>r.validation.tests.skipped=1,r=>r.validation.tests.todo=1,r=>r.validation.tests.cancelled=1,r=>r.validation.tests.fail=1,r=>r.validation.audit.vulnerabilities.total=1,r=>r.validation.agentdbIntegrationAudit.vulnerabilities.total=1,r=>r.validation.node='v24.22.1',r=>r.validation.benchmark.candidateMSE=1]){const report=qualification();mutate(report);assert.throws(()=>validateQualification(report,sha,manifestHash));}}); +test('installed proof requires real SIMD and scalar Node/Chromium numerical checks, types, rollback and finite graph',()=>{validateCoreReceipt(core(),sha);for(const mutate of [r=>r.testCount=0,r=>r.skipped=1,r=>r.todo=1,r=>r.browser.realWasm=false,r=>r.browser.checks=[],r=>r.browser.pageErrors=['error'],r=>r.types.strict=false,r=>r.types.subpaths=0,r=>r.graph.finite=false,r=>r.backendChecks[0].rollbackRevision=2,r=>r.backendChecks[0].search=false]){const proof=core();mutate(proof);assert.throws(()=>validateCoreReceipt(proof,sha));}}); +test('public lock preserves resolved transitive versions and replaces only candidate archives with SRI-bound public URLs',()=>{ + const packages=rows(),lock={name:'consumer',version:'1.0.0',lockfileVersion:3,packages:{'':{dependencies:{}},'node_modules/external':{version:'1.2.3',resolved:'https://registry.npmjs.org/external/-/external-1.2.3.tgz',integrity:'sha512-external'}}}; + for(const row of packages)lock.packages[`node_modules/${row.name}`]={version:row.version,resolved:`file:/tmp/${row.tarball}`,integrity:row.integrity}; + const result=publicLock(lock,packages);assert.equal(result.packages['node_modules/external'].version,'1.2.3');assert.equal(result.packages['node_modules/ruv-fann'].resolved,tarballURL(packages.find(r=>r.name==='ruv-fann')));assert.equal(lock.packages['node_modules/ruv-fann'].resolved.startsWith('file:'),true); + lock.packages['node_modules/external'].resolved='https://hostile.test/package.tgz';assert.throws(()=>publicLock(lock,packages)); +}); +test('archive and evidence filenames reject traversal, shell metacharacters and URLs',()=>{for(const name of ['../x.tgz','x/../x.tgz','x\\y.tgz','https://hostile/x','$(id).tgz','x\n.tgz','..'])assert.throws(()=>safeFilename(name));assert.equal(safeFilename('ruv-fann-0.2.0.tgz'),'ruv-fann-0.2.0.tgz');}); +test('qualification checks out exact PR head and canonical pack precedes both runtime consumers',async()=>{const workflow=await readFile(new URL('../.github/workflows/wsp-toolkit.yml',import.meta.url),'utf8');assert.match(workflow,/ref: \$\{\{ github.event.pull_request.head.sha \|\| inputs.expected_sha \|\| github.sha \}\}/);assert.equal((workflow.match(/toolkit-release-lane.mjs pack /g)??[]).length,1);assert.equal((workflow.match(/toolkit-release-lane.mjs qualify /g)??[]).length,2);assert.match(workflow,/toolkit-candidate-\$\{\{ github.event.pull_request.head.sha/);}); +test('protected publisher selects successful upstream artifact and explicitly uses existing NPM_TOKEN, never source rebuild',async()=>{const workflow=await readFile(new URL('../.github/workflows/protected-toolkit-release.yml',import.meta.url),'utf8');assert.match(workflow,/secrets.NPM_TOKEN/);assert.match(workflow,/toolkit-candidate-download.mjs --expected-sha/);assert.doesNotMatch(workflow,/toolkit-release-lane.mjs (pack|qualify|seal) /);assert.match(workflow,/id-token: write/);assert.match(workflow,/toolkit-release-lane.mjs public-consumer/);assert.match(workflow,/toolkit-release-lane.mjs github-release/);}); +test('actual downloader rejects foreign or local context before gh download',()=>{const result=spawnSync(process.execPath,[new URL('./toolkit-candidate-download.mjs',import.meta.url).pathname,'--expected-sha',sha,'--output','/tmp/never-download-toolkit'],{encoding:'utf8',env:{...process.env,GITHUB_ACTIONS:'false'},timeout:10000});assert.notEqual(result.status,0);assert.match(result.stderr,/Exact protected upstream main context required/);}); diff --git a/scripts/wsp-release-lane.mjs b/scripts/wsp-release-lane.mjs index 3f606dc7d..b691c32ac 100644 --- a/scripts/wsp-release-lane.mjs +++ b/scripts/wsp-release-lane.mjs @@ -9,7 +9,6 @@ import { join, resolve, basename, dirname, extname, sep } from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; import { runWorkbenchProbe, runWorkbenchSecurityProbe } from './wsp-workbench-probes.mjs'; import { validateWorkbenchProof, validateSecurity, validateBenchmark } from './wsp-release-evidence.mjs'; -import { validateOIDCPublishContext, createTokenlessPublishEnvironment } from './constellation-oidc.mjs'; const root = resolve(fileURLToPath(new URL('..', import.meta.url))); const argv = process.argv.slice(2); @@ -430,42 +429,26 @@ async function verifySeal(seal, directory) { async function publish() { const sealPath = resolve(required('seal')); const seal = await json(sealPath); - const publishContext = validateOIDCPublishContext({ env: process.env, sourceSha: seal.sourceSha, checkoutSha: gitSha(), - nodeVersion: process.version, npmVersion: exec('npm', ['--version']) }); protectedContext(seal.sourceSha); - if (seal.name !== identity.name || seal.version !== identity.version || seal.releaseTag !== identity.tag) - throw new Error('Invalid WSP sealed publication identity'); + if (seal.name !== identity.name || seal.version !== identity.version || seal.releaseTag !== identity.tag || !process.env.NODE_AUTH_TOKEN) + throw new Error('Missing NPM_TOKEN or invalid WSP sealed identity'); const archivePath = join(dirname(sealPath), seal.tarball); const archiveBytes = await verifySeal(seal, dirname(sealPath)); const existing = await publicTarball(seal); if (existing) { if (sha256(existing) !== seal.sha256) throw new Error('The public WSP version already exists with different bytes'); } else { - // Run outside the checkout with both npm config files under our control. The - // only publication credential inherited by npm is the ephemeral Actions OIDC capability. - const publishDirectory = await mkdtemp(join(tmpdir(), 'wsp-tokenless-publish-')); - try { - const userConfig = join(publishDirectory, 'user.npmrc'), globalConfig = join(publishDirectory, 'global.npmrc'); - await writeFile(userConfig, 'registry=https://registry.npmjs.org\nprovenance=true\n', { mode: 0o600, flag: 'wx' }); - await writeFile(globalConfig, '', { mode: 0o600, flag: 'wx' }); - await writeFile(join(publishDirectory, '.npmrc'), 'registry=https://registry.npmjs.org\nprovenance=true\n', { mode: 0o600, flag: 'wx' }); - await writeFile(join(publishDirectory, 'package.json'), JSON.stringify({ private: true }), { mode: 0o600, flag: 'wx' }); - const publishArchive = join(publishDirectory, basename(archivePath)); - await writeFile(publishArchive, archiveBytes, { mode: 0o600, flag: 'wx' }); - const publishEnvironment = createTokenlessPublishEnvironment(process.env, { userConfig, globalConfig, cache: join(publishDirectory, 'cache') }); - try { exec('npm', ['publish', publishArchive, '--ignore-scripts', '--access', 'public', '--provenance', '--registry=https://registry.npmjs.org'], publishDirectory, publishEnvironment); } - catch (error) { - // An earlier protected attempt may have completed its upload; accept it only after exact-byte proof. - try { await awaitPublic(seal); } catch { throw error; } - } - } finally { await rm(publishDirectory, { recursive: true, force: true }); } + try { exec('npm', ['publish', archivePath, '--ignore-scripts', '--access', 'public', '--provenance', '--registry=https://registry.npmjs.org'], root); } + catch (error) { + // An earlier protected attempt may have completed its upload; accept it only after exact-byte proof. + try { await awaitPublic(seal); } catch { throw error; } + } } await awaitPublic(seal); const output = resolve(required('output')); await mkdir(dirname(output), { recursive: true }); await saveNew(output, { schema: 'ruv-fann-wsp.npm-publication/1', sourceSha: seal.sourceSha, - releaseTag: seal.releaseTag, package: seal.name, version: seal.version, sha256: seal.sha256, status: 'public-byte-verified', - authentication: publishContext, publication: existing ? 'identical-existing-version' : 'published-or-recovered' }); + releaseTag: seal.releaseTag, package: seal.name, version: seal.version, sha256: seal.sha256, status: 'public-byte-verified' }); } async function publicConsumer() { From 64c3c4161c4f92f90d6bc3d80fd388bb606e1be9 Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 22:59:14 -0500 Subject: [PATCH 10/20] fix(release): bind publication package identities and reject unsealed files --- scripts/toolkit-release-lane.mjs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/toolkit-release-lane.mjs b/scripts/toolkit-release-lane.mjs index 70af3be6c..8c7871bff 100644 --- a/scripts/toolkit-release-lane.mjs +++ b/scripts/toolkit-release-lane.mjs @@ -1,7 +1,7 @@ #!/usr/bin/env node // One canonical pack, two installed-runtime qualifications, protected publication, public-byte proof. import { execFileSync } from 'node:child_process'; -import { readFile,writeFile,readdir,mkdir,mkdtemp,rm,copyFile } from 'node:fs/promises'; +import { readFile,writeFile,readdir,mkdir,mkdtemp,rm,copyFile,lstat } from 'node:fs/promises'; import { join,resolve,dirname,basename } from 'node:path'; import { tmpdir } from 'node:os'; import { fileURLToPath } from 'node:url'; @@ -111,6 +111,9 @@ async function verify(directory){ const seal=await json(join(directory,'candidate-seal.json')); if(seal.schema!==`${schema}.seal/1`||seal.status!=='passed'||seal.sourceSha!==source()||seal.releaseTag!==releaseTag||seal.sourceTree!==run('git',['rev-parse','HEAD^{tree}']))throw Error('Seal source/generation mismatch'); const manifest=await candidate(directory),expected=['package-manifest.json','public-package-lock.json','node-22-qualification.json','node-24-qualification.json',...manifest.packages.map(row=>row.tarball)]; + const actual=await readdir(directory); + if(JSON.stringify(actual.sort())!==JSON.stringify([...expected,'candidate-seal.json'].sort()))throw Error('Candidate directory contains unsealed files'); + for(const filename of actual)if(!(await lstat(join(directory,filename))).isFile())throw Error('Candidate contains links or non-files'); if(!Array.isArray(seal.files)||seal.files.length!==expected.length||new Set(seal.files.map(row=>row.filename)).size!==expected.length)throw Error('Seal file set incomplete'); for(const filename of expected){const row=seal.files.find(row=>row.filename===filename);if(!row||row.sha256!==sha256(await readFile(join(directory,safeFilename(filename)))))throw Error(`Sealed bytes changed: ${filename}`);} const manifestHash=sha256(await readFile(join(directory,'package-manifest.json'))),lockHash=sha256(await readFile(join(directory,'public-package-lock.json'))); @@ -126,7 +129,12 @@ function protectedContext(sha){ if(run('gh',['api','repos/ruvnet/ruv-FANN/issues?labels=release-blocker&state=open&per_page=1','--jq','length'])!=='0')throw Error('Release blockers prevent publication'); clean(); } -async function publicBytes(row){const response=await fetch(tarballURL(row),{redirect:'error',signal:AbortSignal.timeout(30_000)});if(response.status===404)return null;if(!response.ok)throw Error(`Registry HTTP${response.status}`);const bytes=Buffer.from(await response.arrayBuffer());if(bytes.length>20*1024*1024)throw Error('Oversized registry tarball');return bytes;} +async function publicBytes(row){ + const response=await fetch(tarballURL(row),{redirect:'error',signal:AbortSignal.timeout(30_000)}); + if(response.status===404)return null;if(!response.ok)throw Error(`Registry HTTP${response.status}`); + const maximum=20*1024*1024;if(Number(response.headers.get('content-length'))>maximum){await response.body?.cancel();throw Error('Oversized registry tarball');} + const chunks=[];let size=0;for await(const chunk of response.body){size+=chunk.length;if(size>maximum)throw Error('Oversized registry tarball');chunks.push(Buffer.from(chunk));}return Buffer.concat(chunks); +} async function awaitPublic(row,timeout=180_000){const deadline=Date.now()+timeout;while(Date.now()setTimeout(resolve,5000));}throw Error(`Registry propagation timeout: ${row.name}`);} async function publish(){ const directory=resolve(need('directory')),{seal,manifest}=await verify(directory);protectedContext(seal.sourceSha); @@ -146,6 +154,7 @@ async function publish(){ async function publicConsumer(){ const directory=resolve(need('directory')),{seal,manifest}=await verify(directory),publication=await json(need('publication')); if(publication.status!=='passed'||publication.sourceSha!==seal.sourceSha||publication.sealSha256!==sha256(await readFile(join(directory,'candidate-seal.json')))||publication.packages.length!==manifest.packages.length)throw Error('Publication receipt does not match seal'); + for(const row of manifest.packages)if(!publication.packages.some(item=>item.name===row.name&&item.version===row.version&&item.sha256===row.sha256&&item.integrity===row.integrity))throw Error('Publication package digest mismatch'); for(const row of manifest.packages)await awaitPublic(row); const target=await mkdtemp(join(tmpdir(),'toolkit-public-consumer-')),env=await isolatedEnv(target); try{ @@ -162,7 +171,8 @@ function tagCommit(tag){let item=JSON.parse(run('gh',['api',`repos/ruvnet/ruv-FA async function githubRelease(){ const directory=resolve(need('directory')),{seal,manifest}=await verify(directory);protectedContext(seal.sourceSha); const publication=await json(need('publication')),consumer=await json(need('public-consumer')); - if(publication.status!=='passed'||consumer.status!=='passed'||publication.sourceSha!==seal.sourceSha||consumer.sourceSha!==seal.sourceSha||consumer.sealSha256!==sha256(await readFile(join(directory,'candidate-seal.json'))))throw Error('Public release evidence mismatch'); + if(publication.status!=='passed'||consumer.status!=='passed'||publication.sourceSha!==seal.sourceSha||consumer.sourceSha!==seal.sourceSha||consumer.sealSha256!==sha256(await readFile(join(directory,'candidate-seal.json')))||publication.sealSha256!==consumer.sealSha256)throw Error('Public release evidence mismatch'); + for(const row of manifest.packages)for(const receipt of [publication,consumer])if(receipt.packages?.length!==manifest.packages.length||!receipt.packages.some(item=>item.name===row.name&&item.version===row.version&&item.sha256===row.sha256&&item.integrity===row.integrity))throw Error('Release public package evidence differs from seal'); validateCoreReceipt(consumer.core,seal.sourceSha);for(const row of manifest.packages)await awaitPublic(row); const receipt={schema:`${schema}.release/1`,status:'passed',sourceSha:seal.sourceSha,releaseTag,sealSha256:sha256(await readFile(join(directory,'candidate-seal.json'))),publicationSha256:sha256(await readFile(need('publication'))),publicConsumerSha256:sha256(await readFile(need('public-consumer'))),packages:manifest.packages}; await save(need('output'),receipt); From 2751aebf8008bc6a1b48e989bf55fa2b7f297869 Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 23:00:03 -0500 Subject: [PATCH 11/20] ci: route core 0.2 qualification through the toolkit artifact lane --- .github/workflows/npm-modules.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/npm-modules.yml b/.github/workflows/npm-modules.yml index 275c0619c..6d91497b8 100644 --- a/.github/workflows/npm-modules.yml +++ b/.github/workflows/npm-modules.yml @@ -10,7 +10,8 @@ on: branches: [main] paths: - 'packages/wasm/**' - - 'packages/core/**' + # Frozen 0.1.x WASM/core pair. Core 0.2.0 and its exact satellite + # dependency graph are qualified together by wsp-toolkit.yml. - 'scripts/npm-modules-*.mjs' - 'scripts/npm-release-*.mjs' - '.github/workflows/npm-modules.yml' From 48c9ae18ee6c2b39fc31e6789ccf4a63dcad26d2 Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 23:01:59 -0500 Subject: [PATCH 12/20] docs(wsp): prepare discoverable package metadata and release catalog --- .../packages/cloudflare/package.json | 16 +++- .../packages/constellation/catalog.json | 90 +++++++++++-------- .../packages/constellation/package.json | 15 +++- .../constellation/test/links.test.mjs | 23 +++++ .../constellation/test/onramp.test.mjs | 19 +++- .../packages/contracts/package.json | 14 ++- .../contracts/test/contracts.test.mjs | 4 +- .../packages/huggingface/package.json | 16 +++- .../packages/invariants/package.json | 16 +++- .../packages/lifecycle/package.json | 16 +++- .../wsp-toolkit/packages/loop/package.json | 17 +++- .../packages/registry/package.json | 17 +++- .../wsp-toolkit/packages/ruos/package.json | 16 +++- .../wsp-toolkit/packages/search/package.json | 16 +++- .../wsp-toolkit/packages/swarm/package.json | 16 +++- .../packages/telemetry/package.json | 17 +++- .../scripts/constellation-links.mjs | 20 ++--- .../test/constellation-browser.test.mjs | 8 +- .../test/constellation-fixture.mjs | 4 +- .../test/constellation-scenario.mjs | 10 ++- .../wsp-toolkit/test/constellation.test.mjs | 2 +- 21 files changed, 299 insertions(+), 73 deletions(-) create mode 100644 packages/wsp-toolkit/packages/constellation/test/links.test.mjs diff --git a/packages/wsp-toolkit/packages/cloudflare/package.json b/packages/wsp-toolkit/packages/cloudflare/package.json index 489ef1aa8..51249a539 100644 --- a/packages/wsp-toolkit/packages/cloudflare/package.json +++ b/packages/wsp-toolkit/packages/cloudflare/package.json @@ -1,7 +1,7 @@ { "name": "ruv-fann-wsp-cloudflare", "version": "0.1.0", - "description": "Bounded stateless WSP operations with static WebAssembly modules for Cloudflare Workers", + "description": "Run bounded neural weight patches and regression evaluations in Cloudflare Workers with static WebAssembly modules.", "type": "module", "main": "./src/index.js", "types": "./src/index.d.ts", @@ -43,5 +43,19 @@ }, "publishConfig": { "access": "public" + }, + "keywords": [ + "ruv-fann", + "weight-space-programming", + "neural-network", + "webassembly", + "cloudflare-workers", + "edge-computing", + "regression-testing", + "weight-patches" + ], + "homepage": "https://ruvnet.github.io/ruv-FANN/", + "bugs": { + "url": "https://github.com/ruvnet/ruv-FANN/issues" } } diff --git a/packages/wsp-toolkit/packages/constellation/catalog.json b/packages/wsp-toolkit/packages/constellation/catalog.json index 08741f175..ac6a30370 100644 --- a/packages/wsp-toolkit/packages/constellation/catalog.json +++ b/packages/wsp-toolkit/packages/constellation/catalog.json @@ -90,12 +90,12 @@ }, { "name": "ruv-fann", - "version": "0.1.2", + "version": "0.2.0", "role": "primitive", "family": "ruv-fann", "status": "published", "repository": "ruvnet/ruv-FANN", - "description": "Dense neural-network WebAssembly facade", + "description": "Dense neural-network WebAssembly facade with optional weight-space toolkit entry points", "links": { "npm": "https://www.npmjs.com/package/ruv-fann", "source": "https://github.com/ruvnet/ruv-FANN" @@ -182,17 +182,18 @@ "version": "0.1.0", "role": "satellite", "family": "ruv-fann", - "status": "candidate", + "status": "published", "repository": "ruvnet/ruv-FANN", "directory": "packages/wsp-toolkit/packages/lifecycle", - "description": "Bounded multi-suite regression gates and checkpoint branch evaluation for WSP", + "description": "Evaluate bounded neural weight patches across named regression suites and independent candidate branches.", "contracts": [ "ruv-fann.dense-layers/1", "ruv-fann.weight-patch/1", "ruv-fann.weight-evaluation/1" ], "links": { - "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/lifecycle" + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/lifecycle", + "npm": "https://www.npmjs.com/package/ruv-fann-wsp-lifecycle" } }, { @@ -200,16 +201,17 @@ "version": "0.1.0", "role": "satellite", "family": "ruv-fann", - "status": "candidate", + "status": "published", "repository": "ruvnet/ruv-FANN", "directory": "packages/wsp-toolkit/packages/search", - "description": "Bounded derivative-free weight search and experimental symbolic/plasticity proposals for ruv-fann-wsp", + "description": "Search explicit neural weight values without gradients; propose bounded Boolean-table and experimental Hebbian edits.", "contracts": [ "ruv-fann.dense-layers/1", "ruv-fann.weight-patch/1" ], "links": { - "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/search" + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/search", + "npm": "https://www.npmjs.com/package/ruv-fann-wsp-search" } }, { @@ -217,15 +219,16 @@ "version": "0.1.0", "role": "satellite", "family": "ruv-fann", - "status": "candidate", + "status": "published", "repository": "ruvnet/ruv-FANN", "directory": "packages/wsp-toolkit/packages/huggingface", - "description": "Integrity-pinned public Hugging Face dense JSON checkpoints for ruv-FANN WSP", + "description": "Load public Hugging Face dense JSON checkpoints with pinned revisions, SHA-256 integrity and bounded WSP validation.", "contracts": [ "ruv-fann.dense-layers/1" ], "links": { - "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/huggingface" + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/huggingface", + "npm": "https://www.npmjs.com/package/ruv-fann-wsp-huggingface" } }, { @@ -233,17 +236,18 @@ "version": "0.1.0", "role": "satellite", "family": "ruv-fann", - "status": "candidate", + "status": "published", "repository": "ruvnet/ruv-FANN", "directory": "packages/wsp-toolkit/packages/cloudflare", - "description": "Bounded stateless WSP operations with static WebAssembly modules for Cloudflare Workers", + "description": "Run bounded neural weight patches and regression evaluations in Cloudflare Workers with static WebAssembly modules.", "contracts": [ "ruv-fann.dense-layers/1", "ruv-fann.weight-patch/1", "ruv-fann.weight-evaluation/1" ], "links": { - "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/cloudflare" + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/cloudflare", + "npm": "https://www.npmjs.com/package/ruv-fann-wsp-cloudflare" } }, { @@ -251,16 +255,17 @@ "version": "0.1.0", "role": "satellite", "family": "ruv-fann", - "status": "candidate", + "status": "published", "repository": "ruvnet/ruv-FANN", "directory": "packages/wsp-toolkit/packages/ruos", - "description": "Real WASM canary and trusted executor completion checks for ruOS", + "description": "Validate real WebAssembly canary output and bind trusted ruOS executor completion evidence to explicit requests.", "contracts": [ "ruv-fann.dense-layers/1", "ruv-fann.weight-patch/1" ], "links": { - "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/ruos" + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/ruos", + "npm": "https://www.npmjs.com/package/ruv-fann-wsp-ruos" } }, { @@ -268,15 +273,16 @@ "version": "0.1.0", "role": "satellite", "family": "ruv-fann", - "status": "candidate", + "status": "published", "repository": "ruvnet/ruv-FANN", "directory": "packages/wsp-toolkit/packages/invariants", - "description": "Bounded real-WASM finite-domain output invariants for surgical weight evolution", + "description": "Check finite-domain neural output bounds and expected values using real scalar or SIMD WebAssembly inference.", "contracts": [ "ruv-fann.dense-layers/1" ], "links": { - "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/invariants" + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/invariants", + "npm": "https://www.npmjs.com/package/ruv-fann-wsp-invariants" } }, { @@ -284,16 +290,17 @@ "version": "0.1.0", "role": "satellite", "family": "ruv-fann", - "status": "candidate", + "status": "published", "repository": "ruvnet/ruv-FANN", "directory": "packages/wsp-toolkit/packages/swarm", - "description": "Bounded fixed-operation proposal workers using real Node worker threads and WASM", + "description": "Run bounded neural patch and search proposals in real Node.js worker threads with isolated WebAssembly instances.", "contracts": [ "ruv-fann.dense-layers/1", "ruv-fann.weight-patch/1" ], "links": { - "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/swarm" + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/swarm", + "npm": "https://www.npmjs.com/package/ruv-fann-wsp-swarm" } }, { @@ -301,17 +308,18 @@ "version": "0.1.0", "role": "satellite", "family": "ruv-fann", - "status": "candidate", + "status": "published", "repository": "ruvnet/ruv-FANN", "directory": "packages/wsp-toolkit/packages/registry", - "description": "Serialized AgentDB weight-program authority with explicit durable acknowledgement", + "description": "Adapt AgentDB weight programs with serialized operations, revision checks and caller-supplied persistence acknowledgment.", "contracts": [ "ruv-fann.dense-layers/1", "ruv-fann.weight-patch/1", "ruv-fann.weight-evaluation/1" ], "links": { - "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/registry" + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/registry", + "npm": "https://www.npmjs.com/package/ruv-fann-wsp-registry" } }, { @@ -319,17 +327,18 @@ "version": "0.1.0", "role": "satellite", "family": "ruv-fann", - "status": "candidate", + "status": "published", "repository": "ruvnet/ruv-FANN", "directory": "packages/wsp-toolkit/packages/loop", - "description": "Bounded autonomous weight evolution with worker swarms, independent gates and durable revision authority", + "description": "Coordinate bounded local weight evolution with worker proposals, independent regression gates and revision-based promotion.", "contracts": [ "ruv-fann.dense-layers/1", "ruv-fann.weight-patch/1", "ruv-fann.weight-evaluation/1" ], "links": { - "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/loop" + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/loop", + "npm": "https://www.npmjs.com/package/ruv-fann-wsp-loop" } }, { @@ -337,12 +346,13 @@ "version": "0.1.0", "role": "primitive", "family": "constellation", - "status": "candidate", + "status": "published", "repository": "ruvnet/ruv-FANN", "directory": "packages/wsp-toolkit/packages/contracts", - "description": "Dependency-free module and catalog contracts", + "description": "Validate bounded JSON catalogs and module manifests for independently installable RuvNet packages.", "links": { - "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/contracts" + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/contracts", + "npm": "https://www.npmjs.com/package/ruvnet-constellation-contracts" } }, { @@ -350,12 +360,13 @@ "version": "0.1.0", "role": "nucleus", "family": "constellation", - "status": "candidate", + "status": "published", "repository": "ruvnet/ruv-FANN", "directory": "packages/wsp-toolkit/packages/constellation", - "description": "Lightweight explicit discover, plan and scaffold onramp", + "description": "Discover versioned RuvNet packages, plan explicit installs and scaffold local integration adapters with a lightweight CLI.", "links": { - "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/constellation" + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/constellation", + "npm": "https://www.npmjs.com/package/ruvnet-constellation" } }, { @@ -363,12 +374,13 @@ "version": "0.1.0", "role": "satellite", "family": "constellation", - "status": "candidate", + "status": "published", "repository": "ruvnet/ruv-FANN", "directory": "packages/wsp-toolkit/packages/telemetry", - "description": "Public cohort metrics and explicit local adoption analysis", + "description": "Analyze public npm and GitHub observations, consented project samples and standalone package dashboards.", "links": { - "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/telemetry" + "source": "https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit/packages/telemetry", + "npm": "https://www.npmjs.com/package/ruvnet-constellation-telemetry" } } ], @@ -399,7 +411,7 @@ }, { "id": "local-loop", - "description": "Inspect the local autonomous-loop candidates; these are source artifacts", + "description": "Plan explicit version-pinned installs for the local weight-evolution loop and its supporting packages", "packages": [ "ruv-fann-wsp-loop", "ruv-fann-wsp-registry", diff --git a/packages/wsp-toolkit/packages/constellation/package.json b/packages/wsp-toolkit/packages/constellation/package.json index ccb2c9db5..44df0ff08 100644 --- a/packages/wsp-toolkit/packages/constellation/package.json +++ b/packages/wsp-toolkit/packages/constellation/package.json @@ -2,7 +2,7 @@ "name": "ruvnet-constellation", "version": "0.1.0", "type": "module", - "description": "Explicit lightweight constellation discovery, planning and satellite scaffolding", + "description": "Discover versioned RuvNet packages, plan explicit installs and scaffold local integration adapters with a lightweight CLI.", "main": "./src/index.js", "types": "./src/index.d.ts", "exports": { @@ -39,5 +39,18 @@ }, "publishConfig": { "access": "public" + }, + "keywords": [ + "ruvnet", + "constellation", + "package-discovery", + "cli", + "integration", + "scaffolding", + "package-catalog" + ], + "homepage": "https://ruvnet.github.io/ruv-FANN/", + "bugs": { + "url": "https://github.com/ruvnet/ruv-FANN/issues" } } diff --git a/packages/wsp-toolkit/packages/constellation/test/links.test.mjs b/packages/wsp-toolkit/packages/constellation/test/links.test.mjs new file mode 100644 index 000000000..0aab28e6d --- /dev/null +++ b/packages/wsp-toolkit/packages/constellation/test/links.test.mjs @@ -0,0 +1,23 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import {readFile} from 'node:fs/promises'; +import {execFileSync} from 'node:child_process'; +import {readCatalog} from '../src/index.js'; + +test('link preview covers published local packages and keeps npm README links absolute without writing files',async()=>{ + const catalog=await readCatalog(),entries=catalog.packages.filter(pkg=>pkg.directory?.startsWith('packages/wsp-toolkit/packages/')); + assert.equal(entries.length,12);assert.ok(entries.every(pkg=>pkg.status==='published')); + const files=entries.flatMap(pkg=>['README.md','package.json','constellation.json'].map(file=>new URL(`../../../../../${pkg.directory}/${file}`,import.meta.url))); + const before=await Promise.all(files.map(file=>readFile(file,'utf8'))); + const script=new URL('../../../scripts/constellation-links.mjs',import.meta.url); + const preview=JSON.parse(execFileSync(process.execPath,[script.pathname,'--print'],{encoding:'utf8'})); + assert.equal(preview.mode,'print');assert.equal(preview.packages,12);assert.equal(preview.blocks.length,12); + assert.deepEqual(new Set(preview.blocks.map(block=>block.name)),new Set(entries.map(pkg=>pkg.name))); + for(const block of preview.blocks){ + assert.match(block.readmeBlock,/https:\/\/www.npmjs.com\/package\/ruvnet-constellation/); + assert.match(block.readmeBlock,/https:\/\/ruvnet.github.io\/ruv-FANN\//); + assert.match(block.readmeBlock,/independent verification/); + assert.doesNotMatch(block.readmeBlock,/\]\((?:\.\.?\/)/); + } + assert.deepEqual(await Promise.all(files.map(file=>readFile(file,'utf8'))),before); +}); diff --git a/packages/wsp-toolkit/packages/constellation/test/onramp.test.mjs b/packages/wsp-toolkit/packages/constellation/test/onramp.test.mjs index 2655f3204..2a1909866 100644 --- a/packages/wsp-toolkit/packages/constellation/test/onramp.test.mjs +++ b/packages/wsp-toolkit/packages/constellation/test/onramp.test.mjs @@ -10,14 +10,27 @@ import {readCatalog,planProfile,scaffoldSatellite} from '../src/index.js'; const cli=new URL('../src/cli.js',import.meta.url).pathname; async function temp(t){const root=await mkdtemp(join(tmpdir(),'constellation-onramp-'));t.after(()=>rm(root,{recursive:true,force:true}));return root;} -test('default installed catalog plans published pins separately from local candidates',async()=>{ +test('default release catalog plans explicit published pins without installing packages',async()=>{ const catalog=await readCatalog(),weights=planProfile(catalog,'weights'),local=planProfile(catalog,'local-loop'); assert.deepEqual(weights.registrySpecs,['ruv-fann-wsp@0.2.0']);assert.equal(weights.publicInstallAvailable,true); - assert.equal(local.registrySpecs.length,0);assert.equal(local.localCandidates.length,4);assert.equal(local.publicInstallAvailable,false); + assert.deepEqual(local.registrySpecs,['ruv-fann-wsp-loop@0.1.0','ruv-fann-wsp-registry@0.1.0','ruv-fann-wsp-swarm@0.1.0','ruv-fann-wsp-invariants@0.1.0']); + assert.equal(local.localCandidates.length,0);assert.equal(local.publicInstallAvailable,true); + assert.equal(catalog.packages.length,24);assert.ok(catalog.packages.every(pkg=>pkg.status==='published')); + assert.equal(catalog.packages.find(pkg=>pkg.name==='ruv-fann').version,'0.2.0'); assert.equal(local.automaticInstall,false);assert.equal(local.telemetry,'disabled'); catalog.profiles[0].description='changed';assert.notEqual(weights.description,'changed'); assert.throws(()=>planProfile(catalog,'absent')); }); +test('independent source-candidate catalog remains distinct from registry install specifications',()=>{ + const catalog={schema:'ruvnet.constellation-catalog/1',repository:'example/adapters',packages:[ + {name:'published-adapter',version:'1.2.3',role:'primitive',family:'example',status:'published',repository:'example/adapters',description:'Published fixture'}, + {name:'source-adapter',version:'0.1.0',role:'satellite',family:'example',status:'candidate',repository:'example/adapters',directory:'packages/source',description:'Source-only fixture'} + ],profiles:[{id:'mixed',description:'Explicit fixture status distinction',packages:['published-adapter','source-adapter']}]}; + const plan=planProfile(catalog,'mixed'); + assert.deepEqual(plan.registrySpecs,['published-adapter@1.2.3']); + assert.equal(plan.publicInstallAvailable,false);assert.equal(plan.localCandidates[0].name,'source-adapter'); + assert.equal(plan.automaticInstall,false);assert.equal(plan.telemetry,'disabled'); +}); test('local catalog reader rejects oversized, nonregular, invalid UTF-8 and HTTP inputs',async t=>{ const root=await temp(t),file=join(root,'catalog.json'); await writeFile(file,JSON.stringify(await readCatalog()));assert.ok((await readCatalog(pathToFileURL(file))).packages.length>0); @@ -32,7 +45,7 @@ test('CLI help/catalog/plan produce explicit local output and refuse unknown com const help=execFileSync(process.execPath,[cli,'help'],{encoding:'utf8'}); assert.match(help,/https:\/\/www.npmjs.com\/package\/agentdb/);assert.match(help,/No command/); const output=JSON.parse(execFileSync(process.execPath,[cli,'catalog','--json'],{encoding:'utf8'}));assert.ok(output.packages.length>0); - const plan=JSON.parse(execFileSync(process.execPath,[cli,'plan','local-loop'],{encoding:'utf8'}));assert.equal(plan.publicInstallAvailable,false); + const plan=JSON.parse(execFileSync(process.execPath,[cli,'plan','local-loop'],{encoding:'utf8'}));assert.equal(plan.publicInstallAvailable,true);assert.equal(plan.registrySpecs.length,4); for(const args of [['publish'],['plan'],['catalog','--token','example'],['scaffold','x','--name','ok','--exec','id']]) { const rejected=spawnSync(process.execPath,[cli,...args],{encoding:'utf8'});assert.equal(rejected.status,2); } diff --git a/packages/wsp-toolkit/packages/contracts/package.json b/packages/wsp-toolkit/packages/contracts/package.json index 9835cdb3e..082f43a79 100644 --- a/packages/wsp-toolkit/packages/contracts/package.json +++ b/packages/wsp-toolkit/packages/contracts/package.json @@ -1,7 +1,7 @@ { "name": "ruvnet-constellation-contracts", "version": "0.1.0", - "description": "Dependency-free bounded constellation catalog and module contracts", + "description": "Validate bounded JSON catalogs and module manifests for independently installable RuvNet packages.", "type": "module", "main": "./src/index.js", "types": "./src/index.d.ts", @@ -33,5 +33,17 @@ }, "publishConfig": { "access": "public" + }, + "keywords": [ + "ruvnet", + "constellation", + "json-schema", + "validation", + "package-catalog", + "module-manifest" + ], + "homepage": "https://ruvnet.github.io/ruv-FANN/", + "bugs": { + "url": "https://github.com/ruvnet/ruv-FANN/issues" } } diff --git a/packages/wsp-toolkit/packages/contracts/test/contracts.test.mjs b/packages/wsp-toolkit/packages/contracts/test/contracts.test.mjs index 3d72888a8..02686736a 100644 --- a/packages/wsp-toolkit/packages/contracts/test/contracts.test.mjs +++ b/packages/wsp-toolkit/packages/contracts/test/contracts.test.mjs @@ -16,8 +16,10 @@ test('the actual default catalog uses versioned contracts and known profile memb const value=JSON.parse(await readFile(new URL('../../constellation/catalog.json',import.meta.url),'utf8')); const result=validateCatalog(value); assert.ok(result.packages.some(pkg=>pkg.name==='ruv-fann-wsp'&&pkg.status==='published')); - assert.ok(result.packages.some(pkg=>pkg.name==='ruvnet-constellation'&&pkg.status==='candidate')); + assert.ok(result.packages.some(pkg=>pkg.name==='ruvnet-constellation'&&pkg.status==='published')); assert.ok(result.profiles.some(profile=>profile.id==='local-loop')); + assert.equal(result.packages.length,24);assert.ok(result.packages.every(pkg=>pkg.status==='published')); + assert.equal(result.packages.find(pkg=>pkg.name==='ruv-fann').version,'0.2.0'); }); test('unknown fields, classes, getters, symbols and hostile arrays reject without invocation',()=>{ let calls=0; diff --git a/packages/wsp-toolkit/packages/huggingface/package.json b/packages/wsp-toolkit/packages/huggingface/package.json index 45f6793a6..59ffbd565 100644 --- a/packages/wsp-toolkit/packages/huggingface/package.json +++ b/packages/wsp-toolkit/packages/huggingface/package.json @@ -1,7 +1,7 @@ { "name": "ruv-fann-wsp-huggingface", "version": "0.1.0", - "description": "Integrity-pinned public Hugging Face dense JSON checkpoints for ruv-FANN WSP", + "description": "Load public Hugging Face dense JSON checkpoints with pinned revisions, SHA-256 integrity and bounded WSP validation.", "type": "module", "main": "./src/index.js", "types": "./src/index.d.ts", @@ -34,5 +34,19 @@ }, "publishConfig": { "access": "public" + }, + "keywords": [ + "ruv-fann", + "weight-space-programming", + "neural-network", + "webassembly", + "huggingface", + "model-checkpoints", + "sha256", + "model-validation" + ], + "homepage": "https://ruvnet.github.io/ruv-FANN/", + "bugs": { + "url": "https://github.com/ruvnet/ruv-FANN/issues" } } diff --git a/packages/wsp-toolkit/packages/invariants/package.json b/packages/wsp-toolkit/packages/invariants/package.json index 7c49c940a..e04a35f4e 100644 --- a/packages/wsp-toolkit/packages/invariants/package.json +++ b/packages/wsp-toolkit/packages/invariants/package.json @@ -1,7 +1,7 @@ { "name": "ruv-fann-wsp-invariants", "version": "0.1.0", - "description": "Bounded real-WASM finite-domain output invariants for surgical weight evolution", + "description": "Check finite-domain neural output bounds and expected values using real scalar or SIMD WebAssembly inference.", "type": "module", "main": "./src/index.js", "types": "./src/index.d.ts", @@ -35,5 +35,19 @@ "license": "MIT", "publishConfig": { "access": "public" + }, + "keywords": [ + "ruv-fann", + "weight-space-programming", + "neural-network", + "webassembly", + "output-invariants", + "model-validation", + "simd", + "regression-testing" + ], + "homepage": "https://ruvnet.github.io/ruv-FANN/", + "bugs": { + "url": "https://github.com/ruvnet/ruv-FANN/issues" } } diff --git a/packages/wsp-toolkit/packages/lifecycle/package.json b/packages/wsp-toolkit/packages/lifecycle/package.json index d7848fd2a..1423ffc5f 100644 --- a/packages/wsp-toolkit/packages/lifecycle/package.json +++ b/packages/wsp-toolkit/packages/lifecycle/package.json @@ -2,7 +2,7 @@ "name": "ruv-fann-wsp-lifecycle", "version": "0.1.0", "type": "module", - "description": "Bounded multi-suite regression gates and checkpoint branch evaluation for WSP", + "description": "Evaluate bounded neural weight patches across named regression suites and independent candidate branches.", "engines": { "node": ">=20.9.0" }, @@ -32,5 +32,19 @@ "type": "git", "url": "git+https://github.com/ruvnet/ruv-FANN.git", "directory": "packages/wsp-toolkit/packages/lifecycle" + }, + "keywords": [ + "ruv-fann", + "weight-space-programming", + "neural-network", + "webassembly", + "regression-testing", + "model-evaluation", + "weight-patches", + "checkpoint" + ], + "homepage": "https://ruvnet.github.io/ruv-FANN/", + "bugs": { + "url": "https://github.com/ruvnet/ruv-FANN/issues" } } diff --git a/packages/wsp-toolkit/packages/loop/package.json b/packages/wsp-toolkit/packages/loop/package.json index b64b700d8..285b9e48a 100644 --- a/packages/wsp-toolkit/packages/loop/package.json +++ b/packages/wsp-toolkit/packages/loop/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "type": "module", "license": "MIT", - "description": "Bounded autonomous weight evolution with worker swarms, independent gates and durable revision authority", + "description": "Coordinate bounded local weight evolution with worker proposals, independent regression gates and revision-based promotion.", "engines": { "node": ">=20.9.0" }, @@ -32,5 +32,20 @@ "type": "git", "url": "git+https://github.com/ruvnet/ruv-FANN.git", "directory": "packages/wsp-toolkit/packages/loop" + }, + "keywords": [ + "ruv-fann", + "weight-space-programming", + "neural-network", + "webassembly", + "autonomous-agents", + "model-evaluation", + "worker-threads", + "checkpoint", + "agentdb" + ], + "homepage": "https://ruvnet.github.io/ruv-FANN/", + "bugs": { + "url": "https://github.com/ruvnet/ruv-FANN/issues" } } diff --git a/packages/wsp-toolkit/packages/registry/package.json b/packages/wsp-toolkit/packages/registry/package.json index 559ba39ae..6dc59057e 100644 --- a/packages/wsp-toolkit/packages/registry/package.json +++ b/packages/wsp-toolkit/packages/registry/package.json @@ -1,7 +1,7 @@ { "name": "ruv-fann-wsp-registry", "version": "0.1.0", - "description": "Serialized AgentDB weight-program authority with explicit durable acknowledgement", + "description": "Adapt AgentDB weight programs with serialized operations, revision checks and caller-supplied persistence acknowledgment.", "type": "module", "main": "./src/index.js", "types": "./src/index.d.ts", @@ -42,5 +42,20 @@ "license": "MIT", "publishConfig": { "access": "public" + }, + "keywords": [ + "ruv-fann", + "weight-space-programming", + "neural-network", + "webassembly", + "agentdb", + "model-registry", + "checkpoint", + "persistence", + "compare-and-swap" + ], + "homepage": "https://ruvnet.github.io/ruv-FANN/", + "bugs": { + "url": "https://github.com/ruvnet/ruv-FANN/issues" } } diff --git a/packages/wsp-toolkit/packages/ruos/package.json b/packages/wsp-toolkit/packages/ruos/package.json index fda5fbb5a..4467ba686 100644 --- a/packages/wsp-toolkit/packages/ruos/package.json +++ b/packages/wsp-toolkit/packages/ruos/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "type": "module", "license": "MIT", - "description": "Real WASM canary and trusted executor completion checks for ruOS", + "description": "Validate real WebAssembly canary output and bind trusted ruOS executor completion evidence to explicit requests.", "engines": { "node": ">=20.9.0" }, @@ -29,5 +29,19 @@ "type": "git", "url": "git+https://github.com/ruvnet/ruv-FANN.git", "directory": "packages/wsp-toolkit/packages/ruos" + }, + "keywords": [ + "ruv-fann", + "weight-space-programming", + "neural-network", + "webassembly", + "ruos", + "executor", + "canary", + "evidence-validation" + ], + "homepage": "https://ruvnet.github.io/ruv-FANN/", + "bugs": { + "url": "https://github.com/ruvnet/ruv-FANN/issues" } } diff --git a/packages/wsp-toolkit/packages/search/package.json b/packages/wsp-toolkit/packages/search/package.json index fc7480b12..597e6ed8c 100644 --- a/packages/wsp-toolkit/packages/search/package.json +++ b/packages/wsp-toolkit/packages/search/package.json @@ -1,7 +1,7 @@ { "name": "ruv-fann-wsp-search", "version": "0.1.0", - "description": "Bounded derivative-free weight search and experimental symbolic/plasticity proposals for ruv-fann-wsp", + "description": "Search explicit neural weight values without gradients; propose bounded Boolean-table and experimental Hebbian edits.", "type": "module", "main": "./src/index.js", "types": "./src/index.d.ts", @@ -35,5 +35,19 @@ "license": "MIT", "publishConfig": { "access": "public" + }, + "keywords": [ + "ruv-fann", + "weight-space-programming", + "neural-network", + "webassembly", + "derivative-free", + "coordinate-descent", + "hebbian-learning", + "boolean-functions" + ], + "homepage": "https://ruvnet.github.io/ruv-FANN/", + "bugs": { + "url": "https://github.com/ruvnet/ruv-FANN/issues" } } diff --git a/packages/wsp-toolkit/packages/swarm/package.json b/packages/wsp-toolkit/packages/swarm/package.json index c9bee6eb3..be257c0dc 100644 --- a/packages/wsp-toolkit/packages/swarm/package.json +++ b/packages/wsp-toolkit/packages/swarm/package.json @@ -1,7 +1,7 @@ { "name": "ruv-fann-wsp-swarm", "version": "0.1.0", - "description": "Bounded fixed-operation proposal workers using real Node worker threads and WASM", + "description": "Run bounded neural patch and search proposals in real Node.js worker threads with isolated WebAssembly instances.", "type": "module", "main": "./src/index.js", "types": "./src/index.d.ts", @@ -32,5 +32,19 @@ "type": "git", "url": "git+https://github.com/ruvnet/ruv-FANN.git", "directory": "packages/wsp-toolkit/packages/swarm" + }, + "keywords": [ + "ruv-fann", + "weight-space-programming", + "neural-network", + "webassembly", + "worker-threads", + "parallel-computing", + "weight-patches", + "simd" + ], + "homepage": "https://ruvnet.github.io/ruv-FANN/", + "bugs": { + "url": "https://github.com/ruvnet/ruv-FANN/issues" } } diff --git a/packages/wsp-toolkit/packages/telemetry/package.json b/packages/wsp-toolkit/packages/telemetry/package.json index b94ef6751..30b629a6f 100644 --- a/packages/wsp-toolkit/packages/telemetry/package.json +++ b/packages/wsp-toolkit/packages/telemetry/package.json @@ -2,7 +2,7 @@ "name": "ruvnet-constellation-telemetry", "version": "0.1.0", "type": "module", - "description": "Public package observations and explicitly sampled project attach metrics with a standalone constellation dashboard", + "description": "Analyze public npm and GitHub observations, consented project samples and standalone package dashboards.", "engines": { "node": ">=20.9.0" }, @@ -29,5 +29,20 @@ }, "publishConfig": { "access": "public" + }, + "keywords": [ + "ruvnet", + "constellation", + "npm", + "github", + "package-analytics", + "dashboard", + "privacy", + "local-telemetry", + "adoption-metrics" + ], + "homepage": "https://ruvnet.github.io/ruv-FANN/", + "bugs": { + "url": "https://github.com/ruvnet/ruv-FANN/issues" } } diff --git a/packages/wsp-toolkit/scripts/constellation-links.mjs b/packages/wsp-toolkit/scripts/constellation-links.mjs index 524c1d5cc..cef614391 100644 --- a/packages/wsp-toolkit/scripts/constellation-links.mjs +++ b/packages/wsp-toolkit/scripts/constellation-links.mjs @@ -1,22 +1,22 @@ import {readFile,writeFile} from 'node:fs/promises'; -import {resolve,dirname,relative,join} from 'node:path'; +import {resolve,dirname,join} from 'node:path'; import {fileURLToPath} from 'node:url'; import {validateCatalog,validateModuleManifest,CONTRACTS} from 'ruvnet-constellation-contracts'; const root=resolve(dirname(fileURLToPath(import.meta.url)),'..'); const catalog=validateCatalog(JSON.parse(await readFile(join(root,'packages/constellation/catalog.json'),'utf8'))); -const check=process.argv.slice(2).includes('--check'); -if(process.argv.slice(2).some(arg=>arg!=='--check'))throw new Error('usage: node scripts/constellation-links.mjs [--check]'); -const entries=catalog.packages.filter(p=>p.status==='candidate'&&p.repository===catalog.repository&&p.directory?.startsWith('packages/wsp-toolkit/packages/')); +const args=process.argv.slice(2),check=args.includes('--check'),print=args.includes('--print'); +if(args.length>1||args.some(arg=>!['--check','--print'].includes(arg)))throw new Error('usage: node scripts/constellation-links.mjs [--check|--print]'); +const entries=catalog.packages.filter(p=>p.repository===catalog.repository&&p.directory?.startsWith('packages/wsp-toolkit/packages/')); const start='',end=''; -let changes=0; +let changes=0;const blocks=[]; for(const entry of entries) { const directory=resolve(root,'../..',entry.directory); - if(!directory.startsWith(join(root,'packages')+'/'))throw new Error('candidate directory escapes workspace'); + if(!directory.startsWith(join(root,'packages')+'/'))throw new Error('local package directory escapes workspace'); const readmePath=join(directory,'README.md'),manifestPath=join(directory,'package.json'); const manifest=JSON.parse(await readFile(manifestPath,'utf8')); if(manifest.name!==entry.name||manifest.version!==entry.version)throw new Error('catalog package identity differs from source'); - const sourceLink=target=>relative(directory,join(root,'packages',target,'README.md')).split('\\').join('/'); - const block=`${start}\n\nExplore the [constellation onramp](${sourceLink('constellation')}) and [shared contracts](${sourceLink('contracts')}). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo).\n\nThese links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog.\n\n${end}`; + const block=`${start}\n\nExplore the [ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/), [constellation onramp](https://www.npmjs.com/package/ruvnet-constellation) and [shared contracts](https://www.npmjs.com/package/ruvnet-constellation-contracts). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo).\n\nThese links describe integrations; package.json defines install-time dependencies. The [versioned catalog](https://github.com/${catalog.repository}/blob/main/packages/wsp-toolkit/packages/constellation/catalog.json) declares release profiles and package versions; registry availability and publication provenance require independent verification.\n\n${end}`; + if(print)blocks.push({name:entry.name,directory:entry.directory,readmeBlock:block}); const before=await readFile(readmePath,'utf8'); if((before.includes(start)||before.includes(end))&&!(before.includes(start)&&before.includes(end)))throw new Error('incomplete constellation README markers'); const after=before.includes(start)?before.slice(0,before.indexOf(start))+block+before.slice(before.indexOf(end)+end.length):before.trimEnd()+'\n\n'+block+'\n'; @@ -30,8 +30,8 @@ for(const entry of entries) { const changed=after!==before||oldModule!==moduleJSON||!manifest.files?.includes('constellation.json'); if(changed) { changes++; - if(!check){await writeFile(readmePath,after);await writeFile(modulePath,moduleJSON);await writeFile(manifestPath,JSON.stringify(nextManifest,null,2)+'\n');} + if(!check&&!print){await writeFile(readmePath,after);await writeFile(modulePath,moduleJSON);await writeFile(manifestPath,JSON.stringify(nextManifest,null,2)+'\n');} } } if(check&&changes)throw new Error(`${changes} constellation metadata/README blocks need regeneration`); -console.log(JSON.stringify({packages:entries.length,changes,mode:check?'check':'write'})); +console.log(JSON.stringify({packages:entries.length,changes,mode:check?'check':print?'print':'write',...(print?{blocks}:{})})); diff --git a/packages/wsp-toolkit/test/constellation-browser.test.mjs b/packages/wsp-toolkit/test/constellation-browser.test.mjs index 49f3809bf..e271d5e2e 100644 --- a/packages/wsp-toolkit/test/constellation-browser.test.mjs +++ b/packages/wsp-toolkit/test/constellation-browser.test.mjs @@ -6,8 +6,8 @@ import {renderConstellationDashboard} from 'ruvnet-constellation-telemetry'; import {constellationFixture} from './constellation-fixture.mjs'; test('standalone dashboard filters real report shapes without external requests or executable metadata',async()=>{ const fixture=await constellationFixture({adoption:true,hostile:true}); - const unsampled=await constellationFixture(); - const pages=new Map([['/',renderConstellationDashboard(fixture.report)],['/unsampled',renderConstellationDashboard(unsampled.report)]]); + const unsampled=await constellationFixture(),candidates=await constellationFixture({candidates:true}); + const pages=new Map([['/',renderConstellationDashboard(fixture.report)],['/unsampled',renderConstellationDashboard(unsampled.report)],['/candidates',renderConstellationDashboard(candidates.report)]]); const server=createServer((req,res)=>{if(pages.has(req.url)){res.writeHead(200,{'Content-Type':'text/html'});res.end(pages.get(req.url));}else res.writeHead(404).end();}); await new Promise(resolve=>server.listen(0,'127.0.0.1',resolve));let browser; try { @@ -25,9 +25,11 @@ test('standalone dashboard filters real report shapes without external requests assert.equal(await page.locator('#package-table tr[data-package]').count(),9); await page.fill('#package-search','loop');assert.equal(await page.locator('#package-table tr[data-package]').count(),1); assert.equal(await page.locator('#package-table tr[data-package]').getAttribute('data-package'),'ruv-fann-wsp-loop'); - assert.match(await page.locator('#package-table').innerText(),/Local candidate/); + assert.match(await page.locator('#package-table').innerText(),/Observed/); await page.fill('#package-search','no-such-package');assert.match(await page.locator('#package-table').innerText(),/No packages match/); await page.goto(origin+'/unsampled');assert.match(await page.locator('#attach-rate').innerText(),/Not measured/); + await page.goto(origin+'/candidates');await page.fill('#package-search','ruv-fann-wsp-loop'); + assert.match(await page.locator('#package-table').innerText(),/Local candidate/); assert.deepEqual(errors,[]);assert.deepEqual(external,[]); } finally {await browser?.close();await new Promise(resolve=>server.close(resolve));} }); diff --git a/packages/wsp-toolkit/test/constellation-fixture.mjs b/packages/wsp-toolkit/test/constellation-fixture.mjs index 268683fc6..eb0e737f4 100644 --- a/packages/wsp-toolkit/test/constellation-fixture.mjs +++ b/packages/wsp-toolkit/test/constellation-fixture.mjs @@ -1,7 +1,9 @@ import {readCatalog} from 'ruvnet-constellation'; import {analyzeConstellation} from 'ruvnet-constellation-telemetry'; -export async function constellationFixture({adoption=false,hostile=false}={}) { +export async function constellationFixture({adoption=false,hostile=false,candidates=false}={}) { const catalog=await readCatalog(); + // Explicit source-only test variant; the default fixture retains release declarations. + if(candidates)for(const pkg of catalog.packages)if(pkg.directory)pkg.status='candidate'; if(hostile)catalog.packages[0].description=''; const start='2026-09-30',end='2026-11-10'; const observations={schema:'ruvnet.constellation-observations/1',observedAt:'2026-11-11T12:00:00.000Z',start,end, diff --git a/packages/wsp-toolkit/test/constellation-scenario.mjs b/packages/wsp-toolkit/test/constellation-scenario.mjs index 47bd0ca74..5b8fc862d 100644 --- a/packages/wsp-toolkit/test/constellation-scenario.mjs +++ b/packages/wsp-toolkit/test/constellation-scenario.mjs @@ -8,8 +8,12 @@ import {constellationFixture} from './constellation-fixture.mjs'; const check=(ok,message)=>{if(!ok)throw new Error(`constellation scenario: ${message}`);}; export async function runConstellationScenario() { const catalog=await readCatalog(),plan=planProfile(catalog,'weights'),local=planProfile(catalog,'local-loop'); - check(plan.registrySpecs.length===1&&plan.registrySpecs[0]==='ruv-fann-wsp@0.2.0','verified primitive profile'); - check(local.publicInstallAvailable===false&&local.registrySpecs.length===0,'source candidates cannot masquerade as registry installs'); + check(plan.registrySpecs.length===1&&plan.registrySpecs[0]==='ruv-fann-wsp@0.2.0','declared primitive profile'); + check(local.publicInstallAvailable===true&&local.registrySpecs.length===4&&local.localCandidates.length===0,'declared release profile supplies explicit versioned install specs'); + const candidateCatalog=structuredClone(catalog),localNames=new Set(local.packages.map(pkg=>pkg.name)); + for(const entry of candidateCatalog.packages)if(localNames.has(entry.name))entry.status='candidate'; + const candidatePlan=planProfile(candidateCatalog,'local-loop'); + check(candidatePlan.publicInstallAvailable===false&&candidatePlan.registrySpecs.length===0&&candidatePlan.localCandidates.length===4,'independent source-only fixture cannot masquerade as registry installs'); const directory=await mkdtemp(join(tmpdir(),'constellation-scenario-')); try { const scaffold=await scaffoldSatellite({directory:join(directory,'satellite'),name:'constellation-review-fixture',integrations:['ruv-fann-wsp']}); @@ -28,6 +32,6 @@ export async function runConstellationScenario() { check(unsampled.report.attach.status==='unavailable'&&unsampled.report.attach.percentage===null,'downloads do not invent attach'); check(!JSON.stringify(fixture.report).includes('1'.repeat(64)),'sample IDs are not published'); return {schema:'ruvnet.constellation-acceptance/1',catalogEntries:catalog.packages.length,published:catalog.packages.filter(p=>p.status==='published').length, - candidateProfileBlocked:true,scaffoldTests:3,scaffoldNoInstall:true,attachUnit:fixture.report.attach.unit,attachDenominator:3,attachNumerator:2,unsampledAttach:'unavailable',sampleIDsExcluded:true}; + releaseProfileInstallSpecs:local.registrySpecs.length,candidateProfileBlocked:true,scaffoldTests:3,scaffoldNoInstall:true,attachUnit:fixture.report.attach.unit,attachDenominator:3,attachNumerator:2,unsampledAttach:'unavailable',sampleIDsExcluded:true}; } finally {await rm(directory,{recursive:true,force:true});} } diff --git a/packages/wsp-toolkit/test/constellation.test.mjs b/packages/wsp-toolkit/test/constellation.test.mjs index 2be1b0833..238368c25 100644 --- a/packages/wsp-toolkit/test/constellation.test.mjs +++ b/packages/wsp-toolkit/test/constellation.test.mjs @@ -6,7 +6,7 @@ import {join} from 'node:path'; import {spawnSync,execFileSync} from 'node:child_process'; import {runConstellationScenario} from './constellation-scenario.mjs'; test('catalog planning, satellite quality checks and privacy-aware attach compose end-to-end',async()=>{ - const result=await runConstellationScenario();assert.equal(result.catalogEntries,24);assert.equal(result.published,12);assert.equal(result.scaffoldNoInstall,true); + const result=await runConstellationScenario();assert.equal(result.catalogEntries,24);assert.equal(result.published,24);assert.equal(result.releaseProfileInstallSpecs,4);assert.equal(result.candidateProfileBlocked,true);assert.equal(result.scaffoldNoInstall,true); }); test('public report command rejects malformed, oversized and nonregular catalog input before network',async()=>{ const directory=await mkdtemp(join(tmpdir(),'constellation-cli-')),script=new URL('../scripts/constellation-report.mjs',import.meta.url).pathname; From e3b1b77c8844f1a689a94fbb096535ec2a02895f Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 23:02:25 -0500 Subject: [PATCH 13/20] test(release): verify complete toolkit scenarios after fresh public install --- .../workflows/protected-toolkit-release.yml | 1 + .../wsp-toolkit/scripts/packed-consumer.mjs | 26 ++++++++++++------- scripts/toolkit-release-lane.mjs | 11 +++++--- scripts/toolkit-release-lib.mjs | 6 +++++ scripts/toolkit-release.test.mjs | 6 +++-- 5 files changed, 34 insertions(+), 16 deletions(-) diff --git a/.github/workflows/protected-toolkit-release.yml b/.github/workflows/protected-toolkit-release.yml index a27b69d6c..e88ff48df 100644 --- a/.github/workflows/protected-toolkit-release.yml +++ b/.github/workflows/protected-toolkit-release.yml @@ -61,6 +61,7 @@ jobs: NODE_AUTH_TOKEN: '' run: | npm ci --prefix packages/wsp-toolkit --ignore-scripts --no-audit --no-fund + npm run --prefix packages/wsp-toolkit setup:agentdb packages/wsp-toolkit/node_modules/.bin/playwright install --with-deps chromium - name: Require fresh-cache public bytes, sealed dependency lock, strict types and real Chromium/WASM consumer env: diff --git a/packages/wsp-toolkit/scripts/packed-consumer.mjs b/packages/wsp-toolkit/scripts/packed-consumer.mjs index 22531c295..988094878 100644 --- a/packages/wsp-toolkit/scripts/packed-consumer.mjs +++ b/packages/wsp-toolkit/scripts/packed-consumer.mjs @@ -32,16 +32,7 @@ export async function verifyPackedConsumer() { } else archives=await packToolkit(directory); await writeFile(join(directory,'package.json'),JSON.stringify({private:true,type:'module'})); execFileSync('npm',['install','--ignore-scripts','--prefer-offline','--no-audit','--no-fund',...archives.map(p=>join(directory,p.filename))],{cwd:directory,encoding:'utf8'}); - await copyFile(join(toolkitRoot,'test','scenario.mjs'),join(directory,'scenario.mjs')); - await copyFile(join(toolkitRoot,'test','types.ts'),join(directory,'types.ts')); - await copyFile(join(toolkitRoot,'test','evolution-scenario.mjs'),join(directory,'evolution-scenario.mjs')); - for(const file of ['constellation-scenario.mjs','constellation-fixture.mjs'])await copyFile(join(toolkitRoot,'test',file),join(directory,file)); - execFileSync(process.execPath,[join(toolkitRoot,'node_modules/typescript/bin/tsc'),'--noEmit','--strict','--module','nodenext','--target','es2023','--lib','es2023,dom','types.ts'],{cwd:directory,encoding:'utf8'}); - const stdout=execFileSync(process.execPath,['--input-type=module','-e', - "import {pathToFileURL} from 'node:url'; import {runScenario} from './scenario.mjs'; import {runEvolutionScenario} from './evolution-scenario.mjs'; import {runConstellationScenario} from './constellation-scenario.mjs'; import {createAgentDBRegistry} from 'ruv-fann-wsp-registry'; import {buildWorker} from 'ruv-fann-wsp-cloudflare/build'; const {openDemoRegistry}=await import(pathToFileURL(process.argv[1]).href); await buildWorker('./worker'); const evolution=await runEvolutionScenario(path=>openDemoRegistry(path,createAgentDBRegistry),'.'); console.log('WSP_CONSUMER_RESULT '+JSON.stringify({results:[await runScenario(false),await runScenario(true)],evolution,constellation:await runConstellationScenario()}));",join(toolkitRoot,'tooling/agentdb/runtime.mjs')],{cwd:directory,encoding:'utf8'}); - const line=stdout.split('\n').find(line=>line.startsWith('WSP_CONSUMER_RESULT ')); - if(!line)throw new Error('packed consumer result is missing'); - const result=JSON.parse(line.slice('WSP_CONSUMER_RESULT '.length)); + const result=await verifyToolkitInstallation(directory); const light=await mkdtemp(join(tmpdir(),'constellation-light-')); let lightweight; try { @@ -57,3 +48,18 @@ export async function verifyPackedConsumer() { return {schema:'ruv-fann.packed-consumer/1',archives,...result,lightweight}; }finally{await rm(directory,{recursive:true,force:true});} } + +/** Run real integration fixtures against an already-installed archive/public tree. */ +export async function verifyToolkitInstallation(directory,{env=process.env}={}) { + await copyFile(join(toolkitRoot,'test','scenario.mjs'),join(directory,'scenario.mjs')); + await copyFile(join(toolkitRoot,'test','types.ts'),join(directory,'types.ts')); + await copyFile(join(toolkitRoot,'test','evolution-scenario.mjs'),join(directory,'evolution-scenario.mjs')); + for(const file of ['constellation-scenario.mjs','constellation-fixture.mjs'])await copyFile(join(toolkitRoot,'test',file),join(directory,file)); + execFileSync(process.execPath,[join(toolkitRoot,'node_modules/typescript/bin/tsc'),'--noEmit','--strict','--module','nodenext','--target','es2023','--lib','es2023,dom','types.ts'],{cwd:directory,encoding:'utf8',env}); + const stdout=execFileSync(process.execPath,['--input-type=module','-e', + "import {pathToFileURL} from 'node:url'; import {runScenario} from './scenario.mjs'; import {runEvolutionScenario} from './evolution-scenario.mjs'; import {runConstellationScenario} from './constellation-scenario.mjs'; import {createAgentDBRegistry} from 'ruv-fann-wsp-registry'; import {buildWorker} from 'ruv-fann-wsp-cloudflare/build'; const {openDemoRegistry}=await import(pathToFileURL(process.argv[1]).href); await buildWorker('./worker'); const evolution=await runEvolutionScenario(path=>openDemoRegistry(path,createAgentDBRegistry),'.'); console.log('WSP_CONSUMER_RESULT '+JSON.stringify({results:[await runScenario(false),await runScenario(true)],evolution,constellation:await runConstellationScenario()}));",join(toolkitRoot,'tooling/agentdb/runtime.mjs')],{cwd:directory,encoding:'utf8',env}); + const line=stdout.split('\n').find(line=>line.startsWith('WSP_CONSUMER_RESULT ')); + if(!line)throw new Error('packed consumer result is missing'); + const result=JSON.parse(line.slice('WSP_CONSUMER_RESULT '.length)); + return result; +} diff --git a/scripts/toolkit-release-lane.mjs b/scripts/toolkit-release-lane.mjs index 8c7871bff..01fb811fe 100644 --- a/scripts/toolkit-release-lane.mjs +++ b/scripts/toolkit-release-lane.mjs @@ -5,7 +5,8 @@ import { readFile,writeFile,readdir,mkdir,mkdtemp,rm,copyFile,lstat } from 'node import { join,resolve,dirname,basename } from 'node:path'; import { tmpdir } from 'node:os'; import { fileURLToPath } from 'node:url'; -import { schema,releaseTag,packageSpecs,sha256,integrity,tarballURL,safeFilename,assertSourceSha,topologicalOrder,validateRows,validateCoreReceipt,validateQualification,publicLock } from './toolkit-release-lib.mjs'; +import { schema,releaseTag,packageSpecs,sha256,integrity,tarballURL,safeFilename,assertSourceSha,topologicalOrder,validateRows,validateCoreReceipt,validateQualification,validateToolkitProof,publicLock } from './toolkit-release-lib.mjs'; +import {verifyToolkitInstallation} from '../packages/wsp-toolkit/scripts/packed-consumer.mjs'; const root=resolve(fileURLToPath(new URL('..',import.meta.url))),toolkit=join(root,'packages/wsp-toolkit'); const args=process.argv.slice(2),mode=args.shift(),options=Object.create(null); for(let i=0;i({name,version,sha256,integrity})),core}); + const toolkitProof=await verifyToolkitInstallation(target,{env});validateToolkitProof(toolkitProof); + await save(need('output'),{schema:`${schema}.public-consumer/1`,status:'passed',sourceSha:seal.sourceSha,releaseTag,sealSha256:sha256(await readFile(join(directory,'candidate-seal.json'))),publicLockSha256:sha256(await readFile(join(directory,'public-package-lock.json'))),packages:manifest.packages.map(({name,version,sha256,integrity})=>({name,version,sha256,integrity})),core,toolkit:toolkitProof}); }finally{await rm(target,{recursive:true,force:true});} } function tagCommit(tag){let item=JSON.parse(run('gh',['api',`repos/ruvnet/ruv-FANN/git/ref/tags/${tag}`])).object;for(let i=0;i<5;i++){if(item.type==='commit')return item.sha;if(item.type!=='tag')throw Error('Tag does not resolve to commit');item=JSON.parse(run('gh',['api',`repos/ruvnet/ruv-FANN/git/tags/${item.sha}`])).object;}throw Error('Tag nesting exceeds limit');} @@ -173,7 +176,7 @@ async function githubRelease(){ const publication=await json(need('publication')),consumer=await json(need('public-consumer')); if(publication.status!=='passed'||consumer.status!=='passed'||publication.sourceSha!==seal.sourceSha||consumer.sourceSha!==seal.sourceSha||consumer.sealSha256!==sha256(await readFile(join(directory,'candidate-seal.json')))||publication.sealSha256!==consumer.sealSha256)throw Error('Public release evidence mismatch'); for(const row of manifest.packages)for(const receipt of [publication,consumer])if(receipt.packages?.length!==manifest.packages.length||!receipt.packages.some(item=>item.name===row.name&&item.version===row.version&&item.sha256===row.sha256&&item.integrity===row.integrity))throw Error('Release public package evidence differs from seal'); - validateCoreReceipt(consumer.core,seal.sourceSha);for(const row of manifest.packages)await awaitPublic(row); + validateCoreReceipt(consumer.core,seal.sourceSha);validateToolkitProof(consumer.toolkit);for(const row of manifest.packages)await awaitPublic(row); const receipt={schema:`${schema}.release/1`,status:'passed',sourceSha:seal.sourceSha,releaseTag,sealSha256:sha256(await readFile(join(directory,'candidate-seal.json'))),publicationSha256:sha256(await readFile(need('publication'))),publicConsumerSha256:sha256(await readFile(need('public-consumer'))),packages:manifest.packages}; await save(need('output'),receipt); const paths=[...seal.files.map(row=>join(directory,row.filename)),join(directory,'candidate-seal.json'),resolve(need('publication')),resolve(need('public-consumer')),resolve(need('output'))]; diff --git a/scripts/toolkit-release-lib.mjs b/scripts/toolkit-release-lib.mjs index 16ef00e73..068748664 100644 --- a/scripts/toolkit-release-lib.mjs +++ b/scripts/toolkit-release-lib.mjs @@ -63,11 +63,17 @@ export function validateQualification(receipt,sourceSha,manifestHash) { ['fail','cancelled','skipped','todo'].some(key=>report.tests[key]!==0)||report.audit?.vulnerabilities?.total!==0||report.agentdbIntegrationAudit?.vulnerabilities?.total!==0) throw Error('Qualification requires nonzero no-skip tests, types and zero-advisory audits'); validateCoreReceipt(receipt.core,sourceSha); + validateToolkitProof(receipt.toolkit); if(report.benchmark?.schema!=='ruv-fann.search-benchmark/1'||report.benchmark.candidateMSE!==0|| report.benchmark.referenceInferencePasses!==32||report.benchmark.screenedInferencePasses!==19|| !/^[a-f0-9]{64}$/.test(report.benchmark.equivalentCandidateHash))throw Error('Search benchmark must preserve the exact candidate and measured work counts'); if(receipt.runtime!==report.node||receipt.runtime!==receipt.core.runtime)throw Error('Qualification runtimes disagree'); } +export function validateToolkitProof(proof) { + if(!proof||!['wasm','wasm-simd'].every(backend=>proof.results?.some(row=>row.backend===backend&&row.candidateMSE===0&&row.regressionRejected===true&&row.compiledXor===true&&row.rollbackRevision===3))|| + proof.evolution?.report?.promotions!==2||proof.evolution.durability?.reopened!==true||proof.evolution.durability.rollbackPersisted!==true||proof.evolution.report.workerThreadIds?.length<2|| + proof.constellation?.catalogEntries!==24||proof.constellation.scaffoldTests!==3)throw Error('Toolkit installation must prove both real WASM backends, concurrent durable AgentDB promotion/rollback and generated constellation tests'); +} export function publicLock(candidateLock,rows) { const lock=structuredClone(candidateLock),root=lock.packages?.['']; if(!root)throw Error('Installed candidate lock missing root'); diff --git a/scripts/toolkit-release.test.mjs b/scripts/toolkit-release.test.mjs index f0d0f96f3..6360d5dfa 100644 --- a/scripts/toolkit-release.test.mjs +++ b/scripts/toolkit-release.test.mjs @@ -2,12 +2,13 @@ import test from 'node:test'; import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import {execFileSync,spawnSync} from 'node:child_process'; -import {packageSpecs,topologicalOrder,validateRows,validateCoreReceipt,validateQualification,publicLock,safeFilename,sha256,integrity,tarballURL} from './toolkit-release-lib.mjs'; +import {packageSpecs,topologicalOrder,validateRows,validateCoreReceipt,validateQualification,validateToolkitProof,publicLock,safeFilename,sha256,integrity,tarballURL} from './toolkit-release-lib.mjs'; const sha='a'.repeat(40),manifestHash='b'.repeat(64); const rows=()=>topologicalOrder(packageSpecs.map(spec=>({name:spec.name,version:spec.version,tarball:`${spec.name}-${spec.version}.tgz`,sha256:sha256('archive'),integrity:integrity('archive'),dependencies:{}}))); const backend=name=>({backend:name,checks:12,inference:true,training:true,search:true,gate:true,invariants:true,rejectedPromotion:true,rollbackRevision:3}); const core=()=>({schema:'ruv-fann.core-consumer/1',status:'passed',sourceSha:sha,testCount:66,skipped:0,todo:0,runtime:'v22.23.2',backendChecks:['wasm','wasm-simd'].map(backend),browser:{engine:'Chromium',realWasm:true,checks:['wasm','wasm-simd'].map(backend),pageErrors:[]},types:{strict:true,subpaths:14},graph:{core:'0.2.0',legacyCore:'0.1.2',finite:true}}); -const qualification=()=>({schema:'ruv-fann.toolkit.qualification/1',status:'passed',sourceSha:sha,manifestSha256:manifestHash,runtime:'v22.23.2',core:core(),validation:{typecheck:'passed',node:'v22.23.2',tests:{tests:100,pass:100,fail:0,cancelled:0,skipped:0,todo:0},audit:{vulnerabilities:{total:0}},agentdbIntegrationAudit:{vulnerabilities:{total:0}},benchmark:{schema:'ruv-fann.search-benchmark/1',candidateMSE:0,referenceInferencePasses:32,screenedInferencePasses:19,equivalentCandidateHash:'c'.repeat(64)}}}); +const toolkit=()=>({results:['wasm','wasm-simd'].map(backend=>({backend,candidateMSE:0,regressionRejected:true,compiledXor:true,rollbackRevision:3})),evolution:{report:{promotions:2,workerThreadIds:[1,2]},durability:{reopened:true,rollbackPersisted:true}},constellation:{catalogEntries:24,scaffoldTests:3}}); +const qualification=()=>({schema:'ruv-fann.toolkit.qualification/1',status:'passed',sourceSha:sha,manifestSha256:manifestHash,runtime:'v22.23.2',core:core(),toolkit:toolkit(),validation:{typecheck:'passed',node:'v22.23.2',tests:{tests:100,pass:100,fail:0,cancelled:0,skipped:0,todo:0},audit:{vulnerabilities:{total:0}},agentdbIntegrationAudit:{vulnerabilities:{total:0}},benchmark:{schema:'ruv-fann.search-benchmark/1',candidateMSE:0,referenceInferencePasses:32,screenedInferencePasses:19,equivalentCandidateHash:'c'.repeat(64)}}}); test('candidate includes exactly twelve satellites and new core with SHA256/SRI',()=>{assert.equal(validateRows(rows()).length,13);for(const mutate of [r=>r.pop(),r=>r.push(r[0]),r=>r[0].version='1.0.0',r=>r[0].sha256='wrong',r=>r[0].integrity='sha512-wrong',r=>r[0].tarball='../escape.tgz']){const data=rows();mutate(data);assert.throws(()=>validateRows(data));}}); test('dependency order puts prerequisites first and tolerates explicit nested legacy core only',()=>{ const data=rows(),coreRow=data.find(r=>r.name==='ruv-fann'),loop=data.find(r=>r.name==='ruv-fann-wsp-loop');coreRow.dependencies={'ruv-fann-wsp-loop':'0.1.0'};loop.dependencies={'ruv-fann':'0.1.2'}; @@ -17,6 +18,7 @@ test('dependency order puts prerequisites first and tolerates explicit nested le }); test('rejects unknown, skipped, zero, failed and mismatched-source qualification',()=>{validateQualification(qualification(),sha,manifestHash);for(const mutate of [r=>r.status='unknown',r=>r.sourceSha='d'.repeat(40),r=>r.manifestSha256='e'.repeat(64),r=>r.validation.tests.tests=0,r=>r.validation.tests.skipped=1,r=>r.validation.tests.todo=1,r=>r.validation.tests.cancelled=1,r=>r.validation.tests.fail=1,r=>r.validation.audit.vulnerabilities.total=1,r=>r.validation.agentdbIntegrationAudit.vulnerabilities.total=1,r=>r.validation.node='v24.22.1',r=>r.validation.benchmark.candidateMSE=1]){const report=qualification();mutate(report);assert.throws(()=>validateQualification(report,sha,manifestHash));}}); test('installed proof requires real SIMD and scalar Node/Chromium numerical checks, types, rollback and finite graph',()=>{validateCoreReceipt(core(),sha);for(const mutate of [r=>r.testCount=0,r=>r.skipped=1,r=>r.todo=1,r=>r.browser.realWasm=false,r=>r.browser.checks=[],r=>r.browser.pageErrors=['error'],r=>r.types.strict=false,r=>r.types.subpaths=0,r=>r.graph.finite=false,r=>r.backendChecks[0].rollbackRevision=2,r=>r.backendChecks[0].search=false]){const proof=core();mutate(proof);assert.throws(()=>validateCoreReceipt(proof,sha));}}); +test('full installed toolkit proof requires actual concurrent workers and durable AgentDB reopen/rollback',()=>{validateToolkitProof(toolkit());for(const mutate of [r=>r.results=[],r=>r.results[0].candidateMSE=1,r=>r.evolution.report.workerThreadIds=[1],r=>r.evolution.report.promotions=0,r=>r.evolution.durability.reopened=false,r=>r.evolution.durability.rollbackPersisted=false,r=>r.constellation.scaffoldTests=0]){const proof=toolkit();mutate(proof);assert.throws(()=>validateToolkitProof(proof));}}); test('public lock preserves resolved transitive versions and replaces only candidate archives with SRI-bound public URLs',()=>{ const packages=rows(),lock={name:'consumer',version:'1.0.0',lockfileVersion:3,packages:{'':{dependencies:{}},'node_modules/external':{version:'1.2.3',resolved:'https://registry.npmjs.org/external/-/external-1.2.3.tgz',integrity:'sha512-external'}}}; for(const row of packages)lock.packages[`node_modules/${row.name}`]={version:row.version,resolved:`file:/tmp/${row.tarball}`,integrity:row.integrity}; From 6988b3790d273aae56e727d5aa56ac0f280fca0c Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 23:05:44 -0500 Subject: [PATCH 14/20] fix(release): prove packed payload matches tracked source and recover partial assets --- scripts/toolkit-release-lane.mjs | 62 ++++++++++++++++++++++++++++---- scripts/toolkit-release-lib.mjs | 4 +-- scripts/toolkit-release.test.mjs | 18 ++++++++-- 3 files changed, 73 insertions(+), 11 deletions(-) diff --git a/scripts/toolkit-release-lane.mjs b/scripts/toolkit-release-lane.mjs index 01fb811fe..02e2a7568 100644 --- a/scripts/toolkit-release-lane.mjs +++ b/scripts/toolkit-release-lane.mjs @@ -5,6 +5,7 @@ import { readFile,writeFile,readdir,mkdir,mkdtemp,rm,copyFile,lstat } from 'node import { join,resolve,dirname,basename } from 'node:path'; import { tmpdir } from 'node:os'; import { fileURLToPath } from 'node:url'; +import {isDeepStrictEqual} from 'node:util'; import { schema,releaseTag,packageSpecs,sha256,integrity,tarballURL,safeFilename,assertSourceSha,topologicalOrder,validateRows,validateCoreReceipt,validateQualification,validateToolkitProof,publicLock } from './toolkit-release-lib.mjs'; import {verifyToolkitInstallation} from '../packages/wsp-toolkit/scripts/packed-consumer.mjs'; const root=resolve(fileURLToPath(new URL('..',import.meta.url))),toolkit=join(root,'packages/wsp-toolkit'); @@ -26,10 +27,25 @@ async function isolatedEnv(target){ } async function metadata(path){ const names=run('tar',['-tzf',path]).split('\n'); - if(names.length>2000||names.some(name=>!name.startsWith('package/')||name.includes('..')||name.includes('\\')||name.startsWith('/')))throw Error('Unsafe package archive paths'); + if(names.length>2000||new Set(names).size!==names.length||names.some(name=>!name.startsWith('package/')||name.includes('..')||name.includes('\\')||name.startsWith('/')||name.endsWith('/')))throw Error('Unsafe or duplicate package archive paths'); if(run('tar',['-tvzf',path]).split('\n').some(line=>!/^[-d]/.test(line)))throw Error('Archive links and special files forbidden'); return JSON.parse(run('tar',['-xOzf',path,'package/package.json'])); } +function assertTrackedPayload(spec,relative,bytes){ + if(typeof relative!=='string'||!relative||relative.startsWith('/')||relative.includes('..')||relative.includes('\\'))throw Error('Unsafe source payload path'); + const path=`${spec.directory}/${relative}`; + let tracked;try{tracked=execFileSync('git',['show',`HEAD:${path}`],{cwd:root,stdio:['ignore','pipe','pipe'],maxBuffer:20*1024*1024});}catch{throw Error(`Package payload is not tracked at source HEAD: ${path}`);} + if(relative==='package.json'){ + // npm can normalize harmless JSON formatting; the entire parsed manifest must still match HEAD. + if(!isDeepStrictEqual(JSON.parse(bytes),JSON.parse(tracked)))throw Error(`Packed package manifest differs from tracked HEAD: ${path}`); + }else if(!tracked.equals(bytes))throw Error(`Package payload bytes differ from tracked HEAD: ${path}`); +} +async function preflightPackage(spec){ + const listing=JSON.parse(run('npm',['pack','--dry-run','--json','--ignore-scripts'],join(root,spec.directory),cleanEnv())); + if(listing.length!==1||!listing[0].files?.length)throw Error('Package preflight returned no files'); + const names=new Set();for(const file of listing[0].files){if(names.has(file.path))throw Error('Duplicate package preflight path');names.add(file.path);const path=join(root,spec.directory,file.path);if(!(await lstat(path)).isFile())throw Error('Source payload must be a regular tracked file');assertTrackedPayload(spec,file.path,await readFile(path));} +} +async function preflight(){clean();const spec=packageSpecs.find(row=>row.name===need('package'));if(!spec)throw Error('Unknown package');await preflightPackage(spec);} async function inspectRows(directory,rows){ validateRows(rows); for(const row of rows){ @@ -37,11 +53,17 @@ async function inspectRows(directory,rows){ if(sha256(bytes)!==row.sha256||integrity(bytes)!==row.integrity||pkg.name!==row.name||pkg.version!==row.version||pkg.private||JSON.stringify(pkg.dependencies??{})!==JSON.stringify(row.dependencies))throw Error(`Archive identity, dependency or digest mismatch: ${row.name}`); const spec=packageSpecs.find(spec=>spec.name===row.name),tracked=await json(join(root,spec.directory,'package.json')); if(pkg.name!==tracked.name||pkg.version!==tracked.version||JSON.stringify(pkg.dependencies??{})!==JSON.stringify(tracked.dependencies??{}))throw Error('Archive differs from source package identity/dependencies'); + for(const filename of run('tar',['-tzf',path]).split('\n')){ + const bytes=execFileSync('tar',['-xOzf',path,filename],{maxBuffer:20*1024*1024}); + assertTrackedPayload(spec,filename.slice('package/'.length),bytes); + } } } async function pack(){ clean();const directory=resolve(need('directory'));await mkdir(directory,{recursive:true}); if((await readdir(directory)).length)throw Error('Canonical pack directory must be empty'); + // Check the complete pack list before creating any archive. git status alone ignores ignored code. + for(const spec of packageSpecs)await preflightPackage(spec); const rows=[]; for(const spec of packageSpecs){ const pkg=await json(join(root,spec.directory,'package.json'));if(pkg.name!==spec.name||pkg.version!==spec.version||pkg.private)throw Error(`Unexpected source package: ${spec.name}`); @@ -151,7 +173,7 @@ async function publish(){ // Append-only progress survives a later package failure. await save(join(resolve(need('output')),`${row.name}.json`),{schema:`${schema}.package-publication/1`,sourceSha:seal.sourceSha,...results.at(-1)}); } - await save(join(resolve(need('output')),'publication.json'),{schema:`${schema}.publication/1`,status:'passed',sourceSha:seal.sourceSha,releaseTag,sealSha256:sha256(await readFile(join(directory,'candidate-seal.json'))),packages:results}); + await save(join(resolve(need('output')),'publication.json'),{schema:`${schema}.publication/1`,status:'passed',sourceSha:seal.sourceSha,releaseTag,sealSha256:sha256(await readFile(join(directory,'candidate-seal.json'))),packages:results.map(row=>({...row,status:'public-bytes-verified'}))}); } async function publicConsumer(){ const directory=resolve(need('directory')),{seal,manifest}=await verify(directory),publication=await json(need('publication')); @@ -167,6 +189,9 @@ async function publicConsumer(){ for(const row of manifest.packages)if((await json(join(target,'node_modules',row.name,'package.json'))).version!==row.version)throw Error('Wrong public installed version'); const core=await coreConsumer(target,join(target,'core-public.json'),seal.sourceSha,env); const toolkitProof=await verifyToolkitInstallation(target,{env});validateToolkitProof(toolkitProof); + // Public acceptance is repeatable across recovery runs. Timing observations remain + // in the sealed qualification reports; this receipt records behavior and work. + delete toolkitProof.evolution.report.budget.elapsedMs; await save(need('output'),{schema:`${schema}.public-consumer/1`,status:'passed',sourceSha:seal.sourceSha,releaseTag,sealSha256:sha256(await readFile(join(directory,'candidate-seal.json'))),publicLockSha256:sha256(await readFile(join(directory,'public-package-lock.json'))),packages:manifest.packages.map(({name,version,sha256,integrity})=>({name,version,sha256,integrity})),core,toolkit:toolkitProof}); }finally{await rm(target,{recursive:true,force:true});} } @@ -178,14 +203,37 @@ async function githubRelease(){ for(const row of manifest.packages)for(const receipt of [publication,consumer])if(receipt.packages?.length!==manifest.packages.length||!receipt.packages.some(item=>item.name===row.name&&item.version===row.version&&item.sha256===row.sha256&&item.integrity===row.integrity))throw Error('Release public package evidence differs from seal'); validateCoreReceipt(consumer.core,seal.sourceSha);validateToolkitProof(consumer.toolkit);for(const row of manifest.packages)await awaitPublic(row); const receipt={schema:`${schema}.release/1`,status:'passed',sourceSha:seal.sourceSha,releaseTag,sealSha256:sha256(await readFile(join(directory,'candidate-seal.json'))),publicationSha256:sha256(await readFile(need('publication'))),publicConsumerSha256:sha256(await readFile(need('public-consumer'))),packages:manifest.packages}; - await save(need('output'),receipt); - const paths=[...seal.files.map(row=>join(directory,row.filename)),join(directory,'candidate-seal.json'),resolve(need('publication')),resolve(need('public-consumer')),resolve(need('output'))]; + const paths=[...seal.files.map(row=>join(directory,row.filename)),join(directory,'candidate-seal.json'),resolve(need('publication')),resolve(need('public-consumer'))]; + const receiptName=safeFilename(basename(need('output'))),receiptBytes=Buffer.from(JSON.stringify(receipt,null,2)+'\n'); + const expected=new Map(await Promise.all(paths.map(async path=>[basename(path),await readFile(path)])));expected.set(receiptName,receiptBytes); let existing;try{existing=JSON.parse(run('gh',['release','view',releaseTag,'--json','assets']));}catch{ run('gh',['release','create',releaseTag,...paths,'--target',seal.sourceSha,'--title','ruv-fann core 0.2.0 and WSP toolkit 0.1.0','--notes',`Thirteen exact npm archives from source ${seal.sourceSha}. Core subpaths expose bounded WSP lifecycle, search, invariants, workers, registry and constellation capabilities. Node22/24 installed consumers, real Chromium/WASM, strict types, public dependency lock and exact-byte receipts attached. No generalization or SOTA claim.`]); + existing=JSON.parse(run('gh',['release','view',releaseTag,'--json','assets'])); } if(tagCommit(releaseTag)!==seal.sourceSha)throw Error('GitHub tag source mismatch'); - if(existing&&JSON.stringify(existing.assets.map(a=>a.name).sort())!==JSON.stringify(paths.map(basename).sort()))throw Error('GitHub release asset set differs'); - const target=await mkdtemp(join(tmpdir(),'toolkit-github-public-'));try{run('gh',['release','download',releaseTag,'--dir',target]);for(const path of paths)if(sha256(await readFile(path))!==sha256(await readFile(join(target,basename(path)))))throw Error('GitHub release asset bytes differ');}finally{await rm(target,{recursive:true,force:true});} + const target=await mkdtemp(join(tmpdir(),'toolkit-github-public-')); + try{ + async function verifyExisting(assets,requireAll=false){ + const names=assets.map(row=>row.name); + if(new Set(names).size!==names.length||names.some(name=>!expected.has(name))||requireAll&&(names.length!==expected.size))throw Error('GitHub release asset set differs'); + const download=await mkdtemp(join(target,'download-')); + if(names.length)run('gh',['release','download',releaseTag,'--dir',download]); + for(const name of names)if(!expected.get(name).equals(await readFile(join(download,name))))throw Error(`Existing GitHub asset bytes differ: ${name}`); + } + // Resume a partial asset set only after every existing asset and tag passes. Never clobber. + await verifyExisting(existing.assets); + for(const path of paths)if(!existing.assets.some(row=>row.name===basename(path)))run('gh',['release','upload',releaseTag,path]); + existing=JSON.parse(run('gh',['release','view',releaseTag,'--json','assets'])); + for(const path of paths)if(!existing.assets.some(row=>row.name===basename(path)))throw Error('GitHub base asset upload incomplete'); + await verifyExisting(existing.assets); + // The passed receipt is staged only after the public base assets have been downloaded and verified. + const staged=join(target,receiptName);await writeFile(staged,receiptBytes,{flag:'wx'}); + if(!existing.assets.some(row=>row.name===receiptName))run('gh',['release','upload',releaseTag,staged]); + const final=JSON.parse(run('gh',['release','view',releaseTag,'--json','assets'])); + await verifyExisting(final.assets,true); + // No successful receipt is exposed until the complete public asset set, including this receipt, matches. + await save(need('output'),receipt); + }finally{await rm(target,{recursive:true,force:true});} } -const modes={pack,qualify,seal,verify:()=>verify(resolve(need('directory'))),publish,'public-consumer':publicConsumer,'github-release':githubRelease}; +const modes={preflight,pack,qualify,seal,verify:()=>verify(resolve(need('directory'))),publish,'public-consumer':publicConsumer,'github-release':githubRelease}; if(!modes[mode])throw Error('Unsupported toolkit release mode');await modes[mode](); diff --git a/scripts/toolkit-release-lib.mjs b/scripts/toolkit-release-lib.mjs index 068748664..6bdc0a8b5 100644 --- a/scripts/toolkit-release-lib.mjs +++ b/scripts/toolkit-release-lib.mjs @@ -71,7 +71,7 @@ export function validateQualification(receipt,sourceSha,manifestHash) { } export function validateToolkitProof(proof) { if(!proof||!['wasm','wasm-simd'].every(backend=>proof.results?.some(row=>row.backend===backend&&row.candidateMSE===0&&row.regressionRejected===true&&row.compiledXor===true&&row.rollbackRevision===3))|| - proof.evolution?.report?.promotions!==2||proof.evolution.durability?.reopened!==true||proof.evolution.durability.rollbackPersisted!==true||proof.evolution.report.workerThreadIds?.length<2|| + proof.evolution?.report?.promotions!==2||proof.evolution.durability?.reopened!==true||proof.evolution.durability.rollbackPersisted!==true||!Array.isArray(proof.evolution.report.workerThreadIds)||new Set(proof.evolution.report.workerThreadIds).size<2|| proof.constellation?.catalogEntries!==24||proof.constellation.scaffoldTests!==3)throw Error('Toolkit installation must prove both real WASM backends, concurrent durable AgentDB promotion/rollback and generated constellation tests'); } export function publicLock(candidateLock,rows) { @@ -86,7 +86,7 @@ export function publicLock(candidateLock,rows) { delete entry.inBundle; } for(const [path,entry]of Object.entries(lock.packages)) { - if(path&&entry.resolved&&(!entry.resolved.startsWith('https://registry.npmjs.org/')||entry.link))throw Error('Public lock contains a non-registry dependency'); + if(path&&(entry.link||!entry.resolved?.startsWith('https://registry.npmjs.org/')||!/^sha512-[A-Za-z0-9+/]{86}==$/.test(entry.integrity??'')))throw Error('Public lock contains a link, unpinned integrity or non-registry dependency'); } return lock; } diff --git a/scripts/toolkit-release.test.mjs b/scripts/toolkit-release.test.mjs index 6360d5dfa..a842c7cec 100644 --- a/scripts/toolkit-release.test.mjs +++ b/scripts/toolkit-release.test.mjs @@ -1,6 +1,6 @@ import test from 'node:test'; import assert from 'node:assert/strict'; -import { readFile } from 'node:fs/promises'; +import { readFile,writeFile,rm } from 'node:fs/promises'; import {execFileSync,spawnSync} from 'node:child_process'; import {packageSpecs,topologicalOrder,validateRows,validateCoreReceipt,validateQualification,validateToolkitProof,publicLock,safeFilename,sha256,integrity,tarballURL} from './toolkit-release-lib.mjs'; const sha='a'.repeat(40),manifestHash='b'.repeat(64); @@ -20,12 +20,26 @@ test('rejects unknown, skipped, zero, failed and mismatched-source qualification test('installed proof requires real SIMD and scalar Node/Chromium numerical checks, types, rollback and finite graph',()=>{validateCoreReceipt(core(),sha);for(const mutate of [r=>r.testCount=0,r=>r.skipped=1,r=>r.todo=1,r=>r.browser.realWasm=false,r=>r.browser.checks=[],r=>r.browser.pageErrors=['error'],r=>r.types.strict=false,r=>r.types.subpaths=0,r=>r.graph.finite=false,r=>r.backendChecks[0].rollbackRevision=2,r=>r.backendChecks[0].search=false]){const proof=core();mutate(proof);assert.throws(()=>validateCoreReceipt(proof,sha));}}); test('full installed toolkit proof requires actual concurrent workers and durable AgentDB reopen/rollback',()=>{validateToolkitProof(toolkit());for(const mutate of [r=>r.results=[],r=>r.results[0].candidateMSE=1,r=>r.evolution.report.workerThreadIds=[1],r=>r.evolution.report.promotions=0,r=>r.evolution.durability.reopened=false,r=>r.evolution.durability.rollbackPersisted=false,r=>r.constellation.scaffoldTests=0]){const proof=toolkit();mutate(proof);assert.throws(()=>validateToolkitProof(proof));}}); test('public lock preserves resolved transitive versions and replaces only candidate archives with SRI-bound public URLs',()=>{ - const packages=rows(),lock={name:'consumer',version:'1.0.0',lockfileVersion:3,packages:{'':{dependencies:{}},'node_modules/external':{version:'1.2.3',resolved:'https://registry.npmjs.org/external/-/external-1.2.3.tgz',integrity:'sha512-external'}}}; + const packages=rows(),lock={name:'consumer',version:'1.0.0',lockfileVersion:3,packages:{'':{dependencies:{}},'node_modules/external':{version:'1.2.3',resolved:'https://registry.npmjs.org/external/-/external-1.2.3.tgz',integrity:integrity('external')}}}; for(const row of packages)lock.packages[`node_modules/${row.name}`]={version:row.version,resolved:`file:/tmp/${row.tarball}`,integrity:row.integrity}; const result=publicLock(lock,packages);assert.equal(result.packages['node_modules/external'].version,'1.2.3');assert.equal(result.packages['node_modules/ruv-fann'].resolved,tarballURL(packages.find(r=>r.name==='ruv-fann')));assert.equal(lock.packages['node_modules/ruv-fann'].resolved.startsWith('file:'),true); lock.packages['node_modules/external'].resolved='https://hostile.test/package.tgz';assert.throws(()=>publicLock(lock,packages)); + lock.packages['node_modules/external']={link:true};assert.throws(()=>publicLock(lock,packages)); + lock.packages['node_modules/external']={version:'1.2.3',resolved:'https://registry.npmjs.org/external/-/external-1.2.3.tgz'};assert.throws(()=>publicLock(lock,packages)); }); test('archive and evidence filenames reject traversal, shell metacharacters and URLs',()=>{for(const name of ['../x.tgz','x/../x.tgz','x\\y.tgz','https://hostile/x','$(id).tgz','x\n.tgz','..'])assert.throws(()=>safeFilename(name));assert.equal(safeFilename('ruv-fann-0.2.0.tgz'),'ruv-fann-0.2.0.tgz');}); test('qualification checks out exact PR head and canonical pack precedes both runtime consumers',async()=>{const workflow=await readFile(new URL('../.github/workflows/wsp-toolkit.yml',import.meta.url),'utf8');assert.match(workflow,/ref: \$\{\{ github.event.pull_request.head.sha \|\| inputs.expected_sha \|\| github.sha \}\}/);assert.equal((workflow.match(/toolkit-release-lane.mjs pack /g)??[]).length,1);assert.equal((workflow.match(/toolkit-release-lane.mjs qualify /g)??[]).length,2);assert.match(workflow,/toolkit-candidate-\$\{\{ github.event.pull_request.head.sha/);}); test('protected publisher selects successful upstream artifact and explicitly uses existing NPM_TOKEN, never source rebuild',async()=>{const workflow=await readFile(new URL('../.github/workflows/protected-toolkit-release.yml',import.meta.url),'utf8');assert.match(workflow,/secrets.NPM_TOKEN/);assert.match(workflow,/toolkit-candidate-download.mjs --expected-sha/);assert.doesNotMatch(workflow,/toolkit-release-lane.mjs (pack|qualify|seal) /);assert.match(workflow,/id-token: write/);assert.match(workflow,/toolkit-release-lane.mjs public-consumer/);assert.match(workflow,/toolkit-release-lane.mjs github-release/);}); test('actual downloader rejects foreign or local context before gh download',()=>{const result=spawnSync(process.execPath,[new URL('./toolkit-candidate-download.mjs',import.meta.url).pathname,'--expected-sha',sha,'--output','/tmp/never-download-toolkit'],{encoding:'utf8',env:{...process.env,GITHUB_ACTIONS:'false'},timeout:10000});assert.notEqual(result.status,0);assert.match(result.stderr,/Exact protected upstream main context required/);}); +test('ignored JavaScript payload cannot enter a pack even when git status is clean',async()=>{ + const path=new URL('../packages/core/src/release-provenance-probe.tmp',import.meta.url); + try{ + await writeFile(path,'export const ignoredPayload = true;\n',{flag:'wx'}); + const root=new URL('..',import.meta.url); + execFileSync('git',['check-ignore','packages/core/src/release-provenance-probe.tmp'],{cwd:root,stdio:'pipe'}); + const listing=JSON.parse(execFileSync('npm',['pack','--dry-run','--json','--ignore-scripts'],{cwd:new URL('../packages/core/',import.meta.url),encoding:'utf8'})); + assert.ok(listing[0].files.some(row=>row.path==='src/release-provenance-probe.tmp'),'negative fixture must actually be included by npm pack'); + const result=spawnSync(process.execPath,[new URL('./toolkit-release-lane.mjs',import.meta.url).pathname,'preflight','--package','ruv-fann'],{encoding:'utf8',timeout:10000}); + assert.notEqual(result.status,0);assert.match(result.stderr,/Package payload is not tracked at source HEAD/); + }finally{await rm(path,{force:true});} +}); From bf9139e266f673f0735cde12af3d8114085eeb68 Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 23:06:28 -0500 Subject: [PATCH 15/20] test(release): reproduce ignored JavaScript inclusion without changing ignore files --- scripts/toolkit-release.test.mjs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/toolkit-release.test.mjs b/scripts/toolkit-release.test.mjs index a842c7cec..04d2800ff 100644 --- a/scripts/toolkit-release.test.mjs +++ b/scripts/toolkit-release.test.mjs @@ -1,6 +1,8 @@ import test from 'node:test'; import assert from 'node:assert/strict'; -import { readFile,writeFile,rm } from 'node:fs/promises'; +import { readFile,writeFile,rm,mkdtemp } from 'node:fs/promises'; +import {join} from 'node:path'; +import {tmpdir} from 'node:os'; import {execFileSync,spawnSync} from 'node:child_process'; import {packageSpecs,topologicalOrder,validateRows,validateCoreReceipt,validateQualification,validateToolkitProof,publicLock,safeFilename,sha256,integrity,tarballURL} from './toolkit-release-lib.mjs'; const sha='a'.repeat(40),manifestHash='b'.repeat(64); @@ -32,14 +34,17 @@ test('qualification checks out exact PR head and canonical pack precedes both ru test('protected publisher selects successful upstream artifact and explicitly uses existing NPM_TOKEN, never source rebuild',async()=>{const workflow=await readFile(new URL('../.github/workflows/protected-toolkit-release.yml',import.meta.url),'utf8');assert.match(workflow,/secrets.NPM_TOKEN/);assert.match(workflow,/toolkit-candidate-download.mjs --expected-sha/);assert.doesNotMatch(workflow,/toolkit-release-lane.mjs (pack|qualify|seal) /);assert.match(workflow,/id-token: write/);assert.match(workflow,/toolkit-release-lane.mjs public-consumer/);assert.match(workflow,/toolkit-release-lane.mjs github-release/);}); test('actual downloader rejects foreign or local context before gh download',()=>{const result=spawnSync(process.execPath,[new URL('./toolkit-candidate-download.mjs',import.meta.url).pathname,'--expected-sha',sha,'--output','/tmp/never-download-toolkit'],{encoding:'utf8',env:{...process.env,GITHUB_ACTIONS:'false'},timeout:10000});assert.notEqual(result.status,0);assert.match(result.stderr,/Exact protected upstream main context required/);}); test('ignored JavaScript payload cannot enter a pack even when git status is clean',async()=>{ - const path=new URL('../packages/core/src/release-provenance-probe.tmp',import.meta.url); + const path=new URL('../packages/core/src/release-provenance-probe.js',import.meta.url),temp=await mkdtemp(join(tmpdir(),'toolkit-ignored-source-')); try{ + const excludes=join(temp,'excludes');await writeFile(excludes,'release-provenance-probe.js\n'); + // Per-process Git excludes reproduce ignored code without changing the user's ignore files. + const env={...process.env,GIT_CONFIG_COUNT:'1',GIT_CONFIG_KEY_0:'core.excludesFile',GIT_CONFIG_VALUE_0:excludes}; await writeFile(path,'export const ignoredPayload = true;\n',{flag:'wx'}); const root=new URL('..',import.meta.url); - execFileSync('git',['check-ignore','packages/core/src/release-provenance-probe.tmp'],{cwd:root,stdio:'pipe'}); - const listing=JSON.parse(execFileSync('npm',['pack','--dry-run','--json','--ignore-scripts'],{cwd:new URL('../packages/core/',import.meta.url),encoding:'utf8'})); - assert.ok(listing[0].files.some(row=>row.path==='src/release-provenance-probe.tmp'),'negative fixture must actually be included by npm pack'); - const result=spawnSync(process.execPath,[new URL('./toolkit-release-lane.mjs',import.meta.url).pathname,'preflight','--package','ruv-fann'],{encoding:'utf8',timeout:10000}); + execFileSync('git',['check-ignore','packages/core/src/release-provenance-probe.js'],{cwd:root,stdio:'pipe',env}); + const listing=JSON.parse(execFileSync('npm',['pack','--dry-run','--json','--ignore-scripts'],{cwd:new URL('../packages/core/',import.meta.url),encoding:'utf8',env})); + assert.ok(listing[0].files.some(row=>row.path==='src/release-provenance-probe.js'),'negative fixture must actually be included by npm pack'); + const result=spawnSync(process.execPath,[new URL('./toolkit-release-lane.mjs',import.meta.url).pathname,'preflight','--package','ruv-fann'],{encoding:'utf8',timeout:10000,env}); assert.notEqual(result.status,0);assert.match(result.stderr,/Package payload is not tracked at source HEAD/); - }finally{await rm(path,{force:true});} + }finally{await rm(path,{force:true});await rm(temp,{recursive:true,force:true});} }); From b4d85e72f7a3a72961cdbe44d3f9ea09e608a494 Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 23:08:07 -0500 Subject: [PATCH 16/20] docs: illustrate bounded proposal gates and revision authority --- docs/assets/wsp-toolkit-loop.svg | 60 ++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 docs/assets/wsp-toolkit-loop.svg diff --git a/docs/assets/wsp-toolkit-loop.svg b/docs/assets/wsp-toolkit-loop.svg new file mode 100644 index 000000000..f9c6dc5bb --- /dev/null +++ b/docs/assets/wsp-toolkit-loop.svg @@ -0,0 +1,60 @@ + + Bounded ruv-fann weight evolution: propose, independently validate, commit and roll back + Three fixed-operation Node workers receive development data and return proposals. A coordinator keeps holdout data and finite-domain invariants separate, then requests an AgentDB proposal and expected-revision compare-and-swap. An explicit rollback creates a new revision containing the old weights. Worker results never authorize promotion. This conceptual illustration stops animating after four seconds. + + + + + + + + + RUV-FANN · BOUNDED WEIGHT EVOLUTION + Many proposals. One accountable change. + Workers explore. Independent gates check. Your revision authority decides. + + + 01 / PROPOSE + + Δw + Fixed-operation workers + Development inputs only + + + + + 02 / CHECK + + + Held-out suitesFinite-domain rules + Independent evaluation + Real WASM · explicit budgets + + + + + 03 / COMMIT + + + r1 → r2 + AgentDB revision CAS + Stored proposal + expected r1 + + + + + 04 / RECOVER + + r3 + Explicit rollback + Old weights · new revision + + + + + A worker result is a candidate. A passing check is evidence. Promotion is a separate action. + LOCAL COMPUTE · FINITE TESTED DOMAINS · CALLER-OWNED AUTHORITY + EXPLORE THE FIELD GUIDE ↗ + From e573ed708dcc4a5705990f3a8991deaefcf8be74 Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 23:09:02 -0500 Subject: [PATCH 17/20] docs: explain toolkit packages, evaluation boundaries and protected releases --- README.md | 38 ++++- docs/adr/ADR-012-weight-toolkit-release.md | 33 +++++ docs/constellation-design.md | 20 ++- docs/constellation-release.md | 74 +++------- docs/constellation.md | 24 +-- packages/wsp-toolkit/README.md | 138 ++++++++++++------ packages/wsp-toolkit/docs/design.md | 4 +- packages/wsp-toolkit/docs/loop-design.md | 14 +- packages/wsp-toolkit/docs/loop-validation.md | 16 +- packages/wsp-toolkit/docs/validation.md | 8 +- .../wsp-toolkit/packages/cloudflare/README.md | 14 +- .../packages/constellation/README.md | 16 +- .../wsp-toolkit/packages/contracts/README.md | 16 +- .../packages/huggingface/README.md | 16 +- .../wsp-toolkit/packages/invariants/README.md | 18 ++- .../wsp-toolkit/packages/lifecycle/README.md | 14 +- packages/wsp-toolkit/packages/loop/README.md | 16 +- .../wsp-toolkit/packages/registry/README.md | 14 +- packages/wsp-toolkit/packages/ruos/README.md | 14 +- .../wsp-toolkit/packages/search/README.md | 18 ++- packages/wsp-toolkit/packages/swarm/README.md | 16 +- .../wsp-toolkit/packages/telemetry/README.md | 16 +- 22 files changed, 416 insertions(+), 141 deletions(-) create mode 100644 docs/adr/ADR-012-weight-toolkit-release.md diff --git a/README.md b/README.md index 8ad79f689..0b4fc5995 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# ruv-FANN +# ruv-FANN — neural networks, WebAssembly and weight-space programming -Small neural networks you can train, inspect and edit in Rust, Node.js and the browser. The repository also contains separate forecasting, agent, GPU-compute and image-processing projects. +Small neural networks you can train, inspect and edit in Rust, JavaScript, TypeScript and the browser. Add bounded weight search, independent model evaluation, finite-domain checks and explicit AgentDB revisions. The repository also contains separate forecasting, agent, GPU-compute and image-processing projects. [![See the weights. Prove the change. An illustrated guide to inspecting a network, editing a weight and evaluating the result.](docs/assets/weight-space-story.svg)](https://ruvnet.github.io/ruv-FANN/) @@ -10,7 +10,7 @@ Small neural networks you can train, inspect and edit in Rust, Node.js and the b [![API documentation](https://docs.rs/ruv-fann/badge.svg)](https://docs.rs/ruv-fann) [![CI](https://github.com/ruvnet/ruv-FANN/actions/workflows/ci.yml/badge.svg)](https://github.com/ruvnet/ruv-FANN/actions/workflows/ci.yml) -**For Rust, start with the `ruv-fann` crate. For JavaScript and TypeScript, start with the `ruv-fann` npm package.** Add `ruv-fann-wsp` when you want to propose direct weight edits, inspect what changed, and explicitly evaluate and version the result. The Rust core provides generic floating-point networks, training algorithms and model I/O inspired by [FANN](https://github.com/libfann/fann). +**For Rust, start with the `ruv-fann` crate. For JavaScript and TypeScript, start with the `ruv-fann` npm package.** Core npm 0.2.0 exposes the weight toolkit through explicit `ruv-fann/*` subpaths. Choose standalone `ruv-fann-wsp` for a smaller weight-editing installation, or individual toolkit packages for focused integrations. The Rust core provides generic floating-point networks, training algorithms and model I/O inspired by [FANN](https://github.com/libfann/fann). ![Repository map: five independent Rust workspaces for neural networks, agent tools, forecasting, CUDA source translation and image processing.](docs/assets/package-map.svg) @@ -19,7 +19,8 @@ Small neural networks you can train, inspect and edit in Rust, Node.js and the b | Location | Available behavior | Version / guide | | --- | --- | --- | | `packages/wsp/` | **`ruv-fann-wsp`**: inspect and trace models, build bounded weight patches, evaluate candidates, then promote or roll back | Published npm **[0.2.0](https://www.npmjs.com/package/ruv-fann-wsp)** · [WSP guide](packages/wsp/README.md) · [Interactive story](https://ruvnet.github.io/ruv-FANN/) | -| `packages/core/` | **`ruv-fann` for JavaScript/TypeScript**: typed dense models, reusable WASM batch inference, SGD and AdamW training | Published npm **[0.1.2](https://www.npmjs.com/package/ruv-fann)** · [JavaScript guide](packages/core/README.md) | +| `packages/core/` | **`ruv-fann` for JavaScript/TypeScript**: WASM inference/training plus fourteen explicit toolkit subpaths | npm release **[0.2.0](https://www.npmjs.com/package/ruv-fann)** · [JavaScript guide](packages/core/README.md) | +| `packages/wsp-toolkit/` | Twelve focused packages: bounded search, holdout gates, invariants, worker proposals, AgentDB authority, Hub/Workers adapters and constellation tools | **0.1.0** each · [Toolkit guide](packages/wsp-toolkit/README.md) · [Umbrella release](https://github.com/ruvnet/ruv-FANN/releases/tag/ruv-fann-toolkit-v0.2.0) | | `packages/wasm/` | **`ruv-fann-wasm`**: direct WASM bindings, bundled runtime binaries and SIMD detection | Published npm **[0.1.2](https://www.npmjs.com/package/ruv-fann-wasm)** · [Runtime guide](packages/wasm/README.md) | | Repository root | **`ruv-fann` for Rust**: train feedforward networks, prepare immutable CPU inference snapshots, and use optional WebGPU operations | Checkout `0.2.2` · [Crate](https://crates.io/crates/ruv-fann) · [Core example](examples/basic_usage.rs) · [API](https://docs.rs/ruv-fann) | | `integrations/candle/` | Import actual Candle CPU linear layers and compare training gradients/SGD/AdamW with Candle | `ruv-fann-candle 0.1.0` · [Candle guide](integrations/candle/README.md) | @@ -90,6 +91,35 @@ and 24, real Chromium checks, and 19 adversarial input checks. See the [field guide](https://ruvnet.github.io/ruv-FANN/) for an illustrated explanation of those results and their limits. +## Bounded weight improvement with independent evaluation + +[![Workers propose weight edits, independent holdout and finite-domain gates check candidates, and AgentDB controls revision CAS and explicit rollback.](https://raw.githubusercontent.com/ruvnet/ruv-FANN/main/docs/assets/wsp-toolkit-loop.svg)](https://ruvnet.github.io/ruv-FANN/) + +**[Explore the animated field guide →](https://ruvnet.github.io/ruv-FANN/)** + +The toolkit extends local weight editing into a bounded proposal/evaluation loop. Node.js workers explore development cases, while the coordinator keeps holdouts and output constraints separate. A passing candidate is re-proposed through the supplied authority and activated only with an expected-revision comparison. Rollback creates a new revision containing the chosen old weights. + +```sh +npm install ruv-fann@0.2.0 +``` + +| Need | Core import | Individual package | +| --- | --- | --- | +| Inspect weights and trace activations | `ruv-fann/wsp` | `ruv-fann-wsp@0.2.0` | +| Search a bounded parameter set | `ruv-fann/search` | `ruv-fann-wsp-search@0.1.0` | +| Test named independent datasets | `ruv-fann/lifecycle` | `ruv-fann-wsp-lifecycle@0.1.0` | +| Check finite-domain output constraints | `ruv-fann/invariants` | `ruv-fann-wsp-invariants@0.1.0` | +| Coordinate workers and bounded generations | `ruv-fann/swarm`, `ruv-fann/loop` | `ruv-fann-wsp-swarm`, `ruv-fann-wsp-loop` | +| Serialize AgentDB revisions and acknowledge persistence | `ruv-fann/registry` | `ruv-fann-wsp-registry@0.1.0` | +| Load a pinned checkpoint or build a stateless edge handler | `ruv-fann/huggingface`, `ruv-fann/cloudflare` | Hub and Cloudflare adapters | +| Plan packages, validate metadata and render observations | `ruv-fann/constellation`, `ruv-fann/contracts`, `ruv-fann/telemetry` | Three constellation packages | + +Read the [complete runnable rejection→gate→promotion example](packages/wsp-toolkit/README.md#repair-xor-gate-it-independently-and-choose-a-revision), the [core environment matrix](packages/core/README.md#capability-entrypoints), or run the source toolkit's `npm run demo:loop` for actual AgentDB reopen and rollback. The complete facade installs the toolkit, including its build tooling; individual packages provide smaller dependency footprints. Existing satellite pins intentionally retain a nested core 0.1.2 runtime. AgentDB is separately installed and owned by the application. + +The loop does not call an LLM provider, execute generated code or publish packages. Worker threads are execution contexts, not security sandboxes; finite-domain tests and hashes do not establish universal safety or generalization. Release publication is a separate protected workflow that verifies exact archives and public installations. + +**Topics:** Rust neural networks · JavaScript machine learning · TypeScript · WebAssembly SIMD · weight-space programming · model evaluation · neural weight search · AgentDB persistence · Cloudflare Workers. + ## Try the neural-network core Install [Rust](https://www.rust-lang.org/tools/install), then run the included example: diff --git a/docs/adr/ADR-012-weight-toolkit-release.md b/docs/adr/ADR-012-weight-toolkit-release.md new file mode 100644 index 000000000..a47205cfe --- /dev/null +++ b/docs/adr/ADR-012-weight-toolkit-release.md @@ -0,0 +1,33 @@ +# ADR-012: Core capability facade and exact-archive toolkit publication + +Status: Implemented source architecture; publication outcome requires current receipts. +Date: 2026-11-11. Updated: 2026-11-11. +Related: [toolkit delivery contract](../../packages/wsp-toolkit/docs/design.md), [loop architecture](../../packages/wsp-toolkit/docs/loop-design.md), [release setup](../constellation-release.md). + +## Context + +The standalone WSP package provides bounded weight edits and local revisions. Twelve additional packages add search, independent regression suites, finite-domain checks, actual Node workers, caller-owned AgentDB authority, checkpoint transport and package-discovery tools. Applications need a discoverable core entrypoint while existing published dependency contracts and browser inference remain stable. + +A local passing checkout cannot establish that a package's public bytes match the reviewed source. New package identities also need a practical bootstrap publisher without silently replacing the already-working WSP publication contract or claiming unconfigured npm trusted publishers. + +## Decision + +Publish `ruv-fann@0.2.0` as a facade with fourteen explicit typed capability subpaths. Preserve the root inference/training entrypoint without eagerly importing Node workers, filesystem tooling or build integrations. Install exact dependencies for the complete facade; keep independently installable satellites for smaller footprints. The complete install includes Cloudflare's esbuild toolchain. AgentDB remains optional and caller-owned. + +Retain published WSP/satellite pins to core 0.1.2. This is a finite versioned graph: legacy core depends only on WASM 0.1.2 and never imports the new facade. Browser import maps preserve that resolution with scopes. Do not rewrite old dependency contracts to create a same-version cycle. + +Release core plus the twelve satellites under GitHub tag `ruv-fann-toolkit-v0.2.0`, with satellite versions 0.1.0. A new protected toolkit lane packs thirteen archives once, binds qualification to exact source/archive digests and requires successful actual installed-consumer checks on Node.js 22/24 and Chromium. Dependency-ordered publication carries those exact archives without rebuilding, then verifies public bytes and fresh installed behavior before reporting completion. + +Preserve the existing WSP token publisher. Bootstrap the new packages with the existing protected npm credential. The optional OIDC configuration helper is a future opt-in path requiring independently registered package-specific publishers; helper validation is not proof of a live npm identity exchange. Declared catalog `published` status is metadata, not namespace ownership or registry verification. + +## Runtime and authority boundaries + +Proposal workers execute fixed shipped operations on development cases. Independent holdouts and finite-domain invariants remain with the coordinator. An accepted detached evaluation is evidence, not authority. A fresh stored proposal and expected-revision CAS authorize the caller's explicit promotion. Rollback increases revision while restoring selected old content. Live-record revision checks and captured capabilities protect asynchronous authority boundaries. + +Search objectives are trusted synchronous callbacks. Promise-returning objectives reject without leaving unhandled rejections. Actual AbortSignal state must survive shadowing of instance properties. Hub deadlines cover streamed response bodies. The private test/demo AgentDB fixture selects sql.js before import to make persistence-failure oracles reproducible; the published adapter never changes the host's environment or selects its database backend. + +## Evidence and consequences + +Qualification must use real numerical oracles, malformed-input regressions, strict declarations, browser/edge/worker scenarios where applicable, actual AgentDB reopen/fault cases and archive mutation failures. Zero tests, skips, todos, dirty lineage, missing source bindings or unsuccessful public installs cannot become a passing release. Current counts and publication outcomes are supplied by the final workflow receipts; no historical evidence file is rewritten to describe a newer generation. + +The root import remains browser-compatible, but the complete npm installation grows to include toolkit/build dependencies and nested legacy core copies. Node-only subpaths stay explicit. Tests support finite stated domains, not universal safety or generalization. No physical GPU throughput, hosted Worker deployment, LLM-provider optimization or autonomous package-publication capability is implied by this decision. diff --git a/docs/constellation-design.md b/docs/constellation-design.md index 71999c0ec..efcb9a0ee 100644 --- a/docs/constellation-design.md +++ b/docs/constellation-design.md @@ -1,25 +1,27 @@ -# Growth constellation implementation contract +# Constellation discovery, metadata and release contract + +Status: Implemented source architecture. Updated: 2026-11-11. Publication outcomes require current exact-source receipts. ## Outcome and acceptance -Extend the local WSP toolkit into a concrete constellation reference: a lightweight discover/plan/scaffold CLI, dependency-free shared module/contracts metadata, an explicit catalog with verified public anchors and local candidates, a standalone interactive telemetry dashboard, deterministic README cross-links, and a genuinely tokenless OIDC path for the existing protected WSP release. Preserve previous uncommitted work and package names. No registry publication, scope claim, remote repository change or scheduled collection is performed by this task. +Extend the local WSP toolkit into a concrete constellation reference: a lightweight discover/plan/scaffold CLI, dependency-free shared module/contracts metadata, an explicit versioned catalog with declared release identities, a standalone interactive telemetry dashboard, deterministic README cross-links, and a protected thirteen-package toolkit release lane. Preserve existing package names and the existing WSP token publisher. Future package-specific OIDC is opt-in and requires external registration. No namespace claim or scheduled collection is implicit in the implementation. -Acceptance: a fresh packed consumer runs the onramp without pulling an ML stack; scaffolds a package in a new temporary directory; runs its built-in checks; the telemetry aggregator handles a real public cohort and an explicit local adoption sample without inventing attach rates; its HTML works in Chromium; the existing release's source/archive checks remain intact while token fallback is eliminated; all existing toolkit tests and new contract/security checks pass. +Acceptance: a fresh packed consumer runs the onramp without pulling an ML stack; scaffolds a package in a new temporary directory; runs its built-in checks; the telemetry aggregator handles a real public cohort and an explicit local adoption sample without inventing attach rates; its HTML works in Chromium; the existing WSP release remains intact; the new publisher carries exact core/satellite archives and verifies public installations. Current qualification receipts must establish passing tests rather than this design document claiming them. ## Ownership - Onramp worker: `packages/wsp-toolkit/packages/contracts/**` and `packages/wsp-toolkit/packages/constellation/**`, EXCEPT `packages/constellation/catalog.json` owned by coordinator. Packages `ruvnet-constellation-contracts@0.1.0` and `ruvnet-constellation@0.1.0`. - Telemetry worker: `packages/wsp-toolkit/packages/telemetry/**` only. Package `ruvnet-constellation-telemetry@0.1.0`. -- Release worker: `.github/workflows/protected-wsp-release.yml`, `scripts/wsp-release-lane.mjs`, new `scripts/constellation-oidc.mjs`, `scripts/constellation-oidc.test.mjs`, `docs/constellation-release.md` only. +- Release lane: protected toolkit publication, source/archive seals, installed-consumer qualification and public verification. Existing WSP publication is preserved; `scripts/constellation-oidc.mjs` and its tests remain optional future publisher-configuration support. - Coordinator: catalog.json, root manifests/lockfiles, root integration/CLI/report/readme scripts, toolkit E2E/browser/type tests, other documentation/qualification workflow. Workers own their source/declarations/README/LICENSE/package manifest/tests; no root lockfile edits. New packages ESM, src/index.js and src/index.d.ts, version0.1.0, Node20.9+ (qualification Node22.13+). Dependency-free contracts and telemetry; CLI depends only on contracts0.1.0. No lifecycle install hooks or default data collection. ## Catalog and contract -Catalog schema `ruvnet.constellation-catalog/1` has `{schema, repository:'ruvnet/ruv-FANN', packages:[...], profiles:[...]}`. Package record is `{name, role:'nucleus'|'primitive'|'satellite', family, status:'published'|'candidate', version, repository:'owner/repo', directory?:relativeRepoPath, description, contracts?:string[], links?:{npm?:httpsURL,source?:httpsURL}, proposedScope?:string}`. Only verified actual public names have status published. Candidate means local source, not a claim about npm ownership/existence. Unique names, bounded counts<=1000, safe names/paths and explicit schema IDs. No renaming published packages or adding irrelevant peer dependencies to manufacture volume. +Catalog schema `ruvnet.constellation-catalog/1` has `{schema, repository:'ruvnet/ruv-FANN', packages:[...], profiles:[...]}`. Package record is `{name, role:'nucleus'|'primitive'|'satellite', family, status:'published'|'candidate', version, repository:'owner/repo', directory?:relativeRepoPath, description, contracts?:string[], links?:{npm?:httpsURL,source?:httpsURL}, proposedScope?:string}`. `published` is a declared catalog release/planning status; it does not independently query a registry or establish npm ownership. Candidate means local source and remains separate from public install specs. Current observations and exact publication receipts establish actual availability. Unique names, bounded counts<=1000, safe names/paths and explicit schema IDs. No renaming published packages or adding irrelevant peer dependencies to manufacture volume. -Profile record `{id,description,packages:string[]}`; allow only known catalog package names. CLI planning returns package specs/links/availability, does not install them. Catalog lives in CLI package as `catalog.json`, coordinator will populate it. Actual public anchors include metaharness0.4.23, @metaharness/router0.4.1, @claude-flow/cli3.25.6 validated pin (registry latest observed3.75.3), ruflo3.75.3, ruvector0.3.24, agentdb3.10.0, agentic-flow3.5.4, @ruvector/attention2.3.1, @ruvector/ruvllm4.2.2, ruv-fann-wsp0.2.0, ruv-fann0.1.2, ruv-fann-wasm0.1.2. @metaharness/cli returns404 and is not listed as published. +Profile record `{id,description,packages:string[]}`; allow only known catalog package names. CLI planning returns package specs/links/availability, does not install them. Catalog lives in CLI package as `catalog.json`, coordinator will populate it. The historical anchor observations included metaharness0.4.23, @metaharness/router0.4.1, @claude-flow/cli3.25.6 validated pin (registry latest observed3.75.3), ruflo3.75.3, ruvector0.3.24, agentdb3.10.0, agentic-flow3.5.4, @ruvector/attention2.3.1, @ruvector/ruvllm4.2.2, ruv-fann-wsp0.2.0, ruv-fann0.1.2 and ruv-fann-wasm0.1.2. The current release catalog advances the core facade to0.2.0 and declares the twelve satellites0.1.0; earlier observations do not verify those new public bytes. @metaharness/cli returns404 and is not listed as published. Contracts library exports CONTRACTS exact IDs (model dense-layers/1, patch weight-patch/1, evaluation weight-evaluation/1, module ruvnet.constellation-module/1), `validateCatalog(catalog)` returning owned validated data, and `validateModuleManifest({schema:'ruvnet.constellation-module/1',name,version,role,contracts,integrations:string[]})`. Include JSON schemas for module manifest/catalog and references to canonical existing WSP formats; schema/metadata validation does not replace real WSP numerical validation. Strict plain data, bounds, unknown fields/accessors/unsafe paths refusal, snapshots. No SDK/network dependencies. @@ -37,9 +39,11 @@ Optional adoption schema `{schema:'ruvnet.constellation-adoption/1',consent:true `renderConstellationDashboard(report)` returns self-contained HTML with family/role/search/period controls, package table/trend visualization, repository issue signal, candidate/unavailable states, source/coverage labels and attach explanation. Use no external JS/fonts/trackers, escape all untrusted fields/embedded JSON, textContent for dynamic data, safe links only. Browser errors/XSS regression and controls must be tested with actual Chromium by coordinator. A locally generated dashboard is the deliverable; no hosting operation is implicit. -## Release changes +## Release architecture + +The existing WSP token publisher remains unchanged. The separate `protected-toolkit-release.yml` lane bootstraps thirteen packages through the existing protected npm credential, enforces exact source/current-main/archive bindings, publishes in dependency order and verifies public bytes and fresh installed consumers. New core0.2.0 exposes fourteen explicit subpaths while existing WSP/satellite core0.1.2 pins remain a finite nested dependency graph. -Official npm docs currently require npm>=11.5.1 and Node>=22.14.0 for trusted publishing. Existing workflow grants id-token:write but injects NPM_TOKEN, and existing WSP publisher refuses missing NODE_AUTH_TOKEN. Remove token requirement/fallback for this protected lane, keep exact-main/source/archive/provenance checks, add explicit runtime/OIDC-context checks and pin supported Node/npm versions. No live publish or trusted-publisher configuration change. Record npm per-package trusted publisher owner/repository/workflow/environment setup as external prerequisite; inability to verify it is not success. Do not assume scoped names establish enterprise trust or replace dependency review. +The OIDC helper is available only as a future opt-in path. Every selected package needs a separately verified trusted-publisher registration matching the reviewed repository/workflow/environment and permitted operation. Configuration tests do not establish a live OIDC upload or package namespace control. See [release setup](constellation-release.md) and [ADR-012](adr/ADR-012-weight-toolkit-release.md). ## Evidence boundaries diff --git a/docs/constellation-release.md b/docs/constellation-release.md index a4dd70162..3297671fb 100644 --- a/docs/constellation-release.md +++ b/docs/constellation-release.md @@ -1,64 +1,38 @@ -# Tokenless trusted publishing for constellation packages +# Protected npm publication for the ruv-fann toolkit -The protected WSP release now uses npm's GitHub OIDC path without a long-lived npm token fallback. This changes repository code only. No npm name, scope, publisher registration, GitHub environment or release was created or changed, and no live publish was attempted. +Status: Implemented release architecture; publication is established separately by exact-source receipts. Updated: 2026-11-11. -## Existing WSP lane +The `ruv-fann-toolkit-v0.2.0` release contains thirteen new npm archives: `ruv-fann@0.2.0` and twelve toolkit packages at `0.1.0`. Existing `ruv-fann-wsp@0.2.0`, `ruv-fann@0.1.2` and `ruv-fann-wasm@0.1.2` remain published dependencies. The toolkit lane does not rebuild or republish those earlier releases. -The publication entry point remains [protected-wsp-release.yml](../.github/workflows/protected-wsp-release.yml), with workflow name `protected-release`, job `publish`, a manual exact-SHA input and the upstream main-branch restriction. Its toolchain is pinned to Node `24.22.1` and npm `11.9.0`. npm is installed into a runner-temporary prefix without lifecycle scripts; the release PATH selects that explicit CLI. Official npm documentation currently requires npm `11.5.1+` and Node `22.14.0+` for trusted publishing. +## Two separate publishers -The protected script retains the existing checks: +| Lane | Scope | Authentication | +| --- | --- | --- | +| [protected-wsp-release.yml](../.github/workflows/protected-wsp-release.yml) | Existing standalone WSP release contract | Existing `NPM_TOKEN` publisher is preserved | +| [protected-toolkit-release.yml](../.github/workflows/protected-toolkit-release.yml) | Core facade plus twelve toolkit archives | Existing protected npm credential bootstraps the new packages | +| [constellation-oidc.mjs](../scripts/constellation-oidc.mjs) | Optional future configuration guard | Requires deliberately opted-in, package-specific npm trusted-publisher registration | -- The checkout, reviewed input, GitHub SHA, workflow ref and current upstream main must agree. -- Open `release-blocker` issues prevent publication. -- Only the successful qualification run's exact artifact is downloaded. -- The source-bound seal, tarball SHA-256/SHA-512, Node 22/24 receipts, browser proof, mutation checks, benchmark and dependency audit are revalidated. -- npm receives the exact verified archive bytes, copied into a private temporary publication directory without repacking, plus `--ignore-scripts --access public --provenance` and the fixed public registry. -- Public bytes are downloaded and compared; an already published version is accepted only when its bytes match. Public installation and GitHub release-asset checks still run afterward. +A package's catalog status, a successful local pack or possession of the helper does not establish namespace ownership, a registered trusted publisher or permission to upload. The optional OIDC helper is not the active bootstrap publisher, and this documentation does not claim a live OIDC exchange. -[scripts/constellation-oidc.mjs](../scripts/constellation-oidc.mjs) adds a reusable, side-effect-free configuration guard. It requires the expected repository, workflow filename/name, branch, job, dispatch event, reviewed SHA and matching checkout; supported stable Node/npm versions; and the GitHub Actions OIDC request URL/capability. A fork, PR event, different job, missing OIDC permission, stale checkout or npm credential fallback fails before npm can publish. Error messages never include credential values. +## Exact archives move through qualification and publication -Environment strings are not an identity attestation. The helper reports `configuration-validated`, and npm must still obtain the actual GitHub token and match its claims against the package's registered trusted publisher. An identical-existing-version receipt can succeed without issuing any new OIDC upload. The receipt records `oidc-only` policy and whether it verified existing bytes or published/recovered an upload; it does not invent an OIDC exchange proof. +1. Review one immutable source SHA. Qualification packs all thirteen packages once and records their identities and archive digests. +2. Install those exact archives into fresh consumers. Require actual Node.js 22/24 behavior, strict TypeScript declarations, real Chromium/WASM checks, applicable worker/workerd/AgentDB cases, source-bound security checks and zero failed, skipped or todo tests. +3. Seal the exact candidate archives and required receipts together. A passing source checkout alone is insufficient; a receipt from an older generation does not qualify the candidate. +4. Merge the unchanged qualified SHA to upstream `main`. The protected manual publisher checks the input SHA, checkout, GitHub context, current upstream main and open `release-blocker` issues before using the successful qualification artifact. +5. Revalidate the seal and publish in dependency order, with the core facade after its new dependencies. Publish the carried archive bytes without repacking. An existing registry version is accepted only if its bytes match the sealed candidate; a different archive is a release failure, not a reason to overwrite it. +6. Download every public archive, compare it with the seal and repeat fresh installed-consumer qualification. Attach archives, checksums and publication evidence to the umbrella GitHub release. Publication without successful post-install verification remains incomplete. -The child npm process runs outside the checkout with controlled project, user and global `.npmrc` files and a fresh cache. Its environment omits npm auth values and inherited GitHub API tokens while retaining the short-lived Actions OIDC capability, proxy configuration and CA trust. The parent still uses the job's GitHub token for read-only source/blocker/artifact checks and the later release step. Auth files and environment objects are never written to receipts or logs. +The release controller, not a local shell, performs privileged registry and GitHub release writes. Logs and receipts must not contain npm credentials or secret values. Do not weaken source, archive, blocker or consumer checks to get past an authentication or registry failure. -## Required external npm setup +## Optional future trusted publishing -An authorized package owner must configure and verify the package's trusted-publisher relationship on npm before this lane can make a new upload. This task did not inspect or assert that registration. +An authorized package owner may separately register an npm GitHub Actions trusted publisher for each package. The registration must match the exact owner/repository, workflow filename, any environment and allowed operation. Bootstrap and namespace requirements must be verified independently for new packages. See the official [npm trusted publisher documentation](https://docs.npmjs.com/trusted-publishers/). -For the current WSP package, the registration must match: +The OIDC helper checks reviewed configuration, GitHub event/job/source constraints, supported toolchain and the short-lived Actions capability. A `configuration-validated` result is not an identity attestation or proof that npm accepted an OIDC upload. Source changes that opt a package into this path require review and the same artifact/public-install contract. There is no automatic fallback that silently changes a package's chosen publisher policy. -| npm field | Expected value | -| --- | --- | -| CI/CD provider | GitHub Actions on a GitHub-hosted runner | -| Organization or user | `ruvnet` | -| Repository | `ruv-FANN` | -| Workflow filename | `protected-wsp-release.yml` (filename only) | -| Environment name | None is declared by this workflow; any configured environment must agree with a deliberately reviewed job configuration | -| Allowed actions | Direct `npm publish` must be permitted; permission for staged publishing alone does not enable this command | +## Catalog declarations and public availability -The package's `repository.url` must match the upstream GitHub repository. Public-package provenance also requires a public repository. Names, scopes, ownership, access policy and initial-publication/bootstrap requirements for new satellites must be confirmed independently; local candidate manifests and scope suggestions do not establish npm ownership. Do not add a token fallback to bypass missing trusted-publisher setup. A registry authentication failure is an incomplete external setup result, not a successful release. +The 24-entry constellation catalog records release planning identities and statuses. Its `published` field is declared metadata, not a registry query or namespace proof. Public observations may remain missing or stale; a missing npm downloads endpoint is not a zero-download observation. Exact source/archive/public-consumer receipts establish what this release actually published and verified. -Official reference: [npm trusted publishers](https://docs.npmjs.com/trusted-publishers/), inspected 2026-11-11. npm does not validate a saved publisher configuration automatically; its precise values and the first actual authorized publish require verification. - -## Applying the standard to satellites - -Keep independent package names and useful optional integrations. Scope branding alone does not establish security-scanner trust, ownership, a clean dependency tree or adoption. - -For each reviewed release: - -1. Establish package-name/scope ownership and exact repository metadata. -2. Run qualification on the exact reviewed source. Test the actual packed archive, declared integrations and fresh public consumer behavior. -3. Store the archive and evidence hashes in a source-bound seal. Carry those exact bytes through publication; do not rebuild during the privileged job. -4. Configure the package-specific npm trusted publisher to the reviewed repository/workflow/environment and permitted operation. -5. Use GitHub-hosted publication with minimal permissions, `id-token: write`, supported pinned Node/npm versions and tokenless isolated npm configuration. -6. Validate identity/context independently of the artifact checks, publish with provenance, and verify public bytes and consumers. Preserve partial/failure results rather than treating an existing version or coordination record as proof of a new upload. - -The helper can receive an explicit reviewed policy for another workflow. Changing the policy is a source change requiring the same review as the workflow; it is not a remote capability discovery or authorization mechanism. The existing WSP source/archive invariants are not automatically inherited by another package merely because it imports the helper. - -## Local validation - -```sh -node --test scripts/constellation-oidc.test.mjs scripts/wsp-release-evidence.test.mjs -``` - -Tests cover minimum/unsupported toolchains, fork/PR/job/event/source mismatches, missing or external OIDC endpoints, credential fallback spellings, getters and malformed data, child-environment isolation, and actual publication-entry rejection before any registry or GitHub operation. They also verify that the protected workflow retains OIDC permissions, explicit tool pins and source/archive checks. These are configuration and failure-path tests; no live OIDC exchange or publication is claimed. +Historical toolkit evidence remains unchanged in `packages/wsp-toolkit/docs/evidence`. Current counts, hashes and final publication outcomes belong to the current qualification and release artifacts. The separate [observatory workflow](../.github/workflows/constellation-observatory.yml) collects optional public observations and has no publication authority. diff --git a/docs/constellation.md b/docs/constellation.md index e22005d44..40b88de41 100644 --- a/docs/constellation.md +++ b/docs/constellation.md @@ -1,6 +1,8 @@ -# Growth constellation reference +# ruv-fann package constellation — discovery, metadata and public observations -This checkout now implements the operational pieces of the constellation strategy: a small discover/plan/scaffold entry point, common module metadata, explicit optional integrations, consistent documentation links, public cohort reporting and a protected tokenless WSP publication path. It extends the existing WSP swarm loop without renaming its packages or adding orchestration dependencies to every primitive. +Status: Implemented source architecture. Updated: 2026-11-11. + +This checkout implements a small discover/plan/scaffold entry point, common module metadata, explicit optional integrations, consistent documentation links, public cohort reporting and a separate protected thirteen-package toolkit release path. It extends the existing WSP swarm loop without renaming its packages or adding orchestration dependencies to every primitive. ## Start here @@ -12,7 +14,7 @@ npm run constellation -- plan weights npm run constellation -- plan local-loop ``` -The `weights` profile returns the verified published pin `ruv-fann-wsp@0.2.0`. The `local-loop` profile returns candidate source locations and explicitly declines to represent those candidates as public npm install specs. Planning installs nothing and sends no telemetry. The CLI depends only on the dependency-free contracts package; the fresh-consumer test verifies that installing the onramp installs exactly those two packages and no ML stack. +The `weights` profile returns the declared published pin `ruv-fann-wsp@0.2.0`. Profiles return exact install specs for catalog entries declared published, and keep any candidate source locations separate. The catalog now declares the toolkit release versions; a planning result is not an independent registry availability check. Planning installs nothing and sends no telemetry. The CLI depends only on the dependency-free contracts package; the fresh-consumer test verifies that installing the onramp installs exactly those two packages and no ML stack. Create a local, independently useful satellite template in a new directory: @@ -28,13 +30,13 @@ The scaffold is a bounded JSON-copy adapter template with independent validation ## Catalog and scopes -The authoritative [catalog](../packages/wsp-toolkit/packages/constellation/catalog.json) contains 24 entries: 12 verified public anchors/specialists and 12 local package candidates. It records roles, families, exact planning pins, repositories, source directories, existing shared formats and four profiles. Collection can accept another validated catalog of up to 1,000 entries, so a full cohort can be supplied without changing code. +The authoritative [catalog](../packages/wsp-toolkit/packages/constellation/catalog.json) contains 24 versioned release entries, including the twelve toolkit packages. Status is a catalog declaration, not proof of namespace ownership or public availability; use registry observations and exact publication receipts for that evidence. It records roles, families, exact planning pins, repositories, source directories, existing shared formats and four profiles. Collection can accept another validated catalog of up to 1,000 entries, so a full cohort can be supplied without changing code. The supplied 405-package cohort and its original measurement windows were not present in this checkout. The default catalog therefore does not claim to cover that cohort or reproduce its aggregate figures. The public `metaharness` entry exists; `@metaharness/cli` returned npm404 and is not offered as a published package. GitHub's former `ruvnet/claude-flow` repository resolves to `ruvnet/ruflo`, which the catalog uses. The validated Ruflo CLI planning pin remains 3.25.6 even when registry metadata observes a newer version. `proposedScope` values are migration proposals, not assertions of namespace ownership. Existing published identities remain compatible. Before any scoped migration, verify account ownership, choose a version/alias/deprecation plan, preserve downstream imports and separately configure the new package's trusted publisher. A scope is an organizational label; provenance, dependency review and runtime behavior establish the relevant security evidence. -Every local candidate includes a `constellation.json` module manifest. The new contracts package publishes catalog/module JSON schemas and identifiers for the existing WSP model, patch, evaluation and related formats. These metadata contracts do not replace WSP's bounded numerical validation, SHA-256 model checks or AgentDB revision authority. Actual core packages retain their existing dependency requirements; this work does not claim that AgentDB, RuVector or WSP are dependency-free. +Every toolkit package includes a `constellation.json` module manifest. The new contracts package publishes catalog/module JSON schemas and identifiers for the existing WSP model, patch, evaluation and related formats. These metadata contracts do not replace WSP's bounded numerical validation, SHA-256 model checks or AgentDB revision authority. Actual core packages retain their existing dependency requirements; this work does not claim that AgentDB, RuVector or WSP are dependency-free. ## README routing and optional integration @@ -44,7 +46,7 @@ npm run constellation:links npm run constellation:check ``` -The generator writes marked, deterministic cross-links and module manifests for the 12 workspace candidates. Qualification checks for drift. Cross-links point to the onramp, shared standards, relevant primitives and optional orchestration. Integration metadata derives from actual declared dependencies/peers; the generator adds no runtime dependencies. This provides discoverability without manufacturing package downloads through unrelated peer dependencies. +The generator writes marked, deterministic cross-links and module manifests for the twelve workspace packages. Qualification checks for drift. Cross-links point to the onramp, shared standards, relevant primitives and optional orchestration. Integration metadata derives from actual declared dependencies/peers; the generator adds no runtime dependencies. This provides discoverability without manufacturing package downloads through unrelated peer dependencies. ## Public telemetry dashboard @@ -57,7 +59,7 @@ NODE_USE_ENV_PROXY=1 npm run constellation:report The command writes `.artifacts/constellation/{observations.json,report.json,dashboard.html}`. Open the HTML locally; it has no external scripts, fonts, trackers or runtime network requests. Family/role/search/window controls and per-package trends operate entirely on the embedded report. Collection is an explicit read of public npm/GitHub endpoints, with fixed hosts, bounded responses, a finite deadline and concurrency limits. -Collection defaults to 42 complete UTC days ending yesterday. Download totals require complete coverage; missing packages/days remain unknown. The live reference collected through 2026-11-10 has nine measured download series, three FANN download endpoints returning404, 12 source candidates and six observed repositories. All 12 public package metadata requests succeeded. Registry metadata confirms those FANN packages exist; an unavailable downloads endpoint is not evidence of zero downloads. The report retains this distinction. +Collection defaults to 42 complete UTC days ending yesterday. Download totals require complete coverage; missing packages/days remain unknown. The historical live reference collected through 2026-11-10 recorded nine measured download series, three FANN download endpoints returning404, twelve then-candidate source packages and six observed repositories. All twelve queried public package metadata requests succeeded. These dated observations are retained unchanged; they do not qualify the new release catalog or prove current availability. Registry metadata confirms those FANN packages exist; an unavailable downloads endpoint is not evidence of zero downloads. The report retains this distinction. Repository counts use GitHub's `open_issues_count`, which includes open pull requests. Declared dependency links describe manifests, not measured co-installation. Weekday comparisons use the preceding four matching weekdays; correlations are descriptive and cannot establish causal cross-pollination or distinct users. The manually dispatched [observatory workflow](../.github/workflows/constellation-observatory.yml) uploads report artifacts only. No recurring job, public dashboard hosting or remote configuration has been enabled here. @@ -73,9 +75,9 @@ The input schema is `ruvnet.constellation-adoption/1`, with `consent:true` and s The analyzer deduplicates snapshots by project and timestamp, rejects contradictory duplicates even out of order, and keeps the latest valid snapshot per project in the window. The denominator is sampled projects containing any nucleus; the numerator contains a primitive as well. It reports overall/per-primitive attach with explicit denominators and the unit `consenting-project-snapshots`. This is a sample statistic, not a percentage of npm users or developers. Sample IDs and raw snapshots stay out of reports and network requests. No workspace scanning or automatic collection is added. -## Trusted publishing +## Protected publication and optional trusted publishing -The existing WSP protected lane previously granted OIDC permissions while still requiring `NPM_TOKEN`. The revised path pins supported Node/npm, rejects token fallback, retains exact-main/sealed-archive/provenance checks and publishes from isolated auth-free npm configuration. A registration matching the exact package/owner/repository/workflow/environment is still required at npm. No registration, scope claim, initial publication, live OIDC exchange or package upload was performed. See [release setup and boundaries](constellation-release.md). +The existing WSP token-based publisher is preserved. The new protected toolkit lane qualifies and carries thirteen exact archives—core 0.2.0 and twelve satellites 0.1.0—through current-main checks, dependency-ordered publication and public byte/installed-consumer verification. It bootstraps the packages with the existing protected npm credential. The OIDC helper is an optional future path requiring independently configured package-specific trusted publishers; a helper test is not a live OIDC exchange. See [release setup and boundaries](constellation-release.md) and [ADR-012](adr/ADR-012-weight-toolkit-release.md). ## Qualification @@ -86,6 +88,6 @@ npx --no-install playwright install --with-deps chromium npm run validate ``` -Qualification includes the existing real-WASM/swarm/AgentDB scenarios, all new contracts/onramp/telemetry tests, the root OIDC-context/release-evidence tests, strict types, deterministic documentation metadata, standalone browser controls and a fresh consumer of all12 archives. A separate consumer proves the two-package onramp footprint. Security regressions cover conflicting adoption snapshots, embedded HTML/script injection, report-output symlink replacement and concurrent scaffold directory substitution. +Qualification includes the existing real-WASM/swarm/AgentDB scenarios, all new contracts/onramp/telemetry tests, the root OIDC-context/release-evidence tests, strict types, deterministic documentation metadata, standalone browser controls and fresh consumers of the twelve satellite archives and the core facade archive. A separate consumer proves the two-package onramp footprint. Security regressions cover conflicting adoption snapshots, embedded HTML/script injection, report-output symlink replacement and concurrent scaffold directory substitution. -Historical WSP/loop receipts remain unchanged. New source-bound qualification receipts are stored as `constellation-node-22-validation.json` and `constellation-node-24-validation.json` under the toolkit's `docs/evidence` directory. Live observations and summary evidence are separate from synthetic test fixtures. Successful local qualification does not assert that GitHub CI, npm trusted-publisher registration or hosted publication has executed. +Historical WSP/loop receipts remain unchanged. Earlier constellation-generation receipts are stored as `constellation-node-22-validation.json` and `constellation-node-24-validation.json` under the toolkit's `docs/evidence` directory. Current source-bound counts, seals and publication outcomes belong to the new release artifacts, not those historical files. Live observations and summary evidence are separate from synthetic test fixtures. Successful local qualification does not assert that GitHub CI, npm trusted-publisher registration or hosted publication has executed. diff --git a/packages/wsp-toolkit/README.md b/packages/wsp-toolkit/README.md index 37d3c8f0b..f31febae0 100644 --- a/packages/wsp-toolkit/README.md +++ b/packages/wsp-toolkit/README.md @@ -1,21 +1,46 @@ -# ruv-fann-wsp toolkit +# ruv-fann toolkit — bounded weight search, model evaluation and adaptive revisions -Twelve independent ESM subpackages extend `ruv-fann-wsp@0.2.0` with regression gates, bounded search, checkpoint transport and platform adapters. They use the published `ruv-fann@0.1.2` / `ruv-fann-wasm@0.1.2` runtime. The existing core package and its release lanes remain unchanged. This workspace prepares candidate packages; version `0.1.0` has not been published. +Build a local improvement loop for small dense neural networks: propose a bounded weight edit, evaluate independent cases, check finite-domain output rules and explicitly activate a revision through your application's authority. Twelve ESM/TypeScript packages expose focused APIs for search, validation, worker coordination, checkpoint transport and package discovery. -| Package | Purpose | Public API | +[![Bounded neural weight evolution: proposal workers feed independent holdout and invariant gates, then AgentDB revision CAS and explicit rollback.](https://raw.githubusercontent.com/ruvnet/ruv-FANN/main/docs/assets/wsp-toolkit-loop.svg)](https://ruvnet.github.io/ruv-FANN/) + +**[Explore the illustrated field guide and real WASM demo →](https://ruvnet.github.io/ruv-FANN/)** + +**Topics:** weight-space programming · neural network evaluation · bounded search · adaptive weight revisions · AgentDB persistence · Node.js worker threads · WebAssembly · Cloudflare Workers · integrity-pinned checkpoints. + +## Install the complete facade or one capability + +```sh +npm install ruv-fann@0.2.0 +``` + +Core 0.2.0 keeps its root inference/training import and adds fourteen explicit subpaths, including `ruv-fann/wsp`, `ruv-fann/search`, `ruv-fann/invariants` and `ruv-fann/loop`. Installing the facade installs the complete toolkit, including the Cloudflare `esbuild` integration; importing the root does not eagerly load those capabilities. For a smaller installation, choose an individual package below. AgentDB is optional and supplied/configured by your application. + +| Release component | Version | Role | | --- | --- | --- | -| [ruv-fann-wsp-lifecycle](packages/lifecycle/README.md) | CI regression suites and isolated candidate snapshots | `runRegressionGate`, `evaluatePatchBranches`, `wsp-gate` CLI | -| [ruv-fann-wsp-search](packages/search/README.md) | Bounded discrete optimization; experimental symbolic/plasticity proposals | `searchWeightPatch`, `compileBooleanTable`, `createHebbianPatch` | -| [ruv-fann-wsp-huggingface](packages/huggingface/README.md) | Commit-pinned, digest-verified public Hub JSON | `loadHubModel`, `loadHubLinearHead` | -| [ruv-fann-wsp-cloudflare](packages/cloudflare/README.md) | Authenticated stateless HTTP operations and static WASM build | `createWorkerHandler`, `buildWorker` | -| [ruv-fann-wsp-ruos](packages/ruos/README.md) | WASM lifecycle canary, shell plan, executor completion checks | `runWasmCanary`, `createValidationCommand`, `assertRuOSCompletion` | -| [ruv-fann-wsp-invariants](packages/invariants/README.md) | Finite-domain output constraints and exhaustive Boolean checks | `checkModelInvariants`, `estimateInvariantWork`, `createBooleanInvariant` | -| [ruv-fann-wsp-swarm](packages/swarm/README.md) | Real bounded proposal workers with separate WASM instances | `runProposalSwarm`, `estimateSwarmWork` | -| [ruv-fann-wsp-registry](packages/registry/README.md) | AgentDB revision authority with durable acknowledgements | `createAgentDBRegistry` | -| [ruv-fann-wsp-loop](packages/loop/README.md) | Autonomous local proposal/evaluation/promotion loop | `runEvolutionLoop` | -| [ruvnet-constellation-contracts](packages/contracts/README.md) | Dependency-free catalog/module contracts and canonical IDs | `CONTRACTS`, `validateCatalog`, `validateModuleManifest` | -| [ruvnet-constellation](packages/constellation/README.md) | Lightweight explicit discover/plan/scaffold onramp | `readCatalog`, `planProfile`, `scaffoldSatellite` | -| [ruvnet-constellation-telemetry](packages/telemetry/README.md) | Public cohort metrics, sampled project attach and standalone dashboard | `collectPublicMetrics`, `analyzeConstellation`, `renderConstellationDashboard` | +| `ruv-fann` | **0.2.0** | Inference/training plus typed capability subpaths | +| Twelve toolkit packages below | **0.1.0** each | Independently installable capabilities | +| `ruv-fann-wsp` | **0.2.0**, existing public dependency | Weight patches, workspaces and diagnostics | +| `ruv-fann-wasm` | **0.1.2**, existing public dependency | Bundled scalar/SIMD numerical runtime | + +The umbrella GitHub release is `ruv-fann-toolkit-v0.2.0`. The protected release lane qualifies thirteen new archives: core plus twelve toolkit packages. Public availability requires its publication and post-install receipts; a manifest version or catalog `published` declaration is not registry proof. WSP and satellites retain their exact published core 0.1.2 pins, producing a finite nested dependency graph; see [core compatibility and browser guidance](https://github.com/ruvnet/ruv-FANN/tree/main/packages/core#dependency-versions-and-compatibility). + +## Capability map + +| Individual package / core subpath | Use case | Public API | +| --- | --- | --- | +| [ruv-fann-wsp-lifecycle](packages/lifecycle/README.md)
`ruv-fann/lifecycle` | CI regression suites and isolated candidate snapshots | `runRegressionGate`, `evaluatePatchBranches`, `wsp-gate` CLI | +| [ruv-fann-wsp-search](packages/search/README.md)
`ruv-fann/search` | Bounded discrete optimization; experimental symbolic/plasticity proposals | `searchWeightPatch`, `compileBooleanTable`, `createHebbianPatch` | +| [ruv-fann-wsp-huggingface](packages/huggingface/README.md)
`ruv-fann/huggingface` | Commit-pinned, digest-verified public Hub JSON | `loadHubModel`, `loadHubLinearHead` | +| [ruv-fann-wsp-cloudflare](packages/cloudflare/README.md)
`ruv-fann/cloudflare` | Authenticated stateless HTTP operations and static WASM build | `createWorkerHandler`, `buildWorker` | +| [ruv-fann-wsp-ruos](packages/ruos/README.md)
`ruv-fann/ruos` | WASM lifecycle canary, shell plan, executor completion checks | `runWasmCanary`, `createValidationCommand`, `assertRuOSCompletion` | +| [ruv-fann-wsp-invariants](packages/invariants/README.md)
`ruv-fann/invariants` | Finite-domain output constraints and exhaustive Boolean checks | `checkModelInvariants`, `estimateInvariantWork`, `createBooleanInvariant` | +| [ruv-fann-wsp-swarm](packages/swarm/README.md)
`ruv-fann/swarm` | Real bounded proposal workers with separate WASM instances | `runProposalSwarm`, `estimateSwarmWork` | +| [ruv-fann-wsp-registry](packages/registry/README.md)
`ruv-fann/registry` | AgentDB revision authority with durable acknowledgements | `createAgentDBRegistry` | +| [ruv-fann-wsp-loop](packages/loop/README.md)
`ruv-fann/loop` | Autonomous local proposal/evaluation/promotion loop | `runEvolutionLoop` | +| [ruvnet-constellation-contracts](packages/contracts/README.md)
`ruv-fann/contracts` | Dependency-free catalog/module contracts and canonical IDs | `CONTRACTS`, `validateCatalog`, `validateModuleManifest` | +| [ruvnet-constellation](packages/constellation/README.md)
`ruv-fann/constellation` | Lightweight explicit discover/plan/scaffold onramp | `readCatalog`, `planProfile`, `scaffoldSatellite` | +| [ruvnet-constellation-telemetry](packages/telemetry/README.md)
`ruv-fann/telemetry` | Public cohort metrics, sampled project attach and standalone dashboard | `collectPublicMetrics`, `analyzeConstellation`, `renderConstellationDashboard` | ## Constellation onramp and dashboard @@ -26,7 +51,7 @@ npm run constellation -- plan local-loop npm run constellation:report ``` -The onramp plans explicit installs or source candidates and scaffolds reviewable local satellites. It installs no ML stack and collects no telemetry. The dashboard collects public metrics only when invoked; its HTML works offline. Default coverage is 12 verified public packages plus 12 local candidates. Measured project attach needs a separate consenting snapshot input; download correlations cannot establish it. See the [growth constellation guide](../../docs/constellation.md), [catalog](packages/constellation/catalog.json) and [protected OIDC setup](../../docs/constellation-release.md). +The onramp plans explicit installs or source candidates and scaffolds reviewable local satellites. It installs no ML stack and collects no telemetry. The dashboard collects public metrics only when invoked; its HTML works offline. The release catalog declares 24 versioned packages, including the twelve toolkit packages. Catalog status guides planning; current registry observations and exact archive receipts establish actual availability. Measured project attach needs a separate consenting snapshot input; download correlations cannot establish it. See the [growth constellation guide](../../docs/constellation.md), [catalog](packages/constellation/catalog.json) and [protected release and optional OIDC setup](../../docs/constellation-release.md). ## Run @@ -66,38 +91,63 @@ active AgentDB revision → fixed-operation proposal workers The loop has explicit round, proposal, work, worker, timeout and cancellation limits. Workers receive development cases only. Held-out data and acceptance rules remain with the coordinator. A worker result cannot authorize a commit. Active hashes are refreshed before declaring goals met, so another coordinator's rollback invalidates cached goal evidence. Tests exercise multiple generations, two concurrent loops, stale results, aborts and a real post-promotion disk-flush failure. See the [runnable scenario](test/evolution-scenario.mjs), [loop API](packages/loop/README.md), [delivery contract](docs/loop-design.md), and [loop validation](docs/loop-validation.md). -AgentDB 3.10.0/sql.js performs actual persistence in this implementation. The registry adapter accepts a caller-owned controller, serializes operations across awaits, and acknowledges writes only after its persistence callback succeeds. Failed persistence blocks further work until reopen. The fixture uses AgentDB's own WSP 0.1.0 controller dependency, while the coordinator independently checks candidates with WSP 0.2.0. There are no automatic provider calls, generated-code execution, public package publication or billing actions. RuVector/MetaHarness/Agentic Flow routing and universal verification remain extension points. +AgentDB 3.10.0/sql.js performs actual persistence in this implementation. The registry adapter accepts a caller-owned controller, serializes operations across awaits, and acknowledges writes only after its persistence callback succeeds. Failed persistence blocks further work until reopen. The fixture uses AgentDB's own WSP 0.1.0 controller dependency, while the coordinator independently checks candidates with WSP 0.2.0. The loop itself makes no provider calls, executes no generated code, publishes no package and performs no billing action. Package publication is a separate protected GitHub Actions operation, never an evolution-loop capability. RuVector/MetaHarness/Agentic Flow routing and universal verification remain extension points. + +## Repair XOR, gate it independently and choose a revision -## Repair and gate +Save the complete example as `repair.mjs`, then run `node repair.mjs` after installing `ruv-fann@0.2.0`. The search receives one development row. Independent exhaustive cases determine whether its candidate is useful across the whole binary XOR domain. ```js -import { searchWeightPatch } from 'ruv-fann-wsp-search'; -import { runRegressionGate } from 'ruv-fann-wsp-lifecycle'; -import { createWeightWorkspace } from 'ruv-fann-wsp'; - -// model, dataset and policy are application-owned inputs. -const result = await searchWeightPatch(model, dataset, policy, { - locations: [0, 1].map(index => ({layer: 1, parameter: 'weights', index, values: [0, 1]})), - maxEvaluations: 8, - maxPasses: 2 +import { searchWeightPatch } from 'ruv-fann/search'; +import { runRegressionGate } from 'ruv-fann/lifecycle'; +import { createBooleanInvariant, checkModelInvariants } from 'ruv-fann/invariants'; +import { createWeightWorkspace, applyWeightPatch } from 'ruv-fann/wsp'; + +const model = {schema: 'ruv-fann.dense-layers/1', layers: [ + {inputs: 2, outputs: 2, weights: [1,-1,-1,1], bias: [0,0], activation: 'ReLU', steepness: 1}, + {inputs: 2, outputs: 1, weights: [0,0], bias: [0], activation: 'Linear', steepness: 1} +]}; +const development = {inputs: [0,1], targets: [1], rows: 1}; +const holdout = {inputs: [0,0, 1,0, 1,1], targets: [0,1,0], rows: 3}; +const policy = {maxMSE: 0, maxRegressionMSE: 0, maxAbsoluteError: 0}; +const found = await searchWeightPatch(model, development, policy, { + locations: [0,1].map(index => ({layer: 1, parameter: 'weights', index, values: [0,1]})), + maxEvaluations: 8, maxPasses: 2 }); -if (result.patch && result.evaluation.accepted) { - const gate = await runRegressionGate({model, patch: result.patch, suites: [ - {name: 'heldout', dataset: independentDataset, policy} - ]}); - if (gate.accepted) { - const workspace = await createWeightWorkspace(model); - const original = workspace.snapshot(); - // Re-evaluate the promotion policy inside the workspace; a gate receipt is not authority. - const proposal = await workspace.propose(result.patch, independentDataset, policy); - if (proposal.evaluation.accepted) { - const next = workspace.promote(proposal.id, original.revision); - workspace.rollback(original.revision, next.revision); - } - } +if (!found.patch) throw new Error('No improving candidate'); +const gate = await runRegressionGate({model, patch: found.patch, suites: [ + {name: 'development', dataset: development, policy}, + {name: 'held-out-xor', dataset: holdout, policy} +]}); +console.log('Independent holdout accepted:', gate.accepted); // false +// The development-only shortcut is rejected; active state stays unchanged. +const workspace = await createWeightWorkspace(model); +if (gate.accepted) throw new Error('Expected the one-row shortcut to fail the holdout'); + +// A separate explicitly authored candidate connects both useful hidden units. +const completePatch = {...found.patch, edits: [0,1].map(index => + ({layer: 1, parameter: 'weights', index, value: 1}))}; +const checked = await runRegressionGate({model, patch: completePatch, suites: [ + {name: 'development', dataset: development, policy}, + {name: 'held-out-xor', dataset: holdout, policy} +]}); +const candidate = await applyWeightPatch(model, completePatch); +const invariant = await checkModelInvariants(candidate, + createBooleanInvariant({inputs: 2, outputs: 1, targets: [0,1,1,0]})); +if (!checked.accepted || !invariant.accepted || invariant.modelHash !== checked.candidateHash) { + throw new Error('Independent gates rejected the complete candidate'); } +const baseline = workspace.snapshot(); +const proposal = await workspace.propose(completePatch, development, policy); +if (!proposal.evaluation.accepted || proposal.evaluation.baseHash !== checked.baseHash || + proposal.evaluation.candidateHash !== checked.candidateHash) throw new Error('Gated candidate changed'); +const active = workspace.promote(proposal.id, baseline.revision); +console.log('Promoted revision:', active.revision); // 2 +console.log('Rollback revision:', workspace.rollback(baseline.revision, active.revision).revision); // 3 ``` +This deliberately small example illustrates a rejected shortcut, a passing finite-domain candidate and explicit activation. It is not evidence of generalization. Keep real application holdouts private from search, do not repeatedly tune against them, and give promotion authority only to trusted application code. The complete persistent multi-model demonstration is `npm run demo:loop` in the source workspace. + For a PR gate, write `{model,patch,suites:[{name,dataset,policy}]}` to JSON and run `wsp-gate file.json`: exit 0 accepts, 1 rejects, 2 reports invalid input/runtime failure. The [complete executable scenario](test/scenario.mjs) covers two-weight XOR repair, activation and derivative oracles, rejected ablation, branching, compiled Boolean logic, localized plasticity, a Hub transport fixture and rollback in Node and real Chromium. ## Platforms and boundaries @@ -109,3 +159,9 @@ ruOS validation uses the observed Work Desktop executor, installs the same SHA-2 The Boolean compiler covers complete truth tables of at most six binary inputs. Hebbian updates are bounded proposals requiring independent evaluation. Search allows trusted synchronous local objective callbacks, including discontinuous scores; its winner can still fail the authoritative regression policy. Callbacks are not sandboxes. Candidate branches share a runtime and are evaluated sequentially; they do not provide process isolation. No generalization, arbitrary safety-input repair, transformer editing, hidden behavioral keys or autonomous provider execution is claimed. Performance qualification compares an identical 16-candidate one-coordinate sequence: cached baseline screening plus final authoritative validation uses 19 inference passes versus 32 for repeatedly evaluating both models. Timings are local observations. See the [original five-package validation](docs/validation.md), [current loop qualification](docs/loop-validation.md) and [delivery contract](docs/design.md). + +## Release and source evidence + +The [protected thirteen-package lane](https://github.com/ruvnet/ruv-FANN/blob/main/.github/workflows/protected-toolkit-release.yml) publishes only qualified exact archives from the reviewed main SHA, then verifies public bytes and fresh installed consumers. The existing WSP release publisher remains separate. New satellites bootstrap through the existing npm credential; the optional OIDC guard requires independently registered package-specific publishers before use. See [release setup](https://github.com/ruvnet/ruv-FANN/blob/main/docs/constellation-release.md) and [ADR-012](https://github.com/ruvnet/ruv-FANN/blob/main/docs/adr/ADR-012-weight-toolkit-release.md). + +Historical `docs/evidence/*` files describe their recorded generations. They are retained unchanged and do not qualify a newer source commit. Current exact-source test counts, archive digests, publication receipts and installed-consumer results belong to the umbrella release artifacts. diff --git a/packages/wsp-toolkit/docs/design.md b/packages/wsp-toolkit/docs/design.md index fa2cc1946..a97f9efe5 100644 --- a/packages/wsp-toolkit/docs/design.md +++ b/packages/wsp-toolkit/docs/design.md @@ -1,5 +1,7 @@ # WSP toolkit delivery contract +Status: Implemented source architecture. Updated: 2026-11-11. Publication is a separate exact-artifact operation; see [ADR-012](../../../docs/adr/ADR-012-weight-toolkit-release.md). + ## Outcome and scope Deliver independent ESM/TypeScript subpackages around published `ruv-fann-wsp@0.2.0` with real WASM validation. Keep the existing WSP API unchanged. Actors are local developers, checkpoint reviewers and bounded patch generators. No generated code execution or implicit model promotion. No claim to edit transformer/safetensors checkpoints or validate arbitrary safety tasks. @@ -23,4 +25,4 @@ Unit tests cover malformed data, bounds, stale revisions and regression rejectio ## Architecture decision -Use an isolated npm workspace under `packages/wsp-toolkit` rather than adding experimental dependencies to the repository's native/swarm root workspace. Independent packages allow platform adapters and experiments to evolve without inflating the core runtime or changing protected release lanes. Cloudflare operations are stateless; application owners must supply authentication and durable state before exposing a production mutation API. This task prepares and validates artifacts; it does not publish packages or replace existing deployments. +Use an isolated npm workspace under `packages/wsp-toolkit` rather than adding experimental dependencies to the repository's native/swarm root workspace. Independent packages allow focused installations. Core 0.2.0 additionally offers a complete facade with fourteen explicit subpaths and exact satellite dependencies; its root entrypoint still imports only the numerical runtime. Existing satellite/WSP core 0.1.2 pins remain intact as a finite nested graph. Cloudflare operations are stateless; application owners must supply authentication and durable state before exposing a production mutation API. The new protected toolkit lane qualifies thirteen exact archives and carries those bytes through dependency-ordered publication and public installed-consumer verification. The pre-existing WSP publisher remains separate. No hosted Worker deployment or production checkpoint change follows implicitly from publishing npm packages. diff --git a/packages/wsp-toolkit/docs/loop-design.md b/packages/wsp-toolkit/docs/loop-design.md index dbf54829b..ebee44128 100644 --- a/packages/wsp-toolkit/docs/loop-design.md +++ b/packages/wsp-toolkit/docs/loop-design.md @@ -1,8 +1,10 @@ # Bounded autonomous loop and swarm +Status: Implemented source architecture. Updated: 2026-11-11. Publication is a separate exact-artifact operation; see [ADR-012](../../../docs/adr/ADR-012-weight-toolkit-release.md). + ## Outcome and executable acceptance -Extend the existing toolkit with a runnable local evolution loop: multiple worker threads propose surgical weight changes, an independent coordinator re-evaluates selection and held-out suites plus output invariants, and AgentDB owns durable proposal IDs, compare-and-swap revisions and rollback. The acceptance demo repairs XOR, rejects a tempting local-only candidate using an independent gate, preserves rejected/stale revisions, stops within explicit budgets, reopens durable state and rolls back exactly. This is a present-day bounded implementation; no physical neuromorphic hardware, universal alignment proof, public registry publication, provider call or financial action is in scope. +Extend the existing toolkit with a runnable local evolution loop: multiple worker threads propose surgical weight changes, an independent coordinator re-evaluates selection and held-out suites plus output invariants, and AgentDB owns durable proposal IDs, compare-and-swap revisions and rollback. The acceptance demo repairs XOR, rejects a tempting local-only candidate using an independent gate, preserves rejected/stale revisions, stops within explicit budgets, reopens durable state and rolls back exactly. This is a present-day bounded implementation; no physical neuromorphic hardware, universal alignment proof, provider call or financial action is in the evolution loop. Package publication is a separate protected release-controller concern. ## Ownership @@ -11,7 +13,7 @@ Extend the existing toolkit with a runnable local evolution loop: multiple worke - Invariants worker owns `packages/invariants/**`: real WASM finite-domain output constraints. Package name `ruv-fann-wsp-invariants@0.1.0`. - Coordinator owns `packages/loop/**`, root manifests/lockfiles, scripts, E2E, examples, docs and integration. Package name `ruv-fann-wsp-loop@0.1.0`. -No overlapping edits. All libraries ESM with public src/index.js and src/index.d.ts, README, MIT LICENSE and test/*.test.mjs. Runtime dependency WSP exact 0.2.0; sibling packages 0.1.0. No worker edits toolkit root lockfile. Existing uncommitted toolkit work is retained. +No overlapping edits. All libraries ESM with public src/index.js and src/index.d.ts, README, MIT LICENSE and test/*.test.mjs. Runtime dependency WSP exact 0.2.0; sibling packages 0.1.0. No worker edits toolkit root lockfile. The original package interfaces and historical evidence remain retained; current qualification binds the final source and archive generation. ## Shared interfaces @@ -19,7 +21,7 @@ No overlapping edits. All libraries ESM with public src/index.js and src/index.d `createAgentDBRegistry(programs, {flush?, close?}?)` receives a real AgentDB WeightPrograms capability (AgentDB 3.10.0); wrapper returns promise methods `create(id,model)`, `get(id)`, `list(limit?)`, `propose(id,patch,dataset,policy)`, `promote(id,proposalId,expectedRevision)`, `rollback(id,targetRevision,expectedRevision)`, `close()`. Serialize mutations across awaits. Snapshot inputs before queueing; do not accept caller-authored receipts as promotion authority. Flush durable mutations before acknowledging. Failed flush poisons mutations until reopen; report failure. Accessors/getters/unknown arguments/bounds must fail safely. AgentDB is an optional peer, not auto-installed by the library. -`tooling/agentdb/package.json` pins agentdb 3.10.0, private, with its own lockfile and `.npmrc` omitting optional dependencies to avoid unrelated native/model packages. `tooling/agentdb/runtime.mjs` exports `openDemoRegistry(filename)` using the real package's WeightPrograms and db-fallback, with explicit flush/close. Root setup command will run npm ci in this fixture; tests must fail with actionable error if absent, never silently skip. Node 20.9+ runtime; do not mutate process-wide environment. +`tooling/agentdb/package.json` pins agentdb 3.10.0, private, with its own lockfile and `.npmrc` omitting optional dependencies to avoid unrelated native/model packages. `tooling/agentdb/runtime.mjs` exports `openDemoRegistry(filename)` using the real package's WeightPrograms and db-fallback, with explicit flush/close. The setup command explicitly runs npm ci in this fixture; tests fail with an actionable error if it is absent, never silently skip. The private test/demo fixture sets AGENTDB_FORCE_SQLJS before importing AgentDB so host-native driver availability cannot change persistence fault oracles. This backend selection is confined to the isolated fixture process. The published registry adapter does not mutate process-wide environment or select the caller's database backend. ### Swarm @@ -41,4 +43,8 @@ Failure: a candidate fitting the development slice fails held-out/output constra ## Architecture decisions and limitations -Use fixed-operation Node workers for real concurrent execution and separate WASM instances; use platform subagents only to build/review this implementation. Keep AgentDB's large optional dependency tree in a separate pinned integration fixture; the registry library accepts a caller-owned real controller. No mocked database success is called persistence evidence. Hosted runtime connectors are currently unavailable; no remote execution is inferred from coordination records. Universal verification, learned semantic routing, code-generation providers, npm publication and physical actuation remain explicit extensions requiring their own contracts. +Use fixed-operation Node workers for real concurrent execution and separate WASM instances; use platform subagents only to build/review this implementation. Keep AgentDB's large optional dependency tree in a separate pinned integration fixture; the registry library accepts a caller-owned real controller. No mocked database success is called persistence evidence. Hosted runtime connectors are currently unavailable; no remote execution is inferred from coordination records. Universal verification, learned semantic routing, code-generation providers and physical actuation remain explicit extensions requiring their own contracts. npm publication is now handled by the separate protected exact-archive lane; it is never a worker or evolution-loop operation. + +## Release review refinements + +The release review adds live-record revision checks at the authority boundary and captures trusted capabilities before asynchronous work. It rejects asynchronous search objectives without leaving unhandled rejections, and reads actual AbortSignal state rather than accepting shadowed instance fields. Hub transport deadlines remain active through streamed body reads. The private AgentDB fixture forces sql.js before import so persistence-failure tests retain one reproducible backend. These are regression requirements; final pass counts and source bindings come from the current qualification receipts. diff --git a/packages/wsp-toolkit/docs/loop-validation.md b/packages/wsp-toolkit/docs/loop-validation.md index a7a597d87..f642b4cb0 100644 --- a/packages/wsp-toolkit/docs/loop-validation.md +++ b/packages/wsp-toolkit/docs/loop-validation.md @@ -1,6 +1,8 @@ -# Autonomous loop qualification +# Autonomous loop qualification — historical generation and current release gates -The implementation adds four local packages to the original five-package toolkit: `invariants`, `swarm`, `registry`, and `loop`, each version 0.1.0. The selected architecture and control-flow contract are in [loop-design.md](loop-design.md). Existing uncommitted toolkit work and the core WSP API are preserved. +Status: Historical loop-generation evidence plus current regression requirements. Updated: 2026-11-11. + +The original implementation added four local packages to the original five-package toolkit: `invariants`, `swarm`, `registry`, and `loop`, each version 0.1.0. The selected architecture and control-flow contract are in [loop-design.md](loop-design.md). The core WSP API and recorded historical receipts are preserved. Current release qualification covers core 0.2.0 plus all twelve toolkit packages and is source/archive-bound separately. ## Run @@ -33,7 +35,7 @@ Setup explicitly installs the separate locked AgentDB runtime with optional depe | Existing edge compatibility | Original Chromium and workerd tests | Existing browser/Cloudflare operations still run actual WASM; the Node-only loop is not bundled into them | | Supply-chain qualification | `scripts/validate.mjs` | Root audit and isolated AgentDB installed-tree audit report zero known advisories | -The loop-specific suite contains 47 tests: 14 invariants, 10 swarm, 8 registry and 15 coordinator tests. The integrated workspace contains 94 tests, including the original 47. Final Node 22/24 receipts are saved separately under `docs/evidence/loop-node-*-validation.json`; initial five-package receipts remain historical evidence. Live Hub/ruOS results from the earlier task apply to the original packages and are not presented as a remote run of this loop. +The historical loop-specific suite captured on 2026-11-11 contained 47 tests: 14 invariants, 10 swarm, 8 registry and 15 coordinator tests. That generation's integrated workspace contained 94 tests, including the original 47. Its Node 22/24 receipts are retained separately under `docs/evidence/loop-node-*-validation.json`; initial five-package receipts remain historical evidence. Live Hub/ruOS results from the earlier task apply to the original packages and are not presented as a remote run of this loop. ## Demonstrated loop @@ -55,4 +57,10 @@ The AgentDB capability is a local trusted dependency, not an identity or authori The cloud executor is current and available. Live Ruflo and AgentDB runtime connector probes returned internal errors, so no execution or persistence is attributed to those connectors. Platform subagents performed the engineering work; the implementation itself uses real local Node workers and real `agentdb@3.10.0` with sql.js. The fixture omits optional native drivers, embedding/model packages and telemetry integrations. No provider credentials are copied, no model downloaded, and no external agent jobs or public federation messages are started. -RuVector semantic retrieval, MetaHarness/Agentic Flow routing, generated source packages, public npm publication, hardware actuation, cryptographic alignment guarantees and autonomous financial contracting remain outside this implementation. The adapter/capability boundaries leave room for those integrations without pretending that absent runtimes executed them. +RuVector semantic retrieval, MetaHarness/Agentic Flow routing, generated source packages, hardware actuation, cryptographic alignment guarantees and autonomous financial contracting remain outside this implementation. The adapter/capability boundaries leave room for those integrations without pretending that absent runtimes executed them. + +## Current release qualification additions + +The protected thirteen-package lane carries one set of core/satellite archive bytes through Node.js 22/24, strict installed TypeScript, real Chromium/WASM and public installed-consumer checks. New release regressions cover live-record revision CAS, captured authority capabilities, asynchronous objective rejection cleanup, AbortSignal shadowing and Hub streamed-body deadlines. The isolated AgentDB fixture selects sql.js before importing the real controller, making persistence-failure tests independent of optional native driver availability; the published adapter does not change the host environment. + +Final source SHA, zero-skip test counts, archive digests, security results and post-publication outcomes belong to the current workflow artifacts and umbrella release `ruv-fann-toolkit-v0.2.0`. Historical JSON receipts are not edited or relabeled as current qualification. Publication remains outside the evolution loop itself. diff --git a/packages/wsp-toolkit/docs/validation.md b/packages/wsp-toolkit/docs/validation.md index 1b93477a5..e049b364b 100644 --- a/packages/wsp-toolkit/docs/validation.md +++ b/packages/wsp-toolkit/docs/validation.md @@ -1,4 +1,6 @@ -# Initial five-package validation evidence +# Initial five-package validation evidence — historical generation + +Status: Historical evidence summary, retained alongside its original receipts recorded 2026-11-11. Updated: 2026-11-11. This records the original five-package qualification. The expanded nine-package loop is documented in [loop validation](loop-validation.md); its source-bound receipts are separate from the initial records below. @@ -20,7 +22,7 @@ The toolkit was implemented against `ruvnet/ruv-FANN` base commit `4ae155ad300e9 | Dependency security | `npm run audit`, `npm run validate` | Zero known advisories in full locked tree after pinned Miniflare dependency fixes | | Repeatable qualification | `.github/workflows/wsp-toolkit.yml` | Node 22.13/24.22 matrix configured; not yet run on GitHub | -The full new-suite count is 47 tests: 42 package tests, one browser test, one packed-consumer test and three integration/CLI tests. `npm run validate` additionally requires a strict declaration check, zero cancelled/skipped/todo tests, benchmark equality and a clean npm audit. It writes `.artifacts/validation.json` with exact source and lockfile hashes. Captured local qualification reports are stored under `docs/evidence` after final execution; these are evidence records, not signatures. +The original captured generation contained 47 tests: 42 package tests, one browser test, one packed-consumer test and three integration/CLI tests. `npm run validate` additionally requires a strict declaration check, zero cancelled/skipped/todo tests, benchmark equality and a clean npm audit. It writes `.artifacts/validation.json` with exact source and lockfile hashes. Captured local qualification reports are stored under `docs/evidence` after final execution; these are evidence records, not signatures. ## What the platform evidence establishes @@ -44,4 +46,4 @@ The benchmark evaluates the identical sequence of sixteen monotonically improvin ## Remaining boundaries -Packages are prepared and packed, not published to npm. CI is authored but has not executed on GitHub. No hosted Worker was deployed, no Hub model uploaded, and no production checkpoint promoted. Applications must choose appropriate held-out data, provide production authentication/durable state where needed, bound concurrent calls and keep trusted callback execution within their own security boundary. Experimental Boolean compilation, Hebbian proposals and branching remain explicitly scoped to small dense models. +At this historical capture, packages were prepared and packed rather than published, and CI had not executed on GitHub. The later core 0.2.0/twelve-satellite release uses a separate protected qualification/publication lane; current counts and final publication status must be read from that lane's exact-source receipts, not inferred from this table. No hosted Worker was deployed, no Hub model uploaded, and no production checkpoint promoted. Applications must choose appropriate held-out data, provide production authentication/durable state where needed, bound concurrent calls and keep trusted callback execution within their own security boundary. Experimental Boolean compilation, Hebbian proposals and branching remain explicitly scoped to small dense models. diff --git a/packages/wsp-toolkit/packages/cloudflare/README.md b/packages/wsp-toolkit/packages/cloudflare/README.md index 088298fd9..cf9738b01 100644 --- a/packages/wsp-toolkit/packages/cloudflare/README.md +++ b/packages/wsp-toolkit/packages/cloudflare/README.md @@ -1,4 +1,16 @@ -# ruv-fann-wsp-cloudflare +# ruv-fann-wsp-cloudflare — stateless neural operations for Workers + +Expose bounded weight evaluation and diagnostics through stateless Cloudflare Worker routes. The dedicated build helper packages static scalar/SIMD WASM assets; it does not deploy an account or create persistent model authority. + +**Topics:** Cloudflare Workers · static WebAssembly · authenticated neural evaluation · bounded HTTP APIs. + +```sh +npm install ruv-fann-wsp-cloudflare@0.1.0 +``` + +[Package on npm](https://www.npmjs.com/package/ruv-fann-wsp-cloudflare) · [Core 0.2.0 entrypoint: `ruv-fann/cloudflare`](https://github.com/ruvnet/ruv-FANN/tree/main/packages/core#capability-entrypoints) · [Interactive ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/) · [Toolkit API and release guide](https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit#readme) + +Choose this standalone package for its declared dependency footprint, or use `ruv-fann/cloudflare` from the complete `ruv-fann@0.2.0` facade. Package version: **0.1.0**. [Umbrella release and evidence](https://github.com/ruvnet/ruv-FANN/releases/tag/ruv-fann-toolkit-v0.2.0). Stateless HTTP operations over `ruv-fann-wsp@0.2.0`, with a build adapter that imports real precompiled WebAssembly modules into Cloudflare Workers. Reuses one initialized runtime per backend. It never downloads Wasm at runtime and has no JavaScript numerical fallback. diff --git a/packages/wsp-toolkit/packages/constellation/README.md b/packages/wsp-toolkit/packages/constellation/README.md index e4d126ddf..76d66970e 100644 --- a/packages/wsp-toolkit/packages/constellation/README.md +++ b/packages/wsp-toolkit/packages/constellation/README.md @@ -1,6 +1,18 @@ -# ruvnet-constellation +# ruvnet-constellation — discover, plan and scaffold useful packages -A lightweight explicit onramp for a constellation of independently useful packages. ESM, Node 20.9+. Its only runtime dependency is `ruvnet-constellation-contracts@0.1.0`; no ML runtime, model, provider or telemetry collector is pulled in by this package. This source candidate has not been published. +Explore a supplied package catalog, build an explicit installation plan and scaffold a reviewable local adapter. The onramp installs nothing automatically and keeps namespace proposals separate from ownership proof. + +**Topics:** package discovery · explicit install plans · local scaffolding · modular integrations. + +```sh +npm install ruvnet-constellation@0.1.0 +``` + +[Package on npm](https://www.npmjs.com/package/ruvnet-constellation) · [Core 0.2.0 entrypoint: `ruv-fann/constellation`](https://github.com/ruvnet/ruv-FANN/tree/main/packages/core#capability-entrypoints) · [Interactive ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/) · [Toolkit API and release guide](https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit#readme) + +Choose this standalone package for its declared dependency footprint, or use `ruv-fann/constellation` from the complete `ruv-fann@0.2.0` facade. Package version: **0.1.0**. [Umbrella release and evidence](https://github.com/ruvnet/ruv-FANN/releases/tag/ruv-fann-toolkit-v0.2.0). + +A lightweight explicit onramp for a constellation of independently useful packages. ESM, Node 20.9+. Its only runtime dependency is `ruvnet-constellation-contracts@0.1.0`; no ML runtime, model, provider or telemetry collector is pulled in by this package. ```sh constellation help diff --git a/packages/wsp-toolkit/packages/contracts/README.md b/packages/wsp-toolkit/packages/contracts/README.md index c392cd554..a83467bc1 100644 --- a/packages/wsp-toolkit/packages/contracts/README.md +++ b/packages/wsp-toolkit/packages/contracts/README.md @@ -1,6 +1,18 @@ -# ruvnet-constellation-contracts +# ruvnet-constellation-contracts — bounded package and module metadata -Dependency-free ESM metadata contracts for the constellation catalog and satellite module manifests. Node 20.9+ or browsers with `TextEncoder`/`URL`. This candidate has not been published. +Validate bounded constellation catalogs and module manifests without installing a neural runtime. These metadata contracts identify formats; they do not replace numerical validation or prove registry ownership. + +**Topics:** package catalogs · module contracts · JSON validation · dependency-free metadata. + +```sh +npm install ruvnet-constellation-contracts@0.1.0 +``` + +[Package on npm](https://www.npmjs.com/package/ruvnet-constellation-contracts) · [Core 0.2.0 entrypoint: `ruv-fann/contracts`](https://github.com/ruvnet/ruv-FANN/tree/main/packages/core#capability-entrypoints) · [Interactive ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/) · [Toolkit API and release guide](https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit#readme) + +Choose this standalone package for its declared dependency footprint, or use `ruv-fann/contracts` from the complete `ruv-fann@0.2.0` facade. Package version: **0.1.0**. [Umbrella release and evidence](https://github.com/ruvnet/ruv-FANN/releases/tag/ruv-fann-toolkit-v0.2.0). + +Dependency-free ESM metadata contracts for the constellation catalog and satellite module manifests. Node 20.9+ or browsers with `TextEncoder`/`URL`. `validateCatalog(value)` and `validateModuleManifest(value)` return owned, validated JSON data. They reject unknown fields, accessors, sparse arrays, duplicate identifiers, unsafe npm names/paths/URLs, unversioned schema IDs and excessive data. A catalog can contain up to 1,000 packages and 64 profiles within a 2 MiB canonical byte budget. `published` is caller-supplied status; validation does not prove namespace ownership or check a registry. diff --git a/packages/wsp-toolkit/packages/huggingface/README.md b/packages/wsp-toolkit/packages/huggingface/README.md index e35e8d4f4..26e0accae 100644 --- a/packages/wsp-toolkit/packages/huggingface/README.md +++ b/packages/wsp-toolkit/packages/huggingface/README.md @@ -1,9 +1,23 @@ -# ruv-fann-wsp-huggingface +# ruv-fann-wsp-huggingface — integrity-pinned dense checkpoints + +Load a public dense-layer JSON checkpoint from an immutable Hub commit and verify its exact bytes before parsing. An explicit affine-head adapter covers simple weight vectors without pretending to load an arbitrary transformer. + +**Topics:** Hugging Face Hub · dense JSON checkpoints · SHA-256 integrity · affine heads. + +```sh +npm install ruv-fann-wsp-huggingface@0.1.0 +``` + +[Package on npm](https://www.npmjs.com/package/ruv-fann-wsp-huggingface) · [Core 0.2.0 entrypoint: `ruv-fann/huggingface`](https://github.com/ruvnet/ruv-FANN/tree/main/packages/core#capability-entrypoints) · [Interactive ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/) · [Toolkit API and release guide](https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit#readme) + +Choose this standalone package for its declared dependency footprint, or use `ruv-fann/huggingface` from the complete `ruv-fann@0.2.0` facade. Package version: **0.1.0**. [Umbrella release and evidence](https://github.com/ruvnet/ruv-FANN/releases/tag/ruv-fann-toolkit-v0.2.0). Load a public Hugging Face **dense-layers JSON** checkpoint using an immutable commit revision and a caller-supplied SHA-256. The adapter verifies downloaded bytes before parsing and validates the model with `ruv-fann-wsp@0.2.0`. +Configuration template: replace the repository, immutable commit and independently reviewed raw-file digest before running. + ```js import { loadHubModel } from 'ruv-fann-wsp-huggingface'; diff --git a/packages/wsp-toolkit/packages/invariants/README.md b/packages/wsp-toolkit/packages/invariants/README.md index 38f73fdd3..4c1d6e019 100644 --- a/packages/wsp-toolkit/packages/invariants/README.md +++ b/packages/wsp-toolkit/packages/invariants/README.md @@ -1,10 +1,26 @@ -# ruv-fann-wsp-invariants +# ruv-fann-wsp-invariants — finite-domain neural output checks + +Check expected outputs and inclusive bounds over an explicit, finite set of inputs. Exhaustive Boolean cases can cover a small binary domain; they do not prove behavior over arbitrary real inputs or deployment conditions. + +**Topics:** neural output constraints · exhaustive Boolean domains · bounded WASM evaluation · invariant suites. + +```sh +npm install ruv-fann-wsp-invariants@0.1.0 +``` + +[Package on npm](https://www.npmjs.com/package/ruv-fann-wsp-invariants) · [Core 0.2.0 entrypoint: `ruv-fann/invariants`](https://github.com/ruvnet/ruv-FANN/tree/main/packages/core#capability-entrypoints) · [Interactive ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/) · [Toolkit API and release guide](https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit#readme) + +Choose this standalone package for its declared dependency footprint, or use `ruv-fann/invariants` from the complete `ruv-fann@0.2.0` facade. Package version: **0.1.0**. [Umbrella release and evidence](https://github.com/ruvnet/ruv-FANN/releases/tag/ruv-fann-toolkit-v0.2.0). Bounded output constraints evaluated with real `ruv-fann@0.1.2` scalar/SIMD WebAssembly. ESM, Node 20.9+ and secure-context browsers; no gradients, providers or automatic promotion. ```js import { checkModelInvariants, createBooleanInvariant } from 'ruv-fann-wsp-invariants'; +const candidateModel = {schema: 'ruv-fann.dense-layers/1', layers: [ + {inputs: 2, outputs: 2, weights: [1,-1,-1,1], bias: [0,0], activation: 'ReLU', steepness: 1}, + {inputs: 2, outputs: 1, weights: [1,1], bias: [0], activation: 'Linear', steepness: 1} +]}; const suite = createBooleanInvariant({inputs: 2, outputs: 1, targets: [0, 1, 1, 0]}); const result = await checkModelInvariants(candidateModel, suite, {simd: false}); if (!result.accepted) console.log(result.violations); diff --git a/packages/wsp-toolkit/packages/lifecycle/README.md b/packages/wsp-toolkit/packages/lifecycle/README.md index a0fe30197..6a91313a8 100644 --- a/packages/wsp-toolkit/packages/lifecycle/README.md +++ b/packages/wsp-toolkit/packages/lifecycle/README.md @@ -1,4 +1,16 @@ -# ruv-fann-wsp-lifecycle +# ruv-fann-wsp-lifecycle — regression gates and checkpoint branches + +Evaluate several named datasets against the same bounded weight patch, or compare isolated candidate snapshots. A passing result is evidence; your application still controls promotion. + +**Topics:** neural model regression testing · independent holdouts · checkpoint branches · CI gates. + +```sh +npm install ruv-fann-wsp-lifecycle@0.1.0 +``` + +[Package on npm](https://www.npmjs.com/package/ruv-fann-wsp-lifecycle) · [Core 0.2.0 entrypoint: `ruv-fann/lifecycle`](https://github.com/ruvnet/ruv-FANN/tree/main/packages/core#capability-entrypoints) · [Interactive ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/) · [Toolkit API and release guide](https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit#readme) + +Choose this standalone package for its declared dependency footprint, or use `ruv-fann/lifecycle` from the complete `ruv-fann@0.2.0` facade. Package version: **0.1.0**. [Umbrella release and evidence](https://github.com/ruvnet/ruv-FANN/releases/tag/ruv-fann-toolkit-v0.2.0). Multi-suite regression gates and in-memory candidate branch evaluation around `ruv-fann-wsp@0.2.0`. ESM; Node 20.9+; browser-compatible library, Node-only CLI. diff --git a/packages/wsp-toolkit/packages/loop/README.md b/packages/wsp-toolkit/packages/loop/README.md index 2ba4e34c4..1212ccd71 100644 --- a/packages/wsp-toolkit/packages/loop/README.md +++ b/packages/wsp-toolkit/packages/loop/README.md @@ -1,7 +1,21 @@ -# ruv-fann-wsp-loop +# ruv-fann-wsp-loop — bounded neural weight evolution + +Coordinate proposal workers, independent held-out suites, finite-domain checks and a supplied revision authority. Runs stop at explicit work, proposal, round, deadline and cancellation limits. + +**Topics:** adaptive neural weights · independent holdouts · proposal workers · explicit revision promotion. + +```sh +npm install ruv-fann-wsp-loop@0.1.0 +``` + +[Package on npm](https://www.npmjs.com/package/ruv-fann-wsp-loop) · [Core 0.2.0 entrypoint: `ruv-fann/loop`](https://github.com/ruvnet/ruv-FANN/tree/main/packages/core#capability-entrypoints) · [Interactive ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/) · [Toolkit API and release guide](https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit#readme) + +Choose this standalone package for its declared dependency footprint, or use `ruv-fann/loop` from the complete `ruv-fann@0.2.0` facade. Package version: **0.1.0**. [Umbrella release and evidence](https://github.com/ruvnet/ruv-FANN/releases/tag/ruv-fann-toolkit-v0.2.0). A bounded, local autonomous weight-evolution coordinator. Fixed-operation worker threads propose patches; the coordinator independently evaluates trusted regression suites and output constraints; AgentDB's internal proposal IDs and expected revisions authorize local checkpoint promotion. The loop runs no generated code, provider requests, shell commands, public publishing or financial transactions. +Integration sketch: the registry must already contain the module, and the named datasets/constraints below are application-owned inputs. For a complete persistent example, run `npm run demo:loop` from the source toolkit workspace. + ```js import { runEvolutionLoop } from 'ruv-fann-wsp-loop'; const report = await runEvolutionLoop({ diff --git a/packages/wsp-toolkit/packages/registry/README.md b/packages/wsp-toolkit/packages/registry/README.md index 5027be0c9..32cbd2fce 100644 --- a/packages/wsp-toolkit/packages/registry/README.md +++ b/packages/wsp-toolkit/packages/registry/README.md @@ -1,4 +1,16 @@ -# ruv-fann-wsp-registry +# ruv-fann-wsp-registry — AgentDB revisions and durability acknowledgement + +Adapt an application-owned AgentDB WeightPrograms controller into a bounded serialized API. Explicit persistence callbacks distinguish an acknowledged durable mutation from a memory-only update. + +**Topics:** AgentDB weight programs · revision CAS · durable acknowledgements · rollback history. + +```sh +npm install ruv-fann-wsp-registry@0.1.0 +``` + +[Package on npm](https://www.npmjs.com/package/ruv-fann-wsp-registry) · [Core 0.2.0 entrypoint: `ruv-fann/registry`](https://github.com/ruvnet/ruv-FANN/tree/main/packages/core#capability-entrypoints) · [Interactive ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/) · [Toolkit API and release guide](https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit#readme) + +Choose this standalone package for its declared dependency footprint, or use `ruv-fann/registry` from the complete `ruv-fann@0.2.0` facade. Package version: **0.1.0**. [Umbrella release and evidence](https://github.com/ruvnet/ruv-FANN/releases/tag/ruv-fann-toolkit-v0.2.0). Adapt a caller-owned real AgentDB `WeightPrograms` controller into a serialized promise API with explicit persistence acknowledgement. ESM, Node 20.9+. AgentDB 3.10.0 is an optional peer; the library never installs it or opens a database automatically. diff --git a/packages/wsp-toolkit/packages/ruos/README.md b/packages/wsp-toolkit/packages/ruos/README.md index 889a7acba..7c1a53585 100644 --- a/packages/wsp-toolkit/packages/ruos/README.md +++ b/packages/wsp-toolkit/packages/ruos/README.md @@ -1,4 +1,16 @@ -# ruv-fann-wsp-ruos +# ruv-fann-wsp-ruos — WASM canaries and executor completion checks + +Run a real numerical lifecycle canary and check trusted executor-owned completion metadata. Use this for operational validation of a supplied host; a matching response is a consistency check, not cryptographic attestation. + +**Topics:** ruOS validation · WASM canary · checkpoint rollback · executor completion. + +```sh +npm install ruv-fann-wsp-ruos@0.1.0 +``` + +[Package on npm](https://www.npmjs.com/package/ruv-fann-wsp-ruos) · [Core 0.2.0 entrypoint: `ruv-fann/ruos`](https://github.com/ruvnet/ruv-FANN/tree/main/packages/core#capability-entrypoints) · [Interactive ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/) · [Toolkit API and release guide](https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit#readme) + +Choose this standalone package for its declared dependency footprint, or use `ruv-fann/ruos` from the complete `ruv-fann@0.2.0` facade. Package version: **0.1.0**. [Umbrella release and evidence](https://github.com/ruvnet/ruv-FANN/releases/tag/ruv-fann-toolkit-v0.2.0). `runWasmCanary()` exercises the real scalar WASM backend: two-weight XOR repair, exhaustive activation oracle, rejected neuron ablation, numerical sensitivity and revision-safe rollback. It throws on any failed assertion. This Node/browser function has no desktop connection or credentials. diff --git a/packages/wsp-toolkit/packages/search/README.md b/packages/wsp-toolkit/packages/search/README.md index b9ab5fc12..bff7631f0 100644 --- a/packages/wsp-toolkit/packages/search/README.md +++ b/packages/wsp-toolkit/packages/search/README.md @@ -1,11 +1,25 @@ -# ruv-fann-wsp-search +# ruv-fann-wsp-search — bounded neural weight search + +Search a small, explicit set of neural parameters using real WASM predictions. Reuse the baseline measurement, screen bounded candidates and independently validate the winner before asking your application to activate it. + +**Topics:** weight-space programming · coordinate search · Boolean truth tables · Hebbian proposals. + +```sh +npm install ruv-fann-wsp-search@0.1.0 +``` + +[Package on npm](https://www.npmjs.com/package/ruv-fann-wsp-search) · [Core 0.2.0 entrypoint: `ruv-fann/search`](https://github.com/ruvnet/ruv-FANN/tree/main/packages/core#capability-entrypoints) · [Interactive ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/) · [Toolkit API and release guide](https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit#readme) + +Choose this standalone package for its declared dependency footprint, or use `ruv-fann/search` from the complete `ruv-fann@0.2.0` facade. Package version: **0.1.0**. [Umbrella release and evidence](https://github.com/ruvnet/ruv-FANN/releases/tag/ruv-fann-toolkit-v0.2.0). Bounded discrete coordinate search with real WASM inference, plus explicit experimental truth-table compilation and Hebbian patch proposals. ESM, Node 20.9+ and secure-context browsers. Depends on `ruv-fann-wsp@0.2.0` and `ruv-fann@0.1.2`. +Integration sketch: supply `model`, `developmentCases` and your trusted acceptance policy. Keep independent holdout cases away from search. + ```js import { searchWeightPatch } from 'ruv-fann-wsp-search'; -const result = await searchWeightPatch(model, heldOutCases, { +const result = await searchWeightPatch(model, developmentCases, { maxMSE: 0, maxRegressionMSE: 0 }, { locations: [ diff --git a/packages/wsp-toolkit/packages/swarm/README.md b/packages/wsp-toolkit/packages/swarm/README.md index 59149a752..dac975888 100644 --- a/packages/wsp-toolkit/packages/swarm/README.md +++ b/packages/wsp-toolkit/packages/swarm/README.md @@ -1,7 +1,21 @@ -# ruv-fann-wsp-swarm +# ruv-fann-wsp-swarm — bounded Node.js proposal workers + +Schedule fixed-operation proposal jobs in actual Node.js workers with separate WASM instances. The coordinator receives candidate data and diagnostic metrics; workers never receive promotion authority. + +**Topics:** Node.js worker threads · parallel weight proposals · work budgets · cancellation. + +```sh +npm install ruv-fann-wsp-swarm@0.1.0 +``` + +[Package on npm](https://www.npmjs.com/package/ruv-fann-wsp-swarm) · [Core 0.2.0 entrypoint: `ruv-fann/swarm`](https://github.com/ruvnet/ruv-FANN/tree/main/packages/core#capability-entrypoints) · [Interactive ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/) · [Toolkit API and release guide](https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit#readme) + +Choose this standalone package for its declared dependency footprint, or use `ruv-fann/swarm` from the complete `ruv-fann@0.2.0` facade. Package version: **0.1.0**. [Umbrella release and evidence](https://github.com/ruvnet/ruv-FANN/releases/tag/ruv-fann-toolkit-v0.2.0). A bounded scheduler for actual Node `worker_threads`. Each worker executes a shipped, fixed operation with its own JavaScript/WASM runtime. No provider call, generated JavaScript, shell command, model publication or checkpoint promotion is exposed. Worker threads are **not a security sandbox**. +Integration sketch: supply a dense `model`, development `dataset`, acceptance `policy` and explicit parameter `locations`. + ```js import { runProposalSwarm, estimateSwarmWork } from 'ruv-fann-wsp-swarm'; diff --git a/packages/wsp-toolkit/packages/telemetry/README.md b/packages/wsp-toolkit/packages/telemetry/README.md index 3faded215..13fc9fb03 100644 --- a/packages/wsp-toolkit/packages/telemetry/README.md +++ b/packages/wsp-toolkit/packages/telemetry/README.md @@ -1,7 +1,21 @@ -# ruvnet-constellation-telemetry +# ruvnet-constellation-telemetry — public package observations and local dashboards + +Collect public package observations only when invoked, then render a standalone HTML dashboard. Joint adoption needs a separate consenting project sample; download correlations cannot establish an attach rate. + +**Topics:** npm download observations · GitHub activity · consenting adoption samples · offline dashboard. + +```sh +npm install ruvnet-constellation-telemetry@0.1.0 +``` + +[Package on npm](https://www.npmjs.com/package/ruvnet-constellation-telemetry) · [Core 0.2.0 entrypoint: `ruv-fann/telemetry`](https://github.com/ruvnet/ruv-FANN/tree/main/packages/core#capability-entrypoints) · [Interactive ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/) · [Toolkit API and release guide](https://github.com/ruvnet/ruv-FANN/tree/main/packages/wsp-toolkit#readme) + +Choose this standalone package for its declared dependency footprint, or use `ruv-fann/telemetry` from the complete `ruv-fann@0.2.0` facade. Package version: **0.1.0**. [Umbrella release and evidence](https://github.com/ruvnet/ruv-FANN/releases/tag/ruv-fann-toolkit-v0.2.0). Dependency-free public package observations, explicitly sampled project attach metrics, and a standalone interactive dashboard. ESM; Node 20.9+; no install hooks, SDKs, provider calls, hidden collection or uploads. +Integration sketch: supply a validated constellation `catalog`; the call performs explicit public network reads. + ```js import { collectPublicMetrics, analyzeConstellation, renderConstellationDashboard } from 'ruvnet-constellation-telemetry'; From fd645195adddb917502f310d30e17cef14b89649 Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 23:10:16 -0500 Subject: [PATCH 18/20] docs: pin animated diagrams and validate npm-friendly package crosslinks --- README.md | 2 +- packages/core/README.md | 4 ++-- packages/wsp-toolkit/README.md | 2 +- packages/wsp-toolkit/packages/cloudflare/README.md | 4 ++-- packages/wsp-toolkit/packages/constellation/README.md | 4 ++-- packages/wsp-toolkit/packages/contracts/README.md | 4 ++-- packages/wsp-toolkit/packages/huggingface/README.md | 4 ++-- packages/wsp-toolkit/packages/invariants/README.md | 4 ++-- packages/wsp-toolkit/packages/lifecycle/README.md | 4 ++-- packages/wsp-toolkit/packages/loop/README.md | 4 ++-- packages/wsp-toolkit/packages/registry/README.md | 4 ++-- packages/wsp-toolkit/packages/ruos/README.md | 4 ++-- packages/wsp-toolkit/packages/search/README.md | 4 ++-- packages/wsp-toolkit/packages/swarm/README.md | 4 ++-- packages/wsp-toolkit/packages/telemetry/README.md | 4 ++-- 15 files changed, 28 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 0b4fc5995..0aebd71d3 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ of those results and their limits. ## Bounded weight improvement with independent evaluation -[![Workers propose weight edits, independent holdout and finite-domain gates check candidates, and AgentDB controls revision CAS and explicit rollback.](https://raw.githubusercontent.com/ruvnet/ruv-FANN/main/docs/assets/wsp-toolkit-loop.svg)](https://ruvnet.github.io/ruv-FANN/) +[![Workers propose weight edits, independent holdout and finite-domain gates check candidates, and AgentDB controls revision CAS and explicit rollback.](https://raw.githubusercontent.com/ruvnet/ruv-FANN/e573ed708dcc4a5705990f3a8991deaefcf8be74/docs/assets/wsp-toolkit-loop.svg)](https://ruvnet.github.io/ruv-FANN/) **[Explore the animated field guide →](https://ruvnet.github.io/ruv-FANN/)** diff --git a/packages/core/README.md b/packages/core/README.md index 4b810c4ef..2f21f0373 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -4,11 +4,11 @@ Build small neural networks you can **run, train, inspect and change locally**.

- Animated ruv-fann weight programming diagram: run a neural network, propose a bounded weight edit, validate independent gates and explicitly promote a revision. + Animated ruv-fann weight programming diagram: run a neural network, propose a bounded weight edit, validate independent gates and explicitly promote a revision.

-[Explore the interactive field guide and live WASM demo](https://ruvnet.github.io/ruv-FANN/) · [View the illustrated workflow](https://raw.githubusercontent.com/ruvnet/ruv-FANN/main/packages/core/assets/weight-toolkit.svg) +[Explore the interactive field guide and live WASM demo](https://ruvnet.github.io/ruv-FANN/) · [View the illustrated workflow](https://raw.githubusercontent.com/ruvnet/ruv-FANN/e573ed708dcc4a5705990f3a8991deaefcf8be74/packages/core/assets/weight-toolkit.svg) [![npm version](https://img.shields.io/npm/v/ruv-fann?color=2d7068)](https://www.npmjs.com/package/ruv-fann) [![License: MIT](https://img.shields.io/badge/license-MIT-172c2b)](https://github.com/ruvnet/ruv-FANN/blob/main/packages/core/LICENSE) diff --git a/packages/wsp-toolkit/README.md b/packages/wsp-toolkit/README.md index f31febae0..67cd42178 100644 --- a/packages/wsp-toolkit/README.md +++ b/packages/wsp-toolkit/README.md @@ -2,7 +2,7 @@ Build a local improvement loop for small dense neural networks: propose a bounded weight edit, evaluate independent cases, check finite-domain output rules and explicitly activate a revision through your application's authority. Twelve ESM/TypeScript packages expose focused APIs for search, validation, worker coordination, checkpoint transport and package discovery. -[![Bounded neural weight evolution: proposal workers feed independent holdout and invariant gates, then AgentDB revision CAS and explicit rollback.](https://raw.githubusercontent.com/ruvnet/ruv-FANN/main/docs/assets/wsp-toolkit-loop.svg)](https://ruvnet.github.io/ruv-FANN/) +[![Bounded neural weight evolution: proposal workers feed independent holdout and invariant gates, then AgentDB revision CAS and explicit rollback.](https://raw.githubusercontent.com/ruvnet/ruv-FANN/e573ed708dcc4a5705990f3a8991deaefcf8be74/docs/assets/wsp-toolkit-loop.svg)](https://ruvnet.github.io/ruv-FANN/) **[Explore the illustrated field guide and real WASM demo →](https://ruvnet.github.io/ruv-FANN/)** diff --git a/packages/wsp-toolkit/packages/cloudflare/README.md b/packages/wsp-toolkit/packages/cloudflare/README.md index cf9738b01..306743678 100644 --- a/packages/wsp-toolkit/packages/cloudflare/README.md +++ b/packages/wsp-toolkit/packages/cloudflare/README.md @@ -52,8 +52,8 @@ This package stores no checkpoints, accepts no generated code, and exposes no pr -Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). +Explore the [ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/), [constellation onramp](https://www.npmjs.com/package/ruvnet-constellation) and [shared contracts](https://www.npmjs.com/package/ruvnet-constellation-contracts). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). -These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. +These links describe integrations; package.json defines install-time dependencies. The [versioned catalog](https://github.com/ruvnet/ruv-FANN/blob/main/packages/wsp-toolkit/packages/constellation/catalog.json) declares release profiles and package versions; registry availability and publication provenance require independent verification. diff --git a/packages/wsp-toolkit/packages/constellation/README.md b/packages/wsp-toolkit/packages/constellation/README.md index 76d66970e..4291f55cc 100644 --- a/packages/wsp-toolkit/packages/constellation/README.md +++ b/packages/wsp-toolkit/packages/constellation/README.md @@ -32,8 +32,8 @@ All commands are local unless the user separately runs a package manager or prov -Explore the [constellation onramp](README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). +Explore the [ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/), [constellation onramp](https://www.npmjs.com/package/ruvnet-constellation) and [shared contracts](https://www.npmjs.com/package/ruvnet-constellation-contracts). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). -These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. +These links describe integrations; package.json defines install-time dependencies. The [versioned catalog](https://github.com/ruvnet/ruv-FANN/blob/main/packages/wsp-toolkit/packages/constellation/catalog.json) declares release profiles and package versions; registry availability and publication provenance require independent verification. diff --git a/packages/wsp-toolkit/packages/contracts/README.md b/packages/wsp-toolkit/packages/contracts/README.md index a83467bc1..1a228b2b9 100644 --- a/packages/wsp-toolkit/packages/contracts/README.md +++ b/packages/wsp-toolkit/packages/contracts/README.md @@ -24,8 +24,8 @@ No SDK, native driver, provider, telemetry collector, network client or install -Explore the [constellation onramp](../constellation/README.md) and [shared contracts](README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). +Explore the [ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/), [constellation onramp](https://www.npmjs.com/package/ruvnet-constellation) and [shared contracts](https://www.npmjs.com/package/ruvnet-constellation-contracts). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). -These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. +These links describe integrations; package.json defines install-time dependencies. The [versioned catalog](https://github.com/ruvnet/ruv-FANN/blob/main/packages/wsp-toolkit/packages/constellation/catalog.json) declares release profiles and package versions; registry availability and publication provenance require independent verification. diff --git a/packages/wsp-toolkit/packages/huggingface/README.md b/packages/wsp-toolkit/packages/huggingface/README.md index 26e0accae..39d1020d3 100644 --- a/packages/wsp-toolkit/packages/huggingface/README.md +++ b/packages/wsp-toolkit/packages/huggingface/README.md @@ -70,8 +70,8 @@ use injected transports and explicitly do not claim live Hub execution. -Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). +Explore the [ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/), [constellation onramp](https://www.npmjs.com/package/ruvnet-constellation) and [shared contracts](https://www.npmjs.com/package/ruvnet-constellation-contracts). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). -These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. +These links describe integrations; package.json defines install-time dependencies. The [versioned catalog](https://github.com/ruvnet/ruv-FANN/blob/main/packages/wsp-toolkit/packages/constellation/catalog.json) declares release profiles and package versions; registry availability and publication provenance require independent verification. diff --git a/packages/wsp-toolkit/packages/invariants/README.md b/packages/wsp-toolkit/packages/invariants/README.md index 4c1d6e019..ce14ee395 100644 --- a/packages/wsp-toolkit/packages/invariants/README.md +++ b/packages/wsp-toolkit/packages/invariants/README.md @@ -48,8 +48,8 @@ There are at most 16 cases, 1,024 total rows, 131,072 scalar suite elements, 2 M -Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). +Explore the [ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/), [constellation onramp](https://www.npmjs.com/package/ruvnet-constellation) and [shared contracts](https://www.npmjs.com/package/ruvnet-constellation-contracts). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). -These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. +These links describe integrations; package.json defines install-time dependencies. The [versioned catalog](https://github.com/ruvnet/ruv-FANN/blob/main/packages/wsp-toolkit/packages/constellation/catalog.json) declares release profiles and package versions; registry availability and publication provenance require independent verification. diff --git a/packages/wsp-toolkit/packages/lifecycle/README.md b/packages/wsp-toolkit/packages/lifecycle/README.md index 6a91313a8..d8a4b2577 100644 --- a/packages/wsp-toolkit/packages/lifecycle/README.md +++ b/packages/wsp-toolkit/packages/lifecycle/README.md @@ -20,8 +20,8 @@ Multi-suite regression gates and in-memory candidate branch evaluation around `r -Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). +Explore the [ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/), [constellation onramp](https://www.npmjs.com/package/ruvnet-constellation) and [shared contracts](https://www.npmjs.com/package/ruvnet-constellation-contracts). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). -These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. +These links describe integrations; package.json defines install-time dependencies. The [versioned catalog](https://github.com/ruvnet/ruv-FANN/blob/main/packages/wsp-toolkit/packages/constellation/catalog.json) declares release profiles and package versions; registry availability and publication provenance require independent verification. diff --git a/packages/wsp-toolkit/packages/loop/README.md b/packages/wsp-toolkit/packages/loop/README.md index 1212ccd71..6c05fa36e 100644 --- a/packages/wsp-toolkit/packages/loop/README.md +++ b/packages/wsp-toolkit/packages/loop/README.md @@ -47,8 +47,8 @@ Output invariants provide finite-domain evidence. This package claims no univers -Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). +Explore the [ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/), [constellation onramp](https://www.npmjs.com/package/ruvnet-constellation) and [shared contracts](https://www.npmjs.com/package/ruvnet-constellation-contracts). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). -These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. +These links describe integrations; package.json defines install-time dependencies. The [versioned catalog](https://github.com/ruvnet/ruv-FANN/blob/main/packages/wsp-toolkit/packages/constellation/catalog.json) declares release profiles and package versions; registry availability and publication provenance require independent verification. diff --git a/packages/wsp-toolkit/packages/registry/README.md b/packages/wsp-toolkit/packages/registry/README.md index 32cbd2fce..201a5ee27 100644 --- a/packages/wsp-toolkit/packages/registry/README.md +++ b/packages/wsp-toolkit/packages/registry/README.md @@ -41,8 +41,8 @@ The toolkit's separate `tooling/agentdb` fixture installs the real controller an -Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). +Explore the [ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/), [constellation onramp](https://www.npmjs.com/package/ruvnet-constellation) and [shared contracts](https://www.npmjs.com/package/ruvnet-constellation-contracts). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). -These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. +These links describe integrations; package.json defines install-time dependencies. The [versioned catalog](https://github.com/ruvnet/ruv-FANN/blob/main/packages/wsp-toolkit/packages/constellation/catalog.json) declares release profiles and package versions; registry availability and publication provenance require independent verification. diff --git a/packages/wsp-toolkit/packages/ruos/README.md b/packages/wsp-toolkit/packages/ruos/README.md index 7c1a53585..5a4226033 100644 --- a/packages/wsp-toolkit/packages/ruos/README.md +++ b/packages/wsp-toolkit/packages/ruos/README.md @@ -20,8 +20,8 @@ Choose this standalone package for its declared dependency footprint, or use `ru -Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). +Explore the [ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/), [constellation onramp](https://www.npmjs.com/package/ruvnet-constellation) and [shared contracts](https://www.npmjs.com/package/ruvnet-constellation-contracts). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). -These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. +These links describe integrations; package.json defines install-time dependencies. The [versioned catalog](https://github.com/ruvnet/ruv-FANN/blob/main/packages/wsp-toolkit/packages/constellation/catalog.json) declares release profiles and package versions; registry availability and publication provenance require independent verification. diff --git a/packages/wsp-toolkit/packages/search/README.md b/packages/wsp-toolkit/packages/search/README.md index bff7631f0..e2420e5a2 100644 --- a/packages/wsp-toolkit/packages/search/README.md +++ b/packages/wsp-toolkit/packages/search/README.md @@ -62,8 +62,8 @@ Run `npm test` in the package or `npm test` from the toolkit workspace after ins -Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). +Explore the [ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/), [constellation onramp](https://www.npmjs.com/package/ruvnet-constellation) and [shared contracts](https://www.npmjs.com/package/ruvnet-constellation-contracts). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). -These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. +These links describe integrations; package.json defines install-time dependencies. The [versioned catalog](https://github.com/ruvnet/ruv-FANN/blob/main/packages/wsp-toolkit/packages/constellation/catalog.json) declares release profiles and package versions; registry availability and publication provenance require independent verification. diff --git a/packages/wsp-toolkit/packages/swarm/README.md b/packages/wsp-toolkit/packages/swarm/README.md index dac975888..187699b7e 100644 --- a/packages/wsp-toolkit/packages/swarm/README.md +++ b/packages/wsp-toolkit/packages/swarm/README.md @@ -37,8 +37,8 @@ All results remain untrusted proposals. An independent coordinator must apply pa -Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). +Explore the [ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/), [constellation onramp](https://www.npmjs.com/package/ruvnet-constellation) and [shared contracts](https://www.npmjs.com/package/ruvnet-constellation-contracts). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). -These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. +These links describe integrations; package.json defines install-time dependencies. The [versioned catalog](https://github.com/ruvnet/ruv-FANN/blob/main/packages/wsp-toolkit/packages/constellation/catalog.json) declares release profiles and package versions; registry availability and publication provenance require independent verification. diff --git a/packages/wsp-toolkit/packages/telemetry/README.md b/packages/wsp-toolkit/packages/telemetry/README.md index 13fc9fb03..a51194ad0 100644 --- a/packages/wsp-toolkit/packages/telemetry/README.md +++ b/packages/wsp-toolkit/packages/telemetry/README.md @@ -49,8 +49,8 @@ Public metrics are point-in-time observations. Users must supply an accurate cat -Explore the [constellation onramp](../constellation/README.md) and [shared contracts](../contracts/README.md). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). +Explore the [ruv-fann field guide](https://ruvnet.github.io/ruv-FANN/), [constellation onramp](https://www.npmjs.com/package/ruvnet-constellation) and [shared contracts](https://www.npmjs.com/package/ruvnet-constellation-contracts). Optional ecosystem primitives: [ruv-fann-wsp](https://www.npmjs.com/package/ruv-fann-wsp), [AgentDB](https://www.npmjs.com/package/agentdb), [RuVector](https://www.npmjs.com/package/ruvector). Optional orchestration: [MetaHarness](https://www.npmjs.com/package/metaharness) and [Ruflo](https://www.npmjs.com/package/ruflo). -These links describe integrations; they do not add install-time dependencies. Workspace package candidates and namespace proposals are listed explicitly in the catalog. +These links describe integrations; package.json defines install-time dependencies. The [versioned catalog](https://github.com/ruvnet/ruv-FANN/blob/main/packages/wsp-toolkit/packages/constellation/catalog.json) declares release profiles and package versions; registry availability and publication provenance require independent verification. From 52b1fb6feb24f6711939d8dd48e432acb5fe1488 Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 23:14:45 -0500 Subject: [PATCH 19/20] ci: retire automatic legacy pair qualification and route current core through toolkit --- .github/workflows/ci.yml | 7 +++++++ .github/workflows/npm-modules.yml | 22 ++++++++++++---------- .github/workflows/wsp-toolkit.yml | 18 ++++++++++++++++-- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78d79eb48..cda8eaec4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,13 @@ env: RUST_BACKTRACE: 1 jobs: + # Current npm generation: core 0.2.0 plus twelve exact toolkit satellites. + # The former npm-modules.yml pair lane is manual/reusable for 0.1.2 refs only. + npm-toolkit: + uses: ./.github/workflows/wsp-toolkit.yml + with: + expected_sha: ${{ github.event.pull_request.head.sha || github.sha }} + wasm-targets: uses: ./.github/workflows/wasm-build.yml diff --git a/.github/workflows/npm-modules.yml b/.github/workflows/npm-modules.yml index 6d91497b8..1c196d62a 100644 --- a/.github/workflows/npm-modules.yml +++ b/.github/workflows/npm-modules.yml @@ -1,21 +1,14 @@ name: npm modules +# Frozen publication contract for the ruv-fann-wasm/ruv-fann 0.1.2 pair. +# Invoke manually/reusably at a legacy source ref only. Current core and +# satellite qualification lives in wsp-toolkit.yml and is called by CI. on: workflow_call: inputs: release_tag: required: false type: string - pull_request: - branches: [main] - paths: - - 'packages/wasm/**' - # Frozen 0.1.x WASM/core pair. Core 0.2.0 and its exact satellite - # dependency graph are qualified together by wsp-toolkit.yml. - - 'scripts/npm-modules-*.mjs' - - 'scripts/npm-release-*.mjs' - - '.github/workflows/npm-modules.yml' - - '.github/workflows/protected-npm-modules.yml' workflow_dispatch: permissions: @@ -31,6 +24,15 @@ jobs: with: persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} + - name: Require the frozen legacy package generation + run: | + node --input-type=module <<'JS' + import {readFileSync} from 'node:fs'; + const core=JSON.parse(readFileSync('packages/core/package.json','utf8')); + const wasm=JSON.parse(readFileSync('packages/wasm/package.json','utf8')); + if(core.version!=='0.1.2'||wasm.version!=='0.1.2'||core.dependencies?.['ruv-fann-wasm']!=='0.1.2') + throw Error('This manual legacy lane qualifies only the frozen core/WASM 0.1.2 pair; use wsp-toolkit.yml for core 0.2.0 and its satellites.'); + JS - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: '22.13.0' diff --git a/.github/workflows/wsp-toolkit.yml b/.github/workflows/wsp-toolkit.yml index 40e1475a7..7df0035bf 100644 --- a/.github/workflows/wsp-toolkit.yml +++ b/.github/workflows/wsp-toolkit.yml @@ -1,6 +1,12 @@ name: WSP toolkit qualification on: + workflow_call: + inputs: + expected_sha: + description: Exact reviewed source requested by the caller + required: true + type: string pull_request: branches: [main] paths: @@ -13,6 +19,11 @@ on: - '.github/workflows/protected-toolkit-release.yml' - '.github/workflows/constellation-observatory.yml' - '.github/workflows/wsp-toolkit.yml' + - '.github/workflows/ci.yml' + - '.github/workflows/npm-modules.yml' + - '.github/workflows/protected-npm-modules.yml' + - 'scripts/npm-release-*.mjs' + - 'scripts/npm-modules-*.mjs' workflow_dispatch: inputs: expected_sha: @@ -24,7 +35,7 @@ permissions: contents: read concurrency: - group: toolkit-qualification-${{ github.event.pull_request.head.sha || inputs.expected_sha || github.sha }} + group: toolkit-qualification-${{ github.workflow }}-${{ github.event.pull_request.head.sha || inputs.expected_sha || github.sha }} cancel-in-progress: false jobs: @@ -40,7 +51,10 @@ jobs: - name: Require exact requested source env: EXPECTED_SHA: ${{ github.event.pull_request.head.sha || inputs.expected_sha || github.sha }} - run: test "$(git rev-parse HEAD)" = "$EXPECTED_SHA" + CALLER_SHA: ${{ inputs.expected_sha }} + run: | + test "$(git rev-parse HEAD)" = "$EXPECTED_SHA" + if test -n "$CALLER_SHA"; then test "$CALLER_SHA" = "$EXPECTED_SHA"; fi - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: '22.23.2' From 1bd72c040da59ad9b581b77d26e877fecfa227cd Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 10 Nov 2026 23:15:33 -0500 Subject: [PATCH 20/20] docs(release): distinguish current toolkit CI from the frozen npm pair --- docs/constellation-release.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/constellation-release.md b/docs/constellation-release.md index 3297671fb..aad622ed0 100644 --- a/docs/constellation-release.md +++ b/docs/constellation-release.md @@ -12,6 +12,10 @@ The `ruv-fann-toolkit-v0.2.0` release contains thirteen new npm archives: `ruv-f | [protected-toolkit-release.yml](../.github/workflows/protected-toolkit-release.yml) | Core facade plus twelve toolkit archives | Existing protected npm credential bootstraps the new packages | | [constellation-oidc.mjs](../scripts/constellation-oidc.mjs) | Optional future configuration guard | Requires deliberately opted-in, package-specific npm trusted-publisher registration | +Current CI calls `wsp-toolkit.yml` for the core 0.2.0 release set. The older +`npm-modules.yml` pair lane remains available only by explicit manual or reusable +invocation against its 0.1.2 generation; it rejects newer package identities. + A package's catalog status, a successful local pack or possession of the helper does not establish namespace ownership, a registered trusted publisher or permission to upload. The optional OIDC helper is not the active bootstrap publisher, and this documentation does not claim a live OIDC exchange. ## Exact archives move through qualification and publication