@sentry/junior 0.97.1 → 0.99.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 (59) hide show
  1. package/dist/{agent-hooks-XSUIVRQS.js → agent-hooks-OSW6C3CJ.js} +2 -2
  2. package/dist/api/conversations/detail.d.ts +1 -1
  3. package/dist/api/conversations/detail.query.d.ts +1 -1
  4. package/dist/api/conversations/list.d.ts +7 -2
  5. package/dist/api/conversations/list.query.d.ts +9 -3
  6. package/dist/api/conversations/projection.d.ts +0 -1
  7. package/dist/api/conversations/schema.d.ts +31 -8
  8. package/dist/api/people/schema.d.ts +0 -11
  9. package/dist/api/people/shared.d.ts +2 -4
  10. package/dist/api/schema.d.ts +4 -1
  11. package/dist/api/schema.js +5 -3
  12. package/dist/api-reference.d.ts +2 -2
  13. package/dist/api.js +28 -13
  14. package/dist/app.js +50 -37
  15. package/dist/chat/conversations/search.d.ts +24 -0
  16. package/dist/chat/conversations/sql/search.d.ts +4 -0
  17. package/dist/chat/db.d.ts +3 -0
  18. package/dist/chat/runtime/report-progress.d.ts +3 -0
  19. package/dist/chat/runtime/slack-resume.d.ts +2 -0
  20. package/dist/chat/services/context-compaction.d.ts +1 -0
  21. package/dist/chat/slack/assistant-thread/status-scheduler.d.ts +4 -3
  22. package/dist/chat/slack/outbound.d.ts +6 -0
  23. package/dist/chat/slack/tools/conversation-search.d.ts +71 -0
  24. package/dist/chat/state/turn-session.d.ts +2 -0
  25. package/dist/chat/tool-support/zod-tool.d.ts +1 -1
  26. package/dist/chunk-6DTVCPLO.js +146 -0
  27. package/dist/{chunk-VFH4ZKZT.js → chunk-CRQVIHDI.js} +1 -3
  28. package/dist/{chunk-6U26PYI5.js → chunk-CV22LUIV.js} +7 -17
  29. package/dist/{chunk-GUAP3H7O.js → chunk-DHHU2WSG.js} +2 -2
  30. package/dist/{chunk-T533JLM3.js → chunk-ER45IV77.js} +8 -6
  31. package/dist/{chunk-LUAE4MGW.js → chunk-EUZ44ROE.js} +21 -4
  32. package/dist/{chunk-5HLDPVYS.js → chunk-FTTFV6DC.js} +1 -1
  33. package/dist/{chunk-3F4OPKGF.js → chunk-IO65E4ZD.js} +2 -2
  34. package/dist/{chunk-ON6YKIQ7.js → chunk-KFUSLFLL.js} +21 -15
  35. package/dist/{chunk-FBHZJFHI.js → chunk-NJEDJFK4.js} +1 -1
  36. package/dist/{chunk-35BNLDOJ.js → chunk-OGHXZ4KQ.js} +134 -57
  37. package/dist/{chunk-WJOSZOON.js → chunk-OL6XQ23W.js} +11 -150
  38. package/dist/{chunk-XIRPQQVE.js → chunk-PYK7R5A7.js} +312 -175
  39. package/dist/{chunk-UAMKJPDF.js → chunk-T55RBE4Z.js} +4 -0
  40. package/dist/{chunk-WGXMTFNU.js → chunk-WJ7STXT6.js} +5 -3
  41. package/dist/{chunk-AUUCAFDE.js → chunk-ZZUBLPXD.js} +134 -11
  42. package/dist/cli/chat.js +11 -10
  43. package/dist/cli/plugins.js +2 -2
  44. package/dist/cli/upgrade.js +9 -7
  45. package/dist/{db-BWXYIKFQ.js → db-GFSCDAHS.js} +3 -1
  46. package/dist/detail-Q4IVDNGS.js +67 -0
  47. package/dist/{legacy-import-3NQJVGQL.js → legacy-import-6WWXMALY.js} +2 -2
  48. package/dist/{list-UXJI5Q5X.js → list-A3F5JDYV.js} +7 -5
  49. package/dist/{list-A3WFRIYX.js → list-M5BRWW3D.js} +5 -6
  50. package/dist/{plugin-conversations-DDNGC35A.js → plugin-conversations-PDCQWU3O.js} +3 -3
  51. package/dist/{profile-4RYDXWTF.js → profile-UEIRSVT3.js} +5 -5
  52. package/dist/{runner-JALSYH2P.js → runner-267ZRLZD.js} +8 -7
  53. package/dist/{stats-XKXH3PTY.js → stats-L62E4O4U.js} +7 -17
  54. package/dist/{subagent-TZ55XY37.js → subagent-UN3MP6LV.js} +6 -6
  55. package/migrations/0002_conversation_message_search.sql +1 -0
  56. package/migrations/meta/0002_snapshot.json +987 -0
  57. package/migrations/meta/_journal.json +7 -0
  58. package/package.json +6 -6
  59. package/dist/detail-GA6NXWQJ.js +0 -43
@@ -1,11 +1,15 @@
1
1
  // src/api/schema.ts
2
2
  import { z } from "zod";
3
3
  var conversationParamsSchema = z.object({ conversationId: z.string().min(1) }).strict();
4
+ var conversationFeedQuerySchema = z.object({
5
+ actorEmail: z.string().trim().email().transform((value) => value.toLowerCase()).optional()
6
+ }).strict();
4
7
  var subagentParamsSchema = conversationParamsSchema.extend({ subagentId: z.string().min(1) }).strict();
5
8
  var personParamsSchema = z.object({ email: z.string().trim().min(1) }).strict();
6
9
 
7
10
  export {
8
11
  conversationParamsSchema,
12
+ conversationFeedQuerySchema,
9
13
  subagentParamsSchema,
10
14
  personParamsSchema
11
15
  };
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  JUNIOR_THREAD_STATE_TTL_MS,
3
+ buildConversationStatePatch
4
+ } from "./chunk-6DTVCPLO.js";
5
+ import {
3
6
  abandonAgentTurnSessionRecord,
4
7
  addAgentTurnUsage,
5
- buildConversationStatePatch,
6
8
  getAgentTurnSessionRecord,
7
9
  upsertAgentTurnSessionRecord
8
- } from "./chunk-WJOSZOON.js";
10
+ } from "./chunk-OL6XQ23W.js";
9
11
  import {
10
12
  persistConversationMessages
11
- } from "./chunk-3F4OPKGF.js";
13
+ } from "./chunk-IO65E4ZD.js";
12
14
  import {
13
15
  sleep
14
16
  } from "./chunk-4ZNGQH7C.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  conversationSummaryFromStoredConversation
3
- } from "./chunk-ON6YKIQ7.js";
3
+ } from "./chunk-KFUSLFLL.js";
4
4
  import {
5
5
  buildSentryConversationUrl,
6
6
  buildSentryTraceUrl
@@ -8,12 +8,13 @@ import {
8
8
  import {
9
9
  loadProjection,
10
10
  projectSteps
11
- } from "./chunk-GUAP3H7O.js";
11
+ } from "./chunk-DHHU2WSG.js";
12
12
  import {
13
13
  getAgentStepStore,
14
14
  getConversationMessageStore
15
- } from "./chunk-35BNLDOJ.js";
15
+ } from "./chunk-OGHXZ4KQ.js";
16
16
  import {
17
+ stripRuntimeTurnContext,
17
18
  unescapeXml,
18
19
  unwrapCurrentInstruction
19
20
  } from "./chunk-EEZCY5WX.js";
@@ -24,6 +25,9 @@ import {
24
25
  isRecord
25
26
  } from "./chunk-OB42YVAE.js";
26
27
 
28
+ // src/api/conversations/detail-projection.ts
29
+ import { isDeepStrictEqual } from "util";
30
+
27
31
  // src/api/conversations/transcript.ts
28
32
  var SAFE_METADATA_KEY_LIMIT = 20;
29
33
  var LEGACY_ADVISOR_TASK_OPEN = "<advisor-task>\n";
@@ -64,6 +68,14 @@ function recordField(value, names) {
64
68
  }
65
69
  return void 0;
66
70
  }
71
+ function thinkingOutput(part) {
72
+ const output = recordField(part, ["thinking", "text", "content", "output"]);
73
+ return isRecord(output) ? recordField(output, ["thinking", "text", "content", "output"]) : output;
74
+ }
75
+ function isDisplayableTranscriptPart(part) {
76
+ if (part.type !== "thinking") return true;
77
+ return typeof part.output === "string" && part.output.trim().length > 0;
78
+ }
67
79
  function normalizeTranscriptPart(part, options = {}) {
68
80
  const displayText = (text) => {
69
81
  if (options.unwrapCurrentTask) {
@@ -107,7 +119,7 @@ function normalizeTranscriptPart(part, options = {}) {
107
119
  if (rawType === "thinking") {
108
120
  return {
109
121
  type: "thinking",
110
- output: recordField(part, ["thinking", "text", "content", "output"])
122
+ output: thinkingOutput(part)
111
123
  };
112
124
  }
113
125
  return {
@@ -155,7 +167,7 @@ function normalizeMessage(message, options = {}) {
155
167
  unwrapCurrentTask: role === "user",
156
168
  unwrapLegacyAdvisorTask: options.unwrapLegacyAdvisorTask && role === "user"
157
169
  })
158
- ) : [
170
+ ).filter(isDisplayableTranscriptPart) : [
159
171
  normalizeTranscriptPart(content, {
160
172
  unwrapCurrentTask: role === "user",
161
173
  unwrapLegacyAdvisorTask: options.unwrapLegacyAdvisorTask && role === "user"
@@ -393,9 +405,119 @@ function subagentActivityFromSteps(start, end, options = {}) {
393
405
  }
394
406
 
395
407
  // src/api/conversations/detail-projection.ts
396
- async function currentRunContent(args) {
397
- const steps = await args.stepStore.loadCurrentEpoch(args.conversationId);
398
- const messages = projectSteps(steps).messages;
408
+ var COMPACTION_SUMMARY_PREFIXES = [
409
+ "Context compaction summary for future Junior turns:",
410
+ "Context handoff summary for future Junior turns:"
411
+ ];
412
+ var MODEL_HANDOFF_SUMMARY_PREFIX = "Model handoff checkpoint. Continue the outstanding request now using this summary as the complete prior context:";
413
+ function messageText(message) {
414
+ return normalizeTranscriptMessage(message).parts.filter((part) => part.type === "text").map((part) => part.text ?? "").join("\n").trim();
415
+ }
416
+ function summaryAfterPrefix(message, prefixes) {
417
+ const text = messageText(message);
418
+ const prefix = prefixes.find((candidate) => text.startsWith(candidate));
419
+ if (!prefix) return void 0;
420
+ return text.slice(prefix.length).trim();
421
+ }
422
+ function summaryIndex(messages, provenance, prefixes) {
423
+ for (let index = messages.length - 1; index >= 0; index -= 1) {
424
+ if (provenance[index]?.authority === "context" && summaryAfterPrefix(messages[index], prefixes) !== void 0) {
425
+ return index;
426
+ }
427
+ }
428
+ return -1;
429
+ }
430
+ function matchingPrefix(left, right) {
431
+ const limit = Math.min(left.length, right.length);
432
+ for (let index = 0; index < limit; index += 1) {
433
+ if (!isDeepStrictEqual(left[index], right[index])) return index;
434
+ }
435
+ return limit;
436
+ }
437
+ function historyContent(args) {
438
+ const contextEvents = [];
439
+ const messages = [];
440
+ const epochs = /* @__PURE__ */ new Map();
441
+ for (const step of args.steps) {
442
+ const epoch = epochs.get(step.contextEpoch);
443
+ if (epoch) epoch.push(step);
444
+ else epochs.set(step.contextEpoch, [step]);
445
+ }
446
+ let previousModelId;
447
+ let previousProjection = [];
448
+ for (const steps of epochs.values()) {
449
+ const marker = steps.find(
450
+ (step) => step.entry.type === "context_epoch_started"
451
+ );
452
+ const projection = projectSteps(steps);
453
+ const projected = [];
454
+ const projectedProvenance = [];
455
+ projection.messages.forEach((message, index) => {
456
+ for (const retained of stripRuntimeTurnContext([message])) {
457
+ projected.push(retained);
458
+ projectedProvenance.push(projection.provenance[index]);
459
+ }
460
+ });
461
+ const replacementSummaryIndex = marker?.entry.reason === "compaction" ? summaryIndex(
462
+ projected,
463
+ projectedProvenance,
464
+ COMPACTION_SUMMARY_PREFIXES
465
+ ) : marker?.entry.reason === "handoff" ? summaryIndex(projected, projectedProvenance, [
466
+ MODEL_HANDOFF_SUMMARY_PREFIX
467
+ ]) : -1;
468
+ const summary = replacementSummaryIndex >= 0 ? summaryAfterPrefix(
469
+ projected[replacementSummaryIndex],
470
+ marker?.entry.reason === "handoff" ? [MODEL_HANDOFF_SUMMARY_PREFIX] : COMPACTION_SUMMARY_PREFIXES
471
+ ) : void 0;
472
+ if (marker?.entry.reason === "compaction") {
473
+ contextEvents.push({
474
+ type: "context_compacted",
475
+ createdAt: new Date(marker.createdAtMs).toISOString(),
476
+ ...marker.entry.modelId ? { modelId: marker.entry.modelId } : {},
477
+ ...args.canExposePayload && summary ? { summary } : {},
478
+ transcriptIndex: messages.length
479
+ });
480
+ } else if (marker?.entry.reason === "handoff") {
481
+ contextEvents.push({
482
+ type: "model_handoff",
483
+ createdAt: new Date(marker.createdAtMs).toISOString(),
484
+ ...previousModelId ? { fromModelId: previousModelId } : {},
485
+ toModelId: marker.entry.modelId,
486
+ ...args.canExposePayload && summary ? { summary } : {},
487
+ transcriptIndex: messages.length
488
+ });
489
+ }
490
+ if (marker?.entry.reason === "rollback") {
491
+ messages.push(
492
+ ...projected.slice(matchingPrefix(previousProjection, projected))
493
+ );
494
+ } else {
495
+ const copiedMessageIndexes = /* @__PURE__ */ new Set();
496
+ projected.forEach((message, index) => {
497
+ if (index === replacementSummaryIndex) return;
498
+ let copiedCompactionMessage = false;
499
+ if (marker?.entry.reason === "compaction" && replacementSummaryIndex >= 0 && index < replacementSummaryIndex) {
500
+ const copiedIndex = messages.findIndex(
501
+ (candidate, candidateIndex) => !copiedMessageIndexes.has(candidateIndex) && isDeepStrictEqual(candidate, message)
502
+ );
503
+ copiedCompactionMessage = copiedIndex >= 0;
504
+ if (copiedCompactionMessage) copiedMessageIndexes.add(copiedIndex);
505
+ }
506
+ if (!copiedCompactionMessage) messages.push(message);
507
+ });
508
+ }
509
+ previousModelId = marker?.entry.modelId ?? previousModelId;
510
+ previousProjection = projected;
511
+ }
512
+ return { contextEvents, messages };
513
+ }
514
+ async function conversationContent(args) {
515
+ const steps = await args.stepStore.loadHistory(args.conversationId);
516
+ const history = historyContent({
517
+ canExposePayload: args.canExposePayload,
518
+ steps
519
+ });
520
+ const messages = history.messages;
399
521
  const transcript = messages.length > 0 ? messages.map((message) => normalizeTranscriptMessage(message)) : (await args.messageStore.list(args.conversationId)).map(
400
522
  visibleMessageTranscript
401
523
  );
@@ -405,6 +527,7 @@ async function currentRunContent(args) {
405
527
  steps,
406
528
  messages
407
529
  }),
530
+ contextEvents: history.contextEvents,
408
531
  transcript
409
532
  };
410
533
  }
@@ -427,12 +550,12 @@ async function buildConversationDetail(args) {
427
550
  conversationId,
428
551
  visibility: conversation.visibility
429
552
  });
430
- const currentContent = transcriptPurgedAtMs === void 0 ? await currentRunContent({
553
+ const currentContent = transcriptPurgedAtMs === void 0 ? await conversationContent({
431
554
  conversationId,
432
555
  messageStore,
433
556
  stepStore,
434
557
  canExposePayload: canExposeSqlContent
435
- }) : { activity: [], transcript: [] };
558
+ }) : { activity: [], contextEvents: [], transcript: [] };
436
559
  const currentTranscript = currentContent.transcript;
437
560
  const traceId = canExposeSqlContent ? traceIdFromTranscript(currentTranscript) : void 0;
438
561
  const sentryTraceUrl = traceId ? buildSentryTraceUrl(traceId) : void 0;
@@ -441,12 +564,12 @@ async function buildConversationDetail(args) {
441
564
  ...conversationSummaryFromStoredConversation({
442
565
  conversation,
443
566
  durationMs: args.durationMs,
444
- nowMs,
445
567
  usage: args.usage
446
568
  }),
447
569
  ...traceId ? { traceId } : {},
448
570
  ...sentryTraceUrl ? { sentryTraceUrl } : {},
449
571
  activity: currentContent.activity,
572
+ contextEvents: currentContent.contextEvents,
450
573
  transcriptAvailable: transcriptExpiredAt === void 0 && canExposeSqlContent && currentTranscript.length > 0,
451
574
  ...currentTranscript.length > 0 ? {
452
575
  transcriptMessageCount: countConversationMessages(currentTranscript)
package/dist/cli/chat.js CHANGED
@@ -1,21 +1,22 @@
1
1
  import {
2
2
  createAgentRunner,
3
3
  executeAgentRun
4
- } from "../chunk-XIRPQQVE.js";
5
- import "../chunk-WGXMTFNU.js";
6
- import "../chunk-WJOSZOON.js";
7
- import "../chunk-GUAP3H7O.js";
8
- import "../chunk-3F4OPKGF.js";
4
+ } from "../chunk-PYK7R5A7.js";
5
+ import "../chunk-WJ7STXT6.js";
6
+ import "../chunk-6DTVCPLO.js";
7
+ import "../chunk-OL6XQ23W.js";
8
+ import "../chunk-DHHU2WSG.js";
9
+ import "../chunk-IO65E4ZD.js";
9
10
  import "../chunk-H66UCBPW.js";
10
11
  import "../chunk-PDO5BLNM.js";
11
12
  import "../chunk-CM5EZD5F.js";
12
13
  import {
13
14
  loadAppPluginSet
14
15
  } from "../chunk-Y2CM7HXH.js";
15
- import "../chunk-5HLDPVYS.js";
16
+ import "../chunk-FTTFV6DC.js";
16
17
  import "../chunk-WTYEKPXU.js";
17
18
  import "../chunk-EOWXRY5E.js";
18
- import "../chunk-35BNLDOJ.js";
19
+ import "../chunk-OGHXZ4KQ.js";
19
20
  import "../chunk-G3E7SCME.js";
20
21
  import "../chunk-4ZNGQH7C.js";
21
22
  import "../chunk-EEZCY5WX.js";
@@ -151,10 +152,10 @@ async function configureLocalChatPlugins(pluginSet) {
151
152
  databaseModule
152
153
  ] = await Promise.all([
153
154
  import("../plugins-PZMDS7AT.js"),
154
- import("../agent-hooks-XSUIVRQS.js"),
155
+ import("../agent-hooks-OSW6C3CJ.js"),
155
156
  import("../catalog-runtime-PFHVMHDR.js"),
156
157
  import("../validation-FMEAEKCY.js"),
157
- import("../db-BWXYIKFQ.js")
158
+ import("../db-GFSCDAHS.js")
158
159
  ]);
159
160
  const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
160
161
  const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
@@ -215,7 +216,7 @@ function newRunConversationId() {
215
216
  async function prepareLocalChatRun(io, pluginSet) {
216
217
  defaultStateAdapterForLocalChat();
217
218
  await configureLocalChatPlugins(pluginSet);
218
- const { runLocalAgentTurn } = await import("../runner-JALSYH2P.js");
219
+ const { runLocalAgentTurn } = await import("../runner-267ZRLZD.js");
219
220
  const deps = {
220
221
  agentRunner: createAgentRunner(executeAgentRun),
221
222
  deliverReply: async (reply) => {
@@ -13,14 +13,14 @@ import {
13
13
  import {
14
14
  setPlugins,
15
15
  validatePlugins
16
- } from "../chunk-5HLDPVYS.js";
16
+ } from "../chunk-FTTFV6DC.js";
17
17
  import "../chunk-WTYEKPXU.js";
18
18
  import {
19
19
  createPluginLogger
20
20
  } from "../chunk-EOWXRY5E.js";
21
21
  import {
22
22
  getDb
23
- } from "../chunk-35BNLDOJ.js";
23
+ } from "../chunk-OGHXZ4KQ.js";
24
24
  import "../chunk-G3E7SCME.js";
25
25
  import "../chunk-4ZNGQH7C.js";
26
26
  import "../chunk-EEZCY5WX.js";
@@ -4,7 +4,7 @@ import {
4
4
  recordConversationActivity,
5
5
  recordConversationExecution,
6
6
  requestConversationWork
7
- } from "../chunk-FBHZJFHI.js";
7
+ } from "../chunk-NJEDJFK4.js";
8
8
  import {
9
9
  defineJuniorPlugins,
10
10
  pluginCatalogConfigFromEnv,
@@ -13,14 +13,16 @@ import {
13
13
  } from "../chunk-SG5WAA7H.js";
14
14
  import {
15
15
  JUNIOR_THREAD_STATE_TTL_MS,
16
+ coerceThreadConversationState
17
+ } from "../chunk-6DTVCPLO.js";
18
+ import {
16
19
  addAgentTurnUsage,
17
- coerceThreadConversationState,
18
20
  listAgentTurnSessionSummariesForConversations
19
- } from "../chunk-WJOSZOON.js";
20
- import "../chunk-GUAP3H7O.js";
21
+ } from "../chunk-OL6XQ23W.js";
22
+ import "../chunk-DHHU2WSG.js";
21
23
  import {
22
24
  importConversationFromLegacy
23
- } from "../chunk-3F4OPKGF.js";
25
+ } from "../chunk-IO65E4ZD.js";
24
26
  import "../chunk-PDO5BLNM.js";
25
27
  import {
26
28
  loadAppPluginSet
@@ -34,7 +36,7 @@ import {
34
36
  createSqlConversationMessageStore,
35
37
  createSqlStore,
36
38
  getDb
37
- } from "../chunk-35BNLDOJ.js";
39
+ } from "../chunk-OGHXZ4KQ.js";
38
40
  import {
39
41
  disconnectStateAdapter,
40
42
  getChatConfig,
@@ -209,7 +211,7 @@ WHERE table_schema = 'public'
209
211
  `Cannot adopt partial legacy core migration state; missing: ${missingIds.join(", ")}`
210
212
  );
211
213
  }
212
- const migration = metrics?.complete ? migrations.at(-1) : migrations[0];
214
+ const migration = metrics?.complete ? migrations[1] : migrations[0];
213
215
  if (!migration) {
214
216
  throw new Error("No core Drizzle migrations were packaged");
215
217
  }
@@ -2,10 +2,11 @@ import {
2
2
  closeDb,
3
3
  getAgentStepStore,
4
4
  getConversationMessageStore,
5
+ getConversationSearchStore,
5
6
  getConversationStore,
6
7
  getDb,
7
8
  getSqlExecutor
8
- } from "./chunk-35BNLDOJ.js";
9
+ } from "./chunk-OGHXZ4KQ.js";
9
10
  import "./chunk-EEZCY5WX.js";
10
11
  import "./chunk-LVA4I4H7.js";
11
12
  import "./chunk-B7PUBQQM.js";
@@ -18,6 +19,7 @@ export {
18
19
  closeDb,
19
20
  getAgentStepStore,
20
21
  getConversationMessageStore,
22
+ getConversationSearchStore,
21
23
  getConversationStore,
22
24
  getDb,
23
25
  getSqlExecutor
@@ -0,0 +1,67 @@
1
+ import {
2
+ buildConversationDetail
3
+ } from "./chunk-ZZUBLPXD.js";
4
+ import {
5
+ readConversationRecordFromSql
6
+ } from "./chunk-KFUSLFLL.js";
7
+ import {
8
+ conversationDetailReportSchema
9
+ } from "./chunk-EUZ44ROE.js";
10
+ import "./chunk-LVUKF5CE.js";
11
+ import "./chunk-NG2AV7IB.js";
12
+ import {
13
+ listBoundedAgentTurnSessionSummariesForConversation
14
+ } from "./chunk-OL6XQ23W.js";
15
+ import "./chunk-DHHU2WSG.js";
16
+ import "./chunk-IO65E4ZD.js";
17
+ import "./chunk-PDO5BLNM.js";
18
+ import "./chunk-WTYEKPXU.js";
19
+ import "./chunk-OGHXZ4KQ.js";
20
+ import "./chunk-4ZNGQH7C.js";
21
+ import "./chunk-EEZCY5WX.js";
22
+ import "./chunk-LVA4I4H7.js";
23
+ import "./chunk-B7PUBQQM.js";
24
+ import {
25
+ logException
26
+ } from "./chunk-I35CTGPO.js";
27
+ import "./chunk-OB42YVAE.js";
28
+ import "./chunk-6GWA276C.js";
29
+ import "./chunk-7FBGKXPE.js";
30
+ import "./chunk-MLKGABMK.js";
31
+
32
+ // src/api/conversations/detail.query.ts
33
+ async function readLatestRun(conversationId) {
34
+ try {
35
+ return (await listBoundedAgentTurnSessionSummariesForConversation(conversationId)).find((summary) => summary.modelId || summary.reasoningLevel);
36
+ } catch (error) {
37
+ logException(error, "conversation_execution_settings_read_failed", {
38
+ conversationId
39
+ });
40
+ return void 0;
41
+ }
42
+ }
43
+ async function readConversationDetailFromSql(conversationId) {
44
+ const record = await readConversationRecordFromSql(conversationId);
45
+ if (!record) return void 0;
46
+ const [report, latestRun] = await Promise.all([
47
+ buildConversationDetail({
48
+ ...record,
49
+ usage: record.usage ?? void 0
50
+ }),
51
+ readLatestRun(conversationId)
52
+ ]);
53
+ return {
54
+ ...report,
55
+ ...latestRun?.modelId ? { modelId: latestRun.modelId } : {},
56
+ ...latestRun?.reasoningLevel ? { reasoningLevel: latestRun.reasoningLevel } : {}
57
+ };
58
+ }
59
+
60
+ // src/api/conversations/detail.ts
61
+ async function readConversationDetail(conversationId) {
62
+ const report = await readConversationDetailFromSql(conversationId);
63
+ return report ? conversationDetailReportSchema.parse(report) : void 0;
64
+ }
65
+ export {
66
+ readConversationDetail
67
+ };
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  ensureLegacyConversationImport,
3
3
  importConversationFromLegacy
4
- } from "./chunk-3F4OPKGF.js";
5
- import "./chunk-35BNLDOJ.js";
4
+ } from "./chunk-IO65E4ZD.js";
5
+ import "./chunk-OGHXZ4KQ.js";
6
6
  import "./chunk-EEZCY5WX.js";
7
7
  import "./chunk-LVA4I4H7.js";
8
8
  import "./chunk-B7PUBQQM.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  readConversationFeedFromSql
3
- } from "./chunk-ON6YKIQ7.js";
3
+ } from "./chunk-KFUSLFLL.js";
4
4
  import {
5
5
  conversationFeedSchema
6
- } from "./chunk-LUAE4MGW.js";
6
+ } from "./chunk-EUZ44ROE.js";
7
7
  import "./chunk-NG2AV7IB.js";
8
8
  import "./chunk-PDO5BLNM.js";
9
9
  import "./chunk-WTYEKPXU.js";
10
- import "./chunk-35BNLDOJ.js";
10
+ import "./chunk-OGHXZ4KQ.js";
11
11
  import "./chunk-4ZNGQH7C.js";
12
12
  import "./chunk-EEZCY5WX.js";
13
13
  import "./chunk-LVA4I4H7.js";
@@ -19,8 +19,10 @@ import "./chunk-7FBGKXPE.js";
19
19
  import "./chunk-MLKGABMK.js";
20
20
 
21
21
  // src/api/conversations/list.ts
22
- async function readConversationFeed() {
23
- return conversationFeedSchema.parse(await readConversationFeedFromSql());
22
+ async function readConversationFeed(options = {}) {
23
+ return conversationFeedSchema.parse(
24
+ await readConversationFeedFromSql({ actorEmail: options.actorEmail })
25
+ );
24
26
  }
25
27
  export {
26
28
  readConversationFeed
@@ -10,13 +10,13 @@ import {
10
10
  signals,
11
11
  summaryFromRow,
12
12
  usageTokens
13
- } from "./chunk-6U26PYI5.js";
13
+ } from "./chunk-CV22LUIV.js";
14
14
  import {
15
15
  actorDirectoryReportSchema
16
- } from "./chunk-VFH4ZKZT.js";
17
- import "./chunk-LUAE4MGW.js";
16
+ } from "./chunk-CRQVIHDI.js";
17
+ import "./chunk-EUZ44ROE.js";
18
18
  import "./chunk-PDO5BLNM.js";
19
- import "./chunk-35BNLDOJ.js";
19
+ import "./chunk-OGHXZ4KQ.js";
20
20
  import "./chunk-EEZCY5WX.js";
21
21
  import "./chunk-LVA4I4H7.js";
22
22
  import "./chunk-B7PUBQQM.js";
@@ -35,7 +35,6 @@ function directoryItem(accumulator) {
35
35
  durationMs: accumulator.durationMs,
36
36
  failed: accumulator.failed,
37
37
  firstSeenAt: new Date(accumulator.firstSeenMs).toISOString(),
38
- hung: accumulator.hung,
39
38
  lastSeenAt: new Date(accumulator.lastSeenMs).toISOString(),
40
39
  actor: accumulator.actor,
41
40
  ...accumulator.tokens !== void 0 ? { tokens: accumulator.tokens } : {}
@@ -46,7 +45,7 @@ async function readPeopleListFromSql() {
46
45
  const { rows, truncated } = await actorRows();
47
46
  const people = /* @__PURE__ */ new Map();
48
47
  for (const row of rows) {
49
- const summary = summaryFromRow(row, nowMs);
48
+ const summary = summaryFromRow(row);
50
49
  const actor = identityWithEmail(summary.actorIdentity);
51
50
  if (!actor) continue;
52
51
  const firstSeenMs = reportTime(summary.startedAt) ?? row.createdAt.getTime();
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  readConversationFeedFromSql
3
- } from "./chunk-ON6YKIQ7.js";
3
+ } from "./chunk-KFUSLFLL.js";
4
4
  import "./chunk-NG2AV7IB.js";
5
5
  import "./chunk-WTYEKPXU.js";
6
- import "./chunk-35BNLDOJ.js";
6
+ import "./chunk-OGHXZ4KQ.js";
7
7
  import "./chunk-4ZNGQH7C.js";
8
8
  import "./chunk-EEZCY5WX.js";
9
9
  import "./chunk-LVA4I4H7.js";
@@ -17,7 +17,7 @@ import "./chunk-MLKGABMK.js";
17
17
  // src/reporting/plugin-conversations.ts
18
18
  async function listRecentConversationSummaries(requestedLimit = 25) {
19
19
  const limit = Math.max(0, Math.min(100, Math.floor(requestedLimit)));
20
- const feed = await readConversationFeedFromSql(limit);
20
+ const feed = await readConversationFeedFromSql({ limit });
21
21
  return feed.conversations.map((report) => {
22
22
  return {
23
23
  conversationId: report.conversationId,
@@ -19,13 +19,13 @@ import {
19
19
  summaryFromRow,
20
20
  surfaceLabel,
21
21
  usageTokens
22
- } from "./chunk-6U26PYI5.js";
22
+ } from "./chunk-CV22LUIV.js";
23
23
  import {
24
24
  actorProfileReportSchema
25
- } from "./chunk-VFH4ZKZT.js";
26
- import "./chunk-LUAE4MGW.js";
25
+ } from "./chunk-CRQVIHDI.js";
26
+ import "./chunk-EUZ44ROE.js";
27
27
  import "./chunk-PDO5BLNM.js";
28
- import "./chunk-35BNLDOJ.js";
28
+ import "./chunk-OGHXZ4KQ.js";
29
29
  import "./chunk-EEZCY5WX.js";
30
30
  import "./chunk-LVA4I4H7.js";
31
31
  import "./chunk-B7PUBQQM.js";
@@ -72,7 +72,7 @@ async function readPeopleProfileFromSql(email) {
72
72
  const surfaces = /* @__PURE__ */ new Map();
73
73
  const recentConversations = [];
74
74
  for (const row of rows) {
75
- const summary = summaryFromRow(row, nowMs);
75
+ const summary = summaryFromRow(row);
76
76
  const identity = identityWithEmail(summary.actorIdentity);
77
77
  if (identity) {
78
78
  actor = actor ? mergeIdentity(actor, identity) : identity;
@@ -3,7 +3,7 @@ import {
3
3
  finalizeFailedTurnReply,
4
4
  processPluginTask,
5
5
  scheduleSessionCompletedPluginTasks
6
- } from "./chunk-T533JLM3.js";
6
+ } from "./chunk-ER45IV77.js";
7
7
  import "./chunk-KNFROR7R.js";
8
8
  import {
9
9
  coerceThreadArtifactsState,
@@ -13,14 +13,15 @@ import {
13
13
  markTurnFailed,
14
14
  persistThreadStateById,
15
15
  startActiveTurn
16
- } from "./chunk-WGXMTFNU.js";
16
+ } from "./chunk-WJ7STXT6.js";
17
17
  import {
18
18
  coerceThreadConversationState
19
- } from "./chunk-WJOSZOON.js";
19
+ } from "./chunk-6DTVCPLO.js";
20
+ import "./chunk-OL6XQ23W.js";
20
21
  import {
21
22
  commitMessages,
22
23
  loadProjection
23
- } from "./chunk-GUAP3H7O.js";
24
+ } from "./chunk-DHHU2WSG.js";
24
25
  import {
25
26
  buildConversationContext,
26
27
  hydrateConversationMessages,
@@ -28,12 +29,12 @@ import {
28
29
  normalizeConversationText,
29
30
  updateConversationStats,
30
31
  upsertConversationMessage
31
- } from "./chunk-3F4OPKGF.js";
32
+ } from "./chunk-IO65E4ZD.js";
32
33
  import "./chunk-PDO5BLNM.js";
33
- import "./chunk-5HLDPVYS.js";
34
+ import "./chunk-FTTFV6DC.js";
34
35
  import "./chunk-WTYEKPXU.js";
35
36
  import "./chunk-EOWXRY5E.js";
36
- import "./chunk-35BNLDOJ.js";
37
+ import "./chunk-OGHXZ4KQ.js";
37
38
  import "./chunk-G3E7SCME.js";
38
39
  import {
39
40
  sleep