@wix/ditto-codegen-public 1.0.370 → 1.0.372

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 +379 -8
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -12535,6 +12535,11 @@ var require_checkpoint = __commonJS({
12535
12535
  return message.slice(0, MAX_COMMIT_MESSAGE_LENGTH - TRUNCATION_SUFFIX.length) + TRUNCATION_SUFFIX;
12536
12536
  };
12537
12537
  var useCodeProjectOrchestrator = () => process.env.USE_CODE_PROJECT_ORCHESTRATOR === "true";
12538
+ var wasAuthorizationHeaderSent = (requestHeaders) => {
12539
+ if (typeof requestHeaders !== "object" || requestHeaders === null)
12540
+ return false;
12541
+ return Object.keys(requestHeaders).some((key) => key.toLowerCase() === "authorization");
12542
+ };
12538
12543
  var callCreateCheckpoint = async (client, job, commitMessage, logger) => {
12539
12544
  if (useCodeProjectOrchestrator()) {
12540
12545
  if (!job.siteBranchId) {
@@ -12554,7 +12559,9 @@ var require_checkpoint = __commonJS({
12554
12559
  statusText: error.response?.statusText,
12555
12560
  code: error.code,
12556
12561
  message: error.message,
12557
- data: error.response?.data
12562
+ data: error.response?.data,
12563
+ responseHeaders: error.response?.headers ?? null,
12564
+ authorizationHeaderSent: wasAuthorizationHeaderSent(error.config?.headers)
12558
12565
  });
12559
12566
  }
12560
12567
  throw error;
@@ -12583,9 +12590,10 @@ var require_checkpoint = __commonJS({
12583
12590
  };
12584
12591
  var checkpointPluginFactory = (ctx) => {
12585
12592
  const { host, job } = ctx;
12593
+ const accessToken = host.auth.getAccessToken();
12586
12594
  const orchestratorHttpClient = (0, http_client_1.createHttpClient)({
12587
12595
  baseURL: "https://editor.wix.com",
12588
- headers: { Authorization: `Bearer ${host.auth.getAccessToken() ?? ""}` }
12596
+ headers: accessToken ? { Authorization: `Bearer ${accessToken}` } : {}
12589
12597
  });
12590
12598
  let outcome;
12591
12599
  let capturedCommitMessage;
@@ -13912,13 +13920,376 @@ var require_dist8 = __commonJS({
13912
13920
  }
13913
13921
  });
13914
13922
 
13915
- // ../codegen-harmony-config/dist/index.js
13923
+ // ../../node_modules/@wix/ambassador-viewer-v1-feature-vibe-project/cjs/build/http.impl.js
13924
+ var require_http_impl4 = __commonJS({
13925
+ "../../node_modules/@wix/ambassador-viewer-v1-feature-vibe-project/cjs/build/http.impl.js"(exports2) {
13926
+ "use strict";
13927
+ Object.defineProperty(exports2, "__esModule", { value: true });
13928
+ exports2.generateCode = generateCode;
13929
+ exports2.getGeneratedCodeJobStatus = getGeneratedCodeJobStatus;
13930
+ exports2.save = save;
13931
+ exports2.getSaveStatus = getSaveStatus;
13932
+ exports2.getProjectStatus = getProjectStatus;
13933
+ var metro_runtime_1 = require_build();
13934
+ var ambassador_1 = require_ambassador_index();
13935
+ var metro_runtime_2 = require_build();
13936
+ var _codeGenerationTask = {
13937
+ createdAt: "google.protobuf.Timestamp",
13938
+ updatedAt: "google.protobuf.Timestamp"
13939
+ };
13940
+ var _generateCodeRequest = {};
13941
+ var _generateCodeResponse = {};
13942
+ var _getGeneratedCodeJobStatusRequest = {};
13943
+ var _getGeneratedCodeJobStatusResponse = { tasks: "_codeGenerationTask" };
13944
+ var _getProjectStatusRequest = {};
13945
+ var _getProjectStatusResponse = {};
13946
+ var _getSaveStatusRequest = {};
13947
+ var _getSaveStatusResponse = {};
13948
+ var _saveRequest = {};
13949
+ var _saveResponse = {};
13950
+ function resolveWixViewerV1FeatureVibeUrl(opts) {
13951
+ var domainToMappings = {
13952
+ "editor._base_domain_": [
13953
+ {
13954
+ srcPath: "/_api/custom-component-orchestrator",
13955
+ destPath: ""
13956
+ }
13957
+ ],
13958
+ "blocks._base_domain_": [
13959
+ {
13960
+ srcPath: "/_api/custom-component-orchestrator",
13961
+ destPath: ""
13962
+ }
13963
+ ],
13964
+ "create.editorx": [
13965
+ {
13966
+ srcPath: "/_api/custom-component-orchestrator",
13967
+ destPath: ""
13968
+ }
13969
+ ],
13970
+ "bo._base_domain_": [
13971
+ {
13972
+ srcPath: "/_api/custom-component-orchestrator",
13973
+ destPath: ""
13974
+ }
13975
+ ],
13976
+ "wixbo.ai": [
13977
+ {
13978
+ srcPath: "/_api/custom-component-orchestrator",
13979
+ destPath: ""
13980
+ }
13981
+ ],
13982
+ "wix-bo.com": [
13983
+ {
13984
+ srcPath: "/_api/custom-component-orchestrator",
13985
+ destPath: ""
13986
+ }
13987
+ ],
13988
+ "manage._base_domain_": [
13989
+ {
13990
+ srcPath: "/_api/custom-component-orchestrator",
13991
+ destPath: ""
13992
+ }
13993
+ ]
13994
+ };
13995
+ return (0, metro_runtime_2.resolveUrl)(Object.assign(opts, { domainToMappings }));
13996
+ }
13997
+ function generateCode(payload) {
13998
+ var _a = (0, ambassador_1.serializer)(_generateCodeRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
13999
+ var fromRes = (0, ambassador_1.serializer)(_generateCodeResponse, {}).fromJSON;
14000
+ function __generateCode(_a2) {
14001
+ var host = _a2.host;
14002
+ var serializedData = toReq(payload);
14003
+ var metadata = {
14004
+ entityFqdn: "wix.viewer.v1.feature_vibe_project",
14005
+ method: "POST",
14006
+ methodFqn: "wix.viewer.v1.FeatureVibe.GenerateCode",
14007
+ migrationOptions: {
14008
+ optInTransformResponse: true
14009
+ },
14010
+ url: resolveWixViewerV1FeatureVibeUrl({
14011
+ protoPath: "/v1/feature-vibe/generate-code",
14012
+ data: serializedData,
14013
+ host
14014
+ }),
14015
+ data: serializedData,
14016
+ transformResponse: fromRes
14017
+ };
14018
+ return metadata;
14019
+ }
14020
+ __generateCode.fromReq = fromReq;
14021
+ __generateCode.__isAmbassador = true;
14022
+ return __generateCode;
14023
+ }
14024
+ function getGeneratedCodeJobStatus(payload) {
14025
+ var _a = (0, ambassador_1.serializer)(_getGeneratedCodeJobStatusRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
14026
+ var fromRes = (0, ambassador_1.serializer)(_getGeneratedCodeJobStatusResponse, {
14027
+ _codeGenerationTask
14028
+ }).fromJSON;
14029
+ function __getGeneratedCodeJobStatus(_a2) {
14030
+ var host = _a2.host;
14031
+ var serializedData = toReq(payload);
14032
+ var metadata = {
14033
+ entityFqdn: "wix.viewer.v1.feature_vibe_project",
14034
+ method: "GET",
14035
+ methodFqn: "wix.viewer.v1.FeatureVibe.GetGeneratedCodeJobStatus",
14036
+ migrationOptions: {
14037
+ optInTransformResponse: true
14038
+ },
14039
+ url: resolveWixViewerV1FeatureVibeUrl({
14040
+ protoPath: "/v1/feature-vibe/generated-code-job-status/{jobId}",
14041
+ data: serializedData,
14042
+ host
14043
+ }),
14044
+ params: (0, metro_runtime_1.toURLSearchParams)(serializedData),
14045
+ transformResponse: fromRes
14046
+ };
14047
+ return metadata;
14048
+ }
14049
+ __getGeneratedCodeJobStatus.fromReq = fromReq;
14050
+ __getGeneratedCodeJobStatus.__isAmbassador = true;
14051
+ return __getGeneratedCodeJobStatus;
14052
+ }
14053
+ function save(payload) {
14054
+ var _a = (0, ambassador_1.serializer)(_saveRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
14055
+ var fromRes = (0, ambassador_1.serializer)(_saveResponse, {}).fromJSON;
14056
+ function __save(_a2) {
14057
+ var host = _a2.host;
14058
+ var serializedData = toReq(payload);
14059
+ var metadata = {
14060
+ entityFqdn: "wix.viewer.v1.feature_vibe_project",
14061
+ method: "POST",
14062
+ methodFqn: "wix.viewer.v1.FeatureVibe.Save",
14063
+ migrationOptions: {
14064
+ optInTransformResponse: true
14065
+ },
14066
+ url: resolveWixViewerV1FeatureVibeUrl({
14067
+ protoPath: "/v1/feature-vibe/save",
14068
+ data: serializedData,
14069
+ host
14070
+ }),
14071
+ data: serializedData,
14072
+ transformResponse: fromRes
14073
+ };
14074
+ return metadata;
14075
+ }
14076
+ __save.fromReq = fromReq;
14077
+ __save.__isAmbassador = true;
14078
+ return __save;
14079
+ }
14080
+ function getSaveStatus(payload) {
14081
+ var _a = (0, ambassador_1.serializer)(_getSaveStatusRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
14082
+ var fromRes = (0, ambassador_1.serializer)(_getSaveStatusResponse, {}).fromJSON;
14083
+ function __getSaveStatus(_a2) {
14084
+ var host = _a2.host;
14085
+ var serializedData = toReq(payload);
14086
+ var metadata = {
14087
+ entityFqdn: "wix.viewer.v1.feature_vibe_project",
14088
+ method: "GET",
14089
+ methodFqn: "wix.viewer.v1.FeatureVibe.GetSaveStatus",
14090
+ migrationOptions: {
14091
+ optInTransformResponse: true
14092
+ },
14093
+ url: resolveWixViewerV1FeatureVibeUrl({
14094
+ protoPath: "/v1/feature-vibe/save-status/{saveId}",
14095
+ data: serializedData,
14096
+ host
14097
+ }),
14098
+ params: (0, metro_runtime_1.toURLSearchParams)(serializedData),
14099
+ transformResponse: fromRes
14100
+ };
14101
+ return metadata;
14102
+ }
14103
+ __getSaveStatus.fromReq = fromReq;
14104
+ __getSaveStatus.__isAmbassador = true;
14105
+ return __getSaveStatus;
14106
+ }
14107
+ function getProjectStatus(payload) {
14108
+ var _a = (0, ambassador_1.serializer)(_getProjectStatusRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
14109
+ var fromRes = (0, ambassador_1.serializer)(_getProjectStatusResponse, {}).fromJSON;
14110
+ function __getProjectStatus(_a2) {
14111
+ var host = _a2.host;
14112
+ var serializedData = toReq(payload);
14113
+ var metadata = {
14114
+ entityFqdn: "wix.viewer.v1.feature_vibe_project",
14115
+ method: "GET",
14116
+ methodFqn: "wix.viewer.v1.FeatureVibe.GetProjectStatus",
14117
+ migrationOptions: {
14118
+ optInTransformResponse: true
14119
+ },
14120
+ url: resolveWixViewerV1FeatureVibeUrl({
14121
+ protoPath: "/v1/feature-vibe/project-status",
14122
+ data: serializedData,
14123
+ host
14124
+ }),
14125
+ params: (0, metro_runtime_1.toURLSearchParams)(serializedData),
14126
+ transformResponse: fromRes
14127
+ };
14128
+ return metadata;
14129
+ }
14130
+ __getProjectStatus.fromReq = fromReq;
14131
+ __getProjectStatus.__isAmbassador = true;
14132
+ return __getProjectStatus;
14133
+ }
14134
+ }
14135
+ });
14136
+
14137
+ // ../codegen-feature-vibe-plugin/dist/feature-vibe-save.js
14138
+ var require_feature_vibe_save = __commonJS({
14139
+ "../codegen-feature-vibe-plugin/dist/feature-vibe-save.js"(exports2) {
14140
+ "use strict";
14141
+ Object.defineProperty(exports2, "__esModule", { value: true });
14142
+ exports2.featureVibePluginFactory = void 0;
14143
+ var fs_1 = require("fs");
14144
+ var path_1 = require("path");
14145
+ var http_1 = require_http_impl4();
14146
+ var http_client_1 = require_index_node();
14147
+ var FALLBACK_COMMIT_MESSAGE = "Auto-save";
14148
+ var SET_COMMIT_MESSAGE_TOOL = "set-commit-message";
14149
+ var MAX_COMMIT_MESSAGE_LENGTH = 1e3;
14150
+ var TRUNCATION_SUFFIX = "\u2026";
14151
+ var FEATURE_VIBE_BASE_URL = "https://editor.wix.com";
14152
+ var ASSETS_DIR = (0, path_1.join)(__dirname, "..", "assets");
14153
+ var readAsset = (name) => (0, fs_1.readFileSync)((0, path_1.join)(ASSETS_DIR, name), "utf-8");
14154
+ var buildSaveRules = () => [
14155
+ {
14156
+ filename: "save-commit-message.md",
14157
+ content: readAsset("commit-message-rule.md")
14158
+ }
14159
+ ];
14160
+ var buildSaveTools = () => [
14161
+ {
14162
+ filename: "set-commit-message.ts",
14163
+ source: readAsset("set-commit-message.ts")
14164
+ }
14165
+ ];
14166
+ var truncateCommitMessage = (message) => {
14167
+ if (message.length <= MAX_COMMIT_MESSAGE_LENGTH)
14168
+ return message;
14169
+ return message.slice(0, MAX_COMMIT_MESSAGE_LENGTH - TRUNCATION_SUFFIX.length) + TRUNCATION_SUFFIX;
14170
+ };
14171
+ var wasAuthorizationHeaderSent = (requestHeaders) => {
14172
+ if (typeof requestHeaders !== "object" || requestHeaders === null)
14173
+ return false;
14174
+ return Object.keys(requestHeaders).some((key) => key.toLowerCase() === "authorization");
14175
+ };
14176
+ var callSave = async (client, job, commitMessage, logger) => {
14177
+ try {
14178
+ const resp = await client.request((0, http_1.save)({
14179
+ appId: job.projectId,
14180
+ jobId: job.jobId,
14181
+ commitMessage: truncateCommitMessage(commitMessage)
14182
+ }));
14183
+ return { saveId: resp.data?.saveId };
14184
+ } catch (error) {
14185
+ if (http_client_1.HttpClient.isHttpError(error)) {
14186
+ logger.error("[FeatureVibeSave] Save request failed", {
14187
+ projectId: job.projectId,
14188
+ jobId: job.jobId,
14189
+ requestId: error.requestId || void 0,
14190
+ method: error.config?.method?.toUpperCase(),
14191
+ url: error.config?.url,
14192
+ status: error.response?.status,
14193
+ statusText: error.response?.statusText,
14194
+ code: error.code,
14195
+ message: error.message,
14196
+ data: error.response?.data,
14197
+ authorizationHeaderSent: wasAuthorizationHeaderSent(error.config?.headers)
14198
+ });
14199
+ }
14200
+ throw error;
14201
+ }
14202
+ };
14203
+ var readToolCommitMessage = (input) => {
14204
+ if (typeof input !== "object" || input === null)
14205
+ return void 0;
14206
+ const value = input.commitMessage;
14207
+ if (typeof value !== "string")
14208
+ return void 0;
14209
+ const trimmed = value.trim();
14210
+ return trimmed.length > 0 ? trimmed : void 0;
14211
+ };
14212
+ var featureVibePluginFactory = (ctx) => {
14213
+ const { host, job } = ctx;
14214
+ const accessToken = host.auth.getAccessToken();
14215
+ const featureVibeHttpClient = (0, http_client_1.createHttpClient)({
14216
+ baseURL: FEATURE_VIBE_BASE_URL,
14217
+ headers: accessToken ? { Authorization: `Bearer ${accessToken}` } : {}
14218
+ });
14219
+ let outcome;
14220
+ let capturedCommitMessage;
14221
+ const commitSave = async (commitMessage) => {
14222
+ if (!job)
14223
+ return;
14224
+ try {
14225
+ const { saveId } = await callSave(featureVibeHttpClient, job, commitMessage, host.logger);
14226
+ outcome = { status: "created", saveId };
14227
+ if (saveId) {
14228
+ await host.jobs.updatePayload({ jobId: job.jobId, taskId: job.taskId }, { saveId });
14229
+ }
14230
+ host.logger.info("[FeatureVibeSave] save triggered", {
14231
+ projectId: job.projectId,
14232
+ saveId,
14233
+ commitMessage
14234
+ });
14235
+ } catch (error) {
14236
+ outcome = { status: "failed", error };
14237
+ host.logger.error("[FeatureVibeSave] save failed", {
14238
+ projectId: job.projectId,
14239
+ error: error instanceof Error ? error.message : String(error)
14240
+ });
14241
+ throw error;
14242
+ }
14243
+ };
14244
+ return {
14245
+ name: "feature-vibe-save",
14246
+ rules: buildSaveRules(),
14247
+ tools: buildSaveTools(),
14248
+ async onToolUse({ tool, state }) {
14249
+ if (state.status === "error")
14250
+ return;
14251
+ if (tool !== SET_COMMIT_MESSAGE_TOOL)
14252
+ return;
14253
+ const message = readToolCommitMessage(state.input);
14254
+ if (message)
14255
+ capturedCommitMessage = message;
14256
+ },
14257
+ async onFlowEnd({ codegenFailed }) {
14258
+ if (outcome?.status === "failed")
14259
+ throw outcome.error;
14260
+ if (outcome?.status === "created")
14261
+ return;
14262
+ if (codegenFailed)
14263
+ return;
14264
+ const commitMessage = capturedCommitMessage ?? FALLBACK_COMMIT_MESSAGE;
14265
+ await commitSave(commitMessage);
14266
+ }
14267
+ };
14268
+ };
14269
+ exports2.featureVibePluginFactory = featureVibePluginFactory;
14270
+ }
14271
+ });
14272
+
14273
+ // ../codegen-feature-vibe-plugin/dist/index.js
13916
14274
  var require_dist9 = __commonJS({
14275
+ "../codegen-feature-vibe-plugin/dist/index.js"(exports2) {
14276
+ "use strict";
14277
+ Object.defineProperty(exports2, "__esModule", { value: true });
14278
+ exports2.featureVibePluginFactory = void 0;
14279
+ var feature_vibe_save_1 = require_feature_vibe_save();
14280
+ Object.defineProperty(exports2, "featureVibePluginFactory", { enumerable: true, get: function() {
14281
+ return feature_vibe_save_1.featureVibePluginFactory;
14282
+ } });
14283
+ }
14284
+ });
14285
+
14286
+ // ../codegen-harmony-config/dist/index.js
14287
+ var require_dist10 = __commonJS({
13917
14288
  "../codegen-harmony-config/dist/index.js"(exports2) {
13918
14289
  "use strict";
13919
14290
  Object.defineProperty(exports2, "__esModule", { value: true });
13920
14291
  exports2.harmonyCodegenConfig = void 0;
13921
- var codegen_checkpoint_plugin_1 = require_dist6();
14292
+ var codegen_feature_vibe_plugin_1 = require_dist9();
13922
14293
  var codegen_common_logic_1 = require_dist7();
13923
14294
  exports2.harmonyCodegenConfig = {
13924
14295
  codegenRules: [
@@ -13926,7 +14297,7 @@ var require_dist9 = __commonJS({
13926
14297
  ],
13927
14298
  askRules: [],
13928
14299
  decisionCheckers: [],
13929
- plugins: [codegen_checkpoint_plugin_1.checkpointPluginFactory]
14300
+ plugins: [codegen_feature_vibe_plugin_1.featureVibePluginFactory]
13930
14301
  };
13931
14302
  }
13932
14303
  });
@@ -14177,7 +14548,7 @@ var require_environments = __commonJS({
14177
14548
  var types_1 = require_types_impl();
14178
14549
  var codegen_app_builder_config_1 = require_dist5();
14179
14550
  var codegen_studio_2_config_1 = require_dist8();
14180
- var codegen_harmony_config_1 = require_dist9();
14551
+ var codegen_harmony_config_1 = require_dist10();
14181
14552
  var codegen_rules_1 = require_codegen_rules();
14182
14553
  var ask_rules_1 = require_ask_rules();
14183
14554
  var job_decision_manager_1 = require_job_decision_manager();
@@ -17831,7 +18202,7 @@ var require_bi_logger_factory = __commonJS({
17831
18202
  });
17832
18203
 
17833
18204
  // ../../node_modules/@wix/wix-bi-logger-client/dist/index.js
17834
- var require_dist10 = __commonJS({
18205
+ var require_dist11 = __commonJS({
17835
18206
  "../../node_modules/@wix/wix-bi-logger-client/dist/index.js"(exports2, module2) {
17836
18207
  "use strict";
17837
18208
  var BiLoggerClientFactory = require_bi_logger_factory();
@@ -20431,7 +20802,7 @@ var require_src2 = __commonJS({
20431
20802
  Object.defineProperty(exports2, "__esModule", { value: true });
20432
20803
  exports2.StandaloneNodeLogger = void 0;
20433
20804
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
20434
- var wix_bi_logger_client_1 = tslib_1.__importDefault(require_dist10());
20805
+ var wix_bi_logger_client_1 = tslib_1.__importDefault(require_dist11());
20435
20806
  var http_client_1 = require_index_node2();
20436
20807
  var defaultOptions = {
20437
20808
  baseUrl: process.env.BI_BASE_URL || "https://frog.wix.com",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.370",
3
+ "version": "1.0.372",
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": "3d6d0c0fbfb4509e910ac575a739e9fdc27303a83db84e044b588ff9"
32
+ "falconPackageHash": "2bd2b2d9e50fc1c72fc3001a6eb6bbf67cab4068dc3997ebdd8d0987"
33
33
  }