langflower 0.2.2 → 0.3.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.
Files changed (40) hide show
  1. package/README.md +9 -5
  2. package/dist/index.js +2812 -736
  3. package/docs/public/product.md +7 -2
  4. package/package.json +1 -1
  5. package/ui-dist/assets/langflower-mark.svg +33 -0
  6. package/ui-dist/chunk-2F7UKSIL.js +4 -0
  7. package/ui-dist/{chunk-IASSR2ON.js → chunk-B3D35SQ5.js} +1 -1
  8. package/ui-dist/index.html +2 -2
  9. package/ui-dist/main-TL5G57BL.js +323 -0
  10. package/ui-dist/styles-O74ATCGZ.css +1 -0
  11. package/vendor/node-sdk/dist/node-factory/define-llm-node/define-llm-node.d.ts +2 -0
  12. package/vendor/node-sdk/dist/node-factory/define-llm-node/define-llm-node.js +1 -0
  13. package/vendor/node-sdk/dist/node-factory/define-reactive-node/define-reactive-node.d.ts +1 -0
  14. package/vendor/node-sdk/dist/node-factory/define-reactive-node/define-reactive-node.js +3 -1
  15. package/vendor/node-sdk/dist/node-factory/define-reactive-node/io-helpers.d.ts +6 -0
  16. package/vendor/node-sdk/dist/node-factory/define-reactive-node/port-meta.d.ts +5 -0
  17. package/vendor/node-sdk/dist/node-factory/define-reactive-node/types.d.ts +8 -0
  18. package/vendor/node-sdk/dist/node-state.d.ts +28 -0
  19. package/vendor/node-sdk/dist/node-state.js +1 -0
  20. package/vendor/runtime/dist/feed-log-fold.d.ts +26 -0
  21. package/vendor/runtime/dist/feed-log-fold.js +113 -0
  22. package/vendor/runtime/dist/runtime-editor.d.ts +6 -0
  23. package/vendor/runtime/dist/runtime-editor.js +86 -0
  24. package/vendor/runtime/dist/runtime-runner.d.ts +28 -3
  25. package/vendor/runtime/dist/runtime-runner.js +99 -8
  26. package/vendor/runtime/dist/runtime.d.ts +3 -1
  27. package/vendor/runtime/dist/runtime.js +1 -0
  28. package/vendor/runtime/dist/types.d.ts +84 -4
  29. package/vendor/server/skeleton/instructions.md +3 -1
  30. package/vendor/server/skeleton/nodes/my-nodes/README.md +12 -0
  31. package/vendor/server/skeleton/nodes/my-nodes/review-gate.ts +5 -0
  32. package/vendor/server/skeleton/skills/langflower-helper/SKILL.md +121 -21
  33. package/vendor/server/skeleton/skills/langflower-helper/architecture.md +37 -5
  34. package/vendor/server/skeleton/skills/langflower-helper/layout.md +25 -13
  35. package/vendor/server/skeleton/skills/langflower-node-writer/SKILL.md +22 -4
  36. package/vendor/server/skeleton/skills/langflower-workflow-writer/SKILL.md +20 -1
  37. package/vendor/server/skeleton/workflows/starter.json +3 -3
  38. package/ui-dist/chunk-HEF6F5HN.js +0 -4
  39. package/ui-dist/main-66PVIOBC.js +0 -323
  40. package/ui-dist/styles-Y56BLXVS.css +0 -1
@@ -44,9 +44,11 @@ Project product data for Langflower lives under **`.langflower/`**.
44
44
  - **Closing or reopening a browser tab does not stop a running workflow** while
45
45
  `langflower start` / the server process stays up. Reconnect → fresh snapshots
46
46
  - continued facts.
47
- - Soft **Pause**, Hard **Stop**, and checkpoint discard are **explicit** runner
48
- controls — do **not** equate “tab closed” with Stop. Process kill / reboot is
49
- different again (see Knowledge base §7).
47
+ - Soft **Pause**, Hard **Stop**, and discarding a session point are
48
+ **explicit** controls — do **not** equate “tab closed” with Stop. A
49
+ workflow session (topbar tab) can continue after process kill. That is
50
+ not the same as closing the browser while the process stays up (see
51
+ Knowledge base §7).
50
52
 
51
53
  ## Execution model
52
54
 
@@ -56,8 +58,38 @@ Project product data for Langflower lives under **`.langflower/`**.
56
58
  - Canvas node instances stay alive across **Stop / done / Start** while the
57
59
  same workflow is loaded. Authors may **intentionally** keep in-memory
58
60
  internal state across runs until the user **loads another workflow** or
59
- **shuts down Langflower**. That is not durable Checkpoint resume after
60
- process restart.
61
+ **shuts down Langflower**. In-memory closures still survive `done` until
62
+ the node is rematerialized. They do not survive a process restart.
63
+ - A **workflow session** is a durable tab of one workflow, not the process
64
+ `LangflowerSession`. The workflow is the parent: tabs are stored and
65
+ listed under that workflow. While the tab is open the canvas shows the
66
+ session graph snapshot; the workflow file stays the home. On disk the tab is
67
+ `.langflower/sessions/<workflowId>/<label>.json` (`schemaVersion: 1`)
68
+ plus `<label>.feed.jsonl`. The filename is the tab (`YYYY-MM-DD #N`).
69
+ `sessionId` is the UUID inside the JSON. The JSON holds the graph,
70
+ head `nodeStates`, and points (`runOffset` / `feedOffset`, not a copied
71
+ feed). The feed log is one JSON value per line; the restored work log
72
+ is the slice after the last run marker. The JSON is rewritten when the
73
+ graph, node state, points, or identity change. Closed frames are
74
+ appended after a short debounce. An open streaming frame stays in
75
+ memory until it closes. Finish does not flush. Restart binds the newest
76
+ session before the first feed. A Run with no tab writes one from the
77
+ graph on screen. A Run continues the head. **Continue from…** rewinds
78
+ to a point (truncates the feed to that offset and drops later points).
79
+ **Reset** empties the feed and clears points; the tab and graph stay.
80
+ OpenAI, Fake, Review, and Critique persist `{ history }` through the
81
+ state hook (`persist$` + `restore` on the bind result, stored under the
82
+ node id in `nodeStates`). Repeat persists `{ nextIndex, done, count }`
83
+ after each slot that has already left the node. Sub-Agent has no hook:
84
+ its result is a tool call on the parent agent's transcript. A custom
85
+ node uses the same hook: emit the full JSON value, accept `null` or
86
+ that JSON in `restore`. No session bound means nothing is written.
87
+ **Reset session on input** is a node parameter (default off), not the
88
+ hook. Tabs cannot be renamed. Any listed tab can be deleted, including one
89
+ that is not open and a corrupt file.
90
+ Switching workflows or sessions is refused while the graph is executing,
91
+ and allowed during HITL or steering after the parked run stops. Old
92
+ `.langflower/runs/**/checkpoint.json` files are not migrated.
61
93
  - **HITL loops** (Review Gate, feedback ports, composer Start/Send) are normal
62
94
  **internal waiting state of nodes**, not a separate product “interrupt the
63
95
  engine” mechanism.
@@ -4,8 +4,18 @@ Facts for UI chrome and on-disk paths. Prefer this file over guessing.
4
4
 
5
5
  ## Editor chrome map
6
6
 
7
- - **Topbar** — workflow list (switch / create / rename as shipped), gear →
8
- **Settings**.
7
+ - **Topbar** — product mark, then the project folder name (browser
8
+ tab title `<folder> — Langflower`), workflow list, then the **workflow
9
+ file tab** (double-click or the actions menu to rename; a dot when that
10
+ file is dirty; **Save** only while it is dirty and no session is open).
11
+ The actions menu sits next to the workflow list and is hidden while a
12
+ session is open. Then scrollable **session tabs** (`YYYY-MM-DD #N`, name
13
+ order) with **+** (New session) stuck to the last tab. Session tabs
14
+ cannot be renamed. A red dot on a session tab means that session’s graph
15
+ differs from the saved workflow; hover says so. The editor does not copy
16
+ one graph onto the other. × deletes any listed tab after confirmation, including
17
+ one that is not open and a corrupt file. Connection is a dot (the word only while connecting or
18
+ disconnected). Theme toggle and gear → **Settings**.
9
19
  - **Left palette** — built-in nodes; **Custom** packs; **Update** reloads
10
20
  custom packs after disk changes. Collapse with `<<` on the Palette title
11
21
  row; restore with floating `>>` at the canvas top-left. Visibility is
@@ -38,7 +48,9 @@ Facts for UI chrome and on-disk paths. Prefer this file over guessing.
38
48
  | Add a node from the palette | Drag from the left palette onto the canvas. Disabled while a run is active (`cursor-not-allowed`) — Stop first. |
39
49
  | Hide / show the node palette | Palette title `<<` / canvas `>>`. Shared across tabs; stored as `paletteVisible` in project `langflower.jsonc`. Allowed during a run. |
40
50
  | Add or reload custom nodes | Pack under `.langflower/nodes/<pack>/`. Server start loads cached packs when fingerprints match, else compiles. After file changes: on starter, Helper / Writer call `compile_custom_nodes` (Langflower Tools is wired). Else Custom → **Update** (always rebuilds). Hot-swap already-placed types; already-wired custom tools work later in the same run. New types: user places from Custom (no auto-place / auto-wire mid-run). |
41
- | Switch workflow | Topbar workflow list. Load / New / Copy / rename / Delete are locked while a run is active — Stop first. |
51
+ | Switch workflow | Topbar workflow list. Load / New / Copy / rename / Delete stay locked while the graph is executing. HITL and steering leave them usable; the parked run stops first. |
52
+ | Continue a conversation after Stop or restart | Restart opens the newest session. A Run with no tab opens one. **+ New session** is still explicit. A Run continues the head. **Continue from…** lists that session’s points and rewinds. Switching tabs is refused while the graph is executing. HITL and steering allow a switch after the parked run stops. |
53
+ | Drop a poisoned agent transcript on the next run | Select the agent → inspector **Reset session on input** (OpenAI, Fake, Review, Critique; default off), then start a new run. No reset button. The work log stays. |
42
54
  | Open Settings without leaving canvas | Gear — Settings in right aside |
43
55
  | Find sample coding graphs | Skeleton / demo-project workflow files — **manual copy** into project, then load → Start. No Sample workflows catalog UI. |
44
56
  | Why extra empty ports on Helper / tools / Router | Those inputs are `multi`. Wiring one slot shows the next free slot. **Feedback** = several sources (HITL + auto-review). **Tools** = several packs. **Router** = extra channels (`ch` / `ch@1`). Leave the empty row unwired. |
@@ -46,16 +58,16 @@ Facts for UI chrome and on-disk paths. Prefer this file over guessing.
46
58
 
47
59
  ## On-disk `.langflower/` map
48
60
 
49
- | Path | Role |
50
- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
51
- | `langflower.jsonc` | Providers, secrets refs, project config |
52
- | `workflows/` | Saved workflow graphs |
53
- | `skills/` | Agent skills (`langflower-helper/`, `langflower-node-writer/`, `langflower-workflow-writer/`, `spec-architect/`) |
54
- | `nodes/` | Custom node packs — one folder / `package.json` each (`my-nodes/`, sample `hello-embed/`, extra sibling packs; no jsonc registration) |
55
- | `instructions.md` | Project-level agent instructions |
56
- | `runs/` | Run artifacts / checkpoints when created |
57
- | `logs/` | Server bridge diagnostic JSONL logs when the server runs |
58
- | `.gitignore` | Seeded ignore rules: compiled node cache (`.cache/`), `logs/`, pack `node_modules/` |
61
+ | Path | Role |
62
+ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
63
+ | `langflower.jsonc` | Providers, secrets refs, project config |
64
+ | `workflows/` | Saved workflow graphs |
65
+ | `skills/` | Agent skills (`langflower-helper/`, `langflower-node-writer/`, `langflower-workflow-writer/`, `spec-architect/`) |
66
+ | `nodes/` | Custom node packs — one folder / `package.json` each (`my-nodes/`, sample `hello-embed/`, extra sibling packs; no jsonc registration) |
67
+ | `instructions.md` | Project-level agent instructions |
68
+ | `sessions/` | Workflow sessions named like the tab (`<workflowId>/<label>.json`, `schemaVersion: 1`, plus `<label>.feed.jsonl`). JSON: graph, `nodeStates`, point byte offsets. JSONL: the feed (last run is the slice after the last marker). Not read from `runs/` |
69
+ | `logs/` | Server bridge diagnostic JSONL logs when the server runs |
70
+ | `.gitignore` | Seeded ignore rules: compiled node cache (`.cache/`), `logs/`, pack `node_modules/` |
59
71
 
60
72
  ## Out of chrome
61
73
 
@@ -148,8 +148,13 @@ the node — copying the custom-node pack does not break it. Host `git` via
148
148
  `configureOutput('ok', ok$, { inferTypeFrom: trigger })`. Do **not**
149
149
  emit `boolean` `true` on that wire (it breaks typing and the
150
150
  continue-the-graph edge).
151
- - `fail` is a **string** (prefer stripped tool-handler text, not raw
152
- stderr dumps).
151
+ - `fail` is a **string** wired to Preview or an agent `feedback` port.
152
+ Filter test and formatter output to **failures** before that string
153
+ is emitted: failing test names, assertion diffs, and formatter error
154
+ lines. Drop passing suites, progress, and full file dumps. A length
155
+ cap on the raw log is not a filter — the kept text still bloats the
156
+ next agent turn. A green formatter or a passing test emits nothing
157
+ on `fail`.
153
158
  - A rewrite step (formatter) may run as a **side effect** and must not
154
159
  fail the gate if the product intent is “format then typecheck/test”.
155
160
  Typecheck / tests may fail the gate and skip later steps.
@@ -170,8 +175,8 @@ Vitest config **includes** that glob; do not assume it.
170
175
  (`defineToolRegistrations` owns a `tools` output — no custom inputs).
171
176
  3. Implement `execute` (`defineNode`), `tools` handlers
172
177
  (`defineToolRegistrations`), or `bind` (`defineReactiveNode`).
173
- 4. Show the full file the user can paste into `my-nodes/` **or write it**
174
- under `.langflower/nodes/<pack>/`.
178
+ 4. Write the full file under `.langflower/nodes/<pack>/` with `write` or
179
+ `edit`. A chat paste is not a saved node.
175
180
  5. Call **`compile_custom_nodes`**. If the snapshot lists errors, `read`
176
181
  that pack’s `COMPILATION_ERRORS.md`, fix, and compile again. Tell the
177
182
  user to place **new** types from Custom; already-placed types are live.
@@ -184,3 +189,16 @@ Vitest config **includes** that glob; do not assume it.
184
189
  (`defineToolRegistrations`), `review-gate.ts` (`defineReactiveNode`)
185
190
  - Multi-file + `.ts` imports: `.langflower/nodes/hello-embed/` (`tsconfig.json`
186
191
  already has `allowImportingTsExtensions`)
192
+
193
+ ## Before you send a final answer
194
+
195
+ A message with no tool call is the final result Helper will treat as done.
196
+ Plain text does not write or compile files.
197
+
198
+ - Create and edit files with `write`, `edit`, or `create` under
199
+ `.langflower/nodes/`. A chat paste is not a saved node.
200
+ - After writing or editing those files, call `compile_custom_nodes` with no
201
+ arguments. Quote status and `COMPILATION_ERRORS.md` from the tool result.
202
+ - The closing summary lists only paths and compile status that appear in tool
203
+ results from this task, plus open risks. If the file is not written yet, call
204
+ the tool instead of summarizing.
@@ -99,7 +99,10 @@ Custom exclusive-branch nodes (`defineReactiveNode`, seed `review-gate.ts`):
99
99
  - in **`trigger`** (dynamic)
100
100
  - out **`ok`** — **pulse** (`boolean` `true`, seed) **or** **passthrough of
101
101
  `trigger`** (`inferTypeFrom`) when the next stage must keep the payload
102
- - out **`fail`** — string (stripped errors) → Preview / LLM `feedback`
102
+ - out **`fail`** — string → Preview / LLM `feedback`. Filter test and
103
+ formatter output to **failures** (failing names, assertion diffs,
104
+ formatter errors). Drop passing suites and progress. Raw logs bloat
105
+ the next agent turn. A green formatter emits nothing on `fail`.
103
106
 
104
107
  Do **not** emit boolean `true` on `ok` if the downstream graph needs the
105
108
  trigger payload. Do not use `defineNode` that returns `{ ok: true }` for
@@ -123,8 +126,24 @@ graph the first time.
123
126
 
124
127
  ## When drafting
125
128
 
129
+ These steps are tool calls (`write` / `edit` / `create`). A summary of a graph
130
+ you did not write is not a draft.
131
+
126
132
  1. Pick a stable filename stem and metadata name.
127
133
  2. Place nodes with real `type` / `params` / `inputs` / `ui.position`.
128
134
  3. Wire edges with `[portId, slotIndex]` tuples.
129
135
  4. Prefer copying structure from an existing sample, then editing.
130
136
  5. Remind the user to reload the workflow in the topbar and Save if repair ran.
137
+
138
+ ## Before you send a final answer
139
+
140
+ A message with no tool call is the final result Helper will treat as done.
141
+ Plain text does not write or compile files.
142
+
143
+ - Create and edit files with `write`, `edit`, or `create` under
144
+ `.langflower/workflows/` and `.langflower/nodes/`.
145
+ - After writing or editing `.langflower/nodes/` files, call
146
+ `compile_custom_nodes` with no arguments. Quote status from that tool result.
147
+ - The closing summary lists only paths and compile status that appear in tool
148
+ results from this task, plus open risks. If the file is not written yet, call
149
+ the tool instead of summarizing.
@@ -4,7 +4,7 @@
4
4
  "name": "Starter",
5
5
  "description": "Chat loop with an onboarding agent (skill langflower-helper) plus a Writer Sub-Agent (workflow-writer + node-writer). After bootstrap — product capabilities, workflows, editor chrome, and custom nodes.",
6
6
  "createdAt": "2026-07-24T00:00:00.000Z",
7
- "updatedAt": "2026-08-15T00:00:00.000Z"
7
+ "updatedAt": "2026-10-16T00:00:00.000Z"
8
8
  },
9
9
  "graph": {
10
10
  "viewport": {
@@ -64,7 +64,7 @@
64
64
  }
65
65
  },
66
66
  "inputs": {
67
- "systemPrompt": "You are the Langflower onboarding assistant. Use the langflower-helper skill. The user already started Langflower and configured a provider — do not lead with CLI start or provider setup. Help with what Langflower can do, workflows, editor chrome, and custom nodes. Keep answers short and actionable.\n\nLangflower Tools is wired: after custom-node file changes (yours or Writer's), call compile_custom_nodes (no args). Do not send the user to Custom → Update as the only path. You cannot place a new type on the canvas mid-run; already-placed custom types hot-swap, and already-wired custom tools can be invoked later in this run.\n\nWhen the user asks to draft or edit a workflow JSON or a custom node pack, call the Writer specialist tool (skills langflower-workflow-writer and langflower-node-writer) with a clear task; then compile if nodes changed, and summarize for the user."
67
+ "systemPrompt": "You are the Langflower onboarding assistant. Use the langflower-helper skill. The user already started Langflower and configured a provider — do not lead with CLI start or provider setup. Help with what Langflower can do, workflows, editor chrome, and custom nodes. Keep answers short and actionable.\n\nA reply with no tool call is the final answer. Plain text does not run a tool.\n\n- Product questions covered by the skill: answer from the skill. If a fact is missing, say not in my facts.\n- Anything about files on disk, what this project contains, or whether work is finished: call read, glob, or grep first, then answer from the tool result.\n- Draft or edit a workflow JSON or a custom node pack: call Writer(subagent) (toolId Writer_subagent) with a concrete task. Do not paste the files in chat as if they were saved.\n- After custom-node file changes (yours or Writer's): call compile_custom_nodes with no arguments. Report status, nodeTypes, and errors from that tool result. Do not send the user to Custom → Update as the only path. You cannot place a new type on the canvas mid-run; already-placed custom types hot-swap, and already-wired custom tools can be invoked later in this run.\n- Say a file was written, Writer finished, or compile succeeded only when that tool result is already in this turn. Otherwise call the tool. Do not send a plan or a done-summary in place of the call."
68
68
  },
69
69
  "ui": {
70
70
  "position": {
@@ -103,7 +103,7 @@
103
103
  }
104
104
  },
105
105
  "inputs": {
106
- "systemPrompt": "You are Writer. Follow langflower-workflow-writer and/or langflower-node-writer for the task. Prefer editing files under .langflower/workflows/ and .langflower/nodes/. Use only catalog node types and real ports. After writing or editing .langflower/nodes/ files, call compile_custom_nodes (no args) and report status / COMPILATION_ERRORS.md — do not only remind the user to click Update. Wire common-langflower-tools into an agent only when they should be allowed to recompile. Return a short summary of files changed and any open risks."
106
+ "systemPrompt": "You are Writer. Follow langflower-workflow-writer and/or langflower-node-writer.\n\nA reply with no tool call is the final result Helper will treat as done. Plain text does not write or compile files.\n\n- Create and edit files with write, edit, or create under .langflower/workflows/ and .langflower/nodes/. Use only catalog node types and real ports.\n- After writing or editing .langflower/nodes/ files, call compile_custom_nodes with no arguments. Quote status and COMPILATION_ERRORS.md from the tool result. Do not only remind the user to click Update.\n- Wire common-langflower-tools into an agent only when that agent should be allowed to recompile.\n- The closing summary lists only paths and compile status that appear in tool results from this task, plus open risks. If the file is not written yet, call the tool instead of summarizing."
107
107
  },
108
108
  "ui": {
109
109
  "position": {