@covia/covia-sdk 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -20
- package/dist/index.d.mts +390 -127
- package/dist/index.d.ts +390 -127
- package/dist/index.js +644 -378
- package/dist/index.mjs +636 -379
- package/package.json +14 -9
package/README.md
CHANGED
|
@@ -430,34 +430,42 @@ await venue.agents.chat("my-agent", "hi");
|
|
|
430
430
|
|
|
431
431
|
Read and write shared state in the venue's workspace.
|
|
432
432
|
|
|
433
|
+
**Reads are job-free.** `read`/`list`/`slice`/`inspect`/`count`/`aggregate` go through
|
|
434
|
+
`GET /api/v1/values/*` (covia #177) — synchronous, capability-checked, and **no job is
|
|
435
|
+
persisted**. This matters under load: routing reads through the invoke/job path writes a
|
|
436
|
+
durable job record per read, growing the venue's etch without bound. **Writes stay on the
|
|
437
|
+
job path** (they should leave an audit record). A read that needs UCAN **proof tokens**
|
|
438
|
+
(cross-DID) transparently falls back to the invoke path.
|
|
439
|
+
|
|
433
440
|
```typescript
|
|
434
|
-
// CRUD
|
|
441
|
+
// CRUD (reads are job-free; writes are jobs)
|
|
435
442
|
await venue.workspace.write("w/my-app/config", { theme: "dark" });
|
|
436
443
|
const data = await venue.workspace.read("w/my-app/config");
|
|
437
444
|
await venue.workspace.append("w/my-app/log", "new entry");
|
|
438
445
|
await venue.workspace.delete("w/my-app/config");
|
|
439
446
|
|
|
440
447
|
// List and slice
|
|
441
|
-
const entries = await venue.workspace.list("w/my-app/", 100, 0);
|
|
448
|
+
const entries = await venue.workspace.list("w/my-app/log", 100, 0);
|
|
442
449
|
const slice = await venue.workspace.slice("w/my-app/log", 0, 10);
|
|
443
450
|
|
|
444
|
-
//
|
|
445
|
-
const
|
|
446
|
-
const
|
|
447
|
-
|
|
451
|
+
// Server-side tallies — count / group-by without reading every record
|
|
452
|
+
const { count } = await venue.workspace.count("w/my-app/log", { depth: 1 });
|
|
453
|
+
const byKind = await venue.workspace.aggregate("w/my-app/events", { depth: 2, groupBy: "kind" });
|
|
454
|
+
// byKind.groups → { click: { count: 12 }, view: { count: 40 } }
|
|
448
455
|
```
|
|
449
456
|
|
|
450
457
|
| Method | Returns | Description |
|
|
451
458
|
|---|---|---|
|
|
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
|
|
457
|
-
| `workspace.slice(path, offset?, limit?)` | `WorkspaceSliceResult` |
|
|
458
|
-
| `workspace.
|
|
459
|
-
| `workspace.
|
|
460
|
-
| `workspace.
|
|
459
|
+
| `workspace.read(path, maxSize?)` | `WorkspaceReadResult` | Read a value (job-free) |
|
|
460
|
+
| `workspace.write(path, value)` | `WorkspaceWriteResult` | Write a value (job) |
|
|
461
|
+
| `workspace.delete(path)` | `WorkspaceDeleteResult` | Delete an entry (job) |
|
|
462
|
+
| `workspace.append(path, value)` | `WorkspaceAppendResult` | Append to an entry (job) |
|
|
463
|
+
| `workspace.list(path?, limit?, offset?)` | `WorkspaceListResult` | List keys/count of a node (job-free) |
|
|
464
|
+
| `workspace.slice(path, offset?, limit?)` | `WorkspaceSliceResult` | Paginated elements/entries (job-free) |
|
|
465
|
+
| `workspace.inspect(paths, budget?, compact?)` | `WorkspaceInspectResult` | JSON5 render of a value (job-free; single path) |
|
|
466
|
+
| `workspace.count(path, {depth?})` | `WorkspaceCountResult` | Count entries at a depth (job-free) |
|
|
467
|
+
| `workspace.aggregate(path, {depth?, groupBy?})` | `WorkspaceAggregateResult` | Count, optionally grouped by a field (job-free) |
|
|
468
|
+
| `workspace.copy(from, to)` | `WorkspaceCopyResult` | Copy a value between paths (job) |
|
|
461
469
|
|
|
462
470
|
---
|
|
463
471
|
|
|
@@ -466,9 +474,8 @@ const adapters = await venue.workspace.adapters();
|
|
|
466
474
|
Manage secrets stored on the venue.
|
|
467
475
|
|
|
468
476
|
```typescript
|
|
469
|
-
// Store
|
|
470
|
-
await venue.secrets.
|
|
471
|
-
await venue.secrets.set("API_KEY", "sk-..."); // via secret:set operation
|
|
477
|
+
// Store a secret (returns SecretSetResult)
|
|
478
|
+
await venue.secrets.set("API_KEY", "sk-...");
|
|
472
479
|
|
|
473
480
|
// List
|
|
474
481
|
const names = await venue.secrets.list(); // ["API_KEY", "DB_PASS"]
|
|
@@ -483,8 +490,7 @@ await venue.secrets.delete("API_KEY");
|
|
|
483
490
|
| Method | Returns | Description |
|
|
484
491
|
|---|---|---|
|
|
485
492
|
| `secrets.list()` | `string[]` | List secret names |
|
|
486
|
-
| `secrets.
|
|
487
|
-
| `secrets.set(name, value)` | `SecretSetResult` | Store via `secret:set` operation |
|
|
493
|
+
| `secrets.set(name, value)` | `SecretSetResult` | Store a secret (`secret:set`) |
|
|
488
494
|
| `secrets.extract(name)` | `SecretExtractResult` | Extract value (requires UCAN) |
|
|
489
495
|
| `secrets.delete(name)` | `void` | Delete a secret |
|
|
490
496
|
|