@agenticprimitives/intent-marketplace 0.0.0-alpha.3
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 +21 -0
- package/README.md +45 -0
- package/dist/index.d.ts +146 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/package.json +60 -0
- package/spec.md +5 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Agentic Trust Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# @agenticprimitives/intent-marketplace
|
|
2
|
+
|
|
3
|
+
> **Status: STUB** (Wave 0.5 of the W1 implementation wave). Typed primitives and matcher math ship today; the full Direct Lane marketplace lands in Wave 5 per the [w1 implementation wave plan](../../docs/architecture/w1-implementation-wave-plan.md).
|
|
4
|
+
|
|
5
|
+
Agents are about to negotiate with each other at scale, and the intent layer is where that negotiation starts: *"I want X, under these constraints — find me a counterparty."* ERC-7683 and Anoma proved the pattern for cross-chain settlement; what no one ships is intents that live under the **same delegation, custody, and audit substrate as the identity expressing them**. An intent here is expressed by a canonical Smart Agent address, brokered under a scoped delegation, and resolved with a signed, AI-auditable receipt — not a freeform message in a vendor silo.
|
|
6
|
+
|
|
7
|
+
This package is the designed coordination slice of that substrate: spine Layers 2, 3, 5, 6, and 7 — intent expression through dual-signed commitment — spec'd in full, scaffolded now, landing in the implementation waves.
|
|
8
|
+
|
|
9
|
+
Part of [agenticprimitives](../../README.md) — the trust substrate for the agent economy: one canonical Smart Agent identity with custody, delegation, naming, credentials, and audit evidence designed as one system.
|
|
10
|
+
|
|
11
|
+
## What ships today
|
|
12
|
+
|
|
13
|
+
The W1 foundational surface — types and pure functions, no marketplace runtime:
|
|
14
|
+
|
|
15
|
+
- **`Intent` typed envelope** — direction (`receive` | `give`) + SKOS object IRI + topic + payload + expected outcome + 5-tier visibility + status state machine.
|
|
16
|
+
- **`ConstraintSet` + `AssumptionSet`** — first-class typed structures (Anoma CSP-shaped), never freeform payload. Every constraint carries its `source` (`user-asserted` | `llm-inferred` | `policy-imposed`), strength, and enforcement point.
|
|
17
|
+
- **`ResolutionReceipt` type** — the AI-auditability surface: model + version + prompt hash + tool-call hashes + confidence + a `requiresUserConfirmation` gate, so an LLM-inferred constraint can never silently bind a user.
|
|
18
|
+
- **`IntentMatch` + `Commitment` types** — the match record and the dual-signed envelope handed off (as bytes) to `agreements`.
|
|
19
|
+
- **Matcher math** — `isCompatible` (opposite direction + same object + topic similarity) and the `composite` score (0.6 × proximity + 0.4 × outcome, Laplace-smoothed) with `toMatchScore`.
|
|
20
|
+
|
|
21
|
+
## What lands in the waves (designed, not shipped)
|
|
22
|
+
|
|
23
|
+
`buildIntent` / `signIntent`, the `runMatcher` / `rankCandidates` pipeline, visibility projections (`projectFor` with per-field DisclosurePolicy), the three-tier delegation model (T1 session / T2 system / T3 cross), and the scope catalog + cross-delegation builders. Pool Lane (1-to-N) and Proposal Lane (RFP) are deliberately deferred beyond W1. The resolver engine is a separate package — [`intent-resolver`](../intent-resolver).
|
|
24
|
+
|
|
25
|
+
## Where this is heading / market context
|
|
26
|
+
|
|
27
|
+
- **ERC-7683** standardized cross-chain intent orders and the resolver role; we adopt its resolver/matchmaker separation and reserve an `erc7683Order` slot for interop.
|
|
28
|
+
- **Anoma** shaped intents as constraint-satisfaction problems; our `ConstraintSet` follows that shape as a first-class type.
|
|
29
|
+
- **x402 and Google AP2** are making machine payments and agent mandates real — which is exactly why the intent that *triggers* a payment must share a trust chain with the mandate that authorizes it. Here, the intent, the delegation that brokered it, the payment mandate it binds to ([`payments`](../payments)), and the audit event it emits all reference one canonical address.
|
|
30
|
+
|
|
31
|
+
That combination — intents under the same delegation + custody + audit substrate — is the gap this package exists to fill.
|
|
32
|
+
|
|
33
|
+
**Authoritative spec:** [spec 239 — intent spine](../../specs/239-intent-spine.md) (see [`spec.md`](./spec.md)). Owns spine layers 2-3-5-6-7; bounded surface in `CLAUDE.md` and `capability.manifest.json`.
|
|
34
|
+
|
|
35
|
+
## Build
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pnpm --filter @agenticprimitives/intent-marketplace typecheck
|
|
39
|
+
pnpm --filter @agenticprimitives/intent-marketplace test
|
|
40
|
+
pnpm --filter @agenticprimitives/intent-marketplace build
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Status — honest version
|
|
44
|
+
|
|
45
|
+
STUB. Treat every API outside "What ships today" as a design commitment, not a capability. Wave sequencing: [w1-implementation-wave-plan.md](../../docs/architecture/w1-implementation-wave-plan.md). Security findings for the whole repo are tracked live in [`docs/audits/findings.yaml`](../../docs/audits/findings.yaml).
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agenticprimitives/intent-marketplace — Direct Lane intent marketplace
|
|
3
|
+
* (Layers 2, 3, 5, 6, 7 of the spine).
|
|
4
|
+
*
|
|
5
|
+
* Authoritative spec: specs/239-intent-spine.md
|
|
6
|
+
*/
|
|
7
|
+
import type { Address } from '@agenticprimitives/types';
|
|
8
|
+
export declare const PACKAGE_NAME = "@agenticprimitives/intent-marketplace";
|
|
9
|
+
export declare const PACKAGE_STATUS: "w1-foundational";
|
|
10
|
+
export declare const SPEC_REF = "specs/239-intent-spine.md";
|
|
11
|
+
export type Hex32 = `0x${string}`;
|
|
12
|
+
export type IRI = `${string}:${string}`;
|
|
13
|
+
export type IntentDirection = 'receive' | 'give';
|
|
14
|
+
export type IntentStatus = 'drafted' | 'expressed' | 'acknowledged' | 'matched' | 'committed' | 'completed' | 'withdrawn' | 'expired';
|
|
15
|
+
export type VisibilityTier = 'Public' | 'PublicCoarse' | 'PrivateCommitment' | 'PrivateZK' | 'OffchainOnly';
|
|
16
|
+
export interface Intent<TPayload extends Record<string, unknown> = Record<string, unknown>> {
|
|
17
|
+
id: string;
|
|
18
|
+
direction: IntentDirection;
|
|
19
|
+
object: IRI;
|
|
20
|
+
topic?: string;
|
|
21
|
+
intentType?: string;
|
|
22
|
+
expressedBy: Address;
|
|
23
|
+
addressedTo: Address[];
|
|
24
|
+
hasConstraintSet: ConstraintSet;
|
|
25
|
+
hasAssumptionSet?: AssumptionSet;
|
|
26
|
+
expectedOutcome?: Record<string, unknown>;
|
|
27
|
+
visibility: VisibilityTier;
|
|
28
|
+
status: IntentStatus;
|
|
29
|
+
payload?: TPayload;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
}
|
|
32
|
+
export type ConstraintSource = 'user-asserted' | 'llm-inferred' | 'policy-imposed';
|
|
33
|
+
export type ConstraintStrength = 'hard' | 'soft';
|
|
34
|
+
export type ConstraintEnforcement = 'pre-execution' | 'agreement' | 'ranking';
|
|
35
|
+
export type ConstraintDomain = {
|
|
36
|
+
kind: 'enum';
|
|
37
|
+
values: string[];
|
|
38
|
+
} | {
|
|
39
|
+
kind: 'range';
|
|
40
|
+
min: number | bigint;
|
|
41
|
+
max: number | bigint;
|
|
42
|
+
unit: string;
|
|
43
|
+
} | {
|
|
44
|
+
kind: 'set';
|
|
45
|
+
allowedSet: string[];
|
|
46
|
+
deniedSet?: string[];
|
|
47
|
+
} | {
|
|
48
|
+
kind: 'predicate';
|
|
49
|
+
expression: string;
|
|
50
|
+
};
|
|
51
|
+
export interface Constraint {
|
|
52
|
+
id: string;
|
|
53
|
+
variable: string;
|
|
54
|
+
domain: ConstraintDomain;
|
|
55
|
+
source: ConstraintSource;
|
|
56
|
+
strength: ConstraintStrength;
|
|
57
|
+
enforcement?: ConstraintEnforcement;
|
|
58
|
+
rationale?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface ConstraintSet {
|
|
61
|
+
hardConstraints: Constraint[];
|
|
62
|
+
softConstraints: Constraint[];
|
|
63
|
+
fieldDisclosure?: Record<string, VisibilityTier>;
|
|
64
|
+
}
|
|
65
|
+
export interface NamedAssumption {
|
|
66
|
+
name: string;
|
|
67
|
+
description?: string;
|
|
68
|
+
trustLevel: 'asserted' | 'verified' | 'oracle' | 'zkp';
|
|
69
|
+
risk?: string;
|
|
70
|
+
evidenceRef?: string;
|
|
71
|
+
expiresAt?: string;
|
|
72
|
+
}
|
|
73
|
+
export interface AssumptionSet {
|
|
74
|
+
resolverId: string;
|
|
75
|
+
namedAssumptions: NamedAssumption[];
|
|
76
|
+
risks: string[];
|
|
77
|
+
requiredValidations: string[];
|
|
78
|
+
}
|
|
79
|
+
export interface ResolutionReceipt {
|
|
80
|
+
id: string;
|
|
81
|
+
type: 'ResolutionReceipt';
|
|
82
|
+
version: '1.0';
|
|
83
|
+
inputRefs: {
|
|
84
|
+
naturalLanguagePromptHash?: Hex32;
|
|
85
|
+
sourceIntentRef?: string;
|
|
86
|
+
sourceA2aMessageHash?: Hex32;
|
|
87
|
+
contextRefs: string[];
|
|
88
|
+
};
|
|
89
|
+
resolver: {
|
|
90
|
+
agentId: Address;
|
|
91
|
+
agentClass: 'concierge' | 'resolver' | 'orchestrator' | 'hybrid';
|
|
92
|
+
version: string;
|
|
93
|
+
model?: {
|
|
94
|
+
name: string;
|
|
95
|
+
version: string;
|
|
96
|
+
provider: string;
|
|
97
|
+
};
|
|
98
|
+
policyVersion: string;
|
|
99
|
+
toolCalls?: {
|
|
100
|
+
toolName: string;
|
|
101
|
+
inputHash: Hex32;
|
|
102
|
+
outputHash: Hex32;
|
|
103
|
+
durationMs: number;
|
|
104
|
+
}[];
|
|
105
|
+
};
|
|
106
|
+
outputIntentRef: string;
|
|
107
|
+
constraintSetRef: string;
|
|
108
|
+
assumptionSetRef?: string;
|
|
109
|
+
confidence: number;
|
|
110
|
+
unresolvedAmbiguities?: string[];
|
|
111
|
+
missingInformation?: string[];
|
|
112
|
+
requiresUserConfirmation: boolean;
|
|
113
|
+
userConfirmedAt?: string;
|
|
114
|
+
policyChecks: {
|
|
115
|
+
name: string;
|
|
116
|
+
passed: boolean;
|
|
117
|
+
rationale?: string;
|
|
118
|
+
}[];
|
|
119
|
+
riskFlags: string[];
|
|
120
|
+
createdAt: string;
|
|
121
|
+
}
|
|
122
|
+
export interface IntentMatch {
|
|
123
|
+
id: string;
|
|
124
|
+
intentRefs: [string, string];
|
|
125
|
+
matchScore: number;
|
|
126
|
+
matchedAt: string;
|
|
127
|
+
brokerAgent: Address;
|
|
128
|
+
rationale?: string;
|
|
129
|
+
}
|
|
130
|
+
export interface Commitment {
|
|
131
|
+
id: string;
|
|
132
|
+
intentMatchRef: string;
|
|
133
|
+
parties: [Address, Address];
|
|
134
|
+
commitmentHash: Hex32;
|
|
135
|
+
signedBy: [Address, Address];
|
|
136
|
+
createdAt: string;
|
|
137
|
+
}
|
|
138
|
+
export declare function isCompatible(a: Intent, b: Intent, opts?: {
|
|
139
|
+
topicSimilarityThreshold: number;
|
|
140
|
+
}): boolean;
|
|
141
|
+
export declare function composite(args: {
|
|
142
|
+
proximity: number;
|
|
143
|
+
outcome: number;
|
|
144
|
+
}): number;
|
|
145
|
+
export declare function toMatchScore(composite: number): number;
|
|
146
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAExD,eAAO,MAAM,YAAY,0CAA0C,CAAC;AACpE,eAAO,MAAM,cAAc,EAAG,iBAA0B,CAAC;AACzD,eAAO,MAAM,QAAQ,8BAA8B,CAAC;AAEpD,MAAM,MAAM,KAAK,GAAG,KAAK,MAAM,EAAE,CAAC;AAClC,MAAM,MAAM,GAAG,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAIxC,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,MAAM,CAAC;AACjD,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,WAAW,GACX,cAAc,GACd,SAAS,GACT,WAAW,GACX,WAAW,GACX,WAAW,GACX,SAAS,CAAC;AACd,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,cAAc,GACd,mBAAmB,GACnB,WAAW,GACX,cAAc,CAAC;AAEnB,MAAM,WAAW,MAAM,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACxF,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,eAAe,CAAC;IAC3B,MAAM,EAAE,GAAG,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,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E,MAAM,EACT,IAAI,GAAE;IAAE,wBAAwB,EAAE,MAAM,CAAA;CAAsC,GAC7E,OAAO,CAKT;AAYD,wBAAgB,SAAS,CAAC,IAAI,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAI9E;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAGtD"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agenticprimitives/intent-marketplace — Direct Lane intent marketplace
|
|
3
|
+
* (Layers 2, 3, 5, 6, 7 of the spine).
|
|
4
|
+
*
|
|
5
|
+
* Authoritative spec: specs/239-intent-spine.md
|
|
6
|
+
*/
|
|
7
|
+
export const PACKAGE_NAME = '@agenticprimitives/intent-marketplace';
|
|
8
|
+
export const PACKAGE_STATUS = 'w1-foundational';
|
|
9
|
+
export const SPEC_REF = 'specs/239-intent-spine.md';
|
|
10
|
+
// ─── Matcher primitives (spec 239 §7) ───────────────────────────────
|
|
11
|
+
export function isCompatible(a, b, opts = { topicSimilarityThreshold: 0.0 }) {
|
|
12
|
+
if (a.direction === b.direction)
|
|
13
|
+
return false;
|
|
14
|
+
if (a.object !== b.object)
|
|
15
|
+
return false;
|
|
16
|
+
const sim = computeTopicSimilarity(a.topic ?? '', b.topic ?? '');
|
|
17
|
+
return sim >= opts.topicSimilarityThreshold;
|
|
18
|
+
}
|
|
19
|
+
function computeTopicSimilarity(topicA, topicB) {
|
|
20
|
+
if (!topicA || !topicB)
|
|
21
|
+
return 1.0;
|
|
22
|
+
if (topicA === topicB)
|
|
23
|
+
return 1.0;
|
|
24
|
+
const setA = new Set(topicA.toLowerCase().split(/\s+/));
|
|
25
|
+
const setB = new Set(topicB.toLowerCase().split(/\s+/));
|
|
26
|
+
const intersect = new Set([...setA].filter((x) => setB.has(x)));
|
|
27
|
+
const union = new Set([...setA, ...setB]);
|
|
28
|
+
return union.size === 0 ? 0 : intersect.size / union.size;
|
|
29
|
+
}
|
|
30
|
+
export function composite(args) {
|
|
31
|
+
const proxLaplace = (args.proximity + 1) / 2;
|
|
32
|
+
const outLaplace = (args.outcome + 1) / 2;
|
|
33
|
+
return 0.6 * proxLaplace + 0.4 * outLaplace;
|
|
34
|
+
}
|
|
35
|
+
export function toMatchScore(composite) {
|
|
36
|
+
const clamped = Math.max(0, Math.min(1, composite));
|
|
37
|
+
return Math.round(clamped * 10000);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,CAAC,MAAM,YAAY,GAAG,uCAAuC,CAAC;AACpE,MAAM,CAAC,MAAM,cAAc,GAAG,iBAA0B,CAAC;AACzD,MAAM,CAAC,MAAM,QAAQ,GAAG,2BAA2B,CAAC;AA0IpD,uEAAuE;AAEvE,MAAM,UAAU,YAAY,CAC1B,CAAS,EACT,CAAS,EACT,OAA6C,EAAE,wBAAwB,EAAE,GAAG,EAAE;IAE9E,IAAI,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,SAAS;QAAE,OAAO,KAAK,CAAC;IAC9C,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACxC,MAAM,GAAG,GAAG,sBAAsB,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IACjE,OAAO,GAAG,IAAI,IAAI,CAAC,wBAAwB,CAAC;AAC9C,CAAC;AAED,SAAS,sBAAsB,CAAC,MAAc,EAAE,MAAc;IAC5D,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM;QAAE,OAAO,GAAG,CAAC;IACnC,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,GAAG,CA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intent-marketplace",
|
|
3
|
+
"version": "0.0.0-alpha.3",
|
|
4
|
+
"description": "Direct Lane intent matchmaking. Intent + ConstraintSet + AssumptionSet + ResolutionReceipt + IntentMatch + composite-score ranking. Resolver layer 4 folded into PassThrough stub in W1.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/agentictrustlabs/agenticprimitives.git",
|
|
9
|
+
"directory": "packages/intent-marketplace"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/agentictrustlabs/agenticprimitives/tree/master/packages/intent-marketplace",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/agentictrustlabs/agenticprimitives/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"dist",
|
|
27
|
+
"spec.md",
|
|
28
|
+
"README.md"
|
|
29
|
+
],
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"viem": "^2.52.2"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"vitest": "^4.1.8",
|
|
38
|
+
"viem": "^2.52.2"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"agentic",
|
|
42
|
+
"primitives",
|
|
43
|
+
"intent-marketplace"
|
|
44
|
+
],
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@noble/hashes": "^2.2.0",
|
|
47
|
+
"@agenticprimitives/verifiable-credentials": "0.0.0-alpha.3",
|
|
48
|
+
"@agenticprimitives/intent-resolver": "0.0.0-alpha.3",
|
|
49
|
+
"@agenticprimitives/types": "1.0.0-alpha.7",
|
|
50
|
+
"@agenticprimitives/delegation": "1.0.0-alpha.7"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsc -p tsconfig.build.json",
|
|
54
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
55
|
+
"test": "vitest run",
|
|
56
|
+
"test:unit": "vitest run test/unit --passWithNoTests",
|
|
57
|
+
"test:watch": "vitest",
|
|
58
|
+
"clean": "rm -rf dist"
|
|
59
|
+
}
|
|
60
|
+
}
|