@wix/ditto-codegen-public 1.0.406 → 1.0.408

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 +152 -3
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -11564,7 +11564,7 @@ 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.WDS_DOCS_SUBAGENT_NAME = exports2.WIX_DOCS_SUBAGENT_NAME = exports2.VALIDATOR_SUBAGENT_NAME = exports2.PRIMARY_AGENT_NAME = void 0;
11567
+ exports2.SUBAGENT_AGENT_NAMES = 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();
@@ -11572,6 +11572,11 @@ var require_subagents = __commonJS({
11572
11572
  exports2.VALIDATOR_SUBAGENT_NAME = "codegen-validator";
11573
11573
  exports2.WIX_DOCS_SUBAGENT_NAME = "codegen-wix-docs";
11574
11574
  exports2.WDS_DOCS_SUBAGENT_NAME = "codegen-wds-docs";
11575
+ exports2.SUBAGENT_AGENT_NAMES = [
11576
+ exports2.VALIDATOR_SUBAGENT_NAME,
11577
+ exports2.WIX_DOCS_SUBAGENT_NAME,
11578
+ exports2.WDS_DOCS_SUBAGENT_NAME
11579
+ ];
11575
11580
  var VALIDATOR_DESCRIPTION = `Runs validate (tsc + wix build) and fixes the reported errors, consulting the
11576
11581
  skills or wix-mcp for SDK-shape errors; returns when the build is clean
11577
11582
  or reports what it couldn't fix. Validation step only \u2014 never generates features.`;
@@ -15297,6 +15302,144 @@ var require_config = __commonJS({
15297
15302
  }
15298
15303
  });
15299
15304
 
15305
+ // dist/opencode-integration/subagent-tool-logger.js
15306
+ var require_subagent_tool_logger = __commonJS({
15307
+ "dist/opencode-integration/subagent-tool-logger.js"(exports2) {
15308
+ "use strict";
15309
+ Object.defineProperty(exports2, "__esModule", { value: true });
15310
+ exports2.SUBAGENT_TOOL_LOGGER_PLUGIN_PATH = exports2.SUBAGENT_STARTED_EVENT_TYPE = exports2.SUBAGENT_TOOL_EVENT_TYPE = void 0;
15311
+ exports2.buildSubagentToolLoggerPluginSource = buildSubagentToolLoggerPluginSource;
15312
+ exports2.writeSubagentToolLoggerPlugin = writeSubagentToolLoggerPlugin;
15313
+ var promises_1 = require("fs/promises");
15314
+ var os_1 = require("os");
15315
+ var path_1 = require("path");
15316
+ var logger_12 = require_logger();
15317
+ var subagents_1 = require_subagents();
15318
+ exports2.SUBAGENT_TOOL_EVENT_TYPE = "subagent_tool_use";
15319
+ exports2.SUBAGENT_STARTED_EVENT_TYPE = "subagent_started";
15320
+ var GLOBAL_PLUGIN_DIR = (0, path_1.join)((0, os_1.homedir)(), ".config", "opencode", "plugin");
15321
+ var PLUGIN_FILENAME = "subagent-tool-logger.ts";
15322
+ exports2.SUBAGENT_TOOL_LOGGER_PLUGIN_PATH = (0, path_1.join)(GLOBAL_PLUGIN_DIR, PLUGIN_FILENAME);
15323
+ function buildSubagentToolLoggerPluginSource() {
15324
+ return `// Generated by @wix/ditto-codegen (subagent-tool-logger) \u2014 do not edit.
15325
+ const EVENT_TYPE = ${JSON.stringify(exports2.SUBAGENT_TOOL_EVENT_TYPE)};
15326
+ const STARTED_EVENT_TYPE = ${JSON.stringify(exports2.SUBAGENT_STARTED_EVENT_TYPE)};
15327
+ const SUBAGENT_AGENTS = new Set(${JSON.stringify(subagents_1.SUBAGENT_AGENT_NAMES)});
15328
+
15329
+ export const SubagentToolLogger = async () => {
15330
+ // sessionID -> agent name, learned from session.* / message.updated (both
15331
+ // fire before the session's tool parts). Root/primary parts keep the primary
15332
+ // agent name and are never emitted here \u2014 'opencode run' already logs them.
15333
+ const agentBySession = new Map();
15334
+ // callID:status dedupe \u2014 a part can update to a terminal status more than once.
15335
+ const emitted = new Set();
15336
+ // sessions we've already emitted a start marker for (events repeat).
15337
+ const started = new Set();
15338
+
15339
+ // Emit the start marker once per subagent session, stamped with opencode's
15340
+ // own creation time \u2014 NOT the plugin's observation time (Date.now), which
15341
+ // only reflects when this event loop happened to process the event.
15342
+ const emitStart = (sid, agent, model, createdAt) => {
15343
+ if (!sid || started.has(sid)) return;
15344
+ started.add(sid);
15345
+ process.stdout.write(
15346
+ JSON.stringify({
15347
+ type: STARTED_EVENT_TYPE,
15348
+ timestamp: createdAt || Date.now(),
15349
+ exactTime: createdAt != null,
15350
+ sessionID: sid,
15351
+ agent,
15352
+ ...(model ? { model } : {}),
15353
+ }) + "\\n",
15354
+ );
15355
+ };
15356
+
15357
+ return {
15358
+ event: async ({ event }) => {
15359
+ try {
15360
+ if (!event) return;
15361
+
15362
+ // Most exact start signal: the child session's own creation time.
15363
+ // Session.Info carries parentID (set => it is a subagent child),
15364
+ // agent, model, and time.created (epoch ms, stamped at creation).
15365
+ if (event.type === "session.created" || event.type === "session.updated") {
15366
+ const info = event.properties?.info;
15367
+ if (!info?.parentID) return; // only subagent (child) sessions
15368
+ const agent = info.agent;
15369
+ if (!agent || !SUBAGENT_AGENTS.has(agent)) return;
15370
+ agentBySession.set(info.id, agent);
15371
+ emitStart(info.id, agent, info.model?.id, info.time?.created);
15372
+ return;
15373
+ }
15374
+
15375
+ if (event.type === "message.updated") {
15376
+ const info = event.properties?.info;
15377
+ const sid = event.properties?.sessionID;
15378
+ const agent = info?.agent;
15379
+ if (!sid || !agent) return;
15380
+ agentBySession.set(sid, agent);
15381
+ // Fallback if session.* was not delivered: the child's first
15382
+ // assistant message creation time (also opencode-stamped).
15383
+ if (SUBAGENT_AGENTS.has(agent)) {
15384
+ emitStart(sid, agent, info.modelID, info.time?.created);
15385
+ }
15386
+ return;
15387
+ }
15388
+
15389
+ if (event.type !== "message.part.updated") return;
15390
+ const part = event.properties?.part;
15391
+ if (part?.type !== "tool") return;
15392
+
15393
+ const status = part.state?.status;
15394
+ if (status !== "completed" && status !== "error") return;
15395
+
15396
+ const agent = agentBySession.get(part.sessionID);
15397
+ if (!agent || !SUBAGENT_AGENTS.has(agent)) return;
15398
+
15399
+ const key = part.callID + ":" + status;
15400
+ if (emitted.has(key)) return;
15401
+ emitted.add(key);
15402
+
15403
+ const state = part.state || {};
15404
+ // Emit raw \u2014 parser.ts summarizeOpenCodeLine trims input/output before
15405
+ // Panorama. part.time.{start,end} are opencode-stamped; prefer over Date.now.
15406
+ process.stdout.write(
15407
+ JSON.stringify({
15408
+ type: EVENT_TYPE,
15409
+ timestamp: part.time?.end || Date.now(),
15410
+ sessionID: part.sessionID,
15411
+ agent,
15412
+ part: {
15413
+ tool: part.tool,
15414
+ callID: part.callID,
15415
+ ...(part.time ? { time: part.time } : {}),
15416
+ state: {
15417
+ status,
15418
+ ...(state.input ? { input: state.input } : {}),
15419
+ ...(state.output ? { output: state.output } : {}),
15420
+ ...(state.title ? { title: state.title } : {}),
15421
+ },
15422
+ },
15423
+ }) + "\\n",
15424
+ );
15425
+ } catch {
15426
+ // Logging must never interfere with the run.
15427
+ }
15428
+ },
15429
+ };
15430
+ };
15431
+ `;
15432
+ }
15433
+ async function writeSubagentToolLoggerPlugin() {
15434
+ await (0, promises_1.mkdir)(GLOBAL_PLUGIN_DIR, { recursive: true });
15435
+ await (0, promises_1.writeFile)(exports2.SUBAGENT_TOOL_LOGGER_PLUGIN_PATH, buildSubagentToolLoggerPluginSource(), "utf-8");
15436
+ logger_12.logger.info("[OpenCode] Wrote subagent tool logger plugin", {
15437
+ path: exports2.SUBAGENT_TOOL_LOGGER_PLUGIN_PATH
15438
+ });
15439
+ }
15440
+ }
15441
+ });
15442
+
15300
15443
  // dist/opencode-integration/parser.js
15301
15444
  var require_parser = __commonJS({
15302
15445
  "dist/opencode-integration/parser.js"(exports2) {
@@ -15314,6 +15457,7 @@ var require_parser = __commonJS({
15314
15457
  exports2.summarizeOpenCodeLine = summarizeOpenCodeLine;
15315
15458
  var types_1 = require_types4();
15316
15459
  var subagents_1 = require_subagents();
15460
+ var subagent_tool_logger_12 = require_subagent_tool_logger();
15317
15461
  function parseRequiredPermissions(output) {
15318
15462
  let permissions = [];
15319
15463
  const lines = output.split("\n");
@@ -15456,7 +15600,7 @@ var require_parser = __commonJS({
15456
15600
  return outputs;
15457
15601
  }
15458
15602
  function summarizeOpenCodeLine(line) {
15459
- if (line.type !== "tool_use") {
15603
+ if (line.type !== "tool_use" && line.type !== subagent_tool_logger_12.SUBAGENT_TOOL_EVENT_TYPE) {
15460
15604
  return line;
15461
15605
  }
15462
15606
  const { part } = line;
@@ -21639,6 +21783,7 @@ var require_biEvents = __commonJS({
21639
21783
  dev_machine_session_id: report.devMachineSessionId,
21640
21784
  run_kind: report.runKind,
21641
21785
  environment: report.environment,
21786
+ app_id: report.appId,
21642
21787
  msid: report.msid
21643
21788
  };
21644
21789
  logger_12.logger.info("Reporting BI event 299 (generic session start)", codegenAgentParams);
@@ -21682,6 +21827,7 @@ var require_biEvents = __commonJS({
21682
21827
  dev_machine_session_id: report.devMachineSessionId,
21683
21828
  run_kind: report.runKind,
21684
21829
  environment: report.environment,
21830
+ app_id: report.appId,
21685
21831
  agent_output: report.agentOutput,
21686
21832
  job_status: report.taskStatus ? JOB_STATUS_MAP[report.taskStatus] ?? report.taskStatus : void 0,
21687
21833
  job_skills_used: report.skillsUsed ? skillsArrayToMap(report.skillsUsed) : void 0,
@@ -21728,6 +21874,7 @@ var require_biEvents = __commonJS({
21728
21874
  dev_machine_session_id: report.devMachineSessionId,
21729
21875
  run_kind: report.runKind,
21730
21876
  environment: report.environment,
21877
+ app_id: report.appId,
21731
21878
  agent_output: report.agentOutput,
21732
21879
  error_desc: report.errorDesc,
21733
21880
  error_massage: report.errorMessage,
@@ -22866,6 +23013,7 @@ var skills_installer_1 = require_skills_installer();
22866
23013
  var rules_writer_1 = require_rules_writer();
22867
23014
  var tools_writer_1 = require_tools_writer();
22868
23015
  var node_modules_guard_1 = require_node_modules_guard();
23016
+ var subagent_tool_logger_1 = require_subagent_tool_logger();
22869
23017
  var plugin_artifacts_1 = require_plugin_artifacts();
22870
23018
  var config_1 = require_config();
22871
23019
  var environments_1 = require_environments();
@@ -22939,7 +23087,8 @@ async function initOpenCode() {
22939
23087
  ]),
22940
23088
  (0, skills_installer_1.applySkillsOverride)((0, codegen_flow_helpers_1.getOutputPath)(), logger_1.logger),
22941
23089
  (0, tools_writer_1.writeToolFiles)(pluginArtifacts.tools),
22942
- (0, node_modules_guard_1.writeGuardPlugin)()
23090
+ (0, node_modules_guard_1.writeGuardPlugin)(),
23091
+ (0, subagent_tool_logger_1.writeSubagentToolLoggerPlugin)()
22943
23092
  ]);
22944
23093
  }
22945
23094
  async function main(ctx) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.406",
3
+ "version": "1.0.408",
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": "9524fe7789f8c47fddc924848695ccae0c7bf2bc332a8d29bfcdc0e5"
32
+ "falconPackageHash": "4b64ba2a210fb2af7b1d174f35282c93f727d9cf617977cbf8228a4e"
33
33
  }