@sentry/junior 0.128.1 → 0.130.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 (71) hide show
  1. package/dist/{agent-hooks-IWQNFJMS.js → agent-hooks-LJHLLMFC.js} +9 -9
  2. package/dist/api/schema/task.d.ts +152 -0
  3. package/dist/api/schema.d.ts +2 -0
  4. package/dist/api/schema.js +13 -3
  5. package/dist/api/tasks/routes.d.ts +4 -0
  6. package/dist/api.js +425 -23
  7. package/dist/app.js +309 -27
  8. package/dist/{catalog-runtime-KLSYFS4A.js → catalog-runtime-45AHWLJL.js} +5 -5
  9. package/dist/chat/agent-dispatch/context.d.ts +18 -0
  10. package/dist/chat/event-tasks/store.d.ts +7 -1
  11. package/dist/chat/event-tasks/tool-support.d.ts +1 -0
  12. package/dist/chat/resource-events/runtime-catalog.d.ts +3 -0
  13. package/dist/chat/scheduled-tasks/cadence.d.ts +27 -0
  14. package/dist/chat/scheduled-tasks/heartbeat.d.ts +6 -0
  15. package/dist/chat/scheduled-tasks/identity.d.ts +6 -0
  16. package/dist/chat/scheduled-tasks/personal.d.ts +26 -0
  17. package/dist/chat/scheduled-tasks/schedule-intent.d.ts +61 -0
  18. package/dist/chat/scheduled-tasks/store.d.ts +77 -0
  19. package/dist/chat/scheduled-tasks/tool-support.d.ts +203 -0
  20. package/dist/chat/scheduled-tasks/tools/create.d.ts +80 -0
  21. package/dist/chat/scheduled-tasks/tools/delete.d.ts +56 -0
  22. package/dist/chat/scheduled-tasks/tools/list.d.ts +54 -0
  23. package/dist/chat/scheduled-tasks/tools/run-now.d.ts +56 -0
  24. package/dist/chat/scheduled-tasks/tools/update.d.ts +82 -0
  25. package/dist/chat/scheduled-tasks/tools.d.ts +6 -0
  26. package/dist/chat/scheduled-tasks/types.d.ts +81 -0
  27. package/dist/chat/tasks/read.d.ts +9 -0
  28. package/dist/chat/tools/scheduled-tasks.d.ts +4 -0
  29. package/dist/{chunk-AAMF2IRC.js → chunk-224V72RX.js} +1308 -804
  30. package/dist/{chunk-54KP2EAH.js → chunk-2V7BQAJ6.js} +12 -12
  31. package/dist/{chunk-J3YIO3LE.js → chunk-4AF3XOZI.js} +3 -3
  32. package/dist/{chunk-S2O64VXP.js → chunk-4X2MZ4FP.js} +6 -6
  33. package/dist/{chunk-5IR7SGRO.js → chunk-5I4SWLD7.js} +2 -2
  34. package/dist/{chunk-OIQCRZ67.js → chunk-5XDJRSU5.js} +4 -4
  35. package/dist/{chunk-MZ6ZOWMJ.js → chunk-7OO3LMEP.js} +1 -1
  36. package/dist/{chunk-Q5TMMCBV.js → chunk-A64VQ4N4.js} +1 -1
  37. package/dist/{chunk-R2LXTX4J.js → chunk-ATCTPG7J.js} +1 -1
  38. package/dist/{chunk-AFJF3RGU.js → chunk-BVKP37NE.js} +61 -13
  39. package/dist/{chunk-EHEACYJ6.js → chunk-DMS2RTEK.js} +1 -1
  40. package/dist/{chunk-H4HMCSOZ.js → chunk-EKZSU2RK.js} +5 -5
  41. package/dist/chunk-GXO3EXBM.js +1470 -0
  42. package/dist/{chunk-ETGUGGO2.js → chunk-H6GDE77O.js} +7 -7
  43. package/dist/{chunk-P7UUNWC4.js → chunk-HJHTRJKR.js} +4 -4
  44. package/dist/{chunk-TONH5NXR.js → chunk-J6B27DOC.js} +1 -1
  45. package/dist/{chunk-SHMHHXD5.js → chunk-KB2M27DL.js} +58 -0
  46. package/dist/{chunk-EOIA25WC.js → chunk-LYEXN7FN.js} +2 -2
  47. package/dist/{chunk-O3C5BJFD.js → chunk-PVHL3274.js} +1 -1
  48. package/dist/{chunk-O3YROBH4.js → chunk-RTJCNKQD.js} +1 -1
  49. package/dist/{chunk-LIJ4APSS.js → chunk-UDYVHDLH.js} +1 -1
  50. package/dist/{chunk-PLAMHS3D.js → chunk-XRROAXID.js} +2 -2
  51. package/dist/{chunk-MKM5552O.js → chunk-Z72XGIFF.js} +1 -2
  52. package/dist/cli/chat.js +24 -24
  53. package/dist/cli/check.js +6 -6
  54. package/dist/cli/plugins.js +12 -12
  55. package/dist/cli/snapshot-create.js +9 -9
  56. package/dist/cli/upgrade.js +9 -17
  57. package/dist/db/schema/scheduled-tasks.d.ts +257 -0
  58. package/dist/db/schema.d.ts +258 -1
  59. package/dist/{db-VOU5QNLY.js → db-XE6DXA5Z.js} +7 -7
  60. package/dist/instrumentation.js +4 -4
  61. package/dist/nitro.js +2 -2
  62. package/dist/{oauth-callback-server-GS7FBYBC.js → oauth-callback-server-O42UXC7E.js} +17 -17
  63. package/dist/{runner-GSJSBI3J.js → runner-BSP3374N.js} +11 -11
  64. package/dist/{skills-DSHG54LM.js → skills-BNLHOZ75.js} +6 -6
  65. package/dist/{validation-25XWT6TA.js → validation-O7BF3JX6.js} +6 -6
  66. package/dist/version.js +1 -1
  67. package/migrations/0016_neat_the_anarchist.sql +171 -0
  68. package/migrations/meta/0016_snapshot.json +1617 -0
  69. package/migrations/meta/_journal.json +7 -0
  70. package/package.json +4 -5
  71. package/dist/chunk-REHOYCYS.js +0 -37
@@ -5,7 +5,7 @@ import {
5
5
  finalizeFailedTurnReplyWithEvent,
6
6
  processPluginTask,
7
7
  scheduleSessionCompletedPluginTasks
8
- } from "./chunk-S2O64VXP.js";
8
+ } from "./chunk-4X2MZ4FP.js";
9
9
  import "./chunk-5I6ORJUY.js";
10
10
  import {
11
11
  authorizationId
@@ -34,28 +34,28 @@ import {
34
34
  trimTrailingAssistantMessages,
35
35
  updateConversationStats,
36
36
  upsertConversationMessage
37
- } from "./chunk-OIQCRZ67.js";
37
+ } from "./chunk-5XDJRSU5.js";
38
38
  import "./chunk-HX236W2U.js";
39
39
  import "./chunk-PDO5BLNM.js";
40
- import "./chunk-H4HMCSOZ.js";
40
+ import "./chunk-EKZSU2RK.js";
41
41
  import {
42
42
  getConversationEventStore
43
- } from "./chunk-J3YIO3LE.js";
44
- import "./chunk-SHMHHXD5.js";
45
- import "./chunk-MZ6ZOWMJ.js";
46
- import "./chunk-5IR7SGRO.js";
43
+ } from "./chunk-4AF3XOZI.js";
44
+ import "./chunk-KB2M27DL.js";
45
+ import "./chunk-7OO3LMEP.js";
46
+ import "./chunk-5I4SWLD7.js";
47
47
  import "./chunk-VFUK3X5B.js";
48
- import "./chunk-EHEACYJ6.js";
48
+ import "./chunk-DMS2RTEK.js";
49
49
  import "./chunk-HZF5P5UN.js";
50
50
  import "./chunk-F3B2YJ76.js";
51
51
  import {
52
52
  logException,
53
53
  setTags,
54
54
  withLogContext
55
- } from "./chunk-TONH5NXR.js";
55
+ } from "./chunk-J6B27DOC.js";
56
56
  import "./chunk-6GWA276C.js";
57
- import "./chunk-Q5TMMCBV.js";
58
- import "./chunk-MKM5552O.js";
57
+ import "./chunk-A64VQ4N4.js";
58
+ import "./chunk-Z72XGIFF.js";
59
59
  import "./chunk-MLKGABMK.js";
60
60
 
61
61
  // src/chat/local/runner.ts
@@ -6,18 +6,18 @@ import {
6
6
  parseSkillInvocation,
7
7
  resetSkillDiscoveryCache,
8
8
  stripFrontmatter
9
- } from "./chunk-EOIA25WC.js";
10
- import "./chunk-R2LXTX4J.js";
11
- import "./chunk-O3YROBH4.js";
9
+ } from "./chunk-LYEXN7FN.js";
10
+ import "./chunk-ATCTPG7J.js";
11
+ import "./chunk-RTJCNKQD.js";
12
12
  import "./chunk-77VDLF3Z.js";
13
13
  import "./chunk-HZF5P5UN.js";
14
14
  import "./chunk-F3B2YJ76.js";
15
- import "./chunk-TONH5NXR.js";
15
+ import "./chunk-J6B27DOC.js";
16
16
  import "./chunk-6GWA276C.js";
17
17
  import "./chunk-OOUNJNMR.js";
18
18
  import "./chunk-H4HBKISO.js";
19
- import "./chunk-Q5TMMCBV.js";
20
- import "./chunk-MKM5552O.js";
19
+ import "./chunk-A64VQ4N4.js";
20
+ import "./chunk-Z72XGIFF.js";
21
21
  import "./chunk-MLKGABMK.js";
22
22
  export {
23
23
  discoverSkills,
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  validatePluginEgressCredentialHooks,
3
3
  validatePluginRegistrations
4
- } from "./chunk-O3C5BJFD.js";
5
- import "./chunk-R2LXTX4J.js";
6
- import "./chunk-O3YROBH4.js";
4
+ } from "./chunk-PVHL3274.js";
5
+ import "./chunk-ATCTPG7J.js";
6
+ import "./chunk-RTJCNKQD.js";
7
7
  import "./chunk-77VDLF3Z.js";
8
8
  import "./chunk-HZF5P5UN.js";
9
9
  import "./chunk-F3B2YJ76.js";
10
- import "./chunk-TONH5NXR.js";
10
+ import "./chunk-J6B27DOC.js";
11
11
  import "./chunk-6GWA276C.js";
12
12
  import "./chunk-OOUNJNMR.js";
13
13
  import "./chunk-H4HBKISO.js";
14
- import "./chunk-Q5TMMCBV.js";
15
- import "./chunk-MKM5552O.js";
14
+ import "./chunk-A64VQ4N4.js";
15
+ import "./chunk-Z72XGIFF.js";
16
16
  import "./chunk-MLKGABMK.js";
17
17
  export {
18
18
  validatePluginEgressCredentialHooks,
package/dist/version.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  JUNIOR_VERSION
3
- } from "./chunk-MKM5552O.js";
3
+ } from "./chunk-Z72XGIFF.js";
4
4
  import "./chunk-MLKGABMK.js";
5
5
  export {
6
6
  JUNIOR_VERSION
@@ -0,0 +1,171 @@
1
+ -- Adopt the former scheduler plugin tables without copying or renaming data.
2
+ CREATE TABLE IF NOT EXISTS "junior_scheduler_runs" (
3
+ "id" text PRIMARY KEY NOT NULL,
4
+ "task_id" text NOT NULL,
5
+ "status" text NOT NULL,
6
+ "scheduled_for_ms" bigint NOT NULL,
7
+ "record" jsonb NOT NULL
8
+ );--> statement-breakpoint
9
+ CREATE TABLE IF NOT EXISTS "junior_scheduler_tasks" (
10
+ "id" text PRIMARY KEY NOT NULL,
11
+ "team_id" text NOT NULL,
12
+ "creator_slack_user_id" text,
13
+ "creator_identity_id" text,
14
+ "status" text NOT NULL,
15
+ "next_run_at_ms" bigint,
16
+ "run_now_at_ms" bigint,
17
+ "created_at_ms" bigint NOT NULL,
18
+ "record" jsonb NOT NULL
19
+ );--> statement-breakpoint
20
+ ALTER TABLE "junior_scheduler_tasks" ADD COLUMN IF NOT EXISTS "creator_slack_user_id" text;--> statement-breakpoint
21
+ ALTER TABLE "junior_scheduler_tasks" ADD COLUMN IF NOT EXISTS "creator_identity_id" text;--> statement-breakpoint
22
+ UPDATE "junior_scheduler_tasks"
23
+ SET "record" = ("record" - 'credentialSubject') || jsonb_build_object('credentialMode', 'system')
24
+ WHERE NOT ("record" ? 'credentialMode')
25
+ OR "record" ? 'credentialSubject';--> statement-breakpoint
26
+ UPDATE "junior_scheduler_tasks"
27
+ SET "creator_slack_user_id" = "record"->'createdBy'->>'slackUserId'
28
+ WHERE "creator_slack_user_id" IS NULL;--> statement-breakpoint
29
+ UPDATE "junior_scheduler_tasks" AS "task"
30
+ SET "record" = jsonb_set(
31
+ "task"."record",
32
+ '{conversationAccess}',
33
+ jsonb_build_object(
34
+ 'audience',
35
+ CASE
36
+ WHEN "task"."record"#>>'{conversationAccess,audience}' IN ('direct', 'group', 'channel')
37
+ THEN "task"."record"#>>'{conversationAccess,audience}'
38
+ WHEN "task"."record"#>>'{destination,channelId}' LIKE 'D%' THEN 'direct'
39
+ WHEN "task"."record"#>>'{destination,channelId}' LIKE 'G%' THEN 'group'
40
+ ELSE 'channel'
41
+ END,
42
+ 'visibility',
43
+ COALESCE("destination"."visibility", 'private')
44
+ ),
45
+ true
46
+ )
47
+ FROM public."junior_destinations" AS "destination"
48
+ WHERE COALESCE("task"."record"#>>'{conversationAccess,visibility}', 'unknown') = 'unknown'
49
+ AND "destination"."provider" = 'slack'
50
+ AND "destination"."provider_tenant_id" = "task"."team_id"
51
+ AND "destination"."provider_destination_id" = "task"."record"#>>'{destination,channelId}'
52
+ AND "destination"."visibility" IN ('public', 'private');--> statement-breakpoint
53
+ UPDATE "junior_scheduler_tasks" AS "task"
54
+ SET "record" = jsonb_set(
55
+ "task"."record",
56
+ '{conversationAccess}',
57
+ jsonb_build_object(
58
+ 'audience',
59
+ CASE
60
+ WHEN "task"."record"#>>'{conversationAccess,audience}' IN ('direct', 'group', 'channel')
61
+ THEN "task"."record"#>>'{conversationAccess,audience}'
62
+ WHEN "task"."record"#>>'{destination,channelId}' LIKE 'D%' THEN 'direct'
63
+ WHEN "task"."record"#>>'{destination,channelId}' LIKE 'G%' THEN 'group'
64
+ ELSE 'channel'
65
+ END,
66
+ 'visibility',
67
+ 'private'
68
+ ),
69
+ true
70
+ )
71
+ WHERE COALESCE("task"."record"#>>'{conversationAccess,visibility}', 'unknown') = 'unknown';--> statement-breakpoint
72
+ INSERT INTO "junior_identities" (
73
+ "id",
74
+ "kind",
75
+ "provider",
76
+ "provider_tenant_id",
77
+ "provider_subject_id",
78
+ "created_at",
79
+ "updated_at"
80
+ )
81
+ SELECT DISTINCT ON (task."team_id", task."creator_slack_user_id")
82
+ 'scheduler-slack-' || md5(task."team_id" || ':' || task."creator_slack_user_id"),
83
+ 'user',
84
+ 'slack',
85
+ task."team_id",
86
+ task."creator_slack_user_id",
87
+ to_timestamp(task."created_at_ms" / 1000.0),
88
+ CURRENT_TIMESTAMP
89
+ FROM "junior_scheduler_tasks" AS task
90
+ WHERE task."creator_slack_user_id" IS NOT NULL
91
+ ORDER BY task."team_id", task."creator_slack_user_id", task."created_at_ms"
92
+ ON CONFLICT DO NOTHING;--> statement-breakpoint
93
+ UPDATE "junior_scheduler_tasks" AS task
94
+ SET
95
+ "creator_identity_id" = identity."id",
96
+ "record" = CASE
97
+ WHEN jsonb_typeof(task."record") = 'object' THEN
98
+ task."record" || jsonb_build_object('creatorIdentityId', identity."id")
99
+ ELSE task."record"
100
+ END
101
+ FROM "junior_identities" AS identity
102
+ WHERE identity."kind" = 'user'
103
+ AND identity."provider" = 'slack'
104
+ AND identity."provider_tenant_id" = task."team_id"
105
+ AND identity."provider_subject_id" = task."creator_slack_user_id"
106
+ AND task."creator_identity_id" IS NULL;--> statement-breakpoint
107
+ -- Keep rolling old workers compatible until the legacy creator column is retired.
108
+ CREATE OR REPLACE FUNCTION "junior_scheduler_assign_creator_identity"()
109
+ RETURNS trigger
110
+ LANGUAGE plpgsql
111
+ AS $function$
112
+ DECLARE
113
+ resolved_identity_id text;
114
+ BEGIN
115
+ IF NEW."creator_identity_id" IS NOT NULL
116
+ OR NEW."creator_slack_user_id" IS NULL THEN
117
+ RETURN NEW;
118
+ END IF;
119
+
120
+ INSERT INTO "junior_identities" (
121
+ "id",
122
+ "kind",
123
+ "provider",
124
+ "provider_tenant_id",
125
+ "provider_subject_id",
126
+ "created_at",
127
+ "updated_at"
128
+ ) VALUES (
129
+ 'scheduler-slack-' || md5(NEW."team_id" || ':' || NEW."creator_slack_user_id"),
130
+ 'user',
131
+ 'slack',
132
+ NEW."team_id",
133
+ NEW."creator_slack_user_id",
134
+ to_timestamp(NEW."created_at_ms" / 1000.0),
135
+ CURRENT_TIMESTAMP
136
+ )
137
+ ON CONFLICT DO NOTHING;
138
+
139
+ SELECT "id"
140
+ INTO resolved_identity_id
141
+ FROM "junior_identities"
142
+ WHERE "kind" = 'user'
143
+ AND "provider" = 'slack'
144
+ AND "provider_tenant_id" = NEW."team_id"
145
+ AND "provider_subject_id" = NEW."creator_slack_user_id"
146
+ LIMIT 1;
147
+
148
+ IF resolved_identity_id IS NOT NULL THEN
149
+ NEW."creator_identity_id" := resolved_identity_id;
150
+ IF jsonb_typeof(NEW."record") = 'object' THEN
151
+ NEW."record" := NEW."record" || jsonb_build_object(
152
+ 'creatorIdentityId',
153
+ resolved_identity_id
154
+ );
155
+ END IF;
156
+ END IF;
157
+ RETURN NEW;
158
+ END
159
+ $function$;--> statement-breakpoint
160
+ DROP TRIGGER IF EXISTS "junior_scheduler_assign_creator_identity" ON "junior_scheduler_tasks";--> statement-breakpoint
161
+ CREATE TRIGGER "junior_scheduler_assign_creator_identity"
162
+ BEFORE INSERT ON "junior_scheduler_tasks"
163
+ FOR EACH ROW
164
+ EXECUTE FUNCTION "junior_scheduler_assign_creator_identity"();--> statement-breakpoint
165
+ CREATE INDEX IF NOT EXISTS "junior_scheduler_runs_task_status_idx" ON "junior_scheduler_runs" USING btree ("task_id","status","scheduled_for_ms");--> statement-breakpoint
166
+ CREATE INDEX IF NOT EXISTS "junior_scheduler_runs_status_idx" ON "junior_scheduler_runs" USING btree ("status","scheduled_for_ms");--> statement-breakpoint
167
+ CREATE INDEX IF NOT EXISTS "junior_scheduler_tasks_creator_idx" ON "junior_scheduler_tasks" USING btree ("team_id","creator_slack_user_id","created_at_ms","id") WHERE "junior_scheduler_tasks"."status" <> 'deleted';--> statement-breakpoint
168
+ CREATE INDEX IF NOT EXISTS "junior_scheduler_tasks_creator_identity_idx" ON "junior_scheduler_tasks" USING btree ("creator_identity_id","created_at_ms","id") WHERE "junior_scheduler_tasks"."status" <> 'deleted' AND "junior_scheduler_tasks"."creator_identity_id" IS NOT NULL;--> statement-breakpoint
169
+ CREATE INDEX IF NOT EXISTS "junior_scheduler_tasks_team_status_idx" ON "junior_scheduler_tasks" USING btree ("team_id","created_at_ms","id") WHERE "junior_scheduler_tasks"."status" <> 'deleted';--> statement-breakpoint
170
+ CREATE INDEX IF NOT EXISTS "junior_scheduler_tasks_run_now_due_idx" ON "junior_scheduler_tasks" USING btree ("run_now_at_ms","created_at_ms","id") WHERE "junior_scheduler_tasks"."status" = 'active' AND "junior_scheduler_tasks"."run_now_at_ms" IS NOT NULL;--> statement-breakpoint
171
+ CREATE INDEX IF NOT EXISTS "junior_scheduler_tasks_next_run_due_idx" ON "junior_scheduler_tasks" USING btree ("next_run_at_ms","created_at_ms","id") WHERE "junior_scheduler_tasks"."status" = 'active' AND "junior_scheduler_tasks"."next_run_at_ms" IS NOT NULL;