@sentry/junior 0.131.0 → 0.132.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 (56) hide show
  1. package/dist/{agent-hooks-M5V454P5.js → agent-hooks-ONXOJDR6.js} +8 -8
  2. package/dist/api/conversations/list.d.ts +13 -2
  3. package/dist/api/schema/task.d.ts +0 -3
  4. package/dist/api/schema.js +1 -1
  5. package/dist/api.js +23 -22
  6. package/dist/app.js +21 -21
  7. package/dist/{catalog-runtime-PI2IFWZ5.js → catalog-runtime-BATAY4R7.js} +5 -5
  8. package/dist/chat/conversations/location.d.ts +10 -0
  9. package/dist/chat/conversations/sql/location.d.ts +9 -0
  10. package/dist/chat/conversations/store.d.ts +2 -0
  11. package/dist/chat/scheduled-tasks/tool-support.d.ts +2 -5
  12. package/dist/chat/scheduled-tasks/tools/create.d.ts +2 -2
  13. package/dist/chat/scheduled-tasks/tools/delete.d.ts +2 -2
  14. package/dist/chat/scheduled-tasks/tools/list.d.ts +2 -2
  15. package/dist/chat/scheduled-tasks/tools/run-now.d.ts +2 -2
  16. package/dist/chat/scheduled-tasks/tools/update.d.ts +3 -3
  17. package/dist/chat/scheduled-tasks/types.d.ts +1 -1
  18. package/dist/{chunk-SVX4JDOR.js → chunk-2425Q4OR.js} +1 -1
  19. package/dist/{chunk-MLIJGLW5.js → chunk-ALDPUN3Z.js} +4 -4
  20. package/dist/{chunk-XXGCQCFJ.js → chunk-AW5Z3T7V.js} +4 -4
  21. package/dist/{chunk-APUL3Y63.js → chunk-B7IY6SVJ.js} +1 -1
  22. package/dist/{chunk-J4I2GVGH.js → chunk-BKE47OOW.js} +2 -2
  23. package/dist/{chunk-JKHK3LM2.js → chunk-G3WYA2RS.js} +1 -1
  24. package/dist/{chunk-HSPYTFMD.js → chunk-GOEZU33G.js} +1 -1
  25. package/dist/{chunk-HZ5EVSPV.js → chunk-GPXVDJML.js} +4 -4
  26. package/dist/{chunk-VMPL77IK.js → chunk-GTKNPQNN.js} +12 -12
  27. package/dist/{chunk-KWYCUXJX.js → chunk-ISNRPCPG.js} +1 -1
  28. package/dist/{chunk-UYYSD255.js → chunk-JYQAE2ZU.js} +1 -1
  29. package/dist/{chunk-ZMIO64MA.js → chunk-NNHUGGO4.js} +2 -2
  30. package/dist/{chunk-D6ZMP3FC.js → chunk-O2UXPUVQ.js} +6 -6
  31. package/dist/{chunk-XMDY52DJ.js → chunk-ODIP5CEM.js} +1 -1
  32. package/dist/{chunk-BVKP37NE.js → chunk-QVEXYYFM.js} +1 -1
  33. package/dist/{chunk-DRFI6CW3.js → chunk-SKWIIUS7.js} +7 -7
  34. package/dist/{chunk-NGJEC4MF.js → chunk-U76PS7AT.js} +2 -2
  35. package/dist/{chunk-7Y2OKB5K.js → chunk-V44FFBO3.js} +1 -1
  36. package/dist/{chunk-TD2A27ET.js → chunk-WEJIS7OC.js} +1 -1
  37. package/dist/{chunk-5ONXE2GF.js → chunk-WYQP7QSB.js} +206 -176
  38. package/dist/{chunk-7X62XOC4.js → chunk-XN656LB4.js} +53 -18
  39. package/dist/{chunk-TRKWWIB3.js → chunk-ZMV2YBT6.js} +21 -21
  40. package/dist/cli/chat.js +23 -23
  41. package/dist/cli/check.js +6 -6
  42. package/dist/cli/plugins.js +11 -11
  43. package/dist/cli/snapshot-create.js +9 -9
  44. package/dist/cli/upgrade.js +6 -6
  45. package/dist/{db-5P6K3ZCM.js → db-QFFZACXF.js} +6 -6
  46. package/dist/instrumentation.js +4 -4
  47. package/dist/nitro.js +2 -2
  48. package/dist/{oauth-callback-server-RIMCKQZX.js → oauth-callback-server-5WXLD533.js} +16 -16
  49. package/dist/{runner-CAD3BVML.js → runner-Y3LTUNAA.js} +10 -10
  50. package/dist/{skills-WVPCTBUT.js → skills-7M5C24GM.js} +6 -6
  51. package/dist/{validation-GLEXIFFI.js → validation-MRILMYDI.js} +6 -6
  52. package/dist/version.js +1 -1
  53. package/migrations/0017_drop_paused_scheduled_tasks.sql +19 -0
  54. package/migrations/meta/0017_snapshot.json +1666 -0
  55. package/migrations/meta/_journal.json +7 -0
  56. package/package.json +4 -4
@@ -9,7 +9,7 @@ import {
9
9
  TURN_REASONING_LEVELS,
10
10
  getChatConfig,
11
11
  modelProfileSchema
12
- } from "./chunk-ZMIO64MA.js";
12
+ } from "./chunk-NNHUGGO4.js";
13
13
  import {
14
14
  juniorDestinations
15
15
  } from "./chunk-VFUK3X5B.js";
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-F3B2YJ76.js";
20
20
  import {
21
21
  normalizeIdentityEmail
22
- } from "./chunk-HSPYTFMD.js";
22
+ } from "./chunk-GOEZU33G.js";
23
23
 
24
24
  // src/chat/conversations/sql/store.ts
25
25
  import { randomUUID as randomUUID2 } from "crypto";
@@ -197,6 +197,39 @@ function parseSessionSource(value) {
197
197
  return parsed.success ? normalizeSessionSource(parsed.data) : void 0;
198
198
  }
199
199
 
200
+ // src/chat/conversations/location.ts
201
+ import { nonBlankStringSchema } from "@sentry/junior-plugin-api";
202
+ import { z } from "zod";
203
+ var locationSchema = z.object({
204
+ /** Junior-owned stable identity for this location. */
205
+ id: nonBlankStringSchema,
206
+ /** Provider namespace that owns the provider and tenant identifiers. */
207
+ provider: nonBlankStringSchema,
208
+ /** Optional provider-native workspace, account, or tenant scope. */
209
+ tenantId: nonBlankStringSchema.optional(),
210
+ /** Provider-native identifier for the container within its tenant scope. */
211
+ providerId: nonBlankStringSchema
212
+ }).strict();
213
+
214
+ // src/chat/conversations/sql/location.ts
215
+ function locationFromRow(row) {
216
+ if (!row || row.provider === "local") {
217
+ return void 0;
218
+ }
219
+ return locationSchema.parse({
220
+ id: row.id,
221
+ provider: row.provider,
222
+ ...row.providerTenantId ? { tenantId: row.providerTenantId } : {},
223
+ providerId: row.providerDestinationId
224
+ });
225
+ }
226
+ function privacyFromLocationRow(row) {
227
+ if (!row) {
228
+ return void 0;
229
+ }
230
+ return row.visibility === "public" ? "public" : "private";
231
+ }
232
+
200
233
  // src/chat/conversations/sql/store.ts
201
234
  var CONVERSATION_MUTATION_LOCK_PREFIX = "junior_conversation";
202
235
  function now() {
@@ -315,12 +348,6 @@ function executionStatusFromValue(value) {
315
348
  }
316
349
  throw new Error("Conversation record execution status is invalid");
317
350
  }
318
- function privacyFromRow(row) {
319
- if (row.destination === null) {
320
- return void 0;
321
- }
322
- return row.destination.visibility === "public" ? "public" : "private";
323
- }
324
351
  function actorFromIdentityRow(identity, userDisplayName) {
325
352
  if (!identity) {
326
353
  return void 0;
@@ -351,7 +378,7 @@ function destinationFromRow(destination) {
351
378
  }
352
379
  function conversationFromRow(readRow) {
353
380
  const row = readRow.conversation;
354
- const visibility = privacyFromRow(readRow);
381
+ const visibility = privacyFromLocationRow(readRow.destination);
355
382
  if (row.schemaVersion !== 1) {
356
383
  throw new Error("Conversation record schema version is invalid");
357
384
  }
@@ -384,6 +411,7 @@ function conversationFromRow(readRow) {
384
411
  ...row.runId ? { runId: row.runId } : {},
385
412
  updatedAtMs: msFromDate(row.executionUpdatedAt) ?? requiredMsFromDate(row.updatedAt)
386
413
  };
414
+ const location = locationFromRow(readRow.destination);
387
415
  return {
388
416
  schemaVersion: 1,
389
417
  conversationId: row.conversationId,
@@ -397,6 +425,7 @@ function conversationFromRow(readRow) {
397
425
  }
398
426
  } : {},
399
427
  ...destination ? { destination } : {},
428
+ ...location ? { location } : {},
400
429
  ...actor ? { actor } : {},
401
430
  ...msFromDate(row.archivedAt) !== void 0 ? { archivedAtMs: msFromDate(row.archivedAt) } : {},
402
431
  ...row.channelName ? { channelName: row.channelName } : {},
@@ -793,16 +822,16 @@ import {
793
822
  } from "drizzle-orm";
794
823
 
795
824
  // src/chat/conversations/history.ts
796
- import { z as z2 } from "zod";
825
+ import { z as z3 } from "zod";
797
826
 
798
827
  // src/chat/conversations/provenance.ts
799
828
  import { actorSchema } from "@sentry/junior-plugin-api";
800
- import { z } from "zod";
801
- var conversationMessageAuthoritySchema = z.union([
802
- z.literal("instruction"),
803
- z.literal("context")
829
+ import { z as z2 } from "zod";
830
+ var conversationMessageAuthoritySchema = z2.union([
831
+ z2.literal("instruction"),
832
+ z2.literal("context")
804
833
  ]);
805
- var conversationMessageProvenanceSchema = z.object({
834
+ var conversationMessageProvenanceSchema = z2.object({
806
835
  authority: conversationMessageAuthoritySchema,
807
836
  actor: actorSchema.optional()
808
837
  }).strict();
@@ -845,214 +874,214 @@ var handoffModelProfileSchema = modelProfileSchema.refine(
845
874
  (profile) => profile !== "standard",
846
875
  "handoff profile must not be standard"
847
876
  );
848
- var userMessageEventDataSchema = z2.object({
849
- type: z2.literal("user_message"),
850
- role: z2.never().optional(),
877
+ var userMessageEventDataSchema = z3.object({
878
+ type: z3.literal("user_message"),
879
+ role: z3.never().optional(),
851
880
  provenance: conversationMessageProvenanceSchema
852
881
  }).passthrough();
853
- var assistantMessageEventDataSchema = z2.object({
854
- type: z2.literal("assistant_message"),
855
- role: z2.never().optional()
882
+ var assistantMessageEventDataSchema = z3.object({
883
+ type: z3.literal("assistant_message"),
884
+ role: z3.never().optional()
856
885
  }).passthrough();
857
- var toolResultEventDataSchema = z2.object({
858
- type: z2.literal("tool_result"),
859
- role: z2.never().optional()
886
+ var toolResultEventDataSchema = z3.object({
887
+ type: z3.literal("tool_result"),
888
+ role: z3.never().optional()
860
889
  }).passthrough();
861
- var agentHistoryItemSchema = z2.discriminatedUnion("type", [
890
+ var agentHistoryItemSchema = z3.discriminatedUnion("type", [
862
891
  userMessageEventDataSchema,
863
892
  assistantMessageEventDataSchema,
864
893
  toolResultEventDataSchema
865
894
  ]);
866
- var nativeReplacementHistoryItemSchema = z2.object({
895
+ var nativeReplacementHistoryItemSchema = z3.object({
867
896
  item: agentHistoryItemSchema,
868
897
  // Preserve the copied item's position when a turn resumes. Synthetic
869
898
  // summary and handoff items have no source event.
870
- sourceEventSeq: z2.number().int().nonnegative().optional()
899
+ sourceEventSeq: z3.number().int().nonnegative().optional()
871
900
  }).strict();
872
- var replacementHistorySchema = z2.array(nativeReplacementHistoryItemSchema);
873
- var compactionDetailsSchema = z2.object({
874
- reason: z2.literal("capacity"),
875
- estimatedInputTokens: z2.number().int().nonnegative(),
876
- replacementInputTokens: z2.number().int().nonnegative().optional(),
877
- triggerTokens: z2.number().int().nonnegative(),
878
- inputLimitTokens: z2.number().int().positive(),
879
- inputMessageCount: z2.number().int().nonnegative(),
880
- retainedMessageCount: z2.number().int().nonnegative(),
881
- summaryChars: z2.number().int().nonnegative()
901
+ var replacementHistorySchema = z3.array(nativeReplacementHistoryItemSchema);
902
+ var compactionDetailsSchema = z3.object({
903
+ reason: z3.literal("capacity"),
904
+ estimatedInputTokens: z3.number().int().nonnegative(),
905
+ replacementInputTokens: z3.number().int().nonnegative().optional(),
906
+ triggerTokens: z3.number().int().nonnegative(),
907
+ inputLimitTokens: z3.number().int().positive(),
908
+ inputMessageCount: z3.number().int().nonnegative(),
909
+ retainedMessageCount: z3.number().int().nonnegative(),
910
+ summaryChars: z3.number().int().nonnegative()
882
911
  }).strict();
883
- var historyReplacementEventDataSchema = z2.discriminatedUnion("type", [
884
- z2.object({
885
- type: z2.literal("handoff"),
912
+ var historyReplacementEventDataSchema = z3.discriminatedUnion("type", [
913
+ z3.object({
914
+ type: z3.literal("handoff"),
886
915
  modelProfile: handoffModelProfileSchema,
887
- modelId: z2.string().min(1),
888
- reasoningLevel: z2.string().min(1).optional(),
889
- triggeringToolCallId: z2.string().min(1).optional(),
890
- summary: z2.string().min(1).optional(),
916
+ modelId: z3.string().min(1),
917
+ reasoningLevel: z3.string().min(1).optional(),
918
+ triggeringToolCallId: z3.string().min(1).optional(),
919
+ summary: z3.string().min(1).optional(),
891
920
  replacementHistory: replacementHistorySchema
892
921
  }).strict(),
893
- z2.object({
894
- type: z2.literal("compaction"),
922
+ z3.object({
923
+ type: z3.literal("compaction"),
895
924
  modelProfile: modelProfileSchema,
896
- modelId: z2.string().min(1),
925
+ modelId: z3.string().min(1),
897
926
  details: compactionDetailsSchema.optional(),
898
- summary: z2.string().min(1).optional(),
927
+ summary: z3.string().min(1).optional(),
899
928
  replacementHistory: replacementHistorySchema
900
929
  }).strict()
901
930
  ]);
902
- var historyReplacementSchema = z2.object({
931
+ var historyReplacementSchema = z3.object({
903
932
  data: historyReplacementEventDataSchema,
904
- createdAtMs: z2.number().finite()
933
+ createdAtMs: z3.number().finite()
905
934
  }).strict();
906
- var mcpProviderConnectedEventDataSchema = z2.object({
907
- type: z2.literal("mcp_provider_connected"),
908
- provider: z2.string().min(1)
935
+ var mcpProviderConnectedEventDataSchema = z3.object({
936
+ type: z3.literal("mcp_provider_connected"),
937
+ provider: z3.string().min(1)
909
938
  }).strict();
910
- var authorizationKindSchema = z2.union([
911
- z2.literal("plugin"),
912
- z2.literal("mcp")
939
+ var authorizationKindSchema = z3.union([
940
+ z3.literal("plugin"),
941
+ z3.literal("mcp")
913
942
  ]);
914
- var authorizationRequestedEventDataSchema = z2.object({
915
- type: z2.literal("authorization_requested"),
943
+ var authorizationRequestedEventDataSchema = z3.object({
944
+ type: z3.literal("authorization_requested"),
916
945
  kind: authorizationKindSchema,
917
- provider: z2.string().min(1),
918
- actorId: z2.string().min(1),
919
- authorizationId: z2.string().min(1),
920
- delivery: z2.union([
921
- z2.literal("private_link_sent"),
922
- z2.literal("private_link_reused")
946
+ provider: z3.string().min(1),
947
+ actorId: z3.string().min(1),
948
+ authorizationId: z3.string().min(1),
949
+ delivery: z3.union([
950
+ z3.literal("private_link_sent"),
951
+ z3.literal("private_link_reused")
923
952
  ])
924
953
  }).strict();
925
- var authorizationCompletedEventDataSchema = z2.object({
926
- type: z2.literal("authorization_completed"),
954
+ var authorizationCompletedEventDataSchema = z3.object({
955
+ type: z3.literal("authorization_completed"),
927
956
  kind: authorizationKindSchema,
928
- provider: z2.string().min(1),
929
- actorId: z2.string().min(1),
930
- authorizationId: z2.string().min(1)
957
+ provider: z3.string().min(1),
958
+ actorId: z3.string().min(1),
959
+ authorizationId: z3.string().min(1)
931
960
  }).strict();
932
- var toolExecutionStartedEventDataSchema = z2.object({
933
- type: z2.literal("tool_execution_started"),
934
- toolCallId: z2.string().min(1),
935
- toolName: z2.string().min(1)
961
+ var toolExecutionStartedEventDataSchema = z3.object({
962
+ type: z3.literal("tool_execution_started"),
963
+ toolCallId: z3.string().min(1),
964
+ toolName: z3.string().min(1)
936
965
  }).strict();
937
- var guardianActionReviewedEventDataSchema = z2.object({
938
- type: z2.literal("guardian_action_reviewed"),
939
- turnId: z2.string().min(1),
940
- toolCallId: z2.string().min(1),
941
- toolName: z2.string().min(1),
942
- costUsd: z2.number().finite().nonnegative().optional(),
943
- decision: z2.enum(["allow", "ask", "deny"]),
944
- riskLevel: z2.enum(["low", "medium", "high", "critical"]),
945
- userAuthorization: z2.enum(["high", "medium", "low", "unknown"])
966
+ var guardianActionReviewedEventDataSchema = z3.object({
967
+ type: z3.literal("guardian_action_reviewed"),
968
+ turnId: z3.string().min(1),
969
+ toolCallId: z3.string().min(1),
970
+ toolName: z3.string().min(1),
971
+ costUsd: z3.number().finite().nonnegative().optional(),
972
+ decision: z3.enum(["allow", "ask", "deny"]),
973
+ riskLevel: z3.enum(["low", "medium", "high", "critical"]),
974
+ userAuthorization: z3.enum(["high", "medium", "low", "unknown"])
946
975
  }).strict();
947
- var conversationMessageRoleSchema = z2.union([
948
- z2.literal("user"),
949
- z2.literal("assistant"),
950
- z2.literal("system")
976
+ var conversationMessageRoleSchema = z3.union([
977
+ z3.literal("user"),
978
+ z3.literal("assistant"),
979
+ z3.literal("system")
951
980
  ]);
952
- var messageEventDataSchema = z2.object({
953
- type: z2.literal("message"),
954
- messageId: z2.string().min(1),
981
+ var messageEventDataSchema = z3.object({
982
+ type: z3.literal("message"),
983
+ messageId: z3.string().min(1),
955
984
  role: conversationMessageRoleSchema,
956
- text: z2.string(),
957
- authorIdentityId: z2.string().min(1).optional(),
958
- meta: z2.record(z2.string(), z2.unknown()).optional()
985
+ text: z3.string(),
986
+ authorIdentityId: z3.string().min(1).optional(),
987
+ meta: z3.record(z3.string(), z3.unknown()).optional()
959
988
  }).strict();
960
989
  var messageUpdatedEventDataSchema = messageEventDataSchema.extend({
961
- type: z2.literal("message_updated")
990
+ type: z3.literal("message_updated")
962
991
  });
963
- var messageHandledEventDataSchema = z2.object({
964
- type: z2.literal("message_handled"),
965
- messageId: z2.string().min(1)
992
+ var messageHandledEventDataSchema = z3.object({
993
+ type: z3.literal("message_handled"),
994
+ messageId: z3.string().min(1)
966
995
  }).strict();
967
- var messagesSummarizedEventDataSchema = z2.object({
968
- type: z2.literal("messages_summarized"),
969
- historyFromSeq: z2.number().int().nonnegative(),
970
- compactions: z2.array(
971
- z2.object({
972
- coveredMessageCount: z2.number().int().nonnegative(),
973
- createdAtMs: z2.number(),
974
- id: z2.string().min(1),
975
- summary: z2.string()
996
+ var messagesSummarizedEventDataSchema = z3.object({
997
+ type: z3.literal("messages_summarized"),
998
+ historyFromSeq: z3.number().int().nonnegative(),
999
+ compactions: z3.array(
1000
+ z3.object({
1001
+ coveredMessageCount: z3.number().int().nonnegative(),
1002
+ createdAtMs: z3.number(),
1003
+ id: z3.string().min(1),
1004
+ summary: z3.string()
976
1005
  }).strict()
977
1006
  )
978
1007
  }).strict();
979
- var conversationTurnSurfaceSchema = z2.enum([
1008
+ var conversationTurnSurfaceSchema = z3.enum([
980
1009
  "slack",
981
1010
  "api",
982
1011
  "scheduler",
983
1012
  "internal"
984
1013
  ]);
985
- var conversationTurnFailureCodeSchema = z2.enum([
1014
+ var conversationTurnFailureCodeSchema = z3.enum([
986
1015
  "agent_run_failed",
987
1016
  "delivery_failed",
988
1017
  "model_execution_failed",
989
1018
  "persistence_failed"
990
1019
  ]);
991
- var turnStartedEventDataSchema = z2.object({
992
- type: z2.literal("turn_started"),
993
- turnId: z2.string().min(1),
994
- inputMessageIds: z2.array(z2.string().min(1)).min(1),
1020
+ var turnStartedEventDataSchema = z3.object({
1021
+ type: z3.literal("turn_started"),
1022
+ turnId: z3.string().min(1),
1023
+ inputMessageIds: z3.array(z3.string().min(1)).min(1),
995
1024
  surface: conversationTurnSurfaceSchema
996
1025
  }).strict().refine(
997
1026
  (data) => new Set(data.inputMessageIds).size === data.inputMessageIds.length,
998
1027
  "turn input message ids must be unique"
999
1028
  );
1000
- var turnRoutedEventDataSchema = z2.object({
1001
- type: z2.literal("turn_routed"),
1002
- turnId: z2.string().min(1),
1029
+ var turnRoutedEventDataSchema = z3.object({
1030
+ type: z3.literal("turn_routed"),
1031
+ turnId: z3.string().min(1),
1003
1032
  modelProfile: modelProfileSchema,
1004
- modelId: z2.string().min(1),
1005
- reasoningLevel: z2.enum(TURN_REASONING_LEVELS),
1006
- confidence: z2.number().min(0).max(1).optional(),
1007
- source: z2.enum(["configured", "inherited", "router"])
1033
+ modelId: z3.string().min(1),
1034
+ reasoningLevel: z3.enum(TURN_REASONING_LEVELS),
1035
+ confidence: z3.number().min(0).max(1).optional(),
1036
+ source: z3.enum(["configured", "inherited", "router"])
1008
1037
  }).strict();
1009
- var turnContextEventDataSchema = z2.object({
1010
- type: z2.literal("turn_context"),
1011
- turnId: z2.string().min(1),
1012
- pluginName: z2.string().min(1),
1013
- kind: z2.string().min(1).max(64),
1014
- version: z2.number().int().positive(),
1015
- content: z2.record(z2.string(), z2.unknown())
1038
+ var turnContextEventDataSchema = z3.object({
1039
+ type: z3.literal("turn_context"),
1040
+ turnId: z3.string().min(1),
1041
+ pluginName: z3.string().min(1),
1042
+ kind: z3.string().min(1).max(64),
1043
+ version: z3.number().int().positive(),
1044
+ content: z3.record(z3.string(), z3.unknown())
1016
1045
  }).strict();
1017
- var structuredConversationEventDataSchema = z2.object({
1018
- type: z2.literal("structured_event"),
1019
- namespace: z2.string().regex(/^[a-z][a-z0-9-]*$/),
1020
- name: z2.string().regex(/^[a-z][a-z0-9_]*$/),
1021
- version: z2.number().int().positive(),
1022
- turnId: z2.string().min(1).optional(),
1023
- content: z2.record(z2.string(), z2.unknown())
1046
+ var structuredConversationEventDataSchema = z3.object({
1047
+ type: z3.literal("structured_event"),
1048
+ namespace: z3.string().regex(/^[a-z][a-z0-9-]*$/),
1049
+ name: z3.string().regex(/^[a-z][a-z0-9_]*$/),
1050
+ version: z3.number().int().positive(),
1051
+ turnId: z3.string().min(1).optional(),
1052
+ content: z3.record(z3.string(), z3.unknown())
1024
1053
  }).strict();
1025
- var turnCompletedEventDataSchema = z2.object({
1026
- type: z2.literal("turn_completed"),
1027
- turnId: z2.string().min(1),
1028
- outcome: z2.enum(["success", "no_reply"])
1054
+ var turnCompletedEventDataSchema = z3.object({
1055
+ type: z3.literal("turn_completed"),
1056
+ turnId: z3.string().min(1),
1057
+ outcome: z3.enum(["success", "no_reply"])
1029
1058
  }).strict();
1030
- var turnFailedEventDataSchema = z2.object({
1031
- type: z2.literal("turn_failed"),
1032
- turnId: z2.string().min(1),
1059
+ var turnFailedEventDataSchema = z3.object({
1060
+ type: z3.literal("turn_failed"),
1061
+ turnId: z3.string().min(1),
1033
1062
  failureCode: conversationTurnFailureCodeSchema,
1034
- eventId: z2.string().regex(/^[a-f0-9]{32}$/i).optional()
1063
+ eventId: z3.string().regex(/^[a-f0-9]{32}$/i).optional()
1035
1064
  }).strict();
1036
- var subagentStartedEventDataSchema = z2.object({
1037
- type: z2.literal("subagent_started"),
1038
- subagentInvocationId: z2.string().min(1),
1039
- subagentKind: z2.string().min(1),
1040
- modelId: z2.string().min(1).optional(),
1041
- parentToolCallId: z2.string().min(1).optional(),
1042
- reasoningLevel: z2.string().min(1).optional(),
1043
- childConversationId: z2.string().min(1)
1065
+ var subagentStartedEventDataSchema = z3.object({
1066
+ type: z3.literal("subagent_started"),
1067
+ subagentInvocationId: z3.string().min(1),
1068
+ subagentKind: z3.string().min(1),
1069
+ modelId: z3.string().min(1).optional(),
1070
+ parentToolCallId: z3.string().min(1).optional(),
1071
+ reasoningLevel: z3.string().min(1).optional(),
1072
+ childConversationId: z3.string().min(1)
1044
1073
  }).strict();
1045
- var subagentEndedEventDataSchema = z2.object({
1046
- type: z2.literal("subagent_ended"),
1047
- subagentInvocationId: z2.string().min(1),
1048
- outcome: z2.union([
1049
- z2.literal("success"),
1050
- z2.literal("error"),
1051
- z2.literal("aborted")
1074
+ var subagentEndedEventDataSchema = z3.object({
1075
+ type: z3.literal("subagent_ended"),
1076
+ subagentInvocationId: z3.string().min(1),
1077
+ outcome: z3.union([
1078
+ z3.literal("success"),
1079
+ z3.literal("error"),
1080
+ z3.literal("aborted")
1052
1081
  ]),
1053
- errorCode: z2.string().min(1).optional()
1082
+ errorCode: z3.string().min(1).optional()
1054
1083
  }).strict();
1055
- var appendableConversationEventDataSchema = z2.union([
1084
+ var appendableConversationEventDataSchema = z3.union([
1056
1085
  messageEventDataSchema,
1057
1086
  messageUpdatedEventDataSchema,
1058
1087
  agentHistoryItemSchema,
@@ -1072,7 +1101,7 @@ var appendableConversationEventDataSchema = z2.union([
1072
1101
  subagentStartedEventDataSchema,
1073
1102
  subagentEndedEventDataSchema
1074
1103
  ]);
1075
- var conversationEventDataSchema = z2.union([
1104
+ var conversationEventDataSchema = z3.union([
1076
1105
  appendableConversationEventDataSchema,
1077
1106
  historyReplacementEventDataSchema
1078
1107
  ]);
@@ -1100,22 +1129,22 @@ var KNOWN_CONVERSATION_EVENT_TYPES = [
1100
1129
  "handoff",
1101
1130
  "compaction"
1102
1131
  ];
1103
- var knownConversationEventTypeSchema = z2.enum(KNOWN_CONVERSATION_EVENT_TYPES);
1104
- var unknownConversationEventDataSchema = z2.object({
1105
- type: z2.literal("unknown"),
1106
- originalType: z2.string().min(1),
1107
- payload: z2.unknown()
1132
+ var knownConversationEventTypeSchema = z3.enum(KNOWN_CONVERSATION_EVENT_TYPES);
1133
+ var unknownConversationEventDataSchema = z3.object({
1134
+ type: z3.literal("unknown"),
1135
+ originalType: z3.string().min(1),
1136
+ payload: z3.unknown()
1108
1137
  }).strict();
1109
- var conversationEventEnvelopeSchema = z2.object({
1110
- schemaVersion: z2.number().int().nonnegative(),
1111
- seq: z2.number().int().nonnegative(),
1112
- historyVersion: z2.number().int().nonnegative(),
1113
- idempotencyKey: z2.string().min(1).optional(),
1114
- createdAtMs: z2.number().finite()
1138
+ var conversationEventEnvelopeSchema = z3.object({
1139
+ schemaVersion: z3.number().int().nonnegative(),
1140
+ seq: z3.number().int().nonnegative(),
1141
+ historyVersion: z3.number().int().nonnegative(),
1142
+ idempotencyKey: z3.string().min(1).optional(),
1143
+ createdAtMs: z3.number().finite()
1115
1144
  }).strict();
1116
- var conversationEventSchema = z2.union([
1145
+ var conversationEventSchema = z3.union([
1117
1146
  conversationEventEnvelopeSchema.extend({
1118
- schemaVersion: z2.literal(1),
1147
+ schemaVersion: z3.literal(1),
1119
1148
  data: conversationEventDataSchema
1120
1149
  }),
1121
1150
  conversationEventEnvelopeSchema.extend({
@@ -1123,8 +1152,8 @@ var conversationEventSchema = z2.union([
1123
1152
  })
1124
1153
  ]);
1125
1154
  var storedConversationEventSchema = conversationEventEnvelopeSchema.extend({
1126
- type: z2.string().min(1),
1127
- payload: z2.unknown()
1155
+ type: z3.string().min(1),
1156
+ payload: z3.unknown()
1128
1157
  });
1129
1158
  function decodeStoredConversationEvent(value) {
1130
1159
  const stored = storedConversationEventSchema.parse(value);
@@ -1139,10 +1168,10 @@ function decodeStoredConversationEvent(value) {
1139
1168
  data: { type: "unknown", originalType: type, payload }
1140
1169
  });
1141
1170
  }
1142
- var newConversationEventSchema = z2.object({
1171
+ var newConversationEventSchema = z3.object({
1143
1172
  data: appendableConversationEventDataSchema,
1144
- idempotencyKey: z2.string().min(1).optional(),
1145
- createdAtMs: z2.number().finite()
1173
+ idempotencyKey: z3.string().min(1).optional(),
1174
+ createdAtMs: z3.number().finite()
1146
1175
  }).strict();
1147
1176
 
1148
1177
  // src/chat/conversations/sql/conversation-row.ts
@@ -1599,6 +1628,7 @@ export {
1599
1628
  requireSlackDestination,
1600
1629
  sameDestination,
1601
1630
  parseSessionSource,
1631
+ locationFromRow,
1602
1632
  instructionProvenanceFor,
1603
1633
  contextProvenance,
1604
1634
  sameActorIdentity,