@sentry/junior 0.179.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-32IDCLMW.js → agent-hooks-DKDDRKZA.js} +16 -18
- package/dist/api/schema.js +0 -1
- package/dist/api.js +199 -197
- package/dist/app.d.ts +4 -0
- package/dist/app.js +300 -1259
- 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/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-B6ECUSVX.js → chunk-2AYEVN7K.js} +8 -8
- package/dist/{chunk-SLGGOASN.js → chunk-2YIRH4E3.js} +46 -46
- package/dist/{chunk-KJLHIHFF.js → chunk-3ILJBWP7.js} +35 -227
- package/dist/{chunk-RZRYOLCE.js → chunk-5PUMIMNQ.js} +2292 -1147
- package/dist/{chunk-CJLBLELR.js → chunk-5TUR4M3M.js} +8 -61
- package/dist/{chunk-6ZWRNC4D.js → chunk-6Y5B5PEX.js} +1 -1
- package/dist/{chunk-XSPSCWLH.js → chunk-6YCEWOLO.js} +4 -4
- package/dist/chunk-7H2VZTWN.js +103 -0
- package/dist/{chunk-FAS6AIMF.js → chunk-CCDXTDSY.js} +8 -8
- package/dist/{chunk-CGA4ERJ5.js → chunk-CEMMLV5L.js} +1 -1
- package/dist/{chunk-XZY6G5YZ.js → chunk-CK6EINVZ.js} +180 -87
- package/dist/{chunk-FIANEE7Z.js → chunk-CM5HNV2W.js} +6 -6
- package/dist/{chunk-JT4WMD3C.js → chunk-CP73FKME.js} +144 -218
- package/dist/{chunk-3I7XE3PA.js → chunk-DHLOGWYH.js} +36 -36
- package/dist/chunk-DKIJ2RP5.js +68 -0
- package/dist/{chunk-YFNAMRGE.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-R6U7N4FS.js → chunk-FGC3PHNH.js} +3 -3
- package/dist/{chunk-3TM3FYLQ.js → chunk-GA5NS74S.js} +1 -1
- package/dist/{chunk-FIDMHAO6.js → chunk-GPXAHUQH.js} +84 -274
- package/dist/chunk-GUKXEPMX.js +218 -0
- package/dist/{chunk-GENV6KF2.js → chunk-I6IFTAPF.js} +108 -76
- package/dist/{chunk-R5NWWYIS.js → chunk-IANUX7HX.js} +5 -5
- package/dist/{chunk-G2CAC4CV.js → chunk-KCL6AWYW.js} +74 -68
- package/dist/{chunk-5IRROPA5.js → chunk-L7LTGN4Z.js} +129 -31
- package/dist/{chunk-Q5B3WTGG.js → chunk-LGVQLNLS.js} +42 -41
- package/dist/chunk-M3QYTBQ6.js +55 -0
- package/dist/{chunk-FTGD2FBP.js → chunk-MXEUIGHO.js} +2 -2
- package/dist/{chunk-M63DETLL.js → chunk-N7TMSOZH.js} +6 -6
- package/dist/{chunk-2HIPYNQI.js → chunk-O4QYZTDK.js} +33 -32
- package/dist/chunk-PEQXYSSE.js +45 -0
- package/dist/{chunk-RTRBYSF3.js → chunk-QSO7B5JO.js} +1 -1
- package/dist/{chunk-HQNE5APD.js → chunk-RAZG3YHC.js} +100 -79
- package/dist/{chunk-VP4OVRDD.js → chunk-S7YRTOSQ.js} +69 -73
- package/dist/{chunk-U4TKB6F6.js → chunk-SDBKZ5LV.js} +108 -5
- package/dist/{chunk-GPLAT6H7.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-3AFVR5UC.js → chunk-VG722ONZ.js} +18 -16
- package/dist/{chunk-ZQMG3CL5.js → chunk-VGPPWWHF.js} +16 -16
- package/dist/{chunk-JMJNFEDC.js → chunk-WVAMRKYG.js} +9 -54
- package/dist/chunk-X6GDDWQH.js +60 -0
- package/dist/{chunk-4GWXAILB.js → chunk-ZE2KOV3G.js} +1 -1
- package/dist/{chunk-TIEKUH4Q.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-EJAV7JL6.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-GAVSUBTQ.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-34JL64JF.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 +8 -7
- package/dist/catalog-runtime-FBVA6WAQ.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/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-MLKGABMK.js +0 -9
- package/dist/chunk-UT6X7XN7.js +0 -51
- package/dist/chunk-WR76IVA5.js +0 -130
- package/dist/skills-U545HALM.js +0 -29
- package/dist/spawn-I2S4IDUQ.js +0 -37
- package/dist/validation-EVXVGA44.js +0 -19
- package/dist/work-QOAUPDBU.js +0 -45
- package/dist/worker-5GX2IKLZ.js +0 -24
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
ToolInputError,
|
|
3
3
|
canRouteResourceEvents,
|
|
4
4
|
getPlugins
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-DHLOGWYH.js";
|
|
6
6
|
import {
|
|
7
7
|
getDb
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-S7YRTOSQ.js";
|
|
9
9
|
import {
|
|
10
10
|
juniorAttachments,
|
|
11
11
|
juniorConversations,
|
|
@@ -13,10 +13,16 @@ import {
|
|
|
13
13
|
juniorSchedulerRuns,
|
|
14
14
|
juniorSchedulerTasks,
|
|
15
15
|
juniorStats
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-FGC3PHNH.js";
|
|
17
17
|
import {
|
|
18
18
|
juniorDestinations
|
|
19
19
|
} from "./chunk-VFUK3X5B.js";
|
|
20
|
+
import {
|
|
21
|
+
getSlackBotToken
|
|
22
|
+
} from "./chunk-I6IFTAPF.js";
|
|
23
|
+
import {
|
|
24
|
+
logWarn
|
|
25
|
+
} from "./chunk-RAZG3YHC.js";
|
|
20
26
|
|
|
21
27
|
// src/chat/resource-events/catalog.ts
|
|
22
28
|
import {
|
|
@@ -75,14 +81,15 @@ function normalizeEventIdentifier(catalog, namespace, identifier) {
|
|
|
75
81
|
|
|
76
82
|
// src/chat/resource-events/runtime-catalog.ts
|
|
77
83
|
function getResourceEventCatalog() {
|
|
84
|
+
if (!canRouteResourceEvents()) return {};
|
|
78
85
|
return Object.fromEntries(
|
|
79
|
-
|
|
86
|
+
getPlugins().flatMap((plugin) => {
|
|
80
87
|
const registration = plugin.resourceEvents;
|
|
81
88
|
if (!registration || registration.isEnabled?.() === false) {
|
|
82
89
|
return [];
|
|
83
90
|
}
|
|
84
91
|
return [[plugin.manifest.name, registration]];
|
|
85
|
-
})
|
|
92
|
+
})
|
|
86
93
|
);
|
|
87
94
|
}
|
|
88
95
|
|
|
@@ -91,15 +98,15 @@ import { and, asc, desc, eq, inArray, or, sql } from "drizzle-orm";
|
|
|
91
98
|
|
|
92
99
|
// src/chat/event-tasks/types.ts
|
|
93
100
|
import {
|
|
101
|
+
actorUserIdSchema,
|
|
94
102
|
destinationVisibilitySchema,
|
|
95
103
|
resourceEventTypeSchema,
|
|
96
|
-
slackActorSchema,
|
|
97
104
|
slackDestinationSchema
|
|
98
105
|
} from "@sentry/junior-plugin-api";
|
|
99
106
|
import { z as z2 } from "zod";
|
|
100
107
|
var EVENT_TASK_IDENTIFIER_MAX_LENGTH = 300;
|
|
101
108
|
var eventTaskPrincipalSchema = z2.object({
|
|
102
|
-
slackUserId:
|
|
109
|
+
slackUserId: actorUserIdSchema,
|
|
103
110
|
fullName: z2.string().optional(),
|
|
104
111
|
userName: z2.string().optional()
|
|
105
112
|
}).strict();
|
|
@@ -151,7 +158,7 @@ async function createEventTask(db, task) {
|
|
|
151
158
|
title,
|
|
152
159
|
task: parsed
|
|
153
160
|
}).onConflictDoNothing();
|
|
154
|
-
return await getEventTask(db, parsed.id) ?? { ...parsed, ...title ? { title } :
|
|
161
|
+
return await getEventTask(db, parsed.id) ?? { ...parsed, ...title ? { title } : void 0 };
|
|
155
162
|
}
|
|
156
163
|
async function saveEventTask(db, task) {
|
|
157
164
|
const parsed = eventTaskSchema.parse(eventTaskJsonPayload(task));
|
|
@@ -305,34 +312,119 @@ function makeStructuredToolOutput(details, options = {}) {
|
|
|
305
312
|
};
|
|
306
313
|
}
|
|
307
314
|
|
|
308
|
-
// src/chat/
|
|
315
|
+
// src/chat/slack/user.ts
|
|
309
316
|
import { z as z4 } from "zod";
|
|
310
|
-
var
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
317
|
+
var slackUserInfoSchema = z4.object({
|
|
318
|
+
ok: z4.literal(true),
|
|
319
|
+
user: z4.object({
|
|
320
|
+
name: z4.string().nullish(),
|
|
321
|
+
profile: z4.object({
|
|
322
|
+
email: z4.string().nullish(),
|
|
323
|
+
real_name: z4.string().nullish()
|
|
324
|
+
}).optional()
|
|
325
|
+
})
|
|
326
|
+
});
|
|
327
|
+
var USER_CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
328
|
+
var userCache = /* @__PURE__ */ new Map();
|
|
329
|
+
function userCacheKey(teamId, userId) {
|
|
330
|
+
return `${teamId}:${userId}`;
|
|
331
|
+
}
|
|
332
|
+
function readFromCache(teamId, userId) {
|
|
333
|
+
const hit = userCache.get(userCacheKey(teamId, userId));
|
|
334
|
+
if (!hit) return null;
|
|
335
|
+
if (hit.expiresAt < Date.now()) {
|
|
336
|
+
userCache.delete(userCacheKey(teamId, userId));
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
return hit.value;
|
|
340
|
+
}
|
|
341
|
+
function writeToCache(teamId, userId, value) {
|
|
342
|
+
userCache.set(userCacheKey(teamId, userId), {
|
|
343
|
+
value,
|
|
344
|
+
expiresAt: Date.now() + USER_CACHE_TTL_MS
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
async function lookupSlackUser(teamId, userId) {
|
|
348
|
+
if (!teamId || !userId) {
|
|
349
|
+
return null;
|
|
350
|
+
}
|
|
351
|
+
const cached = readFromCache(teamId, userId);
|
|
352
|
+
if (cached) {
|
|
353
|
+
return cached;
|
|
354
|
+
}
|
|
355
|
+
const token = getSlackBotToken();
|
|
356
|
+
if (!token) {
|
|
357
|
+
return null;
|
|
358
|
+
}
|
|
359
|
+
try {
|
|
360
|
+
const response = await fetch(
|
|
361
|
+
`https://slack.com/api/users.info?user=${encodeURIComponent(userId)}`,
|
|
362
|
+
{
|
|
363
|
+
headers: {
|
|
364
|
+
authorization: `Bearer ${token}`
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
);
|
|
368
|
+
if (!response.ok) {
|
|
369
|
+
logWarn("slack.user.lookup.failed", {
|
|
370
|
+
"enduser.id": userId,
|
|
371
|
+
"app.slack.team_id": teamId,
|
|
372
|
+
"http.response.status_code": response.status
|
|
373
|
+
});
|
|
374
|
+
return null;
|
|
375
|
+
}
|
|
376
|
+
const parsed = slackUserInfoSchema.safeParse(await response.json());
|
|
377
|
+
if (!parsed.success) {
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
const payload = parsed.data;
|
|
381
|
+
const userName = payload.user.name?.trim() || void 0;
|
|
382
|
+
const fullName = payload.user.profile?.real_name?.trim() || void 0;
|
|
383
|
+
const result = {
|
|
384
|
+
userName,
|
|
385
|
+
fullName,
|
|
386
|
+
email: payload.user.profile?.email?.trim() || void 0
|
|
387
|
+
};
|
|
388
|
+
writeToCache(teamId, userId, result);
|
|
389
|
+
return result;
|
|
390
|
+
} catch (error) {
|
|
391
|
+
logWarn("slack.user.lookup.failed", {
|
|
392
|
+
"enduser.id": userId,
|
|
393
|
+
"app.slack.team_id": teamId,
|
|
394
|
+
"exception.message": error instanceof Error ? error.message : String(error)
|
|
395
|
+
});
|
|
396
|
+
return null;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// src/chat/event-tasks/tool-support.ts
|
|
401
|
+
import { z as z5 } from "zod";
|
|
402
|
+
var compactEventTaskResultSchema = z5.object({
|
|
403
|
+
id: z5.string().min(1),
|
|
404
|
+
task: z5.string().min(1),
|
|
405
|
+
namespace: z5.string().min(1),
|
|
406
|
+
identifier: z5.string().min(1),
|
|
407
|
+
resourceType: z5.string().min(1),
|
|
408
|
+
label: z5.string().min(1),
|
|
409
|
+
events: z5.array(z5.string().min(1)).min(1),
|
|
410
|
+
credentialMode: z5.enum(["system", "creator"]),
|
|
319
411
|
createdBy: eventTaskPrincipalSchema,
|
|
320
|
-
triggerAvailable:
|
|
412
|
+
triggerAvailable: z5.boolean()
|
|
321
413
|
}).strict();
|
|
322
414
|
var eventTaskToolResultSchema = juniorToolOutputSchema.extend({
|
|
323
415
|
task: compactEventTaskResultSchema
|
|
324
416
|
}).strict();
|
|
325
417
|
var eventTaskListToolResultSchema = juniorToolOutputSchema.extend({
|
|
326
|
-
tasks:
|
|
327
|
-
truncated:
|
|
418
|
+
tasks: z5.array(compactEventTaskResultSchema),
|
|
419
|
+
truncated: z5.boolean()
|
|
328
420
|
}).strict();
|
|
329
421
|
function registeredEventTaskTriggerSchema(catalog) {
|
|
330
|
-
return
|
|
422
|
+
return z5.object({
|
|
331
423
|
namespace: eventNamespaceSchema(catalog),
|
|
332
|
-
identifier:
|
|
424
|
+
identifier: z5.string().trim().min(1).max(EVENT_TASK_IDENTIFIER_MAX_LENGTH),
|
|
333
425
|
resourceType: registeredResourceTypeSchema(catalog),
|
|
334
|
-
label:
|
|
335
|
-
events:
|
|
426
|
+
label: z5.string().trim().min(1).max(500),
|
|
427
|
+
events: z5.array(registeredEventTypeSchema(catalog)).min(1)
|
|
336
428
|
}).strict();
|
|
337
429
|
}
|
|
338
430
|
function requireSupportedEventTaskTrigger(catalog, trigger) {
|
|
@@ -410,22 +502,22 @@ function eventTaskSuccess(task, catalog) {
|
|
|
410
502
|
|
|
411
503
|
// src/chat/scheduled-tasks/tasks.ts
|
|
412
504
|
import { and as and3, asc as asc3, desc as desc2, eq as eq2, inArray as inArray2, notInArray, sql as sql3 } from "drizzle-orm";
|
|
413
|
-
import { z as
|
|
505
|
+
import { z as z7 } from "zod";
|
|
414
506
|
|
|
415
507
|
// src/chat/scheduled-tasks/types.ts
|
|
416
508
|
import {
|
|
417
|
-
|
|
509
|
+
actorUserIdSchema as actorUserIdSchema2,
|
|
418
510
|
slackDestinationSchema as slackDestinationSchema2
|
|
419
511
|
} from "@sentry/junior-plugin-api";
|
|
420
|
-
import { z as
|
|
421
|
-
var scheduledTaskStatusSchema =
|
|
512
|
+
import { z as z6 } from "zod";
|
|
513
|
+
var scheduledTaskStatusSchema = z6.enum([
|
|
422
514
|
"active",
|
|
423
515
|
"blocked",
|
|
424
516
|
"completed",
|
|
425
517
|
"deleted"
|
|
426
518
|
]);
|
|
427
|
-
var scheduledTaskCredentialModeSchema =
|
|
428
|
-
var scheduledRunStatusSchema =
|
|
519
|
+
var scheduledTaskCredentialModeSchema = z6.enum(["system", "creator"]);
|
|
520
|
+
var scheduledRunStatusSchema = z6.enum([
|
|
429
521
|
"pending",
|
|
430
522
|
"running",
|
|
431
523
|
"completed",
|
|
@@ -433,71 +525,71 @@ var scheduledRunStatusSchema = z5.enum([
|
|
|
433
525
|
"blocked",
|
|
434
526
|
"skipped"
|
|
435
527
|
]);
|
|
436
|
-
var scheduledTaskPrincipalSchema =
|
|
437
|
-
slackUserId:
|
|
438
|
-
fullName:
|
|
439
|
-
userName:
|
|
528
|
+
var scheduledTaskPrincipalSchema = z6.object({
|
|
529
|
+
slackUserId: actorUserIdSchema2,
|
|
530
|
+
fullName: z6.string().optional(),
|
|
531
|
+
userName: z6.string().optional()
|
|
440
532
|
}).strict();
|
|
441
|
-
var scheduledTaskRecurrenceSchema =
|
|
442
|
-
dayOfMonth:
|
|
443
|
-
frequency:
|
|
444
|
-
interval:
|
|
445
|
-
month:
|
|
446
|
-
startDate:
|
|
447
|
-
time:
|
|
448
|
-
hour:
|
|
449
|
-
minute:
|
|
533
|
+
var scheduledTaskRecurrenceSchema = z6.object({
|
|
534
|
+
dayOfMonth: z6.number().optional(),
|
|
535
|
+
frequency: z6.enum(["daily", "weekly", "monthly", "yearly"]),
|
|
536
|
+
interval: z6.number(),
|
|
537
|
+
month: z6.number().optional(),
|
|
538
|
+
startDate: z6.string(),
|
|
539
|
+
time: z6.object({
|
|
540
|
+
hour: z6.number(),
|
|
541
|
+
minute: z6.number()
|
|
450
542
|
}).strict(),
|
|
451
|
-
weekdays:
|
|
543
|
+
weekdays: z6.array(z6.number()).optional()
|
|
452
544
|
}).strict();
|
|
453
|
-
var scheduledTaskScheduleSchema =
|
|
454
|
-
description:
|
|
455
|
-
kind:
|
|
545
|
+
var scheduledTaskScheduleSchema = z6.object({
|
|
546
|
+
description: z6.string(),
|
|
547
|
+
kind: z6.enum(["one_off", "recurring"]),
|
|
456
548
|
recurrence: scheduledTaskRecurrenceSchema.optional(),
|
|
457
|
-
timezone:
|
|
549
|
+
timezone: z6.string()
|
|
458
550
|
}).strict();
|
|
459
|
-
var scheduledTaskExecutionActorSchema =
|
|
460
|
-
platform:
|
|
461
|
-
name:
|
|
551
|
+
var scheduledTaskExecutionActorSchema = z6.object({
|
|
552
|
+
platform: z6.literal("system"),
|
|
553
|
+
name: z6.string()
|
|
462
554
|
}).strict();
|
|
463
|
-
var scheduledTaskSchema =
|
|
464
|
-
id:
|
|
465
|
-
conversationAccess:
|
|
466
|
-
audience:
|
|
467
|
-
visibility:
|
|
555
|
+
var scheduledTaskSchema = z6.object({
|
|
556
|
+
id: z6.string(),
|
|
557
|
+
conversationAccess: z6.object({
|
|
558
|
+
audience: z6.enum(["direct", "group", "channel"]),
|
|
559
|
+
visibility: z6.enum(["private", "public"])
|
|
468
560
|
}).strict(),
|
|
469
|
-
createdAtMs:
|
|
561
|
+
createdAtMs: z6.number(),
|
|
470
562
|
createdBy: scheduledTaskPrincipalSchema,
|
|
471
563
|
/** Authoritative provider identity that created the task. */
|
|
472
|
-
creatorIdentityId:
|
|
564
|
+
creatorIdentityId: z6.string(),
|
|
473
565
|
/** Selects system credentials or task-bound creator credential delegation. */
|
|
474
566
|
credentialMode: scheduledTaskCredentialModeSchema,
|
|
475
567
|
destination: slackDestinationSchema2,
|
|
476
568
|
executionActor: scheduledTaskExecutionActorSchema.optional(),
|
|
477
|
-
lastRunAtMs:
|
|
478
|
-
nextRunAtMs:
|
|
479
|
-
originalRequest:
|
|
480
|
-
runNowAtMs:
|
|
569
|
+
lastRunAtMs: z6.number().optional(),
|
|
570
|
+
nextRunAtMs: z6.number().optional(),
|
|
571
|
+
originalRequest: z6.string().optional(),
|
|
572
|
+
runNowAtMs: z6.number().optional(),
|
|
481
573
|
schedule: scheduledTaskScheduleSchema,
|
|
482
574
|
status: scheduledTaskStatusSchema,
|
|
483
|
-
statusReason:
|
|
484
|
-
task:
|
|
575
|
+
statusReason: z6.string().optional(),
|
|
576
|
+
task: z6.object({ text: z6.string() }).strict(),
|
|
485
577
|
/** SQL-backed short display title generated from the task instruction. */
|
|
486
|
-
title:
|
|
487
|
-
updatedAtMs:
|
|
578
|
+
title: z6.string().optional(),
|
|
579
|
+
updatedAtMs: z6.number()
|
|
488
580
|
}).strict();
|
|
489
|
-
var scheduledRunSchema =
|
|
490
|
-
id:
|
|
491
|
-
attempt:
|
|
492
|
-
claimedAtMs:
|
|
493
|
-
completedAtMs:
|
|
494
|
-
dispatchId:
|
|
495
|
-
errorMessage:
|
|
496
|
-
resultMessageTs:
|
|
497
|
-
scheduledForMs:
|
|
498
|
-
startedAtMs:
|
|
581
|
+
var scheduledRunSchema = z6.object({
|
|
582
|
+
id: z6.string(),
|
|
583
|
+
attempt: z6.number(),
|
|
584
|
+
claimedAtMs: z6.number(),
|
|
585
|
+
completedAtMs: z6.number().optional(),
|
|
586
|
+
dispatchId: z6.string().optional(),
|
|
587
|
+
errorMessage: z6.string().optional(),
|
|
588
|
+
resultMessageTs: z6.string().optional(),
|
|
589
|
+
scheduledForMs: z6.number(),
|
|
590
|
+
startedAtMs: z6.number().optional(),
|
|
499
591
|
status: scheduledRunStatusSchema,
|
|
500
|
-
taskId:
|
|
592
|
+
taskId: z6.string()
|
|
501
593
|
}).strict();
|
|
502
594
|
var SCHEDULED_TASK_SYSTEM_ACTOR = Object.freeze({
|
|
503
595
|
platform: "system",
|
|
@@ -509,11 +601,11 @@ var SCHEDULER_KEY_PREFIX = "junior:scheduler";
|
|
|
509
601
|
var retainedScheduledTaskSchema = scheduledTaskSchema.omit({ creatorIdentityId: true, title: true }).extend({
|
|
510
602
|
// TODO(v0.131.0): Remove paused decoding and SQL list filtering after
|
|
511
603
|
// v0.129.x workers can no longer overlap upgrades.
|
|
512
|
-
status:
|
|
513
|
-
version:
|
|
604
|
+
status: z7.enum(["active", "blocked", "completed", "deleted", "paused"]),
|
|
605
|
+
version: z7.number().optional()
|
|
514
606
|
}).strict();
|
|
515
607
|
function parseScheduledTaskRow(row) {
|
|
516
|
-
const record =
|
|
608
|
+
const record = z7.record(z7.string(), z7.unknown()).safeParse(row.record);
|
|
517
609
|
if (!record.success) return void 0;
|
|
518
610
|
const {
|
|
519
611
|
creatorIdentityId: legacyCreatorIdentityId,
|
|
@@ -523,10 +615,10 @@ function parseScheduledTaskRow(row) {
|
|
|
523
615
|
const parsed = retainedScheduledTaskSchema.safeParse(retained);
|
|
524
616
|
if (!parsed.success) return void 0;
|
|
525
617
|
const { status, version: _version, ...task } = parsed.data;
|
|
526
|
-
const fallbackIdentity = row.creatorIdentityId === null ?
|
|
618
|
+
const fallbackIdentity = row.creatorIdentityId === null ? z7.string().safeParse(legacyCreatorIdentityId) : void 0;
|
|
527
619
|
const creatorIdentityId = row.creatorIdentityId ?? (fallbackIdentity?.success ? fallbackIdentity.data : void 0);
|
|
528
620
|
if (creatorIdentityId === void 0) return void 0;
|
|
529
|
-
const fallbackTitle = row.title === null ?
|
|
621
|
+
const fallbackTitle = row.title === null ? z7.string().safeParse(legacyTitle) : void 0;
|
|
530
622
|
const titleSource = row.title !== null ? row.title : fallbackTitle?.success ? fallbackTitle.data : void 0;
|
|
531
623
|
const title = titleSource?.trim() || void 0;
|
|
532
624
|
if (status === "paused") {
|
|
@@ -539,14 +631,14 @@ function parseScheduledTaskRow(row) {
|
|
|
539
631
|
...retained2,
|
|
540
632
|
creatorIdentityId,
|
|
541
633
|
status: "deleted",
|
|
542
|
-
...title ? { title } :
|
|
634
|
+
...title ? { title } : void 0
|
|
543
635
|
};
|
|
544
636
|
}
|
|
545
637
|
return {
|
|
546
638
|
...task,
|
|
547
639
|
creatorIdentityId,
|
|
548
640
|
status,
|
|
549
|
-
...title ? { title } :
|
|
641
|
+
...title ? { title } : void 0
|
|
550
642
|
};
|
|
551
643
|
}
|
|
552
644
|
function isListedScheduledTask(task) {
|
|
@@ -570,7 +662,7 @@ function requireStoredTask(task) {
|
|
|
570
662
|
}
|
|
571
663
|
const { title, ...current } = parsed.data;
|
|
572
664
|
const normalizedTitle = title?.trim() || void 0;
|
|
573
|
-
return { ...current, ...normalizedTitle ? { title: normalizedTitle } :
|
|
665
|
+
return { ...current, ...normalizedTitle ? { title: normalizedTitle } : void 0 };
|
|
574
666
|
}
|
|
575
667
|
function scheduledTaskJsonRecord(task) {
|
|
576
668
|
const { title: _title, ...record } = task;
|
|
@@ -968,7 +1060,7 @@ async function storeAttachments(args) {
|
|
|
968
1060
|
conversationId: args.conversationId,
|
|
969
1061
|
db: args.db,
|
|
970
1062
|
file,
|
|
971
|
-
...args.nowMs !== void 0 ? { nowMs: args.nowMs } :
|
|
1063
|
+
...args.nowMs !== void 0 ? { nowMs: args.nowMs } : void 0,
|
|
972
1064
|
storage: args.storage
|
|
973
1065
|
})
|
|
974
1066
|
);
|
|
@@ -1040,6 +1132,7 @@ export {
|
|
|
1040
1132
|
juniorToolOutputSchema,
|
|
1041
1133
|
injectContinuationToolName,
|
|
1042
1134
|
makeStructuredToolOutput,
|
|
1135
|
+
lookupSlackUser,
|
|
1043
1136
|
eventNamespaceSchema,
|
|
1044
1137
|
registeredEventTypeSchema,
|
|
1045
1138
|
registeredResourceTypeSchema,
|
|
@@ -16,9 +16,9 @@ function cloneInlineManifests(registrations) {
|
|
|
16
16
|
...plugin.manifest.target,
|
|
17
17
|
configKey: plugin.manifest.target.configKey.includes(".") ? plugin.manifest.target.configKey : `${plugin.manifest.name}.${plugin.manifest.target.configKey}`
|
|
18
18
|
}
|
|
19
|
-
} :
|
|
19
|
+
} : void 0
|
|
20
20
|
},
|
|
21
|
-
...plugin.packageName ? { packageName: plugin.packageName } :
|
|
21
|
+
...plugin.packageName ? { packageName: plugin.packageName } : void 0
|
|
22
22
|
}
|
|
23
23
|
] : []
|
|
24
24
|
);
|
|
@@ -63,7 +63,7 @@ function defineJuniorPlugins(inputs, options = {}) {
|
|
|
63
63
|
return {
|
|
64
64
|
packageNames,
|
|
65
65
|
registrations: registrations.map((plugin) => ({ ...plugin })),
|
|
66
|
-
...manifests ? { manifests } :
|
|
66
|
+
...manifests ? { manifests } : void 0
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
function pluginCatalogConfigFromPluginSet(pluginSet) {
|
|
@@ -84,9 +84,9 @@ function pluginCatalogConfigFromPluginSet(pluginSet) {
|
|
|
84
84
|
return void 0;
|
|
85
85
|
}
|
|
86
86
|
return {
|
|
87
|
-
...inlineManifests ? { inlineManifests } :
|
|
88
|
-
...packages.length > 0 ? { packages } :
|
|
89
|
-
...manifests ? { manifests } :
|
|
87
|
+
...inlineManifests ? { inlineManifests } : void 0,
|
|
88
|
+
...packages.length > 0 ? { packages } : void 0,
|
|
89
|
+
...manifests ? { manifests } : void 0
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
function readEnvPluginPackages(env = process.env) {
|