Skip to content

Commit d686e2d

Browse files
committed
simple fixes
1 parent 597eb8a commit d686e2d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2321
-2139
lines changed

apps/api/src/ai/agents/factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Agent, type AgentConfig } from "@ai-sdk-tools/agents";
2-
import { defaultMemoryConfig, type AppContext } from "../config";
2+
import { type AppContext, defaultMemoryConfig } from "../config";
33

44
/**
55
* Creates an agent with the default memory configuration.

apps/api/src/ai/agents/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export { createAgent } from "./factory";
21
export { analyticsAgent } from "./analytics";
3-
export { triageAgent, mainAgent } from "./triage";
2+
export { createAgent } from "./factory";
3+
export { mainAgent, triageAgent } from "./triage";

apps/api/src/ai/agents/triage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { models } from "../config";
22
import { buildTriageInstructions } from "../prompts";
3-
import { createAgent } from "./factory";
43
import { analyticsAgent } from "./analytics";
4+
import { createAgent } from "./factory";
55

66
/**
77
* Triage agent that routes user requests to the appropriate specialist.

apps/api/src/ai/config/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
export { models, openrouter, type ModelKey } from "./models";
2-
export { memoryProvider, defaultMemoryConfig } from "./memory";
31
export {
42
type AppContext,
53
buildAppContext,
64
formatContextForLLM,
75
} from "./context";
6+
export { defaultMemoryConfig, memoryProvider } from "./memory";
7+
export { type ModelKey, models, openrouter } from "./models";

apps/api/src/ai/index.ts

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,33 @@
88
* - tools/ - Tool implementations for agents
99
*/
1010

11+
// Agent exports
12+
export { analyticsAgent, createAgent, mainAgent, triageAgent } from "./agents";
1113
// Config exports
1214
export {
13-
models,
14-
openrouter,
15-
memoryProvider,
16-
defaultMemoryConfig,
15+
type AppContext,
1716
buildAppContext,
17+
defaultMemoryConfig,
1818
formatContextForLLM,
19-
type AppContext,
2019
type ModelKey,
20+
memoryProvider,
21+
models,
22+
openrouter,
2123
} from "./config";
22-
23-
// Agent exports
24-
export { createAgent, triageAgent, mainAgent, analyticsAgent } from "./agents";
25-
26-
// Tool exports
27-
export { analyticsTools, executeSqlQueryTool, getTopPagesTool } from "./tools";
28-
2924
// Prompt exports (for customization/testing)
3025
export {
31-
COMMON_AGENT_RULES,
32-
CLICKHOUSE_SCHEMA_DOCS,
33-
buildTriageInstructions,
3426
buildAnalyticsInstructions,
27+
buildTriageInstructions,
28+
CLICKHOUSE_SCHEMA_DOCS,
29+
COMMON_AGENT_RULES,
3530
} from "./prompts";
31+
// Tool exports
32+
export { analyticsTools, executeSqlQueryTool, getTopPagesTool } from "./tools";
3633

3734
// Type exports
3835
export type {
39-
UIChatMessage,
40-
UITools,
4136
ChatMessageMetadata,
4237
MessageDataParts,
38+
UIChatMessage,
39+
UITools,
4340
} from "./types";

apps/api/src/ai/prompts/analytics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { AppContext } from "../config/context";
22
import { formatContextForLLM } from "../config/context";
3-
import { COMMON_AGENT_RULES, CLICKHOUSE_SCHEMA_DOCS } from "./shared";
3+
import { CLICKHOUSE_SCHEMA_DOCS, COMMON_AGENT_RULES } from "./shared";
44

55
/**
66
* Analytics-specific rules for data analysis and presentation.

apps/api/src/ai/prompts/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export { COMMON_AGENT_RULES, CLICKHOUSE_SCHEMA_DOCS } from "./shared";
2-
export { buildTriageInstructions } from "./triage";
31
export { buildAnalyticsInstructions } from "./analytics";
2+
export { CLICKHOUSE_SCHEMA_DOCS, COMMON_AGENT_RULES } from "./shared";
3+
export { buildTriageInstructions } from "./triage";

apps/api/src/ai/tools/execute-sql-query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { tool } from "ai";
22
import { z } from "zod";
33
import {
44
executeTimedQuery,
5-
validateSQL,
6-
SQL_VALIDATION_ERROR,
75
type QueryResult,
6+
SQL_VALIDATION_ERROR,
7+
validateSQL,
88
} from "./utils";
99

1010
/**
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export { createToolLogger } from "./logger";
2-
export { executeTimedQuery, wrapError, type QueryResult } from "./query";
3-
export { validateSQL, SQL_VALIDATION_ERROR } from "./validation";
2+
export { executeTimedQuery, type QueryResult, wrapError } from "./query";
3+
export { SQL_VALIDATION_ERROR, validateSQL } from "./validation";

apps/api/src/ai/types.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
import type { UITool, UIMessage } from "ai";
1+
import type { UIMessage, UITool } from "ai";
22

33
export type UITools = Record<string, UITool>;
44

55
export type ChatMessageMetadata = {
6-
toolCall?: {
7-
toolName: string;
8-
toolParams: Record<string, unknown>;
9-
};
6+
toolCall?: {
7+
toolName: string;
8+
toolParams: Record<string, unknown>;
9+
};
1010
};
1111

1212
export type MessageDataParts = Record<string, unknown> & {
13-
toolChoice?: string;
14-
agentChoice?: string;
13+
toolChoice?: string;
14+
agentChoice?: string;
1515
};
1616

1717
export type UIChatMessage = UIMessage<
18-
ChatMessageMetadata,
19-
MessageDataParts,
20-
UITools
18+
ChatMessageMetadata,
19+
MessageDataParts,
20+
UITools
2121
>;
22-

0 commit comments

Comments
 (0)