@superblocksteam/cli 2.0.0-next.70 → 2.0.0-next.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6933,8 +6933,8 @@ var require_pattern = __commonJS({
6933
6933
  }
6934
6934
  exports2.endsWithSlashGlobStar = endsWithSlashGlobStar;
6935
6935
  function isAffectDepthOfReadingPattern(pattern) {
6936
- const basename7 = path51.basename(pattern);
6937
- return endsWithSlashGlobStar(pattern) || isStaticPattern(basename7);
6936
+ const basename8 = path51.basename(pattern);
6937
+ return endsWithSlashGlobStar(pattern) || isStaticPattern(basename8);
6938
6938
  }
6939
6939
  exports2.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
6940
6940
  function expandPatternsWithBraceExpansion(patterns) {
@@ -18190,15 +18190,15 @@ var require_file = __commonJS({
18190
18190
  _incFile(callback) {
18191
18191
  debug5("_incFile", this.filename);
18192
18192
  const ext2 = path51.extname(this._basename);
18193
- const basename7 = path51.basename(this._basename, ext2);
18193
+ const basename8 = path51.basename(this._basename, ext2);
18194
18194
  const tasks = [];
18195
18195
  if (this.zippedArchive) {
18196
18196
  tasks.push(
18197
18197
  function(cb) {
18198
18198
  const num = this._created > 0 && !this.tailable ? this._created : "";
18199
18199
  this._compressFile(
18200
- path51.join(this.dirname, `${basename7}${num}${ext2}`),
18201
- path51.join(this.dirname, `${basename7}${num}${ext2}.gz`),
18200
+ path51.join(this.dirname, `${basename8}${num}${ext2}`),
18201
+ path51.join(this.dirname, `${basename8}${num}${ext2}.gz`),
18202
18202
  cb
18203
18203
  );
18204
18204
  }.bind(this)
@@ -18208,9 +18208,9 @@ var require_file = __commonJS({
18208
18208
  function(cb) {
18209
18209
  if (!this.tailable) {
18210
18210
  this._created += 1;
18211
- this._checkMaxFilesIncrementing(ext2, basename7, cb);
18211
+ this._checkMaxFilesIncrementing(ext2, basename8, cb);
18212
18212
  } else {
18213
- this._checkMaxFilesTailable(ext2, basename7, cb);
18213
+ this._checkMaxFilesTailable(ext2, basename8, cb);
18214
18214
  }
18215
18215
  }.bind(this)
18216
18216
  );
@@ -18224,9 +18224,9 @@ var require_file = __commonJS({
18224
18224
  */
18225
18225
  _getFile() {
18226
18226
  const ext2 = path51.extname(this._basename);
18227
- const basename7 = path51.basename(this._basename, ext2);
18227
+ const basename8 = path51.basename(this._basename, ext2);
18228
18228
  const isRotation = this.rotationFormat ? this.rotationFormat() : this._created;
18229
- return !this.tailable && this._created ? `${basename7}${isRotation}${ext2}` : `${basename7}${ext2}`;
18229
+ return !this.tailable && this._created ? `${basename8}${isRotation}${ext2}` : `${basename8}${ext2}`;
18230
18230
  }
18231
18231
  /**
18232
18232
  * Increment the number of files created or checked by this instance.
@@ -18236,14 +18236,14 @@ var require_file = __commonJS({
18236
18236
  * @returns {undefined}
18237
18237
  * @private
18238
18238
  */
18239
- _checkMaxFilesIncrementing(ext2, basename7, callback) {
18239
+ _checkMaxFilesIncrementing(ext2, basename8, callback) {
18240
18240
  if (!this.maxFiles || this._created < this.maxFiles) {
18241
18241
  return setImmediate(callback);
18242
18242
  }
18243
18243
  const oldest = this._created - this.maxFiles;
18244
18244
  const isOldest = oldest !== 0 ? oldest : "";
18245
18245
  const isZipped = this.zippedArchive ? ".gz" : "";
18246
- const filePath = `${basename7}${isOldest}${ext2}${isZipped}`;
18246
+ const filePath = `${basename8}${isOldest}${ext2}${isZipped}`;
18247
18247
  const target = path51.join(this.dirname, filePath);
18248
18248
  fs30.unlink(target, callback);
18249
18249
  }
@@ -18258,7 +18258,7 @@ var require_file = __commonJS({
18258
18258
  * @returns {undefined}
18259
18259
  * @private
18260
18260
  */
18261
- _checkMaxFilesTailable(ext2, basename7, callback) {
18261
+ _checkMaxFilesTailable(ext2, basename8, callback) {
18262
18262
  const tasks = [];
18263
18263
  if (!this.maxFiles) {
18264
18264
  return;
@@ -18266,21 +18266,21 @@ var require_file = __commonJS({
18266
18266
  const isZipped = this.zippedArchive ? ".gz" : "";
18267
18267
  for (let x = this.maxFiles - 1; x > 1; x--) {
18268
18268
  tasks.push(function(i2, cb) {
18269
- let fileName = `${basename7}${i2 - 1}${ext2}${isZipped}`;
18269
+ let fileName = `${basename8}${i2 - 1}${ext2}${isZipped}`;
18270
18270
  const tmppath = path51.join(this.dirname, fileName);
18271
18271
  fs30.exists(tmppath, (exists2) => {
18272
18272
  if (!exists2) {
18273
18273
  return cb(null);
18274
18274
  }
18275
- fileName = `${basename7}${i2}${ext2}${isZipped}`;
18275
+ fileName = `${basename8}${i2}${ext2}${isZipped}`;
18276
18276
  fs30.rename(tmppath, path51.join(this.dirname, fileName), cb);
18277
18277
  });
18278
18278
  }.bind(this, x));
18279
18279
  }
18280
18280
  asyncSeries(tasks, () => {
18281
18281
  fs30.rename(
18282
- path51.join(this.dirname, `${basename7}${ext2}${isZipped}`),
18283
- path51.join(this.dirname, `${basename7}1${ext2}${isZipped}`),
18282
+ path51.join(this.dirname, `${basename8}${ext2}${isZipped}`),
18283
+ path51.join(this.dirname, `${basename8}1${ext2}${isZipped}`),
18284
18284
  callback
18285
18285
  );
18286
18286
  });
@@ -249830,7 +249830,7 @@ var require_view = __commonJS({
249830
249830
  var path51 = __require("path");
249831
249831
  var fs30 = __require("fs");
249832
249832
  var dirname9 = path51.dirname;
249833
- var basename7 = path51.basename;
249833
+ var basename8 = path51.basename;
249834
249834
  var extname3 = path51.extname;
249835
249835
  var join10 = path51.join;
249836
249836
  var resolve8 = path51.resolve;
@@ -249869,7 +249869,7 @@ var require_view = __commonJS({
249869
249869
  var root2 = roots[i2];
249870
249870
  var loc = resolve8(root2, name18);
249871
249871
  var dir = dirname9(loc);
249872
- var file = basename7(loc);
249872
+ var file = basename8(loc);
249873
249873
  path53 = this.resolve(dir, file);
249874
249874
  }
249875
249875
  return path53;
@@ -249885,7 +249885,7 @@ var require_view = __commonJS({
249885
249885
  if (stat4 && stat4.isFile()) {
249886
249886
  return path53;
249887
249887
  }
249888
- path53 = join10(dir, basename7(file, ext2), "index" + ext2);
249888
+ path53 = join10(dir, basename8(file, ext2), "index" + ext2);
249889
249889
  stat4 = tryStat(path53);
249890
249890
  if (stat4 && stat4.isFile()) {
249891
249891
  return path53;
@@ -249909,7 +249909,7 @@ var require_content_disposition = __commonJS({
249909
249909
  init_cjs_shims();
249910
249910
  module2.exports = contentDisposition;
249911
249911
  module2.exports.parse = parse17;
249912
- var basename7 = __require("path").basename;
249912
+ var basename8 = __require("path").basename;
249913
249913
  var Buffer2 = require_safe_buffer().Buffer;
249914
249914
  var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g;
249915
249915
  var HEX_ESCAPE_REGEXP = /%[0-9A-Fa-f]{2}/;
@@ -249945,9 +249945,9 @@ var require_content_disposition = __commonJS({
249945
249945
  if (typeof fallback === "string" && NON_LATIN1_REGEXP.test(fallback)) {
249946
249946
  throw new TypeError("fallback must be ISO-8859-1 string");
249947
249947
  }
249948
- var name18 = basename7(filename);
249948
+ var name18 = basename8(filename);
249949
249949
  var isQuotedString = TEXT_REGEXP.test(name18);
249950
- var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name18) : basename7(fallback);
249950
+ var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name18) : basename8(fallback);
249951
249951
  var hasFallback = typeof fallbackName === "string" && fallbackName !== name18;
249952
249952
  if (hasFallback || !isQuotedString || HEX_ESCAPE_REGEXP.test(name18)) {
249953
249953
  params["filename*"] = name18;
@@ -254980,10 +254980,10 @@ var ReaddirpStream = class extends Readable {
254980
254980
  }
254981
254981
  async _formatEntry(dirent, path51) {
254982
254982
  let entry;
254983
- const basename7 = this._isDirent ? dirent.name : dirent;
254983
+ const basename8 = this._isDirent ? dirent.name : dirent;
254984
254984
  try {
254985
- const fullPath = presolve(pjoin(path51, basename7));
254986
- entry = { path: prelative(this._root, fullPath), fullPath, basename: basename7 };
254985
+ const fullPath = presolve(pjoin(path51, basename8));
254986
+ entry = { path: prelative(this._root, fullPath), fullPath, basename: basename8 };
254987
254987
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
254988
254988
  } catch (err) {
254989
254989
  this._onError(err);
@@ -255523,9 +255523,9 @@ var NodeFsHandler = class {
255523
255523
  _watchWithNodeFs(path51, listener) {
255524
255524
  const opts = this.fsw.options;
255525
255525
  const directory = sysPath.dirname(path51);
255526
- const basename7 = sysPath.basename(path51);
255526
+ const basename8 = sysPath.basename(path51);
255527
255527
  const parent = this.fsw._getWatchedDir(directory);
255528
- parent.add(basename7);
255528
+ parent.add(basename8);
255529
255529
  const absolutePath = sysPath.resolve(path51);
255530
255530
  const options8 = {
255531
255531
  persistent: opts.persistent
@@ -255535,7 +255535,7 @@ var NodeFsHandler = class {
255535
255535
  let closer;
255536
255536
  if (opts.usePolling) {
255537
255537
  const enableBin = opts.interval !== opts.binaryInterval;
255538
- options8.interval = enableBin && isBinaryPath(basename7) ? opts.binaryInterval : opts.interval;
255538
+ options8.interval = enableBin && isBinaryPath(basename8) ? opts.binaryInterval : opts.interval;
255539
255539
  closer = setFsWatchFileListener(path51, absolutePath, options8, {
255540
255540
  listener,
255541
255541
  rawEmitter: this.fsw._emitRaw
@@ -255558,10 +255558,10 @@ var NodeFsHandler = class {
255558
255558
  return;
255559
255559
  }
255560
255560
  const dirname9 = sysPath.dirname(file);
255561
- const basename7 = sysPath.basename(file);
255561
+ const basename8 = sysPath.basename(file);
255562
255562
  const parent = this.fsw._getWatchedDir(dirname9);
255563
255563
  let prevStats = stats;
255564
- if (parent.has(basename7))
255564
+ if (parent.has(basename8))
255565
255565
  return;
255566
255566
  const listener = async (path51, newStats) => {
255567
255567
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
@@ -255586,9 +255586,9 @@ var NodeFsHandler = class {
255586
255586
  prevStats = newStats2;
255587
255587
  }
255588
255588
  } catch (error) {
255589
- this.fsw._remove(dirname9, basename7);
255589
+ this.fsw._remove(dirname9, basename8);
255590
255590
  }
255591
- } else if (parent.has(basename7)) {
255591
+ } else if (parent.has(basename8)) {
255592
255592
  const at3 = newStats.atimeMs;
255593
255593
  const mt = newStats.mtimeMs;
255594
255594
  if (!at3 || at3 <= mt || mt !== prevStats.mtimeMs) {
@@ -261179,8 +261179,8 @@ var require_pattern2 = __commonJS2({
261179
261179
  }
261180
261180
  exports2.endsWithSlashGlobStar = endsWithSlashGlobStar;
261181
261181
  function isAffectDepthOfReadingPattern(pattern) {
261182
- const basename7 = path132.basename(pattern);
261183
- return endsWithSlashGlobStar(pattern) || isStaticPattern(basename7);
261182
+ const basename8 = path132.basename(pattern);
261183
+ return endsWithSlashGlobStar(pattern) || isStaticPattern(basename8);
261184
261184
  }
261185
261185
  exports2.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
261186
261186
  function expandPatternsWithBraceExpansion(patterns) {
@@ -274893,11 +274893,11 @@ function getLanguageByFileName(languages2, file) {
274893
274893
  if (!file) {
274894
274894
  return;
274895
274895
  }
274896
- const basename7 = getFileBasename(file).toLowerCase();
274896
+ const basename8 = getFileBasename(file).toLowerCase();
274897
274897
  return languages2.find(
274898
- ({ filenames }) => filenames == null ? void 0 : filenames.some((name18) => name18.toLowerCase() === basename7)
274898
+ ({ filenames }) => filenames == null ? void 0 : filenames.some((name18) => name18.toLowerCase() === basename8)
274899
274899
  ) ?? languages2.find(
274900
- ({ extensions }) => extensions == null ? void 0 : extensions.some((extension) => basename7.endsWith(extension))
274900
+ ({ extensions }) => extensions == null ? void 0 : extensions.some((extension) => basename8.endsWith(extension))
274901
274901
  );
274902
274902
  }
274903
274903
  function getLanguageByLanguageName(languages2, languageName) {
@@ -286389,7 +286389,7 @@ function createAnthropic(options8 = {}) {
286389
286389
  var anthropic = createAnthropic();
286390
286390
 
286391
286391
  // ../../../vite-plugin-file-sync/dist/ai-service/index.js
286392
- var import_shared10 = __toESM(require_dist2(), 1);
286392
+ var import_shared11 = __toESM(require_dist2(), 1);
286393
286393
 
286394
286394
  // ../../../vite-plugin-file-sync/dist/ai-service/app-interface/shell.js
286395
286395
  init_cjs_shims();
@@ -292880,6 +292880,49 @@ var AppShell = class {
292880
292880
  }
292881
292881
  };
292882
292882
 
292883
+ // ../../../vite-plugin-file-sync/dist/ai-service/app-interface/source-tracker.js
292884
+ init_cjs_shims();
292885
+ var SourceTrackerInterface = class {
292886
+ sourceTracker;
292887
+ setSourceTracker(sourceTracker) {
292888
+ this.sourceTracker = sourceTracker;
292889
+ }
292890
+ getCurrentFiles() {
292891
+ if (!this.sourceTracker) {
292892
+ throw new Error("Source tracker not initialized");
292893
+ }
292894
+ return this.sourceTracker.getCurrentFiles();
292895
+ }
292896
+ getElementToFilePathMap() {
292897
+ return this.sourceTracker?.getElementToFilePath();
292898
+ }
292899
+ getElementToFilePath(el) {
292900
+ if (!this.sourceTracker) {
292901
+ throw new Error("Source tracker not initialized");
292902
+ }
292903
+ if (el === void 0)
292904
+ return this.sourceTracker.getElementToFilePath();
292905
+ return this.sourceTracker.getElementToFilePath(el);
292906
+ }
292907
+ getElementToLocationMap() {
292908
+ return this.sourceTracker?.getElementToLocation();
292909
+ }
292910
+ getElementToLocation(el) {
292911
+ if (!this.sourceTracker) {
292912
+ throw new Error("Source tracker not initialized");
292913
+ }
292914
+ if (el === void 0)
292915
+ return this.sourceTracker.getElementToLocation();
292916
+ return this.sourceTracker.getElementToLocation(el);
292917
+ }
292918
+ getScopeDefinitionForPage(pageName) {
292919
+ if (!this.sourceTracker) {
292920
+ throw new Error("Source tracker not initialized");
292921
+ }
292922
+ return this.sourceTracker.getScopeDefinitionForPage(pageName);
292923
+ }
292924
+ };
292925
+
292883
292926
  // ../../../vite-plugin-file-sync/dist/ai-service/artifacts/bolt.js
292884
292927
  init_cjs_shims();
292885
292928
  var BoltArtifactProcessor = class {
@@ -292910,7 +292953,7 @@ ${boltActions.join("\n")}
292910
292953
  return content2 ? {
292911
292954
  type: "file",
292912
292955
  filePath,
292913
- content: content2
292956
+ content: content2.trim()
292914
292957
  } : null;
292915
292958
  }).filter((file) => file !== null);
292916
292959
  }
@@ -293152,7 +293195,7 @@ var FSM = class {
293152
293195
  event
293153
293196
  });
293154
293197
  } catch (error) {
293155
- logger3.error(`[ai-service] Transition handler threw an error for ${toState}:`, getErrorMeta(error));
293198
+ logger3.error(`[ai-service] Transition handler threw an error for ${toState} on event ${event.type}:`, getErrorMeta(error));
293156
293199
  throw error;
293157
293200
  }
293158
293201
  }
@@ -293166,9 +293209,15 @@ init_cjs_shims();
293166
293209
  var Paths;
293167
293210
  (function(Paths2) {
293168
293211
  Paths2["GeneratedApis"] = "pages/:pageName/apis/:apiName";
293169
- Paths2["PageIndexes"] = "pages/:pageName/index.tsx";
293170
293212
  Paths2["ApiYamls"] = "pages/:pageName/apis/:apiName/api.yaml";
293171
- Paths2["AllScopes"] = "**/*.scope.ts";
293213
+ Paths2["PageIndexes"] = "pages/:pageName/index.tsx";
293214
+ Paths2["PageScopes"] = "pages/:pageName/scope.ts";
293215
+ Paths2["Components"] = "components/:componentName";
293216
+ Paths2["AppScope"] = "scope.ts";
293217
+ Paths2["AppTheme"] = "appTheme.ts";
293218
+ Paths2["AppRoutes"] = "routes.json";
293219
+ Paths2["AppRoot"] = "App.tsx";
293220
+ Paths2["PackageJson"] = "package.json";
293172
293221
  Paths2["AllFiles"] = "**/*";
293173
293222
  })(Paths || (Paths = {}));
293174
293223
  var LOG_SYSTEM_PROMPT = false;
@@ -293551,7 +293600,7 @@ init_cjs_shims();
293551
293600
  init_cjs_shims();
293552
293601
  var generated = {};
293553
293602
  try {
293554
- generated = await import("./generated-7KVX5RHQ.js");
293603
+ generated = await import("./generated-Q3KPLOVI.js");
293555
293604
  } catch (_error) {
293556
293605
  getLogger().warn("[ai-service] Generated markdown modules not found. Run `pnpm generate:markdown` first.");
293557
293606
  }
@@ -293683,6 +293732,10 @@ var superblocksParts = [
293683
293732
  {
293684
293733
  name: "superblocks_rbac",
293685
293734
  content: loadSubprompt("subprompts/superblocks_rbac")
293735
+ },
293736
+ {
293737
+ name: "superblocks_data_filtering",
293738
+ content: loadSubprompt("subprompts/superblocks_data_filtering")
293686
293739
  }
293687
293740
  ];
293688
293741
  var wrapWithTags = (name18, content2, tab2 = 2) => {
@@ -293788,6 +293841,28 @@ var matchPath = (pattern) => {
293788
293841
  return { matched: true, params };
293789
293842
  };
293790
293843
  };
293844
+ var matchMultiplePaths = (...patterns) => {
293845
+ const matchers = patterns.map((pattern) => {
293846
+ if (!matcherCache.has(pattern)) {
293847
+ matcherCache.set(pattern, compileMatcher(pattern));
293848
+ }
293849
+ return matcherCache.get(pattern);
293850
+ });
293851
+ return (path51) => {
293852
+ for (const { regex, paramNames } of matchers) {
293853
+ const match3 = regex.exec(path51);
293854
+ if (match3) {
293855
+ const values = match3.slice(1);
293856
+ const params = {};
293857
+ paramNames.forEach((name18, i2) => {
293858
+ params[name18] = values[i2] ?? "";
293859
+ });
293860
+ return { matched: true, params };
293861
+ }
293862
+ }
293863
+ return { matched: false };
293864
+ };
293865
+ };
293791
293866
  var compileMatcher = (pattern) => {
293792
293867
  const paramNames = [];
293793
293868
  const regexParts = pattern.split("/").map((segment) => {
@@ -293902,7 +293977,7 @@ var ApiBuilderTransformer = class extends FileTransformer {
293902
293977
  runEvaluation(cwd) {
293903
293978
  return new Promise((resolve8, reject) => {
293904
293979
  const logger3 = getLogger();
293905
- logger3.debug("[ai-service] Evaluating in", cwd);
293980
+ logger3.debug(`[ai-service] Evaluating in ${cwd}`);
293906
293981
  const tsc = spawn2("npx", ["tsc", "--noEmitOnError", "false"], { cwd });
293907
293982
  tsc.stdout.on("data", (data) => {
293908
293983
  logger3.info("[ai-service] tsc stdout", data.toString());
@@ -293990,6 +294065,176 @@ var YamlToApiBuilderTransformer = class extends ApiBuilderTransformer {
293990
294065
  }
293991
294066
  };
293992
294067
 
294068
+ // ../../../vite-plugin-file-sync/dist/ai-service/state-machine/helpers/change-info.js
294069
+ init_cjs_shims();
294070
+ import { basename as basename6 } from "node:path";
294071
+
294072
+ // ../../../vite-plugin-file-sync/dist/ai-service/state-machine/helpers/peer.js
294073
+ init_cjs_shims();
294074
+
294075
+ // ../../../vite-plugin-file-sync/dist/util/operation-queue.js
294076
+ init_cjs_shims();
294077
+ var OperationQueue = class {
294078
+ // Invariant: `lastOperation` is a promise that never rejects. This is needed to ensure that the queue
294079
+ // can always enqueue a new operation, even if the previous operation rejected.
294080
+ lastOperation = Promise.resolve();
294081
+ /**
294082
+ * Enqueue an operation to be executed one at a time.
294083
+ *
294084
+ * @param operation - The operation to execute.
294085
+ * @returns A promise that resolves to the result of the operation.
294086
+ */
294087
+ enqueue(operation) {
294088
+ const promise = this.lastOperation.then(operation);
294089
+ this.lastOperation = promise.then(() => {
294090
+ }, () => {
294091
+ });
294092
+ return promise;
294093
+ }
294094
+ };
294095
+
294096
+ // ../../../vite-plugin-file-sync/dist/ai-service/state-machine/helpers/peer.js
294097
+ var peerQueue = (clark) => {
294098
+ const queue = clark.context.peerChannelQueue ?? new OperationQueue();
294099
+ clark.updateContext({
294100
+ peerChannelQueue: queue
294101
+ });
294102
+ return (operation, delay4 = 0) => {
294103
+ if (delay4) {
294104
+ queue.enqueue(() => new Promise((resolve8) => {
294105
+ setTimeout(() => {
294106
+ operation().then(resolve8);
294107
+ }, delay4);
294108
+ }));
294109
+ } else {
294110
+ queue.enqueue(operation);
294111
+ }
294112
+ };
294113
+ };
294114
+ var sendUserMessageChannel = (clark) => {
294115
+ const queue = peerQueue(clark);
294116
+ return async (payload, delay4 = 0) => {
294117
+ return queue(async () => clark.context.peer?.call.aiPushMessage(payload), delay4);
294118
+ };
294119
+ };
294120
+ var sendUserCompletionChannel = (clark) => {
294121
+ const queue = peerQueue(clark);
294122
+ return async (payload, delay4 = 0) => {
294123
+ return queue(async () => clark.context.peer?.call.aiSetCompleted(payload), delay4);
294124
+ };
294125
+ };
294126
+ var sendChangeInfoChannel = (clark) => {
294127
+ const queue = peerQueue(clark);
294128
+ return async (payload, delay4 = 0) => {
294129
+ return queue(async () => clark.context.peer?.call.aiPushChangeInfo(payload), delay4);
294130
+ };
294131
+ };
294132
+
294133
+ // ../../../vite-plugin-file-sync/dist/ai-service/state-machine/helpers/change-info.js
294134
+ var DependencyInfoPath = "package.json/:packageName";
294135
+ var sendChangeInfoHelper = (clark) => {
294136
+ const apiPathMatcher = matchPath(Paths.GeneratedApis);
294137
+ const componentPathMatcher = matchPath(Paths.Components);
294138
+ const pagePathMatcher = matchPath(Paths.PageIndexes);
294139
+ const dependencyPathMatcher = matchPath(DependencyInfoPath);
294140
+ const sendChangeInfo = sendChangeInfoChannel(clark);
294141
+ const push2 = (info) => {
294142
+ clark.updateContext((context2) => ({
294143
+ ...context2,
294144
+ generatedChangeInfo: {
294145
+ ...context2.generatedChangeInfo,
294146
+ [info.filePath]: info
294147
+ }
294148
+ }));
294149
+ return sendChangeInfo(info);
294150
+ };
294151
+ if (!clark.context.generatedChangeInfo) {
294152
+ clark.updateContext({
294153
+ generatedChangeInfo: {}
294154
+ });
294155
+ }
294156
+ return ({ type: type2, filePath, action }) => {
294157
+ const { initialFilePaths } = clark.context;
294158
+ const existingChangeInfo = clark.context.generatedChangeInfo?.[filePath];
294159
+ switch (type2) {
294160
+ case "ready":
294161
+ case "validated":
294162
+ case "error": {
294163
+ if (!existingChangeInfo) {
294164
+ getLogger().warn(`[ai-service] can't update changeInfo for unknown file: ${filePath} (type: ${type2}, action: ${action})`);
294165
+ getLogger().info(`[ai-service] ${JSON.stringify({
294166
+ generatedChangeInfo: clark.context.generatedChangeInfo
294167
+ })}`);
294168
+ return;
294169
+ }
294170
+ return push2({
294171
+ ...existingChangeInfo,
294172
+ status: type2
294173
+ });
294174
+ }
294175
+ case "pending": {
294176
+ const { apis, components: components2 } = initialFilePaths ?? {};
294177
+ if (existingChangeInfo) {
294178
+ return push2({
294179
+ ...existingChangeInfo,
294180
+ status: "pending"
294181
+ });
294182
+ }
294183
+ const dependencyPath = dependencyPathMatcher(filePath);
294184
+ if (dependencyPath.matched) {
294185
+ const { packageName } = dependencyPath.params;
294186
+ return push2({
294187
+ type: "dependency",
294188
+ name: packageName,
294189
+ action: action ?? "create",
294190
+ status: "pending",
294191
+ filePath
294192
+ });
294193
+ }
294194
+ const componentPath = componentPathMatcher(filePath);
294195
+ if (componentPath.matched) {
294196
+ let { componentName } = componentPath.params;
294197
+ componentName = basename6(componentName, ".tsx");
294198
+ return push2({
294199
+ type: "component",
294200
+ name: componentName,
294201
+ action: components2?.includes(componentName) ? "edit" : "create",
294202
+ status: "pending",
294203
+ filePath
294204
+ });
294205
+ }
294206
+ const pagePath = pagePathMatcher(filePath);
294207
+ if (pagePath.matched) {
294208
+ const { pageName } = pagePath.params;
294209
+ return push2({
294210
+ type: "page",
294211
+ name: pageName,
294212
+ action: "edit",
294213
+ status: "pending",
294214
+ filePath
294215
+ });
294216
+ }
294217
+ const apiPath = apiPathMatcher(filePath);
294218
+ if (apiPath.matched) {
294219
+ let { apiName } = apiPath.params;
294220
+ apiName = basename6(apiName, ".ts");
294221
+ const yamlPath = renderPath(Paths.ApiYamls, {
294222
+ ...apiPath.params,
294223
+ apiName
294224
+ });
294225
+ return push2({
294226
+ type: "api",
294227
+ name: apiName,
294228
+ action: apis?.includes(yamlPath) ? "edit" : "create",
294229
+ status: "pending",
294230
+ filePath
294231
+ });
294232
+ }
294233
+ }
294234
+ }
294235
+ };
294236
+ };
294237
+
293993
294238
  // ../../../vite-plugin-file-sync/dist/ai-service/state-machine/helpers/metadata.js
293994
294239
  init_cjs_shims();
293995
294240
  var handlerMetadata = (clark) => {
@@ -294003,15 +294248,6 @@ var handlerMetadata = (clark) => {
294003
294248
  };
294004
294249
  };
294005
294250
 
294006
- // ../../../vite-plugin-file-sync/dist/ai-service/state-machine/helpers/peer.js
294007
- init_cjs_shims();
294008
- var sendUserMessageChannel = (clark) => (payload) => {
294009
- return void clark.context.peer?.call.aiPushMessage(payload);
294010
- };
294011
- var sendUserCompletionChannel = (clark) => async (payload) => {
294012
- return void clark.context.peer?.call.aiSetCompleted(payload);
294013
- };
294014
-
294015
294251
  // ../../../vite-plugin-file-sync/dist/ai-service/state-machine/helpers/transition.js
294016
294252
  init_cjs_shims();
294017
294253
  var transitionFrom = (clark) => {
@@ -294029,6 +294265,7 @@ var doAgentPlanning = (clark, params) => {
294029
294265
  const transitionTo = transitionFrom(clark);
294030
294266
  const sendUserMessage = sendUserMessageChannel(clark);
294031
294267
  const sendUserCompletion = sendUserCompletionChannel(clark);
294268
+ const sendChangeInfo = sendChangeInfoHelper(clark);
294032
294269
  const { getMeta, updateMeta } = handlerMetadata(clark);
294033
294270
  const debug5 = async (debuggingPromptIntro, filePaths = []) => {
294034
294271
  let { debugCount = 0 } = getMeta() ?? {};
@@ -294037,6 +294274,9 @@ var doAgentPlanning = (clark, params) => {
294037
294274
  }
294038
294275
  debugCount++;
294039
294276
  updateMeta({ debugCount });
294277
+ clark.updateContext({
294278
+ usedDebugging: true
294279
+ });
294040
294280
  if (debugCount > MAX_DEBUG_ATTEMPTS) {
294041
294281
  transitionTo({
294042
294282
  type: AGENT_NEEDS_USER_INPUT,
@@ -294045,6 +294285,9 @@ var doAgentPlanning = (clark, params) => {
294045
294285
  return;
294046
294286
  }
294047
294287
  sendUserMessage({
294288
+ type: "control",
294289
+ group: "debugging",
294290
+ status: "pending",
294048
294291
  text: debugCount === 1 ? "I found some problems in the app. Let me address them." : `Still trying to fix the errors\u2026 (attempt ${debugCount} of ${MAX_DEBUG_ATTEMPTS})`
294049
294292
  });
294050
294293
  const diff2 = await params.draftInterface.getDraftDiff(filePaths);
@@ -294056,7 +294299,7 @@ ${diff2}
294056
294299
  ---
294057
294300
 
294058
294301
  Address the errors and return the fixed code.`;
294059
- const systemPrompt = await createSystemPrompt(getMeta()?.request, params, filePaths);
294302
+ const { systemPrompt } = await createSystemPrompt(getMeta()?.request, params, filePaths);
294060
294303
  transitionTo({
294061
294304
  type: AGENT_PLANNED,
294062
294305
  systemPrompt,
@@ -294068,11 +294311,19 @@ Address the errors and return the fixed code.`;
294068
294311
  switch (event.type) {
294069
294312
  case USER_SENT_PROMPT: {
294070
294313
  const { request, peer } = event;
294314
+ const initialElementIds = clark.context.initialElementIds ?? Object.keys(params.sourceTrackerInterface.getElementToFilePathMap() ?? {});
294071
294315
  clark.updateContext((context2) => ({
294072
294316
  ...context2,
294073
294317
  abortController: context2.abortController ?? new AbortController(),
294074
- peer
294318
+ peer,
294319
+ initialElementIds
294075
294320
  }));
294321
+ void sendUserMessage({
294322
+ type: "control",
294323
+ group: "clark",
294324
+ status: "pending",
294325
+ text: "Thinking\u2026"
294326
+ });
294076
294327
  if (clark.context.hasSuggestions) {
294077
294328
  const meta2 = getMeta();
294078
294329
  const previousPrompts = meta2?.promptsForCurrentDraft ?? [];
@@ -294093,11 +294344,23 @@ ${newPrompt}`;
294093
294344
  updateMeta({
294094
294345
  promptsForCurrentDraft: [request.prompt]
294095
294346
  });
294347
+ if (request.promptContext?.fromEmptyState) {
294348
+ sendVerboseControlMessages(sendUserMessage);
294349
+ }
294350
+ }
294351
+ const { systemPrompt, filePaths } = await createSystemPrompt(request, params);
294352
+ if (!clark.context.initialFilePaths) {
294353
+ const apiPathMatcher = matchPath(Paths.ApiYamls);
294354
+ const componentPathMatcher = matchPath(Paths.Components);
294355
+ const apis = filePaths.filter((path51) => apiPathMatcher(path51).matched);
294356
+ const components2 = filePaths.filter((path51) => componentPathMatcher(path51).matched);
294357
+ clark.updateContext({
294358
+ initialFilePaths: {
294359
+ apis,
294360
+ components: components2
294361
+ }
294362
+ });
294096
294363
  }
294097
- const systemPrompt = await createSystemPrompt(request, params);
294098
- setTimeout(() => {
294099
- sendUserMessage({ text: "Planning my approach\u2026" });
294100
- }, 500);
294101
294364
  updateMeta({
294102
294365
  request,
294103
294366
  systemPrompt,
@@ -294182,6 +294445,12 @@ ${error.stack ?? error.message}
294182
294445
  case RUNTIME_REVIEW_ERRORED: {
294183
294446
  const { tsErrorsByPath } = event;
294184
294447
  const filePaths = Object.keys(tsErrorsByPath);
294448
+ for (const filePath of filePaths) {
294449
+ void sendChangeInfo({
294450
+ type: "error",
294451
+ filePath
294452
+ });
294453
+ }
294185
294454
  await debug5(`The following TypeScript errors were found in the project:
294186
294455
  ---
294187
294456
  ${Object.values(tsErrorsByPath).map((errors) => errors.join("\n")).join("\n")}
@@ -294251,7 +294520,28 @@ ${artifactContext.content}
294251
294520
  logger3.info(systemPrompt);
294252
294521
  logger3.info("[ai-service] " + "=".repeat(80));
294253
294522
  }
294254
- return systemPrompt;
294523
+ return { systemPrompt, filePaths: appFiles.map((file) => file.filePath) };
294524
+ };
294525
+ var sendVerboseControlMessages = (sendUserMessage) => {
294526
+ const messages2 = [
294527
+ [0, "Referencing your design system"],
294528
+ [500, "Identifying your available enterprise integrations"],
294529
+ [1300, "Referencing users and groups"]
294530
+ ];
294531
+ for (const [delay4, text2] of messages2) {
294532
+ void sendUserMessage({
294533
+ text: text2,
294534
+ type: "control",
294535
+ group: text2,
294536
+ status: "pending"
294537
+ }, delay4);
294538
+ void sendUserMessage({
294539
+ text: text2,
294540
+ type: "control",
294541
+ group: text2,
294542
+ status: "validated"
294543
+ }, delay4 + 200 + Math.random() * 1e3);
294544
+ }
294255
294545
  };
294256
294546
 
294257
294547
  // ../../../vite-plugin-file-sync/dist/ai-service/state-machine/handlers/awaiting-user.js
@@ -300406,7 +300696,6 @@ var BoltResultBuffer = class extends ResultBuffer {
300406
300696
  const [lhs, rhs] = text2.split("</boltArtifact>");
300407
300697
  this.buffer += lhs + "</boltArtifact>";
300408
300698
  this.currentType = BoltResultType.Artifact;
300409
- this.checkFileActions();
300410
300699
  this.maybeFlush(true);
300411
300700
  if (rhs) {
300412
300701
  this.add(rhs);
@@ -300433,9 +300722,13 @@ var BoltResultBuffer = class extends ResultBuffer {
300433
300722
  maybeFlush(force = false) {
300434
300723
  if (this.buffer && (force || this.shouldFlush())) {
300435
300724
  this.removeTrailingTags();
300725
+ if (this.processingFilePath) {
300726
+ this.params.onFlushFile(this.processingFilePath, this.buffer);
300727
+ }
300436
300728
  this.params.onFlush(this.currentType, this.buffer);
300437
300729
  this.buffer = "";
300438
300730
  this.currentType = BoltResultType.Text;
300731
+ this.processingFilePath = null;
300439
300732
  }
300440
300733
  }
300441
300734
  checkFileActions() {
@@ -300570,6 +300863,7 @@ var doLLMGenerating = (clark, { anthropicProvider, artifactProcessor, templateRe
300570
300863
  const transitionTo = transitionFrom(clark);
300571
300864
  const sendUserMessage = sendUserMessageChannel(clark);
300572
300865
  const sendUserCompletion = sendUserCompletionChannel(clark);
300866
+ const sendChangeInfo = sendChangeInfoHelper(clark);
300573
300867
  const logger3 = getLogger();
300574
300868
  const matchGeneratedApi = matchPath(Paths.GeneratedApis);
300575
300869
  return async ({ event }) => {
@@ -300592,20 +300886,27 @@ var doLLMGenerating = (clark, { anthropicProvider, artifactProcessor, templateRe
300592
300886
  onTypeChange: async (type2) => {
300593
300887
  switch (type2) {
300594
300888
  case BoltResultType.Artifact:
300595
- if (!debugging) {
300596
- void sendUserMessage({ text: "Starting to build\u2026" });
300597
- }
300598
300889
  pendingArtifacts = true;
300599
300890
  break;
300891
+ case BoltResultType.Text:
300892
+ void sendUserMessage({
300893
+ type: "control",
300894
+ group: "clark",
300895
+ status: "ready",
300896
+ text: "Generating\u2026"
300897
+ });
300898
+ break;
300600
300899
  }
300601
300900
  },
300602
300901
  onFlush: async (type2, text2) => {
300603
300902
  switch (type2) {
300604
300903
  case BoltResultType.Text:
300605
- if (artifactChunk) {
300606
- flushedAfterArtifacts.push([type2, text2]);
300607
- } else {
300608
- void sendUserMessage({ text: text2, type: "text" });
300904
+ if (!debugging) {
300905
+ if (artifactChunk) {
300906
+ flushedAfterArtifacts.push([type2, text2]);
300907
+ } else {
300908
+ void sendUserMessage({ text: text2, type: "text" });
300909
+ }
300609
300910
  }
300610
300911
  break;
300611
300912
  case BoltResultType.Think:
@@ -300616,14 +300917,24 @@ var doLLMGenerating = (clark, { anthropicProvider, artifactProcessor, templateRe
300616
300917
  }
300617
300918
  break;
300618
300919
  case BoltResultType.Artifact: {
300619
- artifactChunk = text2;
300920
+ if (!artifactChunk) {
300921
+ artifactChunk = text2;
300922
+ }
300620
300923
  break;
300621
300924
  }
300622
300925
  }
300623
300926
  },
300624
- onPendingFile: (_filePath) => {
300927
+ onPendingFile: async (filePath) => {
300928
+ void sendChangeInfo({
300929
+ type: "pending",
300930
+ filePath
300931
+ });
300625
300932
  },
300626
300933
  onFlushFile: async (filePath, buffer2) => {
300934
+ void sendChangeInfo({
300935
+ type: "ready",
300936
+ filePath
300937
+ });
300627
300938
  if (!matchGeneratedApi(filePath).matched) {
300628
300939
  return;
300629
300940
  }
@@ -300751,44 +301062,103 @@ var playDead = () => async ({ event }) => {
300751
301062
  init_cjs_shims();
300752
301063
  var doPostProcessing = (clark, { draftInterface, appShell }) => {
300753
301064
  const transitionTo = transitionFrom(clark);
301065
+ const sendChangeInfo = sendChangeInfoHelper(clark);
300754
301066
  const sendUserMessage = sendUserMessageChannel(clark);
300755
301067
  const createDraftFiles = (files) => {
301068
+ for (const file of files) {
301069
+ void sendChangeInfo({
301070
+ type: "ready",
301071
+ filePath: file.filePath
301072
+ });
301073
+ }
300756
301074
  return Promise.all(files.map((file) => draftInterface.createDraftFile(file.filePath, file.content)));
300757
301075
  };
301076
+ const handleDependencies = async (packageJson) => {
301077
+ void sendUserMessage({
301078
+ type: "control",
301079
+ group: "dependency-resolve",
301080
+ status: "pending",
301081
+ text: "Resolving dependencies\u2026"
301082
+ });
301083
+ const packageChanges = await parsePackageJsonChanges(draftInterface, packageJson.content);
301084
+ for (const change of packageChanges) {
301085
+ void sendChangeInfo({
301086
+ type: "pending",
301087
+ filePath: renderPath(DependencyInfoPath, {
301088
+ packageName: change.package
301089
+ }),
301090
+ action: change.type
301091
+ });
301092
+ }
301093
+ void sendUserMessage({
301094
+ type: "control",
301095
+ group: "dependency-resolve",
301096
+ status: "validated",
301097
+ text: "Resolved dependencies"
301098
+ });
301099
+ const previousReadyChanges = Object.values(clark.context.generatedChangeInfo ?? {}).filter((change) => change.status === "ready" && change.action !== "delete" && change.filePath.startsWith(DependencyInfoPath));
301100
+ for (const change of previousReadyChanges) {
301101
+ sendChangeInfo({
301102
+ type: "ready",
301103
+ filePath: change.filePath,
301104
+ action: "delete"
301105
+ });
301106
+ }
301107
+ void sendUserMessage({
301108
+ type: "control",
301109
+ group: "dependency-validate",
301110
+ status: "pending",
301111
+ text: "Verifying dependencies\u2026"
301112
+ });
301113
+ await appShell.runNpmInstall(clark.context.abortController?.signal);
301114
+ for (const change of packageChanges) {
301115
+ sendChangeInfo({
301116
+ type: "validated",
301117
+ filePath: renderPath(DependencyInfoPath, {
301118
+ packageName: change.package
301119
+ })
301120
+ });
301121
+ }
301122
+ void sendUserMessage({
301123
+ type: "control",
301124
+ group: "dependency-validate",
301125
+ status: "validated",
301126
+ text: "Dependencies verified"
301127
+ });
301128
+ };
300758
301129
  return async ({ event }) => {
300759
301130
  switch (event.type) {
300760
301131
  case LLM_FINISHED: {
300761
301132
  const { files } = event;
301133
+ const scopeAndApiPaths = matchMultiplePaths(
301134
+ // we have already drafted the generated apis into yaml at this point,
301135
+ // but the api builder files are still in the event's files list
301136
+ Paths.ApiYamls,
301137
+ Paths.GeneratedApis,
301138
+ // the llm created scope files, but we do not draft them because this
301139
+ // could interfere with file sync manager logic that:
301140
+ // 1) has already updated the page scope based on API changes in the previous stage
301141
+ // 2) will update scope when page changes are drafted
301142
+ Paths.PageScopes,
301143
+ Paths.AppScope
301144
+ );
300762
301145
  try {
300763
- const scopePathMatcher = matchPath(Paths.AllScopes);
300764
- const apiPathMatcher = matchPath(Paths.ApiYamls);
300765
- const generatedApiPathMatcher = matchPath(Paths.GeneratedApis);
300766
- const { packageJson, scopes, otherArtifacts } = files.reduce((acc, file) => {
300767
- if (file.filePath === "package.json") {
301146
+ const { packageJson, notScopeOrApiArtifacts } = files.reduce((acc, file) => {
301147
+ if (file.filePath === Paths.PackageJson) {
300768
301148
  acc.packageJson = file;
300769
- } else if (scopePathMatcher(file.filePath).matched) {
300770
- acc.scopes.push(file);
300771
- } else if (apiPathMatcher(file.filePath).matched) {
300772
- acc.apiYamls.push(file);
300773
- } else if (!generatedApiPathMatcher(file.filePath).matched) {
300774
- acc.otherArtifacts.push(file);
301149
+ } else if (!scopeAndApiPaths(file.filePath).matched) {
301150
+ acc.notScopeOrApiArtifacts.push(file);
300775
301151
  }
300776
301152
  return acc;
300777
301153
  }, {
300778
301154
  packageJson: null,
300779
- apiYamls: [],
300780
- scopes: [],
300781
- otherArtifacts: []
301155
+ notScopeOrApiArtifacts: []
300782
301156
  });
300783
301157
  if (packageJson) {
300784
- sendUserMessage({
300785
- text: "Installing dependencies\u2026"
300786
- });
300787
301158
  await createDraftFiles([packageJson]);
300788
- await appShell.runNpmInstall(clark.context.abortController?.signal);
301159
+ await handleDependencies(packageJson);
300789
301160
  }
300790
- await createDraftFiles(scopes);
300791
- await createDraftFiles(otherArtifacts);
301161
+ await createDraftFiles(notScopeOrApiArtifacts);
300792
301162
  transitionTo({
300793
301163
  type: POST_PROCESSING_FINISHED,
300794
301164
  files
@@ -300807,11 +301177,85 @@ var doPostProcessing = (clark, { draftInterface, appShell }) => {
300807
301177
  }
300808
301178
  };
300809
301179
  };
301180
+ var parsePackageJsonChanges = async (draftInterface, updatedPackageJsonContent) => {
301181
+ const diff2 = await draftInterface.getDraftDiff([Paths.PackageJson]);
301182
+ if (!diff2) {
301183
+ return [];
301184
+ }
301185
+ let updatedPackageJson;
301186
+ try {
301187
+ updatedPackageJson = JSON.parse(updatedPackageJsonContent);
301188
+ } catch {
301189
+ return [];
301190
+ }
301191
+ const allCurrentPackages = /* @__PURE__ */ new Set([
301192
+ // we only surface packages in the dependencies object
301193
+ ...Object.keys(updatedPackageJson.dependencies || {})
301194
+ ]);
301195
+ const changes = [];
301196
+ const lines = diff2.split("\n");
301197
+ const addedPackages = /* @__PURE__ */ new Set();
301198
+ const removedPackages = /* @__PURE__ */ new Set();
301199
+ const packageRegex = /^\s*"([^"]+)":\s*"[^"]*",?$/;
301200
+ for (const line3 of lines) {
301201
+ if (!line3.startsWith("+") && !line3.startsWith("-")) {
301202
+ continue;
301203
+ }
301204
+ if (line3.startsWith("+++") || line3.startsWith("---")) {
301205
+ continue;
301206
+ }
301207
+ const lineContent = line3.slice(1);
301208
+ const match3 = lineContent.match(packageRegex);
301209
+ if (match3) {
301210
+ const packageName = match3[1];
301211
+ if (!packageName) {
301212
+ continue;
301213
+ }
301214
+ if (line3.startsWith("+")) {
301215
+ if (allCurrentPackages.has(packageName)) {
301216
+ addedPackages.add(packageName);
301217
+ }
301218
+ } else if (line3.startsWith("-")) {
301219
+ if (!commonTopLevelPackageJsonFields.has(packageName)) {
301220
+ removedPackages.add(packageName);
301221
+ }
301222
+ }
301223
+ }
301224
+ }
301225
+ for (const packageName of addedPackages) {
301226
+ if (removedPackages.has(packageName)) {
301227
+ changes.push({ type: "edit", package: packageName });
301228
+ } else {
301229
+ changes.push({ type: "create", package: packageName });
301230
+ }
301231
+ }
301232
+ for (const packageName of removedPackages) {
301233
+ if (!addedPackages.has(packageName)) {
301234
+ changes.push({ type: "delete", package: packageName });
301235
+ }
301236
+ }
301237
+ return changes;
301238
+ };
301239
+ var commonTopLevelPackageJsonFields = /* @__PURE__ */ new Set([
301240
+ "name",
301241
+ "version",
301242
+ "description",
301243
+ "main",
301244
+ "scripts",
301245
+ "keywords",
301246
+ "author",
301247
+ "license",
301248
+ "repository",
301249
+ "homepage",
301250
+ "bugs"
301251
+ ]);
300810
301252
 
300811
301253
  // ../../../vite-plugin-file-sync/dist/ai-service/state-machine/handlers/runtime-reviewing.js
300812
301254
  init_cjs_shims();
300813
301255
  var doRuntimeReviewing = (clark, params) => {
300814
301256
  const transitionTo = transitionFrom(clark);
301257
+ const sendChangeInfo = sendChangeInfoHelper(clark);
301258
+ const sendUserMessage = sendUserMessageChannel(clark);
300815
301259
  return async ({ event }) => {
300816
301260
  switch (event.type) {
300817
301261
  case USER_REJECTED_DRAFT:
@@ -300833,6 +301277,20 @@ var doRuntimeReviewing = (clark, params) => {
300833
301277
  tsErrorsByPath
300834
301278
  });
300835
301279
  } else {
301280
+ for (const filePath of Object.keys(clark.context.generatedChangeInfo ?? {})) {
301281
+ void sendChangeInfo({
301282
+ type: "validated",
301283
+ filePath
301284
+ });
301285
+ }
301286
+ if (clark.context.usedDebugging) {
301287
+ void sendUserMessage({
301288
+ type: "control",
301289
+ group: "debugging",
301290
+ status: "pending",
301291
+ text: "QA checks passed"
301292
+ });
301293
+ }
300836
301294
  transitionTo({
300837
301295
  type: RUNTIME_REVIEW_FINISHED
300838
301296
  });
@@ -300852,6 +301310,7 @@ var AiService = class extends EventEmitter3 {
300852
301310
  anthropicProvider;
300853
301311
  templateRenderer;
300854
301312
  appShell;
301313
+ sourceTrackerInterface;
300855
301314
  clark;
300856
301315
  tracer;
300857
301316
  constructor(config2) {
@@ -300868,6 +301327,7 @@ var AiService = class extends EventEmitter3 {
300868
301327
  appRootDirPath: config2.appRootDirPath,
300869
301328
  fsOperationQueue: config2.fsOperationQueue
300870
301329
  });
301330
+ this.sourceTrackerInterface = new SourceTrackerInterface();
300871
301331
  this.clark = new FSM({
300872
301332
  transitions,
300873
301333
  initialState: ClarkStateNames.Idle,
@@ -300891,7 +301351,7 @@ var AiService = class extends EventEmitter3 {
300891
301351
  "handleUserCanceled",
300892
301352
  "handleBuildSystemError"
300893
301353
  ];
300894
- (0, import_shared10.addTracingToMethods)(this, methods, this.tracer);
301354
+ (0, import_shared11.addTracingToMethods)(this, methods, this.tracer);
300895
301355
  }
300896
301356
  createClarkTransitionHandler() {
300897
301357
  const clarkStateHandlerFactories = {
@@ -300910,7 +301370,8 @@ var AiService = class extends EventEmitter3 {
300910
301370
  artifactProcessor: this.artifactProcessor,
300911
301371
  anthropicProvider: this.anthropicProvider,
300912
301372
  appShell: this.appShell,
300913
- signals: this
301373
+ signals: this,
301374
+ sourceTrackerInterface: this.sourceTrackerInterface
300914
301375
  };
300915
301376
  const clarkStateHandlers = Object.fromEntries(Object.entries(clarkStateHandlerFactories).map(([state, handlerFactory]) => [state, handlerFactory(clark, params)]));
300916
301377
  return async (transition) => {
@@ -300983,6 +301444,9 @@ var AiService = class extends EventEmitter3 {
300983
301444
  isBusy() {
300984
301445
  return this.clark.state !== ClarkStateNames.Idle && this.clark.state !== ClarkStateNames.AwaitingUser && this.clark.state !== ClarkStateNames.Dead;
300985
301446
  }
301447
+ setSourceTracker(sourceTracker) {
301448
+ this.sourceTrackerInterface.setSourceTracker(sourceTracker);
301449
+ }
300986
301450
  };
300987
301451
 
300988
301452
  // ../../../vite-plugin-file-sync/dist/sync-service/index.js
@@ -300994,7 +301458,7 @@ init_cjs_shims();
300994
301458
 
300995
301459
  // ../../../library-shared/dist/types/entities.js
300996
301460
  init_cjs_shims();
300997
- var import_shared11 = __toESM(require_dist2(), 1);
301461
+ var import_shared12 = __toESM(require_dist2(), 1);
300998
301462
  var sbEntitySymbol = Symbol("sbEntity");
300999
301463
  var SbEntityType = {
301000
301464
  VARIABLE: "SbVariable",
@@ -301067,8 +301531,11 @@ init_cjs_shims();
301067
301531
  init_cjs_shims();
301068
301532
  var BindingMetaSymbol = Symbol("binding-meta");
301069
301533
 
301534
+ // ../../../library-shared/dist/types/ai-operations.js
301535
+ init_cjs_shims();
301536
+
301070
301537
  // ../../../vite-plugin-file-sync/dist/sync-service/index.js
301071
- var import_shared17 = __toESM(require_dist2(), 1);
301538
+ var import_shared18 = __toESM(require_dist2(), 1);
301072
301539
 
301073
301540
  // ../../../vite-plugin-file-sync/dist/errors/error-handler.js
301074
301541
  init_cjs_shims();
@@ -301142,27 +301609,6 @@ var makeServerError = (error, { critical = "critical" in error ? error.critical
301142
301609
  };
301143
301610
  };
301144
301611
 
301145
- // ../../../vite-plugin-file-sync/dist/util/operation-queue.js
301146
- init_cjs_shims();
301147
- var OperationQueue = class {
301148
- // Invariant: `lastOperation` is a promise that never rejects. This is needed to ensure that the queue
301149
- // can always enqueue a new operation, even if the previous operation rejected.
301150
- lastOperation = Promise.resolve();
301151
- /**
301152
- * Enqueue an operation to be executed one at a time.
301153
- *
301154
- * @param operation - The operation to execute.
301155
- * @returns A promise that resolves to the result of the operation.
301156
- */
301157
- enqueue(operation) {
301158
- const promise = this.lastOperation.then(operation);
301159
- this.lastOperation = promise.then(() => {
301160
- }, () => {
301161
- });
301162
- return promise;
301163
- }
301164
- };
301165
-
301166
301612
  // ../../../vite-plugin-file-sync/dist/util/with-resolvers.js
301167
301613
  init_cjs_shims();
301168
301614
  function withResolvers() {
@@ -301181,7 +301627,7 @@ import * as fsp2 from "node:fs/promises";
301181
301627
 
301182
301628
  // ../../../vite-plugin-file-sync/dist/sync-service/hash-dir-tree.js
301183
301629
  init_cjs_shims();
301184
- var import_shared12 = __toESM(require_dist2(), 1);
301630
+ var import_shared13 = __toESM(require_dist2(), 1);
301185
301631
  var import_util4 = __toESM(require_dist3(), 1);
301186
301632
 
301187
301633
  // ../../../vite-plugin-file-sync/dist/sync-service/list-dir.js
@@ -301244,7 +301690,7 @@ async function hashLocalDirectory(localDirectoryPath) {
301244
301690
  let entry;
301245
301691
  switch (localDirEntry.type) {
301246
301692
  case "-": {
301247
- const hash3 = await (0, import_shared12.hashFileContents)(localDirEntry.contents);
301693
+ const hash3 = await (0, import_shared13.hashFileContents)(localDirEntry.contents);
301248
301694
  entry = {
301249
301695
  type: "-",
301250
301696
  executable: localDirEntry.executable,
@@ -301276,20 +301722,20 @@ async function hashLocalDirectory(localDirectoryPath) {
301276
301722
  }
301277
301723
  directoryContents.push(entry);
301278
301724
  }
301279
- const hash2 = await (0, import_shared12.hashDirectoryContents)(directoryContents);
301725
+ const hash2 = await (0, import_shared13.hashDirectoryContents)(directoryContents);
301280
301726
  return { contents: directoryContents, hash: hash2 };
301281
301727
  }
301282
301728
 
301283
301729
  // ../../../vite-plugin-file-sync/dist/sync-service/server-rpc/client.js
301284
301730
  init_cjs_shims();
301285
- var import_shared14 = __toESM(require_dist2(), 1);
301286
301731
  var import_shared15 = __toESM(require_dist2(), 1);
301732
+ var import_shared16 = __toESM(require_dist2(), 1);
301287
301733
 
301288
301734
  // ../../../vite-plugin-file-sync/dist/sync-service/server-rpc/handlers.js
301289
301735
  init_cjs_shims();
301290
- var import_shared13 = __toESM(require_dist2(), 1);
301736
+ var import_shared14 = __toESM(require_dist2(), 1);
301291
301737
  async function notImplemented() {
301292
- throw new import_shared13.NotImplementedError("Signing methods are not implemented");
301738
+ throw new import_shared14.NotImplementedError("Signing methods are not implemented");
301293
301739
  }
301294
301740
  function createRequestHandlers() {
301295
301741
  const requestHandlers = {
@@ -301309,7 +301755,7 @@ function createRequestHandlers() {
301309
301755
  async function connectToISocketRPCServer({ superblocksBaseUrl, token: token2, tracer: tracer2 }) {
301310
301756
  const requestHandlers = createRequestHandlers();
301311
301757
  const authorization = `Bearer ${token2}`;
301312
- const wsUrl = new URL(`api/${import_shared14.serverWsPath}`, superblocksBaseUrl);
301758
+ const wsUrl = new URL(`api/${import_shared15.serverWsPath}`, superblocksBaseUrl);
301313
301759
  if (wsUrl.protocol === "http:") {
301314
301760
  wsUrl.protocol = "ws:";
301315
301761
  } else if (wsUrl.protocol === "https:") {
@@ -301320,7 +301766,7 @@ async function connectToISocketRPCServer({ superblocksBaseUrl, token: token2, tr
301320
301766
  } else if (wsUrl.hostname === "localhost") {
301321
301767
  wsUrl.hostname = "127.0.0.1";
301322
301768
  }
301323
- return await (0, import_shared14.connectISocket)(wsUrl.href, authorization, requestHandlers, [], tracer2, {
301769
+ return await (0, import_shared15.connectISocket)(wsUrl.href, authorization, requestHandlers, [], tracer2, {
301324
301770
  connectionTimeoutInSeconds: 6 * 60,
301325
301771
  // 6 minutes
301326
301772
  noResponseTimeoutInSeconds: 5 * 60
@@ -301332,9 +301778,9 @@ async function unwrapResponseDto(request) {
301332
301778
  if (!response.responseMeta.success || response.responseMeta.error || response.responseMeta.status !== 200) {
301333
301779
  const errorMessage = response.responseMeta.error?.message ?? response.responseMeta.message ?? `Request failed with status ${response.responseMeta.status}`;
301334
301780
  if (response.responseMeta.status === 409) {
301335
- throw new import_shared15.ConflictError(errorMessage);
301781
+ throw new import_shared16.ConflictError(errorMessage);
301336
301782
  } else if (response.responseMeta.status === 404) {
301337
- throw new import_shared14.NotFoundError(errorMessage);
301783
+ throw new import_shared15.NotFoundError(errorMessage);
301338
301784
  }
301339
301785
  throw new Error(errorMessage);
301340
301786
  }
@@ -301438,6 +301884,505 @@ async function doDownloadApplicationDirectory(rpcClient, directoryHash, localDir
301438
301884
  init_cjs_shims();
301439
301885
  import * as fsp3 from "node:fs/promises";
301440
301886
  import * as path19 from "node:path";
301887
+
301888
+ // ../../../../node_modules/.pnpm/diff@8.0.2/node_modules/diff/libesm/index.js
301889
+ init_cjs_shims();
301890
+
301891
+ // ../../../../node_modules/.pnpm/diff@8.0.2/node_modules/diff/libesm/diff/base.js
301892
+ init_cjs_shims();
301893
+ var Diff2 = class {
301894
+ diff(oldStr, newStr, options8 = {}) {
301895
+ let callback;
301896
+ if (typeof options8 === "function") {
301897
+ callback = options8;
301898
+ options8 = {};
301899
+ } else if ("callback" in options8) {
301900
+ callback = options8.callback;
301901
+ }
301902
+ const oldString = this.castInput(oldStr, options8);
301903
+ const newString = this.castInput(newStr, options8);
301904
+ const oldTokens = this.removeEmpty(this.tokenize(oldString, options8));
301905
+ const newTokens = this.removeEmpty(this.tokenize(newString, options8));
301906
+ return this.diffWithOptionsObj(oldTokens, newTokens, options8, callback);
301907
+ }
301908
+ diffWithOptionsObj(oldTokens, newTokens, options8, callback) {
301909
+ var _a18;
301910
+ const done = (value2) => {
301911
+ value2 = this.postProcess(value2, options8);
301912
+ if (callback) {
301913
+ setTimeout(function() {
301914
+ callback(value2);
301915
+ }, 0);
301916
+ return void 0;
301917
+ } else {
301918
+ return value2;
301919
+ }
301920
+ };
301921
+ const newLen = newTokens.length, oldLen = oldTokens.length;
301922
+ let editLength = 1;
301923
+ let maxEditLength = newLen + oldLen;
301924
+ if (options8.maxEditLength != null) {
301925
+ maxEditLength = Math.min(maxEditLength, options8.maxEditLength);
301926
+ }
301927
+ const maxExecutionTime = (_a18 = options8.timeout) !== null && _a18 !== void 0 ? _a18 : Infinity;
301928
+ const abortAfterTimestamp = Date.now() + maxExecutionTime;
301929
+ const bestPath = [{ oldPos: -1, lastComponent: void 0 }];
301930
+ let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options8);
301931
+ if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
301932
+ return done(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
301933
+ }
301934
+ let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
301935
+ const execEditLength = () => {
301936
+ for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
301937
+ let basePath;
301938
+ const removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
301939
+ if (removePath) {
301940
+ bestPath[diagonalPath - 1] = void 0;
301941
+ }
301942
+ let canAdd = false;
301943
+ if (addPath) {
301944
+ const addPathNewPos = addPath.oldPos - diagonalPath;
301945
+ canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
301946
+ }
301947
+ const canRemove = removePath && removePath.oldPos + 1 < oldLen;
301948
+ if (!canAdd && !canRemove) {
301949
+ bestPath[diagonalPath] = void 0;
301950
+ continue;
301951
+ }
301952
+ if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
301953
+ basePath = this.addToPath(addPath, true, false, 0, options8);
301954
+ } else {
301955
+ basePath = this.addToPath(removePath, false, true, 1, options8);
301956
+ }
301957
+ newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options8);
301958
+ if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
301959
+ return done(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
301960
+ } else {
301961
+ bestPath[diagonalPath] = basePath;
301962
+ if (basePath.oldPos + 1 >= oldLen) {
301963
+ maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
301964
+ }
301965
+ if (newPos + 1 >= newLen) {
301966
+ minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
301967
+ }
301968
+ }
301969
+ }
301970
+ editLength++;
301971
+ };
301972
+ if (callback) {
301973
+ (function exec8() {
301974
+ setTimeout(function() {
301975
+ if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
301976
+ return callback(void 0);
301977
+ }
301978
+ if (!execEditLength()) {
301979
+ exec8();
301980
+ }
301981
+ }, 0);
301982
+ })();
301983
+ } else {
301984
+ while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
301985
+ const ret = execEditLength();
301986
+ if (ret) {
301987
+ return ret;
301988
+ }
301989
+ }
301990
+ }
301991
+ }
301992
+ addToPath(path51, added, removed, oldPosInc, options8) {
301993
+ const last2 = path51.lastComponent;
301994
+ if (last2 && !options8.oneChangePerToken && last2.added === added && last2.removed === removed) {
301995
+ return {
301996
+ oldPos: path51.oldPos + oldPosInc,
301997
+ lastComponent: { count: last2.count + 1, added, removed, previousComponent: last2.previousComponent }
301998
+ };
301999
+ } else {
302000
+ return {
302001
+ oldPos: path51.oldPos + oldPosInc,
302002
+ lastComponent: { count: 1, added, removed, previousComponent: last2 }
302003
+ };
302004
+ }
302005
+ }
302006
+ extractCommon(basePath, newTokens, oldTokens, diagonalPath, options8) {
302007
+ const newLen = newTokens.length, oldLen = oldTokens.length;
302008
+ let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
302009
+ while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options8)) {
302010
+ newPos++;
302011
+ oldPos++;
302012
+ commonCount++;
302013
+ if (options8.oneChangePerToken) {
302014
+ basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
302015
+ }
302016
+ }
302017
+ if (commonCount && !options8.oneChangePerToken) {
302018
+ basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
302019
+ }
302020
+ basePath.oldPos = oldPos;
302021
+ return newPos;
302022
+ }
302023
+ equals(left, right, options8) {
302024
+ if (options8.comparator) {
302025
+ return options8.comparator(left, right);
302026
+ } else {
302027
+ return left === right || !!options8.ignoreCase && left.toLowerCase() === right.toLowerCase();
302028
+ }
302029
+ }
302030
+ removeEmpty(array2) {
302031
+ const ret = [];
302032
+ for (let i2 = 0; i2 < array2.length; i2++) {
302033
+ if (array2[i2]) {
302034
+ ret.push(array2[i2]);
302035
+ }
302036
+ }
302037
+ return ret;
302038
+ }
302039
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
302040
+ castInput(value2, options8) {
302041
+ return value2;
302042
+ }
302043
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
302044
+ tokenize(value2, options8) {
302045
+ return Array.from(value2);
302046
+ }
302047
+ join(chars) {
302048
+ return chars.join("");
302049
+ }
302050
+ postProcess(changeObjects, options8) {
302051
+ return changeObjects;
302052
+ }
302053
+ get useLongestToken() {
302054
+ return false;
302055
+ }
302056
+ buildValues(lastComponent, newTokens, oldTokens) {
302057
+ const components2 = [];
302058
+ let nextComponent;
302059
+ while (lastComponent) {
302060
+ components2.push(lastComponent);
302061
+ nextComponent = lastComponent.previousComponent;
302062
+ delete lastComponent.previousComponent;
302063
+ lastComponent = nextComponent;
302064
+ }
302065
+ components2.reverse();
302066
+ const componentLen = components2.length;
302067
+ let componentPos = 0, newPos = 0, oldPos = 0;
302068
+ for (; componentPos < componentLen; componentPos++) {
302069
+ const component = components2[componentPos];
302070
+ if (!component.removed) {
302071
+ if (!component.added && this.useLongestToken) {
302072
+ let value2 = newTokens.slice(newPos, newPos + component.count);
302073
+ value2 = value2.map(function(value3, i2) {
302074
+ const oldValue = oldTokens[oldPos + i2];
302075
+ return oldValue.length > value3.length ? oldValue : value3;
302076
+ });
302077
+ component.value = this.join(value2);
302078
+ } else {
302079
+ component.value = this.join(newTokens.slice(newPos, newPos + component.count));
302080
+ }
302081
+ newPos += component.count;
302082
+ if (!component.added) {
302083
+ oldPos += component.count;
302084
+ }
302085
+ } else {
302086
+ component.value = this.join(oldTokens.slice(oldPos, oldPos + component.count));
302087
+ oldPos += component.count;
302088
+ }
302089
+ }
302090
+ return components2;
302091
+ }
302092
+ };
302093
+
302094
+ // ../../../../node_modules/.pnpm/diff@8.0.2/node_modules/diff/libesm/diff/line.js
302095
+ init_cjs_shims();
302096
+ var LineDiff = class extends Diff2 {
302097
+ constructor() {
302098
+ super(...arguments);
302099
+ this.tokenize = tokenize2;
302100
+ }
302101
+ equals(left, right, options8) {
302102
+ if (options8.ignoreWhitespace) {
302103
+ if (!options8.newlineIsToken || !left.includes("\n")) {
302104
+ left = left.trim();
302105
+ }
302106
+ if (!options8.newlineIsToken || !right.includes("\n")) {
302107
+ right = right.trim();
302108
+ }
302109
+ } else if (options8.ignoreNewlineAtEof && !options8.newlineIsToken) {
302110
+ if (left.endsWith("\n")) {
302111
+ left = left.slice(0, -1);
302112
+ }
302113
+ if (right.endsWith("\n")) {
302114
+ right = right.slice(0, -1);
302115
+ }
302116
+ }
302117
+ return super.equals(left, right, options8);
302118
+ }
302119
+ };
302120
+ var lineDiff2 = new LineDiff();
302121
+ function diffLines2(oldStr, newStr, options8) {
302122
+ return lineDiff2.diff(oldStr, newStr, options8);
302123
+ }
302124
+ function tokenize2(value2, options8) {
302125
+ if (options8.stripTrailingCr) {
302126
+ value2 = value2.replace(/\r\n/g, "\n");
302127
+ }
302128
+ const retLines = [], linesAndNewlines = value2.split(/(\n|\r\n)/);
302129
+ if (!linesAndNewlines[linesAndNewlines.length - 1]) {
302130
+ linesAndNewlines.pop();
302131
+ }
302132
+ for (let i2 = 0; i2 < linesAndNewlines.length; i2++) {
302133
+ const line3 = linesAndNewlines[i2];
302134
+ if (i2 % 2 && !options8.newlineIsToken) {
302135
+ retLines[retLines.length - 1] += line3;
302136
+ } else {
302137
+ retLines.push(line3);
302138
+ }
302139
+ }
302140
+ return retLines;
302141
+ }
302142
+
302143
+ // ../../../../node_modules/.pnpm/diff@8.0.2/node_modules/diff/libesm/diff/json.js
302144
+ init_cjs_shims();
302145
+ var JsonDiff = class extends Diff2 {
302146
+ constructor() {
302147
+ super(...arguments);
302148
+ this.tokenize = tokenize2;
302149
+ }
302150
+ get useLongestToken() {
302151
+ return true;
302152
+ }
302153
+ castInput(value2, options8) {
302154
+ const { undefinedReplacement, stringifyReplacer = (k, v) => typeof v === "undefined" ? undefinedReplacement : v } = options8;
302155
+ return typeof value2 === "string" ? value2 : JSON.stringify(canonicalize2(value2, null, null, stringifyReplacer), null, " ");
302156
+ }
302157
+ equals(left, right, options8) {
302158
+ return super.equals(left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"), options8);
302159
+ }
302160
+ };
302161
+ var jsonDiff2 = new JsonDiff();
302162
+ function diffJson(oldStr, newStr, options8) {
302163
+ return jsonDiff2.diff(oldStr, newStr, options8);
302164
+ }
302165
+ function canonicalize2(obj, stack2, replacementStack, replacer, key2) {
302166
+ stack2 = stack2 || [];
302167
+ replacementStack = replacementStack || [];
302168
+ if (replacer) {
302169
+ obj = replacer(key2 === void 0 ? "" : key2, obj);
302170
+ }
302171
+ let i2;
302172
+ for (i2 = 0; i2 < stack2.length; i2 += 1) {
302173
+ if (stack2[i2] === obj) {
302174
+ return replacementStack[i2];
302175
+ }
302176
+ }
302177
+ let canonicalizedObj;
302178
+ if ("[object Array]" === Object.prototype.toString.call(obj)) {
302179
+ stack2.push(obj);
302180
+ canonicalizedObj = new Array(obj.length);
302181
+ replacementStack.push(canonicalizedObj);
302182
+ for (i2 = 0; i2 < obj.length; i2 += 1) {
302183
+ canonicalizedObj[i2] = canonicalize2(obj[i2], stack2, replacementStack, replacer, String(i2));
302184
+ }
302185
+ stack2.pop();
302186
+ replacementStack.pop();
302187
+ return canonicalizedObj;
302188
+ }
302189
+ if (obj && obj.toJSON) {
302190
+ obj = obj.toJSON();
302191
+ }
302192
+ if (typeof obj === "object" && obj !== null) {
302193
+ stack2.push(obj);
302194
+ canonicalizedObj = {};
302195
+ replacementStack.push(canonicalizedObj);
302196
+ const sortedKeys = [];
302197
+ let key3;
302198
+ for (key3 in obj) {
302199
+ if (Object.prototype.hasOwnProperty.call(obj, key3)) {
302200
+ sortedKeys.push(key3);
302201
+ }
302202
+ }
302203
+ sortedKeys.sort();
302204
+ for (i2 = 0; i2 < sortedKeys.length; i2 += 1) {
302205
+ key3 = sortedKeys[i2];
302206
+ canonicalizedObj[key3] = canonicalize2(obj[key3], stack2, replacementStack, replacer, key3);
302207
+ }
302208
+ stack2.pop();
302209
+ replacementStack.pop();
302210
+ } else {
302211
+ canonicalizedObj = obj;
302212
+ }
302213
+ return canonicalizedObj;
302214
+ }
302215
+
302216
+ // ../../../../node_modules/.pnpm/diff@8.0.2/node_modules/diff/libesm/patch/create.js
302217
+ init_cjs_shims();
302218
+ function structuredPatch2(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options8) {
302219
+ let optionsObj;
302220
+ if (!options8) {
302221
+ optionsObj = {};
302222
+ } else if (typeof options8 === "function") {
302223
+ optionsObj = { callback: options8 };
302224
+ } else {
302225
+ optionsObj = options8;
302226
+ }
302227
+ if (typeof optionsObj.context === "undefined") {
302228
+ optionsObj.context = 4;
302229
+ }
302230
+ const context2 = optionsObj.context;
302231
+ if (optionsObj.newlineIsToken) {
302232
+ throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");
302233
+ }
302234
+ if (!optionsObj.callback) {
302235
+ return diffLinesResultToPatch(diffLines2(oldStr, newStr, optionsObj));
302236
+ } else {
302237
+ const { callback } = optionsObj;
302238
+ diffLines2(oldStr, newStr, Object.assign(Object.assign({}, optionsObj), { callback: (diff2) => {
302239
+ const patch = diffLinesResultToPatch(diff2);
302240
+ callback(patch);
302241
+ } }));
302242
+ }
302243
+ function diffLinesResultToPatch(diff2) {
302244
+ if (!diff2) {
302245
+ return;
302246
+ }
302247
+ diff2.push({ value: "", lines: [] });
302248
+ function contextLines(lines) {
302249
+ return lines.map(function(entry) {
302250
+ return " " + entry;
302251
+ });
302252
+ }
302253
+ const hunks = [];
302254
+ let oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;
302255
+ for (let i2 = 0; i2 < diff2.length; i2++) {
302256
+ const current = diff2[i2], lines = current.lines || splitLines3(current.value);
302257
+ current.lines = lines;
302258
+ if (current.added || current.removed) {
302259
+ if (!oldRangeStart) {
302260
+ const prev = diff2[i2 - 1];
302261
+ oldRangeStart = oldLine;
302262
+ newRangeStart = newLine;
302263
+ if (prev) {
302264
+ curRange = context2 > 0 ? contextLines(prev.lines.slice(-context2)) : [];
302265
+ oldRangeStart -= curRange.length;
302266
+ newRangeStart -= curRange.length;
302267
+ }
302268
+ }
302269
+ for (const line3 of lines) {
302270
+ curRange.push((current.added ? "+" : "-") + line3);
302271
+ }
302272
+ if (current.added) {
302273
+ newLine += lines.length;
302274
+ } else {
302275
+ oldLine += lines.length;
302276
+ }
302277
+ } else {
302278
+ if (oldRangeStart) {
302279
+ if (lines.length <= context2 * 2 && i2 < diff2.length - 2) {
302280
+ for (const line3 of contextLines(lines)) {
302281
+ curRange.push(line3);
302282
+ }
302283
+ } else {
302284
+ const contextSize = Math.min(lines.length, context2);
302285
+ for (const line3 of contextLines(lines.slice(0, contextSize))) {
302286
+ curRange.push(line3);
302287
+ }
302288
+ const hunk = {
302289
+ oldStart: oldRangeStart,
302290
+ oldLines: oldLine - oldRangeStart + contextSize,
302291
+ newStart: newRangeStart,
302292
+ newLines: newLine - newRangeStart + contextSize,
302293
+ lines: curRange
302294
+ };
302295
+ hunks.push(hunk);
302296
+ oldRangeStart = 0;
302297
+ newRangeStart = 0;
302298
+ curRange = [];
302299
+ }
302300
+ }
302301
+ oldLine += lines.length;
302302
+ newLine += lines.length;
302303
+ }
302304
+ }
302305
+ for (const hunk of hunks) {
302306
+ for (let i2 = 0; i2 < hunk.lines.length; i2++) {
302307
+ if (hunk.lines[i2].endsWith("\n")) {
302308
+ hunk.lines[i2] = hunk.lines[i2].slice(0, -1);
302309
+ } else {
302310
+ hunk.lines.splice(i2 + 1, 0, "\");
302311
+ i2++;
302312
+ }
302313
+ }
302314
+ }
302315
+ return {
302316
+ oldFileName,
302317
+ newFileName,
302318
+ oldHeader,
302319
+ newHeader,
302320
+ hunks
302321
+ };
302322
+ }
302323
+ }
302324
+ function formatPatch2(patch) {
302325
+ if (Array.isArray(patch)) {
302326
+ return patch.map(formatPatch2).join("\n");
302327
+ }
302328
+ const ret = [];
302329
+ if (patch.oldFileName == patch.newFileName) {
302330
+ ret.push("Index: " + patch.oldFileName);
302331
+ }
302332
+ ret.push("===================================================================");
302333
+ ret.push("--- " + patch.oldFileName + (typeof patch.oldHeader === "undefined" ? "" : " " + patch.oldHeader));
302334
+ ret.push("+++ " + patch.newFileName + (typeof patch.newHeader === "undefined" ? "" : " " + patch.newHeader));
302335
+ for (let i2 = 0; i2 < patch.hunks.length; i2++) {
302336
+ const hunk = patch.hunks[i2];
302337
+ if (hunk.oldLines === 0) {
302338
+ hunk.oldStart -= 1;
302339
+ }
302340
+ if (hunk.newLines === 0) {
302341
+ hunk.newStart -= 1;
302342
+ }
302343
+ ret.push("@@ -" + hunk.oldStart + "," + hunk.oldLines + " +" + hunk.newStart + "," + hunk.newLines + " @@");
302344
+ for (const line3 of hunk.lines) {
302345
+ ret.push(line3);
302346
+ }
302347
+ }
302348
+ return ret.join("\n") + "\n";
302349
+ }
302350
+ function createTwoFilesPatch2(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options8) {
302351
+ if (typeof options8 === "function") {
302352
+ options8 = { callback: options8 };
302353
+ }
302354
+ if (!(options8 === null || options8 === void 0 ? void 0 : options8.callback)) {
302355
+ const patchObj = structuredPatch2(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options8);
302356
+ if (!patchObj) {
302357
+ return;
302358
+ }
302359
+ return formatPatch2(patchObj);
302360
+ } else {
302361
+ const { callback } = options8;
302362
+ structuredPatch2(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, Object.assign(Object.assign({}, options8), { callback: (patchObj) => {
302363
+ if (!patchObj) {
302364
+ callback(void 0);
302365
+ } else {
302366
+ callback(formatPatch2(patchObj));
302367
+ }
302368
+ } }));
302369
+ }
302370
+ }
302371
+ function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options8) {
302372
+ return createTwoFilesPatch2(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options8);
302373
+ }
302374
+ function splitLines3(text2) {
302375
+ const hasTrailingNl = text2.endsWith("\n");
302376
+ const result = text2.split("\n").map((line3) => line3 + "\n");
302377
+ if (hasTrailingNl) {
302378
+ result.pop();
302379
+ } else {
302380
+ result.push(result.pop().slice(0, -1));
302381
+ }
302382
+ return result;
302383
+ }
302384
+
302385
+ // ../../../vite-plugin-file-sync/dist/sync-service/draft-helpers.js
301441
302386
  var EDIT_EXT = ".sbswap.edit";
301442
302387
  var ADD_EXT = ".sbswap.add";
301443
302388
  function getMarkerFilePath(filePath, appRootDirPath, markerType) {
@@ -301659,7 +302604,7 @@ async function generateDraftDiff(appRootDirPath, specificPaths = []) {
301659
302604
  } catch {
301660
302605
  return "No draft changes found.";
301661
302606
  }
301662
- const diffLines2 = [];
302607
+ const diffLines3 = [];
301663
302608
  let { edits, additions } = await getDraftInfo(appRootDirPath);
301664
302609
  edits = edits.filter((edit) => specificPaths.length === 0 || specificPaths.some((path51) => edit.startsWith(path51)));
301665
302610
  additions = additions.filter((add) => specificPaths.length === 0 || specificPaths.some((path51) => add.startsWith(path51)));
@@ -301672,13 +302617,9 @@ async function generateDraftDiff(appRootDirPath, specificPaths = []) {
301672
302617
  try {
301673
302618
  const currentContent = await fsp3.readFile(originalPath, "utf8");
301674
302619
  const originalContent = await fsp3.readFile(markerPath, "utf8");
301675
- diffLines2.push(`diff --git a/${editPath} b/${editPath}`);
301676
- diffLines2.push(`index 0000000..1000000 100644`);
301677
- diffLines2.push(`--- a/${editPath}`);
301678
- diffLines2.push(`+++ b/${editPath}`);
301679
- const unifiedDiff = generateUnifiedDiff(originalContent, currentContent);
301680
- diffLines2.push(...unifiedDiff);
301681
- diffLines2.push("");
302620
+ const patch = createPatch(editPath, originalContent, currentContent);
302621
+ diffLines3.push(patch);
302622
+ diffLines3.push("");
301682
302623
  } catch (_error) {
301683
302624
  continue;
301684
302625
  }
@@ -301687,81 +302628,17 @@ async function generateDraftDiff(appRootDirPath, specificPaths = []) {
301687
302628
  const filePath = path19.join(appRootDirPath, addPath);
301688
302629
  try {
301689
302630
  const content2 = await fsp3.readFile(filePath, "utf8");
301690
- diffLines2.push(`diff --git a/${addPath} b/${addPath}`);
301691
- diffLines2.push(`new file mode 100644`);
301692
- diffLines2.push(`index 0000000..1000000`);
301693
- diffLines2.push(`--- /dev/null`);
301694
- diffLines2.push(`+++ b/${addPath}`);
301695
- diffLines2.push(`@@ -0,0 +1,${content2.split("\n").length} @@`);
301696
- const lines = content2.split("\n");
301697
- for (const line3 of lines) {
301698
- diffLines2.push(`+${line3}`);
301699
- }
301700
- diffLines2.push("");
302631
+ const patch = createPatch(addPath, "", content2);
302632
+ diffLines3.push(patch);
302633
+ diffLines3.push("");
301701
302634
  } catch (_error) {
301702
302635
  continue;
301703
302636
  }
301704
302637
  }
301705
- if (diffLines2[diffLines2.length - 1] === "") {
301706
- diffLines2.pop();
301707
- }
301708
- return diffLines2.join("\n");
301709
- }
301710
- function generateUnifiedDiff(originalContent, currentContent) {
301711
- const originalLines = originalContent.split("\n");
301712
- const currentLines = currentContent.split("\n");
301713
- const diffLines2 = [];
301714
- let hasChanges = false;
301715
- const changes = [];
301716
- let i2 = 0, j = 0;
301717
- while (i2 < originalLines.length || j < currentLines.length) {
301718
- if (i2 < originalLines.length && j < currentLines.length) {
301719
- const originalLine = originalLines[i2] ?? "";
301720
- const currentLine = currentLines[j] ?? "";
301721
- if (originalLine === currentLine) {
301722
- changes.push({ type: "context", line: originalLine });
301723
- i2++;
301724
- j++;
301725
- } else {
301726
- changes.push({ type: "remove", line: originalLine });
301727
- changes.push({ type: "add", line: currentLine });
301728
- i2++;
301729
- j++;
301730
- hasChanges = true;
301731
- }
301732
- } else if (i2 < originalLines.length) {
301733
- const originalLine = originalLines[i2] ?? "";
301734
- changes.push({ type: "remove", line: originalLine });
301735
- i2++;
301736
- hasChanges = true;
301737
- } else {
301738
- const currentLine = currentLines[j] ?? "";
301739
- changes.push({ type: "add", line: currentLine });
301740
- j++;
301741
- hasChanges = true;
301742
- }
301743
- }
301744
- if (!hasChanges) {
301745
- return [];
302638
+ if (diffLines3[diffLines3.length - 1] === "") {
302639
+ diffLines3.pop();
301746
302640
  }
301747
- const hunkStart = 1;
301748
- const hunkOriginalCount = originalLines.length;
301749
- const hunkCurrentCount = currentLines.length;
301750
- diffLines2.push(`@@ -${hunkStart},${hunkOriginalCount} +${hunkStart},${hunkCurrentCount} @@`);
301751
- for (const change of changes) {
301752
- switch (change.type) {
301753
- case "context":
301754
- diffLines2.push(` ${change.line}`);
301755
- break;
301756
- case "remove":
301757
- diffLines2.push(`-${change.line}`);
301758
- break;
301759
- case "add":
301760
- diffLines2.push(`+${change.line}`);
301761
- break;
301762
- }
301763
- }
301764
- return diffLines2;
302641
+ return diffLines3.join("\n");
301765
302642
  }
301766
302643
 
301767
302644
  // ../../../vite-plugin-file-sync/dist/sync-service/hash-cache.js
@@ -301817,7 +302694,7 @@ var HashCache = class {
301817
302694
 
301818
302695
  // ../../../vite-plugin-file-sync/dist/sync-service/snapshot/take-snapshot.js
301819
302696
  init_cjs_shims();
301820
- var import_shared16 = __toESM(require_dist2(), 1);
302697
+ var import_shared17 = __toESM(require_dist2(), 1);
301821
302698
  var import_util5 = __toESM(require_dist3(), 1);
301822
302699
  async function snapshotLocalDirectory(localDirectoryPath) {
301823
302700
  const directoryContents = [];
@@ -301826,7 +302703,7 @@ async function snapshotLocalDirectory(localDirectoryPath) {
301826
302703
  let entry;
301827
302704
  switch (localDirEntry.type) {
301828
302705
  case "-": {
301829
- const hash2 = await (0, import_shared16.hashFileContents)(localDirEntry.contents);
302706
+ const hash2 = await (0, import_shared17.hashFileContents)(localDirEntry.contents);
301830
302707
  entry = {
301831
302708
  type: "-",
301832
302709
  name: localDirEntry.name,
@@ -301859,7 +302736,7 @@ async function snapshotLocalDirectory(localDirectoryPath) {
301859
302736
  }
301860
302737
  directoryContents.push(entry);
301861
302738
  }
301862
- const directoryHash = await (0, import_shared16.hashDirectoryContents)(directoryContents);
302739
+ const directoryHash = await (0, import_shared17.hashDirectoryContents)(directoryContents);
301863
302740
  return {
301864
302741
  hash: directoryHash,
301865
302742
  contents: directoryContents
@@ -301990,7 +302867,7 @@ var SyncService = class extends EventEmitter4 {
301990
302867
  "discardLocalDraftChanges",
301991
302868
  "commitLocalDraftChanges"
301992
302869
  ];
301993
- (0, import_shared17.addTracingToMethods)(this, methods, this._tracer);
302870
+ (0, import_shared18.addTracingToMethods)(this, methods, this._tracer);
301994
302871
  }
301995
302872
  /** The current status of the sync service, which indicates what the service is currently doing */
301996
302873
  get status() {
@@ -302252,7 +303129,7 @@ var SyncService = class extends EventEmitter4 {
302252
303129
 
302253
303130
  // ../../../vite-plugin-file-sync/dist/lock-service/index.js
302254
303131
  init_cjs_shims();
302255
- var import_shared18 = __toESM(require_dist2(), 1);
303132
+ var import_shared19 = __toESM(require_dist2(), 1);
302256
303133
  import EventEmitter5 from "node:events";
302257
303134
  var LOCK_HEARTBEAT_INTERVAL_MS = 30 * 1e3;
302258
303135
  var SHUTDOWN_TIMEOUT_MS = 5 * 60 * 1e3;
@@ -302307,7 +303184,7 @@ var LockService = class extends EventEmitter5 {
302307
303184
  "shutdown",
302308
303185
  "shutdownAndExit"
302309
303186
  ];
302310
- (0, import_shared18.addTracingToMethods)(this, methods, this._tracer);
303187
+ (0, import_shared19.addTracingToMethods)(this, methods, this._tracer);
302311
303188
  }
302312
303189
  setSyncCallback(callback) {
302313
303190
  this.syncCallback = callback;
@@ -302352,7 +303229,7 @@ var LockService = class extends EventEmitter5 {
302352
303229
  return;
302353
303230
  }
302354
303231
  } catch (error) {
302355
- if (error instanceof import_shared18.ConflictError) {
303232
+ if (error instanceof import_shared19.ConflictError) {
302356
303233
  logger3.error(`[lock-service] ${error.message}`);
302357
303234
  this.emit("statusChange", LockServiceStatus.FAILED_TO_ACQUIRE_LOCK);
302358
303235
  this.status = LockServiceStatus.FAILED_TO_ACQUIRE_LOCK;
@@ -302408,7 +303285,7 @@ var LockService = class extends EventEmitter5 {
302408
303285
  return true;
302409
303286
  }
302410
303287
  } catch (error) {
302411
- if (error instanceof import_shared18.NotFoundError) {
303288
+ if (error instanceof import_shared19.NotFoundError) {
302412
303289
  logger3.info(`[lock-service] Lock was removed, shutting down: ${error.message}`);
302413
303290
  this.emit("statusChange", LockServiceStatus.LOCK_INVALID);
302414
303291
  this.status = LockServiceStatus.LOCK_INVALID;
@@ -302544,7 +303421,7 @@ var LockService = class extends EventEmitter5 {
302544
303421
 
302545
303422
  // ../../../vite-plugin-file-sync/dist/file-sync-vite-plugin.js
302546
303423
  init_cjs_shims();
302547
- var import_shared30 = __toESM(require_dist2(), 1);
303424
+ var import_shared31 = __toESM(require_dist2(), 1);
302548
303425
  var import_body_parser = __toESM(require_body_parser(), 1);
302549
303426
  var import_common_tags4 = __toESM(require_lib4(), 1);
302550
303427
  import path28 from "node:path";
@@ -302707,16 +303584,16 @@ init_cjs_shims();
302707
303584
 
302708
303585
  // ../../../library-shared/dist/scope.js
302709
303586
  init_cjs_shims();
302710
- var import_shared19 = __toESM(require_dist2(), 1);
303587
+ var import_shared20 = __toESM(require_dist2(), 1);
302711
303588
  function getStableScopeId(scopeName) {
302712
- return (0, import_shared19.generatePredictableId)(`sc-${scopeName}`);
303589
+ return (0, import_shared20.generatePredictableId)(`sc-${scopeName}`);
302713
303590
  }
302714
303591
  function getStableEntityId(scopeId, entityName) {
302715
- return `SB-${(0, import_shared19.generatePredictableId)(scopeId + entityName)}-type`;
303592
+ return `SB-${(0, import_shared20.generatePredictableId)(scopeId + entityName)}-type`;
302716
303593
  }
302717
303594
 
302718
303595
  // ../../../vite-plugin-file-sync/dist/binding-extraction/extract-identifiers.js
302719
- var import_shared21 = __toESM(require_dist2(), 1);
303596
+ var import_shared22 = __toESM(require_dist2(), 1);
302720
303597
 
302721
303598
  // ../../../vite-plugin-file-sync/dist/binding-extraction/extract-control-block-identifiers.js
302722
303599
  init_cjs_shims();
@@ -307422,9 +308299,9 @@ var extractPythonEvaluationBindings = async (pythonSnippet) => {
307422
308299
  async function extractBindingsFromValue(value2, pluginID) {
307423
308300
  if (value2?.toString) {
307424
308301
  const stringValue = value2.toString();
307425
- if (pluginID === import_shared21.LanguagePluginID.JavaScript) {
308302
+ if (pluginID === import_shared22.LanguagePluginID.JavaScript) {
307426
308303
  return await extractJsEvaluationBindings(stringValue);
307427
- } else if (pluginID === import_shared21.LanguagePluginID.Python) {
308304
+ } else if (pluginID === import_shared22.LanguagePluginID.Python) {
307428
308305
  return await extractPythonEvaluationBindings(stringValue);
307429
308306
  }
307430
308307
  const { jsSnippets } = getDynamicBindings(stringValue);
@@ -307461,14 +308338,14 @@ async function extractBindingsFromAction(action) {
307461
308338
  }
307462
308339
  var getLanguageConfiguration = (block) => {
307463
308340
  switch (block.step?.integration) {
307464
- case import_shared21.LanguagePluginID.JavaScript:
308341
+ case import_shared22.LanguagePluginID.JavaScript:
307465
308342
  return {
307466
- pluginId: import_shared21.LanguagePluginID.JavaScript,
308343
+ pluginId: import_shared22.LanguagePluginID.JavaScript,
307467
308344
  configuration: block.step?.javascript
307468
308345
  };
307469
- case import_shared21.LanguagePluginID.Python:
308346
+ case import_shared22.LanguagePluginID.Python:
307470
308347
  return {
307471
- pluginId: import_shared21.LanguagePluginID.Python,
308348
+ pluginId: import_shared22.LanguagePluginID.Python,
307472
308349
  configuration: block.step?.python
307473
308350
  };
307474
308351
  default:
@@ -307481,7 +308358,7 @@ var getLanguageConfiguration = (block) => {
307481
308358
  var computeStepBlockBindings = async (block) => {
307482
308359
  const { name: name18 } = block;
307483
308360
  const config2 = {
307484
- type: import_shared21.ActionType.Integration,
308361
+ type: import_shared22.ActionType.Integration,
307485
308362
  name: name18,
307486
308363
  id: name18,
307487
308364
  datasourceId: block.step?.integration,
@@ -307736,7 +308613,7 @@ var import_types25 = __toESM(require_lib7(), 1);
307736
308613
  import fs13 from "fs/promises";
307737
308614
  import EventEmitter8 from "node:events";
307738
308615
  import path27 from "node:path";
307739
- var import_shared28 = __toESM(require_dist2(), 1);
308616
+ var import_shared29 = __toESM(require_dist2(), 1);
307740
308617
  var import_util23 = __toESM(require_dist3(), 1);
307741
308618
  init_lodash();
307742
308619
  var import_yaml3 = __toESM(require_dist(), 1);
@@ -307772,7 +308649,7 @@ var generatePredictableId2 = (name18) => {
307772
308649
  // ../../../vite-plugin-file-sync/dist/parsing/jsx.js
307773
308650
  init_cjs_shims();
307774
308651
  var import_types10 = __toESM(require_lib7(), 1);
307775
- var import_shared24 = __toESM(require_dist2(), 1);
308652
+ var import_shared25 = __toESM(require_dist2(), 1);
307776
308653
 
307777
308654
  // ../../../vite-plugin-file-sync/dist/parsing/properties.js
307778
308655
  init_cjs_shims();
@@ -307803,6 +308680,9 @@ function objectExpressionToObject(obj, context2) {
307803
308680
  return acc;
307804
308681
  }, {});
307805
308682
  }
308683
+ function createObjectKey(key2) {
308684
+ return import_types7.default.isValidIdentifier(key2) ? import_types7.default.identifier(key2) : import_types7.default.stringLiteral(key2);
308685
+ }
307806
308686
  function stringToTaggedTemplate(str2) {
307807
308687
  return import_types7.default.taggedTemplateExpression(import_types7.default.identifier("SB"), import_types7.default.templateLiteral([import_types7.default.templateElement({ raw: str2, cooked: str2 }, true)], []));
307808
308688
  }
@@ -308292,7 +309172,7 @@ init_cjs_shims();
308292
309172
 
308293
309173
  // ../../../vite-plugin-file-sync/dist/parsing/events/to-code-events.js
308294
309174
  init_cjs_shims();
308295
- var import_shared22 = __toESM(require_dist2(), 1);
309175
+ var import_shared23 = __toESM(require_dist2(), 1);
308296
309176
  var getDynamicValue = (value2) => {
308297
309177
  if (value2 === void 0) {
308298
309178
  return "undefined";
@@ -308319,7 +309199,7 @@ function toCodeEventFlow(stepDefs_) {
308319
309199
  }
308320
309200
  let code = `SbEventFlow`;
308321
309201
  for (const stepDef_ of stepDefs_) {
308322
- if (!(0, import_shared22.isValidStepDef)(stepDef_))
309202
+ if (!(0, import_shared23.isValidStepDef)(stepDef_))
308323
309203
  continue;
308324
309204
  const stepDef = stepDef_;
308325
309205
  switch (stepDef.type) {
@@ -308352,7 +309232,7 @@ function toCodeEventFlow(stepDefs_) {
308352
309232
  }
308353
309233
  case TriggerStepType.NAVIGATE_TO: {
308354
309234
  const url3 = stepDef.url;
308355
- if ((0, import_shared22.containsBindingsAnywhere)(url3)) {
309235
+ if ((0, import_shared23.containsBindingsAnywhere)(url3)) {
308356
309236
  code = `${code}.navigateTo({
308357
309237
  url: SB\`${url3}\`,
308358
309238
  })`;
@@ -308364,14 +309244,14 @@ function toCodeEventFlow(stepDefs_) {
308364
309244
  break;
308365
309245
  }
308366
309246
  case TriggerStepType.SET_STATE_VAR: {
308367
- const variableName = stepDef.state?.name !== void 0 ? `${stepDef.state?.scope === import_shared22.ApplicationScope.APP ? "App." : ""}${stepDef.state.name}` : "undefined";
309247
+ const variableName = stepDef.state?.name !== void 0 ? `${stepDef.state?.scope === import_shared23.ApplicationScope.APP ? "App." : ""}${stepDef.state.name}` : "undefined";
308368
309248
  const value2 = stepDef.value;
308369
309249
  const valueToCode = getDynamicValue(value2);
308370
309250
  code = `${code}.setStateVar(${variableName}, ${valueToCode})`;
308371
309251
  break;
308372
309252
  }
308373
309253
  case TriggerStepType.RESET_STATE_VAR: {
308374
- const variableName = stepDef.state?.name !== void 0 ? `${stepDef.state?.scope === import_shared22.ApplicationScope.APP ? "App." : ""}${stepDef.state.name}` : "undefined";
309254
+ const variableName = stepDef.state?.name !== void 0 ? `${stepDef.state?.scope === import_shared23.ApplicationScope.APP ? "App." : ""}${stepDef.state.name}` : "undefined";
308375
309255
  code = `${code}.resetStateVar(${variableName})`;
308376
309256
  break;
308377
309257
  }
@@ -308397,7 +309277,7 @@ function toCodeEventFlow(stepDefs_) {
308397
309277
  // ../../../vite-plugin-file-sync/dist/parsing/events/to-value-events.js
308398
309278
  init_cjs_shims();
308399
309279
  var import_types9 = __toESM(require_lib7(), 1);
308400
- var import_shared23 = __toESM(require_dist2(), 1);
309280
+ var import_shared24 = __toESM(require_dist2(), 1);
308401
309281
  var getApiCallbackNode = (nodePath) => {
308402
309282
  if (nodePath && (0, import_types9.isCallExpression)(nodePath.node) && (0, import_types9.isMemberExpression)(nodePath.node.callee) && (0, import_types9.isIdentifier)(nodePath.node.callee.object) && nodePath.node.callee.object.name === "SbEventFlow") {
308403
309283
  return toValueEventFlow(nodePath);
@@ -308459,7 +309339,7 @@ function toValueEventFlow(nodePath, existingSteps = [], parentId) {
308459
309339
  ...existingSteps,
308460
309340
  {
308461
309341
  id: id2,
308462
- type: import_shared23.TriggerStepType.RUN_JS,
309342
+ type: import_shared24.TriggerStepType.RUN_JS,
308463
309343
  code: expression.toString()
308464
309344
  }
308465
309345
  ];
@@ -308476,7 +309356,7 @@ function toValueEventFlow(nodePath, existingSteps = [], parentId) {
308476
309356
  ...existingSteps,
308477
309357
  {
308478
309358
  id: id2,
308479
- type: import_shared23.TriggerStepType.NAVIGATE_TO,
309359
+ type: import_shared24.TriggerStepType.NAVIGATE_TO,
308480
309360
  url: obj.url ?? "",
308481
309361
  newWindow: obj.newWindow ?? false,
308482
309362
  replaceHistory: obj.replaceHistory ?? false,
@@ -308497,7 +309377,7 @@ function toValueEventFlow(nodePath, existingSteps = [], parentId) {
308497
309377
  ...existingSteps,
308498
309378
  {
308499
309379
  id: id2,
308500
- type: import_shared23.TriggerStepType.RUN_APIS,
309380
+ type: import_shared24.TriggerStepType.RUN_APIS,
308501
309381
  apiNames: nodeToValue(expression.node),
308502
309382
  onSuccess,
308503
309383
  onError: onError2
@@ -308511,7 +309391,7 @@ function toValueEventFlow(nodePath, existingSteps = [], parentId) {
308511
309391
  const apiNames = nodeToValue(expression.node);
308512
309392
  return [
308513
309393
  ...existingSteps,
308514
- { id: id2, type: import_shared23.TriggerStepType.CANCEL_APIS, apiNames }
309394
+ { id: id2, type: import_shared24.TriggerStepType.CANCEL_APIS, apiNames }
308515
309395
  ];
308516
309396
  }
308517
309397
  case "setStateVar": {
@@ -308530,10 +309410,10 @@ function toValueEventFlow(nodePath, existingSteps = [], parentId) {
308530
309410
  ...existingSteps,
308531
309411
  {
308532
309412
  id: id2,
308533
- type: import_shared23.TriggerStepType.SET_STATE_VAR,
309413
+ type: import_shared24.TriggerStepType.SET_STATE_VAR,
308534
309414
  state: variableName ? {
308535
309415
  name: variableName,
308536
- scope: isAppScoped ? import_shared23.ApplicationScope.APP : import_shared23.ApplicationScope.PAGE
309416
+ scope: isAppScoped ? import_shared24.ApplicationScope.APP : import_shared24.ApplicationScope.PAGE
308537
309417
  } : void 0,
308538
309418
  value: value2
308539
309419
  }
@@ -308553,10 +309433,10 @@ function toValueEventFlow(nodePath, existingSteps = [], parentId) {
308553
309433
  ...existingSteps,
308554
309434
  {
308555
309435
  id: id2,
308556
- type: import_shared23.TriggerStepType.RESET_STATE_VAR,
309436
+ type: import_shared24.TriggerStepType.RESET_STATE_VAR,
308557
309437
  state: variableName ? {
308558
309438
  name: variableName,
308559
- scope: isAppScoped ? import_shared23.ApplicationScope.APP : import_shared23.ApplicationScope.PAGE
309439
+ scope: isAppScoped ? import_shared24.ApplicationScope.APP : import_shared24.ApplicationScope.PAGE
308560
309440
  } : void 0
308561
309441
  }
308562
309442
  ];
@@ -308574,7 +309454,7 @@ function toValueEventFlow(nodePath, existingSteps = [], parentId) {
308574
309454
  ...existingSteps,
308575
309455
  {
308576
309456
  id: id2,
308577
- type: import_shared23.TriggerStepType.CONTROL_MODAL,
309457
+ type: import_shared24.TriggerStepType.CONTROL_MODAL,
308578
309458
  name: name18,
308579
309459
  direction
308580
309460
  }
@@ -308589,7 +309469,7 @@ function toValueEventFlow(nodePath, existingSteps = [], parentId) {
308589
309469
  ...existingSteps,
308590
309470
  {
308591
309471
  id: id2,
308592
- type: import_shared23.TriggerStepType.SHOW_ALERT,
309472
+ type: import_shared24.TriggerStepType.SHOW_ALERT,
308593
309473
  message,
308594
309474
  style: type2,
308595
309475
  alertDuration: duration,
@@ -308746,43 +309626,43 @@ function makeJSXAttribute(key2, value2) {
308746
309626
  function tagNameToWidgetType(tagName) {
308747
309627
  switch (tagName) {
308748
309628
  case "SbPage":
308749
- return import_shared24.WidgetTypes.PAGE_WIDGET;
309629
+ return import_shared25.WidgetTypes.PAGE_WIDGET;
308750
309630
  case "SbText":
308751
- return import_shared24.WidgetTypes.TEXT_WIDGET;
309631
+ return import_shared25.WidgetTypes.TEXT_WIDGET;
308752
309632
  case "SbButton":
308753
- return import_shared24.WidgetTypes.BUTTON_WIDGET;
309633
+ return import_shared25.WidgetTypes.BUTTON_WIDGET;
308754
309634
  case "SbInput":
308755
- return import_shared24.WidgetTypes.INPUT_WIDGET;
309635
+ return import_shared25.WidgetTypes.INPUT_WIDGET;
308756
309636
  case "SbModal":
308757
- return import_shared24.WidgetTypes.MODAL_WIDGET;
309637
+ return import_shared25.WidgetTypes.MODAL_WIDGET;
308758
309638
  case "SbSlideout":
308759
- return import_shared24.WidgetTypes.SLIDEOUT_WIDGET;
309639
+ return import_shared25.WidgetTypes.SLIDEOUT_WIDGET;
308760
309640
  case "SbKeyValue":
308761
- return import_shared24.WidgetTypes.KEY_VALUE_WIDGET;
309641
+ return import_shared25.WidgetTypes.KEY_VALUE_WIDGET;
308762
309642
  case "SbContainer":
308763
- return import_shared24.WidgetTypes.CONTAINER_WIDGET;
309643
+ return import_shared25.WidgetTypes.CONTAINER_WIDGET;
308764
309644
  case "SbColumn":
308765
- return import_shared24.WidgetTypes.CANVAS_WIDGET;
309645
+ return import_shared25.WidgetTypes.CANVAS_WIDGET;
308766
309646
  case "SbSection":
308767
- return import_shared24.WidgetTypes.SECTION_WIDGET;
309647
+ return import_shared25.WidgetTypes.SECTION_WIDGET;
308768
309648
  case "SbCheckbox":
308769
- return import_shared24.WidgetTypes.CHECKBOX_WIDGET;
309649
+ return import_shared25.WidgetTypes.CHECKBOX_WIDGET;
308770
309650
  case "SbCustom":
308771
- return import_shared24.WidgetTypes.CUSTOM_WIDGET;
309651
+ return import_shared25.WidgetTypes.CUSTOM_WIDGET;
308772
309652
  case "SbDatePicker":
308773
- return import_shared24.WidgetTypes.DATE_PICKER_WIDGET;
309653
+ return import_shared25.WidgetTypes.DATE_PICKER_WIDGET;
308774
309654
  case "SbTable":
308775
- return import_shared24.WidgetTypes.TABLE_WIDGET;
309655
+ return import_shared25.WidgetTypes.TABLE_WIDGET;
308776
309656
  case "SbImage":
308777
- return import_shared24.WidgetTypes.IMAGE_WIDGET;
309657
+ return import_shared25.WidgetTypes.IMAGE_WIDGET;
308778
309658
  case "SbDropdown":
308779
- return import_shared24.WidgetTypes.DROP_DOWN_WIDGET;
309659
+ return import_shared25.WidgetTypes.DROP_DOWN_WIDGET;
308780
309660
  case "SbSwitch":
308781
- return import_shared24.WidgetTypes.SWITCH_WIDGET;
309661
+ return import_shared25.WidgetTypes.SWITCH_WIDGET;
308782
309662
  case "SbIcon":
308783
- return import_shared24.WidgetTypes.ICON_WIDGET;
309663
+ return import_shared25.WidgetTypes.ICON_WIDGET;
308784
309664
  default:
308785
- return import_shared24.WidgetTypes.CUSTOM_WIDGET;
309665
+ return import_shared25.WidgetTypes.CUSTOM_WIDGET;
308786
309666
  }
308787
309667
  }
308788
309668
  function getProperties(element) {
@@ -309278,10 +310158,26 @@ function getPropertyExpression(info, fieldName = "") {
309278
310158
  }
309279
310159
  }
309280
310160
  if (Array.isArray(value2)) {
309281
- return import_types12.default.arrayExpression(value2.map((v) => isPropertyInfo(v) ? getPropertyExpression(v, fieldName) : (0, import_types12.valueToNode)(v)));
310161
+ const arrayElements = value2.map((v) => {
310162
+ const propertyInfo = isPropertyInfo(v) ? v : Property.Any(v);
310163
+ return getPropertyExpression(propertyInfo, fieldName);
310164
+ });
310165
+ return import_types12.default.arrayExpression(arrayElements);
309282
310166
  }
309283
310167
  if (typeof value2 === "object" && value2 !== null) {
309284
- return import_types12.default.objectExpression(Object.entries(value2).map(([key2, value3]) => import_types12.default.objectProperty(import_types12.default.stringLiteral(key2), isPropertyInfo(value3) ? getPropertyExpression(value3, fieldName) : (0, import_types12.valueToNode)(value3))));
310168
+ return import_types12.default.objectExpression(Object.entries(value2).map(([key2, value3]) => {
310169
+ let objectValue;
310170
+ if (isPropertyInfo(value3)) {
310171
+ objectValue = getPropertyExpression(value3, key2);
310172
+ } else if (Array.isArray(value3)) {
310173
+ objectValue = getPropertyExpression(Property.Any(value3), key2);
310174
+ } else if (typeof value3 === "object" && value3 !== null) {
310175
+ objectValue = getPropertyExpression(Property.Any(value3), key2);
310176
+ } else {
310177
+ objectValue = (0, import_types12.valueToNode)(value3);
310178
+ }
310179
+ return import_types12.default.objectProperty(createObjectKey(key2), objectValue);
310180
+ }));
309285
310181
  }
309286
310182
  if (typeof value2 === "number") {
309287
310183
  return import_types12.default.numericLiteral(value2);
@@ -309534,10 +310430,10 @@ init_cjs_shims();
309534
310430
 
309535
310431
  // ../../../vite-plugin-file-sync/dist/parsing/entity/to-code-entity.js
309536
310432
  init_cjs_shims();
309537
- var import_shared25 = __toESM(require_dist2(), 1);
310433
+ var import_shared26 = __toESM(require_dist2(), 1);
309538
310434
  var toCodeProperty = (value2) => {
309539
310435
  if (typeof value2 === "string") {
309540
- if ((0, import_shared25.containsBindingsAnywhere)(value2)) {
310436
+ if ((0, import_shared26.containsBindingsAnywhere)(value2)) {
309541
310437
  return `SB\`${value2}\``;
309542
310438
  }
309543
310439
  return `"${value2}"`;
@@ -309556,7 +310452,7 @@ function toCodeEntity(entity) {
309556
310452
  case SbEntityType.VARIABLE:
309557
310453
  return `SbVariable({
309558
310454
  defaultValue: ${toCodeProperty(entity.defaultValue)},
309559
- persistence: ${entity.persistence === import_shared11.AppStateVarPersistence6.LOCAL_STORAGE ? "SbVariablePersistence.LOCAL_STORAGE" : "SbVariablePersistence.TEMPORARY"}
310455
+ persistence: ${entity.persistence === import_shared12.AppStateVarPersistence6.LOCAL_STORAGE ? "SbVariablePersistence.LOCAL_STORAGE" : "SbVariablePersistence.TEMPORARY"}
309560
310456
  })`;
309561
310457
  case SbEntityType.API:
309562
310458
  return `SbApi({
@@ -309637,7 +310533,7 @@ function toValueEntity(nodePath, { key: key2, id: id2 }) {
309637
310533
  type: SbEntityType.VARIABLE,
309638
310534
  name: key2,
309639
310535
  defaultValue: args.defaultValue ?? Property.Static(""),
309640
- persistence: args.persistence ?? Property.Expression(import_shared11.AppStateVarPersistence6.TEMPORARY),
310536
+ persistence: args.persistence ?? Property.Expression(import_shared12.AppStateVarPersistence6.TEMPORARY),
309641
310537
  value: args.defaultValue ?? Property.Static(""),
309642
310538
  id: id2
309643
310539
  };
@@ -310221,7 +311117,7 @@ var import_types19 = __toESM(require_lib7(), 1);
310221
311117
 
310222
311118
  // ../../../vite-plugin-file-sync/dist/refactor/blocks.js
310223
311119
  init_cjs_shims();
310224
- var import_shared26 = __toESM(require_dist2(), 1);
311120
+ var import_shared27 = __toESM(require_dist2(), 1);
310225
311121
  var import_esprima2 = __toESM(require_esprima(), 1);
310226
311122
  init_lodash();
310227
311123
  function flattenBlocks(blocks) {
@@ -310229,19 +311125,19 @@ function flattenBlocks(blocks) {
310229
311125
  return [];
310230
311126
  }
310231
311127
  return blocks.flatMap((block) => {
310232
- const localBlock = (0, import_shared26.convertBlock)(block);
311128
+ const localBlock = (0, import_shared27.convertBlock)(block);
310233
311129
  if (!localBlock) {
310234
311130
  return null;
310235
311131
  }
310236
- if ((0, import_shared26.isStepBlock)(localBlock)) {
311132
+ if ((0, import_shared27.isStepBlock)(localBlock)) {
310237
311133
  return localBlock;
310238
- } else if ((0, import_shared26.isControlBlock)(localBlock)) {
311134
+ } else if ((0, import_shared27.isControlBlock)(localBlock)) {
310239
311135
  switch (localBlock.type) {
310240
- case import_shared26.BlockType.PARALLEL: {
311136
+ case import_shared27.BlockType.PARALLEL: {
310241
311137
  const config2 = localBlock.config;
310242
311138
  return flattenBlocks(config2.dynamic?.blocks);
310243
311139
  }
310244
- case import_shared26.BlockType.CONDITION: {
311140
+ case import_shared27.BlockType.CONDITION: {
310245
311141
  const config2 = localBlock.config;
310246
311142
  const blocks2 = [
310247
311143
  ...flattenBlocks(config2.if?.blocks),
@@ -310250,7 +311146,7 @@ function flattenBlocks(blocks) {
310250
311146
  ];
310251
311147
  if (config2.if?.condition) {
310252
311148
  blocks2.push({
310253
- type: import_shared26.BlockType.CONDITION,
311149
+ type: import_shared27.BlockType.CONDITION,
310254
311150
  config: {
310255
311151
  if: config2.if
310256
311152
  }
@@ -310258,7 +311154,7 @@ function flattenBlocks(blocks) {
310258
311154
  }
310259
311155
  if (config2.elseIf?.length) {
310260
311156
  blocks2.push({
310261
- type: import_shared26.BlockType.CONDITION,
311157
+ type: import_shared27.BlockType.CONDITION,
310262
311158
  config: {
310263
311159
  elseIf: config2.elseIf
310264
311160
  }
@@ -310266,11 +311162,11 @@ function flattenBlocks(blocks) {
310266
311162
  }
310267
311163
  return blocks2;
310268
311164
  }
310269
- case import_shared26.BlockType.LOOP: {
311165
+ case import_shared27.BlockType.LOOP: {
310270
311166
  const config2 = localBlock.config;
310271
311167
  return flattenBlocks(config2.blocks);
310272
311168
  }
310273
- case import_shared26.BlockType.TRY_CATCH: {
311169
+ case import_shared27.BlockType.TRY_CATCH: {
310274
311170
  const config2 = localBlock.config;
310275
311171
  return [
310276
311172
  ...flattenBlocks(config2.try?.blocks),
@@ -310278,7 +311174,7 @@ function flattenBlocks(blocks) {
310278
311174
  ...flattenBlocks(config2.finally?.blocks)
310279
311175
  ];
310280
311176
  }
310281
- case import_shared26.BlockType.STREAM: {
311177
+ case import_shared27.BlockType.STREAM: {
310282
311178
  const config2 = localBlock.config;
310283
311179
  return flattenBlocks(config2.process?.blocks);
310284
311180
  }
@@ -310289,19 +311185,19 @@ function flattenBlocks(blocks) {
310289
311185
  }).filter(Boolean);
310290
311186
  }
310291
311187
  var extractPythonEvaluationPairs2 = async (code, entities, dataTree, namespacedEntitiesToExtract) => {
310292
- return (0, import_shared26.extractPythonEvaluationPairsWithParser)(code, entities, dataTree, parser, namespacedEntitiesToExtract);
311188
+ return (0, import_shared27.extractPythonEvaluationPairsWithParser)(code, entities, dataTree, parser, namespacedEntitiesToExtract);
310293
311189
  };
310294
311190
  var extractJsEvaluationPairs2 = async (jsSnippet, entitiesToExtract, dataTree, namespacedEntitiesToExtract) => {
310295
- return (0, import_shared26.extractJsEvaluationPairsWithTokenizer)(jsSnippet, entitiesToExtract, dataTree, import_esprima2.tokenize, namespacedEntitiesToExtract);
311191
+ return (0, import_shared27.extractJsEvaluationPairsWithTokenizer)(jsSnippet, entitiesToExtract, dataTree, import_esprima2.tokenize, namespacedEntitiesToExtract);
310296
311192
  };
310297
311193
  function getExtractorByPluginId(pluginId) {
310298
311194
  if (!pluginId) {
310299
311195
  return extractJsEvaluationPairs2;
310300
311196
  }
310301
311197
  switch (pluginId.trim().toLowerCase()) {
310302
- case import_shared26.LanguagePluginID.Python:
311198
+ case import_shared27.LanguagePluginID.Python:
310303
311199
  return extractPythonEvaluationPairs2;
310304
- case import_shared26.LanguagePluginID.JavaScript:
311200
+ case import_shared27.LanguagePluginID.JavaScript:
310305
311201
  default:
310306
311202
  return extractJsEvaluationPairs2;
310307
311203
  }
@@ -310310,14 +311206,14 @@ async function refactorNameInBlocks(params) {
310310
311206
  const { blocks, oldName, newName, namespace } = params;
310311
311207
  const flattenedBlocks = flattenBlocks(blocks);
310312
311208
  for (const block of flattenedBlocks) {
310313
- const pluginType = (0, import_shared26.getPluginType)(block) ?? void 0;
311209
+ const pluginType = (0, import_shared27.getPluginType)(block) ?? void 0;
310314
311210
  const extractor = getExtractorByPluginId(pluginType);
310315
- if ((0, import_shared26.isStepBlock)(block) && pluginType) {
311211
+ if ((0, import_shared27.isStepBlock)(block) && pluginType) {
310316
311212
  const configuration = block.config[pluginType];
310317
311213
  if (typeof configuration !== "object" || configuration == null) {
310318
311214
  continue;
310319
311215
  }
310320
- await (0, import_shared26.refactorNameInStep)({
311216
+ await (0, import_shared27.refactorNameInStep)({
310321
311217
  ...params,
310322
311218
  dataTree: {
310323
311219
  [newName]: {},
@@ -310327,9 +311223,9 @@ async function refactorNameInBlocks(params) {
310327
311223
  configuration,
310328
311224
  extractor
310329
311225
  });
310330
- } else if ((0, import_shared26.isControlBlock)(block)) {
311226
+ } else if ((0, import_shared27.isControlBlock)(block)) {
310331
311227
  for (const [value2, setValue] of getSetControlBlockExpressions2(block)) {
310332
- const newValue = await (0, import_shared26.refactorNameInString)({
311228
+ const newValue = await (0, import_shared27.refactorNameInString)({
310333
311229
  value: value2,
310334
311230
  oldName,
310335
311231
  newName,
@@ -310359,34 +311255,34 @@ function getSetControlBlockExpressions2(block) {
310359
311255
  const { config: config2, type: type2 } = block;
310360
311256
  const results = [];
310361
311257
  switch (type2) {
310362
- case import_shared26.BlockType.BREAK: {
311258
+ case import_shared27.BlockType.BREAK: {
310363
311259
  const controlConfig = config2;
310364
311260
  results.push(makeGetSet2(controlConfig, "condition"));
310365
311261
  break;
310366
311262
  }
310367
- case import_shared26.BlockType.THROW: {
311263
+ case import_shared27.BlockType.THROW: {
310368
311264
  const controlConfig = config2;
310369
311265
  results.push(makeGetSet2(controlConfig, "error"));
310370
311266
  break;
310371
311267
  }
310372
- case import_shared26.BlockType.RETURN: {
311268
+ case import_shared27.BlockType.RETURN: {
310373
311269
  const controlConfig = config2;
310374
311270
  results.push(makeGetSet2(controlConfig, "data"));
310375
311271
  break;
310376
311272
  }
310377
- case import_shared26.BlockType.WAIT: {
311273
+ case import_shared27.BlockType.WAIT: {
310378
311274
  const controlConfig = config2;
310379
311275
  results.push(makeGetSet2(controlConfig, "condition"));
310380
311276
  break;
310381
311277
  }
310382
- case import_shared26.BlockType.PARALLEL: {
311278
+ case import_shared27.BlockType.PARALLEL: {
310383
311279
  const controlConfig = config2;
310384
311280
  if (controlConfig.dynamic) {
310385
311281
  results.push(makeGetSet2(controlConfig.dynamic, "paths"));
310386
311282
  }
310387
311283
  break;
310388
311284
  }
310389
- case import_shared26.BlockType.CONDITION: {
311285
+ case import_shared27.BlockType.CONDITION: {
310390
311286
  const controlConfig = config2;
310391
311287
  if (controlConfig.if) {
310392
311288
  results.push(makeGetSet2(controlConfig.if, "condition"));
@@ -310396,15 +311292,15 @@ function getSetControlBlockExpressions2(block) {
310396
311292
  }
310397
311293
  break;
310398
311294
  }
310399
- case import_shared26.BlockType.LOOP: {
311295
+ case import_shared27.BlockType.LOOP: {
310400
311296
  const controlConfig = config2;
310401
311297
  results.push(makeGetSet2(controlConfig, "range"));
310402
311298
  break;
310403
311299
  }
310404
- case import_shared26.BlockType.TRY_CATCH: {
311300
+ case import_shared27.BlockType.TRY_CATCH: {
310405
311301
  break;
310406
311302
  }
310407
- case import_shared26.BlockType.VARIABLES: {
311303
+ case import_shared27.BlockType.VARIABLES: {
310408
311304
  const controlConfig = config2;
310409
311305
  for (const variable of controlConfig.items) {
310410
311306
  if (variable.value) {
@@ -310413,12 +311309,12 @@ function getSetControlBlockExpressions2(block) {
310413
311309
  }
310414
311310
  break;
310415
311311
  }
310416
- case import_shared26.BlockType.SEND: {
311312
+ case import_shared27.BlockType.SEND: {
310417
311313
  const controlConfig = config2;
310418
311314
  results.push(makeGetSet2(controlConfig, "message"));
310419
311315
  break;
310420
311316
  }
310421
- case import_shared26.BlockType.STREAM: {
311317
+ case import_shared27.BlockType.STREAM: {
310422
311318
  break;
310423
311319
  }
310424
311320
  default: {
@@ -310432,7 +311328,7 @@ function getSetControlBlockExpressions2(block) {
310432
311328
  // ../../../vite-plugin-file-sync/dist/refactor/javascript.js
310433
311329
  init_cjs_shims();
310434
311330
  var import_types18 = __toESM(require_lib7(), 1);
310435
- var import_shared27 = __toESM(require_dist2(), 1);
311331
+ var import_shared28 = __toESM(require_dist2(), 1);
310436
311332
  function renameEntityInJavascript({ oldName, newName, nodePath, parentBinding, checkFunctionBinding = false }) {
310437
311333
  const functionVisitor = checkFunctionBinding ? {
310438
311334
  Function(path51) {
@@ -310558,6 +311454,13 @@ function renameEntityInJavascript({ oldName, newName, nodePath, parentBinding, c
310558
311454
  },
310559
311455
  MemberExpression(path51) {
310560
311456
  handleMemberExpression(path51);
311457
+ },
311458
+ Identifier(path51) {
311459
+ if (path51.parentPath.isArrayExpression()) {
311460
+ if (path51.node.name === oldName) {
311461
+ path51.replaceInline(import_types18.default.identifier(newName));
311462
+ }
311463
+ }
310561
311464
  }
310562
311465
  });
310563
311466
  }
@@ -310658,6 +311561,17 @@ var RenameManager = class {
310658
311561
  checkFunctionBinding: true,
310659
311562
  parentBinding
310660
311563
  });
311564
+ },
311565
+ ArrayExpression(path51) {
311566
+ if (import_types19.default.isCallExpression(path51.parentPath.node)) {
311567
+ renameEntityInJavascript({
311568
+ oldName,
311569
+ newName,
311570
+ nodePath: path51,
311571
+ checkFunctionBinding: true,
311572
+ parentBinding
311573
+ });
311574
+ }
310661
311575
  }
310662
311576
  };
310663
311577
  traverseFn(ast, {
@@ -310666,7 +311580,7 @@ var RenameManager = class {
310666
311580
  path51.skip();
310667
311581
  },
310668
311582
  CallExpression(path51) {
310669
- if (path51.node.callee.type === "Identifier" && (path51.node.callee.name === "SbVariable" || path51.node.callee.name === "SbTimer" || path51.node.callee.name === "SbEventFlow")) {
311583
+ if (path51.node.callee.type === "Identifier" && (path51.node.callee.name === "SbVariable" || path51.node.callee.name === "SbTimer" || path51.node.callee.name === "SbEventFlow") || path51.node.callee.type === "MemberExpression" && path51.node.arguments.length > 0) {
310670
311584
  path51.traverse(elementVisitor);
310671
311585
  path51.skip();
310672
311586
  }
@@ -312296,7 +313210,7 @@ var FileSyncManager = class extends EventEmitter8 {
312296
313210
  "handleUpdateTheme",
312297
313211
  "handleRenameElement"
312298
313212
  ];
312299
- (0, import_shared28.addTracingToMethods)(this, methods, tracer2);
313213
+ (0, import_shared29.addTracingToMethods)(this, methods, tracer2);
312300
313214
  }
312301
313215
  get appFilePath() {
312302
313216
  if (!this.rootDir) {
@@ -312534,6 +313448,9 @@ var FileSyncManager = class extends EventEmitter8 {
312534
313448
  getTsFilePaths() {
312535
313449
  return Object.keys(this.tsFiles);
312536
313450
  }
313451
+ getSourceTracker() {
313452
+ return this.sourceTracker;
313453
+ }
312537
313454
  async writeFile(path51, content2, kind) {
312538
313455
  if (kind === "ts") {
312539
313456
  this.tsFiles[path51] = content2;
@@ -313438,7 +314355,7 @@ function generateRootSource(code, routes) {
313438
314355
 
313439
314356
  // ../../../vite-plugin-file-sync/dist/socket-manager.js
313440
314357
  init_cjs_shims();
313441
- var import_shared29 = __toESM(require_dist2(), 1);
314358
+ var import_shared30 = __toESM(require_dist2(), 1);
313442
314359
  import EventEmitter9 from "node:events";
313443
314360
 
313444
314361
  // ../../../../node_modules/.pnpm/ws@8.18.2/node_modules/ws/wrapper.mjs
@@ -313549,7 +314466,7 @@ var SocketManager = class extends EventEmitter9 {
313549
314466
  }
313550
314467
  });
313551
314468
  wss.on("connection", (ws, isEditor, peerId, userId) => {
313552
- const socket = (0, import_shared29.createISocketClient)(new import_shared29.TracedSocket(ws, withMethodTracing(tracer2, {
314469
+ const socket = (0, import_shared30.createISocketClient)(new import_shared30.TracedSocket(ws, withMethodTracing(tracer2, {
313553
314470
  editor: {
313554
314471
  // Update widgets
313555
314472
  setProperties: [fileSyncManager.handleSetProperties],
@@ -313744,6 +314661,9 @@ var fileSyncVitePlugin = (pluginParams, options8) => {
313744
314661
  }
313745
314662
  })
313746
314663
  ]);
314664
+ if (aiService) {
314665
+ aiService.setSourceTracker(fileSyncManager.getSourceTracker());
314666
+ }
313747
314667
  server.middlewares.use(indexHtmlMiddleware(server, fileSyncManager));
313748
314668
  server.middlewares.use("/sb-init", import_body_parser.default.json({ strict: true }));
313749
314669
  server.middlewares.use("/sb-init", async (req, res, next) => {
@@ -314303,7 +315223,7 @@ async function getAppScope(fileSyncManager) {
314303
315223
  pageId: apiPb.trigger.application?.pageId,
314304
315224
  organizationId: apiPb.metadata.organization,
314305
315225
  updated: apiPb.metadata?.timestamps?.updated ? new Date(apiPb.metadata?.timestamps?.updated) : void 0,
314306
- triggerType: import_shared30.ApiTriggerType.UI,
315226
+ triggerType: import_shared31.ApiTriggerType.UI,
314307
315227
  apiPb
314308
315228
  }));
314309
315229
  const appScope = {
@@ -314485,7 +315405,7 @@ async function buildWithVite({ root: root2, dest: dest4, mode, libraryUrl, asset
314485
315405
  // ../sdk/dist/client.js
314486
315406
  init_cjs_shims();
314487
315407
  var import_bucketeer_sdk = __toESM(require_dist5(), 1);
314488
- var import_shared32 = __toESM(require_dist2(), 1);
315408
+ var import_shared33 = __toESM(require_dist2(), 1);
314489
315409
  var import_util30 = __toESM(require_dist3(), 1);
314490
315410
  import * as fs16 from "node:fs";
314491
315411
  import path31 from "node:path";
@@ -317937,7 +318857,7 @@ var FeatureFlags = class {
317937
318857
 
317938
318858
  // ../sdk/dist/socket/index.js
317939
318859
  init_cjs_shims();
317940
- var import_shared31 = __toESM(require_dist2(), 1);
318860
+ var import_shared32 = __toESM(require_dist2(), 1);
317941
318861
 
317942
318862
  // ../sdk/dist/dev-utils/dev-tracer.js
317943
318863
  init_cjs_shims();
@@ -317954,7 +318874,7 @@ var import_util29 = __toESM(require_dist3(), 1);
317954
318874
  // ../sdk/package.json
317955
318875
  var package_default = {
317956
318876
  name: "@superblocksteam/sdk",
317957
- version: "2.0.0-next.70",
318877
+ version: "2.0.0-next.71",
317958
318878
  type: "module",
317959
318879
  description: "Superblocks JS SDK",
317960
318880
  homepage: "https://www.superblocks.com",
@@ -317996,8 +318916,8 @@ var package_default = {
317996
318916
  "@rollup/wasm-node": "^4.35.0",
317997
318917
  "@superblocksteam/bucketeer-sdk": "0.5.0",
317998
318918
  "@superblocksteam/shared": "0.9146.0",
317999
- "@superblocksteam/util": "2.0.0-next.70",
318000
- "@superblocksteam/vite-plugin-file-sync": "2.0.0-next.70",
318919
+ "@superblocksteam/util": "2.0.0-next.71",
318920
+ "@superblocksteam/vite-plugin-file-sync": "2.0.0-next.71",
318001
318921
  "@vitejs/plugin-react": "^4.3.4",
318002
318922
  axios: "^1.4.0",
318003
318923
  chokidar: "^4.0.3",
@@ -318390,7 +319310,7 @@ async function connectToISocketRPCServer2({ superblocksBaseUrl, agentUrl, token:
318390
319310
  } else if (wsUrl.hostname === "localhost") {
318391
319311
  wsUrl.hostname = "127.0.0.1";
318392
319312
  }
318393
- return await (0, import_shared31.connectISocket)(wsUrl.href, authorization, requestHandlers, [], dev_tracer_default, {
319313
+ return await (0, import_shared32.connectISocket)(wsUrl.href, authorization, requestHandlers, [], dev_tracer_default, {
318394
319314
  connectionTimeoutInSeconds: 6 * 60,
318395
319315
  // 6 minutes
318396
319316
  noResponseTimeoutInSeconds: 5 * 60
@@ -318413,7 +319333,7 @@ var ResourceType;
318413
319333
  ResourceType2["BACKEND"] = "BACKEND";
318414
319334
  })(ResourceType || (ResourceType = {}));
318415
319335
  async function fetchApplication({ cliVersion, applicationId, branch, token: token2, superblocksBaseUrl, viewMode, commitId, skipSigningVerification = false, injectedHeaders = {} }) {
318416
- if (commitId && viewMode !== import_shared32.ExportViewMode.EXPORT_COMMIT) {
319336
+ if (commitId && viewMode !== import_shared33.ExportViewMode.EXPORT_COMMIT) {
318417
319337
  throw new Error(`If commitId ${commitId} is provided, viewMode cannot be ${viewMode}`);
318418
319338
  }
318419
319339
  try {
@@ -319075,7 +319995,7 @@ function filesToFileDescriptors(files, appRoot) {
319075
319995
 
319076
319996
  // ../sdk/dist/sdk.js
319077
319997
  init_cjs_shims();
319078
- var import_shared34 = __toESM(require_dist2(), 1);
319998
+ var import_shared35 = __toESM(require_dist2(), 1);
319079
319999
 
319080
320000
  // ../sdk/dist/dbfs/client.js
319081
320001
  init_cjs_shims();
@@ -319083,7 +320003,7 @@ var import_util32 = __toESM(require_dist3(), 1);
319083
320003
 
319084
320004
  // ../sdk/dist/dbfs/local.js
319085
320005
  init_cjs_shims();
319086
- var import_shared33 = __toESM(require_dist2(), 1);
320006
+ var import_shared34 = __toESM(require_dist2(), 1);
319087
320007
  var import_util31 = __toESM(require_dist3(), 1);
319088
320008
  import * as fsp4 from "node:fs/promises";
319089
320009
  async function doDownloadDirectoryToLocal(rpcClient, directoryHash, localDirectoryPath) {
@@ -319128,7 +320048,7 @@ async function hashLocalDirectory2(localDirectoryPath) {
319128
320048
  let entry;
319129
320049
  switch (localDirEntry.type) {
319130
320050
  case "-": {
319131
- const hash3 = await (0, import_shared33.hashFileContents)(localDirEntry.contents);
320051
+ const hash3 = await (0, import_shared34.hashFileContents)(localDirEntry.contents);
319132
320052
  entry = {
319133
320053
  type: "-",
319134
320054
  executable: localDirEntry.executable,
@@ -319160,7 +320080,7 @@ async function hashLocalDirectory2(localDirectoryPath) {
319160
320080
  }
319161
320081
  directoryContents.push(entry);
319162
320082
  }
319163
- const hash2 = await (0, import_shared33.hashDirectoryContents)(directoryContents);
320083
+ const hash2 = await (0, import_shared34.hashDirectoryContents)(directoryContents);
319164
320084
  return { contents: directoryContents, hash: hash2 };
319165
320085
  }
319166
320086
  async function doUploadLocalDirectory(rpcClient, localDirectoryPath) {
@@ -319320,7 +320240,7 @@ var SuperblocksSdk = class {
319320
320240
  getFeatureFlagsForUser(user) {
319321
320241
  return new FeatureFlags(user.flagBootstrap);
319322
320242
  }
319323
- async fetchApplication({ applicationId, branch, headers = {}, viewMode = import_shared34.ExportViewMode.EXPORT_LIVE, skipSigningVerification = false }) {
320243
+ async fetchApplication({ applicationId, branch, headers = {}, viewMode = import_shared35.ExportViewMode.EXPORT_LIVE, skipSigningVerification = false }) {
319324
320244
  return fetchApplication({
319325
320245
  cliVersion: this.cliVersion,
319326
320246
  applicationId,
@@ -319341,7 +320261,7 @@ var SuperblocksSdk = class {
319341
320261
  injectedHeaders: headers
319342
320262
  });
319343
320263
  }
319344
- async fetchApplicationWithComponents({ applicationId, branch, headers = {}, viewMode = import_shared34.ExportViewMode.EXPORT_LIVE, commitId, skipSigningVerification = false }) {
320264
+ async fetchApplicationWithComponents({ applicationId, branch, headers = {}, viewMode = import_shared35.ExportViewMode.EXPORT_LIVE, commitId, skipSigningVerification = false }) {
319345
320265
  return fetchApplicationWithComponents({
319346
320266
  cliVersion: this.cliVersion,
319347
320267
  applicationId,
@@ -319381,7 +320301,7 @@ var SuperblocksSdk = class {
319381
320301
  async fetchApplications(headers) {
319382
320302
  return fetchApplications(this.cliVersion, this.token, this.superblocksBaseUrl, headers);
319383
320303
  }
319384
- async fetchApi({ apiId, branch, viewMode = import_shared34.ExportViewMode.EXPORT_LIVE, commitId, skipSigningVerification = false }) {
320304
+ async fetchApi({ apiId, branch, viewMode = import_shared35.ExportViewMode.EXPORT_LIVE, commitId, skipSigningVerification = false }) {
319385
320305
  return fetchApi(this.cliVersion, apiId, this.token, this.superblocksBaseUrl, viewMode, branch, commitId, skipSigningVerification);
319386
320306
  }
319387
320307
  async fetchApis() {
@@ -319457,7 +320377,7 @@ var SuperblocksSdk = class {
319457
320377
 
319458
320378
  // ../sdk/dist/version-control.mjs
319459
320379
  init_cjs_shims();
319460
- var import_shared35 = __toESM(require_dist2(), 1);
320380
+ var import_shared36 = __toESM(require_dist2(), 1);
319461
320381
  var import_util33 = __toESM(require_dist3(), 1);
319462
320382
  import * as https2 from "https";
319463
320383
  import path33 from "node:path";
@@ -324038,11 +324958,11 @@ var FileStructureType;
324038
324958
  function modeFlagToViewMode(modeFlag) {
324039
324959
  switch (modeFlag) {
324040
324960
  case LATEST_EDITS_MODE:
324041
- return import_shared35.ExportViewMode.EXPORT_LIVE;
324961
+ return import_shared36.ExportViewMode.EXPORT_LIVE;
324042
324962
  case MOST_RECENT_COMMIT_MODE:
324043
- return import_shared35.ExportViewMode.EXPORT_LATEST;
324963
+ return import_shared36.ExportViewMode.EXPORT_LATEST;
324044
324964
  case DEPLOYED_MODE:
324045
- return import_shared35.ExportViewMode.EXPORT_DEPLOYED;
324965
+ return import_shared36.ExportViewMode.EXPORT_DEPLOYED;
324046
324966
  default:
324047
324967
  throw new Error(`Unsupported mode flag: ${modeFlag}`);
324048
324968
  }
@@ -324940,7 +325860,7 @@ async function startVite({ app, httpServer: httpServer2, root: root2, mode, port
324940
325860
  };
324941
325861
  const isCustomBuildEnabled2 = await isCustomComponentsEnabled();
324942
325862
  const customFolder = path34.join(root2, "custom");
324943
- const cdnUrl = "https://assets-cdn.superblocks.com/library/2.0.0-next.70";
325863
+ const cdnUrl = "https://assets-cdn.superblocks.com/library/2.0.0-next.71";
324944
325864
  const env3 = loadEnv(mode, root2, "");
324945
325865
  const hmrPort = await getFreePort();
324946
325866
  const hmrOptions = {
@@ -325052,331 +325972,6 @@ import * as child_process2 from "node:child_process";
325052
325972
  import * as fsp5 from "node:fs/promises";
325053
325973
  import { promisify as promisify2 } from "node:util";
325054
325974
 
325055
- // ../../../../node_modules/.pnpm/diff@8.0.2/node_modules/diff/libesm/index.js
325056
- init_cjs_shims();
325057
-
325058
- // ../../../../node_modules/.pnpm/diff@8.0.2/node_modules/diff/libesm/diff/base.js
325059
- init_cjs_shims();
325060
- var Diff2 = class {
325061
- diff(oldStr, newStr, options8 = {}) {
325062
- let callback;
325063
- if (typeof options8 === "function") {
325064
- callback = options8;
325065
- options8 = {};
325066
- } else if ("callback" in options8) {
325067
- callback = options8.callback;
325068
- }
325069
- const oldString = this.castInput(oldStr, options8);
325070
- const newString = this.castInput(newStr, options8);
325071
- const oldTokens = this.removeEmpty(this.tokenize(oldString, options8));
325072
- const newTokens = this.removeEmpty(this.tokenize(newString, options8));
325073
- return this.diffWithOptionsObj(oldTokens, newTokens, options8, callback);
325074
- }
325075
- diffWithOptionsObj(oldTokens, newTokens, options8, callback) {
325076
- var _a18;
325077
- const done = (value2) => {
325078
- value2 = this.postProcess(value2, options8);
325079
- if (callback) {
325080
- setTimeout(function() {
325081
- callback(value2);
325082
- }, 0);
325083
- return void 0;
325084
- } else {
325085
- return value2;
325086
- }
325087
- };
325088
- const newLen = newTokens.length, oldLen = oldTokens.length;
325089
- let editLength = 1;
325090
- let maxEditLength = newLen + oldLen;
325091
- if (options8.maxEditLength != null) {
325092
- maxEditLength = Math.min(maxEditLength, options8.maxEditLength);
325093
- }
325094
- const maxExecutionTime = (_a18 = options8.timeout) !== null && _a18 !== void 0 ? _a18 : Infinity;
325095
- const abortAfterTimestamp = Date.now() + maxExecutionTime;
325096
- const bestPath = [{ oldPos: -1, lastComponent: void 0 }];
325097
- let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options8);
325098
- if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
325099
- return done(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
325100
- }
325101
- let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
325102
- const execEditLength = () => {
325103
- for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
325104
- let basePath;
325105
- const removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
325106
- if (removePath) {
325107
- bestPath[diagonalPath - 1] = void 0;
325108
- }
325109
- let canAdd = false;
325110
- if (addPath) {
325111
- const addPathNewPos = addPath.oldPos - diagonalPath;
325112
- canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
325113
- }
325114
- const canRemove = removePath && removePath.oldPos + 1 < oldLen;
325115
- if (!canAdd && !canRemove) {
325116
- bestPath[diagonalPath] = void 0;
325117
- continue;
325118
- }
325119
- if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
325120
- basePath = this.addToPath(addPath, true, false, 0, options8);
325121
- } else {
325122
- basePath = this.addToPath(removePath, false, true, 1, options8);
325123
- }
325124
- newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options8);
325125
- if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
325126
- return done(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
325127
- } else {
325128
- bestPath[diagonalPath] = basePath;
325129
- if (basePath.oldPos + 1 >= oldLen) {
325130
- maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
325131
- }
325132
- if (newPos + 1 >= newLen) {
325133
- minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
325134
- }
325135
- }
325136
- }
325137
- editLength++;
325138
- };
325139
- if (callback) {
325140
- (function exec8() {
325141
- setTimeout(function() {
325142
- if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
325143
- return callback(void 0);
325144
- }
325145
- if (!execEditLength()) {
325146
- exec8();
325147
- }
325148
- }, 0);
325149
- })();
325150
- } else {
325151
- while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
325152
- const ret = execEditLength();
325153
- if (ret) {
325154
- return ret;
325155
- }
325156
- }
325157
- }
325158
- }
325159
- addToPath(path51, added, removed, oldPosInc, options8) {
325160
- const last2 = path51.lastComponent;
325161
- if (last2 && !options8.oneChangePerToken && last2.added === added && last2.removed === removed) {
325162
- return {
325163
- oldPos: path51.oldPos + oldPosInc,
325164
- lastComponent: { count: last2.count + 1, added, removed, previousComponent: last2.previousComponent }
325165
- };
325166
- } else {
325167
- return {
325168
- oldPos: path51.oldPos + oldPosInc,
325169
- lastComponent: { count: 1, added, removed, previousComponent: last2 }
325170
- };
325171
- }
325172
- }
325173
- extractCommon(basePath, newTokens, oldTokens, diagonalPath, options8) {
325174
- const newLen = newTokens.length, oldLen = oldTokens.length;
325175
- let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
325176
- while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options8)) {
325177
- newPos++;
325178
- oldPos++;
325179
- commonCount++;
325180
- if (options8.oneChangePerToken) {
325181
- basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
325182
- }
325183
- }
325184
- if (commonCount && !options8.oneChangePerToken) {
325185
- basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
325186
- }
325187
- basePath.oldPos = oldPos;
325188
- return newPos;
325189
- }
325190
- equals(left, right, options8) {
325191
- if (options8.comparator) {
325192
- return options8.comparator(left, right);
325193
- } else {
325194
- return left === right || !!options8.ignoreCase && left.toLowerCase() === right.toLowerCase();
325195
- }
325196
- }
325197
- removeEmpty(array2) {
325198
- const ret = [];
325199
- for (let i2 = 0; i2 < array2.length; i2++) {
325200
- if (array2[i2]) {
325201
- ret.push(array2[i2]);
325202
- }
325203
- }
325204
- return ret;
325205
- }
325206
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
325207
- castInput(value2, options8) {
325208
- return value2;
325209
- }
325210
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
325211
- tokenize(value2, options8) {
325212
- return Array.from(value2);
325213
- }
325214
- join(chars) {
325215
- return chars.join("");
325216
- }
325217
- postProcess(changeObjects, options8) {
325218
- return changeObjects;
325219
- }
325220
- get useLongestToken() {
325221
- return false;
325222
- }
325223
- buildValues(lastComponent, newTokens, oldTokens) {
325224
- const components2 = [];
325225
- let nextComponent;
325226
- while (lastComponent) {
325227
- components2.push(lastComponent);
325228
- nextComponent = lastComponent.previousComponent;
325229
- delete lastComponent.previousComponent;
325230
- lastComponent = nextComponent;
325231
- }
325232
- components2.reverse();
325233
- const componentLen = components2.length;
325234
- let componentPos = 0, newPos = 0, oldPos = 0;
325235
- for (; componentPos < componentLen; componentPos++) {
325236
- const component = components2[componentPos];
325237
- if (!component.removed) {
325238
- if (!component.added && this.useLongestToken) {
325239
- let value2 = newTokens.slice(newPos, newPos + component.count);
325240
- value2 = value2.map(function(value3, i2) {
325241
- const oldValue = oldTokens[oldPos + i2];
325242
- return oldValue.length > value3.length ? oldValue : value3;
325243
- });
325244
- component.value = this.join(value2);
325245
- } else {
325246
- component.value = this.join(newTokens.slice(newPos, newPos + component.count));
325247
- }
325248
- newPos += component.count;
325249
- if (!component.added) {
325250
- oldPos += component.count;
325251
- }
325252
- } else {
325253
- component.value = this.join(oldTokens.slice(oldPos, oldPos + component.count));
325254
- oldPos += component.count;
325255
- }
325256
- }
325257
- return components2;
325258
- }
325259
- };
325260
-
325261
- // ../../../../node_modules/.pnpm/diff@8.0.2/node_modules/diff/libesm/diff/line.js
325262
- init_cjs_shims();
325263
- var LineDiff = class extends Diff2 {
325264
- constructor() {
325265
- super(...arguments);
325266
- this.tokenize = tokenize4;
325267
- }
325268
- equals(left, right, options8) {
325269
- if (options8.ignoreWhitespace) {
325270
- if (!options8.newlineIsToken || !left.includes("\n")) {
325271
- left = left.trim();
325272
- }
325273
- if (!options8.newlineIsToken || !right.includes("\n")) {
325274
- right = right.trim();
325275
- }
325276
- } else if (options8.ignoreNewlineAtEof && !options8.newlineIsToken) {
325277
- if (left.endsWith("\n")) {
325278
- left = left.slice(0, -1);
325279
- }
325280
- if (right.endsWith("\n")) {
325281
- right = right.slice(0, -1);
325282
- }
325283
- }
325284
- return super.equals(left, right, options8);
325285
- }
325286
- };
325287
- var lineDiff2 = new LineDiff();
325288
- function tokenize4(value2, options8) {
325289
- if (options8.stripTrailingCr) {
325290
- value2 = value2.replace(/\r\n/g, "\n");
325291
- }
325292
- const retLines = [], linesAndNewlines = value2.split(/(\n|\r\n)/);
325293
- if (!linesAndNewlines[linesAndNewlines.length - 1]) {
325294
- linesAndNewlines.pop();
325295
- }
325296
- for (let i2 = 0; i2 < linesAndNewlines.length; i2++) {
325297
- const line3 = linesAndNewlines[i2];
325298
- if (i2 % 2 && !options8.newlineIsToken) {
325299
- retLines[retLines.length - 1] += line3;
325300
- } else {
325301
- retLines.push(line3);
325302
- }
325303
- }
325304
- return retLines;
325305
- }
325306
-
325307
- // ../../../../node_modules/.pnpm/diff@8.0.2/node_modules/diff/libesm/diff/json.js
325308
- init_cjs_shims();
325309
- var JsonDiff = class extends Diff2 {
325310
- constructor() {
325311
- super(...arguments);
325312
- this.tokenize = tokenize4;
325313
- }
325314
- get useLongestToken() {
325315
- return true;
325316
- }
325317
- castInput(value2, options8) {
325318
- const { undefinedReplacement, stringifyReplacer = (k, v) => typeof v === "undefined" ? undefinedReplacement : v } = options8;
325319
- return typeof value2 === "string" ? value2 : JSON.stringify(canonicalize2(value2, null, null, stringifyReplacer), null, " ");
325320
- }
325321
- equals(left, right, options8) {
325322
- return super.equals(left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"), options8);
325323
- }
325324
- };
325325
- var jsonDiff2 = new JsonDiff();
325326
- function diffJson(oldStr, newStr, options8) {
325327
- return jsonDiff2.diff(oldStr, newStr, options8);
325328
- }
325329
- function canonicalize2(obj, stack2, replacementStack, replacer, key2) {
325330
- stack2 = stack2 || [];
325331
- replacementStack = replacementStack || [];
325332
- if (replacer) {
325333
- obj = replacer(key2 === void 0 ? "" : key2, obj);
325334
- }
325335
- let i2;
325336
- for (i2 = 0; i2 < stack2.length; i2 += 1) {
325337
- if (stack2[i2] === obj) {
325338
- return replacementStack[i2];
325339
- }
325340
- }
325341
- let canonicalizedObj;
325342
- if ("[object Array]" === Object.prototype.toString.call(obj)) {
325343
- stack2.push(obj);
325344
- canonicalizedObj = new Array(obj.length);
325345
- replacementStack.push(canonicalizedObj);
325346
- for (i2 = 0; i2 < obj.length; i2 += 1) {
325347
- canonicalizedObj[i2] = canonicalize2(obj[i2], stack2, replacementStack, replacer, String(i2));
325348
- }
325349
- stack2.pop();
325350
- replacementStack.pop();
325351
- return canonicalizedObj;
325352
- }
325353
- if (obj && obj.toJSON) {
325354
- obj = obj.toJSON();
325355
- }
325356
- if (typeof obj === "object" && obj !== null) {
325357
- stack2.push(obj);
325358
- canonicalizedObj = {};
325359
- replacementStack.push(canonicalizedObj);
325360
- const sortedKeys = [];
325361
- let key3;
325362
- for (key3 in obj) {
325363
- if (Object.prototype.hasOwnProperty.call(obj, key3)) {
325364
- sortedKeys.push(key3);
325365
- }
325366
- }
325367
- sortedKeys.sort();
325368
- for (i2 = 0; i2 < sortedKeys.length; i2 += 1) {
325369
- key3 = sortedKeys[i2];
325370
- canonicalizedObj[key3] = canonicalize2(obj[key3], stack2, replacementStack, replacer, key3);
325371
- }
325372
- stack2.pop();
325373
- replacementStack.pop();
325374
- } else {
325375
- canonicalizedObj = obj;
325376
- }
325377
- return canonicalizedObj;
325378
- }
325379
-
325380
325975
  // ../../../../node_modules/.pnpm/package-manager-detector@1.3.0/node_modules/package-manager-detector/dist/index.mjs
325381
325976
  init_cjs_shims();
325382
325977
 
@@ -326039,11 +326634,11 @@ async function dev(options8) {
326039
326634
 
326040
326635
  // ../sdk/dist/cli-replacement/init.js
326041
326636
  init_cjs_shims();
326042
- var import_shared36 = __toESM(require_dist2(), 1);
326637
+ var import_shared37 = __toESM(require_dist2(), 1);
326043
326638
  var import_util36 = __toESM(require_dist3(), 1);
326044
326639
  async function fetchAndWriteApplication({ resourceId, viewMode, featureFlags, projectRootFolder, appRelativePath, sdk: sdk2, skipSigningVerification }) {
326045
326640
  const headers = {
326046
- [import_util36.COMPONENT_EVENT_HEADER]: import_shared36.ComponentEvent.INIT
326641
+ [import_util36.COMPONENT_EVENT_HEADER]: import_shared37.ComponentEvent.INIT
326047
326642
  };
326048
326643
  const application = await sdk2.fetchApplicationWithComponents({
326049
326644
  applicationId: resourceId,
@@ -326064,7 +326659,7 @@ async function fetchAndWriteApplication({ resourceId, viewMode, featureFlags, pr
326064
326659
  }
326065
326660
 
326066
326661
  // ../sdk/dist/index.js
326067
- var import_shared37 = __toESM(require_dist2(), 1);
326662
+ var import_shared38 = __toESM(require_dist2(), 1);
326068
326663
 
326069
326664
  // src/commands/commits.mts
326070
326665
  var import_util39 = __toESM(require_dist3(), 1);
@@ -331233,7 +331828,7 @@ ${error.message}.`
331233
331828
  task.title = `Pulling resources from branch ${ctx.localBranchName}...`;
331234
331829
  let viewMode;
331235
331830
  if (commitId) {
331236
- viewMode = import_shared37.ExportViewMode.EXPORT_COMMIT;
331831
+ viewMode = import_shared38.ExportViewMode.EXPORT_COMMIT;
331237
331832
  } else {
331238
331833
  viewMode = await getMode(task, mode);
331239
331834
  }