@kindgi/cli 0.1.11-rc.0 → 0.2.0-rc.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 (343) hide show
  1. package/README.md +77 -33
  2. package/dist/build/containerfile.d.ts +2 -0
  3. package/dist/build/containerfile.d.ts.map +1 -1
  4. package/dist/build/containerfile.js +14 -3
  5. package/dist/build/containerfile.js.map +1 -1
  6. package/dist/build/defaults.d.ts +2 -0
  7. package/dist/build/defaults.d.ts.map +1 -1
  8. package/dist/build/defaults.js +8 -0
  9. package/dist/build/defaults.js.map +1 -1
  10. package/dist/build/hosted.d.ts +2 -9
  11. package/dist/build/hosted.d.ts.map +1 -1
  12. package/dist/build/hosted.js +4 -2
  13. package/dist/build/hosted.js.map +1 -1
  14. package/dist/build/pack-blocks.d.ts +51 -0
  15. package/dist/build/pack-blocks.d.ts.map +1 -0
  16. package/dist/build/pack-blocks.js +98 -0
  17. package/dist/build/pack-blocks.js.map +1 -0
  18. package/dist/build/runners.d.ts +5 -1
  19. package/dist/build/runners.d.ts.map +1 -1
  20. package/dist/cli.js +4 -0
  21. package/dist/cli.js.map +1 -1
  22. package/dist/commands/adapters.d.ts.map +1 -1
  23. package/dist/commands/adapters.js +12 -6
  24. package/dist/commands/adapters.js.map +1 -1
  25. package/dist/commands/agents.js +8 -8
  26. package/dist/commands/agents.js.map +1 -1
  27. package/dist/commands/auth.d.ts.map +1 -1
  28. package/dist/commands/auth.js +155 -39
  29. package/dist/commands/auth.js.map +1 -1
  30. package/dist/commands/blocks.d.ts.map +1 -1
  31. package/dist/commands/blocks.js +1 -1
  32. package/dist/commands/blocks.js.map +1 -1
  33. package/dist/commands/build.d.ts +17 -6
  34. package/dist/commands/build.d.ts.map +1 -1
  35. package/dist/commands/build.js +136 -89
  36. package/dist/commands/build.js.map +1 -1
  37. package/dist/commands/connection-apps.d.ts +3 -0
  38. package/dist/commands/connection-apps.d.ts.map +1 -0
  39. package/dist/commands/connection-apps.js +239 -0
  40. package/dist/commands/connection-apps.js.map +1 -0
  41. package/dist/commands/connections.d.ts +44 -0
  42. package/dist/commands/connections.d.ts.map +1 -0
  43. package/dist/commands/connections.js +385 -0
  44. package/dist/commands/connections.js.map +1 -0
  45. package/dist/commands/conversations.js +1 -1
  46. package/dist/commands/conversations.js.map +1 -1
  47. package/dist/commands/deploy.d.ts.map +1 -1
  48. package/dist/commands/deploy.js +178 -97
  49. package/dist/commands/deploy.js.map +1 -1
  50. package/dist/commands/dev.d.ts +10 -0
  51. package/dist/commands/dev.d.ts.map +1 -1
  52. package/dist/commands/dev.js +177 -87
  53. package/dist/commands/dev.js.map +1 -1
  54. package/dist/commands/doctor.js +7 -7
  55. package/dist/commands/doctor.js.map +1 -1
  56. package/dist/commands/env-scoped.d.ts.map +1 -1
  57. package/dist/commands/env-scoped.js +37 -22
  58. package/dist/commands/env-scoped.js.map +1 -1
  59. package/dist/commands/env.d.ts.map +1 -1
  60. package/dist/commands/env.js +35 -22
  61. package/dist/commands/env.js.map +1 -1
  62. package/dist/commands/eval-runs.js +6 -6
  63. package/dist/commands/eval-runs.js.map +1 -1
  64. package/dist/commands/eval-suites.js +9 -9
  65. package/dist/commands/eval-suites.js.map +1 -1
  66. package/dist/commands/exports.d.ts.map +1 -1
  67. package/dist/commands/exports.js +35 -9
  68. package/dist/commands/exports.js.map +1 -1
  69. package/dist/commands/feedback.d.ts.map +1 -1
  70. package/dist/commands/feedback.js +4 -3
  71. package/dist/commands/feedback.js.map +1 -1
  72. package/dist/commands/gate-policies.d.ts.map +1 -1
  73. package/dist/commands/gate-policies.js +7 -7
  74. package/dist/commands/gate-policies.js.map +1 -1
  75. package/dist/commands/helpers.d.ts +9 -0
  76. package/dist/commands/helpers.d.ts.map +1 -1
  77. package/dist/commands/helpers.js +20 -0
  78. package/dist/commands/helpers.js.map +1 -1
  79. package/dist/commands/index.d.ts.map +1 -1
  80. package/dist/commands/index.js +8 -0
  81. package/dist/commands/index.js.map +1 -1
  82. package/dist/commands/init.d.ts +1 -1
  83. package/dist/commands/init.d.ts.map +1 -1
  84. package/dist/commands/init.js +57 -45
  85. package/dist/commands/init.js.map +1 -1
  86. package/dist/commands/judge-classes.js +4 -4
  87. package/dist/commands/judge-classes.js.map +1 -1
  88. package/dist/commands/judging-queue.d.ts +3 -0
  89. package/dist/commands/judging-queue.d.ts.map +1 -0
  90. package/dist/commands/judging-queue.js +105 -0
  91. package/dist/commands/judging-queue.js.map +1 -0
  92. package/dist/commands/judging-rules.d.ts +3 -0
  93. package/dist/commands/judging-rules.d.ts.map +1 -0
  94. package/dist/commands/judging-rules.js +351 -0
  95. package/dist/commands/judging-rules.js.map +1 -0
  96. package/dist/commands/judgments.d.ts.map +1 -1
  97. package/dist/commands/judgments.js +78 -36
  98. package/dist/commands/judgments.js.map +1 -1
  99. package/dist/commands/key.d.ts.map +1 -1
  100. package/dist/commands/key.js +107 -9
  101. package/dist/commands/key.js.map +1 -1
  102. package/dist/commands/license.d.ts.map +1 -1
  103. package/dist/commands/license.js +67 -15
  104. package/dist/commands/license.js.map +1 -1
  105. package/dist/commands/mcp.d.ts.map +1 -1
  106. package/dist/commands/mcp.js +4 -4
  107. package/dist/commands/mcp.js.map +1 -1
  108. package/dist/commands/people.js +8 -14
  109. package/dist/commands/people.js.map +1 -1
  110. package/dist/commands/promote.js +1 -1
  111. package/dist/commands/promote.js.map +1 -1
  112. package/dist/commands/proposals.d.ts.map +1 -1
  113. package/dist/commands/proposals.js +83 -30
  114. package/dist/commands/proposals.js.map +1 -1
  115. package/dist/commands/run-waits.d.ts +68 -19
  116. package/dist/commands/run-waits.d.ts.map +1 -1
  117. package/dist/commands/run-waits.js +82 -8
  118. package/dist/commands/run-waits.js.map +1 -1
  119. package/dist/commands/runs.d.ts.map +1 -1
  120. package/dist/commands/runs.js +70 -30
  121. package/dist/commands/runs.js.map +1 -1
  122. package/dist/commands/schedules.d.ts.map +1 -1
  123. package/dist/commands/schedules.js +35 -12
  124. package/dist/commands/schedules.js.map +1 -1
  125. package/dist/commands/secrets-copy.d.ts.map +1 -1
  126. package/dist/commands/secrets-copy.js +20 -12
  127. package/dist/commands/secrets-copy.js.map +1 -1
  128. package/dist/commands/secrets.d.ts.map +1 -1
  129. package/dist/commands/secrets.js +13 -8
  130. package/dist/commands/secrets.js.map +1 -1
  131. package/dist/commands/sign-in.js +2 -2
  132. package/dist/commands/sign-in.js.map +1 -1
  133. package/dist/commands/sites.d.ts.map +1 -1
  134. package/dist/commands/sites.js +13 -6
  135. package/dist/commands/sites.js.map +1 -1
  136. package/dist/commands/skills.d.ts +54 -3
  137. package/dist/commands/skills.d.ts.map +1 -1
  138. package/dist/commands/skills.js +169 -38
  139. package/dist/commands/skills.js.map +1 -1
  140. package/dist/commands/tokens.d.ts.map +1 -1
  141. package/dist/commands/tokens.js +9 -1
  142. package/dist/commands/tokens.js.map +1 -1
  143. package/dist/commands/upgrade.d.ts.map +1 -1
  144. package/dist/commands/upgrade.js +9 -8
  145. package/dist/commands/upgrade.js.map +1 -1
  146. package/dist/commands/webhooks.d.ts.map +1 -1
  147. package/dist/commands/webhooks.js +62 -24
  148. package/dist/commands/webhooks.js.map +1 -1
  149. package/dist/config.d.ts +6 -0
  150. package/dist/config.d.ts.map +1 -1
  151. package/dist/config.js +18 -3
  152. package/dist/config.js.map +1 -1
  153. package/dist/context.d.ts +12 -0
  154. package/dist/context.d.ts.map +1 -1
  155. package/dist/context.js +2 -0
  156. package/dist/context.js.map +1 -1
  157. package/dist/deploy/pack-blocks-gate.d.ts +12 -0
  158. package/dist/deploy/pack-blocks-gate.d.ts.map +1 -0
  159. package/dist/deploy/pack-blocks-gate.js +34 -0
  160. package/dist/deploy/pack-blocks-gate.js.map +1 -0
  161. package/dist/deploy/post.d.ts +9 -0
  162. package/dist/deploy/post.d.ts.map +1 -1
  163. package/dist/deploy/post.js +20 -3
  164. package/dist/deploy/post.js.map +1 -1
  165. package/dist/dev/defaults.d.ts.map +1 -1
  166. package/dist/dev/defaults.js +8 -1
  167. package/dist/dev/defaults.js.map +1 -1
  168. package/dist/dev/dev-only-imports.d.ts +7 -4
  169. package/dist/dev/dev-only-imports.d.ts.map +1 -1
  170. package/dist/dev/dev-only-imports.js +5 -5
  171. package/dist/dev/dev-only-imports.js.map +1 -1
  172. package/dist/dev/log-view.d.ts +4 -4
  173. package/dist/dev/log-view.d.ts.map +1 -1
  174. package/dist/dev/log-view.js +4 -4
  175. package/dist/dev/log-view.js.map +1 -1
  176. package/dist/dev/pack-service.d.ts +7 -1
  177. package/dist/dev/pack-service.d.ts.map +1 -1
  178. package/dist/dev/pack-service.js +36 -3
  179. package/dist/dev/pack-service.js.map +1 -1
  180. package/dist/dev/preview-expiry.d.ts +6 -7
  181. package/dist/dev/preview-expiry.d.ts.map +1 -1
  182. package/dist/dev/preview-expiry.js +7 -8
  183. package/dist/dev/preview-expiry.js.map +1 -1
  184. package/dist/dev/providers.d.ts +2 -1
  185. package/dist/dev/providers.d.ts.map +1 -1
  186. package/dist/dev/providers.js +28 -12
  187. package/dist/dev/providers.js.map +1 -1
  188. package/dist/dev/runners.d.ts +19 -0
  189. package/dist/dev/runners.d.ts.map +1 -1
  190. package/dist/dev/runtime-container.d.ts.map +1 -1
  191. package/dist/dev/runtime-container.js +2 -2
  192. package/dist/dev/runtime-container.js.map +1 -1
  193. package/dist/dev/runtime-env.d.ts +2 -1
  194. package/dist/dev/runtime-env.d.ts.map +1 -1
  195. package/dist/dev/runtime-env.js +5 -5
  196. package/dist/dev/runtime-env.js.map +1 -1
  197. package/dist/dev/runtime-image.d.ts +2 -2
  198. package/dist/dev/runtime-image.d.ts.map +1 -1
  199. package/dist/dev/runtime-image.js +2 -2
  200. package/dist/dev/runtime-image.js.map +1 -1
  201. package/dist/dev/runtime-registry.d.ts +8 -10
  202. package/dist/dev/runtime-registry.d.ts.map +1 -1
  203. package/dist/dev/runtime-registry.js +27 -27
  204. package/dist/dev/runtime-registry.js.map +1 -1
  205. package/dist/dev/sandbox/index.js +1 -1
  206. package/dist/dev/sandbox/notices.d.ts +2 -0
  207. package/dist/dev/sandbox/notices.d.ts.map +1 -1
  208. package/dist/dev/sandbox/notices.js +5 -2
  209. package/dist/dev/sandbox/notices.js.map +1 -1
  210. package/dist/env/defaults.d.ts.map +1 -1
  211. package/dist/env/defaults.js +3 -1
  212. package/dist/env/defaults.js.map +1 -1
  213. package/dist/env/pack-env-plan.d.ts +4 -0
  214. package/dist/env/pack-env-plan.d.ts.map +1 -1
  215. package/dist/env/pack-env-plan.js +8 -2
  216. package/dist/env/pack-env-plan.js.map +1 -1
  217. package/dist/exports/create.d.ts +2 -0
  218. package/dist/exports/create.d.ts.map +1 -1
  219. package/dist/exports/create.js +10 -2
  220. package/dist/exports/create.js.map +1 -1
  221. package/dist/exports/plan.d.ts.map +1 -1
  222. package/dist/exports/plan.js +20 -0
  223. package/dist/exports/plan.js.map +1 -1
  224. package/dist/feedback/store.d.ts.map +1 -1
  225. package/dist/feedback/store.js +8 -19
  226. package/dist/feedback/store.js.map +1 -1
  227. package/dist/help.d.ts +6 -0
  228. package/dist/help.d.ts.map +1 -1
  229. package/dist/help.js +35 -1
  230. package/dist/help.js.map +1 -1
  231. package/dist/init/agent-access.d.ts +3 -2
  232. package/dist/init/agent-access.d.ts.map +1 -1
  233. package/dist/init/agent-access.js +5 -1
  234. package/dist/init/agent-access.js.map +1 -1
  235. package/dist/init/augment-scaffolder.d.ts +7 -0
  236. package/dist/init/augment-scaffolder.d.ts.map +1 -1
  237. package/dist/init/augment-scaffolder.js +15 -14
  238. package/dist/init/augment-scaffolder.js.map +1 -1
  239. package/dist/init/dependency-specs.d.ts +1 -0
  240. package/dist/init/dependency-specs.d.ts.map +1 -1
  241. package/dist/init/dependency-specs.js +27 -7
  242. package/dist/init/dependency-specs.js.map +1 -1
  243. package/dist/init/java-augment.d.ts +3 -0
  244. package/dist/init/java-augment.d.ts.map +1 -1
  245. package/dist/init/java-augment.js +16 -15
  246. package/dist/init/java-augment.js.map +1 -1
  247. package/dist/init/python-augment.d.ts +3 -0
  248. package/dist/init/python-augment.d.ts.map +1 -1
  249. package/dist/init/python-augment.js +15 -14
  250. package/dist/init/python-augment.js.map +1 -1
  251. package/dist/init/scala-augment.d.ts +8 -1
  252. package/dist/init/scala-augment.d.ts.map +1 -1
  253. package/dist/init/scala-augment.js +32 -17
  254. package/dist/init/scala-augment.js.map +1 -1
  255. package/dist/key/defaults.d.ts.map +1 -1
  256. package/dist/key/defaults.js +6 -1
  257. package/dist/key/defaults.js.map +1 -1
  258. package/dist/key/runners.d.ts +4 -1
  259. package/dist/key/runners.d.ts.map +1 -1
  260. package/dist/license/renew.d.ts +6 -0
  261. package/dist/license/renew.d.ts.map +1 -1
  262. package/dist/license/renew.js +8 -5
  263. package/dist/license/renew.js.map +1 -1
  264. package/dist/main.d.ts +10 -0
  265. package/dist/main.d.ts.map +1 -1
  266. package/dist/main.js +19 -5
  267. package/dist/main.js.map +1 -1
  268. package/dist/output.d.ts +6 -0
  269. package/dist/output.d.ts.map +1 -1
  270. package/dist/output.js +8 -0
  271. package/dist/output.js.map +1 -1
  272. package/dist/parse.d.ts +1 -1
  273. package/dist/parse.d.ts.map +1 -1
  274. package/dist/parse.js +1 -1
  275. package/dist/parse.js.map +1 -1
  276. package/dist/private-file.d.ts +23 -0
  277. package/dist/private-file.d.ts.map +1 -0
  278. package/dist/private-file.js +65 -0
  279. package/dist/private-file.js.map +1 -0
  280. package/dist/progress-head.d.ts +13 -0
  281. package/dist/progress-head.d.ts.map +1 -0
  282. package/dist/progress-head.js +30 -0
  283. package/dist/progress-head.js.map +1 -0
  284. package/dist/progress-lines.d.ts +29 -0
  285. package/dist/progress-lines.d.ts.map +1 -0
  286. package/dist/progress-lines.js +35 -0
  287. package/dist/progress-lines.js.map +1 -0
  288. package/dist/sdk-skills/kindgi-authoring-agents/SKILL.md +6 -6
  289. package/dist/sdk-skills/kindgi-authoring-flows/SKILL.md +1 -1
  290. package/dist/sdk-skills/kindgi-authoring-guardrails/SKILL.md +2 -2
  291. package/dist/sdk-skills/kindgi-authoring-mcp-servers/SKILL.md +1 -1
  292. package/dist/sdk-skills/kindgi-authoring-providers/SKILL.md +3 -3
  293. package/dist/sdk-skills/kindgi-authoring-tools/SKILL.md +39 -6
  294. package/dist/sdk-skills/kindgi-fix-corrections/SKILL.md +262 -0
  295. package/dist/sdk-skills/kindgi-framework-feedback/SKILL.md +1 -1
  296. package/dist/sdk-skills/kindgi-getting-started/SKILL.md +43 -9
  297. package/dist/sdk-skills/kindgi-java-authoring-agents/SKILL.md +5 -5
  298. package/dist/sdk-skills/kindgi-java-authoring-flows/SKILL.md +1 -1
  299. package/dist/sdk-skills/kindgi-java-authoring-guardrails/SKILL.md +1 -1
  300. package/dist/sdk-skills/kindgi-java-authoring-tools/SKILL.md +91 -9
  301. package/dist/sdk-skills/kindgi-java-getting-started/SKILL.md +38 -9
  302. package/dist/sdk-skills/kindgi-python-authoring-agents/SKILL.md +4 -4
  303. package/dist/sdk-skills/kindgi-python-authoring-flows/SKILL.md +1 -1
  304. package/dist/sdk-skills/kindgi-python-authoring-guardrails/SKILL.md +1 -1
  305. package/dist/sdk-skills/kindgi-python-authoring-tools/SKILL.md +43 -8
  306. package/dist/sdk-skills/kindgi-python-getting-started/SKILL.md +39 -11
  307. package/dist/sdk-skills/kindgi-scala-authoring-agents/SKILL.md +5 -5
  308. package/dist/sdk-skills/kindgi-scala-authoring-flows/SKILL.md +1 -1
  309. package/dist/sdk-skills/kindgi-scala-authoring-guardrails/SKILL.md +1 -1
  310. package/dist/sdk-skills/kindgi-scala-authoring-tools/SKILL.md +82 -7
  311. package/dist/sdk-skills/kindgi-scala-getting-started/SKILL.md +38 -9
  312. package/dist/sdk-skills/kindgi-using/SKILL.md +50 -21
  313. package/dist/templates/drupal/AGENTS.md +2 -1
  314. package/dist/templates/follow-up/.nvmrc +1 -0
  315. package/dist/templates/follow-up/AGENTS.md +83 -0
  316. package/dist/templates/follow-up/README.md.tmpl +111 -0
  317. package/dist/templates/follow-up/agents/follow-up/index.test.ts.tmpl +26 -0
  318. package/dist/templates/follow-up/agents/follow-up/index.ts.tmpl +53 -0
  319. package/dist/templates/follow-up/gitignore +8 -0
  320. package/dist/templates/follow-up/kindgi.config.ts.tmpl +45 -0
  321. package/dist/templates/follow-up/package.json.tmpl +30 -0
  322. package/dist/templates/follow-up/pnpm-workspace.yaml +9 -0
  323. package/dist/templates/follow-up/tools/gmail-send/index.test.ts.tmpl +60 -0
  324. package/dist/templates/follow-up/tools/gmail-send/index.ts.tmpl +14 -0
  325. package/dist/templates/follow-up/tsconfig.json.tmpl +27 -0
  326. package/dist/templates/follow-up/vitest.config.ts.tmpl +14 -0
  327. package/dist/templates/java/AGENTS.md +2 -1
  328. package/dist/templates/minimal/AGENTS.md +2 -1
  329. package/dist/templates/python/AGENTS.md +2 -1
  330. package/dist/templates/sample/AGENTS.md +2 -1
  331. package/dist/templates/scala/AGENTS.md +2 -1
  332. package/dist/templates/woocommerce/AGENTS.md +12 -3
  333. package/dist/templates/woocommerce/README.md.tmpl +29 -5
  334. package/dist/templates/woocommerce/agents/store-agent/index.test.ts.tmpl +38 -7
  335. package/dist/templates/woocommerce/agents/store-agent/index.ts.tmpl +7 -12
  336. package/dist/templates/woocommerce/blocks/store-agent-prompt.json.tmpl +10 -0
  337. package/dist/templates/woocommerce/blocks/store-agent-prompt.liquid.tmpl +7 -0
  338. package/dist/templates/woocommerce/kindgi.config.ts.tmpl +1 -0
  339. package/dist/value-target.d.ts +4 -2
  340. package/dist/value-target.d.ts.map +1 -1
  341. package/dist/value-target.js +8 -5
  342. package/dist/value-target.js.map +1 -1
  343. package/package.json +13 -13
@@ -0,0 +1,65 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (C) 2026 Kindgi Inc.
3
+ /**
4
+ * A file that holds a key or token, such as `~/.kindgi/config.json`:
5
+ * owner-only from its first byte, whatever mode an older one had.
6
+ */
7
+ import { randomBytes } from 'node:crypto';
8
+ import { realpath, rename, stat, unlink, writeFile } from 'node:fs/promises';
9
+ const PRIVATE_FILE_MODE = 0o600;
10
+ /**
11
+ * Replace `path` with `text` in one step: a new `0600` file beside it, then
12
+ * a rename (`license/stores.ts`'s way). A reader that opened the old file
13
+ * keeps reading the old text, and a crash leaves the old file or the new
14
+ * one whole. A symlink at `path` stays: the file it points to is the one
15
+ * replaced, so the old text doesn't stay there at its old mode. A link
16
+ * that points nowhere becomes a file. Only a regular file is replaced: one
17
+ * that's a device, a pipe or a socket (a link to `/dev/null`) is refused,
18
+ * and left as it is.
19
+ *
20
+ * The umask can only take bits from `0600`, so the new file is never
21
+ * looser; a filesystem with no modes still gets the file. On Windows too,
22
+ * where the rename fails while another program has the file open, and the
23
+ * old file stays whole.
24
+ */
25
+ export async function replacePrivateFile(path, text) {
26
+ let target = path;
27
+ try {
28
+ target = await realpath(path);
29
+ }
30
+ catch (cause) {
31
+ if (cause.code !== 'ENOENT')
32
+ throw cause;
33
+ }
34
+ // The rename would put a file in place of whatever is there.
35
+ const found = await stat(target).catch((cause) => {
36
+ if (cause.code === 'ENOENT')
37
+ return undefined;
38
+ throw cause;
39
+ });
40
+ if (found !== undefined && !found.isFile()) {
41
+ throw new Error(`${target} isn't a regular file, so it was left as it is.`);
42
+ }
43
+ const temp = `${target}.${randomBytes(6).toString('hex')}.kindgi-tmp`;
44
+ try {
45
+ await writeFile(temp, text, { encoding: 'utf8', mode: PRIVATE_FILE_MODE, flag: 'wx' });
46
+ await rename(temp, target);
47
+ }
48
+ catch (cause) {
49
+ await unlink(temp).catch(() => undefined);
50
+ throw cause;
51
+ }
52
+ }
53
+ /**
54
+ * `replacePrivateFile`, except on Windows: it has no such modes, and a
55
+ * rename there can fail while another program has the file open, so the
56
+ * write there is in place.
57
+ */
58
+ export async function writePrivateFile(path, text) {
59
+ if (process.platform === 'win32') {
60
+ await writeFile(path, text, 'utf8');
61
+ return;
62
+ }
63
+ await replacePrivateFile(path, text);
64
+ }
65
+ //# sourceMappingURL=private-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-file.js","sourceRoot":"","sources":["../src/private-file.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAEjC;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7E,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEhC;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAAY,EAAE,IAAY;IACjE,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,CAAC;QACH,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YAAE,MAAM,KAAK,CAAC;IACtE,CAAC;IACD,6DAA6D;IAC7D,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACxD,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAC;QACzE,MAAM,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;IACH,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,iDAAiD,CAAC,CAAC;IAC9E,CAAC;IACD,MAAM,IAAI,GAAG,GAAG,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC;IACtE,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACvF,MAAM,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC1C,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAY,EAAE,IAAY;IAC/D,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,MAAM,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACpC,OAAO;IACT,CAAC;IACD,MAAM,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * `ctx.progress` when the CLI streams it (`write`): the first line goes
3
+ * after what `runCli` says first, the dev runtime's line (`hint`, said once a
4
+ * command reads its key) and the pin's. `unsaid` is what's left of those
5
+ * for the outcome, before `later` (the pin's line, when the outcome says
6
+ * it): all of it when nothing was streamed, else the hint when it came
7
+ * after the first line.
8
+ */
9
+ export declare function progressAfterHead(write: ((text: string) => void) | undefined, hint: () => string, pin: () => string): {
10
+ readonly progress: ((text: string) => void) | undefined;
11
+ readonly unsaid: (later: string) => string;
12
+ };
13
+ //# sourceMappingURL=progress-head.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-head.d.ts","sourceRoot":"","sources":["../src/progress-head.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,EAC3C,IAAI,EAAE,MAAM,MAAM,EAClB,GAAG,EAAE,MAAM,MAAM,GAChB;IACD,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACxD,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5C,CAgBA"}
@@ -0,0 +1,30 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (C) 2026 Kindgi Inc.
3
+ /**
4
+ * `ctx.progress` when the CLI streams it (`write`): the first line goes
5
+ * after what `runCli` says first, the dev runtime's line (`hint`, said once a
6
+ * command reads its key) and the pin's. `unsaid` is what's left of those
7
+ * for the outcome, before `later` (the pin's line, when the outcome says
8
+ * it): all of it when nothing was streamed, else the hint when it came
9
+ * after the first line.
10
+ */
11
+ export function progressAfterHead(write, hint, pin) {
12
+ let opened;
13
+ const unsaid = (later) => {
14
+ if (opened === undefined)
15
+ return `${hint()}${later}`;
16
+ return opened.hint === '' ? hint() : '';
17
+ };
18
+ if (write === undefined)
19
+ return { progress: undefined, unsaid };
20
+ const progress = (text) => {
21
+ if (opened !== undefined) {
22
+ write(text);
23
+ return;
24
+ }
25
+ opened = { hint: hint() };
26
+ write(`${opened.hint}${pin()}${text}`);
27
+ };
28
+ return { progress, unsaid };
29
+ }
30
+ //# sourceMappingURL=progress-head.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-head.js","sourceRoot":"","sources":["../src/progress-head.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAEjC;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAA2C,EAC3C,IAAkB,EAClB,GAAiB;IAKjB,IAAI,MAA6C,CAAC;IAClD,MAAM,MAAM,GAAG,CAAC,KAAa,EAAU,EAAE;QACvC,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,GAAG,IAAI,EAAE,GAAG,KAAK,EAAE,CAAC;QACrD,OAAO,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1C,CAAC,CAAC;IACF,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IAChE,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAQ,EAAE;QACtC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,KAAK,CAAC,IAAI,CAAC,CAAC;YACZ,OAAO;QACT,CAAC;QACD,MAAM,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;QAC1B,KAAK,CAAC,GAAG,MAAM,CAAC,IAAI,GAAG,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IACzC,CAAC,CAAC;IACF,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Where a command's lines go (`kindgi build`'s, `kindgi deploy`'s): each to
3
+ * `progress` as it comes when the CLI streams them, else kept for the
4
+ * result's stderr (`kept`). `quiet` leaves out each `line`, never a
5
+ * `problem`: an error or a warning is said either way.
6
+ */
7
+ export interface ProgressLines {
8
+ readonly line: (s: string) => void;
9
+ /** A line that's an error or a warning: said under `quiet` too, as `kindgi dev` does. */
10
+ readonly problem: (s: string) => void;
11
+ readonly kept: () => string;
12
+ }
13
+ export declare function progressLines(progress: ((text: string) => void) | undefined, quiet: boolean): ProgressLines;
14
+ /** A line a command says, and whether it's an error or a warning: said under `--quiet` too. */
15
+ export interface SaidLine {
16
+ readonly text: string;
17
+ readonly problem: boolean;
18
+ }
19
+ /**
20
+ * `lines` as a result's stderr, each ending in a newline. Under `quiet`,
21
+ * only the errors and warnings, so a blank line that sets notes apart is
22
+ * a note too.
23
+ */
24
+ export declare function renderLines(lines: readonly SaidLine[], quiet: boolean): string;
25
+ /** A note: left out under `--quiet`. */
26
+ export declare const note: (text: string) => SaidLine;
27
+ /** An error or a warning: said under `--quiet` too. */
28
+ export declare const warning: (text: string) => SaidLine;
29
+ //# sourceMappingURL=progress-lines.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-lines.d.ts","sourceRoot":"","sources":["../src/progress-lines.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,yFAAyF;IACzF,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,MAAM,CAAC;CAC7B;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,EAC9C,KAAK,EAAE,OAAO,GACb,aAAa,CAaf;AAED,+FAA+F;AAC/F,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAK9E;AAED,wCAAwC;AACxC,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,KAAG,QAAsC,CAAC;AAE3E,uDAAuD;AACvD,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,KAAG,QAAqC,CAAC"}
@@ -0,0 +1,35 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (C) 2026 Kindgi Inc.
3
+ export function progressLines(progress, quiet) {
4
+ const kept = [];
5
+ const say = (s) => {
6
+ if (progress === undefined)
7
+ kept.push(s);
8
+ else
9
+ progress(`${s}\n`);
10
+ };
11
+ return {
12
+ line: (s) => {
13
+ if (!quiet)
14
+ say(s);
15
+ },
16
+ problem: say,
17
+ kept: () => (kept.length === 0 ? '' : `${kept.join('\n')}\n`),
18
+ };
19
+ }
20
+ /**
21
+ * `lines` as a result's stderr, each ending in a newline. Under `quiet`,
22
+ * only the errors and warnings, so a blank line that sets notes apart is
23
+ * a note too.
24
+ */
25
+ export function renderLines(lines, quiet) {
26
+ return lines
27
+ .filter((l) => !quiet || l.problem)
28
+ .map((l) => `${l.text}\n`)
29
+ .join('');
30
+ }
31
+ /** A note: left out under `--quiet`. */
32
+ export const note = (text) => ({ text, problem: false });
33
+ /** An error or a warning: said under `--quiet` too. */
34
+ export const warning = (text) => ({ text, problem: true });
35
+ //# sourceMappingURL=progress-lines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress-lines.js","sourceRoot":"","sources":["../src/progress-lines.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAejC,MAAM,UAAU,aAAa,CAC3B,QAA8C,EAC9C,KAAc;IAEd,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,MAAM,GAAG,GAAG,CAAC,CAAS,EAAQ,EAAE;QAC9B,IAAI,QAAQ,KAAK,SAAS;YAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;YACpC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,CAAC;IACF,OAAO;QACL,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE;YACV,IAAI,CAAC,KAAK;gBAAE,GAAG,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC;QACD,OAAO,EAAE,GAAG;QACZ,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;KAC9D,CAAC;AACJ,CAAC;AAQD;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,KAA0B,EAAE,KAAc;IACpE,OAAO,KAAK;SACT,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO,CAAC;SAClC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC;SACzB,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED,wCAAwC;AACxC,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAY,EAAY,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;AAE3E,uDAAuD;AACvD,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAY,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC"}
@@ -13,7 +13,7 @@ description: >
13
13
  type: core
14
14
  library: "@kindgi/sdk"
15
15
  version: "0.4.8"
16
- sdk_version: "0.1.11-rc.0"
16
+ sdk_version: "0.2.0-rc.0"
17
17
  pack_languages: [node]
18
18
  sources:
19
19
  - packages/agents/src/types.ts
@@ -138,9 +138,9 @@ export default defined.value;
138
138
  `hitl.separateApprover` (`true`, or `{ overrides: { '<tool id>': true } }`)
139
139
  makes a tool's approval need someone other than whoever asked.
140
140
  - **`budget`** — per-turn ceiling. `maxSteps` caps model-call cycles
141
- (default 8); `maxCostUsd` caps model spend; `maxWallMs` caps wall
142
- time (default 120 000). Exceeding steps or cost fails the turn with
143
- `budget-exceeded`; running out of wall time aborts it
141
+ (default 8, at most 32); `maxCostUsd` caps model spend; `maxWallMs`
142
+ caps wall time (default 120 000). Exceeding steps or cost fails the
143
+ turn with `budget-exceeded`; running out of wall time aborts it
144
144
  (`agent-turn-aborted`, reason `timeout`).
145
145
 
146
146
  - **`output`** — optional typed result: `{ schema, name?, maxRepairs? }`
@@ -189,7 +189,7 @@ export default defined.value;
189
189
  reliable tool calling. `{ instructionTypes: ['acme.policy'] }` turns a
190
190
  retrieved, verified fact of those types into an instruction
191
191
  ("Policies (verified)"). See
192
- https://docs.kindgi.com/v0.1/guides/agents/give-an-agent-memory/.
192
+ https://docs.kindgi.com/v0.2/guides/agents/give-an-agent-memory/.
193
193
 
194
194
  ## What a turn receives
195
195
 
@@ -282,7 +282,7 @@ concerns, not author-time.
282
282
 
283
283
  - Type surface: `hover any @kindgi/sdk/define export` in your editor
284
284
  for full JSDoc.
285
- - API reference: https://docs.kindgi.com/v0.1/reference/typescript/sdk/kindgi/sdk/define/ (every `define*` spec, field by field).
285
+ - API reference: https://docs.kindgi.com/v0.2/reference/typescript/sdk/kindgi/sdk/define/ (every `define*` spec, field by field).
286
286
  - Common patterns: the `sample` template's `agents/echo-agent`
287
287
  demonstrates the smallest tool-calling shape.
288
288
 
@@ -14,7 +14,7 @@ description: >
14
14
  type: core
15
15
  library: "@kindgi/sdk"
16
16
  version: "0.1.3"
17
- sdk_version: "0.1.11-rc.0"
17
+ sdk_version: "0.2.0-rc.0"
18
18
  pack_languages: [node]
19
19
  sources:
20
20
  - packages/flow/src/types.ts
@@ -18,7 +18,7 @@ description: >
18
18
  type: core
19
19
  library: "@kindgi/sdk"
20
20
  version: "0.3.10"
21
- sdk_version: "0.1.11-rc.0"
21
+ sdk_version: "0.2.0-rc.0"
22
22
  pack_languages: [node]
23
23
  sources:
24
24
  - packages/guardrails/src/types.ts
@@ -371,7 +371,7 @@ ready for the stricter enforcement.
371
371
  - Type surface: hover any `@kindgi/sdk/define` export for full JSDoc;
372
372
  `Guardrail`, `defineGuardrail` and the built-in checks are in
373
373
  `@kindgi/guardrails`.
374
- - API reference: https://docs.kindgi.com/v0.1/reference/typescript/sdk/kindgi/sdk/define/
374
+ - API reference: https://docs.kindgi.com/v0.2/reference/typescript/sdk/kindgi/sdk/define/
375
375
  - Built-in check implementations: `packages/guardrails/src/checks.ts`.
376
376
 
377
377
  ## When the framework itself is the problem
@@ -18,7 +18,7 @@ description: >
18
18
  type: core
19
19
  library: "@kindgi/sdk"
20
20
  version: "0.3.4"
21
- sdk_version: "0.1.11-rc.0"
21
+ sdk_version: "0.2.0-rc.0"
22
22
  pack_languages: [node, python, java, scala]
23
23
  ---
24
24
 
@@ -27,7 +27,7 @@ description: >
27
27
  type: core
28
28
  library: "@kindgi/sdk"
29
29
  version: "0.9.17"
30
- sdk_version: "0.1.11-rc.0"
30
+ sdk_version: "0.2.0-rc.0"
31
31
  pack_languages: [node, python, java, scala]
32
32
  sources:
33
33
  - packages/adapters/model-anthropic/src/provider.ts
@@ -151,7 +151,7 @@ kindgi deploy --hosted --env=prod
151
151
  presets` for `azure-openai`'s settings.
152
152
 
153
153
  The whole flow, from signing the CLI in to going live:
154
- https://docs.kindgi.com/v0.1/hosted/deploy-your-agent/#your-model-key-and-its-provider
154
+ https://docs.kindgi.com/v0.2/hosted/deploy-your-agent/#your-model-key-and-its-provider
155
155
 
156
156
  ## Path A — Hosted, native Anthropic
157
157
 
@@ -705,7 +705,7 @@ moved to `isolated` that signs in as the runtime isn't used there: a turn
705
705
  that needs it fails with `422 capability-routing-failed`. Unregister it, and
706
706
  register it again with a key.
707
707
 
708
- Docs: https://docs.kindgi.com/v0.1/guides/models/#with-a-bedrock-api-key
708
+ Docs: https://docs.kindgi.com/v0.2/guides/models/#with-a-bedrock-api-key
709
709
 
710
710
  ## How the router picks between multiple providers + models
711
711
 
@@ -13,7 +13,7 @@ description: >
13
13
  type: core
14
14
  library: "@kindgi/sdk"
15
15
  version: "0.4.13"
16
- sdk_version: "0.1.11-rc.0"
16
+ sdk_version: "0.2.0-rc.0"
17
17
  pack_languages: [node]
18
18
  sources:
19
19
  - packages/tools/src/types.ts
@@ -124,7 +124,7 @@ The output side is the reverse: the advertised output schema requires every fiel
124
124
  ctx.log?.info('refund issued', { orderId, amountCents });
125
125
  ```
126
126
 
127
- Put values in `fields`, never in the message. Log ids, amounts and outcomes, never what a person typed (a refund's reason, a message, an address): the log is read by whoever operates the runtime, not only by the person the data is about. Docs: https://docs.kindgi.com/v0.1/guides/tools/write-a-tool/#log-from-a-tool
127
+ Put values in `fields`, never in the message. Log ids, amounts and outcomes, never what a person typed (a refund's reason, a message, an address): the log is read by whoever operates the runtime, not only by the person the data is about. Docs: https://docs.kindgi.com/v0.2/guides/tools/write-a-tool/#log-from-a-tool
128
128
 
129
129
  ### Configuration and secrets
130
130
 
@@ -172,6 +172,38 @@ const defined = defineTool({
172
172
 
173
173
  Everything else comes from the process environment: `process.env.CITATOR_URL`. The pack service runs with the pack's env files in `kindgi dev` (less any secret stored with `kindgi secrets set`, which a tool declares and reads from `ctx.secrets`, and any model provider's key, which no tool gets), and with the container's environment in an image. Declare the names your code reads in `kindgi.config.ts`, `env: { required: ['CITATOR_URL'], optional: [...] }`: a deployment injects exactly those, a pack service missing a required one isn't ready and says which, and `kindgi dev` warns about it. In an image the pack service also drops every variable the pack doesn't declare before your code loads (`kindgi dev` keeps them), so an undeclared name works locally and is unset once deployed: declare every name the code reads. Values per environment go in `environments.<name>.env`, secrets only as references.
174
174
 
175
+ ### Connections to other apps
176
+
177
+ A tool that acts in another app as a person or as the company (sending mail, opening an issue) declares a **connection**, never a secret holding someone's token, and reads the call's short-lived token from `ctx.connections` (runtime 0.2.0 or later):
178
+
179
+ ```ts
180
+ import { ConnectionRejectedError, defineTool } from '@kindgi/sdk/define';
181
+
182
+ const defined = defineTool({
183
+ // …id, description, version, input, output, effects…
184
+ needsSpec: {
185
+ connections: { mail: { app: 'google', permissions: ['gmail.send'], as: 'person' } },
186
+ },
187
+ handler: async (input, ctx) => {
188
+ const mail = ctx.connections?.mail;
189
+ const res = await fetch(url, { headers: { authorization: `Bearer ${mail?.accessToken}` } });
190
+ if (res.status === 401) throw new ConnectionRejectedError('mail');
191
+ // …
192
+ },
193
+ });
194
+ ```
195
+
196
+ - **Whose connection:** `as: 'person'` is the connection of the person the run acts as (whoever started it, or the owner of the schedule or webhook that did); `as: 'company'` is the company's. The runtime picks it from the run, never from the input or the model. A run that acts as nobody (a service account's, an event's) fails a `'person'` call with `connection-needs-a-person`.
197
+ - **The token:** `accessToken` is current for this call only. Never keep, print, log or return it; it never reaches the journal. `account.label` says whose account it is (`ana@acme.com`).
198
+ - **A 401 from the app:** throw `new ConnectionRejectedError('mail')`, with the connection's name (a second argument can say what the app answered, never the token), or your own error with it as its `cause`. The runtime renews the token once and runs the call again; refused again, the call fails with `connection-rejected`.
199
+ - **An HTTP tool** sends the token with no code: `authorization: { kind: 'connection', connection: 'mail' }`.
200
+ - **Ready-made tools:** for Gmail, Outlook, GitHub and LinkedIn, include one from `@kindgi/connections` instead of writing it. Each is a factory, and the pack names its id; there's no default, because a tool id is the tenant's, filed under the first project that publishes it. A tool folder's `index.ts` is one line, `export default gmailSend({ id: 'acme.gmail.send' })` (`@kindgi/connections/google/tools`); `githubIssuesList`, `githubLabelsList` and `githubIssuesAddLabels` come from `@kindgi/connections/github/tools`, `outlookSend`, `outlookMessagesList` and `outlookMessageGet` from `@kindgi/connections/microsoft/tools`, and `linkedinPost` from `@kindgi/connections/linkedin/tools`. Agents and approval settings use the pack's id.
201
+ - **Your own calls to an app's API:** `appFetch(ctx, { entry, connection, toolId, url, method, headers, body })` from `@kindgi/connections/app-fetch` sends the connection's token as the only `Authorization`, paces calls by the entry's `rateLimits` (`toolId` is what its `costs` charge; 1 when not listed), tries a busy answer again, and throws a 401 as `ConnectionRejectedError`.
202
+ - **Unattended runs:** in a run no person started, a tool that uses an `as: 'person'` connection waits for that person's yes, unless it's marked `mutating: false` (mark read-only tools so). The agent's `conversationPolicy.hitl` can't lift it; only a trigger's `toolsAllowedUnattended` can, which a project admin sets, as for `needsApprovalWhenUnattended` (below).
203
+ - **In a unit test:** `ctx.connections` is optional in the type; build a context with `toolContextForTest({ connections: { mail: { accessToken: 'test', account: { id: '1', label: 'ana@acme.com' }, … } } })` (`@kindgi/sdk/define`).
204
+
205
+ Docs: https://docs.kindgi.com/v0.2/guides/connections/use-a-connection/
206
+
175
207
  ## Declarative HTTP spec
176
208
 
177
209
  ```ts
@@ -231,6 +263,7 @@ The kinds are `reads`, `writes`, `deletes`, `network`, `spawns-run`, `emits-even
231
263
 
232
264
  - **An agent's call waits** for a person's yes, whatever the agent's `conversationPolicy.hitl.tools` says. The agent's rules can't lift it: agents are reused, and the tool's author knows what it does.
233
265
  - **A flow's tool step that calls it is refused.** Put the tool behind an agent step instead, whose call waits.
266
+ - **A trigger can lift both, for its own runs only.** A project admin names the tool in a webhook trigger's or a schedule's `toolsAllowedUnattended` (`--allow-unattended=<tool-id>` on `kindgi webhooks` and `kindgi schedules`). In that trigger's runs, the tool is then as in a run a person started. The tenant's approval rules still apply.
234
267
 
235
268
  In a run a person started (signed in, or with their own API key), the agent's rules decide, as for any tool. Absent means `false`. Declare it on a tool that moves money or changes something people rely on:
236
269
 
@@ -240,9 +273,9 @@ In a run a person started (signed in, or with their own API key), the agent's ru
240
273
  needsApprovalWhenUnattended: true,
241
274
  ```
242
275
 
243
- Docs: https://docs.kindgi.com/v0.1/guides/approvals/ask-before-a-tool-runs/#when-no-person-started-the-run
276
+ Docs: https://docs.kindgi.com/v0.2/guides/approvals/ask-before-a-tool-runs/#when-no-person-started-the-run
244
277
 
245
- A step can run more than once (resumed after an approval, retried after a failure, run again after a crash), so a tool that writes uses `ctx.idempotencyKey`: the same every time this call runs, different for every other call. Pass it to the system you write to (an `Idempotency-Key` header, a client reference, a unique column) or look for it there first, and a refund never goes out twice. Not `ctx.requestId`: a model's call id is only unique within one of its answers. The key is absent outside a run and from a runtime before 0.1.6. Docs: https://docs.kindgi.com/v0.1/guides/tools/write-a-tool/#make-a-side-effect-happen-once
278
+ A step can run more than once (resumed after an approval, retried after a failure, run again after a crash), so a tool that writes uses `ctx.idempotencyKey`: the same every time this call runs, different for every other call. Pass it to the system you write to (an `Idempotency-Key` header, a client reference, a unique column) or look for it there first, and a refund never goes out twice. Not `ctx.requestId`: a model's call id is only unique within one of its answers. The key is absent outside a run and from a runtime before 0.1.6. Docs: https://docs.kindgi.com/v0.2/guides/tools/write-a-tool/#make-a-side-effect-happen-once
246
279
 
247
280
  ## Tool id convention
248
281
 
@@ -381,7 +414,7 @@ run start via `semver.maxSatisfying`. No implicit `:latest`.
381
414
  folder, `~/.aws`) or any `.env*` file, and gets `EPERM` there. A tool that
382
415
  needs a path names it in `kindgi.config.ts`: `dev: { sandbox: { allowRead: ['~/.aws'] } }`.
383
416
  Never set `KINDGI_DEV_SANDBOX=off` or `dev.sandbox: false` to get past it
384
- (https://docs.kindgi.com/v0.1/guides/secrets/dev-sandbox/).
417
+ (https://docs.kindgi.com/v0.2/guides/secrets/dev-sandbox/).
385
418
 
386
419
  12. **Importing a Next.js module that has `import 'server-only'`.** Outside
387
420
  Next.js that line stops the module from loading, so the tool fails
@@ -436,7 +469,7 @@ run start via `semver.maxSatisfying`. No implicit `:latest`.
436
469
  - Type surface: `hover any @kindgi/sdk/define export` in your editor
437
470
  for full JSDoc — every field on `DefineToolSpec` / `ToolManifest`
438
471
  documents purpose, when to set it, and gotchas.
439
- - API reference: https://docs.kindgi.com/v0.1/reference/typescript/sdk/kindgi/sdk/define/ (every `define*` spec, field by field).
472
+ - API reference: https://docs.kindgi.com/v0.2/reference/typescript/sdk/kindgi/sdk/define/ (every `define*` spec, field by field).
440
473
  - Common patterns: check the `sample` template (`kindgi init
441
474
  --template=sample`) for working examples of both authoring modes.
442
475