@womp/spark-agent 9.4.0 → 10.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/dist/ui.d.ts CHANGED
@@ -3,8 +3,8 @@ export { sparkErrorDiagnostics, sparkErrorDiagnosticsSchema, type SparkErrorDiag
3
3
  import type { InferUIMessageChunk, UIMessage } from "ai";
4
4
  import type { SceneScreenshotOptions } from "./capabilities/scene.js";
5
5
  import { z } from "zod";
6
- export type { SparkGoal, SparkGoalCommand, SparkGoalCondition, SparkGoalDecision, SparkGoalOutcome, SparkGoalProposal, SparkGoalProposalPart, SparkGoalTry } from "./goals.js";
7
- import { type SparkGoalOutcome, type SparkGoalProposal, type SparkGoalProposalPart } from "./goals.js";
6
+ export type { SparkGoal, SparkGoalCommand, SparkGoalCondition, SparkGoalOutcome, SparkGoalRequest, SparkGoalResult, SparkGoalSummary, SparkGoalTry } from "./goals.js";
7
+ import type { SparkGoalRequest, SparkGoalResult } from "./goals.js";
8
8
  import type { ExecutionReceipt, SparkSkill } from "./capabilities.js";
9
9
  export { DEFAULT_MODEL_ID, getSparkModel, REASONING_EFFORT_LABELS, resolveReasoningEffort, SPARK_MODELS, } from "./models.js";
10
10
  export type { ModelProvider, ReasoningEffort, SparkModel } from "./models.js";
@@ -92,7 +92,7 @@ export type SparkDataParts = {
92
92
  };
93
93
  selection: SparkSelectionData;
94
94
  compaction: SparkCompaction;
95
- "goal-proposal": SparkGoalProposalPart;
95
+ "flow-run-result": SparkFlowRunResult;
96
96
  };
97
97
  /** Editor node IDs selected when a user message was sent; never rendered as chat text. */
98
98
  export type SparkSelectionData = {
@@ -156,12 +156,10 @@ export type SparkUITools = {
156
156
  skills: SkillReadResult[];
157
157
  };
158
158
  };
159
- /** Offered only by hosts that can ask the user; see `SparkGoalOffer`. */
160
- propose_goal: {
161
- input: SparkGoalProposal;
162
- output: {
163
- goal: SparkGoalOutcome;
164
- };
159
+ /** Offered only by hosts that run goals; see `SparkGoalHandler`. */
160
+ goal: {
161
+ input: SparkGoalRequest;
162
+ output: SparkGoalResult;
165
163
  };
166
164
  };
167
165
  export type SkillReadResult = ({
@@ -196,9 +194,9 @@ export declare const sparkMessageMetadataSchema: z.ZodObject<{
196
194
  durationMs: z.ZodOptional<z.ZodNumber>;
197
195
  runId: z.ZodOptional<z.ZodString>;
198
196
  runStatus: z.ZodOptional<z.ZodEnum<{
197
+ running: "running";
199
198
  completed: "completed";
200
199
  queued: "queued";
201
- running: "running";
202
200
  requires_action: "requires_action";
203
201
  failed: "failed";
204
202
  cancelled: "cancelled";
@@ -247,6 +245,36 @@ export declare const sparkMessageMetadataSchema: z.ZodObject<{
247
245
  }, z.core.$strip>>>;
248
246
  }, z.core.$strip>>;
249
247
  }, z.core.$strip>;
248
+ declare const flowRunResultSchema: z.ZodObject<{
249
+ runId: z.ZodString;
250
+ flowTitle: z.ZodString;
251
+ status: z.ZodEnum<{
252
+ completed: "completed";
253
+ failed: "failed";
254
+ cancelled: "cancelled";
255
+ }>;
256
+ error: z.ZodNullable<z.ZodString>;
257
+ failedNodes: z.ZodArray<z.ZodObject<{
258
+ nodeId: z.ZodString;
259
+ label: z.ZodString;
260
+ }, z.core.$strip>>;
261
+ outputs: z.ZodArray<z.ZodObject<{
262
+ nodeId: z.ZodString;
263
+ label: z.ZodString;
264
+ title: z.ZodString;
265
+ url: z.ZodString;
266
+ thumbnailUrl: z.ZodOptional<z.ZodString>;
267
+ }, z.core.$strip>>;
268
+ copy: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
269
+ url: z.ZodString;
270
+ }, z.core.$strip>, z.ZodObject<{
271
+ deleted: z.ZodLiteral<true>;
272
+ }, z.core.$strip>]>>;
273
+ }, z.core.$strip>;
274
+ /** A finished flow run, attached to a user message the host sends as an event. */
275
+ export type SparkFlowRunResult = z.infer<typeof flowRunResultSchema>;
276
+ /** The line the model reads for a `flow-run-result` part (model-history.ts); empty segments are left out. */
277
+ export declare function flowRunResultText(data: SparkFlowRunResult): string;
250
278
  export declare const sparkDataPartSchemas: {
251
279
  readonly "tool-input-label": z.ZodObject<{
252
280
  toolCallId: z.ZodString;
@@ -291,9 +319,9 @@ export declare const sparkDataPartSchemas: {
291
319
  readonly "run-status": z.ZodObject<{
292
320
  runId: z.ZodString;
293
321
  status: z.ZodEnum<{
322
+ running: "running";
294
323
  completed: "completed";
295
324
  queued: "queued";
296
- running: "running";
297
325
  requires_action: "requires_action";
298
326
  failed: "failed";
299
327
  cancelled: "cancelled";
@@ -378,24 +406,36 @@ export declare const sparkDataPartSchemas: {
378
406
  createdAt: z.ZodString;
379
407
  }, z.core.$strip>;
380
408
  /**
381
- * The goal the agent proposed in this message, for hosts to show: as the
382
- * confirmation while it waits, and as the goal once it started. The model
383
- * reads the proposal from its `propose_goal` call, not from this part.
409
+ * A finished flow run, as an event. Hosts attach it to a user message, render
410
+ * it as an event and not as that user's text; the model reads it as text
411
+ * (model-history.ts). Hosts that validate stored parts take 9.5.0 first.
384
412
  */
385
- readonly "goal-proposal": z.ZodObject<{
386
- title: z.ZodString;
387
- conditions: z.ZodArray<z.ZodObject<{
388
- text: z.ZodString;
389
- measurable: z.ZodBoolean;
413
+ readonly "flow-run-result": z.ZodObject<{
414
+ runId: z.ZodString;
415
+ flowTitle: z.ZodString;
416
+ status: z.ZodEnum<{
417
+ completed: "completed";
418
+ failed: "failed";
419
+ cancelled: "cancelled";
420
+ }>;
421
+ error: z.ZodNullable<z.ZodString>;
422
+ failedNodes: z.ZodArray<z.ZodObject<{
423
+ nodeId: z.ZodString;
424
+ label: z.ZodString;
390
425
  }, z.core.$strip>>;
391
- toolCallId: z.ZodString;
392
- outcome: z.ZodOptional<z.ZodEnum<{
393
- active: "active";
394
- unanswered: "unanswered";
395
- started: "started";
396
- declined: "declined";
397
- }>>;
426
+ outputs: z.ZodArray<z.ZodObject<{
427
+ nodeId: z.ZodString;
428
+ label: z.ZodString;
429
+ title: z.ZodString;
430
+ url: z.ZodString;
431
+ thumbnailUrl: z.ZodOptional<z.ZodString>;
432
+ }, z.core.$strip>>;
433
+ copy: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
434
+ url: z.ZodString;
435
+ }, z.core.$strip>, z.ZodObject<{
436
+ deleted: z.ZodLiteral<true>;
437
+ }, z.core.$strip>]>>;
398
438
  }, z.core.$strip>;
399
439
  };
400
440
  export { parseWompifyCommand, WOMPIFY_PRESETS, wompifyPrompt, wompifyContextSchema, type WompifyRequest, type WompifyContext } from "./wompify.js";
401
- export { DEFAULT_GOAL_CREDITS, GOAL_CONFIRMATION_DEFAULTS, sparkGoalProposalPartSchema, sparkGoalProposalSchema } from "./goals.js";
441
+ export { DEFAULT_GOAL_CREDITS } from "./goals.js";
package/dist/ui.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { sparkErrorDiagnosticsSchema } from "./error-diagnostics.js";
2
2
  export { sparkErrorDiagnostics, sparkErrorDiagnosticsSchema, } from "./error-diagnostics.js";
3
3
  import { z } from "zod";
4
- import { sparkGoalProposalPartSchema } from "./goals.js";
5
4
  export { DEFAULT_MODEL_ID, getSparkModel, REASONING_EFFORT_LABELS, resolveReasoningEffort, SPARK_MODELS, } from "./models.js";
6
5
  export const SPARK_RUN_STATUSES = [
7
6
  "queued",
@@ -54,6 +53,33 @@ export const sparkMessageMetadataSchema = z.object({
54
53
  error: z.string().optional(),
55
54
  errorDiagnostics: sparkErrorDiagnosticsSchema.optional(),
56
55
  });
56
+ const flowRunResultSchema = z.object({
57
+ runId: z.string().min(1),
58
+ flowTitle: z.string(),
59
+ status: z.enum(["completed", "failed", "cancelled"]),
60
+ /** A sentence for the user; never a provider message. */
61
+ error: z.string().nullable(),
62
+ failedNodes: z.array(z.object({ nodeId: z.string(), label: z.string() })).max(10),
63
+ /** Only what this run produced; outputs with no URL are left out. */
64
+ outputs: z
65
+ .array(z.object({ nodeId: z.string(), label: z.string(), title: z.string(), url: z.string(), thumbnailUrl: z.string().optional() }))
66
+ .max(20),
67
+ copy: z.union([z.object({ url: z.string() }), z.object({ deleted: z.literal(true) })]).nullable(),
68
+ });
69
+ /** The line the model reads for a `flow-run-result` part (model-history.ts); empty segments are left out. */
70
+ export function flowRunResultText(data) {
71
+ const sentence = (text) => (/[.!?]$/.test(text) ? text : `${text}.`);
72
+ const segments = [`[Flow run finished] Flow "${data.flowTitle}" ${data.status}.`];
73
+ if (data.failedNodes.length)
74
+ segments.push(`Failed steps: ${data.failedNodes.map((node) => node.label).join(", ")}.`);
75
+ if (data.outputs.length)
76
+ segments.push(`Outputs: ${data.outputs.map((output) => `${output.title} (${output.url})`).join(", ")}.`);
77
+ if (data.copy)
78
+ segments.push(`Copy: ${"url" in data.copy ? data.copy.url : "deleted"}.`);
79
+ if (data.error)
80
+ segments.push(`Error: ${sentence(data.error)}`);
81
+ return segments.join(" ");
82
+ }
57
83
  export const sparkDataPartSchemas = {
58
84
  "tool-input-label": z.object({
59
85
  toolCallId: z.string(),
@@ -97,11 +123,11 @@ export const sparkDataPartSchemas = {
97
123
  createdAt: z.string().datetime(),
98
124
  }),
99
125
  /**
100
- * The goal the agent proposed in this message, for hosts to show: as the
101
- * confirmation while it waits, and as the goal once it started. The model
102
- * reads the proposal from its `propose_goal` call, not from this part.
126
+ * A finished flow run, as an event. Hosts attach it to a user message, render
127
+ * it as an event and not as that user's text; the model reads it as text
128
+ * (model-history.ts). Hosts that validate stored parts take 9.5.0 first.
103
129
  */
104
- "goal-proposal": sparkGoalProposalPartSchema,
130
+ "flow-run-result": flowRunResultSchema,
105
131
  };
106
132
  export { parseWompifyCommand, WOMPIFY_PRESETS, wompifyPrompt, wompifyContextSchema } from "./wompify.js";
107
- export { DEFAULT_GOAL_CREDITS, GOAL_CONFIRMATION_DEFAULTS, sparkGoalProposalPartSchema, sparkGoalProposalSchema } from "./goals.js";
133
+ export { DEFAULT_GOAL_CREDITS } from "./goals.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@womp/spark-agent",
3
- "version": "9.4.0",
3
+ "version": "10.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",