@agent-teams/docs-protocol 0.1.0-rc.0 → 0.1.0-rc.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.
Files changed (92) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +34 -5
  3. package/assets/catalog.json +1 -0
  4. package/assets/docs-protocol.yml +13 -0
  5. package/assets/transition-catalog.json +1 -0
  6. package/dist/application/authority-handshake.d.ts.map +1 -1
  7. package/dist/application/authority-handshake.js +9 -4
  8. package/dist/application/authority-handshake.js.map +1 -1
  9. package/dist/composition/cli.d.ts.map +1 -1
  10. package/dist/composition/cli.js +9 -1
  11. package/dist/composition/cli.js.map +1 -1
  12. package/dist/consumer-integration/adapters/agents-route-adapter-v1.d.ts +15 -0
  13. package/dist/consumer-integration/adapters/agents-route-adapter-v1.d.ts.map +1 -0
  14. package/dist/consumer-integration/adapters/agents-route-adapter-v1.js +96 -0
  15. package/dist/consumer-integration/adapters/agents-route-adapter-v1.js.map +1 -0
  16. package/dist/consumer-integration/adapters/bounded-repository-topology.d.ts +8 -0
  17. package/dist/consumer-integration/adapters/bounded-repository-topology.d.ts.map +1 -0
  18. package/dist/consumer-integration/adapters/bounded-repository-topology.js +80 -0
  19. package/dist/consumer-integration/adapters/bounded-repository-topology.js.map +1 -0
  20. package/dist/consumer-integration/adapters/consumer-integration-schema-validator.d.ts +3 -0
  21. package/dist/consumer-integration/adapters/consumer-integration-schema-validator.d.ts.map +1 -0
  22. package/dist/consumer-integration/adapters/consumer-integration-schema-validator.js +43 -0
  23. package/dist/consumer-integration/adapters/consumer-integration-schema-validator.js.map +1 -0
  24. package/dist/consumer-integration/adapters/node-consumer-integration-repository.d.ts +14 -0
  25. package/dist/consumer-integration/adapters/node-consumer-integration-repository.d.ts.map +1 -0
  26. package/dist/consumer-integration/adapters/node-consumer-integration-repository.js +404 -0
  27. package/dist/consumer-integration/adapters/node-consumer-integration-repository.js.map +1 -0
  28. package/dist/consumer-integration/adapters/package-consumer-asset-catalog.d.ts +3 -0
  29. package/dist/consumer-integration/adapters/package-consumer-asset-catalog.d.ts.map +1 -0
  30. package/dist/consumer-integration/adapters/package-consumer-asset-catalog.js +152 -0
  31. package/dist/consumer-integration/adapters/package-consumer-asset-catalog.js.map +1 -0
  32. package/dist/consumer-integration/adapters/pnpm-lockfile-policy-v1.d.ts +3 -0
  33. package/dist/consumer-integration/adapters/pnpm-lockfile-policy-v1.d.ts.map +1 -0
  34. package/dist/consumer-integration/adapters/pnpm-lockfile-policy-v1.js +37 -0
  35. package/dist/consumer-integration/adapters/pnpm-lockfile-policy-v1.js.map +1 -0
  36. package/dist/consumer-integration/adapters/pnpm-manifest-adapter-v1.d.ts +16 -0
  37. package/dist/consumer-integration/adapters/pnpm-manifest-adapter-v1.d.ts.map +1 -0
  38. package/dist/consumer-integration/adapters/pnpm-manifest-adapter-v1.js +155 -0
  39. package/dist/consumer-integration/adapters/pnpm-manifest-adapter-v1.js.map +1 -0
  40. package/dist/consumer-integration/adapters/pnpm-runtime-closure-v1.d.ts +8 -0
  41. package/dist/consumer-integration/adapters/pnpm-runtime-closure-v1.d.ts.map +1 -0
  42. package/dist/consumer-integration/adapters/pnpm-runtime-closure-v1.js +160 -0
  43. package/dist/consumer-integration/adapters/pnpm-runtime-closure-v1.js.map +1 -0
  44. package/dist/consumer-integration/application/policies/consumer-integration-assets.d.ts +57 -0
  45. package/dist/consumer-integration/application/policies/consumer-integration-assets.d.ts.map +1 -0
  46. package/dist/consumer-integration/application/policies/consumer-integration-assets.js +151 -0
  47. package/dist/consumer-integration/application/policies/consumer-integration-assets.js.map +1 -0
  48. package/dist/consumer-integration/application/policies/consumer-integration-authority-guards.d.ts +4 -0
  49. package/dist/consumer-integration/application/policies/consumer-integration-authority-guards.d.ts.map +1 -0
  50. package/dist/consumer-integration/application/policies/consumer-integration-authority-guards.js +23 -0
  51. package/dist/consumer-integration/application/policies/consumer-integration-authority-guards.js.map +1 -0
  52. package/dist/consumer-integration/application/policies/consumer-integration-desired-state.d.ts +4 -0
  53. package/dist/consumer-integration/application/policies/consumer-integration-desired-state.d.ts.map +1 -0
  54. package/dist/consumer-integration/application/policies/consumer-integration-desired-state.js +153 -0
  55. package/dist/consumer-integration/application/policies/consumer-integration-desired-state.js.map +1 -0
  56. package/dist/consumer-integration/application/use-cases/plan-consumer-integration.d.ts +18 -0
  57. package/dist/consumer-integration/application/use-cases/plan-consumer-integration.d.ts.map +1 -0
  58. package/dist/consumer-integration/application/use-cases/plan-consumer-integration.js +537 -0
  59. package/dist/consumer-integration/application/use-cases/plan-consumer-integration.js.map +1 -0
  60. package/dist/consumer-integration/composition/consumer-integration-cli.d.ts +3 -0
  61. package/dist/consumer-integration/composition/consumer-integration-cli.d.ts.map +1 -0
  62. package/dist/consumer-integration/composition/consumer-integration-cli.js +223 -0
  63. package/dist/consumer-integration/composition/consumer-integration-cli.js.map +1 -0
  64. package/dist/consumer-integration/composition/node-consumer-integration.d.ts +28 -0
  65. package/dist/consumer-integration/composition/node-consumer-integration.d.ts.map +1 -0
  66. package/dist/consumer-integration/composition/node-consumer-integration.js +138 -0
  67. package/dist/consumer-integration/composition/node-consumer-integration.js.map +1 -0
  68. package/dist/consumer-integration/domain/model.d.ts +105 -0
  69. package/dist/consumer-integration/domain/model.d.ts.map +1 -0
  70. package/dist/consumer-integration/domain/model.js +2 -0
  71. package/dist/consumer-integration/domain/model.js.map +1 -0
  72. package/dist/consumer-integration/generated/canonical-assets.d.ts +3 -0
  73. package/dist/consumer-integration/generated/canonical-assets.d.ts.map +1 -0
  74. package/dist/consumer-integration/generated/canonical-assets.js +4 -0
  75. package/dist/consumer-integration/generated/canonical-assets.js.map +1 -0
  76. package/dist/consumer-integration/index.d.ts +11 -0
  77. package/dist/consumer-integration/index.d.ts.map +1 -0
  78. package/dist/consumer-integration/index.js +7 -0
  79. package/dist/consumer-integration/index.js.map +1 -0
  80. package/dist/index.d.ts +1 -0
  81. package/dist/index.d.ts.map +1 -1
  82. package/dist/index.js +1 -0
  83. package/dist/index.js.map +1 -1
  84. package/dist/qualification/index.js +1 -1
  85. package/dist/qualification/index.js.map +1 -1
  86. package/package.json +13 -3
  87. package/schemas/docs-consumer-integration-execution/v1.schema.json +29 -0
  88. package/schemas/docs-consumer-integration-plan/v1.schema.json +63 -0
  89. package/schemas/docs-consumer-integration-profile/v1.schema.json +110 -0
  90. package/schemas/docs-consumer-managed-state/v1.schema.json +99 -0
  91. package/schemas/qualified-docs-cohort/v1.schema.json +96 -0
  92. package/skills/docs/SKILL.md +28 -0
@@ -0,0 +1,404 @@
1
+ /* oxlint-disable max-lines -- V1 keeps the security-sensitive repository observation boundary cohesive. */
2
+ import { constants } from "node:fs";
3
+ import { lstat, open, realpath } from "node:fs/promises";
4
+ import { dirname, isAbsolute, relative, resolve as resolvePath, sep } from "node:path";
5
+ import { execFile } from "node:child_process";
6
+ import { parseDocument } from "yaml";
7
+ import { parseJsonRecord } from "../../adapters/adoption-input.js";
8
+ import { assertConsumerIntegrationProfileSchema } from "./consumer-integration-schema-validator.js";
9
+ import { targetsManagedPackage, validPnpmPeerContext } from "./pnpm-lockfile-policy-v1.js";
10
+ import { computePnpmRuntimeClosureDigestV1, PnpmRuntimeClosureError } from "./pnpm-runtime-closure-v1.js";
11
+ import { scanConsumerRepositoryTopology } from "./bounded-repository-topology.js";
12
+ const MAXIMUM_PROFILE_BYTES = 256 * 1024;
13
+ const MAXIMUM_MANIFEST_BYTES = 1024 * 1024;
14
+ const MAXIMUM_MANAGED_ASSET_BYTES = 8 * 1024 * 1024;
15
+ const MAXIMUM_LOCKFILE_BYTES = 32 * 1024 * 1024;
16
+ const INTEGRATION_PROFILE_PATH = "architecture/foundation/docs-consumer-integration.json";
17
+ function executeGit(root, args, maximumBytes) {
18
+ return new Promise((resolve, reject) => {
19
+ execFile("git", [...args], {
20
+ cwd: root,
21
+ encoding: "utf8",
22
+ maxBuffer: maximumBytes
23
+ }, (error, stdout) => {
24
+ if (error === null) {
25
+ resolve(stdout);
26
+ }
27
+ else {
28
+ reject(error);
29
+ }
30
+ });
31
+ });
32
+ }
33
+ export class ConsumerIntegrationNodeError extends Error {
34
+ code;
35
+ constructor(code, message, options) {
36
+ super(message, options);
37
+ this.name = "ConsumerIntegrationNodeError";
38
+ this.code = code;
39
+ }
40
+ }
41
+ function errorCode(error) {
42
+ return error instanceof Error && "code" in error
43
+ ? error.code
44
+ : undefined;
45
+ }
46
+ function contained(root, repositoryPath) {
47
+ const absolute = resolvePath(root, repositoryPath);
48
+ const relation = relative(root, absolute);
49
+ if (relation === ".." || relation.startsWith(`..${sep}`) || isAbsolute(relation)) {
50
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_PATH_ESCAPE", `Consumer integration path escapes the repository root: ${repositoryPath}.`);
51
+ }
52
+ return absolute;
53
+ }
54
+ async function canonicalRoot(consumerRoot) {
55
+ const requested = resolvePath(consumerRoot);
56
+ let metadata;
57
+ try {
58
+ metadata = await lstat(requested);
59
+ }
60
+ catch (error) {
61
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_ROOT_INVALID", "Consumer root is unavailable or is not a real directory.", { cause: error });
62
+ }
63
+ if (metadata.isSymbolicLink() || !metadata.isDirectory()) {
64
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_ROOT_INVALID", "Consumer root must be one real directory.");
65
+ }
66
+ return realpath(requested);
67
+ }
68
+ function assertSingleIntegrationTopology(topology) {
69
+ if (topology.lockfiles.length !== 1 || topology.lockfiles[0] !== "pnpm-lock.yaml") {
70
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_NESTED_LOCKFILE_UNSUPPORTED", "V1 requires exactly one root pnpm-lock.yaml and no nested lockfiles.");
71
+ }
72
+ if (topology.integrationProfiles.length !== 1 ||
73
+ topology.integrationProfiles[0] !== INTEGRATION_PROFILE_PATH) {
74
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_MULTIPLE_INTEGRATION_UNITS", `V1 requires exactly one integration profile at ${INTEGRATION_PROFILE_PATH}.`);
75
+ }
76
+ if (topology.pnpmfiles.length > 0) {
77
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_PNPMFILE_UNSUPPORTED", "V1 does not permit .pnpmfile.cjs in the integration repository.");
78
+ }
79
+ }
80
+ async function assertGitRepositoryRoot(root) {
81
+ let gitRoot;
82
+ try {
83
+ gitRoot = await realpath((await executeGit(root, ["rev-parse", "--show-toplevel"], 64 * 1024)).trim());
84
+ }
85
+ catch (error) {
86
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_GIT_ROOT_INVALID", "Consumer root must be the exact top-level directory of one Git repository.", { cause: error });
87
+ }
88
+ if (gitRoot !== root) {
89
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_GIT_ROOT_INVALID", "Consumer root must equal the Git repository top-level directory.");
90
+ }
91
+ }
92
+ function assertNestedAgentsAuthority(topology, governedRoots) {
93
+ const nested = topology.agents.filter((path) => path !== "AGENTS.md");
94
+ const conflicting = governedRoots === undefined
95
+ ? nested
96
+ : nested.filter((path) => {
97
+ const authorityRoot = dirname(path);
98
+ return governedRoots.some((docsRoot) => authorityRoot === docsRoot ||
99
+ authorityRoot.startsWith(`${docsRoot}/`) ||
100
+ docsRoot.startsWith(`${authorityRoot}/`));
101
+ });
102
+ if (conflicting.length > 0) {
103
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_NESTED_AGENTS_UNSUPPORTED", `Nested AGENTS.md overlaps governed documentation authority: ${conflicting.join(", ")}.`);
104
+ }
105
+ }
106
+ async function readStableFile(root, repositoryPath, maximumBytes, required) {
107
+ const path = contained(root, repositoryPath);
108
+ let handle;
109
+ try {
110
+ handle = await open(path, constants.O_RDONLY |
111
+ (process.platform === "win32" ? 0 : constants.O_NOFOLLOW));
112
+ }
113
+ catch (error) {
114
+ if (!required && errorCode(error) === "ENOENT") {
115
+ return { state: "absent" };
116
+ }
117
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_INPUT_MISSING", `Required consumer integration input is unavailable: ${repositoryPath}.`, { cause: error });
118
+ }
119
+ try {
120
+ const before = await handle.stat({ bigint: true });
121
+ if (!before.isFile() || before.nlink > 1n || before.size > BigInt(maximumBytes)) {
122
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_INPUT_INVALID", `Consumer integration input must be one bounded, non-hardlinked regular file: ${repositoryPath}.`);
123
+ }
124
+ const bytes = await handle.readFile();
125
+ const [after, pathState, canonical] = await Promise.all([
126
+ handle.stat({ bigint: true }),
127
+ lstat(path, { bigint: true }),
128
+ realpath(path)
129
+ ]);
130
+ if (pathState.isSymbolicLink() || canonical !== path ||
131
+ before.dev !== after.dev || before.ino !== after.ino ||
132
+ before.birthtimeNs !== after.birthtimeNs || before.ctimeNs !== after.ctimeNs ||
133
+ before.mtimeNs !== after.mtimeNs || before.size !== after.size ||
134
+ pathState.dev !== after.dev || pathState.ino !== after.ino ||
135
+ bytes.byteLength !== Number(after.size)) {
136
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_INPUT_UNSTABLE", `Consumer integration input changed during observation: ${repositoryPath}.`);
137
+ }
138
+ return { state: "file", bytes, mode: Number(after.mode) & 0o777 };
139
+ }
140
+ finally {
141
+ await handle.close();
142
+ }
143
+ }
144
+ function rejectPrototypeKeys(value, path = "integration profile") {
145
+ if (Array.isArray(value)) {
146
+ value.forEach((entry, index) => rejectPrototypeKeys(entry, `${path}[${index}]`));
147
+ return;
148
+ }
149
+ if (typeof value !== "object" || value === null) {
150
+ return;
151
+ }
152
+ for (const [key, entry] of Object.entries(value)) {
153
+ if (["__proto__", "constructor", "prototype"].includes(key)) {
154
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_PROFILE_INVALID", `${path}.${key} is forbidden.`);
155
+ }
156
+ rejectPrototypeKeys(entry, `${path}.${key}`);
157
+ }
158
+ }
159
+ function assertGitHubRuntimeIdentity(desired) {
160
+ const runtimeId = process.env["GITHUB_REPOSITORY_ID"];
161
+ const runtimeName = process.env["GITHUB_REPOSITORY"];
162
+ if (runtimeId !== undefined && runtimeId !== desired.repository.id) {
163
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_REPOSITORY_ID_MISMATCH", "GitHub runtime repository ID does not match the committed integration profile.");
164
+ }
165
+ if (runtimeName !== undefined && runtimeName.toLowerCase() !==
166
+ desired.repository.nameWithOwner.toLowerCase()) {
167
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_REPOSITORY_NAME_MISMATCH", "GitHub runtime repository name does not match the committed integration profile.");
168
+ }
169
+ }
170
+ async function assertQualifiedPnpmRoot(root) {
171
+ const [major, minor] = process.versions.node.split(".").map(Number);
172
+ if (major !== 24 || (minor ?? 0) < 18) {
173
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_UNSUPPORTED_NODE", "V1 check and plan require Node >=24.18.0 <25.");
174
+ }
175
+ const manifestObservation = await readStableFile(root, "package.json", MAXIMUM_MANIFEST_BYTES, true);
176
+ if (manifestObservation.state !== "file") {
177
+ throw new Error("unreachable");
178
+ }
179
+ let manifest;
180
+ try {
181
+ manifest = parseJsonRecord(Buffer.from(manifestObservation.bytes).toString("utf8"));
182
+ }
183
+ catch (error) {
184
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_MANIFEST_INVALID", error instanceof Error ? error.message : "package.json is invalid.", { cause: error });
185
+ }
186
+ const packageManager = manifest["packageManager"];
187
+ const match = typeof packageManager === "string"
188
+ ? /^pnpm@(11)\.([0-9]+)\.([0-9]+)(?:\+sha512\.[A-Za-z0-9+/=]+)?$/u.exec(packageManager)
189
+ : null;
190
+ if (match === null || Number(match[2]) < 17) {
191
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_UNSUPPORTED_PACKAGE_MANAGER", "V1 requires one exact root packageManager declaration within >=11.17.0 <12.");
192
+ }
193
+ const nodeVersion = await readStableFile(root, ".node-version", 128, true);
194
+ if (nodeVersion.state !== "file" ||
195
+ !/^24\.(?:1[89]|[2-9][0-9])\.[0-9]+\n?$/u.test(Buffer.from(nodeVersion.bytes).toString("utf8"))) {
196
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_NODE_VERSION_GATE_INVALID", ".node-version must pin one exact Node version within >=24.18.0 <25.");
197
+ }
198
+ await readStableFile(root, "pnpm-lock.yaml", MAXIMUM_LOCKFILE_BYTES, true);
199
+ for (const path of ["package-lock.json", "yarn.lock", "bun.lock", "bun.lockb"]) {
200
+ if ((await readStableFile(root, path, 1024, false)).state !== "absent") {
201
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_UNSUPPORTED_PACKAGE_MANAGER", `Multiple or unsupported package-manager evidence is present: ${path}.`);
202
+ }
203
+ }
204
+ }
205
+ function sameObservation(left, right) {
206
+ return left.state === right.state && (left.state === "absent" ||
207
+ (right.state === "file" && left.mode === right.mode &&
208
+ Buffer.from(left.bytes).equals(Buffer.from(right.bytes))));
209
+ }
210
+ async function assertSnapshotStillStable(input) {
211
+ const paths = [
212
+ ["integrationProfile", INTEGRATION_PROFILE_PATH, MAXIMUM_PROFILE_BYTES, true],
213
+ ["lockfile", "pnpm-lock.yaml", MAXIMUM_LOCKFILE_BYTES, true],
214
+ ["packageManifest", "package.json", MAXIMUM_MANIFEST_BYTES, true],
215
+ ["agents", "AGENTS.md", MAXIMUM_MANAGED_ASSET_BYTES, false],
216
+ ["skill", input.desired.skillPath, MAXIMUM_MANAGED_ASSET_BYTES, false],
217
+ ["callerWorkflow", input.desired.callerWorkflowPath, MAXIMUM_MANAGED_ASSET_BYTES, false],
218
+ ["managedState", input.desired.managedStatePath, MAXIMUM_MANAGED_ASSET_BYTES, false]
219
+ ];
220
+ const reread = await Promise.all(paths.map(([, path, maximum, required]) => readStableFile(input.root, path, maximum, required)));
221
+ const unstable = paths.find(([key], index) => !sameObservation(input.snapshot[key], reread[index]));
222
+ if (unstable !== undefined) {
223
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_SNAPSHOT_UNSTABLE", `Consumer integration input changed while the repository snapshot was assembled: ${unstable[1]}.`);
224
+ }
225
+ }
226
+ function yamlRecord(value, subject) {
227
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
228
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_LOCKFILE_INVALID", `${subject} must be one mapping.`);
229
+ }
230
+ return value;
231
+ }
232
+ function assertRegistryPackageEntry(options) {
233
+ const resolution = yamlRecord(options.packageEntry["resolution"], `pnpm-lock.yaml#packages.${options.packageName}.resolution`);
234
+ if (resolution["integrity"] !== options.integrity) {
235
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_LOCKFILE_INTEGRITY_MISMATCH", `${options.packageName} registry integrity does not match the selected cohort.`);
236
+ }
237
+ const tarball = resolution["tarball"];
238
+ if (typeof tarball === "string" && !tarball.startsWith("https://registry.npmjs.org/")) {
239
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_LOCKFILE_SOURCE_INVALID", `${options.packageName} must resolve from registry.npmjs.org.`);
240
+ }
241
+ }
242
+ function assertRootOwnsCohortPins(importers, packageNames) {
243
+ for (const [importerPath, importerValue] of Object.entries(importers)) {
244
+ if (importerPath === ".") {
245
+ continue;
246
+ }
247
+ const nestedImporter = yamlRecord(importerValue, `pnpm-lock.yaml#importers.${importerPath}`);
248
+ for (const field of ["dependencies", "devDependencies", "optionalDependencies"]) {
249
+ const declarations = nestedImporter[field];
250
+ if (declarations === undefined) {
251
+ continue;
252
+ }
253
+ const record = yamlRecord(declarations, `pnpm-lock.yaml#importers.${importerPath}.${field}`);
254
+ if (packageNames.some((packageName) => record[packageName] !== undefined)) {
255
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_NESTED_IMPORTER_PIN_FORBIDDEN", `Only the root importer may own Docs Protocol cohort pins; found one in ${importerPath}.`);
256
+ }
257
+ }
258
+ }
259
+ }
260
+ function assertRuntimeClosure(lockfile, desired) {
261
+ try {
262
+ const closureDigest = computePnpmRuntimeClosureDigestV1(lockfile, desired.cohort);
263
+ if (closureDigest !== desired.cohort.runtime.runtimeClosureDigest) {
264
+ throw new PnpmRuntimeClosureError("pnpm-lock.yaml transitive runtime closure does not match the qualified Cohort digest.");
265
+ }
266
+ }
267
+ catch (error) {
268
+ if (error instanceof PnpmRuntimeClosureError) {
269
+ throw new ConsumerIntegrationNodeError(error.code, error.message, { cause: error });
270
+ }
271
+ throw error;
272
+ }
273
+ }
274
+ async function assertQualifiedLockfile(root, desired) {
275
+ const observation = await readStableFile(root, "pnpm-lock.yaml", MAXIMUM_LOCKFILE_BYTES, true);
276
+ if (observation.state !== "file") {
277
+ throw new Error("unreachable");
278
+ }
279
+ const document = parseDocument(Buffer.from(observation.bytes).toString("utf8"), { uniqueKeys: true });
280
+ if (document.errors.length > 0) {
281
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_LOCKFILE_INVALID", "pnpm-lock.yaml must be duplicate-free YAML.");
282
+ }
283
+ const lockfile = yamlRecord(document.toJS({ maxAliasCount: 0 }), "pnpm-lock.yaml");
284
+ if (String(lockfile["lockfileVersion"]) !== "9.0") {
285
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_LOCKFILE_INVALID", "V1 requires pnpm lockfileVersion 9.0.");
286
+ }
287
+ if (targetsManagedPackage(lockfile["overrides"]) ||
288
+ targetsManagedPackage(lockfile["patchedDependencies"])) {
289
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_LOCKFILE_OVERRIDE", "Docs Protocol cohort packages must not use lockfile overrides or patches.");
290
+ }
291
+ const importers = yamlRecord(lockfile["importers"], "pnpm-lock.yaml#importers");
292
+ if (importers["."] === undefined) {
293
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_UNSUPPORTED_WORKSPACE", "V1 requires one root pnpm importer in the repository lockfile.");
294
+ }
295
+ const importer = yamlRecord(importers["."], "pnpm-lock.yaml#importers.");
296
+ const devDependencies = yamlRecord(importer["devDependencies"], "pnpm-lock.yaml#importers...devDependencies");
297
+ for (const field of ["dependencies", "optionalDependencies", "peerDependencies"]) {
298
+ const declarations = importer[field];
299
+ if (declarations === undefined) {
300
+ continue;
301
+ }
302
+ const record = yamlRecord(declarations, `pnpm-lock.yaml#importers...${field}`);
303
+ if (["@agent-teams/docs-protocol", "@agent-teams/engineering-foundation"]
304
+ .some((packageName) => record[packageName] !== undefined)) {
305
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_NON_DEV_DEPENDENCY", "Docs Protocol cohort packages may be declared only in root devDependencies.");
306
+ }
307
+ }
308
+ const packages = yamlRecord(lockfile["packages"], "pnpm-lock.yaml#packages");
309
+ const snapshots = yamlRecord(lockfile["snapshots"], "pnpm-lock.yaml#snapshots");
310
+ const targets = [
311
+ ["@agent-teams/docs-protocol", desired.cohort.packages.docsProtocol],
312
+ ["@agent-teams/engineering-foundation", desired.cohort.packages.engineeringFoundation]
313
+ ];
314
+ assertRootOwnsCohortPins(importers, targets.map(([packageName]) => packageName));
315
+ for (const [packageName, target] of targets) {
316
+ const importerEntry = yamlRecord(devDependencies[packageName], `pnpm-lock.yaml#importers...${packageName}`);
317
+ const selectedVersion = importerEntry["version"];
318
+ if (importerEntry["specifier"] !== target.version ||
319
+ !validPnpmPeerContext(selectedVersion, target.version)) {
320
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_LOCKFILE_COHORT_MISMATCH", `${packageName} importer evidence must select exact cohort version ${target.version}.`);
321
+ }
322
+ const packageEntry = yamlRecord(packages[`${packageName}@${target.version}`], `pnpm-lock.yaml#packages.${packageName}`);
323
+ assertRegistryPackageEntry({
324
+ integrity: target.integrity,
325
+ packageEntry,
326
+ packageName
327
+ });
328
+ const snapshotKey = `${packageName}@${selectedVersion}`;
329
+ if (snapshots[snapshotKey] === undefined) {
330
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_LOCKFILE_SNAPSHOT_MISSING", `${packageName} must have the exact selected pnpm snapshot.`);
331
+ }
332
+ }
333
+ for (const [packageName, target] of targets) {
334
+ const prefix = `${packageName}@`;
335
+ const keys = Object.keys(packages).filter((key) => key.startsWith(prefix));
336
+ if (keys.length !== 1 || keys[0] !== `${prefix}${target.version}`) {
337
+ throw new ConsumerIntegrationNodeError(packageName.endsWith("engineering-foundation")
338
+ ? "DOCS_CONSUMER_DUPLICATE_FOUNDATION_RESOLUTION"
339
+ : "DOCS_CONSUMER_DUPLICATE_DOCS_PROTOCOL_RESOLUTION", `pnpm-lock.yaml must contain exactly one physical cohort ${packageName} resolution.`);
340
+ }
341
+ }
342
+ const docsSelection = yamlRecord(devDependencies["@agent-teams/docs-protocol"], "pnpm-lock.yaml#importers...docs-protocol")["version"];
343
+ const docsSnapshot = yamlRecord(snapshots[`@agent-teams/docs-protocol@${String(docsSelection)}`], "pnpm-lock.yaml#snapshots.docs-protocol");
344
+ const docsDependencies = yamlRecord(docsSnapshot["dependencies"], "pnpm-lock.yaml#snapshots.docs-protocol.dependencies");
345
+ if (!validPnpmPeerContext(docsDependencies["@agent-teams/engineering-foundation"], desired.cohort.packages.engineeringFoundation.version)) {
346
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_COHORT_DEPENDENCY_MISMATCH", "The selected Docs Protocol snapshot must depend on the exact cohort Foundation version.");
347
+ }
348
+ assertRuntimeClosure(lockfile, desired);
349
+ return observation;
350
+ }
351
+ export async function readConsumerIntegrationInput(options) {
352
+ const root = await canonicalRoot(options.consumerRoot);
353
+ await assertGitRepositoryRoot(root);
354
+ const topology = await scanConsumerRepositoryTopology(root);
355
+ assertSingleIntegrationTopology(topology);
356
+ await assertQualifiedPnpmRoot(root);
357
+ const profilePath = options.integrationProfilePath ?? INTEGRATION_PROFILE_PATH;
358
+ if (profilePath !== INTEGRATION_PROFILE_PATH) {
359
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_PROFILE_PATH_UNSUPPORTED", `V1 requires the integration profile at ${INTEGRATION_PROFILE_PATH}.`);
360
+ }
361
+ const profile = await readStableFile(root, profilePath, MAXIMUM_PROFILE_BYTES, true);
362
+ if (profile.state !== "file") {
363
+ throw new Error("unreachable");
364
+ }
365
+ let desired;
366
+ let lockfile;
367
+ try {
368
+ desired = parseJsonRecord(Buffer.from(profile.bytes).toString("utf8"));
369
+ rejectPrototypeKeys(desired);
370
+ await assertConsumerIntegrationProfileSchema(desired);
371
+ assertNestedAgentsAuthority(topology, desired.governedDocsRoots);
372
+ assertGitHubRuntimeIdentity(desired);
373
+ lockfile = await assertQualifiedLockfile(root, desired);
374
+ }
375
+ catch (error) {
376
+ if (error instanceof ConsumerIntegrationNodeError) {
377
+ throw error;
378
+ }
379
+ throw new ConsumerIntegrationNodeError("DOCS_CONSUMER_PROFILE_INVALID", error instanceof Error ? error.message : "Integration profile is invalid.", { cause: error });
380
+ }
381
+ const [packageManifest, agents, skill, callerWorkflow, managedState] = await Promise.all([
382
+ readStableFile(root, "package.json", MAXIMUM_MANIFEST_BYTES, true),
383
+ readStableFile(root, "AGENTS.md", MAXIMUM_MANAGED_ASSET_BYTES, false),
384
+ readStableFile(root, desired.skillPath, MAXIMUM_MANAGED_ASSET_BYTES, false),
385
+ readStableFile(root, desired.callerWorkflowPath, MAXIMUM_MANAGED_ASSET_BYTES, false),
386
+ readStableFile(root, desired.managedStatePath, MAXIMUM_MANAGED_ASSET_BYTES, false)
387
+ ]);
388
+ const snapshot = {
389
+ integrationProfile: profile,
390
+ lockfile,
391
+ packageManifest,
392
+ agents,
393
+ skill,
394
+ callerWorkflow,
395
+ managedState
396
+ };
397
+ await assertSnapshotStillStable({ root, desired, snapshot });
398
+ return {
399
+ desired,
400
+ root,
401
+ snapshot
402
+ };
403
+ }
404
+ //# sourceMappingURL=node-consumer-integration-repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-consumer-integration-repository.js","sourceRoot":"","sources":["../../../src/consumer-integration/adapters/node-consumer-integration-repository.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAA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,QAAQ,GAAG;QACf,kBAAkB,EAAE,OAAO;QAC3B,QAAQ;QACR,eAAe;QACf,MAAM;QACN,KAAK;QACL,cAAc;QACd,YAAY;KACb,CAAC;IACF,MAAM,yBAAyB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC7D,OAAO;QACL,OAAO;QACP,IAAI;QACJ,QAAQ;KACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type ConsumerAssetCatalogV1 } from "../application/policies/consumer-integration-assets.js";
2
+ export declare function loadPackageConsumerAssetCatalog(): Promise<ConsumerAssetCatalogV1>;
3
+ //# sourceMappingURL=package-consumer-asset-catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-consumer-asset-catalog.d.ts","sourceRoot":"","sources":["../../../src/consumer-integration/adapters/package-consumer-asset-catalog.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,sBAAsB,EAG5B,MAAM,wDAAwD,CAAC;AA8HhE,wBAAsB,+BAA+B,IAAI,OAAO,CAAC,sBAAsB,CAAC,CA8CvF"}
@@ -0,0 +1,152 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { digestBytes } from "../application/policies/consumer-integration-assets.js";
3
+ import { assertQualifiedDocsCohortBindingV1 } from "../application/policies/consumer-integration-desired-state.js";
4
+ const DIGEST = /^sha256:[0-9a-f]{64}$/u;
5
+ const COHORT_ID = /^[a-z0-9]+(?:[._-][a-z0-9]+)*$/u;
6
+ const INTEGRITY = /^sha512-[A-Za-z0-9+/]{86}==$/u;
7
+ const SEMVER = /^[0-9]+\.[0-9]+\.[0-9]+(?:-[0-9A-Za-z.-]+)?$/u;
8
+ const BUNDLE_PATH = /^assets\/history\/sha256-[0-9a-f]{64}\/(?:caller\.yml|skill\.md)$/u;
9
+ const MAXIMUM_CATALOG_BYTES = 2 * 1024 * 1024;
10
+ const MAXIMUM_BUNDLE_BYTES = 1024 * 1024;
11
+ function record(value, subject) {
12
+ if (typeof value !== "object" || value === null || Array.isArray(value) ||
13
+ Object.getPrototypeOf(value) !== Object.prototype) {
14
+ throw new TypeError(`${subject} must be one plain object.`);
15
+ }
16
+ return value;
17
+ }
18
+ function digest(value, subject) {
19
+ if (typeof value !== "string" || !DIGEST.test(value)) {
20
+ throw new TypeError(`${subject} must be one sha256 digest.`);
21
+ }
22
+ return value;
23
+ }
24
+ function hasExactKeys(value, keys) {
25
+ return Object.keys(value).toSorted().join("\u0000") === [...keys].toSorted().join("\u0000");
26
+ }
27
+ function packagePair(value) {
28
+ const packages = record(value, "currentSourceExecutor.packages");
29
+ const docsProtocol = record(packages["docsProtocol"], "currentSourceExecutor.packages.docsProtocol");
30
+ const engineeringFoundation = record(packages["engineeringFoundation"], "currentSourceExecutor.packages.engineeringFoundation");
31
+ if (!hasExactKeys(packages, ["docsProtocol", "engineeringFoundation"]) ||
32
+ !hasExactKeys(docsProtocol, ["version", "integrity"]) ||
33
+ !hasExactKeys(engineeringFoundation, ["version", "integrity"]) ||
34
+ !SEMVER.test(String(docsProtocol["version"])) ||
35
+ !SEMVER.test(String(engineeringFoundation["version"])) ||
36
+ !INTEGRITY.test(String(docsProtocol["integrity"])) ||
37
+ !INTEGRITY.test(String(engineeringFoundation["integrity"]))) {
38
+ throw new TypeError("Current source executor package pair is invalid.");
39
+ }
40
+ return packages;
41
+ }
42
+ function schemas(value) {
43
+ const candidate = record(value, "currentSourceExecutor.schemas");
44
+ if (!hasExactKeys(candidate, ["consumerIntegration", "managedState", "docsProtocol"]) ||
45
+ Object.values(candidate).some((entry) => entry !== 1)) {
46
+ throw new TypeError("Current source executor schemas are invalid.");
47
+ }
48
+ return candidate;
49
+ }
50
+ function runtime(value) {
51
+ const candidate = record(value, "currentSourceExecutor.runtime");
52
+ if (!hasExactKeys(candidate, ["node", "pnpm", "runtimeClosureDigest"]) ||
53
+ candidate["node"] !== ">=24.18.0 <25" || candidate["pnpm"] !== ">=11.17.0 <12") {
54
+ throw new TypeError("Current source executor runtime is invalid.");
55
+ }
56
+ digest(candidate["runtimeClosureDigest"], "currentSourceExecutor.runtime.runtimeClosureDigest");
57
+ return candidate;
58
+ }
59
+ function cohortIds(value) {
60
+ if (!Array.isArray(value) || value.length === 0 || value.length > 32 ||
61
+ value.some((entry) => typeof entry !== "string" || !COHORT_ID.test(entry)) ||
62
+ new Set(value).size !== value.length) {
63
+ throw new TypeError("Current source executor target Cohort IDs are invalid.");
64
+ }
65
+ return value;
66
+ }
67
+ async function bundleBytes(path, expected) {
68
+ if (typeof path !== "string" || !BUNDLE_PATH.test(path)) {
69
+ throw new TypeError("Direct-target bundle paths must be content-addressed package assets.");
70
+ }
71
+ const bytes = await readFile(new URL(`../../../${path}`, import.meta.url));
72
+ if (bytes.byteLength > MAXIMUM_BUNDLE_BYTES || digestBytes(bytes) !== digest(expected, path)) {
73
+ throw new TypeError(`Direct-target bundle digest mismatch: ${path}.`);
74
+ }
75
+ return bytes;
76
+ }
77
+ function currentSource(value) {
78
+ const source = record(value, "currentSourceExecutor");
79
+ if (!hasExactKeys(source, [
80
+ "packages", "schemas", "runtime", "assetCatalogDigest", "skillDigest", "callerWorkflowDigest",
81
+ "agentsRouteDigest", "docsScriptsDigest", "directTargetCohortIds"
82
+ ])) {
83
+ throw new TypeError("Current source executor fields are invalid.");
84
+ }
85
+ return Object.freeze({
86
+ packages: packagePair(source["packages"]),
87
+ schemas: schemas(source["schemas"]),
88
+ runtime: runtime(source["runtime"]),
89
+ assetCatalogDigest: digest(source["assetCatalogDigest"], "currentSourceExecutor.assetCatalogDigest"),
90
+ skillDigest: digest(source["skillDigest"], "currentSourceExecutor.skillDigest"),
91
+ callerWorkflowDigest: digest(source["callerWorkflowDigest"], "currentSourceExecutor.callerWorkflowDigest"),
92
+ agentsRouteDigest: digest(source["agentsRouteDigest"], "currentSourceExecutor.agentsRouteDigest"),
93
+ docsScriptsDigest: digest(source["docsScriptsDigest"], "currentSourceExecutor.docsScriptsDigest"),
94
+ directTargetCohortIds: cohortIds(source["directTargetCohortIds"])
95
+ });
96
+ }
97
+ async function directTarget(value) {
98
+ const target = record(value, "directTargetBundle");
99
+ const cohort = record(target["cohort"], "directTargetBundle.cohort");
100
+ assertQualifiedDocsCohortBindingV1(cohort);
101
+ const [skill, callerWorkflow] = await Promise.all([
102
+ bundleBytes(target["skillPath"], target["skillDigest"]),
103
+ bundleBytes(target["callerWorkflowPath"], target["callerWorkflowDigest"])
104
+ ]);
105
+ return Object.freeze({
106
+ cohort,
107
+ skill,
108
+ callerWorkflow,
109
+ agentsRouteDigest: digest(target["agentsRouteDigest"], "directTargetBundle.agentsRouteDigest"),
110
+ docsScriptsDigest: digest(target["docsScriptsDigest"], "directTargetBundle.docsScriptsDigest")
111
+ });
112
+ }
113
+ export async function loadPackageConsumerAssetCatalog() {
114
+ const [bytes, transitionBytes, docsManifestBytes, foundationManifestBytes] = await Promise.all([
115
+ readFile(new URL("../../../assets/catalog.json", import.meta.url)),
116
+ readFile(new URL("../../../assets/transition-catalog.json", import.meta.url)),
117
+ readFile(new URL("../../../package.json", import.meta.url)),
118
+ readFile(new URL(import.meta.resolve("@agent-teams/engineering-foundation/package.json")))
119
+ ]);
120
+ if (bytes.byteLength > MAXIMUM_CATALOG_BYTES) {
121
+ throw new TypeError("Consumer asset catalog is too large.");
122
+ }
123
+ if (transitionBytes.byteLength > MAXIMUM_CATALOG_BYTES) {
124
+ throw new TypeError("Consumer transition catalog is too large.");
125
+ }
126
+ const source = record(JSON.parse(transitionBytes.toString("utf8")), "consumer transition catalog");
127
+ if (!hasExactKeys(source, ["schemaVersion", "currentSourceExecutors", "directTargetBundles"]) ||
128
+ source["schemaVersion"] !== 1) {
129
+ throw new TypeError("Consumer transition catalog fields are invalid.");
130
+ }
131
+ const sources = source["currentSourceExecutors"];
132
+ const targets = source["directTargetBundles"];
133
+ if (!Array.isArray(sources) || sources.length > 32 || !Array.isArray(targets) || targets.length > 32) {
134
+ throw new TypeError("Consumer asset catalog executor and target lists must be bounded arrays.");
135
+ }
136
+ const docsVersion = record(JSON.parse(docsManifestBytes.toString("utf8")), "Docs package")["version"];
137
+ const foundationVersion = record(JSON.parse(foundationManifestBytes.toString("utf8")), "Foundation package")["version"];
138
+ const currentSourceExecutors = sources.map(currentSource).filter(({ packages }) => packages.docsProtocol.version === docsVersion &&
139
+ packages.engineeringFoundation.version === foundationVersion);
140
+ const directTargetBundles = await Promise.all(targets.map(directTarget));
141
+ const directTargetIds = new Set(directTargetBundles.map(({ cohort }) => cohort.cohortId));
142
+ if (directTargetIds.size !== directTargetBundles.length || currentSourceExecutors.some(({ directTargetCohortIds }) => directTargetCohortIds.some((id) => !directTargetIds.has(id)))) {
143
+ throw new TypeError("Consumer transition catalog target Cohort identities must be unique.");
144
+ }
145
+ return Object.freeze({
146
+ catalogDigest: digestBytes(bytes),
147
+ transitionCatalogDigest: digestBytes(transitionBytes),
148
+ currentSourceExecutors: Object.freeze(currentSourceExecutors),
149
+ directTargetBundles: Object.freeze(directTargetBundles)
150
+ });
151
+ }
152
+ //# sourceMappingURL=package-consumer-asset-catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-consumer-asset-catalog.js","sourceRoot":"","sources":["../../../src/consumer-integration/adapters/package-consumer-asset-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EACL,WAAW,EAIZ,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,kCAAkC,EAAE,MAAM,+DAA+D,CAAC;AAEnH,MAAM,MAAM,GAAG,wBAAwB,CAAC;AACxC,MAAM,SAAS,GAAG,iCAAiC,CAAC;AACpD,MAAM,SAAS,GAAG,+BAA+B,CAAC;AAClD,MAAM,MAAM,GAAG,+CAA+C,CAAC;AAC/D,MAAM,WAAW,GAAG,oEAAoE,CAAC;AACzF,MAAM,qBAAqB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAC9C,MAAM,oBAAoB,GAAG,I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,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAChF,QAAQ,CAAC,YAAY,CAAC,OAAO,KAAK,WAAW;QAC7C,QAAQ,CAAC,qBAAqB,CAAC,OAAO,KAAK,iBAAiB,CAC7D,CAAC;IACF,MAAM,mBAAmB,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;IACzE,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC1F,IAAI,eAAe,CAAC,IAAI,KAAK,mBAAmB,CAAC,MAAM,IAAI,sBAAsB,CAAC,IAAI,CACpF,CAAC,EAAE,qBAAqB,EAAE,EAAE,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAC5F,EAAE,CAAC;QACF,MAAM,IAAI,SAAS,CAAC,sEAAsE,CAAC,CAAC;IAC9F,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,aAAa,EAAE,WAAW,CAAC,KAAK,CAAC;QACjC,uBAAuB,EAAE,WAAW,CAAC,eAAe,CAAC;QACrD,sBAAsB,EAAE,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC;QAC7D,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC;KACxD,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function validPnpmPeerContext(value: unknown, exactVersion: string): value is string;
2
+ export declare function targetsManagedPackage(value: unknown): boolean;
3
+ //# sourceMappingURL=pnpm-lockfile-policy-v1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pnpm-lockfile-policy-v1.d.ts","sourceRoot":"","sources":["../../../src/consumer-integration/adapters/pnpm-lockfile-policy-v1.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,KAAK,IAAI,MAAM,CAgB1F;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAM7D"}