@boardwalk-labs/workflow 0.1.0 → 0.1.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/README.md CHANGED
@@ -31,7 +31,7 @@ A workflow is **a script**: the `meta` export is a **pure literal** (engines der
31
31
  | `@boardwalk-labs/workflow/runtime` | The **engine-facing** API: install a `WorkflowHost` before evaluating a program. Authors never import this |
32
32
  | `@boardwalk-labs/workflow/extract` | Static `meta` → manifest extraction (AST-based, never executes the program). Used by engines and tooling |
33
33
 
34
- ## The primitives, in one minute
34
+ ## The primitives
35
35
 
36
36
  - **`agent(prompt, opts?)`** — run an agent loop and get its final text (or `schema`-validated JSON). `model` is optional: name one explicitly, or let the engine resolve it. Loops can use **tools** (built-in or program-defined), **MCP servers**, **skills**, and **memory** — each brought **per call** on `agent()`; the manifest declares none of them.
37
37
  - **`sleep(ms | { until })`** — durable wait; the run holds, locals survive.
@@ -42,7 +42,7 @@ A workflow is **a script**: the `meta` export is a **pure literal** (engines der
42
42
 
43
43
  ## Where workflows run
44
44
 
45
- One file, three engines: `boardwalk dev` (run it now, locally, no account), the self-hosted Boardwalk engine (your server), or [the Boardwalk platform](https://boardwalk.sh) (`boardwalk deploy` — hosted, scheduled, with automatic model routing). The same manifest schema and event stream everywhere; engine differences are limited to documented resolution behavior.
45
+ The same file runs on three engines: `boardwalk dev` (locally, no account), the self-hosted Boardwalk engine (your own server), or [the Boardwalk platform](https://boardwalk.sh) (`boardwalk deploy` — hosted, scheduled, with automatic model routing). The manifest schema and event stream are the same everywhere; engine differences are limited to documented resolution behavior.
46
46
 
47
47
  The full authoring contract — every primitive, the manifest field inventory, and the run-event wire format — is in [`SPEC.md`](./SPEC.md).
48
48
 
package/dist/events.d.ts CHANGED
@@ -64,13 +64,14 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
64
64
  seq: z.ZodNumber;
65
65
  t: z.ZodNumber;
66
66
  }, z.core.$strict>, z.ZodObject<{
67
+ agentId: z.ZodString;
68
+ agentName: z.ZodOptional<z.ZodString>;
67
69
  kind: z.ZodLiteral<"turn_started">;
68
70
  runId: z.ZodString;
69
71
  turnId: z.ZodString;
70
72
  seq: z.ZodNumber;
71
73
  t: z.ZodNumber;
72
74
  }, z.core.$strict>, z.ZodObject<{
73
- kind: z.ZodLiteral<"turn_ended">;
74
75
  reason: z.ZodEnum<{
75
76
  error: "error";
76
77
  cancelled: "cancelled";
@@ -87,6 +88,9 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
87
88
  code: z.ZodString;
88
89
  message: z.ZodString;
89
90
  }, z.core.$strict>>;
91
+ agentId: z.ZodString;
92
+ agentName: z.ZodOptional<z.ZodString>;
93
+ kind: z.ZodLiteral<"turn_ended">;
90
94
  runId: z.ZodString;
91
95
  turnId: z.ZodString;
92
96
  seq: z.ZodNumber;
package/dist/events.js CHANGED
@@ -96,10 +96,29 @@ const programOutputEvent = z.strictObject({
96
96
  text: z.string(),
97
97
  });
98
98
  // -- agent channel ----------------------------------------------------------------
99
- const turnStarted = z.strictObject({ ...envelopeShape, kind: z.literal("turn_started") });
99
+ //
100
+ // `turn_started`/`turn_ended` bracket the turns of ONE `agent()` leaf and carry that leaf's
101
+ // identity: a stable, run-unique `agentId` (engine-assigned) and the author's optional
102
+ // `agentName` (from `AgentOptions.name`). The high-frequency frames in between (text/tool/
103
+ // reasoning) stay lean — a consumer attributes them to a leaf by their envelope `turnId`, which
104
+ // the bracketing `turn_started` maps to its `agentId`/`agentName`. This is what lets a viewer
105
+ // tell concurrent agents apart instead of seeing one interleaved blur.
106
+ /** Identity of the `agent()` leaf a turn belongs to (shared by its turn_started/turn_ended). */
107
+ const agentIdentityShape = {
108
+ /** Stable, run-unique id for the `agent()` call. Engine-assigned; same across all its turns. */
109
+ agentId: z.string().min(1),
110
+ /** The author's `AgentOptions.name`, if one was given. Display-only; absent otherwise. */
111
+ agentName: z.string().min(1).optional(),
112
+ };
113
+ const turnStarted = z.strictObject({
114
+ ...envelopeShape,
115
+ kind: z.literal("turn_started"),
116
+ ...agentIdentityShape,
117
+ });
100
118
  const turnEnded = z.strictObject({
101
119
  ...envelopeShape,
102
120
  kind: z.literal("turn_ended"),
121
+ ...agentIdentityShape,
103
122
  reason: z.enum(["complete", "cancelled", "error"]),
104
123
  usage: tokenUsageSchema.optional(),
105
124
  error: eventErrorSchema.optional(),
package/dist/types.d.ts CHANGED
@@ -26,6 +26,14 @@ export interface ToolDef {
26
26
  * declares none of them. A plain `agent(prompt)` is simple inference.
27
27
  */
28
28
  export interface AgentOptions {
29
+ /**
30
+ * A human label for this leaf, echoed onto its `turn_started`/`turn_ended` events as
31
+ * `agentName`. Purely for display — it lets a stream consumer tell concurrent agents apart
32
+ * (e.g. a `reviewer` and a `summarizer` running under `parallel`). It is NOT an identifier and
33
+ * need not be unique; the engine always assigns a stable, run-unique `agentId` regardless.
34
+ * Defaults to none (consumers fall back to a generic label).
35
+ */
36
+ name?: string;
29
37
  /**
30
38
  * The model, as an OPAQUE string passed VERBATIM to the provider — engines never parse,
31
39
  * prefix, or rewrite it. Use whatever identifier your provider expects (e.g.
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@boardwalk-labs/workflow",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Author Boardwalk workflows in TypeScript: agent(), sleep(), workflows.call(), secrets, the manifest schema, and the run-event wire format.",
5
5
  "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/boardwalk-labs/sdk.git"
9
+ },
10
+ "homepage": "https://github.com/boardwalk-labs/sdk#readme",
6
11
  "type": "module",
7
12
  "engines": {
8
13
  "node": ">=24"