@kindgi/cli 0.0.0-bootstrap.0 → 0.1.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 (496) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +690 -1
  3. package/dist/build/apt.d.ts +16 -0
  4. package/dist/build/apt.d.ts.map +1 -0
  5. package/dist/build/apt.js +50 -0
  6. package/dist/build/apt.js.map +1 -0
  7. package/dist/build/bundle.d.ts +45 -0
  8. package/dist/build/bundle.d.ts.map +1 -0
  9. package/dist/build/bundle.js +121 -0
  10. package/dist/build/bundle.js.map +1 -0
  11. package/dist/build/containerfile.d.ts +27 -0
  12. package/dist/build/containerfile.d.ts.map +1 -0
  13. package/dist/build/containerfile.js +196 -0
  14. package/dist/build/containerfile.js.map +1 -0
  15. package/dist/build/context-files.d.ts +24 -0
  16. package/dist/build/context-files.d.ts.map +1 -0
  17. package/dist/build/context-files.js +99 -0
  18. package/dist/build/context-files.js.map +1 -0
  19. package/dist/build/defaults.d.ts +66 -0
  20. package/dist/build/defaults.d.ts.map +1 -0
  21. package/dist/build/defaults.js +586 -0
  22. package/dist/build/defaults.js.map +1 -0
  23. package/dist/build/envelope.d.ts +72 -0
  24. package/dist/build/envelope.d.ts.map +1 -0
  25. package/dist/build/envelope.js +76 -0
  26. package/dist/build/envelope.js.map +1 -0
  27. package/dist/build/host-install.d.ts +48 -0
  28. package/dist/build/host-install.d.ts.map +1 -0
  29. package/dist/build/host-install.js +375 -0
  30. package/dist/build/host-install.js.map +1 -0
  31. package/dist/build/image-config.d.ts +32 -0
  32. package/dist/build/image-config.d.ts.map +1 -0
  33. package/dist/build/image-config.js +129 -0
  34. package/dist/build/image-config.js.map +1 -0
  35. package/dist/build/integrity.d.ts +51 -0
  36. package/dist/build/integrity.d.ts.map +1 -0
  37. package/dist/build/integrity.js +75 -0
  38. package/dist/build/integrity.js.map +1 -0
  39. package/dist/build/node-image.d.ts +18 -0
  40. package/dist/build/node-image.d.ts.map +1 -0
  41. package/dist/build/node-image.js +46 -0
  42. package/dist/build/node-image.js.map +1 -0
  43. package/dist/build/pack-root.d.ts +69 -0
  44. package/dist/build/pack-root.d.ts.map +1 -0
  45. package/dist/build/pack-root.js +102 -0
  46. package/dist/build/pack-root.js.map +1 -0
  47. package/dist/build/poetry-requirements.d.ts +5 -0
  48. package/dist/build/poetry-requirements.d.ts.map +1 -0
  49. package/dist/build/poetry-requirements.js +8 -0
  50. package/dist/build/poetry-requirements.js.map +1 -0
  51. package/dist/build/python-image.d.ts +40 -0
  52. package/dist/build/python-image.d.ts.map +1 -0
  53. package/dist/build/python-image.js +197 -0
  54. package/dist/build/python-image.js.map +1 -0
  55. package/dist/build/runners.d.ts +259 -0
  56. package/dist/build/runners.d.ts.map +1 -0
  57. package/dist/build/runners.js +4 -0
  58. package/dist/build/runners.js.map +1 -0
  59. package/dist/build/version-specifier.d.ts +2 -0
  60. package/dist/build/version-specifier.d.ts.map +1 -0
  61. package/dist/build/version-specifier.js +70 -0
  62. package/dist/build/version-specifier.js.map +1 -0
  63. package/dist/cli-package.d.ts +15 -0
  64. package/dist/cli-package.d.ts.map +1 -0
  65. package/dist/cli-package.js +37 -0
  66. package/dist/cli-package.js.map +1 -0
  67. package/dist/cli.d.ts +3 -0
  68. package/dist/cli.d.ts.map +1 -0
  69. package/dist/cli.js +26 -0
  70. package/dist/cli.js.map +1 -0
  71. package/dist/commands/adapters.d.ts +3 -0
  72. package/dist/commands/adapters.d.ts.map +1 -0
  73. package/dist/commands/adapters.js +148 -0
  74. package/dist/commands/adapters.js.map +1 -0
  75. package/dist/commands/agents.d.ts +3 -0
  76. package/dist/commands/agents.d.ts.map +1 -0
  77. package/dist/commands/agents.js +82 -0
  78. package/dist/commands/agents.js.map +1 -0
  79. package/dist/commands/approvals.d.ts +3 -0
  80. package/dist/commands/approvals.d.ts.map +1 -0
  81. package/dist/commands/approvals.js +92 -0
  82. package/dist/commands/approvals.js.map +1 -0
  83. package/dist/commands/artifacts.d.ts +3 -0
  84. package/dist/commands/artifacts.d.ts.map +1 -0
  85. package/dist/commands/artifacts.js +87 -0
  86. package/dist/commands/artifacts.js.map +1 -0
  87. package/dist/commands/auth.d.ts +3 -0
  88. package/dist/commands/auth.d.ts.map +1 -0
  89. package/dist/commands/auth.js +88 -0
  90. package/dist/commands/auth.js.map +1 -0
  91. package/dist/commands/build.d.ts +39 -0
  92. package/dist/commands/build.d.ts.map +1 -0
  93. package/dist/commands/build.js +872 -0
  94. package/dist/commands/build.js.map +1 -0
  95. package/dist/commands/capabilities.d.ts +3 -0
  96. package/dist/commands/capabilities.d.ts.map +1 -0
  97. package/dist/commands/capabilities.js +38 -0
  98. package/dist/commands/capabilities.js.map +1 -0
  99. package/dist/commands/conversations.d.ts +3 -0
  100. package/dist/commands/conversations.d.ts.map +1 -0
  101. package/dist/commands/conversations.js +75 -0
  102. package/dist/commands/conversations.js.map +1 -0
  103. package/dist/commands/deploy.d.ts +7 -0
  104. package/dist/commands/deploy.d.ts.map +1 -0
  105. package/dist/commands/deploy.js +697 -0
  106. package/dist/commands/deploy.js.map +1 -0
  107. package/dist/commands/dev.d.ts +44 -0
  108. package/dist/commands/dev.d.ts.map +1 -0
  109. package/dist/commands/dev.js +1032 -0
  110. package/dist/commands/dev.js.map +1 -0
  111. package/dist/commands/env.d.ts +27 -0
  112. package/dist/commands/env.d.ts.map +1 -0
  113. package/dist/commands/env.js +816 -0
  114. package/dist/commands/env.js.map +1 -0
  115. package/dist/commands/feedback.d.ts +33 -0
  116. package/dist/commands/feedback.d.ts.map +1 -0
  117. package/dist/commands/feedback.js +374 -0
  118. package/dist/commands/feedback.js.map +1 -0
  119. package/dist/commands/flows.d.ts +3 -0
  120. package/dist/commands/flows.d.ts.map +1 -0
  121. package/dist/commands/flows.js +60 -0
  122. package/dist/commands/flows.js.map +1 -0
  123. package/dist/commands/guardrails.d.ts +3 -0
  124. package/dist/commands/guardrails.d.ts.map +1 -0
  125. package/dist/commands/guardrails.js +89 -0
  126. package/dist/commands/guardrails.js.map +1 -0
  127. package/dist/commands/health.d.ts +8 -0
  128. package/dist/commands/health.d.ts.map +1 -0
  129. package/dist/commands/health.js +40 -0
  130. package/dist/commands/health.js.map +1 -0
  131. package/dist/commands/helpers.d.ts +37 -0
  132. package/dist/commands/helpers.d.ts.map +1 -0
  133. package/dist/commands/helpers.js +93 -0
  134. package/dist/commands/helpers.js.map +1 -0
  135. package/dist/commands/index.d.ts +7 -0
  136. package/dist/commands/index.d.ts.map +1 -0
  137. package/dist/commands/index.js +90 -0
  138. package/dist/commands/index.js.map +1 -0
  139. package/dist/commands/init.d.ts +46 -0
  140. package/dist/commands/init.d.ts.map +1 -0
  141. package/dist/commands/init.js +455 -0
  142. package/dist/commands/init.js.map +1 -0
  143. package/dist/commands/key.d.ts +3 -0
  144. package/dist/commands/key.d.ts.map +1 -0
  145. package/dist/commands/key.js +322 -0
  146. package/dist/commands/key.js.map +1 -0
  147. package/dist/commands/mcp.d.ts +43 -0
  148. package/dist/commands/mcp.d.ts.map +1 -0
  149. package/dist/commands/mcp.js +433 -0
  150. package/dist/commands/mcp.js.map +1 -0
  151. package/dist/commands/memory.d.ts +3 -0
  152. package/dist/commands/memory.d.ts.map +1 -0
  153. package/dist/commands/memory.js +82 -0
  154. package/dist/commands/memory.js.map +1 -0
  155. package/dist/commands/observations.d.ts +3 -0
  156. package/dist/commands/observations.d.ts.map +1 -0
  157. package/dist/commands/observations.js +27 -0
  158. package/dist/commands/observations.js.map +1 -0
  159. package/dist/commands/proposals.d.ts +3 -0
  160. package/dist/commands/proposals.d.ts.map +1 -0
  161. package/dist/commands/proposals.js +116 -0
  162. package/dist/commands/proposals.js.map +1 -0
  163. package/dist/commands/provenance.d.ts +3 -0
  164. package/dist/commands/provenance.d.ts.map +1 -0
  165. package/dist/commands/provenance.js +53 -0
  166. package/dist/commands/provenance.js.map +1 -0
  167. package/dist/commands/providers.d.ts +3 -0
  168. package/dist/commands/providers.d.ts.map +1 -0
  169. package/dist/commands/providers.js +202 -0
  170. package/dist/commands/providers.js.map +1 -0
  171. package/dist/commands/reviewers.d.ts +3 -0
  172. package/dist/commands/reviewers.d.ts.map +1 -0
  173. package/dist/commands/reviewers.js +78 -0
  174. package/dist/commands/reviewers.js.map +1 -0
  175. package/dist/commands/runs.d.ts +3 -0
  176. package/dist/commands/runs.d.ts.map +1 -0
  177. package/dist/commands/runs.js +221 -0
  178. package/dist/commands/runs.js.map +1 -0
  179. package/dist/commands/secrets.d.ts +21 -0
  180. package/dist/commands/secrets.d.ts.map +1 -0
  181. package/dist/commands/secrets.js +750 -0
  182. package/dist/commands/secrets.js.map +1 -0
  183. package/dist/commands/skills.d.ts +64 -0
  184. package/dist/commands/skills.d.ts.map +1 -0
  185. package/dist/commands/skills.js +430 -0
  186. package/dist/commands/skills.js.map +1 -0
  187. package/dist/commands/test.d.ts +5 -0
  188. package/dist/commands/test.d.ts.map +1 -0
  189. package/dist/commands/test.js +181 -0
  190. package/dist/commands/test.js.map +1 -0
  191. package/dist/commands/tokens.d.ts +3 -0
  192. package/dist/commands/tokens.d.ts.map +1 -0
  193. package/dist/commands/tokens.js +33 -0
  194. package/dist/commands/tokens.js.map +1 -0
  195. package/dist/commands/tools.d.ts +3 -0
  196. package/dist/commands/tools.d.ts.map +1 -0
  197. package/dist/commands/tools.js +153 -0
  198. package/dist/commands/tools.js.map +1 -0
  199. package/dist/commands/types.d.ts +54 -0
  200. package/dist/commands/types.d.ts.map +1 -0
  201. package/dist/commands/types.js +4 -0
  202. package/dist/commands/types.js.map +1 -0
  203. package/dist/commands/unwired.d.ts +17 -0
  204. package/dist/commands/unwired.d.ts.map +1 -0
  205. package/dist/commands/unwired.js +41 -0
  206. package/dist/commands/unwired.js.map +1 -0
  207. package/dist/commands/version.d.ts +8 -0
  208. package/dist/commands/version.d.ts.map +1 -0
  209. package/dist/commands/version.js +41 -0
  210. package/dist/commands/version.js.map +1 -0
  211. package/dist/config.d.ts +42 -0
  212. package/dist/config.d.ts.map +1 -0
  213. package/dist/config.js +83 -0
  214. package/dist/config.js.map +1 -0
  215. package/dist/context.d.ts +153 -0
  216. package/dist/context.d.ts.map +1 -0
  217. package/dist/context.js +44 -0
  218. package/dist/context.js.map +1 -0
  219. package/dist/deploy/defaults.d.ts +14 -0
  220. package/dist/deploy/defaults.d.ts.map +1 -0
  221. package/dist/deploy/defaults.js +37 -0
  222. package/dist/deploy/defaults.js.map +1 -0
  223. package/dist/deploy/envelope-loader.d.ts +24 -0
  224. package/dist/deploy/envelope-loader.d.ts.map +1 -0
  225. package/dist/deploy/envelope-loader.js +141 -0
  226. package/dist/deploy/envelope-loader.js.map +1 -0
  227. package/dist/deploy/post.d.ts +48 -0
  228. package/dist/deploy/post.d.ts.map +1 -0
  229. package/dist/deploy/post.js +210 -0
  230. package/dist/deploy/post.js.map +1 -0
  231. package/dist/deploy/response.d.ts +42 -0
  232. package/dist/deploy/response.d.ts.map +1 -0
  233. package/dist/deploy/response.js +128 -0
  234. package/dist/deploy/response.js.map +1 -0
  235. package/dist/deploy/runners.d.ts +218 -0
  236. package/dist/deploy/runners.d.ts.map +1 -0
  237. package/dist/deploy/runners.js +4 -0
  238. package/dist/deploy/runners.js.map +1 -0
  239. package/dist/dev/bundler.d.ts +8 -0
  240. package/dist/dev/bundler.d.ts.map +1 -0
  241. package/dist/dev/bundler.js +154 -0
  242. package/dist/dev/bundler.js.map +1 -0
  243. package/dist/dev/defaults.d.ts +138 -0
  244. package/dist/dev/defaults.d.ts.map +1 -0
  245. package/dist/dev/defaults.js +691 -0
  246. package/dist/dev/defaults.js.map +1 -0
  247. package/dist/dev/docker-compose.dev.yml +56 -0
  248. package/dist/dev/index-child.d.ts +2 -0
  249. package/dist/dev/index-child.d.ts.map +1 -0
  250. package/dist/dev/index-child.js +53 -0
  251. package/dist/dev/index-child.js.map +1 -0
  252. package/dist/dev/pack-code.d.ts +36 -0
  253. package/dist/dev/pack-code.d.ts.map +1 -0
  254. package/dist/dev/pack-code.js +129 -0
  255. package/dist/dev/pack-code.js.map +1 -0
  256. package/dist/dev/pack-env.d.ts +13 -0
  257. package/dist/dev/pack-env.d.ts.map +1 -0
  258. package/dist/dev/pack-env.js +36 -0
  259. package/dist/dev/pack-env.js.map +1 -0
  260. package/dist/dev/pack-service.d.ts +32 -0
  261. package/dist/dev/pack-service.d.ts.map +1 -0
  262. package/dist/dev/pack-service.js +188 -0
  263. package/dist/dev/pack-service.js.map +1 -0
  264. package/dist/dev/paths.d.ts +22 -0
  265. package/dist/dev/paths.d.ts.map +1 -0
  266. package/dist/dev/paths.js +35 -0
  267. package/dist/dev/paths.js.map +1 -0
  268. package/dist/dev/python-builder.d.ts +16 -0
  269. package/dist/dev/python-builder.d.ts.map +1 -0
  270. package/dist/dev/python-builder.js +122 -0
  271. package/dist/dev/python-builder.js.map +1 -0
  272. package/dist/dev/register.d.ts +71 -0
  273. package/dist/dev/register.d.ts.map +1 -0
  274. package/dist/dev/register.js +54 -0
  275. package/dist/dev/register.js.map +1 -0
  276. package/dist/dev/runners.d.ts +287 -0
  277. package/dist/dev/runners.d.ts.map +1 -0
  278. package/dist/dev/runners.js +4 -0
  279. package/dist/dev/runners.js.map +1 -0
  280. package/dist/dev/runtime-container.d.ts +62 -0
  281. package/dist/dev/runtime-container.d.ts.map +1 -0
  282. package/dist/dev/runtime-container.js +164 -0
  283. package/dist/dev/runtime-container.js.map +1 -0
  284. package/dist/dev/runtime-env.d.ts +62 -0
  285. package/dist/dev/runtime-env.d.ts.map +1 -0
  286. package/dist/dev/runtime-env.js +100 -0
  287. package/dist/dev/runtime-env.js.map +1 -0
  288. package/dist/dev/runtime-image.d.ts +13 -0
  289. package/dist/dev/runtime-image.d.ts.map +1 -0
  290. package/dist/dev/runtime-image.js +15 -0
  291. package/dist/dev/runtime-image.js.map +1 -0
  292. package/dist/env/defaults.d.ts +3 -0
  293. package/dist/env/defaults.d.ts.map +1 -0
  294. package/dist/env/defaults.js +22 -0
  295. package/dist/env/defaults.js.map +1 -0
  296. package/dist/env/pack-env-plan.d.ts +70 -0
  297. package/dist/env/pack-env-plan.d.ts.map +1 -0
  298. package/dist/env/pack-env-plan.js +236 -0
  299. package/dist/env/pack-env-plan.js.map +1 -0
  300. package/dist/env/parser.d.ts +9 -0
  301. package/dist/env/parser.d.ts.map +1 -0
  302. package/dist/env/parser.js +11 -0
  303. package/dist/env/parser.js.map +1 -0
  304. package/dist/env/project-env.d.ts +34 -0
  305. package/dist/env/project-env.d.ts.map +1 -0
  306. package/dist/env/project-env.js +45 -0
  307. package/dist/env/project-env.js.map +1 -0
  308. package/dist/env/runners.d.ts +22 -0
  309. package/dist/env/runners.d.ts.map +1 -0
  310. package/dist/env/runners.js +4 -0
  311. package/dist/env/runners.js.map +1 -0
  312. package/dist/env/writer.d.ts +7 -0
  313. package/dist/env/writer.d.ts.map +1 -0
  314. package/dist/env/writer.js +9 -0
  315. package/dist/env/writer.js.map +1 -0
  316. package/dist/errors.d.ts +31 -0
  317. package/dist/errors.d.ts.map +1 -0
  318. package/dist/errors.js +107 -0
  319. package/dist/errors.js.map +1 -0
  320. package/dist/help.d.ts +5 -0
  321. package/dist/help.d.ts.map +1 -0
  322. package/dist/help.js +61 -0
  323. package/dist/help.js.map +1 -0
  324. package/dist/index.d.ts +13 -0
  325. package/dist/index.d.ts.map +1 -0
  326. package/dist/index.js +13 -0
  327. package/dist/index.js.map +1 -0
  328. package/dist/init/augment-scaffolder.d.ts +74 -0
  329. package/dist/init/augment-scaffolder.d.ts.map +1 -0
  330. package/dist/init/augment-scaffolder.js +459 -0
  331. package/dist/init/augment-scaffolder.js.map +1 -0
  332. package/dist/init/dependency-specs.d.ts +58 -0
  333. package/dist/init/dependency-specs.d.ts.map +1 -0
  334. package/dist/init/dependency-specs.js +153 -0
  335. package/dist/init/dependency-specs.js.map +1 -0
  336. package/dist/init/gitignore-patcher.d.ts +23 -0
  337. package/dist/init/gitignore-patcher.d.ts.map +1 -0
  338. package/dist/init/gitignore-patcher.js +103 -0
  339. package/dist/init/gitignore-patcher.js.map +1 -0
  340. package/dist/init/mode-detect.d.ts +34 -0
  341. package/dist/init/mode-detect.d.ts.map +1 -0
  342. package/dist/init/mode-detect.js +115 -0
  343. package/dist/init/mode-detect.js.map +1 -0
  344. package/dist/init/package-json-patcher.d.ts +36 -0
  345. package/dist/init/package-json-patcher.d.ts.map +1 -0
  346. package/dist/init/package-json-patcher.js +128 -0
  347. package/dist/init/package-json-patcher.js.map +1 -0
  348. package/dist/init/pyproject-patcher.d.ts +56 -0
  349. package/dist/init/pyproject-patcher.d.ts.map +1 -0
  350. package/dist/init/pyproject-patcher.js +324 -0
  351. package/dist/init/pyproject-patcher.js.map +1 -0
  352. package/dist/init/python-augment.d.ts +22 -0
  353. package/dist/init/python-augment.d.ts.map +1 -0
  354. package/dist/init/python-augment.js +300 -0
  355. package/dist/init/python-augment.js.map +1 -0
  356. package/dist/init/template-files.d.ts +16 -0
  357. package/dist/init/template-files.d.ts.map +1 -0
  358. package/dist/init/template-files.js +38 -0
  359. package/dist/init/template-files.js.map +1 -0
  360. package/dist/key/defaults.d.ts +3 -0
  361. package/dist/key/defaults.d.ts.map +1 -0
  362. package/dist/key/defaults.js +60 -0
  363. package/dist/key/defaults.js.map +1 -0
  364. package/dist/key/fingerprint.d.ts +6 -0
  365. package/dist/key/fingerprint.d.ts.map +1 -0
  366. package/dist/key/fingerprint.js +25 -0
  367. package/dist/key/fingerprint.js.map +1 -0
  368. package/dist/key/paths.d.ts +30 -0
  369. package/dist/key/paths.d.ts.map +1 -0
  370. package/dist/key/paths.js +51 -0
  371. package/dist/key/paths.js.map +1 -0
  372. package/dist/key/runners.d.ts +60 -0
  373. package/dist/key/runners.d.ts.map +1 -0
  374. package/dist/key/runners.js +4 -0
  375. package/dist/key/runners.js.map +1 -0
  376. package/dist/main.d.ts +106 -0
  377. package/dist/main.d.ts.map +1 -0
  378. package/dist/main.js +198 -0
  379. package/dist/main.js.map +1 -0
  380. package/dist/mcp/launcher.d.ts +143 -0
  381. package/dist/mcp/launcher.d.ts.map +1 -0
  382. package/dist/mcp/launcher.js +393 -0
  383. package/dist/mcp/launcher.js.map +1 -0
  384. package/dist/mcp/preset-loader.d.ts +29 -0
  385. package/dist/mcp/preset-loader.d.ts.map +1 -0
  386. package/dist/mcp/preset-loader.js +217 -0
  387. package/dist/mcp/preset-loader.js.map +1 -0
  388. package/dist/mcp/preset-types.d.ts +71 -0
  389. package/dist/mcp/preset-types.d.ts.map +1 -0
  390. package/dist/mcp/preset-types.js +4 -0
  391. package/dist/mcp/preset-types.js.map +1 -0
  392. package/dist/mcp/presets/README.md +68 -0
  393. package/dist/mcp/presets/postgres.json +15 -0
  394. package/dist/output.d.ts +26 -0
  395. package/dist/output.d.ts.map +1 -0
  396. package/dist/output.js +46 -0
  397. package/dist/output.js.map +1 -0
  398. package/dist/pack-config.d.ts +37 -0
  399. package/dist/pack-config.d.ts.map +1 -0
  400. package/dist/pack-config.js +65 -0
  401. package/dist/pack-config.js.map +1 -0
  402. package/dist/package-manager.d.ts +33 -0
  403. package/dist/package-manager.d.ts.map +1 -0
  404. package/dist/package-manager.js +129 -0
  405. package/dist/package-manager.js.map +1 -0
  406. package/dist/parse.d.ts +82 -0
  407. package/dist/parse.d.ts.map +1 -0
  408. package/dist/parse.js +99 -0
  409. package/dist/parse.js.map +1 -0
  410. package/dist/providers/preset-loader.d.ts +47 -0
  411. package/dist/providers/preset-loader.d.ts.map +1 -0
  412. package/dist/providers/preset-loader.js +107 -0
  413. package/dist/providers/preset-loader.js.map +1 -0
  414. package/dist/providers/presets/anthropic.json +47 -0
  415. package/dist/providers/presets/gemini.json +40 -0
  416. package/dist/reference.d.ts +28 -0
  417. package/dist/reference.d.ts.map +1 -0
  418. package/dist/reference.js +52 -0
  419. package/dist/reference.js.map +1 -0
  420. package/dist/sdk-package.d.ts +9 -0
  421. package/dist/sdk-package.d.ts.map +1 -0
  422. package/dist/sdk-package.js +20 -0
  423. package/dist/sdk-package.js.map +1 -0
  424. package/dist/sdk-skills/kindgi-authoring-agents/SKILL.md +253 -0
  425. package/dist/sdk-skills/kindgi-authoring-flows/SKILL.md +299 -0
  426. package/dist/sdk-skills/kindgi-authoring-guardrails/SKILL.md +291 -0
  427. package/dist/sdk-skills/kindgi-authoring-mcp-servers/SKILL.md +289 -0
  428. package/dist/sdk-skills/kindgi-authoring-providers/SKILL.md +704 -0
  429. package/dist/sdk-skills/kindgi-authoring-tools/SKILL.md +288 -0
  430. package/dist/sdk-skills/kindgi-framework-feedback/SKILL.md +211 -0
  431. package/dist/sdk-skills/kindgi-getting-started/SKILL.md +181 -0
  432. package/dist/sdk-skills/kindgi-python-authoring-agents/SKILL.md +205 -0
  433. package/dist/sdk-skills/kindgi-python-authoring-flows/SKILL.md +322 -0
  434. package/dist/sdk-skills/kindgi-python-authoring-guardrails/SKILL.md +173 -0
  435. package/dist/sdk-skills/kindgi-python-authoring-tools/SKILL.md +299 -0
  436. package/dist/sdk-skills/kindgi-python-getting-started/SKILL.md +240 -0
  437. package/dist/stop-signal.d.ts +15 -0
  438. package/dist/stop-signal.d.ts.map +1 -0
  439. package/dist/stop-signal.js +16 -0
  440. package/dist/stop-signal.js.map +1 -0
  441. package/dist/templates/minimal/.gitignore +8 -0
  442. package/dist/templates/minimal/.nvmrc +1 -0
  443. package/dist/templates/minimal/AGENTS.md +23 -0
  444. package/dist/templates/minimal/README.md.tmpl +69 -0
  445. package/dist/templates/minimal/agents/.gitkeep +0 -0
  446. package/dist/templates/minimal/flows/.gitkeep +0 -0
  447. package/dist/templates/minimal/guardrails/.gitkeep +0 -0
  448. package/dist/templates/minimal/kindgi.config.ts.tmpl +44 -0
  449. package/dist/templates/minimal/package.json.tmpl +25 -0
  450. package/dist/templates/minimal/pnpm-workspace.yaml +6 -0
  451. package/dist/templates/minimal/tools/.gitkeep +0 -0
  452. package/dist/templates/minimal/tsconfig.json.tmpl +27 -0
  453. package/dist/templates/minimal/vitest.config.ts.tmpl +14 -0
  454. package/dist/templates/python/.gitignore +9 -0
  455. package/dist/templates/python/AGENTS.md +30 -0
  456. package/dist/templates/python/README.md.tmpl +56 -0
  457. package/dist/templates/python/agents/echo_agent.py.tmpl +23 -0
  458. package/dist/templates/python/flows/echo_flow.py.tmpl +17 -0
  459. package/dist/templates/python/guardrails/response_not_empty.py.tmpl +27 -0
  460. package/dist/templates/python/pyproject.toml.tmpl +42 -0
  461. package/dist/templates/python/tests/test_tools.py.tmpl +22 -0
  462. package/dist/templates/python/tools/echo.py.tmpl +27 -0
  463. package/dist/templates/python/tools/greet.py.tmpl +20 -0
  464. package/dist/templates/sample/.gitignore +8 -0
  465. package/dist/templates/sample/.nvmrc +1 -0
  466. package/dist/templates/sample/AGENTS.md +23 -0
  467. package/dist/templates/sample/README.md.tmpl +85 -0
  468. package/dist/templates/sample/agents/echo-agent/index.ts.tmpl +34 -0
  469. package/dist/templates/sample/flows/echo-flow/index.ts.tmpl +59 -0
  470. package/dist/templates/sample/guardrails/response-not-empty/index.ts.tmpl +50 -0
  471. package/dist/templates/sample/kindgi.config.ts.tmpl +41 -0
  472. package/dist/templates/sample/package.json.tmpl +25 -0
  473. package/dist/templates/sample/pnpm-workspace.yaml +6 -0
  474. package/dist/templates/sample/tools/echo/index.test.ts.tmpl +31 -0
  475. package/dist/templates/sample/tools/echo/index.ts.tmpl +37 -0
  476. package/dist/templates/sample/tools/fetch-httpbin/index.ts.tmpl +60 -0
  477. package/dist/templates/sample/tools/greet/index.ts.tmpl +35 -0
  478. package/dist/templates/sample/tsconfig.json.tmpl +27 -0
  479. package/dist/templates/sample/vitest.config.ts.tmpl +14 -0
  480. package/dist/test/defaults.d.ts +3 -0
  481. package/dist/test/defaults.d.ts.map +1 -0
  482. package/dist/test/defaults.js +104 -0
  483. package/dist/test/defaults.js.map +1 -0
  484. package/dist/test/runners.d.ts +60 -0
  485. package/dist/test/runners.d.ts.map +1 -0
  486. package/dist/test/runners.js +4 -0
  487. package/dist/test/runners.js.map +1 -0
  488. package/dist/version-info.d.ts +9 -0
  489. package/dist/version-info.d.ts.map +1 -0
  490. package/dist/version-info.js +27 -0
  491. package/dist/version-info.js.map +1 -0
  492. package/dist/write-fully.d.ts +13 -0
  493. package/dist/write-fully.d.ts.map +1 -0
  494. package/dist/write-fully.js +17 -0
  495. package/dist/write-fully.js.map +1 -0
  496. package/package.json +63 -4
@@ -0,0 +1,253 @@
1
+ ---
2
+ name: kindgi-authoring-agents
3
+ description: >
4
+ Covers writing agents for a Kindgi pack with @kindgi/sdk:
5
+ defining agents via defineAgent, tool wiring with ToolRef versioning,
6
+ guardrail references, conversation policy, turn budgets, LLM
7
+ capability declarations, and prompt template variables. Load this
8
+ whenever you are authoring or editing code inside a pack's agents/
9
+ directory, defining an agent, or when the user asks to add, modify,
10
+ or refactor an agent. Authoring tools is covered by
11
+ kindgi-authoring-tools; authoring guardrails is covered by
12
+ kindgi-authoring-guardrails.
13
+ type: core
14
+ library: "@kindgi/sdk"
15
+ version: "0.4.1"
16
+ sdk_version: "0.1.0"
17
+ pack_languages: [node]
18
+ sources:
19
+ - packages/agents/src/types.ts
20
+ - packages/agents/src/define.ts
21
+ ---
22
+
23
+ # Authoring Kindgi agents
24
+
25
+ > **Running `kindgi`:** the CLI is a devDependency of the project (`@kindgi/cli`),
26
+ > not a global command. Run it through the project's package manager —
27
+ > `pnpm exec kindgi …`, `npx --no kindgi …` (npm), `yarn kindgi …` or
28
+ > `bun run kindgi …`. Commands below are written `kindgi …` for brevity.
29
+
30
+ An **agent** is a versioned LLM-powered orchestrator: instructions (a
31
+ prompt template), a declared set of tools it can call, capability
32
+ declarations for the LLM provider, guardrails that gate its outputs,
33
+ and optional multi-turn conversation policy. Agents live at
34
+ `agents/<name>/index.ts` inside a pack.
35
+
36
+ ## Ask before building
37
+
38
+ Requests like "add an agent" / "create an agent" / "I need an agent"
39
+ are conversation openers, not tickets. Before writing any file, ask:
40
+
41
+ - **What should the agent DO?** The purpose is the load-bearing thing.
42
+ Everything else derives from it.
43
+ - **Which tools does it need?** New tools, or reuses of existing?
44
+ - **Multi-turn or one-shot?** Conversation history changes the shape.
45
+ - **Any specific guardrails?** Safety rules the agent must respect.
46
+
47
+ The pack's existing agents are examples that prove the framework runs
48
+ end-to-end. They are NOT the shape you imitate unless the user
49
+ explicitly asks for that. Inferring purpose from surrounding pack
50
+ shape is how confident, wrong code gets shipped.
51
+
52
+ ## Minimal agent
53
+
54
+ ```ts
55
+ // agents/brief-writer/index.ts
56
+ import { defineAgent } from '@kindgi/sdk/define';
57
+ import type { AgentId, Semver } from '@kindgi/sdk/types';
58
+
59
+ const defined = defineAgent({
60
+ id: 'acme.brief-writer' as AgentId,
61
+ version: '0.1.0' as Semver,
62
+ name: 'Brief Writer',
63
+ description:
64
+ 'Drafts appellate briefs from a case file. Cites precedents; escalates novel legal questions.',
65
+ instructions:
66
+ 'You are drafting a brief in {{ jurisdiction }}. The user provides the case facts; you produce a Section IV argument citing at least two precedents. Use `acme.verify-citation` on every cite before including it. Refuse to fabricate citations — always call the tool.',
67
+ capabilities: [{ needs: [{ feature: 'tool-use' as const }] }],
68
+ tools: [
69
+ { id: 'acme.verify-citation', version: '^0.1.0' },
70
+ { id: 'acme.fetch-precedent', version: '^0.1.0' },
71
+ ],
72
+ retrieval: [],
73
+ guardrails: ['acme.no-fabricated-quotes'],
74
+ parameters: [
75
+ { name: 'jurisdiction', type: 'string', required: true },
76
+ ],
77
+ conversationPolicy: { historyLimit: 20 },
78
+ budget: { maxSteps: 8, maxCostUsd: 0.5, maxWallMs: 60_000 },
79
+ });
80
+
81
+ if (defined.kind === 'err') {
82
+ throw new Error(`acme.brief-writer failed to compile: ${defined.error.message}`);
83
+ }
84
+
85
+ export default defined.value;
86
+ ```
87
+
88
+ ## Field-by-field
89
+
90
+ - **`id`** — `<pack-id>.<agent-name>` (kebab-case, dot-namespaced).
91
+ Enforced.
92
+ - **`version`** — Semver. Runs pin to a specific version; upgrading
93
+ the agent doesn't retroactively rewrite in-flight conversations.
94
+ - **`instructions`** — LiquidJS template. `{{ variable }}` substitutes
95
+ from `parameters` or framework auto-vars (`today`, `now`, `agent.*`,
96
+ `conversation.*`). Rendered with `strictVariables: true` — unresolved
97
+ references fail loudly at invoke time. Frame instructions like a
98
+ competent employee brief: what the agent does, what tools to prefer,
99
+ what to refuse, what quality bar to hit.
100
+ - **`capabilities`** — declares the resource kinds the agent needs at
101
+ runtime. `{feature: 'tool-use'}` is standard for tool-calling
102
+ agents. The router picks the concrete LLM provider at turn time.
103
+ - **`tools`** — `readonly ToolRef[]`, NOT `string[]`. Each entry is
104
+ `{id, version}` where `version` is an npm-style semver **range**
105
+ (`'^0.1.0'`, `'~1.2.3'`, `'>=1.0.0 <2.0.0'`). Empty array = chat-only
106
+ agent.
107
+ - **`guardrails`** — array of guardrail `id` strings. Resolved at turn
108
+ start against the guardrails bound for the run (the tenant's
109
+ registered guardrails). If a guardrail id isn't registered, the turn
110
+ fails with `unresolved-guardrail`. Guardrails are evaluated once per
111
+ turn, on the final response before it is stored — a blocking
112
+ (`halt`) violation fails the turn and the response is never written
113
+ to the conversation.
114
+ - **`parameters`** — typed inputs the caller supplies at invoke time.
115
+ UI builds a "configure agent" form from these; runtime validates
116
+ each required parameter is provided.
117
+ - **`preferredProvider`** — optional soft hint. When set to a
118
+ `ProviderMetadata.id` (e.g. `'anthropic'`, `'groq'`), the router
119
+ prefers that provider when at least one of its models satisfies the
120
+ agent's `capabilities.needs` + tenant policy. Falls back to normal
121
+ capability-based selection when the preferred provider is
122
+ unregistered or filtered out.
123
+ - **`preferredModel`** — optional soft hint at the model level: set to
124
+ a `ModelInfo.name` (e.g. `'gemini-2.5-pro'`), the router prefers
125
+ `(provider, model)` tuples whose model matches. To require a model
126
+ rather than prefer it, add a hard requirement to the capability:
127
+ `capabilities: [{ needs: [{ feature: 'tool-use' }, { models: { allow: ['gemini-2.5-pro'] } }] }]`.
128
+ - **`conversationPolicy`** — optional. Absent = each turn loads the
129
+ conversation's full history and no HITL gates apply. `historyLimit`
130
+ caps how many prior messages are loaded; `hitl` configures approval
131
+ gates (a turn-count gate and per-tool gates). A tenant's `hitl`
132
+ policy can tighten these — a shorter approval timeout, a higher
133
+ reviewer role, a stricter gate for a tool — never loosen them.
134
+ - **`budget`** — per-turn ceiling. `maxSteps` caps model-call cycles
135
+ (default 8); `maxCostUsd` caps model spend; `maxWallMs` caps wall
136
+ time (default 120 000). Exceeding steps or cost fails the turn with
137
+ `budget-exceeded`; running out of wall time aborts it
138
+ (`agent-turn-aborted`, reason `timeout`).
139
+
140
+ - **`output`** — optional typed result: `{ schema, name?, maxRepairs? }`
141
+ (JSON Schema, or Zod). The final answer must be JSON matching
142
+ `schema` (a fenced JSON block is accepted). An answer that doesn't fit
143
+ goes back to the model with the problems listed, up to `maxRepairs`
144
+ times (default 1); then the turn fails with `output-schema-violation`.
145
+ The parsed answer is the turn result's `output`, and in a flow
146
+ `nodeOutputs.<step>.output.<field>`. A Zod `.default()` field must be
147
+ in the answer: downstream steps read every field.
148
+ - **`toolErrors`** — optional: what the turn does when a tool call
149
+ fails. The failure goes back to the model as the call's result (what
150
+ failed and why) so it can correct the call, up to `maxRetries` times
151
+ per turn (default 1), for the kinds in `retryOn` (default
152
+ `['invalid-arguments', 'unknown-tool']`, failures where nothing ran).
153
+ Add `'tool-error'` to retry a tool that ran and failed — only when
154
+ retrying it is safe (a mutating tool may have changed something before
155
+ failing). Each retry costs a step against `budget.maxSteps`. Past the
156
+ retries the turn fails as before, with `toolRetries` on the error. A
157
+ tenant's `tool-errors` policy can lower these (fewer retries, fewer
158
+ kinds), never raise them.
159
+
160
+ ## What a turn receives
161
+
162
+ - **Run directly** (`kindgi runs start --agent=… --input='{…}'`, or
163
+ `POST /v1/runs { agent, input }`), the input is `{ userMessage,
164
+ conversationId?, participantId?, parameters? }`:
165
+ - `userMessage` is the turn's message;
166
+ - `conversationId` continues a conversation;
167
+ - `parameters` fills the agent's `parameters` (string, number or
168
+ boolean values).
169
+ - **As a flow step** (`{ kind: 'agent', ref: 'acme.brief-writer' }`), the
170
+ agent gets the step's input in two ways:
171
+ - as **structured input**, which the instructions read as
172
+ `{{ input.caseFacts }}`;
173
+ - as the user message (the input as JSON).
174
+
175
+ The step's `config.parameters` fills `parameters`, and `config.version`
176
+ pins a version. With a typed `output`, the flow reads the answer at
177
+ `nodeOutputs.<step>.output.<field>`. See `kindgi-authoring-flows`.
178
+
179
+ `{{ input.* }}` is set only in a flow step, so an agent that reads it
180
+ belongs in a flow. Rendering is strict: a direct run of such an agent
181
+ fails when its instructions render.
182
+
183
+ ## Iterating on an agent
184
+
185
+ Edit `agents/<name>/index.ts`, save. The next `kindgi runs start`
186
+ sees the change — new instructions, new tool bindings, new
187
+ capabilities, new preferredProvider, new budget. No version bump,
188
+ no restart. Source is truth in dev.
189
+
190
+ The `version` field is a **semver contract for humans reading the
191
+ source** — it declares what conversations pinned to this agent can
192
+ rely on. Bump because you're breaking that contract (removed a
193
+ parameter, tightened the instructions in a user-visible way,
194
+ switched to an incompatible provider policy), not because you saved
195
+ the file. If you're iterating on the prompt, leave version alone.
196
+
197
+ **When version matters:** conversations persist their `agentVersion`
198
+ at start and pin resume-across-turn to that version. `kindgi deploy`
199
+ publishes to a durable production registry that enforces the
200
+ immutable `(id, version)` contract. Both surfaces are deploy-time
201
+ concerns, not author-time.
202
+
203
+ ## Common mistakes
204
+
205
+ 1. **Adding an agent without asking what it should do.** The most
206
+ common failure mode. "Add an agent" without a stated purpose gets
207
+ answered by imitating the shape of the pack's example agent. Ask
208
+ first.
209
+
210
+ 2. **`tools: ['id-string']`** — `tools` is `ToolRef[]`, so TypeScript
211
+ rejects bare strings, and `defineAgent` returns `invalid-agent` for
212
+ one that slips through (plain JavaScript, a cast). Use
213
+ `[{id: 'acme.x', version: '^0.1.0'}]`.
214
+
215
+ 3. **Referencing guardrails that aren't registered.** If
216
+ `agent.guardrails` contains an id the tenant has no guardrail for
217
+ (registered via `POST /v1/guardrails`, a deploy, or `kindgi dev`),
218
+ turn setup fails with `unresolved-guardrail`. Either author the
219
+ guardrail first or drop it from the agent's list.
220
+
221
+ 4. **Un-declared `{{ variable }}` in instructions.** LiquidJS renders
222
+ with `strictVariables: true` — a reference to `{{ jurisdiction }}`
223
+ that isn't in `parameters` OR an auto-var throws at invoke time.
224
+ Either add it to `parameters` or use a framework auto-var.
225
+
226
+ 5. **Empty `capabilities`.** `defineAgent` rejects an empty
227
+ `capabilities` array (`invalid-agent`) — the turn routes its first
228
+ capability to pick a model. Declare
229
+ `[{needs: [{feature: 'tool-use' as const}]}]` (or the matching
230
+ feature set for your use case).
231
+
232
+ 6. **Missing `Result` unwrap.** `defineAgent` returns `Result<Agent,
233
+ InvalidAgentError>`. Always check `defined.kind === 'err' && throw`
234
+ so a broken agent fails at module load.
235
+
236
+ ## References
237
+
238
+ - Type surface: `hover any @kindgi/sdk/define export` in your editor
239
+ for full JSDoc.
240
+ - Companion docs: `pnpm --filter @kindgi/sdk exec typedoc` regenerates
241
+ markdown API docs at `packages/sdk/docs/`.
242
+ - Common patterns: the `sample` template's `agents/echo-agent`
243
+ demonstrates the smallest tool-calling shape.
244
+
245
+ ## When the framework itself is the problem
246
+
247
+ If you diagnose that the bug lives in Kindgi/`@kindgi/sdk` itself (SDK
248
+ type drift, wire schema silently dropping a field like
249
+ `preferredProvider`, router picking the wrong provider, misleading
250
+ error message, CLI friction) — not in the pack's own code — load the
251
+ `kindgi-framework-feedback` skill and file a structured report with
252
+ `kindgi feedback write`. That diagnostic is high-signal input the
253
+ maintainers can act on; don't let it disappear into the transcript.
@@ -0,0 +1,299 @@
1
+ ---
2
+ name: kindgi-authoring-flows
3
+ description: >
4
+ Covers writing flows for a Kindgi pack with @kindgi/sdk: defineFlow,
5
+ tool and agent steps, edges and `when` conditions, branches that join
6
+ again, inputMapping from runInput / nodeOutputs, typed agent output in
7
+ a flow, the flow's declared output, loops (foreach / while) and fanout,
8
+ per-edge retry and timeout, and running a flow (kindgi runs start
9
+ --flow, in the background, as a dry run) and reading its journal. Load
10
+ this whenever you are authoring or editing code inside a pack's flows/
11
+ directory, defining a flow, or when the user asks to add, change or
12
+ debug one. Tools are covered by kindgi-authoring-tools, agents by
13
+ kindgi-authoring-agents.
14
+ type: core
15
+ library: "@kindgi/sdk"
16
+ version: "0.1.1"
17
+ sdk_version: "0.1.0"
18
+ pack_languages: [node]
19
+ sources:
20
+ - packages/flow/src/types.ts
21
+ - packages/flow/src/define.ts
22
+ ---
23
+
24
+ # Authoring Kindgi flows
25
+
26
+ > **Running `kindgi`:** the CLI is a devDependency of the project (`@kindgi/cli`),
27
+ > not a global command. Run it through the project's package manager —
28
+ > `pnpm exec kindgi …`, `npx --no kindgi …` (npm), `yarn kindgi …` or
29
+ > `bun run kindgi …`. Commands below are written `kindgi …` for brevity.
30
+
31
+ A **flow** is a versioned, durable graph of steps: tools (your code) and
32
+ agents (a model's judgment), joined by edges that can carry conditions.
33
+ It is **data**, not code: `defineFlow({...})` in `flows/<name>/index.ts`.
34
+ The runtime runs it step by step, journals every step, and can resume a
35
+ run that was interrupted. A run pins the flow version it started on.
36
+
37
+ Use a flow when the order of the work is known: parse, then classify,
38
+ then branch, then write. Use a single agent when the model should decide
39
+ the order.
40
+
41
+ ## Ask before building
42
+
43
+ - **What goes in, and what comes out?** The run input's shape and the
44
+ output the caller reads. They become `runInput.*` paths and `output`.
45
+ - **Which steps are code, which are judgment?** Deterministic work
46
+ (parse, rank, look up, write) is a tool; judgment (classify, draft,
47
+ summarize) is an agent with a typed `output`.
48
+ - **Where does it branch?** Every branch needs a condition, and the
49
+ steps after a branch must cope with the branch that didn't run.
50
+ - **What does it change outside Kindgi?** A tool that only reads
51
+ declares `mutating: false`, and a dry run runs it. A tool that writes
52
+ doesn't (leaving it out counts as mutating), and a dry run stops there.
53
+
54
+ ## A flow
55
+
56
+ ```ts
57
+ // flows/triage-ticket/index.ts
58
+ import { defineFlow } from '@kindgi/sdk/define';
59
+
60
+ const isBilling = {
61
+ op: 'eq',
62
+ left: { path: 'nodeOutputs.classify.output.category' },
63
+ right: { literal: 'billing' },
64
+ } as const;
65
+
66
+ const defined = defineFlow({
67
+ id: 'acme.triage-ticket',
68
+ version: '0.1.0',
69
+ name: 'Triage a support ticket',
70
+ description: 'Parses a ticket, classifies it, looks up billing when needed, drafts a reply.',
71
+ nodes: [
72
+ {
73
+ id: 'parse',
74
+ kind: 'tool',
75
+ ref: 'acme.parse-ticket',
76
+ inputMapping: { ticket: { path: 'runInput.ticket' } },
77
+ },
78
+ {
79
+ id: 'classify',
80
+ kind: 'agent',
81
+ ref: 'acme.ticket-classifier', // an agent with a typed `output`
82
+ inputMapping: { text: { path: 'nodeOutputs.parse.text' } },
83
+ config: { parameters: { product: 'acme-cloud' } },
84
+ },
85
+ {
86
+ id: 'billing',
87
+ kind: 'tool',
88
+ ref: 'acme.lookup-invoice',
89
+ inputMapping: { customerId: { path: 'runInput.ticket.customerId' } },
90
+ },
91
+ {
92
+ id: 'reply',
93
+ kind: 'tool',
94
+ ref: 'acme.draft-reply',
95
+ inputMapping: {
96
+ category: { path: 'nodeOutputs.classify.output.category' },
97
+ invoice: { path: 'nodeOutputs.billing.invoice' }, // absent when billing didn't run
98
+ },
99
+ },
100
+ ],
101
+ edges: [
102
+ { id: 'e0', from: '$start', to: 'parse' },
103
+ { id: 'e1', from: 'parse', to: 'classify' },
104
+ { id: 'e2', from: 'classify', to: 'billing', when: isBilling },
105
+ { id: 'e3', from: 'classify', to: 'reply', when: { op: 'not', child: isBilling } },
106
+ { id: 'e4', from: 'billing', to: 'reply' },
107
+ { id: 'e5', from: 'reply', to: '$end' },
108
+ ],
109
+ output: {
110
+ mapping: {
111
+ category: { path: 'nodeOutputs.classify.output.category' },
112
+ reply: { path: 'nodeOutputs.reply.text' },
113
+ },
114
+ schema: {
115
+ type: 'object',
116
+ properties: { category: { type: 'string' }, reply: { type: 'string' } },
117
+ required: ['category', 'reply'],
118
+ },
119
+ },
120
+ });
121
+
122
+ if (defined.kind === 'err') {
123
+ throw new Error(`acme.triage-ticket failed to compile: ${defined.error.message}`);
124
+ }
125
+
126
+ export default defined.value;
127
+ ```
128
+
129
+ `defineFlow` checks the shape where it is written: ids, the version,
130
+ edges between nodes that exist, `$start` / `$end`, no cycles, paths
131
+ rooted where they may be. It doesn't check that `acme.parse-ticket`
132
+ exists. That is checked when a run starts (see "Running a flow").
133
+
134
+ ## Nodes
135
+
136
+ - **`kind: 'tool'`** runs the tool `ref` (its id). The tool's input is
137
+ what the node's `inputMapping` builds, else the output of the node's
138
+ single upstream node (the run input after `$start`). It is validated
139
+ against the tool's input schema, so a mismatch fails the step with
140
+ `input-validation-failed`. The node's output is the tool's return value.
141
+ - **`kind: 'agent'`** runs one turn of the agent `ref` as a child run of
142
+ the flow run. The agent gets the node's input in two ways:
143
+ - as **structured input**: `{{ input.text }}` in its instructions;
144
+ - as its user message (the input as JSON).
145
+
146
+ `config.parameters` fills the agent's `parameters` (string, number or
147
+ boolean values). `config.version` pins an agent version; without it
148
+ the latest active version runs.
149
+
150
+ The node's output:
151
+ - `output` is the agent's typed answer (its `output` schema);
152
+ - `text` is the answer as text;
153
+ - `runId` and `conversationId` belong to the child run.
154
+
155
+ Read a field as `nodeOutputs.<node>.output.<field>`. An answer that
156
+ doesn't fit the agent's `output` schema, after its repairs, fails the
157
+ step with `output-schema-violation`.
158
+
159
+ An approval inside the agent's turn parks the flow until it's decided.
160
+ - **`kind: 'loop'`** repeats a body: `loopKind: 'foreach'` once per
161
+ element of `iterateOver` (`concurrency` up to 32 in parallel), or
162
+ `loopKind: 'while'` until `exitCondition`.
163
+ - The body has its own nodes and edges, with `$loop-start` /
164
+ `$loop-end`; the element is the body's input.
165
+ - `maxIterations` and `outputSchema` are required.
166
+ - The loop's output is `finalOutput`, plus `outputs` with
167
+ `collectAllIterations: true`.
168
+ - Node ids must be unique across the whole flow, bodies included.
169
+ - **`kind: 'fanout'`** runs several handlers on the same input at once,
170
+ each a `branch` with an `outputSchema`. `convergence` decides the
171
+ result:
172
+ - `'all-succeed'`: every branch must succeed;
173
+ - `'any-succeed'`: the first success wins;
174
+ - `'settle-all'`: wait for every branch and report each.
175
+ - **`kind: 'subgraph'`** (a sub-flow) is part of the flow schema, but a
176
+ run refuses it today (`flow-unbound`). Inline the steps instead.
177
+
178
+ ## Edges and conditions
179
+
180
+ An edge goes from a node (or `$start`) to a node (or `$end`). Without
181
+ `when` it fires when its source completes; with `when` it fires only if
182
+ the condition is true. Conditions are JSON:
183
+
184
+ | Operator | Shape |
185
+ |---|---|
186
+ | `eq` `ne` `lt` `lte` `gt` `gte` | `{ op, left, right }` |
187
+ | `in` `notIn` | `{ op, value, set }` |
188
+ | `exists` `notExists` `truthy` `falsy` | `{ op, value }` |
189
+ | `and` `or` | `{ op, children: [...] }` |
190
+ | `not` | `{ op, child }` |
191
+
192
+ Each operand is `{ literal: … }` or `{ path: … }`. A comparison whose
193
+ path doesn't resolve is **false**, `ne` included. So to branch on "not
194
+ billing", write `not` around the `eq` (as above), not `ne`.
195
+
196
+ **Joining branches.** A node with several incoming edges runs once every
197
+ one of them is decided and at least one fired. In the example, `reply`
198
+ runs after `billing` on the billing branch, and straight after `classify`
199
+ otherwise. A node none of whose incoming edges fired is skipped, and so
200
+ is everything only it leads to.
201
+
202
+ **Edge policy** (`policy` on the edge into a node with a single incoming
203
+ edge):
204
+ - `retry: { maxAttempts, delayMs?, backoff?, maxDelayMs? }`: up to 10
205
+ attempts in all;
206
+ - `timeoutMs`: a step that takes longer fails with `reason: 'timeout'`;
207
+ - `concurrencyKey`: at most one such step at a time in the tenant;
208
+ - `priority`: −100 to 100.
209
+
210
+ A node with several incoming edges ignores them.
211
+
212
+ ## Inputs and the output
213
+
214
+ `inputMapping` maps each key to a `{ literal }` or a `{ path }`. Paths are
215
+ dot-separated, with no array indexing, rooted at:
216
+ - `runInput.…`: the input the run was started with;
217
+ - `nodeOutputs.<nodeId>.…`: a step's output. For an agent step, add
218
+ `.output.<field>` to read its typed answer;
219
+ - `state.…`: values written by the runtime's own handlers. Pack tools
220
+ don't write it, so use `nodeOutputs`.
221
+
222
+ A path that doesn't resolve leaves its key out. A step after a branch
223
+ that didn't run gets no `invoice` key at all, rather than `invoice:
224
+ undefined`. Make that key optional in the tool's input schema.
225
+
226
+ `output` is what the run returns: a `mapping` resolved when the run
227
+ finishes, checked against `schema` if you give one. A run whose output
228
+ doesn't match fails. Without `output`, the run returns the output of the
229
+ step that reached `$end`.
230
+
231
+ ## Running a flow
232
+
233
+ From another terminal in the pack directory, while `kindgi dev` runs:
234
+
235
+ ```sh
236
+ kindgi runs start --flow=acme.triage-ticket --input='{"ticket":{"customerId":"c-1","body":"Charged twice"}}'
237
+ kindgi runs start --flow=acme.triage-ticket --input=@ticket.json --no-wait # the run id now; it finishes in the background
238
+ kindgi runs start --flow=acme.triage-ticket --input=@ticket.json --dry-run # runs only read-only tools
239
+ kindgi runs get <run-id> # status, output, failureMessage
240
+ kindgi runs journal <run-id> # every step.started / step.completed / edge.evaluated
241
+ kindgi runs stream <run-id> # follow a running one
242
+ kindgi runs cancel <run-id>
243
+ ```
244
+
245
+ - **A refusal before the run exists:** `422 flow-unbound` names the
246
+ nodes a run can't bind: a tool or agent id the tenant doesn't have, or
247
+ a sub-flow. Fix the ids; nothing ran.
248
+ - **A failed step fails the run**, and `failureMessage` says which step
249
+ and why. Retry it on its edge with `policy.retry` only if running the
250
+ step twice is safe.
251
+ - **`--no-wait`** is how an application starts runs (`options: { wait:
252
+ false }` with `@kindgi/sdk/client`). It answers with the run id at once;
253
+ poll `GET /v1/runs/<id>` or follow the stream.
254
+ - **`--dry-run`** runs a tool only if it's declared read-only:
255
+ `mutating: false`, and no `writes`, `deletes`, `spawns-run`,
256
+ `emits-event` or `external-side-effect` effect. The first other tool
257
+ stops the run with `dry-run-effectful-tool`, and everything before it
258
+ really ran. That's useful for checking the wiring without the writes.
259
+
260
+ ## Iterating on a flow
261
+
262
+ Save the file and `kindgi dev` re-indexes; the next run uses the new
263
+ definition, with no restart. A run already in flight keeps the version it
264
+ started on. Bump `version` when callers' contract changes (the input or
265
+ the output), not on every save.
266
+
267
+ ## Common mistakes
268
+
269
+ 1. **Building a flow without asking what goes in and comes out.** The
270
+ pack's `echo-flow` proves the runtime works. It isn't a template for
271
+ the user's flow.
272
+ 2. **`ne` on a path that may be missing, to mean "otherwise".** A missing
273
+ path makes every comparison false, so neither branch fires and
274
+ everything after is skipped. Use `not` around the positive condition.
275
+ 3. **Reading an agent step's answer at `nodeOutputs.<step>.<field>`.**
276
+ The typed answer is under `.output`: `nodeOutputs.<step>.output.<field>`.
277
+ An agent without an `output` schema has only `text`.
278
+ 4. **A required input key fed by a branch that may not run.** The key is
279
+ omitted, the tool's input check fails, and so does the step. Make the
280
+ key optional in the tool's input schema.
281
+ 5. **`mutating: false` on a tool that writes.** A dry run runs it for
282
+ real unless its `effects` declare the write, and an agent's tool
283
+ gates (when on, with no rule for it) let it through unasked.
284
+ 6. **A read-only tool without `mutating: false`.** Leaving it out counts
285
+ as mutating: a dry run stops at the tool, and an agent's tool gates
286
+ ask before it. kindgi-authoring-tools has the details.
287
+ 7. **A sub-flow node.** A run refuses it (`flow-unbound`) until
288
+ sub-flows are supported.
289
+ 8. **Duplicate node ids inside a loop body.** Ids are unique across the
290
+ whole flow, bodies included.
291
+ 9. **Missing `Result` unwrap.** Check `defined.kind === 'err'` and throw,
292
+ so a broken flow fails when its module loads, not on the first run.
293
+
294
+ ## When the framework itself is the problem
295
+
296
+ If the bug is in Kindgi or `@kindgi/sdk` (a step's output missing a
297
+ field, a condition that evaluates wrongly, a misleading error) and not in
298
+ the pack's code, load `kindgi-framework-feedback` and file it with
299
+ `kindgi feedback write`.