@wix/ditto-codegen-public 1.0.295 → 1.0.297
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 +72 -28
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -39,16 +39,13 @@ var require_types_impl = __commonJS({
|
|
|
39
39
|
"../../node_modules/@wix/ambassador-ctp-codegen-job-service-v1-job/cjs/build/types.impl.js"(exports2) {
|
|
40
40
|
"use strict";
|
|
41
41
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
42
|
-
exports2.
|
|
43
|
-
var
|
|
44
|
-
(function(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
TaskKind2["FIX_CODE"] = "FIX_CODE";
|
|
50
|
-
TaskKind2["ASK_CODEGEN"] = "ASK_CODEGEN";
|
|
51
|
-
})(TaskKind || (exports2.TaskKind = TaskKind = {}));
|
|
42
|
+
exports2.UserDecisionQuestionType = exports2.TaskKind = exports2.Status = exports2.Environment = void 0;
|
|
43
|
+
var Environment;
|
|
44
|
+
(function(Environment2) {
|
|
45
|
+
Environment2["UNKNOWN_ENVIRONMENT"] = "UNKNOWN_ENVIRONMENT";
|
|
46
|
+
Environment2["APP_BUILDER"] = "APP_BUILDER";
|
|
47
|
+
Environment2["STUDIO_2"] = "STUDIO_2";
|
|
48
|
+
})(Environment || (exports2.Environment = Environment = {}));
|
|
52
49
|
var Status;
|
|
53
50
|
(function(Status2) {
|
|
54
51
|
Status2["UNKNOWN_STATUS"] = "UNKNOWN_STATUS";
|
|
@@ -60,17 +57,20 @@ var require_types_impl = __commonJS({
|
|
|
60
57
|
Status2["PENDING_CANCEL"] = "PENDING_CANCEL";
|
|
61
58
|
Status2["AWAITING_USER_INPUT"] = "AWAITING_USER_INPUT";
|
|
62
59
|
})(Status || (exports2.Status = Status = {}));
|
|
60
|
+
var TaskKind;
|
|
61
|
+
(function(TaskKind2) {
|
|
62
|
+
TaskKind2["UNKNOWN_TASK_KIND"] = "UNKNOWN_TASK_KIND";
|
|
63
|
+
TaskKind2["INIT_CODEGEN"] = "INIT_CODEGEN";
|
|
64
|
+
TaskKind2["ITERATE_CODEGEN"] = "ITERATE_CODEGEN";
|
|
65
|
+
TaskKind2["RUN_AGENT"] = "RUN_AGENT";
|
|
66
|
+
TaskKind2["FIX_CODE"] = "FIX_CODE";
|
|
67
|
+
TaskKind2["ASK_CODEGEN"] = "ASK_CODEGEN";
|
|
68
|
+
})(TaskKind || (exports2.TaskKind = TaskKind = {}));
|
|
63
69
|
var UserDecisionQuestionType;
|
|
64
70
|
(function(UserDecisionQuestionType2) {
|
|
65
71
|
UserDecisionQuestionType2["UNKNOWN_QUESTION_TYPE"] = "UNKNOWN_QUESTION_TYPE";
|
|
66
72
|
UserDecisionQuestionType2["UI_COMPONENT_TYPE"] = "UI_COMPONENT_TYPE";
|
|
67
73
|
})(UserDecisionQuestionType || (exports2.UserDecisionQuestionType = UserDecisionQuestionType = {}));
|
|
68
|
-
var Environment;
|
|
69
|
-
(function(Environment2) {
|
|
70
|
-
Environment2["UNKNOWN_ENVIRONMENT"] = "UNKNOWN_ENVIRONMENT";
|
|
71
|
-
Environment2["APP_BUILDER"] = "APP_BUILDER";
|
|
72
|
-
Environment2["STUDIO_2"] = "STUDIO_2";
|
|
73
|
-
})(Environment || (exports2.Environment = Environment = {}));
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
76
|
|
|
@@ -10310,12 +10310,20 @@ var require_CodeGenService = __commonJS({
|
|
|
10310
10310
|
constructor(projectId) {
|
|
10311
10311
|
this.projectId = projectId;
|
|
10312
10312
|
this.accessToken = process.env.WIX_ACCESS_TOKEN;
|
|
10313
|
+
this.sandboxId = process.env.SANDBOX_ID;
|
|
10313
10314
|
this.fetchPendingJobs = async () => {
|
|
10314
10315
|
const resp = await this.httpClient.request((0, http_1.listProjectJobs)({
|
|
10315
10316
|
projectId: this.projectId
|
|
10316
10317
|
}));
|
|
10317
10318
|
const jobs = resp.data?.jobs ?? [];
|
|
10318
|
-
return jobs.filter(
|
|
10319
|
+
return jobs.filter(this.shouldProcessJob);
|
|
10320
|
+
};
|
|
10321
|
+
this.shouldProcessJob = (job) => {
|
|
10322
|
+
if (job.status !== types_1.Status.PENDING)
|
|
10323
|
+
return false;
|
|
10324
|
+
if (this.sandboxId)
|
|
10325
|
+
return job.sandboxId === this.sandboxId;
|
|
10326
|
+
return true;
|
|
10319
10327
|
};
|
|
10320
10328
|
this.markJobAsCompleted = async (jobId) => {
|
|
10321
10329
|
await this.httpClient.request((0, http_1.updateJob)({
|
|
@@ -18038,21 +18046,30 @@ var require_opencode_ask = __commonJS({
|
|
|
18038
18046
|
var ditto_codegen_types_2 = require_dist4();
|
|
18039
18047
|
var context_12 = require_context();
|
|
18040
18048
|
var logger_12 = require_logger();
|
|
18049
|
+
var config_1 = require_config();
|
|
18050
|
+
var biEvents_1 = require_biEvents();
|
|
18041
18051
|
var runOpencodeAskFlow = async (chatHistory) => {
|
|
18042
18052
|
const store = job_context_storage_12.jobContextStorage.getStore();
|
|
18043
18053
|
if (!store?.jobId || !store?.taskId) {
|
|
18044
18054
|
throw new Error("Job context not available - jobId and taskId are required");
|
|
18045
18055
|
}
|
|
18046
|
-
const
|
|
18047
|
-
|
|
18048
|
-
|
|
18056
|
+
const { jobId, taskId, kind } = store;
|
|
18057
|
+
const localJobContext = { jobId, taskId };
|
|
18058
|
+
const biBaseParams = {
|
|
18059
|
+
Job_id: jobId,
|
|
18060
|
+
Task_id: taskId,
|
|
18061
|
+
app_id: context_12.ctx.projectId,
|
|
18062
|
+
Dev_machine_session_id: process.env.CODEGEN_SESSION_ID,
|
|
18063
|
+
run_kind: kind,
|
|
18064
|
+
job_input: JSON.stringify(chatHistory)
|
|
18049
18065
|
};
|
|
18050
|
-
logger_12.logger.info("[OpenCode Ask] Starting task", {
|
|
18051
|
-
|
|
18052
|
-
});
|
|
18053
|
-
|
|
18054
|
-
|
|
18055
|
-
|
|
18066
|
+
logger_12.logger.info("[OpenCode Ask] Starting task", { taskId });
|
|
18067
|
+
await codeGenerationService_12.codeGenerationService.updateTask(jobId, taskId, ditto_codegen_types_12.Status.RUNNING, {});
|
|
18068
|
+
logger_12.logger.info("[OpenCode Ask] Marked task RUNNING", { taskId });
|
|
18069
|
+
(0, biEvents_1.reportSessionStart)({
|
|
18070
|
+
...biBaseParams,
|
|
18071
|
+
Task_model: config_1.DEFAULT_MODEL,
|
|
18072
|
+
Task_type: kind
|
|
18056
18073
|
});
|
|
18057
18074
|
try {
|
|
18058
18075
|
const outputPath = (0, codegen_flow_helpers_12.getOutputPath)();
|
|
@@ -18063,16 +18080,43 @@ var require_opencode_ask = __commonJS({
|
|
|
18063
18080
|
projectId: context_12.ctx.projectId,
|
|
18064
18081
|
chatHistory
|
|
18065
18082
|
});
|
|
18066
|
-
await codeGenerationService_12.codeGenerationService.updateTask(
|
|
18083
|
+
await codeGenerationService_12.codeGenerationService.updateTask(jobId, taskId, ditto_codegen_types_12.Status.COMPLETED, {
|
|
18067
18084
|
taskOutput: {
|
|
18068
18085
|
answer: result.answer
|
|
18069
18086
|
}
|
|
18070
18087
|
});
|
|
18071
|
-
|
|
18088
|
+
(0, biEvents_1.reportSessionEnd)({
|
|
18089
|
+
...biBaseParams,
|
|
18090
|
+
Task_model: config_1.DEFAULT_MODEL,
|
|
18091
|
+
Task_type: kind,
|
|
18092
|
+
Task_cost: Math.round(result.usage.cost * 1e6),
|
|
18093
|
+
Task_status: ditto_codegen_types_12.Status.COMPLETED,
|
|
18094
|
+
Agent_output: JSON.stringify({ answer: result.answer })
|
|
18095
|
+
});
|
|
18096
|
+
logger_12.logger.info("[OpenCode Ask] Completed task", { taskId });
|
|
18072
18097
|
} catch (error) {
|
|
18073
18098
|
const codegenError = (0, ditto_codegen_types_2.toCodegenError)(error);
|
|
18074
18099
|
await (0, codegen_flow_helpers_12.updateParentTaskStatus)(localJobContext, ditto_codegen_types_12.Status.FAILED, codegenError);
|
|
18100
|
+
(0, biEvents_1.reportSessionEnd)({
|
|
18101
|
+
...biBaseParams,
|
|
18102
|
+
Task_model: config_1.DEFAULT_MODEL,
|
|
18103
|
+
Task_type: kind,
|
|
18104
|
+
Task_status: ditto_codegen_types_12.Status.FAILED
|
|
18105
|
+
});
|
|
18106
|
+
(0, biEvents_1.reportSessionError)({
|
|
18107
|
+
...biBaseParams,
|
|
18108
|
+
task_model: config_1.DEFAULT_MODEL,
|
|
18109
|
+
task_type: kind,
|
|
18110
|
+
Agent_output: JSON.stringify(codegenError),
|
|
18111
|
+
Error_desc: codegenError.errorType,
|
|
18112
|
+
error_massage: codegenError.message,
|
|
18113
|
+
error_json: JSON.stringify(codegenError),
|
|
18114
|
+
is_retryable: codegenError.retryable,
|
|
18115
|
+
is_expected: codegenError.expected,
|
|
18116
|
+
validation_type: codegenError.validationType
|
|
18117
|
+
});
|
|
18075
18118
|
logger_12.logger.error("[OpenCode Ask] Failed task", {
|
|
18119
|
+
taskId,
|
|
18076
18120
|
error: error instanceof Error ? error.message : String(error)
|
|
18077
18121
|
});
|
|
18078
18122
|
}
|
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.297",
|
|
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": "8d59424804af593c7815d740ffb2d63bccfc1a551a5bf81c8a306613"
|
|
31
31
|
}
|