@superblocksteam/cli 2.0.127 → 2.0.128-next.1

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-W2BZCDXM.js} +3 -3
  3. package/dist/{angular-J2MXKXGC.js → angular-7EERNNRR.js} +3 -3
  4. package/dist/{api-PHWED3B7.js → api-36RJFR2Y.js} +4 -4
  5. package/dist/{babel-O4PIWZ7M.js → babel-3PANACS5.js} +3 -3
  6. package/dist/{chunk-4H7R7J2T.js → chunk-7FDEQDMJ.js} +4 -4
  7. package/dist/{chunk-K3O6TE35.js → chunk-EHQD7CKO.js} +6 -6
  8. package/dist/{chunk-Y3SSO7TF.js → chunk-EQIY6O6T.js} +3 -3
  9. package/dist/{chunk-GUFH7U6O.js → chunk-EXTWQ3GO.js} +6 -6
  10. package/dist/{chunk-E5BF6ZNT.js → chunk-GGY33KOP.js} +2 -2
  11. package/dist/{chunk-N3OOJGMF.js → chunk-GVSMRDGA.js} +3 -3
  12. package/dist/{chunk-ZQZ76AD5.js → chunk-IV4OFB7R.js} +4 -4
  13. package/dist/{chunk-KKNY3RBN.js → chunk-LW7ON3DK.js} +3 -3
  14. package/dist/{chunk-DY2NVAAD.js → chunk-LY4G74YG.js} +4 -4
  15. package/dist/{chunk-3VETL57J.js → chunk-NWUPLR4A.js} +661 -146
  16. package/dist/{chunk-3VETL57J.js.map → chunk-NWUPLR4A.js.map} +1 -1
  17. package/dist/{chunk-BN5U26VC.js → chunk-PYQVFINF.js} +3 -3
  18. package/dist/{chunk-ZSID6E3B.js → chunk-QJVXR2IU.js} +3 -3
  19. package/dist/{chunk-JSU5Z7TV.js → chunk-RKUVJTYB.js} +3 -3
  20. package/dist/{chunk-24JWMPGA.js → chunk-RZFASTNP.js} +3 -3
  21. package/dist/{chunk-47KCZCU5.js → chunk-T2NEX6F4.js} +3 -3
  22. package/dist/{chunk-Q6V2WBCQ.js → chunk-VCSJREAZ.js} +3 -3
  23. package/dist/{chunk-F4XRKALY.js → chunk-Y4C7DLOV.js} +4 -4
  24. package/dist/{cli-truncate-V3KAVMMO.js → cli-truncate-KASYWIYV.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-AGEFFKZH.js} +7 -7
  28. package/dist/{dist-DMVFGUW4.js → dist-AUFMVP6Q.js} +13 -13
  29. package/dist/{embedded-playwright-mcp-server-UGIS3FHL.js → embedded-playwright-mcp-server-TWSEWXZG.js} +3 -3
  30. package/dist/{enquirer-6OJQE3AT.js → enquirer-E2B3BK7B.js} +4 -4
  31. package/dist/{estree-TCD2UGUS.js → estree-5TTMFJGQ.js} +3 -3
  32. package/dist/{flow-DTJ5KXYK.js → flow-UVCFOA7H.js} +3 -3
  33. package/dist/{getMachineId-bsd-6CQNZOWX.js → getMachineId-bsd-W6Q7FIGO.js} +5 -5
  34. package/dist/{getMachineId-darwin-VRD623QA.js → getMachineId-darwin-SJ5L55AG.js} +5 -5
  35. package/dist/{getMachineId-linux-EL5FHQHK.js → getMachineId-linux-NJSQGZDG.js} +4 -4
  36. package/dist/{getMachineId-unsupported-RU6ZPPJV.js → getMachineId-unsupported-526UHXHF.js} +4 -4
  37. package/dist/{getMachineId-win-PUBLZQLL.js → getMachineId-win-5WFSOI4U.js} +5 -5
  38. package/dist/{glimmer-AER7O7UD.js → glimmer-SQJMGKN3.js} +3 -3
  39. package/dist/{graphql-ZCGKT3ML.js → graphql-O47VXQ4V.js} +3 -3
  40. package/dist/{html-V3FHSD2D.js → html-3GW33SAW.js} +3 -3
  41. package/dist/{http-2CUOSMCF.js → http-2HRAUBLQ.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-4V3NPIVK.js} +3 -3
  45. package/dist/{log-update-Y476NEAV.js → log-update-I66BI4WQ.js} +6 -6
  46. package/dist/{markdown-F4OH2TLC.js → markdown-IP5WYL5S.js} +3 -3
  47. package/dist/{meriyah-7WDK4UW6.js → meriyah-HXGEZIIC.js} +3 -3
  48. package/dist/{postcss-DWK3YRY3.js → postcss-LNFONHX3.js} +3 -3
  49. package/dist/{read-pkg-DM7BQWMA.js → read-pkg-APXZ3M37.js} +5 -5
  50. package/dist/{spans-54HKADTB.js → spans-5ZNSF7ZR.js} +4 -4
  51. package/dist/{src-KMJE6Z3I.js → src-XOGFQGXO.js} +3 -3
  52. package/dist/{token-F25OBSDW.js → token-J7BP2GOR.js} +5 -5
  53. package/dist/{token-util-3CWH3NBE.js → token-util-OV47QL36.js} +5 -5
  54. package/dist/{typescript-VF6VJIWL.js → typescript-TDVWFWCZ.js} +3 -3
  55. package/dist/{wrap-ansi-YWN2NHPU.js → wrap-ansi-EAYJFERB.js} +5 -5
  56. package/dist/{yaml-JLRXP2CH.js → yaml-LLMR27RB.js} +3 -3
  57. package/oclif.manifest.json +1 -1
  58. package/package.json +6 -6
  59. /package/dist/{acorn-ZN7Q6UDZ.js.map → acorn-W2BZCDXM.js.map} +0 -0
  60. /package/dist/{angular-J2MXKXGC.js.map → angular-7EERNNRR.js.map} +0 -0
  61. /package/dist/{api-PHWED3B7.js.map → api-36RJFR2Y.js.map} +0 -0
  62. /package/dist/{babel-O4PIWZ7M.js.map → babel-3PANACS5.js.map} +0 -0
  63. /package/dist/{chunk-4H7R7J2T.js.map → chunk-7FDEQDMJ.js.map} +0 -0
  64. /package/dist/{chunk-K3O6TE35.js.map → chunk-EHQD7CKO.js.map} +0 -0
  65. /package/dist/{chunk-Y3SSO7TF.js.map → chunk-EQIY6O6T.js.map} +0 -0
  66. /package/dist/{chunk-GUFH7U6O.js.map → chunk-EXTWQ3GO.js.map} +0 -0
  67. /package/dist/{chunk-E5BF6ZNT.js.map → chunk-GGY33KOP.js.map} +0 -0
  68. /package/dist/{chunk-N3OOJGMF.js.map → chunk-GVSMRDGA.js.map} +0 -0
  69. /package/dist/{chunk-ZQZ76AD5.js.map → chunk-IV4OFB7R.js.map} +0 -0
  70. /package/dist/{chunk-KKNY3RBN.js.map → chunk-LW7ON3DK.js.map} +0 -0
  71. /package/dist/{chunk-DY2NVAAD.js.map → chunk-LY4G74YG.js.map} +0 -0
  72. /package/dist/{chunk-BN5U26VC.js.map → chunk-PYQVFINF.js.map} +0 -0
  73. /package/dist/{chunk-ZSID6E3B.js.map → chunk-QJVXR2IU.js.map} +0 -0
  74. /package/dist/{chunk-JSU5Z7TV.js.map → chunk-RKUVJTYB.js.map} +0 -0
  75. /package/dist/{chunk-24JWMPGA.js.map → chunk-RZFASTNP.js.map} +0 -0
  76. /package/dist/{chunk-47KCZCU5.js.map → chunk-T2NEX6F4.js.map} +0 -0
  77. /package/dist/{chunk-Q6V2WBCQ.js.map → chunk-VCSJREAZ.js.map} +0 -0
  78. /package/dist/{chunk-F4XRKALY.js.map → chunk-Y4C7DLOV.js.map} +0 -0
  79. /package/dist/{cli-truncate-V3KAVMMO.js.map → cli-truncate-KASYWIYV.js.map} +0 -0
  80. /package/dist/{dd-trace-RM2ILFLC.js.map → dd-trace-AGEFFKZH.js.map} +0 -0
  81. /package/dist/{dist-DMVFGUW4.js.map → dist-AUFMVP6Q.js.map} +0 -0
  82. /package/dist/{embedded-playwright-mcp-server-UGIS3FHL.js.map → embedded-playwright-mcp-server-TWSEWXZG.js.map} +0 -0
  83. /package/dist/{enquirer-6OJQE3AT.js.map → enquirer-E2B3BK7B.js.map} +0 -0
  84. /package/dist/{estree-TCD2UGUS.js.map → estree-5TTMFJGQ.js.map} +0 -0
  85. /package/dist/{flow-DTJ5KXYK.js.map → flow-UVCFOA7H.js.map} +0 -0
  86. /package/dist/{getMachineId-bsd-6CQNZOWX.js.map → getMachineId-bsd-W6Q7FIGO.js.map} +0 -0
  87. /package/dist/{getMachineId-darwin-VRD623QA.js.map → getMachineId-darwin-SJ5L55AG.js.map} +0 -0
  88. /package/dist/{getMachineId-linux-EL5FHQHK.js.map → getMachineId-linux-NJSQGZDG.js.map} +0 -0
  89. /package/dist/{getMachineId-unsupported-RU6ZPPJV.js.map → getMachineId-unsupported-526UHXHF.js.map} +0 -0
  90. /package/dist/{getMachineId-win-PUBLZQLL.js.map → getMachineId-win-5WFSOI4U.js.map} +0 -0
  91. /package/dist/{glimmer-AER7O7UD.js.map → glimmer-SQJMGKN3.js.map} +0 -0
  92. /package/dist/{graphql-ZCGKT3ML.js.map → graphql-O47VXQ4V.js.map} +0 -0
  93. /package/dist/{html-V3FHSD2D.js.map → html-3GW33SAW.js.map} +0 -0
  94. /package/dist/{http-2CUOSMCF.js.map → http-2HRAUBLQ.js.map} +0 -0
  95. /package/dist/{jiti-ZVPDMBG2.js.map → jiti-4V3NPIVK.js.map} +0 -0
  96. /package/dist/{log-update-Y476NEAV.js.map → log-update-I66BI4WQ.js.map} +0 -0
  97. /package/dist/{markdown-F4OH2TLC.js.map → markdown-IP5WYL5S.js.map} +0 -0
  98. /package/dist/{meriyah-7WDK4UW6.js.map → meriyah-HXGEZIIC.js.map} +0 -0
  99. /package/dist/{postcss-DWK3YRY3.js.map → postcss-LNFONHX3.js.map} +0 -0
  100. /package/dist/{read-pkg-DM7BQWMA.js.map → read-pkg-APXZ3M37.js.map} +0 -0
  101. /package/dist/{spans-54HKADTB.js.map → spans-5ZNSF7ZR.js.map} +0 -0
  102. /package/dist/{src-KMJE6Z3I.js.map → src-XOGFQGXO.js.map} +0 -0
  103. /package/dist/{token-F25OBSDW.js.map → token-J7BP2GOR.js.map} +0 -0
  104. /package/dist/{token-util-3CWH3NBE.js.map → token-util-OV47QL36.js.map} +0 -0
  105. /package/dist/{typescript-VF6VJIWL.js.map → typescript-TDVWFWCZ.js.map} +0 -0
  106. /package/dist/{wrap-ansi-YWN2NHPU.js.map → wrap-ansi-EAYJFERB.js.map} +0 -0
  107. /package/dist/{yaml-JLRXP2CH.js.map → yaml-LLMR27RB.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 = 'f2350c50f886c730143bb116bf00d9367b9cb7fa';
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-LW7ON3DK.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-PYQVFINF.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-EHQD7CKO.js";
50
50
  import {
51
51
  require_commonjs
52
- } from "./chunk-24JWMPGA.js";
52
+ } from "./chunk-RZFASTNP.js";
53
53
  import {
54
54
  require_dc_polyfill
55
- } from "./chunk-ZSID6E3B.js";
55
+ } from "./chunk-QJVXR2IU.js";
56
56
  import {
57
57
  require_token_error
58
- } from "./chunk-N3OOJGMF.js";
58
+ } from "./chunk-GVSMRDGA.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-EQIY6O6T.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-GGY33KOP.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-36RJFR2Y.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-36RJFR2Y.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-36RJFR2Y.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-SJ5L55AG.js")).getMachineId;
103620
103620
  break;
103621
103621
  case "linux":
103622
- getMachineIdImpl = (await import("./getMachineId-linux-EL5FHQHK.js")).getMachineId;
103622
+ getMachineIdImpl = (await import("./getMachineId-linux-NJSQGZDG.js")).getMachineId;
103623
103623
  break;
103624
103624
  case "freebsd":
103625
- getMachineIdImpl = (await import("./getMachineId-bsd-6CQNZOWX.js")).getMachineId;
103625
+ getMachineIdImpl = (await import("./getMachineId-bsd-W6Q7FIGO.js")).getMachineId;
103626
103626
  break;
103627
103627
  case "win32":
103628
- getMachineIdImpl = (await import("./getMachineId-win-PUBLZQLL.js")).getMachineId;
103628
+ getMachineIdImpl = (await import("./getMachineId-win-5WFSOI4U.js")).getMachineId;
103629
103629
  break;
103630
103630
  default:
103631
- getMachineIdImpl = (await import("./getMachineId-unsupported-RU6ZPPJV.js")).getMachineId;
103631
+ getMachineIdImpl = (await import("./getMachineId-unsupported-526UHXHF.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-OV47QL36.js"),
182590
+ await import("./token-J7BP2GOR.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-4V3NPIVK.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-XOGFQGXO.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-XOGFQGXO.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.1",
494611
494611
  description: "Superblocks JS SDK",
494612
494612
  homepage: "https://www.superblocks.com",
494613
494613
  license: "Superblocks Community Software License",
@@ -494883,6 +494883,17 @@ var logger = Object.freeze({
494883
494883
  });
494884
494884
  winstonLogger.warn(body);
494885
494885
  },
494886
+ warnStructured: (message, attributes2) => {
494887
+ const body = sanitizeLogMessage(message);
494888
+ const safeAttributes = sanitizeLogObject(attributes2);
494889
+ getLogger().emit({
494890
+ severityNumber: import_api_logs2.SeverityNumber.WARN,
494891
+ severityText: "WARN",
494892
+ body,
494893
+ attributes: safeAttributes
494894
+ });
494895
+ winstonLogger.warn(body);
494896
+ },
494886
494897
  error: (message, meta2) => {
494887
494898
  const safeMessage = sanitizeLogMessage(message);
494888
494899
  const safeError = meta2?.error ? (({ kind, message: message2, stack: stack2 }) => ({ kind, message: message2, stack: stack2 }))(sanitizeLogError(meta2.error)) : void 0;
@@ -494908,6 +494919,11 @@ function getLogger2(loggerOverride) {
494908
494919
  debug: loggerOverride,
494909
494920
  info: loggerOverride,
494910
494921
  warn: loggerOverride,
494922
+ // The override path is for test/debug sinks only: like debug/info/warn
494923
+ // above, it forwards raw args to the supplied function and does NOT
494924
+ // sanitize or emit OTel attributes. Production callers use the default
494925
+ // logger (and the vite-plugin wrapLogger) which sanitize before emitting.
494926
+ warnStructured: (message, attributes2) => loggerOverride(message, attributes2),
494911
494927
  error: loggerOverride
494912
494928
  };
494913
494929
  }
@@ -494969,7 +494985,7 @@ var config = void 0;
494969
494985
  var configured = false;
494970
494986
  var ddTracePromise = void 0;
494971
494987
  async function getDdTrace() {
494972
- ddTracePromise ??= import("./dd-trace-RM2ILFLC.js").then((module) => module.default);
494988
+ ddTracePromise ??= import("./dd-trace-AGEFFKZH.js").then((module) => module.default);
494973
494989
  return await ddTracePromise;
494974
494990
  }
494975
494991
  var deploymentType = (() => {
@@ -496978,6 +496994,16 @@ function wrapLogger(logger21) {
496978
496994
  notifyListeners("warn", sanitized);
496979
496995
  logger21.warn(...sanitized);
496980
496996
  },
496997
+ warnStructured: (message, attributes2) => {
496998
+ const sanitizedMessage = sanitizeLogMessage2(message);
496999
+ const sanitizedAttributes = sanitizeLogObject2(attributes2);
497000
+ notifyListeners("warn", [sanitizedMessage, sanitizedAttributes]);
497001
+ if (logger21.warnStructured) {
497002
+ logger21.warnStructured(sanitizedMessage, sanitizedAttributes);
497003
+ } else {
497004
+ logger21.warn(sanitizedMessage, sanitizedAttributes);
497005
+ }
497006
+ },
496981
497007
  error: (message, meta2) => {
496982
497008
  const sanitizedMessage = sanitizeLogMessage2(message);
496983
497009
  const sanitizedMeta = sanitizeErrorMeta(meta2);
@@ -497008,6 +497034,14 @@ function getLogger3() {
497008
497034
  debug: (...messages3) => (_defaultLogger ?? consoleLogger).debug(...messages3),
497009
497035
  info: (...messages3) => (_defaultLogger ?? consoleLogger).info(...messages3),
497010
497036
  warn: (...messages3) => (_defaultLogger ?? consoleLogger).warn(...messages3),
497037
+ warnStructured: (message, attributes2) => {
497038
+ const target = _defaultLogger ?? consoleLogger;
497039
+ if (target.warnStructured) {
497040
+ target.warnStructured(message, attributes2);
497041
+ } else {
497042
+ target.warn(message, attributes2);
497043
+ }
497044
+ },
497011
497045
  error: (message, meta2) => (_defaultLogger ?? consoleLogger).error(message, meta2)
497012
497046
  };
497013
497047
  return _cachedProxy;
@@ -497055,6 +497089,14 @@ function getPrefixedLogger(prefix, verbose2 = true) {
497055
497089
  },
497056
497090
  info: (...messages3) => baseLogger.info(prefix, ...messages3),
497057
497091
  warn: (...messages3) => baseLogger.warn(prefix, ...messages3),
497092
+ warnStructured: (message, attributes2) => {
497093
+ const prefixedMessage = `${prefix} ${message}`;
497094
+ if (baseLogger.warnStructured) {
497095
+ baseLogger.warnStructured(prefixedMessage, attributes2);
497096
+ } else {
497097
+ baseLogger.warn(prefixedMessage, attributes2);
497098
+ }
497099
+ },
497058
497100
  error: (message, meta2) => baseLogger.error(`${prefix} ${message}`, meta2)
497059
497101
  };
497060
497102
  }
@@ -518590,6 +518632,203 @@ function buildThinkingProviderOptions(coreModel, params) {
518590
518632
  return { anthropic: anthropic3, bedrock, headers };
518591
518633
  }
518592
518634
 
518635
+ // ../../../clark/dist/snowflake-cortex-fetch.js
518636
+ init_cjs_shims();
518637
+ var HTTP_STATUS_TO_ERROR_TYPE = {
518638
+ 400: "invalid_request_error",
518639
+ 401: "authentication_error",
518640
+ 403: "permission_error",
518641
+ 404: "not_found_error",
518642
+ 429: "rate_limit_error",
518643
+ 500: "api_error",
518644
+ 529: "overloaded_error"
518645
+ };
518646
+ function normalizeErrorResponse(response, text3) {
518647
+ try {
518648
+ const body = JSON.parse(text3);
518649
+ if (body?.error && !body?.type) {
518650
+ const errorType = HTTP_STATUS_TO_ERROR_TYPE[response.status] ?? "api_error";
518651
+ return new Response(JSON.stringify({
518652
+ type: "error",
518653
+ error: {
518654
+ type: errorType,
518655
+ message: body.error.message ?? text3
518656
+ }
518657
+ }), {
518658
+ status: response.status,
518659
+ statusText: response.statusText,
518660
+ headers: response.headers
518661
+ });
518662
+ }
518663
+ } catch {
518664
+ }
518665
+ return new Response(text3, {
518666
+ status: response.status,
518667
+ statusText: response.statusText,
518668
+ headers: response.headers
518669
+ });
518670
+ }
518671
+ function normalizeSuccessfulResponseBody(value2) {
518672
+ if (Array.isArray(value2)) {
518673
+ return value2.map(normalizeSuccessfulResponseBody);
518674
+ }
518675
+ if (value2 && typeof value2 === "object") {
518676
+ return Object.fromEntries(Object.entries(value2).map(([key2, nestedValue]) => {
518677
+ if (key2 === "citations" && nestedValue === null) {
518678
+ return [key2, []];
518679
+ }
518680
+ if ((key2 === "cache_creation_input_tokens" || key2 === "cache_read_input_tokens") && nestedValue === null) {
518681
+ return [key2, 0];
518682
+ }
518683
+ return [key2, normalizeSuccessfulResponseBody(nestedValue)];
518684
+ }));
518685
+ }
518686
+ return value2;
518687
+ }
518688
+ function normalizeSuccessResponse(response, text3) {
518689
+ try {
518690
+ return new Response(JSON.stringify(normalizeSuccessfulResponseBody(JSON.parse(text3))), {
518691
+ status: response.status,
518692
+ statusText: response.statusText,
518693
+ headers: response.headers
518694
+ });
518695
+ } catch {
518696
+ return new Response(text3, {
518697
+ status: response.status,
518698
+ statusText: response.statusText,
518699
+ headers: response.headers
518700
+ });
518701
+ }
518702
+ }
518703
+ function stripCacheControl(value2) {
518704
+ if (Array.isArray(value2)) {
518705
+ return value2.map(stripCacheControl);
518706
+ }
518707
+ if (value2 && typeof value2 === "object") {
518708
+ return Object.fromEntries(Object.entries(value2).filter(([key2]) => key2 !== "cache_control").map(([key2, nested]) => [key2, stripCacheControl(nested)]));
518709
+ }
518710
+ return value2;
518711
+ }
518712
+ function stripCortexUnsupportedCacheControl(body) {
518713
+ if (!body || typeof body !== "object") {
518714
+ return body;
518715
+ }
518716
+ const result = {
518717
+ ...body
518718
+ };
518719
+ delete result.cache_control;
518720
+ if (Array.isArray(result.messages)) {
518721
+ result.messages = result.messages.map((message) => message && typeof message === "object" && message.role === "user" ? message : stripCacheControl(message));
518722
+ }
518723
+ if (Array.isArray(result.tools)) {
518724
+ result.tools = result.tools.map(stripCacheControl);
518725
+ }
518726
+ return result;
518727
+ }
518728
+ var UNSUPPORTED_SCHEMA_KEYWORDS = /* @__PURE__ */ new Set([
518729
+ "minLength",
518730
+ "maxLength",
518731
+ "pattern",
518732
+ "format",
518733
+ "minimum",
518734
+ "maximum",
518735
+ "exclusiveMinimum",
518736
+ "exclusiveMaximum",
518737
+ "multipleOf",
518738
+ "minItems",
518739
+ "maxItems",
518740
+ "uniqueItems",
518741
+ "contains",
518742
+ "minContains",
518743
+ "maxContains",
518744
+ "minProperties",
518745
+ "maxProperties",
518746
+ "patternProperties",
518747
+ "propertyNames"
518748
+ ]);
518749
+ var SCHEMA_MAP_KEYWORDS = /* @__PURE__ */ new Set(["properties", "$defs", "definitions"]);
518750
+ var OPAQUE_SCHEMA_KEYWORDS = /* @__PURE__ */ new Set([
518751
+ "enum",
518752
+ "const",
518753
+ "default",
518754
+ "examples"
518755
+ ]);
518756
+ function sanitizeJsonSchema(node) {
518757
+ if (Array.isArray(node)) {
518758
+ return node.map(sanitizeJsonSchema);
518759
+ }
518760
+ if (node && typeof node === "object") {
518761
+ const sanitized = {};
518762
+ for (const [key2, value2] of Object.entries(node)) {
518763
+ if (UNSUPPORTED_SCHEMA_KEYWORDS.has(key2)) {
518764
+ continue;
518765
+ }
518766
+ if (OPAQUE_SCHEMA_KEYWORDS.has(key2)) {
518767
+ sanitized[key2] = value2;
518768
+ } else if (SCHEMA_MAP_KEYWORDS.has(key2) && value2 && typeof value2 === "object" && !Array.isArray(value2)) {
518769
+ sanitized[key2] = Object.fromEntries(Object.entries(value2).map(([name17, subSchema]) => [name17, sanitizeJsonSchema(subSchema)]));
518770
+ } else {
518771
+ sanitized[key2] = sanitizeJsonSchema(value2);
518772
+ }
518773
+ }
518774
+ return sanitized;
518775
+ }
518776
+ return node;
518777
+ }
518778
+ function stripUnsupportedSchemaKeywords(value2) {
518779
+ if (Array.isArray(value2)) {
518780
+ return value2.map(stripUnsupportedSchemaKeywords);
518781
+ }
518782
+ if (value2 && typeof value2 === "object") {
518783
+ return Object.fromEntries(Object.entries(value2).map(([key2, nested]) => key2 === "input_schema" ? [key2, sanitizeJsonSchema(nested)] : [key2, stripUnsupportedSchemaKeywords(nested)]));
518784
+ }
518785
+ return value2;
518786
+ }
518787
+ function sanitizeRequestInit(init2, forwardCacheControl) {
518788
+ if (!init2 || typeof init2.body !== "string") {
518789
+ return init2;
518790
+ }
518791
+ try {
518792
+ const parsed = JSON.parse(init2.body);
518793
+ const afterCacheControl = forwardCacheControl ? stripCortexUnsupportedCacheControl(parsed) : stripCacheControl(parsed);
518794
+ const cleaned = stripUnsupportedSchemaKeywords(afterCacheControl);
518795
+ return { ...init2, body: JSON.stringify(cleaned) };
518796
+ } catch {
518797
+ return init2;
518798
+ }
518799
+ }
518800
+ function createSnowflakeCortexFetch({ forwardCacheControl, onPromptCachingRejected }) {
518801
+ return async (input, init2) => {
518802
+ let response = await globalThis.fetch(input, sanitizeRequestInit(init2, forwardCacheControl));
518803
+ if (forwardCacheControl && response.status === 400) {
518804
+ const text3 = await response.text();
518805
+ if (/cache_control/i.test(text3)) {
518806
+ onPromptCachingRejected?.();
518807
+ response = await globalThis.fetch(input, sanitizeRequestInit(init2, false));
518808
+ } else {
518809
+ return normalizeErrorResponse(new Response(text3, {
518810
+ status: response.status,
518811
+ statusText: response.statusText,
518812
+ headers: response.headers
518813
+ }), text3);
518814
+ }
518815
+ }
518816
+ if (!response.ok) {
518817
+ const text3 = await response.text();
518818
+ return normalizeErrorResponse(response, text3);
518819
+ }
518820
+ const contentType = response.headers.get("content-type") ?? "";
518821
+ if (contentType.includes("application/json")) {
518822
+ const text3 = await response.text();
518823
+ return normalizeSuccessResponse(response, text3);
518824
+ }
518825
+ return response;
518826
+ };
518827
+ }
518828
+ var snowflakeCortexFetch = createSnowflakeCortexFetch({
518829
+ forwardCacheControl: false
518830
+ });
518831
+
518593
518832
  // ../../../clark/dist/mcp/index.js
518594
518833
  init_cjs_shims();
518595
518834
 
@@ -520372,7 +520611,7 @@ var MAX_ATTRIBUTE_LENGTH = 64e3;
520372
520611
  var LLMObsSpanWriter = null;
520373
520612
  async function loadLLMObsSpanWriter() {
520374
520613
  if (!LLMObsSpanWriter) {
520375
- const module = await import("./spans-54HKADTB.js");
520614
+ const module = await import("./spans-5ZNSF7ZR.js");
520376
520615
  LLMObsSpanWriter = module.default;
520377
520616
  }
520378
520617
  return LLMObsSpanWriter;
@@ -550150,6 +550389,7 @@ ${filteredIntegrations.map((integration) => formatIntegrationForPlanPrompt(integ
550150
550389
  retry: {
550151
550390
  maxAttempts: 0
550152
550391
  },
550392
+ observers: services.streamObservers,
550153
550393
  onError: (error40) => {
550154
550394
  clark.logger.error("[exitPlanMode] LLM stream generation failed", getErrorMeta2(error40));
550155
550395
  }
@@ -550313,8 +550553,9 @@ var PLAN_TIME_ESTIMATES = {
550313
550553
  Large: "3 minutes",
550314
550554
  "Extra Large": "5+ minutes"
550315
550555
  };
550556
+ var EXIT_PLAN_MODE_PLAN_GENERATION_PROMPT_PREFIX = "Based on our conversation and the information gathered, create a specific, actionable plan.";
550316
550557
  var PLAN_GENERATION_PROMPT = `
550317
- Based on our conversation and the information gathered, create a specific, actionable plan.
550558
+ ${EXIT_PLAN_MODE_PLAN_GENERATION_PROMPT_PREFIX}
550318
550559
 
550319
550560
  IMPORTANT: You MUST output a plan. Even for trivial tasks, provide a brief plan describing what will be done.
550320
550561
 
@@ -551575,6 +551816,7 @@ var RpcTimeoutError = class extends Error {
551575
551816
  }
551576
551817
  };
551577
551818
  var DEFAULT_RPC_TIMEOUT_MS = 6e4;
551819
+ var FETCH_INTEGRATIONS_TIMEOUT_MS = 15e3;
551578
551820
  async function withRpcTimeout(promise2, timeoutMs = DEFAULT_RPC_TIMEOUT_MS, operationName = "RPC call") {
551579
551821
  let timeoutId;
551580
551822
  const timeoutPromise = new Promise((_4, reject) => {
@@ -552017,7 +552259,7 @@ var IntegrationStore = (() => {
552017
552259
  }
552018
552260
  async fetchIntegrations(editorClient, mentionedIntegrations) {
552019
552261
  getLogger3().info(`[integration-store] Fetching integrations from browser...`);
552020
- const integrations = await withRpcTimeout(editorClient?.call.aiGetIntegrations(), DEFAULT_RPC_TIMEOUT_MS, "aiGetIntegrations") ?? [];
552262
+ const integrations = await withRpcTimeout(editorClient?.call.aiGetIntegrations(), FETCH_INTEGRATIONS_TIMEOUT_MS, "aiGetIntegrations") ?? [];
552021
552263
  getLogger3().info(`[integration-store] Registering ${integrations.length} integrations`);
552022
552264
  for (const integration of integrations) {
552023
552265
  const pluginId = integration.type;
@@ -561438,6 +561680,11 @@ function wrapError(err, provider) {
561438
561680
  const underlyingError = new LLMProviderError({
561439
561681
  provider,
561440
561682
  message: err.message,
561683
+ // A StallTimeoutError carries no provider ErrorCategory, so the constructor
561684
+ // would default it to "api_error" and surface the generic model-error
561685
+ // string. Classify exhausted stalls as "stall" so the user gets a
561686
+ // stall-specific message and observability can distinguish them (APPS-4389).
561687
+ type: err.cause instanceof StallTimeoutError ? "stall" : void 0,
561441
561688
  cause: err.cause
561442
561689
  });
561443
561690
  underlyingError.isRetryable = false;
@@ -601513,6 +601760,13 @@ init_cjs_shims();
601513
601760
 
601514
601761
  // ../../../vite-plugin-file-sync/dist/ai-service/llm/stream/config.js
601515
601762
  init_cjs_shims();
601763
+ var SERVER_CONTEXT_COMPACTION_FIRST_CHUNK_TIMEOUT_MS = 24e4;
601764
+ function defaultFirstChunkTimeoutMs(serverSideContextManagement, idleTimeoutMs) {
601765
+ return serverSideContextManagement ? Math.max(idleTimeoutMs, SERVER_CONTEXT_COMPACTION_FIRST_CHUNK_TIMEOUT_MS) : idleTimeoutMs;
601766
+ }
601767
+ function defaultFallbackStrategy(provider) {
601768
+ return provider === "snowflake" ? "provider-then-model-no-retry" : "model-then-provider";
601769
+ }
601516
601770
  var StreamConfig = class _StreamConfig {
601517
601771
  _retry;
601518
601772
  _provider;
@@ -601533,8 +601787,21 @@ var StreamConfig = class _StreamConfig {
601533
601787
  const retry = {
601534
601788
  maxAttempts: options8.retry?.maxAttempts ?? 5,
601535
601789
  maxAttemptsPerProvider: options8.retry?.maxAttemptsPerProvider ?? 2,
601790
+ // Generic default for callers with no server-side context management.
601791
+ // Like firstChunkTimeoutMs below, StreamConfig stays agnostic and does
601792
+ // NOT floor this against the proxy upstream-stall timeout — callers that
601793
+ // run behind the proxy must pass a value >= the proxy stall budget so a
601794
+ // single upstream stall can't exhaust the retry clock (LLMClient does
601795
+ // this via Math.max(..., proxyStallTimeoutMs)). See APPS-4520.
601536
601796
  maxTotalTimeMs: options8.retry?.maxTotalTimeMs ?? 12e4,
601537
601797
  idleTimeoutMs: options8.retry?.idleTimeoutMs ?? 9e4,
601798
+ // Defaults to the inter-chunk idle budget so generic callers see no
601799
+ // behavior change. StreamConfig is context-management-agnostic and does
601800
+ // NOT itself apply the larger server-side first-chunk budget — callers
601801
+ // that opt into server-side context management must pass a value derived
601802
+ // from `defaultFirstChunkTimeoutMs(serverSide, idleTimeoutMs)` (LLMClient
601803
+ // does this). See APPS-4520.
601804
+ firstChunkTimeoutMs: options8.retry?.firstChunkTimeoutMs ?? options8.retry?.idleTimeoutMs ?? 9e4,
601538
601805
  initialDelayMs: options8.retry?.initialDelayMs ?? 500,
601539
601806
  maxDelayMs: options8.retry?.maxDelayMs ?? 1e4,
601540
601807
  backoffMultiplier: options8.retry?.backoffMultiplier ?? 2
@@ -601545,7 +601812,7 @@ var StreamConfig = class _StreamConfig {
601545
601812
  };
601546
601813
  const fallback = {
601547
601814
  enabled: options8.fallback?.enabled ?? false,
601548
- strategy: options8.fallback?.strategy ?? "model-then-provider",
601815
+ strategy: options8.fallback?.strategy ?? defaultFallbackStrategy(options8.provider),
601549
601816
  fallbackProviders: options8.fallback?.fallbackProviders
601550
601817
  };
601551
601818
  const logging = {
@@ -601581,21 +601848,36 @@ init_cjs_shims();
601581
601848
  var IdleMonitor = class {
601582
601849
  session;
601583
601850
  maxIdleTimeMs;
601851
+ firstChunkTimeoutMs;
601584
601852
  onStallCallback;
601853
+ onServerCompactionStart;
601585
601854
  timer = null;
601586
601855
  stallError = null;
601587
601856
  stallCallbacks = [];
601588
601857
  subscribed = false;
601858
+ hasReceivedChunk = false;
601859
+ compactionTextBlockIds = /* @__PURE__ */ new Set();
601589
601860
  constructor(options8) {
601590
601861
  this.session = options8.session;
601591
601862
  this.maxIdleTimeMs = options8.maxIdleTimeMs;
601863
+ this.firstChunkTimeoutMs = options8.firstChunkTimeoutMs ?? options8.maxIdleTimeMs;
601592
601864
  this.onStallCallback = options8.onStall;
601865
+ this.onServerCompactionStart = options8.onServerCompactionStart;
601866
+ }
601867
+ /**
601868
+ * Active budget: the first-chunk budget until useful output arrives, then
601869
+ * the inter-chunk idle budget.
601870
+ */
601871
+ currentTimeoutMs() {
601872
+ return this.hasReceivedChunk ? this.maxIdleTimeMs : this.firstChunkTimeoutMs;
601593
601873
  }
601594
601874
  /**
601595
601875
  * Start the idle monitor. Arms the timer and subscribes to session events.
601596
601876
  */
601597
601877
  start() {
601598
601878
  this.stallError = null;
601879
+ this.hasReceivedChunk = false;
601880
+ this.compactionTextBlockIds.clear();
601599
601881
  this.session.resetActivityTimer();
601600
601882
  this.subscribeToEvents();
601601
601883
  this.armTimer();
@@ -601637,17 +601919,30 @@ var IdleMonitor = class {
601637
601919
  }
601638
601920
  this.subscribed = true;
601639
601921
  this.session.events.on("chunk", this.handleChunk);
601922
+ this.session.events.on("step:start", this.handleStepStart);
601640
601923
  this.session.events.on("retry", this.handleRetry);
601641
601924
  this.session.events.on("session:complete", this.handleSessionEnd);
601642
601925
  this.session.events.on("session:error", this.handleSessionEnd);
601643
601926
  this.session.events.on("session:abort", this.handleSessionEnd);
601644
601927
  }
601645
- handleChunk = () => {
601928
+ handleChunk = (chunk) => {
601929
+ if (!this.keepsFirstChunkBudget(chunk)) {
601930
+ this.hasReceivedChunk = true;
601931
+ }
601646
601932
  this.stallError = null;
601647
601933
  this.stallCallbacks = [];
601648
601934
  this.armTimer();
601649
601935
  };
601936
+ handleStepStart = () => {
601937
+ this.hasReceivedChunk = false;
601938
+ this.compactionTextBlockIds.clear();
601939
+ this.stallError = null;
601940
+ this.session.resetActivityTimer();
601941
+ this.armTimer();
601942
+ };
601650
601943
  handleRetry = () => {
601944
+ this.hasReceivedChunk = false;
601945
+ this.compactionTextBlockIds.clear();
601651
601946
  this.stallError = null;
601652
601947
  this.stallCallbacks = [];
601653
601948
  this.session.resetActivityTimer();
@@ -601662,14 +601957,39 @@ var IdleMonitor = class {
601662
601957
  }
601663
601958
  this.timer = setTimeout(() => {
601664
601959
  this.fireStall();
601665
- }, this.maxIdleTimeMs);
601960
+ }, this.currentTimeoutMs());
601961
+ }
601962
+ keepsFirstChunkBudget(chunk) {
601963
+ if (chunk.type === "raw" && this.compactionTextBlockIds.size > 0) {
601964
+ return true;
601965
+ }
601966
+ if (chunk.type === "text-start") {
601967
+ const id2 = getChunkTextId(chunk);
601968
+ if (id2 && isAnthropicCompactionMetadata(chunk.providerMetadata)) {
601969
+ if (!this.compactionTextBlockIds.has(id2)) {
601970
+ this.compactionTextBlockIds.add(id2);
601971
+ this.onServerCompactionStart?.(id2);
601972
+ }
601973
+ return true;
601974
+ }
601975
+ }
601976
+ if (chunk.type === "text-delta" || chunk.type === "text-end") {
601977
+ const id2 = getChunkTextId(chunk);
601978
+ if (id2 && this.compactionTextBlockIds.has(id2)) {
601979
+ if (chunk.type === "text-end") {
601980
+ this.compactionTextBlockIds.delete(id2);
601981
+ }
601982
+ return true;
601983
+ }
601984
+ }
601985
+ return false;
601666
601986
  }
601667
601987
  fireStall() {
601668
601988
  if (!this.session.isPending()) {
601669
601989
  return;
601670
601990
  }
601671
601991
  const idleTime = this.session.getTimeSinceLastActivity();
601672
- this.stallError = new StallTimeoutError(idleTime, this.maxIdleTimeMs);
601992
+ this.stallError = new StallTimeoutError(idleTime, this.currentTimeoutMs());
601673
601993
  try {
601674
601994
  this.onStallCallback?.(this.stallError);
601675
601995
  } catch {
@@ -601680,6 +602000,19 @@ var IdleMonitor = class {
601680
602000
  this.stallCallbacks = [];
601681
602001
  }
601682
602002
  };
602003
+ function getChunkTextId(chunk) {
602004
+ return "id" in chunk && typeof chunk.id === "string" ? chunk.id : void 0;
602005
+ }
602006
+ function isAnthropicCompactionMetadata(metadata) {
602007
+ if (!isRecord(metadata)) {
602008
+ return false;
602009
+ }
602010
+ const anthropic3 = metadata.anthropic;
602011
+ return isRecord(anthropic3) && anthropic3.type === "compaction";
602012
+ }
602013
+ function isRecord(value2) {
602014
+ return typeof value2 === "object" && value2 !== null;
602015
+ }
601683
602016
 
601684
602017
  // ../../../vite-plugin-file-sync/dist/ai-service/llm/stream/managed-stream.js
601685
602018
  init_cjs_shims();
@@ -601706,14 +602039,16 @@ function createManagedStream(source2, session, idleMonitor) {
601706
602039
  void session.events.emit("chunk", result.value, session);
601707
602040
  continue;
601708
602041
  }
601709
- session.recordChunk();
601710
- void session.events.emit("chunk", result.value, session);
601711
602042
  if (result.value.type === "error") {
601712
602043
  const chunkError = result.value.error;
602044
+ session.resetActivityTimer();
602045
+ void session.events.emit("chunk", result.value, session);
601713
602046
  closed = true;
601714
602047
  controller.error(chunkError);
601715
602048
  return;
601716
602049
  }
602050
+ session.recordChunk();
602051
+ void session.events.emit("chunk", result.value, session);
601717
602052
  controller.enqueue(result.value);
601718
602053
  return;
601719
602054
  } catch (error40) {
@@ -601792,11 +602127,6 @@ var RetryEngine = class {
601792
602127
  }
601793
602128
  return { shouldRetry: false, delayMs: 0, reason: "non-retryable" };
601794
602129
  }
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
602130
  const { maxAttempts } = this.config.retry;
601801
602131
  if (session.attempt >= maxAttempts) {
601802
602132
  return { shouldRetry: false, delayMs: 0, reason: "max-attempts" };
@@ -601810,6 +602140,11 @@ var RetryEngine = class {
601810
602140
  }
601811
602141
  return { shouldRetry: false, delayMs: 0, reason: "max-attempts" };
601812
602142
  }
602143
+ const timeSinceContent = session.getTimeSinceLastContent();
602144
+ const { maxTotalTimeMs } = this.config.retry;
602145
+ if (timeSinceContent >= maxTotalTimeMs) {
602146
+ return { shouldRetry: false, delayMs: 0, reason: "max-time" };
602147
+ }
601813
602148
  const delayMs = this.calculateDelay(session.attempt);
601814
602149
  return { shouldRetry: true, delayMs };
601815
602150
  }
@@ -602020,12 +602355,17 @@ var StreamSession = class {
602020
602355
  };
602021
602356
  error = null;
602022
602357
  outcome = "pending";
602023
- // tracks when we last received a chunk or started a retry, used for max-time checks.
602358
+ // tracks when we last received a chunk, keep-alive, or started a retry; used
602359
+ // for IdleMonitor liveness checks. NOT the retry max-time budget — that now
602360
+ // measures getTimeSinceLastContent() so keep-alives can't extend it (APPS-4641).
602024
602361
  lastActivityTime;
602362
+ // tracks when we last received a content chunk (NOT reset by keep-alives or retries).
602363
+ lastContentTime;
602025
602364
  constructor(options8) {
602026
602365
  this.id = crypto.randomUUID();
602027
602366
  this.startTime = Date.now();
602028
602367
  this.lastActivityTime = this.startTime;
602368
+ this.lastContentTime = this.startTime;
602029
602369
  this.config = options8.config;
602030
602370
  this.provider = options8.initialProvider;
602031
602371
  this.organizationId = options8.organizationId;
@@ -602082,6 +602422,7 @@ var StreamSession = class {
602082
602422
  }
602083
602423
  this.metrics.chunkCount++;
602084
602424
  this.lastActivityTime = Date.now();
602425
+ this.lastContentTime = Date.now();
602085
602426
  }
602086
602427
  setTotalTokens(tokens) {
602087
602428
  this.metrics.totalTokens = tokens;
@@ -602092,14 +602433,30 @@ var StreamSession = class {
602092
602433
  getElapsedMs() {
602093
602434
  return Date.now() - this.startTime;
602094
602435
  }
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.
602436
+ // Time since the last activity of ANY kind (content, keep-alives, retries).
602437
+ // Reset by resetActivityTimer() and recordRetry(), so it measures liveness,
602438
+ // not real progress. Used by IdleMonitor's stall detection — NOT for the
602439
+ // retry max-time budget (that uses getTimeSinceLastContent()).
602097
602440
  getTimeSinceLastActivity() {
602098
602441
  return Date.now() - this.lastActivityTime;
602099
602442
  }
602443
+ // Time since the last CONTENT chunk. Unlike getTimeSinceLastActivity(), this is
602444
+ // NOT reset by keep-alives (resetActivityTimer) or recordRetry — so it measures
602445
+ // real progress across the whole session. Used by RetryEngine's max-time guard.
602446
+ getTimeSinceLastContent() {
602447
+ return Date.now() - this.lastContentTime;
602448
+ }
602100
602449
  resetActivityTimer() {
602101
602450
  this.lastActivityTime = Date.now();
602102
602451
  }
602452
+ // Advances both the liveness clock and the retry-budget content clock without
602453
+ // touching content metrics (chunkCount / timeToFirstTokenMs). For upstream
602454
+ // chunks that are real model output — proof of progress — but are filtered
602455
+ // out before downstream consumers (server-side compaction deltas).
602456
+ recordContentProgress() {
602457
+ this.lastActivityTime = Date.now();
602458
+ this.lastContentTime = Date.now();
602459
+ }
602103
602460
  };
602104
602461
 
602105
602462
  // ../../../vite-plugin-file-sync/dist/ai-service/llm/stream/orchestrator.js
@@ -602150,6 +602507,7 @@ var StreamOrchestrator = class {
602150
602507
  await session.events.emit("session:start", session, {
602151
602508
  system: options8.system,
602152
602509
  messages: options8.messages ?? [],
602510
+ user: options8.user,
602153
602511
  tools: options8.tools
602154
602512
  });
602155
602513
  internalAbortController.signal.addEventListener("abort", () => {
@@ -602158,17 +602516,43 @@ var StreamOrchestrator = class {
602158
602516
  const idleMonitor = new IdleMonitor({
602159
602517
  session,
602160
602518
  maxIdleTimeMs: this.config.retry.idleTimeoutMs,
602161
- onStall: (error40) => {
602162
- this.logger.warn(`[orchestrator] Idle timeout exceeded, triggering retry`, {
602519
+ firstChunkTimeoutMs: this.config.retry.firstChunkTimeoutMs,
602520
+ onServerCompactionStart: (blockId) => {
602521
+ this.logger.debug("[orchestrator] Server-side compaction chunk detected; holding first-chunk idle budget", {
602163
602522
  sessionId: session.id,
602164
602523
  provider: session.provider.name,
602165
602524
  model: session.provider.model,
602166
602525
  attempt: session.attempt,
602167
- idleMs: error40.idleTimeMs,
602168
- maxIdleTimeMs: error40.maxIdleTimeMs,
602169
- elapsedMs: session.getElapsedMs(),
602170
- chunksReceived: session.metrics.chunkCount
602526
+ blockId,
602527
+ firstChunkTimeoutMs: this.config.retry.firstChunkTimeoutMs
602171
602528
  });
602529
+ },
602530
+ onStall: (error40) => {
602531
+ const budgetKind = error40.maxIdleTimeMs === this.config.retry.firstChunkTimeoutMs ? "first-chunk" : "inter-chunk";
602532
+ const message = `[orchestrator] Idle timeout exceeded, triggering retry`;
602533
+ const attributes2 = {
602534
+ event: "stream_stall",
602535
+ session_id: session.id,
602536
+ provider: session.provider.name,
602537
+ model: session.provider.model,
602538
+ attempt: session.attempt,
602539
+ budget_kind: budgetKind,
602540
+ idle_ms: error40.idleTimeMs,
602541
+ budget_ms: error40.maxIdleTimeMs,
602542
+ elapsed_ms: session.getElapsedMs(),
602543
+ chunks_received: session.metrics.chunkCount
602544
+ };
602545
+ if (session.organizationId) {
602546
+ attributes2.organization_id = session.organizationId;
602547
+ }
602548
+ if (session.applicationId) {
602549
+ attributes2.application_id = session.applicationId;
602550
+ }
602551
+ if (this.logger.warnStructured) {
602552
+ this.logger.warnStructured(message, attributes2);
602553
+ } else {
602554
+ this.logger.warn(message, attributes2);
602555
+ }
602172
602556
  }
602173
602557
  });
602174
602558
  const result = await this.startStreamWithRetry(optionsWithAbort, session, retryEngine);
@@ -604050,14 +604434,20 @@ var LLMClient = class {
604050
604434
  const fallbackEnabled = this.unifiedProviderEnabled && (enableFallback ?? false);
604051
604435
  logger21.info(`[llm-client] provider=${providerConfig.provider} model=${providerConfig.model} unifiedProvider=${this.unifiedProviderEnabled} fallback=${fallbackEnabled} retry=${safeJsonStringify(retryConfig)}`);
604052
604436
  const extendedThinking = usesAdaptiveEffort(providerConfig.model) || providerConfig.model === "claude-opus-4-6";
604053
- const defaultMaxTotalTimeMs = extendedThinking ? 5 * 60 * 1e3 : 2 * 60 * 1e3;
604437
+ const defaultMaxTotalTimeMs = extendedThinking ? 30 * 60 * 1e3 : 15 * 60 * 1e3;
604054
604438
  const defaultIdleTimeoutMs = extendedThinking ? 18e4 : 9e4;
604439
+ const resolvedIdleTimeoutMs = retryConfig?.idleTimeoutMs ?? this.retryOptions?.idleTimeoutMs ?? defaultIdleTimeoutMs;
604440
+ const serverSideContextManagement = contextConfig?.contextManagement?.type === "server";
604441
+ const resolvedFirstChunkTimeoutMs = retryConfig?.firstChunkTimeoutMs ?? this.retryOptions?.firstChunkTimeoutMs ?? defaultFirstChunkTimeoutMs(serverSideContextManagement, resolvedIdleTimeoutMs);
604442
+ const proxyStallTimeoutMs = extendedThinking ? 9e5 : 45e4;
604443
+ const resolvedMaxTotalTimeMs = Math.max(retryConfig?.maxTotalTimeMs ?? this.retryOptions?.maxTotalTimeMs ?? defaultMaxTotalTimeMs, resolvedFirstChunkTimeoutMs, proxyStallTimeoutMs);
604055
604444
  const config4 = StreamConfig.create({
604056
604445
  retry: {
604057
604446
  ...this.retryOptions,
604058
604447
  ...retryConfig,
604059
- maxTotalTimeMs: retryConfig?.maxTotalTimeMs ?? this.retryOptions?.maxTotalTimeMs ?? defaultMaxTotalTimeMs,
604060
- idleTimeoutMs: retryConfig?.idleTimeoutMs ?? this.retryOptions?.idleTimeoutMs ?? defaultIdleTimeoutMs
604448
+ maxTotalTimeMs: resolvedMaxTotalTimeMs,
604449
+ idleTimeoutMs: resolvedIdleTimeoutMs,
604450
+ firstChunkTimeoutMs: resolvedFirstChunkTimeoutMs
604061
604451
  },
604062
604452
  provider: providerConfig.provider,
604063
604453
  model: providerConfig.model,
@@ -609622,7 +610012,7 @@ var PlaywrightMcpServerManager = class {
609622
610012
  this.logger.info(`Starting embedded Playwright MCP server: browser=${options8?.browser || "chromium"}, headless=${options8?.headless !== false}`);
609623
610013
  }
609624
610014
  try {
609625
- const { startEmbeddedPlaywrightMcpServer } = await import("./embedded-playwright-mcp-server-UGIS3FHL.js");
610015
+ const { startEmbeddedPlaywrightMcpServer } = await import("./embedded-playwright-mcp-server-TWSEWXZG.js");
609626
610016
  this.server = await startEmbeddedPlaywrightMcpServer({
609627
610017
  storageStatePath: options8?.storageStatePath,
609628
610018
  jwt: options8?.jwt,
@@ -610000,6 +610390,46 @@ REQUIREMENTS:
610000
610390
  - 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
610391
  }
610002
610392
 
610393
+ // ../../../vite-plugin-file-sync/dist/ai-service/request-deduplicator.js
610394
+ init_cjs_shims();
610395
+ var RequestDeduplicator = class {
610396
+ maxSize;
610397
+ seen = /* @__PURE__ */ new Set();
610398
+ constructor(maxSize = 200) {
610399
+ this.maxSize = maxSize;
610400
+ }
610401
+ /** Returns true if the id was already recorded, without recording it. */
610402
+ has(requestId) {
610403
+ return this.seen.has(requestId);
610404
+ }
610405
+ /**
610406
+ * Records the id if it has not been seen before. Returns true when the id is
610407
+ * new (the caller should proceed) and false when it is a duplicate (the
610408
+ * caller should treat the command as already handled).
610409
+ */
610410
+ markIfNew(requestId) {
610411
+ if (this.seen.has(requestId)) {
610412
+ return false;
610413
+ }
610414
+ this.seen.add(requestId);
610415
+ if (this.seen.size > this.maxSize) {
610416
+ const oldest = this.seen.values().next().value;
610417
+ if (oldest !== void 0) {
610418
+ this.seen.delete(oldest);
610419
+ }
610420
+ }
610421
+ return true;
610422
+ }
610423
+ /**
610424
+ * Removes a previously-recorded id. Use when a command was recorded but never
610425
+ * actually started (e.g. it threw during setup), so a legitimate reconnect
610426
+ * re-send of the same command is not mistakenly swallowed as a duplicate.
610427
+ */
610428
+ forget(requestId) {
610429
+ this.seen.delete(requestId);
610430
+ }
610431
+ };
610432
+
610003
610433
  // ../../../vite-plugin-file-sync/dist/ai-service/state-machine/handlers/agent-planning.js
610004
610434
  init_cjs_shims();
610005
610435
 
@@ -610763,7 +611193,7 @@ var transitionFrom = (clark) => {
610763
611193
  };
610764
611194
 
610765
611195
  // ../../../vite-plugin-file-sync/dist/ai-service/state-machine/handlers/agent-planning.js
610766
- var FETCH_INTEGRATIONS_RECONNECT_BUDGET_MS = 15e3;
611196
+ var FETCH_INTEGRATIONS_RECONNECT_BUDGET_MS = 5e3;
610767
611197
  var MAX_DEBUG_ATTEMPTS = 5;
610768
611198
  function getTerminalErrorMessage(error40) {
610769
611199
  const { type, provider, data: data3 } = error40;
@@ -610787,6 +611217,8 @@ function getTerminalErrorMessage(error40) {
610787
611217
  return "The AI model returned an error. Please retry your prompt below. If the problem persists, the model provider may be experiencing issues.";
610788
611218
  case "timeout":
610789
611219
  return "The request timed out. Please check your connection and try again.";
611220
+ case "stall":
611221
+ return "The AI model stopped responding mid-generation. Please retry your prompt below. If the problem persists, please open a support ticket.";
610790
611222
  case "overloaded":
610791
611223
  return "The model is currently busy. Please retry your prompt below.";
610792
611224
  case "network":
@@ -611134,12 +611566,21 @@ Address the errors and return the fixed code.`;
611134
611566
  try {
611135
611567
  await fetchWithReconnectRetry(clark.context.peer, () => params.integrationStore.fetchIntegrations(clark.context.peer, availableIntegrations ?? []), { reconnectBudgetMs: FETCH_INTEGRATIONS_RECONNECT_BUDGET_MS });
611136
611568
  } 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;
611569
+ const isTransient = error40 instanceof RpcTimeoutError || isTransportCloseError(error40);
611570
+ if (isTransient) {
611571
+ getLogger3().warn(`[agent-planning] Failed to fetch integrations \u2014 proceeding without full integration metadata`, {
611572
+ ...getErrorMeta2(error40),
611573
+ degradedMode: true,
611574
+ errorType: error40 instanceof Error ? error40.constructor.name : typeof error40
611575
+ });
611576
+ } else {
611577
+ getLogger3().error(`[agent-planning] Failed to fetch integrations`, getErrorMeta2(error40));
611578
+ void transitionTo({
611579
+ type: AGENT_CANCELED,
611580
+ advice: "Failed to fetch integrations from the browser. Please refresh the page and try again."
611581
+ });
611582
+ return;
611583
+ }
611143
611584
  }
611144
611585
  getLogger3().info("Agent planning storing llmConfig in context:", request.llmConfig || {});
611145
611586
  const disabledTools = request.llmConfig?.disabledTools;
@@ -616137,6 +616578,7 @@ var AiService = class extends import_shared48.TracedEventEmitter {
616137
616578
  llmClient;
616138
616579
  stablePeer = new StablePeer();
616139
616580
  toolRegistry = new ToolRegistry();
616581
+ requestDeduplicator = new RequestDeduplicator();
616140
616582
  entityPermissionStore = new SessionEntityPermissionStore();
616141
616583
  _onGenerationCompleteCallback;
616142
616584
  tokenManagerJwt;
@@ -616416,24 +616858,7 @@ var AiService = class extends import_shared48.TracedEventEmitter {
616416
616858
  planApproved: this.clark?.context?.planContext?.approved
616417
616859
  };
616418
616860
  },
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
- }
616861
+ remoteRestoreFallback: (id2) => this.remoteRestoreFallback(id2)
616437
616862
  });
616438
616863
  this.llmClient = new LLMClient({
616439
616864
  contextManagerV2: this.contextManagerV2,
@@ -616677,6 +617102,43 @@ var AiService = class extends import_shared48.TracedEventEmitter {
616677
617102
  };
616678
617103
  };
616679
617104
  }
617105
+ /**
617106
+ * Resolves the conversation context for a contextId that is not present
617107
+ * locally, by downloading it from Bucketeer. Wired into ContextManagerV2 as
617108
+ * its `remoteRestoreFallback`, so it runs on a cold/recycled pod where the
617109
+ * editor reconnects and no local context exists.
617110
+ *
617111
+ * The download is keyed by commitId. It prefers `syncService.lastCommitId`
617112
+ * (which `downloadDirectory()` seeds from the server's latest non-draft
617113
+ * commit — the exact key the post-generation context upload uses) and only
617114
+ * falls back to the most recent chat-history commitId when the sync service
617115
+ * has none. Resolving the wrong key here is the context-loss this guards
617116
+ * against, so the resolution is logged.
617117
+ */
617118
+ async remoteRestoreFallback(id2) {
617119
+ const jwt2 = this.getJwt();
617120
+ const lastCommitId = this._syncContextProvider?.getLastCommitId();
617121
+ const commitId = lastCommitId ?? await this.chatSessionStore.getLatestCommitId();
617122
+ const commitIdSource = lastCommitId ? "syncService.lastCommitId" : commitId ? "chatSessionStore.getLatestCommitId" : "unavailable";
617123
+ const branchName = this._syncContextProvider?.getBranchName();
617124
+ if (!jwt2 || !commitId || !branchName) {
617125
+ if (jwt2) {
617126
+ this.getLogger().warn(`[context-restore] remoteRestoreFallback found no restore key: commitId=${commitId ?? "<none>"} source=${commitIdSource} branch=${branchName ?? "<none>"}`);
617127
+ }
617128
+ return null;
617129
+ }
617130
+ this.getLogger().info(`[context-restore] remoteRestoreFallback resolved commitId=${commitId} source=${commitIdSource} branch=${branchName}`);
617131
+ return downloadContextFromBucketeer({
617132
+ applicationId: this.config.applicationId,
617133
+ commitId,
617134
+ branchName,
617135
+ superblocksBaseUrl: this.config.superblocksBaseUrl,
617136
+ logger: this.getLogger(),
617137
+ jwt: jwt2,
617138
+ contextId: id2,
617139
+ appRootDirPath: this.config.appRootDirPath
617140
+ });
617141
+ }
616680
617142
  getJwt() {
616681
617143
  if (this.tokenManagerJwt) {
616682
617144
  return this.tokenManagerJwt;
@@ -616908,53 +617370,68 @@ var AiService = class extends import_shared48.TracedEventEmitter {
616908
617370
  if (this.clark.state === ClarkStateNames.Dead) {
616909
617371
  throw new Error("Service is unavailable");
616910
617372
  }
617373
+ if (request.requestId && this.requestDeduplicator.has(request.requestId)) {
617374
+ this.getLogger().info("[ai-service] Ignoring duplicate aiGenerate re-send", { requestId: request.requestId });
617375
+ return;
617376
+ }
616911
617377
  if (this.isBusy()) {
616912
617378
  this.getLogger().warn("[ai-service] Service is busy. State:", this.clark.state);
616913
617379
  throw new Error("Service is busy");
616914
617380
  }
616915
617381
  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,
617382
+ if (request.requestId && !this.requestDeduplicator.markIfNew(request.requestId)) {
617383
+ this.getLogger().warn("[ai-service] Ignoring duplicate aiGenerate re-send (lost dedup race)", { requestId: request.requestId });
617384
+ return;
617385
+ }
617386
+ try {
617387
+ this.clarkProfiler.startSession();
617388
+ getLogger3().info("AI Service received request with llmConfig:", request.llmConfig || {});
617389
+ getLogger3().info("[ai-service] handleAiGenerate received request", {
617390
+ requestMode: request.mode,
617391
+ currentContextMode: this.clark.context.currentMode,
617392
+ requestPlanContextApproved: request.planContext?.approved,
617393
+ existingPlanContextApproved: this.clark.context.planContext?.approved,
617394
+ responseMetadataType: request.responseMetadata?.type
617395
+ });
617396
+ const promptId = randomUUID3();
617397
+ getLogger3().info("[ai-service] Generated prompt_id for user interaction", {
616933
617398
  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
- });
617399
+ applicationId: this.config.applicationId
617400
+ });
617401
+ this.clark.updateContext((context2) => {
617402
+ return {
617403
+ ...context2,
617404
+ promptId,
617405
+ useMockGeneration: request.mockGeneration ?? false,
617406
+ planContext: mergePlanContexts(context2.planContext, request.planContext),
617407
+ browserContext: request.browserContext,
617408
+ // Initialize workflow metrics tracking
617409
+ workflowMetrics: {
617410
+ toolCallCount: 0,
617411
+ stepCount: 0,
617412
+ linesAdded: 0,
617413
+ linesEdited: 0,
617414
+ linesRemoved: 0,
617415
+ llmUsage: [],
617416
+ llmCallCount: 0,
617417
+ workflowStartedAt: (/* @__PURE__ */ new Date()).toISOString()
617418
+ },
617419
+ llmConfig: request.llmConfig,
617420
+ partialResponse: void 0,
617421
+ userPreferences: request.userPreferences
617422
+ };
617423
+ });
617424
+ const transitionTo = transitionFrom(this.clark);
617425
+ void transitionTo({
617426
+ type: USER_SENT_PROMPT,
617427
+ request
617428
+ });
617429
+ } catch (error40) {
617430
+ if (request.requestId) {
617431
+ this.requestDeduplicator.forget(request.requestId);
617432
+ }
617433
+ throw error40;
617434
+ }
616958
617435
  }
616959
617436
  async handleAiExplainCode(request) {
616960
617437
  if (this.clark.state === ClarkStateNames.Dead) {
@@ -617508,6 +617985,10 @@ ${normalizedTextAttachment.content}
617508
617985
  if (this.clark.state === ClarkStateNames.Dead) {
617509
617986
  throw new Error("Service is unavailable");
617510
617987
  }
617988
+ if (request.requestId && this.requestDeduplicator.has(request.requestId)) {
617989
+ this.getLogger().info("[ai-service] Ignoring duplicate aiGenerateWithQueue re-send", { requestId: request.requestId, mode });
617990
+ return { status: "started" };
617991
+ }
617511
617992
  if (!this.isBusy()) {
617512
617993
  await this.handleAiGenerate(request);
617513
617994
  return { status: "started" };
@@ -617635,6 +618116,12 @@ ${request.prompt}`;
617635
618116
  async handleAiRespondToToolPermission(request) {
617636
618117
  const logger21 = this.getLogger();
617637
618118
  logger21.info(`[ai-service] handleAiRespondToToolPermission: messageId=${request.messageId}, approved=${request.approved}`);
618119
+ if (request.requestId && this.requestDeduplicator.has(request.requestId)) {
618120
+ logger21.info("[ai-service] Ignoring duplicate tool-permission re-send", {
618121
+ requestId: request.requestId
618122
+ });
618123
+ return;
618124
+ }
617638
618125
  const pendingRequest = this.clark.context.pendingToolPermissionRequest;
617639
618126
  logger21.info(`[ai-service] Pending request: ${JSON.stringify(pendingRequest)}`);
617640
618127
  if (!pendingRequest) {
@@ -617645,6 +618132,10 @@ ${request.prompt}`;
617645
618132
  logger21.warn(`[ai-service] Message ID mismatch: expected=${pendingRequest.messageId}, got=${request.messageId}`);
617646
618133
  throw new Error("Message ID mismatch");
617647
618134
  }
618135
+ if (request.requestId && !this.requestDeduplicator.markIfNew(request.requestId)) {
618136
+ logger21.warn("[ai-service] Ignoring duplicate tool-permission re-send (lost dedup race)", { requestId: request.requestId });
618137
+ return;
618138
+ }
617648
618139
  logger21.info(`[ai-service] Clearing pending request`);
617649
618140
  clearPendingToolPermissionRequest(this.clark, "tool-permission-response");
617650
618141
  const toolCallId = pendingRequest.messageId;
@@ -618779,20 +619270,21 @@ async function getApplicationDirectoryHash(rpcClient, applicationId, branch, loc
618779
619270
  getDraftOrLiveDirectoryHash(rpcClient, applicationId, branch),
618780
619271
  hashLocalDirectory(localDirectoryPath)
618781
619272
  ]);
618782
- const directoryHash = draftOrLiveEditHash;
619273
+ const directoryHash = draftOrLiveEditHash.hash;
618783
619274
  if (!directoryHash) {
618784
619275
  throw new Error("No live edit hash found");
618785
619276
  }
618786
619277
  return {
618787
619278
  serverDirectoryHash: directoryHash,
619279
+ latestNonDraftCommitId: draftOrLiveEditHash.latestNonDraftCommitId,
618788
619280
  localDirectoryStatePreDownload
618789
619281
  };
618790
619282
  }
618791
619283
  async function downloadApplicationDirectory({ rpcClient, applicationId, branch, localDirectoryPath, hashCache }) {
618792
- const { serverDirectoryHash, localDirectoryStatePreDownload } = await getApplicationDirectoryHash(rpcClient, applicationId, branch, localDirectoryPath);
619284
+ const { serverDirectoryHash, latestNonDraftCommitId, localDirectoryStatePreDownload } = await getApplicationDirectoryHash(rpcClient, applicationId, branch, localDirectoryPath);
618793
619285
  const directoryState = await doDownloadApplicationDirectory(rpcClient, serverDirectoryHash, localDirectoryStatePreDownload, localDirectoryPath);
618794
619286
  hashCache.add_directory_recursive(directoryState);
618795
- return serverDirectoryHash;
619287
+ return { directoryHash: serverDirectoryHash, latestNonDraftCommitId };
618796
619288
  }
618797
619289
  async function doDownloadApplicationDirectory(rpcClient, directoryHash, oldLocalDirState, localDirectoryPath) {
618798
619290
  const hashesToGet = {};
@@ -618886,7 +619378,10 @@ async function getDraftOrLiveDirectoryHash(rpcClient, applicationId, branch) {
618886
619378
  branchName: branch,
618887
619379
  viewMode: import_shared51.ExportViewMode.EXPORT_DRAFT
618888
619380
  }));
618889
- return response.hash;
619381
+ return {
619382
+ hash: response.hash,
619383
+ latestNonDraftCommitId: response.latestNonDraftCommitId
619384
+ };
618890
619385
  } catch (e) {
618891
619386
  if (e instanceof import_shared50.NotFoundError) {
618892
619387
  const response = await (0, import_shared50.unwrapResponseDto)(rpcClient.call.v3.application.directoryContents.get({
@@ -618895,7 +619390,10 @@ async function getDraftOrLiveDirectoryHash(rpcClient, applicationId, branch) {
618895
619390
  viewMode: import_shared51.ExportViewMode.EXPORT_LIVE
618896
619391
  }));
618897
619392
  getLogger3().warn(`Draft state not found, using live edit hash: ${response.hash}`);
618898
- return response.hash;
619393
+ return {
619394
+ hash: response.hash,
619395
+ latestNonDraftCommitId: response.latestNonDraftCommitId
619396
+ };
618899
619397
  }
618900
619398
  throw e;
618901
619399
  }
@@ -619461,6 +619959,9 @@ function isDevOrLocal() {
619461
619959
  const env2 = process.env.SUPERBLOCKS_SERVER_ENV ?? process.env.SUPERBLOCKS_ENVIRONMENT;
619462
619960
  return env2 === "dev" || env2 === "local";
619463
619961
  }
619962
+ function shouldSeedLastCommitId(currentLastCommitId, incomingCommitId) {
619963
+ return Boolean(incomingCommitId) && !currentLastCommitId;
619964
+ }
619464
619965
  function getSyncErrorLogLevel(error40) {
619465
619966
  const msg = error40?.message ?? "";
619466
619967
  if (msg.includes("RPC client is shutting down") || msg.includes("Connection closed")) {
@@ -619554,6 +620055,7 @@ var SyncService = class extends import_shared54.TracedEventEmitter {
619554
620055
  this.pendingSyncUp = void 0;
619555
620056
  this.lastSyncedDirectoryHash = void 0;
619556
620057
  this.lastSyncedGenerationNumber = void 0;
620058
+ this.lastCommitId = void 0;
619557
620059
  this.synchronizationStatus = SyncronizationStatus.SERVER_AHEAD;
619558
620060
  this.getLogger().info(`[sync-service] switched branch context from '${previousBranchName}' to '${nextBranchName}'`);
619559
620061
  }
@@ -619599,7 +620101,7 @@ var SyncService = class extends import_shared54.TracedEventEmitter {
619599
620101
  return this.fsOperation(async () => {
619600
620102
  this.status = SyncServiceStatus.DOWNLOADING;
619601
620103
  try {
619602
- const directoryHash = await this._rpcClient.call(async (rpcClient) => {
620104
+ const { directoryHash, latestNonDraftCommitId } = await this._rpcClient.call(async (rpcClient) => {
619603
620105
  return await downloadApplicationDirectory({
619604
620106
  rpcClient,
619605
620107
  applicationId: this.applicationId,
@@ -619609,6 +620111,19 @@ var SyncService = class extends import_shared54.TracedEventEmitter {
619609
620111
  });
619610
620112
  });
619611
620113
  this.lastSyncedDirectoryHash = directoryHash;
620114
+ if (shouldSeedLastCommitId(this.lastCommitId, latestNonDraftCommitId)) {
620115
+ this.lastCommitId = latestNonDraftCommitId;
620116
+ this.emit("commitIdChanged", latestNonDraftCommitId);
620117
+ this.getLogger().info(`[sync-service] seeded lastCommitId=${latestNonDraftCommitId} appId=${this.applicationId} branch=${this._branchName ?? "<none>"} from server on cold-pod download`);
620118
+ } else if (latestNonDraftCommitId && this.lastCommitId) {
620119
+ if (this.lastCommitId !== latestNonDraftCommitId) {
620120
+ this.getLogger().info(`[sync-service] warm reconnect: kept lastCommitId=${this.lastCommitId}, server returned ${latestNonDraftCommitId} (values differ, not overwriting) appId=${this.applicationId}`);
620121
+ } else {
620122
+ this.getLogger().debug(`[sync-service] warm reconnect: kept lastCommitId=${this.lastCommitId}, server returned matching value appId=${this.applicationId}`);
620123
+ }
620124
+ } else if (!latestNonDraftCommitId && !this.lastCommitId) {
620125
+ 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>"}`);
620126
+ }
619612
620127
  this.synchronizationStatus = SyncronizationStatus.IN_SYNC;
619613
620128
  this.getLogger().info("[sync-service] Synchronization finished");
619614
620129
  } catch (err) {
@@ -644679,7 +645194,7 @@ var parseYaml3;
644679
645194
  async function loadYaml(file2) {
644680
645195
  const content17 = await read_file_default(file2);
644681
645196
  if (!parseYaml3) {
644682
- ({ __parsePrettierYamlConfig: parseYaml3 } = await import("./yaml-JLRXP2CH.js"));
645197
+ ({ __parsePrettierYamlConfig: parseYaml3 } = await import("./yaml-LLMR27RB.js"));
644683
645198
  }
644684
645199
  try {
644685
645200
  return parseYaml3(content17);
@@ -650073,7 +650588,7 @@ function createParsersAndPrinters(modules) {
650073
650588
  }
650074
650589
  var estreePlugin = createParsersAndPrinters([
650075
650590
  {
650076
- importPlugin: () => import("./estree-TCD2UGUS.js"),
650591
+ importPlugin: () => import("./estree-5TTMFJGQ.js"),
650077
650592
  printers: ["estree", "estree-json"]
650078
650593
  }
650079
650594
  ]);
@@ -650097,11 +650612,11 @@ var languages = [
650097
650612
  ];
650098
650613
  var { parsers: parsers12, printers } = createParsersAndPrinters([
650099
650614
  {
650100
- importPlugin: () => import("./acorn-ZN7Q6UDZ.js"),
650615
+ importPlugin: () => import("./acorn-W2BZCDXM.js"),
650101
650616
  parsers: ["acorn", "espree"]
650102
650617
  },
650103
650618
  {
650104
- importPlugin: () => import("./angular-J2MXKXGC.js"),
650619
+ importPlugin: () => import("./angular-7EERNNRR.js"),
650105
650620
  parsers: [
650106
650621
  "__ng_action",
650107
650622
  "__ng_binding",
@@ -650110,7 +650625,7 @@ var { parsers: parsers12, printers } = createParsersAndPrinters([
650110
650625
  ]
650111
650626
  },
650112
650627
  {
650113
- importPlugin: () => import("./babel-O4PIWZ7M.js"),
650628
+ importPlugin: () => import("./babel-3PANACS5.js"),
650114
650629
  parsers: [
650115
650630
  "babel",
650116
650631
  "babel-flow",
@@ -650129,44 +650644,44 @@ var { parsers: parsers12, printers } = createParsersAndPrinters([
650129
650644
  ]
650130
650645
  },
650131
650646
  {
650132
- importPlugin: () => import("./flow-DTJ5KXYK.js"),
650647
+ importPlugin: () => import("./flow-UVCFOA7H.js"),
650133
650648
  parsers: ["flow"]
650134
650649
  },
650135
650650
  {
650136
- importPlugin: () => import("./glimmer-AER7O7UD.js"),
650651
+ importPlugin: () => import("./glimmer-SQJMGKN3.js"),
650137
650652
  parsers: ["glimmer"],
650138
650653
  printers: ["glimmer"]
650139
650654
  },
650140
650655
  {
650141
- importPlugin: () => import("./graphql-ZCGKT3ML.js"),
650656
+ importPlugin: () => import("./graphql-O47VXQ4V.js"),
650142
650657
  parsers: ["graphql"],
650143
650658
  printers: ["graphql"]
650144
650659
  },
650145
650660
  {
650146
- importPlugin: () => import("./html-V3FHSD2D.js"),
650661
+ importPlugin: () => import("./html-3GW33SAW.js"),
650147
650662
  parsers: ["html", "angular", "vue", "lwc", "mjml"],
650148
650663
  printers: ["html"]
650149
650664
  },
650150
650665
  {
650151
- importPlugin: () => import("./markdown-F4OH2TLC.js"),
650666
+ importPlugin: () => import("./markdown-IP5WYL5S.js"),
650152
650667
  parsers: ["markdown", "mdx", "remark"],
650153
650668
  printers: ["mdast"]
650154
650669
  },
650155
650670
  {
650156
- importPlugin: () => import("./meriyah-7WDK4UW6.js"),
650671
+ importPlugin: () => import("./meriyah-HXGEZIIC.js"),
650157
650672
  parsers: ["meriyah"]
650158
650673
  },
650159
650674
  {
650160
- importPlugin: () => import("./postcss-DWK3YRY3.js"),
650675
+ importPlugin: () => import("./postcss-LNFONHX3.js"),
650161
650676
  parsers: ["css", "less", "scss"],
650162
650677
  printers: ["postcss"]
650163
650678
  },
650164
650679
  {
650165
- importPlugin: () => import("./typescript-VF6VJIWL.js"),
650680
+ importPlugin: () => import("./typescript-TDVWFWCZ.js"),
650166
650681
  parsers: ["typescript"]
650167
650682
  },
650168
650683
  {
650169
- importPlugin: () => import("./yaml-JLRXP2CH.js"),
650684
+ importPlugin: () => import("./yaml-LLMR27RB.js"),
650170
650685
  parsers: ["yaml"],
650171
650686
  printers: ["yaml"]
650172
650687
  }
@@ -667310,7 +667825,7 @@ async function handleLockConflict(error40, lockSvc, span, logger21) {
667310
667825
  }
667311
667826
  async function readPkgJson(cwd) {
667312
667827
  try {
667313
- const { readPackage } = await import("./read-pkg-DM7BQWMA.js");
667828
+ const { readPackage } = await import("./read-pkg-APXZ3M37.js");
667314
667829
  return await readPackage({ cwd });
667315
667830
  } catch {
667316
667831
  return null;
@@ -669004,4 +669519,4 @@ serve-static/index.js:
669004
669519
  chokidar/esm/index.js:
669005
669520
  (*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) *)
669006
669521
  */
669007
- //# sourceMappingURL=chunk-3VETL57J.js.map
669522
+ //# sourceMappingURL=chunk-NWUPLR4A.js.map