@vallum/standards 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/README.md +56 -0
- package/dist/a2a.d.ts +1 -0
- package/dist/a2a.js +1 -0
- package/dist/a2aHttp.d.ts +63 -0
- package/dist/a2aHttp.js +338 -0
- package/dist/a2aNodeServer.d.ts +17 -0
- package/dist/a2aNodeServer.js +156 -0
- package/dist/a2aPush.d.ts +162 -0
- package/dist/a2aPush.js +608 -0
- package/dist/a2aTask.d.ts +125 -0
- package/dist/a2aTask.js +327 -0
- package/dist/ap2.d.ts +38 -0
- package/dist/ap2.js +56 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/x402.d.ts +62 -0
- package/dist/x402.js +76 -0
- package/package.json +38 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { type A2ATask } from "./a2aTask.js";
|
|
2
|
+
export interface A2APushNotificationAuthenticationInfo {
|
|
3
|
+
readonly schemes: readonly string[];
|
|
4
|
+
}
|
|
5
|
+
export interface A2ATaskPushNotificationConfig {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly taskId: string;
|
|
8
|
+
readonly url: string;
|
|
9
|
+
readonly createdAt: string;
|
|
10
|
+
readonly tenant?: string;
|
|
11
|
+
readonly authentication?: A2APushNotificationAuthenticationInfo;
|
|
12
|
+
}
|
|
13
|
+
export interface ListA2APushNotificationConfigsResult {
|
|
14
|
+
readonly configs: readonly A2ATaskPushNotificationConfig[];
|
|
15
|
+
readonly nextPageToken?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface A2APushNotificationPayload {
|
|
18
|
+
readonly kind: "task";
|
|
19
|
+
readonly task: A2ATask;
|
|
20
|
+
}
|
|
21
|
+
export interface A2APushNotificationDeliveryRequest {
|
|
22
|
+
readonly method: "POST";
|
|
23
|
+
readonly url: string;
|
|
24
|
+
readonly headers: Record<string, string>;
|
|
25
|
+
readonly body: A2APushNotificationPayload;
|
|
26
|
+
readonly json: string;
|
|
27
|
+
readonly config: A2ATaskPushNotificationConfig;
|
|
28
|
+
}
|
|
29
|
+
export interface A2APushNotificationTransportResponse {
|
|
30
|
+
readonly status: number;
|
|
31
|
+
}
|
|
32
|
+
export type A2APushNotificationTransport = (request: A2APushNotificationDeliveryRequest) => A2APushNotificationTransportResponse | Promise<A2APushNotificationTransportResponse>;
|
|
33
|
+
export interface A2APushHttpTransportOptions {
|
|
34
|
+
readonly allowedCallbackHosts?: readonly string[];
|
|
35
|
+
readonly fetch?: typeof fetch;
|
|
36
|
+
readonly timeoutMs?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface A2APushNotificationDeliveryAttempt {
|
|
39
|
+
readonly configId: string;
|
|
40
|
+
readonly taskId: string;
|
|
41
|
+
readonly url: string;
|
|
42
|
+
readonly attemptNumber?: number;
|
|
43
|
+
readonly observedAt?: string;
|
|
44
|
+
readonly nextRetryAt?: string;
|
|
45
|
+
readonly status: "delivered" | "failed" | "skipped";
|
|
46
|
+
readonly httpStatus?: number;
|
|
47
|
+
readonly errorCode?: "A2A_PUSH_TRANSPORT_UNCONFIGURED" | "A2A_PUSH_TRANSPORT_FAILED";
|
|
48
|
+
}
|
|
49
|
+
export interface A2APushNotificationDeliveryResult {
|
|
50
|
+
readonly attempts: readonly A2APushNotificationDeliveryAttempt[];
|
|
51
|
+
}
|
|
52
|
+
export interface A2APushNotificationDeliveryQueueEntry {
|
|
53
|
+
readonly id: string;
|
|
54
|
+
readonly enqueuedAt: string;
|
|
55
|
+
readonly claimedAt?: string;
|
|
56
|
+
readonly completedAt?: string;
|
|
57
|
+
readonly failedAt?: string;
|
|
58
|
+
readonly status: "queued" | "claimed" | "completed" | "failed";
|
|
59
|
+
readonly request: A2APushNotificationDeliveryRequest;
|
|
60
|
+
}
|
|
61
|
+
export interface A2APushNotificationDeliveryQueueResult {
|
|
62
|
+
readonly entries: readonly A2APushNotificationDeliveryQueueEntry[];
|
|
63
|
+
}
|
|
64
|
+
export interface A2APushNotificationDeliveryWorkerResult {
|
|
65
|
+
readonly status: "empty" | "delivered" | "failed";
|
|
66
|
+
readonly entry?: A2APushNotificationDeliveryQueueEntry;
|
|
67
|
+
readonly attempt?: A2APushNotificationDeliveryAttempt;
|
|
68
|
+
}
|
|
69
|
+
export interface A2APushNotificationAttemptStore {
|
|
70
|
+
record(attempt: A2APushNotificationDeliveryAttempt): void;
|
|
71
|
+
}
|
|
72
|
+
export type A2APushNotificationErrorCode = "A2A_PUSH_CONFIG_INVALID" | "A2A_PUSH_CONFIG_NOT_FOUND" | "A2A_PUSH_URL_UNSAFE" | "A2A_PUSH_CREDENTIAL_STORAGE_UNSUPPORTED";
|
|
73
|
+
export declare class A2APushNotificationError extends Error {
|
|
74
|
+
readonly code: A2APushNotificationErrorCode;
|
|
75
|
+
readonly status: 400 | 404;
|
|
76
|
+
constructor(code: A2APushNotificationErrorCode, message: string, status?: 400 | 404);
|
|
77
|
+
}
|
|
78
|
+
export declare class LocalA2APushNotificationStore {
|
|
79
|
+
#private;
|
|
80
|
+
put(config: A2ATaskPushNotificationConfig): A2ATaskPushNotificationConfig;
|
|
81
|
+
get(taskId: string, id: string): A2ATaskPushNotificationConfig | undefined;
|
|
82
|
+
list(taskId: string, pageSize?: number): ListA2APushNotificationConfigsResult;
|
|
83
|
+
delete(taskId: string, id: string): boolean;
|
|
84
|
+
}
|
|
85
|
+
export declare class LocalA2APushNotificationAttemptStore implements A2APushNotificationAttemptStore {
|
|
86
|
+
#private;
|
|
87
|
+
record(attempt: A2APushNotificationDeliveryAttempt): void;
|
|
88
|
+
list(): readonly A2APushNotificationDeliveryAttempt[];
|
|
89
|
+
}
|
|
90
|
+
export declare class JsonlA2APushNotificationAttemptStore implements A2APushNotificationAttemptStore {
|
|
91
|
+
#private;
|
|
92
|
+
constructor(filePath: string);
|
|
93
|
+
record(attempt: A2APushNotificationDeliveryAttempt): void;
|
|
94
|
+
list(): readonly A2APushNotificationDeliveryAttempt[];
|
|
95
|
+
}
|
|
96
|
+
export declare class JsonFileA2APushNotificationDeliveryQueue {
|
|
97
|
+
#private;
|
|
98
|
+
constructor(filePath: string);
|
|
99
|
+
enqueue(request: A2APushNotificationDeliveryRequest, options?: {
|
|
100
|
+
readonly id?: string;
|
|
101
|
+
readonly enqueuedAt?: Date;
|
|
102
|
+
}): A2APushNotificationDeliveryQueueEntry;
|
|
103
|
+
list(): readonly A2APushNotificationDeliveryQueueEntry[];
|
|
104
|
+
claim(options?: {
|
|
105
|
+
readonly now?: Date;
|
|
106
|
+
}): A2APushNotificationDeliveryQueueEntry | undefined;
|
|
107
|
+
complete(id: string, options?: {
|
|
108
|
+
readonly now?: Date;
|
|
109
|
+
}): boolean;
|
|
110
|
+
fail(id: string, options?: {
|
|
111
|
+
readonly now?: Date;
|
|
112
|
+
}): boolean;
|
|
113
|
+
}
|
|
114
|
+
export declare function createA2APushNotificationConfig(options: {
|
|
115
|
+
readonly store: LocalA2APushNotificationStore;
|
|
116
|
+
readonly taskId: string;
|
|
117
|
+
readonly value: unknown;
|
|
118
|
+
readonly allowedCallbackHosts?: readonly string[];
|
|
119
|
+
readonly now?: Date;
|
|
120
|
+
}): A2ATaskPushNotificationConfig;
|
|
121
|
+
export declare function getA2APushNotificationConfig(options: {
|
|
122
|
+
readonly store: LocalA2APushNotificationStore;
|
|
123
|
+
readonly taskId: string;
|
|
124
|
+
readonly id: string;
|
|
125
|
+
}): A2ATaskPushNotificationConfig;
|
|
126
|
+
export declare function listA2APushNotificationConfigs(options: {
|
|
127
|
+
readonly store: LocalA2APushNotificationStore;
|
|
128
|
+
readonly taskId: string;
|
|
129
|
+
readonly pageSize?: number;
|
|
130
|
+
}): ListA2APushNotificationConfigsResult;
|
|
131
|
+
export declare function deleteA2APushNotificationConfig(options: {
|
|
132
|
+
readonly store: LocalA2APushNotificationStore;
|
|
133
|
+
readonly taskId: string;
|
|
134
|
+
readonly id: string;
|
|
135
|
+
}): {
|
|
136
|
+
readonly taskId: string;
|
|
137
|
+
readonly id: string;
|
|
138
|
+
readonly deleted: boolean;
|
|
139
|
+
};
|
|
140
|
+
export declare function deliverA2APushNotifications(options: {
|
|
141
|
+
readonly store: LocalA2APushNotificationStore;
|
|
142
|
+
readonly task: A2ATask;
|
|
143
|
+
readonly transport?: A2APushNotificationTransport;
|
|
144
|
+
readonly attemptStore?: A2APushNotificationAttemptStore;
|
|
145
|
+
readonly maxAttempts?: number;
|
|
146
|
+
readonly retryDelayMs?: number;
|
|
147
|
+
readonly now?: () => Date;
|
|
148
|
+
}): Promise<A2APushNotificationDeliveryResult>;
|
|
149
|
+
export declare function queueA2APushNotificationDeliveries(options: {
|
|
150
|
+
readonly store: LocalA2APushNotificationStore;
|
|
151
|
+
readonly task: A2ATask;
|
|
152
|
+
readonly queue: JsonFileA2APushNotificationDeliveryQueue;
|
|
153
|
+
readonly now?: () => Date;
|
|
154
|
+
}): A2APushNotificationDeliveryQueueResult;
|
|
155
|
+
export declare function processNextA2APushNotificationDelivery(options: {
|
|
156
|
+
readonly queue: JsonFileA2APushNotificationDeliveryQueue;
|
|
157
|
+
readonly transport: A2APushNotificationTransport;
|
|
158
|
+
readonly attemptStore?: A2APushNotificationAttemptStore;
|
|
159
|
+
readonly now?: () => Date;
|
|
160
|
+
}): Promise<A2APushNotificationDeliveryWorkerResult>;
|
|
161
|
+
export declare function buildA2APushNotificationDeliveryRequest(config: A2ATaskPushNotificationConfig, task: A2ATask): A2APushNotificationDeliveryRequest;
|
|
162
|
+
export declare function createA2APushHttpTransport(options?: A2APushHttpTransportOptions): A2APushNotificationTransport;
|