@olane/os 0.7.12-alpha.28 → 0.7.12-alpha.29
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/dist/test/basic/basic-usage.spec.d.ts +0 -1
- package/dist/test/basic/basic-usage.spec.js +134 -130
- package/dist/test/basic/playground.spec.d.ts +2 -0
- package/dist/test/basic/playground.spec.d.ts.map +1 -0
- package/dist/test/basic/playground.spec.js +33 -0
- package/dist/test/utils/os.default.js +1 -1
- package/dist/test/utils/tmp.node.d.ts +3 -0
- package/dist/test/utils/tmp.node.d.ts.map +1 -0
- package/dist/test/utils/tmp.node.js +8 -0
- package/package.json +12 -12
|
@@ -1,140 +1,144 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
// intent: 'What is the official endpoint for github mcp server?',
|
|
53
|
-
// },
|
|
54
|
-
// },
|
|
55
|
-
// {
|
|
56
|
-
// onChunk: (chunk) => {
|
|
57
|
-
// console.log(
|
|
58
|
-
// 'Received chunk: ',
|
|
59
|
-
// JSON.stringify(chunk.result.data, null, 2),
|
|
60
|
-
// );
|
|
61
|
-
// },
|
|
62
|
-
// },
|
|
63
|
-
// );
|
|
64
|
-
// await entryNode.use(
|
|
65
|
-
// new oNodeAddress('o://intelligence'),
|
|
66
|
-
// {
|
|
67
|
-
// method: 'prompt',
|
|
68
|
-
// params: {
|
|
69
|
-
// _isStream: true,
|
|
70
|
-
// prompt: 'What is the capital of France?',
|
|
71
|
-
// },
|
|
72
|
-
// },
|
|
73
|
-
// {
|
|
74
|
-
// isStream: true,
|
|
75
|
-
// onChunk: (chunk) => {
|
|
76
|
-
// console.log('FINAL Received chunk: ', JSON.stringify(chunk, null, 2));
|
|
77
|
-
// },
|
|
78
|
-
// },
|
|
79
|
-
// );
|
|
80
|
-
// await new Promise((resolve) => setTimeout(resolve, 20_000));
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
// describe('olane network usage', async () => {
|
|
84
|
-
// it('should be able to use the olane network', async () => {
|
|
85
|
-
// // let's dial the other network
|
|
86
|
-
// const response = await network.use(
|
|
87
|
-
// new oAddress('o://leader', [
|
|
88
|
-
// multiaddr('/dns4/leader.olane.com/tcp/4000/tls/ws'),
|
|
89
|
-
// ]),
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { oAddress, NodeState } from '@olane/o-core';
|
|
3
|
+
// import { expect } from 'chai';
|
|
4
|
+
// import dotenv from 'dotenv';
|
|
5
|
+
// import { defaultOSInstance } from '../utils/os.default.js';
|
|
6
|
+
// import { OlaneOSSystemStatus } from '../../src/o-olane-os/enum/o-os.status-enum.js';
|
|
7
|
+
// import { oNodeAddress, oNodeTransport } from '@olane/o-node';
|
|
8
|
+
// import { multiaddr } from '@olane/o-config';
|
|
9
|
+
// dotenv.config();
|
|
10
|
+
// const network = defaultOSInstance;
|
|
11
|
+
// describe('basic-usage @initialize', async () => {
|
|
12
|
+
// it('should be able to startup the network', async () => {
|
|
13
|
+
// await network.start();
|
|
14
|
+
// expect(network.status).to.equal(OlaneOSSystemStatus.RUNNING);
|
|
15
|
+
// });
|
|
16
|
+
// // disabled for now, to avoid unecessary indexing costs
|
|
17
|
+
// // it('should be able to index the network', async () => {
|
|
18
|
+
// // const entryNode = network.entryNode();
|
|
19
|
+
// // expect(entryNode).to.exist;
|
|
20
|
+
// // expect(entryNode.state).to.equal(NodeState.RUNNING);
|
|
21
|
+
// // const response = await entryNode.use(new oAddress('o://leader'), {
|
|
22
|
+
// // method: 'index_network',
|
|
23
|
+
// // params: {},
|
|
24
|
+
// // });
|
|
25
|
+
// // const data = response.result.data;
|
|
26
|
+
// // expect(data).to.exist;
|
|
27
|
+
// // expect(data.error).to.be.undefined;
|
|
28
|
+
// // expect(data.message).to.equal('Network indexed!');
|
|
29
|
+
// // });
|
|
30
|
+
// it('should be able to use stream from a provider service', async () => {
|
|
31
|
+
// const entryNode = network.entryNode();
|
|
32
|
+
// expect(entryNode).to.exist;
|
|
33
|
+
// expect(entryNode.state).to.equal(NodeState.RUNNING);
|
|
34
|
+
// // configure the intelligence tool
|
|
35
|
+
// // await entryNode.use(new oAddress('o://intelligence'), {
|
|
36
|
+
// // method: 'configure',
|
|
37
|
+
// // params: {
|
|
38
|
+
// // modelProvider: 'anthropic',
|
|
39
|
+
// // hostingProvider: 'olane',
|
|
40
|
+
// // accessToken: 'test',
|
|
41
|
+
// // address: 'o://leader/intelligence',
|
|
42
|
+
// // },
|
|
43
|
+
// // });
|
|
44
|
+
// // console.log('Pinging relay');
|
|
45
|
+
// // await (entryNode.p2pNode.services as any).ping.ping(
|
|
46
|
+
// // multiaddr('/dns4/relay.olane.com/tcp/4000/tls/ws'),
|
|
47
|
+
// // );
|
|
48
|
+
// console.log('Pinged relay');
|
|
49
|
+
// // use the intelligence tool
|
|
50
|
+
// await entryNode.useStream(
|
|
51
|
+
// new oNodeAddress('o://leader', [new oNodeTransport('/ip4/127.0.0.1/tcp/4000/ws/p2p/12D3KooWPHdsHhEdyBd9DS2zHJ1vRSyqSkZ97iT7F8ByYJ7U7bw8')]),
|
|
90
52
|
// {
|
|
91
53
|
// method: 'intent',
|
|
92
54
|
// params: {
|
|
93
|
-
//
|
|
55
|
+
// _isStream: true,
|
|
56
|
+
// intent: 'What is the official endpoint for github mcp server?',
|
|
94
57
|
// },
|
|
95
58
|
// },
|
|
96
|
-
// );
|
|
97
|
-
// console.log(response.result.data);
|
|
98
|
-
// });
|
|
99
|
-
// });
|
|
100
|
-
// describe('external-networks', async () => {
|
|
101
|
-
// it('should be able to use an external network', async () => {
|
|
102
|
-
// const network2 = new oNetwork({
|
|
103
|
-
// // configFilePath: path.join(os.homedir(), '.olane', 'config.json'),
|
|
104
|
-
// nodes: [
|
|
105
|
-
// {
|
|
106
|
-
// type: NodeType.LEADER,
|
|
107
|
-
// address: new oAddress('o://leader'),
|
|
108
|
-
// leader: null,
|
|
109
|
-
// parent: null,
|
|
110
|
-
// },
|
|
111
|
-
// {
|
|
112
|
-
// type: NodeType.NODE,
|
|
113
|
-
// address: new oAddress('o://node2'),
|
|
114
|
-
// leader: null,
|
|
115
|
-
// parent: null,
|
|
116
|
-
// },
|
|
117
|
-
// ],
|
|
118
|
-
// plans: [],
|
|
119
|
-
// noIndexNetwork: true,
|
|
120
|
-
// });
|
|
121
|
-
// await network2.start();
|
|
122
|
-
// expect(network2.status).to.equal(NetworkStatus.RUNNING);
|
|
123
|
-
// // let's dial the other network
|
|
124
|
-
// await network2.use(
|
|
125
|
-
// new oAddress('o://leader', [
|
|
126
|
-
// ...(network?.rootLeader?.address.libp2pTransports || []),
|
|
127
|
-
// ]),
|
|
128
59
|
// {
|
|
129
|
-
//
|
|
130
|
-
//
|
|
60
|
+
// onChunk: (chunk) => {
|
|
61
|
+
// console.log(
|
|
62
|
+
// 'Received chunk: ',
|
|
63
|
+
// JSON.stringify(chunk.result.data, null, 2),
|
|
64
|
+
// );
|
|
65
|
+
// },
|
|
131
66
|
// },
|
|
132
67
|
// );
|
|
68
|
+
// // await entryNode.use(
|
|
69
|
+
// // new oNodeAddress('o://intelligence'),
|
|
70
|
+
// // {
|
|
71
|
+
// // method: 'prompt',
|
|
72
|
+
// // params: {
|
|
73
|
+
// // _isStream: true,
|
|
74
|
+
// // prompt: 'What is the capital of France?',
|
|
75
|
+
// // },
|
|
76
|
+
// // },
|
|
77
|
+
// // {
|
|
78
|
+
// // isStream: true,
|
|
79
|
+
// // onChunk: (chunk) => {
|
|
80
|
+
// // console.log('FINAL Received chunk: ', JSON.stringify(chunk, null, 2));
|
|
81
|
+
// // },
|
|
82
|
+
// // },
|
|
83
|
+
// // );
|
|
84
|
+
// // await new Promise((resolve) => setTimeout(resolve, 20_000));
|
|
85
|
+
// });
|
|
86
|
+
// });
|
|
87
|
+
// // describe('olane network usage', async () => {
|
|
88
|
+
// // it('should be able to use the olane network', async () => {
|
|
89
|
+
// // // let's dial the other network
|
|
90
|
+
// // const response = await network.use(
|
|
91
|
+
// // new oAddress('o://leader', [
|
|
92
|
+
// // multiaddr('/dns4/leader.olane.com/tcp/4000/tls/ws'),
|
|
93
|
+
// // ]),
|
|
94
|
+
// // {
|
|
95
|
+
// // method: 'intent',
|
|
96
|
+
// // params: {
|
|
97
|
+
// // intent: 'What can I do?',
|
|
98
|
+
// // },
|
|
99
|
+
// // },
|
|
100
|
+
// // );
|
|
101
|
+
// // console.log(response.result.data);
|
|
102
|
+
// // });
|
|
103
|
+
// // });
|
|
104
|
+
// // describe('external-networks', async () => {
|
|
105
|
+
// // it('should be able to use an external network', async () => {
|
|
106
|
+
// // const network2 = new oNetwork({
|
|
107
|
+
// // // configFilePath: path.join(os.homedir(), '.olane', 'config.json'),
|
|
108
|
+
// // nodes: [
|
|
109
|
+
// // {
|
|
110
|
+
// // type: NodeType.LEADER,
|
|
111
|
+
// // address: new oAddress('o://leader'),
|
|
112
|
+
// // leader: null,
|
|
113
|
+
// // parent: null,
|
|
114
|
+
// // },
|
|
115
|
+
// // {
|
|
116
|
+
// // type: NodeType.NODE,
|
|
117
|
+
// // address: new oAddress('o://node2'),
|
|
118
|
+
// // leader: null,
|
|
119
|
+
// // parent: null,
|
|
120
|
+
// // },
|
|
121
|
+
// // ],
|
|
122
|
+
// // plans: [],
|
|
123
|
+
// // noIndexNetwork: true,
|
|
124
|
+
// // });
|
|
125
|
+
// // await network2.start();
|
|
126
|
+
// // expect(network2.status).to.equal(NetworkStatus.RUNNING);
|
|
127
|
+
// // // let's dial the other network
|
|
128
|
+
// // await network2.use(
|
|
129
|
+
// // new oAddress('o://leader', [
|
|
130
|
+
// // ...(network?.rootLeader?.address.libp2pTransports || []),
|
|
131
|
+
// // ]),
|
|
132
|
+
// // {
|
|
133
|
+
// // method: 'index_network',
|
|
134
|
+
// // params: {},
|
|
135
|
+
// // },
|
|
136
|
+
// // );
|
|
137
|
+
// // });
|
|
138
|
+
// // });
|
|
139
|
+
// describe('basic-usage @stop-network', async () => {
|
|
140
|
+
// it('should be able to stop the network', async () => {
|
|
141
|
+
// await network.stop();
|
|
142
|
+
// expect(network.status).to.equal(OlaneOSSystemStatus.STOPPED);
|
|
133
143
|
// });
|
|
134
144
|
// });
|
|
135
|
-
describe('basic-usage @stop-network', async () => {
|
|
136
|
-
it('should be able to stop the network', async () => {
|
|
137
|
-
await network.stop();
|
|
138
|
-
expect(network.status).to.equal(OlaneOSSystemStatus.STOPPED);
|
|
139
|
-
});
|
|
140
|
-
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playground.spec.d.ts","sourceRoot":"","sources":["../../../test/basic/playground.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { NodeState } from '@olane/o-core';
|
|
2
|
+
import { expect } from 'chai';
|
|
3
|
+
import dotenv from 'dotenv';
|
|
4
|
+
import { defaultOSInstance } from '../utils/os.default.js';
|
|
5
|
+
import { oNodeAddress, oNodeTransport } from '@olane/o-node';
|
|
6
|
+
import { tmpNode } from '../utils/tmp.node.js';
|
|
7
|
+
dotenv.config();
|
|
8
|
+
const network = defaultOSInstance;
|
|
9
|
+
describe('playground running', async () => {
|
|
10
|
+
it('should be able to use stream from a provider service', async () => {
|
|
11
|
+
const entryNode = tmpNode;
|
|
12
|
+
await entryNode.start();
|
|
13
|
+
expect(entryNode).to.exist;
|
|
14
|
+
expect(entryNode.state).to.equal(NodeState.RUNNING);
|
|
15
|
+
console.log('Using intelligence tool');
|
|
16
|
+
const response = await entryNode.useStream(new oNodeAddress('o://leader/auth/services/intelligence', [
|
|
17
|
+
new oNodeTransport('/ip4/127.0.0.1/tcp/4000/ws/p2p/12D3KooWPHdsHhEdyBd9DS2zHJ1vRSyqSkZ97iT7F8ByYJ7U7bw8'),
|
|
18
|
+
]), {
|
|
19
|
+
method: 'prompt',
|
|
20
|
+
params: {
|
|
21
|
+
_isStream: true,
|
|
22
|
+
prompt: 'What is the capital of France?',
|
|
23
|
+
_token: 'test',
|
|
24
|
+
},
|
|
25
|
+
}, {
|
|
26
|
+
onChunk: (chunk) => {
|
|
27
|
+
console.log('Received chunk:', JSON.stringify(chunk.result.data, null, 2));
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
console.log('Response:', response.result.data);
|
|
31
|
+
await entryNode.stop();
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tmp.node.d.ts","sourceRoot":"","sources":["../../../test/utils/tmp.node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,eAAO,MAAM,OAAO,WAKlB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/os",
|
|
3
|
-
"version": "0.7.12-alpha.
|
|
3
|
+
"version": "0.7.12-alpha.29",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -57,21 +57,21 @@
|
|
|
57
57
|
"typescript": "5.4.5"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@olane/o-config": "0.7.12-alpha.
|
|
61
|
-
"@olane/o-core": "0.7.12-alpha.
|
|
62
|
-
"@olane/o-intelligence": "0.7.12-alpha.
|
|
63
|
-
"@olane/o-lane": "0.7.12-alpha.
|
|
64
|
-
"@olane/o-leader": "0.7.12-alpha.
|
|
65
|
-
"@olane/o-protocol": "0.7.12-alpha.
|
|
66
|
-
"@olane/o-storage": "0.7.12-alpha.
|
|
67
|
-
"@olane/o-tool": "0.7.12-alpha.
|
|
68
|
-
"@olane/o-tool-registry": "0.7.12-alpha.
|
|
69
|
-
"@olane/o-tools-common": "0.7.12-alpha.
|
|
60
|
+
"@olane/o-config": "0.7.12-alpha.29",
|
|
61
|
+
"@olane/o-core": "0.7.12-alpha.29",
|
|
62
|
+
"@olane/o-intelligence": "0.7.12-alpha.29",
|
|
63
|
+
"@olane/o-lane": "0.7.12-alpha.29",
|
|
64
|
+
"@olane/o-leader": "0.7.12-alpha.29",
|
|
65
|
+
"@olane/o-protocol": "0.7.12-alpha.29",
|
|
66
|
+
"@olane/o-storage": "0.7.12-alpha.29",
|
|
67
|
+
"@olane/o-tool": "0.7.12-alpha.29",
|
|
68
|
+
"@olane/o-tool-registry": "0.7.12-alpha.29",
|
|
69
|
+
"@olane/o-tools-common": "0.7.12-alpha.29",
|
|
70
70
|
"chalk": "^5.4.1",
|
|
71
71
|
"debug": "^4.4.1",
|
|
72
72
|
"dotenv": "^16.5.0",
|
|
73
73
|
"fs-extra": "^11.3.0",
|
|
74
74
|
"touch": "^3.1.1"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "b8c692a1b5ef2d0e974ccfe501841be852b17dbc"
|
|
77
77
|
}
|