codesesh 1.0.4 → 1.0.5

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 (53) hide show
  1. package/README.md +4 -4
  2. package/dist/{chunk-MBZ4VV4C.js → chunk-FCYCBGEL.js} +3 -3
  3. package/dist/{chunk-W4PZHL2C.js → chunk-NBJJGH5P.js} +57 -39
  4. package/dist/chunk-NBJJGH5P.js.map +1 -0
  5. package/dist/chunk-PAP2Q3WV.js +1271 -0
  6. package/dist/chunk-PAP2Q3WV.js.map +1 -0
  7. package/dist/{chunk-BYB77UAJ.js → chunk-TS3IWH5U.js} +115 -72
  8. package/dist/chunk-TS3IWH5U.js.map +1 -0
  9. package/dist/{chunk-YCUN52HA.js → chunk-WUYSZAYR.js} +75 -114
  10. package/dist/chunk-WUYSZAYR.js.map +1 -0
  11. package/dist/{chunk-3SXCTDD6.js → chunk-XKZSX5BM.js} +4 -3
  12. package/dist/chunk-YQFEGFWD.js +89 -0
  13. package/dist/chunk-YQFEGFWD.js.map +1 -0
  14. package/dist/{discovery-K3GLISI6.js → discovery-D23RV7FY.js} +11 -5
  15. package/dist/index.js +1415 -948
  16. package/dist/index.js.map +1 -1
  17. package/dist/project-identity-worker.js +4 -4
  18. package/dist/scan-refresh-worker.js +17 -7
  19. package/dist/scan-refresh-worker.js.map +1 -1
  20. package/dist/search-index-worker.js +16 -8
  21. package/dist/search-index-worker.js.map +1 -1
  22. package/dist/session-detail-worker.js +79 -0
  23. package/dist/session-detail-worker.js.map +1 -0
  24. package/dist/smart-tag-worker.js +3 -3
  25. package/dist/web/assets/CustomTimeWindowDialog-C9XTZRm0.js +1 -0
  26. package/dist/web/assets/{InteractiveReceipt-Dk50TBsH.js → InteractiveReceipt-Sca1smpv.js} +1 -1
  27. package/dist/web/assets/OverviewScreen-Vq6BQR9_.js +1 -0
  28. package/dist/web/assets/{PrismHighlighter-B1a2dPJO.js → PrismHighlighter-LWITDffT.js} +1 -1
  29. package/dist/web/assets/Projects-CwicV3Dk.js +1 -0
  30. package/dist/web/assets/{SearchResultsPanel-DfheEwpz.js → SearchResultsPanel-DCO0Ak0c.js} +1 -1
  31. package/dist/web/assets/SessionDetail-mdmTQgo1.js +53 -0
  32. package/dist/web/assets/api-CXVT9XcZ.js +1 -0
  33. package/dist/web/assets/contract-BS78VBCV.js +2 -0
  34. package/dist/web/assets/{index-Bd-YkWkZ.css → index-C5cyw58A.css} +1 -1
  35. package/dist/web/assets/index-H2cT-6c6.js +1423 -0
  36. package/dist/web/assets/{session-indexes-BsgjUoc1.js → session-indexes-yyyWpKLf.js} +2 -2
  37. package/dist/web/index.html +6 -6
  38. package/package.json +1 -1
  39. package/dist/chunk-BYB77UAJ.js.map +0 -1
  40. package/dist/chunk-G4HRD3AR.js +0 -246
  41. package/dist/chunk-G4HRD3AR.js.map +0 -1
  42. package/dist/chunk-W4PZHL2C.js.map +0 -1
  43. package/dist/chunk-YCUN52HA.js.map +0 -1
  44. package/dist/web/assets/OverviewScreen-5hvQVp4H.js +0 -1
  45. package/dist/web/assets/Projects-Cy_v2yep.js +0 -1
  46. package/dist/web/assets/SessionDetail-DRI8R3st.js +0 -53
  47. package/dist/web/assets/api-GP9UCedC.js +0 -1
  48. package/dist/web/assets/contract-xJyW5u7a.js +0 -2
  49. package/dist/web/assets/index-DEjvzumm.js +0 -1410
  50. package/dist/web/assets/panel-ND0J63d3.js +0 -1
  51. /package/dist/{chunk-MBZ4VV4C.js.map → chunk-FCYCBGEL.js.map} +0 -0
  52. /package/dist/{chunk-3SXCTDD6.js.map → chunk-XKZSX5BM.js.map} +0 -0
  53. /package/dist/{discovery-K3GLISI6.js.map → discovery-D23RV7FY.js.map} +0 -0
package/README.md CHANGED
@@ -67,7 +67,7 @@ npx codesesh
67
67
  # Choose a custom starting port
68
68
  npx codesesh --port 8080
69
69
 
70
- # Only show sessions active in the last 3 days
70
+ # Only show sessions active in the last 3 local calendar days
71
71
  npx codesesh --days 3
72
72
 
73
73
  # Jump directly to a session
@@ -97,11 +97,11 @@ npx codesesh --trace
97
97
  | `--tls-key` | — | — | Path to the private key matching `--tls-cert` |
98
98
  | `--trust-proxy` | — | `false` | A reverse proxy in front of CodeSesh terminates TLS |
99
99
  | `--public-url` | — | — | Public HTTPS origin used with `--trust-proxy` for startup links |
100
- | `--days` | `-d` | `7` | Only include sessions active in the last N days (`0` = all time) |
100
+ | `--days` | `-d` | `7` | Only include sessions active in the last N local calendar days (`0` = all time) |
101
101
  | `--cwd` | — | — | Filter to sessions from a project directory |
102
102
  | `--agent` | `-a` | all | Filter to specific agent(s), comma-separated |
103
- | `--from` | — | — | Sessions active after this date `YYYY-MM-DD` |
104
- | `--to` | — | — | Sessions active before this date `YYYY-MM-DD` |
103
+ | `--from` | — | — | Sessions active on or after this date `YYYY-MM-DD` |
104
+ | `--to` | — | — | Sessions active on or before this date `YYYY-MM-DD` |
105
105
  | `--session` | `-s` | — | Directly open a session (`agent://session-id`) |
106
106
  | `--json` | `-j` | `false` | Print the session index as JSON and exit (metadata only) |
107
107
  | `--no-open` | — | `false` | Don't auto-open the browser |
@@ -8,9 +8,9 @@ import {
8
8
  getSessionAgentKey,
9
9
  getSessionReferenceKey,
10
10
  toCalendarDayKey
11
- } from "./chunk-W4PZHL2C.js";
11
+ } from "./chunk-NBJJGH5P.js";
12
12
 
13
- // ../core/dist/chunk-OGQ63HC5.mjs
13
+ // ../core/dist/chunk-APSKFEAV.mjs
14
14
  var COST_ABSOLUTE_TOLERANCE = 1e-8;
15
15
  var COST_RELATIVE_TOLERANCE = 1e-6;
16
16
  function indexFacts(facts) {
@@ -667,4 +667,4 @@ export {
667
667
  summarizeProjects,
668
668
  attachProjectMetricsFromTree
669
669
  };
670
- //# sourceMappingURL=chunk-MBZ4VV4C.js.map
670
+ //# sourceMappingURL=chunk-FCYCBGEL.js.map
@@ -36,7 +36,7 @@ function toPublicReferencedSessionHead(item) {
36
36
  return { ...item, session: toPublicSessionHead(item.session) };
37
37
  }
38
38
 
39
- // ../core/dist/chunk-EY7UDYHJ.mjs
39
+ // ../core/dist/chunk-555L3CTP.mjs
40
40
  var SMART_TAG_CLASSIFIER_REVISION = "smart-tags-v1";
41
41
  var USER_RULES = [
42
42
  ["bugfix", /\b(fix|bug|error|crash|exception|fail(?:ed|ure)?)\b|修复|错误|报错|崩溃|异常/i],
@@ -115,12 +115,19 @@ function hasEditedDocPath(value) {
115
115
  return Object.values(record).some(hasEditedDocPath);
116
116
  }
117
117
  var WORKER_LOG_MESSAGE_TYPE = "codesesh.worker-log";
118
+ var WORKER_LOG_CONTEXT_KEYS = /* @__PURE__ */ new Set(["request_id", "operation_id", "publication_id"]);
118
119
  function isRecord(value) {
119
120
  return value != null && typeof value === "object" && !Array.isArray(value);
120
121
  }
122
+ function isLogContext(value) {
123
+ if (!isRecord(value)) return false;
124
+ return Object.entries(value).every(
125
+ ([key, item]) => WORKER_LOG_CONTEXT_KEYS.has(key) && typeof item === "string" && item.length <= 160
126
+ );
127
+ }
121
128
  function isWorkerLogMessage(value) {
122
129
  if (!isRecord(value) || value.type !== WORKER_LOG_MESSAGE_TYPE) return false;
123
- return typeof value.ts === "string" && value.ts.length > 0 && (value.level === "debug" || value.level === "info" || value.level === "warn" || value.level === "error") && typeof value.event === "string" && value.event.length > 0 && Number.isSafeInteger(value.pid) && Number(value.pid) > 0 && Number.isSafeInteger(value.threadId) && Number(value.threadId) >= 0 && isRecord(value.data);
130
+ return typeof value.ts === "string" && value.ts.length > 0 && (value.level === "debug" || value.level === "info" || value.level === "warn" || value.level === "error") && typeof value.event === "string" && value.event.length > 0 && Number.isSafeInteger(value.pid) && Number(value.pid) > 0 && Number.isSafeInteger(value.threadId) && Number(value.threadId) >= 0 && (value.context === void 0 || isLogContext(value.context)) && isRecord(value.data);
124
131
  }
125
132
 
126
133
  // ../core/dist/chunk-FDGCEOYE.mjs
@@ -165,7 +172,7 @@ function sessionRoutePath(reference) {
165
172
  return `${agentRoutePath(normalized.agentName)}/${encodeURIComponent(normalized.sessionId)}`;
166
173
  }
167
174
 
168
- // ../core/dist/chunk-GHNYETRY.mjs
175
+ // ../core/dist/chunk-EH34OTWI.mjs
169
176
  var FILE_TOOL_KINDS = {
170
177
  read: "read",
171
178
  read_file: "read",
@@ -324,6 +331,18 @@ function addCalendarDays(timestamp, days) {
324
331
  const date = new Date(timestamp);
325
332
  return new Date(date.getFullYear(), date.getMonth(), date.getDate() + days).getTime();
326
333
  }
334
+ function parseCalendarDayBoundary(value, boundary) {
335
+ const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
336
+ if (!match) return void 0;
337
+ const year = Number(match[1]);
338
+ const month = Number(match[2]) - 1;
339
+ const day = Number(match[3]);
340
+ const start = new Date(year, month, day);
341
+ if (start.getFullYear() !== year || start.getMonth() !== month || start.getDate() !== day) {
342
+ return null;
343
+ }
344
+ return boundary === "start" ? start.getTime() : addCalendarDays(start.getTime(), 1) - 1;
345
+ }
327
346
  function toCalendarDayNumber(timestamp) {
328
347
  const date = new Date(timestamp);
329
348
  return Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()) / 864e5;
@@ -644,8 +663,10 @@ function createSessionProjectionContext(previousSessions, nextSessions, changedS
644
663
  );
645
664
  return { relatedSessionHeads, sessionOrder };
646
665
  }
666
+ var CODESESH_REQUEST_ID_HEADER = "X-CodeSesh-Request-ID";
667
+ var CODESESH_OPERATION_ID_HEADER = "X-CodeSesh-Operation-ID";
647
668
 
648
- // ../core/dist/chunk-3ENBOS4I.mjs
669
+ // ../core/dist/chunk-FEGCFXYO.mjs
649
670
  function normalizeToolLabel(part) {
650
671
  if (part.title?.trim()) {
651
672
  return part.title.trim().replace(/^tool:\s*/i, "");
@@ -710,7 +731,7 @@ function extractSessionFileActivity(agentName, sessionId, projectIdentityKey, me
710
731
  );
711
732
  }
712
733
 
713
- // ../core/dist/chunk-WABZHIV5.mjs
734
+ // ../core/dist/chunk-DXASLH4L.mjs
714
735
  import { chmodSync, existsSync, mkdirSync, readdirSync, statSync } from "fs";
715
736
  import { basename, dirname, join } from "path";
716
737
  var diagnostics = null;
@@ -787,7 +808,7 @@ function restrictPrivateDatabase(dbPath) {
787
808
  restrictExistingBackups(dbPath);
788
809
  }
789
810
 
790
- // ../core/dist/chunk-3JGIS7MJ.mjs
811
+ // ../core/dist/chunk-N5FZ5IIC.mjs
791
812
  import { createHash } from "crypto";
792
813
  import { existsSync as existsSync2, readFileSync, renameSync, rmSync, writeFileSync } from "fs";
793
814
  import { homedir } from "os";
@@ -862,8 +883,8 @@ function createPricingGeneration(pricing) {
862
883
  pricing
863
884
  };
864
885
  }
865
- function costNumber(value, fallback) {
866
- return typeof value === "number" && Number.isFinite(value) ? value : fallback;
886
+ function costNumber(value) {
887
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
867
888
  }
868
889
  function getCacheDir() {
869
890
  return join2(homedir(), ".cache", "codesesh");
@@ -888,32 +909,26 @@ function loadSnapshot() {
888
909
  return map;
889
910
  }
890
911
  function parseLiteLLMEntry(entry) {
891
- const input = entry.input_cost_per_token;
892
- const output = entry.output_cost_per_token;
893
- if (typeof input !== "number" || typeof output !== "number") return null;
894
- return {
895
- inputCostPerToken: input,
896
- outputCostPerToken: output,
897
- cacheCreateCostPerToken: entry.cache_creation_input_token_cost ?? input * 1.25,
898
- cacheReadCostPerToken: entry.cache_read_input_token_cost ?? input * 0.1,
899
- reasoningCostPerToken: entry.output_reasoning_cost_per_token ?? output,
900
- webSearchCostPerRequest: costNumber(
901
- entry.web_search_cost_per_request ?? entry.search_context_cost_per_query,
902
- WEB_SEARCH_COST
903
- )
904
- };
912
+ return normalizePricing({
913
+ inputCostPerToken: entry.input_cost_per_token,
914
+ outputCostPerToken: entry.output_cost_per_token,
915
+ cacheCreateCostPerToken: entry.cache_creation_input_token_cost,
916
+ cacheReadCostPerToken: entry.cache_read_input_token_cost,
917
+ reasoningCostPerToken: entry.output_reasoning_cost_per_token,
918
+ webSearchCostPerRequest: entry.web_search_cost_per_request ?? entry.search_context_cost_per_query
919
+ });
905
920
  }
906
- function normalizeCachedPricing(raw) {
907
- const input = costNumber(raw["inputCostPerToken"], 0);
908
- const output = costNumber(raw["outputCostPerToken"], 0);
909
- if (input <= 0 || output <= 0) return null;
921
+ function normalizePricing(raw) {
922
+ const input = costNumber(raw["inputCostPerToken"]);
923
+ const output = costNumber(raw["outputCostPerToken"]);
924
+ if (input === void 0 || output === void 0) return null;
910
925
  return {
911
926
  inputCostPerToken: input,
912
927
  outputCostPerToken: output,
913
- cacheCreateCostPerToken: costNumber(raw["cacheCreateCostPerToken"], input * 1.25),
914
- cacheReadCostPerToken: costNumber(raw["cacheReadCostPerToken"], input * 0.1),
915
- reasoningCostPerToken: costNumber(raw["reasoningCostPerToken"], output),
916
- webSearchCostPerRequest: costNumber(raw["webSearchCostPerRequest"], WEB_SEARCH_COST)
928
+ cacheCreateCostPerToken: costNumber(raw["cacheCreateCostPerToken"]) ?? input * 1.25,
929
+ cacheReadCostPerToken: costNumber(raw["cacheReadCostPerToken"]) ?? input * 0.1,
930
+ reasoningCostPerToken: costNumber(raw["reasoningCostPerToken"]) ?? output,
931
+ webSearchCostPerRequest: costNumber(raw["webSearchCostPerRequest"]) ?? WEB_SEARCH_COST
917
932
  };
918
933
  }
919
934
  function indexPricing(map, name, pricing) {
@@ -944,9 +959,9 @@ function readDiskCache() {
944
959
  }
945
960
  const next = loadSnapshot();
946
961
  for (const [name, rawPricing] of Object.entries(cached.data)) {
947
- const pricing = normalizeCachedPricing(rawPricing);
962
+ const pricing = normalizePricing(rawPricing);
948
963
  if (!pricing) continue;
949
- indexPricing(next, name, pricing);
964
+ next.set(normalizeModelKey(name), pricing);
950
965
  }
951
966
  return createPricingGeneration(next);
952
967
  } catch {
@@ -1177,7 +1192,7 @@ function estimateCostForTokens(model, usage) {
1177
1192
  return cost > 0 ? { cost: Number(cost.toFixed(8)), source: "estimated" } : null;
1178
1193
  }
1179
1194
 
1180
- // ../core/dist/chunk-326ZXYCY.mjs
1195
+ // ../core/dist/chunk-OZGB4IF4.mjs
1181
1196
  import { closeSync, openSync, readSync } from "fs";
1182
1197
  import { StringDecoder } from "string_decoder";
1183
1198
  import { basename as basename2 } from "path";
@@ -1484,7 +1499,8 @@ function cleanMessageParts(parts) {
1484
1499
  }
1485
1500
  function cleanParsedMessage(message) {
1486
1501
  const parts = cleanMessageParts(message.parts);
1487
- if (parts.length === 0) return null;
1502
+ const hasUsage = (message.cost ?? 0) > 0 || Object.values(message.tokens ?? {}).some((value) => value > 0);
1503
+ if (parts.length === 0 && !hasUsage) return null;
1488
1504
  return { ...message, parts };
1489
1505
  }
1490
1506
  function cleanParsedMessages(messages) {
@@ -1505,7 +1521,7 @@ function firstUserMessageTitle(messages) {
1505
1521
  return null;
1506
1522
  }
1507
1523
 
1508
- // ../core/dist/chunk-BAU7ZBXA.mjs
1524
+ // ../core/dist/chunk-HXH76DEE.mjs
1509
1525
  import { existsSync as existsSync3 } from "fs";
1510
1526
  import { basename as basename3, dirname as dirname2, join as join3 } from "path";
1511
1527
  import { createRequire } from "module";
@@ -1974,6 +1990,7 @@ export {
1974
1990
  mergeSessionsUpdatedEvents,
1975
1991
  startOfCalendarDay,
1976
1992
  addCalendarDays,
1993
+ parseCalendarDayBoundary,
1977
1994
  countCalendarDays,
1978
1995
  toCalendarDayKey,
1979
1996
  isProjectIdentityKind,
@@ -1986,12 +2003,13 @@ export {
1986
2003
  filterSessionTreeByActivityWindow,
1987
2004
  filterSessionTreeEntriesByActivityWindow,
1988
2005
  createSessionProjectionContext,
2006
+ CODESESH_REQUEST_ID_HEADER,
2007
+ CODESESH_OPERATION_ID_HEADER,
1989
2008
  extractSessionFileActivity,
1990
2009
  setCoreDiagnostics,
1991
2010
  getCoreDiagnostics,
1992
- ensurePrivateDirectory,
1993
- restrictPrivateFile,
1994
- restrictExistingPrivateFiles,
2011
+ PRIVATE_DIR_MODE,
2012
+ PRIVATE_FILE_MODE,
1995
2013
  getPricingGeneration,
1996
2014
  synchronizePricingGeneration,
1997
2015
  publishPendingPricing,
@@ -2032,4 +2050,4 @@ export {
2032
2050
  AGENT_CATALOG,
2033
2051
  getAgentCatalogEntry
2034
2052
  };
2035
- //# sourceMappingURL=chunk-W4PZHL2C.js.map
2053
+ //# sourceMappingURL=chunk-NBJJGH5P.js.map