app-ai-solution-exp 0.1.7 → 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 +155 -29
  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
  }
@@ -425,30 +434,42 @@ function detectOrphanSessions(profileId) {
425
434
  return orphans;
426
435
  }
427
436
  function listNativeSessions() {
428
- const historyPath = getClaudeHistoryJsonlPath();
429
- if (!fs.existsSync(historyPath)) return [];
430
- let raw;
431
- try {
432
- raw = fs.readFileSync(historyPath, "utf8");
433
- } catch {
434
- 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
+ }
435
447
  }
448
+ if (historySources.length === 0) return [];
436
449
  const sessionsMap = /* @__PURE__ */ new Map();
437
- for (const line of raw.split("\n").filter((l) => l.trim())) {
450
+ for (const source of historySources) {
451
+ let raw;
438
452
  try {
439
- const obj = JSON.parse(line);
440
- const sessionId = typeof obj.sessionId === "string" ? obj.sessionId : null;
441
- const project = typeof obj.project === "string" ? obj.project : null;
442
- const display = typeof obj.display === "string" ? obj.display : "";
443
- const timestamp = typeof obj.timestamp === "number" ? obj.timestamp : 0;
444
- if (!sessionId || !project) continue;
445
- if (!sessionsMap.has(sessionId)) {
446
- sessionsMap.set(sessionId, { projectPath: project, messages: [] });
447
- }
448
- sessionsMap.get(sessionId).messages.push({ display, timestamp });
453
+ raw = fs.readFileSync(source.path, "utf8");
449
454
  } catch {
450
455
  continue;
451
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
+ }
452
473
  }
453
474
  const result = [];
454
475
  for (const [sessionId, data] of sessionsMap) {
@@ -457,6 +478,7 @@ function listNativeSessions() {
457
478
  const last = sorted[sorted.length - 1];
458
479
  result.push({
459
480
  sessionId,
481
+ profileId: data.profileId,
460
482
  projectPath: data.projectPath,
461
483
  projectName,
462
484
  firstMessage: (sorted[0]?.display ?? "").slice(0, 200),
@@ -465,7 +487,97 @@ function listNativeSessions() {
465
487
  messages: sorted
466
488
  });
467
489
  }
468
- 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
+ }
469
581
  }
470
582
  function formatToolAction(tool) {
471
583
  const name = typeof tool.name === "string" ? tool.name : "";
@@ -535,19 +647,28 @@ function emptyStats() {
535
647
  };
536
648
  }
537
649
  function readNativeSessionConversation(sessionId) {
538
- const projectsDir = path.join(getClaudeConfigDir(), "projects");
539
- 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() };
540
658
  let jsonlPath = null;
541
- try {
542
- for (const proj of fs.readdirSync(projectsDir)) {
543
- const candidate = path.join(projectsDir, proj, `${sessionId}.jsonl`);
544
- if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {
545
- jsonlPath = candidate;
546
- 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
+ }
547
667
  }
668
+ } catch {
669
+ continue;
548
670
  }
549
- } catch {
550
- return { messages: [], stats: emptyStats() };
671
+ if (jsonlPath) break;
551
672
  }
552
673
  if (!jsonlPath) return { messages: [], stats: emptyStats() };
553
674
  let raw;
@@ -862,6 +983,7 @@ function formatResetLabel(raw) {
862
983
  return raw;
863
984
  }
864
985
  function preTrustHomeDir(profileDir) {
986
+ fs.mkdirSync(profileDir, { recursive: true });
865
987
  const claudeJsonPath = path.join(profileDir, ".claude.json");
866
988
  const homeDir = os.homedir().replace(/\\/g, "/");
867
989
  try {
@@ -1614,6 +1736,10 @@ function registerHistoryHandlers() {
1614
1736
  if (typeof sessionId !== "string" || !sessionId.trim()) return [];
1615
1737
  return readNativeSessionConversation(sessionId);
1616
1738
  });
1739
+ electron.ipcMain.handle("history:deleteNativeSession", (_event, sessionId) => {
1740
+ if (typeof sessionId !== "string" || !sessionId.trim()) return false;
1741
+ return deleteNativeSession(sessionId);
1742
+ });
1617
1743
  }
1618
1744
  function registerSummaryHandlers() {
1619
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) {