@olane/os 0.7.12-alpha.6 → 0.7.12-alpha.60
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/o-olane-os/config/default.config.js +1 -1
- package/dist/src/o-olane-os/o-os.d.ts +1 -1
- package/dist/src/o-olane-os/o-os.d.ts.map +1 -1
- package/dist/src/o-olane-os/o-os.js +1 -2
- package/dist/src/utils/config.d.ts.map +1 -1
- package/dist/src/utils/config.js +2 -2
- package/dist/test/basic/basic-usage.spec.d.ts +0 -1
- package/dist/test/basic/basic-usage.spec.js +137 -107
- package/dist/test/basic/playground.spec.d.ts +2 -0
- package/dist/test/basic/playground.spec.d.ts.map +1 -0
- package/dist/test/basic/playground.spec.js +108 -0
- package/dist/test/capabilities/base-capability.spec.d.ts +2 -0
- package/dist/test/capabilities/base-capability.spec.d.ts.map +1 -0
- package/dist/test/capabilities/base-capability.spec.js +174 -0
- package/dist/test/capabilities/capability-errors.spec.d.ts +2 -0
- package/dist/test/capabilities/capability-errors.spec.d.ts.map +1 -0
- package/dist/test/capabilities/capability-errors.spec.js +340 -0
- package/dist/test/capabilities/capability-integration.spec.d.ts +2 -0
- package/dist/test/capabilities/capability-integration.spec.d.ts.map +1 -0
- package/dist/test/capabilities/capability-integration.spec.js +463 -0
- package/dist/test/capabilities/capability-registry.spec.d.ts +2 -0
- package/dist/test/capabilities/capability-registry.spec.d.ts.map +1 -0
- package/dist/test/capabilities/capability-registry.spec.js +261 -0
- package/dist/test/capabilities/configure-capability.spec.d.ts +2 -0
- package/dist/test/capabilities/configure-capability.spec.d.ts.map +1 -0
- package/dist/test/capabilities/configure-capability.spec.js +366 -0
- package/dist/test/capabilities/evaluate-capability.spec.d.ts +2 -0
- package/dist/test/capabilities/evaluate-capability.spec.d.ts.map +1 -0
- package/dist/test/capabilities/evaluate-capability.spec.js +323 -0
- package/dist/test/capabilities/intelligence-capability.spec.d.ts +2 -0
- package/dist/test/capabilities/intelligence-capability.spec.d.ts.map +1 -0
- package/dist/test/capabilities/intelligence-capability.spec.js +171 -0
- package/dist/test/capabilities/multiple-step-capability.spec.d.ts +2 -0
- package/dist/test/capabilities/multiple-step-capability.spec.d.ts.map +1 -0
- package/dist/test/capabilities/multiple-step-capability.spec.js +441 -0
- package/dist/test/capabilities/search-capability.spec.d.ts +2 -0
- package/dist/test/capabilities/search-capability.spec.d.ts.map +1 -0
- package/dist/test/capabilities/search-capability.spec.js +337 -0
- package/dist/test/capabilities/task-capability.spec.d.ts +2 -0
- package/dist/test/capabilities/task-capability.spec.d.ts.map +1 -0
- package/dist/test/capabilities/task-capability.spec.js +335 -0
- package/dist/test/capabilities/utils/capability-test-utils.d.ts +68 -0
- package/dist/test/capabilities/utils/capability-test-utils.d.ts.map +1 -0
- package/dist/test/capabilities/utils/capability-test-utils.js +161 -0
- package/dist/test/utils/tmp.node.d.ts +3 -0
- package/dist/test/utils/tmp.node.d.ts.map +1 -0
- package/dist/test/utils/tmp.node.js +8 -0
- package/package.json +15 -12
- package/dist/src/network/config/default.config.d.ts +0 -3
- package/dist/src/network/config/default.config.d.ts.map +0 -1
- package/dist/src/network/config/default.config.js +0 -32
- package/dist/src/network/index.d.ts +0 -5
- package/dist/src/network/index.d.ts.map +0 -1
- package/dist/src/network/index.js +0 -4
- package/dist/src/network/interfaces/network-status.enum.d.ts +0 -7
- package/dist/src/network/interfaces/network-status.enum.d.ts.map +0 -1
- package/dist/src/network/interfaces/network-status.enum.js +0 -7
- package/dist/src/network/interfaces/network.interface.d.ts +0 -18
- package/dist/src/network/interfaces/network.interface.d.ts.map +0 -1
- package/dist/src/network/interfaces/network.interface.js +0 -1
- package/dist/src/network/o-network.d.ts +0 -34
- package/dist/src/network/o-network.d.ts.map +0 -1
- package/dist/src/network/o-network.js +0 -247
- package/dist/test/utils/default.network.d.ts +0 -3
- package/dist/test/utils/default.network.d.ts.map +0 -1
- package/dist/test/utils/default.network.js +0 -33
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import { oCapabilityMultipleStep, oCapabilityType } from '@olane/o-lane';
|
|
3
|
+
import { createTestOS, createTestLaneTool, createMockCapabilityConfig, createMockIntent } from './utils/capability-test-utils.js';
|
|
4
|
+
describe('oCapabilityMultipleStep @capability @multiple-step', () => {
|
|
5
|
+
let os;
|
|
6
|
+
let laneTool;
|
|
7
|
+
let multiStepCapability;
|
|
8
|
+
before(async () => {
|
|
9
|
+
os = await createTestOS();
|
|
10
|
+
laneTool = await createTestLaneTool(os);
|
|
11
|
+
});
|
|
12
|
+
after(async () => {
|
|
13
|
+
if (laneTool) {
|
|
14
|
+
await laneTool.stop();
|
|
15
|
+
}
|
|
16
|
+
if (os) {
|
|
17
|
+
await os.stop();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
multiStepCapability = new oCapabilityMultipleStep();
|
|
22
|
+
});
|
|
23
|
+
describe('type identification', () => {
|
|
24
|
+
it('should return MULTIPLE_STEP type from instance getter', () => {
|
|
25
|
+
expect(multiStepCapability.type).to.equal(oCapabilityType.MULTIPLE_STEP);
|
|
26
|
+
});
|
|
27
|
+
it('should return MULTIPLE_STEP type from static getter', () => {
|
|
28
|
+
expect(oCapabilityMultipleStep.type).to.equal(oCapabilityType.MULTIPLE_STEP);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
describe('inheritance', () => {
|
|
32
|
+
it('should extend oCapabilityIntelligence', async () => {
|
|
33
|
+
expect(multiStepCapability).to.respondTo('intelligence');
|
|
34
|
+
});
|
|
35
|
+
it('should have access to intelligence method', async () => {
|
|
36
|
+
const params = {
|
|
37
|
+
intents: [],
|
|
38
|
+
explanation: 'Test explanation'
|
|
39
|
+
};
|
|
40
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
41
|
+
await multiStepCapability.execute(config);
|
|
42
|
+
expect(multiStepCapability.intelligence).to.be.a('function');
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
describe('configuration getters', () => {
|
|
46
|
+
it('should provide access to intents array', async () => {
|
|
47
|
+
const intents = [
|
|
48
|
+
createMockIntent('First step', {}),
|
|
49
|
+
createMockIntent('Second step', {}),
|
|
50
|
+
createMockIntent('Third step', {})
|
|
51
|
+
];
|
|
52
|
+
const params = {
|
|
53
|
+
intents,
|
|
54
|
+
explanation: 'Multi-step process'
|
|
55
|
+
};
|
|
56
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
57
|
+
await multiStepCapability.execute(config);
|
|
58
|
+
expect(multiStepCapability.intents).to.deep.equal(intents);
|
|
59
|
+
expect(multiStepCapability.intents.length).to.equal(3);
|
|
60
|
+
});
|
|
61
|
+
it('should provide access to explanation', async () => {
|
|
62
|
+
const explanation = 'This explains why we need multiple steps';
|
|
63
|
+
const params = {
|
|
64
|
+
intents: [],
|
|
65
|
+
explanation
|
|
66
|
+
};
|
|
67
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
68
|
+
await multiStepCapability.execute(config);
|
|
69
|
+
expect(multiStepCapability.explanation).to.equal(explanation);
|
|
70
|
+
});
|
|
71
|
+
it('should handle empty intents array', async () => {
|
|
72
|
+
const params = {
|
|
73
|
+
intents: [],
|
|
74
|
+
explanation: 'Empty intents test'
|
|
75
|
+
};
|
|
76
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
77
|
+
await multiStepCapability.execute(config);
|
|
78
|
+
expect(multiStepCapability.intents).to.be.an('array');
|
|
79
|
+
expect(multiStepCapability.intents.length).to.equal(0);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
describe('run() method - intent execution', () => {
|
|
83
|
+
it('should handle empty intents array', async () => {
|
|
84
|
+
const params = {
|
|
85
|
+
intents: [],
|
|
86
|
+
explanation: 'No intents to execute'
|
|
87
|
+
};
|
|
88
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
89
|
+
const result = await multiStepCapability.execute(config);
|
|
90
|
+
expect(result).to.exist;
|
|
91
|
+
expect(result.type).to.equal(oCapabilityType.EVALUATE);
|
|
92
|
+
});
|
|
93
|
+
it('should handle single intent', async () => {
|
|
94
|
+
const intents = [
|
|
95
|
+
createMockIntent('Single step', {})
|
|
96
|
+
];
|
|
97
|
+
const params = {
|
|
98
|
+
intents,
|
|
99
|
+
explanation: 'Single step execution'
|
|
100
|
+
};
|
|
101
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
102
|
+
// May fail if services not available, but tests structure
|
|
103
|
+
try {
|
|
104
|
+
const result = await multiStepCapability.execute(config);
|
|
105
|
+
expect(result).to.exist;
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
// Expected if sub-lane services unavailable
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
it('should handle multiple intents', async () => {
|
|
112
|
+
const intents = [
|
|
113
|
+
createMockIntent('Step one', {}),
|
|
114
|
+
createMockIntent('Step two', {}),
|
|
115
|
+
createMockIntent('Step three', {})
|
|
116
|
+
];
|
|
117
|
+
const params = {
|
|
118
|
+
intents,
|
|
119
|
+
explanation: 'Three step process'
|
|
120
|
+
};
|
|
121
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
122
|
+
// May fail if services not available, but tests structure
|
|
123
|
+
try {
|
|
124
|
+
const result = await multiStepCapability.execute(config);
|
|
125
|
+
expect(result).to.exist;
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
// Expected if sub-lane services unavailable
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
it('should execute intents sequentially', async () => {
|
|
132
|
+
const intents = [
|
|
133
|
+
createMockIntent('First', {}),
|
|
134
|
+
createMockIntent('Second', {})
|
|
135
|
+
];
|
|
136
|
+
const params = {
|
|
137
|
+
intents,
|
|
138
|
+
explanation: 'Sequential execution'
|
|
139
|
+
};
|
|
140
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
141
|
+
try {
|
|
142
|
+
await multiStepCapability.execute(config);
|
|
143
|
+
// If successful, intents were executed in order
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
// Expected if services unavailable
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
describe('sub-lane management', () => {
|
|
151
|
+
it('should create sub-lanes for each intent', async () => {
|
|
152
|
+
const intents = [
|
|
153
|
+
createMockIntent('Step 1', {}),
|
|
154
|
+
createMockIntent('Step 2', {})
|
|
155
|
+
];
|
|
156
|
+
const params = {
|
|
157
|
+
intents,
|
|
158
|
+
explanation: 'Sub-lane creation test'
|
|
159
|
+
};
|
|
160
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
161
|
+
try {
|
|
162
|
+
await multiStepCapability.execute(config);
|
|
163
|
+
// Sub-lanes are created and cleaned up during execution
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
// Expected if services unavailable
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
it('should clean up sub-lanes after execution', async () => {
|
|
170
|
+
const intents = [
|
|
171
|
+
createMockIntent('Step 1', {})
|
|
172
|
+
];
|
|
173
|
+
const params = {
|
|
174
|
+
intents,
|
|
175
|
+
explanation: 'Sub-lane cleanup test'
|
|
176
|
+
};
|
|
177
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
178
|
+
try {
|
|
179
|
+
await multiStepCapability.execute(config);
|
|
180
|
+
// Sub-lanes should be removed from the map after execution
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
// Expected if services unavailable
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
it('should pass lane config to sub-lanes', async () => {
|
|
187
|
+
const intents = [
|
|
188
|
+
createMockIntent('Step with config', {})
|
|
189
|
+
];
|
|
190
|
+
const params = {
|
|
191
|
+
intents,
|
|
192
|
+
explanation: 'Config propagation test'
|
|
193
|
+
};
|
|
194
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
195
|
+
config.laneConfig.maxCycles = 15;
|
|
196
|
+
try {
|
|
197
|
+
await multiStepCapability.execute(config);
|
|
198
|
+
expect(config.laneConfig.maxCycles).to.equal(15);
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
// Expected if services unavailable
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
it('should preserve parent lane ID', async () => {
|
|
205
|
+
const intents = [
|
|
206
|
+
createMockIntent('Child step', {})
|
|
207
|
+
];
|
|
208
|
+
const params = {
|
|
209
|
+
intents,
|
|
210
|
+
explanation: 'Parent lane ID test'
|
|
211
|
+
};
|
|
212
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
213
|
+
config.parentLaneId = 'parent-lane-123';
|
|
214
|
+
try {
|
|
215
|
+
await multiStepCapability.execute(config);
|
|
216
|
+
expect(config.parentLaneId).to.equal('parent-lane-123');
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
// Expected if services unavailable
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
describe('cancellation', () => {
|
|
224
|
+
it('should support cancellation', () => {
|
|
225
|
+
multiStepCapability.cancel();
|
|
226
|
+
// Should not throw - validates cancel method exists
|
|
227
|
+
});
|
|
228
|
+
it('should cancel all active sub-lanes', async () => {
|
|
229
|
+
const intents = [
|
|
230
|
+
createMockIntent('Step 1', {}),
|
|
231
|
+
createMockIntent('Step 2', {})
|
|
232
|
+
];
|
|
233
|
+
const params = {
|
|
234
|
+
intents,
|
|
235
|
+
explanation: 'Cancellation test'
|
|
236
|
+
};
|
|
237
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
238
|
+
// Start execution in background (conceptually)
|
|
239
|
+
const executionPromise = multiStepCapability.execute(config);
|
|
240
|
+
// Cancel immediately
|
|
241
|
+
multiStepCapability.cancel();
|
|
242
|
+
try {
|
|
243
|
+
await executionPromise;
|
|
244
|
+
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
// May error during cancellation
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
it('should handle cancel when no sub-lanes active', () => {
|
|
250
|
+
multiStepCapability.cancel();
|
|
251
|
+
// Should not throw even with no active sub-lanes
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
describe('result structure', () => {
|
|
255
|
+
it('should return capability result', async () => {
|
|
256
|
+
const params = {
|
|
257
|
+
intents: [],
|
|
258
|
+
explanation: 'Result structure test'
|
|
259
|
+
};
|
|
260
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
261
|
+
const result = await multiStepCapability.execute(config);
|
|
262
|
+
expect(result).to.exist;
|
|
263
|
+
expect(result.type).to.equal(oCapabilityType.EVALUATE);
|
|
264
|
+
});
|
|
265
|
+
it('should include results array', async () => {
|
|
266
|
+
const params = {
|
|
267
|
+
intents: [],
|
|
268
|
+
explanation: 'Results array test'
|
|
269
|
+
};
|
|
270
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
271
|
+
const result = await multiStepCapability.execute(config);
|
|
272
|
+
expect(result.result).to.be.an('array');
|
|
273
|
+
expect(result.humanResult).to.be.an('array');
|
|
274
|
+
});
|
|
275
|
+
it('should set type to EVALUATE in result', async () => {
|
|
276
|
+
const params = {
|
|
277
|
+
intents: [],
|
|
278
|
+
explanation: 'Type test'
|
|
279
|
+
};
|
|
280
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
281
|
+
const result = await multiStepCapability.execute(config);
|
|
282
|
+
expect(result.type).to.equal(oCapabilityType.EVALUATE);
|
|
283
|
+
});
|
|
284
|
+
it('should aggregate results from all intents', async () => {
|
|
285
|
+
const intents = [
|
|
286
|
+
createMockIntent('Step 1', {}),
|
|
287
|
+
createMockIntent('Step 2', {})
|
|
288
|
+
];
|
|
289
|
+
const params = {
|
|
290
|
+
intents,
|
|
291
|
+
explanation: 'Result aggregation test'
|
|
292
|
+
};
|
|
293
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
294
|
+
try {
|
|
295
|
+
const result = await multiStepCapability.execute(config);
|
|
296
|
+
expect(result.result).to.be.an('array');
|
|
297
|
+
}
|
|
298
|
+
catch (error) {
|
|
299
|
+
// Expected if services unavailable
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
describe('intent handling', () => {
|
|
304
|
+
it('should handle intents with parameters', async () => {
|
|
305
|
+
const intents = [
|
|
306
|
+
createMockIntent('Step with params', { key1: 'value1', key2: 123 })
|
|
307
|
+
];
|
|
308
|
+
const params = {
|
|
309
|
+
intents,
|
|
310
|
+
explanation: 'Intent params test'
|
|
311
|
+
};
|
|
312
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
313
|
+
try {
|
|
314
|
+
await multiStepCapability.execute(config);
|
|
315
|
+
// Params are stored in the config, not on the intent object
|
|
316
|
+
expect(multiStepCapability.config.params.intents[0]).to.exist;
|
|
317
|
+
}
|
|
318
|
+
catch (error) {
|
|
319
|
+
// Expected if services unavailable
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
it('should handle intents with complex parameters', async () => {
|
|
323
|
+
const intents = [
|
|
324
|
+
createMockIntent('Complex intent', {
|
|
325
|
+
nested: { object: { structure: 'value' } },
|
|
326
|
+
array: [1, 2, 3],
|
|
327
|
+
boolean: true
|
|
328
|
+
})
|
|
329
|
+
];
|
|
330
|
+
const params = {
|
|
331
|
+
intents,
|
|
332
|
+
explanation: 'Complex params test'
|
|
333
|
+
};
|
|
334
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
335
|
+
try {
|
|
336
|
+
await multiStepCapability.execute(config);
|
|
337
|
+
// Check that intents exist
|
|
338
|
+
expect(multiStepCapability.intents[0]).to.exist;
|
|
339
|
+
}
|
|
340
|
+
catch (error) {
|
|
341
|
+
// Expected if services unavailable
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
it('should handle long intent strings', async () => {
|
|
345
|
+
const longIntentText = 'This is a very long intent that describes a complex multi-step process. '.repeat(10);
|
|
346
|
+
const intents = [
|
|
347
|
+
createMockIntent(longIntentText, {})
|
|
348
|
+
];
|
|
349
|
+
const params = {
|
|
350
|
+
intents,
|
|
351
|
+
explanation: 'Long intent test'
|
|
352
|
+
};
|
|
353
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
354
|
+
try {
|
|
355
|
+
await multiStepCapability.execute(config);
|
|
356
|
+
expect(multiStepCapability.intents[0].value).to.equal(longIntentText);
|
|
357
|
+
}
|
|
358
|
+
catch (error) {
|
|
359
|
+
// Expected if services unavailable
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
it('should handle intents with special characters', async () => {
|
|
363
|
+
const intents = [
|
|
364
|
+
createMockIntent('Intent with "quotes" and \'apostrophes\'', {}),
|
|
365
|
+
createMockIntent('Intent with special chars: !@#$%^&*()', {})
|
|
366
|
+
];
|
|
367
|
+
const params = {
|
|
368
|
+
intents,
|
|
369
|
+
explanation: 'Special chars test'
|
|
370
|
+
};
|
|
371
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
372
|
+
try {
|
|
373
|
+
await multiStepCapability.execute(config);
|
|
374
|
+
expect(multiStepCapability.intents.length).to.equal(2);
|
|
375
|
+
}
|
|
376
|
+
catch (error) {
|
|
377
|
+
// Expected if services unavailable
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
});
|
|
381
|
+
describe('error handling', () => {
|
|
382
|
+
it('should handle sub-lane execution errors', async () => {
|
|
383
|
+
const intents = [
|
|
384
|
+
createMockIntent('Step that might fail', {})
|
|
385
|
+
];
|
|
386
|
+
const params = {
|
|
387
|
+
intents,
|
|
388
|
+
explanation: 'Error handling test'
|
|
389
|
+
};
|
|
390
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
391
|
+
try {
|
|
392
|
+
const result = await multiStepCapability.execute(config);
|
|
393
|
+
expect(result).to.exist;
|
|
394
|
+
}
|
|
395
|
+
catch (error) {
|
|
396
|
+
// Expected if services unavailable
|
|
397
|
+
expect(error).to.exist;
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
it('should continue execution after sub-lane error', async () => {
|
|
401
|
+
const intents = [
|
|
402
|
+
createMockIntent('First step', {}),
|
|
403
|
+
createMockIntent('Second step (might fail)', {}),
|
|
404
|
+
createMockIntent('Third step', {})
|
|
405
|
+
];
|
|
406
|
+
const params = {
|
|
407
|
+
intents,
|
|
408
|
+
explanation: 'Continue after error test'
|
|
409
|
+
};
|
|
410
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
411
|
+
try {
|
|
412
|
+
await multiStepCapability.execute(config);
|
|
413
|
+
// Should attempt all steps even if some fail
|
|
414
|
+
}
|
|
415
|
+
catch (error) {
|
|
416
|
+
// Expected if services unavailable
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
});
|
|
420
|
+
describe('integration with base capabilities', () => {
|
|
421
|
+
it('should have access to node through base class', async () => {
|
|
422
|
+
const params = {
|
|
423
|
+
intents: [],
|
|
424
|
+
explanation: 'Node access test'
|
|
425
|
+
};
|
|
426
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step intent', params);
|
|
427
|
+
await multiStepCapability.execute(config);
|
|
428
|
+
expect(multiStepCapability.node).to.equal(laneTool);
|
|
429
|
+
});
|
|
430
|
+
it('should have access to intent through base class', async () => {
|
|
431
|
+
const params = {
|
|
432
|
+
intents: [],
|
|
433
|
+
explanation: 'Intent access test'
|
|
434
|
+
};
|
|
435
|
+
const config = createMockCapabilityConfig(laneTool, 'Multiple step main intent', params);
|
|
436
|
+
await multiStepCapability.execute(config);
|
|
437
|
+
expect(multiStepCapability.intent).to.exist;
|
|
438
|
+
expect(multiStepCapability.intent.value).to.equal('Multiple step main intent');
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-capability.spec.d.ts","sourceRoot":"","sources":["../../../test/capabilities/search-capability.spec.ts"],"names":[],"mappings":""}
|