@sentry/junior 0.301.0 → 0.303.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/adapter-context-BdVnSuY5.js +43 -0
- package/dist/{admin-CRJHvCGg.js → admin-AfeAdS3J.js} +2 -2
- package/dist/{agent-runner-H4YhvNBj.js → agent-runner-BP8_DLUv.js} +4688 -13870
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +7 -8
- package/dist/api.d.ts +13 -12
- package/dist/api.js +268 -118
- package/dist/{app-HDZglaIu.d.ts → app-Dd9v1mNx.d.ts} +15 -15
- package/dist/app.d.ts +1 -1
- package/dist/app.js +99 -330
- package/dist/{automation-Cva5ZOwW.js → automation-D9MvhOWY.js} +3 -1
- package/dist/{background-compaction-queue-CNrZ3QcU.js → background-compaction-queue-xaE05jxH.js} +97 -206
- package/dist/{briefs-x6Mzwxmg.js → briefs-D8i-dKTp.js} +4 -4
- package/dist/{catalog-runtime-BEY6EGRi.js → catalog-runtime-d1EM6Z0V.js} +2 -2
- package/dist/cli/chat.d.ts +1 -1
- package/dist/cli/chat.js +21 -21
- package/dist/cli/check.js +8 -8
- package/dist/cli/env.d.ts +1 -0
- package/dist/cli/env.js +8 -7
- package/dist/cli/init.js +13 -4
- package/dist/cli/main.js +4 -4
- package/dist/cli/plugins.js +6 -6
- package/dist/cli/snapshot-create.js +7 -5
- package/dist/cli/upgrade.d.ts +2 -2
- package/dist/cli/upgrade.js +5 -5
- package/dist/{config-CmjhyqgB.js → config-oGM7KA9M.js} +44 -63
- package/dist/{connections-CfIRm0xv.js → connections-BlikzEJv.js} +6 -6
- package/dist/{continue-in-slack-DPoABVkB.js → continue-in-slack-BZnYifiG.js} +5 -6
- package/dist/{conversation-BNXfq6Lb.js → conversation-CY1jnBiC.js} +1 -1
- package/dist/{conversation-feed-CfpyFMHP.js → conversation-feed-BZJRk6UV.js} +2 -1
- package/dist/{conversation-privacy-0CM0V2qK.js → conversation-privacy-Cx515ddM.js} +7 -7
- package/dist/{conversation-turn-C0sxyvS-.js → conversation-turn-DAhRdX4m.js} +20 -24
- package/dist/{credential-sync-tEMKZ_8M.js → credential-sync-DfhmWFeo.js} +18 -20
- package/dist/{db-Czra10QW.js → db-C-2tFxk3.js} +326 -17
- package/dist/{db-BdUHQhrC.d.ts → db-DPqcEM9_.d.ts} +25 -25
- package/dist/{executor-D_023K0H.js → executor-NVfS8aQ2.js} +51 -10
- package/dist/{history-IjdmO_r6.js → history-UZ3M2M9r.js} +13 -10
- package/dist/install-CHLrpRZc.js +228 -0
- package/dist/instrumentation.d.ts +4 -4
- package/dist/instrumentation.js +10 -10
- package/dist/{lineage-DmMIE0VL.js → lineage-HGLhd_-N.js} +2 -2
- package/dist/{logging-DcjLDDqi.js → logging-DiyqRLBx.js} +24 -20
- package/dist/{message-C0JY9RJP.js → message-CkCOcbFH.js} +9 -9
- package/dist/{model-input-CBp-p24N.js → model-input-DmoPPtPE.js} +5 -10
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +7 -6
- package/dist/{oauth-callback-server-BRq9QNhU.js → oauth-callback-server-CIf_6YmA.js} +5 -4
- package/dist/{oauth-relay-DRzq73b6.js → oauth-relay-DAmfVmJu.js} +3 -6
- package/dist/{package-discovery-DJhGdS4c.js → package-discovery-x4AvVhMj.js} +1 -1
- package/dist/{plugin-module-Cf5gVPWP.js → plugin-module-Cv2ETe8Y.js} +1 -1
- package/dist/{plugins-BBX07Jzt.js → plugins-Bkk0XRo2.js} +3 -3
- package/dist/{projection-CQNDOi82.js → projection-DBq8tsA5.js} +489 -223
- package/dist/{prompt-DLUB5m72.js → prompt-D2KlJopL.js} +15 -5
- package/dist/{queue-CZyYgPF0.d.ts → queue-CbEHUO0l.d.ts} +1 -1
- package/dist/queue-DFaOscp5.js +115 -0
- package/dist/{registry-Dj377ADs.js → registry-Bu0Z9BEO.js} +37 -37
- package/dist/{resolve-DJkh9Fky.js → resolve-DXuA3G0g.js} +4 -229
- package/dist/{result-C8iIpDl1.js → result-DpiNseDA.js} +11 -16
- package/dist/rolldown-runtime-BKpuH2hG.js +26 -0
- package/dist/{runner-DZqrOy8C.js → runner-iu1heRFv.js} +10 -10
- package/dist/{sandbox-egress-signals-CGwH86S9.js → sandbox-egress-signals-2HFYDcQf.js} +1 -1
- package/dist/{schema-CdZFn7Qd.d.ts → schema-DHMOaRzC.d.ts} +959 -41
- package/dist/{schema-DyHXiQKI.js → schema-DvfX3Gq_.js} +141 -40
- package/dist/{secrets-DebYU866.js → secrets-DHaJ5TTn.js} +4 -4
- package/dist/{sentry-BRTJqumy.js → sentry-CPbZjomA.js} +3 -28
- package/dist/{sentry-route-name-BhwWnfqj.js → sentry-route-name-C6EIzAGP.js} +1 -1
- package/dist/{service-account-suY004dx.js → service-account-BcT5LR7V.js} +271 -20
- package/dist/{service-account-D6jGR4a1.js → service-account-xYkaQTrw.js} +3 -3
- package/dist/{session-stop-BLmfFI3d.js → session-stop-BLLp1IP_.js} +1098 -1110
- package/dist/{skills-CmNG0dHb.js → skills-CNAGH4ju.js} +6 -9
- package/dist/{slack-conversation-unfurl-Bty-DlHe.js → slack-conversation-unfurl-DYnqe5ci.js} +10 -14
- package/dist/{spawn-CNjkpXpk.js → spawn-cGasWW33.js} +7 -7
- package/dist/{state-CEbZuZD6.js → state-CDS6h_Wv.js} +34 -5
- package/dist/{stop-Bjy2-K4H.js → stop-DMMA67yT.js} +896 -196
- package/dist/{store-DmV4CoNr.js → store-Dgs7Oe44.js} +5 -5
- package/dist/{task-queue-AhG1tSXR.js → task-queue-DcF0nhhz.js} +3 -3
- package/dist/{task-runner-BMxZI3o7.js → task-runner-BGXF7Fo7.js} +15 -20
- package/dist/{thread-context-CXLnbg7g.js → thread-context-BPky1KBe.js} +12 -12
- package/dist/{store-Epv6t4vV.js → turn-session-routing-DGvn9MSl.js} +384 -13
- package/dist/{turn-user-message-DsUZi9gn.js → turn-user-message-19CkuUvM.js} +3 -3
- package/dist/{validation-DOz8X9BU.js → validation-lu1DgjNQ.js} +2 -2
- package/dist/vercel.js +1 -1
- package/dist/{version-CGMRmMPK.js → version-Uo3c94Dx.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-H3EsMWtJ.js → viewer-BPQHMx3-.js} +3 -3
- package/dist/warmup-H8uLvW9e.js +13946 -0
- package/dist/{statuses-Hn-HsOph.js → web-message-id-lNodcCOI.js} +136 -1
- package/dist/{worker-ClphajjD.js → worker-B-pM_-3K.js} +9 -12
- package/migrations/0108_conversation_embeddings.sql +13 -0
- package/migrations/0109_user_preferences.sql +1 -0
- package/migrations/0110_code_change_repository_state_index.sql +1 -0
- package/migrations/meta/0108_snapshot.json +4688 -0
- package/migrations/meta/0109_snapshot.json +4925 -0
- package/migrations/meta/0110_snapshot.json +4952 -0
- package/migrations/meta/_journal.json +22 -1
- package/package.json +16 -17
- package/dist/adapter-CNjGEJO9.js +0 -303
- package/dist/reporting-window-DopzcOHh.js +0 -137
- package/dist/turn-session-routing-BD3-jJl7.js +0 -380
- package/dist/users-BxvYclQg.js +0 -424
- package/dist/warmup-CdU5hR49.js +0 -3715
|
@@ -1,4 +1,130 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
+
// src/api/reporting-window.ts
|
|
3
|
+
/** Shared UTC day/hour/six-hour windows for dashboard activity series. */
|
|
4
|
+
const HOUR_MS = 36e5;
|
|
5
|
+
const SIX_HOUR_MS = 6 * HOUR_MS;
|
|
6
|
+
const DAY_MS = 24 * HOUR_MS;
|
|
7
|
+
/** Start of the UTC calendar day containing `valueMs`. */
|
|
8
|
+
function startOfUtcDay(valueMs) {
|
|
9
|
+
const date = new Date(valueMs);
|
|
10
|
+
date.setUTCHours(0, 0, 0, 0);
|
|
11
|
+
return date;
|
|
12
|
+
}
|
|
13
|
+
/** Start of the UTC hour containing `valueMs`. */
|
|
14
|
+
function startOfUtcHour(valueMs) {
|
|
15
|
+
const date = new Date(valueMs);
|
|
16
|
+
date.setUTCMinutes(0, 0, 0);
|
|
17
|
+
return date;
|
|
18
|
+
}
|
|
19
|
+
/** Start of the UTC 6-hour bucket containing `valueMs` (00/06/12/18). */
|
|
20
|
+
function startOfUtcSixHour(valueMs) {
|
|
21
|
+
const date = startOfUtcHour(valueMs);
|
|
22
|
+
date.setUTCHours(Math.floor(date.getUTCHours() / 6) * 6, 0, 0, 0);
|
|
23
|
+
return date;
|
|
24
|
+
}
|
|
25
|
+
/** UTC day key `YYYY-MM-DD`. */
|
|
26
|
+
function utcDayKey(value) {
|
|
27
|
+
return (typeof value === "number" ? new Date(value) : value).toISOString().slice(0, 10);
|
|
28
|
+
}
|
|
29
|
+
/** UTC hour key `YYYY-MM-DDTHH`. */
|
|
30
|
+
function utcHourKey(value) {
|
|
31
|
+
return (typeof value === "number" ? new Date(value) : value).toISOString().slice(0, 13);
|
|
32
|
+
}
|
|
33
|
+
/** UTC 6-hour bucket key `YYYY-MM-DDTHH` at 00/06/12/18. */
|
|
34
|
+
function utcSixHourKey(value) {
|
|
35
|
+
return utcHourKey(startOfUtcSixHour(typeof value === "number" ? value : value.getTime()));
|
|
36
|
+
}
|
|
37
|
+
/** Inclusive trailing UTC day window ending on today's UTC day. */
|
|
38
|
+
function trailingUtcDayWindow(nowMs, dayCount) {
|
|
39
|
+
const end = startOfUtcDay(nowMs);
|
|
40
|
+
const start = new Date(end);
|
|
41
|
+
start.setUTCDate(start.getUTCDate() - (dayCount - 1));
|
|
42
|
+
return {
|
|
43
|
+
end,
|
|
44
|
+
start
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/** Inclusive trailing UTC hour window ending on the current UTC hour. */
|
|
48
|
+
function trailingUtcHourWindow(nowMs, hourCount = 24) {
|
|
49
|
+
const end = startOfUtcHour(nowMs);
|
|
50
|
+
return {
|
|
51
|
+
end,
|
|
52
|
+
start: /* @__PURE__ */ new Date(end.getTime() - (hourCount - 1) * HOUR_MS)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** Inclusive trailing UTC 6-hour window ending on the current 6h bucket. */
|
|
56
|
+
function trailingUtcSixHourWindow(nowMs, bucketCount = 28) {
|
|
57
|
+
const end = startOfUtcSixHour(nowMs);
|
|
58
|
+
return {
|
|
59
|
+
end,
|
|
60
|
+
start: /* @__PURE__ */ new Date(end.getTime() - (bucketCount - 1) * SIX_HOUR_MS)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** Fill a fixed UTC day window from a sparse map. */
|
|
64
|
+
function fillUtcDays(args) {
|
|
65
|
+
const { end, start } = trailingUtcDayWindow(args.nowMs, args.count);
|
|
66
|
+
const items = [];
|
|
67
|
+
for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setUTCDate(cursor.getUTCDate() + 1)) {
|
|
68
|
+
const date = utcDayKey(cursor);
|
|
69
|
+
items.push(args.rows.get(date) ?? args.empty(date));
|
|
70
|
+
}
|
|
71
|
+
return items;
|
|
72
|
+
}
|
|
73
|
+
/** Fill a fixed UTC hour window from a sparse map. */
|
|
74
|
+
function fillUtcHours(args) {
|
|
75
|
+
const hourCount = args.count ?? 24;
|
|
76
|
+
const { end, start } = trailingUtcHourWindow(args.nowMs, hourCount);
|
|
77
|
+
const items = [];
|
|
78
|
+
for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setTime(cursor.getTime() + HOUR_MS)) {
|
|
79
|
+
const date = utcHourKey(cursor);
|
|
80
|
+
items.push(args.rows.get(date) ?? args.empty(date));
|
|
81
|
+
}
|
|
82
|
+
return items;
|
|
83
|
+
}
|
|
84
|
+
/** Fill a fixed UTC 6-hour window from a map of known rows. */
|
|
85
|
+
function fillUtcSixHours(args) {
|
|
86
|
+
const bucketCount = args.count ?? 28;
|
|
87
|
+
const { end, start } = trailingUtcSixHourWindow(args.nowMs, bucketCount);
|
|
88
|
+
const items = [];
|
|
89
|
+
for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setTime(cursor.getTime() + SIX_HOUR_MS)) {
|
|
90
|
+
const date = utcSixHourKey(cursor);
|
|
91
|
+
items.push(args.rows.get(date) ?? args.empty(date));
|
|
92
|
+
}
|
|
93
|
+
return items;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Sum hour rows into trailing 6-hour buckets.
|
|
97
|
+
* Adds number fields. Keeps other fields from the first row in the bucket.
|
|
98
|
+
* Sets `date` to the 6-hour bucket key.
|
|
99
|
+
*/
|
|
100
|
+
function sumUtcHoursIntoSixHours(args) {
|
|
101
|
+
const bucketCount = args.count ?? 28;
|
|
102
|
+
const bySix = /* @__PURE__ */ new Map();
|
|
103
|
+
for (const hour of args.hours) {
|
|
104
|
+
const key = utcSixHourKey(Date.parse(`${hour.date}:00:00.000Z`));
|
|
105
|
+
const next = {
|
|
106
|
+
...bySix.get(key) ?? args.empty(key),
|
|
107
|
+
date: key
|
|
108
|
+
};
|
|
109
|
+
for (const [field, value] of Object.entries(hour)) {
|
|
110
|
+
if (field === "date") continue;
|
|
111
|
+
if (typeof value === "number") {
|
|
112
|
+
const prior = next[field];
|
|
113
|
+
next[field] = (typeof prior === "number" ? prior : 0) + value;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
bySix.set(key, next);
|
|
117
|
+
}
|
|
118
|
+
return fillUtcSixHours({
|
|
119
|
+
count: bucketCount,
|
|
120
|
+
empty: args.empty,
|
|
121
|
+
nowMs: args.nowMs,
|
|
122
|
+
rows: bySix
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
// src/api/schema/common.ts
|
|
126
|
+
/** Stable error body returned by Junior-owned REST endpoints. */
|
|
127
|
+
const apiErrorSchema = z.object({ error: z.string().min(1) }).strict();
|
|
2
128
|
// src/chat/agent-invocations/result-event-type.ts
|
|
3
129
|
/** Event namespace of the messages between a parent and its child agents. */
|
|
4
130
|
const AGENT_INVOCATION_EVENT_NAMESPACE = "junior";
|
|
@@ -265,4 +391,13 @@ const AGENT_INVOCATION_PARENT_MAILBOX_STATUSES = [
|
|
|
265
391
|
"skipped",
|
|
266
392
|
"steered"
|
|
267
393
|
];
|
|
268
|
-
|
|
394
|
+
// src/chat/conversations/web-message-id.ts
|
|
395
|
+
/**
|
|
396
|
+
* Build the retry-stable Message id shared by web ingress and browser sends.
|
|
397
|
+
* Keep the existing hash and prefix so retries still address stored Messages.
|
|
398
|
+
*/
|
|
399
|
+
async function webMessageId(args) {
|
|
400
|
+
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(`${args.conversationId}\u0000${args.idempotencyKey}`));
|
|
401
|
+
return `api-msg:${Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("").slice(0, 24)}`;
|
|
402
|
+
}
|
|
403
|
+
export { fillUtcSixHours as A, agentInvocationResultEventType as C, HOUR_MS as D, DAY_MS as E, trailingUtcSixHourWindow as F, utcDayKey as I, utcHourKey as L, sumUtcHoursIntoSixHours as M, trailingUtcDayWindow as N, fillUtcDays as O, trailingUtcHourWindow as P, AGENT_REPLY_EVENT_TYPE as S, apiErrorSchema as T, userCustomizationSchema as _, USER_INPUT_LIMITS as a, AGENT_MESSAGE_EVENT_TYPE 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, startOfUtcHour as j, fillUtcHours 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, isAgentInvocationResultEventType as w, AGENT_PARENT_MESSAGE_EVENT_TYPE as x, AGENT_INVOCATION_EVENT_NAMESPACE as y };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Ct as countPendingConversationMessages, Nt as isFinalAttempt, Pt as isInvalidConversationRecordError, jt as hasConversationStop } from "./projection-
|
|
3
|
-
import { i as getChatConfig, q as isProviderRetryError } from "./config-
|
|
4
|
-
import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-
|
|
5
|
-
import { t as getConversationStoppedAtMs } from "./session-stop-
|
|
6
|
-
import {
|
|
7
|
-
import { T as
|
|
8
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
+
import { Ct as countPendingConversationMessages, Nt as isFinalAttempt, Pt as isInvalidConversationRecordError, jt as hasConversationStop } from "./projection-DBq8tsA5.js";
|
|
3
|
+
import { i as getChatConfig, q as isProviderRetryError } from "./config-oGM7KA9M.js";
|
|
4
|
+
import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-DiyqRLBx.js";
|
|
5
|
+
import { t as getConversationStoppedAtMs } from "./session-stop-BLLp1IP_.js";
|
|
6
|
+
import { _ as nudgeIdempotencyKey, m as ConversationQueueMessageRejectedError, p as getTurnRequestDeadline } from "./background-compaction-queue-xaE05jxH.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-Dgs7Oe44.js";
|
|
8
|
+
import { Bn as isAttemptInterrupt, Vn as selectAttemptMessages } from "./warmup-H8uLvW9e.js";
|
|
9
9
|
// src/chat/task-execution/lost-lease.ts
|
|
10
10
|
/**
|
|
11
11
|
* Count a slice that lost its Conversation Lease as a failed attempt, then
|
|
@@ -59,10 +59,7 @@ async function requestLostLeaseRecovery(args) {
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
// src/chat/task-execution/worker.ts
|
|
62
|
-
var worker_exports = /* @__PURE__ */ __exportAll({
|
|
63
|
-
CONVERSATION_WORK_DEFER_DELAY_MS: () => CONVERSATION_WORK_DEFER_DELAY_MS,
|
|
64
|
-
processConversationWork: () => processConversationWork
|
|
65
|
-
});
|
|
62
|
+
var worker_exports = /* @__PURE__ */ __exportAll({ processConversationWork: () => processConversationWork });
|
|
66
63
|
const CONVERSATION_WORK_DEFER_DELAY_MS = 15e3;
|
|
67
64
|
const CONVERSATION_STOP_CHECK_INTERVAL_MS = 500;
|
|
68
65
|
function now(options) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
CREATE EXTENSION IF NOT EXISTS vector;--> statement-breakpoint
|
|
2
|
+
CREATE TABLE "junior_conversation_embeddings" (
|
|
3
|
+
"conversation_id" text PRIMARY KEY NOT NULL,
|
|
4
|
+
"brief_version" integer NOT NULL,
|
|
5
|
+
"provider" text NOT NULL,
|
|
6
|
+
"model" text NOT NULL,
|
|
7
|
+
"dimensions" integer NOT NULL,
|
|
8
|
+
"embedding" vector NOT NULL,
|
|
9
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
10
|
+
CONSTRAINT "junior_conversation_embeddings_dimensions_check" CHECK (vector_dims("junior_conversation_embeddings"."embedding") = "junior_conversation_embeddings"."dimensions")
|
|
11
|
+
);
|
|
12
|
+
--> statement-breakpoint
|
|
13
|
+
ALTER TABLE "junior_conversation_embeddings" ADD CONSTRAINT "junior_conversation_embeddings_brief_fk" FOREIGN KEY ("conversation_id","brief_version") REFERENCES "public"."junior_conversation_briefs"("conversation_id","version") ON DELETE cascade ON UPDATE no action;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "junior_users" ADD COLUMN "preferences" jsonb DEFAULT '{}'::jsonb NOT NULL;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
CREATE INDEX CONCURRENTLY IF NOT EXISTS "junior_code_changes_repository_state_idx" ON "junior_code_changes" USING btree ("repository_id","state","updated_at" DESC NULLS LAST);
|