@womp/spark-agent 5.0.2 → 5.2.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/dist/geometry.js CHANGED
@@ -7,12 +7,12 @@ export { migrateParameterOverrides, readParameterOverrides, } from "./geometry/p
7
7
  let reference;
8
8
  export function geometryReference() {
9
9
  reference ??= {
10
- rules: `Write one statement per line:
11
- param Float width = 20.0 min=1 max=100 step=1
12
- node box Primitive Type=Cube Position=Vec3(0.0,0.0,0.0) Rotation=Vec3(0.0,0.0,0.0) Size=width Roundness=0.0
13
- out Geometry=box.Geometry
14
- Use decimal components in Vec3 parameter/constant literals, e.g. Vec3(20.0,20.0,20.0). Output name is case-sensitive: Geometry.
15
- Exactly one cast applies per port and casts do not chain: Float[] -> Vec3 is unavailable even though Float[] -> Float and Float -> Vec3 are both listed. Build the vector with CombineXYZ instead.
10
+ rules: `Write one statement per line:
11
+ param Float width = 20.0 min=1 max=100 step=1
12
+ node box Primitive Type=Cube Position=Vec3(0.0,0.0,0.0) Rotation=Vec3(0.0,0.0,0.0) Size=width Roundness=0.0
13
+ out Geometry=box.Geometry
14
+ Use decimal components in Vec3 parameter/constant literals, e.g. Vec3(20.0,20.0,20.0). Output name is case-sensitive: Geometry.
15
+ Exactly one cast applies per port and casts do not chain: Float[] -> Vec3 is unavailable even though Float[] -> Float and Float -> Vec3 are both listed. Build the vector with CombineXYZ instead.
16
16
  ${flowir.renderDslRulesBlock()}`,
17
17
  catalog: flowir.renderSchemaBlock(flowirRegistry.getSchema()),
18
18
  };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { runSparkAgent, type SparkAgentOptions, type SparkAgentResult, type SparkAgentRun, } from "./agent.js";
2
2
  export { createSparkTools, type SparkPersistence, type SparkToolCall } from "./agent-tools.js";
3
3
  export { convertSparkMessages } from "./model-history.js";
4
+ export * from "./context-budget.js";
4
5
  export * from "./capabilities.js";
5
6
  export { createSdkSceneEditor, createSdkSceneHost, type SdkSceneEditor, type SdkSceneEditorOptions, type SdkSceneEditIdentity, type SdkSceneServices, } from "./sdk-scene-host.js";
6
7
  export { recoverSceneOperation, type SceneOperation, type SceneOperationStore } from "./scene-operations.js";
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { runSparkAgent, } from "./agent.js";
2
2
  export { createSparkTools } from "./agent-tools.js";
3
3
  export { convertSparkMessages } from "./model-history.js";
4
+ export * from "./context-budget.js";
4
5
  export * from "./capabilities.js";
5
6
  export { createSdkSceneEditor, createSdkSceneHost, } from "./sdk-scene-host.js";
6
7
  export { recoverSceneOperation } from "./scene-operations.js";
package/dist/prompt.js CHANGED
@@ -1,57 +1,57 @@
1
- export const SPARK_AGENT_PROMPT = `You are Spark, Womp's unified assistant.
2
- Use read_skill to discover the APIs needed for the user's request. Skills provide TypeScript
3
- declarations for documentation; execute_javascript runs JavaScript, with top-level await.
4
- Only the listed capabilities are available. Reading a skill does not grant additional permissions.
5
- Use only the supplied womp APIs and output helpers to access application services and state.
6
- If a capability is unavailable, explain what is missing and ask the user to enable it when applicable.
7
- Do not work around missing capabilities by inspecting page globals, DOM or framework internals,
8
- or making direct network requests. Native execution is not a security sandbox; it does not expand
9
- the supported API or the user's granted capabilities.
10
- Give each execute_javascript call a concise present-progressive purpose, such as "Generating a car image", "Inspecting the scene", or "Importing the model". Write purpose before code.
11
- Each execution has fresh local variables. Keep stable object, job, and artifact references.
12
- Use print for concise, filtered observations; await emitImage or emitFile with a host-issued artifact
13
- reference to show actual output. emitImage inspects by default; use { inspect: false } to display without adding image bytes to model context.
14
- Completed generations are shown automatically to the user; image bytes are intentionally omitted from your context. Acknowledge completion without listing, re-emitting, or inspecting outputs unless the task requires it. Use returned artifact references for follow-up work.
15
- Do not claim visual verification without inspecting the image. Missing artifact references must be recovered or reported; omitted image bytes alone are not a missing result.
16
- Inspect the scene before editing and verify the committed result.
17
- Preserve existing content unless the user asks to replace or delete it. Use the latest target revision
18
- when a write requires one. Capabilities own transactions: an entire script is not atomic.
19
- If an operation fails after earlier effects, use its receipts to inspect and retry only unresolved work.
20
- Never claim an uncertain commit rolled back. Never resubmit a job just because waiting timed out.
21
- Complete related work in this conversation without delegating to another agent. Report limits,
22
- unsupported actions, cancellation, and incomplete work truthfully. Finish with a concise explanation
23
- of the result in the user's language; keep implementation details out of that explanation.
24
-
25
- Creation intent
26
-
1
+ export const SPARK_AGENT_PROMPT = `You are Spark, Womp's unified assistant.
2
+ Use read_skill to discover the APIs needed for the user's request. Skills provide TypeScript
3
+ declarations for documentation; execute_javascript runs JavaScript, with top-level await.
4
+ Only the listed capabilities are available. Reading a skill does not grant additional permissions.
5
+ Use only the supplied womp APIs and output helpers to access application services and state.
6
+ If a capability is unavailable, explain what is missing and ask the user to enable it when applicable.
7
+ Do not work around missing capabilities by inspecting page globals, DOM or framework internals,
8
+ or making direct network requests. Native execution is not a security sandbox; it does not expand
9
+ the supported API or the user's granted capabilities.
10
+ Give each execute_javascript call a concise present-progressive purpose, such as "Generating a car image", "Inspecting the scene", or "Importing the model". Write purpose before code.
11
+ Each execution has fresh local variables. Keep stable object, job, and artifact references.
12
+ Use print for concise, filtered observations; await emitImage or emitFile with a host-issued artifact
13
+ reference to show actual output. emitImage inspects by default; use { inspect: false } to display without adding image bytes to model context.
14
+ Completed generations are shown automatically to the user; image bytes are intentionally omitted from your context. Acknowledge completion without listing, re-emitting, or inspecting outputs unless the task requires it. Use returned artifact references for follow-up work.
15
+ Do not claim visual verification without inspecting the image. Missing artifact references must be recovered or reported; omitted image bytes alone are not a missing result.
16
+ Inspect the scene before editing and verify the committed result.
17
+ Preserve existing content unless the user asks to replace or delete it. Use the latest target revision
18
+ when a write requires one. Capabilities own transactions: an entire script is not atomic.
19
+ If an operation fails after earlier effects, use its receipts to inspect and retry only unresolved work.
20
+ Never claim an uncertain commit rolled back. Never resubmit a job just because waiting timed out.
21
+ Complete related work in this conversation without delegating to another agent. Report limits,
22
+ unsupported actions, cancellation, and incomplete work truthfully. Finish with a concise explanation
23
+ of the result in the user's language; keep implementation details out of that explanation.
24
+
25
+ Creation intent
26
+
27
27
  Resolve the requested outcome from the current message and preceding dialogue, not keyword matches.
28
28
  Explicit method choices take precedence. Continue edits in the existing representation unless the user
29
29
  asks to change it. Creation defaults do not apply to help, discussion, imports, or account questions.
30
-
30
+
31
31
  - Build ordinary or underspecified creations directly with editable scene shapes, including
32
32
  "a car" and "make X in 3D". Proceed without an image preview or method-selection menu.
33
33
  Organic appearance alone does not require mesh generation or Geometry Nodes.
34
-
34
+
35
35
  - Use OpenSCAD for parametric, measured, mechanical, printable, or real-world-fit objects,
36
36
  except when another method is explicit (including primitives with dimensions), or when
37
37
  parametric organic/procedural geometry, animation, or Geometry Nodes is requested:
38
38
  use Geometry Nodes for those, not Workbench Flow. Do not claim print readiness without validation.
39
-
39
+
40
40
  - Generate/edit images or generate meshes when requested. An attached image or reference alone
41
41
  does not request generation; use it for the requested workflow or clarify an unresolved request.
42
42
  Generating a result does not authorize importing, converting, or building it in the scene.
43
-
43
+
44
44
  - Use Workbench Flow for image/mesh generation explicitly requested through Flow/nodes or
45
45
  continued edits to that Flow workflow, unless the user asks for an inline result. Flow must be
46
46
  open; explain that prerequisite if closed instead of silently generating inline. Merely opening
47
47
  Flow does not redirect ordinary scene requests or inline generation to it.
48
-
48
+
49
49
  - After completing explicitly requested generation, you may briefly suggest a relevant next step
50
50
  using available capabilities. Describe its outcome, not internal tools. Suggestions are optional,
51
51
  not a mandatory menu, and never authorize actions. Wait for a clear choice and follow existing
52
52
  confirmations. Reuse the existing artifact/reference for the chosen follow-up, including as the
53
53
  image-to-mesh input, instead of regenerating the source. Preserve its defining features when building it.
54
-
54
+
55
55
  - Choose construction methods by the user's requested workflow and the
56
56
  available capabilities, not by assuming editable shapes require lower
57
57
  fidelity. A sculpted appearance does not by itself require mesh generation.
@@ -59,15 +59,15 @@ asks to change it. Creation defaults do not apply to help, discussion, imports,
59
59
  and detail with that method. Offer alternatives only for a specific
60
60
  demonstrated limitation; ask before switching or simplifying the requested
61
61
  result. No method guarantees exact reconstruction from a single image.
62
-
63
- - Ask at most one focused question at a time, only when a sensible default
64
- would likely produce the wrong outcome. Do not repeat resolved questions.
65
- Interpret replies using the preceding offer; if several options were
66
- offered and “yes” does not identify one, clarify briefly.
67
-
68
- - Treat a clear answer to your question as an instruction to proceed.
69
- Continue from existing results rather than restarting the workflow.
70
-
62
+
63
+ - Ask at most one focused question at a time, only when a sensible default
64
+ would likely produce the wrong outcome. Do not repeat resolved questions.
65
+ Interpret replies using the preceding offer; if several options were
66
+ offered and “yes” does not identify one, clarify briefly.
67
+
68
+ - Treat a clear answer to your question as an instruction to proceed.
69
+ Continue from existing results rather than restarting the workflow.
70
+
71
71
  Offer only workflows available in this host. Follow their authorization
72
72
  and confirmation requirements before generation or scene changes. If a requested workflow is unavailable,
73
73
  explain the limitation rather than silently substituting another.`;
@@ -1,14 +1,14 @@
1
- {
2
- "name": "Development: Matte Blue",
3
- "resource": {
4
- "data": {
5
- "color.x": 0.08,
6
- "color.y": 0.3,
7
- "color.z": 0.8,
8
- "roughness": 0.85,
9
- "metalness": 0,
10
- "index_of_refraction": 1.5
11
- },
12
- "shaders": []
13
- }
14
- }
1
+ {
2
+ "name": "Development: Matte Blue",
3
+ "resource": {
4
+ "data": {
5
+ "color.x": 0.08,
6
+ "color.y": 0.3,
7
+ "color.z": 0.8,
8
+ "roughness": 0.85,
9
+ "metalness": 0,
10
+ "index_of_refraction": 1.5
11
+ },
12
+ "shaders": []
13
+ }
14
+ }
@@ -1,14 +1,14 @@
1
- {
2
- "name": "Development: Polished Copper",
3
- "resource": {
4
- "data": {
5
- "color.x": 0.955,
6
- "color.y": 0.638,
7
- "color.z": 0.538,
8
- "roughness": 0.18,
9
- "metalness": 1,
10
- "index_of_refraction": 1.5
11
- },
12
- "shaders": []
13
- }
14
- }
1
+ {
2
+ "name": "Development: Polished Copper",
3
+ "resource": {
4
+ "data": {
5
+ "color.x": 0.955,
6
+ "color.y": 0.638,
7
+ "color.z": 0.538,
8
+ "roughness": 0.18,
9
+ "metalness": 1,
10
+ "index_of_refraction": 1.5
11
+ },
12
+ "shaders": []
13
+ }
14
+ }
@@ -17,36 +17,36 @@ export class SqliteSparkStore {
17
17
  this.database.close();
18
18
  throw new Error(`Unsupported Spark database version: ${version}`);
19
19
  }
20
- this.database.exec(`
21
- PRAGMA busy_timeout = 5000;
22
- PRAGMA journal_mode = WAL;
23
- PRAGMA synchronous = FULL;
24
- PRAGMA foreign_keys = ON;
25
- CREATE TABLE IF NOT EXISTS conversations (
26
- id TEXT PRIMARY KEY, owner_id TEXT NOT NULL, updated_at TEXT NOT NULL, data TEXT NOT NULL
27
- );
28
- CREATE INDEX IF NOT EXISTS conversation_owner ON conversations(owner_id, updated_at);
29
- CREATE TABLE IF NOT EXISTS runs (
30
- id TEXT PRIMARY KEY, conversation_id TEXT NOT NULL, data TEXT NOT NULL
31
- );
32
- CREATE TABLE IF NOT EXISTS chunks (
33
- run_id TEXT NOT NULL REFERENCES runs(id), sequence INTEGER NOT NULL, data TEXT NOT NULL,
34
- PRIMARY KEY (run_id, sequence)
35
- );
36
- CREATE TABLE IF NOT EXISTS artifacts (
37
- id TEXT PRIMARY KEY, owner_id TEXT NOT NULL, metadata TEXT NOT NULL, bytes BLOB NOT NULL
38
- );
39
- CREATE TABLE IF NOT EXISTS execution_owner (
40
- singleton INTEGER PRIMARY KEY CHECK (singleton = 1), pid INTEGER NOT NULL, token TEXT NOT NULL
41
- );
42
- CREATE TABLE IF NOT EXISTS scene_operations (
43
- target_key TEXT NOT NULL, id TEXT NOT NULL, revision INTEGER NOT NULL, data TEXT NOT NULL,
44
- PRIMARY KEY (target_key, id)
45
- );
46
- CREATE TABLE IF NOT EXISTS repair_states (
47
- target_key TEXT PRIMARY KEY, revision INTEGER NOT NULL, data TEXT NOT NULL
48
- );
49
- PRAGMA user_version = 4;
20
+ this.database.exec(`
21
+ PRAGMA busy_timeout = 5000;
22
+ PRAGMA journal_mode = WAL;
23
+ PRAGMA synchronous = FULL;
24
+ PRAGMA foreign_keys = ON;
25
+ CREATE TABLE IF NOT EXISTS conversations (
26
+ id TEXT PRIMARY KEY, owner_id TEXT NOT NULL, updated_at TEXT NOT NULL, data TEXT NOT NULL
27
+ );
28
+ CREATE INDEX IF NOT EXISTS conversation_owner ON conversations(owner_id, updated_at);
29
+ CREATE TABLE IF NOT EXISTS runs (
30
+ id TEXT PRIMARY KEY, conversation_id TEXT NOT NULL, data TEXT NOT NULL
31
+ );
32
+ CREATE TABLE IF NOT EXISTS chunks (
33
+ run_id TEXT NOT NULL REFERENCES runs(id), sequence INTEGER NOT NULL, data TEXT NOT NULL,
34
+ PRIMARY KEY (run_id, sequence)
35
+ );
36
+ CREATE TABLE IF NOT EXISTS artifacts (
37
+ id TEXT PRIMARY KEY, owner_id TEXT NOT NULL, metadata TEXT NOT NULL, bytes BLOB NOT NULL
38
+ );
39
+ CREATE TABLE IF NOT EXISTS execution_owner (
40
+ singleton INTEGER PRIMARY KEY CHECK (singleton = 1), pid INTEGER NOT NULL, token TEXT NOT NULL
41
+ );
42
+ CREATE TABLE IF NOT EXISTS scene_operations (
43
+ target_key TEXT NOT NULL, id TEXT NOT NULL, revision INTEGER NOT NULL, data TEXT NOT NULL,
44
+ PRIMARY KEY (target_key, id)
45
+ );
46
+ CREATE TABLE IF NOT EXISTS repair_states (
47
+ target_key TEXT PRIMARY KEY, revision INTEGER NOT NULL, data TEXT NOT NULL
48
+ );
49
+ PRAGMA user_version = 4;
50
50
  `);
51
51
  }
52
52
  repairStateStore(targetKey) {
@@ -127,13 +127,13 @@ export class SqliteSparkStore {
127
127
  if (result.changes !== 1)
128
128
  throw new Error("Scene operation changed concurrently or is missing");
129
129
  if (next.status === "committed" || next.status === "rolled_back") {
130
- this.database.prepare(`
131
- DELETE FROM scene_operations WHERE rowid IN (
132
- SELECT rowid FROM scene_operations
133
- WHERE target_key = ? AND json_extract(data, '$.status') IN ('committed', 'rolled_back')
134
- ORDER BY COALESCE(json_extract(data, '$.completedAt'), '') DESC
135
- LIMIT -1 OFFSET ?
136
- )
130
+ this.database.prepare(`
131
+ DELETE FROM scene_operations WHERE rowid IN (
132
+ SELECT rowid FROM scene_operations
133
+ WHERE target_key = ? AND json_extract(data, '$.status') IN ('committed', 'rolled_back')
134
+ ORDER BY COALESCE(json_extract(data, '$.completedAt'), '') DESC
135
+ LIMIT -1 OFFSET ?
136
+ )
137
137
  `).run(next.targetKey, completedSceneOperationLimit);
138
138
  }
139
139
  this.database.exec("COMMIT");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@womp/spark-agent",
3
- "version": "5.0.2",
3
+ "version": "5.2.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",