@olane/os 0.8.3 → 0.8.5
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 +68 -10
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ Think of OlaneOS as the orchestration layer that:
|
|
|
34
34
|
## Installation
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
|
|
37
|
+
pnpm install @olane/os
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
### Peer Dependencies
|
|
@@ -42,7 +42,7 @@ npm install @olane/os
|
|
|
42
42
|
OlaneOS requires the following peer dependencies:
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
|
-
|
|
45
|
+
pnpm install @olane/o-core @olane/o-config @olane/o-protocol \
|
|
46
46
|
@olane/o-tool @olane/o-tools-common @olane/o-tool-registry \
|
|
47
47
|
@olane/o-intelligence @olane/o-leader @olane/o-lane @olane/o-storage
|
|
48
48
|
```
|
|
@@ -77,7 +77,7 @@ const os = new OlaneOS({
|
|
|
77
77
|
await os.start();
|
|
78
78
|
|
|
79
79
|
// Use a node via the OS
|
|
80
|
-
const
|
|
80
|
+
const response = await os.use(
|
|
81
81
|
new oAddress('o://node'),
|
|
82
82
|
{
|
|
83
83
|
method: 'some_tool',
|
|
@@ -85,6 +85,13 @@ const result = await os.use(
|
|
|
85
85
|
}
|
|
86
86
|
);
|
|
87
87
|
|
|
88
|
+
// Check response using the standard wrapping structure
|
|
89
|
+
if (response.result.success) {
|
|
90
|
+
console.log('Data:', response.result.data);
|
|
91
|
+
} else {
|
|
92
|
+
console.error('Error:', response.result.error);
|
|
93
|
+
}
|
|
94
|
+
|
|
88
95
|
// Stop the OS gracefully
|
|
89
96
|
await os.stop();
|
|
90
97
|
```
|
|
@@ -177,9 +184,10 @@ OlaneOS uses round-robin routing to distribute requests across nodes:
|
|
|
177
184
|
|
|
178
185
|
```typescript
|
|
179
186
|
// Requests are automatically load-balanced
|
|
180
|
-
const
|
|
181
|
-
const
|
|
182
|
-
const
|
|
187
|
+
const response1 = await os.use(address, params); // → Node 1
|
|
188
|
+
const response2 = await os.use(address, params); // → Node 2
|
|
189
|
+
const response3 = await os.use(address, params); // → Node 1
|
|
190
|
+
// Access data via response.result.data on each response
|
|
183
191
|
```
|
|
184
192
|
|
|
185
193
|
This provides:
|
|
@@ -187,6 +195,40 @@ This provides:
|
|
|
187
195
|
- **Fault tolerance** if nodes fail
|
|
188
196
|
- **Scalability** by adding more node instances
|
|
189
197
|
|
|
198
|
+
### Response Structure
|
|
199
|
+
|
|
200
|
+
When calling tools via `os.use()`, responses follow a standard wrapped structure:
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
{
|
|
204
|
+
jsonrpc: "2.0",
|
|
205
|
+
id: "request-id",
|
|
206
|
+
result: {
|
|
207
|
+
success: boolean, // Whether the call succeeded
|
|
208
|
+
data: any, // The return value on success
|
|
209
|
+
error?: string // Error message on failure
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Always access response fields through the `result` property:
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
const response = await os.use(address, {
|
|
218
|
+
method: 'some_method',
|
|
219
|
+
params: { /* ... */ }
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
// Check success
|
|
223
|
+
if (response.result.success) {
|
|
224
|
+
const data = response.result.data; // Access return value
|
|
225
|
+
} else {
|
|
226
|
+
const error = response.result.error; // Access error message
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
> **Common mistake**: Accessing `response.success` or `response.data` directly will not work. Always use `response.result.success`, `response.result.data`, and `response.result.error`.
|
|
231
|
+
|
|
190
232
|
### Configuration Management
|
|
191
233
|
|
|
192
234
|
OlaneOS supports two configuration approaches:
|
|
@@ -383,11 +425,22 @@ Routes a request to a node via the entry point router.
|
|
|
383
425
|
- `address` - Target node address (e.g., `o://node/tool`)
|
|
384
426
|
- `params` - Request parameters including method and params
|
|
385
427
|
|
|
386
|
-
**Returns**:
|
|
428
|
+
**Returns**: A wrapped response object with the following structure:
|
|
429
|
+
```typescript
|
|
430
|
+
{
|
|
431
|
+
jsonrpc: "2.0",
|
|
432
|
+
id: "request-id",
|
|
433
|
+
result: {
|
|
434
|
+
success: boolean, // Whether the call succeeded
|
|
435
|
+
data: any, // Response data on success
|
|
436
|
+
error?: string // Error message on failure
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
```
|
|
387
440
|
|
|
388
441
|
**Example**:
|
|
389
442
|
```typescript
|
|
390
|
-
const
|
|
443
|
+
const response = await os.use(
|
|
391
444
|
new oAddress('o://financial-analyst'),
|
|
392
445
|
{
|
|
393
446
|
method: 'intent',
|
|
@@ -396,6 +449,12 @@ const result = await os.use(
|
|
|
396
449
|
}
|
|
397
450
|
}
|
|
398
451
|
);
|
|
452
|
+
|
|
453
|
+
if (response.result.success) {
|
|
454
|
+
console.log('Analysis:', response.result.data);
|
|
455
|
+
} else {
|
|
456
|
+
console.error('Failed:', response.result.error);
|
|
457
|
+
}
|
|
399
458
|
```
|
|
400
459
|
|
|
401
460
|
#### addNode()
|
|
@@ -941,7 +1000,6 @@ ISC © oLane Inc.
|
|
|
941
1000
|
|
|
942
1001
|
---
|
|
943
1002
|
|
|
944
|
-
**Package Version**: 0.
|
|
945
|
-
**Last Updated**: October 1, 2025
|
|
1003
|
+
**Package Version**: 0.8.3
|
|
946
1004
|
**Status**: Active development
|
|
947
1005
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/os",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -58,23 +58,23 @@
|
|
|
58
58
|
"typescript": "5.4.5"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@olane/o-client-limited": "0.8.
|
|
62
|
-
"@olane/o-config": "0.8.
|
|
63
|
-
"@olane/o-core": "0.8.
|
|
64
|
-
"@olane/o-intelligence": "0.8.
|
|
65
|
-
"@olane/o-lane": "0.8.
|
|
66
|
-
"@olane/o-leader": "0.8.
|
|
67
|
-
"@olane/o-login": "0.8.
|
|
68
|
-
"@olane/o-protocol": "0.8.
|
|
69
|
-
"@olane/o-storage": "0.8.
|
|
70
|
-
"@olane/o-tool": "0.8.
|
|
71
|
-
"@olane/o-tool-registry": "0.8.
|
|
72
|
-
"@olane/o-tools-common": "0.8.
|
|
61
|
+
"@olane/o-client-limited": "0.8.5",
|
|
62
|
+
"@olane/o-config": "0.8.5",
|
|
63
|
+
"@olane/o-core": "0.8.5",
|
|
64
|
+
"@olane/o-intelligence": "0.8.5",
|
|
65
|
+
"@olane/o-lane": "0.8.5",
|
|
66
|
+
"@olane/o-leader": "0.8.5",
|
|
67
|
+
"@olane/o-login": "0.8.5",
|
|
68
|
+
"@olane/o-protocol": "0.8.5",
|
|
69
|
+
"@olane/o-storage": "0.8.5",
|
|
70
|
+
"@olane/o-tool": "0.8.5",
|
|
71
|
+
"@olane/o-tool-registry": "0.8.5",
|
|
72
|
+
"@olane/o-tools-common": "0.8.5",
|
|
73
73
|
"chalk": "^5.4.1",
|
|
74
74
|
"debug": "^4.4.1",
|
|
75
75
|
"dotenv": "^16.5.0",
|
|
76
76
|
"fs-extra": "^11.3.0",
|
|
77
77
|
"touch": "^3.1.1"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "e88f1e55dcc92d9a410d28200e4220697116f82f"
|
|
80
80
|
}
|