@olane/o-lane 0.7.26 → 0.7.28
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/src/capabilities-execute/execute.capability.d.ts.map +1 -1
- package/dist/src/capabilities-execute/execute.capability.js +69 -1
- package/dist/src/capabilities-execute/interfaces/o-capability.configure-config.d.ts +13 -0
- package/dist/src/capabilities-execute/interfaces/o-capability.configure-config.d.ts.map +1 -1
- package/dist/src/storage/o-lane.storage-manager.d.ts.map +1 -1
- package/dist/src/storage/o-lane.storage-manager.js +20 -7
- package/package.json +9 -9
|
@@ -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;
|
|
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;CA2NxC"}
|
|
@@ -35,8 +35,62 @@ export class oCapabilityExecute extends oCapabilityIntelligence {
|
|
|
35
35
|
async run() {
|
|
36
36
|
// Check if we're in replay mode
|
|
37
37
|
if (this.config.isReplay) {
|
|
38
|
-
this.logger.debug('Execute capability is being replayed -
|
|
38
|
+
this.logger.debug('Execute capability is being replayed - using stored execution data');
|
|
39
|
+
// Extract stored execution data
|
|
40
|
+
const storedExecution = this.config.params.storedExecution;
|
|
41
|
+
// Validate stored data exists (strict mode - fail if missing)
|
|
42
|
+
if (!storedExecution) {
|
|
43
|
+
throw new oError(oErrorCodes.INVALID_RESPONSE, 'Replay mode enabled but no stored execution data found');
|
|
44
|
+
}
|
|
45
|
+
if (!storedExecution.handshakeResult || !storedExecution.taskConfig) {
|
|
46
|
+
throw new oError(oErrorCodes.INVALID_RESPONSE, 'Replay mode enabled but stored execution data is incomplete');
|
|
47
|
+
}
|
|
48
|
+
const { handshakeResult, taskConfig } = storedExecution;
|
|
49
|
+
const { method, params } = taskConfig;
|
|
50
|
+
this.logger.debug('Replaying task execution with stored data', {
|
|
51
|
+
method,
|
|
52
|
+
params,
|
|
53
|
+
skipHandshake: true,
|
|
54
|
+
skipIntelligence: true,
|
|
55
|
+
skipApproval: true,
|
|
56
|
+
});
|
|
57
|
+
// Execute the stored task directly (skip handshake, AI, and approval)
|
|
58
|
+
try {
|
|
59
|
+
const taskResponse = await this.node.use(new oAddress(this.config.params.address), {
|
|
60
|
+
method: method,
|
|
61
|
+
params: params,
|
|
62
|
+
});
|
|
63
|
+
// Check if the tool response contains _save flag
|
|
64
|
+
const shouldPersist = taskResponse.result?.data?._save === true;
|
|
65
|
+
if (shouldPersist) {
|
|
66
|
+
this.logger.debug('Tool response contains _save flag - lane will be persisted to config');
|
|
67
|
+
}
|
|
68
|
+
// Return an EVALUATE result that contains the task execution output
|
|
69
|
+
return new oCapabilityResult({
|
|
70
|
+
type: oCapabilityType.EVALUATE,
|
|
71
|
+
config: this.config,
|
|
72
|
+
result: {
|
|
73
|
+
handshakeResult: handshakeResult,
|
|
74
|
+
taskConfig: taskConfig,
|
|
75
|
+
response: taskResponse.result,
|
|
76
|
+
},
|
|
77
|
+
shouldPersist,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
this.logger.error('Failed to execute during replay:', `Error when trying to use ${this.config?.params?.address} with config: ${JSON.stringify(taskConfig)} resulting in error: ${error?.message}`);
|
|
82
|
+
return new oCapabilityResult({
|
|
83
|
+
type: oCapabilityType.EVALUATE,
|
|
84
|
+
config: this.config,
|
|
85
|
+
result: {
|
|
86
|
+
handshakeResult: handshakeResult,
|
|
87
|
+
taskConfig: taskConfig,
|
|
88
|
+
},
|
|
89
|
+
error: `Error when trying to use ${this.config?.params?.address} with config: ${JSON.stringify(taskConfig)} resulting in error: ${error?.message}`,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
39
92
|
}
|
|
93
|
+
// Normal execution flow (not replay)
|
|
40
94
|
const handshake = await this.handshake();
|
|
41
95
|
if (!handshake.result) {
|
|
42
96
|
throw new oError(oErrorCodes.INVALID_RESPONSE, 'Handshake failed');
|
|
@@ -101,6 +155,10 @@ export class oCapabilityExecute extends oCapabilityIntelligence {
|
|
|
101
155
|
type: oCapabilityType.EVALUATE,
|
|
102
156
|
config: this.config,
|
|
103
157
|
result: {
|
|
158
|
+
handshakeResult: {
|
|
159
|
+
tools: handshake.result.tools,
|
|
160
|
+
methods: handshake.result.methods,
|
|
161
|
+
},
|
|
104
162
|
taskConfig: {
|
|
105
163
|
method: method,
|
|
106
164
|
params: params,
|
|
@@ -118,6 +176,16 @@ export class oCapabilityExecute extends oCapabilityIntelligence {
|
|
|
118
176
|
return new oCapabilityResult({
|
|
119
177
|
type: oCapabilityType.EVALUATE,
|
|
120
178
|
config: this.config,
|
|
179
|
+
result: {
|
|
180
|
+
handshakeResult: {
|
|
181
|
+
tools: handshake.result.tools,
|
|
182
|
+
methods: handshake.result.methods,
|
|
183
|
+
},
|
|
184
|
+
taskConfig: {
|
|
185
|
+
method: method,
|
|
186
|
+
params: params,
|
|
187
|
+
},
|
|
188
|
+
},
|
|
121
189
|
error: `Error when trying to use ${this.config?.params?.address} with config: ${JSON.stringify({
|
|
122
190
|
method: method,
|
|
123
191
|
params: params,
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { oCapabilityConfig } from '../../capabilities/o-capability.config.js';
|
|
2
|
+
import { oMethod } from '@olane/o-protocol';
|
|
2
3
|
export interface oCapabilityExecuteConfig extends oCapabilityConfig {
|
|
3
4
|
params: {
|
|
4
5
|
address: string;
|
|
5
6
|
intent: string;
|
|
7
|
+
storedExecution?: {
|
|
8
|
+
handshakeResult: {
|
|
9
|
+
tools: string[];
|
|
10
|
+
methods: {
|
|
11
|
+
[key: string]: oMethod;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
taskConfig: {
|
|
15
|
+
method: string;
|
|
16
|
+
params: any;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
6
19
|
};
|
|
7
20
|
}
|
|
8
21
|
//# sourceMappingURL=o-capability.configure-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o-capability.configure-config.d.ts","sourceRoot":"","sources":["../../../../src/capabilities-execute/interfaces/o-capability.configure-config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"o-capability.configure-config.d.ts","sourceRoot":"","sources":["../../../../src/capabilities-execute/interfaces/o-capability.configure-config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IACjE,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,eAAe,CAAC,EAAE;YAChB,eAAe,EAAE;gBACf,KAAK,EAAE,MAAM,EAAE,CAAC;gBAChB,OAAO,EAAE;oBAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;iBAAE,CAAC;aACrC,CAAC;YACF,UAAU,EAAE;gBACV,MAAM,EAAE,MAAM,CAAC;gBACf,MAAM,EAAE,GAAG,CAAC;aACb,CAAC;SACH,CAAC;KACH,CAAC;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o-lane.storage-manager.d.ts","sourceRoot":"","sources":["../../../src/storage/o-lane.storage-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,OAAO,
|
|
1
|
+
{"version":3,"file":"o-lane.storage-manager.d.ts","sourceRoot":"","sources":["../../../src/storage/o-lane.storage-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,OAAO,EACL,iBAAiB,EACjB,eAAe,EAEhB,MAAM,0BAA0B,CAAC;AAGlC,KAAK,KAAK,GAAG,GAAG,CAAC;AAEjB,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,GAAG,CAAkB;IAC7B,OAAO,CAAC,IAAI,CAAQ;gBAER,IAAI,EAAE,KAAK;IAIvB;;;OAGG;IACH,gBAAgB,IAAI,GAAG;IAQvB;;;OAGG;IACH,SAAS,IAAI,GAAG;IAQhB;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC;IAWjC;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC;IAyB1B;;;;OAIG;IACG,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IA2C5E;;;;;OAKG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;IAqFjE;;;;;;OAMG;IACH,sBAAsB,CAAC,cAAc,EAAE,eAAe,GAAG,OAAO;IAShE;;;OAGG;IACH,YAAY,IAAI,GAAG,GAAG,SAAS;IAI/B;;OAEG;IACH,UAAU,IAAI,IAAI;CAGnB"}
|
|
@@ -12,7 +12,7 @@ import { oAddress, oError, oErrorCodes, NodeState } from '@olane/o-core';
|
|
|
12
12
|
import { CID } from 'multiformats';
|
|
13
13
|
import * as json from 'multiformats/codecs/json';
|
|
14
14
|
import { sha256 } from 'multiformats/hashes/sha2';
|
|
15
|
-
import { oCapabilityResult, oCapabilityType } from '../capabilities/index.js';
|
|
15
|
+
import { oCapabilityResult, oCapabilityType, } from '../capabilities/index.js';
|
|
16
16
|
export class oLaneStorageManager {
|
|
17
17
|
constructor(lane) {
|
|
18
18
|
this.lane = lane;
|
|
@@ -144,14 +144,27 @@ export class oLaneStorageManager {
|
|
|
144
144
|
if (this.shouldReplayCapability(capabilityType)) {
|
|
145
145
|
this.lane.logger.debug(`Replaying capability: ${capabilityType}`);
|
|
146
146
|
// Create a capability result with replay flag
|
|
147
|
+
const replayConfig = {
|
|
148
|
+
...sequenceItem.config,
|
|
149
|
+
isReplay: true,
|
|
150
|
+
node: this.lane.node,
|
|
151
|
+
history: this.lane.agentHistory,
|
|
152
|
+
};
|
|
153
|
+
// For EXECUTE capabilities, add stored execution data to skip handshake and intelligence
|
|
154
|
+
if (capabilityType === oCapabilityType.EXECUTE &&
|
|
155
|
+
sequenceItem.result) {
|
|
156
|
+
// Ensure params object exists
|
|
157
|
+
if (!replayConfig.params) {
|
|
158
|
+
replayConfig.params = {};
|
|
159
|
+
}
|
|
160
|
+
replayConfig.params.storedExecution = {
|
|
161
|
+
handshakeResult: sequenceItem?.result?.handshakeResult,
|
|
162
|
+
taskConfig: sequenceItem?.result?.taskConfig,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
147
165
|
const replayStep = new oCapabilityResult({
|
|
148
166
|
type: capabilityType,
|
|
149
|
-
config:
|
|
150
|
-
...sequenceItem.config,
|
|
151
|
-
isReplay: true,
|
|
152
|
-
node: this.lane.node,
|
|
153
|
-
history: this.lane.agentHistory,
|
|
154
|
-
},
|
|
167
|
+
config: replayConfig,
|
|
155
168
|
result: sequenceItem.result,
|
|
156
169
|
error: sequenceItem.error,
|
|
157
170
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/o-lane",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.28",
|
|
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.
|
|
39
|
+
"@olane/o-test": "0.7.28",
|
|
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.
|
|
61
|
-
"@olane/o-core": "0.7.
|
|
62
|
-
"@olane/o-node": "0.7.
|
|
63
|
-
"@olane/o-protocol": "0.7.
|
|
64
|
-
"@olane/o-storage": "0.7.
|
|
65
|
-
"@olane/o-tool": "0.7.
|
|
60
|
+
"@olane/o-config": "0.7.28",
|
|
61
|
+
"@olane/o-core": "0.7.28",
|
|
62
|
+
"@olane/o-node": "0.7.28",
|
|
63
|
+
"@olane/o-protocol": "0.7.28",
|
|
64
|
+
"@olane/o-storage": "0.7.28",
|
|
65
|
+
"@olane/o-tool": "0.7.28",
|
|
66
66
|
"debug": "^4.4.1",
|
|
67
67
|
"dotenv": "^16.5.0",
|
|
68
68
|
"handlebars": "^4.7.8"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "7f24180d2cf06c11195033ae6567aa291c70c90d"
|
|
71
71
|
}
|