@agentic-surfaces/core 0.1.27 → 0.1.29
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 +14 -6
- package/dist/handlers/agent.js +2 -2
- package/dist/project-config.d.ts +1 -0
- package/dist/project-config.js +3 -0
- package/dist/types.d.ts +9 -7
- package/package.json +2 -2
package/dist/executor.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { withRetry } from "./policy.js";
|
|
2
|
+
// Process-global, monotonic run-id counter. Each runWorkflow() call (top-level or a foreach
|
|
3
|
+
// sub-run) gets a distinct id so the dashboard can attribute every event to its own run.
|
|
4
|
+
let runSeq = 0;
|
|
5
|
+
function newRunId() {
|
|
6
|
+
return `run_${(++runSeq).toString(16).padStart(6, "0")}`;
|
|
7
|
+
}
|
|
2
8
|
export async function runWorkflow(opts) {
|
|
3
9
|
const { workflow, triggerNodeId, registry, services, payload, observer } = opts;
|
|
4
10
|
const byId = new Map(workflow.nodes.map(n => [n.id, n]));
|
|
@@ -10,9 +16,11 @@ export async function runWorkflow(opts) {
|
|
|
10
16
|
services,
|
|
11
17
|
observer,
|
|
12
18
|
};
|
|
19
|
+
const runId = newRunId();
|
|
20
|
+
ctx.runId = runId; // so handlers (agent.run) can tag their activity with this run
|
|
13
21
|
const queue = [triggerNodeId];
|
|
14
22
|
const visited = new Set();
|
|
15
|
-
observer?.onRunStart?.(workflow.name, ctx.triggerPayload);
|
|
23
|
+
observer?.onRunStart?.(workflow.name, ctx.triggerPayload, runId);
|
|
16
24
|
while (queue.length > 0) {
|
|
17
25
|
const id = queue.shift();
|
|
18
26
|
if (visited.has(id))
|
|
@@ -22,7 +30,7 @@ export async function runWorkflow(opts) {
|
|
|
22
30
|
if (!node)
|
|
23
31
|
throw new Error(`workflow references missing node: ${id}`);
|
|
24
32
|
const handler = registry.get(node.type);
|
|
25
|
-
observer?.onNodeStart?.(id);
|
|
33
|
+
observer?.onNodeStart?.(id, runId);
|
|
26
34
|
let result;
|
|
27
35
|
let nodeErrored = false;
|
|
28
36
|
try {
|
|
@@ -32,12 +40,12 @@ export async function runWorkflow(opts) {
|
|
|
32
40
|
nodeErrored = true;
|
|
33
41
|
const message = err instanceof Error ? err.message : String(err);
|
|
34
42
|
services.logger?.error?.(`node ${node.id} failed`, { workflow: workflow.name, error: message });
|
|
35
|
-
observer?.onNodeFinish?.(id, "failed", { error: message });
|
|
43
|
+
observer?.onNodeFinish?.(id, "failed", { error: message }, runId);
|
|
36
44
|
if (node.onError === "continue") {
|
|
37
45
|
result = { output: { error: message } };
|
|
38
46
|
}
|
|
39
47
|
else {
|
|
40
|
-
observer?.onRunFinish?.(workflow.name, "failed");
|
|
48
|
+
observer?.onRunFinish?.(workflow.name, "failed", runId);
|
|
41
49
|
throw err;
|
|
42
50
|
}
|
|
43
51
|
}
|
|
@@ -45,7 +53,7 @@ export async function runWorkflow(opts) {
|
|
|
45
53
|
// Surface the node's output so observers (e.g. the live UI) can show what each
|
|
46
54
|
// node produced/fetched — the data is what you need when debugging a run.
|
|
47
55
|
if (!nodeErrored)
|
|
48
|
-
observer?.onNodeFinish?.(id, "success", { output: result.output });
|
|
56
|
+
observer?.onNodeFinish?.(id, "success", { output: result.output }, runId);
|
|
49
57
|
const branches = result.branches;
|
|
50
58
|
for (const edge of workflow.edges) {
|
|
51
59
|
if (edge.from !== id)
|
|
@@ -55,6 +63,6 @@ export async function runWorkflow(opts) {
|
|
|
55
63
|
}
|
|
56
64
|
}
|
|
57
65
|
}
|
|
58
|
-
observer?.onRunFinish?.(workflow.name, "success");
|
|
66
|
+
observer?.onRunFinish?.(workflow.name, "success", runId);
|
|
59
67
|
return ctx.outputs;
|
|
60
68
|
}
|
package/dist/handlers/agent.js
CHANGED
|
@@ -64,8 +64,8 @@ export const agentHandler = {
|
|
|
64
64
|
cwd: ctx.services.projectDir,
|
|
65
65
|
dryRun: ctx.services.dryRun,
|
|
66
66
|
log: (m) => ctx.services.logger?.info?.(m),
|
|
67
|
-
// Stream the agent's reasoning + tool/MCP calls to the run observer, tagged with
|
|
68
|
-
onActivity: (a) => ctx.observer?.onNodeActivity?.(node.id, a),
|
|
67
|
+
// Stream the agent's reasoning + tool/MCP calls to the run observer, tagged with node + run.
|
|
68
|
+
onActivity: (a) => ctx.observer?.onNodeActivity?.(node.id, a, ctx.runId),
|
|
69
69
|
});
|
|
70
70
|
// Decision agent: guarantee the chosen command is on the allowlist (else use
|
|
71
71
|
// the fallback), and surface it at the top level so task.branch can route.
|
package/dist/project-config.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ declare const ProjectConfigSchema: z.ZodObject<{
|
|
|
32
32
|
}, z.core.$strip>>;
|
|
33
33
|
}, z.core.$strip>>;
|
|
34
34
|
workflows: z.ZodOptional<z.ZodString>;
|
|
35
|
+
atlassianSite: z.ZodOptional<z.ZodString>;
|
|
35
36
|
}, z.core.$strip>;
|
|
36
37
|
export type ProjectConfig = z.infer<typeof ProjectConfigSchema>;
|
|
37
38
|
/**
|
package/dist/project-config.js
CHANGED
|
@@ -28,6 +28,9 @@ const ProjectConfigSchema = z.object({
|
|
|
28
28
|
})
|
|
29
29
|
.default({ runner: "claude", model: "claude-opus-4-8" }),
|
|
30
30
|
workflows: z.string().optional(), // relative subdir; omitted = use dir itself
|
|
31
|
+
// Atlassian site host (e.g. "sojournii.atlassian.net") — lets the dashboard build browse/wiki
|
|
32
|
+
// links to the issues/pages a run touched. Optional; links also come from MCP tool results.
|
|
33
|
+
atlassianSite: z.string().optional(),
|
|
31
34
|
});
|
|
32
35
|
const CONFIG_FILENAME = "agentic-surfaces.config.yaml";
|
|
33
36
|
/**
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AgentRunner, McpServerRef, AgentActivity, Capabilities } from "@agentic-surfaces/agent";
|
|
1
|
+
import type { AgentRunner, McpServerRef, AgentActivity, Capabilities, PlanUsage, PlanWindow } from "@agentic-surfaces/agent";
|
|
2
2
|
import type { AgentDefinition } from "./agents.js";
|
|
3
|
-
export type { AgentRunner, McpServerRef, AgentActivity, Capabilities };
|
|
3
|
+
export type { AgentRunner, McpServerRef, AgentActivity, Capabilities, PlanUsage, PlanWindow };
|
|
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;
|
|
@@ -72,6 +72,8 @@ export interface Services {
|
|
|
72
72
|
}
|
|
73
73
|
export interface RunContext {
|
|
74
74
|
workflow: Workflow;
|
|
75
|
+
/** Unique id for this run, set by the executor — handlers tag their observer activity with it. */
|
|
76
|
+
runId?: string;
|
|
75
77
|
outputs: Map<string, unknown>;
|
|
76
78
|
triggerNodeId: string;
|
|
77
79
|
triggerPayload?: unknown;
|
|
@@ -88,10 +90,10 @@ export interface NodeHandler {
|
|
|
88
90
|
execute(node: WorkflowNode, ctx: RunContext): Promise<NodeResult>;
|
|
89
91
|
}
|
|
90
92
|
export interface RunObserver {
|
|
91
|
-
onRunStart?(workflow: string, payload?: unknown): void;
|
|
92
|
-
onNodeStart?(nodeId: string): void;
|
|
93
|
-
onNodeFinish?(nodeId: string, status: "success" | "failed", meta?: unknown): void;
|
|
93
|
+
onRunStart?(workflow: string, payload?: unknown, runId?: string): void;
|
|
94
|
+
onNodeStart?(nodeId: string, runId?: string): void;
|
|
95
|
+
onNodeFinish?(nodeId: string, status: "success" | "failed", meta?: unknown, runId?: string): void;
|
|
94
96
|
/** A live step of an agent node's work (reasoning, a tool/MCP call, or a result). */
|
|
95
|
-
onNodeActivity?(nodeId: string, activity: AgentActivity): void;
|
|
96
|
-
onRunFinish?(workflow: string, status: "success" | "failed"): void;
|
|
97
|
+
onNodeActivity?(nodeId: string, activity: AgentActivity, runId?: string): void;
|
|
98
|
+
onRunFinish?(workflow: string, status: "success" | "failed", runId?: string): void;
|
|
97
99
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentic-surfaces/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"jsonata": "^2.2.1",
|
|
25
25
|
"yaml": "^2.9.0",
|
|
26
26
|
"zod": "^4.4.3",
|
|
27
|
-
"@agentic-surfaces/agent": "0.1.
|
|
27
|
+
"@agentic-surfaces/agent": "0.1.29"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/better-sqlite3": "^7.6.13",
|