feat(sdk): expose runtime bridge controls via GSD options
This commit is contained in:
33
sdk/src/runtime-bridge-options.test.ts
Normal file
33
sdk/src/runtime-bridge-options.test.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { GSD } from './index.js';
|
||||
import { GSDEventType, type GSDEvent } from './types.js';
|
||||
|
||||
describe('GSD runtime bridge options', () => {
|
||||
it('strictSdk option is honored by createTools dispatch seam', async () => {
|
||||
const gsd = new GSD({
|
||||
projectDir: process.cwd(),
|
||||
strictSdk: true,
|
||||
allowFallbackToSubprocess: true,
|
||||
sessionId: 'test-session',
|
||||
});
|
||||
|
||||
const events: GSDEvent[] = [];
|
||||
gsd.onEvent((event) => events.push(event));
|
||||
|
||||
await expect(gsd.createTools().exec('nonexistent-command', [])).rejects.toThrow(
|
||||
"Strict SDK mode: command 'nonexistent-command' has no native adapter",
|
||||
);
|
||||
|
||||
const streamEvent = events.find((event) => event.type === GSDEventType.StreamEvent);
|
||||
expect(streamEvent).toBeDefined();
|
||||
expect(streamEvent).toMatchObject({
|
||||
type: GSDEventType.StreamEvent,
|
||||
sessionId: 'test-session',
|
||||
event: {
|
||||
type: 'query_dispatch',
|
||||
command: 'nonexistent-command',
|
||||
outcome: 'error',
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user