@sentry/junior 0.295.0 → 0.297.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/{admin-ifgjyfpF.js → admin-tmGIw4KS.js} +2 -2
- package/dist/{agent-runner-DjMTPWEO.js → agent-runner-CneTquAE.js} +468 -1947
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +7 -7
- package/dist/api.d.ts +1 -1
- package/dist/api.js +306 -569
- package/dist/{app-uiTzRbvq.d.ts → app-BJojZ7HL.d.ts} +7 -2
- package/dist/app.d.ts +1 -1
- package/dist/app.js +64 -44
- package/dist/attempt-selection-ClP3MMPr.js +61 -0
- package/dist/{automation-yJX3C7i3.js → automation-BrP6ImrC.js} +1 -1
- package/dist/{background-compaction-queue-DUkHZjmL.js → background-compaction-queue-CwfJy3Cd.js} +4 -88
- package/dist/{briefs-CbNYM-q2.js → briefs-uFTuhMqA.js} +3 -3
- package/dist/{catalog-runtime-DgouZKZm.js → catalog-runtime-0kuQqYL4.js} +1 -1
- package/dist/cli/chat.js +19 -15
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{config-DvnTPCfp.js → config-Dj9M_nqB.js} +18 -2
- package/dist/{connections-CWaIVl_1.js → connections-B96JUM5o.js} +6 -6
- package/dist/{conversation-CMkSmi02.js → conversation-CvcBU1z2.js} +2 -16
- package/dist/{conversation-feed-BVAOga0H.js → conversation-feed-BSMlGZnS.js} +1 -1
- package/dist/{conversation-privacy-DPjv4SnA.js → conversation-privacy-DI29jbZV.js} +1 -1
- package/dist/conversation-turn-CZWBr091.js +805 -0
- package/dist/{credential-sync-BhbaZfmO.js → credential-sync-Blhx4_xf.js} +14 -13
- package/dist/{db-Dts2XvLu.js → db-Br0tfAo7.js} +54 -32
- package/dist/{db-CCUqQe0E.d.ts → db-CrtyFRz7.d.ts} +13 -1
- package/dist/{executor-Ck73J0wP.js → executor-BMPipFVA.js} +19 -5
- package/dist/instrumentation.js +19 -2
- package/dist/{logging-9OAq-fdg.js → logging-CQjlDQYX.js} +1 -1
- package/dist/{message-CtaPzC7m.js → message-BOZEIuxy.js} +15 -13
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -2
- package/dist/{session-stop-DkxI5vc3.js → notification-gusCgdQ6.js} +14 -933
- package/dist/{oauth-callback-server-C_LXY1d4.js → oauth-callback-server-V_DuMuNX.js} +2 -2
- package/dist/{projection-BzJQncZV.js → projection-B08mfi0u.js} +479 -145
- package/dist/{prompt-Cbq5b4SO.js → prompt-BlutWLNt.js} +4 -4
- package/dist/prompt-input-Dxn8cDC0.js +1424 -0
- package/dist/{registry-cbpOxO4M.js → registry-BDWgCJDf.js} +1 -1
- package/dist/reporting-window-DopzcOHh.js +137 -0
- package/dist/{resolve-t-pmRdwS.js → resolve-2Z_o_SsI.js} +3 -3
- package/dist/result-CAujiaci.js +463 -0
- package/dist/{runner-CHv9X9TH.js → runner-D2Chc02N.js} +9 -8
- package/dist/{sandbox-egress-signals-Yy3fSCbg.js → sandbox-egress-signals-CFoJduFj.js} +1 -1
- package/dist/{schema-BhneuGYv.js → schema-Bqa5NbcP.js} +22 -48
- package/dist/{schema-TSEisVJR.d.ts → schema-Ce2XCS7O.d.ts} +24 -107
- package/dist/{service-account-DjPIwCMj.js → service-account-C9kRQEb_.js} +3 -3
- package/dist/{service-account-C4rBP8ne.js → service-account-CERfXEVU.js} +3 -3
- package/dist/session-stop-B-I1rAS1.js +181 -0
- package/dist/{skills-BZE2DP8I.js → skills-B0m1nZ_j.js} +3 -3
- package/dist/{spawn-BvULxIiu.js → spawn-CwMjRRtn.js} +6 -5
- package/dist/{state-CO9ETDzk.js → state-DFnmLmfn.js} +2 -2
- package/dist/{stop-CL-rdtQb.js → stop-BCH9VNGf.js} +329 -382
- package/dist/{store-DgD78_NK.js → store-B59rOYbS.js} +11 -4
- package/dist/{task-runner-CKOj6xla.js → store-m5bmdmsP.js} +929 -1559
- package/dist/task-queue-N0kuCknH.js +89 -0
- package/dist/task-runner-COOwR8qm.js +291 -0
- package/dist/thread-context-Cd44z_W5.js +248 -0
- package/dist/turn-cancel-DDu8TOwt.js +201 -0
- package/dist/turn-session-routing-BlCtVFRN.js +380 -0
- package/dist/{turn-failure-response-BTSo6SMJ.js → turn-user-message-ygLG3ylQ.js} +183 -358
- package/dist/turn-wake-DmQec4AG.js +161 -0
- package/dist/{reporting-window-B3Ze-Qnt.js → user-input-request-CXNIov9n.js} +24 -143
- package/dist/{validation-CXeYgBzq.js → validation-Ba2OcUse.js} +1 -1
- package/dist/{version-AQa7Fr2H.js → version-KNDzIAh6.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-Bqkb678l.js → viewer-BPpuN2f9.js} +3 -3
- package/dist/warmup-Bskrwmk1.js +2697 -0
- package/dist/{worker-Hl7N292I.js → worker-B1skZlit.js} +20 -8
- package/migrations/0101_drop_legacy_columns.sql +12 -0
- package/migrations/0102_code_change_last_activity.sql +1 -0
- package/migrations/0103_agent_invocation_fork.sql +8 -0
- package/migrations/meta/0101_snapshot.json +4496 -0
- package/migrations/meta/0102_snapshot.json +4502 -0
- package/migrations/meta/0103_snapshot.json +4509 -0
- package/migrations/meta/_journal.json +21 -0
- package/package.json +5 -4
- package/dist/result-DhgjR3nQ.js +0 -305
- package/dist/result-event-type-DD6BAgT7.js +0 -11
- package/dist/warmup-h6u1e9n0.js +0 -1869
- package/dist/work-yN_GAuXY.js +0 -768
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { $ as loadTurnCheckpoint, at as failTurnRecord, ot as getTurnRecord } from "./projection-B08mfi0u.js";
|
|
2
|
+
import { T as isTopLevelKind, a as getConversationStore, r as getConversationEventStore } from "./db-Br0tfAo7.js";
|
|
3
|
+
import { a as getStateAdapter } from "./state-DFnmLmfn.js";
|
|
4
|
+
import { l as getVercelConversationWorkQueue } from "./background-compaction-queue-CwfJy3Cd.js";
|
|
5
|
+
import { C as requestConversationWork, h as ensureConversationWake } from "./store-B59rOYbS.js";
|
|
6
|
+
import { n as resolveTurnSessionRouting } from "./turn-session-routing-BlCtVFRN.js";
|
|
7
|
+
import { randomUUID } from "node:crypto";
|
|
8
|
+
import * as z from "zod";
|
|
9
|
+
// src/chat/conversations/web-authorization.ts
|
|
10
|
+
const WEB_AUTHORIZATION_PREFIX = "junior:web_authorization:v1";
|
|
11
|
+
const WEB_AUTHORIZATION_TTL_MS = 864e5;
|
|
12
|
+
function authorizationKey$1(conversationId, actorId) {
|
|
13
|
+
return `${WEB_AUTHORIZATION_PREFIX}:${conversationId}:${actorId}`;
|
|
14
|
+
}
|
|
15
|
+
/** Build authorization delivery for one web turn. */
|
|
16
|
+
function createWebAuthorization(args) {
|
|
17
|
+
return {
|
|
18
|
+
createState: async () => randomUUID(),
|
|
19
|
+
deliver: async (request) => {
|
|
20
|
+
await getStateAdapter().set(authorizationKey$1(args.conversationId, args.actorId), JSON.stringify({
|
|
21
|
+
...request,
|
|
22
|
+
...args
|
|
23
|
+
}), WEB_AUTHORIZATION_TTL_MS);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/** Read the pending authorization request for one web actor. */
|
|
28
|
+
async function getWebAuthorization(args) {
|
|
29
|
+
const value = await getStateAdapter().get(authorizationKey$1(args.conversationId, args.actorId));
|
|
30
|
+
if (typeof value !== "string") return void 0;
|
|
31
|
+
try {
|
|
32
|
+
const parsed = JSON.parse(value);
|
|
33
|
+
if (parsed.actorId !== args.actorId || parsed.conversationId !== args.conversationId || typeof parsed.authorizationUrl !== "string" || typeof parsed.label !== "string" || typeof parsed.completionText !== "string") return;
|
|
34
|
+
return parsed;
|
|
35
|
+
} catch {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** Remove a web authorization request after the parked turn continues. */
|
|
40
|
+
async function deleteWebAuthorization(args) {
|
|
41
|
+
await getStateAdapter().delete(authorizationKey$1(args.conversationId, args.actorId));
|
|
42
|
+
}
|
|
43
|
+
// src/chat/task-execution/authorized-turn.ts
|
|
44
|
+
/**
|
|
45
|
+
* OAuth callbacks save readiness, not agent history. The conversation worker
|
|
46
|
+
* consumes this event under its lease before it resumes the paused Turn.
|
|
47
|
+
*/
|
|
48
|
+
const authorizationSchema = z.object({
|
|
49
|
+
kind: z.enum(["mcp", "plugin"]),
|
|
50
|
+
provider: z.string().min(1),
|
|
51
|
+
actorId: z.string().min(1),
|
|
52
|
+
authorizationId: z.string().min(1),
|
|
53
|
+
authSessionId: z.string().optional(),
|
|
54
|
+
scope: z.string().optional(),
|
|
55
|
+
configuration: z.record(z.string(), z.unknown()).optional(),
|
|
56
|
+
toolChannelId: z.string().optional()
|
|
57
|
+
});
|
|
58
|
+
function authorizationKey(turn) {
|
|
59
|
+
return `turn:${turn.turnId}:authorization:${turn.version}`;
|
|
60
|
+
}
|
|
61
|
+
/** Save authorization for this parked boundary without changing model history. */
|
|
62
|
+
async function recordTurnAuthorization(args) {
|
|
63
|
+
const turn = await getTurnRecord(args.conversationId, args.turnId);
|
|
64
|
+
if (!turn || turn.state !== "paused" || turn.resumeReason !== "auth") return;
|
|
65
|
+
await getConversationEventStore().append(args.conversationId, [{
|
|
66
|
+
idempotencyKey: authorizationKey(turn),
|
|
67
|
+
createdAtMs: Date.now(),
|
|
68
|
+
data: {
|
|
69
|
+
type: "structured_event",
|
|
70
|
+
namespace: "junior",
|
|
71
|
+
name: "turn_authorized",
|
|
72
|
+
version: 1,
|
|
73
|
+
turnId: turn.turnId,
|
|
74
|
+
content: authorizationSchema.parse(args)
|
|
75
|
+
}
|
|
76
|
+
}], { activity: "preserve" });
|
|
77
|
+
return {
|
|
78
|
+
conversationId: args.conversationId,
|
|
79
|
+
destination: args.destination,
|
|
80
|
+
turnId: turn.turnId,
|
|
81
|
+
expectedVersion: turn.version
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/** Read authorization for the exact pause; a later auth pause needs its own callback. */
|
|
85
|
+
async function getTurnAuthorization(turn) {
|
|
86
|
+
const event = await getConversationEventStore().loadByIdempotencyKey(turn.conversationId, authorizationKey(turn));
|
|
87
|
+
if (event?.data.type !== "structured_event") return void 0;
|
|
88
|
+
return authorizationSchema.parse(event.data.content);
|
|
89
|
+
}
|
|
90
|
+
// src/chat/task-execution/turn-wake.ts
|
|
91
|
+
/** Build the worker input for a paused turn. */
|
|
92
|
+
async function getPausedTurnRequest(args) {
|
|
93
|
+
const turn = (await loadTurnCheckpoint({
|
|
94
|
+
conversationId: args.conversationId,
|
|
95
|
+
turnId: args.turnId
|
|
96
|
+
})).record;
|
|
97
|
+
if (!turn || turn.state !== "paused" || turn.resumeReason !== "timeout" && turn.resumeReason !== "yield" && turn.resumeReason !== "retry" && !(turn.resumeReason === "auth" && await getTurnAuthorization(turn)) || turn.resumeReason === "timeout" && turn.sliceId < 2) return;
|
|
98
|
+
let routing;
|
|
99
|
+
try {
|
|
100
|
+
routing = await resolveTurnSessionRouting({
|
|
101
|
+
conversationId: args.conversationId,
|
|
102
|
+
conversationStore: args.conversationStore
|
|
103
|
+
});
|
|
104
|
+
} catch (error) {
|
|
105
|
+
await failTurnRecord({
|
|
106
|
+
conversationId: args.conversationId,
|
|
107
|
+
expectedVersion: turn.version,
|
|
108
|
+
turnId: args.turnId,
|
|
109
|
+
errorMessage: error instanceof Error ? error.message : String(error)
|
|
110
|
+
});
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
conversationId: args.conversationId,
|
|
115
|
+
destination: routing.destination,
|
|
116
|
+
turnId: args.turnId,
|
|
117
|
+
expectedVersion: turn.version,
|
|
118
|
+
traceContext: turn.traceContext
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/** Wake the conversation worker for a paused turn. */
|
|
122
|
+
async function wakePausedTurn(request, options = {}) {
|
|
123
|
+
const nowMs = options.nowMs ?? Date.now();
|
|
124
|
+
const conversation = await (options.conversationStore ?? getConversationStore()).get({ conversationId: request.conversationId });
|
|
125
|
+
await requestConversationWork({
|
|
126
|
+
conversationId: request.conversationId,
|
|
127
|
+
destination: conversation && !isTopLevelKind(conversation.kind) ? void 0 : request.destination,
|
|
128
|
+
nowMs,
|
|
129
|
+
state: options.state
|
|
130
|
+
});
|
|
131
|
+
const queue = options.queue ?? getVercelConversationWorkQueue();
|
|
132
|
+
await ensureConversationWake({
|
|
133
|
+
conversationId: request.conversationId,
|
|
134
|
+
idempotencyKey: [
|
|
135
|
+
"agent-continue",
|
|
136
|
+
request.conversationId,
|
|
137
|
+
request.turnId,
|
|
138
|
+
request.expectedVersion,
|
|
139
|
+
nowMs
|
|
140
|
+
].join(":"),
|
|
141
|
+
nowMs,
|
|
142
|
+
queue,
|
|
143
|
+
state: options.state
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/** Create paused Turn operations for one app. */
|
|
147
|
+
function createPausedTurns(options = {}) {
|
|
148
|
+
return {
|
|
149
|
+
get: (args) => getPausedTurnRequest({
|
|
150
|
+
...args,
|
|
151
|
+
conversationStore: options.conversationStore
|
|
152
|
+
}),
|
|
153
|
+
wake: (request) => wakePausedTurn(request, options)
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/** Record completed authorization and wake the sole execution owner. */
|
|
157
|
+
async function wakeAuthorizedTurn(args, queue) {
|
|
158
|
+
const request = await recordTurnAuthorization(args);
|
|
159
|
+
if (request) await wakePausedTurn(request, { queue });
|
|
160
|
+
}
|
|
161
|
+
export { getTurnAuthorization as a, getWebAuthorization as c, wakePausedTurn as i, getPausedTurnRequest as n, createWebAuthorization as o, wakeAuthorizedTurn as r, deleteWebAuthorization as s, createPausedTurns as t };
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
// src/
|
|
3
|
-
/**
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
// src/chat/agent-invocations/result-event-type.ts
|
|
3
|
+
/** Event namespace of the messages between a parent and its child agents. */
|
|
4
|
+
const AGENT_INVOCATION_EVENT_NAMESPACE = "junior";
|
|
5
|
+
const AGENT_INVOCATION_RESULT_EVENT_TYPE_PREFIX = "agent_invocation.";
|
|
6
|
+
/** Build the Event type of the parent message for one agent invocation result. */
|
|
7
|
+
function agentInvocationResultEventType(status) {
|
|
8
|
+
return `${AGENT_INVOCATION_RESULT_EVENT_TYPE_PREFIX}${status}`;
|
|
9
|
+
}
|
|
10
|
+
/** True when an Event type names an agent invocation result. */
|
|
11
|
+
function isAgentInvocationResultEventType(eventType) {
|
|
12
|
+
return eventType.startsWith(AGENT_INVOCATION_RESULT_EVENT_TYPE_PREFIX);
|
|
13
|
+
}
|
|
14
|
+
/** Event type of the `reply` that ends a child agent's Turn. */
|
|
15
|
+
const AGENT_REPLY_EVENT_TYPE = "agent.reply";
|
|
16
|
+
/** Event type of a message that a child agent sends to its parent. */
|
|
17
|
+
const AGENT_MESSAGE_EVENT_TYPE = "agent.message";
|
|
9
18
|
// src/chat/agent-invocations/statuses.ts
|
|
10
19
|
const AGENT_INVOCATION_STATUSES = [
|
|
11
20
|
"pending",
|
|
@@ -32,6 +41,13 @@ const AGENT_INVOCATION_PARENT_MAILBOX_STATUSES = [
|
|
|
32
41
|
"skipped",
|
|
33
42
|
"steered"
|
|
34
43
|
];
|
|
44
|
+
// src/api/schema/user-customization.ts
|
|
45
|
+
/** Longest customization text one user can save. */
|
|
46
|
+
const USER_CUSTOMIZATION_MAX_CHARS = 1e3;
|
|
47
|
+
/** Saved customization text. An empty string means none. */
|
|
48
|
+
const userCustomizationTextSchema = z.string().trim().max(USER_CUSTOMIZATION_MAX_CHARS);
|
|
49
|
+
/** Request and response body for the viewer's customization. */
|
|
50
|
+
const userCustomizationSchema = z.object({ customization: userCustomizationTextSchema }).strict();
|
|
35
51
|
// src/chat/tools/runtime/user-input-request.ts
|
|
36
52
|
const USER_INPUT_LIMITS = {
|
|
37
53
|
maxButtonOptions: 5,
|
|
@@ -160,139 +176,4 @@ function formatUserInputAnswer(request, answer) {
|
|
|
160
176
|
if (normalized.other) lines.push(answerLine(`Other: ${normalized.other}`));
|
|
161
177
|
return lines.join("\n");
|
|
162
178
|
}
|
|
163
|
-
|
|
164
|
-
/** Stable error body returned by Junior-owned REST endpoints. */
|
|
165
|
-
const apiErrorSchema = z.object({ error: z.string().min(1) }).strict();
|
|
166
|
-
// src/chat/conversations/web-message-id.ts
|
|
167
|
-
/**
|
|
168
|
-
* Build the retry-stable Message id shared by web ingress and browser sends.
|
|
169
|
-
* Keep the existing hash and prefix so retries still address stored Messages.
|
|
170
|
-
*/
|
|
171
|
-
async function webMessageId(args) {
|
|
172
|
-
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(`${args.conversationId}\u0000${args.idempotencyKey}`));
|
|
173
|
-
return `api-msg:${Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("").slice(0, 24)}`;
|
|
174
|
-
}
|
|
175
|
-
// src/api/reporting-window.ts
|
|
176
|
-
/** Shared UTC day/hour/six-hour windows for dashboard activity series. */
|
|
177
|
-
const HOUR_MS = 36e5;
|
|
178
|
-
const SIX_HOUR_MS = 6 * HOUR_MS;
|
|
179
|
-
const DAY_MS = 24 * HOUR_MS;
|
|
180
|
-
/** Start of the UTC calendar day containing `valueMs`. */
|
|
181
|
-
function startOfUtcDay(valueMs) {
|
|
182
|
-
const date = new Date(valueMs);
|
|
183
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
184
|
-
return date;
|
|
185
|
-
}
|
|
186
|
-
/** Start of the UTC hour containing `valueMs`. */
|
|
187
|
-
function startOfUtcHour(valueMs) {
|
|
188
|
-
const date = new Date(valueMs);
|
|
189
|
-
date.setUTCMinutes(0, 0, 0);
|
|
190
|
-
return date;
|
|
191
|
-
}
|
|
192
|
-
/** Start of the UTC 6-hour bucket containing `valueMs` (00/06/12/18). */
|
|
193
|
-
function startOfUtcSixHour(valueMs) {
|
|
194
|
-
const date = startOfUtcHour(valueMs);
|
|
195
|
-
date.setUTCHours(Math.floor(date.getUTCHours() / 6) * 6, 0, 0, 0);
|
|
196
|
-
return date;
|
|
197
|
-
}
|
|
198
|
-
/** UTC day key `YYYY-MM-DD`. */
|
|
199
|
-
function utcDayKey(value) {
|
|
200
|
-
return (typeof value === "number" ? new Date(value) : value).toISOString().slice(0, 10);
|
|
201
|
-
}
|
|
202
|
-
/** UTC hour key `YYYY-MM-DDTHH`. */
|
|
203
|
-
function utcHourKey(value) {
|
|
204
|
-
return (typeof value === "number" ? new Date(value) : value).toISOString().slice(0, 13);
|
|
205
|
-
}
|
|
206
|
-
/** UTC 6-hour bucket key `YYYY-MM-DDTHH` at 00/06/12/18. */
|
|
207
|
-
function utcSixHourKey(value) {
|
|
208
|
-
return utcHourKey(startOfUtcSixHour(typeof value === "number" ? value : value.getTime()));
|
|
209
|
-
}
|
|
210
|
-
/** Inclusive trailing UTC day window ending on today's UTC day. */
|
|
211
|
-
function trailingUtcDayWindow(nowMs, dayCount) {
|
|
212
|
-
const end = startOfUtcDay(nowMs);
|
|
213
|
-
const start = new Date(end);
|
|
214
|
-
start.setUTCDate(start.getUTCDate() - (dayCount - 1));
|
|
215
|
-
return {
|
|
216
|
-
end,
|
|
217
|
-
start
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
/** Inclusive trailing UTC hour window ending on the current UTC hour. */
|
|
221
|
-
function trailingUtcHourWindow(nowMs, hourCount = 24) {
|
|
222
|
-
const end = startOfUtcHour(nowMs);
|
|
223
|
-
return {
|
|
224
|
-
end,
|
|
225
|
-
start: /* @__PURE__ */ new Date(end.getTime() - (hourCount - 1) * HOUR_MS)
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
/** Inclusive trailing UTC 6-hour window ending on the current 6h bucket. */
|
|
229
|
-
function trailingUtcSixHourWindow(nowMs, bucketCount = 28) {
|
|
230
|
-
const end = startOfUtcSixHour(nowMs);
|
|
231
|
-
return {
|
|
232
|
-
end,
|
|
233
|
-
start: /* @__PURE__ */ new Date(end.getTime() - (bucketCount - 1) * SIX_HOUR_MS)
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
/** Fill a fixed UTC day window from a sparse map. */
|
|
237
|
-
function fillUtcDays(args) {
|
|
238
|
-
const { end, start } = trailingUtcDayWindow(args.nowMs, args.count);
|
|
239
|
-
const items = [];
|
|
240
|
-
for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setUTCDate(cursor.getUTCDate() + 1)) {
|
|
241
|
-
const date = utcDayKey(cursor);
|
|
242
|
-
items.push(args.rows.get(date) ?? args.empty(date));
|
|
243
|
-
}
|
|
244
|
-
return items;
|
|
245
|
-
}
|
|
246
|
-
/** Fill a fixed UTC hour window from a sparse map. */
|
|
247
|
-
function fillUtcHours(args) {
|
|
248
|
-
const hourCount = args.count ?? 24;
|
|
249
|
-
const { end, start } = trailingUtcHourWindow(args.nowMs, hourCount);
|
|
250
|
-
const items = [];
|
|
251
|
-
for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setTime(cursor.getTime() + HOUR_MS)) {
|
|
252
|
-
const date = utcHourKey(cursor);
|
|
253
|
-
items.push(args.rows.get(date) ?? args.empty(date));
|
|
254
|
-
}
|
|
255
|
-
return items;
|
|
256
|
-
}
|
|
257
|
-
/** Fill a fixed UTC 6-hour window from a map of known rows. */
|
|
258
|
-
function fillUtcSixHours(args) {
|
|
259
|
-
const bucketCount = args.count ?? 28;
|
|
260
|
-
const { end, start } = trailingUtcSixHourWindow(args.nowMs, bucketCount);
|
|
261
|
-
const items = [];
|
|
262
|
-
for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setTime(cursor.getTime() + SIX_HOUR_MS)) {
|
|
263
|
-
const date = utcSixHourKey(cursor);
|
|
264
|
-
items.push(args.rows.get(date) ?? args.empty(date));
|
|
265
|
-
}
|
|
266
|
-
return items;
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Sum hour rows into trailing 6-hour buckets.
|
|
270
|
-
* Adds number fields. Keeps other fields from the first row in the bucket.
|
|
271
|
-
* Sets `date` to the 6-hour bucket key.
|
|
272
|
-
*/
|
|
273
|
-
function sumUtcHoursIntoSixHours(args) {
|
|
274
|
-
const bucketCount = args.count ?? 28;
|
|
275
|
-
const bySix = /* @__PURE__ */ new Map();
|
|
276
|
-
for (const hour of args.hours) {
|
|
277
|
-
const key = utcSixHourKey(Date.parse(`${hour.date}:00:00.000Z`));
|
|
278
|
-
const next = {
|
|
279
|
-
...bySix.get(key) ?? args.empty(key),
|
|
280
|
-
date: key
|
|
281
|
-
};
|
|
282
|
-
for (const [field, value] of Object.entries(hour)) {
|
|
283
|
-
if (field === "date") continue;
|
|
284
|
-
if (typeof value === "number") {
|
|
285
|
-
const prior = next[field];
|
|
286
|
-
next[field] = (typeof prior === "number" ? prior : 0) + value;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
bySix.set(key, next);
|
|
290
|
-
}
|
|
291
|
-
return fillUtcSixHours({
|
|
292
|
-
count: bucketCount,
|
|
293
|
-
empty: args.empty,
|
|
294
|
-
nowMs: args.nowMs,
|
|
295
|
-
rows: bySix
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
export { AGENT_INVOCATION_PARENT_MAILBOX_STATUSES as C, userCustomizationTextSchema as D, userCustomizationSchema as E, AGENT_INVOCATION_MAILBOX_STATUSES as S, USER_CUSTOMIZATION_MAX_CHARS as T, buttonUserInputField as _, fillUtcSixHours as a, normalizeUserInputAnswer as b, trailingUtcDayWindow as c, utcDayKey as d, utcHourKey as f, USER_INPUT_NOTE as g, USER_INPUT_LIMITS as h, fillUtcHours as i, trailingUtcHourWindow as l, apiErrorSchema as m, HOUR_MS as n, startOfUtcHour as o, webMessageId as p, fillUtcDays as r, sumUtcHoursIntoSixHours as s, DAY_MS as t, trailingUtcSixHourWindow as u, formatUserInputAnswer as v, AGENT_INVOCATION_STATUSES as w, userInputRequestSchema as x, isEmptyUserInputAnswer as y };
|
|
179
|
+
export { agentInvocationResultEventType as _, isEmptyUserInputAnswer as a, USER_CUSTOMIZATION_MAX_CHARS as c, AGENT_INVOCATION_MAILBOX_STATUSES as d, AGENT_INVOCATION_PARENT_MAILBOX_STATUSES as f, AGENT_REPLY_EVENT_TYPE as g, AGENT_MESSAGE_EVENT_TYPE as h, formatUserInputAnswer as i, userCustomizationSchema as l, AGENT_INVOCATION_EVENT_NAMESPACE as m, USER_INPUT_NOTE as n, normalizeUserInputAnswer as o, AGENT_INVOCATION_STATUSES as p, buttonUserInputField as r, userInputRequestSchema as s, USER_INPUT_LIMITS as t, userCustomizationTextSchema as u, isAgentInvocationResultEventType as v };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
2
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-0kuQqYL4.js";
|
|
3
3
|
import { isDeepStrictEqual } from "node:util";
|
|
4
4
|
// src/chat/plugins/validation.ts
|
|
5
5
|
var validation_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.
|
|
2
|
+
var version = "0.297.0";
|
|
3
3
|
// src/version.ts
|
|
4
4
|
/** Installed Junior package version, or `unknown` when package metadata is unavailable. */
|
|
5
5
|
const JUNIOR_VERSION = typeof version === "string" && version.trim() ? version : "unknown";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as JUNIOR_VERSION } from "./version-
|
|
1
|
+
export { t as JUNIOR_VERSION } from "./version-KNDzIAh6.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-
|
|
2
|
-
import { N as findActorIdentityId, o as getDb } from "./db-
|
|
3
|
-
import { M as juniorUsers, j as juniorIdentities } from "./executor-
|
|
1
|
+
import { H as GOOGLE_IDENTITY_PROVIDER, W as normalizeIdentityEmail, h as logWarn } from "./logging-CQjlDQYX.js";
|
|
2
|
+
import { N as findActorIdentityId, o as getDb } from "./db-Br0tfAo7.js";
|
|
3
|
+
import { M as juniorUsers, j as juniorIdentities } from "./executor-BMPipFVA.js";
|
|
4
4
|
import { r as detectImageMediaType } from "./media-BepyEUNm.js";
|
|
5
5
|
import { a as withLock } from "./locks-D-0h111u.js";
|
|
6
6
|
import { createHash, randomUUID } from "node:crypto";
|