@sentry/junior 0.204.0 → 0.206.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.
- package/dist/{agent-CMyTD4DD.js → agent-C9yuiZUF.js} +277 -85
- package/dist/{agent-hooks-Bbcp9e33.js → agent-hooks-DNjlz2A-.js} +1084 -16
- package/dist/{agent-runner-DNb1A49M.js → agent-runner-E67lFrDG.js} +5 -5
- package/dist/api/schema.d.ts +85 -0
- package/dist/api/schema.js +2 -2
- package/dist/api.js +44 -511
- package/dist/{app-B1TOqBI8.d.ts → app-AxGmJHwK.d.ts} +8 -0
- package/dist/app.d.ts +1 -1
- package/dist/app.js +56 -84
- package/dist/{auth-pause-state-DosEalIG.js → auth-pause-state-MVZ6xvEK.js} +6 -6
- package/dist/briefs-CvJFQvhJ.js +398 -0
- package/dist/{catalog-runtime-BReos-D4.js → catalog-runtime-TBR8n4e1.js} +1 -1
- package/dist/{checkpoint-CNrPyRJN.js → checkpoint-BY47jJCB.js} +7 -6
- package/dist/cli/chat.js +14 -12
- package/dist/cli/check.js +3 -3
- package/dist/cli/init.js +1 -0
- package/dist/cli/main.js +5 -1
- package/dist/cli/plugins.js +3 -3
- package/dist/cli/run.d.ts +2 -1
- package/dist/cli/run.js +2 -1
- package/dist/cli/snapshot-create.js +3 -3
- package/dist/cli/upgrade.js +3 -3
- package/dist/{config-nGCW1OTG.js → client-ceE7NtvC.js} +4 -367
- package/dist/config-CIE83sR2.js +386 -0
- package/dist/{schema-Rn8-XEaN.js → conversation-AA4R1VUn.js} +580 -558
- package/dist/{conversation-privacy-B4voFRSm.js → conversation-privacy-Auyq26XQ.js} +1 -1
- package/dist/{credential-sync-kXr1hvO1.js → credential-sync-BO33aNQd.js} +22 -20
- package/dist/{execution-stats-DWfSihcH.js → execution-stats-SiS2FLcv.js} +4 -4
- package/dist/{executor-DcMSlI5c.js → executor-BfbYPW63.js} +31 -3
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-Drn_LXlM.js → job-queue-CyTc24Es.js} +1 -1
- package/dist/{logging-BzAk1S_s.js → logging-D37bayDc.js} +1 -1
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-JiftokvA.js → oauth-callback-server-BtfOeHTZ.js} +2 -2
- package/dist/{pending-auth-CWmSdZVg.js → pending-auth-BPUzcs7n.js} +2 -2
- package/dist/{profile-CrT5nXbw.js → profile-CSixooTi.js} +4 -3
- package/dist/prompt-3gqNY1Ka.js +552 -0
- package/dist/{registry-DH1xUo2N.js → registry-DiR0-xRg.js} +1 -1
- package/dist/{resolve-CZHnfxaS.js → resolve-Bn5q__9b.js} +2 -2
- package/dist/{runner-CZV2sC46.js → runner-DFx3dIJH.js} +9 -9
- package/dist/{sandbox-egress-signals-bHZfmhbd.js → sandbox-egress-signals-bwvjihxA.js} +1 -1
- package/dist/schema-8GXFfclK.js +559 -0
- package/dist/{skills-CIcDQSgM.js → skills-BhM5qyCF.js} +2 -2
- package/dist/{spawn-DdkUFRmq.js → spawn-Dk0PqdH6.js} +2 -2
- package/dist/{stats-DTUbAb88.js → stats-DKRP4rsY.js} +26 -12
- package/dist/{task-queue-CJIR4RF7.js → task-queue-CdpTvu4R.js} +3 -3
- package/dist/{task-runner-D-O3A-Cp.js → task-runner-alpjVSxQ.js} +10 -10
- package/dist/{thread-state-CRc9jTJS.js → thread-state-CRK7aA41.js} +5 -5
- package/dist/{turn-execution-BkinIdJF.js → turn-execution-XtyzIHog.js} +3 -3
- package/dist/{turn-lifecycle-DQV19VTW.js → turn-lifecycle-VbwZLfBv.js} +1 -1
- package/dist/{usage-D3EbSO7w.js → usage-D4A48Bdl.js} +4 -125
- package/dist/{validation-C2CR-OX3.js → validation-jn_46o4U.js} +1 -1
- package/dist/{version-DxcWdoKa.js → version-DcfJxB4z.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/web-authorization-CsfLSfEs.js +38 -0
- package/dist/{web-input-3EPfpf55.js → web-input-BPp_sc7t.js} +6 -6
- package/dist/{work-fGofI7Op.js → work-Di-ubSGg.js} +9 -9
- package/dist/{worker-CsOLq-mR.js → worker-Cu_D5Mr8.js} +5 -4
- package/migrations/0040_conversation_briefs.sql +17 -0
- package/migrations/meta/0040_snapshot.json +3516 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +4 -4
- package/dist/history-CqTuSAdI.js +0 -441
- package/dist/usage-schema-CKaDkH_j.js +0 -20
- package/dist/web-authorization-RMBxAR_t.js +0 -76
package/dist/api.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { f as logWarn, u as logException } from "./logging-
|
|
1
|
+
import { f as logWarn, u as logException } from "./logging-D37bayDc.js";
|
|
2
2
|
import { _ as parseSlackMessageTs, h as parseSlackTeamId, p as parseSlackChannelId } from "./context-B45_WqVX.js";
|
|
3
|
-
import {
|
|
3
|
+
import { $ as resolveViewerUser, Ct as readConversationEventPage, D as SANDBOX_RUNTIME, Dt as listConversationAnnotationsById, Et as listConversationAnnotations, Ft as getConversationStore, Gt as resolveRootConversationId, Ht as locationFromRow, It as getDb, J as withSlackRetries, Lt as getSqlExecutor, S as WorkspaceValidationError, St as readLatestConversationBrief, U as getSlackClient, Wt as parseSessionSource, Z as findUserByEmail, _ as deleteWorkspace, b as listWorkspaces, bt as createPluginLogger, et as updateViewerDisplayName, g as createWorkspace, j as workspaceRepoCheckoutPath, u as getPlugins, v as getWorkspace, wt as buildSentryConversationUrl, x as updateWorkspace } from "./agent-hooks-DNjlz2A-.js";
|
|
4
4
|
import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
|
|
5
|
-
import { C as
|
|
6
|
-
import { o as
|
|
7
|
-
import { a as hasAgentTurnUsage, i as agentTurnUsageSchema,
|
|
8
|
-
import { n as hash, t as create } from "./profile-
|
|
9
|
-
import { A as eventTaskTriggerAvailable,
|
|
10
|
-
import { t as getCachedSnapshot } from "./resolve-
|
|
5
|
+
import { C as conversationReadColumns, E as juniorUsers, T as juniorIdentities, _ as juniorConversationEvents, b as juniorCodeChanges, g as juniorConversationBriefs, m as juniorConversationParticipants, o as juniorSchedulerTasks, v as juniorApiTokens, w as juniorConversations, x as juniorCodeRepositories } from "./executor-BfbYPW63.js";
|
|
6
|
+
import { D as createConversationBodySchema, O as createConversationMessageBodySchema, T as conversationStatsReportSchema, _ as conversationParamsSchema, a as cancelConversationPendingMessagesBodySchema, c as conversationAttachmentParamsSchema, d as conversationDetailReportSchema, g as conversationFeedSchema, h as conversationFeedQuerySchema, i as archiveConversationResponseSchema, m as conversationEventsQuerySchema, o as cancelConversationPendingMessagesResponseSchema, p as conversationEventPageSchema, r as archiveConversationBodySchema, t as acceptedConversationMessageSchema, u as conversationDetailQuerySchema, x as conversationPendingMessagesReportSchema } from "./conversation-AA4R1VUn.js";
|
|
7
|
+
import { a as hasAgentTurnUsage, i as agentTurnUsageSchema, s as fallbackShortTitle } from "./usage-D4A48Bdl.js";
|
|
8
|
+
import { n as hash, t as create } from "./profile-CSixooTi.js";
|
|
9
|
+
import { A as eventTaskTriggerAvailable, F as effectiveTaskOutcomes, G as listDeletedEventTasksCreatedBy, H as eventTaskBelongsToUser, J as listPublicEventTasksForTeams, K as listEventTasksCreatedBy, Tt as getConversation, V as deleteEventTask, W as getEventTask, X as getResourceEventCatalog, _ as parseScheduledTaskRow, c as parseSlackThreadId, ht as cancelHumanFacingPendingMessages, i as readLiveAttachment, m as listPublicScheduledTasksForTeams, n as readStats, p as isListedScheduledTask, v as readScheduledTask, y as saveScheduledTask } from "./stats-DKRP4rsY.js";
|
|
10
|
+
import { t as getCachedSnapshot } from "./resolve-Bn5q__9b.js";
|
|
11
11
|
import { t as getVercelConversationWorkQueue } from "./vercel-queue-DIkVcfK4.js";
|
|
12
12
|
import { c as runtimeInfoReportSchema, n as pluginOperationalReportFeedSchema, s as pluginsSchema, t as healthReportSchema, u as skillReportsSchema } from "./reporting-schema-DosTN__Q.js";
|
|
13
|
-
import { C as createVercelAttachmentStorage, S as legacyWebMailboxMetadataSchema, T as readHealthReport, _ as formatSlackConversationRedactedLabel, a as webActorFromEmail, b as resolveSlackConversationContextFromThreadId, c as conversationArchivedForEmail, d as conversationHasParticipantUser, f as conversationNotArchivedForEmail, l as conversationArchivedForUser, m as viewerConversationMembership, o as readConversationAccessFromSql, p as conversationNotArchivedForUser, r as createAndEnqueueConversation, s as conversationArchiveTimes, t as appendAndEnqueueWebMessage, u as conversationHasParticipantEmail, x as lookupSlackUser } from "./web-input-
|
|
14
|
-
import { a as readTaskExecutionStatusDays, c as readTaskExecutions, d as conversationActiveDaysColumn, f as conversationAggregateColumns, i as readTaskExecutionHours, l as readTaskRuns, n as readTaskExecutionByConversationId, o as readTaskExecutionStatusHours, p as conversationRangeColumns, r as readTaskExecutionDays, s as readTaskExecutionSummaries, t as emptyTaskRunWindows } from "./execution-stats-
|
|
15
|
-
import {
|
|
16
|
-
import { $ as sumUtcHoursIntoSixHours, A as actorProfileReportSchema,
|
|
13
|
+
import { C as createVercelAttachmentStorage, S as legacyWebMailboxMetadataSchema, T as readHealthReport, _ as formatSlackConversationRedactedLabel, a as webActorFromEmail, b as resolveSlackConversationContextFromThreadId, c as conversationArchivedForEmail, d as conversationHasParticipantUser, f as conversationNotArchivedForEmail, l as conversationArchivedForUser, m as viewerConversationMembership, o as readConversationAccessFromSql, p as conversationNotArchivedForUser, r as createAndEnqueueConversation, s as conversationArchiveTimes, t as appendAndEnqueueWebMessage, u as conversationHasParticipantEmail, x as lookupSlackUser } from "./web-input-BPp_sc7t.js";
|
|
14
|
+
import { a as readTaskExecutionStatusDays, c as readTaskExecutions, d as conversationActiveDaysColumn, f as conversationAggregateColumns, i as readTaskExecutionHours, l as readTaskRuns, n as readTaskExecutionByConversationId, o as readTaskExecutionStatusHours, p as conversationRangeColumns, r as readTaskExecutionDays, s as readTaskExecutionSummaries, t as emptyTaskRunWindows } from "./execution-stats-SiS2FLcv.js";
|
|
15
|
+
import { r as getWebAuthorization } from "./web-authorization-CsfLSfEs.js";
|
|
16
|
+
import { $ as sumUtcHoursIntoSixHours, A as actorProfileReportSchema, C as createPersonalTokenBodySchema, D as personalTokenParamsSchema, F as locationDirectoryReportSchema, G as codePersonReportSchema, I as locationParamsSchema, J as HOUR_MS$1, L as activityDays$1, M as personalSpendReportSchema, O as revokePersonalTokenResponseSchema, P as locationDetailReportSchema, Q as startOfUtcHour, R as activityHours$1, T as personalTokenListSchema, W as codeOverviewReportSchema, X as fillUtcHours, Y as fillUtcDays, Z as fillUtcSixHours, _ as taskListSchema, a as workspaceBodySchema, at as apiErrorSchema, et as trailingUtcDayWindow, f as taskExecutionListSchema, g as taskListQuerySchema, i as deleteWorkspaceResponseSchema, it as utcHourKey, j as personParamsSchema, k as actorDirectoryReportSchema, l as workspaceSchema, n as statsReportSchema, nt as trailingUtcSixHourWindow, o as workspaceListSchema, q as DAY_MS$1, rt as utcDayKey, s as workspaceParamsSchema, tt as trailingUtcHourWindow, v as taskParamsSchema, w as createdPersonalTokenSchema, y as taskRunListSchema, z as activitySixHours$1 } from "./schema-8GXFfclK.js";
|
|
17
17
|
import { Hono } from "hono";
|
|
18
18
|
import path from "node:path";
|
|
19
19
|
import { z } from "zod";
|
|
20
20
|
import { createHash, createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
21
|
-
import { and, asc, desc, eq,
|
|
21
|
+
import { and, asc, desc, eq, gt, gte, inArray, isNotNull, isNull, lt, lte, notExists, notInArray, or, sql } from "drizzle-orm";
|
|
22
22
|
import { conversationSidebarAnnotationSchema, pluginUserPageContentSchema, pluginUserPageCursorSchema, pluginUserPageFilterSchema, pluginUserPageLinksSchema, pluginUserPageQuerySchema } from "@sentry/junior-plugin-api";
|
|
23
23
|
import { alias } from "drizzle-orm/pg-core";
|
|
24
24
|
import { readFileSync } from "node:fs";
|
|
@@ -460,491 +460,6 @@ function decodeConversationCursor(args) {
|
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
462
|
//#endregion
|
|
463
|
-
//#region src/api/conversations/events.ts
|
|
464
|
-
/** Canonical event types that can contribute to the reporting projection. */
|
|
465
|
-
const conversationReportSourceEventTypes = [
|
|
466
|
-
"message",
|
|
467
|
-
"message_handled",
|
|
468
|
-
"assistant_message",
|
|
469
|
-
"tool_result",
|
|
470
|
-
"tool_execution_started",
|
|
471
|
-
"guardian_action_reviewed",
|
|
472
|
-
"turn_started",
|
|
473
|
-
"turn_context",
|
|
474
|
-
"structured_event",
|
|
475
|
-
"attachments_delivered",
|
|
476
|
-
"turn_routed",
|
|
477
|
-
"turn_completed",
|
|
478
|
-
"turn_failed",
|
|
479
|
-
"compaction",
|
|
480
|
-
"handoff",
|
|
481
|
-
"subagent_started",
|
|
482
|
-
"subagent_ended"
|
|
483
|
-
];
|
|
484
|
-
const reportingAssistantMessageSchema = z.object({
|
|
485
|
-
type: z.literal("assistant_message"),
|
|
486
|
-
content: z.array(z.unknown())
|
|
487
|
-
}).passthrough();
|
|
488
|
-
const reportingToolCallPartSchema = z.object({
|
|
489
|
-
type: z.literal("toolCall"),
|
|
490
|
-
id: z.string().min(1),
|
|
491
|
-
name: z.string().min(1),
|
|
492
|
-
arguments: z.unknown()
|
|
493
|
-
}).passthrough();
|
|
494
|
-
const reportingToolResultMessageSchema = z.object({
|
|
495
|
-
type: z.literal("tool_result"),
|
|
496
|
-
toolCallId: z.string().min(1),
|
|
497
|
-
toolName: z.string().min(1).optional(),
|
|
498
|
-
name: z.string().min(1).optional(),
|
|
499
|
-
content: z.array(z.unknown()),
|
|
500
|
-
details: z.unknown().optional(),
|
|
501
|
-
isError: z.boolean().optional()
|
|
502
|
-
}).passthrough();
|
|
503
|
-
const reportingToolResultDetailsSchema = z.object({
|
|
504
|
-
ok: z.boolean().optional(),
|
|
505
|
-
status: z.string().optional()
|
|
506
|
-
}).passthrough();
|
|
507
|
-
const reportingTextPartSchema = z.object({
|
|
508
|
-
type: z.literal("text"),
|
|
509
|
-
text: z.string()
|
|
510
|
-
}).passthrough();
|
|
511
|
-
const reportingReasoningPartSchema = z.object({
|
|
512
|
-
type: z.literal("thinking"),
|
|
513
|
-
thinking: z.string(),
|
|
514
|
-
redacted: z.literal(true).optional()
|
|
515
|
-
}).passthrough();
|
|
516
|
-
const reportingMediaPartSchema = z.object({
|
|
517
|
-
type: z.enum(["image", "audio"]),
|
|
518
|
-
mimeType: z.string().min(1).optional()
|
|
519
|
-
}).passthrough();
|
|
520
|
-
const reportingMessageAuthorSchema = z.object({
|
|
521
|
-
fullName: z.string().min(1).optional(),
|
|
522
|
-
userId: z.string().min(1).optional(),
|
|
523
|
-
userName: z.string().min(1).optional()
|
|
524
|
-
}).passthrough();
|
|
525
|
-
/** Retain model-visible text and media descriptors, dropping all opaque fields. */
|
|
526
|
-
function sanitizeModelContentPart(value) {
|
|
527
|
-
const text = reportingTextPartSchema.safeParse(value);
|
|
528
|
-
if (text.success) return {
|
|
529
|
-
type: "text",
|
|
530
|
-
text: text.data.text
|
|
531
|
-
};
|
|
532
|
-
const media = reportingMediaPartSchema.safeParse(value);
|
|
533
|
-
if (!media.success) return void 0;
|
|
534
|
-
return {
|
|
535
|
-
type: media.data.type,
|
|
536
|
-
...media.data.mimeType ? { mimeType: media.data.mimeType } : void 0
|
|
537
|
-
};
|
|
538
|
-
}
|
|
539
|
-
/** Convert allowlisted Pi content parts into the reporting result value. */
|
|
540
|
-
function modelVisibleToolOutput(content) {
|
|
541
|
-
const sanitized = content.map(sanitizeModelContentPart).filter((part) => part !== void 0);
|
|
542
|
-
if (sanitized.length === 0) return void 0;
|
|
543
|
-
if (sanitized.length !== 1) return sanitized;
|
|
544
|
-
const only = sanitized[0];
|
|
545
|
-
return only.type === "text" ? only.text : only;
|
|
546
|
-
}
|
|
547
|
-
function reportMessageActorIdentity(data) {
|
|
548
|
-
if (data.role !== "user") return void 0;
|
|
549
|
-
const author = reportingMessageAuthorSchema.safeParse(data.meta?.author);
|
|
550
|
-
if (!author.success) return void 0;
|
|
551
|
-
const actorIdentity = {
|
|
552
|
-
...author.data.fullName ? { fullName: author.data.fullName } : void 0,
|
|
553
|
-
...author.data.userId ? { slackUserId: author.data.userId } : void 0,
|
|
554
|
-
...author.data.userName ? { slackUserName: author.data.userName } : void 0
|
|
555
|
-
};
|
|
556
|
-
return Object.keys(actorIdentity).length > 0 ? actorIdentity : void 0;
|
|
557
|
-
}
|
|
558
|
-
/** Project native assistant tool calls through the existing reporting shape. */
|
|
559
|
-
function reportToolCalls(args) {
|
|
560
|
-
const message = reportingAssistantMessageSchema.safeParse(args.message);
|
|
561
|
-
if (!message.success) return void 0;
|
|
562
|
-
const calls = message.data.content.flatMap((part) => {
|
|
563
|
-
const call = reportingToolCallPartSchema.safeParse(part);
|
|
564
|
-
if (!call.success) return [];
|
|
565
|
-
return [{
|
|
566
|
-
toolCallId: call.data.id,
|
|
567
|
-
name: call.data.name,
|
|
568
|
-
status: "running",
|
|
569
|
-
startedAt: new Date(args.createdAtMs).toISOString(),
|
|
570
|
-
startedSeq: args.seq,
|
|
571
|
-
...args.canExposePayload && call.data.arguments !== void 0 ? { input: call.data.arguments } : void 0
|
|
572
|
-
}];
|
|
573
|
-
});
|
|
574
|
-
return calls.length > 0 ? {
|
|
575
|
-
type: "tool_calls",
|
|
576
|
-
calls
|
|
577
|
-
} : void 0;
|
|
578
|
-
}
|
|
579
|
-
/** Project assistant reasoning with tool ids retained only for display order. */
|
|
580
|
-
function reportAssistantMessage(args) {
|
|
581
|
-
const message = reportingAssistantMessageSchema.safeParse(args.message);
|
|
582
|
-
if (!message.success) return void 0;
|
|
583
|
-
if (!message.data.content.some((part) => {
|
|
584
|
-
const reasoning = reportingReasoningPartSchema.safeParse(part);
|
|
585
|
-
return reasoning.success && reasoning.data.redacted !== true && reasoning.data.thinking.trim().length > 0;
|
|
586
|
-
})) return reportToolCalls(args);
|
|
587
|
-
const reasoningParts = [];
|
|
588
|
-
const assistantParts = [];
|
|
589
|
-
for (const part of message.data.content) {
|
|
590
|
-
const reasoning = reportingReasoningPartSchema.safeParse(part);
|
|
591
|
-
if (reasoning.success) {
|
|
592
|
-
if (reasoning.data.redacted !== true && reasoning.data.thinking.trim().length > 0) {
|
|
593
|
-
const projected = {
|
|
594
|
-
type: "reasoning",
|
|
595
|
-
...args.canExposePayload ? { text: reasoning.data.thinking } : { redacted: true }
|
|
596
|
-
};
|
|
597
|
-
reasoningParts.push(projected);
|
|
598
|
-
assistantParts.push(projected);
|
|
599
|
-
}
|
|
600
|
-
continue;
|
|
601
|
-
}
|
|
602
|
-
const call = reportingToolCallPartSchema.safeParse(part);
|
|
603
|
-
if (call.success) assistantParts.push({
|
|
604
|
-
type: "tool_call",
|
|
605
|
-
toolCallId: call.data.id
|
|
606
|
-
});
|
|
607
|
-
}
|
|
608
|
-
const toolCalls = reportToolCalls(args);
|
|
609
|
-
if (toolCalls?.type === "tool_calls") return {
|
|
610
|
-
...toolCalls,
|
|
611
|
-
assistant: { parts: assistantParts }
|
|
612
|
-
};
|
|
613
|
-
return reasoningParts.length > 0 ? {
|
|
614
|
-
type: "assistant_message",
|
|
615
|
-
parts: reasoningParts
|
|
616
|
-
} : void 0;
|
|
617
|
-
}
|
|
618
|
-
/** Project a native tool result without exposing host-only result details. */
|
|
619
|
-
function reportToolResult(args) {
|
|
620
|
-
const message = reportingToolResultMessageSchema.safeParse(args.message);
|
|
621
|
-
if (!message.success) return void 0;
|
|
622
|
-
const details = reportingToolResultDetailsSchema.safeParse(message.data.details);
|
|
623
|
-
const outcome = message.data.isError === true || details.success && (details.data.ok === false || details.data.status === "error") ? "error" : "completed";
|
|
624
|
-
const output = modelVisibleToolOutput(message.data.content);
|
|
625
|
-
const name = message.data.toolName ?? message.data.name ?? args.start?.name;
|
|
626
|
-
if (!name) return void 0;
|
|
627
|
-
return {
|
|
628
|
-
type: "tool_calls",
|
|
629
|
-
calls: [{
|
|
630
|
-
toolCallId: message.data.toolCallId,
|
|
631
|
-
name,
|
|
632
|
-
status: outcome,
|
|
633
|
-
...args.start ? {
|
|
634
|
-
startedAt: new Date(args.start.createdAtMs).toISOString(),
|
|
635
|
-
startedSeq: args.start.seq
|
|
636
|
-
} : void 0,
|
|
637
|
-
...args.canExposePayload && output !== void 0 ? { output } : void 0
|
|
638
|
-
}]
|
|
639
|
-
};
|
|
640
|
-
}
|
|
641
|
-
/** Return tool result ids that may need start metadata from outside a page. */
|
|
642
|
-
function conversationReportToolResultIds(events) {
|
|
643
|
-
return [...new Set(events.flatMap((event) => {
|
|
644
|
-
const result = reportingToolResultMessageSchema.safeParse(event.data);
|
|
645
|
-
return result.success ? [result.data.toolCallId] : [];
|
|
646
|
-
}))];
|
|
647
|
-
}
|
|
648
|
-
function reportEventData(args) {
|
|
649
|
-
const { data } = args;
|
|
650
|
-
if (data.type === "structured_event") {
|
|
651
|
-
if (!args.canExposePayload) return void 0;
|
|
652
|
-
const presentation = data.namespace === "junior" ? renderJuniorNativeConversationEvent(data) : renderPluginConversationEvent(data);
|
|
653
|
-
if (!presentation) return void 0;
|
|
654
|
-
return {
|
|
655
|
-
type: "structured_event",
|
|
656
|
-
namespace: data.namespace,
|
|
657
|
-
name: data.name,
|
|
658
|
-
version: data.version,
|
|
659
|
-
...data.turnId ? { turnId: data.turnId } : void 0,
|
|
660
|
-
presentation
|
|
661
|
-
};
|
|
662
|
-
}
|
|
663
|
-
switch (data.type) {
|
|
664
|
-
case "message": {
|
|
665
|
-
const actorIdentity = args.canExposePayload ? reportMessageActorIdentity(data) : void 0;
|
|
666
|
-
return {
|
|
667
|
-
type: "message",
|
|
668
|
-
messageId: data.messageId,
|
|
669
|
-
role: data.role,
|
|
670
|
-
...data.meta?.source === "web" || data.meta?.source === "slack" ? { source: data.meta.source } : void 0,
|
|
671
|
-
...actorIdentity ? { actorIdentity } : void 0,
|
|
672
|
-
...typeof data.meta?.eventType === "string" ? { eventType: data.meta.eventType } : void 0,
|
|
673
|
-
...typeof data.meta?.explicitMention === "boolean" ? { explicitMention: data.meta.explicitMention } : void 0,
|
|
674
|
-
...args.canExposePayload && typeof data.meta?.trustedSummary === "string" ? { trustedSummary: data.meta.trustedSummary } : void 0,
|
|
675
|
-
...args.canExposePayload ? { text: data.text } : { redacted: true }
|
|
676
|
-
};
|
|
677
|
-
}
|
|
678
|
-
case "message_handled": return {
|
|
679
|
-
type: "message_handled",
|
|
680
|
-
messageId: data.messageId
|
|
681
|
-
};
|
|
682
|
-
case "turn_started": return {
|
|
683
|
-
type: "turn_lifecycle",
|
|
684
|
-
turnId: data.turnId,
|
|
685
|
-
state: "started",
|
|
686
|
-
...data.inputMessageIds.length > 0 ? { inputMessageIds: data.inputMessageIds } : void 0
|
|
687
|
-
};
|
|
688
|
-
case "turn_context":
|
|
689
|
-
if (!args.canExposePayload) return;
|
|
690
|
-
return {
|
|
691
|
-
type: "turn_context",
|
|
692
|
-
turnId: data.turnId,
|
|
693
|
-
pluginName: data.pluginName,
|
|
694
|
-
kind: data.kind,
|
|
695
|
-
version: data.version,
|
|
696
|
-
content: data.content
|
|
697
|
-
};
|
|
698
|
-
case "attachments_delivered":
|
|
699
|
-
if (!args.canExposePayload) return;
|
|
700
|
-
return {
|
|
701
|
-
type: "attachments_delivered",
|
|
702
|
-
attachments: data.attachments
|
|
703
|
-
};
|
|
704
|
-
case "turn_routed": return {
|
|
705
|
-
type: "turn_routed",
|
|
706
|
-
turnId: data.turnId,
|
|
707
|
-
modelProfile: data.modelProfile,
|
|
708
|
-
modelId: data.modelId,
|
|
709
|
-
...data.costUsd !== void 0 ? { costUsd: data.costUsd } : void 0,
|
|
710
|
-
reasoningLevel: data.reasoningLevel,
|
|
711
|
-
...data.confidence !== void 0 ? { confidence: data.confidence } : void 0,
|
|
712
|
-
source: data.source
|
|
713
|
-
};
|
|
714
|
-
case "guardian_action_reviewed": return {
|
|
715
|
-
type: "guardian_action_reviewed",
|
|
716
|
-
turnId: data.turnId,
|
|
717
|
-
toolCallId: data.toolCallId,
|
|
718
|
-
toolName: data.toolName,
|
|
719
|
-
decision: data.decision,
|
|
720
|
-
riskLevel: data.riskLevel,
|
|
721
|
-
userAuthorization: data.userAuthorization
|
|
722
|
-
};
|
|
723
|
-
case "turn_completed": return {
|
|
724
|
-
type: "turn_lifecycle",
|
|
725
|
-
turnId: data.turnId,
|
|
726
|
-
state: data.outcome === "success" ? "succeeded" : "no_reply"
|
|
727
|
-
};
|
|
728
|
-
case "turn_failed": {
|
|
729
|
-
const eventId = data.eventId;
|
|
730
|
-
const sentryEventUrl = eventId ? buildSentryEventUrl(eventId) : void 0;
|
|
731
|
-
return {
|
|
732
|
-
type: "turn_lifecycle",
|
|
733
|
-
turnId: data.turnId,
|
|
734
|
-
state: "failed",
|
|
735
|
-
failureCode: data.failureCode,
|
|
736
|
-
...data.failureReason ? { failureReason: data.failureReason } : void 0,
|
|
737
|
-
...eventId ? { eventId } : void 0,
|
|
738
|
-
...sentryEventUrl ? { sentryEventUrl } : void 0
|
|
739
|
-
};
|
|
740
|
-
}
|
|
741
|
-
case "compaction": return {
|
|
742
|
-
type: "compaction",
|
|
743
|
-
modelProfile: data.modelProfile,
|
|
744
|
-
modelId: data.modelId,
|
|
745
|
-
...args.canExposePayload && data.summary ? { summary: data.summary } : void 0,
|
|
746
|
-
...data.details ? { details: data.details } : void 0
|
|
747
|
-
};
|
|
748
|
-
default: return;
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
/**
|
|
752
|
-
* Project canonical events into the ordered reporting boundary.
|
|
753
|
-
*
|
|
754
|
-
* `canExposePayload` must come from the authorized conversation-detail policy;
|
|
755
|
-
* this projection never derives visibility or authorization from event data.
|
|
756
|
-
*/
|
|
757
|
-
function projectConversationReportEventPage(args) {
|
|
758
|
-
const subagentStarts = /* @__PURE__ */ new Map();
|
|
759
|
-
for (const event of args.subagentStartEvents ?? []) if (event.data.type === "subagent_started") subagentStarts.set(event.data.subagentInvocationId, {
|
|
760
|
-
createdAtMs: event.createdAtMs,
|
|
761
|
-
data: event.data,
|
|
762
|
-
seq: event.seq
|
|
763
|
-
});
|
|
764
|
-
const toolStarts = /* @__PURE__ */ new Map();
|
|
765
|
-
for (const event of args.toolStartEvents ?? []) if (event.data.type === "tool_execution_started") {
|
|
766
|
-
const current = toolStarts.get(event.data.toolCallId);
|
|
767
|
-
if (!current || event.seq < current.seq) toolStarts.set(event.data.toolCallId, {
|
|
768
|
-
createdAtMs: event.createdAtMs,
|
|
769
|
-
name: event.data.toolName,
|
|
770
|
-
seq: event.seq
|
|
771
|
-
});
|
|
772
|
-
}
|
|
773
|
-
const projected = [];
|
|
774
|
-
for (const event of args.events) {
|
|
775
|
-
let data;
|
|
776
|
-
if (event.data.type === "assistant_message" || event.data.type === "tool_result") {
|
|
777
|
-
const reportArgs = {
|
|
778
|
-
canExposePayload: args.canExposePayload,
|
|
779
|
-
createdAtMs: event.createdAtMs,
|
|
780
|
-
message: event.data,
|
|
781
|
-
seq: event.seq
|
|
782
|
-
};
|
|
783
|
-
const result = reportingToolResultMessageSchema.safeParse(event.data);
|
|
784
|
-
const start = result.success ? toolStarts.get(result.data.toolCallId) : void 0;
|
|
785
|
-
data = reportAssistantMessage(reportArgs) ?? reportToolResult({
|
|
786
|
-
canExposePayload: args.canExposePayload,
|
|
787
|
-
message: event.data,
|
|
788
|
-
...start && start.seq < event.seq ? { start } : void 0
|
|
789
|
-
});
|
|
790
|
-
} else if (event.data.type === "tool_execution_started") {
|
|
791
|
-
toolStarts.set(event.data.toolCallId, {
|
|
792
|
-
createdAtMs: event.createdAtMs,
|
|
793
|
-
name: event.data.toolName,
|
|
794
|
-
seq: event.seq
|
|
795
|
-
});
|
|
796
|
-
data = {
|
|
797
|
-
type: "tool_calls",
|
|
798
|
-
calls: [{
|
|
799
|
-
toolCallId: event.data.toolCallId,
|
|
800
|
-
name: event.data.toolName,
|
|
801
|
-
status: "running",
|
|
802
|
-
startedAt: new Date(event.createdAtMs).toISOString(),
|
|
803
|
-
startedSeq: event.seq
|
|
804
|
-
}]
|
|
805
|
-
};
|
|
806
|
-
} else if (event.data.type === "subagent_started") {
|
|
807
|
-
subagentStarts.set(event.data.subagentInvocationId, {
|
|
808
|
-
createdAtMs: event.createdAtMs,
|
|
809
|
-
data: event.data,
|
|
810
|
-
seq: event.seq
|
|
811
|
-
});
|
|
812
|
-
data = {
|
|
813
|
-
type: "subagent",
|
|
814
|
-
startedSeq: event.seq,
|
|
815
|
-
startedAt: new Date(event.createdAtMs).toISOString(),
|
|
816
|
-
childConversationId: event.data.childConversationId,
|
|
817
|
-
subagentKind: event.data.subagentKind,
|
|
818
|
-
status: "running",
|
|
819
|
-
...event.data.parentToolCallId ? { parentToolCallId: event.data.parentToolCallId } : void 0
|
|
820
|
-
};
|
|
821
|
-
} else if (event.data.type === "subagent_ended") {
|
|
822
|
-
const started = subagentStarts.get(event.data.subagentInvocationId);
|
|
823
|
-
if (started && started.seq < event.seq) {
|
|
824
|
-
data = {
|
|
825
|
-
type: "subagent",
|
|
826
|
-
startedSeq: started.seq,
|
|
827
|
-
startedAt: new Date(started.createdAtMs).toISOString(),
|
|
828
|
-
childConversationId: started.data.childConversationId,
|
|
829
|
-
subagentKind: started.data.subagentKind,
|
|
830
|
-
...started.data.parentToolCallId ? { parentToolCallId: started.data.parentToolCallId } : void 0,
|
|
831
|
-
status: event.data.outcome === "success" ? "completed" : event.data.outcome
|
|
832
|
-
};
|
|
833
|
-
subagentStarts.delete(event.data.subagentInvocationId);
|
|
834
|
-
}
|
|
835
|
-
} else if (event.data.type === "handoff") data = {
|
|
836
|
-
type: "handoff",
|
|
837
|
-
modelProfile: event.data.modelProfile,
|
|
838
|
-
modelId: event.data.modelId,
|
|
839
|
-
...event.data.reasoningLevel ? { reasoningLevel: event.data.reasoningLevel } : void 0,
|
|
840
|
-
...event.data.triggeringToolCallId ? { triggeringToolCallId: event.data.triggeringToolCallId } : void 0,
|
|
841
|
-
...args.canExposePayload && event.data.summary ? { summary: event.data.summary } : void 0
|
|
842
|
-
};
|
|
843
|
-
else data = reportEventData({
|
|
844
|
-
canExposePayload: args.canExposePayload,
|
|
845
|
-
data: event.data
|
|
846
|
-
});
|
|
847
|
-
if (!data) continue;
|
|
848
|
-
projected.push(conversationReportEventSchema.parse({
|
|
849
|
-
seq: event.seq,
|
|
850
|
-
createdAt: new Date(event.createdAtMs).toISOString(),
|
|
851
|
-
data
|
|
852
|
-
}));
|
|
853
|
-
}
|
|
854
|
-
return projected;
|
|
855
|
-
}
|
|
856
|
-
//#endregion
|
|
857
|
-
//#region src/api/conversations/event-page.ts
|
|
858
|
-
const conversationEventColumns = getTableColumns(juniorConversationEvents);
|
|
859
|
-
const MIN_SCAN_SIZE = 64;
|
|
860
|
-
/** Read bounded canonical rows while excluding model-only replacement history. */
|
|
861
|
-
async function readConversationEventRows(executor, args) {
|
|
862
|
-
return executor.db().select({
|
|
863
|
-
...conversationEventColumns,
|
|
864
|
-
payload: sql`case
|
|
865
|
-
when ${juniorConversationEvents.type} in ('compaction', 'handoff')
|
|
866
|
-
then jsonb_set(
|
|
867
|
-
${juniorConversationEvents.payload},
|
|
868
|
-
'{replacementHistory}',
|
|
869
|
-
'[]'::jsonb
|
|
870
|
-
)
|
|
871
|
-
else ${juniorConversationEvents.payload}
|
|
872
|
-
end`
|
|
873
|
-
}).from(juniorConversationEvents).where(and(eq(juniorConversationEvents.conversationId, args.conversationId), args.beforeSeq === void 0 ? void 0 : lt(juniorConversationEvents.seq, args.beforeSeq), inArray(juniorConversationEvents.type, args.types ?? [...conversationReportSourceEventTypes]), args.subagentInvocationIds === void 0 ? void 0 : inArray(sql`${juniorConversationEvents.payload}->>'subagentInvocationId'`, args.subagentInvocationIds), args.toolCallIds === void 0 ? void 0 : inArray(sql`${juniorConversationEvents.payload}->>'toolCallId'`, args.toolCallIds))).orderBy(args.direction === "forward" ? asc(juniorConversationEvents.seq) : desc(juniorConversationEvents.seq)).limit(args.limit);
|
|
874
|
-
}
|
|
875
|
-
function decodeConversationEventRow(row) {
|
|
876
|
-
return decodeStoredConversationEvent({
|
|
877
|
-
schemaVersion: row.schemaVersion,
|
|
878
|
-
seq: row.seq,
|
|
879
|
-
historyVersion: row.historyVersion,
|
|
880
|
-
...row.idempotencyKey ? { idempotencyKey: row.idempotencyKey } : void 0,
|
|
881
|
-
createdAtMs: row.createdAt.getTime(),
|
|
882
|
-
type: row.type,
|
|
883
|
-
payload: row.payload
|
|
884
|
-
});
|
|
885
|
-
}
|
|
886
|
-
/** Project stored rows and resolve entity starts that precede the page. */
|
|
887
|
-
async function projectConversationEventRows(executor, args) {
|
|
888
|
-
const events = args.rows.map(decodeConversationEventRow).sort((left, right) => left.seq - right.seq);
|
|
889
|
-
const endedInvocationIds = [...new Set(events.flatMap((event) => event.data.type === "subagent_ended" ? [event.data.subagentInvocationId] : []))];
|
|
890
|
-
const subagentStartRows = endedInvocationIds.length === 0 ? [] : await readConversationEventRows(executor, {
|
|
891
|
-
conversationId: args.conversationId,
|
|
892
|
-
direction: "forward",
|
|
893
|
-
limit: endedInvocationIds.length,
|
|
894
|
-
subagentInvocationIds: endedInvocationIds,
|
|
895
|
-
types: ["subagent_started"]
|
|
896
|
-
});
|
|
897
|
-
const toolResultIds = conversationReportToolResultIds(events);
|
|
898
|
-
const toolStartRows = toolResultIds.length === 0 ? [] : await readConversationEventRows(executor, {
|
|
899
|
-
conversationId: args.conversationId,
|
|
900
|
-
direction: "forward",
|
|
901
|
-
limit: toolResultIds.length,
|
|
902
|
-
toolCallIds: toolResultIds,
|
|
903
|
-
types: ["tool_execution_started"]
|
|
904
|
-
});
|
|
905
|
-
return projectConversationReportEventPage({
|
|
906
|
-
canExposePayload: args.canExposePayload,
|
|
907
|
-
events,
|
|
908
|
-
subagentStartEvents: subagentStartRows.map(decodeConversationEventRow),
|
|
909
|
-
toolStartEvents: toolStartRows.map(decodeConversationEventRow)
|
|
910
|
-
});
|
|
911
|
-
}
|
|
912
|
-
/**
|
|
913
|
-
* Read the latest reporting events before an exclusive boundary.
|
|
914
|
-
*
|
|
915
|
-
* Source rows are scanned in bounded chunks until the requested projected page
|
|
916
|
-
* and one older event are known. This keeps ordinary pages bounded without
|
|
917
|
-
* assuming every agent history event produces a reporting event.
|
|
918
|
-
*/
|
|
919
|
-
async function readConversationEventPage(executor, args) {
|
|
920
|
-
const scanSize = Math.max(args.limit + 1, MIN_SCAN_SIZE);
|
|
921
|
-
const rows = [];
|
|
922
|
-
let beforeSeq = args.beforeSeq;
|
|
923
|
-
let projected = [];
|
|
924
|
-
while (projected.length <= args.limit) {
|
|
925
|
-
const batch = await readConversationEventRows(executor, {
|
|
926
|
-
beforeSeq,
|
|
927
|
-
conversationId: args.conversationId,
|
|
928
|
-
direction: "backward",
|
|
929
|
-
limit: scanSize
|
|
930
|
-
});
|
|
931
|
-
if (batch.length === 0) break;
|
|
932
|
-
rows.push(...batch);
|
|
933
|
-
projected = await projectConversationEventRows(executor, {
|
|
934
|
-
canExposePayload: args.canExposePayload,
|
|
935
|
-
conversationId: args.conversationId,
|
|
936
|
-
rows
|
|
937
|
-
});
|
|
938
|
-
if (projected.length > args.limit || batch.length < scanSize) break;
|
|
939
|
-
beforeSeq = batch.at(-1).seq;
|
|
940
|
-
}
|
|
941
|
-
const events = projected.slice(-args.limit);
|
|
942
|
-
return {
|
|
943
|
-
events,
|
|
944
|
-
...projected.length > events.length && events[0] ? { previousSeq: events[0].seq } : void 0
|
|
945
|
-
};
|
|
946
|
-
}
|
|
947
|
-
//#endregion
|
|
948
463
|
//#region src/api/conversations/shared.ts
|
|
949
464
|
/** Format a Slack destination without exposing private channel names. */
|
|
950
465
|
function slackStatsLocationLabel(input) {
|
|
@@ -1389,19 +904,18 @@ async function readConversationActivityPreviews(db, conversationIds) {
|
|
|
1389
904
|
//#endregion
|
|
1390
905
|
//#region src/api/conversations/list.ts
|
|
1391
906
|
const CONVERSATION_FEED_LIMIT = 50;
|
|
1392
|
-
|
|
1393
|
-
function conversationFeedMembershipFilter(status, filter, archivedAfter) {
|
|
907
|
+
function conversationFeedMembershipFilter(status, filter) {
|
|
1394
908
|
if (!filter) return status === "archived" ? sql`false` : void 0;
|
|
1395
909
|
if (filter.kind === "viewer") return and(viewerConversationMembership({
|
|
1396
910
|
actorMatch: eq(juniorIdentities.userId, filter.userId),
|
|
1397
911
|
participantMatch: conversationHasParticipantUser(filter.userId)
|
|
1398
|
-
}), status === "archived" ? conversationArchivedForUser(filter.userId) : status === "all" ? void 0 :
|
|
912
|
+
}), status === "archived" ? conversationArchivedForUser(filter.userId) : status === "all" ? void 0 : conversationNotArchivedForUser(filter.userId));
|
|
1399
913
|
return and(viewerConversationMembership({
|
|
1400
914
|
actorMatch: eq(juniorUsers.primaryEmailNormalized, filter.email),
|
|
1401
915
|
participantMatch: conversationHasParticipantEmail(filter.email)
|
|
1402
|
-
}), status === "archived" ? conversationArchivedForEmail(filter.email) : status === "all" ? void 0 :
|
|
916
|
+
}), status === "archived" ? conversationArchivedForEmail(filter.email) : status === "all" ? void 0 : conversationNotArchivedForEmail(filter.email));
|
|
1403
917
|
}
|
|
1404
|
-
async function conversationRows(db, limit, status, filter,
|
|
918
|
+
async function conversationRows(db, limit, status, filter, query, includePrivateBriefs = false) {
|
|
1405
919
|
return db.select({
|
|
1406
920
|
conversation: conversationReadColumns(),
|
|
1407
921
|
location: juniorDestinations,
|
|
@@ -1412,7 +926,19 @@ async function conversationRows(db, limit, status, filter, archivedAfter, query)
|
|
|
1412
926
|
identitySubjectId: juniorIdentities.providerSubjectId,
|
|
1413
927
|
identityTenantId: juniorIdentities.providerTenantId,
|
|
1414
928
|
userDisplayName: juniorUsers.displayName
|
|
1415
|
-
}).from(juniorConversations).leftJoin(juniorDestinations, eq(juniorDestinations.id, juniorConversations.destinationId)).leftJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId)).leftJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(and(isNull(juniorConversations.parentConversationId), conversationFeedMembershipFilter(status, filter
|
|
929
|
+
}).from(juniorConversations).leftJoin(juniorDestinations, eq(juniorDestinations.id, juniorConversations.destinationId)).leftJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId)).leftJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(and(isNull(juniorConversations.parentConversationId), conversationFeedMembershipFilter(status, filter), query ? or(sql`strpos(lower(coalesce(${juniorConversations.title}, '')), ${query}) > 0`, sql`exists (
|
|
930
|
+
select 1
|
|
931
|
+
from ${juniorConversationBriefs}
|
|
932
|
+
where ${juniorConversationBriefs.conversationId} = ${juniorConversations.conversationId}
|
|
933
|
+
and ${includePrivateBriefs ? sql`true` : eq(juniorDestinations.visibility, "public")}
|
|
934
|
+
and ${juniorConversationBriefs.version} = (
|
|
935
|
+
select max(${juniorConversationBriefs.version})
|
|
936
|
+
from ${juniorConversationBriefs}
|
|
937
|
+
where ${juniorConversationBriefs.conversationId} = ${juniorConversations.conversationId}
|
|
938
|
+
)
|
|
939
|
+
and to_tsvector('english', ${juniorConversationBriefs.searchText})
|
|
940
|
+
@@ websearch_to_tsquery('english', ${query})
|
|
941
|
+
)`) : void 0)).orderBy(desc(juniorConversations.lastActivityAt), asc(juniorConversations.conversationId)).limit(limit);
|
|
1416
942
|
}
|
|
1417
943
|
/** Decode a conversation row with the linked user name and identity-scoped provider fields. */
|
|
1418
944
|
function conversationFromRow(row) {
|
|
@@ -1490,7 +1016,7 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
1490
1016
|
const db = getDb();
|
|
1491
1017
|
const filter = conversationFeedFilter(options);
|
|
1492
1018
|
const query = options.q?.trim().toLowerCase() || void 0;
|
|
1493
|
-
const rows = await conversationRows(db, options.limit ?? CONVERSATION_FEED_LIMIT, query ? "all" : options.status ?? "active", filter,
|
|
1019
|
+
const rows = await conversationRows(db, options.limit ?? CONVERSATION_FEED_LIMIT, query ? "all" : options.status ?? "active", filter, query, filter?.kind === "viewer");
|
|
1494
1020
|
const conversations = rows.map((row) => conversationFromRow(row));
|
|
1495
1021
|
const conversationIds = conversations.map((conversation) => conversation.conversationId);
|
|
1496
1022
|
const [accessByConversation, archiveTimesByConversation, annotationsByConversation, auxiliaryCostsByRoot, metricsByRoot, teamDomainByTeamId, conversationWork, lastUserMessageAtByConversation, activityPreviewByConversation] = await Promise.all([
|
|
@@ -2072,6 +1598,7 @@ function projectConversationDetail(args) {
|
|
|
2072
1598
|
usage: args.usage
|
|
2073
1599
|
}),
|
|
2074
1600
|
annotations: canExposePayload ? args.annotations : [],
|
|
1601
|
+
...canExposePayload && args.brief ? { brief: args.brief } : void 0,
|
|
2075
1602
|
events: args.events,
|
|
2076
1603
|
...args.previousSeq !== void 0 ? { previousCursor: encodeConversationCursor({
|
|
2077
1604
|
conversationId,
|
|
@@ -2093,10 +1620,11 @@ async function readConversationDetailFromSql(conversationId, options) {
|
|
|
2093
1620
|
const archivedAtMs = options.viewer ? await readConversationArchivedAt(options.viewer, conversationId) : void 0;
|
|
2094
1621
|
const executor = getSqlExecutor();
|
|
2095
1622
|
const includeDescendantMetrics = record.rootConversationId === conversationId;
|
|
2096
|
-
const [accessByConversation, annotations, auxiliaryCostsByConversation, modelUsage, metricsByRoot, sourceTask, teamDomainByTeamId] = await Promise.all([
|
|
1623
|
+
const [accessByConversation, annotations, auxiliaryCostsByConversation, briefVersion, modelUsage, metricsByRoot, sourceTask, teamDomainByTeamId] = await Promise.all([
|
|
2097
1624
|
readConversationAccessFromSql(getDb(), [conversationId], options.viewer),
|
|
2098
1625
|
listConversationAnnotations(getDb(), conversationId),
|
|
2099
1626
|
readConversationAuxiliaryCostsFromSql(getDb(), [conversationId], { includeDescendants: includeDescendantMetrics }),
|
|
1627
|
+
readLatestConversationBrief(getDb(), conversationId),
|
|
2100
1628
|
record.conversation.transcriptPurgedAtMs === void 0 ? readConversationModelUsageFromSql(executor, {
|
|
2101
1629
|
conversationId,
|
|
2102
1630
|
includeDescendants: includeDescendantMetrics
|
|
@@ -2121,6 +1649,11 @@ async function readConversationDetailFromSql(conversationId, options) {
|
|
|
2121
1649
|
...archivedAtMs === void 0 ? void 0 : { archivedAtMs },
|
|
2122
1650
|
annotations,
|
|
2123
1651
|
auxiliaryCosts: auxiliaryCostsByConversation.get(conversationId),
|
|
1652
|
+
...briefVersion ? { brief: {
|
|
1653
|
+
content: briefVersion.content,
|
|
1654
|
+
updatedAt: briefVersion.createdAt.toISOString(),
|
|
1655
|
+
version: briefVersion.version
|
|
1656
|
+
} } : void 0,
|
|
2124
1657
|
durationMs: metrics?.durationMs ?? record.durationMs,
|
|
2125
1658
|
events: page.events,
|
|
2126
1659
|
modelUsage,
|
|
@@ -3876,7 +3409,7 @@ async function readPeoplePluginReports(args) {
|
|
|
3876
3409
|
reports: [],
|
|
3877
3410
|
source: "plugins"
|
|
3878
3411
|
});
|
|
3879
|
-
const { getPluginProfileReports } = await import("./agent-hooks-
|
|
3412
|
+
const { getPluginProfileReports } = await import("./agent-hooks-DNjlz2A-.js").then((n) => n.t);
|
|
3880
3413
|
return pluginOperationalReportFeedSchema.parse({
|
|
3881
3414
|
generatedAt: new Date(nowMs).toISOString(),
|
|
3882
3415
|
reports: await getPluginProfileReports({
|
|
@@ -4485,7 +4018,7 @@ function readDescriptionText(home) {
|
|
|
4485
4018
|
}
|
|
4486
4019
|
/** Read discovered skill names for authenticated runtime diagnostics. */
|
|
4487
4020
|
async function readSkillReports() {
|
|
4488
|
-
const { discoverSkills } = await import("./skills-
|
|
4021
|
+
const { discoverSkills } = await import("./skills-BhM5qyCF.js").then((n) => n.o);
|
|
4489
4022
|
const skills = await discoverSkills();
|
|
4490
4023
|
return skillReportsSchema.parse(skills.map((skill) => ({
|
|
4491
4024
|
name: skill.name,
|
|
@@ -4494,7 +4027,7 @@ async function readSkillReports() {
|
|
|
4494
4027
|
}
|
|
4495
4028
|
/** Read safe configured plugin metadata for authenticated runtime diagnostics. */
|
|
4496
4029
|
async function readPlugins() {
|
|
4497
|
-
const { pluginCatalogRuntime } = await import("./catalog-runtime-
|
|
4030
|
+
const { pluginCatalogRuntime } = await import("./catalog-runtime-TBR8n4e1.js").then((n) => n.t);
|
|
4498
4031
|
return pluginsSchema.parse(pluginCatalogRuntime.getProviders().map((plugin) => ({
|
|
4499
4032
|
configKeys: plugin.manifest.configKeys ?? [],
|
|
4500
4033
|
description: plugin.manifest.description,
|
|
@@ -4506,7 +4039,7 @@ async function readPlugins() {
|
|
|
4506
4039
|
async function readRuntimeInfoReport() {
|
|
4507
4040
|
const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
|
|
4508
4041
|
import("./package-discovery-7a9YqLhE.js").then((n) => n.r),
|
|
4509
|
-
import("./catalog-runtime-
|
|
4042
|
+
import("./catalog-runtime-TBR8n4e1.js").then((n) => n.t),
|
|
4510
4043
|
readPlugins(),
|
|
4511
4044
|
readSkillReports()
|
|
4512
4045
|
]);
|
|
@@ -4523,7 +4056,7 @@ async function readRuntimeInfoReport() {
|
|
|
4523
4056
|
/** Read sanitized operational summaries contributed by plugins. */
|
|
4524
4057
|
async function readPluginOperationalReportFeed() {
|
|
4525
4058
|
const nowMs = Date.now();
|
|
4526
|
-
const { getPluginOperationalReports } = await import("./agent-hooks-
|
|
4059
|
+
const { getPluginOperationalReports } = await import("./agent-hooks-DNjlz2A-.js").then((n) => n.t);
|
|
4527
4060
|
return pluginOperationalReportFeedSchema.parse({
|
|
4528
4061
|
source: "plugins",
|
|
4529
4062
|
generatedAt: new Date(nowMs).toISOString(),
|