@kody-ade/kody-engine 0.4.502 → 0.4.504

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
@@ -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.502",
18
+ version: "0.4.504",
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
  type: "module",
@@ -15648,6 +15648,8 @@ var init_loadQaContext = __esm({
15648
15648
  // src/scripts/loadSimpleCapability.ts
15649
15649
  import * as fs43 from "fs";
15650
15650
  import * as path40 from "path";
15651
+ import * as os6 from "os";
15652
+ import { randomUUID as randomUUID2 } from "crypto";
15651
15653
  function registerCapabilitySubagents(profile, toolRoot, toolFiles) {
15652
15654
  const subagentFiles = toolFiles.flatMap((file) => {
15653
15655
  const match = /^agents\/([a-z][a-z0-9-]{0,63})\.md$/.exec(file);
@@ -15754,9 +15756,12 @@ var init_loadSimpleCapability = __esm({
15754
15756
  if (capability.config.outputSchema) {
15755
15757
  ctx.data.capabilityOutputSchema = capability.config.outputSchema;
15756
15758
  }
15759
+ const outputPath = ctx.data.capabilityExecution === "agent" && capability.config.outputSchema ? path40.join(os6.tmpdir(), `kody-capability-output-${randomUUID2()}.json`) : void 0;
15760
+ if (outputPath) ctx.data.capabilityOutputPath = outputPath;
15757
15761
  ctx.data.capabilityEnvironment = {
15758
15762
  ...capabilityInputEnvironment(input),
15759
- ...capabilityConfigEnvironment(ctx.config)
15763
+ ...capabilityConfigEnvironment(ctx.config),
15764
+ ...outputPath ? { KODY_CAPABILITY_OUTPUT: outputPath } : {}
15760
15765
  };
15761
15766
  ctx.data.prompt = [
15762
15767
  capability.rawBody.trim(),
@@ -15793,7 +15798,13 @@ var init_loadSimpleCapability = __esm({
15793
15798
  "",
15794
15799
  "```json",
15795
15800
  JSON.stringify(capability.config.outputSchema, null, 2),
15796
- "```"
15801
+ "```",
15802
+ ...outputPath ? [
15803
+ "",
15804
+ "Write the final JSON value to this file before your final response:",
15805
+ outputPath,
15806
+ "The Engine reads this file as the authoritative result. Do not write markdown to it."
15807
+ ] : []
15797
15808
  ] : ["Return one JSON value."]
15798
15809
  ].join("\n");
15799
15810
  };
@@ -16741,6 +16752,15 @@ var init_parseReproOutput = __esm({
16741
16752
  });
16742
16753
 
16743
16754
  // src/scripts/parseSimpleCapabilityOutput.ts
16755
+ import * as fs45 from "fs";
16756
+ function readOutputFile(outputPath) {
16757
+ if (!outputPath || !fs45.existsSync(outputPath)) return { found: false };
16758
+ try {
16759
+ return { found: true, value: JSON.parse(fs45.readFileSync(outputPath, "utf-8")) };
16760
+ } finally {
16761
+ fs45.rmSync(outputPath, { force: true });
16762
+ }
16763
+ }
16744
16764
  function parseOutput(text2) {
16745
16765
  if (!text2) return void 0;
16746
16766
  try {
@@ -16780,7 +16800,9 @@ var init_parseSimpleCapabilityOutput = __esm({
16780
16800
  init_capability_contract_validation();
16781
16801
  init_capabilityResult();
16782
16802
  parseSimpleCapabilityOutput = async (ctx, _profile, agentResult) => {
16783
- const output = Object.hasOwn(ctx.data, "capabilityScriptOutput") ? ctx.data.capabilityScriptOutput : parseOutput(agentResult?.finalText);
16803
+ const outputPath = typeof ctx.data.capabilityOutputPath === "string" ? ctx.data.capabilityOutputPath : void 0;
16804
+ const fileOutput = readOutputFile(outputPath);
16805
+ const output = fileOutput.found ? fileOutput.value : Object.hasOwn(ctx.data, "capabilityScriptOutput") ? ctx.data.capabilityScriptOutput : parseOutput(agentResult?.finalText);
16784
16806
  if (output === void 0) {
16785
16807
  const reason2 = agentResult?.outcomeKind === "out_of_turns" ? "Capability execution limit reached" : "Capability execution ended before returning a result";
16786
16808
  const blocked = {
@@ -17322,8 +17344,8 @@ var init_postResearchComment = __esm({
17322
17344
  });
17323
17345
 
17324
17346
  // src/scripts/prepareBrowserAuth.ts
17325
- import * as fs45 from "fs";
17326
- import * as os6 from "os";
17347
+ import * as fs46 from "fs";
17348
+ import * as os7 from "os";
17327
17349
  import * as path42 from "path";
17328
17350
  function appendAuthMessage(ctx, message) {
17329
17351
  const current = typeof ctx.data.qaAuthBlock === "string" ? ctx.data.qaAuthBlock.trim() : "";
@@ -17363,8 +17385,8 @@ async function githubJson(url, token) {
17363
17385
  return await response.json();
17364
17386
  }
17365
17387
  function writeKodyStorageState(input) {
17366
- const directory = fs45.mkdtempSync(path42.join(os6.tmpdir(), "kody-browser-auth-"));
17367
- fs45.chmodSync(directory, 448);
17388
+ const directory = fs46.mkdtempSync(path42.join(os7.tmpdir(), "kody-browser-auth-"));
17389
+ fs46.chmodSync(directory, 448);
17368
17390
  const file = path42.join(directory, "storage-state.json");
17369
17391
  const now = Date.now();
17370
17392
  const repoEntry = {
@@ -17395,7 +17417,7 @@ function writeKodyStorageState(input) {
17395
17417
  }
17396
17418
  ]
17397
17419
  };
17398
- fs45.writeFileSync(file, JSON.stringify(storageState), { mode: 384 });
17420
+ fs46.writeFileSync(file, JSON.stringify(storageState), { mode: 384 });
17399
17421
  return { directory, file };
17400
17422
  }
17401
17423
  function configurePlaywright(profile, storageStatePath) {
@@ -17477,7 +17499,7 @@ async function prepareMethod(ctx, profile, method) {
17477
17499
  configurePlaywright(profile, state.file);
17478
17500
  const authDirectory = state.directory;
17479
17501
  registerRuntimeCleanup(ctx, () => {
17480
- fs45.rmSync(authDirectory, { recursive: true, force: true });
17502
+ fs46.rmSync(authDirectory, { recursive: true, force: true });
17481
17503
  });
17482
17504
  appendAuthMessage(
17483
17505
  ctx,
@@ -17485,7 +17507,7 @@ async function prepareMethod(ctx, profile, method) {
17485
17507
  );
17486
17508
  return true;
17487
17509
  } catch (error) {
17488
- if (state) fs45.rmSync(state.directory, { recursive: true, force: true });
17510
+ if (state) fs46.rmSync(state.directory, { recursive: true, force: true });
17489
17511
  const reason = error instanceof Error ? error.message : String(error);
17490
17512
  appendAuthMessage(
17491
17513
  ctx,
@@ -19161,7 +19183,7 @@ var init_tickShellRunner = __esm({
19161
19183
  });
19162
19184
 
19163
19185
  // src/scripts/runScheduledImplementationTick.ts
19164
- import * as fs46 from "fs";
19186
+ import * as fs47 from "fs";
19165
19187
  import * as path44 from "path";
19166
19188
  var runScheduledImplementationTick;
19167
19189
  var init_runScheduledImplementationTick = __esm({
@@ -19190,7 +19212,7 @@ var init_runScheduledImplementationTick = __esm({
19190
19212
  return;
19191
19213
  }
19192
19214
  const shellPath = path44.join(profile.dir, shell);
19193
- if (!fs46.existsSync(shellPath)) {
19215
+ if (!fs47.existsSync(shellPath)) {
19194
19216
  ctx.output.exitCode = 99;
19195
19217
  ctx.output.reason = `runScheduledImplementationTick: shell not found: ${shell} (looked in ${profile.dir})`;
19196
19218
  return;
@@ -19222,13 +19244,13 @@ var init_runScheduledImplementationTick = __esm({
19222
19244
 
19223
19245
  // src/scripts/runSimpleCapabilityScript.ts
19224
19246
  import { spawnSync as spawnSync3 } from "child_process";
19225
- import * as fs47 from "fs";
19247
+ import * as fs48 from "fs";
19226
19248
  function formatDuration2(timeoutMs) {
19227
19249
  return timeoutMs % 6e4 === 0 ? `${timeoutMs / 6e4} minutes` : `${timeoutMs}ms`;
19228
19250
  }
19229
19251
  function isRegularFile2(filePath) {
19230
19252
  try {
19231
- const stat = fs47.lstatSync(filePath);
19253
+ const stat = fs48.lstatSync(filePath);
19232
19254
  return stat.isFile() && !stat.isSymbolicLink();
19233
19255
  } catch {
19234
19256
  return false;
@@ -19307,7 +19329,7 @@ var init_runSimpleCapabilityScript = __esm({
19307
19329
  });
19308
19330
 
19309
19331
  // src/scripts/runTickScript.ts
19310
- import * as fs48 from "fs";
19332
+ import * as fs49 from "fs";
19311
19333
  import * as path45 from "path";
19312
19334
  var runTickScript;
19313
19335
  var init_runTickScript = __esm({
@@ -19341,7 +19363,7 @@ var init_runTickScript = __esm({
19341
19363
  return;
19342
19364
  }
19343
19365
  const scriptPath = path45.isAbsolute(tickScript) ? tickScript : path45.join(ctx.cwd, tickScript);
19344
- if (!fs48.existsSync(scriptPath)) {
19366
+ if (!fs49.existsSync(scriptPath)) {
19345
19367
  ctx.output.exitCode = 99;
19346
19368
  ctx.output.reason = `runTickScript: tickScript not found: ${scriptPath}`;
19347
19369
  return;
@@ -20385,7 +20407,7 @@ var init_warmupMcp = __esm({
20385
20407
  });
20386
20408
 
20387
20409
  // src/scripts/writeAgentRunSummary.ts
20388
- import * as fs49 from "fs";
20410
+ import * as fs50 from "fs";
20389
20411
  var writeAgentRunSummary;
20390
20412
  var init_writeAgentRunSummary = __esm({
20391
20413
  "src/scripts/writeAgentRunSummary.ts"() {
@@ -20411,7 +20433,7 @@ var init_writeAgentRunSummary = __esm({
20411
20433
  if (reason) lines.push(`- **Reason:** ${reason}`);
20412
20434
  lines.push("");
20413
20435
  try {
20414
- fs49.appendFileSync(summaryPath, `${lines.join("\n")}
20436
+ fs50.appendFileSync(summaryPath, `${lines.join("\n")}
20415
20437
  `);
20416
20438
  } catch {
20417
20439
  }
@@ -20747,7 +20769,7 @@ var init_scripts = __esm({
20747
20769
  });
20748
20770
 
20749
20771
  // src/stateWorkspace.ts
20750
- import * as fs50 from "fs";
20772
+ import * as fs51 from "fs";
20751
20773
  import * as path47 from "path";
20752
20774
  function tenantId(config) {
20753
20775
  const owner = config.github?.owner?.trim() || process.env.GITHUB_REPOSITORY?.split("/")[0]?.trim();
@@ -20756,8 +20778,8 @@ function tenantId(config) {
20756
20778
  }
20757
20779
  function writeRuntimeFile(cwd, relativePath, content) {
20758
20780
  const target = path47.join(cwd, RUNTIME_ROOT, relativePath);
20759
- fs50.mkdirSync(path47.dirname(target), { recursive: true });
20760
- fs50.writeFileSync(target, content, "utf8");
20781
+ fs51.mkdirSync(path47.dirname(target), { recursive: true });
20782
+ fs51.writeFileSync(target, content, "utf8");
20761
20783
  }
20762
20784
  function record(value) {
20763
20785
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
@@ -20826,7 +20848,7 @@ async function hydrateStateWorkspace(config, cwd, backendOverride) {
20826
20848
  if (hydratedWorkspaces.has(key)) return;
20827
20849
  const backend = backendOverride ?? createStateBackendFromEnv();
20828
20850
  const root = path47.join(cwd, RUNTIME_ROOT);
20829
- fs50.rmSync(root, { recursive: true, force: true });
20851
+ fs51.rmSync(root, { recursive: true, force: true });
20830
20852
  await Promise.all([
20831
20853
  hydratePrefix(backend, tenant, cwd, "context:"),
20832
20854
  hydratePrefix(backend, tenant, cwd, "memory:"),
@@ -20913,8 +20935,8 @@ var init_tools = __esm({
20913
20935
 
20914
20936
  // src/executor.ts
20915
20937
  import { spawn as spawn8 } from "child_process";
20916
- import * as fs51 from "fs";
20917
- import * as os7 from "os";
20938
+ import * as fs52 from "fs";
20939
+ import * as os8 from "os";
20918
20940
  import * as path48 from "path";
20919
20941
  function isMutatingPostflight(scriptName) {
20920
20942
  return MUTATING_POSTFLIGHTS.has(scriptName ?? "");
@@ -21655,7 +21677,7 @@ function resolveProfilePath(profileName, cwd = process.cwd()) {
21655
21677
  // fallback
21656
21678
  ];
21657
21679
  for (const c of candidates) {
21658
- if (fs51.existsSync(c)) return c;
21680
+ if (fs52.existsSync(c)) return c;
21659
21681
  }
21660
21682
  return candidates[0];
21661
21683
  }
@@ -21771,7 +21793,7 @@ function resolveShellTimeoutMs(entry) {
21771
21793
  async function runShellEntry(entry, ctx, profile) {
21772
21794
  const shellName = entry.shell;
21773
21795
  const shellPath = path48.join(profile.dir, shellName);
21774
- if (!fs51.existsSync(shellPath)) {
21796
+ if (!fs52.existsSync(shellPath)) {
21775
21797
  ctx.skipAgent = true;
21776
21798
  ctx.output.exitCode = 99;
21777
21799
  ctx.output.reason = `shell script not found: ${shellName} (looked in ${profile.dir})`;
@@ -21779,7 +21801,7 @@ async function runShellEntry(entry, ctx, profile) {
21779
21801
  }
21780
21802
  const positional = entry.with ? Object.values(entry.with).map((v) => String(v)) : [];
21781
21803
  const outputFile = path48.join(
21782
- os7.tmpdir(),
21804
+ os8.tmpdir(),
21783
21805
  `kody-shell-output-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`
21784
21806
  );
21785
21807
  const env = { ...process.env, HUSKY: "0", SKIP_HOOKS: "1", KODY_OUTPUT: outputFile };
@@ -21845,9 +21867,9 @@ async function runShellEntry(entry, ctx, profile) {
21845
21867
  }
21846
21868
  let sideChannelText = "";
21847
21869
  try {
21848
- if (fs51.existsSync(outputFile)) {
21849
- sideChannelText = fs51.readFileSync(outputFile, "utf-8");
21850
- fs51.rmSync(outputFile, { force: true });
21870
+ if (fs52.existsSync(outputFile)) {
21871
+ sideChannelText = fs52.readFileSync(outputFile, "utf-8");
21872
+ fs52.rmSync(outputFile, { force: true });
21851
21873
  }
21852
21874
  } catch {
21853
21875
  }
@@ -24143,7 +24165,7 @@ async function hydrateDefinitionsFromEnv(cwd = process.cwd(), env = process.env)
24143
24165
 
24144
24166
  // src/kody-cli.ts
24145
24167
  import { execFileSync as execFileSync24 } from "child_process";
24146
- import * as fs52 from "fs";
24168
+ import * as fs53 from "fs";
24147
24169
  import * as path49 from "path";
24148
24170
 
24149
24171
  // src/app-auth.ts
@@ -24848,8 +24870,8 @@ function routeRunRequest(request) {
24848
24870
  const workflowRunId = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.test(requestedRunId) ? requestedRunId : void 0;
24849
24871
  const { runId: _runId, ...workflowInput } = objectValue2(request.input) ?? {};
24850
24872
  return {
24851
- kind: "action",
24852
- action: target.id,
24873
+ kind: "workflow",
24874
+ workflow: target.id,
24853
24875
  cliArgs: workflowInput,
24854
24876
  ...workflowRunId ? { workflowRunId } : {}
24855
24877
  };
@@ -24940,9 +24962,9 @@ async function resolveAuthToken(env = process.env) {
24940
24962
  return void 0;
24941
24963
  }
24942
24964
  function detectPackageManager2(cwd) {
24943
- if (fs52.existsSync(path49.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
24944
- if (fs52.existsSync(path49.join(cwd, "yarn.lock"))) return "yarn";
24945
- if (fs52.existsSync(path49.join(cwd, "bun.lockb"))) return "bun";
24965
+ if (fs53.existsSync(path49.join(cwd, "pnpm-lock.yaml"))) return "pnpm";
24966
+ if (fs53.existsSync(path49.join(cwd, "yarn.lock"))) return "yarn";
24967
+ if (fs53.existsSync(path49.join(cwd, "bun.lockb"))) return "bun";
24946
24968
  return "npm";
24947
24969
  }
24948
24970
  function shouldChainScheduledWatch(match) {
@@ -25044,8 +25066,8 @@ function postFailureTail(issueNumber, cwd, reason) {
25044
25066
  const logPath = lastRunLogPath(cwd);
25045
25067
  let tail = "";
25046
25068
  try {
25047
- if (fs52.existsSync(logPath)) {
25048
- const content = fs52.readFileSync(logPath, "utf-8");
25069
+ if (fs53.existsSync(logPath)) {
25070
+ const content = fs53.readFileSync(logPath, "utf-8");
25049
25071
  tail = content.slice(-3e3);
25050
25072
  }
25051
25073
  } catch {
@@ -25101,6 +25123,7 @@ async function runCi(argv) {
25101
25123
  let forceRunAction = null;
25102
25124
  let forceRunCliArgs = {};
25103
25125
  let forceWorkflowRunId;
25126
+ let forceRunTargetKind = "action";
25104
25127
  let runRequestFanOut = false;
25105
25128
  let runRequestFanOutForce = false;
25106
25129
  const parsedRunRequest = readRunRequestFromEnv();
@@ -25109,8 +25132,6 @@ async function runCi(argv) {
25109
25132
  `);
25110
25133
  return 64;
25111
25134
  }
25112
- if (parsedRunRequest && "request" in parsedRunRequest) {
25113
- }
25114
25135
  const explicitLoopRequest = parsedRunRequest && "request" in parsedRunRequest && parsedRunRequest.request.target.type === "loop";
25115
25136
  if (!args.issueNumber && !autoFallback && parsedRunRequest && "request" in parsedRunRequest) {
25116
25137
  const route = routeRunRequest(parsedRunRequest.request);
@@ -25126,6 +25147,11 @@ async function runCi(argv) {
25126
25147
  forceRunAction = route.action;
25127
25148
  forceRunCliArgs = route.cliArgs;
25128
25149
  forceWorkflowRunId = route.workflowRunId;
25150
+ } else if (route.kind === "workflow") {
25151
+ forceRunAction = route.workflow;
25152
+ forceRunTargetKind = "workflow";
25153
+ forceRunCliArgs = route.cliArgs;
25154
+ forceWorkflowRunId = route.workflowRunId;
25129
25155
  }
25130
25156
  }
25131
25157
  const envForceAction = (process.env.KODY_FORCE_ACTION ?? "").trim();
@@ -25136,9 +25162,9 @@ async function runCi(argv) {
25136
25162
  forceRunCliArgs = { goal: envForceMessage };
25137
25163
  }
25138
25164
  }
25139
- if (!args.issueNumber && !autoFallback && !forceRunAction && !runRequestFanOut && eventName === "workflow_dispatch" && dispatchEventPath && fs52.existsSync(dispatchEventPath)) {
25165
+ if (!args.issueNumber && !autoFallback && !forceRunAction && !runRequestFanOut && eventName === "workflow_dispatch" && dispatchEventPath && fs53.existsSync(dispatchEventPath)) {
25140
25166
  try {
25141
- const evt = JSON.parse(fs52.readFileSync(dispatchEventPath, "utf-8"));
25167
+ const evt = JSON.parse(fs53.readFileSync(dispatchEventPath, "utf-8"));
25142
25168
  const inputs = objectValue2(evt.inputs);
25143
25169
  const issueInput = parseInt(String(inputs?.issue_number ?? ""), 10);
25144
25170
  const sessionInput = String(inputs?.sessionId ?? "");
@@ -25175,7 +25201,7 @@ async function runCi(argv) {
25175
25201
  const capabilityRoot = capabilitiesRoot(cwd);
25176
25202
  const directCapability = manualGoalManager ? null : resolveCapabilityFolder(forceRunAction, capabilityRoot);
25177
25203
  const directExecution = directCapability ? resolveCapabilityExecution(directCapability, cwd) : null;
25178
- const capabilityRoute = manualGoalManager ? null : resolveCapabilityAction(forceRunAction, capabilityRoot) ?? (directCapability && directExecution && (directCapability.config.action ?? directCapability.slug) === forceRunAction ? {
25204
+ const capabilityRoute = manualGoalManager || forceRunTargetKind === "workflow" ? null : resolveCapabilityAction(forceRunAction, capabilityRoot) ?? (directCapability && directExecution && (directCapability.config.action ?? directCapability.slug) === forceRunAction ? {
25179
25205
  action: forceRunAction,
25180
25206
  capability: directCapability.slug,
25181
25207
  implementation: directExecution.implementation,
@@ -25549,7 +25575,7 @@ init_repoWorkspace();
25549
25575
 
25550
25576
  // src/scripts/brainTurnLog.ts
25551
25577
  init_runtimePaths();
25552
- import * as fs53 from "fs";
25578
+ import * as fs54 from "fs";
25553
25579
  import * as path50 from "path";
25554
25580
  import posixPath4 from "path/posix";
25555
25581
  var live = /* @__PURE__ */ new Map();
@@ -25558,8 +25584,8 @@ function brainEventsFilePath(dir, chatId) {
25558
25584
  }
25559
25585
  function lastPersistedSeq(dir, chatId) {
25560
25586
  const p = brainEventsFilePath(dir, chatId);
25561
- if (!fs53.existsSync(p)) return 0;
25562
- const lines = fs53.readFileSync(p, "utf-8").split("\n").filter(Boolean);
25587
+ if (!fs54.existsSync(p)) return 0;
25588
+ const lines = fs54.readFileSync(p, "utf-8").split("\n").filter(Boolean);
25563
25589
  if (lines.length === 0) return 0;
25564
25590
  try {
25565
25591
  return JSON.parse(lines[lines.length - 1]).seq || 0;
@@ -25569,9 +25595,9 @@ function lastPersistedSeq(dir, chatId) {
25569
25595
  }
25570
25596
  function readSince(dir, chatId, since) {
25571
25597
  const p = brainEventsFilePath(dir, chatId);
25572
- if (!fs53.existsSync(p)) return [];
25598
+ if (!fs54.existsSync(p)) return [];
25573
25599
  const out = [];
25574
- for (const line of fs53.readFileSync(p, "utf-8").split("\n")) {
25600
+ for (const line of fs54.readFileSync(p, "utf-8").split("\n")) {
25575
25601
  if (!line) continue;
25576
25602
  try {
25577
25603
  const rec = JSON.parse(line);
@@ -25597,12 +25623,12 @@ function beginTurn(dir, chatId) {
25597
25623
  };
25598
25624
  live.set(chatId, state);
25599
25625
  const p = brainEventsFilePath(dir, chatId);
25600
- fs53.mkdirSync(path50.dirname(p), { recursive: true });
25626
+ fs54.mkdirSync(path50.dirname(p), { recursive: true });
25601
25627
  return (event) => {
25602
25628
  state.seq += 1;
25603
25629
  const rec = { seq: state.seq, turn, ts: Date.now(), event };
25604
25630
  try {
25605
- fs53.appendFileSync(p, `${JSON.stringify(rec)}
25631
+ fs54.appendFileSync(p, `${JSON.stringify(rec)}
25606
25632
  `);
25607
25633
  } catch (err) {
25608
25634
  process.stderr.write(
@@ -25641,7 +25667,7 @@ function endTurnIfUnterminated(dir, chatId, errMessage) {
25641
25667
  event: { type: "error", error: errMessage || "turn ended unexpectedly", chatId }
25642
25668
  };
25643
25669
  try {
25644
- fs53.appendFileSync(brainEventsFilePath(dir, chatId), `${JSON.stringify(rec)}
25670
+ fs54.appendFileSync(brainEventsFilePath(dir, chatId), `${JSON.stringify(rec)}
25645
25671
  `);
25646
25672
  } catch {
25647
25673
  }
@@ -26458,7 +26484,7 @@ init_config();
26458
26484
  init_fetchRepoMcp();
26459
26485
 
26460
26486
  // src/servers/mcpHttpServer.ts
26461
- import { randomUUID as randomUUID2 } from "crypto";
26487
+ import { randomUUID as randomUUID3 } from "crypto";
26462
26488
  import { createServer as createServer4 } from "http";
26463
26489
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
26464
26490
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
@@ -26467,7 +26493,7 @@ function buildMcpHttpServer(opts) {
26467
26493
  const transports = /* @__PURE__ */ new Map();
26468
26494
  for (const route of opts.routes) {
26469
26495
  const transport = new StreamableHTTPServerTransport({
26470
- sessionIdGenerator: () => randomUUID2()
26496
+ sessionIdGenerator: () => randomUUID3()
26471
26497
  });
26472
26498
  transports.set(route.path, transport);
26473
26499
  routes.set(route.path, route.name);
@@ -27819,7 +27845,7 @@ async function poolServe() {
27819
27845
 
27820
27846
  // src/servers/runner-serve.ts
27821
27847
  import { spawn as spawn9 } from "child_process";
27822
- import * as fs54 from "fs";
27848
+ import * as fs55 from "fs";
27823
27849
  import { createServer as createServer6 } from "http";
27824
27850
  var DEFAULT_PORT2 = 8080;
27825
27851
  var DEFAULT_WORKDIR = "/workspace/repo";
@@ -27895,8 +27921,8 @@ async function defaultRunJob(job) {
27895
27921
  const workdir = process.env.RUNNER_WORKDIR ?? DEFAULT_WORKDIR;
27896
27922
  const branch = job.ref ?? "main";
27897
27923
  const authUrl = `https://x-access-token:${job.githubToken}@github.com/${job.repo}.git`;
27898
- fs54.rmSync(workdir, { recursive: true, force: true });
27899
- fs54.mkdirSync(workdir, { recursive: true });
27924
+ fs55.rmSync(workdir, { recursive: true, force: true });
27925
+ fs55.mkdirSync(workdir, { recursive: true });
27900
27926
  const allSecrets = typeof job.allSecrets === "string" ? job.allSecrets : JSON.stringify(job.allSecrets ?? {});
27901
27927
  const target = job.runRequest.target;
27902
27928
  const interactive = target.type === "chat";
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.502",
3
+ "version": "0.4.504",
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
  "type": "module",
@@ -12,6 +12,29 @@
12
12
  "templates",
13
13
  "kody.config.schema.json"
14
14
  ],
15
+ "scripts": {
16
+ "kody:run": "tsx bin/kody.ts",
17
+ "serve": "tsx bin/kody.ts serve",
18
+ "serve:vscode": "tsx bin/kody.ts serve vscode",
19
+ "serve:claude": "tsx bin/kody.ts serve claude",
20
+ "clean:dist": "node scripts/clean-dist.cjs",
21
+ "build": "pnpm clean:dist && tsup && node scripts/copy-assets.cjs",
22
+ "check:modularity": "tsx scripts/check-script-modularity.ts",
23
+ "pretest": "pnpm check:modularity",
24
+ "test": "vitest run tests/unit tests/int --coverage",
25
+ "posttest": "tsx scripts/check-coverage-floor.ts",
26
+ "test:smoke": "vitest run tests/smoke --no-coverage",
27
+ "test:e2e": "vitest run tests/e2e --no-coverage",
28
+ "test:runtime-services": "node --test \"tests/runtime-services/*.test.mjs\"",
29
+ "test:all": "vitest run tests --no-coverage",
30
+ "typecheck": "tsc --noEmit",
31
+ "lint": "biome check",
32
+ "lint:fix": "biome check --write",
33
+ "format": "biome format --write",
34
+ "verify:package": "node scripts/verify-package-tarball.cjs",
35
+ "brain:publish": "docker buildx build --platform linux/amd64 -f runner/Dockerfile.brain --build-arg KODY_ENGINE_REF=$(git rev-parse HEAD) -t ghcr.io/${KODY_BRAIN_GHCR_OWNER:-aharonyaircohen}/kody-brain:latest --push runner",
36
+ "prepublishOnly": "pnpm typecheck && vitest run tests/unit tests/int --no-coverage && pnpm test:runtime-services && pnpm build && pnpm verify:package"
37
+ },
15
38
  "dependencies": {
16
39
  "@actions/cache": "^6.0.0",
17
40
  "@anthropic-ai/claude-agent-sdk": "0.2.119",
@@ -38,27 +61,5 @@
38
61
  "url": "git+https://github.com/aharonyaircohen/kody-engine.git"
39
62
  },
40
63
  "homepage": "https://github.com/aharonyaircohen/kody-engine",
41
- "bugs": "https://github.com/aharonyaircohen/kody-engine/issues",
42
- "scripts": {
43
- "kody:run": "tsx bin/kody.ts",
44
- "serve": "tsx bin/kody.ts serve",
45
- "serve:vscode": "tsx bin/kody.ts serve vscode",
46
- "serve:claude": "tsx bin/kody.ts serve claude",
47
- "clean:dist": "node scripts/clean-dist.cjs",
48
- "build": "pnpm clean:dist && tsup && node scripts/copy-assets.cjs",
49
- "check:modularity": "tsx scripts/check-script-modularity.ts",
50
- "pretest": "pnpm check:modularity",
51
- "test": "vitest run tests/unit tests/int --coverage",
52
- "posttest": "tsx scripts/check-coverage-floor.ts",
53
- "test:smoke": "vitest run tests/smoke --no-coverage",
54
- "test:e2e": "vitest run tests/e2e --no-coverage",
55
- "test:runtime-services": "node --test \"tests/runtime-services/*.test.mjs\"",
56
- "test:all": "vitest run tests --no-coverage",
57
- "typecheck": "tsc --noEmit",
58
- "lint": "biome check",
59
- "lint:fix": "biome check --write",
60
- "format": "biome format --write",
61
- "verify:package": "node scripts/verify-package-tarball.cjs",
62
- "brain:publish": "docker buildx build --platform linux/amd64 -f runner/Dockerfile.brain --build-arg KODY_ENGINE_REF=$(git rev-parse HEAD) -t ghcr.io/${KODY_BRAIN_GHCR_OWNER:-aharonyaircohen}/kody-brain:latest --push runner"
63
- }
64
- }
64
+ "bugs": "https://github.com/aharonyaircohen/kody-engine/issues"
65
+ }