@wix/ditto-codegen-public 1.0.468 → 1.0.470

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 +66 -6
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -546,7 +546,16 @@ var require_context = __commonJS({
546
546
  var path_12 = __importDefault2(require("path"));
547
547
  var provisioned = {
548
548
  CODEGEN_JOB_DELIVERY: process.env.CODEGEN_JOB_DELIVERY,
549
- CODEGEN_JOB_FETCH_PORT: process.env.CODEGEN_JOB_FETCH_PORT
549
+ CODEGEN_JOB_FETCH_PORT: process.env.CODEGEN_JOB_FETCH_PORT,
550
+ // The model-comparison harness pins each CLI via its spawn env, not the shared .env.
551
+ CODEGEN_MODEL_OVERRIDE: process.env.CODEGEN_MODEL_OVERRIDE,
552
+ CODEGEN_SMALL_MODEL_OVERRIDE: process.env.CODEGEN_SMALL_MODEL_OVERRIDE,
553
+ CODEGEN_ENVIRONMENT: process.env.CODEGEN_ENVIRONMENT,
554
+ OUTPUT_PATH: process.env.OUTPUT_PATH,
555
+ SANDBOX_ID: process.env.SANDBOX_ID,
556
+ CODEGEN_FRESH_SESSION: process.env.CODEGEN_FRESH_SESSION,
557
+ CODE_IDENTIFIER: process.env.CODE_IDENTIFIER,
558
+ PROJECT_ID: process.env.PROJECT_ID
550
559
  };
551
560
  dotenv_1.default.config({ path: path_12.default.join(__dirname, "../.env"), override: true });
552
561
  for (const [key, value] of Object.entries(provisioned)) {
@@ -14916,7 +14925,8 @@ ${environmentIdentity}`;
14916
14925
  - \`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.
14917
14926
  - \`batch-read\` to read N files in one call. NEVER call \`read\` more than once per turn \u2014 use batch-read instead.
14918
14927
  - \`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 ${multiEditContextClause} across N files, use ONE \`multi-edit\` with all N edits.
14919
- - Tool arguments are strict JSON, and \`write\`/\`edit\`/\`batch-write\`/\`multi-edit\` write \`content\`/\`oldString\`/\`newString\` to disk EXACTLY as decoded from that JSON \u2014 there is no second unescaping pass, so encode for the ONE decode that happens. Use \`\\n\`/\`\\t\`/\`\\"\` in the JSON when you want the file to contain a REAL newline/tab/quote character (a raw unescaped newline inside a JSON string value breaks parsing). If the file itself must contain the two LITERAL characters backslash-then-n (e.g. inside a string literal like \`.join('\\n')\`, a regex, or an already-escaped JSON value), escape the backslash itself in your JSON so it survives the one decode intact \u2014 do NOT emit a bare \`\\n\` expecting a tool to turn it back into two literal characters for you; none of them do.
14928
+ - \`apply_patch\` (when available): inside each \`*** Update File\` section, list hunks in FILE ORDER, top to bottom. The applier only searches forward from where the previous hunk matched, so a hunk whose lines sit ABOVE the previous one fails with "Failed to find expected lines" even though the lines exist \u2014 the whole patch is then rejected. Unsure of the order? Re-read the file first, or split into one patch per hunk.
14929
+ - Tool arguments are strict JSON, and \`write\`/\`edit\`/\`batch-write\`/\`multi-edit\`/\`apply_patch\` write \`content\`/\`oldString\`/\`newString\`/\`patchText\` to disk EXACTLY as decoded from that JSON \u2014 there is no second unescaping pass, so encode for the ONE decode that happens. Use \`\\n\`/\`\\t\`/\`\\"\` in the JSON when you want the file to contain a REAL newline/tab/quote character (a raw unescaped newline inside a JSON string value breaks parsing). If the file itself must contain the two LITERAL characters backslash-then-n (e.g. inside a string literal like \`.join('\\n')\`, a regex, or an already-escaped JSON value), escape the backslash itself in your JSON so it survives the one decode intact \u2014 do NOT emit a bare \`\\n\` expecting a tool to turn it back into two literal characters for you; none of them do.
14920
14930
  - 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.`;
14921
14931
  }
14922
14932
  }
@@ -14982,7 +14992,7 @@ FILE CREATION:
14982
14992
 
14983
14993
  GENERATED FILES:
14984
14994
  - \`src/extensions/site/components/**/*.generated.ts\` is an auto-generated editor-react-component manifest \u2014 NEVER hand-edit. Change a manifest VALUE in the component's \`*.extension.ts\`; change anything else in the \`*.tsx\` / \`*.module.css\` / \`*.props.ts\` source, then regenerate (workflow step 5). No other \`.generated.ts\` path is affected.
14985
- - A write guard rejects \`write\`/\`edit\`/\`batch-write\`/\`multi-edit\` there, dropping the ENTIRE call \u2014 never batch that path with real edits, or those are lost too and must be resubmitted.
14995
+ - A write guard rejects \`write\`/\`edit\`/\`batch-write\`/\`multi-edit\`/\`apply_patch\` there, dropping the ENTIRE call \u2014 never batch that path with real edits (or put it in a patch alongside other hunks), or those are lost too and must be resubmitted.
14986
14996
 
14987
14997
  TYPESCRIPT:
14988
14998
  - The project enables \`verbatimModuleSyntax\`. Type-only imports MUST use \`import type\`.
@@ -15727,6 +15737,20 @@ export const SubagentToolLogger = async () => {
15727
15737
  }
15728
15738
  });
15729
15739
 
15740
+ // dist/opencode-integration/apply-patch.js
15741
+ var require_apply_patch = __commonJS({
15742
+ "dist/opencode-integration/apply-patch.js"(exports2) {
15743
+ "use strict";
15744
+ Object.defineProperty(exports2, "__esModule", { value: true });
15745
+ exports2.PATCH_FILE_HEADER_RE = void 0;
15746
+ exports2.extractPatchPaths = extractPatchPaths;
15747
+ exports2.PATCH_FILE_HEADER_RE = /^\*\*\* (?:Add File|Update File|Delete File|Move to):(.*)$/;
15748
+ function extractPatchPaths(patchText) {
15749
+ return patchText.split(/\r?\n/).map((line) => exports2.PATCH_FILE_HEADER_RE.exec(line)?.[1].trim() ?? "").filter((p) => p !== "");
15750
+ }
15751
+ }
15752
+ });
15753
+
15730
15754
  // dist/opencode-integration/execution/parser.js
15731
15755
  var require_parser = __commonJS({
15732
15756
  "dist/opencode-integration/execution/parser.js"(exports2) {
@@ -15741,6 +15765,7 @@ var require_parser = __commonJS({
15741
15765
  exports2.summarizeOpenCodeLine = summarizeOpenCodeLine;
15742
15766
  var types_1 = require_types4();
15743
15767
  var subagent_tool_logger_1 = require_subagent_tool_logger();
15768
+ var apply_patch_1 = require_apply_patch();
15744
15769
  function parseRequiredPermissions(output) {
15745
15770
  let permissions = [];
15746
15771
  const lines = output.split("\n");
@@ -15851,7 +15876,14 @@ var require_parser = __commonJS({
15851
15876
  function summarizeOutput(tool, output) {
15852
15877
  return FULL_OUTPUT_TOOLS.has(tool) ? truncate(output, FULL_OUTPUT_CAP) : truncate(output);
15853
15878
  }
15879
+ var PATCH_TEXT_CAP = 4e3;
15854
15880
  function summarizeInput(input) {
15881
+ if (typeof input.patchText === "string") {
15882
+ return {
15883
+ patchFiles: (0, apply_patch_1.extractPatchPaths)(input.patchText),
15884
+ patchText: truncate(input.patchText, PATCH_TEXT_CAP)
15885
+ };
15886
+ }
15855
15887
  if (input.files) {
15856
15888
  return { files: input.files.map(({ path }) => ({ path })) };
15857
15889
  }
@@ -15866,6 +15898,18 @@ var require_parser = __commonJS({
15866
15898
  ...input.description && { description: truncate(input.description) }
15867
15899
  };
15868
15900
  }
15901
+ function summarizeMetadata(metadata) {
15902
+ const trimmed = { ...metadata };
15903
+ delete trimmed.diff;
15904
+ if (trimmed.files) {
15905
+ trimmed.files = trimmed.files.map((file) => {
15906
+ const copy = { ...file };
15907
+ delete copy.patch;
15908
+ return copy;
15909
+ });
15910
+ }
15911
+ return trimmed;
15912
+ }
15869
15913
  function summarizeOpenCodeLine(line) {
15870
15914
  if (line.type !== "tool_use" && line.type !== subagent_tool_logger_1.SUBAGENT_TOOL_EVENT_TYPE) {
15871
15915
  return line;
@@ -15881,6 +15925,9 @@ var require_parser = __commonJS({
15881
15925
  ...state?.input && { input: summarizeInput(state.input) },
15882
15926
  ...state?.output && {
15883
15927
  output: summarizeOutput(part.tool, state.output)
15928
+ },
15929
+ ...state?.metadata && part.tool === "apply_patch" && {
15930
+ metadata: summarizeMetadata(state.metadata)
15884
15931
  }
15885
15932
  }
15886
15933
  }
@@ -16001,7 +16048,7 @@ var require_cost_tracker = __commonJS({
16001
16048
  async function fetchOpenCodeStats(cwd, env) {
16002
16049
  for (let attempt = 0; attempt < STATS_MAX_ATTEMPTS; attempt++) {
16003
16050
  try {
16004
- const { stdout } = await execAsync("opencode stats --models", {
16051
+ const { stdout } = await execAsync('opencode stats --models --project ""', {
16005
16052
  cwd,
16006
16053
  env,
16007
16054
  timeout: CLI_TIMEOUT_MS
@@ -16979,7 +17026,8 @@ var require_executor = __commonJS({
16979
17026
  let currentPrompt = options.prompt;
16980
17027
  let lastFailureReason = null;
16981
17028
  let stalls = 0;
16982
- let continueSession = options.continueSession ?? false;
17029
+ const forceFresh = process.env.CODEGEN_FRESH_SESSION === "true";
17030
+ let continueSession = forceFresh ? false : options.continueSession ?? false;
16983
17031
  const env = (0, config_12.getOpenCodeEnv)(options.projectId, job_context_storage_12.jobContextStorage.getStore()?.kind);
16984
17032
  const statsBaseline = await (0, cost_tracker_1.fetchOpenCodeStats)(options.outputPath, env);
16985
17033
  const baselineCost = statsBaseline ? (0, cost_tracker_1.parseStatsTotalCost)(statsBaseline) : null;
@@ -23929,8 +23977,9 @@ var require_generated_files_guard = __commonJS({
23929
23977
  exports2.buildGeneratedFilesGuardSource = buildGeneratedFilesGuardSource;
23930
23978
  exports2.writeGeneratedFilesGuardPlugin = writeGeneratedFilesGuardPlugin;
23931
23979
  var write_plugin_1 = require_write_plugin();
23980
+ var apply_patch_1 = require_apply_patch();
23932
23981
  var ERC_MANIFEST_RE = /(^|\/)src\/extensions\/site\/components\/.+\.generated\.tsx?$/;
23933
- exports2.GUARD_MESSAGE = "BLOCKED: this editor-react-component manifest is auto-generated. Do not create or edit it by hand \u2014 edit the *.tsx / *.module.css / *.props.ts source and regenerate with `npx wix build && npx wix generate manifest`, or override values in the component's *.extension.ts. Do not re-attempt the blocked path; the whole call was rejected, so resubmit any other paths it carried \u2014 they were not written. Only *.generated.ts under src/extensions/site/components/ is blocked.";
23982
+ exports2.GUARD_MESSAGE = "BLOCKED: this editor-react-component manifest is auto-generated. Do not create or edit it by hand \u2014 edit the *.tsx / *.module.css / *.props.ts source and regenerate with `npx wix build && npx wix generate manifest`, or override values in the component's *.extension.ts. Do not re-attempt the blocked path; the whole call was rejected \u2014 including every other file or apply_patch hunk it carried \u2014 so resubmit those; they were not written. Only *.generated.ts under src/extensions/site/components/ is blocked.";
23934
23983
  function isEditorComponentManifest(path) {
23935
23984
  return ERC_MANIFEST_RE.test(path);
23936
23985
  }
@@ -23938,6 +23987,9 @@ var require_generated_files_guard = __commonJS({
23938
23987
  if (tool === "write" || tool === "edit") {
23939
23988
  return typeof args.filePath === "string" ? [args.filePath] : [];
23940
23989
  }
23990
+ if (tool === "apply_patch") {
23991
+ return typeof args.patchText === "string" ? (0, apply_patch_1.extractPatchPaths)(args.patchText) : [];
23992
+ }
23941
23993
  const list = tool === "batch-write" ? args.files : tool === "multi-edit" ? args.edits : void 0;
23942
23994
  if (!list)
23943
23995
  return [];
@@ -23948,11 +24000,19 @@ var require_generated_files_guard = __commonJS({
23948
24000
  return `// Generated by @wix/ditto-codegen (generated-files-guard). Do not edit.
23949
24001
  const ERC_MANIFEST_RE = /${ERC_MANIFEST_RE.source}/;
23950
24002
  const GUARD_MESSAGE = ${JSON.stringify(exports2.GUARD_MESSAGE)};
24003
+ const PATCH_FILE_HEADER_RE = /${apply_patch_1.PATCH_FILE_HEADER_RE.source}/;
23951
24004
 
23952
24005
  function extractWritePaths(tool, args) {
23953
24006
  if (tool === "${"write"}" || tool === "${"edit"}") {
23954
24007
  return typeof args.filePath === "string" ? [args.filePath] : [];
23955
24008
  }
24009
+ if (tool === "${"apply_patch"}") {
24010
+ if (typeof args.patchText !== "string") return [];
24011
+ return args.patchText
24012
+ .split(/\\r?\\n/)
24013
+ .map((line) => PATCH_FILE_HEADER_RE.exec(line)?.[1].trim() ?? "")
24014
+ .filter((p) => p !== "");
24015
+ }
23956
24016
  const list =
23957
24017
  tool === "${"batch-write"}" ? args.files : tool === "${"multi-edit"}" ? args.edits : undefined;
23958
24018
  if (!list) return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.468",
3
+ "version": "1.0.470",
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": "a6a62e94e0a4a64426b44c65e0586dcf2965cb540f379be948120c0e"
32
+ "falconPackageHash": "51949572d62d11b72e4bc67ed5130033eb60717dc57e17abbdad93a0"
33
33
  }