@sentry/junior 0.87.0 → 0.89.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 (61) hide show
  1. package/README.md +16 -5
  2. package/dist/{agent-hooks-NWOUB3UR.js → agent-hooks-RIJ5TSWP.js} +8 -8
  3. package/dist/api/people/list.d.ts +4 -0
  4. package/dist/api/people/list.js +83 -0
  5. package/dist/api/people/list.query.d.ts +4 -0
  6. package/dist/api/people/profile.d.ts +4 -0
  7. package/dist/api/people/profile.js +131 -0
  8. package/dist/api/people/profile.query.d.ts +4 -0
  9. package/dist/api/people/shared.d.ts +76 -0
  10. package/dist/api/people/types.d.ts +85 -0
  11. package/dist/app.js +43 -40
  12. package/dist/{catalog-runtime-XOD7YPRS.js → catalog-runtime-MW7XERSU.js} +3 -3
  13. package/dist/chat/conversations/sql/migrations.d.ts +1 -1
  14. package/dist/chat/conversations/sql/schema/identities.d.ts +54 -3
  15. package/dist/chat/conversations/sql/schema/users.d.ts +109 -0
  16. package/dist/chat/conversations/sql/schema.d.ts +164 -3
  17. package/dist/chat/conversations/sql/store.d.ts +0 -1
  18. package/dist/chat/identities/identity.d.ts +18 -0
  19. package/dist/chat/identities/sql.d.ts +4 -0
  20. package/dist/chat/runtime/processing-reaction.d.ts +2 -1
  21. package/dist/chat/runtime/slack-resume.d.ts +3 -2
  22. package/dist/chat/runtime/thread-context.d.ts +3 -1
  23. package/dist/chat/runtime/turn-user-message.d.ts +2 -1
  24. package/dist/chat/services/conversation-memory.d.ts +3 -1
  25. package/dist/chat/slack/message.d.ts +2 -1
  26. package/dist/chat/slack/outbound.d.ts +5 -4
  27. package/dist/chat/slack/timestamp.d.ts +6 -0
  28. package/dist/chat/sql/schema.d.ts +163 -3
  29. package/dist/chat/tools/slack/context.d.ts +2 -1
  30. package/dist/{chunk-ENPSU7L7.js → chunk-2DPZRS3B.js} +4 -4
  31. package/dist/{chunk-6I6HBOQM.js → chunk-4IXHIV37.js} +413 -157
  32. package/dist/{chunk-JRXCSSSU.js → chunk-6UPQ5GTJ.js} +3 -3
  33. package/dist/{chunk-64ACM6AP.js → chunk-7ES37H6U.js} +2 -2
  34. package/dist/{chunk-GGD6WK6V.js → chunk-AHLSXMOU.js} +2 -2
  35. package/dist/{chunk-2TAIGJPQ.js → chunk-C5NCV3OB.js} +1 -1
  36. package/dist/{chunk-6O5UI3RG.js → chunk-F22AM3OW.js} +1 -1
  37. package/dist/{chunk-BRSQQRG6.js → chunk-IATAYWFU.js} +2 -2
  38. package/dist/{chunk-BQ3ITJA6.js → chunk-KBFQXJL4.js} +2 -2
  39. package/dist/{chunk-ACJJJEGG.js → chunk-KBSLCOGE.js} +8 -8
  40. package/dist/{chunk-IXTBFABZ.js → chunk-KQKIA4CU.js} +1 -1
  41. package/dist/{chunk-B6FQPS7A.js → chunk-NYJLQI42.js} +22 -20
  42. package/dist/chunk-PBV4ZIVM.js +261 -0
  43. package/dist/{chunk-ZU2ALUVQ.js → chunk-S35CPNPT.js} +1 -1
  44. package/dist/{chunk-RIB3M6YA.js → chunk-V6XDCS3X.js} +4 -4
  45. package/dist/{chunk-KF7522P3.js → chunk-VMBZFPZM.js} +11 -1
  46. package/dist/{chunk-2NFV5FMB.js → chunk-XS6NLQPA.js} +21 -12
  47. package/dist/{chunk-GB5DFM4D.js → chunk-YPAE5RH3.js} +1 -1
  48. package/dist/cli/chat.js +6 -6
  49. package/dist/cli/check.js +4 -4
  50. package/dist/cli/init.js +30 -36
  51. package/dist/cli/plugins.js +11 -11
  52. package/dist/cli/snapshot-warmup.js +6 -6
  53. package/dist/cli/upgrade.js +12 -12
  54. package/dist/{db-SZVUU7RB.js → db-37HOGLI7.js} +5 -5
  55. package/dist/nitro.js +4 -4
  56. package/dist/reporting/conversations.d.ts +0 -56
  57. package/dist/reporting.d.ts +2 -8
  58. package/dist/reporting.js +14 -290
  59. package/dist/{runner-DMP3IQNM.js → runner-BCRF2FCI.js} +13 -13
  60. package/dist/{validation-MBNJKWPQ.js → validation-FMJO3L5P.js} +4 -4
  61. package/package.json +13 -5
@@ -1,5 +1,6 @@
1
1
  import type { Message, Thread } from "chat";
2
2
  import type { TurnToolInvocation } from "@/chat/runtime/turn-input";
3
+ import type { SlackMessageTs } from "@/chat/slack/timestamp";
3
4
  /** Controls the automatic Slack processing reaction lifecycle for one message. */
4
5
  export interface ProcessingReactionSession {
5
6
  complete: () => Promise<void>;
@@ -18,7 +19,7 @@ export declare function startSlackProcessingReaction(args: {
18
19
  /** Start Junior's automatic Slack processing reaction for a known Slack message. */
19
20
  export declare function startSlackProcessingReactionForMessage(args: {
20
21
  channelId: string;
21
- timestamp: string;
22
+ timestamp: SlackMessageTs;
22
23
  logException: (error: unknown, eventName: string, context?: Record<string, unknown>, attributes?: Record<string, unknown>, body?: string) => string | undefined;
23
24
  logContext: Record<string, unknown>;
24
25
  }): Promise<ProcessingReactionSession>;
@@ -1,5 +1,6 @@
1
1
  import { generateAssistantReply, type AssistantReply, type AssistantReplyRequestContext } from "@/chat/respond";
2
2
  import type { Source } from "@sentry/junior-plugin-api";
3
+ import type { SlackMessageTs } from "@/chat/slack/timestamp";
3
4
  /** Error raised when another worker already owns the resume lock. */
4
5
  export declare class ResumeTurnBusyError extends Error {
5
6
  constructor(lockKey: string);
@@ -8,7 +9,7 @@ interface ResumeSlackTurnArgs {
8
9
  messageText: string;
9
10
  channelId: string;
10
11
  threadTs: string;
11
- messageTs?: string;
12
+ messageTs?: SlackMessageTs;
12
13
  replyContext?: ResumeReplyContext;
13
14
  lockKey?: string;
14
15
  initialText?: string;
@@ -41,7 +42,7 @@ export declare function resumeAuthorizedRequest(args: {
41
42
  messageText: string;
42
43
  channelId: string;
43
44
  threadTs: string;
44
- messageTs?: string;
45
+ messageTs?: SlackMessageTs;
45
46
  connectedText: string;
46
47
  replyContext?: ResumeReplyContext;
47
48
  lockKey?: string;
@@ -1,4 +1,5 @@
1
1
  import type { Message, Thread } from "chat";
2
+ import { type SlackMessageTs } from "@/chat/slack/timestamp";
2
3
  interface StripLeadingBotMentionOptions {
3
4
  botUserId?: string;
4
5
  stripLeadingSlackMentionToken?: boolean;
@@ -21,7 +22,8 @@ export declare function getAssistantThreadContext(message: Message): {
21
22
  channelId: string;
22
23
  threadTs: string;
23
24
  } | undefined;
24
- export declare function getMessageTs(message: Message): string | undefined;
25
+ /** Resolve the native Slack timestamp for a message that can target Slack APIs. */
26
+ export declare function getMessageTs(message: Message): SlackMessageTs | undefined;
25
27
  /** Resolve the Slack workspace/team id from the raw inbound message payload. */
26
28
  export declare function getTeamId(message: Message): string | undefined;
27
29
  export {};
@@ -1,10 +1,11 @@
1
1
  import type { ConversationMessage, ThreadConversationState } from "@/chat/state/conversation";
2
+ import { type SlackMessageTs } from "@/chat/slack/timestamp";
2
3
  /** Return the user message for a persisted turn/session, if one exists. */
3
4
  export declare function getTurnUserMessage(conversation: ThreadConversationState, sessionId: string): ConversationMessage | undefined;
4
5
  /** Return the persisted user-message id for a turn/session, if one exists. */
5
6
  export declare function getTurnUserMessageId(conversation: ThreadConversationState, sessionId: string): string | undefined;
6
7
  /** Return the Slack timestamp for the user message that a resumed turn acts on. */
7
- export declare function getTurnUserSlackMessageTs(message: ConversationMessage | undefined): string | undefined;
8
+ export declare function getTurnUserSlackMessageTs(message: ConversationMessage | undefined): SlackMessageTs | undefined;
8
9
  /** Rebuild attachment context for a resumed turn from the persisted user message. */
9
10
  export declare function getTurnUserReplyAttachmentContext(message: ConversationMessage | undefined): {
10
11
  inboundAttachmentCount?: number;
@@ -1,5 +1,6 @@
1
1
  import type { completeText } from "@/chat/pi/client";
2
2
  import type { ConversationMessage, ThreadConversationState } from "@/chat/state/conversation";
3
+ import { type SlackMessageTs } from "@/chat/slack/timestamp";
3
4
  export interface ConversationMemoryDeps {
4
5
  completeText: typeof completeText;
5
6
  }
@@ -30,4 +31,5 @@ export declare function getThreadTitleSourceMessage(conversation: ThreadConversa
30
31
  /** Build the service that owns durable conversation memory compaction and titles. */
31
32
  export declare function createConversationMemoryService(deps: ConversationMemoryDeps): ConversationMemoryService;
32
33
  export declare function isHumanConversationMessage(message: ConversationMessage): boolean;
33
- export declare function getConversationMessageSlackTs(message: ConversationMessage): string | undefined;
34
+ /** Return the native Slack timestamp for a persisted conversation message. */
35
+ export declare function getConversationMessageSlackTs(message: ConversationMessage): SlackMessageTs | undefined;
@@ -1,6 +1,7 @@
1
1
  import type { Message } from "chat";
2
+ import { type SlackMessageTs } from "@/chat/slack/timestamp";
2
3
  /**
3
4
  * Preserve the native Slack message timestamp when a synthetic message ID is
4
5
  * used for routing or deduplication.
5
6
  */
6
- export declare function getSlackMessageTs(message: Pick<Message, "id" | "raw">): string;
7
+ export declare function getSlackMessageTs(message: Pick<Message, "id" | "raw">): SlackMessageTs | undefined;
@@ -1,4 +1,5 @@
1
1
  import type { SlackMessageBlock } from "@/chat/slack/footer";
2
+ import { type SlackMessageTs } from "@/chat/slack/timestamp";
2
3
  /** Post Slack `mrkdwn` text to a conversation or thread via the shared outbound boundary. */
3
4
  export declare function postSlackMessage(input: {
4
5
  blocks?: SlackMessageBlock[];
@@ -7,13 +8,13 @@ export declare function postSlackMessage(input: {
7
8
  threadTs?: string;
8
9
  includePermalink?: boolean;
9
10
  }): Promise<{
10
- ts: string;
11
+ ts: SlackMessageTs;
11
12
  permalink?: string;
12
13
  }>;
13
14
  /** Delete a previously posted Slack message through the shared outbound boundary. */
14
15
  export declare function deleteSlackMessage(input: {
15
16
  channelId: string;
16
- timestamp: string;
17
+ timestamp: SlackMessageTs;
17
18
  }): Promise<void>;
18
19
  /**
19
20
  * Post an ephemeral Slack message. Delivery is best-effort on Slack's side, but
@@ -39,7 +40,7 @@ export declare function uploadFilesToThread(input: {
39
40
  /** Add a reaction to a Slack message, treating `already_reacted` as idempotent success. */
40
41
  export declare function addReactionToMessage(input: {
41
42
  channelId: string;
42
- timestamp: string;
43
+ timestamp: SlackMessageTs;
43
44
  emoji: string;
44
45
  }): Promise<{
45
46
  ok: true;
@@ -47,7 +48,7 @@ export declare function addReactionToMessage(input: {
47
48
  /** Remove a reaction from a Slack message, treating `no_reaction` as idempotent success. */
48
49
  export declare function removeReactionFromMessage(input: {
49
50
  channelId: string;
50
- timestamp: string;
51
+ timestamp: SlackMessageTs;
51
52
  emoji: string;
52
53
  }): Promise<{
53
54
  ok: true;
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ /** Native Slack message timestamp, safe to pass as Slack Web API `message_ts`. */
3
+ export declare const slackMessageTsSchema: z.core.$ZodBranded<z.ZodString, "SlackMessageTs", "out">;
4
+ export type SlackMessageTs = z.output<typeof slackMessageTsSchema>;
5
+ /** Parse a native Slack message timestamp from untrusted message metadata. */
6
+ export declare function parseSlackMessageTs(value: unknown): SlackMessageTs | undefined;
@@ -1,4 +1,4 @@
1
- export { juniorConversations, juniorDestinations, juniorIdentities, juniorSchemaMigrations, } from "@/chat/conversations/sql/schema";
1
+ export { juniorConversations, juniorDestinations, juniorIdentities, juniorSchemaMigrations, juniorUsers, } from "@/chat/conversations/sql/schema";
2
2
  export declare const juniorSqlSchema: {
3
3
  juniorConversations: import("drizzle-orm/pg-core").PgTableWithColumns<{
4
4
  name: "junior_conversations";
@@ -658,7 +658,7 @@ export declare const juniorSqlSchema: {
658
658
  tableName: "junior_identities";
659
659
  dataType: "string";
660
660
  columnType: "PgText";
661
- data: import("../conversations/sql/schema/identities").JuniorIdentityKind;
661
+ data: import("../identities/identity").IdentityKind;
662
662
  driverParam: string;
663
663
  notNull: true;
664
664
  hasDefault: false;
@@ -670,7 +670,7 @@ export declare const juniorSqlSchema: {
670
670
  identity: undefined;
671
671
  generated: undefined;
672
672
  }, {}, {
673
- $type: import("../conversations/sql/schema/identities").JuniorIdentityKind;
673
+ $type: import("../identities/identity").IdentityKind;
674
674
  }>;
675
675
  provider: import("drizzle-orm/pg-core").PgColumn<{
676
676
  name: "provider";
@@ -842,6 +842,57 @@ export declare const juniorSqlSchema: {
842
842
  identity: undefined;
843
843
  generated: undefined;
844
844
  }, {}, {}>;
845
+ userId: import("drizzle-orm/pg-core").PgColumn<{
846
+ name: "user_id";
847
+ tableName: "junior_identities";
848
+ dataType: "string";
849
+ columnType: "PgText";
850
+ data: string;
851
+ driverParam: string;
852
+ notNull: false;
853
+ hasDefault: false;
854
+ isPrimaryKey: false;
855
+ isAutoincrement: false;
856
+ hasRuntimeDefault: false;
857
+ enumValues: [string, ...string[]];
858
+ baseColumn: never;
859
+ identity: undefined;
860
+ generated: undefined;
861
+ }, {}, {}>;
862
+ emailNormalized: import("drizzle-orm/pg-core").PgColumn<{
863
+ name: "email_normalized";
864
+ tableName: "junior_identities";
865
+ dataType: "string";
866
+ columnType: "PgText";
867
+ data: string;
868
+ driverParam: string;
869
+ notNull: false;
870
+ hasDefault: false;
871
+ isPrimaryKey: false;
872
+ isAutoincrement: false;
873
+ hasRuntimeDefault: false;
874
+ enumValues: [string, ...string[]];
875
+ baseColumn: never;
876
+ identity: undefined;
877
+ generated: undefined;
878
+ }, {}, {}>;
879
+ emailVerified: import("drizzle-orm/pg-core").PgColumn<{
880
+ name: "email_verified";
881
+ tableName: "junior_identities";
882
+ dataType: "boolean";
883
+ columnType: "PgBoolean";
884
+ data: boolean;
885
+ driverParam: boolean;
886
+ notNull: true;
887
+ hasDefault: true;
888
+ isPrimaryKey: false;
889
+ isAutoincrement: false;
890
+ hasRuntimeDefault: false;
891
+ enumValues: undefined;
892
+ baseColumn: never;
893
+ identity: undefined;
894
+ generated: undefined;
895
+ }, {}, {}>;
845
896
  };
846
897
  dialect: "pg";
847
898
  }>;
@@ -903,4 +954,113 @@ export declare const juniorSqlSchema: {
903
954
  };
904
955
  dialect: "pg";
905
956
  }>;
957
+ juniorUsers: import("drizzle-orm/pg-core").PgTableWithColumns<{
958
+ name: "junior_users";
959
+ schema: undefined;
960
+ columns: {
961
+ id: import("drizzle-orm/pg-core").PgColumn<{
962
+ name: "id";
963
+ tableName: "junior_users";
964
+ dataType: "string";
965
+ columnType: "PgText";
966
+ data: string;
967
+ driverParam: string;
968
+ notNull: true;
969
+ hasDefault: false;
970
+ isPrimaryKey: true;
971
+ isAutoincrement: false;
972
+ hasRuntimeDefault: false;
973
+ enumValues: [string, ...string[]];
974
+ baseColumn: never;
975
+ identity: undefined;
976
+ generated: undefined;
977
+ }, {}, {}>;
978
+ primaryEmail: import("drizzle-orm/pg-core").PgColumn<{
979
+ name: "primary_email";
980
+ tableName: "junior_users";
981
+ dataType: "string";
982
+ columnType: "PgText";
983
+ data: string;
984
+ driverParam: string;
985
+ notNull: true;
986
+ hasDefault: false;
987
+ isPrimaryKey: false;
988
+ isAutoincrement: false;
989
+ hasRuntimeDefault: false;
990
+ enumValues: [string, ...string[]];
991
+ baseColumn: never;
992
+ identity: undefined;
993
+ generated: undefined;
994
+ }, {}, {}>;
995
+ primaryEmailNormalized: import("drizzle-orm/pg-core").PgColumn<{
996
+ name: "primary_email_normalized";
997
+ tableName: "junior_users";
998
+ dataType: "string";
999
+ columnType: "PgText";
1000
+ data: string;
1001
+ driverParam: string;
1002
+ notNull: true;
1003
+ hasDefault: false;
1004
+ isPrimaryKey: false;
1005
+ isAutoincrement: false;
1006
+ hasRuntimeDefault: false;
1007
+ enumValues: [string, ...string[]];
1008
+ baseColumn: never;
1009
+ identity: undefined;
1010
+ generated: undefined;
1011
+ }, {}, {}>;
1012
+ displayName: import("drizzle-orm/pg-core").PgColumn<{
1013
+ name: "display_name";
1014
+ tableName: "junior_users";
1015
+ dataType: "string";
1016
+ columnType: "PgText";
1017
+ data: string;
1018
+ driverParam: string;
1019
+ notNull: false;
1020
+ hasDefault: false;
1021
+ isPrimaryKey: false;
1022
+ isAutoincrement: false;
1023
+ hasRuntimeDefault: false;
1024
+ enumValues: [string, ...string[]];
1025
+ baseColumn: never;
1026
+ identity: undefined;
1027
+ generated: undefined;
1028
+ }, {}, {}>;
1029
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
1030
+ name: string;
1031
+ tableName: "junior_users";
1032
+ dataType: "date";
1033
+ columnType: "PgTimestamp";
1034
+ data: Date;
1035
+ driverParam: string;
1036
+ notNull: true;
1037
+ hasDefault: false;
1038
+ isPrimaryKey: false;
1039
+ isAutoincrement: false;
1040
+ hasRuntimeDefault: false;
1041
+ enumValues: undefined;
1042
+ baseColumn: never;
1043
+ identity: undefined;
1044
+ generated: undefined;
1045
+ }, {}, {}>;
1046
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
1047
+ name: string;
1048
+ tableName: "junior_users";
1049
+ dataType: "date";
1050
+ columnType: "PgTimestamp";
1051
+ data: Date;
1052
+ driverParam: string;
1053
+ notNull: true;
1054
+ hasDefault: false;
1055
+ isPrimaryKey: false;
1056
+ isAutoincrement: false;
1057
+ hasRuntimeDefault: false;
1058
+ enumValues: undefined;
1059
+ baseColumn: never;
1060
+ identity: undefined;
1061
+ generated: undefined;
1062
+ }, {}, {}>;
1063
+ };
1064
+ dialect: "pg";
1065
+ }>;
906
1066
  };
@@ -2,12 +2,13 @@ import type { ToolRuntimeContext } from "@/chat/tools/types";
2
2
  import type { SlackDestination } from "@sentry/junior-plugin-api";
3
3
  import type { SlackSource } from "@sentry/junior-plugin-api";
4
4
  import type { SlackRequester } from "@/chat/requester";
5
+ import { type SlackMessageTs } from "@/chat/slack/timestamp";
5
6
  export interface SlackToolContext {
6
7
  destination: SlackDestination;
7
8
  source: SlackSource;
8
9
  requester?: SlackRequester;
9
10
  destinationChannelId: string;
10
- messageTs?: string;
11
+ messageTs?: SlackMessageTs;
11
12
  sourceChannelId: string;
12
13
  teamId: string;
13
14
  threadTs?: string;
@@ -4,17 +4,17 @@ import {
4
4
  import {
5
5
  getDefaultRedisStateAdapterFor,
6
6
  getStateAdapter
7
- } from "./chunk-GB5DFM4D.js";
7
+ } from "./chunk-YPAE5RH3.js";
8
8
  import {
9
9
  parseDestination,
10
10
  sameDestination
11
- } from "./chunk-GGD6WK6V.js";
11
+ } from "./chunk-AHLSXMOU.js";
12
12
  import {
13
13
  getChatConfig
14
- } from "./chunk-ZU2ALUVQ.js";
14
+ } from "./chunk-S35CPNPT.js";
15
15
  import {
16
16
  parseStoredSlackRequester
17
- } from "./chunk-IXTBFABZ.js";
17
+ } from "./chunk-KQKIA4CU.js";
18
18
  import {
19
19
  isRecord,
20
20
  toOptionalNumber,