@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,30 @@
1
+ {
2
+ "description": "Agent Graph: settings hooks (pending-task reminders) and the interface mod",
3
+ "modules": [
4
+ "./mod.js"
5
+ ],
6
+ "hooks": {
7
+ "SessionStart": [
8
+ {
9
+ "hooks": [
10
+ {
11
+ "type": "command",
12
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/dist/cli.js\" hook SessionStart",
13
+ "timeout": 5
14
+ }
15
+ ]
16
+ }
17
+ ],
18
+ "UserPromptSubmit": [
19
+ {
20
+ "hooks": [
21
+ {
22
+ "type": "command",
23
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/dist/cli.js\" hook UserPromptSubmit",
24
+ "timeout": 5
25
+ }
26
+ ]
27
+ }
28
+ ]
29
+ }
30
+ }
package/hooks/mod.js ADDED
@@ -0,0 +1,461 @@
1
+ // Agent Graph mod for Claude Code: makes the flow engine part of the interface.
2
+ // - a band above the prompt: running flows, tasks waiting for you, incidents
3
+ // - /flows opens a pane: start a flow, answer user tasks, retry/cancel incidents
4
+ // - "Open ↗" links go to the web explorer, at what needs you (a waiting task, the one
5
+ // running flow, else the flows); in the Desktop app they open in its Browser pane
6
+ // - wakes the agent when a flow hands agent steps to this session
7
+ // One engine serves every project. The mod talks to it over its local HTTP API (address
8
+ // in ~/.agent-graph/daemon.json), shows this project's flows plus the global ones, and
9
+ // all running work with other projects' marked. It never starts a model turn except to
10
+ // hand this project's session jobs to the agent.
11
+
12
+ const PANE = 'agent-graph'
13
+ const POLL_MS = 3000
14
+
15
+ let project = ''
16
+ let url = ''
17
+ let engineFile = '' // ~/.agent-graph/daemon.json (AGE_STATE_DIR)
18
+ let registered = '' // engine url this project was registered with
19
+ let state = null // last /api/state, trimmed
20
+ let error = ''
21
+ let tab = 'inbox'
22
+ let startFor = '' // flow id whose start form is open
23
+ let drafts = {} // user task key -> { field: value }
24
+ let woken = new Set() // session job keys already handed to the agent
25
+ let notified = new Set() // user task keys already toasted
26
+
27
+ const plural = (n, w) => n + ' ' + w + (n === 1 ? '' : 's')
28
+
29
+ /** The project this session works on: nearest ancestor with flows/, else the git root,
30
+ * else the cwd — or ~/AgentGraph (the global library) in / or $HOME. */
31
+ async function findProject($, cwd) {
32
+ const home = (await $.env.get('HOME')) || ''
33
+ if (cwd === '/' || cwd === home) return (await $.env.get('AGE_HOME')) || home + '/AgentGraph'
34
+ let git = ''
35
+ for (let dir = cwd; dir && dir !== home; ) {
36
+ if (await $.fs.exists(dir + '/flows')) return dir
37
+ if (!git && (await $.fs.exists(dir + '/.git'))) git = dir
38
+ const up = dir.replace(/\/[^/]+\/?$/, '') || '/'
39
+ if (up === dir) break
40
+ dir = up
41
+ }
42
+ return git || cwd
43
+ }
44
+
45
+ const base = (p) => String(p || '').split('/').filter(Boolean).pop() || p
46
+ /** " · <project>" for work that belongs to another project. */
47
+ const elsewhere = (x) => (x && x.project && x.project !== project ? ' · ' + base(x.project) : '')
48
+ // the Desktop app only links http://localhost (engines before 0.5.2 wrote 127.0.0.1)
49
+ const explorerUrl = () => url.replace('//127.0.0.1:', '//localhost:') + '/?project=' + encodeURIComponent(project)
50
+
51
+ async function api($, path, body) {
52
+ const r = await $.http.fetch(url + path, body === undefined ? {} : { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) })
53
+ const data = r.text ? JSON.parse(r.text) : {}
54
+ if (!r.ok) throw new Error(data.error || 'HTTP ' + r.status)
55
+ return data
56
+ }
57
+
58
+ async function refresh($) {
59
+ if (!project) return
60
+ let info
61
+ try {
62
+ info = JSON.parse(await $.fs.read(engineFile))
63
+ } catch {
64
+ url = ''
65
+ state = null
66
+ $.ui.invalidate('ui.render')
67
+ return
68
+ }
69
+ url = info.url
70
+ try {
71
+ // A project with flows/ joins the engine as soon as the engine is up.
72
+ if (registered !== url && (await $.fs.exists(project + '/flows'))) {
73
+ await api($, '/api/projects', { path: project })
74
+ registered = url
75
+ }
76
+ const s = await api($, '/api/state?project=' + encodeURIComponent(project))
77
+ state = {
78
+ flows: s.flows || [],
79
+ globalDir: s.globalDir || '',
80
+ instances: (s.instances || []).filter((i) => !i.completed),
81
+ userTasks: s.userTasks || [],
82
+ // agent steps for this session: only runs in this project
83
+ sessionJobs: (s.sessionJobs || []).filter((j) => j.state === 'Created' && (!j.project || j.project === project)),
84
+ incidents: (s.incidents || []).filter((i) => i.state !== 'Resolved'),
85
+ problems: s.problems || [],
86
+ }
87
+ error = ''
88
+ } catch (e) {
89
+ state = null
90
+ url = ''
91
+ error = String((e && e.message) || e)
92
+ }
93
+ await announce($)
94
+ $.ui.invalidate('ui.render')
95
+ }
96
+
97
+ /** Toast new user tasks; hand new session jobs to the agent. */
98
+ async function announce($) {
99
+ if (!state) return
100
+ for (const t of state.userTasks) {
101
+ if (notified.has(t.key)) continue
102
+ notified.add(t.key)
103
+ $.ui.toast('Flow ' + (t.title || t.flowId) + elsewhere(t) + ' is waiting for you: ' + ((t.form && t.form.title) || t.elementId) + ' — /flows')
104
+ }
105
+ const fresh = state.sessionJobs.filter((j) => !woken.has(j.key))
106
+ if (!fresh.length) return
107
+ for (const j of fresh) woken.add(j.key)
108
+ // don't await: submit waits for the session to be idle
109
+ $.prompt.submit({
110
+ text:
111
+ 'Agent Graph: ' + plural(fresh.length, 'agent step') + ' from running flows are waiting for this session. ' +
112
+ 'Call session_job_next' + (fresh.length > 1 ? ' with max ' + fresh.length + ' (use subagents for them if you can)' : '') +
113
+ ', do the work, and hand back each result with session_job_complete.',
114
+ })
115
+ }
116
+
117
+ async function startEngine($) {
118
+ try {
119
+ const r = await $.process.run(['node', $.plugin.root + '/dist/cli.js', 'up', '--project', project], { timeoutMs: 20000 })
120
+ if (r.exitCode !== 0) error = (r.stderr || r.stdout || 'engine did not start').trim()
121
+ } catch (e) {
122
+ error = String((e && e.message) || e)
123
+ }
124
+ await refresh($)
125
+ }
126
+
127
+ /** Opens the web explorer in the browser via `nage open`, which starts the engine if
128
+ * needed. `view` is an explorer route: instance=K, task=K, flow=ID, or empty. */
129
+ async function openExplorer($, view) {
130
+ try {
131
+ const argv = ['node', $.plugin.root + '/dist/cli.js', 'open', ...(view ? [view] : []), '--project', project]
132
+ const r = await $.process.run(argv, { timeoutMs: 20000 })
133
+ if (r.exitCode !== 0) throw new Error((r.stderr || r.stdout || 'could not open the explorer').trim())
134
+ await $.ui.toast('Opened the Agent Graph explorer: ' + r.stdout.trim())
135
+ } catch (e) {
136
+ await $.ui.toast('Agent Graph: ' + String((e && e.message) || e))
137
+ }
138
+ await refresh($)
139
+ }
140
+
141
+ /** The explorer view that needs you: a task waiting in this project, else this project's
142
+ * only running flow, else the flows. */
143
+ function bestView() {
144
+ if (!state) return ''
145
+ const here = (x) => !x.project || x.project === project
146
+ const task = state.userTasks.find(here) || state.userTasks[0]
147
+ if (task) return 'task=' + task.key
148
+ const incident = state.incidents.find(here)
149
+ if (incident) return 'instance=' + incident.instanceKey
150
+ const runs = state.instances.filter(here)
151
+ if (runs.length === 1) return 'instance=' + runs[0].key
152
+ return runs.length ? '/instances' : '/flows'
153
+ }
154
+
155
+ /** A way to open an explorer view. The terminal gets a button that opens the default
156
+ * browser (it can start the engine); the Desktop app and VS Code get a Link, which the
157
+ * Desktop app opens in its Browser pane. */
158
+ function openControl($, e, ui, key, label, view, hotkey) {
159
+ if (e.surface === 'terminal' || !url) return ui.Button({ key, label, hotkey, plain: true, onPress: () => openExplorer($, view) })
160
+ return ui.Link({ href: explorerUrl() + (view ? '#' + view.replace(/^#/, '') : ''), label })
161
+ }
162
+
163
+ async function startFlow($, flowId, input) {
164
+ const text = (input || '').trim()
165
+ let variables
166
+ if (!text) variables = {}
167
+ else if (/^[A-Za-z_][\w]*\s*=/.test(text)) {
168
+ // name=value pairs (quote values with spaces); the engine converts them to the input's types
169
+ variables = {}
170
+ for (const m of text.matchAll(/([A-Za-z_][\w]*)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\S+))/g)) variables[m[1]] = m[2] ?? m[3] ?? m[4]
171
+ } else {
172
+ try {
173
+ variables = JSON.parse(text)
174
+ } catch {
175
+ variables = undefined
176
+ }
177
+ }
178
+ startFor = ''
179
+ if (variables && typeof variables === 'object' && !Array.isArray(variables)) {
180
+ try {
181
+ const r = await api($, '/api/start', { flowId, variables, project, host: 'claude-code' })
182
+ $.ui.toast('Started ' + flowId + ' #' + r.instanceKey)
183
+ } catch (e) {
184
+ $.ui.toast('Could not start ' + flowId + ': ' + ((e && e.message) || e))
185
+ }
186
+ await refresh($)
187
+ return
188
+ }
189
+ // plain words: let the agent work out the start variables
190
+ $.prompt.submit({ text: 'Start the Agent Graph flow "' + flowId + '" for: ' + text + '. Work out its start variables (flow_read if unsure), then flow_start.', asUser: true })
191
+ }
192
+
193
+ async function completeTask($, task) {
194
+ const vars = { ...defaults(task), ...(drafts[task.key] || {}) }
195
+ const missing = ((task.form && task.form.required) || []).filter((k) => vars[k] === undefined || vars[k] === '')
196
+ if (missing.length) {
197
+ $.ui.toast('Fill in: ' + missing.join(', '))
198
+ return
199
+ }
200
+ try {
201
+ await api($, '/api/user-tasks/' + task.key + '/complete', { variables: vars })
202
+ delete drafts[task.key]
203
+ $.ui.toast('Answered ' + ((task.form && task.form.title) || task.elementId))
204
+ } catch (e) {
205
+ $.ui.toast('Could not complete the task: ' + ((e && e.message) || e))
206
+ }
207
+ await refresh($)
208
+ }
209
+
210
+ function defaults(task) {
211
+ const out = {}
212
+ const fields = (task.form && task.form.fields) || {}
213
+ for (const k of Object.keys(fields)) if (fields[k].default !== undefined) out[k] = fields[k].default
214
+ return out
215
+ }
216
+
217
+ function coerce(field, v) {
218
+ if (field.type === 'number' || field.type === 'integer') return v === '' ? undefined : Number(v)
219
+ if (field.type === 'boolean') return v === 'true'
220
+ return v
221
+ }
222
+
223
+ async function resolveIncident($, inc) {
224
+ try {
225
+ await api($, '/api/incidents/' + inc.key + '/resolve', { retries: 1 })
226
+ $.ui.toast('Retrying ' + inc.elementId)
227
+ } catch (e) {
228
+ $.ui.toast('Retry failed: ' + ((e && e.message) || e))
229
+ }
230
+ await refresh($)
231
+ }
232
+
233
+ async function cancelInstance($, key) {
234
+ try {
235
+ await api($, '/api/instances/' + key + '/cancel', {})
236
+ $.ui.toast('Cancelled #' + key)
237
+ } catch (e) {
238
+ $.ui.toast('Cancel failed: ' + ((e && e.message) || e))
239
+ }
240
+ await refresh($)
241
+ }
242
+
243
+ export function register(on) {
244
+ on('session.start', async ($, e, next) => {
245
+ // Register before next(): the Desktop app and VS Code take their / menu from what is
246
+ // registered when the session starts.
247
+ try {
248
+ await $.command.register({ name: 'flows', description: 'Agent Graph: start flows, answer tasks, handle incidents', argumentHint: '[flows | runs]', immediate: true })
249
+ } catch (err) {
250
+ error = String((err && err.message) || err)
251
+ }
252
+ const r = await next(e)
253
+ project = await findProject($, (r && r.cwd) || e.cwd || (await $.session.cwd()))
254
+ engineFile = ((await $.env.get('AGE_STATE_DIR')) || ((await $.env.get('HOME')) || '') + '/.agent-graph') + '/daemon.json'
255
+ await refresh($)
256
+ $.clock.every(POLL_MS, () => refresh($))
257
+ return r
258
+ })
259
+
260
+ on('command.run', { command: 'flows' }, async ($, e) => {
261
+ await refresh($)
262
+ const arg = (e.args || '').trim()
263
+ if (arg === 'start' || arg === 'flows') tab = 'flows'
264
+ else if (arg === 'runs') tab = 'runs'
265
+ else if (state && !state.userTasks.length && !state.incidents.length) tab = 'flows'
266
+ await $.ui.open({ id: PANE, title: 'Agent Graph', focus: true, closeOnEscape: true })
267
+ return {}
268
+ })
269
+
270
+ // the band above the prompt: only while something is going on
271
+ on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
272
+ if (!state) return next(e)
273
+ const tasks = state.userTasks.length
274
+ const incidents = state.incidents.length
275
+ const running = state.instances.length
276
+ if (!tasks && !incidents && !running) return next(e)
277
+ const ui = $.ui.resolve(e)
278
+ const { Box, Text, Button } = ui
279
+ const away = state.instances.filter((i) => elsewhere(i)).length
280
+ const parts = [plural(running, 'flow') + ' running' + (away ? ' (' + away + ' in other projects)' : '')]
281
+ if (tasks) parts.push(plural(tasks, 'task') + ' waiting for you')
282
+ if (incidents) parts.push(plural(incidents, 'incident'))
283
+ const mine = Box({
284
+ flexDirection: 'row',
285
+ columnGap: 2,
286
+ children: [
287
+ Text({ color: incidents ? 'red' : tasks ? 'yellow' : undefined, children: ['⚙ Agent Graph · ' + parts.join(' · ')] }),
288
+ Button({
289
+ key: 'open-flows',
290
+ label: tasks ? 'Answer' : 'Open',
291
+ plain: true,
292
+ onPress: async () => {
293
+ tab = tasks || incidents ? 'inbox' : 'runs'
294
+ await $.ui.open({ id: PANE, title: 'Agent Graph', focus: true, closeOnEscape: true })
295
+ },
296
+ }),
297
+ openControl($, e, ui, 'band-explorer', 'Open ↗', bestView()),
298
+ ],
299
+ })
300
+ const theirs = await next(e)
301
+ return theirs ? Box({ flexDirection: 'column', children: [mine, theirs] }) : mine
302
+ })
303
+
304
+ on('ui.render', { component: 'Pane' }, async ($, e, next) => {
305
+ if (e.requestId !== PANE) return next(e)
306
+ const ui = $.ui.resolve(e)
307
+ const { Box, Text, Button, Input, Select } = ui
308
+ const redraw = () => $.ui.invalidate('ui.render')
309
+ const width = (e.props && e.props.bodyColumns) || 60
310
+ const dim = (s) => Text({ dimColor: true, children: [s] })
311
+
312
+ if (!state) {
313
+ return Box({
314
+ flexDirection: 'column',
315
+ rowGap: 1,
316
+ children: [
317
+ Text({ children: ['The Agent Graph engine is not running.'] }),
318
+ error ? Text({ color: 'red', children: [error] }) : dim('It starts with the first flow tool call, or here.'),
319
+ Button({ key: 'start-engine', label: 'Start engine', hotkey: 's', variant: 'primary', onPress: () => startEngine($) }),
320
+ ],
321
+ })
322
+ }
323
+
324
+ const tabButton = (name, label, hotkey) =>
325
+ Button({ key: 'tab-' + name, label, hotkey, plain: true, dimColor: tab !== name, onPress: () => ((tab = name), redraw()) })
326
+ const header = Box({
327
+ flexDirection: 'row',
328
+ columnGap: 3,
329
+ children: [
330
+ tabButton('inbox', 'Inbox (' + (state.userTasks.length + state.incidents.length) + ')', '1'),
331
+ tabButton('flows', 'Flows (' + state.flows.length + ')', '2'),
332
+ tabButton('runs', 'Runs (' + state.instances.length + ')', '3'),
333
+ openControl($, e, ui, 'open-explorer', 'Open ↗', bestView(), 'o'),
334
+ ],
335
+ })
336
+
337
+ let body = []
338
+ if (tab === 'inbox') {
339
+ if (!state.userTasks.length && !state.incidents.length) body.push(dim('Nothing is waiting for you.'))
340
+ for (const t of state.userTasks) {
341
+ const form = t.form || { fields: {} }
342
+ const draft = drafts[t.key] || (drafts[t.key] = {})
343
+ const rows = [
344
+ Text({ bold: true, children: [(form.title || t.elementId) + ' '] }),
345
+ dim((t.title || t.flowId) + ' #' + t.instanceKey + elsewhere(t)),
346
+ ]
347
+ if (form.description) rows.push(Text({ wrap: 'wrap', children: [String(form.description).slice(0, 4000)] }))
348
+ for (const [name, field] of Object.entries(form.fields || {})) {
349
+ const label = (field.title || name) + (((form.required || []).includes(name)) ? ' *' : '')
350
+ const key = 'f-' + t.key + '-' + name
351
+ if (field.type === 'boolean' || field.enum) {
352
+ const options = field.type === 'boolean'
353
+ ? [{ value: 'true', label: 'Yes' }, { value: 'false', label: 'No' }]
354
+ : field.enum.map((v, i) => ({ value: v, label: (field.enumNames && field.enumNames[i]) || v }))
355
+ const cur = draft[name] !== undefined ? String(draft[name]) : field.default !== undefined ? String(field.default) : undefined
356
+ rows.push(Select({ key, label, options, ...(cur !== undefined ? { value: cur } : {}), onSelect: (v) => ((draft[name] = coerce(field, v)), redraw()) }))
357
+ } else {
358
+ rows.push(
359
+ Input({
360
+ key,
361
+ label,
362
+ placeholder: field.description || '',
363
+ value: draft[name] !== undefined ? String(draft[name]) : '',
364
+ onInput: (v) => (draft[name] = coerce(field, v)),
365
+ onSubmit: (v) => ((draft[name] = coerce(field, v)), redraw()),
366
+ }),
367
+ )
368
+ }
369
+ }
370
+ rows.push(Button({ key: 'submit-' + t.key, label: 'Submit', variant: 'primary', onPress: () => completeTask($, t) }))
371
+ body.push(Box({ flexDirection: 'column', borderStyle: 'round', paddingX: 1, children: rows }))
372
+ }
373
+ for (const inc of state.incidents) {
374
+ body.push(
375
+ Box({
376
+ flexDirection: 'column',
377
+ borderStyle: 'round',
378
+ borderColor: 'red',
379
+ paddingX: 1,
380
+ children: [
381
+ Text({ color: 'red', children: ['Incident in #' + inc.instanceKey + ' at ' + inc.elementId + elsewhere(inc)] }),
382
+ Text({ wrap: 'wrap', children: [String(inc.errorMessage || inc.message || '').slice(0, 1000)] }),
383
+ Box({
384
+ flexDirection: 'row',
385
+ columnGap: 2,
386
+ children: [
387
+ Button({ key: 'retry-' + inc.key, label: 'Retry', onPress: () => resolveIncident($, inc) }),
388
+ Button({ key: 'fix-' + inc.key, label: 'Ask Claude to fix', onPress: () => $.prompt.submit({ text: 'Agent Graph incident in instance ' + inc.instanceKey + ' at ' + inc.elementId + ': ' + (inc.errorMessage || '') + '. Find the cause, fix the flow with flow_write if needed, then retry with flow_operate.', asUser: true }) }),
389
+ Button({ key: 'cancel-' + inc.key, label: 'Cancel run', onPress: () => cancelInstance($, inc.instanceKey) }),
390
+ ],
391
+ }),
392
+ ],
393
+ }),
394
+ )
395
+ }
396
+ } else if (tab === 'flows') {
397
+ // Project flows, then the shared library's (~/AgentGraph/flows), which run here too.
398
+ const sections = state.globalDir && state.globalDir !== project
399
+ ? [
400
+ ['Project flows · ' + base(project), state.flows.filter((f) => f.scope !== 'global'), 'None in ' + project + '/flows. Ask Claude to write one, e.g. "make a flow that…".'],
401
+ ['Global flows', state.flows.filter((f) => f.scope === 'global'), 'None in ' + String(state.globalDir) + '/flows.'],
402
+ ]
403
+ : [['', state.flows, 'No flows yet. Ask Claude to write one, e.g. "make a flow that…".']]
404
+ for (const [label, list, empty] of sections) {
405
+ if (label) body.push(Text({ bold: true, dimColor: true, children: [label + ' (' + list.length + ')'] }))
406
+ if (!list.length) body.push(dim(empty))
407
+ for (const f of list) {
408
+ const row = [
409
+ Box({
410
+ flexDirection: 'row',
411
+ columnGap: 2,
412
+ children: [
413
+ Button({ key: 'start-' + f.id, label: 'Start', onPress: () => ((startFor = startFor === f.id ? '' : f.id), redraw()) }),
414
+ Text({ bold: true, children: [f.id] }),
415
+ ],
416
+ }),
417
+ ]
418
+ if (f.description) row.push(dim(String(f.description).slice(0, width * 2)))
419
+ if (startFor === f.id)
420
+ row.push(
421
+ Input({
422
+ key: 'inputs-' + f.id,
423
+ label: 'Inputs',
424
+ placeholder: f.input
425
+ ? f.input.fields.map((x) => x.name + '=…').join(' ') + ' (' + f.input.fields.map((x) => x.name + (x.optional ? '?' : '') + ': ' + x.type + (x.list ? '[]' : '')).join(', ') + '), JSON, or words for Claude'
426
+ : 'JSON variables, or describe it in words for Claude',
427
+ value: '',
428
+ submitLabel: 'start',
429
+ autoFocus: true,
430
+ onSubmit: (v) => startFlow($, f.id, v),
431
+ }),
432
+ )
433
+ body.push(Box({ flexDirection: 'column', children: row }))
434
+ }
435
+ }
436
+ for (const p of state.problems.slice(0, 5)) body.push(Text({ color: 'red', children: [(p.file || '') + ': ' + (p.message || '')] }))
437
+ } else {
438
+ if (!state.instances.length) body.push(dim('No flows running.'))
439
+ for (const i of state.instances) {
440
+ body.push(
441
+ Box({
442
+ flexDirection: 'row',
443
+ columnGap: 2,
444
+ children: [
445
+ Text({ bold: true, children: ['#' + i.key] }),
446
+ Text({ children: [(i.title || i.flowId) + ' → ' + ((i.activeElements || []).join(', ') || i.state) + elsewhere(i)] }),
447
+ openControl($, e, ui, 'open-run-' + i.key, '↗', 'instance=' + i.key),
448
+ Button({ key: 'cancel-run-' + i.key, label: 'x', plain: true, onPress: () => cancelInstance($, i.key) }),
449
+ ],
450
+ }),
451
+ )
452
+ }
453
+ }
454
+
455
+ return Box({
456
+ flexDirection: 'column',
457
+ rowGap: 1,
458
+ children: [header, ...body],
459
+ })
460
+ })
461
+ }
package/package.json CHANGED
@@ -1,6 +1,82 @@
1
1
  {
2
2
  "name": "@nanobpm/nano-agent-graph-engine",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.18.0",
4
+ "description": "Durable BPMN process engine for Claude Code: code-first flows (defineFlow) that orchestrate scripts, Claude Code agents and people.",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/nanobpm/nano-agent-graph-engine.git"
9
+ },
10
+ "homepage": "https://github.com/nanobpm/nano-agent-graph-engine#readme",
11
+ "bugs": "https://github.com/nanobpm/nano-agent-graph-engine/issues",
12
+ "keywords": [
13
+ "bpmn",
14
+ "workflow",
15
+ "orchestration",
16
+ "agents",
17
+ "mcp",
18
+ "claude-code",
19
+ "opencode",
20
+ "durable"
21
+ ],
22
+ "type": "module",
23
+ "bin": {
24
+ "nage": "dist/cli.js",
25
+ "nano-agent-graph": "dist/cli.js",
26
+ "age": "dist/cli.js"
27
+ },
28
+ "main": "dist/index.js",
29
+ "types": "dist/typecheck/agent-graph-engine/index.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/typecheck/agent-graph-engine/index.d.ts",
33
+ "default": "./dist/index.js"
34
+ },
35
+ "./package.json": "./package.json"
36
+ },
37
+ "files": [
38
+ "dist",
39
+ "skills",
40
+ "hooks/hooks.json",
41
+ "hooks/mod.js",
42
+ ".claude-plugin",
43
+ ".mcp.json",
44
+ "README.md"
45
+ ],
46
+ "engines": {
47
+ "node": ">=22.15"
48
+ },
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "scripts": {
53
+ "build": "node scripts/fetch-explorer.mjs && npm run typecheck && node scripts/build.mjs",
54
+ "typecheck": "tsc --noEmit && tsc -p ui/tsconfig.json",
55
+ "test": "npm run test:engine && claude plugin test .",
56
+ "test:engine": "node --test test/*.spec.ts",
57
+ "pack:mcpb": "node scripts/package-mcpb.mjs",
58
+ "prepack": "node -e \"require('fs').accessSync('dist/cli.js')\""
59
+ },
60
+ "devDependencies": {
61
+ "@modelcontextprotocol/ext-apps": "^1.7.5",
62
+ "@modelcontextprotocol/sdk": "^1.32.2",
63
+ "@nanobpm/agentic": "^0.16.0",
64
+ "@nanobpm/engine-wasm": "^0.11.0",
65
+ "@nanobpm/nano-app-schema": "^0.11.0",
66
+ "@nanobpm/workflow": "^0.19.0",
67
+ "@tailwindcss/cli": "^4.3.5",
68
+ "@tanstack/react-query": "^5.107.1",
69
+ "@types/node": "^26.6.6",
70
+ "@types/react": "^18.3.31",
71
+ "@types/react-dom": "^18.3.7",
72
+ "bpmn-auto-layout": "^2.0.0-alpha.2",
73
+ "bpmn-auto-layout-v1": "npm:bpmn-auto-layout@^1.3.0",
74
+ "bpmn-js": "^18.31.1",
75
+ "esbuild": "^0.28.2",
76
+ "react": "^18.3.1",
77
+ "react-dom": "^18.3.1",
78
+ "tailwindcss": "^4.3.5",
79
+ "typescript": "5.9",
80
+ "zod": "^4.6.7"
81
+ }
82
+ }
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: agent-graph
3
+ description: Run and operate durable workflows ("flows") with the Agent Graph Engine — start flows (with their inputs), answer user tasks, do agent steps assigned to this session, watch runs and fix incidents. Use when the user wants to run a flow, asks what's running or waiting, has a task or incident to deal with, or wants to automate a repeatable multi-step process (then also load agent-graph-authoring to write the flow).
4
+ ---
5
+
6
+ # Agent Graph Engine — running flows
7
+
8
+ A flow is a durable process (`flows/<name>.flow.ts`, compiled to BPMN) that mixes
9
+ scripts, headless agents, work for this session, timers and people. One engine per
10
+ user runs every project's flows, keeps its event log in `~/.agent-graph/`, and keeps
11
+ going after this session ends. It starts on demand and redeploys flows when files
12
+ change. **To write or change a flow, use the `agent-graph-authoring` skill** (or
13
+ `flow_guide` when you have no skills).
14
+
15
+ ## Tools
16
+
17
+ | Tool | Use |
18
+ |---|---|
19
+ | `flow_status` | Flows this project can start — with their **input** as `id(field: type, optional?: type)` — and runs, open tasks, incidents and running jobs in every project. Pass `instanceKey` for one run in detail (variables, activity). |
20
+ | `flow_start` | Start a run: `flowId`, `variables`, a short `title`; `agents` to run agent steps on another CLI/model for this run only (`{ "*": { "use": "opencode", "model": "…" }, "<step>": {…} }`). |
21
+ | `flow_agents` | Which CLI and model run a flow's agent steps, and why; `assign` changes it for every future run (whole flow, one `step`, or a `rank` such as `senior`; `null` clears). |
22
+ | `show_explorer` | The live explorer inline: diagrams with where runs are, start forms, the task inbox, incidents, agent transcripts. |
23
+ | `task_list` / `task_ask` | Open user tasks. `task_ask` shows the form to the user and completes the task with their answer. |
24
+ | `task_complete` | Complete a task with an answer the user gave you in chat (when dialogs aren't available). |
25
+ | `session_job_next` / `session_job_complete` / `session_job_fail` | Do work a flow assigned to *this* session. |
26
+ | `flow_operate` | `retry` an incident after fixing its cause, `cancel` a run, send a `message`. |
27
+ | `flow_list` / `flow_import` | This project's flows and the global ones (`~/AgentGraph/flows`, startable anywhere; they run in the project they're started in). Import copies a global flow here to customize it. |
28
+
29
+ **Never answer a user task yourself**: it is the person's decision. Use `task_ask`.
30
+
31
+ ## Starting a flow
32
+
33
+ - If the flow declares an input, `flow_status` shows it, e.g. `review(pr: integer, repo: string, note?: string)`. Pass exactly those fields as `variables`. Fill them in from the conversation, and ask the user only for required fields you can't infer.
34
+ - Text is fine. The engine converts it to the declared types: `"42"` becomes 42, `"yes"` becomes true, and `"a, b"` becomes a list. It refuses missing or wrong fields and names each one. Fix what it lists and call `flow_start` again.
35
+ - A flow without a declared input takes free-form variables. Read the flow (`flow_read`) to see which ones it uses.
36
+ - The user can also start a run from the explorer's start form, from `/flows` in Claude Code, or with `nage start <flow> --pr 42 --repo x`.
37
+ - After starting, show the run with `show_explorer`, or share the explorer URL.
38
+
39
+ ## While a run is going
40
+
41
+ - **User task waiting** (the hook or `flow_status` tells you): call `task_ask`, or `show_explorer` with the task.
42
+ - **Trying a flow on other models / running someone else's flow**: agent steps are typed `<rank>:<task>`; the CLI and model are the user's choice. "Run it on GPT-5 via OpenCode this time" → `flow_start` with `agents: { "*": { "use": "opencode", "model": "openai/gpt-5" } }`. "Always use nano-coder for the critique" → `flow_agents` with `assign: { step: "critique", use: "nano-coder" }`. A flow's suggested CLI that isn't installed is skipped; one the user assigned that isn't installed stops the step with an incident saying so (install it or change the assignment); `flow_agents` shows what runs each step. Presets: claude, opencode, nano-coder, gemini, qwen, kimi, copilot. Any other CLI: `nage agent add <name> --acp -- <cmd> [args]` for ACP agents, or `--exec` for anything that takes a prompt (`{prompt}` in its args, else stdin) and prints the answer.
43
+ - **Agent steps for this session**: `session_job_next`, do the work, `session_job_complete` with the result (JSON object → variables). Keep going until the run waits on the user or a timer, or is done. Batches (`max`) can go to subagents.
44
+ - **Incident** (a step failed 3 times): read it with `flow_status`. Fix the cause — often the flow code, which reloads on save, or a missing file or tool — then `flow_operate` `retry`, and the *same* run continues.
45
+ - **Changed steps** (added, removed or reordered): this deploys a new version. Running instances keep the old shape, so cancel them and start new runs.
46
+
47
+ CLI equivalent: `node <plugin>/dist/cli.js status|start|tasks|complete|up|down|open`.