Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
import test from 'node:test'
import assert from 'node:assert/strict'
import { buildSync } from 'esbuild'
import { createRequire } from 'node:module'
import { mkdtempSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join, resolve } from 'node:path'
const outfile = join(mkdtempSync(join(tmpdir(), 'forge-scene-source-')), 'scene.cjs')
writeFileSync(outfile, buildSync({ entryPoints: [resolve('src/areas/workflows/workflowSceneSource.ts')], bundle: true, platform: 'node', format: 'cjs', write: false }).outputFiles[0].text)
const {
applySceneValidationResult,
invalidateValidatedScenePath,
resolveSceneSourceManifest,
} = createRequire(import.meta.url)(outfile)
const encoded = Buffer.from(JSON.stringify({ schema: 'three-ws.forge.scene-manifest.v1', sceneRoot: '.', assets: [] })).toString('base64')
test('Load Scene resolves directory and manifest without image bytes', async () => {
for (const scenePath of ['Workflows/room', 'Workflows/room/scene-manifest.json']) {
const result = await resolveSceneSourceManifest({ scenePath, workspaceDir: '/workspace', readFileBase64: async () => encoded })
assert.equal(result.ok, true)
assert.equal(result.manifestWorkspacePath, 'Workflows/room/scene-manifest.json')
}
})
test('Load Scene refuses unsafe paths before reading', async () => {
let reads = 0
for (const scenePath of ['../outside', '/etc/passwd', 'C:/outside', 'Workflows/%2e%2e', 'Workflows/room/']) {
const result = await resolveSceneSourceManifest({ scenePath, workspaceDir: '/workspace', readFileBase64: async () => { reads++; return encoded } })
assert.equal(result.ok, false, scenePath)
}
assert.equal(reads, 0)
})
test('editing a validated Load Scene path clears every derived scene reference', () => {
const params = invalidateValidatedScenePath({
path: 'Workflows/old',
manifestPath: 'Workflows/old/scene-manifest.json',
sceneRoot: '.',
sourceKind: 'directory',
}, 'Workflows/new')
assert.equal(params.path, 'Workflows/new')
assert.equal(params.manifestPath, undefined)
assert.equal(params.sceneRoot, undefined)
assert.equal(params.sourceKind, undefined)
})
test('an async validation result cannot overwrite a subsequently edited path', async () => {
const oldResolution = await resolveSceneSourceManifest({
scenePath: 'Workflows/old',
workspaceDir: '/workspace',
readFileBase64: async () => encoded,
})
assert.equal(oldResolution.ok, true)
const currentParams = invalidateValidatedScenePath({
path: 'Workflows/old',
manifestPath: 'Workflows/old/scene-manifest.json',
sceneRoot: '.',
sourceKind: 'directory',
}, 'Workflows/new')
assert.equal(
applySceneValidationResult(currentParams, 'Workflows/old', oldResolution),
undefined,
)
assert.equal(currentParams.path, 'Workflows/new')
assert.equal(currentParams.manifestPath, undefined)
})
test('Load Scene accepts the legacy upstream schema and normalizes it', async () => {
const legacy = Buffer.from(JSON.stringify({ schema: 'modly.scene-manifest.v1', sceneRoot: '.', assets: [] })).toString('base64')
const result = await resolveSceneSourceManifest({ scenePath: 'Workflows/room', workspaceDir: '/workspace', readFileBase64: async () => legacy })
assert.equal(result.ok, true)
assert.equal(result.manifest.schema, 'three-ws.forge.scene-manifest.v1')
})