@sentry/junior 0.182.0 → 0.183.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-hooks-3S25UIHO.js → agent-hooks-SNRBZYAU.js} +11 -11
- package/dist/api/code/overview.d.ts +35 -0
- package/dist/api/code/routes.d.ts +4 -0
- package/dist/api/schema/code.d.ts +75 -0
- package/dist/api/schema.d.ts +2 -0
- package/dist/api/schema.js +9 -1
- package/dist/api.js +258 -134
- package/dist/app.js +71 -48
- package/dist/{catalog-runtime-ESLMBQBV.js → catalog-runtime-3I3JOIIH.js} +4 -4
- package/dist/chat/agent-invocations/store.d.ts +4 -2
- package/dist/chat/agent-invocations/work.d.ts +1 -3
- package/dist/chat/app/factory.d.ts +3 -3
- package/dist/chat/app/services.d.ts +3 -3
- package/dist/chat/code/publisher.d.ts +3 -0
- package/dist/chat/code/store.d.ts +9 -0
- package/dist/chat/event-tasks/store.d.ts +10 -0
- package/dist/chat/ingress/slack-webhook.d.ts +1 -1
- package/dist/chat/plugins/agent-hooks.d.ts +5 -0
- package/dist/chat/{runtime/slack-runtime.d.ts → providers/slack/runtime.d.ts} +2 -2
- package/dist/chat/{runtime/reply-executor.d.ts → providers/slack/turn.d.ts} +10 -9
- package/dist/chat/resource-events/store.d.ts +12 -0
- package/dist/chat/runtime/turn-execution.d.ts +30 -0
- package/dist/chat/slack/dispatch-turn.d.ts +12 -14
- package/dist/chat/task-execution/slack-work.d.ts +1 -1
- package/dist/{chunk-SXOZIG5X.js → chunk-24OJZ5OU.js} +6 -6
- package/dist/{chunk-SVFSYQMT.js → chunk-2ADFGSUS.js} +1 -1
- package/dist/{chunk-GGYA5NPN.js → chunk-2EPYYVJC.js} +8 -8
- package/dist/{chunk-KGMHUDVF.js → chunk-35PM4YY5.js} +6 -6
- package/dist/{chunk-3ENUMZNG.js → chunk-37IQ6DGU.js} +3 -3
- package/dist/{chunk-3THPTNN6.js → chunk-3HJ4F4L7.js} +4 -4
- package/dist/{chunk-3NFHI2NA.js → chunk-3L7CWDQQ.js} +1 -1
- package/dist/{chunk-CVBIM4Z3.js → chunk-4WGFWHWP.js} +1 -1
- package/dist/{chunk-YHL2L2ZZ.js → chunk-56XONJPF.js} +1 -1
- package/dist/{chunk-44BQ3TSK.js → chunk-6UXDTPEN.js} +233 -173
- package/dist/{chunk-2CEOXDG2.js → chunk-AHMWPFIW.js} +174 -6
- package/dist/{chunk-6TSWXBTQ.js → chunk-AX3UDIMA.js} +3 -3
- package/dist/{chunk-S35OZMSL.js → chunk-AYW7J6K4.js} +13 -13
- package/dist/{chunk-WOIALVN2.js → chunk-E3OBGRHN.js} +1 -1
- package/dist/{chunk-4DZ62L36.js → chunk-EENQGEIP.js} +1 -1
- package/dist/{chunk-UUMBHORH.js → chunk-FJMTMGBC.js} +1 -1
- package/dist/{chunk-Z7ALSQS3.js → chunk-G2B2XZQW.js} +1 -1
- package/dist/{chunk-TEFNHMO2.js → chunk-HUK5XIZL.js} +4 -4
- package/dist/{chunk-LT4QYGKM.js → chunk-IO6KFXYE.js} +160 -97
- package/dist/{chunk-JIOKUIAS.js → chunk-KTXOGLNE.js} +2 -2
- package/dist/{chunk-LHQK5XCU.js → chunk-LMNMMESF.js} +2 -2
- package/dist/{chunk-UQP54CXZ.js → chunk-LZBPGX5A.js} +1 -1
- package/dist/{chunk-PQES5LB5.js → chunk-PLZT45VC.js} +5 -5
- package/dist/{chunk-V5UZCCNW.js → chunk-QI5JW5AG.js} +6 -6
- package/dist/{chunk-A7THOQ6N.js → chunk-QZV76CM4.js} +21 -21
- package/dist/{chunk-LB4FWMCV.js → chunk-R767Y7QV.js} +183 -155
- package/dist/{chunk-MJISSOWB.js → chunk-SQHFVIMZ.js} +1 -1
- package/dist/{chunk-BDDWVY32.js → chunk-T5MTGX2E.js} +19 -19
- package/dist/{chunk-DZR3L74W.js → chunk-V64JCZUV.js} +3 -3
- package/dist/{chunk-VHMAFMHB.js → chunk-VOV3SCM3.js} +1 -1
- package/dist/{chunk-BZD4ADQH.js → chunk-W46NIB5H.js} +1 -1
- package/dist/{chunk-QHALFHZA.js → chunk-W5JMPEBO.js} +9 -9
- package/dist/{chunk-D6OHGAIO.js → chunk-WOKJRLM2.js} +5 -5
- package/dist/chunk-WVIA7V3M.js +975 -0
- package/dist/{chunk-UKIHNBBD.js → chunk-X52ESOBP.js} +3 -3
- package/dist/cli/chat.js +33 -35
- package/dist/cli/check.js +5 -5
- package/dist/cli/plugins.js +12 -12
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +6 -6
- package/dist/db/schema/code.d.ts +367 -0
- package/dist/db/schema.d.ts +367 -1
- package/dist/{db-NYIWZ4L5.js → db-K2VMNLHQ.js} +6 -6
- package/dist/instrumentation.js +3 -3
- package/dist/nitro.js +6 -6
- package/dist/{oauth-callback-server-A2YTPVVX.js → oauth-callback-server-DZZMTKSS.js} +25 -25
- package/dist/{runner-VKAEU52J.js → runner-IIAKWDXI.js} +18 -18
- package/dist/{skills-52GMXUTY.js → skills-EXIQ7BP5.js} +5 -5
- package/dist/spawn-ZR6OOEAN.js +37 -0
- package/dist/task-runner-C52HYCVD.js +32 -0
- package/dist/{validation-VD2YQX2W.js → validation-XUGIWBJF.js} +5 -5
- package/dist/version.js +1 -1
- package/dist/{work-ZWBTGEQP.js → work-G4RLJ634.js} +18 -18
- package/dist/worker-R2JEHK67.js +22 -0
- package/migrations/0036_complex_rage.sql +32 -0
- package/migrations/meta/0036_snapshot.json +3186 -0
- package/migrations/meta/_journal.json +8 -1
- package/package.json +6 -6
- package/dist/chunk-CZYNWPWD.js +0 -930
- package/dist/spawn-GSS4EBLR.js +0 -37
- package/dist/task-runner-DUGDWF5O.js +0 -32
- package/dist/worker-XUWD5WS7.js +0 -22
|
@@ -0,0 +1,975 @@
|
|
|
1
|
+
import {
|
|
2
|
+
usageSchema
|
|
3
|
+
} from "./chunk-PDO5BLNM.js";
|
|
4
|
+
import {
|
|
5
|
+
juniorDestinationKindSchema
|
|
6
|
+
} from "./chunk-VFUK3X5B.js";
|
|
7
|
+
|
|
8
|
+
// src/api/activity.ts
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
var dailyConversationActivitySchema = z.object({
|
|
11
|
+
active: z.number(),
|
|
12
|
+
conversations: z.number(),
|
|
13
|
+
date: z.string(),
|
|
14
|
+
durationMs: z.number(),
|
|
15
|
+
failed: z.number(),
|
|
16
|
+
tokens: z.number().optional()
|
|
17
|
+
}).strict();
|
|
18
|
+
function emptyActivityDay(date) {
|
|
19
|
+
return {
|
|
20
|
+
active: 0,
|
|
21
|
+
conversations: 0,
|
|
22
|
+
date,
|
|
23
|
+
durationMs: 0,
|
|
24
|
+
failed: 0
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function activityDays(days, nowMs, count) {
|
|
28
|
+
const items = [];
|
|
29
|
+
const end = new Date(nowMs);
|
|
30
|
+
end.setUTCHours(0, 0, 0, 0);
|
|
31
|
+
const start = new Date(end);
|
|
32
|
+
start.setUTCDate(start.getUTCDate() - (count - 1));
|
|
33
|
+
for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setUTCDate(cursor.getUTCDate() + 1)) {
|
|
34
|
+
const date = cursor.toISOString().slice(0, 10);
|
|
35
|
+
items.push(days.get(date) ?? emptyActivityDay(date));
|
|
36
|
+
}
|
|
37
|
+
return items;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// src/api/schema/code.ts
|
|
41
|
+
import { z as z2 } from "zod";
|
|
42
|
+
import { codeChangeStateSchema } from "@sentry/junior-plugin-api";
|
|
43
|
+
var codeChangeSummarySchema = z2.object({
|
|
44
|
+
closed: z2.number().int().nonnegative(),
|
|
45
|
+
created: z2.number().int().nonnegative(),
|
|
46
|
+
merged: z2.number().int().nonnegative(),
|
|
47
|
+
mergeRate: z2.number().min(0).max(1).optional(),
|
|
48
|
+
open: z2.number().int().nonnegative()
|
|
49
|
+
}).strict();
|
|
50
|
+
var codeRepositorySummarySchema = z2.object({
|
|
51
|
+
closed: z2.number().int().nonnegative(),
|
|
52
|
+
created: z2.number().int().nonnegative(),
|
|
53
|
+
id: z2.string().uuid(),
|
|
54
|
+
merged: z2.number().int().nonnegative(),
|
|
55
|
+
name: z2.string().min(1),
|
|
56
|
+
open: z2.number().int().nonnegative(),
|
|
57
|
+
provider: z2.string().min(1),
|
|
58
|
+
url: z2.string().url().optional()
|
|
59
|
+
}).strict();
|
|
60
|
+
var codeChangeSummaryReportSchema = z2.object({
|
|
61
|
+
closedAt: z2.string().optional(),
|
|
62
|
+
id: z2.string().uuid(),
|
|
63
|
+
mergedAt: z2.string().optional(),
|
|
64
|
+
number: z2.number().int().positive(),
|
|
65
|
+
openedAt: z2.string(),
|
|
66
|
+
provider: z2.string().min(1),
|
|
67
|
+
repository: z2.string().min(1),
|
|
68
|
+
state: codeChangeStateSchema,
|
|
69
|
+
title: z2.string().optional(),
|
|
70
|
+
url: z2.string().url().optional()
|
|
71
|
+
}).strict();
|
|
72
|
+
var codeOverviewReportSchema = z2.object({
|
|
73
|
+
changes: z2.array(codeChangeSummaryReportSchema),
|
|
74
|
+
generatedAt: z2.string(),
|
|
75
|
+
repositories: z2.array(codeRepositorySummarySchema),
|
|
76
|
+
summary: codeChangeSummarySchema,
|
|
77
|
+
windowEnd: z2.string(),
|
|
78
|
+
windowStart: z2.string()
|
|
79
|
+
}).strict();
|
|
80
|
+
|
|
81
|
+
// src/api/schema/conversation.ts
|
|
82
|
+
import { z as z3 } from "zod";
|
|
83
|
+
import {
|
|
84
|
+
conversationAnnotationInputSchema,
|
|
85
|
+
conversationSidebarAnnotationSchema,
|
|
86
|
+
conversationEventPresentationSchema
|
|
87
|
+
} from "@sentry/junior-plugin-api";
|
|
88
|
+
var conversationReportStatusSchema = z3.enum([
|
|
89
|
+
"active",
|
|
90
|
+
"completed",
|
|
91
|
+
"failed"
|
|
92
|
+
]);
|
|
93
|
+
var conversationSurfaceSchema = z3.enum([
|
|
94
|
+
"api",
|
|
95
|
+
"internal",
|
|
96
|
+
"scheduler",
|
|
97
|
+
"slack"
|
|
98
|
+
]);
|
|
99
|
+
var conversationUsageSchema = usageSchema;
|
|
100
|
+
var conversationParamsSchema = z3.object({ conversationId: z3.string().min(1) }).strict();
|
|
101
|
+
var conversationAttachmentParamsSchema = z3.object({
|
|
102
|
+
attachmentId: z3.string().min(1),
|
|
103
|
+
conversationId: z3.string().min(1)
|
|
104
|
+
}).strict();
|
|
105
|
+
var conversationDetailQuerySchema = z3.object({
|
|
106
|
+
limit: z3.coerce.number().int().min(1).max(1e3).default(500)
|
|
107
|
+
}).strict();
|
|
108
|
+
var conversationEventsQuerySchema = z3.object({
|
|
109
|
+
before: z3.string().min(1),
|
|
110
|
+
limit: z3.coerce.number().int().min(1).max(1e3).default(500)
|
|
111
|
+
}).strict();
|
|
112
|
+
var conversationFeedQuerySchema = z3.object({
|
|
113
|
+
actorEmail: z3.string().trim().email().transform((value) => value.toLowerCase()).optional(),
|
|
114
|
+
status: z3.enum(["active", "archived"]).default("active")
|
|
115
|
+
}).strict();
|
|
116
|
+
var archiveConversationBodySchema = z3.object({ archived: z3.boolean(), lastSeenAt: z3.string().datetime() }).strict();
|
|
117
|
+
var archiveConversationResponseSchema = z3.object({ archivedAt: z3.string().datetime().nullable() }).strict();
|
|
118
|
+
var createConversationBodySchema = z3.object({
|
|
119
|
+
idempotencyKey: z3.string().trim().min(1).max(200),
|
|
120
|
+
message: z3.string().trim().min(1).max(32e3),
|
|
121
|
+
/** New roots default public. Private roots stay participant-only. */
|
|
122
|
+
visibility: z3.enum(["private", "public"]).optional()
|
|
123
|
+
}).strict();
|
|
124
|
+
var createConversationMessageBodySchema = z3.object({
|
|
125
|
+
idempotencyKey: z3.string().trim().min(1).max(200),
|
|
126
|
+
message: z3.string().trim().min(1).max(32e3)
|
|
127
|
+
}).strict();
|
|
128
|
+
var acceptedConversationMessageSchema = z3.object({
|
|
129
|
+
conversationId: z3.string().min(1),
|
|
130
|
+
messageId: z3.string().min(1),
|
|
131
|
+
status: z3.enum(["accepted", "duplicate"])
|
|
132
|
+
}).strict();
|
|
133
|
+
var actorIdentitySchema = z3.object({
|
|
134
|
+
email: z3.string().optional(),
|
|
135
|
+
fullName: z3.string().optional(),
|
|
136
|
+
slackUserId: z3.string().optional(),
|
|
137
|
+
slackUserName: z3.string().optional()
|
|
138
|
+
}).strict();
|
|
139
|
+
var conversationPendingMessageDeliverySchema = z3.enum([
|
|
140
|
+
"defer",
|
|
141
|
+
"interrupt"
|
|
142
|
+
]);
|
|
143
|
+
var conversationPendingMessageSchema = z3.object({
|
|
144
|
+
actorIdentity: actorIdentitySchema.optional(),
|
|
145
|
+
createdAt: z3.string().datetime(),
|
|
146
|
+
delivery: conversationPendingMessageDeliverySchema,
|
|
147
|
+
inboundMessageId: z3.string().min(1),
|
|
148
|
+
messageId: z3.string().min(1),
|
|
149
|
+
receivedAt: z3.string().datetime(),
|
|
150
|
+
role: z3.literal("user"),
|
|
151
|
+
source: z3.enum(["slack", "web"]),
|
|
152
|
+
text: z3.string().optional(),
|
|
153
|
+
redacted: z3.literal(true).optional()
|
|
154
|
+
}).strict().superRefine((data, context) => {
|
|
155
|
+
if (data.text === void 0 === (data.redacted !== true)) {
|
|
156
|
+
context.addIssue({
|
|
157
|
+
code: "custom",
|
|
158
|
+
message: "pending message content must be text or explicitly redacted"
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
if (data.redacted && data.actorIdentity) {
|
|
162
|
+
context.addIssue({
|
|
163
|
+
code: "custom",
|
|
164
|
+
message: "redacted pending messages must not expose actor identity"
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
var conversationPendingAuthorizationSchema = z3.object({
|
|
169
|
+
authorizationUrl: z3.string().url(),
|
|
170
|
+
completionText: z3.string().min(1),
|
|
171
|
+
label: z3.string().min(1)
|
|
172
|
+
}).strict();
|
|
173
|
+
var conversationPendingMessagesReportSchema = z3.object({
|
|
174
|
+
authorization: conversationPendingAuthorizationSchema.optional(),
|
|
175
|
+
conversationId: z3.string().min(1),
|
|
176
|
+
generatedAt: z3.string().datetime(),
|
|
177
|
+
messages: z3.array(conversationPendingMessageSchema)
|
|
178
|
+
}).strict();
|
|
179
|
+
var cancelConversationPendingMessagesBodySchema = z3.object({
|
|
180
|
+
inboundMessageIds: z3.array(z3.string().min(1)).min(1).optional(),
|
|
181
|
+
receivedBefore: z3.string().datetime().optional()
|
|
182
|
+
}).strict();
|
|
183
|
+
var cancelConversationPendingMessagesResponseSchema = z3.object({
|
|
184
|
+
cancelledCount: z3.number().int().nonnegative(),
|
|
185
|
+
cancelledInboundMessageIds: z3.array(z3.string().min(1)),
|
|
186
|
+
conversationId: z3.string().min(1)
|
|
187
|
+
}).strict();
|
|
188
|
+
var conversationAuxiliaryCostsSchema = z3.object({
|
|
189
|
+
costUsd: z3.number().finite().nonnegative(),
|
|
190
|
+
operations: z3.array(
|
|
191
|
+
z3.object({
|
|
192
|
+
costUsd: z3.number().finite().nonnegative(),
|
|
193
|
+
events: z3.number().int().positive(),
|
|
194
|
+
name: z3.string().min(1),
|
|
195
|
+
namespace: z3.string().min(1)
|
|
196
|
+
}).strict()
|
|
197
|
+
).min(1)
|
|
198
|
+
}).strict();
|
|
199
|
+
var conversationSourceTaskSchema = z3.object({
|
|
200
|
+
id: z3.string().min(1).optional(),
|
|
201
|
+
kind: z3.enum(["scheduled", "event"]),
|
|
202
|
+
label: z3.string().min(1).optional(),
|
|
203
|
+
title: z3.string().min(1).optional()
|
|
204
|
+
}).strict().superRefine((value, context) => {
|
|
205
|
+
if (Boolean(value.id) !== Boolean(value.label)) {
|
|
206
|
+
context.addIssue({
|
|
207
|
+
code: "custom",
|
|
208
|
+
message: "sourceTask id and label must both be set or both omitted"
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
var conversationAnnotationReportSchema = conversationAnnotationInputSchema.and(
|
|
213
|
+
z3.object({
|
|
214
|
+
plugin: z3.string().min(1),
|
|
215
|
+
createdAt: z3.string().datetime(),
|
|
216
|
+
updatedAt: z3.string().datetime()
|
|
217
|
+
})
|
|
218
|
+
);
|
|
219
|
+
var conversationSummaryReportSchema = z3.object({
|
|
220
|
+
displayTitle: z3.string(),
|
|
221
|
+
cumulativeDurationMs: z3.number(),
|
|
222
|
+
cumulativeUsage: conversationUsageSchema.optional(),
|
|
223
|
+
auxiliaryCosts: conversationAuxiliaryCostsSchema.optional(),
|
|
224
|
+
conversationId: z3.string(),
|
|
225
|
+
isParticipant: z3.boolean(),
|
|
226
|
+
visibility: z3.enum(["private", "public"]).optional(),
|
|
227
|
+
status: conversationReportStatusSchema,
|
|
228
|
+
startedAt: z3.string(),
|
|
229
|
+
lastSeenAt: z3.string(),
|
|
230
|
+
lastProgressAt: z3.string(),
|
|
231
|
+
surface: conversationSurfaceSchema,
|
|
232
|
+
actorIdentity: actorIdentitySchema.optional(),
|
|
233
|
+
archivedAt: z3.string().datetime().nullable().optional(),
|
|
234
|
+
channel: z3.string().optional(),
|
|
235
|
+
channelName: z3.string().optional(),
|
|
236
|
+
channelNameRedacted: z3.boolean().optional(),
|
|
237
|
+
locationId: z3.string().optional(),
|
|
238
|
+
sentryTraceUrl: z3.string().optional(),
|
|
239
|
+
sourceUrl: z3.string().url().optional(),
|
|
240
|
+
traceId: z3.string().optional(),
|
|
241
|
+
/**
|
|
242
|
+
* Plugin-owned resource links for this conversation.
|
|
243
|
+
* Present on the conversation feed when the viewer can see private content.
|
|
244
|
+
* Clients must not fetch provider state while rendering these links.
|
|
245
|
+
*/
|
|
246
|
+
annotations: z3.array(conversationAnnotationReportSchema).optional(),
|
|
247
|
+
/** Plugin-selected annotations for the compact conversation row. */
|
|
248
|
+
sidebarAnnotations: z3.array(conversationSidebarAnnotationSchema).optional(),
|
|
249
|
+
assignedWork: z3.boolean().optional(),
|
|
250
|
+
finishedWorkAt: z3.string().datetime().optional(),
|
|
251
|
+
/**
|
|
252
|
+
* Dashboard Priority membership for this conversation summary.
|
|
253
|
+
* Present on the conversation feed. Clients must not recompute it.
|
|
254
|
+
*
|
|
255
|
+
* True only when:
|
|
256
|
+
* - unfinished work was last seen within 48 hours
|
|
257
|
+
* - finished assigned work has conversation activity after the finish time
|
|
258
|
+
* - there is no known work and the conversation was last seen within 3 hours
|
|
259
|
+
*/
|
|
260
|
+
isPriority: z3.boolean().optional(),
|
|
261
|
+
unfinishedWork: z3.boolean().optional()
|
|
262
|
+
}).strict();
|
|
263
|
+
var conversationReportMessageEventDataSchema = z3.object({
|
|
264
|
+
type: z3.literal("message"),
|
|
265
|
+
messageId: z3.string().min(1),
|
|
266
|
+
role: z3.enum(["assistant", "system", "user"]),
|
|
267
|
+
source: z3.enum(["slack", "web"]).optional(),
|
|
268
|
+
actorIdentity: actorIdentitySchema.optional(),
|
|
269
|
+
eventType: z3.string().min(1).optional(),
|
|
270
|
+
explicitMention: z3.boolean().optional(),
|
|
271
|
+
text: z3.string().optional(),
|
|
272
|
+
redacted: z3.literal(true).optional()
|
|
273
|
+
}).strict().superRefine((data, context) => {
|
|
274
|
+
if (data.text === void 0 === (data.redacted !== true)) {
|
|
275
|
+
context.addIssue({
|
|
276
|
+
code: "custom",
|
|
277
|
+
message: "message content must be text or explicitly redacted"
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
if (data.redacted && data.actorIdentity) {
|
|
281
|
+
context.addIssue({
|
|
282
|
+
code: "custom",
|
|
283
|
+
message: "redacted messages must not expose actor identity"
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
var conversationReportMessageHandledEventDataSchema = z3.object({
|
|
288
|
+
type: z3.literal("message_handled"),
|
|
289
|
+
messageId: z3.string().min(1)
|
|
290
|
+
}).strict();
|
|
291
|
+
var conversationReportToolCallSchema = z3.object({
|
|
292
|
+
toolCallId: z3.string().min(1),
|
|
293
|
+
name: z3.string().min(1),
|
|
294
|
+
status: z3.enum(["running", "completed", "error"]),
|
|
295
|
+
startedAt: z3.string().datetime().optional(),
|
|
296
|
+
startedSeq: z3.number().int().nonnegative().optional(),
|
|
297
|
+
input: z3.unknown().optional(),
|
|
298
|
+
output: z3.unknown().optional()
|
|
299
|
+
}).strict().superRefine((call, context) => {
|
|
300
|
+
if (call.startedAt === void 0 !== (call.startedSeq === void 0)) {
|
|
301
|
+
context.addIssue({
|
|
302
|
+
code: "custom",
|
|
303
|
+
message: "tool start sequence and timestamp must be provided together"
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
var conversationReportReasoningPartSchema = z3.object({
|
|
308
|
+
type: z3.literal("reasoning"),
|
|
309
|
+
text: z3.string().min(1).optional(),
|
|
310
|
+
redacted: z3.literal(true).optional()
|
|
311
|
+
}).strict().superRefine((data, context) => {
|
|
312
|
+
if (data.text === void 0 === (data.redacted !== true)) {
|
|
313
|
+
context.addIssue({
|
|
314
|
+
code: "custom",
|
|
315
|
+
message: "reasoning content must be text or explicitly redacted"
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
var conversationReportAssistantToolCallPartSchema = z3.object({
|
|
320
|
+
type: z3.literal("tool_call"),
|
|
321
|
+
toolCallId: z3.string().min(1)
|
|
322
|
+
}).strict();
|
|
323
|
+
var conversationReportAssistantMetadataSchema = z3.object({
|
|
324
|
+
parts: z3.array(
|
|
325
|
+
z3.discriminatedUnion("type", [
|
|
326
|
+
conversationReportReasoningPartSchema,
|
|
327
|
+
conversationReportAssistantToolCallPartSchema
|
|
328
|
+
])
|
|
329
|
+
).min(1)
|
|
330
|
+
}).strict();
|
|
331
|
+
var conversationReportToolCallsEventDataSchema = z3.object({
|
|
332
|
+
type: z3.literal("tool_calls"),
|
|
333
|
+
calls: z3.array(conversationReportToolCallSchema).min(1),
|
|
334
|
+
assistant: conversationReportAssistantMetadataSchema.optional()
|
|
335
|
+
}).strict().superRefine((data, context) => {
|
|
336
|
+
if (!data.assistant) return;
|
|
337
|
+
const callCounts = /* @__PURE__ */ new Map();
|
|
338
|
+
for (const call of data.calls) {
|
|
339
|
+
callCounts.set(
|
|
340
|
+
call.toolCallId,
|
|
341
|
+
(callCounts.get(call.toolCallId) ?? 0) + 1
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
const partCounts = /* @__PURE__ */ new Map();
|
|
345
|
+
for (const part of data.assistant.parts) {
|
|
346
|
+
if (part.type !== "tool_call") continue;
|
|
347
|
+
partCounts.set(
|
|
348
|
+
part.toolCallId,
|
|
349
|
+
(partCounts.get(part.toolCallId) ?? 0) + 1
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
if (callCounts.size !== partCounts.size || [...callCounts].some(
|
|
353
|
+
([toolCallId, count]) => partCounts.get(toolCallId) !== count
|
|
354
|
+
)) {
|
|
355
|
+
context.addIssue({
|
|
356
|
+
code: "custom",
|
|
357
|
+
path: ["assistant", "parts"],
|
|
358
|
+
message: "assistant tool parts must reference every call exactly once"
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
var conversationReportAssistantMessageEventDataSchema = z3.object({
|
|
363
|
+
type: z3.literal("assistant_message"),
|
|
364
|
+
parts: z3.array(conversationReportReasoningPartSchema).min(1)
|
|
365
|
+
}).strict();
|
|
366
|
+
var conversationReportTurnLifecycleEventDataSchema = z3.discriminatedUnion(
|
|
367
|
+
"state",
|
|
368
|
+
[
|
|
369
|
+
z3.object({
|
|
370
|
+
type: z3.literal("turn_lifecycle"),
|
|
371
|
+
turnId: z3.string().min(1),
|
|
372
|
+
state: z3.enum(["succeeded", "no_reply"])
|
|
373
|
+
}).strict(),
|
|
374
|
+
z3.object({
|
|
375
|
+
type: z3.literal("turn_lifecycle"),
|
|
376
|
+
turnId: z3.string().min(1),
|
|
377
|
+
state: z3.literal("started"),
|
|
378
|
+
inputMessageIds: z3.array(z3.string().min(1)).min(1).optional()
|
|
379
|
+
}).strict(),
|
|
380
|
+
z3.object({
|
|
381
|
+
type: z3.literal("turn_lifecycle"),
|
|
382
|
+
turnId: z3.string().min(1),
|
|
383
|
+
state: z3.literal("failed"),
|
|
384
|
+
failureKind: z3.enum(["agent", "delivery"])
|
|
385
|
+
}).strict()
|
|
386
|
+
]
|
|
387
|
+
);
|
|
388
|
+
var conversationReportTurnRoutedEventDataSchema = z3.object({
|
|
389
|
+
type: z3.literal("turn_routed"),
|
|
390
|
+
turnId: z3.string().min(1),
|
|
391
|
+
modelProfile: z3.string().min(1),
|
|
392
|
+
modelId: z3.string().min(1),
|
|
393
|
+
costUsd: z3.number().finite().nonnegative().optional(),
|
|
394
|
+
reasoningLevel: z3.string().min(1),
|
|
395
|
+
confidence: z3.number().min(0).max(1).optional(),
|
|
396
|
+
source: z3.enum(["configured", "inherited", "router"])
|
|
397
|
+
}).strict();
|
|
398
|
+
var conversationReportGuardianActionReviewedEventDataSchema = z3.object({
|
|
399
|
+
type: z3.literal("guardian_action_reviewed"),
|
|
400
|
+
turnId: z3.string().min(1),
|
|
401
|
+
toolCallId: z3.string().min(1),
|
|
402
|
+
toolName: z3.string().min(1),
|
|
403
|
+
decision: z3.enum(["allow", "ask", "deny"]),
|
|
404
|
+
riskLevel: z3.enum(["low", "medium", "high", "critical"]),
|
|
405
|
+
userAuthorization: z3.enum(["high", "medium", "low", "unknown"])
|
|
406
|
+
}).strict();
|
|
407
|
+
var conversationReportTurnContextEventDataSchema = z3.object({
|
|
408
|
+
type: z3.literal("turn_context"),
|
|
409
|
+
turnId: z3.string().min(1),
|
|
410
|
+
pluginName: z3.string().min(1),
|
|
411
|
+
kind: z3.string().min(1),
|
|
412
|
+
version: z3.number().int().positive(),
|
|
413
|
+
content: z3.record(z3.string(), z3.unknown())
|
|
414
|
+
}).strict();
|
|
415
|
+
var conversationReportStructuredEventDataSchema = z3.object({
|
|
416
|
+
type: z3.literal("structured_event"),
|
|
417
|
+
namespace: z3.string().min(1),
|
|
418
|
+
name: z3.string().min(1),
|
|
419
|
+
version: z3.number().int().positive(),
|
|
420
|
+
turnId: z3.string().min(1).optional(),
|
|
421
|
+
presentation: conversationEventPresentationSchema
|
|
422
|
+
}).strict();
|
|
423
|
+
var conversationReportDeliveredAttachmentSchema = z3.object({
|
|
424
|
+
id: z3.string().min(1),
|
|
425
|
+
filename: z3.string().min(1),
|
|
426
|
+
contentType: z3.string().min(1),
|
|
427
|
+
bytes: z3.number().int().nonnegative()
|
|
428
|
+
}).strict();
|
|
429
|
+
var conversationReportAttachmentsDeliveredEventDataSchema = z3.object({
|
|
430
|
+
type: z3.literal("attachments_delivered"),
|
|
431
|
+
attachments: z3.array(conversationReportDeliveredAttachmentSchema).min(1)
|
|
432
|
+
}).strict();
|
|
433
|
+
var conversationReportCompactionEventDataSchema = z3.object({
|
|
434
|
+
type: z3.literal("compaction"),
|
|
435
|
+
modelProfile: z3.string().min(1).optional(),
|
|
436
|
+
modelId: z3.string().min(1).optional(),
|
|
437
|
+
summary: z3.string().min(1).optional(),
|
|
438
|
+
details: z3.object({
|
|
439
|
+
reason: z3.literal("capacity"),
|
|
440
|
+
estimatedInputTokens: z3.number().int().nonnegative(),
|
|
441
|
+
replacementInputTokens: z3.number().int().nonnegative().optional(),
|
|
442
|
+
triggerTokens: z3.number().int().nonnegative(),
|
|
443
|
+
inputLimitTokens: z3.number().int().positive(),
|
|
444
|
+
inputMessageCount: z3.number().int().nonnegative(),
|
|
445
|
+
retainedMessageCount: z3.number().int().nonnegative(),
|
|
446
|
+
summaryChars: z3.number().int().nonnegative()
|
|
447
|
+
}).strict().optional()
|
|
448
|
+
}).strict();
|
|
449
|
+
var conversationReportHandoffEventDataSchema = z3.object({
|
|
450
|
+
type: z3.literal("handoff"),
|
|
451
|
+
modelProfile: z3.string().min(1),
|
|
452
|
+
modelId: z3.string().min(1),
|
|
453
|
+
reasoningLevel: z3.string().min(1).optional(),
|
|
454
|
+
triggeringToolCallId: z3.string().min(1).optional(),
|
|
455
|
+
summary: z3.string().min(1).optional()
|
|
456
|
+
}).strict();
|
|
457
|
+
var conversationReportSubagentEventDataSchema = z3.object({
|
|
458
|
+
type: z3.literal("subagent"),
|
|
459
|
+
startedSeq: z3.number().int().nonnegative(),
|
|
460
|
+
startedAt: z3.string().datetime(),
|
|
461
|
+
childConversationId: z3.string().min(1),
|
|
462
|
+
subagentKind: z3.string().min(1),
|
|
463
|
+
parentToolCallId: z3.string().min(1).optional(),
|
|
464
|
+
status: z3.enum(["running", "completed", "error", "aborted"])
|
|
465
|
+
}).strict();
|
|
466
|
+
var conversationReportEventDataSchema = z3.discriminatedUnion("type", [
|
|
467
|
+
conversationReportMessageEventDataSchema,
|
|
468
|
+
conversationReportMessageHandledEventDataSchema,
|
|
469
|
+
conversationReportAssistantMessageEventDataSchema,
|
|
470
|
+
conversationReportToolCallsEventDataSchema,
|
|
471
|
+
conversationReportTurnLifecycleEventDataSchema,
|
|
472
|
+
conversationReportTurnContextEventDataSchema,
|
|
473
|
+
conversationReportStructuredEventDataSchema,
|
|
474
|
+
conversationReportAttachmentsDeliveredEventDataSchema,
|
|
475
|
+
conversationReportTurnRoutedEventDataSchema,
|
|
476
|
+
conversationReportGuardianActionReviewedEventDataSchema,
|
|
477
|
+
conversationReportCompactionEventDataSchema,
|
|
478
|
+
conversationReportHandoffEventDataSchema,
|
|
479
|
+
conversationReportSubagentEventDataSchema
|
|
480
|
+
]);
|
|
481
|
+
var conversationReportEventSchema = z3.object({
|
|
482
|
+
seq: z3.number().int().nonnegative(),
|
|
483
|
+
createdAt: z3.string().datetime(),
|
|
484
|
+
data: conversationReportEventDataSchema
|
|
485
|
+
}).strict();
|
|
486
|
+
var conversationEventHistorySchema = z3.discriminatedUnion("status", [
|
|
487
|
+
z3.object({ status: z3.literal("available") }).strict(),
|
|
488
|
+
z3.object({
|
|
489
|
+
status: z3.literal("redacted"),
|
|
490
|
+
reason: z3.literal("non_public_conversation")
|
|
491
|
+
}).strict(),
|
|
492
|
+
z3.object({
|
|
493
|
+
status: z3.literal("expired"),
|
|
494
|
+
expiredAt: z3.string().datetime()
|
|
495
|
+
}).strict()
|
|
496
|
+
]);
|
|
497
|
+
var conversationModelUsageSchema = z3.object({
|
|
498
|
+
modelId: z3.string(),
|
|
499
|
+
usage: conversationUsageSchema
|
|
500
|
+
}).strict();
|
|
501
|
+
function validateConversationEvents(report, context) {
|
|
502
|
+
if (report.eventHistory.status === "expired" && report.events.length > 0) {
|
|
503
|
+
context.addIssue({
|
|
504
|
+
code: "custom",
|
|
505
|
+
path: ["events"],
|
|
506
|
+
message: "expired event history must not contain events"
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
for (let index = 1; index < report.events.length; index += 1) {
|
|
510
|
+
if (report.events[index].seq <= report.events[index - 1].seq) {
|
|
511
|
+
context.addIssue({
|
|
512
|
+
code: "custom",
|
|
513
|
+
path: ["events", index, "seq"],
|
|
514
|
+
message: "report event sequences must be strictly increasing"
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
for (const [index, event] of report.events.entries()) {
|
|
519
|
+
if (event.data.type === "message") {
|
|
520
|
+
if (report.eventHistory.status === "redacted" && event.data.redacted !== true) {
|
|
521
|
+
context.addIssue({
|
|
522
|
+
code: "custom",
|
|
523
|
+
path: ["events", index, "data"],
|
|
524
|
+
message: "redacted event history must redact messages"
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
if (report.eventHistory.status === "available" && event.data.redacted === true) {
|
|
528
|
+
context.addIssue({
|
|
529
|
+
code: "custom",
|
|
530
|
+
path: ["events", index, "data"],
|
|
531
|
+
message: "available event history must expose messages"
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
if (report.eventHistory.status === "redacted" && event.data.type === "tool_calls" && event.data.calls.some(
|
|
536
|
+
(call) => call.input !== void 0 || call.output !== void 0
|
|
537
|
+
)) {
|
|
538
|
+
context.addIssue({
|
|
539
|
+
code: "custom",
|
|
540
|
+
path: ["events", index, "data"],
|
|
541
|
+
message: "redacted event history must redact tool payloads"
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
if (report.eventHistory.status === "redacted" && event.data.type === "assistant_message" && event.data.parts.some((part) => part.text !== void 0)) {
|
|
545
|
+
context.addIssue({
|
|
546
|
+
code: "custom",
|
|
547
|
+
path: ["events", index, "data"],
|
|
548
|
+
message: "redacted event history must redact assistant messages"
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
if (report.eventHistory.status === "available" && event.data.type === "assistant_message" && event.data.parts.some((part) => part.redacted === true)) {
|
|
552
|
+
context.addIssue({
|
|
553
|
+
code: "custom",
|
|
554
|
+
path: ["events", index, "data"],
|
|
555
|
+
message: "available event history must expose reasoning"
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
if (event.data.type === "tool_calls" && (report.eventHistory.status === "redacted" && event.data.assistant?.parts.some(
|
|
559
|
+
(part) => part.type === "reasoning" && part.text !== void 0
|
|
560
|
+
) || report.eventHistory.status === "available" && event.data.assistant?.parts.some(
|
|
561
|
+
(part) => part.type === "reasoning" && part.redacted === true
|
|
562
|
+
))) {
|
|
563
|
+
context.addIssue({
|
|
564
|
+
code: "custom",
|
|
565
|
+
path: ["events", index, "data", "assistant"],
|
|
566
|
+
message: "assistant reasoning must match event history visibility"
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
var conversationDetailReportSchema = conversationSummaryReportSchema.extend({
|
|
572
|
+
modelUsage: z3.array(conversationModelUsageSchema).optional(),
|
|
573
|
+
events: z3.array(conversationReportEventSchema),
|
|
574
|
+
eventHistory: conversationEventHistorySchema,
|
|
575
|
+
previousCursor: z3.string().min(1).optional(),
|
|
576
|
+
generatedAt: z3.string(),
|
|
577
|
+
sentryConversationUrl: z3.string().optional(),
|
|
578
|
+
sourceTask: conversationSourceTaskSchema.optional()
|
|
579
|
+
}).strict().superRefine(validateConversationEvents);
|
|
580
|
+
var conversationEventPageSchema = z3.object({
|
|
581
|
+
events: z3.array(conversationReportEventSchema),
|
|
582
|
+
eventHistory: conversationEventHistorySchema,
|
|
583
|
+
previousCursor: z3.string().min(1).optional(),
|
|
584
|
+
generatedAt: z3.string()
|
|
585
|
+
}).strict().superRefine(validateConversationEvents);
|
|
586
|
+
var conversationFeedSchema = z3.object({
|
|
587
|
+
conversations: z3.array(conversationSummaryReportSchema),
|
|
588
|
+
source: z3.literal("conversation_index"),
|
|
589
|
+
generatedAt: z3.string()
|
|
590
|
+
}).strict();
|
|
591
|
+
var conversationStatsItemSchema = z3.object({
|
|
592
|
+
active: z3.number(),
|
|
593
|
+
conversations: z3.number(),
|
|
594
|
+
durationMs: z3.number(),
|
|
595
|
+
failed: z3.number(),
|
|
596
|
+
label: z3.string(),
|
|
597
|
+
costUsd: z3.number().optional(),
|
|
598
|
+
tokens: z3.number().optional()
|
|
599
|
+
}).strict();
|
|
600
|
+
var conversationMetricDaySchema = z3.object({
|
|
601
|
+
cachedInputTokens: z3.number().optional(),
|
|
602
|
+
conversations: z3.number(),
|
|
603
|
+
costUsd: z3.number().optional(),
|
|
604
|
+
date: z3.string(),
|
|
605
|
+
durationMs: z3.number(),
|
|
606
|
+
inputTokens: z3.number().optional(),
|
|
607
|
+
tokens: z3.number().optional()
|
|
608
|
+
}).strict();
|
|
609
|
+
var guardianMetricDaySchema = z3.object({
|
|
610
|
+
allow: z3.number(),
|
|
611
|
+
ask: z3.number(),
|
|
612
|
+
costUsd: z3.number().optional(),
|
|
613
|
+
date: z3.string(),
|
|
614
|
+
deny: z3.number(),
|
|
615
|
+
requests: z3.number()
|
|
616
|
+
}).strict();
|
|
617
|
+
var guardianStatsSchema = z3.object({
|
|
618
|
+
allow: z3.number(),
|
|
619
|
+
ask: z3.number(),
|
|
620
|
+
costUsd: z3.number().optional(),
|
|
621
|
+
deny: z3.number(),
|
|
622
|
+
metricDays: z3.array(guardianMetricDaySchema),
|
|
623
|
+
requests: z3.number()
|
|
624
|
+
}).strict();
|
|
625
|
+
var conversationStatsReportSchema = z3.object({
|
|
626
|
+
active: z3.number(),
|
|
627
|
+
cachedInputTokens: z3.number().optional(),
|
|
628
|
+
conversations: z3.number(),
|
|
629
|
+
durationMs: z3.number(),
|
|
630
|
+
failed: z3.number(),
|
|
631
|
+
generatedAt: z3.string(),
|
|
632
|
+
guardian: guardianStatsSchema,
|
|
633
|
+
metricDays: z3.array(conversationMetricDaySchema),
|
|
634
|
+
locations: z3.array(conversationStatsItemSchema),
|
|
635
|
+
actors: z3.array(conversationStatsItemSchema),
|
|
636
|
+
source: z3.literal("conversation_index"),
|
|
637
|
+
costUsd: z3.number().optional(),
|
|
638
|
+
inputTokens: z3.number().optional(),
|
|
639
|
+
tokens: z3.number().optional(),
|
|
640
|
+
windowEnd: z3.string(),
|
|
641
|
+
windowStart: z3.string()
|
|
642
|
+
}).strict();
|
|
643
|
+
|
|
644
|
+
// src/api/schema/person.ts
|
|
645
|
+
import { z as z4 } from "zod";
|
|
646
|
+
var personParamsSchema = z4.object({ email: z4.string().trim().min(1) }).strict();
|
|
647
|
+
var peopleConversationStatsItemSchema = conversationStatsItemSchema.omit({ costUsd: true });
|
|
648
|
+
var actorActivityDayReportSchema = z4.object({
|
|
649
|
+
active: z4.number(),
|
|
650
|
+
conversations: z4.number(),
|
|
651
|
+
costUsd: z4.number().optional(),
|
|
652
|
+
date: z4.string(),
|
|
653
|
+
durationMs: z4.number(),
|
|
654
|
+
failed: z4.number(),
|
|
655
|
+
tokens: z4.number().optional()
|
|
656
|
+
}).strict();
|
|
657
|
+
var peopleActivityDayReportSchema = z4.object({
|
|
658
|
+
activePeople: z4.number(),
|
|
659
|
+
conversations: z4.number(),
|
|
660
|
+
date: z4.string()
|
|
661
|
+
}).strict();
|
|
662
|
+
var actorTotalsReportSchema = z4.object({
|
|
663
|
+
active: z4.number(),
|
|
664
|
+
activeDays: z4.number(),
|
|
665
|
+
conversations: z4.number(),
|
|
666
|
+
durationMs: z4.number(),
|
|
667
|
+
failed: z4.number(),
|
|
668
|
+
tokens: z4.number().optional()
|
|
669
|
+
}).strict();
|
|
670
|
+
var identifiedActorSchema = actorIdentitySchema.extend({ email: z4.string().min(1) }).strict();
|
|
671
|
+
var actorSummaryReportSchema = actorTotalsReportSchema.extend({
|
|
672
|
+
firstSeenAt: z4.string(),
|
|
673
|
+
lastSeenAt: z4.string(),
|
|
674
|
+
actor: identifiedActorSchema
|
|
675
|
+
}).strict();
|
|
676
|
+
var actorDirectoryReportSchema = z4.object({
|
|
677
|
+
activityDays: z4.array(peopleActivityDayReportSchema),
|
|
678
|
+
generatedAt: z4.string(),
|
|
679
|
+
people: z4.array(actorSummaryReportSchema),
|
|
680
|
+
source: z4.literal("conversation_index"),
|
|
681
|
+
windowEnd: z4.string(),
|
|
682
|
+
windowStart: z4.string()
|
|
683
|
+
}).strict();
|
|
684
|
+
var actorProfileReportSchema = z4.object({
|
|
685
|
+
activityDays: z4.array(actorActivityDayReportSchema),
|
|
686
|
+
generatedAt: z4.string(),
|
|
687
|
+
locations: z4.array(peopleConversationStatsItemSchema),
|
|
688
|
+
recentConversations: z4.array(conversationSummaryReportSchema),
|
|
689
|
+
actor: identifiedActorSchema,
|
|
690
|
+
source: z4.literal("conversation_index"),
|
|
691
|
+
surfaces: z4.array(peopleConversationStatsItemSchema),
|
|
692
|
+
totals: actorTotalsReportSchema,
|
|
693
|
+
windowEnd: z4.string(),
|
|
694
|
+
windowStart: z4.string()
|
|
695
|
+
}).strict();
|
|
696
|
+
var personalSpendReportSchema = z4.object({
|
|
697
|
+
generatedAt: z4.string(),
|
|
698
|
+
sevenDaysUsd: z4.number().finite().nonnegative(),
|
|
699
|
+
source: z4.literal("conversation_index"),
|
|
700
|
+
thirtyDaysUsd: z4.number().finite().nonnegative(),
|
|
701
|
+
windowEnd: z4.string(),
|
|
702
|
+
windowStart: z4.string()
|
|
703
|
+
}).strict();
|
|
704
|
+
|
|
705
|
+
// src/api/schema/location.ts
|
|
706
|
+
import { z as z5 } from "zod";
|
|
707
|
+
var locationParamsSchema = z5.object({ locationId: z5.string().min(1) }).strict();
|
|
708
|
+
var locationSummaryReportSchema = conversationStatsItemSchema.extend({
|
|
709
|
+
id: z5.string(),
|
|
710
|
+
firstSeenAt: z5.string(),
|
|
711
|
+
kind: juniorDestinationKindSchema,
|
|
712
|
+
lastSeenAt: z5.string(),
|
|
713
|
+
provider: z5.string(),
|
|
714
|
+
providerDestinationId: z5.string(),
|
|
715
|
+
visibility: z5.literal("public")
|
|
716
|
+
}).strict();
|
|
717
|
+
var locationActorSummaryReportSchema = conversationStatsItemSchema.extend({ actor: actorIdentitySchema }).strict();
|
|
718
|
+
var locationActivityDayReportSchema = z5.object({
|
|
719
|
+
date: z5.string(),
|
|
720
|
+
privateConversations: z5.number(),
|
|
721
|
+
publicConversations: z5.number()
|
|
722
|
+
}).strict();
|
|
723
|
+
var locationDirectoryReportSchema = z5.object({
|
|
724
|
+
activityDays: z5.array(locationActivityDayReportSchema),
|
|
725
|
+
generatedAt: z5.string(),
|
|
726
|
+
locations: z5.array(locationSummaryReportSchema),
|
|
727
|
+
privateActivity: conversationStatsItemSchema,
|
|
728
|
+
source: z5.literal("conversation_index"),
|
|
729
|
+
windowEnd: z5.string(),
|
|
730
|
+
windowStart: z5.string()
|
|
731
|
+
}).strict();
|
|
732
|
+
var locationDetailReportSchema = locationSummaryReportSchema.extend({
|
|
733
|
+
activityDays: z5.array(dailyConversationActivitySchema),
|
|
734
|
+
actors: z5.array(locationActorSummaryReportSchema),
|
|
735
|
+
generatedAt: z5.string(),
|
|
736
|
+
recentConversations: z5.array(conversationSummaryReportSchema),
|
|
737
|
+
source: z5.literal("conversation_index"),
|
|
738
|
+
windowEnd: z5.string(),
|
|
739
|
+
windowStart: z5.string()
|
|
740
|
+
}).strict();
|
|
741
|
+
|
|
742
|
+
// src/api/schema/common.ts
|
|
743
|
+
import { z as z6 } from "zod";
|
|
744
|
+
var apiErrorSchema = z6.object({ error: z6.string().min(1) }).strict();
|
|
745
|
+
|
|
746
|
+
// src/api/schema/personal-token.ts
|
|
747
|
+
import { z as z7 } from "zod";
|
|
748
|
+
var personalTokenMetadataSchema = z7.object({
|
|
749
|
+
id: z7.string().uuid(),
|
|
750
|
+
name: z7.string(),
|
|
751
|
+
tokenSuffix: z7.string(),
|
|
752
|
+
createdAt: z7.string().datetime(),
|
|
753
|
+
expiresAt: z7.string().datetime(),
|
|
754
|
+
lastUsedAt: z7.string().datetime().nullable()
|
|
755
|
+
}).strict();
|
|
756
|
+
var personalTokenListSchema = z7.object({ tokens: z7.array(personalTokenMetadataSchema) }).strict();
|
|
757
|
+
var createPersonalTokenBodySchema = z7.object({ name: z7.string().trim().min(1).max(80) }).strict();
|
|
758
|
+
var createdPersonalTokenSchema = personalTokenMetadataSchema.extend({ token: z7.string().startsWith("jr_pat_") }).strict();
|
|
759
|
+
var personalTokenParamsSchema = z7.object({ id: z7.string().uuid() }).strict();
|
|
760
|
+
var revokePersonalTokenResponseSchema = z7.object({ revoked: z7.literal(true) }).strict();
|
|
761
|
+
|
|
762
|
+
// src/api/schema/workspace.ts
|
|
763
|
+
import { z as z8 } from "zod";
|
|
764
|
+
var workspaceRepoInputSchema = z8.object({
|
|
765
|
+
provider: z8.string(),
|
|
766
|
+
repo: z8.string()
|
|
767
|
+
}).strict();
|
|
768
|
+
var workspaceRepoSchema = z8.object({
|
|
769
|
+
provider: z8.string(),
|
|
770
|
+
repo: z8.string(),
|
|
771
|
+
checkoutPath: z8.string()
|
|
772
|
+
}).strict();
|
|
773
|
+
var workspaceSnapshotSchema = z8.object({
|
|
774
|
+
id: z8.string(),
|
|
775
|
+
generatedAt: z8.iso.datetime(),
|
|
776
|
+
buildDurationMs: z8.number().int().nonnegative(),
|
|
777
|
+
sizeBytes: z8.number().int().nonnegative().nullable()
|
|
778
|
+
}).strict();
|
|
779
|
+
var baselineSnapshotSchema = z8.object({
|
|
780
|
+
id: z8.string(),
|
|
781
|
+
generatedAt: z8.iso.datetime(),
|
|
782
|
+
buildDurationMs: z8.number().int().nonnegative(),
|
|
783
|
+
dependencyCount: z8.number().int().nonnegative()
|
|
784
|
+
}).strict();
|
|
785
|
+
var workspaceSchema = z8.object({
|
|
786
|
+
id: z8.string().uuid(),
|
|
787
|
+
name: z8.string(),
|
|
788
|
+
setupScript: z8.string(),
|
|
789
|
+
repos: z8.array(workspaceRepoSchema),
|
|
790
|
+
snapshot: workspaceSnapshotSchema.nullable()
|
|
791
|
+
}).strict();
|
|
792
|
+
var workspaceListSchema = z8.object({
|
|
793
|
+
baselineSnapshot: baselineSnapshotSchema.nullable(),
|
|
794
|
+
workspaces: z8.array(workspaceSchema)
|
|
795
|
+
}).strict();
|
|
796
|
+
var workspaceBodySchema = z8.object({
|
|
797
|
+
name: z8.string(),
|
|
798
|
+
setupScript: z8.string().optional(),
|
|
799
|
+
repos: z8.array(workspaceRepoInputSchema)
|
|
800
|
+
}).strict();
|
|
801
|
+
var workspaceParamsSchema = z8.object({ id: z8.string().uuid() }).strict();
|
|
802
|
+
var deleteWorkspaceResponseSchema = z8.object({ deleted: z8.literal(true) }).strict();
|
|
803
|
+
|
|
804
|
+
// src/api/schema/task.ts
|
|
805
|
+
import { z as z9 } from "zod";
|
|
806
|
+
var taskDestinationSchema = z9.object({
|
|
807
|
+
channelId: z9.string().min(1),
|
|
808
|
+
label: z9.string().min(1),
|
|
809
|
+
teamId: z9.string().min(1),
|
|
810
|
+
visibility: z9.enum(["private", "public"])
|
|
811
|
+
}).strict();
|
|
812
|
+
var taskSummaryBaseSchema = z9.object({
|
|
813
|
+
createdAt: z9.string().datetime(),
|
|
814
|
+
createdBy: z9.string().min(1),
|
|
815
|
+
createdByEmail: z9.string().trim().email().optional(),
|
|
816
|
+
destination: taskDestinationSchema,
|
|
817
|
+
id: z9.string().min(1),
|
|
818
|
+
instruction: z9.string().min(1),
|
|
819
|
+
lastConversationId: z9.string().min(1).optional(),
|
|
820
|
+
lastRunAt: z9.string().datetime().optional(),
|
|
821
|
+
ownedByViewer: z9.boolean(),
|
|
822
|
+
runsLast7Days: z9.number().int().nonnegative(),
|
|
823
|
+
/** Short display title; falls back from instruction when unset. */
|
|
824
|
+
title: z9.string().min(1),
|
|
825
|
+
totalRuns: z9.number().int().nonnegative()
|
|
826
|
+
});
|
|
827
|
+
var scheduledTaskSummarySchema = taskSummaryBaseSchema.extend({
|
|
828
|
+
kind: z9.literal("scheduled"),
|
|
829
|
+
nextRunAt: z9.string().datetime().optional(),
|
|
830
|
+
schedule: z9.string().min(1),
|
|
831
|
+
status: z9.enum(["active", "blocked", "completed"])
|
|
832
|
+
}).strict();
|
|
833
|
+
var eventTaskSummarySchema = taskSummaryBaseSchema.extend({
|
|
834
|
+
events: z9.array(z9.string().min(1)).min(1),
|
|
835
|
+
kind: z9.literal("event"),
|
|
836
|
+
resource: z9.string().min(1),
|
|
837
|
+
source: z9.string().min(1),
|
|
838
|
+
triggerAvailable: z9.boolean()
|
|
839
|
+
}).strict();
|
|
840
|
+
var taskSummarySchema = z9.discriminatedUnion("kind", [
|
|
841
|
+
scheduledTaskSummarySchema,
|
|
842
|
+
eventTaskSummarySchema
|
|
843
|
+
]);
|
|
844
|
+
var taskExecutionDaySchema = z9.object({
|
|
845
|
+
date: z9.string().min(1),
|
|
846
|
+
event: z9.number().int().nonnegative(),
|
|
847
|
+
scheduled: z9.number().int().nonnegative()
|
|
848
|
+
}).strict();
|
|
849
|
+
var taskListSchema = z9.object({
|
|
850
|
+
executionDays: z9.array(taskExecutionDaySchema),
|
|
851
|
+
tasks: z9.array(taskSummarySchema),
|
|
852
|
+
truncated: z9.boolean()
|
|
853
|
+
}).strict();
|
|
854
|
+
var taskParamsSchema = z9.object({
|
|
855
|
+
id: z9.string().min(1),
|
|
856
|
+
kind: z9.enum(["scheduled", "event"])
|
|
857
|
+
}).strict();
|
|
858
|
+
var taskExecutionStatusSchema = z9.enum([
|
|
859
|
+
"blocked",
|
|
860
|
+
"completed",
|
|
861
|
+
"failed"
|
|
862
|
+
]);
|
|
863
|
+
var taskExecutionSchema = z9.object({
|
|
864
|
+
conversationId: z9.string().min(1).optional(),
|
|
865
|
+
executedAt: z9.string().datetime(),
|
|
866
|
+
executionId: z9.string().min(1),
|
|
867
|
+
status: taskExecutionStatusSchema,
|
|
868
|
+
title: z9.string().min(1).optional()
|
|
869
|
+
}).strict();
|
|
870
|
+
var taskExecutionStatusDaySchema = z9.object({
|
|
871
|
+
blocked: z9.number().int().nonnegative(),
|
|
872
|
+
completed: z9.number().int().nonnegative(),
|
|
873
|
+
date: z9.string().min(1),
|
|
874
|
+
failed: z9.number().int().nonnegative()
|
|
875
|
+
}).strict();
|
|
876
|
+
var taskExecutionListSchema = z9.object({
|
|
877
|
+
executionDays: z9.array(taskExecutionStatusDaySchema),
|
|
878
|
+
executions: z9.array(taskExecutionSchema),
|
|
879
|
+
task: taskSummarySchema,
|
|
880
|
+
truncated: z9.boolean()
|
|
881
|
+
}).strict();
|
|
882
|
+
var taskRunSchema = taskExecutionSchema.extend({
|
|
883
|
+
kind: z9.enum(["scheduled", "event"]),
|
|
884
|
+
taskId: z9.string().min(1),
|
|
885
|
+
taskTitle: z9.string().min(1)
|
|
886
|
+
}).strict();
|
|
887
|
+
var taskRunListSchema = z9.object({
|
|
888
|
+
runs: z9.array(taskRunSchema),
|
|
889
|
+
truncated: z9.boolean()
|
|
890
|
+
}).strict();
|
|
891
|
+
|
|
892
|
+
// src/api/schema/stats.ts
|
|
893
|
+
import { z as z10 } from "zod";
|
|
894
|
+
var statSchema = z10.object({
|
|
895
|
+
count: z10.number().int().nonnegative(),
|
|
896
|
+
date: z10.string(),
|
|
897
|
+
metric: z10.string().min(1),
|
|
898
|
+
name: z10.string().min(1),
|
|
899
|
+
namespace: z10.string().min(1)
|
|
900
|
+
}).strict();
|
|
901
|
+
var statsReportSchema = z10.object({
|
|
902
|
+
generatedAt: z10.string().datetime(),
|
|
903
|
+
stats: z10.array(statSchema),
|
|
904
|
+
windowEnd: z10.string(),
|
|
905
|
+
windowStart: z10.string()
|
|
906
|
+
}).strict();
|
|
907
|
+
|
|
908
|
+
export {
|
|
909
|
+
apiErrorSchema,
|
|
910
|
+
conversationParamsSchema,
|
|
911
|
+
conversationAttachmentParamsSchema,
|
|
912
|
+
conversationDetailQuerySchema,
|
|
913
|
+
conversationEventsQuerySchema,
|
|
914
|
+
conversationFeedQuerySchema,
|
|
915
|
+
archiveConversationBodySchema,
|
|
916
|
+
archiveConversationResponseSchema,
|
|
917
|
+
createConversationBodySchema,
|
|
918
|
+
createConversationMessageBodySchema,
|
|
919
|
+
acceptedConversationMessageSchema,
|
|
920
|
+
conversationPendingMessageDeliverySchema,
|
|
921
|
+
conversationPendingMessageSchema,
|
|
922
|
+
conversationPendingAuthorizationSchema,
|
|
923
|
+
conversationPendingMessagesReportSchema,
|
|
924
|
+
cancelConversationPendingMessagesBodySchema,
|
|
925
|
+
cancelConversationPendingMessagesResponseSchema,
|
|
926
|
+
conversationAuxiliaryCostsSchema,
|
|
927
|
+
conversationSummaryReportSchema,
|
|
928
|
+
conversationReportEventDataSchema,
|
|
929
|
+
conversationReportEventSchema,
|
|
930
|
+
conversationEventHistorySchema,
|
|
931
|
+
conversationDetailReportSchema,
|
|
932
|
+
conversationEventPageSchema,
|
|
933
|
+
conversationFeedSchema,
|
|
934
|
+
conversationStatsReportSchema,
|
|
935
|
+
codeChangeSummarySchema,
|
|
936
|
+
codeRepositorySummarySchema,
|
|
937
|
+
codeChangeSummaryReportSchema,
|
|
938
|
+
codeOverviewReportSchema,
|
|
939
|
+
dailyConversationActivitySchema,
|
|
940
|
+
activityDays,
|
|
941
|
+
locationParamsSchema,
|
|
942
|
+
locationActivityDayReportSchema,
|
|
943
|
+
locationDirectoryReportSchema,
|
|
944
|
+
locationDetailReportSchema,
|
|
945
|
+
personParamsSchema,
|
|
946
|
+
actorDirectoryReportSchema,
|
|
947
|
+
actorProfileReportSchema,
|
|
948
|
+
personalSpendReportSchema,
|
|
949
|
+
personalTokenMetadataSchema,
|
|
950
|
+
personalTokenListSchema,
|
|
951
|
+
createPersonalTokenBodySchema,
|
|
952
|
+
createdPersonalTokenSchema,
|
|
953
|
+
personalTokenParamsSchema,
|
|
954
|
+
revokePersonalTokenResponseSchema,
|
|
955
|
+
scheduledTaskSummarySchema,
|
|
956
|
+
eventTaskSummarySchema,
|
|
957
|
+
taskSummarySchema,
|
|
958
|
+
taskListSchema,
|
|
959
|
+
taskParamsSchema,
|
|
960
|
+
taskExecutionStatusSchema,
|
|
961
|
+
taskExecutionSchema,
|
|
962
|
+
taskExecutionStatusDaySchema,
|
|
963
|
+
taskExecutionListSchema,
|
|
964
|
+
taskRunSchema,
|
|
965
|
+
taskRunListSchema,
|
|
966
|
+
workspaceRepoSchema,
|
|
967
|
+
baselineSnapshotSchema,
|
|
968
|
+
workspaceSchema,
|
|
969
|
+
workspaceListSchema,
|
|
970
|
+
workspaceBodySchema,
|
|
971
|
+
workspaceParamsSchema,
|
|
972
|
+
deleteWorkspaceResponseSchema,
|
|
973
|
+
statSchema,
|
|
974
|
+
statsReportSchema
|
|
975
|
+
};
|