@wix/ditto-codegen-public 1.0.401 → 1.0.403

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 +93 -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,17 @@ 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, 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.)`;
11595
+ var WIX_DOCS_DESCRIPTION = `Use ONLY to discover a Wix SDK you don't know and that the skills +
11581
11596
  KNOWN WIX APIS don't cover. Send ONE complete question; returns the import path
11582
11597
  + exported namespace/method + runtime context + full signature + any required
11583
11598
  scope/permission IDs + a short usage example (not a link). Don't fetch a doc you
@@ -11600,9 +11615,9 @@ the API is limited to one context, say so. For a required scope/permission,
11600
11615
  return the EXACT scope-ID string from the docs (never a guessed format); if none
11601
11616
  is documented, say so.`;
11602
11617
  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.
11618
+ component/prop/example you don't know and the skills don't cover.
11604
11619
  Returns the component name + props + a short usage example. Not for layouts the
11605
- wix-app skill already covers. Read-only.`;
11620
+ skills already cover. Read-only.`;
11606
11621
  var SUBAGENT_DENIED_TOOLS = {
11607
11622
  [
11608
11623
  "task"
@@ -11702,13 +11717,13 @@ wix-app skill already covers. Read-only.`;
11702
11717
  /* OpenCodeTool.Task */
11703
11718
  ]: {
11704
11719
  [types_1.PERMISSION_WILDCARD]: "deny",
11705
- [VALIDATOR_SUBAGENT_NAME]: "allow",
11720
+ [exports2.VALIDATOR_SUBAGENT_NAME]: "allow",
11706
11721
  [WIX_DOCS_SUBAGENT_NAME]: "allow",
11707
11722
  [WDS_DOCS_SUBAGENT_NAME]: "allow"
11708
11723
  }
11709
11724
  }
11710
11725
  },
11711
- [VALIDATOR_SUBAGENT_NAME]: {
11726
+ [exports2.VALIDATOR_SUBAGENT_NAME]: {
11712
11727
  mode: "subagent",
11713
11728
  model: smallModel,
11714
11729
  steps: 40,
@@ -15256,8 +15271,11 @@ var require_parser = __commonJS({
15256
15271
  exports2.parseUsageStats = parseUsageStats;
15257
15272
  exports2.mergeUsageStats = mergeUsageStats;
15258
15273
  exports2.hasSessionError = hasSessionError;
15274
+ exports2.shouldReportValidatorOutput = shouldReportValidatorOutput;
15275
+ exports2.parseValidatorTaskOutputs = parseValidatorTaskOutputs;
15259
15276
  exports2.summarizeOpenCodeLine = summarizeOpenCodeLine;
15260
15277
  var types_1 = require_types4();
15278
+ var subagents_1 = require_subagents();
15261
15279
  function parseRequiredPermissions(output) {
15262
15280
  let permissions = [];
15263
15281
  const lines = output.split("\n");
@@ -15375,6 +15393,26 @@ var require_parser = __commonJS({
15375
15393
  ...input.description && { description: truncate(input.description) }
15376
15394
  };
15377
15395
  }
15396
+ function shouldReportValidatorOutput(output) {
15397
+ return output.includes("NEEDS_INVESTIGATION");
15398
+ }
15399
+ function parseValidatorTaskOutputs(stdout) {
15400
+ const outputs = [];
15401
+ for (const line of stdout.split("\n")) {
15402
+ if (!line.trim())
15403
+ continue;
15404
+ const event = (0, types_1.tryParseJson)(line);
15405
+ if (!event || event.type !== "tool_use" || event.part?.tool !== "task" || event.part?.state?.status !== "completed") {
15406
+ continue;
15407
+ }
15408
+ const { title, output, input } = event.part.state;
15409
+ const isValidator = input?.subagent_type === subagents_1.VALIDATOR_SUBAGENT_NAME || title?.includes(subagents_1.VALIDATOR_SUBAGENT_NAME);
15410
+ if (isValidator && output) {
15411
+ outputs.push(output.trim());
15412
+ }
15413
+ }
15414
+ return outputs;
15415
+ }
15378
15416
  function summarizeOpenCodeLine(line) {
15379
15417
  if (line.type !== "tool_use") {
15380
15418
  return line;
@@ -15950,6 +15988,7 @@ var require_executor = __commonJS({
15950
15988
  "dist/opencode-integration/executor.js"(exports2) {
15951
15989
  "use strict";
15952
15990
  Object.defineProperty(exports2, "__esModule", { value: true });
15991
+ exports2.notifyValidatorOutputsToSlack = notifyValidatorOutputsToSlack;
15953
15992
  exports2.executeOpenCode = executeOpenCode;
15954
15993
  exports2.resolveFinalRunCost = resolveFinalRunCost;
15955
15994
  var child_process_1 = require("child_process");
@@ -15957,6 +15996,7 @@ var require_executor = __commonJS({
15957
15996
  var config_12 = require_config();
15958
15997
  var job_context_storage_12 = require_job_context_storage();
15959
15998
  var parser_1 = require_parser();
15999
+ var codeGenerationService_12 = require_codeGenerationService();
15960
16000
  var prompts_1 = require_prompts();
15961
16001
  var git_file_changes_1 = require_git_file_changes();
15962
16002
  var cost_tracker_1 = require_cost_tracker();
@@ -15965,6 +16005,42 @@ var require_executor = __commonJS({
15965
16005
  var process_handlers_1 = require_process_handlers();
15966
16006
  var logger_12 = require_logger();
15967
16007
  var MAX_RETRIES = 5;
16008
+ async function notifyValidatorOutputsToSlack(stdout, costUsd) {
16009
+ try {
16010
+ const store = job_context_storage_12.jobContextStorage.getStore();
16011
+ const outputs = (0, parser_1.parseValidatorTaskOutputs)(stdout);
16012
+ if (outputs.length === 0)
16013
+ return;
16014
+ const durationMs = store?.flowStartTime ? Date.now() - store.flowStartTime : void 0;
16015
+ const context = {
16016
+ jobId: store?.jobId,
16017
+ metasiteId: store?.metasiteId,
16018
+ costUsd: costUsd > 0 ? costUsd : void 0,
16019
+ durationMs
16020
+ };
16021
+ logger_12.logger.info("[OpenCode] Reporting validator outputs to Slack via server", {
16022
+ count: outputs.length,
16023
+ ...context
16024
+ });
16025
+ for (const output of outputs) {
16026
+ if (!(0, parser_1.shouldReportValidatorOutput)(output)) {
16027
+ logger_12.logger.info("[OpenCode] Skipping validator output \u2014 clean build or too few errors");
16028
+ continue;
16029
+ }
16030
+ try {
16031
+ await codeGenerationService_12.codeGenerationService.handleValidationErrors(output, context);
16032
+ } catch (err) {
16033
+ logger_12.logger.warn("[OpenCode] Failed to report validator output to Slack", {
16034
+ error: err instanceof Error ? err.message : String(err)
16035
+ });
16036
+ }
16037
+ }
16038
+ } catch (err) {
16039
+ logger_12.logger.warn("[OpenCode] Unexpected error in notifyValidatorOutputsToSlack", {
16040
+ error: err instanceof Error ? err.message : String(err)
16041
+ });
16042
+ }
16043
+ }
15968
16044
  async function executeOpenCode(options) {
15969
16045
  let lastResult = null;
15970
16046
  let accumulatedUsage = (0, parser_1.createEmptyUsageStats)();
@@ -15999,6 +16075,7 @@ var require_executor = __commonJS({
15999
16075
  skillsUsed: accumulatedSkills
16000
16076
  };
16001
16077
  logger_12.logger.info("[OpenCode] Usage summary", { usage: finalResult2.usage });
16078
+ void notifyValidatorOutputsToSlack(result.stdout, accumulatedUsage.cost);
16002
16079
  return finalResult2;
16003
16080
  }
16004
16081
  lastResult = result;
@@ -16019,6 +16096,7 @@ var require_executor = __commonJS({
16019
16096
  skillsUsed: Array.from(accumulatedSkills)
16020
16097
  };
16021
16098
  logger_12.logger.info("[OpenCode] Usage summary", { usage: finalResult.usage });
16099
+ void notifyValidatorOutputsToSlack(lastResult.stdout, accumulatedUsage.cost);
16022
16100
  return finalResult;
16023
16101
  }
16024
16102
  async function resolveFinalRunCost(usage, options, baselineCost) {
@@ -16333,6 +16411,7 @@ var require_OpenCodeOrchestrator = __commonJS({
16333
16411
  }
16334
16412
  });
16335
16413
  this.lastUsage = result.usage;
16414
+ this.lastStdout = result.stdout;
16336
16415
  const durationMs = Date.now() - start;
16337
16416
  if (!result.success) {
16338
16417
  this.emitEvent("opencode:error", {
@@ -21565,6 +21644,7 @@ var require_opencode_init = __commonJS({
21565
21644
  var inject_created_by_1 = require_inject_created_by();
21566
21645
  var collect_extensions_created_1 = require_collect_extensions_created();
21567
21646
  var biEvents_1 = require_biEvents();
21647
+ var executor_1 = require_executor();
21568
21648
  var pre_run_decision_1 = require_pre_run_decision();
21569
21649
  var environments_12 = require_environments();
21570
21650
  var plugins_runtime_1 = require_plugins_runtime();
@@ -21629,6 +21709,9 @@ var require_opencode_init = __commonJS({
21629
21709
  ...agentOutput,
21630
21710
  extensions
21631
21711
  });
21712
+ if (orchestrator.lastStdout) {
21713
+ void (0, executor_1.notifyValidatorOutputsToSlack)(orchestrator.lastStdout, result.usage.cost);
21714
+ }
21632
21715
  if (!store.isCompleted) {
21633
21716
  await codeGenerationService_12.codeGenerationService.updateTask(jobId, taskId, ditto_codegen_types_12.Status.COMPLETED, {});
21634
21717
  }
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.403",
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": "7f0093b69b369d12caebe68ad44ce1500915876dd072a15fd45e97aa"
33
33
  }