@sentry/junior 0.138.0 → 0.140.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-SCR74Q3E.js → agent-hooks-BFTDRFUO.js} +10 -10
- package/dist/api/schema/task.d.ts +104 -1
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +9 -1
- package/dist/api.js +198 -54
- package/dist/app.js +374 -607
- package/dist/{catalog-runtime-IU3QF4GG.js → catalog-runtime-RK664S5T.js} +6 -6
- package/dist/chat/agent/request.d.ts +12 -2
- package/dist/chat/credentials/context.d.ts +14 -0
- package/dist/chat/resource-events/actor.d.ts +23 -0
- package/dist/chat/scheduled-tasks/telemetry.d.ts +7 -0
- package/dist/chat/scheduled-tasks/tool-support.d.ts +10 -2
- package/dist/chat/scheduled-tasks/tools/create.d.ts +4 -2
- package/dist/chat/scheduled-tasks/tools/delete.d.ts +4 -2
- package/dist/chat/scheduled-tasks/tools/list.d.ts +4 -2
- package/dist/chat/scheduled-tasks/tools/run-now.d.ts +4 -2
- package/dist/chat/scheduled-tasks/tools/update.d.ts +4 -2
- package/dist/chat/scheduled-tasks/types.d.ts +1 -1
- package/dist/chat/slack/dashboard-link.d.ts +2 -0
- package/dist/chat/state/turn-session-keys.d.ts +2 -2
- package/dist/chat/state/turn-session.d.ts +16 -12
- package/dist/chat/tasks/execution-stats.d.ts +34 -3
- package/dist/chat/tasks/read.d.ts +3 -1
- package/dist/chunk-3B7O3GNU.js +207 -0
- package/dist/{chunk-N7WARMC6.js → chunk-3CUBAGA3.js} +7 -7
- package/dist/{chunk-5MXWHTCK.js → chunk-4PIT6O7A.js} +17 -8
- package/dist/{chunk-DCLLQGS6.js → chunk-557HLSNH.js} +8 -3
- package/dist/{chunk-SD3OFRWY.js → chunk-5KAZMR5U.js} +6 -6
- package/dist/{chunk-ZBSMCXKV.js → chunk-5YAWB2AX.js} +7 -6
- package/dist/{chunk-FEUNPTGV.js → chunk-A6BI25J3.js} +434 -12
- package/dist/{chunk-5LTJ4ITU.js → chunk-AA2EPMUF.js} +4 -4
- package/dist/{chunk-TUUDXEXU.js → chunk-BMFRFSTM.js} +68 -79
- package/dist/{chunk-C7ZVPO4Z.js → chunk-CPPTBHQN.js} +1 -1
- package/dist/{chunk-ZXNTJJIE.js → chunk-D3X2PI3D.js} +2 -2
- package/dist/{chunk-LPVUNO2W.js → chunk-DMDOKRPC.js} +7 -7
- package/dist/{chunk-TCS76X5D.js → chunk-HEFBGCCU.js} +2 -2
- package/dist/{chunk-EPBBYMNE.js → chunk-HUO3UTAQ.js} +1 -1
- package/dist/{chunk-KFRHRSCJ.js → chunk-I3OZR3HG.js} +2 -2
- package/dist/{chunk-BOLJOV5T.js → chunk-J5H65GY2.js} +1 -1
- package/dist/{chunk-RZIBSCYC.js → chunk-MYVCHWDG.js} +39 -23
- package/dist/{chunk-QS527AV5.js → chunk-N2I7W2VS.js} +1 -1
- package/dist/{chunk-JNNJZURV.js → chunk-NPL66ZWL.js} +1 -1
- package/dist/{chunk-A7WCHXZV.js → chunk-OGNL2QY7.js} +4 -4
- package/dist/{chunk-77VDLF3Z.js → chunk-RUIXF3YQ.js} +10 -0
- package/dist/{chunk-BYW4B4PR.js → chunk-S3FAOKQU.js} +2 -2
- package/dist/chunk-TGIKZJ3Y.js +115 -0
- package/dist/{chunk-YU5QUF67.js → chunk-TKTZ4L4Z.js} +1 -1
- package/dist/{chunk-VPZFVJND.js → chunk-UXMRN2ZX.js} +1 -1
- package/dist/{chunk-HIWJWWMT.js → chunk-VRDHAITB.js} +3 -3
- package/dist/{chunk-SIPKWSXK.js → chunk-WSWM6A3R.js} +3 -3
- package/dist/{chunk-FNLBTB4K.js → chunk-WTGLUX4K.js} +1 -1
- package/dist/{chunk-PB3CXNVL.js → chunk-XROWZSOY.js} +1 -1
- package/dist/{chunk-TDJCLNDH.js → chunk-XX2QNQN4.js} +147 -86
- package/dist/{chunk-KDCHVT25.js → chunk-YB363QGA.js} +9 -2
- package/dist/{chunk-HCIVH3JS.js → chunk-YWM6MJT4.js} +29 -1
- package/dist/{chunk-E5UYAIKJ.js → chunk-Z2A7BDHT.js} +17 -19
- package/dist/cli/chat.js +33 -33
- package/dist/cli/check.js +7 -7
- package/dist/cli/plugins.js +14 -14
- package/dist/cli/snapshot-create.js +10 -10
- package/dist/cli/upgrade.js +8 -8
- package/dist/db/schema/task-executions.d.ts +23 -2
- package/dist/db/schema.d.ts +20 -1
- package/dist/{db-UO2IWXGA.js → db-QOGYDDQM.js} +7 -7
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-MAQI43LX.js → oauth-callback-server-CT4RMGCP.js} +22 -21
- package/dist/{runner-PIUQEXKE.js → runner-PHMLHNLX.js} +18 -16
- package/dist/{sandbox-egress-signals-A5HWIQH4.js → sandbox-egress-signals-EKPAVWQL.js} +2 -2
- package/dist/{skills-4ARJADHQ.js → skills-AYRM4QGF.js} +7 -7
- package/dist/spawn-OGRQFUNK.js +38 -0
- package/dist/{validation-S3EE3HWL.js → validation-M5JNGRGL.js} +7 -7
- package/dist/version.js +1 -1
- package/dist/{work-UARRUAW3.js → work-LZWE6HK4.js} +18 -18
- package/dist/{worker-DOCIRVD3.js → worker-KOGPXFYK.js} +10 -10
- package/migrations/0022_task_execution_status.sql +3 -0
- package/migrations/meta/0022_snapshot.json +2186 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +5 -5
- package/dist/chunk-ELKW5FIB.js +0 -233
- package/dist/spawn-G2AWPMCT.js +0 -38
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
PluginCredentialFailureError,
|
|
8
8
|
agentNameSchema,
|
|
9
9
|
createPluginAuthOrchestration
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DMDOKRPC.js";
|
|
11
11
|
import {
|
|
12
12
|
authorizationId
|
|
13
13
|
} from "./chunk-DIB4GX3G.js";
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
patchMcpAuthSession,
|
|
29
29
|
selectPluginGrant,
|
|
30
30
|
toMcpProviderError
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-3CUBAGA3.js";
|
|
32
32
|
import {
|
|
33
33
|
RetryableDeliveryError,
|
|
34
34
|
actorFromRouting,
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
getSlackMessagePermalink,
|
|
45
45
|
resolveBaseUrl,
|
|
46
46
|
uploadFilesToConversation
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-5KAZMR5U.js";
|
|
48
48
|
import {
|
|
49
49
|
AGENTS_REMOVAL_NOTICE,
|
|
50
50
|
AGENTS_REPLACEMENT_NOTICE,
|
|
@@ -111,7 +111,7 @@ import {
|
|
|
111
111
|
trimTrailingAssistantMessages,
|
|
112
112
|
truncateText,
|
|
113
113
|
updateConversationStats
|
|
114
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-BMFRFSTM.js";
|
|
115
115
|
import {
|
|
116
116
|
JUNIOR_THREAD_STATE_TTL_MS
|
|
117
117
|
} from "./chunk-3Y47VMHV.js";
|
|
@@ -120,7 +120,7 @@ import {
|
|
|
120
120
|
parseSandboxEgressPermissionDeniedSignal,
|
|
121
121
|
sandboxEgressCredentialContextSchema,
|
|
122
122
|
sandboxEgressCredentialLeaseSchema
|
|
123
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-HUO3UTAQ.js";
|
|
124
124
|
import {
|
|
125
125
|
isExperimentalFeatureEnabled
|
|
126
126
|
} from "./chunk-5IDFPCON.js";
|
|
@@ -143,7 +143,7 @@ import {
|
|
|
143
143
|
runNonInteractiveCommand,
|
|
144
144
|
throwSandboxOperationError,
|
|
145
145
|
wrapSandboxSetupError
|
|
146
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-OGNL2QY7.js";
|
|
147
147
|
import {
|
|
148
148
|
SCHEDULED_TASK_SYSTEM_ACTOR,
|
|
149
149
|
compactEventTask,
|
|
@@ -173,11 +173,12 @@ import {
|
|
|
173
173
|
requireSupportedEventTaskTrigger,
|
|
174
174
|
resolveLocalScheduleAtMs,
|
|
175
175
|
saveEventTask,
|
|
176
|
+
scheduledTaskAttributes,
|
|
176
177
|
writableEventTask
|
|
177
|
-
} from "./chunk-
|
|
178
|
+
} from "./chunk-XX2QNQN4.js";
|
|
178
179
|
import {
|
|
179
180
|
parseSlackThreadId
|
|
180
|
-
} from "./chunk-
|
|
181
|
+
} from "./chunk-WTGLUX4K.js";
|
|
181
182
|
import {
|
|
182
183
|
ToolInputError,
|
|
183
184
|
addAgentTurnUsage,
|
|
@@ -188,13 +189,14 @@ import {
|
|
|
188
189
|
} from "./chunk-UIE3R5XU.js";
|
|
189
190
|
import {
|
|
190
191
|
createPluginHookRunner,
|
|
192
|
+
getDashboardTaskLink,
|
|
191
193
|
getPluginSystemPromptContributions,
|
|
192
194
|
getPluginTools,
|
|
193
195
|
getPluginUserPromptContributions,
|
|
194
196
|
getSlackToolContext,
|
|
195
197
|
readActorIdentity,
|
|
196
198
|
resolveChannelCapabilities
|
|
197
|
-
} from "./chunk-
|
|
199
|
+
} from "./chunk-4PIT6O7A.js";
|
|
198
200
|
import {
|
|
199
201
|
SlackActionError,
|
|
200
202
|
downloadPrivateSlackFile,
|
|
@@ -203,7 +205,7 @@ import {
|
|
|
203
205
|
isConversationScopedChannel,
|
|
204
206
|
normalizeSlackConversationId,
|
|
205
207
|
withSlackRetries
|
|
206
|
-
} from "./chunk-
|
|
208
|
+
} from "./chunk-HEFBGCCU.js";
|
|
207
209
|
import {
|
|
208
210
|
KNOWN_CONVERSATION_EVENT_TYPES,
|
|
209
211
|
contextProvenance,
|
|
@@ -214,7 +216,7 @@ import {
|
|
|
214
216
|
instructionActors,
|
|
215
217
|
instructionProvenanceFor,
|
|
216
218
|
sameActorIdentity
|
|
217
|
-
} from "./chunk-
|
|
219
|
+
} from "./chunk-WSWM6A3R.js";
|
|
218
220
|
import {
|
|
219
221
|
SANDBOX_DATA_ROOT,
|
|
220
222
|
SANDBOX_SKILLS_ROOT,
|
|
@@ -226,7 +228,7 @@ import {
|
|
|
226
228
|
} from "./chunk-EM225ITJ.js";
|
|
227
229
|
import {
|
|
228
230
|
getStateAdapter
|
|
229
|
-
} from "./chunk-
|
|
231
|
+
} from "./chunk-J5H65GY2.js";
|
|
230
232
|
import {
|
|
231
233
|
ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX,
|
|
232
234
|
COMPACTION_SUMMARY_PREFIX,
|
|
@@ -260,7 +262,7 @@ import {
|
|
|
260
262
|
resolveGatewayCredential,
|
|
261
263
|
resolveGatewayModel,
|
|
262
264
|
unwrapCurrentInstruction
|
|
263
|
-
} from "./chunk-
|
|
265
|
+
} from "./chunk-S3FAOKQU.js";
|
|
264
266
|
import {
|
|
265
267
|
canExposeConversationPayload,
|
|
266
268
|
resolveConversationPrivacy,
|
|
@@ -270,16 +272,16 @@ import {
|
|
|
270
272
|
toGenAiMessagesTraceAttributes,
|
|
271
273
|
toGenAiPayloadMetadata,
|
|
272
274
|
toGenAiPayloadTraceAttributes
|
|
273
|
-
} from "./chunk-
|
|
275
|
+
} from "./chunk-UXMRN2ZX.js";
|
|
274
276
|
import {
|
|
275
277
|
discoverSkills,
|
|
276
278
|
findSkillByName,
|
|
277
279
|
loadSkillsByName,
|
|
278
280
|
parseSkillInvocation
|
|
279
|
-
} from "./chunk-
|
|
281
|
+
} from "./chunk-D3X2PI3D.js";
|
|
280
282
|
import {
|
|
281
283
|
pluginCatalogRuntime
|
|
282
|
-
} from "./chunk-
|
|
284
|
+
} from "./chunk-N2I7W2VS.js";
|
|
283
285
|
import {
|
|
284
286
|
CredentialUnavailableError,
|
|
285
287
|
OAuthProviderError,
|
|
@@ -287,10 +289,10 @@ import {
|
|
|
287
289
|
getOAuthProviderErrorAttributes,
|
|
288
290
|
resolveAuthTokenPlaceholder,
|
|
289
291
|
resolvePluginCommandEnv
|
|
290
|
-
} from "./chunk-
|
|
292
|
+
} from "./chunk-I3OZR3HG.js";
|
|
291
293
|
import {
|
|
292
294
|
credentialUserSubjectId
|
|
293
|
-
} from "./chunk-
|
|
295
|
+
} from "./chunk-RUIXF3YQ.js";
|
|
294
296
|
import {
|
|
295
297
|
isUserActor
|
|
296
298
|
} from "./chunk-HZF5P5UN.js";
|
|
@@ -316,7 +318,7 @@ import {
|
|
|
316
318
|
summarizeMessageText,
|
|
317
319
|
withLogContext,
|
|
318
320
|
withSpan
|
|
319
|
-
} from "./chunk-
|
|
321
|
+
} from "./chunk-NPL66ZWL.js";
|
|
320
322
|
import {
|
|
321
323
|
startInactiveSpan,
|
|
322
324
|
withActiveSpan
|
|
@@ -8918,7 +8920,7 @@ var MAX_LISTED_TASKS = 50;
|
|
|
8918
8920
|
var DEFAULT_SCHEDULE_TIMEZONE = "America/Los_Angeles";
|
|
8919
8921
|
var compactTaskResultSchema = z28.object({
|
|
8920
8922
|
id: z28.string(),
|
|
8921
|
-
status: z28.enum(["active", "blocked", "deleted"]),
|
|
8923
|
+
status: z28.enum(["active", "blocked", "completed", "deleted"]),
|
|
8922
8924
|
task: z28.string(),
|
|
8923
8925
|
schedule: z28.string(),
|
|
8924
8926
|
timezone: z28.string(),
|
|
@@ -8929,6 +8931,7 @@ var compactTaskResultSchema = z28.object({
|
|
|
8929
8931
|
visibility: z28.enum(["private", "public"])
|
|
8930
8932
|
}).strict(),
|
|
8931
8933
|
credential_mode: z28.enum(["system", "creator"]),
|
|
8934
|
+
dashboard_url: z28.string().url().nullable(),
|
|
8932
8935
|
last_run_at: z28.string().nullable(),
|
|
8933
8936
|
run_now_at: z28.string().nullable()
|
|
8934
8937
|
}).strict();
|
|
@@ -9041,6 +9044,7 @@ function compactTask(task) {
|
|
|
9041
9044
|
next_run_at: task.nextRunAtMs ? new Date(task.nextRunAtMs).toISOString() : null,
|
|
9042
9045
|
conversation_access: task.conversationAccess,
|
|
9043
9046
|
credential_mode: task.credentialMode,
|
|
9047
|
+
dashboard_url: getDashboardTaskLink(task.id) ?? null,
|
|
9044
9048
|
last_run_at: task.lastRunAtMs ? new Date(task.lastRunAtMs).toISOString() : null,
|
|
9045
9049
|
run_now_at: task.runNowAtMs ? new Date(task.runNowAtMs).toISOString() : null
|
|
9046
9050
|
});
|
|
@@ -9182,6 +9186,10 @@ function createSlackScheduleCreateTaskTool(context) {
|
|
|
9182
9186
|
if (!sameDestination(committed, destination) || committed.createdBy.slackUserId !== actor.slackUserId) {
|
|
9183
9187
|
throwToolInputError("Scheduled task operation identity is invalid.");
|
|
9184
9188
|
}
|
|
9189
|
+
logInfo(
|
|
9190
|
+
"scheduled_task.create.completed",
|
|
9191
|
+
scheduledTaskAttributes(committed)
|
|
9192
|
+
);
|
|
9185
9193
|
return scheduleTaskToolResult(
|
|
9186
9194
|
"slackScheduleCreateTask",
|
|
9187
9195
|
compactTask(committed)
|
|
@@ -9331,6 +9339,11 @@ function createSlackScheduleUpdateTaskTool(context) {
|
|
|
9331
9339
|
context,
|
|
9332
9340
|
taskId: input.task_id
|
|
9333
9341
|
});
|
|
9342
|
+
if (lookup.status === "completed") {
|
|
9343
|
+
throwToolInputError(
|
|
9344
|
+
"Completed scheduled tasks cannot be updated. Create a new task instead."
|
|
9345
|
+
);
|
|
9346
|
+
}
|
|
9334
9347
|
const actor = requireActor(context, lookup.destination);
|
|
9335
9348
|
const isCreator = actor.slackUserId === lookup.createdBy.slackUserId;
|
|
9336
9349
|
if (input.credential_mode === "creator" && !isCreator) {
|
|
@@ -11162,6 +11175,9 @@ function renderField(raw) {
|
|
|
11162
11175
|
if (title && value) return `${title}: ${value}`;
|
|
11163
11176
|
return title || value;
|
|
11164
11177
|
}
|
|
11178
|
+
function normalizeAttachmentText(value) {
|
|
11179
|
+
return value.replace(/\r\n?/g, "\n").replace(/ {2,}(?=[-*+]\s|\d+\.\s)/g, "\n").replace(/(?<=\S) (?=[-*+] \*\*[^*\n]+\*\*)/g, "\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
11180
|
+
}
|
|
11165
11181
|
function renderAttachment(raw) {
|
|
11166
11182
|
if (!raw || typeof raw !== "object") return "";
|
|
11167
11183
|
const obj = raw;
|
|
@@ -11177,7 +11193,7 @@ function renderAttachment(raw) {
|
|
|
11177
11193
|
const fields = Array.isArray(obj.fields) ? obj.fields : [];
|
|
11178
11194
|
const add = (value) => {
|
|
11179
11195
|
if (!value) return;
|
|
11180
|
-
const normalized = value
|
|
11196
|
+
const normalized = normalizeAttachmentText(value);
|
|
11181
11197
|
if (!normalized || seen.has(normalized)) return;
|
|
11182
11198
|
seen.add(normalized);
|
|
11183
11199
|
parts.push(normalized);
|
|
@@ -11190,7 +11206,7 @@ function renderAttachment(raw) {
|
|
|
11190
11206
|
add(authorName);
|
|
11191
11207
|
if (title && titleLink) {
|
|
11192
11208
|
add(`${title} (${titleLink})`);
|
|
11193
|
-
seen.add(title
|
|
11209
|
+
seen.add(normalizeAttachmentText(title));
|
|
11194
11210
|
} else {
|
|
11195
11211
|
add(title);
|
|
11196
11212
|
}
|
|
@@ -11199,7 +11215,7 @@ function renderAttachment(raw) {
|
|
|
11199
11215
|
add(renderField(field));
|
|
11200
11216
|
}
|
|
11201
11217
|
add(footer);
|
|
11202
|
-
return parts.join("
|
|
11218
|
+
return parts.join("\n");
|
|
11203
11219
|
}
|
|
11204
11220
|
function renderSlackLegacyAttachmentText(input) {
|
|
11205
11221
|
const rendered = getAttachmentPayload(input).slice(0, MAX_ATTACHMENTS).map(renderAttachment).filter((line) => line.length > 0).map((line) => `[attachment] ${line}`).join("\n");
|
|
@@ -4,18 +4,18 @@ import {
|
|
|
4
4
|
} from "./chunk-EM225ITJ.js";
|
|
5
5
|
import {
|
|
6
6
|
getStateAdapter
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-J5H65GY2.js";
|
|
8
8
|
import {
|
|
9
9
|
toOptionalTrimmed
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-S3FAOKQU.js";
|
|
11
11
|
import {
|
|
12
12
|
pluginCatalogRuntime
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-N2I7W2VS.js";
|
|
14
14
|
import {
|
|
15
15
|
setSpanAttributes,
|
|
16
16
|
setSpanStatus,
|
|
17
17
|
withSpan
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-NPL66ZWL.js";
|
|
19
19
|
|
|
20
20
|
// src/chat/sandbox/resources.ts
|
|
21
21
|
var configuredResources;
|
|
@@ -74,6 +74,15 @@ var credentialContextSchema = z.union([
|
|
|
74
74
|
subject: credentialSubjectSchema.optional()
|
|
75
75
|
}).strict()
|
|
76
76
|
]);
|
|
77
|
+
function credentialContextForActor(actor, subject) {
|
|
78
|
+
if (actor.platform === "system") {
|
|
79
|
+
return subject ? { actor, subject } : { actor };
|
|
80
|
+
}
|
|
81
|
+
if (subject) {
|
|
82
|
+
throw new TypeError("Delegated credential subjects require a system actor");
|
|
83
|
+
}
|
|
84
|
+
return { actor: { type: "user", userId: actor.userId } };
|
|
85
|
+
}
|
|
77
86
|
function credentialUserSubjectId(context) {
|
|
78
87
|
if ("type" in context.actor) {
|
|
79
88
|
return context.actor.userId;
|
|
@@ -84,5 +93,6 @@ function credentialUserSubjectId(context) {
|
|
|
84
93
|
export {
|
|
85
94
|
credentialSubjectSchema,
|
|
86
95
|
credentialContextSchema,
|
|
96
|
+
credentialContextForActor,
|
|
87
97
|
credentialUserSubjectId
|
|
88
98
|
};
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
toCanonicalInputMessage,
|
|
4
4
|
toCanonicalOutputMessage,
|
|
5
5
|
toGenAiMessagesTraceAttributes
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UXMRN2ZX.js";
|
|
7
7
|
import {
|
|
8
8
|
extractGenAiUsageAttributes,
|
|
9
9
|
logException,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
normalizeGenAiFinishReason,
|
|
12
12
|
serializeGenAiAttribute,
|
|
13
13
|
withSpan
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-NPL66ZWL.js";
|
|
15
15
|
|
|
16
16
|
// src/chat/services/provider-error.ts
|
|
17
17
|
var ProviderError = class extends Error {
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import {
|
|
2
|
+
healthReportSchema
|
|
3
|
+
} from "./chunk-UTL3MHPC.js";
|
|
4
|
+
import {
|
|
5
|
+
parseSlackThreadId
|
|
6
|
+
} from "./chunk-WTGLUX4K.js";
|
|
7
|
+
import {
|
|
8
|
+
normalizeSlackConversationId
|
|
9
|
+
} from "./chunk-HEFBGCCU.js";
|
|
10
|
+
|
|
11
|
+
// src/handlers/health.ts
|
|
12
|
+
function readHealthReport() {
|
|
13
|
+
return healthReportSchema.parse({
|
|
14
|
+
status: "ok",
|
|
15
|
+
service: "junior",
|
|
16
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function GET() {
|
|
20
|
+
return Response.json(readHealthReport());
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/chat/slack/conversation-context.ts
|
|
24
|
+
function normalizeConversationName(type, channelName) {
|
|
25
|
+
const trimmed = channelName?.trim();
|
|
26
|
+
if (!trimmed) return void 0;
|
|
27
|
+
if (type === "public_channel" || type === "private_channel" || type === "private_channel_or_group_dm") {
|
|
28
|
+
return trimmed.startsWith("#") ? trimmed : `#${trimmed}`;
|
|
29
|
+
}
|
|
30
|
+
return trimmed;
|
|
31
|
+
}
|
|
32
|
+
function typeFromSlackChannelType(channelType) {
|
|
33
|
+
if (channelType === "channel") return "public_channel";
|
|
34
|
+
if (channelType === "group") return "private_channel";
|
|
35
|
+
if (channelType === "mpim") return "group_dm";
|
|
36
|
+
if (channelType === "im") return "direct_message";
|
|
37
|
+
return void 0;
|
|
38
|
+
}
|
|
39
|
+
function typeFromChannelId(channelId, channelName) {
|
|
40
|
+
const normalized = normalizeSlackConversationId(channelId);
|
|
41
|
+
if (!normalized) return void 0;
|
|
42
|
+
if (normalized.startsWith("C")) return "public_channel";
|
|
43
|
+
if (normalized.startsWith("D")) return "direct_message";
|
|
44
|
+
if (normalized.startsWith("G")) {
|
|
45
|
+
return channelName?.trim().startsWith("mpdm-") ? "group_dm" : "private_channel_or_group_dm";
|
|
46
|
+
}
|
|
47
|
+
return void 0;
|
|
48
|
+
}
|
|
49
|
+
function toSlackEventChannelType(channelType) {
|
|
50
|
+
if (channelType === "channel" || channelType === "group" || channelType === "mpim" || channelType === "im") {
|
|
51
|
+
return channelType;
|
|
52
|
+
}
|
|
53
|
+
return void 0;
|
|
54
|
+
}
|
|
55
|
+
function conversationVisibilityFromSlackChannelType(channelType) {
|
|
56
|
+
if (!channelType) return void 0;
|
|
57
|
+
return channelType === "channel" ? "public" : "private";
|
|
58
|
+
}
|
|
59
|
+
function resolveSlackChannelTypeFromMessage(message) {
|
|
60
|
+
const raw = message.raw;
|
|
61
|
+
if (!raw || typeof raw !== "object") {
|
|
62
|
+
return void 0;
|
|
63
|
+
}
|
|
64
|
+
const channelType = raw.channel_type;
|
|
65
|
+
return typeof channelType === "string" ? toSlackEventChannelType(channelType.trim()) : void 0;
|
|
66
|
+
}
|
|
67
|
+
function resolveSlackConversationContext(input) {
|
|
68
|
+
const type = typeFromSlackChannelType(input.channelType) ?? typeFromChannelId(input.channelId, input.channelName);
|
|
69
|
+
if (!type) return void 0;
|
|
70
|
+
const name = normalizeConversationName(type, input.channelName);
|
|
71
|
+
const visibility = conversationVisibilityFromSlackChannelType(
|
|
72
|
+
input.channelType
|
|
73
|
+
);
|
|
74
|
+
return {
|
|
75
|
+
type,
|
|
76
|
+
...name ? { name } : {},
|
|
77
|
+
...visibility ? { visibility } : {}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function resolveSlackConversationContextFromThreadId(input) {
|
|
81
|
+
const slackThread = parseSlackThreadId(input.threadId);
|
|
82
|
+
const context = resolveSlackConversationContext({
|
|
83
|
+
channelId: slackThread?.channelId,
|
|
84
|
+
channelName: input.channelName
|
|
85
|
+
});
|
|
86
|
+
if (!context || !input.visibility) {
|
|
87
|
+
return context;
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
...context,
|
|
91
|
+
type: input.visibility === "private" && context.type === "public_channel" ? "private_channel" : context.type,
|
|
92
|
+
visibility: input.visibility
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function formatSlackConversationTypeLabel(type) {
|
|
96
|
+
if (type === "public_channel") return "Public Channel";
|
|
97
|
+
if (type === "private_channel") return "Private Channel";
|
|
98
|
+
if (type === "group_dm") return "Group DM";
|
|
99
|
+
if (type === "direct_message") return "Direct Message";
|
|
100
|
+
return "Private Channel or Group DM";
|
|
101
|
+
}
|
|
102
|
+
function formatSlackConversationRedactedLabel(context) {
|
|
103
|
+
if (!context) return void 0;
|
|
104
|
+
return formatSlackConversationTypeLabel(context.type);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export {
|
|
108
|
+
readHealthReport,
|
|
109
|
+
GET,
|
|
110
|
+
conversationVisibilityFromSlackChannelType,
|
|
111
|
+
resolveSlackChannelTypeFromMessage,
|
|
112
|
+
resolveSlackConversationContext,
|
|
113
|
+
resolveSlackConversationContextFromThreadId,
|
|
114
|
+
formatSlackConversationRedactedLabel
|
|
115
|
+
};
|
|
@@ -18,20 +18,20 @@ import {
|
|
|
18
18
|
releaseConversationWork,
|
|
19
19
|
requestConversationContinuation,
|
|
20
20
|
startConversationWork
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-AA2EPMUF.js";
|
|
22
22
|
import {
|
|
23
23
|
ConversationQueueMessageRejectedError
|
|
24
24
|
} from "./chunk-IUFM5JWV.js";
|
|
25
25
|
import {
|
|
26
26
|
getChatConfig,
|
|
27
27
|
isProviderRetryError
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-S3FAOKQU.js";
|
|
29
29
|
import {
|
|
30
30
|
logException,
|
|
31
31
|
logInfo,
|
|
32
32
|
logWarn,
|
|
33
33
|
withLogContext
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-NPL66ZWL.js";
|
|
35
35
|
|
|
36
36
|
// src/chat/task-execution/worker.ts
|
|
37
37
|
var CONVERSATION_WORK_DEFER_DELAY_MS = 15e3;
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
juniorConversations,
|
|
6
6
|
juniorIdentities,
|
|
7
7
|
juniorUsers
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-557HLSNH.js";
|
|
9
9
|
import {
|
|
10
10
|
TURN_REASONING_LEVELS,
|
|
11
11
|
getChatConfig,
|
|
12
12
|
modelProfileSchema
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-S3FAOKQU.js";
|
|
14
14
|
import {
|
|
15
15
|
juniorDestinations
|
|
16
16
|
} from "./chunk-VFUK3X5B.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./chunk-F3B2YJ76.js";
|
|
21
21
|
import {
|
|
22
22
|
normalizeIdentityEmail
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-NPL66ZWL.js";
|
|
24
24
|
|
|
25
25
|
// src/chat/conversations/sql/store.ts
|
|
26
26
|
import { randomUUID as randomUUID2 } from "crypto";
|