-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_integration.js
More file actions
38 lines (33 loc) · 1.42 KB
/
Copy pathdebug_integration.js
File metadata and controls
38 lines (33 loc) · 1.42 KB
1
2
3
4
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
import { AdaptivePlugin } from './src/adaptive.js';
import { tmpdir } from '../../opencode/test/fixture/fixture.js';
(async () => {
const { resetMetrics } = await import('./src/metrics.js');
resetMetrics();
await using tmp = await tmpdir();
const hooks = await AdaptivePlugin({
directory: tmp.path,
client: {} as any,
project: {} as any,
worktree: tmp.path,
experimental_workspace: { register: () => {} },
serverUrl: new URL('http://localhost:4096'),
$: undefined as any,
}, { experimentalActive: true, dedupWindow: 0, debug: true });
const sessionID = 'sess_debug';
await hooks['chat.message']!({ sessionID, agent: 'oracle', model: { providerID: 'nvidia', modelID: 'step-3.5-flash' } }, {} as any);
const bashResults = [
{ output: 'ok1', metadata: {} },
{ output: 'ok2', metadata: {} },
{ output: 'fail1', metadata: { error: 'timeout' } },
{ output: 'ok3', metadata: {} },
{ output: 'fail2', metadata: { error: 'command not found' } },
];
for (let i = 0; i < bashResults.length; i++) {
await hooks['tool.execute.after']!({ tool: 'Bash', sessionID, callID: `bash_${i}`, args: {} }, bashResults[i]);
}
// Wait for async validation
await new Promise(r => setTimeout(r, 10));
const compactOutput = { context: [] as string[] };
await hooks['experimental.session.compacting']!({ sessionID }, compactOutput);
console.log('Compaction context:', compactOutput.context);
})();