@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,295 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# ----------------------------------------------------------------------------
|
|
3
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
|
4
|
+
# or more contributor license agreements. See the NOTICE file
|
|
5
|
+
# distributed with this work for additional information
|
|
6
|
+
# regarding copyright ownership. The ASF licenses this file
|
|
7
|
+
# to you under the Apache License, Version 2.0 (the
|
|
8
|
+
# "License"); you may not use this file except in compliance
|
|
9
|
+
# with the License. You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing,
|
|
14
|
+
# software distributed under the License is distributed on an
|
|
15
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
# KIND, either express or implied. See the License for the
|
|
17
|
+
# specific language governing permissions and limitations
|
|
18
|
+
# under the License.
|
|
19
|
+
# ----------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
# ----------------------------------------------------------------------------
|
|
22
|
+
# Apache Maven Wrapper startup batch script, version 3.3.4
|
|
23
|
+
#
|
|
24
|
+
# Optional ENV vars
|
|
25
|
+
# -----------------
|
|
26
|
+
# JAVA_HOME - location of a JDK home dir, required when download maven via java source
|
|
27
|
+
# MVNW_REPOURL - repo url base for downloading maven distribution
|
|
28
|
+
# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
|
|
29
|
+
# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
|
|
30
|
+
# ----------------------------------------------------------------------------
|
|
31
|
+
|
|
32
|
+
set -euf
|
|
33
|
+
[ "${MVNW_VERBOSE-}" != debug ] || set -x
|
|
34
|
+
|
|
35
|
+
# OS specific support.
|
|
36
|
+
native_path() { printf %s\\n "$1"; }
|
|
37
|
+
case "$(uname)" in
|
|
38
|
+
CYGWIN* | MINGW*)
|
|
39
|
+
[ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
|
|
40
|
+
native_path() { cygpath --path --windows "$1"; }
|
|
41
|
+
;;
|
|
42
|
+
esac
|
|
43
|
+
|
|
44
|
+
# set JAVACMD and JAVACCMD
|
|
45
|
+
set_java_home() {
|
|
46
|
+
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
|
|
47
|
+
if [ -n "${JAVA_HOME-}" ]; then
|
|
48
|
+
if [ -x "$JAVA_HOME/jre/sh/java" ]; then
|
|
49
|
+
# IBM's JDK on AIX uses strange locations for the executables
|
|
50
|
+
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
51
|
+
JAVACCMD="$JAVA_HOME/jre/sh/javac"
|
|
52
|
+
else
|
|
53
|
+
JAVACMD="$JAVA_HOME/bin/java"
|
|
54
|
+
JAVACCMD="$JAVA_HOME/bin/javac"
|
|
55
|
+
|
|
56
|
+
if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
|
|
57
|
+
echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
|
|
58
|
+
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
|
|
59
|
+
return 1
|
|
60
|
+
fi
|
|
61
|
+
fi
|
|
62
|
+
else
|
|
63
|
+
JAVACMD="$(
|
|
64
|
+
'set' +e
|
|
65
|
+
'unset' -f command 2>/dev/null
|
|
66
|
+
'command' -v java
|
|
67
|
+
)" || :
|
|
68
|
+
JAVACCMD="$(
|
|
69
|
+
'set' +e
|
|
70
|
+
'unset' -f command 2>/dev/null
|
|
71
|
+
'command' -v javac
|
|
72
|
+
)" || :
|
|
73
|
+
|
|
74
|
+
if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
|
|
75
|
+
echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
|
|
76
|
+
return 1
|
|
77
|
+
fi
|
|
78
|
+
fi
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
# hash string like Java String::hashCode
|
|
82
|
+
hash_string() {
|
|
83
|
+
str="${1:-}" h=0
|
|
84
|
+
while [ -n "$str" ]; do
|
|
85
|
+
char="${str%"${str#?}"}"
|
|
86
|
+
h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
|
|
87
|
+
str="${str#?}"
|
|
88
|
+
done
|
|
89
|
+
printf %x\\n $h
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
verbose() { :; }
|
|
93
|
+
[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
|
|
94
|
+
|
|
95
|
+
die() {
|
|
96
|
+
printf %s\\n "$1" >&2
|
|
97
|
+
exit 1
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
trim() {
|
|
101
|
+
# MWRAPPER-139:
|
|
102
|
+
# Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
|
|
103
|
+
# Needed for removing poorly interpreted newline sequences when running in more
|
|
104
|
+
# exotic environments such as mingw bash on Windows.
|
|
105
|
+
printf "%s" "${1}" | tr -d '[:space:]'
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
scriptDir="$(dirname "$0")"
|
|
109
|
+
scriptName="$(basename "$0")"
|
|
110
|
+
|
|
111
|
+
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
|
|
112
|
+
while IFS="=" read -r key value; do
|
|
113
|
+
case "${key-}" in
|
|
114
|
+
distributionUrl) distributionUrl=$(trim "${value-}") ;;
|
|
115
|
+
distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
|
|
116
|
+
esac
|
|
117
|
+
done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties"
|
|
118
|
+
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
|
|
119
|
+
|
|
120
|
+
case "${distributionUrl##*/}" in
|
|
121
|
+
maven-mvnd-*bin.*)
|
|
122
|
+
MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
|
|
123
|
+
case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
|
|
124
|
+
*AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
|
|
125
|
+
:Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
|
|
126
|
+
:Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
|
|
127
|
+
:Linux*x86_64*) distributionPlatform=linux-amd64 ;;
|
|
128
|
+
*)
|
|
129
|
+
echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
|
|
130
|
+
distributionPlatform=linux-amd64
|
|
131
|
+
;;
|
|
132
|
+
esac
|
|
133
|
+
distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
|
|
134
|
+
;;
|
|
135
|
+
maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
|
|
136
|
+
*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
|
|
137
|
+
esac
|
|
138
|
+
|
|
139
|
+
# apply MVNW_REPOURL and calculate MAVEN_HOME
|
|
140
|
+
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
|
|
141
|
+
[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
|
|
142
|
+
distributionUrlName="${distributionUrl##*/}"
|
|
143
|
+
distributionUrlNameMain="${distributionUrlName%.*}"
|
|
144
|
+
distributionUrlNameMain="${distributionUrlNameMain%-bin}"
|
|
145
|
+
MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
|
|
146
|
+
MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
|
|
147
|
+
|
|
148
|
+
exec_maven() {
|
|
149
|
+
unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
|
|
150
|
+
exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if [ -d "$MAVEN_HOME" ]; then
|
|
154
|
+
verbose "found existing MAVEN_HOME at $MAVEN_HOME"
|
|
155
|
+
exec_maven "$@"
|
|
156
|
+
fi
|
|
157
|
+
|
|
158
|
+
case "${distributionUrl-}" in
|
|
159
|
+
*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
|
|
160
|
+
*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
|
|
161
|
+
esac
|
|
162
|
+
|
|
163
|
+
# prepare tmp dir
|
|
164
|
+
if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
|
|
165
|
+
clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
|
|
166
|
+
trap clean HUP INT TERM EXIT
|
|
167
|
+
else
|
|
168
|
+
die "cannot create temp dir"
|
|
169
|
+
fi
|
|
170
|
+
|
|
171
|
+
mkdir -p -- "${MAVEN_HOME%/*}"
|
|
172
|
+
|
|
173
|
+
# Download and Install Apache Maven
|
|
174
|
+
verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
|
|
175
|
+
verbose "Downloading from: $distributionUrl"
|
|
176
|
+
verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
|
|
177
|
+
|
|
178
|
+
# select .zip or .tar.gz
|
|
179
|
+
if ! command -v unzip >/dev/null; then
|
|
180
|
+
distributionUrl="${distributionUrl%.zip}.tar.gz"
|
|
181
|
+
distributionUrlName="${distributionUrl##*/}"
|
|
182
|
+
fi
|
|
183
|
+
|
|
184
|
+
# verbose opt
|
|
185
|
+
__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
|
|
186
|
+
[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
|
|
187
|
+
|
|
188
|
+
# normalize http auth
|
|
189
|
+
case "${MVNW_PASSWORD:+has-password}" in
|
|
190
|
+
'') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
|
|
191
|
+
has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
|
|
192
|
+
esac
|
|
193
|
+
|
|
194
|
+
if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
|
|
195
|
+
verbose "Found wget ... using wget"
|
|
196
|
+
wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
|
|
197
|
+
elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
|
|
198
|
+
verbose "Found curl ... using curl"
|
|
199
|
+
curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
|
|
200
|
+
elif set_java_home; then
|
|
201
|
+
verbose "Falling back to use Java to download"
|
|
202
|
+
javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
|
|
203
|
+
targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
|
|
204
|
+
cat >"$javaSource" <<-END
|
|
205
|
+
public class Downloader extends java.net.Authenticator
|
|
206
|
+
{
|
|
207
|
+
protected java.net.PasswordAuthentication getPasswordAuthentication()
|
|
208
|
+
{
|
|
209
|
+
return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
|
|
210
|
+
}
|
|
211
|
+
public static void main( String[] args ) throws Exception
|
|
212
|
+
{
|
|
213
|
+
setDefault( new Downloader() );
|
|
214
|
+
java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
END
|
|
218
|
+
# For Cygwin/MinGW, switch paths to Windows format before running javac and java
|
|
219
|
+
verbose " - Compiling Downloader.java ..."
|
|
220
|
+
"$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
|
|
221
|
+
verbose " - Running Downloader.java ..."
|
|
222
|
+
"$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
|
|
223
|
+
fi
|
|
224
|
+
|
|
225
|
+
# If specified, validate the SHA-256 sum of the Maven distribution zip file
|
|
226
|
+
if [ -n "${distributionSha256Sum-}" ]; then
|
|
227
|
+
distributionSha256Result=false
|
|
228
|
+
if [ "$MVN_CMD" = mvnd.sh ]; then
|
|
229
|
+
echo "Checksum validation is not supported for maven-mvnd." >&2
|
|
230
|
+
echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
|
|
231
|
+
exit 1
|
|
232
|
+
elif command -v sha256sum >/dev/null; then
|
|
233
|
+
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then
|
|
234
|
+
distributionSha256Result=true
|
|
235
|
+
fi
|
|
236
|
+
elif command -v shasum >/dev/null; then
|
|
237
|
+
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
|
|
238
|
+
distributionSha256Result=true
|
|
239
|
+
fi
|
|
240
|
+
else
|
|
241
|
+
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
|
|
242
|
+
echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
|
|
243
|
+
exit 1
|
|
244
|
+
fi
|
|
245
|
+
if [ $distributionSha256Result = false ]; then
|
|
246
|
+
echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
|
|
247
|
+
echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
|
|
248
|
+
exit 1
|
|
249
|
+
fi
|
|
250
|
+
fi
|
|
251
|
+
|
|
252
|
+
# unzip and move
|
|
253
|
+
if command -v unzip >/dev/null; then
|
|
254
|
+
unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
|
|
255
|
+
else
|
|
256
|
+
tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
|
|
257
|
+
fi
|
|
258
|
+
|
|
259
|
+
# Find the actual extracted directory name (handles snapshots where filename != directory name)
|
|
260
|
+
actualDistributionDir=""
|
|
261
|
+
|
|
262
|
+
# First try the expected directory name (for regular distributions)
|
|
263
|
+
if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then
|
|
264
|
+
if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then
|
|
265
|
+
actualDistributionDir="$distributionUrlNameMain"
|
|
266
|
+
fi
|
|
267
|
+
fi
|
|
268
|
+
|
|
269
|
+
# If not found, search for any directory with the Maven executable (for snapshots)
|
|
270
|
+
if [ -z "$actualDistributionDir" ]; then
|
|
271
|
+
# enable globbing to iterate over items
|
|
272
|
+
set +f
|
|
273
|
+
for dir in "$TMP_DOWNLOAD_DIR"/*; do
|
|
274
|
+
if [ -d "$dir" ]; then
|
|
275
|
+
if [ -f "$dir/bin/$MVN_CMD" ]; then
|
|
276
|
+
actualDistributionDir="$(basename "$dir")"
|
|
277
|
+
break
|
|
278
|
+
fi
|
|
279
|
+
fi
|
|
280
|
+
done
|
|
281
|
+
set -f
|
|
282
|
+
fi
|
|
283
|
+
|
|
284
|
+
if [ -z "$actualDistributionDir" ]; then
|
|
285
|
+
verbose "Contents of $TMP_DOWNLOAD_DIR:"
|
|
286
|
+
verbose "$(ls -la "$TMP_DOWNLOAD_DIR")"
|
|
287
|
+
die "Could not find Maven distribution directory in extracted archive"
|
|
288
|
+
fi
|
|
289
|
+
|
|
290
|
+
verbose "Found extracted Maven distribution directory: $actualDistributionDir"
|
|
291
|
+
printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url"
|
|
292
|
+
mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
|
|
293
|
+
|
|
294
|
+
clean || :
|
|
295
|
+
exec_maven "$@"
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
3
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
4
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
5
|
+
<modelVersion>4.0.0</modelVersion>
|
|
6
|
+
|
|
7
|
+
<groupId>{{JAVA_PACKAGE}}</groupId>
|
|
8
|
+
<artifactId>{{PACK_NAME}}</artifactId>
|
|
9
|
+
<version>{{PACK_VERSION}}</version>
|
|
10
|
+
<name>{{PACK_NAME}}</name>
|
|
11
|
+
<description>A Kindgi pack in Java: its tools, guardrail checks, agents and flows.</description>
|
|
12
|
+
|
|
13
|
+
<properties>
|
|
14
|
+
<maven.compiler.release>17</maven.compiler.release>
|
|
15
|
+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
16
|
+
<kindgi.version>{{KINDGI_JAVA_VERSION}}</kindgi.version>
|
|
17
|
+
</properties>
|
|
18
|
+
|
|
19
|
+
<dependencies>
|
|
20
|
+
<!-- Tools, guardrail checks, the indexer and the pack service. -->
|
|
21
|
+
<dependency>
|
|
22
|
+
<groupId>com.kindgi</groupId>
|
|
23
|
+
<artifactId>kindgi-pack</artifactId>
|
|
24
|
+
<version>${kindgi.version}</version>
|
|
25
|
+
</dependency>
|
|
26
|
+
<!-- Constraints on tool inputs (@Size, @Min, @Email, …) become their schemas' keywords. -->
|
|
27
|
+
<dependency>
|
|
28
|
+
<groupId>jakarta.validation</groupId>
|
|
29
|
+
<artifactId>jakarta.validation-api</artifactId>
|
|
30
|
+
<version>3.0.2</version>
|
|
31
|
+
</dependency>
|
|
32
|
+
|
|
33
|
+
<dependency>
|
|
34
|
+
<groupId>org.junit.jupiter</groupId>
|
|
35
|
+
<artifactId>junit-jupiter</artifactId>
|
|
36
|
+
<version>6.1.3</version>
|
|
37
|
+
<scope>test</scope>
|
|
38
|
+
</dependency>
|
|
39
|
+
</dependencies>
|
|
40
|
+
|
|
41
|
+
<build>
|
|
42
|
+
<plugins>
|
|
43
|
+
<plugin>
|
|
44
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
45
|
+
<artifactId>maven-resources-plugin</artifactId>
|
|
46
|
+
<version>3.5.0</version>
|
|
47
|
+
</plugin>
|
|
48
|
+
<plugin>
|
|
49
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
50
|
+
<artifactId>maven-compiler-plugin</artifactId>
|
|
51
|
+
<version>3.16.0</version>
|
|
52
|
+
</plugin>
|
|
53
|
+
<plugin>
|
|
54
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
55
|
+
<artifactId>maven-surefire-plugin</artifactId>
|
|
56
|
+
<version>3.6.0</version>
|
|
57
|
+
</plugin>
|
|
58
|
+
<plugin>
|
|
59
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
60
|
+
<artifactId>maven-dependency-plugin</artifactId>
|
|
61
|
+
<version>3.11.0</version>
|
|
62
|
+
</plugin>
|
|
63
|
+
</plugins>
|
|
64
|
+
</build>
|
|
65
|
+
</project>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
package {{JAVA_PACKAGE}}.agents;
|
|
2
|
+
|
|
3
|
+
import {{JAVA_PACKAGE}}.guardrails.ResponseNotEmpty;
|
|
4
|
+
import {{JAVA_PACKAGE}}.tools.Echo;
|
|
5
|
+
import {{JAVA_PACKAGE}}.tools.Greet;
|
|
6
|
+
import com.kindgi.pack.Agent;
|
|
7
|
+
import java.util.List;
|
|
8
|
+
import java.util.Map;
|
|
9
|
+
|
|
10
|
+
/** {{PACK_ID}}.echo-agent — uses both tools; the response-not-empty guardrail guards its answer. */
|
|
11
|
+
public final class EchoAgent {
|
|
12
|
+
public static final Agent AGENT = Agent.define("{{PACK_ID}}.echo-agent")
|
|
13
|
+
.version("{{PACK_VERSION}}")
|
|
14
|
+
.name("Echo Agent")
|
|
15
|
+
.description("Uses the pack's echo and greet tools; the response-not-empty guardrail guards the output.")
|
|
16
|
+
.instructions("For each user message: if the user sends a name, greet them with the greet tool. "
|
|
17
|
+
+ "Otherwise echo their message with the echo tool. Quote the tool result verbatim.")
|
|
18
|
+
.capability(Map.of("needs", List.of(Map.of("feature", "tool-use"))))
|
|
19
|
+
.tool(Echo.TOOL)
|
|
20
|
+
.tool(Greet.TOOL)
|
|
21
|
+
.guardrail(ResponseNotEmpty.GUARDRAIL)
|
|
22
|
+
.set("conversationPolicy", Map.of("historyLimit", 10))
|
|
23
|
+
.set("budget", Map.of("maxSteps", 4, "maxCostUsd", 0.1, "maxWallMs", 60_000))
|
|
24
|
+
.build();
|
|
25
|
+
|
|
26
|
+
private EchoAgent() {}
|
|
27
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
package {{JAVA_PACKAGE}}.flows;
|
|
2
|
+
|
|
3
|
+
import {{JAVA_PACKAGE}}.tools.Echo;
|
|
4
|
+
import com.kindgi.pack.Flow;
|
|
5
|
+
|
|
6
|
+
/** {{PACK_ID}}.echo-flow — runs the pack's echo tool, then ends. */
|
|
7
|
+
public final class EchoFlow {
|
|
8
|
+
public static final Flow FLOW = Flow.define("{{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
|
+
|
|
17
|
+
private EchoFlow() {}
|
|
18
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package {{JAVA_PACKAGE}}.guardrails;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
4
|
+
import com.kindgi.pack.CheckResult;
|
|
5
|
+
import com.kindgi.pack.Guardrail;
|
|
6
|
+
import jakarta.validation.constraints.Min;
|
|
7
|
+
import java.util.Map;
|
|
8
|
+
|
|
9
|
+
/** {{PACK_ID}}.response-not-empty — a zero-LLM guardrail: the run's answer has content. */
|
|
10
|
+
public final class ResponseNotEmpty {
|
|
11
|
+
public record Config(@JsonProperty(defaultValue = "1") @Min(0) int minLength) {}
|
|
12
|
+
|
|
13
|
+
public static final Guardrail<Config> GUARDRAIL = Guardrail.define("{{PACK_ID}}.response-not-empty")
|
|
14
|
+
.name("Response is non-empty")
|
|
15
|
+
.checkId("{{PACK_ID}}.checks.response-not-empty")
|
|
16
|
+
.onViolation("halt")
|
|
17
|
+
.severity("error")
|
|
18
|
+
.set("scope", Map.of("when", "runtime-only"))
|
|
19
|
+
.config(Config.class)
|
|
20
|
+
.check((config, trace) -> {
|
|
21
|
+
String text = trace.output() == null ? "" : trace.output().strip();
|
|
22
|
+
return text.length() >= config.minLength()
|
|
23
|
+
? CheckResult.pass()
|
|
24
|
+
: CheckResult.fail("Response too short: " + text.length() + " chars, expected >= " + config.minLength() + ".");
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
private ResponseNotEmpty() {}
|
|
28
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package {{JAVA_PACKAGE}}.tools;
|
|
2
|
+
|
|
3
|
+
import com.kindgi.pack.Tool;
|
|
4
|
+
import jakarta.validation.constraints.PositiveOrZero;
|
|
5
|
+
import jakarta.validation.constraints.Size;
|
|
6
|
+
import java.time.Instant;
|
|
7
|
+
|
|
8
|
+
/** {{PACK_ID}}.echo — echoes the message back with a UTC timestamp and its length. */
|
|
9
|
+
public final class Echo {
|
|
10
|
+
public record Input(@Size(min = 1, max = 500) String message) {}
|
|
11
|
+
|
|
12
|
+
public record Output(String echo, Instant echoedAt, @PositiveOrZero int characterCount) {}
|
|
13
|
+
|
|
14
|
+
public static final Tool<Input, Output> TOOL = Tool.define("{{PACK_ID}}.echo")
|
|
15
|
+
.description("Echoes the caller-provided message with a UTC timestamp and character count.")
|
|
16
|
+
.input(Input.class)
|
|
17
|
+
.output(Output.class)
|
|
18
|
+
.mutating(false)
|
|
19
|
+
.handler((input, ctx) -> new Output(input.message(), Instant.now(), input.message().length()));
|
|
20
|
+
|
|
21
|
+
private Echo() {}
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
package {{JAVA_PACKAGE}}.tools;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
4
|
+
import com.kindgi.pack.Tool;
|
|
5
|
+
import jakarta.validation.constraints.Size;
|
|
6
|
+
|
|
7
|
+
/** {{PACK_ID}}.greet — greets a named recipient. */
|
|
8
|
+
public final class Greet {
|
|
9
|
+
public record Input(
|
|
10
|
+
@Size(min = 1, max = 100) String name,
|
|
11
|
+
@JsonProperty(defaultValue = "Hello") @Size(min = 1, max = 50) String greeting) {}
|
|
12
|
+
|
|
13
|
+
public record Output(String message) {}
|
|
14
|
+
|
|
15
|
+
public static final Tool<Input, Output> TOOL = Tool.define("{{PACK_ID}}.greet")
|
|
16
|
+
.description("Formats a greeting for the named recipient.")
|
|
17
|
+
.input(Input.class)
|
|
18
|
+
.output(Output.class)
|
|
19
|
+
.mutating(false)
|
|
20
|
+
.handler((input, ctx) -> new Output(input.greeting() + ", " + input.name() + "!"));
|
|
21
|
+
|
|
22
|
+
private Greet() {}
|
|
23
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
package {{JAVA_PACKAGE}};
|
|
2
|
+
|
|
3
|
+
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
4
|
+
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
5
|
+
|
|
6
|
+
import {{JAVA_PACKAGE}}.tools.Echo;
|
|
7
|
+
import {{JAVA_PACKAGE}}.tools.Greet;
|
|
8
|
+
import com.kindgi.pack.ToolContext;
|
|
9
|
+
import org.junit.jupiter.api.Test;
|
|
10
|
+
|
|
11
|
+
/** The pack's tools, called directly — `./mvnw test`. */
|
|
12
|
+
class ToolsTest {
|
|
13
|
+
@Test
|
|
14
|
+
void echoRoundTripsTheMessage() throws Exception {
|
|
15
|
+
Echo.Output out = Echo.TOOL.call(new Echo.Input("hello"), ToolContext.forTest());
|
|
16
|
+
assertEquals("hello", out.echo());
|
|
17
|
+
assertEquals(5, out.characterCount());
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@Test
|
|
21
|
+
void greetUsesTheGreetingItIsGiven() throws Exception {
|
|
22
|
+
assertEquals("Hi, Ada!", Greet.TOOL.call(new Greet.Input("Ada", "Hi"), ToolContext.forTest()).message());
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@Test
|
|
26
|
+
void theToolsSayTheyOnlyRead() {
|
|
27
|
+
assertFalse(Echo.TOOL.mutating());
|
|
28
|
+
assertFalse(Greet.TOOL.mutating());
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -34,16 +34,16 @@ assistant in the loop.
|
|
|
34
34
|
## Run
|
|
35
35
|
|
|
36
36
|
```sh
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
{{INSTALL}}
|
|
38
|
+
{{TYPECHECK}} # verify the pack compiles
|
|
39
|
+
{{KINDGI}} dev # runs the Kindgi runtime (Docker) + hot-reloads this pack
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
The api-server ships with a built-in `demo.echo-agent` you can hit to
|
|
43
43
|
verify boot before authoring anything:
|
|
44
44
|
|
|
45
45
|
```sh
|
|
46
|
-
|
|
46
|
+
{{KINDGI}} runs start --agent=demo.echo-agent --input='{"userMessage":"hi"}'
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
## Use a real model
|
|
@@ -55,8 +55,8 @@ use a real model, set one LLM provider's key and register its preset, with
|
|
|
55
55
|
`kindgi dev` running, from another terminal. For Claude:
|
|
56
56
|
|
|
57
57
|
```sh
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
{{KINDGI}} secrets set ANTHROPIC_API_KEY --env=local --scope=tenant # no-echo prompt; writes .env.local
|
|
59
|
+
{{KINDGI}} providers register --preset=anthropic # Opus 5.5, Sonnet 5.5 (default), Haiku 5.5, Haiku 4.5
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
Claude takes over from dev-echo on the next turn; nothing to restart.
|
|
@@ -67,9 +67,3 @@ OpenRouter, a hosted service your prompts pass through (`OPENROUTER_API_KEY`,
|
|
|
67
67
|
`--preset=openrouter`), work the same way; `kindgi providers presets` lists
|
|
68
68
|
the presets (Gemini on Vertex AI too). Picking a model per
|
|
69
69
|
agent, and other providers: `.claude/skills/kindgi-authoring-providers/SKILL.md`.
|
|
70
|
-
|
|
71
|
-
## Note on `@kindgi/sdk` versioning
|
|
72
|
-
|
|
73
|
-
This template pins `@kindgi/sdk: "workspace:*"` because the SDK is not
|
|
74
|
-
yet published to npm. Until it is, add the pack to a pnpm workspace that
|
|
75
|
-
contains the Kindgi packages (`pnpm-workspace.yaml`).
|
|
@@ -23,14 +23,14 @@ that uses both tools and the guardrail, and one flow that runs the echo tool.
|
|
|
23
23
|
```sh
|
|
24
24
|
uv sync # .venv with kindgi and the dev tools
|
|
25
25
|
uv run pytest
|
|
26
|
-
|
|
26
|
+
{{KINDGI}} dev # boots Kindgi locally and runs this pack's code, reloading on save
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
`kindgi dev` uses the pack's `.venv/bin/python` (or `dev.python` in
|
|
30
30
|
`[tool.kindgi]`). Then, from another terminal:
|
|
31
31
|
|
|
32
32
|
```sh
|
|
33
|
-
|
|
33
|
+
{{KINDGI}} runs start --agent={{PACK_ID}}.echo-agent --input='{"userMessage":"hi"}'
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
## Use a real model
|
|
@@ -42,8 +42,8 @@ use a real model, set one LLM provider's key and register its preset, with
|
|
|
42
42
|
`kindgi dev` running, from another terminal. For Claude:
|
|
43
43
|
|
|
44
44
|
```sh
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
{{KINDGI}} secrets set ANTHROPIC_API_KEY --env=local --scope=tenant # no-echo prompt; writes .env.local
|
|
46
|
+
{{KINDGI}} providers register --preset=anthropic # Opus 5.5, Sonnet 5.5 (default), Haiku 5.5, Haiku 4.5
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
Claude takes over from dev-echo on the next turn; nothing to restart.
|
|
@@ -28,9 +28,9 @@ run with `kindgi dev`.
|
|
|
28
28
|
## Run
|
|
29
29
|
|
|
30
30
|
```sh
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
{{INSTALL}}
|
|
32
|
+
{{TYPECHECK}} # verify the pack compiles
|
|
33
|
+
{{KINDGI}} dev # runs the Kindgi runtime (Docker) + hot-reloads this pack
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
`kindgi dev` bundles every primitive under the four folders above,
|
|
@@ -47,8 +47,8 @@ use a real model, set one LLM provider's key and register its preset, with
|
|
|
47
47
|
`kindgi dev` running, from another terminal. For Claude:
|
|
48
48
|
|
|
49
49
|
```sh
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
{{KINDGI}} secrets set ANTHROPIC_API_KEY --env=local --scope=tenant # no-echo prompt; writes .env.local
|
|
51
|
+
{{KINDGI}} providers register --preset=anthropic # Opus 5.5, Sonnet 5.5 (default), Haiku 5.5, Haiku 4.5
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
Claude takes over from dev-echo on the next turn; nothing to restart.
|
|
@@ -83,9 +83,3 @@ import { z } from 'zod';
|
|
|
83
83
|
|
|
84
84
|
Every `define*` export ships with JSDoc — hover it in your editor for
|
|
85
85
|
field-level docs.
|
|
86
|
-
|
|
87
|
-
## Note on `@kindgi/sdk` versioning
|
|
88
|
-
|
|
89
|
-
This template pins `@kindgi/sdk: "workspace:*"` because the SDK is not
|
|
90
|
-
yet published to npm. Until it is, add the pack to a pnpm workspace that
|
|
91
|
-
contains the Kindgi packages (`pnpm-workspace.yaml`).
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
This directory is a Kindgi pack written in Scala (`com.kindgi %% kindgi-pack-scala`,
|
|
4
|
+
package `com.kindgi.pack.scaladsl`). Tools (`Tool[Input, Output](id)`) and
|
|
5
|
+
guardrail checks (`Guardrail[Config](id)`) are `val`s of an object named like
|
|
6
|
+
its file, under `src/main/scala/**/tools/` and `…/guardrails/`; agents
|
|
7
|
+
(`Agent(id)`) and flows (`Flow(id)`) are data, under `…/agents/` and
|
|
8
|
+
`…/flows/`. A tool's input and output schemas come from its case classes:
|
|
9
|
+
`Option` is optional, a parameter's default is the schema's default, Jakarta
|
|
10
|
+
Validation constraints become their keywords (in Scala 3, name their arguments:
|
|
11
|
+
`@Min(value = 0)`). A tool defined as a `def` or a `lazy val` isn't indexed:
|
|
12
|
+
make it a `val`. The config is `kindgi.config.json`.
|
|
13
|
+
|
|
14
|
+
- `./kindgiw dev` boots Kindgi locally, compiles this pack through sbt's server
|
|
15
|
+
and runs it with its JDK (17 or later), recompiling on every save.
|
|
16
|
+
- `sbt test` runs the tests; `tool.call(input, ToolContext.forTest())` calls a
|
|
17
|
+
handler directly.
|
|
18
|
+
- `java -cp "$(sbt -batch -error 'export Runtime/fullClasspath')" com.kindgi.pack.Main index --pack-dir .`
|
|
19
|
+
shows what Kindgi sees.
|
|
20
|
+
- Agents answer through a model provider. `kindgi dev` gives a new pack
|
|
21
|
+
`dev-echo`, a fallback that isn't a model: it calls the first tool and
|
|
22
|
+
replies "Tool responded: …" after a warning line, while no other provider
|
|
23
|
+
fits. For a real model, put one LLM provider's key in `.env`
|
|
24
|
+
(`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, `GROQ_API_KEY` or
|
|
25
|
+
`OPENROUTER_API_KEY`) and add a `providers` list with its preset
|
|
26
|
+
(`[{"preset": "anthropic"}]`, or `"openai"`, `"gemini-api"`, `"groq"`,
|
|
27
|
+
`"openrouter"`) to `kindgi.config.json`: `kindgi dev` then registers it on
|
|
28
|
+
every boot, in every worktree.
|
|
29
|
+
|
|
30
|
+
When you diagnose a framework bug (something in Kindgi itself, not in this
|
|
31
|
+
pack's code), append an entry to `FEEDBACK.md` at the pack root with
|
|
32
|
+
`./kindgiw feedback write`.
|