@geminilight/mindos 0.5.64 → 0.5.66

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.
Files changed (86) hide show
  1. package/README.md +4 -0
  2. package/README_zh.md +4 -0
  3. package/app/app/api/ask/route.ts +12 -0
  4. package/app/app/api/file/route.ts +9 -0
  5. package/app/app/api/mcp/agents/route.ts +27 -1
  6. package/app/app/api/skills/route.ts +18 -2
  7. package/app/app/api/tree-version/route.ts +8 -0
  8. package/app/components/ActivityBar.tsx +2 -2
  9. package/app/components/Backlinks.tsx +5 -5
  10. package/app/components/CreateSpaceModal.tsx +3 -2
  11. package/app/components/DirPicker.tsx +1 -1
  12. package/app/components/DirView.tsx +2 -3
  13. package/app/components/EditorWrapper.tsx +3 -3
  14. package/app/components/FileTree.tsx +25 -10
  15. package/app/components/GuideCard.tsx +4 -4
  16. package/app/components/HomeContent.tsx +6 -11
  17. package/app/components/MarkdownView.tsx +2 -2
  18. package/app/components/OnboardingView.tsx +1 -1
  19. package/app/components/Panel.tsx +1 -1
  20. package/app/components/RightAgentDetailPanel.tsx +1 -1
  21. package/app/components/RightAskPanel.tsx +1 -1
  22. package/app/components/SearchModal.tsx +10 -2
  23. package/app/components/SidebarLayout.tsx +35 -10
  24. package/app/components/ThemeToggle.tsx +1 -1
  25. package/app/components/agents/AgentDetailContent.tsx +454 -59
  26. package/app/components/agents/AgentsContentPage.tsx +70 -5
  27. package/app/components/agents/AgentsMcpSection.tsx +474 -159
  28. package/app/components/agents/AgentsOverviewSection.tsx +418 -59
  29. package/app/components/agents/AgentsPrimitives.tsx +335 -0
  30. package/app/components/agents/AgentsSkillsSection.tsx +739 -121
  31. package/app/components/agents/SkillDetailPopover.tsx +416 -0
  32. package/app/components/agents/agents-content-model.ts +292 -10
  33. package/app/components/ask/AskContent.tsx +34 -5
  34. package/app/components/ask/FileChip.tsx +1 -0
  35. package/app/components/ask/MentionPopover.tsx +13 -1
  36. package/app/components/ask/MessageList.tsx +5 -7
  37. package/app/components/ask/ToolCallBlock.tsx +4 -4
  38. package/app/components/changes/ChangesBanner.tsx +1 -2
  39. package/app/components/echo/EchoHero.tsx +10 -24
  40. package/app/components/echo/EchoInsightCollapsible.tsx +52 -43
  41. package/app/components/echo/EchoPageSections.tsx +13 -9
  42. package/app/components/echo/EchoSegmentNav.tsx +14 -11
  43. package/app/components/echo/EchoSegmentPageClient.tsx +64 -43
  44. package/app/components/explore/ExploreContent.tsx +3 -7
  45. package/app/components/explore/UseCaseCard.tsx +4 -15
  46. package/app/components/panels/AgentsPanel.tsx +12 -104
  47. package/app/components/panels/AgentsPanelAgentDetail.tsx +2 -2
  48. package/app/components/panels/AgentsPanelAgentGroups.tsx +3 -7
  49. package/app/components/panels/AgentsPanelAgentListRow.tsx +9 -11
  50. package/app/components/panels/EchoPanel.tsx +8 -10
  51. package/app/components/panels/PanelNavRow.tsx +9 -2
  52. package/app/components/panels/PluginsPanel.tsx +2 -2
  53. package/app/components/renderers/agent-inspector/AgentInspectorRenderer.tsx +30 -8
  54. package/app/components/renderers/agent-inspector/manifest.ts +3 -3
  55. package/app/components/renderers/todo/manifest.ts +1 -0
  56. package/app/components/settings/AiTab.tsx +3 -3
  57. package/app/components/settings/AppearanceTab.tsx +2 -2
  58. package/app/components/settings/KnowledgeTab.tsx +3 -3
  59. package/app/components/settings/McpAgentInstall.tsx +3 -6
  60. package/app/components/settings/McpSkillCreateForm.tsx +2 -3
  61. package/app/components/settings/McpSkillRow.tsx +2 -3
  62. package/app/components/settings/McpSkillsSection.tsx +2 -2
  63. package/app/components/settings/McpTab.tsx +12 -13
  64. package/app/components/settings/MonitoringTab.tsx +13 -13
  65. package/app/components/settings/PluginsTab.tsx +2 -2
  66. package/app/components/settings/Primitives.tsx +3 -4
  67. package/app/components/settings/SettingsContent.tsx +3 -3
  68. package/app/components/settings/SyncTab.tsx +11 -17
  69. package/app/components/settings/UpdateTab.tsx +18 -21
  70. package/app/components/settings/types.ts +14 -0
  71. package/app/components/setup/StepKB.tsx +1 -1
  72. package/app/hooks/useMcpData.tsx +4 -2
  73. package/app/hooks/useMention.ts +25 -8
  74. package/app/lib/agent/log.ts +15 -18
  75. package/app/lib/agent/prompt.ts +17 -29
  76. package/app/lib/agent/stream-consumer.ts +3 -0
  77. package/app/lib/agent/to-agent-messages.ts +6 -4
  78. package/app/lib/core/agent-audit-log.ts +280 -0
  79. package/app/lib/core/index.ts +11 -0
  80. package/app/lib/fs.ts +9 -0
  81. package/app/lib/i18n-en.ts +259 -33
  82. package/app/lib/i18n-zh.ts +258 -32
  83. package/app/lib/mcp-agents.ts +231 -2
  84. package/app/lib/types.ts +2 -0
  85. package/package.json +1 -1
  86. package/scripts/migrate-agent-audit-log.js +170 -0
@@ -0,0 +1,170 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * One-shot migration helper:
4
+ * Import legacy Agent-Audit.md and .agent-log.json into .mindos/agent-audit-log.json.
5
+ *
6
+ * Usage:
7
+ * node scripts/migrate-agent-audit-log.js --mind-root /abs/path/to/mindRoot
8
+ */
9
+
10
+ import fs from 'fs';
11
+ import path from 'path';
12
+
13
+ const MAX_EVENTS = 1000;
14
+
15
+ function parseArgs(argv) {
16
+ let mindRoot = '';
17
+ for (let i = 0; i < argv.length; i++) {
18
+ if (argv[i] === '--mind-root') {
19
+ mindRoot = argv[i + 1] || '';
20
+ i += 1;
21
+ }
22
+ }
23
+ return { mindRoot };
24
+ }
25
+
26
+ function nowIso() {
27
+ return new Date().toISOString();
28
+ }
29
+
30
+ function validIso(ts) {
31
+ if (typeof ts !== 'string') return nowIso();
32
+ const ms = new Date(ts).getTime();
33
+ return Number.isFinite(ms) ? new Date(ms).toISOString() : nowIso();
34
+ }
35
+
36
+ function normalizeMessage(message) {
37
+ if (typeof message !== 'string') return undefined;
38
+ return message.slice(0, 2000);
39
+ }
40
+
41
+ function readJson(file, fallback) {
42
+ try {
43
+ if (!fs.existsSync(file)) return fallback;
44
+ return JSON.parse(fs.readFileSync(file, 'utf-8'));
45
+ } catch {
46
+ return fallback;
47
+ }
48
+ }
49
+
50
+ function parseMdBlocks(raw) {
51
+ const blocks = [];
52
+ const re = /```agent-op\s*\n([\s\S]*?)```/g;
53
+ let match;
54
+ while ((match = re.exec(raw)) !== null) {
55
+ try {
56
+ blocks.push(JSON.parse(match[1].trim()));
57
+ } catch {
58
+ // Keep migration best-effort.
59
+ }
60
+ }
61
+ return blocks;
62
+ }
63
+
64
+ function parseJsonLines(raw) {
65
+ const lines = [];
66
+ for (const line of raw.split('\n')) {
67
+ const trimmed = line.trim();
68
+ if (!trimmed || trimmed.startsWith('#') || trimmed.startsWith('//')) continue;
69
+ try {
70
+ lines.push(JSON.parse(trimmed));
71
+ } catch {
72
+ // Ignore malformed line.
73
+ }
74
+ }
75
+ return lines;
76
+ }
77
+
78
+ function toEvent(entry, op, idx) {
79
+ const tool = typeof entry?.tool === 'string' && entry.tool.trim() ? entry.tool.trim() : 'unknown-tool';
80
+ return {
81
+ id: `legacy-script-${Date.now().toString(36)}-${idx.toString(36)}`,
82
+ ts: validIso(entry?.ts),
83
+ tool,
84
+ params: entry?.params && typeof entry.params === 'object' ? entry.params : {},
85
+ result: entry?.result === 'error' ? 'error' : 'ok',
86
+ message: normalizeMessage(entry?.message),
87
+ durationMs: typeof entry?.durationMs === 'number' ? entry.durationMs : undefined,
88
+ op,
89
+ };
90
+ }
91
+
92
+ function main() {
93
+ const { mindRoot } = parseArgs(process.argv.slice(2));
94
+ if (!mindRoot) {
95
+ console.error('Missing --mind-root');
96
+ process.exit(1);
97
+ }
98
+ const root = path.resolve(mindRoot);
99
+ if (!fs.existsSync(root) || !fs.statSync(root).isDirectory()) {
100
+ console.error('Invalid mind root:', root);
101
+ process.exit(1);
102
+ }
103
+
104
+ const legacyMd = path.join(root, 'Agent-Audit.md');
105
+ const legacyJsonl = path.join(root, '.agent-log.json');
106
+ if (!fs.existsSync(legacyMd) && !fs.existsSync(legacyJsonl)) {
107
+ console.log('No legacy Agent-Audit.md or .agent-log.json found. Nothing to migrate.');
108
+ return;
109
+ }
110
+
111
+ const logDir = path.join(root, '.mindos');
112
+ const logFile = path.join(logDir, 'agent-audit-log.json');
113
+ const state = readJson(logFile, {
114
+ version: 1,
115
+ events: [],
116
+ legacy: { mdImportedCount: 0, jsonlImportedCount: 0, lastImportedAt: null },
117
+ });
118
+ const baseEvents = Array.isArray(state.events) ? state.events : [];
119
+ const legacy = {
120
+ mdImportedCount: Number(state?.legacy?.mdImportedCount || 0),
121
+ jsonlImportedCount: Number(state?.legacy?.jsonlImportedCount || 0),
122
+ lastImportedAt: typeof state?.legacy?.lastImportedAt === 'string' ? state.legacy.lastImportedAt : null,
123
+ };
124
+
125
+ const imported = [];
126
+
127
+ if (fs.existsSync(legacyMd)) {
128
+ const blocks = parseMdBlocks(fs.readFileSync(legacyMd, 'utf-8'));
129
+ if (blocks.length > legacy.mdImportedCount) {
130
+ const incoming = blocks.slice(legacy.mdImportedCount);
131
+ imported.push(...incoming.map((entry, idx) => toEvent(entry, 'legacy_agent_audit_md_import', idx)));
132
+ legacy.mdImportedCount = blocks.length;
133
+ legacy.lastImportedAt = nowIso();
134
+ }
135
+ if (blocks.length > 0) fs.rmSync(legacyMd, { force: true });
136
+ }
137
+
138
+ if (fs.existsSync(legacyJsonl)) {
139
+ const lines = parseJsonLines(fs.readFileSync(legacyJsonl, 'utf-8'));
140
+ if (lines.length > legacy.jsonlImportedCount) {
141
+ const incoming = lines.slice(legacy.jsonlImportedCount);
142
+ imported.push(...incoming.map((entry, idx) => toEvent(entry, 'legacy_agent_log_jsonl_import', idx)));
143
+ legacy.jsonlImportedCount = lines.length;
144
+ legacy.lastImportedAt = nowIso();
145
+ }
146
+ if (lines.length > 0) fs.rmSync(legacyJsonl, { force: true });
147
+ }
148
+
149
+ if (imported.length === 0) {
150
+ console.log('No new legacy entries to import.');
151
+ return;
152
+ }
153
+
154
+ const merged = [...baseEvents, ...imported]
155
+ .sort((a, b) => new Date(b.ts).getTime() - new Date(a.ts).getTime())
156
+ .slice(0, MAX_EVENTS);
157
+
158
+ const next = {
159
+ version: 1,
160
+ events: merged,
161
+ legacy,
162
+ };
163
+
164
+ fs.mkdirSync(logDir, { recursive: true });
165
+ fs.writeFileSync(logFile, JSON.stringify(next, null, 2), 'utf-8');
166
+ console.log(`Imported ${imported.length} legacy entry(s) into ${logFile}`);
167
+ }
168
+
169
+ main();
170
+