@wix/ditto-codegen-public 1.0.439 → 1.0.441

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/out.js +105 -127
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -1821,7 +1821,7 @@ var require_headers = __commonJS({
1821
1821
  exports2.isWixDomain = exports2.composeHeaders = exports2.requestIdOrEmptyString = void 0;
1822
1822
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
1823
1823
  var headers_1 = require_cjs();
1824
- var utils_1 = require_utils2();
1824
+ var utils_12 = require_utils2();
1825
1825
  var whitelist_json_1 = tslib_1.__importDefault(require_whitelist());
1826
1826
  function requestIdOrEmptyString(response) {
1827
1827
  var _a;
@@ -1834,11 +1834,11 @@ var require_headers = __commonJS({
1834
1834
  };
1835
1835
  exports2.composeHeaders = composeHeaders;
1836
1836
  function isWixDomain(url) {
1837
- const isRelative = !(0, utils_1.isAbsoluteUrl)(url);
1837
+ const isRelative = !(0, utils_12.isAbsoluteUrl)(url);
1838
1838
  if (isRelative) {
1839
1839
  return true;
1840
1840
  }
1841
- const host = `.${(0, utils_1.extractHost)(url)}`;
1841
+ const host = `.${(0, utils_12.extractHost)(url)}`;
1842
1842
  const isWhitelisted = whitelist_json_1.default.find((wixHost) => host.endsWith(`.${wixHost}`));
1843
1843
  return !!isWhitelisted;
1844
1844
  }
@@ -5359,7 +5359,7 @@ var require_options = __commonJS({
5359
5359
  exports2.getUrlHeaders = exports2.buildAllHeaders = exports2.buildOptions = void 0;
5360
5360
  var constants_1 = require_constants();
5361
5361
  var headers_1 = require_headers();
5362
- var utils_1 = require_utils2();
5362
+ var utils_12 = require_utils2();
5363
5363
  var buildOptions = ({ requestOptions, urlObject, headers, globalConfig = {
5364
5364
  httpMockServer: {
5365
5365
  enabled: false
@@ -5408,8 +5408,8 @@ var require_options = __commonJS({
5408
5408
  const { host, protocol } = urlObject;
5409
5409
  const originalUrlHeader = globalConfig.httpMockServer.enabled ? {
5410
5410
  [constants_1.ORIGINAL_URL_HEADER]: buildUrlFromRequest(url, params),
5411
- [constants_1.ORIGINAL_HOST_HEADER]: (0, utils_1.isAbsoluteUrl)(url) ? (0, utils_1.extractHost)(url) : host,
5412
- [constants_1.ORIGINAL_PROTOCOL_HEADER]: (0, utils_1.isAbsoluteUrl)(url) ? (0, utils_1.extractProtocol)(url) : protocol
5411
+ [constants_1.ORIGINAL_HOST_HEADER]: (0, utils_12.isAbsoluteUrl)(url) ? (0, utils_12.extractHost)(url) : host,
5412
+ [constants_1.ORIGINAL_PROTOCOL_HEADER]: (0, utils_12.isAbsoluteUrl)(url) ? (0, utils_12.extractProtocol)(url) : protocol
5413
5413
  } : {};
5414
5414
  return originalUrlHeader;
5415
5415
  };
@@ -5418,7 +5418,7 @@ var require_options = __commonJS({
5418
5418
  if (globalConfig.httpMockServer.enabled) {
5419
5419
  const mockUrl = new URL(globalConfig.httpMockServer.mockServerUrl);
5420
5420
  return {
5421
- url: (0, utils_1.changeHost)(url, mockUrl.host)
5421
+ url: (0, utils_12.changeHost)(url, mockUrl.host)
5422
5422
  };
5423
5423
  }
5424
5424
  return {};
@@ -5427,7 +5427,7 @@ var require_options = __commonJS({
5427
5427
  const { pathname, searchParams } = new URL(url, "http://unused.com");
5428
5428
  requestParams = requestParams || searchParams;
5429
5429
  if (requestParams) {
5430
- const params = (0, utils_1.toSearchQueryParams)(requestParams) || requestParams.toString();
5430
+ const params = (0, utils_12.toSearchQueryParams)(requestParams) || requestParams.toString();
5431
5431
  const paramsAsString = params ? `?${params}` : "";
5432
5432
  return `${pathname}${paramsAsString}`;
5433
5433
  }
@@ -5469,7 +5469,7 @@ var require_http_client = __commonJS({
5469
5469
  var error_1 = require_error();
5470
5470
  var headers_1 = require_headers();
5471
5471
  var options_1 = require_options();
5472
- var utils_1 = require_utils2();
5472
+ var utils_12 = require_utils2();
5473
5473
  var HttpClient = class {
5474
5474
  constructor(opts = {}) {
5475
5475
  this.opts = opts;
@@ -5487,8 +5487,8 @@ var require_http_client = __commonJS({
5487
5487
  }
5488
5488
  async request(requestOptionsOrFactory, overrides) {
5489
5489
  var _a, _b;
5490
- const host = (0, utils_1.resolveHost)(this.opts);
5491
- const protocol = (0, utils_1.resolveProtocol)(this.opts);
5490
+ const host = (0, utils_12.resolveHost)(this.opts);
5491
+ const protocol = (0, utils_12.resolveProtocol)(this.opts);
5492
5492
  const urlObject = { protocol, host };
5493
5493
  const requestOptions = typeof requestOptionsOrFactory === "function" ? requestOptionsOrFactory({ isSSR: this.opts.isSSR, host }) : requestOptionsOrFactory;
5494
5494
  const signedInstance = (overrides === null || overrides === void 0 ? void 0 : overrides.signedInstance) || await ((_b = (_a = this.opts).getAppToken) === null || _b === void 0 ? void 0 : _b.call(_a)) || "";
@@ -5497,7 +5497,7 @@ var require_http_client = __commonJS({
5497
5497
  requestOptions,
5498
5498
  urlObject,
5499
5499
  headers,
5500
- globalConfig: (0, utils_1.getGlobalConfig)()
5500
+ globalConfig: (0, utils_12.getGlobalConfig)()
5501
5501
  });
5502
5502
  if (this.opts.isSSR) {
5503
5503
  options.baseURL = this.opts.baseURL ? this.opts.baseURL : `${constants_1.SSR_PROTOCOL}://${constants_1.SSR_HOST}`;
@@ -5567,22 +5567,22 @@ var require_http_client = __commonJS({
5567
5567
  multilingualOptions: this.opts.multilingualOptions,
5568
5568
  currency: (_b = (_a = this.opts).getCurrency) === null || _b === void 0 ? void 0 : _b.call(_a)
5569
5569
  };
5570
- return (0, options_1.buildAllHeaders)(requestOptions, wixHeadersOpts, (0, utils_1.getGlobalConfig)(), urlObject);
5570
+ return (0, options_1.buildAllHeaders)(requestOptions, wixHeadersOpts, (0, utils_12.getGlobalConfig)(), urlObject);
5571
5571
  }
5572
5572
  getCustomHeaders(requestOptions, signedInstance, urlObject) {
5573
5573
  const { url, headers } = requestOptions;
5574
5574
  const authHeader = signedInstance && (0, headers_1.isWixDomain)(url) ? { authorization: signedInstance } : {};
5575
5575
  const customHeaders = this.opts.createHeaders();
5576
- const originalUrlHeader = (0, options_1.getUrlHeaders)((0, utils_1.getGlobalConfig)(), requestOptions, urlObject);
5576
+ const originalUrlHeader = (0, options_1.getUrlHeaders)((0, utils_12.getGlobalConfig)(), requestOptions, urlObject);
5577
5577
  return Object.assign(Object.assign(Object.assign(Object.assign({}, originalUrlHeader), customHeaders), authHeader), headers);
5578
5578
  }
5579
5579
  handleRequestError(error, requestOptions) {
5580
5580
  const requestError = (0, error_1.createHttpError)(error);
5581
- (0, utils_1.silent)(() => {
5581
+ (0, utils_12.silent)(() => {
5582
5582
  var _a;
5583
5583
  return (_a = requestOptions.onError) === null || _a === void 0 ? void 0 : _a.call(requestOptions, requestError);
5584
5584
  });
5585
- (0, utils_1.silent)(() => {
5585
+ (0, utils_12.silent)(() => {
5586
5586
  var _a;
5587
5587
  return (_a = this.opts.errorHandler) === null || _a === void 0 ? void 0 : _a.handleError(requestError, {
5588
5588
  requestOptions
@@ -5592,7 +5592,7 @@ var require_http_client = __commonJS({
5592
5592
  }
5593
5593
  maybeFallbackRequest(err, requestOptions, urlObject, signedInstance) {
5594
5594
  var _a, _b, _c;
5595
- const shouldFallbackRequest = (0, utils_1.isHttpMockServerEnabled)() && (0, utils_1.shouldAllowUnmocked)() && ((_a = err.response) === null || _a === void 0 ? void 0 : _a.status) === 404 && ((_c = (_b = err.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.msg) === constants_1.NO_SCENARIO_FOUND;
5595
+ const shouldFallbackRequest = (0, utils_12.isHttpMockServerEnabled)() && (0, utils_12.shouldAllowUnmocked)() && ((_a = err.response) === null || _a === void 0 ? void 0 : _a.status) === 404 && ((_c = (_b = err.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.msg) === constants_1.NO_SCENARIO_FOUND;
5596
5596
  if (shouldFallbackRequest) {
5597
5597
  const headers = this.getHeaders(requestOptions, signedInstance, urlObject);
5598
5598
  const prodOptions = (0, options_1.buildOptions)({
@@ -5635,10 +5635,10 @@ var require_http_client = __commonJS({
5635
5635
  function transformData(res, requestOptions, flags) {
5636
5636
  let resData = sanitizeResponse(res, flags);
5637
5637
  if (requestOptions._pickResponseBody) {
5638
- resData = (0, utils_1.extractProp)(res.data, requestOptions._pickResponseBody);
5638
+ resData = (0, utils_12.extractProp)(res.data, requestOptions._pickResponseBody);
5639
5639
  }
5640
5640
  if (requestOptions._logs) {
5641
- const logs = (0, utils_1.extractProp)(res.data, requestOptions._logs);
5641
+ const logs = (0, utils_12.extractProp)(res.data, requestOptions._logs);
5642
5642
  if (logs === null || logs === void 0 ? void 0 : logs.length) {
5643
5643
  logs.map((log) => console.log(...log));
5644
5644
  }
@@ -11156,6 +11156,19 @@ var require_CodeGenService = __commonJS({
11156
11156
  return job.sandboxId === this.sandboxId;
11157
11157
  return true;
11158
11158
  };
11159
+ this.markJobAsFailed = async (jobId, error) => {
11160
+ logger_12.logger.info("Marking job as failed", { jobId });
11161
+ await this.request((0, http_1.updateJob)({
11162
+ projectId: this.projectId,
11163
+ job: {
11164
+ id: jobId,
11165
+ projectId: this.projectId,
11166
+ status: types_1.Status.FAILED,
11167
+ payload: { error },
11168
+ output: toJobOutput({ error })
11169
+ }
11170
+ }));
11171
+ };
11159
11172
  this.markJobAsCompleted = async (jobId) => {
11160
11173
  await this.request((0, http_1.updateJob)({
11161
11174
  projectId: this.projectId,
@@ -12062,80 +12075,6 @@ var require_rules_writer = __commonJS({
12062
12075
  }
12063
12076
  });
12064
12077
 
12065
- // dist/opencode-integration/generated-plugins.js
12066
- var require_generated_plugins = __commonJS({
12067
- "dist/opencode-integration/generated-plugins.js"(exports2) {
12068
- "use strict";
12069
- Object.defineProperty(exports2, "__esModule", { value: true });
12070
- exports2.OPENCODE_PLUGIN_DIR = void 0;
12071
- exports2.writeGeneratedPlugin = writeGeneratedPlugin;
12072
- var promises_1 = require("fs/promises");
12073
- var os_1 = require("os");
12074
- var path_12 = require("path");
12075
- var logger_12 = require_logger();
12076
- exports2.OPENCODE_PLUGIN_DIR = (0, path_12.join)((0, os_1.homedir)(), ".config", "opencode", "plugin");
12077
- async function writeGeneratedPlugin(filename, source) {
12078
- await (0, promises_1.mkdir)(exports2.OPENCODE_PLUGIN_DIR, { recursive: true });
12079
- await (0, promises_1.writeFile)((0, path_12.join)(exports2.OPENCODE_PLUGIN_DIR, filename), source, "utf-8");
12080
- logger_12.logger.info("[OpenCode] Wrote generated plugin", { plugin: filename });
12081
- }
12082
- }
12083
- });
12084
-
12085
- // dist/opencode-integration/node-modules-guard.js
12086
- var require_node_modules_guard = __commonJS({
12087
- "dist/opencode-integration/node-modules-guard.js"(exports2) {
12088
- "use strict";
12089
- Object.defineProperty(exports2, "__esModule", { value: true });
12090
- exports2.GUARD_PLUGIN_PATH = exports2.GUARD_MESSAGE = exports2.MAX_SPELUNK_CALLS = void 0;
12091
- exports2.isSpelunkCommand = isSpelunkCommand;
12092
- exports2.buildGuardPluginSource = buildGuardPluginSource;
12093
- exports2.writeGuardPlugin = writeGuardPlugin;
12094
- var path_12 = require("path");
12095
- var generated_plugins_1 = require_generated_plugins();
12096
- var READ_VERB_RE = /(^|[\s|;&(])(grep|rg|cat|head|tail|sed|awk|less|more|strings|find)\b/;
12097
- var SDK_INTERNALS_RE = /node_modules\/(@wix|vite|astro)\b/;
12098
- exports2.MAX_SPELUNK_CALLS = 2;
12099
- exports2.GUARD_MESSAGE = `BLOCKED: node_modules is not a documentation source, and the exploratory budget (${exports2.MAX_SPELUNK_CALLS} lookups) is used up. The API you are hunting is already documented:
12100
- - Wix Data items CRUD: import { items } from "@wix/data" (items.query/get/insert/update/remove).
12101
- - Dashboard host SDK (toasts, navigation): import { dashboard } from "@wix/dashboard".
12102
- For anything more (CSS-module/asset typing, component config, etc.), re-read the wix-app skill's references with batch-read, or call SearchWixSDKDocumentation / ReadFullDocsMethodSchema. Do not retry this command.`;
12103
- function isSpelunkCommand(command) {
12104
- return READ_VERB_RE.test(command) && SDK_INTERNALS_RE.test(command);
12105
- }
12106
- var GUARD_PLUGIN_FILENAME = "node-modules-guard.ts";
12107
- exports2.GUARD_PLUGIN_PATH = (0, path_12.join)(generated_plugins_1.OPENCODE_PLUGIN_DIR, GUARD_PLUGIN_FILENAME);
12108
- function buildGuardPluginSource() {
12109
- return `// Generated by @wix/ditto-codegen (node-modules-guard) \u2014 do not edit.
12110
- const READ_VERB_RE = /${READ_VERB_RE.source}/;
12111
- const SDK_INTERNALS_RE = /${SDK_INTERNALS_RE.source}/;
12112
- const MAX_SPELUNK_CALLS = ${exports2.MAX_SPELUNK_CALLS};
12113
- const GUARD_MESSAGE = ${JSON.stringify(exports2.GUARD_MESSAGE)};
12114
-
12115
- let spelunkCalls = 0;
12116
-
12117
- export const NodeModulesGuard = async () => ({
12118
- "tool.execute.before": async (
12119
- input: { tool: string },
12120
- output: { args: { command?: string } },
12121
- ) => {
12122
- if (input.tool !== "bash") return;
12123
- const command = output.args?.command ?? "";
12124
- if (!READ_VERB_RE.test(command) || !SDK_INTERNALS_RE.test(command)) return;
12125
- spelunkCalls += 1;
12126
- if (spelunkCalls > MAX_SPELUNK_CALLS) {
12127
- throw new Error(GUARD_MESSAGE);
12128
- }
12129
- },
12130
- });
12131
- `;
12132
- }
12133
- async function writeGuardPlugin() {
12134
- await (0, generated_plugins_1.writeGeneratedPlugin)(GUARD_PLUGIN_FILENAME, buildGuardPluginSource());
12135
- }
12136
- }
12137
- });
12138
-
12139
12078
  // ../../node_modules/@wix/ambassador-ctp-ditto-v1-blueprint/cjs/build/types.impl.js
12140
12079
  var require_types_impl2 = __commonJS({
12141
12080
  "../../node_modules/@wix/ambassador-ctp-ditto-v1-blueprint/cjs/build/types.impl.js"(exports2) {
@@ -15692,7 +15631,6 @@ var require_config = __commonJS({
15692
15631
  var constants_1 = require_constants5();
15693
15632
  var subagents_1 = require_subagents();
15694
15633
  var rules_writer_12 = require_rules_writer();
15695
- var node_modules_guard_12 = require_node_modules_guard();
15696
15634
  var environments_12 = require_environments();
15697
15635
  var CodeGenService_12 = require_CodeGenService();
15698
15636
  exports2.DEFAULT_TIMEOUT_MS = 20 * 60 * 1e3;
@@ -15830,7 +15768,7 @@ var require_config = __commonJS({
15830
15768
  ]: "deny",
15831
15769
  external_directory: READABLE_EXTERNAL_DIRS
15832
15770
  };
15833
- function buildConfig(instructionPaths, permission, { guardNodeModules = false, withAgents = false } = {}) {
15771
+ function buildConfig(instructionPaths, permission, { isCodeWritingFlow = false, withAgents = false } = {}) {
15834
15772
  return {
15835
15773
  model: exports2.DEFAULT_MODEL,
15836
15774
  small_model: exports2.DEFAULT_SMALL_MODEL,
@@ -15842,7 +15780,7 @@ var require_config = __commonJS({
15842
15780
  lsp: false,
15843
15781
  mcp: WIX_MCP_CONFIG,
15844
15782
  watcher: { ignore: WATCHER_IGNORE_PATTERNS },
15845
- ...guardNodeModules ? { plugin: [node_modules_guard_12.GUARD_PLUGIN_PATH], autoupdate: false, share: "disabled" } : {},
15783
+ ...isCodeWritingFlow ? { autoupdate: false, share: "disabled" } : {},
15846
15784
  // Only code-writing flows register subagents. The read-only ask flow must
15847
15785
  // not: its primary agent re-opens `task`, which would let the write-capable
15848
15786
  // validator subagent run in a flow meant to stay read-only.
@@ -15883,12 +15821,12 @@ var require_config = __commonJS({
15883
15821
  return buildConfig(paths(env.askRules), ASK_PERMISSIONS);
15884
15822
  case CodeGenService_12.TaskKind.FIX_GIT_CONFLICTS:
15885
15823
  return buildConfig(paths(env.gitConflictsRules), GIT_CONFLICTS_PERMISSIONS, {
15886
- guardNodeModules: true,
15824
+ isCodeWritingFlow: true,
15887
15825
  withAgents: true
15888
15826
  });
15889
15827
  default:
15890
15828
  return buildConfig(paths(env.codegenRules), CODEGEN_PERMISSIONS, {
15891
- guardNodeModules: true,
15829
+ isCodeWritingFlow: true,
15892
15830
  withAgents: true
15893
15831
  });
15894
15832
  }
@@ -15896,6 +15834,26 @@ var require_config = __commonJS({
15896
15834
  }
15897
15835
  });
15898
15836
 
15837
+ // dist/opencode-integration/generated-plugins.js
15838
+ var require_generated_plugins = __commonJS({
15839
+ "dist/opencode-integration/generated-plugins.js"(exports2) {
15840
+ "use strict";
15841
+ Object.defineProperty(exports2, "__esModule", { value: true });
15842
+ exports2.OPENCODE_PLUGIN_DIR = void 0;
15843
+ exports2.writeGeneratedPlugin = writeGeneratedPlugin;
15844
+ var promises_1 = require("fs/promises");
15845
+ var os_1 = require("os");
15846
+ var path_12 = require("path");
15847
+ var logger_12 = require_logger();
15848
+ exports2.OPENCODE_PLUGIN_DIR = (0, path_12.join)((0, os_1.homedir)(), ".config", "opencode", "plugin");
15849
+ async function writeGeneratedPlugin(filename, source) {
15850
+ await (0, promises_1.mkdir)(exports2.OPENCODE_PLUGIN_DIR, { recursive: true });
15851
+ await (0, promises_1.writeFile)((0, path_12.join)(exports2.OPENCODE_PLUGIN_DIR, filename), source, "utf-8");
15852
+ logger_12.logger.info("[OpenCode] Wrote generated plugin", { plugin: filename });
15853
+ }
15854
+ }
15855
+ });
15856
+
15899
15857
  // dist/opencode-integration/subagent-tool-logger.js
15900
15858
  var require_subagent_tool_logger = __commonJS({
15901
15859
  "dist/opencode-integration/subagent-tool-logger.js"(exports2) {
@@ -16618,7 +16576,7 @@ var require_plugins_runtime = __commonJS({
16618
16576
  var http_client_1 = require_index_node();
16619
16577
  var job_context_storage_12 = require_job_context_storage();
16620
16578
  var codeGenerationService_12 = require_codeGenerationService();
16621
- var utils_1 = require_utils9();
16579
+ var utils_12 = require_utils9();
16622
16580
  function getActivePlugins() {
16623
16581
  return job_context_storage_12.jobContextStorage.getStore()?.plugins ?? [];
16624
16582
  }
@@ -16662,7 +16620,7 @@ var require_plugins_runtime = __commonJS({
16662
16620
  const requestId = http_client_1.HttpClient.isHttpError(pluginError) && pluginError.requestId || void 0;
16663
16621
  await codeGenerationService_12.codeGenerationService.handlePluginFailure({
16664
16622
  pluginName,
16665
- error: (0, utils_1.errorStack)(pluginError),
16623
+ error: (0, utils_12.errorStack)(pluginError),
16666
16624
  requestId,
16667
16625
  jobId: store?.jobId,
16668
16626
  metasiteId: store?.metasiteId,
@@ -17670,7 +17628,7 @@ var require_codegen_flow_helpers = __commonJS({
17670
17628
  var git_file_changes_1 = require_git_file_changes();
17671
17629
  var collect_extensions_created_1 = require_collect_extensions_created();
17672
17630
  var agent_io_1 = require_agent_io();
17673
- var utils_1 = require_utils9();
17631
+ var utils_12 = require_utils9();
17674
17632
  var DEFAULT_OUTPUT_PATH = "generated-app";
17675
17633
  async function updateJobPayload(jobContext, payload) {
17676
17634
  await codeGenerationService_12.codeGenerationService.updateJob(jobContext.jobId, payload);
@@ -17688,7 +17646,7 @@ var require_codegen_flow_helpers = __commonJS({
17688
17646
  }
17689
17647
  async function updateParentTaskStatus(jobContext, status, error) {
17690
17648
  await codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, jobContext.taskId, status, {
17691
- ...error ? { error: (0, utils_1.serializeError)(error) } : {}
17649
+ ...error ? { error: (0, utils_12.serializeError)(error) } : {}
17692
17650
  });
17693
17651
  }
17694
17652
  function getOutputPath() {
@@ -20455,7 +20413,7 @@ var require_headers2 = __commonJS({
20455
20413
  exports2.isWixDomain = exports2.composeHeaders = exports2.requestIdOrEmptyString = void 0;
20456
20414
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
20457
20415
  var headers_1 = require_cjs4();
20458
- var utils_1 = require_utils11();
20416
+ var utils_12 = require_utils11();
20459
20417
  var whitelist_json_1 = tslib_1.__importDefault(require_whitelist2());
20460
20418
  function requestIdOrEmptyString(response) {
20461
20419
  var _a;
@@ -20468,11 +20426,11 @@ var require_headers2 = __commonJS({
20468
20426
  };
20469
20427
  exports2.composeHeaders = composeHeaders;
20470
20428
  function isWixDomain(url) {
20471
- const isRelative = !(0, utils_1.isAbsoluteUrl)(url);
20429
+ const isRelative = !(0, utils_12.isAbsoluteUrl)(url);
20472
20430
  if (isRelative) {
20473
20431
  return true;
20474
20432
  }
20475
- const host = `.${(0, utils_1.extractHost)(url)}`;
20433
+ const host = `.${(0, utils_12.extractHost)(url)}`;
20476
20434
  const isWhitelisted = whitelist_json_1.default.find((wixHost) => host.endsWith(`.${wixHost}`));
20477
20435
  return !!isWhitelisted;
20478
20436
  }
@@ -22114,7 +22072,7 @@ var require_options2 = __commonJS({
22114
22072
  exports2.getUrlHeaders = exports2.buildAllHeaders = exports2.buildOptions = void 0;
22115
22073
  var constants_1 = require_constants6();
22116
22074
  var headers_1 = require_headers2();
22117
- var utils_1 = require_utils11();
22075
+ var utils_12 = require_utils11();
22118
22076
  var buildOptions = ({ requestOptions, urlObject, headers, globalConfig = {
22119
22077
  httpMockServer: {
22120
22078
  enabled: false
@@ -22151,8 +22109,8 @@ var require_options2 = __commonJS({
22151
22109
  const { host, protocol } = urlObject;
22152
22110
  const originalUrlHeader = globalConfig.httpMockServer.enabled ? {
22153
22111
  [constants_1.ORIGINAL_URL_HEADER]: buildUrlFromRequest(url, params),
22154
- [constants_1.ORIGINAL_HOST_HEADER]: (0, utils_1.isAbsoluteUrl)(url) ? (0, utils_1.extractHost)(url) : host,
22155
- [constants_1.ORIGINAL_PROTOCOL_HEADER]: (0, utils_1.isAbsoluteUrl)(url) ? (0, utils_1.extractProtocol)(url) : protocol
22112
+ [constants_1.ORIGINAL_HOST_HEADER]: (0, utils_12.isAbsoluteUrl)(url) ? (0, utils_12.extractHost)(url) : host,
22113
+ [constants_1.ORIGINAL_PROTOCOL_HEADER]: (0, utils_12.isAbsoluteUrl)(url) ? (0, utils_12.extractProtocol)(url) : protocol
22156
22114
  } : {};
22157
22115
  return originalUrlHeader;
22158
22116
  };
@@ -22161,7 +22119,7 @@ var require_options2 = __commonJS({
22161
22119
  if (globalConfig.httpMockServer.enabled) {
22162
22120
  const mockUrl = new URL(globalConfig.httpMockServer.mockServerUrl);
22163
22121
  return {
22164
- url: (0, utils_1.changeHost)(url, mockUrl.host)
22122
+ url: (0, utils_12.changeHost)(url, mockUrl.host)
22165
22123
  };
22166
22124
  }
22167
22125
  return {};
@@ -22170,7 +22128,7 @@ var require_options2 = __commonJS({
22170
22128
  const { pathname, searchParams } = new URL(url, "http://unused.com");
22171
22129
  requestParams = requestParams || searchParams;
22172
22130
  if (requestParams) {
22173
- const params = (0, utils_1.toSearchQueryParams)(requestParams) || requestParams.toString();
22131
+ const params = (0, utils_12.toSearchQueryParams)(requestParams) || requestParams.toString();
22174
22132
  const paramsAsString = params ? `?${params}` : "";
22175
22133
  return `${pathname}${paramsAsString}`;
22176
22134
  }
@@ -22198,7 +22156,7 @@ var require_http_client2 = __commonJS({
22198
22156
  var error_1 = require_error2();
22199
22157
  var headers_1 = require_headers2();
22200
22158
  var options_1 = require_options2();
22201
- var utils_1 = require_utils11();
22159
+ var utils_12 = require_utils11();
22202
22160
  var HttpClient = class {
22203
22161
  constructor(opts = {}) {
22204
22162
  this.opts = opts;
@@ -22213,8 +22171,8 @@ var require_http_client2 = __commonJS({
22213
22171
  }
22214
22172
  async request(requestOptionsOrFactory, overrides) {
22215
22173
  var _a, _b;
22216
- const host = (0, utils_1.resolveHost)(this.opts);
22217
- const protocol = (0, utils_1.resolveProtocol)(this.opts);
22174
+ const host = (0, utils_12.resolveHost)(this.opts);
22175
+ const protocol = (0, utils_12.resolveProtocol)(this.opts);
22218
22176
  const urlObject = { protocol, host };
22219
22177
  const requestOptions = typeof requestOptionsOrFactory === "function" ? requestOptionsOrFactory({ isSSR: this.opts.isSSR, host }) : requestOptionsOrFactory;
22220
22178
  const signedInstance = (overrides === null || overrides === void 0 ? void 0 : overrides.signedInstance) || await ((_b = (_a = this.opts).getAppToken) === null || _b === void 0 ? void 0 : _b.call(_a)) || "";
@@ -22223,7 +22181,7 @@ var require_http_client2 = __commonJS({
22223
22181
  requestOptions,
22224
22182
  urlObject,
22225
22183
  headers,
22226
- globalConfig: (0, utils_1.getGlobalConfig)()
22184
+ globalConfig: (0, utils_12.getGlobalConfig)()
22227
22185
  });
22228
22186
  if (this.opts.isSSR) {
22229
22187
  options.baseURL = this.opts.baseURL ? this.opts.baseURL : `${constants_1.SSR_PROTOCOL}://${constants_1.SSR_HOST}`;
@@ -22291,18 +22249,18 @@ var require_http_client2 = __commonJS({
22291
22249
  csrf: false,
22292
22250
  multilingualOptions: this.opts.multilingualOptions
22293
22251
  };
22294
- return (0, options_1.buildAllHeaders)(requestOptions, wixHeadersOpts, (0, utils_1.getGlobalConfig)(), urlObject);
22252
+ return (0, options_1.buildAllHeaders)(requestOptions, wixHeadersOpts, (0, utils_12.getGlobalConfig)(), urlObject);
22295
22253
  }
22296
22254
  getCustomHeaders(requestOptions, signedInstance, urlObject) {
22297
22255
  const { url } = requestOptions;
22298
22256
  const authHeader = signedInstance && (0, headers_1.isWixDomain)(url) ? { authorization: signedInstance } : {};
22299
22257
  const customHeaders = this.opts.createHeaders();
22300
- const originalUrlHeader = (0, options_1.getUrlHeaders)((0, utils_1.getGlobalConfig)(), requestOptions, urlObject);
22258
+ const originalUrlHeader = (0, options_1.getUrlHeaders)((0, utils_12.getGlobalConfig)(), requestOptions, urlObject);
22301
22259
  return Object.assign(Object.assign(Object.assign({}, originalUrlHeader), customHeaders), authHeader);
22302
22260
  }
22303
22261
  handleRequestError(error, requestOptions) {
22304
22262
  const requestError = (0, error_1.createHttpError)(error);
22305
- (0, utils_1.silent)(() => {
22263
+ (0, utils_12.silent)(() => {
22306
22264
  var _a;
22307
22265
  return (_a = requestOptions.onError) === null || _a === void 0 ? void 0 : _a.call(requestOptions, requestError);
22308
22266
  });
@@ -22310,7 +22268,7 @@ var require_http_client2 = __commonJS({
22310
22268
  }
22311
22269
  maybeFallbackRequest(err, requestOptions, urlObject, signedInstance) {
22312
22270
  var _a, _b, _c;
22313
- const shouldFallbackRequest = (0, utils_1.isHttpMockServerEnabled)() && (0, utils_1.shouldAllowUnmocked)() && ((_a = err.response) === null || _a === void 0 ? void 0 : _a.status) === 404 && ((_c = (_b = err.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.msg) === constants_1.NO_SCENARIO_FOUND;
22271
+ const shouldFallbackRequest = (0, utils_12.isHttpMockServerEnabled)() && (0, utils_12.shouldAllowUnmocked)() && ((_a = err.response) === null || _a === void 0 ? void 0 : _a.status) === 404 && ((_c = (_b = err.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.msg) === constants_1.NO_SCENARIO_FOUND;
22314
22272
  if (shouldFallbackRequest) {
22315
22273
  const headers = this.getHeaders(requestOptions, signedInstance, urlObject);
22316
22274
  const prodOptions = (0, options_1.buildOptions)({
@@ -22353,10 +22311,10 @@ var require_http_client2 = __commonJS({
22353
22311
  function transformData(res, requestOptions, flags) {
22354
22312
  let resData = sanitizeResponse(res, flags);
22355
22313
  if (requestOptions._pickResponseBody) {
22356
- resData = (0, utils_1.extractProp)(res.data, requestOptions._pickResponseBody);
22314
+ resData = (0, utils_12.extractProp)(res.data, requestOptions._pickResponseBody);
22357
22315
  }
22358
22316
  if (requestOptions._logs) {
22359
- const logs = (0, utils_1.extractProp)(res.data, requestOptions._logs);
22317
+ const logs = (0, utils_12.extractProp)(res.data, requestOptions._logs);
22360
22318
  if (logs === null || logs === void 0 ? void 0 : logs.length) {
22361
22319
  logs.map((log) => console.log(...log));
22362
22320
  }
@@ -23526,7 +23484,7 @@ var require_job_cancellation_monitor = __commonJS({
23526
23484
  Object.defineProperty(exports2, "__esModule", { value: true });
23527
23485
  exports2.JobCancellationMonitor = void 0;
23528
23486
  var ditto_codegen_types_12 = require_dist4();
23529
- var utils_1 = require_utils9();
23487
+ var utils_12 = require_utils9();
23530
23488
  var logger_12 = require_logger();
23531
23489
  var job_context_storage_12 = require_job_context_storage();
23532
23490
  var types_1 = require_types_impl();
@@ -23561,7 +23519,7 @@ var require_job_cancellation_monitor = __commonJS({
23561
23519
  logger_12.logger.info("[Job] Detected cancellation request, exiting");
23562
23520
  await this.reportCancellationBi(jobId);
23563
23521
  await this.codeGenerationService.markJobAsCancelled(jobId);
23564
- await (0, utils_1.updateAllRunningTasks)(jobId, ditto_codegen_types_12.Status.CANCELLED);
23522
+ await (0, utils_12.updateAllRunningTasks)(jobId, ditto_codegen_types_12.Status.CANCELLED);
23565
23523
  logger_12.logger.info("[Job] Marked job as CANCELLED");
23566
23524
  process.exit();
23567
23525
  }
@@ -23602,7 +23560,7 @@ var require_job_timeout_monitor = __commonJS({
23602
23560
  Object.defineProperty(exports2, "__esModule", { value: true });
23603
23561
  exports2.JobTimeoutMonitor = exports2.JOB_TIMEOUT_MS = void 0;
23604
23562
  var ditto_codegen_types_12 = require_dist4();
23605
- var utils_1 = require_utils9();
23563
+ var utils_12 = require_utils9();
23606
23564
  var logger_12 = require_logger();
23607
23565
  var context_12 = require_context();
23608
23566
  var job_context_storage_12 = require_job_context_storage();
@@ -23636,7 +23594,7 @@ var require_job_timeout_monitor = __commonJS({
23636
23594
  logger_12.logger.info("[Job] Timeout detected, exiting", logContext);
23637
23595
  const job = await this.codeGenerationService.getJob(jobId);
23638
23596
  const codegenError = this.resolveTimeoutError(jobId, job);
23639
- await (0, utils_1.updateAllRunningTasks)(jobId, ditto_codegen_types_12.Status.FAILED, codegenError);
23597
+ await (0, utils_12.updateAllRunningTasks)(jobId, ditto_codegen_types_12.Status.FAILED, codegenError);
23640
23598
  await this.codeGenerationService.updateJobStatus(jobId, ditto_codegen_types_12.Status.FAILED);
23641
23599
  const failedRunPayload = await (0, codegen_flow_helpers_12.buildFailedRunPayload)(codegenError, (0, codegen_flow_helpers_12.getOutputPath)(), job_context_storage_12.jobContextStorage.getStore()?.gitBaseline ?? "");
23642
23600
  await this.codeGenerationService.updateJob(jobId, {
@@ -24276,7 +24234,6 @@ var logger_1 = require_logger();
24276
24234
  var skills_installer_1 = require_skills_installer();
24277
24235
  var rules_writer_1 = require_rules_writer();
24278
24236
  var tools_writer_1 = require_tools_writer();
24279
- var node_modules_guard_1 = require_node_modules_guard();
24280
24237
  var tool_policies_1 = require_tool_policies3();
24281
24238
  var skills_override_1 = require_skills_override();
24282
24239
  var generated_files_guard_1 = require_generated_files_guard();
@@ -24285,6 +24242,7 @@ var plugin_artifacts_1 = require_plugin_artifacts();
24285
24242
  var config_1 = require_config();
24286
24243
  var environments_1 = require_environments();
24287
24244
  var plugin_host_1 = require_plugin_host();
24245
+ var utils_1 = require_utils9();
24288
24246
  var sessionId = process.env.CODEGEN_SESSION_ID || (0, crypto_1.randomUUID)();
24289
24247
  process.env.CODEGEN_SESSION_ID = sessionId;
24290
24248
  (0, logger_1.initLogger)(sessionId);
@@ -24358,7 +24316,6 @@ async function initOpenCode() {
24358
24316
  ]),
24359
24317
  (0, skills_installer_1.applySkillsOverride)((0, codegen_flow_helpers_1.getOutputPath)(), logger_1.logger),
24360
24318
  (0, tools_writer_1.writeToolFiles)(pluginArtifacts.tools),
24361
- (0, node_modules_guard_1.writeGuardPlugin)(),
24362
24319
  (0, generated_files_guard_1.writeGeneratedFilesGuardPlugin)(),
24363
24320
  (0, subagent_tool_logger_1.writeSubagentToolLoggerPlugin)(),
24364
24321
  (0, tool_policies_1.writeToolPoliciesPlugin)(toolPolicies)
@@ -24412,6 +24369,22 @@ function extractUserInput(kind, payload) {
24412
24369
  }
24413
24370
  return void 0;
24414
24371
  }
24372
+ async function reportPreDispatchFailure(jobId, error) {
24373
+ const codegenError = (0, ditto_codegen_types_1.toCodegenError)(error);
24374
+ logger_1.logger.error("[Job] Failed before flow dispatch", {
24375
+ jobId,
24376
+ error: codegenError.message
24377
+ });
24378
+ try {
24379
+ await codeGenerationService_1.codeGenerationService.markJobAsFailed(jobId, codegenError);
24380
+ await (0, utils_1.updateAllRunningTasks)(jobId, CodeGenService_1.Status.FAILED, codegenError);
24381
+ } catch (reportError) {
24382
+ logger_1.logger.error("[Job] Could not mark the job failed", {
24383
+ jobId,
24384
+ error: reportError instanceof Error ? reportError.message : reportError
24385
+ });
24386
+ }
24387
+ }
24415
24388
  async function processJob(job) {
24416
24389
  if (!job.id) {
24417
24390
  throw new ditto_codegen_types_1.MissingJobIdError();
@@ -24453,7 +24426,12 @@ async function processJob(job) {
24453
24426
  keys: Object.keys(agentData)
24454
24427
  });
24455
24428
  }
24456
- await (0, skills_installer_1.ensureSkillsReady)((0, codegen_flow_helpers_1.getOutputPath)(), logger_1.logger);
24429
+ try {
24430
+ await (0, skills_installer_1.ensureSkillsReady)((0, codegen_flow_helpers_1.getOutputPath)(), logger_1.logger);
24431
+ } catch (error) {
24432
+ await reportPreDispatchFailure(jobId, error);
24433
+ throw error;
24434
+ }
24457
24435
  if (task.kind === CodeGenService_1.TaskKind.ASK_CODEGEN) {
24458
24436
  await (0, opencode_ask_1.runOpencodeAskFlow)(history);
24459
24437
  } else if (task.kind === CodeGenService_1.TaskKind.ITERATE_CODEGEN) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.439",
3
+ "version": "1.0.441",
4
4
  "description": "AI-powered Wix CLI app generator - standalone executable",
5
5
  "scripts": {
6
6
  "build": "node build.mjs",
@@ -29,5 +29,5 @@
29
29
  "esbuild": "^0.27.2",
30
30
  "vitest": "^4.0.16"
31
31
  },
32
- "falconPackageHash": "48343c7d8a2d3fb18094776d1e5d4acc5ac0d288071c300a89c145ab"
32
+ "falconPackageHash": "b04a4f2857569aa9b70fbf2fc57a6b3c7db84e442334799481a9cc6c"
33
33
  }