@geminilight/mindos 0.6.50 → 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 +16 -16
- 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 +3 -3
- 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 +16 -16
- package/_standalone/.next/server/chunks/{273.js → 1975.js} +2 -2
- package/_standalone/.next/server/chunks/4241.js +28 -28
- package/_standalone/.next/server/next-font-manifest.js +1 -1
- package/_standalone/.next/server/next-font-manifest.json +1 -1
- 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-5b51589d4eedab68.js → layout-4264ca690ad73be1.js} +27 -27
- package/_standalone/.next/static/chunks/app/{page-9ba25963d955f3d4.js → page-00202b22c6db2144.js} +2 -2
- 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/_standalone/.next/static/chunks/app/trash/page-20ee39622ea5047a.js +0 -1
- package/_standalone/.next/static/chunks/app/view/[...path]/page-67c4bf985a579c77.js +0 -12
- /package/_standalone/.next/static/{2qUKZF7S693ZZWFgkTSUY → Oo3NOv4X7Res4OjfuRdIF}/_buildManifest.js +0 -0
- /package/_standalone/.next/static/{2qUKZF7S693ZZWFgkTSUY → 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
|
@@ -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"}]])},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,91143))},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}},91143:(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)("6091887a8aaecc4eb1bd162892fbc7bff446087b56",f.callServer,void 0,f.findSourceMapURL,"restoreFromTrashAction"),p=(0,f.createServerReference)("403c4f9c089cd5fc4dadf175d6388d22c18b7c21bb",f.callServer,void 0,f.findSourceMapURL,"permanentlyDeleteAction"),g=(0,f.createServerReference)("00bcbd3dc575fdd4e4d286631045c0b51612926bbc",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})]})]})})]})}}},e=>{e.O(0,[1053,8441,3794,7358],()=>e(e.s=54839)),_N_E=e.O()}]);
|