codesesh 1.0.6 → 1.0.7

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 (44) hide show
  1. package/dist/{chunk-4QFNZCBR.js → chunk-DE6UJMOY.js} +2 -2
  2. package/dist/{chunk-COZSWVCH.js → chunk-EYZ73CYP.js} +2 -2
  3. package/dist/{chunk-4ND6AT6W.js → chunk-QHWSZFRM.js} +3 -3
  4. package/dist/chunk-QHWSZFRM.js.map +1 -0
  5. package/dist/{chunk-L3DDWTYV.js → chunk-SII3M66U.js} +7 -5
  6. package/dist/chunk-SII3M66U.js.map +1 -0
  7. package/dist/{chunk-XQDYKKRC.js → chunk-VVCSQU5B.js} +98 -14
  8. package/dist/chunk-VVCSQU5B.js.map +1 -0
  9. package/dist/{chunk-A3MT6L6Z.js → chunk-WIWK7BXS.js} +2 -2
  10. package/dist/{chunk-YZ6XCSVQ.js → chunk-YEQTRALH.js} +2 -2
  11. package/dist/{discovery-ADSQARBV.js → discovery-4WAEYSTR.js} +7 -5
  12. package/dist/index.js +40 -14
  13. package/dist/index.js.map +1 -1
  14. package/dist/project-identity-worker.js +4 -4
  15. package/dist/scan-refresh-worker.js +6 -6
  16. package/dist/search-index-worker.js +6 -6
  17. package/dist/session-detail-worker.js +6 -6
  18. package/dist/smart-tag-worker.js +3 -3
  19. package/dist/web/assets/{CustomTimeWindowDialog-D2bx7uDv.js → CustomTimeWindowDialog-CVURkiVO.js} +1 -1
  20. package/dist/web/assets/{InteractiveReceipt-BFpIdno8.js → InteractiveReceipt-DGC-xV7U.js} +1 -1
  21. package/dist/web/assets/{OverviewScreen-D_KXfiJi.js → OverviewScreen-DoXrZ5qp.js} +1 -1
  22. package/dist/web/assets/{PrismHighlighter-BgVkYu_S.js → PrismHighlighter-02695Lmx.js} +1 -1
  23. package/dist/web/assets/{Projects-CN44UpuR.js → Projects-DZiYh6hp.js} +1 -1
  24. package/dist/web/assets/{SearchResultsPanel-CWD01v-a.js → SearchResultsPanel-CAQe8Di0.js} +1 -1
  25. package/dist/web/assets/{SessionDetail-D8taQ6Tl.js → SessionDetail-Da8EBygt.js} +4 -4
  26. package/dist/web/assets/api-ToidoNW6.js +1 -0
  27. package/dist/web/assets/{index-XpolWMY4.js → index-Bl8pbRFj.js} +68 -68
  28. package/dist/web/assets/index-CRI1m3xN.css +1 -0
  29. package/dist/web/assets/{session-indexes-fib48ZKn.js → session-indexes-D5gps7K8.js} +1 -1
  30. package/dist/web/assets/translate-BDFu3ZiK.js +2 -0
  31. package/dist/web/assets/{utils-Bk66u8b3.js → utils-BIZi2up3.js} +1 -1
  32. package/dist/web/index.html +7 -7
  33. package/package.json +1 -1
  34. package/dist/chunk-4ND6AT6W.js.map +0 -1
  35. package/dist/chunk-L3DDWTYV.js.map +0 -1
  36. package/dist/chunk-XQDYKKRC.js.map +0 -1
  37. package/dist/web/assets/api-B9lJtVbO.js +0 -1
  38. package/dist/web/assets/index-xbEEMszv.css +0 -1
  39. package/dist/web/assets/translate-Dmym1ZDl.js +0 -2
  40. /package/dist/{chunk-4QFNZCBR.js.map → chunk-DE6UJMOY.js.map} +0 -0
  41. /package/dist/{chunk-COZSWVCH.js.map → chunk-EYZ73CYP.js.map} +0 -0
  42. /package/dist/{chunk-A3MT6L6Z.js.map → chunk-WIWK7BXS.js.map} +0 -0
  43. /package/dist/{chunk-YZ6XCSVQ.js.map → chunk-YEQTRALH.js.map} +0 -0
  44. /package/dist/{discovery-ADSQARBV.js.map → discovery-4WAEYSTR.js.map} +0 -0
@@ -8,7 +8,7 @@ import {
8
8
  getSessionAgentKey,
9
9
  getSessionReferenceKey,
10
10
  toCalendarDayKey
11
- } from "./chunk-4ND6AT6W.js";
11
+ } from "./chunk-QHWSZFRM.js";
12
12
 
13
13
  // ../core/dist/chunk-FILZDGK6.mjs
14
14
  var COST_ABSOLUTE_TOLERANCE = 1e-8;
@@ -667,4 +667,4 @@ export {
667
667
  summarizeProjects,
668
668
  attachProjectMetricsFromTree
669
669
  };
670
- //# sourceMappingURL=chunk-A3MT6L6Z.js.map
670
+ //# sourceMappingURL=chunk-WIWK7BXS.js.map
@@ -4,7 +4,7 @@ import {
4
4
  getProjectIdentityKey,
5
5
  getSessionAgentKey,
6
6
  matchesProjectIdentity
7
- } from "./chunk-4ND6AT6W.js";
7
+ } from "./chunk-QHWSZFRM.js";
8
8
 
9
9
  // ../core/dist/chunk-2AZEUUPW.mjs
10
10
  import * as os from "os";
@@ -324,4 +324,4 @@ export {
324
324
  normalizeProjectScopePath,
325
325
  buildProjectGroups
326
326
  };
327
- //# sourceMappingURL=chunk-YZ6XCSVQ.js.map
327
+ //# sourceMappingURL=chunk-YEQTRALH.js.map
@@ -18,6 +18,7 @@ import {
18
18
  inheritSessionTags,
19
19
  inspectAgentRefresh,
20
20
  listCachedProjectGroups,
21
+ listDashboardActiveHours,
21
22
  listDashboardCostFacts,
22
23
  listFileActivity,
23
24
  listModelCostDistribution,
@@ -45,15 +46,15 @@ import {
45
46
  sortSessions,
46
47
  syncSessionSearchIndex,
47
48
  syncSessionSearchIndexChanges
48
- } from "./chunk-XQDYKKRC.js";
49
- import "./chunk-YZ6XCSVQ.js";
50
- import "./chunk-L3DDWTYV.js";
49
+ } from "./chunk-VVCSQU5B.js";
50
+ import "./chunk-YEQTRALH.js";
51
+ import "./chunk-SII3M66U.js";
51
52
  import {
52
53
  SMART_TAGS,
53
54
  filterSessionTreeByActivityWindow,
54
55
  isSmartTag,
55
56
  mergeSortedSessions
56
- } from "./chunk-4ND6AT6W.js";
57
+ } from "./chunk-QHWSZFRM.js";
57
58
  export {
58
59
  SMART_TAGS,
59
60
  attachMissingProjectIdentities,
@@ -76,6 +77,7 @@ export {
76
77
  inspectAgentRefresh,
77
78
  isSmartTag,
78
79
  listCachedProjectGroups,
80
+ listDashboardActiveHours,
79
81
  listDashboardCostFacts,
80
82
  listFileActivity,
81
83
  listModelCostDistribution,
@@ -105,4 +107,4 @@ export {
105
107
  syncSessionSearchIndex,
106
108
  syncSessionSearchIndexChanges
107
109
  };
108
- //# sourceMappingURL=discovery-ADSQARBV.js.map
110
+ //# sourceMappingURL=discovery-4WAEYSTR.js.map
package/dist/index.js CHANGED
@@ -4,19 +4,19 @@ import {
4
4
  buildDashboard,
5
5
  getSessionActivityTime,
6
6
  summarizeProjects
7
- } from "./chunk-A3MT6L6Z.js";
7
+ } from "./chunk-WIWK7BXS.js";
8
8
  import {
9
9
  AGENT_UNAVAILABLE_DURING_SCAN_ERROR_CODE,
10
10
  AgentUnavailableDuringScanError
11
11
  } from "./chunk-RF3EEWPH.js";
12
12
  import {
13
13
  terminateWorkerAfterLogDrain
14
- } from "./chunk-COZSWVCH.js";
14
+ } from "./chunk-EYZ73CYP.js";
15
15
  import "./chunk-QH2HOXJH.js";
16
16
  import {
17
17
  appLogger,
18
18
  logSearchIndexSync
19
- } from "./chunk-4QFNZCBR.js";
19
+ } from "./chunk-DE6UJMOY.js";
20
20
  import {
21
21
  attachMissingProjectIdentities,
22
22
  beginAgentRefresh,
@@ -29,6 +29,7 @@ import {
29
29
  getAnalyticsRevision,
30
30
  getSearchProjectDirectory,
31
31
  listCachedProjectGroups,
32
+ listDashboardActiveHours,
32
33
  listDashboardCostFacts,
33
34
  listFileActivity,
34
35
  loadCachedSessionHeads,
@@ -50,18 +51,18 @@ import {
50
51
  sessionMatchesSearchCost,
51
52
  sessionSignature,
52
53
  sortSessions
53
- } from "./chunk-XQDYKKRC.js";
54
+ } from "./chunk-VVCSQU5B.js";
54
55
  import {
55
56
  PROJECT_IDENTITY_RESOLVER_REVISION,
56
57
  createProjectScopeMatcher,
57
58
  createProjectScopeMatcherFromIdentity,
58
59
  matchesProjectScope,
59
60
  normalizeProjectDirectory
60
- } from "./chunk-YZ6XCSVQ.js";
61
+ } from "./chunk-YEQTRALH.js";
61
62
  import {
62
63
  createRegisteredAgents,
63
64
  getAgentInfoMap
64
- } from "./chunk-L3DDWTYV.js";
65
+ } from "./chunk-SII3M66U.js";
65
66
  import {
66
67
  CODESESH_OPERATION_ID_HEADER,
67
68
  CODESESH_REQUEST_ID_HEADER,
@@ -96,7 +97,7 @@ import {
96
97
  tableExists,
97
98
  toPublicReferencedSessionHead,
98
99
  toPublicSessionHead
99
- } from "./chunk-4ND6AT6W.js";
100
+ } from "./chunk-QHWSZFRM.js";
100
101
 
101
102
  // src/index.ts
102
103
  import { defineCommand, runMain } from "citty";
@@ -689,8 +690,9 @@ function getSnapshotCostFacts(source, sessions, from, to, cacheTo, analyticsRevi
689
690
  build
690
691
  );
691
692
  }
692
- function getDashboardStorageAggregation(source, sessions, scope, from, to, cacheTo, analyticsRevision) {
693
+ function getDashboardStorageAggregation(source, sessions, scope, from, to, cacheTo, analyticsRevision, timeZone) {
693
694
  const build = () => ({
695
+ activeHours: listDashboardActiveHours({ ...scope, from, to, timeZone }, source.queryScope),
694
696
  recentFileActivities: listFileActivity(
695
697
  {
696
698
  agent: scope.agent,
@@ -721,6 +723,7 @@ function getDashboardStorageAggregation(source, sessions, scope, from, to, cache
721
723
  sessions,
722
724
  [
723
725
  "dashboard-storage",
726
+ timeZone,
724
727
  scope.agent,
725
728
  scope.projectKind,
726
729
  scope.projectKey,
@@ -1478,12 +1481,13 @@ function readAliasView() {
1478
1481
  }
1479
1482
  }
1480
1483
  var EMPTY_ALIAS_VIEW = buildAliasView(/* @__PURE__ */ new Map());
1484
+ var ALIAS_VIEW_TTL_MS = 1e3;
1481
1485
  var cachedView = null;
1482
1486
  function loadAliasView() {
1483
- if (cachedView) return cachedView;
1487
+ if (cachedView && Date.now() < cachedView.expiresAt) return cachedView.view;
1484
1488
  const loaded = readAliasView();
1485
1489
  if (!loaded) return EMPTY_ALIAS_VIEW;
1486
- cachedView = loaded;
1490
+ cachedView = { view: loaded, expiresAt: Date.now() + ALIAS_VIEW_TTL_MS };
1487
1491
  return loaded;
1488
1492
  }
1489
1493
  function invalidateAliasView() {
@@ -1543,6 +1547,14 @@ function findAliasSearchResults(query, options, scanResult, aliases, context = {
1543
1547
 
1544
1548
  // src/api/dashboard-handler.ts
1545
1549
  function handleGetDashboard(c, scanSource, defaults = {}) {
1550
+ let timeZone;
1551
+ try {
1552
+ timeZone = new Intl.DateTimeFormat("en", {
1553
+ timeZone: optionalQueryValue(c.req.query("timeZone")) ?? Intl.DateTimeFormat().resolvedOptions().timeZone
1554
+ }).resolvedOptions().timeZone;
1555
+ } catch {
1556
+ return c.json({ error: "timeZone must be a valid IANA time zone" }, 400);
1557
+ }
1546
1558
  const scanResult = scanSource.getSnapshot();
1547
1559
  const projectIdentity = parseProjectIdentityFilter(
1548
1560
  c.req.query("projectKind"),
@@ -1611,7 +1623,8 @@ function handleGetDashboard(c, scanSource, defaults = {}) {
1611
1623
  from,
1612
1624
  to,
1613
1625
  cacheTo,
1614
- analyticsRevision
1626
+ analyticsRevision,
1627
+ timeZone
1615
1628
  );
1616
1629
  const data = {
1617
1630
  ...aggregate,
@@ -2095,7 +2108,8 @@ async function handleGetSessionData(c, scanSource, loadDetail = materializeSessi
2095
2108
  session_id: sessionId,
2096
2109
  duration_ms: Math.round(performance.now() - startedAt)
2097
2110
  });
2098
- return c.json({ error: "Session cache not ready" }, 404);
2111
+ c.header("Retry-After", "1");
2112
+ return c.json({ error: "Session detail not ready; retry later" }, 503);
2099
2113
  }
2100
2114
  appLogger.info("api.session_data", {
2101
2115
  agent: agentName,
@@ -2582,7 +2596,19 @@ function createSseResponse(eventSource, requestSignal, shutdownSignal, closeConn
2582
2596
  buffer.enqueue("connected", { timestamp: Date.now() });
2583
2597
  buffer.enqueueScanStatus(eventSource.getScanStatus());
2584
2598
  unsubscribeSessions = eventSource.subscribe((event) => {
2585
- buffer?.enqueue(event.type, event);
2599
+ if (isClosed) return;
2600
+ const aliases = loadAliasView();
2601
+ buffer?.enqueue(event.type, {
2602
+ ...event,
2603
+ changedSessionHeads: event.changedSessionHeads.map((change) => ({
2604
+ ...change,
2605
+ session: aliases.decorate(change.session, change.reference)
2606
+ })),
2607
+ projectionRelatedSessionHeads: event.projectionRelatedSessionHeads?.map((change) => ({
2608
+ ...change,
2609
+ session: aliases.decorate(change.session, change.reference)
2610
+ }))
2611
+ });
2586
2612
  });
2587
2613
  unsubscribeScanStatus = eventSource.subscribeScanStatus((event) => {
2588
2614
  buffer?.enqueueScanStatus(event);
@@ -6927,7 +6953,7 @@ var main = defineCommand({
6927
6953
  log_path: appLogger.getLogPath()
6928
6954
  });
6929
6955
  if (clearCache) {
6930
- const { clearCache: clear } = await import("./discovery-ADSQARBV.js");
6956
+ const { clearCache: clear } = await import("./discovery-4WAEYSTR.js");
6931
6957
  clear();
6932
6958
  appLogger.info("cache.clear");
6933
6959
  console.log("Cache cleared.");