@wix/ditto-codegen-public 1.0.390 → 1.0.391
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 +14 -85
- package/package.json +2 -2
- package/dist/opencode-tools/user-actions.ts +0 -19
package/dist/out.js
CHANGED
|
@@ -10861,7 +10861,7 @@ var require_CodeGenService = __commonJS({
|
|
|
10861
10861
|
};
|
|
10862
10862
|
}
|
|
10863
10863
|
function toJobOutput(payload) {
|
|
10864
|
-
const { requiredPermissions, files, extensions, error, agentMessage,
|
|
10864
|
+
const { requiredPermissions, files, extensions, error, agentMessage, ...rest } = payload;
|
|
10865
10865
|
return {
|
|
10866
10866
|
requiredPermissions,
|
|
10867
10867
|
files: files?.map((file) => ({
|
|
@@ -10880,7 +10880,6 @@ var require_CodeGenService = __commonJS({
|
|
|
10880
10880
|
})),
|
|
10881
10881
|
error: toApiError(error),
|
|
10882
10882
|
agentMessage,
|
|
10883
|
-
userActions,
|
|
10884
10883
|
agentOutput: Object.keys(rest).length > 0 ? rest : void 0
|
|
10885
10884
|
};
|
|
10886
10885
|
}
|
|
@@ -14355,7 +14354,6 @@ TOOL USAGE:
|
|
|
14355
14354
|
- \`uuid\` to generate UUIDs (supports count param for multiple). Do NOT use bash.
|
|
14356
14355
|
- \`wix-generate\` to scaffold extensions non-interactively \u2014 prefer over hand-writing boilerplate; pass an array to scaffold several at once. It RETURNS every created file's contents, so trust that and do NOT \`read\`/\`batch-read\` them afterward. On a \`FAILED\` block, fix the params per the error and retry.
|
|
14357
14356
|
- \`required-permissions\` \u2014 declare the Wix app permissions the generated code needs (when/whether to call: workflow step 6 + PERMISSIONS).
|
|
14358
|
-
- \`user-actions\` \u2014 declare manual setup steps the user must perform (when/whether to call: workflow step 7 + USER ACTIONS).
|
|
14359
14357
|
- Package dependencies \u2014 \`npm install <pkg>\` any package not already in \`package.json\` BEFORE the first \`validate\` (do NOT wait for \`TS2307\`); install all needed packages in ONE command. Do NOT hand-edit \`package.json\` for deps unless npm cannot be used.
|
|
14360
14358
|
- File operations \u2014 pick the BATCH tool whenever you have 2+ files; the single-file variants are 5\u201310\xD7 slower:
|
|
14361
14359
|
- \`batch-write\` to create N new files in one call. NEVER call \`write\` more than once per turn \u2014 use batch-write instead. \`write\` is reserved for single-file creation.
|
|
@@ -14377,7 +14375,7 @@ IMPLEMENTATION WORKFLOW:
|
|
|
14377
14375
|
4. **Register**: Register all extensions in \`src/extensions.ts\`. Include a \`progress\` call (e.g. "Registering extensions").
|
|
14378
14376
|
5. **Validate**: Run \`validate\` (typecheck only). Fix any errors and re-validate until tsc passes. Include a \`progress\` call (e.g. "Running type checks"). Then run \`validate({ runBuild: true })\` ONCE to verify the build. Pass \`installDeps: true\` ONLY when \`package.json\` changed without already running \`npm install <package-name>\` in this iteration; otherwise omit it (node_modules is pre-installed). Include a \`progress\` call (e.g. "Building project").
|
|
14379
14377
|
6. **Declare permissions**: If the generated code requires Wix app permissions, call \`required-permissions\` ONCE with their SCOPE IDs (see PERMISSIONS below). Skip this step entirely if no permissions are needed.
|
|
14380
|
-
7. **
|
|
14378
|
+
7. **Final message**: Your last message is returned to the user as the codegen output \u2014 keep it short and plain (a sentence or two on what the app now does).
|
|
14381
14379
|
8. **Stop**: STOP immediately. Do NOT refactor, clean up, or verify.
|
|
14382
14380
|
|
|
14383
14381
|
FILE CREATION:
|
|
@@ -14394,25 +14392,7 @@ When you call \`required-permissions\` (see workflow step 6 for when), use SCOPE
|
|
|
14394
14392
|
- Embedded scripts \u2192 "SCOPE.DC-APPS.MANAGE-EMBEDDED-SCRIPTS"
|
|
14395
14393
|
|
|
14396
14394
|
CRITICAL: Only include permissions you have explicitly seen in the Wix SDK documentation (via MCP or loaded skills) \u2014 NEVER guess or infer a scope ID. If you cannot point to where you saw it, do NOT include it. When in doubt, skip the call entirely. A fabricated scope ID will show an error to the user and confuse them; a missing permission is just a warning the user can fix.
|
|
14397
|
-
|
|
14398
|
-
USER ACTIONS:
|
|
14399
|
-
A user action is manual setup the app needs to ACTUALLY WORK \u2014 either OUTSIDE Wix (third-party API keys, connecting an external account, registering a webhook elsewhere) or INSIDE Wix that you could not do in code (e.g. creating a Wix Triggered Email template, configuring a Wix Automation, adding a value in Secrets Manager). (When/whether to call: workflow step 7.)
|
|
14400
|
-
\`output\` is a single markdown string rendered directly to the user: a short intro line + a bulleted/numbered list. FORMAT TIGHTLY \u2014 a SINGLE \`\\n\` between every line (intro\u2192first item AND between items); NEVER blank lines (\`\\n\\n\`), which make the client render each item with extra spacing. Example:
|
|
14401
|
-
"After installing the app, complete these steps:\\n1. **Add your Stripe secret key** \u2014 open the app's settings and paste your Stripe secret key.\\n2. **Create the stock-alert email template** \u2014 in your Wix dashboard, create a Triggered Email template so subscribers receive the alert email."
|
|
14402
|
-
|
|
14403
|
-
AUDIENCE \u2014 say WHO performs each step. Most third-party credentials and dashboard setup (their API key, creating a Triggered Email template, configuring an automation) are done by the SITE OWNER who installs the app, NOT the developer \u2014 phrase those as "After installing the app, \u2026" or "The site owner must \u2026". Use developer-facing phrasing only for steps the developer genuinely performs (in Dev Center / the app's own settings).
|
|
14404
|
-
|
|
14405
|
-
CRITICAL \u2014 a user action is something the USER does in a dashboard, UI, or external system. It is NEVER a coding task. Do NOT ask the user to write, add, or modify code, call an API from the codebase, wire up logic, or "finish" an implementation \u2014 that is YOUR job. If a step can be done in code, you MUST do it now, not declare it. (E.g. if a feature needs to send an email, write the sending code yourself; only the dashboard email-template setup is a user action.)
|
|
14406
|
-
|
|
14407
|
-
CRITICAL \u2014 declare ONLY steps the app REQUIRES to function as built. Do NOT include optional customizations, "for future" tweaks, nice-to-haves, or steps for an alternative path you did not implement. Every action must be mandatory for the app to work.
|
|
14408
|
-
|
|
14409
|
-
If a feature only works once the user does required manual setup (e.g. you logged a notification intent because the actual email needs a Triggered Email template), you MUST declare that step here \u2014 do NOT bury it in prose or leave it unsaid.
|
|
14410
|
-
|
|
14411
|
-
Do NOT include the steps Wix already handles through its own flows:
|
|
14412
|
-
- ANYTHING about permissions or scopes \u2014 adding, granting, enabling, or configuring a permission/scope, whether in Dev Center or the dashboard. These are declared EXCLUSIVELY via the \`required-permissions\` tool.
|
|
14413
|
-
- Releasing a new app version.
|
|
14414
|
-
- Publishing the site.
|
|
14415
|
-
Also do NOT include things you already did in code (created files, registered extensions) or things the app does automatically on install. In particular, a site plugin configured with \`installation: { autoAdd: true }\` is placed on its slot automatically \u2014 NEVER tell the user to add it in the Editor. Only declare manual placement for slots that don't support auto-add (e.g. the checkout page).`;
|
|
14395
|
+
`;
|
|
14416
14396
|
}
|
|
14417
14397
|
});
|
|
14418
14398
|
|
|
@@ -14767,10 +14747,6 @@ var require_config = __commonJS({
|
|
|
14767
14747
|
[
|
|
14768
14748
|
"required-permissions"
|
|
14769
14749
|
/* OpenCodeTool.RequiredPermissions */
|
|
14770
|
-
]: "deny",
|
|
14771
|
-
[
|
|
14772
|
-
"user-actions"
|
|
14773
|
-
/* OpenCodeTool.UserActions */
|
|
14774
14750
|
]: "deny"
|
|
14775
14751
|
};
|
|
14776
14752
|
var ASK_PERMISSIONS = {
|
|
@@ -14874,38 +14850,12 @@ var require_types4 = __commonJS({
|
|
|
14874
14850
|
}
|
|
14875
14851
|
});
|
|
14876
14852
|
|
|
14877
|
-
// dist/opencode-integration/normalize-tool-string.js
|
|
14878
|
-
var require_normalize_tool_string = __commonJS({
|
|
14879
|
-
"dist/opencode-integration/normalize-tool-string.js"(exports2) {
|
|
14880
|
-
"use strict";
|
|
14881
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
14882
|
-
exports2.normalizeToolString = normalizeToolString;
|
|
14883
|
-
function unescapeString(str) {
|
|
14884
|
-
return str.replace(/\\(n|t|r|"|\\)/g, (_, c) => {
|
|
14885
|
-
if (c === "n")
|
|
14886
|
-
return "\n";
|
|
14887
|
-
if (c === "t")
|
|
14888
|
-
return " ";
|
|
14889
|
-
if (c === "r")
|
|
14890
|
-
return "\r";
|
|
14891
|
-
if (c === '"')
|
|
14892
|
-
return '"';
|
|
14893
|
-
return "\\";
|
|
14894
|
-
});
|
|
14895
|
-
}
|
|
14896
|
-
function normalizeToolString(text) {
|
|
14897
|
-
return unescapeString(text).replace(/\r\n/g, "\n");
|
|
14898
|
-
}
|
|
14899
|
-
}
|
|
14900
|
-
});
|
|
14901
|
-
|
|
14902
14853
|
// dist/opencode-integration/parser.js
|
|
14903
14854
|
var require_parser = __commonJS({
|
|
14904
14855
|
"dist/opencode-integration/parser.js"(exports2) {
|
|
14905
14856
|
"use strict";
|
|
14906
14857
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
14907
14858
|
exports2.parseRequiredPermissions = parseRequiredPermissions;
|
|
14908
|
-
exports2.parseUserActions = parseUserActions;
|
|
14909
14859
|
exports2.parseAnswerText = parseAnswerText;
|
|
14910
14860
|
exports2.createEmptyUsageStats = createEmptyUsageStats;
|
|
14911
14861
|
exports2.parseUsageStats = parseUsageStats;
|
|
@@ -14913,10 +14863,6 @@ var require_parser = __commonJS({
|
|
|
14913
14863
|
exports2.hasSessionError = hasSessionError;
|
|
14914
14864
|
exports2.summarizeOpenCodeLine = summarizeOpenCodeLine;
|
|
14915
14865
|
var types_1 = require_types4();
|
|
14916
|
-
var normalize_tool_string_1 = require_normalize_tool_string();
|
|
14917
|
-
function parseEvents(output, type) {
|
|
14918
|
-
return output.split("\n").filter((line) => line.trim()).map((line) => (0, types_1.tryParseJson)(line)).filter((event) => event !== null && event.type === type);
|
|
14919
|
-
}
|
|
14920
14866
|
function parseRequiredPermissions(output) {
|
|
14921
14867
|
let permissions = [];
|
|
14922
14868
|
const lines = output.split("\n");
|
|
@@ -14934,25 +14880,9 @@ var require_parser = __commonJS({
|
|
|
14934
14880
|
}
|
|
14935
14881
|
return permissions;
|
|
14936
14882
|
}
|
|
14937
|
-
function parseUserActions(output) {
|
|
14938
|
-
let markdown = "";
|
|
14939
|
-
const lines = output.split("\n");
|
|
14940
|
-
for (const line of lines) {
|
|
14941
|
-
if (!line.trim())
|
|
14942
|
-
continue;
|
|
14943
|
-
const event = (0, types_1.tryParseJson)(line);
|
|
14944
|
-
if (!event || event.type !== "tool_use" || event.part?.tool !== "user-actions" || event.part.state?.status !== "completed") {
|
|
14945
|
-
continue;
|
|
14946
|
-
}
|
|
14947
|
-
const declared = event.part.state.input?.output;
|
|
14948
|
-
if (typeof declared !== "string")
|
|
14949
|
-
continue;
|
|
14950
|
-
markdown = (0, normalize_tool_string_1.normalizeToolString)(declared);
|
|
14951
|
-
}
|
|
14952
|
-
return markdown;
|
|
14953
|
-
}
|
|
14954
14883
|
function parseAnswerText(output) {
|
|
14955
|
-
|
|
14884
|
+
const messages = output.split("\n").map((line) => (0, types_1.tryParseJson)(line)).filter((event) => event?.type === "text").map((event) => event.part?.text ?? "");
|
|
14885
|
+
return (messages[messages.length - 1] ?? "").trim();
|
|
14956
14886
|
}
|
|
14957
14887
|
function createEmptyUsageStats() {
|
|
14958
14888
|
return {
|
|
@@ -15461,7 +15391,7 @@ var require_result_builder = __commonJS({
|
|
|
15461
15391
|
exitCode: null,
|
|
15462
15392
|
stdout,
|
|
15463
15393
|
stderr,
|
|
15464
|
-
|
|
15394
|
+
agentMessage: (0, parser_1.parseAnswerText)(stdout),
|
|
15465
15395
|
error: new ditto_codegen_types_12.TimeoutError(message),
|
|
15466
15396
|
durationMs: Date.now() - startTime,
|
|
15467
15397
|
requiredPermissions: [],
|
|
@@ -15475,7 +15405,7 @@ var require_result_builder = __commonJS({
|
|
|
15475
15405
|
exitCode: code,
|
|
15476
15406
|
stdout,
|
|
15477
15407
|
stderr,
|
|
15478
|
-
|
|
15408
|
+
agentMessage: (0, parser_1.parseAnswerText)(stdout),
|
|
15479
15409
|
error: code !== 0 ? new ditto_codegen_types_12.ProcessExecutionError(`Code generation process exited unexpectedly (exit code ${code})`, {
|
|
15480
15410
|
processType: ditto_codegen_types_12.ProcessType.EXECUTION,
|
|
15481
15411
|
exitCode: code ?? void 0,
|
|
@@ -15493,7 +15423,7 @@ var require_result_builder = __commonJS({
|
|
|
15493
15423
|
exitCode: null,
|
|
15494
15424
|
stdout,
|
|
15495
15425
|
stderr,
|
|
15496
|
-
|
|
15426
|
+
agentMessage: (0, parser_1.parseAnswerText)(stdout),
|
|
15497
15427
|
error: new ditto_codegen_types_12.ProcessExecutionError(`Failed to start code generation process: ${errorMessage}`, {
|
|
15498
15428
|
processType: ditto_codegen_types_12.ProcessType.SPAWN,
|
|
15499
15429
|
stderr
|
|
@@ -15618,7 +15548,6 @@ var require_executor = __commonJS({
|
|
|
15618
15548
|
var MAX_RETRIES = 5;
|
|
15619
15549
|
async function executeOpenCode(options) {
|
|
15620
15550
|
let lastResult = null;
|
|
15621
|
-
let accumulatedStdout = "";
|
|
15622
15551
|
let accumulatedUsage = (0, parser_1.createEmptyUsageStats)();
|
|
15623
15552
|
const accumulatedSkills = [];
|
|
15624
15553
|
let currentPrompt = options.prompt;
|
|
@@ -15631,7 +15560,6 @@ var require_executor = __commonJS({
|
|
|
15631
15560
|
continueSession = false;
|
|
15632
15561
|
}
|
|
15633
15562
|
const result = await executeOpenCodeOnce({ ...options, prompt: currentPrompt, continueSession }, attempt);
|
|
15634
|
-
accumulatedStdout += result.stdout;
|
|
15635
15563
|
accumulatedUsage = (0, parser_1.mergeUsageStats)(accumulatedUsage, result.usage);
|
|
15636
15564
|
accumulatedSkills.push(...result.skillsUsed);
|
|
15637
15565
|
const errorMsg = result.error?.message.toLowerCase() ?? "";
|
|
@@ -15641,7 +15569,7 @@ var require_executor = __commonJS({
|
|
|
15641
15569
|
if (!isRetryableFailure) {
|
|
15642
15570
|
const finalResult2 = {
|
|
15643
15571
|
...result,
|
|
15644
|
-
|
|
15572
|
+
agentMessage: (0, parser_1.parseAnswerText)(result.stdout),
|
|
15645
15573
|
usage: accumulatedUsage,
|
|
15646
15574
|
skillsUsed: accumulatedSkills
|
|
15647
15575
|
};
|
|
@@ -15661,7 +15589,7 @@ var require_executor = __commonJS({
|
|
|
15661
15589
|
});
|
|
15662
15590
|
const finalResult = {
|
|
15663
15591
|
...lastResult,
|
|
15664
|
-
|
|
15592
|
+
agentMessage: (0, parser_1.parseAnswerText)(lastResult.stdout),
|
|
15665
15593
|
usage: accumulatedUsage,
|
|
15666
15594
|
skillsUsed: Array.from(accumulatedSkills)
|
|
15667
15595
|
};
|
|
@@ -15741,7 +15669,7 @@ var require_executor = __commonJS({
|
|
|
15741
15669
|
exitCode: null,
|
|
15742
15670
|
stdout: state.stdout,
|
|
15743
15671
|
stderr: state.stderr,
|
|
15744
|
-
|
|
15672
|
+
agentMessage: (0, parser_1.parseAnswerText)(state.stdout),
|
|
15745
15673
|
error: new ditto_codegen_types_12.ProcessExecutionError(`Code generation process failed to run: ${error instanceof Error ? error.message : String(error)}`, {
|
|
15746
15674
|
processType: ditto_codegen_types_12.ProcessType.EXECUTION,
|
|
15747
15675
|
cause: error
|
|
@@ -21258,7 +21186,7 @@ var require_opencode_init = __commonJS({
|
|
|
21258
21186
|
await (0, inject_created_by_1.injectCreatedByIntoExtensionFiles)(outputPath, extensions.created);
|
|
21259
21187
|
await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
|
|
21260
21188
|
requiredPermissions: result.requiredPermissions,
|
|
21261
|
-
|
|
21189
|
+
agentMessage: result.agentMessage,
|
|
21262
21190
|
files,
|
|
21263
21191
|
...agentOutput,
|
|
21264
21192
|
extensions
|
|
@@ -21448,7 +21376,7 @@ var require_opencode_iterate = __commonJS({
|
|
|
21448
21376
|
await (0, inject_created_by_1.injectCreatedByIntoExtensionFiles)(outputPath, extensions.created);
|
|
21449
21377
|
await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
|
|
21450
21378
|
requiredPermissions: result.requiredPermissions,
|
|
21451
|
-
|
|
21379
|
+
agentMessage: result.agentMessage,
|
|
21452
21380
|
files,
|
|
21453
21381
|
...agentOutput,
|
|
21454
21382
|
extensions
|
|
@@ -21809,6 +21737,7 @@ var require_opencode_fix_git_conflicts = __commonJS({
|
|
|
21809
21737
|
const extensions = await (0, collect_extensions_created_1.buildExtensionsJobPayload)(outputPath, files);
|
|
21810
21738
|
await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
|
|
21811
21739
|
requiredPermissions: result.requiredPermissions,
|
|
21740
|
+
agentMessage: result.agentMessage,
|
|
21812
21741
|
files,
|
|
21813
21742
|
extensions
|
|
21814
21743
|
});
|
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.391",
|
|
4
4
|
"description": "AI-powered Wix CLI app generator - standalone executable",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "node build.mjs",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"esbuild": "^0.27.2",
|
|
30
30
|
"vitest": "^4.0.16"
|
|
31
31
|
},
|
|
32
|
-
"falconPackageHash": "
|
|
32
|
+
"falconPackageHash": "ffaf520e25dae6b0db9450f128f6eedcf0cd611df74594a0e682a01c"
|
|
33
33
|
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { tool } from "@opencode-ai/plugin";
|
|
2
|
-
|
|
3
|
-
export default tool({
|
|
4
|
-
description:
|
|
5
|
-
"Declare the manual setup steps the user must perform for the generated app to " +
|
|
6
|
-
"work, as a single markdown string. Call once at the end, only if such setup is " +
|
|
7
|
-
"required.",
|
|
8
|
-
args: {
|
|
9
|
-
output: tool.schema
|
|
10
|
-
.string()
|
|
11
|
-
.describe(
|
|
12
|
-
"The setup steps, as markdown (a short intro line followed by a bulleted or " +
|
|
13
|
-
"numbered list). Rendered directly to the user.",
|
|
14
|
-
),
|
|
15
|
-
},
|
|
16
|
-
async execute(args) {
|
|
17
|
-
return `✓ recorded user actions (${args.output.length} chars)`;
|
|
18
|
-
},
|
|
19
|
-
});
|