@odla-ai/cli 0.40.0 → 0.40.2

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "./chunk-2IHE5U3M.js";
4
+ } from "./chunk-XUTMQMXZ.js";
5
5
  import {
6
6
  exitCodeFor
7
7
  } from "./chunk-UKLSRQ5J.js";
@@ -9,4 +9,4 @@ export {
9
9
  exitCodeFor,
10
10
  runCli
11
11
  };
12
- //# sourceMappingURL=cli-LRJBESE6.js.map
12
+ //# sourceMappingURL=cli-WJSQEBDO.js.map
package/dist/index.cjs CHANGED
@@ -6275,7 +6275,7 @@ async function stageWorkspacePair(baselineSource, workspaceSource, options = {})
6275
6275
  }
6276
6276
  }
6277
6277
 
6278
- // ../harness/dist/chunk-UVGZHNLW.js
6278
+ // ../harness/dist/chunk-L2T3LPEF.js
6279
6279
  var import_crypto = require("crypto");
6280
6280
  var import_promises5 = require("fs/promises");
6281
6281
  var import_path5 = require("path");
@@ -6612,7 +6612,7 @@ function validateSnapshot(snapshot, limits) {
6612
6612
  }
6613
6613
  }
6614
6614
 
6615
- // ../harness/dist/chunk-UVGZHNLW.js
6615
+ // ../harness/dist/chunk-L2T3LPEF.js
6616
6616
  var import_child_process4 = require("child_process");
6617
6617
  var import_promises6 = require("fs/promises");
6618
6618
  var import_path6 = require("path");
@@ -6914,7 +6914,7 @@ function looksLikeDestination(value2) {
6914
6914
  return /^(?:[a-z][a-z0-9+.-]*:\/\/|\/|\\\\)/i.test(text3) || /^[\w.-]+\.[a-z]{2,}(?:[/:]|$)/i.test(text3);
6915
6915
  }
6916
6916
 
6917
- // ../harness/dist/chunk-UVGZHNLW.js
6917
+ // ../harness/dist/chunk-L2T3LPEF.js
6918
6918
  var import_promises10 = require("fs/promises");
6919
6919
  var import_promises11 = require("fs/promises");
6920
6920
  var import_path10 = require("path");
@@ -7182,7 +7182,7 @@ async function buildCodeGraph(input) {
7182
7182
  return builder.build();
7183
7183
  }
7184
7184
 
7185
- // ../harness/dist/chunk-UVGZHNLW.js
7185
+ // ../harness/dist/chunk-L2T3LPEF.js
7186
7186
  var import_crypto4 = require("crypto");
7187
7187
  async function digestStagedWorkspace(root, limits) {
7188
7188
  const files = [];
@@ -7441,6 +7441,7 @@ function parseSnapshot(value2) {
7441
7441
  return { host, bindings, commands };
7442
7442
  }
7443
7443
  async function parseSource(value2) {
7444
+ const repositoryLimits = { maximumFiles: 1e5, maximumBytes: 80 * 1024 * 1024 };
7444
7445
  const snapshot = record5(record5(value2)?.snapshot);
7445
7446
  if (!snapshot || typeof snapshot.repository !== "string" || typeof snapshot.commitSha !== "string" || typeof snapshot.treeDigest !== "string" || !Array.isArray(snapshot.files)) throw invalid("source");
7446
7447
  const files = snapshot.files.map((value22) => {
@@ -7462,12 +7463,12 @@ async function parseSource(value2) {
7462
7463
  return { path: file.path, content: file.content };
7463
7464
  });
7464
7465
  const source2 = { repository: reference.repository, commitSha: reference.commitSha, files: referenceFiles };
7465
- const referenceDigest = await digestCodeRepositorySnapshot(source2, { maximumFiles: 1e4, maximumBytes: 16 * 1024 * 1024 });
7466
+ const referenceDigest = await digestCodeRepositorySnapshot(source2, repositoryLimits);
7466
7467
  if (referenceDigest !== reference.treeDigest) throw invalid("reference source digest");
7467
7468
  references.push({ alias: reference.alias, ...source2, treeDigest: referenceDigest });
7468
7469
  }
7469
7470
  const source = { repository: snapshot.repository, commitSha: snapshot.commitSha, files };
7470
- const digest = await digestCodeRepositorySnapshot(source, { maximumFiles: 1e4, maximumBytes: 16 * 1024 * 1024 });
7471
+ const digest = await digestCodeRepositorySnapshot(source, repositoryLimits);
7471
7472
  if (digest !== snapshot.treeDigest) throw invalid("source digest");
7472
7473
  return { ...source, treeDigest: digest, ...references.length ? { references } : {} };
7473
7474
  }
@@ -8119,8 +8120,11 @@ async function prepareRuntimeLocalSource(input) {
8119
8120
  }
8120
8121
  var RESERVED2 = /* @__PURE__ */ new Set([".git", ".odla", ".wrangler", "node_modules", "dist", "coverage"]);
8121
8122
  var SECRET2 = /^(?:\.env(?:\..+)?|\.dev\.vars|credentials(?:\..+)?\.json|dev-token(?:\..+)?\.json)$/i;
8123
+ var SOURCE_MAX_FILES = 1e5;
8124
+ var SOURCE_MAX_BYTES = 80 * 1024 * 1024;
8125
+ var SOURCE_SET_MAX_BYTES = 480 * 1024 * 1024;
8122
8126
  async function materializeCodeRuntimeSource(snapshot, tempRoot = (0, import_os3.tmpdir)()) {
8123
- if (!snapshot.files.length || snapshot.files.length > 1e4) throw new TypeError("Code source file count is invalid");
8127
+ if (!snapshot.files.length || snapshot.files.length > SOURCE_MAX_FILES) throw new TypeError("Code source file count is invalid");
8124
8128
  const root = await (0, import_promises8.mkdtemp)((0, import_path8.join)(tempRoot, "odla-code-source-"));
8125
8129
  const sourceDir = (0, import_path8.join)(root, "source");
8126
8130
  await (0, import_promises8.mkdir)(sourceDir);
@@ -8132,7 +8136,7 @@ async function materializeCodeRuntimeSource(snapshot, tempRoot = (0, import_os3.
8132
8136
  if (seen.has(file.path)) throw new TypeError("Code source repeats a path");
8133
8137
  seen.add(file.path);
8134
8138
  bytes += Buffer.byteLength(file.path) + Buffer.byteLength(file.content);
8135
- if (bytes > 16 * 1024 * 1024) throw new TypeError("Code source exceeds its byte bound");
8139
+ if (bytes > SOURCE_MAX_BYTES) throw new TypeError("Code source exceeds its byte bound");
8136
8140
  const target = (0, import_path8.resolve)(sourceDir, file.path);
8137
8141
  if (!target.startsWith(`${(0, import_path8.resolve)(sourceDir)}${import_path8.sep}`)) throw new TypeError("Code source path escapes its root");
8138
8142
  await (0, import_promises8.mkdir)((0, import_path8.dirname)(target), { recursive: true });
@@ -8140,14 +8144,14 @@ async function materializeCodeRuntimeSource(snapshot, tempRoot = (0, import_os3.
8140
8144
  }
8141
8145
  for (const reference of snapshot.references ?? []) {
8142
8146
  validateAlias(reference.alias);
8143
- if (!reference.files.length || reference.files.length > 1e4) throw new TypeError("Code reference file count is invalid");
8147
+ if (!reference.files.length || reference.files.length > SOURCE_MAX_FILES) throw new TypeError("Code reference file count is invalid");
8144
8148
  for (const file of reference.files) {
8145
8149
  validatePath(file.path);
8146
8150
  const path = `.odla-references/${reference.alias}/${file.path}`;
8147
8151
  if (seen.has(path)) throw new TypeError("Code reference repeats a path");
8148
8152
  seen.add(path);
8149
8153
  bytes += Buffer.byteLength(path) + Buffer.byteLength(file.content);
8150
- if (bytes > 80 * 1024 * 1024) throw new TypeError("Code source set exceeds its byte bound");
8154
+ if (bytes > SOURCE_SET_MAX_BYTES) throw new TypeError("Code source set exceeds its byte bound");
8151
8155
  const target = (0, import_path8.resolve)(sourceDir, path);
8152
8156
  if (!target.startsWith(`${(0, import_path8.resolve)(sourceDir)}${import_path8.sep}`)) throw new TypeError("Code reference path escapes its root");
8153
8157
  await (0, import_promises8.mkdir)((0, import_path8.dirname)(target), { recursive: true });
@@ -8173,7 +8177,7 @@ async function attachCodeRuntimeReferences(workspace, references) {
8173
8177
  validatePath(file.path);
8174
8178
  const path = `.odla-references/${reference.alias}/${file.path}`;
8175
8179
  bytes += Buffer.byteLength(path) + Buffer.byteLength(file.content);
8176
- if (bytes > 64 * 1024 * 1024) throw new TypeError("Code reference set exceeds its byte bound");
8180
+ if (bytes > SOURCE_SET_MAX_BYTES - SOURCE_MAX_BYTES) throw new TypeError("Code reference set exceeds its byte bound");
8177
8181
  for (const root of [workspace.baselineDir, workspace.workspaceDir]) {
8178
8182
  const target = (0, import_path8.resolve)(root, path);
8179
8183
  if (!target.startsWith(`${(0, import_path8.resolve)(root)}${import_path8.sep}`)) throw new TypeError("Code reference path escapes its root");
@@ -8223,7 +8227,10 @@ async function materializeCommandWorkspace(input) {
8223
8227
  trustedBaseDir: materialized.sourceDir,
8224
8228
  trustedBaseCommitSha: source.commitSha,
8225
8229
  checkpoint: codeCheckpointPayload(command.payload)
8226
- })).workspace : await stageWorkspace(materialized.sourceDir);
8230
+ })).workspace : await stageWorkspace(materialized.sourceDir, {
8231
+ maxFiles: SOURCE_MAX_FILES,
8232
+ maxBytes: SOURCE_SET_MAX_BYTES
8233
+ });
8227
8234
  return { workspace, sourceDigest: source.treeDigest, requestedLocal: null };
8228
8235
  } finally {
8229
8236
  await materialized.cleanup();