refactor: Restructure monorepo to apps/server/ and apps/web/ layout
Move src/ → apps/server/ and packages/web/ → apps/web/ to adopt standard monorepo conventions (apps/ for runnable apps, packages/ for reusable libraries). Update all config files, shared package imports, test fixtures, and documentation to reflect new paths. Key fixes: - Update workspace config to ["apps/*", "packages/*"] - Update tsconfig.json rootDir/include for apps/server/ - Add apps/web/** to vitest exclude list - Update drizzle.config.ts schema path - Fix ensure-schema.ts migration path detection (3 levels up in dev, 2 levels up in dist) - Fix tests/integration/cli-server.test.ts import paths - Update packages/shared imports to apps/server/ paths - Update all docs/ files with new paths
This commit is contained in:
31
apps/server/agent/providers/parsers/index.ts
Normal file
31
apps/server/agent/providers/parsers/index.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Stream Parser Registry
|
||||
*
|
||||
* Factory function to get the appropriate stream parser for a provider.
|
||||
*/
|
||||
|
||||
import type { StreamParser } from '../stream-types.js';
|
||||
import { ClaudeStreamParser } from './claude.js';
|
||||
import { GenericStreamParser } from './generic.js';
|
||||
|
||||
/** Map of provider names to parser constructors */
|
||||
const parserRegistry: Record<string, new () => StreamParser> = {
|
||||
claude: ClaudeStreamParser,
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a stream parser for the given provider.
|
||||
* Returns a provider-specific parser if available, otherwise the generic fallback.
|
||||
*/
|
||||
export function getStreamParser(providerName: string): StreamParser {
|
||||
const ParserClass = parserRegistry[providerName];
|
||||
if (ParserClass) {
|
||||
return new ParserClass();
|
||||
}
|
||||
return new GenericStreamParser();
|
||||
}
|
||||
|
||||
// Re-export types and parsers for direct access
|
||||
export type { StreamParser, StreamEvent } from '../stream-types.js';
|
||||
export { ClaudeStreamParser } from './claude.js';
|
||||
export { GenericStreamParser } from './generic.js';
|
||||
Reference in New Issue
Block a user