@wix/ditto-codegen-public 1.0.416 → 1.0.418

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 +24 -49
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -11814,43 +11814,6 @@ skills already cover. Read-only.`;
11814
11814
  }
11815
11815
  });
11816
11816
 
11817
- // dist/experiments.js
11818
- var require_experiments = __commonJS({
11819
- "dist/experiments.js"(exports2) {
11820
- "use strict";
11821
- Object.defineProperty(exports2, "__esModule", { value: true });
11822
- exports2.isExperimentEnabled = isExperimentEnabled;
11823
- exports2.isUseWixAiGatewayEnabled = isUseWixAiGatewayEnabled;
11824
- var logger_12 = require_logger();
11825
- var parsedExperiments = null;
11826
- function getExperiments() {
11827
- if (parsedExperiments !== null) {
11828
- return parsedExperiments;
11829
- }
11830
- const raw = process.env.CODEGEN_EXPERIMENTS;
11831
- if (!raw) {
11832
- parsedExperiments = {};
11833
- return parsedExperiments;
11834
- }
11835
- try {
11836
- parsedExperiments = JSON.parse(raw);
11837
- } catch (error) {
11838
- logger_12.logger.error("[Experiments] Failed to parse CODEGEN_EXPERIMENTS", {
11839
- error: error instanceof Error ? error.message : String(error)
11840
- });
11841
- parsedExperiments = {};
11842
- }
11843
- return parsedExperiments;
11844
- }
11845
- function isExperimentEnabled(specName) {
11846
- return getExperiments()[specName] === "true";
11847
- }
11848
- function isUseWixAiGatewayEnabled() {
11849
- return isExperimentEnabled("specs.ditto.CodegenUseWixAiGateway");
11850
- }
11851
- }
11852
- });
11853
-
11854
11817
  // dist/opencode-integration/rules-writer.js
11855
11818
  var require_rules_writer = __commonJS({
11856
11819
  "dist/opencode-integration/rules-writer.js"(exports2) {
@@ -15102,6 +15065,7 @@ var require_environments = __commonJS({
15102
15065
  "dist/environments/index.js"(exports2) {
15103
15066
  "use strict";
15104
15067
  Object.defineProperty(exports2, "__esModule", { value: true });
15068
+ exports2.getValidatedCodegenEnvironment = getValidatedCodegenEnvironment;
15105
15069
  exports2.getCodegenEnvironmentConfig = getCodegenEnvironmentConfig;
15106
15070
  var types_1 = require_types_impl();
15107
15071
  var codegen_app_builder_config_1 = require_dist5();
@@ -15132,14 +15096,27 @@ var require_environments = __commonJS({
15132
15096
  gitConflictsRules: [SHARED_GIT_CONFLICTS_RULE, ...env.gitConflictsRules]
15133
15097
  };
15134
15098
  };
15099
+ var SUPPORTED_ENVIRONMENTS = [
15100
+ types_1.Environment.APP_BUILDER,
15101
+ types_1.Environment.STUDIO_2,
15102
+ types_1.Environment.HARMONY
15103
+ ];
15104
+ function getValidatedCodegenEnvironment() {
15105
+ const environment = process.env.CODEGEN_ENVIRONMENT;
15106
+ const supported = SUPPORTED_ENVIRONMENTS.find((e) => e === environment);
15107
+ if (!supported) {
15108
+ throw new Error(`Unsupported CODEGEN_ENVIRONMENT: ${environment ?? "(missing)"}. Valid values: ${SUPPORTED_ENVIRONMENTS.join(", ")}`);
15109
+ }
15110
+ return supported;
15111
+ }
15135
15112
  function getCodegenEnvironmentConfig() {
15136
- switch (process.env.CODEGEN_ENVIRONMENT) {
15113
+ const environment = getValidatedCodegenEnvironment();
15114
+ switch (environment) {
15137
15115
  case types_1.Environment.STUDIO_2:
15138
15116
  return withSharedRules(codegen_studio_2_config_1.studio2CodegenConfig);
15139
15117
  case types_1.Environment.HARMONY:
15140
15118
  return withSharedRules(codegen_harmony_config_1.harmonyCodegenConfig);
15141
15119
  case types_1.Environment.APP_BUILDER:
15142
- default:
15143
15120
  return withSharedRules({
15144
15121
  ...codegen_app_builder_config_1.appBuilderCodegenConfig,
15145
15122
  decisionCheckers: [
@@ -15168,7 +15145,6 @@ var require_config = __commonJS({
15168
15145
  var ditto_codegen_types_12 = require_dist4();
15169
15146
  var constants_1 = require_constants5();
15170
15147
  var subagents_1 = require_subagents();
15171
- var experiments_1 = require_experiments();
15172
15148
  var rules_writer_12 = require_rules_writer();
15173
15149
  var node_modules_guard_12 = require_node_modules_guard();
15174
15150
  var environments_12 = require_environments();
@@ -15178,10 +15154,7 @@ var require_config = __commonJS({
15178
15154
  exports2.DEFAULT_SMALL_MODEL = "anthropic/claude-haiku-4-5-20251001";
15179
15155
  var AI_PROXY_BASE_URL = process.env.CODEGEN_AI_PROXY_BASE_URL || "http://localhost:3001";
15180
15156
  function getAnthropicBaseUrl(projectId) {
15181
- if ((0, experiments_1.isUseWixAiGatewayEnabled)()) {
15182
- return `${AI_PROXY_BASE_URL}/projects/${projectId}/genai/anthropic`;
15183
- }
15184
- return `${AI_PROXY_BASE_URL}/projects/${projectId}/anthropic`;
15157
+ return `${AI_PROXY_BASE_URL}/projects/${projectId}/genai/anthropic`;
15185
15158
  }
15186
15159
  var currentAccessToken = process.env.WIX_ACCESS_TOKEN;
15187
15160
  function setCurrentAccessToken(token) {
@@ -15198,13 +15171,12 @@ var require_config = __commonJS({
15198
15171
  ".astro/**"
15199
15172
  ];
15200
15173
  function getProviderConfig() {
15201
- const environment = process.env.CODEGEN_ENVIRONMENT;
15174
+ const environment = (0, environments_12.getValidatedCodegenEnvironment)();
15202
15175
  const chargingMode = (0, environments_12.getCodegenEnvironmentConfig)().chargingMode ?? "app";
15203
15176
  const headers = {
15204
15177
  // Tell the proxy which environment this request belongs to so it can
15205
- // select the matching upstream API key. Forwarded verbatim — the proxy
15206
- // owns validation and the default.
15207
- ...environment ? { [ditto_codegen_types_12.CODEGEN_ENVIRONMENT_HEADER]: environment } : {},
15178
+ // select the matching upstream API key.
15179
+ [ditto_codegen_types_12.CODEGEN_ENVIRONMENT_HEADER]: environment,
15208
15180
  // How the request is billed; the proxy resolves auth accordingly.
15209
15181
  [ditto_codegen_types_12.CODEGEN_CHARGING_MODE_HEADER]: chargingMode,
15210
15182
  // The user's Wix token — needed to resolve the account (credits mode) and
@@ -23433,7 +23405,10 @@ async function processJob(job) {
23433
23405
  });
23434
23406
  }
23435
23407
  (0, context_1.initCtx)().then((ctx) => {
23436
- main(ctx);
23408
+ main(ctx).catch((error) => {
23409
+ logger_1.logger.error("[Startup] CodeGen CLI failed", { error: String(error) });
23410
+ process.exit(1);
23411
+ });
23437
23412
  });
23438
23413
  /*! Bundled license information:
23439
23414
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.416",
3
+ "version": "1.0.418",
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": "307836979da78635f24c70b32a36cf29cd5b341aa326e125e187bcd6"
32
+ "falconPackageHash": "839c469a9096dcc7300096729448633fc891eca2aea31f67e593e890"
33
33
  }