@womp/spark-agent 3.0.0 → 3.0.1

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.
@@ -82,7 +82,7 @@ export function createSparkTools(options) {
82
82
  },
83
83
  };
84
84
  const logs = [];
85
- const receipts = [];
85
+ const receipts = new Map();
86
86
  const artifacts = [];
87
87
  const pending = new Set();
88
88
  let outputBytes = 0;
@@ -117,7 +117,7 @@ export function createSparkTools(options) {
117
117
  }
118
118
  }),
119
119
  recordReceipt: (receipt) => {
120
- receipts.push(receipt);
120
+ receipts.set(receipt.id, structuredClone(receipt));
121
121
  options.write({
122
122
  type: "data-execution-receipt",
123
123
  id: receipt.id,
@@ -169,7 +169,7 @@ export function createSparkTools(options) {
169
169
  purpose: input.purpose,
170
170
  value: jsonValue(value),
171
171
  logs,
172
- receipts,
172
+ receipts: [...receipts.values()],
173
173
  artifacts,
174
174
  };
175
175
  }
@@ -182,7 +182,7 @@ export function createSparkTools(options) {
182
182
  purpose: input.purpose,
183
183
  value: null,
184
184
  logs,
185
- receipts,
185
+ receipts: [...receipts.values()],
186
186
  artifacts,
187
187
  error: errorMessage(error),
188
188
  };
package/dist/agent.js CHANGED
@@ -144,6 +144,7 @@ export function runSparkAgent(options) {
144
144
  toolNames: step.toolCalls.map(({ toolName }) => toolName),
145
145
  responseTimeMs: step.performance.responseTimeMs,
146
146
  cost: calculateStepCost(options.modelId, step.usage),
147
+ usage: step.usage,
147
148
  },
148
149
  });
149
150
  if (options.persistence?.saveMessage !== undefined) {
package/dist/ui.d.ts CHANGED
@@ -53,6 +53,7 @@ export type SparkStepMetricsData = {
53
53
  toolNames: string[];
54
54
  responseTimeMs: number;
55
55
  cost?: SparkStepCost;
56
+ usage?: unknown;
56
57
  };
57
58
  export declare const sparkExecutionReceiptSchema: z.ZodObject<{
58
59
  id: z.ZodString;
@@ -220,5 +221,6 @@ export declare const sparkDataPartSchemas: {
220
221
  usd: z.ZodNumber;
221
222
  }, z.core.$strip>>;
222
223
  }, z.core.$strip>>;
224
+ usage: z.ZodOptional<z.ZodUnknown>;
223
225
  }, z.core.$strip>;
224
226
  };
package/dist/ui.js CHANGED
@@ -67,5 +67,6 @@ export const sparkDataPartSchemas = {
67
67
  toolNames: z.array(z.string()),
68
68
  responseTimeMs: z.number().nonnegative(),
69
69
  cost: sparkStepCostSchema.optional(),
70
+ usage: z.unknown().optional(),
70
71
  }),
71
72
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@womp/spark-agent",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
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",