@kirosnn/mosaic 0.73.0 → 0.74.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/README.md +1 -1
- package/package.json +1 -1
- package/src/agent/prompts/systemPrompt.ts +1 -1
- package/src/agent/prompts/toolsPrompt.ts +64 -3
- package/src/components/Main.tsx +1480 -1459
- package/src/mcp/approvalPolicy.ts +155 -147
- package/src/mcp/cli/doctor.ts +0 -3
- package/src/mcp/config.ts +234 -223
- package/src/mcp/processManager.ts +303 -298
- package/src/mcp/servers/navigation/browser.ts +151 -0
- package/src/mcp/servers/navigation/index.ts +23 -0
- package/src/mcp/servers/navigation/tools.ts +263 -0
- package/src/mcp/servers/navigation/types.ts +17 -0
- package/src/mcp/servers/navigation/utils.ts +20 -0
- package/src/mcp/toolCatalog.ts +181 -168
- package/src/mcp/types.ts +115 -94
- package/src/utils/markdown.tsx +60 -26
- package/src/utils/toolFormatting.ts +55 -6
- package/src/web/components/MessageItem.tsx +44 -13
- package/src/mcp/servers/navigation.ts +0 -854
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import { getToolsPrompt } from './toolsPrompt';
|
|
|
5
5
|
|
|
6
6
|
export const DEFAULT_SYSTEM_PROMPT = `You are Mosaic, an AI coding agent operating in the user's terminal.
|
|
7
7
|
You assist with software engineering tasks: coding, debugging, refactoring, testing, and documentation.
|
|
8
|
-
Version : 0.
|
|
8
|
+
Version : 0.74.0 *(Beta)*
|
|
9
9
|
|
|
10
10
|
# Environment
|
|
11
11
|
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { NATIVE_SERVER_IDS } from '../../mcp/types';
|
|
2
|
+
|
|
3
|
+
const NATIVE_SERVER_LABELS: Record<string, string> = {
|
|
4
|
+
navigation: 'Browser Navigation',
|
|
5
|
+
};
|
|
6
|
+
|
|
1
7
|
export const TOOLS_PROMPT = `
|
|
2
8
|
# Available Tools
|
|
3
9
|
|
|
@@ -235,8 +241,63 @@ export function getToolsPrompt(mcpToolInfos?: Array<{ serverId: string; name: st
|
|
|
235
241
|
return TOOLS_PROMPT;
|
|
236
242
|
}
|
|
237
243
|
|
|
238
|
-
const
|
|
239
|
-
|
|
244
|
+
const nativeTools = mcpToolInfos.filter(t => NATIVE_SERVER_IDS.has(t.serverId));
|
|
245
|
+
const externalTools = mcpToolInfos.filter(t => !NATIVE_SERVER_IDS.has(t.serverId));
|
|
246
|
+
|
|
247
|
+
let result = TOOLS_PROMPT;
|
|
248
|
+
|
|
249
|
+
if (nativeTools.length > 0) {
|
|
250
|
+
result += '\n\n' + buildNativeToolsSection(nativeTools);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (externalTools.length > 0) {
|
|
254
|
+
result += '\n\n' + buildMcpToolsSection(externalTools);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return result;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function buildNativeToolsSection(tools: Array<{ serverId: string; name: string; description: string; inputSchema: Record<string, unknown>; canonicalId: string; safeId: string }>): string {
|
|
261
|
+
const lines: string[] = [];
|
|
262
|
+
|
|
263
|
+
const byServer = new Map<string, typeof tools>();
|
|
264
|
+
for (const t of tools) {
|
|
265
|
+
const list = byServer.get(t.serverId) || [];
|
|
266
|
+
list.push(t);
|
|
267
|
+
byServer.set(t.serverId, list);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
for (const [serverId, serverTools] of byServer) {
|
|
271
|
+
const label = NATIVE_SERVER_LABELS[serverId] || serverId.charAt(0).toUpperCase() + serverId.slice(1);
|
|
272
|
+
lines.push(`## ${label}`);
|
|
273
|
+
lines.push('');
|
|
274
|
+
|
|
275
|
+
for (const t of serverTools) {
|
|
276
|
+
lines.push(`### ${t.safeId}`);
|
|
277
|
+
if (t.description) {
|
|
278
|
+
lines.push(t.description);
|
|
279
|
+
}
|
|
280
|
+
const schema = t.inputSchema;
|
|
281
|
+
if (schema && typeof schema === 'object' && schema.properties) {
|
|
282
|
+
const props = schema.properties as Record<string, Record<string, unknown>>;
|
|
283
|
+
const required = (schema.required || []) as string[];
|
|
284
|
+
const paramLines: string[] = [];
|
|
285
|
+
for (const [key, propSchema] of Object.entries(props)) {
|
|
286
|
+
const type = propSchema.type || 'unknown';
|
|
287
|
+
const desc = propSchema.description || '';
|
|
288
|
+
const req = required.includes(key) ? 'required' : 'optional';
|
|
289
|
+
paramLines.push(`- ${key} (${type}, ${req})${desc ? ': ' + desc : ''}`);
|
|
290
|
+
}
|
|
291
|
+
if (paramLines.length > 0) {
|
|
292
|
+
lines.push('Parameters:');
|
|
293
|
+
lines.push(...paramLines);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
lines.push('');
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return lines.join('\n');
|
|
240
301
|
}
|
|
241
302
|
|
|
242
303
|
function buildMcpToolsSection(tools: Array<{ serverId: string; name: string; description: string; inputSchema: Record<string, unknown>; canonicalId: string; safeId: string }>): string {
|
|
@@ -283,4 +344,4 @@ function buildMcpToolsSection(tools: Array<{ serverId: string; name: string; des
|
|
|
283
344
|
}
|
|
284
345
|
|
|
285
346
|
return lines.join('\n');
|
|
286
|
-
}
|
|
347
|
+
}
|