@wix/ditto-codegen-public 1.0.329 → 1.0.331
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 +108 -32
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -11784,7 +11784,6 @@ var require_experiments = __commonJS({
|
|
|
11784
11784
|
"use strict";
|
|
11785
11785
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
11786
11786
|
exports2.isExperimentEnabled = isExperimentEnabled;
|
|
11787
|
-
exports2.isUserDecisionsEnabled = isUserDecisionsEnabled;
|
|
11788
11787
|
exports2.isUseWixAiGatewayEnabled = isUseWixAiGatewayEnabled;
|
|
11789
11788
|
var logger_12 = require_logger();
|
|
11790
11789
|
var parsedExperiments = null;
|
|
@@ -11810,9 +11809,6 @@ var require_experiments = __commonJS({
|
|
|
11810
11809
|
function isExperimentEnabled(specName) {
|
|
11811
11810
|
return getExperiments()[specName] === "true";
|
|
11812
11811
|
}
|
|
11813
|
-
function isUserDecisionsEnabled() {
|
|
11814
|
-
return isExperimentEnabled("specs.ditto.CodegenUserDecisions");
|
|
11815
|
-
}
|
|
11816
11812
|
function isUseWixAiGatewayEnabled() {
|
|
11817
11813
|
return isExperimentEnabled("specs.ditto.CodegenUseWixAiGateway");
|
|
11818
11814
|
}
|
|
@@ -14377,6 +14373,76 @@ var require_agent_io = __commonJS({
|
|
|
14377
14373
|
}
|
|
14378
14374
|
});
|
|
14379
14375
|
|
|
14376
|
+
// dist/opencode-integration/git-file-changes.js
|
|
14377
|
+
var require_git_file_changes = __commonJS({
|
|
14378
|
+
"dist/opencode-integration/git-file-changes.js"(exports2) {
|
|
14379
|
+
"use strict";
|
|
14380
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
14381
|
+
exports2.captureGitBaseline = captureGitBaseline;
|
|
14382
|
+
exports2.collectGitFileChanges = collectGitFileChanges;
|
|
14383
|
+
var child_process_1 = require("child_process");
|
|
14384
|
+
var util_1 = require("util");
|
|
14385
|
+
var ditto_codegen_types_12 = require_dist4();
|
|
14386
|
+
var logger_12 = require_logger();
|
|
14387
|
+
var execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
|
|
14388
|
+
async function captureGitBaseline(cwd) {
|
|
14389
|
+
const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD"], { cwd });
|
|
14390
|
+
return stdout.trim();
|
|
14391
|
+
}
|
|
14392
|
+
async function collectGitFileChanges(cwd, baseline) {
|
|
14393
|
+
try {
|
|
14394
|
+
const [diffResult, untrackedResult] = await Promise.all([
|
|
14395
|
+
execFileAsync("git", [
|
|
14396
|
+
"-c",
|
|
14397
|
+
"core.quotepath=off",
|
|
14398
|
+
"diff",
|
|
14399
|
+
"--name-status",
|
|
14400
|
+
"--no-renames",
|
|
14401
|
+
"-z",
|
|
14402
|
+
baseline
|
|
14403
|
+
], { cwd, maxBuffer: 10 * 1024 * 1024 }),
|
|
14404
|
+
execFileAsync("git", ["ls-files", "--others", "--exclude-standard", "-z"], { cwd, maxBuffer: 10 * 1024 * 1024 })
|
|
14405
|
+
]);
|
|
14406
|
+
const files = parseDiffNameStatus(diffResult.stdout);
|
|
14407
|
+
appendUntrackedFiles(untrackedResult.stdout, files);
|
|
14408
|
+
files.sort((a, b) => a.path.localeCompare(b.path));
|
|
14409
|
+
return files;
|
|
14410
|
+
} catch (error) {
|
|
14411
|
+
logger_12.logger.error("[OpenCode] Failed to collect git file changes", {
|
|
14412
|
+
error: error instanceof Error ? error.message : String(error)
|
|
14413
|
+
});
|
|
14414
|
+
return [];
|
|
14415
|
+
}
|
|
14416
|
+
}
|
|
14417
|
+
var GIT_STATUS_TO_OPERATION = {
|
|
14418
|
+
A: ditto_codegen_types_12.ExtensionGenerationOperation.INSERT,
|
|
14419
|
+
M: ditto_codegen_types_12.ExtensionGenerationOperation.EDIT,
|
|
14420
|
+
D: ditto_codegen_types_12.ExtensionGenerationOperation.DELETE
|
|
14421
|
+
};
|
|
14422
|
+
function parseDiffNameStatus(raw) {
|
|
14423
|
+
const files = [];
|
|
14424
|
+
const parts = raw.split("\0").filter(Boolean);
|
|
14425
|
+
for (let i = 0; i < parts.length - 1; i += 2) {
|
|
14426
|
+
const operation = GIT_STATUS_TO_OPERATION[parts[i]];
|
|
14427
|
+
const path = parts[i + 1];
|
|
14428
|
+
if (path && operation) {
|
|
14429
|
+
files.push({ path, operation });
|
|
14430
|
+
}
|
|
14431
|
+
}
|
|
14432
|
+
return files;
|
|
14433
|
+
}
|
|
14434
|
+
function appendUntrackedFiles(raw, files) {
|
|
14435
|
+
const knownPaths = new Set(files.map((f) => f.path));
|
|
14436
|
+
const paths = raw.split("\0").filter(Boolean);
|
|
14437
|
+
for (const path of paths) {
|
|
14438
|
+
if (!knownPaths.has(path)) {
|
|
14439
|
+
files.push({ path, operation: ditto_codegen_types_12.ExtensionGenerationOperation.INSERT });
|
|
14440
|
+
}
|
|
14441
|
+
}
|
|
14442
|
+
}
|
|
14443
|
+
}
|
|
14444
|
+
});
|
|
14445
|
+
|
|
14380
14446
|
// ../../node_modules/@wix/bi-logger-dev-tools-data/dist/cjs/v2/index.js
|
|
14381
14447
|
var require_v2 = __commonJS({
|
|
14382
14448
|
"../../node_modules/@wix/bi-logger-dev-tools-data/dist/cjs/v2/index.js"(exports2) {
|
|
@@ -19332,9 +19398,9 @@ var require_opencode_init = __commonJS({
|
|
|
19332
19398
|
var context_12 = require_context();
|
|
19333
19399
|
var logger_12 = require_logger();
|
|
19334
19400
|
var config_12 = require_config();
|
|
19401
|
+
var git_file_changes_1 = require_git_file_changes();
|
|
19335
19402
|
var biEvents_1 = require_biEvents();
|
|
19336
19403
|
var pre_run_decision_1 = require_pre_run_decision();
|
|
19337
|
-
var experiments_1 = require_experiments();
|
|
19338
19404
|
var environments_12 = require_environments();
|
|
19339
19405
|
var hooks_1 = require_hooks();
|
|
19340
19406
|
var runOpencodeInitFlow = async (blueprint, history, agentData) => {
|
|
@@ -19365,20 +19431,18 @@ var require_opencode_init = __commonJS({
|
|
|
19365
19431
|
taskType: kind
|
|
19366
19432
|
});
|
|
19367
19433
|
const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
|
|
19434
|
+
const gitBaseline = await (0, git_file_changes_1.captureGitBaseline)(outputPath);
|
|
19368
19435
|
let caughtError;
|
|
19369
19436
|
try {
|
|
19370
19437
|
(0, agent_io_1.writeAgentInput)(outputPath, agentData);
|
|
19371
|
-
|
|
19372
|
-
|
|
19373
|
-
|
|
19374
|
-
|
|
19375
|
-
|
|
19376
|
-
|
|
19377
|
-
|
|
19378
|
-
|
|
19379
|
-
finalBlueprint
|
|
19380
|
-
});
|
|
19381
|
-
}
|
|
19438
|
+
const envConfig = (0, environments_12.getCodegenEnvironmentConfig)();
|
|
19439
|
+
const preDecisionResult = await (0, pre_run_decision_1.runPreDecisionCheck)(localJobContext.jobId, { payload: blueprint }, envConfig.decisionCheckers);
|
|
19440
|
+
const finalBlueprint = preDecisionResult.modifiedPayload ?? blueprint;
|
|
19441
|
+
if (preDecisionResult.decisionsApplied.length > 0) {
|
|
19442
|
+
logger_12.logger.info("[OpenCode Init] Applied pre-decision", {
|
|
19443
|
+
decisions: preDecisionResult.decisionsApplied,
|
|
19444
|
+
finalBlueprint
|
|
19445
|
+
});
|
|
19382
19446
|
}
|
|
19383
19447
|
const orchestrator = new OpenCodeOrchestrator_1.OpenCodeOrchestrator();
|
|
19384
19448
|
(0, cli_listeners_1.attachOrchestratorListeners)(orchestrator);
|
|
@@ -19388,9 +19452,11 @@ var require_opencode_init = __commonJS({
|
|
|
19388
19452
|
projectId: context_12.ctx.projectId,
|
|
19389
19453
|
chatHistory: history
|
|
19390
19454
|
});
|
|
19455
|
+
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19391
19456
|
const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
|
|
19392
19457
|
await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
|
|
19393
19458
|
requiredPermissions: result.requiredPermissions,
|
|
19459
|
+
files,
|
|
19394
19460
|
history,
|
|
19395
19461
|
...agentOutput
|
|
19396
19462
|
});
|
|
@@ -19403,12 +19469,7 @@ var require_opencode_init = __commonJS({
|
|
|
19403
19469
|
taskType: kind,
|
|
19404
19470
|
taskCost: Math.round(result.usage.cost * 1e6),
|
|
19405
19471
|
taskStatus: ditto_codegen_types_12.Status.COMPLETED,
|
|
19406
|
-
agentOutput: JSON.stringify({
|
|
19407
|
-
files: result.filesChanged.map((file) => ({
|
|
19408
|
-
path: file.path,
|
|
19409
|
-
operation: file.operation
|
|
19410
|
-
}))
|
|
19411
|
-
}),
|
|
19472
|
+
agentOutput: JSON.stringify({ files }),
|
|
19412
19473
|
jobDuration: String(Date.now() - flowStartTime),
|
|
19413
19474
|
skillsUsed: result.skillsUsed,
|
|
19414
19475
|
extensionsCreated: result.extensionsCreated
|
|
@@ -19418,9 +19479,11 @@ var require_opencode_init = __commonJS({
|
|
|
19418
19479
|
caughtError = error;
|
|
19419
19480
|
const codegenError = (0, ditto_codegen_types_2.toCodegenError)(error);
|
|
19420
19481
|
const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
|
|
19482
|
+
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19421
19483
|
await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
|
|
19422
19484
|
requiredPermissions: [],
|
|
19423
19485
|
requiredPermissionsErrors: codegenError,
|
|
19486
|
+
files,
|
|
19424
19487
|
history,
|
|
19425
19488
|
...agentOutput
|
|
19426
19489
|
});
|
|
@@ -19430,6 +19493,7 @@ var require_opencode_init = __commonJS({
|
|
|
19430
19493
|
taskModel: config_12.DEFAULT_MODEL,
|
|
19431
19494
|
taskType: kind,
|
|
19432
19495
|
taskStatus: ditto_codegen_types_12.Status.FAILED,
|
|
19496
|
+
agentOutput: JSON.stringify({ files }),
|
|
19433
19497
|
jobDuration: String(Date.now() - flowStartTime)
|
|
19434
19498
|
});
|
|
19435
19499
|
(0, biEvents_1.reportSessionError)({
|
|
@@ -19527,6 +19591,7 @@ var require_opencode_iterate = __commonJS({
|
|
|
19527
19591
|
var context_12 = require_context();
|
|
19528
19592
|
var logger_12 = require_logger();
|
|
19529
19593
|
var config_12 = require_config();
|
|
19594
|
+
var git_file_changes_1 = require_git_file_changes();
|
|
19530
19595
|
var biEvents_1 = require_biEvents();
|
|
19531
19596
|
var hooks_1 = require_hooks();
|
|
19532
19597
|
var runOpencodeIterateFlow = async (chatHistory, agentData) => {
|
|
@@ -19557,6 +19622,7 @@ var require_opencode_iterate = __commonJS({
|
|
|
19557
19622
|
taskType: kind
|
|
19558
19623
|
});
|
|
19559
19624
|
const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
|
|
19625
|
+
const gitBaseline = await (0, git_file_changes_1.captureGitBaseline)(outputPath);
|
|
19560
19626
|
let caughtError;
|
|
19561
19627
|
try {
|
|
19562
19628
|
(0, agent_io_1.writeAgentInput)(outputPath, agentData);
|
|
@@ -19567,19 +19633,15 @@ var require_opencode_iterate = __commonJS({
|
|
|
19567
19633
|
projectId: context_12.ctx.projectId,
|
|
19568
19634
|
chatHistory
|
|
19569
19635
|
});
|
|
19636
|
+
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19570
19637
|
const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
|
|
19571
19638
|
await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
|
|
19572
19639
|
requiredPermissions: result.requiredPermissions,
|
|
19640
|
+
files,
|
|
19573
19641
|
...agentOutput
|
|
19574
19642
|
});
|
|
19575
|
-
const taskOutput = {
|
|
19576
|
-
files: result.filesChanged.map((file) => ({
|
|
19577
|
-
path: file.path,
|
|
19578
|
-
operation: file.operation
|
|
19579
|
-
}))
|
|
19580
|
-
};
|
|
19581
19643
|
await codeGenerationService_12.codeGenerationService.updateTask(jobId, taskId, ditto_codegen_types_12.Status.COMPLETED, {
|
|
19582
|
-
taskOutput
|
|
19644
|
+
taskOutput: { files }
|
|
19583
19645
|
});
|
|
19584
19646
|
(0, biEvents_1.reportSessionEnd)({
|
|
19585
19647
|
...biBase,
|
|
@@ -19587,7 +19649,7 @@ var require_opencode_iterate = __commonJS({
|
|
|
19587
19649
|
taskType: kind,
|
|
19588
19650
|
taskCost: Math.round(result.usage.cost * 1e6),
|
|
19589
19651
|
taskStatus: ditto_codegen_types_12.Status.COMPLETED,
|
|
19590
|
-
agentOutput: JSON.stringify(
|
|
19652
|
+
agentOutput: JSON.stringify({ files }),
|
|
19591
19653
|
jobDuration: String(Date.now() - flowStartTime),
|
|
19592
19654
|
skillsUsed: result.skillsUsed,
|
|
19593
19655
|
extensionsCreated: result.extensionsCreated
|
|
@@ -19597,9 +19659,11 @@ var require_opencode_iterate = __commonJS({
|
|
|
19597
19659
|
caughtError = error;
|
|
19598
19660
|
const codegenError = (0, ditto_codegen_types_2.toCodegenError)(error);
|
|
19599
19661
|
const agentOutput = (0, agent_io_1.readAgentOutput)(outputPath);
|
|
19662
|
+
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19600
19663
|
await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
|
|
19601
19664
|
requiredPermissions: [],
|
|
19602
19665
|
requiredPermissionsErrors: codegenError,
|
|
19666
|
+
files,
|
|
19603
19667
|
...agentOutput
|
|
19604
19668
|
});
|
|
19605
19669
|
await (0, codegen_flow_helpers_12.updateParentTaskStatus)(localJobContext, ditto_codegen_types_12.Status.FAILED, codegenError);
|
|
@@ -19608,6 +19672,7 @@ var require_opencode_iterate = __commonJS({
|
|
|
19608
19672
|
taskModel: config_12.DEFAULT_MODEL,
|
|
19609
19673
|
taskType: kind,
|
|
19610
19674
|
taskStatus: ditto_codegen_types_12.Status.FAILED,
|
|
19675
|
+
agentOutput: JSON.stringify({ files }),
|
|
19611
19676
|
jobDuration: String(Date.now() - flowStartTime)
|
|
19612
19677
|
});
|
|
19613
19678
|
(0, biEvents_1.reportSessionError)({
|
|
@@ -19703,6 +19768,7 @@ var require_opencode_ask = __commonJS({
|
|
|
19703
19768
|
var context_12 = require_context();
|
|
19704
19769
|
var logger_12 = require_logger();
|
|
19705
19770
|
var config_12 = require_config();
|
|
19771
|
+
var git_file_changes_1 = require_git_file_changes();
|
|
19706
19772
|
var biEvents_1 = require_biEvents();
|
|
19707
19773
|
var runOpencodeAskFlow = async (chatHistory) => {
|
|
19708
19774
|
const store = job_context_storage_12.jobContextStorage.getStore();
|
|
@@ -19731,8 +19797,9 @@ var require_opencode_ask = __commonJS({
|
|
|
19731
19797
|
taskModel: config_12.DEFAULT_MODEL,
|
|
19732
19798
|
taskType: kind
|
|
19733
19799
|
});
|
|
19800
|
+
const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
|
|
19801
|
+
const gitBaseline = await (0, git_file_changes_1.captureGitBaseline)(outputPath);
|
|
19734
19802
|
try {
|
|
19735
|
-
const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
|
|
19736
19803
|
const askOrchestrator = new OpenCodeAskOrchestrator_1.OpenCodeAskOrchestrator();
|
|
19737
19804
|
(0, cli_listeners_1.attachOrchestratorListeners)(askOrchestrator);
|
|
19738
19805
|
const result = await askOrchestrator.ask({
|
|
@@ -19740,6 +19807,10 @@ var require_opencode_ask = __commonJS({
|
|
|
19740
19807
|
projectId: context_12.ctx.projectId,
|
|
19741
19808
|
chatHistory
|
|
19742
19809
|
});
|
|
19810
|
+
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19811
|
+
await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
|
|
19812
|
+
files
|
|
19813
|
+
});
|
|
19743
19814
|
await codeGenerationService_12.codeGenerationService.updateTask(jobId, taskId, ditto_codegen_types_12.Status.COMPLETED, {
|
|
19744
19815
|
taskOutput: {
|
|
19745
19816
|
answer: result.answer
|
|
@@ -19751,18 +19822,23 @@ var require_opencode_ask = __commonJS({
|
|
|
19751
19822
|
taskType: kind,
|
|
19752
19823
|
taskCost: Math.round(result.usage.cost * 1e6),
|
|
19753
19824
|
taskStatus: ditto_codegen_types_12.Status.COMPLETED,
|
|
19754
|
-
agentOutput: JSON.stringify({ answer: result.answer }),
|
|
19825
|
+
agentOutput: JSON.stringify({ answer: result.answer, files }),
|
|
19755
19826
|
jobDuration: String(Date.now() - flowStartTime)
|
|
19756
19827
|
});
|
|
19757
19828
|
logger_12.logger.info("[OpenCode Ask] Completed task", { taskId });
|
|
19758
19829
|
} catch (error) {
|
|
19759
19830
|
const codegenError = (0, ditto_codegen_types_2.toCodegenError)(error);
|
|
19831
|
+
const files = await (0, git_file_changes_1.collectGitFileChanges)(outputPath, gitBaseline);
|
|
19832
|
+
await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
|
|
19833
|
+
files
|
|
19834
|
+
});
|
|
19760
19835
|
await (0, codegen_flow_helpers_12.updateParentTaskStatus)(localJobContext, ditto_codegen_types_12.Status.FAILED, codegenError);
|
|
19761
19836
|
(0, biEvents_1.reportSessionEnd)({
|
|
19762
19837
|
...biBase,
|
|
19763
19838
|
taskModel: config_12.DEFAULT_MODEL,
|
|
19764
19839
|
taskType: kind,
|
|
19765
19840
|
taskStatus: ditto_codegen_types_12.Status.FAILED,
|
|
19841
|
+
agentOutput: JSON.stringify({ files }),
|
|
19766
19842
|
jobDuration: String(Date.now() - flowStartTime)
|
|
19767
19843
|
});
|
|
19768
19844
|
(0, biEvents_1.reportSessionError)({
|
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.331",
|
|
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
|
"esbuild": "^0.27.2",
|
|
29
29
|
"vitest": "^4.0.16"
|
|
30
30
|
},
|
|
31
|
-
"falconPackageHash": "
|
|
31
|
+
"falconPackageHash": "dc66760aa92eeb7347a2019b5b49c12bb33ea6af136c3f879f70d32d"
|
|
32
32
|
}
|