@sentry/junior 0.306.0 → 0.307.1

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 (91) hide show
  1. package/dist/{adapter-context-CnY-i32r.js → adapter-context-HrBTD8rJ.js} +2 -2
  2. package/dist/{admin-BLLdLnXh.js → admin-B78_KmfR.js} +2 -2
  3. package/dist/{agent-runner-BaLjEjPR.js → agent-runner-DxivxUYd.js} +226 -137
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +4 -4
  6. package/dist/api.d.ts +1 -1
  7. package/dist/api.js +328 -298
  8. package/dist/{app-DvYbM9UD.d.ts → app-EZur8cVC.d.ts} +12 -3
  9. package/dist/app.d.ts +2 -2
  10. package/dist/app.js +84 -44
  11. package/dist/background-compaction-queue-HlljT9ql.js +231 -0
  12. package/dist/{briefs-DvyzXfrF.js → briefs-DR8mp-TK.js} +2 -2
  13. package/dist/{catalog-runtime-B1R-nHd3.js → catalog-runtime-Se9idiDR.js} +1 -1
  14. package/dist/cli/chat.d.ts +1 -1
  15. package/dist/cli/chat.js +17 -16
  16. package/dist/cli/check.js +58 -48
  17. package/dist/cli/main.js +3 -3
  18. package/dist/cli/plugins.d.ts +1 -1
  19. package/dist/cli/plugins.js +4 -4
  20. package/dist/cli/snapshot-create.js +5 -5
  21. package/dist/cli/upgrade.d.ts +2 -2
  22. package/dist/cli/upgrade.js +3 -8
  23. package/dist/{config-DUD-zMvp.js → config-DY5c1E0l.js} +74 -38
  24. package/dist/{connections-CDhsqPcC.js → connections-C-SqzubG.js} +10 -8
  25. package/dist/{continue-in-slack-BXQizz9o.js → continue-in-slack-DNkrrWuQ.js} +5 -5
  26. package/dist/{conversation-privacy-YE54gMN8.js → conversation-privacy-CVj9vSrP.js} +1 -1
  27. package/dist/{conversation-turn-BzdmrHb0.js → conversation-turn-CkzrIfJ2.js} +19 -47
  28. package/dist/{credential-sync-Cdm-e1vJ.js → credential-sync-B9CIkgOT.js} +28 -28
  29. package/dist/{db-DV2ZUb1Y.js → db-C21CyyTE.js} +140 -11
  30. package/dist/{db-pH357Dkt.d.ts → db-C41UgdBj.d.ts} +1 -1
  31. package/dist/{executor-CjNhwwnj.js → executor-DfNoVVGd.js} +93 -32
  32. package/dist/{install-DbD7C5td.js → install-lYZs8UCL.js} +2 -2
  33. package/dist/instrumentation.js +2 -2
  34. package/dist/{lineage-BFdIPb3o.js → lineage-BJTSY53A.js} +2 -2
  35. package/dist/{logging-oYpJYr-S.js → logging-DjW7LjgJ.js} +1 -1
  36. package/dist/{message-BBPcMKJY.js → message-BPPZpdoZ.js} +8 -8
  37. package/dist/{model-input-DYYF3a8B.js → model-input-DKqiLFGa.js} +3 -3
  38. package/dist/nitro.d.ts +2 -2
  39. package/dist/nitro.js +12 -5
  40. package/dist/{oauth-callback-server-C7Q987su.js → oauth-callback-server-OJP8Y4Ca.js} +2 -2
  41. package/dist/{oauth-relay-DAmfVmJu.js → oauth-relay-KwDz41Z3.js} +1 -1
  42. package/dist/{plugins-B_0Cr0MO.d.ts → plugins-fBrz8PCV.d.ts} +2 -0
  43. package/dist/{projection-CWXDE0f6.js → projection-D47mlszd.js} +1112 -693
  44. package/dist/{prompt-P3eRqO8C.js → prompt-DuWH_YIb.js} +3 -3
  45. package/dist/{registry-1pzXmplY.js → registry-yht0oxq6.js} +19 -9
  46. package/dist/{resolve-n87oXY-d.js → resolve-gZ-hVMYl.js} +3 -3
  47. package/dist/{result-BmF9v9bv.js → result-CP99Ok0_.js} +13 -11
  48. package/dist/{runner-4j7ZsxP5.js → runner-eVlnUkY7.js} +9 -9
  49. package/dist/{sandbox-egress-signals-BRQI8HvT.js → sandbox-egress-signals-DZL_0lnG.js} +1 -1
  50. package/dist/{schedule-CHPWQn-x.js → schedule-BG1tEbRF.js} +34 -4
  51. package/dist/{schema-CVbIjrF3.d.ts → schema-CRXcj4fj.d.ts} +350 -143
  52. package/dist/{schema-D7iIEh6t.js → schema-D4jdesIu.js} +12 -4
  53. package/dist/{service-account-DzQiOmqa.js → service-account-CZneZHh7.js} +8 -6
  54. package/dist/{service-account-BDQ9xzta.js → service-account-tI3LBg2_.js} +3 -3
  55. package/dist/{session-stop-BQxgHR4X.js → session-stop-D3S7mSkX.js} +36 -23
  56. package/dist/{skills-CPf4vNuC.js → skills-Bm6uSO9V.js} +32 -28
  57. package/dist/{slack-conversation-unfurl-B1KEptUg.js → slack-conversation-unfurl-BeBvg3xU.js} +10 -10
  58. package/dist/{spawn-CjGddiAU.js → spawn-vhMAmLuh.js} +6 -6
  59. package/dist/{state-9wfj6aSD.js → state-3Yiy2FvP.js} +4 -4
  60. package/dist/{stop-CsQGuN5n.js → stop-Bh53GUoX.js} +146 -158
  61. package/dist/{store-Dz3YZ7gQ.js → store-BZJdHYR7.js} +5 -5
  62. package/dist/{background-compaction-queue-D2wzxtGU.js → task-queue-BEl5G38v.js} +164 -180
  63. package/dist/{task-runner-frzlUvFD.js → task-runner-C6Bujc6h.js} +11 -8
  64. package/dist/{thread-context-C4QuZlM8.js → thread-context-DxMQGGd_.js} +6 -6
  65. package/dist/{turn-session-routing-BXaubz2w.js → turn-session-routing-CmQY0T60.js} +24 -5
  66. package/dist/{turn-user-message-DNC0eRZ7.js → turn-user-message-Dfbr3Ud9.js} +3 -3
  67. package/dist/{users-XCCKn3xW.js → users-6rSdqXXk.js} +1 -1
  68. package/dist/{validation-L5fdjmFX.js → validation--hsjOLRL.js} +1 -1
  69. package/dist/{version-BFmuwgxP.js → version-9iMT25Hq.js} +1 -1
  70. package/dist/version.js +1 -1
  71. package/dist/{viewer-DKOeHpv3.js → viewer-De1vmuEA.js} +3 -3
  72. package/dist/{warmup-mTMIatCV.js → warmup-C0IblNtf.js} +596 -281
  73. package/dist/{web-message-id-CUaSiGme.js → web-message-id-BT8Mg8LL.js} +1 -1
  74. package/dist/{worker-Bz4KNxjI.js → worker-CiyRr2q7.js} +8 -7
  75. package/migrations/0115_automation_creator_slack_index.sql +1 -0
  76. package/migrations/0116_conversation_event_search.sql +25 -0
  77. package/migrations/0117_automation_last_run.sql +46 -0
  78. package/migrations/0118_automation_last_run_index.sql +1 -0
  79. package/migrations/0119_money_micro_usd.sql +29 -0
  80. package/migrations/0120_conversation_cost_micro_usd.sql +8 -0
  81. package/migrations/meta/0115_snapshot.json +5225 -0
  82. package/migrations/meta/0116_snapshot.json +5388 -0
  83. package/migrations/meta/0117_snapshot.json +5413 -0
  84. package/migrations/meta/0118_snapshot.json +5428 -0
  85. package/migrations/meta/0119_snapshot.json +5441 -0
  86. package/migrations/meta/0120_snapshot.json +5441 -0
  87. package/migrations/meta/_journal.json +42 -0
  88. package/package.json +10 -9
  89. package/dist/queue-7FSijgqG.js +0 -115
  90. package/dist/secrets-DHaJ5TTn.js +0 -18
  91. package/dist/task-queue-CFlrJguF.js +0 -89
@@ -415,4 +415,4 @@ async function webMessageId(args) {
415
415
  const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(`${args.conversationId}\u0000${args.idempotencyKey}`));
416
416
  return `api-msg:${Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("").slice(0, 24)}`;
417
417
  }
418
- export { HOUR_MS as A, utcHourKey as B, AGENT_MESSAGE_EVENT_TYPE as C, isAgentInvocationResultEventType as D, agentInvocationResultEventType as E, sumUtcHoursIntoSixHours as F, trailingUtcDayWindow as I, trailingUtcHourWindow as L, fillUtcHours as M, fillUtcSixHours as N, apiErrorSchema as O, startOfUtcHour as P, trailingUtcSixHourWindow as R, AGENT_INVOCATION_EVENT_NAMESPACE as S, AGENT_REPLY_EVENT_TYPE as T, userCustomizationSchema as _, USER_INPUT_LIMITS as a, SELF_PLAN_ASSIGNEE as b, formatUserInputAnswer as c, userInputRequestSchema as d, INLINE_VIDEO_TYPES as f, USER_CUSTOMIZATION_MAX_CHARS as g, isVisionImageMediaType as h, AGENT_INVOCATION_STATUSES as i, fillUtcDays as j, DAY_MS as k, isEmptyUserInputAnswer as l, detectImageMediaType as m, AGENT_INVOCATION_MAILBOX_STATUSES as n, USER_INPUT_NOTE as o, INPUT_IMAGE_TYPES as p, AGENT_INVOCATION_PARENT_MAILBOX_STATUSES as r, buttonUserInputField as s, webMessageId as t, normalizeUserInputAnswer as u, userCustomizationTextSchema as v, AGENT_PARENT_MESSAGE_EVENT_TYPE as w, isOpenPlanItemStatus as x, PLAN_ITEM_STATUSES as y, utcDayKey as z };
418
+ export { HOUR_MS as A, AGENT_MESSAGE_EVENT_TYPE as C, isAgentInvocationResultEventType as D, agentInvocationResultEventType as E, sumUtcHoursIntoSixHours as F, trailingUtcDayWindow as I, trailingUtcHourWindow as L, fillUtcHours as M, fillUtcSixHours as N, apiErrorSchema as O, startOfUtcHour as P, trailingUtcSixHourWindow as R, AGENT_INVOCATION_EVENT_NAMESPACE as S, AGENT_REPLY_EVENT_TYPE as T, userCustomizationSchema as _, USER_INPUT_LIMITS as a, SELF_PLAN_ASSIGNEE as b, formatUserInputAnswer as c, userInputRequestSchema as d, INLINE_VIDEO_TYPES as f, USER_CUSTOMIZATION_MAX_CHARS as g, isVisionImageMediaType as h, AGENT_INVOCATION_STATUSES as i, fillUtcDays as j, DAY_MS as k, isEmptyUserInputAnswer as l, detectImageMediaType as m, AGENT_INVOCATION_MAILBOX_STATUSES as n, USER_INPUT_NOTE as o, INPUT_IMAGE_TYPES as p, AGENT_INVOCATION_PARENT_MAILBOX_STATUSES as r, buttonUserInputField as s, webMessageId as t, normalizeUserInputAnswer as u, userCustomizationTextSchema as v, AGENT_PARENT_MESSAGE_EVENT_TYPE as w, isOpenPlanItemStatus as x, PLAN_ITEM_STATUSES as y, utcHourKey as z };
@@ -1,11 +1,12 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { Mt as isInvalidConversationRecordError, jt as isFinalAttempt, kt as hasConversationStop, xt as countPendingConversationMessages } from "./projection-CWXDE0f6.js";
3
- import { i as getChatConfig, ot as isProviderRetryError } from "./config-DUD-zMvp.js";
4
- import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-oYpJYr-S.js";
5
- import { t as getConversationStoppedAtMs } from "./session-stop-BQxgHR4X.js";
6
- import { _ as nudgeIdempotencyKey, m as ConversationQueueMessageRejectedError, p as getTurnRequestDeadline } from "./background-compaction-queue-D2wzxtGU.js";
7
- import { C as requestAnotherSlice, S as releaseConversationWork, T as startConversationWork, _ as getConversationWorkState, b as recordAttemptFailure, c as clearConsumedConversationWake, d as completeConversationWork, f as deadLetterAttempt, h as ensureConversationWake, i as beginConversationResume, o as checkInConversationWork, p as drainConversationMailbox, t as ackMessages, u as completeConversationStop, x as recordConversationRetry } from "./store-Dz3YZ7gQ.js";
8
- import { Fn as isAttemptInterrupt, In as selectAttemptMessages } from "./warmup-mTMIatCV.js";
2
+ import { Mt as isInvalidConversationRecordError, jt as isFinalAttempt, kt as hasConversationStop, xt as countPendingConversationMessages } from "./projection-D47mlszd.js";
3
+ import { i as getChatConfig, ot as isProviderRetryError } from "./config-DY5c1E0l.js";
4
+ import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-DjW7LjgJ.js";
5
+ import { t as getConversationStoppedAtMs } from "./session-stop-D3S7mSkX.js";
6
+ import { g as getTurnRequestDeadline } from "./task-queue-BEl5G38v.js";
7
+ import { _ as ConversationQueueMessageRejectedError, b as nudgeIdempotencyKey } from "./background-compaction-queue-HlljT9ql.js";
8
+ import { C as requestAnotherSlice, S as releaseConversationWork, T as startConversationWork, _ as getConversationWorkState, b as recordAttemptFailure, c as clearConsumedConversationWake, d as completeConversationWork, f as deadLetterAttempt, h as ensureConversationWake, i as beginConversationResume, o as checkInConversationWork, p as drainConversationMailbox, t as ackMessages, u as completeConversationStop, x as recordConversationRetry } from "./store-BZJdHYR7.js";
9
+ import { In as isAttemptInterrupt, Ln as selectAttemptMessages } from "./warmup-C0IblNtf.js";
9
10
  // src/chat/task-execution/lost-lease.ts
10
11
  /**
11
12
  * Count a slice that lost its Conversation Lease as a failed attempt, then
@@ -0,0 +1 @@
1
+ CREATE INDEX CONCURRENTLY IF NOT EXISTS "junior_automations_creator_slack_idx" ON "junior_automations" USING btree ("team_id","creator_slack_user_id") WHERE "junior_automations"."status" <> 'deleted';
@@ -0,0 +1,25 @@
1
+ CREATE TABLE "junior_conversation_event_embeddings" (
2
+ "conversation_id" text NOT NULL,
3
+ "seq" integer NOT NULL,
4
+ "provider" text NOT NULL,
5
+ "model" text NOT NULL,
6
+ "dimensions" integer NOT NULL,
7
+ "embedding" halfvec NOT NULL,
8
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
9
+ CONSTRAINT "junior_conversation_event_embeddings_pk" PRIMARY KEY("conversation_id","seq"),
10
+ CONSTRAINT "junior_conversation_event_embeddings_dimensions_check" CHECK (vector_dims("junior_conversation_event_embeddings"."embedding") = "junior_conversation_event_embeddings"."dimensions")
11
+ );
12
+ --> statement-breakpoint
13
+ -- Keep each 2 KB vector in its row: the exact scan of a Conversation then reads no TOAST.
14
+ ALTER TABLE "junior_conversation_event_embeddings" ALTER COLUMN "embedding" SET STORAGE MAIN;--> statement-breakpoint
15
+ CREATE TABLE "junior_conversation_event_lexemes" (
16
+ "conversation_id" text NOT NULL,
17
+ "seq" integer NOT NULL,
18
+ "lexemes" "tsvector" NOT NULL,
19
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
20
+ CONSTRAINT "junior_conversation_event_lexemes_pk" PRIMARY KEY("conversation_id","seq")
21
+ );
22
+ --> statement-breakpoint
23
+ ALTER TABLE "junior_conversation_event_embeddings" ADD CONSTRAINT "junior_conversation_event_embeddings_event_fk" FOREIGN KEY ("conversation_id","seq") REFERENCES "public"."junior_conversation_events"("conversation_id","seq") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
24
+ ALTER TABLE "junior_conversation_event_lexemes" ADD CONSTRAINT "junior_conversation_event_lexemes_event_fk" FOREIGN KEY ("conversation_id","seq") REFERENCES "public"."junior_conversation_events"("conversation_id","seq") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
25
+ CREATE INDEX "junior_conversation_event_lexemes_lexemes_idx" ON "junior_conversation_event_lexemes" USING gin ("lexemes");
@@ -0,0 +1,46 @@
1
+ ALTER TABLE "junior_automation_runs" ADD COLUMN "cost_micro_usd" bigint;--> statement-breakpoint
2
+ ALTER TABLE "junior_automations" ADD COLUMN "last_run_id" text;--> statement-breakpoint
3
+ -- Every row has a null last_run_id here. NOT VALID skips the scan under lock
4
+ -- and still checks every new write.
5
+ ALTER TABLE "junior_automations" ADD CONSTRAINT "junior_automations_last_run_id_junior_automation_runs_id_fk" FOREIGN KEY ("last_run_id") REFERENCES "public"."junior_automation_runs"("id") ON DELETE set null ON UPDATE no action NOT VALID;--> statement-breakpoint
6
+ -- The list orders by the end of this run and finds failed last runs through
7
+ -- it, and each new run write refreshes it. A run that the old runtime writes
8
+ -- during the rollout leaves an older run until that Automation runs again.
9
+ -- junior:bounded-backfill: one row per listed Automation, and each row reads one index range of its runs; deleted Automations are skipped because no list shows them.
10
+ UPDATE "junior_automations"
11
+ SET "last_run_id" = (
12
+ SELECT "id"
13
+ FROM "junior_automation_runs"
14
+ WHERE "junior_automation_runs"."automation_id" = "junior_automations"."id"
15
+ AND "junior_automation_runs"."status" IN ('blocked', 'completed', 'failed')
16
+ AND "junior_automation_runs"."completed_at_ms" IS NOT NULL
17
+ ORDER BY "completed_at_ms" DESC, "id" DESC
18
+ LIMIT 1
19
+ )
20
+ WHERE "status" <> 'deleted';--> statement-breakpoint
21
+ -- Automation cost totals sum this column, in micro-USD. Each usage write of a
22
+ -- Conversation copies its cost to its run, and each run write copies it when
23
+ -- it links the Conversation. This matches costMicroUsdExpr.
24
+ -- junior:bounded-backfill: settled runs only, which no app write changes; each row reads its own Conversation by primary key.
25
+ UPDATE "junior_automation_runs"
26
+ SET "cost_micro_usd" = (
27
+ SELECT round(CASE
28
+ WHEN "usage_json"->'cost'->>'total' IS NOT NULL
29
+ THEN ("usage_json"->'cost'->>'total')::double precision
30
+ WHEN COALESCE(
31
+ "usage_json"->'cost'->>'input',
32
+ "usage_json"->'cost'->>'output',
33
+ "usage_json"->'cost'->>'cacheRead',
34
+ "usage_json"->'cost'->>'cacheWrite'
35
+ ) IS NOT NULL
36
+ THEN COALESCE(("usage_json"->'cost'->>'input')::double precision, 0)
37
+ + COALESCE(("usage_json"->'cost'->>'output')::double precision, 0)
38
+ + COALESCE(("usage_json"->'cost'->>'cacheRead')::double precision, 0)
39
+ + COALESCE(("usage_json"->'cost'->>'cacheWrite')::double precision, 0)
40
+ ELSE NULL
41
+ END * 1000000)::bigint
42
+ FROM "junior_conversations"
43
+ WHERE "junior_conversations"."conversation_id" = "junior_automation_runs"."conversation_id"
44
+ )
45
+ WHERE "conversation_id" IS NOT NULL
46
+ AND "status" IN ('blocked', 'completed', 'failed', 'skipped');
@@ -0,0 +1 @@
1
+ CREATE INDEX CONCURRENTLY IF NOT EXISTS "junior_automations_last_run_idx" ON "junior_automations" USING btree ("last_run_id");
@@ -0,0 +1,29 @@
1
+ ALTER TABLE "junior_conversation_briefs" ADD COLUMN "cost_micro_usd" bigint;--> statement-breakpoint
2
+ ALTER TABLE "junior_stats" ADD COLUMN "value" bigint DEFAULT 0 NOT NULL;--> statement-breakpoint
3
+ -- Money in Postgres is whole micro-USD. The runtime before this release writes
4
+ -- `cost_usd` until its rollout ends; a later repair migration converts those
5
+ -- rows, and the release after it drops the column.
6
+ -- junior:bounded-backfill: Brief versions are append-only, so no app write changes these rows; only a cascade delete of a Conversation waits.
7
+ UPDATE "junior_conversation_briefs"
8
+ SET "cost_micro_usd" = round("cost_usd" * 1000000)::bigint
9
+ WHERE "cost_usd" IS NOT NULL;--> statement-breakpoint
10
+ -- Counters move to the bigint `value`, so a micro-USD counter does not
11
+ -- overflow int4. Cache warming dollar counters stored 1/10,000 USD units, so
12
+ -- 100 micro-USD each. `count` goes to 0, so the repair migration can move the
13
+ -- amounts that the runtime before this release adds to it during the rollout.
14
+ -- junior:bounded-backfill: the table holds a few hundred counters per day and runs last, so app counter writes wait only for one short update.
15
+ UPDATE "junior_stats"
16
+ SET
17
+ "metric" = CASE
18
+ WHEN "namespace" = 'cache_warming'
19
+ AND "metric" IN ('oracle_savings', 'saved', 'unwarmed_oracle_savings', 'warmup_cost')
20
+ THEN "metric" || '_micro_usd'
21
+ ELSE "metric"
22
+ END,
23
+ "value" = CASE
24
+ WHEN "namespace" = 'cache_warming'
25
+ AND "metric" IN ('oracle_savings', 'saved', 'unwarmed_oracle_savings', 'warmup_cost')
26
+ THEN "count"::bigint * 100
27
+ ELSE "count"
28
+ END,
29
+ "count" = 0;
@@ -0,0 +1,8 @@
1
+ -- Run cost metrics move to whole micro-USD in the same double `value`, which
2
+ -- holds every integer up to 2^53 exactly. The runtime before this release
3
+ -- writes `cost_usd` rows until its rollout ends; a later repair migration
4
+ -- converts those rows. This matches usdToMicroUsdSql.
5
+ -- junior:bounded-backfill: one cost row per Run, and the app rewrites the rows of a Run only while it runs, so only Runs in progress wait for this update.
6
+ UPDATE "junior_conversation_metrics"
7
+ SET "metric" = 'cost_micro_usd', "value" = round("value" * 1000000)
8
+ WHERE "metric" = 'cost_usd';