@wix/ditto-codegen-public 1.0.405 → 1.0.407
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 +230 -32
- 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.`;
|
|
@@ -11595,9 +11600,10 @@ Then summarize each error: message, file, root cause, fix. No diffs.
|
|
|
11595
11600
|
var WIX_DOCS_DESCRIPTION = `Use ONLY to discover a Wix SDK you don't know and that the skills +
|
|
11596
11601
|
KNOWN WIX APIS don't cover. Send ONE complete question; returns the import path
|
|
11597
11602
|
+ exported namespace/method + runtime context + full signature + any required
|
|
11598
|
-
scope/permission IDs +
|
|
11599
|
-
|
|
11600
|
-
|
|
11603
|
+
scope/permission IDs + any user setup prerequisites (dependent app to install,
|
|
11604
|
+
dashboard setting to enable, template to create) + a short usage example (not a
|
|
11605
|
+
link). Don't fetch a doc you already identified, and don't split a lookup into
|
|
11606
|
+
separate search/signature calls. Read-only.`;
|
|
11601
11607
|
var WIX_DOCS_PROMPT = `You research Wix SDK APIs via wix-mcp and report back \u2014 never write app code.
|
|
11602
11608
|
The caller uses DIRECT imports inside an extension that already supplies
|
|
11603
11609
|
auth/host: 'import { <namespace> } from "@wix/<pkg>"; await <namespace>.<method>(<optionsObject>)'
|
|
@@ -11608,12 +11614,17 @@ introduction ('SearchWixSDKDocumentation' \u2192 'ReadFullDocsArticle') to confi
|
|
|
11608
11614
|
it's the RIGHT API and its runtime context \u2014 backend, the dashboard host, or the
|
|
11609
11615
|
site/editor host (host modules like @wix/dashboard work ONLY in their own host);
|
|
11610
11616
|
(2) read 'ReadFullDocsMethodSchema' for the exact exported name and its
|
|
11611
|
-
options-object parameters
|
|
11612
|
-
|
|
11613
|
-
|
|
11614
|
-
|
|
11615
|
-
|
|
11616
|
-
|
|
11617
|
+
options-object parameters; (3) capture any user SETUP prerequisites the docs
|
|
11618
|
+
call out (often a 'Before you begin' section) \u2014 a dependent app that must be
|
|
11619
|
+
installed (e.g. Wix Stores, Members Area), a dashboard setting that must be
|
|
11620
|
+
enabled (e.g. Automations for back-in-stock notifications), or a template/config
|
|
11621
|
+
the user must create first (e.g. a triggered email). Reply with: the import path
|
|
11622
|
+
+ exported namespace/method, the runtime context, the full TypeScript signature,
|
|
11623
|
+
a short usage example \u2014 never a bare link, never 'as any' or a guessed method \u2014
|
|
11624
|
+
and a SETUP STEPS list of the prerequisites from (3) so the main agent can relay
|
|
11625
|
+
them to the user (say 'none' if there are none). If the API is limited to one
|
|
11626
|
+
context, say so. For a required scope/permission, return the EXACT scope-ID
|
|
11627
|
+
string from the docs (never a guessed format); if none is documented, say so.`;
|
|
11617
11628
|
var WDS_DOCS_DESCRIPTION = `Use ONLY when building dashboard UI and you need a Wix Design System
|
|
11618
11629
|
component/prop/example you don't know and the skills don't cover.
|
|
11619
11630
|
Returns the component name + props + a short usage example. Not for layouts the
|
|
@@ -12029,6 +12040,7 @@ var require_dist5 = __commonJS({
|
|
|
12029
12040
|
return check_site_ui_decision_1.createCheckSiteUIDecision;
|
|
12030
12041
|
} });
|
|
12031
12042
|
exports2.appBuilderCodegenConfig = {
|
|
12043
|
+
environmentIdentity: "You generate a Wix CLI app (a code-first Wix app) on a dev machine. The user previews it on a dev site and releases it from the product UI.",
|
|
12032
12044
|
codegenRules: [],
|
|
12033
12045
|
askRules: [],
|
|
12034
12046
|
gitConflictsRules: [],
|
|
@@ -14370,6 +14382,7 @@ var require_dist8 = __commonJS({
|
|
|
14370
14382
|
var codegen_checkpoint_plugin_1 = require_dist6();
|
|
14371
14383
|
var codegen_common_logic_1 = require_dist7();
|
|
14372
14384
|
exports2.studio2CodegenConfig = {
|
|
14385
|
+
environmentIdentity: "You generate code for the user's own live Wix site \u2014 to the user it's just their site, not a separate app they're aware of. Your changes are saved and applied to the site automatically; there is no separate release step.",
|
|
14373
14386
|
codegenRules: [
|
|
14374
14387
|
{ filename: "site-data-layer-rules.md", content: codegen_common_logic_1.SITE_DATA_LAYER_RULES },
|
|
14375
14388
|
{ filename: "studio-2-site-ui-rules.md", content: codegen_common_logic_1.STUDIO_2_SITE_UI_RULES }
|
|
@@ -14723,6 +14736,7 @@ var require_dist10 = __commonJS({
|
|
|
14723
14736
|
var codegen_feature_vibe_plugin_1 = require_dist9();
|
|
14724
14737
|
var codegen_common_logic_1 = require_dist7();
|
|
14725
14738
|
exports2.harmonyCodegenConfig = {
|
|
14739
|
+
environmentIdentity: "You generate code for the user's own live Wix site \u2014 to the user it's just their site, not a separate app they're aware of. Your changes are saved and applied to the site automatically; there is no separate release step.",
|
|
14726
14740
|
codegenRules: [
|
|
14727
14741
|
{ filename: "site-data-layer-rules.md", content: codegen_common_logic_1.SITE_DATA_LAYER_RULES }
|
|
14728
14742
|
],
|
|
@@ -14735,13 +14749,36 @@ var require_dist10 = __commonJS({
|
|
|
14735
14749
|
}
|
|
14736
14750
|
});
|
|
14737
14751
|
|
|
14752
|
+
// dist/opencode-integration/rules/shared-rules.js
|
|
14753
|
+
var require_shared_rules = __commonJS({
|
|
14754
|
+
"dist/opencode-integration/rules/shared-rules.js"(exports2) {
|
|
14755
|
+
"use strict";
|
|
14756
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
14757
|
+
exports2.OUTPUT_MESSAGE_RULES = exports2.BOUNDARY_RULES = void 0;
|
|
14758
|
+
exports2.buildEnvironmentRules = buildEnvironmentRules;
|
|
14759
|
+
function buildEnvironmentRules(environmentIdentity) {
|
|
14760
|
+
return `ENVIRONMENT:
|
|
14761
|
+
${environmentIdentity}`;
|
|
14762
|
+
}
|
|
14763
|
+
exports2.BOUNDARY_RULES = `YOUR BOUNDARIES:
|
|
14764
|
+
- You only write code. You cannot release, publish, upload/download files, or do other product/platform actions for the user \u2014 those are the user's to do in the UI, not yours.
|
|
14765
|
+
- If asked how to do such a product/platform action (download/upload files, release, manage app info, use git or the IDE, etc.), do NOT explain the steps or name specific tools, surfaces, or locations \u2014 it varies by environment and you may be wrong. Just say it's outside what you do (you only write code) and that it's done in the UI, not through code.
|
|
14766
|
+
- Don't mention internal/sandbox details (e.g. paths like \`/user-code\`) \u2014 the user can't see them.`;
|
|
14767
|
+
exports2.OUTPUT_MESSAGE_RULES = `OUTPUT MESSAGE (shown to the user):
|
|
14768
|
+
- Match their technical level: include code/technical detail only if their request was technical; otherwise describe the outcome in plain language (no code, file/type names, or internals).
|
|
14769
|
+
- List any manual setup the user must still do for the feature to work, as short "next steps" (e.g. installing a dependent app or enabling a dashboard setting).
|
|
14770
|
+
- Be honest: if you didn't fully build what was asked (e.g. stored data but didn't send it), say so. Keep it short.`;
|
|
14771
|
+
}
|
|
14772
|
+
});
|
|
14773
|
+
|
|
14738
14774
|
// dist/opencode-integration/rules/codegen-rules.js
|
|
14739
14775
|
var require_codegen_rules = __commonJS({
|
|
14740
14776
|
"dist/opencode-integration/rules/codegen-rules.js"(exports2) {
|
|
14741
14777
|
"use strict";
|
|
14742
14778
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
14743
|
-
exports2.
|
|
14744
|
-
|
|
14779
|
+
exports2.buildCodegenRules = buildCodegenRules;
|
|
14780
|
+
var shared_rules_1 = require_shared_rules();
|
|
14781
|
+
var CODEGEN_CORE_RULES = `CORE PRINCIPLES:
|
|
14745
14782
|
- Do NOT invent or assume new types, modules, functions, props, events, or imports.
|
|
14746
14783
|
- NEVER use mocks, placeholders, debugging, or TODOs in any code.
|
|
14747
14784
|
- ALWAYS implement complete, production-ready functionality.
|
|
@@ -14781,7 +14818,7 @@ IMPLEMENTATION WORKFLOW:
|
|
|
14781
14818
|
4. **Register**: Register all extensions in \`src/extensions.ts\`.
|
|
14782
14819
|
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. VERIFY the subagent actually FINISHED with a clean build: read its returned summary and confirm it converged. If it reports remaining/unresolved errors or was cut off before finishing (e.g. "Maximum steps reached"), do NOT treat it as success \u2014 re-dispatch \`codegen-validator\` to finish the remaining errors before moving on.
|
|
14783
14820
|
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.
|
|
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).
|
|
14821
|
+
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). Do NOT mention permissions/scopes here (see PERMISSIONS) and follow OUTPUT MESSAGE below.
|
|
14785
14822
|
8. **Stop**: STOP immediately. Do NOT refactor, clean up, or verify.
|
|
14786
14823
|
|
|
14787
14824
|
FILE CREATION:
|
|
@@ -14798,7 +14835,16 @@ When you call \`required-permissions\` (see workflow step 6 for when), use SCOPE
|
|
|
14798
14835
|
- Embedded scripts \u2192 "SCOPE.DC-APPS.MANAGE-EMBEDDED-SCRIPTS"
|
|
14799
14836
|
|
|
14800
14837
|
CRITICAL: Only include permissions you have explicitly seen in the Wix SDK documentation (via MCP or loaded skills) \u2014 NEVER guess or infer a scope ID. If you cannot point to where you saw it, do NOT include it. When in doubt, skip the call entirely. A fabricated scope ID will show an error to the user and confuse them; a missing permission is just a warning the user can fix.
|
|
14801
|
-
|
|
14838
|
+
|
|
14839
|
+
The \`required-permissions\` tool records and surfaces permissions to the user automatically \u2014 NEVER mention permissions/scopes (IDs or names) in your output, or tell the user to grant them.`;
|
|
14840
|
+
function buildCodegenRules(environmentIdentity) {
|
|
14841
|
+
return [
|
|
14842
|
+
(0, shared_rules_1.buildEnvironmentRules)(environmentIdentity),
|
|
14843
|
+
shared_rules_1.BOUNDARY_RULES,
|
|
14844
|
+
CODEGEN_CORE_RULES,
|
|
14845
|
+
shared_rules_1.OUTPUT_MESSAGE_RULES
|
|
14846
|
+
].join("\n\n");
|
|
14847
|
+
}
|
|
14802
14848
|
}
|
|
14803
14849
|
});
|
|
14804
14850
|
|
|
@@ -14807,8 +14853,9 @@ var require_ask_rules = __commonJS({
|
|
|
14807
14853
|
"dist/opencode-integration/rules/ask-rules.js"(exports2) {
|
|
14808
14854
|
"use strict";
|
|
14809
14855
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
14810
|
-
exports2.
|
|
14811
|
-
|
|
14856
|
+
exports2.buildAskRules = buildAskRules;
|
|
14857
|
+
var shared_rules_1 = require_shared_rules();
|
|
14858
|
+
var ASK_CORE_RULES = `CORE PRINCIPLES:
|
|
14812
14859
|
- You are a READ-ONLY assistant. You MUST NOT modify, create, or delete any files.
|
|
14813
14860
|
- Your job is to answer questions about the codebase and Wix platform by reading code and fetching documentation.
|
|
14814
14861
|
- Use the read tool to explore the codebase and find relevant code.
|
|
@@ -14828,6 +14875,14 @@ DEBUGGING GUIDANCE:
|
|
|
14828
14875
|
- Browser DevTools: the Console, Network, and Sources tabs.
|
|
14829
14876
|
- \`console.log\` statements, then read the output in the already-running server logs.
|
|
14830
14877
|
- Inspecting network requests in the browser, without starting a new server.`;
|
|
14878
|
+
function buildAskRules(environmentIdentity) {
|
|
14879
|
+
return [
|
|
14880
|
+
(0, shared_rules_1.buildEnvironmentRules)(environmentIdentity),
|
|
14881
|
+
shared_rules_1.BOUNDARY_RULES,
|
|
14882
|
+
ASK_CORE_RULES,
|
|
14883
|
+
shared_rules_1.OUTPUT_MESSAGE_RULES
|
|
14884
|
+
].join("\n\n");
|
|
14885
|
+
}
|
|
14831
14886
|
}
|
|
14832
14887
|
});
|
|
14833
14888
|
|
|
@@ -14988,24 +15043,26 @@ var require_environments = __commonJS({
|
|
|
14988
15043
|
var git_conflicts_rules_1 = require_git_conflicts_rules();
|
|
14989
15044
|
var job_decision_manager_1 = require_job_decision_manager();
|
|
14990
15045
|
var logger_12 = require_logger();
|
|
14991
|
-
var SHARED_CODEGEN_RULE = {
|
|
14992
|
-
filename: "codegen-instructions.md",
|
|
14993
|
-
content: codegen_rules_1.CODEGEN_RULES
|
|
14994
|
-
};
|
|
14995
|
-
var SHARED_ASK_RULE = {
|
|
14996
|
-
filename: "ask-instructions.md",
|
|
14997
|
-
content: ask_rules_1.ASK_RULES
|
|
14998
|
-
};
|
|
14999
15046
|
var SHARED_GIT_CONFLICTS_RULE = {
|
|
15000
15047
|
filename: "git-conflicts-instructions.md",
|
|
15001
15048
|
content: git_conflicts_rules_1.GIT_CONFLICTS_RULES
|
|
15002
15049
|
};
|
|
15003
|
-
var withSharedRules = (env) =>
|
|
15004
|
-
|
|
15005
|
-
|
|
15006
|
-
|
|
15007
|
-
|
|
15008
|
-
|
|
15050
|
+
var withSharedRules = (env) => {
|
|
15051
|
+
const sharedCodegenRule = {
|
|
15052
|
+
filename: "codegen-instructions.md",
|
|
15053
|
+
content: (0, codegen_rules_1.buildCodegenRules)(env.environmentIdentity)
|
|
15054
|
+
};
|
|
15055
|
+
const sharedAskRule = {
|
|
15056
|
+
filename: "ask-instructions.md",
|
|
15057
|
+
content: (0, ask_rules_1.buildAskRules)(env.environmentIdentity)
|
|
15058
|
+
};
|
|
15059
|
+
return {
|
|
15060
|
+
...env,
|
|
15061
|
+
codegenRules: [sharedCodegenRule, ...env.codegenRules],
|
|
15062
|
+
askRules: [sharedAskRule, ...env.askRules],
|
|
15063
|
+
gitConflictsRules: [SHARED_GIT_CONFLICTS_RULE, ...env.gitConflictsRules]
|
|
15064
|
+
};
|
|
15065
|
+
};
|
|
15009
15066
|
function getCodegenEnvironmentConfig() {
|
|
15010
15067
|
switch (process.env.CODEGEN_ENVIRONMENT) {
|
|
15011
15068
|
case types_1.Environment.STUDIO_2:
|
|
@@ -15245,6 +15302,144 @@ var require_config = __commonJS({
|
|
|
15245
15302
|
}
|
|
15246
15303
|
});
|
|
15247
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
|
+
|
|
15248
15443
|
// dist/opencode-integration/parser.js
|
|
15249
15444
|
var require_parser = __commonJS({
|
|
15250
15445
|
"dist/opencode-integration/parser.js"(exports2) {
|
|
@@ -15262,6 +15457,7 @@ var require_parser = __commonJS({
|
|
|
15262
15457
|
exports2.summarizeOpenCodeLine = summarizeOpenCodeLine;
|
|
15263
15458
|
var types_1 = require_types4();
|
|
15264
15459
|
var subagents_1 = require_subagents();
|
|
15460
|
+
var subagent_tool_logger_12 = require_subagent_tool_logger();
|
|
15265
15461
|
function parseRequiredPermissions(output) {
|
|
15266
15462
|
let permissions = [];
|
|
15267
15463
|
const lines = output.split("\n");
|
|
@@ -15404,7 +15600,7 @@ var require_parser = __commonJS({
|
|
|
15404
15600
|
return outputs;
|
|
15405
15601
|
}
|
|
15406
15602
|
function summarizeOpenCodeLine(line) {
|
|
15407
|
-
if (line.type !== "tool_use") {
|
|
15603
|
+
if (line.type !== "tool_use" && line.type !== subagent_tool_logger_12.SUBAGENT_TOOL_EVENT_TYPE) {
|
|
15408
15604
|
return line;
|
|
15409
15605
|
}
|
|
15410
15606
|
const { part } = line;
|
|
@@ -22814,6 +23010,7 @@ var skills_installer_1 = require_skills_installer();
|
|
|
22814
23010
|
var rules_writer_1 = require_rules_writer();
|
|
22815
23011
|
var tools_writer_1 = require_tools_writer();
|
|
22816
23012
|
var node_modules_guard_1 = require_node_modules_guard();
|
|
23013
|
+
var subagent_tool_logger_1 = require_subagent_tool_logger();
|
|
22817
23014
|
var plugin_artifacts_1 = require_plugin_artifacts();
|
|
22818
23015
|
var config_1 = require_config();
|
|
22819
23016
|
var environments_1 = require_environments();
|
|
@@ -22887,7 +23084,8 @@ async function initOpenCode() {
|
|
|
22887
23084
|
]),
|
|
22888
23085
|
(0, skills_installer_1.applySkillsOverride)((0, codegen_flow_helpers_1.getOutputPath)(), logger_1.logger),
|
|
22889
23086
|
(0, tools_writer_1.writeToolFiles)(pluginArtifacts.tools),
|
|
22890
|
-
(0, node_modules_guard_1.writeGuardPlugin)()
|
|
23087
|
+
(0, node_modules_guard_1.writeGuardPlugin)(),
|
|
23088
|
+
(0, subagent_tool_logger_1.writeSubagentToolLoggerPlugin)()
|
|
22891
23089
|
]);
|
|
22892
23090
|
}
|
|
22893
23091
|
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.
|
|
3
|
+
"version": "1.0.407",
|
|
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": "
|
|
32
|
+
"falconPackageHash": "5263f96dd353d10c30f46a86ba26c43cfc4901eadfadc6bb73b7db9f"
|
|
33
33
|
}
|