app-ai-solution-exp 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/out/main/index.js +157 -54
  2. package/out/preload/index.js +2 -1
  3. package/out/renderer/assets/{cssMode-0REew4-I.js → cssMode-Djbzf0LR.js} +3 -3
  4. package/out/renderer/assets/{freemarker2-DGOHYByW.js → freemarker2-plN48J_D.js} +1 -1
  5. package/out/renderer/assets/{handlebars-BqVGkTnX.js → handlebars-DkGSdJeE.js} +1 -1
  6. package/out/renderer/assets/{html-SBYz9B6Z.js → html-GfH6N1Gv.js} +1 -1
  7. package/out/renderer/assets/{htmlMode-CGiY9fYI.js → htmlMode-rVPkSV1Q.js} +3 -3
  8. package/out/renderer/assets/{index-D1jw-q7W.js → index-BmudFTDL.js} +511 -261
  9. package/out/renderer/assets/{index-BmTOg-UU.css → index-DCXeENj2.css} +92 -4
  10. package/out/renderer/assets/{javascript-C0APGOR5.js → javascript-PIyGYu6r.js} +2 -2
  11. package/out/renderer/assets/{jsonMode-Bp6cgaVL.js → jsonMode-1NERwSWX.js} +3 -3
  12. package/out/renderer/assets/{liquid-Azv9oa6C.js → liquid-DFsQCm0l.js} +1 -1
  13. package/out/renderer/assets/{lspLanguageFeatures-gtRC0h19.js → lspLanguageFeatures-UQJ0l2cB.js} +1 -1
  14. package/out/renderer/assets/{mdx-BFq9ZGPW.js → mdx-pETBiXt-.js} +1 -1
  15. package/out/renderer/assets/{python-Bmt9B2If.js → python-C-ndJWZ6.js} +1 -1
  16. package/out/renderer/assets/{razor-DNyVX9o_.js → razor-ccgYQ7JO.js} +1 -1
  17. package/out/renderer/assets/{tsMode-B-gbMtTM.js → tsMode-P6prXeLi.js} +1 -1
  18. package/out/renderer/assets/{typescript-EOW0R50S.js → typescript-D2Zozwub.js} +1 -1
  19. package/out/renderer/assets/{xml-Dvlj5OXN.js → xml-L2644zxV.js} +1 -1
  20. package/out/renderer/assets/{yaml-CUjhit4r.js → yaml-5rwJYQiz.js} +1 -1
  21. package/out/renderer/index.html +2 -2
  22. package/package.json +1 -1
package/out/main/index.js CHANGED
@@ -89,6 +89,15 @@ function getGlobalClaudeMdPath() {
89
89
  function getClaudeHistoryJsonlPath() {
90
90
  return path.join(getClaudeConfigDir(), "history.jsonl");
91
91
  }
92
+ function getAllProfileDirs() {
93
+ const profilesRoot = path.join(getCmRoot(), "profiles");
94
+ if (!fs.existsSync(profilesRoot)) return [];
95
+ try {
96
+ return fs.readdirSync(profilesRoot, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => path.join(profilesRoot, d.name));
97
+ } catch {
98
+ return [];
99
+ }
100
+ }
92
101
  function isWindows() {
93
102
  return process.platform === "win32";
94
103
  }
@@ -103,31 +112,8 @@ function whereExe(name) {
103
112
  }
104
113
  function getClaudeSpawnConfig() {
105
114
  if (!isWindows()) {
106
- try {
107
- const shell = process.env.SHELL || "/bin/zsh";
108
- const claudePath = child_process.execSync(`${shell} -l -c "which claude"`, {
109
- encoding: "utf8",
110
- timeout: 5e3
111
- }).trim();
112
- if (claudePath && fs.existsSync(claudePath)) {
113
- return { file: claudePath, args: [] };
114
- }
115
- } catch {
116
- }
117
- const home = process.env.HOME || "";
118
- const commonPaths = [
119
- "/usr/local/bin/claude",
120
- "/opt/homebrew/bin/claude",
121
- `${home}/.npm-global/bin/claude`,
122
- `${home}/.nvm/versions/node/current/bin/claude`,
123
- `${home}/.local/bin/claude`
124
- ];
125
- for (const p of commonPaths) {
126
- if (p && fs.existsSync(p)) {
127
- return { file: p, args: [] };
128
- }
129
- }
130
- return { file: "claude", args: [] };
115
+ const shell = process.env.SHELL || "/bin/zsh";
116
+ return { file: shell, args: ["--login", "-i", "-c", "claude"] };
131
117
  }
132
118
  const systemRoot = process.env.SystemRoot ?? "C:\\Windows";
133
119
  const cmdExe = path.join(systemRoot, "System32", "cmd.exe");
@@ -448,30 +434,42 @@ function detectOrphanSessions(profileId) {
448
434
  return orphans;
449
435
  }
450
436
  function listNativeSessions() {
451
- const historyPath = getClaudeHistoryJsonlPath();
452
- if (!fs.existsSync(historyPath)) return [];
453
- let raw;
454
- try {
455
- raw = fs.readFileSync(historyPath, "utf8");
456
- } catch {
457
- return [];
437
+ const historySources = [];
438
+ const globalPath = getClaudeHistoryJsonlPath();
439
+ if (fs.existsSync(globalPath)) historySources.push({ path: globalPath });
440
+ const profilesPrefix = path.join(getCmRoot(), "profiles");
441
+ for (const profileDir of getAllProfileDirs()) {
442
+ const profileHistoryPath = path.join(profileDir, "history.jsonl");
443
+ if (fs.existsSync(profileHistoryPath)) {
444
+ const profileId = path.relative(profilesPrefix, profileDir).split(/[\\/]/)[0];
445
+ historySources.push({ path: profileHistoryPath, profileId });
446
+ }
458
447
  }
448
+ if (historySources.length === 0) return [];
459
449
  const sessionsMap = /* @__PURE__ */ new Map();
460
- for (const line of raw.split("\n").filter((l) => l.trim())) {
450
+ for (const source of historySources) {
451
+ let raw;
461
452
  try {
462
- const obj = JSON.parse(line);
463
- const sessionId = typeof obj.sessionId === "string" ? obj.sessionId : null;
464
- const project = typeof obj.project === "string" ? obj.project : null;
465
- const display = typeof obj.display === "string" ? obj.display : "";
466
- const timestamp = typeof obj.timestamp === "number" ? obj.timestamp : 0;
467
- if (!sessionId || !project) continue;
468
- if (!sessionsMap.has(sessionId)) {
469
- sessionsMap.set(sessionId, { projectPath: project, messages: [] });
470
- }
471
- sessionsMap.get(sessionId).messages.push({ display, timestamp });
453
+ raw = fs.readFileSync(source.path, "utf8");
472
454
  } catch {
473
455
  continue;
474
456
  }
457
+ for (const line of raw.split("\n").filter((l) => l.trim())) {
458
+ try {
459
+ const obj = JSON.parse(line);
460
+ const sessionId = typeof obj.sessionId === "string" ? obj.sessionId : null;
461
+ const project = typeof obj.project === "string" ? obj.project : null;
462
+ const display = typeof obj.display === "string" ? obj.display : "";
463
+ const timestamp = typeof obj.timestamp === "number" ? obj.timestamp : 0;
464
+ if (!sessionId || !project) continue;
465
+ if (!sessionsMap.has(sessionId)) {
466
+ sessionsMap.set(sessionId, { projectPath: project, profileId: source.profileId, messages: [] });
467
+ }
468
+ sessionsMap.get(sessionId).messages.push({ display, timestamp });
469
+ } catch {
470
+ continue;
471
+ }
472
+ }
475
473
  }
476
474
  const result = [];
477
475
  for (const [sessionId, data] of sessionsMap) {
@@ -480,6 +478,7 @@ function listNativeSessions() {
480
478
  const last = sorted[sorted.length - 1];
481
479
  result.push({
482
480
  sessionId,
481
+ profileId: data.profileId,
483
482
  projectPath: data.projectPath,
484
483
  projectName,
485
484
  firstMessage: (sorted[0]?.display ?? "").slice(0, 200),
@@ -488,7 +487,97 @@ function listNativeSessions() {
488
487
  messages: sorted
489
488
  });
490
489
  }
491
- return result.sort((a, b) => b.lastMessageAt.localeCompare(a.lastMessageAt));
490
+ const UTILITY_COMMANDS = [
491
+ "/usage",
492
+ "usage",
493
+ "/status",
494
+ "status",
495
+ "/cost",
496
+ "cost",
497
+ "/agents",
498
+ "agents",
499
+ "/rate-limit-options",
500
+ "/clear",
501
+ "clear"
502
+ ];
503
+ const utilitySessionIds = /* @__PURE__ */ new Set();
504
+ const filtered = result.filter((s) => {
505
+ if (s.messageCount <= 3) {
506
+ const allUtility = s.messages.every((m) => {
507
+ const text = m.display.trim().toLowerCase();
508
+ return !text || UTILITY_COMMANDS.some((cmd) => text === cmd || text.startsWith(cmd + " "));
509
+ });
510
+ if (allUtility) {
511
+ utilitySessionIds.add(s.sessionId);
512
+ return false;
513
+ }
514
+ }
515
+ return true;
516
+ });
517
+ if (utilitySessionIds.size > 0) {
518
+ cleanupUtilitySessions(utilitySessionIds);
519
+ }
520
+ return filtered.sort((a, b) => b.lastMessageAt.localeCompare(a.lastMessageAt));
521
+ }
522
+ function deleteNativeSession(sessionId) {
523
+ try {
524
+ cleanupUtilitySessions(/* @__PURE__ */ new Set([sessionId]));
525
+ return true;
526
+ } catch {
527
+ return false;
528
+ }
529
+ }
530
+ function cleanupUtilitySessions(sessionIds) {
531
+ const projectsDirs = [];
532
+ const globalProjects = path.join(getClaudeConfigDir(), "projects");
533
+ if (fs.existsSync(globalProjects)) projectsDirs.push(globalProjects);
534
+ for (const profileDir of getAllProfileDirs()) {
535
+ const p = path.join(profileDir, "projects");
536
+ if (fs.existsSync(p)) projectsDirs.push(p);
537
+ }
538
+ for (const projectsDir of projectsDirs) {
539
+ try {
540
+ for (const proj of fs.readdirSync(projectsDir)) {
541
+ const projPath = path.join(projectsDir, proj);
542
+ if (!fs.statSync(projPath).isDirectory()) continue;
543
+ for (const sid of sessionIds) {
544
+ const jsonlFile = path.join(projPath, `${sid}.jsonl`);
545
+ try {
546
+ if (fs.existsSync(jsonlFile)) fs.unlinkSync(jsonlFile);
547
+ } catch {
548
+ }
549
+ }
550
+ }
551
+ } catch {
552
+ }
553
+ }
554
+ const historyFiles = [];
555
+ const globalHistory = getClaudeHistoryJsonlPath();
556
+ if (fs.existsSync(globalHistory)) historyFiles.push(globalHistory);
557
+ for (const profileDir of getAllProfileDirs()) {
558
+ const h = path.join(profileDir, "history.jsonl");
559
+ if (fs.existsSync(h)) historyFiles.push(h);
560
+ }
561
+ for (const historyFile of historyFiles) {
562
+ try {
563
+ const raw = fs.readFileSync(historyFile, "utf8");
564
+ const lines = raw.split("\n");
565
+ const cleaned = lines.filter((line) => {
566
+ if (!line.trim()) return true;
567
+ try {
568
+ const obj = JSON.parse(line);
569
+ const sid = typeof obj.sessionId === "string" ? obj.sessionId : null;
570
+ return !sid || !sessionIds.has(sid);
571
+ } catch {
572
+ return true;
573
+ }
574
+ });
575
+ if (cleaned.length < lines.length) {
576
+ fs.writeFileSync(historyFile, cleaned.join("\n"), "utf8");
577
+ }
578
+ } catch {
579
+ }
580
+ }
492
581
  }
493
582
  function formatToolAction(tool) {
494
583
  const name = typeof tool.name === "string" ? tool.name : "";
@@ -558,19 +647,28 @@ function emptyStats() {
558
647
  };
559
648
  }
560
649
  function readNativeSessionConversation(sessionId) {
561
- const projectsDir = path.join(getClaudeConfigDir(), "projects");
562
- if (!fs.existsSync(projectsDir)) return { messages: [], stats: emptyStats() };
650
+ const projectsDirs = [];
651
+ const globalProjects = path.join(getClaudeConfigDir(), "projects");
652
+ if (fs.existsSync(globalProjects)) projectsDirs.push(globalProjects);
653
+ for (const profileDir of getAllProfileDirs()) {
654
+ const profileProjects = path.join(profileDir, "projects");
655
+ if (fs.existsSync(profileProjects)) projectsDirs.push(profileProjects);
656
+ }
657
+ if (projectsDirs.length === 0) return { messages: [], stats: emptyStats() };
563
658
  let jsonlPath = null;
564
- try {
565
- for (const proj of fs.readdirSync(projectsDir)) {
566
- const candidate = path.join(projectsDir, proj, `${sessionId}.jsonl`);
567
- if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {
568
- jsonlPath = candidate;
569
- break;
659
+ for (const projectsDir of projectsDirs) {
660
+ try {
661
+ for (const proj of fs.readdirSync(projectsDir)) {
662
+ const candidate = path.join(projectsDir, proj, `${sessionId}.jsonl`);
663
+ if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {
664
+ jsonlPath = candidate;
665
+ break;
666
+ }
570
667
  }
668
+ } catch {
669
+ continue;
571
670
  }
572
- } catch {
573
- return { messages: [], stats: emptyStats() };
671
+ if (jsonlPath) break;
574
672
  }
575
673
  if (!jsonlPath) return { messages: [], stats: emptyStats() };
576
674
  let raw;
@@ -885,6 +983,7 @@ function formatResetLabel(raw) {
885
983
  return raw;
886
984
  }
887
985
  function preTrustHomeDir(profileDir) {
986
+ fs.mkdirSync(profileDir, { recursive: true });
888
987
  const claudeJsonPath = path.join(profileDir, ".claude.json");
889
988
  const homeDir = os.homedir().replace(/\\/g, "/");
890
989
  try {
@@ -1637,6 +1736,10 @@ function registerHistoryHandlers() {
1637
1736
  if (typeof sessionId !== "string" || !sessionId.trim()) return [];
1638
1737
  return readNativeSessionConversation(sessionId);
1639
1738
  });
1739
+ electron.ipcMain.handle("history:deleteNativeSession", (_event, sessionId) => {
1740
+ if (typeof sessionId !== "string" || !sessionId.trim()) return false;
1741
+ return deleteNativeSession(sessionId);
1742
+ });
1640
1743
  }
1641
1744
  function registerSummaryHandlers() {
1642
1745
  electron.ipcMain.handle("summary:generate", async (_event, payload) => {
@@ -63,7 +63,8 @@ const electronAPI = {
63
63
  detectOrphan: (profileId) => electron.ipcRenderer.invoke("history:detectOrphan", profileId),
64
64
  readOrphanContent: (jsonlPath) => electron.ipcRenderer.invoke("history:readOrphanContent", jsonlPath),
65
65
  listNativeSessions: () => electron.ipcRenderer.invoke("history:listNativeSessions"),
66
- readNativeSessionConversation: (sessionId) => electron.ipcRenderer.invoke("history:readNativeSessionConversation", sessionId)
66
+ readNativeSessionConversation: (sessionId) => electron.ipcRenderer.invoke("history:readNativeSessionConversation", sessionId),
67
+ deleteNativeSession: (sessionId) => electron.ipcRenderer.invoke("history:deleteNativeSession", sessionId)
67
68
  },
68
69
  // Summary — Sprint 4: geração de resumo via claude --print
69
70
  summary: {
@@ -1,6 +1,6 @@
1
- import { c as createWebWorker, l as languages } from "./index-D1jw-q7W.js";
2
- import { C as CompletionAdapter, H as HoverAdapter, D as DocumentHighlightAdapter, a as DefinitionAdapter, R as ReferenceAdapter, b as DocumentSymbolAdapter, c as RenameAdapter, d as DocumentColorAdapter, F as FoldingRangeAdapter, e as DiagnosticsAdapter, S as SelectionRangeAdapter, f as DocumentFormattingEditProvider, g as DocumentRangeFormattingEditProvider } from "./lspLanguageFeatures-gtRC0h19.js";
3
- import { h, i, j, t, k } from "./lspLanguageFeatures-gtRC0h19.js";
1
+ import { c as createWebWorker, l as languages } from "./index-BmudFTDL.js";
2
+ import { C as CompletionAdapter, H as HoverAdapter, D as DocumentHighlightAdapter, a as DefinitionAdapter, R as ReferenceAdapter, b as DocumentSymbolAdapter, c as RenameAdapter, d as DocumentColorAdapter, F as FoldingRangeAdapter, e as DiagnosticsAdapter, S as SelectionRangeAdapter, f as DocumentFormattingEditProvider, g as DocumentRangeFormattingEditProvider } from "./lspLanguageFeatures-UQJ0l2cB.js";
3
+ import { h, i, j, t, k } from "./lspLanguageFeatures-UQJ0l2cB.js";
4
4
  const STOP_WHEN_IDLE_FOR = 2 * 60 * 1e3;
5
5
  class WorkerManager {
6
6
  constructor(defaults) {
@@ -1,4 +1,4 @@
1
- import { l as languages } from "./index-D1jw-q7W.js";
1
+ import { l as languages } from "./index-BmudFTDL.js";
2
2
  const EMPTY_ELEMENTS = [
3
3
  "assign",
4
4
  "flush",
@@ -1,4 +1,4 @@
1
- import { l as languages } from "./index-D1jw-q7W.js";
1
+ import { l as languages } from "./index-BmudFTDL.js";
2
2
  const EMPTY_ELEMENTS = [
3
3
  "area",
4
4
  "base",
@@ -1,4 +1,4 @@
1
- import { l as languages } from "./index-D1jw-q7W.js";
1
+ import { l as languages } from "./index-BmudFTDL.js";
2
2
  const EMPTY_ELEMENTS = [
3
3
  "area",
4
4
  "base",
@@ -1,6 +1,6 @@
1
- import { c as createWebWorker, l as languages } from "./index-D1jw-q7W.js";
2
- import { H as HoverAdapter, D as DocumentHighlightAdapter, h as DocumentLinkAdapter, F as FoldingRangeAdapter, b as DocumentSymbolAdapter, S as SelectionRangeAdapter, c as RenameAdapter, f as DocumentFormattingEditProvider, g as DocumentRangeFormattingEditProvider, C as CompletionAdapter } from "./lspLanguageFeatures-gtRC0h19.js";
3
- import { a, e, d, R, i, j, t, k } from "./lspLanguageFeatures-gtRC0h19.js";
1
+ import { c as createWebWorker, l as languages } from "./index-BmudFTDL.js";
2
+ import { H as HoverAdapter, D as DocumentHighlightAdapter, h as DocumentLinkAdapter, F as FoldingRangeAdapter, b as DocumentSymbolAdapter, S as SelectionRangeAdapter, c as RenameAdapter, f as DocumentFormattingEditProvider, g as DocumentRangeFormattingEditProvider, C as CompletionAdapter } from "./lspLanguageFeatures-UQJ0l2cB.js";
3
+ import { a, e, d, R, i, j, t, k } from "./lspLanguageFeatures-UQJ0l2cB.js";
4
4
  const STOP_WHEN_IDLE_FOR = 2 * 60 * 1e3;
5
5
  class WorkerManager {
6
6
  constructor(defaults) {