@wix/ditto-codegen-public 1.0.518 → 1.0.519

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 +67 -8
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -10523,6 +10523,7 @@ var require_logger = __commonJS({
10523
10523
  }
10524
10524
  exports2.logger = (() => {
10525
10525
  const environment = process.env.CODEGEN_ENVIRONMENT;
10526
+ const siteEditor = process.env.SITE_EDITOR;
10526
10527
  const modelOverride = process.env.CODEGEN_MODEL_OVERRIDE;
10527
10528
  const smallModelOverride = process.env.CODEGEN_SMALL_MODEL_OVERRIDE;
10528
10529
  const getContextLogger = () => {
@@ -10531,6 +10532,7 @@ var require_logger = __commonJS({
10531
10532
  ...jobId ? { jobId } : {},
10532
10533
  ...metasiteId ? { metasiteId } : {},
10533
10534
  ...environment ? { environment } : {},
10535
+ ...siteEditor ? { siteEditor } : {},
10534
10536
  ...modelOverride ? { modelOverride } : {},
10535
10537
  ...smallModelOverride ? { smallModelOverride } : {}
10536
10538
  };
@@ -13081,6 +13083,35 @@ ${STUDIO_2_SITE_UI_ROUTING}`
13081
13083
  }
13082
13084
  });
13083
13085
 
13086
+ // ../codegen-common-logic/dist/tool-policies/harmony.js
13087
+ var require_harmony = __commonJS({
13088
+ "../codegen-common-logic/dist/tool-policies/harmony.js"(exports2) {
13089
+ "use strict";
13090
+ Object.defineProperty(exports2, "__esModule", { value: true });
13091
+ exports2.HARMONY_CC_POLICIES = exports2.HARMONY_SKILL_ROUTING_POLICY = exports2.HARMONY_GENERATE_POLICY = exports2.HARMONY_ALLOWED_EXTENSION_TYPES = void 0;
13092
+ var studio_2_1 = require_studio_2();
13093
+ exports2.HARMONY_ALLOWED_EXTENSION_TYPES = ["EDITOR_REACT_COMPONENT"];
13094
+ exports2.HARMONY_GENERATE_POLICY = {
13095
+ type: "generate",
13096
+ allowedExtensionTypes: exports2.HARMONY_ALLOWED_EXTENSION_TYPES,
13097
+ message: `BLOCKED: this host only supports Editor React Components. Build the request as an Editor React Component (extensionType: EDITOR_REACT_COMPONENT) instead. Do not retry with another extension type.`
13098
+ };
13099
+ exports2.HARMONY_SKILL_ROUTING_POLICY = {
13100
+ type: "skillContent",
13101
+ skillNames: ["wix-app"],
13102
+ message: `ENVIRONMENT OVERRIDE: this skill's extension-type routing does not apply in this environment. Every artifact in this host is an Editor React Component (\`extensionType: EDITOR_REACT_COMPONENT\`); pages, lightboxes, site plugins, custom elements and every other extension type are unavailable, even if the prompt asks for one.`
13103
+ };
13104
+ exports2.HARMONY_CC_POLICIES = [
13105
+ studio_2_1.CUSTOM_ELEMENT_REFERENCES_POLICY,
13106
+ exports2.HARMONY_SKILL_ROUTING_POLICY,
13107
+ studio_2_1.STUDIO_2_PREVIEW_RELEASE_POLICY,
13108
+ studio_2_1.STUDIO_2_CUSTOM_ELEMENT_GENERATE_POLICY,
13109
+ studio_2_1.STUDIO_2_BRANDED_COMPONENTS_POLICY,
13110
+ exports2.HARMONY_GENERATE_POLICY
13111
+ ];
13112
+ }
13113
+ });
13114
+
13084
13115
  // ../codegen-common-logic/dist/tool-policies/index.js
13085
13116
  var require_tool_policies2 = __commonJS({
13086
13117
  "../codegen-common-logic/dist/tool-policies/index.js"(exports2) {
@@ -13104,6 +13135,7 @@ var require_tool_policies2 = __commonJS({
13104
13135
  Object.defineProperty(exports2, "__esModule", { value: true });
13105
13136
  __exportStar2(require_site(), exports2);
13106
13137
  __exportStar2(require_studio_2(), exports2);
13138
+ __exportStar2(require_harmony(), exports2);
13107
13139
  }
13108
13140
  });
13109
13141
 
@@ -14147,7 +14179,7 @@ var require_dist8 = __commonJS({
14147
14179
  "../codegen-studio-2-config/dist/index.js"(exports2) {
14148
14180
  "use strict";
14149
14181
  Object.defineProperty(exports2, "__esModule", { value: true });
14150
- exports2.studio2CodegenConfig = void 0;
14182
+ exports2.harmonyCodegenConfig = exports2.studio2CodegenConfig = void 0;
14151
14183
  var ditto_codegen_types_12 = require_dist4();
14152
14184
  var codegen_checkpoint_plugin_1 = require_dist7();
14153
14185
  var codegen_common_logic_1 = require_dist5();
@@ -14191,6 +14223,10 @@ var require_dist8 = __commonJS({
14191
14223
  moduleSpecifierPrefix: ditto_codegen_types_12.COMPANION_APP_MODULE_SPECIFIER_PREFIX,
14192
14224
  requiredPermissions: false
14193
14225
  };
14226
+ exports2.harmonyCodegenConfig = {
14227
+ ...exports2.studio2CodegenConfig,
14228
+ toolPolicies: [...codegen_common_logic_1.SITE_POLICIES, ...codegen_common_logic_1.HARMONY_CC_POLICIES]
14229
+ };
14194
14230
  }
14195
14231
  });
14196
14232
 
@@ -14723,15 +14759,17 @@ var require_environments = __commonJS({
14723
14759
  function getCodegenEnvironmentConfig() {
14724
14760
  const environment = getValidatedCodegenEnvironment();
14725
14761
  switch (environment) {
14726
- case types_1.Environment.STUDIO_2:
14762
+ case types_1.Environment.STUDIO_2: {
14763
+ const siteConfig = process.env.SITE_EDITOR === "harmony" ? codegen_studio_2_config_1.harmonyCodegenConfig : codegen_studio_2_config_1.studio2CodegenConfig;
14727
14764
  return withSharedRules({
14728
- ...codegen_studio_2_config_1.studio2CodegenConfig,
14765
+ ...siteConfig,
14729
14766
  plugins: [
14730
- ...codegen_studio_2_config_1.studio2CodegenConfig.plugins,
14767
+ ...siteConfig.plugins,
14731
14768
  telemetry_tools_1.telemetryToolsPluginFactory,
14732
14769
  upload_media_tool_1.uploadMediaToolPluginFactory
14733
14770
  ]
14734
14771
  });
14772
+ }
14735
14773
  case types_1.Environment.APP_BUILDER:
14736
14774
  return withSharedRules({
14737
14775
  ...codegen_app_builder_config_1.appBuilderCodegenConfig,
@@ -129472,8 +129510,9 @@ var require_tool_policies3 = __commonJS({
129472
129510
  isInstruction,
129473
129511
  message
129474
129512
  }), (policy) => policy.mode === mode);
129475
- const generatePolicies = emitKind("generate", ({ blockedExtensionTypes, whenArgsInclude, message }) => ({
129513
+ const generatePolicies = emitKind("generate", ({ blockedExtensionTypes, allowedExtensionTypes, whenArgsInclude, message }) => ({
129476
129514
  blockedExtensionTypes,
129515
+ allowedExtensionTypes,
129477
129516
  whenArgsInclude,
129478
129517
  message
129479
129518
  }));
@@ -129538,6 +129577,25 @@ function generateCommandOf(tool, args) {
129538
129577
  : null;
129539
129578
  }
129540
129579
 
129580
+ // Extension types named in a generate command: \`"extensionType":"X"\` in
129581
+ // --params, or \`--type X\` (the value may be quoted).
129582
+ function commandExtensionTypes(command) {
129583
+ const re = /(?:extensionType["'\\\\\\s:]+|--type[ =]["']?)([A-Z][A-Z0-9_]*)/g;
129584
+ return [...command.matchAll(re)].map((match) => match[1]);
129585
+ }
129586
+
129587
+ function blocksType(policy, type) {
129588
+ return policy.allowedExtensionTypes
129589
+ ? !policy.allowedExtensionTypes.includes(type)
129590
+ : policy.blockedExtensionTypes.includes(type);
129591
+ }
129592
+
129593
+ function blocksCommand(policy, command) {
129594
+ return policy.allowedExtensionTypes
129595
+ ? commandExtensionTypes(command).some((type) => blocksType(policy, type))
129596
+ : policy.blockedExtensionTypes.some((type) => command.includes(type));
129597
+ }
129598
+
129541
129599
  function generateArgsMatch(policy, haystack) {
129542
129600
  return (
129543
129601
  !policy.whenArgsInclude ||
@@ -129567,7 +129625,7 @@ export const ToolPolicies = async () => ({
129567
129625
  const serialized = JSON.stringify(params);
129568
129626
  for (const policy of GENERATE_POLICIES) {
129569
129627
  if (
129570
- policy.blockedExtensionTypes.includes(params.extensionType) &&
129628
+ blocksType(policy, params.extensionType) &&
129571
129629
  generateArgsMatch(policy, serialized)
129572
129630
  ) {
129573
129631
  throw new Error(policy.message);
@@ -129578,7 +129636,7 @@ export const ToolPolicies = async () => ({
129578
129636
  if (generateCommand) {
129579
129637
  for (const policy of GENERATE_POLICIES) {
129580
129638
  if (
129581
- policy.blockedExtensionTypes.some((type) => generateCommand.includes(type)) &&
129639
+ blocksCommand(policy, generateCommand) &&
129582
129640
  generateArgsMatch(policy, generateCommand)
129583
129641
  ) {
129584
129642
  throw new Error(policy.message);
@@ -130328,7 +130386,8 @@ async function main(ctx) {
130328
130386
  projectId: ctx.projectId,
130329
130387
  appNameSpace: ctx.appNamespace,
130330
130388
  codeIdentifier: ctx.codeIdentifier,
130331
- metasiteId: ctx.metasiteId
130389
+ metasiteId: ctx.metasiteId,
130390
+ siteEditor: process.env.SITE_EDITOR
130332
130391
  });
130333
130392
  codeGenerationService_1.codeGenerationService.setAccessTokenListener(config_1.setCurrentAccessToken);
130334
130393
  await initOpenCode();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.518",
3
+ "version": "1.0.519",
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": "69eeb441bed0c625d05a6125c33241750860227f4a4ccde4fbf4fbba"
32
+ "falconPackageHash": "36cc95a70649db03d44124988e86973d73a1e9fbe596505714b438eb"
33
33
  }