@kody-ade/kody-engine 0.4.634 → 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.
Files changed (2) hide show
  1. package/dist/bin/kody.js +28 -3
  2. package/package.json +1 -1
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.634",
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";
@@ -4415,6 +4436,7 @@ async function runAgent(opts) {
4415
4436
  const missingParentWriteGuard = createMissingParentWriteGuard(opts.cwd);
4416
4437
  const outputContractPostWriteHook = opts.outputContract ? createOutputContractPostWriteHook(opts.outputContract) : null;
4417
4438
  const outputContractStopHook = opts.outputContract ? createOutputContractStopHook(opts.outputContract) : null;
4439
+ const submitStateStopHook = opts.enableSubmitTool ? createSubmitStateStopHook(() => getSubmitted?.()) : null;
4418
4440
  let finalSafeToReplay = true;
4419
4441
  for (let attempt = 0; ; attempt++) {
4420
4442
  let ndjsonWriteFailed = false;
@@ -4479,10 +4501,12 @@ async function runAgent(opts) {
4479
4501
  }
4480
4502
  ] : []
4481
4503
  ],
4482
- ...outputContractStopHook ? {
4504
+ ...outputContractStopHook || submitStateStopHook ? {
4483
4505
  Stop: [
4484
4506
  {
4485
- hooks: [outputContractStopHook]
4507
+ hooks: [outputContractStopHook, submitStateStopHook].filter(
4508
+ (hook) => hook !== null
4509
+ )
4486
4510
  }
4487
4511
  ]
4488
4512
  } : {}
@@ -4840,6 +4864,7 @@ var init_agent = __esm({
4840
4864
  "use strict";
4841
4865
  init_claudeBinary();
4842
4866
  init_completionGuard();
4867
+ init_submitStateGuard();
4843
4868
  init_config();
4844
4869
  init_fileEditGuards();
4845
4870
  init_format();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.634",
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": {