@wix/ditto-codegen-public 1.0.359 → 1.0.361

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.
@@ -8,8 +8,7 @@ export default tool({
8
8
  "Pass SCOPE ID format (not human-readable names), e.g. `@wix/data` read → 'SCOPE.DC-DATA.READ', " +
9
9
  "write → 'SCOPE.DC-DATA.WRITE', embedded scripts → 'SCOPE.DC-APPS.MANAGE-EMBEDDED-SCRIPTS'. " +
10
10
  "Only include scope IDs you have explicitly seen in the Wix SDK documentation (via MCP or " +
11
- "loaded skills) — NEVER guess or fabricate them. Omitting a permission is better than " +
12
- "inventing one.",
11
+ "loaded skills) — NEVER guess or fabricate them. If unsure, skip this call entirely.",
13
12
  args: {
14
13
  permissions: tool.schema
15
14
  .array(tool.schema.string())
@@ -0,0 +1,19 @@
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
+ });
package/dist/out.js CHANGED
@@ -10826,7 +10826,7 @@ var require_CodeGenService = __commonJS({
10826
10826
  };
10827
10827
  }
10828
10828
  function toJobOutput(payload) {
10829
- const { requiredPermissions, files, extensions, error, agentMessage, ...rest } = payload;
10829
+ const { requiredPermissions, files, extensions, error, agentMessage, userActions, ...rest } = payload;
10830
10830
  return {
10831
10831
  requiredPermissions,
10832
10832
  files: files?.map((file) => ({
@@ -10844,6 +10844,7 @@ var require_CodeGenService = __commonJS({
10844
10844
  })),
10845
10845
  error: toApiError(error),
10846
10846
  agentMessage,
10847
+ userActions,
10847
10848
  agentOutput: Object.keys(rest).length > 0 ? rest : void 0
10848
10849
  };
10849
10850
  }
@@ -12247,6 +12248,7 @@ TOOL USAGE:
12247
12248
  - \`uuid\` to generate UUIDs (supports count param for multiple). Do NOT use bash.
12248
12249
  - \`wix-generate\` to scaffold extensions non-interactively (wraps \`wix generate --params\`). Prefer it over hand-writing extension boilerplate. It RETURNS the full contents of every file the CLI created, so trust that output and do NOT \`read\`/\`batch-read\` those files afterward. If it returns a \`FAILED\` block, fix the params per the error and retry. Pass an array to scaffold several extensions in one call.
12249
12250
  - \`required-permissions\` to declare the Wix app permissions the generated code needs. Call it ONCE at the end, and ONLY if permissions are actually needed \u2014 don't call it otherwise (see PERMISSIONS).
12251
+ - \`user-actions\` to declare manual steps the user must perform for the app to work. Call it ONCE at the end, and ONLY if there are manual steps \u2014 don't call it otherwise (see USER ACTIONS).
12250
12252
  - File operations \u2014 pick the BATCH tool whenever you have 2+ files; the single-file variants are 5\u201310\xD7 slower:
12251
12253
  - \`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.
12252
12254
  - \`batch-read\` to read N files in one call. NEVER call \`read\` more than once per turn \u2014 use batch-read instead.
@@ -12265,7 +12267,8 @@ IMPLEMENTATION WORKFLOW:
12265
12267
  4. **Register**: Register all extensions in \`src/extensions.ts\`. Include a \`progress\` call (e.g. "Registering extensions").
12266
12268
  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 you added a new dependency to package.json in this iteration; otherwise omit it (node_modules is pre-installed). Include a \`progress\` call (e.g. "Building project").
12267
12269
  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.
12268
- 7. **Stop**: STOP immediately. Do NOT refactor, clean up, or verify.
12270
+ 7. **Declare user actions**: If the user must perform manual steps for the app to work, call \`user-actions\` ONCE with them (see USER ACTIONS below). Skip this step entirely if there are none.
12271
+ 8. **Stop**: STOP immediately. Do NOT refactor, clean up, or verify.
12269
12272
 
12270
12273
  EFFICIENCY:
12271
12274
  - Always prefer the BATCH variant: \`batch-write\` over multiple \`write\`s, \`batch-read\` over multiple \`read\`s, \`multi-edit\` over multiple \`edit\`s.
@@ -12285,9 +12288,32 @@ Use SCOPE ID format (not human-readable names). Examples:
12285
12288
  - \`@wix/data\` read \u2192 "SCOPE.DC-DATA.READ", write \u2192 "SCOPE.DC-DATA.WRITE"
12286
12289
  - Embedded scripts \u2192 "SCOPE.DC-APPS.MANAGE-EMBEDDED-SCRIPTS"
12287
12290
 
12288
- CRITICAL: Only include permissions that you have explicitly seen in the Wix SDK documentation (via MCP or loaded skills). NEVER guess or fabricate permission scope IDs. If you are unsure which permission a feature requires, look it up in the docs first. Omitting a permission is better than inventing one that does not exist.
12291
+ 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.
12289
12292
 
12290
- Example: \`required-permissions({ permissions: ["SCOPE.DC-DATA.READ", "SCOPE.DC-DATA.WRITE"] })\``;
12293
+ Example: \`required-permissions({ permissions: ["SCOPE.DC-DATA.READ", "SCOPE.DC-DATA.WRITE"] })\`
12294
+
12295
+ USER ACTIONS:
12296
+ After the final \`validate\` pass and before you Stop, call the \`user-actions\` tool ONCE ONLY if the app needs the user to perform manual setup for it to ACTUALLY WORK. This includes setup OUTSIDE Wix (third-party API keys, connecting an external account, registering a webhook elsewhere) AND setup 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). If there is no such setup, do NOT call the tool at all.
12297
+ Pass the steps in the \`output\` arg as a single markdown string \u2014 it is rendered directly to the user, so keep it concise and user-facing (a short intro line followed by a bulleted or numbered list). Example:
12298
+ "After installing the app, complete these steps:\\n\\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."
12299
+
12300
+ AUDIENCE \u2014 be explicit about WHO performs each step. Two audiences exist: (1) the APP DEVELOPER (working in Dev Center / the app's own settings), and (2) the SITE OWNER who INSTALLS the app on their site (the merchant with the real Stripe account, their own Wix dashboard, etc.). Most third-party credentials and dashboard setup (their API key, creating a Triggered Email template in their dashboard, configuring an automation) are done by the INSTALLING site owner \u2014 not the developer. When a step is for the installing user, phrase it that way: start it with "After installing the app, \u2026" or "The site owner must \u2026", so it's clear it happens post-install on the installer's site. Use developer-facing phrasing only for steps the developer genuinely performs.
12301
+
12302
+ 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.)
12303
+
12304
+ 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.
12305
+
12306
+ CRITICAL \u2014 NEVER declare anything about permissions or scopes as a user action (e.g. "add SCOPE.DC-STORES.READ-PRODUCTS in Dev Center", "grant the X permission"). Permissions are declared ONLY through the \`required-permissions\` tool and handled by Wix's own flows. A permission/scope step must never appear in user-actions, no matter where it's performed.
12307
+
12308
+ 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.
12309
+
12310
+ Do NOT include the steps Wix already handles through its own flows:
12311
+ - 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.
12312
+ - Releasing a new app version.
12313
+ - Publishing the site.
12314
+ 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).
12315
+
12316
+ Example: \`user-actions({ output: "To finish setting up your app:\\n\\n1. **Add your Stripe secret key** \u2014 open the app settings and paste it." })\``;
12291
12317
  }
12292
12318
  });
12293
12319
 
@@ -12674,6 +12700,7 @@ var require_parser = __commonJS({
12674
12700
  "use strict";
12675
12701
  Object.defineProperty(exports2, "__esModule", { value: true });
12676
12702
  exports2.parseRequiredPermissions = parseRequiredPermissions;
12703
+ exports2.parseUserActions = parseUserActions;
12677
12704
  exports2.parseFilesChanged = parseFilesChanged;
12678
12705
  exports2.parseAnswerText = parseAnswerText;
12679
12706
  exports2.createEmptyUsageStats = createEmptyUsageStats;
@@ -12705,6 +12732,23 @@ var require_parser = __commonJS({
12705
12732
  }
12706
12733
  return permissions;
12707
12734
  }
12735
+ function parseUserActions(output) {
12736
+ let markdown = "";
12737
+ const lines = output.split("\n");
12738
+ for (const line of lines) {
12739
+ if (!line.trim())
12740
+ continue;
12741
+ const event = (0, types_1.tryParseJson)(line);
12742
+ if (!event || event.type !== "tool_use" || event.part?.tool !== "user-actions" || event.part.state?.status !== "completed") {
12743
+ continue;
12744
+ }
12745
+ const declared = event.part.state.input?.output;
12746
+ if (typeof declared !== "string")
12747
+ continue;
12748
+ markdown = declared;
12749
+ }
12750
+ return markdown;
12751
+ }
12708
12752
  function parseFilesChanged(output) {
12709
12753
  const filesChanged = [];
12710
12754
  const seenPaths = /* @__PURE__ */ new Set();
@@ -13167,6 +13211,7 @@ var require_result_builder = __commonJS({
13167
13211
  exitCode: null,
13168
13212
  stdout,
13169
13213
  stderr,
13214
+ userActions: (0, parser_1.parseUserActions)(stdout),
13170
13215
  error: new ditto_codegen_types_12.TimeoutError(message),
13171
13216
  durationMs: Date.now() - startTime,
13172
13217
  requiredPermissions: [],
@@ -13181,6 +13226,7 @@ var require_result_builder = __commonJS({
13181
13226
  exitCode: code,
13182
13227
  stdout,
13183
13228
  stderr,
13229
+ userActions: (0, parser_1.parseUserActions)(stdout),
13184
13230
  error: code !== 0 ? new ditto_codegen_types_12.ProcessExecutionError(`Code generation process exited unexpectedly (exit code ${code})`, {
13185
13231
  processType: ditto_codegen_types_12.ProcessType.EXECUTION,
13186
13232
  exitCode: code ?? void 0,
@@ -13199,6 +13245,7 @@ var require_result_builder = __commonJS({
13199
13245
  exitCode: null,
13200
13246
  stdout,
13201
13247
  stderr,
13248
+ userActions: (0, parser_1.parseUserActions)(stdout),
13202
13249
  error: new ditto_codegen_types_12.ProcessExecutionError(`Failed to start code generation process: ${errorMessage}`, {
13203
13250
  processType: ditto_codegen_types_12.ProcessType.SPAWN,
13204
13251
  stderr
@@ -13346,6 +13393,7 @@ var require_executor = __commonJS({
13346
13393
  if (!isRetryableFailure) {
13347
13394
  const finalResult2 = {
13348
13395
  ...result,
13396
+ userActions: (0, parser_1.parseUserActions)(accumulatedStdout),
13349
13397
  filesChanged: (0, parser_1.parseFilesChanged)(accumulatedStdout),
13350
13398
  usage: accumulatedUsage,
13351
13399
  skillsUsed: accumulatedSkills
@@ -13366,6 +13414,7 @@ var require_executor = __commonJS({
13366
13414
  });
13367
13415
  const finalResult = {
13368
13416
  ...lastResult,
13417
+ userActions: (0, parser_1.parseUserActions)(accumulatedStdout),
13369
13418
  filesChanged: (0, parser_1.parseFilesChanged)(accumulatedStdout),
13370
13419
  usage: accumulatedUsage,
13371
13420
  skillsUsed: Array.from(accumulatedSkills)
@@ -13448,6 +13497,7 @@ var require_executor = __commonJS({
13448
13497
  exitCode: null,
13449
13498
  stdout: state.stdout,
13450
13499
  stderr: state.stderr,
13500
+ userActions: (0, parser_1.parseUserActions)(state.stdout),
13451
13501
  error: new ditto_codegen_types_12.ProcessExecutionError(`Code generation process failed to run: ${error instanceof Error ? error.message : String(error)}`, {
13452
13502
  processType: ditto_codegen_types_12.ProcessType.EXECUTION,
13453
13503
  cause: error
@@ -13748,7 +13798,9 @@ var require_codegen_flow_helpers = __commonJS({
13748
13798
  await codeGenerationService_12.codeGenerationService.updateJob(jobContext.jobId, payload);
13749
13799
  }
13750
13800
  async function updateParentTaskStatus(jobContext, status, error) {
13751
- await codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, jobContext.taskId, status, error ? { error: (0, utils_1.serializeError)(error) } : {});
13801
+ await codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, jobContext.taskId, status, {
13802
+ ...error ? { error: (0, utils_1.serializeError)(error) } : {}
13803
+ });
13752
13804
  }
13753
13805
  function getOutputPath() {
13754
13806
  const outputDir = process.env.OUTPUT_PATH || DEFAULT_OUTPUT_PATH;
@@ -18966,6 +19018,7 @@ var require_opencode_init = __commonJS({
18966
19018
  await (0, inject_created_by_1.injectCreatedByIntoExtensionFiles)(outputPath, extensions.created);
18967
19019
  await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
18968
19020
  requiredPermissions: result.requiredPermissions,
19021
+ userActions: result.userActions,
18969
19022
  files,
18970
19023
  ...agentOutput,
18971
19024
  extensions
@@ -19149,6 +19202,7 @@ var require_opencode_iterate = __commonJS({
19149
19202
  await (0, inject_created_by_1.injectCreatedByIntoExtensionFiles)(outputPath, extensions.created);
19150
19203
  await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
19151
19204
  requiredPermissions: result.requiredPermissions,
19205
+ userActions: result.userActions,
19152
19206
  files,
19153
19207
  ...agentOutput,
19154
19208
  extensions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.359",
3
+ "version": "1.0.361",
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": "359e16ff3223fa5f085d7a83fd81fa8b04c7aa55f5e38602790b2b8f"
32
+ "falconPackageHash": "7b4f927c3fdd53219a51a891cc6b6828c72bd0ebe13e7d33b7da4cd1"
33
33
  }