@sentry/junior 0.178.0 → 0.180.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-PBT4NNBV.js → agent-hooks-DKDDRKZA.js} +16 -18
- package/dist/api/schema.js +0 -1
- package/dist/api.js +401 -366
- package/dist/app.d.ts +4 -0
- package/dist/app.js +783 -1367
- package/dist/catalog-runtime-WXKGUF3W.js +14 -0
- package/dist/chat/agent/sandbox.d.ts +0 -2
- package/dist/chat/api-turns/routing.d.ts +4 -0
- package/dist/chat/api-turns/work.d.ts +5 -0
- package/dist/chat/config.d.ts +5 -2
- package/dist/chat/configuration/defaults.d.ts +1 -1
- package/dist/chat/conversations/projection.d.ts +6 -4
- package/dist/chat/ingress/message-router.d.ts +3 -0
- package/dist/chat/model-profile.d.ts +8 -10
- package/dist/chat/pi/conversation-events.d.ts +3 -2
- package/dist/chat/plugins/task-queue.d.ts +40 -3
- package/dist/chat/plugins/task-runner.d.ts +1 -1
- package/dist/chat/queue/callback.d.ts +26 -0
- package/dist/chat/queue/sign.d.ts +30 -0
- package/dist/chat/sandbox/sandbox.d.ts +0 -2
- package/dist/chat/sandbox/session.d.ts +0 -2
- package/dist/chat/sandbox/skill-sync.d.ts +1 -1
- package/dist/chat/sandbox/snapshot/events.d.ts +23 -0
- package/dist/chat/sandbox/snapshot/job-callback.d.ts +5 -0
- package/dist/chat/sandbox/snapshot/job-queue.d.ts +26 -0
- package/dist/chat/sandbox/snapshot/job-runner.d.ts +11 -0
- package/dist/chat/sandbox/snapshot/not-ready-error.d.ts +6 -0
- package/dist/chat/sandbox/snapshot/workspace.d.ts +9 -3
- package/dist/chat/scheduled-tasks/personal.d.ts +5 -8
- package/dist/chat/scheduled-tasks/runs.d.ts +49 -0
- package/dist/chat/scheduled-tasks/schedule-intent.d.ts +1 -1
- package/dist/chat/scheduled-tasks/tasks.d.ts +27 -0
- package/dist/chat/scheduled-tasks/tool-support.d.ts +0 -4
- package/dist/chat/scheduled-tasks/tools/create.d.ts +1 -1
- package/dist/chat/scheduled-tasks/tools/update.d.ts +1 -1
- package/dist/chat/scheduled-tasks/types.d.ts +127 -78
- package/dist/chat/services/turn-router.d.ts +4 -3
- package/dist/chat/task-execution/queue-signing.d.ts +10 -21
- package/dist/chat/task-execution/state.d.ts +48 -0
- package/dist/chat/task-execution/store.d.ts +28 -2
- package/dist/chat/task-execution/worker.d.ts +4 -1
- package/dist/chat/tools/handoff/tool.d.ts +1 -1
- package/dist/{chunk-534BO42N.js → chunk-2AYEVN7K.js} +8 -8
- package/dist/{chunk-D3UJTX4U.js → chunk-2YIRH4E3.js} +46 -46
- package/dist/{chunk-4K6VNP3S.js → chunk-3ILJBWP7.js} +35 -227
- package/dist/{chunk-FQ6BMP5P.js → chunk-5PUMIMNQ.js} +2724 -1257
- package/dist/{chunk-G3CQEUHI.js → chunk-5TUR4M3M.js} +8 -61
- package/dist/{chunk-6ZWRNC4D.js → chunk-6Y5B5PEX.js} +1 -1
- package/dist/{chunk-KEQAA42D.js → chunk-6YCEWOLO.js} +4 -4
- package/dist/chunk-7H2VZTWN.js +103 -0
- package/dist/{chunk-22T3HB44.js → chunk-CCDXTDSY.js} +8 -8
- package/dist/{chunk-CGA4ERJ5.js → chunk-CEMMLV5L.js} +1 -1
- package/dist/chunk-CK6EINVZ.js +1181 -0
- package/dist/{chunk-FIANEE7Z.js → chunk-CM5HNV2W.js} +6 -6
- package/dist/{chunk-PRDKO3QB.js → chunk-CP73FKME.js} +144 -218
- package/dist/{chunk-XWUJWHFD.js → chunk-DHLOGWYH.js} +36 -36
- package/dist/chunk-DKIJ2RP5.js +68 -0
- package/dist/{chunk-ABLODWPO.js → chunk-DRHEGXTZ.js} +1 -1
- package/dist/{chunk-OOUNJNMR.js → chunk-DWPN6SCH.js} +1 -1
- package/dist/chunk-EWHP2IRG.js +209 -0
- package/dist/{chunk-ZCHHVTMF.js → chunk-FGC3PHNH.js} +3 -3
- package/dist/{chunk-H6ZXBFGX.js → chunk-GA5NS74S.js} +1 -1
- package/dist/{chunk-BFLMRTPD.js → chunk-GPXAHUQH.js} +84 -274
- package/dist/chunk-GUKXEPMX.js +218 -0
- package/dist/{chunk-3ZZEPLLB.js → chunk-I6IFTAPF.js} +108 -76
- package/dist/{chunk-RGXOLPWO.js → chunk-IANUX7HX.js} +5 -5
- package/dist/{chunk-UMG7M32G.js → chunk-KCL6AWYW.js} +74 -68
- package/dist/{chunk-BUGO42R6.js → chunk-L7LTGN4Z.js} +129 -31
- package/dist/{chunk-QCCLDJHB.js → chunk-LGVQLNLS.js} +42 -41
- package/dist/chunk-M3QYTBQ6.js +55 -0
- package/dist/{chunk-AVRWMQ4U.js → chunk-MXEUIGHO.js} +2 -2
- package/dist/{chunk-M63DETLL.js → chunk-N7TMSOZH.js} +6 -6
- package/dist/{chunk-JVXZ3WDH.js → chunk-O4QYZTDK.js} +33 -32
- package/dist/chunk-PEQXYSSE.js +45 -0
- package/dist/{chunk-OGRD5PFM.js → chunk-QSO7B5JO.js} +1 -1
- package/dist/{chunk-UGWBJAGN.js → chunk-RAZG3YHC.js} +100 -79
- package/dist/{chunk-XCNS3CXE.js → chunk-S7YRTOSQ.js} +69 -73
- package/dist/{chunk-LAOP4EPL.js → chunk-SDBKZ5LV.js} +108 -5
- package/dist/{chunk-RE4XWXBV.js → chunk-TC5DE5KJ.js} +22 -18
- package/dist/{chunk-H4HBKISO.js → chunk-TXKUKMVO.js} +1 -1
- package/dist/chunk-U5EUCUBH.js +164 -0
- package/dist/{chunk-BHHWCNXI.js → chunk-VG722ONZ.js} +18 -16
- package/dist/{chunk-U3UDPGZG.js → chunk-VGPPWWHF.js} +16 -16
- package/dist/{chunk-AQHSXA3J.js → chunk-WVAMRKYG.js} +9 -54
- package/dist/chunk-X6GDDWQH.js +60 -0
- package/dist/{chunk-6OYVH66J.js → chunk-ZE2KOV3G.js} +1 -1
- package/dist/{chunk-IQRPDKPJ.js → chunk-ZM7ZURJS.js} +4 -3
- package/dist/cli/chat.js +47 -43
- package/dist/cli/check.js +13 -15
- package/dist/cli/env.js +0 -1
- package/dist/cli/init.js +0 -1
- package/dist/cli/main.js +2 -3
- package/dist/cli/plugins.js +18 -20
- package/dist/cli/run.js +0 -1
- package/dist/cli/snapshot-create.js +14 -16
- package/dist/cli/upgrade.js +16 -18
- package/dist/{conversation-work-KATFHLG3.js → conversation-work-VIOQ5ZF3.js} +0 -2
- package/dist/db/schema/scheduled-tasks.d.ts +29 -5
- package/dist/db/schema.d.ts +28 -4
- package/dist/{db-QVYOWATH.js → db-6SBHIAJK.js} +8 -10
- package/dist/deployment.d.ts +1 -0
- package/dist/{discovery-GUFTFBTL.js → discovery-DWVDM7UK.js} +1 -2
- package/dist/{experimental-XVDOSRBS.js → experimental-SIJSRDJD.js} +0 -1
- package/dist/instrumentation.js +7 -9
- package/dist/nitro.js +39 -13
- package/dist/{oauth-callback-server-PLPAFXO6.js → oauth-callback-server-WSDQPZZS.js} +34 -32
- package/dist/{oauth-relay-3ZU72UGL.js → oauth-relay-5XPVRPYB.js} +0 -1
- package/dist/{plugins-HW4VWW6G.js → plugins-YTYJMMJF.js} +1 -2
- package/dist/{runner-AGNEIOZS.js → runner-GWTSWESR.js} +39 -33
- package/dist/{sandbox-egress-signals-DXOOBSBI.js → sandbox-egress-signals-FIL7EGPR.js} +5 -6
- package/dist/{sentry-JMWTS32N.js → sentry-MB3NL3IR.js} +1 -2
- package/dist/skills-F32BPFYW.js +27 -0
- package/dist/spawn-X5BPP5OE.js +37 -0
- package/dist/task-runner-2FPBV5PP.js +32 -0
- package/dist/validation-62WO524A.js +17 -0
- package/dist/vercel.js +0 -1
- package/dist/version.js +1 -2
- package/dist/work-3C3CMZ24.js +45 -0
- package/dist/worker-MFAI6ZEK.js +22 -0
- package/package.json +7 -6
- package/dist/catalog-runtime-M7QGKPFZ.js +0 -16
- package/dist/chat/plugins/task-callback.d.ts +0 -5
- package/dist/chat/plugins/task-message.d.ts +0 -23
- package/dist/chat/plugins/task-signing.d.ts +0 -31
- package/dist/chat/sandbox/snapshot/waiting-error.d.ts +0 -15
- package/dist/chat/scheduled-tasks/store.d.ts +0 -78
- package/dist/chat/services/workspace-snapshot-wait.d.ts +0 -27
- package/dist/chunk-5I6ORJUY.js +0 -127
- package/dist/chunk-6GWA276C.js +0 -72
- package/dist/chunk-AGJ4OQ2V.js +0 -51
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-RGV6KHDM.js +0 -1944
- package/dist/chunk-WR76IVA5.js +0 -130
- package/dist/skills-U5KQ66EM.js +0 -29
- package/dist/spawn-ZRYYZP2B.js +0 -37
- package/dist/validation-QE4U45KS.js +0 -19
- package/dist/work-ATAXAHJJ.js +0 -45
- package/dist/worker-LIL5AOER.js +0 -24
|
@@ -5,28 +5,28 @@ import {
|
|
|
5
5
|
isDmChannel,
|
|
6
6
|
normalizeSlackConversationId,
|
|
7
7
|
withSlackRetries
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-DHLOGWYH.js";
|
|
9
9
|
import {
|
|
10
10
|
parseDestination
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-S7YRTOSQ.js";
|
|
12
12
|
import {
|
|
13
13
|
getStateAdapter
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-GA5NS74S.js";
|
|
15
15
|
import {
|
|
16
16
|
normalizeSlackEmojiName
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-I6IFTAPF.js";
|
|
18
18
|
import {
|
|
19
19
|
pluginCatalogRuntime
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-DRHEGXTZ.js";
|
|
21
21
|
import {
|
|
22
22
|
parseSlackMessageTs,
|
|
23
23
|
parseSlackUserId
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-N7TMSOZH.js";
|
|
25
25
|
import {
|
|
26
26
|
isRecord,
|
|
27
27
|
logInfo,
|
|
28
28
|
logWarn
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-RAZG3YHC.js";
|
|
30
30
|
|
|
31
31
|
// src/chat/slack/outbound.ts
|
|
32
32
|
var MAX_SLACK_MESSAGE_TEXT_CHARS = 4e4;
|
|
@@ -101,16 +101,17 @@ async function postSlackMessage(input) {
|
|
|
101
101
|
unfurl_links: false,
|
|
102
102
|
unfurl_media: false,
|
|
103
103
|
...input.blocks?.length ? {
|
|
104
|
+
// @ts-expect-error non-overlapping boundary cast; rule forbids as-unknown-as chains
|
|
104
105
|
blocks: input.blocks
|
|
105
|
-
} :
|
|
106
|
-
...threadTs ? { thread_ts: threadTs } :
|
|
106
|
+
} : void 0,
|
|
107
|
+
...threadTs ? { thread_ts: threadTs } : void 0
|
|
107
108
|
}),
|
|
108
109
|
3,
|
|
109
110
|
{
|
|
110
111
|
action: "chat.postMessage",
|
|
111
112
|
spanAttributes: {
|
|
112
113
|
"app.slack.channel_id": channelId,
|
|
113
|
-
...threadTs ? { "app.slack.thread_ts": threadTs } :
|
|
114
|
+
...threadTs ? { "app.slack.thread_ts": threadTs } : void 0
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
117
|
);
|
|
@@ -125,7 +126,7 @@ async function postSlackMessage(input) {
|
|
|
125
126
|
channelId,
|
|
126
127
|
messageTs
|
|
127
128
|
})
|
|
128
|
-
} :
|
|
129
|
+
} : void 0
|
|
129
130
|
};
|
|
130
131
|
}
|
|
131
132
|
async function postSlackEphemeralMessage(input) {
|
|
@@ -150,7 +151,7 @@ async function postSlackEphemeralMessage(input) {
|
|
|
150
151
|
channel: channelId,
|
|
151
152
|
user: userId,
|
|
152
153
|
text,
|
|
153
|
-
...threadTs ? { thread_ts: threadTs } :
|
|
154
|
+
...threadTs ? { thread_ts: threadTs } : void 0
|
|
154
155
|
}),
|
|
155
156
|
3,
|
|
156
157
|
{
|
|
@@ -158,7 +159,7 @@ async function postSlackEphemeralMessage(input) {
|
|
|
158
159
|
spanAttributes: {
|
|
159
160
|
"app.slack.channel_id": channelId,
|
|
160
161
|
"app.slack.user_id": userId,
|
|
161
|
-
...threadTs ? { "app.slack.thread_ts": threadTs } :
|
|
162
|
+
...threadTs ? { "app.slack.thread_ts": threadTs } : void 0
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
165
|
);
|
|
@@ -190,7 +191,7 @@ async function uploadFilesToConversation(input) {
|
|
|
190
191
|
const response = await withSlackRetries(
|
|
191
192
|
() => getSlackClient().filesUploadV2({
|
|
192
193
|
channel_id: channelId,
|
|
193
|
-
...threadTs ? { thread_ts: threadTs } :
|
|
194
|
+
...threadTs ? { thread_ts: threadTs } : void 0,
|
|
194
195
|
file_uploads: fileUploads
|
|
195
196
|
}),
|
|
196
197
|
3,
|
|
@@ -198,7 +199,7 @@ async function uploadFilesToConversation(input) {
|
|
|
198
199
|
action: "filesUploadV2",
|
|
199
200
|
spanAttributes: {
|
|
200
201
|
"app.slack.channel_id": channelId,
|
|
201
|
-
...threadTs ? { "app.slack.thread_ts": threadTs } :
|
|
202
|
+
...threadTs ? { "app.slack.thread_ts": threadTs } : void 0
|
|
202
203
|
}
|
|
203
204
|
}
|
|
204
205
|
);
|
|
@@ -534,14 +535,14 @@ function parseOAuthStatePayload(value) {
|
|
|
534
535
|
return {
|
|
535
536
|
userId: value.userId,
|
|
536
537
|
provider: value.provider,
|
|
537
|
-
...actor?.success ? { actor: actor.data } :
|
|
538
|
-
...optionalString(value.channelId) ? { channelId: optionalString(value.channelId) } :
|
|
539
|
-
...destination ? { destination } :
|
|
540
|
-
...source?.success ? { source: source.data } :
|
|
541
|
-
...optionalString(value.threadTs) ? { threadTs: optionalString(value.threadTs) } :
|
|
542
|
-
...optionalString(value.resumeConversationId) ? { resumeConversationId: optionalString(value.resumeConversationId) } :
|
|
543
|
-
...optionalString(value.resumeSessionId) ? { resumeSessionId: optionalString(value.resumeSessionId) } :
|
|
544
|
-
...optionalString(value.scope) ? { scope: optionalString(value.scope) } :
|
|
538
|
+
...actor?.success ? { actor: actor.data } : void 0,
|
|
539
|
+
...optionalString(value.channelId) ? { channelId: optionalString(value.channelId) } : void 0,
|
|
540
|
+
...destination ? { destination } : void 0,
|
|
541
|
+
...source?.success ? { source: source.data } : void 0,
|
|
542
|
+
...optionalString(value.threadTs) ? { threadTs: optionalString(value.threadTs) } : void 0,
|
|
543
|
+
...optionalString(value.resumeConversationId) ? { resumeConversationId: optionalString(value.resumeConversationId) } : void 0,
|
|
544
|
+
...optionalString(value.resumeSessionId) ? { resumeSessionId: optionalString(value.resumeSessionId) } : void 0,
|
|
545
|
+
...optionalString(value.scope) ? { scope: optionalString(value.scope) } : void 0
|
|
545
546
|
};
|
|
546
547
|
}
|
|
547
548
|
function formatProviderLabel(provider) {
|
|
@@ -657,14 +658,14 @@ async function startOAuthFlow(provider, input) {
|
|
|
657
658
|
{
|
|
658
659
|
userId: input.actorId,
|
|
659
660
|
provider,
|
|
660
|
-
...input.actor ? { actor: input.actor } :
|
|
661
|
-
...input.channelId ? { channelId: input.channelId } :
|
|
662
|
-
...input.destination ? { destination: input.destination } :
|
|
663
|
-
...input.source ? { source: input.source } :
|
|
664
|
-
...input.threadTs ? { threadTs: input.threadTs } :
|
|
665
|
-
...input.resumeConversationId ? { resumeConversationId: input.resumeConversationId } :
|
|
666
|
-
...input.resumeSessionId ? { resumeSessionId: input.resumeSessionId } :
|
|
667
|
-
...requestedScope ? { scope: requestedScope } :
|
|
661
|
+
...input.actor ? { actor: input.actor } : void 0,
|
|
662
|
+
...input.channelId ? { channelId: input.channelId } : void 0,
|
|
663
|
+
...input.destination ? { destination: input.destination } : void 0,
|
|
664
|
+
...input.source ? { source: input.source } : void 0,
|
|
665
|
+
...input.threadTs ? { threadTs: input.threadTs } : void 0,
|
|
666
|
+
...input.resumeConversationId ? { resumeConversationId: input.resumeConversationId } : void 0,
|
|
667
|
+
...input.resumeSessionId ? { resumeSessionId: input.resumeSessionId } : void 0,
|
|
668
|
+
...requestedScope ? { scope: requestedScope } : void 0
|
|
668
669
|
},
|
|
669
670
|
OAUTH_STATE_TTL_MS
|
|
670
671
|
);
|
|
@@ -684,7 +685,7 @@ async function startOAuthFlow(provider, input) {
|
|
|
684
685
|
}
|
|
685
686
|
logInfo("jr_rpc.oauth.started", {
|
|
686
687
|
"app.credential.provider": provider,
|
|
687
|
-
...input.activeSkillName ? { "app.skill.name": input.activeSkillName } :
|
|
688
|
+
...input.activeSkillName ? { "app.skill.name": input.activeSkillName } : void 0
|
|
688
689
|
});
|
|
689
690
|
const authorizationUrl = `${providerConfig.authorizeEndpoint}?${authorizeParams.toString()}`;
|
|
690
691
|
const authorizationRequest = {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// src/chat/sentry.ts
|
|
2
|
+
import {
|
|
3
|
+
captureException,
|
|
4
|
+
captureMessage,
|
|
5
|
+
continueTrace,
|
|
6
|
+
flush,
|
|
7
|
+
getActiveSpan,
|
|
8
|
+
getClient,
|
|
9
|
+
getGlobalScope,
|
|
10
|
+
getTraceData,
|
|
11
|
+
init,
|
|
12
|
+
logger,
|
|
13
|
+
setTag,
|
|
14
|
+
setUser,
|
|
15
|
+
spanToJSON,
|
|
16
|
+
startInactiveSpan,
|
|
17
|
+
startSpan,
|
|
18
|
+
vercelAIIntegration,
|
|
19
|
+
withActiveSpan,
|
|
20
|
+
withScope,
|
|
21
|
+
withStreamedSpan
|
|
22
|
+
} from "@sentry/node";
|
|
23
|
+
export * from "@sentry/node";
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
captureException,
|
|
27
|
+
captureMessage,
|
|
28
|
+
continueTrace,
|
|
29
|
+
flush,
|
|
30
|
+
getActiveSpan,
|
|
31
|
+
getClient,
|
|
32
|
+
getGlobalScope,
|
|
33
|
+
getTraceData,
|
|
34
|
+
init,
|
|
35
|
+
logger,
|
|
36
|
+
setTag,
|
|
37
|
+
setUser,
|
|
38
|
+
spanToJSON,
|
|
39
|
+
startInactiveSpan,
|
|
40
|
+
startSpan,
|
|
41
|
+
vercelAIIntegration,
|
|
42
|
+
withActiveSpan,
|
|
43
|
+
withScope,
|
|
44
|
+
withStreamedSpan
|
|
45
|
+
};
|
|
@@ -1,15 +1,55 @@
|
|
|
1
1
|
import {
|
|
2
2
|
captureException,
|
|
3
|
+
captureMessage,
|
|
3
4
|
getActiveSpan,
|
|
4
|
-
|
|
5
|
+
getTraceData,
|
|
6
|
+
logger,
|
|
5
7
|
setTag,
|
|
6
8
|
setUser,
|
|
9
|
+
spanToJSON,
|
|
7
10
|
startSpan,
|
|
8
11
|
withScope
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PEQXYSSE.js";
|
|
10
13
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./chunk-
|
|
14
|
+
JUNIOR_VERSION
|
|
15
|
+
} from "./chunk-ZM7ZURJS.js";
|
|
16
|
+
|
|
17
|
+
// src/deployment.ts
|
|
18
|
+
var JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
|
|
19
|
+
var JUNIOR_HEARTBEAT_CRON_SCHEDULE = "* * * * *";
|
|
20
|
+
var JUNIOR_RETENTION_ROUTE = "/api/internal/retention";
|
|
21
|
+
var JUNIOR_RETENTION_CRON_SCHEDULE = "0 4 * * *";
|
|
22
|
+
var JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE = "/api/internal/agent/continue";
|
|
23
|
+
var JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE = "/api/internal/plugin/tasks";
|
|
24
|
+
var JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE = "/api/internal/workspace/snapshots";
|
|
25
|
+
var LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION = "api/internal/agent/continue.ts";
|
|
26
|
+
function toOptionalTrimmed(value) {
|
|
27
|
+
const trimmed = value?.trim();
|
|
28
|
+
return trimmed ? trimmed : void 0;
|
|
29
|
+
}
|
|
30
|
+
function getDeploymentServiceVersion() {
|
|
31
|
+
const configuredRelease = toOptionalTrimmed(process.env.SENTRY_RELEASE);
|
|
32
|
+
if (configuredRelease) {
|
|
33
|
+
return configuredRelease;
|
|
34
|
+
}
|
|
35
|
+
const deploymentRevision = toOptionalTrimmed(
|
|
36
|
+
process.env.VERCEL_GIT_COMMIT_SHA
|
|
37
|
+
);
|
|
38
|
+
return deploymentRevision ? `${JUNIOR_VERSION}+${deploymentRevision}` : void 0;
|
|
39
|
+
}
|
|
40
|
+
function getDeploymentTelemetryAttributes() {
|
|
41
|
+
const attributes = {};
|
|
42
|
+
const serviceVersion = getDeploymentServiceVersion();
|
|
43
|
+
const deploymentId = toOptionalTrimmed(process.env.VERCEL_DEPLOYMENT_ID);
|
|
44
|
+
attributes["app.junior.version"] = JUNIOR_VERSION;
|
|
45
|
+
if (serviceVersion) {
|
|
46
|
+
attributes["service.version"] = serviceVersion;
|
|
47
|
+
}
|
|
48
|
+
if (deploymentId) {
|
|
49
|
+
attributes["deployment.id"] = deploymentId;
|
|
50
|
+
}
|
|
51
|
+
return attributes;
|
|
52
|
+
}
|
|
13
53
|
|
|
14
54
|
// src/chat/logging.ts
|
|
15
55
|
import path from "path";
|
|
@@ -407,14 +447,10 @@ function contextToAttributes(context) {
|
|
|
407
447
|
return mergeAttributes(logContextToAttributes(context));
|
|
408
448
|
}
|
|
409
449
|
function getTraceCorrelationAttributes() {
|
|
410
|
-
const sentry = sentry_exports;
|
|
411
|
-
if (typeof sentry.getActiveSpan !== "function" || typeof sentry.spanToJSON !== "function") {
|
|
412
|
-
return {};
|
|
413
|
-
}
|
|
414
450
|
try {
|
|
415
|
-
const span =
|
|
451
|
+
const span = getActiveSpan();
|
|
416
452
|
if (!span) return {};
|
|
417
|
-
const json =
|
|
453
|
+
const json = spanToJSON(span);
|
|
418
454
|
const attrs = {};
|
|
419
455
|
if (json.trace_id) attrs.trace_id = json.trace_id;
|
|
420
456
|
if (json.span_id) attrs.span_id = json.span_id;
|
|
@@ -553,37 +589,28 @@ function getLogTapeLogger(category = []) {
|
|
|
553
589
|
if (!rootLogger) {
|
|
554
590
|
throw new Error("LogTape backend is unavailable");
|
|
555
591
|
}
|
|
556
|
-
let
|
|
592
|
+
let logger2 = rootLogger;
|
|
557
593
|
for (const part of category) {
|
|
558
|
-
|
|
594
|
+
logger2 = logger2.getChild(part);
|
|
559
595
|
}
|
|
560
|
-
return
|
|
596
|
+
return logger2;
|
|
561
597
|
}
|
|
562
598
|
function emitSentry(level, body, attributes) {
|
|
563
599
|
if (shouldSuppressInfoLog(level)) {
|
|
564
600
|
return;
|
|
565
601
|
}
|
|
566
|
-
const
|
|
567
|
-
const loggerFn = sentry.logger?.[level];
|
|
602
|
+
const loggerFn = logger?.[level];
|
|
568
603
|
if (typeof loggerFn === "function") {
|
|
569
604
|
loggerFn(body, attributes);
|
|
570
605
|
return;
|
|
571
606
|
}
|
|
572
|
-
const sentryWithScope = sentry.withScope;
|
|
573
|
-
const sentryCaptureMessage = sentry.captureMessage;
|
|
574
607
|
const sentryLevel = level === "warn" ? "warning" : level;
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
});
|
|
582
|
-
return;
|
|
583
|
-
}
|
|
584
|
-
if (typeof sentryCaptureMessage === "function") {
|
|
585
|
-
sentryCaptureMessage(body, sentryLevel);
|
|
586
|
-
}
|
|
608
|
+
withScope((scope) => {
|
|
609
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
610
|
+
scope.setExtra(key, value);
|
|
611
|
+
}
|
|
612
|
+
captureMessage(body, sentryLevel);
|
|
613
|
+
});
|
|
587
614
|
}
|
|
588
615
|
function formatConsoleLevel(level) {
|
|
589
616
|
if (level === "debug") return "DBG";
|
|
@@ -890,7 +917,7 @@ function emitRecord(category, level, eventName, attrs = {}, body) {
|
|
|
890
917
|
traceAttributes,
|
|
891
918
|
{
|
|
892
919
|
"event.name": normalizedEventName,
|
|
893
|
-
...source ? { "app.log.source": source } :
|
|
920
|
+
...source ? { "app.log.source": source } : void 0,
|
|
894
921
|
...attrs
|
|
895
922
|
},
|
|
896
923
|
// Deployment identity is process-owned and must win over event-local attrs.
|
|
@@ -900,24 +927,24 @@ function emitRecord(category, level, eventName, attrs = {}, body) {
|
|
|
900
927
|
emitDirect(level, normalizedEventName, message, attributes);
|
|
901
928
|
return;
|
|
902
929
|
}
|
|
903
|
-
const
|
|
930
|
+
const logger2 = getLogTapeLogger(category);
|
|
904
931
|
const properties = {
|
|
905
932
|
[LOGTAPE_BODY_KEY]: message,
|
|
906
933
|
...attributes
|
|
907
934
|
};
|
|
908
935
|
if (level === "error") {
|
|
909
|
-
|
|
936
|
+
logger2.error(`{${LOGTAPE_BODY_KEY}}`, properties);
|
|
910
937
|
return;
|
|
911
938
|
}
|
|
912
939
|
if (level === "warn") {
|
|
913
|
-
|
|
940
|
+
logger2.warn(`{${LOGTAPE_BODY_KEY}}`, properties);
|
|
914
941
|
return;
|
|
915
942
|
}
|
|
916
943
|
if (level === "info") {
|
|
917
|
-
|
|
944
|
+
logger2.info(`{${LOGTAPE_BODY_KEY}}`, properties);
|
|
918
945
|
return;
|
|
919
946
|
}
|
|
920
|
-
|
|
947
|
+
logger2.debug(`{${LOGTAPE_BODY_KEY}}`, properties);
|
|
921
948
|
}
|
|
922
949
|
function emit(level, eventName, attrs = {}, body) {
|
|
923
950
|
emitRecord([], level, eventName, attrs, body);
|
|
@@ -950,29 +977,18 @@ var log = {
|
|
|
950
977
|
body
|
|
951
978
|
);
|
|
952
979
|
let eventId;
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
attrs
|
|
961
|
-
);
|
|
962
|
-
for (const [key, value] of Object.entries(mergedAttributes)) {
|
|
963
|
-
scope.setExtra(key, value);
|
|
964
|
-
if (SENTRY_TAG_ATTRIBUTE_KEYS.has(key) && typeof value === "string" && value.length > 0) {
|
|
965
|
-
scope.setTag(key, value);
|
|
966
|
-
}
|
|
980
|
+
withScope((scope) => {
|
|
981
|
+
setSentryScopeContext(scope, getBoundLogContext());
|
|
982
|
+
const mergedAttributes = mergeAttributes(getBoundLogAttributes(), attrs);
|
|
983
|
+
for (const [key, value] of Object.entries(mergedAttributes)) {
|
|
984
|
+
scope.setExtra(key, value);
|
|
985
|
+
if (SENTRY_TAG_ATTRIBUTE_KEYS.has(key) && typeof value === "string" && value.length > 0) {
|
|
986
|
+
scope.setTag(key, value);
|
|
967
987
|
}
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
}
|
|
972
|
-
if (typeof sentryCaptureException === "function") {
|
|
973
|
-
setSentryUser(sentryUserIdentityFromContext(getBoundLogContext()));
|
|
974
|
-
eventId = sentryCaptureException(normalizedError);
|
|
975
|
-
}
|
|
988
|
+
}
|
|
989
|
+
const capturedEventId = captureException(normalizedError);
|
|
990
|
+
eventId = typeof capturedEventId === "string" ? capturedEventId : void 0;
|
|
991
|
+
});
|
|
976
992
|
return eventId;
|
|
977
993
|
}
|
|
978
994
|
};
|
|
@@ -1105,8 +1121,8 @@ function sentryUserIdentityFromContext(context) {
|
|
|
1105
1121
|
const email = normalizeIdentityEmail(context.userEmail);
|
|
1106
1122
|
return {
|
|
1107
1123
|
id: context.userId,
|
|
1108
|
-
...context.userName ? { username: context.userName } :
|
|
1109
|
-
...email ? { email } :
|
|
1124
|
+
...context.userName ? { username: context.userName } : void 0,
|
|
1125
|
+
...email ? { email } : void 0
|
|
1110
1126
|
};
|
|
1111
1127
|
}
|
|
1112
1128
|
return void 0;
|
|
@@ -1115,8 +1131,8 @@ function sentryUserFromIdentity(identity) {
|
|
|
1115
1131
|
return {
|
|
1116
1132
|
id: identity.id,
|
|
1117
1133
|
ip_address: null,
|
|
1118
|
-
...identity.username ? { username: identity.username } :
|
|
1119
|
-
...identity.email ? { email: identity.email } :
|
|
1134
|
+
...identity.username ? { username: identity.username } : void 0,
|
|
1135
|
+
...identity.email ? { email: identity.email } : void 0
|
|
1120
1136
|
};
|
|
1121
1137
|
}
|
|
1122
1138
|
function setSentryUser(identity) {
|
|
@@ -1231,8 +1247,7 @@ async function withSpan(name, op, context, callback, attributes = {}) {
|
|
|
1231
1247
|
});
|
|
1232
1248
|
}
|
|
1233
1249
|
function getTracePropagationHeaders() {
|
|
1234
|
-
const
|
|
1235
|
-
const traceData = sentry.getTraceData?.({ propagateTraceparent: true });
|
|
1250
|
+
const traceData = getTraceData({ propagateTraceparent: true });
|
|
1236
1251
|
if (!traceData) {
|
|
1237
1252
|
return {};
|
|
1238
1253
|
}
|
|
@@ -1262,16 +1277,12 @@ function setSpanStatus(status) {
|
|
|
1262
1277
|
);
|
|
1263
1278
|
}
|
|
1264
1279
|
function getActiveTraceId() {
|
|
1265
|
-
const sentry = sentry_exports;
|
|
1266
|
-
if (typeof sentry.getActiveSpan !== "function" || typeof sentry.spanToJSON !== "function") {
|
|
1267
|
-
return void 0;
|
|
1268
|
-
}
|
|
1269
1280
|
try {
|
|
1270
|
-
const span =
|
|
1281
|
+
const span = getActiveSpan();
|
|
1271
1282
|
if (!span) {
|
|
1272
1283
|
return void 0;
|
|
1273
1284
|
}
|
|
1274
|
-
return toOptionalString(
|
|
1285
|
+
return toOptionalString(spanToJSON(span).trace_id);
|
|
1275
1286
|
} catch {
|
|
1276
1287
|
return void 0;
|
|
1277
1288
|
}
|
|
@@ -1454,17 +1465,17 @@ function extractGenAiUsageAttributes(...sources) {
|
|
|
1454
1465
|
cacheCreationTokens
|
|
1455
1466
|
);
|
|
1456
1467
|
return {
|
|
1457
|
-
...semanticInputTokens !== void 0 ? { "gen_ai.usage.input_tokens": semanticInputTokens } :
|
|
1458
|
-
...outputTokens !== void 0 ? { "gen_ai.usage.output_tokens": outputTokens } :
|
|
1468
|
+
...semanticInputTokens !== void 0 ? { "gen_ai.usage.input_tokens": semanticInputTokens } : void 0,
|
|
1469
|
+
...outputTokens !== void 0 ? { "gen_ai.usage.output_tokens": outputTokens } : void 0,
|
|
1459
1470
|
// OTel has no monetary cost attributes, so report accounting generically.
|
|
1460
|
-
...cachedInputTokens !== void 0 ? { "gen_ai.usage.cache_read.input_tokens": cachedInputTokens } :
|
|
1461
|
-
...cacheCreationTokens !== void 0 ? { "gen_ai.usage.cache_creation.input_tokens": cacheCreationTokens } :
|
|
1462
|
-
...reasoningTokens !== void 0 ? { "gen_ai.usage.reasoning.output_tokens": reasoningTokens } :
|
|
1463
|
-
...cost?.input !== void 0 ? { "app.cost.input_usd": cost.input } :
|
|
1464
|
-
...cost?.output !== void 0 ? { "app.cost.output_usd": cost.output } :
|
|
1465
|
-
...cost?.cacheRead !== void 0 ? { "app.cost.cache_read_usd": cost.cacheRead } :
|
|
1466
|
-
...cost?.cacheWrite !== void 0 ? { "app.cost.cache_write_usd": cost.cacheWrite } :
|
|
1467
|
-
...cost?.total !== void 0 ? { "app.cost.total_usd": cost.total } :
|
|
1471
|
+
...cachedInputTokens !== void 0 ? { "gen_ai.usage.cache_read.input_tokens": cachedInputTokens } : void 0,
|
|
1472
|
+
...cacheCreationTokens !== void 0 ? { "gen_ai.usage.cache_creation.input_tokens": cacheCreationTokens } : void 0,
|
|
1473
|
+
...reasoningTokens !== void 0 ? { "gen_ai.usage.reasoning.output_tokens": reasoningTokens } : void 0,
|
|
1474
|
+
...cost?.input !== void 0 ? { "app.cost.input_usd": cost.input } : void 0,
|
|
1475
|
+
...cost?.output !== void 0 ? { "app.cost.output_usd": cost.output } : void 0,
|
|
1476
|
+
...cost?.cacheRead !== void 0 ? { "app.cost.cache_read_usd": cost.cacheRead } : void 0,
|
|
1477
|
+
...cost?.cacheWrite !== void 0 ? { "app.cost.cache_write_usd": cost.cacheWrite } : void 0,
|
|
1478
|
+
...cost?.total !== void 0 ? { "app.cost.total_usd": cost.total } : void 0
|
|
1468
1479
|
};
|
|
1469
1480
|
}
|
|
1470
1481
|
|
|
@@ -1473,6 +1484,16 @@ export {
|
|
|
1473
1484
|
toOptionalNumber,
|
|
1474
1485
|
isRecord,
|
|
1475
1486
|
normalizeIdentityEmail,
|
|
1487
|
+
JUNIOR_HEARTBEAT_ROUTE,
|
|
1488
|
+
JUNIOR_HEARTBEAT_CRON_SCHEDULE,
|
|
1489
|
+
JUNIOR_RETENTION_ROUTE,
|
|
1490
|
+
JUNIOR_RETENTION_CRON_SCHEDULE,
|
|
1491
|
+
JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
|
|
1492
|
+
JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE,
|
|
1493
|
+
JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE,
|
|
1494
|
+
LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION,
|
|
1495
|
+
getDeploymentServiceVersion,
|
|
1496
|
+
getDeploymentTelemetryAttributes,
|
|
1476
1497
|
normalizeGenAiFinishReason,
|
|
1477
1498
|
summarizeMessageText,
|
|
1478
1499
|
createChatSdkLogger,
|