@sentry/junior 0.72.0 → 0.74.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/bin/junior.mjs +12 -10
- package/dist/api-reference.d.ts +1 -1
- package/dist/app.d.ts +11 -2
- package/dist/app.js +1233 -13143
- package/dist/chat/agent-dispatch/runner.d.ts +2 -0
- package/dist/chat/agent-dispatch/store.d.ts +2 -2
- package/dist/chat/agent-dispatch/types.d.ts +6 -3
- package/dist/chat/agent-dispatch/validation.d.ts +2 -3
- package/dist/chat/app/production.d.ts +11 -1
- package/dist/chat/app/services.d.ts +7 -0
- package/dist/chat/config.d.ts +3 -0
- package/dist/chat/conversations/configured.d.ts +5 -0
- package/dist/chat/conversations/sql/migrations.d.ts +11 -0
- package/dist/chat/conversations/sql/schema/conversations.d.ts +435 -0
- package/dist/chat/conversations/sql/schema/destinations.d.ts +200 -0
- package/dist/chat/conversations/sql/schema/identities.d.ts +214 -0
- package/dist/chat/conversations/sql/schema/migrations.d.ts +58 -0
- package/dist/chat/conversations/sql/schema/timestamps.d.ts +1 -0
- package/dist/chat/conversations/sql/schema.d.ts +910 -0
- package/dist/chat/conversations/sql/store.d.ts +52 -0
- package/dist/chat/conversations/state.d.ts +4 -0
- package/dist/chat/conversations/store.d.ts +57 -0
- package/dist/chat/destination.d.ts +3 -1
- package/dist/chat/ingress/slack-webhook.d.ts +2 -0
- package/dist/chat/logging.d.ts +3 -0
- package/dist/chat/oauth-flow.d.ts +1 -1
- package/dist/chat/plugins/agent-hooks.d.ts +2 -2
- package/dist/chat/plugins/registry.d.ts +2 -0
- package/dist/chat/plugins/types.d.ts +2 -0
- package/dist/chat/prompt.d.ts +4 -1
- package/dist/chat/requester.d.ts +19 -12
- package/dist/chat/respond.d.ts +7 -3
- package/dist/chat/runtime/agent-continue-runner.d.ts +1 -1
- package/dist/chat/runtime/reply-executor.d.ts +3 -1
- package/dist/chat/runtime/slack-resume.d.ts +3 -3
- package/dist/chat/runtime/slack-runtime.d.ts +13 -3
- package/dist/chat/runtime/turn.d.ts +15 -1
- package/dist/chat/sandbox/egress-credentials.d.ts +5 -2
- package/dist/chat/sandbox/egress-policy.d.ts +5 -1
- package/dist/chat/sandbox/egress-proxy.d.ts +2 -0
- package/dist/chat/sandbox/egress-schemas.d.ts +4 -0
- package/dist/chat/sandbox/egress-session.d.ts +3 -1
- package/dist/chat/sandbox/egress-tracing.d.ts +7 -0
- package/dist/chat/sandbox/sandbox.d.ts +2 -0
- package/dist/chat/sandbox/session.d.ts +3 -2
- package/dist/chat/services/auth-pause-response.d.ts +1 -1
- package/dist/chat/services/auth-pause.d.ts +2 -1
- package/dist/chat/services/mcp-auth-orchestration.d.ts +7 -6
- package/dist/chat/services/message-actor-identity.d.ts +2 -2
- package/dist/chat/services/pending-auth.d.ts +2 -0
- package/dist/chat/services/plugin-auth-orchestration.d.ts +14 -12
- package/dist/chat/services/turn-result.d.ts +3 -0
- package/dist/chat/slack/user.d.ts +2 -2
- package/dist/chat/sql/db.d.ts +20 -0
- package/dist/chat/sql/neon.d.ts +9 -0
- package/dist/chat/sql/schema.d.ts +906 -0
- package/dist/chat/state/turn-session.d.ts +3 -0
- package/dist/chat/task-execution/slack-work.d.ts +2 -0
- package/dist/chat/task-execution/state.d.ts +209 -0
- package/dist/chat/task-execution/store.d.ts +30 -114
- package/dist/chat/task-execution/vercel-callback.d.ts +2 -0
- package/dist/chat/task-execution/worker.d.ts +2 -0
- package/dist/chat/tools/slack/canvas-tools.d.ts +3 -2
- package/dist/chat/tools/slack/channel-list-messages.d.ts +2 -2
- package/dist/chat/tools/slack/channel-post-message.d.ts +3 -2
- package/dist/chat/tools/slack/context.d.ts +15 -2
- package/dist/chat/tools/slack/message-add-reaction.d.ts +3 -2
- package/dist/chat/tools/slack/thread-read.d.ts +2 -2
- package/dist/chat/tools/types.d.ts +19 -19
- package/dist/chunk-2LUZA3LY.js +275 -0
- package/dist/{chunk-6GEYPE6T.js → chunk-3BYAPS6B.js} +30 -6
- package/dist/{chunk-VLIO6RQR.js → chunk-6UP2Z2RZ.js} +4 -4
- package/dist/{chunk-GB3AL54K.js → chunk-7Q5YOUUT.js} +10 -2
- package/dist/{chunk-PP7AGSBU.js → chunk-CYUI7JU5.js} +18 -8
- package/dist/{chunk-3FYPXHPL.js → chunk-F6HWCPOC.js} +1 -1
- package/dist/{chunk-ZJQPA67D.js → chunk-GM7HTXYC.js} +230 -224
- package/dist/{chunk-VSNA5KAB.js → chunk-HYHKTFG2.js} +1338 -1499
- package/dist/chunk-JL2SLRAT.js +1970 -0
- package/dist/{chunk-4JXCSGSA.js → chunk-M4FLLXXD.js} +1 -1
- package/dist/{chunk-55XEZFGD.js → chunk-OR6NQJ5E.js} +2 -2
- package/dist/chunk-SJHUF3DP.js +43 -0
- package/dist/chunk-SQGMG7OD.js +12801 -0
- package/dist/{chunk-QUXPUKBH.js → chunk-Y7X25LFY.js} +1 -1
- package/dist/{chunk-ICKIDP7G.js → chunk-YOHFWWBV.js} +1 -1
- package/dist/{chunk-XC33FJZN.js → chunk-YRDS7VKO.js} +25 -4
- package/dist/cli/chat.js +205 -0
- package/dist/cli/check.js +9 -10
- package/dist/cli/init.js +1 -1
- package/dist/cli/run.js +10 -2
- package/dist/cli/snapshot-warmup.js +7 -7
- package/dist/cli/upgrade.js +81 -11
- package/dist/deployment.d.ts +4 -0
- package/dist/handlers/agent-dispatch.d.ts +6 -1
- package/dist/handlers/mcp-oauth-callback.d.ts +6 -1
- package/dist/handlers/oauth-callback.d.ts +6 -1
- package/dist/handlers/sandbox-egress-proxy.d.ts +2 -0
- package/dist/handlers/webhooks.d.ts +4 -2
- package/dist/instrumentation.js +17 -3
- package/dist/nitro.js +9 -10
- package/dist/reporting/conversations.d.ts +13 -3
- package/dist/reporting.d.ts +9 -2
- package/dist/reporting.js +114 -48
- package/dist/runner-27NP2TEO.js +259 -0
- package/dist/vercel.d.ts +6 -1
- package/dist/vercel.js +1 -1
- package/package.json +9 -4
- package/dist/chunk-6YY4Q3D4.js +0 -12
- package/dist/chunk-HNMUVGSR.js +0 -1119
- package/dist/chunk-Z3YD6NHK.js +0 -12
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import {
|
|
2
|
+
normalizeSlackConversationId
|
|
3
|
+
} from "./chunk-YRDS7VKO.js";
|
|
4
|
+
import {
|
|
5
|
+
getStateAdapter
|
|
6
|
+
} from "./chunk-F6HWCPOC.js";
|
|
7
|
+
import {
|
|
8
|
+
parseSlackThreadId
|
|
9
|
+
} from "./chunk-GM7HTXYC.js";
|
|
10
|
+
import {
|
|
11
|
+
parseStoredSlackRequester
|
|
12
|
+
} from "./chunk-CYUI7JU5.js";
|
|
13
|
+
import {
|
|
14
|
+
isRecord,
|
|
15
|
+
toOptionalNumber
|
|
16
|
+
} from "./chunk-3BYAPS6B.js";
|
|
17
|
+
import {
|
|
18
|
+
sentry_exports
|
|
19
|
+
} from "./chunk-SJHUF3DP.js";
|
|
20
|
+
|
|
21
|
+
// src/handlers/health.ts
|
|
22
|
+
function GET() {
|
|
23
|
+
return Response.json({
|
|
24
|
+
status: "ok",
|
|
25
|
+
service: "junior",
|
|
26
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// src/chat/sentry-links.ts
|
|
31
|
+
function getSentryOrgSlug() {
|
|
32
|
+
const slug = process.env.SENTRY_ORG_SLUG?.trim();
|
|
33
|
+
return slug || void 0;
|
|
34
|
+
}
|
|
35
|
+
function isSentrySaasDsnHost(host) {
|
|
36
|
+
return host === "sentry.io" || host.endsWith(".sentry.io");
|
|
37
|
+
}
|
|
38
|
+
function buildSentryWebBaseUrl(dsn) {
|
|
39
|
+
if (isSentrySaasDsnHost(dsn.host)) {
|
|
40
|
+
return "https://sentry.io";
|
|
41
|
+
}
|
|
42
|
+
const port = dsn.port ? `:${dsn.port}` : "";
|
|
43
|
+
const path = dsn.path ? `/${dsn.path}` : "";
|
|
44
|
+
return `${dsn.protocol}://${dsn.host}${port}${path}`;
|
|
45
|
+
}
|
|
46
|
+
function buildSentryConversationUrl(conversationId) {
|
|
47
|
+
const client = sentry_exports.getClient();
|
|
48
|
+
const dsn = client?.getDsn();
|
|
49
|
+
if (!dsn?.host || !dsn.projectId) {
|
|
50
|
+
return void 0;
|
|
51
|
+
}
|
|
52
|
+
const orgSlug = getSentryOrgSlug();
|
|
53
|
+
if (!orgSlug) {
|
|
54
|
+
return void 0;
|
|
55
|
+
}
|
|
56
|
+
const encodedId = encodeURIComponent(conversationId);
|
|
57
|
+
const params = new URLSearchParams();
|
|
58
|
+
params.set("project", dsn.projectId);
|
|
59
|
+
const path = `explore/conversations/${encodedId}/?${params.toString()}`;
|
|
60
|
+
if (isSentrySaasDsnHost(dsn.host)) {
|
|
61
|
+
return `https://${orgSlug}.sentry.io/${path}`;
|
|
62
|
+
}
|
|
63
|
+
return `${buildSentryWebBaseUrl(dsn)}/organizations/${orgSlug}/${path}`;
|
|
64
|
+
}
|
|
65
|
+
function buildSentryTraceUrl(traceId) {
|
|
66
|
+
const client = sentry_exports.getClient();
|
|
67
|
+
const dsn = client?.getDsn();
|
|
68
|
+
if (!dsn?.host || !dsn.projectId) {
|
|
69
|
+
return void 0;
|
|
70
|
+
}
|
|
71
|
+
const orgSlug = getSentryOrgSlug();
|
|
72
|
+
if (!orgSlug) {
|
|
73
|
+
return void 0;
|
|
74
|
+
}
|
|
75
|
+
const encodedTraceId = encodeURIComponent(traceId);
|
|
76
|
+
const params = new URLSearchParams();
|
|
77
|
+
params.set("project", dsn.projectId);
|
|
78
|
+
const path = `performance/trace/${encodedTraceId}/?${params.toString()}`;
|
|
79
|
+
if (isSentrySaasDsnHost(dsn.host)) {
|
|
80
|
+
return `https://${orgSlug}.sentry.io/${path}`;
|
|
81
|
+
}
|
|
82
|
+
return `${buildSentryWebBaseUrl(dsn)}/organizations/${orgSlug}/${path}`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// src/chat/slack/conversation-context.ts
|
|
86
|
+
function normalizeConversationName(type, channelName) {
|
|
87
|
+
const trimmed = channelName?.trim();
|
|
88
|
+
if (!trimmed) return void 0;
|
|
89
|
+
if (type === "public_channel" || type === "private_channel" || type === "private_channel_or_group_dm") {
|
|
90
|
+
return trimmed.startsWith("#") ? trimmed : `#${trimmed}`;
|
|
91
|
+
}
|
|
92
|
+
return trimmed;
|
|
93
|
+
}
|
|
94
|
+
function typeFromSlackChannelType(channelType) {
|
|
95
|
+
if (channelType === "channel") return "public_channel";
|
|
96
|
+
if (channelType === "group") return "private_channel";
|
|
97
|
+
if (channelType === "mpim") return "group_dm";
|
|
98
|
+
if (channelType === "im") return "direct_message";
|
|
99
|
+
return void 0;
|
|
100
|
+
}
|
|
101
|
+
function typeFromChannelId(channelId, channelName) {
|
|
102
|
+
const normalized = normalizeSlackConversationId(channelId);
|
|
103
|
+
if (!normalized) return void 0;
|
|
104
|
+
if (normalized.startsWith("C")) return "public_channel";
|
|
105
|
+
if (normalized.startsWith("D")) return "direct_message";
|
|
106
|
+
if (normalized.startsWith("G")) {
|
|
107
|
+
return channelName?.trim().startsWith("mpdm-") ? "group_dm" : "private_channel_or_group_dm";
|
|
108
|
+
}
|
|
109
|
+
return void 0;
|
|
110
|
+
}
|
|
111
|
+
function toSlackEventChannelType(channelType) {
|
|
112
|
+
if (channelType === "channel" || channelType === "group" || channelType === "mpim" || channelType === "im") {
|
|
113
|
+
return channelType;
|
|
114
|
+
}
|
|
115
|
+
return void 0;
|
|
116
|
+
}
|
|
117
|
+
function resolveSlackChannelTypeFromMessage(message) {
|
|
118
|
+
const raw = message.raw;
|
|
119
|
+
if (!raw || typeof raw !== "object") {
|
|
120
|
+
return void 0;
|
|
121
|
+
}
|
|
122
|
+
const channelType = raw.channel_type;
|
|
123
|
+
return typeof channelType === "string" ? toSlackEventChannelType(channelType.trim()) : void 0;
|
|
124
|
+
}
|
|
125
|
+
function resolveSlackConversationContext(input) {
|
|
126
|
+
const type = typeFromSlackChannelType(input.channelType) ?? typeFromChannelId(input.channelId, input.channelName);
|
|
127
|
+
if (!type) return void 0;
|
|
128
|
+
const name = normalizeConversationName(type, input.channelName);
|
|
129
|
+
return {
|
|
130
|
+
type,
|
|
131
|
+
...name ? { name } : {}
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function resolveSlackConversationContextFromThreadId(input) {
|
|
135
|
+
const slackThread = parseSlackThreadId(input.threadId);
|
|
136
|
+
return resolveSlackConversationContext({
|
|
137
|
+
channelId: slackThread?.channelId,
|
|
138
|
+
channelName: input.channelName
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
function formatSlackConversationTypeLabel(type) {
|
|
142
|
+
if (type === "public_channel") return "Public Channel";
|
|
143
|
+
if (type === "private_channel") return "Private Channel";
|
|
144
|
+
if (type === "group_dm") return "Group DM";
|
|
145
|
+
if (type === "direct_message") return "Direct Message";
|
|
146
|
+
return "Private Channel or Group DM";
|
|
147
|
+
}
|
|
148
|
+
function formatSlackConversationRedactedLabel(context) {
|
|
149
|
+
if (!context) return void 0;
|
|
150
|
+
return formatSlackConversationTypeLabel(context.type);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// src/chat/state/conversation-details.ts
|
|
154
|
+
import { THREAD_STATE_TTL_MS } from "chat";
|
|
155
|
+
var CONVERSATION_PREFIX = "junior:conversation";
|
|
156
|
+
var CONVERSATION_DETAILS_TTL_MS = THREAD_STATE_TTL_MS;
|
|
157
|
+
function conversationContextKey(conversationId) {
|
|
158
|
+
return `${CONVERSATION_PREFIX}:${conversationId}:context`;
|
|
159
|
+
}
|
|
160
|
+
function conversationTitleKey(conversationId) {
|
|
161
|
+
return `${CONVERSATION_PREFIX}:${conversationId}:title`;
|
|
162
|
+
}
|
|
163
|
+
function parseOriginRequester(value) {
|
|
164
|
+
return parseStoredSlackRequester(value);
|
|
165
|
+
}
|
|
166
|
+
function parseOriginSurface(value) {
|
|
167
|
+
if (value === "slack" || value === "api" || value === "scheduler" || value === "internal") {
|
|
168
|
+
return value;
|
|
169
|
+
}
|
|
170
|
+
return void 0;
|
|
171
|
+
}
|
|
172
|
+
function storedContextFromInput(context) {
|
|
173
|
+
return {
|
|
174
|
+
...context.channelName ? { channelName: context.channelName } : {},
|
|
175
|
+
...context.originSurface ? { originSurface: context.originSurface } : {},
|
|
176
|
+
...context.originRequester ? { originRequester: context.originRequester } : {},
|
|
177
|
+
startedAtMs: context.startedAtMs
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function parseContext(value) {
|
|
181
|
+
if (!isRecord(value)) return void 0;
|
|
182
|
+
const startedAtMs = toOptionalNumber(value.startedAtMs);
|
|
183
|
+
if (startedAtMs === void 0) return void 0;
|
|
184
|
+
return {
|
|
185
|
+
...typeof value.channelName === "string" && value.channelName.trim() ? { channelName: value.channelName.trim() } : {},
|
|
186
|
+
...parseOriginSurface(value.originSurface) ? { originSurface: parseOriginSurface(value.originSurface) } : {},
|
|
187
|
+
...parseOriginRequester(value.originRequester) ? { originRequester: parseOriginRequester(value.originRequester) } : {},
|
|
188
|
+
startedAtMs
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function parseTitle(value) {
|
|
192
|
+
if (!isRecord(value)) return void 0;
|
|
193
|
+
const displayTitle = typeof value.displayTitle === "string" && value.displayTitle.trim() ? value.displayTitle.trim() : void 0;
|
|
194
|
+
if (!displayTitle) return void 0;
|
|
195
|
+
return {
|
|
196
|
+
displayTitle,
|
|
197
|
+
...typeof value.titleSourceMessageId === "string" ? { titleSourceMessageId: value.titleSourceMessageId } : {}
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
async function initConversationContext(conversationId, context) {
|
|
201
|
+
const stateAdapter = getStateAdapter();
|
|
202
|
+
await stateAdapter.connect();
|
|
203
|
+
const key = conversationContextKey(conversationId);
|
|
204
|
+
const inserted = await stateAdapter.setIfNotExists(
|
|
205
|
+
key,
|
|
206
|
+
storedContextFromInput(context),
|
|
207
|
+
CONVERSATION_DETAILS_TTL_MS
|
|
208
|
+
);
|
|
209
|
+
if (inserted) return;
|
|
210
|
+
const existing = parseContext(await stateAdapter.get(key));
|
|
211
|
+
if (!existing) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
await stateAdapter.set(key, existing, CONVERSATION_DETAILS_TTL_MS);
|
|
215
|
+
}
|
|
216
|
+
async function setConversationTitle(conversationId, title) {
|
|
217
|
+
const stateAdapter = getStateAdapter();
|
|
218
|
+
await stateAdapter.connect();
|
|
219
|
+
await stateAdapter.set(
|
|
220
|
+
conversationTitleKey(conversationId),
|
|
221
|
+
{
|
|
222
|
+
displayTitle: title.displayTitle,
|
|
223
|
+
...title.titleSourceMessageId ? { titleSourceMessageId: title.titleSourceMessageId } : {}
|
|
224
|
+
},
|
|
225
|
+
CONVERSATION_DETAILS_TTL_MS
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
async function getConversationDetails(conversationId) {
|
|
229
|
+
const stateAdapter = getStateAdapter();
|
|
230
|
+
await stateAdapter.connect();
|
|
231
|
+
const [rawContext, rawTitle] = await Promise.all([
|
|
232
|
+
stateAdapter.get(conversationContextKey(conversationId)),
|
|
233
|
+
stateAdapter.get(conversationTitleKey(conversationId))
|
|
234
|
+
]);
|
|
235
|
+
const context = parseContext(rawContext);
|
|
236
|
+
const title = parseTitle(rawTitle);
|
|
237
|
+
if (!context && !title) return void 0;
|
|
238
|
+
return {
|
|
239
|
+
conversationId,
|
|
240
|
+
...title?.displayTitle ? { displayTitle: title.displayTitle } : {},
|
|
241
|
+
...title?.titleSourceMessageId ? { titleSourceMessageId: title.titleSourceMessageId } : {},
|
|
242
|
+
...context?.channelName ? { channelName: context.channelName } : {},
|
|
243
|
+
...context?.originSurface ? { originSurface: context.originSurface } : {},
|
|
244
|
+
...context?.originRequester ? { originRequester: context.originRequester } : {},
|
|
245
|
+
...context?.startedAtMs !== void 0 ? { startedAtMs: context.startedAtMs } : {}
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
async function getConversationDetailsForIds(conversationIds) {
|
|
249
|
+
const uniqueIds = [...new Set(conversationIds)].filter(Boolean);
|
|
250
|
+
const entries = await Promise.all(
|
|
251
|
+
uniqueIds.map(async (id) => {
|
|
252
|
+
const details = await getConversationDetails(id);
|
|
253
|
+
return details ? [id, details] : void 0;
|
|
254
|
+
})
|
|
255
|
+
);
|
|
256
|
+
const result = /* @__PURE__ */ new Map();
|
|
257
|
+
for (const entry of entries) {
|
|
258
|
+
if (entry) result.set(entry[0], entry[1]);
|
|
259
|
+
}
|
|
260
|
+
return result;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export {
|
|
264
|
+
GET,
|
|
265
|
+
buildSentryConversationUrl,
|
|
266
|
+
buildSentryTraceUrl,
|
|
267
|
+
resolveSlackChannelTypeFromMessage,
|
|
268
|
+
resolveSlackConversationContext,
|
|
269
|
+
resolveSlackConversationContextFromThreadId,
|
|
270
|
+
formatSlackConversationRedactedLabel,
|
|
271
|
+
initConversationContext,
|
|
272
|
+
setConversationTitle,
|
|
273
|
+
getConversationDetails,
|
|
274
|
+
getConversationDetailsForIds
|
|
275
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
getDeploymentTelemetryAttributes,
|
|
2
3
|
sentry_exports
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SJHUF3DP.js";
|
|
4
5
|
|
|
5
6
|
// src/chat/logging.ts
|
|
6
7
|
import { AsyncLocalStorage } from "async_hooks";
|
|
@@ -76,6 +77,7 @@ function normalizeGenAiFinishReasons(value) {
|
|
|
76
77
|
}
|
|
77
78
|
var contextStorage = new AsyncLocalStorage();
|
|
78
79
|
var logRecordSinks = /* @__PURE__ */ new Set();
|
|
80
|
+
var deploymentLogAttributes = getDeploymentTelemetryAttributes();
|
|
79
81
|
var LOGTAPE_BODY_KEY = "__logtape_body";
|
|
80
82
|
var ROOT_LOGGER_CATEGORY = ["junior"];
|
|
81
83
|
var CONSOLE_PRIORITY_KEYS = [
|
|
@@ -820,11 +822,17 @@ function emitRecord(category, level, eventName, attrs = {}, body) {
|
|
|
820
822
|
const message = body ? redactSecrets(body) : normalizedEventName;
|
|
821
823
|
const source = getLogSource([...ROOT_LOGGER_CATEGORY, ...category]);
|
|
822
824
|
const contextAttributes = ownsLogTapeBackend ? void 0 : contextStorage.getStore();
|
|
823
|
-
const attributes = mergeAttributes(
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
825
|
+
const attributes = mergeAttributes(
|
|
826
|
+
contextAttributes,
|
|
827
|
+
traceAttributes,
|
|
828
|
+
{
|
|
829
|
+
"event.name": normalizedEventName,
|
|
830
|
+
...source ? { "app.log.source": source } : {},
|
|
831
|
+
...attrs
|
|
832
|
+
},
|
|
833
|
+
// Deployment identity is process-owned and must win over event-local attrs.
|
|
834
|
+
deploymentLogAttributes
|
|
835
|
+
);
|
|
828
836
|
if (usesDirectEmissionFallback) {
|
|
829
837
|
emitDirect(level, normalizedEventName, message, attributes);
|
|
830
838
|
return;
|
|
@@ -1138,6 +1146,21 @@ async function withSpan(name, op, context, callback, attributes = {}) {
|
|
|
1138
1146
|
);
|
|
1139
1147
|
});
|
|
1140
1148
|
}
|
|
1149
|
+
function getTracePropagationHeaders() {
|
|
1150
|
+
const sentry = sentry_exports;
|
|
1151
|
+
const traceData = sentry.getTraceData?.({ propagateTraceparent: true });
|
|
1152
|
+
if (!traceData) {
|
|
1153
|
+
return {};
|
|
1154
|
+
}
|
|
1155
|
+
const headers = {};
|
|
1156
|
+
for (const key of ["sentry-trace", "baggage", "traceparent"]) {
|
|
1157
|
+
const value = traceData[key];
|
|
1158
|
+
if (typeof value === "string" && value.trim()) {
|
|
1159
|
+
headers[key] = value;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
return headers;
|
|
1163
|
+
}
|
|
1141
1164
|
function setSpanAttributes(attributes) {
|
|
1142
1165
|
const sentry = sentry_exports;
|
|
1143
1166
|
const span = sentry.getActiveSpan?.();
|
|
@@ -1341,6 +1364,7 @@ export {
|
|
|
1341
1364
|
createRequestContext,
|
|
1342
1365
|
withContext,
|
|
1343
1366
|
withSpan,
|
|
1367
|
+
getTracePropagationHeaders,
|
|
1344
1368
|
setSpanAttributes,
|
|
1345
1369
|
setSpanStatus,
|
|
1346
1370
|
getActiveTraceId,
|
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
getPluginRuntimeDependencies,
|
|
6
6
|
getPluginRuntimePostinstall
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7Q5YOUUT.js";
|
|
8
8
|
import {
|
|
9
9
|
getStateAdapter
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-F6HWCPOC.js";
|
|
11
11
|
import {
|
|
12
12
|
toOptionalTrimmed
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-GM7HTXYC.js";
|
|
14
14
|
import {
|
|
15
15
|
withSpan
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-3BYAPS6B.js";
|
|
17
17
|
|
|
18
18
|
// src/chat/sandbox/runtime-dependency-snapshots.ts
|
|
19
19
|
import { createHash } from "crypto";
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
} from "./chunk-KVZL5NZS.js";
|
|
6
6
|
import {
|
|
7
7
|
parseActorUserId
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CYUI7JU5.js";
|
|
9
9
|
import {
|
|
10
10
|
logInfo,
|
|
11
11
|
logWarn,
|
|
12
12
|
setSpanAttributes
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-3BYAPS6B.js";
|
|
14
14
|
|
|
15
15
|
// src/chat/plugins/manifest.ts
|
|
16
16
|
import { z } from "zod";
|
|
@@ -101,6 +101,7 @@ function inlineTargetSource(name, target) {
|
|
|
101
101
|
function inlineManifestSource(manifest) {
|
|
102
102
|
const result = {};
|
|
103
103
|
setDefined(result, "name", manifest.name);
|
|
104
|
+
setDefined(result, "display-name", manifest.displayName);
|
|
104
105
|
setDefined(result, "description", manifest.description);
|
|
105
106
|
setDefined(
|
|
106
107
|
result,
|
|
@@ -316,6 +317,7 @@ var manifestSourceSchema = z.object({
|
|
|
316
317
|
name: z.string().refine((value) => PLUGIN_NAME_RE.test(value), {
|
|
317
318
|
error: "invalid"
|
|
318
319
|
}),
|
|
320
|
+
"display-name": nonEmptyTrimmedString,
|
|
319
321
|
description: nonEmptyTrimmedString,
|
|
320
322
|
capabilities: z.array(z.string(), {
|
|
321
323
|
error: "must be an array when provided"
|
|
@@ -355,6 +357,7 @@ function setDefined2(target, key, value) {
|
|
|
355
357
|
}
|
|
356
358
|
function manifestConfigPatch(config) {
|
|
357
359
|
const result = {};
|
|
360
|
+
setDefined2(result, "display-name", config.displayName);
|
|
358
361
|
setDefined2(result, "description", config.description);
|
|
359
362
|
setDefined2(result, "capabilities", config.capabilities);
|
|
360
363
|
setDefined2(result, "config-keys", config.configKeys);
|
|
@@ -952,6 +955,7 @@ function parseManifestSource(parsedSource, dir, config, options) {
|
|
|
952
955
|
const mcp = data.mcp ? normalizeMcp(data.mcp, envVars, data.name) : void 0;
|
|
953
956
|
const manifest = {
|
|
954
957
|
name: data.name,
|
|
958
|
+
displayName: data["display-name"],
|
|
955
959
|
description: data.description,
|
|
956
960
|
capabilities,
|
|
957
961
|
configKeys,
|
|
@@ -1887,6 +1891,9 @@ function getPluginForSkillPath(skillPath) {
|
|
|
1887
1891
|
function getPluginDefinition(provider) {
|
|
1888
1892
|
return ensurePluginsLoaded().pluginsByName.get(provider);
|
|
1889
1893
|
}
|
|
1894
|
+
function getPluginDisplayName(provider) {
|
|
1895
|
+
return ensurePluginsLoaded().pluginsByName.get(provider)?.manifest.displayName;
|
|
1896
|
+
}
|
|
1890
1897
|
function isPluginProvider(provider) {
|
|
1891
1898
|
return ensurePluginsLoaded().pluginsByName.has(provider);
|
|
1892
1899
|
}
|
|
@@ -1940,6 +1947,7 @@ export {
|
|
|
1940
1947
|
getPluginSkillRoots,
|
|
1941
1948
|
getPluginForSkillPath,
|
|
1942
1949
|
getPluginDefinition,
|
|
1950
|
+
getPluginDisplayName,
|
|
1943
1951
|
isPluginProvider,
|
|
1944
1952
|
isPluginConfigKey,
|
|
1945
1953
|
createPluginBroker
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isSlackTeamId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3BYAPS6B.js";
|
|
4
4
|
|
|
5
5
|
// src/chat/requester.ts
|
|
6
6
|
import { z } from "zod";
|
|
@@ -58,6 +58,10 @@ function isActorUserId(value) {
|
|
|
58
58
|
return parseActorUserId(value) === value;
|
|
59
59
|
}
|
|
60
60
|
function createRequester(input, context) {
|
|
61
|
+
const platform = context.platform ?? input?.platform;
|
|
62
|
+
if (!platform) {
|
|
63
|
+
return void 0;
|
|
64
|
+
}
|
|
61
65
|
const contextUserId = parseActorUserId(context.userId);
|
|
62
66
|
if (context.userId !== void 0 && !contextUserId) {
|
|
63
67
|
return void 0;
|
|
@@ -66,6 +70,10 @@ function createRequester(input, context) {
|
|
|
66
70
|
if (input?.userId !== void 0 && !inputUserId) {
|
|
67
71
|
return void 0;
|
|
68
72
|
}
|
|
73
|
+
const requesterUserId = contextUserId ?? inputUserId;
|
|
74
|
+
if (!requesterUserId) {
|
|
75
|
+
return void 0;
|
|
76
|
+
}
|
|
69
77
|
const contextTeamId = parseSlackTeamId(context.teamId);
|
|
70
78
|
if (context.teamId !== void 0 && !contextTeamId) {
|
|
71
79
|
return void 0;
|
|
@@ -74,24 +82,26 @@ function createRequester(input, context) {
|
|
|
74
82
|
if (input?.teamId !== void 0 && !inputTeamId) {
|
|
75
83
|
return void 0;
|
|
76
84
|
}
|
|
77
|
-
const requesterUserId = contextUserId ?? inputUserId;
|
|
78
85
|
const requesterTeamId = contextTeamId ?? inputTeamId;
|
|
79
|
-
if (
|
|
86
|
+
if (platform === "slack" && !requesterTeamId) {
|
|
80
87
|
return void 0;
|
|
81
88
|
}
|
|
82
|
-
const canUseInputProfile = (!contextUserId || !inputUserId || contextUserId === inputUserId) && (!contextTeamId || !inputTeamId || contextTeamId === inputTeamId);
|
|
83
|
-
|
|
89
|
+
const canUseInputProfile = (!contextUserId || !inputUserId || contextUserId === inputUserId) && (platform !== "slack" || !contextTeamId || !inputTeamId || contextTeamId === inputTeamId);
|
|
90
|
+
const requester = {
|
|
84
91
|
...canUseInputProfile && cleanRequesterEmail(input?.email) ? { email: cleanRequesterEmail(input?.email) } : {},
|
|
85
92
|
...canUseInputProfile && cleanRequesterDisplayName(input?.fullName, requesterUserId) ? {
|
|
86
93
|
fullName: cleanRequesterDisplayName(input?.fullName, requesterUserId)
|
|
87
94
|
} : {},
|
|
88
|
-
platform
|
|
89
|
-
teamId: requesterTeamId,
|
|
95
|
+
platform,
|
|
90
96
|
userId: requesterUserId,
|
|
91
97
|
...canUseInputProfile && cleanRequesterDisplayName(input?.userName, requesterUserId) ? {
|
|
92
98
|
userName: cleanRequesterDisplayName(input?.userName, requesterUserId)
|
|
93
99
|
} : {}
|
|
94
100
|
};
|
|
101
|
+
if (platform === "slack") {
|
|
102
|
+
return { ...requester, platform, teamId: requesterTeamId };
|
|
103
|
+
}
|
|
104
|
+
return { ...requester, platform };
|
|
95
105
|
}
|
|
96
106
|
function createSlackRequester(teamId, userId, profile) {
|
|
97
107
|
const actorUserId = parseActorUserId(userId);
|
|
@@ -110,7 +120,7 @@ function createSlackRequester(teamId, userId, profile) {
|
|
|
110
120
|
},
|
|
111
121
|
{ teamId: actorTeamId, userId: actorUserId }
|
|
112
122
|
);
|
|
113
|
-
if (!requester) {
|
|
123
|
+
if (!requester || requester.platform !== "slack") {
|
|
114
124
|
throw new Error("Slack requester requires team and user ids");
|
|
115
125
|
}
|
|
116
126
|
return requester;
|