@agentic-surfaces/core 0.1.11 → 0.1.13
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/executor.js +3 -1
- package/dist/handlers/cache.d.ts +24 -0
- package/dist/handlers/cache.js +0 -0
- package/dist/scheduler.js +3 -0
- package/dist/schema.js +16 -0
- package/dist/types.d.ts +1 -1
- package/package.json +2 -2
package/dist/executor.js
CHANGED
|
@@ -41,8 +41,10 @@ export async function runWorkflow(opts) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
ctx.outputs.set(id, result.output);
|
|
44
|
+
// Surface the node's output so observers (e.g. the live UI) can show what each
|
|
45
|
+
// node produced/fetched — the data is what you need when debugging a run.
|
|
44
46
|
if (!nodeErrored)
|
|
45
|
-
observer?.onNodeFinish?.(id, "success");
|
|
47
|
+
observer?.onNodeFinish?.(id, "success", { output: result.output });
|
|
46
48
|
const branches = result.branches;
|
|
47
49
|
for (const edge of workflow.edges) {
|
|
48
50
|
if (edge.from !== id)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { NodeHandler } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* task.cache-unseen — filter a list down to the items NOT yet marked seen.
|
|
4
|
+
*
|
|
5
|
+
* config:
|
|
6
|
+
* items: <jsonata → array> # the list to filter (e.g. fetchComments.comments)
|
|
7
|
+
* key: <jsonata over EACH item → string> # the stable surface id (e.g. "id")
|
|
8
|
+
* namespace?: <string> # seen-set scope; defaults to the workflow name
|
|
9
|
+
*
|
|
10
|
+
* Read-only — it never marks anything. Pair it with task.cache-mark to record items
|
|
11
|
+
* as seen once they've actually been handled.
|
|
12
|
+
*/
|
|
13
|
+
export declare const cacheUnseenHandler: NodeHandler;
|
|
14
|
+
/**
|
|
15
|
+
* task.cache-mark — record one or more keys as seen.
|
|
16
|
+
*
|
|
17
|
+
* config:
|
|
18
|
+
* keys: <jsonata → string | string[]> # the key(s) to mark (e.g. "trigger.id" or "x.comments.id")
|
|
19
|
+
* namespace?: <string> # must match the cache-unseen namespace; defaults to workflow name
|
|
20
|
+
*
|
|
21
|
+
* Place it wherever "we've handled this" should become true — typically after the
|
|
22
|
+
* agent/action node has succeeded.
|
|
23
|
+
*/
|
|
24
|
+
export declare const cacheMarkHandler: NodeHandler;
|
|
Binary file
|
package/dist/scheduler.js
CHANGED
|
@@ -7,6 +7,7 @@ import { httpHandler } from "./handlers/http.js";
|
|
|
7
7
|
import { agentHandler } from "./handlers/agent.js";
|
|
8
8
|
import { foreachHandler } from "./handlers/foreach.js";
|
|
9
9
|
import { runWorkflowHandler } from "./handlers/run-workflow.js";
|
|
10
|
+
import { cacheUnseenHandler, cacheMarkHandler } from "./handlers/cache.js";
|
|
10
11
|
import { ConsoleObserver } from "./observer.js";
|
|
11
12
|
const passthrough = (type) => ({
|
|
12
13
|
type,
|
|
@@ -25,6 +26,8 @@ export function defaultRegistry() {
|
|
|
25
26
|
r.register(passthrough("trigger.command"));
|
|
26
27
|
r.register(foreachHandler);
|
|
27
28
|
r.register(runWorkflowHandler);
|
|
29
|
+
r.register(cacheUnseenHandler);
|
|
30
|
+
r.register(cacheMarkHandler);
|
|
28
31
|
return r;
|
|
29
32
|
}
|
|
30
33
|
export async function runWorkflowOnce(workflow, opts) {
|
package/dist/schema.js
CHANGED
|
@@ -4,6 +4,7 @@ const nodeType = z.enum([
|
|
|
4
4
|
"trigger.cron", "trigger.webhook", "trigger.command",
|
|
5
5
|
"task.http", "task.transform", "task.branch",
|
|
6
6
|
"task.run-workflow", "task.foreach",
|
|
7
|
+
"task.cache-unseen", "task.cache-mark",
|
|
7
8
|
"agent.run",
|
|
8
9
|
]);
|
|
9
10
|
const retry = z.object({ maxAttempts: z.number().int().min(1), backoffMs: z.number().int().min(0) });
|
|
@@ -56,6 +57,21 @@ const workflow = z.object({
|
|
|
56
57
|
ctx.addIssue({ code: "custom", message: `node "${n.id}" (task.foreach) requires a non-empty config.workflow string` });
|
|
57
58
|
}
|
|
58
59
|
}
|
|
60
|
+
if (n.type === "task.cache-unseen") {
|
|
61
|
+
const cfg = n.config;
|
|
62
|
+
if (typeof cfg.items !== "string" || cfg.items.trim() === "") {
|
|
63
|
+
ctx.addIssue({ code: "custom", message: `node "${n.id}" (task.cache-unseen) requires a non-empty config.items string` });
|
|
64
|
+
}
|
|
65
|
+
if (typeof cfg.key !== "string" || cfg.key.trim() === "") {
|
|
66
|
+
ctx.addIssue({ code: "custom", message: `node "${n.id}" (task.cache-unseen) requires a non-empty config.key string` });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (n.type === "task.cache-mark") {
|
|
70
|
+
const cfg = n.config;
|
|
71
|
+
if (typeof cfg.keys !== "string" || cfg.keys.trim() === "") {
|
|
72
|
+
ctx.addIssue({ code: "custom", message: `node "${n.id}" (task.cache-mark) requires a non-empty config.keys string` });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
59
75
|
}
|
|
60
76
|
});
|
|
61
77
|
export function loadWorkflow(yamlText) {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AgentRunner, McpServerRef } from "@agentic-surfaces/agent";
|
|
2
2
|
import type { AgentDefinition } from "./agents.js";
|
|
3
3
|
export type { AgentRunner, McpServerRef };
|
|
4
|
-
export type NodeType = "trigger.cron" | "trigger.webhook" | "trigger.command" | "task.http" | "task.transform" | "task.branch" | "task.run-workflow" | "task.foreach" | "agent.run";
|
|
4
|
+
export type NodeType = "trigger.cron" | "trigger.webhook" | "trigger.command" | "task.http" | "task.transform" | "task.branch" | "task.run-workflow" | "task.foreach" | "task.cache-unseen" | "task.cache-mark" | "agent.run";
|
|
5
5
|
export interface RetryPolicy {
|
|
6
6
|
maxAttempts: number;
|
|
7
7
|
backoffMs: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentic-surfaces/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"jsonata": "^2.2.1",
|
|
24
24
|
"yaml": "^2.9.0",
|
|
25
25
|
"zod": "^4.4.3",
|
|
26
|
-
"@agentic-surfaces/agent": "0.1.
|
|
26
|
+
"@agentic-surfaces/agent": "0.1.13"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/better-sqlite3": "^7.6.13",
|