@olane/o-lane 0.7.24 → 0.7.26

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.
@@ -1 +1 @@
1
- {"version":3,"file":"o-capability.result.d.ts","sourceRoot":"","sources":["../../../src/capabilities/o-capability.result.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAG3F,qBAAa,iBAAkB,YAAW,0BAA0B;IAClE,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;gBAEZ,MAAM,EAAE,0BAA0B;IAQ9C,MAAM;;;;;;;;;;;IAUN,QAAQ;CAGT"}
1
+ {"version":3,"file":"o-capability.result.d.ts","sourceRoot":"","sources":["../../../src/capabilities/o-capability.result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAG3F,qBAAa,iBAAkB,YAAW,0BAA0B;IAClE,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;gBAEZ,MAAM,EAAE,0BAA0B;IAS9C,MAAM;;;;;;;;;;;IAUN,QAAQ;CAGT"}
@@ -7,6 +7,7 @@ export class oCapabilityResult {
7
7
  this.type = config.type || oCapabilityType.UNKNOWN;
8
8
  this.config = config.config;
9
9
  this.error = config.error;
10
+ this.shouldPersist = config.shouldPersist;
10
11
  }
11
12
  toJSON() {
12
13
  return {
@@ -14,7 +15,7 @@ export class oCapabilityResult {
14
15
  result: this.result,
15
16
  type: this.type,
16
17
  error: this.error,
17
- config: this.config?.toJSON()
18
+ config: this.config?.toJSON(),
18
19
  };
19
20
  }
20
21
  toString() {
@@ -1 +1 @@
1
- {"version":3,"file":"execute.capability.d.ts","sourceRoot":"","sources":["../../../src/capabilities-execute/execute.capability.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAEvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAEzF,qBAAa,kBAAmB,SAAQ,uBAAuB;IACtD,MAAM,EAAG,wBAAwB,CAAC;IAEzC,IAAI,IAAI,IAAI,eAAe,CAE1B;IAED,MAAM,KAAK,IAAI,oBAEd;IAEK,UAAU,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAepD,SAAS,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAatC,GAAG,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAsGxC"}
1
+ {"version":3,"file":"execute.capability.d.ts","sourceRoot":"","sources":["../../../src/capabilities-execute/execute.capability.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAEvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAEzF,qBAAa,kBAAmB,SAAQ,uBAAuB;IACtD,MAAM,EAAG,wBAAwB,CAAC;IAEzC,IAAI,IAAI,IAAI,eAAe,CAE1B;IAED,MAAM,KAAK,IAAI,oBAEd;IAEK,UAAU,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAepD,SAAS,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAatC,GAAG,IAAI,OAAO,CAAC,iBAAiB,CAAC;CA8HxC"}
@@ -19,7 +19,7 @@ export class oCapabilityExecute extends oCapabilityIntelligence {
19
19
  chat_history: '',
20
20
  past_cycles: '',
21
21
  address: this.config.params.address,
22
- methods: methods ? JSON.stringify(methods) : ''
22
+ methods: methods ? JSON.stringify(methods) : '',
23
23
  });
24
24
  return prompt.render();
25
25
  }
@@ -48,7 +48,9 @@ export class oCapabilityExecute extends oCapabilityIntelligence {
48
48
  // The AI should return the method and params to execute
49
49
  const task = aiResponse.result?.task || aiResponse.result;
50
50
  if (!task || !task.method) {
51
- this.logger.warn('AI did not return a valid task to execute', { aiResponse });
51
+ this.logger.warn('AI did not return a valid task to execute', {
52
+ aiResponse,
53
+ });
52
54
  return aiResponse; // Return AI response as-is if no task to execute
53
55
  }
54
56
  const method = task.method;
@@ -83,28 +85,44 @@ export class oCapabilityExecute extends oCapabilityIntelligence {
83
85
  throw error;
84
86
  }
85
87
  }
86
- // Execute the task
87
- const taskResponse = await this.node.use(new oAddress(this.config.params.address), {
88
- method: method,
89
- params: params,
90
- });
91
- // Check if the tool response contains _save flag
92
- const shouldPersist = taskResponse.result?.data?._save === true;
93
- if (shouldPersist) {
94
- this.logger.debug('Tool response contains _save flag - lane will be persisted to config');
88
+ try {
89
+ // Execute the task
90
+ const taskResponse = await this.node.use(new oAddress(this.config.params.address), {
91
+ method: method,
92
+ params: params,
93
+ });
94
+ // Check if the tool response contains _save flag
95
+ const shouldPersist = taskResponse.result?.data?._save === true;
96
+ if (shouldPersist) {
97
+ this.logger.debug('Tool response contains _save flag - lane will be persisted to config');
98
+ }
99
+ // Return an EVALUATE result that contains the task execution output
100
+ return new oCapabilityResult({
101
+ type: oCapabilityType.EVALUATE,
102
+ config: this.config,
103
+ result: {
104
+ taskConfig: {
105
+ method: method,
106
+ params: params,
107
+ },
108
+ response: taskResponse.result,
109
+ },
110
+ shouldPersist,
111
+ });
95
112
  }
96
- // Return an EVALUATE result that contains the task execution output
97
- return new oCapabilityResult({
98
- type: oCapabilityType.EVALUATE,
99
- config: this.config,
100
- result: {
101
- taskConfig: {
113
+ catch (error) {
114
+ this.logger.error('Failed to execute:', `Error when trying to use ${this.config?.params?.address} with config: ${JSON.stringify({
115
+ method: method,
116
+ params: params,
117
+ })} resulting in error: ${error?.message}`);
118
+ return new oCapabilityResult({
119
+ type: oCapabilityType.EVALUATE,
120
+ config: this.config,
121
+ error: `Error when trying to use ${this.config?.params?.address} with config: ${JSON.stringify({
102
122
  method: method,
103
123
  params: params,
104
- },
105
- response: taskResponse.result,
106
- },
107
- shouldPersist,
108
- });
124
+ })} resulting in error: ${error?.message}`,
125
+ });
126
+ }
109
127
  }
110
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olane/o-lane",
3
- "version": "0.7.24",
3
+ "version": "0.7.26",
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.7.24",
39
+ "@olane/o-test": "0.7.26",
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.7.24",
61
- "@olane/o-core": "0.7.24",
62
- "@olane/o-node": "0.7.24",
63
- "@olane/o-protocol": "0.7.24",
64
- "@olane/o-storage": "0.7.24",
65
- "@olane/o-tool": "0.7.24",
60
+ "@olane/o-config": "0.7.26",
61
+ "@olane/o-core": "0.7.26",
62
+ "@olane/o-node": "0.7.26",
63
+ "@olane/o-protocol": "0.7.26",
64
+ "@olane/o-storage": "0.7.26",
65
+ "@olane/o-tool": "0.7.26",
66
66
  "debug": "^4.4.1",
67
67
  "dotenv": "^16.5.0",
68
68
  "handlebars": "^4.7.8"
69
69
  },
70
- "gitHead": "6f3520b1a7e24d39c0b0d9e6f7b7b3c26145738c"
70
+ "gitHead": "ded249359b4d2d0eb2e1bf438ce59287ba9dfd58"
71
71
  }