codesesh 0.19.0 → 1.0.0

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 (66) hide show
  1. package/README.md +2 -1
  2. package/dist/{chunk-G2BTNW3C.js → chunk-BEF6LLRG.js} +1230 -182
  3. package/dist/chunk-BEF6LLRG.js.map +1 -0
  4. package/dist/{chunk-KD3DGWZY.js → chunk-TIHF4T3K.js} +2 -2
  5. package/dist/{dist-ALXOBKV2.js → dist-3F467V44.js} +4 -2
  6. package/dist/index.js +53 -12
  7. package/dist/index.js.map +1 -1
  8. package/dist/scan-refresh-worker.js +2 -2
  9. package/dist/search-index-worker.js +9 -11
  10. package/dist/search-index-worker.js.map +1 -1
  11. package/dist/smart-tag-worker.js +2 -2
  12. package/dist/web/assets/ErrorBoundary-BY-N1QzJ.js +1 -0
  13. package/dist/web/assets/InteractiveReceipt-DYGyHeZd.js +1 -0
  14. package/dist/web/assets/OverviewScreen-_ZaVjhxN.js +1 -0
  15. package/dist/web/assets/PrismHighlighter-BZkkX0AU.js +6 -0
  16. package/dist/web/assets/Projects-q6cEm2dc.js +1 -0
  17. package/dist/web/assets/SearchFilterBar-CrVBpo40.js +1 -0
  18. package/dist/web/assets/SearchResultsPanel-Cg5V8Ia6.js +1 -0
  19. package/dist/web/assets/SessionDetail-BSSuddsZ.js +54 -0
  20. package/dist/web/assets/{session-title-CNhapdPJ.js → SmartTagChips-ux6idUGJ.js} +1 -1
  21. package/dist/web/assets/chunk-62JRHF6Z-BWRsEBnL.js +4 -0
  22. package/dist/web/assets/code-metrics-UYFsCC7E.js +1 -0
  23. package/dist/web/assets/ibm-plex-sans-cyrillic-ext-wght-normal-d45eAU9y.woff2 +0 -0
  24. package/dist/web/assets/ibm-plex-sans-cyrillic-wght-normal-BAAhND-U.woff2 +0 -0
  25. package/dist/web/assets/ibm-plex-sans-greek-wght-normal-CmyJS8uq.woff2 +0 -0
  26. package/dist/web/assets/ibm-plex-sans-latin-ext-wght-normal-CIII54If.woff2 +0 -0
  27. package/dist/web/assets/ibm-plex-sans-latin-wght-normal-IvpUvPa2.woff2 +0 -0
  28. package/dist/web/assets/ibm-plex-sans-vietnamese-wght-normal-Dg1JeJN0.woff2 +0 -0
  29. package/dist/web/assets/index-C3KgxGwE.js +1410 -0
  30. package/dist/web/assets/index-DQX42cFQ.css +1 -0
  31. package/dist/web/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  32. package/dist/web/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  33. package/dist/web/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  34. package/dist/web/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  35. package/dist/web/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  36. package/dist/web/assets/jsx-runtime-B-hcVAMW.js +1 -0
  37. package/dist/web/assets/panel-B7kuE60V.js +1 -0
  38. package/dist/web/assets/session-indexes-DmnjZ_JL.js +1 -0
  39. package/dist/web/assets/session-title-DdtlxtlR.js +1 -0
  40. package/dist/web/assets/space-grotesk-latin-ext-wght-normal-D9tNdqV9.woff2 +0 -0
  41. package/dist/web/assets/space-grotesk-latin-wght-normal-BhU9QXUp.woff2 +0 -0
  42. package/dist/web/assets/space-grotesk-vietnamese-wght-normal-D0rl6rjA.woff2 +0 -0
  43. package/dist/web/assets/utils-t2u9IbNT.js +1 -0
  44. package/dist/web/icon/agent/grok.svg +1 -0
  45. package/dist/web/index.html +43 -30
  46. package/package.json +8 -8
  47. package/dist/chunk-G2BTNW3C.js.map +0 -1
  48. package/dist/web/assets/AgentIcon-CEj7HO1m.js +0 -1
  49. package/dist/web/assets/BookmarkButton-DLEnIyeE.js +0 -1
  50. package/dist/web/assets/Dashboard-DUG0IFcy.js +0 -39
  51. package/dist/web/assets/DialogTitle-Dv6DQPIb.js +0 -1
  52. package/dist/web/assets/InteractiveReceipt-xnRqJvfd.js +0 -1
  53. package/dist/web/assets/PrismHighlighter-C7OfXHq2.js +0 -6
  54. package/dist/web/assets/Projects-BMaZc6J5.js +0 -1
  55. package/dist/web/assets/SearchFilterBar-iP6pzlZo.js +0 -1
  56. package/dist/web/assets/SearchResultsPanel-RuiLPkbP.js +0 -1
  57. package/dist/web/assets/SessionDetail-De1Wl3mu.js +0 -54
  58. package/dist/web/assets/index-B-CV7pFu.css +0 -2
  59. package/dist/web/assets/index-CQI8F_8X.js +0 -1930
  60. package/dist/web/assets/index.dom-CCLJ9_FR.js +0 -1
  61. package/dist/web/assets/jsx-runtime-n5LQ9ujS.js +0 -1
  62. package/dist/web/assets/session-indexes-BuxBafvh.js +0 -4
  63. package/dist/web/assets/useTheme-CwDcVdGz.js +0 -1
  64. package/dist/web/assets/utils-B6KiDbIe.js +0 -1
  65. /package/dist/{chunk-KD3DGWZY.js.map → chunk-TIHF4T3K.js.map} +0 -0
  66. /package/dist/{dist-ALXOBKV2.js.map → dist-3F467V44.js.map} +0 -0
@@ -4,7 +4,7 @@ import {
4
4
  restrictExistingPrivateFiles,
5
5
  restrictPrivateFile,
6
6
  setCoreDiagnostics
7
- } from "./chunk-G2BTNW3C.js";
7
+ } from "./chunk-BEF6LLRG.js";
8
8
 
9
9
  // src/logging.ts
10
10
  import { appendFileSync, existsSync, readdirSync, renameSync, statSync, unlinkSync } from "fs";
@@ -174,4 +174,4 @@ export {
174
174
  appLogger,
175
175
  logSearchIndexSync
176
176
  };
177
- //# sourceMappingURL=chunk-KD3DGWZY.js.map
177
+ //# sourceMappingURL=chunk-TIHF4T3K.js.map
@@ -38,6 +38,7 @@ import {
38
38
  listBookmarks,
39
39
  listCachedProjectGroups,
40
40
  listFileActivity,
41
+ listModelCostDistribution,
41
42
  listSessionAliases,
42
43
  loadCachedSessions,
43
44
  markAgentCacheInitialized,
@@ -65,7 +66,7 @@ import {
65
66
  syncSessionSearchIndexChanges,
66
67
  upsertBookmark,
67
68
  upsertSessionAlias
68
- } from "./chunk-G2BTNW3C.js";
69
+ } from "./chunk-BEF6LLRG.js";
69
70
  export {
70
71
  BaseAgent,
71
72
  StateStorageUnavailableError as BookmarkStorageUnavailableError,
@@ -106,6 +107,7 @@ export {
106
107
  listBookmarks,
107
108
  listCachedProjectGroups,
108
109
  listFileActivity,
110
+ listModelCostDistribution,
109
111
  listSessionAliases,
110
112
  loadCachedSessions,
111
113
  markAgentCacheInitialized,
@@ -134,4 +136,4 @@ export {
134
136
  upsertBookmark,
135
137
  upsertSessionAlias
136
138
  };
137
- //# sourceMappingURL=dist-ALXOBKV2.js.map
139
+ //# sourceMappingURL=dist-3F467V44.js.map
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  appLogger,
4
4
  logSearchIndexSync
5
- } from "./chunk-KD3DGWZY.js";
5
+ } from "./chunk-TIHF4T3K.js";
6
6
  import {
7
7
  FileSystemSessionSource,
8
8
  SessionAliasValidationError,
@@ -27,12 +27,14 @@ import {
27
27
  getAgentLastFullSyncAt,
28
28
  getSessionActivityTime,
29
29
  getSessionAgentKey,
30
+ getSessionRouteKey,
30
31
  importBookmarks,
31
32
  isAgentCacheInitialized,
32
33
  isProjectIdentityKind,
33
34
  listBookmarks,
34
35
  listCachedProjectGroups,
35
36
  listFileActivity,
37
+ listModelCostDistribution,
36
38
  listSessionAliases,
37
39
  loadCachedSessions,
38
40
  markAgentCacheInitialized,
@@ -58,7 +60,7 @@ import {
58
60
  startOfCalendarDay,
59
61
  upsertBookmark,
60
62
  upsertSessionAlias
61
- } from "./chunk-G2BTNW3C.js";
63
+ } from "./chunk-BEF6LLRG.js";
62
64
 
63
65
  // src/index.ts
64
66
  import { defineCommand, runMain } from "citty";
@@ -539,6 +541,23 @@ function handleGetSessions(c, scanSource, defaults = {}) {
539
541
  )
540
542
  });
541
543
  }
544
+ function withParentContext(results, sessions, aliases) {
545
+ if (!results.some((result) => result.session.parent_reference)) return results;
546
+ const byRouteKey = new Map(
547
+ sessions.map((session) => [
548
+ getSessionRouteKey(getSessionAgentKey(session), session.id),
549
+ session
550
+ ])
551
+ );
552
+ return results.map((result) => {
553
+ const parentReference = result.session.parent_reference;
554
+ if (!parentReference) return result;
555
+ const parent = byRouteKey.get(formatSessionReference(parentReference));
556
+ if (!parent) return result;
557
+ const reference = normalizeSessionReference(parentReference);
558
+ return { ...result, parent: { reference, title: aliases.get(reference) ?? parent.title } };
559
+ });
560
+ }
542
561
  function handleSearchSessions(c, scanSource, defaults = {}) {
543
562
  const query = c.req.query("q")?.trim() ?? "";
544
563
  const scanResult = scanSource.getSnapshot();
@@ -560,7 +579,13 @@ function handleSearchSessions(c, scanSource, defaults = {}) {
560
579
  for (const result of [...aliasResults, ...results]) {
561
580
  deduped.set(`${result.reference.agentName}\0${result.reference.sessionId}`, result);
562
581
  }
563
- return c.json({ results: [...deduped.values()].slice(0, searchOptions.limit ?? 50) });
582
+ return c.json({
583
+ results: withParentContext(
584
+ [...deduped.values()].slice(0, searchOptions.limit ?? 50),
585
+ scanResult.sessions,
586
+ aliases
587
+ )
588
+ });
564
589
  }
565
590
  function handleGetFileActivity(c, defaults = {}) {
566
591
  const limitValue = Number(c.req.query("limit"));
@@ -762,6 +787,7 @@ function handleGetDashboard(c, scanSource, defaults = {}) {
762
787
  projectKind: projectIdentity?.kind,
763
788
  projectKey: projectIdentity?.key
764
789
  };
790
+ const compare = from == null ? void 0 : { from: addCalendarDays(from, -(days ?? countCalendarDays(from, to))), to: from - 1 };
765
791
  const fixedTo = parseDateParam(c.req.query("to"), defaults.to);
766
792
  const aggregate = getSnapshotAggregation(
767
793
  scanSource,
@@ -772,7 +798,9 @@ function handleGetDashboard(c, scanSource, defaults = {}) {
772
798
  scope.projectKind,
773
799
  scope.projectKey,
774
800
  from,
775
- fixedTo ?? startOfCalendarDay(to)
801
+ fixedTo ?? startOfCalendarDay(to),
802
+ compare?.from,
803
+ compare?.to
776
804
  ],
777
805
  () => {
778
806
  const agentInfo = getAgentInfoMap({});
@@ -782,7 +810,8 @@ function handleGetDashboard(c, scanSource, defaults = {}) {
782
810
  scope,
783
811
  from,
784
812
  to,
785
- agentInfoMap
813
+ agentInfoMap,
814
+ compare
786
815
  });
787
816
  }
788
817
  );
@@ -796,7 +825,14 @@ function handleGetDashboard(c, scanSource, defaults = {}) {
796
825
  to,
797
826
  limit: 12
798
827
  }),
799
- window: { from, to, days }
828
+ modelCost: listModelCostDistribution({
829
+ agent: scope.agent,
830
+ projectKind: scope.projectKind,
831
+ projectKey: scope.projectKey,
832
+ from,
833
+ to
834
+ }),
835
+ window: { from, to, days, compareFrom: compare?.from, compareTo: compare?.to }
800
836
  };
801
837
  const aliases = loadAliasView();
802
838
  return c.json({
@@ -1383,6 +1419,11 @@ import { existsSync as existsSync2 } from "fs";
1383
1419
  import { fileURLToPath as fileURLToPath2 } from "url";
1384
1420
  import { Worker } from "worker_threads";
1385
1421
 
1422
+ // src/errors.ts
1423
+ function toError(value) {
1424
+ return value instanceof Error ? value : new Error(String(value));
1425
+ }
1426
+
1386
1427
  // src/pending-search-index-jobs.ts
1387
1428
  var PendingSearchIndexJobBatch = class {
1388
1429
  constructor(id, context, jobs, waiter) {
@@ -1638,7 +1679,7 @@ var SearchIndexJobRunner = class {
1638
1679
  });
1639
1680
  worker.on("error", (error) => {
1640
1681
  appLogger.error("search_index.worker_error", { context: batch.context, error });
1641
- this.settle(batch, error);
1682
+ this.settle(batch, toError(error));
1642
1683
  });
1643
1684
  worker.on("exit", (code) => this.finishWorker(worker, batch, code));
1644
1685
  }
@@ -2913,7 +2954,7 @@ var ThreadWorkerRunner = class {
2913
2954
  try {
2914
2955
  slot = this.createWorker(agentName, request);
2915
2956
  } catch (error) {
2916
- reject(error instanceof Error ? error : new Error(String(error)));
2957
+ reject(toError(error));
2917
2958
  return;
2918
2959
  }
2919
2960
  }
@@ -2929,7 +2970,7 @@ var ThreadWorkerRunner = class {
2929
2970
  slot.worker.postMessage(request);
2930
2971
  } catch (error) {
2931
2972
  slot.pending.delete(request.requestId);
2932
- reject(error instanceof Error ? error : new Error(String(error)));
2973
+ reject(toError(error));
2933
2974
  }
2934
2975
  }
2935
2976
  });
@@ -2955,7 +2996,7 @@ var ThreadWorkerRunner = class {
2955
2996
  this.handleMessage(slot, message);
2956
2997
  });
2957
2998
  worker.on("error", (error) => {
2958
- this.closeWorker(agentName, slot, error);
2999
+ this.closeWorker(agentName, slot, toError(error));
2959
3000
  });
2960
3001
  worker.on("exit", (code) => {
2961
3002
  if (slot.closed) return;
@@ -2997,7 +3038,7 @@ var ThreadWorkerRunner = class {
2997
3038
  changedIds: pending.payload.sourceSync ? replacedSessionIds : void 0
2998
3039
  });
2999
3040
  } catch (error) {
3000
- pending.reject(error instanceof Error ? error : new Error(String(error)));
3041
+ pending.reject(toError(error));
3001
3042
  }
3002
3043
  }
3003
3044
  closeWorker(agentName, slot, error) {
@@ -3418,7 +3459,7 @@ var main = defineCommand({
3418
3459
  log_path: appLogger.getLogPath()
3419
3460
  });
3420
3461
  if (clearCache) {
3421
- const { clearCache: clear } = await import("./dist-ALXOBKV2.js");
3462
+ const { clearCache: clear } = await import("./dist-3F467V44.js");
3422
3463
  clear();
3423
3464
  appLogger.info("cache.clear");
3424
3465
  console.log("Cache cleared.");