inamprotocol 0.3.1 → 0.3.6
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/README.md +84 -84
- package/dist/client.d.ts +15 -0
- package/dist/client.js +27 -0
- package/dist/client.js.map +1 -1
- package/dist/core/schemas.d.ts +268 -0
- package/dist/core/schemas.js +103 -0
- package/dist/core/schemas.js.map +1 -0
- package/dist/core/settlementVolume.d.ts +36 -0
- package/dist/core/settlementVolume.js +51 -0
- package/dist/core/settlementVolume.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +68 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
# inamprotocol (TypeScript/JavaScript SDK)
|
|
2
|
-
|
|
3
|
-
Reference TypeScript client for the [INAM Protocol](https://inamprotocol.org) — agent identity (`did:key`), execution receipts, jobs, and reputation. Parity with the Python SDK, [`sdk-python`](https://pypi.org/project/inamprotocol/). See [SPEC.md](https://github.com/inamprotocol/inam-protocol/blob/main/SPEC.md) for the full protocol specification.
|
|
4
|
-
|
|
5
|
-
This package is a standalone build of the same crypto/client code the [Node reference registry server](https://github.com/inamprotocol/inam-protocol) and its Cloudflare Workers deployment run in production — not a reimplementation with its own drift risk.
|
|
6
|
-
|
|
7
|
-
## Install
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
npm install inamprotocol
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import { InamClient, generateKeypair } from "inamprotocol";
|
|
17
|
-
|
|
18
|
-
const keypair = generateKeypair();
|
|
19
|
-
const client = new InamClient("https://api.inamprotocol.org", keypair);
|
|
20
|
-
|
|
21
|
-
const profile = await client.registerAgent(["document-extraction"], { name: "My Agent" });
|
|
22
|
-
console.log(profile.id); // did:key:z...
|
|
23
|
-
|
|
24
|
-
const reputation = await client.getReputation(profile.id);
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### Jobs (post → offer → accept → execute → receipt)
|
|
28
|
-
|
|
29
|
-
```ts
|
|
30
|
-
const job = await poster.postJob({ capability: "document-extraction", specHash: "sha256:..." });
|
|
31
|
-
await worker.submitOffer(job.jobId, "I can do this in an hour");
|
|
32
|
-
await poster.acceptOffer(job.jobId, worker.did);
|
|
33
|
-
|
|
34
|
-
const receipt = await worker.submitWork(poster.did, {
|
|
35
|
-
jobId: job.jobId,
|
|
36
|
-
task: { capability: "document-extraction", specHash: "sha256:...", createdAt: new Date().toISOString() },
|
|
37
|
-
result: { outputHash: "sha256:...", completedAt: new Date().toISOString() },
|
|
38
|
-
verification: { method: "payer_confirmation", outcome: "success" },
|
|
39
|
-
});
|
|
40
|
-
await poster.acceptWork(receipt); // finalizes the receipt and auto-completes the job
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
`poster.cancelJob(job.jobId)` cancels a not-yet-completed job (poster only); `client.getJob(id)` / `client.searchJobs({ capability, status })` / `client.listOffers(jobId)` round out discovery.
|
|
44
|
-
|
|
45
|
-
### External identity linking (challenge-response)
|
|
46
|
-
|
|
47
|
-
Linking a key-derived external identity (`agentpass_id` / `aitp_id` / `passport_id`; SPEC.md §2.1) requires proving control of that external key via a single-use, ~60s challenge — a bare claim is no longer enough. `a2a_endpoint` isn't key-derived, so it skips straight to `linkIdentity(protocol, value)`.
|
|
48
|
-
|
|
49
|
-
```ts
|
|
50
|
-
// externalKeypair stands in for whatever key AgentPass/AITP/Passport Alliance
|
|
51
|
-
// already issued this agent -- not an INAM keypair.
|
|
52
|
-
const challenge = await client.requestLinkChallenge("agentpass_id", toBase64(externalKeypair.publicKey), "ed25519");
|
|
53
|
-
const proof = toBase64(sign(fromHex(challenge.challenge), externalKeypair.privateKey));
|
|
54
|
-
await client.completeLink("agentpass_id", "ap_my_external_id", challenge.challengeId, proof);
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Verification (independent attestation)
|
|
58
|
-
|
|
59
|
-
A third party — anyone but the receipt's own worker (`agentB`) — can attest that a finalized receipt's output actually holds up (SPEC.md §12), feeding a reputation boost:
|
|
60
|
-
|
|
61
|
-
```ts
|
|
62
|
-
const verification = await verifierClient.submitVerification({
|
|
63
|
-
receiptId: receipt.receiptId,
|
|
64
|
-
method: "deterministic", // or "agent_attestation"
|
|
65
|
-
outputHash: receipt.result.outputHash,
|
|
66
|
-
result: "verified", // or "rejected"
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
await verifierClient.getVerification(verification.verificationId);
|
|
70
|
-
await verifierClient.listReceiptVerifications(receipt.receiptId);
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## What's exported
|
|
74
|
-
|
|
75
|
-
`InamClient`, `generateKeypair`/`keypairFromPrivateKey`/`publicKeyToDid`/`didToPublicKey`/`sign`/`verify`/`verifyRawEd25519`/`sha256Hex`, `generateP256Keypair`/`p256Sign`/`p256Verify` (used for external-identity link-challenge proofs, SPEC.md §2.1), `canonicalize` (the canonical-JSON serializer every INAM signature is computed over), `computeReceiptId`/`buildSignableContent`, `computeVerificationId`/`buildSignableVerificationContent`, and the full set of wire-format types (`AgentRecord`, `ExecutionReceipt`, `JobRecord`, `JobOffer`, `ReputationResult`, `LinkChallenge`, `VerificationRecord`, ...).
|
|
76
|
-
|
|
77
|
-
## Building from source
|
|
78
|
-
|
|
79
|
-
This package's `src/` is the actual source the registry server and Worker import directly (see `../src/services/receiptService.ts` and `../worker/src/receiptService.ts`) — there is exactly one implementation of the crypto/canonicalization/receipt-content logic across all TypeScript runtimes in this repo. The Python SDK is an independently maintained, interop-tested port (see `../sdk-python/tests/test_interop.py`).
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
-
npm install
|
|
83
|
-
npm run build # emits dist/ (declaration + sourcemaps)
|
|
84
|
-
```
|
|
1
|
+
# inamprotocol (TypeScript/JavaScript SDK)
|
|
2
|
+
|
|
3
|
+
Reference TypeScript client for the [INAM Protocol](https://inamprotocol.org) — agent identity (`did:key`), execution receipts, jobs, and reputation. Parity with the Python SDK, [`sdk-python`](https://pypi.org/project/inamprotocol/). See [SPEC.md](https://github.com/inamprotocol/inam-protocol/blob/main/SPEC.md) for the full protocol specification.
|
|
4
|
+
|
|
5
|
+
This package is a standalone build of the same crypto/client code the [Node reference registry server](https://github.com/inamprotocol/inam-protocol) and its Cloudflare Workers deployment run in production — not a reimplementation with its own drift risk.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm install inamprotocol
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { InamClient, generateKeypair } from "inamprotocol";
|
|
17
|
+
|
|
18
|
+
const keypair = generateKeypair();
|
|
19
|
+
const client = new InamClient("https://api.inamprotocol.org", keypair);
|
|
20
|
+
|
|
21
|
+
const profile = await client.registerAgent(["document-extraction"], { name: "My Agent" });
|
|
22
|
+
console.log(profile.id); // did:key:z...
|
|
23
|
+
|
|
24
|
+
const reputation = await client.getReputation(profile.id);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Jobs (post → offer → accept → execute → receipt)
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
const job = await poster.postJob({ capability: "document-extraction", specHash: "sha256:..." });
|
|
31
|
+
await worker.submitOffer(job.jobId, "I can do this in an hour");
|
|
32
|
+
await poster.acceptOffer(job.jobId, worker.did);
|
|
33
|
+
|
|
34
|
+
const receipt = await worker.submitWork(poster.did, {
|
|
35
|
+
jobId: job.jobId,
|
|
36
|
+
task: { capability: "document-extraction", specHash: "sha256:...", createdAt: new Date().toISOString() },
|
|
37
|
+
result: { outputHash: "sha256:...", completedAt: new Date().toISOString() },
|
|
38
|
+
verification: { method: "payer_confirmation", outcome: "success" },
|
|
39
|
+
});
|
|
40
|
+
await poster.acceptWork(receipt); // finalizes the receipt and auto-completes the job
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`poster.cancelJob(job.jobId)` cancels a not-yet-completed job (poster only); `client.getJob(id)` / `client.searchJobs({ capability, status })` / `client.listOffers(jobId)` round out discovery.
|
|
44
|
+
|
|
45
|
+
### External identity linking (challenge-response)
|
|
46
|
+
|
|
47
|
+
Linking a key-derived external identity (`agentpass_id` / `aitp_id` / `passport_id`; SPEC.md §2.1) requires proving control of that external key via a single-use, ~60s challenge — a bare claim is no longer enough. `a2a_endpoint` isn't key-derived, so it skips straight to `linkIdentity(protocol, value)`.
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
// externalKeypair stands in for whatever key AgentPass/AITP/Passport Alliance
|
|
51
|
+
// already issued this agent -- not an INAM keypair.
|
|
52
|
+
const challenge = await client.requestLinkChallenge("agentpass_id", toBase64(externalKeypair.publicKey), "ed25519");
|
|
53
|
+
const proof = toBase64(sign(fromHex(challenge.challenge), externalKeypair.privateKey));
|
|
54
|
+
await client.completeLink("agentpass_id", "ap_my_external_id", challenge.challengeId, proof);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Verification (independent attestation)
|
|
58
|
+
|
|
59
|
+
A third party — anyone but the receipt's own worker (`agentB`) — can attest that a finalized receipt's output actually holds up (SPEC.md §12), feeding a reputation boost:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
const verification = await verifierClient.submitVerification({
|
|
63
|
+
receiptId: receipt.receiptId,
|
|
64
|
+
method: "deterministic", // or "agent_attestation"
|
|
65
|
+
outputHash: receipt.result.outputHash,
|
|
66
|
+
result: "verified", // or "rejected"
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
await verifierClient.getVerification(verification.verificationId);
|
|
70
|
+
await verifierClient.listReceiptVerifications(receipt.receiptId);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## What's exported
|
|
74
|
+
|
|
75
|
+
`InamClient`, `generateKeypair`/`keypairFromPrivateKey`/`publicKeyToDid`/`didToPublicKey`/`sign`/`verify`/`verifyRawEd25519`/`sha256Hex`, `generateP256Keypair`/`p256Sign`/`p256Verify` (used for external-identity link-challenge proofs, SPEC.md §2.1), `canonicalize` (the canonical-JSON serializer every INAM signature is computed over), `computeReceiptId`/`buildSignableContent`, `computeVerificationId`/`buildSignableVerificationContent`, and the full set of wire-format types (`AgentRecord`, `ExecutionReceipt`, `JobRecord`, `JobOffer`, `ReputationResult`, `LinkChallenge`, `VerificationRecord`, ...).
|
|
76
|
+
|
|
77
|
+
## Building from source
|
|
78
|
+
|
|
79
|
+
This package's `src/` is the actual source the registry server and Worker import directly (see `../src/services/receiptService.ts` and `../worker/src/receiptService.ts`) — there is exactly one implementation of the crypto/canonicalization/receipt-content logic across all TypeScript runtimes in this repo. The Python SDK is an independently maintained, interop-tested port (see `../sdk-python/tests/test_interop.py`).
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
npm install
|
|
83
|
+
npm run build # emits dist/ (declaration + sourcemaps)
|
|
84
|
+
```
|
package/dist/client.d.ts
CHANGED
|
@@ -17,6 +17,17 @@ export declare class InamClient {
|
|
|
17
17
|
private request;
|
|
18
18
|
registerAgent(capabilities: string[], metadata?: Record<string, unknown>): Promise<AgentRecord>;
|
|
19
19
|
getAgent(id: string): Promise<AgentRecord>;
|
|
20
|
+
/** Retires this client's own INAM ID (SPEC.md §2.2). One-way — a revoked
|
|
21
|
+
* ID performs no further signed operations and drops out of search. This
|
|
22
|
+
* is the key-compromise / key-rotation-off tool: an INAM ID *is* its
|
|
23
|
+
* Ed25519 key, so a leaked key can't be re-pointed, only burned. Call
|
|
24
|
+
* this while you still control the key. */
|
|
25
|
+
revoke(reason: string): Promise<AgentRecord>;
|
|
26
|
+
/** Grants or revokes `targetAgentId`'s verifier status (SPEC.md §12.3).
|
|
27
|
+
* Only succeeds when this client's own keypair is the registry's
|
|
28
|
+
* configured operator identity — anyone else gets NOT_OPERATOR. There is
|
|
29
|
+
* no self-service path to becoming a verifier. */
|
|
30
|
+
setVerifierStatus(targetAgentId: string, authorized: boolean): Promise<AgentRecord>;
|
|
20
31
|
/** Links `a2a_endpoint` — the one protocol that isn't a key-derived
|
|
21
32
|
* identity, so there's nothing to prove control of beyond this request's
|
|
22
33
|
* own INAM signature. For `agentpass_id` / `aitp_id` / `passport_id`, use
|
|
@@ -47,6 +58,10 @@ export declare class InamClient {
|
|
|
47
58
|
/** Called by the requester (agent_a) to accept the worker's submitted result. */
|
|
48
59
|
acceptWork(receipt: ExecutionReceipt): Promise<ExecutionReceipt>;
|
|
49
60
|
disputeReceipt(receiptId: string, reason: string): Promise<ExecutionReceipt>;
|
|
61
|
+
/** Withdraw a dispute this client opened (SPEC.md §4.3) — moves the receipt
|
|
62
|
+
* `disputed` -> `finalized` so it counts toward reputation again. Only the
|
|
63
|
+
* party that opened the dispute may call this, and only once. */
|
|
64
|
+
resolveDispute(receiptId: string, note?: string): Promise<ExecutionReceipt>;
|
|
50
65
|
postJob(input: {
|
|
51
66
|
capability: string;
|
|
52
67
|
specHash: string;
|
package/dist/client.js
CHANGED
|
@@ -50,6 +50,25 @@ export class InamClient {
|
|
|
50
50
|
getAgent(id) {
|
|
51
51
|
return this.request("GET", `/v1/agents/${encodeURIComponent(id)}`);
|
|
52
52
|
}
|
|
53
|
+
/** Retires this client's own INAM ID (SPEC.md §2.2). One-way — a revoked
|
|
54
|
+
* ID performs no further signed operations and drops out of search. This
|
|
55
|
+
* is the key-compromise / key-rotation-off tool: an INAM ID *is* its
|
|
56
|
+
* Ed25519 key, so a leaked key can't be re-pointed, only burned. Call
|
|
57
|
+
* this while you still control the key. */
|
|
58
|
+
revoke(reason) {
|
|
59
|
+
return this.request("POST", `/v1/agents/${encodeURIComponent(this.keypair.did)}/revoke`, { reason }, {
|
|
60
|
+
idempotencyKey: `revoke:${this.keypair.did}`,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/** Grants or revokes `targetAgentId`'s verifier status (SPEC.md §12.3).
|
|
64
|
+
* Only succeeds when this client's own keypair is the registry's
|
|
65
|
+
* configured operator identity — anyone else gets NOT_OPERATOR. There is
|
|
66
|
+
* no self-service path to becoming a verifier. */
|
|
67
|
+
setVerifierStatus(targetAgentId, authorized) {
|
|
68
|
+
return this.request("POST", `/v1/agents/${encodeURIComponent(targetAgentId)}/verifier-status`, { authorized }, {
|
|
69
|
+
idempotencyKey: `verifier-status:${targetAgentId}:${authorized}:${Date.now()}`,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
53
72
|
/** Links `a2a_endpoint` — the one protocol that isn't a key-derived
|
|
54
73
|
* identity, so there's nothing to prove control of beyond this request's
|
|
55
74
|
* own INAM signature. For `agentpass_id` / `aitp_id` / `passport_id`, use
|
|
@@ -118,6 +137,14 @@ export class InamClient {
|
|
|
118
137
|
idempotencyKey: `dispute:${receiptId}`,
|
|
119
138
|
});
|
|
120
139
|
}
|
|
140
|
+
/** Withdraw a dispute this client opened (SPEC.md §4.3) — moves the receipt
|
|
141
|
+
* `disputed` -> `finalized` so it counts toward reputation again. Only the
|
|
142
|
+
* party that opened the dispute may call this, and only once. */
|
|
143
|
+
resolveDispute(receiptId, note) {
|
|
144
|
+
return this.request("POST", `/v1/receipts/${encodeURIComponent(receiptId)}/dispute/resolve`, note ? { note } : {}, {
|
|
145
|
+
idempotencyKey: `dispute-resolve:${receiptId}`,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
121
148
|
// ---- Jobs (SPEC.md §3) — optional pre-work discovery/offer/accept ----
|
|
122
149
|
postJob(input) {
|
|
123
150
|
return this.request("POST", "/v1/jobs", input, { idempotencyKey: `job:${input.capability}:${input.specHash}:${Date.now()}` });
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAgB,M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CAAC;IAED,eAAe,CAAC,EAAU;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,qBAAqB,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED,wBAAwB,CAAC,SAAiB;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,gBAAgB,kBAAkB,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC5F,CAAC;CACF"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Request-body validation schemas — the one other piece of logic every
|
|
4
|
+
* runtime in this repo must agree on precisely, same principle as
|
|
5
|
+
* canonical.ts and receiptContent.ts. Before this file existed, the Node
|
|
6
|
+
* reference server (src/routes/*.ts) validated every mutating request with
|
|
7
|
+
* these exact Zod schemas, while the Cloudflare Worker (worker/src/index.ts)
|
|
8
|
+
* only checked that each required field was *present*, never that its value
|
|
9
|
+
* was actually valid — e.g. a signed POST /v1/verifications with
|
|
10
|
+
* `{ "result": "banana", "score": 999 }` would be rejected by the Node
|
|
11
|
+
* server but accepted by the Worker, silently writing an invalid `result`
|
|
12
|
+
* value into D1 forever. Both runtimes now import from here instead of
|
|
13
|
+
* defining their own copies, so "same request -> same validation -> same
|
|
14
|
+
* error code" is a property of sharing one schema, not of two
|
|
15
|
+
* independently-maintained ones happening to agree today.
|
|
16
|
+
*/
|
|
17
|
+
export declare const setVerifierStatusSchema: z.ZodObject<{
|
|
18
|
+
authorized: z.ZodBoolean;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
authorized: boolean;
|
|
21
|
+
}, {
|
|
22
|
+
authorized: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const revokeAgentSchema: z.ZodObject<{
|
|
25
|
+
reason: z.ZodString;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
reason: string;
|
|
28
|
+
}, {
|
|
29
|
+
reason: string;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const registerAgentSchema: z.ZodObject<{
|
|
32
|
+
capabilities: z.ZodArray<z.ZodString, "many">;
|
|
33
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
capabilities: string[];
|
|
36
|
+
metadata?: Record<string, unknown> | undefined;
|
|
37
|
+
}, {
|
|
38
|
+
capabilities: string[];
|
|
39
|
+
metadata?: Record<string, unknown> | undefined;
|
|
40
|
+
}>;
|
|
41
|
+
export declare const linkChallengeSchema: z.ZodObject<{
|
|
42
|
+
protocol: z.ZodEnum<["agentpass_id", "aitp_id", "passport_id"]>;
|
|
43
|
+
externalPublicKey: z.ZodString;
|
|
44
|
+
keyType: z.ZodEnum<["ed25519", "p256"]>;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
protocol: "agentpass_id" | "aitp_id" | "passport_id";
|
|
47
|
+
externalPublicKey: string;
|
|
48
|
+
keyType: "ed25519" | "p256";
|
|
49
|
+
}, {
|
|
50
|
+
protocol: "agentpass_id" | "aitp_id" | "passport_id";
|
|
51
|
+
externalPublicKey: string;
|
|
52
|
+
keyType: "ed25519" | "p256";
|
|
53
|
+
}>;
|
|
54
|
+
export declare const linkSchema: z.ZodObject<{
|
|
55
|
+
protocol: z.ZodEnum<["agentpass_id", "aitp_id", "passport_id", "a2a_endpoint"]>;
|
|
56
|
+
value: z.ZodString;
|
|
57
|
+
challengeId: z.ZodOptional<z.ZodString>;
|
|
58
|
+
proofSignature: z.ZodOptional<z.ZodString>;
|
|
59
|
+
}, "strip", z.ZodTypeAny, {
|
|
60
|
+
value: string;
|
|
61
|
+
protocol: "agentpass_id" | "aitp_id" | "passport_id" | "a2a_endpoint";
|
|
62
|
+
challengeId?: string | undefined;
|
|
63
|
+
proofSignature?: string | undefined;
|
|
64
|
+
}, {
|
|
65
|
+
value: string;
|
|
66
|
+
protocol: "agentpass_id" | "aitp_id" | "passport_id" | "a2a_endpoint";
|
|
67
|
+
challengeId?: string | undefined;
|
|
68
|
+
proofSignature?: string | undefined;
|
|
69
|
+
}>;
|
|
70
|
+
export declare const postJobSchema: z.ZodObject<{
|
|
71
|
+
capability: z.ZodString;
|
|
72
|
+
specHash: z.ZodString;
|
|
73
|
+
budget: z.ZodOptional<z.ZodObject<{
|
|
74
|
+
amount: z.ZodOptional<z.ZodString>;
|
|
75
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
amount?: string | undefined;
|
|
78
|
+
currency?: string | undefined;
|
|
79
|
+
}, {
|
|
80
|
+
amount?: string | undefined;
|
|
81
|
+
currency?: string | undefined;
|
|
82
|
+
}>>;
|
|
83
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
capability: string;
|
|
86
|
+
specHash: string;
|
|
87
|
+
budget?: {
|
|
88
|
+
amount?: string | undefined;
|
|
89
|
+
currency?: string | undefined;
|
|
90
|
+
} | undefined;
|
|
91
|
+
expiresAt?: string | undefined;
|
|
92
|
+
}, {
|
|
93
|
+
capability: string;
|
|
94
|
+
specHash: string;
|
|
95
|
+
budget?: {
|
|
96
|
+
amount?: string | undefined;
|
|
97
|
+
currency?: string | undefined;
|
|
98
|
+
} | undefined;
|
|
99
|
+
expiresAt?: string | undefined;
|
|
100
|
+
}>;
|
|
101
|
+
export declare const offerSchema: z.ZodObject<{
|
|
102
|
+
message: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
message?: string | undefined;
|
|
105
|
+
}, {
|
|
106
|
+
message?: string | undefined;
|
|
107
|
+
}>;
|
|
108
|
+
export declare const acceptOfferSchema: z.ZodObject<{
|
|
109
|
+
agentId: z.ZodString;
|
|
110
|
+
}, "strip", z.ZodTypeAny, {
|
|
111
|
+
agentId: string;
|
|
112
|
+
}, {
|
|
113
|
+
agentId: string;
|
|
114
|
+
}>;
|
|
115
|
+
export declare const draftReceiptSchema: z.ZodObject<{
|
|
116
|
+
jobId: z.ZodString;
|
|
117
|
+
agentAId: z.ZodString;
|
|
118
|
+
task: z.ZodObject<{
|
|
119
|
+
capability: z.ZodString;
|
|
120
|
+
specHash: z.ZodString;
|
|
121
|
+
createdAt: z.ZodString;
|
|
122
|
+
}, "strip", z.ZodTypeAny, {
|
|
123
|
+
capability: string;
|
|
124
|
+
specHash: string;
|
|
125
|
+
createdAt: string;
|
|
126
|
+
}, {
|
|
127
|
+
capability: string;
|
|
128
|
+
specHash: string;
|
|
129
|
+
createdAt: string;
|
|
130
|
+
}>;
|
|
131
|
+
result: z.ZodObject<{
|
|
132
|
+
outputHash: z.ZodString;
|
|
133
|
+
outputUri: z.ZodOptional<z.ZodString>;
|
|
134
|
+
completedAt: z.ZodString;
|
|
135
|
+
}, "strip", z.ZodTypeAny, {
|
|
136
|
+
outputHash: string;
|
|
137
|
+
completedAt: string;
|
|
138
|
+
outputUri?: string | undefined;
|
|
139
|
+
}, {
|
|
140
|
+
outputHash: string;
|
|
141
|
+
completedAt: string;
|
|
142
|
+
outputUri?: string | undefined;
|
|
143
|
+
}>;
|
|
144
|
+
settlement: z.ZodOptional<z.ZodObject<{
|
|
145
|
+
amount: z.ZodOptional<z.ZodString>;
|
|
146
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
147
|
+
paymentRef: z.ZodOptional<z.ZodString>;
|
|
148
|
+
}, "strip", z.ZodTypeAny, {
|
|
149
|
+
amount?: string | undefined;
|
|
150
|
+
currency?: string | undefined;
|
|
151
|
+
paymentRef?: string | undefined;
|
|
152
|
+
}, {
|
|
153
|
+
amount?: string | undefined;
|
|
154
|
+
currency?: string | undefined;
|
|
155
|
+
paymentRef?: string | undefined;
|
|
156
|
+
}>>;
|
|
157
|
+
verification: z.ZodObject<{
|
|
158
|
+
method: z.ZodEnum<["payer_confirmation", "independent_validator", "test_suite_pass"]>;
|
|
159
|
+
verifier: z.ZodOptional<z.ZodString>;
|
|
160
|
+
outcome: z.ZodEnum<["success", "partial", "failed"]>;
|
|
161
|
+
}, "strip", z.ZodTypeAny, {
|
|
162
|
+
method: "payer_confirmation" | "independent_validator" | "test_suite_pass";
|
|
163
|
+
outcome: "success" | "partial" | "failed";
|
|
164
|
+
verifier?: string | undefined;
|
|
165
|
+
}, {
|
|
166
|
+
method: "payer_confirmation" | "independent_validator" | "test_suite_pass";
|
|
167
|
+
outcome: "success" | "partial" | "failed";
|
|
168
|
+
verifier?: string | undefined;
|
|
169
|
+
}>;
|
|
170
|
+
signature: z.ZodString;
|
|
171
|
+
}, "strip", z.ZodTypeAny, {
|
|
172
|
+
jobId: string;
|
|
173
|
+
task: {
|
|
174
|
+
capability: string;
|
|
175
|
+
specHash: string;
|
|
176
|
+
createdAt: string;
|
|
177
|
+
};
|
|
178
|
+
result: {
|
|
179
|
+
outputHash: string;
|
|
180
|
+
completedAt: string;
|
|
181
|
+
outputUri?: string | undefined;
|
|
182
|
+
};
|
|
183
|
+
verification: {
|
|
184
|
+
method: "payer_confirmation" | "independent_validator" | "test_suite_pass";
|
|
185
|
+
outcome: "success" | "partial" | "failed";
|
|
186
|
+
verifier?: string | undefined;
|
|
187
|
+
};
|
|
188
|
+
agentAId: string;
|
|
189
|
+
signature: string;
|
|
190
|
+
settlement?: {
|
|
191
|
+
amount?: string | undefined;
|
|
192
|
+
currency?: string | undefined;
|
|
193
|
+
paymentRef?: string | undefined;
|
|
194
|
+
} | undefined;
|
|
195
|
+
}, {
|
|
196
|
+
jobId: string;
|
|
197
|
+
task: {
|
|
198
|
+
capability: string;
|
|
199
|
+
specHash: string;
|
|
200
|
+
createdAt: string;
|
|
201
|
+
};
|
|
202
|
+
result: {
|
|
203
|
+
outputHash: string;
|
|
204
|
+
completedAt: string;
|
|
205
|
+
outputUri?: string | undefined;
|
|
206
|
+
};
|
|
207
|
+
verification: {
|
|
208
|
+
method: "payer_confirmation" | "independent_validator" | "test_suite_pass";
|
|
209
|
+
outcome: "success" | "partial" | "failed";
|
|
210
|
+
verifier?: string | undefined;
|
|
211
|
+
};
|
|
212
|
+
agentAId: string;
|
|
213
|
+
signature: string;
|
|
214
|
+
settlement?: {
|
|
215
|
+
amount?: string | undefined;
|
|
216
|
+
currency?: string | undefined;
|
|
217
|
+
paymentRef?: string | undefined;
|
|
218
|
+
} | undefined;
|
|
219
|
+
}>;
|
|
220
|
+
export declare const countersignSchema: z.ZodObject<{
|
|
221
|
+
signature: z.ZodString;
|
|
222
|
+
}, "strip", z.ZodTypeAny, {
|
|
223
|
+
signature: string;
|
|
224
|
+
}, {
|
|
225
|
+
signature: string;
|
|
226
|
+
}>;
|
|
227
|
+
export declare const disputeSchema: z.ZodObject<{
|
|
228
|
+
reason: z.ZodString;
|
|
229
|
+
}, "strip", z.ZodTypeAny, {
|
|
230
|
+
reason: string;
|
|
231
|
+
}, {
|
|
232
|
+
reason: string;
|
|
233
|
+
}>;
|
|
234
|
+
export declare const resolveDisputeSchema: z.ZodObject<{
|
|
235
|
+
note: z.ZodOptional<z.ZodString>;
|
|
236
|
+
}, "strip", z.ZodTypeAny, {
|
|
237
|
+
note?: string | undefined;
|
|
238
|
+
}, {
|
|
239
|
+
note?: string | undefined;
|
|
240
|
+
}>;
|
|
241
|
+
export declare const submitVerificationSchema: z.ZodObject<{
|
|
242
|
+
receiptId: z.ZodString;
|
|
243
|
+
verifier: z.ZodString;
|
|
244
|
+
method: z.ZodEnum<["deterministic", "agent_attestation"]>;
|
|
245
|
+
outputHash: z.ZodString;
|
|
246
|
+
result: z.ZodEnum<["verified", "rejected"]>;
|
|
247
|
+
score: z.ZodOptional<z.ZodNumber>;
|
|
248
|
+
evidenceUri: z.ZodOptional<z.ZodString>;
|
|
249
|
+
signature: z.ZodString;
|
|
250
|
+
}, "strip", z.ZodTypeAny, {
|
|
251
|
+
receiptId: string;
|
|
252
|
+
result: "verified" | "rejected";
|
|
253
|
+
method: "deterministic" | "agent_attestation";
|
|
254
|
+
verifier: string;
|
|
255
|
+
outputHash: string;
|
|
256
|
+
signature: string;
|
|
257
|
+
score?: number | undefined;
|
|
258
|
+
evidenceUri?: string | undefined;
|
|
259
|
+
}, {
|
|
260
|
+
receiptId: string;
|
|
261
|
+
result: "verified" | "rejected";
|
|
262
|
+
method: "deterministic" | "agent_attestation";
|
|
263
|
+
verifier: string;
|
|
264
|
+
outputHash: string;
|
|
265
|
+
signature: string;
|
|
266
|
+
score?: number | undefined;
|
|
267
|
+
evidenceUri?: string | undefined;
|
|
268
|
+
}>;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Request-body validation schemas — the one other piece of logic every
|
|
4
|
+
* runtime in this repo must agree on precisely, same principle as
|
|
5
|
+
* canonical.ts and receiptContent.ts. Before this file existed, the Node
|
|
6
|
+
* reference server (src/routes/*.ts) validated every mutating request with
|
|
7
|
+
* these exact Zod schemas, while the Cloudflare Worker (worker/src/index.ts)
|
|
8
|
+
* only checked that each required field was *present*, never that its value
|
|
9
|
+
* was actually valid — e.g. a signed POST /v1/verifications with
|
|
10
|
+
* `{ "result": "banana", "score": 999 }` would be rejected by the Node
|
|
11
|
+
* server but accepted by the Worker, silently writing an invalid `result`
|
|
12
|
+
* value into D1 forever. Both runtimes now import from here instead of
|
|
13
|
+
* defining their own copies, so "same request -> same validation -> same
|
|
14
|
+
* error code" is a property of sharing one schema, not of two
|
|
15
|
+
* independently-maintained ones happening to agree today.
|
|
16
|
+
*/
|
|
17
|
+
export const setVerifierStatusSchema = z.object({
|
|
18
|
+
authorized: z.boolean(),
|
|
19
|
+
});
|
|
20
|
+
export const revokeAgentSchema = z.object({
|
|
21
|
+
reason: z.string().min(1).max(500),
|
|
22
|
+
});
|
|
23
|
+
export const registerAgentSchema = z.object({
|
|
24
|
+
capabilities: z.array(z.string().min(1)).min(1),
|
|
25
|
+
metadata: z.record(z.unknown()).optional(),
|
|
26
|
+
});
|
|
27
|
+
export const linkChallengeSchema = z.object({
|
|
28
|
+
protocol: z.enum(["agentpass_id", "aitp_id", "passport_id"]),
|
|
29
|
+
externalPublicKey: z.string().min(1),
|
|
30
|
+
keyType: z.enum(["ed25519", "p256"]),
|
|
31
|
+
});
|
|
32
|
+
export const linkSchema = z.object({
|
|
33
|
+
protocol: z.enum(["agentpass_id", "aitp_id", "passport_id", "a2a_endpoint"]),
|
|
34
|
+
value: z.string().min(1),
|
|
35
|
+
challengeId: z.string().min(1).optional(),
|
|
36
|
+
proofSignature: z.string().min(1).optional(),
|
|
37
|
+
});
|
|
38
|
+
// An audit (SPEC.md v0.11) found `settlement.amount`/`currency` and a job's
|
|
39
|
+
// `budget` were `z.string()` with no shape check: `{ amount: "banana" }` or a
|
|
40
|
+
// negative amount passed validation, then `Number("banana")` -> NaN poisoned
|
|
41
|
+
// the reputation volume sums. `amount` is a non-negative decimal string;
|
|
42
|
+
// `currency` is a short code-shaped token (ISO-4217 like "USD" or a
|
|
43
|
+
// stablecoin ticker like "USDC"), not free-form prose.
|
|
44
|
+
const moneyAmount = z.string().regex(/^\d+(\.\d+)?$/, "must be a non-negative decimal string");
|
|
45
|
+
const currencyCode = z.string().regex(/^[A-Za-z0-9]{1,16}$/, "must be a short currency code");
|
|
46
|
+
const moneyFields = { amount: moneyAmount.optional(), currency: currencyCode.optional() };
|
|
47
|
+
export const postJobSchema = z.object({
|
|
48
|
+
capability: z.string().min(1),
|
|
49
|
+
specHash: z.string().min(1),
|
|
50
|
+
budget: z.object({ ...moneyFields }).optional(),
|
|
51
|
+
expiresAt: z.string().optional(),
|
|
52
|
+
});
|
|
53
|
+
export const offerSchema = z.object({ message: z.string().optional() });
|
|
54
|
+
export const acceptOfferSchema = z.object({ agentId: z.string().min(1) });
|
|
55
|
+
// `{ offset: true }` accepts both JS's `Date.prototype.toISOString()` output
|
|
56
|
+
// ("...526Z") and Python's `datetime.isoformat()` output for a UTC-aware
|
|
57
|
+
// datetime ("...459111+00:00") -- confirmed by hand, since these differ in
|
|
58
|
+
// both suffix style and fractional-second precision and an audit's
|
|
59
|
+
// future-dating finding (SPEC.md v0.7 / CHANGELOG) made date validation here
|
|
60
|
+
// necessary. Bounds/ordering (not-in-the-future, completedAt >= createdAt)
|
|
61
|
+
// are enforced in receiptService.ts, not here -- this only validates shape,
|
|
62
|
+
// consistent with the schema/business-rule split elsewhere in this file.
|
|
63
|
+
const isoDateTime = z.string().datetime({ offset: true });
|
|
64
|
+
export const draftReceiptSchema = z.object({
|
|
65
|
+
jobId: z.string().min(1),
|
|
66
|
+
agentAId: z.string().min(1),
|
|
67
|
+
task: z.object({
|
|
68
|
+
capability: z.string().min(1),
|
|
69
|
+
specHash: z.string().min(1),
|
|
70
|
+
createdAt: isoDateTime,
|
|
71
|
+
}),
|
|
72
|
+
result: z.object({
|
|
73
|
+
outputHash: z.string().min(1),
|
|
74
|
+
outputUri: z.string().optional(),
|
|
75
|
+
completedAt: isoDateTime,
|
|
76
|
+
}),
|
|
77
|
+
settlement: z
|
|
78
|
+
.object({
|
|
79
|
+
paymentRef: z.string().optional(),
|
|
80
|
+
...moneyFields,
|
|
81
|
+
})
|
|
82
|
+
.optional(),
|
|
83
|
+
verification: z.object({
|
|
84
|
+
method: z.enum(["payer_confirmation", "independent_validator", "test_suite_pass"]),
|
|
85
|
+
verifier: z.string().optional(),
|
|
86
|
+
outcome: z.enum(["success", "partial", "failed"]),
|
|
87
|
+
}),
|
|
88
|
+
signature: z.string().min(1),
|
|
89
|
+
});
|
|
90
|
+
export const countersignSchema = z.object({ signature: z.string().min(1) });
|
|
91
|
+
export const disputeSchema = z.object({ reason: z.string().min(1) });
|
|
92
|
+
export const resolveDisputeSchema = z.object({ note: z.string().max(500).optional() });
|
|
93
|
+
export const submitVerificationSchema = z.object({
|
|
94
|
+
receiptId: z.string().min(1),
|
|
95
|
+
verifier: z.string().min(1),
|
|
96
|
+
method: z.enum(["deterministic", "agent_attestation"]),
|
|
97
|
+
outputHash: z.string().min(1),
|
|
98
|
+
result: z.enum(["verified", "rejected"]),
|
|
99
|
+
score: z.number().min(0).max(1).optional(),
|
|
100
|
+
evidenceUri: z.string().optional(),
|
|
101
|
+
signature: z.string().min(1),
|
|
102
|
+
});
|
|
103
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/core/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;GAcG;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE;CACxB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;CACnC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/C,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;IAC5D,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACpC,OAAO,EAA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AAG,CAAC,CAAC,CAAC;IAC3B,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC;IACtD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACxC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC1C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC7B,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settlement-amount aggregation for the reputation model (SPEC.md §5.3).
|
|
3
|
+
*
|
|
4
|
+
* An audit found `components.volumeUsd` summed every finalized receipt's
|
|
5
|
+
* `settlement.amount` regardless of `settlement.currency` — a 1000 TRY receipt
|
|
6
|
+
* added 1000 to a field labelled USD, right next to a 10 USDC one. INAM does
|
|
7
|
+
* no FX and takes no position on stablecoin pegs (§10 — payments/settlement
|
|
8
|
+
* enforcement is out of scope), so the honest fix is to bucket volume by the
|
|
9
|
+
* currency it was actually denominated in and never cross-sum.
|
|
10
|
+
*
|
|
11
|
+
* Shared by both runtimes (src/, worker/) so the two agree by construction,
|
|
12
|
+
* same principle as canonical.ts / receiptContent.ts / schemas.ts.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Normalize a free-form `settlement.currency` to a bucket key. Missing or
|
|
16
|
+
* blank is treated as `"USD"` — `volumeUsd` has always implicitly assumed an
|
|
17
|
+
* untagged amount was USD, and receipts predating any currency discipline
|
|
18
|
+
* still need to land somewhere sensible.
|
|
19
|
+
*/
|
|
20
|
+
export declare function normalizeCurrency(currency?: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Parse a `settlement.amount` string to a non-negative finite number, or 0.
|
|
23
|
+
* A registry MUST NOT let a malformed or negative amount poison the running
|
|
24
|
+
* volume sums (same principle as the non-finite-weight guard in §5.2) — the
|
|
25
|
+
* reference schema rejects such values at ingestion, but data from a
|
|
26
|
+
* non-conformant registry still flows through here.
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseSettlementAmount(amount?: string): number;
|
|
29
|
+
/** Add one receipt's settlement into a currency→total map, in place. */
|
|
30
|
+
export declare function accrueVolume(byCurrency: Record<string, number>, settlement?: {
|
|
31
|
+
amount?: string;
|
|
32
|
+
currency?: string;
|
|
33
|
+
}): void;
|
|
34
|
+
/** Round every bucket to 2 decimal places — these are money totals, not raw
|
|
35
|
+
* floats, and `0.1 + 0.2` should not surface in an API response. */
|
|
36
|
+
export declare function roundVolumes(byCurrency: Record<string, number>): Record<string, number>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settlement-amount aggregation for the reputation model (SPEC.md §5.3).
|
|
3
|
+
*
|
|
4
|
+
* An audit found `components.volumeUsd` summed every finalized receipt's
|
|
5
|
+
* `settlement.amount` regardless of `settlement.currency` — a 1000 TRY receipt
|
|
6
|
+
* added 1000 to a field labelled USD, right next to a 10 USDC one. INAM does
|
|
7
|
+
* no FX and takes no position on stablecoin pegs (§10 — payments/settlement
|
|
8
|
+
* enforcement is out of scope), so the honest fix is to bucket volume by the
|
|
9
|
+
* currency it was actually denominated in and never cross-sum.
|
|
10
|
+
*
|
|
11
|
+
* Shared by both runtimes (src/, worker/) so the two agree by construction,
|
|
12
|
+
* same principle as canonical.ts / receiptContent.ts / schemas.ts.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Normalize a free-form `settlement.currency` to a bucket key. Missing or
|
|
16
|
+
* blank is treated as `"USD"` — `volumeUsd` has always implicitly assumed an
|
|
17
|
+
* untagged amount was USD, and receipts predating any currency discipline
|
|
18
|
+
* still need to land somewhere sensible.
|
|
19
|
+
*/
|
|
20
|
+
export function normalizeCurrency(currency) {
|
|
21
|
+
const c = (currency ?? "").trim().toUpperCase();
|
|
22
|
+
return c === "" ? "USD" : c;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Parse a `settlement.amount` string to a non-negative finite number, or 0.
|
|
26
|
+
* A registry MUST NOT let a malformed or negative amount poison the running
|
|
27
|
+
* volume sums (same principle as the non-finite-weight guard in §5.2) — the
|
|
28
|
+
* reference schema rejects such values at ingestion, but data from a
|
|
29
|
+
* non-conformant registry still flows through here.
|
|
30
|
+
*/
|
|
31
|
+
export function parseSettlementAmount(amount) {
|
|
32
|
+
const n = Number(amount ?? 0);
|
|
33
|
+
return Number.isFinite(n) && n >= 0 ? n : 0;
|
|
34
|
+
}
|
|
35
|
+
/** Add one receipt's settlement into a currency→total map, in place. */
|
|
36
|
+
export function accrueVolume(byCurrency, settlement) {
|
|
37
|
+
const amount = parseSettlementAmount(settlement?.amount);
|
|
38
|
+
if (amount === 0)
|
|
39
|
+
return;
|
|
40
|
+
const key = normalizeCurrency(settlement?.currency);
|
|
41
|
+
byCurrency[key] = (byCurrency[key] ?? 0) + amount;
|
|
42
|
+
}
|
|
43
|
+
/** Round every bucket to 2 decimal places — these are money totals, not raw
|
|
44
|
+
* floats, and `0.1 + 0.2` should not surface in an API response. */
|
|
45
|
+
export function roundVolumes(byCurrency) {
|
|
46
|
+
const out = {};
|
|
47
|
+
for (const [k, v] of Object.entries(byCurrency))
|
|
48
|
+
out[k] = Math.round(v * 100) / 100;
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=settlementVolume.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settlementVolume.js","sourceRoot":"","sources":["../../src/core/settlementVolume.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;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{ generateP256Keypair, p256Sign, p256Verify, type P256Keypair } from "./c
|
|
|
4
4
|
export { canonicalize } from "./crypto/canonical.js";
|
|
5
5
|
export { computeReceiptId, buildSignableContent, type ReceiptContentInput } from "./core/receiptContent.js";
|
|
6
6
|
export { computeVerificationId, buildSignableVerificationContent, type VerificationContentInput } from "./core/verificationContent.js";
|
|
7
|
-
export
|
|
7
|
+
export { registerAgentSchema, linkChallengeSchema, linkSchema, postJobSchema, offerSchema, acceptOfferSchema, draftReceiptSchema, countersignSchema, disputeSchema, submitVerificationSchema, setVerifierStatusSchema, } from "./core/schemas.js";
|
|
8
|
+
export type { LinkedIdentities, ExternalKeyType, LinkChallenge, AgentRecord, VerificationMethod, ReceiptOutcome, ReceiptStatus, DisputeStatus, ExecutionReceipt, SignableReceiptContent, ReputationComponents, ReputationRoleBreakdown, ReputationResult, JobStatus, JobOffer, JobRecord, IndependentVerificationMethod, VerificationResult, VerificationRecord, } from "./types.js";
|
package/dist/index.js
CHANGED
|
@@ -4,4 +4,10 @@ export { generateP256Keypair, p256Sign, p256Verify } from "./crypto/p256.js";
|
|
|
4
4
|
export { canonicalize } from "./crypto/canonical.js";
|
|
5
5
|
export { computeReceiptId, buildSignableContent } from "./core/receiptContent.js";
|
|
6
6
|
export { computeVerificationId, buildSignableVerificationContent } from "./core/verificationContent.js";
|
|
7
|
+
// Request-body validation schemas — shared by the Node reference server and
|
|
8
|
+
// the Cloudflare Worker so both accept/reject the exact same requests (see
|
|
9
|
+
// core/schemas.ts's own header comment for why this exists). Exported
|
|
10
|
+
// publicly too: a caller building requests by hand (rather than through
|
|
11
|
+
// InamClient) can validate a payload client-side before sending it.
|
|
12
|
+
export { registerAgentSchema, linkChallengeSchema, linkSchema, postJobSchema, offerSchema, acceptOfferSchema, draftReceiptSchema, countersignSchema, disputeSchema, submitVerificationSchema, setVerifierStatusSchema, } from "./core/schemas.js";
|
|
7
13
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,IAAI,EACJ,MAAM,EACN,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,UAAU,EACV,KAAK,EACL,OAAO,GAER,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,UAAU,EAAoB,MAAM,kBAAkB,CAAC;AAE/F,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAA4B,MAAM,0BAA0B,CAAC;AAE5G,OAAO,EAAE,qBAAqB,EAAE,gCAAgC,EAAiC,MAAM,+BAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,IAAI,EACJ,MAAM,EACN,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,UAAU,EACV,KAAK,EACL,OAAO,GAER,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,UAAU,EAAoB,MAAM,kBAAkB,CAAC;AAE/F,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAA4B,MAAM,0BAA0B,CAAC;AAE5G,OAAO,EAAE,qBAAqB,EAAE,gCAAgC,EAAiC,MAAM,+BAA+B,CAAC;AAEvI,4EAA4E;AAC5E,2EAA2E;AAC3E,sEAAsE;AACtE,wEAAwE;AACxE,oEAAoE;AACpE,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,UAAU,EACV,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -15,6 +15,28 @@ export interface LinkedIdentities {
|
|
|
15
15
|
* matches ATTP (the protocol AgentPass is built on); Ed25519 is offered as
|
|
16
16
|
* the same primitive INAM's own did:key already uses. */
|
|
17
17
|
export type ExternalKeyType = "ed25519" | "p256";
|
|
18
|
+
/** How one `linked` entry was verified when it was recorded (SPEC.md §2.1).
|
|
19
|
+
* - `key_possession`: the caller proved control of `externalPublicKey` via a
|
|
20
|
+
* signed challenge at `verifiedAt`. This does NOT confirm that key is the
|
|
21
|
+
* one the external system currently recognizes as authoritative for the
|
|
22
|
+
* identity — live cross-registry resolution is out of scope (SPEC.md §10).
|
|
23
|
+
* - `unverified_claim`: an INAM-signed assertion only, no external proof
|
|
24
|
+
* (`a2a_endpoint`, a service URL rather than a key-derived identity). */
|
|
25
|
+
export interface LinkProof {
|
|
26
|
+
method: "key_possession" | "unverified_claim";
|
|
27
|
+
verifiedAt: string;
|
|
28
|
+
keyType?: ExternalKeyType;
|
|
29
|
+
externalPublicKey?: string;
|
|
30
|
+
}
|
|
31
|
+
/** Per-protocol assurance metadata for `linked`, same keys as
|
|
32
|
+
* `LinkedIdentities` (SPEC.md §2.1). A missing key means that identity isn't
|
|
33
|
+
* linked. */
|
|
34
|
+
export interface LinkedIdentityProofs {
|
|
35
|
+
agentpass_id?: LinkProof;
|
|
36
|
+
aitp_id?: LinkProof;
|
|
37
|
+
passport_id?: LinkProof;
|
|
38
|
+
a2a_endpoint?: LinkProof;
|
|
39
|
+
}
|
|
18
40
|
/** Response shape from POST /agents/:id/link/challenge. */
|
|
19
41
|
export interface LinkChallenge {
|
|
20
42
|
challengeId: string;
|
|
@@ -26,8 +48,22 @@ export interface AgentRecord {
|
|
|
26
48
|
capabilities: string[];
|
|
27
49
|
metadata: Record<string, unknown>;
|
|
28
50
|
linked: LinkedIdentities;
|
|
51
|
+
/** Per-protocol assurance metadata for `linked` (SPEC.md §2.1) — lets a
|
|
52
|
+
* consumer tell a challenge-verified link from an unverified claim. */
|
|
53
|
+
linkedProof: LinkedIdentityProofs;
|
|
29
54
|
stakeUsd: number;
|
|
30
55
|
createdAt: string;
|
|
56
|
+
/** Whether the registry operator has authorized this agent as a verifier
|
|
57
|
+
* (SPEC.md §12.3) — false by default at registration. An agent cannot make
|
|
58
|
+
* itself a verifier by self-registering; only the registry's configured
|
|
59
|
+
* operator identity can grant this via POST /agents/:id/verifier-status. */
|
|
60
|
+
isAuthorizedVerifier: boolean;
|
|
61
|
+
/** ISO timestamp the agent retired this INAM ID via POST /agents/:id/revoke
|
|
62
|
+
* (SPEC.md §2.2) — a one-way, self-signed tombstone for a compromised or
|
|
63
|
+
* rotated-off key. Absent for an active agent. A revoked ID can perform no
|
|
64
|
+
* further signed operations and is excluded from search. */
|
|
65
|
+
revokedAt?: string;
|
|
66
|
+
revocationReason?: string;
|
|
31
67
|
}
|
|
32
68
|
export type VerificationMethod = "payer_confirmation" | "independent_validator" | "test_suite_pass";
|
|
33
69
|
export type ReceiptOutcome = "success" | "partial" | "failed";
|
|
@@ -69,6 +105,9 @@ export interface ExecutionReceipt {
|
|
|
69
105
|
status: DisputeStatus;
|
|
70
106
|
reason?: string;
|
|
71
107
|
windowClosesAt: string;
|
|
108
|
+
openedBy?: string;
|
|
109
|
+
resolvedAt?: string;
|
|
110
|
+
resolution?: string;
|
|
72
111
|
};
|
|
73
112
|
signatures: {
|
|
74
113
|
agentB?: string;
|
|
@@ -83,18 +122,47 @@ export type SignableReceiptContent = Omit<ExecutionReceipt, "signatures" | "stat
|
|
|
83
122
|
windowClosesAt: string;
|
|
84
123
|
};
|
|
85
124
|
};
|
|
125
|
+
/** Weighted receipt count/success-rate/volume for one side of an agent's
|
|
126
|
+
* history — see ReputationComponents.asProvider/asRequester. Same weighting
|
|
127
|
+
* (pairWeight * counterpartyTrust * decay * attestationBoost) as the
|
|
128
|
+
* aggregate trustScore, just filtered to receipts where this agent held
|
|
129
|
+
* that role. Not a separate 0-100 score (that's real scoring-model design
|
|
130
|
+
* work, not done here) — the raw signal an aggregate trustScore currently
|
|
131
|
+
* merges away. */
|
|
132
|
+
export interface ReputationRoleBreakdown {
|
|
133
|
+
receipts: number;
|
|
134
|
+
successRate: number;
|
|
135
|
+
/** Volume denominated in USD (or untagged) only — see
|
|
136
|
+
* ReputationComponents.volumeUsd/volumeByCurrency. */
|
|
137
|
+
volumeUsd: number;
|
|
138
|
+
/** Settlement volume bucketed by `settlement.currency`, never cross-summed. */
|
|
139
|
+
volumeByCurrency: Record<string, number>;
|
|
140
|
+
}
|
|
86
141
|
export interface ReputationComponents {
|
|
87
142
|
eigenWeight: number;
|
|
88
143
|
verifiedReceipts: number;
|
|
89
144
|
rawReceipts: number;
|
|
90
145
|
successRate: number;
|
|
146
|
+
/** Total settlement volume across finalized receipts denominated in USD
|
|
147
|
+
* (currency `"USD"` or untagged) only. An audit found this field summed
|
|
148
|
+
* every currency's raw `settlement.amount` into one USD-labelled number;
|
|
149
|
+
* INAM does no FX, so non-USD volume now lives only in `volumeByCurrency`. */
|
|
91
150
|
volumeUsd: number;
|
|
151
|
+
/** Settlement volume bucketed by normalized `settlement.currency`
|
|
152
|
+
* (uppercased; untagged -> `"USD"`), never converted or cross-summed. */
|
|
153
|
+
volumeByCurrency: Record<string, number>;
|
|
92
154
|
stakeUsd: number;
|
|
93
155
|
decayHalfLifeDays: number;
|
|
94
156
|
/** Count of finalized receipts backed by at least one `verified` Verification
|
|
95
157
|
* (SPEC.md §12.5) — distinct from `verifiedReceipts` above, which really
|
|
96
158
|
* means "two-party finalized," not independently attested. */
|
|
97
159
|
attestedReceipts: number;
|
|
160
|
+
/** This agent's history specifically as agentB (the one who did the work)
|
|
161
|
+
* on its finalized receipts (SPEC.md §5.3). */
|
|
162
|
+
asProvider: ReputationRoleBreakdown;
|
|
163
|
+
/** This agent's history specifically as agentA (the one who requested and
|
|
164
|
+
* countersigned the work) on its finalized receipts (SPEC.md §5.3). */
|
|
165
|
+
asRequester: ReputationRoleBreakdown;
|
|
98
166
|
}
|
|
99
167
|
export interface ReputationResult {
|
|
100
168
|
trustScore: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inamprotocol",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Reference TypeScript/JavaScript SDK for the INAM Protocol — agent identity, execution receipts, jobs, and reputation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"@noble/curves": "^2.3.0",
|
|
44
44
|
"@noble/ed25519": "^2.1.0",
|
|
45
45
|
"@noble/hashes": "^1.5.0",
|
|
46
|
-
"bs58": "^6.0.0"
|
|
46
|
+
"bs58": "^6.0.0",
|
|
47
|
+
"zod": "^3.23.8"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
50
|
"@types/node": "^22.5.0",
|