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