@olane/os 0.7.18 → 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":"AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB,EAAe,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAG3D;;GAEG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC,CAiBrD;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAGzE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAEtE;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,GAAG,EACZ,OAAO,CAAC,EAAE;IACR,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GACA,iBAAiB,CAcnB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,2DAUnF;AAED;;GAEG;AACH,wBAAsB,OAAO,CAC3B,SAAS,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EAC3C,OAAO,GAAE,MAAa,EACtB,QAAQ,GAAE,MAAY,GACrB,OAAO,CAAC,IAAI,CAAC,CAYf;AAED;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAa;IAE3B,IAAI,SAAS,IAAI,GAAG,EAAE,CAErB;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,IAAI,SAAS,IAAI,GAAG,GAAG,SAAS,CAE/B;IAED,OAAO,UAAW,GAAG,KAAG,IAAI,CAE1B;IAEF,KAAK,IAAI,IAAI;IAIb,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,MAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpE;AAED;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;6BAaK,MAAM,UAAU,MAAM;;;;CAapD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB;sBACf,GAAG,GAAG,IAAI;oBAMZ,GAAG,gBAAgB,MAAM,GAAG,IAAI;sBAM9B,GAAG,GAAG,IAAI;oBAMZ,GAAG,kBAAkB,MAAM,GAAG,IAAI;CAQnD,CAAC"}
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
- import { oAddress, NodeType } from '@olane/o-core';
2
- import { oIntent } from '@olane/o-lane';
3
- import { OlaneOS } from '../../../src/o-olane-os/index.js';
4
- import { tmpNode } from '../../utils/tmp.node.js';
5
- /**
6
- * Create a test OS instance for capability testing
7
- */
8
- export async function createTestOS() {
9
- const os = new OlaneOS({
10
- nodes: [
11
- {
12
- type: NodeType.LEADER,
13
- address: new oAddress('o://test-leader'),
14
- leader: null,
15
- parent: null,
16
- name: 'Test Leader',
17
- description: 'Test leader node for capability testing'
18
- }
19
- ],
20
- lanes: []
21
- });
22
- await os.start();
23
- return os;
24
- }
25
- /**
26
- * Create a test lane tool node
27
- */
28
- export async function createTestLaneTool(_os) {
29
- // Return tmpNode as a lane tool for testing
30
- return tmpNode;
31
- }
32
- /**
33
- * Create a mock intent for testing
34
- */
35
- export function createMockIntent(intent, params) {
36
- return new oIntent({ intent });
37
- }
38
- /**
39
- * Create a mock capability config for testing
40
- */
41
- export function createMockCapabilityConfig(node, intent, params, options) {
42
- return {
43
- node,
44
- intent: createMockIntent(intent, params),
45
- laneConfig: {
46
- maxCycles: 20,
47
- useStream: options?.useStream || false
48
- },
49
- history: '',
50
- params: params || {},
51
- isReplay: options?.isReplay || false,
52
- useStream: options?.useStream || false,
53
- onChunk: options?.onChunk
54
- };
55
- }
56
- /**
57
- * Create a mock tool for testing task capabilities
58
- */
59
- export async function createMockTool(_os, methods) {
60
- // Use tmpNode as base tool for testing
61
- const tool = tmpNode;
62
- // Add methods to the tool
63
- Object.entries(methods).forEach(([methodName, methodFn]) => {
64
- tool[methodName] = methodFn;
65
- });
66
- return tool;
67
- }
68
- /**
69
- * Wait for a condition to be true
70
- */
71
- export async function waitFor(condition, timeout = 5000, interval = 100) {
72
- const startTime = Date.now();
73
- while (Date.now() - startTime < timeout) {
74
- const result = await Promise.resolve(condition());
75
- if (result) {
76
- return;
77
- }
78
- await new Promise(resolve => setTimeout(resolve, interval));
79
- }
80
- throw new Error(`Condition not met within ${timeout}ms`);
81
- }
82
- /**
83
- * Capture streaming chunks for testing
84
- */
85
- export class ChunkCapture {
86
- constructor() {
87
- this.chunks = [];
88
- this.onChunk = (chunk) => {
89
- this.chunks.push(chunk);
90
- };
91
- }
92
- get allChunks() {
93
- return [...this.chunks];
94
- }
95
- get chunkCount() {
96
- return this.chunks.length;
97
- }
98
- get lastChunk() {
99
- return this.chunks[this.chunks.length - 1];
100
- }
101
- clear() {
102
- this.chunks = [];
103
- }
104
- waitForChunks(count, timeout = 5000) {
105
- return waitFor(() => this.chunks.length >= count, timeout);
106
- }
107
- }
108
- /**
109
- * Common test fixtures
110
- */
111
- export const TEST_FIXTURES = {
112
- simpleIntent: 'Execute a simple test task',
113
- searchIntent: 'Search for information about testing',
114
- configureIntent: 'Configure the test tool',
115
- evaluateIntent: 'Evaluate the test scenario',
116
- multiStepIntent: 'Execute multiple test steps',
117
- mockHistory: `Previous execution history:
118
- - Evaluated intent
119
- - Configured tool
120
- - Executed task`,
121
- mockToolMethods: {
122
- testMethod: async (param1, param2) => {
123
- return `Executed with ${param1} and ${param2}`;
124
- },
125
- asyncMethod: async () => {
126
- await new Promise(resolve => setTimeout(resolve, 100));
127
- return 'Async result';
128
- },
129
- errorMethod: async () => {
130
- throw new Error('Test error from method');
131
- }
132
- }
133
- };
134
- /**
135
- * Assertion helpers
136
- */
137
- export const assertCapabilityResult = {
138
- isSuccess(result) {
139
- if (result.error) {
140
- throw new Error(`Expected success but got error: ${result.error}`);
141
- }
142
- },
143
- hasType(result, expectedType) {
144
- if (result.type !== expectedType) {
145
- throw new Error(`Expected type ${expectedType} but got ${result.type}`);
146
- }
147
- },
148
- hasResult(result) {
149
- if (!result.result && !result.humanResult) {
150
- throw new Error('Expected result to have result or humanResult');
151
- }
152
- },
153
- isError(result, expectedError) {
154
- if (!result.error) {
155
- throw new Error('Expected error but got success');
156
- }
157
- if (expectedError && !result.error.includes(expectedError)) {
158
- throw new Error(`Expected error containing "${expectedError}" but got "${result.error}"`);
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.18",
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.18",
62
- "@olane/o-config": "0.7.18",
63
- "@olane/o-core": "0.7.18",
64
- "@olane/o-intelligence": "0.7.18",
65
- "@olane/o-lane": "0.7.18",
66
- "@olane/o-leader": "0.7.18",
67
- "@olane/o-login": "0.7.18",
68
- "@olane/o-protocol": "0.7.18",
69
- "@olane/o-storage": "0.7.18",
70
- "@olane/o-tool": "0.7.18",
71
- "@olane/o-tool-registry": "0.7.18",
72
- "@olane/o-tools-common": "0.7.18",
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": "9c7cfe1919dd912645dab3b5788f34d5ddd4a761"
79
+ "gitHead": "956ef7a726e5ac2efb7028ffca707ec1cf6ea131"
80
80
  }