@sentry/junior 0.154.0 → 0.156.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-hooks-VEHV2QUA.js → agent-hooks-CCAR46PQ.js} +11 -12
- package/dist/api/conversations/list.d.ts +5 -3
- package/dist/api/conversations/membership.d.ts +16 -0
- package/dist/api/locations/detail.d.ts +2 -0
- package/dist/api/schema/conversation.d.ts +22 -4
- package/dist/api/schema/location.d.ts +2 -0
- package/dist/api/schema/person.d.ts +2 -0
- package/dist/api/schema.js +1 -1
- package/dist/api.js +331 -188
- package/dist/app.js +154 -51
- package/dist/catalog-runtime-3SNKYCBG.js +16 -0
- package/dist/chat/agent/types.d.ts +2 -0
- package/dist/chat/attachments/storage.d.ts +12 -0
- package/dist/chat/attachments/store.d.ts +52 -0
- package/dist/chat/attachments/vercel.d.ts +3 -0
- package/dist/chat/conversations/retention.d.ts +4 -0
- package/dist/chat/conversations/sql/event-actor.d.ts +14 -0
- package/dist/chat/conversations/sql/event-lock.d.ts +1 -1
- package/dist/chat/conversations/sql/participants.d.ts +17 -0
- package/dist/chat/ingress/bot-mention.d.ts +13 -0
- package/dist/chat/plugins/unfinished-work.d.ts +8 -0
- package/dist/chat/runtime/agent-runner.d.ts +4 -0
- package/dist/chat/runtime/slack-resume.d.ts +1 -1
- package/dist/chat/services/conversation-memory.d.ts +1 -1
- package/dist/chat/slack/tools/send-files.d.ts +17 -11
- package/dist/chat/state/conversation.d.ts +3 -1
- package/dist/chat/tools/types.d.ts +2 -0
- package/dist/{chunk-XYMCZGH6.js → chunk-3FFUC32L.js} +8 -10
- package/dist/{chunk-4U4MNYGP.js → chunk-3L2PMOSR.js} +6 -8
- package/dist/{chunk-PTJ75ZWR.js → chunk-4ZZDTHFC.js} +94 -9
- package/dist/{chunk-DAJZZFU7.js → chunk-53W3LZEW.js} +386 -93
- package/dist/{chunk-F7QUK3YP.js → chunk-6CINHXIL.js} +5 -5
- package/dist/{chunk-6VWMX7NS.js → chunk-6JUU7J2B.js} +4 -4
- package/dist/{chunk-HUO3UTAQ.js → chunk-7MA4HV4W.js} +1 -1
- package/dist/{chunk-O4AQDOKA.js → chunk-7RAETIYO.js} +7 -7
- package/dist/{chunk-4R2XCKUH.js → chunk-A6WPDFHQ.js} +1 -1
- package/dist/{chunk-CZD6M57V.js → chunk-AIJRG227.js} +191 -126
- package/dist/{chunk-RUIXF3YQ.js → chunk-BDUENQD3.js} +1 -1
- package/dist/{chunk-NUG3VYHL.js → chunk-CK2H7CFO.js} +2 -2
- package/dist/{chunk-HOGJ6TBT.js → chunk-CN2XSVKF.js} +6 -6
- package/dist/{chunk-3567VGCN.js → chunk-EDJ64P2P.js} +1 -1
- package/dist/{chunk-6PJXR4BC.js → chunk-GKC43TLS.js} +2 -2
- package/dist/{chunk-A6LWN4K6.js → chunk-GSBPZHLQ.js} +11 -11
- package/dist/{chunk-Y654CTW2.js → chunk-IIO5PFZX.js} +366 -138
- package/dist/{chunk-F2Q3ZHW2.js → chunk-IZEBHYI4.js} +1 -1
- package/dist/{chunk-QGR6QTC4.js → chunk-JUJR6WTL.js} +4 -4
- package/dist/{chunk-ZQT4RHUO.js → chunk-KBGMYLSV.js} +4 -1
- package/dist/{chunk-DK2FSQHS.js → chunk-KCA5MKHU.js} +5 -5
- package/dist/{chunk-NNN2WYAD.js → chunk-MC57E5U5.js} +1 -1
- package/dist/{chunk-6AF5GOZA.js → chunk-MJE7XKWP.js} +1 -1
- package/dist/{chunk-7CPN5JTA.js → chunk-NTNU6T2D.js} +3 -3
- package/dist/{chunk-NG4IAOVD.js → chunk-OGZPRMZA.js} +1 -1
- package/dist/{chunk-UCH55IGZ.js → chunk-OMQJB7YN.js} +28 -37
- package/dist/{chunk-2XNVS6RC.js → chunk-PMFGVLDU.js} +12 -11
- package/dist/{chunk-65IAU2L2.js → chunk-SE3D225X.js} +1 -1
- package/dist/{chunk-CCAU73CE.js → chunk-SRJA6QLM.js} +2 -2
- package/dist/{chunk-7RFWIHPM.js → chunk-TN4LVILT.js} +5 -5
- package/dist/{chunk-3ZR2R5EQ.js → chunk-TNXGMFWV.js} +1 -1
- package/dist/{chunk-HZF5P5UN.js → chunk-V7YE4WCP.js} +58 -7
- package/dist/{chunk-MSOZLASC.js → chunk-WD7SEUZO.js} +2 -2
- package/dist/{chunk-UG5UCHHJ.js → chunk-X5NZQH5U.js} +4 -2
- package/dist/{chunk-3HX67UPN.js → chunk-X7W45B5G.js} +1 -1
- package/dist/{chunk-FVY7AJ46.js → chunk-ZNWRYNCA.js} +7 -7
- package/dist/cli/chat.js +36 -36
- package/dist/cli/check.js +8 -9
- package/dist/cli/init.js +41 -7
- package/dist/cli/plugins.js +15 -16
- package/dist/cli/snapshot-create.js +11 -12
- package/dist/cli/upgrade.js +9 -10
- package/dist/db/schema/attachments.d.ts +178 -0
- package/dist/db/schema/conversation-events.d.ts +20 -0
- package/dist/db/schema/conversation-participants.d.ts +63 -0
- package/dist/db/schema.d.ts +255 -1
- package/dist/{db-SOJJLMJK.js → db-TYUUKGJX.js} +8 -8
- package/dist/handlers/retention.d.ts +4 -1
- package/dist/instrumentation.js +4 -4
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-GCJROMVO.js → oauth-callback-server-AWVDKPR5.js} +26 -26
- package/dist/{runner-SY6KDQCN.js → runner-JUQXMACC.js} +15 -16
- package/dist/{sandbox-egress-signals-EKPAVWQL.js → sandbox-egress-signals-U3ZX7C5W.js} +3 -4
- package/dist/{skills-XJ2LJ2ML.js → skills-4GZTZX4V.js} +8 -9
- package/dist/spawn-32SSRWU4.js +37 -0
- package/dist/{validation-XQWY6QRY.js → validation-DRLNJRND.js} +8 -9
- package/dist/version.js +1 -1
- package/dist/{work-FFT5JAOU.js → work-TGIXRRJY.js} +20 -21
- package/dist/worker-IFXZOYED.js +24 -0
- package/migrations/0026_conversation_event_actor_and_participants.sql +140 -0
- package/migrations/0027_attachment_storage.sql +16 -0
- package/migrations/meta/0026_snapshot.json +2424 -0
- package/migrations/meta/0027_snapshot.json +2554 -0
- package/migrations/meta/_journal.json +15 -1
- package/package.json +10 -7
- package/dist/catalog-runtime-AK5MY63F.js +0 -17
- package/dist/chunk-F3B2YJ76.js +0 -57
- package/dist/spawn-QFCQREEP.js +0 -38
- package/dist/worker-JAITK72F.js +0 -25
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CONVERSATION_WORK_DEFER_DELAY_MS,
|
|
3
|
+
processConversationWork
|
|
4
|
+
} from "./chunk-JUJR6WTL.js";
|
|
5
|
+
import "./chunk-A6WPDFHQ.js";
|
|
6
|
+
import "./chunk-6CINHXIL.js";
|
|
7
|
+
import "./chunk-JAL3CH4G.js";
|
|
8
|
+
import "./chunk-3Y47VMHV.js";
|
|
9
|
+
import "./chunk-IIO5PFZX.js";
|
|
10
|
+
import "./chunk-AIJRG227.js";
|
|
11
|
+
import "./chunk-MC57E5U5.js";
|
|
12
|
+
import "./chunk-GKC43TLS.js";
|
|
13
|
+
import "./chunk-VFUK3X5B.js";
|
|
14
|
+
import "./chunk-MJE7XKWP.js";
|
|
15
|
+
import "./chunk-V7YE4WCP.js";
|
|
16
|
+
import "./chunk-X7W45B5G.js";
|
|
17
|
+
import "./chunk-6GWA276C.js";
|
|
18
|
+
import "./chunk-OGZPRMZA.js";
|
|
19
|
+
import "./chunk-KBGMYLSV.js";
|
|
20
|
+
import "./chunk-MLKGABMK.js";
|
|
21
|
+
export {
|
|
22
|
+
CONVERSATION_WORK_DEFER_DELAY_MS,
|
|
23
|
+
processConversationWork
|
|
24
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
CREATE TABLE "junior_conversation_participants" (
|
|
2
|
+
"user_id" text NOT NULL,
|
|
3
|
+
"root_conversation_id" text NOT NULL,
|
|
4
|
+
"last_message_at" timestamp with time zone NOT NULL,
|
|
5
|
+
CONSTRAINT "junior_conversation_participants_user_root_pk" PRIMARY KEY("user_id","root_conversation_id")
|
|
6
|
+
);
|
|
7
|
+
--> statement-breakpoint
|
|
8
|
+
ALTER TABLE "junior_conversation_events" ADD COLUMN "actor_identity_id" text;--> statement-breakpoint
|
|
9
|
+
ALTER TABLE "junior_conversation_participants" ADD CONSTRAINT "junior_conversation_participants_user_id_junior_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."junior_users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
10
|
+
ALTER TABLE "junior_conversation_participants" ADD CONSTRAINT "junior_conversation_participants_root_conversation_id_junior_conversations_conversation_id_fk" FOREIGN KEY ("root_conversation_id") REFERENCES "public"."junior_conversations"("conversation_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
11
|
+
CREATE INDEX "junior_conversation_participants_user_activity_idx" ON "junior_conversation_participants" USING btree ("user_id","last_message_at" DESC NULLS LAST);--> statement-breakpoint
|
|
12
|
+
CREATE INDEX "junior_conversation_participants_root_idx" ON "junior_conversation_participants" USING btree ("root_conversation_id");--> statement-breakpoint
|
|
13
|
+
ALTER TABLE "junior_conversation_events" ADD CONSTRAINT "junior_conversation_events_actor_identity_id_junior_identities_id_fk" FOREIGN KEY ("actor_identity_id") REFERENCES "public"."junior_identities"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
14
|
+
CREATE INDEX "junior_conversation_events_actor_identity_idx" ON "junior_conversation_events" USING btree ("actor_identity_id","conversation_id","seq");--> statement-breakpoint
|
|
15
|
+
-- Lift explicit payload authorIdentityId values onto the new column when valid.
|
|
16
|
+
UPDATE "junior_conversation_events" AS e
|
|
17
|
+
SET "actor_identity_id" = e."payload"->>'authorIdentityId'
|
|
18
|
+
WHERE e."actor_identity_id" IS NULL
|
|
19
|
+
AND e."type" IN ('message', 'message_updated')
|
|
20
|
+
AND jsonb_typeof(e."payload") = 'object'
|
|
21
|
+
AND e."payload" ? 'authorIdentityId'
|
|
22
|
+
AND EXISTS (
|
|
23
|
+
SELECT 1
|
|
24
|
+
FROM "junior_identities" AS i
|
|
25
|
+
WHERE i."id" = e."payload"->>'authorIdentityId'
|
|
26
|
+
);--> statement-breakpoint
|
|
27
|
+
-- Match durable Slack human authors to known identities by subject (+ tenant when known).
|
|
28
|
+
UPDATE "junior_conversation_events" AS e
|
|
29
|
+
SET "actor_identity_id" = matched."id"
|
|
30
|
+
FROM (
|
|
31
|
+
SELECT DISTINCT ON (e2."conversation_id", e2."seq")
|
|
32
|
+
e2."conversation_id",
|
|
33
|
+
e2."seq",
|
|
34
|
+
i."id"
|
|
35
|
+
FROM "junior_conversation_events" AS e2
|
|
36
|
+
INNER JOIN "junior_conversations" AS c
|
|
37
|
+
ON c."conversation_id" = e2."conversation_id"
|
|
38
|
+
LEFT JOIN "junior_destinations" AS d
|
|
39
|
+
ON d."id" = c."destination_id"
|
|
40
|
+
INNER JOIN "junior_identities" AS i
|
|
41
|
+
ON i."provider" = 'slack'
|
|
42
|
+
AND i."provider_subject_id" = e2."payload"->'meta'->'author'->>'userId'
|
|
43
|
+
AND (
|
|
44
|
+
d."provider_tenant_id" IS NULL
|
|
45
|
+
OR d."provider_tenant_id" = ''
|
|
46
|
+
OR i."provider_tenant_id" = d."provider_tenant_id"
|
|
47
|
+
)
|
|
48
|
+
WHERE e2."actor_identity_id" IS NULL
|
|
49
|
+
AND e2."type" IN ('message', 'message_updated')
|
|
50
|
+
AND e2."payload"->>'role' = 'user'
|
|
51
|
+
AND coalesce((e2."payload"->'meta'->'author'->>'isBot')::boolean, false) = false
|
|
52
|
+
AND coalesce(e2."payload"->'meta'->'author'->>'userId', '') <> ''
|
|
53
|
+
ORDER BY e2."conversation_id", e2."seq", i."updated_at" DESC, i."id"
|
|
54
|
+
) AS matched
|
|
55
|
+
WHERE e."conversation_id" = matched."conversation_id"
|
|
56
|
+
AND e."seq" = matched."seq"
|
|
57
|
+
AND e."actor_identity_id" IS NULL;--> statement-breakpoint
|
|
58
|
+
-- Match durable junior/web human authors by verified email subject, including
|
|
59
|
+
-- dashboard:<sha256(email).slice(0,24)> author ids produced by webActorFromEmail.
|
|
60
|
+
CREATE EXTENSION IF NOT EXISTS pgcrypto;--> statement-breakpoint
|
|
61
|
+
UPDATE "junior_conversation_events" AS e
|
|
62
|
+
SET "actor_identity_id" = matched."id"
|
|
63
|
+
FROM (
|
|
64
|
+
SELECT DISTINCT ON (e2."conversation_id", e2."seq")
|
|
65
|
+
e2."conversation_id",
|
|
66
|
+
e2."seq",
|
|
67
|
+
i."id"
|
|
68
|
+
FROM "junior_conversation_events" AS e2
|
|
69
|
+
INNER JOIN "junior_identities" AS i
|
|
70
|
+
ON i."provider" = 'junior'
|
|
71
|
+
AND i."kind" = 'user'
|
|
72
|
+
AND i."email_verified" = true
|
|
73
|
+
AND i."email_normalized" IS NOT NULL
|
|
74
|
+
AND (
|
|
75
|
+
i."email_normalized" = lower(e2."payload"->'meta'->'author'->>'email')
|
|
76
|
+
OR i."provider_subject_id" = lower(e2."payload"->'meta'->'author'->>'email')
|
|
77
|
+
OR (
|
|
78
|
+
e2."payload"->'meta'->'author'->>'userId' LIKE 'dashboard:%'
|
|
79
|
+
AND e2."payload"->'meta'->'author'->>'userId' = concat(
|
|
80
|
+
'dashboard:',
|
|
81
|
+
left(encode(digest(i."email_normalized", 'sha256'), 'hex'), 24)
|
|
82
|
+
)
|
|
83
|
+
)
|
|
84
|
+
)
|
|
85
|
+
WHERE e2."actor_identity_id" IS NULL
|
|
86
|
+
AND e2."type" IN ('message', 'message_updated')
|
|
87
|
+
AND e2."payload"->>'role' = 'user'
|
|
88
|
+
AND coalesce((e2."payload"->'meta'->'author'->>'isBot')::boolean, false) = false
|
|
89
|
+
ORDER BY e2."conversation_id", e2."seq", i."updated_at" DESC, i."id"
|
|
90
|
+
) AS matched
|
|
91
|
+
WHERE e."conversation_id" = matched."conversation_id"
|
|
92
|
+
AND e."seq" = matched."seq"
|
|
93
|
+
AND e."actor_identity_id" IS NULL;--> statement-breakpoint
|
|
94
|
+
-- Materialize linked-user participants from authored human user messages.
|
|
95
|
+
INSERT INTO "junior_conversation_participants" (
|
|
96
|
+
"user_id",
|
|
97
|
+
"root_conversation_id",
|
|
98
|
+
"last_message_at"
|
|
99
|
+
)
|
|
100
|
+
SELECT
|
|
101
|
+
i."user_id",
|
|
102
|
+
coalesce(c."root_conversation_id", c."conversation_id") AS "root_conversation_id",
|
|
103
|
+
max(e."created_at") AS "last_message_at"
|
|
104
|
+
FROM "junior_conversation_events" AS e
|
|
105
|
+
INNER JOIN "junior_identities" AS i
|
|
106
|
+
ON i."id" = e."actor_identity_id"
|
|
107
|
+
INNER JOIN "junior_conversations" AS c
|
|
108
|
+
ON c."conversation_id" = e."conversation_id"
|
|
109
|
+
WHERE i."user_id" IS NOT NULL
|
|
110
|
+
AND e."type" IN ('message', 'message_updated')
|
|
111
|
+
AND e."payload"->>'role' = 'user'
|
|
112
|
+
AND coalesce((e."payload"->'meta'->'author'->>'isBot')::boolean, false) = false
|
|
113
|
+
AND coalesce(c."root_conversation_id", c."conversation_id") IS NOT NULL
|
|
114
|
+
GROUP BY i."user_id", coalesce(c."root_conversation_id", c."conversation_id")
|
|
115
|
+
ON CONFLICT ("user_id", "root_conversation_id") DO UPDATE
|
|
116
|
+
SET "last_message_at" = greatest(
|
|
117
|
+
"junior_conversation_participants"."last_message_at",
|
|
118
|
+
excluded."last_message_at"
|
|
119
|
+
);--> statement-breakpoint
|
|
120
|
+
-- Keep root actors in the personal feed even before they author a message row.
|
|
121
|
+
INSERT INTO "junior_conversation_participants" (
|
|
122
|
+
"user_id",
|
|
123
|
+
"root_conversation_id",
|
|
124
|
+
"last_message_at"
|
|
125
|
+
)
|
|
126
|
+
SELECT
|
|
127
|
+
i."user_id",
|
|
128
|
+
c."conversation_id",
|
|
129
|
+
c."last_activity_at"
|
|
130
|
+
FROM "junior_conversations" AS c
|
|
131
|
+
INNER JOIN "junior_identities" AS i
|
|
132
|
+
ON i."id" = c."actor_identity_id"
|
|
133
|
+
WHERE c."parent_conversation_id" IS NULL
|
|
134
|
+
AND i."user_id" IS NOT NULL
|
|
135
|
+
AND i."kind" = 'user'
|
|
136
|
+
ON CONFLICT ("user_id", "root_conversation_id") DO UPDATE
|
|
137
|
+
SET "last_message_at" = greatest(
|
|
138
|
+
"junior_conversation_participants"."last_message_at",
|
|
139
|
+
excluded."last_message_at"
|
|
140
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
CREATE TABLE "junior_attachments" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"conversation_id" text NOT NULL,
|
|
4
|
+
"provider" text NOT NULL,
|
|
5
|
+
"storage_key" text NOT NULL,
|
|
6
|
+
"filename" text NOT NULL,
|
|
7
|
+
"content_type" text NOT NULL,
|
|
8
|
+
"bytes" integer NOT NULL,
|
|
9
|
+
"sha256" text NOT NULL,
|
|
10
|
+
"created_at" timestamp with time zone NOT NULL,
|
|
11
|
+
"delete_requested_at" timestamp with time zone
|
|
12
|
+
);
|
|
13
|
+
--> statement-breakpoint
|
|
14
|
+
ALTER TABLE "junior_attachments" ADD CONSTRAINT "junior_attachments_conversation_id_junior_conversations_conversation_id_fk" FOREIGN KEY ("conversation_id") REFERENCES "public"."junior_conversations"("conversation_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
15
|
+
CREATE INDEX "junior_attachments_conversation_idx" ON "junior_attachments" USING btree ("conversation_id");--> statement-breakpoint
|
|
16
|
+
CREATE INDEX "junior_attachments_gc_idx" ON "junior_attachments" USING btree ("provider","delete_requested_at","created_at");
|