@plune-ai/cli 0.39.9 → 0.39.11

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.
@@ -406,7 +406,7 @@ function failureOf(attempt, home = homedir2()) {
406
406
  const headline = line !== void 0 && jsonBytes(line) <= HEADLINE_LIMIT ? line : void 0;
407
407
  const steps = chainOf(attempt.steps);
408
408
  const location = error === void 0 ? void 0 : fromRoot(placeOf(error, attempt.testFile), attempt.repoRoot);
409
- const artifacts = attempt.attachments.filter((a) => a.path !== void 0 && !a.name.startsWith("_") && a.contentType !== METADATA_TYPE).map(({ name, contentType }) => ({ name: fileNameOf(name), ...contentType ? { contentType } : {} })).filter((a) => a.name !== "");
409
+ const artifacts = attempt.attachments.filter((a) => a.path !== void 0 && !a.name.startsWith("_") && !READ_NOT_KEPT.has(a.contentType ?? "")).map(({ name, contentType }) => ({ name: fileNameOf(name), ...contentType ? { contentType } : {} })).filter((a) => a.name !== "");
410
410
  const ciUrl = webLink(attempt.buildHref);
411
411
  const failure = {
412
412
  ...headline !== void 0 ? { headline } : {},
@@ -482,7 +482,7 @@ function cut(text) {
482
482
  return { text: [...lines.slice(0, head), omitted(tail - head), ...lines.slice(tail)].join("\n"), omitted: text.length - kept.length };
483
483
  }
484
484
  var omitted = (lines) => `\u2026[omitted ${lines} lines]\u2026`;
485
- var METADATA_TYPE = "application/plune.metadata+json";
485
+ var READ_NOT_KEPT = /* @__PURE__ */ new Set(["application/plune.metadata+json", "application/plune.findings+json"]);
486
486
  var REPO_RELATIVE = /^(?![A-Za-z][A-Za-z0-9+.-]*:)(?![\\/~])(?!(?:.*[\\/])?\.\.(?:[\\/]|$)).+$/;
487
487
  var FRAME = /^\s+at (?:.*? \()?(.+?):(\d+):(\d+)\)?$/;
488
488
  var FRAME_MAX = 8192;
@@ -792,7 +792,7 @@ var TYPE_BY_EXTENSION = {
792
792
  ".jpeg": "image/jpeg",
793
793
  ".webp": "image/webp"
794
794
  };
795
- var METADATA_TYPE2 = "application/plune.metadata+json";
795
+ var READ_NOT_KEPT2 = /* @__PURE__ */ new Set(["application/plune.metadata+json", "application/plune.findings+json"]);
796
796
  var NAME_MAX = 200;
797
797
  function nameOf(file) {
798
798
  const own = file.name.split(/[\\/]/).pop()?.trim() || (file.path === void 0 ? "" : basename2(file.path));
@@ -858,8 +858,13 @@ function withoutTargets(result) {
858
858
  const { targets: _targets, traceUrl: _traceUrl, ...rest } = result;
859
859
  return rest;
860
860
  }
861
+ function withoutFindings(result) {
862
+ if (result.findings === void 0) return result;
863
+ const { findings: _findings, ...rest } = result;
864
+ return rest;
865
+ }
861
866
  function onDisk(deferred) {
862
- const result = withoutTargets(deferred);
867
+ const result = withoutFindings(withoutTargets(deferred));
863
868
  if (!("files" in result) || result.files === void 0) return result;
864
869
  const { files, ...rest } = result;
865
870
  const kept = files.filter((f) => f.path !== void 0).map(({ body: _body, ...file }) => file);
@@ -1309,7 +1314,7 @@ function fileSender(options) {
1309
1314
  if (item?.status !== "accepted" || typeof item.id !== "string" || typeof item.resultKey !== "string") continue;
1310
1315
  for (const file of filesByKey.get(item.resultKey) ?? []) {
1311
1316
  const type = mediaTypeOf(file.contentType) ?? (file.path === void 0 ? void 0 : TYPE_BY_EXTENSION[extname(file.path).toLowerCase()]);
1312
- if (type === void 0 || type === METADATA_TYPE2) continue;
1317
+ if (type === void 0 || READ_NOT_KEPT2.has(type)) continue;
1313
1318
  const kind = kindOf(type);
1314
1319
  if (kind !== "text" && file.path === void 0) continue;
1315
1320
  const name = nameOf(file);
@@ -1412,6 +1417,7 @@ async function startRun(passed, declared) {
1412
1417
  let joined = false;
1413
1418
  let offline = token === "";
1414
1419
  let targetsRefused = false;
1420
+ let findingsRefused = false;
1415
1421
  let done = false;
1416
1422
  const shortened = /* @__PURE__ */ new Set();
1417
1423
  const specFiles = /* @__PURE__ */ new Map();
@@ -1683,6 +1689,7 @@ async function startRun(passed, declared) {
1683
1689
  async function send(submissions, filesByKey) {
1684
1690
  for (const packedPart of packed(submissions)) {
1685
1691
  let part = targetsRefused ? packedPart.map(withoutTargets) : packedPart;
1692
+ if (findingsRefused) part = part.map(withoutFindings);
1686
1693
  if (offline) {
1687
1694
  defer(part);
1688
1695
  continue;
@@ -1693,12 +1700,22 @@ async function startRun(passed, declared) {
1693
1700
  { results, ...configuration !== void 0 ? { configuration } : {} }
1694
1701
  );
1695
1702
  let out = await post(part);
1703
+ let withoutItsFindings = false;
1704
+ if (!out.ok && out.kind === "invalid" && out.status === 400 && part.some((r) => r.findings !== void 0)) {
1705
+ withoutItsFindings = true;
1706
+ part = part.map(withoutFindings);
1707
+ out = await post(part);
1708
+ }
1696
1709
  if (!out.ok && out.kind === "invalid" && out.status === 400 && part.some((r) => r.targets !== void 0 || r.traceUrl !== void 0)) {
1697
1710
  if (!targetsRefused) log("plune: the platform does not take targets or a trace link on a result yet \u2014 the results are sent without them.");
1698
1711
  targetsRefused = true;
1699
1712
  part = part.map(withoutTargets);
1700
1713
  out = await post(part);
1701
1714
  }
1715
+ if (withoutItsFindings && out.ok) {
1716
+ if (!findingsRefused) log("plune: the platform does not take findings on a result yet \u2014 the results are sent without them.");
1717
+ findingsRefused = true;
1718
+ }
1702
1719
  const counts = out.ok ? out.body?.counts : void 0;
1703
1720
  const told = COUNTED.filter((k) => typeof counts?.[k] === "number");
1704
1721
  if (told.length > 0) {
@@ -1896,6 +1913,7 @@ export {
1896
1913
  errorContextOf,
1897
1914
  failureOf,
1898
1915
  filesOf,
1916
+ maskCredentials,
1899
1917
  readEnv,
1900
1918
  repoRootOf,
1901
1919
  resultKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plune-ai/cli",
3
- "version": "0.39.9",
3
+ "version": "0.39.11",
4
4
  "mcpName": "ai.plune/cli",
5
5
  "description": "AI-powered assertion testing for LLM apps — write assertions, run them against any provider, get a pass/fail report (local, CI, or diff).",
6
6
  "keywords": [