@cortexkit/opencode-magic-context 0.41.2 → 0.41.3

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 (138) hide show
  1. package/README.md +9 -3
  2. package/dist/announcement-3c1vertn.js +14 -0
  3. package/dist/config/project-security.d.ts.map +1 -1
  4. package/dist/config/schema/magic-context.d.ts +756 -4
  5. package/dist/config/schema/magic-context.d.ts.map +1 -1
  6. package/dist/conflict-warning-hook-z5sd697e.js +16 -0
  7. package/dist/derive-budgets-901a0pk0.js +11 -0
  8. package/dist/features/magic-context/compartment-lease.d.ts +6 -0
  9. package/dist/features/magic-context/compartment-lease.d.ts.map +1 -1
  10. package/dist/features/magic-context/migrations.d.ts.map +1 -1
  11. package/dist/features/magic-context/storage-db.d.ts +18 -1
  12. package/dist/features/magic-context/storage-db.d.ts.map +1 -1
  13. package/dist/features/magic-context/storage-meta-persisted.d.ts +11 -12
  14. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  15. package/dist/features/magic-context/storage-meta.d.ts +1 -1
  16. package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
  17. package/dist/features/magic-context/storage-subagent-invocations.d.ts +3 -2
  18. package/dist/features/magic-context/storage-subagent-invocations.d.ts.map +1 -1
  19. package/dist/features/magic-context/storage-tags.d.ts +6 -0
  20. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  21. package/dist/features/magic-context/storage.d.ts +2 -2
  22. package/dist/features/magic-context/storage.d.ts.map +1 -1
  23. package/dist/features/magic-context/subagent-token-capture.d.ts +2 -1
  24. package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -1
  25. package/dist/hooks/magic-context/compaction-marker-manager.d.ts +6 -1
  26. package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -1
  27. package/dist/hooks/magic-context/compartment-runner.d.ts +2 -1
  28. package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
  29. package/dist/hooks/magic-context/hook.d.ts +4 -3
  30. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  31. package/dist/hooks/magic-context/inject-compartments.d.ts +6 -0
  32. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  33. package/dist/hooks/magic-context/module-state-sync.d.ts +2 -1
  34. package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
  35. package/dist/hooks/magic-context/module-transport.d.ts +11 -4
  36. package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
  37. package/dist/hooks/magic-context/module-wire.d.ts +6 -1
  38. package/dist/hooks/magic-context/module-wire.d.ts.map +1 -1
  39. package/dist/hooks/magic-context/read-session-db.d.ts +15 -0
  40. package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
  41. package/dist/hooks/magic-context/rust-mode-transform.d.ts +10 -0
  42. package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
  43. package/dist/hooks/magic-context/send-session-notification.d.ts +6 -0
  44. package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
  45. package/dist/hooks/magic-context/sentinel.d.ts +5 -16
  46. package/dist/hooks/magic-context/sentinel.d.ts.map +1 -1
  47. package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
  48. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +32 -0
  49. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  50. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  51. package/dist/{index-y1yr57fw.js → index-0bycg0np.js} +18 -18
  52. package/dist/{index-1yh8g550.js → index-22jkk6wg.js} +2 -15
  53. package/dist/{index-dmvy29z0.js → index-3wzdwt6p.js} +11 -15
  54. package/dist/{index-d1mxrd3p.js → index-7k55qm8a.js} +17 -12
  55. package/dist/{index-4x691bz5.js → index-dkv2dn46.js} +5 -2
  56. package/dist/{index-cvda5jb3.js → index-dn1rwpd8.js} +11 -11
  57. package/dist/{index-rgdqj8nj.js → index-e7vx3byk.js} +1 -1
  58. package/dist/{index-szf8w1p5.js → index-fmsr7v69.js} +2 -2
  59. package/dist/{index-d62ypazr.js → index-jdxxq8cz.js} +6 -11
  60. package/dist/{index-9j3tx8hy.js → index-may8skc8.js} +6 -25
  61. package/dist/{index-eq9wr75c.js → index-npx8vhmy.js} +57 -108
  62. package/dist/{index-zwjhba2r.js → index-q264erdp.js} +122 -41
  63. package/dist/{index-b9j85d29.js → index-raatkvw5.js} +49 -11
  64. package/dist/{index-9xexf8s7.js → index-rn7gafjr.js} +1 -9
  65. package/dist/index-v6t0tg85.js +13 -0
  66. package/dist/{index-j8r0ejb3.js → index-vmmjdpc0.js} +1694 -11167
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +2149 -1799
  69. package/dist/model-resolution-dxatzjde.js +12 -0
  70. package/dist/{index-dynqfgx1.js → module-asyncify-2EFITU5U-rkqjhjxd.js} +69 -8
  71. package/dist/plugin/boot-deadline.d.ts +47 -0
  72. package/dist/plugin/boot-deadline.d.ts.map +1 -0
  73. package/dist/plugin/conflict-warning-hook.d.ts +10 -0
  74. package/dist/plugin/conflict-warning-hook.d.ts.map +1 -1
  75. package/dist/plugin/hooks/create-session-hooks.d.ts +2 -0
  76. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  77. package/dist/plugin/messages-transform.d.ts.map +1 -1
  78. package/dist/prompt-context-5y5ms8f9.js +6 -0
  79. package/dist/recomp-orchestrator-f5m2wk74.js +19 -0
  80. package/dist/rpc-notifications-4amf6mf4.js +14 -0
  81. package/dist/{index-vnz6jvdc.js → safe-notification-target-q9z81zt3.js} +4 -3
  82. package/dist/send-session-notification-hdh02wy9.js +16 -0
  83. package/dist/shared/conflict-detector.d.ts +3 -1
  84. package/dist/shared/conflict-detector.d.ts.map +1 -1
  85. package/dist/shared/harness.d.ts +3 -3
  86. package/dist/shared/harness.d.ts.map +1 -1
  87. package/dist/shared/model-resolution.d.ts +3 -3
  88. package/dist/shared/model-resolution.d.ts.map +1 -1
  89. package/dist/shared/prompt-surface-runtime.d.ts +2 -2
  90. package/dist/shared/prompt-surface-runtime.d.ts.map +1 -1
  91. package/dist/shared/tag-transcript.d.ts.map +1 -1
  92. package/dist/shared/transcript.d.ts +2 -1
  93. package/dist/shared/transcript.d.ts.map +1 -1
  94. package/dist/storage-meta-session-3rxx9ekm.js +20 -0
  95. package/dist/task-config-hnv93r7p.js +9 -0
  96. package/dist/transformers-node-wasm.js +328 -328
  97. package/dist/transformers-web.js +72 -72
  98. package/dist/{transformers.node-b1wa0hgx.js → transformers.node-dpmf3wpx.js} +74 -74
  99. package/package.json +1 -1
  100. package/src/config/index.test.ts +28 -0
  101. package/src/config/project-security.hostile-matrix.test.ts +78 -9
  102. package/src/config/project-security.ts +4 -3
  103. package/src/config/schema/magic-context.test.ts +64 -0
  104. package/src/config/schema/magic-context.ts +100 -6
  105. package/src/shared/conflict-detector.test.ts +24 -0
  106. package/src/shared/conflict-detector.ts +25 -7
  107. package/src/shared/harness.ts +3 -3
  108. package/src/shared/model-resolution.test.ts +61 -0
  109. package/src/shared/model-resolution.ts +14 -5
  110. package/src/shared/prompt-surface-runtime.ts +3 -3
  111. package/src/shared/tag-transcript.ts +11 -0
  112. package/src/shared/transcript.ts +3 -1
  113. package/dist/announcement-3g9xg433.js +0 -18
  114. package/dist/conflict-warning-hook-rf17b6et.js +0 -17
  115. package/dist/derive-budgets-9q2d3r93.js +0 -14
  116. package/dist/emscripten-module-49k43zfy.js +0 -507
  117. package/dist/emscripten-module-ex4v0x4z.js +0 -606
  118. package/dist/emscripten-module-jfs3d1dq.js +0 -1536
  119. package/dist/emscripten-module-ss4g4spn.js +0 -4563
  120. package/dist/ffi-bbm9vkfa.js +0 -92
  121. package/dist/ffi-kb5r0x1j.js +0 -92
  122. package/dist/ffi-qnrt0y78.js +0 -80
  123. package/dist/ffi-yx2hpf4p.js +0 -80
  124. package/dist/index-8sseka65.js +0 -251
  125. package/dist/index-ss632za9.js +0 -77
  126. package/dist/model-resolution-6w6wzw18.js +0 -17
  127. package/dist/module-ES6BEMUI-1yjdz59c.js +0 -14
  128. package/dist/module-asyncify-2EFITU5U-fdkx4fhy.js +0 -9
  129. package/dist/prompt-context-29qkb28f.js +0 -7
  130. package/dist/recomp-orchestrator-m37p3fq6.js +0 -34
  131. package/dist/rpc-notifications-1ffm755w.js +0 -17
  132. package/dist/safe-notification-target-2a8py95v.js +0 -11
  133. package/dist/send-session-notification-bw7eex6w.js +0 -20
  134. package/dist/storage-meta-session-dse3qv6s.js +0 -23
  135. package/dist/task-config-gv6s04fp.js +0 -18
  136. /package/dist/{index-37yzyeca.js → index-3fe78beq.js} +0 -0
  137. /package/dist/{index-8mtsfhyg.js → index-jfpk81yt.js} +0 -0
  138. /package/dist/{index-2wchnyk6.js → index-kby1sng5.js} +0 -0
@@ -4241,18 +4241,18 @@ var Environment = class {
4241
4241
  }
4242
4242
  }
4243
4243
  };
4244
- function setupGlobals(env22) {
4245
- env22.set("false", false);
4246
- env22.set("true", true);
4247
- env22.set("none", null);
4248
- env22.set("raise_exception", (args) => {
4244
+ function setupGlobals(env2) {
4245
+ env2.set("false", false);
4246
+ env2.set("true", true);
4247
+ env2.set("none", null);
4248
+ env2.set("raise_exception", (args) => {
4249
4249
  throw new Error(args);
4250
4250
  });
4251
- env22.set("range", range);
4252
- env22.set("strftime_now", strftime_now);
4253
- env22.set("True", true);
4254
- env22.set("False", false);
4255
- env22.set("None", null);
4251
+ env2.set("range", range);
4252
+ env2.set("strftime_now", strftime_now);
4253
+ env2.set("True", true);
4254
+ env2.set("False", false);
4255
+ env2.set("None", null);
4256
4256
  }
4257
4257
  function getAttributeValue(item, attributePath) {
4258
4258
  const parts = attributePath.split(".");
@@ -4317,8 +4317,8 @@ function compareRuntimeValues(a, b, caseSensitive = false) {
4317
4317
  }
4318
4318
  var Interpreter = class {
4319
4319
  global;
4320
- constructor(env22) {
4321
- this.global = env22 ?? new Environment;
4320
+ constructor(env2) {
4321
+ this.global = env2 ?? new Environment;
4322
4322
  }
4323
4323
  run(program) {
4324
4324
  return this.evaluate(program, this.global);
@@ -5401,14 +5401,14 @@ var Template = class {
5401
5401
  this.parsed = parse(tokens);
5402
5402
  }
5403
5403
  render(items) {
5404
- const env22 = new Environment;
5405
- setupGlobals(env22);
5404
+ const env2 = new Environment;
5405
+ setupGlobals(env2);
5406
5406
  if (items) {
5407
5407
  for (const [key, value] of Object.entries(items)) {
5408
- env22.set(key, value);
5408
+ env2.set(key, value);
5409
5409
  }
5410
5410
  }
5411
- const interpreter = new Interpreter(env22);
5411
+ const interpreter = new Interpreter(env2);
5412
5412
  const result = interpreter.run(this.parsed);
5413
5413
  return result.value;
5414
5414
  }
@@ -6055,8 +6055,8 @@ function getFetchHeaders(urlOrPath) {
6055
6055
  const headers = new Headers;
6056
6056
  if (isNode) {
6057
6057
  const IS_CI = !!process.env?.TESTING_REMOTELY;
6058
- const version2 = env3.version;
6059
- headers.set("User-Agent", `transformers.js/${version2}; is_ci/${IS_CI};`);
6058
+ const version = env3.version;
6059
+ headers.set("User-Agent", `transformers.js/${version}; is_ci/${IS_CI};`);
6060
6060
  const isHFURL = isValidUrl(urlOrPath, ["http:", "https:"], ["huggingface.co", "hf.co"]);
6061
6061
  if (isHFURL) {
6062
6062
  const token = process.env?.HF_TOKEN ?? process.env?.HF_ACCESS_TOKEN;
@@ -6819,7 +6819,7 @@ function dynamic_time_warping(matrix) {
6819
6819
  const outputShape = [output_length + 1, input_length + 1];
6820
6820
  const cost = Array.from({ length: outputShape[0] }, () => Array(outputShape[1]).fill(Infinity));
6821
6821
  cost[0][0] = 0;
6822
- const trace2 = Array.from({ length: outputShape[0] }, () => Array(outputShape[1]).fill(-1));
6822
+ const trace = Array.from({ length: outputShape[0] }, () => Array(outputShape[1]).fill(-1));
6823
6823
  for (let j2 = 1;j2 < outputShape[1]; ++j2) {
6824
6824
  for (let i2 = 1;i2 < outputShape[0]; ++i2) {
6825
6825
  const c0 = cost[i2 - 1][j2 - 1];
@@ -6837,14 +6837,14 @@ function dynamic_time_warping(matrix) {
6837
6837
  t = 2;
6838
6838
  }
6839
6839
  cost[i2][j2] = matrix[i2 - 1][j2 - 1] + c;
6840
- trace2[i2][j2] = t;
6840
+ trace[i2][j2] = t;
6841
6841
  }
6842
6842
  }
6843
6843
  for (let i2 = 0;i2 < outputShape[1]; ++i2) {
6844
- trace2[0][i2] = 2;
6844
+ trace[0][i2] = 2;
6845
6845
  }
6846
6846
  for (let i2 = 0;i2 < outputShape[0]; ++i2) {
6847
- trace2[i2][0] = 1;
6847
+ trace[i2][0] = 1;
6848
6848
  }
6849
6849
  let i = output_length;
6850
6850
  let j = input_length;
@@ -6853,7 +6853,7 @@ function dynamic_time_warping(matrix) {
6853
6853
  while (i > 0 || j > 0) {
6854
6854
  text_indices.push(i - 1);
6855
6855
  time_indices.push(j - 1);
6856
- switch (trace2[i][j]) {
6856
+ switch (trace[i][j]) {
6857
6857
  case 0:
6858
6858
  --i;
6859
6859
  --j;
@@ -8784,9 +8784,9 @@ function reshape(data, dimensions) {
8784
8784
  }
8785
8785
  return reshapedArray[0];
8786
8786
  }
8787
- function permute(tensor2, axes) {
8788
- const [permutedData, shape] = permute_data(tensor2.data, tensor2.dims, axes);
8789
- return new Tensor22(tensor2.type, permutedData, shape);
8787
+ function permute(tensor, axes) {
8788
+ const [permutedData, shape] = permute_data(tensor.data, tensor.dims, axes);
8789
+ return new Tensor22(tensor.type, permutedData, shape);
8790
8790
  }
8791
8791
  function interpolate(input, [out_height, out_width], mode = "bilinear", align_corners = false) {
8792
8792
  const in_channels = input.dims.at(-3) ?? 1;
@@ -8946,8 +8946,8 @@ function cat(tensors, dim = 0) {
8946
8946
  const resultType = tensors[0].type;
8947
8947
  if (dim === 0) {
8948
8948
  let offset = 0;
8949
- for (const tensor2 of tensors) {
8950
- const tensorData = tensor2.data;
8949
+ for (const tensor of tensors) {
8950
+ const tensorData = tensor.data;
8951
8951
  result.set(tensorData, offset);
8952
8952
  offset += tensorData.length;
8953
8953
  }
@@ -9070,20 +9070,20 @@ function full(size, fill_value) {
9070
9070
  }
9071
9071
  return fullHelper(size, fill_value, dtype, typedArrayCls);
9072
9072
  }
9073
- function full_like(tensor2, fill_value) {
9074
- return full(tensor2.dims, fill_value);
9073
+ function full_like(tensor, fill_value) {
9074
+ return full(tensor.dims, fill_value);
9075
9075
  }
9076
9076
  function ones(size) {
9077
9077
  return fullHelper(size, 1n, "int64", BigInt64Array);
9078
9078
  }
9079
- function ones_like(tensor2) {
9080
- return ones(tensor2.dims);
9079
+ function ones_like(tensor) {
9080
+ return ones(tensor.dims);
9081
9081
  }
9082
9082
  function zeros(size) {
9083
9083
  return fullHelper(size, 0n, "int64", BigInt64Array);
9084
9084
  }
9085
- function zeros_like(tensor2) {
9086
- return zeros(tensor2.dims);
9085
+ function zeros_like(tensor) {
9086
+ return zeros(tensor.dims);
9087
9087
  }
9088
9088
  function rand(size) {
9089
9089
  const length = size.reduce((a, b) => a * b, 1);
@@ -9093,11 +9093,11 @@ function randn(size) {
9093
9093
  const length = size.reduce((a, b) => a * b, 1);
9094
9094
  return new Tensor22("float32", Float32Array.from({ length }, () => random.gauss()), size);
9095
9095
  }
9096
- function quantize_embeddings(tensor2, precision) {
9097
- if (tensor2.dims.length !== 2) {
9096
+ function quantize_embeddings(tensor, precision) {
9097
+ if (tensor.dims.length !== 2) {
9098
9098
  throw new Error("The tensor must have 2 dimensions");
9099
9099
  }
9100
- if (tensor2.dims.at(-1) % 8 !== 0) {
9100
+ if (tensor.dims.at(-1) % 8 !== 0) {
9101
9101
  throw new Error("The last dimension of the tensor must be a multiple of 8");
9102
9102
  }
9103
9103
  if (!["binary", "ubinary"].includes(precision)) {
@@ -9106,7 +9106,7 @@ function quantize_embeddings(tensor2, precision) {
9106
9106
  const signed = precision === "binary";
9107
9107
  const dtype = signed ? "int8" : "uint8";
9108
9108
  const cls = signed ? Int8Array : Uint8Array;
9109
- const inputData = tensor2.data;
9109
+ const inputData = tensor.data;
9110
9110
  const outputData = new cls(inputData.length / 8);
9111
9111
  for (let i = 0;i < inputData.length; ++i) {
9112
9112
  const bit = inputData[i] > 0 ? 1 : 0;
@@ -9117,7 +9117,7 @@ function quantize_embeddings(tensor2, precision) {
9117
9117
  outputData[arrayIndex] -= 128;
9118
9118
  }
9119
9119
  }
9120
- return new Tensor22(dtype, outputData, [tensor2.dims[0], tensor2.dims[1] / 8]);
9120
+ return new Tensor22(dtype, outputData, [tensor.dims[0], tensor.dims[1] / 8]);
9121
9121
  }
9122
9122
  async function get_tokenizer_files(modelId) {
9123
9123
  if (!modelId) {
@@ -9133,16 +9133,16 @@ async function loadTokenizer(pretrained_model_name_or_path, options) {
9133
9133
  const tokenizerFiles = await get_tokenizer_files(pretrained_model_name_or_path);
9134
9134
  return await Promise.all(tokenizerFiles.map((file) => getModelJSON(pretrained_model_name_or_path, file, true, options)));
9135
9135
  }
9136
- function prepareTensorForDecode(tensor2) {
9137
- const dims = tensor2.dims;
9136
+ function prepareTensorForDecode(tensor) {
9137
+ const dims = tensor.dims;
9138
9138
  switch (dims.length) {
9139
9139
  case 1:
9140
- return tensor2.tolist();
9140
+ return tensor.tolist();
9141
9141
  case 2:
9142
9142
  if (dims[0] !== 1) {
9143
9143
  throw new Error("Unable to decode tensor with `batch size !== 1`. Use `tokenizer.batch_decode(...)` for batched inputs.");
9144
9144
  }
9145
- return tensor2.tolist()[0];
9145
+ return tensor.tolist()[0];
9146
9146
  default:
9147
9147
  throw new Error(`Expected tensor to have 1-2 dimensions, got ${dims.length}.`);
9148
9148
  }
@@ -11705,26 +11705,26 @@ var RawImage = class _RawImage {
11705
11705
  return await loadImageFunction(img);
11706
11706
  }
11707
11707
  }
11708
- static fromTensor(tensor2, channel_format = "CHW") {
11709
- if (tensor2.dims.length !== 3) {
11710
- throw new Error(`Tensor should have 3 dimensions, but has ${tensor2.dims.length} dimensions.`);
11708
+ static fromTensor(tensor, channel_format = "CHW") {
11709
+ if (tensor.dims.length !== 3) {
11710
+ throw new Error(`Tensor should have 3 dimensions, but has ${tensor.dims.length} dimensions.`);
11711
11711
  }
11712
11712
  if (channel_format === "CHW") {
11713
- tensor2 = tensor2.transpose(1, 2, 0);
11713
+ tensor = tensor.transpose(1, 2, 0);
11714
11714
  } else if (channel_format === "HWC") {} else {
11715
11715
  throw new Error(`Unsupported channel format: ${channel_format}`);
11716
11716
  }
11717
- if (!(tensor2.data instanceof Uint8ClampedArray || tensor2.data instanceof Uint8Array)) {
11718
- throw new Error(`Unsupported tensor type: ${tensor2.type}`);
11717
+ if (!(tensor.data instanceof Uint8ClampedArray || tensor.data instanceof Uint8Array)) {
11718
+ throw new Error(`Unsupported tensor type: ${tensor.type}`);
11719
11719
  }
11720
- switch (tensor2.dims[2]) {
11720
+ switch (tensor.dims[2]) {
11721
11721
  case 1:
11722
11722
  case 2:
11723
11723
  case 3:
11724
11724
  case 4:
11725
- return new _RawImage(tensor2.data, tensor2.dims[1], tensor2.dims[0], tensor2.dims[2]);
11725
+ return new _RawImage(tensor.data, tensor.dims[1], tensor.dims[0], tensor.dims[2]);
11726
11726
  default:
11727
- throw new Error(`Unsupported number of channels: ${tensor2.dims[2]}`);
11727
+ throw new Error(`Unsupported number of channels: ${tensor.dims[2]}`);
11728
11728
  }
11729
11729
  }
11730
11730
  grayscale() {
@@ -12011,13 +12011,13 @@ var RawImage = class _RawImage {
12011
12011
  return await canvas.convertToBlob({ type, quality });
12012
12012
  }
12013
12013
  toTensor(channel_format = "CHW") {
12014
- let tensor2 = new Tensor22("uint8", new Uint8Array(this.data), [this.height, this.width, this.channels]);
12014
+ let tensor = new Tensor22("uint8", new Uint8Array(this.data), [this.height, this.width, this.channels]);
12015
12015
  if (channel_format === "HWC") {} else if (channel_format === "CHW") {
12016
- tensor2 = tensor2.permute(2, 0, 1);
12016
+ tensor = tensor.permute(2, 0, 1);
12017
12017
  } else {
12018
12018
  throw new Error(`Unsupported channel format: ${channel_format}`);
12019
12019
  }
12020
- return tensor2;
12020
+ return tensor;
12021
12021
  }
12022
12022
  toCanvas() {
12023
12023
  if (!apis.IS_WEB_ENV) {
@@ -15301,25 +15301,25 @@ async function sessionRun(session, inputs) {
15301
15301
  const checkedInputs = validateInputs(session, inputs);
15302
15302
  try {
15303
15303
  const ortFeed = Object.fromEntries(Object.entries(checkedInputs).map(([k, v]) => {
15304
- const tensor2 = v.ort_tensor;
15304
+ const tensor = v.ort_tensor;
15305
15305
  if (apis.IS_NODE_ENV) {
15306
- if (typeof Float16Array !== "undefined" && tensor2.cpuData instanceof Float16Array) {
15307
- tensor2.cpuData = new Uint16Array(tensor2.cpuData.buffer);
15306
+ if (typeof Float16Array !== "undefined" && tensor.cpuData instanceof Float16Array) {
15307
+ tensor.cpuData = new Uint16Array(tensor.cpuData.buffer);
15308
15308
  }
15309
15309
  }
15310
- return [k, tensor2];
15310
+ return [k, tensor];
15311
15311
  }));
15312
15312
  const output = await runInferenceSession(session, ortFeed);
15313
15313
  return replaceTensors(output);
15314
15314
  } catch (e) {
15315
- const formatted = Object.fromEntries(Object.entries(checkedInputs).map(([k, tensor2]) => {
15315
+ const formatted = Object.fromEntries(Object.entries(checkedInputs).map(([k, tensor]) => {
15316
15316
  const unpacked = {
15317
- type: tensor2.type,
15318
- dims: tensor2.dims,
15319
- location: tensor2.location
15317
+ type: tensor.type,
15318
+ dims: tensor.dims,
15319
+ location: tensor.location
15320
15320
  };
15321
15321
  if (unpacked.location !== "gpu-buffer") {
15322
- unpacked.data = tensor2.data;
15322
+ unpacked.data = tensor.data;
15323
15323
  }
15324
15324
  return [k, unpacked];
15325
15325
  }));
@@ -15332,12 +15332,12 @@ function validateInputs(session, inputs) {
15332
15332
  const checkedInputs = /* @__PURE__ */ Object.create(null);
15333
15333
  const missingInputs = [];
15334
15334
  for (const inputName of session.inputNames) {
15335
- const tensor2 = inputs[inputName];
15336
- if (!(tensor2 instanceof Tensor22)) {
15335
+ const tensor = inputs[inputName];
15336
+ if (!(tensor instanceof Tensor22)) {
15337
15337
  missingInputs.push(inputName);
15338
15338
  continue;
15339
15339
  }
15340
- checkedInputs[inputName] = isONNXProxy() ? tensor2.clone() : tensor2;
15340
+ checkedInputs[inputName] = isONNXProxy() ? tensor.clone() : tensor;
15341
15341
  }
15342
15342
  if (missingInputs.length > 0) {
15343
15343
  throw new Error(`An error occurred during model execution: "Missing the following inputs: ${missingInputs.join(", ")}.`);
@@ -16736,9 +16736,9 @@ var PreTrainedModel = class extends Callable {
16736
16736
  const sequences = new Tensor22("int64", all_input_ids.flat(), [all_input_ids.length, all_input_ids[0].length]);
16737
16737
  const past_key_values = getPastKeyValues(outputs, model_inputs.past_key_values);
16738
16738
  const cachedTensors = new Set(Object.values(past_key_values));
16739
- for (const tensor2 of Object.values(outputs)) {
16740
- if (tensor2.location === "gpu-buffer" && !cachedTensors.has(tensor2)) {
16741
- tensor2.dispose();
16739
+ for (const tensor of Object.values(outputs)) {
16740
+ if (tensor.location === "gpu-buffer" && !cachedTensors.has(tensor)) {
16741
+ tensor.dispose();
16742
16742
  }
16743
16743
  }
16744
16744
  const keepCacheAlive = "past_key_values" in kwargs || generation_config.return_dict_in_generate;
@@ -19595,8 +19595,8 @@ var MultiModalityCausalLM = class extends MultiModalityPreTrainedModel {
19595
19595
  });
19596
19596
  const clamped = decoded_image.add_(1).mul_(255 / 2).clamp_(0, 255).to("uint8");
19597
19597
  const images = [];
19598
- for (const tensor2 of clamped) {
19599
- const img = RawImage.fromTensor(tensor2);
19598
+ for (const tensor of clamped) {
19599
+ const img = RawImage.fromTensor(tensor);
19600
19600
  images.push(img);
19601
19601
  }
19602
19602
  return images;