@kody-ade/kody-engine 0.4.636 → 0.4.637

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 +15 -2
  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.636",
18
+ version: "0.4.637",
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: {
@@ -181,6 +181,12 @@ var init_completionGuard = __esm({
181
181
  });
182
182
 
183
183
  // src/submitStateGuard.ts
184
+ function createPostSubmitToolGuard(getSubmitted) {
185
+ return async () => getSubmitted() ? {
186
+ decision: "block",
187
+ reason: STATE_ALREADY_SUBMITTED_REASON
188
+ } : {};
189
+ }
184
190
  function createSubmitStateStopHook(getSubmitted) {
185
191
  let finalChanceGiven = false;
186
192
  return async () => {
@@ -193,11 +199,12 @@ function createSubmitStateStopHook(getSubmitted) {
193
199
  };
194
200
  };
195
201
  }
196
- var FINAL_STATE_CHANCE_REASON;
202
+ var FINAL_STATE_CHANCE_REASON, STATE_ALREADY_SUBMITTED_REASON;
197
203
  var init_submitStateGuard = __esm({
198
204
  "src/submitStateGuard.ts"() {
199
205
  "use strict";
200
206
  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.";
207
+ STATE_ALREADY_SUBMITTED_REASON = "Continuation state is already submitted for this cycle. Do not call more tools or perform more work; return your final response now.";
201
208
  }
202
209
  });
203
210
 
@@ -4437,6 +4444,7 @@ async function runAgent(opts) {
4437
4444
  const outputContractPostWriteHook = opts.outputContract ? createOutputContractPostWriteHook(opts.outputContract) : null;
4438
4445
  const outputContractStopHook = opts.outputContract ? createOutputContractStopHook(opts.outputContract) : null;
4439
4446
  const submitStateStopHook = opts.enableSubmitTool ? createSubmitStateStopHook(() => getSubmitted?.()) : null;
4447
+ const postSubmitToolGuard = opts.enableSubmitTool ? createPostSubmitToolGuard(() => getSubmitted?.()) : null;
4440
4448
  let finalSafeToReplay = true;
4441
4449
  for (let attempt = 0; ; attempt++) {
4442
4450
  let ndjsonWriteFailed = false;
@@ -4475,6 +4483,11 @@ async function runAgent(opts) {
4475
4483
  env,
4476
4484
  hooks: {
4477
4485
  PreToolUse: [
4486
+ ...postSubmitToolGuard ? [
4487
+ {
4488
+ hooks: [postSubmitToolGuard]
4489
+ }
4490
+ ] : [],
4478
4491
  ...completionGuard ? [
4479
4492
  {
4480
4493
  hooks: [completionGuard]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.636",
3
+ "version": "0.4.637",
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": {