@kody-ade/kody-engine-lite 0.1.141 → 0.1.142

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/cli.js +23 -3
  2. package/package.json +1 -1
package/dist/bin/cli.js CHANGED
@@ -5198,8 +5198,23 @@ async function pollReady(url, timeoutSec) {
5198
5198
  }
5199
5199
  return false;
5200
5200
  }
5201
+ async function waitForReady(url, timeoutSec, stdoutMatch) {
5202
+ const deadline = Date.now() + timeoutSec * 1e3;
5203
+ while (Date.now() < deadline) {
5204
+ if (stdoutMatch()) {
5205
+ logger.info(" Dev server stdout matched ready pattern");
5206
+ const httpTimeout = Math.min(15, Math.max(1, Math.floor((deadline - Date.now()) / 1e3)));
5207
+ return pollReady(url, httpTimeout);
5208
+ }
5209
+ await new Promise((r) => setTimeout(r, 500));
5210
+ }
5211
+ return false;
5212
+ }
5201
5213
  async function startDevServer(opts) {
5202
- const timeout = opts.readyTimeout ?? 30;
5214
+ const timeout = opts.readyTimeout ?? 60;
5215
+ const patternStr = opts.readyPattern ?? DEFAULT_READY_PATTERN;
5216
+ const pattern = new RegExp(patternStr, "i");
5217
+ const useStdoutDetection = Boolean(opts.readyPattern);
5203
5218
  const [cmd, ...args2] = opts.command.split(/\s+/);
5204
5219
  let child;
5205
5220
  try {
@@ -5216,8 +5231,10 @@ async function startDevServer(opts) {
5216
5231
  }
5217
5232
  let stdout = "";
5218
5233
  let stderr = "";
5234
+ let stdoutMatched = false;
5219
5235
  child.stdout?.on("data", (chunk) => {
5220
5236
  stdout += chunk.toString();
5237
+ if (!stdoutMatched && pattern.test(stdout)) stdoutMatched = true;
5221
5238
  });
5222
5239
  child.stderr?.on("data", (chunk) => {
5223
5240
  stderr += chunk.toString();
@@ -5227,7 +5244,7 @@ async function startDevServer(opts) {
5227
5244
  exited = true;
5228
5245
  });
5229
5246
  child.unref();
5230
- const ready = await pollReady(opts.url, timeout);
5247
+ const ready = useStdoutDetection ? await waitForReady(opts.url, timeout, () => stdoutMatched) : await pollReady(opts.url, timeout);
5231
5248
  if (!ready) {
5232
5249
  if (exited) {
5233
5250
  logger.warn(` Dev server exited before becoming ready`);
@@ -5254,10 +5271,12 @@ async function startDevServer(opts) {
5254
5271
  };
5255
5272
  return { ready, url: opts.url, pid, stop };
5256
5273
  }
5274
+ var DEFAULT_READY_PATTERN;
5257
5275
  var init_dev_server = __esm({
5258
5276
  "src/dev-server.ts"() {
5259
5277
  "use strict";
5260
5278
  init_logger();
5279
+ DEFAULT_READY_PATTERN = "Ready in|compiled|started server|Local:|localhost:";
5261
5280
  }
5262
5281
  });
5263
5282
 
@@ -5329,7 +5348,8 @@ async function executeAgentStage(ctx, def) {
5329
5348
  devServerHandle = await startDevServer({
5330
5349
  command: ds.command,
5331
5350
  url: ds.url,
5332
- readyTimeout: ds.readyTimeout ?? 30,
5351
+ readyTimeout: ds.readyTimeout ?? 60,
5352
+ readyPattern: ds.readyPattern ?? "Ready in|compiled|started server|Local:|localhost:",
5333
5353
  envVars
5334
5354
  });
5335
5355
  if (devServerHandle.ready) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine-lite",
3
- "version": "0.1.141",
3
+ "version": "0.1.142",
4
4
  "description": "Autonomous SDLC pipeline: Kody orchestration + Claude Code + LiteLLM",
5
5
  "license": "MIT",
6
6
  "type": "module",