@wix/ditto-codegen-public 1.0.298 → 1.0.300
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 +365 -283
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -11602,6 +11602,7 @@ var require_constants5 = __commonJS({
|
|
|
11602
11602
|
genericExtension: "extension",
|
|
11603
11603
|
customElement: "custom element",
|
|
11604
11604
|
siteComponent: "editor react component",
|
|
11605
|
+
editorReactComponent: "editor react component",
|
|
11605
11606
|
sitePlugin: "site plugin",
|
|
11606
11607
|
ecomShippingRates: "service plugin",
|
|
11607
11608
|
ecomAdditionalFees: "service plugin",
|
|
@@ -11665,6 +11666,75 @@ ${closeBrace}${tail}`;
|
|
|
11665
11666
|
}
|
|
11666
11667
|
});
|
|
11667
11668
|
|
|
11669
|
+
// dist/experiments.js
|
|
11670
|
+
var require_experiments = __commonJS({
|
|
11671
|
+
"dist/experiments.js"(exports2) {
|
|
11672
|
+
"use strict";
|
|
11673
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
11674
|
+
exports2.isExperimentEnabled = isExperimentEnabled;
|
|
11675
|
+
exports2.isUserDecisionsEnabled = isUserDecisionsEnabled;
|
|
11676
|
+
exports2.isUseWixAiGatewayEnabled = isUseWixAiGatewayEnabled;
|
|
11677
|
+
var logger_12 = require_logger();
|
|
11678
|
+
var parsedExperiments = null;
|
|
11679
|
+
function getExperiments() {
|
|
11680
|
+
if (parsedExperiments !== null) {
|
|
11681
|
+
return parsedExperiments;
|
|
11682
|
+
}
|
|
11683
|
+
const raw = process.env.CODEGEN_EXPERIMENTS;
|
|
11684
|
+
if (!raw) {
|
|
11685
|
+
parsedExperiments = {};
|
|
11686
|
+
return parsedExperiments;
|
|
11687
|
+
}
|
|
11688
|
+
try {
|
|
11689
|
+
parsedExperiments = JSON.parse(raw);
|
|
11690
|
+
} catch (error) {
|
|
11691
|
+
logger_12.logger.error("[Experiments] Failed to parse CODEGEN_EXPERIMENTS", {
|
|
11692
|
+
error: error instanceof Error ? error.message : String(error)
|
|
11693
|
+
});
|
|
11694
|
+
parsedExperiments = {};
|
|
11695
|
+
}
|
|
11696
|
+
return parsedExperiments;
|
|
11697
|
+
}
|
|
11698
|
+
function isExperimentEnabled(specName) {
|
|
11699
|
+
return getExperiments()[specName] === "true";
|
|
11700
|
+
}
|
|
11701
|
+
function isUserDecisionsEnabled() {
|
|
11702
|
+
return isExperimentEnabled("specs.ditto.CodegenUserDecisions");
|
|
11703
|
+
}
|
|
11704
|
+
function isUseWixAiGatewayEnabled() {
|
|
11705
|
+
return isExperimentEnabled("specs.ditto.CodegenUseWixAiGateway");
|
|
11706
|
+
}
|
|
11707
|
+
}
|
|
11708
|
+
});
|
|
11709
|
+
|
|
11710
|
+
// dist/opencode-integration/rules-writer.js
|
|
11711
|
+
var require_rules_writer = __commonJS({
|
|
11712
|
+
"dist/opencode-integration/rules-writer.js"(exports2) {
|
|
11713
|
+
"use strict";
|
|
11714
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
11715
|
+
exports2.getRulePath = getRulePath;
|
|
11716
|
+
exports2.writeRuleFiles = writeRuleFiles;
|
|
11717
|
+
var promises_1 = require("fs/promises");
|
|
11718
|
+
var os_1 = require("os");
|
|
11719
|
+
var path_1 = require("path");
|
|
11720
|
+
var logger_12 = require_logger();
|
|
11721
|
+
var GLOBAL_RULES_DIR = (0, path_1.join)((0, os_1.homedir)(), ".config", "opencode", "rules");
|
|
11722
|
+
function getRulePath(filename) {
|
|
11723
|
+
return (0, path_1.join)(GLOBAL_RULES_DIR, filename);
|
|
11724
|
+
}
|
|
11725
|
+
async function writeRuleFiles(rules) {
|
|
11726
|
+
await (0, promises_1.mkdir)(GLOBAL_RULES_DIR, { recursive: true });
|
|
11727
|
+
const paths = rules.map((rule) => getRulePath(rule.filename));
|
|
11728
|
+
await Promise.all(rules.map((rule) => (0, promises_1.writeFile)(getRulePath(rule.filename), rule.content, "utf-8")));
|
|
11729
|
+
logger_12.logger.info("[OpenCode] Wrote global rule files", {
|
|
11730
|
+
dir: GLOBAL_RULES_DIR,
|
|
11731
|
+
files: rules.map((r) => r.filename)
|
|
11732
|
+
});
|
|
11733
|
+
return paths;
|
|
11734
|
+
}
|
|
11735
|
+
}
|
|
11736
|
+
});
|
|
11737
|
+
|
|
11668
11738
|
// dist/opencode-integration/rules/codegen-rules.js
|
|
11669
11739
|
var require_codegen_rules = __commonJS({
|
|
11670
11740
|
"dist/opencode-integration/rules/codegen-rules.js"(exports2) {
|
|
@@ -11752,70 +11822,289 @@ IMPORTANT INSTRUCTIONS:
|
|
|
11752
11822
|
}
|
|
11753
11823
|
});
|
|
11754
11824
|
|
|
11755
|
-
//
|
|
11756
|
-
var
|
|
11757
|
-
"
|
|
11825
|
+
// ../../node_modules/@wix/ambassador-ctp-ditto-v1-blueprint/cjs/build/types.impl.js
|
|
11826
|
+
var require_types_impl2 = __commonJS({
|
|
11827
|
+
"../../node_modules/@wix/ambassador-ctp-ditto-v1-blueprint/cjs/build/types.impl.js"(exports2) {
|
|
11828
|
+
"use strict";
|
|
11829
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
11830
|
+
exports2.ExtensionType = void 0;
|
|
11831
|
+
var ExtensionType;
|
|
11832
|
+
(function(ExtensionType2) {
|
|
11833
|
+
ExtensionType2["UNDEFINED_EXTENSION_TYPE"] = "UNDEFINED_EXTENSION_TYPE";
|
|
11834
|
+
ExtensionType2["DASHBOARD_PAGE"] = "DASHBOARD_PAGE";
|
|
11835
|
+
ExtensionType2["DASHBOARD_PLUGIN"] = "DASHBOARD_PLUGIN";
|
|
11836
|
+
ExtensionType2["DASHBOARD_MODAL"] = "DASHBOARD_MODAL";
|
|
11837
|
+
ExtensionType2["SITE_WIDGET"] = "SITE_WIDGET";
|
|
11838
|
+
ExtensionType2["EMBEDDED_SCRIPT"] = "EMBEDDED_SCRIPT";
|
|
11839
|
+
ExtensionType2["BACKEND_API"] = "BACKEND_API";
|
|
11840
|
+
ExtensionType2["BACKEND_EVENT"] = "BACKEND_EVENT";
|
|
11841
|
+
ExtensionType2["SERVICE_PLUGIN"] = "SERVICE_PLUGIN";
|
|
11842
|
+
ExtensionType2["WEB_METHODS"] = "WEB_METHODS";
|
|
11843
|
+
ExtensionType2["SITE_COMPONENT"] = "SITE_COMPONENT";
|
|
11844
|
+
ExtensionType2["WEBHOOK"] = "WEBHOOK";
|
|
11845
|
+
ExtensionType2["SITE_PLUGIN"] = "SITE_PLUGIN";
|
|
11846
|
+
ExtensionType2["DATA_COLLECTION"] = "DATA_COLLECTION";
|
|
11847
|
+
ExtensionType2["DASHBOARD_MENU_PLUGIN"] = "DASHBOARD_MENU_PLUGIN";
|
|
11848
|
+
ExtensionType2["CUSTOM_ELEMENT_WIDGET"] = "CUSTOM_ELEMENT_WIDGET";
|
|
11849
|
+
ExtensionType2["EDITOR_REACT_COMPONENT"] = "EDITOR_REACT_COMPONENT";
|
|
11850
|
+
})(ExtensionType || (exports2.ExtensionType = ExtensionType = {}));
|
|
11851
|
+
}
|
|
11852
|
+
});
|
|
11853
|
+
|
|
11854
|
+
// dist/job-decision-manager.js
|
|
11855
|
+
var require_job_decision_manager = __commonJS({
|
|
11856
|
+
"dist/job-decision-manager.js"(exports2) {
|
|
11857
|
+
"use strict";
|
|
11858
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
11859
|
+
exports2.UserDecisionCancelledError = void 0;
|
|
11860
|
+
exports2.pauseForUserDecision = pauseForUserDecision;
|
|
11861
|
+
exports2.askJobChoice = askJobChoice;
|
|
11862
|
+
exports2.askJobConfirmation = askJobConfirmation;
|
|
11863
|
+
var types_1 = require_types_impl();
|
|
11864
|
+
var codeGenerationService_12 = require_codeGenerationService();
|
|
11865
|
+
var CodeGenService_12 = require_CodeGenService();
|
|
11866
|
+
var logger_12 = require_logger();
|
|
11867
|
+
var DECISION_POLL_INTERVAL_MS = 2e3;
|
|
11868
|
+
var UserDecisionCancelledError = class extends Error {
|
|
11869
|
+
constructor(jobId, decisionId) {
|
|
11870
|
+
super(`User decision ${decisionId} cancelled for job ${jobId}`);
|
|
11871
|
+
this.jobId = jobId;
|
|
11872
|
+
this.decisionId = decisionId;
|
|
11873
|
+
this.name = "UserDecisionCancelledError";
|
|
11874
|
+
}
|
|
11875
|
+
};
|
|
11876
|
+
exports2.UserDecisionCancelledError = UserDecisionCancelledError;
|
|
11877
|
+
async function pauseForUserDecision(jobId, request) {
|
|
11878
|
+
const decisionId = crypto.randomUUID();
|
|
11879
|
+
const userDecision = {
|
|
11880
|
+
id: decisionId,
|
|
11881
|
+
request: {
|
|
11882
|
+
...request,
|
|
11883
|
+
requestedAt: /* @__PURE__ */ new Date()
|
|
11884
|
+
}
|
|
11885
|
+
};
|
|
11886
|
+
await codeGenerationService_12.codeGenerationService.updateJobWithPendingDecision(jobId, userDecision);
|
|
11887
|
+
logger_12.logger.info("[JobDecision] Paused for user input", {
|
|
11888
|
+
question: request.question
|
|
11889
|
+
});
|
|
11890
|
+
const startTime = Date.now();
|
|
11891
|
+
const response = await pollForJobDecisionResponse(jobId, decisionId);
|
|
11892
|
+
const durationMs = Date.now() - startTime;
|
|
11893
|
+
await codeGenerationService_12.codeGenerationService.resumeJobFromDecision(jobId);
|
|
11894
|
+
logger_12.logger.info("[JobDecision] Resumed after user decision", {
|
|
11895
|
+
selectedOptionId: response.selectedOptionId,
|
|
11896
|
+
durationMs
|
|
11897
|
+
});
|
|
11898
|
+
return response;
|
|
11899
|
+
}
|
|
11900
|
+
async function pollForJobDecisionResponse(jobId, decisionId) {
|
|
11901
|
+
logger_12.logger.info("[JobDecision] Polling for user decision response", {
|
|
11902
|
+
decisionId
|
|
11903
|
+
});
|
|
11904
|
+
while (true) {
|
|
11905
|
+
const job = await codeGenerationService_12.codeGenerationService.getJob(jobId);
|
|
11906
|
+
if (!job) {
|
|
11907
|
+
throw new Error(`Job ${jobId} not found`);
|
|
11908
|
+
}
|
|
11909
|
+
if (job.status === CodeGenService_12.Status.CANCELLED || job.status === CodeGenService_12.Status.PENDING_CANCEL) {
|
|
11910
|
+
logger_12.logger.warn("[JobDecision] Job cancelled while waiting for user decision", { decisionId });
|
|
11911
|
+
throw new UserDecisionCancelledError(jobId, decisionId);
|
|
11912
|
+
}
|
|
11913
|
+
const decision = job.pendingUserDecisions?.find((d) => d.id === decisionId) ?? job.userDecisionHistory?.find((d) => d.id === decisionId);
|
|
11914
|
+
if (decision?.response?.selectedOptionId) {
|
|
11915
|
+
return {
|
|
11916
|
+
selectedOptionId: decision.response.selectedOptionId,
|
|
11917
|
+
respondedAt: decision.response.respondedAt ?? /* @__PURE__ */ new Date()
|
|
11918
|
+
};
|
|
11919
|
+
}
|
|
11920
|
+
await new Promise((resolve) => setTimeout(resolve, DECISION_POLL_INTERVAL_MS));
|
|
11921
|
+
}
|
|
11922
|
+
}
|
|
11923
|
+
async function askJobChoice(jobId, question, options, context) {
|
|
11924
|
+
const response = await pauseForUserDecision(jobId, {
|
|
11925
|
+
question,
|
|
11926
|
+
questionType: types_1.UserDecisionQuestionType.UI_COMPONENT_TYPE,
|
|
11927
|
+
options,
|
|
11928
|
+
context
|
|
11929
|
+
});
|
|
11930
|
+
if (!response.selectedOptionId) {
|
|
11931
|
+
throw new Error("No option selected in user decision response");
|
|
11932
|
+
}
|
|
11933
|
+
return response.selectedOptionId;
|
|
11934
|
+
}
|
|
11935
|
+
async function askJobConfirmation(jobId, question, context) {
|
|
11936
|
+
const response = await pauseForUserDecision(jobId, {
|
|
11937
|
+
question,
|
|
11938
|
+
questionType: types_1.UserDecisionQuestionType.UI_COMPONENT_TYPE,
|
|
11939
|
+
options: [
|
|
11940
|
+
{ id: "yes", label: "Yes" },
|
|
11941
|
+
{ id: "no", label: "No" }
|
|
11942
|
+
],
|
|
11943
|
+
context
|
|
11944
|
+
});
|
|
11945
|
+
return response.selectedOptionId === "yes";
|
|
11946
|
+
}
|
|
11947
|
+
}
|
|
11948
|
+
});
|
|
11949
|
+
|
|
11950
|
+
// dist/pre-run-decision.js
|
|
11951
|
+
var require_pre_run_decision = __commonJS({
|
|
11952
|
+
"dist/pre-run-decision.js"(exports2) {
|
|
11953
|
+
"use strict";
|
|
11954
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
11955
|
+
exports2.checkSiteUIDecision = void 0;
|
|
11956
|
+
exports2.runPreDecisionCheck = runPreDecisionCheck;
|
|
11957
|
+
var types_1 = require_types_impl2();
|
|
11958
|
+
var job_decision_manager_1 = require_job_decision_manager();
|
|
11959
|
+
var logger_12 = require_logger();
|
|
11960
|
+
async function runPreDecisionCheck(jobId, context, checkers) {
|
|
11961
|
+
const allDecisions = [];
|
|
11962
|
+
let modifiedPayload = context.payload;
|
|
11963
|
+
for (const checker of checkers) {
|
|
11964
|
+
const result = await checker(jobId, {
|
|
11965
|
+
payload: modifiedPayload
|
|
11966
|
+
});
|
|
11967
|
+
if (result) {
|
|
11968
|
+
allDecisions.push(...result.decisionsApplied);
|
|
11969
|
+
if (result.modifiedPayload) {
|
|
11970
|
+
modifiedPayload = result.modifiedPayload;
|
|
11971
|
+
}
|
|
11972
|
+
}
|
|
11973
|
+
}
|
|
11974
|
+
return {
|
|
11975
|
+
decisionsApplied: allDecisions,
|
|
11976
|
+
modifiedPayload
|
|
11977
|
+
};
|
|
11978
|
+
}
|
|
11979
|
+
var checkSiteUIDecision = async (jobId, context) => {
|
|
11980
|
+
const blueprint = context.payload;
|
|
11981
|
+
const extensions = blueprint?.extensions ?? [];
|
|
11982
|
+
const siteUIExtension = extensions.find((ext) => isSiteUIExtension(ext));
|
|
11983
|
+
if (!siteUIExtension?.name) {
|
|
11984
|
+
return null;
|
|
11985
|
+
}
|
|
11986
|
+
const extensionName = siteUIExtension.name;
|
|
11987
|
+
const currentType = siteUIExtension.type;
|
|
11988
|
+
logger_12.logger.info(`[PreDecision] Found site UI extension: "${extensionName}" (current type: ${currentType})`);
|
|
11989
|
+
const { widget: widgetType, component: componentType } = getSiteUITypePair(currentType);
|
|
11990
|
+
const options = [
|
|
11991
|
+
{
|
|
11992
|
+
id: widgetType,
|
|
11993
|
+
label: "Custom Element Widget",
|
|
11994
|
+
description: "A self-contained widget built as a Custom Element, embedded on the site. Best for standalone, reusable components."
|
|
11995
|
+
},
|
|
11996
|
+
{
|
|
11997
|
+
id: componentType,
|
|
11998
|
+
label: "Editor React Component",
|
|
11999
|
+
description: "A React component that integrates with the site builder. Best for components that need to work with Wix editor features."
|
|
12000
|
+
}
|
|
12001
|
+
];
|
|
12002
|
+
const selectedType = await (0, job_decision_manager_1.askJobChoice)(jobId, `What type of site UI element would you like to create for "${extensionName}"?`, options, "Custom Element Widgets are standalone embeddable units with their own styling, while Editor React Components integrate more deeply with the Wix editor and builder.");
|
|
12003
|
+
const selectedLabel = options.find((o) => o.id === selectedType)?.label ?? selectedType;
|
|
12004
|
+
const isTypeChanged = selectedType !== currentType;
|
|
12005
|
+
logger_12.logger.info(`[PreDecision] User selected ${selectedType} for "${extensionName}"${isTypeChanged ? ` (changed from ${currentType})` : " (unchanged)"}`);
|
|
12006
|
+
const appliedDecision = {
|
|
12007
|
+
type: "SITE_UI_TYPE",
|
|
12008
|
+
question: "Custom Element Widget vs Editor React Component",
|
|
12009
|
+
selectedOptionId: selectedType
|
|
12010
|
+
};
|
|
12011
|
+
return {
|
|
12012
|
+
decisionsApplied: [appliedDecision],
|
|
12013
|
+
modifiedPayload: blueprint ? applyTypeToBlueprint(blueprint, extensionName, selectedType, selectedLabel) : void 0
|
|
12014
|
+
};
|
|
12015
|
+
};
|
|
12016
|
+
exports2.checkSiteUIDecision = checkSiteUIDecision;
|
|
12017
|
+
function isSiteUIExtension(extension) {
|
|
12018
|
+
return extension.type === types_1.ExtensionType.SITE_WIDGET || extension.type === types_1.ExtensionType.SITE_COMPONENT || extension.type === types_1.ExtensionType.CUSTOM_ELEMENT_WIDGET || extension.type === types_1.ExtensionType.EDITOR_REACT_COMPONENT;
|
|
12019
|
+
}
|
|
12020
|
+
function isLegacySiteUIType(type) {
|
|
12021
|
+
return type === types_1.ExtensionType.SITE_WIDGET || type === types_1.ExtensionType.SITE_COMPONENT;
|
|
12022
|
+
}
|
|
12023
|
+
function getSiteUITypePair(type) {
|
|
12024
|
+
return isLegacySiteUIType(type) ? {
|
|
12025
|
+
widget: types_1.ExtensionType.SITE_WIDGET,
|
|
12026
|
+
component: types_1.ExtensionType.SITE_COMPONENT
|
|
12027
|
+
} : {
|
|
12028
|
+
widget: types_1.ExtensionType.CUSTOM_ELEMENT_WIDGET,
|
|
12029
|
+
component: types_1.ExtensionType.EDITOR_REACT_COMPONENT
|
|
12030
|
+
};
|
|
12031
|
+
}
|
|
12032
|
+
function applyTypeToBlueprint(blueprint, extensionName, type, label) {
|
|
12033
|
+
const summaryNotice = `[USER DECISION] The user explicitly chose "${label}" for the "${extensionName}" extension. You MUST generate it as type ${type}. Do NOT use any other type.`;
|
|
12034
|
+
const descriptionNotice = `[USER DECISION] This extension MUST be a ${label} (type: ${type}). The user explicitly chose this. Do NOT change it.`;
|
|
12035
|
+
return {
|
|
12036
|
+
...blueprint,
|
|
12037
|
+
summary: `${summaryNotice}
|
|
12038
|
+
|
|
12039
|
+
${blueprint.summary ?? ""}`.trim(),
|
|
12040
|
+
extensions: blueprint.extensions?.map((ext) => ext.name === extensionName ? {
|
|
12041
|
+
...ext,
|
|
12042
|
+
type,
|
|
12043
|
+
description: `${descriptionNotice}
|
|
12044
|
+
|
|
12045
|
+
${ext.description ?? ""}`.trim(),
|
|
12046
|
+
_userDecision: "IMPORTANT: The user explicitly chose this extension type. You MUST use this exact type."
|
|
12047
|
+
} : ext)
|
|
12048
|
+
};
|
|
12049
|
+
}
|
|
12050
|
+
}
|
|
12051
|
+
});
|
|
12052
|
+
|
|
12053
|
+
// dist/environments/app-builder.js
|
|
12054
|
+
var require_app_builder = __commonJS({
|
|
12055
|
+
"dist/environments/app-builder.js"(exports2) {
|
|
12056
|
+
"use strict";
|
|
12057
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12058
|
+
exports2.appBuilderCodegenConfig = void 0;
|
|
12059
|
+
var codegen_rules_1 = require_codegen_rules();
|
|
12060
|
+
var ask_rules_1 = require_ask_rules();
|
|
12061
|
+
var pre_run_decision_1 = require_pre_run_decision();
|
|
12062
|
+
exports2.appBuilderCodegenConfig = {
|
|
12063
|
+
codegenRules: [
|
|
12064
|
+
{ filename: "codegen-instructions.md", content: codegen_rules_1.CODEGEN_RULES }
|
|
12065
|
+
],
|
|
12066
|
+
askRules: [{ filename: "ask-instructions.md", content: ask_rules_1.ASK_RULES }],
|
|
12067
|
+
decisionCheckers: [pre_run_decision_1.checkSiteUIDecision]
|
|
12068
|
+
};
|
|
12069
|
+
}
|
|
12070
|
+
});
|
|
12071
|
+
|
|
12072
|
+
// dist/environments/studio-2.js
|
|
12073
|
+
var require_studio_2 = __commonJS({
|
|
12074
|
+
"dist/environments/studio-2.js"(exports2) {
|
|
11758
12075
|
"use strict";
|
|
11759
12076
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
11760
|
-
exports2.
|
|
11761
|
-
exports2.writeRuleFiles = writeRuleFiles;
|
|
11762
|
-
var promises_1 = require("fs/promises");
|
|
11763
|
-
var os_1 = require("os");
|
|
11764
|
-
var path_1 = require("path");
|
|
12077
|
+
exports2.studio2CodegenConfig = void 0;
|
|
11765
12078
|
var codegen_rules_1 = require_codegen_rules();
|
|
11766
12079
|
var ask_rules_1 = require_ask_rules();
|
|
11767
|
-
|
|
11768
|
-
|
|
11769
|
-
|
|
11770
|
-
|
|
11771
|
-
|
|
11772
|
-
|
|
11773
|
-
|
|
11774
|
-
(0, promises_1.writeFile)(exports2.CODEGEN_RULES_PATH, codegen_rules_1.CODEGEN_RULES, "utf-8"),
|
|
11775
|
-
(0, promises_1.writeFile)(exports2.ASK_RULES_PATH, ask_rules_1.ASK_RULES, "utf-8")
|
|
11776
|
-
]);
|
|
11777
|
-
logger_12.logger.info("[OpenCode] Wrote global rule files", { dir: GLOBAL_RULES_DIR });
|
|
11778
|
-
}
|
|
12080
|
+
exports2.studio2CodegenConfig = {
|
|
12081
|
+
codegenRules: [
|
|
12082
|
+
{ filename: "codegen-instructions.md", content: codegen_rules_1.CODEGEN_RULES }
|
|
12083
|
+
],
|
|
12084
|
+
askRules: [{ filename: "ask-instructions.md", content: ask_rules_1.ASK_RULES }],
|
|
12085
|
+
decisionCheckers: []
|
|
12086
|
+
};
|
|
11779
12087
|
}
|
|
11780
12088
|
});
|
|
11781
12089
|
|
|
11782
|
-
// dist/
|
|
11783
|
-
var
|
|
11784
|
-
"dist/
|
|
12090
|
+
// dist/environments/index.js
|
|
12091
|
+
var require_environments = __commonJS({
|
|
12092
|
+
"dist/environments/index.js"(exports2) {
|
|
11785
12093
|
"use strict";
|
|
11786
12094
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
11787
|
-
exports2.
|
|
11788
|
-
|
|
11789
|
-
|
|
11790
|
-
var
|
|
11791
|
-
|
|
11792
|
-
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
return parsedExperiments;
|
|
11800
|
-
}
|
|
11801
|
-
try {
|
|
11802
|
-
parsedExperiments = JSON.parse(raw);
|
|
11803
|
-
} catch (error) {
|
|
11804
|
-
logger_12.logger.error("[Experiments] Failed to parse CODEGEN_EXPERIMENTS", {
|
|
11805
|
-
error: error instanceof Error ? error.message : String(error)
|
|
11806
|
-
});
|
|
11807
|
-
parsedExperiments = {};
|
|
12095
|
+
exports2.getCodegenEnvironmentConfig = getCodegenEnvironmentConfig;
|
|
12096
|
+
var types_1 = require_types_impl();
|
|
12097
|
+
var app_builder_1 = require_app_builder();
|
|
12098
|
+
var studio_2_1 = require_studio_2();
|
|
12099
|
+
function getCodegenEnvironmentConfig(environment) {
|
|
12100
|
+
switch (environment) {
|
|
12101
|
+
case types_1.Environment.STUDIO_2:
|
|
12102
|
+
return studio_2_1.studio2CodegenConfig;
|
|
12103
|
+
case types_1.Environment.APP_BUILDER:
|
|
12104
|
+
case types_1.Environment.UNKNOWN_ENVIRONMENT:
|
|
12105
|
+
default:
|
|
12106
|
+
return app_builder_1.appBuilderCodegenConfig;
|
|
11808
12107
|
}
|
|
11809
|
-
return parsedExperiments;
|
|
11810
|
-
}
|
|
11811
|
-
function isExperimentEnabled(specName) {
|
|
11812
|
-
return getExperiments()[specName] === "true";
|
|
11813
|
-
}
|
|
11814
|
-
function isUserDecisionsEnabled() {
|
|
11815
|
-
return isExperimentEnabled("specs.ditto.CodegenUserDecisions");
|
|
11816
|
-
}
|
|
11817
|
-
function isUseWixAiGatewayEnabled() {
|
|
11818
|
-
return isExperimentEnabled("specs.ditto.CodegenUseWixAiGateway");
|
|
11819
12108
|
}
|
|
11820
12109
|
}
|
|
11821
12110
|
});
|
|
@@ -11828,11 +12117,11 @@ var require_config = __commonJS({
|
|
|
11828
12117
|
exports2.DEFAULT_MODEL = exports2.DEFAULT_TIMEOUT_MS = void 0;
|
|
11829
12118
|
exports2.getAnthropicBaseUrl = getAnthropicBaseUrl;
|
|
11830
12119
|
exports2.getOpenCodeEnv = getOpenCodeEnv;
|
|
11831
|
-
exports2.getOpenCodeAskEnv = getOpenCodeAskEnv;
|
|
11832
12120
|
var os_1 = require("os");
|
|
11833
12121
|
var constants_1 = require_constants5();
|
|
11834
|
-
var rules_writer_12 = require_rules_writer();
|
|
11835
12122
|
var experiments_1 = require_experiments();
|
|
12123
|
+
var rules_writer_12 = require_rules_writer();
|
|
12124
|
+
var environments_12 = require_environments();
|
|
11836
12125
|
exports2.DEFAULT_TIMEOUT_MS = 20 * 60 * 1e3;
|
|
11837
12126
|
exports2.DEFAULT_MODEL = "anthropic/claude-sonnet-4-6";
|
|
11838
12127
|
var AI_PROXY_BASE_URL = process.env.CODEGEN_AI_PROXY_BASE_URL || "http://localhost:3001";
|
|
@@ -11868,7 +12157,7 @@ var require_config = __commonJS({
|
|
|
11868
12157
|
enabled: true
|
|
11869
12158
|
}
|
|
11870
12159
|
};
|
|
11871
|
-
function getOpenCodeConfig() {
|
|
12160
|
+
function getOpenCodeConfig(instructionPaths) {
|
|
11872
12161
|
return {
|
|
11873
12162
|
model: exports2.DEFAULT_MODEL,
|
|
11874
12163
|
provider: getProviderConfig(),
|
|
@@ -11895,14 +12184,14 @@ var require_config = __commonJS({
|
|
|
11895
12184
|
"/root/.opencode/**": "allow"
|
|
11896
12185
|
}
|
|
11897
12186
|
},
|
|
11898
|
-
instructions:
|
|
12187
|
+
instructions: instructionPaths,
|
|
11899
12188
|
autoupdate: false,
|
|
11900
12189
|
share: "disabled",
|
|
11901
12190
|
lsp: false,
|
|
11902
12191
|
mcp: WIX_MCP_CONFIG
|
|
11903
12192
|
};
|
|
11904
12193
|
}
|
|
11905
|
-
function getOpenCodeAskConfig() {
|
|
12194
|
+
function getOpenCodeAskConfig(instructionPaths) {
|
|
11906
12195
|
return {
|
|
11907
12196
|
model: exports2.DEFAULT_MODEL,
|
|
11908
12197
|
provider: getProviderConfig(),
|
|
@@ -11929,7 +12218,7 @@ var require_config = __commonJS({
|
|
|
11929
12218
|
/* OpenCodeTool.Uuid */
|
|
11930
12219
|
]: "deny"
|
|
11931
12220
|
},
|
|
11932
|
-
instructions:
|
|
12221
|
+
instructions: instructionPaths,
|
|
11933
12222
|
lsp: false,
|
|
11934
12223
|
mcp: WIX_MCP_CONFIG
|
|
11935
12224
|
};
|
|
@@ -11954,11 +12243,12 @@ var require_config = __commonJS({
|
|
|
11954
12243
|
OPENCODE_DISABLE_FILETIME_CHECK: "true"
|
|
11955
12244
|
};
|
|
11956
12245
|
}
|
|
11957
|
-
function getOpenCodeEnv(projectId) {
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
11961
|
-
|
|
12246
|
+
function getOpenCodeEnv(projectId, isAsk = false) {
|
|
12247
|
+
const envConfig = (0, environments_12.getCodegenEnvironmentConfig)();
|
|
12248
|
+
const rules = isAsk ? envConfig.askRules : envConfig.codegenRules;
|
|
12249
|
+
const paths = rules.map((r) => (0, rules_writer_12.getRulePath)(r.filename));
|
|
12250
|
+
const config = isAsk ? getOpenCodeAskConfig(paths) : getOpenCodeConfig(paths);
|
|
12251
|
+
return buildOpenCodeEnv(projectId, config);
|
|
11962
12252
|
}
|
|
11963
12253
|
}
|
|
11964
12254
|
});
|
|
@@ -12902,7 +13192,7 @@ var require_executor = __commonJS({
|
|
|
12902
13192
|
}
|
|
12903
13193
|
async function logOpenCodeStats(options) {
|
|
12904
13194
|
const isAsk = job_context_storage_12.jobContextStorage.getStore()?.kind === ditto_codegen_types_12.TaskKind.ASK_CODEGEN;
|
|
12905
|
-
const env =
|
|
13195
|
+
const env = (0, config_1.getOpenCodeEnv)(options.projectId, isAsk);
|
|
12906
13196
|
const stats = await (0, cost_tracker_1.fetchOpenCodeStats)(options.outputPath, env);
|
|
12907
13197
|
if (stats) {
|
|
12908
13198
|
console.log("[OpenCode] Stats\n", stats);
|
|
@@ -12958,7 +13248,7 @@ var require_executor = __commonJS({
|
|
|
12958
13248
|
workingDirectory: outputPath
|
|
12959
13249
|
});
|
|
12960
13250
|
const isAsk = job_context_storage_12.jobContextStorage.getStore()?.kind === ditto_codegen_types_12.TaskKind.ASK_CODEGEN;
|
|
12961
|
-
const env =
|
|
13251
|
+
const env = (0, config_1.getOpenCodeEnv)(projectId, isAsk);
|
|
12962
13252
|
ctx.child = (0, child_process_1.spawn)("opencode", args, {
|
|
12963
13253
|
cwd: outputPath,
|
|
12964
13254
|
env,
|
|
@@ -17490,219 +17780,6 @@ var require_biEvents = __commonJS({
|
|
|
17490
17780
|
}
|
|
17491
17781
|
});
|
|
17492
17782
|
|
|
17493
|
-
// ../../node_modules/@wix/ambassador-ctp-ditto-v1-blueprint/cjs/build/types.impl.js
|
|
17494
|
-
var require_types_impl2 = __commonJS({
|
|
17495
|
-
"../../node_modules/@wix/ambassador-ctp-ditto-v1-blueprint/cjs/build/types.impl.js"(exports2) {
|
|
17496
|
-
"use strict";
|
|
17497
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
17498
|
-
exports2.ExtensionType = void 0;
|
|
17499
|
-
var ExtensionType;
|
|
17500
|
-
(function(ExtensionType2) {
|
|
17501
|
-
ExtensionType2["UNDEFINED_EXTENSION_TYPE"] = "UNDEFINED_EXTENSION_TYPE";
|
|
17502
|
-
ExtensionType2["DASHBOARD_PAGE"] = "DASHBOARD_PAGE";
|
|
17503
|
-
ExtensionType2["DASHBOARD_PLUGIN"] = "DASHBOARD_PLUGIN";
|
|
17504
|
-
ExtensionType2["DASHBOARD_MODAL"] = "DASHBOARD_MODAL";
|
|
17505
|
-
ExtensionType2["SITE_WIDGET"] = "SITE_WIDGET";
|
|
17506
|
-
ExtensionType2["EMBEDDED_SCRIPT"] = "EMBEDDED_SCRIPT";
|
|
17507
|
-
ExtensionType2["BACKEND_API"] = "BACKEND_API";
|
|
17508
|
-
ExtensionType2["BACKEND_EVENT"] = "BACKEND_EVENT";
|
|
17509
|
-
ExtensionType2["SERVICE_PLUGIN"] = "SERVICE_PLUGIN";
|
|
17510
|
-
ExtensionType2["WEB_METHODS"] = "WEB_METHODS";
|
|
17511
|
-
ExtensionType2["SITE_COMPONENT"] = "SITE_COMPONENT";
|
|
17512
|
-
ExtensionType2["WEBHOOK"] = "WEBHOOK";
|
|
17513
|
-
ExtensionType2["SITE_PLUGIN"] = "SITE_PLUGIN";
|
|
17514
|
-
ExtensionType2["DATA_COLLECTION"] = "DATA_COLLECTION";
|
|
17515
|
-
ExtensionType2["DASHBOARD_MENU_PLUGIN"] = "DASHBOARD_MENU_PLUGIN";
|
|
17516
|
-
ExtensionType2["CUSTOM_ELEMENT_WIDGET"] = "CUSTOM_ELEMENT_WIDGET";
|
|
17517
|
-
ExtensionType2["EDITOR_REACT_COMPONENT"] = "EDITOR_REACT_COMPONENT";
|
|
17518
|
-
})(ExtensionType || (exports2.ExtensionType = ExtensionType = {}));
|
|
17519
|
-
}
|
|
17520
|
-
});
|
|
17521
|
-
|
|
17522
|
-
// dist/job-decision-manager.js
|
|
17523
|
-
var require_job_decision_manager = __commonJS({
|
|
17524
|
-
"dist/job-decision-manager.js"(exports2) {
|
|
17525
|
-
"use strict";
|
|
17526
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
17527
|
-
exports2.UserDecisionCancelledError = void 0;
|
|
17528
|
-
exports2.pauseForUserDecision = pauseForUserDecision;
|
|
17529
|
-
exports2.askJobChoice = askJobChoice;
|
|
17530
|
-
exports2.askJobConfirmation = askJobConfirmation;
|
|
17531
|
-
var types_1 = require_types_impl();
|
|
17532
|
-
var codeGenerationService_12 = require_codeGenerationService();
|
|
17533
|
-
var CodeGenService_12 = require_CodeGenService();
|
|
17534
|
-
var logger_12 = require_logger();
|
|
17535
|
-
var DECISION_POLL_INTERVAL_MS = 2e3;
|
|
17536
|
-
var UserDecisionCancelledError = class extends Error {
|
|
17537
|
-
constructor(jobId, decisionId) {
|
|
17538
|
-
super(`User decision ${decisionId} cancelled for job ${jobId}`);
|
|
17539
|
-
this.jobId = jobId;
|
|
17540
|
-
this.decisionId = decisionId;
|
|
17541
|
-
this.name = "UserDecisionCancelledError";
|
|
17542
|
-
}
|
|
17543
|
-
};
|
|
17544
|
-
exports2.UserDecisionCancelledError = UserDecisionCancelledError;
|
|
17545
|
-
async function pauseForUserDecision(jobId, request) {
|
|
17546
|
-
const decisionId = crypto.randomUUID();
|
|
17547
|
-
const userDecision = {
|
|
17548
|
-
id: decisionId,
|
|
17549
|
-
request: {
|
|
17550
|
-
...request,
|
|
17551
|
-
requestedAt: /* @__PURE__ */ new Date()
|
|
17552
|
-
}
|
|
17553
|
-
};
|
|
17554
|
-
await codeGenerationService_12.codeGenerationService.updateJobWithPendingDecision(jobId, userDecision);
|
|
17555
|
-
logger_12.logger.info("[JobDecision] Paused for user input", {
|
|
17556
|
-
question: request.question
|
|
17557
|
-
});
|
|
17558
|
-
const startTime = Date.now();
|
|
17559
|
-
const response = await pollForJobDecisionResponse(jobId, decisionId);
|
|
17560
|
-
const durationMs = Date.now() - startTime;
|
|
17561
|
-
await codeGenerationService_12.codeGenerationService.resumeJobFromDecision(jobId);
|
|
17562
|
-
logger_12.logger.info("[JobDecision] Resumed after user decision", {
|
|
17563
|
-
selectedOptionId: response.selectedOptionId,
|
|
17564
|
-
durationMs
|
|
17565
|
-
});
|
|
17566
|
-
return response;
|
|
17567
|
-
}
|
|
17568
|
-
async function pollForJobDecisionResponse(jobId, decisionId) {
|
|
17569
|
-
logger_12.logger.info("[JobDecision] Polling for user decision response", {
|
|
17570
|
-
decisionId
|
|
17571
|
-
});
|
|
17572
|
-
while (true) {
|
|
17573
|
-
const job = await codeGenerationService_12.codeGenerationService.getJob(jobId);
|
|
17574
|
-
if (!job) {
|
|
17575
|
-
throw new Error(`Job ${jobId} not found`);
|
|
17576
|
-
}
|
|
17577
|
-
if (job.status === CodeGenService_12.Status.CANCELLED || job.status === CodeGenService_12.Status.PENDING_CANCEL) {
|
|
17578
|
-
logger_12.logger.warn("[JobDecision] Job cancelled while waiting for user decision", { decisionId });
|
|
17579
|
-
throw new UserDecisionCancelledError(jobId, decisionId);
|
|
17580
|
-
}
|
|
17581
|
-
const decision = job.pendingUserDecisions?.find((d) => d.id === decisionId) ?? job.userDecisionHistory?.find((d) => d.id === decisionId);
|
|
17582
|
-
if (decision?.response?.selectedOptionId) {
|
|
17583
|
-
return {
|
|
17584
|
-
selectedOptionId: decision.response.selectedOptionId,
|
|
17585
|
-
respondedAt: decision.response.respondedAt ?? /* @__PURE__ */ new Date()
|
|
17586
|
-
};
|
|
17587
|
-
}
|
|
17588
|
-
await new Promise((resolve) => setTimeout(resolve, DECISION_POLL_INTERVAL_MS));
|
|
17589
|
-
}
|
|
17590
|
-
}
|
|
17591
|
-
async function askJobChoice(jobId, question, options, context) {
|
|
17592
|
-
const response = await pauseForUserDecision(jobId, {
|
|
17593
|
-
question,
|
|
17594
|
-
questionType: types_1.UserDecisionQuestionType.UI_COMPONENT_TYPE,
|
|
17595
|
-
options,
|
|
17596
|
-
context
|
|
17597
|
-
});
|
|
17598
|
-
if (!response.selectedOptionId) {
|
|
17599
|
-
throw new Error("No option selected in user decision response");
|
|
17600
|
-
}
|
|
17601
|
-
return response.selectedOptionId;
|
|
17602
|
-
}
|
|
17603
|
-
async function askJobConfirmation(jobId, question, context) {
|
|
17604
|
-
const response = await pauseForUserDecision(jobId, {
|
|
17605
|
-
question,
|
|
17606
|
-
questionType: types_1.UserDecisionQuestionType.UI_COMPONENT_TYPE,
|
|
17607
|
-
options: [
|
|
17608
|
-
{ id: "yes", label: "Yes" },
|
|
17609
|
-
{ id: "no", label: "No" }
|
|
17610
|
-
],
|
|
17611
|
-
context
|
|
17612
|
-
});
|
|
17613
|
-
return response.selectedOptionId === "yes";
|
|
17614
|
-
}
|
|
17615
|
-
}
|
|
17616
|
-
});
|
|
17617
|
-
|
|
17618
|
-
// dist/pre-run-decision.js
|
|
17619
|
-
var require_pre_run_decision = __commonJS({
|
|
17620
|
-
"dist/pre-run-decision.js"(exports2) {
|
|
17621
|
-
"use strict";
|
|
17622
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
17623
|
-
exports2.runPreDecisionCheck = runPreDecisionCheck;
|
|
17624
|
-
exports2.checkSiteUIDecision = checkSiteUIDecision;
|
|
17625
|
-
var types_1 = require_types_impl2();
|
|
17626
|
-
var job_decision_manager_1 = require_job_decision_manager();
|
|
17627
|
-
var logger_12 = require_logger();
|
|
17628
|
-
async function runPreDecisionCheck(jobId, context, checkers) {
|
|
17629
|
-
const allDecisions = [];
|
|
17630
|
-
let modifiedBlueprint = context.blueprint;
|
|
17631
|
-
for (const checker of checkers) {
|
|
17632
|
-
const result = await checker(jobId, {
|
|
17633
|
-
blueprint: modifiedBlueprint
|
|
17634
|
-
});
|
|
17635
|
-
if (result) {
|
|
17636
|
-
allDecisions.push(...result.decisionsApplied);
|
|
17637
|
-
if (result.modifiedBlueprint) {
|
|
17638
|
-
modifiedBlueprint = result.modifiedBlueprint;
|
|
17639
|
-
}
|
|
17640
|
-
}
|
|
17641
|
-
}
|
|
17642
|
-
return {
|
|
17643
|
-
decisionsApplied: allDecisions,
|
|
17644
|
-
modifiedBlueprint
|
|
17645
|
-
};
|
|
17646
|
-
}
|
|
17647
|
-
async function checkSiteUIDecision(jobId, context) {
|
|
17648
|
-
const extensions = context.blueprint?.extensions ?? [];
|
|
17649
|
-
const siteUIExtension = extensions.find((ext) => isSiteUIExtension(ext));
|
|
17650
|
-
if (!siteUIExtension?.name) {
|
|
17651
|
-
return null;
|
|
17652
|
-
}
|
|
17653
|
-
const extensionName = siteUIExtension.name;
|
|
17654
|
-
const currentType = siteUIExtension.type;
|
|
17655
|
-
logger_12.logger.info(`[PreDecision] Found site UI extension: "${extensionName}" (current type: ${currentType})`);
|
|
17656
|
-
const options = [
|
|
17657
|
-
{
|
|
17658
|
-
id: types_1.ExtensionType.SITE_WIDGET,
|
|
17659
|
-
label: "Custom Element Widget",
|
|
17660
|
-
description: "A self-contained widget built as a Custom Element, embedded on the site. Best for standalone, reusable components."
|
|
17661
|
-
},
|
|
17662
|
-
{
|
|
17663
|
-
id: types_1.ExtensionType.SITE_COMPONENT,
|
|
17664
|
-
label: "Editor React Component",
|
|
17665
|
-
description: "A React component that integrates with the site builder. Best for components that need to work with Wix editor features."
|
|
17666
|
-
}
|
|
17667
|
-
];
|
|
17668
|
-
const selectedType = await (0, job_decision_manager_1.askJobChoice)(jobId, `What type of site UI element would you like to create for "${extensionName}"?`, options, "Custom Element Widgets are standalone embeddable units with their own styling, while Editor React Components integrate more deeply with the Wix editor and builder.");
|
|
17669
|
-
const selectedLabel = options.find((o) => o.id === selectedType)?.label ?? selectedType;
|
|
17670
|
-
const isTypeChanged = selectedType !== currentType;
|
|
17671
|
-
logger_12.logger.info(`[PreDecision] User selected ${selectedType} for "${extensionName}"${isTypeChanged ? ` (changed from ${currentType})` : " (unchanged)"}`);
|
|
17672
|
-
const appliedDecision = {
|
|
17673
|
-
type: "SITE_UI_TYPE",
|
|
17674
|
-
question: "Custom Element Widget vs Editor React Component",
|
|
17675
|
-
selectedOptionId: selectedType
|
|
17676
|
-
};
|
|
17677
|
-
return {
|
|
17678
|
-
decisionsApplied: [appliedDecision],
|
|
17679
|
-
modifiedBlueprint: context.blueprint ? applyTypeToBlueprint(context.blueprint, extensionName, selectedType, selectedLabel) : void 0
|
|
17680
|
-
};
|
|
17681
|
-
}
|
|
17682
|
-
function isSiteUIExtension(extension) {
|
|
17683
|
-
return extension.type === types_1.ExtensionType.SITE_WIDGET || extension.type === types_1.ExtensionType.SITE_COMPONENT;
|
|
17684
|
-
}
|
|
17685
|
-
function applyTypeToBlueprint(blueprint, extensionName, type, label) {
|
|
17686
|
-
const summaryNotice = `[USER DECISION] The user explicitly chose "${label}" for the "${extensionName}" extension. You MUST generate it as type ${type}. Do NOT use any other type.`;
|
|
17687
|
-
const descriptionNotice = `[USER DECISION] This extension MUST be a ${label} (type: ${type}). The user explicitly chose this. Do NOT change it.`;
|
|
17688
|
-
return {
|
|
17689
|
-
...blueprint,
|
|
17690
|
-
summary: `${summaryNotice}
|
|
17691
|
-
|
|
17692
|
-
${blueprint.summary ?? ""}`.trim(),
|
|
17693
|
-
extensions: blueprint.extensions?.map((ext) => ext.name === extensionName ? {
|
|
17694
|
-
...ext,
|
|
17695
|
-
type,
|
|
17696
|
-
description: `${descriptionNotice}
|
|
17697
|
-
|
|
17698
|
-
${ext.description ?? ""}`.trim(),
|
|
17699
|
-
_userDecision: "IMPORTANT: The user explicitly chose this extension type. You MUST use this exact type."
|
|
17700
|
-
} : ext)
|
|
17701
|
-
};
|
|
17702
|
-
}
|
|
17703
|
-
}
|
|
17704
|
-
});
|
|
17705
|
-
|
|
17706
17783
|
// dist/flows/opencode-init.js
|
|
17707
17784
|
var require_opencode_init = __commonJS({
|
|
17708
17785
|
"dist/flows/opencode-init.js"(exports2) {
|
|
@@ -17722,6 +17799,7 @@ var require_opencode_init = __commonJS({
|
|
|
17722
17799
|
var biEvents_1 = require_biEvents();
|
|
17723
17800
|
var pre_run_decision_1 = require_pre_run_decision();
|
|
17724
17801
|
var experiments_1 = require_experiments();
|
|
17802
|
+
var environments_12 = require_environments();
|
|
17725
17803
|
var runOpencodeInitFlow = async (blueprint, history) => {
|
|
17726
17804
|
const store = job_context_storage_12.jobContextStorage.getStore();
|
|
17727
17805
|
if (!store?.jobId || !store?.taskId) {
|
|
@@ -17749,8 +17827,9 @@ var require_opencode_init = __commonJS({
|
|
|
17749
17827
|
const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
|
|
17750
17828
|
let finalBlueprint = blueprint;
|
|
17751
17829
|
if ((0, experiments_1.isUserDecisionsEnabled)()) {
|
|
17752
|
-
const
|
|
17753
|
-
|
|
17830
|
+
const envConfig = (0, environments_12.getCodegenEnvironmentConfig)();
|
|
17831
|
+
const preDecisionResult = await (0, pre_run_decision_1.runPreDecisionCheck)(localJobContext.jobId, { payload: blueprint }, envConfig.decisionCheckers);
|
|
17832
|
+
finalBlueprint = preDecisionResult.modifiedPayload ?? blueprint;
|
|
17754
17833
|
if (preDecisionResult.decisionsApplied.length > 0) {
|
|
17755
17834
|
logger_12.logger.info("[OpenCode Init] Applied pre-decision", {
|
|
17756
17835
|
decisions: preDecisionResult.decisionsApplied,
|
|
@@ -18391,6 +18470,7 @@ var logger_1 = require_logger();
|
|
|
18391
18470
|
var skills_installer_1 = require_skills_installer();
|
|
18392
18471
|
var rules_writer_1 = require_rules_writer();
|
|
18393
18472
|
var tools_writer_1 = require_tools_writer();
|
|
18473
|
+
var environments_1 = require_environments();
|
|
18394
18474
|
var sessionId = process.env.CODEGEN_SESSION_ID || (0, crypto_1.randomUUID)();
|
|
18395
18475
|
process.env.CODEGEN_SESSION_ID = sessionId;
|
|
18396
18476
|
(0, logger_1.initLogger)(sessionId);
|
|
@@ -18437,9 +18517,11 @@ var alwaysOnLoop = async () => {
|
|
|
18437
18517
|
}
|
|
18438
18518
|
};
|
|
18439
18519
|
async function initOpenCode() {
|
|
18520
|
+
const envConfig = (0, environments_1.getCodegenEnvironmentConfig)();
|
|
18440
18521
|
await Promise.all([
|
|
18522
|
+
(0, rules_writer_1.writeRuleFiles)(envConfig.codegenRules),
|
|
18523
|
+
(0, rules_writer_1.writeRuleFiles)(envConfig.askRules),
|
|
18441
18524
|
(0, skills_installer_1.installSkills)((0, codegen_flow_helpers_1.getOutputPath)(), logger_1.logger),
|
|
18442
|
-
(0, rules_writer_1.writeRuleFiles)(),
|
|
18443
18525
|
(0, tools_writer_1.writeToolFiles)()
|
|
18444
18526
|
]);
|
|
18445
18527
|
}
|
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.300",
|
|
4
4
|
"description": "AI-powered Wix CLI app generator - standalone executable",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "node build.mjs",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"@wix/ditto-codegen": "1.0.0",
|
|
28
28
|
"esbuild": "^0.27.2"
|
|
29
29
|
},
|
|
30
|
-
"falconPackageHash": "
|
|
30
|
+
"falconPackageHash": "7e01650dd75487b832d97effba283214a682adce04a362e8302151e0"
|
|
31
31
|
}
|