@substrate-ai/core 0.19.54 → 0.20.2
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/README.md +33 -33
- package/dist/config/types.d.ts +17 -17
- package/package.json +16 -2
- package/dist/__tests__/adapter.test.d.ts +0 -12
- package/dist/__tests__/adapter.test.d.ts.map +0 -1
- package/dist/__tests__/adapter.test.js +0 -259
- package/dist/__tests__/adapter.test.js.map +0 -1
- package/dist/__tests__/event-bus.test.d.ts +0 -14
- package/dist/__tests__/event-bus.test.d.ts.map +0 -1
- package/dist/__tests__/event-bus.test.js +0 -199
- package/dist/__tests__/event-bus.test.js.map +0 -1
- package/dist/__tests__/output-quality.test.d.ts +0 -8
- package/dist/__tests__/output-quality.test.d.ts.map +0 -1
- package/dist/__tests__/output-quality.test.js +0 -166
- package/dist/__tests__/output-quality.test.js.map +0 -1
- package/dist/__tests__/schema-suffix.test.d.ts +0 -9
- package/dist/__tests__/schema-suffix.test.d.ts.map +0 -1
- package/dist/__tests__/schema-suffix.test.js +0 -126
- package/dist/__tests__/schema-suffix.test.js.map +0 -1
- package/dist/__tests__/yaml-parser.test.d.ts +0 -18
- package/dist/__tests__/yaml-parser.test.d.ts.map +0 -1
- package/dist/__tests__/yaml-parser.test.js +0 -475
- package/dist/__tests__/yaml-parser.test.js.map +0 -1
- package/dist/__type-checks__.d.ts +0 -11
- package/dist/__type-checks__.d.ts.map +0 -1
- package/dist/__type-checks__.js +0 -19
- package/dist/__type-checks__.js.map +0 -1
- package/dist/adapters/__tests__/adapter-output-normalizer.test.d.ts +0 -12
- package/dist/adapters/__tests__/adapter-output-normalizer.test.d.ts.map +0 -1
- package/dist/adapters/__tests__/adapter-output-normalizer.test.js +0 -193
- package/dist/adapters/__tests__/adapter-output-normalizer.test.js.map +0 -1
- package/dist/persistence/dolt-adapter-transaction.test.d.ts +0 -10
- package/dist/persistence/dolt-adapter-transaction.test.d.ts.map +0 -1
- package/dist/persistence/dolt-adapter-transaction.test.js +0 -359
- package/dist/persistence/dolt-adapter-transaction.test.js.map +0 -1
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unit tests for packages/core/src/events/event-bus.ts
|
|
3
|
-
*
|
|
4
|
-
* Tests the TypedEventBusImpl class and createEventBus factory:
|
|
5
|
-
* - Basic emit/on/off lifecycle
|
|
6
|
-
* - Typed event emission with correct payload delivery
|
|
7
|
-
* - Multiple handlers for same event
|
|
8
|
-
* - Handler removal (off)
|
|
9
|
-
* - Synchronous dispatch guarantee
|
|
10
|
-
* - Multiple event types coexisting
|
|
11
|
-
* - createEventBus factory returns working instance
|
|
12
|
-
*/
|
|
13
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
14
|
-
import { TypedEventBusImpl, createEventBus } from '../events/event-bus.js';
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
|
-
// TypedEventBusImpl
|
|
17
|
-
// ---------------------------------------------------------------------------
|
|
18
|
-
describe('TypedEventBusImpl', () => {
|
|
19
|
-
// -----------------------------------------------------------------------
|
|
20
|
-
// emit / on basics
|
|
21
|
-
// -----------------------------------------------------------------------
|
|
22
|
-
describe('emit and on', () => {
|
|
23
|
-
it('delivers a payload to a registered handler', () => {
|
|
24
|
-
const bus = new TypedEventBusImpl();
|
|
25
|
-
const handler = vi.fn();
|
|
26
|
-
bus.on('test:simple', handler);
|
|
27
|
-
bus.emit('test:simple', { message: 'hello' });
|
|
28
|
-
expect(handler).toHaveBeenCalledOnce();
|
|
29
|
-
expect(handler).toHaveBeenCalledWith({ message: 'hello' });
|
|
30
|
-
});
|
|
31
|
-
it('delivers correct payload for numeric events', () => {
|
|
32
|
-
const bus = new TypedEventBusImpl();
|
|
33
|
-
const handler = vi.fn();
|
|
34
|
-
bus.on('test:numeric', handler);
|
|
35
|
-
bus.emit('test:numeric', { value: 42 });
|
|
36
|
-
expect(handler).toHaveBeenCalledWith({ value: 42 });
|
|
37
|
-
});
|
|
38
|
-
it('delivers complex nested payloads', () => {
|
|
39
|
-
const bus = new TypedEventBusImpl();
|
|
40
|
-
const handler = vi.fn();
|
|
41
|
-
const payload = {
|
|
42
|
-
items: ['a', 'b', 'c'],
|
|
43
|
-
count: 3,
|
|
44
|
-
nested: { ok: true },
|
|
45
|
-
};
|
|
46
|
-
bus.on('test:complex', handler);
|
|
47
|
-
bus.emit('test:complex', payload);
|
|
48
|
-
expect(handler).toHaveBeenCalledWith(payload);
|
|
49
|
-
});
|
|
50
|
-
it('does not deliver to handlers of different events', () => {
|
|
51
|
-
const bus = new TypedEventBusImpl();
|
|
52
|
-
const simpleHandler = vi.fn();
|
|
53
|
-
const numericHandler = vi.fn();
|
|
54
|
-
bus.on('test:simple', simpleHandler);
|
|
55
|
-
bus.on('test:numeric', numericHandler);
|
|
56
|
-
bus.emit('test:simple', { message: 'only simple' });
|
|
57
|
-
expect(simpleHandler).toHaveBeenCalledOnce();
|
|
58
|
-
expect(numericHandler).not.toHaveBeenCalled();
|
|
59
|
-
});
|
|
60
|
-
it('emitting with no registered handlers does not throw', () => {
|
|
61
|
-
const bus = new TypedEventBusImpl();
|
|
62
|
-
expect(() => {
|
|
63
|
-
bus.emit('test:simple', { message: 'nobody listening' });
|
|
64
|
-
}).not.toThrow();
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
// -----------------------------------------------------------------------
|
|
68
|
-
// Multiple handlers
|
|
69
|
-
// -----------------------------------------------------------------------
|
|
70
|
-
describe('multiple handlers', () => {
|
|
71
|
-
it('delivers to all registered handlers for the same event', () => {
|
|
72
|
-
const bus = new TypedEventBusImpl();
|
|
73
|
-
const handler1 = vi.fn();
|
|
74
|
-
const handler2 = vi.fn();
|
|
75
|
-
const handler3 = vi.fn();
|
|
76
|
-
bus.on('test:simple', handler1);
|
|
77
|
-
bus.on('test:simple', handler2);
|
|
78
|
-
bus.on('test:simple', handler3);
|
|
79
|
-
bus.emit('test:simple', { message: 'broadcast' });
|
|
80
|
-
expect(handler1).toHaveBeenCalledOnce();
|
|
81
|
-
expect(handler2).toHaveBeenCalledOnce();
|
|
82
|
-
expect(handler3).toHaveBeenCalledOnce();
|
|
83
|
-
// All received the same payload
|
|
84
|
-
for (const h of [handler1, handler2, handler3]) {
|
|
85
|
-
expect(h).toHaveBeenCalledWith({ message: 'broadcast' });
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
it('delivers multiple emissions to the same handler', () => {
|
|
89
|
-
const bus = new TypedEventBusImpl();
|
|
90
|
-
const handler = vi.fn();
|
|
91
|
-
bus.on('test:numeric', handler);
|
|
92
|
-
bus.emit('test:numeric', { value: 1 });
|
|
93
|
-
bus.emit('test:numeric', { value: 2 });
|
|
94
|
-
bus.emit('test:numeric', { value: 3 });
|
|
95
|
-
expect(handler).toHaveBeenCalledTimes(3);
|
|
96
|
-
expect(handler).toHaveBeenNthCalledWith(1, { value: 1 });
|
|
97
|
-
expect(handler).toHaveBeenNthCalledWith(2, { value: 2 });
|
|
98
|
-
expect(handler).toHaveBeenNthCalledWith(3, { value: 3 });
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
// -----------------------------------------------------------------------
|
|
102
|
-
// off (handler removal)
|
|
103
|
-
// -----------------------------------------------------------------------
|
|
104
|
-
describe('off', () => {
|
|
105
|
-
it('stops delivering to a removed handler', () => {
|
|
106
|
-
const bus = new TypedEventBusImpl();
|
|
107
|
-
const handler = vi.fn();
|
|
108
|
-
bus.on('test:simple', handler);
|
|
109
|
-
bus.emit('test:simple', { message: 'before off' });
|
|
110
|
-
expect(handler).toHaveBeenCalledOnce();
|
|
111
|
-
bus.off('test:simple', handler);
|
|
112
|
-
bus.emit('test:simple', { message: 'after off' });
|
|
113
|
-
expect(handler).toHaveBeenCalledOnce(); // still 1, not 2
|
|
114
|
-
});
|
|
115
|
-
it('only removes the specific handler, not others', () => {
|
|
116
|
-
const bus = new TypedEventBusImpl();
|
|
117
|
-
const handlerA = vi.fn();
|
|
118
|
-
const handlerB = vi.fn();
|
|
119
|
-
bus.on('test:simple', handlerA);
|
|
120
|
-
bus.on('test:simple', handlerB);
|
|
121
|
-
bus.off('test:simple', handlerA);
|
|
122
|
-
bus.emit('test:simple', { message: 'after removing A' });
|
|
123
|
-
expect(handlerA).not.toHaveBeenCalled();
|
|
124
|
-
expect(handlerB).toHaveBeenCalledOnce();
|
|
125
|
-
});
|
|
126
|
-
it('removing a handler that was never registered does not throw', () => {
|
|
127
|
-
const bus = new TypedEventBusImpl();
|
|
128
|
-
const handler = vi.fn();
|
|
129
|
-
expect(() => {
|
|
130
|
-
bus.off('test:simple', handler);
|
|
131
|
-
}).not.toThrow();
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
// -----------------------------------------------------------------------
|
|
135
|
-
// Synchronous dispatch
|
|
136
|
-
// -----------------------------------------------------------------------
|
|
137
|
-
describe('synchronous dispatch', () => {
|
|
138
|
-
it('all handlers complete before emit returns', () => {
|
|
139
|
-
const bus = new TypedEventBusImpl();
|
|
140
|
-
const order = [];
|
|
141
|
-
bus.on('test:simple', () => order.push(1));
|
|
142
|
-
bus.on('test:simple', () => order.push(2));
|
|
143
|
-
bus.emit('test:simple', { message: 'sync test' });
|
|
144
|
-
order.push(3); // This runs after emit returns
|
|
145
|
-
// If dispatch were async, order might be [3, 1, 2]
|
|
146
|
-
expect(order).toEqual([1, 2, 3]);
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
// -----------------------------------------------------------------------
|
|
150
|
-
// Multiple event types
|
|
151
|
-
// -----------------------------------------------------------------------
|
|
152
|
-
describe('event type isolation', () => {
|
|
153
|
-
it('maintains separate handler lists per event type', () => {
|
|
154
|
-
const bus = new TypedEventBusImpl();
|
|
155
|
-
const simpleHandler = vi.fn();
|
|
156
|
-
const numericHandler = vi.fn();
|
|
157
|
-
bus.on('test:simple', simpleHandler);
|
|
158
|
-
bus.on('test:numeric', numericHandler);
|
|
159
|
-
bus.emit('test:simple', { message: 'hello' });
|
|
160
|
-
bus.emit('test:numeric', { value: 99 });
|
|
161
|
-
expect(simpleHandler).toHaveBeenCalledOnce();
|
|
162
|
-
expect(simpleHandler).toHaveBeenCalledWith({ message: 'hello' });
|
|
163
|
-
expect(numericHandler).toHaveBeenCalledOnce();
|
|
164
|
-
expect(numericHandler).toHaveBeenCalledWith({ value: 99 });
|
|
165
|
-
});
|
|
166
|
-
it('removing handler for one event does not affect others', () => {
|
|
167
|
-
const bus = new TypedEventBusImpl();
|
|
168
|
-
const simpleHandler = vi.fn();
|
|
169
|
-
const numericHandler = vi.fn();
|
|
170
|
-
bus.on('test:simple', simpleHandler);
|
|
171
|
-
bus.on('test:numeric', numericHandler);
|
|
172
|
-
bus.off('test:simple', simpleHandler);
|
|
173
|
-
bus.emit('test:simple', { message: 'removed' });
|
|
174
|
-
bus.emit('test:numeric', { value: 1 });
|
|
175
|
-
expect(simpleHandler).not.toHaveBeenCalled();
|
|
176
|
-
expect(numericHandler).toHaveBeenCalledOnce();
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
// ---------------------------------------------------------------------------
|
|
181
|
-
// createEventBus factory
|
|
182
|
-
// ---------------------------------------------------------------------------
|
|
183
|
-
describe('createEventBus', () => {
|
|
184
|
-
it('returns a TypedEventBusImpl instance', () => {
|
|
185
|
-
const bus = createEventBus();
|
|
186
|
-
expect(bus).toBeInstanceOf(TypedEventBusImpl);
|
|
187
|
-
});
|
|
188
|
-
it('returned bus supports full emit/on/off lifecycle', () => {
|
|
189
|
-
const bus = createEventBus();
|
|
190
|
-
const handler = vi.fn();
|
|
191
|
-
bus.on('test:simple', handler);
|
|
192
|
-
bus.emit('test:simple', { message: 'factory test' });
|
|
193
|
-
expect(handler).toHaveBeenCalledWith({ message: 'factory test' });
|
|
194
|
-
bus.off('test:simple', handler);
|
|
195
|
-
bus.emit('test:simple', { message: 'after off' });
|
|
196
|
-
expect(handler).toHaveBeenCalledOnce();
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
//# sourceMappingURL=event-b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utputQuality function which analyzes raw agent stdout
|
|
5
|
-
* for quality signals before YAML extraction and schema validation.
|
|
6
|
-
*/
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=output-quality.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"output-quality.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/output-quality.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unit tests for packages/core/src/dispatch/output-quality.ts
|
|
3
|
-
*
|
|
4
|
-
* Tests the estimateOutputQuality function which analyzes raw agent stdout
|
|
5
|
-
* for quality signals before YAML extraction and schema validation.
|
|
6
|
-
*/
|
|
7
|
-
import { describe, it, expect } from 'vitest';
|
|
8
|
-
import { estimateOutputQuality } from '../dispatch/output-quality.js';
|
|
9
|
-
describe('estimateOutputQuality', () => {
|
|
10
|
-
// -------------------------------------------------------------------------
|
|
11
|
-
// Empty / null input
|
|
12
|
-
// -------------------------------------------------------------------------
|
|
13
|
-
describe('empty input', () => {
|
|
14
|
-
it('returns score 0 for empty string', () => {
|
|
15
|
-
const result = estimateOutputQuality('');
|
|
16
|
-
expect(result.qualityScore).toBe(0);
|
|
17
|
-
expect(result.outputLength).toBe(0);
|
|
18
|
-
});
|
|
19
|
-
it('returns score 0 for whitespace-only string', () => {
|
|
20
|
-
const result = estimateOutputQuality(' \n\n ');
|
|
21
|
-
expect(result.qualityScore).toBe(0);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
// -------------------------------------------------------------------------
|
|
25
|
-
// Hedging detection
|
|
26
|
-
// -------------------------------------------------------------------------
|
|
27
|
-
describe('hedging detection', () => {
|
|
28
|
-
it('detects "I couldn\'t" hedging', () => {
|
|
29
|
-
const result = estimateOutputQuality("I couldn't figure out how to implement the TLA+ spec.");
|
|
30
|
-
expect(result.hedgingCount).toBeGreaterThanOrEqual(1);
|
|
31
|
-
expect(result.hedgingPhrases.length).toBeGreaterThanOrEqual(1);
|
|
32
|
-
});
|
|
33
|
-
it('detects "I was unable to" hedging', () => {
|
|
34
|
-
const result = estimateOutputQuality('I was unable to resolve the import error.');
|
|
35
|
-
expect(result.hedgingCount).toBeGreaterThanOrEqual(1);
|
|
36
|
-
});
|
|
37
|
-
it('detects TODO markers as hedging', () => {
|
|
38
|
-
const result = estimateOutputQuality('TODO: implement the circuit breaker logic');
|
|
39
|
-
expect(result.hedgingCount).toBeGreaterThanOrEqual(1);
|
|
40
|
-
});
|
|
41
|
-
it('multiple hedging phrases reduce score', () => {
|
|
42
|
-
const output = "I couldn't run the tests. I was unable to find the config. I skipped the integration tests.";
|
|
43
|
-
const result = estimateOutputQuality(output);
|
|
44
|
-
expect(result.hedgingCount).toBeGreaterThanOrEqual(2);
|
|
45
|
-
expect(result.qualityScore).toBeLessThan(30);
|
|
46
|
-
});
|
|
47
|
-
it('reports no hedging for clean output', () => {
|
|
48
|
-
const output = 'Implemented the payment idempotency spec.\n\n```yaml\nresult: success\n```';
|
|
49
|
-
const result = estimateOutputQuality(output);
|
|
50
|
-
expect(result.hedgingCount).toBe(0);
|
|
51
|
-
expect(result.hedgingPhrases).toEqual([]);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
// -------------------------------------------------------------------------
|
|
55
|
-
// Test execution / results detection
|
|
56
|
-
// -------------------------------------------------------------------------
|
|
57
|
-
describe('test detection', () => {
|
|
58
|
-
it('detects test execution mentions', () => {
|
|
59
|
-
const result = estimateOutputQuality('Running the tests with npm test...');
|
|
60
|
-
expect(result.mentionsTestExecution).toBe(true);
|
|
61
|
-
});
|
|
62
|
-
it('detects vitest execution', () => {
|
|
63
|
-
const result = estimateOutputQuality('npx vitest run src/foo.test.ts');
|
|
64
|
-
expect(result.mentionsTestExecution).toBe(true);
|
|
65
|
-
});
|
|
66
|
-
it('detects test pass', () => {
|
|
67
|
-
const result = estimateOutputQuality('All tests passed. 42 passing.');
|
|
68
|
-
expect(result.mentionsTestPass).toBe(true);
|
|
69
|
-
});
|
|
70
|
-
it('detects test failure', () => {
|
|
71
|
-
const result = estimateOutputQuality('3 tests failed in foo.test.ts');
|
|
72
|
-
expect(result.mentionsTestFailure).toBe(true);
|
|
73
|
-
});
|
|
74
|
-
it('test pass boosts score', () => {
|
|
75
|
-
const withPass = estimateOutputQuality('Tests passed.\n\n```yaml\nresult: success\n```');
|
|
76
|
-
const without = estimateOutputQuality('Done.\n\n```yaml\nresult: success\n```');
|
|
77
|
-
expect(withPass.qualityScore).toBeGreaterThan(without.qualityScore);
|
|
78
|
-
});
|
|
79
|
-
it('test failure reduces score', () => {
|
|
80
|
-
const withFail = estimateOutputQuality('Tests failed.\n\n```yaml\nresult: success\n```');
|
|
81
|
-
const without = estimateOutputQuality('Done.\n\n```yaml\nresult: success\n```');
|
|
82
|
-
expect(withFail.qualityScore).toBeLessThan(without.qualityScore);
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
// -------------------------------------------------------------------------
|
|
86
|
-
// YAML block detection
|
|
87
|
-
// -------------------------------------------------------------------------
|
|
88
|
-
describe('YAML block detection', () => {
|
|
89
|
-
it('boosts score significantly when YAML block is present', () => {
|
|
90
|
-
const withYaml = estimateOutputQuality('Done.\n\n```yaml\nresult: success\nac_met:\n - AC1\n```');
|
|
91
|
-
const without = estimateOutputQuality('Done. I implemented everything successfully.');
|
|
92
|
-
expect(withYaml.qualityScore).toBeGreaterThan(without.qualityScore + 10);
|
|
93
|
-
});
|
|
94
|
-
it('detects unfenced YAML starting with result:', () => {
|
|
95
|
-
// Short output triggers length penalty (-20), but YAML detection (+20) offsets it
|
|
96
|
-
const result = estimateOutputQuality('Some output...\nresult: success\nac_met:\n - AC1');
|
|
97
|
-
// Base 30 + YAML +20 - short -20 = 30
|
|
98
|
-
expect(result.qualityScore).toBeGreaterThanOrEqual(25);
|
|
99
|
-
});
|
|
100
|
-
it('penalizes long output without YAML block', () => {
|
|
101
|
-
const longNoYaml = estimateOutputQuality('x'.repeat(2000));
|
|
102
|
-
expect(longNoYaml.qualityScore).toBeLessThan(30);
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
// -------------------------------------------------------------------------
|
|
106
|
-
// File modification detection
|
|
107
|
-
// -------------------------------------------------------------------------
|
|
108
|
-
describe('file modification detection', () => {
|
|
109
|
-
it('counts file modification mentions', () => {
|
|
110
|
-
const output = 'Created file src/specs/payment.tla\nModified file package.json\nUpdated src/index.ts';
|
|
111
|
-
const result = estimateOutputQuality(output);
|
|
112
|
-
expect(result.fileModificationMentions).toBeGreaterThanOrEqual(2);
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
// -------------------------------------------------------------------------
|
|
116
|
-
// Error detection
|
|
117
|
-
// -------------------------------------------------------------------------
|
|
118
|
-
describe('error detection', () => {
|
|
119
|
-
it('detects TypeError mentions', () => {
|
|
120
|
-
const result = estimateOutputQuality('TypeError: Cannot read property of undefined');
|
|
121
|
-
expect(result.mentionsErrors).toBe(true);
|
|
122
|
-
});
|
|
123
|
-
it('detects compilation errors', () => {
|
|
124
|
-
const result = estimateOutputQuality('compilation failed: missing semicolon at line 42');
|
|
125
|
-
expect(result.mentionsErrors).toBe(true);
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
// -------------------------------------------------------------------------
|
|
129
|
-
// Score calibration
|
|
130
|
-
// -------------------------------------------------------------------------
|
|
131
|
-
describe('score calibration', () => {
|
|
132
|
-
it('ideal output (YAML + tests pass + file mods) scores high', () => {
|
|
133
|
-
const output = [
|
|
134
|
-
'Implemented the spec. Created file specs/tla/Payment.tla.',
|
|
135
|
-
'Running the tests... All tests passed.',
|
|
136
|
-
'```yaml',
|
|
137
|
-
'result: success',
|
|
138
|
-
'ac_met:',
|
|
139
|
-
' - AC1',
|
|
140
|
-
' - AC2',
|
|
141
|
-
'files_modified:',
|
|
142
|
-
' - specs/tla/Payment.tla',
|
|
143
|
-
'tests: pass',
|
|
144
|
-
'```',
|
|
145
|
-
].join('\n');
|
|
146
|
-
const result = estimateOutputQuality(output);
|
|
147
|
-
expect(result.qualityScore).toBeGreaterThanOrEqual(70);
|
|
148
|
-
});
|
|
149
|
-
it('bad output (hedging + no YAML + errors) scores low', () => {
|
|
150
|
-
const output = "I couldn't implement the spec. TypeError: module not found. I was unable to run the tests.";
|
|
151
|
-
const result = estimateOutputQuality(output);
|
|
152
|
-
expect(result.qualityScore).toBeLessThanOrEqual(20);
|
|
153
|
-
});
|
|
154
|
-
it('score is clamped to 0-100 range', () => {
|
|
155
|
-
// Extremely bad output
|
|
156
|
-
const bad = estimateOutputQuality("I couldn't. I was unable. I skipped. TODO: everything.");
|
|
157
|
-
expect(bad.qualityScore).toBeGreaterThanOrEqual(0);
|
|
158
|
-
expect(bad.qualityScore).toBeLessThanOrEqual(100);
|
|
159
|
-
});
|
|
160
|
-
it('short output is penalized', () => {
|
|
161
|
-
const short = estimateOutputQuality('ok');
|
|
162
|
-
expect(short.qualityScore).toBeLessThan(20);
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
//# sourceMappingURL=output-quality.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"output-quality.test.js","sourceRoot":"","sources":["../../src/__tests__/output-quality.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AAErE,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,4EAA4E;IAC5E,qBAAqB;IACrB,4EAA4E;IAE5E,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC3B,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;YAC1C,MAAM,MAAM,GAAG,qBAAqB,CAAC,EAAE,CAAC,CAAA;YACxC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC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mBAAmB,CAAC,GAAG,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;YACnC,MAAM,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAA;YACzC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;QAC7C,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unit tests for schema-aware YAML suffix generation.
|
|
3
|
-
*
|
|
4
|
-
* Tests extractSchemaFields and buildYamlOutputSuffix which introspect Zod
|
|
5
|
-
* schemas to produce field-specific YAML output format instructions for
|
|
6
|
-
* non-Claude agent backends.
|
|
7
|
-
*/
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=schema-suffix.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema-suffix.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/schema-suffix.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unit tests for schema-aware YAML suffix generation.
|
|
3
|
-
*
|
|
4
|
-
* Tests extractSchemaFields and buildYamlOutputSuffix which introspect Zod
|
|
5
|
-
* schemas to produce field-specific YAML output format instructions for
|
|
6
|
-
* non-Claude agent backends.
|
|
7
|
-
*/
|
|
8
|
-
import { describe, it, expect } from 'vitest';
|
|
9
|
-
import { z } from 'zod';
|
|
10
|
-
import { extractSchemaFields, buildYamlOutputSuffix } from '../dispatch/dispatcher-impl.js';
|
|
11
|
-
describe('extractSchemaFields', () => {
|
|
12
|
-
it('extracts field names from a simple Zod object', () => {
|
|
13
|
-
const schema = z.object({
|
|
14
|
-
result: z.string(),
|
|
15
|
-
count: z.number(),
|
|
16
|
-
});
|
|
17
|
-
const fields = extractSchemaFields(schema);
|
|
18
|
-
expect(fields).toContain('result: <string>');
|
|
19
|
-
expect(fields).toContain('count: <number>');
|
|
20
|
-
});
|
|
21
|
-
it('handles enum fields with values', () => {
|
|
22
|
-
const schema = z.object({
|
|
23
|
-
result: z.enum(['success', 'failed']),
|
|
24
|
-
});
|
|
25
|
-
const fields = extractSchemaFields(schema);
|
|
26
|
-
expect(fields).toContain('result: success | failed');
|
|
27
|
-
});
|
|
28
|
-
it('handles array fields', () => {
|
|
29
|
-
const schema = z.object({
|
|
30
|
-
files_modified: z.array(z.string()),
|
|
31
|
-
});
|
|
32
|
-
const fields = extractSchemaFields(schema);
|
|
33
|
-
expect(fields).toContain('files_modified: <list>');
|
|
34
|
-
});
|
|
35
|
-
it('handles optional fields', () => {
|
|
36
|
-
const schema = z.object({
|
|
37
|
-
notes: z.string().optional(),
|
|
38
|
-
});
|
|
39
|
-
const fields = extractSchemaFields(schema);
|
|
40
|
-
expect(fields).toContain('notes: <string>');
|
|
41
|
-
});
|
|
42
|
-
it('handles default fields', () => {
|
|
43
|
-
const schema = z.object({
|
|
44
|
-
ac_met: z.array(z.string()).default([]),
|
|
45
|
-
});
|
|
46
|
-
const fields = extractSchemaFields(schema);
|
|
47
|
-
expect(fields).toContain('ac_met: <list>');
|
|
48
|
-
});
|
|
49
|
-
it('handles preprocess/transform (ZodEffects) on object', () => {
|
|
50
|
-
const schema = z.object({
|
|
51
|
-
result: z.preprocess((val) => val, z.string()),
|
|
52
|
-
verdict: z.enum(['SHIP_IT', 'NEEDS_MINOR_FIXES']),
|
|
53
|
-
}).transform((data) => ({ ...data, extra: true }));
|
|
54
|
-
const fields = extractSchemaFields(schema);
|
|
55
|
-
expect(fields).toContain('result: <string>');
|
|
56
|
-
expect(fields).toContain('verdict: SHIP_IT | NEEDS_MINOR_FIXES');
|
|
57
|
-
});
|
|
58
|
-
it('handles boolean fields', () => {
|
|
59
|
-
const schema = z.object({
|
|
60
|
-
enabled: z.boolean(),
|
|
61
|
-
});
|
|
62
|
-
const fields = extractSchemaFields(schema);
|
|
63
|
-
expect(fields).toContain('enabled: <boolean>');
|
|
64
|
-
});
|
|
65
|
-
it('handles nested object fields', () => {
|
|
66
|
-
const schema = z.object({
|
|
67
|
-
metadata: z.object({ key: z.string() }),
|
|
68
|
-
});
|
|
69
|
-
const fields = extractSchemaFields(schema);
|
|
70
|
-
expect(fields).toContain('metadata: <object>');
|
|
71
|
-
});
|
|
72
|
-
it('returns empty array for non-object schema', () => {
|
|
73
|
-
expect(extractSchemaFields(z.string())).toEqual([]);
|
|
74
|
-
expect(extractSchemaFields(null)).toEqual([]);
|
|
75
|
-
expect(extractSchemaFields(undefined)).toEqual([]);
|
|
76
|
-
});
|
|
77
|
-
it('works with DevStoryResultSchema-like schema', () => {
|
|
78
|
-
const schema = z.object({
|
|
79
|
-
result: z.enum(['success', 'failed']),
|
|
80
|
-
ac_met: z.array(z.string()).default([]),
|
|
81
|
-
ac_failures: z.array(z.string()).default([]),
|
|
82
|
-
files_modified: z.array(z.string()).default([]),
|
|
83
|
-
tests: z.enum(['pass', 'fail']),
|
|
84
|
-
notes: z.string().optional(),
|
|
85
|
-
});
|
|
86
|
-
const fields = extractSchemaFields(schema);
|
|
87
|
-
expect(fields).toHaveLength(6);
|
|
88
|
-
expect(fields).toContain('result: success | failed');
|
|
89
|
-
expect(fields).toContain('ac_met: <list>');
|
|
90
|
-
expect(fields).toContain('tests: pass | fail');
|
|
91
|
-
expect(fields).toContain('notes: <string>');
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
describe('buildYamlOutputSuffix', () => {
|
|
95
|
-
it('includes actual field names when schema is provided', () => {
|
|
96
|
-
const schema = z.object({
|
|
97
|
-
result: z.enum(['success', 'failed']),
|
|
98
|
-
files_modified: z.array(z.string()),
|
|
99
|
-
});
|
|
100
|
-
const suffix = buildYamlOutputSuffix(schema);
|
|
101
|
-
expect(suffix).toContain('result: success | failed');
|
|
102
|
-
expect(suffix).toContain('files_modified: <list>');
|
|
103
|
-
expect(suffix).toContain('```yaml');
|
|
104
|
-
expect(suffix).toContain('IMPORTANT');
|
|
105
|
-
});
|
|
106
|
-
it('falls back to generic format when no schema provided', () => {
|
|
107
|
-
const suffix = buildYamlOutputSuffix(undefined);
|
|
108
|
-
expect(suffix).toContain('result: success');
|
|
109
|
-
expect(suffix).toContain('additional fields');
|
|
110
|
-
});
|
|
111
|
-
it('falls back to generic format when schema is null', () => {
|
|
112
|
-
const suffix = buildYamlOutputSuffix(null);
|
|
113
|
-
expect(suffix).toContain('result: success');
|
|
114
|
-
});
|
|
115
|
-
it('includes YAML fence markers', () => {
|
|
116
|
-
const suffix = buildYamlOutputSuffix(z.object({ result: z.string() }));
|
|
117
|
-
expect(suffix).toContain('```yaml');
|
|
118
|
-
expect(suffix).toContain('```');
|
|
119
|
-
});
|
|
120
|
-
it('instructs agent to emit YAML as last output', () => {
|
|
121
|
-
const suffix = buildYamlOutputSuffix();
|
|
122
|
-
expect(suffix).toContain('MUST be the last thing');
|
|
123
|
-
expect(suffix).toContain('Do not add any text after');
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
//# sourceMappingURL=schema-suffix.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema-suffix.test.js","sourceRoot":"","sources":["../../src/__tests__/schema-suffix.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AAE3F,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;YACtB,MAAM,EAA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
|
|
|
1
|
-
/**
|
|
2
|
-
* Unit tests for packages/core/src/dispatch/yaml-parser.ts
|
|
3
|
-
*
|
|
4
|
-
* Tests the two primary exports:
|
|
5
|
-
* - extractYamlBlock(): extraction of YAML from agent output
|
|
6
|
-
* - parseYamlResult(): parsing and optional Zod schema validation
|
|
7
|
-
*
|
|
8
|
-
* Covers:
|
|
9
|
-
* - Fenced YAML extraction (```yaml...```)
|
|
10
|
-
* - Multiple fenced blocks (takes the last one)
|
|
11
|
-
* - Unfenced YAML extraction via anchor keys
|
|
12
|
-
* - Empty/null input handling
|
|
13
|
-
* - YAML parse errors
|
|
14
|
-
* - Schema validation success/failure
|
|
15
|
-
* - Invalid escape sanitization (\$ -> $)
|
|
16
|
-
*/
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=yaml-parser.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"yaml-parser.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/yaml-parser.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
|