@gitroll/tacitt-cli 0.3.0 → 0.4.0

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,6 +1,6 @@
1
- import { Bn as validatePlan, Cn as sessionNonce, Dn as entityDictionaryVersion, En as cleanupImplementationVersion, Fn as frameRecords, Gn as detectStatic, H as codePointLength, Hn as defaultLimits, Ht as ApplicationError, In as retainedMainTextNodes, Jn as jsonSpans, Jt as reviewFamilies, Ln as validateProfile, Nn as nativeText, On as nativeParserVersion, Pn as transformRecords, Qt as sourceSnapshotId, Sn as createReplacementKey, Tn as parseNativeRecord, Un as recordPointerLimits, V as bDigest, Wn as resolveLimits, Wt as safeCode, Xn as createEntityMatcher, Xt as sourceKey, Yn as agentContextLocation, an as withMandatoryCustomTerms, c as textDigest, cn as mainReviewRole, dn as renderNative, fn as createSessionPreparation, gn as createDetectionSummary, in as nativeSourceIdentitySchema, ir as isProcessingCode, j as bDuplicateShift, jn as nativeField, k as bBindingCap, kn as redactionImplementationVersion, ln as reviewRoles, nr as ProcessingError, o as reviewDigest, on as processNativeRecord, pn as bindInspection, qt as familySelected, rr as fail$1, sn as projectNativeReviewInput, tr as defaultDetectionLimits, un as createSentenceContext, vn as walkNativeFields, wn as projectNativeRecord, x as createBAnalysisUnits, zn as buildPlan } from "./locate-U3-nkird.mjs";
1
+ import { Bn as validatePlan, Cn as sessionNonce, Dn as entityDictionaryVersion, En as cleanupImplementationVersion, Fn as frameRecords, Gn as detectStatic, H as codePointLength, Hn as defaultLimits, Ht as ApplicationError, In as retainedMainTextNodes, Jn as jsonSpans, Jt as reviewFamilies, Ln as validateProfile, Mn as nativeItems, Nn as nativeText, On as nativeParserVersion, Pn as transformRecords, Qt as sourceSnapshotId, Sn as createReplacementKey, Tn as parseNativeRecord, Un as recordPointerLimits, V as bDigest, Wn as resolveLimits, Wt as safeCode, Xn as createEntityMatcher, Xt as sourceKey, Yn as agentContextLocation, an as withMandatoryCustomTerms, c as textDigest, cn as mainReviewRole, dn as renderNative, fn as createSessionPreparation, gn as createDetectionSummary, in as nativeSourceIdentitySchema, ir as isProcessingCode, j as bDuplicateShift, jn as nativeField, k as bBindingCap, kn as redactionImplementationVersion, ln as reviewRoles, nr as ProcessingError, o as reviewDigest, on as processNativeRecord, pn as bindInspection, qt as familySelected, rr as fail$1, sn as projectNativeReviewInput, tr as defaultDetectionLimits, un as createSentenceContext, vn as walkNativeFields, wn as projectNativeRecord, x as createBAnalysisUnits, zn as buildPlan } from "./locate-U3-nkird.mjs";
2
2
  import { t as createZstdFrameCheck } from "./frame-waS5FnN5.mjs";
3
- import { Bn as bWordBounded, F as withSourceEvidence, I as agentSetupKey, In as bContainment, Ln as bExceptionRanges, Nt as metadataProcessingVersion, P as sourceIdentityEvidence, gr as resolveSourceSelection, ii as approvedTreatmentSchema, it as defaultAgentSetupInclusion, li as staticCatalogRef, ni as sourceChangePolicy, rt as classifyAgentSetup } from "./src-B4R5XMEP.mjs";
3
+ import { An as bContainment, Dt as metadataProcessingVersion, F as withSourceEvidence, I as agentSetupKey, Mr as agentSourceSchema, P as sourceIdentityEvidence, Pn as bWordBounded, ai as sourceChangePolicy, fi as staticCatalogRef, it as defaultAgentSetupInclusion, jn as bExceptionRanges, jr as agentSourcePathSegment, rt as classifyAgentSetup, si as approvedTreatmentSchema, ur as resolveSourceSelection } from "./src-DNn7SifS.mjs";
4
4
  import { constants } from "node:fs";
5
5
  import { link, lstat, mkdir, open, readFile, readdir, realpath, rm, rmdir, stat, unlink } from "node:fs/promises";
6
6
  import { execFile, fork, spawn } from "node:child_process";
@@ -16,6 +16,7 @@ import "node:perf_hooks";
16
16
  import { availableParallelism, platform, tmpdir, totalmem } from "node:os";
17
17
  import { pipeline } from "node:stream/promises";
18
18
  import { constants as constants$1, createZstdDecompress } from "node:zlib";
19
+ import { parse } from "@decimalturn/toml-patch";
19
20
  //#region packages/file-privacy/src/windows/descriptor.ts
20
21
  const system = "S-1-5-18";
21
22
  const administrators = "S-1-5-32-544";
@@ -831,9 +832,9 @@ const readMetadata = async (entry, signal, maximumBytes = metadataLimitBytes) =>
831
832
  };
832
833
  //#endregion
833
834
  //#region packages/artifact/src/manifest/fields.ts
834
- const isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
835
- const record = (value) => {
836
- if (!isRecord$1(value)) return fail("ARTIFACT_INVALID_MANIFEST");
835
+ const isRecord$2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
836
+ const record$1 = (value) => {
837
+ if (!isRecord$2(value)) return fail("ARTIFACT_INVALID_MANIFEST");
837
838
  return value;
838
839
  };
839
840
  const string = (value) => {
@@ -860,7 +861,7 @@ const keys = (value, expected) => {
860
861
  //#endregion
861
862
  //#region packages/artifact/src/manifest/parse.ts
862
863
  const parseCounts = (value) => {
863
- const item = record(value);
864
+ const item = record$1(value);
864
865
  keys(item, [
865
866
  "workspaces",
866
867
  "sessions",
@@ -1086,7 +1087,7 @@ const nativeId = (value) => {
1086
1087
  };
1087
1088
  const nullableId = (value) => value === null ? null : nativeId(value);
1088
1089
  const parsePosition = (value) => {
1089
- const item = record(value);
1090
+ const item = record$1(value);
1090
1091
  keys(item, ["kind", "value"]);
1091
1092
  const kind = item["kind"];
1092
1093
  if (kind === "unknown" && item["value"] === null) return {
@@ -1115,7 +1116,7 @@ const parsePosition = (value) => {
1115
1116
  return fail("ARTIFACT_INVALID_MANIFEST");
1116
1117
  };
1117
1118
  const parseFork = (value) => {
1118
- const item = record(value);
1119
+ const item = record$1(value);
1119
1120
  keys(item, ["parentSessionId", "position"]);
1120
1121
  return {
1121
1122
  parentSessionId: nativeId(item["parentSessionId"]),
@@ -1124,7 +1125,7 @@ const parseFork = (value) => {
1124
1125
  };
1125
1126
  /** Relationships are explicit native metadata; names never determine roles. */
1126
1127
  const parseNativeIdentity = (value) => {
1127
- const item = record(value);
1128
+ const item = record$1(value);
1128
1129
  keys(item, [
1129
1130
  "role",
1130
1131
  "sessionId",
@@ -1143,7 +1144,7 @@ const parseNativeIdentity = (value) => {
1143
1144
  };
1144
1145
  };
1145
1146
  const parseNativeRelation = (value) => {
1146
- const item = record(value);
1147
+ const item = record$1(value);
1147
1148
  const kind = item["kind"];
1148
1149
  if (kind === "call" || kind === "result") {
1149
1150
  keys(item, ["kind", "callId"]);
@@ -1428,7 +1429,7 @@ function parseWorkspaceConfiguration(input, expectedDigest) {
1428
1429
  /** The talent-platform `challengeIdSchema`; an identifier outside it would fail the upload. */
1429
1430
  const challengeIdPattern = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/;
1430
1431
  const markerLimitBytes = 4096;
1431
- const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
1432
+ const isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
1432
1433
  const isAbsent = (error) => error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
1433
1434
  /** One fixed line; never the path, the file content or the native error message. */
1434
1435
  function ignored(code) {
@@ -1481,7 +1482,7 @@ async function readChallengeId(workspacePath, signal) {
1481
1482
  } catch {
1482
1483
  return ignored("CHALLENGE_MARKER_INVALID");
1483
1484
  }
1484
- if (!isRecord(marker)) return ignored("CHALLENGE_MARKER_INVALID");
1485
+ if (!isRecord$1(marker)) return ignored("CHALLENGE_MARKER_INVALID");
1485
1486
  const challengeId = marker["challengeId"];
1486
1487
  return marker["version"] === 1 && typeof challengeId === "string" && challengeIdPattern.test(challengeId) ? challengeId : ignored("CHALLENGE_MARKER_INVALID");
1487
1488
  }
@@ -1490,7 +1491,7 @@ async function readChallengeId(workspacePath, signal) {
1490
1491
  const uuid$3 = /^[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}$/;
1491
1492
  const digest$6 = /^[a-f0-9]{64}$/;
1492
1493
  function parseConfiguredWork(value) {
1493
- const item = record(value);
1494
+ const item = record$1(value);
1494
1495
  keys(item, [
1495
1496
  "id",
1496
1497
  "metadataPath",
@@ -1506,7 +1507,7 @@ function parseConfiguredWork(value) {
1506
1507
  };
1507
1508
  }
1508
1509
  function parseConfiguredSourceWorkspace(value) {
1509
- const item = record(value);
1510
+ const item = record$1(value);
1510
1511
  keys(item, [
1511
1512
  "id",
1512
1513
  "metadataPath",
@@ -1526,7 +1527,7 @@ function parseConfiguredSourceWorkspace(value) {
1526
1527
  };
1527
1528
  }
1528
1529
  function parseConfiguredWorkMetadata(value) {
1529
- const item = record(value);
1530
+ const item = record$1(value);
1530
1531
  keys(item, [
1531
1532
  "version",
1532
1533
  "id",
@@ -1545,7 +1546,7 @@ function parseConfiguredWorkMetadata(value) {
1545
1546
  }
1546
1547
  /** Physical hashes are never synthesized from a logical Work identity. */
1547
1548
  function validateConfiguredSourceMetadata(value, expected) {
1548
- const item = record(value);
1549
+ const item = record$1(value);
1549
1550
  keys(item, [
1550
1551
  "version",
1551
1552
  "title",
@@ -1576,7 +1577,7 @@ function digestString(value) {
1576
1577
  return result;
1577
1578
  }
1578
1579
  function parseConfiguredEntry(value) {
1579
- const item = record(value);
1580
+ const item = record$1(value);
1580
1581
  keys(item, [
1581
1582
  "entryPath",
1582
1583
  "kind",
@@ -1597,7 +1598,7 @@ function parseConfiguredEntry(value) {
1597
1598
  };
1598
1599
  }
1599
1600
  function parseConfiguredPart(value) {
1600
- const item = record(value);
1601
+ const item = record$1(value);
1601
1602
  keys(item, [
1602
1603
  "id",
1603
1604
  "sourceId",
@@ -1609,7 +1610,7 @@ function parseConfiguredPart(value) {
1609
1610
  "retainedRecordCount",
1610
1611
  "equivalence"
1611
1612
  ]);
1612
- const source = record(item["source"]);
1613
+ const source = record$1(item["source"]);
1613
1614
  keys(source, [
1614
1615
  "representation",
1615
1616
  "byteLength",
@@ -1634,7 +1635,7 @@ function parseConfiguredPart(value) {
1634
1635
  };
1635
1636
  }
1636
1637
  function session$1(value) {
1637
- const item = record(value);
1638
+ const item = record$1(value);
1638
1639
  keys(item, [
1639
1640
  "id",
1640
1641
  "workspaceId",
@@ -1657,7 +1658,7 @@ function session$1(value) {
1657
1658
  };
1658
1659
  }
1659
1660
  function exclusion$1(value) {
1660
- const item = record(value);
1661
+ const item = record$1(value);
1661
1662
  keys(item, [
1662
1663
  "sessionId",
1663
1664
  "sourceId",
@@ -1672,7 +1673,7 @@ function exclusion$1(value) {
1672
1673
  };
1673
1674
  }
1674
1675
  function parseConfiguredManifest(text) {
1675
- const item = record(strictJson(text, manifestLimitBytes, manifestNodeLimit));
1676
+ const item = record$1(strictJson(text, manifestLimitBytes, manifestNodeLimit));
1676
1677
  keys(item, [
1677
1678
  "format",
1678
1679
  "formatVersion",
@@ -1699,11 +1700,11 @@ function parseConfiguredManifest(text) {
1699
1700
  ]);
1700
1701
  const challengeId = item["challengeId"] === void 0 ? null : string(item["challengeId"]);
1701
1702
  if (challengeId !== null && !challengeIdPattern.test(challengeId)) fail("ARTIFACT_INVALID_MANIFEST");
1702
- const producer = record(item["producer"]);
1703
+ const producer = record$1(item["producer"]);
1703
1704
  keys(producer, ["name", "version"]);
1704
- const adapters = record(item["adapterVersions"]);
1705
+ const adapters = record$1(item["adapterVersions"]);
1705
1706
  keys(adapters, ["claude", "codex"]);
1706
- const setup = record(item["agentSetup"]);
1707
+ const setup = record$1(item["agentSetup"]);
1707
1708
  keys(setup, ["version", "files"]);
1708
1709
  const configurationDigest = digestString(item["configurationDigest"]);
1709
1710
  return {
@@ -1730,7 +1731,7 @@ function parseConfiguredManifest(text) {
1730
1731
  configurationDigest,
1731
1732
  configuration: parseWorkspaceConfiguration(item["configuration"], configurationDigest),
1732
1733
  sourceScope: array(item["sourceScope"], (value) => {
1733
- const source = record(value);
1734
+ const source = record$1(value);
1734
1735
  keys(source, ["sessionId", "sourceId"]);
1735
1736
  return {
1736
1737
  sessionId: string(source["sessionId"]),
@@ -1742,7 +1743,7 @@ function parseConfiguredManifest(text) {
1742
1743
  agentSetup: {
1743
1744
  version: literal(setup["version"], 1),
1744
1745
  files: array(setup["files"], (value) => {
1745
- const file = record(value);
1746
+ const file = record$1(value);
1746
1747
  keys(file, [
1747
1748
  "id",
1748
1749
  "category",
@@ -1858,7 +1859,7 @@ const digestPattern = /^[a-f0-9]{64}$/;
1858
1859
  const sessionIdPattern = /^s[0-9]{6}$/;
1859
1860
  const sourceIdPattern = /^src[0-9]{6}$/;
1860
1861
  function description(value) {
1861
- const item = record(value);
1862
+ const item = record$1(value);
1862
1863
  const kind = item["kind"];
1863
1864
  const representation = item["representation"];
1864
1865
  if (kind !== "data" && kind !== "facts" && kind !== "metadata" && kind !== "agent-setup" || representation !== "json" && representation !== "jsonl" && representation !== "jsonl.zst") return fail("ARTIFACT_INVALID_MANIFEST");
@@ -1874,16 +1875,16 @@ function description(value) {
1874
1875
  };
1875
1876
  }
1876
1877
  function checkWorkspaceManifest(text, entries, bundleId, expectedPathHash, summary) {
1877
- const manifest = record(strictJson(text, manifestLimitBytes, manifestNodeLimit));
1878
+ const manifest = record$1(strictJson(text, manifestLimitBytes, manifestNodeLimit));
1878
1879
  const treatment = manifest["contentTreatment"];
1879
1880
  const configured = treatment === "configured";
1880
1881
  const configuredManifest = configured ? parseConfiguredManifest(text) : null;
1881
1882
  if (configuredManifest) validateConfiguredManifest(configuredManifest);
1882
- const sourceWorkspaces = configuredManifest?.sourceWorkspaces ?? [record(manifest["workspace"])];
1883
+ const sourceWorkspaces = configuredManifest?.sourceWorkspaces ?? [record$1(manifest["workspace"])];
1883
1884
  const workspaceIds = new Set(sourceWorkspaces.map((workspace) => string(workspace["id"])));
1884
1885
  if (literal(manifest["format"], "sess-pilot-workspace-bundle") !== "sess-pilot-workspace-bundle" || manifest["formatVersion"] !== (configured ? 5 : 3) || string(manifest["bundleId"]) !== bundleId || summary.bundleId !== bundleId || treatment !== "original" && treatment !== "legacy-plan" && treatment !== "configured") fail("ARTIFACT_INVALID_MANIFEST");
1885
1886
  if (!configured) {
1886
- const workspace = record(manifest["workspace"]);
1887
+ const workspace = record$1(manifest["workspace"]);
1887
1888
  keys(workspace, [
1888
1889
  "id",
1889
1890
  "metadataPath",
@@ -1893,7 +1894,7 @@ function checkWorkspaceManifest(text, entries, bundleId, expectedPathHash, summa
1893
1894
  if (workspace["id"] !== "w000001" || pathHash !== null && !digestPattern.test(pathHash) || pathHash !== expectedPathHash || workspace["metadataPath"] !== "workspace/metadata.json") fail("ARTIFACT_INVALID_MANIFEST");
1894
1895
  } else if ((sourceWorkspaces.length === 1 ? sourceWorkspaces[0]?.["pathHash"] : null) !== expectedPathHash) fail("ARTIFACT_INVALID_MANIFEST");
1895
1896
  const counts = parseCounts(manifest["counts"]);
1896
- const sessions = array(manifest["sessions"], record);
1897
+ const sessions = array(manifest["sessions"], record$1);
1897
1898
  if (counts.workspaces !== sourceWorkspaces.length || sessions.length === 0 || sessions.length !== summary.sessions.length || !countsEqual(counts, summary.counts)) fail("ARTIFACT_INVALID_MANIFEST");
1898
1899
  const descriptions = /* @__PURE__ */ new Map();
1899
1900
  for (const item of array(manifest["entries"], description)) {
@@ -1912,10 +1913,10 @@ function checkWorkspaceManifest(text, entries, bundleId, expectedPathHash, summa
1912
1913
  for (const workspace of configuredManifest.sourceWorkspaces) requireEntry(workspace.metadataPath, "metadata", "json");
1913
1914
  } else requireEntry("workspace/metadata.json", "metadata", "json");
1914
1915
  if (configured) {
1915
- const setup = record(manifest["agentSetup"]);
1916
+ const setup = record$1(manifest["agentSetup"]);
1916
1917
  keys(setup, ["version", "files"]);
1917
1918
  if (setup["version"] !== 1) fail("ARTIFACT_INVALID_MANIFEST");
1918
- for (const [index, value] of array(setup["files"], record).entries()) {
1919
+ for (const [index, value] of array(setup["files"], record$1).entries()) {
1919
1920
  keys(value, [
1920
1921
  "id",
1921
1922
  "category",
@@ -1952,7 +1953,7 @@ function checkWorkspaceManifest(text, entries, bundleId, expectedPathHash, summa
1952
1953
  if (rawSession["metadataPath"] !== metadataPath) fail("ARTIFACT_INVALID_MANIFEST");
1953
1954
  requireEntry(metadataPath, "metadata", "json");
1954
1955
  }
1955
- const sessionParts = array(rawSession["parts"], record);
1956
+ const sessionParts = array(rawSession["parts"], record$1);
1956
1957
  if (sessionParts.length === 0 || sessionParts.length !== expected.sources.length) fail("ARTIFACT_INVALID_MANIFEST");
1957
1958
  for (const [partIndex, part] of sessionParts.entries()) {
1958
1959
  const source = expected.sources[partIndex] ?? fail("ARTIFACT_INVALID_MANIFEST");
@@ -1962,7 +1963,7 @@ function checkWorkspaceManifest(text, entries, bundleId, expectedPathHash, summa
1962
1963
  admitted.set(sourceId, id);
1963
1964
  if (configured) {
1964
1965
  if (source.native === null || !isDeepStrictEqual(parseNativeIdentity(part["native"]), source.native)) fail("ARTIFACT_INVALID_MANIFEST");
1965
- const sourceFacts = record(part["source"]);
1966
+ const sourceFacts = record$1(part["source"]);
1966
1967
  sourceBytes += integer(sourceFacts["byteLength"]);
1967
1968
  const data = `sessions/${id}/parts/${partId}.jsonl`;
1968
1969
  const facts = `sessions/${id}/facts/${partId}.jsonl`;
@@ -1977,21 +1978,21 @@ function checkWorkspaceManifest(text, entries, bundleId, expectedPathHash, summa
1977
1978
  const data = `sessions/${id}/parts/${partId}.${representation}`;
1978
1979
  if (part["entryPath"] !== data) fail("ARTIFACT_INVALID_MANIFEST");
1979
1980
  requireEntry(data, "data", representation);
1980
- sourceBytes += part["source"] === void 0 ? integer(part["byteLength"]) : integer(record(part["source"])["byteLength"]);
1981
+ sourceBytes += part["source"] === void 0 ? integer(part["byteLength"]) : integer(record$1(part["source"])["byteLength"]);
1981
1982
  }
1982
1983
  parts++;
1983
1984
  }
1984
1985
  }
1985
1986
  if (parts !== counts.parts || sourceBytes !== counts.sourceBytes || referenced.size !== descriptions.size) fail("ARTIFACT_INVALID_MANIFEST");
1986
1987
  const scope = /* @__PURE__ */ new Map();
1987
- for (const item of array(manifest["sourceScope"], record)) {
1988
+ for (const item of array(manifest["sourceScope"], record$1)) {
1988
1989
  const sourceId = string(item["sourceId"]);
1989
1990
  const sessionId = string(item["sessionId"]);
1990
1991
  if (!sourceIdPattern.test(sourceId) || !sessionIdPattern.test(sessionId) || scope.has(sourceId)) fail("ARTIFACT_INVALID_MANIFEST");
1991
1992
  scope.set(sourceId, sessionId);
1992
1993
  }
1993
1994
  const excluded = /* @__PURE__ */ new Set();
1994
- for (const item of array(manifest["exclusions"], record)) {
1995
+ for (const item of array(manifest["exclusions"], record$1)) {
1995
1996
  const sourceId = string(item["sourceId"]);
1996
1997
  if (scope.get(sourceId) !== item["sessionId"] || excluded.has(sourceId)) fail("ARTIFACT_INVALID_MANIFEST");
1997
1998
  excluded.add(sourceId);
@@ -2065,7 +2066,7 @@ async function checkWrittenWorkspaceBundle(path, identity, expectedManifestText,
2065
2066
  //#endregion
2066
2067
  //#region packages/artifact/src/collection/companion.ts
2067
2068
  function companionManifest(primaryText, primary, entries) {
2068
- const manifest = record(strictJson(primaryText, manifestLimitBytes, manifestNodeLimit));
2069
+ const manifest = record$1(strictJson(primaryText, manifestLimitBytes, manifestNodeLimit));
2069
2070
  if (manifest["formatVersion"] !== 5 || manifest["companionVersion"] !== 3 || manifest["contentTreatment"] !== "configured") return fail("ARTIFACT_INVALID_MANIFEST");
2070
2071
  return JSON.stringify({
2071
2072
  format: "sess-pilot-workspace-companion",
@@ -2080,7 +2081,7 @@ function companionManifest(primaryText, primary, entries) {
2080
2081
  });
2081
2082
  }
2082
2083
  function checkCompanionManifest(text, entries, primaryText, primary) {
2083
- const value = record(strictJson(text, manifestLimitBytes, manifestNodeLimit));
2084
+ const value = record$1(strictJson(text, manifestLimitBytes, manifestNodeLimit));
2084
2085
  keys(value, [
2085
2086
  "format",
2086
2087
  "formatVersion",
@@ -2092,12 +2093,12 @@ function checkCompanionManifest(text, entries, primaryText, primary) {
2092
2093
  literal(value["format"], "sess-pilot-workspace-companion");
2093
2094
  literal(value["formatVersion"], 1);
2094
2095
  literal(value["companionVersion"], 3);
2095
- const descriptions = array(value["entries"], record);
2096
- const expected = record(strictJson(companionManifest(primaryText, primary, descriptions), manifestLimitBytes, manifestNodeLimit));
2096
+ const descriptions = array(value["entries"], record$1);
2097
+ const expected = record$1(strictJson(companionManifest(primaryText, primary, descriptions), manifestLimitBytes, manifestNodeLimit));
2097
2098
  if (!isDeepStrictEqual(value, expected)) fail("ARTIFACT_INVALID_MANIFEST");
2098
2099
  const paths = /* @__PURE__ */ new Set();
2099
- const primaryManifest = record(strictJson(primaryText, manifestLimitBytes, manifestNodeLimit));
2100
- const parts = array(primaryManifest["sessions"], record).flatMap((session) => array(session["parts"], record));
2100
+ const primaryManifest = record$1(strictJson(primaryText, manifestLimitBytes, manifestNodeLimit));
2101
+ const parts = array(primaryManifest["sessions"], record$1).flatMap((session) => array(session["parts"], record$1));
2101
2102
  for (const part of parts) {
2102
2103
  const path = string(part["factsPath"]);
2103
2104
  if (paths.has(path)) fail("ARTIFACT_INVALID_MANIFEST");
@@ -2221,7 +2222,7 @@ const roles = [
2221
2222
  ];
2222
2223
  const parseRole = (value) => roles.find((role) => role === value) ?? fail("ARTIFACT_INVALID_MANIFEST");
2223
2224
  const parseBody = (value) => {
2224
- const item = record(value);
2225
+ const item = record$1(value);
2225
2226
  keys(item, [
2226
2227
  "bodyId",
2227
2228
  "fieldId",
@@ -2271,7 +2272,7 @@ function sampleLocations(bodies, fields, locations) {
2271
2272
  return synthetic;
2272
2273
  }
2273
2274
  const measured$1 = (value, parse) => {
2274
- const item = record(value);
2275
+ const item = record$1(value);
2275
2276
  const state = item["state"];
2276
2277
  keys(item, [
2277
2278
  "state",
@@ -2295,8 +2296,8 @@ const measured$1 = (value, parse) => {
2295
2296
  };
2296
2297
  return fail("ARTIFACT_INVALID_MANIFEST");
2297
2298
  };
2298
- const patch$1 = (value) => {
2299
- const item = record(value);
2299
+ const patch$2 = (value) => {
2300
+ const item = record$1(value);
2300
2301
  keys(item, [
2301
2302
  "grammarVersion",
2302
2303
  "basis",
@@ -2315,7 +2316,7 @@ const patch$1 = (value) => {
2315
2316
  };
2316
2317
  };
2317
2318
  const parseFacts = (value) => {
2318
- const item = record(value);
2319
+ const item = record$1(value);
2319
2320
  const optional = [
2320
2321
  "decodedUtf8Bytes",
2321
2322
  "logicalLines",
@@ -2338,7 +2339,7 @@ const parseFacts = (value) => {
2338
2339
  extractorVersion: literal(item["extractorVersion"], "native-retention-v1"),
2339
2340
  ...Object.hasOwn(item, "decodedUtf8Bytes") ? { decodedUtf8Bytes: measured$1(item["decodedUtf8Bytes"], integer) } : {},
2340
2341
  ...Object.hasOwn(item, "logicalLines") ? { logicalLines: measured$1(item["logicalLines"], integer) } : {},
2341
- ...Object.hasOwn(item, "patchDelta") ? { patchDelta: measured$1(item["patchDelta"], patch$1) } : {}
2342
+ ...Object.hasOwn(item, "patchDelta") ? { patchDelta: measured$1(item["patchDelta"], patch$2) } : {}
2342
2343
  };
2343
2344
  };
2344
2345
  /** IDs address original nodes, never mutable output positions. */
@@ -2643,7 +2644,7 @@ async function verifyConfiguredPart(part, entries, descriptions, signal) {
2643
2644
  //#region packages/artifact/src/read/configured/workspace.ts
2644
2645
  /** Public primary facts are parsed independently; no source file is opened. */
2645
2646
  function workspaceSummary(text) {
2646
- const manifest = record(parseConfiguredManifest(text));
2647
+ const manifest = record$1(parseConfiguredManifest(text));
2647
2648
  if (manifest["contentTreatment"] !== "configured" || manifest["formatVersion"] !== 5 || manifest["companionVersion"] !== 3) return fail("ARTIFACT_INVALID_MANIFEST");
2648
2649
  return {
2649
2650
  format: "sess-pilot-workspace-summary",
@@ -2651,7 +2652,7 @@ function workspaceSummary(text) {
2651
2652
  bundleId: string(manifest["bundleId"]),
2652
2653
  counts: parseCounts(manifest["counts"]),
2653
2654
  sessions: array(manifest["sessions"], (value) => {
2654
- const session = record(value);
2655
+ const session = record$1(value);
2655
2656
  const harness = session["harness"];
2656
2657
  if (harness !== "claude" && harness !== "codex") return fail("ARTIFACT_INVALID_MANIFEST");
2657
2658
  return {
@@ -2681,7 +2682,7 @@ async function readPrimaryMetadata(primaryEntries, primaryText, signal, only) {
2681
2682
  if (description.representation !== "jsonl" && (!only || only.has(description.entryPath))) {
2682
2683
  const text = await readMetadata(entry, signal);
2683
2684
  if (createHash("sha256").update(text).digest("hex") !== description.sha256) fail("ARTIFACT_INVALID_ARCHIVE");
2684
- const metadata = record(strictJson(text, metadataLimitBytes));
2685
+ const metadata = record$1(strictJson(text, metadataLimitBytes));
2685
2686
  if (description.entryPath === manifest.work.metadataPath) {
2686
2687
  if (parseConfiguredWorkMetadata(metadata).id !== manifest.work.id) fail("ARTIFACT_INVALID_MANIFEST");
2687
2688
  }
@@ -2690,7 +2691,7 @@ async function readPrimaryMetadata(primaryEntries, primaryText, signal, only) {
2690
2691
  if (description.entryPath.startsWith("sessions/")) {
2691
2692
  keys(metadata, ["version", "session"]);
2692
2693
  if (metadata["version"] !== 3) fail("ARTIFACT_INVALID_MANIFEST");
2693
- const session = record(metadata["session"]);
2694
+ const session = record$1(metadata["session"]);
2694
2695
  keys(session, [
2695
2696
  "id",
2696
2697
  "harness",
@@ -2715,11 +2716,11 @@ async function readPrimaryMetadata(primaryEntries, primaryText, signal, only) {
2715
2716
  async function readConfiguredWorkspacePair(primaryEntries, primaryText, companionEntries, companionText, primary, signal, only) {
2716
2717
  const { summary } = await readPrimaryMetadata(primaryEntries, primaryText, signal, only);
2717
2718
  checkCompanionManifest(companionText, companionEntries, primaryText, primary);
2718
- const manifest = record(strictJson(primaryText, manifestLimitBytes, manifestNodeLimit));
2719
- const companion = record(strictJson(companionText, manifestLimitBytes, manifestNodeLimit));
2719
+ const manifest = record$1(strictJson(primaryText, manifestLimitBytes, manifestNodeLimit));
2720
+ const companion = record$1(strictJson(companionText, manifestLimitBytes, manifestNodeLimit));
2720
2721
  const descriptions = new Map([...array(manifest["entries"], parseConfiguredEntry), ...array(companion["entries"], parseConfiguredEntry)].map((entry) => [entry.entryPath, entry]));
2721
2722
  const entries = new Map([...primaryEntries, ...[...companionEntries].filter(([path]) => path !== "manifest.json")]);
2722
- for (const session of array(manifest["sessions"], record)) for (const part of array(session["parts"], parseConfiguredPart)) if (!only || only.has(part.dataPath)) await verifyConfiguredPart(part, entries, descriptions, signal);
2723
+ for (const session of array(manifest["sessions"], record$1)) for (const part of array(session["parts"], parseConfiguredPart)) if (!only || only.has(part.dataPath)) await verifyConfiguredPart(part, entries, descriptions, signal);
2723
2724
  return summary;
2724
2725
  }
2725
2726
  //#endregion
@@ -4729,6 +4730,277 @@ function createInspectionProcessor(processing) {
4729
4730
  } };
4730
4731
  }
4731
4732
  //#endregion
4733
+ //#region packages/artifact/src/agent-sources/model.ts
4734
+ function isRecord(value) {
4735
+ return value !== null && typeof value === "object" && !Array.isArray(value);
4736
+ }
4737
+ function record(value) {
4738
+ return isRecord(value) ? value : {};
4739
+ }
4740
+ function publicName(value) {
4741
+ return typeof value === "string" && /^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,199}$/.test(value);
4742
+ }
4743
+ function repository(value) {
4744
+ if (typeof value !== "string") return false;
4745
+ const segments = value.split("/");
4746
+ return segments.length === 2 && segments.every((part) => part.length <= 100 && agentSourcePathSegment(part));
4747
+ }
4748
+ function repoPath(value) {
4749
+ return value.length <= 500 && value.split("/").every(agentSourcePathSegment);
4750
+ }
4751
+ //#endregion
4752
+ //#region packages/artifact/src/agent-sources/mcp.ts
4753
+ /** Only direct npx invocation has npm provenance; never preserve its arguments. */
4754
+ function npmPackage(value) {
4755
+ const entry = record(value);
4756
+ if (entry["command"] !== "npx" || entry["url"] !== void 0 || entry["type"] !== void 0 && entry["type"] !== "stdio") return void 0;
4757
+ const args = entry["args"];
4758
+ if (!Array.isArray(args) || !args.every((arg) => typeof arg === "string")) return void 0;
4759
+ if (args.some((arg) => /registry|userconfig/i.test(arg)) || Object.keys(record(entry["env"])).some((key) => /registry|userconfig/i.test(key))) return void 0;
4760
+ let position = 0;
4761
+ while (args[position] === "-y" || args[position] === "--yes" || args[position] === "--no") position++;
4762
+ const candidate = args[position];
4763
+ if (candidate === void 0) return void 0;
4764
+ const name = /^((?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*)(?:@[a-zA-Z0-9][a-zA-Z0-9._~^*-]*)?$/.exec(candidate)?.[1];
4765
+ return name !== void 0 && name.length <= 214 ? name : void 0;
4766
+ }
4767
+ function mcpCandidates(value, names) {
4768
+ const output = [];
4769
+ for (const [name, entry] of Object.entries(record(value)).slice(0, 500)) {
4770
+ if (!publicName(name) || !names.has(name)) continue;
4771
+ const packageName = npmPackage(entry);
4772
+ if (packageName) output.push({
4773
+ kind: "mcp",
4774
+ name,
4775
+ source: {
4776
+ type: "npm",
4777
+ package: packageName
4778
+ }
4779
+ });
4780
+ }
4781
+ return output;
4782
+ }
4783
+ //#endregion
4784
+ //#region packages/artifact/src/agent-sources/read.ts
4785
+ /** Optional enrichment treats missing, malformed and unreadable config as omissions. */
4786
+ async function readText(path) {
4787
+ try {
4788
+ const file = await open(path, constants.O_RDONLY | constants.O_NONBLOCK);
4789
+ try {
4790
+ const info = await file.stat();
4791
+ if (!info.isFile() || info.size > 1048576) return void 0;
4792
+ const buffer = Buffer.alloc(1048577);
4793
+ const { bytesRead } = await file.read(buffer, 0, buffer.length, 0);
4794
+ return bytesRead <= 1048576 ? buffer.subarray(0, bytesRead).toString("utf8") : void 0;
4795
+ } finally {
4796
+ await file.close();
4797
+ }
4798
+ } catch {
4799
+ return;
4800
+ }
4801
+ }
4802
+ async function readJson(path) {
4803
+ const text = await readText(path);
4804
+ if (text === void 0) return void 0;
4805
+ try {
4806
+ return JSON.parse(text);
4807
+ } catch {
4808
+ return;
4809
+ }
4810
+ }
4811
+ //#endregion
4812
+ //#region packages/artifact/src/agent-sources/plugins.ts
4813
+ async function skillsAt(root) {
4814
+ try {
4815
+ const entries = await readdir(join(root, "skills"), { withFileTypes: true });
4816
+ const result = [];
4817
+ for (const entry of entries.slice(0, 500)) {
4818
+ if (!entry.isDirectory() || !repoPath(entry.name)) continue;
4819
+ const path = `skills/${entry.name}/SKILL.md`;
4820
+ const text = await readText(join(root, path));
4821
+ const frontmatter = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(text ?? "")?.[1];
4822
+ const name = /^name:\s*["']?([a-zA-Z0-9][a-zA-Z0-9_.:-]*)["']?\s*$/m.exec(frontmatter ?? "")?.[1];
4823
+ if (name && publicName(name)) result.push({
4824
+ name,
4825
+ path
4826
+ });
4827
+ }
4828
+ return result;
4829
+ } catch {
4830
+ return [];
4831
+ }
4832
+ }
4833
+ async function pluginCandidates(home, workspacePath, skills, mcps) {
4834
+ const base = join(home, ".claude", "plugins");
4835
+ const installed = record(record(await readJson(join(base, "installed_plugins.json")))["plugins"]);
4836
+ const marketplaces = record(await readJson(join(base, "known_marketplaces.json")));
4837
+ const personalAndProject = new Set((await Promise.all([skillsAt(join(home, ".claude")), skillsAt(join(workspacePath, ".claude"))])).flat().map((skill) => skill.name));
4838
+ const definitions = /* @__PURE__ */ new Map();
4839
+ const bareCandidates = /* @__PURE__ */ new Set();
4840
+ const output = [];
4841
+ for (const [key, entries] of Object.entries(installed).slice(0, 128)) {
4842
+ const [plugin, marketplace, extra] = key.split("@");
4843
+ if (!plugin || !marketplace || extra !== void 0 || !publicName(plugin)) continue;
4844
+ const market = record(marketplaces[marketplace]);
4845
+ const marketSource = record(market["source"]);
4846
+ const location = market["installLocation"];
4847
+ const catalog = typeof location === "string" ? record(await readJson(join(location, ".claude-plugin", "marketplace.json")))["plugins"] : void 0;
4848
+ const catalogEntry = Array.isArray(catalog) ? catalog.find((item) => record(item)["name"] === plugin) : void 0;
4849
+ const descriptor = record(catalogEntry);
4850
+ const source = record(descriptor["source"]);
4851
+ const relativeSource = descriptor["source"];
4852
+ const prefix = typeof relativeSource === "string" && relativeSource.startsWith("./") && repoPath(relativeSource.slice(2)) ? relativeSource.slice(2) : void 0;
4853
+ const repo = source["source"] === "github" ? source["repo"] : catalogEntry !== void 0 && (relativeSource === void 0 || prefix !== void 0) && (marketSource["source"] === void 0 || marketSource["source"] === "github") ? marketSource["repo"] : void 0;
4854
+ if (!Array.isArray(entries)) continue;
4855
+ const rank = (value) => {
4856
+ const entry = record(value);
4857
+ const scope = entry["scope"];
4858
+ if (scope === "local" || scope === "project") {
4859
+ const projectPath = entry["projectPath"];
4860
+ if (typeof projectPath !== "string" || resolve(projectPath) !== resolve(workspacePath)) return -1;
4861
+ return scope === "local" ? 3 : 2;
4862
+ }
4863
+ return scope === void 0 || scope === "user" ? 1 : -1;
4864
+ };
4865
+ const selected = entries.slice(0, 8).filter((entry) => rank(entry) >= 0).sort((left, right) => rank(right) - rank(left)).slice(0, 1);
4866
+ for (const raw of selected) {
4867
+ const entry = record(raw);
4868
+ const root = entry["installPath"];
4869
+ if (typeof root !== "string") continue;
4870
+ const pluginMcp = record(await readJson(join(root, ".mcp.json")));
4871
+ const servers = record(pluginMcp["mcpServers"] ?? pluginMcp);
4872
+ output.push(...mcpCandidates(servers, mcps));
4873
+ for (const [server, configuration] of Object.entries(servers).slice(0, 500)) {
4874
+ const alias = `plugin_${plugin}_${server}`;
4875
+ if (mcps.has(alias)) output.push(...mcpCandidates({ [alias]: configuration }, mcps));
4876
+ }
4877
+ const directSource = record(entry["source"]);
4878
+ const candidateRepo = directSource["source"] === "github" ? directSource["repo"] : entry["source"] === void 0 ? repo : void 0;
4879
+ const installedSkills = await skillsAt(root);
4880
+ for (const skill of installedSkills) {
4881
+ const owners = definitions.get(skill.name) ?? /* @__PURE__ */ new Set();
4882
+ owners.add(key);
4883
+ definitions.set(skill.name, owners);
4884
+ }
4885
+ if (!repository(candidateRepo)) continue;
4886
+ const commit = entry["gitCommitSha"];
4887
+ for (const skill of installedSkills) for (const name of [`${plugin}:${skill.name}`, skill.name]) {
4888
+ if (!skills.has(name)) continue;
4889
+ const path = directSource["source"] === "github" || source["source"] === "github" ? skill.path : prefix ? `${prefix}/${skill.path}` : void 0;
4890
+ const candidate = {
4891
+ kind: "skill",
4892
+ name,
4893
+ source: {
4894
+ type: "github",
4895
+ repo: candidateRepo,
4896
+ ...path === void 0 ? {} : { path },
4897
+ ...typeof commit === "string" && /^[a-fA-F0-9]{40}$/.test(commit) ? { commit } : {}
4898
+ }
4899
+ };
4900
+ output.push(candidate);
4901
+ if (name === skill.name) bareCandidates.add(candidate);
4902
+ }
4903
+ }
4904
+ }
4905
+ return output.filter((item) => !bareCandidates.has(item) || definitions.get(item.name)?.size === 1 && !personalAndProject.has(item.name)).slice(0, 500);
4906
+ }
4907
+ //#endregion
4908
+ //#region packages/artifact/src/agent-sources/index.ts
4909
+ /** Collection-time candidates stay local until anonymous upload-time admission. */
4910
+ async function collectAgentSourceCandidates(options) {
4911
+ const skills = new Set(options.skills.slice(0, 500));
4912
+ const mcps = new Set(options.mcps.slice(0, 500));
4913
+ if (skills.size === 0 && mcps.size === 0) return [];
4914
+ const output = [];
4915
+ if (options.harness !== "codex") {
4916
+ const user = record(await readJson(join(options.userHome, ".claude.json")));
4917
+ const project = record(await readJson(join(options.workspacePath, ".mcp.json")));
4918
+ const local = record(record(user["projects"])[options.workspacePath]);
4919
+ const servers = {
4920
+ ...record(user["mcpServers"]),
4921
+ ...record(project["mcpServers"]),
4922
+ ...record(local["mcpServers"])
4923
+ };
4924
+ const plugins = await pluginCandidates(options.userHome, options.workspacePath, skills, mcps);
4925
+ output.push(...plugins.filter((item) => item.kind !== "mcp" || !(item.name in servers)));
4926
+ output.push(...mcpCandidates(servers, mcps));
4927
+ }
4928
+ const toml = options.harness === "claude" ? void 0 : await readText(join(options.userHome, ".codex", "config.toml"));
4929
+ if (toml !== void 0) try {
4930
+ output.push(...mcpCandidates(record(parse(toml))["mcp_servers"], mcps));
4931
+ } catch {}
4932
+ const customRegistry = (await Promise.all([readText(join(options.workspacePath, ".npmrc")), readText(join(options.userHome, ".npmrc"))])).some((text) => text?.split(/\r?\n/u).some((line) => /^\s*(?:@[^:=\s]+:)?registry\s*=/iu.test(line)));
4933
+ const privateTerms = [basename(options.userHome), ...options.customTerms ?? []].map((term) => term.normalize("NFC").toLowerCase()).filter(Boolean);
4934
+ const admitted = output.filter((item) => !(customRegistry && item.source.type === "npm") && ![item.name, ...item.source.type === "github" ? [item.source.repo, item.source.path ?? ""] : [item.source.package]].some((value) => privateTerms.some((term) => value.normalize("NFC").toLowerCase().includes(term))));
4935
+ return [...new Map(admitted.map((item) => [`${item.kind}:${item.name}`, item])).values()].slice(0, 500);
4936
+ }
4937
+ //#endregion
4938
+ //#region packages/artifact/src/configured/session/agent-sources.ts
4939
+ /** Recognized call positions only: arbitrary prose and tool results never establish usage. */
4940
+ function createAgentSourceCollector(harness) {
4941
+ const skills = /* @__PURE__ */ new Set();
4942
+ const mcps = /* @__PURE__ */ new Set();
4943
+ const add = (set, name) => {
4944
+ if (name && set.size < 500 && /^[A-Za-z0-9_][A-Za-z0-9_.:-]{0,199}$/u.test(name)) set.add(name);
4945
+ };
4946
+ const mcp = (name) => {
4947
+ if (!name?.startsWith("mcp__")) return;
4948
+ const server = name.slice(5).split("__")[0];
4949
+ if (server && /^[A-Za-z0-9_-]+$/u.test(server)) add(mcps, server);
4950
+ };
4951
+ return {
4952
+ add(root) {
4953
+ const type = nativeText(nativeField(root, "type"));
4954
+ if (harness === "claude" && type === "assistant") {
4955
+ const message = nativeField(root, "message");
4956
+ const role = nativeText(nativeField(message, "role"));
4957
+ if (role !== void 0 && role !== "assistant") return;
4958
+ for (const item of nativeItems(nativeField(message, "content"))) {
4959
+ if (nativeText(nativeField(item, "type")) !== "tool_use") continue;
4960
+ const name = nativeText(nativeField(item, "name"));
4961
+ if (name === "Skill") add(skills, nativeText(nativeField(nativeField(item, "input"), "skill")));
4962
+ else mcp(name);
4963
+ }
4964
+ }
4965
+ if (harness === "codex") {
4966
+ const payload = nativeField(root, "payload");
4967
+ const payloadType = nativeText(nativeField(payload, "type"));
4968
+ if (type === "response_item" && payloadType === "function_call") {
4969
+ mcp(nativeText(nativeField(payload, "name")));
4970
+ mcp(nativeText(nativeField(payload, "namespace")));
4971
+ }
4972
+ if (type === "event_msg" && payloadType === "mcp_tool_call_begin") add(mcps, nativeText(nativeField(nativeField(payload, "invocation"), "server")));
4973
+ }
4974
+ },
4975
+ names: () => ({
4976
+ skills: [...skills],
4977
+ mcps: [...mcps]
4978
+ })
4979
+ };
4980
+ }
4981
+ async function collectSessionAgentSources(request, names) {
4982
+ const userHome = request.processing.environment.userHome;
4983
+ if (!userHome || !request.workspace.path || names.skills.length === 0 && names.mcps.length === 0) return [];
4984
+ try {
4985
+ const candidates = await collectAgentSourceCandidates({
4986
+ userHome,
4987
+ harness: request.session.harness,
4988
+ customTerms: request.processing.customTerms?.terms ?? [],
4989
+ workspacePath: request.workspace.path,
4990
+ ...names
4991
+ });
4992
+ const items = [];
4993
+ for (const candidate of candidates) {
4994
+ const parsed = agentSourceSchema.safeParse(candidate);
4995
+ if (parsed.success) items.push(parsed.data);
4996
+ }
4997
+ return items.slice(0, 500);
4998
+ } catch {
4999
+ console.error("AGENT_SOURCES_COLLECTION_UNAVAILABLE");
5000
+ return [];
5001
+ }
5002
+ }
5003
+ //#endregion
4732
5004
  //#region packages/artifact/src/configured/masks/text.ts
4733
5005
  /** Generated title input is local metadata, not an asserted location inside a captured native row. */
4734
5006
  function titleMasks(input, output) {
@@ -4928,8 +5200,12 @@ async function prepareConfiguredSession(request) {
4928
5200
  const metadata = metadataRoot(request, owner.limits);
4929
5201
  const gitIdentity = await prepareGit(request, owner.signal, owner.preparation);
4930
5202
  const agentSetup = request.collectAgentSetup ? createAgentSetupCollector(request) : void 0;
5203
+ const agentSources = request.collectAgentSetup ? createAgentSourceCollector(request.session.harness) : void 0;
4931
5204
  let images = 0;
4932
- const snapshots = await prepareSources(request, owner, metadata, agentSetup?.add, (count) => {
5205
+ const snapshots = await prepareSources(request, owner, metadata, (root) => {
5206
+ agentSetup?.add(root);
5207
+ agentSources?.add(root);
5208
+ }, (count) => {
4933
5209
  images += count;
4934
5210
  });
4935
5211
  owner.seal();
@@ -4996,6 +5272,7 @@ async function prepareConfiguredSession(request) {
4996
5272
  ...processedMetadata.masks === void 0 ? {} : { metadataMasks: processedMetadata.masks },
4997
5273
  sources: Object.freeze(sources),
4998
5274
  agentSetup: Object.freeze(setup),
5275
+ ...agentSources ? { agentSources: await collectSessionAgentSources(request, agentSources.names()) } : {},
4999
5276
  images
5000
5277
  });
5001
5278
  await owner.close();
@@ -5019,10 +5296,10 @@ async function prepareConfiguredSession(request) {
5019
5296
  //#region packages/artifact/src/collection/producer/session-metadata.ts
5020
5297
  /** Validate the session-only shape already projected before configured processing. */
5021
5298
  function sessionMetadata(metadata) {
5022
- const root = record(strictJson(metadata, metadataLimitBytes));
5299
+ const root = record$1(strictJson(metadata, metadataLimitBytes));
5023
5300
  keys(root, ["version", "session"]);
5024
5301
  literal(root["version"], 3);
5025
- const session = record(root["session"]);
5302
+ const session = record$1(root["session"]);
5026
5303
  const compact = JSON.stringify({
5027
5304
  version: 3,
5028
5305
  session
@@ -5629,7 +5906,7 @@ function boundedHash(value) {
5629
5906
  return result;
5630
5907
  }
5631
5908
  function parseIdentityMap(value) {
5632
- const input = record(value);
5909
+ const input = record$1(value);
5633
5910
  keys(input, [
5634
5911
  "format",
5635
5912
  "formatVersion",
@@ -5638,7 +5915,7 @@ function parseIdentityMap(value) {
5638
5915
  ]);
5639
5916
  const bundleId = string(input["bundleId"]);
5640
5917
  validBundleId(bundleId);
5641
- const workspace = record(input["workspace"]);
5918
+ const workspace = record$1(input["workspace"]);
5642
5919
  keys(workspace, [
5643
5920
  "path",
5644
5921
  "pathHash",
@@ -5652,7 +5929,7 @@ function parseIdentityMap(value) {
5652
5929
  if (!Array.isArray(rawRemotes)) return fail("ARTIFACT_INVALID_MANIFEST");
5653
5930
  if (rawRemotes.length > maximumRemotes) fail("ARTIFACT_METADATA_LIMIT");
5654
5931
  const remotes = rawRemotes.map((entry) => {
5655
- const remote = record(entry);
5932
+ const remote = record$1(entry);
5656
5933
  keys(remote, ["url", "hash"]);
5657
5934
  return {
5658
5935
  url: boundedLocator(remote["url"]),
@@ -6359,7 +6636,7 @@ const pointer$3 = (value) => {
6359
6636
  return text;
6360
6637
  };
6361
6638
  const range$2 = (value) => {
6362
- const v = record(value);
6639
+ const v = record$1(value);
6363
6640
  keys(v, ["start", "end"]);
6364
6641
  const start = integer(v["start"]), end = integer(v["end"]);
6365
6642
  if (end <= start) fail("ARTIFACT_INVALID_MANIFEST");
@@ -6385,7 +6662,7 @@ function rowRanges(value, fields) {
6385
6662
  });
6386
6663
  }
6387
6664
  function mask(value) {
6388
- const v = record(value);
6665
+ const v = record$1(value);
6389
6666
  keys(v, [
6390
6667
  "inputRange",
6391
6668
  "outputRange",
@@ -6394,9 +6671,9 @@ function mask(value) {
6394
6671
  "node",
6395
6672
  "ruleId"
6396
6673
  ]);
6397
- const node = record(v["node"]);
6674
+ const node = record$1(v["node"]);
6398
6675
  keys(node, ["id", "version"]);
6399
- const output = record(v["outputRange"]);
6676
+ const output = record$1(v["outputRange"]);
6400
6677
  keys(output, ["start", "end"]);
6401
6678
  const start = integer(output["start"]), end = integer(output["end"]);
6402
6679
  const replacement = string(v["replacement"]);
@@ -6417,7 +6694,7 @@ function mask(value) {
6417
6694
  };
6418
6695
  }
6419
6696
  function field(value) {
6420
- const v = record(value);
6697
+ const v = record$1(value);
6421
6698
  keys(v, [
6422
6699
  "pointer",
6423
6700
  "cleanedPointer",
@@ -6460,7 +6737,7 @@ function field(value) {
6460
6737
  return result;
6461
6738
  }
6462
6739
  function parsePrivateReviewRow(text) {
6463
- const v = record(strictJson(text, 67108864));
6740
+ const v = record$1(strictJson(text, 67108864));
6464
6741
  keys(v, [
6465
6742
  "entryPath",
6466
6743
  "recordIndex",
@@ -6486,7 +6763,7 @@ function parsePrivateReviewRow(text) {
6486
6763
  };
6487
6764
  }
6488
6765
  function parsePrivateReviewManifest(text, entries, primary) {
6489
- const v = record(strictJson(text, manifestLimitBytes, manifestNodeLimit));
6766
+ const v = record$1(strictJson(text, manifestLimitBytes, manifestNodeLimit));
6490
6767
  keys(v, [
6491
6768
  "format",
6492
6769
  "version",
@@ -6496,11 +6773,11 @@ function parsePrivateReviewManifest(text, entries, primary) {
6496
6773
  "entries",
6497
6774
  "rows"
6498
6775
  ]);
6499
- const bound = record(v["primary"]);
6776
+ const bound = record$1(v["primary"]);
6500
6777
  keys(bound, ["sha256", "archiveBytes"]);
6501
6778
  if (v["bundleId"] !== primary.manifest.bundleId || v["workId"] !== primary.manifest.work.id || bound["sha256"] !== primary.sha256 || bound["archiveBytes"] !== primary.archiveBytes) fail("ARTIFACT_PROCESSING_MISMATCH");
6502
6779
  const descriptions = array(v["entries"], (value) => {
6503
- const e = record(value);
6780
+ const e = record$1(value);
6504
6781
  keys(e, [
6505
6782
  "entryPath",
6506
6783
  "kind",
@@ -7727,7 +8004,7 @@ function createMaskContexts() {
7727
8004
  /** Resolves a stored context of the next row read; a reference must name an earlier one. */
7728
8005
  read(row, inputSha256, value) {
7729
8006
  enter(row);
7730
- const data = record(value);
8007
+ const data = record$1(value);
7731
8008
  const start = integer(data["start"]);
7732
8009
  if (!Object.hasOwn(data, "text")) {
7733
8010
  keys(data, ["start", "end"]);
@@ -7755,7 +8032,7 @@ const hash$3 = (value) => {
7755
8032
  return text;
7756
8033
  };
7757
8034
  const range$1 = (value) => {
7758
- const data = record(value);
8035
+ const data = record$1(value);
7759
8036
  keys(data, ["start", "end"]);
7760
8037
  const start = integer(data["start"]);
7761
8038
  const end = integer(data["end"]);
@@ -7772,7 +8049,7 @@ const pointer$2 = (value) => {
7772
8049
  };
7773
8050
  /** Parses one row in ledger order; `contexts` resolves context references (ADR 0084). */
7774
8051
  function parsePrivateMaskRow(text, contexts) {
7775
- const row = record(strictJson(text, 33554432));
8052
+ const row = record$1(strictJson(text, 33554432));
7776
8053
  keys(row, [
7777
8054
  "entryPath",
7778
8055
  "recordIndex",
@@ -7781,7 +8058,7 @@ function parsePrivateMaskRow(text, contexts) {
7781
8058
  "archiveSessionId",
7782
8059
  "mask"
7783
8060
  ]);
7784
- const item = record(row["mask"]);
8061
+ const item = record$1(row["mask"]);
7785
8062
  keys(item, [
7786
8063
  "inputRange",
7787
8064
  "outputRange",
@@ -7798,7 +8075,7 @@ function parsePrivateMaskRow(text, contexts) {
7798
8075
  "outputSha256",
7799
8076
  "context"
7800
8077
  ]);
7801
- const node = record(item["node"]);
8078
+ const node = record$1(item["node"]);
7802
8079
  keys(node, ["id", "version"]);
7803
8080
  const entryPath = string(row["entryPath"]);
7804
8081
  const recordIndex = integer(row["recordIndex"]);
@@ -7843,7 +8120,7 @@ function parsePrivateMaskRow(text, contexts) {
7843
8120
  };
7844
8121
  }
7845
8122
  function parsePrivateMaskManifest(text, entries, primary) {
7846
- const data = record(strictJson(text, manifestLimitBytes, manifestNodeLimit));
8123
+ const data = record$1(strictJson(text, manifestLimitBytes, manifestNodeLimit));
7847
8124
  keys(data, [
7848
8125
  "format",
7849
8126
  "version",
@@ -7854,11 +8131,11 @@ function parsePrivateMaskManifest(text, entries, primary) {
7854
8131
  "entries",
7855
8132
  "rows"
7856
8133
  ]);
7857
- const binding = record(data["primary"]);
8134
+ const binding = record$1(data["primary"]);
7858
8135
  keys(binding, ["sha256", "archiveBytes"]);
7859
8136
  if (data["bundleId"] !== primary.manifest.bundleId || data["workId"] !== primary.manifest.work.id || binding["sha256"] !== primary.sha256 || binding["archiveBytes"] !== primary.archiveBytes) return fail("ARTIFACT_PROCESSING_MISMATCH");
7860
8137
  const descriptions = array(data["entries"], (value) => {
7861
- const entry = record(value);
8138
+ const entry = record$1(value);
7862
8139
  keys(entry, [
7863
8140
  "entryPath",
7864
8141
  "kind",
@@ -7925,7 +8202,7 @@ function maskHash(value) {
7925
8202
  return text;
7926
8203
  }
7927
8204
  function maskRange(value) {
7928
- const data = record(value);
8205
+ const data = record$1(value);
7929
8206
  keys(data, ["start", "end"]);
7930
8207
  const result = {
7931
8208
  start: integer(data["start"]),
@@ -7940,7 +8217,7 @@ function pointer$1(value) {
7940
8217
  return text;
7941
8218
  }
7942
8219
  function semantic(value, scope, contexts) {
7943
- const data = record(value);
8220
+ const data = record$1(value);
7944
8221
  keys(data, [
7945
8222
  "pointer",
7946
8223
  "inputSha256",
@@ -7967,7 +8244,7 @@ function semantic(value, scope, contexts) {
7967
8244
  }
7968
8245
  /** Parses one row in ledger order; `contexts` resolves static context references (ADR 0084). */
7969
8246
  function parseFinalMaskRow(text, contexts) {
7970
- const data = record(strictJson(text, 33554432));
8247
+ const data = record$1(strictJson(text, 33554432));
7971
8248
  keys(data, [
7972
8249
  "entryPath",
7973
8250
  "recordIndex",
@@ -7982,7 +8259,7 @@ function parseFinalMaskRow(text, contexts) {
7982
8259
  const subject = data["subject"];
7983
8260
  if (subject !== "key" && subject !== "value") return fail("ARTIFACT_INVALID_MANIFEST");
7984
8261
  const contributors = array(data["contributors"], (value) => {
7985
- const item = record(value);
8262
+ const item = record$1(value);
7986
8263
  keys(item, [
7987
8264
  "id",
7988
8265
  "kind",
@@ -8031,7 +8308,7 @@ function parseFinalMaskRow(text, contexts) {
8031
8308
  //#endregion
8032
8309
  //#region packages/artifact/src/configured/masks/final/manifest.ts
8033
8310
  function categories(value) {
8034
- const item = record(value);
8311
+ const item = record$1(value);
8035
8312
  keys(item, [
8036
8313
  "identity",
8037
8314
  "credentials",
@@ -8046,7 +8323,7 @@ function categories(value) {
8046
8323
  };
8047
8324
  }
8048
8325
  function maskSummary(value) {
8049
- const data = record(value);
8326
+ const data = record$1(value);
8050
8327
  keys(data, [
8051
8328
  "occurrences",
8052
8329
  "contributors",
@@ -8064,7 +8341,7 @@ function maskSummariesEqual(a, b) {
8064
8341
  return a.occurrences === b.occurrences && a.contributors === b.contributors && a.categories.identity === b.categories.identity && a.categories.credentials === b.categories.credentials && a.categories.internal === b.categories.internal && a.categories.private === b.categories.private;
8065
8342
  }
8066
8343
  function parseFinalMaskManifest(text, entries, primary) {
8067
- const data = record(strictJson(text, manifestLimitBytes, manifestNodeLimit));
8344
+ const data = record$1(strictJson(text, manifestLimitBytes, manifestNodeLimit));
8068
8345
  keys(data, [
8069
8346
  "format",
8070
8347
  "version",
@@ -8078,13 +8355,13 @@ function parseFinalMaskManifest(text, entries, primary) {
8078
8355
  "entries",
8079
8356
  "summary"
8080
8357
  ]);
8081
- const binding = record(data["primary"]);
8358
+ const binding = record$1(data["primary"]);
8082
8359
  keys(binding, ["sha256", "archiveBytes"]);
8083
8360
  if (data["bundleId"] !== primary.manifest.bundleId || data["workId"] !== primary.manifest.work.id || binding["sha256"] !== primary.sha256 || binding["archiveBytes"] !== primary.archiveBytes) fail("ARTIFACT_PROCESSING_MISMATCH");
8084
8361
  const expected = new Set(primary.manifest.entries.map((entry) => `${entry.entryPath}.masks.jsonl`));
8085
8362
  let total = emptyMaskSummary();
8086
8363
  const descriptions = array(data["entries"], (value) => {
8087
- const row = record(value);
8364
+ const row = record$1(value);
8088
8365
  keys(row, [
8089
8366
  "entryPath",
8090
8367
  "kind",
@@ -8950,7 +9227,7 @@ async function rewriteConfiguredOutput(request, handle, signal = new AbortContro
8950
9227
  archiveBytes: primaryResult.archiveBytes
8951
9228
  };
8952
9229
  const finalMaskLedger = await masks?.finish(changed, finalPrimary, { rows: request.shards === void 0 });
8953
- const companionValue = record(strictJson(companion.manifestText, manifestLimitBytes, manifestNodeLimit));
9230
+ const companionValue = record$1(strictJson(companion.manifestText, manifestLimitBytes, manifestNodeLimit));
8954
9231
  const companionEntries = [];
8955
9232
  for (const description of array(companionValue["entries"], parseConfiguredEntry)) {
8956
9233
  const entry = companion.entries.get(description.entryPath) ?? fail("ARTIFACT_INVALID_ARCHIVE");
@@ -10304,7 +10581,7 @@ function validateCollectionIndex(index) {
10304
10581
  const maximumCollectionIndexBytes = 16777216;
10305
10582
  const maximumCollectionNodes = 1e6;
10306
10583
  function source(value) {
10307
- const item = record(value);
10584
+ const item = record$1(value);
10308
10585
  keys(item, [
10309
10586
  "sourceId",
10310
10587
  "sourceOrdinal",
@@ -10317,7 +10594,7 @@ function source(value) {
10317
10594
  };
10318
10595
  }
10319
10596
  function session(value) {
10320
- const item = record(value);
10597
+ const item = record$1(value);
10321
10598
  keys(item, [
10322
10599
  "sessionId",
10323
10600
  "scopeOrdinal",
@@ -10338,7 +10615,7 @@ function session(value) {
10338
10615
  };
10339
10616
  }
10340
10617
  function parseCollectionWorkspaceSummary(value) {
10341
- const item = record(value);
10618
+ const item = record$1(value);
10342
10619
  keys(item, [
10343
10620
  "format",
10344
10621
  "formatVersion",
@@ -10355,7 +10632,7 @@ function parseCollectionWorkspaceSummary(value) {
10355
10632
  };
10356
10633
  }
10357
10634
  function parseCompanionDescriptor(value) {
10358
- const item = record(value);
10635
+ const item = record$1(value);
10359
10636
  keys(item, [
10360
10637
  "path",
10361
10638
  "archiveBytes",
@@ -10368,7 +10645,7 @@ function parseCompanionDescriptor(value) {
10368
10645
  };
10369
10646
  }
10370
10647
  function bundle(value) {
10371
- const item = record(value);
10648
+ const item = record$1(value);
10372
10649
  keys(item, [
10373
10650
  "workspaceSlot",
10374
10651
  "workspaceVersion",
@@ -10403,7 +10680,7 @@ function bundle(value) {
10403
10680
  };
10404
10681
  }
10405
10682
  function sourceScope(value) {
10406
- const item = record(value);
10683
+ const item = record$1(value);
10407
10684
  keys(item, ["applicationSessionId", "sourceId"]);
10408
10685
  return {
10409
10686
  applicationSessionId: string(item["applicationSessionId"]),
@@ -10411,7 +10688,7 @@ function sourceScope(value) {
10411
10688
  };
10412
10689
  }
10413
10690
  function exclusion(value) {
10414
- const item = record(value);
10691
+ const item = record$1(value);
10415
10692
  keys(item, [
10416
10693
  "applicationSessionId",
10417
10694
  "sourceId",
@@ -10426,7 +10703,7 @@ function exclusion(value) {
10426
10703
  };
10427
10704
  }
10428
10705
  function sessionBinding(value) {
10429
- const item = record(value);
10706
+ const item = record$1(value);
10430
10707
  keys(item, [
10431
10708
  "applicationSessionId",
10432
10709
  "bundleId",
@@ -10441,7 +10718,7 @@ function sessionBinding(value) {
10441
10718
  };
10442
10719
  }
10443
10720
  function sourceBinding(value) {
10444
- const item = record(value);
10721
+ const item = record$1(value);
10445
10722
  keys(item, [
10446
10723
  "applicationSessionId",
10447
10724
  "sourceId",
@@ -10467,7 +10744,7 @@ function parseCollectionIndex(text) {
10467
10744
  if (error instanceof Error && error.message === "ARTIFACT_METADATA_LIMIT") fail("ARTIFACT_INDEX_LIMIT", { cause: error });
10468
10745
  throw error;
10469
10746
  }
10470
- const item = record(value);
10747
+ const item = record$1(value);
10471
10748
  keys(item, [
10472
10749
  "format",
10473
10750
  "formatVersion",
@@ -10563,7 +10840,7 @@ function measured(value, copy) {
10563
10840
  reasonCode: value.reasonCode
10564
10841
  };
10565
10842
  }
10566
- function patch(value) {
10843
+ function patch$1(value) {
10567
10844
  return {
10568
10845
  grammarVersion: value.grammarVersion,
10569
10846
  basis: value.basis,
@@ -10582,7 +10859,7 @@ function fact(value) {
10582
10859
  extractorVersion: value.extractorVersion,
10583
10860
  ...value.decodedUtf8Bytes === void 0 ? {} : { decodedUtf8Bytes: measured(value.decodedUtf8Bytes, (number) => number) },
10584
10861
  ...value.logicalLines === void 0 ? {} : { logicalLines: measured(value.logicalLines, (number) => number) },
10585
- ...value.patchDelta === void 0 ? {} : { patchDelta: measured(value.patchDelta, patch) }
10862
+ ...value.patchDelta === void 0 ? {} : { patchDelta: measured(value.patchDelta, patch$1) }
10586
10863
  };
10587
10864
  }
10588
10865
  function relation(value) {
@@ -10710,7 +10987,7 @@ function pointer(value) {
10710
10987
  return result;
10711
10988
  }
10712
10989
  function parseInputField(value) {
10713
- const v = record(value);
10990
+ const v = record$1(value);
10714
10991
  keys(v, [
10715
10992
  "fieldId",
10716
10993
  "sourceFieldId",
@@ -10732,13 +11009,13 @@ function parseInputField(value) {
10732
11009
  if (scalarKind !== void 0 && scalarKind !== "literal" && scalarKind !== "structure" && scalarKind !== "container") return fail("ARTIFACT_INVALID_MANIFEST");
10733
11010
  const text = string(v["text"]), fieldHash = digest(v["fieldHash"]);
10734
11011
  if (!text.length || hash$1(text) !== fieldHash) fail("ARTIFACT_PROCESSING_MISMATCH");
10735
- const c = v["cleanedRange"] === void 0 ? void 0 : record(v["cleanedRange"]);
11012
+ const c = v["cleanedRange"] === void 0 ? void 0 : record$1(v["cleanedRange"]);
10736
11013
  if (c) keys(c, ["start", "end"]);
10737
11014
  const cleanedRange = c ? {
10738
11015
  start: integer(c["start"]),
10739
11016
  end: integer(c["end"])
10740
11017
  } : void 0;
10741
- const r = v["originalRange"] === void 0 ? void 0 : record(v["originalRange"]);
11018
+ const r = v["originalRange"] === void 0 ? void 0 : record$1(v["originalRange"]);
10742
11019
  if (r) keys(r, ["start", "end"]);
10743
11020
  const range = r ? {
10744
11021
  start: integer(r["start"]),
@@ -11108,6 +11385,7 @@ async function runConfiguredSessionJob(job, processing, signal, onSourceProgress
11108
11385
  parts,
11109
11386
  entries,
11110
11387
  agentSetup: completed.agentSetup,
11388
+ ...completed.agentSources === void 0 ? {} : { agentSources: completed.agentSources },
11111
11389
  images: completed.images
11112
11390
  };
11113
11391
  } catch (error) {
@@ -15613,7 +15891,7 @@ function hash(value) {
15613
15891
  return text;
15614
15892
  }
15615
15893
  function range(value) {
15616
- const v = record(value);
15894
+ const v = record$1(value);
15617
15895
  keys(v, ["start", "end"]);
15618
15896
  const start = integer(v["start"]), end = integer(v["end"]);
15619
15897
  if (end <= start) fail("ARTIFACT_PROCESSING_MISMATCH");
@@ -15634,7 +15912,7 @@ function rowIdentity(v, input) {
15634
15912
  };
15635
15913
  }
15636
15914
  function parseSessionScanRow(value, input) {
15637
- const v = record(value);
15915
+ const v = record$1(value);
15638
15916
  keys(v, [
15639
15917
  "sourceId",
15640
15918
  "ordinal",
@@ -15644,7 +15922,7 @@ function parseSessionScanRow(value, input) {
15644
15922
  const { sourceId, ordinal, id, source } = rowIdentity(v, input);
15645
15923
  const ids = /* @__PURE__ */ new Set();
15646
15924
  const fields = array(v["fields"], (item) => {
15647
- const { sessionId, sourceId: fieldSource, ordinal: fieldOrdinal, recordId: fieldRecord, protectedRanges, ...plain } = record(item);
15925
+ const { sessionId, sourceId: fieldSource, ordinal: fieldOrdinal, recordId: fieldRecord, protectedRanges, ...plain } = record$1(item);
15648
15926
  const field = parseInputField(plain);
15649
15927
  if (!source || source.native.role !== "main" || sessionId !== input.sessionId || fieldSource !== sourceId || fieldOrdinal !== ordinal || fieldRecord !== id || field.role === "tool-output" || field.scalarKind !== void 0 || ids.has(field.fieldId) || !field.sourceFieldId.startsWith(`${id}-f`)) fail("ARTIFACT_PROCESSING_MISMATCH");
15650
15928
  const node = field.sourceFieldId.slice(`${id}-f`.length);
@@ -15671,20 +15949,20 @@ function parseSessionScanRow(value, input) {
15671
15949
  };
15672
15950
  }
15673
15951
  function scanFile(value) {
15674
- const file = record(value);
15952
+ const file = record$1(value);
15675
15953
  keys(file, [
15676
15954
  "path",
15677
15955
  "identity",
15678
15956
  "sha256",
15679
15957
  "byteLength"
15680
15958
  ]);
15681
- const identity = record(file["identity"]);
15959
+ const identity = record$1(file["identity"]);
15682
15960
  keys(identity, ["dev", "ino"]);
15683
15961
  if (!string(file["path"]) || !string(identity["dev"]) || !string(identity["ino"]) || integer(file["byteLength"]) > maximumPartBytes) fail("ARTIFACT_PROCESSING_MISMATCH");
15684
15962
  hash(file["sha256"]);
15685
15963
  }
15686
15964
  function validateSessionScanInput(input) {
15687
- keys(record(input), [
15965
+ keys(record$1(input), [
15688
15966
  "version",
15689
15967
  "sessionId",
15690
15968
  "emptyReviewVerified",
@@ -15701,7 +15979,7 @@ function validateSessionScanInput(input) {
15701
15979
  integer(input.fieldCount);
15702
15980
  integer(input.inputUtf16);
15703
15981
  const sources = /* @__PURE__ */ new Set(), parts = /* @__PURE__ */ new Set();
15704
- for (const item of array(input.sources, record)) {
15982
+ for (const item of array(input.sources, record$1)) {
15705
15983
  keys(item, [
15706
15984
  "sourceId",
15707
15985
  "sourcePartId",
@@ -15712,7 +15990,7 @@ function validateSessionScanInput(input) {
15712
15990
  if (!id || !part || sources.has(id) || parts.has(part) || !nativeSourceIdentitySchema.safeParse(item["native"]).success) fail("ARTIFACT_PROCESSING_MISMATCH");
15713
15991
  sources.add(id);
15714
15992
  parts.add(part);
15715
- const facts = record(item["facts"]);
15993
+ const facts = record$1(item["facts"]);
15716
15994
  keys(facts, [
15717
15995
  "representation",
15718
15996
  "byteLength",
@@ -15748,7 +16026,7 @@ async function* scan(handle, input, signal) {
15748
16026
  const ordinals = /* @__PURE__ */ new Map();
15749
16027
  for await (const value of frames(handle, input.file, signal)) {
15750
16028
  if (footer) fail("ARTIFACT_PROCESSING_MISMATCH");
15751
- if (record(value)["kind"] === "session-scan-footer") {
16029
+ if (record$1(value)["kind"] === "session-scan-footer") {
15752
16030
  const { file: _file, ...descriptor } = input;
15753
16031
  if (!isDeepStrictEqual(value, {
15754
16032
  kind: "session-scan-footer",