@plune-ai/cli 0.32.1 → 0.32.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.
package/dist/cli.cjs CHANGED
@@ -3218,7 +3218,7 @@ async function startRun(passed, declared2) {
3218
3218
  stats.deferred += results.length;
3219
3219
  }
3220
3220
  async function resolveKeys(values) {
3221
- const unknown = values.filter((k) => !resolved.has(k.value));
3221
+ const unknown = values.filter((k) => !resolved.has(keyId(k)));
3222
3222
  if (unknown.length === 0 || offline) return;
3223
3223
  for (const part of chunk(unknown, RESOLVE_CHUNK)) {
3224
3224
  const out = await client.post(
@@ -3230,7 +3230,7 @@ async function startRun(passed, declared2) {
3230
3230
  return;
3231
3231
  }
3232
3232
  for (const row of out.body.results) {
3233
- if (typeof row?.key?.value === "string") resolved.set(row.key.value, row.testCaseId);
3233
+ if (typeof row?.key?.value === "string") resolved.set(keyId(row.key), row.testCaseId);
3234
3234
  }
3235
3235
  }
3236
3236
  }
@@ -3239,7 +3239,7 @@ async function startRun(passed, declared2) {
3239
3239
  const stated2 = expected?.slice(0, EXPECTED_MAX) ?? [];
3240
3240
  const configuration2 = stated2.length === 0 ? void 0 : {
3241
3241
  expected: stated2.flatMap((keys) => {
3242
- const hit = keys.map((k) => resolved.get(k.value)).find((v) => typeof v === "string");
3242
+ const hit = keys.map((k) => resolved.get(keyId(k))).find((v) => typeof v === "string");
3243
3243
  if (typeof hit === "string") return [{ testCaseId: hit }];
3244
3244
  return keys[0] === void 0 ? [] : [{ externalKey: keys[0] }];
3245
3245
  }),
@@ -3288,7 +3288,7 @@ async function startRun(passed, declared2) {
3288
3288
  if (result.testCaseId !== void 0) return { kind: "found", testCaseId: result.testCaseId };
3289
3289
  let unanswered = false;
3290
3290
  for (const key of result.keys) {
3291
- const hit = resolved.get(key.value);
3291
+ const hit = resolved.get(keyId(key));
3292
3292
  if (typeof hit === "string") return { kind: "found", testCaseId: hit };
3293
3293
  if (hit === void 0) unanswered = true;
3294
3294
  }
@@ -3300,14 +3300,14 @@ async function startRun(passed, declared2) {
3300
3300
  if (result.keys.length === 0) return;
3301
3301
  const title = boundTitle(result.title);
3302
3302
  if (title !== result.title) shortened.add(result.title);
3303
- discoveries.set(result.keys[0].value, {
3303
+ discoveries.set(keyId(result.keys[0]), {
3304
3304
  keys: result.keys,
3305
3305
  title,
3306
3306
  source: result.source,
3307
3307
  specRef: result.specRef,
3308
3308
  rawStatus: result.rawStatus
3309
3309
  });
3310
- held.set(result.keys[0].value, result);
3310
+ for (const key of result.keys) held.set(keyId(key), result);
3311
3311
  }
3312
3312
  async function offer() {
3313
3313
  if (discoveries.size === 0 || offline || runId === null) return;
@@ -3331,9 +3331,9 @@ async function startRun(passed, declared2) {
3331
3331
  const submissions = [];
3332
3332
  const filesByKey = /* @__PURE__ */ new Map();
3333
3333
  for (const r of made) {
3334
- const pending = typeof r.id === "string" && r.id !== "" ? held.get(r.key?.value) : void 0;
3334
+ const pending = typeof r.id === "string" && r.id !== "" && typeof r.key?.value === "string" ? held.get(keyId(r.key)) : void 0;
3335
3335
  if (pending === void 0) continue;
3336
- held.delete(r.key.value);
3336
+ for (const key of pending.keys) held.delete(keyId(key));
3337
3337
  const { keys: _keys, files, ...rest } = pending;
3338
3338
  submissions.push({ ...rest, testCaseId: r.id });
3339
3339
  if (files !== void 0) filesByKey.set(pending.resultKey, files);
@@ -3964,7 +3964,7 @@ async function startRun(passed, declared2) {
3964
3964
  }
3965
3965
  };
3966
3966
  }
3967
- var import_node_crypto3, import_node_fs5, import_node_path3, import_node_util2, RESOLVE_CHUNK, BATCH_MAX, DISCOVER_MAX, BATCH_DEFAULT, SEND_CONCURRENCY, EXPECTED_MAX, KEY_MAX, TITLE_MAX, COUNTED, SCREENSHOT_TYPES, SCREENSHOT_BYTES, SCREENSHOTS_PER_RESULT, TEXT_BYTES, TEXTS_PER_RESULT, UTF8, TYPE_BY_EXTENSION, METADATA_TYPE2, NAME_MAX, SKIPPED, BUCKET_FOUND, KINDS, codeOf2, BATCH_BYTES, ENVELOPE_BYTES;
3967
+ var import_node_crypto3, import_node_fs5, import_node_path3, import_node_util2, RESOLVE_CHUNK, BATCH_MAX, DISCOVER_MAX, BATCH_DEFAULT, SEND_CONCURRENCY, EXPECTED_MAX, KEY_MAX, TITLE_MAX, COUNTED, SCREENSHOT_TYPES, SCREENSHOT_BYTES, SCREENSHOTS_PER_RESULT, TEXT_BYTES, TEXTS_PER_RESULT, UTF8, TYPE_BY_EXTENSION, METADATA_TYPE2, NAME_MAX, SKIPPED, BUCKET_FOUND, KINDS, codeOf2, keyId, BATCH_BYTES, ENVELOPE_BYTES;
3968
3968
  var init_session = __esm({
3969
3969
  "src/reporter-core/session.ts"() {
3970
3970
  "use strict";
@@ -4024,6 +4024,7 @@ var init_session = __esm({
4024
4024
  file: { label: "file", bytes: 0, room: 0, limit: "limit", size: "size" }
4025
4025
  };
4026
4026
  codeOf2 = (out) => out.code ?? (out.status === null ? "network" : `http_${out.status}`);
4027
+ keyId = (key) => `${key.kind ?? ""}\0${key.value}`;
4027
4028
  BATCH_BYTES = 8 * 1024 * 1024;
4028
4029
  ENVELOPE_BYTES = Buffer.byteLength(JSON.stringify({ results: [] }));
4029
4030
  }
@@ -726,6 +726,7 @@ function boundKey(key) {
726
726
  if (/[\uD800-\uDBFF]$/.test(head)) head = head.slice(0, -1);
727
727
  return { ...key, value: `${head}#${digest}` };
728
728
  }
729
+ var keyId = (key) => `${key.kind ?? ""}\0${key.value}`;
729
730
  function whyUnoffered(out) {
730
731
  if (out.ok || out.status !== 429) return "other";
731
732
  if (/review queue quota reached/i.test(out.detail)) return "queue";
@@ -863,7 +864,7 @@ async function startRun(passed, declared) {
863
864
  stats.deferred += results.length;
864
865
  }
865
866
  async function resolveKeys(values) {
866
- const unknown = values.filter((k) => !resolved.has(k.value));
867
+ const unknown = values.filter((k) => !resolved.has(keyId(k)));
867
868
  if (unknown.length === 0 || offline) return;
868
869
  for (const part of chunk(unknown, RESOLVE_CHUNK)) {
869
870
  const out = await client.post(
@@ -875,7 +876,7 @@ async function startRun(passed, declared) {
875
876
  return;
876
877
  }
877
878
  for (const row of out.body.results) {
878
- if (typeof row?.key?.value === "string") resolved.set(row.key.value, row.testCaseId);
879
+ if (typeof row?.key?.value === "string") resolved.set(keyId(row.key), row.testCaseId);
879
880
  }
880
881
  }
881
882
  }
@@ -884,7 +885,7 @@ async function startRun(passed, declared) {
884
885
  const stated2 = expected?.slice(0, EXPECTED_MAX) ?? [];
885
886
  const configuration2 = stated2.length === 0 ? void 0 : {
886
887
  expected: stated2.flatMap((keys) => {
887
- const hit = keys.map((k) => resolved.get(k.value)).find((v) => typeof v === "string");
888
+ const hit = keys.map((k) => resolved.get(keyId(k))).find((v) => typeof v === "string");
888
889
  if (typeof hit === "string") return [{ testCaseId: hit }];
889
890
  return keys[0] === void 0 ? [] : [{ externalKey: keys[0] }];
890
891
  }),
@@ -933,7 +934,7 @@ async function startRun(passed, declared) {
933
934
  if (result.testCaseId !== void 0) return { kind: "found", testCaseId: result.testCaseId };
934
935
  let unanswered = false;
935
936
  for (const key of result.keys) {
936
- const hit = resolved.get(key.value);
937
+ const hit = resolved.get(keyId(key));
937
938
  if (typeof hit === "string") return { kind: "found", testCaseId: hit };
938
939
  if (hit === void 0) unanswered = true;
939
940
  }
@@ -945,14 +946,14 @@ async function startRun(passed, declared) {
945
946
  if (result.keys.length === 0) return;
946
947
  const title = boundTitle(result.title);
947
948
  if (title !== result.title) shortened.add(result.title);
948
- discoveries.set(result.keys[0].value, {
949
+ discoveries.set(keyId(result.keys[0]), {
949
950
  keys: result.keys,
950
951
  title,
951
952
  source: result.source,
952
953
  specRef: result.specRef,
953
954
  rawStatus: result.rawStatus
954
955
  });
955
- held.set(result.keys[0].value, result);
956
+ for (const key of result.keys) held.set(keyId(key), result);
956
957
  }
957
958
  async function offer() {
958
959
  if (discoveries.size === 0 || offline || runId === null) return;
@@ -976,9 +977,9 @@ async function startRun(passed, declared) {
976
977
  const submissions = [];
977
978
  const filesByKey = /* @__PURE__ */ new Map();
978
979
  for (const r of made) {
979
- const pending = typeof r.id === "string" && r.id !== "" ? held.get(r.key?.value) : void 0;
980
+ const pending = typeof r.id === "string" && r.id !== "" && typeof r.key?.value === "string" ? held.get(keyId(r.key)) : void 0;
980
981
  if (pending === void 0) continue;
981
- held.delete(r.key.value);
982
+ for (const key of pending.keys) held.delete(keyId(key));
982
983
  const { keys: _keys, files, ...rest } = pending;
983
984
  submissions.push({ ...rest, testCaseId: r.id });
984
985
  if (files !== void 0) filesByKey.set(pending.resultKey, files);
@@ -676,6 +676,7 @@ function boundKey(key) {
676
676
  if (/[\uD800-\uDBFF]$/.test(head)) head = head.slice(0, -1);
677
677
  return { ...key, value: `${head}#${digest}` };
678
678
  }
679
+ var keyId = (key) => `${key.kind ?? ""}\0${key.value}`;
679
680
  function whyUnoffered(out) {
680
681
  if (out.ok || out.status !== 429) return "other";
681
682
  if (/review queue quota reached/i.test(out.detail)) return "queue";
@@ -813,7 +814,7 @@ async function startRun(passed, declared) {
813
814
  stats.deferred += results.length;
814
815
  }
815
816
  async function resolveKeys(values) {
816
- const unknown = values.filter((k) => !resolved.has(k.value));
817
+ const unknown = values.filter((k) => !resolved.has(keyId(k)));
817
818
  if (unknown.length === 0 || offline) return;
818
819
  for (const part of chunk(unknown, RESOLVE_CHUNK)) {
819
820
  const out = await client.post(
@@ -825,7 +826,7 @@ async function startRun(passed, declared) {
825
826
  return;
826
827
  }
827
828
  for (const row of out.body.results) {
828
- if (typeof row?.key?.value === "string") resolved.set(row.key.value, row.testCaseId);
829
+ if (typeof row?.key?.value === "string") resolved.set(keyId(row.key), row.testCaseId);
829
830
  }
830
831
  }
831
832
  }
@@ -834,7 +835,7 @@ async function startRun(passed, declared) {
834
835
  const stated2 = expected?.slice(0, EXPECTED_MAX) ?? [];
835
836
  const configuration2 = stated2.length === 0 ? void 0 : {
836
837
  expected: stated2.flatMap((keys) => {
837
- const hit = keys.map((k) => resolved.get(k.value)).find((v) => typeof v === "string");
838
+ const hit = keys.map((k) => resolved.get(keyId(k))).find((v) => typeof v === "string");
838
839
  if (typeof hit === "string") return [{ testCaseId: hit }];
839
840
  return keys[0] === void 0 ? [] : [{ externalKey: keys[0] }];
840
841
  }),
@@ -883,7 +884,7 @@ async function startRun(passed, declared) {
883
884
  if (result.testCaseId !== void 0) return { kind: "found", testCaseId: result.testCaseId };
884
885
  let unanswered = false;
885
886
  for (const key of result.keys) {
886
- const hit = resolved.get(key.value);
887
+ const hit = resolved.get(keyId(key));
887
888
  if (typeof hit === "string") return { kind: "found", testCaseId: hit };
888
889
  if (hit === void 0) unanswered = true;
889
890
  }
@@ -895,14 +896,14 @@ async function startRun(passed, declared) {
895
896
  if (result.keys.length === 0) return;
896
897
  const title = boundTitle(result.title);
897
898
  if (title !== result.title) shortened.add(result.title);
898
- discoveries.set(result.keys[0].value, {
899
+ discoveries.set(keyId(result.keys[0]), {
899
900
  keys: result.keys,
900
901
  title,
901
902
  source: result.source,
902
903
  specRef: result.specRef,
903
904
  rawStatus: result.rawStatus
904
905
  });
905
- held.set(result.keys[0].value, result);
906
+ for (const key of result.keys) held.set(keyId(key), result);
906
907
  }
907
908
  async function offer() {
908
909
  if (discoveries.size === 0 || offline || runId === null) return;
@@ -926,9 +927,9 @@ async function startRun(passed, declared) {
926
927
  const submissions = [];
927
928
  const filesByKey = /* @__PURE__ */ new Map();
928
929
  for (const r of made) {
929
- const pending = typeof r.id === "string" && r.id !== "" ? held.get(r.key?.value) : void 0;
930
+ const pending = typeof r.id === "string" && r.id !== "" && typeof r.key?.value === "string" ? held.get(keyId(r.key)) : void 0;
930
931
  if (pending === void 0) continue;
931
- held.delete(r.key.value);
932
+ for (const key of pending.keys) held.delete(keyId(key));
932
933
  const { keys: _keys, files, ...rest } = pending;
933
934
  submissions.push({ ...rest, testCaseId: r.id });
934
935
  if (files !== void 0) filesByKey.set(pending.resultKey, files);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plune-ai/cli",
3
- "version": "0.32.1",
3
+ "version": "0.32.2",
4
4
  "description": "AI-powered assertion testing for LLM apps — write assertions, run them against any provider, get a pass/fail report (local, CI, or diff).",
5
5
  "keywords": [
6
6
  "ai",