@kindgi/cli 0.1.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 (139) hide show
  1. package/README.md +63 -15
  2. package/dist/build/bundle.d.ts +5 -2
  3. package/dist/build/bundle.d.ts.map +1 -1
  4. package/dist/build/bundle.js +8 -4
  5. package/dist/build/bundle.js.map +1 -1
  6. package/dist/build/containerfile.d.ts.map +1 -1
  7. package/dist/build/containerfile.js +1 -0
  8. package/dist/build/containerfile.js.map +1 -1
  9. package/dist/build/defaults.d.ts.map +1 -1
  10. package/dist/build/defaults.js +14 -3
  11. package/dist/build/defaults.js.map +1 -1
  12. package/dist/build/host-install.d.ts +52 -0
  13. package/dist/build/host-install.d.ts.map +1 -1
  14. package/dist/build/host-install.js +68 -0
  15. package/dist/build/host-install.js.map +1 -1
  16. package/dist/commands/auth.d.ts +22 -0
  17. package/dist/commands/auth.d.ts.map +1 -1
  18. package/dist/commands/auth.js +197 -2
  19. package/dist/commands/auth.js.map +1 -1
  20. package/dist/commands/build.d.ts +7 -0
  21. package/dist/commands/build.d.ts.map +1 -1
  22. package/dist/commands/build.js +31 -1
  23. package/dist/commands/build.js.map +1 -1
  24. package/dist/commands/dev.d.ts +1 -2
  25. package/dist/commands/dev.d.ts.map +1 -1
  26. package/dist/commands/dev.js +136 -58
  27. package/dist/commands/dev.js.map +1 -1
  28. package/dist/commands/helpers.d.ts +14 -3
  29. package/dist/commands/helpers.d.ts.map +1 -1
  30. package/dist/commands/helpers.js +20 -3
  31. package/dist/commands/helpers.js.map +1 -1
  32. package/dist/commands/init.d.ts.map +1 -1
  33. package/dist/commands/init.js +2 -3
  34. package/dist/commands/init.js.map +1 -1
  35. package/dist/commands/providers.d.ts.map +1 -1
  36. package/dist/commands/providers.js +11 -1
  37. package/dist/commands/providers.js.map +1 -1
  38. package/dist/commands/runs.d.ts.map +1 -1
  39. package/dist/commands/runs.js +17 -15
  40. package/dist/commands/runs.js.map +1 -1
  41. package/dist/commands/secrets.d.ts +1 -4
  42. package/dist/commands/secrets.d.ts.map +1 -1
  43. package/dist/commands/secrets.js +7 -55
  44. package/dist/commands/secrets.js.map +1 -1
  45. package/dist/commands/test.js +1 -1
  46. package/dist/commands/test.js.map +1 -1
  47. package/dist/commands/tools.d.ts.map +1 -1
  48. package/dist/commands/tools.js +11 -2
  49. package/dist/commands/tools.js.map +1 -1
  50. package/dist/commands/unwired.d.ts +5 -0
  51. package/dist/commands/unwired.d.ts.map +1 -1
  52. package/dist/commands/unwired.js +11 -0
  53. package/dist/commands/unwired.js.map +1 -1
  54. package/dist/context.d.ts +9 -0
  55. package/dist/context.d.ts.map +1 -1
  56. package/dist/context.js +1 -0
  57. package/dist/context.js.map +1 -1
  58. package/dist/dev/bundler.d.ts +2 -0
  59. package/dist/dev/bundler.d.ts.map +1 -1
  60. package/dist/dev/bundler.js +91 -10
  61. package/dist/dev/bundler.js.map +1 -1
  62. package/dist/dev/defaults.d.ts +8 -6
  63. package/dist/dev/defaults.d.ts.map +1 -1
  64. package/dist/dev/defaults.js +78 -60
  65. package/dist/dev/defaults.js.map +1 -1
  66. package/dist/dev/dev-only-imports.d.ts +15 -0
  67. package/dist/dev/dev-only-imports.d.ts.map +1 -0
  68. package/dist/dev/dev-only-imports.js +57 -0
  69. package/dist/dev/dev-only-imports.js.map +1 -0
  70. package/dist/dev/docker-compose.dev.yml +19 -7
  71. package/dist/dev/pack-service.d.ts +8 -0
  72. package/dist/dev/pack-service.d.ts.map +1 -1
  73. package/dist/dev/pack-service.js +1 -0
  74. package/dist/dev/pack-service.js.map +1 -1
  75. package/dist/dev/postgres-container.d.ts +77 -0
  76. package/dist/dev/postgres-container.d.ts.map +1 -0
  77. package/dist/dev/postgres-container.js +346 -0
  78. package/dist/dev/postgres-container.js.map +1 -0
  79. package/dist/dev/runners.d.ts +36 -11
  80. package/dist/dev/runners.d.ts.map +1 -1
  81. package/dist/dev/runtime-container.d.ts +11 -2
  82. package/dist/dev/runtime-container.d.ts.map +1 -1
  83. package/dist/dev/runtime-container.js +16 -7
  84. package/dist/dev/runtime-container.js.map +1 -1
  85. package/dist/dev/runtime-image.d.ts +15 -2
  86. package/dist/dev/runtime-image.d.ts.map +1 -1
  87. package/dist/dev/runtime-image.js +31 -2
  88. package/dist/dev/runtime-image.js.map +1 -1
  89. package/dist/dev/runtime-registry.d.ts +73 -0
  90. package/dist/dev/runtime-registry.d.ts.map +1 -0
  91. package/dist/dev/runtime-registry.js +111 -0
  92. package/dist/dev/runtime-registry.js.map +1 -0
  93. package/dist/errors.d.ts.map +1 -1
  94. package/dist/errors.js +5 -1
  95. package/dist/errors.js.map +1 -1
  96. package/dist/init/augment-scaffolder.d.ts +12 -0
  97. package/dist/init/augment-scaffolder.d.ts.map +1 -1
  98. package/dist/init/augment-scaffolder.js +93 -14
  99. package/dist/init/augment-scaffolder.js.map +1 -1
  100. package/dist/init/pnpm-workspace-patcher.d.ts +55 -0
  101. package/dist/init/pnpm-workspace-patcher.d.ts.map +1 -0
  102. package/dist/init/pnpm-workspace-patcher.js +248 -0
  103. package/dist/init/pnpm-workspace-patcher.js.map +1 -0
  104. package/dist/init/template-files.d.ts +2 -0
  105. package/dist/init/template-files.d.ts.map +1 -1
  106. package/dist/init/template-files.js +16 -1
  107. package/dist/init/template-files.js.map +1 -1
  108. package/dist/main.d.ts +7 -0
  109. package/dist/main.d.ts.map +1 -1
  110. package/dist/main.js +1 -0
  111. package/dist/main.js.map +1 -1
  112. package/dist/parse.d.ts +6 -0
  113. package/dist/parse.d.ts.map +1 -1
  114. package/dist/parse.js +1 -0
  115. package/dist/parse.js.map +1 -1
  116. package/dist/sdk-skills/kindgi-authoring-agents/SKILL.md +3 -4
  117. package/dist/sdk-skills/kindgi-authoring-flows/SKILL.md +12 -9
  118. package/dist/sdk-skills/kindgi-authoring-guardrails/SKILL.md +13 -7
  119. package/dist/sdk-skills/kindgi-authoring-mcp-servers/SKILL.md +1 -1
  120. package/dist/sdk-skills/kindgi-authoring-providers/SKILL.md +10 -9
  121. package/dist/sdk-skills/kindgi-authoring-tools/SKILL.md +15 -5
  122. package/dist/sdk-skills/kindgi-framework-feedback/SKILL.md +1 -1
  123. package/dist/sdk-skills/kindgi-getting-started/SKILL.md +16 -8
  124. package/dist/sdk-skills/kindgi-python-authoring-agents/SKILL.md +1 -1
  125. package/dist/sdk-skills/kindgi-python-authoring-flows/SKILL.md +12 -9
  126. package/dist/sdk-skills/kindgi-python-authoring-guardrails/SKILL.md +10 -7
  127. package/dist/sdk-skills/kindgi-python-authoring-tools/SKILL.md +8 -2
  128. package/dist/sdk-skills/kindgi-python-getting-started/SKILL.md +5 -3
  129. package/dist/templates/minimal/pnpm-workspace.yaml +6 -4
  130. package/dist/templates/sample/guardrails/response-not-empty/index.ts.tmpl +14 -6
  131. package/dist/templates/sample/pnpm-workspace.yaml +6 -4
  132. package/dist/terminal-input.d.ts +17 -0
  133. package/dist/terminal-input.d.ts.map +1 -0
  134. package/dist/terminal-input.js +88 -0
  135. package/dist/terminal-input.js.map +1 -0
  136. package/package.json +10 -10
  137. /package/dist/templates/minimal/{.gitignore → gitignore} +0 -0
  138. /package/dist/templates/python/{.gitignore → gitignore} +0 -0
  139. /package/dist/templates/sample/{.gitignore → gitignore} +0 -0
@@ -15,8 +15,8 @@ description: >
15
15
  kindgi-authoring-agents.
16
16
  type: core
17
17
  library: "@kindgi/sdk"
18
- version: "0.3.5"
19
- sdk_version: "0.1.0"
18
+ version: "0.3.6"
19
+ sdk_version: "0.1.1"
20
20
  pack_languages: [node]
21
21
  sources:
22
22
  - packages/guardrails/src/types.ts
@@ -167,7 +167,10 @@ available to the runtime that evaluates it.
167
167
  - **`config`** — the check's parameters, validated against the check's
168
168
  `configSchema` by `defineGuardrail`. In a pack, the declaration's
169
169
  `config` goes into the index and the check runs with it; without one
170
- it runs with `{}`. `evaluate` receives the config as declared —
170
+ it runs with `{}`. A declaration a pack file default-exports isn't run
171
+ through `defineGuardrail`, so nothing validates its `config`: keep it
172
+ valid against the schema yourself. `evaluate` receives the config as
173
+ declared —
171
174
  schema defaults are not filled in — so handle absent optional fields.
172
175
  - **`action.on-violation`** — `'halt'`, `'retry'` (with
173
176
  `retry.maxAttempts`, 1–10), `'escalate'` (with `escalateTo`),
@@ -177,7 +180,9 @@ available to the runtime that evaluates it.
177
180
  any other action are reported in `AgentTurnResult.violations` and the
178
181
  turn completes. The action handlers in `@kindgi/guardrails`
179
182
  (`retryHandler`, `escalateHandler`, `compensateHandler`, …) record the
180
- intent for callers that act on it.
183
+ intent for callers that act on it. In 0.1 the runtime acts only on
184
+ `halt`: `retry`, `escalate` and `compensate` are recorded on the
185
+ violation, with no second attempt, escalation or compensating call.
181
186
  - **`severity`** — `'info'` / `'warn'` / `'error'` (the default) /
182
187
  `'critical'`. Orthogonal to `action`: logs and dashboards group by
183
188
  severity; execution follows the action. A `log-only` guardrail can
@@ -236,8 +241,9 @@ guardrails: ['acme.no-fabricated-quotes'],
236
241
 
237
242
  At the start of each turn, the runtime resolves these ids against the
238
243
  guardrails available to the run. An id that isn't registered fails the
239
- turn with `unresolved-guardrail`, so register the guardrail before an
240
- agent references it.
244
+ turn before the model is called (`Error [invalid-request]: Agent "…"
245
+ references guardrails not in the registry: <id>`), so register the
246
+ guardrail before an agent references it.
241
247
 
242
248
  ## Changing a guardrail
243
249
 
@@ -277,7 +283,7 @@ ready for the stricter enforcement.
277
283
  - Type surface: hover any `@kindgi/sdk/define` export for full JSDoc;
278
284
  `Guardrail`, `defineGuardrail` and the built-in checks are in
279
285
  `@kindgi/guardrails`.
280
- - Companion docs: `pnpm --filter @kindgi/sdk exec typedoc`.
286
+ - API reference: https://docs.kindgi.com/v0.1/reference/typescript/sdk/kindgi/sdk/define/
281
287
  - Built-in check implementations: `packages/guardrails/src/checks.ts`.
282
288
 
283
289
  ## 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.0"
21
- sdk_version: "0.1.0"
21
+ sdk_version: "0.1.1"
22
22
  pack_languages: [node, python]
23
23
  ---
24
24
 
@@ -22,8 +22,8 @@ description: >
22
22
  kindgi-getting-started.
23
23
  type: core
24
24
  library: "@kindgi/sdk"
25
- version: "0.9.1"
26
- sdk_version: "0.1.0"
25
+ version: "0.9.2"
26
+ sdk_version: "0.1.1"
27
27
  pack_languages: [node, python]
28
28
  sources:
29
29
  - packages/adapters/model-anthropic/src/provider.ts
@@ -492,15 +492,12 @@ into one entry per model (`metadata.models[]`), filters the resulting
492
492
  tenant policy), then sorts survivors in this order:
493
493
 
494
494
  1. **Preferred provider / model.** Tuples matching the agent's
495
- `preferredProvider` (and `preferredModel`, when the `Agent` object
496
- carries one) are promoted to the front.
495
+ `preferredProvider` and `preferredModel` are promoted to the front.
497
496
  - Both set → promote the exact tuple.
498
497
  - Only `preferredModel` set → promote any provider exposing that model.
499
498
  - Only `preferredProvider` set → promote every model of that provider.
500
- `defineAgent` accepts `preferredProvider` but not `preferredModel`
501
- (`DefineAgentSpec` has no such field), so agents built with it can
502
- only express a provider preference here. A Python `Agent` takes
503
- both (`preferred_provider=`, `preferred_model=`).
499
+ `defineAgent` takes both (`preferredProvider`, `preferredModel`), and
500
+ so does a Python `Agent` (`preferred_provider=`, `preferred_model=`).
504
501
  2. **`capability.prefer[]` weights.** If the agent's capability
505
502
  declares `prefer: [{feature: 'thinking', weight: 3}, ...]`, tuples
506
503
  with matching model features (or provider attributes) get higher
@@ -597,7 +594,11 @@ defineAgent({
597
594
  be the FULL npm package name of the adapter — `"@kindgi/adapter-model-anthropic"`,
598
595
  NOT `"anthropic"`. Adapters are registered with the runtime under
599
596
  their full package names, and a short name matches none of them, so
600
- the registration fails. Confirm valid ids with `kindgi adapters list`.
597
+ the registration fails. The model adapters are
598
+ `@kindgi/adapter-model-anthropic`, `@kindgi/adapter-model-gemini`,
599
+ `@kindgi/adapter-model-openai-compat` and
600
+ `@kindgi/adapter-model-in-process`; `kindgi providers presets` shows
601
+ the id each preset uses.
601
602
 
602
603
  1. **`envName` mismatch between the setter (`kindgi secrets set` or `env set`) and `provider.json`.**
603
604
  Both writers use `--env=<name>` (default `local`): `local` is the
@@ -12,8 +12,8 @@ description: >
12
12
  authoring agents is covered by kindgi-authoring-agents.
13
13
  type: core
14
14
  library: "@kindgi/sdk"
15
- version: "0.4.1"
16
- sdk_version: "0.1.0"
15
+ version: "0.4.3"
16
+ sdk_version: "0.1.1"
17
17
  pack_languages: [node]
18
18
  sources:
19
19
  - packages/tools/src/types.ts
@@ -108,7 +108,7 @@ A handler must return a Promise; one with nothing to `await` can return `Promise
108
108
  The handler gets the **parsed** input, typed `z.infer` of `input` (Zod's output type):
109
109
 
110
110
  - **Defaults.** A `.default()` field is optional to the caller, the model included. The tool's advertised schema doesn't list it as required, and the handler always gets a value.
111
- - **Transforms and refinements.** `.transform()` results and `.refine()` checks apply before the handler runs. A failed refinement comes back as `input-validation-failed`, with the field's path.
111
+ - **Transforms and refinements.** `.transform()` results and `.refine()` checks apply before the handler runs. A failed refinement comes back as `input-validation-failed`.
112
112
  - **Extra keys.** A plain `z.object` accepts them and strips them. Use `z.strictObject` to reject them.
113
113
  - **JSON-Schema-authored tools** get each property's `default` filled in the same way.
114
114
 
@@ -268,13 +268,23 @@ run start via `semver.maxSatisfying`. No implicit `:latest`.
268
268
  changes (breaking schema shape, semantic behavior), not when you
269
269
  save. See the "Iterating on a tool" section above.
270
270
 
271
+ 9. **A package a tool imports, listed only in `devDependencies`.** The
272
+ deployed pack installs the app's production dependencies only, so the
273
+ import works under `kindgi dev` and fails in the image. When a tool
274
+ imports a new package (an ORM client such as `@prisma/client`, an API
275
+ SDK), check that the app's `package.json` lists it under
276
+ `dependencies`. Build-time tools (the `prisma` CLI, `typescript`) stay
277
+ in `devDependencies`. `kindgi dev` warns as soon as a tool imports one
278
+ ("⚠ The pack imports @prisma/client (in kindgi/tools/…), which
279
+ package.json lists only in devDependencies: …"), and `kindgi build`
280
+ refuses the pack until it moves.
281
+
271
282
  ## References
272
283
 
273
284
  - Type surface: `hover any @kindgi/sdk/define export` in your editor
274
285
  for full JSDoc — every field on `DefineToolSpec` / `ToolManifest`
275
286
  documents purpose, when to set it, and gotchas.
276
- - Companion docs: `pnpm --filter @kindgi/sdk exec typedoc` regenerates
277
- markdown API docs at `packages/sdk/docs/`.
287
+ - API reference: https://docs.kindgi.com/v0.1/reference/typescript/sdk/kindgi/sdk/define/ (every `define*` spec, field by field).
278
288
  - Common patterns: check the `sample` template (`kindgi init
279
289
  --template=sample`) for working examples of both authoring modes.
280
290
 
@@ -15,7 +15,7 @@ description: >
15
15
  type: core
16
16
  library: "@kindgi/sdk"
17
17
  version: "0.4.0"
18
- sdk_version: "0.1.0"
18
+ sdk_version: "0.1.1"
19
19
  pack_languages: [node, python]
20
20
  ---
21
21
 
@@ -14,8 +14,8 @@ description: >
14
14
  primitive.
15
15
  type: core
16
16
  library: "@kindgi/sdk"
17
- version: "0.3.2"
18
- sdk_version: "0.1.0"
17
+ version: "0.3.4"
18
+ sdk_version: "0.1.1"
19
19
  pack_languages: [node]
20
20
  ---
21
21
 
@@ -70,7 +70,9 @@ pnpm install # or the app's own package manager
70
70
 
71
71
  This adds `kindgi.config.ts` and a `kindgi/` folder beside the app's code,
72
72
  and never creates env files: `kindgi dev` reads the app's own `.env` /
73
- `.env.local`.
73
+ `.env.local`. A package a tool imports must be in the app's `dependencies`,
74
+ not `devDependencies`: the deployed pack installs production dependencies
75
+ only (see `kindgi-authoring-tools`).
74
76
 
75
77
  Either way, `init` adds `@kindgi/sdk` and `@kindgi/cli` to the project's
76
78
  `package.json`, so the project runs the `kindgi` it pins — never a global
@@ -95,22 +97,28 @@ needs on first run), indexes the pack, registers every primitive, and
95
97
  re-registers on every save. The banner prints the API URL, the seeded
96
98
  bearer token, and (if the console is bundled) the `/console/` URL.
97
99
 
98
- The local runtime includes a built-in `demo.echo-agent` you can hit to
99
- verify the harness before authoring anything.
100
+ Until a model provider is registered, agents answer with `dev-echo`, a
101
+ stand-in that calls the agent's first tool with `{"message": <userMessage>}`
102
+ and replies with what the tool returned. It checks the wiring only: it can't
103
+ fill in any other tool input or produce a typed `output` (that turn fails
104
+ with `output-schema-violation`). Register a provider
105
+ (`kindgi-authoring-providers`) before building a real agent.
100
106
 
101
107
  ## First run
102
108
 
103
109
  From a second terminal, with `cd my-pack`:
104
110
 
105
111
  ```bash
106
- pnpm exec kindgi runs start --agent=demo.echo-agent --input='{"userMessage":"hi"}'
112
+ pnpm exec kindgi runs start --agent=my-pack.echo-agent --input='{"userMessage":"hi"}'
107
113
  ```
108
114
 
115
+ `my-pack.echo-agent` is the agent the `sample` template ships (`<pack-id>.echo-agent`);
116
+ a `minimal` pack has no agent until you write one.
117
+
109
118
  The CLI reads `.kindgirc.json` (auto-written by `kindgi dev`) for the
110
119
  API URL + token, so second-terminal commands work without flags.
111
120
 
112
- Once you author your own agent, replace `demo.echo-agent` with your
113
- own id.
121
+ Once you author your own agent, run it by its own id.
114
122
 
115
123
  ## Layout
116
124
 
@@ -16,7 +16,7 @@ description: >
16
16
  type: core
17
17
  library: "kindgi (Python)"
18
18
  version: "0.1.0"
19
- sdk_version: "0.1.0"
19
+ sdk_version: "0.1.1"
20
20
  pack_languages: [python]
21
21
  sources:
22
22
  - sdks/python/src/kindgi/pack/define.py
@@ -16,8 +16,8 @@ description: >
16
16
  kindgi-python-authoring-agents.
17
17
  type: core
18
18
  library: "kindgi (Python)"
19
- version: "0.1.0"
20
- sdk_version: "0.1.0"
19
+ version: "0.1.1"
20
+ sdk_version: "0.1.1"
21
21
  pack_languages: [python]
22
22
  sources:
23
23
  - sdks/python/src/kindgi/pack/define.py
@@ -200,9 +200,11 @@ the condition is true. Conditions are dicts:
200
200
  | `and` `or` | `{"op", "children": [...]}` |
201
201
  | `not` | `{"op", "child"}` |
202
202
 
203
- Each operand is `{"literal": …}` or `{"path": …}`. A comparison whose
204
- path doesn't resolve is **false**, `ne` included. So to branch on "not
205
- billing", write `not` around the `eq` (as above), not `ne`. A condition
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
206
208
  used twice is easiest as a module-level constant (`IS_BILLING`).
207
209
 
208
210
  **Joining branches.** A node with several incoming edges runs once every
@@ -227,7 +229,7 @@ A node with several incoming edges ignores them.
227
229
  Its keys are the tool's input **as it travels**: a pydantic field's name,
228
230
  or its alias if it has one (a `customer_id` field is the key
229
231
  `customer_id`; with `alias="customerId"`, it's `customerId`). Paths are
230
- dot-separated, with no array indexing, rooted at:
232
+ dot-separated (a number segment indexes an array: `items.0.sku`), rooted at:
231
233
  - `runInput.…`: the input the run was started with;
232
234
  - `nodeOutputs.<nodeId>.…`: a step's output. For an agent step, add
233
235
  `.output.<field>` to read its typed answer;
@@ -289,9 +291,10 @@ the output), not on every save.
289
291
  1. **Building a flow without asking what goes in and comes out.** The
290
292
  pack's `echo_flow` proves the runtime works. It isn't a template for
291
293
  the user's flow.
292
- 2. **`ne` on a path that may be missing, to mean "otherwise".** A missing
293
- path makes every comparison false, so neither branch fires and
294
- everything after is skipped. Use `not` around the positive condition.
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.
295
298
  3. **Reading an agent step's answer at `nodeOutputs.<step>.<field>`.**
296
299
  The typed answer is under `.output`: `nodeOutputs.<step>.output.<field>`.
297
300
  An agent without `output=` has only `text`.
@@ -14,8 +14,8 @@ description: >
14
14
  kindgi-python-authoring-tools.
15
15
  type: core
16
16
  library: "kindgi (Python)"
17
- version: "0.1.0"
18
- sdk_version: "0.1.0"
17
+ version: "0.1.1"
18
+ sdk_version: "0.1.1"
19
19
  pack_languages: [python]
20
20
  sources:
21
21
  - sdks/python/src/kindgi/pack/define.py
@@ -106,7 +106,9 @@ def no_fabricated_quotes(config: Config, trace: RunTrace) -> CheckResult:
106
106
  In an agent turn a failed `halt` guardrail fails the turn
107
107
  (`guardrail-violation`) and the answer is not stored; any other action
108
108
  reports the failure in the turn result's `violations` and the turn
109
- completes.
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.
110
112
  - **`severity`** — `"info"`, `"warn"`, `"error"` (default), `"critical"`.
111
113
  Independent of the action: dashboards group by severity, execution
112
114
  follows the action.
@@ -147,8 +149,9 @@ brief_writer = Agent(..., guardrails=[no_fabricated_quotes])
147
149
  ```
148
150
 
149
151
  The `Guardrail` object (or its id). `kindgi dev` registers the pack's
150
- guardrails; an agent naming an id with no registered guardrail fails
151
- its turn (`unresolved-guardrail`).
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>`).
152
155
 
153
156
  ## Common mistakes
154
157
 
@@ -158,8 +161,8 @@ its turn (`unresolved-guardrail`).
158
161
  2. **Snake_case keys in `config=`.** It is keyed like the wire — the
159
162
  model's aliases (`{"minLookups": 2}`), not the field names.
160
163
  3. **Both `on_violation=` and `action=`, or neither** — `DefinitionError`.
161
- 4. **Expecting retries from `halt`.** `halt` stops the turn; use
162
- `action={"on-violation": "retry", …}` for another attempt.
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.
163
166
  5. **Calling a model from the check.** Not available; keep checks pure.
164
167
  6. **Raising for a broken rule.** Return `CheckResult(passed=False,
165
168
  reason=…)`; an exception is an evaluation error, not a violation.
@@ -14,8 +14,8 @@ description: >
14
14
  kindgi-python-getting-started.
15
15
  type: core
16
16
  library: "kindgi (Python)"
17
- version: "0.1.0"
18
- sdk_version: "0.1.0"
17
+ version: "0.1.1"
18
+ sdk_version: "0.1.1"
19
19
  pack_languages: [python]
20
20
  sources:
21
21
  - sdks/python/src/kindgi/pack/define.py
@@ -290,6 +290,12 @@ removed field, a narrower type — not on every save.
290
290
  and an agent's tool approval gate asks before it on first use.
291
291
  10. **`mutating=False` on a tool that writes.** A dry run then runs it
292
292
  for real.
293
+ 11. **A package a tool imports, only in a dev group.** The deployed pack
294
+ installs without dev dependencies (`uv sync --no-dev`, or Poetry's
295
+ main group only), so the import works under `kindgi dev` and fails in
296
+ the image. Put what tools import in `[project].dependencies` (in a
297
+ Poetry 1 app, `[tool.poetry.dependencies]`); test and build tools stay
298
+ in dev groups.
293
299
 
294
300
  ## When the framework itself is the problem
295
301
 
@@ -14,8 +14,8 @@ description: >
14
14
  kindgi-python-authoring-agents; models by kindgi-authoring-providers.
15
15
  type: core
16
16
  library: "kindgi (Python)"
17
- version: "0.1.0"
18
- sdk_version: "0.1.0"
17
+ version: "0.1.1"
18
+ sdk_version: "0.1.1"
19
19
  pack_languages: [python]
20
20
  sources:
21
21
  - sdks/python/README.md
@@ -90,7 +90,9 @@ name (`from acme.text import normalize`); inside `kindgi/`, import the pack's
90
90
  modules relatively. Don't add an `__init__.py` to `kindgi/` — the folder
91
91
  would then shadow the `kindgi` package. `kindgi dev` reads the app's `.env`
92
92
  / `.env.local` — keys already there reach the tools as environment
93
- variables.
93
+ variables. A package a tool imports must be in the app's main dependencies,
94
+ not a dev group: the deployed pack installs without dev dependencies (see
95
+ `kindgi-python-authoring-tools`).
94
96
 
95
97
  ## Layout of the template
96
98
 
@@ -1,6 +1,8 @@
1
1
  # pnpm 12+ reads settings from this file, not from `package.json`'s
2
- # `pnpm` block. `allowBuilds` grants postinstall permission to
3
- # specific dependencies — esbuild ships a native binary via
4
- # postinstall that the vitest transform pipeline depends on.
2
+ # `pnpm` block. `allowBuilds` records, per dependency, whether pnpm runs
3
+ # its install script (true) or skips it (false); pnpm 11+ stops an install
4
+ # until each one has a decision. esbuild (the CLI's bundler, and vitest's
5
+ # transform) works without its script: its native binary comes from its
6
+ # `@esbuild/<platform>` package, so the script stays off.
5
7
  allowBuilds:
6
- esbuild: true
8
+ esbuild: false
@@ -7,7 +7,7 @@
7
7
  // `kind` at the top level; the runtime registers the inline check at
8
8
  // boot.
9
9
 
10
- import { defineCheck } from '@kindgi/sdk/define';
10
+ import { type DefinedCheck, defineCheck } from '@kindgi/sdk/define';
11
11
  import { z } from 'zod';
12
12
 
13
13
  const ConfigSchema = z.object({
@@ -31,15 +31,23 @@ const check = defineCheck({
31
31
  },
32
32
  });
33
33
 
34
+ // The check as the runtime registers it, typed with the SDK's
35
+ // `DefinedCheck`. Left to inference, its type would name
36
+ // `@kindgi/guardrails`, which the pack reaches only through
37
+ // `@kindgi/sdk` — `tsc` then stops with TS2742 (`declaration: true`).
38
+ type InlineCheck = Pick<DefinedCheck<typeof ConfigSchema>, 'id' | 'evaluate' | 'validateConfig'>;
39
+
40
+ const inlineCheck: InlineCheck = {
41
+ id: check.id,
42
+ evaluate: check.evaluate,
43
+ ...(check.validateConfig !== undefined && { validateConfig: check.validateConfig }),
44
+ };
45
+
34
46
  const guardrail = {
35
47
  id: '{{PACK_ID}}.response-not-empty',
36
48
  name: 'Response is non-empty',
37
49
  kind: 'zero-llm' as const,
38
- check: {
39
- id: check.id,
40
- evaluate: check.evaluate,
41
- ...(check.validateConfig !== undefined && { validateConfig: check.validateConfig }),
42
- },
50
+ check: inlineCheck,
43
51
  configSchema: check.configJsonSchema,
44
52
  action: { 'on-violation': 'halt' } as const,
45
53
  severity: 'error' as const,
@@ -1,6 +1,8 @@
1
1
  # pnpm 12+ reads settings from this file, not from `package.json`'s
2
- # `pnpm` block. `allowBuilds` grants postinstall permission to
3
- # specific dependencies — esbuild ships a native binary via
4
- # postinstall that the vitest transform pipeline depends on.
2
+ # `pnpm` block. `allowBuilds` records, per dependency, whether pnpm runs
3
+ # its install script (true) or skips it (false); pnpm 11+ stops an install
4
+ # until each one has a decision. esbuild (the CLI's bundler, and vitest's
5
+ # transform) works without its script: its native binary comes from its
6
+ # `@esbuild/<platform>` package, so the script stays off.
5
7
  allowBuilds:
6
- esbuild: true
8
+ esbuild: false
@@ -0,0 +1,17 @@
1
+ /** A prompt whose answer isn't echoed. Tests hand in a fake. */
2
+ export interface TtySeam {
3
+ /** Rejects with `PromptCancelled` when the person presses Ctrl+C (or Ctrl+D) instead. */
4
+ promptHidden(prompt: string): Promise<string>;
5
+ close(): void;
6
+ }
7
+ /** The person cancelled a prompt (Ctrl+C, or Ctrl+D): no answer, not an empty one. */
8
+ export declare class PromptCancelled extends Error {
9
+ constructor();
10
+ }
11
+ /** Whether stdin is a terminal, so a hidden prompt can read from it. */
12
+ export declare function stdinIsTty(): boolean;
13
+ export declare function stripTrailingNewline(s: string): string;
14
+ export declare function readStdinToEnd(): Promise<string>;
15
+ /** The hidden prompt on the real terminal: the prompt on stderr, keystrokes from stdin. */
16
+ export declare function realTtySeam(): TtySeam;
17
+ //# sourceMappingURL=terminal-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal-input.d.ts","sourceRoot":"","sources":["../src/terminal-input.ts"],"names":[],"mappings":"AAaA,gEAAgE;AAChE,MAAM,WAAW,OAAO;IACtB,yFAAyF;IACzF,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9C,KAAK,IAAI,IAAI,CAAC;CACf;AAED,sFAAsF;AACtF,qBAAa,eAAgB,SAAQ,KAAK;;CAKzC;AAED,wEAAwE;AACxE,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAItD;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAMtD;AAED,2FAA2F;AAC3F,wBAAgB,WAAW,IAAI,OAAO,CAsDrC"}
@@ -0,0 +1,88 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (C) 2026 Kindgi Inc.
3
+ /**
4
+ * Reading a secret from the person at the terminal (a hidden prompt) or
5
+ * from stdin: the value of `kindgi secrets set`, the registry token of
6
+ * `kindgi auth registry`. Nothing here echoes or logs what it reads.
7
+ */
8
+ import { EOL } from 'node:os';
9
+ import * as readline from 'node:readline';
10
+ /** The person cancelled a prompt (Ctrl+C, or Ctrl+D): no answer, not an empty one. */
11
+ export class PromptCancelled extends Error {
12
+ constructor() {
13
+ super('Cancelled.');
14
+ this.name = 'PromptCancelled';
15
+ }
16
+ }
17
+ /** Whether stdin is a terminal, so a hidden prompt can read from it. */
18
+ export function stdinIsTty() {
19
+ return Boolean(process.stdin.isTTY);
20
+ }
21
+ export function stripTrailingNewline(s) {
22
+ if (s.endsWith(EOL))
23
+ return s.slice(0, -EOL.length);
24
+ if (s.endsWith('\n'))
25
+ return s.slice(0, -1);
26
+ return s;
27
+ }
28
+ export async function readStdinToEnd() {
29
+ const chunks = [];
30
+ for await (const chunk of process.stdin) {
31
+ chunks.push(chunk);
32
+ }
33
+ return Buffer.concat(chunks).toString('utf8');
34
+ }
35
+ /** The hidden prompt on the real terminal: the prompt on stderr, keystrokes from stdin. */
36
+ export function realTtySeam() {
37
+ const rl = readline.createInterface({
38
+ input: process.stdin,
39
+ output: process.stderr,
40
+ terminal: true,
41
+ });
42
+ // Silence output while user types. `readline` doesn't expose a
43
+ // built-in "no-echo" mode; the standard trick is to override the
44
+ // internal `_writeToOutput` on the interface. This is portable
45
+ // enough across Node 22.x + prints only the prompt itself.
46
+ const rlAny = rl;
47
+ return {
48
+ promptHidden: (prompt) => new Promise((resolve, reject) => {
49
+ const originalWrite = rlAny._writeToOutput;
50
+ const done = () => {
51
+ rl.off('SIGINT', cancel);
52
+ rl.off('close', cancel);
53
+ if (originalWrite !== undefined) {
54
+ rlAny._writeToOutput = originalWrite;
55
+ }
56
+ else {
57
+ // biome-ignore lint/performance/noDelete: readline distinguishes missing property from undefined
58
+ delete rlAny._writeToOutput;
59
+ }
60
+ (rlAny.output ?? process.stderr).write('\n');
61
+ };
62
+ // Ctrl+C in a raw-mode prompt reaches readline, not the process:
63
+ // without these, readline closes, the answer never comes, and the
64
+ // process exits 0 as if nothing went wrong.
65
+ const cancel = () => {
66
+ done();
67
+ reject(new PromptCancelled());
68
+ };
69
+ rl.once('SIGINT', cancel);
70
+ rl.once('close', cancel);
71
+ rlAny._writeToOutput = function overrideWrite(str) {
72
+ // Write only the prompt itself (rl.question emits the
73
+ // prompt via the same channel); swallow keystrokes.
74
+ if (str === prompt) {
75
+ (rlAny.output ?? process.stderr).write(str);
76
+ }
77
+ };
78
+ rl.question(prompt, (answer) => {
79
+ done();
80
+ resolve(answer);
81
+ });
82
+ }),
83
+ close: () => {
84
+ rl.close();
85
+ },
86
+ };
87
+ }
88
+ //# sourceMappingURL=terminal-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal-input.js","sourceRoot":"","sources":["../src/terminal-input.ts"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kindgi/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Command-line interface for Kindgi™ — the sovereign AI OS. 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": {
@@ -36,15 +36,15 @@
36
36
  "provenance": true
37
37
  },
38
38
  "dependencies": {
39
- "@kindgi/client": "0.1.0",
40
- "@kindgi/dotenv-file": "0.1.0",
41
- "@kindgi/crypto": "0.1.0",
42
- "@kindgi/env-schema": "0.1.0",
43
- "@kindgi/handler-runtime": "0.1.0",
44
- "@kindgi/secrets-dotenv": "0.1.0",
45
- "@kindgi/platform": "0.1.0",
46
- "@kindgi/sdk": "0.1.0",
47
- "@kindgi/types": "0.1.0",
39
+ "@kindgi/client": "0.1.1",
40
+ "@kindgi/dotenv-file": "0.1.1",
41
+ "@kindgi/crypto": "0.1.1",
42
+ "@kindgi/env-schema": "0.1.1",
43
+ "@kindgi/handler-runtime": "0.1.1",
44
+ "@kindgi/secrets-dotenv": "0.1.1",
45
+ "@kindgi/platform": "0.1.1",
46
+ "@kindgi/sdk": "0.1.1",
47
+ "@kindgi/types": "0.1.1",
48
48
  "esbuild": "^0.24.0",
49
49
  "semver": "^7.8.5",
50
50
  "smol-toml": "^1.9.0",
File without changes
File without changes