@womp/spark-agent 9.3.0 → 9.5.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/CHANGELOG.md +39 -0
- package/dist/capabilities/flow-runs.d.ts +9 -0
- package/dist/capabilities/flow-runs.js +1 -0
- package/dist/capabilities.d.ts +1 -1
- package/dist/generated/flow-runs-declarations.d.ts +1 -1
- package/dist/generated/flow-runs-declarations.js +1 -1
- package/dist/model-history.js +5 -1
- package/dist/server/service.d.ts +7 -0
- package/dist/server/service.js +4 -2
- package/dist/ui.d.ts +62 -0
- package/dist/ui.js +33 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,45 @@ 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
|
+
## 9.5.0 — 2026-10-13
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- The `flow-run-result` data part in `sparkDataPartSchemas`: a finished flow run (`runId`,
|
|
12
|
+
`flowTitle`, `status`, `error`, `failedNodes`, `outputs`, `copy`). `convertSparkMessages` turns it
|
|
13
|
+
into one text line for the model, built by the new export `flowRunResultText(data)` (also from
|
|
14
|
+
`@womp/spark-agent/ui`) and the type `SparkFlowRunResult`.
|
|
15
|
+
- `hostParts?: boolean` on `SubmitSparkMessageInput`: set only by host code, it lets
|
|
16
|
+
`submitMessage` accept a `data-flow-run-result` part (still validated by `sparkDataPartSchemas`).
|
|
17
|
+
Without it the part is refused with 400. The express router never sets it from a request body.
|
|
18
|
+
- `failedNodes` on `FlowRunStatus` and `FlowRunStarted` (optional), and the `flow-runs` skill tells
|
|
19
|
+
the model to name the failed steps.
|
|
20
|
+
|
|
21
|
+
### Migration
|
|
22
|
+
|
|
23
|
+
- Hosts that validate stored parts with `sparkDataPartSchemas` take 9.5.0 before a host that writes
|
|
24
|
+
the part. Render the part as an event, not as a user message.
|
|
25
|
+
- Hosts submit the part with `hostParts: true` on `submitMessage`.
|
|
26
|
+
- Once a host writes the `flow-run-result` part into stored conversations, every reader of those
|
|
27
|
+
conversations must be at 9.5.0 or newer. A 9.4.x bundle (a frontend rollback, a tab open from
|
|
28
|
+
before the frontend deploy, a preview build not on 9.5.0) fails to read the thread ("The saved
|
|
29
|
+
conversation could not be read"), and rolling the writing host back below 9.5.0 makes later
|
|
30
|
+
submits in those threads fail. Deploy readers first, and do not roll back below 9.5.0 after the
|
|
31
|
+
writer is live.
|
|
32
|
+
|
|
33
|
+
## 9.4.0 — 2026-10-13
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- Depends on `@womp/kakapo-sdk` 0.10.0, which removes `KakapoAPI.waitForRenderer()`. Spark has not
|
|
38
|
+
called it since 9.2.1.
|
|
39
|
+
|
|
40
|
+
### Migration
|
|
41
|
+
|
|
42
|
+
- Hosts that pin the SDK move it to 0.10.0 with this release, because the host's `KakapoAPI` and
|
|
43
|
+
Spark must share one SDK copy. Delete any `waitForRenderer()` calls, including from test doubles
|
|
44
|
+
of `KakapoAPI`.
|
|
45
|
+
|
|
7
46
|
## 9.3.0 — 2026-10-13
|
|
8
47
|
|
|
9
48
|
### Changed
|
|
@@ -13,6 +13,11 @@ export type FlowRunOutputNode = {
|
|
|
13
13
|
nodeId: string;
|
|
14
14
|
typeId: string;
|
|
15
15
|
};
|
|
16
|
+
/** A step that failed; `label` is its display name, never a provider message. */
|
|
17
|
+
export type FlowRunFailedNode = {
|
|
18
|
+
nodeId: string;
|
|
19
|
+
label: string;
|
|
20
|
+
};
|
|
16
21
|
export type FlowRunLive = {
|
|
17
22
|
runId: string;
|
|
18
23
|
trigger: string;
|
|
@@ -39,6 +44,8 @@ export type FlowRunStarted = {
|
|
|
39
44
|
deleteCopy: boolean;
|
|
40
45
|
/** When the copy was deleted (ISO); null while it exists. */
|
|
41
46
|
copyDeletedAt: string | null;
|
|
47
|
+
/** Set when the run already failed by the time start returns (a repeated start). */
|
|
48
|
+
failedNodes?: FlowRunFailedNode[];
|
|
42
49
|
};
|
|
43
50
|
export type FlowRunStatus = {
|
|
44
51
|
runId: string;
|
|
@@ -55,6 +62,8 @@ export type FlowRunStatus = {
|
|
|
55
62
|
projectUrl: string | null;
|
|
56
63
|
deleteCopy: boolean;
|
|
57
64
|
copyDeletedAt: string | null;
|
|
65
|
+
/** On a failed run: the steps that failed, by display name. Absent from older hosts. */
|
|
66
|
+
failedNodes?: FlowRunFailedNode[];
|
|
58
67
|
};
|
|
59
68
|
export type FlowRunCancelled = {
|
|
60
69
|
runId: string;
|
|
@@ -27,6 +27,7 @@ Only one run of a flow can be live. run() starts the run and returns at once. Fo
|
|
|
27
27
|
To leave the user's flow untouched, pass copy: true. The run then happens on a new copy of the project, placed in the user's "Flow runs" folder: the input values, outputs and any scene changes land on the copy, and the user's flow, its saved values and its scene are not changed. Use it when the user wants to try values without changing their flow, or when their flow is busy. A copy run does not lock the scene. run() returns the copy's projectUrl; give it to the user so they can open the result.
|
|
28
28
|
To keep only the result of a copy run, also pass deleteCopy: true: the copy is deleted when the run ends, whether it completed, failed or was cancelled. Use it when the user wants the outputs, not the project; do not give them that run's projectUrl, which stops working (status() then returns projectUrl null).
|
|
29
29
|
To delete a copy run's copy later, call deleteCopy(runId) once the run has ended; it is refused for a run that is still running (cancel it first) or one that did not run on a copy. Right after cancel(), deleteCopy() may answer run_active for about a minute while the run stops: retry later, or pass deleteCopy: true at start instead. Output links keep working after the copy is deleted, either way.
|
|
30
|
+
When a run fails, name the failed steps from failedNodes in your answer (the error alone is generic). The outputs listed for a run are only what that run produced; do not present anything else as its result.
|
|
30
31
|
A run may outlive your turn. If it does, the system reports the result in a follow-up, so do not keep calling status() across many calls.
|
|
31
32
|
When status() or wait() returns an ended run with reported "now", the result is yours to tell the user. With reported "earlier", the result was already reported, earlier in the conversation or by the refusal run() returned to you; do not repeat it.
|
|
32
33
|
Errors start with a code. flow_busy and snapshot_changed mean the user is using the flow: tell them and do not retry. backend_deploying means try again later. not_authorized is final. no_project means the conversation needs a project first.
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type { SceneHealthHost } from "./capabilities/scene.js";
|
|
|
18
18
|
export { createFlowCapability } from "./capabilities/flow.js";
|
|
19
19
|
export type { FlowHost, FlowSnapshot, FlowWrite, FlowWriteResult, WompFlowApi, } from "./capabilities/flow.js";
|
|
20
20
|
export { createFlowRunsCapability, FLOW_RUN_WAIT_DEFAULT_SECONDS, FLOW_RUN_WAIT_MAX_SECONDS, } from "./capabilities/flow-runs.js";
|
|
21
|
-
export type { FlowRunCancelled, FlowRunCopyDeleted, FlowRunDescription, FlowRunInput, FlowRunLive, FlowRunOutputNode, FlowRunStarted, FlowRunStatus, FlowRunsHost, WompFlowRunsApi, } from "./capabilities/flow-runs.js";
|
|
21
|
+
export type { FlowRunCancelled, FlowRunCopyDeleted, FlowRunDescription, FlowRunInput, FlowRunLive, FlowRunOutputNode, FlowRunFailedNode, FlowRunStarted, FlowRunStatus, FlowRunsHost, WompFlowRunsApi, } from "./capabilities/flow-runs.js";
|
|
22
22
|
export type { GeometryHost, GeometryTarget, GeometryInstance, GeometryParamValue, GeometryWrite, GeometryWriteResult, WompGeometryApi, } from "./capabilities/geometry.js";
|
|
23
23
|
export type { WompOpenScadApi, OpenScadHost, OpenScadTarget, OpenScadSource, OpenScadCreate, OpenScadUpdate, OpenScadValidation, OpenScadPrintability, OpenScadWriteResult, } from "./capabilities/openscad.js";
|
|
24
24
|
export type ArtifactRef = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const WOMP_FLOW_RUNS_DECLARATIONS = "declare const womp: { flowRuns: {\n\"describe\": (() => Promise<{\n\"projectId\": number;\n\"snapshotId\": string;\n\"inputs\": Array<{\n\"nodeId\": string;\n\"typeId\": string;\n\"valueType\": string;\n\"value\": unknown;\n\"required\": false | true;\n}>;\n\"outputs\": Array<{\n\"nodeId\": string;\n\"typeId\": string;\n}>;\n\"liveRun\": null | {\n\"runId\": string;\n\"trigger\": string;\n};\n}>);\n\"run\": ((options?: undefined | {\n\"inputs\"?: undefined | {\n[key: string]: unknown;\n};\n\"copy\"?: undefined | false | true;\n\"deleteCopy\"?: undefined | false | true;\n}) => Promise<{\n\"runId\": string;\n\"status\": string;\n\"repeated\": false | true;\n\"projectId\": number;\n\"sourceProjectId\": null | number;\n\"projectUrl\": null | string;\n\"deleteCopy\": false | true;\n\"copyDeletedAt\": null | string;\n}>);\n\"status\": ((runId: string) => Promise<{\n\"runId\": string;\n\"status\": string;\n\"outputs\": unknown;\n\"error\": null | string;\n\"errorCode\": null | string;\n\"reported\": null | \"now\" | \"earlier\";\n\"projectId\": number;\n\"sourceProjectId\": null | number;\n\"projectUrl\": null | string;\n\"deleteCopy\": false | true;\n\"copyDeletedAt\": null | string;\n}>);\n\"wait\": ((runId: string, seconds?: undefined | number) => Promise<{\n\"runId\": string;\n\"status\": string;\n\"outputs\": unknown;\n\"error\": null | string;\n\"errorCode\": null | string;\n\"reported\": null | \"now\" | \"earlier\";\n\"projectId\": number;\n\"sourceProjectId\": null | number;\n\"projectUrl\": null | string;\n\"deleteCopy\": false | true;\n\"copyDeletedAt\": null | string;\n}>);\n\"cancel\": ((runId: string) => Promise<{\n\"runId\": string;\n\"status\": string;\n\"cancelled\": false | true;\n}>);\n\"deleteCopy\": ((runId: string) => Promise<{\n\"runId\": string;\n\"copyDeletedAt\": string;\n}>);\n} };\ndeclare function print(...values: unknown[]): void;\ndeclare function emitImage(ref: { id: string; mediaType: string; name?: string }, options?: { inspect?: boolean }): Promise<void>;\ndeclare function emitFile(ref: { id: string; mediaType: string; name?: string }): Promise<void>;\n";
|
|
1
|
+
export declare const WOMP_FLOW_RUNS_DECLARATIONS = "declare const womp: { flowRuns: {\n\"describe\": (() => Promise<{\n\"projectId\": number;\n\"snapshotId\": string;\n\"inputs\": Array<{\n\"nodeId\": string;\n\"typeId\": string;\n\"valueType\": string;\n\"value\": unknown;\n\"required\": false | true;\n}>;\n\"outputs\": Array<{\n\"nodeId\": string;\n\"typeId\": string;\n}>;\n\"liveRun\": null | {\n\"runId\": string;\n\"trigger\": string;\n};\n}>);\n\"run\": ((options?: undefined | {\n\"inputs\"?: undefined | {\n[key: string]: unknown;\n};\n\"copy\"?: undefined | false | true;\n\"deleteCopy\"?: undefined | false | true;\n}) => Promise<{\n\"runId\": string;\n\"status\": string;\n\"repeated\": false | true;\n\"projectId\": number;\n\"sourceProjectId\": null | number;\n\"projectUrl\": null | string;\n\"deleteCopy\": false | true;\n\"copyDeletedAt\": null | string;\n\"failedNodes\"?: undefined | Array<{\n\"nodeId\": string;\n\"label\": string;\n}>;\n}>);\n\"status\": ((runId: string) => Promise<{\n\"runId\": string;\n\"status\": string;\n\"outputs\": unknown;\n\"error\": null | string;\n\"errorCode\": null | string;\n\"reported\": null | \"now\" | \"earlier\";\n\"projectId\": number;\n\"sourceProjectId\": null | number;\n\"projectUrl\": null | string;\n\"deleteCopy\": false | true;\n\"copyDeletedAt\": null | string;\n\"failedNodes\"?: undefined | Array<{\n\"nodeId\": string;\n\"label\": string;\n}>;\n}>);\n\"wait\": ((runId: string, seconds?: undefined | number) => Promise<{\n\"runId\": string;\n\"status\": string;\n\"outputs\": unknown;\n\"error\": null | string;\n\"errorCode\": null | string;\n\"reported\": null | \"now\" | \"earlier\";\n\"projectId\": number;\n\"sourceProjectId\": null | number;\n\"projectUrl\": null | string;\n\"deleteCopy\": false | true;\n\"copyDeletedAt\": null | string;\n\"failedNodes\"?: undefined | Array<{\n\"nodeId\": string;\n\"label\": string;\n}>;\n}>);\n\"cancel\": ((runId: string) => Promise<{\n\"runId\": string;\n\"status\": string;\n\"cancelled\": false | true;\n}>);\n\"deleteCopy\": ((runId: string) => Promise<{\n\"runId\": string;\n\"copyDeletedAt\": string;\n}>);\n} };\ndeclare function print(...values: unknown[]): void;\ndeclare function emitImage(ref: { id: string; mediaType: string; name?: string }, options?: { inspect?: boolean }): Promise<void>;\ndeclare function emitFile(ref: { id: string; mediaType: string; name?: string }): Promise<void>;\n";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Generated by scripts/generate-skill-declarations.mjs.
|
|
2
2
|
// prettier-ignore
|
|
3
|
-
export const WOMP_FLOW_RUNS_DECLARATIONS = "declare const womp: { flowRuns: {\n\"describe\": (() => Promise<{\n\"projectId\": number;\n\"snapshotId\": string;\n\"inputs\": Array<{\n\"nodeId\": string;\n\"typeId\": string;\n\"valueType\": string;\n\"value\": unknown;\n\"required\": false | true;\n}>;\n\"outputs\": Array<{\n\"nodeId\": string;\n\"typeId\": string;\n}>;\n\"liveRun\": null | {\n\"runId\": string;\n\"trigger\": string;\n};\n}>);\n\"run\": ((options?: undefined | {\n\"inputs\"?: undefined | {\n[key: string]: unknown;\n};\n\"copy\"?: undefined | false | true;\n\"deleteCopy\"?: undefined | false | true;\n}) => Promise<{\n\"runId\": string;\n\"status\": string;\n\"repeated\": false | true;\n\"projectId\": number;\n\"sourceProjectId\": null | number;\n\"projectUrl\": null | string;\n\"deleteCopy\": false | true;\n\"copyDeletedAt\": null | string;\n}>);\n\"status\": ((runId: string) => Promise<{\n\"runId\": string;\n\"status\": string;\n\"outputs\": unknown;\n\"error\": null | string;\n\"errorCode\": null | string;\n\"reported\": null | \"now\" | \"earlier\";\n\"projectId\": number;\n\"sourceProjectId\": null | number;\n\"projectUrl\": null | string;\n\"deleteCopy\": false | true;\n\"copyDeletedAt\": null | string;\n}>);\n\"wait\": ((runId: string, seconds?: undefined | number) => Promise<{\n\"runId\": string;\n\"status\": string;\n\"outputs\": unknown;\n\"error\": null | string;\n\"errorCode\": null | string;\n\"reported\": null | \"now\" | \"earlier\";\n\"projectId\": number;\n\"sourceProjectId\": null | number;\n\"projectUrl\": null | string;\n\"deleteCopy\": false | true;\n\"copyDeletedAt\": null | string;\n}>);\n\"cancel\": ((runId: string) => Promise<{\n\"runId\": string;\n\"status\": string;\n\"cancelled\": false | true;\n}>);\n\"deleteCopy\": ((runId: string) => Promise<{\n\"runId\": string;\n\"copyDeletedAt\": string;\n}>);\n} };\ndeclare function print(...values: unknown[]): void;\ndeclare function emitImage(ref: { id: string; mediaType: string; name?: string }, options?: { inspect?: boolean }): Promise<void>;\ndeclare function emitFile(ref: { id: string; mediaType: string; name?: string }): Promise<void>;\n";
|
|
3
|
+
export const WOMP_FLOW_RUNS_DECLARATIONS = "declare const womp: { flowRuns: {\n\"describe\": (() => Promise<{\n\"projectId\": number;\n\"snapshotId\": string;\n\"inputs\": Array<{\n\"nodeId\": string;\n\"typeId\": string;\n\"valueType\": string;\n\"value\": unknown;\n\"required\": false | true;\n}>;\n\"outputs\": Array<{\n\"nodeId\": string;\n\"typeId\": string;\n}>;\n\"liveRun\": null | {\n\"runId\": string;\n\"trigger\": string;\n};\n}>);\n\"run\": ((options?: undefined | {\n\"inputs\"?: undefined | {\n[key: string]: unknown;\n};\n\"copy\"?: undefined | false | true;\n\"deleteCopy\"?: undefined | false | true;\n}) => Promise<{\n\"runId\": string;\n\"status\": string;\n\"repeated\": false | true;\n\"projectId\": number;\n\"sourceProjectId\": null | number;\n\"projectUrl\": null | string;\n\"deleteCopy\": false | true;\n\"copyDeletedAt\": null | string;\n\"failedNodes\"?: undefined | Array<{\n\"nodeId\": string;\n\"label\": string;\n}>;\n}>);\n\"status\": ((runId: string) => Promise<{\n\"runId\": string;\n\"status\": string;\n\"outputs\": unknown;\n\"error\": null | string;\n\"errorCode\": null | string;\n\"reported\": null | \"now\" | \"earlier\";\n\"projectId\": number;\n\"sourceProjectId\": null | number;\n\"projectUrl\": null | string;\n\"deleteCopy\": false | true;\n\"copyDeletedAt\": null | string;\n\"failedNodes\"?: undefined | Array<{\n\"nodeId\": string;\n\"label\": string;\n}>;\n}>);\n\"wait\": ((runId: string, seconds?: undefined | number) => Promise<{\n\"runId\": string;\n\"status\": string;\n\"outputs\": unknown;\n\"error\": null | string;\n\"errorCode\": null | string;\n\"reported\": null | \"now\" | \"earlier\";\n\"projectId\": number;\n\"sourceProjectId\": null | number;\n\"projectUrl\": null | string;\n\"deleteCopy\": false | true;\n\"copyDeletedAt\": null | string;\n\"failedNodes\"?: undefined | Array<{\n\"nodeId\": string;\n\"label\": string;\n}>;\n}>);\n\"cancel\": ((runId: string) => Promise<{\n\"runId\": string;\n\"status\": string;\n\"cancelled\": false | true;\n}>);\n\"deleteCopy\": ((runId: string) => Promise<{\n\"runId\": string;\n\"copyDeletedAt\": string;\n}>);\n} };\ndeclare function print(...values: unknown[]): void;\ndeclare function emitImage(ref: { id: string; mediaType: string; name?: string }, options?: { inspect?: boolean }): Promise<void>;\ndeclare function emitFile(ref: { id: string; mediaType: string; name?: string }): Promise<void>;\n";
|
package/dist/model-history.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { asSchema, convertToModelMessages } from "ai";
|
|
2
2
|
import { applyCompaction } from "./compaction.js";
|
|
3
|
-
import { sparkDataPartSchemas } from "./ui.js";
|
|
3
|
+
import { flowRunResultText, sparkDataPartSchemas } from "./ui.js";
|
|
4
4
|
function record(value) {
|
|
5
5
|
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
6
6
|
? value
|
|
@@ -60,6 +60,10 @@ export async function convertSparkMessages(messages, tools, options = {}) {
|
|
|
60
60
|
return convertToModelMessages(history, {
|
|
61
61
|
tools,
|
|
62
62
|
convertDataPart: (part) => {
|
|
63
|
+
if (part.type === "data-flow-run-result") {
|
|
64
|
+
const result = sparkDataPartSchemas["flow-run-result"].safeParse(part.data);
|
|
65
|
+
return result.success ? { type: "text", text: flowRunResultText(result.data) } : undefined;
|
|
66
|
+
}
|
|
63
67
|
if (part.type !== "data-selection")
|
|
64
68
|
return undefined;
|
|
65
69
|
const selection = sparkDataPartSchemas.selection.safeParse(part.data);
|
package/dist/server/service.d.ts
CHANGED
|
@@ -55,6 +55,13 @@ export type SubmitSparkMessageInput = {
|
|
|
55
55
|
message: SparkUIMessage;
|
|
56
56
|
messageId?: string;
|
|
57
57
|
settings: SparkRunSettings;
|
|
58
|
+
/**
|
|
59
|
+
* Accept the host-only `data-flow-run-result` part on this message. Set only
|
|
60
|
+
* by host code, e.g. a follow-up the host starts itself. Never copy it from a
|
|
61
|
+
* request body: the express router builds this input field by field and does
|
|
62
|
+
* not set it.
|
|
63
|
+
*/
|
|
64
|
+
hostParts?: boolean;
|
|
58
65
|
};
|
|
59
66
|
export declare class SparkAgentService {
|
|
60
67
|
private readonly store;
|
package/dist/server/service.js
CHANGED
|
@@ -52,7 +52,7 @@ function titleFor(message) {
|
|
|
52
52
|
return "New build";
|
|
53
53
|
return text.length > 44 ? `${text.slice(0, 44)}…` : text;
|
|
54
54
|
}
|
|
55
|
-
function normalizeUserMessage(message) {
|
|
55
|
+
function normalizeUserMessage(message, options = {}) {
|
|
56
56
|
if (message.role !== "user") {
|
|
57
57
|
throw new SparkServiceError(400, "A new chat message must have the user role.");
|
|
58
58
|
}
|
|
@@ -60,6 +60,8 @@ function normalizeUserMessage(message) {
|
|
|
60
60
|
// The data schemas are checked with the rest of the message (validateUIMessages).
|
|
61
61
|
if (part.type === "text" || part.type === "data-selection")
|
|
62
62
|
continue;
|
|
63
|
+
if (part.type === "data-flow-run-result" && options.hostParts === true)
|
|
64
|
+
continue;
|
|
63
65
|
if (part.type === "file" &&
|
|
64
66
|
part.mediaType.startsWith("image/") &&
|
|
65
67
|
part.url.startsWith(`data:${part.mediaType};base64,`)) {
|
|
@@ -351,7 +353,7 @@ export class SparkAgentService {
|
|
|
351
353
|
inputMessage = previous;
|
|
352
354
|
}
|
|
353
355
|
else {
|
|
354
|
-
inputMessage = normalizeUserMessage(input.message);
|
|
356
|
+
inputMessage = normalizeUserMessage(input.message, { hostParts: input.hostParts === true });
|
|
355
357
|
if (goalContinuation)
|
|
356
358
|
inputMessage.metadata = { ...inputMessage.metadata, goalContinuation: true };
|
|
357
359
|
if (conversation.messages.some(({ id }) => id === inputMessage.id)) {
|
package/dist/ui.d.ts
CHANGED
|
@@ -93,6 +93,7 @@ export type SparkDataParts = {
|
|
|
93
93
|
selection: SparkSelectionData;
|
|
94
94
|
compaction: SparkCompaction;
|
|
95
95
|
"goal-proposal": SparkGoalProposalPart;
|
|
96
|
+
"flow-run-result": SparkFlowRunResult;
|
|
96
97
|
};
|
|
97
98
|
/** Editor node IDs selected when a user message was sent; never rendered as chat text. */
|
|
98
99
|
export type SparkSelectionData = {
|
|
@@ -247,6 +248,36 @@ export declare const sparkMessageMetadataSchema: z.ZodObject<{
|
|
|
247
248
|
}, z.core.$strip>>>;
|
|
248
249
|
}, z.core.$strip>>;
|
|
249
250
|
}, z.core.$strip>;
|
|
251
|
+
declare const flowRunResultSchema: z.ZodObject<{
|
|
252
|
+
runId: z.ZodString;
|
|
253
|
+
flowTitle: z.ZodString;
|
|
254
|
+
status: z.ZodEnum<{
|
|
255
|
+
completed: "completed";
|
|
256
|
+
failed: "failed";
|
|
257
|
+
cancelled: "cancelled";
|
|
258
|
+
}>;
|
|
259
|
+
error: z.ZodNullable<z.ZodString>;
|
|
260
|
+
failedNodes: z.ZodArray<z.ZodObject<{
|
|
261
|
+
nodeId: z.ZodString;
|
|
262
|
+
label: z.ZodString;
|
|
263
|
+
}, z.core.$strip>>;
|
|
264
|
+
outputs: z.ZodArray<z.ZodObject<{
|
|
265
|
+
nodeId: z.ZodString;
|
|
266
|
+
label: z.ZodString;
|
|
267
|
+
title: z.ZodString;
|
|
268
|
+
url: z.ZodString;
|
|
269
|
+
thumbnailUrl: z.ZodOptional<z.ZodString>;
|
|
270
|
+
}, z.core.$strip>>;
|
|
271
|
+
copy: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
272
|
+
url: z.ZodString;
|
|
273
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
274
|
+
deleted: z.ZodLiteral<true>;
|
|
275
|
+
}, z.core.$strip>]>>;
|
|
276
|
+
}, z.core.$strip>;
|
|
277
|
+
/** A finished flow run, attached to a user message the host sends as an event. */
|
|
278
|
+
export type SparkFlowRunResult = z.infer<typeof flowRunResultSchema>;
|
|
279
|
+
/** The line the model reads for a `flow-run-result` part (model-history.ts); empty segments are left out. */
|
|
280
|
+
export declare function flowRunResultText(data: SparkFlowRunResult): string;
|
|
250
281
|
export declare const sparkDataPartSchemas: {
|
|
251
282
|
readonly "tool-input-label": z.ZodObject<{
|
|
252
283
|
toolCallId: z.ZodString;
|
|
@@ -396,6 +427,37 @@ export declare const sparkDataPartSchemas: {
|
|
|
396
427
|
declined: "declined";
|
|
397
428
|
}>>;
|
|
398
429
|
}, z.core.$strip>;
|
|
430
|
+
/**
|
|
431
|
+
* A finished flow run, as an event. Hosts attach it to a user message, render
|
|
432
|
+
* it as an event and not as that user's text; the model reads it as text
|
|
433
|
+
* (model-history.ts). Hosts that validate stored parts take 9.5.0 first.
|
|
434
|
+
*/
|
|
435
|
+
readonly "flow-run-result": z.ZodObject<{
|
|
436
|
+
runId: z.ZodString;
|
|
437
|
+
flowTitle: z.ZodString;
|
|
438
|
+
status: z.ZodEnum<{
|
|
439
|
+
completed: "completed";
|
|
440
|
+
failed: "failed";
|
|
441
|
+
cancelled: "cancelled";
|
|
442
|
+
}>;
|
|
443
|
+
error: z.ZodNullable<z.ZodString>;
|
|
444
|
+
failedNodes: z.ZodArray<z.ZodObject<{
|
|
445
|
+
nodeId: z.ZodString;
|
|
446
|
+
label: z.ZodString;
|
|
447
|
+
}, z.core.$strip>>;
|
|
448
|
+
outputs: z.ZodArray<z.ZodObject<{
|
|
449
|
+
nodeId: z.ZodString;
|
|
450
|
+
label: z.ZodString;
|
|
451
|
+
title: z.ZodString;
|
|
452
|
+
url: z.ZodString;
|
|
453
|
+
thumbnailUrl: z.ZodOptional<z.ZodString>;
|
|
454
|
+
}, z.core.$strip>>;
|
|
455
|
+
copy: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
456
|
+
url: z.ZodString;
|
|
457
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
458
|
+
deleted: z.ZodLiteral<true>;
|
|
459
|
+
}, z.core.$strip>]>>;
|
|
460
|
+
}, z.core.$strip>;
|
|
399
461
|
};
|
|
400
462
|
export { parseWompifyCommand, WOMPIFY_PRESETS, wompifyPrompt, wompifyContextSchema, type WompifyRequest, type WompifyContext } from "./wompify.js";
|
|
401
463
|
export { DEFAULT_GOAL_CREDITS, GOAL_CONFIRMATION_DEFAULTS, sparkGoalProposalPartSchema, sparkGoalProposalSchema } from "./goals.js";
|
package/dist/ui.js
CHANGED
|
@@ -54,6 +54,33 @@ export const sparkMessageMetadataSchema = z.object({
|
|
|
54
54
|
error: z.string().optional(),
|
|
55
55
|
errorDiagnostics: sparkErrorDiagnosticsSchema.optional(),
|
|
56
56
|
});
|
|
57
|
+
const flowRunResultSchema = z.object({
|
|
58
|
+
runId: z.string().min(1),
|
|
59
|
+
flowTitle: z.string(),
|
|
60
|
+
status: z.enum(["completed", "failed", "cancelled"]),
|
|
61
|
+
/** A sentence for the user; never a provider message. */
|
|
62
|
+
error: z.string().nullable(),
|
|
63
|
+
failedNodes: z.array(z.object({ nodeId: z.string(), label: z.string() })).max(10),
|
|
64
|
+
/** Only what this run produced; outputs with no URL are left out. */
|
|
65
|
+
outputs: z
|
|
66
|
+
.array(z.object({ nodeId: z.string(), label: z.string(), title: z.string(), url: z.string(), thumbnailUrl: z.string().optional() }))
|
|
67
|
+
.max(20),
|
|
68
|
+
copy: z.union([z.object({ url: z.string() }), z.object({ deleted: z.literal(true) })]).nullable(),
|
|
69
|
+
});
|
|
70
|
+
/** The line the model reads for a `flow-run-result` part (model-history.ts); empty segments are left out. */
|
|
71
|
+
export function flowRunResultText(data) {
|
|
72
|
+
const sentence = (text) => (/[.!?]$/.test(text) ? text : `${text}.`);
|
|
73
|
+
const segments = [`[Flow run finished] Flow "${data.flowTitle}" ${data.status}.`];
|
|
74
|
+
if (data.failedNodes.length)
|
|
75
|
+
segments.push(`Failed steps: ${data.failedNodes.map((node) => node.label).join(", ")}.`);
|
|
76
|
+
if (data.outputs.length)
|
|
77
|
+
segments.push(`Outputs: ${data.outputs.map((output) => `${output.title} (${output.url})`).join(", ")}.`);
|
|
78
|
+
if (data.copy)
|
|
79
|
+
segments.push(`Copy: ${"url" in data.copy ? data.copy.url : "deleted"}.`);
|
|
80
|
+
if (data.error)
|
|
81
|
+
segments.push(`Error: ${sentence(data.error)}`);
|
|
82
|
+
return segments.join(" ");
|
|
83
|
+
}
|
|
57
84
|
export const sparkDataPartSchemas = {
|
|
58
85
|
"tool-input-label": z.object({
|
|
59
86
|
toolCallId: z.string(),
|
|
@@ -102,6 +129,12 @@ export const sparkDataPartSchemas = {
|
|
|
102
129
|
* reads the proposal from its `propose_goal` call, not from this part.
|
|
103
130
|
*/
|
|
104
131
|
"goal-proposal": sparkGoalProposalPartSchema,
|
|
132
|
+
/**
|
|
133
|
+
* A finished flow run, as an event. Hosts attach it to a user message, render
|
|
134
|
+
* it as an event and not as that user's text; the model reads it as text
|
|
135
|
+
* (model-history.ts). Hosts that validate stored parts take 9.5.0 first.
|
|
136
|
+
*/
|
|
137
|
+
"flow-run-result": flowRunResultSchema,
|
|
105
138
|
};
|
|
106
139
|
export { parseWompifyCommand, WOMPIFY_PRESETS, wompifyPrompt, wompifyContextSchema } from "./wompify.js";
|
|
107
140
|
export { DEFAULT_GOAL_CREDITS, GOAL_CONFIRMATION_DEFAULTS, sparkGoalProposalPartSchema, sparkGoalProposalSchema } from "./goals.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@womp/spark-agent",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.5.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",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"@ai-sdk/openai": "4.0.63",
|
|
117
117
|
"@jitl/quickjs-wasmfile-release-sync": "0.32.0",
|
|
118
118
|
"@womp/flowir": "0.5.0",
|
|
119
|
-
"@womp/kakapo-sdk": "0.
|
|
119
|
+
"@womp/kakapo-sdk": "0.10.0",
|
|
120
120
|
"ai": "7.0.95",
|
|
121
121
|
"eventsource-parser": "^3.0.6",
|
|
122
122
|
"express": "^5.2.1",
|