@womp/spark-agent 0.3.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -11
- package/dist/agent.js +1 -1
- package/dist/client.js +15 -15
- package/dist/context.d.ts +1 -1
- package/dist/context.js +4 -6
- package/dist/generated/scene-declarations.d.ts +1 -1
- package/dist/generated/scene-declarations.js +1 -1
- package/dist/kakapo-capability.d.ts +44 -5
- package/dist/kakapo-capability.js +155 -36
- package/dist/kakapo.d.ts +5 -4
- package/dist/kakapo.js +6 -2
- package/dist/pricing.js +29 -9
- package/dist/runtime.d.ts +36 -17
- package/dist/runtime.js +119 -137
- package/dist/server/express.js +4 -2
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/standalone.js +9 -3
- package/dist/server/store.js +1 -3
- package/package.json +7 -4
- package/.env.example +0 -4
- package/dist/coordinates.d.ts +0 -22
- package/dist/coordinates.js +0 -123
- package/dist/generated/kakapo-declarations.d.ts +0 -1
- package/dist/generated/kakapo-declarations.js +0 -3
- package/dist/kakapo-capability-api.d.ts +0 -18
- package/dist/kakapo-capability-api.js +0 -1
- package/dist/kakapo-scene-skill.d.ts +0 -1
- package/dist/kakapo-scene-skill.js +0 -54
- package/dist/womp-scene-api.d.ts +0 -246
- package/dist/womp-scene-api.js +0 -844
package/dist/runtime.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KakapoAPI } from "@womp/kakapo-sdk";
|
|
2
|
+
import { createSceneApi } from "@womp/scene-api";
|
|
3
|
+
import { createKakapoSceneStore, createKakapoTransaction, } from "@womp/scene-api/adapters/kakapo";
|
|
2
4
|
import { QuickJSJavaScriptExecutor } from "./quickjs-executor.js";
|
|
3
|
-
import { createWompSceneApi } from "./womp-scene-api.js";
|
|
4
5
|
function safeValue(value) {
|
|
5
6
|
if (value instanceof Uint8Array)
|
|
6
7
|
return { bytes: value.byteLength };
|
|
@@ -13,15 +14,73 @@ function safeValue(value) {
|
|
|
13
14
|
return String(value);
|
|
14
15
|
}
|
|
15
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Kakapo has no library-material concept, so `pending` stays absent -- the
|
|
19
|
+
* "backing with no queue" case `@womp/scene-api`'s `MaterialCatalog` documents.
|
|
20
|
+
* `nodeSetMaterialId` with a NAME still fails loudly rather than silently
|
|
21
|
+
* dropping the assignment.
|
|
22
|
+
*/
|
|
23
|
+
const KAKAPO_MATERIAL_CATALOG = {
|
|
24
|
+
listSuperMaterialNames: () => [],
|
|
25
|
+
};
|
|
26
|
+
export async function composeKakapoSceneSeams(engine, fonts) {
|
|
27
|
+
// Prefetched because `listFonts()` is an async RPC while the seam's
|
|
28
|
+
// `listFontFamilies` is synchronous.
|
|
29
|
+
const resolved = fonts ?? (await engine.listFonts());
|
|
30
|
+
let captured;
|
|
31
|
+
await engine.editScene((scene) => {
|
|
32
|
+
captured = scene;
|
|
33
|
+
});
|
|
34
|
+
if (captured === undefined) {
|
|
35
|
+
throw new Error("engine.editScene() resolved without invoking its callback.");
|
|
36
|
+
}
|
|
37
|
+
const edit = captured;
|
|
38
|
+
return {
|
|
39
|
+
store: createKakapoSceneStore(edit, engine, { fonts: resolved }),
|
|
40
|
+
transaction: createKakapoTransaction(engine),
|
|
41
|
+
scene: () => edit.getScene(),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* `createSceneApi` returns `Record<string, unknown>` (its `SceneScriptApi`), so
|
|
46
|
+
* naming it as the draft the capability declares takes one cast. It is not a
|
|
47
|
+
* blind one: `test/kakapo-capability.test.ts`'s "the generated skill documents
|
|
48
|
+
* the exact executable draft surface" asserts set equality between
|
|
49
|
+
* `WompSceneDraft`'s members and the functions this object actually exposes, in
|
|
50
|
+
* both directions, so a drift on either side fails a test rather than surfacing
|
|
51
|
+
* as a `TypeError` inside a model-authored script.
|
|
52
|
+
*/
|
|
53
|
+
export function asSceneDraft(api) {
|
|
54
|
+
return api;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Records every WRITE method invoked on `store`, in call order, once the call
|
|
58
|
+
* has succeeded -- the `sdkCalls` the old per-call `sceneCall` wrapper
|
|
59
|
+
* reported. Read methods (`get*`/`list*`/`child*`) were never routed through it
|
|
60
|
+
* either, and are excluded so `sdkCalls` says what the script CHANGED rather
|
|
61
|
+
* than what it merely inspected. Ported from `@womp/spark-agent-host`.
|
|
62
|
+
*/
|
|
63
|
+
function trackedStore(store, calls) {
|
|
64
|
+
const readPrefixes = ["get", "list", "child"];
|
|
65
|
+
return new Proxy(store, {
|
|
66
|
+
get(target, property, receiver) {
|
|
67
|
+
const value = Reflect.get(target, property, receiver);
|
|
68
|
+
if (typeof value !== "function" || typeof property !== "string")
|
|
69
|
+
return value;
|
|
70
|
+
if (readPrefixes.some((prefix) => property.startsWith(prefix)))
|
|
71
|
+
return value.bind(target);
|
|
72
|
+
return (...args) => {
|
|
73
|
+
const result = value.apply(target, args);
|
|
74
|
+
calls.push(property);
|
|
75
|
+
return result;
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
16
80
|
export class KakapoRuntime {
|
|
17
81
|
api;
|
|
18
|
-
rootId = 0;
|
|
19
|
-
defaultMaterialId;
|
|
20
82
|
calls = [];
|
|
21
|
-
|
|
22
|
-
materialNames = new Map();
|
|
23
|
-
createdIds = new Set();
|
|
24
|
-
fonts = [];
|
|
83
|
+
seams;
|
|
25
84
|
executor;
|
|
26
85
|
eventSink;
|
|
27
86
|
constructor(url, executorOrEventSink, eventSink) {
|
|
@@ -45,15 +104,21 @@ export class KakapoRuntime {
|
|
|
45
104
|
}
|
|
46
105
|
async connect() {
|
|
47
106
|
await this.sdkCall("connect", [], () => this.api.connect());
|
|
48
|
-
|
|
49
|
-
this.
|
|
107
|
+
const fonts = await this.sdkCall("listFonts", [], () => this.api.listFonts());
|
|
108
|
+
this.seams = await composeKakapoSceneSeams(this.api, fonts);
|
|
50
109
|
}
|
|
51
110
|
disconnect() {
|
|
52
111
|
this.api.disconnect();
|
|
53
112
|
}
|
|
54
113
|
async sdkCall(method, args, action) {
|
|
55
114
|
const callId = crypto.randomUUID();
|
|
56
|
-
this.emit({
|
|
115
|
+
this.emit({
|
|
116
|
+
type: "sdk-call",
|
|
117
|
+
callId,
|
|
118
|
+
method,
|
|
119
|
+
status: "running",
|
|
120
|
+
args: safeValue(args),
|
|
121
|
+
});
|
|
57
122
|
try {
|
|
58
123
|
const value = await action();
|
|
59
124
|
this.calls.push(method);
|
|
@@ -77,111 +142,23 @@ export class KakapoRuntime {
|
|
|
77
142
|
throw error;
|
|
78
143
|
}
|
|
79
144
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
try {
|
|
84
|
-
const value = action();
|
|
85
|
-
this.calls.push(method);
|
|
86
|
-
this.emit({ type: "sdk-call", callId, method, status: "complete", result: safeValue(value) });
|
|
87
|
-
return value;
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
this.emit({
|
|
91
|
-
type: "sdk-call",
|
|
92
|
-
callId,
|
|
93
|
-
method,
|
|
94
|
-
status: "error",
|
|
95
|
-
error: error instanceof Error ? error.message : String(error),
|
|
96
|
-
});
|
|
97
|
-
throw error;
|
|
145
|
+
requireSeams(caller) {
|
|
146
|
+
if (this.seams === undefined) {
|
|
147
|
+
throw new Error(`${caller}: connect() must resolve before the scene can be reached.`);
|
|
98
148
|
}
|
|
149
|
+
return this.seams;
|
|
99
150
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
scene,
|
|
106
|
-
engine: this.api,
|
|
107
|
-
rootId: this.rootId,
|
|
108
|
-
getDefaultMaterialId: () => {
|
|
109
|
-
if (this.defaultMaterialId !== undefined)
|
|
110
|
-
return this.defaultMaterialId;
|
|
111
|
-
const material = this.sceneCall("createMaterial", [], () => scene.createMaterial({
|
|
112
|
-
color: { x: 189 / 255, y: 189 / 255, z: 189 / 255 },
|
|
113
|
-
roughness: 0.22,
|
|
114
|
-
}));
|
|
115
|
-
this.defaultMaterialId = material.id;
|
|
116
|
-
this.materialIds.add(material.id);
|
|
117
|
-
this.materialNames.set(material.id, "Default Material");
|
|
118
|
-
return material.id;
|
|
119
|
-
},
|
|
120
|
-
fonts: this.fonts,
|
|
121
|
-
requireNode: (id) => this.requireNode(id),
|
|
122
|
-
trackNode: (id) => this.createdIds.add(id),
|
|
123
|
-
trackMaterial: (id) => this.materialIds.add(id),
|
|
124
|
-
untrackMaterial: (id) => {
|
|
125
|
-
this.materialIds.delete(id);
|
|
126
|
-
this.materialNames.delete(id);
|
|
127
|
-
},
|
|
128
|
-
listMaterialIds: () => this.api.listMaterials().map(({ id }) => id),
|
|
129
|
-
requireMaterial: (id) => {
|
|
130
|
-
this.api.getMaterial(id);
|
|
131
|
-
},
|
|
132
|
-
getMaterialName: (id) => this.materialNames.get(id) ?? `Material ${id}`,
|
|
133
|
-
setMaterialName: (id, name) => this.materialNames.set(id, name),
|
|
134
|
-
call: (method, args, action) => this.sceneCall(method, args, action),
|
|
135
|
-
callAsync: (method, args, action) => this.sdkCall(method, args, action),
|
|
151
|
+
sceneApi(seams, print) {
|
|
152
|
+
return createSceneApi({
|
|
153
|
+
store: trackedStore(seams.store, this.calls),
|
|
154
|
+
transaction: seams.transaction,
|
|
155
|
+
catalog: KAKAPO_MATERIAL_CATALOG,
|
|
136
156
|
print,
|
|
137
157
|
});
|
|
138
158
|
}
|
|
139
|
-
async inspect() {
|
|
140
|
-
await this.api.refreshScene();
|
|
141
|
-
return { revision: await this.sceneRevision(), scene: this.api.getScene() };
|
|
142
|
-
}
|
|
143
|
-
async sceneRevision() {
|
|
144
|
-
const bytes = new TextEncoder().encode(JSON.stringify(this.api.getScene()));
|
|
145
|
-
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
146
|
-
return Array.from(new Uint8Array(digest), (value) => value.toString(16).padStart(2, "0")).join("");
|
|
147
|
-
}
|
|
148
|
-
async edit(callback, expectedRevision, context) {
|
|
149
|
-
let callbackCompleted = false;
|
|
150
|
-
let changed = false;
|
|
151
|
-
const receipt = {
|
|
152
|
-
id: crypto.randomUUID(),
|
|
153
|
-
capability: "scene",
|
|
154
|
-
operation: "edit",
|
|
155
|
-
};
|
|
156
|
-
let value;
|
|
157
|
-
try {
|
|
158
|
-
value = await this.api.editScene(async (scene) => {
|
|
159
|
-
context.signal.throwIfAborted();
|
|
160
|
-
if ((await this.sceneRevision()) !== expectedRevision) {
|
|
161
|
-
throw new Error("Scene changed since inspection. Read the scene again before editing.");
|
|
162
|
-
}
|
|
163
|
-
const result = await callback(this.sceneApi(scene, () => undefined));
|
|
164
|
-
context.signal.throwIfAborted();
|
|
165
|
-
changed = (await this.sceneRevision()) !== expectedRevision;
|
|
166
|
-
callbackCompleted = true;
|
|
167
|
-
return result;
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
catch (error) {
|
|
171
|
-
await context.recordReceipt({
|
|
172
|
-
...receipt,
|
|
173
|
-
status: callbackCompleted ? "unknown" : "rolled_back",
|
|
174
|
-
});
|
|
175
|
-
throw error;
|
|
176
|
-
}
|
|
177
|
-
if (changed)
|
|
178
|
-
await context.recordReceipt({ ...receipt, status: "committed" });
|
|
179
|
-
return value;
|
|
180
|
-
}
|
|
181
159
|
async screenshot(input) {
|
|
182
160
|
let targetId;
|
|
183
161
|
if (input.targetId !== undefined) {
|
|
184
|
-
this.requireNode(input.targetId);
|
|
185
162
|
let target = this.api.getNode(input.targetId);
|
|
186
163
|
while (target.parentId !== null && target.parentId !== 0) {
|
|
187
164
|
target = this.api.getNode(target.parentId);
|
|
@@ -201,6 +178,7 @@ export class KakapoRuntime {
|
|
|
201
178
|
return screenshot;
|
|
202
179
|
}
|
|
203
180
|
async execute(code, purpose) {
|
|
181
|
+
const seams = this.requireSeams("execute");
|
|
204
182
|
this.calls = [];
|
|
205
183
|
const logs = [];
|
|
206
184
|
this.emit({ type: "javascript", code, purpose });
|
|
@@ -215,11 +193,15 @@ export class KakapoRuntime {
|
|
|
215
193
|
warn: (...values) => consoleFacade.log("WARN", ...values),
|
|
216
194
|
error: (...values) => consoleFacade.log("ERROR", ...values),
|
|
217
195
|
};
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
196
|
+
let value;
|
|
197
|
+
const globals = {
|
|
198
|
+
...this.sceneApi(seams, (...values) => consoleFacade.log(...values)),
|
|
199
|
+
console: consoleFacade,
|
|
200
|
+
};
|
|
201
|
+
const failure = await seams.transaction.run(async () => {
|
|
202
|
+
value = await this.executor.execute(code, globals, 60_000);
|
|
203
|
+
});
|
|
204
|
+
if (failure === null) {
|
|
223
205
|
const result = {
|
|
224
206
|
ok: true,
|
|
225
207
|
purpose,
|
|
@@ -237,30 +219,30 @@ export class KakapoRuntime {
|
|
|
237
219
|
});
|
|
238
220
|
return result;
|
|
239
221
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
222
|
+
const transactionError = `Transaction rolled back; no scene changes were applied. ${failure.message}`;
|
|
223
|
+
this.emit({
|
|
224
|
+
type: "console",
|
|
225
|
+
text: `Execution error: ${transactionError}`,
|
|
226
|
+
});
|
|
227
|
+
const result = {
|
|
228
|
+
ok: false,
|
|
229
|
+
purpose,
|
|
230
|
+
value: null,
|
|
231
|
+
logs,
|
|
232
|
+
sdkCalls: [...this.calls],
|
|
233
|
+
error: transactionError,
|
|
234
|
+
rolledBack: true,
|
|
235
|
+
};
|
|
236
|
+
this.emit({
|
|
237
|
+
type: "execution-result",
|
|
238
|
+
ok: result.ok,
|
|
239
|
+
purpose: result.purpose,
|
|
240
|
+
value: result.value,
|
|
241
|
+
logs: result.logs,
|
|
242
|
+
sdkCalls: result.sdkCalls,
|
|
243
|
+
error: result.error,
|
|
244
|
+
rolledBack: result.rolledBack,
|
|
245
|
+
});
|
|
246
|
+
return result;
|
|
265
247
|
}
|
|
266
248
|
}
|
package/dist/server/express.js
CHANGED
|
@@ -44,10 +44,12 @@ export function createSparkAgentRouter(options) {
|
|
|
44
44
|
});
|
|
45
45
|
router.post("/conversations", async (request, response) => {
|
|
46
46
|
const ownerId = await resolveOwnerId(request);
|
|
47
|
-
const body = z
|
|
47
|
+
const body = z
|
|
48
|
+
.object({
|
|
48
49
|
id: z.string().min(1).optional(),
|
|
49
50
|
title: z.string().max(200).optional(),
|
|
50
|
-
})
|
|
51
|
+
})
|
|
52
|
+
.parse(request.body ?? {});
|
|
51
53
|
const conversation = await options.service.createConversation(ownerId, body);
|
|
52
54
|
response.status(201).json({ conversation });
|
|
53
55
|
});
|
package/dist/server/index.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export { createSparkRunExecutor, type ResolvedSparkModel, type SparkRunExecutorO
|
|
|
4
4
|
export { SparkAgentService, SparkServiceError } from "./service.js";
|
|
5
5
|
export type { SubmitSparkMessageInput } from "./service.js";
|
|
6
6
|
export { MemorySparkAgentStore } from "./store.js";
|
|
7
|
-
export { createStandaloneSparkAgentApp, type StandaloneSparkAgentOptions
|
|
7
|
+
export { createStandaloneSparkAgentApp, type StandaloneSparkAgentOptions } from "./standalone.js";
|
|
8
8
|
export type { SparkAgentStore, SparkConversation, SparkConversationSummary, SparkRun, SparkRunExecutionContext, SparkRunExecutor, SparkRunSettings, } from "./types.js";
|
package/dist/server/index.js
CHANGED
|
@@ -2,4 +2,4 @@ export { MemorySparkArtifactStore } from "./artifacts.js";
|
|
|
2
2
|
export { createSparkRunExecutor, } from "./executor.js";
|
|
3
3
|
export { SparkAgentService, SparkServiceError } from "./service.js";
|
|
4
4
|
export { MemorySparkAgentStore } from "./store.js";
|
|
5
|
-
export { createStandaloneSparkAgentApp
|
|
5
|
+
export { createStandaloneSparkAgentApp } from "./standalone.js";
|
|
@@ -3,9 +3,9 @@ import { createOpenAI } from "@ai-sdk/openai";
|
|
|
3
3
|
import express from "express";
|
|
4
4
|
import { getSparkModel, SPARK_MODELS } from "../models.js";
|
|
5
5
|
import { KakapoRuntime } from "../runtime.js";
|
|
6
|
-
import { composeCapabilities, createAccountCapability } from "../capabilities.js";
|
|
6
|
+
import { composeCapabilities, createAccountCapability, createSceneCapability, } from "../capabilities.js";
|
|
7
7
|
import { createDemoAccountHost } from "./demo-account.js";
|
|
8
|
-
import {
|
|
8
|
+
import { createKakapoSceneHost } from "../kakapo-capability.js";
|
|
9
9
|
import { QuickJSJavaScriptExecutor } from "../quickjs-executor.js";
|
|
10
10
|
import { sparkModelOptions } from "../model-options.js";
|
|
11
11
|
import { MemorySparkArtifactStore } from "./artifacts.js";
|
|
@@ -25,7 +25,13 @@ export function createStandaloneSparkAgentApp(options) {
|
|
|
25
25
|
return {
|
|
26
26
|
executor: new QuickJSJavaScriptExecutor(),
|
|
27
27
|
capabilities: composeCapabilities({
|
|
28
|
-
|
|
28
|
+
// The unified surface: the same `SceneHost` contract, the same
|
|
29
|
+
// `scene-editing` v2 skill and the same `@womp/scene-api` functions
|
|
30
|
+
// the browser runs on, rather than this package's retired second
|
|
31
|
+
// scene layer.
|
|
32
|
+
scene: createSceneCapability(createKakapoSceneHost(runtime.api, {
|
|
33
|
+
saveImage: (image) => artifactStore.write(context.ownerId, image),
|
|
34
|
+
})),
|
|
29
35
|
...(options.developmentProfile === "demo-account"
|
|
30
36
|
? { account: createAccountCapability(createDemoAccountHost()) }
|
|
31
37
|
: {}),
|
package/dist/server/store.js
CHANGED
|
@@ -63,8 +63,6 @@ export class MemorySparkAgentStore {
|
|
|
63
63
|
const chunks = this.chunks.get(runId);
|
|
64
64
|
if (chunks === undefined)
|
|
65
65
|
throw new Error(`Run ${runId} does not exist.`);
|
|
66
|
-
return chunks
|
|
67
|
-
.filter(({ sequence }) => sequence > afterSequence)
|
|
68
|
-
.map(copy);
|
|
66
|
+
return chunks.filter(({ sequence }) => sequence > afterSequence).map(copy);
|
|
69
67
|
}
|
|
70
68
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@womp/spark-agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Portable skills-based AI agent with local and durable chat transports for Womp",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -84,15 +84,16 @@
|
|
|
84
84
|
"dev:web": "vite --config web/vite.config.ts",
|
|
85
85
|
"start": "node dist/cli.js",
|
|
86
86
|
"web:build": "yarn build && tsc --noEmit -p web/tsconfig.json && vite build --config web/vite.config.ts",
|
|
87
|
-
"test": "yarn build && tsx --tsconfig tsconfig.json --test test/**/*.test.ts && node --input-type=module -e \"await Promise.all([import('@womp/spark-agent'), import('@womp/spark-agent/ui'), import('@womp/spark-agent/client'), import('@womp/spark-agent/server'), import('@womp/spark-agent/express')])\"",
|
|
88
|
-
"test:live": "tsx --tsconfig tsconfig.json test/
|
|
87
|
+
"test": "yarn build && tsx --tsconfig tsconfig.json --test test/**/*.test.ts && node --input-type=module -e \"await Promise.all([import('@womp/spark-agent'), import('@womp/spark-agent/ui'), import('@womp/spark-agent/client'), import('@womp/spark-agent/server'), import('@womp/spark-agent/express'), import('@womp/spark-agent/kakapo')])\"",
|
|
88
|
+
"test:live": "tsx --tsconfig tsconfig.json test/kakapo-runtime.live.ts",
|
|
89
89
|
"prepack": "yarn build"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
92
|
"@ai-sdk/anthropic": "4.0.50",
|
|
93
93
|
"@ai-sdk/openai": "4.0.63",
|
|
94
94
|
"@jitl/quickjs-wasmfile-release-sync": "0.32.0",
|
|
95
|
-
"@womp/kakapo-sdk": "0.
|
|
95
|
+
"@womp/kakapo-sdk": "0.2.0",
|
|
96
|
+
"@womp/scene-api": "0.2.0",
|
|
96
97
|
"ai": "7.0.95",
|
|
97
98
|
"eventsource-parser": "^3.0.6",
|
|
98
99
|
"express": "^5.2.1",
|
|
@@ -108,6 +109,8 @@
|
|
|
108
109
|
"@vitejs/plugin-react": "^6.0.4",
|
|
109
110
|
"concurrently": "^9.2.1",
|
|
110
111
|
"lucide-react": "^1.26.0",
|
|
112
|
+
"prettier": "^3.8.1",
|
|
113
|
+
"pretty-quick": "^4.2.2",
|
|
111
114
|
"react": "^19.2.8",
|
|
112
115
|
"react-dom": "^19.2.8",
|
|
113
116
|
"react-markdown": "^10.1.0",
|
package/.env.example
DELETED
package/dist/coordinates.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Transform, Vec3 } from "@womp/kakapo-sdk";
|
|
2
|
-
export declare const INTERNAL_UNITS_PER_MM: number;
|
|
3
|
-
export declare const WOMP_BLEND_MULTIPLIER = 55;
|
|
4
|
-
export declare const MAX_ENGINE_BLEND = 500;
|
|
5
|
-
export declare const MAX_GOOP_MM: number;
|
|
6
|
-
export declare const MAX_MIRROR_GOOP_MM = 1000;
|
|
7
|
-
export declare function toEnginePosition(value: Vec3): Vec3;
|
|
8
|
-
export declare function fromEnginePosition(value: Vec3): Vec3;
|
|
9
|
-
export declare function toEngineDimensions(value: Vec3): Vec3;
|
|
10
|
-
export declare function fromEngineDimensions(value: Vec3): Vec3;
|
|
11
|
-
export declare function convertRotationBasis(value: Vec3): Vec3;
|
|
12
|
-
export declare function toEngineTransform(input: {
|
|
13
|
-
position?: Vec3;
|
|
14
|
-
rotation?: Vec3;
|
|
15
|
-
dimensions?: Vec3;
|
|
16
|
-
}): Partial<Transform>;
|
|
17
|
-
export declare function toEngineBlend(goopMm: number): number;
|
|
18
|
-
export declare function fromEngineBlend(blend: number): number;
|
|
19
|
-
export declare function toEngineMirrorGoop(goopMm: number): number;
|
|
20
|
-
export type MirrorAxis = "x" | "y" | "z";
|
|
21
|
-
export declare function toEngineMirrorRotation(axis: MirrorAxis): Vec3;
|
|
22
|
-
export declare function fromEngineMirrorRotation(rotation: Vec3): MirrorAxis | undefined;
|
package/dist/coordinates.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
export const INTERNAL_UNITS_PER_MM = 1 / 25;
|
|
2
|
-
export const WOMP_BLEND_MULTIPLIER = 55;
|
|
3
|
-
export const MAX_ENGINE_BLEND = 500;
|
|
4
|
-
export const MAX_GOOP_MM = MAX_ENGINE_BLEND / WOMP_BLEND_MULTIPLIER;
|
|
5
|
-
export const MAX_MIRROR_GOOP_MM = 1000;
|
|
6
|
-
const BASIS = [
|
|
7
|
-
[0, 0, -1],
|
|
8
|
-
[0, 1, 0],
|
|
9
|
-
[-1, 0, 0],
|
|
10
|
-
];
|
|
11
|
-
function clean(value) {
|
|
12
|
-
const rounded = Math.round(value * 1e9) / 1e9;
|
|
13
|
-
return Math.abs(rounded) < 1e-10 ? 0 : rounded;
|
|
14
|
-
}
|
|
15
|
-
export function toEnginePosition(value) {
|
|
16
|
-
return {
|
|
17
|
-
x: clean(-value.z * INTERNAL_UNITS_PER_MM),
|
|
18
|
-
y: clean(value.y * INTERNAL_UNITS_PER_MM),
|
|
19
|
-
z: clean(-value.x * INTERNAL_UNITS_PER_MM),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export function fromEnginePosition(value) {
|
|
23
|
-
return {
|
|
24
|
-
x: clean(-value.z / INTERNAL_UNITS_PER_MM),
|
|
25
|
-
y: clean(value.y / INTERNAL_UNITS_PER_MM),
|
|
26
|
-
z: clean(-value.x / INTERNAL_UNITS_PER_MM),
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
export function toEngineDimensions(value) {
|
|
30
|
-
return {
|
|
31
|
-
x: value.z * INTERNAL_UNITS_PER_MM,
|
|
32
|
-
y: value.y * INTERNAL_UNITS_PER_MM,
|
|
33
|
-
z: value.x * INTERNAL_UNITS_PER_MM,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export function fromEngineDimensions(value) {
|
|
37
|
-
return {
|
|
38
|
-
x: value.z / INTERNAL_UNITS_PER_MM,
|
|
39
|
-
y: value.y / INTERNAL_UNITS_PER_MM,
|
|
40
|
-
z: value.x / INTERNAL_UNITS_PER_MM,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
export function convertRotationBasis(value) {
|
|
44
|
-
// Womp and Kakapo compose and extract Euler angles in XZY order.
|
|
45
|
-
const x = value.x * Math.PI / 180;
|
|
46
|
-
const y = value.y * Math.PI / 180;
|
|
47
|
-
const z = value.z * Math.PI / 180;
|
|
48
|
-
const a = Math.cos(x);
|
|
49
|
-
const b = Math.sin(x);
|
|
50
|
-
const c = Math.cos(y);
|
|
51
|
-
const d = Math.sin(y);
|
|
52
|
-
const e = Math.cos(z);
|
|
53
|
-
const f = Math.sin(z);
|
|
54
|
-
const source = [
|
|
55
|
-
[c * e, -f, d * e],
|
|
56
|
-
[a * c * f + b * d, a * e, a * d * f - b * c],
|
|
57
|
-
[b * c * f - a * d, b * e, b * d * f + a * c],
|
|
58
|
-
];
|
|
59
|
-
const multiply = (left, right) => {
|
|
60
|
-
const cell = (row, column) => left[row][0] * right[0][column] +
|
|
61
|
-
left[row][1] * right[1][column] +
|
|
62
|
-
left[row][2] * right[2][column];
|
|
63
|
-
return [
|
|
64
|
-
[cell(0, 0), cell(0, 1), cell(0, 2)],
|
|
65
|
-
[cell(1, 0), cell(1, 1), cell(1, 2)],
|
|
66
|
-
[cell(2, 0), cell(2, 1), cell(2, 2)],
|
|
67
|
-
];
|
|
68
|
-
};
|
|
69
|
-
const converted = multiply(multiply(BASIS, source), BASIS);
|
|
70
|
-
const convertedZ = Math.asin(Math.min(1, Math.max(-1, -converted[0][1])));
|
|
71
|
-
const nearGimbalLock = Math.abs(converted[0][1]) >= 0.9999999;
|
|
72
|
-
const convertedX = nearGimbalLock
|
|
73
|
-
? Math.atan2(-converted[1][2], converted[2][2])
|
|
74
|
-
: Math.atan2(converted[2][1], converted[1][1]);
|
|
75
|
-
const convertedY = nearGimbalLock
|
|
76
|
-
? 0
|
|
77
|
-
: Math.atan2(converted[0][2], converted[0][0]);
|
|
78
|
-
return {
|
|
79
|
-
x: clean(convertedX * 180 / Math.PI),
|
|
80
|
-
y: clean(convertedY * 180 / Math.PI),
|
|
81
|
-
z: clean(convertedZ * 180 / Math.PI),
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
export function toEngineTransform(input) {
|
|
85
|
-
return {
|
|
86
|
-
...(input.position ? { position: toEnginePosition(input.position) } : {}),
|
|
87
|
-
...(input.rotation ? { rotation: convertRotationBasis(input.rotation) } : {}),
|
|
88
|
-
...(input.dimensions ? { scale: toEngineDimensions(input.dimensions) } : {}),
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
export function toEngineBlend(goopMm) {
|
|
92
|
-
return Math.min(MAX_ENGINE_BLEND, Math.max(0, goopMm * WOMP_BLEND_MULTIPLIER));
|
|
93
|
-
}
|
|
94
|
-
export function fromEngineBlend(blend) {
|
|
95
|
-
return blend / WOMP_BLEND_MULTIPLIER;
|
|
96
|
-
}
|
|
97
|
-
export function toEngineMirrorGoop(goopMm) {
|
|
98
|
-
return Math.min(MAX_MIRROR_GOOP_MM, Math.max(0, goopMm)) * WOMP_BLEND_MULTIPLIER;
|
|
99
|
-
}
|
|
100
|
-
export function toEngineMirrorRotation(axis) {
|
|
101
|
-
if (axis === "x")
|
|
102
|
-
return { x: 0, y: 90, z: 0 };
|
|
103
|
-
if (axis === "y")
|
|
104
|
-
return { x: 0, y: 0, z: 90 };
|
|
105
|
-
return { x: 0, y: 180, z: 0 };
|
|
106
|
-
}
|
|
107
|
-
export function fromEngineMirrorRotation(rotation) {
|
|
108
|
-
const x = rotation.x * Math.PI / 180;
|
|
109
|
-
const y = rotation.y * Math.PI / 180;
|
|
110
|
-
const z = rotation.z * Math.PI / 180;
|
|
111
|
-
const engineNormal = {
|
|
112
|
-
x: Math.cos(y) * Math.cos(z),
|
|
113
|
-
y: Math.cos(x) * Math.sin(z) + Math.sin(x) * Math.cos(z) * Math.sin(y),
|
|
114
|
-
z: Math.sin(x) * Math.sin(z) - Math.cos(x) * Math.cos(z) * Math.sin(y),
|
|
115
|
-
};
|
|
116
|
-
const publicNormal = {
|
|
117
|
-
x: -engineNormal.z,
|
|
118
|
-
y: engineNormal.y,
|
|
119
|
-
z: -engineNormal.x,
|
|
120
|
-
};
|
|
121
|
-
return Object.keys(publicNormal)
|
|
122
|
-
.find((axis) => Math.abs(publicNormal[axis]) > 1 - 1e-6);
|
|
123
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const KAKAPO_DECLARATIONS = "declare const womp: { scene: {\n\"read\": (() => Promise<{\n\"revision\": string;\n\"nodes\": Array<{\n\"id\": number;\n\"name\": string;\n\"kind\": string;\n\"parentId\": null | number;\n}>;\n}>);\n\"edit\": (<T>(callback: ((draft: {\n\"NodeType\": {\n\"Primitive\": 0;\n\"Union\": 1;\n\"Light\": 2;\n\"Curve\": 3;\n\"Group\": 4;\n\"Text\": 5;\n\"Field\": 6;\n\"SVG\": 7;\n\"Mesh\": 8;\n\"Decal\": 9;\n\"OpenSCAD\": 10;\n\"Socket\": 11;\n} & {\n[key: number]: string;\n};\n\"PrimitiveType\": {\n\"Sphere\": 0;\n\"Cylinder\": 1;\n\"Cube\": 2;\n\"Cone\": 3;\n\"Torus\": 4;\n\"Pyramid\": 9;\n} & {\n[key: number]: string;\n};\n\"OperationType\": {\n\"Subtract\": 0;\n\"Union\": 1;\n\"Stain\": 2;\n\"Intersect\": 3;\n} & {\n[key: number]: string;\n};\n\"LightType\": {\n\"Rect\": 0;\n\"Sphere\": 1;\n\"Distant\": 2;\n} & {\n[key: number]: string;\n};\n\"nodeCreate\": ((type: number, parentId?: number) => number);\n\"nodeDelete\": ((id: number) => void);\n\"nodeClone\": ((id: number) => number);\n\"nodeList\": (() => Array<number>);\n\"nodeChildren\": ((parentId: number) => Array<number>);\n\"nodeSetParent\": ((id: number, parentId: number, index?: undefined | number) => void);\n\"nodeGetType\": ((id: number) => number);\n\"nodeGetName\": ((id: number) => string);\n\"nodeSetName\": ((id: number, name: string) => void);\n\"nodeGetParentId\": ((id: number) => number);\n\"nodeGetPos\": ((id: number) => {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n});\n\"nodeSetPos\": ((id: number, position: {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n}) => void);\n\"nodeGetRot\": ((id: number) => {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n});\n\"nodeSetRot\": ((id: number, rotation: {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n}) => void);\n\"nodeGetSize\": ((id: number) => {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n});\n\"nodeSetSize\": ((id: number, sizeValue: {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n}) => void);\n\"nodeGetHide\": ((id: number) => false | true);\n\"nodeSetHide\": ((id: number, hidden: false | true) => void);\n\"nodeGetOp\": ((id: number) => number);\n\"nodeSetOp\": ((id: number, operation: number) => void);\n\"nodeGetBlend\": ((id: number) => number);\n\"nodeSetBlend\": ((id: number, blend: number) => void);\n\"nodeGetRound\": ((id: number) => number);\n\"nodeSetRound\": ((id: number, round: number) => void);\n\"nodeGetColor\": ((id: number) => {\n\"r\": number;\n\"g\": number;\n\"b\": number;\n});\n\"nodeSetColor\": ((id: number, color: {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n} | {\n\"r\": number;\n\"g\": number;\n\"b\": number;\n}) => void);\n\"nodeGetMaterialId\": ((id: number) => null | number);\n\"nodeSetMaterialId\": ((id: number, materialId: number) => void);\n\"nodeGetResolution\": ((id: number) => number);\n\"nodeSetResolution\": ((id: number, resolution: number) => void);\n\"nodeGetLightType\": ((id: number) => number);\n\"nodeSetLightType\": ((id: number, lightType: number) => void);\n\"nodeGetPower\": ((id: number) => number);\n\"nodeSetPower\": ((id: number, power: number) => void);\n\"nodeGetText\": ((id: number) => string);\n\"nodeSetText\": ((id: number, text: string) => void);\n\"nodeGetFont\": ((id: number) => string);\n\"nodeSetFont\": ((id: number, font: string) => void);\n\"nodeGetWeight\": ((id: number) => number);\n\"nodeSetWeight\": ((id: number, weight: number) => void);\n\"nodeGetItalic\": ((id: number) => false | true);\n\"nodeSetItalic\": ((id: number, italic: false | true) => void);\n\"nodeGetAlign\": ((id: number) => number);\n\"nodeSetAlign\": ((id: number, align: number) => void);\n\"nodeGetWrap\": ((id: number) => number);\n\"nodeSetWrap\": ((id: number, wrap: number) => void);\n\"nodeGetWidth\": ((id: number) => number);\n\"nodeSetWidth\": ((id: number, width: number) => void);\n\"nodeGetSpacing\": ((id: number) => number);\n\"nodeSetSpacing\": ((id: number, spacing: number) => void);\n\"nodeGetLineHeight\": ((id: number) => number);\n\"nodeSetLineHeight\": ((id: number, lineHeight: number) => void);\n\"nodeGetDensity\": ((id: number) => number);\n\"nodeSetDensity\": ((id: number, density: number) => void);\n\"nodeGetRoundness\": ((id: number) => number);\n\"nodeSetRoundness\": ((id: number, roundness: number) => void);\n\"nodeGetSmoothing\": ((id: number) => number);\n\"nodeSetSmoothing\": ((id: number, smoothing: number) => void);\n\"nodeGetPrimType\": ((id: number) => number);\n\"nodeSetPrimType\": ((id: number, primitive: number) => void);\n\"nodeGetMirror\": ((id: number, slot: number) => {\n\"axis\": \"x\" | \"y\" | \"z\" | \"disabled\" | \"custom\";\n\"planePosition\": number;\n\"goop\": number;\n});\n\"nodeSetMirror\": ((id: number, slot: number, axis: \"x\" | \"y\" | \"z\" | \"disabled\", planePosition?: number, goop?: number) => void);\n\"nodeGetThickness\": ((id: number) => number);\n\"nodeSetThickness\": ((id: number, thickness: number) => void);\n\"curvePointCount\": ((curveId: number) => number);\n\"curvePointAdd\": ((curveId: number, point?: {\n\"name\"?: undefined | string;\n\"pos\"?: undefined | {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n\"rot\"?: undefined | {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n\"size\"?: undefined | {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n\"fixed\"?: undefined | false | true;\n\"round\"?: undefined | number;\n\"materialId\"?: undefined | string | number;\n}) => number);\n\"curvePointInsert\": ((curveId: number, pointIndex: number, point?: {\n\"name\"?: undefined | string;\n\"pos\"?: undefined | {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n\"rot\"?: undefined | {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n\"size\"?: undefined | {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n\"fixed\"?: undefined | false | true;\n\"round\"?: undefined | number;\n\"materialId\"?: undefined | string | number;\n}) => number);\n\"curvePointRemove\": ((curveId: number, pointIndex: number) => void);\n\"curvePointGetPos\": ((curveId: number, pointIndex: number) => {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n});\n\"curvePointSetPos\": ((curveId: number, pointIndex: number, position: {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n}) => void);\n\"curvePointGetRot\": ((curveId: number, pointIndex: number) => {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n});\n\"curvePointSetRot\": ((curveId: number, pointIndex: number, rotation: {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n}) => void);\n\"curvePointGetSize\": ((curveId: number, pointIndex: number) => {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n});\n\"curvePointSetSize\": ((curveId: number, pointIndex: number, sizeValue: {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n}) => void);\n\"curvePointGetFixed\": ((curveId: number, pointIndex: number) => false | true);\n\"curvePointSetFixed\": ((curveId: number, pointIndex: number, fixed: false | true) => void);\n\"curvePointGetRound\": ((curveId: number, pointIndex: number) => number);\n\"curvePointSetRound\": ((curveId: number, pointIndex: number, round: number) => void);\n\"curvePointGetMaterialId\": ((curveId: number, pointIndex: number) => null | number);\n\"curvePointSetMaterialId\": ((curveId: number, pointIndex: number, materialId: number) => void);\n\"materialCreate\": (() => number);\n\"materialDelete\": ((id: number) => void);\n\"materialList\": (() => Array<number>);\n\"materialGetName\": ((id: number) => string);\n\"materialSetName\": ((id: number, name: string) => void);\n\"materialGetColor\": ((id: number) => {\n\"r\": number;\n\"g\": number;\n\"b\": number;\n});\n\"materialSetColor\": ((id: number, color: {\n\"r\": number;\n\"g\": number;\n\"b\": number;\n}) => void);\n\"materialGetSecondaryColor\": ((id: number) => {\n\"r\": number;\n\"g\": number;\n\"b\": number;\n});\n\"materialSetSecondaryColor\": ((id: number, color: {\n\"r\": number;\n\"g\": number;\n\"b\": number;\n}) => void);\n\"materialGetSubsurfaceColor\": ((id: number) => {\n\"r\": number;\n\"g\": number;\n\"b\": number;\n});\n\"materialSetSubsurfaceColor\": ((id: number, color: {\n\"r\": number;\n\"g\": number;\n\"b\": number;\n}) => void);\n\"materialGetRoughness\": ((id: number) => number);\n\"materialSetRoughness\": ((id: number, value: number) => void);\n\"materialGetMetalness\": ((id: number) => number);\n\"materialSetMetalness\": ((id: number, value: number) => void);\n\"materialGetTransmittance\": ((id: number) => number);\n\"materialSetTransmittance\": ((id: number, value: number) => void);\n\"materialGetTranslucency\": ((id: number) => number);\n\"materialSetTranslucency\": ((id: number, value: number) => void);\n\"materialGetIor\": ((id: number) => number);\n\"materialSetIor\": ((id: number, value: number) => void);\n\"materialGetSheen\": ((id: number) => number);\n\"materialSetSheen\": ((id: number, value: number) => void);\n\"materialGetSheenRoughness\": ((id: number) => number);\n\"materialSetSheenRoughness\": ((id: number, value: number) => void);\n\"materialGetSpecularTint\": ((id: number) => number);\n\"materialSetSpecularTint\": ((id: number, value: number) => void);\n\"materialGetAbsorption\": ((id: number) => number);\n\"materialSetAbsorption\": ((id: number, value: number) => void);\n\"materialGetEmission\": ((id: number) => number);\n\"materialSetEmission\": ((id: number, value: number) => void);\n\"materialGetIridescence\": ((id: number) => number);\n\"materialSetIridescence\": ((id: number, value: number) => void);\n\"materialGetTranslucencyWeight\": ((id: number) => number);\n\"materialSetTranslucencyWeight\": ((id: number, value: number) => void);\n\"materialGetDispersion\": ((id: number) => number);\n\"materialSetDispersion\": ((id: number, value: number) => void);\n\"materialGetSurfaceOpacity\": ((id: number) => number);\n\"materialSetSurfaceOpacity\": ((id: number, value: number) => void);\n\"listFontFamilies\": (() => Array<{\n\"name\": string;\n\"variants\": Array<{\n\"weight\": string;\n\"italic\": false | true;\n}>;\n}>);\n\"print\": ((...values: Array<unknown>) => void);\n\"nodeGetAABB\": ((id: number) => Promise<{\n\"min\": {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n\"max\": {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n}>);\n\"nodeResize\": ((id: number, dimensions: {\n\"x\"?: undefined | number;\n\"y\"?: undefined | number;\n\"z\"?: undefined | number;\n}) => Promise<void>);\n\"aabbCenter\": ((box: {\n\"min\": {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n\"max\": {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n}) => {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n});\n\"aabbRadius\": ((box: {\n\"min\": {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n\"max\": {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n}) => number);\n\"lookAt\": ((origin: {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n}, target: {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n}) => {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n});\n}) => T | Promise<T>), expectedRevision: string) => Promise<T>);\n\"screenshot\": ((input: {\n\"targetId\"?: undefined | number;\n\"view\"?: undefined | \"front\" | \"back\" | \"left\" | \"right\" | \"top\" | \"bottom\" | \"isometric\";\n}) => Promise<{\n\"id\": string;\n\"mediaType\": string;\n\"name\"?: undefined | string;\n}>);\n} };\ndeclare function print(...values: unknown[]): void;\ndeclare function emitImage(ref: { id: string; mediaType: string; name?: string }): Promise<void>;\ndeclare function emitFile(ref: { id: string; mediaType: string; name?: string }): Promise<void>;\n";
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// Generated by scripts/generate-skill-declarations.mjs.
|
|
2
|
-
// prettier-ignore
|
|
3
|
-
export const KAKAPO_DECLARATIONS = "declare const womp: { scene: {\n\"read\": (() => Promise<{\n\"revision\": string;\n\"nodes\": Array<{\n\"id\": number;\n\"name\": string;\n\"kind\": string;\n\"parentId\": null | number;\n}>;\n}>);\n\"edit\": (<T>(callback: ((draft: {\n\"NodeType\": {\n\"Primitive\": 0;\n\"Union\": 1;\n\"Light\": 2;\n\"Curve\": 3;\n\"Group\": 4;\n\"Text\": 5;\n\"Field\": 6;\n\"SVG\": 7;\n\"Mesh\": 8;\n\"Decal\": 9;\n\"OpenSCAD\": 10;\n\"Socket\": 11;\n} & {\n[key: number]: string;\n};\n\"PrimitiveType\": {\n\"Sphere\": 0;\n\"Cylinder\": 1;\n\"Cube\": 2;\n\"Cone\": 3;\n\"Torus\": 4;\n\"Pyramid\": 9;\n} & {\n[key: number]: string;\n};\n\"OperationType\": {\n\"Subtract\": 0;\n\"Union\": 1;\n\"Stain\": 2;\n\"Intersect\": 3;\n} & {\n[key: number]: string;\n};\n\"LightType\": {\n\"Rect\": 0;\n\"Sphere\": 1;\n\"Distant\": 2;\n} & {\n[key: number]: string;\n};\n\"nodeCreate\": ((type: number, parentId?: number) => number);\n\"nodeDelete\": ((id: number) => void);\n\"nodeClone\": ((id: number) => number);\n\"nodeList\": (() => Array<number>);\n\"nodeChildren\": ((parentId: number) => Array<number>);\n\"nodeSetParent\": ((id: number, parentId: number, index?: undefined | number) => void);\n\"nodeGetType\": ((id: number) => number);\n\"nodeGetName\": ((id: number) => string);\n\"nodeSetName\": ((id: number, name: string) => void);\n\"nodeGetParentId\": ((id: number) => number);\n\"nodeGetPos\": ((id: number) => {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n});\n\"nodeSetPos\": ((id: number, position: {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n}) => void);\n\"nodeGetRot\": ((id: number) => {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n});\n\"nodeSetRot\": ((id: number, rotation: {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n}) => void);\n\"nodeGetSize\": ((id: number) => {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n});\n\"nodeSetSize\": ((id: number, sizeValue: {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n}) => void);\n\"nodeGetHide\": ((id: number) => false | true);\n\"nodeSetHide\": ((id: number, hidden: false | true) => void);\n\"nodeGetOp\": ((id: number) => number);\n\"nodeSetOp\": ((id: number, operation: number) => void);\n\"nodeGetBlend\": ((id: number) => number);\n\"nodeSetBlend\": ((id: number, blend: number) => void);\n\"nodeGetRound\": ((id: number) => number);\n\"nodeSetRound\": ((id: number, round: number) => void);\n\"nodeGetColor\": ((id: number) => {\n\"r\": number;\n\"g\": number;\n\"b\": number;\n});\n\"nodeSetColor\": ((id: number, color: {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n} | {\n\"r\": number;\n\"g\": number;\n\"b\": number;\n}) => void);\n\"nodeGetMaterialId\": ((id: number) => null | number);\n\"nodeSetMaterialId\": ((id: number, materialId: number) => void);\n\"nodeGetResolution\": ((id: number) => number);\n\"nodeSetResolution\": ((id: number, resolution: number) => void);\n\"nodeGetLightType\": ((id: number) => number);\n\"nodeSetLightType\": ((id: number, lightType: number) => void);\n\"nodeGetPower\": ((id: number) => number);\n\"nodeSetPower\": ((id: number, power: number) => void);\n\"nodeGetText\": ((id: number) => string);\n\"nodeSetText\": ((id: number, text: string) => void);\n\"nodeGetFont\": ((id: number) => string);\n\"nodeSetFont\": ((id: number, font: string) => void);\n\"nodeGetWeight\": ((id: number) => number);\n\"nodeSetWeight\": ((id: number, weight: number) => void);\n\"nodeGetItalic\": ((id: number) => false | true);\n\"nodeSetItalic\": ((id: number, italic: false | true) => void);\n\"nodeGetAlign\": ((id: number) => number);\n\"nodeSetAlign\": ((id: number, align: number) => void);\n\"nodeGetWrap\": ((id: number) => number);\n\"nodeSetWrap\": ((id: number, wrap: number) => void);\n\"nodeGetWidth\": ((id: number) => number);\n\"nodeSetWidth\": ((id: number, width: number) => void);\n\"nodeGetSpacing\": ((id: number) => number);\n\"nodeSetSpacing\": ((id: number, spacing: number) => void);\n\"nodeGetLineHeight\": ((id: number) => number);\n\"nodeSetLineHeight\": ((id: number, lineHeight: number) => void);\n\"nodeGetDensity\": ((id: number) => number);\n\"nodeSetDensity\": ((id: number, density: number) => void);\n\"nodeGetRoundness\": ((id: number) => number);\n\"nodeSetRoundness\": ((id: number, roundness: number) => void);\n\"nodeGetSmoothing\": ((id: number) => number);\n\"nodeSetSmoothing\": ((id: number, smoothing: number) => void);\n\"nodeGetPrimType\": ((id: number) => number);\n\"nodeSetPrimType\": ((id: number, primitive: number) => void);\n\"nodeGetMirror\": ((id: number, slot: number) => {\n\"axis\": \"x\" | \"y\" | \"z\" | \"disabled\" | \"custom\";\n\"planePosition\": number;\n\"goop\": number;\n});\n\"nodeSetMirror\": ((id: number, slot: number, axis: \"x\" | \"y\" | \"z\" | \"disabled\", planePosition?: number, goop?: number) => void);\n\"nodeGetThickness\": ((id: number) => number);\n\"nodeSetThickness\": ((id: number, thickness: number) => void);\n\"curvePointCount\": ((curveId: number) => number);\n\"curvePointAdd\": ((curveId: number, point?: {\n\"name\"?: undefined | string;\n\"pos\"?: undefined | {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n\"rot\"?: undefined | {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n\"size\"?: undefined | {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n\"fixed\"?: undefined | false | true;\n\"round\"?: undefined | number;\n\"materialId\"?: undefined | string | number;\n}) => number);\n\"curvePointInsert\": ((curveId: number, pointIndex: number, point?: {\n\"name\"?: undefined | string;\n\"pos\"?: undefined | {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n\"rot\"?: undefined | {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n\"size\"?: undefined | {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n\"fixed\"?: undefined | false | true;\n\"round\"?: undefined | number;\n\"materialId\"?: undefined | string | number;\n}) => number);\n\"curvePointRemove\": ((curveId: number, pointIndex: number) => void);\n\"curvePointGetPos\": ((curveId: number, pointIndex: number) => {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n});\n\"curvePointSetPos\": ((curveId: number, pointIndex: number, position: {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n}) => void);\n\"curvePointGetRot\": ((curveId: number, pointIndex: number) => {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n});\n\"curvePointSetRot\": ((curveId: number, pointIndex: number, rotation: {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n}) => void);\n\"curvePointGetSize\": ((curveId: number, pointIndex: number) => {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n});\n\"curvePointSetSize\": ((curveId: number, pointIndex: number, sizeValue: {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n}) => void);\n\"curvePointGetFixed\": ((curveId: number, pointIndex: number) => false | true);\n\"curvePointSetFixed\": ((curveId: number, pointIndex: number, fixed: false | true) => void);\n\"curvePointGetRound\": ((curveId: number, pointIndex: number) => number);\n\"curvePointSetRound\": ((curveId: number, pointIndex: number, round: number) => void);\n\"curvePointGetMaterialId\": ((curveId: number, pointIndex: number) => null | number);\n\"curvePointSetMaterialId\": ((curveId: number, pointIndex: number, materialId: number) => void);\n\"materialCreate\": (() => number);\n\"materialDelete\": ((id: number) => void);\n\"materialList\": (() => Array<number>);\n\"materialGetName\": ((id: number) => string);\n\"materialSetName\": ((id: number, name: string) => void);\n\"materialGetColor\": ((id: number) => {\n\"r\": number;\n\"g\": number;\n\"b\": number;\n});\n\"materialSetColor\": ((id: number, color: {\n\"r\": number;\n\"g\": number;\n\"b\": number;\n}) => void);\n\"materialGetSecondaryColor\": ((id: number) => {\n\"r\": number;\n\"g\": number;\n\"b\": number;\n});\n\"materialSetSecondaryColor\": ((id: number, color: {\n\"r\": number;\n\"g\": number;\n\"b\": number;\n}) => void);\n\"materialGetSubsurfaceColor\": ((id: number) => {\n\"r\": number;\n\"g\": number;\n\"b\": number;\n});\n\"materialSetSubsurfaceColor\": ((id: number, color: {\n\"r\": number;\n\"g\": number;\n\"b\": number;\n}) => void);\n\"materialGetRoughness\": ((id: number) => number);\n\"materialSetRoughness\": ((id: number, value: number) => void);\n\"materialGetMetalness\": ((id: number) => number);\n\"materialSetMetalness\": ((id: number, value: number) => void);\n\"materialGetTransmittance\": ((id: number) => number);\n\"materialSetTransmittance\": ((id: number, value: number) => void);\n\"materialGetTranslucency\": ((id: number) => number);\n\"materialSetTranslucency\": ((id: number, value: number) => void);\n\"materialGetIor\": ((id: number) => number);\n\"materialSetIor\": ((id: number, value: number) => void);\n\"materialGetSheen\": ((id: number) => number);\n\"materialSetSheen\": ((id: number, value: number) => void);\n\"materialGetSheenRoughness\": ((id: number) => number);\n\"materialSetSheenRoughness\": ((id: number, value: number) => void);\n\"materialGetSpecularTint\": ((id: number) => number);\n\"materialSetSpecularTint\": ((id: number, value: number) => void);\n\"materialGetAbsorption\": ((id: number) => number);\n\"materialSetAbsorption\": ((id: number, value: number) => void);\n\"materialGetEmission\": ((id: number) => number);\n\"materialSetEmission\": ((id: number, value: number) => void);\n\"materialGetIridescence\": ((id: number) => number);\n\"materialSetIridescence\": ((id: number, value: number) => void);\n\"materialGetTranslucencyWeight\": ((id: number) => number);\n\"materialSetTranslucencyWeight\": ((id: number, value: number) => void);\n\"materialGetDispersion\": ((id: number) => number);\n\"materialSetDispersion\": ((id: number, value: number) => void);\n\"materialGetSurfaceOpacity\": ((id: number) => number);\n\"materialSetSurfaceOpacity\": ((id: number, value: number) => void);\n\"listFontFamilies\": (() => Array<{\n\"name\": string;\n\"variants\": Array<{\n\"weight\": string;\n\"italic\": false | true;\n}>;\n}>);\n\"print\": ((...values: Array<unknown>) => void);\n\"nodeGetAABB\": ((id: number) => Promise<{\n\"min\": {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n\"max\": {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n}>);\n\"nodeResize\": ((id: number, dimensions: {\n\"x\"?: undefined | number;\n\"y\"?: undefined | number;\n\"z\"?: undefined | number;\n}) => Promise<void>);\n\"aabbCenter\": ((box: {\n\"min\": {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n\"max\": {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n}) => {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n});\n\"aabbRadius\": ((box: {\n\"min\": {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n\"max\": {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n};\n}) => number);\n\"lookAt\": ((origin: {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n}, target: {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n}) => {\n\"x\": number;\n\"y\": number;\n\"z\": number;\n});\n}) => T | Promise<T>), expectedRevision: string) => Promise<T>);\n\"screenshot\": ((input: {\n\"targetId\"?: undefined | number;\n\"view\"?: undefined | \"front\" | \"back\" | \"left\" | \"right\" | \"top\" | \"bottom\" | \"isometric\";\n}) => Promise<{\n\"id\": string;\n\"mediaType\": string;\n\"name\"?: undefined | string;\n}>);\n} };\ndeclare function print(...values: unknown[]): void;\ndeclare function emitImage(ref: { id: string; mediaType: string; name?: string }): Promise<void>;\ndeclare function emitFile(ref: { id: string; mediaType: string; name?: string }): Promise<void>;\n";
|