@superblocksteam/cli 2.0.127 → 2.0.128-next.0

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 (107) hide show
  1. package/README.md +1 -1
  2. package/dist/{acorn-ZN7Q6UDZ.js → acorn-RVXTUPIU.js} +3 -3
  3. package/dist/{angular-J2MXKXGC.js → angular-3LHQBAFX.js} +3 -3
  4. package/dist/{api-PHWED3B7.js → api-GR5LHFUB.js} +4 -4
  5. package/dist/{babel-O4PIWZ7M.js → babel-EJ6IVCOP.js} +3 -3
  6. package/dist/{chunk-DY2NVAAD.js → chunk-342EVLJX.js} +4 -4
  7. package/dist/{chunk-JSU5Z7TV.js → chunk-5ZWYGXW4.js} +3 -3
  8. package/dist/{chunk-Q6V2WBCQ.js → chunk-7BPG477E.js} +3 -3
  9. package/dist/{chunk-N3OOJGMF.js → chunk-BLGSMTBW.js} +3 -3
  10. package/dist/{chunk-3VETL57J.js → chunk-CFDMQXWR.js} +630 -156
  11. package/dist/{chunk-3VETL57J.js.map → chunk-CFDMQXWR.js.map} +1 -1
  12. package/dist/{chunk-KKNY3RBN.js → chunk-ECZ3M77Z.js} +3 -3
  13. package/dist/{chunk-F4XRKALY.js → chunk-FSN6QRPE.js} +4 -4
  14. package/dist/{chunk-K3O6TE35.js → chunk-G53E6Y74.js} +6 -6
  15. package/dist/{chunk-4H7R7J2T.js → chunk-G7XWN6TU.js} +4 -4
  16. package/dist/{chunk-BN5U26VC.js → chunk-HJRKYDBU.js} +3 -3
  17. package/dist/{chunk-GUFH7U6O.js → chunk-HMNEAK2U.js} +6 -6
  18. package/dist/{chunk-Y3SSO7TF.js → chunk-HZ57BTBJ.js} +3 -3
  19. package/dist/{chunk-ZQZ76AD5.js → chunk-IZRSG265.js} +4 -4
  20. package/dist/{chunk-24JWMPGA.js → chunk-KSSU6DJH.js} +3 -3
  21. package/dist/{chunk-47KCZCU5.js → chunk-STZPIQ5B.js} +3 -3
  22. package/dist/{chunk-E5BF6ZNT.js → chunk-TVWA6CZX.js} +2 -2
  23. package/dist/{chunk-ZSID6E3B.js → chunk-WWRBGTXM.js} +3 -3
  24. package/dist/{cli-truncate-V3KAVMMO.js → cli-truncate-H3JAVDQT.js} +5 -5
  25. package/dist/commands/dev-parent.js +42 -10
  26. package/dist/commands/dev-parent.js.map +2 -2
  27. package/dist/{dd-trace-RM2ILFLC.js → dd-trace-HKBFCAGL.js} +7 -7
  28. package/dist/{dist-DMVFGUW4.js → dist-URDKB7G3.js} +13 -13
  29. package/dist/{embedded-playwright-mcp-server-UGIS3FHL.js → embedded-playwright-mcp-server-55KSMVXX.js} +3 -3
  30. package/dist/{enquirer-6OJQE3AT.js → enquirer-IR2EPTGY.js} +4 -4
  31. package/dist/{estree-TCD2UGUS.js → estree-XHRBZXDB.js} +3 -3
  32. package/dist/{flow-DTJ5KXYK.js → flow-PO73QWID.js} +3 -3
  33. package/dist/{getMachineId-bsd-6CQNZOWX.js → getMachineId-bsd-EFWKCDBV.js} +5 -5
  34. package/dist/{getMachineId-darwin-VRD623QA.js → getMachineId-darwin-Y7OUNXQ6.js} +5 -5
  35. package/dist/{getMachineId-linux-EL5FHQHK.js → getMachineId-linux-DWD2G4MU.js} +4 -4
  36. package/dist/{getMachineId-unsupported-RU6ZPPJV.js → getMachineId-unsupported-C4F6X6HP.js} +4 -4
  37. package/dist/{getMachineId-win-PUBLZQLL.js → getMachineId-win-YAXEWWSU.js} +5 -5
  38. package/dist/{glimmer-AER7O7UD.js → glimmer-YNVOZBDJ.js} +3 -3
  39. package/dist/{graphql-ZCGKT3ML.js → graphql-HFTLPD2K.js} +3 -3
  40. package/dist/{html-V3FHSD2D.js → html-EY72FROY.js} +3 -3
  41. package/dist/{http-2CUOSMCF.js → http-VFSP22FR.js} +12 -12
  42. package/dist/index.js +24 -20
  43. package/dist/index.js.map +1 -1
  44. package/dist/{jiti-ZVPDMBG2.js → jiti-MWCTYY5S.js} +3 -3
  45. package/dist/{log-update-Y476NEAV.js → log-update-MLASJTN5.js} +6 -6
  46. package/dist/{markdown-F4OH2TLC.js → markdown-BG67LRMX.js} +3 -3
  47. package/dist/{meriyah-7WDK4UW6.js → meriyah-3TDTM3WJ.js} +3 -3
  48. package/dist/{postcss-DWK3YRY3.js → postcss-YODQYYIW.js} +3 -3
  49. package/dist/{read-pkg-DM7BQWMA.js → read-pkg-RLPLKGXT.js} +5 -5
  50. package/dist/{spans-54HKADTB.js → spans-GAMVAAT5.js} +4 -4
  51. package/dist/{src-KMJE6Z3I.js → src-HJMFY2GS.js} +3 -3
  52. package/dist/{token-F25OBSDW.js → token-NGCVDZXF.js} +5 -5
  53. package/dist/{token-util-3CWH3NBE.js → token-util-RCTSISL4.js} +5 -5
  54. package/dist/{typescript-VF6VJIWL.js → typescript-GS5XECMQ.js} +3 -3
  55. package/dist/{wrap-ansi-YWN2NHPU.js → wrap-ansi-77EVEKZS.js} +5 -5
  56. package/dist/{yaml-JLRXP2CH.js → yaml-KLI3RE6K.js} +3 -3
  57. package/oclif.manifest.json +1 -1
  58. package/package.json +6 -6
  59. /package/dist/{acorn-ZN7Q6UDZ.js.map → acorn-RVXTUPIU.js.map} +0 -0
  60. /package/dist/{angular-J2MXKXGC.js.map → angular-3LHQBAFX.js.map} +0 -0
  61. /package/dist/{api-PHWED3B7.js.map → api-GR5LHFUB.js.map} +0 -0
  62. /package/dist/{babel-O4PIWZ7M.js.map → babel-EJ6IVCOP.js.map} +0 -0
  63. /package/dist/{chunk-DY2NVAAD.js.map → chunk-342EVLJX.js.map} +0 -0
  64. /package/dist/{chunk-JSU5Z7TV.js.map → chunk-5ZWYGXW4.js.map} +0 -0
  65. /package/dist/{chunk-Q6V2WBCQ.js.map → chunk-7BPG477E.js.map} +0 -0
  66. /package/dist/{chunk-N3OOJGMF.js.map → chunk-BLGSMTBW.js.map} +0 -0
  67. /package/dist/{chunk-KKNY3RBN.js.map → chunk-ECZ3M77Z.js.map} +0 -0
  68. /package/dist/{chunk-F4XRKALY.js.map → chunk-FSN6QRPE.js.map} +0 -0
  69. /package/dist/{chunk-K3O6TE35.js.map → chunk-G53E6Y74.js.map} +0 -0
  70. /package/dist/{chunk-4H7R7J2T.js.map → chunk-G7XWN6TU.js.map} +0 -0
  71. /package/dist/{chunk-BN5U26VC.js.map → chunk-HJRKYDBU.js.map} +0 -0
  72. /package/dist/{chunk-GUFH7U6O.js.map → chunk-HMNEAK2U.js.map} +0 -0
  73. /package/dist/{chunk-Y3SSO7TF.js.map → chunk-HZ57BTBJ.js.map} +0 -0
  74. /package/dist/{chunk-ZQZ76AD5.js.map → chunk-IZRSG265.js.map} +0 -0
  75. /package/dist/{chunk-24JWMPGA.js.map → chunk-KSSU6DJH.js.map} +0 -0
  76. /package/dist/{chunk-47KCZCU5.js.map → chunk-STZPIQ5B.js.map} +0 -0
  77. /package/dist/{chunk-E5BF6ZNT.js.map → chunk-TVWA6CZX.js.map} +0 -0
  78. /package/dist/{chunk-ZSID6E3B.js.map → chunk-WWRBGTXM.js.map} +0 -0
  79. /package/dist/{cli-truncate-V3KAVMMO.js.map → cli-truncate-H3JAVDQT.js.map} +0 -0
  80. /package/dist/{dd-trace-RM2ILFLC.js.map → dd-trace-HKBFCAGL.js.map} +0 -0
  81. /package/dist/{dist-DMVFGUW4.js.map → dist-URDKB7G3.js.map} +0 -0
  82. /package/dist/{embedded-playwright-mcp-server-UGIS3FHL.js.map → embedded-playwright-mcp-server-55KSMVXX.js.map} +0 -0
  83. /package/dist/{enquirer-6OJQE3AT.js.map → enquirer-IR2EPTGY.js.map} +0 -0
  84. /package/dist/{estree-TCD2UGUS.js.map → estree-XHRBZXDB.js.map} +0 -0
  85. /package/dist/{flow-DTJ5KXYK.js.map → flow-PO73QWID.js.map} +0 -0
  86. /package/dist/{getMachineId-bsd-6CQNZOWX.js.map → getMachineId-bsd-EFWKCDBV.js.map} +0 -0
  87. /package/dist/{getMachineId-darwin-VRD623QA.js.map → getMachineId-darwin-Y7OUNXQ6.js.map} +0 -0
  88. /package/dist/{getMachineId-linux-EL5FHQHK.js.map → getMachineId-linux-DWD2G4MU.js.map} +0 -0
  89. /package/dist/{getMachineId-unsupported-RU6ZPPJV.js.map → getMachineId-unsupported-C4F6X6HP.js.map} +0 -0
  90. /package/dist/{getMachineId-win-PUBLZQLL.js.map → getMachineId-win-YAXEWWSU.js.map} +0 -0
  91. /package/dist/{glimmer-AER7O7UD.js.map → glimmer-YNVOZBDJ.js.map} +0 -0
  92. /package/dist/{graphql-ZCGKT3ML.js.map → graphql-HFTLPD2K.js.map} +0 -0
  93. /package/dist/{html-V3FHSD2D.js.map → html-EY72FROY.js.map} +0 -0
  94. /package/dist/{http-2CUOSMCF.js.map → http-VFSP22FR.js.map} +0 -0
  95. /package/dist/{jiti-ZVPDMBG2.js.map → jiti-MWCTYY5S.js.map} +0 -0
  96. /package/dist/{log-update-Y476NEAV.js.map → log-update-MLASJTN5.js.map} +0 -0
  97. /package/dist/{markdown-F4OH2TLC.js.map → markdown-BG67LRMX.js.map} +0 -0
  98. /package/dist/{meriyah-7WDK4UW6.js.map → meriyah-3TDTM3WJ.js.map} +0 -0
  99. /package/dist/{postcss-DWK3YRY3.js.map → postcss-YODQYYIW.js.map} +0 -0
  100. /package/dist/{read-pkg-DM7BQWMA.js.map → read-pkg-RLPLKGXT.js.map} +0 -0
  101. /package/dist/{spans-54HKADTB.js.map → spans-GAMVAAT5.js.map} +0 -0
  102. /package/dist/{src-KMJE6Z3I.js.map → src-HJMFY2GS.js.map} +0 -0
  103. /package/dist/{token-F25OBSDW.js.map → token-NGCVDZXF.js.map} +0 -0
  104. /package/dist/{token-util-3CWH3NBE.js.map → token-util-RCTSISL4.js.map} +0 -0
  105. /package/dist/{typescript-VF6VJIWL.js.map → typescript-GS5XECMQ.js.map} +0 -0
  106. /package/dist/{wrap-ansi-YWN2NHPU.js.map → wrap-ansi-77EVEKZS.js.map} +0 -0
  107. /package/dist/{yaml-JLRXP2CH.js.map → yaml-KLI3RE6K.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  if (typeof process === 'object' && process !== null &&
2
2
  process.env !== null && typeof process.env === 'object') {
3
3
  process.env.DD_GIT_REPOSITORY_URL = 'https://token@github.com/superblocksteam/superblocks.git';
4
- process.env.DD_GIT_COMMIT_SHA = '25cc3037f32707a904e7459e80e958ca3ad1528d';
4
+ process.env.DD_GIT_COMMIT_SHA = '20de18b4be09a66317d3ef2bc2efbf8bfb1bbfa7';
5
5
  }
6
6
  import { createRequire as $dd_createRequire } from 'module';
7
7
  import { fileURLToPath as $dd_fileURLToPath } from 'url';
@@ -22,7 +22,7 @@ import {
22
22
  require_re,
23
23
  require_semver,
24
24
  require_valid
25
- } from "./chunk-KKNY3RBN.js";
25
+ } from "./chunk-ECZ3M77Z.js";
26
26
  import {
27
27
  debounce_default,
28
28
  get_default,
@@ -39,23 +39,23 @@ import {
39
39
  require_lib,
40
40
  require_slugify,
41
41
  throttle_default
42
- } from "./chunk-BN5U26VC.js";
42
+ } from "./chunk-HJRKYDBU.js";
43
43
  import {
44
44
  require_dd_trace,
45
45
  require_js_yaml,
46
46
  require_module_details_from_path,
47
47
  require_p_limit,
48
48
  require_path_to_regexp
49
- } from "./chunk-K3O6TE35.js";
49
+ } from "./chunk-G53E6Y74.js";
50
50
  import {
51
51
  require_commonjs
52
- } from "./chunk-24JWMPGA.js";
52
+ } from "./chunk-KSSU6DJH.js";
53
53
  import {
54
54
  require_dc_polyfill
55
- } from "./chunk-ZSID6E3B.js";
55
+ } from "./chunk-WWRBGTXM.js";
56
56
  import {
57
57
  require_token_error
58
- } from "./chunk-N3OOJGMF.js";
58
+ } from "./chunk-BLGSMTBW.js";
59
59
  import {
60
60
  SpanKind,
61
61
  SpanStatusCode,
@@ -65,7 +65,7 @@ import {
65
65
  init_esm,
66
66
  metrics,
67
67
  trace
68
- } from "./chunk-Y3SSO7TF.js";
68
+ } from "./chunk-HZ57BTBJ.js";
69
69
  import {
70
70
  __commonJS,
71
71
  __esm,
@@ -74,7 +74,7 @@ import {
74
74
  __toCommonJS,
75
75
  __toESM,
76
76
  init_cjs_shims
77
- } from "./chunk-E5BF6ZNT.js";
77
+ } from "./chunk-TVWA6CZX.js";
78
78
 
79
79
  // ../../../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js
80
80
  var require_constants3 = __commonJS({
@@ -97018,15 +97018,15 @@ var require_api_files = __commonJS({
97018
97018
  exports.readAppApiYamlFile = readAppApiYamlFile4;
97019
97019
  exports.resolveLanguageSpecificStepContentFromBlocks = resolveLanguageSpecificStepContentFromBlocks2;
97020
97020
  async function writeApiFiles3(...args) {
97021
- const esmFunction = await import("./api-PHWED3B7.js");
97021
+ const esmFunction = await import("./api-GR5LHFUB.js");
97022
97022
  return esmFunction.writeApiFiles(...args);
97023
97023
  }
97024
97024
  async function readAppApiYamlFile4(...args) {
97025
- const esmFunction = await import("./api-PHWED3B7.js");
97025
+ const esmFunction = await import("./api-GR5LHFUB.js");
97026
97026
  return esmFunction.readAppApiYamlFile(...args);
97027
97027
  }
97028
97028
  async function resolveLanguageSpecificStepContentFromBlocks2(...args) {
97029
- const esmFunction = await import("./api-PHWED3B7.js");
97029
+ const esmFunction = await import("./api-GR5LHFUB.js");
97030
97030
  return esmFunction.resolveLanguageSpecificStepContentFromBlocks(...args);
97031
97031
  }
97032
97032
  }
@@ -103616,19 +103616,19 @@ var require_getMachineId = __commonJS({
103616
103616
  if (!getMachineIdImpl) {
103617
103617
  switch (process5.platform) {
103618
103618
  case "darwin":
103619
- getMachineIdImpl = (await import("./getMachineId-darwin-VRD623QA.js")).getMachineId;
103619
+ getMachineIdImpl = (await import("./getMachineId-darwin-Y7OUNXQ6.js")).getMachineId;
103620
103620
  break;
103621
103621
  case "linux":
103622
- getMachineIdImpl = (await import("./getMachineId-linux-EL5FHQHK.js")).getMachineId;
103622
+ getMachineIdImpl = (await import("./getMachineId-linux-DWD2G4MU.js")).getMachineId;
103623
103623
  break;
103624
103624
  case "freebsd":
103625
- getMachineIdImpl = (await import("./getMachineId-bsd-6CQNZOWX.js")).getMachineId;
103625
+ getMachineIdImpl = (await import("./getMachineId-bsd-EFWKCDBV.js")).getMachineId;
103626
103626
  break;
103627
103627
  case "win32":
103628
- getMachineIdImpl = (await import("./getMachineId-win-PUBLZQLL.js")).getMachineId;
103628
+ getMachineIdImpl = (await import("./getMachineId-win-YAXEWWSU.js")).getMachineId;
103629
103629
  break;
103630
103630
  default:
103631
- getMachineIdImpl = (await import("./getMachineId-unsupported-RU6ZPPJV.js")).getMachineId;
103631
+ getMachineIdImpl = (await import("./getMachineId-unsupported-C4F6X6HP.js")).getMachineId;
103632
103632
  break;
103633
103633
  }
103634
103634
  }
@@ -182586,8 +182586,8 @@ var require_get_vercel_oidc_token = __commonJS({
182586
182586
  }
182587
182587
  try {
182588
182588
  const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
182589
- await import("./token-util-3CWH3NBE.js"),
182590
- await import("./token-F25OBSDW.js")
182589
+ await import("./token-util-RCTSISL4.js"),
182590
+ await import("./token-NGCVDZXF.js")
182591
182591
  ]);
182592
182592
  if (!token2 || isExpired(getTokenPayload(token2))) {
182593
182593
  await refreshToken();
@@ -213546,14 +213546,14 @@ var require_lib6 = __commonJS({
213546
213546
  };
213547
213547
  var mixinPluginNames = Object.keys(mixinPlugins);
213548
213548
  var ExpressionParser = class extends LValParser {
213549
- checkProto(prop2, isRecord, sawProto, refExpressionErrors) {
213549
+ checkProto(prop2, isRecord2, sawProto, refExpressionErrors) {
213550
213550
  if (prop2.type === "SpreadElement" || this.isObjectMethod(prop2) || prop2.computed || prop2.shorthand) {
213551
213551
  return sawProto;
213552
213552
  }
213553
213553
  const key2 = prop2.key;
213554
213554
  const name17 = key2.type === "Identifier" ? key2.name : key2.value;
213555
213555
  if (name17 === "__proto__") {
213556
- if (isRecord) {
213556
+ if (isRecord2) {
213557
213557
  this.raise(Errors.RecordNoProto, key2);
213558
213558
  return true;
213559
213559
  }
@@ -214611,8 +214611,8 @@ var require_lib6 = __commonJS({
214611
214611
  parseTemplateSubstitution() {
214612
214612
  return this.parseExpression();
214613
214613
  }
214614
- parseObjectLike(close, isPattern, isRecord, refExpressionErrors) {
214615
- if (isRecord) {
214614
+ parseObjectLike(close, isPattern, isRecord2, refExpressionErrors) {
214615
+ if (isRecord2) {
214616
214616
  this.expectPlugin("recordAndTuple");
214617
214617
  }
214618
214618
  const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
@@ -214637,9 +214637,9 @@ var require_lib6 = __commonJS({
214637
214637
  prop2 = this.parseBindingProperty();
214638
214638
  } else {
214639
214639
  prop2 = this.parsePropertyDefinition(refExpressionErrors);
214640
- sawProto = this.checkProto(prop2, isRecord, sawProto, refExpressionErrors);
214640
+ sawProto = this.checkProto(prop2, isRecord2, sawProto, refExpressionErrors);
214641
214641
  }
214642
- if (isRecord && !this.isObjectProperty(prop2) && prop2.type !== "SpreadElement") {
214642
+ if (isRecord2 && !this.isObjectProperty(prop2) && prop2.type !== "SpreadElement") {
214643
214643
  this.raise(Errors.InvalidRecordProperty, prop2);
214644
214644
  }
214645
214645
  if (prop2.shorthand) {
@@ -214652,7 +214652,7 @@ var require_lib6 = __commonJS({
214652
214652
  let type = "ObjectExpression";
214653
214653
  if (isPattern) {
214654
214654
  type = "ObjectPattern";
214655
- } else if (isRecord) {
214655
+ } else if (isRecord2) {
214656
214656
  type = "RecordExpression";
214657
214657
  }
214658
214658
  return this.finishNode(node, type);
@@ -437974,7 +437974,7 @@ var require_config_loader = __commonJS({
437974
437974
  * @returns {Promise<{createJiti: Function|undefined, version: string;}>} A promise that fulfills with an object containing the jiti module's createJiti function and version.
437975
437975
  */
437976
437976
  static async loadJiti() {
437977
- const { createJiti } = await import("./jiti-ZVPDMBG2.js");
437977
+ const { createJiti } = await import("./jiti-MWCTYY5S.js");
437978
437978
  const version4 = require_package5().version;
437979
437979
  return { createJiti, version: version4 };
437980
437980
  }
@@ -438303,7 +438303,7 @@ var require_eslint_helpers = __commonJS({
438303
438303
  }
438304
438304
  async function globMatch({ basePath, pattern }) {
438305
438305
  let found = false;
438306
- const { hfs } = await import("./src-KMJE6Z3I.js");
438306
+ const { hfs } = await import("./src-HJMFY2GS.js");
438307
438307
  const patternToUse = normalizeToPosix(path78.relative(basePath, pattern));
438308
438308
  const matcher = new Minimatch2(patternToUse, MINIMATCH_OPTIONS);
438309
438309
  const walkSettings = {
@@ -438343,7 +438343,7 @@ var require_eslint_helpers = __commonJS({
438343
438343
  return new Minimatch2(patternToUse, MINIMATCH_OPTIONS);
438344
438344
  });
438345
438345
  const unmatchedPatterns = /* @__PURE__ */ new Set([...relativeToPatterns.keys()]);
438346
- const { hfs } = await import("./src-KMJE6Z3I.js");
438346
+ const { hfs } = await import("./src-HJMFY2GS.js");
438347
438347
  const walk2 = hfs.walk(basePath, {
438348
438348
  async directoryFilter(entry) {
438349
438349
  if (!matchers.some((matcher) => matcher.match(entry.path, true))) {
@@ -494607,7 +494607,7 @@ init_cjs_shims();
494607
494607
  // ../sdk/package.json
494608
494608
  var package_default = {
494609
494609
  name: "@superblocksteam/sdk",
494610
- version: "2.0.127",
494610
+ version: "2.0.128-next.0",
494611
494611
  description: "Superblocks JS SDK",
494612
494612
  homepage: "https://www.superblocks.com",
494613
494613
  license: "Superblocks Community Software License",
@@ -494969,7 +494969,7 @@ var config = void 0;
494969
494969
  var configured = false;
494970
494970
  var ddTracePromise = void 0;
494971
494971
  async function getDdTrace() {
494972
- ddTracePromise ??= import("./dd-trace-RM2ILFLC.js").then((module) => module.default);
494972
+ ddTracePromise ??= import("./dd-trace-HKBFCAGL.js").then((module) => module.default);
494973
494973
  return await ddTracePromise;
494974
494974
  }
494975
494975
  var deploymentType = (() => {
@@ -499041,7 +499041,7 @@ init_cjs_shims();
499041
499041
 
499042
499042
  // ../../../vite-plugin-file-sync/dist/ai-service/index.js
499043
499043
  init_cjs_shims();
499044
- var import_ai17 = __toESM(require_dist9(), 1);
499044
+ var import_ai17 = __toESM(require_dist9());
499045
499045
  import { createHash as createHash5, randomUUID as randomUUID3 } from "node:crypto";
499046
499046
  import os6 from "node:os";
499047
499047
  import path50 from "node:path";
@@ -503478,7 +503478,7 @@ init_cjs_shims();
503478
503478
  init_cjs_shims();
503479
503479
 
503480
503480
  // ../../../vite-plugin-file-sync/dist/ai-service/index.js
503481
- var import_shared48 = __toESM(require_dist2(), 1);
503481
+ var import_shared48 = __toESM(require_dist2());
503482
503482
 
503483
503483
  // ../../../vite-plugin-file-sync/dist/migration/translation-prompt.js
503484
503484
  init_cjs_shims();
@@ -518590,6 +518590,203 @@ function buildThinkingProviderOptions(coreModel, params) {
518590
518590
  return { anthropic: anthropic3, bedrock, headers };
518591
518591
  }
518592
518592
 
518593
+ // ../../../clark/dist/snowflake-cortex-fetch.js
518594
+ init_cjs_shims();
518595
+ var HTTP_STATUS_TO_ERROR_TYPE = {
518596
+ 400: "invalid_request_error",
518597
+ 401: "authentication_error",
518598
+ 403: "permission_error",
518599
+ 404: "not_found_error",
518600
+ 429: "rate_limit_error",
518601
+ 500: "api_error",
518602
+ 529: "overloaded_error"
518603
+ };
518604
+ function normalizeErrorResponse(response, text3) {
518605
+ try {
518606
+ const body = JSON.parse(text3);
518607
+ if (body?.error && !body?.type) {
518608
+ const errorType = HTTP_STATUS_TO_ERROR_TYPE[response.status] ?? "api_error";
518609
+ return new Response(JSON.stringify({
518610
+ type: "error",
518611
+ error: {
518612
+ type: errorType,
518613
+ message: body.error.message ?? text3
518614
+ }
518615
+ }), {
518616
+ status: response.status,
518617
+ statusText: response.statusText,
518618
+ headers: response.headers
518619
+ });
518620
+ }
518621
+ } catch {
518622
+ }
518623
+ return new Response(text3, {
518624
+ status: response.status,
518625
+ statusText: response.statusText,
518626
+ headers: response.headers
518627
+ });
518628
+ }
518629
+ function normalizeSuccessfulResponseBody(value2) {
518630
+ if (Array.isArray(value2)) {
518631
+ return value2.map(normalizeSuccessfulResponseBody);
518632
+ }
518633
+ if (value2 && typeof value2 === "object") {
518634
+ return Object.fromEntries(Object.entries(value2).map(([key2, nestedValue]) => {
518635
+ if (key2 === "citations" && nestedValue === null) {
518636
+ return [key2, []];
518637
+ }
518638
+ if ((key2 === "cache_creation_input_tokens" || key2 === "cache_read_input_tokens") && nestedValue === null) {
518639
+ return [key2, 0];
518640
+ }
518641
+ return [key2, normalizeSuccessfulResponseBody(nestedValue)];
518642
+ }));
518643
+ }
518644
+ return value2;
518645
+ }
518646
+ function normalizeSuccessResponse(response, text3) {
518647
+ try {
518648
+ return new Response(JSON.stringify(normalizeSuccessfulResponseBody(JSON.parse(text3))), {
518649
+ status: response.status,
518650
+ statusText: response.statusText,
518651
+ headers: response.headers
518652
+ });
518653
+ } catch {
518654
+ return new Response(text3, {
518655
+ status: response.status,
518656
+ statusText: response.statusText,
518657
+ headers: response.headers
518658
+ });
518659
+ }
518660
+ }
518661
+ function stripCacheControl(value2) {
518662
+ if (Array.isArray(value2)) {
518663
+ return value2.map(stripCacheControl);
518664
+ }
518665
+ if (value2 && typeof value2 === "object") {
518666
+ return Object.fromEntries(Object.entries(value2).filter(([key2]) => key2 !== "cache_control").map(([key2, nested]) => [key2, stripCacheControl(nested)]));
518667
+ }
518668
+ return value2;
518669
+ }
518670
+ function stripCortexUnsupportedCacheControl(body) {
518671
+ if (!body || typeof body !== "object") {
518672
+ return body;
518673
+ }
518674
+ const result = {
518675
+ ...body
518676
+ };
518677
+ delete result.cache_control;
518678
+ if (Array.isArray(result.messages)) {
518679
+ result.messages = result.messages.map((message) => message && typeof message === "object" && message.role === "user" ? message : stripCacheControl(message));
518680
+ }
518681
+ if (Array.isArray(result.tools)) {
518682
+ result.tools = result.tools.map(stripCacheControl);
518683
+ }
518684
+ return result;
518685
+ }
518686
+ var UNSUPPORTED_SCHEMA_KEYWORDS = /* @__PURE__ */ new Set([
518687
+ "minLength",
518688
+ "maxLength",
518689
+ "pattern",
518690
+ "format",
518691
+ "minimum",
518692
+ "maximum",
518693
+ "exclusiveMinimum",
518694
+ "exclusiveMaximum",
518695
+ "multipleOf",
518696
+ "minItems",
518697
+ "maxItems",
518698
+ "uniqueItems",
518699
+ "contains",
518700
+ "minContains",
518701
+ "maxContains",
518702
+ "minProperties",
518703
+ "maxProperties",
518704
+ "patternProperties",
518705
+ "propertyNames"
518706
+ ]);
518707
+ var SCHEMA_MAP_KEYWORDS = /* @__PURE__ */ new Set(["properties", "$defs", "definitions"]);
518708
+ var OPAQUE_SCHEMA_KEYWORDS = /* @__PURE__ */ new Set([
518709
+ "enum",
518710
+ "const",
518711
+ "default",
518712
+ "examples"
518713
+ ]);
518714
+ function sanitizeJsonSchema(node) {
518715
+ if (Array.isArray(node)) {
518716
+ return node.map(sanitizeJsonSchema);
518717
+ }
518718
+ if (node && typeof node === "object") {
518719
+ const sanitized = {};
518720
+ for (const [key2, value2] of Object.entries(node)) {
518721
+ if (UNSUPPORTED_SCHEMA_KEYWORDS.has(key2)) {
518722
+ continue;
518723
+ }
518724
+ if (OPAQUE_SCHEMA_KEYWORDS.has(key2)) {
518725
+ sanitized[key2] = value2;
518726
+ } else if (SCHEMA_MAP_KEYWORDS.has(key2) && value2 && typeof value2 === "object" && !Array.isArray(value2)) {
518727
+ sanitized[key2] = Object.fromEntries(Object.entries(value2).map(([name17, subSchema]) => [name17, sanitizeJsonSchema(subSchema)]));
518728
+ } else {
518729
+ sanitized[key2] = sanitizeJsonSchema(value2);
518730
+ }
518731
+ }
518732
+ return sanitized;
518733
+ }
518734
+ return node;
518735
+ }
518736
+ function stripUnsupportedSchemaKeywords(value2) {
518737
+ if (Array.isArray(value2)) {
518738
+ return value2.map(stripUnsupportedSchemaKeywords);
518739
+ }
518740
+ if (value2 && typeof value2 === "object") {
518741
+ return Object.fromEntries(Object.entries(value2).map(([key2, nested]) => key2 === "input_schema" ? [key2, sanitizeJsonSchema(nested)] : [key2, stripUnsupportedSchemaKeywords(nested)]));
518742
+ }
518743
+ return value2;
518744
+ }
518745
+ function sanitizeRequestInit(init2, forwardCacheControl) {
518746
+ if (!init2 || typeof init2.body !== "string") {
518747
+ return init2;
518748
+ }
518749
+ try {
518750
+ const parsed = JSON.parse(init2.body);
518751
+ const afterCacheControl = forwardCacheControl ? stripCortexUnsupportedCacheControl(parsed) : stripCacheControl(parsed);
518752
+ const cleaned = stripUnsupportedSchemaKeywords(afterCacheControl);
518753
+ return { ...init2, body: JSON.stringify(cleaned) };
518754
+ } catch {
518755
+ return init2;
518756
+ }
518757
+ }
518758
+ function createSnowflakeCortexFetch({ forwardCacheControl, onPromptCachingRejected }) {
518759
+ return async (input, init2) => {
518760
+ let response = await globalThis.fetch(input, sanitizeRequestInit(init2, forwardCacheControl));
518761
+ if (forwardCacheControl && response.status === 400) {
518762
+ const text3 = await response.text();
518763
+ if (/cache_control/i.test(text3)) {
518764
+ onPromptCachingRejected?.();
518765
+ response = await globalThis.fetch(input, sanitizeRequestInit(init2, false));
518766
+ } else {
518767
+ return normalizeErrorResponse(new Response(text3, {
518768
+ status: response.status,
518769
+ statusText: response.statusText,
518770
+ headers: response.headers
518771
+ }), text3);
518772
+ }
518773
+ }
518774
+ if (!response.ok) {
518775
+ const text3 = await response.text();
518776
+ return normalizeErrorResponse(response, text3);
518777
+ }
518778
+ const contentType = response.headers.get("content-type") ?? "";
518779
+ if (contentType.includes("application/json")) {
518780
+ const text3 = await response.text();
518781
+ return normalizeSuccessResponse(response, text3);
518782
+ }
518783
+ return response;
518784
+ };
518785
+ }
518786
+ var snowflakeCortexFetch = createSnowflakeCortexFetch({
518787
+ forwardCacheControl: false
518788
+ });
518789
+
518593
518790
  // ../../../clark/dist/mcp/index.js
518594
518791
  init_cjs_shims();
518595
518792
 
@@ -520372,7 +520569,7 @@ var MAX_ATTRIBUTE_LENGTH = 64e3;
520372
520569
  var LLMObsSpanWriter = null;
520373
520570
  async function loadLLMObsSpanWriter() {
520374
520571
  if (!LLMObsSpanWriter) {
520375
- const module = await import("./spans-54HKADTB.js");
520572
+ const module = await import("./spans-GAMVAAT5.js");
520376
520573
  LLMObsSpanWriter = module.default;
520377
520574
  }
520378
520575
  return LLMObsSpanWriter;
@@ -550150,6 +550347,7 @@ ${filteredIntegrations.map((integration) => formatIntegrationForPlanPrompt(integ
550150
550347
  retry: {
550151
550348
  maxAttempts: 0
550152
550349
  },
550350
+ observers: services.streamObservers,
550153
550351
  onError: (error40) => {
550154
550352
  clark.logger.error("[exitPlanMode] LLM stream generation failed", getErrorMeta2(error40));
550155
550353
  }
@@ -550313,8 +550511,9 @@ var PLAN_TIME_ESTIMATES = {
550313
550511
  Large: "3 minutes",
550314
550512
  "Extra Large": "5+ minutes"
550315
550513
  };
550514
+ var EXIT_PLAN_MODE_PLAN_GENERATION_PROMPT_PREFIX = "Based on our conversation and the information gathered, create a specific, actionable plan.";
550316
550515
  var PLAN_GENERATION_PROMPT = `
550317
- Based on our conversation and the information gathered, create a specific, actionable plan.
550516
+ ${EXIT_PLAN_MODE_PLAN_GENERATION_PROMPT_PREFIX}
550318
550517
 
550319
550518
  IMPORTANT: You MUST output a plan. Even for trivial tasks, provide a brief plan describing what will be done.
550320
550519
 
@@ -551575,6 +551774,7 @@ var RpcTimeoutError = class extends Error {
551575
551774
  }
551576
551775
  };
551577
551776
  var DEFAULT_RPC_TIMEOUT_MS = 6e4;
551777
+ var FETCH_INTEGRATIONS_TIMEOUT_MS = 15e3;
551578
551778
  async function withRpcTimeout(promise2, timeoutMs = DEFAULT_RPC_TIMEOUT_MS, operationName = "RPC call") {
551579
551779
  let timeoutId;
551580
551780
  const timeoutPromise = new Promise((_4, reject) => {
@@ -552017,7 +552217,7 @@ var IntegrationStore = (() => {
552017
552217
  }
552018
552218
  async fetchIntegrations(editorClient, mentionedIntegrations) {
552019
552219
  getLogger3().info(`[integration-store] Fetching integrations from browser...`);
552020
- const integrations = await withRpcTimeout(editorClient?.call.aiGetIntegrations(), DEFAULT_RPC_TIMEOUT_MS, "aiGetIntegrations") ?? [];
552220
+ const integrations = await withRpcTimeout(editorClient?.call.aiGetIntegrations(), FETCH_INTEGRATIONS_TIMEOUT_MS, "aiGetIntegrations") ?? [];
552021
552221
  getLogger3().info(`[integration-store] Registering ${integrations.length} integrations`);
552022
552222
  for (const integration of integrations) {
552023
552223
  const pluginId = integration.type;
@@ -561438,6 +561638,11 @@ function wrapError(err, provider) {
561438
561638
  const underlyingError = new LLMProviderError({
561439
561639
  provider,
561440
561640
  message: err.message,
561641
+ // A StallTimeoutError carries no provider ErrorCategory, so the constructor
561642
+ // would default it to "api_error" and surface the generic model-error
561643
+ // string. Classify exhausted stalls as "stall" so the user gets a
561644
+ // stall-specific message and observability can distinguish them (APPS-4389).
561645
+ type: err.cause instanceof StallTimeoutError ? "stall" : void 0,
561441
561646
  cause: err.cause
561442
561647
  });
561443
561648
  underlyingError.isRetryable = false;
@@ -601513,6 +601718,13 @@ init_cjs_shims();
601513
601718
 
601514
601719
  // ../../../vite-plugin-file-sync/dist/ai-service/llm/stream/config.js
601515
601720
  init_cjs_shims();
601721
+ var SERVER_CONTEXT_COMPACTION_FIRST_CHUNK_TIMEOUT_MS = 24e4;
601722
+ function defaultFirstChunkTimeoutMs(serverSideContextManagement, idleTimeoutMs) {
601723
+ return serverSideContextManagement ? Math.max(idleTimeoutMs, SERVER_CONTEXT_COMPACTION_FIRST_CHUNK_TIMEOUT_MS) : idleTimeoutMs;
601724
+ }
601725
+ function defaultFallbackStrategy(provider) {
601726
+ return provider === "snowflake" ? "provider-then-model-no-retry" : "model-then-provider";
601727
+ }
601516
601728
  var StreamConfig = class _StreamConfig {
601517
601729
  _retry;
601518
601730
  _provider;
@@ -601533,8 +601745,21 @@ var StreamConfig = class _StreamConfig {
601533
601745
  const retry = {
601534
601746
  maxAttempts: options8.retry?.maxAttempts ?? 5,
601535
601747
  maxAttemptsPerProvider: options8.retry?.maxAttemptsPerProvider ?? 2,
601748
+ // Generic default for callers with no server-side context management.
601749
+ // Like firstChunkTimeoutMs below, StreamConfig stays agnostic and does
601750
+ // NOT floor this against the proxy upstream-stall timeout — callers that
601751
+ // run behind the proxy must pass a value >= the proxy stall budget so a
601752
+ // single upstream stall can't exhaust the retry clock (LLMClient does
601753
+ // this via Math.max(..., proxyStallTimeoutMs)). See APPS-4520.
601536
601754
  maxTotalTimeMs: options8.retry?.maxTotalTimeMs ?? 12e4,
601537
601755
  idleTimeoutMs: options8.retry?.idleTimeoutMs ?? 9e4,
601756
+ // Defaults to the inter-chunk idle budget so generic callers see no
601757
+ // behavior change. StreamConfig is context-management-agnostic and does
601758
+ // NOT itself apply the larger server-side first-chunk budget — callers
601759
+ // that opt into server-side context management must pass a value derived
601760
+ // from `defaultFirstChunkTimeoutMs(serverSide, idleTimeoutMs)` (LLMClient
601761
+ // does this). See APPS-4520.
601762
+ firstChunkTimeoutMs: options8.retry?.firstChunkTimeoutMs ?? options8.retry?.idleTimeoutMs ?? 9e4,
601538
601763
  initialDelayMs: options8.retry?.initialDelayMs ?? 500,
601539
601764
  maxDelayMs: options8.retry?.maxDelayMs ?? 1e4,
601540
601765
  backoffMultiplier: options8.retry?.backoffMultiplier ?? 2
@@ -601545,7 +601770,7 @@ var StreamConfig = class _StreamConfig {
601545
601770
  };
601546
601771
  const fallback = {
601547
601772
  enabled: options8.fallback?.enabled ?? false,
601548
- strategy: options8.fallback?.strategy ?? "model-then-provider",
601773
+ strategy: options8.fallback?.strategy ?? defaultFallbackStrategy(options8.provider),
601549
601774
  fallbackProviders: options8.fallback?.fallbackProviders
601550
601775
  };
601551
601776
  const logging = {
@@ -601581,21 +601806,36 @@ init_cjs_shims();
601581
601806
  var IdleMonitor = class {
601582
601807
  session;
601583
601808
  maxIdleTimeMs;
601809
+ firstChunkTimeoutMs;
601584
601810
  onStallCallback;
601811
+ onServerCompactionStart;
601585
601812
  timer = null;
601586
601813
  stallError = null;
601587
601814
  stallCallbacks = [];
601588
601815
  subscribed = false;
601816
+ hasReceivedChunk = false;
601817
+ compactionTextBlockIds = /* @__PURE__ */ new Set();
601589
601818
  constructor(options8) {
601590
601819
  this.session = options8.session;
601591
601820
  this.maxIdleTimeMs = options8.maxIdleTimeMs;
601821
+ this.firstChunkTimeoutMs = options8.firstChunkTimeoutMs ?? options8.maxIdleTimeMs;
601592
601822
  this.onStallCallback = options8.onStall;
601823
+ this.onServerCompactionStart = options8.onServerCompactionStart;
601824
+ }
601825
+ /**
601826
+ * Active budget: the first-chunk budget until useful output arrives, then
601827
+ * the inter-chunk idle budget.
601828
+ */
601829
+ currentTimeoutMs() {
601830
+ return this.hasReceivedChunk ? this.maxIdleTimeMs : this.firstChunkTimeoutMs;
601593
601831
  }
601594
601832
  /**
601595
601833
  * Start the idle monitor. Arms the timer and subscribes to session events.
601596
601834
  */
601597
601835
  start() {
601598
601836
  this.stallError = null;
601837
+ this.hasReceivedChunk = false;
601838
+ this.compactionTextBlockIds.clear();
601599
601839
  this.session.resetActivityTimer();
601600
601840
  this.subscribeToEvents();
601601
601841
  this.armTimer();
@@ -601637,17 +601877,30 @@ var IdleMonitor = class {
601637
601877
  }
601638
601878
  this.subscribed = true;
601639
601879
  this.session.events.on("chunk", this.handleChunk);
601880
+ this.session.events.on("step:start", this.handleStepStart);
601640
601881
  this.session.events.on("retry", this.handleRetry);
601641
601882
  this.session.events.on("session:complete", this.handleSessionEnd);
601642
601883
  this.session.events.on("session:error", this.handleSessionEnd);
601643
601884
  this.session.events.on("session:abort", this.handleSessionEnd);
601644
601885
  }
601645
- handleChunk = () => {
601886
+ handleChunk = (chunk) => {
601887
+ if (!this.keepsFirstChunkBudget(chunk)) {
601888
+ this.hasReceivedChunk = true;
601889
+ }
601646
601890
  this.stallError = null;
601647
601891
  this.stallCallbacks = [];
601648
601892
  this.armTimer();
601649
601893
  };
601894
+ handleStepStart = () => {
601895
+ this.hasReceivedChunk = false;
601896
+ this.compactionTextBlockIds.clear();
601897
+ this.stallError = null;
601898
+ this.session.resetActivityTimer();
601899
+ this.armTimer();
601900
+ };
601650
601901
  handleRetry = () => {
601902
+ this.hasReceivedChunk = false;
601903
+ this.compactionTextBlockIds.clear();
601651
601904
  this.stallError = null;
601652
601905
  this.stallCallbacks = [];
601653
601906
  this.session.resetActivityTimer();
@@ -601662,14 +601915,39 @@ var IdleMonitor = class {
601662
601915
  }
601663
601916
  this.timer = setTimeout(() => {
601664
601917
  this.fireStall();
601665
- }, this.maxIdleTimeMs);
601918
+ }, this.currentTimeoutMs());
601919
+ }
601920
+ keepsFirstChunkBudget(chunk) {
601921
+ if (chunk.type === "raw" && this.compactionTextBlockIds.size > 0) {
601922
+ return true;
601923
+ }
601924
+ if (chunk.type === "text-start") {
601925
+ const id2 = getChunkTextId(chunk);
601926
+ if (id2 && isAnthropicCompactionMetadata(chunk.providerMetadata)) {
601927
+ if (!this.compactionTextBlockIds.has(id2)) {
601928
+ this.compactionTextBlockIds.add(id2);
601929
+ this.onServerCompactionStart?.(id2);
601930
+ }
601931
+ return true;
601932
+ }
601933
+ }
601934
+ if (chunk.type === "text-delta" || chunk.type === "text-end") {
601935
+ const id2 = getChunkTextId(chunk);
601936
+ if (id2 && this.compactionTextBlockIds.has(id2)) {
601937
+ if (chunk.type === "text-end") {
601938
+ this.compactionTextBlockIds.delete(id2);
601939
+ }
601940
+ return true;
601941
+ }
601942
+ }
601943
+ return false;
601666
601944
  }
601667
601945
  fireStall() {
601668
601946
  if (!this.session.isPending()) {
601669
601947
  return;
601670
601948
  }
601671
601949
  const idleTime = this.session.getTimeSinceLastActivity();
601672
- this.stallError = new StallTimeoutError(idleTime, this.maxIdleTimeMs);
601950
+ this.stallError = new StallTimeoutError(idleTime, this.currentTimeoutMs());
601673
601951
  try {
601674
601952
  this.onStallCallback?.(this.stallError);
601675
601953
  } catch {
@@ -601680,6 +601958,19 @@ var IdleMonitor = class {
601680
601958
  this.stallCallbacks = [];
601681
601959
  }
601682
601960
  };
601961
+ function getChunkTextId(chunk) {
601962
+ return "id" in chunk && typeof chunk.id === "string" ? chunk.id : void 0;
601963
+ }
601964
+ function isAnthropicCompactionMetadata(metadata) {
601965
+ if (!isRecord(metadata)) {
601966
+ return false;
601967
+ }
601968
+ const anthropic3 = metadata.anthropic;
601969
+ return isRecord(anthropic3) && anthropic3.type === "compaction";
601970
+ }
601971
+ function isRecord(value2) {
601972
+ return typeof value2 === "object" && value2 !== null;
601973
+ }
601683
601974
 
601684
601975
  // ../../../vite-plugin-file-sync/dist/ai-service/llm/stream/managed-stream.js
601685
601976
  init_cjs_shims();
@@ -601706,14 +601997,16 @@ function createManagedStream(source2, session, idleMonitor) {
601706
601997
  void session.events.emit("chunk", result.value, session);
601707
601998
  continue;
601708
601999
  }
601709
- session.recordChunk();
601710
- void session.events.emit("chunk", result.value, session);
601711
602000
  if (result.value.type === "error") {
601712
602001
  const chunkError = result.value.error;
602002
+ session.resetActivityTimer();
602003
+ void session.events.emit("chunk", result.value, session);
601713
602004
  closed = true;
601714
602005
  controller.error(chunkError);
601715
602006
  return;
601716
602007
  }
602008
+ session.recordChunk();
602009
+ void session.events.emit("chunk", result.value, session);
601717
602010
  controller.enqueue(result.value);
601718
602011
  return;
601719
602012
  } catch (error40) {
@@ -601792,11 +602085,6 @@ var RetryEngine = class {
601792
602085
  }
601793
602086
  return { shouldRetry: false, delayMs: 0, reason: "non-retryable" };
601794
602087
  }
601795
- const timeSinceActivity = session.getTimeSinceLastActivity();
601796
- const { maxTotalTimeMs } = this.config.retry;
601797
- if (timeSinceActivity >= maxTotalTimeMs) {
601798
- return { shouldRetry: false, delayMs: 0, reason: "max-time" };
601799
- }
601800
602088
  const { maxAttempts } = this.config.retry;
601801
602089
  if (session.attempt >= maxAttempts) {
601802
602090
  return { shouldRetry: false, delayMs: 0, reason: "max-attempts" };
@@ -601810,6 +602098,11 @@ var RetryEngine = class {
601810
602098
  }
601811
602099
  return { shouldRetry: false, delayMs: 0, reason: "max-attempts" };
601812
602100
  }
602101
+ const timeSinceContent = session.getTimeSinceLastContent();
602102
+ const { maxTotalTimeMs } = this.config.retry;
602103
+ if (timeSinceContent >= maxTotalTimeMs) {
602104
+ return { shouldRetry: false, delayMs: 0, reason: "max-time" };
602105
+ }
601813
602106
  const delayMs = this.calculateDelay(session.attempt);
601814
602107
  return { shouldRetry: true, delayMs };
601815
602108
  }
@@ -602020,12 +602313,17 @@ var StreamSession = class {
602020
602313
  };
602021
602314
  error = null;
602022
602315
  outcome = "pending";
602023
- // tracks when we last received a chunk or started a retry, used for max-time checks.
602316
+ // tracks when we last received a chunk, keep-alive, or started a retry; used
602317
+ // for IdleMonitor liveness checks. NOT the retry max-time budget — that now
602318
+ // measures getTimeSinceLastContent() so keep-alives can't extend it (APPS-4641).
602024
602319
  lastActivityTime;
602320
+ // tracks when we last received a content chunk (NOT reset by keep-alives or retries).
602321
+ lastContentTime;
602025
602322
  constructor(options8) {
602026
602323
  this.id = crypto.randomUUID();
602027
602324
  this.startTime = Date.now();
602028
602325
  this.lastActivityTime = this.startTime;
602326
+ this.lastContentTime = this.startTime;
602029
602327
  this.config = options8.config;
602030
602328
  this.provider = options8.initialProvider;
602031
602329
  this.organizationId = options8.organizationId;
@@ -602082,6 +602380,7 @@ var StreamSession = class {
602082
602380
  }
602083
602381
  this.metrics.chunkCount++;
602084
602382
  this.lastActivityTime = Date.now();
602383
+ this.lastContentTime = Date.now();
602085
602384
  }
602086
602385
  setTotalTokens(tokens) {
602087
602386
  this.metrics.totalTokens = tokens;
@@ -602092,14 +602391,30 @@ var StreamSession = class {
602092
602391
  getElapsedMs() {
602093
602392
  return Date.now() - this.startTime;
602094
602393
  }
602095
- // use this for max-time checks, NOT getElapsedMs(). we only want to timeout
602096
- // if nothing is happening, not if the stream has been running for a while.
602394
+ // Time since the last activity of ANY kind (content, keep-alives, retries).
602395
+ // Reset by resetActivityTimer() and recordRetry(), so it measures liveness,
602396
+ // not real progress. Used by IdleMonitor's stall detection — NOT for the
602397
+ // retry max-time budget (that uses getTimeSinceLastContent()).
602097
602398
  getTimeSinceLastActivity() {
602098
602399
  return Date.now() - this.lastActivityTime;
602099
602400
  }
602401
+ // Time since the last CONTENT chunk. Unlike getTimeSinceLastActivity(), this is
602402
+ // NOT reset by keep-alives (resetActivityTimer) or recordRetry — so it measures
602403
+ // real progress across the whole session. Used by RetryEngine's max-time guard.
602404
+ getTimeSinceLastContent() {
602405
+ return Date.now() - this.lastContentTime;
602406
+ }
602100
602407
  resetActivityTimer() {
602101
602408
  this.lastActivityTime = Date.now();
602102
602409
  }
602410
+ // Advances both the liveness clock and the retry-budget content clock without
602411
+ // touching content metrics (chunkCount / timeToFirstTokenMs). For upstream
602412
+ // chunks that are real model output — proof of progress — but are filtered
602413
+ // out before downstream consumers (server-side compaction deltas).
602414
+ recordContentProgress() {
602415
+ this.lastActivityTime = Date.now();
602416
+ this.lastContentTime = Date.now();
602417
+ }
602103
602418
  };
602104
602419
 
602105
602420
  // ../../../vite-plugin-file-sync/dist/ai-service/llm/stream/orchestrator.js
@@ -602150,6 +602465,7 @@ var StreamOrchestrator = class {
602150
602465
  await session.events.emit("session:start", session, {
602151
602466
  system: options8.system,
602152
602467
  messages: options8.messages ?? [],
602468
+ user: options8.user,
602153
602469
  tools: options8.tools
602154
602470
  });
602155
602471
  internalAbortController.signal.addEventListener("abort", () => {
@@ -602158,14 +602474,30 @@ var StreamOrchestrator = class {
602158
602474
  const idleMonitor = new IdleMonitor({
602159
602475
  session,
602160
602476
  maxIdleTimeMs: this.config.retry.idleTimeoutMs,
602477
+ firstChunkTimeoutMs: this.config.retry.firstChunkTimeoutMs,
602478
+ onServerCompactionStart: (blockId) => {
602479
+ this.logger.debug("[orchestrator] Server-side compaction chunk detected; holding first-chunk idle budget", {
602480
+ sessionId: session.id,
602481
+ provider: session.provider.name,
602482
+ model: session.provider.model,
602483
+ attempt: session.attempt,
602484
+ blockId,
602485
+ firstChunkTimeoutMs: this.config.retry.firstChunkTimeoutMs
602486
+ });
602487
+ },
602161
602488
  onStall: (error40) => {
602489
+ const budgetKind = error40.maxIdleTimeMs === this.config.retry.firstChunkTimeoutMs ? "first-chunk" : "inter-chunk";
602162
602490
  this.logger.warn(`[orchestrator] Idle timeout exceeded, triggering retry`, {
602163
602491
  sessionId: session.id,
602164
602492
  provider: session.provider.name,
602165
602493
  model: session.provider.model,
602166
602494
  attempt: session.attempt,
602495
+ budgetKind,
602167
602496
  idleMs: error40.idleTimeMs,
602497
+ budgetMs: error40.maxIdleTimeMs,
602168
602498
  maxIdleTimeMs: error40.maxIdleTimeMs,
602499
+ firstChunkTimeoutMs: this.config.retry.firstChunkTimeoutMs,
602500
+ idleTimeoutMs: this.config.retry.idleTimeoutMs,
602169
602501
  elapsedMs: session.getElapsedMs(),
602170
602502
  chunksReceived: session.metrics.chunkCount
602171
602503
  });
@@ -604050,14 +604382,20 @@ var LLMClient = class {
604050
604382
  const fallbackEnabled = this.unifiedProviderEnabled && (enableFallback ?? false);
604051
604383
  logger21.info(`[llm-client] provider=${providerConfig.provider} model=${providerConfig.model} unifiedProvider=${this.unifiedProviderEnabled} fallback=${fallbackEnabled} retry=${safeJsonStringify(retryConfig)}`);
604052
604384
  const extendedThinking = usesAdaptiveEffort(providerConfig.model) || providerConfig.model === "claude-opus-4-6";
604053
- const defaultMaxTotalTimeMs = extendedThinking ? 5 * 60 * 1e3 : 2 * 60 * 1e3;
604385
+ const defaultMaxTotalTimeMs = extendedThinking ? 30 * 60 * 1e3 : 15 * 60 * 1e3;
604054
604386
  const defaultIdleTimeoutMs = extendedThinking ? 18e4 : 9e4;
604387
+ const resolvedIdleTimeoutMs = retryConfig?.idleTimeoutMs ?? this.retryOptions?.idleTimeoutMs ?? defaultIdleTimeoutMs;
604388
+ const serverSideContextManagement = contextConfig?.contextManagement?.type === "server";
604389
+ const resolvedFirstChunkTimeoutMs = retryConfig?.firstChunkTimeoutMs ?? this.retryOptions?.firstChunkTimeoutMs ?? defaultFirstChunkTimeoutMs(serverSideContextManagement, resolvedIdleTimeoutMs);
604390
+ const proxyStallTimeoutMs = extendedThinking ? 9e5 : 45e4;
604391
+ const resolvedMaxTotalTimeMs = Math.max(retryConfig?.maxTotalTimeMs ?? this.retryOptions?.maxTotalTimeMs ?? defaultMaxTotalTimeMs, resolvedFirstChunkTimeoutMs, proxyStallTimeoutMs);
604055
604392
  const config4 = StreamConfig.create({
604056
604393
  retry: {
604057
604394
  ...this.retryOptions,
604058
604395
  ...retryConfig,
604059
- maxTotalTimeMs: retryConfig?.maxTotalTimeMs ?? this.retryOptions?.maxTotalTimeMs ?? defaultMaxTotalTimeMs,
604060
- idleTimeoutMs: retryConfig?.idleTimeoutMs ?? this.retryOptions?.idleTimeoutMs ?? defaultIdleTimeoutMs
604396
+ maxTotalTimeMs: resolvedMaxTotalTimeMs,
604397
+ idleTimeoutMs: resolvedIdleTimeoutMs,
604398
+ firstChunkTimeoutMs: resolvedFirstChunkTimeoutMs
604061
604399
  },
604062
604400
  provider: providerConfig.provider,
604063
604401
  model: providerConfig.model,
@@ -609622,7 +609960,7 @@ var PlaywrightMcpServerManager = class {
609622
609960
  this.logger.info(`Starting embedded Playwright MCP server: browser=${options8?.browser || "chromium"}, headless=${options8?.headless !== false}`);
609623
609961
  }
609624
609962
  try {
609625
- const { startEmbeddedPlaywrightMcpServer } = await import("./embedded-playwright-mcp-server-UGIS3FHL.js");
609963
+ const { startEmbeddedPlaywrightMcpServer } = await import("./embedded-playwright-mcp-server-55KSMVXX.js");
609626
609964
  this.server = await startEmbeddedPlaywrightMcpServer({
609627
609965
  storageStatePath: options8?.storageStatePath,
609628
609966
  jwt: options8?.jwt,
@@ -610000,6 +610338,46 @@ REQUIREMENTS:
610000
610338
  - When referencing integrations, use the @Integration[id=<UUID>] syntax so they render as tags in the UI. For example: "This API connects to @Integration[id=abc-123] to fetch order data."`;
610001
610339
  }
610002
610340
 
610341
+ // ../../../vite-plugin-file-sync/dist/ai-service/request-deduplicator.js
610342
+ init_cjs_shims();
610343
+ var RequestDeduplicator = class {
610344
+ maxSize;
610345
+ seen = /* @__PURE__ */ new Set();
610346
+ constructor(maxSize = 200) {
610347
+ this.maxSize = maxSize;
610348
+ }
610349
+ /** Returns true if the id was already recorded, without recording it. */
610350
+ has(requestId) {
610351
+ return this.seen.has(requestId);
610352
+ }
610353
+ /**
610354
+ * Records the id if it has not been seen before. Returns true when the id is
610355
+ * new (the caller should proceed) and false when it is a duplicate (the
610356
+ * caller should treat the command as already handled).
610357
+ */
610358
+ markIfNew(requestId) {
610359
+ if (this.seen.has(requestId)) {
610360
+ return false;
610361
+ }
610362
+ this.seen.add(requestId);
610363
+ if (this.seen.size > this.maxSize) {
610364
+ const oldest = this.seen.values().next().value;
610365
+ if (oldest !== void 0) {
610366
+ this.seen.delete(oldest);
610367
+ }
610368
+ }
610369
+ return true;
610370
+ }
610371
+ /**
610372
+ * Removes a previously-recorded id. Use when a command was recorded but never
610373
+ * actually started (e.g. it threw during setup), so a legitimate reconnect
610374
+ * re-send of the same command is not mistakenly swallowed as a duplicate.
610375
+ */
610376
+ forget(requestId) {
610377
+ this.seen.delete(requestId);
610378
+ }
610379
+ };
610380
+
610003
610381
  // ../../../vite-plugin-file-sync/dist/ai-service/state-machine/handlers/agent-planning.js
610004
610382
  init_cjs_shims();
610005
610383
 
@@ -610763,7 +611141,7 @@ var transitionFrom = (clark) => {
610763
611141
  };
610764
611142
 
610765
611143
  // ../../../vite-plugin-file-sync/dist/ai-service/state-machine/handlers/agent-planning.js
610766
- var FETCH_INTEGRATIONS_RECONNECT_BUDGET_MS = 15e3;
611144
+ var FETCH_INTEGRATIONS_RECONNECT_BUDGET_MS = 5e3;
610767
611145
  var MAX_DEBUG_ATTEMPTS = 5;
610768
611146
  function getTerminalErrorMessage(error40) {
610769
611147
  const { type, provider, data: data3 } = error40;
@@ -610787,6 +611165,8 @@ function getTerminalErrorMessage(error40) {
610787
611165
  return "The AI model returned an error. Please retry your prompt below. If the problem persists, the model provider may be experiencing issues.";
610788
611166
  case "timeout":
610789
611167
  return "The request timed out. Please check your connection and try again.";
611168
+ case "stall":
611169
+ return "The AI model stopped responding mid-generation. Please retry your prompt below. If the problem persists, please open a support ticket.";
610790
611170
  case "overloaded":
610791
611171
  return "The model is currently busy. Please retry your prompt below.";
610792
611172
  case "network":
@@ -611134,12 +611514,21 @@ Address the errors and return the fixed code.`;
611134
611514
  try {
611135
611515
  await fetchWithReconnectRetry(clark.context.peer, () => params.integrationStore.fetchIntegrations(clark.context.peer, availableIntegrations ?? []), { reconnectBudgetMs: FETCH_INTEGRATIONS_RECONNECT_BUDGET_MS });
611136
611516
  } catch (error40) {
611137
- getLogger3().error(`[agent-planning] Failed to fetch integrations`, getErrorMeta2(error40));
611138
- void transitionTo({
611139
- type: AGENT_CANCELED,
611140
- advice: "Failed to fetch integrations from the browser. Please refresh the page and try again."
611141
- });
611142
- return;
611517
+ const isTransient = error40 instanceof RpcTimeoutError || isTransportCloseError(error40);
611518
+ if (isTransient) {
611519
+ getLogger3().warn(`[agent-planning] Failed to fetch integrations \u2014 proceeding without full integration metadata`, {
611520
+ ...getErrorMeta2(error40),
611521
+ degradedMode: true,
611522
+ errorType: error40 instanceof Error ? error40.constructor.name : typeof error40
611523
+ });
611524
+ } else {
611525
+ getLogger3().error(`[agent-planning] Failed to fetch integrations`, getErrorMeta2(error40));
611526
+ void transitionTo({
611527
+ type: AGENT_CANCELED,
611528
+ advice: "Failed to fetch integrations from the browser. Please refresh the page and try again."
611529
+ });
611530
+ return;
611531
+ }
611143
611532
  }
611144
611533
  getLogger3().info("Agent planning storing llmConfig in context:", request.llmConfig || {});
611145
611534
  const disabledTools = request.llmConfig?.disabledTools;
@@ -616137,6 +616526,7 @@ var AiService = class extends import_shared48.TracedEventEmitter {
616137
616526
  llmClient;
616138
616527
  stablePeer = new StablePeer();
616139
616528
  toolRegistry = new ToolRegistry();
616529
+ requestDeduplicator = new RequestDeduplicator();
616140
616530
  entityPermissionStore = new SessionEntityPermissionStore();
616141
616531
  _onGenerationCompleteCallback;
616142
616532
  tokenManagerJwt;
@@ -616416,24 +616806,7 @@ var AiService = class extends import_shared48.TracedEventEmitter {
616416
616806
  planApproved: this.clark?.context?.planContext?.approved
616417
616807
  };
616418
616808
  },
616419
- remoteRestoreFallback: async (id2) => {
616420
- const jwt2 = this.getJwt();
616421
- const commitId = this._syncContextProvider?.getLastCommitId() ?? await this.chatSessionStore.getLatestCommitId();
616422
- const branchName = this._syncContextProvider?.getBranchName();
616423
- if (!jwt2 || !commitId || !branchName) {
616424
- return null;
616425
- }
616426
- return downloadContextFromBucketeer({
616427
- applicationId: config4.applicationId,
616428
- commitId,
616429
- branchName,
616430
- superblocksBaseUrl: config4.superblocksBaseUrl,
616431
- logger: this.getLogger(),
616432
- jwt: jwt2,
616433
- contextId: id2,
616434
- appRootDirPath: config4.appRootDirPath
616435
- });
616436
- }
616809
+ remoteRestoreFallback: (id2) => this.remoteRestoreFallback(id2)
616437
616810
  });
616438
616811
  this.llmClient = new LLMClient({
616439
616812
  contextManagerV2: this.contextManagerV2,
@@ -616677,6 +617050,43 @@ var AiService = class extends import_shared48.TracedEventEmitter {
616677
617050
  };
616678
617051
  };
616679
617052
  }
617053
+ /**
617054
+ * Resolves the conversation context for a contextId that is not present
617055
+ * locally, by downloading it from Bucketeer. Wired into ContextManagerV2 as
617056
+ * its `remoteRestoreFallback`, so it runs on a cold/recycled pod where the
617057
+ * editor reconnects and no local context exists.
617058
+ *
617059
+ * The download is keyed by commitId. It prefers `syncService.lastCommitId`
617060
+ * (which `downloadDirectory()` seeds from the server's latest non-draft
617061
+ * commit — the exact key the post-generation context upload uses) and only
617062
+ * falls back to the most recent chat-history commitId when the sync service
617063
+ * has none. Resolving the wrong key here is the context-loss this guards
617064
+ * against, so the resolution is logged.
617065
+ */
617066
+ async remoteRestoreFallback(id2) {
617067
+ const jwt2 = this.getJwt();
617068
+ const lastCommitId = this._syncContextProvider?.getLastCommitId();
617069
+ const commitId = lastCommitId ?? await this.chatSessionStore.getLatestCommitId();
617070
+ const commitIdSource = lastCommitId ? "syncService.lastCommitId" : commitId ? "chatSessionStore.getLatestCommitId" : "unavailable";
617071
+ const branchName = this._syncContextProvider?.getBranchName();
617072
+ if (!jwt2 || !commitId || !branchName) {
617073
+ if (jwt2) {
617074
+ this.getLogger().warn(`[context-restore] remoteRestoreFallback found no restore key: commitId=${commitId ?? "<none>"} source=${commitIdSource} branch=${branchName ?? "<none>"}`);
617075
+ }
617076
+ return null;
617077
+ }
617078
+ this.getLogger().info(`[context-restore] remoteRestoreFallback resolved commitId=${commitId} source=${commitIdSource} branch=${branchName}`);
617079
+ return downloadContextFromBucketeer({
617080
+ applicationId: this.config.applicationId,
617081
+ commitId,
617082
+ branchName,
617083
+ superblocksBaseUrl: this.config.superblocksBaseUrl,
617084
+ logger: this.getLogger(),
617085
+ jwt: jwt2,
617086
+ contextId: id2,
617087
+ appRootDirPath: this.config.appRootDirPath
617088
+ });
617089
+ }
616680
617090
  getJwt() {
616681
617091
  if (this.tokenManagerJwt) {
616682
617092
  return this.tokenManagerJwt;
@@ -616908,53 +617318,68 @@ var AiService = class extends import_shared48.TracedEventEmitter {
616908
617318
  if (this.clark.state === ClarkStateNames.Dead) {
616909
617319
  throw new Error("Service is unavailable");
616910
617320
  }
617321
+ if (request.requestId && this.requestDeduplicator.has(request.requestId)) {
617322
+ this.getLogger().info("[ai-service] Ignoring duplicate aiGenerate re-send", { requestId: request.requestId });
617323
+ return;
617324
+ }
616911
617325
  if (this.isBusy()) {
616912
617326
  this.getLogger().warn("[ai-service] Service is busy. State:", this.clark.state);
616913
617327
  throw new Error("Service is busy");
616914
617328
  }
616915
617329
  await this.ensureAiQuotaAvailable(request.jwt);
616916
- this.clarkProfiler.startSession();
616917
- getLogger3().info("AI Service received request with llmConfig:", request.llmConfig || {});
616918
- getLogger3().info("[ai-service] handleAiGenerate received request", {
616919
- requestMode: request.mode,
616920
- currentContextMode: this.clark.context.currentMode,
616921
- requestPlanContextApproved: request.planContext?.approved,
616922
- existingPlanContextApproved: this.clark.context.planContext?.approved,
616923
- responseMetadataType: request.responseMetadata?.type
616924
- });
616925
- const promptId = randomUUID3();
616926
- getLogger3().info("[ai-service] Generated prompt_id for user interaction", {
616927
- promptId,
616928
- applicationId: this.config.applicationId
616929
- });
616930
- this.clark.updateContext((context2) => {
616931
- return {
616932
- ...context2,
617330
+ if (request.requestId && !this.requestDeduplicator.markIfNew(request.requestId)) {
617331
+ this.getLogger().warn("[ai-service] Ignoring duplicate aiGenerate re-send (lost dedup race)", { requestId: request.requestId });
617332
+ return;
617333
+ }
617334
+ try {
617335
+ this.clarkProfiler.startSession();
617336
+ getLogger3().info("AI Service received request with llmConfig:", request.llmConfig || {});
617337
+ getLogger3().info("[ai-service] handleAiGenerate received request", {
617338
+ requestMode: request.mode,
617339
+ currentContextMode: this.clark.context.currentMode,
617340
+ requestPlanContextApproved: request.planContext?.approved,
617341
+ existingPlanContextApproved: this.clark.context.planContext?.approved,
617342
+ responseMetadataType: request.responseMetadata?.type
617343
+ });
617344
+ const promptId = randomUUID3();
617345
+ getLogger3().info("[ai-service] Generated prompt_id for user interaction", {
616933
617346
  promptId,
616934
- useMockGeneration: request.mockGeneration ?? false,
616935
- planContext: mergePlanContexts(context2.planContext, request.planContext),
616936
- browserContext: request.browserContext,
616937
- // Initialize workflow metrics tracking
616938
- workflowMetrics: {
616939
- toolCallCount: 0,
616940
- stepCount: 0,
616941
- linesAdded: 0,
616942
- linesEdited: 0,
616943
- linesRemoved: 0,
616944
- llmUsage: [],
616945
- llmCallCount: 0,
616946
- workflowStartedAt: (/* @__PURE__ */ new Date()).toISOString()
616947
- },
616948
- llmConfig: request.llmConfig,
616949
- partialResponse: void 0,
616950
- userPreferences: request.userPreferences
616951
- };
616952
- });
616953
- const transitionTo = transitionFrom(this.clark);
616954
- void transitionTo({
616955
- type: USER_SENT_PROMPT,
616956
- request
616957
- });
617347
+ applicationId: this.config.applicationId
617348
+ });
617349
+ this.clark.updateContext((context2) => {
617350
+ return {
617351
+ ...context2,
617352
+ promptId,
617353
+ useMockGeneration: request.mockGeneration ?? false,
617354
+ planContext: mergePlanContexts(context2.planContext, request.planContext),
617355
+ browserContext: request.browserContext,
617356
+ // Initialize workflow metrics tracking
617357
+ workflowMetrics: {
617358
+ toolCallCount: 0,
617359
+ stepCount: 0,
617360
+ linesAdded: 0,
617361
+ linesEdited: 0,
617362
+ linesRemoved: 0,
617363
+ llmUsage: [],
617364
+ llmCallCount: 0,
617365
+ workflowStartedAt: (/* @__PURE__ */ new Date()).toISOString()
617366
+ },
617367
+ llmConfig: request.llmConfig,
617368
+ partialResponse: void 0,
617369
+ userPreferences: request.userPreferences
617370
+ };
617371
+ });
617372
+ const transitionTo = transitionFrom(this.clark);
617373
+ void transitionTo({
617374
+ type: USER_SENT_PROMPT,
617375
+ request
617376
+ });
617377
+ } catch (error40) {
617378
+ if (request.requestId) {
617379
+ this.requestDeduplicator.forget(request.requestId);
617380
+ }
617381
+ throw error40;
617382
+ }
616958
617383
  }
616959
617384
  async handleAiExplainCode(request) {
616960
617385
  if (this.clark.state === ClarkStateNames.Dead) {
@@ -617508,6 +617933,10 @@ ${normalizedTextAttachment.content}
617508
617933
  if (this.clark.state === ClarkStateNames.Dead) {
617509
617934
  throw new Error("Service is unavailable");
617510
617935
  }
617936
+ if (request.requestId && this.requestDeduplicator.has(request.requestId)) {
617937
+ this.getLogger().info("[ai-service] Ignoring duplicate aiGenerateWithQueue re-send", { requestId: request.requestId, mode });
617938
+ return { status: "started" };
617939
+ }
617511
617940
  if (!this.isBusy()) {
617512
617941
  await this.handleAiGenerate(request);
617513
617942
  return { status: "started" };
@@ -617635,6 +618064,12 @@ ${request.prompt}`;
617635
618064
  async handleAiRespondToToolPermission(request) {
617636
618065
  const logger21 = this.getLogger();
617637
618066
  logger21.info(`[ai-service] handleAiRespondToToolPermission: messageId=${request.messageId}, approved=${request.approved}`);
618067
+ if (request.requestId && this.requestDeduplicator.has(request.requestId)) {
618068
+ logger21.info("[ai-service] Ignoring duplicate tool-permission re-send", {
618069
+ requestId: request.requestId
618070
+ });
618071
+ return;
618072
+ }
617638
618073
  const pendingRequest = this.clark.context.pendingToolPermissionRequest;
617639
618074
  logger21.info(`[ai-service] Pending request: ${JSON.stringify(pendingRequest)}`);
617640
618075
  if (!pendingRequest) {
@@ -617645,6 +618080,10 @@ ${request.prompt}`;
617645
618080
  logger21.warn(`[ai-service] Message ID mismatch: expected=${pendingRequest.messageId}, got=${request.messageId}`);
617646
618081
  throw new Error("Message ID mismatch");
617647
618082
  }
618083
+ if (request.requestId && !this.requestDeduplicator.markIfNew(request.requestId)) {
618084
+ logger21.warn("[ai-service] Ignoring duplicate tool-permission re-send (lost dedup race)", { requestId: request.requestId });
618085
+ return;
618086
+ }
617648
618087
  logger21.info(`[ai-service] Clearing pending request`);
617649
618088
  clearPendingToolPermissionRequest(this.clark, "tool-permission-response");
617650
618089
  const toolCallId = pendingRequest.messageId;
@@ -618583,9 +619022,9 @@ ${request.prompt}`;
618583
619022
  // ../../../vite-plugin-file-sync/dist/sync-service/index.js
618584
619023
  init_cjs_shims();
618585
619024
  import { normalizePath as normalizePath8 } from "vite";
618586
- var import_shared54 = __toESM(require_dist2(), 1);
618587
- var import_shared55 = __toESM(require_dist2(), 1);
618588
- var import_shared56 = __toESM(require_dist2(), 1);
619025
+ var import_shared54 = __toESM(require_dist2());
619026
+ var import_shared55 = __toESM(require_dist2());
619027
+ var import_shared56 = __toESM(require_dist2());
618589
619028
 
618590
619029
  // ../../../vite-plugin-file-sync/dist/errors/make-server-error.js
618591
619030
  init_cjs_shims();
@@ -618779,20 +619218,21 @@ async function getApplicationDirectoryHash(rpcClient, applicationId, branch, loc
618779
619218
  getDraftOrLiveDirectoryHash(rpcClient, applicationId, branch),
618780
619219
  hashLocalDirectory(localDirectoryPath)
618781
619220
  ]);
618782
- const directoryHash = draftOrLiveEditHash;
619221
+ const directoryHash = draftOrLiveEditHash.hash;
618783
619222
  if (!directoryHash) {
618784
619223
  throw new Error("No live edit hash found");
618785
619224
  }
618786
619225
  return {
618787
619226
  serverDirectoryHash: directoryHash,
619227
+ latestNonDraftCommitId: draftOrLiveEditHash.latestNonDraftCommitId,
618788
619228
  localDirectoryStatePreDownload
618789
619229
  };
618790
619230
  }
618791
619231
  async function downloadApplicationDirectory({ rpcClient, applicationId, branch, localDirectoryPath, hashCache }) {
618792
- const { serverDirectoryHash, localDirectoryStatePreDownload } = await getApplicationDirectoryHash(rpcClient, applicationId, branch, localDirectoryPath);
619232
+ const { serverDirectoryHash, latestNonDraftCommitId, localDirectoryStatePreDownload } = await getApplicationDirectoryHash(rpcClient, applicationId, branch, localDirectoryPath);
618793
619233
  const directoryState = await doDownloadApplicationDirectory(rpcClient, serverDirectoryHash, localDirectoryStatePreDownload, localDirectoryPath);
618794
619234
  hashCache.add_directory_recursive(directoryState);
618795
- return serverDirectoryHash;
619235
+ return { directoryHash: serverDirectoryHash, latestNonDraftCommitId };
618796
619236
  }
618797
619237
  async function doDownloadApplicationDirectory(rpcClient, directoryHash, oldLocalDirState, localDirectoryPath) {
618798
619238
  const hashesToGet = {};
@@ -618886,7 +619326,10 @@ async function getDraftOrLiveDirectoryHash(rpcClient, applicationId, branch) {
618886
619326
  branchName: branch,
618887
619327
  viewMode: import_shared51.ExportViewMode.EXPORT_DRAFT
618888
619328
  }));
618889
- return response.hash;
619329
+ return {
619330
+ hash: response.hash,
619331
+ latestNonDraftCommitId: response.latestNonDraftCommitId
619332
+ };
618890
619333
  } catch (e) {
618891
619334
  if (e instanceof import_shared50.NotFoundError) {
618892
619335
  const response = await (0, import_shared50.unwrapResponseDto)(rpcClient.call.v3.application.directoryContents.get({
@@ -618895,7 +619338,10 @@ async function getDraftOrLiveDirectoryHash(rpcClient, applicationId, branch) {
618895
619338
  viewMode: import_shared51.ExportViewMode.EXPORT_LIVE
618896
619339
  }));
618897
619340
  getLogger3().warn(`Draft state not found, using live edit hash: ${response.hash}`);
618898
- return response.hash;
619341
+ return {
619342
+ hash: response.hash,
619343
+ latestNonDraftCommitId: response.latestNonDraftCommitId
619344
+ };
618899
619345
  }
618900
619346
  throw e;
618901
619347
  }
@@ -619461,6 +619907,9 @@ function isDevOrLocal() {
619461
619907
  const env2 = process.env.SUPERBLOCKS_SERVER_ENV ?? process.env.SUPERBLOCKS_ENVIRONMENT;
619462
619908
  return env2 === "dev" || env2 === "local";
619463
619909
  }
619910
+ function shouldSeedLastCommitId(currentLastCommitId, incomingCommitId) {
619911
+ return Boolean(incomingCommitId) && !currentLastCommitId;
619912
+ }
619464
619913
  function getSyncErrorLogLevel(error40) {
619465
619914
  const msg = error40?.message ?? "";
619466
619915
  if (msg.includes("RPC client is shutting down") || msg.includes("Connection closed")) {
@@ -619554,6 +620003,7 @@ var SyncService = class extends import_shared54.TracedEventEmitter {
619554
620003
  this.pendingSyncUp = void 0;
619555
620004
  this.lastSyncedDirectoryHash = void 0;
619556
620005
  this.lastSyncedGenerationNumber = void 0;
620006
+ this.lastCommitId = void 0;
619557
620007
  this.synchronizationStatus = SyncronizationStatus.SERVER_AHEAD;
619558
620008
  this.getLogger().info(`[sync-service] switched branch context from '${previousBranchName}' to '${nextBranchName}'`);
619559
620009
  }
@@ -619599,7 +620049,7 @@ var SyncService = class extends import_shared54.TracedEventEmitter {
619599
620049
  return this.fsOperation(async () => {
619600
620050
  this.status = SyncServiceStatus.DOWNLOADING;
619601
620051
  try {
619602
- const directoryHash = await this._rpcClient.call(async (rpcClient) => {
620052
+ const { directoryHash, latestNonDraftCommitId } = await this._rpcClient.call(async (rpcClient) => {
619603
620053
  return await downloadApplicationDirectory({
619604
620054
  rpcClient,
619605
620055
  applicationId: this.applicationId,
@@ -619609,6 +620059,19 @@ var SyncService = class extends import_shared54.TracedEventEmitter {
619609
620059
  });
619610
620060
  });
619611
620061
  this.lastSyncedDirectoryHash = directoryHash;
620062
+ if (shouldSeedLastCommitId(this.lastCommitId, latestNonDraftCommitId)) {
620063
+ this.lastCommitId = latestNonDraftCommitId;
620064
+ this.emit("commitIdChanged", latestNonDraftCommitId);
620065
+ this.getLogger().info(`[sync-service] seeded lastCommitId=${latestNonDraftCommitId} appId=${this.applicationId} branch=${this._branchName ?? "<none>"} from server on cold-pod download`);
620066
+ } else if (latestNonDraftCommitId && this.lastCommitId) {
620067
+ if (this.lastCommitId !== latestNonDraftCommitId) {
620068
+ this.getLogger().info(`[sync-service] warm reconnect: kept lastCommitId=${this.lastCommitId}, server returned ${latestNonDraftCommitId} (values differ, not overwriting) appId=${this.applicationId}`);
620069
+ } else {
620070
+ this.getLogger().debug(`[sync-service] warm reconnect: kept lastCommitId=${this.lastCommitId}, server returned matching value appId=${this.applicationId}`);
620071
+ }
620072
+ } else if (!latestNonDraftCommitId && !this.lastCommitId) {
620073
+ this.getLogger().debug(`[sync-service] cold-pod download: server returned no non-draft commitId (new app or draft-only branch), context restore will fall back to chat history appId=${this.applicationId} branch=${this._branchName ?? "<none>"}`);
620074
+ }
619612
620075
  this.synchronizationStatus = SyncronizationStatus.IN_SYNC;
619613
620076
  this.getLogger().info("[sync-service] Synchronization finished");
619614
620077
  } catch (err) {
@@ -620098,8 +620561,8 @@ var SyncService = class extends import_shared54.TracedEventEmitter {
620098
620561
 
620099
620562
  // ../../../vite-plugin-file-sync/dist/lock-service/index.js
620100
620563
  init_cjs_shims();
620101
- var import_shared57 = __toESM(require_dist2(), 1);
620102
- var import_shared58 = __toESM(require_dist2(), 1);
620564
+ var import_shared57 = __toESM(require_dist2());
620565
+ var import_shared58 = __toESM(require_dist2());
620103
620566
 
620104
620567
  // ../../../vite-plugin-file-sync/dist/lock-service/activity-tracker.js
620105
620568
  init_cjs_shims();
@@ -620757,6 +621220,10 @@ var LockService = class extends import_shared57.TracedEventEmitter {
620757
621220
  this.getLogger().info("[lock-service] lock release already in progress, skipping duplicate evaluation");
620758
621221
  return;
620759
621222
  }
621223
+ if (this._isRestarting) {
621224
+ this.getLogger().info("[lock-service] restart in progress, skipping lock state evaluation");
621225
+ return;
621226
+ }
620760
621227
  if (this.waitForGenerationCompleteCallback) {
620761
621228
  this.getLogger().debug("[lock-service] waiting for Clark generation to complete before evaluating lock state");
620762
621229
  await this.waitForGenerationCompleteCallback();
@@ -620773,20 +621240,20 @@ var LockService = class extends import_shared57.TracedEventEmitter {
620773
621240
  this.getLogger().debug(`[lock-service] user disconnected but was recently active, waiting for ${this._lockBufferMs}ms buffer period before releasing lock`);
620774
621241
  this._bufferPeriodTimeout = setTimeout(() => {
620775
621242
  this.getLogger().debug("[lock-service] buffer period expired, releasing lock");
620776
- if (this.lockType === LockType.LOCAL) {
620777
- void this.shutdownAndExit();
620778
- } else {
620779
- void this.shutdown({ serverInitiated: false });
621243
+ if (this._isRestarting) {
621244
+ this.getLogger().info("[lock-service] restart in progress, skipping buffer-period shutdown");
621245
+ return;
620780
621246
  }
621247
+ void this.shutdownAndExit();
620781
621248
  }, this._lockBufferMs);
620782
621249
  this._bufferPeriodTimeout.unref();
620783
621250
  } else {
620784
621251
  this.getLogger().debug("[lock-service] user disconnected and was not recently active, releasing lock immediately");
620785
- if (this.lockType === LockType.LOCAL) {
620786
- await this.shutdownAndExit();
620787
- } else {
620788
- await this.shutdown({ serverInitiated: false });
621252
+ if (this._isRestarting) {
621253
+ this.getLogger().info("[lock-service] restart in progress, skipping immediate shutdown");
621254
+ return;
620789
621255
  }
621256
+ await this.shutdownAndExit();
620790
621257
  }
620791
621258
  } else {
620792
621259
  this.getLogger().debug("[lock-service] user inactive but still connected, marking lock as ready for takeover");
@@ -620819,9 +621286,16 @@ var LockService = class extends import_shared57.TracedEventEmitter {
620819
621286
  markActivity(isUserActive) {
620820
621287
  this._activityTracker.markActivity(isUserActive);
620821
621288
  }
620822
- /** when the dev server is restarting, we will use the 5-minute shutdown timer instead of the instant one */
621289
+ /** Mark the dev server as restarting. Prevents evaluateLockState() from calling
621290
+ * shutdownAndExit() (which would fire process.exit(1)) while the restart handler
621291
+ * intends to exit with RESTART_EXIT_CODE. Also cancels any pending buffer timeout. */
620823
621292
  async setIsRestarting() {
620824
621293
  this._isRestarting = true;
621294
+ if (this._bufferPeriodTimeout) {
621295
+ clearTimeout(this._bufferPeriodTimeout);
621296
+ this._bufferPeriodTimeout = void 0;
621297
+ this.getLogger().info("[lock-service] cleared pending buffer timeout on restart");
621298
+ }
620825
621299
  }
620826
621300
  };
620827
621301
 
@@ -644679,7 +645153,7 @@ var parseYaml3;
644679
645153
  async function loadYaml(file2) {
644680
645154
  const content17 = await read_file_default(file2);
644681
645155
  if (!parseYaml3) {
644682
- ({ __parsePrettierYamlConfig: parseYaml3 } = await import("./yaml-JLRXP2CH.js"));
645156
+ ({ __parsePrettierYamlConfig: parseYaml3 } = await import("./yaml-KLI3RE6K.js"));
644683
645157
  }
644684
645158
  try {
644685
645159
  return parseYaml3(content17);
@@ -650073,7 +650547,7 @@ function createParsersAndPrinters(modules) {
650073
650547
  }
650074
650548
  var estreePlugin = createParsersAndPrinters([
650075
650549
  {
650076
- importPlugin: () => import("./estree-TCD2UGUS.js"),
650550
+ importPlugin: () => import("./estree-XHRBZXDB.js"),
650077
650551
  printers: ["estree", "estree-json"]
650078
650552
  }
650079
650553
  ]);
@@ -650097,11 +650571,11 @@ var languages = [
650097
650571
  ];
650098
650572
  var { parsers: parsers12, printers } = createParsersAndPrinters([
650099
650573
  {
650100
- importPlugin: () => import("./acorn-ZN7Q6UDZ.js"),
650574
+ importPlugin: () => import("./acorn-RVXTUPIU.js"),
650101
650575
  parsers: ["acorn", "espree"]
650102
650576
  },
650103
650577
  {
650104
- importPlugin: () => import("./angular-J2MXKXGC.js"),
650578
+ importPlugin: () => import("./angular-3LHQBAFX.js"),
650105
650579
  parsers: [
650106
650580
  "__ng_action",
650107
650581
  "__ng_binding",
@@ -650110,7 +650584,7 @@ var { parsers: parsers12, printers } = createParsersAndPrinters([
650110
650584
  ]
650111
650585
  },
650112
650586
  {
650113
- importPlugin: () => import("./babel-O4PIWZ7M.js"),
650587
+ importPlugin: () => import("./babel-EJ6IVCOP.js"),
650114
650588
  parsers: [
650115
650589
  "babel",
650116
650590
  "babel-flow",
@@ -650129,44 +650603,44 @@ var { parsers: parsers12, printers } = createParsersAndPrinters([
650129
650603
  ]
650130
650604
  },
650131
650605
  {
650132
- importPlugin: () => import("./flow-DTJ5KXYK.js"),
650606
+ importPlugin: () => import("./flow-PO73QWID.js"),
650133
650607
  parsers: ["flow"]
650134
650608
  },
650135
650609
  {
650136
- importPlugin: () => import("./glimmer-AER7O7UD.js"),
650610
+ importPlugin: () => import("./glimmer-YNVOZBDJ.js"),
650137
650611
  parsers: ["glimmer"],
650138
650612
  printers: ["glimmer"]
650139
650613
  },
650140
650614
  {
650141
- importPlugin: () => import("./graphql-ZCGKT3ML.js"),
650615
+ importPlugin: () => import("./graphql-HFTLPD2K.js"),
650142
650616
  parsers: ["graphql"],
650143
650617
  printers: ["graphql"]
650144
650618
  },
650145
650619
  {
650146
- importPlugin: () => import("./html-V3FHSD2D.js"),
650620
+ importPlugin: () => import("./html-EY72FROY.js"),
650147
650621
  parsers: ["html", "angular", "vue", "lwc", "mjml"],
650148
650622
  printers: ["html"]
650149
650623
  },
650150
650624
  {
650151
- importPlugin: () => import("./markdown-F4OH2TLC.js"),
650625
+ importPlugin: () => import("./markdown-BG67LRMX.js"),
650152
650626
  parsers: ["markdown", "mdx", "remark"],
650153
650627
  printers: ["mdast"]
650154
650628
  },
650155
650629
  {
650156
- importPlugin: () => import("./meriyah-7WDK4UW6.js"),
650630
+ importPlugin: () => import("./meriyah-3TDTM3WJ.js"),
650157
650631
  parsers: ["meriyah"]
650158
650632
  },
650159
650633
  {
650160
- importPlugin: () => import("./postcss-DWK3YRY3.js"),
650634
+ importPlugin: () => import("./postcss-YODQYYIW.js"),
650161
650635
  parsers: ["css", "less", "scss"],
650162
650636
  printers: ["postcss"]
650163
650637
  },
650164
650638
  {
650165
- importPlugin: () => import("./typescript-VF6VJIWL.js"),
650639
+ importPlugin: () => import("./typescript-GS5XECMQ.js"),
650166
650640
  parsers: ["typescript"]
650167
650641
  },
650168
650642
  {
650169
- importPlugin: () => import("./yaml-JLRXP2CH.js"),
650643
+ importPlugin: () => import("./yaml-KLI3RE6K.js"),
650170
650644
  parsers: ["yaml"],
650171
650645
  printers: ["yaml"]
650172
650646
  }
@@ -667310,7 +667784,7 @@ async function handleLockConflict(error40, lockSvc, span, logger21) {
667310
667784
  }
667311
667785
  async function readPkgJson(cwd) {
667312
667786
  try {
667313
- const { readPackage } = await import("./read-pkg-DM7BQWMA.js");
667787
+ const { readPackage } = await import("./read-pkg-RLPLKGXT.js");
667314
667788
  return await readPackage({ cwd });
667315
667789
  } catch {
667316
667790
  return null;
@@ -669004,4 +669478,4 @@ serve-static/index.js:
669004
669478
  chokidar/esm/index.js:
669005
669479
  (*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) *)
669006
669480
  */
669007
- //# sourceMappingURL=chunk-3VETL57J.js.map
669481
+ //# sourceMappingURL=chunk-CFDMQXWR.js.map