@sentry/junior 0.90.0 → 0.92.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 (131) hide show
  1. package/dist/{agent-hooks-MXAF7RQL.js → agent-hooks-BYSSWCNW.js} +7 -7
  2. package/dist/api/people/list.d.ts +3 -3
  3. package/dist/api/people/list.js +15 -15
  4. package/dist/api/people/list.query.d.ts +2 -2
  5. package/dist/api/people/profile.d.ts +3 -3
  6. package/dist/api/people/profile.js +12 -12
  7. package/dist/api/people/profile.query.d.ts +2 -2
  8. package/dist/api/people/shared.d.ts +13 -13
  9. package/dist/api/people/types.d.ts +12 -12
  10. package/dist/api-reference.d.ts +1 -1
  11. package/dist/app.js +406 -267
  12. package/dist/{catalog-runtime-DXE6NXHT.js → catalog-runtime-NZHMSMYC.js} +2 -2
  13. package/dist/chat/actor.d.ts +75 -0
  14. package/dist/chat/agent/prompt.d.ts +4 -4
  15. package/dist/chat/agent/request.d.ts +21 -13
  16. package/dist/chat/agent/resume.d.ts +5 -4
  17. package/dist/chat/agent/tools.d.ts +2 -2
  18. package/dist/chat/capabilities/jr-rpc-command.d.ts +1 -1
  19. package/dist/chat/conversation-privacy.d.ts +11 -0
  20. package/dist/chat/conversations/sql/migrations.d.ts +1 -1
  21. package/dist/chat/conversations/sql/schema/conversations.d.ts +2 -19
  22. package/dist/chat/conversations/sql/schema.d.ts +2 -19
  23. package/dist/chat/conversations/sql/store.d.ts +3 -3
  24. package/dist/chat/conversations/store.d.ts +4 -4
  25. package/dist/chat/credentials/context.d.ts +4 -4
  26. package/dist/chat/current-instruction.d.ts +5 -3
  27. package/dist/chat/logging.d.ts +2 -2
  28. package/dist/chat/no-reply.d.ts +1 -1
  29. package/dist/chat/oauth-authorization-message.d.ts +6 -0
  30. package/dist/chat/oauth-flow.d.ts +1 -1
  31. package/dist/chat/pi/messages.d.ts +2 -2
  32. package/dist/chat/pi/transcript.d.ts +15 -0
  33. package/dist/chat/plugins/agent-hooks.d.ts +3 -3
  34. package/dist/chat/plugins/credential-hooks.d.ts +2 -8
  35. package/dist/chat/prompt.d.ts +3 -6
  36. package/dist/chat/runtime/reply-executor.d.ts +1 -1
  37. package/dist/chat/runtime/turn-input.d.ts +1 -1
  38. package/dist/chat/sandbox/egress/schemas.d.ts +2 -2
  39. package/dist/chat/sandbox/egress/session.d.ts +1 -1
  40. package/dist/chat/services/context-compaction.d.ts +1 -1
  41. package/dist/chat/services/conversation-memory.d.ts +1 -1
  42. package/dist/chat/services/mcp-auth-orchestration.d.ts +1 -1
  43. package/dist/chat/services/message-actor-identity.d.ts +4 -4
  44. package/dist/chat/services/pending-auth.d.ts +2 -2
  45. package/dist/chat/services/plugin-auth-orchestration.d.ts +1 -1
  46. package/dist/chat/services/provider-default-config.d.ts +1 -1
  47. package/dist/chat/services/subscribed-decision.d.ts +1 -1
  48. package/dist/chat/services/turn-result.d.ts +1 -1
  49. package/dist/chat/services/turn-session-record.d.ts +11 -8
  50. package/dist/chat/services/turn-thinking-level.d.ts +1 -1
  51. package/dist/chat/slack/assistant-thread/title.d.ts +1 -1
  52. package/dist/chat/slack/mrkdwn.d.ts +6 -0
  53. package/dist/chat/slack/tools/canvas/create.d.ts +41 -1
  54. package/dist/chat/slack/tools/canvas/edit.d.ts +60 -1
  55. package/dist/chat/slack/tools/canvas/read.d.ts +60 -1
  56. package/dist/chat/slack/tools/canvas/write.d.ts +41 -1
  57. package/dist/chat/slack/tools/channel-list-messages.d.ts +45 -1
  58. package/dist/chat/slack/tools/context.d.ts +3 -3
  59. package/dist/chat/slack/tools/list/add-items.d.ts +42 -1
  60. package/dist/chat/slack/tools/list/create.d.ts +40 -1
  61. package/dist/chat/slack/tools/list/get-items.d.ts +40 -1
  62. package/dist/chat/slack/tools/list/update-item.d.ts +46 -1
  63. package/dist/chat/slack/tools/message-add-reaction.d.ts +40 -1
  64. package/dist/chat/slack/tools/send-message.d.ts +45 -1
  65. package/dist/chat/slack/tools/thread-read.d.ts +44 -1
  66. package/dist/chat/slack/tools/user-lookup.d.ts +45 -1
  67. package/dist/chat/slack/user.d.ts +3 -3
  68. package/dist/chat/slack/vision-context.d.ts +2 -2
  69. package/dist/chat/sql/schema.d.ts +2 -19
  70. package/dist/chat/state/conversation-details.d.ts +4 -4
  71. package/dist/chat/state/conversation.d.ts +1 -1
  72. package/dist/chat/state/session-log.d.ts +140 -26
  73. package/dist/chat/state/turn-session.d.ts +18 -5
  74. package/dist/chat/task-execution/slack-work.d.ts +2 -2
  75. package/dist/chat/task-execution/state.d.ts +4 -4
  76. package/dist/chat/tool-support/zod-tool.d.ts +16 -4
  77. package/dist/chat/tools/advisor/tool.d.ts +41 -1
  78. package/dist/chat/tools/definition.d.ts +10 -0
  79. package/dist/chat/tools/execute-tool.d.ts +41 -1
  80. package/dist/chat/tools/resource-events.d.ts +124 -3
  81. package/dist/chat/tools/runtime/report-progress.d.ts +40 -1
  82. package/dist/chat/tools/sandbox/bash.d.ts +41 -1
  83. package/dist/chat/tools/sandbox/edit-file.d.ts +44 -1
  84. package/dist/chat/tools/sandbox/find-files.d.ts +42 -1
  85. package/dist/chat/tools/sandbox/grep.d.ts +46 -1
  86. package/dist/chat/tools/sandbox/list-dir.d.ts +41 -1
  87. package/dist/chat/tools/sandbox/read-file.d.ts +42 -1
  88. package/dist/chat/tools/sandbox/write-file.d.ts +41 -1
  89. package/dist/chat/tools/search-tools.d.ts +102 -1
  90. package/dist/chat/tools/skill/call-mcp-tool.d.ts +10 -1
  91. package/dist/chat/tools/skill/load-skill.d.ts +40 -1
  92. package/dist/chat/tools/skill/search-mcp-tools.d.ts +100 -1
  93. package/dist/chat/tools/system-time.d.ts +38 -1
  94. package/dist/chat/tools/types.d.ts +4 -4
  95. package/dist/chat/tools/web/fetch-tool.d.ts +41 -1
  96. package/dist/chat/tools/web/image-generate.d.ts +62 -1
  97. package/dist/chat/tools/web/search.d.ts +41 -1
  98. package/dist/{chunk-HXL2ZV74.js → chunk-3F54A3YM.js} +82 -11
  99. package/dist/{chunk-BKSZL4QO.js → chunk-7DVIELX3.js} +670 -401
  100. package/dist/{chunk-GCWD2VHP.js → chunk-7FS3K243.js} +284 -124
  101. package/dist/{chunk-AOISHLSF.js → chunk-ACJENBVF.js} +143 -20
  102. package/dist/{chunk-IRRMABQD.js → chunk-APIVR44P.js} +10 -10
  103. package/dist/{chunk-PHZHJTCK.js → chunk-BMQ5DXHV.js} +30 -52
  104. package/dist/{chunk-XP7F4LYB.js → chunk-BTH37NCU.js} +4 -4
  105. package/dist/{chunk-5GBUZI6M.js → chunk-H7KUZAMZ.js} +4 -4
  106. package/dist/{chunk-TYUXD3FN.js → chunk-MC4ZZE4Q.js} +1 -1
  107. package/dist/{chunk-QCKGI74V.js → chunk-N25HRI6B.js} +10 -10
  108. package/dist/{chunk-2S7M37HY.js → chunk-NIFONS4W.js} +86 -47
  109. package/dist/{chunk-ONFOWI2D.js → chunk-OJP53WIU.js} +16 -15
  110. package/dist/{chunk-NW7AXDA5.js → chunk-OZJXGX4U.js} +2 -2
  111. package/dist/{chunk-KC42JAAQ.js → chunk-PFXC67GJ.js} +3 -3
  112. package/dist/{chunk-ZUK7BL63.js → chunk-S6QKIGRM.js} +66 -54
  113. package/dist/{chunk-IX76WFJV.js → chunk-TF5VLGA7.js} +10 -10
  114. package/dist/{chunk-DACFZ5CI.js → chunk-VY7TVOIK.js} +16 -12
  115. package/dist/{chunk-AN2437E3.js → chunk-YTNPU7I2.js} +2 -2
  116. package/dist/{chunk-3MPOMK3K.js → chunk-YYBX2BD5.js} +61 -3
  117. package/dist/{chunk-RS6ANWVT.js → chunk-ZATRYQLR.js} +1 -1
  118. package/dist/cli/chat.js +20 -20
  119. package/dist/cli/check.js +3 -3
  120. package/dist/cli/plugins.js +9 -9
  121. package/dist/cli/snapshot-warmup.js +6 -6
  122. package/dist/cli/upgrade.js +9 -9
  123. package/dist/{db-CXI7PR5U.js → db-GCK43OO3.js} +4 -4
  124. package/dist/instrumentation.js +1 -1
  125. package/dist/reporting/conversations.d.ts +3 -3
  126. package/dist/reporting.d.ts +1 -1
  127. package/dist/reporting.js +48 -50
  128. package/dist/{runner-FKL3RAHA.js → runner-XWTFA26U.js} +20 -18
  129. package/dist/{validation-I7GD2YWS.js → validation-KYAWETI4.js} +3 -3
  130. package/package.json +6 -6
  131. package/dist/chat/requester.d.ts +0 -68
@@ -1,6 +1,32 @@
1
1
  import { z } from "zod";
2
+ import { type Actor } from "@sentry/junior-plugin-api";
2
3
  import { type PiMessage } from "@/chat/pi/messages";
3
- import { type StoredSlackRequester } from "@/chat/requester";
4
+ import { type StoredSlackActor } from "@/chat/actor";
5
+ declare const piMessageAuthoritySchema: z.ZodUnion<readonly [z.ZodLiteral<"instruction">, z.ZodLiteral<"context">]>;
6
+ declare const piMessageProvenanceSchema: z.ZodObject<{
7
+ authority: z.ZodUnion<readonly [z.ZodLiteral<"instruction">, z.ZodLiteral<"context">]>;
8
+ actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
9
+ platform: z.ZodLiteral<"slack">;
10
+ teamId: z.ZodString;
11
+ email: z.ZodOptional<z.ZodString>;
12
+ fullName: z.ZodOptional<z.ZodString>;
13
+ userId: z.ZodString;
14
+ userName: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$strict>, z.ZodObject<{
16
+ platform: z.ZodLiteral<"local">;
17
+ email: z.ZodOptional<z.ZodString>;
18
+ fullName: z.ZodOptional<z.ZodString>;
19
+ userId: z.ZodString;
20
+ userName: z.ZodOptional<z.ZodString>;
21
+ }, z.core.$strict>, z.ZodObject<{
22
+ platform: z.ZodLiteral<"system">;
23
+ name: z.ZodString;
24
+ }, z.core.$strict>], "platform">>;
25
+ }, z.core.$strict>;
26
+ /** Whether a user-role Pi message is a durable instruction or ambient context. */
27
+ export type PiMessageAuthority = z.output<typeof piMessageAuthoritySchema>;
28
+ /** Per-message record of the actor a Pi message came from and its authority weight. */
29
+ export type PiMessageProvenance = z.output<typeof piMessageProvenanceSchema>;
4
30
  declare const authorizationKindSchema: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
5
31
  declare const transcriptRefSchema: z.ZodObject<{
6
32
  type: z.ZodLiteral<"advisor_session">;
@@ -8,16 +34,36 @@ declare const transcriptRefSchema: z.ZodObject<{
8
34
  key: z.ZodString;
9
35
  }, z.core.$strip>;
10
36
  declare const sessionLogEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
11
- schemaVersion: z.ZodLiteral<1>;
37
+ schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
12
38
  type: z.ZodLiteral<"pi_message">;
13
39
  sessionId: z.ZodDefault<z.ZodString>;
14
40
  message: z.ZodPipe<z.ZodObject<{
15
41
  role: z.ZodString;
16
- }, z.core.$loose>, z.ZodTransform<import("@earendil-works/pi-ai").UserMessage | import("@earendil-works/pi-ai").AssistantMessage | import("@earendil-works/pi-ai").ToolResultMessage<any> | import("@earendil-works/pi-agent-core").CustomMessage<unknown> | import("@earendil-works/pi-agent-core").BashExecutionMessage | import("@earendil-works/pi-agent-core").BranchSummaryMessage | import("@earendil-works/pi-agent-core").CompactionSummaryMessage, {
42
+ }, z.core.$loose>, z.ZodTransform<import("@earendil-works/pi-ai").AssistantMessage | import("@earendil-works/pi-ai").UserMessage | import("@earendil-works/pi-ai").ToolResultMessage<any> | import("@earendil-works/pi-agent-core").CustomMessage<unknown> | import("@earendil-works/pi-agent-core").BashExecutionMessage | import("@earendil-works/pi-agent-core").BranchSummaryMessage | import("@earendil-works/pi-agent-core").CompactionSummaryMessage, {
17
43
  [x: string]: unknown;
18
44
  role: string;
19
45
  }>>;
20
- requester: z.ZodOptional<z.ZodObject<{
46
+ provenance: z.ZodOptional<z.ZodObject<{
47
+ authority: z.ZodUnion<readonly [z.ZodLiteral<"instruction">, z.ZodLiteral<"context">]>;
48
+ actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
49
+ platform: z.ZodLiteral<"slack">;
50
+ teamId: z.ZodString;
51
+ email: z.ZodOptional<z.ZodString>;
52
+ fullName: z.ZodOptional<z.ZodString>;
53
+ userId: z.ZodString;
54
+ userName: z.ZodOptional<z.ZodString>;
55
+ }, z.core.$strict>, z.ZodObject<{
56
+ platform: z.ZodLiteral<"local">;
57
+ email: z.ZodOptional<z.ZodString>;
58
+ fullName: z.ZodOptional<z.ZodString>;
59
+ userId: z.ZodString;
60
+ userName: z.ZodOptional<z.ZodString>;
61
+ }, z.core.$strict>, z.ZodObject<{
62
+ platform: z.ZodLiteral<"system">;
63
+ name: z.ZodString;
64
+ }, z.core.$strict>], "platform">>;
65
+ }, z.core.$strict>>;
66
+ actor: z.ZodOptional<z.ZodObject<{
21
67
  email: z.ZodOptional<z.ZodString>;
22
68
  fullName: z.ZodOptional<z.ZodString>;
23
69
  platform: z.ZodOptional<z.ZodLiteral<"slack">>;
@@ -26,16 +72,36 @@ declare const sessionLogEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
26
72
  teamId: z.ZodOptional<z.ZodString>;
27
73
  }, z.core.$strict>>;
28
74
  }, z.core.$strip>, z.ZodObject<{
29
- schemaVersion: z.ZodLiteral<1>;
75
+ schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
30
76
  type: z.ZodLiteral<"projection_reset">;
31
77
  sessionId: z.ZodDefault<z.ZodString>;
32
78
  messages: z.ZodArray<z.ZodPipe<z.ZodObject<{
33
79
  role: z.ZodString;
34
- }, z.core.$loose>, z.ZodTransform<import("@earendil-works/pi-ai").UserMessage | import("@earendil-works/pi-ai").AssistantMessage | import("@earendil-works/pi-ai").ToolResultMessage<any> | import("@earendil-works/pi-agent-core").CustomMessage<unknown> | import("@earendil-works/pi-agent-core").BashExecutionMessage | import("@earendil-works/pi-agent-core").BranchSummaryMessage | import("@earendil-works/pi-agent-core").CompactionSummaryMessage, {
80
+ }, z.core.$loose>, z.ZodTransform<import("@earendil-works/pi-ai").AssistantMessage | import("@earendil-works/pi-ai").UserMessage | import("@earendil-works/pi-ai").ToolResultMessage<any> | import("@earendil-works/pi-agent-core").CustomMessage<unknown> | import("@earendil-works/pi-agent-core").BashExecutionMessage | import("@earendil-works/pi-agent-core").BranchSummaryMessage | import("@earendil-works/pi-agent-core").CompactionSummaryMessage, {
35
81
  [x: string]: unknown;
36
82
  role: string;
37
83
  }>>>;
38
- requester: z.ZodOptional<z.ZodObject<{
84
+ provenance: z.ZodOptional<z.ZodArray<z.ZodObject<{
85
+ authority: z.ZodUnion<readonly [z.ZodLiteral<"instruction">, z.ZodLiteral<"context">]>;
86
+ actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
87
+ platform: z.ZodLiteral<"slack">;
88
+ teamId: z.ZodString;
89
+ email: z.ZodOptional<z.ZodString>;
90
+ fullName: z.ZodOptional<z.ZodString>;
91
+ userId: z.ZodString;
92
+ userName: z.ZodOptional<z.ZodString>;
93
+ }, z.core.$strict>, z.ZodObject<{
94
+ platform: z.ZodLiteral<"local">;
95
+ email: z.ZodOptional<z.ZodString>;
96
+ fullName: z.ZodOptional<z.ZodString>;
97
+ userId: z.ZodString;
98
+ userName: z.ZodOptional<z.ZodString>;
99
+ }, z.core.$strict>, z.ZodObject<{
100
+ platform: z.ZodLiteral<"system">;
101
+ name: z.ZodString;
102
+ }, z.core.$strict>], "platform">>;
103
+ }, z.core.$strict>>>;
104
+ actor: z.ZodOptional<z.ZodObject<{
39
105
  email: z.ZodOptional<z.ZodString>;
40
106
  fullName: z.ZodOptional<z.ZodString>;
41
107
  platform: z.ZodOptional<z.ZodLiteral<"slack">>;
@@ -44,10 +110,10 @@ declare const sessionLogEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
44
110
  teamId: z.ZodOptional<z.ZodString>;
45
111
  }, z.core.$strict>>;
46
112
  }, z.core.$strip>, z.ZodObject<{
47
- schemaVersion: z.ZodLiteral<1>;
48
- type: z.ZodLiteral<"requester_recorded">;
113
+ schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
114
+ type: z.ZodLiteral<"actor_recorded">;
49
115
  sessionId: z.ZodDefault<z.ZodString>;
50
- requester: z.ZodObject<{
116
+ actor: z.ZodObject<{
51
117
  email: z.ZodOptional<z.ZodString>;
52
118
  fullName: z.ZodOptional<z.ZodString>;
53
119
  platform: z.ZodOptional<z.ZodLiteral<"slack">>;
@@ -56,31 +122,31 @@ declare const sessionLogEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
56
122
  teamId: z.ZodOptional<z.ZodString>;
57
123
  }, z.core.$strict>;
58
124
  }, z.core.$strip>, z.ZodObject<{
59
- schemaVersion: z.ZodLiteral<1>;
125
+ schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
60
126
  type: z.ZodLiteral<"mcp_provider_connected">;
61
127
  sessionId: z.ZodDefault<z.ZodString>;
62
128
  provider: z.ZodString;
63
129
  }, z.core.$strip>, z.ZodObject<{
64
- schemaVersion: z.ZodLiteral<1>;
130
+ schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
65
131
  type: z.ZodLiteral<"authorization_requested">;
66
132
  sessionId: z.ZodDefault<z.ZodString>;
67
133
  createdAtMs: z.ZodNumber;
68
134
  kind: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
69
135
  provider: z.ZodString;
70
- requesterId: z.ZodString;
136
+ actorId: z.ZodString;
71
137
  authorizationId: z.ZodString;
72
138
  delivery: z.ZodUnion<readonly [z.ZodLiteral<"private_link_sent">, z.ZodLiteral<"private_link_reused">]>;
73
139
  }, z.core.$strip>, z.ZodObject<{
74
- schemaVersion: z.ZodLiteral<1>;
140
+ schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
75
141
  type: z.ZodLiteral<"authorization_completed">;
76
142
  sessionId: z.ZodDefault<z.ZodString>;
77
143
  createdAtMs: z.ZodNumber;
78
144
  kind: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
79
145
  provider: z.ZodString;
80
- requesterId: z.ZodString;
146
+ actorId: z.ZodString;
81
147
  authorizationId: z.ZodString;
82
148
  }, z.core.$strip>, z.ZodObject<{
83
- schemaVersion: z.ZodLiteral<1>;
149
+ schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
84
150
  type: z.ZodLiteral<"tool_execution_started">;
85
151
  sessionId: z.ZodDefault<z.ZodString>;
86
152
  createdAtMs: z.ZodNumber;
@@ -88,7 +154,7 @@ declare const sessionLogEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
88
154
  toolName: z.ZodString;
89
155
  args: z.ZodOptional<z.ZodUnknown>;
90
156
  }, z.core.$strip>, z.ZodObject<{
91
- schemaVersion: z.ZodLiteral<1>;
157
+ schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
92
158
  type: z.ZodLiteral<"subagent_started">;
93
159
  sessionId: z.ZodDefault<z.ZodString>;
94
160
  subagentInvocationId: z.ZodString;
@@ -104,7 +170,7 @@ declare const sessionLogEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
104
170
  historyMode: z.ZodLiteral<"shared">;
105
171
  createdAtMs: z.ZodNumber;
106
172
  }, z.core.$strip>, z.ZodObject<{
107
- schemaVersion: z.ZodLiteral<1>;
173
+ schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
108
174
  type: z.ZodLiteral<"subagent_ended">;
109
175
  sessionId: z.ZodDefault<z.ZodString>;
110
176
  subagentInvocationId: z.ZodString;
@@ -114,7 +180,7 @@ declare const sessionLogEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
114
180
  transcriptStartMessageIndex: z.ZodOptional<z.ZodNumber>;
115
181
  createdAtMs: z.ZodNumber;
116
182
  }, z.core.$strip>], "type">;
117
- /** Requester identity stored with turn-start messages for durable continuation. */
183
+ /** Actor identity stored with turn-start messages for durable continuation. */
118
184
  export type SessionLogEntry = z.infer<typeof sessionLogEntrySchema>;
119
185
  export type AuthorizationKind = z.infer<typeof authorizationKindSchema>;
120
186
  export type TranscriptRef = z.infer<typeof transcriptRefSchema>;
@@ -137,10 +203,21 @@ export interface SessionLogStore {
137
203
  append(args: AppendArgs): Promise<void>;
138
204
  read(scope: Scope): Promise<SessionLogEntry[]>;
139
205
  }
206
+ /** Aligned Pi-message projection: `provenance[i]` describes `messages[i]`. */
140
207
  export interface SessionProjection {
141
208
  messages: PiMessage[];
142
- requester?: StoredSlackRequester;
209
+ provenance: PiMessageProvenance[];
143
210
  }
211
+ /**
212
+ * All distinct actors annotated on instruction-authority messages, in
213
+ * first-seen order — the run's actors. This is attribution, never
214
+ * authority: it exists so provenance consumers know which actors
215
+ * contributed instructions to a run. It must never feed credential
216
+ * issuance, credential-subject selection, or scope ownership.
217
+ * Unattributable instructions (no resolvable actor) never join;
218
+ * distinctness is by identity ids only, never display fields.
219
+ */
220
+ export declare function instructionActors(provenance: PiMessageProvenance[]): Actor[];
144
221
  /** Load chronological host-only runtime activity entries for reporting. */
145
222
  export declare function loadActivityEntries(args: Scope & {
146
223
  store?: SessionLogStore;
@@ -152,19 +229,38 @@ export declare function loadMessages(args: Scope & {
152
229
  messageCount: number;
153
230
  sessionId?: string;
154
231
  }): Promise<PiMessage[] | undefined>;
232
+ /** Load the committed Pi-message projection with aligned per-message provenance. */
233
+ export declare function loadMessagesWithProvenance(args: Scope & {
234
+ store?: SessionLogStore;
235
+ messageCount: number;
236
+ sessionId?: string;
237
+ }): Promise<SessionProjection | undefined>;
155
238
  /** Load the full current Pi-message projection for a conversation. */
156
239
  export declare function loadProjection(args: Scope & {
157
240
  store?: SessionLogStore;
158
241
  sessionId?: string;
159
242
  }): Promise<PiMessage[]>;
160
243
  /**
161
- * Load the Pi-message projection and derived requester identity in one read.
162
- * Used at continuation boundaries to avoid a second log scan.
244
+ * Load the Pi-message projection with aligned per-message provenance in one
245
+ * read. Used at continuation boundaries to avoid a second log scan.
163
246
  */
164
- export declare function loadProjectionWithRequester(args: Scope & {
247
+ export declare function loadProjectionWithProvenance(args: Scope & {
165
248
  store?: SessionLogStore;
166
249
  sessionId?: string;
167
250
  }): Promise<SessionProjection>;
251
+ /**
252
+ * Load the projection with the latest instruction actor as a stored Slack
253
+ * actor. Retained for callers that still key on a single latest actor; it
254
+ * derives the actor from per-message provenance rather than a latest-wins
255
+ * field.
256
+ */
257
+ export declare function loadProjectionWithActor(args: Scope & {
258
+ store?: SessionLogStore;
259
+ sessionId?: string;
260
+ }): Promise<{
261
+ messages: PiMessage[];
262
+ actor?: StoredSlackActor;
263
+ }>;
168
264
  /** Load MCP providers that were durably connected in this conversation. */
169
265
  export declare function loadConnectedMcpProviders(args: Scope & {
170
266
  store?: SessionLogStore;
@@ -180,7 +276,7 @@ export declare function recordAuthorizationRequested(args: Scope & {
180
276
  store?: SessionLogStore;
181
277
  kind: AuthorizationKind;
182
278
  provider: string;
183
- requesterId: string;
279
+ actorId: string;
184
280
  authorizationId: string;
185
281
  delivery: "private_link_sent" | "private_link_reused";
186
282
  ttlMs: number;
@@ -190,7 +286,7 @@ export declare function recordAuthorizationCompleted(args: Scope & {
190
286
  store?: SessionLogStore;
191
287
  kind: AuthorizationKind;
192
288
  provider: string;
193
- requesterId: string;
289
+ actorId: string;
194
290
  authorizationId: string;
195
291
  ttlMs: number;
196
292
  }): Promise<void>;
@@ -241,8 +337,26 @@ export declare function commitMessages(args: Scope & {
241
337
  store?: SessionLogStore;
242
338
  messages: PiMessage[];
243
339
  ttlMs: number;
244
- requester?: StoredSlackRequester;
340
+ /** Explicit per-message provenance aligned one-to-one with `messages`. */
341
+ provenance?: PiMessageProvenance[];
342
+ /** Explicit provenance for the trailing newly committed messages. */
343
+ trailingMessageProvenance?: PiMessageProvenance[];
344
+ /** Default applied to the last new user message when no explicit array. */
345
+ newMessageProvenance?: PiMessageProvenance;
245
346
  }): Promise<{
246
347
  sessionId: string;
348
+ provenance: PiMessageProvenance[];
247
349
  }>;
350
+ /** Build an instruction-provenance record for the given actor. */
351
+ export declare function instructionProvenanceFor(actor: Actor | undefined): PiMessageProvenance;
352
+ /** Unattributed ambient-context provenance for non-instruction Pi messages. */
353
+ export declare const contextProvenance: PiMessageProvenance;
354
+ /**
355
+ * Parse durably-stored message provenance, failing closed on misalignment.
356
+ *
357
+ * A missing field is a legacy record: it materializes as unauthored context of
358
+ * the expected length. A present-but-malformed or wrong-length value returns
359
+ * undefined so callers reject the record rather than zip a mismatched array.
360
+ */
361
+ export declare function parseStoredMessageProvenance(value: unknown, expectedLength: number): PiMessageProvenance[] | undefined;
248
362
  export {};
@@ -1,6 +1,7 @@
1
1
  import { type Destination, type Source } from "@sentry/junior-plugin-api";
2
2
  import type { PiMessage } from "@/chat/pi/messages";
3
- import { type Requester } from "@/chat/requester";
3
+ import { type Actor } from "@/chat/actor";
4
+ import { type PiMessageProvenance } from "./session-log";
4
5
  import type { AgentTurnUsage } from "@/chat/usage";
5
6
  import type { ConversationPrivacy } from "@/chat/conversation-privacy";
6
7
  import type { ConversationStore } from "@/chat/conversations/store";
@@ -19,7 +20,17 @@ export interface AgentTurnSessionRecord {
19
20
  lastProgressAtMs: number;
20
21
  loadedSkillNames?: string[];
21
22
  piMessages: PiMessage[];
22
- requester?: Requester;
23
+ /** Per-message provenance aligned one-to-one with `piMessages`. */
24
+ piMessageProvenance: PiMessageProvenance[];
25
+ /**
26
+ * All distinct actors annotated on this run's committed instruction-authority
27
+ * messages, in first-seen order. Derived from `piMessageProvenance` at
28
+ * materialization — never persisted separately, so it cannot drift from
29
+ * provenance. Attribution only; never an authority source.
30
+ */
31
+ actors: Actor[];
32
+ /** The single actor this run executes as (credential binding, auth flows). */
33
+ actor?: Actor;
23
34
  resumeReason?: AgentTurnResumeReason;
24
35
  resumedFromSliceId?: number;
25
36
  sessionId: string;
@@ -31,7 +42,7 @@ export interface AgentTurnSessionRecord {
31
42
  turnStartMessageIndex?: number;
32
43
  updatedAtMs: number;
33
44
  }
34
- export type AgentTurnSessionSummary = Omit<AgentTurnSessionRecord, "errorMessage" | "piMessages" | "turnStartMessageIndex">;
45
+ export type AgentTurnSessionSummary = Omit<AgentTurnSessionRecord, "errorMessage" | "actors" | "piMessages" | "piMessageProvenance" | "turnStartMessageIndex">;
35
46
  /** Read a materialized turn session record for resume and history loading. */
36
47
  export declare function getAgentTurnSessionRecord(conversationId: string, sessionId: string): Promise<AgentTurnSessionRecord | undefined>;
37
48
  /** Commit stable Pi session state and advance the turn session record. */
@@ -52,7 +63,9 @@ export declare function upsertAgentTurnSessionRecord(args: {
52
63
  state: AgentTurnSessionStatus;
53
64
  surface?: AgentTurnSurface;
54
65
  piMessages: PiMessage[];
55
- requester?: Requester;
66
+ /** Provenance for trailing newly committed messages, such as steering. */
67
+ trailingMessageProvenance?: PiMessageProvenance[];
68
+ actor?: Actor;
56
69
  resumeReason?: AgentTurnResumeReason;
57
70
  errorMessage?: string;
58
71
  resumedFromSliceId?: number;
@@ -77,7 +90,7 @@ export declare function recordAgentTurnSessionSummary(args: {
77
90
  lastProgressAtMs?: number;
78
91
  loadedSkillNames?: string[];
79
92
  conversationStore?: ConversationStore;
80
- requester?: Requester;
93
+ actor?: Actor;
81
94
  resumeReason?: AgentTurnResumeReason;
82
95
  sessionId: string;
83
96
  sliceId: number;
@@ -5,7 +5,7 @@ import type { ConversationStore } from "@/chat/conversations/store";
5
5
  import type { InboundMessage } from "@/chat/task-execution/store";
6
6
  import type { ConversationWorkerContext, ConversationWorkerResult } from "@/chat/task-execution/worker";
7
7
  import { type SlackInstallationContext } from "@/chat/slack/adapter-context";
8
- import { type SlackRequesterProfile } from "@/chat/requester";
8
+ import { type SlackActorProfile } from "@/chat/actor";
9
9
  export type SlackConversationRoute = "mention" | "subscribed";
10
10
  export interface SlackConversationMessageMetadata {
11
11
  [key: string]: unknown;
@@ -44,7 +44,7 @@ interface SlackResourceEventInboundInput {
44
44
  }
45
45
  export interface CreateSlackConversationWorkerOptions {
46
46
  getSlackAdapter: () => SlackAdapter;
47
- lookupSlackUser?: (teamId: string, userId: string) => Promise<SlackRequesterProfile | null | undefined>;
47
+ lookupSlackUser?: (teamId: string, userId: string) => Promise<SlackActorProfile | null | undefined>;
48
48
  resumeAwaitingContinuation: (conversationId: string) => Promise<boolean>;
49
49
  conversationStore?: ConversationStore;
50
50
  runtime: SlackInboxTurnRuntime;
@@ -1,6 +1,6 @@
1
1
  import type { StateAdapter } from "chat";
2
2
  import type { Destination } from "@sentry/junior-plugin-api";
3
- import { type StoredSlackRequester } from "@/chat/requester";
3
+ import { type StoredSlackActor } from "@/chat/actor";
4
4
  declare class InvalidConversationRecordError extends Error {
5
5
  constructor(conversationId: string);
6
6
  }
@@ -55,7 +55,7 @@ export interface Conversation {
55
55
  destination?: Destination;
56
56
  execution: ConversationExecution;
57
57
  lastActivityAtMs: number;
58
- requester?: StoredSlackRequester;
58
+ actor?: StoredSlackActor;
59
59
  schemaVersion: 1;
60
60
  source?: Source;
61
61
  title?: string;
@@ -131,7 +131,7 @@ export declare function recordConversationActivity(args: {
131
131
  conversationId: string;
132
132
  destination?: Destination;
133
133
  nowMs?: number;
134
- requester?: StoredSlackRequester;
134
+ actor?: StoredSlackActor;
135
135
  source?: Source;
136
136
  state?: StateAdapter;
137
137
  title?: string;
@@ -150,7 +150,7 @@ export declare function recordConversationExecution(args: {
150
150
  updatedAtMs?: number;
151
151
  };
152
152
  lastActivityAtMs: number;
153
- requester?: StoredSlackRequester;
153
+ actor?: StoredSlackActor;
154
154
  source?: Source;
155
155
  state?: StateAdapter;
156
156
  title?: string;
@@ -1,13 +1,13 @@
1
1
  import { z, type ZodType, type ZodTypeAny } from "zod";
2
2
  import { type JuniorToolResult } from "@/chat/tool-support/structured-result";
3
3
  import type { ImageContent, TextContent } from "@earendil-works/pi-ai";
4
- import type { AnyToolDefinition, ToolExecuteOptions } from "@/chat/tools/definition";
4
+ import type { AnyToolDefinition, JsonSchemaObject, ToolExecuteOptions } from "@/chat/tools/definition";
5
5
  type ZodToolDefinitionBase<TInputSchema extends ZodTypeAny> = Pick<AnyToolDefinition, "identity" | "description" | "exposure" | "annotations" | "promptSnippet" | "promptGuidelines" | "executionMode"> & {
6
6
  inputSchema: TInputSchema;
7
7
  prepareArguments?: (args: unknown) => z.input<TInputSchema>;
8
8
  };
9
9
  type StructuredToolExecuteResult<TOutputSchema extends ZodType<JuniorToolResult>> = z.input<TOutputSchema>;
10
- interface ContentOnlyToolResult {
10
+ export interface ContentOnlyToolResult {
11
11
  content: Array<TextContent | ImageContent>;
12
12
  details?: never;
13
13
  }
@@ -19,9 +19,21 @@ type ContentZodToolDefinition<TInputSchema extends ZodTypeAny> = ZodToolDefiniti
19
19
  outputSchema?: undefined;
20
20
  execute?: (input: z.output<TInputSchema>, options: ToolExecuteOptions) => Promise<ContentOnlyToolResult> | ContentOnlyToolResult;
21
21
  };
22
+ type StructuredZodTool<TInputSchema extends ZodTypeAny, TOutputSchema extends ZodType<JuniorToolResult>> = Omit<AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
23
+ inputSchema: JsonSchemaObject;
24
+ outputSchema: JsonSchemaObject;
25
+ prepareArguments(args: unknown): z.output<TInputSchema>;
26
+ execute?: (input: unknown, options: ToolExecuteOptions) => Promise<z.output<TOutputSchema>> | z.output<TOutputSchema>;
27
+ };
28
+ type ContentZodTool<TInputSchema extends ZodTypeAny> = Omit<AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
29
+ inputSchema: JsonSchemaObject;
30
+ outputSchema?: undefined;
31
+ prepareArguments(args: unknown): z.output<TInputSchema>;
32
+ execute?: (input: unknown, options: ToolExecuteOptions) => Promise<ContentOnlyToolResult> | ContentOnlyToolResult;
33
+ };
22
34
  /**
23
35
  * Define a Junior-owned tool with Zod input parsing and JSON Schema parameters.
24
36
  */
25
- export declare function zodTool<TInputSchema extends ZodTypeAny, TOutputSchema extends ZodType<JuniorToolResult>>(definition: StructuredZodToolDefinition<TInputSchema, TOutputSchema>): AnyToolDefinition;
26
- export declare function zodTool<TInputSchema extends ZodTypeAny>(definition: ContentZodToolDefinition<TInputSchema>): AnyToolDefinition;
37
+ export declare function zodTool<TInputSchema extends ZodTypeAny, TOutputSchema extends ZodType<JuniorToolResult>>(definition: StructuredZodToolDefinition<TInputSchema, TOutputSchema>): StructuredZodTool<TInputSchema, TOutputSchema>;
38
+ export declare function zodTool<TInputSchema extends ZodTypeAny>(definition: ContentZodToolDefinition<TInputSchema>): ContentZodTool<TInputSchema>;
27
39
  export {};
@@ -24,4 +24,44 @@ export interface AdvisorToolRuntimeContext {
24
24
  /** Build the advisor's read-only tool definition subset. */
25
25
  export declare function createAdvisorToolDefinitions(definitions: Record<string, AnyToolDefinition>): Record<string, AnyToolDefinition>;
26
26
  /** Create the advisor tool backed by conversation-scoped message history. */
27
- export declare function createAdvisorTool(context: AdvisorToolRuntimeContext): AnyToolDefinition;
27
+ export declare function createAdvisorTool(context: AdvisorToolRuntimeContext): Omit<AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
28
+ inputSchema: import("@/chat/tools/definition").JsonSchemaObject;
29
+ outputSchema: import("@/chat/tools/definition").JsonSchemaObject;
30
+ prepareArguments(args: unknown): {
31
+ question: string;
32
+ context: string;
33
+ };
34
+ execute?: ((input: unknown, options: import("@/chat/tools/definition").ToolExecuteOptions) => {
35
+ [x: string]: unknown;
36
+ ok: boolean;
37
+ status: "error" | "success";
38
+ target?: string | undefined;
39
+ data?: unknown;
40
+ truncated?: boolean | undefined;
41
+ continuation?: {
42
+ arguments: Record<string, unknown>;
43
+ reason?: string | undefined;
44
+ } | undefined;
45
+ error?: string | {
46
+ kind: string;
47
+ message: string;
48
+ retryable?: boolean | undefined;
49
+ } | undefined;
50
+ } | Promise<{
51
+ [x: string]: unknown;
52
+ ok: boolean;
53
+ status: "error" | "success";
54
+ target?: string | undefined;
55
+ data?: unknown;
56
+ truncated?: boolean | undefined;
57
+ continuation?: {
58
+ arguments: Record<string, unknown>;
59
+ reason?: string | undefined;
60
+ } | undefined;
61
+ error?: string | {
62
+ kind: string;
63
+ message: string;
64
+ retryable?: boolean | undefined;
65
+ } | undefined;
66
+ }>) | undefined;
67
+ };
@@ -23,6 +23,11 @@ interface BaseToolDefinition<TInput, TInputSchema extends ToolInputSchema> {
23
23
  name: string;
24
24
  plugin: string;
25
25
  };
26
+ /** Stable model-facing catalog grouping for deferred tool discovery. */
27
+ source?: {
28
+ description: string;
29
+ id: string;
30
+ };
26
31
  description: string;
27
32
  exposure?: ToolExposure;
28
33
  inputSchema: TInputSchema;
@@ -56,6 +61,11 @@ export interface AnyToolDefinition {
56
61
  name: string;
57
62
  plugin: string;
58
63
  };
64
+ /** Stable model-facing catalog grouping for deferred tool discovery. */
65
+ source?: {
66
+ description: string;
67
+ id: string;
68
+ };
59
69
  description: string;
60
70
  exposure?: ToolExposure;
61
71
  inputSchema: ToolInputSchema;
@@ -1,3 +1,43 @@
1
1
  export declare const EXECUTE_TOOL_NAME = "executeTool";
2
2
  /** Create the model-visible dispatcher schema for catalog tools. */
3
- export declare function createExecuteToolTool(): import("./definition").AnyToolDefinition;
3
+ export declare function createExecuteToolTool(): Omit<import("./definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
4
+ inputSchema: import("./definition").JsonSchemaObject;
5
+ outputSchema: import("./definition").JsonSchemaObject;
6
+ prepareArguments(args: unknown): {
7
+ tool_name: string;
8
+ arguments?: Record<string, unknown> | undefined;
9
+ };
10
+ execute?: ((input: unknown, options: import("./definition").ToolExecuteOptions) => {
11
+ [x: string]: unknown;
12
+ ok: boolean;
13
+ status: "error" | "success";
14
+ target?: string | undefined;
15
+ data?: unknown;
16
+ truncated?: boolean | undefined;
17
+ continuation?: {
18
+ arguments: Record<string, unknown>;
19
+ reason?: string | undefined;
20
+ } | undefined;
21
+ error?: string | {
22
+ kind: string;
23
+ message: string;
24
+ retryable?: boolean | undefined;
25
+ } | undefined;
26
+ } | Promise<{
27
+ [x: string]: unknown;
28
+ ok: boolean;
29
+ status: "error" | "success";
30
+ target?: string | undefined;
31
+ data?: unknown;
32
+ truncated?: boolean | undefined;
33
+ continuation?: {
34
+ arguments: Record<string, unknown>;
35
+ reason?: string | undefined;
36
+ } | undefined;
37
+ error?: string | {
38
+ kind: string;
39
+ message: string;
40
+ retryable?: boolean | undefined;
41
+ } | undefined;
42
+ }>) | undefined;
43
+ };