@sentry/junior 0.106.0 → 0.107.1

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 (132) hide show
  1. package/dist/{agent-hooks-KR5BCWOK.js → agent-hooks-ICPIJAFY.js} +9 -7
  2. package/dist/api/conversations/detail.d.ts +1 -1
  3. package/dist/api/conversations/events.d.ts +14 -0
  4. package/dist/api/conversations/schema.d.ts +196 -463
  5. package/dist/api/schema.d.ts +2 -7
  6. package/dist/api/schema.js +10 -8
  7. package/dist/api.js +377 -810
  8. package/dist/app.js +3586 -3614
  9. package/dist/{catalog-runtime-5CVM2DOF.js → catalog-runtime-FOFNPR3P.js} +3 -2
  10. package/dist/chat/agent/prompt.d.ts +1 -1
  11. package/dist/chat/agent/request.d.ts +28 -29
  12. package/dist/chat/agent/resume.d.ts +7 -7
  13. package/dist/chat/agent/session.d.ts +5 -6
  14. package/dist/chat/agent/tools.d.ts +3 -3
  15. package/dist/chat/agent-dispatch/runner.d.ts +2 -0
  16. package/dist/chat/config.d.ts +2 -2
  17. package/dist/chat/conversations/history.d.ts +582 -167
  18. package/dist/chat/conversations/message-projection.d.ts +6 -0
  19. package/dist/chat/conversations/message-summaries.d.ts +9 -0
  20. package/dist/chat/conversations/messages.d.ts +13 -27
  21. package/dist/chat/conversations/projection.d.ts +30 -53
  22. package/dist/chat/conversations/provenance.d.ts +42 -0
  23. package/dist/chat/conversations/search.d.ts +2 -2
  24. package/dist/chat/conversations/sql/conversation-row.d.ts +1 -1
  25. package/dist/chat/conversations/sql/event-lock.d.ts +3 -0
  26. package/dist/chat/conversations/sql/history.d.ts +3 -3
  27. package/dist/chat/conversations/sql/privacy.d.ts +27 -0
  28. package/dist/chat/conversations/sql/purge.d.ts +2 -10
  29. package/dist/chat/conversations/sql/store.d.ts +0 -5
  30. package/dist/chat/conversations/store.d.ts +8 -13
  31. package/dist/chat/conversations/turn-lifecycle.d.ts +41 -0
  32. package/dist/chat/db.d.ts +4 -10
  33. package/dist/chat/model-profile.d.ts +10 -0
  34. package/dist/chat/oauth-flow.d.ts +0 -5
  35. package/dist/chat/pi/conversation-events.d.ts +33 -0
  36. package/dist/chat/pi/sql-model-usage.d.ts +10 -0
  37. package/dist/chat/plugins/agent-hooks.d.ts +4 -2
  38. package/dist/chat/resource-events/ingest.d.ts +0 -13
  39. package/dist/chat/runtime/delivered-turn-state.d.ts +1 -1
  40. package/dist/chat/runtime/generated-artifacts.d.ts +1 -1
  41. package/dist/chat/runtime/reply-executor.d.ts +2 -0
  42. package/dist/chat/runtime/slack-resume.d.ts +23 -28
  43. package/dist/chat/runtime/slack-runtime.d.ts +2 -0
  44. package/dist/chat/runtime/turn.d.ts +14 -1
  45. package/dist/chat/services/context-compaction-marker.d.ts +0 -1
  46. package/dist/chat/services/context-compaction.d.ts +1 -0
  47. package/dist/chat/services/conversation-memory.d.ts +9 -0
  48. package/dist/chat/services/plugin-auth-orchestration.d.ts +1 -4
  49. package/dist/chat/services/subscribed-decision.d.ts +1 -1
  50. package/dist/chat/services/turn-failure-response.d.ts +10 -3
  51. package/dist/chat/services/turn-result.d.ts +7 -12
  52. package/dist/chat/services/{turn-reasoning-level.d.ts → turn-router.d.ts} +12 -8
  53. package/dist/chat/services/turn-session-record.d.ts +15 -16
  54. package/dist/chat/slack/adapter.d.ts +2 -2
  55. package/dist/chat/slack/errors.d.ts +2 -0
  56. package/dist/chat/slack/outbound.d.ts +0 -1
  57. package/dist/chat/slack/reply.d.ts +2 -8
  58. package/dist/chat/slack/tools/channel-capabilities.d.ts +2 -2
  59. package/dist/chat/slack/tools/{send-message.d.ts → send-files.d.ts} +27 -19
  60. package/dist/chat/state/conversation.d.ts +4 -4
  61. package/dist/chat/state/turn-id.d.ts +2 -0
  62. package/dist/chat/state/turn-session-keys.d.ts +6 -0
  63. package/dist/chat/state/turn-session.d.ts +11 -9
  64. package/dist/chat/task-execution/state.d.ts +6 -1
  65. package/dist/chat/task-execution/store.d.ts +1 -1
  66. package/dist/chat/tool-support/pi-tool-adapter.d.ts +1 -1
  67. package/dist/chat/tool-support/tool-execution-report.d.ts +1 -0
  68. package/dist/chat/tools/handoff/tool.d.ts +2 -2
  69. package/dist/chat/tools/sandbox/file-uploads.d.ts +28 -6
  70. package/dist/chat/tools/types.d.ts +6 -9
  71. package/dist/chat/tools/web/image-generate.d.ts +4 -6
  72. package/dist/{chunk-DDRQ4U7I.js → chunk-4YF7Z6IA.js} +390 -270
  73. package/dist/{chunk-AZ5OMSN5.js → chunk-AUUOHQAT.js} +2 -2
  74. package/dist/chunk-B2Z2H66D.js +250 -0
  75. package/dist/{chunk-4W4O4DCV.js → chunk-CQ7KSO2B.js} +75 -45
  76. package/dist/{chunk-MJSJAHBW.js → chunk-DY7TRYB5.js} +1 -1
  77. package/dist/{chunk-GPPUTY5M.js → chunk-EDLNHZH3.js} +861 -891
  78. package/dist/{chunk-R5BFYK2O.js → chunk-IGHMVDWI.js} +134 -18
  79. package/dist/chunk-MU6HHZEN.js +99 -0
  80. package/dist/{chunk-XTKJPSMF.js → chunk-NVOTGWYX.js} +458 -684
  81. package/dist/{chunk-AEWZ7F65.js → chunk-O24R4DCK.js} +2 -179
  82. package/dist/{chunk-CCFROYAV.js → chunk-PUAMO4PI.js} +115 -125
  83. package/dist/{chunk-ZMRLBBD5.js → chunk-RMVOAJRL.js} +30 -13
  84. package/dist/{chunk-3NYUCBLE.js → chunk-SPUAJVVH.js} +6 -4
  85. package/dist/{chunk-4UYIRWDW.js → chunk-SS67LUOK.js} +41 -290
  86. package/dist/{chunk-FXFQNHRU.js → chunk-VFUK3X5B.js} +4 -2
  87. package/dist/{chunk-3MPPVPGZ.js → chunk-VH6KWKG2.js} +2 -2
  88. package/dist/chunk-VIXFG2VC.js +182 -0
  89. package/dist/{chunk-BKM4UXUD.js → chunk-YFQ7CQDE.js} +669 -18
  90. package/dist/{chunk-77LHNQK4.js → chunk-YIPD3L6L.js} +4 -2
  91. package/dist/{chunk-3OUSJPR7.js → chunk-YNP2ATQX.js} +6 -4
  92. package/dist/{chunk-WR7H7VLJ.js → chunk-YT72TOEK.js} +2 -2
  93. package/dist/cli/chat.js +21 -20
  94. package/dist/cli/check.js +4 -3
  95. package/dist/cli/plugins.js +11 -9
  96. package/dist/cli/snapshot-warmup.js +7 -5
  97. package/dist/cli/upgrade.js +2041 -105
  98. package/dist/db/schema/{agent-steps.d.ts → conversation-events.d.ts} +37 -21
  99. package/dist/db/schema.d.ts +28 -159
  100. package/dist/{db-S33LFWG2.js → db-DIGO4TGW.js} +6 -8
  101. package/dist/{runner-HA5XAL6K.js → runner-ACR2HAIC.js} +209 -101
  102. package/dist/{skills-722AXRV5.js → skills-ITNHBARB.js} +4 -3
  103. package/dist/{validation-EUI2UFRM.js → validation-AGQ46ZGV.js} +4 -3
  104. package/migrations/0005_conversation_events.sql +122 -0
  105. package/migrations/README.md +23 -10
  106. package/migrations/meta/0005_snapshot.json +948 -0
  107. package/migrations/meta/_journal.json +7 -0
  108. package/package.json +5 -5
  109. package/dist/api/conversations/activity.d.ts +0 -40
  110. package/dist/api/conversations/detail-projection.d.ts +0 -11
  111. package/dist/api/conversations/detail.query.d.ts +0 -3
  112. package/dist/api/conversations/subagent.d.ts +0 -10
  113. package/dist/api/conversations/transcript.d.ts +0 -28
  114. package/dist/chat/conversations/legacy-advisor-session.d.ts +0 -7
  115. package/dist/chat/conversations/legacy-import.d.ts +0 -38
  116. package/dist/chat/conversations/sql/legacy-history-import.d.ts +0 -55
  117. package/dist/chat/conversations/sql/messages.d.ts +0 -4
  118. package/dist/chat/conversations/visible-compactions.d.ts +0 -11
  119. package/dist/chat/conversations/visible-messages.d.ts +0 -47
  120. package/dist/chat/services/reply-delivery-plan.d.ts +0 -5
  121. package/dist/chat/state/session-log.d.ts +0 -384
  122. package/dist/chunk-P4P7O5WG.js +0 -1072
  123. package/dist/chunk-XIMUQ4IU.js +0 -147
  124. package/dist/db/schema/conversation-messages.d.ts +0 -153
  125. package/dist/handlers/github-webhook/check-suite.d.ts +0 -3
  126. package/dist/handlers/github-webhook/issue-comment.d.ts +0 -3
  127. package/dist/handlers/github-webhook/pull-request-review-comment.d.ts +0 -3
  128. package/dist/handlers/github-webhook/pull-request-review.d.ts +0 -3
  129. package/dist/handlers/github-webhook/pull-request.d.ts +0 -3
  130. package/dist/handlers/github-webhook/resource.d.ts +0 -10
  131. package/dist/handlers/github-webhook.d.ts +0 -15
  132. package/dist/legacy-import-TMJISRKO.js +0 -18
@@ -1,384 +0,0 @@
1
- import { z } from "zod";
2
- import { type Actor } from "@sentry/junior-plugin-api";
3
- import { type PiMessage } from "@/chat/pi/messages";
4
- import { type StoredSlackActor } from "@/chat/actor";
5
- declare const piMessageAuthoritySchema: z.ZodUnion<readonly [z.ZodLiteral<"instruction">, z.ZodLiteral<"context">]>;
6
- /** Per-message provenance payload reused by the SQL agent-step envelope. */
7
- export declare const piMessageProvenanceSchema: z.ZodObject<{
8
- authority: z.ZodUnion<readonly [z.ZodLiteral<"instruction">, z.ZodLiteral<"context">]>;
9
- actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
10
- platform: z.ZodLiteral<"slack">;
11
- teamId: z.ZodString;
12
- email: z.ZodOptional<z.ZodString>;
13
- fullName: z.ZodOptional<z.ZodString>;
14
- userId: z.ZodString;
15
- userName: z.ZodOptional<z.ZodString>;
16
- }, z.core.$strict>, z.ZodObject<{
17
- platform: z.ZodLiteral<"local">;
18
- email: z.ZodOptional<z.ZodString>;
19
- fullName: z.ZodOptional<z.ZodString>;
20
- userId: z.ZodString;
21
- userName: z.ZodOptional<z.ZodString>;
22
- }, z.core.$strict>, z.ZodObject<{
23
- platform: z.ZodLiteral<"system">;
24
- name: z.ZodString;
25
- }, z.core.$strict>], "platform">>;
26
- }, z.core.$strict>;
27
- /** Whether a user-role Pi message is a durable instruction or ambient context. */
28
- export type PiMessageAuthority = z.output<typeof piMessageAuthoritySchema>;
29
- /** Per-message record of the actor a Pi message came from and its authority weight. */
30
- export type PiMessageProvenance = z.output<typeof piMessageProvenanceSchema>;
31
- /**
32
- * Recover per-message provenance from a legacy v1 pi_message. A stored Slack
33
- * actor on the entry meant that user message was the turn instruction, so it
34
- * decodes to an authored instruction when the identity is intact; anything
35
- * missing or malformed fails closed to unauthored context.
36
- */
37
- export declare function legacyActorProvenance(actor: StoredSlackActor): PiMessageProvenance;
38
- declare const authorizationKindSchema: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
39
- declare const transcriptRefSchema: z.ZodObject<{
40
- type: z.ZodLiteral<"advisor_session">;
41
- parentConversationId: z.ZodString;
42
- key: z.ZodString;
43
- }, z.core.$strip>;
44
- declare const sessionLogEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
45
- schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
46
- type: z.ZodLiteral<"pi_message">;
47
- sessionId: z.ZodDefault<z.ZodString>;
48
- message: z.ZodPipe<z.ZodObject<{
49
- role: z.ZodString;
50
- }, 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").BashExecutionMessage | import("@earendil-works/pi-agent-core").CustomMessage<unknown> | import("@earendil-works/pi-agent-core").BranchSummaryMessage | import("@earendil-works/pi-agent-core").CompactionSummaryMessage, {
51
- [x: string]: unknown;
52
- role: string;
53
- }>>;
54
- provenance: z.ZodOptional<z.ZodObject<{
55
- authority: z.ZodUnion<readonly [z.ZodLiteral<"instruction">, z.ZodLiteral<"context">]>;
56
- actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
57
- platform: z.ZodLiteral<"slack">;
58
- teamId: z.ZodString;
59
- email: z.ZodOptional<z.ZodString>;
60
- fullName: z.ZodOptional<z.ZodString>;
61
- userId: z.ZodString;
62
- userName: z.ZodOptional<z.ZodString>;
63
- }, z.core.$strict>, z.ZodObject<{
64
- platform: z.ZodLiteral<"local">;
65
- email: z.ZodOptional<z.ZodString>;
66
- fullName: z.ZodOptional<z.ZodString>;
67
- userId: z.ZodString;
68
- userName: z.ZodOptional<z.ZodString>;
69
- }, z.core.$strict>, z.ZodObject<{
70
- platform: z.ZodLiteral<"system">;
71
- name: z.ZodString;
72
- }, z.core.$strict>], "platform">>;
73
- }, z.core.$strict>>;
74
- actor: z.ZodOptional<z.ZodObject<{
75
- email: z.ZodOptional<z.ZodString>;
76
- fullName: z.ZodOptional<z.ZodString>;
77
- platform: z.ZodOptional<z.ZodLiteral<"slack">>;
78
- slackUserId: z.ZodOptional<z.ZodString>;
79
- slackUserName: z.ZodOptional<z.ZodString>;
80
- teamId: z.ZodOptional<z.ZodString>;
81
- }, z.core.$strict>>;
82
- }, z.core.$strip>, z.ZodObject<{
83
- schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
84
- type: z.ZodLiteral<"projection_reset">;
85
- sessionId: z.ZodDefault<z.ZodString>;
86
- messages: z.ZodArray<z.ZodPipe<z.ZodObject<{
87
- role: z.ZodString;
88
- }, 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").BashExecutionMessage | import("@earendil-works/pi-agent-core").CustomMessage<unknown> | import("@earendil-works/pi-agent-core").BranchSummaryMessage | import("@earendil-works/pi-agent-core").CompactionSummaryMessage, {
89
- [x: string]: unknown;
90
- role: string;
91
- }>>>;
92
- provenance: z.ZodOptional<z.ZodArray<z.ZodObject<{
93
- authority: z.ZodUnion<readonly [z.ZodLiteral<"instruction">, z.ZodLiteral<"context">]>;
94
- actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
95
- platform: z.ZodLiteral<"slack">;
96
- teamId: z.ZodString;
97
- email: z.ZodOptional<z.ZodString>;
98
- fullName: z.ZodOptional<z.ZodString>;
99
- userId: z.ZodString;
100
- userName: z.ZodOptional<z.ZodString>;
101
- }, z.core.$strict>, z.ZodObject<{
102
- platform: z.ZodLiteral<"local">;
103
- email: z.ZodOptional<z.ZodString>;
104
- fullName: z.ZodOptional<z.ZodString>;
105
- userId: z.ZodString;
106
- userName: z.ZodOptional<z.ZodString>;
107
- }, z.core.$strict>, z.ZodObject<{
108
- platform: z.ZodLiteral<"system">;
109
- name: z.ZodString;
110
- }, z.core.$strict>], "platform">>;
111
- }, z.core.$strict>>>;
112
- actor: z.ZodOptional<z.ZodObject<{
113
- email: z.ZodOptional<z.ZodString>;
114
- fullName: z.ZodOptional<z.ZodString>;
115
- platform: z.ZodOptional<z.ZodLiteral<"slack">>;
116
- slackUserId: z.ZodOptional<z.ZodString>;
117
- slackUserName: z.ZodOptional<z.ZodString>;
118
- teamId: z.ZodOptional<z.ZodString>;
119
- }, z.core.$strict>>;
120
- }, z.core.$strip>, z.ZodObject<{
121
- schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
122
- type: z.ZodLiteral<"actor_recorded">;
123
- sessionId: z.ZodDefault<z.ZodString>;
124
- actor: z.ZodObject<{
125
- email: z.ZodOptional<z.ZodString>;
126
- fullName: z.ZodOptional<z.ZodString>;
127
- platform: z.ZodOptional<z.ZodLiteral<"slack">>;
128
- slackUserId: z.ZodOptional<z.ZodString>;
129
- slackUserName: z.ZodOptional<z.ZodString>;
130
- teamId: z.ZodOptional<z.ZodString>;
131
- }, z.core.$strict>;
132
- }, z.core.$strip>, z.ZodObject<{
133
- schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
134
- type: z.ZodLiteral<"mcp_provider_connected">;
135
- sessionId: z.ZodDefault<z.ZodString>;
136
- provider: z.ZodString;
137
- }, z.core.$strip>, z.ZodObject<{
138
- schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
139
- type: z.ZodLiteral<"authorization_requested">;
140
- sessionId: z.ZodDefault<z.ZodString>;
141
- createdAtMs: z.ZodNumber;
142
- kind: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
143
- provider: z.ZodString;
144
- actorId: z.ZodString;
145
- authorizationId: z.ZodString;
146
- delivery: z.ZodUnion<readonly [z.ZodLiteral<"private_link_sent">, z.ZodLiteral<"private_link_reused">]>;
147
- }, z.core.$strip>, z.ZodObject<{
148
- schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
149
- type: z.ZodLiteral<"authorization_completed">;
150
- sessionId: z.ZodDefault<z.ZodString>;
151
- createdAtMs: z.ZodNumber;
152
- kind: z.ZodUnion<readonly [z.ZodLiteral<"plugin">, z.ZodLiteral<"mcp">]>;
153
- provider: z.ZodString;
154
- actorId: z.ZodString;
155
- authorizationId: z.ZodString;
156
- }, z.core.$strip>, z.ZodObject<{
157
- schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
158
- type: z.ZodLiteral<"tool_execution_started">;
159
- sessionId: z.ZodDefault<z.ZodString>;
160
- createdAtMs: z.ZodNumber;
161
- toolCallId: z.ZodString;
162
- toolName: z.ZodString;
163
- args: z.ZodOptional<z.ZodUnknown>;
164
- }, z.core.$strip>, z.ZodObject<{
165
- schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
166
- type: z.ZodLiteral<"subagent_started">;
167
- sessionId: z.ZodDefault<z.ZodString>;
168
- subagentInvocationId: z.ZodString;
169
- subagentKind: z.ZodString;
170
- parentToolCallId: z.ZodOptional<z.ZodString>;
171
- parentConversationId: z.ZodString;
172
- parentSessionId: z.ZodOptional<z.ZodString>;
173
- transcriptRef: z.ZodObject<{
174
- type: z.ZodLiteral<"advisor_session">;
175
- parentConversationId: z.ZodString;
176
- key: z.ZodString;
177
- }, z.core.$strip>;
178
- historyMode: z.ZodLiteral<"shared">;
179
- modelId: z.ZodOptional<z.ZodString>;
180
- reasoningLevel: z.ZodOptional<z.ZodString>;
181
- createdAtMs: z.ZodNumber;
182
- }, z.core.$strip>, z.ZodObject<{
183
- schemaVersion: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
184
- type: z.ZodLiteral<"subagent_ended">;
185
- sessionId: z.ZodDefault<z.ZodString>;
186
- subagentInvocationId: z.ZodString;
187
- outcome: z.ZodUnion<readonly [z.ZodLiteral<"success">, z.ZodLiteral<"error">, z.ZodLiteral<"aborted">]>;
188
- errorCode: z.ZodOptional<z.ZodString>;
189
- transcriptEndMessageIndex: z.ZodOptional<z.ZodNumber>;
190
- transcriptStartMessageIndex: z.ZodOptional<z.ZodNumber>;
191
- createdAtMs: z.ZodNumber;
192
- }, z.core.$strip>], "type">;
193
- /** Actor identity stored with turn-start messages for durable continuation. */
194
- export type SessionLogEntry = z.infer<typeof sessionLogEntrySchema>;
195
- export type AuthorizationKind = z.infer<typeof authorizationKindSchema>;
196
- export type TranscriptRef = z.infer<typeof transcriptRefSchema>;
197
- export type SessionActivityEntry = Extract<SessionLogEntry, {
198
- type: "tool_execution_started";
199
- }> | Extract<SessionLogEntry, {
200
- type: "subagent_started";
201
- }> | Extract<SessionLogEntry, {
202
- type: "subagent_ended";
203
- }>;
204
- interface Scope {
205
- conversationId: string;
206
- }
207
- interface AppendArgs {
208
- entries: SessionLogEntry[];
209
- scope: Scope;
210
- ttlMs: number;
211
- }
212
- export interface SessionLogStore {
213
- append(args: AppendArgs): Promise<void>;
214
- read(scope: Scope): Promise<SessionLogEntry[]>;
215
- }
216
- /** Aligned Pi-message projection: `provenance[i]` describes `messages[i]`. */
217
- export interface SessionProjection {
218
- messages: PiMessage[];
219
- provenance: PiMessageProvenance[];
220
- }
221
- /**
222
- * All distinct actors annotated on instruction-authority messages, in
223
- * first-seen order — the run's actors. This is attribution, never
224
- * authority: it exists so provenance consumers know which actors
225
- * contributed instructions to a run. It must never feed credential
226
- * issuance, credential-subject selection, or scope ownership.
227
- * Unattributable instructions (no resolvable actor) never join;
228
- * distinctness is by identity ids only, never display fields.
229
- */
230
- export declare function instructionActors(provenance: PiMessageProvenance[]): Actor[];
231
- /**
232
- * Read the raw decoded legacy session-log entries for one conversation.
233
- *
234
- * The single read source for the one-time Redis→SQL history import; it returns
235
- * every entry in list order (no projection collapsing) so the importer can
236
- * translate `sessionId` markers into context epochs.
237
- */
238
- export declare function readSessionLogEntries(args: Scope & {
239
- store?: SessionLogStore;
240
- }): Promise<SessionLogEntry[]>;
241
- /** Load chronological host-only runtime activity entries for reporting. */
242
- export declare function loadActivityEntries(args: Scope & {
243
- store?: SessionLogStore;
244
- sessionId?: string;
245
- }): Promise<SessionActivityEntry[]>;
246
- /** Load the committed Pi-message projection for a conversation. */
247
- export declare function loadMessages(args: Scope & {
248
- store?: SessionLogStore;
249
- messageCount: number;
250
- sessionId?: string;
251
- }): Promise<PiMessage[] | undefined>;
252
- /** Load the committed Pi-message projection with aligned per-message provenance. */
253
- export declare function loadMessagesWithProvenance(args: Scope & {
254
- store?: SessionLogStore;
255
- messageCount: number;
256
- sessionId?: string;
257
- }): Promise<SessionProjection | undefined>;
258
- /** Load the full current Pi-message projection for a conversation. */
259
- export declare function loadProjection(args: Scope & {
260
- store?: SessionLogStore;
261
- sessionId?: string;
262
- }): Promise<PiMessage[]>;
263
- /**
264
- * Load the Pi-message projection with aligned per-message provenance in one
265
- * read. Used at continuation boundaries to avoid a second log scan.
266
- */
267
- export declare function loadProjectionWithProvenance(args: Scope & {
268
- store?: SessionLogStore;
269
- sessionId?: string;
270
- }): Promise<SessionProjection>;
271
- /**
272
- * Load the projection with the latest instruction actor as a stored Slack
273
- * actor. Retained for callers that still key on a single latest actor; it
274
- * derives the actor from per-message provenance rather than a latest-wins
275
- * field.
276
- */
277
- export declare function loadProjectionWithActor(args: Scope & {
278
- store?: SessionLogStore;
279
- sessionId?: string;
280
- }): Promise<{
281
- messages: PiMessage[];
282
- actor?: StoredSlackActor;
283
- }>;
284
- /** Load MCP providers that were durably connected in this conversation. */
285
- export declare function loadConnectedMcpProviders(args: Scope & {
286
- store?: SessionLogStore;
287
- }): Promise<string[]>;
288
- /** Record a successful MCP provider connection without duplicating the fact. */
289
- export declare function recordMcpProviderConnected(args: Scope & {
290
- store?: SessionLogStore;
291
- provider: string;
292
- ttlMs: number;
293
- }): Promise<void>;
294
- /** Record that an OAuth/MCP authorization link was delivered or reused. */
295
- export declare function recordAuthorizationRequested(args: Scope & {
296
- store?: SessionLogStore;
297
- kind: AuthorizationKind;
298
- provider: string;
299
- actorId: string;
300
- authorizationId: string;
301
- delivery: "private_link_sent" | "private_link_reused";
302
- ttlMs: number;
303
- }): Promise<void>;
304
- /** Record completed authorization as a chronological host observation for Pi. */
305
- export declare function recordAuthorizationCompleted(args: Scope & {
306
- store?: SessionLogStore;
307
- kind: AuthorizationKind;
308
- provider: string;
309
- actorId: string;
310
- authorizationId: string;
311
- ttlMs: number;
312
- }): Promise<void>;
313
- /** Record a host-observed parent tool start without adding it to Pi replay. */
314
- export declare function recordToolExecutionStarted(args: Scope & {
315
- args?: unknown;
316
- createdAtMs?: number;
317
- sessionId?: string;
318
- store?: SessionLogStore;
319
- toolCallId: string;
320
- toolName: string;
321
- ttlMs: number;
322
- }): Promise<void>;
323
- /** Record that a child agent execution became visible from this parent run. */
324
- export declare function recordSubagentStarted(args: Scope & {
325
- createdAtMs?: number;
326
- historyMode: "shared";
327
- modelId?: string;
328
- parentConversationId: string;
329
- parentSessionId?: string;
330
- parentToolCallId?: string;
331
- reasoningLevel?: string;
332
- sessionId?: string;
333
- store?: SessionLogStore;
334
- subagentInvocationId: string;
335
- subagentKind: string;
336
- transcriptRef: TranscriptRef;
337
- ttlMs: number;
338
- }): Promise<void>;
339
- /** Record the terminal state for a previously-started child agent execution. */
340
- export declare function recordSubagentEnded(args: Scope & {
341
- createdAtMs?: number;
342
- errorCode?: string;
343
- outcome: "success" | "error" | "aborted";
344
- sessionId?: string;
345
- store?: SessionLogStore;
346
- subagentInvocationId: string;
347
- transcriptEndMessageIndex?: number;
348
- transcriptStartMessageIndex?: number;
349
- ttlMs: number;
350
- }): Promise<void>;
351
- /**
352
- * Append conversation-log entries and advance the current Pi projection.
353
- *
354
- * Normal commits append new Pi messages. If the runtime rolls back to an
355
- * earlier safe boundary, the log records that projection reset as an explicit
356
- * event instead of rewriting prior history.
357
- */
358
- export declare function commitMessages(args: Scope & {
359
- store?: SessionLogStore;
360
- messages: PiMessage[];
361
- ttlMs: number;
362
- /** Explicit per-message provenance aligned one-to-one with `messages`. */
363
- provenance?: PiMessageProvenance[];
364
- /** Explicit provenance for the trailing newly committed messages. */
365
- trailingMessageProvenance?: PiMessageProvenance[];
366
- /** Default applied to the last new user message when no explicit array. */
367
- newMessageProvenance?: PiMessageProvenance;
368
- }): Promise<{
369
- sessionId: string;
370
- provenance: PiMessageProvenance[];
371
- }>;
372
- /** Build an instruction-provenance record for the given actor. */
373
- export declare function instructionProvenanceFor(actor: Actor | undefined): PiMessageProvenance;
374
- /** Unattributed ambient-context provenance for non-instruction Pi messages. */
375
- export declare const contextProvenance: PiMessageProvenance;
376
- /**
377
- * Parse durably-stored message provenance, failing closed on misalignment.
378
- *
379
- * A missing field is a legacy record: it materializes as unauthored context of
380
- * the expected length. A present-but-malformed or wrong-length value returns
381
- * undefined so callers reject the record rather than zip a mismatched array.
382
- */
383
- export declare function parseStoredMessageProvenance(value: unknown, expectedLength: number): PiMessageProvenance[] | undefined;
384
- export {};