@kody-ade/kody-engine 0.4.639 → 0.4.640

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 +57 -46
  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.639",
18
+ version: "0.4.640",
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,49 +180,6 @@ var init_completionGuard = __esm({
180
180
  }
181
181
  });
182
182
 
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
- }
197
- function createPostSubmitToolGuard(getSubmitted) {
198
- return async () => getSubmitted() ? {
199
- decision: "block",
200
- reason: STATE_ALREADY_SUBMITTED_REASON
201
- } : {};
202
- }
203
- function createSubmitStateStopHook(getSubmitted) {
204
- let finalChanceGiven = false;
205
- return async () => {
206
- if (getSubmitted()) return {};
207
- if (finalChanceGiven) return {};
208
- finalChanceGiven = true;
209
- return {
210
- decision: "block",
211
- reason: FINAL_STATE_CHANCE_REASON
212
- };
213
- };
214
- }
215
- var FINAL_STATE_CHANCE_REASON, STATE_ALREADY_SUBMITTED_REASON, ACTIVITY_REQUIRED_REASON, SUBMIT_STATE_TOOL;
216
- var init_submitStateGuard = __esm({
217
- "src/submitStateGuard.ts"() {
218
- "use strict";
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.";
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";
223
- }
224
- });
225
-
226
183
  // src/config.ts
227
184
  import * as fs2 from "fs";
228
185
  import * as path3 from "path";
@@ -1193,6 +1150,49 @@ var init_subagents = __esm({
1193
1150
  }
1194
1151
  });
1195
1152
 
1153
+ // src/submitStateGuard.ts
1154
+ function createSubmitStateActivityGuard() {
1155
+ let hasActivity = false;
1156
+ return {
1157
+ recordToolUse: async (input) => {
1158
+ if (input?.tool_name !== SUBMIT_STATE_TOOL) hasActivity = true;
1159
+ return {};
1160
+ },
1161
+ requireActivity: async () => hasActivity ? {} : {
1162
+ decision: "block",
1163
+ reason: ACTIVITY_REQUIRED_REASON
1164
+ }
1165
+ };
1166
+ }
1167
+ function createPostSubmitToolGuard(getSubmitted) {
1168
+ return async () => getSubmitted() ? {
1169
+ decision: "block",
1170
+ reason: STATE_ALREADY_SUBMITTED_REASON
1171
+ } : {};
1172
+ }
1173
+ function createSubmitStateStopHook(getSubmitted) {
1174
+ let finalChanceGiven = false;
1175
+ return async () => {
1176
+ if (getSubmitted()) return {};
1177
+ if (finalChanceGiven) return {};
1178
+ finalChanceGiven = true;
1179
+ return {
1180
+ decision: "block",
1181
+ reason: FINAL_STATE_CHANCE_REASON
1182
+ };
1183
+ };
1184
+ }
1185
+ var FINAL_STATE_CHANCE_REASON, STATE_ALREADY_SUBMITTED_REASON, ACTIVITY_REQUIRED_REASON, SUBMIT_STATE_TOOL;
1186
+ var init_submitStateGuard = __esm({
1187
+ "src/submitStateGuard.ts"() {
1188
+ "use strict";
1189
+ 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.";
1190
+ 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.";
1191
+ 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.";
1192
+ SUBMIT_STATE_TOOL = "mcp__kody-submit__submit_state";
1193
+ }
1194
+ });
1195
+
1196
1196
  // src/events.ts
1197
1197
  var events_exports = {};
1198
1198
  __export(events_exports, {
@@ -3589,10 +3589,19 @@ __export(capabilityMcp_exports, {
3589
3589
  parseCapabilityTrustMode: () => parseCapabilityTrustMode,
3590
3590
  readCheckRuns: () => readCheckRuns,
3591
3591
  readThread: () => readThread,
3592
+ selectCapabilityToolDefinitions: () => selectCapabilityToolDefinitions,
3592
3593
  startCapability: () => startCapability
3593
3594
  });
3594
3595
  import { createSdkMcpServer as createSdkMcpServer4, tool as tool4 } from "@anthropic-ai/claude-agent-sdk";
3595
3596
  import { z as z3 } from "zod";
3597
+ function selectCapabilityToolDefinitions(definitions, allowedToolNames) {
3598
+ if (!allowedToolNames) return definitions;
3599
+ const available = new Set(definitions.map((definition) => definition.name));
3600
+ const unknown = allowedToolNames.filter((name) => !available.has(name));
3601
+ if (unknown.length > 0) throw new Error(`Unknown capability MCP tools: ${unknown.join(", ")}`);
3602
+ const allowed = new Set(allowedToolNames);
3603
+ return definitions.filter((definition) => allowed.has(definition.name));
3604
+ }
3596
3605
  function summarizeCiStatus(rollup) {
3597
3606
  if (!Array.isArray(rollup) || rollup.length === 0) return "UNKNOWN";
3598
3607
  let hasRunning = false;
@@ -4188,7 +4197,7 @@ function capabilityToolDefinitions(opts) {
4188
4197
  ];
4189
4198
  }
4190
4199
  function buildCapabilityMcpServer(opts) {
4191
- const definitions = capabilityToolDefinitions(opts);
4200
+ const definitions = selectCapabilityToolDefinitions(capabilityToolDefinitions(opts), opts.allowedToolNames);
4192
4201
  const tools = definitions.map(
4193
4202
  (def) => tool4(
4194
4203
  def.name,
@@ -4613,6 +4622,7 @@ async function runAgent(opts) {
4613
4622
  const capabilityHandle = buildCapabilityMcpServer2({
4614
4623
  repoSlug: opts.capabilityRepoSlug,
4615
4624
  operatorMention: opts.capabilityOperatorMention ?? "",
4625
+ ...opts.capabilityToolNames ? { allowedToolNames: opts.capabilityToolNames } : {},
4616
4626
  ...opts.capabilityDefaultBranch ? { defaultBranch: opts.capabilityDefaultBranch } : {},
4617
4627
  ...opts.capabilitySlug ? { capabilitySlug: opts.capabilitySlug } : {}
4618
4628
  });
@@ -4929,13 +4939,13 @@ var init_agent = __esm({
4929
4939
  "use strict";
4930
4940
  init_claudeBinary();
4931
4941
  init_completionGuard();
4932
- init_submitStateGuard();
4933
4942
  init_config();
4934
4943
  init_fileEditGuards();
4935
4944
  init_format();
4936
4945
  init_outputContractHooks();
4937
4946
  init_runtimePaths();
4938
4947
  init_subagents();
4948
+ init_submitStateGuard();
4939
4949
  DEFAULT_ALLOWED_TOOLS = ["Bash", "Edit", "Read", "Write", "Glob", "Grep"];
4940
4950
  DEFAULT_TURN_TIMEOUT_MS = 6e5;
4941
4951
  MAX_CONNECTION_RETRIES = 2;
@@ -23421,6 +23431,7 @@ async function runImplementation(profileName, input) {
23421
23431
  // to know the palette — it just forwards the flag so agent.ts can spin
23422
23432
  // up the in-process `kody-capability` MCP server with the right context.
23423
23433
  enableCapabilityTool: Array.isArray(ctx.data.capabilityTools) && ctx.data.capabilityTools.length > 0,
23434
+ capabilityToolNames: Array.isArray(ctx.data.capabilityTools) ? ctx.data.capabilityTools.filter((name) => typeof name === "string") : void 0,
23424
23435
  enableDashboardCmsTool: Boolean(
23425
23436
  ctx.data.capabilityRequirements && typeof ctx.data.capabilityRequirements === "object" && !Array.isArray(ctx.data.capabilityRequirements) && ctx.data.capabilityRequirements.cms === true
23426
23437
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.639",
3
+ "version": "0.4.640",
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": {