3D engine that AI agents drive
JavaScript 3d3d-engineagentic-aiai-agentsblenderclaude-codegame-enginegaussian-splattinggltfjavascriptmcpmcp-servermodel-context-protocolpath-tracerpath-tracingpbrrenderingthreejs-alternativewebgl2webgpu
List first-party packages on the marketplace and drop the addon keyword from three-bridge (#1988)
Nguyen Xuan Anf3f7121f5ba3
diff --git a/changes/1988.md b/changes/1988.mdnew file mode 100644index 00000000..2b9c017e--- /dev/null+++ b/changes/1988.md@@ -0,0 +1 @@+- The marketplace lists the companion packages CodePawl publishes on npm (`@codepawlhq/crucible-*`) in their own section with an install command, and `@codepawlhq/crucible-three-bridge` drops the `crucible-addon` keyword because it is a library that registers nothing.diff --git a/packages/three-bridge/README.md b/packages/three-bridge/README.mdindex 4ea43c10..cf8080ce 100644--- a/packages/three-bridge/README.md+++ b/packages/three-bridge/README.md@@ -1,6 +1,6 @@# @codepawlhq/crucible-three-bridge-Optional addon that imports a three.js object tree as Crucible parts and builds three.js meshes from Crucible parts. It imports neither `three` nor Crucible. `three` is a peer dependency of this package only; the core gains none. Not part of the core `crucible` archive and not on npm yet: import it from this folder in a source checkout.+Companion package that imports a three.js object tree as Crucible parts and builds three.js meshes from Crucible parts. It imports neither `three` nor Crucible. `three` is a peer dependency of this package only; the core gains none. Not part of the core `crucible` archive. It is a library, not an addon: it registers nothing, so the MCP server does not load it with `--allow-addon`. It is not on npm yet: import it from this folder in a source checkout.```jsimport * as THREE from 'three';diff --git a/packages/three-bridge/package.json b/packages/three-bridge/package.jsonindex de22f2a4..b5eb2a62 100644--- a/packages/three-bridge/package.json+++ b/packages/three-bridge/package.json@@ -1,7 +1,7 @@{"name": "@codepawlhq/crucible-three-bridge","version": "0.1.0",- "description": "Optional addon that imports a three.js object tree as Crucible parts and builds three.js meshes from Crucible parts. Imports neither three nor Crucible. Not part of the core archive.",+ "description": "Companion package that imports a three.js object tree as Crucible parts and builds three.js meshes from Crucible parts. Imports neither three nor Crucible. Not part of the core archive.","type": "module","main": "./index.mjs","exports": {@@ -12,7 +12,6 @@"README.md"],"keywords": [- "crucible-addon","three","threejs","gltf"diff --git a/site/marketplace.html b/site/marketplace.htmlindex 80f8fdf4..305391cf 100644--- a/site/marketplace.html+++ b/site/marketplace.html@@ -54,6 +54,12 @@</p><div id="addon-list" class="market-list" aria-live="polite"></div></section>+ <section id="packages" aria-labelledby="packages-title">+ <div class="section-heading">+ <h2 id="packages-title">Packages by CodePawl</h2>+ </div>+ <div id="package-list" class="market-list" aria-live="polite"></div>+ </section></main><footer class="site-footer" aria-label="Site footer"><p><a class="brand" href="/" aria-label="Crucible home">Crucible</a> by <a href="https://codepawl.com">CodePawl</a></p>diff --git a/src/marketplace-npm.js b/src/marketplace-npm.jsindex d7660d2b..ee53e4f8 100644--- a/src/marketplace-npm.js+++ b/src/marketplace-npm.js@@ -6,3 +6,23 @@ export function npmManifestPath(name) {if (typeof name !== 'string' || name.length > 214 || !NPM_PACKAGE_NAME.test(name)) return null;return `${encodeURIComponent(name).replace(/^%40/, '@')}/latest`;}++export const FIRST_PARTY_PREFIX = '@codepawlhq/crucible-';+const ADDON_KEYWORD = 'crucible-addon';++/**+ * The companion packages CodePawl publishes beside the engine, from an npm search result: names under+ * `@codepawlhq/crucible-`, valid npm names, and not addons (those carry the `crucible-addon` keyword and list under Addons).+ */+export function firstPartyPackages(searchObjects) {+ if (!Array.isArray(searchObjects)) return [];+ const packages = [];+ for (const object of searchObjects) {+ const entry = object?.package;+ if (typeof entry?.name !== 'string' || !entry.name.startsWith(FIRST_PARTY_PREFIX)) continue;+ if (npmManifestPath(entry.name) === null) continue;+ if (Array.isArray(entry.keywords) && entry.keywords.includes(ADDON_KEYWORD)) continue;+ packages.push({ name: entry.name, version: String(entry.version ?? ''), description: String(entry.description ?? '') });+ }+ return packages.sort((left, right) => left.name.localeCompare(right.name));+}diff --git a/src/marketplace.css b/src/marketplace.cssindex 5a7eab03..d911e7a6 100644--- a/src/marketplace.css+++ b/src/marketplace.css@@ -48,7 +48,7 @@ body.marketplace > main { gap: 40px; }.market-install li { display: grid; gap: 8px; counter-increment: step; }.market-install li p { color: var(--muted); font-size: 15px; }.market-install li p::before { content: counter(step) ". "; font-variant-numeric: tabular-nums; }-.market-install .command-row code { user-select: text; }+.market-install .command-row code, .market-card .command-row code { user-select: text; }.marketplace button, .marketplace .market-button, .marketplace .section-heading a { user-select: none; }diff --git a/src/marketplace.js b/src/marketplace.jsindex b0121d06..4582a969 100644--- a/src/marketplace.js+++ b/src/marketplace.js@@ -1,10 +1,11 @@import './site.css';import './brand.js';import './marketplace.css';-import { npmManifestPath } from './marketplace-npm.js';+import { firstPartyPackages, npmManifestPath } from './marketplace-npm.js';const NPM_SEARCH_URL = 'https://registry.npmjs.org/-/v1/search?text=keywords:crucible-addon&size=50';const NPM_MANIFEST_URL = 'https://registry.npmjs.org/';+const FIRST_PARTY_SEARCH_URL = 'https://registry.npmjs.org/-/v1/search?text=@codepawlhq&size=50';const MAXIMUM_RANGE_LOOKUPS = 20;const CONCURRENT_RANGE_LOOKUPS = 5;const ADDONS_DOC_URL = 'https://github.com/codepawl/crucible/blob/main/docs/addons.md';@@ -200,8 +201,46 @@ async function loadAddons(container) {}}+function packageCard(entry) {+ const card = element('article', 'market-card addon-card');+ const title = element('h3');+ title.append(link(entry.name, npmUrl(entry.name)), element('span', 'market-version', entry.version));+ const body = element('div', 'addon-body');+ body.append(title);+ if (entry.description) body.append(element('p', 'market-description', entry.description));+ const command = `npm install ${entry.name}`;+ const row = element('div', 'command-row');+ row.append(element('code', '', command), copyButton(command));+ body.append(row);+ const npm = link('npm', npmUrl(entry.name), 'market-button market-button-quiet');+ const logo = element('span', 'package-logo package-logo-npm');+ logo.setAttribute('aria-hidden', 'true');+ npm.prepend(logo);+ npm.setAttribute('aria-label', `${entry.name} on npm`);+ card.append(body, npm);+ return card;+}++async function loadFirstPartyPackages(container) {+ showState(container, 'loading', 'Searching npm for packages');+ try {+ const response = await fetch(FIRST_PARTY_SEARCH_URL);+ if (!response.ok) throw new Error(`HTTP ${response.status}`);+ const { objects } = await response.json();+ const packages = firstPartyPackages(objects);+ if (packages.length === 0) {+ showState(container, 'empty', 'No companion packages are published yet.');+ return;+ }+ container.replaceChildren(...packages.map(packageCard));+ } catch {+ showState(container, 'error', 'npm did not answer, so the package list is missing.', link('Open the npm search', 'https://www.npmjs.com/search?q=%40codepawlhq%2Fcrucible-'));+ }+}+document.querySelectorAll('[data-copy]').forEach(button => {button.addEventListener('click', () => copyText(button, button.dataset.copy));});loadPacks(document.querySelector('#pack-list'));loadAddons(document.querySelector('#addon-list'));+loadFirstPartyPackages(document.querySelector('#package-list'));diff --git a/tests/marketplace-npm.test.js b/tests/marketplace-npm.test.jsindex ee5d9f9c..40638cde 100644--- a/tests/marketplace-npm.test.js+++ b/tests/marketplace-npm.test.js@@ -1,6 +1,6 @@import test from 'node:test';import assert from 'node:assert/strict';-import { npmManifestPath } from '../src/marketplace-npm.js';+import { firstPartyPackages, npmManifestPath } from '../src/marketplace-npm.js';test('a plain or scoped npm name becomes its registry manifest path', () => {assert.equal(npmManifestPath('hover-controller'), 'hover-controller/latest');@@ -12,3 +12,24 @@ test('a name that npm would not publish is refused instead of reaching the requeassert.equal(npmManifestPath(name), null, `refuses ${String(name).slice(0, 20)}`);}});++test('only published @codepawlhq/crucible- companion packages are listed, sorted, without addons or the engine', () => {+ const objects = [+ { package: { name: '@codepawlhq/crucible-three-bridge', version: '0.1.0', description: 'three.js bridge', keywords: ['three'] } },+ { package: { name: '@codepawlhq/crucible', version: '0.21.0', description: 'the engine' } },+ { package: { name: '@codepawlhq/crucible-denoise-oidn', version: '0.2.0' } },+ { package: { name: '@codepawlhq/crucible-hover', version: '1.0.0', keywords: ['crucible-addon'] } },+ { package: { name: '@someone/crucible-denoise', version: '1.0.0' } },+ { package: { name: '@codepawlhq/crucible-../x', version: '1.0.0' } },+ { package: null },+ {},+ ];+ assert.deepEqual(firstPartyPackages(objects), [+ { name: '@codepawlhq/crucible-denoise-oidn', version: '0.2.0', description: '' },+ { name: '@codepawlhq/crucible-three-bridge', version: '0.1.0', description: 'three.js bridge' },+ ]);+});++test('a search result that is not a list gives no packages', () => {+ for (const value of [undefined, null, {}, 'x']) assert.deepEqual(firstPartyPackages(value), []);+});