@sentry/junior 0.108.0 → 0.109.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-NU5HK3PS.js → agent-hooks-FHHVLNPA.js} +12 -12
- package/dist/api/conversations/events.d.ts +1 -1
- package/dist/api/conversations/schema.d.ts +57 -6
- package/dist/api/schema.js +1 -1
- package/dist/api.js +108 -22
- package/dist/app.d.ts +1 -0
- package/dist/app.js +1481 -420
- package/dist/{catalog-runtime-FOFNPR3P.js → catalog-runtime-DMGJSLV2.js} +6 -4
- package/dist/chat/conversations/sql/store.d.ts +0 -7
- package/dist/chat/log-context.d.ts +40 -0
- package/dist/chat/logging.d.ts +3 -26
- package/dist/chat/runtime/slack-resume.d.ts +2 -2
- package/dist/chat/services/turn-session-record.d.ts +0 -2
- package/dist/chat/slack/reply.d.ts +7 -19
- package/dist/chat/state/conversation.d.ts +1 -0
- package/dist/chat/task-execution/slack-work.d.ts +2 -2
- package/dist/chunk-3SXUV423.js +10 -0
- package/dist/{chunk-3RGQLX2F.js → chunk-72OMGPDS.js} +1010 -26
- package/dist/{chunk-2XXEKR44.js → chunk-7Q6WCISF.js} +1 -1
- package/dist/{chunk-TE4QHJH4.js → chunk-FENLIFJD.js} +72 -591
- package/dist/{chunk-XKB7LGIW.js → chunk-FWJRXN4F.js} +3 -3
- package/dist/{chunk-PUAMO4PI.js → chunk-HHVY4SMP.js} +41 -7
- package/dist/{chunk-B5I5LMSP.js → chunk-HO5NT6OE.js} +5 -7
- package/dist/{chunk-O24R4DCK.js → chunk-ISMWX44P.js} +93 -55
- package/dist/{chunk-7FBGKXPE.js → chunk-IVVGFRQQ.js} +5 -0
- package/dist/{chunk-KPMPQ6AA.js → chunk-IXKSQGIO.js} +90 -100
- package/dist/{chunk-SS67LUOK.js → chunk-JNAVF45E.js} +6 -7
- package/dist/{chunk-DY7TRYB5.js → chunk-MGUMR35T.js} +1 -1
- package/dist/{chunk-A5CO2EHL.js → chunk-MXW4GL53.js} +11 -15
- package/dist/{chunk-RT5BUHR5.js → chunk-O3JMSZLI.js} +1 -1
- package/dist/chunk-OCD3OZRK.js +125 -0
- package/dist/{chunk-H3QYZL7K.js → chunk-OUHNWH46.js} +28 -3
- package/dist/{chunk-VIXFG2VC.js → chunk-PLB7MRCQ.js} +1 -2
- package/dist/{chunk-UD6THJ2I.js → chunk-QY636HZU.js} +114 -12
- package/dist/{chunk-VH6KWKG2.js → chunk-RGX4V75M.js} +3 -3
- package/dist/{chunk-B7PUBQQM.js → chunk-SYAQIR5Z.js} +1 -1
- package/dist/chunk-TMBRFULF.js +471 -0
- package/dist/{chunk-YIPD3L6L.js → chunk-TT6GMXNA.js} +8 -10
- package/dist/{chunk-YT72TOEK.js → chunk-WHMOBKT7.js} +2 -2
- package/dist/cli/chat.js +23 -23
- package/dist/cli/check.js +8 -6
- package/dist/cli/plugins.js +16 -16
- package/dist/cli/snapshot-warmup.js +10 -9
- package/dist/cli/upgrade.js +314 -3505
- package/dist/db/db.d.ts +1 -1
- package/dist/{db-AMRBAT5D.js → db-V3NU72O2.js} +8 -6
- package/dist/instrumentation.js +3 -2
- package/dist/nitro.js +5 -4
- package/dist/{runner-TQH5GAJ4.js → runner-JYBCQBLK.js} +17 -20
- package/dist/{skills-ITNHBARB.js → skills-U6MDAST7.js} +7 -5
- package/dist/{validation-AGQ46ZGV.js → validation-72N3JVRU.js} +7 -5
- package/dist/version.d.ts +2 -0
- package/dist/version.js +7 -0
- package/migrations/0006_drop_legacy_conversation_messages.sql +1 -0
- package/migrations/README.md +12 -9
- package/migrations/meta/0006_snapshot.json +948 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +9 -5
- package/dist/chunk-AHJR2IFF.js +0 -115
- package/dist/chunk-G3E7SCME.js +0 -28
- package/dist/chunk-J3B3FPP2.js +0 -1061
- package/dist/chunk-TWINAEZQ.js +0 -1283
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pluginCatalogRuntime
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-3SXUV423.js";
|
|
4
|
+
import "./chunk-TT6GMXNA.js";
|
|
5
|
+
import "./chunk-PLB7MRCQ.js";
|
|
6
|
+
import "./chunk-ISMWX44P.js";
|
|
6
7
|
import "./chunk-OB42YVAE.js";
|
|
7
8
|
import "./chunk-6GWA276C.js";
|
|
8
9
|
import "./chunk-B3IT5END.js";
|
|
9
|
-
import "./chunk-7FBGKXPE.js";
|
|
10
10
|
import "./chunk-3V7OFJZC.js";
|
|
11
|
+
import "./chunk-IVVGFRQQ.js";
|
|
12
|
+
import "./chunk-OCD3OZRK.js";
|
|
11
13
|
import "./chunk-MLKGABMK.js";
|
|
12
14
|
export {
|
|
13
15
|
pluginCatalogRuntime
|
|
@@ -38,13 +38,6 @@ export declare class SqlStore implements ConversationStore {
|
|
|
38
38
|
updatedAtMs: number;
|
|
39
39
|
visibility?: ConversationPrivacy;
|
|
40
40
|
}): Promise<void>;
|
|
41
|
-
/** Copy one conversation record and retained metrics into SQL during backfill. */
|
|
42
|
-
backfillConversation(sourceConversation: Conversation, metrics?: {
|
|
43
|
-
durationMs: number;
|
|
44
|
-
executionDurationMs: number;
|
|
45
|
-
executionUsage?: AgentTurnUsage;
|
|
46
|
-
usage?: AgentTurnUsage;
|
|
47
|
-
}): Promise<void>;
|
|
48
41
|
listByActivity(args?: {
|
|
49
42
|
limit?: number;
|
|
50
43
|
offset?: number;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
export type LogAttributeValue = string | number | boolean | string[];
|
|
3
|
+
export type LogAttributes = Record<string, LogAttributeValue>;
|
|
4
|
+
/** Provider-neutral correlation data inherited by logs and spans in an operation. */
|
|
5
|
+
export interface LogContext {
|
|
6
|
+
conversationId?: string;
|
|
7
|
+
platform?: string;
|
|
8
|
+
requestId?: string;
|
|
9
|
+
messageConversationId?: string;
|
|
10
|
+
destinationName?: string;
|
|
11
|
+
userId?: string;
|
|
12
|
+
userName?: string;
|
|
13
|
+
userEmail?: string;
|
|
14
|
+
runId?: string;
|
|
15
|
+
actorType?: string;
|
|
16
|
+
actorId?: string;
|
|
17
|
+
assistantUserName?: string;
|
|
18
|
+
modelId?: string;
|
|
19
|
+
skillName?: string;
|
|
20
|
+
httpMethod?: string;
|
|
21
|
+
httpPath?: string;
|
|
22
|
+
urlFull?: string;
|
|
23
|
+
userAgent?: string;
|
|
24
|
+
}
|
|
25
|
+
/** Async attribute domain consumed directly by LogTape. */
|
|
26
|
+
export declare const logContextStorage: AsyncLocalStorage<LogAttributes>;
|
|
27
|
+
/** Convert provider-neutral domain context to stable telemetry attributes. */
|
|
28
|
+
export declare function logContextToAttributes(context: LogContext): LogAttributes;
|
|
29
|
+
/** Run an operation with merged context, restoring its parent on completion. */
|
|
30
|
+
export declare function runWithLogContext<T>(context: LogContext, attributes: LogAttributes, callback: () => T): T;
|
|
31
|
+
/** Run an operation with raw attributes, restoring its parent on completion. */
|
|
32
|
+
export declare function runWithLogAttributes<T>(attributes: LogAttributes, callback: () => T): T;
|
|
33
|
+
/** Merge raw attributes into the current scoped operation. */
|
|
34
|
+
export declare function updateLogAttributes(attributes: LogAttributes): void;
|
|
35
|
+
/** Merge context and attributes into the current scoped operation. */
|
|
36
|
+
export declare function updateLogContext(context: LogContext, attributes: LogAttributes): void;
|
|
37
|
+
/** Read the typed context bound to the current operation. */
|
|
38
|
+
export declare function getBoundLogContext(): LogContext;
|
|
39
|
+
/** Read the attributes bound to the current operation. */
|
|
40
|
+
export declare function getBoundLogAttributes(): LogAttributes;
|
package/dist/chat/logging.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { Logger as ChatSdkLogger } from "chat";
|
|
2
|
+
import { type LogAttributes, type LogContext } from "@/chat/log-context";
|
|
2
3
|
import * as Sentry from "@/chat/sentry";
|
|
3
4
|
import type { AgentTurnUsage } from "@/chat/usage";
|
|
4
|
-
type
|
|
5
|
-
type AttributeValue = Primitive | string[];
|
|
6
|
-
export type LogAttributes = Record<string, AttributeValue>;
|
|
5
|
+
export type { LogAttributes, LogContext } from "@/chat/log-context";
|
|
7
6
|
export type LogLevel = "debug" | "info" | "warn" | "error";
|
|
8
7
|
export interface EmittedLogRecord {
|
|
9
8
|
attributes: LogAttributes;
|
|
@@ -11,26 +10,6 @@ export interface EmittedLogRecord {
|
|
|
11
10
|
eventName: string;
|
|
12
11
|
level: LogLevel;
|
|
13
12
|
}
|
|
14
|
-
export interface LogContext {
|
|
15
|
-
conversationId?: string;
|
|
16
|
-
platform?: string;
|
|
17
|
-
requestId?: string;
|
|
18
|
-
slackThreadId?: string;
|
|
19
|
-
slackUserId?: string;
|
|
20
|
-
slackUserName?: string;
|
|
21
|
-
slackUserEmail?: string;
|
|
22
|
-
slackChannelId?: string;
|
|
23
|
-
runId?: string;
|
|
24
|
-
actorType?: string;
|
|
25
|
-
actorId?: string;
|
|
26
|
-
assistantUserName?: string;
|
|
27
|
-
modelId?: string;
|
|
28
|
-
skillName?: string;
|
|
29
|
-
httpMethod?: string;
|
|
30
|
-
httpPath?: string;
|
|
31
|
-
urlFull?: string;
|
|
32
|
-
userAgent?: string;
|
|
33
|
-
}
|
|
34
13
|
export type TracePropagationHeaders = Partial<Record<"baggage" | "sentry-trace" | "traceparent", string>>;
|
|
35
14
|
interface SentryUserIdentity {
|
|
36
15
|
id: string | number;
|
|
@@ -51,7 +30,6 @@ export declare const log: {
|
|
|
51
30
|
/** Create a Chat SDK logger that routes records through Junior's logging backend. */
|
|
52
31
|
export declare function createChatSdkLogger(): ChatSdkLogger;
|
|
53
32
|
export declare function withLogContext<T>(context: LogContext, callback: () => Promise<T>): Promise<T>;
|
|
54
|
-
export declare function setLogContext(context: LogContext): void;
|
|
55
33
|
export declare function getLogContextAttributes(): LogAttributes;
|
|
56
34
|
/** Return inherited log context filtered to attributes valid for the span operation. */
|
|
57
35
|
export declare function getLogContextAttributesForSpan(op: string): LogAttributes;
|
|
@@ -75,7 +53,7 @@ export declare function logWarn(eventName: string, context?: LogContext, attribu
|
|
|
75
53
|
export declare function logError(eventName: string, context?: LogContext, attributes?: Record<string, unknown>, body?: string): void;
|
|
76
54
|
/** Log an error with exception capture; returns the Sentry event ID if available. */
|
|
77
55
|
export declare function logException(error: unknown, eventName: string, context?: LogContext, attributes?: Record<string, unknown>, body?: string): string | undefined;
|
|
78
|
-
/**
|
|
56
|
+
/** Add context to the current operation and Sentry scope. */
|
|
79
57
|
export declare function setTags(context?: LogContext): void;
|
|
80
58
|
/** Create a LogContext from an incoming HTTP request. */
|
|
81
59
|
export declare function createRequestContext(request: Request, context?: Partial<LogContext>): LogContext;
|
|
@@ -107,4 +85,3 @@ export declare function serializeGenAiAttribute(value: unknown, maxChars?: numbe
|
|
|
107
85
|
export declare function extractGenAiUsageSummary(...sources: unknown[]): AgentTurnUsage;
|
|
108
86
|
/** Extract GenAI token and estimated USD cost attributes for tracing. */
|
|
109
87
|
export declare function extractGenAiUsageAttributes(...sources: unknown[]): Partial<Record<"gen_ai.usage.input_tokens" | "gen_ai.usage.output_tokens" | "gen_ai.usage.cache_read.input_tokens" | "gen_ai.usage.cache_creation.input_tokens" | "gen_ai.usage.reasoning.output_tokens", number> & Partial<Record<"app.cost.input_usd" | "app.cost.output_usd" | "app.cost.cache_read_usd" | "app.cost.cache_write_usd" | "app.cost.total_usd", number>>>;
|
|
110
|
-
export {};
|
|
@@ -26,7 +26,7 @@ interface ResumeSlackTurnArgs {
|
|
|
26
26
|
conversationId: string;
|
|
27
27
|
sessionId: string;
|
|
28
28
|
}) => Promise<void>;
|
|
29
|
-
|
|
29
|
+
commitResult?: (result: AgentRunResult) => Promise<void>;
|
|
30
30
|
onFailure?: (error: unknown) => Promise<void>;
|
|
31
31
|
onAuthPause?: (pause: {
|
|
32
32
|
providerDisplayName: string;
|
|
@@ -45,7 +45,7 @@ interface ResumePreparedTurn {
|
|
|
45
45
|
inputMessageIds?: string[];
|
|
46
46
|
initialStatus?: AssistantStatusSpec;
|
|
47
47
|
replyContext: ResumeReplyContext;
|
|
48
|
-
|
|
48
|
+
commitResult?: (result: AgentRunResult) => Promise<void>;
|
|
49
49
|
onFailure?: (error: unknown) => Promise<void>;
|
|
50
50
|
onAuthPause?: (pause: {
|
|
51
51
|
providerDisplayName: string;
|
|
@@ -64,7 +64,6 @@ export declare function persistCompletedSessionRecord(args: {
|
|
|
64
64
|
sliceId?: number;
|
|
65
65
|
allMessages: PiMessage[];
|
|
66
66
|
loadedSkillNames?: string[];
|
|
67
|
-
logContext: SessionRecordLogContext;
|
|
68
67
|
modelId: string;
|
|
69
68
|
actor?: Actor;
|
|
70
69
|
reasoningLevel?: string;
|
|
@@ -79,7 +78,6 @@ export declare function completeDeliveredTurn(args: {
|
|
|
79
78
|
destinationVisibility?: ConversationPrivacy;
|
|
80
79
|
durationMs?: number;
|
|
81
80
|
loadedSkillNames?: string[];
|
|
82
|
-
logContext: SessionRecordLogContext;
|
|
83
81
|
messages: PiMessage[];
|
|
84
82
|
modelId: string;
|
|
85
83
|
actor?: Actor;
|
|
@@ -1,24 +1,12 @@
|
|
|
1
|
-
import { type SlackReplyFooter } from "@/chat/slack/footer";
|
|
2
|
-
export type PlannedSlackReplyStage = "thread_reply" | "thread_reply_continuation";
|
|
3
|
-
export interface PlannedSlackReplyPost {
|
|
4
|
-
stage: PlannedSlackReplyStage;
|
|
5
|
-
text: string;
|
|
6
|
-
}
|
|
7
|
-
/** Plan the Slack posts for one completed assistant message. */
|
|
8
|
-
export declare function planSlackAssistantMessagePosts(text: string): PlannedSlackReplyPost[];
|
|
9
1
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
2
|
+
* Send one destination-visible Slack reply.
|
|
3
|
+
*
|
|
4
|
+
* Chunks oversized text, builds the conversation footer from
|
|
5
|
+
* `conversationId`, and posts through the shared Slack outbound boundary.
|
|
12
6
|
*/
|
|
13
|
-
export declare function
|
|
14
|
-
beforePost?: () => Promise<void>;
|
|
15
|
-
footer?: SlackReplyFooter;
|
|
7
|
+
export declare function sendSlackReply(args: {
|
|
16
8
|
channelId: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
messageTs?: string;
|
|
20
|
-
stage: PlannedSlackReplyStage;
|
|
21
|
-
}) => Promise<void> | void;
|
|
9
|
+
conversationId: string;
|
|
10
|
+
text: string;
|
|
22
11
|
threadTs?: string;
|
|
23
|
-
posts: PlannedSlackReplyPost[];
|
|
24
12
|
}): Promise<string | undefined>;
|
|
@@ -71,8 +71,8 @@ declare const slackConversationMessageMetadataSchema: z.ZodUnion<readonly [z.Zod
|
|
|
71
71
|
adapterName: z.ZodLiteral<"slack">;
|
|
72
72
|
channelId: z.ZodString;
|
|
73
73
|
channelVisibility: z.ZodOptional<z.ZodEnum<{
|
|
74
|
-
private: "private";
|
|
75
74
|
unknown: "unknown";
|
|
75
|
+
private: "private";
|
|
76
76
|
external: "external";
|
|
77
77
|
workspace: "workspace";
|
|
78
78
|
}>>;
|
|
@@ -181,8 +181,8 @@ declare const slackConversationMessageMetadataSchema: z.ZodUnion<readonly [z.Zod
|
|
|
181
181
|
adapterName: z.ZodLiteral<"slack">;
|
|
182
182
|
channelId: z.ZodString;
|
|
183
183
|
channelVisibility: z.ZodOptional<z.ZodEnum<{
|
|
184
|
-
private: "private";
|
|
185
184
|
unknown: "unknown";
|
|
185
|
+
private: "private";
|
|
186
186
|
external: "external";
|
|
187
187
|
workspace: "workspace";
|
|
188
188
|
}>>;
|