@wix/ditto-codegen-public 1.0.223 → 1.0.225
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 +370 -312
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -105088,48 +105088,6 @@ export default appBuilder;
|
|
|
105088
105088
|
}
|
|
105089
105089
|
});
|
|
105090
105090
|
|
|
105091
|
-
// dist/orchestrator-error-helpers.js
|
|
105092
|
-
var require_orchestrator_error_helpers = __commonJS({
|
|
105093
|
-
"dist/orchestrator-error-helpers.js"(exports2) {
|
|
105094
|
-
"use strict";
|
|
105095
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
105096
|
-
exports2.createExtensionErrorHandler = createExtensionErrorHandler;
|
|
105097
|
-
exports2.throwIfFailures = throwIfFailures;
|
|
105098
|
-
var ditto_codegen_types_12 = require_dist();
|
|
105099
|
-
function createExtensionErrorHandler(eventEmitter, extension) {
|
|
105100
|
-
return (error) => {
|
|
105101
|
-
const codegenError = (0, ditto_codegen_types_12.toCodegenError)(error);
|
|
105102
|
-
eventEmitter.emitEvent("agent:error", {
|
|
105103
|
-
extension,
|
|
105104
|
-
error: codegenError
|
|
105105
|
-
});
|
|
105106
|
-
console.error(`\u274C Failed to process extension ${extension.name}:`, error);
|
|
105107
|
-
throw codegenError;
|
|
105108
|
-
};
|
|
105109
|
-
}
|
|
105110
|
-
function throwIfFailures(results) {
|
|
105111
|
-
const failures = results.map((result, index) => {
|
|
105112
|
-
if (result.status === "rejected") {
|
|
105113
|
-
return {
|
|
105114
|
-
index,
|
|
105115
|
-
error: result.reason
|
|
105116
|
-
};
|
|
105117
|
-
}
|
|
105118
|
-
return null;
|
|
105119
|
-
}).filter((f) => f !== null);
|
|
105120
|
-
if (failures.length > 0) {
|
|
105121
|
-
const errorMessages = failures.map((f) => {
|
|
105122
|
-
const codegenError = (0, ditto_codegen_types_12.toCodegenError)(f.error);
|
|
105123
|
-
return `Task ${f.index} failed: ${codegenError.message}`;
|
|
105124
|
-
});
|
|
105125
|
-
const message = `Failed to process ${failures.length} of ${results.length} parallel tasks:
|
|
105126
|
-
${errorMessages.join("\n")}`;
|
|
105127
|
-
throw (0, ditto_codegen_types_12.toCodegenError)(new Error(message));
|
|
105128
|
-
}
|
|
105129
|
-
}
|
|
105130
|
-
}
|
|
105131
|
-
});
|
|
105132
|
-
|
|
105133
105091
|
// dist/utils.js
|
|
105134
105092
|
var require_utils15 = __commonJS({
|
|
105135
105093
|
"dist/utils.js"(exports2) {
|
|
@@ -105202,6 +105160,337 @@ var require_utils15 = __commonJS({
|
|
|
105202
105160
|
}
|
|
105203
105161
|
});
|
|
105204
105162
|
|
|
105163
|
+
// ../../node_modules/@wix/ambassador-ctp-ditto-v1-blueprint/build/cjs/http.impl.js
|
|
105164
|
+
var require_http_impl2 = __commonJS({
|
|
105165
|
+
"../../node_modules/@wix/ambassador-ctp-ditto-v1-blueprint/build/cjs/http.impl.js"(exports2) {
|
|
105166
|
+
"use strict";
|
|
105167
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
105168
|
+
exports2.getRequiredPermissions = exports2.editBlueprint = exports2.createAppName = exports2.createBlueprint = void 0;
|
|
105169
|
+
var ambassador_1 = require_ambassador_index();
|
|
105170
|
+
var metro_runtime_1 = require_cjs2();
|
|
105171
|
+
var _createAppNameRequest = {};
|
|
105172
|
+
var _createAppNameResponse = {};
|
|
105173
|
+
var _createBlueprintRequest = {};
|
|
105174
|
+
var _createBlueprintResponse = {};
|
|
105175
|
+
var _editBlueprintRequest = {};
|
|
105176
|
+
var _editBlueprintResponse = {};
|
|
105177
|
+
var _getRequiredPermissionsRequest = {};
|
|
105178
|
+
var _getRequiredPermissionsResponse = {};
|
|
105179
|
+
function resolveComWixpressDittoBlueprintServiceApiDittoBlueprintServiceUrl(opts) {
|
|
105180
|
+
var domainToMappings = {
|
|
105181
|
+
"manage._base_domain_": [
|
|
105182
|
+
{
|
|
105183
|
+
srcPath: "/_api/ditto-blueprint-service-web",
|
|
105184
|
+
destPath: ""
|
|
105185
|
+
}
|
|
105186
|
+
]
|
|
105187
|
+
};
|
|
105188
|
+
return (0, metro_runtime_1.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
105189
|
+
}
|
|
105190
|
+
function createBlueprint(payload) {
|
|
105191
|
+
var _a = (0, ambassador_1.serializer)(_createBlueprintRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
|
|
105192
|
+
var fromRes = (0, ambassador_1.serializer)(_createBlueprintResponse, {}).fromJSON;
|
|
105193
|
+
function __createBlueprint(_a2) {
|
|
105194
|
+
var host = _a2.host;
|
|
105195
|
+
var serializedData = toReq(payload);
|
|
105196
|
+
var metadata = {
|
|
105197
|
+
entityFqdn: "wix.ctp.ditto.v1.blueprint",
|
|
105198
|
+
method: "POST",
|
|
105199
|
+
methodFqn: "com.wixpress.ditto_blueprint_service.api.DittoBlueprintService.CreateBlueprint",
|
|
105200
|
+
migrationOptions: {
|
|
105201
|
+
optInTransformResponse: true
|
|
105202
|
+
},
|
|
105203
|
+
url: resolveComWixpressDittoBlueprintServiceApiDittoBlueprintServiceUrl({
|
|
105204
|
+
protoPath: "/v1/blueprints",
|
|
105205
|
+
data: serializedData,
|
|
105206
|
+
host
|
|
105207
|
+
}),
|
|
105208
|
+
data: serializedData,
|
|
105209
|
+
transformResponse: fromRes
|
|
105210
|
+
};
|
|
105211
|
+
return metadata;
|
|
105212
|
+
}
|
|
105213
|
+
__createBlueprint.fromReq = fromReq;
|
|
105214
|
+
__createBlueprint.__isAmbassador = true;
|
|
105215
|
+
return __createBlueprint;
|
|
105216
|
+
}
|
|
105217
|
+
exports2.createBlueprint = createBlueprint;
|
|
105218
|
+
function createAppName(payload) {
|
|
105219
|
+
var _a = (0, ambassador_1.serializer)(_createAppNameRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
|
|
105220
|
+
var fromRes = (0, ambassador_1.serializer)(_createAppNameResponse, {}).fromJSON;
|
|
105221
|
+
function __createAppName(_a2) {
|
|
105222
|
+
var host = _a2.host;
|
|
105223
|
+
var serializedData = toReq(payload);
|
|
105224
|
+
var metadata = {
|
|
105225
|
+
entityFqdn: "wix.ctp.ditto.v1.blueprint",
|
|
105226
|
+
method: "POST",
|
|
105227
|
+
methodFqn: "com.wixpress.ditto_blueprint_service.api.DittoBlueprintService.CreateAppName",
|
|
105228
|
+
migrationOptions: {
|
|
105229
|
+
optInTransformResponse: true
|
|
105230
|
+
},
|
|
105231
|
+
url: resolveComWixpressDittoBlueprintServiceApiDittoBlueprintServiceUrl({
|
|
105232
|
+
protoPath: "/v1/blueprints/app-name",
|
|
105233
|
+
data: serializedData,
|
|
105234
|
+
host
|
|
105235
|
+
}),
|
|
105236
|
+
data: serializedData,
|
|
105237
|
+
transformResponse: fromRes
|
|
105238
|
+
};
|
|
105239
|
+
return metadata;
|
|
105240
|
+
}
|
|
105241
|
+
__createAppName.fromReq = fromReq;
|
|
105242
|
+
__createAppName.__isAmbassador = true;
|
|
105243
|
+
return __createAppName;
|
|
105244
|
+
}
|
|
105245
|
+
exports2.createAppName = createAppName;
|
|
105246
|
+
function editBlueprint(payload) {
|
|
105247
|
+
var _a = (0, ambassador_1.serializer)(_editBlueprintRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
|
|
105248
|
+
var fromRes = (0, ambassador_1.serializer)(_editBlueprintResponse, {}).fromJSON;
|
|
105249
|
+
function __editBlueprint(_a2) {
|
|
105250
|
+
var host = _a2.host;
|
|
105251
|
+
var serializedData = toReq(payload);
|
|
105252
|
+
var metadata = {
|
|
105253
|
+
entityFqdn: "wix.ctp.ditto.v1.blueprint",
|
|
105254
|
+
method: "POST",
|
|
105255
|
+
methodFqn: "com.wixpress.ditto_blueprint_service.api.DittoBlueprintService.EditBlueprint",
|
|
105256
|
+
migrationOptions: {
|
|
105257
|
+
optInTransformResponse: true
|
|
105258
|
+
},
|
|
105259
|
+
url: resolveComWixpressDittoBlueprintServiceApiDittoBlueprintServiceUrl({
|
|
105260
|
+
protoPath: "/v1/blueprints/edit",
|
|
105261
|
+
data: serializedData,
|
|
105262
|
+
host
|
|
105263
|
+
}),
|
|
105264
|
+
data: serializedData,
|
|
105265
|
+
transformResponse: fromRes
|
|
105266
|
+
};
|
|
105267
|
+
return metadata;
|
|
105268
|
+
}
|
|
105269
|
+
__editBlueprint.fromReq = fromReq;
|
|
105270
|
+
__editBlueprint.__isAmbassador = true;
|
|
105271
|
+
return __editBlueprint;
|
|
105272
|
+
}
|
|
105273
|
+
exports2.editBlueprint = editBlueprint;
|
|
105274
|
+
function getRequiredPermissions(payload) {
|
|
105275
|
+
var _a = (0, ambassador_1.serializer)(_getRequiredPermissionsRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
|
|
105276
|
+
var fromRes = (0, ambassador_1.serializer)(_getRequiredPermissionsResponse, {}).fromJSON;
|
|
105277
|
+
function __getRequiredPermissions(_a2) {
|
|
105278
|
+
var host = _a2.host;
|
|
105279
|
+
var serializedData = toReq(payload);
|
|
105280
|
+
var metadata = {
|
|
105281
|
+
entityFqdn: "wix.ctp.ditto.v1.blueprint",
|
|
105282
|
+
method: "POST",
|
|
105283
|
+
methodFqn: "com.wixpress.ditto_blueprint_service.api.DittoBlueprintService.GetRequiredPermissions",
|
|
105284
|
+
migrationOptions: {
|
|
105285
|
+
optInTransformResponse: true
|
|
105286
|
+
},
|
|
105287
|
+
url: resolveComWixpressDittoBlueprintServiceApiDittoBlueprintServiceUrl({
|
|
105288
|
+
protoPath: "/v1/blueprints/required-permissions",
|
|
105289
|
+
data: serializedData,
|
|
105290
|
+
host
|
|
105291
|
+
}),
|
|
105292
|
+
data: serializedData,
|
|
105293
|
+
transformResponse: fromRes
|
|
105294
|
+
};
|
|
105295
|
+
return metadata;
|
|
105296
|
+
}
|
|
105297
|
+
__getRequiredPermissions.fromReq = fromReq;
|
|
105298
|
+
__getRequiredPermissions.__isAmbassador = true;
|
|
105299
|
+
return __getRequiredPermissions;
|
|
105300
|
+
}
|
|
105301
|
+
exports2.getRequiredPermissions = getRequiredPermissions;
|
|
105302
|
+
}
|
|
105303
|
+
});
|
|
105304
|
+
|
|
105305
|
+
// dist/flows/codegen-flow-helpers.js
|
|
105306
|
+
var require_codegen_flow_helpers = __commonJS({
|
|
105307
|
+
"dist/flows/codegen-flow-helpers.js"(exports2) {
|
|
105308
|
+
"use strict";
|
|
105309
|
+
var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
|
|
105310
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
105311
|
+
};
|
|
105312
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
105313
|
+
exports2.addAgentTask = addAgentTask;
|
|
105314
|
+
exports2.completeAgentTask = completeAgentTask;
|
|
105315
|
+
exports2.failAgentTask = failAgentTask;
|
|
105316
|
+
exports2.addUpdateExtensionAgentTask = addUpdateExtensionAgentTask;
|
|
105317
|
+
exports2.completeUpdateExtensionAgentTask = completeUpdateExtensionAgentTask;
|
|
105318
|
+
exports2.failUpdateExtensionAgentTask = failUpdateExtensionAgentTask;
|
|
105319
|
+
exports2.updateJobPayload = updateJobPayload;
|
|
105320
|
+
exports2.updateParentTaskStatus = updateParentTaskStatus;
|
|
105321
|
+
exports2.getOutputPath = getOutputPath;
|
|
105322
|
+
exports2.getRequiredPermissions = getRequiredPermissions;
|
|
105323
|
+
var path_1 = __importDefault2(require("path"));
|
|
105324
|
+
var codeGenerationService_12 = require_codeGenerationService();
|
|
105325
|
+
var ditto_codegen_types_12 = require_dist();
|
|
105326
|
+
var utils_1 = require_utils15();
|
|
105327
|
+
var http_1 = require_http_impl2();
|
|
105328
|
+
var http_client_1 = require_index_node();
|
|
105329
|
+
var orchestrator_1 = require_orchestrator();
|
|
105330
|
+
var job_context_storage_12 = require_job_context_storage();
|
|
105331
|
+
var slugify = (str = "") => {
|
|
105332
|
+
return str.toLowerCase().replace(/ /g, "-");
|
|
105333
|
+
};
|
|
105334
|
+
function getJobContext() {
|
|
105335
|
+
const store = job_context_storage_12.jobContextStorage.getStore();
|
|
105336
|
+
if (!store?.jobId || !store?.taskId) {
|
|
105337
|
+
return null;
|
|
105338
|
+
}
|
|
105339
|
+
return { jobId: store.jobId, taskId: store.taskId };
|
|
105340
|
+
}
|
|
105341
|
+
function getAgentTaskId(parentTaskId, extension) {
|
|
105342
|
+
return `${parentTaskId}-${slugify(extension.name)}`;
|
|
105343
|
+
}
|
|
105344
|
+
async function addAgentTask(extension, agentName) {
|
|
105345
|
+
const jobContext = getJobContext();
|
|
105346
|
+
if (!jobContext) {
|
|
105347
|
+
console.log(`[Agent] start: ${extension.name} (no job context)`);
|
|
105348
|
+
return;
|
|
105349
|
+
}
|
|
105350
|
+
console.log(`[Agent] start: ${extension.name}`);
|
|
105351
|
+
const taskId = getAgentTaskId(jobContext.taskId, extension);
|
|
105352
|
+
await codeGenerationService_12.codeGenerationService.addTask(jobContext.jobId, {
|
|
105353
|
+
id: taskId,
|
|
105354
|
+
kind: ditto_codegen_types_12.TaskKind.RUN_AGENT,
|
|
105355
|
+
status: ditto_codegen_types_12.Status.RUNNING,
|
|
105356
|
+
name: "run_agent",
|
|
105357
|
+
description: `Run agent for ${extension.name}`,
|
|
105358
|
+
payload: { extension },
|
|
105359
|
+
agentName
|
|
105360
|
+
});
|
|
105361
|
+
}
|
|
105362
|
+
async function completeAgentTask(extension, files) {
|
|
105363
|
+
const jobContext = getJobContext();
|
|
105364
|
+
if (!jobContext) {
|
|
105365
|
+
console.log(`[Agent] done: ${extension.name} (no job context)`);
|
|
105366
|
+
return;
|
|
105367
|
+
}
|
|
105368
|
+
console.log(`[Agent] done: ${extension.name}`);
|
|
105369
|
+
const taskId = getAgentTaskId(jobContext.taskId, extension);
|
|
105370
|
+
await codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, taskId, ditto_codegen_types_12.Status.COMPLETED, { taskOutput: { files } });
|
|
105371
|
+
}
|
|
105372
|
+
async function failAgentTask(extension, error) {
|
|
105373
|
+
const jobContext = getJobContext();
|
|
105374
|
+
if (!jobContext) {
|
|
105375
|
+
console.error(`[Agent] error: ${extension.name} (no job context)`, error);
|
|
105376
|
+
return;
|
|
105377
|
+
}
|
|
105378
|
+
console.error(`[Agent] error: ${extension.name}`, error);
|
|
105379
|
+
const taskId = getAgentTaskId(jobContext.taskId, extension);
|
|
105380
|
+
await codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, taskId, ditto_codegen_types_12.Status.FAILED, { error: (0, utils_1.serializeError)(error) });
|
|
105381
|
+
}
|
|
105382
|
+
async function addUpdateExtensionAgentTask() {
|
|
105383
|
+
const jobContext = getJobContext();
|
|
105384
|
+
if (!jobContext) {
|
|
105385
|
+
console.log(`[Agent] start: iterating existing code (no job context)`);
|
|
105386
|
+
return;
|
|
105387
|
+
}
|
|
105388
|
+
console.log(`[Agent] start: iterating existing code`);
|
|
105389
|
+
const taskId = `${jobContext.taskId}-update-extension-agent`;
|
|
105390
|
+
await codeGenerationService_12.codeGenerationService.addTask(jobContext.jobId, {
|
|
105391
|
+
id: taskId,
|
|
105392
|
+
kind: ditto_codegen_types_12.TaskKind.RUN_AGENT,
|
|
105393
|
+
status: ditto_codegen_types_12.Status.RUNNING,
|
|
105394
|
+
name: "run_agent",
|
|
105395
|
+
description: "Iterating existing code",
|
|
105396
|
+
agentName: "UpdateExtensionAgent"
|
|
105397
|
+
});
|
|
105398
|
+
}
|
|
105399
|
+
async function completeUpdateExtensionAgentTask(files) {
|
|
105400
|
+
const jobContext = getJobContext();
|
|
105401
|
+
if (!jobContext) {
|
|
105402
|
+
console.log(`[Agent] done: iterating existing code (no job context)`);
|
|
105403
|
+
return;
|
|
105404
|
+
}
|
|
105405
|
+
console.log(`[Agent] done: iterating existing code`);
|
|
105406
|
+
const taskId = `${jobContext.taskId}-update-extension-agent`;
|
|
105407
|
+
await codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, taskId, ditto_codegen_types_12.Status.COMPLETED, { taskOutput: { files } });
|
|
105408
|
+
}
|
|
105409
|
+
async function failUpdateExtensionAgentTask(error) {
|
|
105410
|
+
const jobContext = getJobContext();
|
|
105411
|
+
if (!jobContext) {
|
|
105412
|
+
console.error(`[Agent] error: iterating existing code (no job context)`, error);
|
|
105413
|
+
return;
|
|
105414
|
+
}
|
|
105415
|
+
console.error(`[Agent] error: iterating existing code`, error);
|
|
105416
|
+
const taskId = `${jobContext.taskId}-update-extension-agent`;
|
|
105417
|
+
await codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, taskId, ditto_codegen_types_12.Status.FAILED, { error: (0, utils_1.serializeError)(error) });
|
|
105418
|
+
}
|
|
105419
|
+
async function updateJobPayload(jobContext, payload) {
|
|
105420
|
+
await codeGenerationService_12.codeGenerationService.updateJob(jobContext.jobId, payload);
|
|
105421
|
+
}
|
|
105422
|
+
async function updateParentTaskStatus(jobContext, status, error) {
|
|
105423
|
+
await codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, jobContext.taskId, status, error ? { error: (0, utils_1.serializeError)(error) } : {});
|
|
105424
|
+
}
|
|
105425
|
+
function getOutputPath() {
|
|
105426
|
+
const outputDir = process.env.OUTPUT_PATH || orchestrator_1.DittoOrchestrator.DEFAULT_OUTPUT_PATH;
|
|
105427
|
+
return outputDir.startsWith("/") ? outputDir : path_1.default.join(process.cwd(), outputDir);
|
|
105428
|
+
}
|
|
105429
|
+
async function getRequiredPermissions(extensions) {
|
|
105430
|
+
const httpClient = (0, http_client_1.createHttpClient)({
|
|
105431
|
+
baseURL: "https://manage.wix.com"
|
|
105432
|
+
});
|
|
105433
|
+
return httpClient.request((0, http_1.getRequiredPermissions)({
|
|
105434
|
+
relatedApis: getRelatedApis(extensions ?? []),
|
|
105435
|
+
extensionTypes: getExtensionTypes(extensions ?? [])
|
|
105436
|
+
}));
|
|
105437
|
+
}
|
|
105438
|
+
function getExtensionTypes(extensions) {
|
|
105439
|
+
return Array.from(new Set((extensions ?? []).map(({ type }) => type).filter(Boolean)));
|
|
105440
|
+
}
|
|
105441
|
+
function getRelatedApis(extensions) {
|
|
105442
|
+
return Array.from(new Set((extensions ?? []).flatMap((ext) => [
|
|
105443
|
+
...(ext.relatedApis ?? []).map(({ name }) => name).filter(Boolean),
|
|
105444
|
+
...(ext.relatedSpis ?? []).map(({ name }) => name).filter(Boolean)
|
|
105445
|
+
])));
|
|
105446
|
+
}
|
|
105447
|
+
}
|
|
105448
|
+
});
|
|
105449
|
+
|
|
105450
|
+
// dist/orchestrator-error-helpers.js
|
|
105451
|
+
var require_orchestrator_error_helpers = __commonJS({
|
|
105452
|
+
"dist/orchestrator-error-helpers.js"(exports2) {
|
|
105453
|
+
"use strict";
|
|
105454
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
105455
|
+
exports2.createExtensionErrorHandler = createExtensionErrorHandler;
|
|
105456
|
+
exports2.throwIfFailures = throwIfFailures;
|
|
105457
|
+
var ditto_codegen_types_12 = require_dist();
|
|
105458
|
+
var codegen_flow_helpers_1 = require_codegen_flow_helpers();
|
|
105459
|
+
function createExtensionErrorHandler(eventEmitter, extension) {
|
|
105460
|
+
return async (error) => {
|
|
105461
|
+
const codegenError = (0, ditto_codegen_types_12.toCodegenError)(error);
|
|
105462
|
+
await (0, codegen_flow_helpers_1.failAgentTask)(extension, codegenError);
|
|
105463
|
+
eventEmitter.emitEvent("agent:error", {
|
|
105464
|
+
extension,
|
|
105465
|
+
error: codegenError
|
|
105466
|
+
});
|
|
105467
|
+
console.error(`\u274C Failed to process extension ${extension.name}:`, error);
|
|
105468
|
+
throw codegenError;
|
|
105469
|
+
};
|
|
105470
|
+
}
|
|
105471
|
+
function throwIfFailures(results) {
|
|
105472
|
+
const failures = results.map((result, index) => {
|
|
105473
|
+
if (result.status === "rejected") {
|
|
105474
|
+
return {
|
|
105475
|
+
index,
|
|
105476
|
+
error: result.reason
|
|
105477
|
+
};
|
|
105478
|
+
}
|
|
105479
|
+
return null;
|
|
105480
|
+
}).filter((f) => f !== null);
|
|
105481
|
+
if (failures.length > 0) {
|
|
105482
|
+
const errorMessages = failures.map((f) => {
|
|
105483
|
+
const codegenError = (0, ditto_codegen_types_12.toCodegenError)(f.error);
|
|
105484
|
+
return `Task ${f.index} failed: ${codegenError.message}`;
|
|
105485
|
+
});
|
|
105486
|
+
const message = `Failed to process ${failures.length} of ${results.length} parallel tasks:
|
|
105487
|
+
${errorMessages.join("\n")}`;
|
|
105488
|
+
throw (0, ditto_codegen_types_12.toCodegenError)(new Error(message));
|
|
105489
|
+
}
|
|
105490
|
+
}
|
|
105491
|
+
}
|
|
105492
|
+
});
|
|
105493
|
+
|
|
105205
105494
|
// dist/validators/TypescriptValidator.js
|
|
105206
105495
|
var require_TypescriptValidator = __commonJS({
|
|
105207
105496
|
"dist/validators/TypescriptValidator.js"(exports2) {
|
|
@@ -105428,7 +105717,7 @@ var require_BuildFixerAgent = __commonJS({
|
|
|
105428
105717
|
WORKFLOW:
|
|
105429
105718
|
1. Analyze the build output to identify the error type and files involved
|
|
105430
105719
|
2. Read the relevant file(s) to understand the context
|
|
105431
|
-
3.
|
|
105720
|
+
3. ALWAYS call submit_fix with your fix - this is REQUIRED
|
|
105432
105721
|
|
|
105433
105722
|
EXTENSION-VALIDATOR ERRORS (most common):
|
|
105434
105723
|
Format: "[field] message (... → ./path/source.ts)"
|
|
@@ -105443,12 +105732,12 @@ OTHER BUILD ERRORS:
|
|
|
105443
105732
|
- Read the file mentioned in the error
|
|
105444
105733
|
- Use the error message and file content to determine the fix
|
|
105445
105734
|
|
|
105446
|
-
|
|
105447
|
-
-
|
|
105448
|
-
- Read
|
|
105735
|
+
CRITICAL RULES:
|
|
105736
|
+
- You MUST call submit_fix at the end - never respond with just text
|
|
105737
|
+
- Read files FIRST, then submit the fix
|
|
105738
|
+
- Read only 1-2 files maximum
|
|
105449
105739
|
- Make minimal changes - only fix what's broken
|
|
105450
|
-
- Preserve code style and formatting
|
|
105451
|
-
- Be efficient - submit the fix quickly after reading`;
|
|
105740
|
+
- Preserve code style and formatting`;
|
|
105452
105741
|
}
|
|
105453
105742
|
formatPreviousBuildOutput(previousBuildOutput) {
|
|
105454
105743
|
if (!previousBuildOutput) {
|
|
@@ -105474,11 +105763,11 @@ IMPORTANT:
|
|
|
105474
105763
|
2. Read the relevant file(s) first to understand the context
|
|
105475
105764
|
3. After reading, submit the fix for the file that needs changing
|
|
105476
105765
|
`;
|
|
105766
|
+
console.log(`\u{1F527} BuildFixerAgent starting with tools...`);
|
|
105767
|
+
const model = (0, customAnthropicProvider_1.createCustomTextModel)()(constants_1.LLM_MODELS.CLAUDE_HAIKU_4_5, {
|
|
105768
|
+
agentName: this.name
|
|
105769
|
+
});
|
|
105477
105770
|
try {
|
|
105478
|
-
console.log(`\u{1F527} BuildFixerAgent starting with tools...`);
|
|
105479
|
-
const model = (0, customAnthropicProvider_1.createCustomTextModel)()(constants_1.LLM_MODELS.CLAUDE_HAIKU_4_5, {
|
|
105480
|
-
agentName: this.name
|
|
105481
|
-
});
|
|
105482
105771
|
const result = await (0, codegen_common_logic_1.generateAgentText)({
|
|
105483
105772
|
agentName: this.name,
|
|
105484
105773
|
model,
|
|
@@ -105492,7 +105781,9 @@ IMPORTANT:
|
|
|
105492
105781
|
});
|
|
105493
105782
|
const fixResult = (0, codegen_common_logic_1.extractToolResult)(result.toolCalls, SUBMIT_FIX_TOOL_NAME);
|
|
105494
105783
|
if (!fixResult) {
|
|
105495
|
-
throw new
|
|
105784
|
+
throw new ditto_codegen_types_12.AutoFixError("BuildFixerAgent did not submit a fix", {
|
|
105785
|
+
validationType: ditto_codegen_types_12.ValidationType.BUILD
|
|
105786
|
+
});
|
|
105496
105787
|
}
|
|
105497
105788
|
console.log(`\u{1F527} BuildFixerAgent fix submitted for: ${fixResult.filePath}`);
|
|
105498
105789
|
return fixResult;
|
|
@@ -106377,7 +106668,8 @@ var require_finalize_extension_generation = __commonJS({
|
|
|
106377
106668
|
var file_collector_1 = require_file_collector();
|
|
106378
106669
|
var orchestrator_error_helpers_1 = require_orchestrator_error_helpers();
|
|
106379
106670
|
var write_file_1 = require_write_file();
|
|
106380
|
-
|
|
106671
|
+
var codegen_flow_helpers_1 = require_codegen_flow_helpers();
|
|
106672
|
+
async function finalizeExtensionGeneration(options, eventEmitter) {
|
|
106381
106673
|
const { extension, agentName, agentFiles, scaffolds = [], scaffoldPath, outputPath, generatedConfig } = options;
|
|
106382
106674
|
try {
|
|
106383
106675
|
const filesToCheck = agentFiles.map((f) => f.path || "");
|
|
@@ -106396,6 +106688,7 @@ var require_finalize_extension_generation = __commonJS({
|
|
|
106396
106688
|
outputPath,
|
|
106397
106689
|
existingFiles
|
|
106398
106690
|
});
|
|
106691
|
+
await (0, codegen_flow_helpers_1.completeAgentTask)(extension, allCreatedFiles);
|
|
106399
106692
|
eventEmitter.emitEvent("agent:done", {
|
|
106400
106693
|
extension,
|
|
106401
106694
|
name: agentName,
|
|
@@ -106403,7 +106696,8 @@ var require_finalize_extension_generation = __commonJS({
|
|
|
106403
106696
|
});
|
|
106404
106697
|
return extensionFilePath;
|
|
106405
106698
|
} catch (error) {
|
|
106406
|
-
|
|
106699
|
+
await (0, orchestrator_error_helpers_1.createExtensionErrorHandler)(eventEmitter, extension)(error);
|
|
106700
|
+
throw error;
|
|
106407
106701
|
}
|
|
106408
106702
|
}
|
|
106409
106703
|
}
|
|
@@ -106449,10 +106743,12 @@ var require_extensionProcessors = __commonJS({
|
|
|
106449
106743
|
exports2.processStandardExtension = processStandardExtension;
|
|
106450
106744
|
var finalize_extension_generation_1 = require_finalize_extension_generation();
|
|
106451
106745
|
var create_scaffolding_1 = require_create_scaffolding();
|
|
106746
|
+
var codegen_flow_helpers_1 = require_codegen_flow_helpers();
|
|
106452
106747
|
async function processStandardExtension(params) {
|
|
106453
106748
|
const { extension, outputPath, plan, agentsFactory, eventEmitter, blueprint, userRequestSummary, previousResources } = params;
|
|
106454
106749
|
const scaffolds = await (0, create_scaffolding_1.createScaffolding)(extension, outputPath, eventEmitter);
|
|
106455
106750
|
const agent = agentsFactory.getAgent(extension);
|
|
106751
|
+
await (0, codegen_flow_helpers_1.addAgentTask)(extension, agent.name);
|
|
106456
106752
|
eventEmitter.emitEvent("agent:start", {
|
|
106457
106753
|
extension,
|
|
106458
106754
|
name: agent.name
|
|
@@ -106466,7 +106762,7 @@ var require_extensionProcessors = __commonJS({
|
|
|
106466
106762
|
...userRequestSummary && { userRequestSummary },
|
|
106467
106763
|
...previousResources && { previousResources }
|
|
106468
106764
|
});
|
|
106469
|
-
(0, finalize_extension_generation_1.finalizeExtensionGeneration)({
|
|
106765
|
+
await (0, finalize_extension_generation_1.finalizeExtensionGeneration)({
|
|
106470
106766
|
extension,
|
|
106471
106767
|
agentName: agent.name,
|
|
106472
106768
|
agentFiles: files,
|
|
@@ -106487,6 +106783,7 @@ var require_dashboardPage = __commonJS({
|
|
|
106487
106783
|
var finalize_extension_generation_1 = require_finalize_extension_generation();
|
|
106488
106784
|
var extensionProcessors_1 = require_extensionProcessors();
|
|
106489
106785
|
var ditto_codegen_types_12 = require_dist();
|
|
106786
|
+
var codegen_flow_helpers_1 = require_codegen_flow_helpers();
|
|
106490
106787
|
async function processDashboardPage(params) {
|
|
106491
106788
|
const { extension, outputPath, plan, agentsFactory, eventEmitter, blueprint, userRequestSummary, previousResources } = params;
|
|
106492
106789
|
const decisionAgent = agentsFactory.getAgent({
|
|
@@ -106528,6 +106825,7 @@ var require_dashboardPage = __commonJS({
|
|
|
106528
106825
|
const autoPatternsGenerator = agentsFactory.getAgent({
|
|
106529
106826
|
type: "AUTO_PATTERNS_GENERATOR"
|
|
106530
106827
|
});
|
|
106828
|
+
await (0, codegen_flow_helpers_1.addAgentTask)(extension, "DashboardAgent");
|
|
106531
106829
|
eventEmitter.emitEvent("agent:start", {
|
|
106532
106830
|
extension,
|
|
106533
106831
|
name: "DashboardAgent"
|
|
@@ -106538,7 +106836,7 @@ var require_dashboardPage = __commonJS({
|
|
|
106538
106836
|
extensionName: extension.name || ""
|
|
106539
106837
|
});
|
|
106540
106838
|
const pagePath = files[0].path || "";
|
|
106541
|
-
(0, finalize_extension_generation_1.finalizeExtensionGeneration)({
|
|
106839
|
+
await (0, finalize_extension_generation_1.finalizeExtensionGeneration)({
|
|
106542
106840
|
extension,
|
|
106543
106841
|
agentName: "DashboardAgent",
|
|
106544
106842
|
agentFiles: files,
|
|
@@ -106560,6 +106858,7 @@ var require_servicePlugin = __commonJS({
|
|
|
106560
106858
|
var finalize_extension_generation_1 = require_finalize_extension_generation();
|
|
106561
106859
|
var create_scaffolding_1 = require_create_scaffolding();
|
|
106562
106860
|
var ditto_codegen_types_12 = require_dist();
|
|
106861
|
+
var codegen_flow_helpers_1 = require_codegen_flow_helpers();
|
|
106563
106862
|
async function processMultipleServicePluginScaffolds(params) {
|
|
106564
106863
|
const { extension, scaffolds, outputPath, plan, agentsFactory, eventEmitter, blueprint, userRequestSummary, previousResources } = params;
|
|
106565
106864
|
if (!extension.relatedSpis || extension.relatedSpis.length === 0) {
|
|
@@ -106580,6 +106879,7 @@ var require_servicePlugin = __commonJS({
|
|
|
106580
106879
|
relatedSpis: [spi]
|
|
106581
106880
|
};
|
|
106582
106881
|
const agent = agentsFactory.getAgent(spiExtension);
|
|
106882
|
+
await (0, codegen_flow_helpers_1.addAgentTask)(spiExtension, agent.name);
|
|
106583
106883
|
eventEmitter.emitEvent("agent:start", {
|
|
106584
106884
|
extension: spiExtension,
|
|
106585
106885
|
name: agent.name
|
|
@@ -106593,7 +106893,7 @@ var require_servicePlugin = __commonJS({
|
|
|
106593
106893
|
...userRequestSummary && { userRequestSummary },
|
|
106594
106894
|
...previousResources && { previousResources }
|
|
106595
106895
|
});
|
|
106596
|
-
(0, finalize_extension_generation_1.finalizeExtensionGeneration)({
|
|
106896
|
+
await (0, finalize_extension_generation_1.finalizeExtensionGeneration)({
|
|
106597
106897
|
extension: spiExtension,
|
|
106598
106898
|
agentName: agent.name,
|
|
106599
106899
|
agentFiles: files,
|
|
@@ -106612,6 +106912,7 @@ var require_servicePlugin = __commonJS({
|
|
|
106612
106912
|
return processMultipleServicePluginScaffolds({ ...params, scaffolds });
|
|
106613
106913
|
}
|
|
106614
106914
|
const agent = agentsFactory.getAgent(extension);
|
|
106915
|
+
await (0, codegen_flow_helpers_1.addAgentTask)(extension, agent.name);
|
|
106615
106916
|
eventEmitter.emitEvent("agent:start", { extension, name: agent.name });
|
|
106616
106917
|
const files = await agent.generate({
|
|
106617
106918
|
extension,
|
|
@@ -106622,7 +106923,7 @@ var require_servicePlugin = __commonJS({
|
|
|
106622
106923
|
...userRequestSummary && { userRequestSummary },
|
|
106623
106924
|
...previousResources && { previousResources }
|
|
106624
106925
|
});
|
|
106625
|
-
(0, finalize_extension_generation_1.finalizeExtensionGeneration)({
|
|
106926
|
+
await (0, finalize_extension_generation_1.finalizeExtensionGeneration)({
|
|
106626
106927
|
extension,
|
|
106627
106928
|
agentName: agent.name,
|
|
106628
106929
|
agentFiles: files,
|
|
@@ -106643,10 +106944,12 @@ var require_embeddedScript = __commonJS({
|
|
|
106643
106944
|
var types_1 = require_types_impl2();
|
|
106644
106945
|
var finalize_extension_generation_1 = require_finalize_extension_generation();
|
|
106645
106946
|
var create_scaffolding_1 = require_create_scaffolding();
|
|
106947
|
+
var codegen_flow_helpers_1 = require_codegen_flow_helpers();
|
|
106646
106948
|
async function processEmbeddedScriptExtension(params) {
|
|
106647
106949
|
const { extension, outputPath, plan, agentsFactory, eventEmitter, blueprint, userRequestSummary, previousResources } = params;
|
|
106648
106950
|
const scaffolds = await (0, create_scaffolding_1.createScaffolding)(extension, outputPath, eventEmitter);
|
|
106649
106951
|
const embeddedScriptAgent = agentsFactory.getAgent(extension);
|
|
106952
|
+
await (0, codegen_flow_helpers_1.addAgentTask)(extension, embeddedScriptAgent.name);
|
|
106650
106953
|
eventEmitter.emitEvent("agent:start", {
|
|
106651
106954
|
extension,
|
|
106652
106955
|
name: embeddedScriptAgent.name
|
|
@@ -106660,7 +106963,7 @@ var require_embeddedScript = __commonJS({
|
|
|
106660
106963
|
...userRequestSummary && { userRequestSummary },
|
|
106661
106964
|
...previousResources && { previousResources }
|
|
106662
106965
|
});
|
|
106663
|
-
(0, finalize_extension_generation_1.finalizeExtensionGeneration)({
|
|
106966
|
+
await (0, finalize_extension_generation_1.finalizeExtensionGeneration)({
|
|
106664
106967
|
extension,
|
|
106665
106968
|
agentName: embeddedScriptAgent.name,
|
|
106666
106969
|
agentFiles: files,
|
|
@@ -106684,9 +106987,11 @@ var require_backendApi = __commonJS({
|
|
|
106684
106987
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
106685
106988
|
exports2.processBackendApiExtension = processBackendApiExtension;
|
|
106686
106989
|
var finalize_extension_generation_1 = require_finalize_extension_generation();
|
|
106990
|
+
var codegen_flow_helpers_1 = require_codegen_flow_helpers();
|
|
106687
106991
|
async function processBackendApiExtension(params) {
|
|
106688
106992
|
const { extension, outputPath, plan, agentsFactory, eventEmitter, blueprint, userRequestSummary, previousResources } = params;
|
|
106689
106993
|
const backendApiAgent = agentsFactory.getAgent(extension);
|
|
106994
|
+
await (0, codegen_flow_helpers_1.addAgentTask)(extension, backendApiAgent.name);
|
|
106690
106995
|
eventEmitter.emitEvent("agent:start", {
|
|
106691
106996
|
extension,
|
|
106692
106997
|
name: backendApiAgent.name
|
|
@@ -106699,7 +107004,7 @@ var require_backendApi = __commonJS({
|
|
|
106699
107004
|
...userRequestSummary && { userRequestSummary },
|
|
106700
107005
|
...previousResources && { previousResources }
|
|
106701
107006
|
});
|
|
106702
|
-
(0, finalize_extension_generation_1.finalizeExtensionGeneration)({
|
|
107007
|
+
await (0, finalize_extension_generation_1.finalizeExtensionGeneration)({
|
|
106703
107008
|
extension,
|
|
106704
107009
|
agentName: backendApiAgent.name,
|
|
106705
107010
|
agentFiles: files,
|
|
@@ -106965,255 +107270,6 @@ var require_orchestrator = __commonJS({
|
|
|
106965
107270
|
}
|
|
106966
107271
|
});
|
|
106967
107272
|
|
|
106968
|
-
// ../../node_modules/@wix/ambassador-ctp-ditto-v1-blueprint/build/cjs/http.impl.js
|
|
106969
|
-
var require_http_impl2 = __commonJS({
|
|
106970
|
-
"../../node_modules/@wix/ambassador-ctp-ditto-v1-blueprint/build/cjs/http.impl.js"(exports2) {
|
|
106971
|
-
"use strict";
|
|
106972
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
106973
|
-
exports2.getRequiredPermissions = exports2.editBlueprint = exports2.createAppName = exports2.createBlueprint = void 0;
|
|
106974
|
-
var ambassador_1 = require_ambassador_index();
|
|
106975
|
-
var metro_runtime_1 = require_cjs2();
|
|
106976
|
-
var _createAppNameRequest = {};
|
|
106977
|
-
var _createAppNameResponse = {};
|
|
106978
|
-
var _createBlueprintRequest = {};
|
|
106979
|
-
var _createBlueprintResponse = {};
|
|
106980
|
-
var _editBlueprintRequest = {};
|
|
106981
|
-
var _editBlueprintResponse = {};
|
|
106982
|
-
var _getRequiredPermissionsRequest = {};
|
|
106983
|
-
var _getRequiredPermissionsResponse = {};
|
|
106984
|
-
function resolveComWixpressDittoBlueprintServiceApiDittoBlueprintServiceUrl(opts) {
|
|
106985
|
-
var domainToMappings = {
|
|
106986
|
-
"manage._base_domain_": [
|
|
106987
|
-
{
|
|
106988
|
-
srcPath: "/_api/ditto-blueprint-service-web",
|
|
106989
|
-
destPath: ""
|
|
106990
|
-
}
|
|
106991
|
-
]
|
|
106992
|
-
};
|
|
106993
|
-
return (0, metro_runtime_1.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
106994
|
-
}
|
|
106995
|
-
function createBlueprint(payload) {
|
|
106996
|
-
var _a = (0, ambassador_1.serializer)(_createBlueprintRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
|
|
106997
|
-
var fromRes = (0, ambassador_1.serializer)(_createBlueprintResponse, {}).fromJSON;
|
|
106998
|
-
function __createBlueprint(_a2) {
|
|
106999
|
-
var host = _a2.host;
|
|
107000
|
-
var serializedData = toReq(payload);
|
|
107001
|
-
var metadata = {
|
|
107002
|
-
entityFqdn: "wix.ctp.ditto.v1.blueprint",
|
|
107003
|
-
method: "POST",
|
|
107004
|
-
methodFqn: "com.wixpress.ditto_blueprint_service.api.DittoBlueprintService.CreateBlueprint",
|
|
107005
|
-
migrationOptions: {
|
|
107006
|
-
optInTransformResponse: true
|
|
107007
|
-
},
|
|
107008
|
-
url: resolveComWixpressDittoBlueprintServiceApiDittoBlueprintServiceUrl({
|
|
107009
|
-
protoPath: "/v1/blueprints",
|
|
107010
|
-
data: serializedData,
|
|
107011
|
-
host
|
|
107012
|
-
}),
|
|
107013
|
-
data: serializedData,
|
|
107014
|
-
transformResponse: fromRes
|
|
107015
|
-
};
|
|
107016
|
-
return metadata;
|
|
107017
|
-
}
|
|
107018
|
-
__createBlueprint.fromReq = fromReq;
|
|
107019
|
-
__createBlueprint.__isAmbassador = true;
|
|
107020
|
-
return __createBlueprint;
|
|
107021
|
-
}
|
|
107022
|
-
exports2.createBlueprint = createBlueprint;
|
|
107023
|
-
function createAppName(payload) {
|
|
107024
|
-
var _a = (0, ambassador_1.serializer)(_createAppNameRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
|
|
107025
|
-
var fromRes = (0, ambassador_1.serializer)(_createAppNameResponse, {}).fromJSON;
|
|
107026
|
-
function __createAppName(_a2) {
|
|
107027
|
-
var host = _a2.host;
|
|
107028
|
-
var serializedData = toReq(payload);
|
|
107029
|
-
var metadata = {
|
|
107030
|
-
entityFqdn: "wix.ctp.ditto.v1.blueprint",
|
|
107031
|
-
method: "POST",
|
|
107032
|
-
methodFqn: "com.wixpress.ditto_blueprint_service.api.DittoBlueprintService.CreateAppName",
|
|
107033
|
-
migrationOptions: {
|
|
107034
|
-
optInTransformResponse: true
|
|
107035
|
-
},
|
|
107036
|
-
url: resolveComWixpressDittoBlueprintServiceApiDittoBlueprintServiceUrl({
|
|
107037
|
-
protoPath: "/v1/blueprints/app-name",
|
|
107038
|
-
data: serializedData,
|
|
107039
|
-
host
|
|
107040
|
-
}),
|
|
107041
|
-
data: serializedData,
|
|
107042
|
-
transformResponse: fromRes
|
|
107043
|
-
};
|
|
107044
|
-
return metadata;
|
|
107045
|
-
}
|
|
107046
|
-
__createAppName.fromReq = fromReq;
|
|
107047
|
-
__createAppName.__isAmbassador = true;
|
|
107048
|
-
return __createAppName;
|
|
107049
|
-
}
|
|
107050
|
-
exports2.createAppName = createAppName;
|
|
107051
|
-
function editBlueprint(payload) {
|
|
107052
|
-
var _a = (0, ambassador_1.serializer)(_editBlueprintRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
|
|
107053
|
-
var fromRes = (0, ambassador_1.serializer)(_editBlueprintResponse, {}).fromJSON;
|
|
107054
|
-
function __editBlueprint(_a2) {
|
|
107055
|
-
var host = _a2.host;
|
|
107056
|
-
var serializedData = toReq(payload);
|
|
107057
|
-
var metadata = {
|
|
107058
|
-
entityFqdn: "wix.ctp.ditto.v1.blueprint",
|
|
107059
|
-
method: "POST",
|
|
107060
|
-
methodFqn: "com.wixpress.ditto_blueprint_service.api.DittoBlueprintService.EditBlueprint",
|
|
107061
|
-
migrationOptions: {
|
|
107062
|
-
optInTransformResponse: true
|
|
107063
|
-
},
|
|
107064
|
-
url: resolveComWixpressDittoBlueprintServiceApiDittoBlueprintServiceUrl({
|
|
107065
|
-
protoPath: "/v1/blueprints/edit",
|
|
107066
|
-
data: serializedData,
|
|
107067
|
-
host
|
|
107068
|
-
}),
|
|
107069
|
-
data: serializedData,
|
|
107070
|
-
transformResponse: fromRes
|
|
107071
|
-
};
|
|
107072
|
-
return metadata;
|
|
107073
|
-
}
|
|
107074
|
-
__editBlueprint.fromReq = fromReq;
|
|
107075
|
-
__editBlueprint.__isAmbassador = true;
|
|
107076
|
-
return __editBlueprint;
|
|
107077
|
-
}
|
|
107078
|
-
exports2.editBlueprint = editBlueprint;
|
|
107079
|
-
function getRequiredPermissions(payload) {
|
|
107080
|
-
var _a = (0, ambassador_1.serializer)(_getRequiredPermissionsRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
|
|
107081
|
-
var fromRes = (0, ambassador_1.serializer)(_getRequiredPermissionsResponse, {}).fromJSON;
|
|
107082
|
-
function __getRequiredPermissions(_a2) {
|
|
107083
|
-
var host = _a2.host;
|
|
107084
|
-
var serializedData = toReq(payload);
|
|
107085
|
-
var metadata = {
|
|
107086
|
-
entityFqdn: "wix.ctp.ditto.v1.blueprint",
|
|
107087
|
-
method: "POST",
|
|
107088
|
-
methodFqn: "com.wixpress.ditto_blueprint_service.api.DittoBlueprintService.GetRequiredPermissions",
|
|
107089
|
-
migrationOptions: {
|
|
107090
|
-
optInTransformResponse: true
|
|
107091
|
-
},
|
|
107092
|
-
url: resolveComWixpressDittoBlueprintServiceApiDittoBlueprintServiceUrl({
|
|
107093
|
-
protoPath: "/v1/blueprints/required-permissions",
|
|
107094
|
-
data: serializedData,
|
|
107095
|
-
host
|
|
107096
|
-
}),
|
|
107097
|
-
data: serializedData,
|
|
107098
|
-
transformResponse: fromRes
|
|
107099
|
-
};
|
|
107100
|
-
return metadata;
|
|
107101
|
-
}
|
|
107102
|
-
__getRequiredPermissions.fromReq = fromReq;
|
|
107103
|
-
__getRequiredPermissions.__isAmbassador = true;
|
|
107104
|
-
return __getRequiredPermissions;
|
|
107105
|
-
}
|
|
107106
|
-
exports2.getRequiredPermissions = getRequiredPermissions;
|
|
107107
|
-
}
|
|
107108
|
-
});
|
|
107109
|
-
|
|
107110
|
-
// dist/flows/codegen-flow-helpers.js
|
|
107111
|
-
var require_codegen_flow_helpers = __commonJS({
|
|
107112
|
-
"dist/flows/codegen-flow-helpers.js"(exports2) {
|
|
107113
|
-
"use strict";
|
|
107114
|
-
var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
|
|
107115
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
107116
|
-
};
|
|
107117
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
107118
|
-
exports2.setupAgentTaskTracking = setupAgentTaskTracking;
|
|
107119
|
-
exports2.updateJobPayload = updateJobPayload;
|
|
107120
|
-
exports2.updateParentTaskStatus = updateParentTaskStatus;
|
|
107121
|
-
exports2.getOutputPath = getOutputPath;
|
|
107122
|
-
exports2.getRequiredPermissions = getRequiredPermissions;
|
|
107123
|
-
var path_1 = __importDefault2(require("path"));
|
|
107124
|
-
var codeGenerationService_12 = require_codeGenerationService();
|
|
107125
|
-
var ditto_codegen_types_12 = require_dist();
|
|
107126
|
-
var utils_1 = require_utils15();
|
|
107127
|
-
var http_1 = require_http_impl2();
|
|
107128
|
-
var http_client_1 = require_index_node();
|
|
107129
|
-
var orchestrator_1 = require_orchestrator();
|
|
107130
|
-
var AgentsFactory_1 = require_AgentsFactory();
|
|
107131
|
-
var slugify = (str = "") => {
|
|
107132
|
-
return str.toLowerCase().replace(/ /g, "-");
|
|
107133
|
-
};
|
|
107134
|
-
function setupAgentTaskTracking(eventEmitter, jobContext) {
|
|
107135
|
-
const getTaskId = (extension) => {
|
|
107136
|
-
return `${jobContext.taskId}-${slugify(extension.name)}`;
|
|
107137
|
-
};
|
|
107138
|
-
eventEmitter.onEvent("agent:start", ({ extension }) => {
|
|
107139
|
-
console.log(`[Agent] start: ${extension.name}`);
|
|
107140
|
-
const taskId = getTaskId(extension);
|
|
107141
|
-
codeGenerationService_12.codeGenerationService.addTask(jobContext.jobId, {
|
|
107142
|
-
id: taskId,
|
|
107143
|
-
kind: ditto_codegen_types_12.TaskKind.RUN_AGENT,
|
|
107144
|
-
status: ditto_codegen_types_12.Status.RUNNING,
|
|
107145
|
-
name: "run_agent",
|
|
107146
|
-
description: `Run agent for ${extension.name}`,
|
|
107147
|
-
payload: { extension },
|
|
107148
|
-
agentName: new AgentsFactory_1.AgentsFactory().getAgent(extension).name
|
|
107149
|
-
});
|
|
107150
|
-
});
|
|
107151
|
-
eventEmitter.onEvent("agent:done", ({ extension, files }) => {
|
|
107152
|
-
console.log(`[Agent] done: ${extension.name}`);
|
|
107153
|
-
const taskId = getTaskId(extension);
|
|
107154
|
-
codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, taskId, ditto_codegen_types_12.Status.COMPLETED, { taskOutput: { files } });
|
|
107155
|
-
});
|
|
107156
|
-
eventEmitter.onEvent("agent:error", async ({ extension, error }) => {
|
|
107157
|
-
console.error(`[Agent] error: ${extension.name}`, error);
|
|
107158
|
-
const taskId = getTaskId(extension);
|
|
107159
|
-
await codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, taskId, ditto_codegen_types_12.Status.FAILED, {
|
|
107160
|
-
error: (0, utils_1.serializeError)(error)
|
|
107161
|
-
});
|
|
107162
|
-
});
|
|
107163
|
-
const updateExtensionAgentTaskId = `${jobContext.taskId}-update-extension-agent`;
|
|
107164
|
-
eventEmitter.onEvent("updateExtensionAgent:start", () => {
|
|
107165
|
-
console.log(`[Agent] start: iterating existing code`);
|
|
107166
|
-
codeGenerationService_12.codeGenerationService.addTask(jobContext.jobId, {
|
|
107167
|
-
id: updateExtensionAgentTaskId,
|
|
107168
|
-
kind: ditto_codegen_types_12.TaskKind.RUN_AGENT,
|
|
107169
|
-
status: ditto_codegen_types_12.Status.RUNNING,
|
|
107170
|
-
name: "run_agent",
|
|
107171
|
-
description: "Iterating existing code",
|
|
107172
|
-
agentName: "UpdateExtensionAgent"
|
|
107173
|
-
});
|
|
107174
|
-
});
|
|
107175
|
-
eventEmitter.onEvent("updateExtensionAgent:done", ({ files }) => {
|
|
107176
|
-
console.log(`[Agent] done: iterating existing code`);
|
|
107177
|
-
codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, updateExtensionAgentTaskId, ditto_codegen_types_12.Status.COMPLETED, { taskOutput: { files } });
|
|
107178
|
-
});
|
|
107179
|
-
eventEmitter.onEvent("updateExtensionAgent:error", async ({ error }) => {
|
|
107180
|
-
console.error(`[Agent] error: iterating existing code`, error);
|
|
107181
|
-
await codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, updateExtensionAgentTaskId, ditto_codegen_types_12.Status.FAILED, {
|
|
107182
|
-
error: (0, utils_1.serializeError)(error)
|
|
107183
|
-
});
|
|
107184
|
-
});
|
|
107185
|
-
}
|
|
107186
|
-
async function updateJobPayload(jobContext, payload) {
|
|
107187
|
-
await codeGenerationService_12.codeGenerationService.updateJob(jobContext.jobId, payload);
|
|
107188
|
-
}
|
|
107189
|
-
async function updateParentTaskStatus(jobContext, status, error) {
|
|
107190
|
-
await codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, jobContext.taskId, status, error ? { error: (0, utils_1.serializeError)(error) } : {});
|
|
107191
|
-
}
|
|
107192
|
-
function getOutputPath() {
|
|
107193
|
-
const outputDir = process.env.OUTPUT_PATH || orchestrator_1.DittoOrchestrator.DEFAULT_OUTPUT_PATH;
|
|
107194
|
-
return outputDir.startsWith("/") ? outputDir : path_1.default.join(process.cwd(), outputDir);
|
|
107195
|
-
}
|
|
107196
|
-
async function getRequiredPermissions(extensions) {
|
|
107197
|
-
const httpClient = (0, http_client_1.createHttpClient)({
|
|
107198
|
-
baseURL: "https://manage.wix.com"
|
|
107199
|
-
});
|
|
107200
|
-
return httpClient.request((0, http_1.getRequiredPermissions)({
|
|
107201
|
-
relatedApis: getRelatedApis(extensions ?? []),
|
|
107202
|
-
extensionTypes: getExtensionTypes(extensions ?? [])
|
|
107203
|
-
}));
|
|
107204
|
-
}
|
|
107205
|
-
function getExtensionTypes(extensions) {
|
|
107206
|
-
return Array.from(new Set((extensions ?? []).map(({ type }) => type).filter(Boolean)));
|
|
107207
|
-
}
|
|
107208
|
-
function getRelatedApis(extensions) {
|
|
107209
|
-
return Array.from(new Set((extensions ?? []).flatMap((ext) => [
|
|
107210
|
-
...(ext.relatedApis ?? []).map(({ name }) => name).filter(Boolean),
|
|
107211
|
-
...(ext.relatedSpis ?? []).map(({ name }) => name).filter(Boolean)
|
|
107212
|
-
])));
|
|
107213
|
-
}
|
|
107214
|
-
}
|
|
107215
|
-
});
|
|
107216
|
-
|
|
107217
107273
|
// dist/flows/init-codegen.js
|
|
107218
107274
|
var require_init_codegen = __commonJS({
|
|
107219
107275
|
"dist/flows/init-codegen.js"(exports2) {
|
|
@@ -107239,7 +107295,6 @@ var require_init_codegen = __commonJS({
|
|
|
107239
107295
|
const outputPath = (0, codegen_flow_helpers_1.getOutputPath)();
|
|
107240
107296
|
const agentsFactory = new AgentsFactory_1.AgentsFactory(false);
|
|
107241
107297
|
const orchestrator = new orchestrator_1.DittoOrchestrator(agentsFactory);
|
|
107242
|
-
(0, codegen_flow_helpers_1.setupAgentTaskTracking)(orchestrator, localJobContext);
|
|
107243
107298
|
(0, cli_listeners_1.attachOrchestratorListeners)(orchestrator);
|
|
107244
107299
|
try {
|
|
107245
107300
|
const requiredPermissionsResponse = await (0, codegen_flow_helpers_1.getRequiredPermissions)(blueprint?.extensions ?? []);
|
|
@@ -321045,6 +321100,7 @@ var require_IterationOrchestrator = __commonJS({
|
|
|
321045
321100
|
var write_file_1 = require_write_file();
|
|
321046
321101
|
var projectContext_1 = require_projectContext();
|
|
321047
321102
|
var ditto_codegen_types_12 = require_dist();
|
|
321103
|
+
var codegen_flow_helpers_1 = require_codegen_flow_helpers();
|
|
321048
321104
|
var IterationOrchestrator = class extends DittoEventEmitter_1.DittoEventEmitter {
|
|
321049
321105
|
constructor(agentsFactory) {
|
|
321050
321106
|
super();
|
|
@@ -321143,6 +321199,7 @@ var require_IterationOrchestrator = __commonJS({
|
|
|
321143
321199
|
return iterationPlan;
|
|
321144
321200
|
}
|
|
321145
321201
|
async processExistingExtensions({ currentExtensions, userRequestSummary, outputPath, plan, previousResources }) {
|
|
321202
|
+
await (0, codegen_flow_helpers_1.addUpdateExtensionAgentTask)();
|
|
321146
321203
|
this.emitEvent("updateExtensionAgent:start", {});
|
|
321147
321204
|
try {
|
|
321148
321205
|
const updateExtensionAgent = this.agentsFactory.getAgent({
|
|
@@ -321155,10 +321212,12 @@ var require_IterationOrchestrator = __commonJS({
|
|
|
321155
321212
|
plan,
|
|
321156
321213
|
previousResources
|
|
321157
321214
|
});
|
|
321215
|
+
await (0, codegen_flow_helpers_1.completeUpdateExtensionAgentTask)(result.filesModified);
|
|
321158
321216
|
this.emitEvent("updateExtensionAgent:done", {
|
|
321159
321217
|
files: result.filesModified
|
|
321160
321218
|
});
|
|
321161
321219
|
} catch (error) {
|
|
321220
|
+
await (0, codegen_flow_helpers_1.failUpdateExtensionAgentTask)(error);
|
|
321162
321221
|
this.emitEvent("updateExtensionAgent:error", {
|
|
321163
321222
|
error: error instanceof Error ? error : new Error(String(error))
|
|
321164
321223
|
});
|
|
@@ -321310,7 +321369,6 @@ var require_iterate_codegen = __commonJS({
|
|
|
321310
321369
|
const outputPath = (0, codegen_flow_helpers_1.getOutputPath)();
|
|
321311
321370
|
const agentsFactory = new AgentsFactory_1.AgentsFactory(true);
|
|
321312
321371
|
const iterationOrchestrator = new IterationOrchestrator_1.IterationOrchestrator(agentsFactory);
|
|
321313
|
-
(0, codegen_flow_helpers_1.setupAgentTaskTracking)(iterationOrchestrator, localJobContext);
|
|
321314
321372
|
(0, cli_listeners_1.attachOrchestratorListeners)(iterationOrchestrator);
|
|
321315
321373
|
const { iterationPlan, previousResources } = await iterationOrchestrator.getContextualIterationPlan({
|
|
321316
321374
|
outputPath,
|
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.225",
|
|
4
4
|
"description": "AI-powered Wix CLI app generator - standalone executable",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "node build.mjs",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@wix/ditto-codegen": "1.0.0",
|
|
25
25
|
"esbuild": "^0.27.2"
|
|
26
26
|
},
|
|
27
|
-
"falconPackageHash": "
|
|
27
|
+
"falconPackageHash": "2e7d0b6dea61740e43a2e46910e0abf3709a19aed36a59e7b403b2cc"
|
|
28
28
|
}
|