@sentry/junior 0.205.0 → 0.207.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-D4nu8MQV.js → agent-CmQlX68D.js} +603 -394
- package/dist/{agent-hooks-DXHpTJ4m.js → agent-hooks-BBX9p6aG.js} +1171 -100
- package/dist/{agent-runner-C04colea.js → agent-runner-CQD4HKK2.js} +9 -9
- package/dist/api/schema.d.ts +116 -39
- package/dist/api/schema.js +3 -3
- package/dist/api.d.ts +1 -1
- package/dist/api.js +182 -649
- package/dist/{app-Cb776lL8.d.ts → app-DfNrn_gS.d.ts} +9 -2
- package/dist/app.d.ts +1 -1
- package/dist/app.js +205 -233
- package/dist/{auth-pause-state-C2P3guS1.js → auth-pause-state-uv8on6cT.js} +7 -7
- package/dist/briefs-BXEmjD9D.js +398 -0
- package/dist/{catalog-runtime-CXw3asJD.js → catalog-runtime-1BZEOR8J.js} +1 -1
- package/dist/{checkpoint-CrViJ8Ps.js → checkpoint-B-JO5F3c.js} +9 -8
- package/dist/cli/chat.js +14 -12
- package/dist/cli/check.js +3 -3
- package/dist/cli/init.js +1 -0
- package/dist/cli/main.js +5 -1
- package/dist/cli/plugins.js +3 -3
- package/dist/cli/run.d.ts +2 -1
- package/dist/cli/run.js +2 -1
- package/dist/cli/snapshot-create.js +3 -3
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{config-BOtJQ7Pc.js → client-Bp297GA0.js} +6 -369
- package/dist/config-G2gv97R1.js +386 -0
- package/dist/{context-B45_WqVX.js → context-Bplcgypl.js} +13 -13
- package/dist/{schema-Rn8-XEaN.js → conversation-AA4R1VUn.js} +580 -558
- package/dist/{conversation-privacy-BZRA6Pes.js → conversation-privacy-BUfel19D.js} +1 -1
- package/dist/{credential-sync-Bep34IB_.js → credential-sync-D04NWqMR.js} +21 -20
- package/dist/{db-BeyXKJOI.d.ts → db-D74z7BZH.d.ts} +1 -1
- package/dist/{execution-stats-B6lgWxCK.js → execution-stats-Ds4bSvam.js} +77 -77
- package/dist/{executor-BlUhFL7_.js → executor-BZu1Ta06.js} +41 -13
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-DLMqIK74.js → job-queue-rnAPfUhP.js} +1 -1
- package/dist/{logging-BMJzdDlP.js → logging-Dx0S5k2z.js} +1 -1
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-WwG5_Zgm.js → oauth-callback-server-xGpwURIj.js} +2 -2
- package/dist/{pending-auth-CUbXq06G.js → pending-auth-DIZ4iZjS.js} +2 -2
- package/dist/{profile-T0tXE4zu.js → profile-d-fKypxo.js} +4 -3
- package/dist/prompt-x-0ZtTyb.js +552 -0
- package/dist/{registry-BA0__8ai.js → registry-CWKdLCTG.js} +2 -2
- package/dist/{resolve-bvD1ORdv.js → resolve-BhRB1s2A.js} +2 -2
- package/dist/{runner-BXYxfIUL.js → runner-DNml3owD.js} +10 -10
- package/dist/{sandbox-egress-signals-ngEPjSEW.js → sandbox-egress-signals-DUIl3-gW.js} +1 -1
- package/dist/schema-CwTeb-BF.js +559 -0
- package/dist/{skills-DJOlYdBs.js → skills-D9WesdJJ.js} +2 -2
- package/dist/{spawn-h0R1bTEo.js → spawn-Eh_3-s0M.js} +2 -2
- package/dist/{stats-3YZn-Swi.js → stats-CFlUGqVA.js} +292 -268
- package/dist/{store-C5qxF2ac.d.ts → store-Det8MQ9g.d.ts} +1 -1
- package/dist/{task-queue-CoXwd2eq.js → task-queue-D8I1_5wP.js} +3 -3
- package/dist/{task-runner-B2_mJZj0.js → task-runner-DO79gdho.js} +18 -18
- package/dist/{thread-state-CqZ1m-es.js → thread-state-DD6BA4xz.js} +5 -5
- package/dist/{turn-execution-fI6PZ0iI.js → turn-execution-BSIHxmQJ.js} +3 -3
- package/dist/{turn-lifecycle-CcnwrOcp.js → turn-lifecycle-DSBK4Ars.js} +1 -1
- package/dist/{usage-B5SfMb3H.js → usage-WRXkNOHp.js} +4 -125
- package/dist/{validation-DfWcvhuS.js → validation-BbHZ4r4S.js} +1 -1
- package/dist/{version-oD-oPrbO.js → version-C71UcRWw.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/web-authorization-C73gJV7l.js +38 -0
- package/dist/{web-input-BOuq3oKK.js → web-input-Ce1FcNIM.js} +8 -8
- package/dist/{work-B91LQKHr.js → work-BEzDU_2x.js} +9 -9
- package/dist/{worker-BcRRTe6k.js → worker-MK2ubOv-.js} +5 -4
- package/migrations/0040_conversation_briefs.sql +17 -0
- package/migrations/0041_automation_outcomes_backfill.sql +27 -0
- package/migrations/meta/0040_snapshot.json +3516 -0
- package/migrations/meta/0041_snapshot.json +3516 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +4 -4
- package/dist/history-CqTuSAdI.js +0 -441
- package/dist/usage-schema-CKaDkH_j.js +0 -20
- package/dist/web-authorization-Crbzlmzo.js +0 -76
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
import { t as juniorDestinationKindSchema } from "./destinations-BeBiJeEM.js";
|
|
2
|
+
import { E as conversationSummaryReportSchema, n as actorIdentitySchema, w as conversationStatsItemSchema } from "./conversation-AA4R1VUn.js";
|
|
3
|
+
import "./reporting-schema-DosTN__Q.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { codeChangeStateSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
|
|
6
|
+
//#region src/api/schema/common.ts
|
|
7
|
+
/** Stable error body returned by Junior-owned REST endpoints. */
|
|
8
|
+
const apiErrorSchema = z.object({ error: z.string().min(1) }).strict();
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/api/reporting-window.ts
|
|
11
|
+
/** Shared UTC day/hour/six-hour windows for dashboard activity series. */
|
|
12
|
+
const HOUR_MS = 36e5;
|
|
13
|
+
const SIX_HOUR_MS = 6 * HOUR_MS;
|
|
14
|
+
const DAY_MS = 24 * HOUR_MS;
|
|
15
|
+
/** Start of the UTC calendar day containing `valueMs`. */
|
|
16
|
+
function startOfUtcDay(valueMs) {
|
|
17
|
+
const date = new Date(valueMs);
|
|
18
|
+
date.setUTCHours(0, 0, 0, 0);
|
|
19
|
+
return date;
|
|
20
|
+
}
|
|
21
|
+
/** Start of the UTC hour containing `valueMs`. */
|
|
22
|
+
function startOfUtcHour(valueMs) {
|
|
23
|
+
const date = new Date(valueMs);
|
|
24
|
+
date.setUTCMinutes(0, 0, 0);
|
|
25
|
+
return date;
|
|
26
|
+
}
|
|
27
|
+
/** Start of the UTC 6-hour bucket containing `valueMs` (00/06/12/18). */
|
|
28
|
+
function startOfUtcSixHour(valueMs) {
|
|
29
|
+
const date = startOfUtcHour(valueMs);
|
|
30
|
+
date.setUTCHours(Math.floor(date.getUTCHours() / 6) * 6, 0, 0, 0);
|
|
31
|
+
return date;
|
|
32
|
+
}
|
|
33
|
+
/** UTC day key `YYYY-MM-DD`. */
|
|
34
|
+
function utcDayKey(value) {
|
|
35
|
+
return (typeof value === "number" ? new Date(value) : value).toISOString().slice(0, 10);
|
|
36
|
+
}
|
|
37
|
+
/** UTC hour key `YYYY-MM-DDTHH`. */
|
|
38
|
+
function utcHourKey(value) {
|
|
39
|
+
return (typeof value === "number" ? new Date(value) : value).toISOString().slice(0, 13);
|
|
40
|
+
}
|
|
41
|
+
/** UTC 6-hour bucket key `YYYY-MM-DDTHH` at 00/06/12/18. */
|
|
42
|
+
function utcSixHourKey(value) {
|
|
43
|
+
return utcHourKey(startOfUtcSixHour(typeof value === "number" ? value : value.getTime()));
|
|
44
|
+
}
|
|
45
|
+
/** Inclusive trailing UTC day window ending on today's UTC day. */
|
|
46
|
+
function trailingUtcDayWindow(nowMs, dayCount) {
|
|
47
|
+
const end = startOfUtcDay(nowMs);
|
|
48
|
+
const start = new Date(end);
|
|
49
|
+
start.setUTCDate(start.getUTCDate() - (dayCount - 1));
|
|
50
|
+
return {
|
|
51
|
+
end,
|
|
52
|
+
start
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** Inclusive trailing UTC hour window ending on the current UTC hour. */
|
|
56
|
+
function trailingUtcHourWindow(nowMs, hourCount = 24) {
|
|
57
|
+
const end = startOfUtcHour(nowMs);
|
|
58
|
+
return {
|
|
59
|
+
end,
|
|
60
|
+
start: /* @__PURE__ */ new Date(end.getTime() - (hourCount - 1) * HOUR_MS)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** Inclusive trailing UTC 6-hour window ending on the current 6h bucket. */
|
|
64
|
+
function trailingUtcSixHourWindow(nowMs, bucketCount = 28) {
|
|
65
|
+
const end = startOfUtcSixHour(nowMs);
|
|
66
|
+
return {
|
|
67
|
+
end,
|
|
68
|
+
start: /* @__PURE__ */ new Date(end.getTime() - (bucketCount - 1) * SIX_HOUR_MS)
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** Fill a fixed UTC day window from a sparse map. */
|
|
72
|
+
function fillUtcDays(args) {
|
|
73
|
+
const { end, start } = trailingUtcDayWindow(args.nowMs, args.count);
|
|
74
|
+
const items = [];
|
|
75
|
+
for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setUTCDate(cursor.getUTCDate() + 1)) {
|
|
76
|
+
const date = utcDayKey(cursor);
|
|
77
|
+
items.push(args.rows.get(date) ?? args.empty(date));
|
|
78
|
+
}
|
|
79
|
+
return items;
|
|
80
|
+
}
|
|
81
|
+
/** Fill a fixed UTC hour window from a sparse map. */
|
|
82
|
+
function fillUtcHours(args) {
|
|
83
|
+
const hourCount = args.count ?? 24;
|
|
84
|
+
const { end, start } = trailingUtcHourWindow(args.nowMs, hourCount);
|
|
85
|
+
const items = [];
|
|
86
|
+
for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setTime(cursor.getTime() + HOUR_MS)) {
|
|
87
|
+
const date = utcHourKey(cursor);
|
|
88
|
+
items.push(args.rows.get(date) ?? args.empty(date));
|
|
89
|
+
}
|
|
90
|
+
return items;
|
|
91
|
+
}
|
|
92
|
+
/** Fill a fixed UTC 6-hour window from a map of known rows. */
|
|
93
|
+
function fillUtcSixHours(args) {
|
|
94
|
+
const bucketCount = args.count ?? 28;
|
|
95
|
+
const { end, start } = trailingUtcSixHourWindow(args.nowMs, bucketCount);
|
|
96
|
+
const items = [];
|
|
97
|
+
for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setTime(cursor.getTime() + SIX_HOUR_MS)) {
|
|
98
|
+
const date = utcSixHourKey(cursor);
|
|
99
|
+
items.push(args.rows.get(date) ?? args.empty(date));
|
|
100
|
+
}
|
|
101
|
+
return items;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Sum hour rows into trailing 6-hour buckets.
|
|
105
|
+
* Adds number fields. Keeps other fields from the first row in the bucket.
|
|
106
|
+
* Sets `date` to the 6-hour bucket key.
|
|
107
|
+
*/
|
|
108
|
+
function sumUtcHoursIntoSixHours(args) {
|
|
109
|
+
const bucketCount = args.count ?? 28;
|
|
110
|
+
const bySix = /* @__PURE__ */ new Map();
|
|
111
|
+
for (const hour of args.hours) {
|
|
112
|
+
const key = utcSixHourKey(Date.parse(`${hour.date}:00:00.000Z`));
|
|
113
|
+
const next = {
|
|
114
|
+
...bySix.get(key) ?? args.empty(key),
|
|
115
|
+
date: key
|
|
116
|
+
};
|
|
117
|
+
for (const [field, value] of Object.entries(hour)) {
|
|
118
|
+
if (field === "date") continue;
|
|
119
|
+
if (typeof value === "number") {
|
|
120
|
+
const prior = next[field];
|
|
121
|
+
next[field] = (typeof prior === "number" ? prior : 0) + value;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
bySix.set(key, next);
|
|
125
|
+
}
|
|
126
|
+
return fillUtcSixHours({
|
|
127
|
+
count: bucketCount,
|
|
128
|
+
empty: args.empty,
|
|
129
|
+
nowMs: args.nowMs,
|
|
130
|
+
rows: bySix
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/api/schema/code.ts
|
|
135
|
+
const codeChangeSummarySchema = z.object({
|
|
136
|
+
closed: z.number().int().nonnegative(),
|
|
137
|
+
costUsd: z.number().nonnegative().optional(),
|
|
138
|
+
created: z.number().int().nonnegative(),
|
|
139
|
+
medianCostUsd: z.number().nonnegative().optional(),
|
|
140
|
+
medianMergeTimeMs: z.number().nonnegative().optional(),
|
|
141
|
+
merged: z.number().int().nonnegative(),
|
|
142
|
+
mergeRate: z.number().min(0).max(1).optional(),
|
|
143
|
+
open: z.number().int().nonnegative()
|
|
144
|
+
}).strict();
|
|
145
|
+
/** UTC day (`YYYY-MM-DD`) or hour (`YYYY-MM-DDTHH`) activity bucket key. */
|
|
146
|
+
const codeMetricBucketSchema = z.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
|
|
147
|
+
const codeActivityDaySchema = z.object({
|
|
148
|
+
closed: z.number().int().nonnegative(),
|
|
149
|
+
created: z.number().int().nonnegative(),
|
|
150
|
+
date: codeMetricBucketSchema,
|
|
151
|
+
merged: z.number().int().nonnegative()
|
|
152
|
+
}).strict();
|
|
153
|
+
const codeRepositorySummarySchema = z.object({
|
|
154
|
+
closed: z.number().int().nonnegative(),
|
|
155
|
+
created: z.number().int().nonnegative(),
|
|
156
|
+
id: z.string().uuid(),
|
|
157
|
+
medianCostUsd: z.number().nonnegative().optional(),
|
|
158
|
+
merged: z.number().int().nonnegative(),
|
|
159
|
+
mergeRate: z.number().min(0).max(1).optional(),
|
|
160
|
+
name: z.string().min(1),
|
|
161
|
+
open: z.number().int().nonnegative(),
|
|
162
|
+
provider: z.string().min(1),
|
|
163
|
+
url: z.string().url().optional()
|
|
164
|
+
}).strict();
|
|
165
|
+
const codeChangeSummaryReportSchema = z.object({
|
|
166
|
+
closedAt: z.string().optional(),
|
|
167
|
+
id: z.string().uuid(),
|
|
168
|
+
mergedAt: z.string().optional(),
|
|
169
|
+
number: z.number().int().positive(),
|
|
170
|
+
openedAt: z.string(),
|
|
171
|
+
provider: z.string().min(1),
|
|
172
|
+
repository: z.string().min(1),
|
|
173
|
+
state: codeChangeStateSchema,
|
|
174
|
+
title: z.string().optional(),
|
|
175
|
+
url: z.string().url().optional()
|
|
176
|
+
}).strict();
|
|
177
|
+
const codeOverviewReportSchema = z.object({
|
|
178
|
+
activityDays: z.array(codeActivityDaySchema),
|
|
179
|
+
activityHours: z.array(codeActivityDaySchema).optional(),
|
|
180
|
+
activitySixHours: z.array(codeActivityDaySchema).optional(),
|
|
181
|
+
changes: z.array(codeChangeSummaryReportSchema),
|
|
182
|
+
generatedAt: z.string(),
|
|
183
|
+
repositories: z.array(codeRepositorySummarySchema),
|
|
184
|
+
summary: codeChangeSummarySchema,
|
|
185
|
+
windowEnd: z.string(),
|
|
186
|
+
windowStart: z.string()
|
|
187
|
+
}).strict();
|
|
188
|
+
/** Person-scoped code activity for one People profile. */
|
|
189
|
+
const codePersonReportSchema = z.object({
|
|
190
|
+
activityDays: z.array(codeActivityDaySchema),
|
|
191
|
+
activityHours: z.array(codeActivityDaySchema).optional(),
|
|
192
|
+
activitySixHours: z.array(codeActivityDaySchema).optional(),
|
|
193
|
+
generatedAt: z.string(),
|
|
194
|
+
summary: codeChangeSummarySchema,
|
|
195
|
+
windowEnd: z.string(),
|
|
196
|
+
windowStart: z.string()
|
|
197
|
+
}).strict();
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/api/activity.ts
|
|
200
|
+
const dailyConversationActivitySchema = z.object({
|
|
201
|
+
active: z.number(),
|
|
202
|
+
conversations: z.number(),
|
|
203
|
+
date: z.string(),
|
|
204
|
+
durationMs: z.number(),
|
|
205
|
+
failed: z.number(),
|
|
206
|
+
tokens: z.number().optional()
|
|
207
|
+
}).strict();
|
|
208
|
+
/** Build a zeroed day for conversation activity projections. */
|
|
209
|
+
function emptyActivityDay(date) {
|
|
210
|
+
return {
|
|
211
|
+
active: 0,
|
|
212
|
+
conversations: 0,
|
|
213
|
+
date,
|
|
214
|
+
durationMs: 0,
|
|
215
|
+
failed: 0
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
/** Fill a fixed UTC day window from sparse conversation activity. */
|
|
219
|
+
function activityDays(days, nowMs, count) {
|
|
220
|
+
return fillUtcDays({
|
|
221
|
+
count,
|
|
222
|
+
empty: emptyActivityDay,
|
|
223
|
+
nowMs,
|
|
224
|
+
rows: days
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Fill the trailing 7-day UTC hour window from known hour rows.
|
|
229
|
+
* 24h charts use the last 24 points. 7d charts sum hours into 6-hour buckets.
|
|
230
|
+
*/
|
|
231
|
+
function activityHours(hours, nowMs) {
|
|
232
|
+
return fillUtcHours({
|
|
233
|
+
count: 168,
|
|
234
|
+
empty: emptyActivityDay,
|
|
235
|
+
nowMs,
|
|
236
|
+
rows: hours
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Fill trailing 6-hour buckets from hour keys or hour rows.
|
|
241
|
+
* Hour keys must be summed into 6-hour keys first.
|
|
242
|
+
*/
|
|
243
|
+
function activitySixHours(hours, nowMs) {
|
|
244
|
+
return sumUtcHoursIntoSixHours({
|
|
245
|
+
empty: emptyActivityDay,
|
|
246
|
+
hours: hours instanceof Map ? activityHours(hours, nowMs) : [...hours],
|
|
247
|
+
nowMs
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region src/api/schema/location.ts
|
|
252
|
+
const locationParamsSchema = z.object({ locationId: z.string().min(1) }).strict();
|
|
253
|
+
const locationSummaryReportSchema = conversationStatsItemSchema.extend({
|
|
254
|
+
id: z.string(),
|
|
255
|
+
firstSeenAt: z.string(),
|
|
256
|
+
kind: juniorDestinationKindSchema,
|
|
257
|
+
lastSeenAt: z.string(),
|
|
258
|
+
provider: z.string(),
|
|
259
|
+
providerDestinationId: z.string(),
|
|
260
|
+
visibility: z.literal("public")
|
|
261
|
+
}).strict();
|
|
262
|
+
const locationActorSummaryReportSchema = conversationStatsItemSchema.extend({ actor: actorIdentitySchema }).strict();
|
|
263
|
+
/** UTC day (`YYYY-MM-DD`) or hour (`YYYY-MM-DDTHH`) activity bucket key. */
|
|
264
|
+
const locationMetricBucketSchema = z.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
|
|
265
|
+
const locationActivityDayReportSchema = z.object({
|
|
266
|
+
date: locationMetricBucketSchema,
|
|
267
|
+
privateConversations: z.number(),
|
|
268
|
+
publicConversations: z.number()
|
|
269
|
+
}).strict();
|
|
270
|
+
const locationDirectoryReportSchema = z.object({
|
|
271
|
+
activityDays: z.array(locationActivityDayReportSchema),
|
|
272
|
+
activityHours: z.array(locationActivityDayReportSchema).optional(),
|
|
273
|
+
activitySixHours: z.array(locationActivityDayReportSchema).optional(),
|
|
274
|
+
generatedAt: z.string(),
|
|
275
|
+
locations: z.array(locationSummaryReportSchema),
|
|
276
|
+
privateActivity: conversationStatsItemSchema,
|
|
277
|
+
source: z.literal("conversation_index"),
|
|
278
|
+
windowEnd: z.string(),
|
|
279
|
+
windowStart: z.string()
|
|
280
|
+
}).strict();
|
|
281
|
+
const locationDetailReportSchema = locationSummaryReportSchema.extend({
|
|
282
|
+
activityDays: z.array(dailyConversationActivitySchema),
|
|
283
|
+
activityHours: z.array(dailyConversationActivitySchema).optional(),
|
|
284
|
+
activitySixHours: z.array(dailyConversationActivitySchema).optional(),
|
|
285
|
+
actors: z.array(locationActorSummaryReportSchema),
|
|
286
|
+
generatedAt: z.string(),
|
|
287
|
+
recentConversations: z.array(conversationSummaryReportSchema),
|
|
288
|
+
source: z.literal("conversation_index"),
|
|
289
|
+
windowEnd: z.string(),
|
|
290
|
+
windowStart: z.string()
|
|
291
|
+
}).strict();
|
|
292
|
+
//#endregion
|
|
293
|
+
//#region src/api/schema/person.ts
|
|
294
|
+
const personParamsSchema = z.object({ email: z.string().trim().min(1) }).strict();
|
|
295
|
+
const peopleConversationStatsItemSchema = conversationStatsItemSchema.omit({ costUsd: true });
|
|
296
|
+
/** UTC day (`YYYY-MM-DD`) or hour (`YYYY-MM-DDTHH`) activity bucket key. */
|
|
297
|
+
const peopleMetricBucketSchema = z.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
|
|
298
|
+
const actorActivityDayReportSchema = z.object({
|
|
299
|
+
active: z.number(),
|
|
300
|
+
conversations: z.number(),
|
|
301
|
+
costUsd: z.number().optional(),
|
|
302
|
+
date: peopleMetricBucketSchema,
|
|
303
|
+
durationMs: z.number(),
|
|
304
|
+
failed: z.number(),
|
|
305
|
+
tokens: z.number().optional()
|
|
306
|
+
}).strict();
|
|
307
|
+
const peopleActivityDayReportSchema = z.object({
|
|
308
|
+
activePeople: z.number(),
|
|
309
|
+
conversations: z.number(),
|
|
310
|
+
date: peopleMetricBucketSchema
|
|
311
|
+
}).strict();
|
|
312
|
+
const actorTotalsReportSchema = z.object({
|
|
313
|
+
active: z.number(),
|
|
314
|
+
activeDays: z.number(),
|
|
315
|
+
conversations: z.number(),
|
|
316
|
+
durationMs: z.number(),
|
|
317
|
+
failed: z.number(),
|
|
318
|
+
tokens: z.number().optional()
|
|
319
|
+
}).strict();
|
|
320
|
+
/** Spend and activity for one people-directory range, plus the prior period's spend. */
|
|
321
|
+
const actorWindowMetricsSchema = z.object({
|
|
322
|
+
conversations: z.number().int().nonnegative(),
|
|
323
|
+
costUsd: z.number().finite().nonnegative(),
|
|
324
|
+
durationMs: z.number().finite().nonnegative(),
|
|
325
|
+
priorCostUsd: z.number().finite().nonnegative()
|
|
326
|
+
}).strict();
|
|
327
|
+
/** People-directory ranges that match the dashboard range control. */
|
|
328
|
+
const actorDirectoryWindowsSchema = z.object({
|
|
329
|
+
1: actorWindowMetricsSchema,
|
|
330
|
+
7: actorWindowMetricsSchema,
|
|
331
|
+
30: actorWindowMetricsSchema,
|
|
332
|
+
90: actorWindowMetricsSchema
|
|
333
|
+
}).strict();
|
|
334
|
+
const identifiedActorSchema = actorIdentitySchema.extend({ email: z.string().min(1) }).strict();
|
|
335
|
+
const actorSummaryReportSchema = actorTotalsReportSchema.extend({
|
|
336
|
+
firstSeenAt: z.string(),
|
|
337
|
+
lastSeenAt: z.string(),
|
|
338
|
+
actor: identifiedActorSchema,
|
|
339
|
+
windows: actorDirectoryWindowsSchema
|
|
340
|
+
}).strict();
|
|
341
|
+
const actorDirectoryReportSchema = z.object({
|
|
342
|
+
activityDays: z.array(peopleActivityDayReportSchema),
|
|
343
|
+
activityHours: z.array(peopleActivityDayReportSchema).optional(),
|
|
344
|
+
activitySixHours: z.array(peopleActivityDayReportSchema).optional(),
|
|
345
|
+
generatedAt: z.string(),
|
|
346
|
+
people: z.array(actorSummaryReportSchema),
|
|
347
|
+
source: z.literal("conversation_index"),
|
|
348
|
+
windowEnd: z.string(),
|
|
349
|
+
windowStart: z.string()
|
|
350
|
+
}).strict();
|
|
351
|
+
const actorProfileReportSchema = z.object({
|
|
352
|
+
activityDays: z.array(actorActivityDayReportSchema),
|
|
353
|
+
activityHours: z.array(actorActivityDayReportSchema).optional(),
|
|
354
|
+
activitySixHours: z.array(actorActivityDayReportSchema).optional(),
|
|
355
|
+
generatedAt: z.string(),
|
|
356
|
+
locations: z.array(peopleConversationStatsItemSchema),
|
|
357
|
+
recentConversations: z.array(conversationSummaryReportSchema),
|
|
358
|
+
actor: identifiedActorSchema,
|
|
359
|
+
source: z.literal("conversation_index"),
|
|
360
|
+
surfaces: z.array(peopleConversationStatsItemSchema),
|
|
361
|
+
totals: actorTotalsReportSchema,
|
|
362
|
+
windowEnd: z.string(),
|
|
363
|
+
windowStart: z.string()
|
|
364
|
+
}).strict();
|
|
365
|
+
const personalSpendReportSchema = z.object({
|
|
366
|
+
generatedAt: z.string(),
|
|
367
|
+
sevenDaysUsd: z.number().finite().nonnegative(),
|
|
368
|
+
source: z.literal("conversation_index"),
|
|
369
|
+
thirtyDaysUsd: z.number().finite().nonnegative(),
|
|
370
|
+
windowEnd: z.string(),
|
|
371
|
+
windowStart: z.string()
|
|
372
|
+
}).strict();
|
|
373
|
+
//#endregion
|
|
374
|
+
//#region src/api/schema/personal-token.ts
|
|
375
|
+
const personalTokenMetadataSchema = z.object({
|
|
376
|
+
id: z.string().uuid(),
|
|
377
|
+
name: z.string(),
|
|
378
|
+
tokenSuffix: z.string(),
|
|
379
|
+
createdAt: z.string().datetime(),
|
|
380
|
+
expiresAt: z.string().datetime(),
|
|
381
|
+
lastUsedAt: z.string().datetime().nullable()
|
|
382
|
+
}).strict();
|
|
383
|
+
const personalTokenListSchema = z.object({ tokens: z.array(personalTokenMetadataSchema) }).strict();
|
|
384
|
+
const createPersonalTokenBodySchema = z.object({ name: z.string().trim().min(1).max(80) }).strict();
|
|
385
|
+
const createdPersonalTokenSchema = personalTokenMetadataSchema.extend({ token: z.string().startsWith("jr_pat_") }).strict();
|
|
386
|
+
const personalTokenParamsSchema = z.object({ id: z.string().uuid() }).strict();
|
|
387
|
+
const revokePersonalTokenResponseSchema = z.object({ revoked: z.literal(true) }).strict();
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/api/schema/automation.ts
|
|
390
|
+
const automationDestinationSchema = z.object({
|
|
391
|
+
channelId: z.string().min(1),
|
|
392
|
+
label: z.string().min(1),
|
|
393
|
+
teamId: z.string().min(1),
|
|
394
|
+
visibility: z.enum(["private", "public"])
|
|
395
|
+
}).strict();
|
|
396
|
+
/** Automation run counts for the dashboard range control (24h/7d/30d/90d). */
|
|
397
|
+
const automationRunWindowsSchema = z.object({
|
|
398
|
+
1: z.number().int().nonnegative(),
|
|
399
|
+
7: z.number().int().nonnegative(),
|
|
400
|
+
30: z.number().int().nonnegative(),
|
|
401
|
+
90: z.number().int().nonnegative()
|
|
402
|
+
}).strict();
|
|
403
|
+
const automationSummaryBaseSchema = z.object({
|
|
404
|
+
createdAt: z.string().datetime(),
|
|
405
|
+
createdBy: z.string().min(1),
|
|
406
|
+
createdByEmail: z.string().trim().email().optional(),
|
|
407
|
+
destination: automationDestinationSchema,
|
|
408
|
+
id: z.string().min(1),
|
|
409
|
+
instruction: z.string().min(1),
|
|
410
|
+
lastConversationId: z.string().min(1).optional(),
|
|
411
|
+
lastRunAt: z.string().datetime().optional(),
|
|
412
|
+
ownedByViewer: z.boolean(),
|
|
413
|
+
runs: automationRunWindowsSchema,
|
|
414
|
+
outcomes: z.array(taskOutcomeSchema).max(5),
|
|
415
|
+
/** Short display title; falls back from instruction when unset. */
|
|
416
|
+
title: z.string().min(1),
|
|
417
|
+
totalRuns: z.number().int().nonnegative()
|
|
418
|
+
});
|
|
419
|
+
const scheduledAutomationSummarySchema = automationSummaryBaseSchema.extend({
|
|
420
|
+
kind: z.literal("scheduled"),
|
|
421
|
+
nextRunAt: z.string().datetime().optional(),
|
|
422
|
+
schedule: z.string().min(1),
|
|
423
|
+
status: z.enum([
|
|
424
|
+
"active",
|
|
425
|
+
"blocked",
|
|
426
|
+
"completed"
|
|
427
|
+
])
|
|
428
|
+
}).strict();
|
|
429
|
+
const eventAutomationSummarySchema = automationSummaryBaseSchema.extend({
|
|
430
|
+
events: z.array(z.string().min(1)).min(1),
|
|
431
|
+
kind: z.literal("event"),
|
|
432
|
+
resource: z.string().min(1),
|
|
433
|
+
source: z.string().min(1),
|
|
434
|
+
triggerAvailable: z.boolean()
|
|
435
|
+
}).strict();
|
|
436
|
+
const automationSummarySchema = z.discriminatedUnion("kind", [scheduledAutomationSummarySchema, eventAutomationSummarySchema]);
|
|
437
|
+
/** UTC day (`YYYY-MM-DD`) or hour (`YYYY-MM-DDTHH`) execution bucket key. */
|
|
438
|
+
const automationMetricBucketSchema = z.string().regex(/^\d{4}-\d{2}-\d{2}(T\d{2})?$/);
|
|
439
|
+
/** One UTC day/hour of completed automation executions stacked by automation type. */
|
|
440
|
+
const automationExecutionDaySchema = z.object({
|
|
441
|
+
/** Linked conversation spend for executions in this bucket. */
|
|
442
|
+
costUsd: z.number().finite().nonnegative(),
|
|
443
|
+
date: automationMetricBucketSchema,
|
|
444
|
+
event: z.number().int().nonnegative(),
|
|
445
|
+
scheduled: z.number().int().nonnegative()
|
|
446
|
+
}).strict();
|
|
447
|
+
const automationListQuerySchema = z.object({ q: z.string().trim().max(200).optional() }).strict();
|
|
448
|
+
const automationListSchema = z.object({
|
|
449
|
+
executionDays: z.array(automationExecutionDaySchema),
|
|
450
|
+
executionHours: z.array(automationExecutionDaySchema).optional(),
|
|
451
|
+
executionSixHours: z.array(automationExecutionDaySchema).optional(),
|
|
452
|
+
automations: z.array(automationSummarySchema),
|
|
453
|
+
truncated: z.boolean()
|
|
454
|
+
}).strict();
|
|
455
|
+
const automationParamsSchema = z.object({
|
|
456
|
+
id: z.string().min(1),
|
|
457
|
+
kind: z.enum(["scheduled", "event"])
|
|
458
|
+
}).strict();
|
|
459
|
+
const automationExecutionStatusSchema = z.enum([
|
|
460
|
+
"blocked",
|
|
461
|
+
"completed",
|
|
462
|
+
"failed"
|
|
463
|
+
]);
|
|
464
|
+
const automationExecutionSchema = z.object({
|
|
465
|
+
conversationId: z.string().min(1).optional(),
|
|
466
|
+
/** Estimated model cost for the linked conversation, when known. */
|
|
467
|
+
costUsd: z.number().finite().nonnegative().optional(),
|
|
468
|
+
/** Cumulative conversation runtime in milliseconds, when known. */
|
|
469
|
+
durationMs: z.number().finite().nonnegative().optional(),
|
|
470
|
+
executedAt: z.string().datetime(),
|
|
471
|
+
executionId: z.string().min(1),
|
|
472
|
+
status: automationExecutionStatusSchema,
|
|
473
|
+
title: z.string().min(1).optional(),
|
|
474
|
+
/** Cumulative conversation token total, when known. */
|
|
475
|
+
totalTokens: z.number().int().nonnegative().optional()
|
|
476
|
+
}).strict();
|
|
477
|
+
/** One UTC day/hour of terminal executions for a single automation, stacked by status. */
|
|
478
|
+
const automationExecutionStatusDaySchema = z.object({
|
|
479
|
+
blocked: z.number().int().nonnegative(),
|
|
480
|
+
completed: z.number().int().nonnegative(),
|
|
481
|
+
date: automationMetricBucketSchema,
|
|
482
|
+
failed: z.number().int().nonnegative()
|
|
483
|
+
}).strict();
|
|
484
|
+
const automationExecutionListSchema = z.object({
|
|
485
|
+
executionDays: z.array(automationExecutionStatusDaySchema),
|
|
486
|
+
executionHours: z.array(automationExecutionStatusDaySchema).optional(),
|
|
487
|
+
executionSixHours: z.array(automationExecutionStatusDaySchema).optional(),
|
|
488
|
+
executions: z.array(automationExecutionSchema),
|
|
489
|
+
automation: automationSummarySchema,
|
|
490
|
+
truncated: z.boolean()
|
|
491
|
+
}).strict();
|
|
492
|
+
const automationRunSchema = automationExecutionSchema.extend({
|
|
493
|
+
kind: z.enum(["scheduled", "event"]),
|
|
494
|
+
automationId: z.string().min(1),
|
|
495
|
+
automationTitle: z.string().min(1)
|
|
496
|
+
}).strict();
|
|
497
|
+
const automationRunListSchema = z.object({
|
|
498
|
+
runs: z.array(automationRunSchema),
|
|
499
|
+
truncated: z.boolean()
|
|
500
|
+
}).strict();
|
|
501
|
+
//#endregion
|
|
502
|
+
//#region src/api/schema/workspace.ts
|
|
503
|
+
const workspaceRepoInputSchema = z.object({
|
|
504
|
+
provider: z.string(),
|
|
505
|
+
repo: z.string()
|
|
506
|
+
}).strict();
|
|
507
|
+
const workspaceRepoSchema = z.object({
|
|
508
|
+
provider: z.string(),
|
|
509
|
+
repo: z.string(),
|
|
510
|
+
checkoutPath: z.string()
|
|
511
|
+
}).strict();
|
|
512
|
+
const workspaceSnapshotSchema = z.object({
|
|
513
|
+
id: z.string(),
|
|
514
|
+
generatedAt: z.iso.datetime(),
|
|
515
|
+
buildDurationMs: z.number().int().nonnegative(),
|
|
516
|
+
sizeBytes: z.number().int().nonnegative().nullable()
|
|
517
|
+
}).strict();
|
|
518
|
+
/** Install-wide baseline Sandbox snapshot used when no Workspace recipe is selected. */
|
|
519
|
+
const baselineSnapshotSchema = z.object({
|
|
520
|
+
id: z.string(),
|
|
521
|
+
generatedAt: z.iso.datetime(),
|
|
522
|
+
buildDurationMs: z.number().int().nonnegative(),
|
|
523
|
+
dependencyCount: z.number().int().nonnegative()
|
|
524
|
+
}).strict();
|
|
525
|
+
const workspaceSchema = z.object({
|
|
526
|
+
id: z.string().uuid(),
|
|
527
|
+
name: z.string(),
|
|
528
|
+
setupScript: z.string(),
|
|
529
|
+
repos: z.array(workspaceRepoSchema),
|
|
530
|
+
snapshot: workspaceSnapshotSchema.nullable()
|
|
531
|
+
}).strict();
|
|
532
|
+
const workspaceListSchema = z.object({
|
|
533
|
+
baselineSnapshot: baselineSnapshotSchema.nullable(),
|
|
534
|
+
workspaces: z.array(workspaceSchema)
|
|
535
|
+
}).strict();
|
|
536
|
+
const workspaceBodySchema = z.object({
|
|
537
|
+
name: z.string(),
|
|
538
|
+
setupScript: z.string().optional(),
|
|
539
|
+
repos: z.array(workspaceRepoInputSchema)
|
|
540
|
+
}).strict();
|
|
541
|
+
const workspaceParamsSchema = z.object({ id: z.string().uuid() }).strict();
|
|
542
|
+
const deleteWorkspaceResponseSchema = z.object({ deleted: z.literal(true) }).strict();
|
|
543
|
+
//#endregion
|
|
544
|
+
//#region src/api/schema/stats.ts
|
|
545
|
+
const statSchema = z.object({
|
|
546
|
+
count: z.number().int().nonnegative(),
|
|
547
|
+
date: z.string(),
|
|
548
|
+
metric: z.string().min(1),
|
|
549
|
+
name: z.string().min(1),
|
|
550
|
+
namespace: z.string().min(1)
|
|
551
|
+
}).strict();
|
|
552
|
+
const statsReportSchema = z.object({
|
|
553
|
+
generatedAt: z.string().datetime(),
|
|
554
|
+
stats: z.array(statSchema),
|
|
555
|
+
windowEnd: z.string(),
|
|
556
|
+
windowStart: z.string()
|
|
557
|
+
}).strict();
|
|
558
|
+
//#endregion
|
|
559
|
+
export { sumUtcHoursIntoSixHours as $, actorProfileReportSchema as A, dailyConversationActivitySchema as B, createPersonalTokenBodySchema as C, personalTokenParamsSchema as D, personalTokenMetadataSchema as E, locationDirectoryReportSchema as F, codePersonReportSchema as G, codeChangeSummaryReportSchema as H, locationParamsSchema as I, HOUR_MS as J, codeRepositorySummarySchema as K, activityDays as L, personalSpendReportSchema as M, locationActivityDayReportSchema as N, revokePersonalTokenResponseSchema as O, locationDetailReportSchema as P, startOfUtcHour as Q, activityHours as R, scheduledAutomationSummarySchema as S, personalTokenListSchema as T, codeChangeSummarySchema as U, codeActivityDaySchema as V, codeOverviewReportSchema as W, fillUtcHours as X, fillUtcDays as Y, fillUtcSixHours as Z, automationRunListSchema as _, workspaceBodySchema as a, apiErrorSchema as at, automationSummarySchema as b, workspaceRepoSchema as c, automationExecutionSchema as d, trailingUtcDayWindow as et, automationExecutionStatusDaySchema as f, automationParamsSchema as g, automationListSchema as h, deleteWorkspaceResponseSchema as i, utcHourKey as it, personParamsSchema as j, actorDirectoryReportSchema as k, workspaceSchema as l, automationListQuerySchema as m, statsReportSchema as n, trailingUtcSixHourWindow as nt, workspaceListSchema as o, automationExecutionStatusSchema as p, DAY_MS as q, baselineSnapshotSchema as r, utcDayKey as rt, workspaceParamsSchema as s, statSchema as t, trailingUtcHourWindow as tt, automationExecutionListSchema as u, automationRunSchema as v, createdPersonalTokenSchema as w, eventAutomationSummarySchema as x, automationRunWindowsSchema as y, activitySixHours as z };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import { f as logWarn } from "./logging-
|
|
2
|
+
import { f as logWarn } from "./logging-Dx0S5k2z.js";
|
|
3
3
|
import { s as skillRoots } from "./package-discovery-7a9YqLhE.js";
|
|
4
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
4
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-1BZEOR8J.js";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import fs from "node:fs/promises";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import { C as toolInvocationDestination, y as actorFromRun } from "./agent-runner-
|
|
3
|
-
import { n as createAndEnqueueAgentInvocation } from "./work-
|
|
2
|
+
import { C as toolInvocationDestination, y as actorFromRun } from "./agent-runner-CQD4HKK2.js";
|
|
3
|
+
import { n as createAndEnqueueAgentInvocation } from "./work-BEzDU_2x.js";
|
|
4
4
|
//#region src/chat/agent-invocations/spawn.ts
|
|
5
5
|
var spawn_exports = /* @__PURE__ */ __exportAll({ bindSpawnAgent: () => bindSpawnAgent });
|
|
6
6
|
/** Bind a Run's Actor and credentials to new Agent invocations. */
|