@wix/ditto-codegen-public 1.0.463 → 1.0.465

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,91 @@
1
+ import { execFile } from "child_process";
2
+ import { promisify } from "util";
3
+ import { tool } from "@opencode-ai/plugin";
4
+
5
+ const execFileAsync = promisify(execFile);
6
+
7
+ // The endpoint behind @wix/mcp's SupportAndFeedback tool, which the local
8
+ // stdio @wix/mcp doesn't register. Relays to the #mcp-user-feedback Slack
9
+ // channel, attributed to the token's user.
10
+ const FEEDBACK_API_URL = "https://www.wixapis.com/mcp-serverless/v1/feedback";
11
+ const FEEDBACK_TIMEOUT_MS = 15_000;
12
+
13
+ async function getWixAccessToken(): Promise<string> {
14
+ const { stdout } = await execFileAsync("wix", ["token", "--json"], {
15
+ timeout: 30_000,
16
+ });
17
+ const { accessToken } = JSON.parse(stdout) as { accessToken?: string };
18
+ if (!accessToken) {
19
+ throw new Error("wix token returned empty accessToken");
20
+ }
21
+ return accessToken;
22
+ }
23
+
24
+ function buildProvenance(): string {
25
+ const lines = [
26
+ `Source: Codegen running on ${process.env.CODEGEN_ENVIRONMENT ?? "unknown environment"}`,
27
+ process.env.CODEGEN_JOB_ID && `Codegen job id: ${process.env.CODEGEN_JOB_ID}`,
28
+ process.env.CODEGEN_PROJECT_ID &&
29
+ `Project id: ${process.env.CODEGEN_PROJECT_ID}`,
30
+ process.env.CODEGEN_METASITE_ID &&
31
+ `Meta site id: ${process.env.CODEGEN_METASITE_ID}`,
32
+ ];
33
+ return lines.filter(Boolean).join("\n");
34
+ }
35
+
36
+ export default tool({
37
+ description:
38
+ "Report a problem with Wix docs or the wix-mcp tools to the Wix MCP team. Call it when " +
39
+ "docs or MCP — not your own code — made the task harder: a search whose top results were " +
40
+ "off-target, an article or example that is wrong or missing the fields you needed, a " +
41
+ "method schema that doesn't match the installed SDK types, or an MCP tool error. Include " +
42
+ "cases you recovered from. Do NOT report your own mistakes or the user's request. Call it " +
43
+ "at most ONCE per task, covering every friction point you've hit so far.",
44
+ args: {
45
+ message: tool.schema
46
+ .string()
47
+ .min(1)
48
+ .describe(
49
+ "Plain-text report. For each friction point: the tool and exact input (search " +
50
+ "term, docs URL), what came back, what was wrong or missing, the workaround you " +
51
+ "used, and what you expected. Then your best guess of where the fault lives " +
52
+ "(search ranking / docs article or example / method schema / SDK typings / MCP " +
53
+ "tool) and whether you confirmed it. End with one line naming the most important " +
54
+ "problem. No secrets or tokens.",
55
+ ),
56
+ requestId: tool.schema
57
+ .string()
58
+ .optional()
59
+ .describe(
60
+ "x-wix-request-id of a failed Wix API call this report relates to, if any.",
61
+ ),
62
+ },
63
+ async execute(args) {
64
+ const message = [
65
+ buildProvenance(),
66
+ args.message,
67
+ args.requestId && `request id: ${args.requestId}`,
68
+ ]
69
+ .filter(Boolean)
70
+ .join("\n\n");
71
+
72
+ try {
73
+ const response = await fetch(FEEDBACK_API_URL, {
74
+ method: "POST",
75
+ headers: {
76
+ Authorization: await getWixAccessToken(),
77
+ "Content-Type": "application/json",
78
+ },
79
+ body: JSON.stringify({ message }),
80
+ signal: AbortSignal.timeout(FEEDBACK_TIMEOUT_MS),
81
+ });
82
+ if (!response.ok) {
83
+ return `Failed to send the report (HTTP ${response.status}). Continue your task — do not retry.`;
84
+ }
85
+ return "Report sent to the Wix MCP team. Continue your task.";
86
+ } catch (error) {
87
+ const reason = error instanceof Error ? error.message : String(error);
88
+ return `Failed to send the report (${reason}). Continue your task — do not retry.`;
89
+ }
90
+ },
91
+ });
package/dist/out.js CHANGED
@@ -11298,13 +11298,6 @@ var require_CodeGenService = __commonJS({
11298
11298
  metasiteId: ctx.metasiteId ?? "",
11299
11299
  durationMs: ctx.durationMs != null ? String(ctx.durationMs) : void 0
11300
11300
  });
11301
- this.handleValidationErrors = async (output, context = {}) => {
11302
- await this.request((0, http_1.handleValidationErrors)({
11303
- output,
11304
- costUsd: context.costUsd,
11305
- ...this.runContext(context)
11306
- }));
11307
- };
11308
11301
  this.handlePluginFailure = async (input) => {
11309
11302
  await this.request((0, http_1.handlePluginFailure)({
11310
11303
  pluginName: input.pluginName,
@@ -11726,6 +11719,7 @@ var require_model_knobs = __commonJS({
11726
11719
  exports2.getSmallModel = getSmallModel;
11727
11720
  exports2.hasModelOverride = hasModelOverride;
11728
11721
  exports2.hasSmallModelOverride = hasSmallModelOverride;
11722
+ exports2.readEnumEnv = readEnumEnv;
11729
11723
  exports2.getReasoningEffort = getReasoningEffort;
11730
11724
  exports2.getSmallReasoningEffort = getSmallReasoningEffort;
11731
11725
  exports2.hasSmallReasoningEffortOverride = hasSmallReasoningEffortOverride;
@@ -11823,7 +11817,7 @@ var require_subagents = __commonJS({
11823
11817
  "dist/opencode-integration/configuration/subagents.js"(exports2) {
11824
11818
  "use strict";
11825
11819
  Object.defineProperty(exports2, "__esModule", { value: true });
11826
- exports2.SUBAGENT_AGENT_NAMES = exports2.WDS_DOCS_SUBAGENT_NAME = exports2.WIX_DOCS_SUBAGENT_NAME = exports2.VALIDATOR_SUBAGENT_NAME = exports2.PRIMARY_AGENT_NAME = void 0;
11820
+ exports2.SUBAGENT_AGENT_NAMES = exports2.VALIDATOR_SUBAGENT_NAME = exports2.PRIMARY_AGENT_NAME = void 0;
11827
11821
  exports2.getAgentConfig = getAgentConfig;
11828
11822
  exports2.getMainAgentModel = getMainAgentModel;
11829
11823
  exports2.getSubagentModel = getSubagentModel;
@@ -11832,13 +11826,7 @@ var require_subagents = __commonJS({
11832
11826
  var model_knobs_1 = require_model_knobs();
11833
11827
  exports2.PRIMARY_AGENT_NAME = "codegen";
11834
11828
  exports2.VALIDATOR_SUBAGENT_NAME = "codegen-validator";
11835
- exports2.WIX_DOCS_SUBAGENT_NAME = "codegen-wix-docs";
11836
- exports2.WDS_DOCS_SUBAGENT_NAME = "codegen-wds-docs";
11837
- exports2.SUBAGENT_AGENT_NAMES = [
11838
- exports2.VALIDATOR_SUBAGENT_NAME,
11839
- exports2.WIX_DOCS_SUBAGENT_NAME,
11840
- exports2.WDS_DOCS_SUBAGENT_NAME
11841
- ];
11829
+ exports2.SUBAGENT_AGENT_NAMES = [exports2.VALIDATOR_SUBAGENT_NAME];
11842
11830
  var VALIDATOR_DESCRIPTION = `Runs validate (tsc + wix build) and fixes the reported errors, consulting the
11843
11831
  skills or wix-mcp for SDK-shape errors; returns when the build is clean
11844
11832
  or reports what it couldn't fix. Validation step only \u2014 never generates features.`;
@@ -11865,42 +11853,7 @@ unfixed. Work in a bounded number of fix cycles \u2014 if the build isn't conver
11865
11853
  after a few attempts, STOP and return the remaining errors verbatim rather than
11866
11854
  looping; never silence them.
11867
11855
 
11868
- When done, if you fixed any errors or any remain unfixed, write NEEDS_INVESTIGATION
11869
- as the very first line of your response (before the summary).
11870
- Then summarize each error: message, file, root cause, fix. No diffs.
11871
- (NEEDS_INVESTIGATION triggers a team alert to improve codegen for future runs.)`;
11872
- var WIX_DOCS_DESCRIPTION = `Use ONLY to discover a Wix SDK you don't know and that the skills +
11873
- KNOWN WIX APIS don't cover. Send ONE complete question; returns the import path
11874
- + exported namespace/method + runtime context + full signature + any required
11875
- scope/permission IDs + any user setup prerequisites (dependent app to install,
11876
- dashboard setting to enable, template to create) + a short usage example (not a
11877
- link). Don't fetch a doc you already identified, and don't split a lookup into
11878
- separate search/signature calls. Read-only.`;
11879
- var WIX_DOCS_PROMPT = `You research Wix SDK APIs via wix-mcp and report back \u2014 never write app code.
11880
- The caller uses DIRECT imports inside an extension that already supplies
11881
- auth/host: 'import { <namespace> } from "@wix/<pkg>"; await <namespace>.<method>(<optionsObject>)'
11882
- \u2014 describe that form, NEVER a 'createClient'/'wixClient' client. Report the SDK,
11883
- NOT the REST spec: REST names, namespaces, and positional params often differ,
11884
- so verify the method EXISTS as an SDK export. Steps: (1) read the SDK
11885
- introduction ('SearchWixSDKDocumentation' \u2192 'ReadFullDocsArticle') to confirm
11886
- it's the RIGHT API and its runtime context \u2014 backend, the dashboard host, or the
11887
- site/editor host (host modules like @wix/dashboard work ONLY in their own host);
11888
- (2) read 'ReadFullDocsMethodSchema' for the exact exported name and its
11889
- options-object parameters; (3) capture any user SETUP prerequisites the docs
11890
- call out (often a 'Before you begin' section) \u2014 a dependent app that must be
11891
- installed (e.g. Wix Stores, Members Area), a dashboard setting that must be
11892
- enabled (e.g. Automations for back-in-stock notifications), or a template/config
11893
- the user must create first (e.g. a triggered email). Reply with: the import path
11894
- + exported namespace/method, the runtime context, the full TypeScript signature,
11895
- a short usage example \u2014 never a bare link, never 'as any' or a guessed method \u2014
11896
- and a SETUP STEPS list of the prerequisites from (3) so the main agent can relay
11897
- them to the user (say 'none' if there are none). If the API is limited to one
11898
- context, say so. For a required scope/permission, return the EXACT scope-ID
11899
- string from the docs (never a guessed format); if none is documented, say so.`;
11900
- var WDS_DOCS_DESCRIPTION = `Use ONLY when building dashboard UI and you need a Wix Design System
11901
- component/prop/example you don't know and the skills don't cover.
11902
- Returns the component name + props + a short usage example. Not for layouts the
11903
- skills already cover. Read-only.`;
11856
+ When done, summarize each error: message, file, root cause, fix. No diffs.`;
11904
11857
  var SUBAGENT_DENIED_TOOLS = {
11905
11858
  [
11906
11859
  "task"
@@ -11925,29 +11878,10 @@ skills already cover. Read-only.`;
11925
11878
  [
11926
11879
  "required-permissions"
11927
11880
  /* OpenCodeTool.RequiredPermissions */
11928
- ]: "deny"
11929
- };
11930
- var DOCS_SUBAGENT_DENIED_TOOLS = {
11931
- ...SUBAGENT_DENIED_TOOLS,
11932
- [
11933
- "edit"
11934
- /* OpenCodeTool.Edit */
11935
- ]: "deny",
11936
- [
11937
- "write"
11938
- /* OpenCodeTool.Write */
11939
- ]: "deny",
11940
- [
11941
- "batch-write"
11942
- /* OpenCodeTool.BatchWrite */
11943
- ]: "deny",
11944
- [
11945
- "multi-edit"
11946
- /* OpenCodeTool.MultiEdit */
11947
11881
  ]: "deny",
11948
11882
  [
11949
- "validate"
11950
- /* OpenCodeTool.Validate */
11883
+ "report-wix-feedback"
11884
+ /* OpenCodeTool.ReportWixFeedback */
11951
11885
  ]: "deny"
11952
11886
  };
11953
11887
  var READ_TOOLS = {
@@ -12015,9 +11949,7 @@ skills already cover. Read-only.`;
12015
11949
  /* OpenCodeTool.Task */
12016
11950
  ]: {
12017
11951
  [types_1.PERMISSION_WILDCARD]: "deny",
12018
- [exports2.VALIDATOR_SUBAGENT_NAME]: "allow",
12019
- [exports2.WIX_DOCS_SUBAGENT_NAME]: "allow",
12020
- [exports2.WDS_DOCS_SUBAGENT_NAME]: "allow"
11952
+ [exports2.VALIDATOR_SUBAGENT_NAME]: "allow"
12021
11953
  }
12022
11954
  }
12023
11955
  },
@@ -12046,46 +11978,6 @@ skills already cover. Read-only.`;
12046
11978
  ]: "allow",
12047
11979
  [constants_1.WIX_MCP_SERVER_NAME]: "allow"
12048
11980
  }
12049
- },
12050
- [exports2.WIX_DOCS_SUBAGENT_NAME]: {
12051
- mode: "subagent",
12052
- ...subagent,
12053
- steps: 15,
12054
- description: WIX_DOCS_DESCRIPTION,
12055
- prompt: WIX_DOCS_PROMPT,
12056
- permission: {
12057
- ...DOCS_SUBAGENT_DENIED_TOOLS,
12058
- ...READ_TOOLS,
12059
- [
12060
- "bash"
12061
- /* OpenCodeTool.Bash */
12062
- ]: "deny",
12063
- [
12064
- "skill"
12065
- /* OpenCodeTool.Skill */
12066
- ]: "allow",
12067
- [constants_1.WIX_MCP_SERVER_NAME]: "allow"
12068
- }
12069
- },
12070
- [exports2.WDS_DOCS_SUBAGENT_NAME]: {
12071
- mode: "subagent",
12072
- ...subagent,
12073
- steps: 15,
12074
- description: WDS_DOCS_DESCRIPTION,
12075
- permission: {
12076
- ...DOCS_SUBAGENT_DENIED_TOOLS,
12077
- ...READ_TOOLS,
12078
- // The wix-design-system skill shells out to a script, so bash is needed.
12079
- [
12080
- "bash"
12081
- /* OpenCodeTool.Bash */
12082
- ]: "allow",
12083
- [
12084
- "skill"
12085
- /* OpenCodeTool.Skill */
12086
- ]: "allow",
12087
- [constants_1.WIX_MCP_SERVER_NAME]: "deny"
12088
- }
12089
11981
  }
12090
11982
  };
12091
11983
  }
@@ -15035,7 +14927,16 @@ var require_codegen_rules = __commonJS({
15035
14927
  Object.defineProperty(exports2, "__esModule", { value: true });
15036
14928
  exports2.buildCodegenRules = buildCodegenRules;
15037
14929
  var shared_rules_1 = require_shared_rules();
15038
- var CODEGEN_CORE_RULES = `CORE PRINCIPLES:
14930
+ var model_knobs_1 = require_model_knobs();
14931
+ var DELEGATED_VALIDATION = {
14932
+ toolRule: "- `validate` (tsc + build) is run by the `codegen-validator` subagent \u2014 do NOT call it directly; delegate via `task` at step 5.",
14933
+ step: `5. **Validate**: Dispatch ONE \`task({ subagent: "codegen-validator", prompt: "Run validate({ runBuild: true }) \u2014 it typechecks AND builds in a single pass (tsc runs first and fails fast before the build). Fix any errors and re-run until it passes. Pass installDeps: true only if package.json changed and npm install was not already run in this session." })\`. Wait for the subagent to return. Do NOT call \`validate\` directly from the primary agent, and do NOT make a separate tsc-only call first \u2014 the single runBuild pass already fails fast on type errors. VERIFY the subagent actually FINISHED with a clean build: read its returned summary and confirm it converged. If it reports remaining/unresolved errors or was cut off before finishing (e.g. "Maximum steps reached"), do NOT treat it as success \u2014 re-dispatch \`codegen-validator\` to finish the remaining errors before moving on. After the validator confirms a clean build, if you created or modified an EDITOR_REACT_COMPONENT extension in this task, run \`npx wix generate manifest\` via bash (the validator is instructed not to run it, so this is the only run).`
14934
+ };
14935
+ var DIRECT_VALIDATION = {
14936
+ toolRule: "- `validate` (tsc + build) \u2014 you call it yourself at step 5. Do NOT delegate it.",
14937
+ step: `5. **Validate**: Call \`validate({ runBuild: true })\` yourself \u2014 it typechecks AND builds in a single pass (tsc runs first and fails fast before the build). Fix any errors and re-run until it passes. Pass installDeps: true only if package.json changed and npm install was not already run in this session. Do NOT delegate this to a subagent, and do NOT make a separate tsc-only call first \u2014 the single runBuild pass already fails fast on type errors. Do NOT move on until the build is clean. After the build is clean, if you created or modified an EDITOR_REACT_COMPONENT extension in this task, run \`npx wix generate manifest\` via bash (idempotent).`
14938
+ };
14939
+ var buildCoreRules = (validation) => `CORE PRINCIPLES:
15039
14940
  - Do NOT invent or assume new types, modules, functions, props, events, or imports.
15040
14941
  - NEVER use mocks, placeholders, debugging, or TODOs in any code.
15041
14942
  - ALWAYS implement complete, production-ready functionality.
@@ -15047,15 +14948,14 @@ MINIMIZE TEXT OUTPUT \u2014 CRITICAL:
15047
14948
  - Every text token costs money. Use tools, not words.
15048
14949
 
15049
14950
  TOOL USAGE:
15050
- - \`validate\` (tsc + build) is run by the \`codegen-validator\` subagent \u2014 do NOT call it directly; delegate via \`task\` at step 5.
15051
- - \`task\` delegates to subagents: \`codegen-validator\` (step 5; see step 5 for the exact prompt), \`codegen-wix-docs\` (step 2; to SEARCH/discover an unknown Wix SDK method/shape/scope ID via wix-mcp), \`codegen-wds-docs\` (step 2; to discover WDS components/props you don't know). Docs subagents are for DISCOVERY only \u2014 give them a QUESTION ("which method lists X?"), never a known article URL to fetch.
15052
- - Each \`task\` round-trip is EXPENSIVE (~90s of subagent startup, regardless of how small the question). So minimize them: ask ONE comprehensive question per API that returns everything you need at once \u2014 method name + FULL call signature + parameter shapes + required scope IDs. NEVER do a broad "find the X SDK" call and then a follow-up "what's the exact signature" call \u2014 that is two ~90s round-trips for one answer. Batch all your unknowns for a domain into a single delegation.
15053
- - If BOTH docs subagents are needed, fire both \`task\` calls in ONE response (parallel), never serially.
14951
+ ${validation.toolRule}
15054
14952
  - \`uuid\` to generate UUIDs (supports count param for multiple). Do NOT use bash.
15055
14953
  - \`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.
15056
14954
  - \`required-permissions\` \u2014 declare the Wix app permissions the generated code needs (when/whether to call: workflow step 6 + PERMISSIONS).
15057
14955
  ${(0, shared_rules_1.buildFileOperationsRules)("fixing type errors")}
15058
- - API discovery (shapes, method signatures, types) \u2014 in this order: (1) loaded skills + KNOWN WIX APIS, if they already cover the API \u2014 if so, do NOT delegate; (2) only when you genuinely don't know which method/API to use, delegate to \`codegen-wix-docs\` (Wix SDK) or \`codegen-wds-docs\` (WDS) to SEARCH for it \u2014 pass the question, not a known article link; the subagent searches AND reads the right schema (\`ReadFullDocsMethodSchema\` is the source of truth for parameter shapes) and returns a summary. Do NOT delegate just to fetch a doc you already identified; (3) grepping \`node_modules\` ONLY as a last resort if the above return nothing \u2014 SDK internals are not a documentation source, and doing it first wastes turns, inflates context, and is unreliable. ENFORCED: after 2 such lookups, further bash inspection of \`node_modules\` Wix/vite/astro internals is rejected.
14956
+ - API discovery (shapes, method signatures, types) \u2014 in this order: (1) loaded skills + KNOWN WIX APIS, if they already cover the API; (2) wix-mcp, yourself: \`SearchWixSDKDocumentation\` to find the method, then \`ReadFullDocsMethodSchema\` for its exact exported name, options object, response fields, enum values and scope IDs \u2014 the schema is the source of truth; an article or its examples are not. Model the call on the SDK view, not REST, and use the direct form inside the extension: \`import { <namespace> } from "@wix/<pkg>"; await <namespace>.<method>(<options>)\` \u2014 never \`createClient\`. Note any setup the docs require from the user (an app to install, a dashboard setting to enable) for the final message. For WDS components/props, use the \`wix-design-system\` skill; (3) grepping \`node_modules\` ONLY as a last resort if the above return nothing \u2014 SDK internals are not a documentation source, and doing it first wastes turns, inflates context, and is unreliable.
14957
+ - NEVER write a Wix SDK method, field, or enum value you haven't seen in a skill or a method schema.
14958
+ - \`report-wix-feedback\` \u2014 report Wix docs / wix-mcp problems to Wix (when: workflow step 7).
15059
14959
  - NEVER run preview, dev, release, or promote commands.
15060
14960
 
15061
14961
  KNOWN WIX APIS (already documented \u2014 do NOT rediscover these from node_modules; for full detail consult the \`wix-app\` skill's references or \`ReadFullDocsMethodSchema\`):
@@ -15064,13 +14964,14 @@ KNOWN WIX APIS (already documented \u2014 do NOT rediscover these from node_modu
15064
14964
 
15065
14965
  IMPLEMENTATION WORKFLOW:
15066
14966
  1. **Plan**: Determine extension types using the \`wix-app\` skill. Generate ALL UUIDs upfront.
15067
- 2. **Research**: Load the \`wix-app\` skill per extension type. SKIP this step entirely if the skill + KNOWN WIX APIS cover everything (common for dashboard + data-collection apps). Otherwise delegate ONLY to search for an API you genuinely can't identify \u2014 \`codegen-wix-docs\` (SDK), \`codegen-wds-docs\` (WDS), both in ONE response if both needed; pass each the question, not a known doc link \u2014 and wait for the summaries before building.
14967
+ 2. **Research**: Load the \`wix-app\` skill per extension type. SKIP this step entirely if the skill + KNOWN WIX APIS cover everything (common for dashboard + data-collection apps). Otherwise look up only the APIs you genuinely can't identify, via wix-mcp (see API discovery).
15068
14968
  3. **Build**: Write files incrementally \u2014 group by logical section, NOT all at once. For complex tasks (300+ total lines across files), split into multiple \`batch-write\` calls. NEVER hold back writing until all code is planned \u2014 write each logical piece as soon as it is ready. Build all extensions before registering.
15069
14969
  4. **Register**: Register all extensions in \`src/extensions.ts\`.
15070
- 5. **Validate**: Dispatch ONE \`task({ subagent: "codegen-validator", prompt: "Run validate({ runBuild: true }) \u2014 it typechecks AND builds in a single pass (tsc runs first and fails fast before the build). Fix any errors and re-run until it passes. Pass installDeps: true only if package.json changed and npm install was not already run in this session." })\`. Wait for the subagent to return. Do NOT call \`validate\` directly from the primary agent, and do NOT make a separate tsc-only call first \u2014 the single runBuild pass already fails fast on type errors. VERIFY the subagent actually FINISHED with a clean build: read its returned summary and confirm it converged. If it reports remaining/unresolved errors or was cut off before finishing (e.g. "Maximum steps reached"), do NOT treat it as success \u2014 re-dispatch \`codegen-validator\` to finish the remaining errors before moving on. After the validator confirms a clean build, if you created or modified an EDITOR_REACT_COMPONENT extension in this task, run \`npx wix generate manifest\` via bash (the validator is instructed not to run it, so this is the only run).
14970
+ ${validation.step}
15071
14971
  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.
15072
- 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). Do NOT mention permissions/scopes here (see PERMISSIONS) and follow OUTPUT MESSAGE below.
15073
- 8. **Stop**: STOP immediately. Do NOT refactor, clean up, or verify.
14972
+ 7. **Report docs problems**: Skip this step if you already called \`report-wix-feedback\` this run. Otherwise look back at the run: if ANY of these happened, call it ONCE covering all of them: (a) you inspected \`node_modules\` to find a Wix SDK signature, shape, or type because the docs didn't give you one that compiles; (b) the validator fixed a Wix SDK call you wrote from the docs \u2014 read its summary; (c) a doc example, article, or schema contradicted the installed SDK types; (d) a search's top results were off-target, or a wix-mcp tool failed. For each: the docs URL or search term, what it showed, and what actually worked.
14973
+ 8. **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). Do NOT mention permissions/scopes here (see PERMISSIONS) and follow OUTPUT MESSAGE below.
14974
+ 9. **Stop**: STOP immediately. Do NOT refactor, clean up, or verify.
15074
14975
 
15075
14976
  FILE CREATION:
15076
14977
  - NEVER rewrite the same file twice. Once written, move on.
@@ -15092,11 +14993,15 @@ When you call \`required-permissions\` (see workflow step 6 for when), use SCOPE
15092
14993
  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.
15093
14994
 
15094
14995
  The \`required-permissions\` tool records and surfaces permissions to the user automatically \u2014 NEVER mention permissions/scopes (IDs or names) in your output, or tell the user to grant them.`;
14996
+ function isValidatorSubagentSkipped() {
14997
+ return (0, model_knobs_1.readEnumEnv)("CODEGEN_RULES_NO_VALIDATOR", ["1"]) === "1";
14998
+ }
15095
14999
  function buildCodegenRules(environmentIdentity) {
15000
+ const validation = isValidatorSubagentSkipped() ? DIRECT_VALIDATION : DELEGATED_VALIDATION;
15096
15001
  return [
15097
15002
  (0, shared_rules_1.buildEnvironmentRules)(environmentIdentity),
15098
15003
  shared_rules_1.BOUNDARY_RULES,
15099
- CODEGEN_CORE_RULES,
15004
+ buildCoreRules(validation),
15100
15005
  shared_rules_1.OUTPUT_MESSAGE_RULES
15101
15006
  ].join("\n\n");
15102
15007
  }
@@ -15382,6 +15287,7 @@ var require_config = __commonJS({
15382
15287
  var rules_writer_12 = require_rules_writer();
15383
15288
  var environments_12 = require_environments();
15384
15289
  var CodeGenService_12 = require_CodeGenService();
15290
+ var job_context_storage_12 = require_job_context_storage();
15385
15291
  exports2.DEFAULT_TIMEOUT_MS = 20 * 60 * 1e3;
15386
15292
  function usesOpenAiProvider() {
15387
15293
  return (0, model_knobs_1.isOpenAiModel)((0, model_knobs_1.getModel)()) || (0, model_knobs_1.isOpenAiModel)((0, model_knobs_1.getSmallModel)());
@@ -15615,7 +15521,11 @@ var require_config = __commonJS({
15615
15521
  OPENCODE_CONFIG_CONTENT: JSON.stringify(config),
15616
15522
  OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS: exports2.DEFAULT_TIMEOUT_MS.toString(),
15617
15523
  OPENCODE_DISABLE_LSP_DOWNLOAD: "true",
15618
- OPENCODE_DISABLE_FILETIME_CHECK: "true"
15524
+ OPENCODE_DISABLE_FILETIME_CHECK: "true",
15525
+ // Read by the report-wix-feedback tool to tag reports with their run.
15526
+ CODEGEN_PROJECT_ID: projectId,
15527
+ CODEGEN_JOB_ID: job_context_storage_12.jobContextStorage.getStore()?.jobId ?? "",
15528
+ CODEGEN_METASITE_ID: job_context_storage_12.jobContextStorage.getStore()?.metasiteId ?? ""
15619
15529
  };
15620
15530
  }
15621
15531
  function getOpenCodeEnv(projectId, kind) {
@@ -15826,12 +15736,8 @@ var require_parser = __commonJS({
15826
15736
  exports2.parseUsageStats = parseUsageStats;
15827
15737
  exports2.mergeUsageStats = mergeUsageStats;
15828
15738
  exports2.hasSessionError = hasSessionError;
15829
- exports2.isStepCappedValidatorOutput = isStepCappedValidatorOutput;
15830
- exports2.shouldReportValidatorOutput = shouldReportValidatorOutput;
15831
- exports2.parseValidatorTaskOutputs = parseValidatorTaskOutputs;
15832
15739
  exports2.summarizeOpenCodeLine = summarizeOpenCodeLine;
15833
15740
  var types_1 = require_types4();
15834
- var subagents_1 = require_subagents();
15835
15741
  var subagent_tool_logger_1 = require_subagent_tool_logger();
15836
15742
  function parseRequiredPermissions(output) {
15837
15743
  let permissions = [];
@@ -15958,30 +15864,6 @@ var require_parser = __commonJS({
15958
15864
  ...input.description && { description: truncate(input.description) }
15959
15865
  };
15960
15866
  }
15961
- var STEP_CAP_RE = /maximum steps reached/i;
15962
- function isStepCappedValidatorOutput(output) {
15963
- return STEP_CAP_RE.test(output);
15964
- }
15965
- function shouldReportValidatorOutput(output) {
15966
- return output.includes("NEEDS_INVESTIGATION") || isStepCappedValidatorOutput(output);
15967
- }
15968
- function parseValidatorTaskOutputs(stdout) {
15969
- const outputs = [];
15970
- for (const line of stdout.split("\n")) {
15971
- if (!line.trim())
15972
- continue;
15973
- const event = (0, types_1.tryParseJson)(line);
15974
- if (!event || event.type !== "tool_use" || event.part?.tool !== "task" || event.part?.state?.status !== "completed") {
15975
- continue;
15976
- }
15977
- const { title, output, input } = event.part.state;
15978
- const isValidator = input?.subagent_type === subagents_1.VALIDATOR_SUBAGENT_NAME || title?.includes(subagents_1.VALIDATOR_SUBAGENT_NAME);
15979
- if (isValidator && output) {
15980
- outputs.push(output.trim());
15981
- }
15982
- }
15983
- return outputs;
15984
- }
15985
15867
  function summarizeOpenCodeLine(line) {
15986
15868
  if (line.type !== "tool_use" && line.type !== subagent_tool_logger_1.SUBAGENT_TOOL_EVENT_TYPE) {
15987
15869
  return line;
@@ -16338,9 +16220,7 @@ var require_derived_progress = __commonJS({
16338
16220
  var detect_1 = require_detect();
16339
16221
  var subagents_1 = require_subagents();
16340
16222
  var SUBAGENT_STEPS = {
16341
- [subagents_1.VALIDATOR_SUBAGENT_NAME]: "Building project",
16342
- [subagents_1.WIX_DOCS_SUBAGENT_NAME]: "Reading documentation",
16343
- [subagents_1.WDS_DOCS_SUBAGENT_NAME]: "Reading documentation"
16223
+ [subagents_1.VALIDATOR_SUBAGENT_NAME]: "Building project"
16344
16224
  };
16345
16225
  var REGISTRY_FILE_PATTERN = /(^|\/)extensions\.ts$/;
16346
16226
  var EXTENSION_DEFINITION_PATTERN = /\.extension\.ts$/;
@@ -22748,50 +22628,6 @@ var require_bi_events = __commonJS({
22748
22628
  }
22749
22629
  });
22750
22630
 
22751
- // dist/opencode-integration/slack-reports/validator-outputs.js
22752
- var require_validator_outputs = __commonJS({
22753
- "dist/opencode-integration/slack-reports/validator-outputs.js"(exports2) {
22754
- "use strict";
22755
- Object.defineProperty(exports2, "__esModule", { value: true });
22756
- exports2.notifyValidatorOutputsToSlack = notifyValidatorOutputsToSlack;
22757
- var logger_12 = require_logger();
22758
- var job_context_storage_12 = require_job_context_storage();
22759
- var codeGenerationService_12 = require_codeGenerationService();
22760
- var parser_1 = require_parser();
22761
- async function notifyValidatorOutputsToSlack(stdout, costUsd) {
22762
- try {
22763
- const store = job_context_storage_12.jobContextStorage.getStore();
22764
- const outputs = (0, parser_1.parseValidatorTaskOutputs)(stdout);
22765
- if (outputs.length === 0)
22766
- return;
22767
- const durationMs = store?.flowStartTime ? Date.now() - store.flowStartTime : void 0;
22768
- const context = {
22769
- jobId: store?.jobId,
22770
- metasiteId: store?.metasiteId,
22771
- costUsd: costUsd > 0 ? costUsd : void 0,
22772
- durationMs
22773
- };
22774
- for (const output of outputs) {
22775
- if (!(0, parser_1.shouldReportValidatorOutput)(output)) {
22776
- continue;
22777
- }
22778
- try {
22779
- await codeGenerationService_12.codeGenerationService.handleValidationErrors(output, context);
22780
- } catch (err) {
22781
- logger_12.logger.warn("[OpenCode] Failed to report validator output to Slack", {
22782
- error: err instanceof Error ? err.message : String(err)
22783
- });
22784
- }
22785
- }
22786
- } catch (err) {
22787
- logger_12.logger.warn("[OpenCode] Unexpected error in notifyValidatorOutputsToSlack", {
22788
- error: err instanceof Error ? err.message : String(err)
22789
- });
22790
- }
22791
- }
22792
- }
22793
- });
22794
-
22795
22631
  // dist/opencode-integration/slack-reports/expensive-run.js
22796
22632
  var require_expensive_run = __commonJS({
22797
22633
  "dist/opencode-integration/slack-reports/expensive-run.js"(exports2) {
@@ -22874,7 +22710,6 @@ var require_opencode_init = __commonJS({
22874
22710
  var inject_created_by_1 = require_inject_created_by();
22875
22711
  var job_payload_1 = require_job_payload2();
22876
22712
  var bi_events_1 = require_bi_events();
22877
- var validator_outputs_1 = require_validator_outputs();
22878
22713
  var expensive_run_1 = require_expensive_run();
22879
22714
  var pre_run_decision_1 = require_pre_run_decision();
22880
22715
  var environments_12 = require_environments();
@@ -22953,7 +22788,6 @@ var require_opencode_init = __commonJS({
22953
22788
  requiredPermissions: result.requiredPermissions
22954
22789
  });
22955
22790
  if (orchestrator.lastStdout && !(0, model_knobs_1.hasModelOverride)() && !(0, model_knobs_1.hasSmallModelOverride)()) {
22956
- void (0, validator_outputs_1.notifyValidatorOutputsToSlack)(orchestrator.lastStdout, result.usage.cost);
22957
22791
  void (0, expensive_run_1.notifyExpensiveRunToSlack)({
22958
22792
  usage: result.usage,
22959
22793
  durationMs: Date.now() - flowStartTime,
@@ -23096,7 +22930,6 @@ var require_opencode_iterate = __commonJS({
23096
22930
  var file_changes_1 = require_file_changes();
23097
22931
  var inject_created_by_1 = require_inject_created_by();
23098
22932
  var job_payload_1 = require_job_payload2();
23099
- var validator_outputs_1 = require_validator_outputs();
23100
22933
  var expensive_run_1 = require_expensive_run();
23101
22934
  var bi_events_1 = require_bi_events();
23102
22935
  var plugins_runtime_1 = require_plugins_runtime();
@@ -23164,7 +22997,6 @@ var require_opencode_iterate = __commonJS({
23164
22997
  requiredPermissions: result.requiredPermissions
23165
22998
  });
23166
22999
  if (iterationOrchestrator.lastStdout && !(0, model_knobs_1.hasModelOverride)() && !(0, model_knobs_1.hasSmallModelOverride)()) {
23167
- void (0, validator_outputs_1.notifyValidatorOutputsToSlack)(iterationOrchestrator.lastStdout, result.usage.cost);
23168
23000
  void (0, expensive_run_1.notifyExpensiveRunToSlack)({
23169
23001
  usage: result.usage,
23170
23002
  durationMs: Date.now() - flowStartTime,
@@ -23484,7 +23316,6 @@ var require_opencode_fix_git_conflicts = __commonJS({
23484
23316
  var model_knobs_1 = require_model_knobs();
23485
23317
  var file_changes_1 = require_file_changes();
23486
23318
  var job_payload_1 = require_job_payload2();
23487
- var validator_outputs_1 = require_validator_outputs();
23488
23319
  var expensive_run_1 = require_expensive_run();
23489
23320
  var bi_events_1 = require_bi_events();
23490
23321
  var plugins_runtime_1 = require_plugins_runtime();
@@ -23547,7 +23378,6 @@ var require_opencode_fix_git_conflicts = __commonJS({
23547
23378
  requiredPermissions: result.requiredPermissions
23548
23379
  });
23549
23380
  if (orchestrator.lastStdout && !(0, model_knobs_1.hasModelOverride)() && !(0, model_knobs_1.hasSmallModelOverride)()) {
23550
- void (0, validator_outputs_1.notifyValidatorOutputsToSlack)(orchestrator.lastStdout, result.usage.cost);
23551
23381
  void (0, expensive_run_1.notifyExpensiveRunToSlack)({
23552
23382
  usage: result.usage,
23553
23383
  durationMs: Date.now() - flowStartTime,
@@ -23997,6 +23827,95 @@ var require_tools_writer = __commonJS({
23997
23827
  }
23998
23828
  });
23999
23829
 
23830
+ // dist/opencode-integration/plugins/docs-feedback-nudge.js
23831
+ var require_docs_feedback_nudge = __commonJS({
23832
+ "dist/opencode-integration/plugins/docs-feedback-nudge.js"(exports2) {
23833
+ "use strict";
23834
+ Object.defineProperty(exports2, "__esModule", { value: true });
23835
+ exports2.DOCS_FEEDBACK_NUDGE_FILENAME = exports2.REPORT_SENT_PREFIX = exports2.COMPILE_FAILURE_NOTE = exports2.VALIDATOR_NOTE = exports2.SDK_INTERNALS_NOTE = exports2.WIX_SDK_INTERNALS_RE = void 0;
23836
+ exports2.buildDocsFeedbackNudgeSource = buildDocsFeedbackNudgeSource;
23837
+ exports2.writeDocsFeedbackNudgePlugin = writeDocsFeedbackNudgePlugin;
23838
+ var write_plugin_1 = require_write_plugin();
23839
+ var subagents_1 = require_subagents();
23840
+ exports2.WIX_SDK_INTERNALS_RE = /node_modules\/@wix\/(?!patterns\b|design-system\b)[\w-]+/;
23841
+ exports2.SDK_INTERNALS_NOTE = "Docs check: you are reading Wix SDK internals. If it's because the docs didn't give you a signature, shape, or type that compiles, call `report-wix-feedback` once you have the answer \u2014 with the docs URL or search term you used, what it showed, and what you found here.";
23842
+ exports2.VALIDATOR_NOTE = "Docs check: if the validator fixed a Wix SDK call you wrote from a doc example, article, or schema, call `report-wix-feedback` now \u2014 with the docs URL, what it showed, and what the validator changed it to.";
23843
+ exports2.COMPILE_FAILURE_NOTE = "Docs check: if a failure above is in a Wix SDK call you wrote from a doc example, article, or schema, call `report-wix-feedback` once you've fixed it \u2014 with the docs URL, what it showed, and what actually compiled.";
23844
+ exports2.REPORT_SENT_PREFIX = "Report sent";
23845
+ exports2.DOCS_FEEDBACK_NUDGE_FILENAME = "docs-feedback-nudge.ts";
23846
+ function buildDocsFeedbackNudgeSource() {
23847
+ return `// Generated by @wix/ditto-codegen (docs-feedback-nudge). Do not edit.
23848
+ const WIX_SDK_INTERNALS_RE = /${exports2.WIX_SDK_INTERNALS_RE.source}/;
23849
+ const NOTES = {
23850
+ sdkInternals: ${JSON.stringify(exports2.SDK_INTERNALS_NOTE)},
23851
+ validator: ${JSON.stringify(exports2.VALIDATOR_NOTE)},
23852
+ compileFailure: ${JSON.stringify(exports2.COMPILE_FAILURE_NOTE)},
23853
+ };
23854
+ const REPORT_SENT_PREFIX = ${JSON.stringify(exports2.REPORT_SENT_PREFIX)};
23855
+ const LOOKUP_TOOLS = new Set([
23856
+ "${"bash"}",
23857
+ "${"read"}",
23858
+ "${"batch-read"}",
23859
+ "${"grep"}",
23860
+ "${"glob"}",
23861
+ ]);
23862
+
23863
+ function noteKind(input, result) {
23864
+ const args = input.args ?? {};
23865
+ if (LOOKUP_TOOLS.has(input.tool) && WIX_SDK_INTERNALS_RE.test(JSON.stringify(args))) {
23866
+ return "sdkInternals";
23867
+ }
23868
+ if (input.tool === "${"task"}" && args.subagent_type === "${subagents_1.VALIDATOR_SUBAGENT_NAME}") {
23869
+ return "validator";
23870
+ }
23871
+ if (input.tool === "${"validate"}" && result.startsWith("FAILED")) {
23872
+ return "compileFailure";
23873
+ }
23874
+ return null;
23875
+ }
23876
+
23877
+ export const DocsFeedbackNudge = async () => {
23878
+ const childSessions = new Set();
23879
+ const reported = new Set();
23880
+ const nudged = new Set();
23881
+
23882
+ return {
23883
+ event: async ({ event }) => {
23884
+ const info = event?.properties?.info;
23885
+ if (
23886
+ (event?.type === "session.created" || event?.type === "session.updated") &&
23887
+ info?.parentID
23888
+ ) {
23889
+ childSessions.add(info.id);
23890
+ }
23891
+ if (event?.type === "message.updated" && info?.agent === "${subagents_1.VALIDATOR_SUBAGENT_NAME}") {
23892
+ childSessions.add(event.properties.sessionID ?? info.sessionID);
23893
+ }
23894
+ },
23895
+ "tool.execute.after": async (input, output) => {
23896
+ const sessionID = input.sessionID;
23897
+ if (childSessions.has(sessionID) || typeof output.output !== "string") return;
23898
+ if (input.tool === "${"report-wix-feedback"}") {
23899
+ if (output.output.startsWith(REPORT_SENT_PREFIX)) reported.add(sessionID);
23900
+ return;
23901
+ }
23902
+ if (reported.has(sessionID)) return;
23903
+
23904
+ const kind = noteKind(input, output.output);
23905
+ if (!kind || nudged.has(sessionID + ":" + kind)) return;
23906
+ nudged.add(sessionID + ":" + kind);
23907
+ output.output = output.output + "\\n\\n" + NOTES[kind];
23908
+ },
23909
+ };
23910
+ };
23911
+ `;
23912
+ }
23913
+ async function writeDocsFeedbackNudgePlugin() {
23914
+ await (0, write_plugin_1.writeGeneratedPlugin)(exports2.DOCS_FEEDBACK_NUDGE_FILENAME, buildDocsFeedbackNudgeSource());
23915
+ }
23916
+ }
23917
+ });
23918
+
24000
23919
  // dist/opencode-integration/plugins/generated-files-guard.js
24001
23920
  var require_generated_files_guard = __commonJS({
24002
23921
  "dist/opencode-integration/plugins/generated-files-guard.js"(exports2) {
@@ -24320,6 +24239,7 @@ var require_plugins3 = __commonJS({
24320
24239
  Object.defineProperty(exports2, "__esModule", { value: true });
24321
24240
  exports2.validateToolPolicies = void 0;
24322
24241
  exports2.writeGeneratedPlugins = writeGeneratedPlugins;
24242
+ var docs_feedback_nudge_1 = require_docs_feedback_nudge();
24323
24243
  var generated_files_guard_1 = require_generated_files_guard();
24324
24244
  var subagent_tool_logger_1 = require_subagent_tool_logger();
24325
24245
  var tool_policies_1 = require_tool_policies3();
@@ -24329,6 +24249,7 @@ var require_plugins3 = __commonJS({
24329
24249
  } });
24330
24250
  async function writeGeneratedPlugins(toolPolicies) {
24331
24251
  await Promise.all([
24252
+ (0, docs_feedback_nudge_1.writeDocsFeedbackNudgePlugin)(),
24332
24253
  (0, generated_files_guard_1.writeGeneratedFilesGuardPlugin)(),
24333
24254
  (0, subagent_tool_logger_1.writeSubagentToolLoggerPlugin)(),
24334
24255
  (0, tool_policies_1.writeToolPoliciesPlugin)(toolPolicies)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.463",
3
+ "version": "1.0.465",
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": "4b4c9bb0574e94bfd5df434744eef2f05f876dbd9776e8d6616a3fc5"
32
+ "falconPackageHash": "175eef2c2268c965ea1b16a42224fac32fe17587e762719c5ed06a1b"
33
33
  }