@covia/covia-sdk 1.6.0-next.0 → 1.7.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/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?: any, wait?: boolean | number): Promise<AgentRequestResult>;
7
- message(message: any): Promise<AgentMessageResult>;
8
- chat(message: any, sessionId?: string): Promise<AgentChatResult>;
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, any>;
20
- state?: Record<string, any>;
21
- }): Promise<any>;
22
- cancelTask(taskId: string): Promise<any>;
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, any>;
30
+ config?: Record<string, unknown>;
32
31
  includeTimeline?: boolean;
33
32
  overwrite?: boolean;
34
33
  }): Promise<Agent>;
35
- context(task?: any): Promise<string>;
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: any): Promise<AgentChatResult>;
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(): any;
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<any>;
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: any): Promise<any>;
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
- * @returns {Promise<any>}
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: any): Promise<any>;
175
+ run<T = unknown>(input?: unknown, options?: InvokeOptions): Promise<T>;
176
176
  /**
177
- * Execute the operation
178
- * @param input - Operation input parameters
179
- * @returns {Promise<Job>}
180
- */
181
- invoke(input: any): Promise<Job>;
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
- /** Apply authentication credentials to request headers (mutates in place). */
199
- abstract apply(headers: Record<string, string>): void;
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>): void;
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>): void;
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 = KeyPairAuth.generate();
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 KeyPairAuth extends Auth {
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>): void;
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 a KeyPairAuth instance. */
244
- static generate(tokenLifetimeSeconds?: number): KeyPairAuth;
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): KeyPairAuth;
274
+ static fromHex(privateKeyHex: string, tokenLifetimeSeconds?: number): Ed25519Auth;
247
275
  }
248
- /** @deprecated Use Auth subclasses instead (NoAuth, BearerAuth, KeyPairAuth). */
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, KeyPairAuth). */
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;
@@ -259,17 +296,60 @@ declare class CredentialsHTTP implements Credentials {
259
296
  constructor(venueId: string, apiKey: string, userId: string);
260
297
  }
261
298
 
299
+ interface AdapterManagerVenue {
300
+ workspace: {
301
+ slice(path: string, offset?: number, limit?: number, ucans?: string[]): Promise<WorkspaceSliceResult>;
302
+ read(path: string, maxSize?: number, ucans?: string[]): Promise<WorkspaceReadResult>;
303
+ };
304
+ }
305
+ /**
306
+ * Adapter introspection for a venue.
307
+ *
308
+ * Reads go through the workspace manager, so they are job-free (`GET
309
+ * /api/v1/values/*`, covia #177) on 0.3+ venues and transparently fall back
310
+ * to the invoke path on older ones — the same job-free/fallback behaviour
311
+ * every other workspace-backed read gets, rather than a hand-rolled fetch.
312
+ */
313
+ declare class AdapterManager {
314
+ private venue;
315
+ constructor(venue: AdapterManagerVenue);
316
+ /**
317
+ * List the adapters registered on the venue, with their descriptions and
318
+ * invocable operation catalog paths. Registered-but-inactive or zero-op
319
+ * adapters are included — this is the true registry, not an inference
320
+ * from the operations catalog.
321
+ */
322
+ list(): Promise<AdapterInfo[]>;
323
+ /**
324
+ * Get a single adapter's summary by name.
325
+ * @param name - Adapter name, e.g. "mcp"
326
+ * @returns {Promise<AdapterInfo | null>} `null` if no adapter with that name is registered
327
+ */
328
+ get(name: string): Promise<AdapterInfo | null>;
329
+ }
330
+
262
331
  interface AgentManagerVenue {
263
- operations: {
264
- run(assetId: string, input: any): Promise<any>;
332
+ baseUrl: string;
333
+ venueId: string;
334
+ auth: {
335
+ apply(headers: Record<string, string>, audience?: string): void;
265
336
  };
337
+ operations: OperationRunner;
338
+ lastKnownStatus?: StatusData;
266
339
  }
267
340
  declare class AgentManager {
268
341
  private venue;
342
+ private agentsGetSupported;
269
343
  constructor(venue: AgentManagerVenue);
344
+ private _headers;
345
+ /** Whether the venue serves `GET /api/v1/agents`: no if a probe already
346
+ * 404'd, or if the venue's last known status identifies it as pre-0.4. */
347
+ private supportsAgentsGet;
348
+ /** A job-free agents GET, falling back to the invoke path on pre-0.4 venues. */
349
+ private _agentsOr;
270
350
  create(input: AgentCreateInput): Promise<AgentCreateResult>;
271
- request(agentId: string, input?: any, wait?: boolean | number): Promise<AgentRequestResult>;
272
- message(agentId: string, message: any): Promise<AgentMessageResult>;
351
+ request(agentId: string, input?: unknown, wait?: boolean | number): Promise<AgentRequestResult>;
352
+ message(agentId: string, message: unknown): Promise<AgentMessageResult>;
273
353
  /**
274
354
  * Send a message to an agent and synchronously await its next response on the session.
275
355
  *
@@ -286,26 +366,33 @@ declare class AgentManager {
286
366
  * Blocking: always blocks until the agent produces its next response on the session.
287
367
  * No polling required.
288
368
  */
289
- chat(agentId: string, message: any, sessionId?: string): Promise<AgentChatResult>;
369
+ chat(agentId: string, message: unknown, sessionId?: string): Promise<AgentChatResult>;
290
370
  trigger(agentId: string): Promise<AgentTriggerResult>;
291
- query(agentId: string): Promise<AgentQueryResult>;
371
+ /**
372
+ * List the caller's agents. **Job-free** on covia ≥ 0.4: goes through
373
+ * `GET /api/v1/agents` (covia#180) — synchronous, no Job persisted. Older
374
+ * venues transparently fall back to the invoke path (one probe, remembered).
375
+ */
292
376
  list(includeTerminated?: boolean): Promise<AgentListResult>;
293
377
  delete(agentId: string, remove?: boolean): Promise<AgentDeleteResult>;
294
378
  suspend(agentId: string): Promise<AgentSuspendResult>;
295
379
  resume(agentId: string, autoWake?: boolean): Promise<AgentSuspendResult>;
296
- update(input: AgentUpdateInput): Promise<any>;
297
- cancelTask(agentId: string, taskId: string): Promise<any>;
380
+ update(input: AgentUpdateInput): Promise<unknown>;
381
+ cancelTask(agentId: string, taskId: string): Promise<unknown>;
382
+ /** Agent info. **Job-free** on covia ≥ 0.4 (`GET /api/v1/agents/{id}`,
383
+ * covia#180); older venues fall back to the invoke path. */
298
384
  info(agentId: string): Promise<AgentInfoResult>;
299
385
  fork(input: AgentForkInput): Promise<AgentForkResult>;
300
- context(agentId: string, task?: any): Promise<string>;
301
- completeTask(result?: any): Promise<AgentCompleteTaskResult>;
386
+ context(agentId: string, task?: unknown): Promise<string>;
387
+ completeTask(result?: unknown): Promise<AgentCompleteTaskResult>;
302
388
  failTask(error: string): Promise<AgentFailTaskResult>;
303
389
  }
304
390
 
305
391
  interface JobManagerVenue {
306
392
  baseUrl: string;
393
+ venueId: string;
307
394
  auth: {
308
- apply(headers: Record<string, string>): void;
395
+ apply(headers: Record<string, string>, audience?: string): void;
309
396
  };
310
397
  }
311
398
  declare class JobManager {
@@ -317,26 +404,30 @@ declare class JobManager {
317
404
  delete(jobId: string): Promise<void>;
318
405
  pause(jobId: string): Promise<JobMetadata>;
319
406
  resume(jobId: string): Promise<JobMetadata>;
320
- sendMessage(jobId: string, message: any): Promise<any>;
407
+ sendMessage(jobId: string, message: unknown): Promise<unknown>;
321
408
  stream(jobId: string): AsyncGenerator<SSEEvent>;
322
409
  private _buildHeaders;
323
410
  }
324
411
 
325
412
  interface AssetManagerVenue {
326
413
  baseUrl: string;
414
+ venueId: string;
327
415
  auth: {
328
- apply(headers: Record<string, string>): void;
329
- };
330
- operations: {
331
- run(assetId: string, input: any): Promise<any>;
416
+ apply(headers: Record<string, string>, audience?: string): void;
332
417
  };
418
+ operations: OperationRunner;
333
419
  }
334
420
  declare class AssetManager {
335
421
  private venue;
336
422
  constructor(venue: AssetManagerVenue);
337
423
  /**
338
- * Get asset by ID
339
- * @param assetId - Asset identifier
424
+ * Get an asset by lattice address.
425
+ *
426
+ * `assetId` may be a content hash (`<hash>`, `a/<hash>`, `<DID>/a/<hash>`) or
427
+ * a mutable lattice path the venue resolves (`w/my-assets/foo`, `o/my-op`,
428
+ * `<DID>/w/...`). Only content-addressed (immutable) refs are cached;
429
+ * mutable paths are always re-fetched, so a changed value is never served stale.
430
+ * @param assetId - Asset identifier or lattice address
340
431
  * @returns Returns either an Operation or DataAsset based on the asset's metadata
341
432
  */
342
433
  get(assetId: AssetID): Promise<Asset>;
@@ -349,7 +440,7 @@ declare class AssetManager {
349
440
  * Register a new asset
350
441
  * @param assetData - Asset configuration
351
442
  */
352
- register(assetData: any): Promise<Asset>;
443
+ register(assetData: unknown): Promise<Asset>;
353
444
  /**
354
445
  * Get asset metadata
355
446
  * @param assetId - Asset identifier
@@ -382,9 +473,11 @@ declare class AssetManager {
382
473
 
383
474
  interface OperationManagerVenue {
384
475
  baseUrl: string;
476
+ venueId: string;
385
477
  auth: {
386
- apply(headers: Record<string, string>): void;
478
+ apply(headers: Record<string, string>, audience?: string): void;
387
479
  };
480
+ privateJobs?: boolean;
388
481
  }
389
482
  declare class OperationManager {
390
483
  private venue;
@@ -404,52 +497,135 @@ declare class OperationManager {
404
497
  * @param input - Operation input parameters
405
498
  * @param options - Invoke options (e.g., ucans)
406
499
  */
407
- run(assetId: string, input: any, options?: InvokeOptions): Promise<any>;
500
+ run<T = unknown>(assetId: string, input?: unknown, options?: InvokeOptions): Promise<T>;
501
+ /**
502
+ * Private-mode execution (covia #192): a memory-only job whose result is
503
+ * collected through the invoke `wait` window — a completed private job is
504
+ * immediately forgotten by the venue, so polling cannot be used. If the
505
+ * operation outlives the venue's wait cap, polling continues while the job
506
+ * runs; a job that completes between polls is unobservable and surfaces as
507
+ * a clear error rather than a confusing 404.
508
+ */
509
+ private _runPrivate;
408
510
  /**
409
511
  * Execute an operation and return a Job for tracking
410
512
  * @param assetId - Operation asset ID or named operation
411
513
  * @param input - Operation input parameters
412
514
  * @param options - Invoke options (e.g., ucans)
413
515
  */
414
- invoke(assetId: string, input: any, options?: InvokeOptions): Promise<Job>;
516
+ invoke(assetId: string, input?: unknown, options?: InvokeOptions): Promise<Job>;
415
517
  private _buildHeaders;
416
518
  }
417
519
 
418
520
  interface WorkspaceManagerVenue {
419
- operations: {
420
- run(assetId: string, input: any): Promise<any>;
521
+ baseUrl: string;
522
+ venueId: string;
523
+ auth: {
524
+ apply(headers: Record<string, string>, audience?: string): void;
421
525
  };
526
+ operations: OperationRunner;
527
+ lastKnownStatus?: StatusData;
422
528
  }
529
+ /**
530
+ * Workspace (lattice) operations against a venue.
531
+ *
532
+ * **Reads are job-free.** `read`/`list`/`slice`/`inspect`/`count`/`aggregate` go
533
+ * through `GET /api/v1/values/*` (covia #177) — synchronous, capability-checked,
534
+ * and **no Job is persisted**. This matters at scale: routing reads through the
535
+ * invoke/job path writes one durable job record per read, which grows the venue's
536
+ * etch without bound under a read-heavy consumer.
537
+ *
538
+ * **Writes stay on the job path** (`write`/`delete`/`append`/`copy` via
539
+ * `operations.run`) — a mutation *should* leave an audit record.
540
+ *
541
+ * Paths resolve against the caller's own DID unless fully qualified
542
+ * (`<DID>/w/...`). Reading another DID's namespace is capability-gated: the
543
+ * job-free GET path carries only the caller's identity token, so a read that
544
+ * needs UCAN **proof tokens** (`ucans`) transparently falls back to the invoke
545
+ * path (the only transport that carries a proof array). Own-namespace reads —
546
+ * the common case — never need this and stay fully job-free.
547
+ *
548
+ * Venues that predate the `/values` routes (< covia 0.3) are accommodated
549
+ * here, not in application code: a 404 from the GET surface can only mean the
550
+ * route is missing (an absent path is `200 {exists:false}`), so reads fall
551
+ * back to the invoke path and the venue is remembered as pre-0.3 for the rest
552
+ * of this manager's lifetime.
553
+ */
423
554
  declare class WorkspaceManager {
424
555
  private venue;
556
+ private valuesSupported;
425
557
  constructor(venue: WorkspaceManagerVenue);
426
- read(path: string, maxSize?: number): Promise<WorkspaceReadResult>;
427
- write(path: string, value: any): Promise<WorkspaceWriteResult>;
428
- delete(path: string): Promise<WorkspaceDeleteResult>;
429
- append(path: string, value: any): Promise<WorkspaceAppendResult>;
430
- list(path?: string, limit?: number, offset?: number): Promise<WorkspaceListResult>;
431
- slice(path: string, offset?: number, limit?: number): Promise<WorkspaceSliceResult>;
432
- copy(from: string, to: string): Promise<WorkspaceCopyResult>;
433
- inspect(paths: string | string[], budget?: number, compact?: boolean): Promise<WorkspaceInspectResult>;
558
+ private _headers;
559
+ /** GET a job-free `/api/v1/values/{op}` read; omit undefined params. */
560
+ private _values;
561
+ /**
562
+ * Whether the venue serves `GET /api/v1/values/*`: no if a probe already
563
+ * 404'd, or if the venue's last known status identifies it as pre-0.3
564
+ * (venues that old don't report a `version` at all). Checked per read —
565
+ * connect/`status()` may populate the status after this manager exists.
566
+ */
567
+ private supportsValues;
568
+ /** A job-free values read, falling back to the invoke path on pre-0.3 venues. */
569
+ private _valuesOr;
570
+ read(path: string, maxSize?: number, ucans?: string[]): Promise<WorkspaceReadResult>;
571
+ list(path?: string, limit?: number, offset?: number, ucans?: string[]): Promise<WorkspaceListResult>;
572
+ slice(path: string, offset?: number, limit?: number, ucans?: string[]): Promise<WorkspaceSliceResult>;
573
+ inspect(paths: string | string[], budget?: number, compact?: boolean, ucans?: string[]): Promise<WorkspaceInspectResult>;
574
+ /**
575
+ * Count entries at a depth below `path` — a job-free server-side tally, so the
576
+ * caller never reads every record to learn "how many".
577
+ *
578
+ * `depth` = the exact number of `get`-steps below `path` to visit (default 1 =
579
+ * direct children). Records nested at `w/x/<bucket>/<record>` are counted with
580
+ * `depth: 2`. Absent path or a scalar → `{exists:false}`.
581
+ */
582
+ count(path: string, opts?: {
583
+ depth?: number;
584
+ ucans?: string[];
585
+ }): Promise<WorkspaceCountResult>;
586
+ /**
587
+ * Count entries at a depth below `path`, optionally partitioned by a field —
588
+ * the job-free, authoritative alternative to counting client-side.
589
+ *
590
+ * `groupBy` names the field whose value forms each group key (may be a relative
591
+ * path, `foo/bar`); an entry missing it groups under `"null"`. Σ(group counts)
592
+ * equals the top-level `count`.
593
+ */
594
+ aggregate(path: string, opts?: {
595
+ depth?: number;
596
+ groupBy?: string;
597
+ ucans?: string[];
598
+ }): Promise<WorkspaceAggregateResult>;
599
+ write(path: string, value: unknown, ucans?: string[]): Promise<WorkspaceWriteResult>;
600
+ delete(path: string, ucans?: string[]): Promise<WorkspaceDeleteResult>;
601
+ append(path: string, value: unknown, ucans?: string[]): Promise<WorkspaceAppendResult>;
602
+ copy(from: string, to: string, ucans?: string[]): Promise<WorkspaceCopyResult>;
434
603
  }
435
604
 
436
605
  interface UCANManagerVenue {
437
- operations: {
438
- run(assetId: string, input: any): Promise<any>;
439
- };
606
+ operations: OperationRunner;
440
607
  }
441
608
  declare class UCANManager {
442
609
  private venue;
443
610
  constructor(venue: UCANManagerVenue);
444
611
  issue(aud: string, att: UCANAttenuation[], exp: number): Promise<UCANIssueResult>;
612
+ /**
613
+ * Verify a UCAN against the venue's trust policy and get the verdict
614
+ * explained — validity with a diagnosable reason, chain depth and root
615
+ * issuer, per-capability root-authority (owner / venue / refused), and,
616
+ * when `check` is supplied, whether the token would authorise that request
617
+ * here. The diagnostic counterpart to an enforcement "Access denied".
618
+ */
619
+ verify(token: string | object, check?: {
620
+ with?: string;
621
+ can?: string;
622
+ aud?: string;
623
+ }): Promise<UCANVerifyResult>;
445
624
  }
446
625
 
447
626
  interface SecretManagerVenue {
448
- operations: {
449
- run(assetId: string, input: any): Promise<any>;
450
- };
627
+ operations: OperationRunner;
451
628
  listSecrets(): Promise<string[]>;
452
- putSecret(name: string, value: string): Promise<void>;
453
629
  deleteSecret(name: string): Promise<void>;
454
630
  }
455
631
  declare class SecretManager {
@@ -458,12 +634,11 @@ declare class SecretManager {
458
634
  set(name: string, value: string): Promise<SecretSetResult>;
459
635
  /**
460
636
  * Extract a secret value by name.
461
- * NOTE: This operation requires a UCAN capability grant. The backend
462
- * may reject requests that lack the appropriate capability proof.
637
+ * Requires a UCAN capability grant pass the proof token(s) as `ucans`.
638
+ * Extracting another DID's secret needs a grant on that DID's `/s/<name>`.
463
639
  */
464
- extract(name: string): Promise<SecretExtractResult>;
640
+ extract(name: string, ucans?: string[]): Promise<SecretExtractResult>;
465
641
  list(): Promise<string[]>;
466
- put(name: string, value: string): Promise<void>;
467
642
  delete(name: string): Promise<void>;
468
643
  }
469
644
 
@@ -477,10 +652,32 @@ declare class SecretManager {
477
652
  */
478
653
  declare function venueBaseUrlCandidates(venueId: string): string[];
479
654
  declare class Venue implements VenueInterface {
655
+ /** Connection-level private-jobs mode — see {@link setPrivate}. */
656
+ privateJobs: boolean;
657
+ /**
658
+ * Puts this connection in **private-jobs mode**: every subsequent
659
+ * `operations.run(...)` executes as a memory-only job (covia #192) — never
660
+ * persisted to the venue's job index, no durable record, gone on venue
661
+ * restart. Requires `enablePrivateJobs` on the venue.
662
+ *
663
+ * Because a completed private job is immediately forgotten, results are
664
+ * collected through the invoke `wait` window rather than polling — so
665
+ * private mode works with `run()`; a poll-style `invoke()` throws.
666
+ */
667
+ setPrivate(enabled: boolean): void;
480
668
  baseUrl: string;
481
669
  venueId: string;
482
670
  auth: Auth;
483
671
  metadata: VenueData;
672
+ /**
673
+ * The most recent status this instance has seen — seeded by {@link connect}
674
+ * (which fetches `/api/v1/status` anyway) and refreshed by every
675
+ * {@link status} call. Undefined until one of those has happened, e.g. on a
676
+ * directly constructed venue. Managers use it as a capability hint (venue
677
+ * `version`); it is a cache, not a liveness check.
678
+ */
679
+ lastKnownStatus?: StatusData;
680
+ private _adapters?;
484
681
  private _agents?;
485
682
  private _jobs?;
486
683
  private _assets?;
@@ -488,6 +685,7 @@ declare class Venue implements VenueInterface {
488
685
  private _workspace?;
489
686
  private _ucan?;
490
687
  private _secrets?;
688
+ get adapters(): AdapterManager;
491
689
  get agents(): AgentManager;
492
690
  get jobs(): JobManager;
493
691
  get assets(): AssetManager;
@@ -497,10 +695,25 @@ declare class Venue implements VenueInterface {
497
695
  get secrets(): SecretManager;
498
696
  constructor(options?: VenueOptions);
499
697
  /**
500
- * Static method to connect to a venue
501
- * @param venueId - Can be a HTTP base URL, DNS name, or existing Venue instance
502
- * @param credentials - Optional credentials for venue authentication
503
- * @returns {Promise<Venue>} A new Venue instance configured appropriately
698
+ * Connect to a venue, validating it with `GET {base}/api/v1/status`. If the
699
+ * venue is auth-gated (status answers 401/403 public access disabled), the
700
+ * venue is validated against its public did:web document at
701
+ * `/.well-known/did.json` instead, whose `id` becomes `venueId` identity is
702
+ * publicly resolvable by spec even when the API is not.
703
+ *
704
+ * The input is permissive: a full `http(s)://` URL, a bare host / IP /
705
+ * host:port, a `did:web:` id, or an existing Venue instance. Schemeless inputs
706
+ * pick a scheme by host and may fall back across http/https (see
707
+ * {@link venueBaseUrlCandidates}); did:web ids resolve to their `Covia.API.v1`
708
+ * endpoint.
709
+ *
710
+ * @param venueId - A venue URL, DNS name / host:port, `did:web:` id, or existing Venue
711
+ * @param auth - Optional credentials for venue authentication
712
+ * @returns {Promise<Venue>} A connected venue. The actually resolved/validated
713
+ * target is on the returned object: `venue.baseUrl` is the origin that
714
+ * responded (the https candidate if an http fallback failed; the resolved
715
+ * endpoint for a did:web id), and `venue.venueId` is the DID the venue
716
+ * reported. The validated API root is `${venue.baseUrl}/api/v1`.
504
717
  */
505
718
  static connect(venueId: string | Venue, auth?: Auth): Promise<Venue>;
506
719
  /**
@@ -538,12 +751,6 @@ declare class Venue implements VenueInterface {
538
751
  * @returns {Promise<string[]>}
539
752
  */
540
753
  listSecrets(): Promise<string[]>;
541
- /**
542
- * Store a secret value
543
- * @param name - Secret name
544
- * @param value - Secret value
545
- */
546
- putSecret(name: string, value: string): Promise<void>;
547
754
  /**
548
755
  * Delete a secret
549
756
  * @param name - Secret name
@@ -554,6 +761,23 @@ declare class Venue implements VenueInterface {
554
761
  * @returns {Promise<StatusData>}
555
762
  */
556
763
  status(): Promise<StatusData>;
764
+ /**
765
+ * Block until the venue is ready to serve operations.
766
+ *
767
+ * Polls {@link status} until it responds and reports either no explicit
768
+ * `status` or `"OK"`. Connection/HTTP errors are treated as "not ready yet"
769
+ * and retried until `timeoutMs` elapses — useful right after starting a venue,
770
+ * since a cold venue may answer its root before its invoke layer is up.
771
+ *
772
+ * @param options.timeoutMs - Max time to wait (default 60000).
773
+ * @param options.pollIntervalMs - Delay between polls (default 1000).
774
+ * @returns The ready {@link StatusData}.
775
+ * @throws {CoviaTimeoutError} If the venue is not ready within the timeout.
776
+ */
777
+ waitUntilReady(options?: {
778
+ timeoutMs?: number;
779
+ pollIntervalMs?: number;
780
+ }): Promise<StatusData>;
557
781
  /**
558
782
  * Get the full DID document for this venue
559
783
  * @returns {Promise<DIDDocument>}
@@ -587,6 +811,8 @@ interface VenueOptions {
587
811
  name?: string;
588
812
  description?: string;
589
813
  auth?: Auth;
814
+ /** Status observed while connecting — seeds {@link Venue.lastKnownStatus}. */
815
+ status?: StatusData;
590
816
  }
591
817
  interface VenueConstructor {
592
818
  new (): VenueInterface;
@@ -595,6 +821,14 @@ interface VenueConstructor {
595
821
  interface InvokeOptions {
596
822
  ucans?: string[];
597
823
  }
824
+ /**
825
+ * The venue's operation-execution surface, as the typed managers consume it.
826
+ * `run<T>` returns the operation's result typed as `T` (defaults to `unknown`,
827
+ * so an un-parameterised call stays type-safe rather than leaking `any`).
828
+ */
829
+ interface OperationRunner {
830
+ run<T = unknown>(assetId: string, input?: unknown, options?: InvokeOptions): Promise<T>;
831
+ }
598
832
  interface VenueInterface {
599
833
  baseUrl: string;
600
834
  venueId: string;
@@ -609,7 +843,6 @@ interface VenueInterface {
609
843
  mcpDiscovery(): Promise<MCPDiscovery>;
610
844
  agentCard(): Promise<AgentCard>;
611
845
  listSecrets(): Promise<string[]>;
612
- putSecret(name: string, value: string): Promise<void>;
613
846
  deleteSecret(name: string): Promise<void>;
614
847
  agent(agentId: string): Agent;
615
848
  close(): void;
@@ -651,16 +884,17 @@ interface ContentHashResult {
651
884
  hash: string;
652
885
  }
653
886
  interface JobMetadata {
887
+ id?: string;
654
888
  name?: string;
655
889
  status?: RunStatus;
656
890
  created?: string;
657
891
  updated?: string;
658
- input?: any;
659
- output?: any;
892
+ input?: unknown;
893
+ output?: unknown;
660
894
  operation?: string;
661
895
  caller?: string;
662
896
  error?: string;
663
- [key: string]: any;
897
+ [key: string]: unknown;
664
898
  }
665
899
  interface InvokePayload {
666
900
  assetId: AssetID;
@@ -687,6 +921,8 @@ interface StatusData {
687
921
  status?: string;
688
922
  did?: string;
689
923
  name?: string;
924
+ /** Venue platform version (e.g. "0.3.0"). Absent on venues before 0.3. */
925
+ version?: string;
690
926
  stats?: StatsData;
691
927
  }
692
928
  interface StatsData {
@@ -713,13 +949,23 @@ interface MCPDiscovery {
713
949
  endpoint?: Record<string, any> | string;
714
950
  [key: string]: any;
715
951
  }
952
+ /**
953
+ * A2A agent card from `GET /.well-known/agent-card.json`.
954
+ * Field names mirror the A2A v1.0 wire format the venue serves (via the
955
+ * official A2A Java SDK). The index signature preserves any spec fields a
956
+ * given venue build adds (e.g. `securitySchemes`, `protocolVersion`).
957
+ */
716
958
  interface AgentCard {
717
- agentProvider?: Record<string, any>;
718
- agentCapabilities?: Record<string, any>;
719
- agentSkills?: Record<string, any>[];
720
- agentInterfaces?: Record<string, any>[];
721
- securityScheme?: Record<string, any>;
722
- preferredTransport?: Record<string, any>;
959
+ name: string;
960
+ description?: string;
961
+ version?: string;
962
+ provider?: Record<string, any>;
963
+ capabilities?: Record<string, any>;
964
+ defaultInputModes?: string[];
965
+ defaultOutputModes?: string[];
966
+ skills?: Record<string, any>[];
967
+ supportedInterfaces?: Record<string, any>[];
968
+ preferredTransport?: string;
723
969
  [key: string]: any;
724
970
  }
725
971
  interface DIDDocument {
@@ -742,7 +988,7 @@ interface SSEEvent {
742
988
  id: string | null;
743
989
  retry: number | null;
744
990
  /** Parse the event data as JSON. */
745
- json: () => any;
991
+ json: () => unknown;
746
992
  }
747
993
  declare enum AgentStatus {
748
994
  SLEEPING = "SLEEPING",
@@ -798,17 +1044,6 @@ interface AgentTriggerResult {
798
1044
  result?: any;
799
1045
  taskResults?: any[];
800
1046
  }
801
- interface AgentQueryInput {
802
- agentId: string;
803
- }
804
- interface AgentQueryResult {
805
- agentId: string;
806
- status: string;
807
- state?: Record<string, any>;
808
- config?: Record<string, any>;
809
- tasks?: any[];
810
- [key: string]: any;
811
- }
812
1047
  interface AgentListInput {
813
1048
  includeTerminated?: boolean;
814
1049
  }
@@ -886,10 +1121,10 @@ interface AssetPinResult {
886
1121
  hash: string;
887
1122
  }
888
1123
  interface WorkspaceCopyResult {
889
- /** 0.2.x: present and true only if a new parent path was built at the destination. */
1124
+ /** 0.3.0 (#147): `false` = copy created a new value at the destination, `true` = it replaced an existing one. */
1125
+ existed?: boolean;
1126
+ /** 0.3.0: present and true only if a new parent path was built at the destination. */
890
1127
  pathCreated?: boolean;
891
- /** @deprecated pre-0.2.x: constant true. Success is the job status. */
892
- copied?: boolean;
893
1128
  }
894
1129
  interface WorkspaceInspectInput {
895
1130
  paths: string | string[];
@@ -897,7 +1132,8 @@ interface WorkspaceInspectInput {
897
1132
  compact?: boolean;
898
1133
  }
899
1134
  interface WorkspaceInspectResult {
900
- result: any;
1135
+ /** Rendered string for a single path, or a `{path: string}` map for multiple. */
1136
+ result: string | Record<string, string>;
901
1137
  }
902
1138
  interface WorkspaceReadInput {
903
1139
  path: string;
@@ -907,26 +1143,27 @@ interface WorkspaceReadResult {
907
1143
  exists: boolean;
908
1144
  value?: any;
909
1145
  truncated?: boolean;
910
- /** 0.2.x: encoding size in bytes (always present). */
1146
+ /** Convex type name; included on a truncated read (0.3.0) so the caller can
1147
+ * fall back to `list` (map) or `slice` (sequence) instead of guessing. */
1148
+ type?: string;
1149
+ /** 0.3.0: encoded size in bytes (always present). */
911
1150
  valueBytes?: number;
912
- /** @deprecated pre-0.2.x: bytes, only on truncation. Use valueBytes. */
913
- size?: number;
914
1151
  }
915
1152
  interface WorkspaceWriteInput {
916
1153
  path: string;
917
1154
  value: any;
918
1155
  }
919
1156
  interface WorkspaceWriteResult {
920
- /** 0.2.x: true iff the write built a new parent path; omitted otherwise. */
1157
+ /** 0.3.0 (#147): `false` = a new value was created, `true` = an existing one was replaced (a stored null counts as present). */
1158
+ existed?: boolean;
1159
+ /** 0.3.0: true iff the write built a new parent path; omitted otherwise. */
921
1160
  pathCreated?: boolean;
922
- /** @deprecated pre-0.2.x: constant true. Success is the job status. */
923
- written?: boolean;
924
1161
  }
925
1162
  interface WorkspaceDeleteInput {
926
1163
  path: string;
927
1164
  }
928
1165
  interface WorkspaceDeleteResult {
929
- /** @deprecated pre-0.2.x: constant true. 0.2.x returns an empty object (success is the job status). */
1166
+ /** 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.) */
930
1167
  deleted?: boolean;
931
1168
  }
932
1169
  interface WorkspaceAppendInput {
@@ -934,28 +1171,31 @@ interface WorkspaceAppendInput {
934
1171
  value: any;
935
1172
  }
936
1173
  interface WorkspaceAppendResult {
937
- /** 0.2.x: vector element count after the append. */
1174
+ /** 0.3.0 (#147): `false` = a new collection was created, `true` = an existing one was extended. */
1175
+ existed?: boolean;
1176
+ /** 0.3.0 (#147): the position the appended element landed at (`newSize - 1`). */
1177
+ index?: number;
1178
+ /** 0.3.0: vector element count after the append. */
938
1179
  newSize?: number;
939
- /** 0.2.x: true iff a new parent path was built. */
1180
+ /** 0.3.0: true iff a new parent path was built. */
940
1181
  pathCreated?: boolean;
941
- /** @deprecated pre-0.2.x: constant true. */
942
- appended?: boolean;
943
1182
  }
944
1183
  interface WorkspaceListInput {
945
1184
  path?: string;
946
1185
  limit?: number;
947
1186
  offset?: number;
948
1187
  }
1188
+ /** Result of `covia:list` — the direct children of a node. A map lists its
1189
+ * `keys`; sets and vectors report only `type` + `count` (page their elements
1190
+ * with `slice`). */
949
1191
  interface WorkspaceListResult {
950
1192
  exists: boolean;
951
1193
  type: string;
952
- /** 0.2.x: total entries in the collection. */
953
- totalSize?: number;
1194
+ /** total entries in the collection (the single cardinality word). */
1195
+ count?: number;
1196
+ /** populated for maps; omitted for sets/vectors/scalars. */
954
1197
  keys?: string[];
955
- values?: any[];
956
1198
  offset?: number;
957
- /** @deprecated pre-0.2.x name for totalSize. */
958
- count?: number;
959
1199
  }
960
1200
  interface WorkspaceSliceInput {
961
1201
  path: string;
@@ -966,11 +1206,30 @@ interface WorkspaceSliceResult {
966
1206
  exists: boolean;
967
1207
  type?: string;
968
1208
  values?: any[];
969
- /** 0.2.x: total entries in the collection. */
970
- totalSize?: number;
1209
+ /** total entries in the collection (the single cardinality word). */
1210
+ count?: number;
971
1211
  offset?: number;
972
- /** @deprecated pre-0.2.x name for totalSize. */
1212
+ }
1213
+ /** Job-free tally (#177). `exists` = a countable collection is present at the
1214
+ * path (absent path, or a scalar with nothing to descend into → `{exists:false}`,
1215
+ * no `count`; an empty or too-deep collection → `{exists:true, count:0}`). */
1216
+ interface WorkspaceCountResult {
1217
+ exists: boolean;
1218
+ count?: number;
1219
+ }
1220
+ /** One group's metrics in `WorkspaceAggregateResult.groups`. `count` today;
1221
+ * numeric reductions (`sum`/`min`/`max`) will add keys additively. */
1222
+ interface GroupCount {
973
1223
  count?: number;
1224
+ [key: string]: number | undefined;
1225
+ }
1226
+ interface WorkspaceAggregateResult {
1227
+ exists: boolean;
1228
+ count?: number;
1229
+ /** Present when `groupBy` was supplied: each distinct field value → a
1230
+ * `GroupCount`. An entry lacking the field groups under the `"null"` key.
1231
+ * Σ(group counts) == count. */
1232
+ groups?: Record<string, GroupCount>;
974
1233
  }
975
1234
  interface UCANAttenuation {
976
1235
  with: string;
@@ -981,8 +1240,31 @@ interface UCANIssueInput {
981
1240
  att: UCANAttenuation[];
982
1241
  exp: number;
983
1242
  }
1243
+ /** Result of `ucan:verify` — the diagnostic verdict on a token. */
1244
+ interface UCANVerifyResult {
1245
+ valid: boolean;
1246
+ /** When invalid: a diagnosable reason (expired, bad signature, unparseable, ...). */
1247
+ reason?: string;
1248
+ iss?: string;
1249
+ aud?: string;
1250
+ exp?: number;
1251
+ /** Delegation hops above this token (0 = a root grant). */
1252
+ chainDepth?: number;
1253
+ /** The DID that signed the root of the delegation chain. */
1254
+ rootIssuer?: string;
1255
+ /** Capabilities, each annotated with rootAuthority: owner | venue | refused. */
1256
+ att?: Array<UCANAttenuation & {
1257
+ rootAuthority?: string;
1258
+ }>;
1259
+ /** Present when with/can supplied: whether the token authorises that request. */
1260
+ authorises?: boolean;
1261
+ [key: string]: unknown;
1262
+ }
984
1263
  interface UCANIssueResult {
985
- [key: string]: any;
1264
+ /** The issued delegation token — pass as an element of the `ucans` array on
1265
+ * subsequent invokes. */
1266
+ token: string;
1267
+ [key: string]: unknown;
986
1268
  }
987
1269
  interface SecretSetInput {
988
1270
  name: string;
@@ -1007,9 +1289,13 @@ interface FunctionInfo {
1007
1289
  interface FunctionsResult {
1008
1290
  functions: FunctionInfo[];
1009
1291
  }
1292
+ /** Per-adapter summary the venue materialises at `v/info/adapters/<name>`
1293
+ * (OPERATIONS.md §3). */
1010
1294
  interface AdapterInfo {
1011
1295
  name: string;
1012
1296
  description?: string;
1297
+ /** Full catalog paths of the adapter's invocable operations
1298
+ * (`v/ops/...`, `v/test/ops/...`), each runnable via `operations.run`. */
1013
1299
  operations: string[];
1014
1300
  }
1015
1301
  interface AdaptersResult {
@@ -1022,8 +1308,8 @@ declare class CoviaError extends Error {
1022
1308
  /** Raised when the Covia API returns an error response (4xx/5xx). */
1023
1309
  declare class GridError extends CoviaError {
1024
1310
  statusCode: number;
1025
- responseBody: any;
1026
- constructor(statusCode: number, message: string, responseBody?: any);
1311
+ responseBody: unknown;
1312
+ constructor(statusCode: number, message: string, responseBody?: unknown);
1027
1313
  }
1028
1314
  /** Raised when the SDK cannot connect to the venue. */
1029
1315
  declare class CoviaConnectionError extends CoviaError {
@@ -1039,6 +1325,13 @@ declare class JobFailedError extends CoviaError {
1039
1325
  constructor(jobData: JobMetadata);
1040
1326
  }
1041
1327
  /** Raised when a requested resource is not found (404). */
1328
+ /** HTTP 429 from the venue — a rate limit or concurrent-job cap. Carries the
1329
+ * server's Retry-After hint (seconds). Thrown only after the SDK's bounded
1330
+ * automatic retries are exhausted. */
1331
+ declare class RateLimitError extends GridError {
1332
+ retryAfterSeconds: number;
1333
+ constructor(message: string, retryAfterSeconds: number, body?: unknown);
1334
+ }
1042
1335
  declare class NotFoundError extends GridError {
1043
1336
  constructor(message: string);
1044
1337
  }
@@ -1053,12 +1346,11 @@ declare class JobNotFoundError extends NotFoundError {
1053
1346
  constructor(jobId: string);
1054
1347
  }
1055
1348
 
1056
- /**
1057
- * Utility function to handle API calls with consistent error handling
1058
- * @param url - The URL to fetch
1059
- * @param options - Fetch options
1060
- * @returns {Promise<T>} The response data
1061
- */
1349
+ /** Parse a Retry-After header (delta-seconds or HTTP-date) to ms from now. */
1350
+ declare function parseRetryAfterMs(header: string | null, nowMs: number): number;
1351
+ /** Delay before the next attempt after a 429, or -1 to give up. Pure — random
1352
+ * in [0,1) supplied by the caller so tests are deterministic. */
1353
+ declare function retryDelayMs(attempt: number, retryAfterMs: number, remainingBudgetMs: number, random: number): number;
1062
1354
  declare function fetchWithError<T>(url: string, options?: RequestInit): Promise<T>;
1063
1355
  /**
1064
1356
  * Utility function to handle fetch requests that return streams
@@ -1092,7 +1384,8 @@ declare function isJobFinished(jobStatus: RunStatus): boolean;
1092
1384
  */
1093
1385
  declare function getParsedAssetId(assetId: string): string;
1094
1386
  /**
1095
- * Utility function to return complete assetId from hex and path
1387
+ * Utility function to return complete assetId from hex and an API path of the
1388
+ * form `/api/v1/assets/<encoded-did>/...`.
1096
1389
  * @param assetHex - The asset hex
1097
1390
  * @param assetPath - The asset path
1098
1391
  * @returns {string} - Returns the complete assetId
@@ -1114,6 +1407,65 @@ declare function createSSEEvent(fields: {
1114
1407
  */
1115
1408
  declare function parseSSEStream(response: Response): AsyncGenerator<SSEEvent>;
1116
1409
 
1410
+ /**
1411
+ * DID and lattice-path helpers for the Covia grid.
1412
+ *
1413
+ * Covia addresses its lattice as `<DID>/<namespace>/<path...>`. These helpers
1414
+ * build and parse those addresses so callers don't hand-concatenate strings.
1415
+ *
1416
+ * Which DID belongs in a lattice address:
1417
+ * - `w`/`o`/`g`/`j`/`s` are per-user: the `<DID>` is the resource *owner's* DID
1418
+ * (yours is your auth DID, e.g. `Ed25519Auth.getDID()`) — NOT the venue's.
1419
+ * - `a` (assets) is venue-global and content-addressed.
1420
+ * - A namespace-relative path (no `<DID>`) resolves to the authenticated caller.
1421
+ */
1422
+ /** Lattice namespace identifiers. */
1423
+ declare const Namespace: {
1424
+ readonly ASSET: "a";
1425
+ readonly OPERATION: "o";
1426
+ readonly JOB: "j";
1427
+ readonly AGENT: "g";
1428
+ readonly WORKSPACE: "w";
1429
+ readonly SECRET: "s";
1430
+ readonly AGENT_SCRATCH: "n";
1431
+ readonly SESSION_SCRATCH: "c";
1432
+ readonly JOB_SCRATCH: "t";
1433
+ readonly VENUE: "v";
1434
+ };
1435
+ /** A parsed lattice address. */
1436
+ interface DIDURL {
1437
+ did: string | null;
1438
+ namespace: string | null;
1439
+ path: string;
1440
+ }
1441
+ /** True if `value` is a bare DID (`did:<method>:<id>`), not a DID URL with a path. */
1442
+ declare function isDid(value: string): boolean;
1443
+ /** The DID method (e.g. `'key'`, `'web'`), or null if `value` is not a DID. */
1444
+ declare function didMethod(value: string): string | null;
1445
+ /**
1446
+ * Split a lattice address into its DID, namespace, and path. Handles bare DIDs,
1447
+ * namespace-relative paths (`w/foo` or `/w/foo`), and fully-qualified DID URLs
1448
+ * (`did:key:z.../w/foo`); did:web `:` path separators inside the DID are kept.
1449
+ */
1450
+ declare function parseDidUrl(value: string): DIDURL;
1451
+ /**
1452
+ * Build a lattice address `<did>/<namespace>/<segments...>`. Pass `did = null`
1453
+ * for a namespace-relative path. Stray surrounding slashes on segments are
1454
+ * stripped and empty segments dropped.
1455
+ *
1456
+ * Remember the ownership rules above: for `w`/`o`/`g`/`j`/`s` the `did` is the
1457
+ * resource owner's DID, not the venue's.
1458
+ */
1459
+ declare function didUrl(did: string | null, namespace: string, ...segments: string[]): string;
1460
+ /**
1461
+ * The content hash `ref` pins to, or null if it isn't content-addressed.
1462
+ * Recognises a bare hex hash, `a/<hash>`, and `<DID>/a/<hash>` — the forms that
1463
+ * name a specific immutable asset. Mutable lattice paths (`w/…`, `o/…`) return
1464
+ * null: they resolve server-side, so there's no client-side hash and they must
1465
+ * not be treated as immutable (e.g. cached).
1466
+ */
1467
+ declare function assetHash(ref: string): string | null;
1468
+
1117
1469
  /**
1118
1470
  * Simple logger for the Covia SDK.
1119
1471
  *
@@ -1136,7 +1488,7 @@ declare class Grid {
1136
1488
  /**
1137
1489
  * Static method to connect to a venue
1138
1490
  * @param venueId - Can be a HTTP base URL, DNS name, or existing Venue instance
1139
- * @param auth - Optional authentication provider (BearerAuth, KeyPairAuth, etc.)
1491
+ * @param auth - Optional authentication provider (BearerAuth, BasicAuth, Ed25519Auth, etc.)
1140
1492
  * @returns {Promise<Venue>} A new Venue instance configured appropriately
1141
1493
  */
1142
1494
  static connect(venueId: string, auth?: Auth): Promise<Venue>;
@@ -1193,4 +1545,58 @@ declare function decodePublicKey(multikey: string): Uint8Array;
1193
1545
  */
1194
1546
  declare function didFromPublicKey(publicKey: Uint8Array): string;
1195
1547
 
1196
- 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 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, type AssetPinResult, Auth, BearerAuth, ChatSession, 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 WorkspaceCopyResult, 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, createSSEEvent, decodePublicKey, didFromPublicKey, encodePublicKey, fetchStreamWithError, fetchWithError, generateKeyPair, getAssetIdFromPath, getAssetIdFromVenueId, getParsedAssetId, hexToPrivateKey, isJobComplete, isJobFinished, isJobPaused, logger, parseSSEStream, privateKeyToHex, venueBaseUrlCandidates };
1548
+ /**
1549
+ * Client-side UCAN minting for self-sovereign callers — the tokens a principal
1550
+ * signs with their OWN key (a venue cannot sign as the caller, so these have
1551
+ * no venue-op counterpart; venues only verify). Java parity:
1552
+ * covia-core `covia.grid.auth.UcanTokens`.
1553
+ *
1554
+ * All helpers return the JWT encoding — the transport form carried in the
1555
+ * `ucans` request array and relayed across cross-venue hops. Delegation chains
1556
+ * embed parent tokens as JWT strings in `prf`.
1557
+ */
1558
+ /** The ability that instructs a venue to relay a cross-venue hop as itself. */
1559
+ declare const VENUE_RELAY = "venue/relay";
1560
+ interface UCANCapability {
1561
+ with: string;
1562
+ can: string;
1563
+ }
1564
+ /** The did:key DID for a private key. */
1565
+ declare function didFor(privateKey: Uint8Array): string;
1566
+ /**
1567
+ * Mint a UCAN as an EdDSA JWT: `{iss, aud, att, exp[, prf]}` signed by
1568
+ * `privateKey` (iss = its did:key).
1569
+ *
1570
+ * @param privateKey 32-byte Ed25519 private key (the issuer)
1571
+ * @param audienceDID who receives the token (`aud`)
1572
+ * @param att capabilities delegated (empty array = pure identity token)
1573
+ * @param lifetimeSeconds validity window
1574
+ * @param proofs parent UCAN JWT strings (`prf`) for delegation chains
1575
+ */
1576
+ declare function createUCANJWT(privateKey: Uint8Array, audienceDID: string, att: UCANCapability[], lifetimeSeconds: number, proofs?: string[]): string;
1577
+ /**
1578
+ * Mint an **identity token**: a UCAN with an EMPTY attenuation list, audienced
1579
+ * to `venueDID`. Pure proof of identity — it grants nothing, and being
1580
+ * audience-bound it is unusable at any other venue. Present it in the `ucans`
1581
+ * array; the venue accepts it as the caller identity on an
1582
+ * otherwise-unauthenticated transport (how identity crosses cross-venue
1583
+ * relays — COG-3 §6, COG-15).
1584
+ */
1585
+ declare function identityToken(privateKey: Uint8Array, venueDID: string, lifetimeSeconds?: number): string;
1586
+ /**
1587
+ * Mint an owner-signed (**self-sovereign**) grant: delegates `(with, can)` to
1588
+ * `audienceDID`, rooted by the signer. Because the root issuer is the resource
1589
+ * owner, the grant verifies on ANY venue hosting the data — no venue involved
1590
+ * in issuance.
1591
+ */
1592
+ declare function grant(ownerPrivateKey: Uint8Array, audienceDID: string, withResource: string, can: string, lifetimeSeconds: number): string;
1593
+ /**
1594
+ * Mint a **relay delegation**: instructs and authorises `venueDID` to make a
1595
+ * cross-venue hop authenticated as itself, exercising the caller's authority.
1596
+ * Carries the `venue/relay` instruction plus the substantive capabilities the
1597
+ * venue may exercise. The venue honours it only when its issuer is the
1598
+ * authenticated caller (COG-15).
1599
+ */
1600
+ declare function relayDelegation(privateKey: Uint8Array, venueDID: string, lifetimeSeconds: number, caps?: UCANCapability[]): string;
1601
+
1602
+ export { type AdapterInfo, AdapterManager, 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, RateLimitError, RunStatus, type SSEEvent, type SecretExtractInput, type SecretExtractResult, SecretManager, type SecretSetInput, type SecretSetResult, type StatsData, type StatusData, type UCANAttenuation, type UCANCapability, type UCANIssueInput, type UCANIssueResult, UCANManager, type UCANVerifyResult, VENUE_RELAY, 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, createUCANJWT, decodePublicKey, didFor, didFromPublicKey, didMethod, didUrl, encodePublicKey, fetchStreamWithError, fetchWithError, generateKeyPair, getAssetIdFromPath, getAssetIdFromVenueId, getParsedAssetId, grant, hexToPrivateKey, identityToken, isDid, isJobComplete, isJobFinished, isJobPaused, logger, parseDidUrl, parseRetryAfterMs, parseSSEStream, privateKeyToHex, relayDelegation, retryDelayMs, venueBaseUrlCandidates };