@riddledc/riddle-proof 0.7.22 → 0.7.23

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.
@@ -1273,24 +1273,36 @@ return result;
1273
1273
  }
1274
1274
  function collectRiddleProfileArtifactRefs(input) {
1275
1275
  const refs = [];
1276
- const seen = /* @__PURE__ */ new Set();
1276
+ const indexes = /* @__PURE__ */ new Map();
1277
+ const priorities = /* @__PURE__ */ new Map();
1277
1278
  function add(item, source) {
1278
1279
  if (!isRecord(item)) return;
1279
- const name = stringValue(item.name) || stringValue(item.filename) || "";
1280
1280
  const url = stringValue(item.url);
1281
1281
  const path = stringValue(item.path);
1282
+ const rawName = stringValue(item.name) || stringValue(item.filename) || artifactNameFromPath(url || path) || "";
1283
+ const name = normalizeRiddleProfileArtifactName(rawName);
1282
1284
  if (!name && !url && !path) return;
1283
- const key = `${name}:${url || path || ""}`;
1284
- if (seen.has(key)) return;
1285
- seen.add(key);
1286
- refs.push({
1285
+ const key = profileArtifactDedupeKey(name, url || path || "");
1286
+ const priority = profileArtifactPriority(rawName, name);
1287
+ const ref = {
1287
1288
  name,
1288
1289
  url,
1289
1290
  path,
1290
1291
  kind: stringValue(item.kind) || stringValue(item.type),
1291
1292
  content_type: stringValue(item.content_type) || stringValue(item.contentType),
1292
1293
  source
1293
- });
1294
+ };
1295
+ const existingIndex = indexes.get(key);
1296
+ if (existingIndex !== void 0) {
1297
+ if (priority > (priorities.get(key) || 0)) {
1298
+ refs[existingIndex] = ref;
1299
+ priorities.set(key, priority);
1300
+ }
1301
+ return;
1302
+ }
1303
+ indexes.set(key, refs.length);
1304
+ priorities.set(key, priority);
1305
+ refs.push(ref);
1294
1306
  }
1295
1307
  function visit(value, source) {
1296
1308
  if (Array.isArray(value)) {
@@ -1305,6 +1317,31 @@ function collectRiddleProfileArtifactRefs(input) {
1305
1317
  visit(input, "artifacts");
1306
1318
  return refs;
1307
1319
  }
1320
+ function normalizeRiddleProfileArtifactName(name) {
1321
+ return name.replace(/\.json\.json$/i, ".json");
1322
+ }
1323
+ function profileArtifactDedupeKey(name, location) {
1324
+ if (PROFILE_SINGLETON_ARTIFACT_NAMES.has(name.toLowerCase())) return name.toLowerCase();
1325
+ return `${name}:${location}`;
1326
+ }
1327
+ function profileArtifactPriority(rawName, normalizedName) {
1328
+ const lower = normalizedName.toLowerCase();
1329
+ if (!PROFILE_SINGLETON_ARTIFACT_NAMES.has(lower)) return 1;
1330
+ return /\.json\.json$/i.test(rawName) ? 2 : 1;
1331
+ }
1332
+ function artifactNameFromPath(value) {
1333
+ if (!value) return "";
1334
+ try {
1335
+ return new URL(value).pathname.split("/").filter(Boolean).pop() || "";
1336
+ } catch {
1337
+ return value.split(/[\\/]/).filter(Boolean).pop() || "";
1338
+ }
1339
+ }
1340
+ var PROFILE_SINGLETON_ARTIFACT_NAMES = /* @__PURE__ */ new Set([
1341
+ "proof.json",
1342
+ "console.json",
1343
+ "dom-summary.json"
1344
+ ]);
1308
1345
  function extractRiddleProofProfileResult(input) {
1309
1346
  if (!isRecord(input)) return void 0;
1310
1347
  if (input.version === RIDDLE_PROOF_PROFILE_RESULT_VERSION) return input;
package/dist/cli.cjs CHANGED
@@ -8037,24 +8037,36 @@ return result;
8037
8037
  }
8038
8038
  function collectRiddleProfileArtifactRefs(input) {
8039
8039
  const refs = [];
8040
- const seen = /* @__PURE__ */ new Set();
8040
+ const indexes = /* @__PURE__ */ new Map();
8041
+ const priorities = /* @__PURE__ */ new Map();
8041
8042
  function add(item, source) {
8042
8043
  if (!isRecord(item)) return;
8043
- const name = stringValue2(item.name) || stringValue2(item.filename) || "";
8044
8044
  const url = stringValue2(item.url);
8045
8045
  const path7 = stringValue2(item.path);
8046
+ const rawName = stringValue2(item.name) || stringValue2(item.filename) || artifactNameFromPath(url || path7) || "";
8047
+ const name = normalizeRiddleProfileArtifactName(rawName);
8046
8048
  if (!name && !url && !path7) return;
8047
- const key = `${name}:${url || path7 || ""}`;
8048
- if (seen.has(key)) return;
8049
- seen.add(key);
8050
- refs.push({
8049
+ const key = profileArtifactDedupeKey(name, url || path7 || "");
8050
+ const priority = profileArtifactPriority(rawName, name);
8051
+ const ref = {
8051
8052
  name,
8052
8053
  url,
8053
8054
  path: path7,
8054
8055
  kind: stringValue2(item.kind) || stringValue2(item.type),
8055
8056
  content_type: stringValue2(item.content_type) || stringValue2(item.contentType),
8056
8057
  source
8057
- });
8058
+ };
8059
+ const existingIndex = indexes.get(key);
8060
+ if (existingIndex !== void 0) {
8061
+ if (priority > (priorities.get(key) || 0)) {
8062
+ refs[existingIndex] = ref;
8063
+ priorities.set(key, priority);
8064
+ }
8065
+ return;
8066
+ }
8067
+ indexes.set(key, refs.length);
8068
+ priorities.set(key, priority);
8069
+ refs.push(ref);
8058
8070
  }
8059
8071
  function visit(value, source) {
8060
8072
  if (Array.isArray(value)) {
@@ -8069,6 +8081,31 @@ function collectRiddleProfileArtifactRefs(input) {
8069
8081
  visit(input, "artifacts");
8070
8082
  return refs;
8071
8083
  }
8084
+ function normalizeRiddleProfileArtifactName(name) {
8085
+ return name.replace(/\.json\.json$/i, ".json");
8086
+ }
8087
+ function profileArtifactDedupeKey(name, location) {
8088
+ if (PROFILE_SINGLETON_ARTIFACT_NAMES.has(name.toLowerCase())) return name.toLowerCase();
8089
+ return `${name}:${location}`;
8090
+ }
8091
+ function profileArtifactPriority(rawName, normalizedName) {
8092
+ const lower = normalizedName.toLowerCase();
8093
+ if (!PROFILE_SINGLETON_ARTIFACT_NAMES.has(lower)) return 1;
8094
+ return /\.json\.json$/i.test(rawName) ? 2 : 1;
8095
+ }
8096
+ function artifactNameFromPath(value) {
8097
+ if (!value) return "";
8098
+ try {
8099
+ return new URL(value).pathname.split("/").filter(Boolean).pop() || "";
8100
+ } catch {
8101
+ return value.split(/[\\/]/).filter(Boolean).pop() || "";
8102
+ }
8103
+ }
8104
+ var PROFILE_SINGLETON_ARTIFACT_NAMES = /* @__PURE__ */ new Set([
8105
+ "proof.json",
8106
+ "console.json",
8107
+ "dom-summary.json"
8108
+ ]);
8072
8109
  function extractRiddleProofProfileResult(input) {
8073
8110
  if (!isRecord(input)) return void 0;
8074
8111
  if (input.version === RIDDLE_PROOF_PROFILE_RESULT_VERSION) return input;
package/dist/cli.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  profileStatusExitCode,
11
11
  resolveRiddleProofProfileTargetUrl,
12
12
  resolveRiddleProofProfileTimeoutSec
13
- } from "./chunk-WTHSVHG5.js";
13
+ } from "./chunk-XOM2OYAB.js";
14
14
  import {
15
15
  createRiddleApiClient,
16
16
  parseRiddleViewport
package/dist/index.cjs CHANGED
@@ -9987,24 +9987,36 @@ return result;
9987
9987
  }
9988
9988
  function collectRiddleProfileArtifactRefs(input) {
9989
9989
  const refs = [];
9990
- const seen = /* @__PURE__ */ new Set();
9990
+ const indexes = /* @__PURE__ */ new Map();
9991
+ const priorities = /* @__PURE__ */ new Map();
9991
9992
  function add(item, source) {
9992
9993
  if (!isRecord2(item)) return;
9993
- const name = stringValue5(item.name) || stringValue5(item.filename) || "";
9994
9994
  const url = stringValue5(item.url);
9995
9995
  const path6 = stringValue5(item.path);
9996
+ const rawName = stringValue5(item.name) || stringValue5(item.filename) || artifactNameFromPath(url || path6) || "";
9997
+ const name = normalizeRiddleProfileArtifactName(rawName);
9996
9998
  if (!name && !url && !path6) return;
9997
- const key = `${name}:${url || path6 || ""}`;
9998
- if (seen.has(key)) return;
9999
- seen.add(key);
10000
- refs.push({
9999
+ const key = profileArtifactDedupeKey(name, url || path6 || "");
10000
+ const priority = profileArtifactPriority(rawName, name);
10001
+ const ref = {
10001
10002
  name,
10002
10003
  url,
10003
10004
  path: path6,
10004
10005
  kind: stringValue5(item.kind) || stringValue5(item.type),
10005
10006
  content_type: stringValue5(item.content_type) || stringValue5(item.contentType),
10006
10007
  source
10007
- });
10008
+ };
10009
+ const existingIndex = indexes.get(key);
10010
+ if (existingIndex !== void 0) {
10011
+ if (priority > (priorities.get(key) || 0)) {
10012
+ refs[existingIndex] = ref;
10013
+ priorities.set(key, priority);
10014
+ }
10015
+ return;
10016
+ }
10017
+ indexes.set(key, refs.length);
10018
+ priorities.set(key, priority);
10019
+ refs.push(ref);
10008
10020
  }
10009
10021
  function visit(value, source) {
10010
10022
  if (Array.isArray(value)) {
@@ -10019,6 +10031,31 @@ function collectRiddleProfileArtifactRefs(input) {
10019
10031
  visit(input, "artifacts");
10020
10032
  return refs;
10021
10033
  }
10034
+ function normalizeRiddleProfileArtifactName(name) {
10035
+ return name.replace(/\.json\.json$/i, ".json");
10036
+ }
10037
+ function profileArtifactDedupeKey(name, location) {
10038
+ if (PROFILE_SINGLETON_ARTIFACT_NAMES.has(name.toLowerCase())) return name.toLowerCase();
10039
+ return `${name}:${location}`;
10040
+ }
10041
+ function profileArtifactPriority(rawName, normalizedName) {
10042
+ const lower = normalizedName.toLowerCase();
10043
+ if (!PROFILE_SINGLETON_ARTIFACT_NAMES.has(lower)) return 1;
10044
+ return /\.json\.json$/i.test(rawName) ? 2 : 1;
10045
+ }
10046
+ function artifactNameFromPath(value) {
10047
+ if (!value) return "";
10048
+ try {
10049
+ return new URL(value).pathname.split("/").filter(Boolean).pop() || "";
10050
+ } catch {
10051
+ return value.split(/[\\/]/).filter(Boolean).pop() || "";
10052
+ }
10053
+ }
10054
+ var PROFILE_SINGLETON_ARTIFACT_NAMES = /* @__PURE__ */ new Set([
10055
+ "proof.json",
10056
+ "console.json",
10057
+ "dom-summary.json"
10058
+ ]);
10022
10059
  function extractRiddleProofProfileResult(input) {
10023
10060
  if (!isRecord2(input)) return void 0;
10024
10061
  if (input.version === RIDDLE_PROOF_PROFILE_RESULT_VERSION) return input;
package/dist/index.js CHANGED
@@ -58,7 +58,7 @@ import {
58
58
  resolveRiddleProofProfileTimeoutSec,
59
59
  slugifyRiddleProofProfileName,
60
60
  summarizeRiddleProofProfileResult
61
- } from "./chunk-WTHSVHG5.js";
61
+ } from "./chunk-XOM2OYAB.js";
62
62
  import {
63
63
  DEFAULT_RIDDLE_API_BASE_URL,
64
64
  DEFAULT_RIDDLE_API_KEY_FILE,
package/dist/profile.cjs CHANGED
@@ -1316,24 +1316,36 @@ return result;
1316
1316
  }
1317
1317
  function collectRiddleProfileArtifactRefs(input) {
1318
1318
  const refs = [];
1319
- const seen = /* @__PURE__ */ new Set();
1319
+ const indexes = /* @__PURE__ */ new Map();
1320
+ const priorities = /* @__PURE__ */ new Map();
1320
1321
  function add(item, source) {
1321
1322
  if (!isRecord(item)) return;
1322
- const name = stringValue(item.name) || stringValue(item.filename) || "";
1323
1323
  const url = stringValue(item.url);
1324
1324
  const path = stringValue(item.path);
1325
+ const rawName = stringValue(item.name) || stringValue(item.filename) || artifactNameFromPath(url || path) || "";
1326
+ const name = normalizeRiddleProfileArtifactName(rawName);
1325
1327
  if (!name && !url && !path) return;
1326
- const key = `${name}:${url || path || ""}`;
1327
- if (seen.has(key)) return;
1328
- seen.add(key);
1329
- refs.push({
1328
+ const key = profileArtifactDedupeKey(name, url || path || "");
1329
+ const priority = profileArtifactPriority(rawName, name);
1330
+ const ref = {
1330
1331
  name,
1331
1332
  url,
1332
1333
  path,
1333
1334
  kind: stringValue(item.kind) || stringValue(item.type),
1334
1335
  content_type: stringValue(item.content_type) || stringValue(item.contentType),
1335
1336
  source
1336
- });
1337
+ };
1338
+ const existingIndex = indexes.get(key);
1339
+ if (existingIndex !== void 0) {
1340
+ if (priority > (priorities.get(key) || 0)) {
1341
+ refs[existingIndex] = ref;
1342
+ priorities.set(key, priority);
1343
+ }
1344
+ return;
1345
+ }
1346
+ indexes.set(key, refs.length);
1347
+ priorities.set(key, priority);
1348
+ refs.push(ref);
1337
1349
  }
1338
1350
  function visit(value, source) {
1339
1351
  if (Array.isArray(value)) {
@@ -1348,6 +1360,31 @@ function collectRiddleProfileArtifactRefs(input) {
1348
1360
  visit(input, "artifacts");
1349
1361
  return refs;
1350
1362
  }
1363
+ function normalizeRiddleProfileArtifactName(name) {
1364
+ return name.replace(/\.json\.json$/i, ".json");
1365
+ }
1366
+ function profileArtifactDedupeKey(name, location) {
1367
+ if (PROFILE_SINGLETON_ARTIFACT_NAMES.has(name.toLowerCase())) return name.toLowerCase();
1368
+ return `${name}:${location}`;
1369
+ }
1370
+ function profileArtifactPriority(rawName, normalizedName) {
1371
+ const lower = normalizedName.toLowerCase();
1372
+ if (!PROFILE_SINGLETON_ARTIFACT_NAMES.has(lower)) return 1;
1373
+ return /\.json\.json$/i.test(rawName) ? 2 : 1;
1374
+ }
1375
+ function artifactNameFromPath(value) {
1376
+ if (!value) return "";
1377
+ try {
1378
+ return new URL(value).pathname.split("/").filter(Boolean).pop() || "";
1379
+ } catch {
1380
+ return value.split(/[\\/]/).filter(Boolean).pop() || "";
1381
+ }
1382
+ }
1383
+ var PROFILE_SINGLETON_ARTIFACT_NAMES = /* @__PURE__ */ new Set([
1384
+ "proof.json",
1385
+ "console.json",
1386
+ "dom-summary.json"
1387
+ ]);
1351
1388
  function extractRiddleProofProfileResult(input) {
1352
1389
  if (!isRecord(input)) return void 0;
1353
1390
  if (input.version === RIDDLE_PROOF_PROFILE_RESULT_VERSION) return input;
package/dist/profile.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  resolveRiddleProofProfileTimeoutSec,
20
20
  slugifyRiddleProofProfileName,
21
21
  summarizeRiddleProofProfileResult
22
- } from "./chunk-WTHSVHG5.js";
22
+ } from "./chunk-XOM2OYAB.js";
23
23
  export {
24
24
  RIDDLE_PROOF_PROFILE_CHECK_TYPES,
25
25
  RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.7.22",
3
+ "version": "0.7.23",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",