@lzn1998/dsh-langgraph 0.13.0 → 1.0.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # dsh-langgraph
2
2
 
3
- A DSH bundle that registers LangGraph workflows and exposes them to the agent as the
3
+ A DSH bundle that registers LangGraph graphs and exposes them to the agent as the
4
4
  `langgraph_run` and `langgraph_threads` tools. Graph nodes call the session's own DSH
5
5
  tools through `helpers.callTool`; threads are checkpointed in a DSH storage domain, so a
6
6
  run survives the turn — and the Host process — and an `interrupt()`ed graph resumes
@@ -27,8 +27,9 @@ where it stopped.
27
27
  listing; vector `query` search is rejected rather than faked. Without a storage domain
28
28
  it falls back to `InMemoryStore`; `config.store: false` passes no store at all.
29
29
  - **Model-facing guidance:** while loaded, a system-prompt section lists the registered
30
- graph ids and descriptions, so the model can choose `langgraph_run` without first listing.
31
- `config.prompt: false` disables it.
30
+ graph ids and descriptions, distinguishes `langgraph_run` from the `workflow` tool, and
31
+ tells the model to use a matching graph rather than reimplement it. `config.prompt: false`
32
+ disables it.
32
33
  - **Trajectory trace:** each run shows up as one `langgraph_run` row; its graph nodes, DSH
33
34
  tool calls, and model calls appear as nested sub-calls in **Trajectory** — `langgraph:node`,
34
35
  `langgraph:tool`, `langgraph:model`, `langgraph:subagent`. The trace uses DSH's log-only
@@ -40,11 +41,13 @@ where it stopped.
40
41
  resume or delete them. Each thread keeps at most `retention` checkpoints (default 200;
41
42
  `0` keeps every checkpoint), with their writes pruned alongside.
42
43
  - **Web panel:** in a Web profile the plugin contributes a **LangGraph** sidebar panel that
43
- lists the registered workflows, their thread counts, and the selected graph's topology
44
+ lists the registered graphs, their thread counts, and the selected graph's topology
44
45
  (nodes, edges, conditional branches). It reads two owner-only `/api/plugins/langgraph/*`
45
46
  routes; `config.ui: false` registers neither. Token-level streaming is not part of this
46
47
  panel; runs stay visible in Trajectory.
47
48
  - See `docs/DETAIL.md` for the graph module contract, trace mapping, thread semantics, and limits.
49
+ - See `docs/CONTEXT.md` for what is injected into the model context, the vocabulary, and
50
+ how it stays distinct from DSH's `workflow`, `subagent`, and question tools.
48
51
  - See `docs/ECOSYSTEM.md` for adding LangChain packages, vector stores, prebuilt agents,
49
52
  LangSmith tracing, and streaming.
50
53
 
package/client/index.tsx CHANGED
@@ -295,14 +295,14 @@ function LangGraphPanel() {
295
295
 
296
296
  const selectedGraph = ui?.graphs.find(graph => graph.id === selected)
297
297
  return (
298
- <section className="lg-panel" aria-label="LangGraph workflows">
298
+ <section className="lg-panel" aria-label="LangGraph graphs">
299
299
  <header className="lg-header">
300
300
  <div>
301
301
  <h2 className="lg-title">LangGraph</h2>
302
302
  <p className="lg-muted">
303
303
  {ui === undefined
304
- ? 'Loading workflows…'
305
- : `${ui.graphs.length} workflow${ui.graphs.length === 1 ? '' : 's'} · ${ui.threads.total} durable thread${ui.threads.total === 1 ? '' : 's'}`}
304
+ ? 'Loading graphs…'
305
+ : `${ui.graphs.length} graph${ui.graphs.length === 1 ? '' : 's'} · ${ui.threads.total} durable thread${ui.threads.total === 1 ? '' : 's'}`}
306
306
  </p>
307
307
  </div>
308
308
  <button type="button" className="lg-button" onClick={() => { void refresh() }}>Refresh</button>
@@ -328,7 +328,7 @@ function LangGraphPanel() {
328
328
  )}
329
329
  </button>
330
330
  ))}
331
- {ui !== undefined && ui.graphs.length === 0 && <p className="lg-muted">No workflows registered.</p>}
331
+ {ui !== undefined && ui.graphs.length === 0 && <p className="lg-muted">No graphs registered.</p>}
332
332
  </nav>
333
333
 
334
334
  <div className="lg-canvas">
@@ -336,7 +336,7 @@ function LangGraphPanel() {
336
336
  {busy && <p className="lg-muted">Loading topology…</p>}
337
337
  {!busy && topology !== undefined && <TopologyView topology={topology} />}
338
338
  {!busy && topology === undefined && topologyError === undefined && (
339
- <p className="lg-muted">Select a workflow to see its nodes and edges.</p>
339
+ <p className="lg-muted">Select a graph to see its nodes and edges.</p>
340
340
  )}
341
341
  </div>
342
342
  </div>
@@ -0,0 +1,102 @@
1
+ # Context and prompt design
2
+
3
+ This plugin adds one vocabulary and two tools to a DSH profile. This page records
4
+ exactly what it injects, what it deliberately does not inject, and how that layer stays
5
+ distinct from DSH's own prompt and tools.
6
+
7
+ ## What is injected
8
+
9
+ | Layer | Contribution | Lifetime |
10
+ |---|---|---|
11
+ | Tool schemas | `langgraph_run`, `langgraph_threads` | While the plugin is loaded; `config.prompt: false` does not remove them. |
12
+ | System-prompt section | `tool:langgraph`, order `TOOL_SUBAGENT - 10` | Effect-owned by the plugin; `config.prompt: false` disables it. |
13
+ | Runtime context | **none** | — |
14
+ | Session events | none from the model's point of view | Traces are log-only DSH PTC events for Trajectory. |
15
+
16
+ The section is a text function, so the model sees a short "call it to list" hint until
17
+ the asynchronous registry scan finishes, then the graph list (up to 24 ids and one-line
18
+ descriptions; input schemas stay out of the prompt). `langgraph_run` with no `graph`
19
+ always returns the full list and schemas.
20
+
21
+ ### Why no runtime context
22
+
23
+ `ctx.systemPrompt.context` materializes durable user-role snapshots. The plugin does not
24
+ use it because:
25
+
26
+ - The graph catalog is a profile-level fact, not a per-turn fact; a section is the right
27
+ layer and can be cached.
28
+ - The only genuinely dynamic facts are the calling session's threads and checkpoints.
29
+ Those are read on demand with `langgraph_threads`; injecting them every turn would
30
+ duplicate state, grow tokens, and go stale.
31
+ - `AssembleContext` carries no session identity, so a context contribution could not be
32
+ scoped to the calling session without a new DSH seam. The plugin does not invent one.
33
+
34
+ ## Vocabulary
35
+
36
+ | Term | Meaning in this plugin | Not |
37
+ |---|---|---|
38
+ | **graph** | A module registered with the profile (`id`, `description`, `input`, `build`). | The `workflow` tool's ad-hoc JavaScript script. |
39
+ | **graph run** | One execution with an input, returning a state. | A DSH turn or Session. |
40
+ | **thread** | A durable LangGraph checkpoint chain for one graph run, owned by the session and graph that created it. | A DSH Session. |
41
+ | **checkpoint** | One snapshot in a thread; `history`, `edit`, and replay address it by id. | A DSH session checkpoint. |
42
+ | **background run** | A graph run started as a DSH job; read with `job_output`, stop with `job_kill`. | A detached process. |
43
+ | **Trajectory record** | The log-only `langgraph:node` / `langgraph:tool` / `langgraph:model` sub-calls under the `langgraph_run` row. | Model-visible conversation content. |
44
+ | **store** | An optional graph-owned `BaseStore`; not a model-facing facility by itself. | A reason to call `langgraph_run`. |
45
+
46
+ ## Trigger policy
47
+
48
+ The section states one policy, in the same words the model sees:
49
+
50
+ 1. **Name** — the user names one of the registered graph ids.
51
+ 2. **Match** — a graph's description matches the **requested output**, not merely the
52
+ same files or tools. `scan-report` matches “is this a lot?”; an exact file count is a
53
+ glob/bash task, so the graph is not a match even though it also counts.
54
+ 3. **Property** — the task needs a durable thread, a background run (DSH job),
55
+ checkpoint history or replay, a Trajectory sub-call record, or a graph that interrupts.
56
+
57
+ It also says what *not* to do: when no graph's output matches, use ordinary DSH tools;
58
+ do not wrap a single tool call in a graph for ceremony, and do not reimplement a matching
59
+ graph with `bash`, `subagent`, or ad-hoc steps. This keeps graph
60
+ use from becoming ceremony while still letting a matching graph win over a hand-rolled
61
+ sequence.
62
+
63
+ The tool description covers mechanics (arguments, thread/resume/checkpoint, background
64
+ job), not selection; the section covers selection, not mechanics. This split is the main
65
+ rule for future edits.
66
+
67
+ ## Boundaries with DSH's own context
68
+
69
+ | DSH facility | Boundary |
70
+ |---|---|
71
+ | `workflow` tool | `workflow` writes an ad-hoc JavaScript fan-out script; `langgraph_run` runs a profile-registered, named graph with a durable thread. The section sits **after** the workflow tool's "only when the user asks" rule and **before** subagent guidance (`TOOL_SUBAGENT - 10`), so that rule cannot read as part of this section. |
72
+ | `subagent` | One-off delegation stays `subagent`; a graph may delegate internally, and `helpers.subagent` creates a normal DSH child. |
73
+ | `ask_user_question` | The native question tool is the default for one question; the `ask-user` graph only adds value when a graph or thread is wanted. |
74
+ | `job_output` / `job_kill` | A background graph run is a DSH job; use the stock job tools. |
75
+ | DSH Session | A LangGraph thread is not a Session; the prompt and tool schema say so explicitly. |
76
+ | Trajectory | Graph activity appears as nested log-only sub-calls; it is not injected into model context. |
77
+ | Goals, schedules | Out of scope; the plugin does not create either. |
78
+
79
+ ## Placement
80
+
81
+ - Order: `ctx.systemPrompt.getSectionOrder('TOOL_SUBAGENT') - 10`, fallback `2790`.
82
+ The earlier `TOOL_WORKFLOW` (2600) placement put the section between two copies of the
83
+ workflow tool's "ONLY when..." guidance and made the two "workflow" instructions read
84
+ as one.
85
+ - The section is global to the profile while the plugin is active, including agents whose
86
+ tool policy hides `langgraph_run`; `config.prompt: false` is the escape hatch.
87
+ - Registry entries are sorted by id; broken modules are skipped from the list.
88
+
89
+ ## Maintenance checklist
90
+
91
+ When changing this layer:
92
+
93
+ 1. Keep the words **graph**, **thread**, **checkpoint**, and **DSH job** consistent in the
94
+ prompt, tool descriptions, error messages, UI, and docs.
95
+ 2. Do not use "workflow" as a synonym for a graph; it belongs only in the explicit
96
+ distinction from the `workflow` tool.
97
+ 3. Add a trigger only if it is a property the plugin actually provides; do not advertise
98
+ long-term memory unless a graph uses the store.
99
+ 4. Keep the section about selection and the tool descriptions about mechanics.
100
+ 5. Keep graph descriptions one line, unique, and specific about the graph's value; avoid
101
+ demo overlap.
102
+ 6. Re-check section order when a DSH release adds or renames prompt sections.
package/docs/DETAIL.md CHANGED
@@ -1,4 +1,4 @@
1
- # LangGraph workflows
1
+ # LangGraph graphs
2
2
 
3
3
  Run a LangGraph graph from inside a DSH agent session, and continue it later.
4
4
 
@@ -47,11 +47,20 @@ Run a LangGraph graph from inside a DSH agent session, and continue it later.
47
47
  ## Model-facing guidance
48
48
 
49
49
  While the plugin is active it registers a system-prompt section through DSH's public
50
- `ctx.systemPrompt.section` API — no DSH source change. The section names `langgraph_run`,
51
- says when to prefer it, and lists the registered graph ids with their one-line descriptions
52
- (up to 24; input schemas stay out of the prompt). The model therefore knows what exists
53
- without spending a discovery call; `langgraph_run` with no `graph` still returns the full
54
- list and input schemas.
50
+ `ctx.systemPrompt.section` API — no DSH source change. The section defines the vocabulary
51
+ (profile-registered graphs, not the `workflow` tool), the trigger policy (a named graph,
52
+ a description match, or a graph-specific need such as a durable thread, background job,
53
+ interrupt/resume, checkpoint replay, or Trajectory sub-calls), and the registry (up to 24
54
+ ids and descriptions; input schemas stay out of the prompt). The model therefore knows
55
+ what exists without spending a discovery call; `langgraph_run` with no `graph` still
56
+ returns the full list and input schemas.
57
+
58
+ - The section sits just before the subagent guidance, after the `workflow` tool's
59
+ "only when the user asks" rule. An earlier placement at `TOOL_WORKFLOW` made the two
60
+ "workflow" instructions read as one.
61
+ - Apart from the section and the two tool schemas, the plugin injects no runtime context;
62
+ per-session thread facts are read on demand with `langgraph_threads`. See
63
+ [CONTEXT.md](CONTEXT.md) for the mapping and the maintenance rules.
55
64
 
56
65
  - The registry is scanned when the plugin activates, so graph modules should keep top-level
57
66
  code side-effect free.
@@ -299,8 +308,8 @@ const ship = answers.find(answer => answer.id === 'ship')
299
308
  ## Writing a graph (TypeScript or JavaScript)
300
309
 
301
310
  ```ts
302
- export const id = 'my-workflow'
303
- export const description = 'One line the agent sees when it lists workflows.'
311
+ export const id = 'my-graph'
312
+ export const description = 'One line the agent sees when it lists graphs.'
304
313
  export const input = {
305
314
  type: 'object',
306
315
  properties: { pattern: { type: 'string', description: 'Glob to scan.' } },
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Example workflow that pauses for a decision before doing any work.
2
+ * Example graph that pauses for a decision before doing any work.
3
3
  *
4
4
  * The gate node calls LangGraph's `interrupt(...)`: the run stops, the agent sees
5
5
  * `status: "interrupted"` with the question, and `langgraph_run({ graph, thread,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Example ReAct workflow: LangGraph's prebuilt agent driving DSH tools with this
2
+ * Example ReAct graph: LangGraph's prebuilt agent driving DSH tools with this
3
3
  * deployment's model.
4
4
  *
5
5
  * This is the "LangGraph in DSH" case end to end: the graph is LangGraph's own
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Example workflow that mixes DSH tool calls with a model call inside one graph.
2
+ * Example graph that mixes DSH tool calls with a model call inside one graph.
3
3
  *
4
4
  * `scan` reads the workspace through the DSH `glob` tool; `answer` asks the
5
5
  * deployment's model to explain the result. The graph owns the control flow, DSH
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Example LangGraph workflow shipped with the plugin.
2
+ * Example LangGraph graph shipped with the plugin.
3
3
  *
4
4
  * It demonstrates the two things this plugin adds to LangGraph inside DSH:
5
5
  * - a graph is registered by id and run from the agent's `langgraph_run` tool;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * LangGraph workflows as DSH tools, with durable threads.
2
+ * LangGraph graphs as DSH tools, with durable threads.
3
3
  *
4
4
  * A graph module exports `id`, an optional `description`, an optional `input` JSON
5
5
  * Schema for its initial state, and `build(api)` where `api` carries the LangGraph API
@@ -134,15 +134,16 @@ function describeInput(entry) {
134
134
  * @returns {string} section text.
135
135
  */
136
136
  export function renderGraphPrompt(registry, ready) {
137
- const intro = 'LangGraph workflows are available through the `langgraph_run` tool.'
137
+ const intro = 'LangGraph graphs are profile-registered, named graphs run by `langgraph_run`. '
138
+ + 'They are not the `workflow` tool (`workflow` runs an ad-hoc JavaScript fan-out script).'
138
139
  if (!ready) {
139
- return `${intro} Call it with no \`graph\` to list the registered workflows and their input schemas.`
140
+ return `${intro} Call it with no \`graph\` to list the registered graphs and their input schemas.`
140
141
  }
141
142
  const available = [...registry.values()]
142
143
  .filter(entry => entry.error === undefined)
143
144
  .sort((left, right) => left.id.localeCompare(right.id))
144
145
  if (available.length === 0) {
145
- return `${intro}\n\nNo workflow is registered yet; call it with no \`graph\` to re-check.`
146
+ return `${intro}\n\nNo graph is registered yet; call it with no \`graph\` to re-check.`
146
147
  }
147
148
  const limit = 24
148
149
  const lines = available.slice(0, limit).map(entry => {
@@ -154,11 +155,18 @@ export function renderGraphPrompt(registry, ready) {
154
155
  }
155
156
  return [
156
157
  intro,
157
- 'Use it when a task benefits from durable multi-step execution, background runs, '
158
- + 'interrupts/resume, or traced node/tool/model activity. '
159
- + 'Use `langgraph_threads` to list, inspect, or delete durable threads.',
160
- `Registered workflows:\n${lines.join('\n')}`,
161
- 'Omit `graph` to see each workflow\'s input schema.',
158
+ 'Use `langgraph_run` when:\n'
159
+ + '- the user names one of the graph ids below;\n'
160
+ + '- a registered graph\'s description matches the requested output; use that graph instead of '
161
+ + 'hand-rolling its steps with bash, subagent, or ad-hoc calls;\n'
162
+ + '- the task needs a durable LangGraph thread, a background run (a DSH job), checkpoint '
163
+ + 'history or replay, a Trajectory sub-call record, or the graph description says it interrupts.',
164
+ 'When no graph\'s output matches, use ordinary DSH tools; do not wrap a single tool call in a graph '
165
+ + 'just for ceremony, and do not use the `workflow` tool as a substitute for a named graph.',
166
+ 'A LangGraph thread is a durable checkpoint chain for one graph run, not a DSH Session. '
167
+ + 'Use `langgraph_threads` to list, inspect, time-travel, or delete threads, or read a graph\'s topology.',
168
+ `Registered graphs:\n${lines.join('\n')}`,
169
+ 'Omit `graph` to list input schemas.',
162
170
  ].join('\n\n')
163
171
  }
164
172
 
@@ -677,7 +685,7 @@ export function apply(ctx, config) {
677
685
  // --- tools --------------------------------------------------------------------
678
686
  async function describeGraphs() {
679
687
  await scan()
680
- if (registry.size === 0) return 'No LangGraph workflow is registered.'
688
+ if (registry.size === 0) return 'No LangGraph graph is registered.'
681
689
  const lines = [...registry.values()]
682
690
  .sort((left, right) => left.id.localeCompare(right.id))
683
691
  .map(entry => {
@@ -1165,39 +1173,43 @@ export function apply(ctx, config) {
1165
1173
  void scan().then(() => { scannedReady = true }).catch(error => {
1166
1174
  ctx.logger?.warn(`langgraph: graph scan failed: ${error?.message ?? error}`)
1167
1175
  })
1168
- let order = 2600
1176
+ // Sit after the `workflow` tool's "only when the user asks" rule and just
1177
+ // before subagent guidance. The old TOOL_WORKFLOW slot put this section
1178
+ // next to a second "workflow" rule, which read as one instruction.
1179
+ let order = 2790
1169
1180
  try {
1170
1181
  if (typeof systemPrompt.getSectionOrder === 'function') {
1171
- order = systemPrompt.getSectionOrder('TOOL_WORKFLOW')
1182
+ order = systemPrompt.getSectionOrder('TOOL_SUBAGENT') - 10
1172
1183
  }
1173
1184
  } catch {
1174
- // A future DSH may rename the order; 2600 is the tool-guidance band.
1185
+ // A future DSH may rename the order; 2790 is just before subagents.
1175
1186
  }
1176
1187
  ctx.effect(() => systemPrompt.section({
1177
1188
  name: 'tool:langgraph',
1178
1189
  order,
1179
1190
  text: () => renderGraphPrompt(registry, scannedReady),
1180
- retirement: 'The langgraph_run workflow guidance no longer applies.',
1191
+ retirement: 'The langgraph_run graph guidance no longer applies.',
1181
1192
  }), 'langgraph: prompt section')
1182
1193
  }
1183
1194
  }
1184
1195
 
1185
1196
  ctx.effect(() => ctx.tools.register({
1186
1197
  name: RUN_TOOL,
1187
- description: 'Run a registered LangGraph workflow. Workflows coordinate work in this workspace: '
1188
- + 'their nodes call the same tools you have, in this session and sandbox. Omit `graph` to list them '
1189
- + 'with their input schemas. Threads are durable: pass `thread` to continue one, and `resume` to answer '
1190
- + 'an interrupted graph. Set `run_in_background` to return a job id immediately; read it with '
1191
- + 'job_output and stop it with job_kill.',
1198
+ description: 'Run one registered LangGraph graph by id. Use it when the user names a graph, a graph\'s '
1199
+ + 'description matches the requested output, or the task needs a durable thread, background job, '
1200
+ + 'checkpoint replay, or Trajectory record; it is not the `workflow` tool. Omit `graph` to list graphs '
1201
+ + 'and input schemas. Threads are durable LangGraph checkpoint chains (not DSH Sessions): pass `thread` '
1202
+ + 'to continue one, `resume` to answer an interrupt, and `checkpoint` to replay a snapshot from '
1203
+ + '`langgraph_threads` history. `run_in_background` returns a DSH job id for `job_output`/`job_kill`.',
1192
1204
  parameters: {
1193
1205
  type: 'object',
1194
1206
  properties: {
1195
- graph: { type: 'string', description: 'Graph id. Omit to list the registered graphs.' },
1207
+ graph: { type: 'string', description: 'Registered graph id; omit to list graphs and input schemas.' },
1196
1208
  input: { type: 'object', description: 'Initial graph state, as a JSON object.', additionalProperties: true },
1197
- thread: { type: 'string', description: 'Thread to continue. Omit to start a new durable thread.' },
1209
+ thread: { type: 'string', description: 'LangGraph thread to continue; omit to start a new durable thread. Not a DSH Session id.' },
1198
1210
  checkpoint: {
1199
1211
  type: 'string',
1200
- description: 'Checkpoint id to replay from. Requires `thread`; list them with langgraph_threads action "history".',
1212
+ description: 'Checkpoint id to replay from (langgraph_threads action "history"); requires `thread`.',
1201
1213
  },
1202
1214
  resume: { description: 'Value handed to an interrupted graph, resuming it where it stopped.' },
1203
1215
  maxSteps: { type: 'integer', description: 'Upper bound on graph supersteps for this run.' },
@@ -1224,16 +1236,16 @@ export function apply(ctx, config) {
1224
1236
 
1225
1237
  ctx.effect(() => ctx.tools.register({
1226
1238
  name: THREADS_TOOL,
1227
- description: 'List, inspect, time-travel, or delete durable LangGraph threads, or read a graph\'s topology. '
1228
- + 'Threads of this session are listed by default; `state` shows a thread\'s values and what it waits on; '
1229
- + '`history` lists checkpoints; `edit` forks a checkpoint with new values, then replay it with '
1230
- + 'langgraph_run({ checkpoint }); `topology` returns a graph\'s nodes and edges.',
1239
+ description: 'Manage durable LangGraph threads and a graph\'s topology. `list` (this session by default), '
1240
+ + '`state` (values, next, interrupts), `history` (checkpoint ids), `edit` (fork a checkpoint with new '
1241
+ + 'values), `topology` (nodes/edges), or `delete`. A thread is a LangGraph checkpoint chain, not a '
1242
+ + 'DSH Session. Replay an edit with `langgraph_run({ checkpoint })`.',
1231
1243
  parameters: {
1232
1244
  type: 'object',
1233
1245
  properties: {
1234
1246
  action: { type: 'string', enum: ['list', 'state', 'history', 'edit', 'topology', 'delete'], description: 'Defaults to list.' },
1235
- graph: { type: 'string', description: 'Graph id; required by state, history, and edit.' },
1236
- thread: { type: 'string', description: 'Thread id; required by state, history, edit, and delete.' },
1247
+ graph: { type: 'string', description: 'Graph id; required by state, history, edit, and topology.' },
1248
+ thread: { type: 'string', description: 'LangGraph thread id; required by state, history, edit, and delete. Not a DSH Session id.' },
1237
1249
  checkpoint: { type: 'string', description: 'Checkpoint id for state, edit, or replay; defaults to the thread head.' },
1238
1250
  values: { type: 'object', description: 'State fields to write in an edit, as a JSON object.', additionalProperties: true },
1239
1251
  asNode: { type: 'string', description: 'Attribute an edit to this node, when the graph needs one.' },
package/lib/client.js CHANGED
@@ -206,9 +206,9 @@ window.__ModuleLoader__.load({
206
206
  return () => { live = false; };
207
207
  }, [selected]);
208
208
  const selectedGraph = ui?.graphs.find(graph => graph.id === selected);
209
- return ((0, jsx_runtime_1.jsxs)("section", { className: "lg-panel", "aria-label": "LangGraph workflows", children: [(0, jsx_runtime_1.jsxs)("header", { className: "lg-header", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h2", { className: "lg-title", children: "LangGraph" }), (0, jsx_runtime_1.jsx)("p", { className: "lg-muted", children: ui === undefined
210
- ? 'Loading workflows…'
211
- : `${ui.graphs.length} workflow${ui.graphs.length === 1 ? '' : 's'} · ${ui.threads.total} durable thread${ui.threads.total === 1 ? '' : 's'}` })] }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "lg-button", onClick: () => { void refresh(); }, children: "Refresh" })] }), uiError !== undefined && (0, jsx_runtime_1.jsx)("p", { className: "lg-error", children: uiError }), (0, jsx_runtime_1.jsxs)("div", { className: "lg-grid", children: [(0, jsx_runtime_1.jsxs)("nav", { className: "lg-list", "aria-label": "Registered graphs", children: [(ui?.graphs ?? []).map(graph => ((0, jsx_runtime_1.jsxs)("button", { type: "button", className: graph.id === selected ? 'lg-item lg-item-active' : 'lg-item', onClick: () => setSelected(graph.id), children: [(0, jsx_runtime_1.jsx)("span", { className: "lg-item-id", children: graph.id }), (0, jsx_runtime_1.jsx)("span", { className: "lg-item-meta", children: graph.error ?? `${ui?.threads.byGraph[graph.id] ?? 0} thread${(ui?.threads.byGraph[graph.id] ?? 0) === 1 ? '' : 's'}` }), graph.error === undefined && graph.description !== undefined && ((0, jsx_runtime_1.jsx)("span", { className: "lg-item-desc", children: graph.description }))] }, graph.id))), ui !== undefined && ui.graphs.length === 0 && (0, jsx_runtime_1.jsx)("p", { className: "lg-muted", children: "No workflows registered." })] }), (0, jsx_runtime_1.jsxs)("div", { className: "lg-canvas", children: [topologyError !== undefined && (0, jsx_runtime_1.jsx)("p", { className: "lg-error", children: topologyError }), busy && (0, jsx_runtime_1.jsx)("p", { className: "lg-muted", children: "Loading topology\u2026" }), !busy && topology !== undefined && (0, jsx_runtime_1.jsx)(TopologyView, { topology: topology }), !busy && topology === undefined && topologyError === undefined && ((0, jsx_runtime_1.jsx)("p", { className: "lg-muted", children: "Select a workflow to see its nodes and edges." }))] })] }), (0, jsx_runtime_1.jsx)("footer", { className: "lg-footer", children: selectedGraph?.description ?? 'Runs appear as langgraph_run rows in Trajectory.' })] }));
209
+ return ((0, jsx_runtime_1.jsxs)("section", { className: "lg-panel", "aria-label": "LangGraph graphs", children: [(0, jsx_runtime_1.jsxs)("header", { className: "lg-header", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h2", { className: "lg-title", children: "LangGraph" }), (0, jsx_runtime_1.jsx)("p", { className: "lg-muted", children: ui === undefined
210
+ ? 'Loading graphs…'
211
+ : `${ui.graphs.length} graph${ui.graphs.length === 1 ? '' : 's'} · ${ui.threads.total} durable thread${ui.threads.total === 1 ? '' : 's'}` })] }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "lg-button", onClick: () => { void refresh(); }, children: "Refresh" })] }), uiError !== undefined && (0, jsx_runtime_1.jsx)("p", { className: "lg-error", children: uiError }), (0, jsx_runtime_1.jsxs)("div", { className: "lg-grid", children: [(0, jsx_runtime_1.jsxs)("nav", { className: "lg-list", "aria-label": "Registered graphs", children: [(ui?.graphs ?? []).map(graph => ((0, jsx_runtime_1.jsxs)("button", { type: "button", className: graph.id === selected ? 'lg-item lg-item-active' : 'lg-item', onClick: () => setSelected(graph.id), children: [(0, jsx_runtime_1.jsx)("span", { className: "lg-item-id", children: graph.id }), (0, jsx_runtime_1.jsx)("span", { className: "lg-item-meta", children: graph.error ?? `${ui?.threads.byGraph[graph.id] ?? 0} thread${(ui?.threads.byGraph[graph.id] ?? 0) === 1 ? '' : 's'}` }), graph.error === undefined && graph.description !== undefined && ((0, jsx_runtime_1.jsx)("span", { className: "lg-item-desc", children: graph.description }))] }, graph.id))), ui !== undefined && ui.graphs.length === 0 && (0, jsx_runtime_1.jsx)("p", { className: "lg-muted", children: "No graphs registered." })] }), (0, jsx_runtime_1.jsxs)("div", { className: "lg-canvas", children: [topologyError !== undefined && (0, jsx_runtime_1.jsx)("p", { className: "lg-error", children: topologyError }), busy && (0, jsx_runtime_1.jsx)("p", { className: "lg-muted", children: "Loading topology\u2026" }), !busy && topology !== undefined && (0, jsx_runtime_1.jsx)(TopologyView, { topology: topology }), !busy && topology === undefined && topologyError === undefined && ((0, jsx_runtime_1.jsx)("p", { className: "lg-muted", children: "Select a graph to see its nodes and edges." }))] })] }), (0, jsx_runtime_1.jsx)("footer", { className: "lg-footer", children: selectedGraph?.description ?? 'Runs appear as langgraph_run rows in Trajectory.' })] }));
212
212
  }
213
213
  /** Sidebar launcher icon: one node feeding two others. */
214
214
  function LangGraphIcon() {
package/locale/en.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "meta": {
3
- "title": "LangGraph workflows",
4
- "description": "Registers LangGraph graphs as durable workflows an agent runs with the langgraph_run tool. Registered graphs are listed in the system prompt, nodes call this session's own tools in its sandbox, can ask the user through the native question UI, run as background jobs or delegate to DSH subagents, every node/tool/model call is traced in Trajectory, threads and long-term memory survive restarts, an interrupted graph resumes where it stopped, and a Web sidebar panel lists the workflows and draws their topology.",
3
+ "title": "LangGraph graphs",
4
+ "description": "Registers LangGraph graphs as durable DSH tools an agent runs with the langgraph_run tool. Registered graphs are listed in the system prompt, nodes call this session's own tools in its sandbox, can ask the user through the native question UI, run as background jobs or delegate to DSH subagents, every node/tool/model call is traced in Trajectory, threads and long-term memory survive restarts, an interrupted graph resumes where it stopped, and a Web sidebar panel lists the graphs and draws their topology.",
5
5
  "detail": "docs/DETAIL.md"
6
6
  }
7
7
  }
package/locale/zh.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "meta": {
3
- "title": "LangGraph 工作流",
4
- "description": "把 LangGraph 图注册成可持久化的流程,agent 通过 langgraph_run 工具运行。已注册的图会列在 system prompt 里,图里的节点调用本会话自己的工具、在同一个沙箱执行,可通过原生提问 UI 询问用户,可后台运行,也可派发 DSH 子 agent;节点/工具/模型动作在 Trajectory 里逐层可见;线程和长期记忆跨重启保留,被 interrupt 暂停的图可以从原处继续;Web 侧边栏面板会列出工作流并绘制拓扑。",
3
+ "title": "LangGraph 图",
4
+ "description": "把 LangGraph 图注册成可持久化的 DSH 工具,agent 通过 langgraph_run 工具运行。已注册的图会列在 system prompt 里,图里的节点调用本会话自己的工具、在同一个沙箱执行,可通过原生提问 UI 询问用户,可后台运行,也可派发 DSH 子 agent;节点/工具/模型动作在 Trajectory 里逐层可见;线程和长期记忆跨重启保留,被 interrupt 暂停的图可以从原处继续;Web 侧边栏面板会列出图并绘制拓扑。",
5
5
  "detail": "docs/DETAIL.md"
6
6
  }
7
7
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@lzn1998/dsh-langgraph",
3
- "version": "0.13.0",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
- "description": "Durable LangGraph workflows as DSH tools: register TS/JS graphs, advertise them in the system prompt, run, resume and time-travel them, give them durable long-term memory, ask the user in the native question UI, run them as background jobs, delegate to DSH subagents, trace every node/tool/model call in Trajectory, draw their topology in a Web panel, and let graph nodes call this session's own tools.",
5
+ "description": "Durable LangGraph graphs as DSH tools: register TS/JS graphs, advertise them in the system prompt, run, resume and time-travel them, give them durable long-term memory, ask the user in the native question UI, run them as background jobs, delegate to DSH subagents, trace every node/tool/model call in Trajectory, draw their topology in a Web panel, and let graph nodes call this session's own tools.",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/lznnnnn1998/DSH-LangGraph.git"