@blocks-network/sdk 0.1.45 → 0.1.46
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 +15 -15
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @blocks-network/sdk
|
|
2
2
|
|
|
3
|
-
Blocks Network SDK for Node.js -- build and run A2A agents on
|
|
3
|
+
Blocks Network SDK for Node.js -- build and run A2A agents on Blocks Network.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -87,14 +87,14 @@ The agent card follows the A2A specification with a `runtime` extension:
|
|
|
87
87
|
Note: `identity.agentName` must use only alphanumeric characters and
|
|
88
88
|
underscores (no hyphens). The pattern is `^[a-zA-Z0-9_]+$`.
|
|
89
89
|
|
|
90
|
-
##
|
|
90
|
+
## Blocks Network Subscribe Strategy
|
|
91
91
|
|
|
92
|
-
The Node SDK uses
|
|
93
|
-
subscribing
|
|
92
|
+
The Node SDK uses Blocks Network Event Engine (`enableEventEngine: true`) on all
|
|
93
|
+
subscribing Blocks Network clients (control client, per-task client, and per-stream
|
|
94
94
|
client). Event Engine replaces the legacy subscribe manager with a
|
|
95
95
|
deterministic state machine for subscribe, reconnect, and retry. The SDK
|
|
96
96
|
does not set `autoNetworkDetection` or `restore` (both are browser-only
|
|
97
|
-
settings). No explicit `retryConfiguration` is added; the
|
|
97
|
+
settings). No explicit `retryConfiguration` is added; the Blocks Network JS SDK
|
|
98
98
|
applies a default exponential retry policy when Event Engine is enabled.
|
|
99
99
|
|
|
100
100
|
## API
|
|
@@ -112,7 +112,7 @@ Go CLI's `blocks publish` command generates the API key and writes
|
|
|
112
112
|
it to `.env` automatically. `blocks login` can also do this when
|
|
113
113
|
invoked with `--write-env` (or by answering "y" to its prompt).
|
|
114
114
|
|
|
115
|
-
PAM tokens for
|
|
115
|
+
PAM tokens for Blocks Network channel access are managed by the SDK at runtime
|
|
116
116
|
(granted at registration, refreshed per-task on the control channel).
|
|
117
117
|
No CLI involvement is needed for PAM.
|
|
118
118
|
|
|
@@ -291,7 +291,7 @@ const result: DownloadedArtifact = await session.downloadArtifact(ref);
|
|
|
291
291
|
// result.data: Uint8Array, result.mimeType: string, result.fileName?: string
|
|
292
292
|
```
|
|
293
293
|
|
|
294
|
-
Also available as a standalone function: `downloadArtifact(ref,
|
|
294
|
+
Also available as a standalone function: `downloadArtifact(ref, client)`.
|
|
295
295
|
|
|
296
296
|
### `session.onError(cb)`
|
|
297
297
|
|
|
@@ -371,7 +371,7 @@ extends `Uint8Array`.
|
|
|
371
371
|
|
|
372
372
|
### Stream Consumer APIs
|
|
373
373
|
|
|
374
|
-
All consumer iterators (`bytes()`, `events()`, `readable()`, `inbound`) deliver messages in sequence order. The SDK's reorder buffer transparently corrects out-of-order
|
|
374
|
+
All consumer iterators (`bytes()`, `events()`, `readable()`, `inbound`) deliver messages in sequence order. The SDK's reorder buffer transparently corrects out-of-order Blocks Network delivery and drops duplicate messages. To customize or disable reordering, pass `reorderTimeoutMs` to `open()`:
|
|
375
375
|
|
|
376
376
|
```typescript
|
|
377
377
|
// Default: reorder buffer with 750ms gap timeout
|
|
@@ -411,9 +411,9 @@ readable.pipe(createWriteStream('./output.bin'));
|
|
|
411
411
|
### Handling Stream Errors
|
|
412
412
|
|
|
413
413
|
Every `StreamClient` exposes an `onError(cb)` registration method.
|
|
414
|
-
The callback fires whenever the stream's
|
|
414
|
+
The callback fires whenever the stream's Blocks Network subscribe loop
|
|
415
415
|
surfaces an error-category status event: PAM revocation, network
|
|
416
|
-
issues, timeouts, or any other category the
|
|
416
|
+
issues, timeouts, or any other category the Blocks Network SDK marks as an
|
|
417
417
|
error. The payload is a typed `StreamError`:
|
|
418
418
|
|
|
419
419
|
```typescript
|
|
@@ -443,7 +443,7 @@ arrive:
|
|
|
443
443
|
|
|
444
444
|
All other error categories (network transients, timeouts, etc.)
|
|
445
445
|
fire `onError` with `fatal: false` and leave the stream running so
|
|
446
|
-
|
|
446
|
+
Blocks Network's built-in retry machinery can recover.
|
|
447
447
|
|
|
448
448
|
### Opening Task Streams
|
|
449
449
|
|
|
@@ -505,7 +505,7 @@ The option is supported on both `sendMessage()` and `connect()`.
|
|
|
505
505
|
|
|
506
506
|
### Reconnecting to Terminal Tasks
|
|
507
507
|
|
|
508
|
-
Stream data is **live-only** —
|
|
508
|
+
Stream data is **live-only** — Blocks Network does not persist stream
|
|
509
509
|
payloads. When `client.connect({ taskId })` returns a session for a
|
|
510
510
|
task that has already finished, a stream that was **never opened
|
|
511
511
|
while the task was active** throws a typed `StreamUnavailableError`
|
|
@@ -587,8 +587,8 @@ are browser-safe — no Node.js `Buffer` polyfill needed:
|
|
|
587
587
|
`Blob` field. `fetch` computes the multipart boundary
|
|
588
588
|
automatically — no manual `Content-Type: multipart/form-data`
|
|
589
589
|
header, no `Buffer.concat`.
|
|
590
|
-
- `downloadArtifact()` handles the three
|
|
591
|
-
(raw `Uint8Array`, `Blob`, and legacy `
|
|
590
|
+
- `downloadArtifact()` handles the three Blocks Network v10 download shapes
|
|
591
|
+
(raw `Uint8Array`, `Blob`, and legacy `Blocks NetworkFile` with
|
|
592
592
|
`toArrayBuffer()`) with typeof-guarded branches — no
|
|
593
593
|
`Buffer.isBuffer` OR-order short-circuits.
|
|
594
594
|
- `decodeInlineArtifact()` uses `atob` + `Uint8Array` and
|
|
@@ -629,4 +629,4 @@ the SDK does not read from `process.env` in browser environments:
|
|
|
629
629
|
|
|
630
630
|
## License
|
|
631
631
|
|
|
632
|
-
|
|
632
|
+
Blocks Network
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocks-network/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.46",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Blocks Network SDK — build and run A2A agents on
|
|
5
|
+
"description": "Blocks Network SDK — build and run A2A agents on Blocks Network",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
8
|
"browser": {
|
|
@@ -58,14 +58,14 @@
|
|
|
58
58
|
},
|
|
59
59
|
"repository": {
|
|
60
60
|
"type": "git",
|
|
61
|
-
"url": "git+https://github.com/
|
|
61
|
+
"url": "git+https://github.com/blocksnetwork/blocks-sdk.git",
|
|
62
62
|
"directory": "blocks-sdk/sdks/node"
|
|
63
63
|
},
|
|
64
|
-
"homepage": "https://github.com/
|
|
64
|
+
"homepage": "https://github.com/blocksnetwork/blocks-sdk/tree/master/sdks/node#readme",
|
|
65
65
|
"bugs": {
|
|
66
|
-
"url": "https://github.com/
|
|
66
|
+
"url": "https://github.com/blocksnetwork/blocks-sdk/issues"
|
|
67
67
|
},
|
|
68
|
-
"license": "
|
|
68
|
+
"license": "Blocks Network",
|
|
69
69
|
"overrides": {
|
|
70
70
|
"pubnub": {
|
|
71
71
|
"react-native-url-polyfill": "npm:empty-npm-package@1.0.0"
|