@geminilight/mindos 0.6.49 → 0.6.51
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/_standalone/.mindos-build-version +1 -1
- package/_standalone/.next/BUILD_ID +1 -1
- package/_standalone/.next/app-path-routes-manifest.json +23 -23
- package/_standalone/.next/build-manifest.json +2 -2
- package/_standalone/.next/cache/.previewinfo +1 -1
- package/_standalone/.next/cache/.rscinfo +1 -1
- package/_standalone/.next/cache/config.json +3 -3
- package/_standalone/.next/prerender-manifest.json +3 -3
- package/_standalone/.next/server/app/.well-known/agent-card.json/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/_global-error.html +2 -2
- package/_standalone/.next/server/app/_global-error.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/_standalone/.next/server/app/_not-found/page.js +1 -1
- package/_standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/agents/[agentKey]/page.js +1 -1
- package/_standalone/.next/server/app/agents/[agentKey]/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/agents/[agentKey]/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/agents/page.js +1 -1
- package/_standalone/.next/server/app/agents/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/agents/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/agents/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/delegations/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/discover/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/config/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/detect/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/install/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/registry/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/session/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/agent-activity/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/ask/route.js +30 -30
- package/_standalone/.next/server/app/api/ask/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/ask-sessions/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/auth/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/backlinks/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/bootstrap/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/changes/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/export/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/extract-pdf/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/file/import/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/file/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/graph/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/inbox/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/agents/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/install/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/install-skill/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/restart/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/status/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/uninstall/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/monitoring/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/recent-files/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/restart/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/list-models/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/reset-token/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/test-key/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/check-path/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/check-port/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/generate-token/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/ls/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/sync/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/tree-version/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/uninstall/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/update-check/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/update-status/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/workflows/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/changes/page.js +1 -1
- package/_standalone/.next/server/app/changes/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/changes/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/echo/[segment]/page.js +1 -1
- package/_standalone/.next/server/app/echo/[segment]/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/echo/[segment]/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/echo/page.js +1 -1
- package/_standalone/.next/server/app/echo/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/echo/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/explore/page.js +1 -1
- package/_standalone/.next/server/app/explore/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/explore/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/help/page.js +1 -1
- package/_standalone/.next/server/app/help/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/help/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/login/page.js +1 -1
- package/_standalone/.next/server/app/login/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/page.js +1 -1
- package/_standalone/.next/server/app/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/setup/page.js +1 -1
- package/_standalone/.next/server/app/setup/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/trash/page.js +2 -2
- package/_standalone/.next/server/app/trash/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/view/[...path]/page.js +1 -1
- package/_standalone/.next/server/app/view/[...path]/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/view/[...path]/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app-paths-manifest.json +23 -23
- package/_standalone/.next/server/chunks/{9986.js → 1975.js} +2 -2
- package/_standalone/.next/server/chunks/4241.js +20 -20
- package/_standalone/.next/server/pages/500.html +2 -2
- package/_standalone/.next/server/server-reference-manifest.js +1 -1
- package/_standalone/.next/server/server-reference-manifest.json +1 -1
- package/_standalone/.next/static/chunks/app/{layout-e49b880ef457bb2c.js → layout-4264ca690ad73be1.js} +27 -27
- package/_standalone/.next/static/chunks/app/page-00202b22c6db2144.js +7 -0
- package/_standalone/.next/static/chunks/app/trash/page-e0398f37b2a47da5.js +1 -0
- package/_standalone/.next/static/chunks/app/view/[...path]/page-02d632d03f3ec6c6.js +12 -0
- package/_standalone/.next/trace +63 -63
- package/_standalone/tsconfig.tsbuildinfo +1 -1
- package/app/app/api/ask/route.ts +47 -15
- package/bin/commands/dev.js +10 -0
- package/bin/commands/doctor.js +18 -6
- package/bin/commands/start.js +17 -8
- package/bin/lib/cli-shim.js +166 -0
- package/package.json +1 -1
- package/scripts/build-runtime-archive.sh +4 -1
- package/_standalone/.next/static/chunks/app/page-b3a7338f30362edb.js +0 -7
- package/_standalone/.next/static/chunks/app/trash/page-c8bf8845e81cf112.js +0 -1
- package/_standalone/.next/static/chunks/app/view/[...path]/page-409e1b9baa22c66a.js +0 -12
- /package/_standalone/.next/static/{v1Q015tiqW8z0rkxr-Kpt → Oo3NOv4X7Res4OjfuRdIF}/_buildManifest.js +0 -0
- /package/_standalone/.next/static/{v1Q015tiqW8z0rkxr-Kpt → Oo3NOv4X7Res4OjfuRdIF}/_ssgManifest.js +0 -0
package/app/app/api/ask/route.ts
CHANGED
|
@@ -230,21 +230,26 @@ function readKnowledgeFile(filePath: string): { ok: boolean; content: string; tr
|
|
|
230
230
|
* Tries in order: app/data/skills → skills → {mindRoot}/.skills → ~/.mindos/skills
|
|
231
231
|
* Returns { path, result } where result is the file content or error.
|
|
232
232
|
*/
|
|
233
|
+
/**
|
|
234
|
+
* Candidate skill directories, ordered by priority.
|
|
235
|
+
* Used for SKILL.md resolution AND reference file fallback.
|
|
236
|
+
*/
|
|
237
|
+
function skillDirCandidates(skillName: string, projectRoot: string, mindRoot: string): string[] {
|
|
238
|
+
return [
|
|
239
|
+
path.join(projectRoot, 'app', 'data', 'skills', skillName),
|
|
240
|
+
path.join(projectRoot, 'skills', skillName),
|
|
241
|
+
path.join(mindRoot, '.skills', skillName),
|
|
242
|
+
path.join(process.env.HOME || '/root', '.mindos', 'skills', skillName),
|
|
243
|
+
];
|
|
244
|
+
}
|
|
245
|
+
|
|
233
246
|
function resolveSkillFile(
|
|
234
247
|
skillName: string,
|
|
235
248
|
projectRoot: string,
|
|
236
249
|
mindRoot: string,
|
|
237
250
|
): { path: string; result: ReturnType<typeof readAbsoluteFile> } {
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
path.join(projectRoot, 'app', 'data', 'skills', skillName, 'SKILL.md'),
|
|
241
|
-
// Fallback: repository root (dev/CLI usage)
|
|
242
|
-
path.join(projectRoot, 'skills', skillName, 'SKILL.md'),
|
|
243
|
-
// Fallback: knowledge base custom skills
|
|
244
|
-
path.join(mindRoot, '.skills', skillName, 'SKILL.md'),
|
|
245
|
-
// Fallback: global user skills
|
|
246
|
-
path.join(process.env.HOME || '/root', '.mindos', 'skills', skillName, 'SKILL.md'),
|
|
247
|
-
];
|
|
251
|
+
const dirs = skillDirCandidates(skillName, projectRoot, mindRoot);
|
|
252
|
+
const locations = dirs.map(d => path.join(d, 'SKILL.md'));
|
|
248
253
|
|
|
249
254
|
for (const absPath of locations) {
|
|
250
255
|
const result = readAbsoluteFile(absPath);
|
|
@@ -253,7 +258,6 @@ function resolveSkillFile(
|
|
|
253
258
|
}
|
|
254
259
|
}
|
|
255
260
|
|
|
256
|
-
// All locations failed — return last error
|
|
257
261
|
return {
|
|
258
262
|
path: locations[locations.length - 1],
|
|
259
263
|
result: {
|
|
@@ -265,6 +269,34 @@ function resolveSkillFile(
|
|
|
265
269
|
};
|
|
266
270
|
}
|
|
267
271
|
|
|
272
|
+
/**
|
|
273
|
+
* Resolve a skill reference file (e.g. references/write-supplement.md) with
|
|
274
|
+
* multi-location fallback. First tries relative to the found SKILL.md, then
|
|
275
|
+
* falls back to all other candidate directories. This handles the case where
|
|
276
|
+
* SKILL.md is found in one location but its references/ dir is in another
|
|
277
|
+
* (e.g. stale Desktop build, Core Hot Update with partial content).
|
|
278
|
+
*/
|
|
279
|
+
function resolveSkillReference(
|
|
280
|
+
relPath: string,
|
|
281
|
+
skillInfo: { path: string },
|
|
282
|
+
skillName: string,
|
|
283
|
+
projectRoot: string,
|
|
284
|
+
mindRoot: string,
|
|
285
|
+
): ReturnType<typeof readAbsoluteFile> {
|
|
286
|
+
const primaryDir = path.dirname(skillInfo.path);
|
|
287
|
+
const primaryPath = path.join(primaryDir, relPath);
|
|
288
|
+
const primaryResult = readAbsoluteFile(primaryPath);
|
|
289
|
+
if (primaryResult.ok) return primaryResult;
|
|
290
|
+
|
|
291
|
+
for (const dir of skillDirCandidates(skillName, projectRoot, mindRoot)) {
|
|
292
|
+
if (dir === primaryDir) continue;
|
|
293
|
+
const result = readAbsoluteFile(path.join(dir, relPath));
|
|
294
|
+
if (result.ok) return result;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
return primaryResult;
|
|
298
|
+
}
|
|
299
|
+
|
|
268
300
|
/**
|
|
269
301
|
* In-memory cache for absolute file reads (SKILL.md, etc).
|
|
270
302
|
* Keyed by absPath. Re-reads only when file mtime changes.
|
|
@@ -504,10 +536,10 @@ export async function POST(req: NextRequest) {
|
|
|
504
536
|
const skillInfo = resolveSkillFile(skillDirName, projectRoot, mindRoot);
|
|
505
537
|
const skill = skillInfo.result;
|
|
506
538
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
539
|
+
const skillWrite = resolveSkillReference(
|
|
540
|
+
path.join('references', 'write-supplement.md'),
|
|
541
|
+
skillInfo, skillDirName, projectRoot, mindRoot,
|
|
542
|
+
);
|
|
511
543
|
|
|
512
544
|
console.log(
|
|
513
545
|
`[ask] SKILL skill=${skill.ok} (${skillInfo.path}), write-supplement=${skillWrite.ok}`
|
package/bin/commands/dev.js
CHANGED
|
@@ -36,6 +36,16 @@ export const run = async (args, flags) => {
|
|
|
36
36
|
if (!process.env.MINDOS_MCP_PORT) process.env.MINDOS_MCP_PORT = '8781';
|
|
37
37
|
process.env.MINDOS_CLI_PATH = resolve(ROOT, 'bin', 'cli.js');
|
|
38
38
|
process.env.MINDOS_NODE_BIN = process.execPath;
|
|
39
|
+
|
|
40
|
+
// Inject ~/.mindos/bin into PATH so dev server child processes can find `mindos` CLI
|
|
41
|
+
const { homedir } = await import('node:os');
|
|
42
|
+
const mindosBinDir = resolve(homedir(), '.mindos', 'bin');
|
|
43
|
+
const pathSep = process.platform === 'win32' ? ';' : ':';
|
|
44
|
+
const pathDirs = (process.env.PATH || '').split(pathSep);
|
|
45
|
+
if (!pathDirs.includes(mindosBinDir)) {
|
|
46
|
+
process.env.PATH = `${mindosBinDir}${pathSep}${process.env.PATH || ''}`;
|
|
47
|
+
}
|
|
48
|
+
|
|
39
49
|
const webPort = process.env.MINDOS_WEB_PORT;
|
|
40
50
|
const mcpPort = process.env.MINDOS_MCP_PORT;
|
|
41
51
|
await assertPortFree(Number(webPort), 'web');
|
package/bin/commands/doctor.js
CHANGED
|
@@ -105,16 +105,28 @@ export const run = async (_args, flags) => {
|
|
|
105
105
|
hasError = true;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
// 4c. ~/.mindos/bin in PATH (
|
|
108
|
+
// 4c. ~/.mindos/bin in PATH (CLI shim)
|
|
109
109
|
const mindosBin = resolve(homedir(), '.mindos', 'bin');
|
|
110
110
|
const pathDirs = (process.env.PATH || '').split(':');
|
|
111
111
|
if (pathDirs.some(d => d === mindosBin || d === '$HOME/.mindos/bin' || d === '~/.mindos/bin')) {
|
|
112
112
|
ok(`~/.mindos/bin is in PATH`);
|
|
113
|
-
} else
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
} else {
|
|
114
|
+
try {
|
|
115
|
+
const { ensureCliShim, isShimInPath } = await import('../lib/cli-shim.js');
|
|
116
|
+
ensureCliShim();
|
|
117
|
+
if (isShimInPath()) {
|
|
118
|
+
ok(`~/.mindos/bin is in PATH`);
|
|
119
|
+
} else {
|
|
120
|
+
warn(`~/.mindos/bin PATH injected into shell rc files — open a new terminal to activate`);
|
|
121
|
+
}
|
|
122
|
+
} catch {
|
|
123
|
+
if (existsSync(resolve(mindosBin, 'mindos'))) {
|
|
124
|
+
warn(`~/.mindos/bin/mindos exists but is NOT in PATH — AI Agents cannot find the mindos command`);
|
|
125
|
+
if (!jsonMode) {
|
|
126
|
+
console.log(dim(' Fix: add to your shell config:'));
|
|
127
|
+
console.log(dim(' export PATH="$HOME/.mindos/bin:$PATH"'));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
118
130
|
}
|
|
119
131
|
}
|
|
120
132
|
|
package/bin/commands/start.js
CHANGED
|
@@ -63,14 +63,23 @@ export const run = async (args, flags) => {
|
|
|
63
63
|
const isVerbose = Boolean(flags.verbose);
|
|
64
64
|
const extra = args.join(' ');
|
|
65
65
|
|
|
66
|
-
// Ensure `mindos` CLI
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
// Ensure `mindos` CLI shim + PATH injection (silent, best-effort)
|
|
67
|
+
const isDesktop = !!(process.env.ELECTRON_RUN_AS_NODE || process.env.MINDOS_DESKTOP);
|
|
68
|
+
if (!isDesktop) {
|
|
69
|
+
try {
|
|
70
|
+
const { ensureCliShim } = await import('../lib/cli-shim.js');
|
|
71
|
+
ensureCliShim();
|
|
72
|
+
} catch { /* best effort */ }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Inject ~/.mindos/bin into current process PATH so child processes
|
|
76
|
+
// (Next.js server, MCP) can find the `mindos` command.
|
|
77
|
+
const { homedir } = await import('node:os');
|
|
78
|
+
const mindosBinDir = resolve(homedir(), '.mindos', 'bin');
|
|
79
|
+
const pathSep = process.platform === 'win32' ? ';' : ':';
|
|
80
|
+
const pathDirs = (process.env.PATH || '').split(pathSep);
|
|
81
|
+
if (!pathDirs.includes(mindosBinDir)) {
|
|
82
|
+
process.env.PATH = `${mindosBinDir}${pathSep}${process.env.PATH || ''}`;
|
|
74
83
|
}
|
|
75
84
|
|
|
76
85
|
// Check for incomplete setup
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI shim creation + PATH injection for non-Desktop installs.
|
|
3
|
+
* Mirrors desktop/src/install-cli-shim.ts but uses only Node.js APIs (no Electron).
|
|
4
|
+
*
|
|
5
|
+
* Creates ~/.mindos/bin/mindos and injects PATH into shell rc files
|
|
6
|
+
* so AI Agents (Claude Code, Cursor, etc.) can find the `mindos` command.
|
|
7
|
+
*/
|
|
8
|
+
import {
|
|
9
|
+
existsSync,
|
|
10
|
+
readFileSync,
|
|
11
|
+
writeFileSync,
|
|
12
|
+
appendFileSync,
|
|
13
|
+
mkdirSync,
|
|
14
|
+
chmodSync,
|
|
15
|
+
} from 'node:fs';
|
|
16
|
+
import { resolve } from 'node:path';
|
|
17
|
+
import { homedir, platform } from 'node:os';
|
|
18
|
+
import { CLI_PATH } from './constants.js';
|
|
19
|
+
|
|
20
|
+
const SHELL_MARKER = '# MindOS CLI';
|
|
21
|
+
const home = homedir();
|
|
22
|
+
|
|
23
|
+
function shimDir() {
|
|
24
|
+
return resolve(home, '.mindos', 'bin');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function shimPath() {
|
|
28
|
+
return resolve(shimDir(), platform() === 'win32' ? 'mindos.cmd' : 'mindos');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function shellSingleQuote(s) {
|
|
32
|
+
return `'${s.replace(/'/g, `'\"'\"'`)}'`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function writeUnixShim(cliJs) {
|
|
36
|
+
const cliLit = shellSingleQuote(cliJs);
|
|
37
|
+
const script = `#!/bin/sh
|
|
38
|
+
# Generated by MindOS CLI — overwritten on each mindos start.
|
|
39
|
+
|
|
40
|
+
cd "$HOME" 2>/dev/null || true
|
|
41
|
+
|
|
42
|
+
CLI=${cliLit}
|
|
43
|
+
|
|
44
|
+
if [ ! -f "$CLI" ]; then
|
|
45
|
+
NPM_ROOT=$(npm root -g 2>/dev/null)
|
|
46
|
+
NPM_CLI="\${NPM_ROOT}/@geminilight/mindos/bin/cli.js"
|
|
47
|
+
if [ -f "$NPM_CLI" ]; then
|
|
48
|
+
CLI="$NPM_CLI"
|
|
49
|
+
else
|
|
50
|
+
echo "mindos: CLI not found. Reinstall: npm install -g @geminilight/mindos" >&2
|
|
51
|
+
exit 127
|
|
52
|
+
fi
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
if [ -x "$HOME/.mindos/node/bin/node" ]; then
|
|
56
|
+
exec "$HOME/.mindos/node/bin/node" "$CLI" "$@"
|
|
57
|
+
fi
|
|
58
|
+
if command -v node >/dev/null 2>&1; then
|
|
59
|
+
exec node "$CLI" "$@"
|
|
60
|
+
fi
|
|
61
|
+
echo "mindos: Node.js not found. Install Node 18+ or run MindOS Desktop (it installs Node under ~/.mindos/node)." >&2
|
|
62
|
+
exit 127
|
|
63
|
+
`;
|
|
64
|
+
mkdirSync(shimDir(), { recursive: true });
|
|
65
|
+
writeFileSync(shimPath(), script, 'utf-8');
|
|
66
|
+
try { chmodSync(shimPath(), 0o755); } catch { /* ignore */ }
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Append ~/.mindos/bin to PATH in relevant shell rc files (idempotent).
|
|
71
|
+
* AI Agents run commands via non-interactive shells:
|
|
72
|
+
* - Non-interactive zsh reads ~/.zshenv (NOT ~/.zshrc)
|
|
73
|
+
* - Non-interactive bash reads ~/.bashrc (some systems) or nothing
|
|
74
|
+
* - Fish reads ~/.config/fish/conf.d/*.fish always
|
|
75
|
+
*/
|
|
76
|
+
function appendPathToShellRc() {
|
|
77
|
+
if (platform() === 'win32') return false;
|
|
78
|
+
|
|
79
|
+
const block = `\n${SHELL_MARKER}\nexport PATH="$HOME/.mindos/bin:$PATH"\n`;
|
|
80
|
+
|
|
81
|
+
const targets =
|
|
82
|
+
platform() === 'darwin'
|
|
83
|
+
? [
|
|
84
|
+
{ name: '.zshenv', mustCreate: true },
|
|
85
|
+
{ name: '.zshrc', mustCreate: false },
|
|
86
|
+
{ name: '.bashrc', mustCreate: true },
|
|
87
|
+
{ name: '.bash_profile', mustCreate: false },
|
|
88
|
+
]
|
|
89
|
+
: [
|
|
90
|
+
{ name: '.bashrc', mustCreate: true },
|
|
91
|
+
{ name: '.zshenv', mustCreate: true },
|
|
92
|
+
{ name: '.zshrc', mustCreate: false },
|
|
93
|
+
{ name: '.profile', mustCreate: false },
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
let appended = false;
|
|
97
|
+
|
|
98
|
+
for (const { name, mustCreate } of targets) {
|
|
99
|
+
const full = resolve(home, name);
|
|
100
|
+
const fileExists = existsSync(full);
|
|
101
|
+
|
|
102
|
+
if (!fileExists && !mustCreate) continue;
|
|
103
|
+
|
|
104
|
+
if (fileExists) {
|
|
105
|
+
try {
|
|
106
|
+
const content = readFileSync(full, 'utf-8');
|
|
107
|
+
if (content.includes(SHELL_MARKER) || content.includes('# MindOS Desktop')
|
|
108
|
+
|| content.includes('.mindos/bin')) continue;
|
|
109
|
+
} catch { continue; }
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
try {
|
|
113
|
+
appendFileSync(full, block, 'utf-8');
|
|
114
|
+
appended = true;
|
|
115
|
+
} catch { /* best effort */ }
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Fish shell support
|
|
119
|
+
try {
|
|
120
|
+
const fishConfD = resolve(home, '.config', 'fish', 'conf.d');
|
|
121
|
+
if (existsSync(fishConfD)) {
|
|
122
|
+
const fishFile = resolve(fishConfD, 'mindos.fish');
|
|
123
|
+
const fishBlock = `${SHELL_MARKER}\nif not contains "$HOME/.mindos/bin" $PATH\n set -gx PATH "$HOME/.mindos/bin" $PATH\nend\n`;
|
|
124
|
+
let needsWrite = !existsSync(fishFile);
|
|
125
|
+
if (!needsWrite) {
|
|
126
|
+
const content = readFileSync(fishFile, 'utf-8');
|
|
127
|
+
needsWrite = !content.includes(SHELL_MARKER)
|
|
128
|
+
&& !content.includes('# MindOS Desktop')
|
|
129
|
+
&& !content.includes('.mindos/bin');
|
|
130
|
+
}
|
|
131
|
+
if (needsWrite) {
|
|
132
|
+
writeFileSync(fishFile, fishBlock, 'utf-8');
|
|
133
|
+
appended = true;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
} catch { /* best effort */ }
|
|
137
|
+
|
|
138
|
+
return appended;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Ensure CLI shim exists and PATH is injected. Safe to call on every `mindos start`.
|
|
143
|
+
* Returns true if any changes were made.
|
|
144
|
+
*/
|
|
145
|
+
export function ensureCliShim() {
|
|
146
|
+
try {
|
|
147
|
+
writeUnixShim(CLI_PATH);
|
|
148
|
+
} catch (e) {
|
|
149
|
+
console.warn('[MindOS] Failed to write CLI shim:', e instanceof Error ? e.message : e);
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
try {
|
|
154
|
+
return appendPathToShellRc();
|
|
155
|
+
} catch (e) {
|
|
156
|
+
console.warn('[MindOS] Failed to append PATH to shell rc:', e instanceof Error ? e.message : e);
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** Check if ~/.mindos/bin is in the current PATH. */
|
|
162
|
+
export function isShimInPath() {
|
|
163
|
+
const dirs = (process.env.PATH || '').split(platform() === 'win32' ? ';' : ':');
|
|
164
|
+
const binDir = shimDir();
|
|
165
|
+
return dirs.some(d => d === binDir || d === '$HOME/.mindos/bin' || d === '~/.mindos/bin');
|
|
166
|
+
}
|
package/package.json
CHANGED
|
@@ -40,7 +40,10 @@ cp -r app/.next/static "$WORK/app/.next/static"
|
|
|
40
40
|
mkdir -p "$WORK/app"
|
|
41
41
|
cp -r app/public "$WORK/app/public"
|
|
42
42
|
# Copy skill definitions (not included in standalone output, needed at runtime)
|
|
43
|
-
[ -d app/data/skills ]
|
|
43
|
+
if [ -d app/data/skills ]; then
|
|
44
|
+
mkdir -p "$WORK/app/data"
|
|
45
|
+
cp -r app/data/skills "$WORK/app/data/skills"
|
|
46
|
+
fi
|
|
44
47
|
|
|
45
48
|
# ── MCP server ──
|
|
46
49
|
echo " Copying MCP..."
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{3237:(e,t,s)=>{"use strict";s.d(t,{D:()=>n});var r=s(9339);let n=(0,r.createServerReference)("004277b0ddf905eaed45f61af2e364ff335151f197",r.callServer,void 0,r.findSourceMapURL,"scanExampleFilesAction")},4235:(e,t,s)=>{"use strict";s.d(t,{B1:()=>o,X8:()=>d,dV:()=>l,oR:()=>m});let r=[],n=[],a=0;function i(){for(let e of n)e()}function o(e){return n=[...n,e],()=>{n=n.filter(t=>t!==e)}}function l(){return r}function d(e){r=r.filter(t=>t.id!==e),i()}function c(e){let t=`toast-${++a}`,s={id:t,message:e.message,type:e.type??"info",duration:e.duration??2e3,action:e.action};r=[...r,s].slice(-3),i(),s.duration>0&&setTimeout(()=>d(t),s.duration)}function m(e,t){c({message:e,...t})}m.success=(e,t)=>c({message:e,type:"success",duration:t}),m.undo=(e,t,s)=>c({message:e,type:"info",duration:s?.duration??5e3,action:{label:s?.label??"Undo",onClick:t}}),m.error=(e,t)=>c({message:e,type:"error",duration:t}),m.copy=(e="Copied")=>c({message:e,type:"success",duration:1500})},6496:(e,t,s)=>{"use strict";s.d(t,{A:()=>h});var r=s(95155),n=s(12115),a=s(98500),i=s.n(a),o=s(93219),l=s(21628),d=s(12651),c=s(13545),m=s(66088),u=s(91337),x=s(91053),p=s(42833);function h(){let{t:e,locale:t}=(0,x.Y)(),[s,a]=(0,n.useState)([]),[h,f]=(0,n.useState)(!0),[g,b]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let e=!1,t=()=>{fetch("/api/agent-activity?limit=20").then(e=>e.json()).then(t=>{e||a(t.events??[])}).catch(()=>{}).finally(()=>{e||f(!1)})};t();let s=()=>{"visible"===document.visibilityState&&t()};return document.addEventListener("visibilitychange",s),()=>{e=!0,document.removeEventListener("visibilitychange",s)}},[]);let v=(0,n.useMemo)(()=>{let e=s.filter(e=>{let t=(0,p.wT)(e.tool);return"write"===t||"create"===t||"delete"===t});return e.length>=3?e:s},[s]),j=g?v:v.slice(0,5),N=v.length-5;if(h)return(0,r.jsxs)("section",{className:"animate-pulse","aria-label":"Recent Activity",children:[(0,r.jsx)("div",{className:"h-4 w-36 bg-muted rounded mb-3"}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"h-10 bg-muted/50 rounded-lg"}),(0,r.jsx)("div",{className:"h-10 bg-muted/50 rounded-lg"})]})]});if(0===s.length)return null;let y=e.agentsContent?.overview;return(0,r.jsxs)("section",{"aria-label":"Recent Activity",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,r.jsx)("span",{className:"text-[var(--amber)]",children:(0,r.jsx)(o.A,{size:13})}),(0,r.jsx)("h2",{className:"text-sm font-semibold font-display text-foreground",children:y?.recentActivity??"Recent Activity"}),(0,r.jsx)("div",{className:"ml-auto",children:(0,r.jsxs)(i(),{href:"/agents?tab=activity",className:"flex items-center gap-1.5 text-xs font-medium text-[var(--amber)] hover:opacity-80 transition-colors font-display",children:[(0,r.jsx)(l.A,{size:12}),(0,r.jsx)("span",{children:y?.viewAll??"View all"})]})})]}),(0,r.jsx)("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:j.map((e,s)=>{let n=(0,p.wT)(e.tool),a=(0,p.oK)(e.params);return(0,r.jsxs)("div",{className:`flex items-center gap-3 px-3.5 py-2.5 ${s>0?"border-t border-border/30":""} hover:bg-muted/30 transition-colors`,children:[(0,r.jsx)(p.g,{kind:n,locale:t,size:"sm"}),a?(0,r.jsx)(i(),{href:`/view/${(0,u.O0)(a)}`,className:"text-xs text-[var(--amber)]/80 hover:text-[var(--amber)] truncate min-w-0 flex-1 font-display transition-colors",title:a,children:a}):(0,r.jsx)("span",{className:"flex-1"}),e.agentName&&(0,r.jsx)("span",{className:"text-[0.6rem] font-medium text-muted-foreground/70 bg-muted/60 px-1.5 py-0.5 rounded-full shrink-0 font-display",title:e.agentName,children:e.agentName.length>20?e.agentName.slice(0,20)+"...":e.agentName}),"ok"===e.result?(0,r.jsx)(d.A,{size:11,className:"shrink-0 text-[var(--success)]/60"}):(0,r.jsx)(c.A,{size:11,className:"shrink-0 text-[var(--error)]/60"}),(0,r.jsx)("span",{className:"text-2xs text-muted-foreground/40 tabular-nums shrink-0 font-display",title:e.ts,children:(0,p.MZ)(e.ts)})]},e.id??s)})}),N>0&&(0,r.jsxs)("button",{onClick:()=>b(e=>!e),className:"flex items-center gap-1.5 mt-2 text-xs font-medium text-[var(--amber)] hover:opacity-80 transition-opacity cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded",children:[(0,r.jsx)(m.A,{size:12,className:`transition-transform duration-200 ${g?"rotate-180":""}`}),(0,r.jsx)("span",{children:g?y?.showLess??"Show less":`${N} more`})]})]})}},7701:(e,t,s)=>{"use strict";s.d(t,{E:()=>n});var r=s(9339);let n=(0,r.createServerReference)("0081d0e6107ae00e6ac205a4fabb54b6f48fbfa8e7",r.callServer,void 0,r.findSourceMapURL,"cleanupExamplesAction")},7834:(e,t,s)=>{"use strict";async function r(e){if(navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let s=document.execCommand("copy");return document.body.removeChild(t),s}catch{return!1}}s.d(t,{l:()=>r})},10377:(e,t,s)=>{"use strict";s.d(t,{Z:()=>h});var r=s(12115);let n="mindos-pinned-files",a="mindos:pins-changed";function i(){try{let e=localStorage.getItem(n);return e?JSON.parse(e):[]}catch{return[]}}function o(){return c}let l=[];function d(){return l}let c=[],m=!1;function u(){m||(c=i(),m=!0)}function x(e){u();let t=t=>{t.key===n&&(c=i(),e())},s=()=>{c=i(),e()};return window.addEventListener("storage",t),window.addEventListener(a,s),()=>{window.removeEventListener("storage",t),window.removeEventListener(a,s)}}function p(e){c=e;try{localStorage.setItem(n,JSON.stringify(e))}catch{}window.dispatchEvent(new Event(a))}function h(){u();let e=(0,r.useSyncExternalStore)(x,o,d),t=(0,r.useCallback)(t=>e.includes(t),[e]),s=(0,r.useCallback)(e=>{let t=i(),s=t.indexOf(e);s>=0?t.splice(s,1):t.unshift(e),p(t)},[]);return{pinnedFiles:e,isPinned:t,togglePin:s,reorderPins:(0,r.useCallback)(e=>{p(e)},[]),removePin:(0,r.useCallback)(e=>{p(i().filter(t=>t!==e))},[])}}},14153:(e,t,s)=>{Promise.resolve().then(s.bind(s,46515))},22356:(e,t,s)=>{"use strict";s.d(t,{h:()=>r,n:()=>n});class r extends Error{constructor(e,t,s){super(e),this.name="ApiError",this.status=t,this.code=s}}async function n(e,t={}){let s,a,i,{timeout:o=3e4,signal:l,...d}=t;if((o>0||l)&&(s=new AbortController),o>0&&s&&(a=setTimeout(()=>{s.abort(Error(`Request timed out after ${Math.round(o/1e3)}s`))},o)),l&&s)if(l.aborted)s.abort();else{let e=()=>s?.abort();l.addEventListener("abort",e,{once:!0}),i=()=>{l.removeEventListener("abort",e)}}let c=s?.signal??l;try{let t=await fetch(e,{...d,signal:c});if(!t.ok){let e,s=`Request failed (${t.status})`;try{let r=await t.json();r?.error?.code&&r?.error?.message?(s=r.error.message,e=r.error.code):r?.error&&(s="string"==typeof r.error?r.error:r.error.message??s)}catch{}throw new r(s,t.status,e)}return await t.json()}finally{a&&clearTimeout(a),i&&i()}}},27318:(e,t,s)=>{"use strict";s.d(t,{KT:()=>c,NH:()=>d});var r=s(12115);let n={open:!1,initialMessage:"",source:"user",acpAgent:null},a=new Set;function i(){a.forEach(e=>e())}function o(e){return a.add(e),()=>{a.delete(e)}}function l(){return n}function d(e="",t="user",s=null){n={open:!0,initialMessage:e,source:t,acpAgent:s},i()}function c(){let e=(0,r.useSyncExternalStore)(o,l,l);return{open:e.open,initialMessage:e.initialMessage,source:e.source,acpAgent:e.acpAgent,openWith:(0,r.useCallback)((e,t="user",s=null)=>d(e,t,s),[]),close:(0,r.useCallback)(()=>void(n={open:!1,initialMessage:"",source:"user",acpAgent:null},i()),[])}}},29494:(e,t,s)=>{"use strict";s.d(t,{Q:()=>n});var r=s(4235);async function n(e,t){let s=[],n=0;for(let t of e){if(t.size>0xa00000){n++;continue}try{if(t.name.toLowerCase().endsWith(".pdf")){let e=await t.arrayBuffer();s.push({name:t.name,content:function(e){let t=new Uint8Array(e),s=[];for(let e=0;e<t.length;e+=8192)s.push(String.fromCharCode(...t.subarray(e,e+8192)));return btoa(s.join(""))}(e),encoding:"base64"})}else{let e=await t.text();s.push({name:t.name,content:e})}}catch{}}if(0===s.length)return void(n>0?r.oR.error(t.inbox.tooLarge(n),4e3):e.length>0&&r.oR.error(t.inbox.saveFailed,4e3));try{var a;let e=await fetch("/api/inbox",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:s})});if(!e.ok){let s=await e.json().catch(()=>({}));console.error("[QuickDrop] Save failed:",s.error),r.oR.error(t.inbox.saveFailed,4e3);return}let i=await e.json(),o=i.saved?.length??0,l=i.skipped?.length??0;a=n,o>0&&a>0&&0===l?r.oR.success(t.inbox.savedWithOversized(o,a),4e3):o>0&&l+a>0?r.oR.success(t.inbox.savedWithSkipped(o,l+a),4e3):o>0?r.oR.success(t.inbox.savedToast(o),3e3):(a>0&&r.oR.error(t.inbox.tooLarge(a),4e3),l>0&&r.oR.error(t.inbox.savedWithSkipped(0,l),4e3),0===a&&0===l&&r.oR.error(t.inbox.saveFailed,4e3)),window.dispatchEvent(new Event("mindos:files-changed")),window.dispatchEvent(new Event("mindos:inbox-updated"))}catch(e){console.error("[QuickDrop] Network error:",e),r.oR.error(t.inbox.saveFailed,4e3)}}},42833:(e,t,s)=>{"use strict";s.d(t,{$2:()=>p,CF:()=>m,MZ:()=>h,g:()=>g,hf:()=>x,oK:()=>f,wT:()=>c,zR:()=>u});var r=s(95155),n=s(84980),a=s(3926),i=s(93631),o=s(68459),l=s(61878),d=s(10762);function c(e){return/search/.test(e)?"search":/read|list|get/.test(e)?"read":/create/.test(e)?"create":/delete/.test(e)?"delete":/write|update|insert|append/.test(e)?"write":"other"}let m={en:{read:"Read",write:"Write",create:"Create",delete:"Delete",search:"Search",other:"Other"},zh:{read:"读取",write:"写入",create:"创建",delete:"删除",search:"搜索",other:"其他"}},u={read:{bg:"rgba(138,180,216,0.10)",text:"#8ab4d8",border:"rgba(138,180,216,0.25)"},write:{bg:"rgba(200,135,58,0.10)",text:"var(--amber)",border:"rgba(200,135,58,0.25)"},create:{bg:"rgba(122,173,128,0.10)",text:"var(--success)",border:"rgba(122,173,128,0.25)"},delete:{bg:"rgba(200,80,80,0.10)",text:"var(--error)",border:"rgba(200,80,80,0.25)"},search:{bg:"rgba(200,160,216,0.10)",text:"#c8a0d8",border:"rgba(200,160,216,0.25)"},other:{bg:"var(--muted)",text:"var(--muted-foreground)",border:"var(--border)"}};function x({kind:e,size:t=13}){return"read"===e?(0,r.jsx)(n.A,{size:t}):"write"===e?(0,r.jsx)(a.A,{size:t}):"create"===e?(0,r.jsx)(i.A,{size:t}):"delete"===e?(0,r.jsx)(o.A,{size:t}):"search"===e?(0,r.jsx)(l.A,{size:t}):(0,r.jsx)(d.A,{size:t})}function p(e){try{return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function h(e){let t=Date.now()-new Date(e).getTime(),s=Math.floor(t/6e4),r=Math.floor(t/36e5),n=Math.floor(t/864e5);return s<1?"<1m":s<60?`${s}m`:r<24?`${r}h`:`${n}d`}function f(e){return"string"==typeof e.path?e.path:null}function g({kind:e,locale:t,size:s="md"}){let n=u[e],a=m[t?.startsWith("zh")?"zh":"en"][e];return(0,r.jsxs)("span",{className:"font-display",style:{display:"inline-flex",alignItems:"center",gap:3,padding:"sm"===s?"1px 6px":"2px 8px",borderRadius:999,fontSize:"sm"===s?"0.6rem":"0.68rem",fontWeight:600,background:n.bg,color:n.text,border:`1px solid ${n.border}`,flexShrink:0,whiteSpace:"nowrap"},children:[(0,r.jsx)(x,{kind:e,size:"sm"===s?9:10}),a]})}},46515:(e,t,s)=>{"use strict";s.d(t,{default:()=>eo});var r=s(95155),n=s(98500),a=s.n(n),i=s(66088),o=s(33078),l=s(48368),d=s(86901),c=s(61878),m=s(93631),u=s(21628),x=s(90718),p=s(38798),h=s(84980),f=s(50538),g=s(94290),b=s(33210),v=s(51914),j=s(94514),N=s(6296),y=s(68459),w=s(12115),k=s(91053),A=s(91337),z=s(10377),C=s(73321),E=s(92451),S=s(97810),T=s(13545),L=s(31025);let M=[{id:"en",icon:(0,r.jsx)(E.A,{size:20}),dirs:["Profile/","Connections/","Notes/","Workflows/","Resources/","Projects/"]},{id:"zh",icon:(0,r.jsx)(S.A,{size:20}),dirs:["画像/","关系/","笔记/","流程/","资源/","项目/"]},{id:"empty",icon:(0,r.jsx)(l.A,{size:20}),dirs:["README.md","CONFIG.json","INSTRUCTION.md"]}];function $(){let{t:e}=(0,k.Y)(),t=(0,C.useRouter)(),[s,n]=(0,w.useState)(null),[a,i]=(0,w.useState)(null),o=e.onboarding;async function l(e){n(e),i(null);try{let s=await fetch("/api/init",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({template:e})});if(!s.ok){let e=await s.json().catch(()=>({}));throw Error(e.error||`HTTP ${s.status}`)}t.refresh()}catch(e){console.error("[Onboarding] init failed:",e),i(e instanceof Error?e.message:"Unknown error"),n(null)}}return(0,r.jsxs)("div",{className:"content-width px-4 md:px-6 py-12 md:py-20",children:[(0,r.jsxs)("div",{className:"text-center mb-10",children:[(0,r.jsxs)("div",{className:"inline-flex items-center gap-2 mb-4",children:[(0,r.jsx)(d.A,{size:18,className:"text-[var(--amber)]"}),(0,r.jsx)("h1",{className:"text-2xl font-semibold tracking-tight font-display text-foreground",children:"MindOS"})]}),(0,r.jsx)("p",{className:"text-sm leading-relaxed max-w-md mx-auto text-muted-foreground",children:o.subtitle})]}),a&&(0,r.jsxs)("div",{role:"alert",className:"max-w-2xl mx-auto mb-6 flex items-center gap-2.5 px-4 py-3 rounded-lg border border-destructive/30 bg-destructive/5 text-sm text-destructive",children:[(0,r.jsx)(T.A,{size:16,className:"shrink-0"}),(0,r.jsx)("span",{className:"flex-1",children:o.initError??"Initialization failed. Please try again."}),(0,r.jsx)("button",{onClick:()=>i(null),className:"text-xs underline shrink-0 hover:opacity-80",children:o.dismiss??"Dismiss"})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4 max-w-2xl mx-auto mb-10",children:M.map(t=>{let n=s===t.id,a=null!==s;return(0,r.jsxs)("button",{disabled:a,title:a?e.hints.templateInitializing:void 0,onClick:()=>l(t.id),className:"group relative flex flex-col items-start gap-3 p-5 rounded-xl border border-border bg-card text-left transition-all duration-150 hover:border-[var(--amber)]/50 hover:bg-[var(--amber)]/5 disabled:opacity-60 disabled:cursor-not-allowed",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2.5 w-full",children:[(0,r.jsx)("span",{className:"text-[var(--amber)]",children:t.icon}),(0,r.jsx)("span",{className:"text-sm font-semibold text-foreground",children:o.templates[t.id].title}),n&&(0,r.jsx)(N.A,{size:14,className:"animate-spin ml-auto text-[var(--amber)]"})]}),(0,r.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:o.templates[t.id].desc}),(0,r.jsx)("div",{className:"w-full rounded-lg px-3 py-2 text-xs leading-relaxed font-display bg-muted text-muted-foreground opacity-80",children:t.dirs.map(e=>(0,r.jsx)("div",{children:e},e))})]},t.id)})}),(0,r.jsx)("p",{className:"text-center text-xs leading-relaxed max-w-sm mx-auto font-display text-muted-foreground opacity-60",children:o.importHint}),(0,r.jsx)("p",{className:"text-center mt-2",children:(0,r.jsx)("button",{type:"button",onClick:()=>window.dispatchEvent(new CustomEvent("mindos:open-import")),className:"text-xs text-[var(--amber-text)] hover:underline transition-colors",children:e.fileImport.onboardingHint})}),(0,r.jsxs)("div",{className:"max-w-md mx-auto mt-6 flex items-center gap-3 px-4 py-3 rounded-lg border border-border bg-card text-left",children:[(0,r.jsx)(L.A,{size:16,className:"text-muted-foreground shrink-0"}),(0,r.jsx)("div",{className:"min-w-0",children:(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:[o.syncHint??"Want cross-device sync? Run"," ",(0,r.jsx)("code",{className:"font-mono px-1 py-0.5 rounded select-all bg-muted text-[11px]",children:"mindos sync init"})," ",o.syncHintSuffix??"in the terminal after setup."]})})]})]})}var R=s(21362),D=s(21975),O=s(92564),W=s(22164),P=s(67635),I=s(7834),H=s(4235),F=s(27318),K=s(76449);function U(){let{t:e}=(0,k.Y)(),t=e.guide,[s,n]=(0,w.useState)(null),[i,o]=(0,w.useState)(null),[l,c]=(0,w.useState)(!1),[m,u]=(0,w.useState)(!1),x=(0,w.useCallback)(()=>{fetch("/api/setup").then(e=>e.json()).then(e=>{let t=e.guideState;t?.active&&!t.dismissed?n(t):n(null)}).catch(e=>{console.warn("[GuideCard] Fetch guide state failed:",e)})},[]);(0,w.useEffect)(()=>{x();let e=()=>{c(!0)};window.addEventListener("mindos:first-visit",e);let t=()=>x();return window.addEventListener("focus",t),window.addEventListener("guide-state-updated",t),()=>{window.removeEventListener("mindos:first-visit",e),window.removeEventListener("focus",t),window.removeEventListener("guide-state-updated",t)}},[x]);let p=(0,w.useCallback)(e=>{n(t=>t?{...t,...e}:t),fetch("/api/setup",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({guideState:e})}).catch(e=>{console.warn("[GuideCard] PATCH guide state failed:",e)})},[]),h=(0,w.useCallback)(()=>{p({dismissed:!0}),n(null)},[p]),f=(0,w.useCallback)(()=>{window.dispatchEvent(new CustomEvent("mindos:open-import"))},[]),g=(0,w.useCallback)(()=>{p({step1Done:!0}),o(null)},[p]);(0,w.useEffect)(()=>{if(!s||s.step1Done)return;let e=()=>p({step1Done:!0});return window.addEventListener("mindos:files-changed",e),()=>window.removeEventListener("mindos:files-changed",e)},[s,s?.step1Done,p]);let v=(0,w.useCallback)(()=>{let e=s?.template==="empty"?t.ai.promptEmpty:t.ai.prompt;(0,F.NH)(e,"guide")},[s,t]),j=(0,w.useCallback)(async()=>{await (0,I.l)(t.agent.copyPrompt)&&H.oR.copy()},[t]),N=(0,w.useCallback)(()=>{u(!0),o(null),p({nextStepIndex:0})},[p]),y=(0,w.useCallback)(()=>{if(!s)return;let e=s.nextStepIndex,r=t.done.steps;e<r.length&&((0,F.NH)(r[e].prompt,"guide-next"),p({nextStepIndex:e+1}))},[s,t,p]);(0,w.useEffect)(()=>{l&&s&&!s.step1Done&&o("import")},[l,s]);let A=(0,w.useRef)({s1:!1,s2:!1});(0,w.useEffect)(()=>{if(!s)return;let e=A.current;s.step1Done&&!e.s1&&(o("ai"),e.s1=!0),s.askedAI&&!e.s2&&(o("agent"),e.s2=!0)},[s?.step1Done,s?.askedAI,s]);let z=s?.step1Done??!1,C=s?.askedAI??!1,E=s?.nextStepIndex??0,S=z&&C&&m,T=S&&E>=t.done.steps.length,L=(0,w.useRef)(null);if((0,w.useEffect)(()=>(T&&(L.current=setTimeout(()=>h(),8e3)),()=>{L.current&&clearTimeout(L.current)}),[T,h]),!s||void 0!==s.walkthroughStep&&s.walkthroughStep>=0&&s.walkthroughStep<K.g.length&&!s.walkthroughDismissed)return null;let M=z&&C&&!m;if(S&&T)return(0,r.jsxs)("div",{className:"mb-6 rounded-xl border border-[var(--amber)] px-5 py-4 flex items-center gap-3 animate-in fade-in duration-300 bg-[var(--amber-subtle)]",children:[(0,r.jsx)(d.A,{size:16,className:"animate-spin-slow text-[var(--amber)]"}),(0,r.jsx)("span",{className:"text-sm font-semibold flex-1 text-foreground",children:t.done.titleFinal}),(0,r.jsx)(a(),{href:"/explore",className:"text-xs font-medium text-[var(--amber)] transition-colors hover:opacity-80",children:e.walkthrough.exploreCta}),(0,r.jsx)("button",{onClick:h,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground",children:(0,r.jsx)(b.A,{size:14})})]});if(S){let e=t.done.steps[E];return(0,r.jsxs)("div",{className:"mb-6 rounded-xl border border-[var(--amber)] px-5 py-4 animate-in fade-in duration-300 bg-[var(--amber-subtle)]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(d.A,{size:16,className:"text-[var(--amber)]"}),(0,r.jsx)("span",{className:"text-sm font-semibold flex-1 text-foreground",children:t.done.title}),(0,r.jsx)("button",{onClick:h,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground",children:(0,r.jsx)(b.A,{size:14})})]}),e&&(0,r.jsxs)("button",{onClick:y,className:"mt-3 flex items-center gap-2 text-sm text-[var(--amber)] transition-colors hover:opacity-80 cursor-pointer animate-in fade-in slide-in-from-left-2 duration-300",children:[(0,r.jsx)(R.A,{size:14}),(0,r.jsx)("span",{children:e.hint})]})]})}return(0,r.jsxs)("div",{className:"mb-6 rounded-xl border border-[var(--amber)] overflow-hidden bg-[var(--amber-subtle)]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 px-5 pt-4 pb-2",children:[(0,r.jsx)(d.A,{size:16,className:"text-[var(--amber)]"}),(0,r.jsx)("span",{className:"text-sm font-semibold flex-1 font-display text-foreground",children:t.title}),(0,r.jsx)("button",{onClick:h,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground",children:(0,r.jsx)(b.A,{size:14})})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2 px-5 py-3",children:[(0,r.jsx)(_,{icon:(0,r.jsx)(D.A,{size:16}),title:t.import.title,cta:t.import.cta,done:z,active:"import"===i,onClick:()=>z?null:o("import"===i?null:"import")}),(0,r.jsx)(_,{icon:(0,r.jsx)(O.A,{size:16}),title:t.ai.title,cta:t.ai.cta,done:C,active:"ai"===i,dimmed:!z,onClick:()=>{!C&&z&&o("ai"===i?null:"ai")}}),(0,r.jsx)(_,{icon:(0,r.jsx)(W.A,{size:16}),title:t.agent.title,cta:t.agent.cta,done:m,active:"agent"===i,dimmed:!z||!C,onClick:()=>{z&&C&&o("agent"===i?null:"agent")}})]}),"import"===i&&!z&&(0,r.jsx)("div",{className:"px-5 pb-4 animate-in slide-in-from-top-2 duration-200",children:(0,r.jsxs)("div",{className:"rounded-lg border border-border bg-card p-4",children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground mb-3",children:t.import.desc}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("button",{onClick:f,className:"text-xs font-medium px-4 py-2 rounded-lg transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:t.import.button}),(0,r.jsx)("button",{onClick:g,className:"text-xs px-3 py-1 rounded-lg text-muted-foreground transition-colors hover:bg-muted",children:t.skip})]})]})}),"ai"===i&&z&&!C&&(0,r.jsx)("div",{className:"px-5 pb-4 animate-in slide-in-from-top-2 duration-200",children:(0,r.jsxs)("div",{className:"rounded-lg border border-border bg-card p-4",children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground mb-3",children:t.ai.desc}),(0,r.jsxs)("button",{onClick:v,className:"text-xs font-medium px-4 py-2 rounded-lg transition-all hover:opacity-90",style:{background:"var(--amber)",color:"var(--amber-foreground)"},children:[t.ai.cta," →"]})]})}),"agent"===i&&M&&(0,r.jsx)("div",{className:"px-5 pb-4 animate-in slide-in-from-top-2 duration-200",children:(0,r.jsxs)("div",{className:"rounded-lg border border-border bg-card p-4",children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground mb-3",children:t.agent.desc}),(0,r.jsxs)("div",{className:"relative rounded-lg border border-border bg-muted/50 p-3 pr-16",children:[(0,r.jsx)("p",{className:"text-xs font-mono text-foreground leading-relaxed whitespace-pre-wrap",children:t.agent.copyPrompt}),(0,r.jsxs)("button",{onClick:j,className:"absolute top-2 right-2 flex items-center gap-1 text-2xs font-medium px-2.5 py-1.5 rounded-md border transition-all border-border bg-card text-muted-foreground hover:text-foreground hover:border-[var(--amber)]/30",children:[(0,r.jsx)(P.A,{size:11}),t.agent.copy]})]}),(0,r.jsx)("div",{className:"flex items-center justify-end mt-3 pt-3 border-t border-border",children:(0,r.jsx)("button",{onClick:N,className:"text-xs px-3 py-1 rounded-lg text-muted-foreground transition-colors hover:bg-muted",children:t.skip})})]})})]})}function _({icon:e,title:t,cta:s,done:n,active:a,dimmed:i,onClick:o}){return(0,r.jsxs)("button",{onClick:o,disabled:n||i,className:`
|
|
2
|
-
flex flex-col items-center gap-1.5 px-3 py-3 rounded-lg border text-center
|
|
3
|
-
transition-all duration-150
|
|
4
|
-
${n?"opacity-60":i?"opacity-40 cursor-default":"hover:border-[var(--amber)]/30 hover:bg-muted/50 cursor-pointer"}
|
|
5
|
-
${a?"border-[var(--amber)]/40 bg-muted/50":""}
|
|
6
|
-
${n||a?"border-[var(--amber)]":"border-border"}
|
|
7
|
-
`,children:[(0,r.jsx)("span",{className:`${n?"animate-in zoom-in-50 duration-300 text-success":"text-[var(--amber)]"}`,children:n?(0,r.jsx)(j.A,{size:16}):e}),(0,r.jsx)("span",{className:"text-xs font-medium text-foreground",children:t}),!n&&!i&&(0,r.jsxs)("span",{className:"text-2xs text-[var(--amber-text)]",children:[s," →"]})]})}var Y=s(49619),J=s(70617);let B="mindos:pulse-collapsed";function Q(){let e=(0,J.cd)(),{t}=(0,k.Y)(),s=t.pulse,[n,o]=(0,w.useState)(!1),[l,d]=(0,w.useState)(!1);(0,w.useEffect)(()=>{let e=localStorage.getItem(B);null!==e&&o("1"===e)},[]);let c=e?.agents??[],m=e?.status??null,x=(0,w.useMemo)(()=>[...c].sort((e,t)=>{let s=e=>e.installed?3:2*!!e.present,r=s(t)-s(e);if(0!==r)return r;let n=e.runtimeLastActivityAt?new Date(e.runtimeLastActivityAt).getTime():0;return(t.runtimeLastActivityAt?new Date(t.runtimeLastActivityAt).getTime():0)-n}),[c]).filter(e=>e.installed),p=m?.running??!1,h=()=>{let e=!n;o(e),localStorage.setItem(B,e?"1":"0")};if(!e||e.loading)return(0,r.jsxs)("section",{className:"mb-8 animate-pulse",children:[(0,r.jsx)("div",{className:"h-4 w-32 bg-muted rounded mb-3"}),(0,r.jsx)("div",{className:"h-16 bg-muted/50 rounded-xl"})]});if(c.every(e=>!e.present))return(0,r.jsxs)("section",{className:"mb-10",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,r.jsx)("span",{className:"text-[var(--amber)]",children:(0,r.jsx)(Y.A,{size:13})}),(0,r.jsx)("h2",{className:"text-sm font-semibold font-display text-foreground",children:s.title})]}),(0,r.jsx)("div",{className:"rounded-xl border border-dashed border-border/60 p-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)("div",{className:"w-9 h-9 rounded-lg bg-[var(--amber)]/8 flex items-center justify-center shrink-0",children:(0,r.jsx)(Y.A,{size:16,className:"text-[var(--amber)]"})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-foreground",children:s.connectTitle}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:s.connectDesc})]}),(0,r.jsxs)(a(),{href:"/agents",className:"shrink-0 inline-flex items-center gap-1.5 px-3.5 py-2 rounded-lg text-xs font-medium bg-[var(--amber)] text-[var(--amber-foreground)] transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[s.connectAction,(0,r.jsx)(u.A,{size:11})]})]})})]});let f=x.length;if(n)return(0,r.jsx)("section",{className:"mb-10",children:(0,r.jsxs)("button",{onClick:h,className:"w-full flex items-center gap-2 group cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded",children:[(0,r.jsx)("span",{className:"text-[var(--amber)]",children:(0,r.jsx)(Y.A,{size:13})}),(0,r.jsx)("h2",{className:"text-sm font-semibold font-display text-foreground",children:s.title}),f>0&&(0,r.jsx)("span",{className:"text-xs tabular-nums text-muted-foreground font-display",children:f}),(0,r.jsxs)("div",{className:"flex items-center gap-2 ml-1",children:[x.slice(0,3).map(e=>(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground/60",children:[(0,r.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 shrink-0"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:e.name})]},e.key)),f>3&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground/40",children:["+",f-3]})]}),(0,r.jsx)(i.A,{size:12,className:"ml-auto text-muted-foreground/30 group-hover:text-[var(--amber)] transition-colors"})]})});let g=l?x:x.slice(0,3),b=x.length-3;return(0,r.jsxs)("section",{className:"mb-10",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,r.jsx)("span",{className:"text-[var(--amber)]",children:(0,r.jsx)(Y.A,{size:13})}),(0,r.jsx)("h2",{className:"text-sm font-semibold font-display text-foreground",children:s.title}),f>0&&(0,r.jsx)("span",{className:"text-xs tabular-nums text-muted-foreground font-display",children:f}),p&&(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground/50 ml-1",children:[(0,r.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:s.running})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 ml-auto",children:[(0,r.jsx)(a(),{href:"/agents",className:"text-xs font-medium text-[var(--amber)] hover:opacity-80 transition-opacity font-display",children:s.manage}),(0,r.jsx)("button",{onClick:h,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground/40 hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Collapse",children:(0,r.jsx)(i.A,{size:12,className:"rotate-180"})})]})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:g.map(e=>{var t;let n,i=function(e){if(!e)return null;let t=Date.now()-new Date(e).getTime();return t<6e4?"<1m":t<36e5?`${Math.floor(t/6e4)}m`:t<864e5?`${Math.floor(t/36e5)}h`:`${Math.floor(t/864e5)}d`}(e.runtimeLastActivityAt);return(0,r.jsxs)(a(),{href:`/agents/${encodeURIComponent(e.key)}`,className:"flex items-center gap-3 px-3.5 py-3 rounded-xl border border-border hover:border-[var(--amber)]/30 hover:shadow-sm transition-all duration-150 hover:bg-muted/30 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,r.jsxs)("div",{className:"relative w-8 h-8 rounded-lg bg-[var(--amber)]/8 text-[var(--amber-text)] ring-1 ring-[var(--amber)]/15 flex items-center justify-center text-xs font-semibold font-display shrink-0",children:[(n=(t=e.name).split(/[\s-]+/)).length>=2?(n[0][0]+n[1][0]).toUpperCase():t.slice(0,2).toUpperCase(),(0,r.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-emerald-500 ring-[1.5px] ring-card"})]}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-foreground block truncate",children:e.name}),(0,r.jsxs)("span",{className:"text-xs text-muted-foreground/60 block",children:[s.active,i?` \xb7 ${i}`:""]})]})]},e.key)})}),b>0&&(0,r.jsxs)("button",{onClick:()=>d(e=>!e),className:"flex items-center gap-1.5 mt-2 text-xs font-medium text-[var(--amber)] hover:opacity-80 transition-opacity cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded",children:[(0,r.jsx)(i.A,{size:12,className:`transition-transform duration-200 ${l?"rotate-180":""}`}),(0,r.jsx)("span",{children:l?s.showLess:s.showMore(b)})]})]})}var Z=s(15282),G=s(29494);function X({isOrganizing:e=!1}){let{t}=(0,k.Y)(),[s,n]=(0,w.useState)([]),[a,i]=(0,w.useState)(!0),[o,l]=(0,w.useState)(!1),[c,m]=(0,w.useState)(!1),u=(0,w.useRef)(null),x=e||c,p=(0,w.useCallback)(()=>{0===s.length||x||(m(!0),window.dispatchEvent(new CustomEvent("mindos:inbox-organize",{detail:{files:s}})))},[s,x]),h=(0,w.useCallback)(e=>{e&&0!==e.length&&((0,G.Q)(Array.from(e),t),u.current&&(u.current.value=""))},[t]),f=(0,w.useCallback)(async()=>{try{let e=await fetch("/api/inbox");if(!e.ok)return;let t=await e.json();Array.isArray(t.files)&&n(t.files)}catch(e){console.warn("[InboxSection] Failed to fetch inbox:",e)}finally{i(!1)}},[]),g=(0,w.useRef)(void 0),b=(0,w.useCallback)(()=>{clearTimeout(g.current),g.current=setTimeout(f,80)},[f]);(0,w.useEffect)(()=>{f();let e=()=>{m(!1),b()};return window.addEventListener("mindos:files-changed",b),window.addEventListener("mindos:inbox-updated",b),window.addEventListener("mindos:organize-done",e),()=>{clearTimeout(g.current),window.removeEventListener("mindos:files-changed",b),window.removeEventListener("mindos:inbox-updated",b),window.removeEventListener("mindos:organize-done",e)}},[f,b]);let v=(0,w.useMemo)(()=>o?s:s.slice(0,5),[s,o]),j=s.length-5;return a?(0,r.jsxs)("section",{className:"mb-10 animate-pulse",children:[(0,r.jsx)("div",{className:"h-4 w-24 bg-muted rounded mb-3"}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"h-10 bg-muted/50 rounded-lg"}),(0,r.jsx)("div",{className:"h-10 bg-muted/50 rounded-lg"})]})]}):(0,r.jsxs)("section",{className:"mb-10",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,r.jsx)("span",{className:"text-[var(--amber)]",children:(0,r.jsx)(Z.A,{size:13})}),(0,r.jsx)("h2",{className:"text-sm font-semibold font-display text-foreground",children:t.inbox.title}),s.length>0&&(0,r.jsx)("span",{className:"inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 text-2xs font-semibold rounded-full bg-[var(--amber)]/15 text-[var(--amber)] tabular-nums font-display",children:t.inbox.count(s.length)}),s.length>0&&(0,r.jsxs)("div",{className:"ml-auto flex items-center gap-3",children:[(0,r.jsx)("button",{type:"button",onClick:()=>u.current?.click(),className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground cursor-pointer font-display",title:t.inbox.uploadButton,children:(0,r.jsx)(D.A,{size:12})}),(0,r.jsxs)("button",{onClick:p,disabled:x,className:"flex items-center gap-1.5 text-xs font-medium text-[var(--amber)] transition-colors hover:opacity-80 cursor-pointer font-display disabled:opacity-50 disabled:cursor-not-allowed",title:x?t.inbox.organizing:void 0,children:[x?(0,r.jsx)(N.A,{size:12,className:"animate-spin"}):(0,r.jsx)(d.A,{size:12}),(0,r.jsx)("span",{children:x?t.inbox.organizing:t.inbox.organizeButton})]})]})]}),(0,r.jsx)("input",{ref:u,type:"file",multiple:!0,accept:".md,.txt,.csv,.json,.pdf",className:"hidden",onChange:e=>h(e.target.files)}),0===s.length?(0,r.jsxs)("div",{className:"rounded-xl border-2 border-dashed border-border px-4 py-8 text-center",children:[(0,r.jsx)(Z.A,{size:24,className:"mx-auto mb-2 text-muted-foreground/30"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground/70 font-display",children:t.inbox.emptyTitle}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground/40 mt-1",children:t.inbox.emptyDesc}),(0,r.jsxs)("button",{type:"button",onClick:()=>u.current?.click(),className:"mt-3 inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg transition-colors bg-muted text-muted-foreground hover:text-foreground hover:bg-muted/80",children:[(0,r.jsx)(D.A,{size:12}),t.inbox.uploadButton]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"flex flex-col gap-0.5",children:v.map(e=>(0,r.jsx)(q,{file:e},e.path))}),j>0&&(0,r.jsxs)("button",{onClick:()=>l(e=>!e),className:"flex items-center gap-1 mt-2 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer font-display",children:[(0,r.jsx)(R.A,{size:12,className:`transition-transform duration-150 ${o?"rotate-90":""}`}),o?t.home.showLess:t.inbox.more(j)]})]})]})}function q({file:e}){let{t}=(0,k.Y)(),s=e.name.endsWith(".csv"),n=function(e,t){let s=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(s<1)return t.justNow;if(s<60)return t.minutesAgo(s);let r=Math.floor(s/60);if(r<24)return t.hoursAgo(r);let n=Math.floor(r/24);return t.daysAgo(n)}(e.modifiedAt,t.home.relativeTime);return(0,r.jsxs)(a(),{href:`/view/${(0,A.O0)(e.path)}`,className:"flex items-center gap-3 px-3 py-2 rounded-lg transition-all duration-100 hover:translate-x-0.5 hover:bg-muted group",children:[(0,r.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.isAging?"bg-[var(--amber)]/60":"bg-[var(--amber)]"}`}),s?(0,r.jsx)(o.A,{size:12,className:"shrink-0 text-success"}):(0,r.jsx)(l.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,r.jsx)("span",{className:"text-sm truncate flex-1 text-foreground",title:e.name,suppressHydrationWarning:!0,children:e.name}),(0,r.jsx)("span",{className:"text-2xs text-muted-foreground/50 tabular-nums shrink-0 font-display",children:n}),e.isAging&&(0,r.jsx)("span",{title:"7+ days",children:(0,r.jsx)(T.A,{size:11,className:"shrink-0 text-[var(--amber)]/60"})})]})}var V=s(3237),ee=s(7701),et=s(6496);function es(){window.dispatchEvent(new KeyboardEvent("keydown",{key:"k",metaKey:!0,bubbles:!0}))}function er(){window.dispatchEvent(new KeyboardEvent("keydown",{key:"/",metaKey:!0,bubbles:!0}))}function en({icon:e,children:t,count:s,action:n}){return(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,r.jsx)("span",{className:"text-[var(--amber)]",children:e}),(0,r.jsx)("h2",{className:"text-sm font-semibold font-display text-foreground",children:t}),null!=s&&s>0&&(0,r.jsx)("span",{className:"text-xs tabular-nums text-muted-foreground font-display",children:s}),n?(0,r.jsx)("div",{className:"ml-auto",children:n}):null]})}function ea({expanded:e,onToggle:t,showLabel:s,hideLabel:n,className:a=""}){return(0,r.jsxs)("button",{onClick:t,"aria-expanded":e,className:`flex items-center gap-1.5 text-xs font-medium text-[var(--amber)] transition-colors hover:opacity-80 cursor-pointer font-display ${a}`,children:[(0,r.jsx)(i.A,{size:12,className:`transition-transform duration-200 ${e?"rotate-180":""}`}),(0,r.jsx)("span",{children:e?n:s})]})}function ei({filePath:e,mtime:t,formatTime:s,subPath:n}){let i=e.endsWith(".csv"),d=e.split("/").pop()||e;return(0,r.jsxs)(a(),{href:`/view/${(0,A.O0)(e)}`,className:"flex items-center gap-3 px-3 py-2 rounded-lg transition-all duration-100 hover:translate-x-0.5 hover:bg-muted group",children:[i?(0,r.jsx)(o.A,{size:12,className:"shrink-0 text-success"}):(0,r.jsx)(l.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("span",{className:"text-sm truncate block text-foreground",suppressHydrationWarning:!0,children:d}),n&&(0,r.jsx)("span",{className:"text-xs truncate block text-muted-foreground opacity-50",suppressHydrationWarning:!0,children:n})]}),(0,r.jsx)("span",{className:"text-xs shrink-0 tabular-nums font-display text-muted-foreground opacity-40",suppressHydrationWarning:!0,children:s(t)})]})}function eo({recent:e,existingFiles:t,spaces:s}){let{t:n}=(0,k.Y)(),[i,g]=(0,w.useState)(!1),[b,v]=(0,w.useState)(!1),[j,N]=(0,w.useState)(0),y=n.ask?.suggestions??["Summarize this document","List all action items and TODOs","What are the key points?","Find related notes on this topic"];(0,w.useEffect)(()=>{let e=setInterval(()=>{N(e=>(e+1)%y.length)},4e3);return()=>clearInterval(e)},[y.length]);let z=s??[],{groups:C,rootFiles:E}=(0,w.useMemo)(()=>(function(e,t){let s=new Map,r=[];for(let n of e){let e=n.path.split("/");if(e.length<2){r.push(n);continue}let a=e[0],i=t.find(e=>e.name===a);s.has(a)||s.set(a,{space:a,spacePath:a+"/",files:[],latestMtime:0,totalFiles:i?.fileCount??0});let o=s.get(a);o.files.push(n),o.latestMtime=Math.max(o.latestMtime,n.mtime)}return{groups:[...s.values()].sort((e,t)=>t.latestMtime-e.latestMtime),rootFiles:r}})(e,z),[e,z]);if(0===e.length)return(0,r.jsx)($,{});let S=e=>(0,A.KW)(e,n.home.relativeTime),T=e[0];return(0,r.jsxs)("div",{className:"content-width px-4 md:px-6 py-10 md:py-14",children:[(0,r.jsx)(U,{}),(0,r.jsx)(ec,{}),(0,r.jsxs)("div",{className:"mb-10",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,r.jsx)("div",{className:"w-1 h-7 rounded-full bg-gradient-to-b from-[var(--amber)] to-[var(--amber)]/20"}),(0,r.jsx)("h1",{className:"text-2xl font-semibold tracking-tight font-display text-foreground",children:"MindOS"})]}),(0,r.jsx)("p",{className:"text-sm leading-relaxed text-muted-foreground pl-4 max-w-lg mb-6",children:n.app.tagline}),(0,r.jsxs)("div",{className:"w-full max-w-xl flex flex-col sm:flex-row items-stretch sm:items-center gap-2 pl-4",children:[(0,r.jsxs)("button",{onClick:er,title:"⌘/","data-walkthrough":"ask-button",className:"flex-1 flex items-center gap-3 px-4 py-3 rounded-xl border border-border/60 shadow-sm bg-card transition-all duration-150 hover:border-[var(--amber)]/50 hover:shadow-md group",children:[(0,r.jsx)(d.A,{size:15,className:"shrink-0 text-[var(--amber)] group-hover:scale-110 transition-transform duration-150"}),(0,r.jsx)("div",{className:"flex-1 min-h-[1.5rem] flex items-center",children:(0,r.jsx)("span",{className:"text-sm text-left text-muted-foreground animate-in fade-in duration-300",children:y[j]},j)}),(0,r.jsx)("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-2 py-0.5 rounded text-xs font-mono font-medium bg-[var(--amber-dim)] text-[var(--amber-text)]",children:"⌘/"})]}),(0,r.jsxs)("button",{onClick:es,title:"⌘K",className:"flex items-center gap-2 px-3.5 py-3 rounded-xl border border-border/60 text-sm text-muted-foreground transition-all duration-150 shrink-0 hover:bg-muted hover:shadow-sm",children:[(0,r.jsx)(c.A,{size:14}),(0,r.jsx)("kbd",{className:"hidden sm:inline-flex items-center px-1.5 py-0.5 rounded text-2xs font-mono bg-muted",children:"⌘K"})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 mt-4 pl-4",children:[(0,r.jsxs)(a(),{href:"/view/Untitled.md",className:"inline-flex items-center gap-2 px-3.5 py-2 rounded-lg text-sm font-medium transition-all duration-150 hover:shadow-sm bg-[var(--amber)] text-[var(--amber-foreground)]",children:[(0,r.jsx)(m.A,{size:14}),(0,r.jsx)("span",{children:n.home.newNote})]}),T&&(0,r.jsxs)(a(),{href:`/view/${(0,A.O0)(T.path)}`,className:"inline-flex items-center gap-2 px-3.5 py-2 rounded-lg text-sm font-medium transition-colors text-muted-foreground hover:text-foreground hover:bg-muted",children:[(0,r.jsx)(u.A,{size:14,className:"text-[var(--amber)]/60"}),(0,r.jsx)("span",{children:n.home.continueEditing}),(0,r.jsx)("span",{className:"text-xs opacity-40 truncate max-w-32",suppressHydrationWarning:!0,children:T.path.split("/").pop()})]})]})]}),(0,r.jsx)(Q,{}),(0,r.jsx)("div",{className:"mb-10",children:(0,r.jsx)(et.A,{})}),(0,r.jsx)(X,{}),(z.length,(0,r.jsxs)("section",{className:"mb-10",children:[(0,r.jsx)(en,{icon:(0,r.jsx)(x.A,{size:13}),count:z.length>0?z.length:void 0,action:(0,r.jsx)(ed,{t:n}),children:n.home.spaces}),z.length>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:(b?z:z.slice(0,6)).map(e=>{let t=(0,A.IX)(e.name),s=(0,A.vr)(e.name),i=0===e.fileCount;return(0,r.jsxs)(a(),{href:`/view/${(0,A.O0)(e.path)}`,className:`flex items-start gap-3 px-3.5 py-3 rounded-xl border transition-all duration-150 ${i?"border-dashed border-border/50 opacity-50 hover:opacity-70":"border-border hover:border-[var(--amber)]/30 hover:shadow-sm"}`,children:[t?(0,r.jsx)("span",{className:"text-lg leading-none shrink-0 mt-0.5",suppressHydrationWarning:!0,children:t}):(0,r.jsx)(p.A,{size:16,className:"shrink-0 text-[var(--amber)] mt-0.5"}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("span",{className:"text-sm font-medium truncate block text-foreground",children:s}),e.description&&(0,r.jsx)("span",{className:"text-xs text-muted-foreground line-clamp-1 mt-0.5",suppressHydrationWarning:!0,children:e.description}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground/50 mt-0.5 block tabular-nums",children:n.home.nFiles(e.fileCount)})]})]},e.name)})}),z.length>6&&(0,r.jsx)(ea,{expanded:b,onToggle:()=>v(e=>!e),showLabel:n.home.showMore,hideLabel:n.home.showLess,className:"mt-2"})]}):(0,r.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:n.home.noSpacesYet??"No spaces yet. Create one to organize your knowledge."})]})),(0,r.jsx)(el,{formatTime:S}),e.length>0&&(0,r.jsxs)("section",{className:"mb-10",children:[(0,r.jsx)(en,{icon:(0,r.jsx)(h.A,{size:13}),count:e.length,action:(0,r.jsxs)(a(),{href:"/changes",className:"flex items-center gap-1.5 text-xs font-medium text-[var(--amber)] transition-colors hover:opacity-80 font-display",children:[(0,r.jsx)(f.A,{size:12}),(0,r.jsx)("span",{children:n.home.changeHistory})]}),children:n.home.recentlyEdited}),C.length>0?(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[C.map(e=>{let t=i?e.files:e.files.slice(0,3),s=e.files.length>3;return(0,r.jsxs)("div",{children:[(0,r.jsxs)(a(),{href:`/view/${(0,A.O0)(e.spacePath)}`,className:"flex items-center gap-2 px-1 py-1.5 rounded-lg group transition-colors hover:bg-muted/50",children:[(0,r.jsx)(p.A,{size:13,className:"shrink-0 text-[var(--amber)]"}),(0,r.jsx)("span",{className:"text-xs font-semibold font-display text-foreground group-hover:text-[var(--amber)] transition-colors",suppressHydrationWarning:!0,children:e.space}),(0,r.jsxs)("span",{className:"text-xs text-muted-foreground/50 tabular-nums",suppressHydrationWarning:!0,children:[n.home.nFiles(e.totalFiles)," \xb7 ",S(e.latestMtime)]}),s&&!i&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground/30 tabular-nums",children:["+",e.files.length-3]})]}),(0,r.jsx)("div",{className:"flex flex-col gap-0.5 ml-2 border-l border-border/40 pl-3",children:t.map(({path:e,mtime:t})=>(0,r.jsx)(ei,{filePath:e,mtime:t,formatTime:S,subPath:e.split("/").slice(1,-1).join("/")},e))})]},e.space)}),E.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-1 py-1.5",children:[(0,r.jsx)(l.A,{size:13,className:"shrink-0 text-muted-foreground/50"}),(0,r.jsx)("span",{className:"text-xs font-semibold font-display text-muted-foreground/60",children:n.home.other})]}),(0,r.jsx)("div",{className:"flex flex-col gap-0.5 ml-2 border-l border-border/40 pl-3",children:E.map(({path:e,mtime:t})=>(0,r.jsx)(ei,{filePath:e,mtime:t,formatTime:S},e))})]}),C.some(e=>e.files.length>3)&&(0,r.jsx)(ea,{expanded:i,onToggle:()=>g(e=>!e),showLabel:n.home.showMore,hideLabel:n.home.showLess,className:"mt-1 ml-1"})]}):(0,r.jsxs)("div",{className:"relative pl-4",children:[(0,r.jsx)("div",{className:"absolute left-0 top-1 bottom-1 w-px bg-border/40"}),(0,r.jsx)("div",{className:"flex flex-col gap-0.5",children:(i?e:e.slice(0,5)).map(({path:e,mtime:t},s)=>{let n=e.endsWith(".csv"),i=e.split("/").pop()||e,d=e.split("/").slice(0,-1).join("/");return(0,r.jsxs)("div",{className:"relative group",children:[(0,r.jsx)("div",{"aria-hidden":"true",className:`absolute -left-4 top-1/2 -translate-y-1/2 rounded-full transition-all duration-150 group-hover:scale-150 ${0===s?"w-2 h-2 bg-[var(--amber)] ring-2 ring-[var(--amber)]/20":"w-1.5 h-1.5 bg-muted-foreground/20"}`}),(0,r.jsxs)(a(),{href:`/view/${(0,A.O0)(e)}`,className:"flex items-center gap-3 px-3 py-2 rounded-lg transition-all duration-100 group-hover:translate-x-0.5 hover:bg-muted",children:[n?(0,r.jsx)(o.A,{size:12,className:"shrink-0 text-success"}):(0,r.jsx)(l.A,{size:12,className:"shrink-0 text-muted-foreground/50"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("span",{className:"text-sm truncate block text-foreground",suppressHydrationWarning:!0,children:i}),d&&(0,r.jsx)("span",{className:"text-xs truncate block text-muted-foreground/40",suppressHydrationWarning:!0,children:d})]}),(0,r.jsx)("span",{className:"text-xs shrink-0 tabular-nums font-display text-muted-foreground/40",suppressHydrationWarning:!0,children:S(t)})]})]},e)})}),e.length>5&&(0,r.jsx)(ea,{expanded:i,onToggle:()=>g(e=>!e),showLabel:n.home.showMore,hideLabel:n.home.showLess,className:"mt-2 ml-3"})]})]}),(0,r.jsxs)("div",{className:"py-6 border-t border-border/20 flex items-center gap-1.5 text-xs font-display text-muted-foreground/30",children:[(0,r.jsx)(d.A,{size:10,className:"text-[var(--amber)]/40"}),(0,r.jsx)("span",{children:n.app.footer})]})]})}function el({formatTime:e}){let{t}=(0,k.Y)(),{pinnedFiles:s,removePin:n}=(0,z.Z)();return 0===s.length?null:(0,r.jsxs)("section",{className:"mb-12",children:[(0,r.jsx)(en,{icon:(0,r.jsx)(g.A,{size:13}),count:s.length,children:t.pinnedFiles.title}),(0,r.jsx)("div",{className:"flex flex-col gap-0.5",children:s.map(e=>{let s=e.split("/").pop()||e,i=e.split("/").slice(0,-1).join("/"),d=e.endsWith(".csv");return(0,r.jsxs)("div",{className:"group/pin relative",children:[(0,r.jsxs)(a(),{href:`/view/${(0,A.O0)(e)}`,className:"flex items-center gap-3 px-3 py-2 rounded-lg transition-all duration-100 hover:translate-x-0.5 hover:bg-muted",children:[(0,r.jsx)(g.A,{size:12,className:"shrink-0 fill-[var(--amber)] text-[var(--amber)]"}),d?(0,r.jsx)(o.A,{size:12,className:"shrink-0 text-success"}):(0,r.jsx)(l.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("span",{className:"text-sm truncate block text-foreground",suppressHydrationWarning:!0,children:s}),i&&(0,r.jsx)("span",{className:"text-xs truncate block text-muted-foreground opacity-50",suppressHydrationWarning:!0,children:i})]})]}),(0,r.jsx)("button",{onClick:t=>{t.preventDefault(),t.stopPropagation(),n(e)},className:"absolute right-2 top-1/2 -translate-y-1/2 hidden group-hover/pin:flex p-1 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:t.pinnedFiles.removedToast,children:(0,r.jsx)(b.A,{size:12})})]},e)})})]})}function ed({t:e}){return(0,r.jsxs)("button",{onClick:()=>window.dispatchEvent(new Event("mindos:create-space")),className:"flex items-center gap-1.5 text-xs font-medium text-[var(--amber)] transition-colors hover:opacity-80 cursor-pointer font-display",children:[(0,r.jsx)(v.A,{size:12}),(0,r.jsx)("span",{children:e.home.newSpace})]})}function ec(){let{t:e}=(0,k.Y)(),[t,s]=(0,w.useState)(null),[n,a]=(0,w.useState)(!1),[i,o]=(0,w.useState)(!1),[l,d]=(0,w.useState)(!1);(0,w.useEffect)(()=>{(0,V.D)().then(e=>{e.files.length>0&&s(e.files.length)}).catch(e=>{console.warn("[HomeContent] scanExampleFilesAction failed:",e)})},[]);let c=(0,w.useCallback)(async()=>{if(null!==t){a(!0);try{(await (0,ee.E)()).success&&(o(!0),setTimeout(()=>d(!0),2500))}catch{}a(!1)}},[t]);return l||null===t||0===t?null:i?(0,r.jsxs)("div",{className:"mb-6 flex items-center gap-2.5 px-4 py-3 rounded-xl border border-success/30 bg-success/5 animate-in fade-in duration-300",children:[(0,r.jsx)(j.A,{size:14,className:"text-success shrink-0"}),(0,r.jsx)("span",{className:"text-xs text-success",children:e.home.cleanupExamplesDone})]}):(0,r.jsxs)("div",{className:"mb-6 flex items-center gap-3 px-4 py-3 rounded-xl border border-border bg-muted/30 animate-in fade-in duration-300",children:[(0,r.jsx)("span",{className:"text-sm leading-none shrink-0",children:"\uD83E\uDDEA"}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground flex-1",children:e.home.cleanupExamples(t)}),(0,r.jsxs)("button",{onClick:c,disabled:n,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg transition-colors shrink-0 disabled:opacity-50 bg-[var(--amber-dim)] text-[var(--amber-text)] hover:opacity-80",children:[n?(0,r.jsx)(N.A,{size:11,className:"animate-spin"}):(0,r.jsx)(y.A,{size:11}),e.home.cleanupExamplesButton]}),(0,r.jsx)("button",{onClick:()=>d(!0),className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground shrink-0",children:(0,r.jsx)(b.A,{size:12})})]})}},70617:(e,t,s)=>{"use strict";s.d(t,{cd:()=>d,kr:()=>l,zd:()=>o});var r=s(1934),n=s(22356);let a=null;async function i(e){a?.abort();let t=new AbortController;a=t;try{let[s,r,a]=await Promise.all([(0,n.n)("/api/mcp/status",{signal:t.signal}),(0,n.n)("/api/mcp/agents",{signal:t.signal}),(0,n.n)("/api/skills",{signal:t.signal})]);t.signal.aborted||e({status:s,agents:r.agents,skills:a.skills})}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return}finally{t.signal.aborted||e({loading:!1})}}let o=(0,r.v)((e,t)=>({status:null,agents:[],skills:[],loading:!0,refresh:()=>i(e),toggleSkill:async(s,r)=>{e({skills:t().skills.map(e=>e.name===s?{...e,enabled:r}:e)});try{return await (0,n.n)("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"toggle",name:s,enabled:r})}),!0}catch{return e({skills:t().skills.map(e=>e.name===s?{...e,enabled:!r}:e)}),!1}},installAgent:async(s,r)=>{let a=t().agents.find(e=>e.key===s);if(!a)return!1;try{let t=await (0,n.n)("/api/mcp/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:[{key:s,scope:r?.scope??(a.hasProjectScope?"project":"global"),transport:r?.transport??a.preferredTransport}],transport:"auto"})}),o=t.results?.[0],l=o?.ok===!0||o?.status==="ok";return l&&await i(e),l}catch{return!1}},_init:()=>{let t;i(e);let s=()=>{clearTimeout(t),t=setTimeout(()=>i(e),500)};window.addEventListener("mindos:skills-changed",s);let r=setInterval(()=>{"visible"===document.visibilityState&&i(e)},3e4);return()=>{a?.abort(),clearTimeout(t),clearInterval(r),window.removeEventListener("mindos:skills-changed",s)}}}));function l(){return o()}function d(){return o()}},76449:(e,t,s)=>{"use strict";s.d(t,{g:()=>r});let r=[{anchor:"files-panel",position:"right"},{anchor:"ask-button",position:"right"},{anchor:"agents-panel",position:"right"}]},91337:(e,t,s)=>{"use strict";s.d(t,{IX:()=>l,KW:()=>o,O0:()=>i,cn:()=>a,vr:()=>d});var r=s(29722),n=s(622);function a(...e){return(0,n.QP)((0,r.$)(e))}function i(e){return e.split("/").map(encodeURIComponent).join("/")}function o(e,t){let s=Date.now()-e,r=Math.floor(s/6e4),n=Math.floor(s/36e5),a=Math.floor(s/864e5);return r<1?t.justNow:r<60?t.minutesAgo(r):n<24?t.hoursAgo(n):a<7?t.daysAgo(a):new Date(e).toLocaleDateString()}function l(e){let t=e.match(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}]+/u);return t?.[0]??""}function d(e){return e.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\s]+/u,"")||e}}},e=>{e.O(0,[6926,9602,3160,1053,8441,3794,7358],()=>e(e.s=14153)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1227],{1934:(e,t,r)=>{"use strict";r.d(t,{v:()=>o});var s=r(12115);let a=e=>{let t,r=new Set,s=(e,s)=>{let a="function"==typeof e?e(t):e;if(!Object.is(a,t)){let e=t;t=(null!=s?s:"object"!=typeof a||null===a)?a:Object.assign({},t,a),r.forEach(r=>r(t,e))}},a=()=>t,n={setState:s,getState:a,getInitialState:()=>o,subscribe:e=>(r.add(e),()=>r.delete(e))},o=t=e(s,a,n);return n},n=e=>{let t=e?a(e):a,r=e=>(function(e,t=e=>e){let r=s.useSyncExternalStore(e.subscribe,s.useCallback(()=>t(e.getState()),[e,t]),s.useCallback(()=>t(e.getInitialState()),[e,t]));return s.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},o=e=>e?n(e):n},4235:(e,t,r)=>{"use strict";r.d(t,{B1:()=>i,X8:()=>l,dV:()=>d,oR:()=>u});let s=[],a=[],n=0;function o(){for(let e of a)e()}function i(e){return a=[...a,e],()=>{a=a.filter(t=>t!==e)}}function d(){return s}function l(e){s=s.filter(t=>t.id!==e),o()}function c(e){let t=`toast-${++n}`,r={id:t,message:e.message,type:e.type??"info",duration:e.duration??2e3,action:e.action};s=[...s,r].slice(-3),o(),r.duration>0&&setTimeout(()=>l(t),r.duration)}function u(e,t){c({message:e,...t})}u.success=(e,t)=>c({message:e,type:"success",duration:t}),u.undo=(e,t,r)=>c({message:e,type:"info",duration:r?.duration??5e3,action:{label:r?.label??"Undo",onClick:t}}),u.error=(e,t)=>c({message:e,type:"error",duration:t}),u.copy=(e="Copied")=>c({message:e,type:"success",duration:1500})},6296:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(90425).A)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},9199:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(90425).A)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]])},9339:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s={callServer:function(){return n.callServer},createServerReference:function(){return i.createServerReference},findSourceMapURL:function(){return o.findSourceMapURL}};for(var a in s)Object.defineProperty(t,a,{enumerable:!0,get:s[a]});let n=r(77304),o=r(4060),i=r(77197)},33078:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(90425).A)("table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]])},33210:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(90425).A)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},38798:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(90425).A)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]])},39498:(e,t,r)=>{"use strict";r.d(t,{BK:()=>y,DO:()=>c,KF:()=>d,Mv:()=>m,TM:()=>v,ZC:()=>g,lx:()=>p,md:()=>l,pp:()=>x,rA:()=>u});var s=r(95155),a=r(33210),n=r(6296),o=r(51914),i=r(12115);function d({active:e,label:t,onClick:r}){return(0,s.jsx)("button",{type:"button",onClick:r,"aria-pressed":e,className:`relative px-2.5 min-h-[28px] rounded text-xs cursor-pointer transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${e?"bg-[var(--amber-dim)] text-[var(--amber-text)] font-medium shadow-[0_1px_2px_rgba(200,135,58,0.08)]":"text-muted-foreground hover:text-foreground hover:bg-muted/60"}`,children:t})}function l({tone:e,label:t,count:r}){return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[(0,s.jsx)("span",{className:`w-2 h-2 rounded-full ${"ok"===e?"bg-[var(--success)]":"warn"===e?"bg-[var(--amber)]":"bg-muted-foreground/60"}`,"aria-hidden":"true"}),(0,s.jsx)("span",{className:"text-xs",children:t}),(0,s.jsx)("span",{className:`tabular-nums font-medium ${"ok"===e?"text-foreground":"warn"===e?"text-[var(--amber)]":"text-muted-foreground"}`,children:r})]})}function c({value:e,onChange:t,placeholder:r,ariaLabel:n,icon:o}){return(0,s.jsxs)("label",{className:"relative block group/search",children:[(0,s.jsx)(o,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground/60 group-focus-within/search:text-[var(--amber)] pointer-events-none transition-colors duration-150"}),(0,s.jsx)("input",{value:e,onChange:e=>t(e.target.value),placeholder:r,"aria-label":n,className:"w-full h-9 rounded-lg border border-border bg-background pl-9 pr-8 text-sm text-foreground placeholder:text-muted-foreground/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--amber)]/30 focus-visible:border-[var(--amber)]/40 transition-all duration-150"}),e.length>0&&(0,s.jsx)("button",{type:"button",onClick:()=>t(""),"aria-label":"Clear search",className:"absolute right-2.5 top-1/2 -translate-y-1/2 p-0.5 rounded-full text-muted-foreground hover:text-foreground hover:bg-muted cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors duration-150",children:(0,s.jsx)(a.A,{size:13})})]})}function u({onClick:e,disabled:t,busy:r,label:a,busyLabel:o,variant:i="default"}){return(0,s.jsxs)("button",{type:"button",onClick:e,disabled:t,"aria-busy":r,className:`inline-flex items-center justify-center gap-1.5 text-2xs min-h-[28px] px-2.5 rounded-md cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-150 ${{default:"border border-border hover:bg-muted",primary:"bg-[var(--amber)] text-background hover:bg-[var(--amber)]/90"}[i]}`,children:[r&&(0,s.jsx)(n.A,{size:12,className:"animate-spin","aria-hidden":"true"}),r?o??a:a]})}function m({message:e}){return e?(0,s.jsx)("span",{role:"status","aria-live":"polite",className:"text-2xs text-muted-foreground animate-in fade-in duration-200",children:e}):null}function x({message:e,icon:t,className:r}){return(0,s.jsxs)("div",{className:`rounded-xl border border-dashed border-border/60 bg-gradient-to-b from-card/80 to-card/40 p-10 text-center ${r??""}`,children:[t&&(0,s.jsx)("div",{className:"w-10 h-10 rounded-full bg-muted/50 flex items-center justify-center mx-auto mb-3 text-muted-foreground/40",children:t}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground/70 leading-relaxed max-w-xs mx-auto",children:e})]})}let b=[["bg-rose-100/70 dark:bg-rose-900/30","border-rose-300/50 dark:border-rose-700/40","text-rose-600/80 dark:text-rose-400/80"],["bg-violet-100/70 dark:bg-violet-900/30","border-violet-300/50 dark:border-violet-700/40","text-violet-600/80 dark:text-violet-400/80"],["bg-emerald-100/70 dark:bg-emerald-900/30","border-emerald-300/50 dark:border-emerald-700/40","text-emerald-600/80 dark:text-emerald-400/80"],["bg-sky-100/70 dark:bg-sky-900/30","border-sky-300/50 dark:border-sky-700/40","text-sky-600/80 dark:text-sky-400/80"],["bg-amber-100/70 dark:bg-amber-900/30","border-amber-300/50 dark:border-amber-700/40","text-amber-700/80 dark:text-amber-400/80"],["bg-teal-100/70 dark:bg-teal-900/30","border-teal-300/50 dark:border-teal-700/40","text-teal-600/80 dark:text-teal-400/80"],["bg-pink-100/70 dark:bg-pink-900/30","border-pink-300/50 dark:border-pink-700/40","text-pink-600/80 dark:text-pink-400/80"],["bg-indigo-100/70 dark:bg-indigo-900/30","border-indigo-300/50 dark:border-indigo-700/40","text-indigo-600/80 dark:text-indigo-400/80"],["bg-lime-100/70 dark:bg-lime-900/30","border-lime-300/50 dark:border-lime-700/40","text-lime-700/80 dark:text-lime-400/80"],["bg-fuchsia-100/70 dark:bg-fuchsia-900/30","border-fuchsia-300/50 dark:border-fuchsia-700/40","text-fuchsia-600/80 dark:text-fuchsia-400/80"],["bg-cyan-100/70 dark:bg-cyan-900/30","border-cyan-300/50 dark:border-cyan-700/40","text-cyan-600/80 dark:text-cyan-400/80"],["bg-orange-100/70 dark:bg-orange-900/30","border-orange-300/50 dark:border-orange-700/40","text-orange-600/80 dark:text-orange-400/80"]];function f(e){let t=0;for(let r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)|0;return Math.abs(t)}function h(e){let t=e.split(/[\s\-_]+/).filter(Boolean);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function p({name:e,status:t,size:r="md",onRemove:n,href:o}){let[i,d,l]=b[f(e)%b.length],c="connected"===t?"bg-[var(--success)]":"detected"===t?"bg-[var(--amber)]":"bg-muted-foreground";return(0,s.jsxs)("div",{className:"relative group/avatar",title:e,children:[(0,s.jsx)("div",{className:`${"sm"===r?"w-7 h-7 text-[10px]":"w-9 h-9 text-xs"} ${i} ${d} ${l} border rounded-full flex items-center justify-center font-semibold select-none`,children:h(e)}),t&&(0,s.jsx)("span",{className:`absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-full border-2 border-card ${c}`,"aria-hidden":"true"}),n&&(0,s.jsx)("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},className:"absolute -top-1 -right-1 w-4 h-4 rounded-full bg-destructive text-white flex items-center justify-center opacity-0 scale-75 group-hover/avatar:opacity-100 group-hover/avatar:scale-100 transition-all duration-150 cursor-pointer focus-visible:opacity-100 focus-visible:scale-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":`Remove ${e}`,children:(0,s.jsx)(a.A,{size:9})})]})}function g({onClick:e,label:t,size:r="md"}){return(0,s.jsx)("button",{type:"button",onClick:e,title:t,"aria-label":t,className:`${"sm"===r?"w-7 h-7":"w-9 h-9"} rounded-full border-2 border-dashed border-border flex items-center justify-center text-muted-foreground hover:text-foreground hover:border-foreground/30 hover:bg-muted cursor-pointer transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,s.jsx)(o.A,{size:14})})}function v({open:e,title:t,message:r,confirmLabel:a,cancelLabel:n,onConfirm:o,onCancel:d,variant:l="destructive"}){let c=(0,i.useRef)(null);return((0,i.useEffect)(()=>{e&&c.current?.focus()},[e]),(0,i.useEffect)(()=>{if(e)return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&d()}},[e,d]),e)?(0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",role:"alertdialog","aria-modal":"true","aria-label":t,children:[(0,s.jsx)("div",{className:"absolute inset-0 overlay-backdrop",onClick:d,"aria-hidden":"true"}),(0,s.jsxs)("div",{className:"relative bg-card border border-border rounded-lg shadow-xl p-5 max-w-sm w-full mx-4 animate-in fade-in zoom-in-95 duration-200",children:[(0,s.jsx)("h3",{className:"text-sm font-medium text-foreground mb-1.5",children:t}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground mb-4 leading-relaxed",children:r}),(0,s.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,s.jsx)("button",{ref:c,type:"button",onClick:d,className:"px-3 min-h-[32px] text-sm rounded-md border border-border hover:bg-muted cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors duration-150",children:n}),(0,s.jsx)("button",{type:"button",onClick:o,className:`px-3 min-h-[32px] text-sm rounded-md cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors duration-150 ${"destructive"===l?"bg-destructive text-destructive-foreground hover:bg-destructive/90":"bg-[var(--amber)] text-background hover:bg-[var(--amber)]/90"}`,children:a})]})]})]}):null}function y({open:e,agents:t,emptyLabel:r,onSelect:a,onClose:n}){let o=(0,i.useRef)(null);return((0,i.useEffect)(()=>{if(e)return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t);function t(e){o.current&&!o.current.contains(e.target)&&n()}},[e,n]),(0,i.useEffect)(()=>{if(e)return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t);function t(e){"Escape"===e.key&&n()}},[e,n]),e)?(0,s.jsx)("div",{ref:o,className:"absolute right-0 top-full mt-1 z-30 w-56 rounded-lg border border-border bg-card shadow-lg animate-in fade-in slide-in-from-top-1 duration-150",children:0===t.length?(0,s.jsx)("p",{className:"px-3 py-2.5 text-xs text-muted-foreground",children:r}):(0,s.jsx)("div",{className:"py-1 max-h-48 overflow-y-auto",children:t.map(e=>(0,s.jsxs)("button",{type:"button",onClick:()=>a(e.key),className:"w-full text-left px-3 py-2 text-xs text-foreground hover:bg-muted cursor-pointer flex items-center gap-2 transition-colors duration-100",children:[(()=>{let[t,r,a]=b[f(e.name)%b.length];return(0,s.jsx)("div",{className:`w-6 h-6 rounded-full border ${t} ${r} ${a} flex items-center justify-center text-[9px] font-semibold shrink-0`,children:h(e.name)})})(),e.name]},e.key))})}):null}},41585:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(90425).A)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},48368:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(90425).A)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},51680:(e,t,r)=>{"use strict";r.d(t,{default:()=>k});var s=r(95155),a=r(12115),n=r(68459),o=r(38798),i=r(33078),d=r(48368),l=r(41585),c=r(6296),u=r(9199),m=r(33210),x=r(73321),b=r(91053),f=r(9339);let h=(0,f.createServerReference)("603a64fdddfef4e658bbfe23c10538d829c8674caf",f.callServer,void 0,f.findSourceMapURL,"restoreFromTrashAction"),p=(0,f.createServerReference)("40abff7bf8f41fb44ec5d138147d0d85764a47b5cb",f.callServer,void 0,f.findSourceMapURL,"permanentlyDeleteAction"),g=(0,f.createServerReference)("004a0f75f9c85bdb0fb526bd4c31a93a5579c69f2c",f.callServer,void 0,f.findSourceMapURL,"emptyTrashAction");var v=r(39498),y=r(4235);function k({initialItems:e}){let{t}=(0,b.Y)(),r=(0,x.useRouter)(),[f,k]=(0,a.useState)(e),[j,N]=(0,a.useTransition)(),[w,A]=(0,a.useState)(!1),[C,M]=(0,a.useState)(null),[S,R]=(0,a.useState)(null),[z,$]=(0,a.useState)(null),L=(0,a.useCallback)(async e=>{$(e.id);try{let s=await h(e.id,"restore");s.success?(k(t=>t.filter(t=>t.id!==e.id)),y.oR.success(t.trash.restored),r.refresh()):s.conflict?R(e):y.oR.error(s.error??"Failed to restore")}finally{$(null)}},[t,r]),E=(0,a.useCallback)(async e=>{if(!S)return;let s=await h(S.id,e);s.success?(k(e=>e.filter(e=>e.id!==S.id)),y.oR.success(t.trash.restored),R(null),r.refresh()):y.oR.error(s.error??"Failed to restore")},[S,t,r]),P=(0,a.useCallback)(async()=>{if(!C)return;let e=await p(C.id);e.success?(k(e=>e.filter(e=>e.id!==C.id)),y.oR.success(t.trash.deleted)):y.oR.error(e.error??"Failed to delete"),M(null)},[C,t]),T=(0,a.useCallback)(async()=>{N(async()=>{let e=await g();e.success?(k([]),y.oR.success(t.trash.emptied(e.count??0))):y.oR.error(e.error??"Failed to empty trash"),A(!1)})},[t]);return(0,s.jsxs)("div",{className:"min-h-screen",children:[(0,s.jsx)("div",{className:"px-4 md:px-6 pt-6 md:pt-8",children:(0,s.jsx)("div",{className:"content-width xl:mr-[220px] rounded-xl border border-border bg-card px-4 py-3 md:px-5 md:py-4",children:(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground font-display",children:[(0,s.jsx)(n.A,{size:15}),t.trash.title]}),(0,s.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:t.trash.subtitle}),f.length>0&&(0,s.jsx)("div",{className:"mt-2 text-xs text-muted-foreground",children:t.trash.itemCount(f.length)})]}),f.length>0&&(0,s.jsx)("button",{type:"button",onClick:()=>A(!0),disabled:j,className:"px-2.5 py-1.5 rounded-md text-xs font-medium bg-error/10 text-error hover:bg-error/20 transition-colors disabled:opacity-50",children:t.trash.emptyTrash})]})})}),(0,s.jsx)("div",{className:"px-4 md:px-6 py-4 md:py-6",children:(0,s.jsx)("div",{className:"content-width xl:mr-[220px]",children:0===f.length?(0,s.jsxs)("div",{className:"rounded-xl border border-dashed border-border bg-card p-12 text-center",children:[(0,s.jsx)(n.A,{size:32,className:"mx-auto text-muted-foreground/30 mb-3"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground font-display",children:t.trash.empty}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground/60 mt-1",children:t.trash.emptySubtext})]}):(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:f.map(e=>{let r=Math.max(0,Math.ceil((new Date(e.expiresAt).getTime()-Date.now())/864e5)),a=r<=3;return(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-card p-4 flex flex-col gap-3 hover:border-border/80 transition-colors",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3 min-w-0",children:[(0,s.jsx)("div",{className:"w-9 h-9 rounded-lg bg-muted/50 flex items-center justify-center shrink-0",children:e.isDirectory?(0,s.jsx)(o.A,{size:16,className:"text-muted-foreground"}):e.fileName.endsWith(".csv")?(0,s.jsx)(i.A,{size:16,className:"text-success"}):(0,s.jsx)(d.A,{size:16,className:"text-muted-foreground"})}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-foreground truncate",title:e.fileName,children:e.fileName}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground truncate mt-0.5",title:e.originalPath,children:[t.trash.from,": ",e.originalPath.split("/").slice(0,-1).join("/")||"/"]})]})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,s.jsx)("span",{className:"text-2xs text-muted-foreground",children:t.trash.deletedAgo(function(e,t){let r=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(r<1)return t.justNow??"just now";if(r<60)return t.minutesAgo?.(r)??`${r}m ago`;let s=Math.floor(r/60);if(s<24)return t.hoursAgo?.(s)??`${s}h ago`;let a=Math.floor(s/24);return t.daysAgo?.(a)??`${a}d ago`}(e.deletedAt,t.trash))}),(0,s.jsxs)("span",{className:`text-2xs ${a?"text-error":"text-muted-foreground/60"}`,children:[a&&(0,s.jsx)(l.A,{size:9,className:"inline mr-0.5"}),t.trash.expiresIn(r)]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>L(e),disabled:z===e.id,className:"inline-flex items-center gap-1 px-2 py-1 rounded-md text-xs font-medium bg-success/10 text-success hover:bg-success/20 transition-colors disabled:opacity-50",children:[z===e.id?(0,s.jsx)(c.A,{size:11,className:"animate-spin"}):(0,s.jsx)(u.A,{size:11}),t.trash.restore]}),(0,s.jsx)("button",{type:"button",onClick:()=>M(e),className:"p-1 rounded-md text-muted-foreground hover:text-error hover:bg-error/10 transition-colors",title:t.trash.deletePermanently,children:(0,s.jsx)(m.A,{size:13})})]})]})]},e.id)})})})}),(0,s.jsx)(v.TM,{open:w,title:t.trash.emptyTrash,message:t.trash.emptyTrashConfirm,confirmLabel:t.trash.emptyTrash,cancelLabel:t.trash.cancel??"Cancel",onConfirm:()=>void T(),onCancel:()=>A(!1),variant:"destructive"}),(0,s.jsx)(v.TM,{open:!!C,title:t.trash.deletePermanently,message:C?t.trash.deletePermanentlyConfirm(C.fileName):"",confirmLabel:t.trash.deletePermanently,cancelLabel:t.trash.cancel??"Cancel",onConfirm:()=>void P(),onCancel:()=>M(null),variant:"destructive"}),S&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm",children:(0,s.jsxs)("div",{className:"bg-card border border-border rounded-xl shadow-xl max-w-sm w-full mx-4 p-5",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,s.jsx)(l.A,{size:16,className:"text-[var(--amber)]"}),(0,s.jsx)("h3",{className:"text-sm font-semibold font-display",children:t.trash.restoreConflict})]}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground mb-4",children:['"',S.fileName,'" — ',S.originalPath]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,s.jsx)("button",{type:"button",onClick:()=>R(null),className:"px-3 py-1.5 rounded-md text-xs font-medium text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:t.trash.cancel??"Cancel"}),(0,s.jsx)("button",{type:"button",onClick:()=>void E("copy"),className:"px-3 py-1.5 rounded-md text-xs font-medium bg-muted text-foreground hover:bg-muted/80 transition-colors",children:t.trash.saveAsCopy}),(0,s.jsx)("button",{type:"button",onClick:()=>void E("overwrite"),className:"px-3 py-1.5 rounded-md text-xs font-medium bg-[var(--amber-dim)] text-[var(--amber-text)] hover:opacity-80 transition-colors",children:t.trash.overwrite})]})]})})]})}},51914:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(90425).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},54839:(e,t,r)=>{Promise.resolve().then(r.bind(r,51680))},68459:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(90425).A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},73321:(e,t,r)=>{"use strict";var s=r(74645);r.o(s,"usePathname")&&r.d(t,{usePathname:function(){return s.usePathname}}),r.o(s,"useRouter")&&r.d(t,{useRouter:function(){return s.useRouter}}),r.o(s,"useSearchParams")&&r.d(t,{useSearchParams:function(){return s.useSearchParams}})},90425:(e,t,r)=>{"use strict";r.d(t,{A:()=>d});var s=r(12115);let a=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),n=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var o={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,s.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:d,iconNode:l,...c},u)=>(0,s.createElement)("svg",{ref:u,...o,width:t,height:t,stroke:e,strokeWidth:n?24*Number(r)/Number(t):r,className:a("lucide",i),...!d&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(c)&&{"aria-hidden":"true"},...c},[...l.map(([e,t])=>(0,s.createElement)(e,t)),...Array.isArray(d)?d:[d]])),d=(e,t)=>{let r=(0,s.forwardRef)(({className:r,...o},d)=>(0,s.createElement)(i,{ref:d,iconNode:t,className:a(`lucide-${n(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,r),...o}));return r.displayName=n(e),r}}},e=>{e.O(0,[1053,8441,3794,7358],()=>e(e.s=54839)),_N_E=e.O()}]);
|