@wix/ditto-codegen-public 1.0.401 → 1.0.402

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.
Files changed (2) hide show
  1. package/dist/out.js +86 -10
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -11084,6 +11084,16 @@ var require_CodeGenService = __commonJS({
11084
11084
  }));
11085
11085
  return resp.data?.job ?? null;
11086
11086
  };
11087
+ this.handleValidationErrors = async (output, context) => {
11088
+ await this.request((0, http_1.handleValidationErrors)({
11089
+ output,
11090
+ jobId: context?.jobId ?? "",
11091
+ projectId: this.projectId,
11092
+ metasiteId: context?.metasiteId ?? "",
11093
+ costUsd: context?.costUsd,
11094
+ durationMs: context?.durationMs != null ? String(context.durationMs) : void 0
11095
+ }));
11096
+ };
11087
11097
  if (httpClient) {
11088
11098
  this.httpClient = httpClient;
11089
11099
  return;
@@ -11554,16 +11564,16 @@ var require_subagents = __commonJS({
11554
11564
  "dist/opencode-integration/subagents.js"(exports2) {
11555
11565
  "use strict";
11556
11566
  Object.defineProperty(exports2, "__esModule", { value: true });
11557
- exports2.PRIMARY_AGENT_NAME = void 0;
11567
+ exports2.VALIDATOR_SUBAGENT_NAME = exports2.PRIMARY_AGENT_NAME = void 0;
11558
11568
  exports2.getAgentConfig = getAgentConfig;
11559
11569
  var types_1 = require_types4();
11560
11570
  var constants_1 = require_constants5();
11561
11571
  exports2.PRIMARY_AGENT_NAME = "codegen";
11562
- var VALIDATOR_SUBAGENT_NAME = "codegen-validator";
11572
+ exports2.VALIDATOR_SUBAGENT_NAME = "codegen-validator";
11563
11573
  var WIX_DOCS_SUBAGENT_NAME = "codegen-wix-docs";
11564
11574
  var WDS_DOCS_SUBAGENT_NAME = "codegen-wds-docs";
11565
11575
  var VALIDATOR_DESCRIPTION = `Runs validate (tsc + wix build) and fixes the reported errors, consulting the
11566
- wix-app skill / wix-mcp for SDK-shape errors; returns when the build is clean
11576
+ skills or wix-mcp for SDK-shape errors; returns when the build is clean
11567
11577
  or reports what it couldn't fix. Validation step only \u2014 never generates features.`;
11568
11578
  var VALIDATOR_PROMPT = `Run 'validate({ runBuild: true })', fix the errors it reports, and re-run until
11569
11579
  it passes. You are fixing EXISTING code \u2014 do NOT add features or rewrite whole
@@ -11572,12 +11582,16 @@ files. NEVER force a green build by suppressing types: no 'as any', no
11572
11582
  'import { bookings } from "@wix/bookings"') to 'import * as' just to satisfy
11573
11583
  tsc \u2014 that ships code that compiles but breaks at runtime. A type error on a
11574
11584
  Wix SDK method/namespace/parameter means the call is WRONG: look up the correct
11575
- usage via the 'wix-app' skill or wix-mcp ('SearchWixSDKDocumentation' \u2192
11585
+ usage via skills or wix-mcp ('SearchWixSDKDocumentation' \u2192
11576
11586
  'ReadFullDocsMethodSchema') and fix it to the real exported method + its options
11577
11587
  object. Work in a bounded number of fix cycles \u2014 if the build isn't converging
11578
11588
  after a few attempts, STOP and return the remaining errors verbatim rather than
11579
- looping; never silence them.`;
11580
- var WIX_DOCS_DESCRIPTION = `Use ONLY to discover a Wix SDK you don't know and that the wix-app skill +
11589
+ looping; never silence them.
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.)`;
11594
+ var WIX_DOCS_DESCRIPTION = `Use ONLY to discover a Wix SDK you don't know and that the skills +
11581
11595
  KNOWN WIX APIS don't cover. Send ONE complete question; returns the import path
11582
11596
  + exported namespace/method + runtime context + full signature + any required
11583
11597
  scope/permission IDs + a short usage example (not a link). Don't fetch a doc you
@@ -11600,9 +11614,9 @@ the API is limited to one context, say so. For a required scope/permission,
11600
11614
  return the EXACT scope-ID string from the docs (never a guessed format); if none
11601
11615
  is documented, say so.`;
11602
11616
  var WDS_DOCS_DESCRIPTION = `Use ONLY when building dashboard UI and you need a Wix Design System
11603
- component/prop/example you don't know and the wix-app skill doesn't cover.
11617
+ component/prop/example you don't know and the skills don't cover.
11604
11618
  Returns the component name + props + a short usage example. Not for layouts the
11605
- wix-app skill already covers. Read-only.`;
11619
+ skills already cover. Read-only.`;
11606
11620
  var SUBAGENT_DENIED_TOOLS = {
11607
11621
  [
11608
11622
  "task"
@@ -11702,13 +11716,13 @@ wix-app skill already covers. Read-only.`;
11702
11716
  /* OpenCodeTool.Task */
11703
11717
  ]: {
11704
11718
  [types_1.PERMISSION_WILDCARD]: "deny",
11705
- [VALIDATOR_SUBAGENT_NAME]: "allow",
11719
+ [exports2.VALIDATOR_SUBAGENT_NAME]: "allow",
11706
11720
  [WIX_DOCS_SUBAGENT_NAME]: "allow",
11707
11721
  [WDS_DOCS_SUBAGENT_NAME]: "allow"
11708
11722
  }
11709
11723
  }
11710
11724
  },
11711
- [VALIDATOR_SUBAGENT_NAME]: {
11725
+ [exports2.VALIDATOR_SUBAGENT_NAME]: {
11712
11726
  mode: "subagent",
11713
11727
  model: smallModel,
11714
11728
  steps: 40,
@@ -15256,8 +15270,11 @@ var require_parser = __commonJS({
15256
15270
  exports2.parseUsageStats = parseUsageStats;
15257
15271
  exports2.mergeUsageStats = mergeUsageStats;
15258
15272
  exports2.hasSessionError = hasSessionError;
15273
+ exports2.shouldReportValidatorOutput = shouldReportValidatorOutput;
15274
+ exports2.parseValidatorTaskOutputs = parseValidatorTaskOutputs;
15259
15275
  exports2.summarizeOpenCodeLine = summarizeOpenCodeLine;
15260
15276
  var types_1 = require_types4();
15277
+ var subagents_1 = require_subagents();
15261
15278
  function parseRequiredPermissions(output) {
15262
15279
  let permissions = [];
15263
15280
  const lines = output.split("\n");
@@ -15375,6 +15392,26 @@ var require_parser = __commonJS({
15375
15392
  ...input.description && { description: truncate(input.description) }
15376
15393
  };
15377
15394
  }
15395
+ function shouldReportValidatorOutput(output) {
15396
+ return output.includes("NEEDS_INVESTIGATION");
15397
+ }
15398
+ function parseValidatorTaskOutputs(stdout) {
15399
+ const outputs = [];
15400
+ for (const line of stdout.split("\n")) {
15401
+ if (!line.trim())
15402
+ continue;
15403
+ const event = (0, types_1.tryParseJson)(line);
15404
+ if (!event || event.type !== "tool_use" || event.part?.tool !== "task" || event.part?.state?.status !== "completed") {
15405
+ continue;
15406
+ }
15407
+ const { title, output, input } = event.part.state;
15408
+ const isValidator = input?.subagent_type === subagents_1.VALIDATOR_SUBAGENT_NAME || title?.includes(subagents_1.VALIDATOR_SUBAGENT_NAME);
15409
+ if (isValidator && output) {
15410
+ outputs.push(output.trim());
15411
+ }
15412
+ }
15413
+ return outputs;
15414
+ }
15378
15415
  function summarizeOpenCodeLine(line) {
15379
15416
  if (line.type !== "tool_use") {
15380
15417
  return line;
@@ -15957,6 +15994,7 @@ var require_executor = __commonJS({
15957
15994
  var config_12 = require_config();
15958
15995
  var job_context_storage_12 = require_job_context_storage();
15959
15996
  var parser_1 = require_parser();
15997
+ var codeGenerationService_12 = require_codeGenerationService();
15960
15998
  var prompts_1 = require_prompts();
15961
15999
  var git_file_changes_1 = require_git_file_changes();
15962
16000
  var cost_tracker_1 = require_cost_tracker();
@@ -15965,6 +16003,42 @@ var require_executor = __commonJS({
15965
16003
  var process_handlers_1 = require_process_handlers();
15966
16004
  var logger_12 = require_logger();
15967
16005
  var MAX_RETRIES = 5;
16006
+ async function notifyValidatorOutputsToSlack(stdout, costUsd) {
16007
+ try {
16008
+ const store = job_context_storage_12.jobContextStorage.getStore();
16009
+ const outputs = (0, parser_1.parseValidatorTaskOutputs)(stdout);
16010
+ if (outputs.length === 0)
16011
+ return;
16012
+ const durationMs = store?.flowStartTime ? Date.now() - store.flowStartTime : void 0;
16013
+ const context = {
16014
+ jobId: store?.jobId,
16015
+ metasiteId: store?.metasiteId,
16016
+ costUsd: costUsd > 0 ? costUsd : void 0,
16017
+ durationMs
16018
+ };
16019
+ logger_12.logger.info("[OpenCode] Reporting validator outputs to Slack via server", {
16020
+ count: outputs.length,
16021
+ ...context
16022
+ });
16023
+ for (const output of outputs) {
16024
+ if (!(0, parser_1.shouldReportValidatorOutput)(output)) {
16025
+ logger_12.logger.info("[OpenCode] Skipping validator output \u2014 clean build or too few errors");
16026
+ continue;
16027
+ }
16028
+ try {
16029
+ await codeGenerationService_12.codeGenerationService.handleValidationErrors(output, context);
16030
+ } catch (err) {
16031
+ logger_12.logger.warn("[OpenCode] Failed to report validator output to Slack", {
16032
+ error: err instanceof Error ? err.message : String(err)
16033
+ });
16034
+ }
16035
+ }
16036
+ } catch (err) {
16037
+ logger_12.logger.warn("[OpenCode] Unexpected error in notifyValidatorOutputsToSlack", {
16038
+ error: err instanceof Error ? err.message : String(err)
16039
+ });
16040
+ }
16041
+ }
15968
16042
  async function executeOpenCode(options) {
15969
16043
  let lastResult = null;
15970
16044
  let accumulatedUsage = (0, parser_1.createEmptyUsageStats)();
@@ -15999,6 +16073,7 @@ var require_executor = __commonJS({
15999
16073
  skillsUsed: accumulatedSkills
16000
16074
  };
16001
16075
  logger_12.logger.info("[OpenCode] Usage summary", { usage: finalResult2.usage });
16076
+ void notifyValidatorOutputsToSlack(result.stdout, accumulatedUsage.cost);
16002
16077
  return finalResult2;
16003
16078
  }
16004
16079
  lastResult = result;
@@ -16019,6 +16094,7 @@ var require_executor = __commonJS({
16019
16094
  skillsUsed: Array.from(accumulatedSkills)
16020
16095
  };
16021
16096
  logger_12.logger.info("[OpenCode] Usage summary", { usage: finalResult.usage });
16097
+ void notifyValidatorOutputsToSlack(lastResult.stdout, accumulatedUsage.cost);
16022
16098
  return finalResult;
16023
16099
  }
16024
16100
  async function resolveFinalRunCost(usage, options, baselineCost) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.401",
3
+ "version": "1.0.402",
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": "d334a6c2006988703898fcc80ea93c020eff7e47c3f6d7628b2d0e30"
32
+ "falconPackageHash": "8556d9204c6f708d61f1eea28d679376b18a7da3a41be6f4bcfdbffe"
33
33
  }