@womp/spark-agent 7.0.0 → 9.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +3 -2
  3. package/dist/capabilities/geometry.d.ts +17 -5
  4. package/dist/capabilities/geometry.js +11 -12
  5. package/dist/generated/geometry-declarations.d.ts +1 -1
  6. package/dist/generated/geometry-declarations.js +1 -1
  7. package/dist/geometry/backendRegistry.d.ts +1 -0
  8. package/dist/geometry/common.d.ts +5 -2
  9. package/dist/geometry/common.js +18 -3
  10. package/dist/geometry/compiler.js +2 -2
  11. package/dist/geometry/diagnostics.d.ts +2 -7
  12. package/dist/geometry/diagnostics.js +3 -51
  13. package/dist/geometry/graph.d.ts +1 -1
  14. package/dist/geometry/graph.js +1 -0
  15. package/dist/geometry/index.d.ts +0 -1
  16. package/dist/geometry/index.js +0 -3
  17. package/dist/geometry/lift.js +105 -113
  18. package/dist/geometry/lower.js +29 -49
  19. package/dist/geometry/schemas/flowir-dialect.json +117 -117
  20. package/dist/geometry/writeParamData.js +4 -4
  21. package/dist/geometry.d.ts +2 -5
  22. package/dist/geometry.js +7 -11
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +0 -1
  25. package/dist/intent-bench.js +1 -1
  26. package/dist/kakapo.d.ts +1 -1
  27. package/dist/scene-operations.d.ts +2 -17
  28. package/dist/scene-operations.js +4 -40
  29. package/dist/sdk-geometry-host.d.ts +1 -1
  30. package/dist/sdk-geometry-host.js +252 -251
  31. package/dist/sdk-openscad-host.js +1 -3
  32. package/dist/sdk-scene-host.d.ts +3 -5
  33. package/dist/sdk-scene-host.js +5 -15
  34. package/dist/server/sqlite-store.d.ts +1 -5
  35. package/dist/server/sqlite-store.js +3 -40
  36. package/dist/server/standalone.js +0 -1
  37. package/dist/womp-scene-api.d.ts +9 -1
  38. package/dist/womp-scene-api.js +41 -32
  39. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -5,6 +5,5 @@ export { applyCompaction, latestCompaction } from "./compaction.js";
5
5
  export * from "./context-window.js";
6
6
  export * from "./capabilities.js";
7
7
  export { createSdkSceneEditor, createSdkSceneHost, } from "./sdk-scene-host.js";
8
- export { recoverSceneOperation } from "./scene-operations.js";
9
8
  export { DEFAULT_MODEL_ID, getSparkModel, REASONING_EFFORT_LABELS, resolveReasoningEffort, SPARK_MODELS, } from "./models.js";
10
9
  export { SPARK_AGENT_PROMPT, sparkSystemPrompt } from "./prompt.js";
@@ -342,7 +342,7 @@ async function intentFixtures(testCase, controller) {
342
342
  if (objectId !== 0)
343
343
  return refuse("geometry.read", `Object ${objectId} has no Geometry Nodes graph.`);
344
344
  note("geometry.read");
345
- return { kind: "container", objectId: 0, title: "Scene", source: null, instances: [], diagnostics: [] };
345
+ return { kind: "container", objectId: 0, title: "Scene", source: null, transform: null, bounds: null, instances: [], diagnostics: [] };
346
346
  },
347
347
  write: async (options) => decide("geometry-nodes", "geometry.write", options),
348
348
  }, geometryReference()),
package/dist/kakapo.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { KakapoRuntime } from "./runtime.js";
2
2
  export { createSdkSceneDraft, createSdkSceneEditor, createSdkSceneHost, type SdkSceneEditor, type SdkSceneEditorOptions, type SdkSceneEditIdentity, type SdkSceneServices, } from "./sdk-scene-host.js";
3
- export type { SceneOperation, SceneOperationStore, } from "./scene-operations.js";
3
+ export type { SceneOperation } from "./scene-operations.js";
4
4
  export { createWompSceneApi, NodeType, OperationType, PrimitiveTypeValue, } from "./womp-scene-api.js";
5
5
  export type { WompSceneApi, WompSceneApiContext } from "./womp-scene-api.js";
6
6
  export { createSdkGeometryHost, type SdkGeometryHostOptions, } from "./sdk-geometry-host.js";
@@ -4,10 +4,10 @@ export type SceneEditResult = {
4
4
  } | {
5
5
  empty: true;
6
6
  };
7
+ /** One scene edit's outcome, held for the invocation that made it. */
7
8
  export type SceneOperation = {
8
9
  id: string;
9
10
  targetKey: string;
10
- revision: number;
11
11
  status: "started" | "prepared" | "committed" | "rolled_back" | "unknown";
12
12
  result?: SceneEditResult;
13
13
  changed?: boolean;
@@ -17,23 +17,9 @@ export type SceneOperation = {
17
17
  };
18
18
  completedAt?: string;
19
19
  };
20
- export interface SceneOperationStore {
21
- getSceneOperation(targetKey: string, id: string): Promise<SceneOperation | undefined>;
22
- createSceneOperation(operation: SceneOperation): Promise<boolean>;
23
- saveSceneOperation(operation: SceneOperation): Promise<SceneOperation>;
24
- }
25
- /** Recover acknowledged/no-op results without replaying or refetching an uncertain edit. */
26
- export declare function recoverSceneOperation(options: {
27
- api: KakapoAPI;
28
- store: SceneOperationStore;
29
- targetKey: string;
30
- id: string;
31
- assertActive(): void | Promise<void>;
32
- }): Promise<SceneOperation | undefined>;
33
- /** Hosts may omit persistence; journal-backed hosts retain duplicate-operation protection. */
20
+ /** Applies one edit directly to the scene and reports its outcome; nothing is journaled or replayed. */
34
21
  export declare function executeSceneOperation<T>(options: {
35
22
  api: KakapoAPI;
36
- store?: SceneOperationStore;
37
23
  onOutcome?(operation: SceneOperation): void;
38
24
  operation: Pick<SceneOperation, "id" | "targetKey">;
39
25
  assertEditable(): void | Promise<void>;
@@ -44,5 +30,4 @@ export declare function executeSceneOperation<T>(options: {
44
30
  }): Promise<{
45
31
  value: T;
46
32
  operation: SceneOperation;
47
- reused?: boolean;
48
33
  }>;
@@ -42,44 +42,15 @@ function resultValue(operation) {
42
42
  function complete(operation, status) {
43
43
  return { ...operation, status, completedAt: operation.completedAt ?? new Date().toISOString() };
44
44
  }
45
- /** Recover acknowledged/no-op results without replaying or refetching an uncertain edit. */
46
- export async function recoverSceneOperation(options) {
47
- await options.assertActive();
48
- const previous = await options.store.getSceneOperation(options.targetKey, options.id);
49
- if (!previous || previous.status === "committed" || previous.status === "rolled_back")
50
- return previous;
51
- await options.assertActive();
52
- if (previous.changed === false && previous.result) {
53
- return options.store.saveSceneOperation(complete(previous, "committed"));
54
- }
55
- return previous;
56
- }
57
- /** Hosts may omit persistence; journal-backed hosts retain duplicate-operation protection. */
45
+ /** Applies one edit directly to the scene and reports its outcome; nothing is journaled or replayed. */
58
46
  export async function executeSceneOperation(options) {
59
- const { api, store, operation: identity } = options;
47
+ const { api, operation: identity } = options;
60
48
  const savesScene = options.saveToRenderer === true;
61
49
  await options.assertEditable();
62
- const previous = await store?.getSceneOperation(identity.targetKey, identity.id);
63
- if (previous && store) {
64
- if ((previous.save !== undefined) !== savesScene)
65
- throw new Error("Scene operation identity was reused with a different save policy");
66
- if (previous.status === "committed")
67
- return { value: resultValue(previous), operation: previous, reused: true };
68
- if (previous.status === "rolled_back")
69
- throw new Error(previous.error ?? "Scene operation was rolled back");
70
- const recovered = await recoverSceneOperation({
71
- api, store, targetKey: identity.targetKey, id: identity.id, assertActive: options.assertEditable,
72
- });
73
- if (recovered?.status === "committed")
74
- return { value: resultValue(recovered), operation: recovered, reused: true };
75
- throw new Error("Scene edit outcome is uncertain. Inspect the scene before making a new edit; this operation was not replayed.");
76
- }
77
50
  let operation = {
78
- ...identity, revision: 0, status: "started",
51
+ ...identity, status: "started",
79
52
  ...(savesScene ? { save: { status: "unknown" } } : {}),
80
53
  };
81
- if (store && !await store.createSceneOperation(operation))
82
- throw new Error("Scene operation is already in progress");
83
54
  try {
84
55
  const edit = async (draft) => {
85
56
  await options.assertEditable();
@@ -94,8 +65,6 @@ export async function executeSceneOperation(options) {
94
65
  ...operation, status: "prepared", changed,
95
66
  ...(savesScene && !changed ? { save: { status: "not_needed" } } : {}),
96
67
  };
97
- if (store)
98
- operation = await store.saveSceneOperation(operation);
99
68
  await options.assertEditable();
100
69
  if (changed)
101
70
  await options.prepareCommit?.(operation);
@@ -118,16 +87,11 @@ export async function executeSceneOperation(options) {
118
87
  ...(operation.save && status === "rolled_back" ? { save: { status: "not_needed" } } : {}),
119
88
  };
120
89
  options.onOutcome?.(operation);
121
- if (store)
122
- operation = await store.saveSceneOperation(operation);
123
90
  }
124
91
  catch {
125
- // Keep the original error; recovery can inspect the prepared record.
92
+ // Keep the original error.
126
93
  }
127
94
  throw error;
128
95
  }
129
- // A prepared record alone never proves an uncertain commit succeeded.
130
- if (store)
131
- operation = await store.saveSceneOperation(complete(operation, "committed"));
132
96
  return { value: resultValue(operation), operation };
133
97
  }
@@ -1,5 +1,5 @@
1
- import { type SdkSceneEditor } from "./sdk-scene-host.js";
2
1
  import type { GeometryHost } from "./capabilities.js";
2
+ import { type SdkSceneEditor } from "./sdk-scene-host.js";
3
3
  import { readSdkSceneHealth } from "./scene-health.js";
4
4
  import { type RepairStateStore } from "./repair-state.js";
5
5
  export type SdkGeometryHostOptions = {