@covia/covia-sdk 1.1.0 → 1.3.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/README.md +478 -49
- package/dist/index.d.mts +520 -112
- package/dist/index.d.ts +520 -112
- package/dist/index.js +1608 -317
- package/dist/index.mjs +1594 -316
- package/package.json +3 -1
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,7 @@ declare class Job {
|
|
|
2
2
|
id: string;
|
|
3
3
|
venue: VenueInterface;
|
|
4
4
|
metadata: JobMetadata;
|
|
5
|
+
private _jobs;
|
|
5
6
|
constructor(id: string, venue: VenueInterface, metadata: JobMetadata);
|
|
6
7
|
/**
|
|
7
8
|
* Whether the job has reached a terminal state
|
|
@@ -47,15 +48,42 @@ declare class Job {
|
|
|
47
48
|
*/
|
|
48
49
|
stream(): AsyncGenerator<SSEEvent>;
|
|
49
50
|
/**
|
|
50
|
-
*
|
|
51
|
-
* @returns {Promise<number>}
|
|
51
|
+
* Whether the job is paused (PAUSED, INPUT_REQUIRED, or AUTH_REQUIRED)
|
|
52
52
|
*/
|
|
53
|
-
|
|
53
|
+
get isPaused(): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the job requires user input
|
|
56
|
+
*/
|
|
57
|
+
get needsInput(): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the job requires authentication
|
|
60
|
+
*/
|
|
61
|
+
get needsAuth(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Send a message to the running job
|
|
64
|
+
* @param message - Message payload
|
|
65
|
+
* @returns {Promise<any>}
|
|
66
|
+
*/
|
|
67
|
+
sendMessage(message: any): Promise<any>;
|
|
68
|
+
/**
|
|
69
|
+
* Pause the job
|
|
70
|
+
* @returns {Promise<JobMetadata>} Updated job metadata
|
|
71
|
+
*/
|
|
72
|
+
pause(): Promise<JobMetadata>;
|
|
73
|
+
/**
|
|
74
|
+
* Resume the job
|
|
75
|
+
* @returns {Promise<JobMetadata>} Updated job metadata
|
|
76
|
+
*/
|
|
77
|
+
resume(): Promise<JobMetadata>;
|
|
78
|
+
/**
|
|
79
|
+
* Cancel the job
|
|
80
|
+
* @returns {Promise<JobMetadata>} Updated job metadata
|
|
81
|
+
*/
|
|
82
|
+
cancel(): Promise<JobMetadata>;
|
|
54
83
|
/**
|
|
55
84
|
* Delete the job
|
|
56
|
-
* @returns {Promise<number>}
|
|
57
85
|
*/
|
|
58
|
-
|
|
86
|
+
delete(): Promise<void>;
|
|
59
87
|
}
|
|
60
88
|
|
|
61
89
|
declare abstract class Asset {
|
|
@@ -64,23 +92,20 @@ declare abstract class Asset {
|
|
|
64
92
|
metadata: AssetMetadata;
|
|
65
93
|
status?: RunStatus;
|
|
66
94
|
error?: string;
|
|
95
|
+
private _assets;
|
|
96
|
+
private _operations;
|
|
67
97
|
constructor(id: AssetID, venue: VenueInterface, metadata?: AssetMetadata);
|
|
68
98
|
/**
|
|
69
99
|
* Get asset metadata
|
|
70
100
|
* @returns {Promise<AssetMetadata>}
|
|
71
101
|
*/
|
|
72
102
|
getMetadata(): Promise<AssetMetadata>;
|
|
73
|
-
/**
|
|
74
|
-
* Read stream from asset
|
|
75
|
-
* @param reader - ReadableStreamDefaultReader
|
|
76
|
-
*/
|
|
77
|
-
readStream(reader: ReadableStreamDefaultReader<Uint8Array>): Promise<void>;
|
|
78
103
|
/**
|
|
79
104
|
* Put content to asset
|
|
80
105
|
* @param content - Content to upload
|
|
81
|
-
* @returns {Promise<
|
|
106
|
+
* @returns {Promise<ContentHashResult>} The content hash returned by the server
|
|
82
107
|
*/
|
|
83
|
-
putContent(content: BodyInit): Promise<
|
|
108
|
+
putContent(content: BodyInit): Promise<ContentHashResult>;
|
|
84
109
|
/**
|
|
85
110
|
* Get asset content
|
|
86
111
|
* @returns {Promise<ReadableStream<Uint8Array> | null>}
|
|
@@ -100,7 +125,7 @@ declare abstract class Asset {
|
|
|
100
125
|
/**
|
|
101
126
|
* Execute the operation
|
|
102
127
|
* @param input - Operation input parameters
|
|
103
|
-
* @returns {Promise<
|
|
128
|
+
* @returns {Promise<Job>}
|
|
104
129
|
*/
|
|
105
130
|
invoke(input: any): Promise<Job>;
|
|
106
131
|
}
|
|
@@ -139,29 +164,43 @@ declare class BearerAuth extends Auth {
|
|
|
139
164
|
apply(headers: Record<string, string>): void;
|
|
140
165
|
}
|
|
141
166
|
/**
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
* Custom auth that sets the X-Covia-User header for user identity tracking.
|
|
167
|
+
* Ed25519 keypair authentication (self-issued EdDSA JWT).
|
|
168
|
+
* Generates a fresh short-lived JWT for every request, signed with the
|
|
169
|
+
* client's Ed25519 private key. The server verifies the signature and
|
|
170
|
+
* extracts the caller's DID from the `sub` claim.
|
|
171
|
+
*
|
|
172
|
+
* Example:
|
|
173
|
+
* const auth = KeyPairAuth.generate();
|
|
174
|
+
* console.log(auth.getDID()); // did:key:z6Mk...
|
|
175
|
+
* const venue = await Grid.connect("https://venue.covia.ai", auth);
|
|
152
176
|
*/
|
|
153
|
-
declare class
|
|
154
|
-
private
|
|
155
|
-
|
|
177
|
+
declare class KeyPairAuth extends Auth {
|
|
178
|
+
private _privateKey;
|
|
179
|
+
private _publicKey;
|
|
180
|
+
private _did;
|
|
181
|
+
private _lifetime;
|
|
182
|
+
/**
|
|
183
|
+
* @param privateKey - 32-byte Ed25519 private key
|
|
184
|
+
* @param tokenLifetimeSeconds - JWT lifetime in seconds (default 300 = 5 min)
|
|
185
|
+
*/
|
|
186
|
+
constructor(privateKey: Uint8Array, tokenLifetimeSeconds?: number);
|
|
156
187
|
apply(headers: Record<string, string>): void;
|
|
157
|
-
|
|
158
|
-
|
|
188
|
+
/** The caller's DID derived from the public key. */
|
|
189
|
+
getDID(): string;
|
|
190
|
+
/** The 32-byte Ed25519 public key. */
|
|
191
|
+
getPublicKey(): Uint8Array;
|
|
192
|
+
/** Generate a new random keypair and return a KeyPairAuth instance. */
|
|
193
|
+
static generate(tokenLifetimeSeconds?: number): KeyPairAuth;
|
|
194
|
+
/** Create from a hex-encoded private key string. */
|
|
195
|
+
static fromHex(privateKeyHex: string, tokenLifetimeSeconds?: number): KeyPairAuth;
|
|
196
|
+
}
|
|
197
|
+
/** @deprecated Use Auth subclasses instead (NoAuth, BearerAuth, KeyPairAuth). */
|
|
159
198
|
interface Credentials {
|
|
160
199
|
venueId: string;
|
|
161
200
|
apiKey: string;
|
|
162
201
|
userId: string;
|
|
163
202
|
}
|
|
164
|
-
/** @deprecated Use Auth subclasses instead (NoAuth, BearerAuth,
|
|
203
|
+
/** @deprecated Use Auth subclasses instead (NoAuth, BearerAuth, KeyPairAuth). */
|
|
165
204
|
declare class CredentialsHTTP implements Credentials {
|
|
166
205
|
venueId: string;
|
|
167
206
|
apiKey: string;
|
|
@@ -169,11 +208,200 @@ declare class CredentialsHTTP implements Credentials {
|
|
|
169
208
|
constructor(venueId: string, apiKey: string, userId: string);
|
|
170
209
|
}
|
|
171
210
|
|
|
211
|
+
interface AgentManagerVenue {
|
|
212
|
+
operations: {
|
|
213
|
+
run(assetId: string, input: any): Promise<any>;
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
declare class AgentManager {
|
|
217
|
+
private venue;
|
|
218
|
+
constructor(venue: AgentManagerVenue);
|
|
219
|
+
create(input: AgentCreateInput): Promise<AgentCreateResult>;
|
|
220
|
+
request(agentId: string, input?: any, wait?: boolean | number): Promise<AgentRequestResult>;
|
|
221
|
+
message(agentId: string, message: any): Promise<AgentMessageResult>;
|
|
222
|
+
trigger(agentId: string): Promise<AgentTriggerResult>;
|
|
223
|
+
query(agentId: string): Promise<AgentQueryResult>;
|
|
224
|
+
list(includeTerminated?: boolean): Promise<AgentListResult>;
|
|
225
|
+
delete(agentId: string, remove?: boolean): Promise<AgentDeleteResult>;
|
|
226
|
+
suspend(agentId: string): Promise<AgentSuspendResult>;
|
|
227
|
+
resume(agentId: string, autoWake?: boolean): Promise<AgentSuspendResult>;
|
|
228
|
+
update(input: AgentUpdateInput): Promise<any>;
|
|
229
|
+
cancelTask(agentId: string, taskId: string): Promise<any>;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
interface JobManagerVenue {
|
|
233
|
+
baseUrl: string;
|
|
234
|
+
auth: {
|
|
235
|
+
apply(headers: Record<string, string>): void;
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
declare class JobManager {
|
|
239
|
+
private venue;
|
|
240
|
+
constructor(venue: JobManagerVenue);
|
|
241
|
+
list(): Promise<string[]>;
|
|
242
|
+
get(jobId: string): Promise<Job>;
|
|
243
|
+
cancel(jobId: string): Promise<JobMetadata>;
|
|
244
|
+
delete(jobId: string): Promise<void>;
|
|
245
|
+
pause(jobId: string): Promise<JobMetadata>;
|
|
246
|
+
resume(jobId: string): Promise<JobMetadata>;
|
|
247
|
+
sendMessage(jobId: string, message: any): Promise<any>;
|
|
248
|
+
stream(jobId: string): AsyncGenerator<SSEEvent>;
|
|
249
|
+
private _buildHeaders;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
interface AssetManagerVenue {
|
|
253
|
+
baseUrl: string;
|
|
254
|
+
auth: {
|
|
255
|
+
apply(headers: Record<string, string>): void;
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
declare class AssetManager {
|
|
259
|
+
private venue;
|
|
260
|
+
constructor(venue: AssetManagerVenue);
|
|
261
|
+
/**
|
|
262
|
+
* Get asset by ID
|
|
263
|
+
* @param assetId - Asset identifier
|
|
264
|
+
* @returns Returns either an Operation or DataAsset based on the asset's metadata
|
|
265
|
+
*/
|
|
266
|
+
get(assetId: AssetID): Promise<Asset>;
|
|
267
|
+
/**
|
|
268
|
+
* List assets with pagination support
|
|
269
|
+
* @param options - Pagination options (offset, limit)
|
|
270
|
+
*/
|
|
271
|
+
list(options?: AssetListOptions): Promise<AssetList>;
|
|
272
|
+
/**
|
|
273
|
+
* Register a new asset
|
|
274
|
+
* @param assetData - Asset configuration
|
|
275
|
+
*/
|
|
276
|
+
register(assetData: any): Promise<Asset>;
|
|
277
|
+
/**
|
|
278
|
+
* Get asset metadata
|
|
279
|
+
* @param assetId - Asset identifier
|
|
280
|
+
*/
|
|
281
|
+
getMetadata(assetId: string): Promise<AssetMetadata>;
|
|
282
|
+
/**
|
|
283
|
+
* Put content to asset
|
|
284
|
+
* @param assetId - Asset identifier
|
|
285
|
+
* @param content - Content to upload
|
|
286
|
+
* @returns The content hash returned by the server
|
|
287
|
+
*/
|
|
288
|
+
putContent(assetId: string, content: BodyInit): Promise<ContentHashResult>;
|
|
289
|
+
/**
|
|
290
|
+
* Get asset content
|
|
291
|
+
* @param assetId - Asset identifier
|
|
292
|
+
*/
|
|
293
|
+
getContent(assetId: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
294
|
+
/**
|
|
295
|
+
* Clear the asset cache.
|
|
296
|
+
*/
|
|
297
|
+
clearCache(): void;
|
|
298
|
+
private _buildHeaders;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
interface OperationManagerVenue {
|
|
302
|
+
baseUrl: string;
|
|
303
|
+
auth: {
|
|
304
|
+
apply(headers: Record<string, string>): void;
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
declare class OperationManager {
|
|
308
|
+
private venue;
|
|
309
|
+
constructor(venue: OperationManagerVenue);
|
|
310
|
+
/**
|
|
311
|
+
* List all named operations available on this venue
|
|
312
|
+
*/
|
|
313
|
+
list(): Promise<OperationInfo[]>;
|
|
314
|
+
/**
|
|
315
|
+
* Get details of a named operation
|
|
316
|
+
* @param name - Operation name (e.g., "test:echo")
|
|
317
|
+
*/
|
|
318
|
+
get(name: string): Promise<OperationInfo>;
|
|
319
|
+
/**
|
|
320
|
+
* Execute an operation and wait for the result
|
|
321
|
+
* @param assetId - Operation asset ID or named operation
|
|
322
|
+
* @param input - Operation input parameters
|
|
323
|
+
* @param options - Invoke options (e.g., ucans)
|
|
324
|
+
*/
|
|
325
|
+
run(assetId: string, input: any, options?: InvokeOptions): Promise<any>;
|
|
326
|
+
/**
|
|
327
|
+
* Execute an operation and return a Job for tracking
|
|
328
|
+
* @param assetId - Operation asset ID or named operation
|
|
329
|
+
* @param input - Operation input parameters
|
|
330
|
+
* @param options - Invoke options (e.g., ucans)
|
|
331
|
+
*/
|
|
332
|
+
invoke(assetId: string, input: any, options?: InvokeOptions): Promise<Job>;
|
|
333
|
+
private _buildHeaders;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
interface WorkspaceManagerVenue {
|
|
337
|
+
operations: {
|
|
338
|
+
run(assetId: string, input: any): Promise<any>;
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
declare class WorkspaceManager {
|
|
342
|
+
private venue;
|
|
343
|
+
constructor(venue: WorkspaceManagerVenue);
|
|
344
|
+
read(path: string, maxSize?: number): Promise<WorkspaceReadResult>;
|
|
345
|
+
write(path: string, value: any): Promise<WorkspaceWriteResult>;
|
|
346
|
+
delete(path: string): Promise<WorkspaceDeleteResult>;
|
|
347
|
+
append(path: string, value: any): Promise<WorkspaceAppendResult>;
|
|
348
|
+
list(path?: string, limit?: number, offset?: number): Promise<WorkspaceListResult>;
|
|
349
|
+
slice(path: string, offset?: number, limit?: number): Promise<WorkspaceSliceResult>;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
interface UCANManagerVenue {
|
|
353
|
+
operations: {
|
|
354
|
+
run(assetId: string, input: any): Promise<any>;
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
declare class UCANManager {
|
|
358
|
+
private venue;
|
|
359
|
+
constructor(venue: UCANManagerVenue);
|
|
360
|
+
issue(aud: string, att: UCANAttenuation[], exp: number): Promise<UCANIssueResult>;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
interface SecretManagerVenue {
|
|
364
|
+
operations: {
|
|
365
|
+
run(assetId: string, input: any): Promise<any>;
|
|
366
|
+
};
|
|
367
|
+
listSecrets(): Promise<string[]>;
|
|
368
|
+
putSecret(name: string, value: string): Promise<void>;
|
|
369
|
+
deleteSecret(name: string): Promise<void>;
|
|
370
|
+
}
|
|
371
|
+
declare class SecretManager {
|
|
372
|
+
private venue;
|
|
373
|
+
constructor(venue: SecretManagerVenue);
|
|
374
|
+
set(name: string, value: string): Promise<SecretSetResult>;
|
|
375
|
+
/**
|
|
376
|
+
* Extract a secret value by name.
|
|
377
|
+
* NOTE: This operation requires a UCAN capability grant. The backend
|
|
378
|
+
* may reject requests that lack the appropriate capability proof.
|
|
379
|
+
*/
|
|
380
|
+
extract(name: string): Promise<SecretExtractResult>;
|
|
381
|
+
list(): Promise<string[]>;
|
|
382
|
+
put(name: string, value: string): Promise<void>;
|
|
383
|
+
delete(name: string): Promise<void>;
|
|
384
|
+
}
|
|
385
|
+
|
|
172
386
|
declare class Venue implements VenueInterface {
|
|
173
387
|
baseUrl: string;
|
|
174
388
|
venueId: string;
|
|
175
389
|
auth: Auth;
|
|
176
390
|
metadata: VenueData;
|
|
391
|
+
private _agents?;
|
|
392
|
+
private _jobs?;
|
|
393
|
+
private _assets?;
|
|
394
|
+
private _operations?;
|
|
395
|
+
private _workspace?;
|
|
396
|
+
private _ucan?;
|
|
397
|
+
private _secrets?;
|
|
398
|
+
get agents(): AgentManager;
|
|
399
|
+
get jobs(): JobManager;
|
|
400
|
+
get assets(): AssetManager;
|
|
401
|
+
get operations(): OperationManager;
|
|
402
|
+
get workspace(): WorkspaceManager;
|
|
403
|
+
get ucan(): UCANManager;
|
|
404
|
+
get secrets(): SecretManager;
|
|
177
405
|
constructor(options?: VenueOptions);
|
|
178
406
|
/**
|
|
179
407
|
* Static method to connect to a venue
|
|
@@ -183,24 +411,13 @@ declare class Venue implements VenueInterface {
|
|
|
183
411
|
*/
|
|
184
412
|
static connect(venueId: string | Venue, auth?: Auth): Promise<Venue>;
|
|
185
413
|
/**
|
|
186
|
-
*
|
|
187
|
-
* @param assetData - Asset configuration
|
|
188
|
-
* @returns {Promise<Asset>}
|
|
189
|
-
*/
|
|
190
|
-
register(assetData: any): Promise<Asset>;
|
|
191
|
-
/**
|
|
192
|
-
* Read stream from asset
|
|
193
|
-
* @param reader - ReadableStreamDefaultReader
|
|
194
|
-
*/
|
|
195
|
-
readStream(reader: ReadableStreamDefaultReader<Uint8Array>): Promise<void>;
|
|
196
|
-
/**
|
|
197
|
-
* Get asset by ID
|
|
414
|
+
* Get asset by ID (convenience delegate to venue.assets.get)
|
|
198
415
|
* @param assetId - Asset identifier
|
|
199
416
|
* @returns {Promise<Asset>} Returns either an Operation or DataAsset based on the asset's metadata
|
|
200
417
|
*/
|
|
201
418
|
getAsset(assetId: AssetID): Promise<Asset>;
|
|
202
419
|
/**
|
|
203
|
-
* List assets with pagination support
|
|
420
|
+
* List assets with pagination support (convenience delegate to venue.assets.list)
|
|
204
421
|
* @param options - Pagination options (offset, limit)
|
|
205
422
|
* @returns {Promise<AssetList>} Paginated list of asset IDs with metadata
|
|
206
423
|
*/
|
|
@@ -217,33 +434,26 @@ declare class Venue implements VenueInterface {
|
|
|
217
434
|
*/
|
|
218
435
|
getJob(jobId: string): Promise<Job>;
|
|
219
436
|
/**
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
cancelJob(jobId: string): Promise<number>;
|
|
225
|
-
/**
|
|
226
|
-
* Delete job by ID
|
|
227
|
-
* @param jobId - Job identifier
|
|
228
|
-
* @returns {Promise<number>}
|
|
229
|
-
*/
|
|
230
|
-
deleteJob(jobId: string): Promise<number>;
|
|
437
|
+
* List secret names
|
|
438
|
+
* @returns {Promise<string[]>}
|
|
439
|
+
*/
|
|
440
|
+
listSecrets(): Promise<string[]>;
|
|
231
441
|
/**
|
|
232
|
-
*
|
|
233
|
-
* @
|
|
442
|
+
* Store a secret value
|
|
443
|
+
* @param name - Secret name
|
|
444
|
+
* @param value - Secret value
|
|
234
445
|
*/
|
|
235
|
-
|
|
446
|
+
putSecret(name: string, value: string): Promise<void>;
|
|
236
447
|
/**
|
|
237
|
-
*
|
|
238
|
-
* @
|
|
448
|
+
* Delete a secret
|
|
449
|
+
* @param name - Secret name
|
|
239
450
|
*/
|
|
240
|
-
|
|
451
|
+
deleteSecret(name: string): Promise<void>;
|
|
241
452
|
/**
|
|
242
|
-
* Get
|
|
243
|
-
* @
|
|
244
|
-
* @returns {Promise<OperationInfo>}
|
|
453
|
+
* Get venue status
|
|
454
|
+
* @returns {Promise<StatusData>}
|
|
245
455
|
*/
|
|
246
|
-
|
|
456
|
+
status(): Promise<StatusData>;
|
|
247
457
|
/**
|
|
248
458
|
* Get the full DID document for this venue
|
|
249
459
|
* @returns {Promise<DIDDocument>}
|
|
@@ -259,40 +469,6 @@ declare class Venue implements VenueInterface {
|
|
|
259
469
|
* @returns {Promise<AgentCard>}
|
|
260
470
|
*/
|
|
261
471
|
agentCard(): Promise<AgentCard>;
|
|
262
|
-
/**
|
|
263
|
-
* Get asset metadata
|
|
264
|
-
* @returns {Promise<AssetMetadata>}
|
|
265
|
-
*/
|
|
266
|
-
getMetadata(assetId: string): Promise<AssetMetadata>;
|
|
267
|
-
/**
|
|
268
|
-
* Put content to asset
|
|
269
|
-
* @param content - Content to upload
|
|
270
|
-
* @returns {Promise<ReadableStream<Uint8Array> | null>}
|
|
271
|
-
*/
|
|
272
|
-
putContent(assetId: string, content: BodyInit): Promise<ReadableStream<Uint8Array> | null>;
|
|
273
|
-
/**
|
|
274
|
-
* Get asset content
|
|
275
|
-
* @returns {Promise<ReadableStream<Uint8Array> | null>}
|
|
276
|
-
*/
|
|
277
|
-
getContent(assetId: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
278
|
-
/**
|
|
279
|
-
* Execute the operation
|
|
280
|
-
* @param input - Operation input parameters
|
|
281
|
-
* @returns {Promise<any>}
|
|
282
|
-
*/
|
|
283
|
-
run(assetId: string, input: any): Promise<any>;
|
|
284
|
-
/**
|
|
285
|
-
* Execute the operation
|
|
286
|
-
* @param input - Operation input parameters
|
|
287
|
-
* @returns {Promise<Job>}
|
|
288
|
-
*/
|
|
289
|
-
invoke(assetId: string, input: any): Promise<Job>;
|
|
290
|
-
/**
|
|
291
|
-
* Stream server-sent events for a job.
|
|
292
|
-
* @param jobId - Job identifier
|
|
293
|
-
* @returns AsyncGenerator yielding SSEEvent objects
|
|
294
|
-
*/
|
|
295
|
-
streamJobEvents(jobId: string): AsyncGenerator<SSEEvent>;
|
|
296
472
|
/**
|
|
297
473
|
* Close the venue and release resources.
|
|
298
474
|
* Clears cached asset data for this venue.
|
|
@@ -316,30 +492,25 @@ interface VenueConstructor {
|
|
|
316
492
|
new (): VenueInterface;
|
|
317
493
|
connect(venueId: string | Venue, auth?: Auth): Promise<Venue>;
|
|
318
494
|
}
|
|
495
|
+
interface InvokeOptions {
|
|
496
|
+
ucans?: string[];
|
|
497
|
+
}
|
|
319
498
|
interface VenueInterface {
|
|
320
499
|
baseUrl: string;
|
|
321
500
|
venueId: string;
|
|
322
501
|
metadata: VenueData;
|
|
323
|
-
|
|
324
|
-
deleteJob(jobId: string): Promise<number>;
|
|
502
|
+
auth: Auth;
|
|
325
503
|
status(): Promise<StatusData>;
|
|
326
504
|
getJob(jobId: string): Promise<Job>;
|
|
327
505
|
listJobs(): Promise<string[]>;
|
|
328
506
|
getAsset(assetId: AssetID): Promise<Asset>;
|
|
329
|
-
register(assetData: any): Promise<Asset>;
|
|
330
|
-
getMetadata(assetId: string): Promise<AssetMetadata>;
|
|
331
|
-
readStream(reader: ReadableStreamDefaultReader<Uint8Array>): Promise<void>;
|
|
332
|
-
putContent(assetId: string, content: BodyInit): Promise<ReadableStream<Uint8Array> | null>;
|
|
333
|
-
getContent(assetId: string): Promise<ReadableStream<Uint8Array> | null>;
|
|
334
|
-
run(assetId: string, input: any): Promise<any>;
|
|
335
|
-
invoke(assetId: string, input: any): Promise<Job>;
|
|
336
507
|
listAssets(options?: AssetListOptions): Promise<AssetList>;
|
|
337
|
-
listOperations(): Promise<OperationInfo[]>;
|
|
338
|
-
getOperation(name: string): Promise<OperationInfo>;
|
|
339
508
|
didDocument(): Promise<DIDDocument>;
|
|
340
509
|
mcpDiscovery(): Promise<MCPDiscovery>;
|
|
341
510
|
agentCard(): Promise<AgentCard>;
|
|
342
|
-
|
|
511
|
+
listSecrets(): Promise<string[]>;
|
|
512
|
+
putSecret(name: string, value: string): Promise<void>;
|
|
513
|
+
deleteSecret(name: string): Promise<void>;
|
|
343
514
|
close(): void;
|
|
344
515
|
}
|
|
345
516
|
type AssetID = string;
|
|
@@ -375,6 +546,9 @@ interface ContentDetails {
|
|
|
375
546
|
interface OperationPayload {
|
|
376
547
|
[key: string]: any;
|
|
377
548
|
}
|
|
549
|
+
interface ContentHashResult {
|
|
550
|
+
hash: string;
|
|
551
|
+
}
|
|
378
552
|
interface JobMetadata {
|
|
379
553
|
name?: string;
|
|
380
554
|
status?: RunStatus;
|
|
@@ -382,7 +556,9 @@ interface JobMetadata {
|
|
|
382
556
|
updated?: string;
|
|
383
557
|
input?: any;
|
|
384
558
|
output?: any;
|
|
385
|
-
|
|
559
|
+
operation?: string;
|
|
560
|
+
caller?: string;
|
|
561
|
+
error?: string;
|
|
386
562
|
[key: string]: any;
|
|
387
563
|
}
|
|
388
564
|
interface InvokePayload {
|
|
@@ -467,6 +643,195 @@ interface SSEEvent {
|
|
|
467
643
|
/** Parse the event data as JSON. */
|
|
468
644
|
json: () => any;
|
|
469
645
|
}
|
|
646
|
+
declare enum AgentStatus {
|
|
647
|
+
SLEEPING = "SLEEPING",
|
|
648
|
+
RUNNING = "RUNNING",
|
|
649
|
+
SUSPENDED = "SUSPENDED",
|
|
650
|
+
TERMINATED = "TERMINATED"
|
|
651
|
+
}
|
|
652
|
+
interface AgentCreateInput {
|
|
653
|
+
agentId: string;
|
|
654
|
+
config?: Record<string, any>;
|
|
655
|
+
state?: Record<string, any>;
|
|
656
|
+
overwrite?: boolean;
|
|
657
|
+
}
|
|
658
|
+
interface AgentCreateResult {
|
|
659
|
+
agentId: string;
|
|
660
|
+
status: string;
|
|
661
|
+
created: boolean;
|
|
662
|
+
}
|
|
663
|
+
interface AgentRequestInput {
|
|
664
|
+
agentId: string;
|
|
665
|
+
input?: any;
|
|
666
|
+
wait?: boolean | number;
|
|
667
|
+
}
|
|
668
|
+
interface AgentRequestResult {
|
|
669
|
+
id: string;
|
|
670
|
+
status: string;
|
|
671
|
+
output?: any;
|
|
672
|
+
}
|
|
673
|
+
interface AgentMessageInput {
|
|
674
|
+
agentId: string;
|
|
675
|
+
message: any;
|
|
676
|
+
}
|
|
677
|
+
interface AgentMessageResult {
|
|
678
|
+
agentId: string;
|
|
679
|
+
delivered: boolean;
|
|
680
|
+
}
|
|
681
|
+
interface AgentTriggerInput {
|
|
682
|
+
agentId: string;
|
|
683
|
+
}
|
|
684
|
+
interface AgentTriggerResult {
|
|
685
|
+
agentId: string;
|
|
686
|
+
status: string;
|
|
687
|
+
result?: any;
|
|
688
|
+
taskResults?: any[];
|
|
689
|
+
}
|
|
690
|
+
interface AgentQueryInput {
|
|
691
|
+
agentId: string;
|
|
692
|
+
}
|
|
693
|
+
interface AgentQueryResult {
|
|
694
|
+
agentId: string;
|
|
695
|
+
status: string;
|
|
696
|
+
state?: Record<string, any>;
|
|
697
|
+
config?: Record<string, any>;
|
|
698
|
+
tasks?: any[];
|
|
699
|
+
[key: string]: any;
|
|
700
|
+
}
|
|
701
|
+
interface AgentListInput {
|
|
702
|
+
includeTerminated?: boolean;
|
|
703
|
+
}
|
|
704
|
+
interface AgentListResult {
|
|
705
|
+
agents: Array<{
|
|
706
|
+
agentId: string;
|
|
707
|
+
status: string;
|
|
708
|
+
tasks: number;
|
|
709
|
+
}>;
|
|
710
|
+
}
|
|
711
|
+
interface AgentDeleteInput {
|
|
712
|
+
agentId: string;
|
|
713
|
+
remove?: boolean;
|
|
714
|
+
}
|
|
715
|
+
interface AgentDeleteResult {
|
|
716
|
+
agentId: string;
|
|
717
|
+
status: string;
|
|
718
|
+
removed?: boolean;
|
|
719
|
+
}
|
|
720
|
+
interface AgentSuspendResult {
|
|
721
|
+
agentId: string;
|
|
722
|
+
status: string;
|
|
723
|
+
}
|
|
724
|
+
interface AgentResumeInput {
|
|
725
|
+
agentId: string;
|
|
726
|
+
autoWake?: boolean;
|
|
727
|
+
}
|
|
728
|
+
interface AgentUpdateInput {
|
|
729
|
+
agentId: string;
|
|
730
|
+
config?: Record<string, any>;
|
|
731
|
+
state?: Record<string, any>;
|
|
732
|
+
}
|
|
733
|
+
interface AgentCancelTaskInput {
|
|
734
|
+
agentId: string;
|
|
735
|
+
taskId: string;
|
|
736
|
+
}
|
|
737
|
+
interface WorkspaceReadInput {
|
|
738
|
+
path: string;
|
|
739
|
+
maxSize?: number;
|
|
740
|
+
}
|
|
741
|
+
interface WorkspaceReadResult {
|
|
742
|
+
exists: boolean;
|
|
743
|
+
value?: any;
|
|
744
|
+
truncated?: boolean;
|
|
745
|
+
size?: number;
|
|
746
|
+
}
|
|
747
|
+
interface WorkspaceWriteInput {
|
|
748
|
+
path: string;
|
|
749
|
+
value: any;
|
|
750
|
+
}
|
|
751
|
+
interface WorkspaceWriteResult {
|
|
752
|
+
written: boolean;
|
|
753
|
+
}
|
|
754
|
+
interface WorkspaceDeleteInput {
|
|
755
|
+
path: string;
|
|
756
|
+
}
|
|
757
|
+
interface WorkspaceDeleteResult {
|
|
758
|
+
deleted: boolean;
|
|
759
|
+
}
|
|
760
|
+
interface WorkspaceAppendInput {
|
|
761
|
+
path: string;
|
|
762
|
+
value: any;
|
|
763
|
+
}
|
|
764
|
+
interface WorkspaceAppendResult {
|
|
765
|
+
appended: boolean;
|
|
766
|
+
}
|
|
767
|
+
interface WorkspaceListInput {
|
|
768
|
+
path?: string;
|
|
769
|
+
limit?: number;
|
|
770
|
+
offset?: number;
|
|
771
|
+
}
|
|
772
|
+
interface WorkspaceListResult {
|
|
773
|
+
exists: boolean;
|
|
774
|
+
type: string;
|
|
775
|
+
count?: number;
|
|
776
|
+
keys?: string[];
|
|
777
|
+
values?: any[];
|
|
778
|
+
offset?: number;
|
|
779
|
+
}
|
|
780
|
+
interface WorkspaceSliceInput {
|
|
781
|
+
path: string;
|
|
782
|
+
offset?: number;
|
|
783
|
+
limit?: number;
|
|
784
|
+
}
|
|
785
|
+
interface WorkspaceSliceResult {
|
|
786
|
+
exists: boolean;
|
|
787
|
+
type: string;
|
|
788
|
+
values: any[];
|
|
789
|
+
count: number;
|
|
790
|
+
offset: number;
|
|
791
|
+
}
|
|
792
|
+
interface UCANAttenuation {
|
|
793
|
+
with: string;
|
|
794
|
+
can: string;
|
|
795
|
+
}
|
|
796
|
+
interface UCANIssueInput {
|
|
797
|
+
aud: string;
|
|
798
|
+
att: UCANAttenuation[];
|
|
799
|
+
exp: number;
|
|
800
|
+
}
|
|
801
|
+
interface UCANIssueResult {
|
|
802
|
+
[key: string]: any;
|
|
803
|
+
}
|
|
804
|
+
interface SecretSetInput {
|
|
805
|
+
name: string;
|
|
806
|
+
value: string;
|
|
807
|
+
}
|
|
808
|
+
interface SecretSetResult {
|
|
809
|
+
name: string;
|
|
810
|
+
stored: boolean;
|
|
811
|
+
}
|
|
812
|
+
interface SecretExtractInput {
|
|
813
|
+
name: string;
|
|
814
|
+
}
|
|
815
|
+
interface SecretExtractResult {
|
|
816
|
+
name: string;
|
|
817
|
+
value: string;
|
|
818
|
+
}
|
|
819
|
+
interface FunctionInfo {
|
|
820
|
+
name: string;
|
|
821
|
+
id: string;
|
|
822
|
+
description?: string;
|
|
823
|
+
}
|
|
824
|
+
interface FunctionsResult {
|
|
825
|
+
functions: FunctionInfo[];
|
|
826
|
+
}
|
|
827
|
+
interface AdapterInfo {
|
|
828
|
+
name: string;
|
|
829
|
+
description?: string;
|
|
830
|
+
operations: string[];
|
|
831
|
+
}
|
|
832
|
+
interface AdaptersResult {
|
|
833
|
+
adapters: AdapterInfo[];
|
|
834
|
+
}
|
|
470
835
|
declare class CoviaError extends Error {
|
|
471
836
|
code: number | null;
|
|
472
837
|
constructor(message: string, code?: number | null);
|
|
@@ -588,7 +953,7 @@ declare class Grid {
|
|
|
588
953
|
/**
|
|
589
954
|
* Static method to connect to a venue
|
|
590
955
|
* @param venueId - Can be a HTTP base URL, DNS name, or existing Venue instance
|
|
591
|
-
* @param auth - Optional authentication provider (BearerAuth,
|
|
956
|
+
* @param auth - Optional authentication provider (BearerAuth, KeyPairAuth, etc.)
|
|
592
957
|
* @returns {Promise<Venue>} A new Venue instance configured appropriately
|
|
593
958
|
*/
|
|
594
959
|
static connect(venueId: string, auth?: Auth): Promise<Venue>;
|
|
@@ -602,4 +967,47 @@ declare class DataAsset extends Asset {
|
|
|
602
967
|
constructor(id: AssetID, venue: VenueInterface, metadata?: AssetMetadata);
|
|
603
968
|
}
|
|
604
969
|
|
|
605
|
-
|
|
970
|
+
/**
|
|
971
|
+
* Ed25519 keypair generation and utility functions.
|
|
972
|
+
*/
|
|
973
|
+
/**
|
|
974
|
+
* Generate a random Ed25519 keypair.
|
|
975
|
+
* @returns Object with privateKey (32 bytes) and publicKey (32 bytes)
|
|
976
|
+
*/
|
|
977
|
+
declare function generateKeyPair(): {
|
|
978
|
+
privateKey: Uint8Array;
|
|
979
|
+
publicKey: Uint8Array;
|
|
980
|
+
};
|
|
981
|
+
/**
|
|
982
|
+
* Convert a private key to hex string for storage.
|
|
983
|
+
*/
|
|
984
|
+
declare function privateKeyToHex(key: Uint8Array): string;
|
|
985
|
+
/**
|
|
986
|
+
* Convert a hex string back to a private key Uint8Array.
|
|
987
|
+
*/
|
|
988
|
+
declare function hexToPrivateKey(hex: string): Uint8Array;
|
|
989
|
+
|
|
990
|
+
/**
|
|
991
|
+
* Multikey encoding for Ed25519 public keys.
|
|
992
|
+
* Follows the did:key spec with multicodec prefix 0xed01 for Ed25519.
|
|
993
|
+
*/
|
|
994
|
+
/**
|
|
995
|
+
* Encode an Ed25519 public key as a multikey string (z-prefixed base58-btc).
|
|
996
|
+
* @param publicKey - 32-byte Ed25519 public key
|
|
997
|
+
* @returns Multikey string like "z6MkhaXgBZD..."
|
|
998
|
+
*/
|
|
999
|
+
declare function encodePublicKey(publicKey: Uint8Array): string;
|
|
1000
|
+
/**
|
|
1001
|
+
* Decode a multikey string back to a 32-byte Ed25519 public key.
|
|
1002
|
+
* @param multikey - Multikey string starting with "z"
|
|
1003
|
+
* @returns 32-byte Ed25519 public key
|
|
1004
|
+
*/
|
|
1005
|
+
declare function decodePublicKey(multikey: string): Uint8Array;
|
|
1006
|
+
/**
|
|
1007
|
+
* Create a did:key DID from an Ed25519 public key.
|
|
1008
|
+
* @param publicKey - 32-byte Ed25519 public key
|
|
1009
|
+
* @returns DID string like "did:key:z6MkhaXgBZD..."
|
|
1010
|
+
*/
|
|
1011
|
+
declare function didFromPublicKey(publicKey: Uint8Array): string;
|
|
1012
|
+
|
|
1013
|
+
export { type AdapterInfo, type AdaptersResult, type AgentCancelTaskInput, type AgentCard, type AgentCreateInput, type AgentCreateResult, type AgentDeleteInput, type AgentDeleteResult, type AgentListInput, type AgentListResult, AgentManager, type AgentMessageInput, type AgentMessageResult, type AgentQueryInput, type AgentQueryResult, type AgentRequestInput, type AgentRequestResult, type AgentResumeInput, AgentStatus, type AgentSuspendResult, type AgentTriggerInput, type AgentTriggerResult, type AgentUpdateInput, Asset, type AssetID, type AssetList, type AssetListOptions, AssetManager, type AssetMetadata, AssetNotFoundError, Auth, BearerAuth, type ContentDetails, type ContentHashResult, CoviaConnectionError, CoviaError, CoviaTimeoutError, type Credentials, CredentialsHTTP, type DIDDocument, DataAsset, type FunctionInfo, type FunctionsResult, Grid, GridError, type InvokeOptions, type InvokePayload, Job, JobFailedError, JobManager, type JobMetadata, JobNotFoundError, JobStatus, KeyPairAuth, type MCPDiscovery, NoAuth, NotFoundError, Operation, type OperationDetails, type OperationInfo, OperationManager, type OperationPayload, RunStatus, type SSEEvent, type SecretExtractInput, type SecretExtractResult, SecretManager, type SecretSetInput, type SecretSetResult, type StatsData, type StatusData, type UCANAttenuation, type UCANIssueInput, type UCANIssueResult, UCANManager, Venue, type VenueConstructor, type VenueData, type VenueInterface, type VenueOptions, type WorkspaceAppendInput, type WorkspaceAppendResult, type WorkspaceDeleteInput, type WorkspaceDeleteResult, type WorkspaceListInput, type WorkspaceListResult, WorkspaceManager, type WorkspaceReadInput, type WorkspaceReadResult, type WorkspaceSliceInput, type WorkspaceSliceResult, type WorkspaceWriteInput, type WorkspaceWriteResult, createSSEEvent, decodePublicKey, didFromPublicKey, encodePublicKey, fetchStreamWithError, fetchWithError, generateKeyPair, getAssetIdFromPath, getAssetIdFromVenueId, getParsedAssetId, hexToPrivateKey, isJobComplete, isJobFinished, isJobPaused, logger, parseSSEStream, privateKeyToHex };
|