@kindgi/cli 0.0.0-bootstrap.0 → 0.1.1

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 (516) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +738 -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 +48 -0
  8. package/dist/build/bundle.d.ts.map +1 -0
  9. package/dist/build/bundle.js +125 -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 +197 -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 +597 -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 +100 -0
  28. package/dist/build/host-install.d.ts.map +1 -0
  29. package/dist/build/host-install.js +443 -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 +25 -0
  88. package/dist/commands/auth.d.ts.map +1 -0
  89. package/dist/commands/auth.js +283 -0
  90. package/dist/commands/auth.js.map +1 -0
  91. package/dist/commands/build.d.ts +46 -0
  92. package/dist/commands/build.d.ts.map +1 -0
  93. package/dist/commands/build.js +902 -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 +43 -0
  108. package/dist/commands/dev.d.ts.map +1 -0
  109. package/dist/commands/dev.js +1110 -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 +48 -0
  132. package/dist/commands/helpers.d.ts.map +1 -0
  133. package/dist/commands/helpers.js +110 -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 +454 -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 +212 -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 +223 -0
  178. package/dist/commands/runs.js.map +1 -0
  179. package/dist/commands/secrets.d.ts +18 -0
  180. package/dist/commands/secrets.d.ts.map +1 -0
  181. package/dist/commands/secrets.js +702 -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 +162 -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 +22 -0
  204. package/dist/commands/unwired.d.ts.map +1 -0
  205. package/dist/commands/unwired.js +52 -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 +162 -0
  216. package/dist/context.d.ts.map +1 -0
  217. package/dist/context.js +45 -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 +10 -0
  240. package/dist/dev/bundler.d.ts.map +1 -0
  241. package/dist/dev/bundler.js +235 -0
  242. package/dist/dev/bundler.js.map +1 -0
  243. package/dist/dev/defaults.d.ts +140 -0
  244. package/dist/dev/defaults.d.ts.map +1 -0
  245. package/dist/dev/defaults.js +709 -0
  246. package/dist/dev/defaults.js.map +1 -0
  247. package/dist/dev/dev-only-imports.d.ts +15 -0
  248. package/dist/dev/dev-only-imports.d.ts.map +1 -0
  249. package/dist/dev/dev-only-imports.js +57 -0
  250. package/dist/dev/dev-only-imports.js.map +1 -0
  251. package/dist/dev/docker-compose.dev.yml +68 -0
  252. package/dist/dev/index-child.d.ts +2 -0
  253. package/dist/dev/index-child.d.ts.map +1 -0
  254. package/dist/dev/index-child.js +53 -0
  255. package/dist/dev/index-child.js.map +1 -0
  256. package/dist/dev/pack-code.d.ts +36 -0
  257. package/dist/dev/pack-code.d.ts.map +1 -0
  258. package/dist/dev/pack-code.js +129 -0
  259. package/dist/dev/pack-code.js.map +1 -0
  260. package/dist/dev/pack-env.d.ts +13 -0
  261. package/dist/dev/pack-env.d.ts.map +1 -0
  262. package/dist/dev/pack-env.js +36 -0
  263. package/dist/dev/pack-env.js.map +1 -0
  264. package/dist/dev/pack-service.d.ts +40 -0
  265. package/dist/dev/pack-service.d.ts.map +1 -0
  266. package/dist/dev/pack-service.js +189 -0
  267. package/dist/dev/pack-service.js.map +1 -0
  268. package/dist/dev/paths.d.ts +22 -0
  269. package/dist/dev/paths.d.ts.map +1 -0
  270. package/dist/dev/paths.js +35 -0
  271. package/dist/dev/paths.js.map +1 -0
  272. package/dist/dev/postgres-container.d.ts +77 -0
  273. package/dist/dev/postgres-container.d.ts.map +1 -0
  274. package/dist/dev/postgres-container.js +346 -0
  275. package/dist/dev/postgres-container.js.map +1 -0
  276. package/dist/dev/python-builder.d.ts +16 -0
  277. package/dist/dev/python-builder.d.ts.map +1 -0
  278. package/dist/dev/python-builder.js +122 -0
  279. package/dist/dev/python-builder.js.map +1 -0
  280. package/dist/dev/register.d.ts +71 -0
  281. package/dist/dev/register.d.ts.map +1 -0
  282. package/dist/dev/register.js +54 -0
  283. package/dist/dev/register.js.map +1 -0
  284. package/dist/dev/runners.d.ts +312 -0
  285. package/dist/dev/runners.d.ts.map +1 -0
  286. package/dist/dev/runners.js +4 -0
  287. package/dist/dev/runners.js.map +1 -0
  288. package/dist/dev/runtime-container.d.ts +71 -0
  289. package/dist/dev/runtime-container.d.ts.map +1 -0
  290. package/dist/dev/runtime-container.js +173 -0
  291. package/dist/dev/runtime-container.js.map +1 -0
  292. package/dist/dev/runtime-env.d.ts +62 -0
  293. package/dist/dev/runtime-env.d.ts.map +1 -0
  294. package/dist/dev/runtime-env.js +100 -0
  295. package/dist/dev/runtime-env.js.map +1 -0
  296. package/dist/dev/runtime-image.d.ts +26 -0
  297. package/dist/dev/runtime-image.d.ts.map +1 -0
  298. package/dist/dev/runtime-image.js +44 -0
  299. package/dist/dev/runtime-image.js.map +1 -0
  300. package/dist/dev/runtime-registry.d.ts +73 -0
  301. package/dist/dev/runtime-registry.d.ts.map +1 -0
  302. package/dist/dev/runtime-registry.js +111 -0
  303. package/dist/dev/runtime-registry.js.map +1 -0
  304. package/dist/env/defaults.d.ts +3 -0
  305. package/dist/env/defaults.d.ts.map +1 -0
  306. package/dist/env/defaults.js +22 -0
  307. package/dist/env/defaults.js.map +1 -0
  308. package/dist/env/pack-env-plan.d.ts +70 -0
  309. package/dist/env/pack-env-plan.d.ts.map +1 -0
  310. package/dist/env/pack-env-plan.js +236 -0
  311. package/dist/env/pack-env-plan.js.map +1 -0
  312. package/dist/env/parser.d.ts +9 -0
  313. package/dist/env/parser.d.ts.map +1 -0
  314. package/dist/env/parser.js +11 -0
  315. package/dist/env/parser.js.map +1 -0
  316. package/dist/env/project-env.d.ts +34 -0
  317. package/dist/env/project-env.d.ts.map +1 -0
  318. package/dist/env/project-env.js +45 -0
  319. package/dist/env/project-env.js.map +1 -0
  320. package/dist/env/runners.d.ts +22 -0
  321. package/dist/env/runners.d.ts.map +1 -0
  322. package/dist/env/runners.js +4 -0
  323. package/dist/env/runners.js.map +1 -0
  324. package/dist/env/writer.d.ts +7 -0
  325. package/dist/env/writer.d.ts.map +1 -0
  326. package/dist/env/writer.js +9 -0
  327. package/dist/env/writer.js.map +1 -0
  328. package/dist/errors.d.ts +31 -0
  329. package/dist/errors.d.ts.map +1 -0
  330. package/dist/errors.js +111 -0
  331. package/dist/errors.js.map +1 -0
  332. package/dist/help.d.ts +5 -0
  333. package/dist/help.d.ts.map +1 -0
  334. package/dist/help.js +61 -0
  335. package/dist/help.js.map +1 -0
  336. package/dist/index.d.ts +13 -0
  337. package/dist/index.d.ts.map +1 -0
  338. package/dist/index.js +13 -0
  339. package/dist/index.js.map +1 -0
  340. package/dist/init/augment-scaffolder.d.ts +86 -0
  341. package/dist/init/augment-scaffolder.d.ts.map +1 -0
  342. package/dist/init/augment-scaffolder.js +538 -0
  343. package/dist/init/augment-scaffolder.js.map +1 -0
  344. package/dist/init/dependency-specs.d.ts +58 -0
  345. package/dist/init/dependency-specs.d.ts.map +1 -0
  346. package/dist/init/dependency-specs.js +153 -0
  347. package/dist/init/dependency-specs.js.map +1 -0
  348. package/dist/init/gitignore-patcher.d.ts +23 -0
  349. package/dist/init/gitignore-patcher.d.ts.map +1 -0
  350. package/dist/init/gitignore-patcher.js +103 -0
  351. package/dist/init/gitignore-patcher.js.map +1 -0
  352. package/dist/init/mode-detect.d.ts +34 -0
  353. package/dist/init/mode-detect.d.ts.map +1 -0
  354. package/dist/init/mode-detect.js +115 -0
  355. package/dist/init/mode-detect.js.map +1 -0
  356. package/dist/init/package-json-patcher.d.ts +36 -0
  357. package/dist/init/package-json-patcher.d.ts.map +1 -0
  358. package/dist/init/package-json-patcher.js +128 -0
  359. package/dist/init/package-json-patcher.js.map +1 -0
  360. package/dist/init/pnpm-workspace-patcher.d.ts +55 -0
  361. package/dist/init/pnpm-workspace-patcher.d.ts.map +1 -0
  362. package/dist/init/pnpm-workspace-patcher.js +248 -0
  363. package/dist/init/pnpm-workspace-patcher.js.map +1 -0
  364. package/dist/init/pyproject-patcher.d.ts +56 -0
  365. package/dist/init/pyproject-patcher.d.ts.map +1 -0
  366. package/dist/init/pyproject-patcher.js +324 -0
  367. package/dist/init/pyproject-patcher.js.map +1 -0
  368. package/dist/init/python-augment.d.ts +22 -0
  369. package/dist/init/python-augment.d.ts.map +1 -0
  370. package/dist/init/python-augment.js +300 -0
  371. package/dist/init/python-augment.js.map +1 -0
  372. package/dist/init/template-files.d.ts +18 -0
  373. package/dist/init/template-files.d.ts.map +1 -0
  374. package/dist/init/template-files.js +53 -0
  375. package/dist/init/template-files.js.map +1 -0
  376. package/dist/key/defaults.d.ts +3 -0
  377. package/dist/key/defaults.d.ts.map +1 -0
  378. package/dist/key/defaults.js +60 -0
  379. package/dist/key/defaults.js.map +1 -0
  380. package/dist/key/fingerprint.d.ts +6 -0
  381. package/dist/key/fingerprint.d.ts.map +1 -0
  382. package/dist/key/fingerprint.js +25 -0
  383. package/dist/key/fingerprint.js.map +1 -0
  384. package/dist/key/paths.d.ts +30 -0
  385. package/dist/key/paths.d.ts.map +1 -0
  386. package/dist/key/paths.js +51 -0
  387. package/dist/key/paths.js.map +1 -0
  388. package/dist/key/runners.d.ts +60 -0
  389. package/dist/key/runners.d.ts.map +1 -0
  390. package/dist/key/runners.js +4 -0
  391. package/dist/key/runners.js.map +1 -0
  392. package/dist/main.d.ts +113 -0
  393. package/dist/main.d.ts.map +1 -0
  394. package/dist/main.js +199 -0
  395. package/dist/main.js.map +1 -0
  396. package/dist/mcp/launcher.d.ts +143 -0
  397. package/dist/mcp/launcher.d.ts.map +1 -0
  398. package/dist/mcp/launcher.js +393 -0
  399. package/dist/mcp/launcher.js.map +1 -0
  400. package/dist/mcp/preset-loader.d.ts +29 -0
  401. package/dist/mcp/preset-loader.d.ts.map +1 -0
  402. package/dist/mcp/preset-loader.js +217 -0
  403. package/dist/mcp/preset-loader.js.map +1 -0
  404. package/dist/mcp/preset-types.d.ts +71 -0
  405. package/dist/mcp/preset-types.d.ts.map +1 -0
  406. package/dist/mcp/preset-types.js +4 -0
  407. package/dist/mcp/preset-types.js.map +1 -0
  408. package/dist/mcp/presets/README.md +68 -0
  409. package/dist/mcp/presets/postgres.json +15 -0
  410. package/dist/output.d.ts +26 -0
  411. package/dist/output.d.ts.map +1 -0
  412. package/dist/output.js +46 -0
  413. package/dist/output.js.map +1 -0
  414. package/dist/pack-config.d.ts +37 -0
  415. package/dist/pack-config.d.ts.map +1 -0
  416. package/dist/pack-config.js +65 -0
  417. package/dist/pack-config.js.map +1 -0
  418. package/dist/package-manager.d.ts +33 -0
  419. package/dist/package-manager.d.ts.map +1 -0
  420. package/dist/package-manager.js +129 -0
  421. package/dist/package-manager.js.map +1 -0
  422. package/dist/parse.d.ts +88 -0
  423. package/dist/parse.d.ts.map +1 -0
  424. package/dist/parse.js +100 -0
  425. package/dist/parse.js.map +1 -0
  426. package/dist/providers/preset-loader.d.ts +47 -0
  427. package/dist/providers/preset-loader.d.ts.map +1 -0
  428. package/dist/providers/preset-loader.js +107 -0
  429. package/dist/providers/preset-loader.js.map +1 -0
  430. package/dist/providers/presets/anthropic.json +47 -0
  431. package/dist/providers/presets/gemini.json +40 -0
  432. package/dist/reference.d.ts +28 -0
  433. package/dist/reference.d.ts.map +1 -0
  434. package/dist/reference.js +52 -0
  435. package/dist/reference.js.map +1 -0
  436. package/dist/sdk-package.d.ts +9 -0
  437. package/dist/sdk-package.d.ts.map +1 -0
  438. package/dist/sdk-package.js +20 -0
  439. package/dist/sdk-package.js.map +1 -0
  440. package/dist/sdk-skills/kindgi-authoring-agents/SKILL.md +252 -0
  441. package/dist/sdk-skills/kindgi-authoring-flows/SKILL.md +302 -0
  442. package/dist/sdk-skills/kindgi-authoring-guardrails/SKILL.md +297 -0
  443. package/dist/sdk-skills/kindgi-authoring-mcp-servers/SKILL.md +289 -0
  444. package/dist/sdk-skills/kindgi-authoring-providers/SKILL.md +705 -0
  445. package/dist/sdk-skills/kindgi-authoring-tools/SKILL.md +298 -0
  446. package/dist/sdk-skills/kindgi-framework-feedback/SKILL.md +211 -0
  447. package/dist/sdk-skills/kindgi-getting-started/SKILL.md +189 -0
  448. package/dist/sdk-skills/kindgi-python-authoring-agents/SKILL.md +205 -0
  449. package/dist/sdk-skills/kindgi-python-authoring-flows/SKILL.md +325 -0
  450. package/dist/sdk-skills/kindgi-python-authoring-guardrails/SKILL.md +176 -0
  451. package/dist/sdk-skills/kindgi-python-authoring-tools/SKILL.md +305 -0
  452. package/dist/sdk-skills/kindgi-python-getting-started/SKILL.md +242 -0
  453. package/dist/stop-signal.d.ts +15 -0
  454. package/dist/stop-signal.d.ts.map +1 -0
  455. package/dist/stop-signal.js +16 -0
  456. package/dist/stop-signal.js.map +1 -0
  457. package/dist/templates/minimal/.nvmrc +1 -0
  458. package/dist/templates/minimal/AGENTS.md +23 -0
  459. package/dist/templates/minimal/README.md.tmpl +69 -0
  460. package/dist/templates/minimal/agents/.gitkeep +0 -0
  461. package/dist/templates/minimal/flows/.gitkeep +0 -0
  462. package/dist/templates/minimal/gitignore +8 -0
  463. package/dist/templates/minimal/guardrails/.gitkeep +0 -0
  464. package/dist/templates/minimal/kindgi.config.ts.tmpl +44 -0
  465. package/dist/templates/minimal/package.json.tmpl +25 -0
  466. package/dist/templates/minimal/pnpm-workspace.yaml +8 -0
  467. package/dist/templates/minimal/tools/.gitkeep +0 -0
  468. package/dist/templates/minimal/tsconfig.json.tmpl +27 -0
  469. package/dist/templates/minimal/vitest.config.ts.tmpl +14 -0
  470. package/dist/templates/python/AGENTS.md +30 -0
  471. package/dist/templates/python/README.md.tmpl +56 -0
  472. package/dist/templates/python/agents/echo_agent.py.tmpl +23 -0
  473. package/dist/templates/python/flows/echo_flow.py.tmpl +17 -0
  474. package/dist/templates/python/gitignore +9 -0
  475. package/dist/templates/python/guardrails/response_not_empty.py.tmpl +27 -0
  476. package/dist/templates/python/pyproject.toml.tmpl +42 -0
  477. package/dist/templates/python/tests/test_tools.py.tmpl +22 -0
  478. package/dist/templates/python/tools/echo.py.tmpl +27 -0
  479. package/dist/templates/python/tools/greet.py.tmpl +20 -0
  480. package/dist/templates/sample/.nvmrc +1 -0
  481. package/dist/templates/sample/AGENTS.md +23 -0
  482. package/dist/templates/sample/README.md.tmpl +85 -0
  483. package/dist/templates/sample/agents/echo-agent/index.ts.tmpl +34 -0
  484. package/dist/templates/sample/flows/echo-flow/index.ts.tmpl +59 -0
  485. package/dist/templates/sample/gitignore +8 -0
  486. package/dist/templates/sample/guardrails/response-not-empty/index.ts.tmpl +58 -0
  487. package/dist/templates/sample/kindgi.config.ts.tmpl +41 -0
  488. package/dist/templates/sample/package.json.tmpl +25 -0
  489. package/dist/templates/sample/pnpm-workspace.yaml +8 -0
  490. package/dist/templates/sample/tools/echo/index.test.ts.tmpl +31 -0
  491. package/dist/templates/sample/tools/echo/index.ts.tmpl +37 -0
  492. package/dist/templates/sample/tools/fetch-httpbin/index.ts.tmpl +60 -0
  493. package/dist/templates/sample/tools/greet/index.ts.tmpl +35 -0
  494. package/dist/templates/sample/tsconfig.json.tmpl +27 -0
  495. package/dist/templates/sample/vitest.config.ts.tmpl +14 -0
  496. package/dist/terminal-input.d.ts +17 -0
  497. package/dist/terminal-input.d.ts.map +1 -0
  498. package/dist/terminal-input.js +88 -0
  499. package/dist/terminal-input.js.map +1 -0
  500. package/dist/test/defaults.d.ts +3 -0
  501. package/dist/test/defaults.d.ts.map +1 -0
  502. package/dist/test/defaults.js +104 -0
  503. package/dist/test/defaults.js.map +1 -0
  504. package/dist/test/runners.d.ts +60 -0
  505. package/dist/test/runners.d.ts.map +1 -0
  506. package/dist/test/runners.js +4 -0
  507. package/dist/test/runners.js.map +1 -0
  508. package/dist/version-info.d.ts +9 -0
  509. package/dist/version-info.d.ts.map +1 -0
  510. package/dist/version-info.js +27 -0
  511. package/dist/version-info.js.map +1 -0
  512. package/dist/write-fully.d.ts +13 -0
  513. package/dist/write-fully.d.ts.map +1 -0
  514. package/dist/write-fully.js +17 -0
  515. package/dist/write-fully.js.map +1 -0
  516. package/package.json +63 -4
@@ -0,0 +1,325 @@
1
+ ---
2
+ name: kindgi-python-authoring-flows
3
+ description: >
4
+ Covers writing flows for a Kindgi pack in Python (the `kindgi`
5
+ package): declaring a `Flow(...)` at module level, tool and agent
6
+ steps (Tool and Agent objects as refs), edges and `when` conditions,
7
+ branches that join again, inputMapping from runInput / nodeOutputs,
8
+ typed agent output in a flow, the flow's declared output, loops
9
+ (foreach / while) and fanout, per-edge retry and timeout, and running
10
+ a flow (kindgi runs start --flow, in the background, as a dry run) and
11
+ reading its journal. Load this whenever you are authoring or editing
12
+ code inside a Python pack's flows/ directory (a pack whose config is
13
+ `[tool.kindgi]` in pyproject.toml), defining a flow, or when the user
14
+ asks to add, change or debug one. Python tools are covered by
15
+ kindgi-python-authoring-tools, Python agents by
16
+ kindgi-python-authoring-agents.
17
+ type: core
18
+ library: "kindgi (Python)"
19
+ version: "0.1.1"
20
+ sdk_version: "0.1.1"
21
+ pack_languages: [python]
22
+ sources:
23
+ - sdks/python/src/kindgi/pack/define.py
24
+ - sdks/python/src/kindgi/pack/index.py
25
+ - packages/specs/schemas/flow.schema.json
26
+ ---
27
+
28
+ # Authoring Kindgi flows in Python
29
+
30
+ > **Running `kindgi`:** a Python pack has no Node project, so the
31
+ > `kindgi` CLI is the one on `PATH`. Python commands run in the pack's
32
+ > environment: `uv run …` (or `.venv/bin/python …`).
33
+
34
+ A **flow** is a versioned, durable graph of steps: tools (your code) and
35
+ agents (a model's judgment), joined by edges that can carry conditions.
36
+ It is **data**, not code: a `Flow(...)` at module level in
37
+ `flows/<name>.py`. The runtime runs it step by step, journals every
38
+ step, and can resume a run that was interrupted. A run pins the flow
39
+ version it started on.
40
+
41
+ Use a flow when the order of the work is known: parse, then classify,
42
+ then branch, then write. Use a single agent when the model should decide
43
+ the order.
44
+
45
+ ## Ask before building
46
+
47
+ - **What goes in, and what comes out?** The run input's shape and the
48
+ output the caller reads. They become `runInput.*` paths and `output`.
49
+ - **Which steps are code, which are judgment?** Deterministic work
50
+ (parse, rank, look up, write) is a tool; judgment (classify, draft,
51
+ summarize) is an agent with a typed `output`.
52
+ - **Where does it branch?** Every branch needs a condition, and the
53
+ steps after a branch must cope with the branch that didn't run.
54
+ - **What does it change outside Kindgi?** Know which tools write: a dry
55
+ run stops before them (see "Running a flow").
56
+
57
+ ## A flow
58
+
59
+ ```python
60
+ # flows/triage_ticket.py
61
+ from kindgi import Flow
62
+
63
+ from ..agents.ticket_classifier import ticket_classifier
64
+ from ..tools.tickets import draft_reply, lookup_invoice, parse_ticket
65
+
66
+ IS_BILLING = {
67
+ "op": "eq",
68
+ "left": {"path": "nodeOutputs.classify.output.category"},
69
+ "right": {"literal": "billing"},
70
+ }
71
+
72
+ triage_ticket = Flow(
73
+ id="acme.triage-ticket",
74
+ version="0.1.0",
75
+ name="Triage a support ticket",
76
+ description="Parses a ticket, classifies it, looks up billing when needed, drafts a reply.",
77
+ nodes=[
78
+ {
79
+ "id": "parse",
80
+ "kind": "tool",
81
+ "ref": parse_ticket,
82
+ "inputMapping": {"ticket": {"path": "runInput.ticket"}},
83
+ },
84
+ {
85
+ "id": "classify",
86
+ "kind": "agent",
87
+ "ref": ticket_classifier, # an Agent with output=
88
+ "inputMapping": {"text": {"path": "nodeOutputs.parse.text"}},
89
+ "config": {"parameters": {"product": "acme-cloud"}},
90
+ },
91
+ {
92
+ "id": "billing",
93
+ "kind": "tool",
94
+ "ref": lookup_invoice,
95
+ "inputMapping": {"customer_id": {"path": "runInput.ticket.customer_id"}},
96
+ },
97
+ {
98
+ "id": "reply",
99
+ "kind": "tool",
100
+ "ref": draft_reply,
101
+ "inputMapping": {
102
+ "category": {"path": "nodeOutputs.classify.output.category"},
103
+ "invoice": {"path": "nodeOutputs.billing.invoice"}, # absent when billing didn't run
104
+ },
105
+ },
106
+ ],
107
+ edges=[
108
+ {"id": "e0", "from": "$start", "to": "parse"},
109
+ {"id": "e1", "from": "parse", "to": "classify"},
110
+ {"id": "e2", "from": "classify", "to": "billing", "when": IS_BILLING},
111
+ {"id": "e3", "from": "classify", "to": "reply", "when": {"op": "not", "child": IS_BILLING}},
112
+ {"id": "e4", "from": "billing", "to": "reply"},
113
+ {"id": "e5", "from": "reply", "to": "$end"},
114
+ ],
115
+ output={
116
+ "mapping": {
117
+ "category": {"path": "nodeOutputs.classify.output.category"},
118
+ "reply": {"path": "nodeOutputs.reply.text"},
119
+ },
120
+ "schema": {
121
+ "type": "object",
122
+ "properties": {"category": {"type": "string"}, "reply": {"type": "string"}},
123
+ "required": ["category", "reply"],
124
+ },
125
+ },
126
+ )
127
+ ```
128
+
129
+ - **Refs** are the `Tool` / `Agent` (or `Flow`) objects, imported
130
+ relatively from the pack's own modules — anywhere in the flow, loop
131
+ bodies and fanout branches included. A primitive from another pack is
132
+ its id string. Ids are plain strings; no casts.
133
+ - **The dicts are the wire shape**, so their keys are camelCase
134
+ (`inputMapping`, `loopKind`, `maxIterations`); `Flow`'s own keywords
135
+ are snake_case (`max_parallelism`).
136
+ - **Where it's checked:** `Flow(...)` checks the id when the module
137
+ loads. The indexer checks the rest against `flow.schema.json` —
138
+ version, node and edge shapes, `$start` / `$end` — and `kindgi dev`
139
+ reports a mistake as a file error that says what and where
140
+ (`flow 'acme.triage-ticket' is invalid at /nodes/0: must NOT have
141
+ additional properties ('input_mapping')`), while the pack's other
142
+ primitives keep serving. That a ref's tool or agent
143
+ exists is checked when a run starts (see "Running a flow").
144
+
145
+ ## Nodes
146
+
147
+ - **`"kind": "tool"`** runs the tool `ref`. The tool's input is what the
148
+ node's `inputMapping` builds, else the output of the node's single
149
+ upstream node (the run input after `$start`). It is validated against
150
+ the tool's input schema, so a mismatch fails the step with
151
+ `input-validation-failed`. The node's output is the tool's return
152
+ value, as JSON (field aliases, if the model has any).
153
+ - **`"kind": "agent"`** runs one turn of the agent `ref` as a child run
154
+ of the flow run. The agent gets the node's input in two ways:
155
+ - as **structured input**: `{{ input.text }}` in its instructions;
156
+ - as its user message (the input as JSON).
157
+
158
+ `"config": {"parameters": {…}}` fills the agent's `parameters`
159
+ (string, number or boolean values). `"config": {"version": "1.2.0"}`
160
+ pins an agent version; without it the latest active version runs.
161
+
162
+ The node's output:
163
+ - `output` is the agent's typed answer (its `output=` model);
164
+ - `text` is the answer as text;
165
+ - `runId` and `conversationId` belong to the child run.
166
+
167
+ Read a field as `nodeOutputs.<node>.output.<field>`. An answer that
168
+ doesn't fit the agent's `output`, after its repairs, fails the step
169
+ with `output-schema-violation`. An approval inside the agent's turn
170
+ parks the flow until it's decided.
171
+ - **`"kind": "loop"`** repeats a body: `"loopKind": "foreach"` once per
172
+ element of `iterateOver` (`concurrency` up to 32 in parallel), or
173
+ `"loopKind": "while"` until `exitCondition`.
174
+ - The body (`"body": {"nodes": [...], "edges": [...]}`) has its own
175
+ nodes and edges, with `$loop-start` / `$loop-end`; the element is
176
+ the body's input.
177
+ - `maxIterations` and `outputSchema` are required.
178
+ - The loop's output is `finalOutput`, plus `outputs` with
179
+ `"collectAllIterations": True`.
180
+ - Node ids must be unique across the whole flow, bodies included.
181
+ - **`"kind": "fanout"`** runs several handlers on the same input at
182
+ once, each a branch (`branchId`, `handler` — a `Tool` or an id —
183
+ and `outputSchema`). `convergence` decides the result: `all-succeed`,
184
+ `any-succeed` (the first success wins), or `settle-all` (wait for
185
+ every branch and report each).
186
+ - **`"kind": "subgraph"`** (a sub-flow) is part of the flow schema, but a
187
+ run refuses it today (`flow-unbound`). Inline the steps instead.
188
+
189
+ ## Edges and conditions
190
+
191
+ An edge goes from a node (or `$start`) to a node (or `$end`). Without
192
+ `when` it fires when its source completes; with `when` it fires only if
193
+ the condition is true. Conditions are dicts:
194
+
195
+ | Operator | Shape |
196
+ |---|---|
197
+ | `eq` `ne` `lt` `lte` `gt` `gte` | `{"op", "left", "right"}` |
198
+ | `in` `notIn` | `{"op", "value", "set"}` |
199
+ | `exists` `notExists` `truthy` `falsy` | `{"op", "value"}` |
200
+ | `and` `or` | `{"op", "children": [...]}` |
201
+ | `not` | `{"op", "child"}` |
202
+
203
+ Each operand is `{"literal": …}` or `{"path": …}`. When a path doesn't
204
+ resolve, `eq`, `lt`, `lte`, `gt` and `gte` are false and `ne` is true. So
205
+ for the "otherwise" branch, write `not` around the condition (as above),
206
+ rather than a second comparison: it covers exactly what the first edge
207
+ doesn't. A condition
208
+ used twice is easiest as a module-level constant (`IS_BILLING`).
209
+
210
+ **Joining branches.** A node with several incoming edges runs once every
211
+ one of them is decided and at least one fired. In the example, `reply`
212
+ runs after `billing` on the billing branch, and straight after
213
+ `classify` otherwise. A node none of whose incoming edges fired is
214
+ skipped, and so is everything only it leads to.
215
+
216
+ **Edge policy** (`"policy"` on the edge into a node with a single
217
+ incoming edge):
218
+ - `"retry": {"maxAttempts", "delayMs"?, "backoff"?, "maxDelayMs"?}`: up
219
+ to 10 attempts in all;
220
+ - `"timeoutMs"`: a step that takes longer fails with `reason: timeout`;
221
+ - `"concurrencyKey"`: at most one such step at a time in the tenant;
222
+ - `"priority"`: −100 to 100.
223
+
224
+ A node with several incoming edges ignores them.
225
+
226
+ ## Inputs and the output
227
+
228
+ `inputMapping` maps each key to a `{"literal": …}` or a `{"path": …}`.
229
+ Its keys are the tool's input **as it travels**: a pydantic field's name,
230
+ or its alias if it has one (a `customer_id` field is the key
231
+ `customer_id`; with `alias="customerId"`, it's `customerId`). Paths are
232
+ dot-separated (a number segment indexes an array: `items.0.sku`), rooted at:
233
+ - `runInput.…`: the input the run was started with;
234
+ - `nodeOutputs.<nodeId>.…`: a step's output. For an agent step, add
235
+ `.output.<field>` to read its typed answer;
236
+ - `state.…`: values written by the runtime's own handlers. Pack tools
237
+ don't write it, so use `nodeOutputs`.
238
+
239
+ A path that doesn't resolve leaves its key out. A step after a branch
240
+ that didn't run gets no `invoice` key at all, rather than `None`. Give
241
+ that field a default in the tool's input model
242
+ (`invoice: Invoice | None = None`).
243
+
244
+ `output` is what the run returns: a `mapping` resolved when the run
245
+ finishes, checked against `schema` if you give one. A run whose output
246
+ doesn't match fails. Without `output`, the run returns the output of the
247
+ step that reached `$end`.
248
+
249
+ ## Running a flow
250
+
251
+ From another terminal in the pack directory, while `kindgi dev` runs:
252
+
253
+ ```sh
254
+ kindgi runs start --flow=acme.triage-ticket --input='{"ticket":{"customer_id":"c-1","body":"Charged twice"}}'
255
+ kindgi runs start --flow=acme.triage-ticket --input=@ticket.json --no-wait # the run id now; it finishes in the background
256
+ kindgi runs start --flow=acme.triage-ticket --input=@ticket.json --dry-run # stops before a tool that may write
257
+ kindgi runs get <run-id> # status, output, failureMessage
258
+ kindgi runs journal <run-id> # every step.started / step.completed / edge.evaluated
259
+ kindgi runs stream <run-id> # follow a running one
260
+ kindgi runs cancel <run-id>
261
+ ```
262
+
263
+ Or from Python, with `kindgi.client`:
264
+ `Kindgi().runs.start(flow="acme.triage-ticket", input={...})`.
265
+
266
+ - **A refusal before the run exists:** `422 flow-unbound` names the
267
+ nodes a run can't bind: a tool or agent id the tenant doesn't have, or
268
+ a sub-flow. Fix the ids; nothing ran.
269
+ - **A failed step fails the run**, and `failureMessage` says which step
270
+ and why. Retry it on its edge with `policy.retry` only if running the
271
+ step twice is safe.
272
+ - **`--no-wait`** is how an application starts runs
273
+ (`options={"wait": False}`). It answers with the run id at once; poll
274
+ the run or follow its stream.
275
+ - **`--dry-run`** runs a tool only if it's declared read-only:
276
+ `@tool(..., mutating=False)` (or `http_tool(..., mutating=False)`),
277
+ and no `writes`, `deletes`, `spawns-run`, `emits-event` or
278
+ `external-side-effect` effect. The first other tool stops the run with
279
+ `dry-run-effectful-tool`, and everything before it really ran. That's
280
+ useful for checking the wiring without the writes.
281
+
282
+ ## Iterating on a flow
283
+
284
+ Save the file and `kindgi dev` re-indexes; the next run uses the new
285
+ definition, with no restart. A run already in flight keeps the version it
286
+ started on. Bump `version` when callers' contract changes (the input or
287
+ the output), not on every save.
288
+
289
+ ## Common mistakes
290
+
291
+ 1. **Building a flow without asking what goes in and comes out.** The
292
+ pack's `echo_flow` proves the runtime works. It isn't a template for
293
+ the user's flow.
294
+ 2. **A second comparison for "otherwise".** On a path that may be
295
+ missing, `eq` is false and `ne` is true, and `lt`/`gt` are both false,
296
+ so a hand-written opposite can miss a case or overlap. Use `not` around
297
+ the positive condition: it covers exactly what the first edge doesn't.
298
+ 3. **Reading an agent step's answer at `nodeOutputs.<step>.<field>`.**
299
+ The typed answer is under `.output`: `nodeOutputs.<step>.output.<field>`.
300
+ An agent without `output=` has only `text`.
301
+ 4. **A required input field fed by a branch that may not run.** The key
302
+ is omitted, the tool's input check fails, and so does the step. Give
303
+ the field a default.
304
+ 5. **`inputMapping` keys in the wrong spelling.** They're the input's
305
+ wire names (field names, or aliases): `customerId` doesn't fill a
306
+ `customer_id` field that has no alias.
307
+ 6. **snake_case keys inside the dicts** (`input_mapping`,
308
+ `max_iterations`). The indexer refuses them, naming the key; the
309
+ dicts are camelCase.
310
+ 7. **A sub-flow node.** A run refuses it (`flow-unbound`) until
311
+ sub-flows are supported.
312
+ 8. **Duplicate node ids inside a loop body.** Ids are unique across the
313
+ whole flow, bodies included.
314
+ 9. **`mutating=False` on a tool that writes.** A dry run then runs it for
315
+ real, and an agent's tool approval gate (when it falls back on
316
+ `mutating`) won't ask before it.
317
+ 10. **A read-only tool without `mutating=False`.** A dry run stops at it,
318
+ and an agent's tool approval gate asks before it on first use.
319
+
320
+ ## When the framework itself is the problem
321
+
322
+ If the bug is in Kindgi or the `kindgi` package (a step's output missing
323
+ a field, a condition that evaluates wrongly, a misleading error) and not
324
+ in the pack's code, load `kindgi-framework-feedback` and file it with
325
+ `kindgi feedback write`.
@@ -0,0 +1,176 @@
1
+ ---
2
+ name: kindgi-python-authoring-guardrails
3
+ description: >
4
+ Covers writing guardrails (safety checks on an agent's turn) for a
5
+ Kindgi pack in Python (the `kindgi` package): the `@guardrail`
6
+ decorator over a `(config, trace)` check, `RunTrace` and
7
+ `CheckResult`, config models, actions (halt / retry / escalate /
8
+ log-only / compensate), severity and scope, unit tests, and wiring a
9
+ guardrail onto an agent. Load this whenever you are authoring or
10
+ editing code inside a Python pack's guardrails/ directory (a pack
11
+ whose config is `[tool.kindgi]` in pyproject.toml), defining a check,
12
+ or wiring a guardrail onto an agent. Python agents are covered by
13
+ kindgi-python-authoring-agents, Python tools by
14
+ kindgi-python-authoring-tools.
15
+ type: core
16
+ library: "kindgi (Python)"
17
+ version: "0.1.1"
18
+ sdk_version: "0.1.1"
19
+ pack_languages: [python]
20
+ sources:
21
+ - sdks/python/src/kindgi/pack/define.py
22
+ - sdks/python/src/kindgi/pack/trace.py
23
+ - sdks/python/src/kindgi/pack/service.py
24
+ ---
25
+
26
+ # Authoring Kindgi guardrails in Python
27
+
28
+ > **Running `kindgi`:** a Python pack has no Node project, so the
29
+ > `kindgi` CLI is the one on `PATH`. Python commands run in the pack's
30
+ > environment: `uv run …` (or `.venv/bin/python …`).
31
+
32
+ A **guardrail** is a rule an agent's turn must satisfy: a **check** (a
33
+ function over the turn's trace) plus an **action** (what happens when it
34
+ fails). In a Python pack, `@guardrail(...)` on a function at module
35
+ level in a file under `guardrails/` declares both. For an agent turn,
36
+ the runtime evaluates every guardrail the agent lists once, on the final
37
+ answer, before it is stored.
38
+
39
+ Ask what the rule should catch before writing one; the sample
40
+ `response-not-empty` guardrail is a demonstration, not a template.
41
+
42
+ ## A guardrail
43
+
44
+ ```python
45
+ # guardrails/citations.py
46
+ from pydantic import BaseModel, Field
47
+
48
+ from kindgi import CheckResult, RunTrace, guardrail
49
+
50
+
51
+ class Config(BaseModel):
52
+ min_lookups: int = Field(1, alias="minLookups", ge=0)
53
+
54
+
55
+ @guardrail(
56
+ id="acme.no-fabricated-quotes",
57
+ name="No fabricated quotations",
58
+ on_violation="halt",
59
+ severity="critical",
60
+ config={"minLookups": 2}, # what the check runs with — keyed as on the wire
61
+ )
62
+ def no_fabricated_quotes(config: Config, trace: RunTrace) -> CheckResult:
63
+ lookups = [c for c in trace.tool_calls if c.tool_name == "acme.verify-citation"]
64
+ if len(lookups) < config.min_lookups:
65
+ return CheckResult(
66
+ passed=False,
67
+ reason=f"Only {len(lookups)} citation lookups (need {config.min_lookups}+).",
68
+ )
69
+ return CheckResult(passed=True)
70
+ ```
71
+
72
+ - **The check** is `(config, trace)`, `def` or `async def`, and returns a
73
+ `CheckResult`, a dict with a boolean `"passed"`, or a `bool`. A failed
74
+ result's `reason` is what the violation reports — make it say what was
75
+ wrong.
76
+ - **`trace`** is a `RunTrace` (snake_case here, camelCase on the wire):
77
+ `output` (the final answer text), `tool_calls` (`tool_id`,
78
+ `tool_name`, `arguments`), `tool_results` (`tool_call_id`, `output`),
79
+ `model_calls` (`provider_id`, `model`, tokens), `user_input`,
80
+ `agent_id`, `conversation_id`, `turn_number`, `total_cost_usd`,
81
+ `duration_ms`, `mode` (`"runtime"` or `"ci"`). Annotate it `dict` to get
82
+ the raw wire dict instead.
83
+ - **`config`** — its type comes from the first parameter's annotation
84
+ (or `config_type=`) and becomes the guardrail's config schema. The
85
+ values are `config=` on the decorator, keyed as on the wire (the
86
+ model's aliases): `@guardrail(..., config={"minLookups": 2})`. They are
87
+ checked against the type where declared, go into the index, and the
88
+ check runs with them. Without `config=` the check runs with `{}` — so
89
+ give every field a default; a required field without a value fails
90
+ every evaluation (`input-validation-failed`).
91
+ - An exception in the check fails the evaluation (`handler-throw`);
92
+ return a failed `CheckResult` for a rule that isn't met.
93
+ - A check gets no model and no provider: it can't call an LLM. Keep it a
94
+ pure function of the trace (fast, deterministic, free).
95
+
96
+ ## `@guardrail(...)`
97
+
98
+ - **`id`** — `<pack-id>.<guardrail-name>`, kebab-case. Name the rule as
99
+ a positive assertion: `no-fabricated-quotes`, `response-not-empty`.
100
+ - **`on_violation`** — the action: `"halt"`, `"retry"`, `"escalate"`,
101
+ `"log-only"`, `"compensate"`. For one that needs settings pass the
102
+ whole object with `action=` instead (exactly one of the two):
103
+ `action={"on-violation": "retry", "retry": {"maxAttempts": 2}}`,
104
+ `{"on-violation": "escalate", "escalateTo": …}`,
105
+ `{"on-violation": "compensate", "compensateWith": "<tool id>"}`.
106
+ In an agent turn a failed `halt` guardrail fails the turn
107
+ (`guardrail-violation`) and the answer is not stored; any other action
108
+ reports the failure in the turn result's `violations` and the turn
109
+ completes. In 0.1 the runtime acts only on `halt`: `retry`, `escalate`
110
+ and `compensate` are recorded on the violation, with no second attempt,
111
+ escalation or compensating call.
112
+ - **`severity`** — `"info"`, `"warn"`, `"error"` (default), `"critical"`.
113
+ Independent of the action: dashboards group by severity, execution
114
+ follows the action.
115
+ - **`scope`** — when it applies: `{"when": "always" | "ci-only" |
116
+ "runtime-only"}`, narrowed by `agents`, `flows`, `tenants` lists.
117
+ - **`kind`** — `"zero-llm"` (default): a check over the trace — what a
118
+ pack writes.
119
+ - **`config`** — the values the check runs with (above); **`config_type`**
120
+ — the config's type when the check's first parameter isn't annotated
121
+ with it.
122
+ - **`name`** — a display name. **`check_id`** — defaults to the id.
123
+ - `sandbox=`, `limits=`, `network=` are recorded in the index.
124
+
125
+ ## Testing
126
+
127
+ A `Guardrail` is still callable:
128
+
129
+ ```python
130
+ # tests/test_guardrails.py
131
+ from kindgi import RunTrace
132
+ from guardrails.citations import Config, no_fabricated_quotes
133
+
134
+
135
+ def test_no_lookups_fails():
136
+ trace = RunTrace(run_id="r", tenant_id="t", output="As held in Smith v. Jones…")
137
+ assert not no_fabricated_quotes(Config(), trace).passed
138
+ ```
139
+
140
+ `RunTrace(...)` takes snake_case fields; `tool_calls` entries are
141
+ `ToolCallRecord(tool_id=…, tool_name=…, arguments={…}, at="…")`.
142
+
143
+ ## Wiring onto an agent
144
+
145
+ ```python
146
+ from ..guardrails.citations import no_fabricated_quotes
147
+
148
+ brief_writer = Agent(..., guardrails=[no_fabricated_quotes])
149
+ ```
150
+
151
+ The `Guardrail` object (or its id). `kindgi dev` registers the pack's
152
+ guardrails; an agent naming an id with no registered guardrail fails the
153
+ turn before the model is called (`Error [invalid-request]: Agent "…"
154
+ references guardrails not in the registry: <id>`).
155
+
156
+ ## Common mistakes
157
+
158
+ 1. **A required config field with no `config=` value.** Without
159
+ `config=` the check runs with `{}`; give the field a default or the
160
+ guardrail its values.
161
+ 2. **Snake_case keys in `config=`.** It is keyed like the wire — the
162
+ model's aliases (`{"minLookups": 2}`), not the field names.
163
+ 3. **Both `on_violation=` and `action=`, or neither** — `DefinitionError`.
164
+ 4. **Expecting another attempt.** `halt` stops the turn, and in 0.1
165
+ `retry` doesn't run the turn again: it's only recorded.
166
+ 5. **Calling a model from the check.** Not available; keep checks pure.
167
+ 6. **Raising for a broken rule.** Return `CheckResult(passed=False,
168
+ reason=…)`; an exception is an evaluation error, not a violation.
169
+ 7. **Defining the guardrail inside a function** — only module-level
170
+ primitives are indexed.
171
+
172
+ ## When the framework itself is the problem
173
+
174
+ If the bug is in Kindgi or the `kindgi` package (a trace field missing,
175
+ a misleading error) and not in the check, load
176
+ `kindgi-framework-feedback` and file it with `kindgi feedback write`.