@agentic-surfaces/core 0.1.18 → 0.1.20
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/cache.d.ts +13 -1
- package/dist/cache.js +21 -2
- package/dist/executor.js +1 -0
- package/dist/handlers/agent.js +2 -0
- package/dist/handlers/cache.js +0 -0
- package/dist/schema.js +1 -0
- package/dist/types.d.ts +24 -3
- package/package.json +2 -2
package/dist/cache.d.ts
CHANGED
|
@@ -5,7 +5,19 @@ export declare class SqliteCache implements Cache {
|
|
|
5
5
|
getCursor(k: string): string | undefined;
|
|
6
6
|
setCursor(k: string, v: string): void;
|
|
7
7
|
isSeen(k: string): boolean;
|
|
8
|
-
markSeen(k: string): void;
|
|
8
|
+
markSeen(k: string, label?: string): void;
|
|
9
|
+
entries(): {
|
|
10
|
+
seen: Array<{
|
|
11
|
+
key: string;
|
|
12
|
+
ts?: number;
|
|
13
|
+
label?: string;
|
|
14
|
+
}>;
|
|
15
|
+
cursors: Array<{
|
|
16
|
+
key: string;
|
|
17
|
+
value: string;
|
|
18
|
+
}>;
|
|
19
|
+
};
|
|
20
|
+
forget(k: string): void;
|
|
9
21
|
wipe(): void;
|
|
10
22
|
close(): void;
|
|
11
23
|
}
|
package/dist/cache.js
CHANGED
|
@@ -7,6 +7,13 @@ export class SqliteCache {
|
|
|
7
7
|
CREATE TABLE IF NOT EXISTS cursors (key TEXT PRIMARY KEY, value TEXT NOT NULL);
|
|
8
8
|
CREATE TABLE IF NOT EXISTS seen (key TEXT PRIMARY KEY);
|
|
9
9
|
`);
|
|
10
|
+
// Migrate older DBs: add when-seen + a human label so the cache view is legible.
|
|
11
|
+
for (const col of ["ts INTEGER", "label TEXT"]) {
|
|
12
|
+
try {
|
|
13
|
+
this.db.exec(`ALTER TABLE seen ADD COLUMN ${col}`);
|
|
14
|
+
}
|
|
15
|
+
catch { /* already present */ }
|
|
16
|
+
}
|
|
10
17
|
}
|
|
11
18
|
getCursor(k) {
|
|
12
19
|
const row = this.db.prepare("SELECT value FROM cursors WHERE key = ?").get(k);
|
|
@@ -18,8 +25,20 @@ export class SqliteCache {
|
|
|
18
25
|
isSeen(k) {
|
|
19
26
|
return !!this.db.prepare("SELECT 1 FROM seen WHERE key = ?").get(k);
|
|
20
27
|
}
|
|
21
|
-
markSeen(k) {
|
|
22
|
-
this.db
|
|
28
|
+
markSeen(k, label) {
|
|
29
|
+
this.db
|
|
30
|
+
.prepare("INSERT INTO seen(key, ts, label) VALUES(?,?,?) ON CONFLICT(key) DO UPDATE SET ts=excluded.ts, label=COALESCE(excluded.label, seen.label)")
|
|
31
|
+
.run(k, Date.now(), label ?? null);
|
|
32
|
+
}
|
|
33
|
+
entries() {
|
|
34
|
+
const seen = this.db.prepare("SELECT key, ts, label FROM seen ORDER BY ts DESC, key").all()
|
|
35
|
+
.map((r) => ({ key: r.key, ts: r.ts ?? undefined, label: r.label ?? undefined }));
|
|
36
|
+
const cursors = this.db.prepare("SELECT key, value FROM cursors ORDER BY key").all();
|
|
37
|
+
return { seen, cursors };
|
|
38
|
+
}
|
|
39
|
+
forget(k) {
|
|
40
|
+
this.db.prepare("DELETE FROM seen WHERE key = ?").run(k);
|
|
41
|
+
this.db.prepare("DELETE FROM cursors WHERE key = ?").run(k);
|
|
23
42
|
}
|
|
24
43
|
wipe() {
|
|
25
44
|
this.db.exec("DELETE FROM cursors; DELETE FROM seen;");
|
package/dist/executor.js
CHANGED
package/dist/handlers/agent.js
CHANGED
|
@@ -51,6 +51,8 @@ export const agentHandler = {
|
|
|
51
51
|
profile: profile ?? "constrained",
|
|
52
52
|
dryRun: ctx.services.dryRun,
|
|
53
53
|
log: (m) => ctx.services.logger?.info?.(m),
|
|
54
|
+
// Stream the agent's reasoning + tool/MCP calls to the run observer, tagged with this node.
|
|
55
|
+
onActivity: (a) => ctx.observer?.onNodeActivity?.(node.id, a),
|
|
54
56
|
});
|
|
55
57
|
// Decision agent: guarantee the chosen command is on the allowlist (else use
|
|
56
58
|
// the fallback), and surface it at the top level so task.branch can route.
|
package/dist/handlers/cache.js
CHANGED
|
Binary file
|
package/dist/schema.js
CHANGED
|
@@ -23,6 +23,7 @@ const node = z.object({
|
|
|
23
23
|
const edge = z.object({ from: z.string().min(1), to: z.string().min(1), when: z.string().optional() });
|
|
24
24
|
const workflow = z.object({
|
|
25
25
|
name: z.string().min(1),
|
|
26
|
+
title: z.string().min(1).optional(),
|
|
26
27
|
nodes: z.array(node).min(1),
|
|
27
28
|
edges: z.array(edge).default([]),
|
|
28
29
|
}).superRefine((wf, ctx) => {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AgentRunner, McpServerRef } from "@agentic-surfaces/agent";
|
|
1
|
+
import type { AgentRunner, McpServerRef, AgentActivity } from "@agentic-surfaces/agent";
|
|
2
2
|
import type { AgentDefinition } from "./agents.js";
|
|
3
|
-
export type { AgentRunner, McpServerRef };
|
|
3
|
+
export type { AgentRunner, McpServerRef, AgentActivity };
|
|
4
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;
|
|
@@ -20,6 +20,8 @@ export interface WorkflowEdge {
|
|
|
20
20
|
}
|
|
21
21
|
export interface Workflow {
|
|
22
22
|
name: string;
|
|
23
|
+
/** Human-readable display name for the UI (falls back to `name` when omitted). */
|
|
24
|
+
title?: string;
|
|
23
25
|
nodes: WorkflowNode[];
|
|
24
26
|
edges: WorkflowEdge[];
|
|
25
27
|
}
|
|
@@ -31,7 +33,22 @@ export interface Cache {
|
|
|
31
33
|
getCursor(k: string): string | undefined;
|
|
32
34
|
setCursor(k: string, v: string): void;
|
|
33
35
|
isSeen(k: string): boolean;
|
|
34
|
-
|
|
36
|
+
/** Mark a key seen, with an optional human label for the cache view. */
|
|
37
|
+
markSeen(k: string, label?: string): void;
|
|
38
|
+
/** Inspect all cache contents (seen-set with when/label + cursors) — for the dashboard's cache view. */
|
|
39
|
+
entries(): {
|
|
40
|
+
seen: Array<{
|
|
41
|
+
key: string;
|
|
42
|
+
ts?: number;
|
|
43
|
+
label?: string;
|
|
44
|
+
}>;
|
|
45
|
+
cursors: Array<{
|
|
46
|
+
key: string;
|
|
47
|
+
value: string;
|
|
48
|
+
}>;
|
|
49
|
+
};
|
|
50
|
+
/** Forget a single key (seen + cursor) so it gets reprocessed. */
|
|
51
|
+
forget(k: string): void;
|
|
35
52
|
wipe(): void;
|
|
36
53
|
}
|
|
37
54
|
export interface Services {
|
|
@@ -55,6 +72,8 @@ export interface RunContext {
|
|
|
55
72
|
triggerNodeId: string;
|
|
56
73
|
triggerPayload?: unknown;
|
|
57
74
|
services: Services;
|
|
75
|
+
/** The run observer, so handlers (e.g. agent.run) can stream live activity for a node. */
|
|
76
|
+
observer?: RunObserver;
|
|
58
77
|
}
|
|
59
78
|
export interface NodeResult {
|
|
60
79
|
output: unknown;
|
|
@@ -68,5 +87,7 @@ export interface RunObserver {
|
|
|
68
87
|
onRunStart?(workflow: string, payload?: unknown): void;
|
|
69
88
|
onNodeStart?(nodeId: string): void;
|
|
70
89
|
onNodeFinish?(nodeId: string, status: "success" | "failed", meta?: unknown): void;
|
|
90
|
+
/** A live step of an agent node's work (reasoning, a tool/MCP call, or a result). */
|
|
91
|
+
onNodeActivity?(nodeId: string, activity: AgentActivity): void;
|
|
71
92
|
onRunFinish?(workflow: string, status: "success" | "failed"): void;
|
|
72
93
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentic-surfaces/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
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.20"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/better-sqlite3": "^7.6.13",
|