@kirosnn/mosaic 0.0.91 → 0.73.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +2 -6
- package/package.json +55 -48
- package/src/agent/Agent.ts +353 -131
- package/src/agent/context.ts +4 -4
- package/src/agent/prompts/systemPrompt.ts +209 -70
- package/src/agent/prompts/toolsPrompt.ts +285 -138
- package/src/agent/provider/anthropic.ts +109 -105
- package/src/agent/provider/google.ts +111 -107
- package/src/agent/provider/mistral.ts +95 -95
- package/src/agent/provider/ollama.ts +73 -17
- package/src/agent/provider/openai.ts +146 -102
- package/src/agent/provider/rateLimit.ts +178 -0
- package/src/agent/provider/reasoning.ts +29 -0
- package/src/agent/provider/xai.ts +108 -104
- package/src/agent/tools/definitions.ts +15 -1
- package/src/agent/tools/executor.ts +717 -98
- package/src/agent/tools/exploreExecutor.ts +20 -22
- package/src/agent/tools/fetch.ts +58 -0
- package/src/agent/tools/glob.ts +20 -4
- package/src/agent/tools/grep.ts +64 -9
- package/src/agent/tools/plan.ts +27 -0
- package/src/agent/tools/question.ts +7 -1
- package/src/agent/tools/read.ts +2 -0
- package/src/agent/types.ts +15 -14
- package/src/components/App.tsx +50 -8
- package/src/components/CustomInput.tsx +461 -77
- package/src/components/Main.tsx +1459 -1112
- package/src/components/Setup.tsx +1 -1
- package/src/components/ShortcutsModal.tsx +11 -8
- package/src/components/Welcome.tsx +1 -1
- package/src/components/main/ApprovalPanel.tsx +4 -3
- package/src/components/main/ChatPage.tsx +858 -516
- package/src/components/main/HomePage.tsx +58 -39
- package/src/components/main/QuestionPanel.tsx +52 -7
- package/src/components/main/ThinkingIndicator.tsx +13 -2
- package/src/components/main/types.ts +11 -10
- package/src/index.tsx +53 -25
- package/src/mcp/approvalPolicy.ts +148 -0
- package/src/mcp/cli/add.ts +185 -0
- package/src/mcp/cli/doctor.ts +77 -0
- package/src/mcp/cli/index.ts +85 -0
- package/src/mcp/cli/list.ts +50 -0
- package/src/mcp/cli/logs.ts +24 -0
- package/src/mcp/cli/manage.ts +99 -0
- package/src/mcp/cli/show.ts +53 -0
- package/src/mcp/cli/tools.ts +77 -0
- package/src/mcp/config.ts +223 -0
- package/src/mcp/index.ts +80 -0
- package/src/mcp/processManager.ts +299 -0
- package/src/mcp/rateLimiter.ts +50 -0
- package/src/mcp/registry.ts +151 -0
- package/src/mcp/schemaConverter.ts +100 -0
- package/src/mcp/servers/navigation.ts +854 -0
- package/src/mcp/toolCatalog.ts +169 -0
- package/src/mcp/types.ts +95 -0
- package/src/utils/approvalBridge.ts +45 -12
- package/src/utils/approvalModeBridge.ts +17 -0
- package/src/utils/commands/approvals.ts +48 -0
- package/src/utils/commands/compact.ts +30 -0
- package/src/utils/commands/echo.ts +1 -1
- package/src/utils/commands/image.ts +109 -0
- package/src/utils/commands/index.ts +9 -7
- package/src/utils/commands/new.ts +15 -0
- package/src/utils/commands/types.ts +3 -0
- package/src/utils/config.ts +3 -1
- package/src/utils/diffRendering.tsx +13 -16
- package/src/utils/exploreBridge.ts +10 -0
- package/src/utils/history.ts +82 -40
- package/src/utils/imageBridge.ts +28 -0
- package/src/utils/images.ts +31 -0
- package/src/utils/markdown.tsx +163 -99
- package/src/utils/models.ts +31 -16
- package/src/utils/notificationBridge.ts +23 -0
- package/src/utils/questionBridge.ts +36 -1
- package/src/utils/tokenEstimator.ts +32 -0
- package/src/utils/toolFormatting.ts +428 -48
- package/src/web/app.tsx +65 -5
- package/src/web/assets/css/ChatPage.css +102 -30
- package/src/web/assets/css/MessageItem.css +26 -29
- package/src/web/assets/css/ThinkingIndicator.css +44 -6
- package/src/web/assets/css/ToolMessage.css +36 -14
- package/src/web/components/ChatPage.tsx +228 -105
- package/src/web/components/HomePage.tsx +3 -3
- package/src/web/components/MessageItem.tsx +80 -81
- package/src/web/components/QuestionPanel.tsx +72 -12
- package/src/web/components/Setup.tsx +1 -1
- package/src/web/components/Sidebar.tsx +1 -3
- package/src/web/components/ThinkingIndicator.tsx +41 -21
- package/src/web/router.ts +1 -1
- package/src/web/server.tsx +894 -662
- package/src/web/storage.ts +23 -1
- package/src/web/types.ts +7 -6
- package/src/utils/commands/redo.ts +0 -74
- package/src/utils/commands/sessions.ts +0 -129
- package/src/utils/commands/undo.ts +0 -75
- package/src/utils/undoRedo.ts +0 -429
- package/src/utils/undoRedoBridge.ts +0 -45
- package/src/utils/undoRedoDb.ts +0 -338
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
export interface McpRegistryEntry {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
command: string;
|
|
6
|
+
args: string[];
|
|
7
|
+
env?: Record<string, { description: string; required: boolean }>;
|
|
8
|
+
prompts?: { key: string; question: string; argIndex?: number }[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const MCP_REGISTRY: McpRegistryEntry[] = [
|
|
12
|
+
{
|
|
13
|
+
id: 'filesystem',
|
|
14
|
+
name: 'Filesystem',
|
|
15
|
+
description: 'Read/write access to the local filesystem',
|
|
16
|
+
command: 'npx',
|
|
17
|
+
args: ['-y', '@modelcontextprotocol/server-filesystem', '{path}'],
|
|
18
|
+
prompts: [{ key: 'path', question: 'Directory path to expose', argIndex: 2 }],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 'memory',
|
|
22
|
+
name: 'Memory',
|
|
23
|
+
description: 'Persistent knowledge graph memory for the agent',
|
|
24
|
+
command: 'npx',
|
|
25
|
+
args: ['-y', '@modelcontextprotocol/server-memory'],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 'fetch',
|
|
29
|
+
name: 'Fetch',
|
|
30
|
+
description: 'Fetch and convert web content to markdown',
|
|
31
|
+
command: 'npx',
|
|
32
|
+
args: ['-y', '@modelcontextprotocol/server-fetch'],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'brave-search',
|
|
36
|
+
name: 'Brave Search',
|
|
37
|
+
description: 'Web search via Brave Search API',
|
|
38
|
+
command: 'npx',
|
|
39
|
+
args: ['-y', '@modelcontextprotocol/server-brave-search'],
|
|
40
|
+
env: { BRAVE_API_KEY: { description: 'Brave Search API key', required: true } },
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 'github',
|
|
44
|
+
name: 'GitHub',
|
|
45
|
+
description: 'GitHub API access (repos, issues, PRs, etc.)',
|
|
46
|
+
command: 'npx',
|
|
47
|
+
args: ['-y', '@modelcontextprotocol/server-github'],
|
|
48
|
+
env: { GITHUB_PERSONAL_ACCESS_TOKEN: { description: 'GitHub personal access token', required: true } },
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: 'gitlab',
|
|
52
|
+
name: 'GitLab',
|
|
53
|
+
description: 'GitLab API access (repos, issues, MRs, etc.)',
|
|
54
|
+
command: 'npx',
|
|
55
|
+
args: ['-y', '@modelcontextprotocol/server-gitlab'],
|
|
56
|
+
env: {
|
|
57
|
+
GITLAB_PERSONAL_ACCESS_TOKEN: { description: 'GitLab personal access token', required: true },
|
|
58
|
+
GITLAB_API_URL: { description: 'GitLab API URL (for self-hosted)', required: false },
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: 'google-maps',
|
|
63
|
+
name: 'Google Maps',
|
|
64
|
+
description: 'Google Maps geocoding, directions, places, and elevation',
|
|
65
|
+
command: 'npx',
|
|
66
|
+
args: ['-y', '@modelcontextprotocol/server-google-maps'],
|
|
67
|
+
env: { GOOGLE_MAPS_API_KEY: { description: 'Google Maps API key', required: true } },
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: 'slack',
|
|
71
|
+
name: 'Slack',
|
|
72
|
+
description: 'Slack workspace access (channels, messages, users)',
|
|
73
|
+
command: 'npx',
|
|
74
|
+
args: ['-y', '@modelcontextprotocol/server-slack'],
|
|
75
|
+
env: {
|
|
76
|
+
SLACK_BOT_TOKEN: { description: 'Slack bot token (xoxb-...)', required: true },
|
|
77
|
+
SLACK_TEAM_ID: { description: 'Slack workspace/team ID', required: true },
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'postgres',
|
|
82
|
+
name: 'PostgreSQL',
|
|
83
|
+
description: 'Read-only access to a PostgreSQL database',
|
|
84
|
+
command: 'npx',
|
|
85
|
+
args: ['-y', '@modelcontextprotocol/server-postgres', '{connection_string}'],
|
|
86
|
+
prompts: [{ key: 'connection_string', question: 'PostgreSQL connection string (postgresql://...)', argIndex: 2 }],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'sqlite',
|
|
90
|
+
name: 'SQLite',
|
|
91
|
+
description: 'Read/write access to a SQLite database',
|
|
92
|
+
command: 'npx',
|
|
93
|
+
args: ['-y', '@modelcontextprotocol/server-sqlite', '--db-path', '{db_path}'],
|
|
94
|
+
prompts: [{ key: 'db_path', question: 'Path to the SQLite database file', argIndex: 3 }],
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'puppeteer',
|
|
98
|
+
name: 'Puppeteer',
|
|
99
|
+
description: 'Browser automation and web scraping via Puppeteer',
|
|
100
|
+
command: 'npx',
|
|
101
|
+
args: ['-y', '@modelcontextprotocol/server-puppeteer'],
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: 'sequential-thinking',
|
|
105
|
+
name: 'Sequential Thinking',
|
|
106
|
+
description: 'Dynamic problem-solving through structured sequential thinking',
|
|
107
|
+
command: 'npx',
|
|
108
|
+
args: ['-y', '@modelcontextprotocol/server-sequential-thinking'],
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: 'everything',
|
|
112
|
+
name: 'Everything',
|
|
113
|
+
description: 'MCP test server with sample tools, resources, and prompts',
|
|
114
|
+
command: 'npx',
|
|
115
|
+
args: ['-y', '@modelcontextprotocol/server-everything'],
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: 'browser-use',
|
|
119
|
+
name: 'Browser Use',
|
|
120
|
+
description: 'AI-powered browser automation, web search, and data extraction',
|
|
121
|
+
command: 'npx',
|
|
122
|
+
args: ['-y', 'browser-use-mcp'],
|
|
123
|
+
env: { BROWSER_USE_API_KEY: { description: 'Browser Use API key (from cloud.browser-use.com)', required: true } },
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: 'sentry',
|
|
127
|
+
name: 'Sentry',
|
|
128
|
+
description: 'Sentry error tracking access',
|
|
129
|
+
command: 'npx',
|
|
130
|
+
args: ['-y', '@modelcontextprotocol/server-sentry'],
|
|
131
|
+
env: { SENTRY_AUTH_TOKEN: { description: 'Sentry auth token', required: true } },
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
|
|
135
|
+
export function findRegistryEntry(nameOrId: string): McpRegistryEntry | null {
|
|
136
|
+
const lower = nameOrId.toLowerCase().replace(/\s+/g, '-');
|
|
137
|
+
return MCP_REGISTRY.find(e =>
|
|
138
|
+
e.id === lower ||
|
|
139
|
+
e.name.toLowerCase() === nameOrId.toLowerCase() ||
|
|
140
|
+
e.name.toLowerCase().replace(/\s+/g, '-') === lower
|
|
141
|
+
) || null;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export function searchRegistry(query: string): McpRegistryEntry[] {
|
|
145
|
+
const lower = query.toLowerCase();
|
|
146
|
+
return MCP_REGISTRY.filter(e =>
|
|
147
|
+
e.id.includes(lower) ||
|
|
148
|
+
e.name.toLowerCase().includes(lower) ||
|
|
149
|
+
e.description.toLowerCase().includes(lower)
|
|
150
|
+
);
|
|
151
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { z, type ZodTypeAny } from 'zod';
|
|
2
|
+
|
|
3
|
+
export function jsonSchemaToZod(schema: Record<string, unknown>): ZodTypeAny {
|
|
4
|
+
if (!schema || typeof schema !== 'object') {
|
|
5
|
+
return z.unknown();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (schema.enum && Array.isArray(schema.enum)) {
|
|
9
|
+
const values = schema.enum as [string, ...string[]];
|
|
10
|
+
if (values.length > 0) {
|
|
11
|
+
return z.enum(values as [string, ...string[]]);
|
|
12
|
+
}
|
|
13
|
+
return z.string();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
17
|
+
const schemas = (schema.oneOf as Record<string, unknown>[]).map(s => jsonSchemaToZod(s));
|
|
18
|
+
if (schemas.length === 0) return z.unknown();
|
|
19
|
+
if (schemas.length === 1) return schemas[0]!;
|
|
20
|
+
return z.union([schemas[0]!, schemas[1]!, ...schemas.slice(2)]);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
24
|
+
const schemas = (schema.anyOf as Record<string, unknown>[]).map(s => jsonSchemaToZod(s));
|
|
25
|
+
if (schemas.length === 0) return z.unknown();
|
|
26
|
+
if (schemas.length === 1) return schemas[0]!;
|
|
27
|
+
return z.union([schemas[0]!, schemas[1]!, ...schemas.slice(2)]);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const type = schema.type as string | undefined;
|
|
31
|
+
const description = schema.description as string | undefined;
|
|
32
|
+
|
|
33
|
+
let result: ZodTypeAny;
|
|
34
|
+
|
|
35
|
+
switch (type) {
|
|
36
|
+
case 'string': {
|
|
37
|
+
let s = z.string();
|
|
38
|
+
if (typeof schema.minLength === 'number') s = s.min(schema.minLength);
|
|
39
|
+
if (typeof schema.maxLength === 'number') s = s.max(schema.maxLength);
|
|
40
|
+
result = s;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
case 'number':
|
|
45
|
+
case 'integer': {
|
|
46
|
+
let n = type === 'integer' ? z.number().int() : z.number();
|
|
47
|
+
if (typeof schema.minimum === 'number') n = n.min(schema.minimum);
|
|
48
|
+
if (typeof schema.maximum === 'number') n = n.max(schema.maximum);
|
|
49
|
+
result = n;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
case 'boolean':
|
|
54
|
+
result = z.boolean();
|
|
55
|
+
break;
|
|
56
|
+
|
|
57
|
+
case 'array': {
|
|
58
|
+
const items = schema.items as Record<string, unknown> | undefined;
|
|
59
|
+
const itemSchema = items ? jsonSchemaToZod(items) : z.unknown();
|
|
60
|
+
result = z.array(itemSchema);
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
case 'object': {
|
|
65
|
+
result = jsonSchemaObjectToZodObject(schema);
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
case 'null':
|
|
70
|
+
result = z.null();
|
|
71
|
+
break;
|
|
72
|
+
|
|
73
|
+
default:
|
|
74
|
+
result = z.unknown();
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (description) {
|
|
79
|
+
result = result.describe(description);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function jsonSchemaObjectToZodObject(schema: Record<string, unknown>): z.ZodObject<any> {
|
|
86
|
+
const properties = (schema.properties || {}) as Record<string, Record<string, unknown>>;
|
|
87
|
+
const required = (schema.required || []) as string[];
|
|
88
|
+
|
|
89
|
+
const shape: Record<string, ZodTypeAny> = {};
|
|
90
|
+
|
|
91
|
+
for (const [key, propSchema] of Object.entries(properties)) {
|
|
92
|
+
let zodProp = jsonSchemaToZod(propSchema);
|
|
93
|
+
if (!required.includes(key)) {
|
|
94
|
+
zodProp = zodProp.optional();
|
|
95
|
+
}
|
|
96
|
+
shape[key] = zodProp;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return z.object(shape).passthrough();
|
|
100
|
+
}
|