@olane/o-lane 0.7.12-alpha.66 → 0.7.12-alpha.68

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,8 +1,8 @@
1
1
  import { oIntent } from '../../intent/o-intent.js';
2
2
  import { oLaneConfig } from '../../interfaces/o-lane.config.js';
3
- import type { oLaneTool } from '../../o-lane.tool.js';
3
+ import { oToolBase } from '@olane/o-tool';
4
4
  export interface oCapabilityConfig {
5
- node: oLaneTool;
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,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,WAAW,iBAAiB;IAChC,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
+ {"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(): oLaneTool;
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,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,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"}
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"}
@@ -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 +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,12 +10,13 @@ export interface oLaneConfig {
10
10
  sequence?: any[];
11
11
  streamTo?: oAddress;
12
12
  capabilities?: oCapability[];
13
- currentNode: oLaneTool;
13
+ currentNode: oToolBase;
14
14
  extraInstructions?: string;
15
15
  parentLaneId?: string;
16
16
  maxCycles?: number;
17
17
  persistToConfig?: boolean;
18
18
  onChunk?: (chunk: any) => void;
19
19
  useStream?: boolean;
20
+ requestId?: string | number;
20
21
  }
21
22
  //# sourceMappingURL=o-lane.config.d.ts.map
@@ -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,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,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;IAG7B,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;CACrB"}
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"}
@@ -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("./o-lane.tool.js").oLaneTool;
56
+ get node(): import("@olane/o-tool").oToolBase;
57
57
  }
58
58
  //# sourceMappingURL=o-lane.d.ts.map
@@ -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,CAAC,MAAM,EAAE,WAAW;IAV3C,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;gBAEP,MAAM,EAAE,WAAW;IAalD,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,UAAU,IAAI,GAAG;IAQjB,MAAM;;;;;IAQN,WAAW,CAAC,MAAM,EAAE,iBAAiB;IAgB/B,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC;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,CAAC,iBAAiB,GAAG,SAAS,CAAC;IAwEjE;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAS9B,IAAI,IAAI,sCAEP;CACF"}
@@ -318,7 +318,7 @@ export class oLane extends oObject {
318
318
  _isStreaming: true,
319
319
  _connectionId: this.node.address.toString(),
320
320
  _requestMethod: 'unknown',
321
- id: uuidv4(),
321
+ id: this.config.requestId ?? uuidv4(), // Use request ID for proper correlation, fallback to UUID
322
322
  }));
323
323
  }
324
324
  }
@@ -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 { oRequest } from '@olane/o-core';
2
- import { oNodeConfig, oNodeTool, oStreamRequest } from '@olane/o-node';
3
- import { oHandshakeResult } from './interfaces/index.js';
4
- export declare class oLaneTool extends oNodeTool {
5
- private manager;
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,EAKL,QAAQ,EAET,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,WAAW,EACX,SAAS,EACT,cAAc,EAEf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAQzD,qBAAa,SAAU,SAAQ,SAAS;IACtC,OAAO,CAAC,OAAO,CAAe;gBAElB,MAAM,EAAE,WAAW;IAKzB,eAAe,CAAC,SAAS,EAAE,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAyBrE;;;;OAIG;IACG,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC;IA4DzD;;;;;OAKG;IACG,YAAY,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;IA8B7C,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAIhC"}
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"}
@@ -1,118 +1,16 @@
1
- import { CoreUtils, oAddress, oError, oErrorCodes, oResponse, } from '@olane/o-core';
2
- import { oNodeTool, } from '@olane/o-node';
3
- import { oCapabilityType } from './capabilities/index.js';
4
- import { oIntent } from './intent/index.js';
5
- import { oLaneContext } from './o-lane.context.js';
6
- import { oLaneManager } from './manager/o-lane.manager.js';
7
- import { oCapabilityResult } from './capabilities/o-capability.result.js';
8
- export class oLaneTool extends oNodeTool {
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
- onChunk: _isStreaming
45
- ? async (chunk) => {
46
- if (chunk?._last || chunk?.result?._last) {
47
- this.logger.error('UNEXPECTED LAST CHUNK RECEIVED', JSON.stringify(chunk, null, 2));
48
- throw new oError(oErrorCodes.INVALID_ACTION, 'Misbehaving client sent unexpected last chunk');
49
- }
50
- await CoreUtils.sendStreamResponse(oResponse.fromJSON(chunk), request.stream);
51
- }
52
- : undefined,
53
- context: context
54
- ? new oLaneContext([
55
- `[Chat History Context Begin]\n${context}\n[Chat History Context End]`,
56
- ])
57
- : undefined,
58
- });
59
- // TODO: brendon experiment review
60
- // stream.addEventListener('close', () => {
61
- // this.logger.debug('Stream closed, cancelling lane for intent:', intent);
62
- // pc.cancel();
63
- // });
64
- let response;
65
- response = await pc.execute();
66
- const completeResponse = {
67
- result: response?.result,
68
- humanResult: response?.humanResult, // Full human-readable formatted result (AI-generated markdown)
69
- summary: response?.config?.params?.summary, // Short 1-2 sentence summary
70
- error: response?.error,
71
- cycles: pc.sequence.length,
72
- cid: pc.cid?.toString(),
73
- sequence: pc.sequence.map((s) => {
74
- return s.result;
75
- }),
76
- };
77
- await new Promise((resolve) => setTimeout(resolve, 3000)); // TODO: fix this: wait for 3 seconds to let the stream send 2 messages lol
78
- console.log('completeResponse', completeResponse);
79
- return completeResponse;
80
- }
81
- /**
82
- * Replay a stored lane from storage by CID
83
- * This restores network state from a previously executed lane
84
- * @param request - Request containing the CID of the lane to replay
85
- * @returns The result of the replayed lane
86
- */
87
- async _tool_replay(request) {
88
- this.logger.debug('Lane replay called: ', request.params);
89
- const { cid } = request.params;
90
- if (!cid || typeof cid !== 'string') {
91
- throw new Error('CID parameter is required and must be a string');
92
- }
93
- // Create a lane instance for replay
94
- const lane = await this.manager.createLane({
95
- intent: new oIntent({ intent: 'replay' }),
96
- currentNode: this,
97
- caller: this.address,
98
- });
99
- try {
100
- const response = await lane.replay(cid);
101
- this.logger.debug('Lane replay response: ', response);
102
- return {
103
- result: response?.result,
104
- error: response?.error,
105
- cycles: lane.sequence.length,
106
- cid: cid,
107
- };
108
- }
109
- catch (error) {
110
- this.logger.error('Lane replay failed: ', error);
111
- throw error;
112
- }
113
- }
114
- async teardown() {
115
- await this.manager.teardown();
116
- await super.teardown();
117
15
  }
118
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olane/o-lane",
3
- "version": "0.7.12-alpha.66",
3
+ "version": "0.7.12-alpha.68",
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.66",
58
- "@olane/o-core": "0.7.12-alpha.66",
59
- "@olane/o-node": "0.7.12-alpha.66",
60
- "@olane/o-protocol": "0.7.12-alpha.66",
61
- "@olane/o-tool": "0.7.12-alpha.66",
57
+ "@olane/o-config": "0.7.12-alpha.68",
58
+ "@olane/o-core": "0.7.12-alpha.68",
59
+ "@olane/o-node": "0.7.12-alpha.68",
60
+ "@olane/o-protocol": "0.7.12-alpha.68",
61
+ "@olane/o-tool": "0.7.12-alpha.68",
62
62
  "debug": "^4.4.1",
63
63
  "dotenv": "^16.5.0"
64
64
  },
65
- "gitHead": "879cb37d1e93b54a1e5d804987daf478fcc2722f"
65
+ "gitHead": "3ffe39de1430bed3673c13adc1b144f9016967dc"
66
66
  }