@wix/ditto-codegen-public 1.0.414 → 1.0.416
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.
|
@@ -16,13 +16,14 @@ async function existingFileSize(path: string): Promise<number | null> {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
// Keep in sync with normalize-tool-string.ts. Only whitespace/control escapes
|
|
20
|
+
// are unescaped; `\"` and `\\` are NOT, or legitimate escaped quotes/backslashes
|
|
21
|
+
// in the content (e.g. "C:\\Users", /\\d+/) would be silently corrupted.
|
|
19
22
|
function unescapeString(str: string): string {
|
|
20
|
-
return str.replace(/\\(n|t|r
|
|
23
|
+
return str.replace(/\\(n|t|r)/g, (_, c: string) => {
|
|
21
24
|
if (c === "n") return "\n";
|
|
22
25
|
if (c === "t") return "\t";
|
|
23
|
-
|
|
24
|
-
if (c === '"') return '"';
|
|
25
|
-
return "\\";
|
|
26
|
+
return "\r";
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
|
|
@@ -2,13 +2,14 @@ import { tool } from "@opencode-ai/plugin";
|
|
|
2
2
|
import { readFile, writeFile } from "fs/promises";
|
|
3
3
|
import { join, isAbsolute } from "path";
|
|
4
4
|
|
|
5
|
+
// Keep in sync with normalize-tool-string.ts. Only whitespace/control escapes
|
|
6
|
+
// are unescaped; `\"` and `\\` are NOT, or legitimate escaped quotes/backslashes
|
|
7
|
+
// in the content (e.g. "C:\\Users", /\\d+/) would be silently corrupted.
|
|
5
8
|
function unescapeString(str: string): string {
|
|
6
|
-
return str.replace(/\\(n|t|r
|
|
9
|
+
return str.replace(/\\(n|t|r)/g, (_, c: string) => {
|
|
7
10
|
if (c === "n") return "\n";
|
|
8
11
|
if (c === "t") return "\t";
|
|
9
|
-
|
|
10
|
-
if (c === '"') return '"';
|
|
11
|
-
return "\\";
|
|
12
|
+
return "\r";
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
15
|
|
package/dist/out.js
CHANGED
|
@@ -6665,18 +6665,30 @@ var require_http_impl = __commonJS({
|
|
|
6665
6665
|
{
|
|
6666
6666
|
srcPath: "/_api/codegen-server",
|
|
6667
6667
|
destPath: ""
|
|
6668
|
+
},
|
|
6669
|
+
{
|
|
6670
|
+
srcPath: "/_api/codegen-server/open-in-editor",
|
|
6671
|
+
destPath: ""
|
|
6668
6672
|
}
|
|
6669
6673
|
],
|
|
6670
6674
|
"wixbo.ai": [
|
|
6671
6675
|
{
|
|
6672
6676
|
srcPath: "/_api/codegen-server",
|
|
6673
6677
|
destPath: ""
|
|
6678
|
+
},
|
|
6679
|
+
{
|
|
6680
|
+
srcPath: "/_api/codegen-server/open-in-editor",
|
|
6681
|
+
destPath: ""
|
|
6674
6682
|
}
|
|
6675
6683
|
],
|
|
6676
6684
|
"wix-bo.com": [
|
|
6677
6685
|
{
|
|
6678
6686
|
srcPath: "/_api/codegen-server",
|
|
6679
6687
|
destPath: ""
|
|
6688
|
+
},
|
|
6689
|
+
{
|
|
6690
|
+
srcPath: "/_api/codegen-server/open-in-editor",
|
|
6691
|
+
destPath: ""
|
|
6680
6692
|
}
|
|
6681
6693
|
],
|
|
6682
6694
|
"editor._base_domain_": [
|
|
@@ -12485,6 +12497,8 @@ var require_http_impl3 = __commonJS({
|
|
|
12485
12497
|
exports2.askCodegen = askCodegen;
|
|
12486
12498
|
exports2.reportCodeDiagnostic = reportCodeDiagnostic;
|
|
12487
12499
|
exports2.getCodeStatus = getCodeStatus;
|
|
12500
|
+
exports2.pullIfClean = pullIfClean;
|
|
12501
|
+
exports2.resolveCheckpointConflict = resolveCheckpointConflict;
|
|
12488
12502
|
var metro_runtime_1 = require_build();
|
|
12489
12503
|
var ambassador_1 = require_ambassador_index();
|
|
12490
12504
|
var metro_runtime_2 = require_build();
|
|
@@ -12521,8 +12535,12 @@ var require_http_impl3 = __commonJS({
|
|
|
12521
12535
|
var _getDevSessionStatusResponse = { tasks: "_task" };
|
|
12522
12536
|
var _initializeRequest = {};
|
|
12523
12537
|
var _initializeResponse = {};
|
|
12538
|
+
var _pullIfCleanRequest = {};
|
|
12539
|
+
var _pullIfCleanResponse = {};
|
|
12524
12540
|
var _reportCodeDiagnosticRequest = {};
|
|
12525
12541
|
var _reportCodeDiagnosticResponse = {};
|
|
12542
|
+
var _resolveCheckpointConflictRequest = {};
|
|
12543
|
+
var _resolveCheckpointConflictResponse = {};
|
|
12526
12544
|
var _restoreRevisionRequest = {};
|
|
12527
12545
|
var _restoreRevisionResponse = {};
|
|
12528
12546
|
var _startDevSessionRequest = {};
|
|
@@ -12933,6 +12951,56 @@ var require_http_impl3 = __commonJS({
|
|
|
12933
12951
|
__getCodeStatus.__isAmbassador = true;
|
|
12934
12952
|
return __getCodeStatus;
|
|
12935
12953
|
}
|
|
12954
|
+
function pullIfClean(payload) {
|
|
12955
|
+
var _a = (0, ambassador_1.serializer)(_pullIfCleanRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
|
|
12956
|
+
var fromRes = (0, ambassador_1.serializer)(_pullIfCleanResponse, {}).fromJSON;
|
|
12957
|
+
function __pullIfClean(_a2) {
|
|
12958
|
+
var host = _a2.host;
|
|
12959
|
+
var serializedData = toReq(payload);
|
|
12960
|
+
var metadata = {
|
|
12961
|
+
entityFqdn: "wix.code_project.orchestrator.v1.code_project",
|
|
12962
|
+
method: "POST",
|
|
12963
|
+
methodFqn: "com.wixpress.code_project.orchestrator.api.CodeProjectOrchestratorService.PullIfClean",
|
|
12964
|
+
migrationOptions: {
|
|
12965
|
+
optInTransformResponse: true
|
|
12966
|
+
},
|
|
12967
|
+
url: resolveComWixpressCodeProjectOrchestratorApiCodeProjectOrchestratorServiceUrl({ protoPath: "/v1/pull-if-clean", data: serializedData, host }),
|
|
12968
|
+
data: serializedData,
|
|
12969
|
+
transformResponse: fromRes
|
|
12970
|
+
};
|
|
12971
|
+
return metadata;
|
|
12972
|
+
}
|
|
12973
|
+
__pullIfClean.fromReq = fromReq;
|
|
12974
|
+
__pullIfClean.__isAmbassador = true;
|
|
12975
|
+
return __pullIfClean;
|
|
12976
|
+
}
|
|
12977
|
+
function resolveCheckpointConflict(payload) {
|
|
12978
|
+
var _a = (0, ambassador_1.serializer)(_resolveCheckpointConflictRequest, {}), toReq = _a.toJSON, fromReq = _a.fromJSON;
|
|
12979
|
+
var fromRes = (0, ambassador_1.serializer)(_resolveCheckpointConflictResponse, {}).fromJSON;
|
|
12980
|
+
function __resolveCheckpointConflict(_a2) {
|
|
12981
|
+
var host = _a2.host;
|
|
12982
|
+
var serializedData = toReq(payload);
|
|
12983
|
+
var metadata = {
|
|
12984
|
+
entityFqdn: "wix.code_project.orchestrator.v1.code_project",
|
|
12985
|
+
method: "POST",
|
|
12986
|
+
methodFqn: "com.wixpress.code_project.orchestrator.api.CodeProjectOrchestratorService.ResolveCheckpointConflict",
|
|
12987
|
+
migrationOptions: {
|
|
12988
|
+
optInTransformResponse: true
|
|
12989
|
+
},
|
|
12990
|
+
url: resolveComWixpressCodeProjectOrchestratorApiCodeProjectOrchestratorServiceUrl({
|
|
12991
|
+
protoPath: "/v1/resolve-checkpoint-conflict",
|
|
12992
|
+
data: serializedData,
|
|
12993
|
+
host
|
|
12994
|
+
}),
|
|
12995
|
+
data: serializedData,
|
|
12996
|
+
transformResponse: fromRes
|
|
12997
|
+
};
|
|
12998
|
+
return metadata;
|
|
12999
|
+
}
|
|
13000
|
+
__resolveCheckpointConflict.fromReq = fromReq;
|
|
13001
|
+
__resolveCheckpointConflict.__isAmbassador = true;
|
|
13002
|
+
return __resolveCheckpointConflict;
|
|
13003
|
+
}
|
|
12936
13004
|
}
|
|
12937
13005
|
});
|
|
12938
13006
|
|
|
@@ -14803,7 +14871,7 @@ TOOL USAGE:
|
|
|
14803
14871
|
- \`batch-write\` to create N new files in one call. NEVER call \`write\` more than once per turn \u2014 use batch-write instead. \`write\` is reserved for single-file creation.
|
|
14804
14872
|
- \`batch-read\` to read N files in one call. NEVER call \`read\` more than once per turn \u2014 use batch-read instead.
|
|
14805
14873
|
- \`multi-edit\` to apply N find-and-replace edits across one or more files in one call. NEVER call \`edit\` more than once per turn \u2014 use multi-edit instead. \`edit\` is reserved for a single edit to one file. When fixing type errors across N files, use ONE \`multi-edit\` with all N edits.
|
|
14806
|
-
- Tool arguments are strict JSON. For multiline strings in \`write\`, \`edit\`, \`batch-write\`, and \`multi-edit\`, use JSON escape sequences (\`\\n\`, \`\\t\`, \`\\"\`) \u2014 do NOT put raw (unescaped) newlines inside JSON string values (that breaks parsing). \`batch-write
|
|
14874
|
+
- Tool arguments are strict JSON. For multiline strings in \`write\`, \`edit\`, \`batch-write\`, and \`multi-edit\`, use JSON escape sequences (\`\\n\`, \`\\t\`, \`\\"\`) \u2014 do NOT put raw (unescaped) newlines inside JSON string values (that breaks parsing). All four write tools (\`write\`, \`edit\`, \`batch-write\`, \`multi-edit\`) normalize literal two-character escape sequences before writing; prefer proper JSON escapes.
|
|
14807
14875
|
- For tools where no batch variant exists (e.g. \`grep\`, \`glob\`), still emit MULTIPLE \`tool_use\` blocks in a SINGLE response when the calls are independent. Sequential turns waste a model round-trip per call.
|
|
14808
14876
|
- API discovery (shapes, method signatures, types) \u2014 in this order: (1) loaded skills + KNOWN WIX APIS, if they already cover the API \u2014 if so, do NOT delegate; (2) only when you genuinely don't know which method/API to use, delegate to \`codegen-wix-docs\` (Wix SDK) or \`codegen-wds-docs\` (WDS) to SEARCH for it \u2014 pass the question, not a known article link; the subagent searches AND reads the right schema (\`ReadFullDocsMethodSchema\` is the source of truth for parameter shapes) and returns a summary. Do NOT delegate just to fetch a doc you already identified; (3) grepping \`node_modules\` ONLY as a last resort if the above return nothing \u2014 SDK internals are not a documentation source, and doing it first wastes turns, inflates context, and is unreliable. ENFORCED: after 2 such lookups, further bash inspection of \`node_modules\` Wix/vite/astro internals is rejected.
|
|
14809
14877
|
- NEVER run preview, dev, release, or promote commands.
|
|
@@ -14929,7 +14997,7 @@ TOOL USAGE:
|
|
|
14929
14997
|
- \`batch-read\` to read N files in one call. NEVER call \`read\` more than once per turn \u2014 use batch-read instead.
|
|
14930
14998
|
- \`multi-edit\` to apply N find-and-replace edits across one or more files in one call. NEVER call \`edit\` more than once per turn \u2014 use multi-edit instead. \`edit\` is reserved for a single edit to one file. When resolving conflicts across N files, use ONE \`multi-edit\` with all N edits.
|
|
14931
14999
|
- \`batch-write\` to create N new files in one call. NEVER call \`write\` more than once per turn \u2014 use batch-write instead. \`write\` is reserved for single-file creation.
|
|
14932
|
-
- Tool arguments are strict JSON. For multiline strings in \`write\`, \`edit\`, \`batch-write\`, and \`multi-edit\`, use JSON escape sequences (\`\\n\`, \`\\t\`, \`\\"\`) \u2014 do NOT put raw (unescaped) newlines inside JSON string values (that breaks parsing). \`batch-write
|
|
15000
|
+
- Tool arguments are strict JSON. For multiline strings in \`write\`, \`edit\`, \`batch-write\`, and \`multi-edit\`, use JSON escape sequences (\`\\n\`, \`\\t\`, \`\\"\`) \u2014 do NOT put raw (unescaped) newlines inside JSON string values (that breaks parsing). All four write tools (\`write\`, \`edit\`, \`batch-write\`, \`multi-edit\`) normalize literal two-character escape sequences before writing; prefer proper JSON escapes.
|
|
14933
15001
|
- For tools where no batch variant exists (e.g. \`grep\`, \`glob\`), still emit MULTIPLE \`tool_use\` blocks in a SINGLE response when the calls are independent. Sequential turns waste a model round-trip per call.
|
|
14934
15002
|
- NEVER run preview, dev, release, or promote commands.
|
|
14935
15003
|
|
|
@@ -23037,6 +23105,85 @@ export const GeneratedFilesGuard = async () => ({
|
|
|
23037
23105
|
}
|
|
23038
23106
|
});
|
|
23039
23107
|
|
|
23108
|
+
// dist/opencode-integration/normalize-tool-string.js
|
|
23109
|
+
var require_normalize_tool_string = __commonJS({
|
|
23110
|
+
"dist/opencode-integration/normalize-tool-string.js"(exports2) {
|
|
23111
|
+
"use strict";
|
|
23112
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
23113
|
+
exports2.unescapeString = unescapeString;
|
|
23114
|
+
exports2.normalizeToolString = normalizeToolString;
|
|
23115
|
+
function unescapeString(str) {
|
|
23116
|
+
return str.replace(/\\(n|t|r)/g, (_, c) => {
|
|
23117
|
+
if (c === "n")
|
|
23118
|
+
return "\n";
|
|
23119
|
+
if (c === "t")
|
|
23120
|
+
return " ";
|
|
23121
|
+
return "\r";
|
|
23122
|
+
});
|
|
23123
|
+
}
|
|
23124
|
+
function normalizeToolString(text) {
|
|
23125
|
+
return unescapeString(text).replace(/\r\n/g, "\n");
|
|
23126
|
+
}
|
|
23127
|
+
}
|
|
23128
|
+
});
|
|
23129
|
+
|
|
23130
|
+
// dist/opencode-integration/edit-normalizer.js
|
|
23131
|
+
var require_edit_normalizer = __commonJS({
|
|
23132
|
+
"dist/opencode-integration/edit-normalizer.js"(exports2) {
|
|
23133
|
+
"use strict";
|
|
23134
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
23135
|
+
exports2.NORMALIZE_PLUGIN_PATH = void 0;
|
|
23136
|
+
exports2.buildNormalizePluginSource = buildNormalizePluginSource;
|
|
23137
|
+
exports2.writeNormalizePlugin = writeNormalizePlugin;
|
|
23138
|
+
var promises_1 = require("fs/promises");
|
|
23139
|
+
var os_1 = require("os");
|
|
23140
|
+
var path_1 = require("path");
|
|
23141
|
+
var logger_12 = require_logger();
|
|
23142
|
+
var normalize_tool_string_1 = require_normalize_tool_string();
|
|
23143
|
+
var GLOBAL_PLUGIN_DIR = (0, path_1.join)((0, os_1.homedir)(), ".config", "opencode", "plugin");
|
|
23144
|
+
var NORMALIZE_PLUGIN_FILENAME = "edit-write-normalizer.ts";
|
|
23145
|
+
exports2.NORMALIZE_PLUGIN_PATH = (0, path_1.join)(GLOBAL_PLUGIN_DIR, NORMALIZE_PLUGIN_FILENAME);
|
|
23146
|
+
function buildNormalizePluginSource() {
|
|
23147
|
+
return `// Generated by @wix/ditto-codegen (edit-normalizer) \u2014 do not edit.
|
|
23148
|
+
${normalize_tool_string_1.unescapeString.toString()}
|
|
23149
|
+
|
|
23150
|
+
${normalize_tool_string_1.normalizeToolString.toString()}
|
|
23151
|
+
|
|
23152
|
+
export const EditWriteNormalizer = async () => ({
|
|
23153
|
+
"tool.execute.before": async (
|
|
23154
|
+
input: { tool: string },
|
|
23155
|
+
output: {
|
|
23156
|
+
args?: { oldString?: string; newString?: string; content?: string };
|
|
23157
|
+
},
|
|
23158
|
+
) => {
|
|
23159
|
+
const args = output?.args;
|
|
23160
|
+
if (!args) return;
|
|
23161
|
+
if (input.tool === "edit") {
|
|
23162
|
+
if (typeof args.oldString === "string") {
|
|
23163
|
+
args.oldString = normalizeToolString(args.oldString);
|
|
23164
|
+
}
|
|
23165
|
+
if (typeof args.newString === "string") {
|
|
23166
|
+
args.newString = normalizeToolString(args.newString);
|
|
23167
|
+
}
|
|
23168
|
+
} else if (input.tool === "write") {
|
|
23169
|
+
if (typeof args.content === "string") {
|
|
23170
|
+
args.content = normalizeToolString(args.content);
|
|
23171
|
+
}
|
|
23172
|
+
}
|
|
23173
|
+
},
|
|
23174
|
+
});
|
|
23175
|
+
`;
|
|
23176
|
+
}
|
|
23177
|
+
async function writeNormalizePlugin() {
|
|
23178
|
+
await (0, promises_1.mkdir)(GLOBAL_PLUGIN_DIR, { recursive: true });
|
|
23179
|
+
await (0, promises_1.writeFile)(exports2.NORMALIZE_PLUGIN_PATH, buildNormalizePluginSource(), "utf-8");
|
|
23180
|
+
logger_12.logger.info("[OpenCode] Wrote edit/write normalizer plugin", {
|
|
23181
|
+
path: exports2.NORMALIZE_PLUGIN_PATH
|
|
23182
|
+
});
|
|
23183
|
+
}
|
|
23184
|
+
}
|
|
23185
|
+
});
|
|
23186
|
+
|
|
23040
23187
|
// dist/plugin-host.js
|
|
23041
23188
|
var require_plugin_host = __commonJS({
|
|
23042
23189
|
"dist/plugin-host.js"(exports2) {
|
|
@@ -23105,6 +23252,7 @@ var tools_writer_1 = require_tools_writer();
|
|
|
23105
23252
|
var node_modules_guard_1 = require_node_modules_guard();
|
|
23106
23253
|
var generated_files_guard_1 = require_generated_files_guard();
|
|
23107
23254
|
var subagent_tool_logger_1 = require_subagent_tool_logger();
|
|
23255
|
+
var edit_normalizer_1 = require_edit_normalizer();
|
|
23108
23256
|
var plugin_artifacts_1 = require_plugin_artifacts();
|
|
23109
23257
|
var config_1 = require_config();
|
|
23110
23258
|
var environments_1 = require_environments();
|
|
@@ -23180,7 +23328,8 @@ async function initOpenCode() {
|
|
|
23180
23328
|
(0, tools_writer_1.writeToolFiles)(pluginArtifacts.tools),
|
|
23181
23329
|
(0, node_modules_guard_1.writeGuardPlugin)(),
|
|
23182
23330
|
(0, generated_files_guard_1.writeGeneratedFilesGuardPlugin)(),
|
|
23183
|
-
(0, subagent_tool_logger_1.writeSubagentToolLoggerPlugin)()
|
|
23331
|
+
(0, subagent_tool_logger_1.writeSubagentToolLoggerPlugin)(),
|
|
23332
|
+
(0, edit_normalizer_1.writeNormalizePlugin)()
|
|
23184
23333
|
]);
|
|
23185
23334
|
}
|
|
23186
23335
|
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.416",
|
|
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": "307836979da78635f24c70b32a36cf29cd5b341aa326e125e187bcd6"
|
|
33
33
|
}
|