@kohala/devkit 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # @kohala/devkit
2
2
 
3
+ ## 0.1.1 (unreleased)
4
+
5
+ Bug fixes.
6
+
7
+ - **Default models updated to match the hosted platform** (BUG-040).
8
+ Local llm-mode now defaults to `claude-sonnet-4-6` (Anthropic) and
9
+ `gemini-flash-latest` (Gemini) — the same models the platform runs — so
10
+ cap tuning and output behaviour carry over after `kohala deploy`. Override
11
+ locally with `ANTHROPIC_MODEL`, `GEMINI_MODEL`, or `KOHALA_LLM_MODEL`.
12
+
13
+ - **Default Gemini model changed from `gemini-2.0-flash` to
14
+ `gemini-flash-latest`** (BUG-041). The previous default hit quota limits
15
+ on new free-tier Gemini keys; the new default works on fresh keys.
16
+ Override with `GEMINI_MODEL` or `KOHALA_LLM_MODEL`.
17
+
18
+ - **`kohala doctor` now correctly distinguishes llm-mode availability from
19
+ `llm.complete` availability** (BUG-042). `GEMINI_API_KEY` enables
20
+ `llm.complete` in wrap-mode skills but not the llm-mode tool-use loop
21
+ (which requires `ANTHROPIC_API_KEY`). The doctor now reports each case
22
+ separately so the output matches what actually works.
23
+
24
+ - **`kohala run` error message is now specific when `runtimeMode: "llm"` is
25
+ used without an Anthropic key** (BUG-042). The previous message suggested
26
+ that `GEMINI_API_KEY` would work; the new message explains the distinction.
27
+
28
+ - **`docs/` and `examples/` included in the published tarball** (BUG-034).
29
+ The README links to both; they now ship inside the package so installed
30
+ users can read them without cloning the repository.
31
+
32
+ - **`kohala memory serve` documentation clarified** (BUG-035). The command
33
+ requires either `--agent <name>` or to be run from inside an agent
34
+ directory. The docs now show both forms.
35
+
3
36
  ## 0.1.0
4
37
 
5
38
  Initial release.
@@ -13,3 +46,9 @@ Initial release.
13
46
  - Stdlib-only Python script SDK over a loopback RPC boundary
14
47
  - Deploy client for the kohala.ai REST API (idempotent, additive,
15
48
  `--dry-run`)
49
+
50
+ ### SDK compatibility note (BUG-015)
51
+
52
+ 0.1.0 was released against `@kohala/sdk` 0.1.x. The SDK published 0.2.0 on
53
+ 2026-07-20 with updated method signatures. The emulator and deploy client
54
+ work against any SDK version; this note tracks awareness of the divergence.
@@ -0,0 +1,37 @@
1
+ # Code of Conduct
2
+
3
+ ## Our pledge
4
+
5
+ We as members, contributors, and maintainers pledge to make participation in
6
+ the Kohala Devkit project a harassment-free experience for everyone,
7
+ regardless of age, body size, visible or invisible disability, ethnicity, sex
8
+ characteristics, gender identity and expression, level of experience,
9
+ education, socio-economic status, nationality, personal appearance, race,
10
+ religion, or sexual identity and orientation.
11
+
12
+ ## Our standards
13
+
14
+ Examples of behavior that contributes to a positive environment:
15
+
16
+ - Being respectful of differing opinions, viewpoints, and experiences
17
+ - Giving and gracefully accepting constructive feedback
18
+ - Focusing on what is best for the community and the project
19
+
20
+ Examples of unacceptable behavior:
21
+
22
+ - Harassment, trolling, insulting or derogatory comments, personal attacks
23
+ - Publishing others' private information without explicit permission
24
+ - Other conduct which could reasonably be considered inappropriate in a
25
+ professional setting
26
+
27
+ ## Enforcement
28
+
29
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
30
+ reported to the maintainers at conduct@kohala.ai. All complaints will be
31
+ reviewed and investigated promptly and fairly. Maintainers are obligated to
32
+ respect the privacy and security of the reporter of any incident.
33
+
34
+ ## Attribution
35
+
36
+ This Code of Conduct is adapted from the
37
+ [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
@@ -0,0 +1,53 @@
1
+ # Contributing to the Kohala Devkit
2
+
3
+ Thanks for helping! The devkit is deliberately small and boring — please keep
4
+ it that way.
5
+
6
+ ## Setup
7
+
8
+ ```bash
9
+ git clone https://github.com/kohala-ai/devkit
10
+ cd devkit
11
+ npm install # or pnpm install
12
+ npm run build
13
+ node dist/cli/index.js --version
14
+ ```
15
+
16
+ Python 3 must be on your PATH to run the end-to-end tests.
17
+
18
+ ## Development loop
19
+
20
+ ```bash
21
+ npm run typecheck # strict tsc, no emit
22
+ npm run lint # eslint
23
+ npm test # vitest (unit + CLI e2e)
24
+ npm run build # tsup -> dist/
25
+ ```
26
+
27
+ ## Ground rules
28
+
29
+ - **Errors fail loudly.** No silent fallbacks, no mock LLM responses, no
30
+ swallowed exceptions. If something can't work, say so with an actionable
31
+ message.
32
+ - **Platform parity is the product.** Tool names, manifest fields, cap codes
33
+ (`PER_RUN_TOKEN_CAP`, `PER_DAY_TOKEN_CAP`, `TOOL_DENIED`), and enforcement
34
+ order must match the hosted platform. Don't rename things casually.
35
+ - **Dependency budget.** Runtime deps are limited to: commander, zod,
36
+ @modelcontextprotocol/sdk, execa, picocolors, ora. `pg` stays an optional
37
+ peer. New runtime dependencies need a strong justification in the PR.
38
+ - **The Python SDK stays stdlib-only.** Scaffolded agents must run without a
39
+ single `pip install`.
40
+ - Keep CLI command files thin; put behavior in the library modules where it
41
+ can be unit-tested.
42
+
43
+ ## Submitting changes
44
+
45
+ 1. Fork, branch, make the change, add/adjust tests.
46
+ 2. Add a changeset: `npx changeset` (pick patch/minor and write one line).
47
+ 3. Open a PR. CI runs typecheck, lint, tests, and build on Node 20 and 22.
48
+
49
+ ## Releases
50
+
51
+ Releases are automated with [changesets](https://github.com/changesets/changesets):
52
+ merged changesets accumulate, and the release workflow versions, tags, and
53
+ publishes to npm.
package/README.md CHANGED
@@ -55,9 +55,11 @@ skill scripts).
55
55
  ```
56
56
 
57
57
  - `runtimeMode: "wrap"` executes your script directly and validates its
58
- output (stdout).
59
- - `runtimeMode: "llm"` runs a real tool-use loop against **your own**
60
- `ANTHROPIC_API_KEY` the devkit never mocks completions.
58
+ output (stdout). Use `llm.complete` from the script SDK to call an LLM
59
+ mid-script (needs `ANTHROPIC_API_KEY` or `GEMINI_API_KEY`).
60
+ - `runtimeMode: "llm"` runs a real Anthropic tool-use loop — requires
61
+ `ANTHROPIC_API_KEY`. `GEMINI_API_KEY` works for `llm.complete` in wrap
62
+ mode but not for this loop. The devkit never mocks completions.
61
63
 
62
64
  ## Docs
63
65
 
package/SECURITY.md ADDED
@@ -0,0 +1,28 @@
1
+ # Security Policy
2
+
3
+ ## Supported versions
4
+
5
+ Only the latest published version of `@kohala/devkit` receives security
6
+ fixes.
7
+
8
+ ## Reporting a vulnerability
9
+
10
+ Please email **security@kohala.ai** with a description of the issue, steps to
11
+ reproduce, and the version affected. Do **not** open a public GitHub issue
12
+ for security reports.
13
+
14
+ We aim to acknowledge reports within 3 business days.
15
+
16
+ ## Scope notes
17
+
18
+ - The devkit runs agent scripts **you** wrote on **your** machine, with your
19
+ own credentials. It does not sandbox skill scripts — treat third-party
20
+ agent code like any other code you execute locally.
21
+ - The `http.post_json` tool refuses private/internal targets: it validates
22
+ the hostname, every IP it resolves to (IPv4 and IPv6, including
23
+ IPv4-mapped, link-local, ULA, and CGNAT ranges), and re-validates each
24
+ redirect hop. A determined attacker with DNS rebinding at request time may
25
+ still find gaps — do not treat it as a hardened network boundary.
26
+ - `kohala login` stores your API key at `~/.kohala/credentials.json` with
27
+ mode 600. The `KOHALA_API_KEY` environment variable always takes
28
+ precedence and is the recommended mechanism in CI.
package/dist/cli/index.js CHANGED
@@ -725,8 +725,8 @@ var NoLlmKeyError = class extends Error {
725
725
  this.name = "NoLlmKeyError";
726
726
  }
727
727
  };
728
- var DEFAULT_ANTHROPIC_MODEL = "claude-3-5-haiku-latest";
729
- var DEFAULT_GEMINI_MODEL = "gemini-2.0-flash";
728
+ var DEFAULT_ANTHROPIC_MODEL = "claude-sonnet-4-6";
729
+ var DEFAULT_GEMINI_MODEL = "gemini-flash-latest";
730
730
  function detectLlmProvider(env = process.env) {
731
731
  if (env.ANTHROPIC_API_KEY) return "anthropic";
732
732
  if (env.GEMINI_API_KEY) return "gemini";
@@ -735,10 +735,12 @@ function detectLlmProvider(env = process.env) {
735
735
  async function completeText(prompt, model, maxOutputTokens = 1024, env = process.env) {
736
736
  const provider = detectLlmProvider(env);
737
737
  if (provider === "anthropic") {
738
- return completeAnthropic(prompt, model ?? DEFAULT_ANTHROPIC_MODEL, maxOutputTokens, env);
738
+ const resolvedModel = model ?? env.KOHALA_LLM_MODEL ?? env.ANTHROPIC_MODEL ?? DEFAULT_ANTHROPIC_MODEL;
739
+ return completeAnthropic(prompt, resolvedModel, maxOutputTokens, env);
739
740
  }
740
741
  if (provider === "gemini") {
741
- return completeGemini(prompt, model ?? DEFAULT_GEMINI_MODEL, maxOutputTokens, env);
742
+ const resolvedModel = model ?? env.KOHALA_LLM_MODEL ?? env.GEMINI_MODEL ?? DEFAULT_GEMINI_MODEL;
743
+ return completeGemini(prompt, resolvedModel, maxOutputTokens, env);
742
744
  }
743
745
  throw new NoLlmKeyError();
744
746
  }
@@ -1211,9 +1213,11 @@ var TOOL_DEFINITIONS = {
1211
1213
  async function runLlmShift(context, skillName, scriptPath, repairFeedback) {
1212
1214
  const apiKey = process.env.ANTHROPIC_API_KEY;
1213
1215
  if (!apiKey) {
1214
- throw new NoLlmKeyError();
1216
+ throw new Error(
1217
+ 'NO_LLM_KEY: llm mode requires ANTHROPIC_API_KEY. GEMINI_API_KEY enables llm.complete calls inside wrap-mode skills, but the llm-mode tool-use loop only supports Anthropic. Set ANTHROPIC_API_KEY in your environment to use runtimeMode: "llm".'
1218
+ );
1215
1219
  }
1216
- const model = process.env.KOHALA_LLM_MODEL ?? "claude-3-5-haiku-latest";
1220
+ const model = process.env.KOHALA_LLM_MODEL ?? process.env.ANTHROPIC_MODEL ?? "claude-sonnet-4-6";
1217
1221
  const dispatcher = new ToolDispatcher(context);
1218
1222
  const { manifest, meter, trace, runId } = context;
1219
1223
  const tools = Object.entries(TOOL_DEFINITIONS).filter(([name]) => manifest.toolAllowlist.includes(name)).map(([name, definition]) => ({ name: toApiToolName(name), ...definition }));
@@ -2198,8 +2202,15 @@ function registerDoctorCommand(program2) {
2198
2202
  warn("python 3 not found", "wrap-mode `kohala run --local` will not work until installed");
2199
2203
  }
2200
2204
  const provider = detectLlmProvider();
2201
- if (provider) {
2202
- ok(`LLM key (${provider})`, "llm.complete and llm mode available");
2205
+ const hasAnthropic = Boolean(process.env.ANTHROPIC_API_KEY);
2206
+ if (hasAnthropic) {
2207
+ ok("LLM key (anthropic)", "llm.complete and llm mode both available");
2208
+ } else if (provider === "gemini") {
2209
+ ok("LLM key (gemini)", "llm.complete available in wrap mode");
2210
+ warn(
2211
+ "no ANTHROPIC_API_KEY",
2212
+ 'llm mode (runtimeMode: "llm") requires Anthropic \u2014 GEMINI_API_KEY covers llm.complete only'
2213
+ );
2203
2214
  } else {
2204
2215
  warn(
2205
2216
  "no ANTHROPIC_API_KEY / GEMINI_API_KEY",