@olane/o-lane 0.8.3 → 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.
package/README.md CHANGED
@@ -76,6 +76,39 @@ console.log(response.result.data);
76
76
  // }
77
77
  ```
78
78
 
79
+ ### Response Structure
80
+
81
+ When calling `use()` on a lane-enabled tool, responses follow the standard O-Network wrapping structure:
82
+
83
+ ```typescript
84
+ // Response from use() follows this structure:
85
+ // {
86
+ // jsonrpc: "2.0",
87
+ // id: "request-id",
88
+ // result: {
89
+ // success: boolean, // Whether the operation succeeded
90
+ // data: any, // The returned data (on success)
91
+ // error?: string // Error details (on failure)
92
+ // }
93
+ // }
94
+
95
+ const response = await agent.use(agent.address, {
96
+ method: 'intent',
97
+ params: { intent: 'Analyze sales data' }
98
+ });
99
+
100
+ // Always check response.result.success before accessing data
101
+ if (response.result.success) {
102
+ const data = response.result.data;
103
+ console.log('Result:', data.result);
104
+ console.log('Cycles:', data.cycles);
105
+ } else {
106
+ console.error('Error:', response.result.error);
107
+ }
108
+ ```
109
+
110
+ > **Important**: Access data via `response.result.data`, not `response.data` directly. The `result` object contains the wrapping fields (`success`, `data`, `error`).
111
+
79
112
  ### Expected Output
80
113
 
81
114
  After executing an intent, you'll receive:
@@ -338,6 +371,8 @@ import { oCapabilityEvaluate } from '@olane/o-lane';
338
371
 
339
372
  **When Used**: Agent needs to call a tool (API, database, computation, etc.)
340
373
 
374
+ > **Note**: `oCapabilityExecute` is exported directly from `@olane/o-lane` and can be imported alongside other lane primitives.
375
+
341
376
  ```typescript
342
377
  import { oCapabilityExecute } from '@olane/o-lane';
343
378
 
@@ -696,7 +731,7 @@ Result object returned by capabilities.
696
731
  import { oCapabilityResult, oCapabilityType } from '@olane/o-lane';
697
732
 
698
733
  const result = new oCapabilityResult({
699
- type: oCapabilityType.TASK,
734
+ type: oCapabilityType.EXECUTE,
700
735
  result: { data: 'success' },
701
736
  config: { /* next capability config */ },
702
737
  error: undefined
@@ -733,11 +768,11 @@ enum oLaneStatus {
733
768
 
734
769
  ```typescript
735
770
  enum oCapabilityType {
736
- TASK = 'task',
771
+ TASK = 'task', // Legacy alias - prefer EXECUTE for new code
737
772
  SEARCH = 'search',
738
773
  MULTIPLE_STEP = 'multiple_step',
739
774
  CONFIGURE = 'configure',
740
- EXECUTE = 'execute',
775
+ EXECUTE = 'execute', // Primary type for executing tool methods
741
776
  HANDSHAKE = 'handshake',
742
777
  EVALUATE = 'evaluate',
743
778
  STOP = 'stop',
@@ -745,6 +780,8 @@ enum oCapabilityType {
745
780
  }
746
781
  ```
747
782
 
783
+ > **Note on TASK vs EXECUTE**: `TASK` is a legacy capability type that predates `EXECUTE`. For new code, prefer using `oCapabilityType.EXECUTE` which maps to the `oCapabilityExecute` capability class. Both exist in the enum for backward compatibility.
784
+
748
785
  ## Examples
749
786
 
750
787
  ### Basic Intent Resolution
@@ -1253,9 +1290,9 @@ describe('Lane Execution', () => {
1253
1290
  import { oCapability, oCapabilityResult, oCapabilityType } from '@olane/o-lane';
1254
1291
 
1255
1292
  // Create mock capability for testing
1256
- class MockTaskCapability extends oCapability {
1293
+ class MockExecuteCapability extends oCapability {
1257
1294
  get type() {
1258
- return oCapabilityType.TASK;
1295
+ return oCapabilityType.EXECUTE;
1259
1296
  }
1260
1297
 
1261
1298
  async run(): Promise<oCapabilityResult> {
@@ -1271,7 +1308,7 @@ class MockTaskCapability extends oCapability {
1271
1308
  it('should use mock capabilities', async () => {
1272
1309
  const mockCapabilities = [
1273
1310
  new oCapabilityEvaluate(),
1274
- new MockTaskCapability()
1311
+ new MockExecuteCapability()
1275
1312
  ];
1276
1313
 
1277
1314
  const lane = await manager.createLane({
@@ -7,6 +7,7 @@ export * from './o-lane.tool.js';
7
7
  export * from './capabilities/index.js';
8
8
  export * from './intent/index.js';
9
9
  export * from './capabilities-all/o-capability.all.js';
10
+ export * from './capabilities-execute/execute.capability.js';
10
11
  export * from './capabilities-evaluate/o-capability.evaluate.js';
11
12
  export * from './capabilities-multiple-step/o-capability.multiple-step.js';
12
13
  export * from './capabilities-search/o-capability.search.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wCAAwC,CAAC;AACvD,cAAc,kDAAkD,CAAC;AACjE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,8CAA8C,CAAC;AAC7D,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wCAAwC,CAAC;AACvD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,kDAAkD,CAAC;AACjE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,8CAA8C,CAAC;AAC7D,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC"}
package/dist/src/index.js CHANGED
@@ -7,6 +7,7 @@ export * from './o-lane.tool.js';
7
7
  export * from './capabilities/index.js';
8
8
  export * from './intent/index.js';
9
9
  export * from './capabilities-all/o-capability.all.js';
10
+ export * from './capabilities-execute/execute.capability.js';
10
11
  export * from './capabilities-evaluate/o-capability.evaluate.js';
11
12
  export * from './capabilities-multiple-step/o-capability.multiple-step.js';
12
13
  export * from './capabilities-search/o-capability.search.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olane/o-lane",
3
- "version": "0.8.3",
3
+ "version": "0.8.4",
4
4
  "type": "module",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -36,7 +36,7 @@
36
36
  "devDependencies": {
37
37
  "@eslint/eslintrc": "^3.3.1",
38
38
  "@eslint/js": "^9.29.0",
39
- "@olane/o-test": "0.8.3",
39
+ "@olane/o-test": "0.8.4",
40
40
  "@tsconfig/node20": "^20.1.6",
41
41
  "@types/handlebars": "^4.1.0",
42
42
  "@types/jest": "^30.0.0",
@@ -57,15 +57,15 @@
57
57
  "typescript": "5.4.5"
58
58
  },
59
59
  "dependencies": {
60
- "@olane/o-config": "0.8.3",
61
- "@olane/o-core": "0.8.3",
62
- "@olane/o-node": "0.8.3",
63
- "@olane/o-protocol": "0.8.3",
64
- "@olane/o-storage": "0.8.3",
65
- "@olane/o-tool": "0.8.3",
60
+ "@olane/o-config": "0.8.4",
61
+ "@olane/o-core": "0.8.4",
62
+ "@olane/o-node": "0.8.4",
63
+ "@olane/o-protocol": "0.8.4",
64
+ "@olane/o-storage": "0.8.4",
65
+ "@olane/o-tool": "0.8.4",
66
66
  "debug": "^4.4.1",
67
67
  "dotenv": "^16.5.0",
68
68
  "handlebars": "^4.7.8"
69
69
  },
70
- "gitHead": "189c0cf7b6dd9d5d961f5424af21d37978092d9e"
70
+ "gitHead": "b53623b1ad4365133911722f80d5597a72b65bf2"
71
71
  }