@sentry/junior 0.292.0 → 0.293.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.
Files changed (65) hide show
  1. package/dist/{adapter-Cigb1MTr.js → adapter-CMJfmHso.js} +1 -1
  2. package/dist/{admin-BO9V7vnn.js → admin-uuecrKuD.js} +2 -2
  3. package/dist/{agent-runner-BuH7EHrX.js → agent-runner-DHq1pjUg.js} +272 -151
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +3 -3
  6. package/dist/api.d.ts +1 -1
  7. package/dist/api.js +42 -37
  8. package/dist/{app-C47PT68y.d.ts → app-fWzCHFIb.d.ts} +2 -2
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +422 -394
  11. package/dist/{assistant-reply-ZjLRGHm2.js → assistant-reply-CIApSfor.js} +1 -1
  12. package/dist/{automation-CrsYnvdV.js → automation-BE3z19VN.js} +71 -22
  13. package/dist/{background-compaction-queue-CqZBPe9g.js → background-compaction-queue-D7ncdEa6.js} +4 -4
  14. package/dist/{briefs-DZrhXJss.js → briefs-NpgMEFh1.js} +2 -2
  15. package/dist/{catalog-runtime-Cj9I0dco.js → catalog-runtime-DwbTyNRD.js} +1 -1
  16. package/dist/cli/chat.js +15 -15
  17. package/dist/cli/check.js +3 -3
  18. package/dist/cli/main.js +3 -3
  19. package/dist/cli/plugins.js +4 -4
  20. package/dist/cli/snapshot-create.js +4 -4
  21. package/dist/cli/upgrade.d.ts +1 -1
  22. package/dist/cli/upgrade.js +3 -3
  23. package/dist/{config-BerMjSVL.js → config-B4b-NXH5.js} +2 -2
  24. package/dist/{connections-BWmTOVPB.js → connections-Dz_AQg5p.js} +6 -6
  25. package/dist/{conversation-pending-messages-Cd7ShwBs.js → conversation-pending-messages-1Kad1Mif.js} +4 -1
  26. package/dist/{conversation-privacy-BMfbOUCo.js → conversation-privacy-DRsSgLGO.js} +1 -1
  27. package/dist/{credential-sync-DZDij2CU.js → credential-sync-ClCnnGVj.js} +13 -13
  28. package/dist/{db-7glZCI18.d.ts → db-BbpttyKH.d.ts} +1 -1
  29. package/dist/{db-BlfjuqzW.js → db-CoA7_Xqu.js} +3 -3
  30. package/dist/{executor-ikZvFaMD.js → executor-SWyHhit0.js} +31 -14
  31. package/dist/instrumentation.js +2 -2
  32. package/dist/{logging-CTCH5jOy.js → logging-BN5drSEZ.js} +1 -1
  33. package/dist/{message-C1ID1tKi.js → message-D4qjpW1C.js} +9 -9
  34. package/dist/nitro.d.ts +1 -1
  35. package/dist/nitro.js +2 -2
  36. package/dist/{oauth-callback-server-CStBgDU7.js → oauth-callback-server-Xi-mTLOV.js} +2 -2
  37. package/dist/{projection-DY93nCfX.js → projection-DXl4ftyL.js} +140 -50
  38. package/dist/{prompt-exicBZeb.js → prompt-Dmx6IfWZ.js} +3 -3
  39. package/dist/{registry-X_xdFY9L.js → registry-DosVt9f9.js} +1 -1
  40. package/dist/{resolve-B9dYN-nS.js → resolve-BDjWJC9s.js} +3 -3
  41. package/dist/{result-CC8bV8Fl.js → result-CaAFpf4B.js} +8 -8
  42. package/dist/{runner-D44qp4rc.js → runner-h96Mkss6.js} +7 -7
  43. package/dist/{sandbox-egress-signals-BrH6DWkt.js → sandbox-egress-signals-rK91BW7i.js} +1 -1
  44. package/dist/{schema-CC2RxDAV.d.ts → schema-CHsBmXIj.d.ts} +246 -45
  45. package/dist/{schema-CVV5r-qP.js → schema-C_v8wb80.js} +2 -2
  46. package/dist/{service-account-89JZHWCE.js → service-account-BpGpScaT.js} +3 -3
  47. package/dist/{service-account-DoNZuJb-.js → service-account-WUMVuqVL.js} +3 -3
  48. package/dist/{session-stop-DNucbmPf.js → session-stop-xYK15HUu.js} +20 -41
  49. package/dist/{skills-BeUfmYXL.js → skills-DHApyCjj.js} +10 -9
  50. package/dist/{spawn-CIAcfcvZ.js → spawn-BQQrwGNe.js} +5 -5
  51. package/dist/{stop-Ckd3735h.js → stop-CBeD6_Gs.js} +32 -26
  52. package/dist/{store-CS0xoqXW.js → store-xtibD98L.js} +3 -3
  53. package/dist/{task-runner-DjjHCX_m.js → task-runner-BYPN4BEO.js} +65 -90
  54. package/dist/{turn-failure-response-D0bwI462.js → turn-failure-response-jNVl00MD.js} +7 -7
  55. package/dist/{validation-Cvx_AupF.js → validation-DGeB_moV.js} +1 -1
  56. package/dist/{version-BrDx4Fzc.js → version-C6nqU3Qc.js} +1 -1
  57. package/dist/version.js +1 -1
  58. package/dist/{viewer-4CxdwLLQ.js → viewer-9KLQibjn.js} +3 -3
  59. package/dist/{warmup-B62hd4lD.js → warmup-7S6z068f.js} +56 -24
  60. package/dist/{work-Cu315oJl.js → work-xwX6unUE.js} +11 -11
  61. package/dist/{worker-4ClZu6ry.js → worker-CiCCfwd4.js} +6 -6
  62. package/migrations/0096_automation_task_kind.sql +75 -0
  63. package/migrations/meta/0096_snapshot.json +4490 -0
  64. package/migrations/meta/_journal.json +7 -0
  65. package/package.json +5 -5
@@ -1,4 +1,4 @@
1
- import { $t as extractAssistantText, dn as normalizeToolNameFromResult, ln as isToolResultError, un as isToolResultMessage } from "./projection-DY93nCfX.js";
1
+ import { hn as normalizeToolNameFromResult, mn as isToolResultMessage, pn as isToolResultError, rn as extractAssistantText } from "./projection-DXl4ftyL.js";
2
2
  import * as z from "zod";
3
3
  // src/chat/no-reply.ts
4
4
  /** No-reply result of a Turn. */
@@ -2,6 +2,48 @@ import { c as resolveLocalScheduleAtMs, i as getFirstRunAtMs, o as getZonedDateT
2
2
  import { i as actorIdentitySchema } from "./conversation-CtjR1Zcx.js";
3
3
  import * as z from "zod";
4
4
  import { actorUserIdSchema, destinationVisibilitySchema, eventMatchFieldsSchema, eventMatchSchema, eventReachSchema, eventTypeSchema, pluginEventTypeSchema, slackDestinationSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
5
+ // src/chat/automations/task.ts
6
+ /**
7
+ * The work of an Automation run. An Automation runs either a written
8
+ * instruction or a skill. A skill can have context: what the Automation
9
+ * needs beyond the skill.
10
+ */
11
+ /** A skill name, in the form that skill frontmatter allows. */
12
+ const automationSkillNameSchema = z.string().max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, "Use a skill name, such as tpm.");
13
+ /** Text of an instruction or a context, trimmed and not empty. */
14
+ const automationTaskTextSchema = z.string().trim().min(1, "Write at least one word.").max(4e3);
15
+ /** Validate the stored task of either Automation kind. */
16
+ const automationTaskSchema = z.discriminatedUnion("kind", [z.object({
17
+ kind: z.literal("instruction"),
18
+ instruction: automationTaskTextSchema
19
+ }).strict(), z.object({
20
+ kind: z.literal("skill"),
21
+ skill: automationSkillNameSchema,
22
+ /** Absent when the skill needs nothing more. */
23
+ context: automationTaskTextSchema.optional()
24
+ }).strict()]);
25
+ /** Return the written text of a task: its instruction or its context. */
26
+ function automationTaskText(task) {
27
+ return task.kind === "instruction" ? task.instruction : task.context;
28
+ }
29
+ /**
30
+ * Describe the work in one plain text for title fallback, title generation,
31
+ * and cards, so a skill-mode Automation shows its skill. Do not store it.
32
+ */
33
+ function automationTaskDescription(task) {
34
+ if (task.kind === "instruction") return task.instruction;
35
+ return task.context ? `Run the ${task.skill} skill. ${task.context}` : `Run the ${task.skill} skill.`;
36
+ }
37
+ /** Return the `instruction` and `skill` columns of a task. One is null. */
38
+ function automationTaskColumns(task) {
39
+ return task.kind === "instruction" ? {
40
+ instruction: task.instruction,
41
+ skill: null
42
+ } : {
43
+ instruction: null,
44
+ skill: task.skill
45
+ };
46
+ }
5
47
  // src/chat/scheduled-automations/schedule-intent.ts
6
48
  /**
7
49
  * Owns model-facing schedule intent and materializes it against the trusted
@@ -317,7 +359,7 @@ const scheduledAutomationSchema = z.object({
317
359
  statusReason: z.string().optional(),
318
360
  /** Explicit visible effects after successful work. An empty list is silent. */
319
361
  outcomes: z.array(scheduledAutomationOutcomeSchema).max(5),
320
- task: z.object({ text: z.string() }).strict(),
362
+ task: automationTaskSchema,
321
363
  /** SQL-backed short display title generated from the task instruction. */
322
364
  title: z.string().optional(),
323
365
  updatedAtMs: z.number()
@@ -378,7 +420,7 @@ const eventAutomationSchema = z.object({
378
420
  destinationVisibility: destinationVisibilitySchema,
379
421
  /** Explicit visible effects after successful work. An empty list is silent. */
380
422
  outcomes: z.array(eventAutomationOutcomeSchema).max(5),
381
- task: z.object({ text: z.string().min(1) }).strict(),
423
+ task: automationTaskSchema,
382
424
  trigger: eventAutomationTriggerSchema
383
425
  }).strict();
384
426
  // src/chat/task-outcomes-schema.ts
@@ -390,16 +432,18 @@ const taskOutcomeInputSchema = z.object({
390
432
  }).strict();
391
433
  // src/chat/automations/edit-schema.ts
392
434
  const automationTitleSchema = z.string().trim().min(1).max(60);
393
- const automationInstructionSchema = z.string().trim().min(1).max(4e3);
394
435
  /**
395
436
  * Instruction input for agent tools. The run does not see the request, so the
396
437
  * instruction names exact targets. It calls the creator "the Automation
397
438
  * creator". It names every other person with their mention.
398
439
  */
399
- const automationInstructionToolSchema = automationInstructionSchema.describe("Work to perform when the Automation runs. The run does not see this conversation, so words like \"this channel\" or \"here\" will mean nothing then. Write the exact target instead, such as a channel mention or a link. Call the person who created the Automation \"the Automation creator\", not \"me\"; each run knows who that is. Name every other person with their Slack mention, such as <@U123>, including a requester who did not create the Automation. Preserve the user's scope, targets, and constraints. Do not add permissions or side effects the user did not request.");
440
+ const automationInstructionToolSchema = automationTaskTextSchema.describe("Work to perform when the Automation runs. The run does not see this conversation, so words like \"this channel\" or \"here\" will mean nothing then. Write the exact target instead, such as a channel mention or a link. Call the person who created the Automation \"the Automation creator\", not \"me\"; each run knows who that is. Name every other person with their Slack mention, such as <@U123>, including a requester who did not create the Automation. Preserve the user's scope, targets, and constraints. Do not add permissions or side effects the user did not request.");
441
+ /** Context input for agent tools. It follows the same rules as an instruction. */
442
+ const automationContextToolSchema = automationTaskTextSchema.describe("What a skill run needs beyond the skill, such as a repo, a threshold, or who to tag. Follow the same rules as an instruction: write exact targets, call the creator \"the Automation creator\", and name other people with their Slack mention.");
400
443
  const automationEditFieldsSchema = z.object({
401
444
  title: automationTitleSchema.optional(),
402
- instruction: automationInstructionSchema.optional(),
445
+ /** Replaces the whole task, so a mode switch drops the other mode's text. */
446
+ task: automationTaskSchema.optional(),
403
447
  credentialMode: z.enum(["system", "creator"]).optional(),
404
448
  outcomes: z.array(z.union([taskOutcomeInputSchema, taskOutcomeSchema])).max(5).optional()
405
449
  });
@@ -438,8 +482,8 @@ const automationSummaryBaseSchema = z.object({
438
482
  createdByEmail: z.string().trim().email().optional(),
439
483
  destination: automationDestinationSchema,
440
484
  id: z.string().min(1),
441
- instruction: z.string().min(1),
442
- /** People mentioned in the instruction, resolved at read time. */
485
+ task: automationTaskSchema,
486
+ /** People mentioned in the task text, resolved at read time. */
443
487
  mentions: z.array(actorIdentitySchema).optional(),
444
488
  lastConversationId: z.string().min(1).optional(),
445
489
  lastRunAt: z.string().datetime().optional(),
@@ -449,10 +493,22 @@ const automationSummaryBaseSchema = z.object({
449
493
  "failed"
450
494
  ]).optional(),
451
495
  ownedByViewer: z.boolean(),
496
+ /** Newest terminal runs, oldest first, so the list can show recent health. */
497
+ recentRuns: z.array(z.object({
498
+ durationMs: z.number().finite().nonnegative().optional(),
499
+ executedAt: z.string().datetime(),
500
+ status: z.enum([
501
+ "blocked",
502
+ "completed",
503
+ "failed"
504
+ ])
505
+ }).strict()).max(20),
452
506
  runs: automationRunWindowsSchema,
453
507
  outcomes: z.array(taskOutcomeSchema).max(5),
454
- /** Short display title; falls back from instruction when unset. */
508
+ /** Short display title; falls back from the task when unset. */
455
509
  title: z.string().min(1),
510
+ /** Linked Conversation cost of every run, since the Automation was created. */
511
+ totalCostUsd: z.number().finite().nonnegative(),
456
512
  totalRuns: z.number().int().nonnegative()
457
513
  });
458
514
  const scheduledAutomationSummarySchema = automationSummaryBaseSchema.extend({
@@ -490,14 +546,6 @@ const eventAutomationSummarySchema = automationSummaryBaseSchema.extend({
490
546
  const automationSummarySchema = z.discriminatedUnion("kind", [scheduledAutomationSummarySchema, eventAutomationSummarySchema]);
491
547
  /** UTC day (`YYYY-MM-DD`) or hour (`YYYY-MM-DDTHH`) execution bucket key. */
492
548
  const automationMetricBucketSchema = z.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
493
- /** One UTC day/hour of completed automation executions stacked by automation type. */
494
- const automationExecutionDaySchema = z.object({
495
- /** Linked conversation spend for executions in this bucket. */
496
- costUsd: z.number().finite().nonnegative(),
497
- date: automationMetricBucketSchema,
498
- event: z.number().int().nonnegative(),
499
- scheduled: z.number().int().nonnegative()
500
- }).strict();
501
549
  const automationListQuerySchema = z.object({
502
550
  q: z.string().trim().max(200).optional(),
503
551
  scope: z.enum([
@@ -521,6 +569,8 @@ const automationListQuerySchema = z.object({
521
569
  ]).default("all"),
522
570
  creator: z.string().max(300).optional(),
523
571
  destination: z.string().max(300).optional(),
572
+ /** Only Automations that run this skill. */
573
+ skill: automationSkillNameSchema.optional(),
524
574
  sort: z.enum([
525
575
  "newest",
526
576
  "oldest",
@@ -534,9 +584,6 @@ const automationFilterOptionSchema = z.object({
534
584
  label: z.string()
535
585
  }).strict();
536
586
  const automationListSchema = z.object({
537
- executionDays: z.array(automationExecutionDaySchema),
538
- executionHours: z.array(automationExecutionDaySchema).optional(),
539
- executionSixHours: z.array(automationExecutionDaySchema).optional(),
540
587
  automations: z.array(automationSummarySchema),
541
588
  total: z.number().int().nonnegative(),
542
589
  page: z.number().int().positive(),
@@ -582,6 +629,8 @@ const automationExecutionSchema = z.object({
582
629
  const automationExecutionStatusDaySchema = z.object({
583
630
  blocked: z.number().int().nonnegative(),
584
631
  completed: z.number().int().nonnegative(),
632
+ /** Linked Conversation cost of the runs in this bucket. */
633
+ costUsd: z.number().finite().nonnegative(),
585
634
  date: automationMetricBucketSchema,
586
635
  failed: z.number().int().nonnegative()
587
636
  }).strict();
@@ -604,7 +653,7 @@ const automationRunListSchema = z.object({
604
653
  }).strict();
605
654
  const automationDefinitionFields = {
606
655
  title: z.string().nullable(),
607
- instruction: z.string()
656
+ task: automationTaskSchema
608
657
  };
609
658
  const automationVersionFields = {
610
659
  version: z.number().int().positive(),
@@ -663,7 +712,7 @@ const automationEditBaseSchema = scheduledAutomationSchema.pick({
663
712
  id: z.string().min(1),
664
713
  revision: automationRevisionSchema,
665
714
  title: z.string().nullable(),
666
- instruction: z.string(),
715
+ task: automationTaskSchema,
667
716
  credentialMode: z.enum(["system", "creator"]),
668
717
  outcomes: z.array(taskOutcomeSchema).max(5),
669
718
  /** Creator-only rules apply when false. */
@@ -720,4 +769,4 @@ const automationEventCatalogSchema = z.array(z.object({
720
769
  }).strict());
721
770
  const automationScheduleIntentSchema = scheduleIntentSchema;
722
771
  const automationSchedulePreviewSchema = scheduledAutomationSchema.pick({ schedule: true }).extend({ nextRunAtMs: z.number() }).strict();
723
- export { SCHEDULED_AUTOMATION_SYSTEM_ACTOR as A, eventAutomationSummarySchema as C, taskOutcomeInputSchema as D, automationTitleSchema as E, scheduleIntentFromTool as F, toolScheduleIntentSchema as I, weekdaySchema as L, scheduledRunSchema as M, ScheduleIntentError as N, eventAutomationSchema as O, compileScheduleIntent as P, automationVersionSchema as S, automationInstructionToolSchema as T, automationSummarySchema as _, automationExecutionSchema as a, automationVersionListSchema as b, automationLifecycleSchema as c, automationParamsSchema as d, automationRunListSchema as f, automationSchedulePreviewSchema as g, automationScheduleIntentSchema as h, automationExecutionListSchema as i, scheduledAutomationSchema as j, eventAutomationTriggerSchema as k, automationListQuerySchema as l, automationRunWindowsSchema as m, automationEditSchema as n, automationExecutionStatusDaySchema as o, automationRunSchema as p, automationEventCatalogSchema as r, automationExecutionStatusSchema as s, automationEditErrorSchema as t, automationListSchema as u, automationUpdateSchema as v, scheduledAutomationSummarySchema as w, automationVersionParamsSchema as x, automationVersionActivateSchema as y };
772
+ export { eventAutomationTriggerSchema as A, automationTaskColumns as B, eventAutomationSummarySchema as C, automationTitleSchema as D, automationInstructionToolSchema as E, compileScheduleIntent as F, automationTaskSchema as H, scheduleIntentFromTool as I, toolScheduleIntentSchema as L, scheduledAutomationSchema as M, scheduledRunSchema as N, taskOutcomeInputSchema as O, ScheduleIntentError as P, weekdaySchema as R, automationVersionSchema as S, automationContextToolSchema as T, automationTaskText as U, automationTaskDescription as V, automationSummarySchema as _, automationExecutionSchema as a, automationVersionListSchema as b, automationLifecycleSchema as c, automationParamsSchema as d, automationRunListSchema as f, automationSchedulePreviewSchema as g, automationScheduleIntentSchema as h, automationExecutionListSchema as i, SCHEDULED_AUTOMATION_SYSTEM_ACTOR as j, eventAutomationSchema as k, automationListQuerySchema as l, automationRunWindowsSchema as m, automationEditSchema as n, automationExecutionStatusDaySchema as o, automationRunSchema as p, automationEventCatalogSchema as r, automationExecutionStatusSchema as s, automationEditErrorSchema as t, automationListSchema as u, automationUpdateSchema as v, scheduledAutomationSummarySchema as w, automationVersionParamsSchema as x, automationVersionActivateSchema as y, automationSkillNameSchema as z };
@@ -1,5 +1,5 @@
1
- import { i as getChatConfig } from "./config-BerMjSVL.js";
2
- import { E as withSpan, h as logWarn, m as logInfo, p as logException } from "./logging-CTCH5jOy.js";
1
+ import { i as getChatConfig } from "./config-B4b-NXH5.js";
2
+ import { E as withSpan, h as logWarn, m as logInfo, p as logException } from "./logging-BN5drSEZ.js";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import { createHash, createHmac, timingSafeEqual } from "node:crypto";
5
5
  import * as z from "zod";
@@ -371,7 +371,7 @@ function cacheWarmupCallback() {
371
371
  maxDeliveries: 1,
372
372
  onRejected: logCacheWarmupRejected,
373
373
  run: async (message) => {
374
- const { runCacheWarmup } = await import("./warmup-B62hd4lD.js").then((n) => n.o);
374
+ const { runCacheWarmup } = await import("./warmup-7S6z068f.js").then((n) => n.o);
375
375
  await runCacheWarmup(message);
376
376
  },
377
377
  skip: () => !getChatConfig().cacheWarmingEnabled,
@@ -560,7 +560,7 @@ function pluginTaskCallback() {
560
560
  maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
561
561
  onRejected: logPluginTaskQueueMessageRejected,
562
562
  run: async (message) => {
563
- const { processPluginTask } = await import("./task-runner-DjjHCX_m.js").then((n) => n.r);
563
+ const { processPluginTask } = await import("./task-runner-BYPN4BEO.js").then((n) => n.r);
564
564
  await processPluginTask(message);
565
565
  },
566
566
  topic: PLUGIN_TASK_QUEUE_TOPIC,
@@ -1,4 +1,4 @@
1
- import { l as completeObject, n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-exicBZeb.js";
1
+ import { l as completeObject, n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-Dmx6IfWZ.js";
2
2
  import { G as briefCodeChangeSchema, J as briefResourceLabel, X as parseBriefInput, d as conversationEventPageSchema, l as conversationDetailReportSchema } from "./conversation-CtjR1Zcx.js";
3
3
  import { CLI_USAGE } from "./cli/run.js";
4
4
  import path from "node:path";
@@ -262,7 +262,7 @@ async function parseRunOptions(argv) {
262
262
  * token.
263
263
  */
264
264
  async function configuredBriefModelId() {
265
- const { botConfig } = await import("./config-BerMjSVL.js").then((n) => n.r);
265
+ const { botConfig } = await import("./config-B4b-NXH5.js").then((n) => n.r);
266
266
  return botConfig.fastModelId;
267
267
  }
268
268
  function apiUrl(baseUrl, pathname) {
@@ -1,5 +1,5 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { t as createPluginCatalogRuntime } from "./registry-X_xdFY9L.js";
2
+ import { t as createPluginCatalogRuntime } from "./registry-DosVt9f9.js";
3
3
  // src/chat/plugins/catalog-runtime.ts
4
4
  var catalog_runtime_exports = /* @__PURE__ */ __exportAll({ pluginCatalogRuntime: () => pluginCatalogRuntime });
5
5
  const pluginCatalogRuntime = createPluginCatalogRuntime();
package/dist/cli/chat.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-BuH7EHrX.js";
1
+ import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-DHq1pjUg.js";
2
2
  import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
3
3
  import path from "node:path";
4
4
  import { createHash, randomUUID } from "node:crypto";
@@ -99,10 +99,10 @@ async function loadLocalPluginSet() {
99
99
  async function configureLocalChatPlugins(pluginSet) {
100
100
  const [pluginsModule, agentHooksModule, catalogRuntimeModule, validationModule, databaseModule] = await Promise.all([
101
101
  import("../plugins-HYh_JOdw.js").then((n) => n.o),
102
- import("../projection-DY93nCfX.js").then((n) => n.jn),
103
- import("../catalog-runtime-Cj9I0dco.js").then((n) => n.t),
104
- import("../validation-Cvx_AupF.js").then((n) => n.r),
105
- import("../db-BlfjuqzW.js").then((n) => n.n)
102
+ import("../projection-DXl4ftyL.js").then((n) => n.Fn),
103
+ import("../catalog-runtime-DwbTyNRD.js").then((n) => n.t),
104
+ import("../validation-DGeB_moV.js").then((n) => n.r),
105
+ import("../db-CoA7_Xqu.js").then((n) => n.n)
106
106
  ]);
107
107
  const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
108
108
  const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
@@ -152,18 +152,18 @@ function localDevServerUrl() {
152
152
  async function prepareLocalChatRun(io, pluginSet) {
153
153
  defaultStateAdapterForLocalChat();
154
154
  await configureLocalChatPlugins(pluginSet);
155
- const { setBriefsConfig } = await import("../projection-DY93nCfX.js").then((n) => n.Un);
155
+ const { setBriefsConfig } = await import("../projection-DXl4ftyL.js").then((n) => n.Jn);
156
156
  setBriefsConfig({ enabled: true });
157
- const { runLocalAgentTurn } = await import("../runner-D44qp4rc.js");
158
- const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-CStBgDU7.js");
157
+ const { runLocalAgentTurn } = await import("../runner-h96Mkss6.js");
158
+ const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-Xi-mTLOV.js");
159
159
  const { createLocalOAuthState } = await import("../oauth-relay-D6xxVywK.js").then((n) => n.t);
160
- const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-BrH6DWkt.js");
161
- const { bindSpawnAgent } = await import("../spawn-CIAcfcvZ.js").then((n) => n.n);
162
- const { bindMessageAgent } = await import("../message-C1ID1tKi.js").then((n) => n.n);
163
- const { createChildConversationWorker } = await import("../result-CC8bV8Fl.js").then((n) => n.i);
164
- const { skipInputAfterConversationStop } = await import("../session-stop-DNucbmPf.js").then((n) => n.a);
160
+ const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-rK91BW7i.js");
161
+ const { bindSpawnAgent } = await import("../spawn-BQQrwGNe.js").then((n) => n.n);
162
+ const { bindMessageAgent } = await import("../message-D4qjpW1C.js").then((n) => n.n);
163
+ const { createChildConversationWorker } = await import("../result-CaAFpf4B.js").then((n) => n.i);
164
+ const { skipInputAfterConversationStop } = await import("../session-stop-xYK15HUu.js").then((n) => n.a);
165
165
  const { createLocalConversationWork } = await import("../conversation-work-BaT_T6EB.js");
166
- const { processConversationWork } = await import("../worker-4ClZu6ry.js").then((n) => n.n);
166
+ const { processConversationWork } = await import("../worker-CiCCfwd4.js").then((n) => n.n);
167
167
  let agentRunner;
168
168
  const localConversationWork = createLocalConversationWork(async (message) => {
169
169
  if (!agentRunner) throw new Error("Local agent runner is not ready");
@@ -177,7 +177,7 @@ async function prepareLocalChatRun(io, pluginSet) {
177
177
  });
178
178
  });
179
179
  agentRunner = createAgentRunner(executeAgentRun, {
180
- bindMessageAgent: (request) => request.agentInvocationId ? void 0 : bindMessageAgent(request, { queue: localConversationWork.queue }),
180
+ bindMessageAgent: (request, agents) => agents === "children_and_parent" ? void 0 : bindMessageAgent(request, { queue: localConversationWork.queue }),
181
181
  bindSpawnAgent: (request) => bindSpawnAgent(request, { queue: localConversationWork.queue })
182
182
  });
183
183
  const oauthCallback = await startLocalOAuthCallbackServer();
package/dist/cli/check.js CHANGED
@@ -1,6 +1,6 @@
1
- import { N as JUNIOR_HEARTBEAT_ROUTE, R as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-CTCH5jOy.js";
2
- import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-X_xdFY9L.js";
3
- import { i as parseSkillFile } from "../skills-BeUfmYXL.js";
1
+ import { N as JUNIOR_HEARTBEAT_ROUTE, R as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE } from "../logging-BN5drSEZ.js";
2
+ import { v as parseInlinePluginManifest, y as parsePluginManifest } from "../registry-DosVt9f9.js";
3
+ import { i as parseSkillFile } from "../skills-DHApyCjj.js";
4
4
  import path from "node:path";
5
5
  import fs from "node:fs/promises";
6
6
  import { pathToFileURL } from "node:url";
package/dist/cli/main.js CHANGED
@@ -45,13 +45,13 @@ async function runChat(argv, pluginSet) {
45
45
  return await (await import("./chat.js")).runChat(argv, void 0, { pluginSet });
46
46
  }
47
47
  async function runAdmin(argv) {
48
- return await (await import("../admin-BO9V7vnn.js")).runAdmin(argv);
48
+ return await (await import("../admin-uuecrKuD.js")).runAdmin(argv);
49
49
  }
50
50
  async function runServiceAccount(argv) {
51
- return await (await import("../service-account-DoNZuJb-.js")).runServiceAccount(argv);
51
+ return await (await import("../service-account-WUMVuqVL.js")).runServiceAccount(argv);
52
52
  }
53
53
  async function runBriefs(argv) {
54
- return await (await import("../briefs-DZrhXJss.js")).runBriefs(argv);
54
+ return await (await import("../briefs-NpgMEFh1.js")).runBriefs(argv);
55
55
  }
56
56
  function topLevelCommand(argv) {
57
57
  return (argv[0] === "--" ? argv.slice(1) : argv)[0];
@@ -1,7 +1,7 @@
1
- import { Bn as setPlugins, Vn as validatePlugins, Ya as createPluginLogger } from "../projection-DY93nCfX.js";
2
- import { o as getDb } from "../db-BlfjuqzW.js";
3
- import { n as pluginCatalogRuntime } from "../catalog-runtime-Cj9I0dco.js";
4
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-Cvx_AupF.js";
1
+ import { Gn as setPlugins, Kn as validatePlugins, eo as createPluginLogger } from "../projection-DXl4ftyL.js";
2
+ import { o as getDb } from "../db-CoA7_Xqu.js";
3
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-DwbTyNRD.js";
4
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-DGeB_moV.js";
5
5
  import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-HYh_JOdw.js";
6
6
  import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
7
7
  import { stderr, stdout } from "node:process";
@@ -1,7 +1,7 @@
1
- import { Aa as SANDBOX_RUNTIME, wi as create } from "../projection-DY93nCfX.js";
2
- import { n as pluginCatalogRuntime } from "../catalog-runtime-Cj9I0dco.js";
3
- import { t as disconnectStateAdapter } from "../adapter-Cigb1MTr.js";
4
- import { n as resolve } from "../resolve-B9dYN-nS.js";
1
+ import { Fa as SANDBOX_RUNTIME, ki as create } from "../projection-DXl4ftyL.js";
2
+ import { n as pluginCatalogRuntime } from "../catalog-runtime-DwbTyNRD.js";
3
+ import { t as disconnectStateAdapter } from "../adapter-CMJfmHso.js";
4
+ import { n as resolve } from "../resolve-BDjWJC9s.js";
5
5
  // src/cli/snapshot-create.ts
6
6
  const DEFAULT_TIMEOUT_MS = 6e5;
7
7
  function progressMessage(phase) {
@@ -1,4 +1,4 @@
1
- import "../db-7glZCI18.js";
1
+ import "../db-BbpttyKH.js";
2
2
  import { n as JuniorPluginSet } from "../plugins-DtmjkTza.js";
3
3
  interface UpgradeIo {
4
4
  info: (line: string) => void;
@@ -1,6 +1,6 @@
1
- import { i as getChatConfig } from "../config-BerMjSVL.js";
2
- import { t as createJuniorSqlExecutor } from "../executor-ikZvFaMD.js";
3
- import { t as createPluginCatalogRuntime } from "../registry-X_xdFY9L.js";
1
+ import { i as getChatConfig } from "../config-B4b-NXH5.js";
2
+ import { t as createJuniorSqlExecutor } from "../executor-SWyHhit0.js";
3
+ import { t as createPluginCatalogRuntime } from "../registry-DosVt9f9.js";
4
4
  import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-HYh_JOdw.js";
5
5
  import { t as loadAppPluginSet } from "../plugin-module-Cf5gVPWP.js";
6
6
  import { basename, dirname, join, resolve } from "node:path";
@@ -1,6 +1,6 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-CTCH5jOy.js";
3
- import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-BMfbOUCo.js";
2
+ import { E as withSpan, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, p as logException, v as serializeGenAiAttribute } from "./logging-BN5drSEZ.js";
3
+ import { a as toCanonicalInputMessage, n as getCurrentConversationPrivacy, o as toCanonicalOutputMessage, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-DRsSgLGO.js";
4
4
  import { AwsClient } from "aws4fetch";
5
5
  import { del, get, put } from "@vercel/blob";
6
6
  import { calculateCost, completeSimple, getEnvApiKey, getModels, registerApiProvider } from "@earendil-works/pi-ai/compat";
@@ -1,9 +1,9 @@
1
- import { Fi as startOAuthFlow } from "./projection-DY93nCfX.js";
2
- import { n as botConfig } from "./config-BerMjSVL.js";
3
- import { A as deleteProviderIdentityForUser, k as deleteProviderIdentityForSlackUser, s as getSqlExecutor } from "./db-BlfjuqzW.js";
4
- import { u as hasRequiredOAuthScope } from "./registry-X_xdFY9L.js";
5
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Cj9I0dco.js";
6
- import { c as deleteMcpServerSessionId, l as deleteMcpStoredOAuthCredentials, s as deleteMcpAuthSessionsForUserProvider } from "./agent-runner-BuH7EHrX.js";
1
+ import { Bi as startOAuthFlow } from "./projection-DXl4ftyL.js";
2
+ import { n as botConfig } from "./config-B4b-NXH5.js";
3
+ import { A as deleteProviderIdentityForUser, k as deleteProviderIdentityForSlackUser, s as getSqlExecutor } from "./db-CoA7_Xqu.js";
4
+ import { u as hasRequiredOAuthScope } from "./registry-DosVt9f9.js";
5
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-DwbTyNRD.js";
6
+ import { c as deleteMcpServerSessionId, l as deleteMcpStoredOAuthCredentials, s as deleteMcpAuthSessionsForUserProvider } from "./agent-runner-DHq1pjUg.js";
7
7
  import { randomBytes } from "node:crypto";
8
8
  // src/handlers/oauth-html.ts
9
9
  /** Build pre-escaped callback HTML with the shared response security policy. */
@@ -15,7 +15,10 @@ const pluginSchema = z.object({
15
15
  const pluginsSchema = z.array(pluginSchema);
16
16
  const skillReportSchema = z.object({
17
17
  name: z.string(),
18
- pluginProvider: z.string().optional()
18
+ description: z.string(),
19
+ pluginProvider: z.string().optional(),
20
+ /** The skill runs only when invoked by name, such as from an Automation. */
21
+ disableModelInvocation: z.boolean().optional()
19
22
  }).strict();
20
23
  const skillReportsSchema = z.array(skillReportSchema);
21
24
  const pluginPackageContentItemReportSchema = z.object({
@@ -1,4 +1,4 @@
1
- import { h as logWarn } from "./logging-CTCH5jOy.js";
1
+ import { h as logWarn } from "./logging-BN5drSEZ.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  // src/chat/conversation-privacy.ts
4
4
  const SAFE_METADATA_KEY_LIMIT = 20;
@@ -1,19 +1,19 @@
1
- import { An as resolvePluginOAuthAccount, En as createUserTokenStore, Ji as postSlackMessage, Mi as formatProviderLabel, Ni as parseOAuthStatePayload, Pi as resolveBaseUrl, Z as getConversationPendingAuth, aa as getSlackClient, d as recordAuthorizationCompleted, ot as getTurnRecord, u as recordAuthenticationLinked } from "./projection-DY93nCfX.js";
2
- import { L as escapeXml, a as getRuntimeMetadata, n as botConfig } from "./config-BerMjSVL.js";
3
- import { U as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-CTCH5jOy.js";
1
+ import { $i as postSlackMessage, An as createUserTokenStore, Li as formatProviderLabel, Pn as resolvePluginOAuthAccount, Ri as parseOAuthStatePayload, Z as getConversationPendingAuth, d as recordAuthorizationCompleted, ot as getTurnRecord, u as recordAuthenticationLinked, ua as getSlackClient, zi as resolveBaseUrl } from "./projection-DXl4ftyL.js";
2
+ import { L as escapeXml, a as getRuntimeMetadata, n as botConfig } from "./config-B4b-NXH5.js";
3
+ import { U as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging-BN5drSEZ.js";
4
4
  import { p as parseSlackUserId } from "./actor-6jsm_v96.js";
5
- import { D as resolveActorIdentityId, F as upsertLinkedIdentity, j as findUserByVerifiedEmails, s as getSqlExecutor } from "./db-BlfjuqzW.js";
5
+ import { D as resolveActorIdentityId, F as upsertLinkedIdentity, j as findUserByVerifiedEmails, s as getSqlExecutor } from "./db-CoA7_Xqu.js";
6
6
  import { i as homeDir } from "./package-discovery-DJhGdS4c.js";
7
- import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-X_xdFY9L.js";
8
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Cj9I0dco.js";
9
- import { t as discoverSkills } from "./skills-BeUfmYXL.js";
10
- import { It as wakeAuthorizedTurn, Lt as wakePausedTurn, Yt as deleteWebAuthorization, a as finalizeMcpAuthorization, d as getMcpStoredOAuthCredentials, f as putMcpStoredOAuthCredentials, o as deleteMcpAuthSession, u as getMcpAuthSession, y as lookupSlackUserProfile } from "./agent-runner-BuH7EHrX.js";
7
+ import { n as buildOAuthTokenRequest, r as parseOAuthTokenResponse, u as hasRequiredOAuthScope } from "./registry-DosVt9f9.js";
8
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-DwbTyNRD.js";
9
+ import { t as discoverSkills } from "./skills-DHApyCjj.js";
10
+ import { It as wakeAuthorizedTurn, Lt as wakePausedTurn, Yt as deleteWebAuthorization, a as finalizeMcpAuthorization, d as getMcpStoredOAuthCredentials, f as putMcpStoredOAuthCredentials, o as deleteMcpAuthSession, u as getMcpAuthSession, y as lookupSlackUserProfile } from "./agent-runner-DHq1pjUg.js";
11
11
  import { r as acquireActiveLock } from "./locks-D-0h111u.js";
12
- import { o as readIdentityById } from "./viewer-4CxdwLLQ.js";
13
- import { r as getStateAdapter } from "./adapter-Cigb1MTr.js";
14
- import { ht as getPersistedThreadState, vt as coerceThreadConversationState } from "./task-runner-DjjHCX_m.js";
15
- import { _ as getMcpProviderErrorAttributes } from "./service-account-89JZHWCE.js";
16
- import { i as readConnectedOAuthTokens, s as htmlCallbackResponse } from "./connections-BWmTOVPB.js";
12
+ import { o as readIdentityById } from "./viewer-9KLQibjn.js";
13
+ import { r as getStateAdapter } from "./adapter-CMJfmHso.js";
14
+ import { gt as coerceThreadConversationState, pt as getPersistedThreadState } from "./task-runner-BYPN4BEO.js";
15
+ import { _ as getMcpProviderErrorAttributes } from "./service-account-BpGpScaT.js";
16
+ import { i as readConnectedOAuthTokens, s as htmlCallbackResponse } from "./connections-Dz_AQg5p.js";
17
17
  import { n as relayLocalOAuthCallback } from "./oauth-relay-D6xxVywK.js";
18
18
  import path from "node:path";
19
19
  import { createHmac, createSecretKey, timingSafeEqual } from "node:crypto";
@@ -1,4 +1,4 @@
1
- import "./schema-CC2RxDAV.js";
1
+ import "./schema-CHsBmXIj.js";
2
2
  import * as z from "zod";
3
3
  import "drizzle-orm";
4
4
  import { Destination, Source, locationSchema } from "@sentry/junior-plugin-api";
@@ -1,8 +1,8 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { i as getChatConfig } from "./config-BerMjSVL.js";
3
- import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-CTCH5jOy.js";
2
+ import { i as getChatConfig } from "./config-B4b-NXH5.js";
3
+ import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-BN5drSEZ.js";
4
4
  import { a as isSlackUserId, d as parseSlackChannelReferenceId, f as parseSlackTeamId, s as parseActorUserId } from "./actor-6jsm_v96.js";
5
- import { A as juniorConversations, E as juniorConversationAnnotations, M as juniorUsers, N as juniorDestinations, S as juniorConversationMetrics, j as juniorIdentities, t as createJuniorSqlExecutor, v as juniorConversationParticipants, w as juniorConversationEvents, x as CONVERSATION_METRICS, y as juniorConversationBindings } from "./executor-ikZvFaMD.js";
5
+ import { A as juniorConversations, E as juniorConversationAnnotations, M as juniorUsers, N as juniorDestinations, S as juniorConversationMetrics, j as juniorIdentities, t as createJuniorSqlExecutor, v as juniorConversationParticipants, w as juniorConversationEvents, x as CONVERSATION_METRICS, y as juniorConversationBindings } from "./executor-SWyHhit0.js";
6
6
  import { d as historyReplacementSchema, f as newConversationEventSchema, p as encodeHistoryPayload, s as conversationEventDataSchema, u as decodeStoredConversationEvent, y as usageSchema } from "./media-BepyEUNm.js";
7
7
  import { randomUUID } from "node:crypto";
8
8
  import { and, asc, desc, eq, gt, gte, inArray, isNull, lt, lte, ne, or, sql } from "drizzle-orm";
@@ -1,6 +1,6 @@
1
1
  import { _ as withScope } from "./sentry-BRTJqumy.js";
2
- import "./config-BerMjSVL.js";
3
- import { h as logWarn, p as logException } from "./logging-CTCH5jOy.js";
2
+ import "./config-B4b-NXH5.js";
3
+ import { h as logWarn, p as logException } from "./logging-BN5drSEZ.js";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
5
5
  import { sql } from "drizzle-orm";
6
6
  import { bigint, boolean, check, date, doublePrecision, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
@@ -503,10 +503,11 @@ const juniorStats = pgTable("junior_stats", {
503
503
  * One row per Automation of either kind. `record` holds the fields that have
504
504
  * no column. Each write also copies the nested fields that queries filter or
505
505
  * search on into columns: `team_id`, `channel_id`, `creator_slack_user_id`,
506
- * `instruction`, and the event trigger `namespace` and `identifier`. An event
507
- * trigger with no identifier runs for every resource of its namespace, so its
508
- * `identifier` is null. The match index finds those rows with
509
- * `identifier is null`.
506
+ * the task `instruction` or `skill`, and the event trigger `namespace` and
507
+ * `identifier`. Exactly one of `instruction` and `skill` is set, by the task
508
+ * kind. A skill's context is only in `record`. An event trigger with no
509
+ * identifier runs for every resource of its namespace, so its `identifier` is
510
+ * null. The match index finds those rows with `identifier is null`.
510
511
  */
511
512
  const juniorAutomations = pgTable("junior_automations", {
512
513
  id: text("id").primaryKey(),
@@ -520,7 +521,10 @@ const juniorAutomations = pgTable("junior_automations", {
520
521
  /** Why a run blocked this Automation, until its creator resumes it. */
521
522
  statusReason: text("status_reason"),
522
523
  title: text("title"),
523
- instruction: text("instruction").notNull(),
524
+ /** The instruction of an instruction task. Null for a skill task. */
525
+ instruction: text("instruction"),
526
+ /** The skill of a skill task. Null for an instruction task. */
527
+ skill: text("skill"),
524
528
  createdAtMs: bigint("created_at_ms", { mode: "number" }).notNull(),
525
529
  nextRunAtMs: bigint("next_run_at_ms", { mode: "number" }),
526
530
  runNowAtMs: bigint("run_now_at_ms", { mode: "number" }),
@@ -530,12 +534,14 @@ const juniorAutomations = pgTable("junior_automations", {
530
534
  }, (table) => [
531
535
  check("junior_automations_kind_check", sql`${table.kind} in ('scheduled', 'event')`),
532
536
  check("junior_automations_status_check", sql`${table.status} in ('active', 'blocked', 'paused', 'completed', 'deleted')`),
537
+ check("junior_automations_task_check", sql`(${table.instruction} is null) <> (${table.skill} is null)`),
533
538
  check("junior_automations_record_check", sql`jsonb_typeof(${table.record}) = 'object'`),
534
539
  check("junior_automations_trigger_check", sql`(${table.kind} = 'scheduled' and ${table.namespace} is null and ${table.identifier} is null) or (${table.kind} = 'event' and ${table.namespace} is not null and ${table.nextRunAtMs} is null and ${table.runNowAtMs} is null and ${table.status} <> 'completed')`),
535
540
  index("junior_automations_team_idx").on(table.teamId, table.createdAtMs, table.id).where(sql`${table.status} <> 'deleted'`),
536
541
  index("junior_automations_creator_identity_idx").on(table.creatorIdentityId, table.createdAtMs, table.id),
537
542
  index("junior_automations_run_now_due_idx").on(table.runNowAtMs, table.createdAtMs, table.id).where(sql`${table.status} = 'active' AND ${table.runNowAtMs} IS NOT NULL`),
538
543
  index("junior_automations_next_run_due_idx").on(table.nextRunAtMs, table.createdAtMs, table.id).where(sql`${table.status} = 'active' AND ${table.nextRunAtMs} IS NOT NULL`),
544
+ index("junior_automations_skill_idx").on(table.skill, table.createdAtMs, table.id).where(sql`${table.status} <> 'deleted' AND ${table.skill} IS NOT NULL`),
539
545
  index("junior_automations_match_idx").on(table.namespace, table.identifier, table.createdAtMs, table.id).where(sql`${table.status} <> 'deleted'`)
540
546
  ]);
541
547
  // src/db/schema/automation-versions.ts
@@ -860,11 +866,13 @@ var OverflowPool = class extends Pool {
860
866
  connectionString: args.connectionString,
861
867
  max: POOL_MAX,
862
868
  idleTimeoutMillis: 6e4,
869
+ min: 1,
863
870
  statement_timeout: args.statementTimeoutMs
864
871
  });
865
872
  this.sql = neon(args.connectionString, { fullResults: true });
866
873
  this.dispatcher = args.dispatcher;
867
874
  this.statementTimeoutMs = args.statementTimeoutMs;
875
+ this.on("remove", () => this.reconnectWhenEmpty());
868
876
  }
869
877
  query(input, values, callback) {
870
878
  const query = typeof input === "string" ? { text: input } : input;
@@ -877,13 +885,22 @@ var OverflowPool = class extends Pool {
877
885
  growInBackground() {
878
886
  setImmediate(() => {
879
887
  if (this.ending || this.idleCount > 0 || this.totalCount >= POOL_MAX) return;
880
- this.connect((error, client) => {
881
- if (client) {
882
- client.release();
883
- return;
884
- }
885
- logException(error, "db.pool.client.connect_failed", { "app.db.driver": "neon" });
886
- });
888
+ this.openClient();
889
+ });
890
+ }
891
+ reconnectWhenEmpty() {
892
+ setImmediate(() => {
893
+ if (this.ending || this.totalCount > 0) return;
894
+ this.openClient();
895
+ });
896
+ }
897
+ openClient() {
898
+ this.connect((error, client) => {
899
+ if (client) {
900
+ client.release();
901
+ return;
902
+ }
903
+ logException(error, "db.pool.client.connect_failed", { "app.db.driver": "neon" });
887
904
  });
888
905
  }
889
906
  /** Keep every pool query in `callback` on WebSocket. */
@@ -1,6 +1,6 @@
1
1
  import { a as getClient, c as init, i as getActiveSpan, o as getGlobalScope, p as spanToJSON, s as getTraceData } from "./sentry-BRTJqumy.js";
2
- import { B as getDeploymentTelemetryAttributes, z as getDeploymentServiceVersion } from "./logging-CTCH5jOy.js";
3
- import { n as getCurrentConversationPrivacy } from "./conversation-privacy-BMfbOUCo.js";
2
+ import { B as getDeploymentTelemetryAttributes, z as getDeploymentServiceVersion } from "./logging-BN5drSEZ.js";
3
+ import { n as getCurrentConversationPrivacy } from "./conversation-privacy-DRsSgLGO.js";
4
4
  import { n as redactSandboxEgressProxyPath } from "./proxy-path-BHYoKZdq.js";
5
5
  import { t as consumePrivateTraceResultMarker } from "./private-trace-result-CE7_lEdq.js";
6
6
  import { n as promoteHttpRouteName, r as routeNameMiddleware, t as nameRequestRoute } from "./sentry-route-name-BhwWnfqj.js";
@@ -1,5 +1,5 @@
1
1
  import { _ as withScope, d as setTag, f as setUser, h as startSpan, i as getActiveSpan, l as logger, n as captureMessage, p as spanToJSON, s as getTraceData, t as captureException } from "./sentry-BRTJqumy.js";
2
- import { t as JUNIOR_VERSION } from "./version-BrDx4Fzc.js";
2
+ import { t as JUNIOR_VERSION } from "./version-C6nqU3Qc.js";
3
3
  import path from "node:path";
4
4
  import { styleText } from "node:util";
5
5
  import { ConfigError, configureSync, getConfig, getLogger } from "@logtape/logtape";