@covia/covia-sdk 1.6.0 → 1.7.1
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 +61 -2
- package/dist/index.d.mts +221 -9
- package/dist/index.d.ts +221 -9
- package/dist/index.js +360 -50
- package/dist/index.mjs +349 -51
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -118,8 +118,26 @@ venue.metadata; // { name, description }
|
|
|
118
118
|
| `venue.didDocument()` | Get the venue's DID document |
|
|
119
119
|
| `venue.mcpDiscovery()` | Get MCP (Model Context Protocol) discovery info |
|
|
120
120
|
| `venue.agentCard()` | Get A2A (Agent-to-Agent) agent card |
|
|
121
|
+
| `venue.setPrivate(enabled)` | Toggle private-jobs mode for this connection (see below) |
|
|
121
122
|
| `venue.close()` | Release resources and clear caches |
|
|
122
123
|
|
|
124
|
+
#### Private jobs
|
|
125
|
+
|
|
126
|
+
`venue.setPrivate(true)` puts the connection in **private-jobs mode**: every
|
|
127
|
+
subsequent `operations.run()` executes as a memory-only job — never persisted
|
|
128
|
+
to the venue's job index, gone on venue restart. The venue must have
|
|
129
|
+
`enablePrivateJobs` set. Because a completed private job is immediately
|
|
130
|
+
forgotten by the venue, results are collected through the server-side invoke
|
|
131
|
+
`wait` window rather than polling — so private mode works with `run()`, and
|
|
132
|
+
poll-style `operations.invoke()` throws.
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
venue.setPrivate(true);
|
|
136
|
+
const result = await venue.operations.run("v/ops/schema/infer", {
|
|
137
|
+
value: { name: "Ada", age: 36 },
|
|
138
|
+
});
|
|
139
|
+
```
|
|
140
|
+
|
|
123
141
|
---
|
|
124
142
|
|
|
125
143
|
### Operations — `venue.operations`
|
|
@@ -160,6 +178,22 @@ const job = await venue.operations.invoke("sensitive:op", input, {
|
|
|
160
178
|
|
|
161
179
|
---
|
|
162
180
|
|
|
181
|
+
### Adapters — `venue.adapters`
|
|
182
|
+
|
|
183
|
+
List the adapters registered on a venue — the true registry, including adapters
|
|
184
|
+
with zero catalogued operations. Backed by the venue's canonical
|
|
185
|
+
`v/info/adapters/<name>` lattice data, read job-free via the values API.
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
// All registered adapters
|
|
189
|
+
const adapters = await venue.adapters.list();
|
|
190
|
+
adapters.forEach((a) => console.log(`${a.name}: ${a.operations.length} ops`));
|
|
191
|
+
|
|
192
|
+
// One adapter's summary (null if not registered)
|
|
193
|
+
const covia = await venue.adapters.get("covia");
|
|
194
|
+
console.log(covia?.description, covia?.operations);
|
|
195
|
+
```
|
|
196
|
+
|
|
163
197
|
### Assets — `venue.assets`
|
|
164
198
|
|
|
165
199
|
Manage data assets and operations registered on the venue.
|
|
@@ -509,7 +543,31 @@ const token = await venue.ucan.issue("did:key:z6MkBob", att, exp);
|
|
|
509
543
|
|
|
510
544
|
| Method | Returns | Description |
|
|
511
545
|
|---|---|---|
|
|
512
|
-
| `ucan.issue(aud, att, exp)` | `UCANIssueResult` | Issue a UCAN token |
|
|
546
|
+
| `ucan.issue(aud, att, exp)` | `UCANIssueResult` | Issue a venue-signed UCAN token |
|
|
547
|
+
| `ucan.verify(token, check?)` | `UCANVerifyResult` | Diagnose a token against the venue's trust policy |
|
|
548
|
+
|
|
549
|
+
`ucan.verify` explains a token's verdict — `valid`/`reason`, `chainDepth`,
|
|
550
|
+
`rootIssuer`, and a per-capability `rootAuthority` (`owner` / `venue` /
|
|
551
|
+
`refused`). Pass `check: { with, can, aud }` to also ask whether the token
|
|
552
|
+
would authorise a specific request (`authorises`).
|
|
553
|
+
|
|
554
|
+
#### Client-side minting
|
|
555
|
+
|
|
556
|
+
Tokens can also be minted locally with your own Ed25519 key — no venue
|
|
557
|
+
round-trip:
|
|
558
|
+
|
|
559
|
+
```typescript
|
|
560
|
+
import { grant, identityToken, relayDelegation, didFor } from "@covia/covia-sdk";
|
|
561
|
+
|
|
562
|
+
// Self-sovereign grant over your own namespace — verifies on ANY venue
|
|
563
|
+
const token = grant(privateKey, "did:key:z6MkBob", `${didFor(privateKey)}/w/shared/`, "crud/read", 3600);
|
|
564
|
+
|
|
565
|
+
// Identity token — proves control of your DID to a venue (empty attenuation)
|
|
566
|
+
const idToken = identityToken(privateKey, venue.venueId);
|
|
567
|
+
|
|
568
|
+
// Relay delegation — authorises the venue to forward your authority cross-venue
|
|
569
|
+
const relay = relayDelegation(privateKey, venue.venueId, 300, [{ with: `${didFor(privateKey)}/w/`, can: "crud/read" }]);
|
|
570
|
+
```
|
|
513
571
|
|
|
514
572
|
---
|
|
515
573
|
|
|
@@ -527,6 +585,7 @@ import {
|
|
|
527
585
|
CoviaConnectionError,// Connection failures
|
|
528
586
|
CoviaTimeoutError, // Timeout exceeded
|
|
529
587
|
JobFailedError, // Job finished with non-COMPLETE status
|
|
588
|
+
RateLimitError, // 429 after bounded retries (carries retryAfterSeconds)
|
|
530
589
|
} from "@covia/covia-sdk";
|
|
531
590
|
|
|
532
591
|
try {
|
|
@@ -579,7 +638,7 @@ RunStatus.AUTH_REQUIRED; // Waiting for authentication
|
|
|
579
638
|
```typescript
|
|
580
639
|
import {
|
|
581
640
|
Venue, Grid, Job, Agent, ChatSession, Asset, Operation, DataAsset,
|
|
582
|
-
AssetManager, OperationManager, JobManager,
|
|
641
|
+
AdapterManager, AssetManager, OperationManager, JobManager,
|
|
583
642
|
AgentManager, WorkspaceManager, SecretManager, UCANManager,
|
|
584
643
|
KeyPairAuth, BearerAuth,
|
|
585
644
|
RunStatus, CoviaError,
|
package/dist/index.d.mts
CHANGED
|
@@ -296,12 +296,57 @@ declare class CredentialsHTTP implements Credentials {
|
|
|
296
296
|
constructor(venueId: string, apiKey: string, userId: string);
|
|
297
297
|
}
|
|
298
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
|
+
|
|
299
331
|
interface AgentManagerVenue {
|
|
332
|
+
baseUrl: string;
|
|
333
|
+
venueId: string;
|
|
334
|
+
auth: {
|
|
335
|
+
apply(headers: Record<string, string>, audience?: string): void;
|
|
336
|
+
};
|
|
300
337
|
operations: OperationRunner;
|
|
338
|
+
lastKnownStatus?: StatusData;
|
|
301
339
|
}
|
|
302
340
|
declare class AgentManager {
|
|
303
341
|
private venue;
|
|
342
|
+
private agentsGetSupported;
|
|
304
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;
|
|
305
350
|
create(input: AgentCreateInput): Promise<AgentCreateResult>;
|
|
306
351
|
request(agentId: string, input?: unknown, wait?: boolean | number): Promise<AgentRequestResult>;
|
|
307
352
|
message(agentId: string, message: unknown): Promise<AgentMessageResult>;
|
|
@@ -323,12 +368,19 @@ declare class AgentManager {
|
|
|
323
368
|
*/
|
|
324
369
|
chat(agentId: string, message: unknown, sessionId?: string): Promise<AgentChatResult>;
|
|
325
370
|
trigger(agentId: string): Promise<AgentTriggerResult>;
|
|
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
|
+
*/
|
|
326
376
|
list(includeTerminated?: boolean): Promise<AgentListResult>;
|
|
327
377
|
delete(agentId: string, remove?: boolean): Promise<AgentDeleteResult>;
|
|
328
378
|
suspend(agentId: string): Promise<AgentSuspendResult>;
|
|
329
379
|
resume(agentId: string, autoWake?: boolean): Promise<AgentSuspendResult>;
|
|
330
380
|
update(input: AgentUpdateInput): Promise<unknown>;
|
|
331
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. */
|
|
332
384
|
info(agentId: string): Promise<AgentInfoResult>;
|
|
333
385
|
fork(input: AgentForkInput): Promise<AgentForkResult>;
|
|
334
386
|
context(agentId: string, task?: unknown): Promise<string>;
|
|
@@ -379,6 +431,7 @@ declare class AssetManager {
|
|
|
379
431
|
* @returns Returns either an Operation or DataAsset based on the asset's metadata
|
|
380
432
|
*/
|
|
381
433
|
get(assetId: AssetID): Promise<Asset>;
|
|
434
|
+
private _wrap;
|
|
382
435
|
/**
|
|
383
436
|
* List assets with pagination support
|
|
384
437
|
* @param options - Pagination options (offset, limit)
|
|
@@ -425,6 +478,7 @@ interface OperationManagerVenue {
|
|
|
425
478
|
auth: {
|
|
426
479
|
apply(headers: Record<string, string>, audience?: string): void;
|
|
427
480
|
};
|
|
481
|
+
privateJobs?: boolean;
|
|
428
482
|
}
|
|
429
483
|
declare class OperationManager {
|
|
430
484
|
private venue;
|
|
@@ -445,6 +499,15 @@ declare class OperationManager {
|
|
|
445
499
|
* @param options - Invoke options (e.g., ucans)
|
|
446
500
|
*/
|
|
447
501
|
run<T = unknown>(assetId: string, input?: unknown, options?: InvokeOptions): Promise<T>;
|
|
502
|
+
/**
|
|
503
|
+
* Private-mode execution (covia #192): a memory-only job whose result is
|
|
504
|
+
* collected through the invoke `wait` window — a completed private job is
|
|
505
|
+
* immediately forgotten by the venue, so polling cannot be used. If the
|
|
506
|
+
* operation outlives the venue's wait cap, polling continues while the job
|
|
507
|
+
* runs; a job that completes between polls is unobservable and surfaces as
|
|
508
|
+
* a clear error rather than a confusing 404.
|
|
509
|
+
*/
|
|
510
|
+
private _runPrivate;
|
|
448
511
|
/**
|
|
449
512
|
* Execute an operation and return a Job for tracking
|
|
450
513
|
* @param assetId - Operation asset ID or named operation
|
|
@@ -547,6 +610,18 @@ declare class UCANManager {
|
|
|
547
610
|
private venue;
|
|
548
611
|
constructor(venue: UCANManagerVenue);
|
|
549
612
|
issue(aud: string, att: UCANAttenuation[], exp: number): Promise<UCANIssueResult>;
|
|
613
|
+
/**
|
|
614
|
+
* Verify a UCAN against the venue's trust policy and get the verdict
|
|
615
|
+
* explained — validity with a diagnosable reason, chain depth and root
|
|
616
|
+
* issuer, per-capability root-authority (owner / venue / refused), and,
|
|
617
|
+
* when `check` is supplied, whether the token would authorise that request
|
|
618
|
+
* here. The diagnostic counterpart to an enforcement "Access denied".
|
|
619
|
+
*/
|
|
620
|
+
verify(token: string | object, check?: {
|
|
621
|
+
with?: string;
|
|
622
|
+
can?: string;
|
|
623
|
+
aud?: string;
|
|
624
|
+
}): Promise<UCANVerifyResult>;
|
|
550
625
|
}
|
|
551
626
|
|
|
552
627
|
interface SecretManagerVenue {
|
|
@@ -578,6 +653,19 @@ declare class SecretManager {
|
|
|
578
653
|
*/
|
|
579
654
|
declare function venueBaseUrlCandidates(venueId: string): string[];
|
|
580
655
|
declare class Venue implements VenueInterface {
|
|
656
|
+
/** Connection-level private-jobs mode — see {@link setPrivate}. */
|
|
657
|
+
privateJobs: boolean;
|
|
658
|
+
/**
|
|
659
|
+
* Puts this connection in **private-jobs mode**: every subsequent
|
|
660
|
+
* `operations.run(...)` executes as a memory-only job (covia #192) — never
|
|
661
|
+
* persisted to the venue's job index, no durable record, gone on venue
|
|
662
|
+
* restart. Requires `enablePrivateJobs` on the venue.
|
|
663
|
+
*
|
|
664
|
+
* Because a completed private job is immediately forgotten, results are
|
|
665
|
+
* collected through the invoke `wait` window rather than polling — so
|
|
666
|
+
* private mode works with `run()`; a poll-style `invoke()` throws.
|
|
667
|
+
*/
|
|
668
|
+
setPrivate(enabled: boolean): void;
|
|
581
669
|
baseUrl: string;
|
|
582
670
|
venueId: string;
|
|
583
671
|
auth: Auth;
|
|
@@ -590,6 +678,7 @@ declare class Venue implements VenueInterface {
|
|
|
590
678
|
* `version`); it is a cache, not a liveness check.
|
|
591
679
|
*/
|
|
592
680
|
lastKnownStatus?: StatusData;
|
|
681
|
+
private _adapters?;
|
|
593
682
|
private _agents?;
|
|
594
683
|
private _jobs?;
|
|
595
684
|
private _assets?;
|
|
@@ -597,6 +686,7 @@ declare class Venue implements VenueInterface {
|
|
|
597
686
|
private _workspace?;
|
|
598
687
|
private _ucan?;
|
|
599
688
|
private _secrets?;
|
|
689
|
+
get adapters(): AdapterManager;
|
|
600
690
|
get agents(): AgentManager;
|
|
601
691
|
get jobs(): JobManager;
|
|
602
692
|
get assets(): AssetManager;
|
|
@@ -917,6 +1007,14 @@ interface AgentCreateResult {
|
|
|
917
1007
|
agentId: string;
|
|
918
1008
|
status: string;
|
|
919
1009
|
created: boolean;
|
|
1010
|
+
/** True when an existing SLEEPING/SUSPENDED record was updated in place
|
|
1011
|
+
* (mutually exclusive with created). Absent on venues before 0.4. */
|
|
1012
|
+
updated?: boolean;
|
|
1013
|
+
/** Non-fatal advisories (venue 0.5+): present only when the config looks
|
|
1014
|
+
* misconfigured but create still succeeded — e.g. an Ollama model whose
|
|
1015
|
+
* tool-calling can't be confirmed, or declared tools that don't resolve
|
|
1016
|
+
* on the venue. Each entry is a human-readable message. */
|
|
1017
|
+
warnings?: string[];
|
|
920
1018
|
}
|
|
921
1019
|
interface AgentRequestInput {
|
|
922
1020
|
agentId: string;
|
|
@@ -959,10 +1057,13 @@ interface AgentListInput {
|
|
|
959
1057
|
includeTerminated?: boolean;
|
|
960
1058
|
}
|
|
961
1059
|
interface AgentListResult {
|
|
1060
|
+
/** Always objects. The invoke op returns enriched entries; the job-free GET
|
|
1061
|
+
* returns bare id strings, which the SDK normalises to `{agentId}` — so
|
|
1062
|
+
* `status`/`tasks` are present only when the venue supplied them. */
|
|
962
1063
|
agents: Array<{
|
|
963
1064
|
agentId: string;
|
|
964
|
-
status
|
|
965
|
-
tasks
|
|
1065
|
+
status?: string;
|
|
1066
|
+
tasks?: number;
|
|
966
1067
|
}>;
|
|
967
1068
|
}
|
|
968
1069
|
interface AgentDeleteInput {
|
|
@@ -1151,6 +1252,26 @@ interface UCANIssueInput {
|
|
|
1151
1252
|
att: UCANAttenuation[];
|
|
1152
1253
|
exp: number;
|
|
1153
1254
|
}
|
|
1255
|
+
/** Result of `ucan:verify` — the diagnostic verdict on a token. */
|
|
1256
|
+
interface UCANVerifyResult {
|
|
1257
|
+
valid: boolean;
|
|
1258
|
+
/** When invalid: a diagnosable reason (expired, bad signature, unparseable, ...). */
|
|
1259
|
+
reason?: string;
|
|
1260
|
+
iss?: string;
|
|
1261
|
+
aud?: string;
|
|
1262
|
+
exp?: number;
|
|
1263
|
+
/** Delegation hops above this token (0 = a root grant). */
|
|
1264
|
+
chainDepth?: number;
|
|
1265
|
+
/** The DID that signed the root of the delegation chain. */
|
|
1266
|
+
rootIssuer?: string;
|
|
1267
|
+
/** Capabilities, each annotated with rootAuthority: owner | venue | refused. */
|
|
1268
|
+
att?: Array<UCANAttenuation & {
|
|
1269
|
+
rootAuthority?: string;
|
|
1270
|
+
}>;
|
|
1271
|
+
/** Present when with/can supplied: whether the token authorises that request. */
|
|
1272
|
+
authorises?: boolean;
|
|
1273
|
+
[key: string]: unknown;
|
|
1274
|
+
}
|
|
1154
1275
|
interface UCANIssueResult {
|
|
1155
1276
|
/** The issued delegation token — pass as an element of the `ucans` array on
|
|
1156
1277
|
* subsequent invokes. */
|
|
@@ -1180,9 +1301,13 @@ interface FunctionInfo {
|
|
|
1180
1301
|
interface FunctionsResult {
|
|
1181
1302
|
functions: FunctionInfo[];
|
|
1182
1303
|
}
|
|
1304
|
+
/** Per-adapter summary the venue materialises at `v/info/adapters/<name>`
|
|
1305
|
+
* (OPERATIONS.md §3). */
|
|
1183
1306
|
interface AdapterInfo {
|
|
1184
1307
|
name: string;
|
|
1185
1308
|
description?: string;
|
|
1309
|
+
/** Full catalog paths of the adapter's invocable operations
|
|
1310
|
+
* (`v/ops/...`, `v/test/ops/...`), each runnable via `operations.run`. */
|
|
1186
1311
|
operations: string[];
|
|
1187
1312
|
}
|
|
1188
1313
|
interface AdaptersResult {
|
|
@@ -1212,6 +1337,13 @@ declare class JobFailedError extends CoviaError {
|
|
|
1212
1337
|
constructor(jobData: JobMetadata);
|
|
1213
1338
|
}
|
|
1214
1339
|
/** Raised when a requested resource is not found (404). */
|
|
1340
|
+
/** HTTP 429 from the venue — a rate limit or concurrent-job cap. Carries the
|
|
1341
|
+
* server's Retry-After hint (seconds). Thrown only after the SDK's bounded
|
|
1342
|
+
* automatic retries are exhausted. */
|
|
1343
|
+
declare class RateLimitError extends GridError {
|
|
1344
|
+
retryAfterSeconds: number;
|
|
1345
|
+
constructor(message: string, retryAfterSeconds: number, body?: unknown);
|
|
1346
|
+
}
|
|
1215
1347
|
declare class NotFoundError extends GridError {
|
|
1216
1348
|
constructor(message: string);
|
|
1217
1349
|
}
|
|
@@ -1226,12 +1358,11 @@ declare class JobNotFoundError extends NotFoundError {
|
|
|
1226
1358
|
constructor(jobId: string);
|
|
1227
1359
|
}
|
|
1228
1360
|
|
|
1229
|
-
/**
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
*
|
|
1233
|
-
|
|
1234
|
-
*/
|
|
1361
|
+
/** Parse a Retry-After header (delta-seconds or HTTP-date) to ms from now. */
|
|
1362
|
+
declare function parseRetryAfterMs(header: string | null, nowMs: number): number;
|
|
1363
|
+
/** Delay before the next attempt after a 429, or -1 to give up. Pure — random
|
|
1364
|
+
* in [0,1) supplied by the caller so tests are deterministic. */
|
|
1365
|
+
declare function retryDelayMs(attempt: number, retryAfterMs: number, remainingBudgetMs: number, random: number): number;
|
|
1235
1366
|
declare function fetchWithError<T>(url: string, options?: RequestInit): Promise<T>;
|
|
1236
1367
|
/**
|
|
1237
1368
|
* Utility function to handle fetch requests that return streams
|
|
@@ -1347,6 +1478,33 @@ declare function didUrl(did: string | null, namespace: string, ...segments: stri
|
|
|
1347
1478
|
*/
|
|
1348
1479
|
declare function assetHash(ref: string): string | null;
|
|
1349
1480
|
|
|
1481
|
+
/**
|
|
1482
|
+
* Pluggable persistent store for content-addressed asset metadata.
|
|
1483
|
+
*
|
|
1484
|
+
* An asset id is the Convex value hash of its metadata (`AMap.getHash()`
|
|
1485
|
+
* venue-side), so hash → metadata is immutable: entries never go stale and are
|
|
1486
|
+
* safe to cache indefinitely, across sessions and across venues. Keys are the
|
|
1487
|
+
* normalised bare hash (lowercase, no `0x`), so `<hash>`, `0x<hash>` and
|
|
1488
|
+
* `<DID>/a/<hash>` refs all share one entry.
|
|
1489
|
+
*
|
|
1490
|
+
* Trust model: entries are cached as returned by the venue that served them.
|
|
1491
|
+
* Provable verification — recomputing the Convex value hash of the metadata
|
|
1492
|
+
* and rejecting mismatches — requires a canonical CVM cell encoder in
|
|
1493
|
+
* TypeScript, which does not exist yet; when it lands, verification will gate
|
|
1494
|
+
* admission to this cache so entries are correct by construction rather than
|
|
1495
|
+
* by trust. Until then this is a availability/performance cache with the same
|
|
1496
|
+
* trust as an uncached fetch from the same venue.
|
|
1497
|
+
*/
|
|
1498
|
+
interface AssetMetadataStore {
|
|
1499
|
+
get(hash: string): AssetMetadata | undefined;
|
|
1500
|
+
put(hash: string, metadata: AssetMetadata): void;
|
|
1501
|
+
clear(): void;
|
|
1502
|
+
}
|
|
1503
|
+
/** Replace the persistent metadata store (e.g. a file-backed store in Node),
|
|
1504
|
+
* or pass `null` to disable persistence. Browsers default to localStorage. */
|
|
1505
|
+
declare function setAssetMetadataStore(s: AssetMetadataStore | null): void;
|
|
1506
|
+
declare function getAssetMetadataStore(): AssetMetadataStore | null;
|
|
1507
|
+
|
|
1350
1508
|
/**
|
|
1351
1509
|
* Simple logger for the Covia SDK.
|
|
1352
1510
|
*
|
|
@@ -1426,4 +1584,58 @@ declare function decodePublicKey(multikey: string): Uint8Array;
|
|
|
1426
1584
|
*/
|
|
1427
1585
|
declare function didFromPublicKey(publicKey: Uint8Array): string;
|
|
1428
1586
|
|
|
1429
|
-
|
|
1587
|
+
/**
|
|
1588
|
+
* Client-side UCAN minting for self-sovereign callers — the tokens a principal
|
|
1589
|
+
* signs with their OWN key (a venue cannot sign as the caller, so these have
|
|
1590
|
+
* no venue-op counterpart; venues only verify). Java parity:
|
|
1591
|
+
* covia-core `covia.grid.auth.UcanTokens`.
|
|
1592
|
+
*
|
|
1593
|
+
* All helpers return the JWT encoding — the transport form carried in the
|
|
1594
|
+
* `ucans` request array and relayed across cross-venue hops. Delegation chains
|
|
1595
|
+
* embed parent tokens as JWT strings in `prf`.
|
|
1596
|
+
*/
|
|
1597
|
+
/** The ability that instructs a venue to relay a cross-venue hop as itself. */
|
|
1598
|
+
declare const VENUE_RELAY = "venue/relay";
|
|
1599
|
+
interface UCANCapability {
|
|
1600
|
+
with: string;
|
|
1601
|
+
can: string;
|
|
1602
|
+
}
|
|
1603
|
+
/** The did:key DID for a private key. */
|
|
1604
|
+
declare function didFor(privateKey: Uint8Array): string;
|
|
1605
|
+
/**
|
|
1606
|
+
* Mint a UCAN as an EdDSA JWT: `{iss, aud, att, exp[, prf]}` signed by
|
|
1607
|
+
* `privateKey` (iss = its did:key).
|
|
1608
|
+
*
|
|
1609
|
+
* @param privateKey 32-byte Ed25519 private key (the issuer)
|
|
1610
|
+
* @param audienceDID who receives the token (`aud`)
|
|
1611
|
+
* @param att capabilities delegated (empty array = pure identity token)
|
|
1612
|
+
* @param lifetimeSeconds validity window
|
|
1613
|
+
* @param proofs parent UCAN JWT strings (`prf`) for delegation chains
|
|
1614
|
+
*/
|
|
1615
|
+
declare function createUCANJWT(privateKey: Uint8Array, audienceDID: string, att: UCANCapability[], lifetimeSeconds: number, proofs?: string[]): string;
|
|
1616
|
+
/**
|
|
1617
|
+
* Mint an **identity token**: a UCAN with an EMPTY attenuation list, audienced
|
|
1618
|
+
* to `venueDID`. Pure proof of identity — it grants nothing, and being
|
|
1619
|
+
* audience-bound it is unusable at any other venue. Present it in the `ucans`
|
|
1620
|
+
* array; the venue accepts it as the caller identity on an
|
|
1621
|
+
* otherwise-unauthenticated transport (how identity crosses cross-venue
|
|
1622
|
+
* relays — COG-3 §6, COG-15).
|
|
1623
|
+
*/
|
|
1624
|
+
declare function identityToken(privateKey: Uint8Array, venueDID: string, lifetimeSeconds?: number): string;
|
|
1625
|
+
/**
|
|
1626
|
+
* Mint an owner-signed (**self-sovereign**) grant: delegates `(with, can)` to
|
|
1627
|
+
* `audienceDID`, rooted by the signer. Because the root issuer is the resource
|
|
1628
|
+
* owner, the grant verifies on ANY venue hosting the data — no venue involved
|
|
1629
|
+
* in issuance.
|
|
1630
|
+
*/
|
|
1631
|
+
declare function grant(ownerPrivateKey: Uint8Array, audienceDID: string, withResource: string, can: string, lifetimeSeconds: number): string;
|
|
1632
|
+
/**
|
|
1633
|
+
* Mint a **relay delegation**: instructs and authorises `venueDID` to make a
|
|
1634
|
+
* cross-venue hop authenticated as itself, exercising the caller's authority.
|
|
1635
|
+
* Carries the `venue/relay` instruction plus the substantive capabilities the
|
|
1636
|
+
* venue may exercise. The venue honours it only when its issuer is the
|
|
1637
|
+
* authenticated caller (COG-15).
|
|
1638
|
+
*/
|
|
1639
|
+
declare function relayDelegation(privateKey: Uint8Array, venueDID: string, lifetimeSeconds: number, caps?: UCANCapability[]): string;
|
|
1640
|
+
|
|
1641
|
+
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, type AssetMetadataStore, 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, getAssetMetadataStore, getParsedAssetId, grant, hexToPrivateKey, identityToken, isDid, isJobComplete, isJobFinished, isJobPaused, logger, parseDidUrl, parseRetryAfterMs, parseSSEStream, privateKeyToHex, relayDelegation, retryDelayMs, setAssetMetadataStore, venueBaseUrlCandidates };
|