@wix/ditto-codegen-public 1.0.262 → 1.0.263
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.
- package/dist/out.js +348 -7
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -141,7 +141,7 @@ var require_main = __commonJS({
|
|
|
141
141
|
var fs4 = require("fs");
|
|
142
142
|
var path4 = require("path");
|
|
143
143
|
var os = require("os");
|
|
144
|
-
var
|
|
144
|
+
var crypto6 = require("crypto");
|
|
145
145
|
var packageJson = require_package();
|
|
146
146
|
var version3 = packageJson.version;
|
|
147
147
|
var TIPS = [
|
|
@@ -392,7 +392,7 @@ var require_main = __commonJS({
|
|
|
392
392
|
const authTag = ciphertext.subarray(-16);
|
|
393
393
|
ciphertext = ciphertext.subarray(12, -16);
|
|
394
394
|
try {
|
|
395
|
-
const aesgcm =
|
|
395
|
+
const aesgcm = crypto6.createDecipheriv("aes-256-gcm", key, nonce);
|
|
396
396
|
aesgcm.setAuthTag(authTag);
|
|
397
397
|
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
|
|
398
398
|
} catch (error48) {
|
|
@@ -6514,9 +6514,12 @@ var require_http_impl = __commonJS({
|
|
|
6514
6514
|
exports2.updateTask = updateTask;
|
|
6515
6515
|
exports2.stopGeneration = stopGeneration;
|
|
6516
6516
|
exports2.submitUserDecision = submitUserDecision;
|
|
6517
|
+
exports2.cleanupStaleJobs = cleanupStaleJobs;
|
|
6517
6518
|
var metro_runtime_1 = require_build();
|
|
6518
6519
|
var ambassador_1 = require_ambassador_index();
|
|
6519
6520
|
var metro_runtime_2 = require_build();
|
|
6521
|
+
var _cleanupStaleJobsRequest = {};
|
|
6522
|
+
var _cleanupStaleJobsResponse = {};
|
|
6520
6523
|
var _createJobRequest = { job: "_job" };
|
|
6521
6524
|
var _createJobResponse = { job: "_job" };
|
|
6522
6525
|
var _createTaskRequest = { task: "_task" };
|
|
@@ -6593,6 +6596,24 @@ var require_http_impl = __commonJS({
|
|
|
6593
6596
|
srcPath: "/_api/codegen-server",
|
|
6594
6597
|
destPath: ""
|
|
6595
6598
|
}
|
|
6599
|
+
],
|
|
6600
|
+
"editor._base_domain_": [
|
|
6601
|
+
{
|
|
6602
|
+
srcPath: "/_api/codegen-server",
|
|
6603
|
+
destPath: ""
|
|
6604
|
+
}
|
|
6605
|
+
],
|
|
6606
|
+
"blocks._base_domain_": [
|
|
6607
|
+
{
|
|
6608
|
+
srcPath: "/_api/codegen-server",
|
|
6609
|
+
destPath: ""
|
|
6610
|
+
}
|
|
6611
|
+
],
|
|
6612
|
+
"create.editorx": [
|
|
6613
|
+
{
|
|
6614
|
+
srcPath: "/_api/codegen-server",
|
|
6615
|
+
destPath: ""
|
|
6616
|
+
}
|
|
6596
6617
|
]
|
|
6597
6618
|
};
|
|
6598
6619
|
return (0, metro_runtime_2.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
@@ -6898,6 +6919,33 @@ var require_http_impl = __commonJS({
|
|
|
6898
6919
|
__submitUserDecision.__isAmbassador = true;
|
|
6899
6920
|
return __submitUserDecision;
|
|
6900
6921
|
}
|
|
6922
|
+
function cleanupStaleJobs(payload) {
|
|
6923
|
+
var _a2 = (0, ambassador_1.serializer)(_cleanupStaleJobsRequest, {}), toReq = _a2.toJSON, fromReq = _a2.fromJSON;
|
|
6924
|
+
var fromRes = (0, ambassador_1.serializer)(_cleanupStaleJobsResponse, {}).fromJSON;
|
|
6925
|
+
function __cleanupStaleJobs(_a3) {
|
|
6926
|
+
var host = _a3.host;
|
|
6927
|
+
var serializedData = toReq(payload);
|
|
6928
|
+
var metadata = {
|
|
6929
|
+
entityFqdn: "wix.ctp.codegen_job_service.v1.job",
|
|
6930
|
+
method: "POST",
|
|
6931
|
+
methodFqn: "com.wixpress.ditto.codegen_job_service.api.CodegenJobService.CleanupStaleJobs",
|
|
6932
|
+
migrationOptions: {
|
|
6933
|
+
optInTransformResponse: true
|
|
6934
|
+
},
|
|
6935
|
+
url: resolveComWixpressDittoCodegenJobServiceApiCodegenJobServiceUrl({
|
|
6936
|
+
protoPath: "/v1/cleanup-stale-jobs",
|
|
6937
|
+
data: serializedData,
|
|
6938
|
+
host
|
|
6939
|
+
}),
|
|
6940
|
+
data: serializedData,
|
|
6941
|
+
transformResponse: fromRes
|
|
6942
|
+
};
|
|
6943
|
+
return metadata;
|
|
6944
|
+
}
|
|
6945
|
+
__cleanupStaleJobs.fromReq = fromReq;
|
|
6946
|
+
__cleanupStaleJobs.__isAmbassador = true;
|
|
6947
|
+
return __cleanupStaleJobs;
|
|
6948
|
+
}
|
|
6901
6949
|
}
|
|
6902
6950
|
});
|
|
6903
6951
|
|
|
@@ -10302,6 +10350,34 @@ var require_CodeGenService = __commonJS({
|
|
|
10302
10350
|
}
|
|
10303
10351
|
}));
|
|
10304
10352
|
};
|
|
10353
|
+
this.updateJobWithPendingDecision = async (jobId, userDecision) => {
|
|
10354
|
+
logger_12.logger.info("Setting job to await user decision", {
|
|
10355
|
+
jobId,
|
|
10356
|
+
decisionId: userDecision.id,
|
|
10357
|
+
userDecision: JSON.stringify(userDecision, null, 2)
|
|
10358
|
+
});
|
|
10359
|
+
await this.httpClient.request((0, http_1.updateJob)({
|
|
10360
|
+
projectId: this.projectId,
|
|
10361
|
+
job: {
|
|
10362
|
+
id: jobId,
|
|
10363
|
+
projectId: this.projectId,
|
|
10364
|
+
status: types_1.Status.AWAITING_USER_INPUT,
|
|
10365
|
+
pendingUserDecisions: [userDecision]
|
|
10366
|
+
}
|
|
10367
|
+
}));
|
|
10368
|
+
};
|
|
10369
|
+
this.resumeJobFromDecision = async (jobId) => {
|
|
10370
|
+
logger_12.logger.info("Resuming job from user decision", { jobId });
|
|
10371
|
+
await this.httpClient.request((0, http_1.updateJob)({
|
|
10372
|
+
projectId: this.projectId,
|
|
10373
|
+
job: {
|
|
10374
|
+
id: jobId,
|
|
10375
|
+
projectId: this.projectId,
|
|
10376
|
+
status: types_1.Status.RUNNING,
|
|
10377
|
+
pendingUserDecisions: []
|
|
10378
|
+
}
|
|
10379
|
+
}));
|
|
10380
|
+
};
|
|
10305
10381
|
this.updateTask = async (jobId, taskId, status, payload) => {
|
|
10306
10382
|
await this.httpClient.request((0, http_1.updateTask)({
|
|
10307
10383
|
projectId: this.projectId,
|
|
@@ -11144,6 +11220,14 @@ var require_generation = __commonJS({
|
|
|
11144
11220
|
}
|
|
11145
11221
|
});
|
|
11146
11222
|
|
|
11223
|
+
// ../codegen-types/dist/types/user-decision.js
|
|
11224
|
+
var require_user_decision = __commonJS({
|
|
11225
|
+
"../codegen-types/dist/types/user-decision.js"(exports2) {
|
|
11226
|
+
"use strict";
|
|
11227
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
11228
|
+
}
|
|
11229
|
+
});
|
|
11230
|
+
|
|
11147
11231
|
// ../codegen-types/dist/ai/index.js
|
|
11148
11232
|
var require_ai = __commonJS({
|
|
11149
11233
|
"../codegen-types/dist/ai/index.js"(exports2) {
|
|
@@ -11186,6 +11270,7 @@ var require_dist4 = __commonJS({
|
|
|
11186
11270
|
__exportStar2(require_status(), exports2);
|
|
11187
11271
|
__exportStar2(require_task(), exports2);
|
|
11188
11272
|
__exportStar2(require_generation(), exports2);
|
|
11273
|
+
__exportStar2(require_user_decision(), exports2);
|
|
11189
11274
|
__exportStar2(require_ai(), exports2);
|
|
11190
11275
|
}
|
|
11191
11276
|
});
|
|
@@ -94831,6 +94916,229 @@ var require_codegen_flow_helpers = __commonJS({
|
|
|
94831
94916
|
}
|
|
94832
94917
|
});
|
|
94833
94918
|
|
|
94919
|
+
// dist/job-decision-manager.js
|
|
94920
|
+
var require_job_decision_manager = __commonJS({
|
|
94921
|
+
"dist/job-decision-manager.js"(exports2) {
|
|
94922
|
+
"use strict";
|
|
94923
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
94924
|
+
exports2.UserDecisionCancelledError = void 0;
|
|
94925
|
+
exports2.pauseForUserDecision = pauseForUserDecision;
|
|
94926
|
+
exports2.askJobChoice = askJobChoice;
|
|
94927
|
+
exports2.askJobConfirmation = askJobConfirmation;
|
|
94928
|
+
var types_1 = require_types_impl();
|
|
94929
|
+
var codeGenerationService_12 = require_codeGenerationService();
|
|
94930
|
+
var CodeGenService_12 = require_CodeGenService();
|
|
94931
|
+
var logger_12 = require_logger();
|
|
94932
|
+
var DECISION_POLL_INTERVAL_MS = 2e3;
|
|
94933
|
+
var UserDecisionCancelledError = class extends Error {
|
|
94934
|
+
constructor(jobId, decisionId) {
|
|
94935
|
+
super(`User decision ${decisionId} cancelled for job ${jobId}`);
|
|
94936
|
+
this.jobId = jobId;
|
|
94937
|
+
this.decisionId = decisionId;
|
|
94938
|
+
this.name = "UserDecisionCancelledError";
|
|
94939
|
+
}
|
|
94940
|
+
};
|
|
94941
|
+
exports2.UserDecisionCancelledError = UserDecisionCancelledError;
|
|
94942
|
+
async function pauseForUserDecision(jobId, request) {
|
|
94943
|
+
const decisionId = crypto.randomUUID();
|
|
94944
|
+
const userDecision = {
|
|
94945
|
+
id: decisionId,
|
|
94946
|
+
request: {
|
|
94947
|
+
...request,
|
|
94948
|
+
requestedAt: /* @__PURE__ */ new Date()
|
|
94949
|
+
}
|
|
94950
|
+
};
|
|
94951
|
+
await codeGenerationService_12.codeGenerationService.updateJobWithPendingDecision(jobId, userDecision);
|
|
94952
|
+
logger_12.logger.info(`[JobDecision] Job ${jobId} paused for user input`, {
|
|
94953
|
+
question: request.question
|
|
94954
|
+
});
|
|
94955
|
+
const response = await pollForJobDecisionResponse(jobId, decisionId);
|
|
94956
|
+
await codeGenerationService_12.codeGenerationService.resumeJobFromDecision(jobId);
|
|
94957
|
+
logger_12.logger.info(`[JobDecision] Job ${jobId} resumed`, {
|
|
94958
|
+
selectedOptionId: response.selectedOptionId
|
|
94959
|
+
});
|
|
94960
|
+
return response;
|
|
94961
|
+
}
|
|
94962
|
+
async function pollForJobDecisionResponse(jobId, decisionId) {
|
|
94963
|
+
while (true) {
|
|
94964
|
+
const job = await codeGenerationService_12.codeGenerationService.getJob(jobId);
|
|
94965
|
+
if (!job) {
|
|
94966
|
+
throw new Error(`Job ${jobId} not found`);
|
|
94967
|
+
}
|
|
94968
|
+
logger_12.logger.info(`[JobDecision] Polling for job ${jobId} decision ${decisionId}`, { job: JSON.stringify(job, null, 2) });
|
|
94969
|
+
if (job.status === CodeGenService_12.Status.CANCELLED || job.status === CodeGenService_12.Status.PENDING_CANCEL) {
|
|
94970
|
+
throw new UserDecisionCancelledError(jobId, decisionId);
|
|
94971
|
+
}
|
|
94972
|
+
const decision = job.pendingUserDecisions?.find((d) => d.id === decisionId) ?? job.userDecisionHistory?.find((d) => d.id === decisionId);
|
|
94973
|
+
if (decision?.response?.selectedOptionId) {
|
|
94974
|
+
return {
|
|
94975
|
+
selectedOptionId: decision.response.selectedOptionId,
|
|
94976
|
+
respondedAt: decision.response.respondedAt ?? /* @__PURE__ */ new Date()
|
|
94977
|
+
};
|
|
94978
|
+
}
|
|
94979
|
+
await new Promise((resolve3) => setTimeout(resolve3, DECISION_POLL_INTERVAL_MS));
|
|
94980
|
+
}
|
|
94981
|
+
}
|
|
94982
|
+
async function askJobChoice(jobId, question, options, context2) {
|
|
94983
|
+
const response = await pauseForUserDecision(jobId, {
|
|
94984
|
+
question,
|
|
94985
|
+
questionType: types_1.UserDecisionQuestionType.UI_COMPONENT_TYPE,
|
|
94986
|
+
options,
|
|
94987
|
+
context: context2
|
|
94988
|
+
});
|
|
94989
|
+
if (!response.selectedOptionId) {
|
|
94990
|
+
throw new Error("No option selected in user decision response");
|
|
94991
|
+
}
|
|
94992
|
+
return response.selectedOptionId;
|
|
94993
|
+
}
|
|
94994
|
+
async function askJobConfirmation(jobId, question, context2) {
|
|
94995
|
+
const response = await pauseForUserDecision(jobId, {
|
|
94996
|
+
question,
|
|
94997
|
+
questionType: types_1.UserDecisionQuestionType.UI_COMPONENT_TYPE,
|
|
94998
|
+
options: [
|
|
94999
|
+
{ id: "yes", label: "Yes" },
|
|
95000
|
+
{ id: "no", label: "No" }
|
|
95001
|
+
],
|
|
95002
|
+
context: context2
|
|
95003
|
+
});
|
|
95004
|
+
return response.selectedOptionId === "yes";
|
|
95005
|
+
}
|
|
95006
|
+
}
|
|
95007
|
+
});
|
|
95008
|
+
|
|
95009
|
+
// dist/pre-run-decision.js
|
|
95010
|
+
var require_pre_run_decision = __commonJS({
|
|
95011
|
+
"dist/pre-run-decision.js"(exports2) {
|
|
95012
|
+
"use strict";
|
|
95013
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
95014
|
+
exports2.runPreDecisionCheck = runPreDecisionCheck;
|
|
95015
|
+
exports2.checkSiteUIDecision = checkSiteUIDecision;
|
|
95016
|
+
var types_1 = require_types_impl2();
|
|
95017
|
+
var job_decision_manager_1 = require_job_decision_manager();
|
|
95018
|
+
var logger_12 = require_logger();
|
|
95019
|
+
async function runPreDecisionCheck(jobId, context2, checkers) {
|
|
95020
|
+
const allDecisions = [];
|
|
95021
|
+
let modifiedBlueprint = context2.blueprint;
|
|
95022
|
+
let modifiedIterationPlan = context2.iterationPlan;
|
|
95023
|
+
for (const checker of checkers) {
|
|
95024
|
+
const result = await checker(jobId, {
|
|
95025
|
+
blueprint: modifiedBlueprint,
|
|
95026
|
+
iterationPlan: modifiedIterationPlan
|
|
95027
|
+
});
|
|
95028
|
+
if (result) {
|
|
95029
|
+
allDecisions.push(...result.decisionsApplied);
|
|
95030
|
+
if (result.modifiedBlueprint) {
|
|
95031
|
+
modifiedBlueprint = result.modifiedBlueprint;
|
|
95032
|
+
}
|
|
95033
|
+
if (result.modifiedIterationPlan) {
|
|
95034
|
+
modifiedIterationPlan = result.modifiedIterationPlan;
|
|
95035
|
+
}
|
|
95036
|
+
}
|
|
95037
|
+
}
|
|
95038
|
+
return {
|
|
95039
|
+
decisionsApplied: allDecisions,
|
|
95040
|
+
modifiedBlueprint,
|
|
95041
|
+
modifiedIterationPlan
|
|
95042
|
+
};
|
|
95043
|
+
}
|
|
95044
|
+
async function checkSiteUIDecision(jobId, context2) {
|
|
95045
|
+
const extensions = getExtensions(context2);
|
|
95046
|
+
const siteUIExtension = extensions.find((ext) => isSiteUIExtension(ext));
|
|
95047
|
+
if (!siteUIExtension?.name) {
|
|
95048
|
+
return null;
|
|
95049
|
+
}
|
|
95050
|
+
const extensionName = siteUIExtension.name;
|
|
95051
|
+
const currentType = siteUIExtension.type;
|
|
95052
|
+
logger_12.logger.info(`[PreDecision] Found site UI extension: "${extensionName}" (current type: ${currentType})`);
|
|
95053
|
+
const selectedType = await (0, job_decision_manager_1.askJobChoice)(jobId, `What type of site UI element would you like to create for "${extensionName}"?`, [
|
|
95054
|
+
{
|
|
95055
|
+
id: types_1.ExtensionType.SITE_WIDGET,
|
|
95056
|
+
label: "Site Widget (Custom Element)",
|
|
95057
|
+
description: "A self-contained widget built as a Custom Element, embedded on the site. Best for standalone, reusable components."
|
|
95058
|
+
},
|
|
95059
|
+
{
|
|
95060
|
+
id: types_1.ExtensionType.SITE_COMPONENT,
|
|
95061
|
+
label: "Site Component (React)",
|
|
95062
|
+
description: "A React component that integrates with the site builder. Best for components that need to work with Wix editor features."
|
|
95063
|
+
}
|
|
95064
|
+
], "Site Widgets are standalone embeddable units with their own styling, while Site Components integrate more deeply with the Wix editor and builder.");
|
|
95065
|
+
const isTypeChanged = selectedType !== currentType;
|
|
95066
|
+
logger_12.logger.info(`[PreDecision] User selected ${selectedType} for "${extensionName}"${isTypeChanged ? ` (changed from ${currentType})` : " (unchanged)"}`);
|
|
95067
|
+
const appliedDecision = {
|
|
95068
|
+
type: "SITE_UI_TYPE",
|
|
95069
|
+
question: "Site Widget vs Site Component",
|
|
95070
|
+
selectedOptionId: selectedType
|
|
95071
|
+
};
|
|
95072
|
+
return {
|
|
95073
|
+
decisionsApplied: [appliedDecision],
|
|
95074
|
+
modifiedBlueprint: context2.blueprint ? applyTypeToBlueprint(context2.blueprint, extensionName, selectedType) : void 0,
|
|
95075
|
+
modifiedIterationPlan: context2.iterationPlan ? applyTypeToIterationPlan(context2.iterationPlan, extensionName, selectedType) : void 0
|
|
95076
|
+
};
|
|
95077
|
+
}
|
|
95078
|
+
function getExtensions(context2) {
|
|
95079
|
+
if (context2.blueprint) {
|
|
95080
|
+
return context2.blueprint.extensions ?? [];
|
|
95081
|
+
}
|
|
95082
|
+
if (context2.iterationPlan) {
|
|
95083
|
+
return context2.iterationPlan.additionalExtensions?.map((e) => e.extension) ?? [];
|
|
95084
|
+
}
|
|
95085
|
+
return [];
|
|
95086
|
+
}
|
|
95087
|
+
function isSiteUIExtension(extension) {
|
|
95088
|
+
return extension.type === types_1.ExtensionType.SITE_WIDGET || extension.type === types_1.ExtensionType.SITE_COMPONENT;
|
|
95089
|
+
}
|
|
95090
|
+
function applyTypeToBlueprint(blueprint, extensionName, type) {
|
|
95091
|
+
return {
|
|
95092
|
+
...blueprint,
|
|
95093
|
+
extensions: blueprint.extensions?.map((ext) => ext.name === extensionName ? { ...ext, type } : ext)
|
|
95094
|
+
};
|
|
95095
|
+
}
|
|
95096
|
+
function applyTypeToIterationPlan(plan, extensionName, type) {
|
|
95097
|
+
return {
|
|
95098
|
+
...plan,
|
|
95099
|
+
additionalExtensions: plan.additionalExtensions?.map((item) => item.extension.name === extensionName ? { ...item, extension: { ...item.extension, type } } : item)
|
|
95100
|
+
};
|
|
95101
|
+
}
|
|
95102
|
+
}
|
|
95103
|
+
});
|
|
95104
|
+
|
|
95105
|
+
// dist/experiments.js
|
|
95106
|
+
var require_experiments = __commonJS({
|
|
95107
|
+
"dist/experiments.js"(exports2) {
|
|
95108
|
+
"use strict";
|
|
95109
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
95110
|
+
exports2.isExperimentEnabled = isExperimentEnabled;
|
|
95111
|
+
exports2.isUserDecisionsEnabled = isUserDecisionsEnabled;
|
|
95112
|
+
var logger_12 = require_logger();
|
|
95113
|
+
var parsedExperiments = null;
|
|
95114
|
+
function getExperiments() {
|
|
95115
|
+
if (parsedExperiments !== null) {
|
|
95116
|
+
return parsedExperiments;
|
|
95117
|
+
}
|
|
95118
|
+
const raw = process.env.CODEGEN_EXPERIMENTS;
|
|
95119
|
+
if (!raw) {
|
|
95120
|
+
parsedExperiments = {};
|
|
95121
|
+
return parsedExperiments;
|
|
95122
|
+
}
|
|
95123
|
+
try {
|
|
95124
|
+
parsedExperiments = JSON.parse(raw);
|
|
95125
|
+
} catch (error48) {
|
|
95126
|
+
logger_12.logger.error("[Experiments] Failed to parse CODEGEN_EXPERIMENTS", {
|
|
95127
|
+
error: error48 instanceof Error ? error48.message : String(error48)
|
|
95128
|
+
});
|
|
95129
|
+
parsedExperiments = {};
|
|
95130
|
+
}
|
|
95131
|
+
return parsedExperiments;
|
|
95132
|
+
}
|
|
95133
|
+
function isExperimentEnabled(specName) {
|
|
95134
|
+
return getExperiments()[specName] === "true";
|
|
95135
|
+
}
|
|
95136
|
+
function isUserDecisionsEnabled() {
|
|
95137
|
+
return isExperimentEnabled("specs.ditto.CodegenUserDecisions");
|
|
95138
|
+
}
|
|
95139
|
+
}
|
|
95140
|
+
});
|
|
95141
|
+
|
|
94834
95142
|
// dist/flows/opencode-init.js
|
|
94835
95143
|
var require_opencode_init = __commonJS({
|
|
94836
95144
|
"dist/flows/opencode-init.js"(exports2) {
|
|
@@ -94846,6 +95154,8 @@ var require_opencode_init = __commonJS({
|
|
|
94846
95154
|
var ditto_codegen_types_2 = require_dist4();
|
|
94847
95155
|
var context_12 = require_context();
|
|
94848
95156
|
var logger_12 = require_logger();
|
|
95157
|
+
var pre_run_decision_1 = require_pre_run_decision();
|
|
95158
|
+
var experiments_1 = require_experiments();
|
|
94849
95159
|
var runOpencodeInitFlow = async (blueprint, history) => {
|
|
94850
95160
|
const store = job_context_storage_12.jobContextStorage.getStore();
|
|
94851
95161
|
if (!store?.jobId || !store?.taskId) {
|
|
@@ -94861,10 +95171,18 @@ var require_opencode_init = __commonJS({
|
|
|
94861
95171
|
jobLog.info(`[OpenCode Init] Marked task RUNNING: jobId=${localJobContext.jobId}, taskId=${localJobContext.taskId}`);
|
|
94862
95172
|
try {
|
|
94863
95173
|
const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
|
|
95174
|
+
let finalBlueprint = blueprint;
|
|
95175
|
+
if ((0, experiments_1.isUserDecisionsEnabled)()) {
|
|
95176
|
+
const preDecisionResult = await (0, pre_run_decision_1.runPreDecisionCheck)(localJobContext.jobId, { blueprint }, [pre_run_decision_1.checkSiteUIDecision]);
|
|
95177
|
+
finalBlueprint = preDecisionResult.modifiedBlueprint ?? blueprint;
|
|
95178
|
+
if (preDecisionResult.decisionsApplied.length > 0) {
|
|
95179
|
+
jobLog.info(`[OpenCode Init] Applied ${preDecisionResult.decisionsApplied.length} pre-decision(s)`);
|
|
95180
|
+
}
|
|
95181
|
+
}
|
|
94864
95182
|
const orchestrator = new OpenCodeOrchestrator_1.OpenCodeOrchestrator();
|
|
94865
95183
|
(0, cli_listeners_1.attachOrchestratorListeners)(orchestrator);
|
|
94866
95184
|
const result = await orchestrator.generateCode({
|
|
94867
|
-
blueprint,
|
|
95185
|
+
blueprint: finalBlueprint,
|
|
94868
95186
|
outputPath,
|
|
94869
95187
|
projectId: context_12.ctx.projectId,
|
|
94870
95188
|
chatHistory: history
|
|
@@ -128542,7 +128860,9 @@ var require_init_codegen = __commonJS({
|
|
|
128542
128860
|
var ditto_codegen_types_12 = require_dist4();
|
|
128543
128861
|
var codegen_flow_helpers_12 = require_codegen_flow_helpers();
|
|
128544
128862
|
var ditto_codegen_types_2 = require_dist4();
|
|
128863
|
+
var pre_run_decision_1 = require_pre_run_decision();
|
|
128545
128864
|
var logger_12 = require_logger();
|
|
128865
|
+
var experiments_1 = require_experiments();
|
|
128546
128866
|
var runInitCodegenFlow = async (blueprint, history) => {
|
|
128547
128867
|
const localJobContext = job_context_storage_12.jobContextStorage.getStore();
|
|
128548
128868
|
const jobLog = (0, logger_12.getJobLogger)(localJobContext.jobId, localJobContext.taskId);
|
|
@@ -128551,11 +128871,19 @@ var require_init_codegen = __commonJS({
|
|
|
128551
128871
|
jobLog.info(`[Init] Marked task RUNNING: jobId=${localJobContext.jobId}, taskId=${localJobContext.taskId}`);
|
|
128552
128872
|
try {
|
|
128553
128873
|
const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
|
|
128874
|
+
let finalBlueprint = blueprint;
|
|
128875
|
+
if ((0, experiments_1.isUserDecisionsEnabled)()) {
|
|
128876
|
+
const preDecisionResult = await (0, pre_run_decision_1.runPreDecisionCheck)(localJobContext.jobId, { blueprint }, [pre_run_decision_1.checkSiteUIDecision]);
|
|
128877
|
+
finalBlueprint = preDecisionResult.modifiedBlueprint ?? blueprint;
|
|
128878
|
+
if (preDecisionResult.decisionsApplied.length > 0) {
|
|
128879
|
+
jobLog.info(`[Init] Applied ${preDecisionResult.decisionsApplied.length} pre-decision(s)`);
|
|
128880
|
+
}
|
|
128881
|
+
}
|
|
128554
128882
|
const agentsFactory = new AgentsFactory_1.AgentsFactory(false);
|
|
128555
128883
|
const orchestrator = new orchestrator_1.DittoOrchestrator(agentsFactory);
|
|
128556
128884
|
(0, cli_listeners_1.attachOrchestratorListeners)(orchestrator);
|
|
128557
128885
|
try {
|
|
128558
|
-
const requiredPermissionsResponse = await (0, codegen_flow_helpers_12.getRequiredPermissions)(
|
|
128886
|
+
const requiredPermissionsResponse = await (0, codegen_flow_helpers_12.getRequiredPermissions)(finalBlueprint?.extensions ?? []);
|
|
128559
128887
|
await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
|
|
128560
128888
|
requiredPermissions: requiredPermissionsResponse?.data?.requiredPermissions ?? [],
|
|
128561
128889
|
history
|
|
@@ -128570,7 +128898,7 @@ var require_init_codegen = __commonJS({
|
|
|
128570
128898
|
});
|
|
128571
128899
|
}
|
|
128572
128900
|
await orchestrator.generateCode({
|
|
128573
|
-
blueprint,
|
|
128901
|
+
blueprint: finalBlueprint,
|
|
128574
128902
|
outputPath,
|
|
128575
128903
|
appNamespace: context_12.ctx.appNamespace,
|
|
128576
128904
|
history
|
|
@@ -342617,7 +342945,9 @@ var require_iterate_codegen = __commonJS({
|
|
|
342617
342945
|
var IterationOrchestrator_1 = require_IterationOrchestrator();
|
|
342618
342946
|
var codegen_flow_helpers_12 = require_codegen_flow_helpers();
|
|
342619
342947
|
var ditto_codegen_types_2 = require_dist4();
|
|
342948
|
+
var pre_run_decision_1 = require_pre_run_decision();
|
|
342620
342949
|
var logger_12 = require_logger();
|
|
342950
|
+
var experiments_1 = require_experiments();
|
|
342621
342951
|
var runIterateCodegenFlow = async (chatHistory) => {
|
|
342622
342952
|
const localJobContext = job_context_storage_12.jobContextStorage.getStore();
|
|
342623
342953
|
const jobLog = (0, logger_12.getJobLogger)(localJobContext.jobId, localJobContext.taskId);
|
|
@@ -342633,11 +342963,22 @@ var require_iterate_codegen = __commonJS({
|
|
|
342633
342963
|
outputPath,
|
|
342634
342964
|
chatHistory
|
|
342635
342965
|
});
|
|
342636
|
-
|
|
342966
|
+
let finalIterationPlan = iterationPlan;
|
|
342967
|
+
if ((0, experiments_1.isUserDecisionsEnabled)()) {
|
|
342968
|
+
const preDecisionResult = await (0, pre_run_decision_1.runPreDecisionCheck)(localJobContext.jobId, { iterationPlan }, [pre_run_decision_1.checkSiteUIDecision]);
|
|
342969
|
+
finalIterationPlan = preDecisionResult.modifiedIterationPlan ?? iterationPlan;
|
|
342970
|
+
if (preDecisionResult.decisionsApplied.length > 0) {
|
|
342971
|
+
jobLog.info(`[Iterate] Applied ${preDecisionResult.decisionsApplied.length} pre-decision(s)`);
|
|
342972
|
+
}
|
|
342973
|
+
}
|
|
342974
|
+
await updateRequiredPermissions(finalIterationPlan, localJobContext);
|
|
342637
342975
|
await iterationOrchestrator.generateIterationCode({
|
|
342638
342976
|
outputPath,
|
|
342639
342977
|
appNamespace: context_12.ctx.appNamespace,
|
|
342640
|
-
iterationPlanAndPreviousResources: {
|
|
342978
|
+
iterationPlanAndPreviousResources: {
|
|
342979
|
+
iterationPlan: finalIterationPlan,
|
|
342980
|
+
previousResources
|
|
342981
|
+
}
|
|
342641
342982
|
});
|
|
342642
342983
|
await (0, codegen_flow_helpers_12.updateParentTaskStatus)(localJobContext, ditto_codegen_types_12.Status.COMPLETED);
|
|
342643
342984
|
jobLog.info(`[Iterate] Completed iterate codegen task: jobId=${localJobContext.jobId}, taskId=${localJobContext.taskId}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/ditto-codegen-public",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.263",
|
|
4
4
|
"description": "AI-powered Wix CLI app generator - standalone executable",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "node build.mjs",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"@wix/ditto-codegen": "1.0.0",
|
|
29
29
|
"esbuild": "^0.27.2"
|
|
30
30
|
},
|
|
31
|
-
"falconPackageHash": "
|
|
31
|
+
"falconPackageHash": "dba48cab03e25adf44f9e435dce1352d6354d45aa693b174a99500b2"
|
|
32
32
|
}
|