@vallum/policy-gateway 0.0.0-prerelease
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/README.md +43 -0
- package/dist/capabilityCheck.d.ts +18 -0
- package/dist/capabilityCheck.js +49 -0
- package/dist/contractAllowList.d.ts +4 -0
- package/dist/contractAllowList.js +19 -0
- package/dist/evaluatePolicy.d.ts +5 -0
- package/dist/evaluatePolicy.js +52 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/mockGasStationAdapter.d.ts +15 -0
- package/dist/mockGasStationAdapter.js +8 -0
- package/dist/policy.d.ts +2 -0
- package/dist/policy.js +58 -0
- package/dist/policySchema.d.ts +23 -0
- package/dist/policySchema.js +1 -0
- package/dist/routes.d.ts +38 -0
- package/dist/routes.js +169 -0
- package/dist/server.d.ts +12 -0
- package/dist/server.js +15 -0
- package/package.json +38 -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/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @vallum/policy-gateway
|
|
2
|
+
|
|
3
|
+
Fail-closed sponsorship policy evaluation helpers for Vallum gateways.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
For the npm prerelease, install:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @vallum/policy-gateway@next
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
See
|
|
14
|
+
https://github.com/0xCozart/agentic-gaskit/blob/main/docs/vallum/package-integration-guide.md
|
|
15
|
+
for package selection, configuration, and when to use the gateway package
|
|
16
|
+
instead of the SDK.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { evaluateSponsorshipPolicy } from "@vallum/policy-gateway";
|
|
22
|
+
|
|
23
|
+
const decision = evaluateSponsorshipPolicy(
|
|
24
|
+
{
|
|
25
|
+
appId: "demo-app",
|
|
26
|
+
appStatus: "active",
|
|
27
|
+
allowedPackages: ["0xpackage"],
|
|
28
|
+
maxGasBudgetPerTx: 10_000_000,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
authenticated: true,
|
|
32
|
+
appId: "demo-app",
|
|
33
|
+
packageId: "0xpackage",
|
|
34
|
+
gasBudget: 1_000_000,
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
if (!decision.allowed) {
|
|
39
|
+
console.error(decision.reasonCode, decision.message);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The evaluator is deterministic and local. It does not reserve gas, execute transactions, call IOTA RPC, or enforce quotas beyond the request context values supplied by the caller.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ResolveAgentResult } from "@vallum/registry";
|
|
2
|
+
export interface AgentCapabilityRequirement {
|
|
3
|
+
readonly capabilityId: string;
|
|
4
|
+
readonly scope?: string;
|
|
5
|
+
readonly contract?: string;
|
|
6
|
+
}
|
|
7
|
+
export type AgentCapabilityPolicyDecision = {
|
|
8
|
+
readonly allowed: true;
|
|
9
|
+
} | {
|
|
10
|
+
readonly allowed: false;
|
|
11
|
+
readonly reasonCode: "PROFILE_INVALID" | "PROFILE_REVOKED" | "PROFILE_EXPIRED" | "PROFILE_UNVERIFIABLE" | "PROFILE_STALE_CACHE" | "CAPABILITY_NOT_ALLOWED";
|
|
12
|
+
readonly message: string;
|
|
13
|
+
};
|
|
14
|
+
export interface AgentCapabilityPolicyOptions {
|
|
15
|
+
readonly now?: Date;
|
|
16
|
+
}
|
|
17
|
+
export declare function evaluateProfileCapabilityPolicy(profile: unknown, requirement: AgentCapabilityRequirement, options?: AgentCapabilityPolicyOptions): AgentCapabilityPolicyDecision;
|
|
18
|
+
export declare function evaluateResolvedProfileCapabilityPolicy(resolved: ResolveAgentResult, requirement: AgentCapabilityRequirement, options?: AgentCapabilityPolicyOptions): AgentCapabilityPolicyDecision;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { validateAgentProfile } from "@vallum/registry";
|
|
2
|
+
export function evaluateProfileCapabilityPolicy(profile, requirement, options = {}) {
|
|
3
|
+
const validation = validateAgentProfile(profile, { now: options.now });
|
|
4
|
+
if (!validation.ok) {
|
|
5
|
+
if (validation.errors.some((error) => error.code === "PROFILE_REVOKED")) {
|
|
6
|
+
return deny("PROFILE_REVOKED", "Agent profile is revoked.");
|
|
7
|
+
}
|
|
8
|
+
if (validation.errors.some((error) => error.code === "PROFILE_EXPIRED")) {
|
|
9
|
+
return deny("PROFILE_EXPIRED", "Agent profile is expired.");
|
|
10
|
+
}
|
|
11
|
+
return deny("PROFILE_INVALID", "Agent profile failed validation.");
|
|
12
|
+
}
|
|
13
|
+
if (!hasRequiredCapability(validation.profile, requirement)) {
|
|
14
|
+
return deny("CAPABILITY_NOT_ALLOWED", "Required agent capability is not present.");
|
|
15
|
+
}
|
|
16
|
+
return { allowed: true };
|
|
17
|
+
}
|
|
18
|
+
export function evaluateResolvedProfileCapabilityPolicy(resolved, requirement, options = {}) {
|
|
19
|
+
if (!resolved.ok) {
|
|
20
|
+
if (resolved.error.code === "PROFILE_REVOKED") {
|
|
21
|
+
return deny("PROFILE_REVOKED", resolved.error.message);
|
|
22
|
+
}
|
|
23
|
+
if (resolved.error.code === "PROFILE_EXPIRED") {
|
|
24
|
+
return deny("PROFILE_EXPIRED", resolved.error.message);
|
|
25
|
+
}
|
|
26
|
+
if (resolved.error.code === "PROFILE_STALE_CACHE") {
|
|
27
|
+
return deny("PROFILE_STALE_CACHE", resolved.error.message);
|
|
28
|
+
}
|
|
29
|
+
if (resolved.error.code === "PROFILE_UNVERIFIABLE") {
|
|
30
|
+
return deny("PROFILE_UNVERIFIABLE", resolved.error.message);
|
|
31
|
+
}
|
|
32
|
+
return deny("PROFILE_INVALID", resolved.error.message);
|
|
33
|
+
}
|
|
34
|
+
return evaluateProfileCapabilityPolicy(resolved.profile, requirement, options);
|
|
35
|
+
}
|
|
36
|
+
function hasRequiredCapability(profile, requirement) {
|
|
37
|
+
return profile.capabilities.some((capability) => {
|
|
38
|
+
if (capability.id !== requirement.capabilityId)
|
|
39
|
+
return false;
|
|
40
|
+
if (requirement.scope && !capability.scopes?.includes(requirement.scope))
|
|
41
|
+
return false;
|
|
42
|
+
if (requirement.contract && !capability.contracts?.includes(requirement.contract))
|
|
43
|
+
return false;
|
|
44
|
+
return true;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function deny(reasonCode, message) {
|
|
48
|
+
return { allowed: false, reasonCode, message };
|
|
49
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ContractTemplateRegistry } from "@vallum/contracts-metadata";
|
|
2
|
+
import type { AgentTransactionManifest } from "@vallum/manifest";
|
|
3
|
+
import type { AgentPolicyContract } from "./policySchema.js";
|
|
4
|
+
export declare function contractActionAllowed(allowedContracts: readonly AgentPolicyContract[], action: AgentTransactionManifest["action"], registry?: ContractTemplateRegistry): boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defaultContractTemplateRegistry, evaluateContractTemplateAction, } from "@vallum/contracts-metadata";
|
|
2
|
+
export function contractActionAllowed(allowedContracts, action, registry = defaultContractTemplateRegistry) {
|
|
3
|
+
return allowedContracts.some((contract) => (templateContractAllowed(contract, action, registry) || rawContractAllowed(contract, action)));
|
|
4
|
+
}
|
|
5
|
+
function templateContractAllowed(contract, action, registry) {
|
|
6
|
+
if (!contract.templateId)
|
|
7
|
+
return false;
|
|
8
|
+
if (!contract.templateVersion)
|
|
9
|
+
return false;
|
|
10
|
+
if (contract.templateId !== action.templateId || contract.templateVersion !== action.templateVersion)
|
|
11
|
+
return false;
|
|
12
|
+
const decision = evaluateContractTemplateAction(registry, action);
|
|
13
|
+
return decision.allowed;
|
|
14
|
+
}
|
|
15
|
+
function rawContractAllowed(contract, action) {
|
|
16
|
+
return contract.packageId === action.packageId &&
|
|
17
|
+
contract.functionName === action.functionName &&
|
|
18
|
+
(contract.module === undefined || contract.module === action.module);
|
|
19
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AgentActionPolicy, AgentPolicyDecision } from "./policySchema.js";
|
|
2
|
+
export interface AgentActionPolicyEvaluationOptions {
|
|
3
|
+
readonly now?: Date;
|
|
4
|
+
}
|
|
5
|
+
export declare function evaluateAgentActionPolicy(policy: AgentActionPolicy, manifest: unknown, options?: AgentActionPolicyEvaluationOptions): AgentPolicyDecision;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { validateAgentTransactionManifest, } from "@vallum/manifest";
|
|
2
|
+
import { contractActionAllowed } from "./contractAllowList.js";
|
|
3
|
+
export function evaluateAgentActionPolicy(policy, manifest, options = {}) {
|
|
4
|
+
if (manifest === undefined || manifest === null) {
|
|
5
|
+
return reject("MISSING_MANIFEST", "Agent transaction manifest is required.");
|
|
6
|
+
}
|
|
7
|
+
const manifestResult = validateAgentTransactionManifest(manifest, { now: options.now });
|
|
8
|
+
if (!manifestResult.ok)
|
|
9
|
+
return manifestValidationDecision(manifestResult.errors);
|
|
10
|
+
const validManifest = manifestResult.manifest;
|
|
11
|
+
if (!policy.knownAgents.includes(validManifest.agent.id)) {
|
|
12
|
+
return reject("UNKNOWN_AGENT", "Agent is not known to policy.");
|
|
13
|
+
}
|
|
14
|
+
if (policy.revokedAgents?.includes(validManifest.agent.id)) {
|
|
15
|
+
return reject("AGENT_REVOKED", "Agent is revoked by policy.");
|
|
16
|
+
}
|
|
17
|
+
if (validManifest.spend.maxGasBudget > policy.maxGasBudget) {
|
|
18
|
+
return reject("GAS_BUDGET_TOO_HIGH", "Manifest gas budget exceeds policy.");
|
|
19
|
+
}
|
|
20
|
+
if (!contractActionAllowed(policy.allowedContracts, validManifest.action)) {
|
|
21
|
+
return reject("CONTRACT_NOT_ALLOWED", "Manifest contract action is not allowed by policy.");
|
|
22
|
+
}
|
|
23
|
+
if (!policy.allowedCounterparties.includes(validManifest.counterparty.id)) {
|
|
24
|
+
return reject("COUNTERPARTY_NOT_ALLOWED", "Manifest counterparty is not allowed by policy.");
|
|
25
|
+
}
|
|
26
|
+
if (policy.requireSimulation && !simulationSatisfied(validManifest)) {
|
|
27
|
+
return reject("SIMULATION_REQUIRED", "Passing simulation is required before sponsorship.");
|
|
28
|
+
}
|
|
29
|
+
if (typeof policy.humanApprovalGasThreshold === "number" &&
|
|
30
|
+
validManifest.spend.maxGasBudget > policy.humanApprovalGasThreshold) {
|
|
31
|
+
return reject("HUMAN_APPROVAL_REQUIRED", "Human approval is required for this manifest budget.");
|
|
32
|
+
}
|
|
33
|
+
return { allowed: true };
|
|
34
|
+
}
|
|
35
|
+
function manifestValidationDecision(errors) {
|
|
36
|
+
if (errors.some((error) => error.code === "UNSUPPORTED_VERSION")) {
|
|
37
|
+
return reject("UNSUPPORTED_MANIFEST_VERSION", "Manifest version is unsupported.");
|
|
38
|
+
}
|
|
39
|
+
if (errors.some((error) => error.code === "MANIFEST_EXPIRED")) {
|
|
40
|
+
return reject("MANIFEST_EXPIRED", "Manifest is expired.");
|
|
41
|
+
}
|
|
42
|
+
return reject("MANIFEST_INVALID", "Manifest failed validation.");
|
|
43
|
+
}
|
|
44
|
+
function simulationSatisfied(manifest) {
|
|
45
|
+
return manifest.simulation.required === true &&
|
|
46
|
+
manifest.simulation.status === "passed" &&
|
|
47
|
+
typeof manifest.simulation.hash === "string" &&
|
|
48
|
+
manifest.simulation.hash.trim() !== "";
|
|
49
|
+
}
|
|
50
|
+
function reject(reasonCode, message) {
|
|
51
|
+
return { allowed: false, reasonCode, message };
|
|
52
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./policy.js";
|
|
2
|
+
export * from "./capabilityCheck.js";
|
|
3
|
+
export * from "./contractAllowList.js";
|
|
4
|
+
export * from "./evaluatePolicy.js";
|
|
5
|
+
export * from "./policySchema.js";
|
|
6
|
+
export * from "./mockGasStationAdapter.js";
|
|
7
|
+
export * from "./routes.js";
|
|
8
|
+
export * from "./server.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./policy.js";
|
|
2
|
+
export * from "./capabilityCheck.js";
|
|
3
|
+
export * from "./contractAllowList.js";
|
|
4
|
+
export * from "./evaluatePolicy.js";
|
|
5
|
+
export * from "./policySchema.js";
|
|
6
|
+
export * from "./mockGasStationAdapter.js";
|
|
7
|
+
export * from "./routes.js";
|
|
8
|
+
export * from "./server.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AgentTransactionManifest } from "@vallum/manifest";
|
|
2
|
+
import type { AgentPolicyDecision } from "./policySchema.js";
|
|
3
|
+
export interface MockSponsorshipReservation {
|
|
4
|
+
readonly sponsorshipId: string;
|
|
5
|
+
}
|
|
6
|
+
export interface MockGasStationAdapter {
|
|
7
|
+
reserve: (request: MockSponsorshipRequest) => Promise<MockSponsorshipReservation> | MockSponsorshipReservation;
|
|
8
|
+
}
|
|
9
|
+
export interface MockSponsorshipRequest {
|
|
10
|
+
readonly manifest: AgentTransactionManifest;
|
|
11
|
+
readonly decision: Extract<AgentPolicyDecision, {
|
|
12
|
+
allowed: true;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export declare function createMockGasStationAdapter(): MockGasStationAdapter;
|
package/dist/policy.d.ts
ADDED
package/dist/policy.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
function reject(reasonCode, message) {
|
|
2
|
+
return { allowed: false, reasonCode, message };
|
|
3
|
+
}
|
|
4
|
+
function hasConfiguredAllowlist(values) {
|
|
5
|
+
return Array.isArray(values) && values.length > 0;
|
|
6
|
+
}
|
|
7
|
+
export function evaluateSponsorshipPolicy(policy, request) {
|
|
8
|
+
if (!request.authenticated) {
|
|
9
|
+
return reject("AUTH_MISSING", "A valid app API key is required.");
|
|
10
|
+
}
|
|
11
|
+
if (request.appId !== policy.appId) {
|
|
12
|
+
return reject("AUTH_INVALID", "The app credentials do not match this policy.");
|
|
13
|
+
}
|
|
14
|
+
if (policy.appStatus === "disabled") {
|
|
15
|
+
return reject("APP_DISABLED", "This app is disabled and cannot sponsor transactions.");
|
|
16
|
+
}
|
|
17
|
+
if (typeof policy.dailyRequestLimit === "number" &&
|
|
18
|
+
typeof request.appRequestsToday === "number" &&
|
|
19
|
+
request.appRequestsToday >= policy.dailyRequestLimit) {
|
|
20
|
+
return reject("APP_DAILY_REQUEST_LIMIT_EXCEEDED", "The app daily request limit has been reached.");
|
|
21
|
+
}
|
|
22
|
+
if (typeof policy.dailyBudgetNanos === "number" &&
|
|
23
|
+
typeof request.appGasReservedToday === "number" &&
|
|
24
|
+
typeof request.gasBudget === "number" &&
|
|
25
|
+
request.appGasReservedToday + request.gasBudget > policy.dailyBudgetNanos) {
|
|
26
|
+
return reject("APP_DAILY_BUDGET_EXCEEDED", "The app daily gas budget would be exceeded.");
|
|
27
|
+
}
|
|
28
|
+
if (typeof policy.maxGasBudgetPerTx === "number" &&
|
|
29
|
+
typeof request.gasBudget === "number" &&
|
|
30
|
+
request.gasBudget > policy.maxGasBudgetPerTx) {
|
|
31
|
+
return reject("GAS_BUDGET_TOO_HIGH", "The requested gas budget is higher than policy allows.");
|
|
32
|
+
}
|
|
33
|
+
if (request.walletAddress && policy.deniedWallets?.includes(request.walletAddress)) {
|
|
34
|
+
return reject("WALLET_DENIED", "This wallet is denied by policy.");
|
|
35
|
+
}
|
|
36
|
+
if (typeof policy.maxRequestsPerWalletPerDay === "number" &&
|
|
37
|
+
typeof request.walletRequestsToday === "number" &&
|
|
38
|
+
request.walletRequestsToday >= policy.maxRequestsPerWalletPerDay) {
|
|
39
|
+
return reject("WALLET_DAILY_LIMIT_EXCEEDED", "This wallet reached its daily sponsorship limit.");
|
|
40
|
+
}
|
|
41
|
+
if (hasConfiguredAllowlist(policy.allowedPackages)) {
|
|
42
|
+
if (!request.packageId) {
|
|
43
|
+
return reject("PACKAGE_NOT_ALLOWED", "Package metadata is required when a package allowlist is configured.");
|
|
44
|
+
}
|
|
45
|
+
if (!policy.allowedPackages.includes(request.packageId)) {
|
|
46
|
+
return reject("PACKAGE_NOT_ALLOWED", "The requested package is not allowlisted.");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (hasConfiguredAllowlist(policy.allowedFunctions)) {
|
|
50
|
+
if (!request.functionName) {
|
|
51
|
+
return reject("FUNCTION_NOT_ALLOWED", "Function metadata is required when a function allowlist is configured.");
|
|
52
|
+
}
|
|
53
|
+
if (!policy.allowedFunctions.includes(request.functionName)) {
|
|
54
|
+
return reject("FUNCTION_NOT_ALLOWED", "The requested function is not allowlisted.");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return { allowed: true };
|
|
58
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface AgentActionPolicy {
|
|
2
|
+
readonly knownAgents: readonly string[];
|
|
3
|
+
readonly revokedAgents?: readonly string[];
|
|
4
|
+
readonly maxGasBudget: number;
|
|
5
|
+
readonly allowedContracts: readonly AgentPolicyContract[];
|
|
6
|
+
readonly allowedCounterparties: readonly string[];
|
|
7
|
+
readonly requireSimulation?: boolean;
|
|
8
|
+
readonly humanApprovalGasThreshold?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface AgentPolicyContract {
|
|
11
|
+
readonly packageId?: string;
|
|
12
|
+
readonly module?: string;
|
|
13
|
+
readonly functionName?: string;
|
|
14
|
+
readonly templateId?: string;
|
|
15
|
+
readonly templateVersion?: string;
|
|
16
|
+
}
|
|
17
|
+
export type AgentPolicyDecision = {
|
|
18
|
+
readonly allowed: true;
|
|
19
|
+
} | {
|
|
20
|
+
readonly allowed: false;
|
|
21
|
+
readonly reasonCode: "MISSING_MANIFEST" | "MANIFEST_INVALID" | "MANIFEST_EXPIRED" | "UNSUPPORTED_MANIFEST_VERSION" | "UNKNOWN_AGENT" | "AGENT_REVOKED" | "GAS_BUDGET_TOO_HIGH" | "CONTRACT_NOT_ALLOWED" | "COUNTERPARTY_NOT_ALLOWED" | "SIMULATION_REQUIRED" | "HUMAN_APPROVAL_REQUIRED";
|
|
22
|
+
readonly message: string;
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/routes.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
import type { MockGasStationAdapter } from "./mockGasStationAdapter.js";
|
|
3
|
+
import type { AgentActionPolicy, AgentPolicyDecision } from "./policySchema.js";
|
|
4
|
+
export type AgentGatewayEventOutcome = "approved" | "denied" | "bad_request" | "not_found";
|
|
5
|
+
export interface AgentGatewayEvent {
|
|
6
|
+
readonly timestamp: string;
|
|
7
|
+
readonly route: "/v1/agent/sponsorships";
|
|
8
|
+
readonly outcome: AgentGatewayEventOutcome;
|
|
9
|
+
readonly httpStatus: number;
|
|
10
|
+
readonly reasonCode?: Exclude<AgentPolicyDecision, {
|
|
11
|
+
allowed: true;
|
|
12
|
+
}>["reasonCode"];
|
|
13
|
+
readonly mockSponsorshipId?: string;
|
|
14
|
+
readonly manifest: RedactedAgentManifestEvent;
|
|
15
|
+
}
|
|
16
|
+
export interface RedactedAgentManifestEvent {
|
|
17
|
+
readonly version?: string;
|
|
18
|
+
readonly agentId?: string;
|
|
19
|
+
readonly ownerId?: string;
|
|
20
|
+
readonly walletId?: string;
|
|
21
|
+
readonly action?: {
|
|
22
|
+
readonly packageId?: string;
|
|
23
|
+
readonly module?: string;
|
|
24
|
+
readonly functionName?: string;
|
|
25
|
+
};
|
|
26
|
+
readonly counterpartyId?: string;
|
|
27
|
+
readonly maxGasBudget?: number;
|
|
28
|
+
readonly intentLength?: number;
|
|
29
|
+
readonly hasMetadata?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface AgentGatewayRouteConfig {
|
|
32
|
+
readonly policy: AgentActionPolicy;
|
|
33
|
+
readonly mockGasStation: MockGasStationAdapter;
|
|
34
|
+
readonly now?: () => Date;
|
|
35
|
+
readonly eventSink?: (event: AgentGatewayEvent) => void | Promise<void>;
|
|
36
|
+
readonly maxBodyBytes?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare function handleAgentGatewayRequest(request: IncomingMessage, response: ServerResponse, config: AgentGatewayRouteConfig): Promise<void>;
|
package/dist/routes.js
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { validateAgentTransactionManifest, } from "@vallum/manifest";
|
|
2
|
+
import { evaluateAgentActionPolicy } from "./evaluatePolicy.js";
|
|
3
|
+
class AgentGatewayRequestError extends Error {
|
|
4
|
+
status;
|
|
5
|
+
body;
|
|
6
|
+
constructor(status, body) {
|
|
7
|
+
super(typeof body.message === "string" ? body.message : "Request error.");
|
|
8
|
+
this.status = status;
|
|
9
|
+
this.body = body;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export async function handleAgentGatewayRequest(request, response, config) {
|
|
13
|
+
if (request.url !== "/v1/agent/sponsorships") {
|
|
14
|
+
writeJson(response, 404, { error: "NotFound", message: "Route not found." });
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (request.method !== "POST") {
|
|
18
|
+
writeJson(response, 405, { error: "MethodNotAllowed", message: "Use POST for agent sponsorship requests." });
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const body = requestRecord(await readJson(request, config.maxBodyBytes));
|
|
23
|
+
const manifest = body.manifest;
|
|
24
|
+
const decision = evaluateAgentActionPolicy(config.policy, manifest, { now: config.now?.() });
|
|
25
|
+
if (!decision.allowed) {
|
|
26
|
+
await emitEvent(config, {
|
|
27
|
+
outcome: "denied",
|
|
28
|
+
httpStatus: 403,
|
|
29
|
+
reasonCode: decision.reasonCode,
|
|
30
|
+
manifest: redactManifestForEvent(manifest),
|
|
31
|
+
});
|
|
32
|
+
writeJson(response, 403, { approved: false, decision });
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const manifestResult = validateAgentTransactionManifest(manifest, { now: config.now?.() });
|
|
36
|
+
if (!manifestResult.ok) {
|
|
37
|
+
await emitEvent(config, {
|
|
38
|
+
outcome: "denied",
|
|
39
|
+
httpStatus: 403,
|
|
40
|
+
reasonCode: "MANIFEST_INVALID",
|
|
41
|
+
manifest: redactManifestForEvent(manifest),
|
|
42
|
+
});
|
|
43
|
+
writeJson(response, 403, {
|
|
44
|
+
approved: false,
|
|
45
|
+
decision: {
|
|
46
|
+
allowed: false,
|
|
47
|
+
reasonCode: "MANIFEST_INVALID",
|
|
48
|
+
message: "Manifest failed validation.",
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const reservation = await config.mockGasStation.reserve({
|
|
54
|
+
manifest: manifestResult.manifest,
|
|
55
|
+
decision,
|
|
56
|
+
});
|
|
57
|
+
await emitEvent(config, {
|
|
58
|
+
outcome: "approved",
|
|
59
|
+
httpStatus: 200,
|
|
60
|
+
mockSponsorshipId: reservation.sponsorshipId,
|
|
61
|
+
manifest: redactManifestForEvent(manifestResult.manifest),
|
|
62
|
+
});
|
|
63
|
+
writeJson(response, 200, {
|
|
64
|
+
approved: true,
|
|
65
|
+
decision,
|
|
66
|
+
mockSponsorshipId: reservation.sponsorshipId,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
if (error instanceof AgentGatewayRequestError) {
|
|
71
|
+
await emitEvent(config, {
|
|
72
|
+
outcome: "bad_request",
|
|
73
|
+
httpStatus: error.status,
|
|
74
|
+
manifest: {},
|
|
75
|
+
});
|
|
76
|
+
writeJson(response, error.status, error.body);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
writeJson(response, 500, { error: "InternalError", message: "Agent gateway request failed." });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async function emitEvent(config, event) {
|
|
83
|
+
if (!config.eventSink)
|
|
84
|
+
return;
|
|
85
|
+
try {
|
|
86
|
+
await config.eventSink({
|
|
87
|
+
timestamp: (config.now?.() ?? new Date()).toISOString(),
|
|
88
|
+
route: "/v1/agent/sponsorships",
|
|
89
|
+
...event,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// Observability failures must not alter local sponsorship decisions.
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function writeJson(response, status, body) {
|
|
97
|
+
response.writeHead(status, { "cache-control": "no-store", "content-type": "application/json" });
|
|
98
|
+
response.end(JSON.stringify(body));
|
|
99
|
+
}
|
|
100
|
+
async function readJson(request, maxBytes = 1_048_576) {
|
|
101
|
+
let raw = "";
|
|
102
|
+
let bytes = 0;
|
|
103
|
+
for await (const chunk of request) {
|
|
104
|
+
const text = chunk.toString();
|
|
105
|
+
bytes += Buffer.byteLength(text);
|
|
106
|
+
if (bytes > maxBytes) {
|
|
107
|
+
throw new AgentGatewayRequestError(413, {
|
|
108
|
+
error: "PayloadTooLarge",
|
|
109
|
+
message: "Request body exceeds the local agent gateway limit.",
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
raw += text;
|
|
113
|
+
}
|
|
114
|
+
if (!raw.trim())
|
|
115
|
+
return {};
|
|
116
|
+
try {
|
|
117
|
+
return JSON.parse(raw);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
throw new AgentGatewayRequestError(400, {
|
|
121
|
+
error: "BadRequest",
|
|
122
|
+
message: "Request body must be valid JSON.",
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function requestRecord(value) {
|
|
127
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value))
|
|
128
|
+
return value;
|
|
129
|
+
throw new AgentGatewayRequestError(400, {
|
|
130
|
+
error: "BadRequest",
|
|
131
|
+
message: "Request body must be a JSON object.",
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function redactManifestForEvent(manifest) {
|
|
135
|
+
const record = asRecord(manifest);
|
|
136
|
+
const wallet = asRecord(record.wallet);
|
|
137
|
+
const action = asRecord(record.action);
|
|
138
|
+
const spend = asRecord(record.spend);
|
|
139
|
+
const agent = asRecord(record.agent);
|
|
140
|
+
const owner = asRecord(record.owner);
|
|
141
|
+
const counterparty = asRecord(record.counterparty);
|
|
142
|
+
return {
|
|
143
|
+
version: stringField(record.version),
|
|
144
|
+
agentId: stringField(agent.id),
|
|
145
|
+
ownerId: stringField(owner.id),
|
|
146
|
+
walletId: stringField(wallet.walletId),
|
|
147
|
+
action: {
|
|
148
|
+
packageId: stringField(action.packageId),
|
|
149
|
+
module: stringField(action.module),
|
|
150
|
+
functionName: stringField(action.functionName),
|
|
151
|
+
},
|
|
152
|
+
counterpartyId: stringField(counterparty.id),
|
|
153
|
+
maxGasBudget: numberField(spend.maxGasBudget),
|
|
154
|
+
intentLength: typeof record.intent === "string" ? record.intent.length : undefined,
|
|
155
|
+
hasMetadata: typeof record.metadata === "object" && record.metadata !== null,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function asRecord(value) {
|
|
159
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
160
|
+
}
|
|
161
|
+
function stringField(value) {
|
|
162
|
+
if (typeof value !== "string")
|
|
163
|
+
return undefined;
|
|
164
|
+
const trimmed = value.trim();
|
|
165
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
166
|
+
}
|
|
167
|
+
function numberField(value) {
|
|
168
|
+
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
169
|
+
}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Server } from "node:http";
|
|
2
|
+
import { type MockGasStationAdapter } from "./mockGasStationAdapter.js";
|
|
3
|
+
import { type AgentGatewayEvent } from "./routes.js";
|
|
4
|
+
import type { AgentActionPolicy } from "./policySchema.js";
|
|
5
|
+
export interface AgentMockGatewayServerConfig {
|
|
6
|
+
readonly policy: AgentActionPolicy;
|
|
7
|
+
readonly mockGasStation?: MockGasStationAdapter;
|
|
8
|
+
readonly now?: () => Date;
|
|
9
|
+
readonly eventSink?: (event: AgentGatewayEvent) => void | Promise<void>;
|
|
10
|
+
readonly maxBodyBytes?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function createAgentMockGatewayServer(config: AgentMockGatewayServerConfig): Server;
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createServer } from "node:http";
|
|
2
|
+
import { createMockGasStationAdapter } from "./mockGasStationAdapter.js";
|
|
3
|
+
import { handleAgentGatewayRequest } from "./routes.js";
|
|
4
|
+
export function createAgentMockGatewayServer(config) {
|
|
5
|
+
const mockGasStation = config.mockGasStation ?? createMockGasStationAdapter();
|
|
6
|
+
return createServer((request, response) => {
|
|
7
|
+
void handleAgentGatewayRequest(request, response, {
|
|
8
|
+
policy: config.policy,
|
|
9
|
+
mockGasStation,
|
|
10
|
+
now: config.now,
|
|
11
|
+
eventSink: config.eventSink,
|
|
12
|
+
maxBodyBytes: config.maxBodyBytes,
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vallum/policy-gateway",
|
|
3
|
+
"version": "0.0.0-prerelease",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"license": "Apache-2.0",
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@vallum/contracts-metadata": "0.0.0-prerelease",
|
|
16
|
+
"@vallum/manifest": "0.0.0-prerelease",
|
|
17
|
+
"@vallum/registry": "0.0.0-prerelease",
|
|
18
|
+
"@vallum/shared-types": "0.0.0-prerelease"
|
|
19
|
+
},
|
|
20
|
+
"description": "Fail-closed policy decision engine scaffold for Vallum sponsorship gateways.",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist/**/*.js",
|
|
23
|
+
"dist/**/*.d.ts",
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsc -p tsconfig.build.json"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=20"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public",
|
|
36
|
+
"tag": "next"
|
|
37
|
+
}
|
|
38
|
+
}
|