@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/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.
@@ -430,34 +464,42 @@ await venue.agents.chat("my-agent", "hi");
430
464
 
431
465
  Read and write shared state in the venue's workspace.
432
466
 
467
+ **Reads are job-free.** `read`/`list`/`slice`/`inspect`/`count`/`aggregate` go through
468
+ `GET /api/v1/values/*` (covia #177) — synchronous, capability-checked, and **no job is
469
+ persisted**. This matters under load: routing reads through the invoke/job path writes a
470
+ durable job record per read, growing the venue's etch without bound. **Writes stay on the
471
+ job path** (they should leave an audit record). A read that needs UCAN **proof tokens**
472
+ (cross-DID) transparently falls back to the invoke path.
473
+
433
474
  ```typescript
434
- // CRUD
475
+ // CRUD (reads are job-free; writes are jobs)
435
476
  await venue.workspace.write("w/my-app/config", { theme: "dark" });
436
477
  const data = await venue.workspace.read("w/my-app/config");
437
478
  await venue.workspace.append("w/my-app/log", "new entry");
438
479
  await venue.workspace.delete("w/my-app/config");
439
480
 
440
481
  // List and slice
441
- const entries = await venue.workspace.list("w/my-app/", 100, 0);
482
+ const entries = await venue.workspace.list("w/my-app/log", 100, 0);
442
483
  const slice = await venue.workspace.slice("w/my-app/log", 0, 10);
443
484
 
444
- // Discovery
445
- const funcs = await venue.workspace.functions();
446
- const desc = await venue.workspace.describe("myFunction");
447
- const adapters = await venue.workspace.adapters();
485
+ // Server-side tallies — count / group-by without reading every record
486
+ const { count } = await venue.workspace.count("w/my-app/log", { depth: 1 });
487
+ const byKind = await venue.workspace.aggregate("w/my-app/events", { depth: 2, groupBy: "kind" });
488
+ // byKind.groups { click: { count: 12 }, view: { count: 40 } }
448
489
  ```
449
490
 
450
491
  | Method | Returns | Description |
451
492
  |---|---|---|
452
- | `workspace.read(path, maxSize?)` | `WorkspaceReadResult` | Read a value |
453
- | `workspace.write(path, value)` | `WorkspaceWriteResult` | Write a value |
454
- | `workspace.delete(path)` | `WorkspaceDeleteResult` | Delete an entry |
455
- | `workspace.append(path, value)` | `WorkspaceAppendResult` | Append to an entry |
456
- | `workspace.list(path?, limit?, offset?)` | `WorkspaceListResult` | List entries |
457
- | `workspace.slice(path, offset?, limit?)` | `WorkspaceSliceResult` | Slice an entry |
458
- | `workspace.functions()` | `FunctionsResult` | List available functions |
459
- | `workspace.describe(name)` | `any` | Describe a function |
460
- | `workspace.adapters()` | `AdaptersResult` | List adapters |
493
+ | `workspace.read(path, maxSize?)` | `WorkspaceReadResult` | Read a value (job-free) |
494
+ | `workspace.write(path, value)` | `WorkspaceWriteResult` | Write a value (job) |
495
+ | `workspace.delete(path)` | `WorkspaceDeleteResult` | Delete an entry (job) |
496
+ | `workspace.append(path, value)` | `WorkspaceAppendResult` | Append to an entry (job) |
497
+ | `workspace.list(path?, limit?, offset?)` | `WorkspaceListResult` | List keys/count of a node (job-free) |
498
+ | `workspace.slice(path, offset?, limit?)` | `WorkspaceSliceResult` | Paginated elements/entries (job-free) |
499
+ | `workspace.inspect(paths, budget?, compact?)` | `WorkspaceInspectResult` | JSON5 render of a value (job-free; single path) |
500
+ | `workspace.count(path, {depth?})` | `WorkspaceCountResult` | Count entries at a depth (job-free) |
501
+ | `workspace.aggregate(path, {depth?, groupBy?})` | `WorkspaceAggregateResult` | Count, optionally grouped by a field (job-free) |
502
+ | `workspace.copy(from, to)` | `WorkspaceCopyResult` | Copy a value between paths (job) |
461
503
 
462
504
  ---
463
505
 
@@ -466,9 +508,8 @@ const adapters = await venue.workspace.adapters();
466
508
  Manage secrets stored on the venue.
467
509
 
468
510
  ```typescript
469
- // Store and retrieve
470
- await venue.secrets.put("API_KEY", "sk-...");
471
- await venue.secrets.set("API_KEY", "sk-..."); // via secret:set operation
511
+ // Store a secret (returns SecretSetResult)
512
+ await venue.secrets.set("API_KEY", "sk-...");
472
513
 
473
514
  // List
474
515
  const names = await venue.secrets.list(); // ["API_KEY", "DB_PASS"]
@@ -483,8 +524,7 @@ await venue.secrets.delete("API_KEY");
483
524
  | Method | Returns | Description |
484
525
  |---|---|---|
485
526
  | `secrets.list()` | `string[]` | List secret names |
486
- | `secrets.put(name, value)` | `void` | Store a secret via REST |
487
- | `secrets.set(name, value)` | `SecretSetResult` | Store via `secret:set` operation |
527
+ | `secrets.set(name, value)` | `SecretSetResult` | Store a secret (`secret:set`) |
488
528
  | `secrets.extract(name)` | `SecretExtractResult` | Extract value (requires UCAN) |
489
529
  | `secrets.delete(name)` | `void` | Delete a secret |
490
530
 
@@ -503,7 +543,31 @@ const token = await venue.ucan.issue("did:key:z6MkBob", att, exp);
503
543
 
504
544
  | Method | Returns | Description |
505
545
  |---|---|---|
506
- | `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
+ ```
507
571
 
508
572
  ---
509
573
 
@@ -521,6 +585,7 @@ import {
521
585
  CoviaConnectionError,// Connection failures
522
586
  CoviaTimeoutError, // Timeout exceeded
523
587
  JobFailedError, // Job finished with non-COMPLETE status
588
+ RateLimitError, // 429 after bounded retries (carries retryAfterSeconds)
524
589
  } from "@covia/covia-sdk";
525
590
 
526
591
  try {
@@ -573,7 +638,7 @@ RunStatus.AUTH_REQUIRED; // Waiting for authentication
573
638
  ```typescript
574
639
  import {
575
640
  Venue, Grid, Job, Agent, ChatSession, Asset, Operation, DataAsset,
576
- AssetManager, OperationManager, JobManager,
641
+ AdapterManager, AssetManager, OperationManager, JobManager,
577
642
  AgentManager, WorkspaceManager, SecretManager, UCANManager,
578
643
  KeyPairAuth, BearerAuth,
579
644
  RunStatus, CoviaError,