@olane/o-lane 0.7.12-alpha.67 → 0.7.12-alpha.69
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/interfaces/o-capability.config.d.ts +2 -2
- package/dist/src/capabilities/interfaces/o-capability.config.d.ts.map +1 -1
- package/dist/src/capabilities/o-capability.d.ts +2 -2
- package/dist/src/capabilities/o-capability.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/interfaces/o-lane.config.d.ts +2 -2
- package/dist/src/interfaces/o-lane.config.d.ts.map +1 -1
- package/dist/src/o-lane.d.ts +1 -1
- package/dist/src/o-lane.d.ts.map +1 -1
- package/dist/src/o-lane.mixin.d.ts +17 -0
- package/dist/src/o-lane.mixin.d.ts.map +1 -0
- package/dist/src/o-lane.mixin.js +136 -0
- package/dist/src/o-lane.tool.d.ts +13 -20
- package/dist/src/o-lane.tool.d.ts.map +1 -1
- package/dist/src/o-lane.tool.js +12 -117
- package/package.json +7 -7
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { oIntent } from '../../intent/o-intent.js';
|
|
2
2
|
import { oLaneConfig } from '../../interfaces/o-lane.config.js';
|
|
3
|
-
import
|
|
3
|
+
import { oToolBase } from '@olane/o-tool';
|
|
4
4
|
export interface oCapabilityConfig {
|
|
5
|
-
node:
|
|
5
|
+
node: oToolBase;
|
|
6
6
|
intent: oIntent;
|
|
7
7
|
laneConfig: oLaneConfig;
|
|
8
8
|
history: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o-capability.config.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/interfaces/o-capability.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,
|
|
1
|
+
{"version":3,"file":"o-capability.config.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/interfaces/o-capability.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,MAAM,WAAW,iBAAiB;IAEhC,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,WAAW,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CAChC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { oObject } from '@olane/o-core';
|
|
2
|
+
import { oToolBase } from '@olane/o-tool';
|
|
2
3
|
import { oCapabilityConfig } from './interfaces/o-capability.config.js';
|
|
3
4
|
import { oCapabilityType } from './enums/o-capability.type-enum.js';
|
|
4
5
|
import { oCapabilityResult } from './o-capability.result.js';
|
|
5
|
-
import type { oLaneTool } from '../o-lane.tool.js';
|
|
6
6
|
import { oIntent } from '../intent/o-intent.js';
|
|
7
7
|
export declare abstract class oCapability extends oObject {
|
|
8
8
|
config: oCapabilityConfig;
|
|
9
9
|
abstract run(): Promise<oCapabilityResult>;
|
|
10
|
-
get node():
|
|
10
|
+
get node(): oToolBase;
|
|
11
11
|
execute(config: oCapabilityConfig): Promise<oCapabilityResult>;
|
|
12
12
|
get intent(): oIntent;
|
|
13
13
|
get type(): oCapabilityType;
|
|
@@ -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,
|
|
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,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,8BAAsB,WAAY,SAAQ,OAAO;IACxC,MAAM,EAAG,iBAAiB,CAAC;IAClC,QAAQ,CAAC,GAAG,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAE1C,IAAI,IAAI,IAAI,SAAS,CAEpB;IAEK,OAAO,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAKpE,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,IAAI,IAAI,oBAEP;IAED,MAAM,KAAK,IAAI,oBAEd;IAED,MAAM;CAGP"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './o-lane.js';
|
|
|
2
2
|
export * from './interfaces/index.js';
|
|
3
3
|
export * from './manager/o-lane.manager.js';
|
|
4
4
|
export * from './o-lane.context.js';
|
|
5
|
+
export * from './o-lane.mixin.js';
|
|
5
6
|
export * from './o-lane.tool.js';
|
|
6
7
|
export * from './capabilities/index.js';
|
|
7
8
|
export * from './intent/index.js';
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -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,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wCAAwC,CAAC;AACvD,cAAc,oDAAoD,CAAC;AACnE,cAAc,kDAAkD,CAAC;AACjE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0CAA0C,CAAC;AACzD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,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,oDAAoD,CAAC;AACnE,cAAc,kDAAkD,CAAC;AACjE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0CAA0C,CAAC;AACzD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export * from './o-lane.js';
|
|
|
2
2
|
export * from './interfaces/index.js';
|
|
3
3
|
export * from './manager/o-lane.manager.js';
|
|
4
4
|
export * from './o-lane.context.js';
|
|
5
|
+
export * from './o-lane.mixin.js';
|
|
5
6
|
export * from './o-lane.tool.js';
|
|
6
7
|
export * from './capabilities/index.js';
|
|
7
8
|
export * from './intent/index.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { oAddress } from '@olane/o-core';
|
|
2
|
+
import { oToolBase } from '@olane/o-tool';
|
|
2
3
|
import { oLaneContext } from '../o-lane.context.js';
|
|
3
4
|
import { oCapability } from '../capabilities/o-capability.js';
|
|
4
5
|
import { oIntent } from '../intent/o-intent.js';
|
|
5
|
-
import { oLaneTool } from '../o-lane.tool.js';
|
|
6
6
|
export interface oLaneConfig {
|
|
7
7
|
intent: oIntent;
|
|
8
8
|
caller: oAddress;
|
|
@@ -10,7 +10,7 @@ export interface oLaneConfig {
|
|
|
10
10
|
sequence?: any[];
|
|
11
11
|
streamTo?: oAddress;
|
|
12
12
|
capabilities?: oCapability[];
|
|
13
|
-
currentNode:
|
|
13
|
+
currentNode: oToolBase;
|
|
14
14
|
extraInstructions?: string;
|
|
15
15
|
parentLaneId?: string;
|
|
16
16
|
maxCycles?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o-lane.config.d.ts","sourceRoot":"","sources":["../../../src/interfaces/o-lane.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAS,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"o-lane.config.d.ts","sourceRoot":"","sources":["../../../src/interfaces/o-lane.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAS,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,MAAM,WAAW,WAAW;IAE1B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,QAAQ,CAAC;IAEjB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;IAEjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAI7B,WAAW,EAAE,SAAS,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B"}
|
package/dist/src/o-lane.d.ts
CHANGED
|
@@ -53,6 +53,6 @@ export declare class oLane extends oObject {
|
|
|
53
53
|
* Other capabilities use cached results
|
|
54
54
|
*/
|
|
55
55
|
private shouldReplayCapability;
|
|
56
|
-
get node(): import("
|
|
56
|
+
get node(): import("@olane/o-tool").oToolBase;
|
|
57
57
|
}
|
|
58
58
|
//# sourceMappingURL=o-lane.d.ts.map
|
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,EAKL,OAAO,EAGR,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAInC,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,EACL,iBAAiB,EACjB,iBAAiB,EAElB,MAAM,yBAAyB,CAAC;AAIjC,qBAAa,KAAM,SAAQ,OAAO;IAWpB,SAAS,CAAC,QAAQ,C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;OAGG;IACH,iBAAiB,IAAI,MAAM;IA+DrB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAW1B,OAAO,IAAI,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;IA4BvD,IAAI,YAAY,2DAEf;IAED,cAAc,CAAC,MAAM,EAAE,GAAG,GAAG,iBAAiB;IAcxC,YAAY,CAChB,WAAW,EAAE,iBAAiB,GAC7B,OAAO,CAAC,iBAAiB,CAAC;IA0BvB,IAAI,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAsDlC,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,GAAG;IAezD,UAAU,CACd,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;IAsDzC,MAAM;IASN;;;OAGG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;IAwEjE;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAS9B,IAAI,IAAI,sCAEP;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { oToolBase } from '@olane/o-tool';
|
|
2
|
+
/**
|
|
3
|
+
* withLane mixin - adds lane execution capabilities to any tool base class
|
|
4
|
+
* This mixin pattern allows lane functionality to be composed with different
|
|
5
|
+
* base classes (e.g., node-based, browser-based, or other implementations)
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Apply to node-based tool
|
|
10
|
+
* export class oLaneTool extends withLane(oNodeTool) {}
|
|
11
|
+
*
|
|
12
|
+
* // Future: Apply to browser-based tool
|
|
13
|
+
* export class oBrowserLaneTool extends withLane(oBrowserTool) {}
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function withLane<T extends new (...args: any[]) => oToolBase>(Base: T): T;
|
|
17
|
+
//# sourceMappingURL=o-lane.mixin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"o-lane.mixin.d.ts","sourceRoot":"","sources":["../../src/o-lane.mixin.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAQ1C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,SAAS,EAClE,IAAI,EAAE,CAAC,GACN,CAAC,CAiJH"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { CoreUtils, oAddress, oError, oErrorCodes, oResponse, } from '@olane/o-core';
|
|
2
|
+
import { oCapabilityType } from './capabilities/index.js';
|
|
3
|
+
import { oIntent } from './intent/index.js';
|
|
4
|
+
import { oLaneContext } from './o-lane.context.js';
|
|
5
|
+
import { oLaneManager } from './manager/o-lane.manager.js';
|
|
6
|
+
import { oCapabilityResult } from './capabilities/o-capability.result.js';
|
|
7
|
+
/**
|
|
8
|
+
* withLane mixin - adds lane execution capabilities to any tool base class
|
|
9
|
+
* This mixin pattern allows lane functionality to be composed with different
|
|
10
|
+
* base classes (e.g., node-based, browser-based, or other implementations)
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // Apply to node-based tool
|
|
15
|
+
* export class oLaneTool extends withLane(oNodeTool) {}
|
|
16
|
+
*
|
|
17
|
+
* // Future: Apply to browser-based tool
|
|
18
|
+
* export class oBrowserLaneTool extends withLane(oBrowserTool) {}
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export function withLane(Base) {
|
|
22
|
+
return class extends Base {
|
|
23
|
+
constructor(...args) {
|
|
24
|
+
super(...args);
|
|
25
|
+
this.manager = new oLaneManager();
|
|
26
|
+
}
|
|
27
|
+
async _tool_handshake(handshake) {
|
|
28
|
+
this.logger.debug('Performing handshake with intent: ', handshake.params.intent);
|
|
29
|
+
let tools = await this.myTools();
|
|
30
|
+
let methods = this.methods;
|
|
31
|
+
const { tool } = handshake.params;
|
|
32
|
+
if (tool) {
|
|
33
|
+
tools = tools.filter((t) => t === tool);
|
|
34
|
+
methods = { tool: this.methods[tool] };
|
|
35
|
+
}
|
|
36
|
+
return new oCapabilityResult({
|
|
37
|
+
result: {
|
|
38
|
+
tools: tools.filter((t) => t !== 'handshake' && t !== 'intent'),
|
|
39
|
+
methods: methods,
|
|
40
|
+
},
|
|
41
|
+
type: oCapabilityType.HANDSHAKE,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Where all intents go to be resolved.
|
|
46
|
+
* @param request
|
|
47
|
+
* @returns
|
|
48
|
+
*/
|
|
49
|
+
async _tool_intent(request) {
|
|
50
|
+
this.logger.debug('Intent resolution called: ', request.params);
|
|
51
|
+
const { intent, context, streamTo, _isStreaming = false } = request.params;
|
|
52
|
+
const pc = await this.manager.createLane({
|
|
53
|
+
intent: new oIntent({ intent: intent }),
|
|
54
|
+
currentNode: this,
|
|
55
|
+
caller: this.address,
|
|
56
|
+
streamTo: streamTo ? new oAddress(streamTo) : undefined,
|
|
57
|
+
useStream: _isStreaming,
|
|
58
|
+
requestId: request.id, // Pass request ID for proper response correlation
|
|
59
|
+
onChunk: _isStreaming
|
|
60
|
+
? async (chunk) => {
|
|
61
|
+
if (chunk?._last ||
|
|
62
|
+
chunk?.result?._last ||
|
|
63
|
+
chunk?.result?.data?._last) {
|
|
64
|
+
this.logger.error('UNEXPECTED LAST CHUNK RECEIVED', JSON.stringify(chunk, null, 2));
|
|
65
|
+
throw new oError(oErrorCodes.INVALID_ACTION, 'Misbehaving client sent unexpected last chunk');
|
|
66
|
+
}
|
|
67
|
+
await CoreUtils.sendStreamResponse(oResponse.fromJSON(chunk), request.stream);
|
|
68
|
+
}
|
|
69
|
+
: undefined,
|
|
70
|
+
context: context
|
|
71
|
+
? new oLaneContext([
|
|
72
|
+
`[Chat History Context Begin]\n${context}\n[Chat History Context End]`,
|
|
73
|
+
])
|
|
74
|
+
: undefined,
|
|
75
|
+
});
|
|
76
|
+
// TODO: brendon experiment review
|
|
77
|
+
// stream.addEventListener('close', () => {
|
|
78
|
+
// this.logger.debug('Stream closed, cancelling lane for intent:', intent);
|
|
79
|
+
// pc.cancel();
|
|
80
|
+
// });
|
|
81
|
+
let response;
|
|
82
|
+
response = await pc.execute();
|
|
83
|
+
const completeResponse = {
|
|
84
|
+
result: response?.result,
|
|
85
|
+
humanResult: response?.humanResult, // Full human-readable formatted result (AI-generated markdown)
|
|
86
|
+
summary: response?.config?.params?.summary, // Short 1-2 sentence summary
|
|
87
|
+
error: response?.error,
|
|
88
|
+
cycles: pc.sequence.length,
|
|
89
|
+
cid: pc.cid?.toString(),
|
|
90
|
+
sequence: pc.sequence.map((s) => {
|
|
91
|
+
return s.result;
|
|
92
|
+
}),
|
|
93
|
+
};
|
|
94
|
+
await new Promise((resolve) => setTimeout(resolve, 3000)); // TODO: fix this: wait for 3 seconds to let the stream send 2 messages lol
|
|
95
|
+
console.log('completeResponse', completeResponse);
|
|
96
|
+
return completeResponse;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Replay a stored lane from storage by CID
|
|
100
|
+
* This restores network state from a previously executed lane
|
|
101
|
+
* @param request - Request containing the CID of the lane to replay
|
|
102
|
+
* @returns The result of the replayed lane
|
|
103
|
+
*/
|
|
104
|
+
async _tool_replay(request) {
|
|
105
|
+
this.logger.debug('Lane replay called: ', request.params);
|
|
106
|
+
const { cid } = request.params;
|
|
107
|
+
if (!cid || typeof cid !== 'string') {
|
|
108
|
+
throw new Error('CID parameter is required and must be a string');
|
|
109
|
+
}
|
|
110
|
+
// Create a lane instance for replay
|
|
111
|
+
const lane = await this.manager.createLane({
|
|
112
|
+
intent: new oIntent({ intent: 'replay' }),
|
|
113
|
+
currentNode: this,
|
|
114
|
+
caller: this.address,
|
|
115
|
+
});
|
|
116
|
+
try {
|
|
117
|
+
const response = await lane.replay(cid);
|
|
118
|
+
this.logger.debug('Lane replay response: ', response);
|
|
119
|
+
return {
|
|
120
|
+
result: response?.result,
|
|
121
|
+
error: response?.error,
|
|
122
|
+
cycles: lane.sequence.length,
|
|
123
|
+
cid: cid,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
this.logger.error('Lane replay failed: ', error);
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
async teardown() {
|
|
132
|
+
await this.manager.teardown();
|
|
133
|
+
await super.teardown();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { oNodeConfig, oNodeTool } from '@olane/o-node';
|
|
2
|
+
declare const oLaneTool_base: typeof oNodeTool;
|
|
3
|
+
/**
|
|
4
|
+
* oLaneTool - Node-based tool with lane execution capabilities
|
|
5
|
+
* This class composes the withLane mixin with oNodeTool to provide
|
|
6
|
+
* a concrete implementation for node-based lane execution.
|
|
7
|
+
*
|
|
8
|
+
* All lane-specific functionality is provided by the withLane mixin,
|
|
9
|
+
* making this implementation backward compatible while enabling
|
|
10
|
+
* future flexibility to apply lane capabilities to other base classes.
|
|
11
|
+
*/
|
|
12
|
+
export declare class oLaneTool extends oLaneTool_base {
|
|
6
13
|
constructor(config: oNodeConfig);
|
|
7
|
-
_tool_handshake(handshake: oRequest): Promise<oHandshakeResult>;
|
|
8
|
-
/**
|
|
9
|
-
* Where all intents go to be resolved.
|
|
10
|
-
* @param request
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
_tool_intent(request: oStreamRequest): Promise<any>;
|
|
14
|
-
/**
|
|
15
|
-
* Replay a stored lane from storage by CID
|
|
16
|
-
* This restores network state from a previously executed lane
|
|
17
|
-
* @param request - Request containing the CID of the lane to replay
|
|
18
|
-
* @returns The result of the replayed lane
|
|
19
|
-
*/
|
|
20
|
-
_tool_replay(request: oRequest): Promise<any>;
|
|
21
|
-
teardown(): Promise<void>;
|
|
22
14
|
}
|
|
15
|
+
export {};
|
|
23
16
|
//# sourceMappingURL=o-lane.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"o-lane.tool.d.ts","sourceRoot":"","sources":["../../src/o-lane.tool.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"o-lane.tool.d.ts","sourceRoot":"","sources":["../../src/o-lane.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;;AAGvD;;;;;;;;GAQG;AACH,qBAAa,SAAU,SAAQ,cAAmB;gBACpC,MAAM,EAAE,WAAW;CAGhC"}
|
package/dist/src/o-lane.tool.js
CHANGED
|
@@ -1,121 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { oNodeTool } from '@olane/o-node';
|
|
2
|
+
import { withLane } from './o-lane.mixin.js';
|
|
3
|
+
/**
|
|
4
|
+
* oLaneTool - Node-based tool with lane execution capabilities
|
|
5
|
+
* This class composes the withLane mixin with oNodeTool to provide
|
|
6
|
+
* a concrete implementation for node-based lane execution.
|
|
7
|
+
*
|
|
8
|
+
* All lane-specific functionality is provided by the withLane mixin,
|
|
9
|
+
* making this implementation backward compatible while enabling
|
|
10
|
+
* future flexibility to apply lane capabilities to other base classes.
|
|
11
|
+
*/
|
|
12
|
+
export class oLaneTool extends withLane(oNodeTool) {
|
|
9
13
|
constructor(config) {
|
|
10
14
|
super(config);
|
|
11
|
-
this.manager = new oLaneManager();
|
|
12
|
-
}
|
|
13
|
-
async _tool_handshake(handshake) {
|
|
14
|
-
this.logger.debug('Performing handshake with intent: ', handshake.params.intent);
|
|
15
|
-
let tools = await this.myTools();
|
|
16
|
-
let methods = this.methods;
|
|
17
|
-
const { tool } = handshake.params;
|
|
18
|
-
if (tool) {
|
|
19
|
-
tools = tools.filter((t) => t === tool);
|
|
20
|
-
methods = { tool: this.methods[tool] };
|
|
21
|
-
}
|
|
22
|
-
return new oCapabilityResult({
|
|
23
|
-
result: {
|
|
24
|
-
tools: tools.filter((t) => t !== 'handshake' && t !== 'intent'),
|
|
25
|
-
methods: methods,
|
|
26
|
-
},
|
|
27
|
-
type: oCapabilityType.HANDSHAKE,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Where all intents go to be resolved.
|
|
32
|
-
* @param request
|
|
33
|
-
* @returns
|
|
34
|
-
*/
|
|
35
|
-
async _tool_intent(request) {
|
|
36
|
-
this.logger.debug('Intent resolution called: ', request.params);
|
|
37
|
-
const { intent, context, streamTo, _isStreaming = false } = request.params;
|
|
38
|
-
const pc = await this.manager.createLane({
|
|
39
|
-
intent: new oIntent({ intent: intent }),
|
|
40
|
-
currentNode: this,
|
|
41
|
-
caller: this.address,
|
|
42
|
-
streamTo: streamTo ? new oAddress(streamTo) : undefined,
|
|
43
|
-
useStream: _isStreaming,
|
|
44
|
-
requestId: request.id, // Pass request ID for proper response correlation
|
|
45
|
-
onChunk: _isStreaming
|
|
46
|
-
? async (chunk) => {
|
|
47
|
-
if (chunk?._last ||
|
|
48
|
-
chunk?.result?._last ||
|
|
49
|
-
chunk?.result?.data?._last) {
|
|
50
|
-
this.logger.error('UNEXPECTED LAST CHUNK RECEIVED', JSON.stringify(chunk, null, 2));
|
|
51
|
-
throw new oError(oErrorCodes.INVALID_ACTION, 'Misbehaving client sent unexpected last chunk');
|
|
52
|
-
}
|
|
53
|
-
await CoreUtils.sendStreamResponse(oResponse.fromJSON(chunk), request.stream);
|
|
54
|
-
}
|
|
55
|
-
: undefined,
|
|
56
|
-
context: context
|
|
57
|
-
? new oLaneContext([
|
|
58
|
-
`[Chat History Context Begin]\n${context}\n[Chat History Context End]`,
|
|
59
|
-
])
|
|
60
|
-
: undefined,
|
|
61
|
-
});
|
|
62
|
-
// TODO: brendon experiment review
|
|
63
|
-
// stream.addEventListener('close', () => {
|
|
64
|
-
// this.logger.debug('Stream closed, cancelling lane for intent:', intent);
|
|
65
|
-
// pc.cancel();
|
|
66
|
-
// });
|
|
67
|
-
let response;
|
|
68
|
-
response = await pc.execute();
|
|
69
|
-
const completeResponse = {
|
|
70
|
-
result: response?.result,
|
|
71
|
-
humanResult: response?.humanResult, // Full human-readable formatted result (AI-generated markdown)
|
|
72
|
-
summary: response?.config?.params?.summary, // Short 1-2 sentence summary
|
|
73
|
-
error: response?.error,
|
|
74
|
-
cycles: pc.sequence.length,
|
|
75
|
-
cid: pc.cid?.toString(),
|
|
76
|
-
sequence: pc.sequence.map((s) => {
|
|
77
|
-
return s.result;
|
|
78
|
-
}),
|
|
79
|
-
};
|
|
80
|
-
await new Promise((resolve) => setTimeout(resolve, 3000)); // TODO: fix this: wait for 3 seconds to let the stream send 2 messages lol
|
|
81
|
-
console.log('completeResponse', completeResponse);
|
|
82
|
-
return completeResponse;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Replay a stored lane from storage by CID
|
|
86
|
-
* This restores network state from a previously executed lane
|
|
87
|
-
* @param request - Request containing the CID of the lane to replay
|
|
88
|
-
* @returns The result of the replayed lane
|
|
89
|
-
*/
|
|
90
|
-
async _tool_replay(request) {
|
|
91
|
-
this.logger.debug('Lane replay called: ', request.params);
|
|
92
|
-
const { cid } = request.params;
|
|
93
|
-
if (!cid || typeof cid !== 'string') {
|
|
94
|
-
throw new Error('CID parameter is required and must be a string');
|
|
95
|
-
}
|
|
96
|
-
// Create a lane instance for replay
|
|
97
|
-
const lane = await this.manager.createLane({
|
|
98
|
-
intent: new oIntent({ intent: 'replay' }),
|
|
99
|
-
currentNode: this,
|
|
100
|
-
caller: this.address,
|
|
101
|
-
});
|
|
102
|
-
try {
|
|
103
|
-
const response = await lane.replay(cid);
|
|
104
|
-
this.logger.debug('Lane replay response: ', response);
|
|
105
|
-
return {
|
|
106
|
-
result: response?.result,
|
|
107
|
-
error: response?.error,
|
|
108
|
-
cycles: lane.sequence.length,
|
|
109
|
-
cid: cid,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
catch (error) {
|
|
113
|
-
this.logger.error('Lane replay failed: ', error);
|
|
114
|
-
throw error;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
async teardown() {
|
|
118
|
-
await this.manager.teardown();
|
|
119
|
-
await super.teardown();
|
|
120
15
|
}
|
|
121
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/o-lane",
|
|
3
|
-
"version": "0.7.12-alpha.
|
|
3
|
+
"version": "0.7.12-alpha.69",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
"typescript": "5.4.5"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@olane/o-config": "0.7.12-alpha.
|
|
58
|
-
"@olane/o-core": "0.7.12-alpha.
|
|
59
|
-
"@olane/o-node": "0.7.12-alpha.
|
|
60
|
-
"@olane/o-protocol": "0.7.12-alpha.
|
|
61
|
-
"@olane/o-tool": "0.7.12-alpha.
|
|
57
|
+
"@olane/o-config": "0.7.12-alpha.69",
|
|
58
|
+
"@olane/o-core": "0.7.12-alpha.69",
|
|
59
|
+
"@olane/o-node": "0.7.12-alpha.69",
|
|
60
|
+
"@olane/o-protocol": "0.7.12-alpha.69",
|
|
61
|
+
"@olane/o-tool": "0.7.12-alpha.69",
|
|
62
62
|
"debug": "^4.4.1",
|
|
63
63
|
"dotenv": "^16.5.0"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "7c99a936a1ae14a70c1703d1b06f55d6a937f9ce"
|
|
66
66
|
}
|