@wix/ditto-codegen-public 1.0.402 → 1.0.404

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 CHANGED
@@ -11564,14 +11564,14 @@ var require_subagents = __commonJS({
11564
11564
  "dist/opencode-integration/subagents.js"(exports2) {
11565
11565
  "use strict";
11566
11566
  Object.defineProperty(exports2, "__esModule", { value: true });
11567
- exports2.VALIDATOR_SUBAGENT_NAME = exports2.PRIMARY_AGENT_NAME = void 0;
11567
+ exports2.WDS_DOCS_SUBAGENT_NAME = exports2.WIX_DOCS_SUBAGENT_NAME = exports2.VALIDATOR_SUBAGENT_NAME = exports2.PRIMARY_AGENT_NAME = void 0;
11568
11568
  exports2.getAgentConfig = getAgentConfig;
11569
11569
  var types_1 = require_types4();
11570
11570
  var constants_1 = require_constants5();
11571
11571
  exports2.PRIMARY_AGENT_NAME = "codegen";
11572
11572
  exports2.VALIDATOR_SUBAGENT_NAME = "codegen-validator";
11573
- var WIX_DOCS_SUBAGENT_NAME = "codegen-wix-docs";
11574
- var WDS_DOCS_SUBAGENT_NAME = "codegen-wds-docs";
11573
+ exports2.WIX_DOCS_SUBAGENT_NAME = "codegen-wix-docs";
11574
+ exports2.WDS_DOCS_SUBAGENT_NAME = "codegen-wds-docs";
11575
11575
  var VALIDATOR_DESCRIPTION = `Runs validate (tsc + wix build) and fixes the reported errors, consulting the
11576
11576
  skills or wix-mcp for SDK-shape errors; returns when the build is clean
11577
11577
  or reports what it couldn't fix. Validation step only \u2014 never generates features.`;
@@ -11588,9 +11588,10 @@ object. Work in a bounded number of fix cycles \u2014 if the build isn't converg
11588
11588
  after a few attempts, STOP and return the remaining errors verbatim rather than
11589
11589
  looping; never silence them.
11590
11590
 
11591
- When done, summarize each error: message, file, root cause, fix. No diffs.
11592
- If you fixed 2+ errors or any remain unfixed, add exactly: NEEDS_INVESTIGATION
11593
- (This triggers a team alert to improve codegen for future runs.)`;
11591
+ When done, if you fixed any errors or any remain unfixed, write NEEDS_INVESTIGATION
11592
+ as the very first line of your response (before the summary).
11593
+ Then summarize each error: message, file, root cause, fix. No diffs.
11594
+ (NEEDS_INVESTIGATION triggers a team alert to improve codegen for future runs.)`;
11594
11595
  var WIX_DOCS_DESCRIPTION = `Use ONLY to discover a Wix SDK you don't know and that the skills +
11595
11596
  KNOWN WIX APIS don't cover. Send ONE complete question; returns the import path
11596
11597
  + exported namespace/method + runtime context + full signature + any required
@@ -11641,10 +11642,6 @@ skills already cover. Read-only.`;
11641
11642
  [
11642
11643
  "required-permissions"
11643
11644
  /* OpenCodeTool.RequiredPermissions */
11644
- ]: "deny",
11645
- [
11646
- "progress"
11647
- /* OpenCodeTool.Progress */
11648
11645
  ]: "deny"
11649
11646
  };
11650
11647
  var DOCS_SUBAGENT_DENIED_TOOLS = {
@@ -11717,8 +11714,8 @@ skills already cover. Read-only.`;
11717
11714
  ]: {
11718
11715
  [types_1.PERMISSION_WILDCARD]: "deny",
11719
11716
  [exports2.VALIDATOR_SUBAGENT_NAME]: "allow",
11720
- [WIX_DOCS_SUBAGENT_NAME]: "allow",
11721
- [WDS_DOCS_SUBAGENT_NAME]: "allow"
11717
+ [exports2.WIX_DOCS_SUBAGENT_NAME]: "allow",
11718
+ [exports2.WDS_DOCS_SUBAGENT_NAME]: "allow"
11722
11719
  }
11723
11720
  }
11724
11721
  },
@@ -11748,7 +11745,7 @@ skills already cover. Read-only.`;
11748
11745
  [constants_1.WIX_MCP_SERVER_NAME]: "allow"
11749
11746
  }
11750
11747
  },
11751
- [WIX_DOCS_SUBAGENT_NAME]: {
11748
+ [exports2.WIX_DOCS_SUBAGENT_NAME]: {
11752
11749
  mode: "subagent",
11753
11750
  model: smallModel,
11754
11751
  steps: 15,
@@ -11768,7 +11765,7 @@ skills already cover. Read-only.`;
11768
11765
  [constants_1.WIX_MCP_SERVER_NAME]: "allow"
11769
11766
  }
11770
11767
  },
11771
- [WDS_DOCS_SUBAGENT_NAME]: {
11768
+ [exports2.WDS_DOCS_SUBAGENT_NAME]: {
11772
11769
  mode: "subagent",
11773
11770
  model: smallModel,
11774
11771
  steps: 15,
@@ -14756,7 +14753,6 @@ MINIMIZE TEXT OUTPUT \u2014 CRITICAL:
14756
14753
  - Every text token costs money. Use tools, not words.
14757
14754
 
14758
14755
  TOOL USAGE:
14759
- - \`progress\` to mark a step done. Call it ONCE per completed step, in the SAME response as the tool calls that did the work \u2014 never dedicate a separate turn to it. Report progress at EVERY meaningful milestone (the IMPLEMENTATION WORKFLOW steps below give the exact wording to use). Keep descriptions SHORT \u2014 mention the extension type but no file names, counts, namespaces, or other specifics.
14760
14756
  - \`validate\` (tsc + build) is run by the \`codegen-validator\` subagent \u2014 do NOT call it directly; delegate via \`task\` at step 5.
14761
14757
  - \`task\` delegates to haiku 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.
14762
14758
  - 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.
@@ -14779,11 +14775,11 @@ KNOWN WIX APIS (already documented \u2014 do NOT rediscover these from node_modu
14779
14775
  - Dashboard host SDK (toasts, navigation, modals): \`import { dashboard } from "@wix/dashboard"\`.
14780
14776
 
14781
14777
  IMPLEMENTATION WORKFLOW:
14782
- 1. **Plan**: Determine extension types using the \`wix-app\` skill. Generate ALL UUIDs upfront. Include a \`progress\` call (e.g. "Planning extensions").
14783
- 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 \`progress\` ("Reading documentation"), then 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.
14784
- 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. Include one \`progress\` call per extension type (e.g. "Creating dashboard page", "Creating service plugin", "Creating data collection").
14785
- 4. **Register**: Register all extensions in \`src/extensions.ts\`. Include a \`progress\` call (e.g. "Registering extensions").
14786
- 5. **Validate**: Call \`progress\` ("Running type checks"), then 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.
14778
+ 1. **Plan**: Determine extension types using the \`wix-app\` skill. Generate ALL UUIDs upfront.
14779
+ 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.
14780
+ 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.
14781
+ 4. **Register**: Register all extensions in \`src/extensions.ts\`.
14782
+ 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.
14787
14783
  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.
14788
14784
  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).
14789
14785
  8. **Stop**: STOP immediately. Do NOT refactor, clean up, or verify.
@@ -14819,12 +14815,6 @@ var require_ask_rules = __commonJS({
14819
14815
  - Use the wix-mcp tools to fetch Wix SDK/API documentation when needed.
14820
14816
  - Provide clear, accurate, and well-structured answers.
14821
14817
 
14822
- TOOL USAGE:
14823
- - \`progress\` to mark a step done. Call it ONCE per completed step, in the SAME response as the tool calls that did the work. Examples:
14824
- - "Reading codebase"
14825
- - "Looking up documentation"
14826
- - "Analyzing code"
14827
-
14828
14818
  IMPORTANT INSTRUCTIONS:
14829
14819
  1. Do NOT edit, write, or create any files.
14830
14820
  2. Do NOT run any bash commands.
@@ -15148,10 +15138,6 @@ var require_config = __commonJS({
15148
15138
  };
15149
15139
  var GIT_CONFLICTS_PERMISSIONS = {
15150
15140
  ...CODEGEN_PERMISSIONS,
15151
- [
15152
- "progress"
15153
- /* OpenCodeTool.Progress */
15154
- ]: "deny",
15155
15141
  [
15156
15142
  "uuid"
15157
15143
  /* OpenCodeTool.Uuid */
@@ -15619,15 +15605,11 @@ var require_progress_handler = __commonJS({
15619
15605
  var logger_12 = require_logger();
15620
15606
  var init_task_1 = require_init_task();
15621
15607
  var ProgressTaskHandler = class {
15622
- async handle(state, ctx) {
15623
- if (state.status !== "completed")
15624
- return;
15608
+ /** Posts one completed progress step (from wrapper-derived progress). */
15609
+ async report(description, ctx) {
15625
15610
  const jobContext = ctx.getJobContext();
15626
15611
  if (!jobContext)
15627
15612
  return;
15628
- const description = state.input?.step;
15629
- if (!description)
15630
- return;
15631
15613
  await (0, init_task_1.completeInitTask)(ctx);
15632
15614
  try {
15633
15615
  await codeGenerationService_12.codeGenerationService.addTask(jobContext.jobId, {
@@ -15652,6 +15634,118 @@ var require_progress_handler = __commonJS({
15652
15634
  }
15653
15635
  });
15654
15636
 
15637
+ // dist/opencode-integration/task-tracker/derived-progress.js
15638
+ var require_derived_progress = __commonJS({
15639
+ "dist/opencode-integration/task-tracker/derived-progress.js"(exports2) {
15640
+ "use strict";
15641
+ Object.defineProperty(exports2, "__esModule", { value: true });
15642
+ exports2.DerivedProgressReporter = void 0;
15643
+ exports2.deriveProgressSteps = deriveProgressSteps;
15644
+ var ditto_codegen_types_12 = require_dist4();
15645
+ var constants_1 = require_constants5();
15646
+ var subagents_1 = require_subagents();
15647
+ var SUBAGENT_STEPS = {
15648
+ [subagents_1.VALIDATOR_SUBAGENT_NAME]: "Building project",
15649
+ [subagents_1.WIX_DOCS_SUBAGENT_NAME]: "Reading documentation",
15650
+ [subagents_1.WDS_DOCS_SUBAGENT_NAME]: "Reading documentation"
15651
+ };
15652
+ var REGISTRY_FILE_PATTERN = /(^|\/)extensions\.ts$/;
15653
+ var EXTENSION_DEFINITION_PATTERN = /\.extension\.ts$/;
15654
+ function toTitleCaseWords(token) {
15655
+ return token.replace(/[_-]+/g, " ").replace(/([a-z\d])([A-Z])/g, "$1 $2").split(/\s+/).filter(Boolean).map((word) => word[0].toUpperCase() + word.slice(1).toLowerCase()).join(" ");
15656
+ }
15657
+ function humanizeExtensionType(type) {
15658
+ return (0, constants_1.isSpiExtension)(type) ? "Service Plugin" : toTitleCaseWords(type);
15659
+ }
15660
+ function extensionStep(verb, type) {
15661
+ return `${verb} ${humanizeExtensionType(type)}`;
15662
+ }
15663
+ function touchedFiles(tool, input) {
15664
+ switch (tool) {
15665
+ case "write":
15666
+ return input.filePath ? [{ path: input.filePath, content: input.content }] : [];
15667
+ case "edit":
15668
+ return input.filePath ? [{ path: input.filePath, content: input.new_string }] : [];
15669
+ case "batch-write":
15670
+ return (input.files ?? []).map((f) => ({
15671
+ path: f.path,
15672
+ content: f.content
15673
+ }));
15674
+ case "multi-edit":
15675
+ return (input.edits ?? []).map((e) => ({
15676
+ path: e.path,
15677
+ content: e.newString
15678
+ }));
15679
+ default:
15680
+ return [];
15681
+ }
15682
+ }
15683
+ function deriveProgressSteps(tool, state) {
15684
+ const input = state.input ?? {};
15685
+ switch (tool) {
15686
+ case "uuid":
15687
+ return ["Planning extensions"];
15688
+ case "skill":
15689
+ return ["Reading documentation"];
15690
+ case "task": {
15691
+ const step = input.subagent_type ? SUBAGENT_STEPS[input.subagent_type] : void 0;
15692
+ return step ? [step] : [];
15693
+ }
15694
+ case "wix-generate":
15695
+ return (input.extensions ?? []).flatMap((e) => e.params?.extensionType ? [extensionStep("Creating", e.params.extensionType)] : []);
15696
+ case "validate":
15697
+ return [input.runBuild ? "Building project" : "Running type checks"];
15698
+ case "write":
15699
+ case "edit":
15700
+ case "batch-write":
15701
+ case "multi-edit": {
15702
+ const steps = [];
15703
+ for (const file of touchedFiles(tool, input)) {
15704
+ if (REGISTRY_FILE_PATTERN.test(file.path)) {
15705
+ steps.push("Registering extensions");
15706
+ } else if (EXTENSION_DEFINITION_PATTERN.test(file.path) && file.content) {
15707
+ const type = (0, constants_1.detectExtension)(file.content);
15708
+ if (type)
15709
+ steps.push(extensionStep("Editing", type));
15710
+ }
15711
+ }
15712
+ return steps;
15713
+ }
15714
+ default:
15715
+ return [];
15716
+ }
15717
+ }
15718
+ var DERIVED_FLOW_KINDS = /* @__PURE__ */ new Set([
15719
+ ditto_codegen_types_12.TaskKind.INIT_CODEGEN,
15720
+ ditto_codegen_types_12.TaskKind.ITERATE_CODEGEN
15721
+ ]);
15722
+ var DerivedProgressReporter = class {
15723
+ constructor(progressHandler) {
15724
+ this.progressHandler = progressHandler;
15725
+ this.reported = /* @__PURE__ */ new Set();
15726
+ this.queue = Promise.resolve();
15727
+ }
15728
+ handle(tool, state, ctx) {
15729
+ if (state.status !== "completed")
15730
+ return this.queue;
15731
+ const kind = ctx.store?.kind;
15732
+ if (!kind || !DERIVED_FLOW_KINDS.has(kind))
15733
+ return this.queue;
15734
+ const steps = deriveProgressSteps(tool, state).filter((step) => !this.reported.has(step) && this.reported.add(step));
15735
+ if (!steps.length)
15736
+ return this.queue;
15737
+ this.queue = this.queue.then(async () => {
15738
+ for (const step of steps) {
15739
+ await this.progressHandler.report(step, ctx);
15740
+ }
15741
+ });
15742
+ return this.queue;
15743
+ }
15744
+ };
15745
+ exports2.DerivedProgressReporter = DerivedProgressReporter;
15746
+ }
15747
+ });
15748
+
15655
15749
  // dist/plugins-runtime.js
15656
15750
  var require_plugins_runtime = __commonJS({
15657
15751
  "dist/plugins-runtime.js"(exports2) {
@@ -15710,11 +15804,12 @@ var require_task_tracker = __commonJS({
15710
15804
  var types_1 = require_types4();
15711
15805
  var logger_12 = require_logger();
15712
15806
  var progress_handler_1 = require_progress_handler();
15807
+ var derived_progress_1 = require_derived_progress();
15713
15808
  var plugins_runtime_1 = require_plugins_runtime();
15714
15809
  var OpenCodeTaskTracker = class {
15715
15810
  constructor(workingDirectory) {
15716
15811
  this.skillsUsed = /* @__PURE__ */ new Set();
15717
- this.progressHandler = new progress_handler_1.ProgressTaskHandler();
15812
+ this.derivedProgress = new derived_progress_1.DerivedProgressReporter(new progress_handler_1.ProgressTaskHandler());
15718
15813
  this.store = job_context_storage_12.jobContextStorage.getStore();
15719
15814
  this.workingDirectory = workingDirectory;
15720
15815
  }
@@ -15751,9 +15846,7 @@ var require_task_tracker = __commonJS({
15751
15846
  if (tool === "skill" && state.status === "completed") {
15752
15847
  this.handleSkillEvent(state);
15753
15848
  }
15754
- if (tool === "progress") {
15755
- void this.progressHandler.handle(state, this.handlerContext);
15756
- }
15849
+ void this.derivedProgress.handle(tool, state, this.handlerContext);
15757
15850
  await (0, plugins_runtime_1.runOnToolUse)((0, plugins_runtime_1.getActivePlugins)(), { tool, state }, logger_12.logger);
15758
15851
  }
15759
15852
  handleSkillEvent(state) {
@@ -15987,6 +16080,7 @@ var require_executor = __commonJS({
15987
16080
  "dist/opencode-integration/executor.js"(exports2) {
15988
16081
  "use strict";
15989
16082
  Object.defineProperty(exports2, "__esModule", { value: true });
16083
+ exports2.notifyValidatorOutputsToSlack = notifyValidatorOutputsToSlack;
15990
16084
  exports2.executeOpenCode = executeOpenCode;
15991
16085
  exports2.resolveFinalRunCost = resolveFinalRunCost;
15992
16086
  var child_process_1 = require("child_process");
@@ -16409,6 +16503,7 @@ var require_OpenCodeOrchestrator = __commonJS({
16409
16503
  }
16410
16504
  });
16411
16505
  this.lastUsage = result.usage;
16506
+ this.lastStdout = result.stdout;
16412
16507
  const durationMs = Date.now() - start;
16413
16508
  if (!result.success) {
16414
16509
  this.emitEvent("opencode:error", {
@@ -21641,6 +21736,7 @@ var require_opencode_init = __commonJS({
21641
21736
  var inject_created_by_1 = require_inject_created_by();
21642
21737
  var collect_extensions_created_1 = require_collect_extensions_created();
21643
21738
  var biEvents_1 = require_biEvents();
21739
+ var executor_1 = require_executor();
21644
21740
  var pre_run_decision_1 = require_pre_run_decision();
21645
21741
  var environments_12 = require_environments();
21646
21742
  var plugins_runtime_1 = require_plugins_runtime();
@@ -21705,6 +21801,9 @@ var require_opencode_init = __commonJS({
21705
21801
  ...agentOutput,
21706
21802
  extensions
21707
21803
  });
21804
+ if (orchestrator.lastStdout) {
21805
+ void (0, executor_1.notifyValidatorOutputsToSlack)(orchestrator.lastStdout, result.usage.cost);
21806
+ }
21708
21807
  if (!store.isCompleted) {
21709
21808
  await codeGenerationService_12.codeGenerationService.updateTask(jobId, taskId, ditto_codegen_types_12.Status.COMPLETED, {});
21710
21809
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.402",
3
+ "version": "1.0.404",
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": "8556d9204c6f708d61f1eea28d679376b18a7da3a41be6f4bcfdbffe"
32
+ "falconPackageHash": "8f5c312e7c5ce1503203320c0d70f5b63851f962f98ae7e6b8970427"
33
33
  }
@@ -1,17 +0,0 @@
1
- import { tool } from "@opencode-ai/plugin";
2
-
3
- export default tool({
4
- description:
5
- "Mark a completed step. Call once per step AFTER it is done. " +
6
- "Emit alongside other tool calls in the same response — do not dedicate a turn to it.",
7
- args: {
8
- step: tool.schema
9
- .string()
10
- .describe(
11
- "Short label in present progressive, e.g. 'Planning extensions', 'Creating dashboard page'. No file names, counts, or specifics.",
12
- ),
13
- },
14
- async execute(args) {
15
- return `✓ ${args.step}`;
16
- },
17
- });