@sentry/junior 0.87.0 → 0.88.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 (59) hide show
  1. package/dist/{agent-hooks-NWOUB3UR.js → agent-hooks-RIJ5TSWP.js} +8 -8
  2. package/dist/api/people/list.d.ts +4 -0
  3. package/dist/api/people/list.js +83 -0
  4. package/dist/api/people/list.query.d.ts +4 -0
  5. package/dist/api/people/profile.d.ts +4 -0
  6. package/dist/api/people/profile.js +131 -0
  7. package/dist/api/people/profile.query.d.ts +4 -0
  8. package/dist/api/people/shared.d.ts +76 -0
  9. package/dist/api/people/types.d.ts +85 -0
  10. package/dist/app.js +43 -40
  11. package/dist/{catalog-runtime-XOD7YPRS.js → catalog-runtime-MW7XERSU.js} +3 -3
  12. package/dist/chat/conversations/sql/migrations.d.ts +1 -1
  13. package/dist/chat/conversations/sql/schema/identities.d.ts +54 -3
  14. package/dist/chat/conversations/sql/schema/users.d.ts +109 -0
  15. package/dist/chat/conversations/sql/schema.d.ts +164 -3
  16. package/dist/chat/conversations/sql/store.d.ts +0 -1
  17. package/dist/chat/identities/identity.d.ts +18 -0
  18. package/dist/chat/identities/sql.d.ts +4 -0
  19. package/dist/chat/runtime/processing-reaction.d.ts +2 -1
  20. package/dist/chat/runtime/slack-resume.d.ts +3 -2
  21. package/dist/chat/runtime/thread-context.d.ts +3 -1
  22. package/dist/chat/runtime/turn-user-message.d.ts +2 -1
  23. package/dist/chat/services/conversation-memory.d.ts +3 -1
  24. package/dist/chat/slack/message.d.ts +2 -1
  25. package/dist/chat/slack/outbound.d.ts +5 -4
  26. package/dist/chat/slack/timestamp.d.ts +6 -0
  27. package/dist/chat/sql/schema.d.ts +163 -3
  28. package/dist/chat/tools/slack/context.d.ts +2 -1
  29. package/dist/{chunk-ENPSU7L7.js → chunk-2DPZRS3B.js} +4 -4
  30. package/dist/{chunk-6I6HBOQM.js → chunk-4IXHIV37.js} +413 -157
  31. package/dist/{chunk-JRXCSSSU.js → chunk-6UPQ5GTJ.js} +3 -3
  32. package/dist/{chunk-64ACM6AP.js → chunk-7ES37H6U.js} +2 -2
  33. package/dist/{chunk-GGD6WK6V.js → chunk-AHLSXMOU.js} +2 -2
  34. package/dist/{chunk-2TAIGJPQ.js → chunk-C5NCV3OB.js} +1 -1
  35. package/dist/{chunk-6O5UI3RG.js → chunk-F22AM3OW.js} +1 -1
  36. package/dist/{chunk-BRSQQRG6.js → chunk-IATAYWFU.js} +2 -2
  37. package/dist/{chunk-BQ3ITJA6.js → chunk-KBFQXJL4.js} +2 -2
  38. package/dist/{chunk-ACJJJEGG.js → chunk-KBSLCOGE.js} +8 -8
  39. package/dist/{chunk-IXTBFABZ.js → chunk-KQKIA4CU.js} +1 -1
  40. package/dist/{chunk-B6FQPS7A.js → chunk-NYJLQI42.js} +22 -20
  41. package/dist/chunk-PBV4ZIVM.js +261 -0
  42. package/dist/{chunk-ZU2ALUVQ.js → chunk-S35CPNPT.js} +1 -1
  43. package/dist/{chunk-RIB3M6YA.js → chunk-V6XDCS3X.js} +4 -4
  44. package/dist/{chunk-KF7522P3.js → chunk-VMBZFPZM.js} +11 -1
  45. package/dist/{chunk-2NFV5FMB.js → chunk-XS6NLQPA.js} +21 -12
  46. package/dist/{chunk-GB5DFM4D.js → chunk-YPAE5RH3.js} +1 -1
  47. package/dist/cli/chat.js +6 -6
  48. package/dist/cli/check.js +4 -4
  49. package/dist/cli/plugins.js +11 -11
  50. package/dist/cli/snapshot-warmup.js +6 -6
  51. package/dist/cli/upgrade.js +12 -12
  52. package/dist/{db-SZVUU7RB.js → db-37HOGLI7.js} +5 -5
  53. package/dist/nitro.js +4 -4
  54. package/dist/reporting/conversations.d.ts +0 -56
  55. package/dist/reporting.d.ts +2 -8
  56. package/dist/reporting.js +14 -290
  57. package/dist/{runner-DMP3IQNM.js → runner-BCRF2FCI.js} +13 -13
  58. package/dist/{validation-MBNJKWPQ.js → validation-FMJO3L5P.js} +4 -4
  59. package/package.json +14 -6
@@ -1,4 +1,4 @@
1
- export type JuniorIdentityKind = "service" | "system" | "user";
1
+ import type { IdentityKind } from "@/chat/identities/identity";
2
2
  export declare const juniorIdentities: import("drizzle-orm/pg-core").PgTableWithColumns<{
3
3
  name: "junior_identities";
4
4
  schema: undefined;
@@ -25,7 +25,7 @@ export declare const juniorIdentities: import("drizzle-orm/pg-core").PgTableWith
25
25
  tableName: "junior_identities";
26
26
  dataType: "string";
27
27
  columnType: "PgText";
28
- data: JuniorIdentityKind;
28
+ data: IdentityKind;
29
29
  driverParam: string;
30
30
  notNull: true;
31
31
  hasDefault: false;
@@ -37,7 +37,7 @@ export declare const juniorIdentities: import("drizzle-orm/pg-core").PgTableWith
37
37
  identity: undefined;
38
38
  generated: undefined;
39
39
  }, {}, {
40
- $type: JuniorIdentityKind;
40
+ $type: IdentityKind;
41
41
  }>;
42
42
  provider: import("drizzle-orm/pg-core").PgColumn<{
43
43
  name: "provider";
@@ -209,6 +209,57 @@ export declare const juniorIdentities: import("drizzle-orm/pg-core").PgTableWith
209
209
  identity: undefined;
210
210
  generated: undefined;
211
211
  }, {}, {}>;
212
+ userId: import("drizzle-orm/pg-core").PgColumn<{
213
+ name: "user_id";
214
+ tableName: "junior_identities";
215
+ dataType: "string";
216
+ columnType: "PgText";
217
+ data: string;
218
+ driverParam: string;
219
+ notNull: false;
220
+ hasDefault: false;
221
+ isPrimaryKey: false;
222
+ isAutoincrement: false;
223
+ hasRuntimeDefault: false;
224
+ enumValues: [string, ...string[]];
225
+ baseColumn: never;
226
+ identity: undefined;
227
+ generated: undefined;
228
+ }, {}, {}>;
229
+ emailNormalized: import("drizzle-orm/pg-core").PgColumn<{
230
+ name: "email_normalized";
231
+ tableName: "junior_identities";
232
+ dataType: "string";
233
+ columnType: "PgText";
234
+ data: string;
235
+ driverParam: string;
236
+ notNull: false;
237
+ hasDefault: false;
238
+ isPrimaryKey: false;
239
+ isAutoincrement: false;
240
+ hasRuntimeDefault: false;
241
+ enumValues: [string, ...string[]];
242
+ baseColumn: never;
243
+ identity: undefined;
244
+ generated: undefined;
245
+ }, {}, {}>;
246
+ emailVerified: import("drizzle-orm/pg-core").PgColumn<{
247
+ name: "email_verified";
248
+ tableName: "junior_identities";
249
+ dataType: "boolean";
250
+ columnType: "PgBoolean";
251
+ data: boolean;
252
+ driverParam: boolean;
253
+ notNull: true;
254
+ hasDefault: true;
255
+ isPrimaryKey: false;
256
+ isAutoincrement: false;
257
+ hasRuntimeDefault: false;
258
+ enumValues: undefined;
259
+ baseColumn: never;
260
+ identity: undefined;
261
+ generated: undefined;
262
+ }, {}, {}>;
212
263
  };
213
264
  dialect: "pg";
214
265
  }>;
@@ -0,0 +1,109 @@
1
+ export declare const juniorUsers: import("drizzle-orm/pg-core").PgTableWithColumns<{
2
+ name: "junior_users";
3
+ schema: undefined;
4
+ columns: {
5
+ id: import("drizzle-orm/pg-core").PgColumn<{
6
+ name: "id";
7
+ tableName: "junior_users";
8
+ dataType: "string";
9
+ columnType: "PgText";
10
+ data: string;
11
+ driverParam: string;
12
+ notNull: true;
13
+ hasDefault: false;
14
+ isPrimaryKey: true;
15
+ isAutoincrement: false;
16
+ hasRuntimeDefault: false;
17
+ enumValues: [string, ...string[]];
18
+ baseColumn: never;
19
+ identity: undefined;
20
+ generated: undefined;
21
+ }, {}, {}>;
22
+ primaryEmail: import("drizzle-orm/pg-core").PgColumn<{
23
+ name: "primary_email";
24
+ tableName: "junior_users";
25
+ dataType: "string";
26
+ columnType: "PgText";
27
+ data: string;
28
+ driverParam: string;
29
+ notNull: true;
30
+ hasDefault: false;
31
+ isPrimaryKey: false;
32
+ isAutoincrement: false;
33
+ hasRuntimeDefault: false;
34
+ enumValues: [string, ...string[]];
35
+ baseColumn: never;
36
+ identity: undefined;
37
+ generated: undefined;
38
+ }, {}, {}>;
39
+ primaryEmailNormalized: import("drizzle-orm/pg-core").PgColumn<{
40
+ name: "primary_email_normalized";
41
+ tableName: "junior_users";
42
+ dataType: "string";
43
+ columnType: "PgText";
44
+ data: string;
45
+ driverParam: string;
46
+ notNull: true;
47
+ hasDefault: false;
48
+ isPrimaryKey: false;
49
+ isAutoincrement: false;
50
+ hasRuntimeDefault: false;
51
+ enumValues: [string, ...string[]];
52
+ baseColumn: never;
53
+ identity: undefined;
54
+ generated: undefined;
55
+ }, {}, {}>;
56
+ displayName: import("drizzle-orm/pg-core").PgColumn<{
57
+ name: "display_name";
58
+ tableName: "junior_users";
59
+ dataType: "string";
60
+ columnType: "PgText";
61
+ data: string;
62
+ driverParam: string;
63
+ notNull: false;
64
+ hasDefault: false;
65
+ isPrimaryKey: false;
66
+ isAutoincrement: false;
67
+ hasRuntimeDefault: false;
68
+ enumValues: [string, ...string[]];
69
+ baseColumn: never;
70
+ identity: undefined;
71
+ generated: undefined;
72
+ }, {}, {}>;
73
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
74
+ name: string;
75
+ tableName: "junior_users";
76
+ dataType: "date";
77
+ columnType: "PgTimestamp";
78
+ data: Date;
79
+ driverParam: string;
80
+ notNull: true;
81
+ hasDefault: false;
82
+ isPrimaryKey: false;
83
+ isAutoincrement: false;
84
+ hasRuntimeDefault: false;
85
+ enumValues: undefined;
86
+ baseColumn: never;
87
+ identity: undefined;
88
+ generated: undefined;
89
+ }, {}, {}>;
90
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
91
+ name: string;
92
+ tableName: "junior_users";
93
+ dataType: "date";
94
+ columnType: "PgTimestamp";
95
+ data: Date;
96
+ driverParam: string;
97
+ notNull: true;
98
+ hasDefault: false;
99
+ isPrimaryKey: false;
100
+ isAutoincrement: false;
101
+ hasRuntimeDefault: false;
102
+ enumValues: undefined;
103
+ baseColumn: never;
104
+ identity: undefined;
105
+ generated: undefined;
106
+ }, {}, {}>;
107
+ };
108
+ dialect: "pg";
109
+ }>;
@@ -2,7 +2,8 @@ import { juniorConversations } from "./schema/conversations";
2
2
  import { juniorDestinations } from "./schema/destinations";
3
3
  import { juniorIdentities } from "./schema/identities";
4
4
  import { juniorSchemaMigrations } from "./schema/migrations";
5
- export { juniorConversations, juniorDestinations, juniorIdentities, juniorSchemaMigrations, };
5
+ import { juniorUsers } from "./schema/users";
6
+ export { juniorConversations, juniorDestinations, juniorIdentities, juniorSchemaMigrations, juniorUsers, };
6
7
  export declare const schema: {
7
8
  juniorConversations: import("drizzle-orm/pg-core").PgTableWithColumns<{
8
9
  name: "junior_conversations";
@@ -662,7 +663,7 @@ export declare const schema: {
662
663
  tableName: "junior_identities";
663
664
  dataType: "string";
664
665
  columnType: "PgText";
665
- data: import("./schema/identities").JuniorIdentityKind;
666
+ data: import("../../identities/identity").IdentityKind;
666
667
  driverParam: string;
667
668
  notNull: true;
668
669
  hasDefault: false;
@@ -674,7 +675,7 @@ export declare const schema: {
674
675
  identity: undefined;
675
676
  generated: undefined;
676
677
  }, {}, {
677
- $type: import("./schema/identities").JuniorIdentityKind;
678
+ $type: import("../../identities/identity").IdentityKind;
678
679
  }>;
679
680
  provider: import("drizzle-orm/pg-core").PgColumn<{
680
681
  name: "provider";
@@ -846,6 +847,57 @@ export declare const schema: {
846
847
  identity: undefined;
847
848
  generated: undefined;
848
849
  }, {}, {}>;
850
+ userId: import("drizzle-orm/pg-core").PgColumn<{
851
+ name: "user_id";
852
+ tableName: "junior_identities";
853
+ dataType: "string";
854
+ columnType: "PgText";
855
+ data: string;
856
+ driverParam: string;
857
+ notNull: false;
858
+ hasDefault: false;
859
+ isPrimaryKey: false;
860
+ isAutoincrement: false;
861
+ hasRuntimeDefault: false;
862
+ enumValues: [string, ...string[]];
863
+ baseColumn: never;
864
+ identity: undefined;
865
+ generated: undefined;
866
+ }, {}, {}>;
867
+ emailNormalized: import("drizzle-orm/pg-core").PgColumn<{
868
+ name: "email_normalized";
869
+ tableName: "junior_identities";
870
+ dataType: "string";
871
+ columnType: "PgText";
872
+ data: string;
873
+ driverParam: string;
874
+ notNull: false;
875
+ hasDefault: false;
876
+ isPrimaryKey: false;
877
+ isAutoincrement: false;
878
+ hasRuntimeDefault: false;
879
+ enumValues: [string, ...string[]];
880
+ baseColumn: never;
881
+ identity: undefined;
882
+ generated: undefined;
883
+ }, {}, {}>;
884
+ emailVerified: import("drizzle-orm/pg-core").PgColumn<{
885
+ name: "email_verified";
886
+ tableName: "junior_identities";
887
+ dataType: "boolean";
888
+ columnType: "PgBoolean";
889
+ data: boolean;
890
+ driverParam: boolean;
891
+ notNull: true;
892
+ hasDefault: true;
893
+ isPrimaryKey: false;
894
+ isAutoincrement: false;
895
+ hasRuntimeDefault: false;
896
+ enumValues: undefined;
897
+ baseColumn: never;
898
+ identity: undefined;
899
+ generated: undefined;
900
+ }, {}, {}>;
849
901
  };
850
902
  dialect: "pg";
851
903
  }>;
@@ -907,4 +959,113 @@ export declare const schema: {
907
959
  };
908
960
  dialect: "pg";
909
961
  }>;
962
+ juniorUsers: import("drizzle-orm/pg-core").PgTableWithColumns<{
963
+ name: "junior_users";
964
+ schema: undefined;
965
+ columns: {
966
+ id: import("drizzle-orm/pg-core").PgColumn<{
967
+ name: "id";
968
+ tableName: "junior_users";
969
+ dataType: "string";
970
+ columnType: "PgText";
971
+ data: string;
972
+ driverParam: string;
973
+ notNull: true;
974
+ hasDefault: false;
975
+ isPrimaryKey: true;
976
+ isAutoincrement: false;
977
+ hasRuntimeDefault: false;
978
+ enumValues: [string, ...string[]];
979
+ baseColumn: never;
980
+ identity: undefined;
981
+ generated: undefined;
982
+ }, {}, {}>;
983
+ primaryEmail: import("drizzle-orm/pg-core").PgColumn<{
984
+ name: "primary_email";
985
+ tableName: "junior_users";
986
+ dataType: "string";
987
+ columnType: "PgText";
988
+ data: string;
989
+ driverParam: string;
990
+ notNull: true;
991
+ hasDefault: false;
992
+ isPrimaryKey: false;
993
+ isAutoincrement: false;
994
+ hasRuntimeDefault: false;
995
+ enumValues: [string, ...string[]];
996
+ baseColumn: never;
997
+ identity: undefined;
998
+ generated: undefined;
999
+ }, {}, {}>;
1000
+ primaryEmailNormalized: import("drizzle-orm/pg-core").PgColumn<{
1001
+ name: "primary_email_normalized";
1002
+ tableName: "junior_users";
1003
+ dataType: "string";
1004
+ columnType: "PgText";
1005
+ data: string;
1006
+ driverParam: string;
1007
+ notNull: true;
1008
+ hasDefault: false;
1009
+ isPrimaryKey: false;
1010
+ isAutoincrement: false;
1011
+ hasRuntimeDefault: false;
1012
+ enumValues: [string, ...string[]];
1013
+ baseColumn: never;
1014
+ identity: undefined;
1015
+ generated: undefined;
1016
+ }, {}, {}>;
1017
+ displayName: import("drizzle-orm/pg-core").PgColumn<{
1018
+ name: "display_name";
1019
+ tableName: "junior_users";
1020
+ dataType: "string";
1021
+ columnType: "PgText";
1022
+ data: string;
1023
+ driverParam: string;
1024
+ notNull: false;
1025
+ hasDefault: false;
1026
+ isPrimaryKey: false;
1027
+ isAutoincrement: false;
1028
+ hasRuntimeDefault: false;
1029
+ enumValues: [string, ...string[]];
1030
+ baseColumn: never;
1031
+ identity: undefined;
1032
+ generated: undefined;
1033
+ }, {}, {}>;
1034
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
1035
+ name: string;
1036
+ tableName: "junior_users";
1037
+ dataType: "date";
1038
+ columnType: "PgTimestamp";
1039
+ data: Date;
1040
+ driverParam: string;
1041
+ notNull: true;
1042
+ hasDefault: false;
1043
+ isPrimaryKey: false;
1044
+ isAutoincrement: false;
1045
+ hasRuntimeDefault: false;
1046
+ enumValues: undefined;
1047
+ baseColumn: never;
1048
+ identity: undefined;
1049
+ generated: undefined;
1050
+ }, {}, {}>;
1051
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
1052
+ name: string;
1053
+ tableName: "junior_users";
1054
+ dataType: "date";
1055
+ columnType: "PgTimestamp";
1056
+ data: Date;
1057
+ driverParam: string;
1058
+ notNull: true;
1059
+ hasDefault: false;
1060
+ isPrimaryKey: false;
1061
+ isAutoincrement: false;
1062
+ hasRuntimeDefault: false;
1063
+ enumValues: undefined;
1064
+ baseColumn: never;
1065
+ identity: undefined;
1066
+ generated: undefined;
1067
+ }, {}, {}>;
1068
+ };
1069
+ dialect: "pg";
1070
+ }>;
910
1071
  };
@@ -53,7 +53,6 @@ export declare class SqlStore implements ConversationStore {
53
53
  private readConversationRow;
54
54
  /** Upsert the conversation row while preserving previously discovered nullable metadata fields. */
55
55
  private upsertConversation;
56
- private upsertIdentity;
57
56
  private upsertDestination;
58
57
  }
59
58
  /** Create a SQL-backed conversation store. */
@@ -0,0 +1,18 @@
1
+ export type IdentityKind = "service" | "system" | "user";
2
+ export interface IdentityUpsert {
3
+ displayName?: string;
4
+ email?: string;
5
+ emailVerified?: boolean;
6
+ handle?: string;
7
+ kind: IdentityKind;
8
+ metadata?: Record<string, unknown>;
9
+ provider: string;
10
+ providerSubjectId: string;
11
+ providerTenantId?: string;
12
+ }
13
+ export interface StoredIdentity {
14
+ id: string;
15
+ userId?: string;
16
+ }
17
+ /** Canonicalize email addresses for identity lookup and linking. */
18
+ export declare function normalizeIdentityEmail(email: string | undefined): string | undefined;
@@ -0,0 +1,4 @@
1
+ import type { JuniorSqlDatabase } from "@/chat/sql/db";
2
+ import { type IdentityUpsert, type StoredIdentity } from "./identity";
3
+ /** Persist one provider identity observation and link verified emails to users. */
4
+ export declare function upsertIdentity(executor: JuniorSqlDatabase, identity: IdentityUpsert, nowMs?: number): Promise<StoredIdentity>;
@@ -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;