@yanib/reverb-adapter-sdk 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 YanibHQ
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # @yanib/reverb-adapter-sdk
2
+
3
+ Contract-adapter interfaces, validation, and admission helpers for Reverb.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add --save-exact @yanib/reverb-adapter-sdk@0.1.0
9
+ ```
10
+
11
+ Import only the documented package root. See the
12
+ [public package API](https://github.com/YanibHQ/reverb-impact/blob/main/docs/api/public-packages.md)
13
+ and [compatibility policy](https://github.com/YanibHQ/reverb-impact/blob/main/docs/compatibility/versioning.md)
14
+ before embedding Reverb in a host.
15
+
16
+ Reverb 0.x is a pre-1.0 release line. Pin an exact version and review release metadata before
17
+ upgrading.
18
+
19
+ ## License
20
+
21
+ Apache-2.0
@@ -0,0 +1,15 @@
1
+ import type { AdapterAdmissionReport, AdapterManifest, AdmissionCheck } from './types.js';
2
+ export interface CreateAdmissionReportInput {
3
+ readonly manifest: AdapterManifest;
4
+ readonly demand: string;
5
+ readonly designPartner?: string;
6
+ readonly identitySummary: string;
7
+ readonly compatibilitySummary: string;
8
+ readonly evidenceRendering: string;
9
+ readonly latencyResourceSummary?: string;
10
+ readonly dependenciesAndLicenses?: readonly string[];
11
+ readonly checks: readonly AdmissionCheck[];
12
+ readonly realLabelledCorpusState?: 'absent' | 'available';
13
+ }
14
+ export declare function createAdmissionReport(input: CreateAdmissionReportInput): AdapterAdmissionReport;
15
+ //# sourceMappingURL=admission.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admission.d.ts","sourceRoot":"","sources":["../src/admission.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG1F,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrD,QAAQ,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3C,QAAQ,CAAC,uBAAuB,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC;CAC3D;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,GAAG,sBAAsB,CA2B/F"}
@@ -0,0 +1,29 @@
1
+ import { contentHash, hashCanonical } from '@yanib/reverb-domain';
2
+ import { validateAdapterManifest } from './validation.js';
3
+ export function createAdmissionReport(input) {
4
+ const manifest = validateAdapterManifest(input.manifest);
5
+ const withoutHash = {
6
+ schema: 'reverb.adapter-admission',
7
+ schemaVersion: '1.0',
8
+ adapterId: manifest.id,
9
+ adapterVersion: manifest.version,
10
+ identityVersion: manifest.identityVersion,
11
+ demand: input.demand,
12
+ designPartner: input.designPartner ?? 'none',
13
+ identitySummary: input.identitySummary,
14
+ compatibilitySummary: input.compatibilitySummary,
15
+ evidenceRendering: input.evidenceRendering,
16
+ latencyResourceSummary: input.latencyResourceSummary ??
17
+ `timeout=${manifest.resourceBudget.timeoutMs}ms memory=${manifest.resourceBudget.memoryMiB}MiB output=${manifest.resourceBudget.maximumOutputBytes}B`,
18
+ dependenciesAndLicenses: input.dependenciesAndLicenses ??
19
+ manifest.externalTools.map((tool) => `${tool.id}@${tool.version}: ${tool.license}`),
20
+ limitations: manifest.limitations,
21
+ maintainer: manifest.maintainer,
22
+ checks: [...input.checks].sort((left, right) => left.id.localeCompare(right.id)),
23
+ realLabelledCorpusState: input.realLabelledCorpusState ?? 'absent',
24
+ promotionState: 'UNMEASURED',
25
+ deliveryReady: false,
26
+ };
27
+ return { ...withoutHash, outputHash: contentHash(hashCanonical(withoutHash)) };
28
+ }
29
+ //# sourceMappingURL=admission.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admission.js","sourceRoot":"","sources":["../src/admission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGlE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAe1D,MAAM,UAAU,qBAAqB,CAAC,KAAiC;IACrE,MAAM,QAAQ,GAAG,uBAAuB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACzD,MAAM,WAAW,GAAG;QAClB,MAAM,EAAE,0BAAmC;QAC3C,aAAa,EAAE,KAAc;QAC7B,SAAS,EAAE,QAAQ,CAAC,EAAE;QACtB,cAAc,EAAE,QAAQ,CAAC,OAAO;QAChC,eAAe,EAAE,QAAQ,CAAC,eAAe;QACzC,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,MAAM;QAC5C,eAAe,EAAE,KAAK,CAAC,eAAe;QACtC,oBAAoB,EAAE,KAAK,CAAC,oBAAoB;QAChD,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;QAC1C,sBAAsB,EACpB,KAAK,CAAC,sBAAsB;YAC5B,WAAW,QAAQ,CAAC,cAAc,CAAC,SAAS,aAAa,QAAQ,CAAC,cAAc,CAAC,SAAS,cAAc,QAAQ,CAAC,cAAc,CAAC,kBAAkB,GAAG;QACvJ,uBAAuB,EACrB,KAAK,CAAC,uBAAuB;YAC7B,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;QACrF,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAChF,uBAAuB,EAAE,KAAK,CAAC,uBAAuB,IAAK,QAAkB;QAC7E,cAAc,EAAE,YAAqB;QACrC,aAAa,EAAE,KAAc;KAC9B,CAAC;IACF,OAAO,EAAE,GAAG,WAAW,EAAE,UAAU,EAAE,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;AACjF,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { AdapterExtractionResult, ContractAdapter, ExtractRequest } from './types.js';
2
+ export interface DeterminismReport {
3
+ readonly stable: boolean;
4
+ readonly outputHash: AdapterExtractionResult['outputHash'];
5
+ readonly byteLength: number;
6
+ }
7
+ export declare function verifyExtractionDeterminism(adapter: ContractAdapter, request: ExtractRequest): Promise<DeterminismReport>;
8
+ export declare function verifyIdentityRoundTrip(canonicalize: (raw: Readonly<Record<string, string>>) => string, producer: Readonly<Record<string, string>>, consumer: Readonly<Record<string, string>>): string;
9
+ //# sourceMappingURL=harness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../src/harness.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG3F,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,uBAAuB,CAAC,YAAY,CAAC,CAAC;IAC3D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,iBAAiB,CAAC,CAuB5B;AAED,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,MAAM,EAC/D,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC1C,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACzC,MAAM,CAUR"}
@@ -0,0 +1,30 @@
1
+ import { canonicalJson } from '@yanib/reverb-domain';
2
+ import { AdapterValidationError, validateAdapterManifest } from './validation.js';
3
+ export async function verifyExtractionDeterminism(adapter, request) {
4
+ validateAdapterManifest(adapter.manifest);
5
+ const first = await adapter.extract(request);
6
+ const second = await adapter.extract(request);
7
+ const firstJson = canonicalJson(first);
8
+ const secondJson = canonicalJson(second);
9
+ if (firstJson !== secondJson || first.outputHash !== second.outputHash) {
10
+ throw new AdapterValidationError('nondeterministic_output', 'Repeated extraction produced different canonical output.');
11
+ }
12
+ const byteLength = Buffer.byteLength(firstJson);
13
+ if (byteLength > adapter.manifest.resourceBudget.maximumOutputBytes) {
14
+ throw new AdapterValidationError('output_limit', 'Adapter output exceeds its declared limit.');
15
+ }
16
+ if (first.definitions.length + first.references.length >
17
+ adapter.manifest.resourceBudget.maximumItems) {
18
+ throw new AdapterValidationError('item_limit', 'Adapter output exceeds its item limit.');
19
+ }
20
+ return { stable: true, outputHash: first.outputHash, byteLength };
21
+ }
22
+ export function verifyIdentityRoundTrip(canonicalize, producer, consumer) {
23
+ const producerKey = canonicalize(producer);
24
+ const consumerKey = canonicalize(consumer);
25
+ if (producerKey !== consumerKey) {
26
+ throw new AdapterValidationError('identity_round_trip_failed', 'Producer and consumer identity variants do not canonicalize equally.');
27
+ }
28
+ return producerKey;
29
+ }
30
+ //# sourceMappingURL=harness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness.js","sourceRoot":"","sources":["../src/harness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAQlF,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,OAAwB,EACxB,OAAuB;IAEvB,uBAAuB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,SAAS,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACzC,IAAI,SAAS,KAAK,UAAU,IAAI,KAAK,CAAC,UAAU,KAAK,MAAM,CAAC,UAAU,EAAE,CAAC;QACvE,MAAM,IAAI,sBAAsB,CAC9B,yBAAyB,EACzB,0DAA0D,CAC3D,CAAC;IACJ,CAAC;IACD,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAChD,IAAI,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC;QACpE,MAAM,IAAI,sBAAsB,CAAC,cAAc,EAAE,4CAA4C,CAAC,CAAC;IACjG,CAAC;IACD,IACE,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM;QAClD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,YAAY,EAC5C,CAAC;QACD,MAAM,IAAI,sBAAsB,CAAC,YAAY,EAAE,wCAAwC,CAAC,CAAC;IAC3F,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,UAAU,EAAE,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,YAA+D,EAC/D,QAA0C,EAC1C,QAA0C;IAE1C,MAAM,WAAW,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC3C,MAAM,WAAW,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,WAAW,KAAK,WAAW,EAAE,CAAC;QAChC,MAAM,IAAI,sBAAsB,CAC9B,4BAA4B,EAC5B,sEAAsE,CACvE,CAAC;IACJ,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { contentHash } from '@yanib/reverb-domain';
2
+ export declare function canonicalIdentitySegment(value: string, name: string): string;
3
+ export declare function canonicalContractKey(scheme: string, segments: readonly {
4
+ readonly name: string;
5
+ readonly value: string;
6
+ }[]): string;
7
+ export declare function canonicalShape(value: Readonly<Record<string, unknown>>): {
8
+ readonly shape: Readonly<Record<string, unknown>>;
9
+ readonly shapeHash: ReturnType<typeof contentHash>;
10
+ };
11
+ //# sourceMappingURL=identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,WAAW,EAAiB,MAAM,sBAAsB,CAAC;AAIjF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAM5E;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,GACrE,MAAM,CAKR;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG;IACxE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAClD,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;CACpD,CAGA"}
@@ -0,0 +1,20 @@
1
+ import { canonicalJson, contentHash, hashCanonical } from '@yanib/reverb-domain';
2
+ import { AdapterValidationError } from './validation.js';
3
+ export function canonicalIdentitySegment(value, name) {
4
+ const normalized = value.normalize('NFC').trim();
5
+ if (normalized.length === 0 || normalized.length > 512 || normalized.includes('\0')) {
6
+ throw new AdapterValidationError('invalid_identity', `${name} is not a bounded identity.`);
7
+ }
8
+ return encodeURIComponent(normalized);
9
+ }
10
+ export function canonicalContractKey(scheme, segments) {
11
+ const prefix = canonicalIdentitySegment(scheme.toLowerCase(), 'Identity scheme');
12
+ return `${prefix}:${segments
13
+ .map((segment) => canonicalIdentitySegment(segment.value, segment.name))
14
+ .join('#')}`;
15
+ }
16
+ export function canonicalShape(value) {
17
+ JSON.parse(canonicalJson(value));
18
+ return { shape: value, shapeHash: contentHash(hashCanonical(value)) };
19
+ }
20
+ //# sourceMappingURL=identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.js","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,MAAM,UAAU,wBAAwB,CAAC,KAAa,EAAE,IAAY;IAClE,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;IACjD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACpF,MAAM,IAAI,sBAAsB,CAAC,kBAAkB,EAAE,GAAG,IAAI,6BAA6B,CAAC,CAAC;IAC7F,CAAC;IACD,OAAO,kBAAkB,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,MAAc,EACd,QAAsE;IAEtE,MAAM,MAAM,GAAG,wBAAwB,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,iBAAiB,CAAC,CAAC;IACjF,OAAO,GAAG,MAAM,IAAI,QAAQ;SACzB,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,wBAAwB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;SACvE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAwC;IAIrE,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;IACjC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;AACxE,CAAC"}
@@ -0,0 +1,9 @@
1
+ export * from './admission.js';
2
+ export * from './harness.js';
3
+ export * from './identity.js';
4
+ export * from './materialize.js';
5
+ export * from './sandbox.js';
6
+ export * from './types.js';
7
+ export * from './validation.js';
8
+ export declare const ADAPTER_SDK_PACKAGE_ID = "@yanib/reverb-adapter-sdk";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAEhC,eAAO,MAAM,sBAAsB,8BAA8B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ export * from './admission.js';
2
+ export * from './harness.js';
3
+ export * from './identity.js';
4
+ export * from './materialize.js';
5
+ export * from './sandbox.js';
6
+ export * from './types.js';
7
+ export * from './validation.js';
8
+ export const ADAPTER_SDK_PACKAGE_ID = '@yanib/reverb-adapter-sdk';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAEhC,MAAM,CAAC,MAAM,sBAAsB,GAAG,2BAA2B,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { type CommitSha, type ContractGenerationObservation, type GenerationId, type IndexedContractChange, type Instant, type RepositoryStableId, type WorkspaceId } from '@yanib/reverb-domain';
2
+ import type { AdapterDiffResult, AdapterExtractionResult } from './types.js';
3
+ export declare function materializeContractObservation(input: {
4
+ readonly workspaceId: WorkspaceId;
5
+ readonly repositoryId: RepositoryStableId;
6
+ readonly generationId: GenerationId;
7
+ readonly commitSha: CommitSha;
8
+ readonly observedAt: Instant;
9
+ readonly extractions: readonly AdapterExtractionResult[];
10
+ readonly serviceId?: string;
11
+ }): ContractGenerationObservation;
12
+ export declare function materializeContractChanges(input: {
13
+ readonly workspaceId: WorkspaceId;
14
+ readonly producerRepositoryId: RepositoryStableId;
15
+ readonly baseGenerationId: GenerationId;
16
+ readonly headGenerationId?: GenerationId;
17
+ readonly baseSha: CommitSha;
18
+ readonly headSha: CommitSha;
19
+ readonly diffs: readonly AdapterDiffResult[];
20
+ }): readonly IndexedContractChange[];
21
+ //# sourceMappingURL=materialize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"materialize.d.ts","sourceRoot":"","sources":["../src/materialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,6BAA6B,EAClC,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAG1B,KAAK,OAAO,EACZ,KAAK,kBAAkB,EACvB,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAwB7E,wBAAgB,8BAA8B,CAAC,KAAK,EAAE;IACpD,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAC;IAC1C,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACzD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B,GAAG,6BAA6B,CA+EhC;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,oBAAoB,EAAE,kBAAkB,CAAC;IAClD,QAAQ,CAAC,gBAAgB,EAAE,YAAY,CAAC;IACxC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,YAAY,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC9C,GAAG,SAAS,qBAAqB,EAAE,CAgCnC"}
@@ -0,0 +1,113 @@
1
+ import { contentHash, deriveStableReferenceId, hashCanonical, } from '@yanib/reverb-domain';
2
+ function observationCoverage(extractions) {
3
+ const itemCount = extractions.reduce((count, extraction) => count + extraction.definitions.length + extraction.references.length, 0);
4
+ if (extractions.length === 0)
5
+ return 'unsupported';
6
+ if (extractions.every((value) => value.coverage.state === 'unsupported') && itemCount === 0) {
7
+ return 'unsupported';
8
+ }
9
+ if (extractions.every((value) => value.coverage.state === 'failed' || value.coverage.state === 'unsupported') &&
10
+ itemCount === 0) {
11
+ return 'failed';
12
+ }
13
+ return extractions.every((value) => value.coverage.state === 'complete') ? 'complete' : 'partial';
14
+ }
15
+ export function materializeContractObservation(input) {
16
+ const definitions = input.extractions.flatMap((extraction) => extraction.definitions.map((definition) => ({
17
+ workspaceId: input.workspaceId,
18
+ repositoryId: input.repositoryId,
19
+ generationId: input.generationId,
20
+ commitSha: input.commitSha,
21
+ ...(input.serviceId === undefined ? {} : { serviceId: input.serviceId }),
22
+ contractKind: definition.contractKind,
23
+ canonicalKey: definition.canonicalKey,
24
+ path: definition.path,
25
+ ...(definition.range === undefined ? {} : { range: definition.range }),
26
+ contentHash: definition.contentHash,
27
+ shapeHash: definition.shapeHash,
28
+ adapterId: definition.extractorId,
29
+ adapterVersion: definition.extractorVersion,
30
+ identityVersion: definition.identityVersion,
31
+ configRevision: definition.configRevision,
32
+ evidenceStratum: definition.evidenceStratum,
33
+ })));
34
+ const referencesById = new Map();
35
+ for (const extraction of input.extractions) {
36
+ for (const reference of extraction.references) {
37
+ const stableId = deriveStableReferenceId({
38
+ contractKind: reference.contractKind,
39
+ ...(reference.canonicalKey === undefined
40
+ ? { unresolvedPattern: reference.unresolvedPattern ?? 'unknown' }
41
+ : { canonicalKey: reference.canonicalKey }),
42
+ ...(reference.semanticOwner === undefined
43
+ ? {}
44
+ : { semanticOwner: reference.semanticOwner }),
45
+ evidenceStratum: reference.evidenceStratum,
46
+ });
47
+ const indexed = {
48
+ workspaceId: input.workspaceId,
49
+ repositoryId: input.repositoryId,
50
+ generationId: input.generationId,
51
+ commitSha: input.commitSha,
52
+ ...(input.serviceId === undefined ? {} : { consumerServiceId: input.serviceId }),
53
+ contractKind: reference.contractKind,
54
+ ...(reference.canonicalKey === undefined ? {} : { canonicalKey: reference.canonicalKey }),
55
+ ...(reference.unresolvedPattern === undefined
56
+ ? {}
57
+ : { unresolvedPattern: reference.unresolvedPattern }),
58
+ stableReferenceId: stableId,
59
+ path: reference.path,
60
+ ...(reference.range === undefined ? {} : { range: reference.range }),
61
+ contentHash: reference.contentHash,
62
+ adapterId: reference.extractorId,
63
+ adapterVersion: reference.extractorVersion,
64
+ identityVersion: reference.identityVersion,
65
+ configRevision: reference.configRevision,
66
+ evidenceStratum: reference.evidenceStratum,
67
+ activation: reference.activation,
68
+ };
69
+ const prior = referencesById.get(stableId);
70
+ if (prior === undefined || indexed.path < prior.path)
71
+ referencesById.set(stableId, indexed);
72
+ }
73
+ }
74
+ const canonicalDefinitions = definitions.sort((left, right) => `${left.contractKind}\0${left.canonicalKey}\0${left.path}`.localeCompare(`${right.contractKind}\0${right.canonicalKey}\0${right.path}`));
75
+ const references = [...referencesById.values()].sort((left, right) => left.stableReferenceId.localeCompare(right.stableReferenceId));
76
+ const canonical = {
77
+ workspaceId: input.workspaceId,
78
+ repositoryId: input.repositoryId,
79
+ generationId: input.generationId,
80
+ commitSha: input.commitSha,
81
+ coverageState: observationCoverage(input.extractions),
82
+ definitions: canonicalDefinitions,
83
+ references,
84
+ observedAt: input.observedAt,
85
+ };
86
+ return { ...canonical, outputHash: contentHash(hashCanonical(canonical)) };
87
+ }
88
+ export function materializeContractChanges(input) {
89
+ return input.diffs
90
+ .flatMap((diff) => diff.changes.map((change) => ({
91
+ workspaceId: input.workspaceId,
92
+ producerRepositoryId: input.producerRepositoryId,
93
+ baseGenerationId: input.baseGenerationId,
94
+ ...(input.headGenerationId === undefined
95
+ ? {}
96
+ : { headGenerationId: input.headGenerationId }),
97
+ baseSha: input.baseSha,
98
+ headSha: input.headSha,
99
+ contractKind: change.contractKind,
100
+ canonicalKey: change.canonicalKey,
101
+ changeKind: change.changeKind,
102
+ compatibility: change.compatibility,
103
+ activation: change.activation,
104
+ adapterId: diff.adapterId,
105
+ adapterVersion: diff.adapterVersion,
106
+ identityVersion: diff.identityVersion,
107
+ coverageState: diff.coverage.state,
108
+ coverageDependencies: change.coverageDependencies,
109
+ remedy: change.remedy,
110
+ })))
111
+ .sort((left, right) => `${left.contractKind}\0${left.canonicalKey}`.localeCompare(`${right.contractKind}\0${right.canonicalKey}`));
112
+ }
113
+ //# sourceMappingURL=materialize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"materialize.js","sourceRoot":"","sources":["../src/materialize.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,aAAa,GAUd,MAAM,sBAAsB,CAAC;AAI9B,SAAS,mBAAmB,CAC1B,WAA+C;IAE/C,MAAM,SAAS,GAAG,WAAW,CAAC,MAAM,CAClC,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,CAAC,KAAK,GAAG,UAAU,CAAC,WAAW,CAAC,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,MAAM,EAC3F,CAAC,CACF,CAAC;IACF,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,aAAa,CAAC;IACnD,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,KAAK,aAAa,CAAC,IAAI,SAAS,KAAK,CAAC,EAAE,CAAC;QAC5F,OAAO,aAAa,CAAC;IACvB,CAAC;IACD,IACE,WAAW,CAAC,KAAK,CACf,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,KAAK,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EAAE,IAAI,CAAC,SAAS;QACzB,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK;QAClC,oBAAoB,EAAE,MAAM,CAAC,oBAAoB;QACjD,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC,CACH,CACF;SACA,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACpB,GAAG,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,YAAY,EAAE,CAAC,aAAa,CACxD,GAAG,KAAK,CAAC,YAAY,KAAK,KAAK,CAAC,YAAY,EAAE,CAC/C,CACF,CAAC;AACN,CAAC"}
@@ -0,0 +1,62 @@
1
+ import type { ContentHash } from '@yanib/reverb-domain';
2
+ import type { DifferMetadata, ExternalToolDeclaration } from './types.js';
3
+ export interface AdapterSandboxRequest {
4
+ readonly toolId: string;
5
+ readonly argv: readonly string[];
6
+ readonly inputRefs: readonly string[];
7
+ readonly timeoutMs: number;
8
+ readonly maximumOutputBytes: number;
9
+ readonly network: false;
10
+ readonly readOnlyInputs: true;
11
+ readonly scratchOutput: true;
12
+ readonly memoryMiB: number;
13
+ readonly environment: Readonly<Record<string, never>>;
14
+ }
15
+ export interface AdapterSandboxResult {
16
+ readonly exitCode: number | null;
17
+ readonly stdout: Uint8Array;
18
+ readonly stderrCode: string | null;
19
+ readonly timedOut: boolean;
20
+ readonly outputTruncated: boolean;
21
+ }
22
+ export type AdapterSandboxPortResult<Value> = {
23
+ readonly ok: true;
24
+ readonly value: Value;
25
+ } | {
26
+ readonly ok: false;
27
+ readonly failure: {
28
+ readonly kind: string;
29
+ readonly code: string;
30
+ readonly safeMessage: string;
31
+ readonly retryable: boolean;
32
+ };
33
+ };
34
+ export interface AdapterSandboxRunner {
35
+ run(request: AdapterSandboxRequest): Promise<AdapterSandboxPortResult<AdapterSandboxResult>>;
36
+ }
37
+ export interface DifferExitMap {
38
+ readonly compatible: readonly number[];
39
+ readonly breaking: readonly number[];
40
+ readonly unknown: readonly number[];
41
+ }
42
+ export interface DeclaredDifferResult {
43
+ readonly state: 'compatible' | 'breaking' | 'unknown' | 'tool_failure';
44
+ readonly stdout: Uint8Array;
45
+ readonly failureCode?: string;
46
+ readonly metadata: DifferMetadata;
47
+ }
48
+ export declare class DeclaredExternalDiffer {
49
+ private readonly tool;
50
+ private readonly sandbox;
51
+ private readonly options;
52
+ constructor(tool: ExternalToolDeclaration, sandbox: AdapterSandboxRunner, options: {
53
+ readonly timeoutMs: number;
54
+ readonly memoryMiB: number;
55
+ readonly maximumOutputBytes: number;
56
+ readonly exitMap: DifferExitMap;
57
+ readonly category: string;
58
+ });
59
+ run(argv: readonly string[], inputRefs: readonly string[]): Promise<DeclaredDifferResult>;
60
+ }
61
+ export declare function contentInputReference(hash: ContentHash): string;
62
+ //# sourceMappingURL=sandbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAG1E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB,QAAQ,CAAC,cAAc,EAAE,IAAI,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MA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C;IACvE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;CACnC;AAcD,qBAAa,sBAAsB;IAE/B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAFP,IAAI,EAAE,uBAAuB,EAC7B,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE;QACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;QACpC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;QAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;KAC3B;IAMU,GAAG,CACd,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,OAAO,CAAC,oBAAoB,CAAC;CAkEjC;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAE/D"}
@@ -0,0 +1,88 @@
1
+ import { AdapterValidationError } from './validation.js';
2
+ const INPUT_REF = /^blob:sha256:[0-9a-f]{64}$/;
3
+ function metadata(tool, category) {
4
+ return {
5
+ toolId: tool.id,
6
+ toolVersion: tool.version,
7
+ toolDigest: tool.digest,
8
+ toolLicense: tool.license,
9
+ category,
10
+ };
11
+ }
12
+ export class DeclaredExternalDiffer {
13
+ tool;
14
+ sandbox;
15
+ options;
16
+ constructor(tool, sandbox, options) {
17
+ this.tool = tool;
18
+ this.sandbox = sandbox;
19
+ this.options = options;
20
+ if (tool.network !== false)
21
+ throw new AdapterValidationError('unsafe_tool', 'Differ tools must deny network.');
22
+ }
23
+ async run(argv, inputRefs) {
24
+ if (argv.length === 0 ||
25
+ argv.length > 64 ||
26
+ argv.some((argument) => argument.length > 2048 || argument.includes('\0'))) {
27
+ throw new AdapterValidationError('invalid_tool_argv', 'Differ argv is invalid.');
28
+ }
29
+ if (inputRefs.length === 0 || inputRefs.some((reference) => !INPUT_REF.test(reference))) {
30
+ throw new AdapterValidationError('unsafe_tool_input', 'Differ inputs must be content-addressed read-only blobs.');
31
+ }
32
+ const result = await this.sandbox.run({
33
+ toolId: this.tool.id,
34
+ argv: [...argv],
35
+ inputRefs: [...inputRefs],
36
+ timeoutMs: this.options.timeoutMs,
37
+ maximumOutputBytes: this.options.maximumOutputBytes,
38
+ network: false,
39
+ readOnlyInputs: true,
40
+ scratchOutput: true,
41
+ memoryMiB: this.options.memoryMiB,
42
+ environment: {},
43
+ });
44
+ const toolMetadata = metadata(this.tool, this.options.category);
45
+ if (!result.ok) {
46
+ return {
47
+ state: 'tool_failure',
48
+ stdout: new Uint8Array(),
49
+ failureCode: result.failure.code,
50
+ metadata: toolMetadata,
51
+ };
52
+ }
53
+ if (result.value.timedOut)
54
+ return {
55
+ state: 'tool_failure',
56
+ stdout: new Uint8Array(),
57
+ failureCode: 'tool_timeout',
58
+ metadata: toolMetadata,
59
+ };
60
+ if (result.value.outputTruncated)
61
+ return {
62
+ state: 'tool_failure',
63
+ stdout: new Uint8Array(),
64
+ failureCode: 'tool_output_truncated',
65
+ metadata: toolMetadata,
66
+ };
67
+ const exitCode = result.value.exitCode;
68
+ if (exitCode !== null && this.options.exitMap.compatible.includes(exitCode)) {
69
+ return { state: 'compatible', stdout: result.value.stdout, metadata: toolMetadata };
70
+ }
71
+ if (exitCode !== null && this.options.exitMap.breaking.includes(exitCode)) {
72
+ return { state: 'breaking', stdout: result.value.stdout, metadata: toolMetadata };
73
+ }
74
+ if (exitCode !== null && this.options.exitMap.unknown.includes(exitCode)) {
75
+ return { state: 'unknown', stdout: result.value.stdout, metadata: toolMetadata };
76
+ }
77
+ return {
78
+ state: 'tool_failure',
79
+ stdout: new Uint8Array(),
80
+ failureCode: result.value.stderrCode ?? 'unmapped_tool_exit',
81
+ metadata: toolMetadata,
82
+ };
83
+ }
84
+ }
85
+ export function contentInputReference(hash) {
86
+ return `blob:${hash}`;
87
+ }
88
+ //# sourceMappingURL=sandbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAoDzD,MAAM,SAAS,GAAG,4BAA4B,CAAC;AAE/C,SAAS,QAAQ,CAAC,IAA6B,EAAE,QAAgB;IAC/D,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,EAAE;QACf,WAAW,EAAE,IAAI,CAAC,OAAO;QACzB,UAAU,EAAE,IAAI,CAAC,MAAM;QACvB,WAAW,EAAE,IAAI,CAAC,OAAO;QACzB,QAAQ;KACT,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,sBAAsB;IAEd;IACA;IACA;IAHnB,YACmB,IAA6B,EAC7B,OAA6B,EAC7B,OAMhB;QARgB,SAAI,GAAJ,IAAI,CAAyB;QAC7B,YAAO,GAAP,OAAO,CAAsB;QAC7B,YAAO,GAAP,OAAO,CAMvB;QAED,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK;YACxB,MAAM,IAAI,sBAAsB,CAAC,aAAa,EAAE,iCAAiC,CAAC,CAAC;IACvF,CAAC;IAEM,KAAK,CAAC,GAAG,CACd,IAAuB,EACvB,SAA4B;QAE5B,IACE,IAAI,CAAC,MAAM,KAAK,CAAC;YACjB,IAAI,CAAC,MAAM,GAAG,EAAE;YAChB,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,GAAG,IAAI,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAC1E,CAAC;YACD,MAAM,IAAI,sBAAsB,CAAC,mBAAmB,EAAE,yBAAyB,C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C,IAAiB;IACrD,OAAO,QAAQ,IAAI,EAAE,CAAC;AACxB,CAAC"}
@@ -0,0 +1,195 @@
1
+ import type { AdapterId, BoundedDiagnostic, ConfigRevision, ContractKind, ContentHash, RepoPath } from '@yanib/reverb-domain';
2
+ export { CONTRACT_KINDS } from '@yanib/reverb-domain';
3
+ export type { ContractKind } from '@yanib/reverb-domain';
4
+ export declare const CAPABILITY_TIERS: readonly ["contract_grade", "structural", "preview"];
5
+ export type CapabilityTier = (typeof CAPABILITY_TIERS)[number];
6
+ export declare const COMPATIBILITY_RESULTS: readonly ["breaking", "potentially_breaking", "compatible", "unknown"];
7
+ export type CompatibilityResult = (typeof COMPATIBILITY_RESULTS)[number];
8
+ export declare const ACTIVATION_TIMINGS: readonly ["current_runtime", "on_upgrade", "on_deploy", "unknown"];
9
+ export type ActivationTiming = (typeof ACTIVATION_TIMINGS)[number];
10
+ export interface EvidenceStratumDeclaration {
11
+ readonly id: string;
12
+ readonly family: 'exact_schema' | 'exact_symbol' | 'fallback_identity';
13
+ readonly requiredEvidence: readonly string[];
14
+ readonly promotionState: 'UNMEASURED';
15
+ }
16
+ export interface ExternalToolDeclaration {
17
+ readonly id: string;
18
+ readonly version: string;
19
+ readonly digest: ContentHash;
20
+ readonly license: string;
21
+ readonly network: false;
22
+ }
23
+ export interface AdapterResourceBudget {
24
+ readonly timeoutMs: number;
25
+ readonly memoryMiB: number;
26
+ readonly maximumInputBytes: number;
27
+ readonly maximumOutputBytes: number;
28
+ readonly maximumItems: number;
29
+ }
30
+ export interface AdapterManifest {
31
+ readonly schema: 'reverb.adapter-manifest';
32
+ readonly schemaVersion: '1.0';
33
+ readonly id: AdapterId;
34
+ readonly version: string;
35
+ readonly identityVersion: number;
36
+ readonly contractKinds: readonly ContractKind[];
37
+ readonly capabilityTiers: readonly {
38
+ readonly input: string;
39
+ readonly tier: CapabilityTier;
40
+ }[];
41
+ readonly evidenceStrata: readonly EvidenceStratumDeclaration[];
42
+ readonly externalTools: readonly ExternalToolDeclaration[];
43
+ readonly limitations: readonly string[];
44
+ readonly resourceBudget: AdapterResourceBudget;
45
+ readonly maintainer: string;
46
+ readonly deprecated?: {
47
+ readonly replacement?: AdapterId;
48
+ readonly removeAfter?: string;
49
+ };
50
+ }
51
+ export interface ArtifactInput {
52
+ readonly path: RepoPath;
53
+ readonly contentHash: ContentHash;
54
+ readonly bytes: Uint8Array;
55
+ readonly classification: 'source' | 'generated' | 'vendored' | 'test' | 'example';
56
+ }
57
+ export interface SourceRange {
58
+ readonly startLine: number;
59
+ readonly startColumn: number;
60
+ readonly endLine: number;
61
+ readonly endColumn: number;
62
+ }
63
+ export interface ContractDefinition {
64
+ readonly contractKind: ContractKind;
65
+ readonly canonicalKey: string;
66
+ readonly displayName: string;
67
+ readonly path: RepoPath;
68
+ readonly range?: SourceRange;
69
+ readonly contentHash: ContentHash;
70
+ readonly shapeHash: ContentHash;
71
+ readonly shape: Readonly<Record<string, unknown>>;
72
+ readonly extractorId: AdapterId;
73
+ readonly extractorVersion: string;
74
+ readonly identityVersion: number;
75
+ readonly configRevision: ConfigRevision;
76
+ readonly evidenceStratum: string;
77
+ }
78
+ export interface ContractReference {
79
+ readonly contractKind: ContractKind;
80
+ readonly canonicalKey?: string;
81
+ readonly unresolvedPattern?: string;
82
+ readonly unresolvedReason?: string;
83
+ readonly semanticOwner?: string;
84
+ readonly path: RepoPath;
85
+ readonly range?: SourceRange;
86
+ readonly contentHash: ContentHash;
87
+ readonly extractorId: AdapterId;
88
+ readonly extractorVersion: string;
89
+ readonly identityVersion: number;
90
+ readonly configRevision: ConfigRevision;
91
+ readonly evidenceStratum: string;
92
+ readonly activation: ActivationTiming;
93
+ }
94
+ export interface AdapterLimitation {
95
+ readonly code: string;
96
+ readonly scope?: RepoPath;
97
+ }
98
+ export interface AdapterCoverage {
99
+ readonly state: 'complete' | 'partial' | 'failed' | 'unsupported';
100
+ readonly eligibleArtifacts: number;
101
+ readonly processedArtifacts: number;
102
+ readonly skippedArtifacts: number;
103
+ readonly failedArtifacts: number;
104
+ readonly limitations: readonly AdapterLimitation[];
105
+ }
106
+ export interface AdapterExtractionResult {
107
+ readonly schema: 'reverb.adapter-extraction';
108
+ readonly schemaVersion: '1.0';
109
+ readonly adapterId: AdapterId;
110
+ readonly adapterVersion: string;
111
+ readonly identityVersion: number;
112
+ readonly configRevision: ConfigRevision;
113
+ readonly definitions: readonly ContractDefinition[];
114
+ readonly references: readonly ContractReference[];
115
+ readonly coverage: AdapterCoverage;
116
+ readonly diagnostics: readonly BoundedDiagnostic[];
117
+ readonly sourceFingerprint: ContentHash;
118
+ readonly outputHash: ContentHash;
119
+ }
120
+ export interface DifferMetadata {
121
+ readonly toolId: string;
122
+ readonly toolVersion: string;
123
+ readonly toolDigest: ContentHash;
124
+ readonly toolLicense: string;
125
+ readonly category: string;
126
+ }
127
+ export interface ContractChange {
128
+ readonly contractKind: ContractKind;
129
+ readonly canonicalKey: string;
130
+ readonly changeKind: string;
131
+ readonly compatibility: CompatibilityResult;
132
+ readonly activation: ActivationTiming;
133
+ readonly baseShapeHash?: ContentHash;
134
+ readonly headShapeHash?: ContentHash;
135
+ readonly coverageDependencies: readonly string[];
136
+ readonly remedy: {
137
+ readonly kind: string;
138
+ readonly text: string;
139
+ };
140
+ readonly differ: DifferMetadata;
141
+ }
142
+ export interface AdapterDiffResult {
143
+ readonly schema: 'reverb.adapter-diff';
144
+ readonly schemaVersion: '1.0';
145
+ readonly adapterId: AdapterId;
146
+ readonly adapterVersion: string;
147
+ readonly identityVersion: number;
148
+ readonly changes: readonly ContractChange[];
149
+ readonly coverage: AdapterCoverage;
150
+ readonly diagnostics: readonly BoundedDiagnostic[];
151
+ readonly outputHash: ContentHash;
152
+ }
153
+ export interface ExtractRequest {
154
+ readonly artifacts: readonly ArtifactInput[];
155
+ readonly configRevision: ConfigRevision;
156
+ readonly context: Readonly<Record<string, unknown>>;
157
+ }
158
+ export interface DiffRequest {
159
+ readonly base: AdapterExtractionResult;
160
+ readonly head: AdapterExtractionResult;
161
+ readonly configRevision: ConfigRevision;
162
+ readonly context: Readonly<Record<string, unknown>>;
163
+ }
164
+ export interface ContractAdapter {
165
+ readonly manifest: AdapterManifest;
166
+ extract(request: ExtractRequest): Promise<AdapterExtractionResult>;
167
+ diff(request: DiffRequest): Promise<AdapterDiffResult>;
168
+ }
169
+ export interface AdmissionCheck {
170
+ readonly id: string;
171
+ readonly state: 'pass' | 'fail' | 'not_measured';
172
+ readonly evidence: string;
173
+ }
174
+ export interface AdapterAdmissionReport {
175
+ readonly schema: 'reverb.adapter-admission';
176
+ readonly schemaVersion: '1.0';
177
+ readonly adapterId: AdapterId;
178
+ readonly adapterVersion: string;
179
+ readonly identityVersion: number;
180
+ readonly demand: string;
181
+ readonly designPartner: string;
182
+ readonly identitySummary: string;
183
+ readonly compatibilitySummary: string;
184
+ readonly evidenceRendering: string;
185
+ readonly latencyResourceSummary: string;
186
+ readonly dependenciesAndLicenses: readonly string[];
187
+ readonly limitations: readonly string[];
188
+ readonly maintainer: string;
189
+ readonly checks: readonly AdmissionCheck[];
190
+ readonly realLabelledCorpusState: 'absent' | 'available';
191
+ readonly promotionState: 'UNMEASURED';
192
+ readonly deliveryReady: false;
193
+ readonly outputHash: ContentHash;
194
+ }
195
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,WAAW,EACX,QAAQ,EACT,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,eAAO,MAAM,gBAAgB,sDAAuD,CAAC;AACrF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,eAA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QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,uBAAuB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpD,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3C,QAAQ,CAAC,uBAAuB,EAAE,QAAQ,GAAG,WAAW,CAAC;IACzD,QAAQ,CAAC,cAAc,EAAE,YAAY,CAAC;IACtC,QAAQ,CAAC,aAAa,EAAE,KAAK,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;CAClC"}
package/dist/types.js ADDED
@@ -0,0 +1,15 @@
1
+ export { CONTRACT_KINDS } from '@yanib/reverb-domain';
2
+ export const CAPABILITY_TIERS = ['contract_grade', 'structural', 'preview'];
3
+ export const COMPATIBILITY_RESULTS = [
4
+ 'breaking',
5
+ 'potentially_breaking',
6
+ 'compatible',
7
+ 'unknown',
8
+ ];
9
+ export const ACTIVATION_TIMINGS = [
10
+ 'current_runtime',
11
+ 'on_upgrade',
12
+ 'on_deploy',
13
+ 'unknown',
14
+ ];
15
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,gBAAgB,EAAE,YAAY,EAAE,SAAS,CAAU,CAAC;AAGrF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,UAAU;IACV,sBAAsB;IACtB,YAAY;IACZ,SAAS;CACD,CAAC;AAGX,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,iBAAiB;IACjB,YAAY;IACZ,WAAW;IACX,SAAS;CACD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { configRevision } from '@yanib/reverb-domain';
2
+ import { type AdapterCoverage, type AdapterDiffResult, type AdapterExtractionResult, type AdapterManifest } from './types.js';
3
+ export declare class AdapterValidationError extends Error {
4
+ readonly code: string;
5
+ constructor(code: string, message: string);
6
+ }
7
+ export declare function validateAdapterManifest(manifest: AdapterManifest): AdapterManifest;
8
+ export declare function validateCoverage(coverage: AdapterCoverage): AdapterCoverage;
9
+ export declare function finalizeExtraction(input: Omit<AdapterExtractionResult, 'outputHash'>): AdapterExtractionResult;
10
+ export declare function finalizeDiff(input: Omit<AdapterDiffResult, 'outputHash'>): AdapterDiffResult;
11
+ export declare function assertComparableExtractions(manifest: AdapterManifest, base: AdapterExtractionResult, head: AdapterExtractionResult, expectedConfigRevision?: AdapterExtractionResult['configRevision']): void;
12
+ export declare function canonicalAdapterJson(value: unknown): string;
13
+ export declare function validateConfigRevision(value: string): ReturnType<typeof configRevision>;
14
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,cAAc,EAKf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EAIrB,MAAM,YAAY,CAAC;AAKpB,qBAAa,sBAAuB,SAAQ,KAAK;aAE7B,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM,EAC5B,OAAO,EAAE,MAAM;CAKlB;AAWD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,eAAe,GAAG,eAAe,CAyElF;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,eAAe,CA4B3E;AAkID,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,IAAI,CAAC,uBAAuB,EAAE,YAAY,CAAC,GACjD,uBAAuB,CA0CzB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC,GAAG,iBAAiB,CAoB5F;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,eAAe,EACzB,IAAI,EAAE,uBAAuB,EAC7B,IAAI,EAAE,uBAAuB,EAC7B,sBAAsB,CAAC,EAAE,uBAAuB,CAAC,gBAAgB,CAAC,GACjE,IAAI,CAeN;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE3D;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAEvF"}
@@ -0,0 +1,198 @@
1
+ import { adapterId, canonicalJson, configRevision, contentHash, hashCanonical, repoPath, } from '@yanib/reverb-domain';
2
+ import { ACTIVATION_TIMINGS, CAPABILITY_TIERS, COMPATIBILITY_RESULTS, CONTRACT_KINDS, } from './types.js';
3
+ const SEMVER = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?$/;
4
+ const TOKEN = /^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/;
5
+ export class AdapterValidationError extends Error {
6
+ code;
7
+ constructor(code, message) {
8
+ super(message);
9
+ this.code = code;
10
+ this.name = 'AdapterValidationError';
11
+ }
12
+ }
13
+ function requireCondition(condition, code, message) {
14
+ if (!condition)
15
+ throw new AdapterValidationError(code, message);
16
+ }
17
+ function boundedText(value, name, maximum = 256) {
18
+ requireCondition(value.trim().length > 0, 'invalid_manifest', `${name} cannot be empty.`);
19
+ requireCondition(value.length <= maximum, 'invalid_manifest', `${name} exceeds its limit.`);
20
+ }
21
+ export function validateAdapterManifest(manifest) {
22
+ requireCondition(manifest.schema === 'reverb.adapter-manifest' && manifest.schemaVersion === '1.0', 'unsupported_manifest_schema', 'Adapter manifest schema is unsupported.');
23
+ adapterId(manifest.id);
24
+ requireCondition(SEMVER.test(manifest.version), 'invalid_manifest', 'Version must be SemVer.');
25
+ requireCondition(Number.isSafeInteger(manifest.identityVersion) && manifest.identityVersion > 0, 'invalid_manifest', 'Identity version must be positive.');
26
+ requireCondition(manifest.contractKinds.length > 0, 'invalid_manifest', 'Kinds are required.');
27
+ requireCondition(new Set(manifest.contractKinds).size === manifest.contractKinds.length &&
28
+ manifest.contractKinds.every((kind) => CONTRACT_KINDS.includes(kind)), 'invalid_manifest', 'Contract kinds must be unique and closed.');
29
+ requireCondition(manifest.capabilityTiers.length > 0 &&
30
+ manifest.capabilityTiers.every((entry) => entry.input.length > 0 && CAPABILITY_TIERS.includes(entry.tier)), 'invalid_manifest', 'Capability tiers are invalid.');
31
+ const strata = new Set();
32
+ for (const stratum of manifest.evidenceStrata) {
33
+ requireCondition(TOKEN.test(stratum.id), 'invalid_manifest', 'Stratum ID is invalid.');
34
+ requireCondition(!strata.has(stratum.id), 'invalid_manifest', 'Stratum ID is duplicated.');
35
+ requireCondition(stratum.promotionState === 'UNMEASURED', 'invalid_manifest', 'New adapter strata must be unmeasured.');
36
+ requireCondition(stratum.requiredEvidence.length > 0, 'invalid_manifest', 'Strata require evidence declarations.');
37
+ strata.add(stratum.id);
38
+ }
39
+ requireCondition(strata.size > 0, 'invalid_manifest', 'At least one evidence stratum is required.');
40
+ const tools = new Set();
41
+ for (const tool of manifest.externalTools) {
42
+ boundedText(tool.id, 'Tool ID');
43
+ boundedText(tool.version, 'Tool version');
44
+ contentHash(tool.digest);
45
+ boundedText(tool.license, 'Tool license');
46
+ requireCondition(tool.network === false, 'invalid_manifest', 'External tools must deny network.');
47
+ requireCondition(!tools.has(tool.id), 'invalid_manifest', 'External tool is duplicated.');
48
+ tools.add(tool.id);
49
+ }
50
+ for (const limitation of manifest.limitations)
51
+ boundedText(limitation, 'Limitation', 512);
52
+ boundedText(manifest.maintainer, 'Maintainer');
53
+ for (const [name, value] of Object.entries(manifest.resourceBudget)) {
54
+ requireCondition(Number.isSafeInteger(value) && value > 0, 'invalid_manifest', `${name} must be positive.`);
55
+ }
56
+ return manifest;
57
+ }
58
+ export function validateCoverage(coverage) {
59
+ for (const value of [
60
+ coverage.eligibleArtifacts,
61
+ coverage.processedArtifacts,
62
+ coverage.skippedArtifacts,
63
+ coverage.failedArtifacts,
64
+ ]) {
65
+ requireCondition(Number.isSafeInteger(value) && value >= 0, 'invalid_coverage', 'Coverage counts must be non-negative integers.');
66
+ }
67
+ requireCondition(coverage.processedArtifacts + coverage.skippedArtifacts + coverage.failedArtifacts <=
68
+ coverage.eligibleArtifacts, 'invalid_coverage', 'Coverage accounting exceeds eligible artifacts.');
69
+ if (coverage.state === 'complete') {
70
+ requireCondition(coverage.failedArtifacts === 0 &&
71
+ coverage.processedArtifacts + coverage.skippedArtifacts === coverage.eligibleArtifacts, 'invalid_coverage', 'Complete coverage must account for every artifact.');
72
+ }
73
+ return coverage;
74
+ }
75
+ function validateDiagnostic(diagnostic) {
76
+ requireCondition(diagnostic.safeMessage.length > 0 && diagnostic.safeMessage.length <= 256, 'invalid_diagnostic', 'Diagnostic text must be bounded.');
77
+ if (diagnostic.scope)
78
+ repoPath(diagnostic.scope);
79
+ if (diagnostic.detailHash)
80
+ contentHash(diagnostic.detailHash);
81
+ }
82
+ function validateRange(range) {
83
+ if (range === undefined)
84
+ return;
85
+ for (const value of [range.startLine, range.startColumn, range.endLine, range.endColumn]) {
86
+ requireCondition(Number.isSafeInteger(value) && value > 0, 'invalid_output', 'Source ranges must contain positive integers.');
87
+ }
88
+ requireCondition(range.endLine > range.startLine ||
89
+ (range.endLine === range.startLine && range.endColumn >= range.startColumn), 'invalid_output', 'Source range end precedes its start.');
90
+ }
91
+ function validateContractKey(value) {
92
+ requireCondition(value.length > 0 && value.length <= 2048 && !value.includes('\0'), 'invalid_output', 'Canonical contract key is not bounded.');
93
+ }
94
+ function validateDefinition(value) {
95
+ requireCondition(CONTRACT_KINDS.includes(value.contractKind), 'invalid_output', 'Contract kind is invalid.');
96
+ validateContractKey(value.canonicalKey);
97
+ boundedText(value.displayName, 'Definition display name', 512);
98
+ repoPath(value.path);
99
+ validateRange(value.range);
100
+ contentHash(value.contentHash);
101
+ contentHash(value.shapeHash);
102
+ requireCondition(value.shapeHash === contentHash(hashCanonical(value.shape)), 'invalid_output', 'Definition shape hash does not match its shape.');
103
+ boundedText(value.evidenceStratum, 'Evidence stratum', 128);
104
+ }
105
+ function validateReference(value) {
106
+ requireCondition(CONTRACT_KINDS.includes(value.contractKind), 'invalid_output', 'Contract kind is invalid.');
107
+ const resolved = value.canonicalKey !== undefined;
108
+ const unresolved = value.unresolvedPattern !== undefined && value.unresolvedReason !== undefined;
109
+ requireCondition(resolved !== unresolved, 'invalid_output', 'Reference must be exactly resolved or unresolved.');
110
+ if (value.canonicalKey !== undefined)
111
+ validateContractKey(value.canonicalKey);
112
+ if (value.unresolvedPattern !== undefined)
113
+ boundedText(value.unresolvedPattern, 'Unresolved pattern', 2048);
114
+ if (value.unresolvedReason !== undefined)
115
+ boundedText(value.unresolvedReason, 'Unresolved reason', 256);
116
+ repoPath(value.path);
117
+ validateRange(value.range);
118
+ contentHash(value.contentHash);
119
+ requireCondition(ACTIVATION_TIMINGS.includes(value.activation), 'invalid_output', 'Activation is invalid.');
120
+ boundedText(value.evidenceStratum, 'Evidence stratum', 128);
121
+ }
122
+ function validateChange(value) {
123
+ requireCondition(CONTRACT_KINDS.includes(value.contractKind), 'invalid_output', 'Contract kind is invalid.');
124
+ validateContractKey(value.canonicalKey);
125
+ boundedText(value.changeKind, 'Change kind', 128);
126
+ requireCondition(COMPATIBILITY_RESULTS.includes(value.compatibility), 'invalid_output', 'Compatibility result is invalid.');
127
+ requireCondition(ACTIVATION_TIMINGS.includes(value.activation), 'invalid_output', 'Activation is invalid.');
128
+ if (value.baseShapeHash)
129
+ contentHash(value.baseShapeHash);
130
+ if (value.headShapeHash)
131
+ contentHash(value.headShapeHash);
132
+ value.coverageDependencies.forEach((dependency) => boundedText(dependency, 'Coverage dependency', 256));
133
+ boundedText(value.remedy.kind, 'Remedy kind', 128);
134
+ boundedText(value.remedy.text, 'Remedy text', 1024);
135
+ boundedText(value.differ.toolId, 'Differ tool ID');
136
+ boundedText(value.differ.toolVersion, 'Differ tool version');
137
+ contentHash(value.differ.toolDigest);
138
+ boundedText(value.differ.toolLicense, 'Differ tool license');
139
+ boundedText(value.differ.category, 'Differ category');
140
+ }
141
+ function definitionSortKey(value) {
142
+ return `${value.contractKind}\u0000${value.canonicalKey}\u0000${value.path}`;
143
+ }
144
+ function referenceSortKey(value) {
145
+ return `${value.contractKind}\u0000${value.canonicalKey ?? value.unresolvedPattern ?? ''}\u0000${value.path}`;
146
+ }
147
+ function changeSortKey(value) {
148
+ return `${value.contractKind}\u0000${value.canonicalKey}\u0000${value.changeKind}`;
149
+ }
150
+ export function finalizeExtraction(input) {
151
+ validateCoverage(input.coverage);
152
+ input.diagnostics.forEach(validateDiagnostic);
153
+ adapterId(input.adapterId);
154
+ requireCondition(SEMVER.test(input.adapterVersion), 'invalid_output', 'Adapter output version is invalid.');
155
+ requireCondition(Number.isSafeInteger(input.identityVersion) && input.identityVersion > 0, 'invalid_output', 'Identity version is invalid.');
156
+ configRevision(input.configRevision);
157
+ contentHash(input.sourceFingerprint);
158
+ input.definitions.forEach(validateDefinition);
159
+ input.references.forEach(validateReference);
160
+ const definitions = [...input.definitions].sort((left, right) => definitionSortKey(left).localeCompare(definitionSortKey(right)));
161
+ const references = [...input.references].sort((left, right) => referenceSortKey(left).localeCompare(referenceSortKey(right)));
162
+ const identity = `${input.adapterId}@${input.adapterVersion}#${input.identityVersion}`;
163
+ for (const item of [...definitions, ...references]) {
164
+ requireCondition(`${item.extractorId}@${item.extractorVersion}#${item.identityVersion}` === identity, 'incompatible_output_version', 'Adapter output version stamps do not match its result.');
165
+ requireCondition(item.configRevision === input.configRevision, 'incompatible_output_version', 'Adapter output config revision does not match its result.');
166
+ }
167
+ const withoutHash = { ...input, definitions, references };
168
+ return {
169
+ ...withoutHash,
170
+ outputHash: contentHash(hashCanonical(withoutHash)),
171
+ };
172
+ }
173
+ export function finalizeDiff(input) {
174
+ validateCoverage(input.coverage);
175
+ input.diagnostics.forEach(validateDiagnostic);
176
+ adapterId(input.adapterId);
177
+ requireCondition(SEMVER.test(input.adapterVersion), 'invalid_output', 'Adapter output version is invalid.');
178
+ requireCondition(Number.isSafeInteger(input.identityVersion) && input.identityVersion > 0, 'invalid_output', 'Identity version is invalid.');
179
+ input.changes.forEach(validateChange);
180
+ const changes = [...input.changes].sort((left, right) => changeSortKey(left).localeCompare(changeSortKey(right)));
181
+ const withoutHash = { ...input, changes };
182
+ return { ...withoutHash, outputHash: contentHash(hashCanonical(withoutHash)) };
183
+ }
184
+ export function assertComparableExtractions(manifest, base, head, expectedConfigRevision) {
185
+ const expected = `${manifest.id}@${manifest.version}#${manifest.identityVersion}`;
186
+ for (const result of [base, head]) {
187
+ requireCondition(`${result.adapterId}@${result.adapterVersion}#${result.identityVersion}` === expected, 'incompatible_extraction', 'Extraction was produced by an incompatible adapter or identity version.');
188
+ }
189
+ requireCondition(base.configRevision === head.configRevision &&
190
+ (expectedConfigRevision === undefined || base.configRevision === expectedConfigRevision), 'incompatible_extraction', 'Extraction config revisions are incompatible.');
191
+ }
192
+ export function canonicalAdapterJson(value) {
193
+ return canonicalJson(value);
194
+ }
195
+ export function validateConfigRevision(value) {
196
+ return configRevision(value);
197
+ }
198
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,aAAa,EACb,cAAc,EACd,WAAW,EACX,aAAa,EACb,QAAQ,GAET,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,GAQf,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,GAAG,sEAAsE,CAAC;AACtF,MAAM,KAAK,GAAG,qCAAqC,CAAC;AA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;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,KAAa;IAClD,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@yanib/reverb-adapter-sdk",
3
+ "version": "0.1.0",
4
+ "description": "Contract adapter interfaces and validation for Reverb",
5
+ "type": "module",
6
+ "license": "Apache-2.0",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/YanibHQ/reverb-impact.git",
10
+ "directory": "packages/adapter-sdk"
11
+ },
12
+ "homepage": "https://github.com/YanibHQ/reverb-impact#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/YanibHQ/reverb-impact/issues"
15
+ },
16
+ "engines": {
17
+ "node": ">=24 <26"
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "main": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "default": "./dist/index.js"
28
+ }
29
+ },
30
+ "dependencies": {
31
+ "@yanib/reverb-domain": "0.1.0",
32
+ "@yanib/reverb-schema": "0.1.0"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public",
36
+ "provenance": true
37
+ },
38
+ "scripts": {
39
+ "build": "tsc -b"
40
+ }
41
+ }