@sentry/junior 0.95.0 → 0.96.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-FTQ5EGPO.js → agent-hooks-5URSMY3O.js} +6 -6
- package/dist/api/people/list.js +5 -5
- package/dist/api/people/profile.js +5 -5
- package/dist/api-reference.d.ts +1 -1
- package/dist/app.js +24 -20
- package/dist/{catalog-runtime-2D7IVKUT.js → catalog-runtime-MSMAYYIK.js} +3 -3
- package/dist/chat/logging.d.ts +2 -2
- package/dist/chat/plugins/auth/oauth-request.d.ts +2 -0
- package/dist/chat/resource-events/notification.d.ts +2 -0
- package/dist/chat/runtime/agent-run-outcome.d.ts +3 -0
- package/dist/chat/sentry.d.ts +1 -1
- package/dist/chat/state/turn-session.d.ts +3 -1
- package/dist/chat/usage.d.ts +27 -13
- package/dist/{chunk-E3E2XNCN.js → chunk-2NAZZPPS.js} +2 -2
- package/dist/{chunk-CRRBJ3JP.js → chunk-5C6XTTFI.js} +4 -4
- package/dist/{chunk-3DA7X2U3.js → chunk-6GWA276C.js} +15 -0
- package/dist/{chunk-EKNJM5IG.js → chunk-AAZXTVJT.js} +2 -2
- package/dist/{chunk-WCMQJE4F.js → chunk-BYZWPRJA.js} +3 -3
- package/dist/{chunk-HZNJLKKI.js → chunk-DZENG5ML.js} +1 -1
- package/dist/{chunk-5XMNOD3S.js → chunk-GQ3GK22G.js} +3 -3
- package/dist/{chunk-WPOJ443W.js → chunk-I35CTGPO.js} +58 -6
- package/dist/{chunk-HCXXB35T.js → chunk-IYM2SIVG.js} +21 -19
- package/dist/{chunk-GVOUCI2O.js → chunk-L7CDEIVJ.js} +12 -4
- package/dist/{chunk-WAGQ377B.js → chunk-MNTINMWR.js} +170 -29
- package/dist/{chunk-XX4N4E6C.js → chunk-P3YFQLEN.js} +8 -8
- package/dist/{chunk-HDTO3A74.js → chunk-PMNN6ST4.js} +2 -2
- package/dist/{chunk-6ONME5IG.js → chunk-RITD7E5L.js} +2 -2
- package/dist/{chunk-NSCHU54X.js → chunk-S5KZ5LPG.js} +4 -4
- package/dist/{chunk-KDPCGVIT.js → chunk-UKHVMPX5.js} +5 -61
- package/dist/{chunk-N4RNJ32C.js → chunk-WM6KHPBQ.js} +1 -1
- package/dist/{chunk-AYP4ERVZ.js → chunk-YDT7SNCN.js} +1 -1
- package/dist/{chunk-GUE7HTNR.js → chunk-YDVEH3SB.js} +1 -1
- package/dist/cli/chat.js +19 -19
- package/dist/cli/check.js +4 -4
- package/dist/cli/main.js +1 -1
- package/dist/cli/plugins.js +8 -8
- package/dist/cli/snapshot-warmup.js +5 -5
- package/dist/cli/upgrade.js +8 -8
- package/dist/{db-W55B74OP.js → db-2D6RMG67.js} +4 -4
- package/dist/instrumentation.js +1 -1
- package/dist/{legacy-import-ZPLGLAFD.js → legacy-import-VZ2MEGP7.js} +5 -5
- package/dist/reporting/conversations/summaries.d.ts +3 -0
- package/dist/reporting/conversations/types.d.ts +13 -0
- package/dist/reporting.d.ts +1 -1
- package/dist/reporting.js +113 -23
- package/dist/{runner-OOSBDYRK.js → runner-JZBRQP4F.js} +10 -10
- package/dist/{sentry-EGFOV3DH.js → sentry-JMWTS32N.js} +11 -1
- package/dist/{validation-QCGRFRFZ.js → validation-6XOOQGME.js} +4 -4
- package/package.json +7 -7
|
@@ -11,16 +11,16 @@ import {
|
|
|
11
11
|
getPlugins,
|
|
12
12
|
setPlugins,
|
|
13
13
|
validatePlugins
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-S5KZ5LPG.js";
|
|
15
|
+
import "./chunk-2NAZZPPS.js";
|
|
16
16
|
import "./chunk-CZEX6KIQ.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-RITD7E5L.js";
|
|
18
|
+
import "./chunk-YDVEH3SB.js";
|
|
19
19
|
import "./chunk-GY34VGP5.js";
|
|
20
20
|
import "./chunk-B7PUBQQM.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-I35CTGPO.js";
|
|
22
22
|
import "./chunk-OB42YVAE.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-6GWA276C.js";
|
|
24
24
|
import "./chunk-7FBGKXPE.js";
|
|
25
25
|
import "./chunk-MLKGABMK.js";
|
|
26
26
|
export {
|
package/dist/api/people/list.js
CHANGED
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
reportTime,
|
|
10
10
|
signals,
|
|
11
11
|
summaryFromRow
|
|
12
|
-
} from "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
12
|
+
} from "../../chunk-DZENG5ML.js";
|
|
13
|
+
import "../../chunk-RITD7E5L.js";
|
|
14
|
+
import "../../chunk-YDVEH3SB.js";
|
|
15
15
|
import "../../chunk-GY34VGP5.js";
|
|
16
16
|
import "../../chunk-B7PUBQQM.js";
|
|
17
|
-
import "../../chunk-
|
|
17
|
+
import "../../chunk-I35CTGPO.js";
|
|
18
18
|
import "../../chunk-OB42YVAE.js";
|
|
19
|
-
import "../../chunk-
|
|
19
|
+
import "../../chunk-6GWA276C.js";
|
|
20
20
|
import "../../chunk-7FBGKXPE.js";
|
|
21
21
|
import "../../chunk-MLKGABMK.js";
|
|
22
22
|
|
|
@@ -18,14 +18,14 @@ import {
|
|
|
18
18
|
statsItems,
|
|
19
19
|
summaryFromRow,
|
|
20
20
|
surfaceLabel
|
|
21
|
-
} from "../../chunk-
|
|
22
|
-
import "../../chunk-
|
|
23
|
-
import "../../chunk-
|
|
21
|
+
} from "../../chunk-DZENG5ML.js";
|
|
22
|
+
import "../../chunk-RITD7E5L.js";
|
|
23
|
+
import "../../chunk-YDVEH3SB.js";
|
|
24
24
|
import "../../chunk-GY34VGP5.js";
|
|
25
25
|
import "../../chunk-B7PUBQQM.js";
|
|
26
|
-
import "../../chunk-
|
|
26
|
+
import "../../chunk-I35CTGPO.js";
|
|
27
27
|
import "../../chunk-OB42YVAE.js";
|
|
28
|
-
import "../../chunk-
|
|
28
|
+
import "../../chunk-6GWA276C.js";
|
|
29
29
|
import "../../chunk-7FBGKXPE.js";
|
|
30
30
|
import "../../chunk-MLKGABMK.js";
|
|
31
31
|
|
package/dist/api-reference.d.ts
CHANGED
|
@@ -8,6 +8,6 @@ export type { JuniorPluginInput, JuniorPluginSet, JuniorPluginSetOptions, } from
|
|
|
8
8
|
export type { PluginRunContext, PluginRunTranscriptEntry, PluginTaskContext, PluginTaskDefinition, PluginTasks, SubscribableResource, } from "@sentry/junior-plugin-api";
|
|
9
9
|
export { definePluginTool, pluginRunContextSchema, pluginRunTranscriptEntrySchema, zodTool, } from "@sentry/junior-plugin-api";
|
|
10
10
|
export { createJuniorReporting } from "./reporting";
|
|
11
|
-
export type { PluginConversationStatus, PluginConversations, PluginConversationSummary, ConversationActivityReport, ConversationActivityStatus, ConversationFeed, ConversationReport, ConversationReportStatus, ConversationRunReport, ConversationSubagentActivityReport, ConversationStatsItem, ConversationStatsReport, ConversationSummaryReport, ConversationSurface, ConversationToolActivityReport, ConversationUsage, HealthReport, JuniorReporting, PluginOperationalReport, PluginOperationalReportFeed, PluginPackageContentItemReport, PluginPackageContentReport, PluginReport, ActorIdentity, RuntimeInfoReport, SkillReport, TranscriptMessage, TranscriptPart, TranscriptPartType, TranscriptRole, } from "./reporting";
|
|
11
|
+
export type { PluginConversationStatus, PluginConversations, PluginConversationSummary, ConversationActivityReport, ConversationActivityStatus, ConversationCost, ConversationFeed, ConversationReport, ConversationReportStatus, ConversationRunReport, ConversationSubagentActivityReport, ConversationStatsItem, ConversationStatsReport, ConversationSummaryReport, ConversationSurface, ConversationToolActivityReport, ConversationUsage, HealthReport, JuniorReporting, PluginOperationalReport, PluginOperationalReportFeed, PluginPackageContentItemReport, PluginPackageContentReport, PluginReport, ActorIdentity, RuntimeInfoReport, SkillReport, TranscriptMessage, TranscriptPart, TranscriptPartType, TranscriptRole, } from "./reporting";
|
|
12
12
|
export { juniorVercelConfig } from "./vercel";
|
|
13
13
|
export type { JuniorVercelConfigOptions } from "./vercel";
|
package/dist/app.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
processPluginTask,
|
|
6
6
|
requireTurnFailureEventId,
|
|
7
7
|
scheduleSessionCompletedPluginTasks
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-P3YFQLEN.js";
|
|
9
9
|
import {
|
|
10
10
|
CONVERSATION_WORK_CHECK_IN_INTERVAL_MS,
|
|
11
11
|
CONVERSATION_WORK_STALE_ENQUEUE_MS,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
requestConversationContinuation,
|
|
30
30
|
requestConversationWork,
|
|
31
31
|
startConversationWork
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-GQ3GK22G.js";
|
|
33
33
|
import {
|
|
34
34
|
getVercelConversationWorkQueue,
|
|
35
35
|
resolveConversationWorkQueueTopic,
|
|
@@ -46,11 +46,11 @@ import {
|
|
|
46
46
|
conversationVisibilityFromSlackChannelType,
|
|
47
47
|
resolveSlackChannelTypeFromMessage,
|
|
48
48
|
resolveSlackConversationContext
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-AAZXTVJT.js";
|
|
50
50
|
import {
|
|
51
51
|
validatePluginEgressCredentialHooks,
|
|
52
52
|
validatePluginRegistrations
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-YDT7SNCN.js";
|
|
54
54
|
import {
|
|
55
55
|
defineJuniorPlugins,
|
|
56
56
|
pluginCatalogConfigFromEnv,
|
|
@@ -98,7 +98,7 @@ import {
|
|
|
98
98
|
splitSlackReplyText,
|
|
99
99
|
startOAuthFlow,
|
|
100
100
|
truncateStatusText
|
|
101
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-IYM2SIVG.js";
|
|
102
102
|
import {
|
|
103
103
|
CooperativeTurnYieldError,
|
|
104
104
|
TurnInputCommitLostError,
|
|
@@ -127,13 +127,13 @@ import {
|
|
|
127
127
|
persistWithRetry,
|
|
128
128
|
persistYieldSessionRecord,
|
|
129
129
|
startActiveTurn
|
|
130
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-UKHVMPX5.js";
|
|
131
131
|
import {
|
|
132
132
|
coerceThreadConversationState
|
|
133
133
|
} from "./chunk-RAIB6WSG.js";
|
|
134
|
-
import "./chunk-
|
|
134
|
+
import "./chunk-BYZWPRJA.js";
|
|
135
135
|
import "./chunk-CM5EZD5F.js";
|
|
136
|
-
import "./chunk-
|
|
136
|
+
import "./chunk-WM6KHPBQ.js";
|
|
137
137
|
import {
|
|
138
138
|
abandonAgentTurnSessionRecord,
|
|
139
139
|
commitMessages,
|
|
@@ -144,7 +144,7 @@ import {
|
|
|
144
144
|
loadProjectionWithProvenance,
|
|
145
145
|
recordAgentTurnSessionSummary,
|
|
146
146
|
recordAuthorizationCompleted
|
|
147
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-MNTINMWR.js";
|
|
148
148
|
import {
|
|
149
149
|
JUNIOR_THREAD_STATE_TTL_MS,
|
|
150
150
|
buildConversationContext,
|
|
@@ -162,7 +162,7 @@ import {
|
|
|
162
162
|
persistConversationMessages,
|
|
163
163
|
updateConversationStats,
|
|
164
164
|
upsertConversationMessage
|
|
165
|
-
} from "./chunk-
|
|
165
|
+
} from "./chunk-5C6XTTFI.js";
|
|
166
166
|
import {
|
|
167
167
|
SlackActionError,
|
|
168
168
|
bindSlackDirectCredentialSubject,
|
|
@@ -181,11 +181,11 @@ import {
|
|
|
181
181
|
setPlugins,
|
|
182
182
|
validatePlugins,
|
|
183
183
|
verifySlackDirectCredentialSubject
|
|
184
|
-
} from "./chunk-
|
|
184
|
+
} from "./chunk-S5KZ5LPG.js";
|
|
185
185
|
import {
|
|
186
186
|
createPluginLogger,
|
|
187
187
|
createPluginState
|
|
188
|
-
} from "./chunk-
|
|
188
|
+
} from "./chunk-2NAZZPPS.js";
|
|
189
189
|
import {
|
|
190
190
|
sleep
|
|
191
191
|
} from "./chunk-CZEX6KIQ.js";
|
|
@@ -200,7 +200,7 @@ import {
|
|
|
200
200
|
juniorConversationMessages,
|
|
201
201
|
juniorConversations,
|
|
202
202
|
juniorDestinations
|
|
203
|
-
} from "./chunk-
|
|
203
|
+
} from "./chunk-RITD7E5L.js";
|
|
204
204
|
import {
|
|
205
205
|
FUNCTION_TIMEOUT_BUFFER_SECONDS,
|
|
206
206
|
acquireActiveLock,
|
|
@@ -222,7 +222,7 @@ import {
|
|
|
222
222
|
stripRuntimeTurnContext,
|
|
223
223
|
trimTrailingAssistantMessages,
|
|
224
224
|
unwrapCurrentInstruction
|
|
225
|
-
} from "./chunk-
|
|
225
|
+
} from "./chunk-YDVEH3SB.js";
|
|
226
226
|
import {
|
|
227
227
|
parseSlackThreadId,
|
|
228
228
|
readSlackRawMessageContext,
|
|
@@ -238,13 +238,13 @@ import {
|
|
|
238
238
|
} from "./chunk-B7PUBQQM.js";
|
|
239
239
|
import {
|
|
240
240
|
discoverSkills
|
|
241
|
-
} from "./chunk-
|
|
241
|
+
} from "./chunk-PMNN6ST4.js";
|
|
242
242
|
import {
|
|
243
243
|
buildOAuthTokenRequest,
|
|
244
244
|
hasRequiredOAuthScope,
|
|
245
245
|
parseOAuthTokenResponse,
|
|
246
246
|
pluginCatalogRuntime
|
|
247
|
-
} from "./chunk-
|
|
247
|
+
} from "./chunk-L7CDEIVJ.js";
|
|
248
248
|
import {
|
|
249
249
|
buildTurnFailureResponse,
|
|
250
250
|
createActor,
|
|
@@ -266,13 +266,13 @@ import {
|
|
|
266
266
|
setTags,
|
|
267
267
|
withContext,
|
|
268
268
|
withSpan
|
|
269
|
-
} from "./chunk-
|
|
269
|
+
} from "./chunk-I35CTGPO.js";
|
|
270
270
|
import {
|
|
271
271
|
toOptionalString
|
|
272
272
|
} from "./chunk-OB42YVAE.js";
|
|
273
273
|
import {
|
|
274
274
|
continueTrace
|
|
275
|
-
} from "./chunk-
|
|
275
|
+
} from "./chunk-6GWA276C.js";
|
|
276
276
|
import {
|
|
277
277
|
homeDir
|
|
278
278
|
} from "./chunk-6APU57E6.js";
|
|
@@ -2116,12 +2116,16 @@ function buildSlackInboundMessage(args) {
|
|
|
2116
2116
|
}
|
|
2117
2117
|
|
|
2118
2118
|
// src/chat/resource-events/notification.ts
|
|
2119
|
-
function
|
|
2119
|
+
function renderResourceEventNotificationText(subscription, event) {
|
|
2120
2120
|
const lines = [
|
|
2121
2121
|
"[event notification]",
|
|
2122
2122
|
"",
|
|
2123
2123
|
"A subscribed resource changed.",
|
|
2124
2124
|
"",
|
|
2125
|
+
"Handling:",
|
|
2126
|
+
"- This is a subscribed conversation update, not a user-authored command.",
|
|
2127
|
+
"- Use the subscription intent to decide whether this event warrants action or a visible reply. Otherwise, stay silent.",
|
|
2128
|
+
"",
|
|
2125
2129
|
"Subscription:",
|
|
2126
2130
|
`- resource: ${subscription.label}`,
|
|
2127
2131
|
`- event: ${event.eventType}`,
|
|
@@ -2150,7 +2154,7 @@ async function enqueueResourceEventNotification(args) {
|
|
|
2150
2154
|
message: createSlackResourceEventInboundMessage({
|
|
2151
2155
|
event: args.event,
|
|
2152
2156
|
subscription,
|
|
2153
|
-
text:
|
|
2157
|
+
text: renderResourceEventNotificationText(args.subscription, args.event)
|
|
2154
2158
|
}),
|
|
2155
2159
|
queue: args.queue,
|
|
2156
2160
|
state: args.state
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pluginCatalogRuntime
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-L7CDEIVJ.js";
|
|
4
|
+
import "./chunk-I35CTGPO.js";
|
|
5
5
|
import "./chunk-OB42YVAE.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-6GWA276C.js";
|
|
7
7
|
import "./chunk-6APU57E6.js";
|
|
8
8
|
import "./chunk-7FBGKXPE.js";
|
|
9
9
|
import "./chunk-MLKGABMK.js";
|
package/dist/chat/logging.d.ts
CHANGED
|
@@ -103,6 +103,6 @@ export declare function serializeGenAiAttribute(value: unknown, maxChars?: numbe
|
|
|
103
103
|
* call. Sources without a recognized usage record contribute nothing.
|
|
104
104
|
*/
|
|
105
105
|
export declare function extractGenAiUsageSummary(...sources: unknown[]): AgentTurnUsage;
|
|
106
|
-
/** Extract GenAI token
|
|
107
|
-
export declare function extractGenAiUsageAttributes(...sources: unknown[]): Partial<Record<"gen_ai.usage.input_tokens" | "gen_ai.usage.output_tokens" | "gen_ai.usage.input_tokens.cached" | "gen_ai.usage.input_tokens.cache_write" | "gen_ai.usage.total_tokens", number
|
|
106
|
+
/** Extract GenAI token and estimated USD cost attributes for tracing. */
|
|
107
|
+
export declare function extractGenAiUsageAttributes(...sources: unknown[]): Partial<Record<"gen_ai.usage.input_tokens" | "gen_ai.usage.output_tokens" | "gen_ai.usage.input_tokens.cached" | "gen_ai.usage.input_tokens.cache_write" | "gen_ai.usage.total_tokens", number> & Partial<Record<"app.ai.cost.input_usd" | "app.ai.cost.output_usd" | "app.ai.cost.cache_read_usd" | "app.ai.cost.cache_write_usd" | "app.ai.cost.total_usd" | "app.ai.reasoning_tokens", number>>>;
|
|
108
108
|
export {};
|
|
@@ -18,7 +18,9 @@ export declare function buildOAuthTokenRequest(input: OAuthTokenRequestInput): {
|
|
|
18
18
|
headers: Record<string, string>;
|
|
19
19
|
body: BodyInit;
|
|
20
20
|
};
|
|
21
|
+
/** Parse provider tokens, retaining the request token when a refresh response omits rotation. */
|
|
21
22
|
export declare function parseOAuthTokenResponse(data: unknown, requestedScope?: string, options?: {
|
|
22
23
|
treatEmptyScopeAsUnreported?: boolean;
|
|
24
|
+
refreshToken?: string;
|
|
23
25
|
}): OAuthTokenResponse;
|
|
24
26
|
export {};
|
|
@@ -11,6 +11,8 @@ export interface ResourceEventNotification {
|
|
|
11
11
|
trustedSummary: string;
|
|
12
12
|
untrustedText?: string;
|
|
13
13
|
}
|
|
14
|
+
/** Render the runtime-owned conversation message for a subscribed event. */
|
|
15
|
+
export declare function renderResourceEventNotificationText(subscription: Pick<ResourceEventSubscription, "intent" | "label">, event: Pick<ResourceEventNotification, "eventType" | "trustedSummary" | "untrustedText">): string;
|
|
14
16
|
/** Enqueue a resource event as normal conversation mailbox input. */
|
|
15
17
|
export declare function enqueueResourceEventNotification(args: {
|
|
16
18
|
event: ResourceEventNotification;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AgentRunResult } from "@/chat/services/turn-result";
|
|
2
|
+
import type { AgentTurnUsage } from "@/chat/usage";
|
|
2
3
|
/**
|
|
3
4
|
* How an agent run ended. `completed` carries the terminal result (success or
|
|
4
5
|
* failure — `result.diagnostics` distinguishes them). `suspended` means the run
|
|
@@ -13,9 +14,11 @@ export type AgentRunOutcome = {
|
|
|
13
14
|
} | {
|
|
14
15
|
status: "suspended";
|
|
15
16
|
resumeVersion: number;
|
|
17
|
+
usage?: AgentTurnUsage;
|
|
16
18
|
} | {
|
|
17
19
|
status: "awaiting_auth";
|
|
18
20
|
providerDisplayName: string;
|
|
21
|
+
usage?: AgentTurnUsage;
|
|
19
22
|
};
|
|
20
23
|
/** Wrap a terminal result (successful or failed per its diagnostics) as an outcome. */
|
|
21
24
|
export declare function completedAgentRun(result: AgentRunResult): AgentRunOutcome;
|
package/dist/chat/sentry.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Sentry SDK re-export. Isolates the concrete package to a single file. */
|
|
2
|
-
export { captureException, continueTrace, flush, getClient, getGlobalScope, init, setTag, setUser, startInactiveSpan, startSpan, vercelAIIntegration, withActiveSpan, withScope, withStreamedSpan, } from "@sentry/node";
|
|
2
|
+
export { captureException, captureMessage, continueTrace, flush, getActiveSpan, getClient, getGlobalScope, getTraceData, init, logger, setTag, setUser, spanToJSON, startInactiveSpan, startSpan, vercelAIIntegration, withActiveSpan, withScope, withStreamedSpan, } from "@sentry/node";
|
|
3
3
|
export * from "@sentry/node";
|
|
@@ -2,7 +2,7 @@ import { type Destination, type Source } from "@sentry/junior-plugin-api";
|
|
|
2
2
|
import type { PiMessage } from "@/chat/pi/messages";
|
|
3
3
|
import { type Actor } from "@/chat/actor";
|
|
4
4
|
import { type PiMessageProvenance } from "./session-log";
|
|
5
|
-
import type
|
|
5
|
+
import { type AgentTurnUsage } from "@/chat/usage";
|
|
6
6
|
import type { ConversationPrivacy } from "@/chat/conversation-privacy";
|
|
7
7
|
import type { ConversationStore } from "@/chat/conversations/store";
|
|
8
8
|
export type AgentTurnSessionStatus = "running" | "awaiting_resume" | "completed" | "failed" | "abandoned";
|
|
@@ -110,6 +110,8 @@ export declare function recordAgentTurnSessionSummary(args: {
|
|
|
110
110
|
export declare function listAgentTurnSessionSummaries(limit?: number): Promise<AgentTurnSessionSummary[]>;
|
|
111
111
|
/** List turn-session summaries for one conversation without the global feed cap. */
|
|
112
112
|
export declare function listAgentTurnSessionSummariesForConversation(conversationId: string): Promise<AgentTurnSessionSummary[]>;
|
|
113
|
+
/** Read complete per-conversation summary indexes with bounded backend load. */
|
|
114
|
+
export declare function listAgentTurnSessionSummariesForConversations(conversationIds: string[]): Promise<Map<string, AgentTurnSessionSummary[]>>;
|
|
113
115
|
/** Mark an unfinished turn session record as abandoned when a newer turn wins. */
|
|
114
116
|
export declare function abandonAgentTurnSessionRecord(args: {
|
|
115
117
|
conversationId: string;
|
package/dist/chat/usage.d.ts
CHANGED
|
@@ -1,23 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const agentTurnCostSchema: z.ZodObject<{
|
|
3
|
+
input: z.ZodOptional<z.ZodNumber>;
|
|
4
|
+
output: z.ZodOptional<z.ZodNumber>;
|
|
5
|
+
cacheRead: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
cacheWrite: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
/** Estimated USD cost reported by pi-ai for one or more model calls. */
|
|
10
|
+
export type AgentTurnCost = z.output<typeof agentTurnCostSchema>;
|
|
11
|
+
export declare const agentTurnUsageSchema: z.ZodObject<{
|
|
12
|
+
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
cachedInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
cacheCreationTokens: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
reasoningTokens: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
totalTokens: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
cost: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
input: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
output: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
cacheRead: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
cacheWrite: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
}, z.core.$strict>>;
|
|
25
|
+
}, z.core.$strict>;
|
|
1
26
|
/**
|
|
2
|
-
* Structured token usage captured for a single agent turn.
|
|
27
|
+
* Structured token and cost usage captured for a single agent turn.
|
|
3
28
|
*
|
|
4
29
|
* Mirrors the fields pi-ai emits on `AssistantMessage.usage` (see
|
|
5
30
|
* `@earendil-works/pi-ai` `Usage`) so diagnostics carry every counter the
|
|
6
31
|
* provider normalizes into the pi-ai shape as its own item. Renderers decide
|
|
7
32
|
* whether to display a breakdown or a single aggregate.
|
|
8
33
|
*/
|
|
9
|
-
export
|
|
10
|
-
/** Non-cached input tokens; OTel `gen_ai.usage.input_tokens` adds cache counters back in. */
|
|
11
|
-
inputTokens?: number;
|
|
12
|
-
/** Output tokens; pi-ai folds reasoning tokens into this for providers that report them. */
|
|
13
|
-
outputTokens?: number;
|
|
14
|
-
/** Cached input tokens read from the provider's prompt cache. */
|
|
15
|
-
cachedInputTokens?: number;
|
|
16
|
-
/** Input tokens written into the provider's prompt cache. */
|
|
17
|
-
cacheCreationTokens?: number;
|
|
18
|
-
/** Provider-reported total. May not equal the sum of individual counters across providers. */
|
|
19
|
-
totalTokens?: number;
|
|
20
|
-
}
|
|
34
|
+
export type AgentTurnUsage = z.output<typeof agentTurnUsageSchema>;
|
|
21
35
|
/** Return whether any token counter is present on a usage record. */
|
|
22
36
|
export declare function hasAgentTurnUsage(usage: AgentTurnUsage | undefined): usage is AgentTurnUsage;
|
|
23
37
|
/** Aggregate token usage across slices without double-counting provider totals. */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getStateAdapter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YDVEH3SB.js";
|
|
4
4
|
import {
|
|
5
5
|
logException,
|
|
6
6
|
logInfo,
|
|
7
7
|
logWarn
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-I35CTGPO.js";
|
|
9
9
|
|
|
10
10
|
// src/chat/plugins/logging.ts
|
|
11
11
|
function createPluginLogger(plugin) {
|
|
@@ -10,17 +10,17 @@ import {
|
|
|
10
10
|
juniorConversations,
|
|
11
11
|
legacyActorProvenance,
|
|
12
12
|
readSessionLogEntries
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-RITD7E5L.js";
|
|
14
14
|
import {
|
|
15
15
|
botConfig,
|
|
16
16
|
escapeXml,
|
|
17
17
|
getStateAdapter,
|
|
18
18
|
resolveGatewayModel
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-YDVEH3SB.js";
|
|
20
20
|
import {
|
|
21
21
|
logWarn,
|
|
22
22
|
setSpanAttributes
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-I35CTGPO.js";
|
|
24
24
|
import {
|
|
25
25
|
parseSlackMessageTs
|
|
26
26
|
} from "./chunk-7FBGKXPE.js";
|
|
@@ -462,7 +462,7 @@ async function hydrateConversationMessages(args) {
|
|
|
462
462
|
args.conversation.messages = [];
|
|
463
463
|
return;
|
|
464
464
|
}
|
|
465
|
-
const { ensureLegacyConversationImport: ensureLegacyConversationImport2 } = await import("./legacy-import-
|
|
465
|
+
const { ensureLegacyConversationImport: ensureLegacyConversationImport2 } = await import("./legacy-import-VZ2MEGP7.js");
|
|
466
466
|
await ensureLegacyConversationImport2({ conversationId: args.conversationId });
|
|
467
467
|
await hydrateConversationCompactions({
|
|
468
468
|
conversation: args.conversation,
|
|
@@ -6,13 +6,18 @@ import {
|
|
|
6
6
|
var sentry_exports = {};
|
|
7
7
|
__export(sentry_exports, {
|
|
8
8
|
captureException: () => captureException,
|
|
9
|
+
captureMessage: () => captureMessage,
|
|
9
10
|
continueTrace: () => continueTrace,
|
|
10
11
|
flush: () => flush,
|
|
12
|
+
getActiveSpan: () => getActiveSpan,
|
|
11
13
|
getClient: () => getClient,
|
|
12
14
|
getGlobalScope: () => getGlobalScope,
|
|
15
|
+
getTraceData: () => getTraceData,
|
|
13
16
|
init: () => init,
|
|
17
|
+
logger: () => logger,
|
|
14
18
|
setTag: () => setTag,
|
|
15
19
|
setUser: () => setUser,
|
|
20
|
+
spanToJSON: () => spanToJSON,
|
|
16
21
|
startInactiveSpan: () => startInactiveSpan,
|
|
17
22
|
startSpan: () => startSpan,
|
|
18
23
|
vercelAIIntegration: () => vercelAIIntegration,
|
|
@@ -22,13 +27,18 @@ __export(sentry_exports, {
|
|
|
22
27
|
});
|
|
23
28
|
import {
|
|
24
29
|
captureException,
|
|
30
|
+
captureMessage,
|
|
25
31
|
continueTrace,
|
|
26
32
|
flush,
|
|
33
|
+
getActiveSpan,
|
|
27
34
|
getClient,
|
|
28
35
|
getGlobalScope,
|
|
36
|
+
getTraceData,
|
|
29
37
|
init,
|
|
38
|
+
logger,
|
|
30
39
|
setTag,
|
|
31
40
|
setUser,
|
|
41
|
+
spanToJSON,
|
|
32
42
|
startInactiveSpan,
|
|
33
43
|
startSpan,
|
|
34
44
|
vercelAIIntegration,
|
|
@@ -41,13 +51,18 @@ export * from "@sentry/node";
|
|
|
41
51
|
export {
|
|
42
52
|
sentry_exports,
|
|
43
53
|
captureException,
|
|
54
|
+
captureMessage,
|
|
44
55
|
continueTrace,
|
|
45
56
|
flush,
|
|
57
|
+
getActiveSpan,
|
|
46
58
|
getClient,
|
|
47
59
|
getGlobalScope,
|
|
60
|
+
getTraceData,
|
|
48
61
|
init,
|
|
62
|
+
logger,
|
|
49
63
|
setTag,
|
|
50
64
|
setUser,
|
|
65
|
+
spanToJSON,
|
|
51
66
|
startInactiveSpan,
|
|
52
67
|
startSpan,
|
|
53
68
|
vercelAIIntegration,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeSlackConversationId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-S5KZ5LPG.js";
|
|
4
4
|
import {
|
|
5
5
|
parseSlackThreadId
|
|
6
6
|
} from "./chunk-GY34VGP5.js";
|
|
7
7
|
import {
|
|
8
8
|
getClient
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6GWA276C.js";
|
|
10
10
|
|
|
11
11
|
// src/handlers/health.ts
|
|
12
12
|
function GET() {
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
getStateAdapter,
|
|
7
7
|
toOptionalTrimmed
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YDVEH3SB.js";
|
|
9
9
|
import {
|
|
10
10
|
pluginCatalogRuntime
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-L7CDEIVJ.js";
|
|
12
12
|
import {
|
|
13
13
|
withSpan
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-I35CTGPO.js";
|
|
15
15
|
|
|
16
16
|
// src/chat/sandbox/runtime-dependency-snapshots.ts
|
|
17
17
|
import { createHash } from "crypto";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
JUNIOR_THREAD_STATE_TTL_MS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5C6XTTFI.js";
|
|
4
4
|
import {
|
|
5
5
|
getChatConfig,
|
|
6
6
|
getDefaultRedisStateAdapterFor,
|
|
7
7
|
getStateAdapter
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YDVEH3SB.js";
|
|
9
9
|
import {
|
|
10
10
|
parseDestination,
|
|
11
11
|
sameDestination
|
|
12
12
|
} from "./chunk-B7PUBQQM.js";
|
|
13
13
|
import {
|
|
14
14
|
parseStoredSlackActor
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-I35CTGPO.js";
|
|
16
16
|
import {
|
|
17
17
|
isRecord,
|
|
18
18
|
toOptionalNumber,
|