@kody-ade/kody-engine 0.4.54 → 0.4.56

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.
package/dist/bin/kody.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // package.json
4
4
  var package_default = {
5
5
  name: "@kody-ade/kody-engine",
6
- version: "0.4.54",
6
+ version: "0.4.56",
7
7
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
8
8
  license: "MIT",
9
9
  type: "module",
@@ -472,7 +472,19 @@ async function runAgent(opts) {
472
472
  queryOptions.maxThinkingTokens = opts.maxThinkingTokens;
473
473
  }
474
474
  if (typeof opts.systemPromptAppend === "string" && opts.systemPromptAppend.length > 0) {
475
- queryOptions.systemPrompt = { type: "preset", preset: "claude_code", append: opts.systemPromptAppend };
475
+ const systemPrompt = {
476
+ type: "preset",
477
+ preset: "claude_code",
478
+ append: opts.systemPromptAppend
479
+ };
480
+ if (opts.cacheable) systemPrompt.excludeDynamicSections = true;
481
+ queryOptions.systemPrompt = systemPrompt;
482
+ } else if (opts.cacheable) {
483
+ queryOptions.systemPrompt = {
484
+ type: "preset",
485
+ preset: "claude_code",
486
+ excludeDynamicSections: true
487
+ };
476
488
  }
477
489
  queryOptions.settingSources = opts.settingSources ?? ["project", "local"];
478
490
  const result = query({
@@ -1779,6 +1791,7 @@ function parseClaudeCode(p, raw) {
1779
1791
  maxThinkingTokens: typeof r.maxThinkingTokens === "number" ? r.maxThinkingTokens : null,
1780
1792
  maxTurnTimeoutSec: typeof r.maxTurnTimeoutSec === "number" ? r.maxTurnTimeoutSec : null,
1781
1793
  systemPromptAppend: typeof r.systemPromptAppend === "string" ? r.systemPromptAppend : null,
1794
+ cacheable: r.cacheable === true,
1782
1795
  tools,
1783
1796
  hooks: Array.isArray(r.hooks) ? r.hooks : [],
1784
1797
  skills: Array.isArray(r.skills) ? r.skills : [],
@@ -5471,6 +5484,12 @@ function extractIssueNumber(pr) {
5471
5484
 
5472
5485
  // src/scripts/finishFlow.ts
5473
5486
  import { execFileSync as execFileSync14 } from "child_process";
5487
+ var TERMINAL_PHASE = {
5488
+ "review-passed": { phase: "shipped", status: "succeeded" },
5489
+ "fix-applied": { phase: "shipped", status: "succeeded" },
5490
+ "review-failed": { phase: "failed", status: "failed" },
5491
+ aborted: { phase: "failed", status: "failed" }
5492
+ };
5474
5493
  var API_TIMEOUT_MS6 = 3e4;
5475
5494
  var STATUS_ICON = {
5476
5495
  "review-passed": "\u2705",
@@ -5515,6 +5534,22 @@ var finishFlow = async (ctx, profile, _agentResult, args) => {
5515
5534
  `
5516
5535
  );
5517
5536
  }
5537
+ const terminal = TERMINAL_PHASE[reason];
5538
+ if (terminal && state) {
5539
+ state.core.phase = terminal.phase;
5540
+ state.core.status = terminal.status;
5541
+ state.core.currentExecutable = null;
5542
+ const target = ctx.data.commentTargetType ?? "issue";
5543
+ const targetNumber = ctx.data.commentTargetNumber ?? issueNumber;
5544
+ try {
5545
+ writeTaskState(target, targetNumber, state, ctx.cwd);
5546
+ } catch (err) {
5547
+ process.stderr.write(
5548
+ `[kody finishFlow] failed to update state mirror: ${err instanceof Error ? err.message : String(err)}
5549
+ `
5550
+ );
5551
+ }
5552
+ }
5518
5553
  };
5519
5554
 
5520
5555
  // src/branch.ts
@@ -9251,6 +9286,7 @@ async function runExecutable(profileName, input) {
9251
9286
  maxThinkingTokens: profile.claudeCode.maxThinkingTokens,
9252
9287
  maxTurnTimeoutMs: typeof profile.claudeCode.maxTurnTimeoutSec === "number" ? Math.floor(profile.claudeCode.maxTurnTimeoutSec * 1e3) : void 0,
9253
9288
  systemPromptAppend: profile.claudeCode.systemPromptAppend,
9289
+ cacheable: profile.claudeCode.cacheable,
9254
9290
  settingSources: profile.claudeCode.settingSources
9255
9291
  });
9256
9292
  };
@@ -24,6 +24,7 @@
24
24
  "maxTurns": null,
25
25
  "maxThinkingTokens": null,
26
26
  "systemPromptAppend": null,
27
+ "cacheable": true,
27
28
  "tools": [
28
29
  "Read",
29
30
  "Bash"
@@ -25,6 +25,7 @@
25
25
  "maxTurns": null,
26
26
  "maxTurnTimeoutSec": 1200,
27
27
  "systemPromptAppend": null,
28
+ "cacheable": true,
28
29
  "tools": [
29
30
  "Read",
30
31
  "Write",
@@ -24,6 +24,7 @@
24
24
  "maxTurns": null,
25
25
  "maxTurnTimeoutSec": 1200,
26
26
  "systemPromptAppend": null,
27
+ "cacheable": true,
27
28
  "tools": [
28
29
  "Read",
29
30
  "Write",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -24,6 +24,7 @@
24
24
  "maxTurns": null,
25
25
  "maxTurnTimeoutSec": 1200,
26
26
  "systemPromptAppend": null,
27
+ "cacheable": true,
27
28
  "tools": [
28
29
  "Read",
29
30
  "Write",
@@ -163,6 +163,20 @@ export interface ClaudeCodeSpec {
163
163
  maxTurnTimeoutSec?: number | null
164
164
  /** Text appended on top of Claude Code's baseline system prompt. */
165
165
  systemPromptAppend: string | null
166
+ /**
167
+ * Cross-process prompt caching opt-in. When true, the agent invocation
168
+ * sets `systemPrompt.excludeDynamicSections: true` so per-user dynamic
169
+ * content (cwd, git status, auto-memory) is stripped from the preset
170
+ * and re-injected as the first user message. The remaining preset
171
+ * becomes byte-identical across runs and benefits from Anthropic's
172
+ * 5-min server-side prompt cache. Recommended for hot-path stages
173
+ * (`run`, `fix`, `classify`) where the same workflow fires many
174
+ * times in a short window.
175
+ *
176
+ * Default: false (preserves legacy behaviour). No-op if the SDK does
177
+ * not support `excludeDynamicSections` (forward-compatible).
178
+ */
179
+ cacheable?: boolean
166
180
  /** SDK built-in tools this executable is allowed to use (capability pack). */
167
181
  tools: string[]
168
182
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.54",
3
+ "version": "0.4.56",
4
4
  "description": "kody — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -12,18 +12,6 @@
12
12
  "templates",
13
13
  "kody.config.schema.json"
14
14
  ],
15
- "scripts": {
16
- "kody": "tsx bin/kody.ts",
17
- "build": "tsup && node scripts/copy-assets.cjs",
18
- "test": "vitest run tests/unit tests/int --no-coverage",
19
- "test:e2e": "vitest run tests/e2e --no-coverage",
20
- "test:all": "vitest run tests --no-coverage",
21
- "typecheck": "tsc --noEmit",
22
- "lint": "biome check",
23
- "lint:fix": "biome check --write",
24
- "format": "biome format --write",
25
- "prepublishOnly": "pnpm build"
26
- },
27
15
  "dependencies": {
28
16
  "@actions/cache": "^6.0.0",
29
17
  "@anthropic-ai/claude-agent-sdk": "0.2.119"
@@ -44,5 +32,16 @@
44
32
  "url": "git+https://github.com/aharonyaircohen/kody-engine.git"
45
33
  },
46
34
  "homepage": "https://github.com/aharonyaircohen/kody-engine",
47
- "bugs": "https://github.com/aharonyaircohen/kody-engine/issues"
48
- }
35
+ "bugs": "https://github.com/aharonyaircohen/kody-engine/issues",
36
+ "scripts": {
37
+ "kody": "tsx bin/kody.ts",
38
+ "build": "tsup && node scripts/copy-assets.cjs",
39
+ "test": "vitest run tests/unit tests/int --no-coverage",
40
+ "test:e2e": "vitest run tests/e2e --no-coverage",
41
+ "test:all": "vitest run tests --no-coverage",
42
+ "typecheck": "tsc --noEmit",
43
+ "lint": "biome check",
44
+ "lint:fix": "biome check --write",
45
+ "format": "biome format --write"
46
+ }
47
+ }