@kindgi/cli 0.1.8 → 0.1.9-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 (267) hide show
  1. package/README.md +59 -2
  2. package/dist/api-address.d.ts +104 -12
  3. package/dist/api-address.d.ts.map +1 -1
  4. package/dist/api-address.js +169 -30
  5. package/dist/api-address.js.map +1 -1
  6. package/dist/cli.js +12 -2
  7. package/dist/cli.js.map +1 -1
  8. package/dist/commands/approvals.d.ts.map +1 -1
  9. package/dist/commands/approvals.js +15 -3
  10. package/dist/commands/approvals.js.map +1 -1
  11. package/dist/commands/auth.d.ts.map +1 -1
  12. package/dist/commands/auth.js +27 -0
  13. package/dist/commands/auth.js.map +1 -1
  14. package/dist/commands/build.d.ts +18 -0
  15. package/dist/commands/build.d.ts.map +1 -1
  16. package/dist/commands/build.js +118 -13
  17. package/dist/commands/build.js.map +1 -1
  18. package/dist/commands/conversations.d.ts.map +1 -1
  19. package/dist/commands/conversations.js +13 -3
  20. package/dist/commands/conversations.js.map +1 -1
  21. package/dist/commands/deploy.d.ts.map +1 -1
  22. package/dist/commands/deploy.js +235 -53
  23. package/dist/commands/deploy.js.map +1 -1
  24. package/dist/commands/deployments.d.ts +3 -0
  25. package/dist/commands/deployments.d.ts.map +1 -0
  26. package/dist/commands/deployments.js +196 -0
  27. package/dist/commands/deployments.js.map +1 -0
  28. package/dist/commands/doctor.d.ts +1 -5
  29. package/dist/commands/doctor.d.ts.map +1 -1
  30. package/dist/commands/doctor.js +42 -22
  31. package/dist/commands/doctor.js.map +1 -1
  32. package/dist/commands/egress.d.ts +9 -0
  33. package/dist/commands/egress.d.ts.map +1 -0
  34. package/dist/commands/egress.js +40 -0
  35. package/dist/commands/egress.js.map +1 -0
  36. package/dist/commands/env-scoped.d.ts +5 -0
  37. package/dist/commands/env-scoped.d.ts.map +1 -1
  38. package/dist/commands/env-scoped.js +64 -19
  39. package/dist/commands/env-scoped.js.map +1 -1
  40. package/dist/commands/env.d.ts.map +1 -1
  41. package/dist/commands/env.js +91 -30
  42. package/dist/commands/env.js.map +1 -1
  43. package/dist/commands/environments.d.ts +6 -0
  44. package/dist/commands/environments.d.ts.map +1 -0
  45. package/dist/commands/environments.js +166 -0
  46. package/dist/commands/environments.js.map +1 -0
  47. package/dist/commands/exports.d.ts.map +1 -1
  48. package/dist/commands/exports.js +118 -3
  49. package/dist/commands/exports.js.map +1 -1
  50. package/dist/commands/feedback.d.ts +1 -2
  51. package/dist/commands/feedback.d.ts.map +1 -1
  52. package/dist/commands/feedback.js +55 -24
  53. package/dist/commands/feedback.js.map +1 -1
  54. package/dist/commands/helpers.d.ts +6 -0
  55. package/dist/commands/helpers.d.ts.map +1 -1
  56. package/dist/commands/helpers.js +8 -0
  57. package/dist/commands/helpers.js.map +1 -1
  58. package/dist/commands/index.d.ts.map +1 -1
  59. package/dist/commands/index.js +12 -0
  60. package/dist/commands/index.js.map +1 -1
  61. package/dist/commands/license.d.ts +3 -0
  62. package/dist/commands/license.d.ts.map +1 -1
  63. package/dist/commands/license.js +1 -1
  64. package/dist/commands/license.js.map +1 -1
  65. package/dist/commands/people.d.ts.map +1 -1
  66. package/dist/commands/people.js +105 -10
  67. package/dist/commands/people.js.map +1 -1
  68. package/dist/commands/projects.d.ts.map +1 -1
  69. package/dist/commands/projects.js +133 -11
  70. package/dist/commands/projects.js.map +1 -1
  71. package/dist/commands/promote.d.ts +38 -0
  72. package/dist/commands/promote.d.ts.map +1 -0
  73. package/dist/commands/promote.js +371 -0
  74. package/dist/commands/promote.js.map +1 -0
  75. package/dist/commands/proposals.d.ts.map +1 -1
  76. package/dist/commands/proposals.js +2 -1
  77. package/dist/commands/proposals.js.map +1 -1
  78. package/dist/commands/providers.d.ts.map +1 -1
  79. package/dist/commands/providers.js +29 -5
  80. package/dist/commands/providers.js.map +1 -1
  81. package/dist/commands/schedules.d.ts.map +1 -1
  82. package/dist/commands/schedules.js +30 -2
  83. package/dist/commands/schedules.js.map +1 -1
  84. package/dist/commands/secrets.d.ts.map +1 -1
  85. package/dist/commands/secrets.js +65 -40
  86. package/dist/commands/secrets.js.map +1 -1
  87. package/dist/commands/sign-in.d.ts +3 -0
  88. package/dist/commands/sign-in.d.ts.map +1 -0
  89. package/dist/commands/sign-in.js +61 -0
  90. package/dist/commands/sign-in.js.map +1 -0
  91. package/dist/commands/sites.d.ts +3 -0
  92. package/dist/commands/sites.d.ts.map +1 -0
  93. package/dist/commands/sites.js +244 -0
  94. package/dist/commands/sites.js.map +1 -0
  95. package/dist/commands/tools.d.ts.map +1 -1
  96. package/dist/commands/tools.js +2 -2
  97. package/dist/commands/tools.js.map +1 -1
  98. package/dist/commands/types.d.ts +11 -0
  99. package/dist/commands/types.d.ts.map +1 -1
  100. package/dist/commands/webhooks.d.ts.map +1 -1
  101. package/dist/commands/webhooks.js +38 -2
  102. package/dist/commands/webhooks.js.map +1 -1
  103. package/dist/config.d.ts +13 -0
  104. package/dist/config.d.ts.map +1 -1
  105. package/dist/config.js +20 -7
  106. package/dist/config.js.map +1 -1
  107. package/dist/context.d.ts +38 -2
  108. package/dist/context.d.ts.map +1 -1
  109. package/dist/context.js +12 -1
  110. package/dist/context.js.map +1 -1
  111. package/dist/deploy/defaults.d.ts.map +1 -1
  112. package/dist/deploy/defaults.js +7 -1
  113. package/dist/deploy/defaults.js.map +1 -1
  114. package/dist/deploy/pack-service-text.d.ts +29 -0
  115. package/dist/deploy/pack-service-text.d.ts.map +1 -0
  116. package/dist/deploy/pack-service-text.js +72 -0
  117. package/dist/deploy/pack-service-text.js.map +1 -0
  118. package/dist/deploy/post.d.ts +17 -4
  119. package/dist/deploy/post.d.ts.map +1 -1
  120. package/dist/deploy/post.js +177 -60
  121. package/dist/deploy/post.js.map +1 -1
  122. package/dist/deploy/promotion-path.d.ts +44 -0
  123. package/dist/deploy/promotion-path.d.ts.map +1 -0
  124. package/dist/deploy/promotion-path.js +86 -0
  125. package/dist/deploy/promotion-path.js.map +1 -0
  126. package/dist/deploy/response.d.ts +3 -0
  127. package/dist/deploy/response.d.ts.map +1 -1
  128. package/dist/deploy/response.js +66 -12
  129. package/dist/deploy/response.js.map +1 -1
  130. package/dist/deploy/runners.d.ts +99 -5
  131. package/dist/deploy/runners.d.ts.map +1 -1
  132. package/dist/dev/java-builder.d.ts.map +1 -1
  133. package/dist/dev/java-builder.js +19 -3
  134. package/dist/dev/java-builder.js.map +1 -1
  135. package/dist/dev/python-builder.d.ts.map +1 -1
  136. package/dist/dev/python-builder.js +18 -3
  137. package/dist/dev/python-builder.js.map +1 -1
  138. package/dist/dev/runtime-container.d.ts +28 -3
  139. package/dist/dev/runtime-container.d.ts.map +1 -1
  140. package/dist/dev/runtime-container.js +103 -36
  141. package/dist/dev/runtime-container.js.map +1 -1
  142. package/dist/dev/runtime-image.d.ts +1 -1
  143. package/dist/dev/runtime-image.d.ts.map +1 -1
  144. package/dist/dev/runtime-image.js +1 -1
  145. package/dist/dev/runtime-image.js.map +1 -1
  146. package/dist/dev/scala-builder.d.ts.map +1 -1
  147. package/dist/dev/scala-builder.js +55 -21
  148. package/dist/dev/scala-builder.js.map +1 -1
  149. package/dist/dev/shared-watch.d.ts +30 -0
  150. package/dist/dev/shared-watch.d.ts.map +1 -1
  151. package/dist/dev/shared-watch.js +46 -1
  152. package/dist/dev/shared-watch.js.map +1 -1
  153. package/dist/env/pack-env-hint.d.ts +52 -0
  154. package/dist/env/pack-env-hint.d.ts.map +1 -0
  155. package/dist/env/pack-env-hint.js +57 -0
  156. package/dist/env/pack-env-hint.js.map +1 -0
  157. package/dist/env/pack-env-plan.d.ts +2 -0
  158. package/dist/env/pack-env-plan.d.ts.map +1 -1
  159. package/dist/env/pack-env-plan.js +2 -1
  160. package/dist/env/pack-env-plan.js.map +1 -1
  161. package/dist/env-projects.d.ts +23 -0
  162. package/dist/env-projects.d.ts.map +1 -0
  163. package/dist/env-projects.js +28 -0
  164. package/dist/env-projects.js.map +1 -0
  165. package/dist/exports/create.d.ts +71 -0
  166. package/dist/exports/create.d.ts.map +1 -0
  167. package/dist/exports/create.js +576 -0
  168. package/dist/exports/create.js.map +1 -0
  169. package/dist/exports/plan.d.ts +69 -0
  170. package/dist/exports/plan.d.ts.map +1 -0
  171. package/dist/exports/plan.js +496 -0
  172. package/dist/exports/plan.js.map +1 -0
  173. package/dist/exports/reader.d.ts +48 -0
  174. package/dist/exports/reader.d.ts.map +1 -0
  175. package/dist/exports/reader.js +181 -0
  176. package/dist/exports/reader.js.map +1 -0
  177. package/dist/feedback/entries.d.ts +53 -0
  178. package/dist/feedback/entries.d.ts.map +1 -0
  179. package/dist/feedback/entries.js +173 -0
  180. package/dist/feedback/entries.js.map +1 -0
  181. package/dist/feedback/intake.d.ts +37 -0
  182. package/dist/feedback/intake.d.ts.map +1 -0
  183. package/dist/feedback/intake.js +101 -0
  184. package/dist/feedback/intake.js.map +1 -0
  185. package/dist/feedback/protocol.d.ts +111 -0
  186. package/dist/feedback/protocol.d.ts.map +1 -0
  187. package/dist/feedback/protocol.js +143 -0
  188. package/dist/feedback/protocol.js.map +1 -0
  189. package/dist/feedback/redact.d.ts +34 -0
  190. package/dist/feedback/redact.d.ts.map +1 -0
  191. package/dist/feedback/redact.js +258 -0
  192. package/dist/feedback/redact.js.map +1 -0
  193. package/dist/feedback/report.d.ts +51 -0
  194. package/dist/feedback/report.d.ts.map +1 -0
  195. package/dist/feedback/report.js +122 -0
  196. package/dist/feedback/report.js.map +1 -0
  197. package/dist/feedback/run.d.ts +21 -0
  198. package/dist/feedback/run.d.ts.map +1 -0
  199. package/dist/feedback/run.js +578 -0
  200. package/dist/feedback/run.js.map +1 -0
  201. package/dist/feedback/store.d.ts +24 -0
  202. package/dist/feedback/store.d.ts.map +1 -0
  203. package/dist/feedback/store.js +117 -0
  204. package/dist/feedback/store.js.map +1 -0
  205. package/dist/main.d.ts +6 -0
  206. package/dist/main.d.ts.map +1 -1
  207. package/dist/main.js +86 -5
  208. package/dist/main.js.map +1 -1
  209. package/dist/node-version.d.ts +13 -0
  210. package/dist/node-version.d.ts.map +1 -0
  211. package/dist/node-version.js +37 -0
  212. package/dist/node-version.js.map +1 -0
  213. package/dist/parse.d.ts +8 -2
  214. package/dist/parse.d.ts.map +1 -1
  215. package/dist/parse.js +7 -2
  216. package/dist/parse.js.map +1 -1
  217. package/dist/project-ref.d.ts +44 -0
  218. package/dist/project-ref.d.ts.map +1 -0
  219. package/dist/project-ref.js +69 -0
  220. package/dist/project-ref.js.map +1 -0
  221. package/dist/sdk-skills/kindgi-authoring-agents/SKILL.md +15 -2
  222. package/dist/sdk-skills/kindgi-authoring-flows/SKILL.md +1 -1
  223. package/dist/sdk-skills/kindgi-authoring-guardrails/SKILL.md +44 -7
  224. package/dist/sdk-skills/kindgi-authoring-mcp-servers/SKILL.md +11 -2
  225. package/dist/sdk-skills/kindgi-authoring-providers/SKILL.md +60 -13
  226. package/dist/sdk-skills/kindgi-authoring-tools/SKILL.md +19 -2
  227. package/dist/sdk-skills/kindgi-framework-feedback/SKILL.md +82 -3
  228. package/dist/sdk-skills/kindgi-getting-started/SKILL.md +1 -1
  229. package/dist/sdk-skills/kindgi-java-authoring-agents/SKILL.md +17 -3
  230. package/dist/sdk-skills/kindgi-java-authoring-flows/SKILL.md +1 -1
  231. package/dist/sdk-skills/kindgi-java-authoring-guardrails/SKILL.md +43 -6
  232. package/dist/sdk-skills/kindgi-java-authoring-tools/SKILL.md +19 -2
  233. package/dist/sdk-skills/kindgi-java-getting-started/SKILL.md +1 -1
  234. package/dist/sdk-skills/kindgi-python-authoring-agents/SKILL.md +17 -3
  235. package/dist/sdk-skills/kindgi-python-authoring-flows/SKILL.md +1 -1
  236. package/dist/sdk-skills/kindgi-python-authoring-guardrails/SKILL.md +49 -13
  237. package/dist/sdk-skills/kindgi-python-authoring-tools/SKILL.md +27 -3
  238. package/dist/sdk-skills/kindgi-python-getting-started/SKILL.md +1 -1
  239. package/dist/sdk-skills/kindgi-scala-authoring-agents/SKILL.md +17 -3
  240. package/dist/sdk-skills/kindgi-scala-authoring-flows/SKILL.md +1 -1
  241. package/dist/sdk-skills/kindgi-scala-authoring-guardrails/SKILL.md +43 -6
  242. package/dist/sdk-skills/kindgi-scala-authoring-tools/SKILL.md +19 -2
  243. package/dist/sdk-skills/kindgi-scala-getting-started/SKILL.md +1 -1
  244. package/dist/sdk-skills/kindgi-using/SKILL.md +1 -1
  245. package/dist/slug.d.ts +18 -0
  246. package/dist/slug.d.ts.map +1 -0
  247. package/dist/slug.js +29 -0
  248. package/dist/slug.js.map +1 -0
  249. package/dist/templates/drupal/AGENTS.md +2 -0
  250. package/dist/templates/java/AGENTS.md +2 -0
  251. package/dist/templates/minimal/AGENTS.md +2 -0
  252. package/dist/templates/python/AGENTS.md +2 -0
  253. package/dist/templates/sample/AGENTS.md +2 -0
  254. package/dist/templates/scala/AGENTS.md +2 -0
  255. package/dist/templates/woocommerce/AGENTS.md +11 -4
  256. package/dist/templates/woocommerce/README.md.tmpl +47 -4
  257. package/dist/templates/woocommerce/agents/store-agent/index.test.ts.tmpl +13 -0
  258. package/dist/templates/woocommerce/agents/store-agent/index.ts.tmpl +11 -1
  259. package/dist/templates/woocommerce/tools/publish-product/index.ts.tmpl +7 -1
  260. package/dist/templates/woocommerce/tools/refund/index.ts.tmpl +7 -2
  261. package/dist/templates/woocommerce/tools/refund-large/index.ts.tmpl +8 -2
  262. package/dist/templates/woocommerce/tools/set-price/index.ts.tmpl +6 -0
  263. package/dist/value-target.d.ts +139 -0
  264. package/dist/value-target.d.ts.map +1 -0
  265. package/dist/value-target.js +231 -0
  266. package/dist/value-target.js.map +1 -0
  267. package/package.json +13 -13
@@ -39,6 +39,19 @@ describe('{{PACK_ID}}.store-agent', () => {
39
39
  expect(line).toMatch(/look it up again before you say what it has been refunded/);
40
40
  });
41
41
 
42
+ test('each tool that waits for a person needs a reviewer other than the person who asked', () => {
43
+ const tools = storeAgent.conversationPolicy?.hitl?.tools;
44
+ const free = new Set(
45
+ Object.entries(tools?.overrides ?? {})
46
+ .filter(([, mode]) => mode === 'never_ask')
47
+ .map(([id]) => id),
48
+ );
49
+ const waiting = storeAgent.tools.map((t) => t.id).filter((id) => !free.has(id));
50
+ const fourEyes = storeAgent.conversationPolicy?.hitl?.separateApprover;
51
+ if (typeof fourEyes !== 'object') throw new Error('separateApprover is set per tool');
52
+ for (const id of waiting) expect(fourEyes.overrides?.[id], id).toBe(true);
53
+ });
54
+
42
55
  test("its instructions don't tell it to say a call waits: it never answers while one does", () => {
43
56
  const { instructions } = storeAgent;
44
57
  if (typeof instructions !== 'string') throw new Error('The instructions are a prompt reference now: check the prompt.');
@@ -11,7 +11,10 @@
11
11
  // - a larger refund, a price change and publishing a product each wait
12
12
  // for a reviewer, who approves or rejects it in the console's approvals
13
13
  // inbox (or by email). The tool runs only after an approval; a
14
- // rejection is recorded in the audit, and the agent says so.
14
+ // rejection is recorded in the audit, and the agent says so;
15
+ // - those three need a reviewer other than the person who asked
16
+ // (`separateApprover`): whoever's turn asked for a large refund can't
17
+ // approve it themselves.
15
18
  import { defineAgent } from '@kindgi/sdk/define';
16
19
  import type { AgentId, GuardrailId, Semver } from '@kindgi/sdk/types';
17
20
 
@@ -54,6 +57,13 @@ const defined = defineAgent({
54
57
  },
55
58
  },
56
59
  defaultReviewerRole: 'standard',
60
+ separateApprover: {
61
+ overrides: {
62
+ '{{PACK_ID}}.woo.refund-large': true,
63
+ '{{PACK_ID}}.woo.set-price': true,
64
+ '{{PACK_ID}}.woo.publish-product': true,
65
+ },
66
+ },
57
67
  },
58
68
  },
59
69
  // A refused call goes back to the model instead of failing the turn: when
@@ -1,6 +1,8 @@
1
1
  // {{PACK_ID}}.woo.publish-product — publish a draft product, so shoppers can
2
2
  // see it. A store change, so the agent's approval policy has a person
3
- // approve every call.
3
+ // approve every call. The tool also declares it waits in a run no person
4
+ // started, so even an agent whose policy says `never_ask` can't run it
5
+ // there unasked.
4
6
  import { defineTool } from '@kindgi/sdk/define';
5
7
  import type { ToolId } from '@kindgi/sdk/types';
6
8
  import { z } from 'zod';
@@ -15,6 +17,10 @@ const defined = defineTool({
15
17
  output: z.object({ productId: z.number().int(), name: z.string(), status: z.string() }),
16
18
  effects: [{ kind: 'writes', resource: 'external:woocommerce' }],
17
19
  mutating: true,
20
+ // In a run no person started (a webhook, a schedule or a service account's
21
+ // key started it), every call waits for a person's yes, whatever the
22
+ // agent's approval policy says.
23
+ needsApprovalWhenUnattended: true,
18
24
  needsSpec: WOO_NEEDS,
19
25
  handler: async ({ productId }, ctx) => {
20
26
  const product = await woo<{ readonly id: number; readonly name: string; readonly status: string }>(
@@ -1,5 +1,6 @@
1
1
  // {{PACK_ID}}.woo.refund — a refund of up to 100 (in the order's currency) on
2
- // an order, with no one to approve it.
2
+ // an order, with no one to approve it when a person asks for it. In a run a
3
+ // webhook or a schedule started, it waits for a person's yes.
3
4
  //
4
5
  // Kindgi's approval rules key on the tool, not on its arguments, so "refunds
5
6
  // over 100 need a person" is two tools: this one, which the agent's policy
@@ -39,7 +40,7 @@ export const RefundOutput = z.object({
39
40
 
40
41
  const defined = defineTool({
41
42
  id: '{{PACK_ID}}.woo.refund' as ToolId,
42
- description: `Refund up to ${REFUND_LIMIT} on an order, counting what it has been refunded already. Runs without approval. For more, use {{PACK_ID}}.woo.refund-large, which waits for a person.`,
43
+ description: `Refund up to ${REFUND_LIMIT} on an order, counting what it has been refunded already. Runs without approval when a person starts the turn; in a run a webhook or schedule started, it waits for a person. For more, use {{PACK_ID}}.woo.refund-large, which waits for a person.`,
43
44
  version: '{{PACK_VERSION}}',
44
45
  input: RefundInput,
45
46
  output: RefundOutput,
@@ -48,6 +49,10 @@ const defined = defineTool({
48
49
  { kind: 'external-side-effect', notes: 'Refunds money to the customer.' },
49
50
  ],
50
51
  mutating: true,
52
+ // In a run no person started (a webhook, a schedule or a service account's
53
+ // key started it), every call waits for a person's yes, whatever the
54
+ // agent's approval policy says.
55
+ needsApprovalWhenUnattended: true,
51
56
  needsSpec: REFUND_NEEDS,
52
57
  // The limit is checked after `createRefund` has looked for this call's own
53
58
  // refund: a call run again after its refund went out returns that refund,
@@ -2,8 +2,10 @@
2
2
  // agent's approval policy marks it `always_ask`: every call waits for a
3
3
  // person to approve it, and the refund happens only after they do, once:
4
4
  // the step resumed after the approval, or run again after a crash, finds the
5
- // refund it made (`createRefund` in `lib/woo.ts`). See
6
- // `{{PACK_ID}}.woo.refund` for why the store has two refund tools.
5
+ // refund it made (`createRefund` in `lib/woo.ts`). The tool also declares
6
+ // it waits in a run no person started, so even an agent whose policy says
7
+ // `never_ask` can't run it there unasked. See `{{PACK_ID}}.woo.refund` for
8
+ // why the store has two refund tools.
7
9
  import { defineTool } from '@kindgi/sdk/define';
8
10
  import type { ToolId } from '@kindgi/sdk/types';
9
11
  import { z } from 'zod';
@@ -33,6 +35,10 @@ const defined = defineTool({
33
35
  { kind: 'external-side-effect', notes: 'Refunds money to the customer.' },
34
36
  ],
35
37
  mutating: true,
38
+ // In a run no person started (a webhook, a schedule or a service account's
39
+ // key started it), every call waits for a person's yes, whatever the
40
+ // agent's approval policy says.
41
+ needsApprovalWhenUnattended: true,
36
42
  needsSpec: REFUND_NEEDS,
37
43
  handler: async (input, ctx) => createRefund(ctx, input),
38
44
  });
@@ -1,5 +1,7 @@
1
1
  // {{PACK_ID}}.woo.set-price — change a product's regular price. A store
2
2
  // change, so the agent's approval policy has a person approve every call.
3
+ // The tool also declares it waits in a run no person started, so even an
4
+ // agent whose policy says `never_ask` can't run it there unasked.
3
5
  import { defineTool } from '@kindgi/sdk/define';
4
6
  import type { ToolId } from '@kindgi/sdk/types';
5
7
  import { z } from 'zod';
@@ -17,6 +19,10 @@ const defined = defineTool({
17
19
  output: z.object({ productId: z.number().int(), name: z.string(), regularPrice: z.string() }),
18
20
  effects: [{ kind: 'writes', resource: 'external:woocommerce' }],
19
21
  mutating: true,
22
+ // In a run no person started (a webhook, a schedule or a service account's
23
+ // key started it), every call waits for a person's yes, whatever the
24
+ // agent's approval policy says.
25
+ needsApprovalWhenUnattended: true,
20
26
  needsSpec: WOO_NEEDS,
21
27
  handler: async ({ productId, regularPrice }, ctx) => {
22
28
  const product = await woo<{ readonly id: number; readonly name: string; readonly regular_price: string }>(
@@ -0,0 +1,139 @@
1
+ import type { KindgiClient } from '@kindgi/client';
2
+ import type { CommandResult } from './commands/types.js';
3
+ import type { CommandContext } from './context.js';
4
+ /**
5
+ * What a runtime says it serves (whoami's `servedEnv`): the env its tools'
6
+ * values are read under, and whether it refuses values under any other.
7
+ */
8
+ export interface ServedEnv {
9
+ readonly envName: string;
10
+ readonly refusesOtherEnvs: boolean;
11
+ }
12
+ /**
13
+ * The runtime's `servedEnv`, or `undefined` when it doesn't say (a runtime
14
+ * that serves no env, or an older one) or can't be asked. Then every default
15
+ * stays as it was, and a runtime that refuses other envs still refuses the
16
+ * write itself (`409 env-not-served`).
17
+ */
18
+ export declare function servedEnvOf(client: () => KindgiClient): Promise<ServedEnv | undefined>;
19
+ /**
20
+ * A pack's environments: each name in its config's `environments`, with
21
+ * the project (id or slug) its `project` names, if it names one.
22
+ */
23
+ export type PackEnvironments = Readonly<Record<string, string | undefined>>;
24
+ /** A pack environment `--env` named, and the project its config names for it. */
25
+ export interface MappedEnvironment {
26
+ readonly name: string;
27
+ /** As the config names it: an id or a slug. */
28
+ readonly projectRef: string;
29
+ }
30
+ /** The env a value command acts under, or why there's none. */
31
+ export type ValueTarget = {
32
+ readonly kind: 'ok';
33
+ readonly envName: string;
34
+ /**
35
+ * `served`: `--env` was left out, and the runtime refuses other envs.
36
+ * `environment`: `--env` named a pack environment with a project, on
37
+ * such a runtime.
38
+ */
39
+ readonly from: 'flag' | 'served' | 'default' | 'environment';
40
+ /** With `from: 'environment'`: the environment, whose project is the value's scope. */
41
+ readonly environment?: MappedEnvironment;
42
+ }
43
+ /** No `--env`, and neither a default nor a runtime that names one: the command's own message. */
44
+ | {
45
+ readonly kind: 'missing';
46
+ } | {
47
+ readonly kind: 'refused';
48
+ readonly stderr: string;
49
+ };
50
+ /** A pack environment `--env` named, with its project resolved to an id. */
51
+ export interface ResolvedEnvironment extends MappedEnvironment {
52
+ readonly projectId: string;
53
+ }
54
+ /** `ValueTarget` for a command: a named environment's project resolved to its id. */
55
+ export type CommandValueTarget = (Extract<ValueTarget, {
56
+ kind: 'ok';
57
+ }> & {
58
+ readonly environment?: ResolvedEnvironment;
59
+ }) | Exclude<ValueTarget, {
60
+ kind: 'ok';
61
+ }>;
62
+ /**
63
+ * Where a value command's value goes. `flag` is `--env` as given, `fallback`
64
+ * the command's own default (none: `--env` is required).
65
+ *
66
+ * On a runtime that refuses other envs, `--env` defaults to the env it
67
+ * serves, and a write (`write`) under another is refused here, before
68
+ * anything is sent: it would never be read. A read or a delete may still
69
+ * name another env, to find and remove what was stored there before.
70
+ * There, `--env` may also name one of the pack's `environments` that has a
71
+ * `project`: the value is that project's, under the env the runtime serves.
72
+ * The environment picks the scope, so a `--scope` with it (`scope`, as
73
+ * given) may only name that project: `project`, or `project:<its id>`
74
+ * (`valueTargetFor` compares the id).
75
+ * Anywhere else: `flag`, then `fallback`, as before.
76
+ *
77
+ * `what` names what would be stored, for the refusal (`a secret`).
78
+ * `mayOmit: false` when leaving `--env` out isn't the way (it picks more
79
+ * than the env), so the refusal doesn't suggest it. A refused `local`
80
+ * also says where `local` is: a `kindgi dev` runtime, which the CLI talks
81
+ * to in its pack. `environments` is the pack's (none: outside a pack).
82
+ */
83
+ export declare function resolveValueTarget(input: {
84
+ readonly flag: string | undefined;
85
+ readonly fallback?: string;
86
+ readonly served: ServedEnv | undefined;
87
+ readonly write: boolean;
88
+ readonly what: string;
89
+ readonly mayOmit?: boolean;
90
+ readonly environments?: PackEnvironments;
91
+ readonly scope?: string;
92
+ }): ValueTarget;
93
+ /** A pack config's environments, each with the project it names (`projectOfEnv`). */
94
+ export declare function environmentsOf(config: {
95
+ readonly environments?: unknown;
96
+ }): PackEnvironments;
97
+ /** What a value command passes to `valueEnvFor` and `valueTargetFor`. */
98
+ interface ValueTargetOptions {
99
+ readonly write: boolean;
100
+ readonly what: string;
101
+ readonly fallback?: string;
102
+ readonly mayOmit?: boolean;
103
+ readonly scope?: string;
104
+ }
105
+ /**
106
+ * `resolveValueTarget` for a command, with a named pack environment's
107
+ * project as the config gives it (not looked up): for a command that uses
108
+ * the env alone. Asks the runtime what it serves only when that can change
109
+ * the answer: when `--env` is left out, the command writes, or `--env`
110
+ * names one of the pack's environments with a project. The pack's
111
+ * environments are read only when `--env` is given. On a runtime that
112
+ * refuses other envs, a pack config that can't be read is refused, before
113
+ * anything is sent: whether `--env` names one of its environments isn't
114
+ * known.
115
+ */
116
+ export declare function valueEnvFor(ctx: CommandContext, flag: string | undefined, options: ValueTargetOptions): Promise<ValueTarget>;
117
+ /**
118
+ * `valueEnvFor`, with the named pack environment's project looked up (a
119
+ * slug that names none or several is refused), and a `--scope` naming a
120
+ * project compared with it.
121
+ */
122
+ export declare function valueTargetFor(ctx: CommandContext, flag: string | undefined, options: ValueTargetOptions): Promise<CommandValueTarget>;
123
+ /**
124
+ * A command's result, with the line saying which project and env a pack
125
+ * environment named by `--env` stood for. Nothing for any other target.
126
+ */
127
+ export declare function withEnvironmentNote(result: CommandResult, target: {
128
+ readonly envName: string;
129
+ readonly environment?: ResolvedEnvironment;
130
+ }): CommandResult;
131
+ /**
132
+ * A command's result for `thrown`, with where `local` is added when the
133
+ * runtime refused a value under `local` (`409 env-not-served`). For a write
134
+ * the CLI sends anyway, since only the runtime knows whether a registration
135
+ * still reads it there.
136
+ */
137
+ export declare function withLocalEnvHint(result: CommandResult, thrown: unknown, envName: string): CommandResult;
138
+ export {};
139
+ //# sourceMappingURL=value-target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-target.d.ts","sourceRoot":"","sources":["../src/value-target.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,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W,CAAC,CA0BtB;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,kBAAkB,CAAC,CAqB7B;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,mBAAmB,CAAA;CAAE,GAC/E,aAAa,CAWf;AASD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,MAAM,GACd,aAAa,CAIf"}
@@ -0,0 +1,231 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (C) 2026 Kindgi Inc.
3
+ import { isAbsolute, resolve } from 'node:path';
4
+ import { LOCAL_ENV_NAME } from '@kindgi/secrets-dotenv';
5
+ import { projectOfEnv } from './commands/build.js';
6
+ import { UsageError, extractKindgiError } from './errors.js';
7
+ import { loadPackConfig } from './pack-config.js';
8
+ import { resolveProjectRef } from './project-ref.js';
9
+ /**
10
+ * The runtime's `servedEnv`, or `undefined` when it doesn't say (a runtime
11
+ * that serves no env, or an older one) or can't be asked. Then every default
12
+ * stays as it was, and a runtime that refuses other envs still refuses the
13
+ * write itself (`409 env-not-served`).
14
+ */
15
+ export async function servedEnvOf(client) {
16
+ try {
17
+ const served = (await client().identity.whoami()).servedEnv;
18
+ return served === undefined
19
+ ? undefined
20
+ : { envName: served.envName, refusesOtherEnvs: served.refusesOtherEnvs };
21
+ }
22
+ catch {
23
+ return undefined;
24
+ }
25
+ }
26
+ /**
27
+ * Where a value command's value goes. `flag` is `--env` as given, `fallback`
28
+ * the command's own default (none: `--env` is required).
29
+ *
30
+ * On a runtime that refuses other envs, `--env` defaults to the env it
31
+ * serves, and a write (`write`) under another is refused here, before
32
+ * anything is sent: it would never be read. A read or a delete may still
33
+ * name another env, to find and remove what was stored there before.
34
+ * There, `--env` may also name one of the pack's `environments` that has a
35
+ * `project`: the value is that project's, under the env the runtime serves.
36
+ * The environment picks the scope, so a `--scope` with it (`scope`, as
37
+ * given) may only name that project: `project`, or `project:<its id>`
38
+ * (`valueTargetFor` compares the id).
39
+ * Anywhere else: `flag`, then `fallback`, as before.
40
+ *
41
+ * `what` names what would be stored, for the refusal (`a secret`).
42
+ * `mayOmit: false` when leaving `--env` out isn't the way (it picks more
43
+ * than the env), so the refusal doesn't suggest it. A refused `local`
44
+ * also says where `local` is: a `kindgi dev` runtime, which the CLI talks
45
+ * to in its pack. `environments` is the pack's (none: outside a pack).
46
+ */
47
+ export function resolveValueTarget(input) {
48
+ const { flag, served } = input;
49
+ if (served?.refusesOtherEnvs === true) {
50
+ if (flag === undefined)
51
+ return { kind: 'ok', envName: served.envName, from: 'served' };
52
+ const projectRef = input.environments?.[flag];
53
+ if (projectRef !== undefined) {
54
+ return environmentTarget({ name: flag, projectRef }, served, input.scope);
55
+ }
56
+ if (flag !== served.envName && input.write) {
57
+ return {
58
+ kind: 'refused',
59
+ stderr: `env-not-served: this runtime keeps its values under \`${served.envName}\` only, so ${input.what} under \`${flag}\` would never be read. Use --env=${served.envName}${input.mayOmit === false ? '' : ', or leave --env out'}.\n${environmentsHint(flag, input.environments)}${localEnvHint(flag)}`,
60
+ };
61
+ }
62
+ return { kind: 'ok', envName: flag, from: 'flag' };
63
+ }
64
+ if (flag !== undefined)
65
+ return { kind: 'ok', envName: flag, from: 'flag' };
66
+ if (input.fallback !== undefined) {
67
+ return { kind: 'ok', envName: input.fallback, from: 'default' };
68
+ }
69
+ return { kind: 'missing' };
70
+ }
71
+ /**
72
+ * `--env` naming a pack environment with a project, on a runtime that
73
+ * refuses other envs: that project, under the env the runtime serves. A
74
+ * `--scope` (`scope`, as given) may only name that project.
75
+ */
76
+ function environmentTarget(environment, served, scope) {
77
+ const { name, projectRef } = environment;
78
+ if (scope === 'project:') {
79
+ return {
80
+ kind: 'refused',
81
+ stderr: 'Malformed --scope: expected --scope=project:<projectId>, got "project:".\n',
82
+ };
83
+ }
84
+ if (scope !== undefined && scope !== 'project' && !scope.startsWith('project:')) {
85
+ return {
86
+ kind: 'refused',
87
+ stderr: `--env=${name} is the pack's environment ${name}, so its scope is its project, ${projectRef}, not ${scope}. For a value every environment without its own reads, leave --env out (--scope=${scope}).\n`,
88
+ };
89
+ }
90
+ return { kind: 'ok', envName: served.envName, from: 'environment', environment };
91
+ }
92
+ /**
93
+ * What the pack's environments offer in place of a refused `--env`: the
94
+ * ones with a project, and how to give one a project. Nothing outside a
95
+ * pack, or for `local`, which has its own (`localEnvHint`).
96
+ */
97
+ function environmentsHint(flag, environments) {
98
+ if (environments === undefined || flag === LOCAL_ENV_NAME)
99
+ return '';
100
+ const mapped = Object.entries(environments).filter((entry) => entry[1] !== undefined);
101
+ const unmapped = flag in environments
102
+ ? `The pack's environment ${flag} names no project: add \`environments.${flag}.project\` to kindgi.config.ts, and --env=${flag} stores values in that project.\n`
103
+ : '';
104
+ if (mapped.length === 0) {
105
+ return (unmapped ||
106
+ "No environment in the pack's config names a project: add `environments.<name>.project` to kindgi.config.ts, and --env=<name> stores values in that project.\n");
107
+ }
108
+ const list = mapped.map(([name, project]) => `${name} (project ${project})`).join(', ');
109
+ return `${unmapped}The pack's environments: ${list}. --env=<one of them> stores a value in its project.\n`;
110
+ }
111
+ /** The environments of the pack at `--path`, else the cwd. */
112
+ async function packEnvironmentsOf(ctx) {
113
+ const raw = ctx.options.path;
114
+ const dir = typeof raw === 'string' && raw !== '' ? raw : '.';
115
+ const loaded = await loadPackConfig(ctx, isAbsolute(dir) ? dir : resolve(ctx.cwd, dir));
116
+ if (loaded.kind === 'ok')
117
+ return { kind: 'ok', environments: environmentsOf(loaded.config) };
118
+ return loaded.kind === 'invalid'
119
+ ? { kind: 'invalid', message: loaded.message }
120
+ : { kind: 'missing' };
121
+ }
122
+ /** A pack config's environments, each with the project it names (`projectOfEnv`). */
123
+ export function environmentsOf(config) {
124
+ const { environments } = config;
125
+ if (environments === null || typeof environments !== 'object')
126
+ return {};
127
+ return Object.fromEntries(Object.keys(environments).map((name) => [name, projectOfEnv(config, name)]));
128
+ }
129
+ /**
130
+ * `resolveValueTarget` for a command, with a named pack environment's
131
+ * project as the config gives it (not looked up): for a command that uses
132
+ * the env alone. Asks the runtime what it serves only when that can change
133
+ * the answer: when `--env` is left out, the command writes, or `--env`
134
+ * names one of the pack's environments with a project. The pack's
135
+ * environments are read only when `--env` is given. On a runtime that
136
+ * refuses other envs, a pack config that can't be read is refused, before
137
+ * anything is sent: whether `--env` names one of its environments isn't
138
+ * known.
139
+ */
140
+ export async function valueEnvFor(ctx, flag, options) {
141
+ let served;
142
+ let read = { kind: 'missing' };
143
+ if (flag === undefined || options.write) {
144
+ served = await servedEnvOf(ctx.client);
145
+ if (flag !== undefined && served?.refusesOtherEnvs === true) {
146
+ read = await packEnvironmentsOf(ctx);
147
+ }
148
+ }
149
+ else {
150
+ read = await packEnvironmentsOf(ctx);
151
+ if (read.kind === 'invalid' || (read.kind === 'ok' && read.environments[flag] !== undefined)) {
152
+ served = await servedEnvOf(ctx.client);
153
+ }
154
+ }
155
+ if (read.kind === 'invalid' && flag !== undefined && served?.refusesOtherEnvs === true) {
156
+ return {
157
+ kind: 'refused',
158
+ stderr: `Couldn't read the pack config: ${read.message.trimEnd()}\nOn this runtime, --env=${flag} may name one of the pack's environments, whose values are in its project, so nothing was sent. Fix the config and run this again.\n`,
159
+ };
160
+ }
161
+ return resolveValueTarget({
162
+ flag,
163
+ served,
164
+ ...(read.kind === 'ok' && { environments: read.environments }),
165
+ ...options,
166
+ });
167
+ }
168
+ /**
169
+ * `valueEnvFor`, with the named pack environment's project looked up (a
170
+ * slug that names none or several is refused), and a `--scope` naming a
171
+ * project compared with it.
172
+ */
173
+ export async function valueTargetFor(ctx, flag, options) {
174
+ const target = await valueEnvFor(ctx, flag, options);
175
+ if (target.kind !== 'ok' || target.environment === undefined) {
176
+ return target;
177
+ }
178
+ const { name, projectRef } = target.environment;
179
+ let projectId;
180
+ try {
181
+ projectId = await resolveProjectRef(ctx, projectRef);
182
+ }
183
+ catch (err) {
184
+ if (!(err instanceof UsageError))
185
+ throw err;
186
+ return { kind: 'refused', stderr: `The pack's environment ${name}: ${err.message}\n` };
187
+ }
188
+ const named = options.scope?.startsWith('project:') === true ? options.scope.slice(8) : undefined;
189
+ if (named !== undefined && named !== projectId) {
190
+ return {
191
+ kind: 'refused',
192
+ stderr: `--env=${name} is the pack's environment ${name}, project ${projectRef} (${projectId}), but --scope names project ${named}. Name one: --env=${name} with --scope=project, or --scope=project:${named} without --env.\n`,
193
+ };
194
+ }
195
+ return { ...target, environment: { name, projectRef, projectId } };
196
+ }
197
+ /**
198
+ * A command's result, with the line saying which project and env a pack
199
+ * environment named by `--env` stood for. Nothing for any other target.
200
+ */
201
+ export function withEnvironmentNote(result, target) {
202
+ const { environment } = target;
203
+ if (environment === undefined)
204
+ return result;
205
+ const shown = environment.projectRef === environment.projectId
206
+ ? environment.projectId
207
+ : `${environment.projectRef} (${environment.projectId})`;
208
+ const note = `Environment ${environment.name}: project ${shown}, values under ${target.envName}.\n`;
209
+ return result.kind === 'ok'
210
+ ? { ...result, rendered: { ...result.rendered, stderr: `${note}${result.rendered.stderr}` } }
211
+ : { ...result, stderr: `${note}${result.stderr}` };
212
+ }
213
+ /** Where `local` is, when that's the env a refused value named; otherwise nothing. */
214
+ function localEnvHint(envName) {
215
+ return envName === LOCAL_ENV_NAME
216
+ ? "`local` is a `kindgi dev` runtime's env: in a pack where `kindgi dev` runs, the CLI talks to that runtime, unless --url or KINDGI_API_URL names another.\n"
217
+ : '';
218
+ }
219
+ /**
220
+ * A command's result for `thrown`, with where `local` is added when the
221
+ * runtime refused a value under `local` (`409 env-not-served`). For a write
222
+ * the CLI sends anyway, since only the runtime knows whether a registration
223
+ * still reads it there.
224
+ */
225
+ export function withLocalEnvHint(result, thrown, envName) {
226
+ const wire = extractKindgiError(thrown);
227
+ if (result.kind !== 'error' || wire?.reason !== 'env-not-served')
228
+ return result;
229
+ return { ...result, stderr: `${result.stderr}${localEnvHint(envName)}` };
230
+ }
231
+ //# sourceMappingURL=value-target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-target.js","sourceRoot":"","sources":["../src/value-target.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAEjC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGhD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAWrD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAA0B;IAC1D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC;QAC5D,OAAO,MAAM,KAAK,SAAS;YACzB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAC7E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AA2CD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,kBAAkB,CAAC,KASlC;IACC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAC/B,IAAI,MAAM,EAAE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AM,UAAU,gBAAgB,CAC9B,MAAqB,EACrB,MAAe,EACf,OAAe;IAEf,MAAM,IAAI,GAAG,kBAAkB,CAAC,MAAM,CAAyC,CAAC;IAChF,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,EAAE,MAAM,KAAK,gBAAgB;QAAE,OAAO,MAAM,CAAC;IAChF,OAAO,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;AAC3E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kindgi/cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.9-rc.0",
4
4
  "description": "Command-line interface for Kindgi™. Create a pack, run it on your machine (`kindgi dev`), build, sign and deploy it, and work with a running Kindgi API from the terminal.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -37,18 +37,18 @@
37
37
  "provenance": true
38
38
  },
39
39
  "dependencies": {
40
- "@kindgi/agents": "0.1.8",
41
- "@kindgi/client": "0.1.8",
42
- "@kindgi/dotenv-file": "0.1.8",
43
- "@kindgi/crypto": "0.1.8",
44
- "@kindgi/env-schema": "0.1.8",
45
- "@kindgi/flow": "0.1.8",
46
- "@kindgi/handler-runtime": "0.1.8",
47
- "@kindgi/log": "0.1.8",
48
- "@kindgi/secrets-dotenv": "0.1.8",
49
- "@kindgi/platform": "0.1.8",
50
- "@kindgi/sdk": "0.1.8",
51
- "@kindgi/types": "0.1.8",
40
+ "@kindgi/agents": "0.1.9-rc.0",
41
+ "@kindgi/client": "0.1.9-rc.0",
42
+ "@kindgi/dotenv-file": "0.1.9-rc.0",
43
+ "@kindgi/crypto": "0.1.9-rc.0",
44
+ "@kindgi/env-schema": "0.1.9-rc.0",
45
+ "@kindgi/flow": "0.1.9-rc.0",
46
+ "@kindgi/handler-runtime": "0.1.9-rc.0",
47
+ "@kindgi/log": "0.1.9-rc.0",
48
+ "@kindgi/secrets-dotenv": "0.1.9-rc.0",
49
+ "@kindgi/platform": "0.1.9-rc.0",
50
+ "@kindgi/sdk": "0.1.9-rc.0",
51
+ "@kindgi/types": "0.1.9-rc.0",
52
52
  "esbuild": "^0.24.0",
53
53
  "semver": "^7.8.5",
54
54
  "smol-toml": "^1.9.0",