fix: resolve strict typecheck fallout in setup, routing, and tests
This commit is contained in:
+38
-34
@@ -99,18 +99,18 @@ describe('daemon command fast-path integration', () => {
|
||||
const router = createMessageRouter({
|
||||
sessionManager: {
|
||||
getSession: vi.fn(() => session),
|
||||
} as MessageRouterDeps['sessionManager'],
|
||||
} as unknown as MessageRouterDeps['sessionManager'],
|
||||
modelRouter: {
|
||||
getAvailableTiers: () => ['fast', 'default', 'complex', 'local'],
|
||||
getAllLabels: () => ({ fast: 'fast', default: 'default', complex: 'complex', local: 'local' }),
|
||||
getLabel: (tier: string) => tier,
|
||||
} as MessageRouterDeps['modelRouter'],
|
||||
} as unknown as MessageRouterDeps['modelRouter'],
|
||||
systemPrompt: 'test prompt',
|
||||
toolRegistry: {
|
||||
clone() { return this; },
|
||||
register: vi.fn(),
|
||||
} as MessageRouterDeps['toolRegistry'],
|
||||
toolExecutor: {} as MessageRouterDeps['toolExecutor'],
|
||||
} as unknown as MessageRouterDeps['toolRegistry'],
|
||||
toolExecutor: {} as unknown as MessageRouterDeps['toolExecutor'],
|
||||
config: {
|
||||
agents: {
|
||||
primary_tier: 'default',
|
||||
@@ -126,16 +126,17 @@ describe('daemon command fast-path integration', () => {
|
||||
},
|
||||
compaction: { enabled: false },
|
||||
models: { default: { provider: 'anthropic', model: 'claude' } },
|
||||
} as MessageRouterDeps['config'],
|
||||
} as unknown as MessageRouterDeps['config'],
|
||||
commandRegistry,
|
||||
});
|
||||
|
||||
const reply = vi.fn(async () => {});
|
||||
const reply = vi.fn(async (_message: OutboundMessage) => {});
|
||||
await router.handler({
|
||||
id: 'm1',
|
||||
channel: 'telegram',
|
||||
senderId: 'user-1',
|
||||
text: '/reset',
|
||||
timestamp: Date.now(),
|
||||
metadata: { isCommand: true, command: 'reset' },
|
||||
} as MessageRouterInput, reply);
|
||||
|
||||
@@ -163,18 +164,18 @@ describe('daemon command fast-path integration', () => {
|
||||
const router = createMessageRouter({
|
||||
sessionManager: {
|
||||
getSession: vi.fn(() => session),
|
||||
} as MessageRouterDeps['sessionManager'],
|
||||
} as unknown as MessageRouterDeps['sessionManager'],
|
||||
modelRouter: {
|
||||
getAvailableTiers: () => ['fast', 'default', 'complex', 'local'],
|
||||
getAllLabels: () => ({ fast: 'fast', default: 'default', complex: 'complex', local: 'local' }),
|
||||
getLabel: (tier: string) => tier,
|
||||
} as MessageRouterDeps['modelRouter'],
|
||||
} as unknown as MessageRouterDeps['modelRouter'],
|
||||
systemPrompt: 'test prompt',
|
||||
toolRegistry: {
|
||||
clone() { return this; },
|
||||
register: vi.fn(),
|
||||
} as MessageRouterDeps['toolRegistry'],
|
||||
toolExecutor: {} as MessageRouterDeps['toolExecutor'],
|
||||
} as unknown as MessageRouterDeps['toolRegistry'],
|
||||
toolExecutor: {} as unknown as MessageRouterDeps['toolExecutor'],
|
||||
config: {
|
||||
agents: {
|
||||
primary_tier: 'default',
|
||||
@@ -190,16 +191,17 @@ describe('daemon command fast-path integration', () => {
|
||||
},
|
||||
compaction: { enabled: false },
|
||||
models: { default: { provider: 'anthropic', model: 'claude' } },
|
||||
} as MessageRouterDeps['config'],
|
||||
} as unknown as MessageRouterDeps['config'],
|
||||
commandRegistry,
|
||||
});
|
||||
|
||||
const reply = vi.fn(async () => {});
|
||||
const reply = vi.fn(async (_message: OutboundMessage) => {});
|
||||
await router.handler({
|
||||
id: 'm4',
|
||||
channel: 'telegram',
|
||||
senderId: 'user-4',
|
||||
text: '/model fast',
|
||||
timestamp: Date.now(),
|
||||
metadata: { isCommand: true, command: 'model', commandArgs: 'fast' },
|
||||
} as MessageRouterInput, reply);
|
||||
|
||||
@@ -247,18 +249,18 @@ describe('daemon command fast-path integration', () => {
|
||||
const router = createMessageRouter({
|
||||
sessionManager: {
|
||||
getSession: vi.fn(() => session),
|
||||
} as MessageRouterDeps['sessionManager'],
|
||||
} as unknown as MessageRouterDeps['sessionManager'],
|
||||
modelRouter: {
|
||||
getAvailableTiers: () => ['fast', 'default', 'complex', 'local'],
|
||||
getAllLabels: () => ({ fast: 'fast', default: 'default', complex: 'complex', local: 'local' }),
|
||||
getLabel: (tier: string) => tier,
|
||||
} as MessageRouterDeps['modelRouter'],
|
||||
} as unknown as MessageRouterDeps['modelRouter'],
|
||||
systemPrompt: 'test prompt',
|
||||
toolRegistry: {
|
||||
clone() { return this; },
|
||||
register: vi.fn(),
|
||||
} as MessageRouterDeps['toolRegistry'],
|
||||
toolExecutor: {} as MessageRouterDeps['toolExecutor'],
|
||||
} as unknown as MessageRouterDeps['toolRegistry'],
|
||||
toolExecutor: {} as unknown as MessageRouterDeps['toolExecutor'],
|
||||
config: {
|
||||
intents: { enabled: true },
|
||||
agents: {
|
||||
@@ -275,7 +277,7 @@ describe('daemon command fast-path integration', () => {
|
||||
},
|
||||
compaction: { enabled: false },
|
||||
models: { default: { provider: 'anthropic', model: 'claude' } },
|
||||
} as MessageRouterDeps['config'],
|
||||
} as unknown as MessageRouterDeps['config'],
|
||||
commandRegistry,
|
||||
intentRegistry,
|
||||
agentConfigRegistry,
|
||||
@@ -287,6 +289,7 @@ describe('daemon command fast-path integration', () => {
|
||||
channel: 'telegram',
|
||||
senderId: 'user-2',
|
||||
text: 'deploy backend now',
|
||||
timestamp: Date.now(),
|
||||
metadata: { isCommand: true, command: 'reset' },
|
||||
} as MessageRouterInput, vi.fn(async () => {}));
|
||||
|
||||
@@ -340,18 +343,18 @@ describe('daemon command fast-path integration', () => {
|
||||
const router = createMessageRouter({
|
||||
sessionManager: {
|
||||
getSession: vi.fn(() => session),
|
||||
} as MessageRouterDeps['sessionManager'],
|
||||
} as unknown as MessageRouterDeps['sessionManager'],
|
||||
modelRouter: {
|
||||
getAvailableTiers: () => ['fast', 'default', 'complex', 'local'],
|
||||
getAllLabels: () => ({ fast: 'fast', default: 'default', complex: 'complex', local: 'local' }),
|
||||
getLabel: (tier: string) => tier,
|
||||
} as MessageRouterDeps['modelRouter'],
|
||||
} as unknown as MessageRouterDeps['modelRouter'],
|
||||
systemPrompt: 'test prompt',
|
||||
toolRegistry: {
|
||||
clone() { return this; },
|
||||
register: vi.fn(),
|
||||
} as MessageRouterDeps['toolRegistry'],
|
||||
toolExecutor: {} as MessageRouterDeps['toolExecutor'],
|
||||
} as unknown as MessageRouterDeps['toolRegistry'],
|
||||
toolExecutor: {} as unknown as MessageRouterDeps['toolExecutor'],
|
||||
config: {
|
||||
intents: { enabled: true },
|
||||
agents: {
|
||||
@@ -368,7 +371,7 @@ describe('daemon command fast-path integration', () => {
|
||||
},
|
||||
compaction: { enabled: false },
|
||||
models: { default: { provider: 'anthropic', model: 'claude' } },
|
||||
} as MessageRouterDeps['config'],
|
||||
} as unknown as MessageRouterDeps['config'],
|
||||
commandRegistry,
|
||||
intentRegistry,
|
||||
routingPolicy,
|
||||
@@ -381,6 +384,7 @@ describe('daemon command fast-path integration', () => {
|
||||
channel: 'telegram',
|
||||
senderId: 'user-3',
|
||||
text: 'deploy backend now',
|
||||
timestamp: Date.now(),
|
||||
metadata: { isCommand: true, command: 'reset' },
|
||||
} as MessageRouterInput, vi.fn(async () => {}));
|
||||
|
||||
@@ -412,15 +416,15 @@ describe('daemon audio routing integration', () => {
|
||||
registerBuiltinCommands(commandRegistry);
|
||||
|
||||
const router = createMessageRouter({
|
||||
sessionManager: { getSession: vi.fn(() => session) } as MessageRouterDeps['sessionManager'],
|
||||
sessionManager: { getSession: vi.fn(() => session) } as unknown as MessageRouterDeps['sessionManager'],
|
||||
modelRouter: {
|
||||
getAvailableTiers: () => ['default'],
|
||||
getAllLabels: () => ({ default: 'default' }),
|
||||
getLabel: (tier: string) => tier,
|
||||
} as MessageRouterDeps['modelRouter'],
|
||||
} as unknown as MessageRouterDeps['modelRouter'],
|
||||
systemPrompt: 'test prompt',
|
||||
toolRegistry: { clone() { return this; }, register: vi.fn() } as MessageRouterDeps['toolRegistry'],
|
||||
toolExecutor: {} as MessageRouterDeps['toolExecutor'],
|
||||
toolRegistry: { clone() { return this; }, register: vi.fn() } as unknown as MessageRouterDeps['toolRegistry'],
|
||||
toolExecutor: {} as unknown as MessageRouterDeps['toolExecutor'],
|
||||
config: {
|
||||
agents: {
|
||||
primary_tier: 'default',
|
||||
@@ -438,11 +442,11 @@ describe('daemon audio routing integration', () => {
|
||||
// Anthropic doesn't support native audio; ensures routing hits the non-audio path.
|
||||
models: { default: { provider: 'anthropic', model: 'claude' } },
|
||||
audio: { enabled: false },
|
||||
} as MessageRouterDeps['config'],
|
||||
} as unknown as MessageRouterDeps['config'],
|
||||
commandRegistry,
|
||||
});
|
||||
|
||||
const reply = vi.fn(async () => {});
|
||||
const reply = vi.fn(async (_message: OutboundMessage) => {});
|
||||
await router.handler({
|
||||
id: 'v1',
|
||||
channel: 'telegram',
|
||||
@@ -485,15 +489,15 @@ describe('daemon audio routing integration', () => {
|
||||
registerBuiltinCommands(commandRegistry);
|
||||
|
||||
const router = createMessageRouter({
|
||||
sessionManager: { getSession: vi.fn(() => session) } as MessageRouterDeps['sessionManager'],
|
||||
sessionManager: { getSession: vi.fn(() => session) } as unknown as MessageRouterDeps['sessionManager'],
|
||||
modelRouter: {
|
||||
getAvailableTiers: () => ['default'],
|
||||
getAllLabels: () => ({ default: 'default' }),
|
||||
getLabel: (tier: string) => tier,
|
||||
} as MessageRouterDeps['modelRouter'],
|
||||
} as unknown as MessageRouterDeps['modelRouter'],
|
||||
systemPrompt: 'test prompt',
|
||||
toolRegistry: { clone() { return this; }, register: vi.fn() } as MessageRouterDeps['toolRegistry'],
|
||||
toolExecutor: {} as MessageRouterDeps['toolExecutor'],
|
||||
toolRegistry: { clone() { return this; }, register: vi.fn() } as unknown as MessageRouterDeps['toolRegistry'],
|
||||
toolExecutor: {} as unknown as MessageRouterDeps['toolExecutor'],
|
||||
config: {
|
||||
agents: {
|
||||
primary_tier: 'default',
|
||||
@@ -513,11 +517,11 @@ describe('daemon audio routing integration', () => {
|
||||
enabled: true,
|
||||
provider: { type: 'openai', endpoint: 'https://example.com/v1/audio/transcriptions', api_key: 'sk-test', model: 'whisper-1' },
|
||||
},
|
||||
} as MessageRouterDeps['config'],
|
||||
} as unknown as MessageRouterDeps['config'],
|
||||
commandRegistry,
|
||||
});
|
||||
|
||||
const reply = vi.fn(async () => {});
|
||||
const reply = vi.fn(async (_message: OutboundMessage) => {});
|
||||
await router.handler({
|
||||
id: 'v2',
|
||||
channel: 'telegram',
|
||||
|
||||
Reference in New Issue
Block a user