@atcn/sdk 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builders.d.ts +3 -1
- package/dist/builders.js +2 -1
- package/dist/client.d.ts +7 -2
- package/dist/client.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/subledger.d.ts +69 -5
- package/dist/subledger.js +4 -0
- package/package.json +5 -5
package/dist/builders.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Deliverable, type EvidenceEnvelope, type ObligationTerms, type PolicyTemplate } from "@atcn/schema";
|
|
1
|
+
import { type Deliverable, type EvidenceEnvelope, type ObligationTerms, type PolicyTemplate, type SkillRef } from "@atcn/schema";
|
|
2
2
|
export interface TermsInput {
|
|
3
3
|
parentObligationId?: string | null;
|
|
4
4
|
principalId: string;
|
|
@@ -22,6 +22,8 @@ export interface TermsInput {
|
|
|
22
22
|
} | null;
|
|
23
23
|
disputeReviewerId?: string | null;
|
|
24
24
|
verifierAgentIds?: string[];
|
|
25
|
+
/** The skill the counterparty performs (for A2A, the AgentSkill id). Produces schema_version 1.1 terms. */
|
|
26
|
+
skill?: SkillRef;
|
|
25
27
|
}
|
|
26
28
|
/** Builds version-1 obligation terms with sensible defaults (7-day deadline, 1-day offer window). */
|
|
27
29
|
export declare function buildTerms(input: TermsInput): ObligationTerms;
|
package/dist/builders.js
CHANGED
|
@@ -4,7 +4,7 @@ const DAY_MS = 24 * 3600 * 1000;
|
|
|
4
4
|
export function buildTerms(input) {
|
|
5
5
|
const now = Date.now();
|
|
6
6
|
return {
|
|
7
|
-
schema_version: "1.0",
|
|
7
|
+
schema_version: input.skill ? "1.1" : "1.0",
|
|
8
8
|
obligation_id: newId("obligation"),
|
|
9
9
|
terms_version: 1,
|
|
10
10
|
parent_obligation_id: input.parentObligationId ?? null,
|
|
@@ -27,6 +27,7 @@ export function buildTerms(input) {
|
|
|
27
27
|
dispute_reviewer_id: input.disputeReviewerId ?? null,
|
|
28
28
|
verifier_agent_ids: input.verifierAgentIds ?? [],
|
|
29
29
|
issued_at: new Date(now).toISOString(),
|
|
30
|
+
...(input.skill ? { skill: input.skill } : {}),
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
33
|
/** Data for obligation.created / obligation.offered / obligation.amended events. */
|
package/dist/client.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare class AtcnApiError extends Error {
|
|
|
9
9
|
constructor(status: number, code: string, message: string, reason: string | undefined, retryable: boolean, correlationId: string | undefined, details: unknown);
|
|
10
10
|
}
|
|
11
11
|
/** Must equal this package's version in package.json (checked by a test). */
|
|
12
|
-
export declare const SDK_VERSION = "1.
|
|
12
|
+
export declare const SDK_VERSION = "1.4.0";
|
|
13
13
|
/** Names the SDK and its version on every request, so the API operator can count SDK versions in use. Nothing else is sent. */
|
|
14
14
|
export declare const SDK_HEADER = "atcn-sdk";
|
|
15
15
|
export interface ClientOptions {
|
|
@@ -140,7 +140,7 @@ export declare class AtcnClient {
|
|
|
140
140
|
parent_obligation_id: string | null;
|
|
141
141
|
redacted: boolean;
|
|
142
142
|
effective_terms: {
|
|
143
|
-
schema_version: "1.0";
|
|
143
|
+
schema_version: "1.0" | "1.1";
|
|
144
144
|
obligation_id: string;
|
|
145
145
|
terms_version: number;
|
|
146
146
|
parent_obligation_id: string | null;
|
|
@@ -181,6 +181,11 @@ export declare class AtcnClient {
|
|
|
181
181
|
dispute_reviewer_id: string | null;
|
|
182
182
|
verifier_agent_ids: string[];
|
|
183
183
|
issued_at: string;
|
|
184
|
+
skill?: {
|
|
185
|
+
namespace: string;
|
|
186
|
+
skill_id: string;
|
|
187
|
+
agent_card_url?: string | undefined;
|
|
188
|
+
} | undefined;
|
|
184
189
|
} | null;
|
|
185
190
|
effective_terms_digest: string | null;
|
|
186
191
|
state: string;
|
package/dist/client.js
CHANGED
|
@@ -16,7 +16,7 @@ export class AtcnApiError extends Error {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
/** Must equal this package's version in package.json (checked by a test). */
|
|
19
|
-
export const SDK_VERSION = "1.
|
|
19
|
+
export const SDK_VERSION = "1.4.0";
|
|
20
20
|
/** Names the SDK and its version on every request, so the API operator can count SDK versions in use. Nothing else is sent. */
|
|
21
21
|
export const SDK_HEADER = "atcn-sdk";
|
|
22
22
|
/** Thin HTTP client for the ATCN API. Every mutating call carries an Idempotency-Key. */
|
package/dist/index.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export { AtcnClient, AtcnApiError, SDK_HEADER, SDK_VERSION, type ClientOptions,
|
|
|
4
4
|
export { verifyClosurePackage, REFERENCE_POLICIES, CODE_CHANGE_POLICY_V1, CODE_CHANGE_POLICY_V1_1, CODE_CHANGE_SUBTASK_POLICY_V1 } from "@atcn/core";
|
|
5
5
|
export { SubledgerClient, ReceiptLinkClient, CaptureQueue, ext, stableKey, type CaptureOperation, type CaptureQueueOptions, type FlushResult } from "./subledger.js";
|
|
6
6
|
export { verifySubledgerDocument, buildResponseStatement, signStatement, verifyStatementSignature } from "@atcn/subledger";
|
|
7
|
-
export { verifyWebhook, signWebhook, WEBHOOK_SIGNATURE_HEADER, generateKeyPair, digestOf, sha256Digest, canonicalize } from "@atcn/schema";
|
|
7
|
+
export { verifyWebhook, signWebhook, WEBHOOK_SIGNATURE_HEADER, generateKeyPair, digestOf, sha256Digest, canonicalize, executionBinding } from "@atcn/schema";
|
package/dist/index.js
CHANGED
|
@@ -4,4 +4,4 @@ export { AtcnClient, AtcnApiError, SDK_HEADER, SDK_VERSION } from "./client.js";
|
|
|
4
4
|
export { verifyClosurePackage, REFERENCE_POLICIES, CODE_CHANGE_POLICY_V1, CODE_CHANGE_POLICY_V1_1, CODE_CHANGE_SUBTASK_POLICY_V1 } from "@atcn/core";
|
|
5
5
|
export { SubledgerClient, ReceiptLinkClient, CaptureQueue, ext, stableKey } from "./subledger.js";
|
|
6
6
|
export { verifySubledgerDocument, buildResponseStatement, signStatement, verifyStatementSignature } from "@atcn/subledger";
|
|
7
|
-
export { verifyWebhook, signWebhook, WEBHOOK_SIGNATURE_HEADER, generateKeyPair, digestOf, sha256Digest, canonicalize } from "@atcn/schema";
|
|
7
|
+
export { verifyWebhook, signWebhook, WEBHOOK_SIGNATURE_HEADER, generateKeyPair, digestOf, sha256Digest, canonicalize, executionBinding } from "@atcn/schema";
|
package/dist/subledger.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { z } from "zod";
|
|
2
2
|
import { type AllocationInputSchema, type AllocationRuleInputSchema, type AttestableField, type Correction, type DelegationEventInputSchema, type DelegationInputSchema, type EvidenceRef, type FinancialEventInput, type OperatorKeyRecord, type ProviderInputSchema, type ResponseType, type SignedClosure, type SignedReceipt, type TaskInputSchema } from "@atcn/subledger";
|
|
3
|
+
import { type AttestationRef, type ExecutionBinding } from "@atcn/schema";
|
|
3
4
|
import { AtcnClient, type ClientOptions } from "./client.js";
|
|
4
5
|
type Json = Record<string, unknown>;
|
|
5
6
|
type Opts = {
|
|
@@ -89,7 +90,7 @@ export declare class SubledgerClient {
|
|
|
89
90
|
getClosure(taskId: string, version?: number): Promise<{
|
|
90
91
|
payload: {
|
|
91
92
|
document_type: "atcn.subledger.closure";
|
|
92
|
-
schema_version: "1.
|
|
93
|
+
schema_version: "1.4" | "1.2" | "1.3";
|
|
93
94
|
closure_id: string;
|
|
94
95
|
version: number;
|
|
95
96
|
previous_closure_id: string | null;
|
|
@@ -133,13 +134,37 @@ export declare class SubledgerClient {
|
|
|
133
134
|
delivery_status: string;
|
|
134
135
|
retrospective: boolean;
|
|
135
136
|
created_at: string;
|
|
137
|
+
execution?: {
|
|
138
|
+
execution_id: string;
|
|
139
|
+
agent: {
|
|
140
|
+
agent_id: string;
|
|
141
|
+
agent_version: string;
|
|
142
|
+
card_digest?: string | undefined;
|
|
143
|
+
model?: {
|
|
144
|
+
provider: string;
|
|
145
|
+
name: string;
|
|
146
|
+
version: string;
|
|
147
|
+
} | undefined;
|
|
148
|
+
config_digest?: string | undefined;
|
|
149
|
+
};
|
|
150
|
+
protocol?: {
|
|
151
|
+
name: "a2a";
|
|
152
|
+
task_id: string;
|
|
153
|
+
context_id?: string | undefined;
|
|
154
|
+
} | undefined;
|
|
155
|
+
skill?: {
|
|
156
|
+
namespace: string;
|
|
157
|
+
skill_id: string;
|
|
158
|
+
agent_card_url?: string | undefined;
|
|
159
|
+
} | undefined;
|
|
160
|
+
} | undefined;
|
|
136
161
|
}[];
|
|
137
162
|
delivery_claims: {
|
|
138
163
|
event_id: string;
|
|
139
164
|
delegation_id: string;
|
|
140
165
|
type: "acceptance" | "completion" | "partial_completion" | "cancellation" | "provider_failure" | "terms_update" | "correction";
|
|
141
166
|
asserted_by: "provider" | "buyer" | "clearing_policy" | "dispute_reviewer" | "clearing_network";
|
|
142
|
-
assurance: ("contested" | "issuer_signed" | "buyer_recorded" | "network_recorded" | "recipient_viewed" | "link_authenticated_response" | "provider_identity_bound" | "provider_key_signed" | "superseded")[];
|
|
167
|
+
assurance: ("expired" | "contested" | "issuer_signed" | "buyer_recorded" | "network_recorded" | "recipient_viewed" | "link_authenticated_response" | "provider_identity_bound" | "provider_key_signed" | "superseded" | "revoked")[];
|
|
143
168
|
note: string | null;
|
|
144
169
|
evidence: {
|
|
145
170
|
uri: string;
|
|
@@ -335,6 +360,17 @@ export declare class SubledgerClient {
|
|
|
335
360
|
proposed_value: string;
|
|
336
361
|
reason: string;
|
|
337
362
|
}[];
|
|
363
|
+
execution?: {
|
|
364
|
+
execution_id: string;
|
|
365
|
+
execution_digest: string;
|
|
366
|
+
} | undefined;
|
|
367
|
+
issued_at?: string | undefined;
|
|
368
|
+
expires_at?: string | undefined;
|
|
369
|
+
refs?: {
|
|
370
|
+
relation: "revokes" | "disputes";
|
|
371
|
+
attestation_digest: string;
|
|
372
|
+
reason: string;
|
|
373
|
+
}[] | undefined;
|
|
338
374
|
};
|
|
339
375
|
statement_digest: string;
|
|
340
376
|
provider_signature: {
|
|
@@ -342,7 +378,7 @@ export declare class SubledgerClient {
|
|
|
342
378
|
binding_id: string;
|
|
343
379
|
value: string;
|
|
344
380
|
} | null;
|
|
345
|
-
assurance: ("contested" | "issuer_signed" | "buyer_recorded" | "network_recorded" | "recipient_viewed" | "link_authenticated_response" | "provider_identity_bound" | "provider_key_signed" | "superseded")[];
|
|
381
|
+
assurance: ("expired" | "contested" | "issuer_signed" | "buyer_recorded" | "network_recorded" | "recipient_viewed" | "link_authenticated_response" | "provider_identity_bound" | "provider_key_signed" | "superseded" | "revoked")[];
|
|
346
382
|
decision: {
|
|
347
383
|
status: "accepted" | "rejected";
|
|
348
384
|
reason: string;
|
|
@@ -407,7 +443,7 @@ export declare class SubledgerClient {
|
|
|
407
443
|
getReceipt(receiptId: string): Promise<{
|
|
408
444
|
payload: {
|
|
409
445
|
document_type: "atcn.subledger.receipt";
|
|
410
|
-
schema_version: "1.
|
|
446
|
+
schema_version: "1.4" | "1.2" | "1.3";
|
|
411
447
|
receipt_id: string;
|
|
412
448
|
revision: number;
|
|
413
449
|
previous_receipt_id: string | null;
|
|
@@ -433,6 +469,30 @@ export declare class SubledgerClient {
|
|
|
433
469
|
expected_delivery: string | null;
|
|
434
470
|
retrospective: boolean;
|
|
435
471
|
downstream_visibility: "unknown" | "disclosed" | "none";
|
|
472
|
+
execution?: {
|
|
473
|
+
execution_id: string;
|
|
474
|
+
agent: {
|
|
475
|
+
agent_id: string;
|
|
476
|
+
agent_version: string;
|
|
477
|
+
card_digest?: string | undefined;
|
|
478
|
+
model?: {
|
|
479
|
+
provider: string;
|
|
480
|
+
name: string;
|
|
481
|
+
version: string;
|
|
482
|
+
} | undefined;
|
|
483
|
+
config_digest?: string | undefined;
|
|
484
|
+
};
|
|
485
|
+
protocol?: {
|
|
486
|
+
name: "a2a";
|
|
487
|
+
task_id: string;
|
|
488
|
+
context_id?: string | undefined;
|
|
489
|
+
} | undefined;
|
|
490
|
+
skill?: {
|
|
491
|
+
namespace: string;
|
|
492
|
+
skill_id: string;
|
|
493
|
+
agent_card_url?: string | undefined;
|
|
494
|
+
} | undefined;
|
|
495
|
+
} | undefined;
|
|
436
496
|
};
|
|
437
497
|
provider: {
|
|
438
498
|
provider_id: string | null;
|
|
@@ -454,7 +514,7 @@ export declare class SubledgerClient {
|
|
|
454
514
|
supersedes_event_id: string | null;
|
|
455
515
|
reason: string | null;
|
|
456
516
|
event_id: string;
|
|
457
|
-
assurance: ("contested" | "issuer_signed" | "buyer_recorded" | "network_recorded" | "recipient_viewed" | "link_authenticated_response" | "provider_identity_bound" | "provider_key_signed" | "superseded")[];
|
|
517
|
+
assurance: ("expired" | "contested" | "issuer_signed" | "buyer_recorded" | "network_recorded" | "recipient_viewed" | "link_authenticated_response" | "provider_identity_bound" | "provider_key_signed" | "superseded" | "revoked")[];
|
|
458
518
|
recorded_at: string;
|
|
459
519
|
}[];
|
|
460
520
|
financial_events: {
|
|
@@ -600,6 +660,10 @@ export declare class ReceiptLinkClient {
|
|
|
600
660
|
note?: string | null;
|
|
601
661
|
evidence?: EvidenceRef[];
|
|
602
662
|
corrections?: Correction[];
|
|
663
|
+
execution?: ExecutionBinding;
|
|
664
|
+
issued_at?: string;
|
|
665
|
+
expires_at?: string;
|
|
666
|
+
refs?: AttestationRef[];
|
|
603
667
|
}, signing?: {
|
|
604
668
|
bindingId: string;
|
|
605
669
|
keyId: string;
|
package/dist/subledger.js
CHANGED
|
@@ -175,6 +175,10 @@ export class ReceiptLinkClient {
|
|
|
175
175
|
note: response.note ?? null,
|
|
176
176
|
evidence: response.evidence ?? [],
|
|
177
177
|
corrections: response.corrections ?? [],
|
|
178
|
+
execution: response.execution,
|
|
179
|
+
issued_at: response.issued_at,
|
|
180
|
+
expires_at: response.expires_at,
|
|
181
|
+
refs: response.refs,
|
|
178
182
|
});
|
|
179
183
|
provider_signature = { binding_id: signing.bindingId, key_id: signing.keyId, value: signStatement(statement, signing.privateKey) };
|
|
180
184
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atcn/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "TypeScript SDK for ATCN: sign events, build terms and evidence envelopes, call the API, verify webhooks, closures, and closure packages",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"build": "tsc -p tsconfig.build.json"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@atcn/core": "1.
|
|
40
|
-
"@atcn/schema": "1.
|
|
41
|
-
"@atcn/subledger": "1.
|
|
42
|
-
"@atcn/usage": "1.
|
|
39
|
+
"@atcn/core": "1.4.0",
|
|
40
|
+
"@atcn/schema": "1.4.0",
|
|
41
|
+
"@atcn/subledger": "1.4.0",
|
|
42
|
+
"@atcn/usage": "1.4.0",
|
|
43
43
|
"zod": "^4.1.0"
|
|
44
44
|
}
|
|
45
45
|
}
|