@womp/spark-agent 12.0.0 → 13.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.
- package/CHANGELOG.md +27 -0
- package/README.md +1 -1
- package/dist/agent-tools.js +4 -4
- package/dist/agent.js +21 -2
- package/dist/goals.d.ts +0 -6
- package/dist/goals.js +0 -3
- package/dist/server/index.d.ts +0 -1
- package/dist/server/index.js +0 -1
- package/dist/server/service.js +3 -3
- package/dist/ui.d.ts +0 -1
- package/dist/ui.js +0 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,33 @@ Notable changes to `@womp/spark-agent`, newest first. Versions follow
|
|
|
4
4
|
[Semantic Versioning](https://semver.org/). Add an entry with each version bump; describe what
|
|
5
5
|
changed for hosts and users, and how to migrate across breaking changes.
|
|
6
6
|
|
|
7
|
+
## 13.0.1 — 2026-10-20
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- A run is no longer failed by a tool call the model got wrong: input that does not parse or fails
|
|
12
|
+
the tool's schema, or a tool that does not exist. The AI SDK already answers such a call with a
|
|
13
|
+
tool error and lets the model continue. The run used to keep going, finish its work, and then be
|
|
14
|
+
stored `failed` with `AI_InvalidToolInputError: Invalid input for tool …` as its error (SW-006).
|
|
15
|
+
A tool that throws while it runs (a persistence barrier, say) still fails the run.
|
|
16
|
+
|
|
17
|
+
## 13.0.0 — 2026-10-19
|
|
18
|
+
|
|
19
|
+
A goal has no tries or credit limit of its own: it goes on until its conditions are verified, it is
|
|
20
|
+
blocked, it pauses, or the user's own credits run out.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- A goal the agent sets without `tries` or `credits` gets no `maxTurns` and no `creditBudget`
|
|
25
|
+
(before: 5 tries and 2,000 credits where the host counts credits). Limits the user asks for, and
|
|
26
|
+
the Wompify tiers' limits, still apply. The `goal` tool tells the agent so.
|
|
27
|
+
- The standalone goal bar shows the try number of a goal without a tries limit.
|
|
28
|
+
|
|
29
|
+
### Removed
|
|
30
|
+
|
|
31
|
+
- `DEFAULT_GOAL_CREDITS` from `@womp/spark-agent/server` and `@womp/spark-agent/ui`. A host that
|
|
32
|
+
filled it in for `set` stops doing so, or passes its own `creditBudget`.
|
|
33
|
+
|
|
7
34
|
## 12.0.0 — 2026-10-16
|
|
8
35
|
|
|
9
36
|
### Changed
|
package/README.md
CHANGED
|
@@ -158,7 +158,7 @@ A goal starts from an ordinary message, when the agent sets one, and changes whe
|
|
|
158
158
|
chat. A service with `evaluateGoal` gives the agent the `goal` tool. With `set` it starts a goal
|
|
159
159
|
before building, when the request sets constraints a result can be measured against, from a title
|
|
160
160
|
and the conditions, each one tool results can check. The goal starts at once,
|
|
161
|
-
with that run as its first try and with
|
|
161
|
+
with that run as its first try, and with no tries or credit limit unless the call gives one; the
|
|
162
162
|
service evaluates each condition after every try and records the result on
|
|
163
163
|
`goal.conditions`. `change` gives the goal new conditions or limits, `continue` has a stopped goal
|
|
164
164
|
go on, and `remove` ends it; after a change the goal goes on in that turn. A `set` over an existing
|
package/dist/agent-tools.js
CHANGED
|
@@ -3,7 +3,7 @@ import { z } from "zod";
|
|
|
3
3
|
import { boundedResultText, canonicalJsonValue } from "./bounded-output.js";
|
|
4
4
|
import { completedInputString } from "./tool-input-label.js";
|
|
5
5
|
import { UserWait } from "./execution-lifetime.js";
|
|
6
|
-
import {
|
|
6
|
+
import { GOAL_MORE_TRIES, sparkGoalRequestSchema } from "./goals.js";
|
|
7
7
|
function errorMessage(error) {
|
|
8
8
|
return error instanceof Error ? error.message : String(error);
|
|
9
9
|
}
|
|
@@ -31,7 +31,7 @@ function goalResultText({ goal, tries, credits }) {
|
|
|
31
31
|
const upTo = limits ? `, up to ${limits}` : "";
|
|
32
32
|
switch (goal) {
|
|
33
33
|
case "started":
|
|
34
|
-
return `The goal is set and running${upTo}. Tell the user in one line that you set a goal from their message, its limits, and that they can tell you to stop or change anything. Then build it. An independent check follows each try and sends back what is still unmet. It cannot run tools: it reads what your tool calls print. So before you finish, print each condition's measured value in one call.`;
|
|
34
|
+
return `The goal is set and running${upTo}. Tell the user in one line that you set a goal from their message${limits ? ", its limits" : ""}, and that they can tell you to stop or change anything. Then build it. An independent check follows each try and sends back what is still unmet. It cannot run tools: it reads what your tool calls print. So before you finish, print each condition's measured value in one call.`;
|
|
35
35
|
case "running":
|
|
36
36
|
return `The goal is running${upTo}, with this turn as its next try. Confirm to the user in one line what changed, then keep working toward it.`;
|
|
37
37
|
case "done":
|
|
@@ -109,8 +109,8 @@ export function createSparkTools(options) {
|
|
|
109
109
|
inputSchema: sparkGoalRequestSchema.extend({
|
|
110
110
|
title: sparkGoalRequestSchema.shape.title.describe("For set: two to four words in sentence case naming what is being made."),
|
|
111
111
|
conditions: sparkGoalRequestSchema.shape.conditions.describe("For set, and for change when the conditions change: the full list. Only constraints the user stated or directly implied, never your own, that tool results can check. The description of what to make is not a list of constraints: leave out its parts and features, and any instruction about how to work, what to check or what to render. State each as a fact about the finished result in a few words of the user's language, with its number and unit: \"Height is 120 mm\", not \"Make it 120 mm tall\". Split compound constraints. Leave out a look, style, feel or quality that takes judgement: it is not a condition. Keep a condition's words as they are when it does not change."),
|
|
112
|
-
tries: sparkGoalRequestSchema.shape.tries.describe(`For set or change: the most tries the goal may take, when the user gave a number.
|
|
113
|
-
credits: sparkGoalRequestSchema.shape.credits.describe(`For set or change: the most credits the goal may spend, when the user gave a number.
|
|
112
|
+
tries: sparkGoalRequestSchema.shape.tries.describe(`For set or change: the most tries the goal may take, only when the user gave a number. Without one the goal has no tries limit; continue adds ${GOAL_MORE_TRIES} to one that used its tries.`),
|
|
113
|
+
credits: sparkGoalRequestSchema.shape.credits.describe(`For set or change: the most credits the goal may spend, only when the user gave a number. Without one the goal has no credit limit of its own.`),
|
|
114
114
|
}),
|
|
115
115
|
execute: (input, { toolCallId }) => execute({ id: toolCallId, name: "goal", input }, () => handleGoal(input)),
|
|
116
116
|
toModelOutput: ({ output }) => ({ type: "text", value: goalResultText(output) }),
|
package/dist/agent.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { sparkErrorDiagnostics } from "./error-diagnostics.js";
|
|
2
|
-
import { createUIMessageStream, stepCountIs, streamText, } from "ai";
|
|
2
|
+
import { createUIMessageStream, InvalidToolInputError, NoSuchToolError, stepCountIs, streamText, ToolCallRepairError, } from "ai";
|
|
3
3
|
import { createSparkTools } from "./agent-tools.js";
|
|
4
4
|
import { sparkSystemPrompt } from "./prompt.js";
|
|
5
5
|
import { calculateStepCost } from "./pricing.js";
|
|
@@ -9,6 +9,16 @@ import { convertSparkMessages } from "./model-history.js";
|
|
|
9
9
|
function errorMessage(error) {
|
|
10
10
|
return sparkErrorDiagnostics(error).message;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* A tool call the model got wrong: input that does not parse or fails the
|
|
14
|
+
* tool's schema, or a tool that does not exist. The AI SDK answers it with a
|
|
15
|
+
* tool error and gives the model its next step, so it is not the run's failure.
|
|
16
|
+
*/
|
|
17
|
+
function isModelToolCallError(error) {
|
|
18
|
+
return (InvalidToolInputError.isInstance(error) ||
|
|
19
|
+
NoSuchToolError.isInstance(error) ||
|
|
20
|
+
ToolCallRepairError.isInstance(error));
|
|
21
|
+
}
|
|
12
22
|
/**
|
|
13
23
|
* `stop` completes a run and `tool-calls` means the step budget ran out
|
|
14
24
|
* (`stopWhen` is the only other way the loop ends), which leaves it
|
|
@@ -120,6 +130,9 @@ export function runSparkAgent(options) {
|
|
|
120
130
|
},
|
|
121
131
|
execute: async ({ writer }) => {
|
|
122
132
|
let generationError;
|
|
133
|
+
// The tool errors the model was answered with for its own bad calls
|
|
134
|
+
// (`isModelToolCallError`), as the AI SDK words them (`String(error)`).
|
|
135
|
+
const answeredToModel = new Set();
|
|
123
136
|
let stepCount = 0;
|
|
124
137
|
try {
|
|
125
138
|
controller.signal.throwIfAborted();
|
|
@@ -241,8 +254,14 @@ export function runSparkAgent(options) {
|
|
|
241
254
|
writer.merge(generation.toUIMessageStream({
|
|
242
255
|
generateMessageId: () => options.messageId,
|
|
243
256
|
onError: (error) => {
|
|
257
|
+
// Also called for tool errors. A bad call of the model's arrives
|
|
258
|
+
// twice, as its own error and then as the tool error the model
|
|
259
|
+
// is sent (that error's `String`); neither fails the run.
|
|
260
|
+
if (isModelToolCallError(error))
|
|
261
|
+
answeredToModel.add(String(error));
|
|
244
262
|
// streamText's onError callback may run later on another stream branch.
|
|
245
|
-
|
|
263
|
+
else if (!(typeof error === "string" && answeredToModel.has(error)))
|
|
264
|
+
generationError = error;
|
|
246
265
|
return errorMessage(error);
|
|
247
266
|
},
|
|
248
267
|
sendReasoning: true,
|
package/dist/goals.d.ts
CHANGED
|
@@ -24,11 +24,6 @@ export type SparkGoalTry = {
|
|
|
24
24
|
/** In the order of the goal's conditions; a condition left to the user has no result. */
|
|
25
25
|
conditions: Pick<SparkGoalCondition, "met" | "reason">[];
|
|
26
26
|
};
|
|
27
|
-
/** The caps of a goal the agent sets, unless the user asked for others. */
|
|
28
|
-
export declare const GOAL_DEFAULT_CAPS: {
|
|
29
|
-
readonly tries: 5;
|
|
30
|
-
readonly credits: 2000;
|
|
31
|
-
};
|
|
32
27
|
/** The tries a goal that used its tries gets when the user has it keep going. */
|
|
33
28
|
export declare const GOAL_MORE_TRIES = 3;
|
|
34
29
|
/**
|
|
@@ -125,4 +120,3 @@ export declare const sparkGoalCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
125
120
|
}>;
|
|
126
121
|
}, z.core.$strip>], "action">;
|
|
127
122
|
export type SparkGoalCommand = z.infer<typeof sparkGoalCommandSchema>;
|
|
128
|
-
export declare const DEFAULT_GOAL_CREDITS = 50000;
|
package/dist/goals.js
CHANGED
|
@@ -13,8 +13,6 @@ const goalCaps = {
|
|
|
13
13
|
creditBudget: z.number().int().positive().max(1_000_000_000).optional(),
|
|
14
14
|
maxTurns: z.number().int().min(1).max(100).optional(),
|
|
15
15
|
};
|
|
16
|
-
/** The caps of a goal the agent sets, unless the user asked for others. */
|
|
17
|
-
export const GOAL_DEFAULT_CAPS = { tries: 5, credits: 2_000 };
|
|
18
16
|
/** The tries a goal that used its tries gets when the user has it keep going. */
|
|
19
17
|
export const GOAL_MORE_TRIES = 3;
|
|
20
18
|
/**
|
|
@@ -46,4 +44,3 @@ export const sparkGoalCommandSchema = z.discriminatedUnion("action", [
|
|
|
46
44
|
}),
|
|
47
45
|
z.object({ action: z.enum(["status", "pause", "resume", "clear"]) }),
|
|
48
46
|
]);
|
|
49
|
-
export const DEFAULT_GOAL_CREDITS = 50_000;
|
package/dist/server/index.d.ts
CHANGED
|
@@ -9,4 +9,3 @@ export { MemorySparkAgentStore } from "./store.js";
|
|
|
9
9
|
export { SqliteSparkStore } from "./sqlite-store.js";
|
|
10
10
|
export { createStandaloneSparkAgentApp, type StandaloneSparkAgentOptions, type StandaloneSparkAgentApp, } from "./standalone.js";
|
|
11
11
|
export type { SparkAgentStore, SparkConversation, SparkConversationSummary, SparkRun, SparkRunExecutionContext, SparkRunExecutor, SparkRunSettings, } from "./types.js";
|
|
12
|
-
export { DEFAULT_GOAL_CREDITS } from "../goals.js";
|
package/dist/server/index.js
CHANGED
|
@@ -6,4 +6,3 @@ export { DEFAULT_ENDING_RETRY_DELAYS_MS, RUN_INTERRUPTED_ERROR, RUN_NOT_SAVED_ER
|
|
|
6
6
|
export { MemorySparkAgentStore } from "./store.js";
|
|
7
7
|
export { SqliteSparkStore } from "./sqlite-store.js";
|
|
8
8
|
export { createStandaloneSparkAgentApp, } from "./standalone.js";
|
|
9
|
-
export { DEFAULT_GOAL_CREDITS } from "../goals.js";
|
package/dist/server/service.js
CHANGED
|
@@ -2,7 +2,7 @@ import { sparkErrorDiagnostics } from "../error-diagnostics.js";
|
|
|
2
2
|
import { validateUIMessages } from "ai";
|
|
3
3
|
import { foldAllChunks } from "./message-fold.js";
|
|
4
4
|
import { sparkDataPartSchemas, sparkMessageMetadataSchema, } from "../ui.js";
|
|
5
|
-
import {
|
|
5
|
+
import { GOAL_MORE_TRIES, MAX_GOAL_LENGTH, sparkGoalCommandSchema } from "../goals.js";
|
|
6
6
|
import { goalVerdictSchema } from "./goal-evaluator.js";
|
|
7
7
|
const TERMINAL_STATUSES = new Set([
|
|
8
8
|
"completed",
|
|
@@ -657,8 +657,8 @@ export class SparkAgentService {
|
|
|
657
657
|
id: crypto.randomUUID(), objective: (message ? messageText(message) : "").slice(0, MAX_GOAL_LENGTH) || request.title,
|
|
658
658
|
title: request.title, conditions: request.conditions,
|
|
659
659
|
status: "active", settings: run.settings, createdAt, updatedAt: createdAt, turns: 0, runId: run.id,
|
|
660
|
-
maxTurns: caps.maxTurns
|
|
661
|
-
...(
|
|
660
|
+
...(caps.maxTurns === undefined ? {} : { maxTurns: caps.maxTurns }),
|
|
661
|
+
...(caps.creditBudget === undefined ? {} : { creditBudget: caps.creditBudget, creditsUsed: 0 }),
|
|
662
662
|
};
|
|
663
663
|
if (current)
|
|
664
664
|
ended = goalSummary(current, current.status === "completed" ? "done" : "replaced");
|
package/dist/ui.d.ts
CHANGED
package/dist/ui.js
CHANGED