@olane/o-storage 0.6.1

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.
Files changed (68) hide show
  1. package/README.md +86 -0
  2. package/dist/src/index.d.ts +5 -0
  3. package/dist/src/index.d.ts.map +1 -0
  4. package/dist/src/index.js +4 -0
  5. package/dist/src/interfaces/get-data.response.d.ts +4 -0
  6. package/dist/src/interfaces/get-data.response.d.ts.map +1 -0
  7. package/dist/src/interfaces/get-data.response.js +1 -0
  8. package/dist/src/interfaces/index.d.ts +6 -0
  9. package/dist/src/interfaces/index.d.ts.map +1 -0
  10. package/dist/src/interfaces/index.js +5 -0
  11. package/dist/src/interfaces/placeholder-put.request.d.ts +17 -0
  12. package/dist/src/interfaces/placeholder-put.request.d.ts.map +1 -0
  13. package/dist/src/interfaces/placeholder-put.request.js +7 -0
  14. package/dist/src/interfaces/placeholder-put.response.d.ts +8 -0
  15. package/dist/src/interfaces/placeholder-put.response.d.ts.map +1 -0
  16. package/dist/src/interfaces/placeholder-put.response.js +1 -0
  17. package/dist/src/interfaces/placeholder-value.interface.d.ts +6 -0
  18. package/dist/src/interfaces/placeholder-value.interface.d.ts.map +1 -0
  19. package/dist/src/interfaces/placeholder-value.interface.js +1 -0
  20. package/dist/src/interfaces/put.request.d.ts +16 -0
  21. package/dist/src/interfaces/put.request.d.ts.map +1 -0
  22. package/dist/src/interfaces/put.request.js +7 -0
  23. package/dist/src/methods/placeholder-storage.methods.d.ts +5 -0
  24. package/dist/src/methods/placeholder-storage.methods.d.ts.map +1 -0
  25. package/dist/src/methods/placeholder-storage.methods.js +32 -0
  26. package/dist/src/methods/storage.methods.d.ts +5 -0
  27. package/dist/src/methods/storage.methods.d.ts.map +1 -0
  28. package/dist/src/methods/storage.methods.js +65 -0
  29. package/dist/src/placeholder.tool.d.ts +10 -0
  30. package/dist/src/placeholder.tool.d.ts.map +1 -0
  31. package/dist/src/placeholder.tool.js +76 -0
  32. package/dist/src/providers/dht-storage-provider.tool.d.ts +12 -0
  33. package/dist/src/providers/dht-storage-provider.tool.d.ts.map +1 -0
  34. package/dist/src/providers/dht-storage-provider.tool.js +25 -0
  35. package/dist/src/providers/disk-storage-provider.tool.d.ts +45 -0
  36. package/dist/src/providers/disk-storage-provider.tool.d.ts.map +1 -0
  37. package/dist/src/providers/disk-storage-provider.tool.js +134 -0
  38. package/dist/src/providers/encrypted-storage-provider.tool.d.ts +1 -0
  39. package/dist/src/providers/encrypted-storage-provider.tool.d.ts.map +1 -0
  40. package/dist/src/providers/encrypted-storage-provider.tool.js +63 -0
  41. package/dist/src/providers/index.d.ts +6 -0
  42. package/dist/src/providers/index.d.ts.map +1 -0
  43. package/dist/src/providers/index.js +5 -0
  44. package/dist/src/providers/memory-storage-provider.tool.d.ts +32 -0
  45. package/dist/src/providers/memory-storage-provider.tool.d.ts.map +1 -0
  46. package/dist/src/providers/memory-storage-provider.tool.js +65 -0
  47. package/dist/src/providers/secure-storage-provider.tool.d.ts +25 -0
  48. package/dist/src/providers/secure-storage-provider.tool.d.ts.map +1 -0
  49. package/dist/src/providers/secure-storage-provider.tool.js +72 -0
  50. package/dist/src/providers/storage-provider.tool.d.ts +12 -0
  51. package/dist/src/providers/storage-provider.tool.d.ts.map +1 -0
  52. package/dist/src/providers/storage-provider.tool.js +41 -0
  53. package/dist/src/resolvers/placeholder.resolver.d.ts +6 -0
  54. package/dist/src/resolvers/placeholder.resolver.d.ts.map +1 -0
  55. package/dist/src/resolvers/placeholder.resolver.js +10 -0
  56. package/dist/src/storage.tool.d.ts +12 -0
  57. package/dist/src/storage.tool.d.ts.map +1 -0
  58. package/dist/src/storage.tool.js +46 -0
  59. package/dist/test/basic.spec.d.ts +1 -0
  60. package/dist/test/basic.spec.d.ts.map +1 -0
  61. package/dist/test/basic.spec.js +1 -0
  62. package/dist/test/data/bigfile.d.ts +2 -0
  63. package/dist/test/data/bigfile.d.ts.map +1 -0
  64. package/dist/test/data/bigfile.js +174 -0
  65. package/dist/test/placeholder.spec.d.ts +2 -0
  66. package/dist/test/placeholder.spec.d.ts.map +1 -0
  67. package/dist/test/placeholder.spec.js +61 -0
  68. package/package.json +72 -0
@@ -0,0 +1,174 @@
1
+ export const bigfile = `
2
+ # 🌊 O-Core: The Future of Distributed AI is Here
3
+
4
+ [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
5
+ [![npm version](https://badge.fury.io/js/%40olane%2Fo-core.svg)](https://badge.fury.io/js/%40olane%2Fo-core)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
7
+
8
+ > **Imagine AI agents that think, plan, and collaborate across a peer-to-peer network—without central servers, without vendor lock-in, without limits.**
9
+
10
+ O-Core is the foundation for building **decentralized AI networks** where LLM agents operate as autonomous peers, discovering and collaborating with each other to solve complex problems.
11
+
12
+ ## 🚀 Why O-Core Will Change Everything
13
+
14
+ ### 🌐 **True Decentralization**
15
+ - **No Single Point of Failure**: Your AI network runs across distributed nodes
16
+ - **Peer Discovery**: Nodes automatically find and connect to each other via libp2p
17
+ - **Network Resilience**: If one node goes down, others seamlessly take over
18
+
19
+ ### 🧠 **Intelligent Agent Orchestration**
20
+ - **AI Planning Engine**: Agents autonomously plan multi-step tasks
21
+ - **Context-Aware Routing**: Smart request routing based on capabilities
22
+ - **Self-Organizing Networks**: Nodes discover optimal collaboration patterns
23
+
24
+ ### ⚡ **Production-Ready Architecture**
25
+ - **Built on libp2p**: Battle-tested P2P networking foundation
26
+ - **TypeScript First**: Type-safe development with excellent IDE support
27
+ - **Metrics & Monitoring**: Built-in Prometheus metrics for observability
28
+
29
+ ---
30
+
31
+ ## 🎯 Core Features
32
+
33
+ ### 🤖 **Autonomous AI Agents**
34
+
35
+
36
+ ### 🎛️ **Flexible Node Types**
37
+ - **Host Nodes**: Full P2P nodes accessible via TCP/IP
38
+ - **Virtual Nodes**: Lightweight in-memory nodes for local processing
39
+ - **Hybrid Networks**: Mix node types for optimal performance
40
+
41
+ ### 🔍 **Intelligent Tool Discovery**
42
+
43
+
44
+ ---
45
+
46
+ ## 🌟 Real-World Applications
47
+
48
+ ### 🏢 **Enterprise AI Mesh**
49
+ Deploy AI capabilities across your infrastructure where each service becomes an intelligent agent:
50
+ - Customer service bots that collaborate with analytics agents
51
+ - Content generation that works with fact-checking services
52
+ - Automated workflows that span multiple departments
53
+
54
+ ### 🏠 **Personal AI Networks**
55
+ Build your own private AI ecosystem:
56
+ - Home automation agents that learn your preferences
57
+ - Personal assistants that coordinate across devices
58
+ - Local-first AI that never leaves your network
59
+
60
+ ### 🌍 **Community AI Commons**
61
+ Participate in shared intelligence networks:
62
+ - Researchers sharing specialized AI models
63
+ - Open-source AI tools that anyone can contribute to
64
+ - Collaborative problem-solving at scale
65
+
66
+ ---
67
+
68
+ ## 🚀 Quick Start
69
+
70
+
71
+
72
+ ### Create Your First AI Node
73
+
74
+
75
+ ### Make Your First AI Plan
76
+
77
+
78
+ ---
79
+
80
+ ## 🏗️ Architecture Deep Dive
81
+
82
+ ### 🔗 **Peer-to-Peer Foundation**
83
+ Built on **libp2p**, the same networking stack that powers IPFS and Ethereum 2.0:
84
+ - **Content addressing** for deterministic routing
85
+ - **NAT traversal** for real-world connectivity
86
+ - **Pluggable transports** (TCP, WebRTC, WebSockets)
87
+
88
+ ### 🧠 **AI Planning Layer**
89
+ Smart agents that can:
90
+ - **Analyze intent** and break down complex requests
91
+ - **Discover tools** across the network automatically
92
+ - **Execute multi-step plans** with error recovery
93
+ - **Learn from interactions** via vector storage
94
+
95
+ ### 🎛️ **Flexible Deployment**
96
+ - **Docker-ready** with Kubernetes charts
97
+ - **Cloud-agnostic** - runs anywhere
98
+ - **Resource-aware** scaling and discovery
99
+
100
+ ---
101
+
102
+ ## 🛠️ Advanced Usage
103
+
104
+ ### Custom Agent Prompts
105
+
106
+
107
+ ### Network Metrics & Monitoring
108
+
109
+ // Built-in Prometheus metrics
110
+ const metrics = node.p2pNode.metrics;
111
+ console.log('Active connections:', metrics.getConnectionCount());
112
+ console.log('Tool execution success rate:', node.successCount / (node.successCount + node.errorCount));
113
+
114
+
115
+ ---
116
+
117
+ ## 🤝 Join the Revolution
118
+
119
+ ### 🌟 **For Developers**
120
+ - **Contribute tools** to the global AI network
121
+ - **Build specialized agents** for your domain
122
+ - **Extend the protocol** with new capabilities
123
+
124
+ ### 🏢 **For Enterprises**
125
+ - **Deploy private AI networks** with zero vendor lock-in
126
+ - **Scale AI horizontally** across your infrastructure
127
+ - **Maintain data sovereignty** while leveraging collective intelligence
128
+
129
+ ### 🎓 **For Researchers**
130
+ - **Experiment with distributed AI** at scale
131
+ - **Share models and tools** with the community
132
+ - **Study emergent behaviors** in AI networks
133
+
134
+ ---
135
+
136
+ ## 📖 Documentation & Resources
137
+
138
+ - **[API Documentation](https://olane-labs.github.io/o-core)**
139
+ - **[Architecture Guide](./docs/ARCHITECTURE.md)**
140
+ - **[Deployment Examples](./examples/)**
141
+ - **[Contributing Guidelines](./CONTRIBUTING.md)**
142
+
143
+ ---
144
+
145
+ ## 🎯 Roadmap
146
+
147
+ - **Q1 2024**: WebRTC support for browser nodes
148
+ - **Q2 2024**: Built-in model serving capabilities
149
+ - **Q3 2024**: Advanced consensus mechanisms
150
+ - **Q4 2024**: Cross-network protocol bridges
151
+
152
+ ---
153
+
154
+ ## 💫 The Future is Distributed
155
+
156
+ O-Core isn't just another AI framework—it's the foundation for an **Internet of Intelligence** where AI agents collaborate as naturally as humans do, but at the speed of light and the scale of the internet.
157
+
158
+ **Ready to build the future?**
159
+
160
+
161
+ **Join our community:**
162
+ - 🐦 [Twitter/X](https://twitter.com/olane_labs)
163
+ - 💬 [Discord](https://discord.gg/olane)
164
+ - 📧 [Newsletter](https://olane.com/newsletter)
165
+
166
+ ---
167
+
168
+ <div align="center">
169
+
170
+ **Made with 🌊 by the oLane Team**
171
+
172
+ *Democratizing AI, one node at a time.*
173
+
174
+ </div>`;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=placeholder.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeholder.spec.d.ts","sourceRoot":"","sources":["../../test/placeholder.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,61 @@
1
+ import { NodeState, oAddress } from '@olane/o-core';
2
+ import { expect } from 'chai';
3
+ import { oLeaderNode, RegistryMemoryTool } from '@olane/o-leader';
4
+ import { IntelligenceTool } from '@olane/o-intelligence';
5
+ import { StorageTool } from '../src/index.js';
6
+ import { bigfile } from './data/bigfile.js';
7
+ import { oVirtualTool } from '@olane/o-tool';
8
+ import dotenv from 'dotenv';
9
+ dotenv.config();
10
+ const leader = new oLeaderNode({
11
+ parent: null,
12
+ leader: null,
13
+ });
14
+ const node = new oVirtualTool({
15
+ parent: null,
16
+ leader: null,
17
+ address: new oAddress('o://node'),
18
+ });
19
+ leader.addChildNode(node);
20
+ describe('o-storage @placeholder', () => {
21
+ it('should be able to start a node', async () => {
22
+ const registryTool = new RegistryMemoryTool({
23
+ parent: leader.address,
24
+ leader: leader.address,
25
+ });
26
+ leader.addChildNode(registryTool);
27
+ const intelligenceTool = new IntelligenceTool({
28
+ parent: node.address,
29
+ leader: node.address,
30
+ });
31
+ leader.addChildNode(intelligenceTool);
32
+ const storageTool = new StorageTool({
33
+ parent: node.address,
34
+ leader: node.address,
35
+ });
36
+ leader.addChildNode(storageTool);
37
+ await leader.start();
38
+ expect(intelligenceTool.state).to.equal(NodeState.RUNNING);
39
+ });
40
+ it('should be able to perform a put', async () => {
41
+ const result = await leader.use(new oAddress('o://leader/storage/placeholder'), {
42
+ method: 'put',
43
+ params: {
44
+ key: 'test-key-1234',
45
+ value: bigfile,
46
+ intent: 'I want to copy file "bigfile.txt" to "bigfile.txt.copy"',
47
+ },
48
+ });
49
+ console.log(result.result.data);
50
+ });
51
+ it('should be able to perform a get', async () => {
52
+ const result = await leader.use(new oAddress('o://leader/storage/placeholder/test-key-1234'));
53
+ const data = result.result.data;
54
+ expect(data.value.length > 0).to.be.true;
55
+ });
56
+ it('should be able to perform an explicit get', async () => {
57
+ const result = await leader.use(new oAddress('o://leader/storage/placeholder/test-key-1234/get'));
58
+ const data = result.result.data;
59
+ expect(data.value.length > 0).to.be.true;
60
+ });
61
+ });
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "@olane/o-storage",
3
+ "version": "0.6.1",
4
+ "type": "module",
5
+ "main": "dist/src/index.js",
6
+ "types": "dist/src/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/src/index.d.ts",
10
+ "default": "./dist/src/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist/**/*",
15
+ "README.md",
16
+ "LICENSE"
17
+ ],
18
+ "scripts": {
19
+ "test": "aegir test",
20
+ "test:node": "aegir test -t node",
21
+ "test:browser": "aegir test -t browser",
22
+ "dev": "DEBUG=o-protocol:* npx tsx src/tests/index.ts",
23
+ "build": "tsc",
24
+ "deep:clean": "rm -rf node_modules && rm package-lock.json",
25
+ "start:prod": "node dist/index.js",
26
+ "prepublishOnly": "npm run build",
27
+ "update:lib": "npm install @olane/o-core@latest",
28
+ "lint": "eslint src/**/*.ts"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/olane-labs/olane.git"
33
+ },
34
+ "author": "oLane Inc.",
35
+ "license": "ISC",
36
+ "description": "oLane storage tool",
37
+ "devDependencies": {
38
+ "@olane/o-config": "file:../o-config",
39
+ "@olane/o-core": "file:../..",
40
+ "@olane/o-protocol": "file:../o-protocol",
41
+ "@olane/o-tool": "file:../o-tool",
42
+ "@olane/o-leader": "file:../o-leader",
43
+ "@olane/o-intelligence": "file:../o-intelligence",
44
+ "@eslint/eslintrc": "^3.3.1",
45
+ "@eslint/js": "^9.29.0",
46
+ "@tsconfig/node20": "^20.1.6",
47
+ "@types/jest": "^30.0.0",
48
+ "@typescript-eslint/eslint-plugin": "^8.34.1",
49
+ "@typescript-eslint/parser": "^8.34.1",
50
+ "eslint": "^9.29.0",
51
+ "eslint-config-prettier": "^10.1.6",
52
+ "eslint-plugin-prettier": "^5.5.0",
53
+ "globals": "^16.2.0",
54
+ "jest": "^30.0.0",
55
+ "prettier": "^3.5.3",
56
+ "ts-jest": "^29.4.0",
57
+ "ts-node": "^10.9.2",
58
+ "tsconfig-paths": "^4.2.0",
59
+ "tsx": "^4.20.3",
60
+ "typescript": "5.4.5"
61
+ },
62
+ "peerDependencies": {
63
+ "@olane/o-config": "^0.6.1",
64
+ "@olane/o-core": "^0.6.1",
65
+ "@olane/o-protocol": "^0.6.1",
66
+ "@olane/o-tool": "^0.6.1"
67
+ },
68
+ "dependencies": {
69
+ "debug": "^4.4.1",
70
+ "dotenv": "^16.5.0"
71
+ }
72
+ }