@wix/ditto-codegen-public 1.0.403 → 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.`;
@@ -11642,10 +11642,6 @@ skills already cover. Read-only.`;
11642
11642
  [
11643
11643
  "required-permissions"
11644
11644
  /* OpenCodeTool.RequiredPermissions */
11645
- ]: "deny",
11646
- [
11647
- "progress"
11648
- /* OpenCodeTool.Progress */
11649
11645
  ]: "deny"
11650
11646
  };
11651
11647
  var DOCS_SUBAGENT_DENIED_TOOLS = {
@@ -11718,8 +11714,8 @@ skills already cover. Read-only.`;
11718
11714
  ]: {
11719
11715
  [types_1.PERMISSION_WILDCARD]: "deny",
11720
11716
  [exports2.VALIDATOR_SUBAGENT_NAME]: "allow",
11721
- [WIX_DOCS_SUBAGENT_NAME]: "allow",
11722
- [WDS_DOCS_SUBAGENT_NAME]: "allow"
11717
+ [exports2.WIX_DOCS_SUBAGENT_NAME]: "allow",
11718
+ [exports2.WDS_DOCS_SUBAGENT_NAME]: "allow"
11723
11719
  }
11724
11720
  }
11725
11721
  },
@@ -11749,7 +11745,7 @@ skills already cover. Read-only.`;
11749
11745
  [constants_1.WIX_MCP_SERVER_NAME]: "allow"
11750
11746
  }
11751
11747
  },
11752
- [WIX_DOCS_SUBAGENT_NAME]: {
11748
+ [exports2.WIX_DOCS_SUBAGENT_NAME]: {
11753
11749
  mode: "subagent",
11754
11750
  model: smallModel,
11755
11751
  steps: 15,
@@ -11769,7 +11765,7 @@ skills already cover. Read-only.`;
11769
11765
  [constants_1.WIX_MCP_SERVER_NAME]: "allow"
11770
11766
  }
11771
11767
  },
11772
- [WDS_DOCS_SUBAGENT_NAME]: {
11768
+ [exports2.WDS_DOCS_SUBAGENT_NAME]: {
11773
11769
  mode: "subagent",
11774
11770
  model: smallModel,
11775
11771
  steps: 15,
@@ -14757,7 +14753,6 @@ MINIMIZE TEXT OUTPUT \u2014 CRITICAL:
14757
14753
  - Every text token costs money. Use tools, not words.
14758
14754
 
14759
14755
  TOOL USAGE:
14760
- - \`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.
14761
14756
  - \`validate\` (tsc + build) is run by the \`codegen-validator\` subagent \u2014 do NOT call it directly; delegate via \`task\` at step 5.
14762
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.
14763
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.
@@ -14780,11 +14775,11 @@ KNOWN WIX APIS (already documented \u2014 do NOT rediscover these from node_modu
14780
14775
  - Dashboard host SDK (toasts, navigation, modals): \`import { dashboard } from "@wix/dashboard"\`.
14781
14776
 
14782
14777
  IMPLEMENTATION WORKFLOW:
14783
- 1. **Plan**: Determine extension types using the \`wix-app\` skill. Generate ALL UUIDs upfront. Include a \`progress\` call (e.g. "Planning extensions").
14784
- 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.
14785
- 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").
14786
- 4. **Register**: Register all extensions in \`src/extensions.ts\`. Include a \`progress\` call (e.g. "Registering extensions").
14787
- 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.
14788
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.
14789
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).
14790
14785
  8. **Stop**: STOP immediately. Do NOT refactor, clean up, or verify.
@@ -14820,12 +14815,6 @@ var require_ask_rules = __commonJS({
14820
14815
  - Use the wix-mcp tools to fetch Wix SDK/API documentation when needed.
14821
14816
  - Provide clear, accurate, and well-structured answers.
14822
14817
 
14823
- TOOL USAGE:
14824
- - \`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:
14825
- - "Reading codebase"
14826
- - "Looking up documentation"
14827
- - "Analyzing code"
14828
-
14829
14818
  IMPORTANT INSTRUCTIONS:
14830
14819
  1. Do NOT edit, write, or create any files.
14831
14820
  2. Do NOT run any bash commands.
@@ -15149,10 +15138,6 @@ var require_config = __commonJS({
15149
15138
  };
15150
15139
  var GIT_CONFLICTS_PERMISSIONS = {
15151
15140
  ...CODEGEN_PERMISSIONS,
15152
- [
15153
- "progress"
15154
- /* OpenCodeTool.Progress */
15155
- ]: "deny",
15156
15141
  [
15157
15142
  "uuid"
15158
15143
  /* OpenCodeTool.Uuid */
@@ -15620,15 +15605,11 @@ var require_progress_handler = __commonJS({
15620
15605
  var logger_12 = require_logger();
15621
15606
  var init_task_1 = require_init_task();
15622
15607
  var ProgressTaskHandler = class {
15623
- async handle(state, ctx) {
15624
- if (state.status !== "completed")
15625
- return;
15608
+ /** Posts one completed progress step (from wrapper-derived progress). */
15609
+ async report(description, ctx) {
15626
15610
  const jobContext = ctx.getJobContext();
15627
15611
  if (!jobContext)
15628
15612
  return;
15629
- const description = state.input?.step;
15630
- if (!description)
15631
- return;
15632
15613
  await (0, init_task_1.completeInitTask)(ctx);
15633
15614
  try {
15634
15615
  await codeGenerationService_12.codeGenerationService.addTask(jobContext.jobId, {
@@ -15653,6 +15634,118 @@ var require_progress_handler = __commonJS({
15653
15634
  }
15654
15635
  });
15655
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
+
15656
15749
  // dist/plugins-runtime.js
15657
15750
  var require_plugins_runtime = __commonJS({
15658
15751
  "dist/plugins-runtime.js"(exports2) {
@@ -15711,11 +15804,12 @@ var require_task_tracker = __commonJS({
15711
15804
  var types_1 = require_types4();
15712
15805
  var logger_12 = require_logger();
15713
15806
  var progress_handler_1 = require_progress_handler();
15807
+ var derived_progress_1 = require_derived_progress();
15714
15808
  var plugins_runtime_1 = require_plugins_runtime();
15715
15809
  var OpenCodeTaskTracker = class {
15716
15810
  constructor(workingDirectory) {
15717
15811
  this.skillsUsed = /* @__PURE__ */ new Set();
15718
- this.progressHandler = new progress_handler_1.ProgressTaskHandler();
15812
+ this.derivedProgress = new derived_progress_1.DerivedProgressReporter(new progress_handler_1.ProgressTaskHandler());
15719
15813
  this.store = job_context_storage_12.jobContextStorage.getStore();
15720
15814
  this.workingDirectory = workingDirectory;
15721
15815
  }
@@ -15752,9 +15846,7 @@ var require_task_tracker = __commonJS({
15752
15846
  if (tool === "skill" && state.status === "completed") {
15753
15847
  this.handleSkillEvent(state);
15754
15848
  }
15755
- if (tool === "progress") {
15756
- void this.progressHandler.handle(state, this.handlerContext);
15757
- }
15849
+ void this.derivedProgress.handle(tool, state, this.handlerContext);
15758
15850
  await (0, plugins_runtime_1.runOnToolUse)((0, plugins_runtime_1.getActivePlugins)(), { tool, state }, logger_12.logger);
15759
15851
  }
15760
15852
  handleSkillEvent(state) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.403",
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": "7f0093b69b369d12caebe68ad44ce1500915876dd072a15fd45e97aa"
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
- });