@kody-ade/kody-engine 0.4.635 → 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 +22 -4
  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.635",
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]
@@ -21296,19 +21309,24 @@ var init_saveLiveAgentState = __esm({
21296
21309
  const repo = ctx.config.github?.repo?.trim() || envRepo;
21297
21310
  if (!owner || !repo) throw new Error("Repository identity is required for live Agent state");
21298
21311
  const summary = (agentResult?.finalText ?? "").trim().slice(0, 1e3);
21312
+ const output = {
21313
+ cursor: next.cursor,
21314
+ data: next.data && typeof next.data === "object" ? next.data : {}
21315
+ };
21299
21316
  await createStateBackendFromEnv().saveAgentState(
21300
21317
  `${owner}/${repo}`,
21301
21318
  {
21302
21319
  version: 1,
21303
21320
  agent,
21304
21321
  revision: previousRevision + 1,
21305
- cursor: next.cursor,
21322
+ cursor: output.cursor,
21306
21323
  summary,
21307
- data: next.data && typeof next.data === "object" ? next.data : {},
21324
+ data: output.data,
21308
21325
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
21309
21326
  },
21310
21327
  previousRevision
21311
21328
  );
21329
+ ctx.data.capabilityOutput = output;
21312
21330
  };
21313
21331
  }
21314
21332
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.635",
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": {