@womp/spark-agent 0.1.0 → 0.3.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.
Files changed (113) hide show
  1. package/.env.example +4 -0
  2. package/README.md +295 -49
  3. package/dist/agent-tools.d.ts +30 -0
  4. package/dist/agent-tools.js +189 -0
  5. package/dist/agent.d.ts +34 -7
  6. package/dist/agent.js +223 -158
  7. package/dist/browser.d.ts +2 -0
  8. package/dist/browser.js +2 -0
  9. package/dist/capabilities/account.d.ts +216 -0
  10. package/dist/capabilities/account.js +63 -0
  11. package/dist/capabilities/asset-imports.d.ts +55 -0
  12. package/dist/capabilities/asset-imports.js +117 -0
  13. package/dist/capabilities/assets.d.ts +29 -0
  14. package/dist/capabilities/assets.js +48 -0
  15. package/dist/capabilities/flow.d.ts +29 -0
  16. package/dist/capabilities/flow.js +52 -0
  17. package/dist/capabilities/geometry.d.ts +48 -0
  18. package/dist/capabilities/geometry.js +51 -0
  19. package/dist/capabilities/knowledge.d.ts +11 -0
  20. package/dist/capabilities/knowledge.js +23 -0
  21. package/dist/capabilities/openscad-instructions.d.ts +1 -0
  22. package/dist/capabilities/openscad-instructions.js +81 -0
  23. package/dist/capabilities/openscad.d.ts +54 -0
  24. package/dist/capabilities/openscad.js +34 -0
  25. package/dist/capabilities/operations.d.ts +104 -0
  26. package/dist/capabilities/operations.js +145 -0
  27. package/dist/capabilities/scene-draft.d.ts +404 -0
  28. package/dist/capabilities/scene-draft.js +1 -0
  29. package/dist/capabilities/scene.d.ts +28 -0
  30. package/dist/capabilities/scene.js +51 -0
  31. package/dist/capabilities.d.ts +67 -0
  32. package/dist/capabilities.js +25 -0
  33. package/dist/cli.d.ts +2 -0
  34. package/dist/cli.js +24 -0
  35. package/dist/client.d.ts +43 -0
  36. package/dist/client.js +159 -0
  37. package/dist/context.d.ts +15 -0
  38. package/dist/context.js +264 -0
  39. package/dist/execution-lifetime.d.ts +32 -0
  40. package/dist/execution-lifetime.js +113 -0
  41. package/dist/executor.d.ts +6 -1
  42. package/dist/generated/account-declarations.d.ts +1 -0
  43. package/dist/generated/account-declarations.js +3 -0
  44. package/dist/generated/asset-import-declarations.d.ts +1 -0
  45. package/dist/generated/asset-import-declarations.js +3 -0
  46. package/dist/generated/assets-declarations.d.ts +1 -0
  47. package/dist/generated/assets-declarations.js +3 -0
  48. package/dist/generated/flow-declarations.d.ts +1 -0
  49. package/dist/generated/flow-declarations.js +3 -0
  50. package/dist/generated/geometry-declarations.d.ts +1 -0
  51. package/dist/generated/geometry-declarations.js +3 -0
  52. package/dist/generated/kakapo-declarations.d.ts +1 -0
  53. package/dist/generated/kakapo-declarations.js +3 -0
  54. package/dist/generated/knowledge-declarations.d.ts +1 -0
  55. package/dist/generated/knowledge-declarations.js +3 -0
  56. package/dist/generated/openscad-declarations.d.ts +1 -0
  57. package/dist/generated/openscad-declarations.js +3 -0
  58. package/dist/generated/operations-declarations.d.ts +1 -0
  59. package/dist/generated/operations-declarations.js +3 -0
  60. package/dist/generated/scene-declarations.d.ts +1 -0
  61. package/dist/generated/scene-declarations.js +3 -0
  62. package/dist/index.d.ts +7 -6
  63. package/dist/index.js +5 -3
  64. package/dist/kakapo-capability-api.d.ts +18 -0
  65. package/dist/kakapo-capability-api.js +1 -0
  66. package/dist/kakapo-capability.d.ts +6 -0
  67. package/dist/kakapo-capability.js +50 -0
  68. package/dist/kakapo-scene-skill.d.ts +1 -0
  69. package/dist/kakapo-scene-skill.js +54 -0
  70. package/dist/kakapo.d.ts +5 -0
  71. package/dist/kakapo.js +3 -0
  72. package/dist/local-transport.d.ts +11 -0
  73. package/dist/local-transport.js +15 -0
  74. package/dist/model-history.d.ts +5 -0
  75. package/dist/model-history.js +34 -0
  76. package/dist/model-options.d.ts +4 -0
  77. package/dist/model-options.js +25 -0
  78. package/dist/models.d.ts +3 -15
  79. package/dist/models.js +2 -16
  80. package/dist/native-executor.d.ts +5 -0
  81. package/dist/native-executor.js +92 -0
  82. package/dist/pricing.d.ts +3 -0
  83. package/dist/pricing.js +70 -0
  84. package/dist/prompt.d.ts +1 -1
  85. package/dist/prompt.js +19 -209
  86. package/dist/quickjs-executor.d.ts +13 -0
  87. package/dist/quickjs-executor.js +309 -0
  88. package/dist/runtime.d.ts +16 -5
  89. package/dist/runtime.js +61 -10
  90. package/dist/server/artifacts.d.ts +17 -0
  91. package/dist/server/artifacts.js +36 -0
  92. package/dist/server/demo-account.d.ts +3 -0
  93. package/dist/server/demo-account.js +38 -0
  94. package/dist/server/executor.d.ts +17 -0
  95. package/dist/server/executor.js +35 -0
  96. package/dist/server/express.d.ts +13 -0
  97. package/dist/server/express.js +159 -0
  98. package/dist/server/index.d.ts +8 -0
  99. package/dist/server/index.js +5 -0
  100. package/dist/server/service.d.ts +41 -0
  101. package/dist/server/service.js +402 -0
  102. package/dist/server/standalone.d.ts +9 -0
  103. package/dist/server/standalone.js +85 -0
  104. package/dist/server/store.d.ts +16 -0
  105. package/dist/server/store.js +70 -0
  106. package/dist/server/types.d.ts +53 -0
  107. package/dist/server/types.js +1 -0
  108. package/dist/types.d.ts +3 -27
  109. package/dist/ui.d.ts +224 -0
  110. package/dist/ui.js +71 -0
  111. package/dist/womp-scene-api.d.ts +195 -3
  112. package/dist/womp-scene-api.js +102 -73
  113. package/package.json +66 -10
package/dist/client.js ADDED
@@ -0,0 +1,159 @@
1
+ import { EventSourceParserStream } from "eventsource-parser/stream";
2
+ function isStoredChunk(value) {
3
+ if (value === null || typeof value !== "object")
4
+ return false;
5
+ const chunk = value;
6
+ return Number.isSafeInteger(chunk.sequence) &&
7
+ typeof chunk.conversationId === "string" &&
8
+ typeof chunk.runId === "string" &&
9
+ typeof chunk.createdAt === "string" &&
10
+ chunk.chunk !== null &&
11
+ typeof chunk.chunk === "object";
12
+ }
13
+ async function responseError(response) {
14
+ try {
15
+ const body = await response.json();
16
+ if (typeof body.error === "string")
17
+ return new Error(body.error);
18
+ }
19
+ catch {
20
+ // The status text below is the best available error for a non-JSON response.
21
+ }
22
+ return new Error(`Spark Agent request failed (${response.status} ${response.statusText}).`);
23
+ }
24
+ export class SparkChatTransport {
25
+ api;
26
+ credentials;
27
+ headers;
28
+ fetchImplementation;
29
+ getSettings;
30
+ activeRuns = new Map();
31
+ constructor(options) {
32
+ this.api = options.api.replace(/\/$/u, "");
33
+ this.credentials = options.credentials ?? "same-origin";
34
+ this.headers = options.headers;
35
+ this.fetchImplementation = options.fetch ?? globalThis.fetch.bind(globalThis);
36
+ this.getSettings = options.getSettings;
37
+ }
38
+ async sendMessages(options) {
39
+ const message = options.messageId === undefined
40
+ ? options.messages.at(-1)
41
+ : options.messages.find(({ id }) => id === options.messageId) ?? options.messages.at(-1);
42
+ if (message === undefined)
43
+ throw new Error("Spark Agent requires a message to send.");
44
+ const settings = this.settingsFrom(options.body);
45
+ const response = await this.request(`/conversations/${encodeURIComponent(options.chatId)}/messages`, {
46
+ method: "POST",
47
+ body: JSON.stringify({
48
+ trigger: options.trigger,
49
+ message,
50
+ messageId: options.messageId,
51
+ settings,
52
+ }),
53
+ signal: options.abortSignal,
54
+ }, options.headers);
55
+ if (response.ok === false)
56
+ throw await responseError(response);
57
+ const body = await response.json();
58
+ this.activeRuns.set(options.chatId, body.run.id);
59
+ return this.openRunStream(body.run.id, options.abortSignal, options.headers);
60
+ }
61
+ async reconnectToStream(options) {
62
+ const response = await this.request(`/conversations/${encodeURIComponent(options.chatId)}/active-run`, { method: "GET", signal: options.abortSignal }, options.headers);
63
+ if (response.status === 204)
64
+ return null;
65
+ if (response.ok === false)
66
+ throw await responseError(response);
67
+ const body = await response.json();
68
+ this.activeRuns.set(options.chatId, body.run.id);
69
+ // useChat reconstructs a resumed assistant message from the returned stream.
70
+ // Replay the active message from sequence zero so its prefix is not lost.
71
+ return this.openRunStream(body.run.id, options.abortSignal, options.headers);
72
+ }
73
+ async cancelRun(conversationId) {
74
+ let runId = this.activeRuns.get(conversationId);
75
+ if (runId === undefined) {
76
+ const active = await this.request(`/conversations/${encodeURIComponent(conversationId)}/active-run`, { method: "GET" });
77
+ if (active.status === 204)
78
+ return undefined;
79
+ if (active.ok === false)
80
+ throw await responseError(active);
81
+ const body = await active.json();
82
+ runId = body.run.id;
83
+ }
84
+ const response = await this.request(`/runs/${encodeURIComponent(runId)}/cancel`, { method: "POST" });
85
+ if (response.ok === false)
86
+ throw await responseError(response);
87
+ const body = await response.json();
88
+ this.activeRuns.delete(conversationId);
89
+ return body.run;
90
+ }
91
+ async createConversation(input) {
92
+ const response = await this.request("/conversations", {
93
+ method: "POST",
94
+ body: JSON.stringify(input ?? {}),
95
+ });
96
+ if (response.ok === false)
97
+ throw await responseError(response);
98
+ const body = await response.json();
99
+ return body.conversation;
100
+ }
101
+ async getConversation(id) {
102
+ const response = await this.request(`/conversations/${encodeURIComponent(id)}`, {
103
+ method: "GET",
104
+ });
105
+ if (response.ok === false)
106
+ throw await responseError(response);
107
+ const body = await response.json();
108
+ return body.conversation;
109
+ }
110
+ async listConversations() {
111
+ const response = await this.request("/conversations", { method: "GET" });
112
+ if (response.ok === false)
113
+ throw await responseError(response);
114
+ const body = await response.json();
115
+ return body.conversations;
116
+ }
117
+ settingsFrom(body) {
118
+ const settings = body?.settings ?? this.getSettings?.();
119
+ if (settings === null || typeof settings !== "object") {
120
+ throw new Error("SparkChatTransport requires run settings.");
121
+ }
122
+ return settings;
123
+ }
124
+ async openRunStream(runId, signal, requestHeaders) {
125
+ const response = await this.request(`/runs/${encodeURIComponent(runId)}/stream?after=0`, { method: "GET", signal }, requestHeaders);
126
+ if (response.ok === false)
127
+ throw await responseError(response);
128
+ if (response.body === null)
129
+ throw new Error("Spark Agent returned an empty event stream.");
130
+ return response.body
131
+ .pipeThrough(new TextDecoderStream())
132
+ .pipeThrough(new EventSourceParserStream())
133
+ .pipeThrough(new TransformStream({
134
+ transform(event, controller) {
135
+ if (event.data === "[DONE]")
136
+ return;
137
+ const value = JSON.parse(event.data);
138
+ if (isStoredChunk(value) === false) {
139
+ throw new Error("Spark Agent returned an invalid stored chunk.");
140
+ }
141
+ controller.enqueue(value.chunk);
142
+ },
143
+ }));
144
+ }
145
+ async request(path, init, requestHeaders) {
146
+ const configuredHeaders = typeof this.headers === "function"
147
+ ? await this.headers()
148
+ : this.headers;
149
+ const headers = new Headers(configuredHeaders);
150
+ new Headers(requestHeaders).forEach((value, key) => headers.set(key, value));
151
+ if (init.body !== undefined)
152
+ headers.set("Content-Type", "application/json");
153
+ return this.fetchImplementation(`${this.api}${path}`, {
154
+ ...init,
155
+ credentials: this.credentials,
156
+ headers,
157
+ });
158
+ }
159
+ }
@@ -0,0 +1,15 @@
1
+ import type { ModelMessage } from "ai";
2
+ /** Host input budget, not a claim about a provider's maximum context window. */
3
+ export type SparkContextPolicy = {
4
+ maxInputTokens: number;
5
+ };
6
+ export declare class SparkContextLimitError extends Error {
7
+ constructor();
8
+ }
9
+ /** Approximation for text/code, with a separate allowance for each image/file. */
10
+ export declare function estimateSparkContextTokens(value: unknown): number;
11
+ /**
12
+ * Project model input only. Never mutate persisted messages, remove call/result
13
+ * pairs, summarize user requests, or discard receipts, references, and failures.
14
+ */
15
+ export declare function prepareSparkContext(messages: ModelMessage[], system: string, policy: SparkContextPolicy): ModelMessage[];
@@ -0,0 +1,264 @@
1
+ export class SparkContextLimitError extends Error {
2
+ constructor() {
3
+ super("This conversation is too large to continue without losing required context. Completed work and full history are saved. Start a new conversation with the current target references and remaining task; inspect existing results before retrying any changes.");
4
+ this.name = "SparkContextLimitError";
5
+ }
6
+ }
7
+ function record(value) {
8
+ return typeof value === "object" && value !== null && !Array.isArray(value)
9
+ ? value
10
+ : undefined;
11
+ }
12
+ /** Approximation for text/code, with a separate allowance for each image/file. */
13
+ export function estimateSparkContextTokens(value) {
14
+ let media = 0;
15
+ const json = JSON.stringify(value, (_key, item) => {
16
+ const part = record(item);
17
+ if (part &&
18
+ (part.type === "image" || part.type === "file" || part.type === "reasoning-file")) {
19
+ media++;
20
+ return { type: part.type, mediaType: part.mediaType };
21
+ }
22
+ return item;
23
+ }) ?? "";
24
+ return Math.ceil(new TextEncoder().encode(json).byteLength / 3) + media * 8192;
25
+ }
26
+ function executionOutput(part) {
27
+ if (part.toolName !== "execute_javascript" || part.output.type !== "content")
28
+ return;
29
+ const first = part.output.value[0];
30
+ if (first?.type !== "text")
31
+ return;
32
+ try {
33
+ const value = record(JSON.parse(first.text));
34
+ if (value?.version === 2 && typeof value.ok === "boolean")
35
+ return value;
36
+ }
37
+ catch {
38
+ // Legacy and unrecognized results remain verbatim.
39
+ }
40
+ }
41
+ function shortenSkills(messages, keepLatest) {
42
+ let retained = 0;
43
+ const result = [...messages];
44
+ for (let index = result.length - 1; index >= 0; index--) {
45
+ const message = result[index];
46
+ if (message.role !== "tool")
47
+ continue;
48
+ result[index] = {
49
+ ...message,
50
+ content: message.content.map((part) => {
51
+ if (part.type !== "tool-result" ||
52
+ part.toolName !== "read_skill" ||
53
+ part.output.type !== "json")
54
+ return part;
55
+ const skill = record(part.output.value);
56
+ if (skill?.ok !== true ||
57
+ typeof skill.name !== "string" ||
58
+ (typeof skill.instructions !== "string" && typeof skill.declarations !== "string"))
59
+ return part;
60
+ if (retained++ < keepLatest)
61
+ return part;
62
+ const summary = {
63
+ ok: true,
64
+ name: skill.name,
65
+ version: typeof skill.version === "string" ? skill.version : "",
66
+ contextNote: "This older skill body was removed from model context. Call read_skill again before using its API; do not guess its declarations.",
67
+ };
68
+ if (JSON.stringify(summary).length >= JSON.stringify(skill).length)
69
+ return part;
70
+ return { ...part, output: { type: "json", value: summary } };
71
+ }),
72
+ };
73
+ }
74
+ return result;
75
+ }
76
+ /**
77
+ * Project model input only. Never mutate persisted messages, remove call/result
78
+ * pairs, summarize user requests, or discard receipts, references, and failures.
79
+ */
80
+ export function prepareSparkContext(messages, system, policy) {
81
+ if (!Number.isSafeInteger(policy.maxInputTokens) || policy.maxInputTokens < 1)
82
+ throw new Error("maxInputTokens must be a positive integer.");
83
+ // Reserve room for the two tool schemas and provider message framing.
84
+ const fits = (input) => estimateSparkContextTokens({ system, messages: input }) + 2048 <= policy.maxInputTokens;
85
+ if (fits(messages))
86
+ return messages;
87
+ const seenSkills = new Map();
88
+ const seenOutputs = new Map();
89
+ const compactableCalls = new Set();
90
+ const lastUser = messages.reduce((last, message, index) => (message.role === "user" ? index : last), -1);
91
+ const prepared = messages.map((message) => ({ ...message }));
92
+ for (let index = prepared.length - 1; index >= 0; index--) {
93
+ const message = prepared[index];
94
+ if (message.role !== "tool")
95
+ continue;
96
+ prepared[index] = {
97
+ ...message,
98
+ content: message.content.map((part) => {
99
+ if (part.type !== "tool-result")
100
+ return part;
101
+ if (part.toolName === "read_skill" && part.output.type === "json") {
102
+ const skill = record(part.output.value);
103
+ if (skill?.ok !== true || typeof skill.name !== "string")
104
+ return part;
105
+ const key = JSON.stringify(skill);
106
+ const later = seenSkills.get(key);
107
+ if (later === undefined) {
108
+ seenSkills.set(key, part.toolCallId);
109
+ return part;
110
+ }
111
+ const summary = {
112
+ ok: true,
113
+ name: skill.name,
114
+ version: typeof skill.version === "string" ? skill.version : "",
115
+ contextNote: `Identical skill content is retained in tool result ${later}. Read the skill again if needed.`,
116
+ };
117
+ if (JSON.stringify(summary).length >= key.length)
118
+ return part;
119
+ return {
120
+ ...part,
121
+ output: { type: "json", value: summary },
122
+ };
123
+ }
124
+ const output = executionOutput(part);
125
+ if (!output || part.output.type !== "content")
126
+ return part;
127
+ const receipts = Array.isArray(output.receipts) ? output.receipts : [];
128
+ const settled = output.ok === true &&
129
+ receipts.every((receipt) => record(receipt)?.status === "committed");
130
+ // Preserve code for unresolved work and for the current user turn.
131
+ if (index < lastUser && settled && receipts.length > 0)
132
+ compactableCalls.add(part.toolCallId);
133
+ if (!settled)
134
+ return part;
135
+ const key = JSON.stringify({ value: output.value, logs: output.logs });
136
+ const later = seenOutputs.get(key);
137
+ if (later === undefined) {
138
+ seenOutputs.set(key, part.toolCallId);
139
+ return part;
140
+ }
141
+ const abbreviated = {
142
+ ...output,
143
+ value: null,
144
+ logs: [`Identical returned value and logs are retained in tool result ${later}.`],
145
+ contextNote: "Only duplicate observations were omitted. This call's own receipts and artifacts remain below.",
146
+ };
147
+ const text = JSON.stringify(abbreviated);
148
+ if (text.length >= JSON.stringify(output).length)
149
+ return part;
150
+ return {
151
+ ...part,
152
+ output: {
153
+ ...part.output,
154
+ value: [{ type: "text", text }, ...part.output.value.slice(1)],
155
+ },
156
+ };
157
+ }),
158
+ };
159
+ }
160
+ if (fits(prepared))
161
+ return prepared;
162
+ // Prefer keeping the latest workflow and reference together while there is room.
163
+ const withRecentSkills = shortenSkills(prepared, 2);
164
+ if (fits(withRecentSkills))
165
+ return withRecentSkills;
166
+ const withoutOldCode = withRecentSkills.map((message) => {
167
+ if (message.role !== "assistant" ||
168
+ typeof message.content === "string" ||
169
+ message.providerOptions)
170
+ return message;
171
+ if (message.content.some((part) => part.type === "reasoning" ||
172
+ part.type === "reasoning-file" ||
173
+ ("providerOptions" in part && part.providerOptions)))
174
+ return message;
175
+ return {
176
+ ...message,
177
+ content: message.content.map((part) => {
178
+ // Signed/provider-owned tool inputs must remain byte-for-byte intact.
179
+ if (part.type !== "tool-call" ||
180
+ part.toolName !== "execute_javascript" ||
181
+ part.providerOptions ||
182
+ !compactableCalls.has(part.toolCallId))
183
+ return part;
184
+ const input = record(part.input);
185
+ if (typeof input?.code !== "string")
186
+ return part;
187
+ const code = "// Historical code omitted from model context. This completed call must not be replayed; inspect its preserved result and receipts.";
188
+ if (input.code.length <= code.length)
189
+ return part;
190
+ return {
191
+ ...part,
192
+ input: { ...input, code },
193
+ };
194
+ }),
195
+ };
196
+ });
197
+ if (fits(withoutOldCode))
198
+ return withoutOldCode;
199
+ // Older visual observations can be recovered from their retained artifact references.
200
+ // Keep the latest visual result and all user/provider-owned media verbatim.
201
+ // SDK call metadata can also appear on local tool results; preserve that metadata
202
+ // without treating the host's subsequently produced output as signed model content.
203
+ let latestVisualCall;
204
+ for (const message of withoutOldCode) {
205
+ if (message.role !== "tool")
206
+ continue;
207
+ for (const part of message.content) {
208
+ if (part.type !== "tool-result" || part.output.type !== "content")
209
+ continue;
210
+ if (part.output.value.some((item) => item.type === "file"))
211
+ latestVisualCall = part.toolCallId;
212
+ }
213
+ }
214
+ for (let index = 0; index < withoutOldCode.length; index++) {
215
+ const message = withoutOldCode[index];
216
+ if (message.role !== "tool" || message.providerOptions)
217
+ continue;
218
+ withoutOldCode[index] = {
219
+ ...message,
220
+ content: message.content.map((part) => {
221
+ if (part.type !== "tool-result" ||
222
+ part.toolCallId === latestVisualCall ||
223
+ part.output.type !== "content")
224
+ return part;
225
+ const output = executionOutput(part);
226
+ if (output?.ok !== true ||
227
+ !Array.isArray(output.artifacts) ||
228
+ output.artifacts.length === 0)
229
+ return part;
230
+ if (output.artifacts.some((item) => typeof record(record(item)?.artifact)?.id !== "string"))
231
+ return part;
232
+ const receipts = Array.isArray(output.receipts) ? output.receipts : [];
233
+ if (receipts.some((receipt) => record(receipt)?.status !== "committed"))
234
+ return part;
235
+ if (!part.output.value.some((item) => item.type === "file"))
236
+ return part;
237
+ if (part.output.value.some((item) => "providerOptions" in item && item.providerOptions))
238
+ return part;
239
+ const abbreviated = {
240
+ ...output,
241
+ contextNote: "Older image/file bytes were omitted from model context. The original artifact references remain in this result and full stored history. Use emitImage or emitFile with those references when you need to inspect them again.",
242
+ };
243
+ return {
244
+ ...part,
245
+ output: {
246
+ type: "content",
247
+ value: [
248
+ { type: "text", text: JSON.stringify(abbreviated) },
249
+ ...part.output.value.slice(1).filter((item) => item.type !== "file"),
250
+ ],
251
+ },
252
+ };
253
+ }),
254
+ };
255
+ if (fits(withoutOldCode))
256
+ return withoutOldCode;
257
+ }
258
+ // Documentation can be reread; keep current observations and receipts instead
259
+ // of stopping solely to retain a second skill body.
260
+ const withLatestSkill = shortenSkills(withoutOldCode, 1);
261
+ if (fits(withLatestSkill))
262
+ return withLatestSkill;
263
+ throw new SparkContextLimitError();
264
+ }
@@ -0,0 +1,32 @@
1
+ import type { JavaScriptUserWait } from "./executor.js";
2
+ /** One interaction per invocation. UI owners also arbitrate their shared dialog slots. */
3
+ export declare class UserWait implements JavaScriptUserWait {
4
+ active: boolean;
5
+ private readonly listeners;
6
+ subscribe(listener: () => void): () => void;
7
+ wait<T>(signal: AbortSignal, action: () => Promise<T>): Promise<T>;
8
+ private notify;
9
+ }
10
+ /** Counts execution/service time, excluding only host-declared user waits. */
11
+ export declare class ExecutionBudget {
12
+ private readonly timeoutMs;
13
+ private readonly signal;
14
+ private readonly userWait;
15
+ readonly interrupted: Promise<never>;
16
+ private reject;
17
+ private timer;
18
+ private readonly unsubscribe;
19
+ private remaining;
20
+ private startedAt;
21
+ private counting;
22
+ private guestDepth;
23
+ private disposed;
24
+ constructor(timeoutMs: number, signal: AbortSignal | undefined, userWait: JavaScriptUserWait | undefined);
25
+ expired(): boolean;
26
+ timeoutError(): Error;
27
+ /** Guest work still counts while an unawaited host interaction is pending. */
28
+ runGuest<T>(action: () => T): T;
29
+ dispose(): void;
30
+ private readonly onAbort;
31
+ private update;
32
+ }
@@ -0,0 +1,113 @@
1
+ /** One interaction per invocation. UI owners also arbitrate their shared dialog slots. */
2
+ export class UserWait {
3
+ active = false;
4
+ listeners = new Set();
5
+ subscribe(listener) {
6
+ this.listeners.add(listener);
7
+ return () => this.listeners.delete(listener);
8
+ }
9
+ async wait(signal, action) {
10
+ signal.throwIfAborted();
11
+ if (this.active)
12
+ throw new Error("This invocation already has a pending user interaction.");
13
+ this.active = true;
14
+ this.notify();
15
+ let onAbort = () => { };
16
+ const aborted = new Promise((_, reject) => {
17
+ onAbort = () => reject(signal.reason);
18
+ signal.addEventListener("abort", onAbort, { once: true });
19
+ });
20
+ try {
21
+ const result = await Promise.race([action(), aborted]);
22
+ signal.throwIfAborted();
23
+ return result;
24
+ }
25
+ finally {
26
+ signal.removeEventListener("abort", onAbort);
27
+ this.active = false;
28
+ this.notify();
29
+ }
30
+ }
31
+ notify() {
32
+ for (const listener of this.listeners)
33
+ listener();
34
+ }
35
+ }
36
+ /** Counts execution/service time, excluding only host-declared user waits. */
37
+ export class ExecutionBudget {
38
+ timeoutMs;
39
+ signal;
40
+ userWait;
41
+ interrupted;
42
+ reject;
43
+ timer;
44
+ unsubscribe;
45
+ remaining;
46
+ startedAt = performance.now();
47
+ counting = false;
48
+ guestDepth = 0;
49
+ disposed = false;
50
+ constructor(timeoutMs, signal, userWait) {
51
+ this.timeoutMs = timeoutMs;
52
+ this.signal = signal;
53
+ this.userWait = userWait;
54
+ if (Number.isFinite(timeoutMs) === false || timeoutMs <= 0)
55
+ throw new Error("JavaScript timeout must be a positive finite number.");
56
+ signal?.throwIfAborted();
57
+ this.remaining = timeoutMs;
58
+ this.interrupted = new Promise((_, reject) => {
59
+ this.reject = reject;
60
+ });
61
+ // Synchronous guest execution may exhaust the budget before its first await.
62
+ void this.interrupted.catch(() => undefined);
63
+ this.unsubscribe = userWait?.subscribe(() => this.update());
64
+ signal?.addEventListener("abort", this.onAbort, { once: true });
65
+ this.update();
66
+ }
67
+ expired() {
68
+ return this.remaining - (this.counting ? performance.now() - this.startedAt : 0) <= 0;
69
+ }
70
+ timeoutError() {
71
+ return new Error(`JavaScript exceeded ${this.timeoutMs / 1_000} seconds.`);
72
+ }
73
+ /** Guest work still counts while an unawaited host interaction is pending. */
74
+ runGuest(action) {
75
+ this.signal?.throwIfAborted();
76
+ if (this.expired())
77
+ throw this.timeoutError();
78
+ this.guestDepth++;
79
+ this.update();
80
+ try {
81
+ return action();
82
+ }
83
+ finally {
84
+ this.guestDepth--;
85
+ this.update();
86
+ }
87
+ }
88
+ dispose() {
89
+ this.disposed = true;
90
+ clearTimeout(this.timer);
91
+ this.unsubscribe?.();
92
+ this.signal?.removeEventListener("abort", this.onAbort);
93
+ }
94
+ onAbort = () => {
95
+ this.reject(this.signal?.reason ?? new Error("JavaScript execution cancelled."));
96
+ };
97
+ update() {
98
+ if (this.disposed)
99
+ return;
100
+ const now = performance.now();
101
+ if (this.counting)
102
+ this.remaining -= now - this.startedAt;
103
+ this.startedAt = now;
104
+ this.counting = this.userWait?.active !== true || this.guestDepth > 0;
105
+ clearTimeout(this.timer);
106
+ if (this.remaining <= 0) {
107
+ this.reject(this.timeoutError());
108
+ return;
109
+ }
110
+ if (this.counting)
111
+ this.timer = setTimeout(() => this.reject(this.timeoutError()), this.remaining);
112
+ }
113
+ }
@@ -1,4 +1,9 @@
1
1
  export type JavaScriptGlobals = Record<string, unknown>;
2
+ /** Host-owned interaction state; never exposed to generated JavaScript. */
3
+ export interface JavaScriptUserWait {
4
+ readonly active: boolean;
5
+ subscribe(listener: () => void): () => void;
6
+ }
2
7
  export interface JavaScriptExecutor {
3
- execute(code: string, globals: JavaScriptGlobals, timeoutMs: number): Promise<unknown>;
8
+ execute(code: string, globals: JavaScriptGlobals, timeoutMs: number, signal?: AbortSignal, userWait?: JavaScriptUserWait): Promise<unknown>;
4
9
  }
@@ -0,0 +1 @@
1
+ export declare const WOMP_ACCOUNT_DECLARATIONS = "declare const womp: { account: {\n\"read\": ((options: {\n\"sections\": Array<\"profile\" | \"teams\" | \"credits\" | \"subscription\" | \"billing\" | \"orders\" | \"cart\" | \"projects\" | \"notifications\" | \"workflows\">;\n\"from\"?: undefined | number;\n\"count\"?: undefined | number;\n}) => Promise<{\n\"provenance\": {\n\"kind\": \"live\";\n\"observedAt\": string;\n} | {\n\"kind\": \"fixture\";\n\"profile\": \"demo-account\";\n\"fictional\": true;\n};\n\"profile\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": {\n\"userId\": string;\n\"name\": string;\n\"email\"?: undefined | null | string;\n\"biography\"?: undefined | null | string;\n\"picture\"?: undefined | null | string;\n\"isPro\"?: undefined | false | true;\n\"subStatus\"?: undefined | null | string;\n\"verified\"?: undefined | false | true;\n\"tier\"?: undefined | number;\n\"roles\"?: undefined | string;\n\"permissions\"?: undefined | string;\n\"projectCount\"?: undefined | number;\n\"publicProjectCount\"?: undefined | number;\n\"followerCount\"?: undefined | number;\n\"followeeCount\"?: undefined | number;\n\"totalLikeCount\"?: undefined | number;\n\"point\"?: undefined | number;\n\"thisWeekPoint\"?: undefined | number;\n\"createdAt\"?: undefined | string;\n\"lastEditedAt\"?: undefined | string;\n\"addresses\"?: undefined | Array<{\n\"name\": string;\n\"city\": string;\n\"country\": string;\n\"line1\": string;\n\"line2\"?: undefined | null | string;\n\"postalCode\": string;\n\"state\"?: undefined | null | string;\n\"phoneNumber\"?: undefined | null | string;\n}>;\n\"badges\"?: undefined | Array<{\n\"id\": string;\n\"description\": string;\n\"symbol\": string;\n}>;\n};\n};\n\"teams\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": Array<{\n\"teamId\": string;\n\"name\": string;\n\"roles\": string;\n\"accepted\": false | true;\n\"memberCount\"?: undefined | number;\n\"seats\"?: undefined | number;\n}>;\n};\n\"credits\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": Array<{\n\"unit\": \"aip\" | \"3dpd\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"available\": number;\n\"subscription\": number;\n\"periodical\": number;\n\"canUseSubscriptionCredit\": false | true;\n\"buckets\": Array<{\n\"net\": number;\n\"originalNet\": number;\n\"activeSubscriptionId\": null | string;\n\"periodicalFrom\": null | string;\n\"transactionId\": null | string;\n\"transactionFrom\": null | string;\n}>;\n}>;\n};\n\"subscription\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": null | {\n\"id\": number;\n\"status\": string;\n\"period\": string;\n\"createdAt\": string;\n\"trialEndAt\"?: undefined | null | string;\n\"endAt\"?: undefined | null | string;\n\"cancelAt\"?: undefined | null | string;\n\"canceledAt\"?: undefined | null | string;\n\"endedAt\"?: undefined | null | string;\n\"price\"?: undefined | number;\n};\n};\n\"billing\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": {\n\"balance\": number;\n\"history\": {\n\"items\": Array<{\n\"invoiceId\": string;\n\"amountPaid\": number;\n\"paymentDate\": string;\n\"paymentStatus\": string;\n\"description\": null | string;\n\"via\": string;\n}>;\n\"from\": number;\n\"nextFrom\": null | number;\n\"totalCount\"?: undefined | number;\n};\n\"upcoming\": null | {\n\"amountDue\": number;\n\"total\": number;\n\"dueDate\": string;\n\"lines\": Array<{\n\"amount\": number;\n\"description\": null | string;\n}>;\n};\n\"paymentMethods\": Array<{\n\"type\": string;\n\"brand\"?: undefined | string;\n\"last4\"?: undefined | string;\n\"default\": false | true;\n\"status\"?: undefined | string;\n}>;\n};\n};\n\"orders\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": {\n\"items\": Array<{\n\"id\": number;\n\"status\": number;\n\"statusName\": string;\n\"totalCost\": number;\n\"shippingCost\": number;\n\"shippingService\"?: undefined | null | string;\n\"createdAt\": string;\n\"deliveredAt\"?: undefined | null | string;\n\"clientShippingStartedAt\"?: undefined | null | string;\n\"clientShippingDays\"?: undefined | null | number;\n\"orderItems\": Array<{\n\"id\": number;\n\"title\": string;\n\"projectId\": null | number;\n\"projectTitle\"?: undefined | null | string;\n\"quantity\": number;\n\"status\": number;\n\"materialName\"?: undefined | null | string;\n\"color\"?: undefined | null | string;\n\"surface\"?: undefined | null | string;\n\"previewUrl\"?: undefined | null | string;\n\"pricings\"?: undefined | null | Array<{\n\"selected\": false | true;\n\"salePrice\": number;\n\"discount\"?: undefined | number;\n\"needPro\"?: undefined | false | true;\n}>;\n}>;\n\"addrTo\"?: undefined | null | {\n\"name\": string;\n\"city\": string;\n\"country\": string;\n\"line1\": string;\n\"line2\"?: undefined | null | string;\n\"postalCode\": string;\n\"state\"?: undefined | null | string;\n\"phoneNumber\"?: undefined | null | string;\n};\n\"shipments\"?: undefined | Array<{\n\"carrier\"?: undefined | string;\n\"trackingNumber\": string;\n\"trackingStatus\": string;\n}>;\n}>;\n\"from\": number;\n\"nextFrom\": null | number;\n\"totalCount\"?: undefined | number;\n};\n};\n\"cart\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": {\n\"items\": Array<{\n\"id\": number;\n\"title\": string;\n\"projectId\": null | number;\n\"projectTitle\"?: undefined | null | string;\n\"quantity\": number;\n\"status\": number;\n\"materialName\"?: undefined | null | string;\n\"color\"?: undefined | null | string;\n\"surface\"?: undefined | null | string;\n\"previewUrl\"?: undefined | null | string;\n\"pricings\"?: undefined | null | Array<{\n\"selected\": false | true;\n\"salePrice\": number;\n\"discount\"?: undefined | number;\n\"needPro\"?: undefined | false | true;\n}>;\n}>;\n\"from\": number;\n\"nextFrom\": null | number;\n\"totalCount\"?: undefined | number;\n};\n};\n\"projects\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": {\n\"items\": Array<{\n\"id\": number;\n\"title\": string;\n\"userId\"?: undefined | string;\n\"teamId\"?: undefined | null | string;\n\"public\": false | true;\n\"createdAt\"?: undefined | string;\n\"updatedAt\"?: undefined | string;\n\"thumbnailUrl\"?: undefined | null | string;\n\"labels\"?: undefined | Array<string>;\n}>;\n\"from\": number;\n\"nextFrom\": null | number;\n\"totalCount\"?: undefined | number;\n};\n};\n\"notifications\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": {\n\"items\": Array<{\n\"id\": number;\n\"type\": string;\n\"read\": false | true;\n\"seen\": false | true;\n\"createdAt\": string;\n\"details\": {\n[key: string]: unknown;\n};\n}>;\n\"from\": number;\n\"nextFrom\": null | number;\n\"totalCount\"?: undefined | number;\n};\n};\n\"workflows\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": {\n\"items\": Array<{\n\"id\": number;\n\"name\": string;\n\"type\": string;\n\"description\"?: undefined | null | string;\n\"capabilities\"?: undefined | Array<string>;\n}>;\n\"from\": number;\n\"nextFrom\": null | number;\n\"totalCount\"?: undefined | number;\n};\n};\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";
@@ -0,0 +1,3 @@
1
+ // Generated by scripts/generate-skill-declarations.mjs.
2
+ // prettier-ignore
3
+ export const WOMP_ACCOUNT_DECLARATIONS = "declare const womp: { account: {\n\"read\": ((options: {\n\"sections\": Array<\"profile\" | \"teams\" | \"credits\" | \"subscription\" | \"billing\" | \"orders\" | \"cart\" | \"projects\" | \"notifications\" | \"workflows\">;\n\"from\"?: undefined | number;\n\"count\"?: undefined | number;\n}) => Promise<{\n\"provenance\": {\n\"kind\": \"live\";\n\"observedAt\": string;\n} | {\n\"kind\": \"fixture\";\n\"profile\": \"demo-account\";\n\"fictional\": true;\n};\n\"profile\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": {\n\"userId\": string;\n\"name\": string;\n\"email\"?: undefined | null | string;\n\"biography\"?: undefined | null | string;\n\"picture\"?: undefined | null | string;\n\"isPro\"?: undefined | false | true;\n\"subStatus\"?: undefined | null | string;\n\"verified\"?: undefined | false | true;\n\"tier\"?: undefined | number;\n\"roles\"?: undefined | string;\n\"permissions\"?: undefined | string;\n\"projectCount\"?: undefined | number;\n\"publicProjectCount\"?: undefined | number;\n\"followerCount\"?: undefined | number;\n\"followeeCount\"?: undefined | number;\n\"totalLikeCount\"?: undefined | number;\n\"point\"?: undefined | number;\n\"thisWeekPoint\"?: undefined | number;\n\"createdAt\"?: undefined | string;\n\"lastEditedAt\"?: undefined | string;\n\"addresses\"?: undefined | Array<{\n\"name\": string;\n\"city\": string;\n\"country\": string;\n\"line1\": string;\n\"line2\"?: undefined | null | string;\n\"postalCode\": string;\n\"state\"?: undefined | null | string;\n\"phoneNumber\"?: undefined | null | string;\n}>;\n\"badges\"?: undefined | Array<{\n\"id\": string;\n\"description\": string;\n\"symbol\": string;\n}>;\n};\n};\n\"teams\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": Array<{\n\"teamId\": string;\n\"name\": string;\n\"roles\": string;\n\"accepted\": false | true;\n\"memberCount\"?: undefined | number;\n\"seats\"?: undefined | number;\n}>;\n};\n\"credits\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": Array<{\n\"unit\": \"aip\" | \"3dpd\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"available\": number;\n\"subscription\": number;\n\"periodical\": number;\n\"canUseSubscriptionCredit\": false | true;\n\"buckets\": Array<{\n\"net\": number;\n\"originalNet\": number;\n\"activeSubscriptionId\": null | string;\n\"periodicalFrom\": null | string;\n\"transactionId\": null | string;\n\"transactionFrom\": null | string;\n}>;\n}>;\n};\n\"subscription\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": null | {\n\"id\": number;\n\"status\": string;\n\"period\": string;\n\"createdAt\": string;\n\"trialEndAt\"?: undefined | null | string;\n\"endAt\"?: undefined | null | string;\n\"cancelAt\"?: undefined | null | string;\n\"canceledAt\"?: undefined | null | string;\n\"endedAt\"?: undefined | null | string;\n\"price\"?: undefined | number;\n};\n};\n\"billing\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": {\n\"balance\": number;\n\"history\": {\n\"items\": Array<{\n\"invoiceId\": string;\n\"amountPaid\": number;\n\"paymentDate\": string;\n\"paymentStatus\": string;\n\"description\": null | string;\n\"via\": string;\n}>;\n\"from\": number;\n\"nextFrom\": null | number;\n\"totalCount\"?: undefined | number;\n};\n\"upcoming\": null | {\n\"amountDue\": number;\n\"total\": number;\n\"dueDate\": string;\n\"lines\": Array<{\n\"amount\": number;\n\"description\": null | string;\n}>;\n};\n\"paymentMethods\": Array<{\n\"type\": string;\n\"brand\"?: undefined | string;\n\"last4\"?: undefined | string;\n\"default\": false | true;\n\"status\"?: undefined | string;\n}>;\n};\n};\n\"orders\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": {\n\"items\": Array<{\n\"id\": number;\n\"status\": number;\n\"statusName\": string;\n\"totalCost\": number;\n\"shippingCost\": number;\n\"shippingService\"?: undefined | null | string;\n\"createdAt\": string;\n\"deliveredAt\"?: undefined | null | string;\n\"clientShippingStartedAt\"?: undefined | null | string;\n\"clientShippingDays\"?: undefined | null | number;\n\"orderItems\": Array<{\n\"id\": number;\n\"title\": string;\n\"projectId\": null | number;\n\"projectTitle\"?: undefined | null | string;\n\"quantity\": number;\n\"status\": number;\n\"materialName\"?: undefined | null | string;\n\"color\"?: undefined | null | string;\n\"surface\"?: undefined | null | string;\n\"previewUrl\"?: undefined | null | string;\n\"pricings\"?: undefined | null | Array<{\n\"selected\": false | true;\n\"salePrice\": number;\n\"discount\"?: undefined | number;\n\"needPro\"?: undefined | false | true;\n}>;\n}>;\n\"addrTo\"?: undefined | null | {\n\"name\": string;\n\"city\": string;\n\"country\": string;\n\"line1\": string;\n\"line2\"?: undefined | null | string;\n\"postalCode\": string;\n\"state\"?: undefined | null | string;\n\"phoneNumber\"?: undefined | null | string;\n};\n\"shipments\"?: undefined | Array<{\n\"carrier\"?: undefined | string;\n\"trackingNumber\": string;\n\"trackingStatus\": string;\n}>;\n}>;\n\"from\": number;\n\"nextFrom\": null | number;\n\"totalCount\"?: undefined | number;\n};\n};\n\"cart\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": {\n\"items\": Array<{\n\"id\": number;\n\"title\": string;\n\"projectId\": null | number;\n\"projectTitle\"?: undefined | null | string;\n\"quantity\": number;\n\"status\": number;\n\"materialName\"?: undefined | null | string;\n\"color\"?: undefined | null | string;\n\"surface\"?: undefined | null | string;\n\"previewUrl\"?: undefined | null | string;\n\"pricings\"?: undefined | null | Array<{\n\"selected\": false | true;\n\"salePrice\": number;\n\"discount\"?: undefined | number;\n\"needPro\"?: undefined | false | true;\n}>;\n}>;\n\"from\": number;\n\"nextFrom\": null | number;\n\"totalCount\"?: undefined | number;\n};\n};\n\"projects\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": {\n\"items\": Array<{\n\"id\": number;\n\"title\": string;\n\"userId\"?: undefined | string;\n\"teamId\"?: undefined | null | string;\n\"public\": false | true;\n\"createdAt\"?: undefined | string;\n\"updatedAt\"?: undefined | string;\n\"thumbnailUrl\"?: undefined | null | string;\n\"labels\"?: undefined | Array<string>;\n}>;\n\"from\": number;\n\"nextFrom\": null | number;\n\"totalCount\"?: undefined | number;\n};\n};\n\"notifications\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": {\n\"items\": Array<{\n\"id\": number;\n\"type\": string;\n\"read\": false | true;\n\"seen\": false | true;\n\"createdAt\": string;\n\"details\": {\n[key: string]: unknown;\n};\n}>;\n\"from\": number;\n\"nextFrom\": null | number;\n\"totalCount\"?: undefined | number;\n};\n};\n\"workflows\"?: undefined | {\n\"status\": \"unavailable\";\n\"reason\": string;\n} | {\n\"status\": \"available\";\n\"scope\": {\n\"userId\": string;\n\"teamId\": null | string;\n};\n\"data\": {\n\"items\": Array<{\n\"id\": number;\n\"name\": string;\n\"type\": string;\n\"description\"?: undefined | null | string;\n\"capabilities\"?: undefined | Array<string>;\n}>;\n\"from\": number;\n\"nextFrom\": null | number;\n\"totalCount\"?: undefined | number;\n};\n};\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";
@@ -0,0 +1 @@
1
+ export declare const WOMP_ASSET_IMPORT_DECLARATIONS = "declare const womp: { assets: {\n\"importMesh\": ((request: {\n\"key\": string;\n\"source\": {\n\"id\": string;\n\"mediaType\": string;\n\"name\"?: undefined | string;\n};\n\"destination\": \"scene\" | \"library\";\n}) => Promise<{\n\"key\": string;\n\"status\": \"processing\" | \"ready\" | \"completed\" | \"partial\" | \"cancelled\" | \"failed\" | \"unknown\";\n\"tasks\": Array<{\n\"id\": number;\n\"projectId\": null | number;\n\"status\": string;\n\"fileName\"?: undefined | string;\n\"error\"?: undefined | string;\n}>;\n\"assets\": Array<{\n\"id\": number;\n\"projectId\": null | number;\n\"type\": \"mesh\" | \"field\" | \"decal\";\n}>;\n\"objectIds\": Array<number>;\n\"omittedFiles\"?: undefined | Array<{\n\"fileName\": string;\n\"projectId\": null | number;\n}>;\n\"reason\"?: undefined | string;\n}>);\n\"retryMeshImport\": ((request: {\n\"key\": string;\n\"fileName\": string;\n}) => Promise<{\n\"key\": string;\n\"status\": \"processing\" | \"ready\" | \"completed\" | \"partial\" | \"cancelled\" | \"failed\" | \"unknown\";\n\"tasks\": Array<{\n\"id\": number;\n\"projectId\": null | number;\n\"status\": string;\n\"fileName\"?: undefined | string;\n\"error\"?: undefined | string;\n}>;\n\"assets\": Array<{\n\"id\": number;\n\"projectId\": null | number;\n\"type\": \"mesh\" | \"field\" | \"decal\";\n}>;\n\"objectIds\": Array<number>;\n\"omittedFiles\"?: undefined | Array<{\n\"fileName\": string;\n\"projectId\": null | number;\n}>;\n\"reason\"?: undefined | string;\n}>);\n\"importImage\": ((request: {\n\"key\": string;\n\"source\": {\n\"id\": string;\n\"mediaType\": string;\n\"name\"?: undefined | string;\n};\n\"destination\": \"scene\" | \"library\";\n} & {\n\"kind\": \"image-plane\" | \"sticker\";\n\"removeBackground\"?: undefined | false | true;\n}) => Promise<{\n\"key\": string;\n\"status\": \"processing\" | \"ready\" | \"completed\" | \"partial\" | \"cancelled\" | \"failed\" | \"unknown\";\n\"tasks\": Array<{\n\"id\": number;\n\"projectId\": null | number;\n\"status\": string;\n\"fileName\"?: undefined | string;\n\"error\"?: undefined | string;\n}>;\n\"assets\": Array<{\n\"id\": number;\n\"projectId\": null | number;\n\"type\": \"mesh\" | \"field\" | \"decal\";\n}>;\n\"objectIds\": Array<number>;\n\"omittedFiles\"?: undefined | Array<{\n\"fileName\": string;\n\"projectId\": null | number;\n}>;\n\"reason\"?: undefined | string;\n}>);\n\"readImport\": ((key: string) => Promise<{\n\"key\": string;\n\"status\": \"processing\" | \"ready\" | \"completed\" | \"partial\" | \"cancelled\" | \"failed\" | \"unknown\";\n\"tasks\": Array<{\n\"id\": number;\n\"projectId\": null | number;\n\"status\": string;\n\"fileName\"?: undefined | string;\n\"error\"?: undefined | string;\n}>;\n\"assets\": Array<{\n\"id\": number;\n\"projectId\": null | number;\n\"type\": \"mesh\" | \"field\" | \"decal\";\n}>;\n\"objectIds\": Array<number>;\n\"omittedFiles\"?: undefined | Array<{\n\"fileName\": string;\n\"projectId\": null | number;\n}>;\n\"reason\"?: undefined | string;\n}>);\n\"finishImport\": ((key: string, options?: undefined | {\n\"timeoutMs\"?: undefined | number;\n}) => Promise<{\n\"key\": string;\n\"status\": \"processing\" | \"ready\" | \"completed\" | \"partial\" | \"cancelled\" | \"failed\" | \"unknown\";\n\"tasks\": Array<{\n\"id\": number;\n\"projectId\": null | number;\n\"status\": string;\n\"fileName\"?: undefined | string;\n\"error\"?: undefined | string;\n}>;\n\"assets\": Array<{\n\"id\": number;\n\"projectId\": null | number;\n\"type\": \"mesh\" | \"field\" | \"decal\";\n}>;\n\"objectIds\": Array<number>;\n\"omittedFiles\"?: undefined | Array<{\n\"fileName\": string;\n\"projectId\": null | number;\n}>;\n\"reason\"?: 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";