Skip to content

armgit / kiln

Public Imported from GitHub
0

Build and revise procedural 3D assets with your coding agent. Local MCP server, CLI and TypeScript engine with rendered review, editable source and GLB export.

Add Terror in the Jungle asset gallery

Matt Kissinger96389d0b458c
diff --git a/generate.ts b/generate.ts
index a21772d3..dd852822 100644
--- a/generate.ts
+++ b/generate.ts
@@ -85,6 +85,16 @@ const DEFAULT_OPUS_MODEL = 'claude-opus-4-7';
/** The pinned Haiku compaction model. */
const DEFAULT_HAIKU_MODEL = 'claude-haiku-4-5-20251001';
+type QueryMessage = {
+ type?: string;
+ subtype?: string;
+ session_id?: string;
+ structured_output?: { code: string; effectCode?: string };
+ result?: string;
+ errors?: unknown;
+ error?: string;
+};
+
/**
* The `@anthropic-ai/claude-agent-sdk` spawns a nested Claude Code process
* and refuses to run when `CLAUDECODE` or `CLAUDE_CODE_ENTRYPOINT` are set
@@ -306,7 +316,7 @@ Fix these issues before producing the refactored code.`;
* three branches (success / error result / auth failure).
*/
function handleQueryMessage(
- message: Record<string, any>,
+ message: QueryMessage,
fallbackErrorLabel: string
): KilnGenerateResult | null {
if (message['type'] === 'result' && message['subtype'] === 'success') {
@@ -320,7 +330,7 @@ function handleQueryMessage(
sessionId,
};
}
- return parseResultText(message['result'], sessionId);
+ return parseResultText(message['result'] ?? '', sessionId);
}
if (message['type'] === 'result' && message['subtype']?.startsWith('error')) {
const errs = message['errors'];
@@ -365,7 +375,7 @@ async function runRefactorQuery(
});
for await (const message of q) {
- const terminal = handleQueryMessage(message as Record<string, any>, 'Refactor failed');
+ const terminal = handleQueryMessage(message as QueryMessage, 'Refactor failed');
if (terminal) return terminal;
}
@@ -410,7 +420,7 @@ async function runStructuredQuery(
});
for await (const message of q) {
- const terminal = handleQueryMessage(message as Record<string, any>, 'Generation failed');
+ const terminal = handleQueryMessage(message as QueryMessage, 'Generation failed');
if (terminal) return terminal;
}
diff --git a/render.ts b/render.ts
index 07ac9b9c..f4f78450 100644
--- a/render.ts
+++ b/render.ts
@@ -312,7 +312,7 @@ function bridgeNode(
// (same geo + mat as source) produces a GLB-level mesh instance: a
// single Mesh referenced by multiple Nodes. Cuts duplicated accessors
// for wheels, bolts, fence posts, etc.
- const cacheKey = `${(threeObj.geometry as any).uuid}__${(threeMat as any).uuid}`;
+ const cacheKey = `${threeObj.geometry.uuid}__${threeMat.uuid}`;
let gtMesh = meshCache.get(cacheKey);
if (!gtMesh) {
gtMesh = bridgeGeometry(doc, buf, threeObj.geometry, gtMat, threeObj.name || 'mesh');
diff --git a/solids.ts b/solids.ts
index 2856e71c..b396e75d 100644
--- a/solids.ts
+++ b/solids.ts
@@ -24,8 +24,6 @@
*/
import * as THREE from 'three';
-
-// eslint-disable-next-line @typescript-eslint/consistent-type-imports
import type { ManifoldToplevel, Manifold, Mesh } from 'manifold-3d';
// Lazy-init singleton. First call to any CSG op awaits init; subsequent
diff --git a/uv.ts b/uv.ts
index aa79d139..9bc0f976 100644
--- a/uv.ts
+++ b/uv.ts
@@ -1,4 +1,3 @@
-/// <reference path="./xatlasjs-shims.d.ts" />
/**
* Kiln UV unwrapping — Wave 3A
*
@@ -61,14 +60,16 @@ async function getXatlas(): Promise<XatlasApi> {
if (!_xatlasReady) {
_xatlasReady = (async () => {
// xatlasjs publishes a Node-friendly emscripten build under dist/node.
- const apiMod = (await import('xatlasjs/dist/node/api.mjs')) as unknown as {
+ const apiSpecifier = 'xatlasjs/dist/node/api.mjs';
+ const xatlasSpecifier = 'xatlasjs/dist/node/xatlas.js';
+ const apiMod = (await import(apiSpecifier)) as unknown as {
Api: (createModule: unknown) => new (
onLoad: () => void,
locateFile: unknown,
onProgress: unknown
) => XatlasApi;
};
- const xatlasMod = (await import('xatlasjs/dist/node/xatlas.js')) as unknown as {
+ const xatlasMod = (await import(xatlasSpecifier)) as unknown as {
default?: unknown;
};
const create = xatlasMod.default ?? xatlasMod;