@getvda/evaluator-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 +202 -0
- package/NOTICE +30 -0
- package/README.md +61 -0
- package/dist/evaluate.d.ts +33 -0
- package/dist/evaluate.d.ts.map +1 -0
- package/dist/evaluate.js +55 -0
- package/dist/evaluate.js.map +1 -0
- package/dist/evaluator.d.ts +78 -0
- package/dist/evaluator.d.ts.map +1 -0
- package/dist/evaluator.js +139 -0
- package/dist/evaluator.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/package.json +36 -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,61 @@
|
|
|
1
|
+
# @getvda/evaluator-sdk
|
|
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
|
+
The **fleet-reuse artifact** (Phase 5d/5e) — the highest-reuse thing ACP ships.
|
|
18
|
+
A customer's agent team drops in a library, not a systems-integration project.
|
|
19
|
+
Framework-agnostic (no LangChain/CrewAI/AutoGen specifics).
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
const evaluator = new GovernanceEvaluator({
|
|
23
|
+
source: new HttpBundleSource({ baseUrl: 'https://acp.getvda.ai/bundles' }),
|
|
24
|
+
resolver: new DidWebKeyResolver(),
|
|
25
|
+
witness, // WitnessHttpClient (customer-managed custody)
|
|
26
|
+
environment: 'ref-env',
|
|
27
|
+
agentId: 'agent://my-agent',
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const outcome = await evaluator.evaluate({ capability: 'send_email', conditionsMet: true });
|
|
31
|
+
if (!outcome.allowed) refuse(outcome.reason);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## fetch → verify → cache → evaluate → seal
|
|
35
|
+
|
|
36
|
+
Each `evaluate` (and `refresh`): fetch the active bundle over HTTPS, **verify its
|
|
37
|
+
signature against `did:web:acp.getvda.ai`**, cache it locally, evaluate the
|
|
38
|
+
proposed action against the governance, and **seal the outcome as an
|
|
39
|
+
`agent_action`** to Witness — the sealed record references the bundle's version +
|
|
40
|
+
git commit hash, so "what governance was this agent running when it decided D" is
|
|
41
|
+
provable.
|
|
42
|
+
|
|
43
|
+
**The agent asserts its conditions.** ACP answers the structural question — is the
|
|
44
|
+
capability granted, and (if conditioned) has the agent asserted its conditions are
|
|
45
|
+
met? It surfaces the required conditions; the agent, which has the runtime context,
|
|
46
|
+
asserts compliance (and is accountable — the assertion is sealed). ACP does not
|
|
47
|
+
pretend to auto-evaluate free-text conditions.
|
|
48
|
+
|
|
49
|
+
## Fail-static (5e) — the availability-audit answer
|
|
50
|
+
|
|
51
|
+
If ACP's distribution endpoint is down, or a fetched bundle fails verification, the
|
|
52
|
+
evaluator keeps evaluating against the **last cached, verified** bundle
|
|
53
|
+
(stale-flagged) and picks up the new version when ACP returns.
|
|
54
|
+
|
|
55
|
+
- **Not fail-open** — an unverified/tampered bundle is never cached or evaluated.
|
|
56
|
+
- **Not fail-closed** — downtime does not stop a governed agent.
|
|
57
|
+
- The only hard stop is **cold start with no cache AND no reachable endpoint** — a
|
|
58
|
+
deploy gap (the agent was never governed), surfaced as `NoGovernanceError`, not
|
|
59
|
+
silently allowed.
|
|
60
|
+
|
|
61
|
+
Governance propagates slightly later under downtime; it never gaps.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Governance evaluation of a proposed action against a signed bundle.
|
|
3
|
+
*
|
|
4
|
+
* ACP evaluates the STRUCTURAL question it can answer from the governance
|
|
5
|
+
* documents: is this capability granted, and (if conditioned) has the agent
|
|
6
|
+
* asserted its conditions are met? The natural-language conditions themselves are
|
|
7
|
+
* the AGENT's to satisfy — it knows its runtime context — so the SDK surfaces the
|
|
8
|
+
* required conditions and lets the agent assert compliance, rather than pretending
|
|
9
|
+
* to evaluate free-text conditions it cannot.
|
|
10
|
+
*/
|
|
11
|
+
import type { SignedBundle } from '@getvda/bundle';
|
|
12
|
+
export interface ProposedAction {
|
|
13
|
+
/** The SKILL.md capability the agent wants to exercise. */
|
|
14
|
+
readonly capability: string;
|
|
15
|
+
/**
|
|
16
|
+
* The agent's assertion that it has satisfied the capability's conditions.
|
|
17
|
+
* The agent is accountable for this assertion (it is sealed). Omit/false when
|
|
18
|
+
* the agent cannot confirm the conditions.
|
|
19
|
+
*/
|
|
20
|
+
readonly conditionsMet?: boolean;
|
|
21
|
+
/** Arbitrary context, sealed as parameters (not hashed). */
|
|
22
|
+
readonly context?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export interface Decision {
|
|
25
|
+
readonly allowed: boolean;
|
|
26
|
+
readonly reason: string;
|
|
27
|
+
/** Governing clause references the decision rests on. */
|
|
28
|
+
readonly governingClauseRefs: readonly string[];
|
|
29
|
+
/** Conditions the agent must satisfy for a conditioned capability. */
|
|
30
|
+
readonly requiredConditions: readonly string[];
|
|
31
|
+
}
|
|
32
|
+
export declare function evaluateAction(bundle: SignedBundle, action: ProposedAction): Decision;
|
|
33
|
+
//# sourceMappingURL=evaluate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../src/evaluate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,WAAW,cAAc;IAC7B,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yDAAyD;IACzD,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,sEAAsE;IACtE,QAAQ,CAAC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;CAChD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,GAAG,QAAQ,CA+CrF"}
|
package/dist/evaluate.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Governance evaluation of a proposed action against a signed bundle.
|
|
3
|
+
*
|
|
4
|
+
* ACP evaluates the STRUCTURAL question it can answer from the governance
|
|
5
|
+
* documents: is this capability granted, and (if conditioned) has the agent
|
|
6
|
+
* asserted its conditions are met? The natural-language conditions themselves are
|
|
7
|
+
* the AGENT's to satisfy — it knows its runtime context — so the SDK surfaces the
|
|
8
|
+
* required conditions and lets the agent assert compliance, rather than pretending
|
|
9
|
+
* to evaluate free-text conditions it cannot.
|
|
10
|
+
*/
|
|
11
|
+
import { parseGovernanceFile } from '@getvda/governance-schema';
|
|
12
|
+
export function evaluateAction(bundle, action) {
|
|
13
|
+
const skillSource = bundle.files['SKILL.md'];
|
|
14
|
+
if (!skillSource) {
|
|
15
|
+
return {
|
|
16
|
+
allowed: false,
|
|
17
|
+
reason: 'no SKILL.md in the governance bundle; no capability is granted',
|
|
18
|
+
governingClauseRefs: ['bundle'],
|
|
19
|
+
requiredConditions: [],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const parsed = parseGovernanceFile('SKILL.md', skillSource);
|
|
23
|
+
const cap = parsed.capabilities.find((c) => c.capability === action.capability);
|
|
24
|
+
if (!cap) {
|
|
25
|
+
return {
|
|
26
|
+
allowed: false,
|
|
27
|
+
reason: `capability "${action.capability}" is not granted by SKILL.md`,
|
|
28
|
+
governingClauseRefs: ['SKILL.md'],
|
|
29
|
+
requiredConditions: [],
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
if (cap.conditions.length === 0) {
|
|
33
|
+
return {
|
|
34
|
+
allowed: true,
|
|
35
|
+
reason: `capability "${action.capability}" is granted unconditionally`,
|
|
36
|
+
governingClauseRefs: [`SKILL.md#${action.capability}`],
|
|
37
|
+
requiredConditions: [],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (action.conditionsMet === true) {
|
|
41
|
+
return {
|
|
42
|
+
allowed: true,
|
|
43
|
+
reason: `capability "${action.capability}" granted; agent asserted its conditions are met`,
|
|
44
|
+
governingClauseRefs: [`SKILL.md#${action.capability}`],
|
|
45
|
+
requiredConditions: cap.conditions,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
allowed: false,
|
|
50
|
+
reason: `capability "${action.capability}" is conditioned; agent has not asserted the conditions are met`,
|
|
51
|
+
governingClauseRefs: [`SKILL.md#${action.capability}`],
|
|
52
|
+
requiredConditions: cap.conditions,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=evaluate.js.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;YACL,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,eAAe,MAAM,CAAC,UAAU,kDAAkD;YAC1F,mBAAmB,EAAE,CAAC,YAAY,MAAM,CAAC,UAAU,EAAE,CAAC;YACtD,kBAAkB,EAAE,GAAG,CAAC,UAAU;SACnC,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,eAAe,MAAM,CAAC,UAAU,iEAAiE;QACzG,mBAAmB,EAAE,CAAC,YAAY,MAAM,CAAC,UAAU,EAAE,CAAC;QACtD,kBAAkB,EAAE,GAAG,CAAC,UAAU;KACnC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GovernanceEvaluator — the fleet-reuse artifact (5d).
|
|
3
|
+
*
|
|
4
|
+
* An agent embeds this and calls `evaluate(action)`. It:
|
|
5
|
+
* fetch (active bundle over HTTPS) → verify (signature against did:web) →
|
|
6
|
+
* cache (locally) → evaluate (the action against the governance) →
|
|
7
|
+
* seal (the outcome as an agent_action to Witness).
|
|
8
|
+
*
|
|
9
|
+
* FAIL-STATIC (5e): if ACP's distribution endpoint is unreachable OR a fetched
|
|
10
|
+
* bundle fails verification, the evaluator keeps evaluating against the last
|
|
11
|
+
* cached, verified bundle and picks up the new version when ACP returns.
|
|
12
|
+
* - NOT fail-open: it never evaluates against an unverified/tampered bundle.
|
|
13
|
+
* - NOT fail-closed: downtime does not stop a governed agent.
|
|
14
|
+
* - The ONLY hard stop is cold-start with no cache AND no reachable endpoint —
|
|
15
|
+
* that is a deployment gap (the agent was never governed), surfaced as an
|
|
16
|
+
* error, not silently allowed.
|
|
17
|
+
* Governance propagates slightly later under downtime; it never gaps.
|
|
18
|
+
*
|
|
19
|
+
* Framework-agnostic: no LangChain/CrewAI/AutoGen specifics.
|
|
20
|
+
*/
|
|
21
|
+
import type { KeyResolver, SignedBundle } from '@getvda/bundle';
|
|
22
|
+
import type { BundleSource } from '@getvda/distribution';
|
|
23
|
+
import type { SealedRecord, WitnessClient } from '@getvda/witness';
|
|
24
|
+
import { type Decision, type ProposedAction } from './evaluate.js';
|
|
25
|
+
export declare class NoGovernanceError extends Error {
|
|
26
|
+
constructor(message: string);
|
|
27
|
+
}
|
|
28
|
+
export declare class BundleVerificationError extends Error {
|
|
29
|
+
readonly reasons: readonly string[];
|
|
30
|
+
constructor(reasons: readonly string[]);
|
|
31
|
+
}
|
|
32
|
+
export interface RefreshResult {
|
|
33
|
+
/** True if the cached bundle changed to a new version. */
|
|
34
|
+
readonly updated: boolean;
|
|
35
|
+
/** True if serving a cached bundle because refresh could not complete. */
|
|
36
|
+
readonly stale: boolean;
|
|
37
|
+
readonly usingVersion?: string;
|
|
38
|
+
readonly reason?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface EvaluationOutcome extends Decision {
|
|
41
|
+
readonly bundleVersion: string;
|
|
42
|
+
readonly commitSha: string;
|
|
43
|
+
readonly stale: boolean;
|
|
44
|
+
readonly sealedRecordId: string;
|
|
45
|
+
readonly sealed: SealedRecord;
|
|
46
|
+
}
|
|
47
|
+
export interface EvaluatorConfig {
|
|
48
|
+
readonly source: BundleSource;
|
|
49
|
+
readonly resolver: KeyResolver;
|
|
50
|
+
readonly witness: WitnessClient;
|
|
51
|
+
readonly environment: string;
|
|
52
|
+
/** The agent's id, sealed as the actor of each agent_action. */
|
|
53
|
+
readonly agentId: string;
|
|
54
|
+
/** Optional persistent cache seam (default: in-memory only). */
|
|
55
|
+
readonly initialCache?: SignedBundle;
|
|
56
|
+
readonly now?: () => string;
|
|
57
|
+
}
|
|
58
|
+
export declare class GovernanceEvaluator {
|
|
59
|
+
private readonly config;
|
|
60
|
+
private cached;
|
|
61
|
+
private lastStale;
|
|
62
|
+
private readonly now;
|
|
63
|
+
constructor(config: EvaluatorConfig);
|
|
64
|
+
getCachedVersion(): string | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Fetch the active bundle, verify it, and cache it. Fail-static: on a fetch
|
|
67
|
+
* failure or a missing active bundle, keep the cache (if any). NEVER caches an
|
|
68
|
+
* unverified bundle.
|
|
69
|
+
*/
|
|
70
|
+
refresh(): Promise<RefreshResult>;
|
|
71
|
+
/**
|
|
72
|
+
* Evaluate a proposed action against the governance and seal the outcome.
|
|
73
|
+
* Uses the cached bundle; on cold start (no cache) it refreshes first.
|
|
74
|
+
*/
|
|
75
|
+
evaluate(action: ProposedAction): Promise<EvaluationOutcome>;
|
|
76
|
+
private sealOutcome;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=evaluator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../src/evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAkB,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAEnF,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI5B;AACD,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;gBACxB,OAAO,EAAE,SAAS,MAAM,EAAE;CAKvC;AAED,MAAM,WAAW,aAAa;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAkB,SAAQ,QAAQ;IACjD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;CAC/B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,gEAAgE;IAChE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IACrC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CAC7B;AAED,qBAAa,mBAAmB;IAKlB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJnC,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;gBAEN,MAAM,EAAE,eAAe;IAKpD,gBAAgB,IAAI,MAAM,GAAG,SAAS;IAItC;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC;IA2CvC;;;OAGG;IACG,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC;YAiBpD,WAAW;CAgC1B"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GovernanceEvaluator — the fleet-reuse artifact (5d).
|
|
3
|
+
*
|
|
4
|
+
* An agent embeds this and calls `evaluate(action)`. It:
|
|
5
|
+
* fetch (active bundle over HTTPS) → verify (signature against did:web) →
|
|
6
|
+
* cache (locally) → evaluate (the action against the governance) →
|
|
7
|
+
* seal (the outcome as an agent_action to Witness).
|
|
8
|
+
*
|
|
9
|
+
* FAIL-STATIC (5e): if ACP's distribution endpoint is unreachable OR a fetched
|
|
10
|
+
* bundle fails verification, the evaluator keeps evaluating against the last
|
|
11
|
+
* cached, verified bundle and picks up the new version when ACP returns.
|
|
12
|
+
* - NOT fail-open: it never evaluates against an unverified/tampered bundle.
|
|
13
|
+
* - NOT fail-closed: downtime does not stop a governed agent.
|
|
14
|
+
* - The ONLY hard stop is cold-start with no cache AND no reachable endpoint —
|
|
15
|
+
* that is a deployment gap (the agent was never governed), surfaced as an
|
|
16
|
+
* error, not silently allowed.
|
|
17
|
+
* Governance propagates slightly later under downtime; it never gaps.
|
|
18
|
+
*
|
|
19
|
+
* Framework-agnostic: no LangChain/CrewAI/AutoGen specifics.
|
|
20
|
+
*/
|
|
21
|
+
import { verifyBundle } from '@getvda/bundle';
|
|
22
|
+
import { evaluateAction } from './evaluate.js';
|
|
23
|
+
export class NoGovernanceError extends Error {
|
|
24
|
+
constructor(message) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.name = 'NoGovernanceError';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export class BundleVerificationError extends Error {
|
|
30
|
+
reasons;
|
|
31
|
+
constructor(reasons) {
|
|
32
|
+
super(`fetched bundle failed verification: ${reasons.join('; ')}`);
|
|
33
|
+
this.name = 'BundleVerificationError';
|
|
34
|
+
this.reasons = reasons;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class GovernanceEvaluator {
|
|
38
|
+
config;
|
|
39
|
+
cached;
|
|
40
|
+
lastStale = false;
|
|
41
|
+
now;
|
|
42
|
+
constructor(config) {
|
|
43
|
+
this.config = config;
|
|
44
|
+
this.cached = config.initialCache;
|
|
45
|
+
this.now = config.now ?? (() => new Date().toISOString());
|
|
46
|
+
}
|
|
47
|
+
getCachedVersion() {
|
|
48
|
+
return this.cached?.manifest.version;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Fetch the active bundle, verify it, and cache it. Fail-static: on a fetch
|
|
52
|
+
* failure or a missing active bundle, keep the cache (if any). NEVER caches an
|
|
53
|
+
* unverified bundle.
|
|
54
|
+
*/
|
|
55
|
+
async refresh() {
|
|
56
|
+
let fetched;
|
|
57
|
+
try {
|
|
58
|
+
fetched = await this.config.source.getActive(this.config.environment);
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
if (this.cached) {
|
|
62
|
+
this.lastStale = true;
|
|
63
|
+
return staleResult(this.cached, `distribution unreachable (${err.message}); using cache`);
|
|
64
|
+
}
|
|
65
|
+
throw new NoGovernanceError(`distribution unreachable and no cached governance bundle for "${this.config.environment}"`);
|
|
66
|
+
}
|
|
67
|
+
if (!fetched) {
|
|
68
|
+
if (this.cached) {
|
|
69
|
+
this.lastStale = true;
|
|
70
|
+
return staleResult(this.cached, 'no active bundle published; using cache');
|
|
71
|
+
}
|
|
72
|
+
throw new NoGovernanceError(`no active governance bundle for "${this.config.environment}"`);
|
|
73
|
+
}
|
|
74
|
+
const verification = await verifyBundle(fetched, this.config.resolver);
|
|
75
|
+
if (!verification.valid) {
|
|
76
|
+
if (this.cached) {
|
|
77
|
+
this.lastStale = true;
|
|
78
|
+
return staleResult(this.cached, `fetched bundle failed verification; kept cache: ${verification.reasons.join('; ')}`);
|
|
79
|
+
}
|
|
80
|
+
throw new BundleVerificationError(verification.reasons);
|
|
81
|
+
}
|
|
82
|
+
const changed = this.cached?.manifest.version !== fetched.manifest.version;
|
|
83
|
+
this.cached = fetched;
|
|
84
|
+
this.lastStale = false;
|
|
85
|
+
return { updated: changed, stale: false, usingVersion: fetched.manifest.version };
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Evaluate a proposed action against the governance and seal the outcome.
|
|
89
|
+
* Uses the cached bundle; on cold start (no cache) it refreshes first.
|
|
90
|
+
*/
|
|
91
|
+
async evaluate(action) {
|
|
92
|
+
if (!this.cached) {
|
|
93
|
+
await this.refresh(); // cold start must obtain governance (throws if it can't)
|
|
94
|
+
}
|
|
95
|
+
const bundle = this.cached;
|
|
96
|
+
const decision = evaluateAction(bundle, action);
|
|
97
|
+
const sealed = await this.sealOutcome(action, decision, bundle);
|
|
98
|
+
return {
|
|
99
|
+
...decision,
|
|
100
|
+
bundleVersion: bundle.manifest.version,
|
|
101
|
+
commitSha: bundle.manifest.commitSha,
|
|
102
|
+
stale: this.lastStale,
|
|
103
|
+
sealedRecordId: sealed.record.recordId,
|
|
104
|
+
sealed,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
async sealOutcome(action, decision, bundle) {
|
|
108
|
+
return this.config.witness.sealAgentAction({
|
|
109
|
+
actor: { id: this.config.agentId, type: 'agent', role: this.config.environment },
|
|
110
|
+
action: {
|
|
111
|
+
statement: `evaluated capability "${action.capability}"`,
|
|
112
|
+
outcome: decision.allowed ? 'permitted' : 'denied',
|
|
113
|
+
rationale: decision.reason,
|
|
114
|
+
},
|
|
115
|
+
// The governing rule IS the bundle in force — tied to the git commit + hash.
|
|
116
|
+
governing_rule: {
|
|
117
|
+
ref: `bundle:${bundle.manifest.environment}@${bundle.manifest.version}`,
|
|
118
|
+
text: `governance version ${bundle.manifest.version} (commit ${bundle.manifest.commitSha})`,
|
|
119
|
+
hash: bundle.manifest.contentHash,
|
|
120
|
+
},
|
|
121
|
+
evidence: [
|
|
122
|
+
{
|
|
123
|
+
ref: `git:${bundle.manifest.commitSha}`,
|
|
124
|
+
hash: bundle.manifest.contentHash,
|
|
125
|
+
media_type: 'application/vnd.acp.bundle+json',
|
|
126
|
+
description: `Governance bundle ${bundle.manifest.version} for ${bundle.manifest.environment}`,
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
parameters: action.context ?? {},
|
|
130
|
+
agent_context: { stale: this.lastStale, governingClauseRefs: decision.governingClauseRefs },
|
|
131
|
+
basis_captured_at: this.now(),
|
|
132
|
+
decisionId: `eval:${this.config.agentId}:${bundle.manifest.version}:${action.capability}`,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function staleResult(cached, reason) {
|
|
137
|
+
return { updated: false, stale: true, usingVersion: cached.manifest.version, reason };
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=evaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluator.js","sourceRoot":"","sources":["../src/evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,cAAc,EAAsC,MAAM,eAAe,CAAC;AAEnF,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AACD,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IACvC,OAAO,CAAoB;IACpC,YAAY,OAA0B;QACpC,KAAK,CAAC,uCAAuC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACnE,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AA+BD,MAAM,OAAO,mBAAmB;IAKD;IAJrB,MAAM,CAA2B;IACjC,SAAS,GAAG,KAAK,CAAC;IACT,GAAG,CAAe;IAEnC,YAA6B,MAAuB;QAAvB,WAAM,GAAN,MAAM,CAAiB;QAClD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC;QAClC,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,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AC;CACF;AAED,SAAS,WAAW,CAAC,MAAoB,EAAE,MAAc;IACvD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;AACxF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @getvda/evaluator-sdk — the fleet-reuse artifact.
|
|
3
|
+
*
|
|
4
|
+
* Any agent embeds this to fetch → verify → cache → evaluate → seal a governance
|
|
5
|
+
* bundle LOCALLY. Framework-agnostic; fail-static. A customer's agent team drops
|
|
6
|
+
* in a library, not a systems-integration project.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const evaluator = new GovernanceEvaluator({
|
|
10
|
+
* source: new HttpBundleSource({ baseUrl: 'https://acp.getvda.ai/bundles' }),
|
|
11
|
+
* resolver: new DidWebKeyResolver(),
|
|
12
|
+
* witness, // WitnessHttpClient (customer-managed custody)
|
|
13
|
+
* environment: 'ref-env',
|
|
14
|
+
* agentId: 'agent://my-agent',
|
|
15
|
+
* });
|
|
16
|
+
* const outcome = await evaluator.evaluate({ capability: 'send_email', conditionsMet: true });
|
|
17
|
+
* if (!outcome.allowed) refuse(outcome.reason);
|
|
18
|
+
*/
|
|
19
|
+
export { GovernanceEvaluator, NoGovernanceError, BundleVerificationError, type EvaluatorConfig, type RefreshResult, type EvaluationOutcome, } from './evaluator.js';
|
|
20
|
+
export { evaluateAction, type ProposedAction, type Decision } from './evaluate.js';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,iBAAiB,GACvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @getvda/evaluator-sdk — the fleet-reuse artifact.
|
|
3
|
+
*
|
|
4
|
+
* Any agent embeds this to fetch → verify → cache → evaluate → seal a governance
|
|
5
|
+
* bundle LOCALLY. Framework-agnostic; fail-static. A customer's agent team drops
|
|
6
|
+
* in a library, not a systems-integration project.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const evaluator = new GovernanceEvaluator({
|
|
10
|
+
* source: new HttpBundleSource({ baseUrl: 'https://acp.getvda.ai/bundles' }),
|
|
11
|
+
* resolver: new DidWebKeyResolver(),
|
|
12
|
+
* witness, // WitnessHttpClient (customer-managed custody)
|
|
13
|
+
* environment: 'ref-env',
|
|
14
|
+
* agentId: 'agent://my-agent',
|
|
15
|
+
* });
|
|
16
|
+
* const outcome = await evaluator.evaluate({ capability: 'send_email', conditionsMet: true });
|
|
17
|
+
* if (!outcome.allowed) refuse(outcome.reason);
|
|
18
|
+
*/
|
|
19
|
+
export { GovernanceEvaluator, NoGovernanceError, BundleVerificationError, } from './evaluator.js';
|
|
20
|
+
export { evaluateAction } from './evaluate.js';
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,GAIxB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,cAAc,EAAsC,MAAM,eAAe,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@getvda/evaluator-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "The ACP evaluator SDK — the fleet-reuse artifact. Any agent embeds it to fetch → verify → cache → evaluate → seal a governance bundle LOCALLY. Framework-agnostic. Fail-static.",
|
|
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/governance-schema": "^0.2.0",
|
|
16
|
+
"@getvda/bundle": "^0.1.0",
|
|
17
|
+
"@getvda/distribution": "^0.1.0",
|
|
18
|
+
"@getvda/witness": "^0.1.0"
|
|
19
|
+
},
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE",
|
|
28
|
+
"NOTICE"
|
|
29
|
+
],
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/getvda-ai/acp-agent.git",
|
|
33
|
+
"directory": "packages/evaluator-sdk"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://getvda.ai"
|
|
36
|
+
}
|