@kody-ade/kody-engine 0.4.633 → 0.4.635

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/dist/bin/kody.js CHANGED
@@ -15,7 +15,7 @@ var init_package = __esm({
15
15
  "package.json"() {
16
16
  package_default = {
17
17
  name: "@kody-ade/kody-engine",
18
- version: "0.4.633",
18
+ version: "0.4.635",
19
19
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative implementation profiles.",
20
20
  license: "MIT",
21
21
  repository: {
@@ -180,6 +180,27 @@ var init_completionGuard = __esm({
180
180
  }
181
181
  });
182
182
 
183
+ // src/submitStateGuard.ts
184
+ function createSubmitStateStopHook(getSubmitted) {
185
+ let finalChanceGiven = false;
186
+ return async () => {
187
+ if (getSubmitted()) return {};
188
+ if (finalChanceGiven) return {};
189
+ finalChanceGiven = true;
190
+ return {
191
+ decision: "block",
192
+ reason: FINAL_STATE_CHANCE_REASON
193
+ };
194
+ };
195
+ }
196
+ var FINAL_STATE_CHANCE_REASON;
197
+ var init_submitStateGuard = __esm({
198
+ "src/submitStateGuard.ts"() {
199
+ "use strict";
200
+ FINAL_STATE_CHANCE_REASON = "Before finishing, call `submit_state` exactly once with the next non-empty `cursor`, compact durable `data`, and the correct `done` value. Do not perform more work; submit only the continuation state now.";
201
+ }
202
+ });
203
+
183
204
  // src/config.ts
184
205
  import * as fs2 from "fs";
185
206
  import * as path3 from "path";
@@ -323,6 +344,7 @@ function loadConfig(projectDir = process.cwd()) {
323
344
  throw new Error(`kody.config.json: github.owner and github.repo are required`);
324
345
  }
325
346
  const automaticModels = parseAutomaticModels(agent.automaticModels);
347
+ const modelConfig = agent.modelConfig ? parseModelRuntimeConfig(String(agent.model), JSON.stringify(agent.modelConfig)) : void 0;
326
348
  if (agent.model === "automatic" && (!automaticModels || automaticModels.length < 2)) {
327
349
  throw new Error("kody.config.json: Automatic requires at least two agent.automaticModels");
328
350
  }
@@ -343,6 +365,7 @@ function loadConfig(projectDir = process.cwd()) {
343
365
  },
344
366
  agent: {
345
367
  model: String(agent.model),
368
+ ...modelConfig ? { modelConfig } : {},
346
369
  ...automaticModels ? { automaticModels } : {},
347
370
  ...parsePerImplementation(agent.perImplementation),
348
371
  ...parsePerImplementationReasoningEffort(agent.perImplementationReasoningEffort),
@@ -4413,6 +4436,7 @@ async function runAgent(opts) {
4413
4436
  const missingParentWriteGuard = createMissingParentWriteGuard(opts.cwd);
4414
4437
  const outputContractPostWriteHook = opts.outputContract ? createOutputContractPostWriteHook(opts.outputContract) : null;
4415
4438
  const outputContractStopHook = opts.outputContract ? createOutputContractStopHook(opts.outputContract) : null;
4439
+ const submitStateStopHook = opts.enableSubmitTool ? createSubmitStateStopHook(() => getSubmitted?.()) : null;
4416
4440
  let finalSafeToReplay = true;
4417
4441
  for (let attempt = 0; ; attempt++) {
4418
4442
  let ndjsonWriteFailed = false;
@@ -4477,10 +4501,12 @@ async function runAgent(opts) {
4477
4501
  }
4478
4502
  ] : []
4479
4503
  ],
4480
- ...outputContractStopHook ? {
4504
+ ...outputContractStopHook || submitStateStopHook ? {
4481
4505
  Stop: [
4482
4506
  {
4483
- hooks: [outputContractStopHook]
4507
+ hooks: [outputContractStopHook, submitStateStopHook].filter(
4508
+ (hook) => hook !== null
4509
+ )
4484
4510
  }
4485
4511
  ]
4486
4512
  } : {}
@@ -4838,6 +4864,7 @@ var init_agent = __esm({
4838
4864
  "use strict";
4839
4865
  init_claudeBinary();
4840
4866
  init_completionGuard();
4867
+ init_submitStateGuard();
4841
4868
  init_config();
4842
4869
  init_fileEditGuards();
4843
4870
  init_format();
@@ -23116,7 +23143,9 @@ async function runImplementation(profileName, input) {
23116
23143
  const reasoningEffort = config.agent.perImplementationReasoningEffort?.[profileName] ?? profile.claudeCode.reasoningEffort ?? (profileHasThinkingTokens ? void 0 : config.agent.reasoningEffort);
23117
23144
  let modelCandidates;
23118
23145
  try {
23119
- modelCandidates = modelSpec === "automatic" ? config.agent.automaticModels ?? [] : [parseProviderModel(modelSpec)];
23146
+ modelCandidates = modelSpec === "automatic" ? config.agent.automaticModels ?? [] : [
23147
+ modelSpec === config.agent.model && config.agent.modelConfig ? config.agent.modelConfig : parseProviderModel(modelSpec)
23148
+ ];
23120
23149
  if (modelCandidates.length === 0) throw new Error("Automatic has no configured models");
23121
23150
  } catch (err) {
23122
23151
  return finishAndEnd({
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.633",
3
+ "version": "0.4.635",
4
4
  "description": "kody — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative implementation profiles.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -17,30 +17,6 @@
17
17
  "docs/delivery-boundary.md",
18
18
  "kody.config.schema.json"
19
19
  ],
20
- "scripts": {
21
- "kody:run": "tsx bin/kody.ts",
22
- "serve": "tsx bin/kody.ts serve",
23
- "serve:vscode": "tsx bin/kody.ts serve vscode",
24
- "serve:claude": "tsx bin/kody.ts serve claude",
25
- "clean:dist": "node scripts/clean-dist.cjs",
26
- "build": "pnpm clean:dist && tsup && node scripts/copy-assets.cjs",
27
- "check:modularity": "tsx scripts/check-script-modularity.ts",
28
- "pretest": "pnpm check:modularity",
29
- "test": "vitest run tests/unit tests/int --coverage",
30
- "posttest": "tsx scripts/check-coverage-floor.ts",
31
- "test:smoke": "vitest run tests/smoke --no-coverage",
32
- "test:e2e": "vitest run tests/e2e --no-coverage",
33
- "verify:live-release": "tsx scripts/live-release-gate.ts",
34
- "test:runtime-services": "node --test \"tests/runtime-services/*.test.mjs\"",
35
- "test:all": "vitest run tests --no-coverage",
36
- "typecheck": "tsc --noEmit",
37
- "lint": "biome check",
38
- "lint:fix": "biome check --write",
39
- "format": "biome format --write",
40
- "verify:package": "node scripts/verify-package-tarball.cjs",
41
- "brain:publish": "docker buildx build --platform linux/amd64 -f runner/Dockerfile.brain --build-arg KODY_ENGINE_REF=$(git rev-parse HEAD) -t ghcr.io/${KODY_BRAIN_GHCR_OWNER:-aharonyaircohen}/kody-brain:latest --push runner",
42
- "prepublishOnly": "pnpm typecheck && pnpm test:runtime-services && pnpm build && pnpm verify:package"
43
- },
44
20
  "dependencies": {
45
21
  "@actions/cache": "^6.0.0",
46
22
  "@anthropic-ai/claude-agent-sdk": "0.2.119",
@@ -63,5 +39,28 @@
63
39
  "node": ">=22"
64
40
  },
65
41
  "homepage": "https://github.com/aharonyaircohen/kody-engine",
66
- "bugs": "https://github.com/aharonyaircohen/kody-engine/issues"
67
- }
42
+ "bugs": "https://github.com/aharonyaircohen/kody-engine/issues",
43
+ "scripts": {
44
+ "kody:run": "tsx bin/kody.ts",
45
+ "serve": "tsx bin/kody.ts serve",
46
+ "serve:vscode": "tsx bin/kody.ts serve vscode",
47
+ "serve:claude": "tsx bin/kody.ts serve claude",
48
+ "clean:dist": "node scripts/clean-dist.cjs",
49
+ "build": "pnpm clean:dist && tsup && node scripts/copy-assets.cjs",
50
+ "check:modularity": "tsx scripts/check-script-modularity.ts",
51
+ "pretest": "pnpm check:modularity",
52
+ "test": "vitest run tests/unit tests/int --coverage",
53
+ "posttest": "tsx scripts/check-coverage-floor.ts",
54
+ "test:smoke": "vitest run tests/smoke --no-coverage",
55
+ "test:e2e": "vitest run tests/e2e --no-coverage",
56
+ "verify:live-release": "tsx scripts/live-release-gate.ts",
57
+ "test:runtime-services": "node --test \"tests/runtime-services/*.test.mjs\"",
58
+ "test:all": "vitest run tests --no-coverage",
59
+ "typecheck": "tsc --noEmit",
60
+ "lint": "biome check",
61
+ "lint:fix": "biome check --write",
62
+ "format": "biome format --write",
63
+ "verify:package": "node scripts/verify-package-tarball.cjs",
64
+ "brain:publish": "docker buildx build --platform linux/amd64 -f runner/Dockerfile.brain --build-arg KODY_ENGINE_REF=$(git rev-parse HEAD) -t ghcr.io/${KODY_BRAIN_GHCR_OWNER:-aharonyaircohen}/kody-brain:latest --push runner"
65
+ }
66
+ }