@nanobpm/nano-agent-graph-engine 0.0.0-stage → 0.18.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 (270) hide show
  1. package/.claude-plugin/marketplace.json +20 -0
  2. package/.claude-plugin/plugin.json +21 -0
  3. package/.mcp.json +8 -0
  4. package/README.md +526 -2
  5. package/dist/cli.js +55833 -0
  6. package/dist/explorer-app.html +196 -0
  7. package/dist/explorer.html +196 -0
  8. package/dist/guide.md +147 -0
  9. package/dist/index.js +1262 -0
  10. package/dist/layout-thread.js +12857 -0
  11. package/dist/nanobpmn_engine_bg.wasm +0 -0
  12. package/dist/step-thread.js +55 -0
  13. package/dist/typecheck/agent-graph-engine/agents.d.ts +120 -0
  14. package/dist/typecheck/agent-graph-engine/index.d.ts +124 -0
  15. package/dist/typecheck/agent-graph-engine/input.d.ts +57 -0
  16. package/dist/typecheck/agent-graph-engine/paths.d.ts +35 -0
  17. package/dist/typecheck/lib.decorators.d.ts +384 -0
  18. package/dist/typecheck/lib.decorators.legacy.d.ts +22 -0
  19. package/dist/typecheck/lib.es2015.collection.d.ts +147 -0
  20. package/dist/typecheck/lib.es2015.core.d.ts +597 -0
  21. package/dist/typecheck/lib.es2015.d.ts +28 -0
  22. package/dist/typecheck/lib.es2015.generator.d.ts +77 -0
  23. package/dist/typecheck/lib.es2015.iterable.d.ts +605 -0
  24. package/dist/typecheck/lib.es2015.promise.d.ts +81 -0
  25. package/dist/typecheck/lib.es2015.proxy.d.ts +128 -0
  26. package/dist/typecheck/lib.es2015.reflect.d.ts +144 -0
  27. package/dist/typecheck/lib.es2015.symbol.d.ts +46 -0
  28. package/dist/typecheck/lib.es2015.symbol.wellknown.d.ts +326 -0
  29. package/dist/typecheck/lib.es2016.array.include.d.ts +116 -0
  30. package/dist/typecheck/lib.es2016.d.ts +21 -0
  31. package/dist/typecheck/lib.es2016.full.d.ts +23 -0
  32. package/dist/typecheck/lib.es2016.intl.d.ts +31 -0
  33. package/dist/typecheck/lib.es2017.arraybuffer.d.ts +21 -0
  34. package/dist/typecheck/lib.es2017.d.ts +26 -0
  35. package/dist/typecheck/lib.es2017.date.d.ts +31 -0
  36. package/dist/typecheck/lib.es2017.full.d.ts +23 -0
  37. package/dist/typecheck/lib.es2017.intl.d.ts +44 -0
  38. package/dist/typecheck/lib.es2017.object.d.ts +49 -0
  39. package/dist/typecheck/lib.es2017.sharedmemory.d.ts +135 -0
  40. package/dist/typecheck/lib.es2017.string.d.ts +45 -0
  41. package/dist/typecheck/lib.es2017.typedarrays.d.ts +53 -0
  42. package/dist/typecheck/lib.es2018.asyncgenerator.d.ts +77 -0
  43. package/dist/typecheck/lib.es2018.asynciterable.d.ts +53 -0
  44. package/dist/typecheck/lib.es2018.d.ts +24 -0
  45. package/dist/typecheck/lib.es2018.full.d.ts +24 -0
  46. package/dist/typecheck/lib.es2018.intl.d.ts +83 -0
  47. package/dist/typecheck/lib.es2018.promise.d.ts +30 -0
  48. package/dist/typecheck/lib.es2018.regexp.d.ts +37 -0
  49. package/dist/typecheck/lib.es2019.array.d.ts +79 -0
  50. package/dist/typecheck/lib.es2019.d.ts +24 -0
  51. package/dist/typecheck/lib.es2019.full.d.ts +24 -0
  52. package/dist/typecheck/lib.es2019.intl.d.ts +23 -0
  53. package/dist/typecheck/lib.es2019.object.d.ts +33 -0
  54. package/dist/typecheck/lib.es2019.string.d.ts +37 -0
  55. package/dist/typecheck/lib.es2019.symbol.d.ts +24 -0
  56. package/dist/typecheck/lib.es2020.bigint.d.ts +765 -0
  57. package/dist/typecheck/lib.es2020.d.ts +27 -0
  58. package/dist/typecheck/lib.es2020.date.d.ts +42 -0
  59. package/dist/typecheck/lib.es2020.full.d.ts +24 -0
  60. package/dist/typecheck/lib.es2020.intl.d.ts +474 -0
  61. package/dist/typecheck/lib.es2020.number.d.ts +28 -0
  62. package/dist/typecheck/lib.es2020.promise.d.ts +47 -0
  63. package/dist/typecheck/lib.es2020.sharedmemory.d.ts +99 -0
  64. package/dist/typecheck/lib.es2020.string.d.ts +44 -0
  65. package/dist/typecheck/lib.es2020.symbol.wellknown.d.ts +41 -0
  66. package/dist/typecheck/lib.es2021.d.ts +23 -0
  67. package/dist/typecheck/lib.es2021.full.d.ts +24 -0
  68. package/dist/typecheck/lib.es2021.intl.d.ts +166 -0
  69. package/dist/typecheck/lib.es2021.promise.d.ts +48 -0
  70. package/dist/typecheck/lib.es2021.string.d.ts +33 -0
  71. package/dist/typecheck/lib.es2021.weakref.d.ts +78 -0
  72. package/dist/typecheck/lib.es2022.array.d.ts +121 -0
  73. package/dist/typecheck/lib.es2022.d.ts +25 -0
  74. package/dist/typecheck/lib.es2022.error.d.ts +75 -0
  75. package/dist/typecheck/lib.es2022.full.d.ts +24 -0
  76. package/dist/typecheck/lib.es2022.intl.d.ts +145 -0
  77. package/dist/typecheck/lib.es2022.object.d.ts +26 -0
  78. package/dist/typecheck/lib.es2022.regexp.d.ts +39 -0
  79. package/dist/typecheck/lib.es2022.string.d.ts +25 -0
  80. package/dist/typecheck/lib.es2023.array.d.ts +924 -0
  81. package/dist/typecheck/lib.es2023.collection.d.ts +21 -0
  82. package/dist/typecheck/lib.es2023.d.ts +22 -0
  83. package/dist/typecheck/lib.es2023.full.d.ts +24 -0
  84. package/dist/typecheck/lib.es2023.intl.d.ts +56 -0
  85. package/dist/typecheck/lib.es2024.arraybuffer.d.ts +65 -0
  86. package/dist/typecheck/lib.es2024.collection.d.ts +29 -0
  87. package/dist/typecheck/lib.es2024.d.ts +26 -0
  88. package/dist/typecheck/lib.es2024.full.d.ts +24 -0
  89. package/dist/typecheck/lib.es2024.object.d.ts +29 -0
  90. package/dist/typecheck/lib.es2024.promise.d.ts +35 -0
  91. package/dist/typecheck/lib.es2024.regexp.d.ts +25 -0
  92. package/dist/typecheck/lib.es2024.sharedmemory.d.ts +68 -0
  93. package/dist/typecheck/lib.es2024.string.d.ts +29 -0
  94. package/dist/typecheck/lib.es5.d.ts +4601 -0
  95. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/client.d.ts +169 -0
  96. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/declarative.d.ts +365 -0
  97. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/envelope.d.ts +77 -0
  98. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/imperative.d.ts +32 -0
  99. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/index.d.ts +14 -0
  100. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/io-mapping.d.ts +32 -0
  101. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/layout.d.ts +35 -0
  102. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/nodes/boundary.d.ts +63 -0
  103. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/nodes/branch.d.ts +11 -0
  104. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/nodes/break.d.ts +8 -0
  105. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/nodes/continue.d.ts +8 -0
  106. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/nodes/end.d.ts +40 -0
  107. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/nodes/forEach.d.ts +37 -0
  108. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/nodes/human.d.ts +44 -0
  109. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/nodes/index.d.ts +15 -0
  110. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/nodes/loop.d.ts +9 -0
  111. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/nodes/parallel.d.ts +9 -0
  112. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/nodes/race.d.ts +54 -0
  113. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/nodes/registry.d.ts +33 -0
  114. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/nodes/run.d.ts +12 -0
  115. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/nodes/signal.d.ts +11 -0
  116. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/nodes/switch.d.ts +11 -0
  117. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/nodes/task.d.ts +82 -0
  118. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/nodes/timer.d.ts +9 -0
  119. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/test-support/diff.d.ts +8 -0
  120. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/test-support/index.d.ts +8 -0
  121. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/test-support/normalize.d.ts +19 -0
  122. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/test-support/parity.d.ts +28 -0
  123. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/test-support/xml.d.ts +17 -0
  124. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/types.d.ts +146 -0
  125. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/worker.d.ts +92 -0
  126. package/dist/typecheck/node_modules/@nanobpm/workflow/dist/xml.d.ts +14 -0
  127. package/dist/typecheck/node_modules/@nanobpm/workflow/package.json +65 -0
  128. package/dist/typecheck/node_modules/@nanobpm/workflow/src/bpmn-auto-layout.d.ts +10 -0
  129. package/dist/typecheck/node_modules/@types/node/assert/strict.d.ts +68 -0
  130. package/dist/typecheck/node_modules/@types/node/assert.d.ts +1077 -0
  131. package/dist/typecheck/node_modules/@types/node/async_hooks.d.ts +711 -0
  132. package/dist/typecheck/node_modules/@types/node/buffer.buffer.d.ts +471 -0
  133. package/dist/typecheck/node_modules/@types/node/buffer.d.ts +1800 -0
  134. package/dist/typecheck/node_modules/@types/node/child_process.d.ts +1361 -0
  135. package/dist/typecheck/node_modules/@types/node/cluster.d.ts +432 -0
  136. package/dist/typecheck/node_modules/@types/node/console.d.ts +93 -0
  137. package/dist/typecheck/node_modules/@types/node/constants.d.ts +14 -0
  138. package/dist/typecheck/node_modules/@types/node/crypto.d.ts +3964 -0
  139. package/dist/typecheck/node_modules/@types/node/dgram.d.ts +652 -0
  140. package/dist/typecheck/node_modules/@types/node/diagnostics_channel.d.ts +794 -0
  141. package/dist/typecheck/node_modules/@types/node/dns/promises.d.ts +497 -0
  142. package/dist/typecheck/node_modules/@types/node/dns.d.ts +876 -0
  143. package/dist/typecheck/node_modules/@types/node/domain.d.ts +150 -0
  144. package/dist/typecheck/node_modules/@types/node/events.d.ts +1008 -0
  145. package/dist/typecheck/node_modules/@types/node/ffi.d.ts +500 -0
  146. package/dist/typecheck/node_modules/@types/node/fs/promises.d.ts +1477 -0
  147. package/dist/typecheck/node_modules/@types/node/fs.d.ts +4803 -0
  148. package/dist/typecheck/node_modules/@types/node/globals.d.ts +150 -0
  149. package/dist/typecheck/node_modules/@types/node/globals.typedarray.d.ts +101 -0
  150. package/dist/typecheck/node_modules/@types/node/http.d.ts +2218 -0
  151. package/dist/typecheck/node_modules/@types/node/http2.d.ts +2498 -0
  152. package/dist/typecheck/node_modules/@types/node/https.d.ts +400 -0
  153. package/dist/typecheck/node_modules/@types/node/index.d.ts +116 -0
  154. package/dist/typecheck/node_modules/@types/node/inspector/promises.d.ts +35 -0
  155. package/dist/typecheck/node_modules/@types/node/inspector.d.ts +265 -0
  156. package/dist/typecheck/node_modules/@types/node/inspector.generated.d.ts +4406 -0
  157. package/dist/typecheck/node_modules/@types/node/module.d.ts +726 -0
  158. package/dist/typecheck/node_modules/@types/node/net.d.ts +1074 -0
  159. package/dist/typecheck/node_modules/@types/node/os.d.ts +498 -0
  160. package/dist/typecheck/node_modules/@types/node/package.json +140 -0
  161. package/dist/typecheck/node_modules/@types/node/path/posix.d.ts +8 -0
  162. package/dist/typecheck/node_modules/@types/node/path/win32.d.ts +8 -0
  163. package/dist/typecheck/node_modules/@types/node/path.d.ts +178 -0
  164. package/dist/typecheck/node_modules/@types/node/perf_hooks.d.ts +617 -0
  165. package/dist/typecheck/node_modules/@types/node/process.d.ts +2269 -0
  166. package/dist/typecheck/node_modules/@types/node/punycode.d.ts +89 -0
  167. package/dist/typecheck/node_modules/@types/node/querystring.d.ts +139 -0
  168. package/dist/typecheck/node_modules/@types/node/quic.d.ts +2191 -0
  169. package/dist/typecheck/node_modules/@types/node/readline/promises.d.ts +158 -0
  170. package/dist/typecheck/node_modules/@types/node/readline.d.ts +508 -0
  171. package/dist/typecheck/node_modules/@types/node/repl.d.ts +420 -0
  172. package/dist/typecheck/node_modules/@types/node/sea.d.ts +47 -0
  173. package/dist/typecheck/node_modules/@types/node/sqlite.d.ts +1140 -0
  174. package/dist/typecheck/node_modules/@types/node/stream/consumers.d.ts +114 -0
  175. package/dist/typecheck/node_modules/@types/node/stream/iter.d.ts +449 -0
  176. package/dist/typecheck/node_modules/@types/node/stream/promises.d.ts +211 -0
  177. package/dist/typecheck/node_modules/@types/node/stream/web.d.ts +320 -0
  178. package/dist/typecheck/node_modules/@types/node/stream.d.ts +1806 -0
  179. package/dist/typecheck/node_modules/@types/node/string_decoder.d.ts +27 -0
  180. package/dist/typecheck/node_modules/@types/node/test/reporters.d.ts +60 -0
  181. package/dist/typecheck/node_modules/@types/node/test.d.ts +2558 -0
  182. package/dist/typecheck/node_modules/@types/node/timers/promises.d.ts +93 -0
  183. package/dist/typecheck/node_modules/@types/node/timers.d.ts +149 -0
  184. package/dist/typecheck/node_modules/@types/node/tls.d.ts +1232 -0
  185. package/dist/typecheck/node_modules/@types/node/trace_events.d.ts +103 -0
  186. package/dist/typecheck/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +467 -0
  187. package/dist/typecheck/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  188. package/dist/typecheck/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  189. package/dist/typecheck/node_modules/@types/node/ts5.6/index.d.ts +118 -0
  190. package/dist/typecheck/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  191. package/dist/typecheck/node_modules/@types/node/ts5.7/index.d.ts +118 -0
  192. package/dist/typecheck/node_modules/@types/node/tty.d.ts +226 -0
  193. package/dist/typecheck/node_modules/@types/node/url.d.ts +556 -0
  194. package/dist/typecheck/node_modules/@types/node/util/types.d.ts +558 -0
  195. package/dist/typecheck/node_modules/@types/node/util.d.ts +1680 -0
  196. package/dist/typecheck/node_modules/@types/node/v8.d.ts +1059 -0
  197. package/dist/typecheck/node_modules/@types/node/vfs.d.ts +211 -0
  198. package/dist/typecheck/node_modules/@types/node/vm.d.ts +1137 -0
  199. package/dist/typecheck/node_modules/@types/node/wasi.d.ts +131 -0
  200. package/dist/typecheck/node_modules/@types/node/web-globals/abortcontroller.d.ts +59 -0
  201. package/dist/typecheck/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  202. package/dist/typecheck/node_modules/@types/node/web-globals/console.d.ts +9 -0
  203. package/dist/typecheck/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
  204. package/dist/typecheck/node_modules/@types/node/web-globals/domexception.d.ts +83 -0
  205. package/dist/typecheck/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  206. package/dist/typecheck/node_modules/@types/node/web-globals/events.d.ts +106 -0
  207. package/dist/typecheck/node_modules/@types/node/web-globals/fetch.d.ts +69 -0
  208. package/dist/typecheck/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  209. package/dist/typecheck/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  210. package/dist/typecheck/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  211. package/dist/typecheck/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  212. package/dist/typecheck/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  213. package/dist/typecheck/node_modules/@types/node/web-globals/streams.d.ts +119 -0
  214. package/dist/typecheck/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  215. package/dist/typecheck/node_modules/@types/node/web-globals/url.d.ts +24 -0
  216. package/dist/typecheck/node_modules/@types/node/worker_threads.d.ts +672 -0
  217. package/dist/typecheck/node_modules/@types/node/zlib/iter.d.ts +131 -0
  218. package/dist/typecheck/node_modules/@types/node/zlib.d.ts +1364 -0
  219. package/dist/typecheck/node_modules/undici-types/agent.d.ts +30 -0
  220. package/dist/typecheck/node_modules/undici-types/api.d.ts +43 -0
  221. package/dist/typecheck/node_modules/undici-types/balanced-pool.d.ts +30 -0
  222. package/dist/typecheck/node_modules/undici-types/cache-interceptor.d.ts +179 -0
  223. package/dist/typecheck/node_modules/undici-types/cache.d.ts +36 -0
  224. package/dist/typecheck/node_modules/undici-types/client-stats.d.ts +15 -0
  225. package/dist/typecheck/node_modules/undici-types/client.d.ts +134 -0
  226. package/dist/typecheck/node_modules/undici-types/connector.d.ts +37 -0
  227. package/dist/typecheck/node_modules/undici-types/content-type.d.ts +21 -0
  228. package/dist/typecheck/node_modules/undici-types/cookies.d.ts +30 -0
  229. package/dist/typecheck/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
  230. package/dist/typecheck/node_modules/undici-types/dispatcher.d.ts +253 -0
  231. package/dist/typecheck/node_modules/undici-types/dispatcher1-wrapper.d.ts +7 -0
  232. package/dist/typecheck/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  233. package/dist/typecheck/node_modules/undici-types/errors.d.ts +187 -0
  234. package/dist/typecheck/node_modules/undici-types/eventsource.d.ts +66 -0
  235. package/dist/typecheck/node_modules/undici-types/fetch.d.ts +235 -0
  236. package/dist/typecheck/node_modules/undici-types/formdata.d.ts +108 -0
  237. package/dist/typecheck/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  238. package/dist/typecheck/node_modules/undici-types/global-origin.d.ts +7 -0
  239. package/dist/typecheck/node_modules/undici-types/h2c-client.d.ts +73 -0
  240. package/dist/typecheck/node_modules/undici-types/handlers.d.ts +16 -0
  241. package/dist/typecheck/node_modules/undici-types/header.d.ts +165 -0
  242. package/dist/typecheck/node_modules/undici-types/index.d.ts +93 -0
  243. package/dist/typecheck/node_modules/undici-types/interceptors.d.ts +80 -0
  244. package/dist/typecheck/node_modules/undici-types/mock-agent.d.ts +68 -0
  245. package/dist/typecheck/node_modules/undici-types/mock-call-history.d.ts +111 -0
  246. package/dist/typecheck/node_modules/undici-types/mock-client.d.ts +27 -0
  247. package/dist/typecheck/node_modules/undici-types/mock-errors.d.ts +12 -0
  248. package/dist/typecheck/node_modules/undici-types/mock-interceptor.d.ts +98 -0
  249. package/dist/typecheck/node_modules/undici-types/mock-pool.d.ts +27 -0
  250. package/dist/typecheck/node_modules/undici-types/package.json +55 -0
  251. package/dist/typecheck/node_modules/undici-types/patch.d.ts +29 -0
  252. package/dist/typecheck/node_modules/undici-types/pool-stats.d.ts +19 -0
  253. package/dist/typecheck/node_modules/undici-types/pool.d.ts +39 -0
  254. package/dist/typecheck/node_modules/undici-types/proxy-agent.d.ts +36 -0
  255. package/dist/typecheck/node_modules/undici-types/readable.d.ts +68 -0
  256. package/dist/typecheck/node_modules/undici-types/retry-agent.d.ts +8 -0
  257. package/dist/typecheck/node_modules/undici-types/retry-handler.d.ts +125 -0
  258. package/dist/typecheck/node_modules/undici-types/round-robin-pool.d.ts +39 -0
  259. package/dist/typecheck/node_modules/undici-types/snapshot-agent.d.ts +113 -0
  260. package/dist/typecheck/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
  261. package/dist/typecheck/node_modules/undici-types/util.d.ts +18 -0
  262. package/dist/typecheck/node_modules/undici-types/utility.d.ts +7 -0
  263. package/dist/typecheck/node_modules/undici-types/webidl.d.ts +346 -0
  264. package/dist/typecheck/node_modules/undici-types/websocket.d.ts +188 -0
  265. package/dist/typecheck/ts.cjs +446 -0
  266. package/hooks/hooks.json +30 -0
  267. package/hooks/mod.js +461 -0
  268. package/package.json +80 -4
  269. package/skills/agent-graph/SKILL.md +47 -0
  270. package/skills/agent-graph-authoring/SKILL.md +147 -0
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "nanobpm",
3
+ "owner": {
4
+ "name": "nanobpm",
5
+ "url": "https://github.com/nanobpm"
6
+ },
7
+ "description": "nanobpm plugins for Claude Code",
8
+ "plugins": [
9
+ {
10
+ "name": "nano-agent-graph-engine",
11
+ "source": {
12
+ "source": "github",
13
+ "repo": "nanobpm/nano-agent-graph-engine",
14
+ "ref": "release"
15
+ },
16
+ "description": "Durable process engine: defineFlow → BPMN, local engine, agent steps on your CLI, user tasks, web explorer",
17
+ "version": "0.18.0"
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "nano-agent-graph-engine",
3
+ "version": "0.18.0",
4
+ "description": "Nano Agent Graph Engine: write durable flows in TypeScript (defineFlow), compile them to BPMN, and run them in a local engine that orchestrates scripts, headless agents, this session and you (user tasks).",
5
+ "license": "Apache-2.0",
6
+ "keywords": [
7
+ "bpmn",
8
+ "workflow",
9
+ "orchestration",
10
+ "agents",
11
+ "durable"
12
+ ],
13
+ "author": {
14
+ "name": "nanobpm",
15
+ "url": "https://github.com/nanobpm"
16
+ },
17
+ "mcpServers": "./.mcp.json",
18
+ "hooks": "./hooks/hooks.json",
19
+ "homepage": "https://github.com/nanobpm/nano-agent-graph-engine",
20
+ "repository": "https://github.com/nanobpm/nano-agent-graph-engine"
21
+ }
package/.mcp.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "agent-graph": {
4
+ "command": "node",
5
+ "args": ["${CLAUDE_PLUGIN_ROOT}/dist/cli.js", "mcp"]
6
+ }
7
+ }
8
+ }
package/README.md CHANGED
@@ -1,3 +1,527 @@
1
- # Temporary Holding Version
1
+ # Nano Agent Graph Engine
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A durable process engine for coding agents (Claude Code, Claude Desktop, OpenCode, Codex, Cursor). Write a flow in TypeScript with `defineFlow`.
4
+ It compiles to BPMN with a generated diagram and runs in a small local daemon. A flow can
5
+ orchestrate:
6
+
7
+ - **scripts**: `w.run` with Node code, plus `sh()`
8
+ - **headless agents**: `w.task({ jobType: "senior:review" })` runs a prompt file on an agent CLI of *your* choice (the flow names a rank and task, never a CLI) — `claude -p`, or any ACP agent such as OpenCode or nano-coder — and records the transcript as an AgentInstance
9
+ - **the live Claude Code session**: `w.task({ jobType: "session" })`, which the agent picks up through MCP
10
+ - **people**: `w.human` user tasks, asked in a Claude Code dialog or in the web explorer
11
+ - **time and events**: `w.timer` and `w.signal`
12
+
13
+ …with loops, switches, branches and parallel steps. State is an event log on disk, so
14
+ instances survive restarts and keep running after the Claude session ends.
15
+
16
+ This fills a different spot than [Claude Code workflows](https://code.claude.com/docs/en/workflows).
17
+ Those are session-scoped scripts that fan out subagents, with no user input mid-run, no
18
+ timers and no shell. Agent Graph flows are long-lived, can wait for people or time, run
19
+ real code, and can be inspected as a diagram.
20
+
21
+ ```
22
+ flows/*.flow.ts ──check──▶ BPMN + DI ──deploy──▶ engine (one per user, ~/.agent-graph/journal.json)
23
+ │ workers: run handlers · claude -p · timers
24
+ Claude Code ──MCP (stdio)──▶ nage mcp ──HTTP──▶─────┤
25
+ hooks (SessionStart/UserPromptSubmit) ──────────┤ "user task waiting…" → context
26
+ browser ──────────────────────────────────────────▶┘ explorer: diagram, tokens, forms, incidents
27
+ ```
28
+
29
+ ## Install
30
+
31
+ Node 22.15 or newer (24 recommended; flow files are `.ts` and run with Node's built-in type stripping).
32
+
33
+ | Host | Install |
34
+ |---|---|
35
+ | Claude Code | `/plugin marketplace add nanobpm/nano-agent-graph-engine`, then `/plugin install nano-agent-graph-engine@nanobpm`. Brings the MCP server, skills, hooks and the `/flows` mod. |
36
+ | Claude Desktop | Download `nano-agent-graph-engine-<version>.mcpb` from [Releases](https://github.com/nanobpm/nano-agent-graph-engine/releases) and open it (uses Desktop's built-in Node). Or `npx -y @nanobpm/nano-agent-graph-engine install claude-desktop`. |
37
+ | OpenCode, Codex, Cursor | `npx -y @nanobpm/nano-agent-graph-engine install opencode` (or `codex`, `cursor`) |
38
+ | Terminal | `npm install -g @nanobpm/nano-agent-graph-engine`, then `nage` |
39
+
40
+ `nage install <host>` adds the `agent-graph` MCP server to the host's config (keeping a `.bak`
41
+ of the file it changes) and copies the skills where the host reads them (OpenCode, Codex);
42
+ `--dry-run` shows the change, `nage uninstall <host>` takes it out. Run from npx, the entry
43
+ starts the server with `npx -y @nanobpm/nano-agent-graph-engine mcp`; from a global install,
44
+ with that install's `node` and `cli.js` (absolute paths, as desktop apps don't load your
45
+ shell PATH). Run it again after an upgrade to refresh the skills.
46
+
47
+ **Coming from `agent-graph-engine`?** Flow files may keep `import … from "agent-graph-engine"`;
48
+ the new name is `@nanobpm/nano-agent-graph-engine`. The command is now `nage` (`age` clashes with
49
+ the age encryption tool); `age` still works for this release and prints a note. State stays in
50
+ `~/.agent-graph`, and the `AGE_*` variables keep their names.
51
+
52
+ ## Claude Desktop (chat)
53
+
54
+ No server to run and no workers to configure: install the `.mcpb`, or run `nage install claude-desktop`, which adds
55
+ this to `~/Library/Application Support/Claude/claude_desktop_config.json` (restart Desktop with ⌘Q afterwards):
56
+
57
+ ```json
58
+ "mcpServers": {
59
+ "agent-graph": {
60
+ "command": "/absolute/path/to/node",
61
+ "args": ["/absolute/path/to/nano-agent-graph-engine/dist/cli.js", "mcp"]
62
+ }
63
+ }
64
+ ```
65
+
66
+ - **One engine, every project.** You have one engine (state in `~/.agent-graph`, `AGE_STATE_DIR` moves it). Each project's flows are in its `flows/`; a project joins the engine the first time a flow tool, the CLI or the `/flows` pane is used there. The flows in `~/AgentGraph/flows` (the library; `AGE_HOME` moves it) are *global*: offered in every project and run in the project they were started from. A project flow with the same id takes the global one's place there (`flow_import` copies one in to customize it). Every run belongs to a project: its `sh()` steps and agent steps run in that folder, and files a step writes should use `projectPath("file")`. `flow_status`, the `/flows` pane and the explorer show work in all projects (the explorer has a project picker), so nothing waits somewhere you aren't looking. Agent steps for the session only go to a session in the run's project. Nothing is written into your repos.
67
+ - **Where flows live.** Desktop starts servers in `/`, so flows go in `~/AgentGraph/flows/`. Override with `"env": {"AGE_PROJECT": "/some/dir"}`.
68
+ - **Authoring.** Claude reads `flow_guide`, then writes flows with `flow_write`, which saves, compiles, lints and deploys in one step. Nothing is needed on your side.
69
+ - **Agent steps** (`jobType: "senior:<task>"`) need no setup:
70
+ - If the Claude Code CLI is installed and logged in, they run headless in the background.
71
+ - Otherwise the Claude you are chatting with does them (`session_job_next`/`session_job_complete`). If the CLI fails to authenticate, the engine switches to this automatically.
72
+ - To force one mode: `AGE_AGENT_MODE=cli|session`.
73
+ - **Seeing and answering.**
74
+ - `show_explorer` renders the explorer **inline in the chat** as an MCP App, with three tabs:
75
+ - **Inbox:** task forms.
76
+ - **Flows:** diagrams with live token counts, and a start form.
77
+ - **Instances:** the nano console's Process Explorer: filters, diagram, variables (editable), jobs, incidents, cancel, and a step-by-step trace.
78
+ - The view reaches the engine only through the server's app-only `ui_api` tool, so the iframe needs no network access.
79
+ - The same explorer is also at the daemon URL in a browser.
80
+ - **Background.** The engine daemon keeps running after the chat is closed, so timers and CLI agent steps continue. In chat, nothing can wake Claude by itself: the explorer shows "agent step waiting — say *continue the flow*".
81
+
82
+ ### Reusing flows across Desktop and Claude Code
83
+
84
+ `~/AgentGraph` doubles as a **library**. In any Claude Code project, `flow_list` shows the
85
+ project's flows and the library's, with descriptions and steps. `flow_import <name>` copies a
86
+ library flow and its prompt files into `./flows/` and deploys it there. Runs and state stay
87
+ per project. Relative imports from a flow file (your own helper modules) are not copied.
88
+
89
+ ## In the interface: slash commands and the Claude Code mod
90
+
91
+ **Every MCP client: prompts.** The server publishes one prompt per flow in the project,
92
+ `start-<flow>`, with an `inputs` argument, plus `flows`, which shows what's going on. The
93
+ list follows `flows/` as you add or change flows.
94
+
95
+ | Client | How the prompts appear |
96
+ |---|---|
97
+ | Claude Code | `/mcp__agent-graph__start-release-notes since v1.0` |
98
+ | Claude Desktop | In the prompt menu (+) |
99
+ | OpenCode | As the command `agent-graph:start-release-notes`, e.g. `opencode run --command agent-graph:start-release-notes "since v1.0"` |
100
+
101
+ **Claude Code: the mod.** This needs Claude Code v2.1.287 or later, or v2.1.286 or later
102
+ in the Desktop Code tab. The plugin includes a mod (`hooks/mod.js`), so the engine shows up
103
+ in the Claude Code interface itself: the terminal, the Desktop Code tab, and VS Code
104
+ (panes only).
105
+
106
+ - **Band above the prompt.** While something is going on, it shows
107
+ `⚙ Agent Graph · 2 flows running · 1 task waiting for you · 1 incident`, with a
108
+ buttons that open the pane and the web explorer.
109
+ - **`/flows` pane**, with three tabs:
110
+ - **Inbox:** user tasks drawn as forms that you answer right there, and incidents
111
+ with **Retry**, **Ask Claude to fix** and **Cancel run**.
112
+ - **Flows:** every flow has a **Start** button. Type JSON variables and the mod starts
113
+ the run directly, with no model turn. Type plain words and Claude works out the
114
+ variables.
115
+ - **Runs:** what's active and where.
116
+ - **Open ↗** (hotkey `o`) opens the web explorer at what needs you: the waiting
117
+ task, else the incident, else this project's one running flow, else the flows. **↗**
118
+ on a run opens that instance. The band's **Open ↗** does the same.
119
+ - **Where it opens:** in the terminal, your default browser (the engine starts if
120
+ needed; `nage open [instance=K | task=K | flow=ID]` does the same from a shell). In the
121
+ Desktop app, the links open in its Browser pane, if you chose "Open links in built-in
122
+ browser" there (Browser pane ⋮ menu). The engine answers on `http://localhost`, the
123
+ only plain-http links the app makes clickable.
124
+ - **Wakes the agent.** When a flow hands agent steps to the session, the mod submits a
125
+ prompt so the agent picks them up, using `session_job_next` with `max` for a fan-out.
126
+ New user tasks show a toast.
127
+ - **No engine running?** The pane offers **Start engine**.
128
+
129
+ The mod polls the engine every 3 s over its local HTTP API. It reads the engine's
130
+ address from `~/.agent-graph/daemon.json`. Run the mod's tests with
131
+ `claude plugin test .`; `npm test` runs them after the engine tests.
132
+
133
+ **Organisations.** Mods are on by default. An administrator can allow only managed mods
134
+ with `allowManagedModsOnly` in managed settings. If they do, the band and pane don't
135
+ appear, and everything else keeps working.
136
+
137
+ ## OpenCode
138
+
139
+ `nage install opencode` adds the server to `~/.config/opencode/opencode.json` (in a project, `opencode.json` takes the same entry):
140
+
141
+ ```json
142
+ "mcp": {
143
+ "agent-graph": {
144
+ "type": "local",
145
+ "command": ["/absolute/path/to/node", "/absolute/path/to/nano-agent-graph-engine/dist/cli.js", "mcp"],
146
+ "enabled": true
147
+ }
148
+ }
149
+ ```
150
+
151
+ and copies the two skills into `~/.config/opencode/skills/`, so OpenCode knows how to run and write flows.
152
+
153
+ Check it with `opencode mcp list`, which should show `✓ agent-graph connected`.
154
+
155
+ **OpenCode desktop app (2.x).** The app runs its own bundled server (`opencode-cli serve --service`, 2.2.6 at the time of writing) and reads the same `~/.config/opencode/opencode.json` and `skills/`, so the entry above is all it needs. It accepts the 1.x shape shown here; the 2.x shape is `"mcp": {"servers": {"agent-graph": {..., "disabled": false}}}`. Restart the app after editing the config. Two things differ from the terminal CLI:
156
+
157
+ - The 2.x `opencode mcp list` prints "No MCP servers configured" even when the server is connected. Ask the running app instead: `"~/Library/Application Support/ai.opencode.desktop/cli/<version>/opencode-cli" api mcp.list` should list `agent-graph` as `connected`.
158
+ - The model calls tools from code, through one `execute` tool (`tools["agent-graph"].flow_start(...)`). Tool names and results are the same.
159
+
160
+ - **Where flows live.** The project is OpenCode's working directory, or the nearest parent with `flows/`, as in Claude Code. `flow_list` and `flow_import` reach the `~/AgentGraph` library.
161
+ - **Agent steps.** If the Claude Code CLI is installed and logged in, these still run as headless `claude -p`. Otherwise they go to the OpenCode agent through `session_job_next`, which uses whatever model you picked. To force this, set `"environment": {"AGE_AGENT_MODE": "session"}` on the server entry.
162
+ - **User tasks.** OpenCode renders neither MCP Apps nor MCP elicitation forms. The 2.x app does declare elicitation support, but it never shows the form, so the call would hang until OpenCode's 60-second tool timeout. `task_ask` therefore skips the dialog for OpenCode and falls back to text: the agent asks you in chat and records the answer with `task_complete`. Or answer in the browser explorer; `flow_start` and `flow_status` print its URL. For any client, a form that gets no answer within 10 minutes (`AGE_ELICIT_TIMEOUT_MS`) also falls back to chat. `AGE_ELICIT=on|off` overrides the detection.
163
+ - **No hooks.** OpenCode has no equivalent of Claude Code's SessionStart and UserPromptSubmit hooks, so ask "anything waiting in my flows?" and the agent will call `flow_status`.
164
+
165
+ ## Claude Code plugin
166
+
167
+ ```sh
168
+ claude plugin marketplace add nanobpm/nano-agent-graph-engine
169
+ claude plugin install nano-agent-graph-engine@nanobpm
170
+ ```
171
+
172
+ The marketplace (on `main`) points at the `release` branch, which holds the built plugin.
173
+
174
+ On macOS, also install `terminal-notifier` (`brew install terminal-notifier`) for
175
+ [notifications](#notifications) that open the run in the explorer when clicked, then allow its notifications: run
176
+ `terminal-notifier -title Test -message Hello` once and accept the prompt, or turn on **Allow notifications** for
177
+ **terminal-notifier** in System Settings → Notifications. Without it, notifications still appear, but clicking one
178
+ opens Script Editor.
179
+
180
+ The plugin provides:
181
+
182
+ - the **`agent-graph` MCP server**:
183
+ - `flow_check`, `flow_start`, `flow_status`
184
+ - `task_list`, `task_ask`, `task_complete`
185
+ - `session_job_next`, `session_job_complete`, `session_job_fail`
186
+ - `flow_operate`
187
+ - the **`agent-graph` and `agent-graph-authoring` skills**: how to run flows, and how to write them
188
+ - **hooks**: when a user task, session job or incident is waiting, SessionStart and UserPromptSubmit add it to Claude's context. They stay silent otherwise and never start the daemon.
189
+
190
+ ## Use
191
+
192
+ Ask Claude something like *"make a flow that drafts release notes from git log with an agent,
193
+ lets me review, and writes CHANGELOG.md"*. It writes `flows/<name>.flow.ts`, runs
194
+ `flow_check` until clean, and starts it. When the review step is reached, `task_ask` opens
195
+ a form dialog in Claude Code. You can also answer it in the explorer.
196
+
197
+ CLI (`node dist/cli.js …`, or `nage` once installed):
198
+
199
+ ```
200
+ nage check [file] [--json] | up | down | status | start <flow> [--field value …] [json] | tasks | complete <task> [json] | open
201
+ ```
202
+
203
+ The example is in `examples/demo`:
204
+
205
+ ```sh
206
+ cd examples/demo
207
+ node ../../dist/cli.js check
208
+ node ../../dist/cli.js start changelog '{"commits":10}'
209
+ node ../../dist/cli.js open # explorer URL
210
+ ```
211
+
212
+ ### A flow
213
+
214
+ See `examples/demo/flows/changelog.flow.ts` and `skills/agent-graph-authoring/SKILL.md` for the full API.
215
+
216
+ ```ts
217
+ import { defineFlow, defineForms, sh } from "@nanobpm/nano-agent-graph-engine";
218
+ export const forms = defineForms({ "review": { title: "Review", description: "{{notes}}",
219
+ fields: { decision: { type: "string", enum: ["publish", "redo", "cancel"] }, feedback: { type: "string" } }, required: ["decision"] } });
220
+ export const changelog = defineFlow("changelog", (w) => {
221
+ w.run("gather", async () => ({ commitLog: (await sh("git log --oneline -n 20")).stdout }));
222
+ w.loop((b) => {
223
+ b.task("draft", { jobType: "senior:draft", prompt: { resourceId: "changelog.md" } });
224
+ b.human("review", { form: "review" });
225
+ b.switch("decision", { publish: (c) => { c.run("write", async (j) => { /* … */ }); c.break(); },
226
+ cancel: (c) => c.break(), default: (c) => c.continue() });
227
+ });
228
+ });
229
+ ```
230
+
231
+ ### Flow input and the start form
232
+
233
+ A flow declares what a run starts with as the `Start` contract, an envelope from
234
+ `@nanobpm/workflow` (it becomes `io.nanobpm.dataEnvelope.in` on the BPMN start event):
235
+
236
+ ```ts
237
+ import { defineFlow, defineStartForm, envelope } from "@nanobpm/nano-agent-graph-engine";
238
+ const Input = envelope("ReviewInput", { pr: "integer", repo: "string", note: { type: "string", optional: true } });
239
+ export const startForm = defineStartForm(Input, { title: "Review a PR", fields: { pr: { title: "PR number" } } }); // optional hints
240
+ export const review = defineFlow("review", { Start: { in: Input } }, (w) => { /* … */ });
241
+ ```
242
+
243
+ That one declaration drives:
244
+
245
+ - the explorer's **start form** (typed fields, with a JSON box under *Advanced* for extra variables);
246
+ - the `/flows` pane in Claude Code (`pr=42 repo=x`);
247
+ - `flow_status` (`review(pr: integer, repo: string, note?: string)`) and the `flow_start` guidance agents get;
248
+ - the `/start-review` **MCP prompt**, with one argument per field;
249
+ - `nage start review --pr 42 --repo x`;
250
+ - a **check at start**: `/api/start` converts text to the declared types and refuses missing or wrong fields with `400 { error, problems: [{ field, message }] }`.
251
+
252
+ Flows without an input work as before, with free-form JSON variables.
253
+
254
+ Flow inputs need `@nanobpm/workflow` 0.17 or later.
255
+
256
+ ### The authoring loop: `nage check` / `flow_check`
257
+
258
+ Authoring agents (the `agent-graph-authoring` skill) run this after every edit, until it is clean:
259
+
260
+ 1. **Type-check** the flow file and the project modules it imports. This is TypeScript strict mode against the real `@nanobpm/nano-agent-graph-engine`, `@nanobpm/workflow` and Node types, with `file:line:col TSxxxx` errors.
261
+ - The engine loads flows with types stripped, so without this step a type error only shows up at run time.
262
+ - The checker ships in the plugin as `dist/typecheck/` (about 6.7 MB): minified TypeScript, the ES libs, `@types/node`, and the declarations. The user's project needs nothing installed.
263
+ - It takes about 0.4 s. `--no-types` skips it.
264
+ 2. `defineFlow` validates the structure.
265
+ 3. `@nanobpm/workflow` emits BPMN.
266
+ 4. `bpmn-auto-layout` generates the DI.
267
+ 5. Our lint checks catch:
268
+ - `run` steps without a handler
269
+ - unknown forms
270
+ - missing prompt files and unknown agent profiles
271
+ - job types no worker serves
272
+ - start-form hints that don't match the input
273
+ 6. A trial deploy into the engine is the final check.
274
+
275
+ `--json` prints `{ ok, typesChecked, files: [{ file, flows: [{ id, input }], problems }] }`, and the exit code is 1 on errors.
276
+ `flow_write` (for MCP-only clients) writes a flow and runs the same check.
277
+
278
+ The daemon deploys every flow that compiles (it does not type-check), and a new version only when the BPMN changed. It watches `flows/`.
279
+
280
+ ## Which agent runs an agent step
281
+
282
+ Agent steps follow the [nano-workforce](https://github.com/nanobpm) convention, so a flow is portable: its job type names a **rank and a task** (`senior:review`, `junior:triage`), never a CLI, and the BPMN carries the agent marker (`zeebe:agentDefinition agentType="external"`) and the prompt as a linked resource. Which CLI and model run a step is decided on the machine that runs it. So:
283
+
284
+ - someone who uses OpenCode can send you a flow and it runs on your Claude Code (or anything else you've installed);
285
+ - you can rerun the same flow on another CLI or model to compare them, without editing it.
286
+
287
+ `jobType: "claude"` still works as the legacy name of an agent step (no rank). A `jobType` that is neither `<rank>:<task>` nor `claude` gets a lint warning.
288
+
289
+ An agent step runs on an **agent profile**: a CLI the engine starts headless for that step.
290
+
291
+ Built-in profiles:
292
+
293
+ | profile | runs | protocol |
294
+ | --- | --- | --- |
295
+ | `claude` | `claude -p --output-format stream-json` | Claude Code print mode |
296
+ | `opencode` | `opencode acp` | [ACP](https://agentclientprotocol.com) |
297
+ | `nano-coder` | `nano-coder --acp` | ACP |
298
+ | `gemini` | `gemini --experimental-acp` | ACP |
299
+ | `qwen` | `qwen --acp` | ACP |
300
+ | `kimi` | `kimi acp` (a model goes before `acp`: `kimi --model … acp`) | ACP |
301
+ | `copilot` | `copilot --acp` | ACP |
302
+
303
+ **Any other CLI** works too. Add it with `nage agent add` (it goes in `~/.agent-graph/agents.json`), saying how to talk to it:
304
+
305
+ ```sh
306
+ # an ACP agent (Agent Client Protocol over stdio): tool calls, streaming and tokens in the transcript
307
+ nage agent add codex --acp -- npx -y @zed-industries/codex-acp
308
+ # anything else: the prompt replaces {prompt} in its arguments, or else goes to its stdin,
309
+ # and what it prints is the answer (a non-zero exit fails the step with its stderr)
310
+ nage agent add aider --exec --model-arg --model -- aider --yes-always --no-git --message {prompt}
311
+ nage agent add my-script --exec -- ./ask.sh
312
+ # options: --model <default model>, --model-arg <flag> (how a model is passed; --model-first
313
+ # puts it before the args), --env K=V, --description text
314
+ nage agent remove aider
315
+ ```
316
+
317
+ `--exec` CLIs show their output in the live transcript as it's printed, but no tool calls or token counts (the engine only sees stdout). A profile you add under a preset's name replaces the preset for you; removing it brings the preset back. Flow files can define profiles too (`agentProfiles`, below).
318
+
319
+ ### Choosing the CLI and model
320
+
321
+ **For every run** (saved in `~/.agent-graph/agents.json`):
322
+
323
+ ```sh
324
+ nage agent show review # each agent step: who runs it, and why
325
+ nage agent assign review opencode # the whole flow on OpenCode
326
+ nage agent assign review/critique nano-coder --model openrouter/openai/gpt-5 # one step
327
+ nage agent assign review - --model sonnet # keep the CLI, change the model
328
+ nage agent assign --rank senior claude # every flow's senior:* steps
329
+ nage agent unassign review[/step] | --rank senior
330
+ nage agent default nano-coder # whatever nothing else decides
331
+ ```
332
+
333
+ **For one run**, without changing the assignments:
334
+
335
+ ```sh
336
+ nage start review --agent opencode --model anthropic/claude-sonnet-4-5 # all agent steps
337
+ nage start review --agent critique=gemini --model draft=opus # per step
338
+ ```
339
+
340
+ The same is available to agents as the `flow_agents` MCP tool (show, and `assign`) and `flow_start`'s `agents` argument (`{ "*": { "use": "opencode", "model": "…" }, "critique": { … } }`), over HTTP as `GET /api/flows/<id>/agents` and `POST /api/agents/assign`, and in the explorer's start form: its **Agents** table shows each step's CLI, model and the reason, applies your changes to the run you start, and **Save for every run** keeps them. The run records its overrides.
341
+
342
+ ```jsonc
343
+ // ~/.agent-graph/agents.json
344
+ {
345
+ "default": "nano-coder",
346
+ "ranks": { "senior": "claude", "junior": "nano-coder" },
347
+ "flows": { "review": { "use": "opencode", "steps": { "critique": { "use": "critic", "model": "openai/gpt-5" } } } },
348
+ "profiles": {
349
+ "critic": { "protocol": "acp", "command": "nano-coder", "args": ["--acp"], "model": "openrouter/openai/gpt-5", "modelArg": "--model" },
350
+ "oc-sonnet": { "protocol": "acp", "command": "opencode", "args": ["acp"], "model": "anthropic/claude-sonnet-4-5" }
351
+ }
352
+ }
353
+ ```
354
+
355
+ A flow's author can **suggest** a CLI and model; it's used only where that CLI is installed and you haven't decided otherwise:
356
+
357
+ ```ts
358
+ // flows/review.flow.ts
359
+ export const agentProfiles = defineAgentProfiles({ critic: { protocol: "acp", command: "nano-coder", args: ["--acp"], model: "…" } });
360
+ export const defaultAgent = "claude";
361
+ export const agents = { critique: { use: "critic" }, draft: { model: "opus" } };
362
+ ```
363
+
364
+ The profile for a step is the first of:
365
+
366
+ 1. this run's override (`--agent`, `flow_start` `agents`, the start form): the step, then `*`;
367
+ 2. your assignment for the step;
368
+ 3. your assignment for the flow;
369
+ 4. your assignment for the step's rank;
370
+ 5. the author's suggestion — the step's `use`, else the flow's `defaultAgent` — if that CLI is installed here;
371
+ 6. `default` in `agents.json`;
372
+ 7. the CLI of the host that started the run (Claude Code → `claude`, OpenCode → `opencode`, nano-coder → `nano-coder`);
373
+ 8. the first installed of `claude`, `opencode`, `nano-coder`, `gemini`, `qwen`, `kimi`, `copilot`.
374
+
375
+ The model follows the same order (yours, then the author's, then the profile's). **CLIs that aren't installed.** The flow author's suggestions are only *suggestions*: one whose profile is unknown or whose CLI isn't installed here is skipped, with a note ("flow suggests gpt-cli (unknown here)") and a warning from `nage check`, and the step falls through to the next rule. Your own choices are not swapped behind your back (that could mean another subscription or model): an assignment or override naming an unknown profile, or a CLI that isn't installed, stops the step with an incident that says so ("agent CLI "kimi" isn't installed here (kimi, from your rank senior); install it, or change the assignment"); the explorer's Agents table and `nage agent show` show the same before you run. The auto-detect in rule 8 only considers installed CLIs, and `nage agent` marks the ones that aren't. On a name clash `agents.json` wins over a flow's `agentProfiles`, which win over the built-ins. `nage agent` lists the profiles. If no agent CLI is installed, agent steps go to the chat session (`session_job_next`), as before. `AGE_CONCURRENCY=claude=N` caps all agent steps together.
376
+
377
+ A step's prompt file may use `{{name}}` placeholders (filled from the variables); `context: []` stops the variables being appended as JSON, and `cwd` (also with placeholders) sets the agent's working directory. That lets a flow wrap an app's own prompts: a `run` step builds the prompt, the agent step runs it on your CLI, a `run` step validates and retries (see `~/AgentGraph/flows/publish-video.flow.ts`).
378
+
379
+ `env` (also with placeholders) adds environment variables for the agent CLI. Every agent run gets `AGENT_RESULT_FILE`: a JSON object written there becomes the step's variables, ahead of the final message. With `abortCheck: true` the agent also gets `AGE_JOB_STATUS_URL` plus a prompt section telling it to `curl -fsS` that URL before irreversible actions; it 404s once the step is cancelled, and the cancelled step's CLI is killed. Those are the Nano Workforce harness conventions, so nwf prompts run unchanged: `~/AgentGraph/flows/pr-converge.flow.ts` is a port of nwf's single-PR converge → merge loop (Copilot review rounds, adversarial self-review, CI fix, rebase, merge, escalations as forms) that uses nwf's own prompt files.
380
+
381
+ **Live transcript.** While an agent step runs, everything it does streams to `~/.agent-graph/transcripts/<jobKey>.jsonl` in Nano Workforce's transcript format (`@nanobpm/agentic/transcript`): the prompt, assistant text as it's generated (claude runs with `--include-partial-messages`; ACP agents send deltas anyway), tool calls and their results, then a closing lifecycle event. Read it with `GET /api/jobs/<jobKey>/transcript?from=<offset>` or `GET /api/explorer/agents/<agentInstanceKey>/transcript?from=<offset>`, which return `{status: "open"|"completed", nextOffset, entries: [{offset, chunk}]}` (the shape of nwf's `/agentic/transcripts` read; offsets are bytes). In the explorer, the agent panel on a running step shows a **Now** section under the turn scrubber: text as it streams, and tool calls with a spinner until their result lands. Transcripts older than 7 days are pruned when the engine starts.
382
+
383
+ Big flows: the detailed diagram layout (bpmn-auto-layout 2) slows down steeply with flow size. It runs on a worker thread for up to `AGE_LAYOUT_MS` (default 5 s); past that the flow deploys with the simpler 1.x layout, and the detailed one finishes in the background into `~/.agent-graph/layout-cache/` and is used from the next deploy.
384
+
385
+ ACP agents run in the agent's working directory (by default the run's project directory) with permission requests approved, so give them a sandbox you trust. Each step is a fresh ACP session. `schema` is passed as an instruction to answer with JSON; the first JSON object in the answer becomes variables.
386
+
387
+ ### Agent transcripts (AgentInstance)
388
+
389
+ Each agent step is recorded in the engine as an **AgentInstance** with its **history** (the same read model Camunda's agentic orchestration and `c8ctl-plugin-nano` use): a CONFIGURATION item (profile as provider, model, prompt), the USER prompt, each ASSISTANT turn with its tool calls and token/time metrics, and each TOOL_RESULT. Agent jobs are activated with a lease token, so writes are fenced to the activation; the history is committed when the step completes and discarded if it fails. A retry of the same step continues the same AgentInstance.
390
+
391
+ The explorer shows an agent badge on the step; click it for the transcript, with a timeline, metrics and a run picker when a step ran several times. The data comes from `GET /api/explorer/instances/<key>/agents` and `GET /api/explorer/agents/<key>/history`. Recording is best-effort: a failure is logged and never fails the step.
392
+
393
+ ## Notifications
394
+
395
+ The engine runs in the background, so a run can stop long after you've left the session. When an incident is raised, or a user task starts waiting for you, the engine shows a desktop notification with the flow and project. Clicking it opens that run or task in the explorer, where available. Each incident or task is announced once. Anything already waiting when the engine starts is not announced again. More than three at once are combined into one notification.
396
+
397
+ | Platform | Uses | Click opens the explorer |
398
+ |---|---|---|
399
+ | macOS | `terminal-notifier` (**recommended:** `brew install terminal-notifier`; found on PATH or in Homebrew's bin), else `osascript` | only with `terminal-notifier`; `osascript` notifications belong to Script Editor, so a click opens Script Editor |
400
+ | Linux | `notify-send` (libnotify, any freedesktop notification daemon) | with libnotify 0.7.9+ (`--action`); the URL is also in the text |
401
+ | Windows 10/11 | a PowerShell toast (no install) | yes |
402
+
403
+ `AGE_NOTIFY=off` turns them off, and `AGE_NOTIFY=incidents` or `AGE_NOTIFY=tasks` limits them to one kind. Set it in the environment the engine starts from. A missing or failing notifier is logged once in the activity log and never affects runs.
404
+
405
+ If no notifications appear on macOS, check System Settings → Notifications for **terminal-notifier** (and **Script Editor**, which is what `osascript` notifications show up as). macOS asks for permission the first time; if that prompt was dismissed, notifications stay off for that app, and `terminal-notifier` prints "Notifications are turned off for this application" and exits with code 3. The engine then logs `terminal-notifier failed (exit 3): …` in the activity log and falls back to `osascript`. To fix it, open System Settings → Notifications, select **terminal-notifier** and turn on **Allow notifications** (choose **Alerts** to keep them on screen until dismissed). The `tccutil reset UserNotification …` command that `terminal-notifier` suggests fails on recent macOS, so use System Settings. No restart is needed afterwards.
406
+
407
+ ## Parallelism and fan-out
408
+
409
+ Flows fan out with `w.parallel([...])`, a fixed set of branches, and
410
+ `w.forEach("files", "file", body, { outputCollection, outputElement, name })`, one branch per
411
+ list item with the results collected in order. A multi-step body is a sub-process, drawn
412
+ expanded with its steps inline (`name` labels it, e.g. "Review & challenge each file"). Both are BPMN parallel gateways and
413
+ multi-instance activities, so the engine joins the branches and continues only when
414
+ all are done, or when `completionCondition` holds.
415
+
416
+ How the branches run depends on who does the work:
417
+
418
+ - **`run` steps and headless agents** (`claude -p`) run concurrently inside the daemon, up to `AGE_MAX_CONCURRENT` at a time (default 4). `AGE_CONCURRENCY="claude=2"` sets a lower limit for a step type. Each agent step is its own `claude -p` process: a durable subagent with its own context, tools and cost line. Measured with six 2-second agent steps plus a two-branch `parallel`: they ran in three waves of 4 + 2 + 2, so about 7 s instead of 16 s.
419
+ - **Steps handed to the chat agent** (`session` jobs, and agent steps when there's no CLI) are queued. `session_job_next` hands them out one at a time, or as a batch with `max`. An agent that has subagents (Claude Code's Task tool, OpenCode's `task`) can then do the batch in parallel and complete each job by key. Without subagents, the agent works through them one by one.
420
+
421
+ Compared with session-scoped workflow tools (Claude Code workflows, dsh `workflow`):
422
+
423
+ - **What's the same:** both fan out to fresh agents.
424
+ - **What's different:**
425
+ - The fan-out here is a step in a durable process, so it can be joined, retried per branch (an incident on one branch doesn't lose the others), and followed by human review or timers.
426
+ - Each branch shows on the diagram with ×N badges.
427
+
428
+ ## How it works
429
+
430
+ - **Engine**: `@nanobpm/engine-wasm` (`TestEngine`) running in Node. The host owns the clock (`tickNow(Date.now())` every 500 ms) and runs the job workers.
431
+ - **Durability**:
432
+ - After each change, `engine.events()` is written atomically to `~/.agent-graph/journal.json`.
433
+ - On start, `replayEvents()` restores it.
434
+ - Jobs that were mid-run when the daemon died are handed back out.
435
+ - Tested by the e2e test: it stops the daemon in the middle of a flow.
436
+ - **Code layout**: three parts with narrow seams between them.
437
+ - **Control** (`src/client.ts`): `EngineClient`, the one typed client the MCP server, CLI and hooks use. It finds or starts the engine, scopes calls to a project and builds explorer links. The mod runs sandboxed and keeps a few direct calls to the same routes.
438
+ - **Engine** (`src/daemon.ts`): the WASM engine, event log, timers and HTTP API.
439
+ - **Worker** (`src/worker.ts`): runs activated jobs. It meets the engine only through complete/fail, so it's tested with a fake engine (`test/worker.spec.ts`).
440
+ - **Step threads** (`src/step-pool.ts`, `src/step-thread.ts`): flow code runs on a pool of worker threads, one step per thread, up to `AGE_MAX_CONCURRENT` threads. Each thread imports the flow file itself, and only JSON variables pass between it and the engine.
441
+ - **Workers**:
442
+ - `run` handlers are imported from the flow file. A failed job gets 3 retries with backoff, then an incident.
443
+ - A step can't take the engine down. A handler that throws, rejects or hangs fails its job. Steps time out after 25 minutes, agent steps after 55 (`AGE_JOB_TIMEOUT_MS` overrides both); on timeout the step's `sh()`/`claude()` process is killed, and handlers can pass `jobSignal()` to `fetch()` and other long calls. A stray rejection or exception from flow code is logged, not fatal.
444
+ - Flow code runs on step threads, not the engine's thread. Steps that compute run in parallel, and the engine keeps ticking timers and answering the explorer meanwhile. A step that doesn't stop within 2 s of its timeout, even one stuck in a synchronous loop, has its thread terminated. `process.exit()` in a step ends only its thread and fails the step. Threads are replaced when flows are reloaded. `AGE_STEP_THREADS=0` runs flow code on the engine's thread, as before 0.7.
445
+ - Threads share the process's memory, so a step that exhausts memory or crashes native code still stops the engine. Module-level state in a flow file isn't shared between steps, since each thread has its own copy; keep shared state in variables or files.
446
+ - Agent steps (`claude`) stay on the engine's thread: they only wait on the `claude` process.
447
+ - The agent worker runs the step's profile (see [Which agent runs an agent step](#which-agent-runs-an-agent-step)). For `claude` it spawns `claude -p --output-format stream-json --verbose --permission-mode dontAsk` with optional `--json-schema`, `--allowedTools` and `--model`; ACP profiles go through the `@nanobpm/agentic` ACP client. Options come from `export const agents`. The cost is logged when the CLI reports it.
448
+ - `AGE_CLAUDE_CMD` swaps the `claude` binary (the tests use fakes: `test/fixtures/fake-claude.mjs`, `fake-acp.mjs`).
449
+ - **One engine per user**:
450
+ - Its info is in `~/.agent-graph/daemon.json`, and it listens on `localhost` (`127.0.0.1` and `::1`).
451
+ - The MCP server, CLI and hooks are thin HTTP clients. MCP/CLI start the engine detached on first use (one client starts it; the others wait) and register their project with it (`projects.json`).
452
+ - A project's flows deploy as `<folder>-<hash>.<id>`, so two repos can both have a `release` flow; global flows keep their id. Runs record their project; handlers run inside an async context that `sh()`, `claude()` and `projectPath()` read.
453
+ - Before 0.5 each project had its own engine in `<project>/.agent-graph/`. Those aren't migrated: stop one with the old version's `nage down` once its runs are done (its history stays in that folder).
454
+ - `flow_start` output includes the explorer URL.
455
+ - **Explorer** (`GET /`), a single HTML file using the bpmn-js viewer, shows:
456
+ - the task inbox with forms
457
+ - flows, with token counts and a start form
458
+ - instances: active, done and incident markers, the path taken, ×N loop badges, variables (rebuilt from the event log for finished instances), activity and costs, retry and cancel
459
+
460
+ ## Surfacing user tasks and prompting in Claude Code: findings
461
+
462
+ | Surface | Status | Used here |
463
+ |---|---|---|
464
+ | **MCP elicitation** (form/url dialogs from a tool call) | stable in Claude Code | ✅ `task_ask` asks the form in a dialog. It only works *inside* a tool call, so the agent has to call it. |
465
+ | **Hooks** `additionalContext` (SessionStart, UserPromptSubmit) | stable | ✅ tells the agent what's waiting on the next prompt (deduplicated) |
466
+ | **Web UI** (own HTTP server) | — | ✅ explorer: inbox, forms, diagram |
467
+ | **Mods** (`$.ui.open` panes in terminal/Desktop/VS Code, `$.ui.notify/toast/status`, `$.ui.ask`, `$.clock.every`, `$.prompt.submit` to start a turn from the background) | Claude Code ≥ 2.1.290 | ❌ not yet. This is the best fit: a live task-inbox pane, a status line ("2 tasks waiting"), and waking the agent when a session job arrives. Local Claude Code is 2.1.177. |
468
+ | **MCP tasks** (`input_required` → elicitation while a long job runs) | public beta, ≥ 2.1.304 | ❌ could make `flow_start … wait` a first-class background task |
469
+ | **Channels** (`notifications/claude/channel` push into a running session) | research preview, needs `--dangerously-load-development-channels` | ❌ push alternative to hooks |
470
+
471
+ Without mods, nothing can *interrupt* an idle session. Waiting work is surfaced on the next prompt (hook), in the explorer, and by `flow_status`.
472
+
473
+ ## Develop
474
+
475
+ ```sh
476
+ npm install
477
+ npm run build # fetch the Process Explorer, typecheck, esbuild + tailwind →
478
+ # dist/{cli.js,index.js,explorer.html,explorer-app.html,nanobpmn_engine_bg.wasm}
479
+ npm test # e2e: MCP client with elicitation → server → daemon, restart mid-flow, hooks, lint,
480
+ # and a Desktop-like client (cwd /, no CLI, no elicitation) authoring + running via MCP only
481
+ node dist/cli.js mcp --http 3001 # Streamable HTTP, for MCP Apps hosts / inspector
482
+ PLAYWRIGHT_FROM=/tmp/bh node test/app-host-e2e.mjs http://localhost:8090 # explorer as MCP App in basic-host
483
+ node test/explorer-e2e.mjs [out-prefix] # temp project + daemon, drives inbox → instance → flows; screenshots
484
+ # (PLAYWRIGHT_FROM=<dir with playwright>)
485
+ ```
486
+
487
+ The explorer's Instances tab is the nano console's Process Explorer
488
+ ([`@nanobpm/process-explorer`](https://github.com/nanobpm/nano-bpm/tree/main/process-explorer)),
489
+ over the daemon's `/api/explorer/*` routes (`src/explorer-api.ts` maps the engine snapshot and
490
+ event log onto the console's wire model, including the trace). It isn't on npm yet
491
+ ([nanobpm/nano-bpm#1475](https://github.com/nanobpm/nano-bpm/issues/1475)) and npm can't install a
492
+ git subdirectory, so `scripts/fetch-explorer.mjs` sparse-clones it at a pinned commit into
493
+ `node_modules/.cache/nano-bpm` and the build bundles it. Bump `NANO_BPM_REV` to update it.
494
+
495
+ Flow files import `"@nanobpm/nano-agent-graph-engine"` (or the old `"agent-graph-engine"`). The
496
+ daemon maps those specifiers to `dist/index.js` with `module.registerHooks`, and `nage check`
497
+ type-checks against declarations shipped in `dist/typecheck`, so the user's project needs no install.
498
+
499
+ To try the plugin from a checkout: `npm run build`, then `claude --plugin-dir .`.
500
+
501
+ ### Releasing
502
+
503
+ Releases work as in nanobpm/nano-ide, with [release-please](https://github.com/googleapis/release-please):
504
+
505
+ - `main` is squash-merged, so PR titles become the commits. Write them as Conventional Commits
506
+ (`feat: …`, `fix: …`, `feat!: …`); `pr-title-lint` checks this. A `feat` bumps the minor
507
+ version (the patch while we're on 0.x), `fix`/`perf`/`deps`/`revert` the patch; `docs`,
508
+ `chore`, `ci`, `test` and `refactor` land without a release.
509
+ - release-please keeps one release PR open. It bumps `package.json`, `.claude-plugin/plugin.json`,
510
+ `.claude-plugin/marketplace.json` and `CHANGELOG.md`, and auto-merges once CI is green.
511
+ Never bump versions by hand.
512
+ - Merging it tags `vX.Y.Z` and cuts the GitHub Release. When CI then passes on `main`,
513
+ `release.yml` runs `scripts/publish.mjs`: it publishes to npm (Trusted Publisher, with
514
+ provenance), attaches the Desktop extension (`npm run pack:mcpb`) to the release, and commits the
515
+ built plugin to the `release` branch (`scripts/publish-plugin-branch.mjs`). Each step checks
516
+ first, so re-runs are safe.
517
+
518
+ ## Limitations and next steps
519
+
520
+ - The explorer draws the *current* BPMN of a flow, even for instances started on an older version (the flow id is the definition key).
521
+ - The explorer polls (every 1.5 s); the daemon has no push feed.
522
+ - The journal is rewritten whole on each change. Fine for local use, but long-lived projects will want compaction (snapshot + tail).
523
+ - One process: `run` handlers share the daemon. A blocking handler stalls ticks; use async APIs.
524
+ - Headless agents never prompt for permissions: list the tools they need in `agents.<step>.allowedTools`. No cost caps yet beyond what you set in prompts. Spend is logged per job.
525
+ - Not yet verified inside a real Claude Code session: the local OAuth token had expired (`claude -p` → 401). The plugin validates, and `claude mcp list` shows `agent-graph` ✔ Connected.
526
+ - MCP Apps view verified in the ext-apps reference host (`test/app-host-e2e.mjs`). Claude Desktop's own rendering has not been verified yet.
527
+ - Next: a mods pane/status line and `$.prompt.submit` for session jobs, plus MCP tasks for "start and wait".