langflower 0.1.1 → 0.1.2
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 +74 -105
- package/dist/{chunk-526FJL62.js → chunk-AO33IM2J.js} +1 -1
- package/dist/{chunk-WQZHA5FM.js → chunk-NIRPHJLO.js} +94 -33
- package/dist/index.js +273 -56
- package/package.json +1 -1
- package/ui-dist/index.html +1 -1
- package/ui-dist/main-JJURZFKA.js +318 -0
- package/vendor/node-sdk/dist/node-factory/define-tool-registrations/define-tool-registrations.d.ts +6 -6
- package/vendor/node-sdk/dist/node-factory/define-tool-registrations/define-tool-registrations.js +6 -6
- package/vendor/server/skeleton/skills/langflower-helper/SKILL.md +32 -10
- package/vendor/server/skeleton/skills/langflower-helper/architecture.md +5 -1
- package/vendor/server/skeleton/skills/langflower-helper/layout.md +12 -10
- package/vendor/server/skeleton/skills/langflower-node-writer/SKILL.md +69 -0
- package/vendor/server/skeleton/skills/langflower-workflow-writer/SKILL.md +15 -2
- package/vendor/server/skeleton/skills/spec-architect/SKILL.md +232 -0
- package/vendor/server/skeleton/workflows/advanced-coder.json +1 -0
- package/vendor/server/skeleton/workflows/simple-coder.json +1 -0
- package/ui-dist/main-X5M7PU3P.js +0 -317
package/vendor/node-sdk/dist/node-factory/define-tool-registrations/define-tool-registrations.d.ts
CHANGED
|
@@ -6,13 +6,13 @@ import { type ToolHandler } from './tool-handle.js';
|
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```ts
|
|
9
|
-
* import {
|
|
9
|
+
* import { CRAWL_TOOL_CONFIGS } from '@langflower/tools/domain-tool-configs';
|
|
10
10
|
*
|
|
11
|
-
* export const
|
|
12
|
-
* type: 'common-
|
|
13
|
-
* displayName: '
|
|
14
|
-
* category: '
|
|
15
|
-
* tools:
|
|
11
|
+
* export const crawlToolsNode = defineToolRegistrations({
|
|
12
|
+
* type: 'common-crawl-tools',
|
|
13
|
+
* displayName: 'Crawl Tools',
|
|
14
|
+
* category: 'Tools',
|
|
15
|
+
* tools: CRAWL_TOOL_CONFIGS,
|
|
16
16
|
* });
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
package/vendor/node-sdk/dist/node-factory/define-tool-registrations/define-tool-registrations.js
CHANGED
|
@@ -9,13 +9,13 @@ import { TOOL_HANDLE_WIRE_TYPE, } from './tool-handle.js';
|
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```ts
|
|
12
|
-
* import {
|
|
12
|
+
* import { CRAWL_TOOL_CONFIGS } from '@langflower/tools/domain-tool-configs';
|
|
13
13
|
*
|
|
14
|
-
* export const
|
|
15
|
-
* type: 'common-
|
|
16
|
-
* displayName: '
|
|
17
|
-
* category: '
|
|
18
|
-
* tools:
|
|
14
|
+
* export const crawlToolsNode = defineToolRegistrations({
|
|
15
|
+
* type: 'common-crawl-tools',
|
|
16
|
+
* displayName: 'Crawl Tools',
|
|
17
|
+
* category: 'Tools',
|
|
18
|
+
* tools: CRAWL_TOOL_CONFIGS,
|
|
19
19
|
* });
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
@@ -73,8 +73,8 @@ do not say coding pipelines “don’t exist” or are unavailable.
|
|
|
73
73
|
- **Can:** `langflower start [project-dir]` (default port **4010**) creates
|
|
74
74
|
`.langflower/`, config, `instructions.md`, packs `nodes/my-nodes/` and
|
|
75
75
|
`nodes/hello-embed/`, skills
|
|
76
|
-
`langflower-helper`, `langflower-node-writer`,
|
|
77
|
-
`langflower-workflow-writer`, and opens workflow **`starter`** first.
|
|
76
|
+
`langflower-helper`, `langflower-node-writer`,
|
|
77
|
+
`langflower-workflow-writer`, and `spec-architect`, and opens workflow **`starter`** first.
|
|
78
78
|
- **Can:** Skeleton already ships coding and KB sample workflows
|
|
79
79
|
(`simple-coder`, `advanced-coder`, `kb-create`, `kb-navigate`,
|
|
80
80
|
`kb-ingest`, `kb-manual-search`, `kb-tool`, `kb-rag`, …). With a
|
|
@@ -95,7 +95,7 @@ do not say coding pipelines “don’t exist” or are unavailable.
|
|
|
95
95
|
|
|
96
96
|
- **Can:** First-run seed = config + **all** skeleton workflows (including
|
|
97
97
|
`starter`, coding samples, `kb-create`, `kb-navigate`, `kb-ingest`,
|
|
98
|
-
`kb-manual-search`, `kb-tool`, `kb-rag`) +
|
|
98
|
+
`kb-manual-search`, `kb-tool`, `kb-rag`) + four skills + `my-nodes` +
|
|
99
99
|
`hello-embed` + instructions.
|
|
100
100
|
- **Can:** Skeleton inventory includes `node-writer`, `agents-dialog`,
|
|
101
101
|
`simple-coder`, `advanced-coder`, `kb-create`, `kb-navigate`,
|
|
@@ -155,8 +155,10 @@ do not say coding pipelines “don’t exist” or are unavailable.
|
|
|
155
155
|
- **Can:** Chat Input graphs start from the composer **Start** control. Plain
|
|
156
156
|
**Run** stays disabled for those graphs. Prefill or last typed text lives on
|
|
157
157
|
the Chat Input node (`inputs.message`) and reappears after Stop.
|
|
158
|
-
- **Can:** While running — Hard **Stop**, soft **Pause**, HITL
|
|
159
|
-
`
|
|
158
|
+
- **Can:** While running — Hard **Stop**, soft **Pause**, HITL,
|
|
159
|
+
`ask_user` (composer Send; question in the work log), and `permission.ask`
|
|
160
|
+
in the composer. Work log **clears** on
|
|
161
|
+
successful
|
|
160
162
|
workflow load / create / copy (not rename).
|
|
161
163
|
- **Cannot:** Switch, rename, delete, copy, or create a workflow while a run
|
|
162
164
|
is active — Stop first. Same lock: inspector / canvas inline / palette
|
|
@@ -206,7 +208,7 @@ unwired — it is not a duplicate Helper, not a second node, and not a bug.
|
|
|
206
208
|
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
207
209
|
| `starter` | Onboarding chat + this skill + Writer Sub-Agent (`langflower-workflow-writer` + `langflower-node-writer`) — default open after seed |
|
|
208
210
|
| Skeleton stubs | `simple-coder`, `advanced-coder`, `kb-create`, `kb-navigate`, `kb-ingest`, `kb-manual-search`, `kb-tool`, `kb-rag`, … seeded on first-run; with provider → Start |
|
|
209
|
-
| `simple-coder` | Plan⇄HITL→Coder⇄HITL→Finish smoke spine + `common-memory-tools` on Plan/Coder/Researcher/Worker; Researcher Sub-Agent under Plan, Worker under Coder — **not** full multi-loop `coding-agent`
|
|
211
|
+
| `simple-coder` | Plan (`spec-architect`) ⇄ HITL → Coder ⇄ HITL → Finish smoke spine + `common-memory-tools` on Plan/Coder/Researcher/Worker; Researcher Sub-Agent under Plan, Worker under Coder — **not** full multi-loop `coding-agent` |
|
|
210
212
|
| `kb-create` | Memory / project wiki create: Orchestrator **indexes** the repo with `glob`/`read`, persists `history/work-queue.md`, then **serially** calls Explorer → Composer **one unit at a time**; `common-memory-tools` writes `core/*` + `modules/*`; Review rejects non-empty Pending or thin overviews |
|
|
211
213
|
| `kb-navigate` | Memory navigate: Navigator + Searcher + memory tree/grep/section tools; HITL Review Gate for follow-ups |
|
|
212
214
|
| `kb-ingest` | Sample **hello-embed** ingest (Settings embedding model; pack compiles on `langflower start`) |
|
|
@@ -232,8 +234,11 @@ These four are **not** the same thing.
|
|
|
232
234
|
|
|
233
235
|
### 8. Tools, permissions, MCP
|
|
234
236
|
|
|
235
|
-
- **Can:** Harness builtins + `permission.ask`
|
|
236
|
-
|
|
237
|
+
- **Can:** Harness builtins (including default `ask_user`) + `permission.ask`
|
|
238
|
+
Allow/Deny for those builtins. `ask_user` shows the question in the work
|
|
239
|
+
log and opens the composer textarea (Send), not Allow/Deny. Wired pack /
|
|
240
|
+
MCP tools (including memory writes and
|
|
241
|
+
**Langflower Tools**)
|
|
237
242
|
do **not** ask — authoring the edge is consent. Write Allow does **not**
|
|
238
243
|
grant bash. MCP **nodes** wire `tools` → agent `tools` (`ToolHandle[]`).
|
|
239
244
|
Optional **Tool collection** (`common-tool-collection`) can merge several
|
|
@@ -291,7 +296,10 @@ Sub-Agent is an **explicit canvas node** for **control and observability**
|
|
|
291
296
|
`kb-create` (index with `glob` → `history/work-queue.md` → serial
|
|
292
297
|
Explorer/Composer units into `core/*` + `modules/*`) and `kb-navigate`.
|
|
293
298
|
Managed markdown under `.langflower/memory/` (also reachable with harness
|
|
294
|
-
file tools). **
|
|
299
|
+
file tools). **Can:** with Memory Tools wired, call `update_plan` to write
|
|
300
|
+
`history/plan.md` and print the current plan in the work log (`plan`
|
|
301
|
+
output, `feed.role: result`). There is no separate Plan mode. **Embeddings**
|
|
302
|
+
catalog nodes + Settings default embedding model
|
|
295
303
|
are shipped for API checks and pack **`EmbedHandle`** wiring — separate from
|
|
296
304
|
vector KB ([ADR-033](../../../../../docs/ADR.md#adr-033--markdown-memory-tools-no-embedding-as-base)).
|
|
297
305
|
Obsidian vault helpers are **not** shipped (TBD-007).
|
|
@@ -332,7 +340,18 @@ When the user asks to “create a project wiki”, “build a knowledge base”,
|
|
|
332
340
|
Pack `tsconfig.json` gates compile (`tsc --noEmit`). `from './file.ts'`
|
|
333
341
|
requires `"allowImportingTsExtensions": true` next to `"noEmit": true`
|
|
334
342
|
(hello-embed); otherwise the pack does not compile. Extensionless imports
|
|
335
|
-
(`my-nodes`) do not need the flag.
|
|
343
|
+
(`my-nodes`) do not need the flag. Relative `from './lib/x'` without a
|
|
344
|
+
suffix fails NodeNext `tsc` (`TS2835`) — use `.ts` + the flag for
|
|
345
|
+
multi-file packs, or keep one-file nodes with no local imports.
|
|
346
|
+
Sibling folders under `.langflower/nodes/` with their own `package.json`
|
|
347
|
+
are extra packs (no jsonc registration).
|
|
348
|
+
LLM tool `handler`s return short **strings** (expected failures as text,
|
|
349
|
+
not throws). Do not dump raw subprocess logs at the model.
|
|
350
|
+
Exclusive `ok` / `fail` gates are **`defineReactiveNode`**. Seed
|
|
351
|
+
`review-gate` uses a boolean **pulse** on `ok`. If the next stage needs
|
|
352
|
+
the original payload, `ok` **passthroughs `trigger`** (`inferTypeFrom`)
|
|
353
|
+
— not `boolean` `true`. A formatter rewrite may be a side effect that
|
|
354
|
+
does **not** fail the gate.
|
|
336
355
|
Nodes may **intentionally keep in-memory internal state across runs**
|
|
337
356
|
(Stop / done / Start) until the user loads another workflow or shuts down
|
|
338
357
|
Langflower — not the same as Checkpoint resume after process kill.
|
|
@@ -341,6 +360,9 @@ When the user asks to “create a project wiki”, “build a knowledge base”,
|
|
|
341
360
|
Ambient compile without Langflower Tools wired. Canvas add/remove node or
|
|
342
361
|
edge tools (not shipped). Claim that every node always resets on Stop, or
|
|
343
362
|
that in-memory node state survives process restart without Checkpoints.
|
|
363
|
+
`defineNode` for exclusive `ok` / `fail`. Boolean `true` on a gate `ok`
|
|
364
|
+
that should continue the graph. Shell Cap on public `ExecutionContext`
|
|
365
|
+
(seed demos use `child_process`). Hanging `start` / `dev` / watch tools.
|
|
344
366
|
|
|
345
367
|
### 11a. Recipe — write / reload a custom node
|
|
346
368
|
|
|
@@ -71,7 +71,7 @@ Project product data for Langflower lives under **`.langflower/`**.
|
|
|
71
71
|
Authentication/configuration failures are terminal. Generic reload of any
|
|
72
72
|
failed non-LLM node is not yet shipped.
|
|
73
73
|
- Also on the bus: runner start / resume / interrupt intents, `permission.ask`,
|
|
74
|
-
and related facts.
|
|
74
|
+
`askUser.ask`, and related facts.
|
|
75
75
|
|
|
76
76
|
## Agents on the canvas
|
|
77
77
|
|
|
@@ -111,6 +111,10 @@ Project product data for Langflower lives under **`.langflower/`**.
|
|
|
111
111
|
Stop is not required for already-placed custom types.
|
|
112
112
|
An already-wired custom tools pack can be invoked later in the same run
|
|
113
113
|
after compile. Do not auto-place or auto-wire a new type mid-run.
|
|
114
|
+
Tool handlers return short pass/fail text (not raw logs). Exclusive
|
|
115
|
+
`ok`/`fail` gates: seed pulse is boolean `true` on `ok`; continue-the-graph
|
|
116
|
+
gates passthrough `trigger` (`inferTypeFrom`). No shell Cap on public
|
|
117
|
+
`ExecutionContext` yet.
|
|
114
118
|
- Plain JS / Go / Python are not the authoring path. Sandboxed arbitrary
|
|
115
119
|
user-node execution is **not** shipped. Canvas add/remove node or edge
|
|
116
120
|
tools are **not** shipped (later rows on Langflower Tools).
|
|
@@ -16,7 +16,8 @@ Facts for UI chrome and on-disk paths. Prefer this file over guessing.
|
|
|
16
16
|
**Settings**. Opening Settings (gear or empty-provider onboarding) swaps out
|
|
17
17
|
feed/inspector; canvas stays. Settings open/close is server-driven.
|
|
18
18
|
- **Composer (bottom)** — **Start** / Hard **Stop** / soft **Pause**; HITL
|
|
19
|
-
input and actions; `
|
|
19
|
+
input and actions; `ask_user` textarea + Send (question is in the work log);
|
|
20
|
+
`permission.ask` Allow/Deny while a run needs them.
|
|
20
21
|
|
|
21
22
|
## Where can I…?
|
|
22
23
|
|
|
@@ -27,6 +28,7 @@ Facts for UI chrome and on-disk paths. Prefer this file over guessing.
|
|
|
27
28
|
| Start a Chat Input graph | Composer **Start** — not plain **Run**. Prefill lives on the node; Stop then Start reuses it. |
|
|
28
29
|
| See run output / stream | Right aside **feed** |
|
|
29
30
|
| Answer HITL / send into a waiting node | Composer + feed context |
|
|
31
|
+
| Answer an agent's `ask_user` question | Work log shows the question; composer textarea + **Send** (not Allow/Deny) |
|
|
30
32
|
| Allow or Deny `permission.ask` | Composer permission controls |
|
|
31
33
|
| Soft-pause last feed agent / continue | Composer **Pause** (per-node) / Send or Resume (soft pause ≠ Hard Stop) |
|
|
32
34
|
| Hard-stop a run | Composer **Stop** |
|
|
@@ -43,15 +45,15 @@ Facts for UI chrome and on-disk paths. Prefer this file over guessing.
|
|
|
43
45
|
|
|
44
46
|
## On-disk `.langflower/` map
|
|
45
47
|
|
|
46
|
-
| Path | Role
|
|
47
|
-
| ------------------ |
|
|
48
|
-
| `langflower.jsonc` | Providers, secrets refs, project config
|
|
49
|
-
| `workflows/` | Saved workflow graphs
|
|
50
|
-
| `skills/` | Agent skills (`langflower-helper/`, `langflower-node-writer/`, `langflower-workflow-writer/`)
|
|
51
|
-
| `nodes/` | Custom node packs (`my-nodes/`, sample `hello-embed
|
|
52
|
-
| `instructions.md` | Project-level agent instructions
|
|
53
|
-
| `runs/` | Run artifacts / checkpoints when created
|
|
54
|
-
| `logs/` | Server bridge diagnostic JSONL logs when the server runs
|
|
48
|
+
| Path | Role |
|
|
49
|
+
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
50
|
+
| `langflower.jsonc` | Providers, secrets refs, project config |
|
|
51
|
+
| `workflows/` | Saved workflow graphs |
|
|
52
|
+
| `skills/` | Agent skills (`langflower-helper/`, `langflower-node-writer/`, `langflower-workflow-writer/`, `spec-architect/`) |
|
|
53
|
+
| `nodes/` | Custom node packs — one folder / `package.json` each (`my-nodes/`, sample `hello-embed/`, extra sibling packs; no jsonc registration) |
|
|
54
|
+
| `instructions.md` | Project-level agent instructions |
|
|
55
|
+
| `runs/` | Run artifacts / checkpoints when created |
|
|
56
|
+
| `logs/` | Server bridge diagnostic JSONL logs when the server runs |
|
|
55
57
|
|
|
56
58
|
## Out of chrome
|
|
57
59
|
|
|
@@ -49,6 +49,75 @@ You help the user write **custom nodes** for Langflower.
|
|
|
49
49
|
custom types. An already-wired custom tools pack can be invoked later in
|
|
50
50
|
the **same run** after compile. Failures land in `COMPILATION_ERRORS.md`
|
|
51
51
|
in that pack.
|
|
52
|
+
- Sibling packs: any folder under `.langflower/nodes/` with its own
|
|
53
|
+
`package.json` is discovered (no `langflower.jsonc` registration). Seed
|
|
54
|
+
`my-nodes` is the default; extra packs sit next to it (`hello-embed`).
|
|
55
|
+
|
|
56
|
+
## Author patterns (do not invent forks)
|
|
57
|
+
|
|
58
|
+
### Factory
|
|
59
|
+
|
|
60
|
+
| Need | Factory | Not |
|
|
61
|
+
| --------------------------------------------------------------------------- | ------------------------- | ---------------------------------------------------- |
|
|
62
|
+
| One `execute` result on **all** outputs together | `defineNode` | Exclusive `ok` / `fail` |
|
|
63
|
+
| LLM-callable `ToolHandle[]` on a `tools` port | `defineToolRegistrations` | `defineNode` that returns inventory as a string wire |
|
|
64
|
+
| Emit on one port and **stay silent** on the other; streams; `inferTypeFrom` | `defineReactiveNode` | `defineNode` |
|
|
65
|
+
|
|
66
|
+
**Wrong:** a review / QA gate with `defineNode` that returns `{ ok: true }`
|
|
67
|
+
or throws on failure. `execute` maps onto every declared output at once.
|
|
68
|
+
Throwing is a node error stream — it does **not** drive a separate `fail`
|
|
69
|
+
branch. **Right:** `defineReactiveNode` + `of` / `EMPTY` (seed
|
|
70
|
+
`review-gate.ts`).
|
|
71
|
+
|
|
72
|
+
### Multi-file imports
|
|
73
|
+
|
|
74
|
+
Pack `tsconfig` is NodeNext. Relative `from './lib/x'` **without** a suffix
|
|
75
|
+
fails `tsc` (`TS2835`). Either keep one-file nodes with no local imports
|
|
76
|
+
(seed `git-diff.ts`) **or** `from './lib/x.ts'` plus
|
|
77
|
+
`"allowImportingTsExtensions": true` next to `"noEmit": true` (copy
|
|
78
|
+
`hello-embed/tsconfig.json`).
|
|
79
|
+
|
|
80
|
+
### LLM tools (`defineToolRegistrations`)
|
|
81
|
+
|
|
82
|
+
- `handler` returns `Promise<string>`. Expected command / test failure is
|
|
83
|
+
**text to the model**, not `throw`. Throw only for contract (empty
|
|
84
|
+
`ctx.projectDir`).
|
|
85
|
+
- Agent-facing text is a **short signal**: success → one line `ok <toolId>`.
|
|
86
|
+
Failure → failed tests / `TS####` / ESLint errors only. Strip ANSI. Drop
|
|
87
|
+
`✓`, coverage tables, npm lifecycle banners, raw stdout dumps. When
|
|
88
|
+
slicing an `Issues:` block, do **not** use `$` with the `/m` flag (that
|
|
89
|
+
is end-of-line, so the match stops after the first line).
|
|
90
|
+
- No shell Cap on public `ExecutionContext` yet — `child_process` like seed
|
|
91
|
+
`git-diff-tool.ts`. `shell: true` only with an **allowlisted literal**
|
|
92
|
+
(`npm run format`); never splice user paths into a shell string. Resolve
|
|
93
|
+
user paths under `ctx.projectDir` and reject `..` escapes.
|
|
94
|
+
- Do not register hanging processes (`start`, `dev`, `test:watch`) as tools.
|
|
95
|
+
|
|
96
|
+
### QA / review gates (`defineReactiveNode`)
|
|
97
|
+
|
|
98
|
+
- Exclusive ports: pass → emit on `ok`, silent `fail`; fail → emit on
|
|
99
|
+
`fail`, silent `ok`.
|
|
100
|
+
- Two honest `ok` shapes — pick from the graph, do not mix them:
|
|
101
|
+
- **Pulse** — seed `review-gate.ts` emits `boolean` `true`
|
|
102
|
+
(`wireType: 'boolean'`). Downstream only needs “passed”.
|
|
103
|
+
- **Passthrough** — when the next stage must keep the original payload:
|
|
104
|
+
`configureOutput('ok', ok$, { inferTypeFrom: trigger })`. Do **not**
|
|
105
|
+
emit `boolean` `true` on that wire (it breaks typing and the
|
|
106
|
+
continue-the-graph edge).
|
|
107
|
+
- `fail` is a **string** (prefer stripped tool-handler text, not raw
|
|
108
|
+
stderr dumps).
|
|
109
|
+
- A rewrite step (formatter) may run as a **side effect** and must not
|
|
110
|
+
fail the gate if the product intent is “format then typecheck/test”.
|
|
111
|
+
Typecheck / tests may fail the gate and skip later steps.
|
|
112
|
+
|
|
113
|
+
### Tests
|
|
114
|
+
|
|
115
|
+
Pack compile **skips** `*.test.ts`. Drive nodes with
|
|
116
|
+
`createNodeHarness` from `@langflower/node-sdk/testing`. Subscribe to
|
|
117
|
+
exclusive `ok` / `fail` **before** `send('trigger')` or you miss the
|
|
118
|
+
emission. Mock `child_process` — do not spawn a real monorepo `build`
|
|
119
|
+
from a unit test. Host `npm test` only sees pack tests if the project
|
|
120
|
+
Vitest config **includes** that glob; do not assume it.
|
|
52
121
|
|
|
53
122
|
## When drafting a node
|
|
54
123
|
|
|
@@ -14,8 +14,8 @@ You help the user **author valid Langflower workflow JSON** under
|
|
|
14
14
|
## Honesty (do not invent)
|
|
15
15
|
|
|
16
16
|
- Use only **catalog** node `type` strings that exist in the project palette /
|
|
17
|
-
common-nodes
|
|
18
|
-
use `common-hitl-review-gate`).
|
|
17
|
+
common-nodes **or compiled custom packs**. Do **not** invent types (e.g.
|
|
18
|
+
there is no `common-hitl` — use `common-hitl-review-gate`).
|
|
19
19
|
- Use only **real port ids** from each node’s definition / `NODE.md`. Wrong
|
|
20
20
|
ports are stripped on load (graceful repair) — inventing ports breaks the
|
|
21
21
|
graph.
|
|
@@ -80,6 +80,19 @@ Typical HITL revise loop:
|
|
|
80
80
|
Do **not** feed Merge output into both gates and LLM feedback on every tick
|
|
81
81
|
without a clear phase split.
|
|
82
82
|
|
|
83
|
+
## Custom QA / review gates
|
|
84
|
+
|
|
85
|
+
Custom exclusive-branch nodes (`defineReactiveNode`, seed `review-gate.ts`):
|
|
86
|
+
|
|
87
|
+
- in **`trigger`** (dynamic)
|
|
88
|
+
- out **`ok`** — **pulse** (`boolean` `true`, seed) **or** **passthrough of
|
|
89
|
+
`trigger`** (`inferTypeFrom`) when the next stage must keep the payload
|
|
90
|
+
- out **`fail`** — string (stripped errors) → Preview / LLM `feedback`
|
|
91
|
+
|
|
92
|
+
Do **not** emit boolean `true` on `ok` if the downstream graph needs the
|
|
93
|
+
trigger payload. Do not use `defineNode` that returns `{ ok: true }` for
|
|
94
|
+
this shape (`execute` cannot stay silent on `fail`).
|
|
95
|
+
|
|
83
96
|
## Sub-Agent (one registration wire)
|
|
84
97
|
|
|
85
98
|
Mirror `.langflower/workflows/kb-navigate.json`:
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec-architect
|
|
3
|
+
description: >-
|
|
4
|
+
Discovery skill for the Plan role. Converts a short feature prompt into an
|
|
5
|
+
explicit specification. When update_plan is wired, the full spec lives in
|
|
6
|
+
the memory plan (work log) — do not write spec.md into a project folder.
|
|
7
|
+
Sequences environment audit, requirements, blast radius, dependencies,
|
|
8
|
+
contracts, mechanics, patterns, and verification.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Spec architect (Plan)
|
|
12
|
+
|
|
13
|
+
You convert a short, ambiguous feature request into an explicit specification.
|
|
14
|
+
Do **not** jump into application source implementation, refactoring, or
|
|
15
|
+
unsolicited file creation while this skill is active.
|
|
16
|
+
|
|
17
|
+
You are a defensive principal architect: uncover hidden constraints, map
|
|
18
|
+
invariants, and force alignment with local patterns. Do not guess when the
|
|
19
|
+
repo shows competing styles — ask.
|
|
20
|
+
|
|
21
|
+
## Honesty (Langflower, not Cursor)
|
|
22
|
+
|
|
23
|
+
- There is **no** Cursor Plan mode and **no** `CreatePlan` tool.
|
|
24
|
+
- **Memory plan available** (`update_plan` / `read_plan` in your tool list):
|
|
25
|
+
deliver the **full** Output Target Layout through `update_plan` so the
|
|
26
|
+
operator sees it in the work log. Call `read_plan` first if you need the
|
|
27
|
+
current plan. **Do not** write `spec.md` (or any other spec file) into a
|
|
28
|
+
project folder. Generic `update_memory_section` on `history/plan.md` does
|
|
29
|
+
**not** show the plan in the feed.
|
|
30
|
+
- **No memory plan** (`update_plan` not wired): fallback only — write
|
|
31
|
+
`{designatedBaseFolder}/spec.md` with the same layout via harness `create`
|
|
32
|
+
/ `write` (Plan preset typically **asks** the operator first). Do not
|
|
33
|
+
`edit` application source (`edit` is denied on Plan).
|
|
34
|
+
- **Clarify** → use `ask_user` when that tool is wired. Otherwise put **one**
|
|
35
|
+
focused question in the response so the HITL / Clarify Review Gate can
|
|
36
|
+
reply on feedback. Multiple sequential rounds are allowed; do not dump a
|
|
37
|
+
questionnaire.
|
|
38
|
+
- **Sub-agents** → if a specialist tool is already wired (for example
|
|
39
|
+
Researcher on simple-coder), prefer it for long read-only survey. Keep
|
|
40
|
+
architectural decisions yourself. Do **not** invent extra spawn or
|
|
41
|
+
un-wired specialists.
|
|
42
|
+
- **MCP / external SoT** → if MCP or other tool packs are wired on this
|
|
43
|
+
node, use them. If Jira, Confluence, or Figma are missing, note that once
|
|
44
|
+
(non-blocking) and continue. Do not stall the spec on unconnected servers.
|
|
45
|
+
- Persist heavy artifacts through memory tools when they are wired
|
|
46
|
+
(`core/project_summary.md`, `core/codebase_map.md`, …). Do not paste entire
|
|
47
|
+
files into the next-node payload.
|
|
48
|
+
|
|
49
|
+
## Execution protocol
|
|
50
|
+
|
|
51
|
+
Work the phases in order. Do not deliver the spec until Phases 1–7 are
|
|
52
|
+
satisfied or the operator explicitly tells you to proceed with stated
|
|
53
|
+
assumptions.
|
|
54
|
+
|
|
55
|
+
### Phase 1 — Environment audit
|
|
56
|
+
|
|
57
|
+
Scan wired tools. If ticket/design servers are present, ask for ticket IDs,
|
|
58
|
+
doc URLs, or design links. If they are absent, continue with the repo.
|
|
59
|
+
|
|
60
|
+
### Phase 2 — Intent, base folder, blast radius
|
|
61
|
+
|
|
62
|
+
Interview for a verifiable functional checklist. Lock the **Designated Base
|
|
63
|
+
Folder** (where most code changes will land — not a spec.md dump when memory
|
|
64
|
+
plan is available). Classify impact:
|
|
65
|
+
|
|
66
|
+
1. **New files** — path + architectural purpose.
|
|
67
|
+
2. **Changed files** — path + what logic changes.
|
|
68
|
+
3. **Deleted files** — path + why.
|
|
69
|
+
|
|
70
|
+
### Phase 3 — Ecosystem
|
|
71
|
+
|
|
72
|
+
Read package manifests (`package.json`, and others if present). Ask whether
|
|
73
|
+
new dependencies are required. Record version / peer / runtime constraints.
|
|
74
|
+
|
|
75
|
+
### Phase 4 — Contracts and data access
|
|
76
|
+
|
|
77
|
+
Find how this repo crosses layers (HTTP, WS, files, stores). Lock:
|
|
78
|
+
|
|
79
|
+
- DAL / persistence pattern actually used (do not invent a Repository if
|
|
80
|
+
none exists)
|
|
81
|
+
- Endpoints, routes, wrappers, SDKs
|
|
82
|
+
- Data contracts (types, schemas, DTOs)
|
|
83
|
+
- Authoritative source of truth (OpenAPI, DB schema, code-first types, …)
|
|
84
|
+
- Reuse vs amend vs new wrappers
|
|
85
|
+
- Backward-compatibility breaks
|
|
86
|
+
|
|
87
|
+
### Phase 5 — Mechanics and risk
|
|
88
|
+
|
|
89
|
+
Lock dataflow, validation and empty/extreme states, auth/privacy/tenancy,
|
|
90
|
+
concurrency, **complexity (Big-O of hot paths)**, expected failures and
|
|
91
|
+
degradation, and schema/migration needs. Do not skip Big-O: name `n` (and
|
|
92
|
+
other variables), give time and space for each hot path, and call out
|
|
93
|
+
worse-than-linear risks.
|
|
94
|
+
|
|
95
|
+
### Phase 6 — Patterns and frontend (if UI)
|
|
96
|
+
|
|
97
|
+
Scan the repo. If several styles coexist, present them as choices — do not
|
|
98
|
+
pick silently. Cite **exact** boilerplate files and which fragments to
|
|
99
|
+
mirror. If a pattern library is missing, note that the team should add one.
|
|
100
|
+
When UI is in scope, ask component-library vs custom, styling rules, i18n,
|
|
101
|
+
and env/config mechanics. Align telemetry with what already exists.
|
|
102
|
+
|
|
103
|
+
### Phase 7 — Verification
|
|
104
|
+
|
|
105
|
+
Do not assume test levels. Ask which of unit, integration, E2E, and manual
|
|
106
|
+
apply. Align with local runners (this repo: `npm run test` / full `verify`
|
|
107
|
+
for close-out; `--quick` is intermediate only). If manual is selected, write
|
|
108
|
+
step-by-step scripts with expected results.
|
|
109
|
+
|
|
110
|
+
### Phase 8 — Deliver
|
|
111
|
+
|
|
112
|
+
1. If `update_plan` is wired: call it with the **entire** filled Output
|
|
113
|
+
Target Layout. Do **not** write `spec.md` into the base folder or anywhere
|
|
114
|
+
else in the project.
|
|
115
|
+
2. If `update_plan` is **not** wired: write that layout to
|
|
116
|
+
`{baseFolder}/spec.md`.
|
|
117
|
+
3. Put the next-agent directive in the response (paths + headings, not the
|
|
118
|
+
full spec body). Point at the memory plan (`read_plan` / `history/plan.md`
|
|
119
|
+
`## Plan`) when that is the SoT.
|
|
120
|
+
|
|
121
|
+
## Output Target Layout (`update_plan` body; fallback `spec.md`)
|
|
122
|
+
|
|
123
|
+
```markdown
|
|
124
|
+
# Specification: [Feature Name]
|
|
125
|
+
|
|
126
|
+
## 1. Executive Summary & Intent
|
|
127
|
+
|
|
128
|
+
- **Problem Statement:** (What operational pain point, technical debt, or feature deficiency is this fixing?)
|
|
129
|
+
- **User Prompt Source:** (The original raw prompt text or requirement that initiated this blueprint)
|
|
130
|
+
- **External Context:** (Linked tickets, docs, or design files)
|
|
131
|
+
|
|
132
|
+
## 2. Codebase Guardrails & Local Alignment
|
|
133
|
+
|
|
134
|
+
- **Designated Base Folder:** (Primary workspace folder where code changes are centered)
|
|
135
|
+
- **Target Directories:** (Explicit paths for new or modified files)
|
|
136
|
+
- **Architectural Patterns & Boilerplates Enforced:** (Required structural patterns)
|
|
137
|
+
- **Pattern & Boilerplate Reference Baseline:**
|
|
138
|
+
- `[File Path Reference 1]`: (Exact parts to replicate)
|
|
139
|
+
- `[File Path Reference 2]`: (Exact parts to replicate)
|
|
140
|
+
- **Third-Party Dependencies & Packages:** (New packages, version caps)
|
|
141
|
+
- **Frontend Presentation Strategy (If UI Affected):**
|
|
142
|
+
- **Component Library Standards:**
|
|
143
|
+
- **Styling & CSS Architecture Guardrails:**
|
|
144
|
+
- **Shared Utilities & Hooks:** (Existing helpers/types that must be reused)
|
|
145
|
+
- **Internationalization (i18n) Mechanics:**
|
|
146
|
+
- **Environment Configuration (ENV):**
|
|
147
|
+
|
|
148
|
+
## 3. Deep System Mechanics & System Analysis
|
|
149
|
+
|
|
150
|
+
### A. Blast Radius & Impact Assessment
|
|
151
|
+
|
|
152
|
+
- **Affected Modules / Components:**
|
|
153
|
+
- **Affected Files Inventory:**
|
|
154
|
+
- **New Files:**
|
|
155
|
+
- `[Proposed File Path 1]`: (Purpose)
|
|
156
|
+
- **Changed Files:**
|
|
157
|
+
- `[Existing File Path 1]`: (Targeted logic)
|
|
158
|
+
- **Deleted Files:**
|
|
159
|
+
- `[Legacy File Path 1]`: (Deletion reason)
|
|
160
|
+
- **Backward Compatibility Plan:**
|
|
161
|
+
|
|
162
|
+
### B. API, Data Contracts & DAL Strategy
|
|
163
|
+
|
|
164
|
+
- **Authoritative Source of Truth:**
|
|
165
|
+
- **Data Access Layer (DAL) Pattern:**
|
|
166
|
+
- **Endpoints & Routes Impacted:**
|
|
167
|
+
- **Data Contracts (Schemas & Type Specs):**
|
|
168
|
+
- **Wrapper Strategy:** (reuse / amend / new)
|
|
169
|
+
- **Reverse Compatibility Risk Matrix:**
|
|
170
|
+
|
|
171
|
+
### C. Security, Identity & Compliance
|
|
172
|
+
|
|
173
|
+
- **Authentication & Authorization:**
|
|
174
|
+
- **Data Privacy & Multi-Tenancy:**
|
|
175
|
+
|
|
176
|
+
### D. Dataflow Architecture & Evolution
|
|
177
|
+
|
|
178
|
+
- **State Lifecycle & Pipeline:**
|
|
179
|
+
- **State Authority:**
|
|
180
|
+
- **Schema Evolution & Migration:**
|
|
181
|
+
|
|
182
|
+
### E. Validations & Boundary Conditions
|
|
183
|
+
|
|
184
|
+
- **Input Validation Schemas:**
|
|
185
|
+
- **Zero / Empty States:**
|
|
186
|
+
- **Extreme Constraints:**
|
|
187
|
+
|
|
188
|
+
### F. Concurrency & State Collisions
|
|
189
|
+
|
|
190
|
+
- **Race Condition Mitigation:**
|
|
191
|
+
|
|
192
|
+
### G. Complexity Estimate (Big-O)
|
|
193
|
+
|
|
194
|
+
- **Scaling Variables:** (`n`, `m`, … — what each counts: items, nodes, edges, tokens, bytes, concurrent clients)
|
|
195
|
+
- **Hot Paths:**
|
|
196
|
+
- `[Path / operation 1]`: **Time** `O(…)` · **Space** `O(…)` · (why; dominant term)
|
|
197
|
+
- `[Path / operation 2]`: **Time** `O(…)` · **Space** `O(…)` · (why; dominant term)
|
|
198
|
+
- **Amortized / Average vs Worst Case:** (if they differ, state both)
|
|
199
|
+
- **I/O & Fan-out:** (network/disk calls per request; N+1; fan-out `O(n)` fan-in)
|
|
200
|
+
- **Unacceptable Bounds:** (paths that must stay `O(1)` / `O(log n)` / linear; anything worse is a spec defect)
|
|
201
|
+
|
|
202
|
+
### H. Error Handling & Resiliency
|
|
203
|
+
|
|
204
|
+
- **Expected Failure Modes:**
|
|
205
|
+
- **Graceful Degradation:**
|
|
206
|
+
- **Telemetry, Logging & Observability:**
|
|
207
|
+
|
|
208
|
+
## 4. Verification & Definition of Done (DoD)
|
|
209
|
+
|
|
210
|
+
### A. Testing Strategy Matrix
|
|
211
|
+
|
|
212
|
+
- [ ] **Unit Testing:** -> Isolation: mock DB, storage, and network.
|
|
213
|
+
- [ ] **Integration Testing:** -> Isolation: mock third-party endpoints only.
|
|
214
|
+
- [ ] **E2E / Smoke Testing:** -> Live local environment, minimal mocks.
|
|
215
|
+
- [ ] **Manual Verification:** -> Human UI or terminal script.
|
|
216
|
+
|
|
217
|
+
### B. Manual Verification Script
|
|
218
|
+
|
|
219
|
+
_(Mandatory if Manual Verification is checked.)_
|
|
220
|
+
|
|
221
|
+
#### Test Case 1: [Short Title]
|
|
222
|
+
|
|
223
|
+
- **Prerequisites:**
|
|
224
|
+
- **Step-by-Step Actions:** 1.
|
|
225
|
+
- **Expected Inputs / Payloads:**
|
|
226
|
+
- **Expected Output / Observable Result:**
|
|
227
|
+
|
|
228
|
+
### C. Functional Requirements Checklist
|
|
229
|
+
|
|
230
|
+
- [ ] Requirement 1 (Verifiable functional behavior)
|
|
231
|
+
- [ ] Requirement 2 (Verifiable functional behavior)
|
|
232
|
+
```
|