@olane/os 0.7.17 → 0.7.19
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,68 +1 @@
|
|
|
1
|
-
import { oLaneTool, oIntent, oCapabilityConfig } from '@olane/o-lane';
|
|
2
|
-
import { OlaneOS } from '../../../src/o-olane-os/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* Create a test OS instance for capability testing
|
|
5
|
-
*/
|
|
6
|
-
export declare function createTestOS(): Promise<OlaneOS>;
|
|
7
|
-
/**
|
|
8
|
-
* Create a test lane tool node
|
|
9
|
-
*/
|
|
10
|
-
export declare function createTestLaneTool(_os: OlaneOS): Promise<oLaneTool>;
|
|
11
|
-
/**
|
|
12
|
-
* Create a mock intent for testing
|
|
13
|
-
*/
|
|
14
|
-
export declare function createMockIntent(intent: string, params?: any): oIntent;
|
|
15
|
-
/**
|
|
16
|
-
* Create a mock capability config for testing
|
|
17
|
-
*/
|
|
18
|
-
export declare function createMockCapabilityConfig(node: oLaneTool, intent: string, params?: any, options?: {
|
|
19
|
-
useStream?: boolean;
|
|
20
|
-
onChunk?: (chunk: any) => void;
|
|
21
|
-
isReplay?: boolean;
|
|
22
|
-
}): oCapabilityConfig;
|
|
23
|
-
/**
|
|
24
|
-
* Create a mock tool for testing task capabilities
|
|
25
|
-
*/
|
|
26
|
-
export declare function createMockTool(_os: OlaneOS, methods: Record<string, Function>): Promise<import("@olane/o-client-limited").oLimitedTool>;
|
|
27
|
-
/**
|
|
28
|
-
* Wait for a condition to be true
|
|
29
|
-
*/
|
|
30
|
-
export declare function waitFor(condition: () => boolean | Promise<boolean>, timeout?: number, interval?: number): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Capture streaming chunks for testing
|
|
33
|
-
*/
|
|
34
|
-
export declare class ChunkCapture {
|
|
35
|
-
private chunks;
|
|
36
|
-
get allChunks(): any[];
|
|
37
|
-
get chunkCount(): number;
|
|
38
|
-
get lastChunk(): any | undefined;
|
|
39
|
-
onChunk: (chunk: any) => void;
|
|
40
|
-
clear(): void;
|
|
41
|
-
waitForChunks(count: number, timeout?: number): Promise<void>;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Common test fixtures
|
|
45
|
-
*/
|
|
46
|
-
export declare const TEST_FIXTURES: {
|
|
47
|
-
simpleIntent: string;
|
|
48
|
-
searchIntent: string;
|
|
49
|
-
configureIntent: string;
|
|
50
|
-
evaluateIntent: string;
|
|
51
|
-
multiStepIntent: string;
|
|
52
|
-
mockHistory: string;
|
|
53
|
-
mockToolMethods: {
|
|
54
|
-
testMethod: (param1: string, param2: number) => Promise<string>;
|
|
55
|
-
asyncMethod: () => Promise<string>;
|
|
56
|
-
errorMethod: () => Promise<never>;
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Assertion helpers
|
|
61
|
-
*/
|
|
62
|
-
export declare const assertCapabilityResult: {
|
|
63
|
-
isSuccess(result: any): void;
|
|
64
|
-
hasType(result: any, expectedType: string): void;
|
|
65
|
-
hasResult(result: any): void;
|
|
66
|
-
isError(result: any, expectedError?: string): void;
|
|
67
|
-
};
|
|
68
1
|
//# sourceMappingURL=capability-test-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability-test-utils.d.ts","sourceRoot":"","sources":["../../../../test/capabilities/utils/capability-test-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"capability-test-utils.d.ts","sourceRoot":"","sources":["../../../../test/capabilities/utils/capability-test-utils.ts"],"names":[],"mappings":""}
|
|
@@ -1,161 +1,173 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { oAddress, NodeType } from '@olane/o-core';
|
|
3
|
+
// import { oLaneTool, oIntent, oCapabilityConfig, oLaneConfig } from '@olane/o-lane';
|
|
4
|
+
// import { OlaneOS } from '../../../src/o-olane-os/index.js';
|
|
5
|
+
// import { tmpNode } from '../../utils/tmp.node.js';
|
|
6
|
+
// /**
|
|
7
|
+
// * Create a test OS instance for capability testing
|
|
8
|
+
// */
|
|
9
|
+
// export async function createTestOS(): Promise<OlaneOS> {
|
|
10
|
+
// const os = new OlaneOS({
|
|
11
|
+
// nodes: [
|
|
12
|
+
// {
|
|
13
|
+
// type: NodeType.LEADER,
|
|
14
|
+
// address: new oAddress('o://test-leader'),
|
|
15
|
+
// leader: null,
|
|
16
|
+
// parent: null,
|
|
17
|
+
// name: 'Test Leader',
|
|
18
|
+
// description: 'Test leader node for capability testing'
|
|
19
|
+
// }
|
|
20
|
+
// ],
|
|
21
|
+
// lanes: []
|
|
22
|
+
// });
|
|
23
|
+
// await os.start();
|
|
24
|
+
// return os;
|
|
25
|
+
// }
|
|
26
|
+
// /**
|
|
27
|
+
// * Create a test lane tool node
|
|
28
|
+
// */
|
|
29
|
+
// export async function createTestLaneTool(_os: OlaneOS): Promise<oLaneTool> {
|
|
30
|
+
// // Return tmpNode as a lane tool for testing
|
|
31
|
+
// return tmpNode as unknown as oLaneTool;
|
|
32
|
+
// }
|
|
33
|
+
// /**
|
|
34
|
+
// * Create a mock intent for testing
|
|
35
|
+
// */
|
|
36
|
+
// export function createMockIntent(intent: string, params?: any): oIntent {
|
|
37
|
+
// return new oIntent({ intent });
|
|
38
|
+
// }
|
|
39
|
+
// /**
|
|
40
|
+
// * Create a mock capability config for testing
|
|
41
|
+
// */
|
|
42
|
+
// export function createMockCapabilityConfig(
|
|
43
|
+
// node: oLaneTool,
|
|
44
|
+
// intent: string,
|
|
45
|
+
// params?: any,
|
|
46
|
+
// options?: {
|
|
47
|
+
// useStream?: boolean;
|
|
48
|
+
// onChunk?: (chunk: any) => void;
|
|
49
|
+
// isReplay?: boolean;
|
|
50
|
+
// }
|
|
51
|
+
// ): oCapabilityConfig {
|
|
52
|
+
// return {
|
|
53
|
+
// node,
|
|
54
|
+
// intent: createMockIntent(intent, params),
|
|
55
|
+
// laneConfig: {
|
|
56
|
+
// maxCycles: 20,
|
|
57
|
+
// useStream: options?.useStream || false
|
|
58
|
+
// } as oLaneConfig,
|
|
59
|
+
// history: '',
|
|
60
|
+
// params: params || {},
|
|
61
|
+
// isReplay: options?.isReplay || false,
|
|
62
|
+
// useStream: options?.useStream || false,
|
|
63
|
+
// onChunk: options?.onChunk
|
|
64
|
+
// };
|
|
65
|
+
// }
|
|
66
|
+
// /**
|
|
67
|
+
// * Create a mock tool for testing task capabilities
|
|
68
|
+
// */
|
|
69
|
+
// export async function createMockTool(_os: OlaneOS, methods: Record<string, Function>) {
|
|
70
|
+
// // Use tmpNode as base tool for testing
|
|
71
|
+
// const tool = tmpNode;
|
|
72
|
+
// // Add methods to the tool
|
|
73
|
+
// Object.entries(methods).forEach(([methodName, methodFn]) => {
|
|
74
|
+
// (tool as any)[methodName] = methodFn;
|
|
75
|
+
// });
|
|
76
|
+
// return tool;
|
|
77
|
+
// }
|
|
78
|
+
// /**
|
|
79
|
+
// * Wait for a condition to be true
|
|
80
|
+
// */
|
|
81
|
+
// export async function waitFor(
|
|
82
|
+
// condition: () => boolean | Promise<boolean>,
|
|
83
|
+
// timeout: number = 5000,
|
|
84
|
+
// interval: number = 100
|
|
85
|
+
// ): Promise<void> {
|
|
86
|
+
// const startTime = Date.now();
|
|
87
|
+
// while (Date.now() - startTime < timeout) {
|
|
88
|
+
// const result = await Promise.resolve(condition());
|
|
89
|
+
// if (result) {
|
|
90
|
+
// return;
|
|
91
|
+
// }
|
|
92
|
+
// await new Promise(resolve => setTimeout(resolve, interval));
|
|
93
|
+
// }
|
|
94
|
+
// throw new Error(`Condition not met within ${timeout}ms`);
|
|
95
|
+
// }
|
|
96
|
+
// /**
|
|
97
|
+
// * Capture streaming chunks for testing
|
|
98
|
+
// */
|
|
99
|
+
// export class ChunkCapture {
|
|
100
|
+
// private chunks: any[] = [];
|
|
101
|
+
// get allChunks(): any[] {
|
|
102
|
+
// return [...this.chunks];
|
|
103
|
+
// }
|
|
104
|
+
// get chunkCount(): number {
|
|
105
|
+
// return this.chunks.length;
|
|
106
|
+
// }
|
|
107
|
+
// get lastChunk(): any | undefined {
|
|
108
|
+
// return this.chunks[this.chunks.length - 1];
|
|
109
|
+
// }
|
|
110
|
+
// onChunk = (chunk: any): void => {
|
|
111
|
+
// this.chunks.push(chunk);
|
|
112
|
+
// };
|
|
113
|
+
// clear(): void {
|
|
114
|
+
// this.chunks = [];
|
|
115
|
+
// }
|
|
116
|
+
// waitForChunks(count: number, timeout: number = 5000): Promise<void> {
|
|
117
|
+
// return waitFor(() => this.chunks.length >= count, timeout);
|
|
118
|
+
// }
|
|
119
|
+
// }
|
|
120
|
+
// /**
|
|
121
|
+
// * Common test fixtures
|
|
122
|
+
// */
|
|
123
|
+
// export const TEST_FIXTURES = {
|
|
124
|
+
// simpleIntent: 'Execute a simple test task',
|
|
125
|
+
// searchIntent: 'Search for information about testing',
|
|
126
|
+
// configureIntent: 'Configure the test tool',
|
|
127
|
+
// evaluateIntent: 'Evaluate the test scenario',
|
|
128
|
+
// multiStepIntent: 'Execute multiple test steps',
|
|
129
|
+
// mockHistory: `Previous execution history:
|
|
130
|
+
// - Evaluated intent
|
|
131
|
+
// - Configured tool
|
|
132
|
+
// - Executed task`,
|
|
133
|
+
// mockToolMethods: {
|
|
134
|
+
// testMethod: async (param1: string, param2: number) => {
|
|
135
|
+
// return `Executed with ${param1} and ${param2}`;
|
|
136
|
+
// },
|
|
137
|
+
// asyncMethod: async () => {
|
|
138
|
+
// await new Promise(resolve => setTimeout(resolve, 100));
|
|
139
|
+
// return 'Async result';
|
|
140
|
+
// },
|
|
141
|
+
// errorMethod: async () => {
|
|
142
|
+
// throw new Error('Test error from method');
|
|
143
|
+
// }
|
|
144
|
+
// }
|
|
145
|
+
// };
|
|
146
|
+
// /**
|
|
147
|
+
// * Assertion helpers
|
|
148
|
+
// */
|
|
149
|
+
// export const assertCapabilityResult = {
|
|
150
|
+
// isSuccess(result: any): void {
|
|
151
|
+
// if (result.error) {
|
|
152
|
+
// throw new Error(`Expected success but got error: ${result.error}`);
|
|
153
|
+
// }
|
|
154
|
+
// },
|
|
155
|
+
// hasType(result: any, expectedType: string): void {
|
|
156
|
+
// if (result.type !== expectedType) {
|
|
157
|
+
// throw new Error(`Expected type ${expectedType} but got ${result.type}`);
|
|
158
|
+
// }
|
|
159
|
+
// },
|
|
160
|
+
// hasResult(result: any): void {
|
|
161
|
+
// if (!result.result && !result.humanResult) {
|
|
162
|
+
// throw new Error('Expected result to have result or humanResult');
|
|
163
|
+
// }
|
|
164
|
+
// },
|
|
165
|
+
// isError(result: any, expectedError?: string): void {
|
|
166
|
+
// if (!result.error) {
|
|
167
|
+
// throw new Error('Expected error but got success');
|
|
168
|
+
// }
|
|
169
|
+
// if (expectedError && !result.error.includes(expectedError)) {
|
|
170
|
+
// throw new Error(`Expected error containing "${expectedError}" but got "${result.error}"`);
|
|
171
|
+
// }
|
|
172
|
+
// }
|
|
173
|
+
// };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olane/os",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -58,23 +58,23 @@
|
|
|
58
58
|
"typescript": "5.4.5"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@olane/o-client-limited": "0.7.
|
|
62
|
-
"@olane/o-config": "0.7.
|
|
63
|
-
"@olane/o-core": "0.7.
|
|
64
|
-
"@olane/o-intelligence": "0.7.
|
|
65
|
-
"@olane/o-lane": "0.7.
|
|
66
|
-
"@olane/o-leader": "0.7.
|
|
67
|
-
"@olane/o-login": "0.7.
|
|
68
|
-
"@olane/o-protocol": "0.7.
|
|
69
|
-
"@olane/o-storage": "0.7.
|
|
70
|
-
"@olane/o-tool": "0.7.
|
|
71
|
-
"@olane/o-tool-registry": "0.7.
|
|
72
|
-
"@olane/o-tools-common": "0.7.
|
|
61
|
+
"@olane/o-client-limited": "0.7.19",
|
|
62
|
+
"@olane/o-config": "0.7.19",
|
|
63
|
+
"@olane/o-core": "0.7.19",
|
|
64
|
+
"@olane/o-intelligence": "0.7.19",
|
|
65
|
+
"@olane/o-lane": "0.7.19",
|
|
66
|
+
"@olane/o-leader": "0.7.19",
|
|
67
|
+
"@olane/o-login": "0.7.19",
|
|
68
|
+
"@olane/o-protocol": "0.7.19",
|
|
69
|
+
"@olane/o-storage": "0.7.19",
|
|
70
|
+
"@olane/o-tool": "0.7.19",
|
|
71
|
+
"@olane/o-tool-registry": "0.7.19",
|
|
72
|
+
"@olane/o-tools-common": "0.7.19",
|
|
73
73
|
"chalk": "^5.4.1",
|
|
74
74
|
"debug": "^4.4.1",
|
|
75
75
|
"dotenv": "^16.5.0",
|
|
76
76
|
"fs-extra": "^11.3.0",
|
|
77
77
|
"touch": "^3.1.1"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "956ef7a726e5ac2efb7028ffca707ec1cf6ea131"
|
|
80
80
|
}
|