@getvda/distribution 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 +202 -0
- package/NOTICE +30 -0
- package/README.md +32 -0
- package/dist/distributor.d.ts +44 -0
- package/dist/distributor.d.ts.map +1 -0
- package/dist/distributor.js +82 -0
- package/dist/distributor.js.map +1 -0
- package/dist/http-source.d.ts +28 -0
- package/dist/http-source.d.ts.map +1 -0
- package/dist/http-source.js +35 -0
- package/dist/http-source.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/store.d.ts +40 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +44 -0
- package/dist/store.js.map +1 -0
- package/package.json +34 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Verified Digital Agents (VDA) — Agent Control Plane
|
|
2
|
+
Copyright 2026 getvda.ai
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use these files except in compliance with the License. A copy of the
|
|
6
|
+
License is in the LICENSE file at the repository root and at:
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
11
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
12
|
+
CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
What these packages do and do NOT carry
|
|
17
|
+
----------------------------------------
|
|
18
|
+
|
|
19
|
+
The @getvda/* packages VERIFY and ENFORCE governance. They do not carry the
|
|
20
|
+
trust anchors that governance rests on:
|
|
21
|
+
|
|
22
|
+
- Bundle-signing keys (#key-3) live only in getvda's Secret Manager. These
|
|
23
|
+
packages VERIFY a bundle's signature against the public key resolved from
|
|
24
|
+
did:web:acp.getvda.ai; they cannot mint a bundle that verifies.
|
|
25
|
+
- Witness account credentials are the customer's own (customer-managed
|
|
26
|
+
custody). These packages SEAL to a Witness account the caller supplies;
|
|
27
|
+
they carry no standing credential.
|
|
28
|
+
|
|
29
|
+
The code is open. The trust anchors are not in the code — and giving away the
|
|
30
|
+
verifier does not give away the ability to forge what it verifies.
|
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @getvda/distribution
|
|
2
|
+
|
|
3
|
+
> **Status: pre-1.0 (0.x).** Public API may change between minor versions —
|
|
4
|
+
> pin an exact version if you need stability. Part of the [getvda.ai](https://getvda.ai)
|
|
5
|
+
> governance suite. Honesty discipline: nothing documented here is live unless it
|
|
6
|
+
> says so, boundaries (fail-static, condition-assertion) are stated where they apply,
|
|
7
|
+
> and a stub is labelled a stub.
|
|
8
|
+
|
|
9
|
+
> **What this carries — and what it does not.** This package *verifies and
|
|
10
|
+
> enforces* governance. The trust anchors are not in it: bundle-signing keys
|
|
11
|
+
> (`#key-3`) live only in getvda's Secret Manager, and Witness account
|
|
12
|
+
> credentials are the caller's own (customer-managed custody). It verifies a
|
|
13
|
+
> signature against the public key resolved from `did:web:acp.getvda.ai` and
|
|
14
|
+
> seals to a Witness account you supply — it cannot mint a bundle that verifies,
|
|
15
|
+
> and carries no standing credential. Open code, trust anchors elsewhere.
|
|
16
|
+
|
|
17
|
+
Pull-based, infrastructure-agnostic bundle distribution (Phase 5b/5c).
|
|
18
|
+
|
|
19
|
+
- **`BundleSource`** (agent read) / **`BundleStore`** (publisher). `HttpBundleSource`
|
|
20
|
+
GETs the active bundle over plain HTTPS (`{base}/{env}/active.json`); the
|
|
21
|
+
production store is a thin adapter over object storage behind
|
|
22
|
+
`acp.getvda.ai/bundles` — nothing is GCS-specific. `InMemoryBundleStore` runs the
|
|
23
|
+
loop with no network. **Agents never `git pull`; ACP builds no per-runtime
|
|
24
|
+
integration.**
|
|
25
|
+
- **`Distributor.activate(bundle)`** (5c) publishes + moves the active pointer +
|
|
26
|
+
**seals a Witness attestation** whose claim, `governing_basis`, and evidence
|
|
27
|
+
reference the **git commit hash** and bundle contentHash. This is the runtime
|
|
28
|
+
document↔event tie: git proves authoring, the attestation proves which version
|
|
29
|
+
was in force from time T, externally anchored.
|
|
30
|
+
- **`Distributor.rollback(env, version)`** re-activates a previously-published
|
|
31
|
+
version — also sealed. Rollback = publish/activate the previous version; the path
|
|
32
|
+
is tested.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Distributor (5c) — publish + activate, with activation SEALED to Witness.
|
|
3
|
+
*
|
|
4
|
+
* Activating a governance version seals a Witness ATTESTATION whose claim + basis
|
|
5
|
+
* reference the git commit hash. THIS is the document↔event tie for runtime:
|
|
6
|
+
* git proves who authored the version; the attestation proves which version was
|
|
7
|
+
* in force from time T, externally anchored. Rollback is just activating a
|
|
8
|
+
* previously-published version — and it too is sealed.
|
|
9
|
+
*/
|
|
10
|
+
import type { SealedRecord, WitnessClient } from '@getvda/witness';
|
|
11
|
+
import type { SignedBundle } from '@getvda/bundle';
|
|
12
|
+
import type { BundleStore } from './store.js';
|
|
13
|
+
export interface DistributorConfig {
|
|
14
|
+
readonly store: BundleStore;
|
|
15
|
+
readonly witness: WitnessClient;
|
|
16
|
+
/** ACP's DID, used as the attestation actor id. */
|
|
17
|
+
readonly did?: string;
|
|
18
|
+
readonly now?: () => string;
|
|
19
|
+
}
|
|
20
|
+
export interface ActivationResult {
|
|
21
|
+
readonly environment: string;
|
|
22
|
+
readonly version: string;
|
|
23
|
+
readonly commitSha: string;
|
|
24
|
+
readonly sealed: SealedRecord;
|
|
25
|
+
readonly rolledBack: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare class Distributor {
|
|
28
|
+
private readonly store;
|
|
29
|
+
private readonly witness;
|
|
30
|
+
private readonly did;
|
|
31
|
+
private readonly now;
|
|
32
|
+
constructor(config: DistributorConfig);
|
|
33
|
+
/** Publish a bundle without activating it (e.g. staging). */
|
|
34
|
+
publish(bundle: SignedBundle): Promise<void>;
|
|
35
|
+
/** Publish (if needed), make active, and seal the activation attestation. */
|
|
36
|
+
activate(bundle: SignedBundle): Promise<ActivationResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Roll back to a previously-published version: re-activate it and seal a
|
|
39
|
+
* rollback attestation. The prior version must already be in the store.
|
|
40
|
+
*/
|
|
41
|
+
rollback(environment: string, toVersion: string): Promise<ActivationResult>;
|
|
42
|
+
private sealActivation;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=distributor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distributor.d.ts","sourceRoot":"","sources":["../src/distributor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,mDAAmD;IACnD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IACxC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;gBAEvB,MAAM,EAAE,iBAAiB;IAOrC,6DAA6D;IACvD,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlD,6EAA6E;IACvE,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAa/D;;;OAGG;IACG,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;YAcnE,cAAc;CAyB7B"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Distributor (5c) — publish + activate, with activation SEALED to Witness.
|
|
3
|
+
*
|
|
4
|
+
* Activating a governance version seals a Witness ATTESTATION whose claim + basis
|
|
5
|
+
* reference the git commit hash. THIS is the document↔event tie for runtime:
|
|
6
|
+
* git proves who authored the version; the attestation proves which version was
|
|
7
|
+
* in force from time T, externally anchored. Rollback is just activating a
|
|
8
|
+
* previously-published version — and it too is sealed.
|
|
9
|
+
*/
|
|
10
|
+
export class Distributor {
|
|
11
|
+
store;
|
|
12
|
+
witness;
|
|
13
|
+
did;
|
|
14
|
+
now;
|
|
15
|
+
constructor(config) {
|
|
16
|
+
this.store = config.store;
|
|
17
|
+
this.witness = config.witness;
|
|
18
|
+
this.did = config.did ?? 'did:web:acp.getvda.ai';
|
|
19
|
+
this.now = config.now ?? (() => new Date().toISOString());
|
|
20
|
+
}
|
|
21
|
+
/** Publish a bundle without activating it (e.g. staging). */
|
|
22
|
+
async publish(bundle) {
|
|
23
|
+
await this.store.publish(bundle);
|
|
24
|
+
}
|
|
25
|
+
/** Publish (if needed), make active, and seal the activation attestation. */
|
|
26
|
+
async activate(bundle) {
|
|
27
|
+
await this.store.publish(bundle);
|
|
28
|
+
await this.store.setActive(bundle.manifest.environment, bundle.manifest.version);
|
|
29
|
+
const sealed = await this.sealActivation(bundle, false);
|
|
30
|
+
return {
|
|
31
|
+
environment: bundle.manifest.environment,
|
|
32
|
+
version: bundle.manifest.version,
|
|
33
|
+
commitSha: bundle.manifest.commitSha,
|
|
34
|
+
sealed,
|
|
35
|
+
rolledBack: false,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Roll back to a previously-published version: re-activate it and seal a
|
|
40
|
+
* rollback attestation. The prior version must already be in the store.
|
|
41
|
+
*/
|
|
42
|
+
async rollback(environment, toVersion) {
|
|
43
|
+
const bundle = await this.store.get(environment, toVersion);
|
|
44
|
+
if (!bundle)
|
|
45
|
+
throw new Error(`cannot roll back ${environment}@${toVersion}: not published`);
|
|
46
|
+
await this.store.setActive(environment, toVersion);
|
|
47
|
+
const sealed = await this.sealActivation(bundle, true);
|
|
48
|
+
return {
|
|
49
|
+
environment,
|
|
50
|
+
version: toVersion,
|
|
51
|
+
commitSha: bundle.manifest.commitSha,
|
|
52
|
+
sealed,
|
|
53
|
+
rolledBack: true,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
async sealActivation(bundle, rolledBack) {
|
|
57
|
+
const { environment, version, commitSha, contentHash } = bundle.manifest;
|
|
58
|
+
const verb = rolledBack ? 'rolled back' : 'activated';
|
|
59
|
+
return this.witness.sealAttestation({
|
|
60
|
+
actor: { id: this.did, type: 'system', role: 'acp-distributor' },
|
|
61
|
+
claim: `Governance version ${version} ${verb} for environment "${environment}" at git commit ${commitSha}`,
|
|
62
|
+
as_of: this.now(),
|
|
63
|
+
governing_basis: {
|
|
64
|
+
ref: `git:${commitSha}`,
|
|
65
|
+
text: `governance bundle ${version}`,
|
|
66
|
+
hash: contentHash,
|
|
67
|
+
},
|
|
68
|
+
evidence: [
|
|
69
|
+
{
|
|
70
|
+
ref: `git:${commitSha}`,
|
|
71
|
+
hash: contentHash,
|
|
72
|
+
media_type: 'application/vnd.acp.bundle+json',
|
|
73
|
+
description: `Signed governance bundle ${version} for ${environment}`,
|
|
74
|
+
captured_at: this.now(),
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
context: `${environment} bundle ${version}${rolledBack ? ' (rollback)' : ''}`,
|
|
78
|
+
decisionId: `activate:${environment}:${version}${rolledBack ? ':rollback' : ''}`,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=distributor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distributor.js","sourceRoot":"","sources":["../src/distributor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAsBH,MAAM,OAAO,WAAW;IACL,KAAK,CAAc;IACnB,OAAO,CAAgB;IACvB,GAAG,CAAS;IACZ,GAAG,CAAe;IAEnC,YAAY,MAAyB;QACnC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,IAAI,uBAAuB,CAAC;QACjD,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,6DAA6D;IAC7D,KAAK,C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
* No per-runtime integration: an agent GETs the active bundle from a plain HTTPS
|
|
5
|
+
* endpoint and verifies it locally. Layout:
|
|
6
|
+
* GET {base}/{environment}/active.json → the active SignedBundle
|
|
7
|
+
* GET {base}/{environment}/versions/{v}.json → a specific SignedBundle
|
|
8
|
+
*
|
|
9
|
+
* The production base is `https://acp.getvda.ai/bundles` (object storage behind
|
|
10
|
+
* the domain). This client does NOT verify signatures — that is the evaluator
|
|
11
|
+
* SDK's job after fetch, so verification and fetch stay separable.
|
|
12
|
+
*/
|
|
13
|
+
import type { SignedBundle } from '@getvda/bundle';
|
|
14
|
+
import type { BundleSource } from './store.js';
|
|
15
|
+
export interface HttpBundleSourceConfig {
|
|
16
|
+
/** e.g. https://acp.getvda.ai/bundles */
|
|
17
|
+
readonly baseUrl: string;
|
|
18
|
+
readonly fetch?: typeof fetch;
|
|
19
|
+
}
|
|
20
|
+
export declare class HttpBundleSource implements BundleSource {
|
|
21
|
+
private readonly base;
|
|
22
|
+
private readonly fetchImpl;
|
|
23
|
+
constructor(config: HttpBundleSourceConfig);
|
|
24
|
+
getActive(environment: string): Promise<SignedBundle | null>;
|
|
25
|
+
get(environment: string, version: string): Promise<SignedBundle | null>;
|
|
26
|
+
private fetchBundle;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=http-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-source.d.ts","sourceRoot":"","sources":["../src/http-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,WAAW,sBAAsB;IACrC,yCAAyC;IACzC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CAC/B;AAED,qBAAa,gBAAiB,YAAW,YAAY;IACnD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;gBAE7B,MAAM,EAAE,sBAAsB;IAKpC,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAI5D,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;YAM/D,WAAW;CAM1B"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HttpBundleSource — the agent-side, pull-based fetch over HTTPS.
|
|
3
|
+
*
|
|
4
|
+
* No per-runtime integration: an agent GETs the active bundle from a plain HTTPS
|
|
5
|
+
* endpoint and verifies it locally. Layout:
|
|
6
|
+
* GET {base}/{environment}/active.json → the active SignedBundle
|
|
7
|
+
* GET {base}/{environment}/versions/{v}.json → a specific SignedBundle
|
|
8
|
+
*
|
|
9
|
+
* The production base is `https://acp.getvda.ai/bundles` (object storage behind
|
|
10
|
+
* the domain). This client does NOT verify signatures — that is the evaluator
|
|
11
|
+
* SDK's job after fetch, so verification and fetch stay separable.
|
|
12
|
+
*/
|
|
13
|
+
export class HttpBundleSource {
|
|
14
|
+
base;
|
|
15
|
+
fetchImpl;
|
|
16
|
+
constructor(config) {
|
|
17
|
+
this.base = config.baseUrl.replace(/\/+$/, '');
|
|
18
|
+
this.fetchImpl = config.fetch ?? fetch;
|
|
19
|
+
}
|
|
20
|
+
async getActive(environment) {
|
|
21
|
+
return this.fetchBundle(`${this.base}/${encodeURIComponent(environment)}/active.json`);
|
|
22
|
+
}
|
|
23
|
+
async get(environment, version) {
|
|
24
|
+
return this.fetchBundle(`${this.base}/${encodeURIComponent(environment)}/versions/${encodeURIComponent(version)}.json`);
|
|
25
|
+
}
|
|
26
|
+
async fetchBundle(url) {
|
|
27
|
+
const res = await this.fetchImpl(url);
|
|
28
|
+
if (res.status === 404)
|
|
29
|
+
return null;
|
|
30
|
+
if (!res.ok)
|
|
31
|
+
throw new Error(`bundle fetch failed (${res.status}) at ${url}`);
|
|
32
|
+
return (await res.json());
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=http-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-source.js","sourceRoot":"","sources":["../src/http-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAWH,MAAM,OAAO,gBAAgB;IACV,IAAI,CAAS;IACb,SAAS,CAAe;IAEzC,YAAY,MAA8B;QACxC,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,KAAK,IAAI,KAAK,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,WAAmB;QACjC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,kBAAkB,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACzF,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,WAAmB,EAAE,OAAe;QAC5C,OAAO,IAAI,CAAC,WAAW,CACrB,GAAG,IAAI,CAAC,IAAI,IAAI,kBAAkB,CAAC,WAAW,CAAC,aAAa,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAC/F,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,WAAW,CAAC,GAAW;QACnC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;YAAE,OAAO,IAAI,CAAC;QACpC,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC,CAAC;QAC9E,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAiB,CAAC;IAC5C,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @getvda/distribution — pull-based, infrastructure-agnostic bundle distribution.
|
|
3
|
+
* Publish + activate (sealed to Witness); agents fetch over HTTPS; rollback =
|
|
4
|
+
* activate the previous version.
|
|
5
|
+
*/
|
|
6
|
+
export { InMemoryBundleStore, type BundleStore, type BundleSource } from './store.js';
|
|
7
|
+
export { HttpBundleSource, type HttpBundleSourceConfig } from './http-source.js';
|
|
8
|
+
export { Distributor, type DistributorConfig, type ActivationResult } from './distributor.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @getvda/distribution — pull-based, infrastructure-agnostic bundle distribution.
|
|
3
|
+
* Publish + activate (sealed to Witness); agents fetch over HTTPS; rollback =
|
|
4
|
+
* activate the previous version.
|
|
5
|
+
*/
|
|
6
|
+
export { InMemoryBundleStore } from './store.js';
|
|
7
|
+
export { HttpBundleSource } from './http-source.js';
|
|
8
|
+
export { Distributor } from './distributor.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAuC,MAAM,YAAY,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAA+B,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,WAAW,EAAiD,MAAM,kBAAkB,CAAC"}
|
package/dist/store.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundle storage + the agent-read source.
|
|
3
|
+
*
|
|
4
|
+
* Two roles:
|
|
5
|
+
* - BundleSource (agent side) — read the active bundle, or a specific version.
|
|
6
|
+
* HttpBundleSource is the production shape (GET over HTTPS); InMemoryBundleStore
|
|
7
|
+
* also implements it for the loop.
|
|
8
|
+
* - BundleStore (publisher side) — publish a version + move the active pointer.
|
|
9
|
+
*
|
|
10
|
+
* Infrastructure-agnostic: the production store is a thin adapter over object
|
|
11
|
+
* storage served on HTTPS (GCS bucket behind acp.getvda.ai/bundles/...). Nothing
|
|
12
|
+
* here is GCS-specific; swap the store, keep everything above it.
|
|
13
|
+
*/
|
|
14
|
+
import type { SignedBundle } from '@getvda/bundle';
|
|
15
|
+
/** Agent-facing read surface. */
|
|
16
|
+
export interface BundleSource {
|
|
17
|
+
/** The currently active bundle for an environment, or null if none. */
|
|
18
|
+
getActive(environment: string): Promise<SignedBundle | null>;
|
|
19
|
+
/** A specific version, or null. */
|
|
20
|
+
get(environment: string, version: string): Promise<SignedBundle | null>;
|
|
21
|
+
}
|
|
22
|
+
/** Publisher-facing surface. */
|
|
23
|
+
export interface BundleStore extends BundleSource {
|
|
24
|
+
publish(bundle: SignedBundle): Promise<void>;
|
|
25
|
+
setActive(environment: string, version: string): Promise<void>;
|
|
26
|
+
listVersions(environment: string): Promise<readonly string[]>;
|
|
27
|
+
activeVersion(environment: string): Promise<string | null>;
|
|
28
|
+
}
|
|
29
|
+
/** In-memory store for tests + the reference loop (no network). */
|
|
30
|
+
export declare class InMemoryBundleStore implements BundleStore {
|
|
31
|
+
private byEnv;
|
|
32
|
+
private active;
|
|
33
|
+
publish(bundle: SignedBundle): Promise<void>;
|
|
34
|
+
setActive(environment: string, version: string): Promise<void>;
|
|
35
|
+
get(environment: string, version: string): Promise<SignedBundle | null>;
|
|
36
|
+
getActive(environment: string): Promise<SignedBundle | null>;
|
|
37
|
+
listVersions(environment: string): Promise<readonly string[]>;
|
|
38
|
+
activeVersion(environment: string): Promise<string | null>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,iCAAiC;AACjC,MAAM,WAAW,YAAY;IAC3B,uEAAuE;IACvE,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAC7D,mCAAmC;IACnC,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;CACzE;AAED,gCAAgC;AAChC,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/D,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;IAC9D,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC5D;AAED,mEAAmE;AACnE,qBAAa,mBAAoB,YAAW,WAAW;IACrD,OAAO,CAAC,KAAK,CAAgD;IAC7D,OAAO,CAAC,MAAM,CAA6B;IAErC,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAM5C,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO9D,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAIvE,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAK5D,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC;IAI7D,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAGjE"}
|
package/dist/store.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundle storage + the agent-read source.
|
|
3
|
+
*
|
|
4
|
+
* Two roles:
|
|
5
|
+
* - BundleSource (agent side) — read the active bundle, or a specific version.
|
|
6
|
+
* HttpBundleSource is the production shape (GET over HTTPS); InMemoryBundleStore
|
|
7
|
+
* also implements it for the loop.
|
|
8
|
+
* - BundleStore (publisher side) — publish a version + move the active pointer.
|
|
9
|
+
*
|
|
10
|
+
* Infrastructure-agnostic: the production store is a thin adapter over object
|
|
11
|
+
* storage served on HTTPS (GCS bucket behind acp.getvda.ai/bundles/...). Nothing
|
|
12
|
+
* here is GCS-specific; swap the store, keep everything above it.
|
|
13
|
+
*/
|
|
14
|
+
/** In-memory store for tests + the reference loop (no network). */
|
|
15
|
+
export class InMemoryBundleStore {
|
|
16
|
+
byEnv = new Map();
|
|
17
|
+
active = new Map();
|
|
18
|
+
async publish(bundle) {
|
|
19
|
+
const env = bundle.manifest.environment;
|
|
20
|
+
if (!this.byEnv.has(env))
|
|
21
|
+
this.byEnv.set(env, new Map());
|
|
22
|
+
this.byEnv.get(env).set(bundle.manifest.version, bundle);
|
|
23
|
+
}
|
|
24
|
+
async setActive(environment, version) {
|
|
25
|
+
if (!this.byEnv.get(environment)?.has(version)) {
|
|
26
|
+
throw new Error(`cannot activate ${environment}@${version}: not published`);
|
|
27
|
+
}
|
|
28
|
+
this.active.set(environment, version);
|
|
29
|
+
}
|
|
30
|
+
async get(environment, version) {
|
|
31
|
+
return this.byEnv.get(environment)?.get(version) ?? null;
|
|
32
|
+
}
|
|
33
|
+
async getActive(environment) {
|
|
34
|
+
const v = this.active.get(environment);
|
|
35
|
+
return v ? (this.byEnv.get(environment)?.get(v) ?? null) : null;
|
|
36
|
+
}
|
|
37
|
+
async listVersions(environment) {
|
|
38
|
+
return [...(this.byEnv.get(environment)?.keys() ?? [])];
|
|
39
|
+
}
|
|
40
|
+
async activeVersion(environment) {
|
|
41
|
+
return this.active.get(environment) ?? null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAoBH,mEAAmE;AACnE,MAAM,OAAO,mBAAmB;IACtB,KAAK,GAAG,IAAI,GAAG,EAAqC,CAAC;IACrD,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE3C,KAAK,CAAC,OAAO,CAAC,MAAoB;QAChC,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QACzD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC,GAAG,CAAC,MAAM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|
+
"name": "@getvda/distribution",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "Pull-based, infrastructure-agnostic bundle distribution. Publish + activate a signed bundle (activation sealed to Witness, referencing the commit hash); agents fetch over HTTPS. Rollback = activate the previous version.",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc --build",
|
|
11
|
+
"typecheck": "tsc --noEmit",
|
|
12
|
+
"test": "vitest run"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@getvda/bundle": "^0.1.0",
|
|
16
|
+
"@getvda/witness": "^0.1.0"
|
|
17
|
+
},
|
|
18
|
+
"license": "Apache-2.0",
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"NOTICE"
|
|
27
|
+
],
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+https://github.com/getvda-ai/acp-agent.git",
|
|
31
|
+
"directory": "packages/distribution"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://getvda.ai"
|
|
34
|
+
}
|