@kody-ade/kody-engine 0.4.634 → 0.4.636

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 +35 -5
  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.636",
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();
@@ -21271,19 +21296,24 @@ var init_saveLiveAgentState = __esm({
21271
21296
  const repo = ctx.config.github?.repo?.trim() || envRepo;
21272
21297
  if (!owner || !repo) throw new Error("Repository identity is required for live Agent state");
21273
21298
  const summary = (agentResult?.finalText ?? "").trim().slice(0, 1e3);
21299
+ const output = {
21300
+ cursor: next.cursor,
21301
+ data: next.data && typeof next.data === "object" ? next.data : {}
21302
+ };
21274
21303
  await createStateBackendFromEnv().saveAgentState(
21275
21304
  `${owner}/${repo}`,
21276
21305
  {
21277
21306
  version: 1,
21278
21307
  agent,
21279
21308
  revision: previousRevision + 1,
21280
- cursor: next.cursor,
21309
+ cursor: output.cursor,
21281
21310
  summary,
21282
- data: next.data && typeof next.data === "object" ? next.data : {},
21311
+ data: output.data,
21283
21312
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
21284
21313
  },
21285
21314
  previousRevision
21286
21315
  );
21316
+ ctx.data.capabilityOutput = output;
21287
21317
  };
21288
21318
  }
21289
21319
  });
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.636",
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": {