@sentry/junior 0.114.0 → 0.116.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.
Files changed (147) hide show
  1. package/dist/{agent-hooks-WNBUY4OB.js → agent-hooks-67NFITDH.js} +13 -12
  2. package/dist/api/conversations/detail.d.ts +20 -0
  3. package/dist/api/conversations/event-list.d.ts +2 -0
  4. package/dist/api/conversations/event-page.d.ts +1 -1
  5. package/dist/api/conversations/events.d.ts +1 -1
  6. package/dist/api/health.d.ts +7 -0
  7. package/dist/api/people/profile.d.ts +2 -2
  8. package/dist/api/people/shared.d.ts +1 -1
  9. package/dist/api/personal-tokens/create.d.ts +11 -0
  10. package/dist/api/personal-tokens/list.d.ts +12 -0
  11. package/dist/api/personal-tokens/revoke.d.ts +5 -0
  12. package/dist/api/personal-tokens/routes.d.ts +4 -0
  13. package/dist/api/plugin-reports.d.ts +62 -0
  14. package/dist/api/plugins.d.ts +8 -0
  15. package/dist/api/route.d.ts +1 -1
  16. package/dist/api/runtime.d.ts +24 -0
  17. package/dist/api/schema/conversation.d.ts +26 -0
  18. package/dist/api/schema/person.d.ts +3 -3
  19. package/dist/api/schema/personal-token.d.ts +38 -0
  20. package/dist/api/schema.d.ts +4 -2
  21. package/dist/api/schema.js +19 -7
  22. package/dist/api/skills.d.ts +6 -0
  23. package/dist/api.d.ts +1 -0
  24. package/dist/api.js +285 -121
  25. package/dist/app.js +1957 -5677
  26. package/dist/catalog-runtime-CWZY6GTH.js +18 -0
  27. package/dist/chat/agent/request.d.ts +7 -0
  28. package/dist/chat/agent/resume.d.ts +1 -0
  29. package/dist/chat/agent/sandbox.d.ts +3 -0
  30. package/dist/chat/agent/tools.d.ts +3 -0
  31. package/dist/chat/agent-dispatch/context.d.ts +2 -0
  32. package/dist/chat/agent-dispatch/heartbeat.d.ts +11 -5
  33. package/dist/chat/agent-dispatch/signing.d.ts +14 -5
  34. package/dist/chat/agent-dispatch/store.d.ts +36 -15
  35. package/dist/chat/agent-dispatch/types.d.ts +23 -10
  36. package/dist/chat/agent-dispatch/work.d.ts +58 -0
  37. package/dist/chat/app/factory.d.ts +12 -3
  38. package/dist/chat/config.d.ts +2 -0
  39. package/dist/chat/conversations/history.d.ts +291 -290
  40. package/dist/chat/conversations/projection.d.ts +2 -2
  41. package/dist/chat/local/credential-sync.d.ts +5 -0
  42. package/dist/chat/local/oauth-relay.d.ts +4 -0
  43. package/dist/chat/mcp/oauth.d.ts +1 -0
  44. package/dist/chat/mcp/tool-manager.d.ts +2 -1
  45. package/dist/chat/oauth-authorization.d.ts +17 -0
  46. package/dist/chat/oauth-flow.d.ts +9 -0
  47. package/dist/chat/pi/conversation-events.d.ts +6 -2
  48. package/dist/chat/plugins/annotations.d.ts +8 -0
  49. package/dist/chat/plugins/registry.d.ts +0 -3
  50. package/dist/chat/plugins/types.d.ts +0 -2
  51. package/dist/chat/runtime/agent-continue-runner.d.ts +4 -0
  52. package/dist/chat/runtime/reply-executor.d.ts +6 -1
  53. package/dist/chat/runtime/slack-resume.d.ts +5 -1
  54. package/dist/chat/runtime/turn-input.d.ts +3 -0
  55. package/dist/chat/sandbox/egress/schemas.d.ts +46 -0
  56. package/dist/chat/sandbox/egress/signals.d.ts +9 -0
  57. package/dist/chat/sandbox/sandbox.d.ts +4 -1
  58. package/dist/chat/sandbox/session.d.ts +2 -11
  59. package/dist/chat/sandbox/workspace.d.ts +10 -2
  60. package/dist/chat/sentry-payload-filter.d.ts +4 -4
  61. package/dist/chat/services/mcp-auth-orchestration.d.ts +5 -3
  62. package/dist/chat/services/plugin-auth-orchestration.d.ts +2 -0
  63. package/dist/chat/services/turn-session-record.d.ts +14 -1
  64. package/dist/chat/slack/dispatch-turn.d.ts +25 -0
  65. package/dist/chat/slack/message-control.d.ts +2 -0
  66. package/dist/chat/slack/oauth-authorization-message.d.ts +3 -0
  67. package/dist/chat/state/turn-session.d.ts +11 -0
  68. package/dist/chat/task-execution/slack-work.d.ts +2 -0
  69. package/dist/chat/tool-support/text-range-result.d.ts +3 -0
  70. package/dist/chat/tool-support/zod-tool.d.ts +2 -1
  71. package/dist/chat/tools/definition.d.ts +3 -5
  72. package/dist/chat/tools/query-conversation-events.d.ts +68 -0
  73. package/dist/chat/tools/sandbox/file-utils.d.ts +8 -1
  74. package/dist/chat/tools/sandbox/find-files.d.ts +2 -1
  75. package/dist/chat/tools/sandbox/grep.d.ts +2 -1
  76. package/dist/{chunk-OSKEC4XU.js → chunk-25GU5B5E.js} +1 -1
  77. package/dist/{chunk-XLFBQJUO.js → chunk-3H45VOBZ.js} +32 -7
  78. package/dist/{chunk-4FUEG3QY.js → chunk-3JOGUT46.js} +4 -16
  79. package/dist/chunk-4CODA7P5.js +43 -0
  80. package/dist/{chunk-O4GT7LYB.js → chunk-4DD6AOCG.js} +3 -43
  81. package/dist/{chunk-YU6PO42Q.js → chunk-53ZKTQO6.js} +1 -1
  82. package/dist/{chunk-WV4UJBAS.js → chunk-5UNB623T.js} +1282 -2536
  83. package/dist/{chunk-TLGM5X2M.js → chunk-6RQ5GCWH.js} +2 -2
  84. package/dist/{chunk-MIAKQNYX.js → chunk-6ZK6FZIV.js} +1 -1
  85. package/dist/{chunk-W6RDUAO3.js → chunk-BXLS3I4W.js} +1 -1
  86. package/dist/{chunk-RD7EJI7H.js → chunk-CI3VK7X5.js} +69 -3
  87. package/dist/chunk-DIB4GX3G.js +8 -0
  88. package/dist/{chunk-42WRQLJ6.js → chunk-F3B2YJ76.js} +0 -14
  89. package/dist/chunk-FA6POGLH.js +70 -0
  90. package/dist/{chunk-6Y5L4BOM.js → chunk-FXOYURO4.js} +5 -3
  91. package/dist/chunk-HDSDCEPK.js +80 -0
  92. package/dist/{chunk-C4MZ3GP5.js → chunk-HZF5P5UN.js} +1 -1
  93. package/dist/{chunk-K2W4CK7K.js → chunk-JZPQ5K4V.js} +10 -129
  94. package/dist/{chunk-FIGAF6KL.js → chunk-KBNDFU6J.js} +108 -38
  95. package/dist/{chunk-PM3PX42K.js → chunk-MGH5ADQS.js} +1 -2
  96. package/dist/{chunk-5CZ7RETL.js → chunk-N7TMYLF2.js} +1 -1
  97. package/dist/chunk-OB42YVAE.js +16 -0
  98. package/dist/{chunk-6QWPVTMO.js → chunk-OF5FODBL.js} +125 -23
  99. package/dist/{chunk-2ZTTXTSZ.js → chunk-PE44LDDQ.js} +9 -4
  100. package/dist/chunk-PGKWXHYJ.js +1870 -0
  101. package/dist/{chunk-ZGXH3REA.js → chunk-PZGPCOSD.js} +12 -2
  102. package/dist/{chunk-JQFJO5WH.js → chunk-RXRQJF7Y.js} +74 -17
  103. package/dist/{chunk-S4QDH23A.js → chunk-TC4ZEM2D.js} +113 -79
  104. package/dist/{chunk-ABPSDO6M.js → chunk-UEVLIYK5.js} +234 -165
  105. package/dist/chunk-VKZ6WVAY.js +4318 -0
  106. package/dist/{chunk-VNNBSKCO.js → chunk-VZCSLYCE.js} +22 -7
  107. package/dist/chunk-W3U3YQYI.js +71 -0
  108. package/dist/{chunk-SG5WAA7H.js → chunk-WKU7TY22.js} +0 -3
  109. package/dist/cli/chat.js +74 -42
  110. package/dist/cli/check.js +10 -8
  111. package/dist/cli/init.js +1 -0
  112. package/dist/cli/plugins.js +18 -16
  113. package/dist/cli/snapshot-warmup.js +13 -11
  114. package/dist/cli/upgrade.js +12 -10
  115. package/dist/db/schema/api-tokens.d.ts +160 -0
  116. package/dist/db/schema/conversation-annotations.d.ts +142 -0
  117. package/dist/db/schema.d.ts +305 -1
  118. package/dist/{db-4VLP7KBF.js → db-57FHVGGQ.js} +9 -8
  119. package/dist/handlers/agent-dispatch.d.ts +7 -3
  120. package/dist/handlers/sandbox-egress-signals.d.ts +4 -0
  121. package/dist/instrumentation.js +72 -4
  122. package/dist/nitro.js +5 -5
  123. package/dist/oauth-callback-server-PAQRPXZX.js +231 -0
  124. package/dist/oauth-relay-3ZU72UGL.js +9 -0
  125. package/dist/personal-tokens/store.d.ts +27 -0
  126. package/dist/{plugins-PZMDS7AT.js → plugins-IUJA4VBU.js} +1 -1
  127. package/dist/reporting-schema.d.ts +10 -4
  128. package/dist/reporting.d.ts +5 -5
  129. package/dist/{runner-IPXLWQOF.js → runner-4ISZYJEX.js} +141 -74
  130. package/dist/sandbox-egress-signals-CDFAP67O.js +75 -0
  131. package/dist/{skills-QCNZISNF.js → skills-UE2KXQMB.js} +10 -8
  132. package/dist/validation-PO5LHTJT.js +21 -0
  133. package/dist/version.js +1 -1
  134. package/migrations/0008_sticky_rage.sql +14 -0
  135. package/migrations/0009_slippery_harrier.sql +12 -0
  136. package/migrations/0010_native_conversation_history.sql +142 -0
  137. package/migrations/meta/0008_snapshot.json +1076 -0
  138. package/migrations/meta/0009_snapshot.json +1146 -0
  139. package/migrations/meta/0010_snapshot.json +1190 -0
  140. package/migrations/meta/_journal.json +22 -1
  141. package/package.json +6 -7
  142. package/dist/catalog-runtime-6O4M6JGA.js +0 -16
  143. package/dist/chat/agent-dispatch/runner.d.ts +0 -13
  144. package/dist/chat/capabilities/catalog.d.ts +0 -16
  145. package/dist/chat/oauth-authorization-message.d.ts +0 -6
  146. package/dist/validation-I2BW3UHD.js +0 -19
  147. package/dist/{chunk-KNFROR7R.js → chunk-5I6ORJUY.js} +1 -1
@@ -4,7 +4,7 @@ import {
4
4
  toCanonicalInputMessage,
5
5
  toCanonicalOutputMessage,
6
6
  toGenAiMessagesTraceAttributes
7
- } from "./chunk-6Y5L4BOM.js";
7
+ } from "./chunk-FXOYURO4.js";
8
8
  import {
9
9
  extractGenAiUsageAttributes,
10
10
  logException,
@@ -12,7 +12,7 @@ import {
12
12
  normalizeGenAiFinishReason,
13
13
  serializeGenAiAttribute,
14
14
  withSpan
15
- } from "./chunk-4FUEG3QY.js";
15
+ } from "./chunk-3JOGUT46.js";
16
16
 
17
17
  // src/chat/config.ts
18
18
  import { getModel as getModel2 } from "@earendil-works/pi-ai/compat";
@@ -693,6 +693,13 @@ function parseSlashCommand(rawValue) {
693
693
  }
694
694
  return command;
695
695
  }
696
+ function parseCrossActorMidRunMode(rawValue) {
697
+ const value = toOptionalTrimmed(rawValue) ?? "follow_up";
698
+ if (value === "follow_up" || value === "steer") {
699
+ return value;
700
+ }
701
+ throw new Error("JUNIOR_CROSS_ACTOR_MID_RUN_MODE must be follow_up or steer");
702
+ }
696
703
  var DEFAULT_MODEL_ID = getModel2("vercel-ai-gateway", "xai/grok-4.5").id;
697
704
  var DEFAULT_FAST_MODEL_ID = getModel2(
698
705
  "vercel-ai-gateway",
@@ -779,6 +786,9 @@ function readBotConfig(env, functionMaxDurationSeconds) {
779
786
  const handoffModelId = validateGatewayModelId(env.AI_HANDOFF_MODEL) ?? DEFAULT_HANDOFF_MODEL_ID;
780
787
  return {
781
788
  userName: toOptionalTrimmed(env.JUNIOR_BOT_NAME) ?? "junior",
789
+ crossActorMidRunMode: parseCrossActorMidRunMode(
790
+ env.JUNIOR_CROSS_ACTOR_MID_RUN_MODE
791
+ ),
782
792
  profiles: parseProfiles(env.AI_MODEL_PROFILES, modelId, handoffModelId),
783
793
  contextWindowTokens: parseOptionalPositiveInteger(
784
794
  "AI_MODEL_CONTEXT_WINDOW_TOKENS",
@@ -11,18 +11,14 @@ import {
11
11
  import { drizzle } from "drizzle-orm/neon-serverless";
12
12
  import { migrate } from "drizzle-orm/neon-serverless/migrator";
13
13
 
14
- // src/db/schema/conversation-events.ts
14
+ // src/db/schema/conversation-annotations.ts
15
15
  import {
16
16
  foreignKey,
17
- index as index3,
18
- integer as integer2,
19
17
  jsonb as jsonb3,
20
18
  pgTable as pgTable4,
21
19
  primaryKey,
22
- text as text4,
23
- uniqueIndex as uniqueIndex3
20
+ text as text4
24
21
  } from "drizzle-orm/pg-core";
25
- import { sql as sql3 } from "drizzle-orm";
26
22
 
27
23
  // src/db/schema/conversations.ts
28
24
  import { sql as sql2 } from "drizzle-orm";
@@ -178,41 +174,98 @@ var juniorConversations = pgTable3(
178
174
  ]
179
175
  );
180
176
 
177
+ // src/db/schema/conversation-annotations.ts
178
+ var juniorConversationAnnotations = pgTable4(
179
+ "junior_conversation_annotations",
180
+ {
181
+ conversationId: text4("conversation_id").notNull(),
182
+ plugin: text4("plugin").notNull(),
183
+ kind: text4("kind").notNull(),
184
+ key: text4("key").notNull(),
185
+ annotation: jsonb3("annotation_json").$type().notNull(),
186
+ createdAt: timestamptz("created_at").notNull(),
187
+ updatedAt: timestamptz("updated_at").notNull()
188
+ },
189
+ (table) => [
190
+ primaryKey({
191
+ name: "junior_conversation_annotations_pk",
192
+ columns: [table.conversationId, table.plugin, table.kind, table.key]
193
+ }),
194
+ foreignKey({
195
+ name: "junior_conversation_annotations_conversation_id_fk",
196
+ columns: [table.conversationId],
197
+ foreignColumns: [juniorConversations.conversationId]
198
+ }).onDelete("cascade")
199
+ ]
200
+ );
201
+
202
+ // src/db/schema/api-tokens.ts
203
+ import { index as index3, pgTable as pgTable5, text as text5, uniqueIndex as uniqueIndex3 } from "drizzle-orm/pg-core";
204
+ var juniorApiTokens = pgTable5(
205
+ "junior_api_tokens",
206
+ {
207
+ id: text5("id").primaryKey(),
208
+ ownerEmailNormalized: text5("owner_email_normalized").notNull(),
209
+ name: text5("name").notNull(),
210
+ tokenHash: text5("token_hash").notNull(),
211
+ tokenSuffix: text5("token_suffix").notNull(),
212
+ createdAt: timestamptz("created_at").notNull(),
213
+ expiresAt: timestamptz("expires_at").notNull(),
214
+ lastUsedAt: timestamptz("last_used_at"),
215
+ revokedAt: timestamptz("revoked_at")
216
+ },
217
+ (table) => [
218
+ uniqueIndex3("junior_api_tokens_token_hash_uidx").on(table.tokenHash),
219
+ index3("junior_api_tokens_owner_email_idx").on(table.ownerEmailNormalized)
220
+ ]
221
+ );
222
+
181
223
  // src/db/schema/conversation-events.ts
182
- var juniorConversationEvents = pgTable4(
224
+ import {
225
+ foreignKey as foreignKey2,
226
+ index as index4,
227
+ integer as integer2,
228
+ jsonb as jsonb4,
229
+ pgTable as pgTable6,
230
+ primaryKey as primaryKey2,
231
+ text as text6,
232
+ uniqueIndex as uniqueIndex4
233
+ } from "drizzle-orm/pg-core";
234
+ import { sql as sql3 } from "drizzle-orm";
235
+ var juniorConversationEvents = pgTable6(
183
236
  "junior_conversation_events",
184
237
  {
185
- conversationId: text4("conversation_id").notNull(),
238
+ conversationId: text6("conversation_id").notNull(),
186
239
  seq: integer2("seq").notNull(),
187
240
  historyVersion: integer2("history_version").notNull(),
188
241
  schemaVersion: integer2("schema_version").default(1).notNull(),
189
- idempotencyKey: text4("idempotency_key"),
190
- type: text4("type").notNull(),
191
- payload: jsonb3("payload").$type().notNull(),
242
+ idempotencyKey: text6("idempotency_key"),
243
+ type: text6("type").notNull(),
244
+ payload: jsonb4("payload").$type().notNull(),
192
245
  createdAt: timestamptz("created_at").notNull()
193
246
  },
194
247
  (table) => [
195
- primaryKey({
248
+ primaryKey2({
196
249
  name: "junior_conversation_events_conversation_id_seq_pk",
197
250
  columns: [table.conversationId, table.seq]
198
251
  }),
199
- foreignKey({
252
+ foreignKey2({
200
253
  name: "junior_conversation_events_conversation_id_junior_conversations_conversation_id_fk",
201
254
  columns: [table.conversationId],
202
255
  foreignColumns: [juniorConversations.conversationId]
203
256
  }),
204
- index3("junior_conversation_events_history_version_idx").on(
257
+ index4("junior_conversation_events_history_version_idx").on(
205
258
  table.conversationId,
206
259
  table.historyVersion,
207
260
  table.seq
208
261
  ),
209
- index3("junior_conversation_events_type_idx").on(
262
+ index4("junior_conversation_events_type_idx").on(
210
263
  table.conversationId,
211
264
  table.type,
212
265
  table.seq
213
266
  ),
214
- index3("junior_conversation_events_message_search_idx").using("gin", sql3`to_tsvector('english', ${table.payload}->>'text')`).where(sql3`${table.type} = 'message'`),
215
- uniqueIndex3("junior_conversation_events_idempotency_idx").on(
267
+ index4("junior_conversation_events_message_search_idx").using("gin", sql3`to_tsvector('english', ${table.payload}->>'text')`).where(sql3`${table.type} = 'message'`),
268
+ uniqueIndex4("junior_conversation_events_idempotency_idx").on(
216
269
  table.conversationId,
217
270
  table.idempotencyKey
218
271
  )
@@ -221,6 +274,8 @@ var juniorConversationEvents = pgTable4(
221
274
 
222
275
  // src/db/schema.ts
223
276
  var juniorSqlSchema = {
277
+ juniorConversationAnnotations,
278
+ juniorApiTokens,
224
279
  juniorConversationEvents,
225
280
  juniorConversations,
226
281
  juniorDestinations,
@@ -472,6 +527,8 @@ export {
472
527
  juniorUsers,
473
528
  juniorIdentities,
474
529
  juniorConversations,
530
+ juniorConversationAnnotations,
531
+ juniorApiTokens,
475
532
  juniorConversationEvents,
476
533
  createJuniorSqlExecutor
477
534
  };
@@ -5,12 +5,41 @@ import {
5
5
  juniorDestinationKindSchema
6
6
  } from "./chunk-VFUK3X5B.js";
7
7
 
8
- // src/api/schema/common.ts
8
+ // src/api/activity.ts
9
9
  import { z } from "zod";
10
- var apiErrorSchema = z.object({ error: z.string().min(1) }).strict();
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
+ }
11
39
 
12
40
  // src/api/schema/conversation.ts
13
41
  import { z as z2 } from "zod";
42
+ import { conversationAnnotationInputSchema } from "@sentry/junior-plugin-api";
14
43
  var conversationReportStatusSchema = z2.enum([
15
44
  "active",
16
45
  "completed",
@@ -130,6 +159,7 @@ var conversationReportCompactionEventDataSchema = z2.object({
130
159
  type: z2.literal("compaction"),
131
160
  modelProfile: z2.string().min(1).optional(),
132
161
  modelId: z2.string().min(1).optional(),
162
+ summary: z2.string().min(1).optional(),
133
163
  details: z2.object({
134
164
  reason: z2.literal("capacity"),
135
165
  estimatedInputTokens: z2.number().int().nonnegative(),
@@ -146,7 +176,8 @@ var conversationReportHandoffEventDataSchema = z2.object({
146
176
  modelProfile: z2.string().min(1),
147
177
  modelId: z2.string().min(1),
148
178
  reasoningLevel: z2.string().min(1).optional(),
149
- triggeringToolCallId: z2.string().min(1).optional()
179
+ triggeringToolCallId: z2.string().min(1).optional(),
180
+ summary: z2.string().min(1).optional()
150
181
  }).strict();
151
182
  var conversationReportSubagentEventDataSchema = z2.object({
152
183
  type: z2.literal("subagent"),
@@ -233,6 +264,15 @@ function validateConversationEvents(report, context) {
233
264
  }
234
265
  }
235
266
  var conversationDetailReportSchema = conversationSummaryReportSchema.extend({
267
+ annotations: z2.array(
268
+ conversationAnnotationInputSchema.and(
269
+ z2.object({
270
+ plugin: z2.string().min(1),
271
+ createdAt: z2.string().datetime(),
272
+ updatedAt: z2.string().datetime()
273
+ })
274
+ )
275
+ ).optional(),
236
276
  modelUsage: z2.array(conversationModelUsageSchema).optional(),
237
277
  events: z2.array(conversationReportEventSchema),
238
278
  eventHistory: conversationEventHistorySchema,
@@ -282,37 +322,58 @@ var conversationStatsReportSchema = z2.object({
282
322
  windowStart: z2.string()
283
323
  }).strict();
284
324
 
285
- // src/api/activity.ts
325
+ // src/api/schema/person.ts
286
326
  import { z as z3 } from "zod";
287
- var dailyConversationActivitySchema = z3.object({
327
+ var personParamsSchema = z3.object({ email: z3.string().trim().min(1) }).strict();
328
+ var peopleConversationStatsItemSchema = conversationStatsItemSchema.omit({ costUsd: true });
329
+ var actorActivityDayReportSchema = z3.object({
288
330
  active: z3.number(),
289
331
  conversations: z3.number(),
332
+ costUsd: z3.number().optional(),
290
333
  date: z3.string(),
291
334
  durationMs: z3.number(),
292
335
  failed: z3.number(),
293
336
  tokens: z3.number().optional()
294
337
  }).strict();
295
- function emptyActivityDay(date) {
296
- return {
297
- active: 0,
298
- conversations: 0,
299
- date,
300
- durationMs: 0,
301
- failed: 0
302
- };
303
- }
304
- function activityDays(days, nowMs, count) {
305
- const items = [];
306
- const end = new Date(nowMs);
307
- end.setUTCHours(0, 0, 0, 0);
308
- const start = new Date(end);
309
- start.setUTCDate(start.getUTCDate() - (count - 1));
310
- for (const cursor = new Date(start); cursor.getTime() <= end.getTime(); cursor.setUTCDate(cursor.getUTCDate() + 1)) {
311
- const date = cursor.toISOString().slice(0, 10);
312
- items.push(days.get(date) ?? emptyActivityDay(date));
313
- }
314
- return items;
315
- }
338
+ var peopleActivityDayReportSchema = z3.object({
339
+ activePeople: z3.number(),
340
+ conversations: z3.number(),
341
+ date: z3.string()
342
+ }).strict();
343
+ var actorTotalsReportSchema = z3.object({
344
+ active: z3.number(),
345
+ activeDays: z3.number(),
346
+ conversations: z3.number(),
347
+ durationMs: z3.number(),
348
+ failed: z3.number(),
349
+ tokens: z3.number().optional()
350
+ }).strict();
351
+ var identifiedActorSchema = actorIdentitySchema.extend({ email: z3.string().min(1) }).strict();
352
+ var actorSummaryReportSchema = actorTotalsReportSchema.extend({
353
+ firstSeenAt: z3.string(),
354
+ lastSeenAt: z3.string(),
355
+ actor: identifiedActorSchema
356
+ }).strict();
357
+ var actorDirectoryReportSchema = z3.object({
358
+ activityDays: z3.array(peopleActivityDayReportSchema),
359
+ generatedAt: z3.string(),
360
+ people: z3.array(actorSummaryReportSchema),
361
+ source: z3.literal("conversation_index"),
362
+ windowEnd: z3.string(),
363
+ windowStart: z3.string()
364
+ }).strict();
365
+ var actorProfileReportSchema = z3.object({
366
+ activityDays: z3.array(actorActivityDayReportSchema),
367
+ generatedAt: z3.string(),
368
+ locations: z3.array(peopleConversationStatsItemSchema),
369
+ recentConversations: z3.array(conversationSummaryReportSchema),
370
+ actor: identifiedActorSchema,
371
+ source: z3.literal("conversation_index"),
372
+ surfaces: z3.array(peopleConversationStatsItemSchema),
373
+ totals: actorTotalsReportSchema,
374
+ windowEnd: z3.string(),
375
+ windowStart: z3.string()
376
+ }).strict();
316
377
 
317
378
  // src/api/schema/location.ts
318
379
  import { z as z4 } from "zod";
@@ -351,58 +412,25 @@ var locationDetailReportSchema = locationSummaryReportSchema.extend({
351
412
  windowStart: z4.string()
352
413
  }).strict();
353
414
 
354
- // src/api/schema/person.ts
415
+ // src/api/schema/common.ts
355
416
  import { z as z5 } from "zod";
356
- var personParamsSchema = z5.object({ email: z5.string().trim().min(1) }).strict();
357
- var peopleConversationStatsItemSchema = conversationStatsItemSchema.omit({ costUsd: true });
358
- var actorActivityDayReportSchema = z5.object({
359
- active: z5.number(),
360
- conversations: z5.number(),
361
- costUsd: z5.number().optional(),
362
- date: z5.string(),
363
- durationMs: z5.number(),
364
- failed: z5.number(),
365
- tokens: z5.number().optional()
366
- }).strict();
367
- var peopleActivityDayReportSchema = z5.object({
368
- activePeople: z5.number(),
369
- conversations: z5.number(),
370
- date: z5.string()
371
- }).strict();
372
- var actorTotalsReportSchema = z5.object({
373
- active: z5.number(),
374
- activeDays: z5.number(),
375
- conversations: z5.number(),
376
- durationMs: z5.number(),
377
- failed: z5.number(),
378
- tokens: z5.number().optional()
379
- }).strict();
380
- var identifiedActorSchema = actorIdentitySchema.extend({ email: z5.string().min(1) }).strict();
381
- var actorSummaryReportSchema = actorTotalsReportSchema.extend({
382
- firstSeenAt: z5.string(),
383
- lastSeenAt: z5.string(),
384
- actor: identifiedActorSchema
385
- }).strict();
386
- var actorDirectoryReportSchema = z5.object({
387
- activityDays: z5.array(peopleActivityDayReportSchema),
388
- generatedAt: z5.string(),
389
- people: z5.array(actorSummaryReportSchema),
390
- source: z5.literal("conversation_index"),
391
- windowEnd: z5.string(),
392
- windowStart: z5.string()
393
- }).strict();
394
- var actorProfileReportSchema = z5.object({
395
- activityDays: z5.array(actorActivityDayReportSchema),
396
- generatedAt: z5.string(),
397
- locations: z5.array(peopleConversationStatsItemSchema),
398
- recentConversations: z5.array(conversationSummaryReportSchema),
399
- actor: identifiedActorSchema,
400
- source: z5.literal("conversation_index"),
401
- surfaces: z5.array(peopleConversationStatsItemSchema),
402
- totals: actorTotalsReportSchema,
403
- windowEnd: z5.string(),
404
- windowStart: z5.string()
417
+ var apiErrorSchema = z5.object({ error: z5.string().min(1) }).strict();
418
+
419
+ // src/api/schema/personal-token.ts
420
+ import { z as z6 } from "zod";
421
+ var personalTokenMetadataSchema = z6.object({
422
+ id: z6.string().uuid(),
423
+ name: z6.string(),
424
+ tokenSuffix: z6.string(),
425
+ createdAt: z6.string().datetime(),
426
+ expiresAt: z6.string().datetime(),
427
+ lastUsedAt: z6.string().datetime().nullable()
405
428
  }).strict();
429
+ var personalTokenListSchema = z6.object({ tokens: z6.array(personalTokenMetadataSchema) }).strict();
430
+ var createPersonalTokenBodySchema = z6.object({ name: z6.string().trim().min(1).max(80) }).strict();
431
+ var createdPersonalTokenSchema = personalTokenMetadataSchema.extend({ token: z6.string().startsWith("jr_pat_") }).strict();
432
+ var personalTokenParamsSchema = z6.object({ id: z6.string().uuid() }).strict();
433
+ var revokePersonalTokenResponseSchema = z6.object({ revoked: z6.literal(true) }).strict();
406
434
 
407
435
  export {
408
436
  apiErrorSchema,
@@ -422,11 +450,17 @@ export {
422
450
  conversationStatsReportSchema,
423
451
  dailyConversationActivitySchema,
424
452
  activityDays,
453
+ personParamsSchema,
454
+ actorDirectoryReportSchema,
455
+ actorProfileReportSchema,
425
456
  locationParamsSchema,
426
457
  locationActivityDayReportSchema,
427
458
  locationDirectoryReportSchema,
428
459
  locationDetailReportSchema,
429
- personParamsSchema,
430
- actorDirectoryReportSchema,
431
- actorProfileReportSchema
460
+ personalTokenMetadataSchema,
461
+ personalTokenListSchema,
462
+ createPersonalTokenBodySchema,
463
+ createdPersonalTokenSchema,
464
+ personalTokenParamsSchema,
465
+ revokePersonalTokenResponseSchema
432
466
  };