@kody-ade/kody-engine 0.4.637 → 0.4.638

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 +29 -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.637",
18
+ version: "0.4.638",
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,19 @@ var init_completionGuard = __esm({
181
181
  });
182
182
 
183
183
  // src/submitStateGuard.ts
184
+ function createSubmitStateActivityGuard() {
185
+ let hasActivity = false;
186
+ return {
187
+ recordToolUse: async (input) => {
188
+ if (input?.tool_name !== SUBMIT_STATE_TOOL) hasActivity = true;
189
+ return {};
190
+ },
191
+ requireActivity: async () => hasActivity ? {} : {
192
+ decision: "block",
193
+ reason: ACTIVITY_REQUIRED_REASON
194
+ }
195
+ };
196
+ }
184
197
  function createPostSubmitToolGuard(getSubmitted) {
185
198
  return async () => getSubmitted() ? {
186
199
  decision: "block",
@@ -199,12 +212,14 @@ function createSubmitStateStopHook(getSubmitted) {
199
212
  };
200
213
  };
201
214
  }
202
- var FINAL_STATE_CHANCE_REASON, STATE_ALREADY_SUBMITTED_REASON;
215
+ var FINAL_STATE_CHANCE_REASON, STATE_ALREADY_SUBMITTED_REASON, ACTIVITY_REQUIRED_REASON, SUBMIT_STATE_TOOL;
203
216
  var init_submitStateGuard = __esm({
204
217
  "src/submitStateGuard.ts"() {
205
218
  "use strict";
206
219
  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
220
  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.";
221
+ ACTIVITY_REQUIRED_REASON = "Do not submit continuation state yet. First use a tool to observe current evidence or perform the next responsibility action for this cycle.";
222
+ SUBMIT_STATE_TOOL = "mcp__kody-submit__submit_state";
208
223
  }
209
224
  });
210
225
 
@@ -4445,6 +4460,7 @@ async function runAgent(opts) {
4445
4460
  const outputContractStopHook = opts.outputContract ? createOutputContractStopHook(opts.outputContract) : null;
4446
4461
  const submitStateStopHook = opts.enableSubmitTool ? createSubmitStateStopHook(() => getSubmitted?.()) : null;
4447
4462
  const postSubmitToolGuard = opts.enableSubmitTool ? createPostSubmitToolGuard(() => getSubmitted?.()) : null;
4463
+ const submitStateActivityGuard = opts.enableSubmitTool ? createSubmitStateActivityGuard() : null;
4448
4464
  let finalSafeToReplay = true;
4449
4465
  for (let attempt = 0; ; attempt++) {
4450
4466
  let ndjsonWriteFailed = false;
@@ -4493,6 +4509,12 @@ async function runAgent(opts) {
4493
4509
  hooks: [completionGuard]
4494
4510
  }
4495
4511
  ] : [],
4512
+ ...submitStateActivityGuard ? [
4513
+ {
4514
+ matcher: "mcp__kody-submit__submit_state",
4515
+ hooks: [submitStateActivityGuard.requireActivity]
4516
+ }
4517
+ ] : [],
4496
4518
  {
4497
4519
  matcher: "Agent",
4498
4520
  hooks: [enforceSubagentModelInheritance]
@@ -4503,6 +4525,11 @@ async function runAgent(opts) {
4503
4525
  }
4504
4526
  ],
4505
4527
  PostToolUse: [
4528
+ ...submitStateActivityGuard ? [
4529
+ {
4530
+ hooks: [submitStateActivityGuard.recordToolUse]
4531
+ }
4532
+ ] : [],
4506
4533
  {
4507
4534
  matcher: "Agent",
4508
4535
  hooks: [subagentInvocationHook]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.637",
3
+ "version": "0.4.638",
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": {