@probelabs/visor 0.1.178 → 0.1.179

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 (94) hide show
  1. package/defaults/assistant.yaml +38 -16
  2. package/defaults/skills/code-explorer.yaml +8 -8
  3. package/dist/agent-protocol/tasks-cli-handler.d.ts.map +1 -1
  4. package/dist/agent-protocol/track-execution.d.ts.map +1 -1
  5. package/dist/defaults/assistant.yaml +38 -16
  6. package/dist/defaults/skills/code-explorer.yaml +8 -8
  7. package/dist/frontends/slack-frontend.d.ts +6 -0
  8. package/dist/frontends/slack-frontend.d.ts.map +1 -1
  9. package/dist/index.js +305 -87
  10. package/dist/output/traces/{run-2026-03-11T06-33-05-398Z.ndjson → run-2026-03-11T13-57-13-250Z.ndjson} +96 -96
  11. package/dist/output/traces/{run-2026-03-11T06-33-47-884Z.ndjson → run-2026-03-11T13-57-55-455Z.ndjson} +1932 -1932
  12. package/dist/providers/ai-check-provider.d.ts.map +1 -1
  13. package/dist/sdk/{a2a-frontend-WYBMBBYG.mjs → a2a-frontend-HKPCABGG.mjs} +2 -2
  14. package/dist/sdk/{a2a-frontend-U3PTNCLR.mjs → a2a-frontend-KJFLIZJT.mjs} +2 -2
  15. package/dist/sdk/{check-provider-registry-3DZOXYIA.mjs → check-provider-registry-EXP6DYGL.mjs} +5 -5
  16. package/dist/sdk/{check-provider-registry-T5J3H2N7.mjs → check-provider-registry-SYAHJMWJ.mjs} +5 -5
  17. package/dist/sdk/{check-provider-registry-ZX76MY2L.mjs → check-provider-registry-WKVXEZXA.mjs} +5 -5
  18. package/dist/sdk/{chunk-AK64Y6Y2.mjs → chunk-BFQUKQQI.mjs} +163 -124
  19. package/dist/sdk/chunk-BFQUKQQI.mjs.map +1 -0
  20. package/dist/sdk/{chunk-6YGCACBF.mjs → chunk-CHARL3TY.mjs} +2 -2
  21. package/dist/sdk/{chunk-6YGCACBF.mjs.map → chunk-CHARL3TY.mjs.map} +1 -1
  22. package/dist/sdk/{chunk-4ECMTCOM.mjs → chunk-DMUBFE4V.mjs} +2 -2
  23. package/dist/sdk/{chunk-B7XHSG3L.mjs → chunk-FTPLYUQ3.mjs} +163 -124
  24. package/dist/sdk/chunk-FTPLYUQ3.mjs.map +1 -0
  25. package/dist/sdk/{chunk-ANEKFNAS.mjs → chunk-JTRN5AR7.mjs} +163 -124
  26. package/dist/sdk/chunk-JTRN5AR7.mjs.map +1 -0
  27. package/dist/sdk/{chunk-ENSZDV3O.mjs → chunk-NNL5M6QR.mjs} +3 -3
  28. package/dist/sdk/{chunk-CDRKH5HH.mjs → chunk-OYHDBTKY.mjs} +2 -2
  29. package/dist/sdk/{chunk-KG6PM4OL.mjs → chunk-WSPF7FAK.mjs} +3 -3
  30. package/dist/sdk/{chunk-KG6PM4OL.mjs.map → chunk-WSPF7FAK.mjs.map} +1 -1
  31. package/dist/sdk/{chunk-WZS4ARZB.mjs → chunk-ZJYQMNPA.mjs} +3 -3
  32. package/dist/sdk/{failure-condition-evaluator-P3MS5DRL.mjs → failure-condition-evaluator-CBJ2DP4X.mjs} +3 -3
  33. package/dist/sdk/{failure-condition-evaluator-MMPKQGUA.mjs → failure-condition-evaluator-V2YGFRKO.mjs} +3 -3
  34. package/dist/sdk/{github-frontend-7RLEBJWG.mjs → github-frontend-4LM4NAZK.mjs} +3 -3
  35. package/dist/sdk/{github-frontend-QTKOYB56.mjs → github-frontend-VGU6PNQH.mjs} +3 -3
  36. package/dist/sdk/{host-I2TBBKD5.mjs → host-AMJG7BIE.mjs} +4 -4
  37. package/dist/sdk/{host-SE3MQHWG.mjs → host-XXPPPC76.mjs} +4 -4
  38. package/dist/sdk/{routing-2X6QF5IW.mjs → routing-W6AUOIGF.mjs} +4 -4
  39. package/dist/sdk/{routing-QHXBQS6X.mjs → routing-YAYBIVPL.mjs} +4 -4
  40. package/dist/sdk/{schedule-tool-R6JJIDZ6.mjs → schedule-tool-BVWTYA2Y.mjs} +5 -5
  41. package/dist/sdk/{schedule-tool-W4SQ334O.mjs → schedule-tool-OIVJDIDK.mjs} +5 -5
  42. package/dist/sdk/{schedule-tool-MKT5FZ6J.mjs → schedule-tool-T3PAV4N3.mjs} +5 -5
  43. package/dist/sdk/{schedule-tool-handler-AOMZV3Q3.mjs → schedule-tool-handler-AYJP3FGI.mjs} +5 -5
  44. package/dist/sdk/{schedule-tool-handler-MPJFLH4J.mjs → schedule-tool-handler-SJF4ZKSB.mjs} +5 -5
  45. package/dist/sdk/{schedule-tool-handler-WY7WCFE5.mjs → schedule-tool-handler-VOCVDJSM.mjs} +5 -5
  46. package/dist/sdk/sdk.js +214 -138
  47. package/dist/sdk/sdk.js.map +1 -1
  48. package/dist/sdk/sdk.mjs +4 -4
  49. package/dist/sdk/{slack-frontend-XKSIOUXB.mjs → slack-frontend-OWD7BSWF.mjs} +22 -3
  50. package/dist/sdk/slack-frontend-OWD7BSWF.mjs.map +1 -0
  51. package/dist/sdk/{trace-helpers-4ADQ4GB3.mjs → trace-helpers-FZAVMGTD.mjs} +2 -2
  52. package/dist/sdk/{trace-helpers-K47ZVJSU.mjs → trace-helpers-QL2B75AK.mjs} +2 -2
  53. package/dist/sdk/{track-execution-XTCZBUWX.mjs → track-execution-2Q66SXBZ.mjs} +20 -2
  54. package/dist/sdk/{track-execution-XTCZBUWX.mjs.map → track-execution-2Q66SXBZ.mjs.map} +1 -1
  55. package/dist/sdk/{workflow-check-provider-WHZP7BDF.mjs → workflow-check-provider-IXW6BMQA.mjs} +5 -5
  56. package/dist/sdk/{workflow-check-provider-WZN3B2S2.mjs → workflow-check-provider-JW43OGRQ.mjs} +5 -5
  57. package/dist/sdk/{workflow-check-provider-A3YH2UZJ.mjs → workflow-check-provider-ZG2JHKBH.mjs} +5 -5
  58. package/dist/traces/{run-2026-03-11T06-33-05-398Z.ndjson → run-2026-03-11T13-57-13-250Z.ndjson} +96 -96
  59. package/dist/traces/{run-2026-03-11T06-33-47-884Z.ndjson → run-2026-03-11T13-57-55-455Z.ndjson} +1932 -1932
  60. package/dist/utils/workspace-manager.d.ts +2 -0
  61. package/dist/utils/workspace-manager.d.ts.map +1 -1
  62. package/package.json +2 -2
  63. package/dist/sdk/chunk-AK64Y6Y2.mjs.map +0 -1
  64. package/dist/sdk/chunk-ANEKFNAS.mjs.map +0 -1
  65. package/dist/sdk/chunk-B7XHSG3L.mjs.map +0 -1
  66. package/dist/sdk/slack-frontend-XKSIOUXB.mjs.map +0 -1
  67. /package/dist/sdk/{a2a-frontend-U3PTNCLR.mjs.map → a2a-frontend-HKPCABGG.mjs.map} +0 -0
  68. /package/dist/sdk/{a2a-frontend-WYBMBBYG.mjs.map → a2a-frontend-KJFLIZJT.mjs.map} +0 -0
  69. /package/dist/sdk/{check-provider-registry-3DZOXYIA.mjs.map → check-provider-registry-EXP6DYGL.mjs.map} +0 -0
  70. /package/dist/sdk/{check-provider-registry-T5J3H2N7.mjs.map → check-provider-registry-SYAHJMWJ.mjs.map} +0 -0
  71. /package/dist/sdk/{check-provider-registry-ZX76MY2L.mjs.map → check-provider-registry-WKVXEZXA.mjs.map} +0 -0
  72. /package/dist/sdk/{chunk-4ECMTCOM.mjs.map → chunk-DMUBFE4V.mjs.map} +0 -0
  73. /package/dist/sdk/{chunk-ENSZDV3O.mjs.map → chunk-NNL5M6QR.mjs.map} +0 -0
  74. /package/dist/sdk/{chunk-CDRKH5HH.mjs.map → chunk-OYHDBTKY.mjs.map} +0 -0
  75. /package/dist/sdk/{chunk-WZS4ARZB.mjs.map → chunk-ZJYQMNPA.mjs.map} +0 -0
  76. /package/dist/sdk/{failure-condition-evaluator-MMPKQGUA.mjs.map → failure-condition-evaluator-CBJ2DP4X.mjs.map} +0 -0
  77. /package/dist/sdk/{failure-condition-evaluator-P3MS5DRL.mjs.map → failure-condition-evaluator-V2YGFRKO.mjs.map} +0 -0
  78. /package/dist/sdk/{github-frontend-7RLEBJWG.mjs.map → github-frontend-4LM4NAZK.mjs.map} +0 -0
  79. /package/dist/sdk/{github-frontend-QTKOYB56.mjs.map → github-frontend-VGU6PNQH.mjs.map} +0 -0
  80. /package/dist/sdk/{host-I2TBBKD5.mjs.map → host-AMJG7BIE.mjs.map} +0 -0
  81. /package/dist/sdk/{host-SE3MQHWG.mjs.map → host-XXPPPC76.mjs.map} +0 -0
  82. /package/dist/sdk/{routing-2X6QF5IW.mjs.map → routing-W6AUOIGF.mjs.map} +0 -0
  83. /package/dist/sdk/{routing-QHXBQS6X.mjs.map → routing-YAYBIVPL.mjs.map} +0 -0
  84. /package/dist/sdk/{schedule-tool-MKT5FZ6J.mjs.map → schedule-tool-BVWTYA2Y.mjs.map} +0 -0
  85. /package/dist/sdk/{schedule-tool-R6JJIDZ6.mjs.map → schedule-tool-OIVJDIDK.mjs.map} +0 -0
  86. /package/dist/sdk/{schedule-tool-W4SQ334O.mjs.map → schedule-tool-T3PAV4N3.mjs.map} +0 -0
  87. /package/dist/sdk/{schedule-tool-handler-AOMZV3Q3.mjs.map → schedule-tool-handler-AYJP3FGI.mjs.map} +0 -0
  88. /package/dist/sdk/{schedule-tool-handler-MPJFLH4J.mjs.map → schedule-tool-handler-SJF4ZKSB.mjs.map} +0 -0
  89. /package/dist/sdk/{schedule-tool-handler-WY7WCFE5.mjs.map → schedule-tool-handler-VOCVDJSM.mjs.map} +0 -0
  90. /package/dist/sdk/{trace-helpers-4ADQ4GB3.mjs.map → trace-helpers-FZAVMGTD.mjs.map} +0 -0
  91. /package/dist/sdk/{trace-helpers-K47ZVJSU.mjs.map → trace-helpers-QL2B75AK.mjs.map} +0 -0
  92. /package/dist/sdk/{workflow-check-provider-A3YH2UZJ.mjs.map → workflow-check-provider-IXW6BMQA.mjs.map} +0 -0
  93. /package/dist/sdk/{workflow-check-provider-WHZP7BDF.mjs.map → workflow-check-provider-JW43OGRQ.mjs.map} +0 -0
  94. /package/dist/sdk/{workflow-check-provider-WZN3B2S2.mjs.map → workflow-check-provider-ZG2JHKBH.mjs.map} +0 -0
package/dist/sdk/sdk.js CHANGED
@@ -704,7 +704,7 @@ var require_package = __commonJS({
704
704
  "package.json"(exports2, module2) {
705
705
  module2.exports = {
706
706
  name: "@probelabs/visor",
707
- version: "0.1.178",
707
+ version: "0.1.179",
708
708
  main: "dist/index.js",
709
709
  bin: {
710
710
  visor: "./dist/index.js"
@@ -823,7 +823,7 @@ var require_package = __commonJS({
823
823
  "@opentelemetry/sdk-node": "^0.203.0",
824
824
  "@opentelemetry/sdk-trace-base": "^1.30.1",
825
825
  "@opentelemetry/semantic-conventions": "^1.30.1",
826
- "@probelabs/probe": "^0.6.0-rc293",
826
+ "@probelabs/probe": "^0.6.0-rc294",
827
827
  "@types/commander": "^2.12.0",
828
828
  "@types/uuid": "^10.0.0",
829
829
  acorn: "^8.16.0",
@@ -1152,11 +1152,11 @@ function getTracer() {
1152
1152
  }
1153
1153
  async function withActiveSpan(name, attrs, fn) {
1154
1154
  const tracer = getTracer();
1155
- return await new Promise((resolve15, reject) => {
1155
+ return await new Promise((resolve16, reject) => {
1156
1156
  const callback = async (span) => {
1157
1157
  try {
1158
1158
  const res = await fn(span);
1159
- resolve15(res);
1159
+ resolve16(res);
1160
1160
  } catch (err) {
1161
1161
  try {
1162
1162
  if (err instanceof Error) span.recordException(err);
@@ -7158,7 +7158,7 @@ async function renderMermaidToPng(mermaidCode) {
7158
7158
  if (chromiumPath) {
7159
7159
  env.PUPPETEER_EXECUTABLE_PATH = chromiumPath;
7160
7160
  }
7161
- const result = await new Promise((resolve15) => {
7161
+ const result = await new Promise((resolve16) => {
7162
7162
  const proc = (0, import_child_process.spawn)(
7163
7163
  "npx",
7164
7164
  [
@@ -7188,13 +7188,13 @@ async function renderMermaidToPng(mermaidCode) {
7188
7188
  });
7189
7189
  proc.on("close", (code) => {
7190
7190
  if (code === 0) {
7191
- resolve15({ success: true });
7191
+ resolve16({ success: true });
7192
7192
  } else {
7193
- resolve15({ success: false, error: stderr || `Exit code ${code}` });
7193
+ resolve16({ success: false, error: stderr || `Exit code ${code}` });
7194
7194
  }
7195
7195
  });
7196
7196
  proc.on("error", (err) => {
7197
- resolve15({ success: false, error: err.message });
7197
+ resolve16({ success: false, error: err.message });
7198
7198
  });
7199
7199
  });
7200
7200
  if (!result.success) {
@@ -9471,7 +9471,7 @@ ${"=".repeat(60)}
9471
9471
  * Generate mock response for testing
9472
9472
  */
9473
9473
  async generateMockResponse(_prompt, _checkName, _schema) {
9474
- await new Promise((resolve15) => setTimeout(resolve15, 500));
9474
+ await new Promise((resolve16) => setTimeout(resolve16, 500));
9475
9475
  const name = (_checkName || "").toLowerCase();
9476
9476
  if (name.includes("extract-facts")) {
9477
9477
  const arr = Array.from({ length: 6 }, (_, i) => ({
@@ -9832,7 +9832,7 @@ var init_command_executor = __esm({
9832
9832
  * Execute command with stdin input
9833
9833
  */
9834
9834
  executeWithStdin(command, options) {
9835
- return new Promise((resolve15, reject) => {
9835
+ return new Promise((resolve16, reject) => {
9836
9836
  const childProcess = (0, import_child_process2.exec)(
9837
9837
  command,
9838
9838
  {
@@ -9844,7 +9844,7 @@ var init_command_executor = __esm({
9844
9844
  if (error && error.killed && (error.code === "ETIMEDOUT" || error.signal === "SIGTERM")) {
9845
9845
  reject(new Error(`Command timed out after ${options.timeout || 3e4}ms`));
9846
9846
  } else {
9847
- resolve15({
9847
+ resolve16({
9848
9848
  stdout: stdout || "",
9849
9849
  stderr: stderr || "",
9850
9850
  exitCode: error ? error.code || 1 : 0
@@ -9973,7 +9973,7 @@ async function rateLimitedFetch(url, options, rateLimitConfig) {
9973
9973
  logger.verbose(
9974
9974
  `[rate-limiter] 429 on ${url} (bucket: ${key}), retry ${attempt + 1}/${maxRetries} in ${delayMs}ms`
9975
9975
  );
9976
- await new Promise((resolve15) => setTimeout(resolve15, delayMs));
9976
+ await new Promise((resolve16) => setTimeout(resolve16, delayMs));
9977
9977
  }
9978
9978
  return fetch(url, options);
9979
9979
  }
@@ -10022,8 +10022,8 @@ var init_rate_limiter = __esm({
10022
10022
  return;
10023
10023
  }
10024
10024
  const waitMs = Math.ceil((1 - this.tokens) / this.refillRate);
10025
- return new Promise((resolve15) => {
10026
- const entry = { resolve: resolve15 };
10025
+ return new Promise((resolve16) => {
10026
+ const entry = { resolve: resolve16 };
10027
10027
  this.waitQueue.push(entry);
10028
10028
  setTimeout(() => {
10029
10029
  const idx = this.waitQueue.indexOf(entry);
@@ -10034,7 +10034,7 @@ var init_rate_limiter = __esm({
10034
10034
  if (this.tokens >= 1) {
10035
10035
  this.tokens -= 1;
10036
10036
  }
10037
- resolve15();
10037
+ resolve16();
10038
10038
  }, waitMs);
10039
10039
  });
10040
10040
  }
@@ -20341,10 +20341,28 @@ async function trackExecution(opts, executor) {
20341
20341
  );
20342
20342
  try {
20343
20343
  const result = await executor();
20344
+ let responseText = "Execution completed";
20345
+ try {
20346
+ const history = result?.reviewSummary?.history;
20347
+ if (history) {
20348
+ for (const outputs of Object.values(history)) {
20349
+ if (!Array.isArray(outputs)) continue;
20350
+ for (const out of outputs) {
20351
+ const text = out?.text;
20352
+ if (typeof text === "string" && text.trim().length > 0) {
20353
+ responseText = text.trim();
20354
+ break;
20355
+ }
20356
+ }
20357
+ if (responseText !== "Execution completed") break;
20358
+ }
20359
+ }
20360
+ } catch {
20361
+ }
20344
20362
  const completedMsg = {
20345
20363
  message_id: import_crypto2.default.randomUUID(),
20346
20364
  role: "agent",
20347
- parts: [{ text: "Execution completed" }]
20365
+ parts: [{ text: responseText }]
20348
20366
  };
20349
20367
  taskStore.updateTaskState(task.id, "completed", completedMsg);
20350
20368
  logger.info(`[TaskTracking] Task ${task.id} completed`);
@@ -22397,7 +22415,7 @@ var init_mcp_custom_sse_server = __esm({
22397
22415
  * Returns the actual bound port number
22398
22416
  */
22399
22417
  async start() {
22400
- return new Promise((resolve15, reject) => {
22418
+ return new Promise((resolve16, reject) => {
22401
22419
  try {
22402
22420
  this.server = import_http.default.createServer((req, res) => {
22403
22421
  this.handleRequest(req, res).catch((error) => {
@@ -22431,7 +22449,7 @@ var init_mcp_custom_sse_server = __esm({
22431
22449
  );
22432
22450
  }
22433
22451
  this.startKeepalive();
22434
- resolve15(this.port);
22452
+ resolve16(this.port);
22435
22453
  });
22436
22454
  } catch (error) {
22437
22455
  reject(error);
@@ -22494,7 +22512,7 @@ var init_mcp_custom_sse_server = __esm({
22494
22512
  logger.debug(
22495
22513
  `[CustomToolsSSEServer:${this.sessionId}] Grace period before stop: ${waitMs}ms (activeToolCalls=${this.activeToolCalls})`
22496
22514
  );
22497
- await new Promise((resolve15) => setTimeout(resolve15, waitMs));
22515
+ await new Promise((resolve16) => setTimeout(resolve16, waitMs));
22498
22516
  }
22499
22517
  }
22500
22518
  if (this.activeToolCalls > 0) {
@@ -22503,7 +22521,7 @@ var init_mcp_custom_sse_server = __esm({
22503
22521
  `[CustomToolsSSEServer:${this.sessionId}] Waiting for ${this.activeToolCalls} active tool call(s) before stop`
22504
22522
  );
22505
22523
  while (this.activeToolCalls > 0 && Date.now() - startedAt < effectiveDrainTimeoutMs) {
22506
- await new Promise((resolve15) => setTimeout(resolve15, 250));
22524
+ await new Promise((resolve16) => setTimeout(resolve16, 250));
22507
22525
  }
22508
22526
  if (this.activeToolCalls > 0) {
22509
22527
  logger.warn(
@@ -22528,21 +22546,21 @@ var init_mcp_custom_sse_server = __esm({
22528
22546
  }
22529
22547
  this.connections.clear();
22530
22548
  if (this.server) {
22531
- await new Promise((resolve15, reject) => {
22549
+ await new Promise((resolve16, reject) => {
22532
22550
  const timeout = setTimeout(() => {
22533
22551
  if (this.debug) {
22534
22552
  logger.debug(
22535
22553
  `[CustomToolsSSEServer:${this.sessionId}] Force closing server after timeout`
22536
22554
  );
22537
22555
  }
22538
- this.server?.close(() => resolve15());
22556
+ this.server?.close(() => resolve16());
22539
22557
  }, 5e3);
22540
22558
  this.server.close((error) => {
22541
22559
  clearTimeout(timeout);
22542
22560
  if (error) {
22543
22561
  reject(error);
22544
22562
  } else {
22545
- resolve15();
22563
+ resolve16();
22546
22564
  }
22547
22565
  });
22548
22566
  });
@@ -22999,7 +23017,7 @@ var init_mcp_custom_sse_server = __esm({
22999
23017
  logger.warn(
23000
23018
  `[CustomToolsSSEServer:${this.sessionId}] Tool ${toolName} failed (attempt ${attempt + 1}/${retryCount + 1}): ${errorMsg}. Retrying in ${delay}ms`
23001
23019
  );
23002
- await new Promise((resolve15) => setTimeout(resolve15, delay));
23020
+ await new Promise((resolve16) => setTimeout(resolve16, delay));
23003
23021
  attempt++;
23004
23022
  }
23005
23023
  }
@@ -23858,45 +23876,44 @@ ${preview}`);
23858
23876
  const aiConfig = {};
23859
23877
  if (config.ai) {
23860
23878
  const aiAny2 = config.ai;
23879
+ const resolveLiquid = async (val) => {
23880
+ if (typeof val !== "string" || !val.includes("{{")) return void 0;
23881
+ try {
23882
+ return (await this.liquidEngine.parseAndRender(val, {
23883
+ inputs: config.workflowInputs || {},
23884
+ env: process.env
23885
+ })).trim();
23886
+ } catch {
23887
+ return void 0;
23888
+ }
23889
+ };
23890
+ const resolveBool = async (val) => {
23891
+ const resolved = await resolveLiquid(val) ?? val;
23892
+ if (typeof resolved === "boolean") return resolved;
23893
+ if (typeof resolved === "string") return resolved === "true";
23894
+ return !!resolved;
23895
+ };
23861
23896
  const skipTransport = aiAny2.skip_transport_context === true;
23862
23897
  if (aiAny2.apiKey !== void 0) {
23863
23898
  aiConfig.apiKey = aiAny2.apiKey;
23864
23899
  }
23865
23900
  if (aiAny2.model !== void 0) {
23866
- let modelVal = String(aiAny2.model);
23867
- if (modelVal.includes("{{")) {
23868
- try {
23869
- const rendered = await this.liquidEngine.parseAndRender(modelVal, {
23870
- inputs: config.workflowInputs || {},
23871
- env: process.env
23872
- });
23873
- modelVal = rendered.trim();
23874
- } catch {
23875
- }
23876
- }
23901
+ const modelVal = await resolveLiquid(aiAny2.model) ?? String(aiAny2.model);
23877
23902
  if (modelVal) {
23878
23903
  aiConfig.model = modelVal;
23879
23904
  }
23880
23905
  }
23881
23906
  if (aiAny2.timeout !== void 0) {
23882
- aiConfig.timeout = aiAny2.timeout;
23907
+ const resolvedTimeout = await resolveLiquid(aiAny2.timeout) ?? aiAny2.timeout;
23908
+ aiConfig.timeout = Number(resolvedTimeout);
23883
23909
  }
23884
23910
  if (aiAny2.max_iterations !== void 0 || aiAny2.maxIterations !== void 0) {
23885
23911
  const raw = aiAny2.max_iterations ?? aiAny2.maxIterations;
23886
- aiConfig.maxIterations = Number(raw);
23912
+ const resolved = await resolveLiquid(raw) ?? raw;
23913
+ aiConfig.maxIterations = Number(resolved);
23887
23914
  }
23888
23915
  if (aiAny2.provider !== void 0) {
23889
- let providerVal = String(aiAny2.provider);
23890
- if (providerVal.includes("{{")) {
23891
- try {
23892
- const rendered = await this.liquidEngine.parseAndRender(providerVal, {
23893
- inputs: config.workflowInputs || {},
23894
- env: process.env
23895
- });
23896
- providerVal = rendered.trim();
23897
- } catch {
23898
- }
23899
- }
23916
+ const providerVal = await resolveLiquid(aiAny2.provider) ?? String(aiAny2.provider);
23900
23917
  if (providerVal) {
23901
23918
  aiConfig.provider = providerVal;
23902
23919
  }
@@ -23905,16 +23922,16 @@ ${preview}`);
23905
23922
  aiConfig.debug = aiAny2.debug;
23906
23923
  }
23907
23924
  if (aiAny2.enableDelegate !== void 0) {
23908
- aiConfig.enableDelegate = aiAny2.enableDelegate;
23925
+ aiConfig.enableDelegate = await resolveBool(aiAny2.enableDelegate);
23909
23926
  }
23910
23927
  if (aiAny2.enableTasks !== void 0) {
23911
- aiConfig.enableTasks = aiAny2.enableTasks;
23928
+ aiConfig.enableTasks = await resolveBool(aiAny2.enableTasks);
23912
23929
  }
23913
23930
  if (aiAny2.enableExecutePlan !== void 0) {
23914
- aiConfig.enableExecutePlan = aiAny2.enableExecutePlan;
23931
+ aiConfig.enableExecutePlan = await resolveBool(aiAny2.enableExecutePlan);
23915
23932
  }
23916
23933
  if (aiAny2.allowEdit !== void 0) {
23917
- aiConfig.allowEdit = aiAny2.allowEdit;
23934
+ aiConfig.allowEdit = await resolveBool(aiAny2.allowEdit);
23918
23935
  }
23919
23936
  if (aiAny2.allowedTools !== void 0) {
23920
23937
  aiConfig.allowedTools = aiAny2.allowedTools;
@@ -23923,20 +23940,20 @@ ${preview}`);
23923
23940
  );
23924
23941
  }
23925
23942
  if (aiAny2.disableTools !== void 0) {
23926
- aiConfig.disableTools = aiAny2.disableTools;
23943
+ aiConfig.disableTools = await resolveBool(aiAny2.disableTools);
23927
23944
  this.logDebug(`[AI Provider] Read disableTools from YAML: ${aiAny2.disableTools}`);
23928
23945
  }
23929
23946
  if (aiAny2.allowBash !== void 0) {
23930
- aiConfig.allowBash = aiAny2.allowBash;
23947
+ aiConfig.allowBash = await resolveBool(aiAny2.allowBash);
23931
23948
  }
23932
23949
  if (aiAny2.bashConfig !== void 0) {
23933
23950
  aiConfig.bashConfig = aiAny2.bashConfig;
23934
23951
  }
23935
23952
  if (aiAny2.search_delegate_provider !== void 0) {
23936
- aiConfig.search_delegate_provider = aiAny2.search_delegate_provider;
23953
+ aiConfig.search_delegate_provider = await resolveLiquid(aiAny2.search_delegate_provider) ?? aiAny2.search_delegate_provider;
23937
23954
  }
23938
23955
  if (aiAny2.search_delegate_model !== void 0) {
23939
- aiConfig.search_delegate_model = aiAny2.search_delegate_model;
23956
+ aiConfig.search_delegate_model = await resolveLiquid(aiAny2.search_delegate_model) ?? aiAny2.search_delegate_model;
23940
23957
  }
23941
23958
  if (aiAny2.completion_prompt !== void 0) {
23942
23959
  aiConfig.completionPrompt = aiAny2.completion_prompt;
@@ -24047,6 +24064,9 @@ ${preview}`);
24047
24064
  if (config.ai_max_iterations !== void 0 && aiConfig.maxIterations === void 0) {
24048
24065
  aiConfig.maxIterations = config.ai_max_iterations;
24049
24066
  }
24067
+ if (aiConfig.maxIterations === void 0 || Number.isNaN(aiConfig.maxIterations)) {
24068
+ aiConfig.maxIterations = 100;
24069
+ }
24050
24070
  const sharedLimiter = sessionInfo?._parentContext?.sharedConcurrencyLimiter;
24051
24071
  if (sharedLimiter) {
24052
24072
  aiConfig.concurrencyLimiter = sharedLimiter;
@@ -32662,8 +32682,8 @@ var require_util2 = __commonJS({
32662
32682
  function createDeferredPromise() {
32663
32683
  let res;
32664
32684
  let rej;
32665
- const promise = new Promise((resolve15, reject) => {
32666
- res = resolve15;
32685
+ const promise = new Promise((resolve16, reject) => {
32686
+ res = resolve16;
32667
32687
  rej = reject;
32668
32688
  });
32669
32689
  return { promise, resolve: res, reject: rej };
@@ -34168,8 +34188,8 @@ Content-Type: ${value.type || "application/octet-stream"}\r
34168
34188
  });
34169
34189
  }
34170
34190
  });
34171
- const busboyResolve = new Promise((resolve15, reject) => {
34172
- busboy.on("finish", resolve15);
34191
+ const busboyResolve = new Promise((resolve16, reject) => {
34192
+ busboy.on("finish", resolve16);
34173
34193
  busboy.on("error", (err) => reject(new TypeError(err)));
34174
34194
  });
34175
34195
  if (this.body !== null) for await (const chunk of consumeBody(this[kState].body)) busboy.write(chunk);
@@ -34703,9 +34723,9 @@ var require_dispatcher_base = __commonJS({
34703
34723
  }
34704
34724
  close(callback) {
34705
34725
  if (callback === void 0) {
34706
- return new Promise((resolve15, reject) => {
34726
+ return new Promise((resolve16, reject) => {
34707
34727
  this.close((err, data) => {
34708
- return err ? reject(err) : resolve15(data);
34728
+ return err ? reject(err) : resolve16(data);
34709
34729
  });
34710
34730
  });
34711
34731
  }
@@ -34743,12 +34763,12 @@ var require_dispatcher_base = __commonJS({
34743
34763
  err = null;
34744
34764
  }
34745
34765
  if (callback === void 0) {
34746
- return new Promise((resolve15, reject) => {
34766
+ return new Promise((resolve16, reject) => {
34747
34767
  this.destroy(err, (err2, data) => {
34748
34768
  return err2 ? (
34749
34769
  /* istanbul ignore next: should never error */
34750
34770
  reject(err2)
34751
- ) : resolve15(data);
34771
+ ) : resolve16(data);
34752
34772
  });
34753
34773
  });
34754
34774
  }
@@ -35810,16 +35830,16 @@ var require_client = __commonJS({
35810
35830
  return this[kNeedDrain] < 2;
35811
35831
  }
35812
35832
  async [kClose]() {
35813
- return new Promise((resolve15) => {
35833
+ return new Promise((resolve16) => {
35814
35834
  if (!this[kSize]) {
35815
- resolve15(null);
35835
+ resolve16(null);
35816
35836
  } else {
35817
- this[kClosedResolve] = resolve15;
35837
+ this[kClosedResolve] = resolve16;
35818
35838
  }
35819
35839
  });
35820
35840
  }
35821
35841
  async [kDestroy](err) {
35822
- return new Promise((resolve15) => {
35842
+ return new Promise((resolve16) => {
35823
35843
  const requests = this[kQueue].splice(this[kPendingIdx]);
35824
35844
  for (let i = 0; i < requests.length; i++) {
35825
35845
  const request = requests[i];
@@ -35830,7 +35850,7 @@ var require_client = __commonJS({
35830
35850
  this[kClosedResolve]();
35831
35851
  this[kClosedResolve] = null;
35832
35852
  }
35833
- resolve15();
35853
+ resolve16();
35834
35854
  };
35835
35855
  if (this[kHTTP2Session] != null) {
35836
35856
  util.destroy(this[kHTTP2Session], err);
@@ -36410,7 +36430,7 @@ var require_client = __commonJS({
36410
36430
  });
36411
36431
  }
36412
36432
  try {
36413
- const socket = await new Promise((resolve15, reject) => {
36433
+ const socket = await new Promise((resolve16, reject) => {
36414
36434
  client[kConnector]({
36415
36435
  host,
36416
36436
  hostname,
@@ -36422,7 +36442,7 @@ var require_client = __commonJS({
36422
36442
  if (err) {
36423
36443
  reject(err);
36424
36444
  } else {
36425
- resolve15(socket2);
36445
+ resolve16(socket2);
36426
36446
  }
36427
36447
  });
36428
36448
  });
@@ -37046,12 +37066,12 @@ upgrade: ${upgrade}\r
37046
37066
  cb();
37047
37067
  }
37048
37068
  }
37049
- const waitForDrain = () => new Promise((resolve15, reject) => {
37069
+ const waitForDrain = () => new Promise((resolve16, reject) => {
37050
37070
  assert(callback === null);
37051
37071
  if (socket[kError]) {
37052
37072
  reject(socket[kError]);
37053
37073
  } else {
37054
- callback = resolve15;
37074
+ callback = resolve16;
37055
37075
  }
37056
37076
  });
37057
37077
  if (client[kHTTPConnVersion] === "h2") {
@@ -37397,8 +37417,8 @@ var require_pool_base = __commonJS({
37397
37417
  if (this[kQueue].isEmpty()) {
37398
37418
  return Promise.all(this[kClients].map((c) => c.close()));
37399
37419
  } else {
37400
- return new Promise((resolve15) => {
37401
- this[kClosedResolve] = resolve15;
37420
+ return new Promise((resolve16) => {
37421
+ this[kClosedResolve] = resolve16;
37402
37422
  });
37403
37423
  }
37404
37424
  }
@@ -37976,7 +37996,7 @@ var require_readable = __commonJS({
37976
37996
  if (this.closed) {
37977
37997
  return Promise.resolve(null);
37978
37998
  }
37979
- return new Promise((resolve15, reject) => {
37999
+ return new Promise((resolve16, reject) => {
37980
38000
  const signalListenerCleanup = signal ? util.addAbortListener(signal, () => {
37981
38001
  this.destroy();
37982
38002
  }) : noop;
@@ -37985,7 +38005,7 @@ var require_readable = __commonJS({
37985
38005
  if (signal && signal.aborted) {
37986
38006
  reject(signal.reason || Object.assign(new Error("The operation was aborted"), { name: "AbortError" }));
37987
38007
  } else {
37988
- resolve15(null);
38008
+ resolve16(null);
37989
38009
  }
37990
38010
  }).on("error", noop).on("data", function(chunk) {
37991
38011
  limit -= chunk.length;
@@ -38007,11 +38027,11 @@ var require_readable = __commonJS({
38007
38027
  throw new TypeError("unusable");
38008
38028
  }
38009
38029
  assert(!stream[kConsume]);
38010
- return new Promise((resolve15, reject) => {
38030
+ return new Promise((resolve16, reject) => {
38011
38031
  stream[kConsume] = {
38012
38032
  type,
38013
38033
  stream,
38014
- resolve: resolve15,
38034
+ resolve: resolve16,
38015
38035
  reject,
38016
38036
  length: 0,
38017
38037
  body: []
@@ -38046,12 +38066,12 @@ var require_readable = __commonJS({
38046
38066
  }
38047
38067
  }
38048
38068
  function consumeEnd(consume2) {
38049
- const { type, body, resolve: resolve15, stream, length } = consume2;
38069
+ const { type, body, resolve: resolve16, stream, length } = consume2;
38050
38070
  try {
38051
38071
  if (type === "text") {
38052
- resolve15(toUSVString(Buffer.concat(body)));
38072
+ resolve16(toUSVString(Buffer.concat(body)));
38053
38073
  } else if (type === "json") {
38054
- resolve15(JSON.parse(Buffer.concat(body)));
38074
+ resolve16(JSON.parse(Buffer.concat(body)));
38055
38075
  } else if (type === "arrayBuffer") {
38056
38076
  const dst = new Uint8Array(length);
38057
38077
  let pos = 0;
@@ -38059,12 +38079,12 @@ var require_readable = __commonJS({
38059
38079
  dst.set(buf, pos);
38060
38080
  pos += buf.byteLength;
38061
38081
  }
38062
- resolve15(dst.buffer);
38082
+ resolve16(dst.buffer);
38063
38083
  } else if (type === "blob") {
38064
38084
  if (!Blob2) {
38065
38085
  Blob2 = require("buffer").Blob;
38066
38086
  }
38067
- resolve15(new Blob2(body, { type: stream[kContentType] }));
38087
+ resolve16(new Blob2(body, { type: stream[kContentType] }));
38068
38088
  }
38069
38089
  consumeFinish(consume2);
38070
38090
  } catch (err) {
@@ -38321,9 +38341,9 @@ var require_api_request = __commonJS({
38321
38341
  };
38322
38342
  function request(opts, callback) {
38323
38343
  if (callback === void 0) {
38324
- return new Promise((resolve15, reject) => {
38344
+ return new Promise((resolve16, reject) => {
38325
38345
  request.call(this, opts, (err, data) => {
38326
- return err ? reject(err) : resolve15(data);
38346
+ return err ? reject(err) : resolve16(data);
38327
38347
  });
38328
38348
  });
38329
38349
  }
@@ -38496,9 +38516,9 @@ var require_api_stream = __commonJS({
38496
38516
  };
38497
38517
  function stream(opts, factory, callback) {
38498
38518
  if (callback === void 0) {
38499
- return new Promise((resolve15, reject) => {
38519
+ return new Promise((resolve16, reject) => {
38500
38520
  stream.call(this, opts, factory, (err, data) => {
38501
- return err ? reject(err) : resolve15(data);
38521
+ return err ? reject(err) : resolve16(data);
38502
38522
  });
38503
38523
  });
38504
38524
  }
@@ -38779,9 +38799,9 @@ var require_api_upgrade = __commonJS({
38779
38799
  };
38780
38800
  function upgrade(opts, callback) {
38781
38801
  if (callback === void 0) {
38782
- return new Promise((resolve15, reject) => {
38802
+ return new Promise((resolve16, reject) => {
38783
38803
  upgrade.call(this, opts, (err, data) => {
38784
- return err ? reject(err) : resolve15(data);
38804
+ return err ? reject(err) : resolve16(data);
38785
38805
  });
38786
38806
  });
38787
38807
  }
@@ -38870,9 +38890,9 @@ var require_api_connect = __commonJS({
38870
38890
  };
38871
38891
  function connect(opts, callback) {
38872
38892
  if (callback === void 0) {
38873
- return new Promise((resolve15, reject) => {
38893
+ return new Promise((resolve16, reject) => {
38874
38894
  connect.call(this, opts, (err, data) => {
38875
- return err ? reject(err) : resolve15(data);
38895
+ return err ? reject(err) : resolve16(data);
38876
38896
  });
38877
38897
  });
38878
38898
  }
@@ -42495,7 +42515,7 @@ var require_fetch = __commonJS({
42495
42515
  async function dispatch({ body }) {
42496
42516
  const url = requestCurrentURL(request);
42497
42517
  const agent = fetchParams.controller.dispatcher;
42498
- return new Promise((resolve15, reject) => agent.dispatch(
42518
+ return new Promise((resolve16, reject) => agent.dispatch(
42499
42519
  {
42500
42520
  path: url.pathname + url.search,
42501
42521
  origin: url.origin,
@@ -42571,7 +42591,7 @@ var require_fetch = __commonJS({
42571
42591
  }
42572
42592
  }
42573
42593
  }
42574
- resolve15({
42594
+ resolve16({
42575
42595
  status,
42576
42596
  statusText,
42577
42597
  headersList: headers[kHeadersList],
@@ -42614,7 +42634,7 @@ var require_fetch = __commonJS({
42614
42634
  const val = headersList[n + 1].toString("latin1");
42615
42635
  headers[kHeadersList].append(key, val);
42616
42636
  }
42617
- resolve15({
42637
+ resolve16({
42618
42638
  status,
42619
42639
  statusText: STATUS_CODES[status],
42620
42640
  headersList: headers[kHeadersList],
@@ -46429,7 +46449,7 @@ var init_mcp_check_provider = __esm({
46429
46449
  logger.warn(
46430
46450
  `MCP ${transportName} failed (attempt ${attempt + 1}/${maxRetries + 1}), retrying in ${delay}ms: ${error instanceof Error ? error.message : String(error)}`
46431
46451
  );
46432
- await new Promise((resolve15) => setTimeout(resolve15, delay));
46452
+ await new Promise((resolve16) => setTimeout(resolve16, delay));
46433
46453
  attempt += 1;
46434
46454
  } finally {
46435
46455
  try {
@@ -46722,7 +46742,7 @@ async function acquirePromptLock() {
46722
46742
  );
46723
46743
  }, 1e4);
46724
46744
  try {
46725
- await new Promise((resolve15) => waiters.push(resolve15));
46745
+ await new Promise((resolve16) => waiters.push(resolve16));
46726
46746
  } finally {
46727
46747
  clearInterval(reminder);
46728
46748
  const waitedMs = Date.now() - queuedAt;
@@ -46741,7 +46761,7 @@ function releasePromptLock() {
46741
46761
  }
46742
46762
  async function interactivePrompt(options) {
46743
46763
  await acquirePromptLock();
46744
- return new Promise((resolve15, reject) => {
46764
+ return new Promise((resolve16, reject) => {
46745
46765
  const dbg = process.env.VISOR_DEBUG === "true";
46746
46766
  try {
46747
46767
  if (dbg) {
@@ -46828,12 +46848,12 @@ async function interactivePrompt(options) {
46828
46848
  };
46829
46849
  const finish = (value) => {
46830
46850
  cleanup();
46831
- resolve15(value);
46851
+ resolve16(value);
46832
46852
  };
46833
46853
  if (options.timeout && options.timeout > 0) {
46834
46854
  timeoutId = setTimeout(() => {
46835
46855
  cleanup();
46836
- if (defaultValue !== void 0) return resolve15(defaultValue);
46856
+ if (defaultValue !== void 0) return resolve16(defaultValue);
46837
46857
  return reject(new Error("Input timeout"));
46838
46858
  }, options.timeout);
46839
46859
  }
@@ -46965,7 +46985,7 @@ async function interactivePrompt(options) {
46965
46985
  });
46966
46986
  }
46967
46987
  async function simplePrompt(prompt) {
46968
- return new Promise((resolve15) => {
46988
+ return new Promise((resolve16) => {
46969
46989
  const rl = readline.createInterface({
46970
46990
  input: process.stdin,
46971
46991
  output: process.stdout
@@ -46981,7 +47001,7 @@ async function simplePrompt(prompt) {
46981
47001
  rl.question(`${prompt}
46982
47002
  > `, (answer) => {
46983
47003
  rl.close();
46984
- resolve15(answer.trim());
47004
+ resolve16(answer.trim());
46985
47005
  });
46986
47006
  });
46987
47007
  }
@@ -47149,7 +47169,7 @@ function isStdinAvailable() {
47149
47169
  return !process.stdin.isTTY;
47150
47170
  }
47151
47171
  async function readStdin(timeout, maxSize = 1024 * 1024) {
47152
- return new Promise((resolve15, reject) => {
47172
+ return new Promise((resolve16, reject) => {
47153
47173
  let data = "";
47154
47174
  let timeoutId;
47155
47175
  if (timeout) {
@@ -47176,7 +47196,7 @@ async function readStdin(timeout, maxSize = 1024 * 1024) {
47176
47196
  };
47177
47197
  const onEnd = () => {
47178
47198
  cleanup();
47179
- resolve15(data.trim());
47199
+ resolve16(data.trim());
47180
47200
  };
47181
47201
  const onError = (err) => {
47182
47202
  cleanup();
@@ -56533,8 +56553,8 @@ var init_workspace_manager = __esm({
56533
56553
  );
56534
56554
  if (this.cleanupRequested && this.activeOperations === 0) {
56535
56555
  logger.debug(`[Workspace] All references released, proceeding with deferred cleanup`);
56536
- for (const resolve15 of this.cleanupResolvers) {
56537
- resolve15();
56556
+ for (const resolve16 of this.cleanupResolvers) {
56557
+ resolve16();
56538
56558
  }
56539
56559
  this.cleanupResolvers = [];
56540
56560
  }
@@ -56581,8 +56601,32 @@ var init_workspace_manager = __esm({
56581
56601
  configuredMainProjectName || this.extractProjectName(this.originalPath)
56582
56602
  );
56583
56603
  this.usedNames.add(mainProjectName);
56584
- const mainProjectPath = path25.join(this.workspacePath, mainProjectName);
56604
+ let mainProjectPath = path25.join(this.workspacePath, mainProjectName);
56585
56605
  const isGitRepo = await this.isGitRepository(this.originalPath);
56606
+ if (isGitRepo) {
56607
+ try {
56608
+ await commandExecutor.execute(`git -C ${shellEscape(this.originalPath)} worktree prune`, {
56609
+ timeout: 15e3
56610
+ });
56611
+ } catch {
56612
+ }
56613
+ }
56614
+ let subdirOffset = "";
56615
+ if (isGitRepo) {
56616
+ const gitRootResult = await commandExecutor.execute(
56617
+ `git -C ${shellEscape(this.originalPath)} rev-parse --show-toplevel`,
56618
+ { timeout: 5e3 }
56619
+ );
56620
+ if (gitRootResult.exitCode === 0) {
56621
+ const gitRoot = gitRootResult.stdout.trim();
56622
+ const normalizedOriginal = path25.resolve(this.originalPath);
56623
+ const normalizedRoot = path25.resolve(gitRoot);
56624
+ if (normalizedOriginal !== normalizedRoot) {
56625
+ subdirOffset = path25.relative(normalizedRoot, normalizedOriginal);
56626
+ logger.info(`[Workspace] Original path is a subdirectory of git repo: ${subdirOffset}`);
56627
+ }
56628
+ }
56629
+ }
56586
56630
  if (isGitRepo) {
56587
56631
  const exists = await this.pathExists(mainProjectPath);
56588
56632
  if (exists) {
@@ -56616,6 +56660,18 @@ var init_workspace_manager = __esm({
56616
56660
  }
56617
56661
  }
56618
56662
  }
56663
+ const worktreeRootPath = mainProjectPath;
56664
+ if (subdirOffset) {
56665
+ mainProjectPath = path25.join(mainProjectPath, subdirOffset);
56666
+ logger.info(`[Workspace] Adjusted main project path to subdirectory: ${mainProjectPath}`);
56667
+ const subdirExists = await this.pathExists(mainProjectPath);
56668
+ if (!subdirExists) {
56669
+ logger.warn(
56670
+ `[Workspace] Subdirectory '${subdirOffset}' not found in worktree \u2014 falling back to worktree root`
56671
+ );
56672
+ mainProjectPath = path25.join(this.workspacePath, mainProjectName);
56673
+ }
56674
+ }
56619
56675
  try {
56620
56676
  const entries = await fsp2.readdir(this.workspacePath, { withFileTypes: true });
56621
56677
  for (const entry of entries) {
@@ -56631,7 +56687,8 @@ var init_workspace_manager = __esm({
56631
56687
  workspacePath: this.workspacePath,
56632
56688
  mainProjectPath,
56633
56689
  mainProjectName,
56634
- originalPath: this.originalPath
56690
+ originalPath: this.originalPath,
56691
+ worktreeRootPath
56635
56692
  };
56636
56693
  this.initialized = true;
56637
56694
  logger.info(`Workspace initialized: ${this.workspacePath}`);
@@ -56713,30 +56770,30 @@ var init_workspace_manager = __esm({
56713
56770
  );
56714
56771
  this.cleanupRequested = true;
56715
56772
  await Promise.race([
56716
- new Promise((resolve15) => {
56773
+ new Promise((resolve16) => {
56717
56774
  if (this.activeOperations === 0) {
56718
- resolve15();
56775
+ resolve16();
56719
56776
  } else {
56720
- this.cleanupResolvers.push(resolve15);
56777
+ this.cleanupResolvers.push(resolve16);
56721
56778
  }
56722
56779
  }),
56723
- new Promise((resolve15) => {
56780
+ new Promise((resolve16) => {
56724
56781
  setTimeout(() => {
56725
56782
  logger.warn(
56726
56783
  `[Workspace] Cleanup timeout after ${timeout}ms, proceeding anyway (${this.activeOperations} operations still active)`
56727
56784
  );
56728
- resolve15();
56785
+ resolve16();
56729
56786
  }, timeout);
56730
56787
  })
56731
56788
  ]);
56732
56789
  }
56733
56790
  try {
56734
56791
  if (this.mainProjectInfo) {
56735
- const mainProjectPath = this.mainProjectInfo.mainProjectPath;
56792
+ const worktreePath = this.mainProjectInfo.worktreeRootPath || this.mainProjectInfo.mainProjectPath;
56736
56793
  try {
56737
- const stats = await fsp2.lstat(mainProjectPath);
56794
+ const stats = await fsp2.lstat(worktreePath);
56738
56795
  if (!stats.isSymbolicLink()) {
56739
- await this.removeMainProjectWorktree(mainProjectPath);
56796
+ await this.removeMainProjectWorktree(worktreePath);
56740
56797
  }
56741
56798
  } catch {
56742
56799
  }
@@ -57140,8 +57197,8 @@ var init_fair_concurrency_limiter = __esm({
57140
57197
  );
57141
57198
  const queuedAt = Date.now();
57142
57199
  const effectiveTimeout = queueTimeout ?? 12e4;
57143
- return new Promise((resolve15, reject) => {
57144
- const entry = { resolve: resolve15, reject, queuedAt };
57200
+ return new Promise((resolve16, reject) => {
57201
+ const entry = { resolve: resolve16, reject, queuedAt };
57145
57202
  entry.reminder = setInterval(() => {
57146
57203
  const waited = Math.round((Date.now() - queuedAt) / 1e3);
57147
57204
  const curQueued = this._totalQueued();
@@ -58151,8 +58208,8 @@ var init_github_comments = __esm({
58151
58208
  * Update existing comment or create new one with collision detection
58152
58209
  */
58153
58210
  async updateOrCreateComment(owner, repo, prNumber, content, options = {}) {
58154
- return new Promise((resolve15, reject) => {
58155
- this._writeQueue = this._writeQueue.then(() => this._doUpdateOrCreate(owner, repo, prNumber, content, options)).then(resolve15, reject);
58211
+ return new Promise((resolve16, reject) => {
58212
+ this._writeQueue = this._writeQueue.then(() => this._doUpdateOrCreate(owner, repo, prNumber, content, options)).then(resolve16, reject);
58156
58213
  });
58157
58214
  }
58158
58215
  async _doUpdateOrCreate(owner, repo, prNumber, content, options = {}) {
@@ -58363,8 +58420,8 @@ ${content}
58363
58420
  * Sleep utility
58364
58421
  */
58365
58422
  sleep(ms) {
58366
- return new Promise((resolve15) => {
58367
- const t = setTimeout(resolve15, ms);
58423
+ return new Promise((resolve16) => {
58424
+ const t = setTimeout(resolve16, ms);
58368
58425
  if (typeof t.unref === "function") {
58369
58426
  try {
58370
58427
  t.unref();
@@ -58649,8 +58706,8 @@ ${end}`);
58649
58706
  async updateGroupedComment(ctx, comments, group, changedIds) {
58650
58707
  const existingLock = this.updateLocks.get(group);
58651
58708
  let resolveLock;
58652
- const ourLock = new Promise((resolve15) => {
58653
- resolveLock = resolve15;
58709
+ const ourLock = new Promise((resolve16) => {
58710
+ resolveLock = resolve16;
58654
58711
  });
58655
58712
  this.updateLocks.set(group, ourLock);
58656
58713
  try {
@@ -58981,7 +59038,7 @@ ${blocks}
58981
59038
  * Sleep utility for enforcing delays
58982
59039
  */
58983
59040
  sleep(ms) {
58984
- return new Promise((resolve15) => setTimeout(resolve15, ms));
59041
+ return new Promise((resolve16) => setTimeout(resolve16, ms));
58985
59042
  }
58986
59043
  };
58987
59044
  }
@@ -59378,7 +59435,16 @@ var init_slack_frontend = __esm({
59378
59435
  this.subs.push(
59379
59436
  bus.on("StateTransition", async (env) => {
59380
59437
  const ev = env && env.payload || env;
59381
- if (ev && (ev.to === "Completed" || ev.to === "Error")) {
59438
+ if (ev && ev.to === "Completed") {
59439
+ await this.finalizeReactions(ctx).catch(() => {
59440
+ });
59441
+ } else if (ev && ev.to === "Error") {
59442
+ if (!this.errorNotified) {
59443
+ await this.maybePostError(ctx, "Run failed", "Workflow finished with errors").catch(
59444
+ () => {
59445
+ }
59446
+ );
59447
+ }
59382
59448
  await this.finalizeReactions(ctx).catch(() => {
59383
59449
  });
59384
59450
  }
@@ -59388,7 +59454,7 @@ var init_slack_frontend = __esm({
59388
59454
  bus.on("Shutdown", async (env) => {
59389
59455
  const ev = env && env.payload || env;
59390
59456
  const message = ev?.error?.message || "Fatal error";
59391
- await this.maybePostError(ctx, "Run failed", message).catch(() => {
59457
+ await this.forcePostError(ctx, "Run failed", message).catch(() => {
59392
59458
  });
59393
59459
  })
59394
59460
  );
@@ -59514,6 +59580,16 @@ var init_slack_frontend = __esm({
59514
59580
  }
59515
59581
  async maybePostError(ctx, title, message, checkId) {
59516
59582
  if (this.errorNotified) return;
59583
+ return this.postErrorToSlack(ctx, title, message, checkId);
59584
+ }
59585
+ /**
59586
+ * Post error to Slack regardless of errorNotified flag.
59587
+ * Used for fatal/shutdown errors that must always reach the user.
59588
+ */
59589
+ async forcePostError(ctx, title, message, checkId) {
59590
+ return this.postErrorToSlack(ctx, title, message, checkId);
59591
+ }
59592
+ async postErrorToSlack(ctx, title, message, checkId) {
59517
59593
  const slack = this.getSlack(ctx);
59518
59594
  if (!slack) return;
59519
59595
  const payload = this.getInboundSlackPayload(ctx);
@@ -60843,11 +60919,11 @@ var require_request3 = __commonJS({
60843
60919
  "use strict";
60844
60920
  var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
60845
60921
  function adopt(value) {
60846
- return value instanceof P ? value : new P(function(resolve15) {
60847
- resolve15(value);
60922
+ return value instanceof P ? value : new P(function(resolve16) {
60923
+ resolve16(value);
60848
60924
  });
60849
60925
  }
60850
- return new (P || (P = Promise))(function(resolve15, reject) {
60926
+ return new (P || (P = Promise))(function(resolve16, reject) {
60851
60927
  function fulfilled(value) {
60852
60928
  try {
60853
60929
  step(generator.next(value));
@@ -60863,7 +60939,7 @@ var require_request3 = __commonJS({
60863
60939
  }
60864
60940
  }
60865
60941
  function step(result) {
60866
- result.done ? resolve15(result.value) : adopt(result.value).then(fulfilled, rejected);
60942
+ result.done ? resolve16(result.value) : adopt(result.value).then(fulfilled, rejected);
60867
60943
  }
60868
60944
  step((generator = generator.apply(thisArg, _arguments || [])).next());
60869
60945
  });
@@ -60992,7 +61068,7 @@ var require_request3 = __commonJS({
60992
61068
  }
60993
61069
  function sendWithRetry(url, init, retryScheduleInMs, nextInterval = 50, triesLeft = 2, fetchImpl = fetch, retryCount = 1) {
60994
61070
  return __awaiter(this, void 0, void 0, function* () {
60995
- const sleep = (interval) => new Promise((resolve15) => setTimeout(resolve15, interval));
61071
+ const sleep = (interval) => new Promise((resolve16) => setTimeout(resolve16, interval));
60996
61072
  try {
60997
61073
  const response = yield fetchImpl(url, init);
60998
61074
  if (triesLeft <= 0 || response.status < 500) {
@@ -70849,13 +70925,13 @@ __export(a2a_frontend_exports, {
70849
70925
  resultToArtifacts: () => resultToArtifacts
70850
70926
  });
70851
70927
  function readJsonBody(req) {
70852
- return new Promise((resolve15, reject) => {
70928
+ return new Promise((resolve16, reject) => {
70853
70929
  const chunks = [];
70854
70930
  req.on("data", (chunk) => chunks.push(chunk));
70855
70931
  req.on("end", () => {
70856
70932
  try {
70857
70933
  const body = Buffer.concat(chunks).toString("utf8");
70858
- resolve15(body ? JSON.parse(body) : {});
70934
+ resolve16(body ? JSON.parse(body) : {});
70859
70935
  } catch {
70860
70936
  reject(new ParseError("Malformed JSON body"));
70861
70937
  }
@@ -71098,12 +71174,12 @@ var init_a2a_frontend = __esm({
71098
71174
  }
71099
71175
  const port = this.config.port ?? 9e3;
71100
71176
  const host = this.config.host ?? "0.0.0.0";
71101
- await new Promise((resolve15) => {
71177
+ await new Promise((resolve16) => {
71102
71178
  this.server.listen(port, host, () => {
71103
71179
  const addr = this.server.address();
71104
71180
  this._boundPort = typeof addr === "object" && addr ? addr.port : port;
71105
71181
  logger.info(`A2A server listening on ${host}:${this._boundPort}`);
71106
- resolve15();
71182
+ resolve16();
71107
71183
  });
71108
71184
  });
71109
71185
  if (this.agentCard) {
@@ -71127,8 +71203,8 @@ var init_a2a_frontend = __esm({
71127
71203
  }
71128
71204
  this.streamManager.shutdown();
71129
71205
  if (this.server) {
71130
- await new Promise((resolve15, reject) => {
71131
- this.server.close((err) => err ? reject(err) : resolve15());
71206
+ await new Promise((resolve16, reject) => {
71207
+ this.server.close((err) => err ? reject(err) : resolve16());
71132
71208
  });
71133
71209
  this.server = null;
71134
71210
  }