@covia/covia-sdk 1.5.0 → 1.6.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 +26 -20
- package/dist/index.d.mts +390 -127
- package/dist/index.d.ts +390 -127
- package/dist/index.js +644 -378
- package/dist/index.mjs +636 -379
- package/package.json +14 -9
package/dist/index.d.mts
CHANGED
|
@@ -3,23 +3,22 @@ declare class Agent {
|
|
|
3
3
|
readonly venue: VenueInterface;
|
|
4
4
|
private _agents;
|
|
5
5
|
constructor(id: string, venue: VenueInterface);
|
|
6
|
-
request(input?:
|
|
7
|
-
message(message:
|
|
8
|
-
chat(message:
|
|
6
|
+
request(input?: unknown, wait?: boolean | number): Promise<AgentRequestResult>;
|
|
7
|
+
message(message: unknown): Promise<AgentMessageResult>;
|
|
8
|
+
chat(message: unknown, sessionId?: string): Promise<AgentChatResult>;
|
|
9
9
|
/**
|
|
10
10
|
* Create a ChatSession bound to this agent.
|
|
11
11
|
* @param sessionId - Optional session ID to resume an existing session
|
|
12
12
|
*/
|
|
13
13
|
chatSession(sessionId?: string): ChatSession;
|
|
14
14
|
trigger(): Promise<AgentTriggerResult>;
|
|
15
|
-
query(): Promise<AgentQueryResult>;
|
|
16
15
|
suspend(): Promise<AgentSuspendResult>;
|
|
17
16
|
resume(autoWake?: boolean): Promise<AgentSuspendResult>;
|
|
18
17
|
update(options: {
|
|
19
|
-
config?: Record<string,
|
|
20
|
-
state?: Record<string,
|
|
21
|
-
}): Promise<
|
|
22
|
-
cancelTask(taskId: string): Promise<
|
|
18
|
+
config?: Record<string, unknown>;
|
|
19
|
+
state?: Record<string, unknown>;
|
|
20
|
+
}): Promise<unknown>;
|
|
21
|
+
cancelTask(taskId: string): Promise<unknown>;
|
|
23
22
|
info(): Promise<AgentInfoResult>;
|
|
24
23
|
/**
|
|
25
24
|
* Fork this agent into a new agent.
|
|
@@ -28,11 +27,11 @@ declare class Agent {
|
|
|
28
27
|
* @returns A new Agent instance for the forked agent
|
|
29
28
|
*/
|
|
30
29
|
fork(agentId: string, options?: {
|
|
31
|
-
config?: Record<string,
|
|
30
|
+
config?: Record<string, unknown>;
|
|
32
31
|
includeTimeline?: boolean;
|
|
33
32
|
overwrite?: boolean;
|
|
34
33
|
}): Promise<Agent>;
|
|
35
|
-
context(task?:
|
|
34
|
+
context(task?: unknown): Promise<string>;
|
|
36
35
|
delete(remove?: boolean): Promise<AgentDeleteResult>;
|
|
37
36
|
}
|
|
38
37
|
declare class ChatSession {
|
|
@@ -46,7 +45,7 @@ declare class ChatSession {
|
|
|
46
45
|
* On the first call (when no sessionId is set), the server mints a new session.
|
|
47
46
|
* The returned sessionId is captured and reused for all subsequent calls.
|
|
48
47
|
*/
|
|
49
|
-
send(message:
|
|
48
|
+
send(message: unknown): Promise<AgentChatResult>;
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
declare class Job {
|
|
@@ -68,7 +67,7 @@ declare class Job {
|
|
|
68
67
|
* @throws {Error} If the job has not finished yet.
|
|
69
68
|
* @throws {JobFailedError} If the job finished with a non-COMPLETE status.
|
|
70
69
|
*/
|
|
71
|
-
get output():
|
|
70
|
+
get output(): unknown;
|
|
72
71
|
/**
|
|
73
72
|
* Poll the venue for the latest job status.
|
|
74
73
|
* @throws {Error} If the job has no ID.
|
|
@@ -92,7 +91,7 @@ declare class Job {
|
|
|
92
91
|
*/
|
|
93
92
|
result(options?: {
|
|
94
93
|
timeout?: number;
|
|
95
|
-
}): Promise<
|
|
94
|
+
}): Promise<unknown>;
|
|
96
95
|
/**
|
|
97
96
|
* Stream server-sent events for this job.
|
|
98
97
|
* @returns AsyncGenerator yielding SSEEvent objects
|
|
@@ -115,7 +114,7 @@ declare class Job {
|
|
|
115
114
|
* @param message - Message payload
|
|
116
115
|
* @returns {Promise<any>}
|
|
117
116
|
*/
|
|
118
|
-
sendMessage(message:
|
|
117
|
+
sendMessage(message: unknown): Promise<unknown>;
|
|
119
118
|
/**
|
|
120
119
|
* Pause the job
|
|
121
120
|
* @returns {Promise<JobMetadata>} Updated job metadata
|
|
@@ -168,17 +167,19 @@ declare abstract class Asset {
|
|
|
168
167
|
*/
|
|
169
168
|
getContentURL(): string;
|
|
170
169
|
/**
|
|
171
|
-
* Execute the operation
|
|
170
|
+
* Execute the operation and await its result.
|
|
172
171
|
* @param input - Operation input parameters
|
|
173
|
-
* @
|
|
172
|
+
* @param options - Invocation options (e.g. UCAN proofs)
|
|
173
|
+
* @returns {Promise<T>} The operation result, typed as `T` (defaults to `unknown`)
|
|
174
174
|
*/
|
|
175
|
-
run(input
|
|
175
|
+
run<T = unknown>(input?: unknown, options?: InvokeOptions): Promise<T>;
|
|
176
176
|
/**
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
177
|
+
* Execute the operation, returning the Job without awaiting completion.
|
|
178
|
+
* @param input - Operation input parameters
|
|
179
|
+
* @param options - Invocation options (e.g. UCAN proofs)
|
|
180
|
+
* @returns {Promise<Job>}
|
|
181
|
+
*/
|
|
182
|
+
invoke(input?: unknown, options?: InvokeOptions): Promise<Job>;
|
|
182
183
|
}
|
|
183
184
|
|
|
184
185
|
/**
|
|
@@ -195,12 +196,19 @@ declare abstract class Asset {
|
|
|
195
196
|
* }
|
|
196
197
|
*/
|
|
197
198
|
declare abstract class Auth {
|
|
198
|
-
/**
|
|
199
|
-
|
|
199
|
+
/**
|
|
200
|
+
* Apply authentication credentials to request headers (mutates in place).
|
|
201
|
+
*
|
|
202
|
+
* @param headers - Outgoing request headers to mutate.
|
|
203
|
+
* @param audience - The venue's DID, supplied by the transport. Providers
|
|
204
|
+
* that bind tokens to the venue's identity (e.g. {@link Ed25519Auth}) use it
|
|
205
|
+
* as the JWT `aud`; others ignore it.
|
|
206
|
+
*/
|
|
207
|
+
abstract apply(headers: Record<string, string>, audience?: string): void;
|
|
200
208
|
}
|
|
201
209
|
/** No-op authentication provider. Sends no credentials. */
|
|
202
210
|
declare class NoAuth extends Auth {
|
|
203
|
-
apply(_headers: Record<string, string
|
|
211
|
+
apply(_headers: Record<string, string>, _audience?: string): void;
|
|
204
212
|
}
|
|
205
213
|
/**
|
|
206
214
|
* Bearer token authentication.
|
|
@@ -212,7 +220,20 @@ declare class NoAuth extends Auth {
|
|
|
212
220
|
declare class BearerAuth extends Auth {
|
|
213
221
|
private _token;
|
|
214
222
|
constructor(token: string);
|
|
215
|
-
apply(headers: Record<string, string
|
|
223
|
+
apply(headers: Record<string, string>, _audience?: string): void;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* HTTP Basic authentication.
|
|
227
|
+
* Adds `Authorization: Basic <base64(username:password)>` to every request.
|
|
228
|
+
*
|
|
229
|
+
* Example:
|
|
230
|
+
* const venue = await Grid.connect("https://venue.covia.ai", new BasicAuth("admin", "s3cret"));
|
|
231
|
+
*/
|
|
232
|
+
declare class BasicAuth extends Auth {
|
|
233
|
+
private _username;
|
|
234
|
+
private _password;
|
|
235
|
+
constructor(username: string, password: string);
|
|
236
|
+
apply(headers: Record<string, string>, _audience?: string): void;
|
|
216
237
|
}
|
|
217
238
|
/**
|
|
218
239
|
* Ed25519 keypair authentication (self-issued EdDSA JWT).
|
|
@@ -221,37 +242,53 @@ declare class BearerAuth extends Auth {
|
|
|
221
242
|
* extracts the caller's DID from the `sub` claim.
|
|
222
243
|
*
|
|
223
244
|
* Example:
|
|
224
|
-
* const auth =
|
|
245
|
+
* const auth = Ed25519Auth.generate();
|
|
225
246
|
* console.log(auth.getDID()); // did:key:z6Mk...
|
|
226
247
|
* const venue = await Grid.connect("https://venue.covia.ai", auth);
|
|
227
248
|
*/
|
|
228
|
-
declare class
|
|
249
|
+
declare class Ed25519Auth extends Auth {
|
|
229
250
|
private _privateKey;
|
|
230
251
|
private _publicKey;
|
|
231
252
|
private _did;
|
|
232
253
|
private _lifetime;
|
|
254
|
+
private _audience?;
|
|
233
255
|
/**
|
|
234
256
|
* @param privateKey - 32-byte Ed25519 private key
|
|
235
257
|
* @param tokenLifetimeSeconds - JWT lifetime in seconds (default 300 = 5 min)
|
|
236
258
|
*/
|
|
237
259
|
constructor(privateKey: Uint8Array, tokenLifetimeSeconds?: number);
|
|
238
|
-
apply(headers: Record<string, string
|
|
260
|
+
apply(headers: Record<string, string>, audience?: string): void;
|
|
239
261
|
/** The caller's DID derived from the public key. */
|
|
240
262
|
getDID(): string;
|
|
263
|
+
/**
|
|
264
|
+
* Explicitly pin the JWT `aud` claim. Overrides the venue DID the transport
|
|
265
|
+
* supplies — normally unnecessary, since the venue DID is the correct audience.
|
|
266
|
+
*/
|
|
267
|
+
set audience(value: string | undefined);
|
|
268
|
+
get audience(): string | undefined;
|
|
241
269
|
/** The 32-byte Ed25519 public key. */
|
|
242
270
|
getPublicKey(): Uint8Array;
|
|
243
|
-
/** Generate a new random keypair and return
|
|
244
|
-
static generate(tokenLifetimeSeconds?: number):
|
|
271
|
+
/** Generate a new random keypair and return an Ed25519Auth instance. */
|
|
272
|
+
static generate(tokenLifetimeSeconds?: number): Ed25519Auth;
|
|
245
273
|
/** Create from a hex-encoded private key string. */
|
|
246
|
-
static fromHex(privateKeyHex: string, tokenLifetimeSeconds?: number):
|
|
274
|
+
static fromHex(privateKeyHex: string, tokenLifetimeSeconds?: number): Ed25519Auth;
|
|
247
275
|
}
|
|
248
|
-
/**
|
|
276
|
+
/**
|
|
277
|
+
* @deprecated Renamed to {@link Ed25519Auth} for cross-SDK consistency
|
|
278
|
+
* (the Python SDK uses the same name). This alias keeps existing
|
|
279
|
+
* `KeyPairAuth` / `KeyPairAuth.generate()` / `KeyPairAuth.fromHex()` usage
|
|
280
|
+
* working; prefer `Ed25519Auth` in new code.
|
|
281
|
+
*/
|
|
282
|
+
declare const KeyPairAuth: typeof Ed25519Auth;
|
|
283
|
+
/** @deprecated Renamed to {@link Ed25519Auth}. */
|
|
284
|
+
type KeyPairAuth = Ed25519Auth;
|
|
285
|
+
/** @deprecated Use Auth subclasses instead (NoAuth, BearerAuth, BasicAuth, Ed25519Auth). */
|
|
249
286
|
interface Credentials {
|
|
250
287
|
venueId: string;
|
|
251
288
|
apiKey: string;
|
|
252
289
|
userId: string;
|
|
253
290
|
}
|
|
254
|
-
/** @deprecated Use Auth subclasses instead (NoAuth, BearerAuth,
|
|
291
|
+
/** @deprecated Use Auth subclasses instead (NoAuth, BearerAuth, BasicAuth, Ed25519Auth). */
|
|
255
292
|
declare class CredentialsHTTP implements Credentials {
|
|
256
293
|
venueId: string;
|
|
257
294
|
apiKey: string;
|
|
@@ -260,16 +297,14 @@ declare class CredentialsHTTP implements Credentials {
|
|
|
260
297
|
}
|
|
261
298
|
|
|
262
299
|
interface AgentManagerVenue {
|
|
263
|
-
operations:
|
|
264
|
-
run(assetId: string, input: any): Promise<any>;
|
|
265
|
-
};
|
|
300
|
+
operations: OperationRunner;
|
|
266
301
|
}
|
|
267
302
|
declare class AgentManager {
|
|
268
303
|
private venue;
|
|
269
304
|
constructor(venue: AgentManagerVenue);
|
|
270
305
|
create(input: AgentCreateInput): Promise<AgentCreateResult>;
|
|
271
|
-
request(agentId: string, input?:
|
|
272
|
-
message(agentId: string, message:
|
|
306
|
+
request(agentId: string, input?: unknown, wait?: boolean | number): Promise<AgentRequestResult>;
|
|
307
|
+
message(agentId: string, message: unknown): Promise<AgentMessageResult>;
|
|
273
308
|
/**
|
|
274
309
|
* Send a message to an agent and synchronously await its next response on the session.
|
|
275
310
|
*
|
|
@@ -286,26 +321,26 @@ declare class AgentManager {
|
|
|
286
321
|
* Blocking: always blocks until the agent produces its next response on the session.
|
|
287
322
|
* No polling required.
|
|
288
323
|
*/
|
|
289
|
-
chat(agentId: string, message:
|
|
324
|
+
chat(agentId: string, message: unknown, sessionId?: string): Promise<AgentChatResult>;
|
|
290
325
|
trigger(agentId: string): Promise<AgentTriggerResult>;
|
|
291
|
-
query(agentId: string): Promise<AgentQueryResult>;
|
|
292
326
|
list(includeTerminated?: boolean): Promise<AgentListResult>;
|
|
293
327
|
delete(agentId: string, remove?: boolean): Promise<AgentDeleteResult>;
|
|
294
328
|
suspend(agentId: string): Promise<AgentSuspendResult>;
|
|
295
329
|
resume(agentId: string, autoWake?: boolean): Promise<AgentSuspendResult>;
|
|
296
|
-
update(input: AgentUpdateInput): Promise<
|
|
297
|
-
cancelTask(agentId: string, taskId: string): Promise<
|
|
330
|
+
update(input: AgentUpdateInput): Promise<unknown>;
|
|
331
|
+
cancelTask(agentId: string, taskId: string): Promise<unknown>;
|
|
298
332
|
info(agentId: string): Promise<AgentInfoResult>;
|
|
299
333
|
fork(input: AgentForkInput): Promise<AgentForkResult>;
|
|
300
|
-
context(agentId: string, task?:
|
|
301
|
-
completeTask(result?:
|
|
334
|
+
context(agentId: string, task?: unknown): Promise<string>;
|
|
335
|
+
completeTask(result?: unknown): Promise<AgentCompleteTaskResult>;
|
|
302
336
|
failTask(error: string): Promise<AgentFailTaskResult>;
|
|
303
337
|
}
|
|
304
338
|
|
|
305
339
|
interface JobManagerVenue {
|
|
306
340
|
baseUrl: string;
|
|
341
|
+
venueId: string;
|
|
307
342
|
auth: {
|
|
308
|
-
apply(headers: Record<string, string
|
|
343
|
+
apply(headers: Record<string, string>, audience?: string): void;
|
|
309
344
|
};
|
|
310
345
|
}
|
|
311
346
|
declare class JobManager {
|
|
@@ -317,26 +352,30 @@ declare class JobManager {
|
|
|
317
352
|
delete(jobId: string): Promise<void>;
|
|
318
353
|
pause(jobId: string): Promise<JobMetadata>;
|
|
319
354
|
resume(jobId: string): Promise<JobMetadata>;
|
|
320
|
-
sendMessage(jobId: string, message:
|
|
355
|
+
sendMessage(jobId: string, message: unknown): Promise<unknown>;
|
|
321
356
|
stream(jobId: string): AsyncGenerator<SSEEvent>;
|
|
322
357
|
private _buildHeaders;
|
|
323
358
|
}
|
|
324
359
|
|
|
325
360
|
interface AssetManagerVenue {
|
|
326
361
|
baseUrl: string;
|
|
362
|
+
venueId: string;
|
|
327
363
|
auth: {
|
|
328
|
-
apply(headers: Record<string, string
|
|
329
|
-
};
|
|
330
|
-
operations: {
|
|
331
|
-
run(assetId: string, input: any): Promise<any>;
|
|
364
|
+
apply(headers: Record<string, string>, audience?: string): void;
|
|
332
365
|
};
|
|
366
|
+
operations: OperationRunner;
|
|
333
367
|
}
|
|
334
368
|
declare class AssetManager {
|
|
335
369
|
private venue;
|
|
336
370
|
constructor(venue: AssetManagerVenue);
|
|
337
371
|
/**
|
|
338
|
-
* Get asset by
|
|
339
|
-
*
|
|
372
|
+
* Get an asset by lattice address.
|
|
373
|
+
*
|
|
374
|
+
* `assetId` may be a content hash (`<hash>`, `a/<hash>`, `<DID>/a/<hash>`) or
|
|
375
|
+
* a mutable lattice path the venue resolves (`w/my-assets/foo`, `o/my-op`,
|
|
376
|
+
* `<DID>/w/...`). Only content-addressed (immutable) refs are cached;
|
|
377
|
+
* mutable paths are always re-fetched, so a changed value is never served stale.
|
|
378
|
+
* @param assetId - Asset identifier or lattice address
|
|
340
379
|
* @returns Returns either an Operation or DataAsset based on the asset's metadata
|
|
341
380
|
*/
|
|
342
381
|
get(assetId: AssetID): Promise<Asset>;
|
|
@@ -349,7 +388,7 @@ declare class AssetManager {
|
|
|
349
388
|
* Register a new asset
|
|
350
389
|
* @param assetData - Asset configuration
|
|
351
390
|
*/
|
|
352
|
-
register(assetData:
|
|
391
|
+
register(assetData: unknown): Promise<Asset>;
|
|
353
392
|
/**
|
|
354
393
|
* Get asset metadata
|
|
355
394
|
* @param assetId - Asset identifier
|
|
@@ -382,8 +421,9 @@ declare class AssetManager {
|
|
|
382
421
|
|
|
383
422
|
interface OperationManagerVenue {
|
|
384
423
|
baseUrl: string;
|
|
424
|
+
venueId: string;
|
|
385
425
|
auth: {
|
|
386
|
-
apply(headers: Record<string, string
|
|
426
|
+
apply(headers: Record<string, string>, audience?: string): void;
|
|
387
427
|
};
|
|
388
428
|
}
|
|
389
429
|
declare class OperationManager {
|
|
@@ -404,39 +444,104 @@ declare class OperationManager {
|
|
|
404
444
|
* @param input - Operation input parameters
|
|
405
445
|
* @param options - Invoke options (e.g., ucans)
|
|
406
446
|
*/
|
|
407
|
-
run(assetId: string, input
|
|
447
|
+
run<T = unknown>(assetId: string, input?: unknown, options?: InvokeOptions): Promise<T>;
|
|
408
448
|
/**
|
|
409
449
|
* Execute an operation and return a Job for tracking
|
|
410
450
|
* @param assetId - Operation asset ID or named operation
|
|
411
451
|
* @param input - Operation input parameters
|
|
412
452
|
* @param options - Invoke options (e.g., ucans)
|
|
413
453
|
*/
|
|
414
|
-
invoke(assetId: string, input
|
|
454
|
+
invoke(assetId: string, input?: unknown, options?: InvokeOptions): Promise<Job>;
|
|
415
455
|
private _buildHeaders;
|
|
416
456
|
}
|
|
417
457
|
|
|
418
458
|
interface WorkspaceManagerVenue {
|
|
419
|
-
|
|
420
|
-
|
|
459
|
+
baseUrl: string;
|
|
460
|
+
venueId: string;
|
|
461
|
+
auth: {
|
|
462
|
+
apply(headers: Record<string, string>, audience?: string): void;
|
|
421
463
|
};
|
|
464
|
+
operations: OperationRunner;
|
|
465
|
+
lastKnownStatus?: StatusData;
|
|
422
466
|
}
|
|
467
|
+
/**
|
|
468
|
+
* Workspace (lattice) operations against a venue.
|
|
469
|
+
*
|
|
470
|
+
* **Reads are job-free.** `read`/`list`/`slice`/`inspect`/`count`/`aggregate` go
|
|
471
|
+
* through `GET /api/v1/values/*` (covia #177) — synchronous, capability-checked,
|
|
472
|
+
* and **no Job is persisted**. This matters at scale: routing reads through the
|
|
473
|
+
* invoke/job path writes one durable job record per read, which grows the venue's
|
|
474
|
+
* etch without bound under a read-heavy consumer.
|
|
475
|
+
*
|
|
476
|
+
* **Writes stay on the job path** (`write`/`delete`/`append`/`copy` via
|
|
477
|
+
* `operations.run`) — a mutation *should* leave an audit record.
|
|
478
|
+
*
|
|
479
|
+
* Paths resolve against the caller's own DID unless fully qualified
|
|
480
|
+
* (`<DID>/w/...`). Reading another DID's namespace is capability-gated: the
|
|
481
|
+
* job-free GET path carries only the caller's identity token, so a read that
|
|
482
|
+
* needs UCAN **proof tokens** (`ucans`) transparently falls back to the invoke
|
|
483
|
+
* path (the only transport that carries a proof array). Own-namespace reads —
|
|
484
|
+
* the common case — never need this and stay fully job-free.
|
|
485
|
+
*
|
|
486
|
+
* Venues that predate the `/values` routes (< covia 0.3) are accommodated
|
|
487
|
+
* here, not in application code: a 404 from the GET surface can only mean the
|
|
488
|
+
* route is missing (an absent path is `200 {exists:false}`), so reads fall
|
|
489
|
+
* back to the invoke path and the venue is remembered as pre-0.3 for the rest
|
|
490
|
+
* of this manager's lifetime.
|
|
491
|
+
*/
|
|
423
492
|
declare class WorkspaceManager {
|
|
424
493
|
private venue;
|
|
494
|
+
private valuesSupported;
|
|
425
495
|
constructor(venue: WorkspaceManagerVenue);
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
496
|
+
private _headers;
|
|
497
|
+
/** GET a job-free `/api/v1/values/{op}` read; omit undefined params. */
|
|
498
|
+
private _values;
|
|
499
|
+
/**
|
|
500
|
+
* Whether the venue serves `GET /api/v1/values/*`: no if a probe already
|
|
501
|
+
* 404'd, or if the venue's last known status identifies it as pre-0.3
|
|
502
|
+
* (venues that old don't report a `version` at all). Checked per read —
|
|
503
|
+
* connect/`status()` may populate the status after this manager exists.
|
|
504
|
+
*/
|
|
505
|
+
private supportsValues;
|
|
506
|
+
/** A job-free values read, falling back to the invoke path on pre-0.3 venues. */
|
|
507
|
+
private _valuesOr;
|
|
508
|
+
read(path: string, maxSize?: number, ucans?: string[]): Promise<WorkspaceReadResult>;
|
|
509
|
+
list(path?: string, limit?: number, offset?: number, ucans?: string[]): Promise<WorkspaceListResult>;
|
|
510
|
+
slice(path: string, offset?: number, limit?: number, ucans?: string[]): Promise<WorkspaceSliceResult>;
|
|
511
|
+
inspect(paths: string | string[], budget?: number, compact?: boolean, ucans?: string[]): Promise<WorkspaceInspectResult>;
|
|
512
|
+
/**
|
|
513
|
+
* Count entries at a depth below `path` — a job-free server-side tally, so the
|
|
514
|
+
* caller never reads every record to learn "how many".
|
|
515
|
+
*
|
|
516
|
+
* `depth` = the exact number of `get`-steps below `path` to visit (default 1 =
|
|
517
|
+
* direct children). Records nested at `w/x/<bucket>/<record>` are counted with
|
|
518
|
+
* `depth: 2`. Absent path or a scalar → `{exists:false}`.
|
|
519
|
+
*/
|
|
520
|
+
count(path: string, opts?: {
|
|
521
|
+
depth?: number;
|
|
522
|
+
ucans?: string[];
|
|
523
|
+
}): Promise<WorkspaceCountResult>;
|
|
524
|
+
/**
|
|
525
|
+
* Count entries at a depth below `path`, optionally partitioned by a field —
|
|
526
|
+
* the job-free, authoritative alternative to counting client-side.
|
|
527
|
+
*
|
|
528
|
+
* `groupBy` names the field whose value forms each group key (may be a relative
|
|
529
|
+
* path, `foo/bar`); an entry missing it groups under `"null"`. Σ(group counts)
|
|
530
|
+
* equals the top-level `count`.
|
|
531
|
+
*/
|
|
532
|
+
aggregate(path: string, opts?: {
|
|
533
|
+
depth?: number;
|
|
534
|
+
groupBy?: string;
|
|
535
|
+
ucans?: string[];
|
|
536
|
+
}): Promise<WorkspaceAggregateResult>;
|
|
537
|
+
write(path: string, value: unknown, ucans?: string[]): Promise<WorkspaceWriteResult>;
|
|
538
|
+
delete(path: string, ucans?: string[]): Promise<WorkspaceDeleteResult>;
|
|
539
|
+
append(path: string, value: unknown, ucans?: string[]): Promise<WorkspaceAppendResult>;
|
|
540
|
+
copy(from: string, to: string, ucans?: string[]): Promise<WorkspaceCopyResult>;
|
|
434
541
|
}
|
|
435
542
|
|
|
436
543
|
interface UCANManagerVenue {
|
|
437
|
-
operations:
|
|
438
|
-
run(assetId: string, input: any): Promise<any>;
|
|
439
|
-
};
|
|
544
|
+
operations: OperationRunner;
|
|
440
545
|
}
|
|
441
546
|
declare class UCANManager {
|
|
442
547
|
private venue;
|
|
@@ -445,11 +550,8 @@ declare class UCANManager {
|
|
|
445
550
|
}
|
|
446
551
|
|
|
447
552
|
interface SecretManagerVenue {
|
|
448
|
-
operations:
|
|
449
|
-
run(assetId: string, input: any): Promise<any>;
|
|
450
|
-
};
|
|
553
|
+
operations: OperationRunner;
|
|
451
554
|
listSecrets(): Promise<string[]>;
|
|
452
|
-
putSecret(name: string, value: string): Promise<void>;
|
|
453
555
|
deleteSecret(name: string): Promise<void>;
|
|
454
556
|
}
|
|
455
557
|
declare class SecretManager {
|
|
@@ -458,20 +560,36 @@ declare class SecretManager {
|
|
|
458
560
|
set(name: string, value: string): Promise<SecretSetResult>;
|
|
459
561
|
/**
|
|
460
562
|
* Extract a secret value by name.
|
|
461
|
-
*
|
|
462
|
-
*
|
|
563
|
+
* Requires a UCAN capability grant — pass the proof token(s) as `ucans`.
|
|
564
|
+
* Extracting another DID's secret needs a grant on that DID's `/s/<name>`.
|
|
463
565
|
*/
|
|
464
|
-
extract(name: string): Promise<SecretExtractResult>;
|
|
566
|
+
extract(name: string, ucans?: string[]): Promise<SecretExtractResult>;
|
|
465
567
|
list(): Promise<string[]>;
|
|
466
|
-
put(name: string, value: string): Promise<void>;
|
|
467
568
|
delete(name: string): Promise<void>;
|
|
468
569
|
}
|
|
469
570
|
|
|
571
|
+
/**
|
|
572
|
+
* Resolve a non-DID venue id into the ordered list of base URLs that
|
|
573
|
+
* {@link Venue.connect} will try in turn. Explicit `http(s)://` inputs are
|
|
574
|
+
* honoured as given (trailing slash trimmed, single candidate, no fallback);
|
|
575
|
+
* schemeless inputs (bare host / IP / host:port) pick a scheme by host — local
|
|
576
|
+
* hosts (loopback, private ranges, mDNS) try http then https, public hosts stay
|
|
577
|
+
* https-only. `did:*` ids are resolved separately and are not handled here.
|
|
578
|
+
*/
|
|
579
|
+
declare function venueBaseUrlCandidates(venueId: string): string[];
|
|
470
580
|
declare class Venue implements VenueInterface {
|
|
471
581
|
baseUrl: string;
|
|
472
582
|
venueId: string;
|
|
473
583
|
auth: Auth;
|
|
474
584
|
metadata: VenueData;
|
|
585
|
+
/**
|
|
586
|
+
* The most recent status this instance has seen — seeded by {@link connect}
|
|
587
|
+
* (which fetches `/api/v1/status` anyway) and refreshed by every
|
|
588
|
+
* {@link status} call. Undefined until one of those has happened, e.g. on a
|
|
589
|
+
* directly constructed venue. Managers use it as a capability hint (venue
|
|
590
|
+
* `version`); it is a cache, not a liveness check.
|
|
591
|
+
*/
|
|
592
|
+
lastKnownStatus?: StatusData;
|
|
475
593
|
private _agents?;
|
|
476
594
|
private _jobs?;
|
|
477
595
|
private _assets?;
|
|
@@ -488,10 +606,25 @@ declare class Venue implements VenueInterface {
|
|
|
488
606
|
get secrets(): SecretManager;
|
|
489
607
|
constructor(options?: VenueOptions);
|
|
490
608
|
/**
|
|
491
|
-
*
|
|
492
|
-
*
|
|
493
|
-
*
|
|
494
|
-
*
|
|
609
|
+
* Connect to a venue, validating it with `GET {base}/api/v1/status`. If the
|
|
610
|
+
* venue is auth-gated (status answers 401/403 — public access disabled), the
|
|
611
|
+
* venue is validated against its public did:web document at
|
|
612
|
+
* `/.well-known/did.json` instead, whose `id` becomes `venueId` — identity is
|
|
613
|
+
* publicly resolvable by spec even when the API is not.
|
|
614
|
+
*
|
|
615
|
+
* The input is permissive: a full `http(s)://` URL, a bare host / IP /
|
|
616
|
+
* host:port, a `did:web:` id, or an existing Venue instance. Schemeless inputs
|
|
617
|
+
* pick a scheme by host and may fall back across http/https (see
|
|
618
|
+
* {@link venueBaseUrlCandidates}); did:web ids resolve to their `Covia.API.v1`
|
|
619
|
+
* endpoint.
|
|
620
|
+
*
|
|
621
|
+
* @param venueId - A venue URL, DNS name / host:port, `did:web:` id, or existing Venue
|
|
622
|
+
* @param auth - Optional credentials for venue authentication
|
|
623
|
+
* @returns {Promise<Venue>} A connected venue. The actually resolved/validated
|
|
624
|
+
* target is on the returned object: `venue.baseUrl` is the origin that
|
|
625
|
+
* responded (the https candidate if an http fallback failed; the resolved
|
|
626
|
+
* endpoint for a did:web id), and `venue.venueId` is the DID the venue
|
|
627
|
+
* reported. The validated API root is `${venue.baseUrl}/api/v1`.
|
|
495
628
|
*/
|
|
496
629
|
static connect(venueId: string | Venue, auth?: Auth): Promise<Venue>;
|
|
497
630
|
/**
|
|
@@ -529,12 +662,6 @@ declare class Venue implements VenueInterface {
|
|
|
529
662
|
* @returns {Promise<string[]>}
|
|
530
663
|
*/
|
|
531
664
|
listSecrets(): Promise<string[]>;
|
|
532
|
-
/**
|
|
533
|
-
* Store a secret value
|
|
534
|
-
* @param name - Secret name
|
|
535
|
-
* @param value - Secret value
|
|
536
|
-
*/
|
|
537
|
-
putSecret(name: string, value: string): Promise<void>;
|
|
538
665
|
/**
|
|
539
666
|
* Delete a secret
|
|
540
667
|
* @param name - Secret name
|
|
@@ -545,6 +672,23 @@ declare class Venue implements VenueInterface {
|
|
|
545
672
|
* @returns {Promise<StatusData>}
|
|
546
673
|
*/
|
|
547
674
|
status(): Promise<StatusData>;
|
|
675
|
+
/**
|
|
676
|
+
* Block until the venue is ready to serve operations.
|
|
677
|
+
*
|
|
678
|
+
* Polls {@link status} until it responds and reports either no explicit
|
|
679
|
+
* `status` or `"OK"`. Connection/HTTP errors are treated as "not ready yet"
|
|
680
|
+
* and retried until `timeoutMs` elapses — useful right after starting a venue,
|
|
681
|
+
* since a cold venue may answer its root before its invoke layer is up.
|
|
682
|
+
*
|
|
683
|
+
* @param options.timeoutMs - Max time to wait (default 60000).
|
|
684
|
+
* @param options.pollIntervalMs - Delay between polls (default 1000).
|
|
685
|
+
* @returns The ready {@link StatusData}.
|
|
686
|
+
* @throws {CoviaTimeoutError} If the venue is not ready within the timeout.
|
|
687
|
+
*/
|
|
688
|
+
waitUntilReady(options?: {
|
|
689
|
+
timeoutMs?: number;
|
|
690
|
+
pollIntervalMs?: number;
|
|
691
|
+
}): Promise<StatusData>;
|
|
548
692
|
/**
|
|
549
693
|
* Get the full DID document for this venue
|
|
550
694
|
* @returns {Promise<DIDDocument>}
|
|
@@ -578,6 +722,8 @@ interface VenueOptions {
|
|
|
578
722
|
name?: string;
|
|
579
723
|
description?: string;
|
|
580
724
|
auth?: Auth;
|
|
725
|
+
/** Status observed while connecting — seeds {@link Venue.lastKnownStatus}. */
|
|
726
|
+
status?: StatusData;
|
|
581
727
|
}
|
|
582
728
|
interface VenueConstructor {
|
|
583
729
|
new (): VenueInterface;
|
|
@@ -586,6 +732,14 @@ interface VenueConstructor {
|
|
|
586
732
|
interface InvokeOptions {
|
|
587
733
|
ucans?: string[];
|
|
588
734
|
}
|
|
735
|
+
/**
|
|
736
|
+
* The venue's operation-execution surface, as the typed managers consume it.
|
|
737
|
+
* `run<T>` returns the operation's result typed as `T` (defaults to `unknown`,
|
|
738
|
+
* so an un-parameterised call stays type-safe rather than leaking `any`).
|
|
739
|
+
*/
|
|
740
|
+
interface OperationRunner {
|
|
741
|
+
run<T = unknown>(assetId: string, input?: unknown, options?: InvokeOptions): Promise<T>;
|
|
742
|
+
}
|
|
589
743
|
interface VenueInterface {
|
|
590
744
|
baseUrl: string;
|
|
591
745
|
venueId: string;
|
|
@@ -600,7 +754,6 @@ interface VenueInterface {
|
|
|
600
754
|
mcpDiscovery(): Promise<MCPDiscovery>;
|
|
601
755
|
agentCard(): Promise<AgentCard>;
|
|
602
756
|
listSecrets(): Promise<string[]>;
|
|
603
|
-
putSecret(name: string, value: string): Promise<void>;
|
|
604
757
|
deleteSecret(name: string): Promise<void>;
|
|
605
758
|
agent(agentId: string): Agent;
|
|
606
759
|
close(): void;
|
|
@@ -642,16 +795,17 @@ interface ContentHashResult {
|
|
|
642
795
|
hash: string;
|
|
643
796
|
}
|
|
644
797
|
interface JobMetadata {
|
|
798
|
+
id?: string;
|
|
645
799
|
name?: string;
|
|
646
800
|
status?: RunStatus;
|
|
647
801
|
created?: string;
|
|
648
802
|
updated?: string;
|
|
649
|
-
input?:
|
|
650
|
-
output?:
|
|
803
|
+
input?: unknown;
|
|
804
|
+
output?: unknown;
|
|
651
805
|
operation?: string;
|
|
652
806
|
caller?: string;
|
|
653
807
|
error?: string;
|
|
654
|
-
[key: string]:
|
|
808
|
+
[key: string]: unknown;
|
|
655
809
|
}
|
|
656
810
|
interface InvokePayload {
|
|
657
811
|
assetId: AssetID;
|
|
@@ -678,6 +832,8 @@ interface StatusData {
|
|
|
678
832
|
status?: string;
|
|
679
833
|
did?: string;
|
|
680
834
|
name?: string;
|
|
835
|
+
/** Venue platform version (e.g. "0.3.0"). Absent on venues before 0.3. */
|
|
836
|
+
version?: string;
|
|
681
837
|
stats?: StatsData;
|
|
682
838
|
}
|
|
683
839
|
interface StatsData {
|
|
@@ -704,13 +860,23 @@ interface MCPDiscovery {
|
|
|
704
860
|
endpoint?: Record<string, any> | string;
|
|
705
861
|
[key: string]: any;
|
|
706
862
|
}
|
|
863
|
+
/**
|
|
864
|
+
* A2A agent card from `GET /.well-known/agent-card.json`.
|
|
865
|
+
* Field names mirror the A2A v1.0 wire format the venue serves (via the
|
|
866
|
+
* official A2A Java SDK). The index signature preserves any spec fields a
|
|
867
|
+
* given venue build adds (e.g. `securitySchemes`, `protocolVersion`).
|
|
868
|
+
*/
|
|
707
869
|
interface AgentCard {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
870
|
+
name: string;
|
|
871
|
+
description?: string;
|
|
872
|
+
version?: string;
|
|
873
|
+
provider?: Record<string, any>;
|
|
874
|
+
capabilities?: Record<string, any>;
|
|
875
|
+
defaultInputModes?: string[];
|
|
876
|
+
defaultOutputModes?: string[];
|
|
877
|
+
skills?: Record<string, any>[];
|
|
878
|
+
supportedInterfaces?: Record<string, any>[];
|
|
879
|
+
preferredTransport?: string;
|
|
714
880
|
[key: string]: any;
|
|
715
881
|
}
|
|
716
882
|
interface DIDDocument {
|
|
@@ -733,7 +899,7 @@ interface SSEEvent {
|
|
|
733
899
|
id: string | null;
|
|
734
900
|
retry: number | null;
|
|
735
901
|
/** Parse the event data as JSON. */
|
|
736
|
-
json: () =>
|
|
902
|
+
json: () => unknown;
|
|
737
903
|
}
|
|
738
904
|
declare enum AgentStatus {
|
|
739
905
|
SLEEPING = "SLEEPING",
|
|
@@ -789,17 +955,6 @@ interface AgentTriggerResult {
|
|
|
789
955
|
result?: any;
|
|
790
956
|
taskResults?: any[];
|
|
791
957
|
}
|
|
792
|
-
interface AgentQueryInput {
|
|
793
|
-
agentId: string;
|
|
794
|
-
}
|
|
795
|
-
interface AgentQueryResult {
|
|
796
|
-
agentId: string;
|
|
797
|
-
status: string;
|
|
798
|
-
state?: Record<string, any>;
|
|
799
|
-
config?: Record<string, any>;
|
|
800
|
-
tasks?: any[];
|
|
801
|
-
[key: string]: any;
|
|
802
|
-
}
|
|
803
958
|
interface AgentListInput {
|
|
804
959
|
includeTerminated?: boolean;
|
|
805
960
|
}
|
|
@@ -877,7 +1032,10 @@ interface AssetPinResult {
|
|
|
877
1032
|
hash: string;
|
|
878
1033
|
}
|
|
879
1034
|
interface WorkspaceCopyResult {
|
|
880
|
-
|
|
1035
|
+
/** 0.3.0 (#147): `false` = copy created a new value at the destination, `true` = it replaced an existing one. */
|
|
1036
|
+
existed?: boolean;
|
|
1037
|
+
/** 0.3.0: present and true only if a new parent path was built at the destination. */
|
|
1038
|
+
pathCreated?: boolean;
|
|
881
1039
|
}
|
|
882
1040
|
interface WorkspaceInspectInput {
|
|
883
1041
|
paths: string | string[];
|
|
@@ -885,7 +1043,8 @@ interface WorkspaceInspectInput {
|
|
|
885
1043
|
compact?: boolean;
|
|
886
1044
|
}
|
|
887
1045
|
interface WorkspaceInspectResult {
|
|
888
|
-
|
|
1046
|
+
/** Rendered string for a single path, or a `{path: string}` map for multiple. */
|
|
1047
|
+
result: string | Record<string, string>;
|
|
889
1048
|
}
|
|
890
1049
|
interface WorkspaceReadInput {
|
|
891
1050
|
path: string;
|
|
@@ -895,39 +1054,58 @@ interface WorkspaceReadResult {
|
|
|
895
1054
|
exists: boolean;
|
|
896
1055
|
value?: any;
|
|
897
1056
|
truncated?: boolean;
|
|
898
|
-
|
|
1057
|
+
/** Convex type name; included on a truncated read (0.3.0) so the caller can
|
|
1058
|
+
* fall back to `list` (map) or `slice` (sequence) instead of guessing. */
|
|
1059
|
+
type?: string;
|
|
1060
|
+
/** 0.3.0: encoded size in bytes (always present). */
|
|
1061
|
+
valueBytes?: number;
|
|
899
1062
|
}
|
|
900
1063
|
interface WorkspaceWriteInput {
|
|
901
1064
|
path: string;
|
|
902
1065
|
value: any;
|
|
903
1066
|
}
|
|
904
1067
|
interface WorkspaceWriteResult {
|
|
905
|
-
|
|
1068
|
+
/** 0.3.0 (#147): `false` = a new value was created, `true` = an existing one was replaced (a stored null counts as present). */
|
|
1069
|
+
existed?: boolean;
|
|
1070
|
+
/** 0.3.0: true iff the write built a new parent path; omitted otherwise. */
|
|
1071
|
+
pathCreated?: boolean;
|
|
906
1072
|
}
|
|
907
1073
|
interface WorkspaceDeleteInput {
|
|
908
1074
|
path: string;
|
|
909
1075
|
}
|
|
910
1076
|
interface WorkspaceDeleteResult {
|
|
911
|
-
|
|
1077
|
+
/** 0.3.0 (#147): `true` = a value was present and removed, `false` = idempotent no-op. (Pre-0.3.0 this was a constant `true`, then an empty object.) */
|
|
1078
|
+
deleted?: boolean;
|
|
912
1079
|
}
|
|
913
1080
|
interface WorkspaceAppendInput {
|
|
914
1081
|
path: string;
|
|
915
1082
|
value: any;
|
|
916
1083
|
}
|
|
917
1084
|
interface WorkspaceAppendResult {
|
|
918
|
-
|
|
1085
|
+
/** 0.3.0 (#147): `false` = a new collection was created, `true` = an existing one was extended. */
|
|
1086
|
+
existed?: boolean;
|
|
1087
|
+
/** 0.3.0 (#147): the position the appended element landed at (`newSize - 1`). */
|
|
1088
|
+
index?: number;
|
|
1089
|
+
/** 0.3.0: vector element count after the append. */
|
|
1090
|
+
newSize?: number;
|
|
1091
|
+
/** 0.3.0: true iff a new parent path was built. */
|
|
1092
|
+
pathCreated?: boolean;
|
|
919
1093
|
}
|
|
920
1094
|
interface WorkspaceListInput {
|
|
921
1095
|
path?: string;
|
|
922
1096
|
limit?: number;
|
|
923
1097
|
offset?: number;
|
|
924
1098
|
}
|
|
1099
|
+
/** Result of `covia:list` — the direct children of a node. A map lists its
|
|
1100
|
+
* `keys`; sets and vectors report only `type` + `count` (page their elements
|
|
1101
|
+
* with `slice`). */
|
|
925
1102
|
interface WorkspaceListResult {
|
|
926
1103
|
exists: boolean;
|
|
927
1104
|
type: string;
|
|
1105
|
+
/** total entries in the collection (the single cardinality word). */
|
|
928
1106
|
count?: number;
|
|
1107
|
+
/** populated for maps; omitted for sets/vectors/scalars. */
|
|
929
1108
|
keys?: string[];
|
|
930
|
-
values?: any[];
|
|
931
1109
|
offset?: number;
|
|
932
1110
|
}
|
|
933
1111
|
interface WorkspaceSliceInput {
|
|
@@ -937,10 +1115,32 @@ interface WorkspaceSliceInput {
|
|
|
937
1115
|
}
|
|
938
1116
|
interface WorkspaceSliceResult {
|
|
939
1117
|
exists: boolean;
|
|
940
|
-
type
|
|
941
|
-
values
|
|
942
|
-
|
|
943
|
-
|
|
1118
|
+
type?: string;
|
|
1119
|
+
values?: any[];
|
|
1120
|
+
/** total entries in the collection (the single cardinality word). */
|
|
1121
|
+
count?: number;
|
|
1122
|
+
offset?: number;
|
|
1123
|
+
}
|
|
1124
|
+
/** Job-free tally (#177). `exists` = a countable collection is present at the
|
|
1125
|
+
* path (absent path, or a scalar with nothing to descend into → `{exists:false}`,
|
|
1126
|
+
* no `count`; an empty or too-deep collection → `{exists:true, count:0}`). */
|
|
1127
|
+
interface WorkspaceCountResult {
|
|
1128
|
+
exists: boolean;
|
|
1129
|
+
count?: number;
|
|
1130
|
+
}
|
|
1131
|
+
/** One group's metrics in `WorkspaceAggregateResult.groups`. `count` today;
|
|
1132
|
+
* numeric reductions (`sum`/`min`/`max`) will add keys additively. */
|
|
1133
|
+
interface GroupCount {
|
|
1134
|
+
count?: number;
|
|
1135
|
+
[key: string]: number | undefined;
|
|
1136
|
+
}
|
|
1137
|
+
interface WorkspaceAggregateResult {
|
|
1138
|
+
exists: boolean;
|
|
1139
|
+
count?: number;
|
|
1140
|
+
/** Present when `groupBy` was supplied: each distinct field value → a
|
|
1141
|
+
* `GroupCount`. An entry lacking the field groups under the `"null"` key.
|
|
1142
|
+
* Σ(group counts) == count. */
|
|
1143
|
+
groups?: Record<string, GroupCount>;
|
|
944
1144
|
}
|
|
945
1145
|
interface UCANAttenuation {
|
|
946
1146
|
with: string;
|
|
@@ -952,7 +1152,10 @@ interface UCANIssueInput {
|
|
|
952
1152
|
exp: number;
|
|
953
1153
|
}
|
|
954
1154
|
interface UCANIssueResult {
|
|
955
|
-
|
|
1155
|
+
/** The issued delegation token — pass as an element of the `ucans` array on
|
|
1156
|
+
* subsequent invokes. */
|
|
1157
|
+
token: string;
|
|
1158
|
+
[key: string]: unknown;
|
|
956
1159
|
}
|
|
957
1160
|
interface SecretSetInput {
|
|
958
1161
|
name: string;
|
|
@@ -992,8 +1195,8 @@ declare class CoviaError extends Error {
|
|
|
992
1195
|
/** Raised when the Covia API returns an error response (4xx/5xx). */
|
|
993
1196
|
declare class GridError extends CoviaError {
|
|
994
1197
|
statusCode: number;
|
|
995
|
-
responseBody:
|
|
996
|
-
constructor(statusCode: number, message: string, responseBody?:
|
|
1198
|
+
responseBody: unknown;
|
|
1199
|
+
constructor(statusCode: number, message: string, responseBody?: unknown);
|
|
997
1200
|
}
|
|
998
1201
|
/** Raised when the SDK cannot connect to the venue. */
|
|
999
1202
|
declare class CoviaConnectionError extends CoviaError {
|
|
@@ -1062,7 +1265,8 @@ declare function isJobFinished(jobStatus: RunStatus): boolean;
|
|
|
1062
1265
|
*/
|
|
1063
1266
|
declare function getParsedAssetId(assetId: string): string;
|
|
1064
1267
|
/**
|
|
1065
|
-
* Utility function to return complete assetId from hex and path
|
|
1268
|
+
* Utility function to return complete assetId from hex and an API path of the
|
|
1269
|
+
* form `/api/v1/assets/<encoded-did>/...`.
|
|
1066
1270
|
* @param assetHex - The asset hex
|
|
1067
1271
|
* @param assetPath - The asset path
|
|
1068
1272
|
* @returns {string} - Returns the complete assetId
|
|
@@ -1084,6 +1288,65 @@ declare function createSSEEvent(fields: {
|
|
|
1084
1288
|
*/
|
|
1085
1289
|
declare function parseSSEStream(response: Response): AsyncGenerator<SSEEvent>;
|
|
1086
1290
|
|
|
1291
|
+
/**
|
|
1292
|
+
* DID and lattice-path helpers for the Covia grid.
|
|
1293
|
+
*
|
|
1294
|
+
* Covia addresses its lattice as `<DID>/<namespace>/<path...>`. These helpers
|
|
1295
|
+
* build and parse those addresses so callers don't hand-concatenate strings.
|
|
1296
|
+
*
|
|
1297
|
+
* Which DID belongs in a lattice address:
|
|
1298
|
+
* - `w`/`o`/`g`/`j`/`s` are per-user: the `<DID>` is the resource *owner's* DID
|
|
1299
|
+
* (yours is your auth DID, e.g. `Ed25519Auth.getDID()`) — NOT the venue's.
|
|
1300
|
+
* - `a` (assets) is venue-global and content-addressed.
|
|
1301
|
+
* - A namespace-relative path (no `<DID>`) resolves to the authenticated caller.
|
|
1302
|
+
*/
|
|
1303
|
+
/** Lattice namespace identifiers. */
|
|
1304
|
+
declare const Namespace: {
|
|
1305
|
+
readonly ASSET: "a";
|
|
1306
|
+
readonly OPERATION: "o";
|
|
1307
|
+
readonly JOB: "j";
|
|
1308
|
+
readonly AGENT: "g";
|
|
1309
|
+
readonly WORKSPACE: "w";
|
|
1310
|
+
readonly SECRET: "s";
|
|
1311
|
+
readonly AGENT_SCRATCH: "n";
|
|
1312
|
+
readonly SESSION_SCRATCH: "c";
|
|
1313
|
+
readonly JOB_SCRATCH: "t";
|
|
1314
|
+
readonly VENUE: "v";
|
|
1315
|
+
};
|
|
1316
|
+
/** A parsed lattice address. */
|
|
1317
|
+
interface DIDURL {
|
|
1318
|
+
did: string | null;
|
|
1319
|
+
namespace: string | null;
|
|
1320
|
+
path: string;
|
|
1321
|
+
}
|
|
1322
|
+
/** True if `value` is a bare DID (`did:<method>:<id>`), not a DID URL with a path. */
|
|
1323
|
+
declare function isDid(value: string): boolean;
|
|
1324
|
+
/** The DID method (e.g. `'key'`, `'web'`), or null if `value` is not a DID. */
|
|
1325
|
+
declare function didMethod(value: string): string | null;
|
|
1326
|
+
/**
|
|
1327
|
+
* Split a lattice address into its DID, namespace, and path. Handles bare DIDs,
|
|
1328
|
+
* namespace-relative paths (`w/foo` or `/w/foo`), and fully-qualified DID URLs
|
|
1329
|
+
* (`did:key:z.../w/foo`); did:web `:` path separators inside the DID are kept.
|
|
1330
|
+
*/
|
|
1331
|
+
declare function parseDidUrl(value: string): DIDURL;
|
|
1332
|
+
/**
|
|
1333
|
+
* Build a lattice address `<did>/<namespace>/<segments...>`. Pass `did = null`
|
|
1334
|
+
* for a namespace-relative path. Stray surrounding slashes on segments are
|
|
1335
|
+
* stripped and empty segments dropped.
|
|
1336
|
+
*
|
|
1337
|
+
* Remember the ownership rules above: for `w`/`o`/`g`/`j`/`s` the `did` is the
|
|
1338
|
+
* resource owner's DID, not the venue's.
|
|
1339
|
+
*/
|
|
1340
|
+
declare function didUrl(did: string | null, namespace: string, ...segments: string[]): string;
|
|
1341
|
+
/**
|
|
1342
|
+
* The content hash `ref` pins to, or null if it isn't content-addressed.
|
|
1343
|
+
* Recognises a bare hex hash, `a/<hash>`, and `<DID>/a/<hash>` — the forms that
|
|
1344
|
+
* name a specific immutable asset. Mutable lattice paths (`w/…`, `o/…`) return
|
|
1345
|
+
* null: they resolve server-side, so there's no client-side hash and they must
|
|
1346
|
+
* not be treated as immutable (e.g. cached).
|
|
1347
|
+
*/
|
|
1348
|
+
declare function assetHash(ref: string): string | null;
|
|
1349
|
+
|
|
1087
1350
|
/**
|
|
1088
1351
|
* Simple logger for the Covia SDK.
|
|
1089
1352
|
*
|
|
@@ -1106,7 +1369,7 @@ declare class Grid {
|
|
|
1106
1369
|
/**
|
|
1107
1370
|
* Static method to connect to a venue
|
|
1108
1371
|
* @param venueId - Can be a HTTP base URL, DNS name, or existing Venue instance
|
|
1109
|
-
* @param auth - Optional authentication provider (BearerAuth,
|
|
1372
|
+
* @param auth - Optional authentication provider (BearerAuth, BasicAuth, Ed25519Auth, etc.)
|
|
1110
1373
|
* @returns {Promise<Venue>} A new Venue instance configured appropriately
|
|
1111
1374
|
*/
|
|
1112
1375
|
static connect(venueId: string, auth?: Auth): Promise<Venue>;
|
|
@@ -1163,4 +1426,4 @@ declare function decodePublicKey(multikey: string): Uint8Array;
|
|
|
1163
1426
|
*/
|
|
1164
1427
|
declare function didFromPublicKey(publicKey: Uint8Array): string;
|
|
1165
1428
|
|
|
1166
|
-
export { type AdapterInfo, type AdaptersResult, Agent, type AgentCancelTaskInput, type AgentCard, type AgentChatInput, type AgentChatResult, type AgentCompleteTaskResult, type AgentContextInput, type AgentCreateInput, type AgentCreateResult, type AgentDeleteInput, type AgentDeleteResult, type AgentFailTaskResult, type AgentForkInput, type AgentForkResult, type AgentInfoResult, type AgentListInput, type AgentListResult, AgentManager, type AgentMessageInput, type AgentMessageResult, type
|
|
1429
|
+
export { type AdapterInfo, type AdaptersResult, Agent, type AgentCancelTaskInput, type AgentCard, type AgentChatInput, type AgentChatResult, type AgentCompleteTaskResult, type AgentContextInput, type AgentCreateInput, type AgentCreateResult, type AgentDeleteInput, type AgentDeleteResult, type AgentFailTaskResult, type AgentForkInput, type AgentForkResult, type AgentInfoResult, type AgentListInput, type AgentListResult, AgentManager, type AgentMessageInput, type AgentMessageResult, 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, type AssetPinResult, Auth, BasicAuth, BearerAuth, ChatSession, type ContentDetails, type ContentHashResult, CoviaConnectionError, CoviaError, CoviaTimeoutError, type Credentials, CredentialsHTTP, type DIDDocument, type DIDURL, DataAsset, Ed25519Auth, type FunctionInfo, type FunctionsResult, Grid, GridError, type GroupCount, type InvokeOptions, type InvokePayload, Job, JobFailedError, JobManager, type JobMetadata, JobNotFoundError, JobStatus, KeyPairAuth, type MCPDiscovery, Namespace, NoAuth, NotFoundError, Operation, type OperationDetails, type OperationInfo, OperationManager, type OperationPayload, type OperationRunner, 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 WorkspaceAggregateResult, type WorkspaceAppendInput, type WorkspaceAppendResult, type WorkspaceCopyResult, type WorkspaceCountResult, type WorkspaceDeleteInput, type WorkspaceDeleteResult, type WorkspaceInspectInput, type WorkspaceInspectResult, type WorkspaceListInput, type WorkspaceListResult, WorkspaceManager, type WorkspaceReadInput, type WorkspaceReadResult, type WorkspaceSliceInput, type WorkspaceSliceResult, type WorkspaceWriteInput, type WorkspaceWriteResult, assetHash, createSSEEvent, decodePublicKey, didFromPublicKey, didMethod, didUrl, encodePublicKey, fetchStreamWithError, fetchWithError, generateKeyPair, getAssetIdFromPath, getAssetIdFromVenueId, getParsedAssetId, hexToPrivateKey, isDid, isJobComplete, isJobFinished, isJobPaused, logger, parseDidUrl, parseSSEStream, privateKeyToHex, venueBaseUrlCandidates };
|