@wix/ditto-codegen-public 1.0.442 → 1.0.444

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 +231 -53
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -11810,6 +11810,84 @@ ${closeBrace}${tail}`;
11810
11810
  }
11811
11811
  });
11812
11812
 
11813
+ // dist/opencode-integration/model-knobs.js
11814
+ var require_model_knobs = __commonJS({
11815
+ "dist/opencode-integration/model-knobs.js"(exports2) {
11816
+ "use strict";
11817
+ Object.defineProperty(exports2, "__esModule", { value: true });
11818
+ exports2.DEFAULT_SMALL_MODEL = exports2.DEFAULT_MODEL = void 0;
11819
+ exports2.isOpenAiModel = isOpenAiModel;
11820
+ exports2.getModel = getModel;
11821
+ exports2.getSmallModel = getSmallModel;
11822
+ exports2.hasModelOverride = hasModelOverride;
11823
+ exports2.getReasoningEffort = getReasoningEffort;
11824
+ exports2.getSmallReasoningEffort = getSmallReasoningEffort;
11825
+ exports2.hasSmallReasoningEffortOverride = hasSmallReasoningEffortOverride;
11826
+ exports2.getOpenAiServiceTier = getOpenAiServiceTier;
11827
+ exports2.DEFAULT_MODEL = "anthropic/claude-sonnet-4-6";
11828
+ exports2.DEFAULT_SMALL_MODEL = "anthropic/claude-haiku-4-5-20251001";
11829
+ var SMALL_MODEL_REASONING_EFFORT = "medium";
11830
+ var REASONING_EFFORTS = ["xhigh", "high", "medium", "low"];
11831
+ var VALID_OPENAI_SERVICE_TIERS = [
11832
+ "auto",
11833
+ "default",
11834
+ "flex",
11835
+ "priority"
11836
+ ];
11837
+ function isOpenAiModel(model) {
11838
+ return model.startsWith("openai/");
11839
+ }
11840
+ function getModel() {
11841
+ return process.env.CODEGEN_MODEL_OVERRIDE || exports2.DEFAULT_MODEL;
11842
+ }
11843
+ function getSmallModel() {
11844
+ return process.env.CODEGEN_SMALL_MODEL_OVERRIDE || exports2.DEFAULT_SMALL_MODEL;
11845
+ }
11846
+ function hasModelOverride() {
11847
+ return !!process.env.CODEGEN_MODEL_OVERRIDE;
11848
+ }
11849
+ function readEnumEnv(name, allowed) {
11850
+ const value = process.env[name];
11851
+ if (!value)
11852
+ return void 0;
11853
+ if (!allowed.includes(value)) {
11854
+ throw new Error(`Unsupported ${name}: ${value} (expected one of ${allowed.join(", ")})`);
11855
+ }
11856
+ return value;
11857
+ }
11858
+ function getReasoningEffort() {
11859
+ const effort = readEnumEnv("CODEGEN_REASONING_EFFORT", REASONING_EFFORTS);
11860
+ if (!effort)
11861
+ return void 0;
11862
+ if (!isOpenAiModel(getModel()) || !isOpenAiModel(getSmallModel())) {
11863
+ throw new Error("CODEGEN_REASONING_EFFORT requires BOTH the main and small models to be openai/* \u2014 set CODEGEN_MODEL_OVERRIDE and CODEGEN_SMALL_MODEL_OVERRIDE (reasoning-effort variants are invalid on Anthropic models).");
11864
+ }
11865
+ return effort;
11866
+ }
11867
+ function getSmallReasoningEffort() {
11868
+ const effort = readEnumEnv("CODEGEN_SMALL_MODEL_REASONING_EFFORT", REASONING_EFFORTS);
11869
+ if (!effort)
11870
+ return SMALL_MODEL_REASONING_EFFORT;
11871
+ if (!isOpenAiModel(getSmallModel())) {
11872
+ throw new Error("CODEGEN_SMALL_MODEL_REASONING_EFFORT requires the small model to be openai/* \u2014 set CODEGEN_SMALL_MODEL_OVERRIDE (reasoning-effort variants are invalid on Anthropic models).");
11873
+ }
11874
+ return effort;
11875
+ }
11876
+ function hasSmallReasoningEffortOverride() {
11877
+ return !!process.env.CODEGEN_SMALL_MODEL_REASONING_EFFORT;
11878
+ }
11879
+ function getOpenAiServiceTier() {
11880
+ const tier = readEnumEnv("CODEGEN_OPENAI_SERVICE_TIER", VALID_OPENAI_SERVICE_TIERS);
11881
+ if (!tier)
11882
+ return void 0;
11883
+ if (!isOpenAiModel(getModel()) && !isOpenAiModel(getSmallModel())) {
11884
+ throw new Error("CODEGEN_OPENAI_SERVICE_TIER requires the main or small model to be openai/* \u2014 set CODEGEN_MODEL_OVERRIDE and/or CODEGEN_SMALL_MODEL_OVERRIDE (serviceTier applies only to openai models).");
11885
+ }
11886
+ return tier;
11887
+ }
11888
+ }
11889
+ });
11890
+
11813
11891
  // dist/opencode-integration/types.js
11814
11892
  var require_types4 = __commonJS({
11815
11893
  "dist/opencode-integration/types.js"(exports2) {
@@ -11828,15 +11906,18 @@ var require_types4 = __commonJS({
11828
11906
  }
11829
11907
  });
11830
11908
 
11831
- // dist/opencode-integration/subagents.js
11832
- var require_subagents = __commonJS({
11833
- "dist/opencode-integration/subagents.js"(exports2) {
11909
+ // dist/opencode-integration/agents.js
11910
+ var require_agents = __commonJS({
11911
+ "dist/opencode-integration/agents.js"(exports2) {
11834
11912
  "use strict";
11835
11913
  Object.defineProperty(exports2, "__esModule", { value: true });
11836
11914
  exports2.SUBAGENT_AGENT_NAMES = exports2.WDS_DOCS_SUBAGENT_NAME = exports2.WIX_DOCS_SUBAGENT_NAME = exports2.VALIDATOR_SUBAGENT_NAME = exports2.PRIMARY_AGENT_NAME = void 0;
11837
11915
  exports2.getAgentConfig = getAgentConfig;
11916
+ exports2.getMainAgentModel = getMainAgentModel;
11917
+ exports2.getSubagentModel = getSubagentModel;
11838
11918
  var types_1 = require_types4();
11839
11919
  var constants_1 = require_constants5();
11920
+ var model_knobs_1 = require_model_knobs();
11840
11921
  exports2.PRIMARY_AGENT_NAME = "codegen";
11841
11922
  exports2.VALIDATOR_SUBAGENT_NAME = "codegen-validator";
11842
11923
  exports2.WIX_DOCS_SUBAGENT_NAME = "codegen-wix-docs";
@@ -11986,10 +12067,26 @@ skills already cover. Read-only.`;
11986
12067
  /* OpenCodeTool.BatchWrite */
11987
12068
  ]: "allow"
11988
12069
  };
11989
- function getAgentConfig(smallModel) {
12070
+ var MODEL_VARIANTS = {
12071
+ "openai/gpt-5.6-luna": ["xhigh", "high", "medium", "low"],
12072
+ "openai/gpt-5.6-sol": ["xhigh", "high", "medium", "low"],
12073
+ "openai/gpt-5.6-terra": ["xhigh", "high", "medium", "low"]
12074
+ };
12075
+ function agentModel(model, opts = {}) {
12076
+ if (opts.variant && !MODEL_VARIANTS[model]?.includes(opts.variant)) {
12077
+ throw new Error(`Model ${model} does not support reasoning variant "${opts.variant}"`);
12078
+ }
12079
+ return {
12080
+ model,
12081
+ ...opts.variant ? { variant: opts.variant } : {},
12082
+ ...opts.options ? { options: opts.options } : {}
12083
+ };
12084
+ }
12085
+ function getAgentConfig(main2, subagent) {
11990
12086
  return {
11991
12087
  [exports2.PRIMARY_AGENT_NAME]: {
11992
12088
  mode: "primary",
12089
+ ...main2 ?? {},
11993
12090
  permission: {
11994
12091
  [
11995
12092
  "task"
@@ -12004,7 +12101,7 @@ skills already cover. Read-only.`;
12004
12101
  },
12005
12102
  [exports2.VALIDATOR_SUBAGENT_NAME]: {
12006
12103
  mode: "subagent",
12007
- model: smallModel,
12104
+ ...subagent,
12008
12105
  steps: 80,
12009
12106
  description: VALIDATOR_DESCRIPTION,
12010
12107
  prompt: VALIDATOR_PROMPT,
@@ -12030,7 +12127,7 @@ skills already cover. Read-only.`;
12030
12127
  },
12031
12128
  [exports2.WIX_DOCS_SUBAGENT_NAME]: {
12032
12129
  mode: "subagent",
12033
- model: smallModel,
12130
+ ...subagent,
12034
12131
  steps: 15,
12035
12132
  description: WIX_DOCS_DESCRIPTION,
12036
12133
  prompt: WIX_DOCS_PROMPT,
@@ -12050,7 +12147,7 @@ skills already cover. Read-only.`;
12050
12147
  },
12051
12148
  [exports2.WDS_DOCS_SUBAGENT_NAME]: {
12052
12149
  mode: "subagent",
12053
- model: smallModel,
12150
+ ...subagent,
12054
12151
  steps: 15,
12055
12152
  description: WDS_DOCS_DESCRIPTION,
12056
12153
  permission: {
@@ -12070,6 +12167,29 @@ skills already cover. Read-only.`;
12070
12167
  }
12071
12168
  };
12072
12169
  }
12170
+ function serviceTierOptions(model) {
12171
+ const tier = (0, model_knobs_1.getOpenAiServiceTier)();
12172
+ return tier && (0, model_knobs_1.isOpenAiModel)(model) ? { serviceTier: tier } : void 0;
12173
+ }
12174
+ function getMainAgentModel() {
12175
+ const effort = (0, model_knobs_1.getReasoningEffort)();
12176
+ const options = serviceTierOptions((0, model_knobs_1.getModel)());
12177
+ if (!effort && !options && !(0, model_knobs_1.hasModelOverride)())
12178
+ return void 0;
12179
+ return agentModel((0, model_knobs_1.getModel)(), {
12180
+ ...effort ? { variant: effort } : {},
12181
+ ...options ? { options } : {}
12182
+ });
12183
+ }
12184
+ function getSubagentModel() {
12185
+ const hasEffort = Boolean((0, model_knobs_1.getReasoningEffort)()) || (0, model_knobs_1.hasSmallReasoningEffortOverride)();
12186
+ const effort = hasEffort ? (0, model_knobs_1.getSmallReasoningEffort)() : void 0;
12187
+ const options = serviceTierOptions((0, model_knobs_1.getSmallModel)());
12188
+ return agentModel((0, model_knobs_1.getSmallModel)(), {
12189
+ ...effort ? { variant: effort } : {},
12190
+ ...options ? { options } : {}
12191
+ });
12192
+ }
12073
12193
  }
12074
12194
  });
12075
12195
 
@@ -14711,6 +14831,31 @@ For ANY use of a Wix Stores API (products, variants, inventory, collections/cate
14711
14831
  }
14712
14832
  });
14713
14833
 
14834
+ // ../codegen-common-logic/dist/rules/vertical-installation.js
14835
+ var require_vertical_installation = __commonJS({
14836
+ "../codegen-common-logic/dist/rules/vertical-installation.js"(exports2) {
14837
+ "use strict";
14838
+ Object.defineProperty(exports2, "__esModule", { value: true });
14839
+ exports2.VERTICAL_INSTALLATION_RULES = void 0;
14840
+ exports2.VERTICAL_INSTALLATION_RULES = `# Vertical Installation Rules
14841
+
14842
+ Code written against a Wix app this site doesn't have compiles, saves, and then does nothing.
14843
+
14844
+ For ANY use of a Wix vertical SDK (Stores, eCommerce, Bookings, Restaurants, Pricing Plans, Gift Cards, Blog, Events, Portfolio, Members Area, Forms, Loyalty Program, Donations):
14845
+
14846
+ 1. **You MUST invoke the \`wix-site-installed-apps\` skill before your FIRST write of any kind** \u2014 not merely before the vertical code itself. The build workflow tells you to write each piece as soon as it is ready, so a dashboard shell written before you reach the vertical part is still work rule 2 will make you undo. Name the apps this request needs, by product name; ask in one call and reuse the answer.
14847
+ 2. **If any app comes back \`installed: false\`, STOP. Write no code at all** \u2014 not for that app, and not for the rest of the request either. Your reply is **one** short message to the site owner, naming the app and which parts of the request you did not attempt, and nothing else. Write the outcome, never the mechanism: no rule, no skill, no check or verdict, no app id or endpoint, and no sentence announcing that you are stopping \u2014 the user doesn't know what any of that is, and reading it as an error is the likeliest outcome. \\"Wix Events isn't installed on your site, so I couldn't build the upcoming-events page. Install Wix Events from your dashboard, then ask again and I'll build it.\\" \u2014 that shape, once. **If you have already created or modified files in this session, undo those changes before replying \u2014 path by path, naming each file you wrote, never a bulk revert of the working tree (\`git clean\`, \`git checkout .\`, \`git reset --hard\`, or any "discard all changes"), which also destroys work that was there before you** \u2014 a half-built app that saves is worse than either outcome this rule chooses between.
14848
+ 3. **Do not soften rule 2.** No partial build, no stub, no CMS collection standing in for the app, no "for when they install it" path, and no offering to build the parts that would work. The site owner installs the app, then asks again. **Where the OUTPUT MESSAGE instruction says to build the feature and list installing a dependent app as a "next step", this rule wins** \u2014 for a missing app there is no build, so there is no next step to list against it.
14849
+ 4. **\`installed: null\`, or the check itself failing: build, and say the app may need installing.** A verdict you can't trust never stops anything. The exception is a \`null\` carrying \`"reason":"not-installable"\` \u2014 the check refuses that name because there is no app behind it to install: build, and name nothing. Some plain \`null\`s are platform features with nothing to install either \u2014 contacts, coupons, automations and triggered emails, login and logged-in-only gating \u2014 so build and name nothing for those too.
14850
+ 5. **This outranks the plan.** A blueprint summary or extension description naming a missing app was written without knowing the site; rule 2 wins, and your reply says which planned parts you left unbuilt.
14851
+ 6. **Never install an app** \u2014 it adds pages, a cart, and checkout to the user's live site.
14852
+
14853
+ CMS is exempt: \`wix-site-data-collection\` installs it, so CMS work is never blocked and CMS is never named as missing.
14854
+
14855
+ Two names answer nothing: **"Wix CMS"** (the published id is a variant nobody can install) and **"Wix eCommerce"** (cart and checkout have no standalone install \u2014 they arrive with a catalog app). The check refuses both, answering \`installed: null\` with \`"reason":"not-installable"\`, so asking is harmless but decides nothing. For an eCommerce feature, gate on the catalog app it needs instead \u2014 Wix Stores, Wix Bookings, or the specific Wix Restaurants app \u2014 and never tell the user to install eCommerce or CMS.`;
14856
+ }
14857
+ });
14858
+
14714
14859
  // ../codegen-common-logic/dist/rules/index.js
14715
14860
  var require_rules = __commonJS({
14716
14861
  "../codegen-common-logic/dist/rules/index.js"(exports2) {
@@ -14734,6 +14879,7 @@ var require_rules = __commonJS({
14734
14879
  Object.defineProperty(exports2, "__esModule", { value: true });
14735
14880
  __exportStar2(require_site_data_layer(), exports2);
14736
14881
  __exportStar2(require_stores_catalog_version(), exports2);
14882
+ __exportStar2(require_vertical_installation(), exports2);
14737
14883
  }
14738
14884
  });
14739
14885
 
@@ -14747,6 +14893,10 @@ var require_site_environment = __commonJS({
14747
14893
  exports2.SITE_ENVIRONMENT_IDENTITY = "You generate code for the user's own live Wix site \u2014 to the user it's just their site, not a separate app they're aware of. Your changes are saved and applied to the site automatically; there is no separate release step.";
14748
14894
  exports2.SITE_CODEGEN_RULES = [
14749
14895
  { filename: "site-data-layer-rules.md", content: rules_1.SITE_DATA_LAYER_RULES },
14896
+ {
14897
+ filename: "vertical-installation-rules.md",
14898
+ content: rules_1.VERTICAL_INSTALLATION_RULES
14899
+ },
14750
14900
  {
14751
14901
  filename: "stores-catalog-version-rules.md",
14752
14902
  content: rules_1.STORES_CATALOG_VERSION_RULES
@@ -15348,7 +15498,7 @@ MINIMIZE TEXT OUTPUT \u2014 CRITICAL:
15348
15498
 
15349
15499
  TOOL USAGE:
15350
15500
  - \`validate\` (tsc + build) is run by the \`codegen-validator\` subagent \u2014 do NOT call it directly; delegate via \`task\` at step 5.
15351
- - \`task\` delegates to haiku subagents: \`codegen-validator\` (step 5; see step 5 for the exact prompt), \`codegen-wix-docs\` (step 2; to SEARCH/discover an unknown Wix SDK method/shape/scope ID via wix-mcp), \`codegen-wds-docs\` (step 2; to discover WDS components/props you don't know). Docs subagents are for DISCOVERY only \u2014 give them a QUESTION ("which method lists X?"), never a known article URL to fetch.
15501
+ - \`task\` delegates to subagents: \`codegen-validator\` (step 5; see step 5 for the exact prompt), \`codegen-wix-docs\` (step 2; to SEARCH/discover an unknown Wix SDK method/shape/scope ID via wix-mcp), \`codegen-wds-docs\` (step 2; to discover WDS components/props you don't know). Docs subagents are for DISCOVERY only \u2014 give them a QUESTION ("which method lists X?"), never a known article URL to fetch.
15352
15502
  - Each \`task\` round-trip is EXPENSIVE (~90s of subagent startup, regardless of how small the question). So minimize them: ask ONE comprehensive question per API that returns everything you need at once \u2014 method name + FULL call signature + parameter shapes + required scope IDs. NEVER do a broad "find the X SDK" call and then a follow-up "what's the exact signature" call \u2014 that is two ~90s round-trips for one answer. Batch all your unknowns for a domain into a single delegation.
15353
15503
  - If BOTH docs subagents are needed, fire both \`task\` calls in ONE response (parallel), never serially.
15354
15504
  - \`uuid\` to generate UUIDs (supports count param for multiple). Do NOT use bash.
@@ -15650,25 +15800,31 @@ var require_config = __commonJS({
15650
15800
  "dist/opencode-integration/config.js"(exports2) {
15651
15801
  "use strict";
15652
15802
  Object.defineProperty(exports2, "__esModule", { value: true });
15653
- exports2.DEFAULT_SMALL_MODEL = exports2.DEFAULT_MODEL = exports2.DEFAULT_TIMEOUT_MS = void 0;
15803
+ exports2.DEFAULT_TIMEOUT_MS = void 0;
15654
15804
  exports2.getAnthropicBaseUrl = getAnthropicBaseUrl;
15805
+ exports2.getOpenAiBaseUrl = getOpenAiBaseUrl;
15655
15806
  exports2.setCurrentAccessToken = setCurrentAccessToken;
15656
15807
  exports2.getCurrentAccessToken = getCurrentAccessToken;
15657
15808
  exports2.getOpenCodeEnv = getOpenCodeEnv;
15658
15809
  var os_1 = require("os");
15659
15810
  var ditto_codegen_types_12 = require_dist4();
15660
15811
  var constants_1 = require_constants5();
15661
- var subagents_1 = require_subagents();
15812
+ var model_knobs_1 = require_model_knobs();
15813
+ var agents_1 = require_agents();
15662
15814
  var rules_writer_12 = require_rules_writer();
15663
15815
  var environments_12 = require_environments();
15664
15816
  var CodeGenService_12 = require_CodeGenService();
15665
15817
  exports2.DEFAULT_TIMEOUT_MS = 20 * 60 * 1e3;
15666
- exports2.DEFAULT_MODEL = "anthropic/claude-sonnet-4-6";
15667
- exports2.DEFAULT_SMALL_MODEL = "anthropic/claude-haiku-4-5-20251001";
15818
+ function usesOpenAiProvider() {
15819
+ return (0, model_knobs_1.isOpenAiModel)((0, model_knobs_1.getModel)()) || (0, model_knobs_1.isOpenAiModel)((0, model_knobs_1.getSmallModel)());
15820
+ }
15668
15821
  var AI_PROXY_BASE_URL = process.env.CODEGEN_AI_PROXY_BASE_URL || "http://localhost:3001";
15669
15822
  function getAnthropicBaseUrl(projectId) {
15670
15823
  return `${AI_PROXY_BASE_URL}/projects/${projectId}/genai/anthropic`;
15671
15824
  }
15825
+ function getOpenAiBaseUrl(projectId) {
15826
+ return `${AI_PROXY_BASE_URL}/projects/${projectId}/genai/openai`;
15827
+ }
15672
15828
  var currentAccessToken = process.env.WIX_ACCESS_TOKEN;
15673
15829
  function setCurrentAccessToken(token) {
15674
15830
  currentAccessToken = token;
@@ -15683,7 +15839,7 @@ var require_config = __commonJS({
15683
15839
  ".git/**",
15684
15840
  ".astro/**"
15685
15841
  ];
15686
- function getProviderConfig() {
15842
+ function getProviderConfig(projectId) {
15687
15843
  const environment = (0, environments_12.getValidatedCodegenEnvironment)();
15688
15844
  const chargingMode = (0, environments_12.getCodegenEnvironmentConfig)().chargingMode ?? "app";
15689
15845
  const headers = {
@@ -15696,7 +15852,7 @@ var require_config = __commonJS({
15696
15852
  // authorize the project.
15697
15853
  ...currentAccessToken ? { Authorization: `Bearer ${currentAccessToken}` } : {}
15698
15854
  };
15699
- return {
15855
+ const provider = {
15700
15856
  anthropic: {
15701
15857
  options: {
15702
15858
  apiKey: "proxy-handled",
@@ -15705,6 +15861,19 @@ var require_config = __commonJS({
15705
15861
  }
15706
15862
  }
15707
15863
  };
15864
+ if (usesOpenAiProvider()) {
15865
+ provider.openai = {
15866
+ options: {
15867
+ // Load-bearing: @ai-sdk/openai turns this into `Authorization: Bearer
15868
+ // proxy-handled`; only the headers-spread order lets the Wix token win, so
15869
+ // don't "clean up" apiKey — removing it 403s every openai request.
15870
+ apiKey: "proxy-handled",
15871
+ baseURL: getOpenAiBaseUrl(projectId),
15872
+ headers
15873
+ }
15874
+ };
15875
+ }
15876
+ return provider;
15708
15877
  }
15709
15878
  var WIX_MCP_CONFIG = {
15710
15879
  [constants_1.WIX_MCP_SERVER_NAME]: {
@@ -15797,11 +15966,13 @@ var require_config = __commonJS({
15797
15966
  ]: "deny",
15798
15967
  external_directory: READABLE_EXTERNAL_DIRS
15799
15968
  };
15800
- function buildConfig(instructionPaths, permission, { isCodeWritingFlow = false, withAgents = false } = {}) {
15969
+ function buildConfig(projectId, instructionPaths, permission, { isCodeWritingFlow = false, withAgents = false } = {}) {
15970
+ const main2 = (0, agents_1.getMainAgentModel)();
15971
+ const subagent = (0, agents_1.getSubagentModel)();
15801
15972
  return {
15802
- model: exports2.DEFAULT_MODEL,
15803
- small_model: exports2.DEFAULT_SMALL_MODEL,
15804
- provider: getProviderConfig(),
15973
+ model: (0, model_knobs_1.getModel)(),
15974
+ small_model: (0, model_knobs_1.getSmallModel)(),
15975
+ provider: getProviderConfig(projectId),
15805
15976
  compaction: { prune: true },
15806
15977
  // drop old tool outputs so --continue replays stay bounded
15807
15978
  permission,
@@ -15814,8 +15985,8 @@ var require_config = __commonJS({
15814
15985
  // not: its primary agent re-opens `task`, which would let the write-capable
15815
15986
  // validator subagent run in a flow meant to stay read-only.
15816
15987
  ...withAgents ? {
15817
- agent: (0, subagents_1.getAgentConfig)(exports2.DEFAULT_SMALL_MODEL),
15818
- default_agent: subagents_1.PRIMARY_AGENT_NAME
15988
+ agent: (0, agents_1.getAgentConfig)(main2, subagent),
15989
+ default_agent: agents_1.PRIMARY_AGENT_NAME
15819
15990
  } : {}
15820
15991
  };
15821
15992
  }
@@ -15833,6 +16004,9 @@ var require_config = __commonJS({
15833
16004
  ...process.env,
15834
16005
  PATH: ensureOpenCodeInPath(),
15835
16006
  ANTHROPIC_BASE_URL: anthropicBaseUrl,
16007
+ // The provider block sets baseURL too; this also covers any AI-SDK path that
16008
+ // reads the env.
16009
+ ...usesOpenAiProvider() ? { OPENAI_BASE_URL: getOpenAiBaseUrl(projectId) } : {},
15836
16010
  OPENCODE_CONFIG_CONTENT: JSON.stringify(config),
15837
16011
  OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS: exports2.DEFAULT_TIMEOUT_MS.toString(),
15838
16012
  OPENCODE_DISABLE_LSP_DOWNLOAD: "true",
@@ -15840,21 +16014,21 @@ var require_config = __commonJS({
15840
16014
  };
15841
16015
  }
15842
16016
  function getOpenCodeEnv(projectId, kind) {
15843
- return buildOpenCodeEnv(projectId, buildConfigForKind(kind));
16017
+ return buildOpenCodeEnv(projectId, buildConfigForKind(projectId, kind));
15844
16018
  }
15845
- function buildConfigForKind(kind) {
16019
+ function buildConfigForKind(projectId, kind) {
15846
16020
  const env = (0, environments_12.getCodegenEnvironmentConfig)();
15847
16021
  const paths = (rules) => rules.map((r) => (0, rules_writer_12.getRulePath)(r.filename));
15848
16022
  switch (kind) {
15849
16023
  case CodeGenService_12.TaskKind.ASK_CODEGEN:
15850
- return buildConfig(paths(env.askRules), ASK_PERMISSIONS);
16024
+ return buildConfig(projectId, paths(env.askRules), ASK_PERMISSIONS);
15851
16025
  case CodeGenService_12.TaskKind.FIX_GIT_CONFLICTS:
15852
- return buildConfig(paths(env.gitConflictsRules), GIT_CONFLICTS_PERMISSIONS, {
16026
+ return buildConfig(projectId, paths(env.gitConflictsRules), GIT_CONFLICTS_PERMISSIONS, {
15853
16027
  isCodeWritingFlow: true,
15854
16028
  withAgents: true
15855
16029
  });
15856
16030
  default:
15857
- return buildConfig(paths(env.codegenRules), CODEGEN_PERMISSIONS, {
16031
+ return buildConfig(projectId, paths(env.codegenRules), CODEGEN_PERMISSIONS, {
15858
16032
  isCodeWritingFlow: true,
15859
16033
  withAgents: true
15860
16034
  });
@@ -15892,7 +16066,7 @@ var require_subagent_tool_logger = __commonJS({
15892
16066
  exports2.buildSubagentToolLoggerPluginSource = buildSubagentToolLoggerPluginSource;
15893
16067
  exports2.writeSubagentToolLoggerPlugin = writeSubagentToolLoggerPlugin;
15894
16068
  var generated_plugins_1 = require_generated_plugins();
15895
- var subagents_1 = require_subagents();
16069
+ var agents_1 = require_agents();
15896
16070
  exports2.SUBAGENT_TOOL_EVENT_TYPE = "subagent_tool_use";
15897
16071
  exports2.SUBAGENT_STARTED_EVENT_TYPE = "subagent_started";
15898
16072
  var PLUGIN_FILENAME = "subagent-tool-logger.ts";
@@ -15900,7 +16074,7 @@ var require_subagent_tool_logger = __commonJS({
15900
16074
  return `// Generated by @wix/ditto-codegen (subagent-tool-logger) \u2014 do not edit.
15901
16075
  const EVENT_TYPE = ${JSON.stringify(exports2.SUBAGENT_TOOL_EVENT_TYPE)};
15902
16076
  const STARTED_EVENT_TYPE = ${JSON.stringify(exports2.SUBAGENT_STARTED_EVENT_TYPE)};
15903
- const SUBAGENT_AGENTS = new Set(${JSON.stringify(subagents_1.SUBAGENT_AGENT_NAMES)});
16077
+ const SUBAGENT_AGENTS = new Set(${JSON.stringify(agents_1.SUBAGENT_AGENT_NAMES)});
15904
16078
 
15905
16079
  export const SubagentToolLogger = async () => {
15906
16080
  // sessionID -> agent name, learned from session.* / message.updated (both
@@ -16030,7 +16204,7 @@ var require_parser = __commonJS({
16030
16204
  exports2.parseValidatorTaskOutputs = parseValidatorTaskOutputs;
16031
16205
  exports2.summarizeOpenCodeLine = summarizeOpenCodeLine;
16032
16206
  var types_1 = require_types4();
16033
- var subagents_1 = require_subagents();
16207
+ var agents_1 = require_agents();
16034
16208
  var subagent_tool_logger_12 = require_subagent_tool_logger();
16035
16209
  function parseRequiredPermissions(output) {
16036
16210
  let permissions = [];
@@ -16174,7 +16348,7 @@ var require_parser = __commonJS({
16174
16348
  continue;
16175
16349
  }
16176
16350
  const { title, output, input } = event.part.state;
16177
- const isValidator = input?.subagent_type === subagents_1.VALIDATOR_SUBAGENT_NAME || title?.includes(subagents_1.VALIDATOR_SUBAGENT_NAME);
16351
+ const isValidator = input?.subagent_type === agents_1.VALIDATOR_SUBAGENT_NAME || title?.includes(agents_1.VALIDATOR_SUBAGENT_NAME);
16178
16352
  if (isValidator && output) {
16179
16353
  outputs.push(output.trim());
16180
16354
  }
@@ -16428,11 +16602,11 @@ var require_derived_progress = __commonJS({
16428
16602
  exports2.deriveProgressSteps = deriveProgressSteps;
16429
16603
  var ditto_codegen_types_12 = require_dist4();
16430
16604
  var constants_1 = require_constants5();
16431
- var subagents_1 = require_subagents();
16605
+ var agents_1 = require_agents();
16432
16606
  var SUBAGENT_STEPS = {
16433
- [subagents_1.VALIDATOR_SUBAGENT_NAME]: "Building project",
16434
- [subagents_1.WIX_DOCS_SUBAGENT_NAME]: "Reading documentation",
16435
- [subagents_1.WDS_DOCS_SUBAGENT_NAME]: "Reading documentation"
16607
+ [agents_1.VALIDATOR_SUBAGENT_NAME]: "Building project",
16608
+ [agents_1.WIX_DOCS_SUBAGENT_NAME]: "Reading documentation",
16609
+ [agents_1.WDS_DOCS_SUBAGENT_NAME]: "Reading documentation"
16436
16610
  };
16437
16611
  var REGISTRY_FILE_PATTERN = /(^|\/)extensions\.ts$/;
16438
16612
  var EXTENSION_DEFINITION_PATTERN = /\.extension\.ts$/;
@@ -22800,7 +22974,7 @@ var require_opencode_init = __commonJS({
22800
22974
  var types_1 = require_types_impl();
22801
22975
  var context_12 = require_context();
22802
22976
  var logger_12 = require_logger();
22803
- var config_12 = require_config();
22977
+ var model_knobs_1 = require_model_knobs();
22804
22978
  var git_file_changes_1 = require_git_file_changes();
22805
22979
  var inject_created_by_1 = require_inject_created_by();
22806
22980
  var collect_extensions_created_1 = require_collect_extensions_created();
@@ -22820,6 +22994,7 @@ var require_opencode_init = __commonJS({
22820
22994
  const environment = process.env.CODEGEN_ENVIRONMENT ?? types_1.Environment.UNKNOWN_ENVIRONMENT;
22821
22995
  const flowStartTime = Date.now();
22822
22996
  store.flowStartTime = flowStartTime;
22997
+ const taskModel = (0, model_knobs_1.getModel)();
22823
22998
  const biBase = {
22824
22999
  jobId,
22825
23000
  taskId,
@@ -22834,7 +23009,7 @@ var require_opencode_init = __commonJS({
22834
23009
  logger_12.logger.info("[OpenCode Init] Marked task RUNNING", { taskId });
22835
23010
  await (0, biEvents_1.reportSessionStart)({
22836
23011
  ...biBase,
22837
- taskModel: config_12.DEFAULT_MODEL,
23012
+ taskModel,
22838
23013
  taskType: kind,
22839
23014
  jobInput: userInput
22840
23015
  });
@@ -22888,7 +23063,7 @@ var require_opencode_init = __commonJS({
22888
23063
  }
22889
23064
  await (0, biEvents_1.reportSessionEnd)({
22890
23065
  ...biBase,
22891
- taskModel: config_12.DEFAULT_MODEL,
23066
+ taskModel,
22892
23067
  taskType: kind,
22893
23068
  taskCost: Math.round(result.usage.cost * 1e6),
22894
23069
  taskStatus: ditto_codegen_types_12.Status.COMPLETED,
@@ -22907,7 +23082,7 @@ var require_opencode_init = __commonJS({
22907
23082
  const taskCost = orchestrator.lastUsage ? Math.round(orchestrator.lastUsage.cost * 1e6) : void 0;
22908
23083
  await (0, biEvents_1.reportSessionEnd)({
22909
23084
  ...biBase,
22910
- taskModel: config_12.DEFAULT_MODEL,
23085
+ taskModel,
22911
23086
  taskType: kind,
22912
23087
  taskCost,
22913
23088
  taskStatus: ditto_codegen_types_12.Status.FAILED,
@@ -22916,7 +23091,7 @@ var require_opencode_init = __commonJS({
22916
23091
  });
22917
23092
  await (0, biEvents_1.reportSessionError)({
22918
23093
  ...biBase,
22919
- taskModel: config_12.DEFAULT_MODEL,
23094
+ taskModel,
22920
23095
  taskType: kind,
22921
23096
  agentOutput: JSON.stringify(codegenError),
22922
23097
  errorDesc: codegenError.errorType,
@@ -23009,7 +23184,7 @@ var require_opencode_iterate = __commonJS({
23009
23184
  var ditto_codegen_types_2 = require_dist4();
23010
23185
  var context_12 = require_context();
23011
23186
  var logger_12 = require_logger();
23012
- var config_12 = require_config();
23187
+ var model_knobs_1 = require_model_knobs();
23013
23188
  var git_file_changes_1 = require_git_file_changes();
23014
23189
  var inject_created_by_1 = require_inject_created_by();
23015
23190
  var collect_extensions_created_1 = require_collect_extensions_created();
@@ -23027,6 +23202,7 @@ var require_opencode_iterate = __commonJS({
23027
23202
  const environment = process.env.CODEGEN_ENVIRONMENT ?? types_1.Environment.UNKNOWN_ENVIRONMENT;
23028
23203
  const flowStartTime = Date.now();
23029
23204
  store.flowStartTime = flowStartTime;
23205
+ const taskModel = (0, model_knobs_1.getModel)();
23030
23206
  const biBase = {
23031
23207
  jobId,
23032
23208
  taskId,
@@ -23041,7 +23217,7 @@ var require_opencode_iterate = __commonJS({
23041
23217
  logger_12.logger.info("[OpenCode Iterate] Marked task RUNNING", { taskId });
23042
23218
  await (0, biEvents_1.reportSessionStart)({
23043
23219
  ...biBase,
23044
- taskModel: config_12.DEFAULT_MODEL,
23220
+ taskModel,
23045
23221
  taskType: kind,
23046
23222
  jobInput: userInput
23047
23223
  });
@@ -23085,7 +23261,7 @@ var require_opencode_iterate = __commonJS({
23085
23261
  });
23086
23262
  await (0, biEvents_1.reportSessionEnd)({
23087
23263
  ...biBase,
23088
- taskModel: config_12.DEFAULT_MODEL,
23264
+ taskModel,
23089
23265
  taskType: kind,
23090
23266
  taskCost: Math.round(result.usage.cost * 1e6),
23091
23267
  taskStatus: ditto_codegen_types_12.Status.COMPLETED,
@@ -23104,7 +23280,7 @@ var require_opencode_iterate = __commonJS({
23104
23280
  const taskCost = iterationOrchestrator.lastUsage ? Math.round(iterationOrchestrator.lastUsage.cost * 1e6) : void 0;
23105
23281
  await (0, biEvents_1.reportSessionEnd)({
23106
23282
  ...biBase,
23107
- taskModel: config_12.DEFAULT_MODEL,
23283
+ taskModel,
23108
23284
  taskType: kind,
23109
23285
  taskCost,
23110
23286
  taskStatus: ditto_codegen_types_12.Status.FAILED,
@@ -23113,7 +23289,7 @@ var require_opencode_iterate = __commonJS({
23113
23289
  });
23114
23290
  await (0, biEvents_1.reportSessionError)({
23115
23291
  ...biBase,
23116
- taskModel: config_12.DEFAULT_MODEL,
23292
+ taskModel,
23117
23293
  taskType: kind,
23118
23294
  agentOutput: JSON.stringify(codegenError),
23119
23295
  errorDesc: codegenError.errorType,
@@ -23203,7 +23379,7 @@ var require_opencode_ask = __commonJS({
23203
23379
  var ditto_codegen_types_2 = require_dist4();
23204
23380
  var context_12 = require_context();
23205
23381
  var logger_12 = require_logger();
23206
- var config_12 = require_config();
23382
+ var model_knobs_1 = require_model_knobs();
23207
23383
  var git_file_changes_1 = require_git_file_changes();
23208
23384
  var inject_created_by_1 = require_inject_created_by();
23209
23385
  var collect_extensions_created_1 = require_collect_extensions_created();
@@ -23218,6 +23394,7 @@ var require_opencode_ask = __commonJS({
23218
23394
  const environment = process.env.CODEGEN_ENVIRONMENT ?? types_1.Environment.UNKNOWN_ENVIRONMENT;
23219
23395
  const flowStartTime = Date.now();
23220
23396
  store.flowStartTime = flowStartTime;
23397
+ const taskModel = (0, model_knobs_1.getModel)();
23221
23398
  const biBase = {
23222
23399
  jobId,
23223
23400
  taskId,
@@ -23232,7 +23409,7 @@ var require_opencode_ask = __commonJS({
23232
23409
  logger_12.logger.info("[OpenCode Ask] Marked task RUNNING", { taskId });
23233
23410
  await (0, biEvents_1.reportSessionStart)({
23234
23411
  ...biBase,
23235
- taskModel: config_12.DEFAULT_MODEL,
23412
+ taskModel,
23236
23413
  taskType: kind,
23237
23414
  jobInput: userInput
23238
23415
  });
@@ -23263,7 +23440,7 @@ var require_opencode_ask = __commonJS({
23263
23440
  });
23264
23441
  await (0, biEvents_1.reportSessionEnd)({
23265
23442
  ...biBase,
23266
- taskModel: config_12.DEFAULT_MODEL,
23443
+ taskModel,
23267
23444
  taskType: kind,
23268
23445
  taskCost: Math.round(result.usage.cost * 1e6),
23269
23446
  taskStatus: ditto_codegen_types_12.Status.COMPLETED,
@@ -23285,7 +23462,7 @@ var require_opencode_ask = __commonJS({
23285
23462
  const taskCost = askOrchestrator.lastUsage ? Math.round(askOrchestrator.lastUsage.cost * 1e6) : void 0;
23286
23463
  await (0, biEvents_1.reportSessionEnd)({
23287
23464
  ...biBase,
23288
- taskModel: config_12.DEFAULT_MODEL,
23465
+ taskModel,
23289
23466
  taskType: kind,
23290
23467
  taskCost,
23291
23468
  taskStatus: ditto_codegen_types_12.Status.FAILED,
@@ -23294,7 +23471,7 @@ var require_opencode_ask = __commonJS({
23294
23471
  });
23295
23472
  await (0, biEvents_1.reportSessionError)({
23296
23473
  ...biBase,
23297
- taskModel: config_12.DEFAULT_MODEL,
23474
+ taskModel,
23298
23475
  taskType: kind,
23299
23476
  agentOutput: JSON.stringify(codegenError),
23300
23477
  errorDesc: codegenError.errorType,
@@ -23383,7 +23560,7 @@ var require_opencode_fix_git_conflicts = __commonJS({
23383
23560
  var codegen_flow_helpers_12 = require_codegen_flow_helpers();
23384
23561
  var context_12 = require_context();
23385
23562
  var logger_12 = require_logger();
23386
- var config_12 = require_config();
23563
+ var model_knobs_1 = require_model_knobs();
23387
23564
  var git_file_changes_1 = require_git_file_changes();
23388
23565
  var collect_extensions_created_1 = require_collect_extensions_created();
23389
23566
  var executor_1 = require_executor();
@@ -23400,6 +23577,7 @@ var require_opencode_fix_git_conflicts = __commonJS({
23400
23577
  const environment = process.env.CODEGEN_ENVIRONMENT ?? types_1.Environment.UNKNOWN_ENVIRONMENT;
23401
23578
  const flowStartTime = Date.now();
23402
23579
  store.flowStartTime = flowStartTime;
23580
+ const taskModel = (0, model_knobs_1.getModel)();
23403
23581
  const biBase = {
23404
23582
  jobId,
23405
23583
  taskId,
@@ -23414,7 +23592,7 @@ var require_opencode_fix_git_conflicts = __commonJS({
23414
23592
  logger_12.logger.info("[OpenCode Git Conflicts] Marked task RUNNING", { taskId });
23415
23593
  await (0, biEvents_1.reportSessionStart)({
23416
23594
  ...biBase,
23417
- taskModel: config_12.DEFAULT_MODEL,
23595
+ taskModel,
23418
23596
  taskType: kind
23419
23597
  });
23420
23598
  const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
@@ -23453,7 +23631,7 @@ var require_opencode_fix_git_conflicts = __commonJS({
23453
23631
  });
23454
23632
  await (0, biEvents_1.reportSessionEnd)({
23455
23633
  ...biBase,
23456
- taskModel: config_12.DEFAULT_MODEL,
23634
+ taskModel,
23457
23635
  taskType: kind,
23458
23636
  taskCost: Math.round(result.usage.cost * 1e6),
23459
23637
  taskStatus: ditto_codegen_types_12.Status.COMPLETED,
@@ -23477,7 +23655,7 @@ var require_opencode_fix_git_conflicts = __commonJS({
23477
23655
  const taskCost = orchestrator.lastUsage ? Math.round(orchestrator.lastUsage.cost * 1e6) : void 0;
23478
23656
  await (0, biEvents_1.reportSessionEnd)({
23479
23657
  ...biBase,
23480
- taskModel: config_12.DEFAULT_MODEL,
23658
+ taskModel,
23481
23659
  taskType: kind,
23482
23660
  taskCost,
23483
23661
  taskStatus: ditto_codegen_types_12.Status.FAILED,
@@ -23486,7 +23664,7 @@ var require_opencode_fix_git_conflicts = __commonJS({
23486
23664
  });
23487
23665
  await (0, biEvents_1.reportSessionError)({
23488
23666
  ...biBase,
23489
- taskModel: config_12.DEFAULT_MODEL,
23667
+ taskModel,
23490
23668
  taskType: kind,
23491
23669
  agentOutput: JSON.stringify(codegenError),
23492
23670
  errorDesc: codegenError.errorType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.442",
3
+ "version": "1.0.444",
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": "19c7b1e106b5b7a1aa3bc62b9fc8ebae4ce01f8641d5971c6e7138c3"
32
+ "falconPackageHash": "5586151659b98dc4763183479e5853a3d0c6e39e3187fd3a48a7096e"
33
33
  }