@wix/ditto-codegen-public 1.0.360 → 1.0.362

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.
@@ -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.
@@ -12287,7 +12290,30 @@ Use SCOPE ID format (not human-readable names). Examples:
12287
12290
 
12288
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
 
@@ -12668,12 +12694,38 @@ var require_internal_paths = __commonJS({
12668
12694
  }
12669
12695
  });
12670
12696
 
12697
+ // dist/opencode-integration/normalize-tool-string.js
12698
+ var require_normalize_tool_string = __commonJS({
12699
+ "dist/opencode-integration/normalize-tool-string.js"(exports2) {
12700
+ "use strict";
12701
+ Object.defineProperty(exports2, "__esModule", { value: true });
12702
+ exports2.normalizeToolString = normalizeToolString;
12703
+ function unescapeString(str) {
12704
+ return str.replace(/\\(n|t|r|"|\\)/g, (_, c) => {
12705
+ if (c === "n")
12706
+ return "\n";
12707
+ if (c === "t")
12708
+ return " ";
12709
+ if (c === "r")
12710
+ return "\r";
12711
+ if (c === '"')
12712
+ return '"';
12713
+ return "\\";
12714
+ });
12715
+ }
12716
+ function normalizeToolString(text) {
12717
+ return unescapeString(text).replace(/\r\n/g, "\n");
12718
+ }
12719
+ }
12720
+ });
12721
+
12671
12722
  // dist/opencode-integration/parser.js
12672
12723
  var require_parser = __commonJS({
12673
12724
  "dist/opencode-integration/parser.js"(exports2) {
12674
12725
  "use strict";
12675
12726
  Object.defineProperty(exports2, "__esModule", { value: true });
12676
12727
  exports2.parseRequiredPermissions = parseRequiredPermissions;
12728
+ exports2.parseUserActions = parseUserActions;
12677
12729
  exports2.parseFilesChanged = parseFilesChanged;
12678
12730
  exports2.parseAnswerText = parseAnswerText;
12679
12731
  exports2.createEmptyUsageStats = createEmptyUsageStats;
@@ -12685,6 +12737,7 @@ var require_parser = __commonJS({
12685
12737
  var types_1 = require_types4();
12686
12738
  var constants_1 = require_constants5();
12687
12739
  var internal_paths_1 = require_internal_paths();
12740
+ var normalize_tool_string_1 = require_normalize_tool_string();
12688
12741
  function parseEvents(output, type) {
12689
12742
  return output.split("\n").filter((line) => line.trim()).map((line) => (0, types_1.tryParseJson)(line)).filter((event) => event !== null && event.type === type);
12690
12743
  }
@@ -12705,6 +12758,23 @@ var require_parser = __commonJS({
12705
12758
  }
12706
12759
  return permissions;
12707
12760
  }
12761
+ function parseUserActions(output) {
12762
+ let markdown = "";
12763
+ const lines = output.split("\n");
12764
+ for (const line of lines) {
12765
+ if (!line.trim())
12766
+ continue;
12767
+ const event = (0, types_1.tryParseJson)(line);
12768
+ if (!event || event.type !== "tool_use" || event.part?.tool !== "user-actions" || event.part.state?.status !== "completed") {
12769
+ continue;
12770
+ }
12771
+ const declared = event.part.state.input?.output;
12772
+ if (typeof declared !== "string")
12773
+ continue;
12774
+ markdown = (0, normalize_tool_string_1.normalizeToolString)(declared);
12775
+ }
12776
+ return markdown;
12777
+ }
12708
12778
  function parseFilesChanged(output) {
12709
12779
  const filesChanged = [];
12710
12780
  const seenPaths = /* @__PURE__ */ new Set();
@@ -13167,6 +13237,7 @@ var require_result_builder = __commonJS({
13167
13237
  exitCode: null,
13168
13238
  stdout,
13169
13239
  stderr,
13240
+ userActions: (0, parser_1.parseUserActions)(stdout),
13170
13241
  error: new ditto_codegen_types_12.TimeoutError(message),
13171
13242
  durationMs: Date.now() - startTime,
13172
13243
  requiredPermissions: [],
@@ -13181,6 +13252,7 @@ var require_result_builder = __commonJS({
13181
13252
  exitCode: code,
13182
13253
  stdout,
13183
13254
  stderr,
13255
+ userActions: (0, parser_1.parseUserActions)(stdout),
13184
13256
  error: code !== 0 ? new ditto_codegen_types_12.ProcessExecutionError(`Code generation process exited unexpectedly (exit code ${code})`, {
13185
13257
  processType: ditto_codegen_types_12.ProcessType.EXECUTION,
13186
13258
  exitCode: code ?? void 0,
@@ -13199,6 +13271,7 @@ var require_result_builder = __commonJS({
13199
13271
  exitCode: null,
13200
13272
  stdout,
13201
13273
  stderr,
13274
+ userActions: (0, parser_1.parseUserActions)(stdout),
13202
13275
  error: new ditto_codegen_types_12.ProcessExecutionError(`Failed to start code generation process: ${errorMessage}`, {
13203
13276
  processType: ditto_codegen_types_12.ProcessType.SPAWN,
13204
13277
  stderr
@@ -13346,6 +13419,7 @@ var require_executor = __commonJS({
13346
13419
  if (!isRetryableFailure) {
13347
13420
  const finalResult2 = {
13348
13421
  ...result,
13422
+ userActions: (0, parser_1.parseUserActions)(accumulatedStdout),
13349
13423
  filesChanged: (0, parser_1.parseFilesChanged)(accumulatedStdout),
13350
13424
  usage: accumulatedUsage,
13351
13425
  skillsUsed: accumulatedSkills
@@ -13366,6 +13440,7 @@ var require_executor = __commonJS({
13366
13440
  });
13367
13441
  const finalResult = {
13368
13442
  ...lastResult,
13443
+ userActions: (0, parser_1.parseUserActions)(accumulatedStdout),
13369
13444
  filesChanged: (0, parser_1.parseFilesChanged)(accumulatedStdout),
13370
13445
  usage: accumulatedUsage,
13371
13446
  skillsUsed: Array.from(accumulatedSkills)
@@ -13448,6 +13523,7 @@ var require_executor = __commonJS({
13448
13523
  exitCode: null,
13449
13524
  stdout: state.stdout,
13450
13525
  stderr: state.stderr,
13526
+ userActions: (0, parser_1.parseUserActions)(state.stdout),
13451
13527
  error: new ditto_codegen_types_12.ProcessExecutionError(`Code generation process failed to run: ${error instanceof Error ? error.message : String(error)}`, {
13452
13528
  processType: ditto_codegen_types_12.ProcessType.EXECUTION,
13453
13529
  cause: error
@@ -13748,7 +13824,9 @@ var require_codegen_flow_helpers = __commonJS({
13748
13824
  await codeGenerationService_12.codeGenerationService.updateJob(jobContext.jobId, payload);
13749
13825
  }
13750
13826
  async function updateParentTaskStatus(jobContext, status, error) {
13751
- await codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, jobContext.taskId, status, error ? { error: (0, utils_1.serializeError)(error) } : {});
13827
+ await codeGenerationService_12.codeGenerationService.updateTask(jobContext.jobId, jobContext.taskId, status, {
13828
+ ...error ? { error: (0, utils_1.serializeError)(error) } : {}
13829
+ });
13752
13830
  }
13753
13831
  function getOutputPath() {
13754
13832
  const outputDir = process.env.OUTPUT_PATH || DEFAULT_OUTPUT_PATH;
@@ -18966,6 +19044,7 @@ var require_opencode_init = __commonJS({
18966
19044
  await (0, inject_created_by_1.injectCreatedByIntoExtensionFiles)(outputPath, extensions.created);
18967
19045
  await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
18968
19046
  requiredPermissions: result.requiredPermissions,
19047
+ userActions: result.userActions,
18969
19048
  files,
18970
19049
  ...agentOutput,
18971
19050
  extensions
@@ -19149,6 +19228,7 @@ var require_opencode_iterate = __commonJS({
19149
19228
  await (0, inject_created_by_1.injectCreatedByIntoExtensionFiles)(outputPath, extensions.created);
19150
19229
  await (0, codegen_flow_helpers_12.updateJobPayload)(localJobContext, {
19151
19230
  requiredPermissions: result.requiredPermissions,
19231
+ userActions: result.userActions,
19152
19232
  files,
19153
19233
  ...agentOutput,
19154
19234
  extensions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.360",
3
+ "version": "1.0.362",
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": "638525404cd181b8d164c2da040e677af90272016e2635526ffb488c"
32
+ "falconPackageHash": "17c320c3fae4886b3e20248ff6adb58607f4d0e2e93af6aa054a5928"
33
33
  }