@sentry/junior 0.83.0 → 0.84.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-hooks-EEWWWIS2.js → agent-hooks-XDS5DIVS.js} +6 -6
- package/dist/app.js +54 -13
- package/dist/chat/config.d.ts +1 -1
- package/dist/chat/slack/client.d.ts +1 -1
- package/dist/chat/state/session-log.d.ts +4 -0
- package/dist/chat/task-execution/state.d.ts +1 -1
- package/dist/{chunk-QVMLDCVR.js → chunk-AAD2D7K3.js} +2 -10
- package/dist/{chunk-ABRNFE3N.js → chunk-ALL7GG6U.js} +7 -6
- package/dist/{chunk-KZLRUQAA.js → chunk-BAPRSWNW.js} +4 -1
- package/dist/{chunk-LK53AHO5.js → chunk-BFPOSIYV.js} +17 -10
- package/dist/{chunk-GUO4EE7L.js → chunk-CWMMGUWM.js} +1 -1
- package/dist/{chunk-GK5CITCY.js → chunk-JUI6XIHU.js} +11 -5
- package/dist/{chunk-5C3RY6IZ.js → chunk-KNVN4HUT.js} +4 -4
- package/dist/{chunk-X2FL5ZH5.js → chunk-MJ4E2PK7.js} +1 -1
- package/dist/{chunk-3JKTVW4R.js → chunk-MZ4DUVFD.js} +2 -2
- package/dist/{chunk-ORRLK22J.js → chunk-S7SC5IUJ.js} +3 -3
- package/dist/{chunk-AK7T7XRQ.js → chunk-SBYMRDH7.js} +1 -1
- package/dist/{chunk-BFQ7IUTE.js → chunk-ZPD5YQFZ.js} +2 -2
- package/dist/cli/chat.js +4 -4
- package/dist/cli/plugins.js +6 -6
- package/dist/cli/snapshot-warmup.js +3 -3
- package/dist/cli/upgrade.js +16 -32
- package/dist/{db-TRIVS6BW.js → db-7RRWCYF3.js} +3 -3
- package/dist/nitro.js +3 -3
- package/dist/reporting/conversations.d.ts +77 -0
- package/dist/reporting.d.ts +10 -2
- package/dist/reporting.js +420 -10
- package/dist/{runner-KS4XDMHF.js → runner-CJL5IKFO.js} +9 -9
- package/package.json +6 -6
package/dist/cli/upgrade.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
recordConversationActivity,
|
|
5
5
|
recordConversationExecution,
|
|
6
6
|
requestConversationWork
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-S7SC5IUJ.js";
|
|
8
8
|
import {
|
|
9
9
|
JUNIOR_THREAD_STATE_TTL_MS,
|
|
10
10
|
coerceThreadConversationState
|
|
@@ -18,23 +18,23 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
createPluginLogger,
|
|
20
20
|
createPluginState
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-CWMMGUWM.js";
|
|
22
22
|
import {
|
|
23
23
|
createJuniorSqlExecutor,
|
|
24
24
|
createSqlStore,
|
|
25
25
|
getDb
|
|
26
|
-
} from "../chunk-
|
|
26
|
+
} from "../chunk-AAD2D7K3.js";
|
|
27
27
|
import {
|
|
28
28
|
disconnectStateAdapter,
|
|
29
29
|
getConnectedStateContext
|
|
30
|
-
} from "../chunk-
|
|
30
|
+
} from "../chunk-MJ4E2PK7.js";
|
|
31
31
|
import {
|
|
32
32
|
parseDestination,
|
|
33
33
|
sameDestination
|
|
34
|
-
} from "../chunk-
|
|
34
|
+
} from "../chunk-BAPRSWNW.js";
|
|
35
35
|
import {
|
|
36
36
|
getChatConfig
|
|
37
|
-
} from "../chunk-
|
|
37
|
+
} from "../chunk-ALL7GG6U.js";
|
|
38
38
|
import "../chunk-DR75T7J3.js";
|
|
39
39
|
import {
|
|
40
40
|
loadAppPluginSet
|
|
@@ -83,23 +83,15 @@ function createStateConversationStore(state) {
|
|
|
83
83
|
|
|
84
84
|
// src/cli/upgrade/migrations/conversations-sql.ts
|
|
85
85
|
var CONVERSATION_BACKFILL_LIMIT = 1e4;
|
|
86
|
-
var REQUIRED_SQL_DATABASE_URL_MESSAGE = "Junior SQL database URL is required for conversation metadata upgrade. Set JUNIOR_DATABASE_URL or DATABASE_URL.";
|
|
87
|
-
function requireConversationSqlDatabaseUrl(context) {
|
|
88
|
-
const databaseUrl = context.sqlDatabaseUrl ?? getChatConfig().sql.databaseUrl;
|
|
89
|
-
if (!databaseUrl) {
|
|
90
|
-
throw new Error(REQUIRED_SQL_DATABASE_URL_MESSAGE);
|
|
91
|
-
}
|
|
92
|
-
return databaseUrl;
|
|
93
|
-
}
|
|
94
86
|
async function migrateConversationsToSql(context, options = {}) {
|
|
95
87
|
const source = createStateConversationStore(context.stateAdapter);
|
|
96
88
|
let target = options.target;
|
|
97
89
|
let closeTarget;
|
|
98
90
|
if (!target) {
|
|
99
|
-
const
|
|
91
|
+
const { sql } = getChatConfig();
|
|
100
92
|
const executor = createJuniorSqlExecutor({
|
|
101
|
-
connectionString: databaseUrl,
|
|
102
|
-
driver:
|
|
93
|
+
connectionString: sql.databaseUrl,
|
|
94
|
+
driver: sql.driver
|
|
103
95
|
});
|
|
104
96
|
target = createSqlStore(executor);
|
|
105
97
|
closeTarget = () => executor.close();
|
|
@@ -219,9 +211,10 @@ async function runPluginStorageMigrations(context) {
|
|
|
219
211
|
return emptyResult();
|
|
220
212
|
}
|
|
221
213
|
const previousConfig = pluginCatalogRuntime.setConfig(pluginCatalogConfig);
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
214
|
+
const sql = getChatConfig().sql;
|
|
215
|
+
const ownedExecutor = context.db ? void 0 : createJuniorSqlExecutor({
|
|
216
|
+
connectionString: sql.databaseUrl,
|
|
217
|
+
driver: sql.driver
|
|
225
218
|
});
|
|
226
219
|
const sqlUrlDb = ownedExecutor ? ownedExecutor.db() : void 0;
|
|
227
220
|
try {
|
|
@@ -377,21 +370,13 @@ async function migratePluginSchemas(executor, migrations) {
|
|
|
377
370
|
}
|
|
378
371
|
|
|
379
372
|
// src/cli/upgrade/migrations/plugin-sql.ts
|
|
380
|
-
var REQUIRED_SQL_DATABASE_URL_MESSAGE2 = "Junior SQL database URL is required for plugin schema migration. Set JUNIOR_DATABASE_URL or DATABASE_URL.";
|
|
381
|
-
function requirePluginSqlDatabaseUrl(context) {
|
|
382
|
-
const databaseUrl = context.sqlDatabaseUrl ?? getChatConfig().sql.databaseUrl;
|
|
383
|
-
if (!databaseUrl) {
|
|
384
|
-
throw new Error(REQUIRED_SQL_DATABASE_URL_MESSAGE2);
|
|
385
|
-
}
|
|
386
|
-
return databaseUrl;
|
|
387
|
-
}
|
|
388
373
|
async function migratePluginsToSql(context) {
|
|
389
|
-
const
|
|
374
|
+
const { sql } = getChatConfig();
|
|
390
375
|
const { pluginCatalogConfig } = await resolveUpgradePlugins(context);
|
|
391
376
|
const previousConfig = pluginCatalogRuntime.setConfig(pluginCatalogConfig);
|
|
392
377
|
const executor = createJuniorSqlExecutor({
|
|
393
|
-
connectionString: databaseUrl,
|
|
394
|
-
driver:
|
|
378
|
+
connectionString: sql.databaseUrl,
|
|
379
|
+
driver: sql.driver
|
|
395
380
|
});
|
|
396
381
|
try {
|
|
397
382
|
const migrations = pluginCatalogRuntime.getMigrationRoots().flatMap((root) => readPluginMigrations(root));
|
|
@@ -991,7 +976,6 @@ function formatMigrationResult(result) {
|
|
|
991
976
|
async function runUpgradeMigrations(context) {
|
|
992
977
|
const plugins = await resolveUpgradePlugins(context);
|
|
993
978
|
const migrationContext = { ...context, ...plugins };
|
|
994
|
-
migrationContext.sqlDatabaseUrl ??= requireConversationSqlDatabaseUrl(migrationContext);
|
|
995
979
|
const results = [];
|
|
996
980
|
for (const migration of MIGRATIONS) {
|
|
997
981
|
migrationContext.io.info(`Running migration ${migration.name}...`);
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
closeDb,
|
|
3
3
|
getConversationStore,
|
|
4
4
|
getDb
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-AAD2D7K3.js";
|
|
6
|
+
import "./chunk-BAPRSWNW.js";
|
|
7
|
+
import "./chunk-ALL7GG6U.js";
|
|
8
8
|
import "./chunk-DR75T7J3.js";
|
|
9
9
|
import "./chunk-ZPCGQRFJ.js";
|
|
10
10
|
import "./chunk-KF7522P3.js";
|
package/dist/nitro.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveConversationWorkQueueTopic
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SBYMRDH7.js";
|
|
4
4
|
import {
|
|
5
5
|
PLUGIN_TASK_QUEUE_TOPIC
|
|
6
6
|
} from "./chunk-KNFROR7R.js";
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
pluginCatalogConfigFromPluginSet,
|
|
9
9
|
pluginRuntimeRegistrationsFromPluginSet
|
|
10
10
|
} from "./chunk-SG5WAA7H.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-BAPRSWNW.js";
|
|
12
|
+
import "./chunk-ALL7GG6U.js";
|
|
13
13
|
import "./chunk-DR75T7J3.js";
|
|
14
14
|
import {
|
|
15
15
|
loadPluginSetFromModule,
|
|
@@ -90,6 +90,7 @@ export interface ConversationSubagentActivityReport {
|
|
|
90
90
|
parentToolCallId?: string;
|
|
91
91
|
status: ConversationActivityStatus;
|
|
92
92
|
subagentKind: string;
|
|
93
|
+
transcriptAvailable?: boolean;
|
|
93
94
|
}
|
|
94
95
|
export interface ConversationToolActivityReport extends ActivityPayloadMetadata {
|
|
95
96
|
type: "tool_execution";
|
|
@@ -111,6 +112,24 @@ export interface ConversationReport {
|
|
|
111
112
|
sentryConversationUrl?: string;
|
|
112
113
|
runs: ConversationRunReport[];
|
|
113
114
|
}
|
|
115
|
+
export interface ConversationSubagentTranscriptReport {
|
|
116
|
+
type: "subagent";
|
|
117
|
+
createdAt: string;
|
|
118
|
+
endedAt?: string;
|
|
119
|
+
id: string;
|
|
120
|
+
outcome?: "success" | "error" | "aborted";
|
|
121
|
+
parentToolCallId?: string;
|
|
122
|
+
status: ConversationActivityStatus;
|
|
123
|
+
subagentConversationId?: string;
|
|
124
|
+
subagentKind: string;
|
|
125
|
+
subagentSentryConversationUrl?: string;
|
|
126
|
+
transcript: TranscriptMessage[];
|
|
127
|
+
transcriptAvailable: boolean;
|
|
128
|
+
transcriptMessageCount?: number;
|
|
129
|
+
transcriptRedacted?: boolean;
|
|
130
|
+
transcriptRedactionReason?: "non_public_conversation";
|
|
131
|
+
unavailableReason?: "missing_transcript_range" | "missing_transcript_ref" | "not_found";
|
|
132
|
+
}
|
|
114
133
|
export interface ConversationFeed {
|
|
115
134
|
conversations: ConversationSummaryReport[];
|
|
116
135
|
source: "conversation_index";
|
|
@@ -144,6 +163,62 @@ export interface ConversationStatsReport {
|
|
|
144
163
|
windowEnd: string;
|
|
145
164
|
windowStart: string;
|
|
146
165
|
}
|
|
166
|
+
export interface RequesterActivityDayReport {
|
|
167
|
+
active: number;
|
|
168
|
+
conversations: number;
|
|
169
|
+
date: string;
|
|
170
|
+
durationMs: number;
|
|
171
|
+
failed: number;
|
|
172
|
+
hung: number;
|
|
173
|
+
runs: number;
|
|
174
|
+
tokens?: number;
|
|
175
|
+
}
|
|
176
|
+
export interface RequesterTotalsReport {
|
|
177
|
+
active: number;
|
|
178
|
+
activeDays: number;
|
|
179
|
+
conversations: number;
|
|
180
|
+
durationMs: number;
|
|
181
|
+
failed: number;
|
|
182
|
+
hung: number;
|
|
183
|
+
runs: number;
|
|
184
|
+
tokens?: number;
|
|
185
|
+
}
|
|
186
|
+
export interface RequesterSummaryReport extends RequesterTotalsReport {
|
|
187
|
+
firstSeenAt: string;
|
|
188
|
+
lastSeenAt: string;
|
|
189
|
+
requester: RequesterIdentity & {
|
|
190
|
+
email: string;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
export interface RequesterDirectoryReport {
|
|
194
|
+
generatedAt: string;
|
|
195
|
+
people: RequesterSummaryReport[];
|
|
196
|
+
sampleLimit: number;
|
|
197
|
+
sampleSize: number;
|
|
198
|
+
source: "conversation_index";
|
|
199
|
+
truncated: boolean;
|
|
200
|
+
}
|
|
201
|
+
export interface RequesterProfileReport {
|
|
202
|
+
activityDays: RequesterActivityDayReport[];
|
|
203
|
+
generatedAt: string;
|
|
204
|
+
locations: ConversationStatsItem[];
|
|
205
|
+
recentConversations: ConversationSummaryReport[];
|
|
206
|
+
requester: RequesterIdentity & {
|
|
207
|
+
email: string;
|
|
208
|
+
};
|
|
209
|
+
sampleLimit: number;
|
|
210
|
+
sampleSize: number;
|
|
211
|
+
source: "conversation_index";
|
|
212
|
+
surfaces: ConversationStatsItem[];
|
|
213
|
+
totals: RequesterTotalsReport;
|
|
214
|
+
truncated: boolean;
|
|
215
|
+
windowEnd: string;
|
|
216
|
+
windowStart: string;
|
|
217
|
+
}
|
|
218
|
+
/** Read the requester directory from durable conversation metadata. */
|
|
219
|
+
export declare function readRequesterDirectoryReport(options?: ConversationReaderOptions): Promise<RequesterDirectoryReport>;
|
|
220
|
+
/** Read one requester profile without exposing transcript payloads. */
|
|
221
|
+
export declare function readRequesterProfileReport(email: string, options?: ConversationReaderOptions): Promise<RequesterProfileReport>;
|
|
147
222
|
/** Read the recent conversation feed for reporting consumers. */
|
|
148
223
|
export declare function readConversationFeed(options?: ConversationReaderOptions): Promise<ConversationFeed>;
|
|
149
224
|
/** Read aggregate conversation statistics for reporting consumers. */
|
|
@@ -154,3 +229,5 @@ export declare function listRecentConversationSummaries(options?: {
|
|
|
154
229
|
} & ConversationReaderOptions): Promise<PluginConversationSummary[]>;
|
|
155
230
|
/** Read one conversation transcript for reporting consumers. */
|
|
156
231
|
export declare function readConversationReport(conversationId: string, options?: ConversationReaderOptions): Promise<ConversationReport>;
|
|
232
|
+
/** Read one child-agent transcript through its parent conversation run. */
|
|
233
|
+
export declare function readConversationSubagentTranscriptReport(conversationId: string, runId: string, subagentId: string): Promise<ConversationSubagentTranscriptReport>;
|
package/dist/reporting.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PluginOperationalReport } from "@sentry/junior-plugin-api";
|
|
2
|
-
import { type ConversationFeed, type PluginConversationSummary, type ConversationReport, type ConversationStatsReport } from "./reporting/conversations";
|
|
3
|
-
export type { PluginConversationStatus, PluginConversations, PluginConversationSummary, ConversationActivityReport, ConversationActivityStatus, ConversationFeed, ConversationReport, ConversationReportStatus, ConversationRunReport, ConversationSubagentActivityReport, ConversationStatsItem, ConversationStatsReport, ConversationSummaryReport, ConversationSurface, ConversationToolActivityReport, ConversationUsage, RequesterIdentity, TranscriptMessage, TranscriptPart, TranscriptPartType, TranscriptRole, } from "./reporting/conversations";
|
|
2
|
+
import { type ConversationFeed, type PluginConversationSummary, type ConversationReport, type ConversationSubagentTranscriptReport, type ConversationStatsReport, type RequesterDirectoryReport, type RequesterProfileReport } from "./reporting/conversations";
|
|
3
|
+
export type { PluginConversationStatus, PluginConversations, PluginConversationSummary, ConversationActivityReport, ConversationActivityStatus, ConversationFeed, ConversationReport, ConversationReportStatus, ConversationRunReport, ConversationSubagentActivityReport, ConversationSubagentTranscriptReport, ConversationStatsItem, ConversationStatsReport, ConversationSummaryReport, ConversationSurface, ConversationToolActivityReport, ConversationUsage, RequesterActivityDayReport, RequesterDirectoryReport, RequesterIdentity, RequesterProfileReport, RequesterSummaryReport, RequesterTotalsReport, TranscriptMessage, TranscriptPart, TranscriptPartType, TranscriptRole, } from "./reporting/conversations";
|
|
4
4
|
export interface HealthReport {
|
|
5
5
|
status: "ok";
|
|
6
6
|
service: string;
|
|
@@ -53,6 +53,10 @@ export interface JuniorReporting {
|
|
|
53
53
|
listConversations(): Promise<ConversationFeed>;
|
|
54
54
|
/** Read aggregate conversation stats for reporting consumers. */
|
|
55
55
|
getConversationStats?(): Promise<ConversationStatsReport>;
|
|
56
|
+
/** List requester profiles derived from trusted conversation requester emails. */
|
|
57
|
+
listRequesters?(): Promise<RequesterDirectoryReport>;
|
|
58
|
+
/** Read one requester profile derived from trusted conversation requester emails. */
|
|
59
|
+
getRequesterProfile?(email: string): Promise<RequesterProfileReport>;
|
|
56
60
|
/** Read recent conversation summaries without transcript payloads. */
|
|
57
61
|
listRecentConversations?(options?: {
|
|
58
62
|
limit?: number;
|
|
@@ -67,10 +71,14 @@ export interface JuniorReporting {
|
|
|
67
71
|
* source. Avoid adding fields that require Redis-only transcript internals.
|
|
68
72
|
*/
|
|
69
73
|
getConversation(conversationId: string): Promise<ConversationReport>;
|
|
74
|
+
/** Load a child-agent transcript only when an operator opens that subagent. */
|
|
75
|
+
getConversationSubagentTranscript(conversationId: string, runId: string, subagentId: string): Promise<ConversationSubagentTranscriptReport>;
|
|
70
76
|
}
|
|
71
77
|
/** Create the read-only reporting boundary used by plugins and other consumers. */
|
|
72
78
|
export declare function createJuniorReporting(): JuniorReporting & {
|
|
73
79
|
getConversationStats(): Promise<ConversationStatsReport>;
|
|
80
|
+
listRequesters(): Promise<RequesterDirectoryReport>;
|
|
81
|
+
getRequesterProfile(email: string): Promise<RequesterProfileReport>;
|
|
74
82
|
listRecentConversations(options?: {
|
|
75
83
|
limit?: number;
|
|
76
84
|
}): Promise<PluginConversationSummary[]>;
|