@kindgi/cli 0.1.4 → 0.1.5
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/README.md +13 -7
- package/dist/build/bundle.d.ts +11 -3
- package/dist/build/bundle.d.ts.map +1 -1
- package/dist/build/bundle.js +17 -3
- package/dist/build/bundle.js.map +1 -1
- package/dist/build/defaults.d.ts +3 -1
- package/dist/build/defaults.d.ts.map +1 -1
- package/dist/build/defaults.js +44 -1
- package/dist/build/defaults.js.map +1 -1
- package/dist/build/java-image.d.ts +31 -0
- package/dist/build/java-image.d.ts.map +1 -0
- package/dist/build/java-image.js +146 -0
- package/dist/build/java-image.js.map +1 -0
- package/dist/build/pack-root.d.ts +1 -31
- package/dist/build/pack-root.d.ts.map +1 -1
- package/dist/build/pack-root.js +22 -2
- package/dist/build/pack-root.js.map +1 -1
- package/dist/build/runners.d.ts +44 -0
- package/dist/build/runners.d.ts.map +1 -1
- package/dist/build/scala-image.d.ts +21 -0
- package/dist/build/scala-image.d.ts.map +1 -0
- package/dist/build/scala-image.js +150 -0
- package/dist/build/scala-image.js.map +1 -0
- package/dist/cli-pin.d.ts +16 -0
- package/dist/cli-pin.d.ts.map +1 -0
- package/dist/cli-pin.js +66 -0
- package/dist/cli-pin.js.map +1 -0
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +9 -8
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/approvals.d.ts.map +1 -1
- package/dist/commands/approvals.js +30 -4
- package/dist/commands/approvals.js.map +1 -1
- package/dist/commands/artifacts.d.ts.map +1 -1
- package/dist/commands/artifacts.js +100 -37
- package/dist/commands/artifacts.js.map +1 -1
- package/dist/commands/auth.js +2 -2
- package/dist/commands/blocks.d.ts.map +1 -1
- package/dist/commands/blocks.js +5 -4
- package/dist/commands/blocks.js.map +1 -1
- package/dist/commands/build.d.ts +10 -2
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +109 -16
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/capabilities.d.ts.map +1 -1
- package/dist/commands/capabilities.js +37 -10
- package/dist/commands/capabilities.js.map +1 -1
- package/dist/commands/console.d.ts +21 -0
- package/dist/commands/console.d.ts.map +1 -0
- package/dist/commands/console.js +87 -0
- package/dist/commands/console.js.map +1 -0
- package/dist/commands/conversations.d.ts.map +1 -1
- package/dist/commands/conversations.js +13 -2
- package/dist/commands/conversations.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +2 -2
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +11 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +212 -40
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/doctor.d.ts +14 -2
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +356 -20
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/env-scoped.d.ts +44 -0
- package/dist/commands/env-scoped.d.ts.map +1 -0
- package/dist/commands/env-scoped.js +222 -0
- package/dist/commands/env-scoped.js.map +1 -0
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/commands/env.js +85 -123
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/eval-runs.d.ts +9 -0
- package/dist/commands/eval-runs.d.ts.map +1 -1
- package/dist/commands/eval-runs.js +20 -19
- package/dist/commands/eval-runs.js.map +1 -1
- package/dist/commands/eval-suites.d.ts.map +1 -1
- package/dist/commands/eval-suites.js +16 -8
- package/dist/commands/eval-suites.js.map +1 -1
- package/dist/commands/exports.d.ts +3 -0
- package/dist/commands/exports.d.ts.map +1 -0
- package/dist/commands/exports.js +82 -0
- package/dist/commands/exports.js.map +1 -0
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +6 -5
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/flows.d.ts.map +1 -1
- package/dist/commands/flows.js +2 -1
- package/dist/commands/flows.js.map +1 -1
- package/dist/commands/gate-policies.d.ts.map +1 -1
- package/dist/commands/gate-policies.js +2 -1
- package/dist/commands/gate-policies.js.map +1 -1
- package/dist/commands/guardrails.d.ts.map +1 -1
- package/dist/commands/guardrails.js +3 -2
- package/dist/commands/guardrails.js.map +1 -1
- package/dist/commands/helpers.js +5 -5
- package/dist/commands/helpers.js.map +1 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +14 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +254 -18
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/judge-classes.d.ts.map +1 -1
- package/dist/commands/judge-classes.js +11 -10
- package/dist/commands/judge-classes.js.map +1 -1
- package/dist/commands/judgments.d.ts.map +1 -1
- package/dist/commands/judgments.js +7 -6
- package/dist/commands/judgments.js.map +1 -1
- package/dist/commands/key.js +4 -4
- package/dist/commands/memory.d.ts.map +1 -1
- package/dist/commands/memory.js +277 -25
- package/dist/commands/memory.js.map +1 -1
- package/dist/commands/people.d.ts +3 -0
- package/dist/commands/people.d.ts.map +1 -0
- package/dist/commands/people.js +166 -0
- package/dist/commands/people.js.map +1 -0
- package/dist/commands/proposals.d.ts.map +1 -1
- package/dist/commands/proposals.js +390 -69
- package/dist/commands/proposals.js.map +1 -1
- package/dist/commands/provenance.d.ts.map +1 -1
- package/dist/commands/provenance.js +6 -7
- package/dist/commands/provenance.js.map +1 -1
- package/dist/commands/providers.d.ts.map +1 -1
- package/dist/commands/providers.js +7 -5
- package/dist/commands/providers.js.map +1 -1
- package/dist/commands/reviewers.d.ts.map +1 -1
- package/dist/commands/reviewers.js +3 -2
- package/dist/commands/reviewers.js.map +1 -1
- package/dist/commands/runs.d.ts.map +1 -1
- package/dist/commands/runs.js +35 -15
- package/dist/commands/runs.js.map +1 -1
- package/dist/commands/schedules.d.ts +3 -0
- package/dist/commands/schedules.d.ts.map +1 -0
- package/dist/commands/schedules.js +275 -0
- package/dist/commands/schedules.js.map +1 -0
- package/dist/commands/secrets.d.ts.map +1 -1
- package/dist/commands/secrets.js +10 -11
- package/dist/commands/secrets.js.map +1 -1
- package/dist/commands/service-accounts.d.ts +3 -0
- package/dist/commands/service-accounts.d.ts.map +1 -0
- package/dist/commands/service-accounts.js +175 -0
- package/dist/commands/service-accounts.js.map +1 -0
- package/dist/commands/skills.d.ts +1 -1
- package/dist/commands/skills.d.ts.map +1 -1
- package/dist/commands/skills.js +11 -4
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/sso.d.ts +6 -0
- package/dist/commands/sso.d.ts.map +1 -0
- package/dist/commands/sso.js +318 -0
- package/dist/commands/sso.js.map +1 -0
- package/dist/commands/tokens.d.ts +11 -0
- package/dist/commands/tokens.d.ts.map +1 -1
- package/dist/commands/tokens.js +144 -11
- package/dist/commands/tokens.js.map +1 -1
- package/dist/commands/tools.d.ts.map +1 -1
- package/dist/commands/tools.js +4 -3
- package/dist/commands/tools.js.map +1 -1
- package/dist/commands/unwired.d.ts.map +1 -1
- package/dist/commands/unwired.js +1 -30
- package/dist/commands/unwired.js.map +1 -1
- package/dist/commands/upgrade.d.ts +11 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +160 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/context.d.ts +7 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -0
- package/dist/context.js.map +1 -1
- package/dist/dev/defaults.d.ts +28 -11
- package/dist/dev/defaults.d.ts.map +1 -1
- package/dist/dev/defaults.js +114 -35
- package/dist/dev/defaults.js.map +1 -1
- package/dist/dev/google-credentials.d.ts +50 -0
- package/dist/dev/google-credentials.d.ts.map +1 -0
- package/dist/dev/google-credentials.js +157 -0
- package/dist/dev/google-credentials.js.map +1 -0
- package/dist/dev/java-builder.d.ts +56 -0
- package/dist/dev/java-builder.d.ts.map +1 -0
- package/dist/dev/java-builder.js +204 -0
- package/dist/dev/java-builder.js.map +1 -0
- package/dist/dev/jvm-run-files.d.ts +29 -0
- package/dist/dev/jvm-run-files.d.ts.map +1 -0
- package/dist/dev/jvm-run-files.js +94 -0
- package/dist/dev/jvm-run-files.js.map +1 -0
- package/dist/dev/lines.d.ts +13 -0
- package/dist/dev/lines.d.ts.map +1 -0
- package/dist/dev/lines.js +24 -0
- package/dist/dev/lines.js.map +1 -0
- package/dist/dev/log-view.d.ts +116 -0
- package/dist/dev/log-view.d.ts.map +1 -0
- package/dist/dev/log-view.js +233 -0
- package/dist/dev/log-view.js.map +1 -0
- package/dist/dev/pack-code.d.ts +79 -4
- package/dist/dev/pack-code.d.ts.map +1 -1
- package/dist/dev/pack-code.js +262 -3
- package/dist/dev/pack-code.js.map +1 -1
- package/dist/dev/pack-env.d.ts.map +1 -1
- package/dist/dev/pack-env.js +4 -0
- package/dist/dev/pack-env.js.map +1 -1
- package/dist/dev/pack-service.d.ts +11 -1
- package/dist/dev/pack-service.d.ts.map +1 -1
- package/dist/dev/pack-service.js +56 -20
- package/dist/dev/pack-service.js.map +1 -1
- package/dist/dev/paths.d.ts +6 -0
- package/dist/dev/paths.d.ts.map +1 -1
- package/dist/dev/paths.js +8 -0
- package/dist/dev/paths.js.map +1 -1
- package/dist/dev/project-database.js +1 -1
- package/dist/dev/project-database.js.map +1 -1
- package/dist/dev/runners.d.ts +35 -9
- package/dist/dev/runners.d.ts.map +1 -1
- package/dist/dev/runtime-container.d.ts +10 -2
- package/dist/dev/runtime-container.d.ts.map +1 -1
- package/dist/dev/runtime-container.js +48 -20
- package/dist/dev/runtime-container.js.map +1 -1
- package/dist/dev/runtime-env.d.ts +10 -0
- package/dist/dev/runtime-env.d.ts.map +1 -1
- package/dist/dev/runtime-env.js +8 -4
- package/dist/dev/runtime-env.js.map +1 -1
- package/dist/dev/runtime-image.d.ts +1 -1
- package/dist/dev/runtime-image.js +1 -1
- package/dist/dev/scala-builder.d.ts +72 -0
- package/dist/dev/scala-builder.d.ts.map +1 -0
- package/dist/dev/scala-builder.js +347 -0
- package/dist/dev/scala-builder.js.map +1 -0
- package/dist/env/project-env.d.ts.map +1 -1
- package/dist/env/project-env.js +3 -1
- package/dist/env/project-env.js.map +1 -1
- package/dist/errors.d.ts +9 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +15 -0
- package/dist/errors.js.map +1 -1
- package/dist/init/augment-scaffolder.js +1 -1
- package/dist/init/augment-scaffolder.js.map +1 -1
- package/dist/init/dependency-specs.d.ts +26 -0
- package/dist/init/dependency-specs.d.ts.map +1 -1
- package/dist/init/dependency-specs.js +38 -0
- package/dist/init/dependency-specs.js.map +1 -1
- package/dist/init/java-augment.d.ts +24 -0
- package/dist/init/java-augment.d.ts.map +1 -0
- package/dist/init/java-augment.js +198 -0
- package/dist/init/java-augment.js.map +1 -0
- package/dist/init/mode-detect.d.ts +2 -2
- package/dist/init/mode-detect.d.ts.map +1 -1
- package/dist/init/mode-detect.js +12 -1
- package/dist/init/mode-detect.js.map +1 -1
- package/dist/init/python-augment.js +1 -1
- package/dist/init/python-augment.js.map +1 -1
- package/dist/init/scala-augment.d.ts +23 -0
- package/dist/init/scala-augment.d.ts.map +1 -0
- package/dist/init/scala-augment.js +213 -0
- package/dist/init/scala-augment.js.map +1 -0
- package/dist/init/template-files.d.ts +40 -2
- package/dist/init/template-files.d.ts.map +1 -1
- package/dist/init/template-files.js +56 -5
- package/dist/init/template-files.js.map +1 -1
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +20 -2
- package/dist/main.js.map +1 -1
- package/dist/open-url.d.ts +15 -0
- package/dist/open-url.d.ts.map +1 -0
- package/dist/open-url.js +41 -0
- package/dist/open-url.js.map +1 -0
- package/dist/package-manager.d.ts +10 -3
- package/dist/package-manager.d.ts.map +1 -1
- package/dist/package-manager.js +19 -1
- package/dist/package-manager.js.map +1 -1
- package/dist/providers/presets/anthropic.json +11 -3
- package/dist/sdk-skills/kindgi-authoring-agents/SKILL.md +30 -2
- package/dist/sdk-skills/kindgi-authoring-flows/SKILL.md +1 -1
- package/dist/sdk-skills/kindgi-authoring-guardrails/SKILL.md +47 -3
- package/dist/sdk-skills/kindgi-authoring-mcp-servers/SKILL.md +7 -5
- package/dist/sdk-skills/kindgi-authoring-providers/SKILL.md +40 -15
- package/dist/sdk-skills/kindgi-authoring-tools/SKILL.md +66 -2
- package/dist/sdk-skills/kindgi-framework-feedback/SKILL.md +5 -4
- package/dist/sdk-skills/kindgi-getting-started/SKILL.md +1 -1
- package/dist/sdk-skills/kindgi-java-authoring-agents/SKILL.md +220 -0
- package/dist/sdk-skills/kindgi-java-authoring-flows/SKILL.md +390 -0
- package/dist/sdk-skills/kindgi-java-authoring-guardrails/SKILL.md +209 -0
- package/dist/sdk-skills/kindgi-java-authoring-tools/SKILL.md +334 -0
- package/dist/sdk-skills/kindgi-java-getting-started/SKILL.md +270 -0
- package/dist/sdk-skills/kindgi-python-authoring-agents/SKILL.md +25 -3
- package/dist/sdk-skills/kindgi-python-authoring-flows/SKILL.md +1 -1
- package/dist/sdk-skills/kindgi-python-authoring-guardrails/SKILL.md +10 -3
- package/dist/sdk-skills/kindgi-python-authoring-tools/SKILL.md +45 -6
- package/dist/sdk-skills/kindgi-python-getting-started/SKILL.md +2 -2
- package/dist/sdk-skills/kindgi-scala-authoring-agents/SKILL.md +217 -0
- package/dist/sdk-skills/kindgi-scala-authoring-flows/SKILL.md +357 -0
- package/dist/sdk-skills/kindgi-scala-authoring-guardrails/SKILL.md +199 -0
- package/dist/sdk-skills/kindgi-scala-authoring-tools/SKILL.md +302 -0
- package/dist/sdk-skills/kindgi-scala-getting-started/SKILL.md +302 -0
- package/dist/templates/java/.mvn/wrapper/maven-wrapper.properties +3 -0
- package/dist/templates/java/AGENTS.md +31 -0
- package/dist/templates/java/README.md.tmpl +69 -0
- package/dist/templates/java/gitignore +9 -0
- package/dist/templates/java/kindgi.config.json.tmpl +8 -0
- package/dist/templates/java/kindgiw +33 -0
- package/dist/templates/java/kindgiw.cmd +28 -0
- package/dist/templates/java/mvnw +295 -0
- package/dist/templates/java/pom.xml.tmpl +65 -0
- package/dist/templates/java/src/main/java/__PACKAGE__/agents/EchoAgent.java.tmpl +27 -0
- package/dist/templates/java/src/main/java/__PACKAGE__/flows/EchoFlow.java.tmpl +18 -0
- package/dist/templates/java/src/main/java/__PACKAGE__/guardrails/ResponseNotEmpty.java.tmpl +28 -0
- package/dist/templates/java/src/main/java/__PACKAGE__/tools/Echo.java.tmpl +22 -0
- package/dist/templates/java/src/main/java/__PACKAGE__/tools/Greet.java.tmpl +23 -0
- package/dist/templates/java/src/test/java/__PACKAGE__/ToolsTest.java.tmpl +30 -0
- package/dist/templates/minimal/README.md.tmpl +6 -12
- package/dist/templates/python/README.md.tmpl +4 -4
- package/dist/templates/sample/README.md.tmpl +5 -11
- package/dist/templates/scala/AGENTS.md +32 -0
- package/dist/templates/scala/README.md.tmpl +75 -0
- package/dist/templates/scala/build.sbt.tmpl +16 -0
- package/dist/templates/scala/gitignore +13 -0
- package/dist/templates/scala/kindgi.config.json.tmpl +8 -0
- package/dist/templates/scala/project/build.properties +1 -0
- package/dist/templates/scala/src/main/scala/__PACKAGE__/agents/EchoAgent.scala.tmpl +23 -0
- package/dist/templates/scala/src/main/scala/__PACKAGE__/flows/EchoFlow.scala.tmpl +16 -0
- package/dist/templates/scala/src/main/scala/__PACKAGE__/guardrails/ResponseNotEmpty.scala.tmpl +21 -0
- package/dist/templates/scala/src/main/scala/__PACKAGE__/tools/Echo.scala.tmpl +16 -0
- package/dist/templates/scala/src/main/scala/__PACKAGE__/tools/Greet.scala.tmpl +17 -0
- package/dist/templates/scala/src/test/scala/__PACKAGE__/ToolsSuite.scala.tmpl +23 -0
- package/package.json +13 -12
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# {{PACK_NAME}}
|
|
2
|
+
|
|
3
|
+
A sample Kindgi pack in Scala — scaffolded by `kindgi init --template=scala`.
|
|
4
|
+
|
|
5
|
+
Two tools (`echo`, `greet`), one guardrail (`response-not-empty`), one agent
|
|
6
|
+
that uses both tools and the guardrail, and one flow that runs the echo tool.
|
|
7
|
+
|
|
8
|
+
Java and Scala support is in preview: tested and supported, but the API may
|
|
9
|
+
still change in 0.1.6 without the usual deprecation period.
|
|
10
|
+
|
|
11
|
+
## Layout
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
{{PACK_NAME}}/
|
|
15
|
+
├── kindgi.config.json # the pack's id and version ("language": "scala"), the CLI it pins
|
|
16
|
+
├── build.sbt # kindgi-pack-scala, Scala 3.3, Java 17
|
|
17
|
+
├── src/main/scala/{{SCALA_PACKAGE_PATH}}/
|
|
18
|
+
│ ├── tools/Echo.scala # Tool[Input, Output] — case classes in, case classes out
|
|
19
|
+
│ ├── tools/Greet.scala # a parameter's default is the schema's default
|
|
20
|
+
│ ├── guardrails/ResponseNotEmpty.scala # Guardrail[Config] — a zero-LLM check over the run
|
|
21
|
+
│ ├── agents/EchoAgent.scala # Agent — data
|
|
22
|
+
│ └── flows/EchoFlow.scala # Flow — data
|
|
23
|
+
└── src/test/scala/{{SCALA_PACKAGE_PATH}}/ToolsSuite.scala # the tools, called directly
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
A file's tools, guardrails, agents and flows are the `val`s of an object named
|
|
27
|
+
like the file (`Greet.scala` holds `object Greet`).
|
|
28
|
+
|
|
29
|
+
## Run
|
|
30
|
+
|
|
31
|
+
You need a JDK 17 or later (`JAVA_HOME`) and sbt.
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
sbt test
|
|
35
|
+
./kindgiw dev # the CLI the pack pins: boots Kindgi locally, compiles and runs this pack, recompiling on save
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Then, from another terminal:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
./kindgiw runs start --agent={{PACK_ID}}.echo-agent --input='{"userMessage":"hi"}'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`kindgi dev` compiles through sbt's server (`sbt --client`), so a save compiles
|
|
45
|
+
in about a second once it's warm. It starts that server when none is running
|
|
46
|
+
and stops it when it stops; a server you already run (your IDE's) is used and
|
|
47
|
+
left running. It uses `JAVA_HOME`'s JDK (or `dev.javaHome` in
|
|
48
|
+
`kindgi.config.json`) and the `sbt` on your `PATH` (or `dev.sbt`, e.g.
|
|
49
|
+
`["sbt", "-mem", "2048"]`). `SBT_OPTS` in your shell reaches sbt only, never
|
|
50
|
+
the pack.
|
|
51
|
+
|
|
52
|
+
## Use a real model
|
|
53
|
+
|
|
54
|
+
`kindgi dev` gives a new pack `dev-echo`, a fallback provider that isn't a
|
|
55
|
+
model: it calls the first tool and replies "Tool responded: …", after a
|
|
56
|
+
warning line that says so. It answers only while no other provider fits. To
|
|
57
|
+
use a real model, set one LLM provider's key and register its preset, with
|
|
58
|
+
`kindgi dev` running, from another terminal. For Claude:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
./kindgiw secrets set ANTHROPIC_API_KEY --env=local --scope=tenant # no-echo prompt; writes .env.local
|
|
62
|
+
./kindgiw providers register --preset=anthropic # Opus 5.5, Sonnet 5.5, Haiku 4.5
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Claude takes over from dev-echo on the next turn; nothing to restart.
|
|
66
|
+
OpenAI (`OPENAI_API_KEY`, `--preset=openai`), Gemini (`GEMINI_API_KEY`,
|
|
67
|
+
`--preset=gemini-api`), Groq (`GROQ_API_KEY`, `--preset=groq`) and
|
|
68
|
+
OpenRouter (`OPENROUTER_API_KEY`, `--preset=openrouter`) work the same way;
|
|
69
|
+
`kindgi providers presets` lists the presets.
|
|
70
|
+
|
|
71
|
+
## Build
|
|
72
|
+
|
|
73
|
+
`kindgi build --env=<name>` makes the pack's image: sbt compiles it in a
|
|
74
|
+
pinned sbt + JDK 17 image, the index is built in the image, and the pack
|
|
75
|
+
service runs on a JRE 17 as its entrypoint.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// {{PACK_ID}}: a Kindgi pack in Scala (kindgi.config.json, "language": "scala").
|
|
2
|
+
|
|
3
|
+
ThisBuild / scalaVersion := "3.3.8"
|
|
4
|
+
|
|
5
|
+
lazy val root = (project in file("."))
|
|
6
|
+
.settings(
|
|
7
|
+
name := "{{PACK_NAME}}",
|
|
8
|
+
version := "{{PACK_VERSION}}",{{SCALA_LOCAL_RESOLVER}}
|
|
9
|
+
libraryDependencies ++= Seq(
|
|
10
|
+
"com.kindgi" %% "kindgi-pack-scala" % "{{KINDGI_SCALA_VERSION}}",
|
|
11
|
+
"jakarta.validation" % "jakarta.validation-api" % "3.0.2",
|
|
12
|
+
"org.scalameta" %% "munit" % "1.3.6" % Test
|
|
13
|
+
),
|
|
14
|
+
javacOptions ++= Seq("--release", "17"),
|
|
15
|
+
scalacOptions ++= Seq("-release", "17", "-deprecation", "-feature")
|
|
16
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sbt.version=1.12.15
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
package {{SCALA_PACKAGE}}.agents
|
|
2
|
+
|
|
3
|
+
import com.kindgi.pack.scaladsl._
|
|
4
|
+
import {{SCALA_PACKAGE}}.guardrails.ResponseNotEmpty
|
|
5
|
+
import {{SCALA_PACKAGE}}.tools.{Echo, Greet}
|
|
6
|
+
|
|
7
|
+
/** {{PACK_ID}}.echo-agent — uses both tools; the response-not-empty guardrail guards its answer. */
|
|
8
|
+
object EchoAgent {
|
|
9
|
+
val agent: Agent = Agent("{{PACK_ID}}.echo-agent")
|
|
10
|
+
.version("{{PACK_VERSION}}")
|
|
11
|
+
.name("Echo Agent")
|
|
12
|
+
.description("Uses the pack's echo and greet tools; the response-not-empty guardrail guards the output.")
|
|
13
|
+
.instructions(
|
|
14
|
+
"For each user message: if the user sends a name, greet them with the greet tool. " +
|
|
15
|
+
"Otherwise echo their message with the echo tool. Quote the tool result verbatim.")
|
|
16
|
+
.capability(Map("needs" -> List(Map("feature" -> "tool-use"))))
|
|
17
|
+
.tool(Echo.tool)
|
|
18
|
+
.tool(Greet.tool)
|
|
19
|
+
.guardrail(ResponseNotEmpty.guardrail)
|
|
20
|
+
.set("conversationPolicy", Map("historyLimit" -> 10))
|
|
21
|
+
.set("budget", Map("maxSteps" -> 4, "maxCostUsd" -> 0.1, "maxWallMs" -> 60000))
|
|
22
|
+
.build()
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
package {{SCALA_PACKAGE}}.flows
|
|
2
|
+
|
|
3
|
+
import com.kindgi.pack.scaladsl._
|
|
4
|
+
import {{SCALA_PACKAGE}}.tools.Echo
|
|
5
|
+
|
|
6
|
+
/** {{PACK_ID}}.echo-flow — runs the pack's echo tool, then ends. */
|
|
7
|
+
object EchoFlow {
|
|
8
|
+
val flow: Flow = Flow("{{PACK_ID}}.echo-flow")
|
|
9
|
+
.version("{{PACK_VERSION}}")
|
|
10
|
+
.set("name", "Echo Flow")
|
|
11
|
+
.set("description", "Runs the pack's echo tool and terminates.")
|
|
12
|
+
.toolNode("echo", Echo.tool)
|
|
13
|
+
.edge("e-start", "$start", "echo")
|
|
14
|
+
.edge("e-end", "echo", "$end")
|
|
15
|
+
.build()
|
|
16
|
+
}
|
package/dist/templates/scala/src/main/scala/__PACKAGE__/guardrails/ResponseNotEmpty.scala.tmpl
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
package {{SCALA_PACKAGE}}.guardrails
|
|
2
|
+
|
|
3
|
+
import com.kindgi.pack.scaladsl._
|
|
4
|
+
import jakarta.validation.constraints.Min
|
|
5
|
+
|
|
6
|
+
/** {{PACK_ID}}.response-not-empty — a zero-LLM guardrail: the run's answer has content. */
|
|
7
|
+
object ResponseNotEmpty {
|
|
8
|
+
final case class Config(@Min(value = 0) minLength: Int = 1)
|
|
9
|
+
|
|
10
|
+
val guardrail: Guardrail[Config] = Guardrail[Config]("{{PACK_ID}}.response-not-empty")
|
|
11
|
+
.name("Response is non-empty")
|
|
12
|
+
.checkId("{{PACK_ID}}.checks.response-not-empty")
|
|
13
|
+
.onViolation("halt")
|
|
14
|
+
.severity("error")
|
|
15
|
+
.set("scope", Map("when" -> "runtime-only"))
|
|
16
|
+
.check { (config, trace) =>
|
|
17
|
+
val text = Option(trace.output).getOrElse("").strip
|
|
18
|
+
if (text.length >= config.minLength) CheckResult.pass
|
|
19
|
+
else CheckResult.fail(s"Response too short: ${text.length} chars, expected >= ${config.minLength}.")
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
package {{SCALA_PACKAGE}}.tools
|
|
2
|
+
|
|
3
|
+
import com.kindgi.pack.scaladsl._
|
|
4
|
+
import jakarta.validation.constraints.{PositiveOrZero, Size}
|
|
5
|
+
import java.time.Instant
|
|
6
|
+
|
|
7
|
+
/** {{PACK_ID}}.echo — echoes the message back with a UTC timestamp and its length. */
|
|
8
|
+
object Echo {
|
|
9
|
+
final case class Input(@Size(min = 1, max = 500) message: String)
|
|
10
|
+
final case class Output(echo: String, echoedAt: Instant, @PositiveOrZero characterCount: Int)
|
|
11
|
+
|
|
12
|
+
val tool: Tool[Input, Output] = Tool[Input, Output]("{{PACK_ID}}.echo")
|
|
13
|
+
.description("Echoes the caller-provided message with a UTC timestamp and character count.")
|
|
14
|
+
.readOnly
|
|
15
|
+
.handler((in, _) => Output(in.message, Instant.now(), in.message.length))
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package {{SCALA_PACKAGE}}.tools
|
|
2
|
+
|
|
3
|
+
import com.kindgi.pack.scaladsl._
|
|
4
|
+
import jakarta.validation.constraints.Size
|
|
5
|
+
|
|
6
|
+
/** {{PACK_ID}}.greet — greets a named recipient. */
|
|
7
|
+
object Greet {
|
|
8
|
+
final case class Input(
|
|
9
|
+
@Size(min = 1, max = 100) name: String,
|
|
10
|
+
@Size(min = 1, max = 50) greeting: String = "Hello")
|
|
11
|
+
final case class Output(message: String)
|
|
12
|
+
|
|
13
|
+
val tool: Tool[Input, Output] = Tool[Input, Output]("{{PACK_ID}}.greet")
|
|
14
|
+
.description("Formats a greeting for the named recipient.")
|
|
15
|
+
.readOnly
|
|
16
|
+
.handler((in, _) => Output(s"${in.greeting}, ${in.name}!"))
|
|
17
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
package {{SCALA_PACKAGE}}
|
|
2
|
+
|
|
3
|
+
import com.kindgi.pack.ToolContext
|
|
4
|
+
import {{SCALA_PACKAGE}}.tools.{Echo, Greet}
|
|
5
|
+
|
|
6
|
+
/** The pack's tools, called directly — `sbt test`. */
|
|
7
|
+
class ToolsSuite extends munit.FunSuite {
|
|
8
|
+
test("echo round-trips the message") {
|
|
9
|
+
val out = Echo.tool.call(Echo.Input("hello"), ToolContext.forTest())
|
|
10
|
+
assertEquals(out.echo, "hello")
|
|
11
|
+
assertEquals(out.characterCount, 5)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
test("greet uses the greeting it is given, else Hello") {
|
|
15
|
+
assertEquals(Greet.tool.call(Greet.Input("Ada", "Hi"), ToolContext.forTest()).message, "Hi, Ada!")
|
|
16
|
+
assertEquals(Greet.tool.call(Greet.Input("Ada"), ToolContext.forTest()).message, "Hello, Ada!")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
test("the tools say they only read") {
|
|
20
|
+
assert(!Echo.tool.mutating())
|
|
21
|
+
assert(!Greet.tool.mutating())
|
|
22
|
+
}
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kindgi/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
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": {
|
|
@@ -37,17 +37,18 @@
|
|
|
37
37
|
"provenance": true
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@kindgi/agents": "0.1.
|
|
41
|
-
"@kindgi/client": "0.1.
|
|
42
|
-
"@kindgi/dotenv-file": "0.1.
|
|
43
|
-
"@kindgi/crypto": "0.1.
|
|
44
|
-
"@kindgi/env-schema": "0.1.
|
|
45
|
-
"@kindgi/flow": "0.1.
|
|
46
|
-
"@kindgi/handler-runtime": "0.1.
|
|
47
|
-
"@kindgi/
|
|
48
|
-
"@kindgi/
|
|
49
|
-
"@kindgi/
|
|
50
|
-
"@kindgi/
|
|
40
|
+
"@kindgi/agents": "0.1.5",
|
|
41
|
+
"@kindgi/client": "0.1.5",
|
|
42
|
+
"@kindgi/dotenv-file": "0.1.5",
|
|
43
|
+
"@kindgi/crypto": "0.1.5",
|
|
44
|
+
"@kindgi/env-schema": "0.1.5",
|
|
45
|
+
"@kindgi/flow": "0.1.5",
|
|
46
|
+
"@kindgi/handler-runtime": "0.1.5",
|
|
47
|
+
"@kindgi/log": "0.1.5",
|
|
48
|
+
"@kindgi/secrets-dotenv": "0.1.5",
|
|
49
|
+
"@kindgi/platform": "0.1.5",
|
|
50
|
+
"@kindgi/sdk": "0.1.5",
|
|
51
|
+
"@kindgi/types": "0.1.5",
|
|
51
52
|
"esbuild": "^0.24.0",
|
|
52
53
|
"semver": "^7.8.5",
|
|
53
54
|
"smol-toml": "^1.9.0",
|