@olane/o-protocol 0.8.2 → 0.8.4

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 (3) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +279 -14
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## <small>0.8.4 (2026-02-18)</small>
7
+
8
+ - updated docs ([3cc950f](https://github.com/olane-labs/olane/commit/3cc950f))
9
+
10
+ ## <small>0.8.3 (2026-02-11)</small>
11
+
12
+ **Note:** Version bump only for package @olane/o-protocol
13
+
6
14
  ## <small>0.8.2 (2026-02-10)</small>
7
15
 
8
16
  **Note:** Version bump only for package @olane/o-protocol
package/README.md CHANGED
@@ -1,24 +1,289 @@
1
- # o-protocol
1
+ # @olane/o-protocol
2
2
 
3
- A protocol designed for complex communication with anything
3
+ Protocol specification and type definitions for the Olane network.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @olane/o-protocol
9
+ ```
4
10
 
5
11
  ## Overview
6
- The o-network addressing system provides a hierarchical, federated approach to AI agent communication across distributed networks. This protocol enables AI agents to discover, access, and interact with tools and services through a simple yet powerful addressing scheme that scales from individual consumer networks to enterprise provider networks.
12
+
13
+ The o-protocol defines the communication layer for AI agent interaction across distributed networks. It provides the type system, addressing scheme, JSON-RPC message format, method definitions, and routing interfaces that all Olane nodes use to discover, register, and communicate with each other.
7
14
 
8
15
  ## Key Features
9
- - Hierarchical P2P Network Structure - The primary use case is for resolving addresses within the o-network, a hierarchical federated network of p2p nodes [link to o-network README.md]
10
- - Universal Address Format - Example: o://network_name/node_group_name/node_name/node_tool/node_tool_method
11
- - Middleware-Enabled Routing - Each term within the address represents a p2p node that contains its own functionality that can be leveraged as middleware on its route to the destination leaf node
12
- - AI-Native Workflow Language - This simplistic address structure allows AI to create a common language for workflow structures which can be shared
13
- - Composable Plans - Combining multiple addresses is also possible resulting in Plans [link to plans README.md], which are also addressable and shareable too
14
- - Self-Improving Intelligence - As AI Agents think about how to accomplish a task within the context of an o-network, failure and success alike become context for how to achieve a better solution or resolve a previous failure
15
16
 
17
+ - **Hierarchical P2P Network Structure** - Resolves addresses within the o-network, a hierarchical federated network of p2p nodes
18
+ - **Universal Address Format** - `o://network_name/node_group_name/node_name/node_tool/node_tool_method`
19
+ - **Middleware-Enabled Routing** - Each term within the address represents a p2p node that contains its own functionality that can be leveraged as middleware on its route to the destination leaf node
20
+ - **JSON-RPC 2.0 Messaging** - Standard request/response protocol with typed error codes
21
+ - **AI-Native Method Discovery** - Rich method definitions with parameters, examples, approval metadata, and performance hints for AI agent consumption
22
+
23
+ ## Usage
24
+
25
+ ### Defining Methods and Parameters
26
+
27
+ Methods describe the capabilities a node exposes. Each method includes typed parameters, descriptions for AI discovery, and optional metadata for approval, performance, and error handling.
28
+
29
+ ```typescript
30
+ import { oMethod, oParameter } from '@olane/o-protocol';
31
+
32
+ const parameters: oParameter[] = [
33
+ {
34
+ name: 'customerId',
35
+ type: 'string',
36
+ description: 'Unique customer identifier (UUID)',
37
+ required: true,
38
+ exampleValues: ['cust_abc123'],
39
+ },
40
+ {
41
+ name: 'includeHistory',
42
+ type: 'boolean',
43
+ description: 'Include purchase history in the response',
44
+ required: false,
45
+ defaultValue: false,
46
+ },
47
+ {
48
+ name: 'status',
49
+ type: 'string',
50
+ description: 'Filter by account status',
51
+ required: false,
52
+ structure: { enum: ['active', 'inactive', 'suspended'] },
53
+ },
54
+ ];
55
+
56
+ const methods: Record<string, oMethod> = {
57
+ get_customer: {
58
+ name: 'get_customer',
59
+ description: 'Retrieves customer information by ID.',
60
+ parameters,
61
+ dependencies: [],
62
+ requiresApproval: false,
63
+ examples: [
64
+ {
65
+ description: 'Fetch a customer by ID',
66
+ intent: 'Get customer details for cust_abc123',
67
+ params: { customerId: 'cust_abc123' },
68
+ expectedResult: { id: 'cust_abc123', name: 'Alice' },
69
+ },
70
+ ],
71
+ commonErrors: [
72
+ {
73
+ errorCode: 'CUSTOMER_NOT_FOUND',
74
+ message: 'No customer exists with the given ID',
75
+ causes: ['Invalid or expired customer ID'],
76
+ remediation: 'Verify the customer ID and try again',
77
+ },
78
+ ],
79
+ performance: {
80
+ estimatedDuration: 200,
81
+ cacheable: true,
82
+ cacheKey: ['customerId'],
83
+ idempotent: true,
84
+ },
85
+ },
86
+ };
87
+ ```
88
+
89
+ ### Working with JSON-RPC Messages
90
+
91
+ All Olane communication uses JSON-RPC 2.0. The protocol exports request, response, and error types along with standard error codes.
92
+
93
+ ```typescript
94
+ import {
95
+ JSONRPC_VERSION,
96
+ JSONRPCRequest,
97
+ JSONRPCResponse,
98
+ JSONRPCError,
99
+ PARSE_ERROR,
100
+ INVALID_REQUEST,
101
+ METHOD_NOT_FOUND,
102
+ INVALID_PARAMS,
103
+ INTERNAL_ERROR,
104
+ oRequest,
105
+ oResponse,
106
+ } from '@olane/o-protocol';
107
+
108
+ // oRequest and oResponse are aliases for JSONRPCRequest and JSONRPCResponse
109
+ const request: oRequest = {
110
+ jsonrpc: JSONRPC_VERSION,
111
+ id: 'req-1',
112
+ method: 'get_customer',
113
+ params: {
114
+ _connectionId: 'conn-1',
115
+ _requestMethod: 'get_customer',
116
+ customerId: 'cust_abc123',
117
+ },
118
+ };
119
+ ```
120
+
121
+ ### Protocol Methods Enum
122
+
123
+ Built-in protocol methods used for node lifecycle operations:
124
+
125
+ ```typescript
126
+ import { oProtocolMethods } from '@olane/o-protocol';
127
+
128
+ // oProtocolMethods.HANDSHAKE = "handshake"
129
+ // oProtocolMethods.REGISTER = "register"
130
+ // oProtocolMethods.ROUTE = "route"
131
+ // oProtocolMethods.INDEX_NETWORK = "index_network"
132
+ // oProtocolMethods.INTENT = "intent"
133
+ // oProtocolMethods.INTENT_METHOD_CONFIGURATION = "intent_method_configuration"
134
+ ```
135
+
136
+ ## API Reference
137
+
138
+ ### oAddress
139
+
140
+ Defines the transport and protocol for a node address.
141
+
142
+ ```typescript
143
+ interface oAddress {
144
+ transports: string[];
145
+ protocol: string;
146
+ }
147
+ ```
148
+
149
+ ### oMethod
150
+
151
+ Describes a callable method on a node, including everything an AI agent needs for discovery and invocation.
152
+
153
+ ```typescript
154
+ interface oMethod {
155
+ name: string; // Method identifier
156
+ description: string; // Human/AI-readable description
157
+ parameters: oParameter[]; // Input parameters
158
+ dependencies: oDependency[]; // External node dependencies
159
+ requiresApproval?: boolean; // Whether human approval is needed
160
+ approvalMetadata?: oApprovalMetadata; // Risk level, category, auto-approve rules
161
+ examples?: oMethodExample[]; // Example invocations with expected results
162
+ commonErrors?: oCommonError[]; // Known failure modes and remediation
163
+ performance?: oPerformanceMetadata; // Timing, caching, batching hints
164
+ successCriteria?: string; // What constitutes a successful call
165
+ suggestedContext?: string[]; // Recommended context for the AI agent
166
+ similarMethods?: string[]; // Related methods for discovery
167
+ }
168
+ ```
169
+
170
+ ### oParameter
171
+
172
+ Defines a single input parameter for a method.
173
+
174
+ ```typescript
175
+ interface oParameter {
176
+ name: string; // Parameter name
177
+ type: string; // Type: "string", "number", "boolean", "array", "object"
178
+ value?: any; // Pre-set value (if fixed)
179
+ description?: string; // Human/AI-readable description
180
+ required?: boolean; // Whether the parameter is required
181
+ options?: any[]; // Allowed values (legacy, prefer structure.enum)
182
+ structure?: oParameterStructure; // Nested structure, constraints, enums
183
+ schema?: any; // JSON Schema for complex validation
184
+ defaultValue?: any; // Default if not provided
185
+ exampleValues?: any[]; // Example values for AI agents
186
+ validationRules?: string[]; // Validation rule descriptions
187
+ }
188
+
189
+ interface oParameterStructure {
190
+ objectProperties?: Record<string, oParameter>; // Properties for object types
191
+ arrayItems?: oParameter; // Item type for array types
192
+ enum?: any[]; // Allowed values
193
+ pattern?: string; // Regex pattern for strings
194
+ minimum?: number; // Minimum for numbers
195
+ maximum?: number; // Maximum for numbers
196
+ minLength?: number; // Min length for strings/arrays
197
+ maxLength?: number; // Max length for strings/arrays
198
+ }
199
+ ```
200
+
201
+ ### oDependency
202
+
203
+ Declares a dependency on another node in the network.
204
+
205
+ ```typescript
206
+ interface oDependency {
207
+ address: string; // o:// address of the dependency
208
+ version?: string; // Required version
209
+ method?: string; // Specific method required
210
+ parameters?: oParameter[]; // Parameters to pass
211
+ }
212
+ ```
213
+
214
+ ### JSON-RPC Types
215
+
216
+ | Type | Description |
217
+ |------|-------------|
218
+ | `JSONRPCRequest` | A request that expects a response (`jsonrpc`, `id`, `method`, `params`) |
219
+ | `JSONRPCResponse` | A successful response (`jsonrpc`, `id`, `result`) |
220
+ | `JSONRPCError` | An error response (`jsonrpc`, `id`, `error: { code, message, data? }`) |
221
+ | `JSONRPCNotification` | A notification that does not expect a response |
222
+ | `oRequest` | Alias for `JSONRPCRequest` |
223
+ | `oResponse` | Alias for `JSONRPCResponse` |
224
+ | `RequestId` | `string \| number` |
225
+
226
+ ### Standard Error Codes
227
+
228
+ | Constant | Value | Meaning |
229
+ |----------|-------|---------|
230
+ | `PARSE_ERROR` | -32700 | Invalid JSON received |
231
+ | `INVALID_REQUEST` | -32600 | JSON is not a valid request object |
232
+ | `METHOD_NOT_FOUND` | -32601 | Method does not exist |
233
+ | `INVALID_PARAMS` | -32602 | Invalid method parameters |
234
+ | `INTERNAL_ERROR` | -32603 | Internal server error |
235
+
236
+ ### Approval Metadata
237
+
238
+ Methods that perform sensitive operations can declare approval requirements:
239
+
240
+ ```typescript
241
+ interface oApprovalMetadata {
242
+ riskLevel?: 'low' | 'medium' | 'high' | 'critical';
243
+ category?: 'read' | 'write' | 'destructive' | 'network' | 'system';
244
+ description?: string;
245
+ autoApproveConditions?: {
246
+ parameterConstraints?: Record<string, any>;
247
+ contextRequirements?: string[];
248
+ userRoles?: string[];
249
+ };
250
+ denialReasons?: string[];
251
+ alternativeMethods?: string[];
252
+ }
253
+ ```
254
+
255
+ ### Performance Metadata
256
+
257
+ Hints for AI agents and the runtime about method behavior:
258
+
259
+ ```typescript
260
+ interface oPerformanceMetadata {
261
+ estimatedDuration?: number; // Expected duration in ms
262
+ maxDuration?: number; // Timeout threshold in ms
263
+ cacheable?: boolean; // Whether results can be cached
264
+ cacheKey?: string[]; // Parameter names that form the cache key
265
+ idempotent?: boolean; // Safe to retry
266
+ supportsBatching?: boolean; // Can process multiple inputs
267
+ batchSizeLimit?: number; // Max batch size
268
+ supportsStreaming?: boolean; // Supports streaming responses
269
+ }
270
+ ```
271
+
272
+ ### Registration and Routing
273
+
274
+ Used internally by the node lifecycle for network registration and message routing:
275
+
276
+ - **`oRegisterRequest`** - Request to register a node with `transports`, `peerId`, `address`, `protocols`, and optional `ttl`
277
+ - **`oRouterRequestInterface`** - Request to route a message to an `address` with a `payload`
278
+ - **`oHandshakeRequest` / `oHandshakeResponse`** - Initial capability exchange between nodes
16
279
 
17
- The addressing protocol transforms simple intents into executable plans, automatically caching successful workflows for future use and creating an evolving intelligence layer that improves over time.
280
+ ### Config
18
281
 
19
- ## Action Complete & Deterministic Outcomes
282
+ ```typescript
283
+ import { LATEST_PROTOCOL_VERSION } from '@olane/o-protocol';
284
+ // LATEST_PROTOCOL_VERSION = '1.0.0'
285
+ ```
20
286
 
21
- ### Hyper-Personalization
287
+ ## License
22
288
 
23
- ## Why Build This?
24
- The current internet evolved around a world that lacked intelligence as a service, resulting in static workflows masqueraded as APIs or websites. With the advent of LLMs, the world is quickly adapting and in dire need of an infrastructure that can match this new dynamic / fluid system.
289
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olane/o-protocol",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "oLane Protocol specification and protocol schema",
5
5
  "license": "MIT",
6
6
  "author": "oLane Inc. (https://olane.com)",
@@ -53,5 +53,5 @@
53
53
  "typescript": "^5.6.2",
54
54
  "typescript-json-schema": "^0.65.1"
55
55
  },
56
- "gitHead": "9e35c874d849d051bcffe483fd2a8c2b3ecf68cc"
56
+ "gitHead": "b53623b1ad4365133911722f80d5597a72b65bf2"
57
57
  }