@olane/o-lane 0.8.15 → 0.8.17
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/o-capability.d.ts.map +1 -1
- package/dist/src/capabilities/o-capability.intelligence.d.ts.map +1 -1
- package/dist/src/capabilities/o-capability.intelligence.js +22 -0
- package/dist/src/capabilities/o-capability.js +8 -0
- package/dist/src/capabilities-evaluate/o-capability.evaluate.d.ts.map +1 -1
- package/dist/src/capabilities-evaluate/o-capability.evaluate.js +29 -3
- package/dist/src/capabilities-execute/execute.capability.d.ts.map +1 -1
- package/dist/src/capabilities-execute/execute.capability.js +119 -5
- package/dist/src/o-lane.d.ts.map +1 -1
- package/dist/src/o-lane.js +96 -3
- package/dist/src/prompts/o-prompt.d.ts.map +1 -1
- package/dist/src/prompts/o-prompt.js +10 -0
- package/dist/src/storage/o-lane.storage-manager.d.ts.map +1 -1
- package/dist/src/storage/o-lane.storage-manager.js +47 -2
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o-capability.d.ts","sourceRoot":"","sources":["../../../src/capabilities/o-capability.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,8BAAsB,WAAY,SAAQ,OAAO;IAC/C,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IACrC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC;IAC1B,SAAS,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAC;gBAEzB,EAAC,YAAY,EAAE,IAAI,EAAC,EAAE;QAAE,YAAY,EAAE,YAAY,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE;IAOjF,QAAQ,CAAC,GAAG,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAEpC,OAAO,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"o-capability.d.ts","sourceRoot":"","sources":["../../../src/capabilities/o-capability.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,8BAAsB,WAAY,SAAQ,OAAO;IAC/C,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IACrC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC;IAC1B,SAAS,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAC;gBAEzB,EAAC,YAAY,EAAE,IAAI,EAAC,EAAE;QAAE,YAAY,EAAE,YAAY,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE;IAOjF,QAAQ,CAAC,GAAG,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAEpC,OAAO,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAapE,IAAI,IAAI,oBAEP;IAED,MAAM,KAAK,IAAI,oBAEd;IAED,MAAM;CAGP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o-capability.intelligence.d.ts","sourceRoot":"","sources":["../../../src/capabilities/o-capability.intelligence.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,6BAA6B,EAAE,MAAM,kDAAkD,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,8BAAsB,uBAAwB,SAAQ,WAAW;IAEzD,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"o-capability.intelligence.d.ts","sourceRoot":"","sources":["../../../src/capabilities/o-capability.intelligence.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,6BAA6B,EAAE,MAAM,kDAAkD,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,8BAAsB,uBAAwB,SAAQ,WAAW;IAEzD,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,6BAA6B,CAAC;CA+E3E"}
|
|
@@ -5,6 +5,14 @@ import { oCapabilityType } from './enums/o-capability.type-enum.js';
|
|
|
5
5
|
export class oCapabilityIntelligence extends oCapability {
|
|
6
6
|
async intelligence(prompt) {
|
|
7
7
|
try {
|
|
8
|
+
if (process.env.VERBOSE === 'true') {
|
|
9
|
+
this.logger.verbose('Intelligence prompt sending', {
|
|
10
|
+
promptLength: prompt.length,
|
|
11
|
+
preview: prompt.substring(0, 500) + (prompt.length > 500 ? '...' : ''),
|
|
12
|
+
intent: this.config?.intent?.value,
|
|
13
|
+
isStreaming: this.config?.useStream || false,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
8
16
|
const _isStreaming = this.config?.useStream || false;
|
|
9
17
|
const response = await this.node.useStream(new oAddress(RestrictedAddresses.INTELLIGENCE), {
|
|
10
18
|
method: 'prompt',
|
|
@@ -28,11 +36,25 @@ export class oCapabilityIntelligence extends oCapability {
|
|
|
28
36
|
if (!message) {
|
|
29
37
|
throw new Error('No message returned from intelligence');
|
|
30
38
|
}
|
|
39
|
+
if (process.env.VERBOSE === 'true') {
|
|
40
|
+
const messageStr = typeof message === 'string' ? message : JSON.stringify(message);
|
|
41
|
+
this.logger.verbose('Intelligence raw AI message', {
|
|
42
|
+
messageLength: messageStr.length,
|
|
43
|
+
preview: messageStr.substring(0, 500) + (messageStr.length > 500 ? '...' : ''),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
31
46
|
// Use the parsed result value if available, otherwise fall back to full message
|
|
32
47
|
const processedResult = RegexUtils.extractResultFromAI(message);
|
|
33
48
|
// Extract structured fields from AI response
|
|
34
49
|
// The AI returns JSON with fields like: type, summary, reasoning, result, etc.
|
|
35
50
|
const { type } = processedResult;
|
|
51
|
+
if (process.env.VERBOSE === 'true') {
|
|
52
|
+
this.logger.verbose('Intelligence parsed result', {
|
|
53
|
+
determinedType: type || oCapabilityType.EVALUATE,
|
|
54
|
+
resultKeys: processedResult && typeof processedResult === 'object' ? Object.keys(processedResult) : [],
|
|
55
|
+
result: processedResult,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
36
58
|
return new oCapabilityIntelligenceResult({
|
|
37
59
|
result: processedResult, // Keep full result for backwards compatibility
|
|
38
60
|
type: type || oCapabilityType.EVALUATE,
|
|
@@ -8,6 +8,14 @@ export class oCapability extends oObject {
|
|
|
8
8
|
}
|
|
9
9
|
async execute(config) {
|
|
10
10
|
this.config = config;
|
|
11
|
+
if (process.env.VERBOSE === 'true') {
|
|
12
|
+
this.logger.verbose('Capability execute starting', {
|
|
13
|
+
capabilityType: this.type,
|
|
14
|
+
intent: config.intent?.value,
|
|
15
|
+
isReplay: config.isReplay || false,
|
|
16
|
+
paramsKeys: config.params && typeof config.params === 'object' ? Object.keys(config.params) : [],
|
|
17
|
+
});
|
|
18
|
+
}
|
|
11
19
|
return this.run();
|
|
12
20
|
}
|
|
13
21
|
get type() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o-capability.evaluate.d.ts","sourceRoot":"","sources":["../../../src/capabilities-evaluate/o-capability.evaluate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,qBAAa,mBAAoB,SAAQ,uBAAuB;IAC9D,MAAM,KAAK,IAAI,oBAEd;IAED,IAAI,IAAI,oBAEP;IAEK,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"o-capability.evaluate.d.ts","sourceRoot":"","sources":["../../../src/capabilities-evaluate/o-capability.evaluate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,qBAAa,mBAAoB,SAAQ,uBAAuB;IAC9D,MAAM,KAAK,IAAI,oBAEd;IAED,IAAI,IAAI,oBAEP;IAEK,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IA2B7B,GAAG,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAoBxC"}
|
|
@@ -8,7 +8,7 @@ export class oCapabilityEvaluate extends oCapabilityIntelligence {
|
|
|
8
8
|
return oCapabilityType.EVALUATE;
|
|
9
9
|
}
|
|
10
10
|
async loadPrompt() {
|
|
11
|
-
const
|
|
11
|
+
const params = {
|
|
12
12
|
human_about: '',
|
|
13
13
|
agent_about: '',
|
|
14
14
|
context_global: `
|
|
@@ -16,15 +16,41 @@ export class oCapabilityEvaluate extends oCapabilityIntelligence {
|
|
|
16
16
|
You are in a secure environment and are allowed to operate with secure information (api keys, credit card info, etc).`,
|
|
17
17
|
chat_history: '',
|
|
18
18
|
past_cycles: this.config?.history,
|
|
19
|
-
}
|
|
20
|
-
|
|
19
|
+
};
|
|
20
|
+
if (process.env.VERBOSE === 'true') {
|
|
21
|
+
this.logger.verbose('Evaluate loadPrompt params', {
|
|
22
|
+
paramKeys: Object.keys(params),
|
|
23
|
+
pastCyclesLength: (this.config?.history || '').length,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const prompt = await this.promptLoader?.loadPromptForType(this.type, params);
|
|
27
|
+
const rendered = prompt.render();
|
|
28
|
+
if (process.env.VERBOSE === 'true') {
|
|
29
|
+
this.logger.verbose('Evaluate prompt rendered', {
|
|
30
|
+
length: rendered.length,
|
|
31
|
+
preview: rendered.substring(0, 500) + (rendered.length > 500 ? '...' : ''),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return rendered;
|
|
21
35
|
}
|
|
22
36
|
async run() {
|
|
23
37
|
if (!this.config?.intent) {
|
|
24
38
|
throw new Error('Invalid intent passed');
|
|
25
39
|
}
|
|
40
|
+
if (process.env.VERBOSE === 'true') {
|
|
41
|
+
this.logger.verbose('Evaluate run starting', {
|
|
42
|
+
intent: this.config.intent.value,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
26
45
|
const prompt = await this.loadPrompt();
|
|
27
46
|
const response = await this.intelligence(prompt);
|
|
47
|
+
if (process.env.VERBOSE === 'true') {
|
|
48
|
+
this.logger.verbose('Evaluate run result', {
|
|
49
|
+
responseType: response.type,
|
|
50
|
+
hasError: !!response.error,
|
|
51
|
+
resultKeys: response.result && typeof response.result === 'object' ? Object.keys(response.result) : [],
|
|
52
|
+
});
|
|
53
|
+
}
|
|
28
54
|
return response;
|
|
29
55
|
}
|
|
30
56
|
}
|
|
@@ -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;IAED,OAAO,CAAC,cAAc;IAYhB,UAAU,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,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;IAED,OAAO,CAAC,cAAc;IAYhB,UAAU,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IA8BpD,SAAS,IAAI,OAAO,CAAC,gBAAgB,CAAC;YA0B9B,WAAW;IAwBzB,OAAO,CAAC,WAAW;IAwCnB,OAAO,CAAC,gBAAgB;YA+BV,eAAe;IAuDvB,GAAG,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAuIxC"}
|
|
@@ -18,7 +18,7 @@ export class oCapabilityExecute extends oCapabilityIntelligence {
|
|
|
18
18
|
return address;
|
|
19
19
|
}
|
|
20
20
|
async loadPrompt({ tools, methods }) {
|
|
21
|
-
const
|
|
21
|
+
const params = {
|
|
22
22
|
human_about: '',
|
|
23
23
|
agent_about: '',
|
|
24
24
|
context_global: `
|
|
@@ -28,24 +28,71 @@ export class oCapabilityExecute extends oCapabilityIntelligence {
|
|
|
28
28
|
past_cycles: '',
|
|
29
29
|
address: this.resolveAddress(),
|
|
30
30
|
methods: methods ? JSON.stringify(methods) : '',
|
|
31
|
-
}
|
|
32
|
-
|
|
31
|
+
};
|
|
32
|
+
if (process.env.VERBOSE === 'true') {
|
|
33
|
+
this.logger.verbose('Execute loadPrompt params', {
|
|
34
|
+
paramKeys: Object.keys(params),
|
|
35
|
+
address: params.address,
|
|
36
|
+
methodsLength: params.methods.length,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const prompt = await this.promptLoader?.loadPromptForType(this.type, params);
|
|
40
|
+
const rendered = prompt.render();
|
|
41
|
+
if (process.env.VERBOSE === 'true') {
|
|
42
|
+
this.logger.verbose('Execute prompt rendered', {
|
|
43
|
+
length: rendered.length,
|
|
44
|
+
preview: rendered.substring(0, 500) + (rendered.length > 500 ? '...' : ''),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return rendered;
|
|
33
48
|
}
|
|
34
49
|
async handshake() {
|
|
35
|
-
const
|
|
50
|
+
const address = this.resolveAddress();
|
|
51
|
+
if (process.env.VERBOSE === 'true') {
|
|
52
|
+
this.logger.verbose('Handshake starting', {
|
|
53
|
+
targetAddress: address,
|
|
54
|
+
intent: this.config.intent.value,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const response = await this.node.use(new oAddress(address), {
|
|
36
58
|
method: oProtocolMethods.HANDSHAKE,
|
|
37
59
|
params: {
|
|
38
60
|
intent: this.config.intent.value,
|
|
39
61
|
},
|
|
40
62
|
});
|
|
63
|
+
if (process.env.VERBOSE === 'true') {
|
|
64
|
+
const data = response.result.data;
|
|
65
|
+
this.logger.verbose('Handshake response', {
|
|
66
|
+
targetAddress: address,
|
|
67
|
+
hasResult: !!data?.result,
|
|
68
|
+
toolsCount: data?.result?.tools?.length,
|
|
69
|
+
methodKeys: data?.result?.methods ? Object.keys(data.result.methods) : [],
|
|
70
|
+
});
|
|
71
|
+
}
|
|
41
72
|
return response.result.data;
|
|
42
73
|
}
|
|
43
74
|
async executeTask(method, params) {
|
|
44
75
|
this.logger.debug('Executing task:', method);
|
|
45
|
-
|
|
76
|
+
if (process.env.VERBOSE === 'true') {
|
|
77
|
+
this.logger.verbose('executeTask', {
|
|
78
|
+
address: this.resolveAddress(),
|
|
79
|
+
method,
|
|
80
|
+
paramsKeys: params ? Object.keys(params) : [],
|
|
81
|
+
params,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
const response = await this.node.use(new oAddress(this.resolveAddress()), {
|
|
46
85
|
method,
|
|
47
86
|
params,
|
|
48
87
|
});
|
|
88
|
+
if (process.env.VERBOSE === 'true') {
|
|
89
|
+
this.logger.verbose('executeTask response', {
|
|
90
|
+
method,
|
|
91
|
+
success: response?.result?.success,
|
|
92
|
+
resultKeys: response?.result?.data && typeof response.result.data === 'object' ? Object.keys(response.result.data) : [],
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return response;
|
|
49
96
|
}
|
|
50
97
|
buildResult(taskResponse, handshakeResult, taskConfig, address) {
|
|
51
98
|
const shouldPersist = taskResponse.result?.data?._save === true;
|
|
@@ -60,6 +107,15 @@ export class oCapabilityExecute extends oCapabilityIntelligence {
|
|
|
60
107
|
if (address) {
|
|
61
108
|
result.address = address;
|
|
62
109
|
}
|
|
110
|
+
if (process.env.VERBOSE === 'true') {
|
|
111
|
+
this.logger.verbose('buildResult', {
|
|
112
|
+
shouldPersist,
|
|
113
|
+
address,
|
|
114
|
+
method: taskConfig.method,
|
|
115
|
+
resultKeys: Object.keys(result),
|
|
116
|
+
responseSuccess: taskResponse.result?.success,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
63
119
|
return new oCapabilityResult({
|
|
64
120
|
type: oCapabilityType.EVALUATE,
|
|
65
121
|
config: this.config,
|
|
@@ -71,6 +127,15 @@ export class oCapabilityExecute extends oCapabilityIntelligence {
|
|
|
71
127
|
const addr = this.resolveAddress();
|
|
72
128
|
const errorMessage = `Error when trying to use ${addr} with config: ${JSON.stringify(taskConfig)} resulting in error: ${error?.message}`;
|
|
73
129
|
this.logger.error('Failed to execute:', errorMessage);
|
|
130
|
+
if (process.env.VERBOSE === 'true') {
|
|
131
|
+
this.logger.verbose('buildErrorResult', {
|
|
132
|
+
address: addr,
|
|
133
|
+
method: taskConfig.method,
|
|
134
|
+
params: taskConfig.params,
|
|
135
|
+
errorMessage: error?.message,
|
|
136
|
+
errorStack: error?.stack,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
74
139
|
return new oCapabilityResult({
|
|
75
140
|
type: oCapabilityType.EVALUATE,
|
|
76
141
|
config: this.config,
|
|
@@ -82,6 +147,13 @@ export class oCapabilityExecute extends oCapabilityIntelligence {
|
|
|
82
147
|
});
|
|
83
148
|
}
|
|
84
149
|
async requestApproval(method, params) {
|
|
150
|
+
if (process.env.VERBOSE === 'true') {
|
|
151
|
+
this.logger.verbose('requestApproval sending', {
|
|
152
|
+
toolAddress: this.resolveAddress(),
|
|
153
|
+
method,
|
|
154
|
+
paramsKeys: params ? Object.keys(params) : [],
|
|
155
|
+
});
|
|
156
|
+
}
|
|
85
157
|
try {
|
|
86
158
|
const approvalResponse = await this.node.use(new oAddress('o://approval'), {
|
|
87
159
|
method: 'request_approval',
|
|
@@ -93,6 +165,12 @@ export class oCapabilityExecute extends oCapabilityIntelligence {
|
|
|
93
165
|
},
|
|
94
166
|
});
|
|
95
167
|
const approved = approvalResponse.result.data?.approved;
|
|
168
|
+
if (process.env.VERBOSE === 'true') {
|
|
169
|
+
this.logger.verbose('requestApproval response', {
|
|
170
|
+
approved,
|
|
171
|
+
decision: approvalResponse.result.data?.decision,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
96
174
|
if (!approved) {
|
|
97
175
|
const decision = approvalResponse.result.data?.decision || 'denied';
|
|
98
176
|
this.logger.warn(`Task execution denied by approval system: ${decision}`);
|
|
@@ -126,6 +204,15 @@ export class oCapabilityExecute extends oCapabilityIntelligence {
|
|
|
126
204
|
}
|
|
127
205
|
const { handshakeResult, taskConfig } = storedExecution;
|
|
128
206
|
const { method, params } = taskConfig;
|
|
207
|
+
if (process.env.VERBOSE === 'true') {
|
|
208
|
+
this.logger.verbose('Execute replay full stored data', {
|
|
209
|
+
address: storedExecution.address,
|
|
210
|
+
method,
|
|
211
|
+
params,
|
|
212
|
+
handshakeToolsCount: handshakeResult?.tools?.length,
|
|
213
|
+
handshakeMethodKeys: handshakeResult?.methods ? Object.keys(handshakeResult.methods) : [],
|
|
214
|
+
});
|
|
215
|
+
}
|
|
129
216
|
this.logger.debug('Replaying task execution with stored data', {
|
|
130
217
|
method,
|
|
131
218
|
params,
|
|
@@ -142,13 +229,33 @@ export class oCapabilityExecute extends oCapabilityIntelligence {
|
|
|
142
229
|
}
|
|
143
230
|
}
|
|
144
231
|
// Normal execution flow
|
|
232
|
+
const address = this.resolveAddress();
|
|
233
|
+
if (process.env.VERBOSE === 'true') {
|
|
234
|
+
this.logger.verbose('Execute run normal flow starting', {
|
|
235
|
+
address,
|
|
236
|
+
intent: this.config.intent.value,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
145
239
|
const handshake = await this.handshake();
|
|
146
240
|
if (!handshake.result) {
|
|
147
241
|
throw new oError(oErrorCodes.INVALID_RESPONSE, 'Handshake failed');
|
|
148
242
|
}
|
|
149
243
|
const { tools, methods } = handshake.result;
|
|
244
|
+
if (process.env.VERBOSE === 'true') {
|
|
245
|
+
this.logger.verbose('Execute handshake result', {
|
|
246
|
+
toolsList: tools,
|
|
247
|
+
methodKeys: methods ? Object.keys(methods) : [],
|
|
248
|
+
});
|
|
249
|
+
}
|
|
150
250
|
const prompt = await this.loadPrompt({ tools, methods });
|
|
151
251
|
const aiResponse = await this.intelligence(prompt);
|
|
252
|
+
if (process.env.VERBOSE === 'true') {
|
|
253
|
+
this.logger.verbose('Execute AI response', {
|
|
254
|
+
responseType: aiResponse.type,
|
|
255
|
+
hasError: !!aiResponse.error,
|
|
256
|
+
resultKeys: aiResponse.result && typeof aiResponse.result === 'object' ? Object.keys(aiResponse.result) : [],
|
|
257
|
+
});
|
|
258
|
+
}
|
|
152
259
|
const task = aiResponse.result?.task || aiResponse.result;
|
|
153
260
|
if (!task || !task.method) {
|
|
154
261
|
this.logger.warn('AI did not return a valid task to execute', {
|
|
@@ -169,6 +276,13 @@ export class oCapabilityExecute extends oCapabilityIntelligence {
|
|
|
169
276
|
const params = task.params || {};
|
|
170
277
|
const taskConfig = { method, params };
|
|
171
278
|
this.logger.debug('AI decided to execute:', { method, params });
|
|
279
|
+
if (process.env.VERBOSE === 'true') {
|
|
280
|
+
this.logger.verbose('Execute task chosen by AI', {
|
|
281
|
+
method,
|
|
282
|
+
params,
|
|
283
|
+
address,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
172
286
|
await this.requestApproval(method, params);
|
|
173
287
|
try {
|
|
174
288
|
const taskResponse = await this.executeTask(method, params);
|
package/dist/src/o-lane.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o-lane.d.ts","sourceRoot":"","sources":["../../src/o-lane.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,OAAO,EAER,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAEL,iBAAiB,EAElB,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,qBAAa,KAAM,SAAQ,OAAO;IAgBpB,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW;IAf3C,QAAQ,EAAE,iBAAiB,EAAE,CAAM;IACnC,GAAG,EAAE,GAAG,GAAG,SAAS,CAAC;IACrB,EAAE,EAAE,MAAM,CAAY;IACtB,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,aAAa,EAAE,cAAc,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAM;IACxB,MAAM,EAAE,WAAW,CAAuB;IAC1C,MAAM,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACtC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IACtC,OAAO,CAAC,YAAY,CAAe;IAC5B,cAAc,EAAE,mBAAmB,CAAC;IAC3C,OAAO,CAAC,kBAAkB,CAAuB;IACjD,OAAO,CAAC,iBAAiB,CAAsB;IAC/C,OAAO,CAAC,kBAAkB,CAAC,CAAoC;gBAEhC,MAAM,EAAE,WAAW;IAuBlD,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,UAAU,IAAI,GAAG;IAIjB,MAAM;IAIN,WAAW,CAAC,MAAM,EAAE,iBAAiB;IAI/B,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC;IAIrB,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC;IAI3B,IAAI,YAAY,WAkBf;IAED;;;OAGG;IACH,iBAAiB,IAAI,MAAM;IA+DrB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"o-lane.d.ts","sourceRoot":"","sources":["../../src/o-lane.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,OAAO,EAER,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAEL,iBAAiB,EAElB,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,qBAAa,KAAM,SAAQ,OAAO;IAgBpB,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW;IAf3C,QAAQ,EAAE,iBAAiB,EAAE,CAAM;IACnC,GAAG,EAAE,GAAG,GAAG,SAAS,CAAC;IACrB,EAAE,EAAE,MAAM,CAAY;IACtB,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,aAAa,EAAE,cAAc,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAM;IACxB,MAAM,EAAE,WAAW,CAAuB;IAC1C,MAAM,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACtC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IACtC,OAAO,CAAC,YAAY,CAAe;IAC5B,cAAc,EAAE,mBAAmB,CAAC;IAC3C,OAAO,CAAC,kBAAkB,CAAuB;IACjD,OAAO,CAAC,iBAAiB,CAAsB;IAC/C,OAAO,CAAC,kBAAkB,CAAC,CAAoC;gBAEhC,MAAM,EAAE,WAAW;IAuBlD,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,UAAU,IAAI,GAAG;IAIjB,MAAM;IAIN,WAAW,CAAC,MAAM,EAAE,iBAAiB;IAI/B,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC;IAIrB,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC;IAI3B,IAAI,YAAY,WAkBf;IAED;;;OAGG;IACH,iBAAiB,IAAI,MAAM;IA+DrB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB1B,OAAO,IAAI,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;IAuCvD,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,aAAa;IAiBrB,OAAO,CAAC,WAAW;IA4Bb,YAAY,CAChB,WAAW,EAAE,iBAAiB,GAC7B,OAAO,CAAC,iBAAiB,CAAC;IAgDvB,IAAI,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAgElC,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,GAAG;IAuBzD,UAAU,CACd,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;IAgCzC,MAAM;IAaN;;;OAGG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;IA8BjE,IAAI,IAAI,sCAEP;CACF"}
|
package/dist/src/o-lane.js
CHANGED
|
@@ -128,13 +128,29 @@ export class oLane extends oObject {
|
|
|
128
128
|
this.status = oLaneStatus.PREFLIGHT;
|
|
129
129
|
this.logger.debug('Pinging intelligence tool...');
|
|
130
130
|
// ping the intelligence tool to ensure it is available
|
|
131
|
-
await this.node.use(new oAddress('o://intelligence'), {
|
|
131
|
+
const pingResponse = await this.node.use(new oAddress('o://intelligence'), {
|
|
132
132
|
method: 'ping',
|
|
133
133
|
params: {},
|
|
134
134
|
});
|
|
135
|
+
if (process.env.VERBOSE === 'true') {
|
|
136
|
+
this.logger.verbose('Preflight intelligence ping response', {
|
|
137
|
+
success: pingResponse?.result?.success,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
135
140
|
}
|
|
136
141
|
async execute() {
|
|
137
142
|
this.logger.debug('Executing...');
|
|
143
|
+
if (process.env.VERBOSE === 'true') {
|
|
144
|
+
this.logger.verbose('Lane execute starting', {
|
|
145
|
+
laneId: this.id,
|
|
146
|
+
intent: this.intent?.value,
|
|
147
|
+
maxCycles: this.MAX_CYCLES,
|
|
148
|
+
sequenceLength: this.sequence?.length,
|
|
149
|
+
parentLaneId: this.parentLaneId,
|
|
150
|
+
useStream: this.config.useStream || false,
|
|
151
|
+
persistToConfig: this.config.persistToConfig || false,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
138
154
|
try {
|
|
139
155
|
await this.preflight().catch((error) => {
|
|
140
156
|
this.logger.error('Error in preflight: ', error);
|
|
@@ -180,7 +196,7 @@ export class oLane extends oObject {
|
|
|
180
196
|
}
|
|
181
197
|
buildConfig(step) {
|
|
182
198
|
const resultData = step.result || step.error;
|
|
183
|
-
|
|
199
|
+
const config = new oCapabilityConfig({
|
|
184
200
|
intent: this.intent,
|
|
185
201
|
node: this.node,
|
|
186
202
|
history: this.agentHistory,
|
|
@@ -190,13 +206,49 @@ export class oLane extends oObject {
|
|
|
190
206
|
laneConfig: { ...this.config, sequence: this.sequence },
|
|
191
207
|
isReplay: step.config?.isReplay,
|
|
192
208
|
});
|
|
209
|
+
if (process.env.VERBOSE === 'true') {
|
|
210
|
+
this.logger.verbose('Built capability config', {
|
|
211
|
+
intent: this.intent?.value,
|
|
212
|
+
historyLength: this.agentHistory?.length,
|
|
213
|
+
paramsKeys: typeof resultData === 'object' && resultData
|
|
214
|
+
? Object.keys(resultData)
|
|
215
|
+
: [],
|
|
216
|
+
useStream: this.config.useStream || false,
|
|
217
|
+
isReplay: step.config?.isReplay || false,
|
|
218
|
+
sequenceLength: this.sequence?.length,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
return config;
|
|
193
222
|
}
|
|
194
223
|
async doCapability(currentStep) {
|
|
195
224
|
try {
|
|
196
225
|
const config = this.buildConfig(currentStep);
|
|
197
226
|
const capability = this.getCapability(currentStep.type);
|
|
198
227
|
this.logger.debug('Executing capability: ', currentStep.type);
|
|
199
|
-
|
|
228
|
+
if (process.env.VERBOSE === 'true') {
|
|
229
|
+
this.logger.verbose('doCapability input', {
|
|
230
|
+
stepType: currentStep?.type,
|
|
231
|
+
intent: this.intent?.value,
|
|
232
|
+
hasError: !!currentStep?.error,
|
|
233
|
+
isReplay: currentStep?.config?.isReplay || false,
|
|
234
|
+
paramsKeys: currentStep?.result && typeof currentStep?.result === 'object'
|
|
235
|
+
? Object.keys(currentStep.result)
|
|
236
|
+
: [],
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
const result = await capability.execute(config);
|
|
240
|
+
if (process.env.VERBOSE === 'true') {
|
|
241
|
+
this.logger.verbose('doCapability result', {
|
|
242
|
+
resultType: result?.type,
|
|
243
|
+
hasError: !!result?.error,
|
|
244
|
+
error: result?.error || undefined,
|
|
245
|
+
shouldPersist: result?.shouldPersist || false,
|
|
246
|
+
resultKeys: result.result && typeof result?.result === 'object'
|
|
247
|
+
? Object.keys(result.result)
|
|
248
|
+
: [],
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
return result;
|
|
200
252
|
}
|
|
201
253
|
catch (error) {
|
|
202
254
|
this.logger.error('Error in doCapability: ', error);
|
|
@@ -232,6 +284,14 @@ export class oLane extends oObject {
|
|
|
232
284
|
});
|
|
233
285
|
while (iterations++ < this.MAX_CYCLES &&
|
|
234
286
|
this.status === oLaneStatus.RUNNING) {
|
|
287
|
+
if (process.env.VERBOSE === 'true') {
|
|
288
|
+
this.logger.verbose('Loop iteration starting', {
|
|
289
|
+
iteration: iterations,
|
|
290
|
+
stepType: currentStep?.type,
|
|
291
|
+
sequenceLength: this.sequence?.length,
|
|
292
|
+
maxCycles: this.MAX_CYCLES,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
235
295
|
// update the history
|
|
236
296
|
if (currentStep.config) {
|
|
237
297
|
currentStep.config.history = this.agentHistory;
|
|
@@ -259,6 +319,14 @@ export class oLane extends oObject {
|
|
|
259
319
|
throw new Error('Plan failed');
|
|
260
320
|
}
|
|
261
321
|
async emitNonFinalChunk(result, payload) {
|
|
322
|
+
if (process.env.VERBOSE === 'true') {
|
|
323
|
+
this.logger.verbose('emitNonFinalChunk', {
|
|
324
|
+
useStream: this.config.useStream || false,
|
|
325
|
+
hasOnChunk: !!this.onChunk,
|
|
326
|
+
resultType: result?.type,
|
|
327
|
+
payloadKeys: payload?.data ? Object.keys(payload?.data) : [],
|
|
328
|
+
});
|
|
329
|
+
}
|
|
262
330
|
if (this.config.useStream && this.onChunk) {
|
|
263
331
|
await this.onChunk(new oResponse({
|
|
264
332
|
...payload,
|
|
@@ -276,6 +344,16 @@ export class oLane extends oObject {
|
|
|
276
344
|
try {
|
|
277
345
|
this.cid = await this.store();
|
|
278
346
|
this.logger.debug('Saving plan with CID: ', this.cid.toString());
|
|
347
|
+
if (process.env.VERBOSE === 'true') {
|
|
348
|
+
const serialized = JSON.stringify(this.storageManager.serialize());
|
|
349
|
+
this.logger.verbose('Postflight lane stored', {
|
|
350
|
+
cid: this.cid?.toString(),
|
|
351
|
+
serializedSize: serialized?.length,
|
|
352
|
+
persistToConfig: this.config.persistToConfig || false,
|
|
353
|
+
sequenceLength: this.sequence?.length,
|
|
354
|
+
resultType: response?.type,
|
|
355
|
+
});
|
|
356
|
+
}
|
|
279
357
|
// If this lane is marked for persistence to config, store it directly in os-config storage
|
|
280
358
|
if (this.config.persistToConfig && this.cid) {
|
|
281
359
|
try {
|
|
@@ -308,11 +386,26 @@ export class oLane extends oObject {
|
|
|
308
386
|
* This method loads a lane's execution sequence and replays it to restore network state
|
|
309
387
|
*/
|
|
310
388
|
async replay(cid) {
|
|
389
|
+
if (process.env.VERBOSE === 'true') {
|
|
390
|
+
this.logger.verbose('Lane replay starting', {
|
|
391
|
+
cid,
|
|
392
|
+
laneId: this.id,
|
|
393
|
+
intent: this.intent?.value,
|
|
394
|
+
});
|
|
395
|
+
}
|
|
311
396
|
this.status = oLaneStatus.RUNNING;
|
|
312
397
|
try {
|
|
313
398
|
const result = await this.storageManager.replay(cid);
|
|
314
399
|
this.result = result;
|
|
315
400
|
this.status = oLaneStatus.COMPLETED;
|
|
401
|
+
if (process.env.VERBOSE === 'true') {
|
|
402
|
+
this.logger.verbose('Lane replay completed', {
|
|
403
|
+
cid,
|
|
404
|
+
status: this.status,
|
|
405
|
+
resultType: result?.type,
|
|
406
|
+
sequenceLength: this.sequence?.length,
|
|
407
|
+
});
|
|
408
|
+
}
|
|
316
409
|
return result;
|
|
317
410
|
}
|
|
318
411
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o-prompt.d.ts","sourceRoot":"","sources":["../../../src/prompts/o-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,qBAAa,OAAQ,SAAQ,OAAO;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAkB;IACvC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAM;IAC7B,OAAO,CAAC,gBAAgB,CAAC,CAA6B;gBAE1C,MAAM,EAAE,aAAa;IAajC;;;OAGG;IACH,oBAAoB,IAAI,MAAM,EAAE;IAgBhC;;;OAGG;IACH,QAAQ,IAAI,IAAI;IAgBhB;;;;OAIG;IACH,OAAO,IAAI,MAAM;
|
|
1
|
+
{"version":3,"file":"o-prompt.d.ts","sourceRoot":"","sources":["../../../src/prompts/o-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,qBAAa,OAAQ,SAAQ,OAAO;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAkB;IACvC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAM;IAC7B,OAAO,CAAC,gBAAgB,CAAC,CAA6B;gBAE1C,MAAM,EAAE,aAAa;IAajC;;;OAGG;IACH,oBAAoB,IAAI,MAAM,EAAE;IAgBhC;;;OAGG;IACH,QAAQ,IAAI,IAAI;IAgBhB;;;;OAIG;IACH,OAAO,IAAI,MAAM;IAuCjB;;OAEG;IACH,MAAM,IAAI,MAAM;IAKhB,WAAW,IAAI,MAAM;IAIrB,OAAO,IAAI,eAAe;IAI1B,WAAW,IAAI,MAAM;IAIrB,SAAS,IAAI,GAAG;CAGjB"}
|
|
@@ -60,6 +60,16 @@ export class oPrompt extends oObject {
|
|
|
60
60
|
}
|
|
61
61
|
// Render the template with params
|
|
62
62
|
const result = this.compiledTemplate(this.params);
|
|
63
|
+
if (process.env.VERBOSE === 'true') {
|
|
64
|
+
this.logger.verbose('Prompt compiled', {
|
|
65
|
+
type: this.type,
|
|
66
|
+
provider: this.provider,
|
|
67
|
+
requiredVariables: this.getRequiredVariables(),
|
|
68
|
+
providedParams: Object.keys(this.params),
|
|
69
|
+
outputLength: result.length,
|
|
70
|
+
preview: result.substring(0, 300) + (result.length > 300 ? '...' : ''),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
63
73
|
return result;
|
|
64
74
|
}
|
|
65
75
|
catch (error) {
|
|
@@ -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,EACL,iBAAiB,EAGlB,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;
|
|
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,EAGlB,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;IAkC1B;;;;OAIG;IACG,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoD5E;;;;;OAKG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;IAoHjE;;;;;;OAMG;IACH,sBAAsB,CAAC,gBAAgB,EAAE,GAAG,GAAG,OAAO;IAItD;;;OAGG;IACH,YAAY,IAAI,GAAG,GAAG,SAAS;IAI/B;;OAEG;IACH,UAAU,IAAI,IAAI;CAGnB"}
|
|
@@ -64,10 +64,18 @@ export class oLaneStorageManager {
|
|
|
64
64
|
if (this.lane.node.state !== NodeState.RUNNING) {
|
|
65
65
|
throw new oError(oErrorCodes.INVALID_STATE, 'Node is not in a valid state to store a lane');
|
|
66
66
|
}
|
|
67
|
+
const serialized = JSON.stringify(this.serialize());
|
|
67
68
|
const params = {
|
|
68
69
|
key: cid.toString(),
|
|
69
|
-
value:
|
|
70
|
+
value: serialized,
|
|
70
71
|
};
|
|
72
|
+
if (process.env.VERBOSE === 'true') {
|
|
73
|
+
this.lane.logger.verbose('Storage save', {
|
|
74
|
+
cid: cid.toString(),
|
|
75
|
+
serializedSize: serialized.length,
|
|
76
|
+
sequenceLength: this.lane.sequence.length,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
71
79
|
this.lane.logger.debug('Storing lane params: ', params);
|
|
72
80
|
await this.lane.node.use(oAddress.lane(), {
|
|
73
81
|
method: 'put',
|
|
@@ -85,6 +93,14 @@ export class oLaneStorageManager {
|
|
|
85
93
|
try {
|
|
86
94
|
// Get the OS instance name from the node's system name
|
|
87
95
|
const systemName = this.lane.node.config.systemName || 'default-os';
|
|
96
|
+
if (process.env.VERBOSE === 'true') {
|
|
97
|
+
this.lane.logger.verbose('persistToConfig', {
|
|
98
|
+
systemName,
|
|
99
|
+
cid: cid.toString(),
|
|
100
|
+
hasAddressesToIndex: !!response?.result?.addresses_to_index,
|
|
101
|
+
addressesToIndex: response?.result?.addresses_to_index || [],
|
|
102
|
+
});
|
|
103
|
+
}
|
|
88
104
|
await this.lane.node.use(new oAddress('o://os-config'), {
|
|
89
105
|
method: 'add_lane_to_config',
|
|
90
106
|
params: {
|
|
@@ -137,12 +153,29 @@ export class oLaneStorageManager {
|
|
|
137
153
|
if (!storedLane.sequence || !Array.isArray(storedLane.sequence)) {
|
|
138
154
|
throw new Error('Invalid lane data: missing or invalid sequence');
|
|
139
155
|
}
|
|
156
|
+
if (process.env.VERBOSE === 'true') {
|
|
157
|
+
this.lane.logger.verbose('Replay loaded lane data', {
|
|
158
|
+
cid,
|
|
159
|
+
sequenceLength: storedLane.sequence.length,
|
|
160
|
+
configKeys: storedLane.config ? Object.keys(storedLane.config) : [],
|
|
161
|
+
hasResult: !!storedLane.result,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
140
164
|
// Iterate through the stored sequence and replay capabilities
|
|
141
|
-
for (
|
|
165
|
+
for (let i = 0; i < storedLane.sequence.length; i++) {
|
|
166
|
+
const sequenceItem = storedLane.sequence[i];
|
|
142
167
|
const capabilityType = sequenceItem.type;
|
|
143
168
|
// Determine if this capability should be replayed
|
|
144
169
|
if (this.shouldReplayCapability(sequenceItem)) {
|
|
145
170
|
this.lane.logger.debug(`Replaying capability: ${capabilityType}`);
|
|
171
|
+
if (process.env.VERBOSE === 'true') {
|
|
172
|
+
this.lane.logger.verbose('Replay step executing', {
|
|
173
|
+
stepIndex: i,
|
|
174
|
+
capabilityType,
|
|
175
|
+
hasTaskConfig: !!sequenceItem.result?.taskConfig,
|
|
176
|
+
method: sequenceItem.result?.taskConfig?.method,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
146
179
|
// Create a capability result with replay flag
|
|
147
180
|
const replayConfig = {
|
|
148
181
|
...sequenceItem.config,
|
|
@@ -179,10 +212,22 @@ export class oLaneStorageManager {
|
|
|
179
212
|
}
|
|
180
213
|
else {
|
|
181
214
|
this.lane.logger.debug(`Skipping capability (using cached result): ${capabilityType}`);
|
|
215
|
+
if (process.env.VERBOSE === 'true') {
|
|
216
|
+
this.lane.logger.verbose('Replay step skipped (cached)', {
|
|
217
|
+
stepIndex: i,
|
|
218
|
+
capabilityType,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
182
221
|
// Add the cached result to sequence without re-executing
|
|
183
222
|
this.lane.addSequence(sequenceItem);
|
|
184
223
|
}
|
|
185
224
|
}
|
|
225
|
+
if (process.env.VERBOSE === 'true') {
|
|
226
|
+
this.lane.logger.verbose('Replay completed', {
|
|
227
|
+
cid,
|
|
228
|
+
finalSequenceLength: this.lane.sequence.length,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
186
231
|
this.lane.logger.debug('Lane replay completed successfully');
|
|
187
232
|
return this.lane.result;
|
|
188
233
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/o-lane",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.17",
|
|
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.4",
|
|
38
38
|
"@eslint/js": "^10.0.1",
|
|
39
|
-
"@olane/o-test": "0.8.
|
|
39
|
+
"@olane/o-test": "0.8.17",
|
|
40
40
|
"@tsconfig/node20": "^20.1.9",
|
|
41
41
|
"@types/handlebars": "^4.1.0",
|
|
42
42
|
"@types/jest": "^30.0.0",
|
|
@@ -57,15 +57,15 @@
|
|
|
57
57
|
"typescript": "5.9.3"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@olane/o-config": "0.8.
|
|
61
|
-
"@olane/o-core": "0.8.
|
|
62
|
-
"@olane/o-node": "0.8.
|
|
63
|
-
"@olane/o-protocol": "0.8.
|
|
64
|
-
"@olane/o-storage": "0.8.
|
|
65
|
-
"@olane/o-tool": "0.8.
|
|
60
|
+
"@olane/o-config": "0.8.17",
|
|
61
|
+
"@olane/o-core": "0.8.17",
|
|
62
|
+
"@olane/o-node": "0.8.17",
|
|
63
|
+
"@olane/o-protocol": "0.8.17",
|
|
64
|
+
"@olane/o-storage": "0.8.17",
|
|
65
|
+
"@olane/o-tool": "0.8.17",
|
|
66
66
|
"debug": "^4.4.3",
|
|
67
67
|
"dotenv": "^17.3.1",
|
|
68
68
|
"handlebars": "^4.7.8"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "848be12a374d32f799026feecf15ada6bcf753ff"
|
|
71
71
|
}
|