@sentry/junior 0.155.0 → 0.157.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 (94) hide show
  1. package/dist/{agent-hooks-AWVTLAV2.js → agent-hooks-QI5EPOKQ.js} +10 -10
  2. package/dist/api/conversations/attachments.d.ts +32 -0
  3. package/dist/api/conversations/priority.d.ts +21 -0
  4. package/dist/api/conversations/routes.d.ts +4 -1
  5. package/dist/api/locations/detail.d.ts +4 -1
  6. package/dist/api/schema/conversation.d.ts +33 -8
  7. package/dist/api/schema/location.d.ts +4 -1
  8. package/dist/api/schema/person.d.ts +4 -1
  9. package/dist/api/schema/task.d.ts +8 -8
  10. package/dist/api/schema.js +1 -1
  11. package/dist/api.js +182 -48
  12. package/dist/app.js +128 -44
  13. package/dist/{catalog-runtime-V6YD6KH5.js → catalog-runtime-HUGHAFUN.js} +5 -5
  14. package/dist/chat/agent/types.d.ts +2 -0
  15. package/dist/chat/agent-invocations/types.d.ts +12 -12
  16. package/dist/chat/attachments/storage.d.ts +14 -0
  17. package/dist/chat/attachments/store.d.ts +68 -0
  18. package/dist/chat/attachments/vercel.d.ts +3 -0
  19. package/dist/chat/conversations/retention.d.ts +4 -0
  20. package/dist/chat/event-tasks/tool-support.d.ts +1 -1
  21. package/dist/chat/event-tasks/types.d.ts +1 -1
  22. package/dist/chat/ingress/bot-mention.d.ts +13 -0
  23. package/dist/chat/plugins/unfinished-work.d.ts +11 -0
  24. package/dist/chat/runtime/agent-runner.d.ts +2 -0
  25. package/dist/chat/scheduled-tasks/tool-support.d.ts +5 -5
  26. package/dist/chat/scheduled-tasks/tools/create.d.ts +2 -2
  27. package/dist/chat/scheduled-tasks/tools/delete.d.ts +2 -2
  28. package/dist/chat/scheduled-tasks/tools/list.d.ts +2 -2
  29. package/dist/chat/scheduled-tasks/tools/run-now.d.ts +2 -2
  30. package/dist/chat/scheduled-tasks/tools/update.d.ts +2 -2
  31. package/dist/chat/services/conversation-memory.d.ts +1 -1
  32. package/dist/chat/slack/tools/send-files.d.ts +17 -11
  33. package/dist/chat/state/conversation.d.ts +2 -1
  34. package/dist/chat/task-execution/slack-work.d.ts +2 -2
  35. package/dist/chat/tools/types.d.ts +2 -0
  36. package/dist/{chunk-773XC7P4.js → chunk-3GS7O66Z.js} +159 -128
  37. package/dist/{chunk-JFZBGFNX.js → chunk-46ADYIPE.js} +2 -1
  38. package/dist/{chunk-KTVHAHUV.js → chunk-4M25PSFB.js} +1 -1
  39. package/dist/{chunk-4K5N6HTX.js → chunk-5TIH5GOE.js} +5 -5
  40. package/dist/{chunk-TVXAN43I.js → chunk-6MI43QZO.js} +1 -1
  41. package/dist/{chunk-RN3AWYEP.js → chunk-77QB5FNI.js} +1 -1
  42. package/dist/{chunk-Y7ZUBP2K.js → chunk-7J65DOBL.js} +6 -6
  43. package/dist/{chunk-2AHVM3HK.js → chunk-AFQ47JQ7.js} +10 -8
  44. package/dist/{chunk-ELOTIL5F.js → chunk-BLCVTEE7.js} +4 -4
  45. package/dist/{chunk-ZLSFOSDK.js → chunk-CZCMFRUQ.js} +18 -1
  46. package/dist/{chunk-2WLJDM23.js → chunk-D7BNWRYL.js} +1 -1
  47. package/dist/{chunk-EORR34UB.js → chunk-F7VOY4VQ.js} +1 -1
  48. package/dist/{chunk-JJX77MB7.js → chunk-G2FN3I66.js} +3 -3
  49. package/dist/{chunk-J2SYI36O.js → chunk-GEY6IFXH.js} +4 -4
  50. package/dist/{chunk-37G5HJ2X.js → chunk-GO2W3VZY.js} +4 -4
  51. package/dist/{chunk-LQT3SWFA.js → chunk-HJ3EZHIX.js} +351 -5
  52. package/dist/{chunk-SDRJ2LE3.js → chunk-I3OQVVMV.js} +1 -1
  53. package/dist/{chunk-TKJ7277U.js → chunk-MDZQ62PB.js} +2 -2
  54. package/dist/{chunk-V57LZDHN.js → chunk-MGJW3SW4.js} +6 -6
  55. package/dist/{chunk-7NYEB2TM.js → chunk-MKA3T2R6.js} +1 -1
  56. package/dist/{chunk-RQ62VKM7.js → chunk-MXO6VFB3.js} +1 -1
  57. package/dist/{chunk-AENPRXCG.js → chunk-OWASYHHV.js} +68 -39
  58. package/dist/{chunk-UWTXAYBP.js → chunk-PP4UQTH3.js} +9 -9
  59. package/dist/{chunk-JIC33O5L.js → chunk-RQBRGPUF.js} +2 -2
  60. package/dist/{chunk-NWSKFYOH.js → chunk-S4PFOWRA.js} +1 -1
  61. package/dist/{chunk-NKFRRZIT.js → chunk-TA5R6BME.js} +19 -18
  62. package/dist/{chunk-XFZLQANQ.js → chunk-UJYA75N5.js} +2 -2
  63. package/dist/{chunk-Y6MVGU7L.js → chunk-VBKFO65J.js} +35 -10
  64. package/dist/{chunk-KBT2I5ER.js → chunk-VDAEXEBB.js} +6 -6
  65. package/dist/{chunk-J7MWZFFP.js → chunk-VIBHFGQC.js} +4 -4
  66. package/dist/{chunk-APHDJYN7.js → chunk-VYDM7HUF.js} +1 -1
  67. package/dist/{chunk-CPQBTTI6.js → chunk-WNNYOPXX.js} +5 -5
  68. package/dist/{chunk-MLBH7J7J.js → chunk-XRERMHPN.js} +1 -1
  69. package/dist/cli/chat.js +30 -30
  70. package/dist/cli/check.js +6 -6
  71. package/dist/cli/plugins.js +13 -13
  72. package/dist/cli/snapshot-create.js +9 -9
  73. package/dist/cli/upgrade.js +7 -7
  74. package/dist/db/schema/agent-invocations.d.ts +4 -4
  75. package/dist/db/schema/attachments.d.ts +178 -0
  76. package/dist/db/schema.d.ts +183 -5
  77. package/dist/{db-WT7P56AH.js → db-VQAV4PJ3.js} +7 -7
  78. package/dist/handlers/retention.d.ts +4 -1
  79. package/dist/instrumentation.js +4 -4
  80. package/dist/nitro.js +2 -2
  81. package/dist/{oauth-callback-server-R2PK2MCA.js → oauth-callback-server-K5KQAAAX.js} +23 -23
  82. package/dist/{runner-O7YYUIHT.js → runner-U7QI7P4S.js} +14 -15
  83. package/dist/{skills-S6HLQRH7.js → skills-ENKRBZ7K.js} +6 -6
  84. package/dist/spawn-4XGNONLS.js +37 -0
  85. package/dist/{validation-46WD2OAR.js → validation-VKCDVGA6.js} +6 -6
  86. package/dist/version.js +1 -1
  87. package/dist/{work-YT5QUBS3.js → work-IBD6PWP2.js} +17 -17
  88. package/dist/worker-TJFXOZRC.js +24 -0
  89. package/migrations/0027_attachment_storage.sql +16 -0
  90. package/migrations/meta/0027_snapshot.json +2554 -0
  91. package/migrations/meta/_journal.json +8 -1
  92. package/package.json +5 -4
  93. package/dist/spawn-B4SBFFA2.js +0 -37
  94. package/dist/worker-4C5BEDWN.js +0 -24
@@ -1,3 +1,4 @@
1
+ import type { AttachmentStorage } from "@/chat/attachments/storage";
1
2
  import type { JuniorSqlDatabase } from "@/db/db";
2
3
  /** Content retention windows keyed by resolved conversation visibility. */
3
4
  export declare const CONTENT_RETENTION_MS: {
@@ -6,6 +7,8 @@ export declare const CONTENT_RETENTION_MS: {
6
7
  };
7
8
  /** Aggregate outcome of one bounded retention purge batch. */
8
9
  export interface RetentionPurgeResult {
10
+ /** Attachment blobs removed after conversation content was purged. */
11
+ attachments: number;
9
12
  /** Root conversations examined and attempted this run. */
10
13
  scanned: number;
11
14
  /** Root trees successfully purged. */
@@ -22,6 +25,7 @@ export interface RetentionPurgeResult {
22
25
  * remainder of an over-limit backlog is left for the next run.
23
26
  */
24
27
  export declare function runRetentionPurge(executor: JuniorSqlDatabase, args: {
28
+ attachmentStorage?: AttachmentStorage;
25
29
  nowMs: number;
26
30
  limit?: number;
27
31
  }): Promise<RetentionPurgeResult>;
@@ -92,7 +92,7 @@ export declare function requireEventTaskSlackContext(context: ToolRuntimeContext
92
92
  platform: "slack";
93
93
  teamId: string;
94
94
  channelId: string;
95
- visibility: "public" | "private";
95
+ visibility: "private" | "public";
96
96
  messageTs?: string | undefined;
97
97
  threadTs?: string | undefined;
98
98
  };
@@ -26,8 +26,8 @@ export declare const eventTaskSchema: z.ZodObject<{
26
26
  channelId: z.ZodString;
27
27
  }, z.core.$strict>;
28
28
  destinationVisibility: z.ZodEnum<{
29
- public: "public";
30
29
  private: "private";
30
+ public: "public";
31
31
  }>;
32
32
  task: z.ZodObject<{
33
33
  text: z.ZodString;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Detect Slack bot @mentions that should activate Junior.
3
+ *
4
+ * Mentions inside inline code or fenced code blocks are display-only
5
+ * references. Slack can still deliver `app_mention` for those tokens, so
6
+ * both `message` and `app_mention` paths must use this check.
7
+ */
8
+ /**
9
+ * Return true when `text` contains a Slack bot mention token outside code.
10
+ *
11
+ * Slack encodes user mentions as `<@UXXXXXXXX>` or `<@UXXXXXXXX|label>`.
12
+ */
13
+ export declare function textMentionsBot(text: string, botUserId: string): boolean;
@@ -1,2 +1,13 @@
1
+ export type ConversationWork = {
2
+ assignedIds: string[];
3
+ /** Latest finish time per conversation, used with activity for Priority. */
4
+ finishedAtById: Record<string, string>;
5
+ unfinishedIds: string[];
6
+ };
7
+ /**
8
+ * Return assigned and unfinished plugin work for the candidate conversations.
9
+ * Feed Priority combines these signals with conversation activity on the host.
10
+ */
11
+ export declare function listConversationWork(conversationIds: string[]): Promise<ConversationWork>;
1
12
  /** Return candidate conversations that have unfinished plugin work. */
2
13
  export declare function listUnfinishedWork(conversationIds: string[]): Promise<string[]>;
@@ -2,12 +2,14 @@ import type { StreamFn } from "@earendil-works/pi-agent-core";
2
2
  import { type AgentRun, type SpawnAgent } from "@/chat/agent/types";
3
3
  import type { AgentRunOutcome } from "@/chat/runtime/agent-run-outcome";
4
4
  import type { SandboxEgressTracePropagationConfig } from "@/chat/sandbox/egress/tracing";
5
+ import type { AttachmentStorage } from "@/chat/attachments/storage";
5
6
  /** Run one agent-run slice behind runtime-owned orchestration boundaries. */
6
7
  export interface AgentRunner {
7
8
  run(run: AgentRun): Promise<AgentRunOutcome>;
8
9
  }
9
10
  /** Compose the agent executor with stable host dependencies. */
10
11
  export declare function createAgentRunner(execute: (run: AgentRun, streamFn?: StreamFn) => Promise<AgentRunOutcome>, options?: {
12
+ attachmentStorage?: AttachmentStorage;
11
13
  bindSpawnAgent?: (run: AgentRun) => SpawnAgent | undefined;
12
14
  streamFn?: StreamFn;
13
15
  tracePropagation?: SandboxEgressTracePropagationConfig;
@@ -41,8 +41,8 @@ declare const compactTaskResultSchema: z.ZodObject<{
41
41
  group: "group";
42
42
  }>;
43
43
  visibility: z.ZodEnum<{
44
- public: "public";
45
44
  private: "private";
45
+ public: "public";
46
46
  }>;
47
47
  }, z.core.$strict>;
48
48
  credential_mode: z.ZodEnum<{
@@ -86,8 +86,8 @@ export declare const scheduleTaskToolResultSchema: z.ZodObject<{
86
86
  group: "group";
87
87
  }>;
88
88
  visibility: z.ZodEnum<{
89
- public: "public";
90
89
  private: "private";
90
+ public: "public";
91
91
  }>;
92
92
  }, z.core.$strict>;
93
93
  credential_mode: z.ZodEnum<{
@@ -131,8 +131,8 @@ export declare const scheduleListToolResultSchema: z.ZodObject<{
131
131
  group: "group";
132
132
  }>;
133
133
  visibility: z.ZodEnum<{
134
- public: "public";
135
134
  private: "private";
135
+ public: "public";
136
136
  }>;
137
137
  }, z.core.$strict>;
138
138
  credential_mode: z.ZodEnum<{
@@ -181,7 +181,7 @@ export declare function scheduleTaskToolResult(target: string, task: CompactTask
181
181
  };
182
182
  conversation_access: {
183
183
  audience: "channel" | "direct" | "group";
184
- visibility: "public" | "private";
184
+ visibility: "private" | "public";
185
185
  };
186
186
  credential_mode: "system" | "creator";
187
187
  dashboard_url: string | null;
@@ -211,7 +211,7 @@ export declare function scheduleListToolResult(args: {
211
211
  };
212
212
  conversation_access: {
213
213
  audience: "channel" | "direct" | "group";
214
- visibility: "public" | "private";
214
+ visibility: "private" | "public";
215
215
  };
216
216
  credential_mode: "system" | "creator";
217
217
  dashboard_url: string | null;
@@ -48,7 +48,7 @@ export declare function createSlackScheduleCreateTaskTool(context: SchedulerTool
48
48
  };
49
49
  conversation_access: {
50
50
  audience: "channel" | "direct" | "group";
51
- visibility: "public" | "private";
51
+ visibility: "private" | "public";
52
52
  };
53
53
  credential_mode: "system" | "creator";
54
54
  dashboard_url: string | null;
@@ -78,7 +78,7 @@ export declare function createSlackScheduleCreateTaskTool(context: SchedulerTool
78
78
  };
79
79
  conversation_access: {
80
80
  audience: "channel" | "direct" | "group";
81
- visibility: "public" | "private";
81
+ visibility: "private" | "public";
82
82
  };
83
83
  credential_mode: "system" | "creator";
84
84
  dashboard_url: string | null;
@@ -23,7 +23,7 @@ export declare function createSlackScheduleDeleteTaskTool(context: SchedulerTool
23
23
  };
24
24
  conversation_access: {
25
25
  audience: "channel" | "direct" | "group";
26
- visibility: "public" | "private";
26
+ visibility: "private" | "public";
27
27
  };
28
28
  credential_mode: "system" | "creator";
29
29
  dashboard_url: string | null;
@@ -53,7 +53,7 @@ export declare function createSlackScheduleDeleteTaskTool(context: SchedulerTool
53
53
  };
54
54
  conversation_access: {
55
55
  audience: "channel" | "direct" | "group";
56
- visibility: "public" | "private";
56
+ visibility: "private" | "public";
57
57
  };
58
58
  credential_mode: "system" | "creator";
59
59
  dashboard_url: string | null;
@@ -24,7 +24,7 @@ export declare function createSlackScheduleListTasksTool(context: SchedulerToolC
24
24
  };
25
25
  conversation_access: {
26
26
  audience: "channel" | "direct" | "group";
27
- visibility: "public" | "private";
27
+ visibility: "private" | "public";
28
28
  };
29
29
  credential_mode: "system" | "creator";
30
30
  dashboard_url: string | null;
@@ -54,7 +54,7 @@ export declare function createSlackScheduleListTasksTool(context: SchedulerToolC
54
54
  };
55
55
  conversation_access: {
56
56
  audience: "channel" | "direct" | "group";
57
- visibility: "public" | "private";
57
+ visibility: "private" | "public";
58
58
  };
59
59
  credential_mode: "system" | "creator";
60
60
  dashboard_url: string | null;
@@ -23,7 +23,7 @@ export declare function createSlackScheduleRunTaskNowTool(context: SchedulerTool
23
23
  };
24
24
  conversation_access: {
25
25
  audience: "channel" | "direct" | "group";
26
- visibility: "public" | "private";
26
+ visibility: "private" | "public";
27
27
  };
28
28
  credential_mode: "system" | "creator";
29
29
  dashboard_url: string | null;
@@ -53,7 +53,7 @@ export declare function createSlackScheduleRunTaskNowTool(context: SchedulerTool
53
53
  };
54
54
  conversation_access: {
55
55
  audience: "channel" | "direct" | "group";
56
- visibility: "public" | "private";
56
+ visibility: "private" | "public";
57
57
  };
58
58
  credential_mode: "system" | "creator";
59
59
  dashboard_url: string | null;
@@ -50,7 +50,7 @@ export declare function createSlackScheduleUpdateTaskTool(context: SchedulerTool
50
50
  };
51
51
  conversation_access: {
52
52
  audience: "channel" | "direct" | "group";
53
- visibility: "public" | "private";
53
+ visibility: "private" | "public";
54
54
  };
55
55
  credential_mode: "system" | "creator";
56
56
  dashboard_url: string | null;
@@ -80,7 +80,7 @@ export declare function createSlackScheduleUpdateTaskTool(context: SchedulerTool
80
80
  };
81
81
  conversation_access: {
82
82
  audience: "channel" | "direct" | "group";
83
- visibility: "public" | "private";
83
+ visibility: "private" | "public";
84
84
  };
85
85
  credential_mode: "system" | "creator";
86
86
  dashboard_url: string | null;
@@ -22,7 +22,7 @@ export declare function upsertConversationMessage(conversation: ThreadConversati
22
22
  export declare function recordDeliveredAssistantMessage(args: {
23
23
  conversation: ThreadConversationState;
24
24
  sessionId: string;
25
- source?: "web";
25
+ source?: "slack" | "web";
26
26
  text: string;
27
27
  userMessageId?: string;
28
28
  }): string;
@@ -1,10 +1,16 @@
1
+ import type { AttachmentStorage } from "@/chat/attachments/storage";
2
+ import type { JuniorSqlDatabase } from "@/db/db";
1
3
  import type { SlackToolContext } from "@/chat/slack/tool-support/context";
2
4
  import { type SandboxFileMaterializationInput, type SandboxFileUpload } from "@/chat/tools/sandbox/file-uploads";
3
5
  import type { ToolState } from "@/chat/tools/types";
4
6
  /** Convert a model-supplied sandbox file path into bytes safe for Slack upload. */
5
7
  export type MaterializeFile = (input: SandboxFileMaterializationInput) => Promise<SandboxFileUpload>;
6
8
  /** Create the Slack side-effect tool for active-conversation file messages. */
7
- export declare function createSendFilesTool(context: SlackToolContext, state: ToolState, materializeFile: MaterializeFile): Omit<import("../../tools/definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
9
+ export declare function createSendFilesTool(context: SlackToolContext, state: ToolState, materializeFile: MaterializeFile, attachments?: {
10
+ conversationId: string;
11
+ db: JuniorSqlDatabase;
12
+ storage: AttachmentStorage;
13
+ }): Omit<import("../../tools/definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
8
14
  inputSchema: import("../../tools/definition").JsonSchemaObject;
9
15
  outputSchema: import("../../tools/definition").JsonSchemaObject;
10
16
  prepareArguments(args: unknown): {
@@ -17,10 +23,11 @@ export declare function createSendFilesTool(context: SlackToolContext, state: To
17
23
  };
18
24
  execute?: ((input: unknown, options: import("../../tools/definition").ToolExecuteOptions) => {
19
25
  [x: string]: unknown;
20
- target: string;
21
- channel_id: string;
22
- file_count: number;
23
- thread_ts: string;
26
+ attachment_refs: {
27
+ id: string;
28
+ name: string;
29
+ }[];
30
+ target?: string | undefined;
24
31
  truncated?: boolean | undefined;
25
32
  timed_out?: boolean | undefined;
26
33
  continuation?: {
@@ -28,13 +35,13 @@ export declare function createSendFilesTool(context: SlackToolContext, state: To
28
35
  reason?: string | undefined;
29
36
  } | undefined;
30
37
  deduplicated?: boolean | undefined;
31
- file_ids?: string[] | undefined;
32
38
  } | Promise<{
33
39
  [x: string]: unknown;
34
- target: string;
35
- channel_id: string;
36
- file_count: number;
37
- thread_ts: string;
40
+ attachment_refs: {
41
+ id: string;
42
+ name: string;
43
+ }[];
44
+ target?: string | undefined;
38
45
  truncated?: boolean | undefined;
39
46
  timed_out?: boolean | undefined;
40
47
  continuation?: {
@@ -42,6 +49,5 @@ export declare function createSendFilesTool(context: SlackToolContext, state: To
42
49
  reason?: string | undefined;
43
50
  } | undefined;
44
51
  deduplicated?: boolean | undefined;
45
- file_ids?: string[] | undefined;
46
52
  }>) | undefined;
47
53
  };
@@ -8,7 +8,8 @@ export interface ConversationAuthor {
8
8
  }
9
9
  export interface ConversationMessageMeta {
10
10
  attachmentCount?: number;
11
- source?: "web";
11
+ /** Known message provenance. Omit when unknown; never invent a default. */
12
+ source?: "slack" | "web";
12
13
  eventType?: string;
13
14
  explicitMention?: boolean;
14
15
  imageAttachmentCount?: number;
@@ -72,9 +72,9 @@ declare const slackConversationMessageMetadataSchema: z.ZodUnion<readonly [z.Zod
72
72
  adapterName: z.ZodLiteral<"slack">;
73
73
  channelId: z.ZodString;
74
74
  channelVisibility: z.ZodOptional<z.ZodEnum<{
75
+ private: "private";
75
76
  unknown: "unknown";
76
77
  external: "external";
77
- private: "private";
78
78
  workspace: "workspace";
79
79
  }>>;
80
80
  currentMessage: z.ZodOptional<z.ZodObject<{
@@ -182,9 +182,9 @@ declare const slackConversationMessageMetadataSchema: z.ZodUnion<readonly [z.Zod
182
182
  adapterName: z.ZodLiteral<"slack">;
183
183
  channelId: z.ZodString;
184
184
  channelVisibility: z.ZodOptional<z.ZodEnum<{
185
+ private: "private";
185
186
  unknown: "unknown";
186
187
  external: "external";
187
- private: "private";
188
188
  workspace: "workspace";
189
189
  }>>;
190
190
  currentMessage: z.ZodOptional<z.ZodObject<{
@@ -10,6 +10,7 @@ import type { SlackActionToken } from "@/chat/slack/action-token";
10
10
  import type { ModelProfile } from "@/chat/model-profile";
11
11
  import type { GeneratedArtifactFileRef } from "@/chat/tools/sandbox/file-uploads";
12
12
  import type { SpawnAgent } from "@/chat/agent/types";
13
+ import type { AttachmentStorage } from "@/chat/attachments/storage";
13
14
  interface HandoffControl {
14
15
  /** Non-empty catalog of configured targets. */
15
16
  profiles: readonly [ModelProfile, ...ModelProfile[]];
@@ -52,6 +53,7 @@ export interface ToolHooks {
52
53
  };
53
54
  }
54
55
  interface BaseToolRuntimeContext {
56
+ attachmentStorage?: AttachmentStorage;
55
57
  handoff?: HandoffControl;
56
58
  spawnAgent?: SpawnAgent;
57
59
  /**