@sentry/junior 0.91.0 → 0.92.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 (128) hide show
  1. package/dist/{agent-hooks-MXAF7RQL.js → agent-hooks-KL7I3ZRC.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 +365 -265
  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 +2 -2
  15. package/dist/chat/agent/request.d.ts +13 -13
  16. package/dist/chat/agent/resume.d.ts +5 -4
  17. package/dist/chat/agent/tools.d.ts +4 -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/logging.d.ts +2 -2
  27. package/dist/chat/no-reply.d.ts +1 -1
  28. package/dist/chat/oauth-flow.d.ts +1 -1
  29. package/dist/chat/pi/messages.d.ts +2 -2
  30. package/dist/chat/pi/transcript.d.ts +15 -0
  31. package/dist/chat/plugins/agent-hooks.d.ts +5 -3
  32. package/dist/chat/plugins/credential-hooks.d.ts +2 -8
  33. package/dist/chat/prompt.d.ts +3 -6
  34. package/dist/chat/runtime/reply-executor.d.ts +1 -1
  35. package/dist/chat/runtime/turn-input.d.ts +1 -1
  36. package/dist/chat/sandbox/egress/schemas.d.ts +2 -2
  37. package/dist/chat/sandbox/egress/session.d.ts +1 -1
  38. package/dist/chat/services/context-compaction.d.ts +1 -1
  39. package/dist/chat/services/conversation-memory.d.ts +1 -1
  40. package/dist/chat/services/mcp-auth-orchestration.d.ts +1 -1
  41. package/dist/chat/services/message-actor-identity.d.ts +4 -4
  42. package/dist/chat/services/pending-auth.d.ts +2 -2
  43. package/dist/chat/services/plugin-auth-orchestration.d.ts +1 -1
  44. package/dist/chat/services/provider-default-config.d.ts +1 -1
  45. package/dist/chat/services/subscribed-decision.d.ts +1 -1
  46. package/dist/chat/services/turn-result.d.ts +1 -1
  47. package/dist/chat/services/turn-session-record.d.ts +11 -8
  48. package/dist/chat/services/turn-thinking-level.d.ts +1 -1
  49. package/dist/chat/slack/assistant-thread/title.d.ts +1 -1
  50. package/dist/chat/slack/tools/canvas/create.d.ts +41 -1
  51. package/dist/chat/slack/tools/canvas/edit.d.ts +60 -1
  52. package/dist/chat/slack/tools/canvas/read.d.ts +60 -1
  53. package/dist/chat/slack/tools/canvas/write.d.ts +41 -1
  54. package/dist/chat/slack/tools/channel-list-messages.d.ts +45 -1
  55. package/dist/chat/slack/tools/context.d.ts +3 -3
  56. package/dist/chat/slack/tools/list/add-items.d.ts +42 -1
  57. package/dist/chat/slack/tools/list/create.d.ts +40 -1
  58. package/dist/chat/slack/tools/list/get-items.d.ts +40 -1
  59. package/dist/chat/slack/tools/list/update-item.d.ts +46 -1
  60. package/dist/chat/slack/tools/message-add-reaction.d.ts +40 -1
  61. package/dist/chat/slack/tools/send-message.d.ts +45 -1
  62. package/dist/chat/slack/tools/thread-read.d.ts +44 -1
  63. package/dist/chat/slack/tools/user-lookup.d.ts +45 -1
  64. package/dist/chat/slack/user.d.ts +3 -3
  65. package/dist/chat/slack/vision-context.d.ts +2 -2
  66. package/dist/chat/sql/schema.d.ts +2 -19
  67. package/dist/chat/state/conversation-details.d.ts +4 -4
  68. package/dist/chat/state/conversation.d.ts +1 -1
  69. package/dist/chat/state/session-log.d.ts +140 -26
  70. package/dist/chat/state/turn-session.d.ts +18 -5
  71. package/dist/chat/task-execution/slack-work.d.ts +2 -2
  72. package/dist/chat/task-execution/state.d.ts +4 -4
  73. package/dist/chat/tool-support/zod-tool.d.ts +16 -4
  74. package/dist/chat/tools/advisor/tool.d.ts +41 -1
  75. package/dist/chat/tools/definition.d.ts +10 -0
  76. package/dist/chat/tools/execute-tool.d.ts +41 -1
  77. package/dist/chat/tools/resource-events.d.ts +124 -3
  78. package/dist/chat/tools/runtime/report-progress.d.ts +40 -1
  79. package/dist/chat/tools/sandbox/bash.d.ts +41 -1
  80. package/dist/chat/tools/sandbox/edit-file.d.ts +44 -1
  81. package/dist/chat/tools/sandbox/find-files.d.ts +42 -1
  82. package/dist/chat/tools/sandbox/grep.d.ts +46 -1
  83. package/dist/chat/tools/sandbox/list-dir.d.ts +41 -1
  84. package/dist/chat/tools/sandbox/read-file.d.ts +42 -1
  85. package/dist/chat/tools/sandbox/write-file.d.ts +41 -1
  86. package/dist/chat/tools/search-tools.d.ts +102 -1
  87. package/dist/chat/tools/skill/call-mcp-tool.d.ts +10 -1
  88. package/dist/chat/tools/skill/load-skill.d.ts +40 -1
  89. package/dist/chat/tools/skill/search-mcp-tools.d.ts +100 -1
  90. package/dist/chat/tools/system-time.d.ts +38 -1
  91. package/dist/chat/tools/types.d.ts +4 -4
  92. package/dist/chat/tools/web/fetch-tool.d.ts +41 -1
  93. package/dist/chat/tools/web/image-generate.d.ts +62 -1
  94. package/dist/chat/tools/web/search.d.ts +41 -1
  95. package/dist/{chunk-HXL2ZV74.js → chunk-3F54A3YM.js} +82 -11
  96. package/dist/{chunk-ZGDTBSQ7.js → chunk-56SIBIVF.js} +930 -660
  97. package/dist/{chunk-DACFZ5CI.js → chunk-7K3JALTQ.js} +18 -12
  98. package/dist/{chunk-IRRMABQD.js → chunk-APIVR44P.js} +10 -10
  99. package/dist/{chunk-XP7F4LYB.js → chunk-BTH37NCU.js} +4 -4
  100. package/dist/{chunk-5GBUZI6M.js → chunk-H7KUZAMZ.js} +4 -4
  101. package/dist/{chunk-PIB4EOW6.js → chunk-IWKVXO3F.js} +19 -72
  102. package/dist/{chunk-TYUXD3FN.js → chunk-MC4ZZE4Q.js} +1 -1
  103. package/dist/{chunk-2S7M37HY.js → chunk-NIFONS4W.js} +86 -47
  104. package/dist/{chunk-AOISHLSF.js → chunk-O6ZYIHFC.js} +143 -20
  105. package/dist/{chunk-GCWD2VHP.js → chunk-OQQU3SD6.js} +285 -124
  106. package/dist/{chunk-NW7AXDA5.js → chunk-OZJXGX4U.js} +2 -2
  107. package/dist/{chunk-KC42JAAQ.js → chunk-PFXC67GJ.js} +3 -3
  108. package/dist/{chunk-QCKGI74V.js → chunk-PGR4WGZW.js} +10 -10
  109. package/dist/{chunk-ZUK7BL63.js → chunk-S6QKIGRM.js} +66 -54
  110. package/dist/{chunk-IX76WFJV.js → chunk-TF5VLGA7.js} +10 -10
  111. package/dist/{chunk-AN2437E3.js → chunk-YTNPU7I2.js} +2 -2
  112. package/dist/{chunk-3MPOMK3K.js → chunk-YYBX2BD5.js} +61 -3
  113. package/dist/{chunk-ONFOWI2D.js → chunk-Z4FOYQXW.js} +16 -15
  114. package/dist/{chunk-RS6ANWVT.js → chunk-ZATRYQLR.js} +1 -1
  115. package/dist/cli/chat.js +20 -20
  116. package/dist/cli/check.js +3 -3
  117. package/dist/cli/plugins.js +9 -9
  118. package/dist/cli/snapshot-warmup.js +6 -6
  119. package/dist/cli/upgrade.js +9 -9
  120. package/dist/{db-CXI7PR5U.js → db-GCK43OO3.js} +4 -4
  121. package/dist/instrumentation.js +1 -1
  122. package/dist/reporting/conversations.d.ts +3 -3
  123. package/dist/reporting.d.ts +1 -1
  124. package/dist/reporting.js +48 -50
  125. package/dist/{runner-FKL3RAHA.js → runner-Y73GZ2VE.js} +20 -18
  126. package/dist/{validation-I7GD2YWS.js → validation-KYAWETI4.js} +3 -3
  127. package/package.json +6 -6
  128. package/dist/chat/requester.d.ts +0 -68
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-XP7F4LYB.js";
4
- import "./chunk-ZUK7BL63.js";
3
+ } from "./chunk-BTH37NCU.js";
4
+ import "./chunk-S6QKIGRM.js";
5
5
  import "./chunk-OB42YVAE.js";
6
6
  import "./chunk-3DA7X2U3.js";
7
7
  import "./chunk-6APU57E6.js";
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Canonical actor identity.
3
+ *
4
+ * Runtime actors are platform-scoped actors. Stored Slack actor parsing
5
+ * remains explicit so durable conversation metadata is not repaired on read.
6
+ */
7
+ import { z } from "zod";
8
+ export declare const storedSlackActorSchema: z.ZodObject<{
9
+ email: z.ZodOptional<z.ZodString>;
10
+ fullName: z.ZodOptional<z.ZodString>;
11
+ platform: z.ZodOptional<z.ZodLiteral<"slack">>;
12
+ slackUserId: z.ZodOptional<z.ZodString>;
13
+ slackUserName: z.ZodOptional<z.ZodString>;
14
+ teamId: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$strict>;
16
+ interface BaseActor {
17
+ email?: string;
18
+ fullName?: string;
19
+ userId: string;
20
+ userName?: string;
21
+ }
22
+ export interface SlackActor extends BaseActor {
23
+ platform: "slack";
24
+ teamId: string;
25
+ }
26
+ export interface LocalActor extends BaseActor {
27
+ platform: "local";
28
+ }
29
+ export interface SystemActor {
30
+ platform: "system";
31
+ name: string;
32
+ }
33
+ export type UserActor = SlackActor | LocalActor;
34
+ export type Actor = UserActor | SystemActor;
35
+ export interface SlackActorProfile {
36
+ email?: string;
37
+ fullName?: string;
38
+ userName?: string;
39
+ }
40
+ export type StoredSlackActor = z.output<typeof storedSlackActorSchema>;
41
+ /** Parse a serialized runtime actor that crossed a durable boundary. */
42
+ export declare function parseActor(value: unknown): Actor | undefined;
43
+ /** Return whether an actor is a platform-scoped user actor. */
44
+ export declare function isUserActor(actor: Actor | undefined): actor is UserActor;
45
+ interface ActorInput {
46
+ email?: string;
47
+ fullName?: string;
48
+ platform?: UserActor["platform"];
49
+ teamId?: string;
50
+ userId?: string;
51
+ userName?: string;
52
+ }
53
+ /** Keep actor ids exact at platform boundaries before they enter owned state. */
54
+ export declare function parseActorUserId(value: unknown): string | undefined;
55
+ /** Assert persisted actor ids without read-side repair. */
56
+ export declare function isActorUserId(value: string | undefined): value is string;
57
+ /** Build Junior's canonical platform actor from exact actor ids and profile data. */
58
+ export declare function createActor(input: ActorInput | undefined, context: {
59
+ platform?: UserActor["platform"];
60
+ teamId?: string;
61
+ userId?: string;
62
+ }): UserActor | undefined;
63
+ /** Build Junior's canonical actor from Slack profile data. */
64
+ export declare function createSlackActor(teamId: string, userId: string, profile: SlackActorProfile | null | undefined): SlackActor;
65
+ /** Parse a serialized Slack actor that crossed a runtime boundary. */
66
+ export declare function parseStoredSlackActor(value: unknown): StoredSlackActor | undefined;
67
+ /** Convert a runtime Slack actor into its durable session shape. */
68
+ export declare function toStoredSlackActor(actor: SlackActor): StoredSlackActor;
69
+ /** Resolve a Slack resume actor from stored profile data and the active actor. */
70
+ export declare function createSlackResumeActor(args: {
71
+ actor?: UserActor;
72
+ teamId: string;
73
+ userId: string;
74
+ }): SlackActor;
75
+ export {};
@@ -5,7 +5,7 @@ import type { SkillInvocation, SkillMetadata } from "@/chat/skills";
5
5
  import type { ActiveMcpCatalogSummary } from "@/chat/tool-support/skill/mcp-tool-summary";
6
6
  import type { ToolRuntimeContext } from "@/chat/tools/types";
7
7
  import type { AnyToolDefinition } from "@/chat/tools/definition";
8
- import type { Requester } from "@/chat/requester";
8
+ import { type Actor } from "@/chat/actor";
9
9
  import type { ThreadArtifactsState } from "@/chat/state/artifacts";
10
10
  import type { AgentRunInput, AgentRunInstructionActor, AgentRunRouting, AgentRunSteeringMessage } from "@/chat/agent/request";
11
11
  export type UserContentPart = {
@@ -56,7 +56,7 @@ export declare function buildSteeringPiMessage(message: AgentRunSteeringMessage)
56
56
  /** Assemble prompt history, instructions, and telemetry input for one slice. */
57
57
  export declare function assemblePrompt(args: {
58
58
  activeMcpCatalogs: ActiveMcpCatalogSummary[];
59
- actorRequester?: Requester;
59
+ currentActor?: Actor;
60
60
  artifactState?: ThreadArtifactsState;
61
61
  availableSkills: SkillMetadata[];
62
62
  configurationValues: Record<string, unknown>;
@@ -2,16 +2,16 @@
2
2
  * Agent run request contract.
3
3
  *
4
4
  * Groups the per-slice run request by the runtime role each field serves and
5
- * owns interpretation of the routing group: requester derivation, surface
5
+ * owns interpretation of the routing group: actor derivation, surface
6
6
  * inference, destination consistency checks, and session identifiers. Run
7
7
  * phases consume these groups directly; callers build them at runtime
8
8
  * boundaries.
9
9
  */
10
- import type { Destination, Source } from "@sentry/junior-plugin-api";
10
+ import type { Destination, Source, SystemActor } from "@sentry/junior-plugin-api";
11
11
  import type { ChannelConfigurationService } from "@/chat/configuration/types";
12
12
  import type { CredentialContext } from "@/chat/credentials/context";
13
13
  import type { PiMessage } from "@/chat/pi/messages";
14
- import { type Requester } from "@/chat/requester";
14
+ import { type Actor } from "@/chat/actor";
15
15
  import type { SandboxAcquiredState } from "@/chat/sandbox/sandbox";
16
16
  import type { SandboxEgressTracePropagationConfig } from "@/chat/sandbox/egress/tracing";
17
17
  import type { AuthorizationFlowMode } from "@/chat/services/auth-pause";
@@ -19,6 +19,7 @@ import type { AssistantStatusSpec } from "@/chat/slack/assistant-thread/status";
19
19
  import type { SlackConversationContext } from "@/chat/slack/conversation-context";
20
20
  import type { ThreadArtifactsState } from "@/chat/state/artifacts";
21
21
  import type { ConversationPendingAuthState } from "@/chat/state/conversation";
22
+ import type { PiMessageProvenance } from "@/chat/state/session-log";
22
23
  import type { AgentTurnSurface } from "@/chat/state/turn-session";
23
24
  import type { ToolExecutionReport } from "@/chat/tool-support/tool-execution-report";
24
25
  import type { ImageGenerateToolDeps, WebFetchToolDeps, WebSearchToolDeps } from "@/chat/tools/types";
@@ -35,6 +36,8 @@ export interface AgentRunInstructionActor {
35
36
  }
36
37
  export interface AgentRunSteeringMessage {
37
38
  actor?: AgentRunInstructionActor;
39
+ /** Provenance of this queued/steered message, carrying its original author. */
40
+ provenance: PiMessageProvenance;
38
41
  omittedImageAttachmentCount?: number;
39
42
  text: string;
40
43
  timestampMs?: number;
@@ -55,16 +58,13 @@ export interface AgentRunInput {
55
58
  /** Carries identity and addressing needed to route tools, auth, and delivery. */
56
59
  export interface AgentRunRouting {
57
60
  credentialContext?: CredentialContext;
58
- requester?: Requester;
61
+ actor?: Actor;
59
62
  source: Source;
60
63
  slackConversation?: SlackConversationContext;
61
64
  destination: Destination;
62
65
  surface?: AgentTurnSurface;
63
66
  dispatch?: {
64
- actor?: {
65
- id: string;
66
- type: string;
67
- };
67
+ actor?: SystemActor;
68
68
  metadata?: Record<string, string>;
69
69
  plugin?: string;
70
70
  };
@@ -78,7 +78,7 @@ export interface AgentRunRouting {
78
78
  teamId?: string;
79
79
  messageTs?: string;
80
80
  threadTs?: string;
81
- requesterId?: string;
81
+ actorId?: string;
82
82
  };
83
83
  toolChannelId?: string;
84
84
  }
@@ -146,10 +146,10 @@ export declare function getSessionIdentifiers(routing: AgentRunRouting): {
146
146
  conversationId?: string;
147
147
  sessionId?: string;
148
148
  };
149
- /** Derive the acting requester, filling platform and team from the destination. */
150
- export declare function requesterFromRouting(routing: AgentRunRouting): Requester | undefined;
151
- /** Reject requester identities that do not belong to the active destination. */
152
- export declare function assertRequesterDestinationMatch(routing: AgentRunRouting): void;
149
+ /** Derive the acting actor, filling platform and team from the destination. */
150
+ export declare function actorFromRouting(routing: AgentRunRouting): Actor | undefined;
151
+ /** Reject actor identities that do not belong to the active destination. */
152
+ export declare function assertActorDestinationMatch(routing: AgentRunRouting): void;
153
153
  /** Reject legacy Slack correlation fields that conflict with the destination. */
154
154
  export declare function assertCorrelationDestinationMatch(routing: AgentRunRouting): void;
155
155
  /** Route tool side effects to the tool channel when one overrides the destination. */
@@ -9,10 +9,11 @@
9
9
  */
10
10
  import type { Destination, Source } from "@sentry/junior-plugin-api";
11
11
  import type { PiMessage } from "@/chat/pi/messages";
12
+ import type { PiMessageProvenance } from "@/chat/state/session-log";
12
13
  import { CooperativeTurnYieldError } from "@/chat/runtime/turn";
13
14
  import type { AgentRunOutcome } from "@/chat/runtime/agent-run-outcome";
14
15
  import type { AgentTurnSurface } from "@/chat/state/turn-session";
15
- import type { Requester } from "@/chat/requester";
16
+ import type { Actor } from "@/chat/actor";
16
17
  import { loadTurnSessionRecord, persistRunningSessionRecord } from "@/chat/services/turn-session-record";
17
18
  import { type AgentTurnUsage } from "@/chat/usage";
18
19
  import type { AgentRunDurability } from "@/chat/agent/request";
@@ -25,7 +26,7 @@ interface ResumeStateArgs {
25
26
  getLoadedSkillNames: () => string[];
26
27
  logContext: SessionRecordLogContext;
27
28
  recordActiveMcpProviders: () => Promise<void>;
28
- requester?: Requester;
29
+ actor?: Actor;
29
30
  runSource: Source;
30
31
  sessionConversationId?: string;
31
32
  sessionId?: string;
@@ -48,8 +49,8 @@ export declare function createResumeState(args: ResumeStateArgs): {
48
49
  getResumeSnapshot(currentMessages: PiMessage[]): PiMessage[];
49
50
  markTimedOut(): void;
50
51
  commitInput(): Promise<void>;
51
- persistSafeBoundary(messages: PiMessage[]): Promise<boolean>;
52
- requireDurableInputCheckpoint(messages: PiMessage[]): Promise<boolean>;
52
+ persistSafeBoundary(messages: PiMessage[], trailingMessageProvenance?: PiMessageProvenance[]): Promise<boolean>;
53
+ requireDurableInputCheckpoint(messages: PiMessage[], trailingMessageProvenance?: PiMessageProvenance[]): Promise<boolean>;
53
54
  yieldAtSafeBoundaryIfDue(currentMessages: PiMessage[]): void;
54
55
  /**
55
56
  * Persist the continuation for an expected run ending and translate it
@@ -20,7 +20,7 @@ import { type SandboxExecutor } from "@/chat/sandbox/sandbox";
20
20
  import type { PiMessage } from "@/chat/pi/messages";
21
21
  import type { LogContext } from "@/chat/logging";
22
22
  import type { ConversationPrivacy } from "@/chat/conversation-privacy";
23
- import type { Requester } from "@/chat/requester";
23
+ import { type Actor } from "@/chat/actor";
24
24
  import type { ThreadArtifactsState } from "@/chat/state/artifacts";
25
25
  import type { AuthorizationPauseError } from "@/chat/services/auth-pause";
26
26
  import type { AgentTurnSurface } from "@/chat/state/turn-session";
@@ -29,7 +29,9 @@ import type { ResumeState } from "@/chat/agent/resume";
29
29
  interface ToolWiringArgs {
30
30
  abortAgent: () => void;
31
31
  activeSkills: Skill[];
32
- actorRequester?: Requester;
32
+ currentActor?: Actor;
33
+ /** Live projection of the run's committed instruction-authority actors so far. */
34
+ currentActors?: () => Actor[];
33
35
  artifactStatePatch: Partial<ThreadArtifactsState>;
34
36
  availableSkills: SkillMetadata[];
35
37
  configurationValues: Record<string, unknown>;
@@ -3,7 +3,7 @@ import type { Skill } from "@/chat/skills";
3
3
  type JrRpcDeps = {
4
4
  activeSkill: Skill | null;
5
5
  channelConfiguration?: ChannelConfigurationService;
6
- requesterId?: string;
6
+ actorId?: string;
7
7
  onConfigurationValueChanged?: (key: string, value: unknown | undefined) => void;
8
8
  };
9
9
  export declare function maybeExecuteJrRpcCustomCommand(command: string, deps: JrRpcDeps): Promise<{
@@ -1,3 +1,4 @@
1
+ import type { AssistantMessage, Message } from "@earendil-works/pi-ai";
1
2
  export type ConversationPrivacy = "public" | "private";
2
3
  type TraceAttributeValue = string | number | boolean | string[];
3
4
  /**
@@ -32,6 +33,16 @@ export declare function toGenAiTextMetadata(text: string): Record<string, unknow
32
33
  export declare function toGenAiPayloadMetadata(payload: unknown): Record<string, unknown>;
33
34
  /** Convert an arbitrary payload into safe flattened trace attributes. */
34
35
  export declare function toGenAiPayloadTraceAttributes(prefix: string, payload: unknown): Record<string, TraceAttributeValue>;
36
+ /**
37
+ * Map a pi-ai AssistantMessage to the canonical gen_ai.output.messages shape:
38
+ * `{ role, parts: [...], finish_reason }` — drops provider noise fields.
39
+ */
40
+ export declare function toCanonicalOutputMessage(message: AssistantMessage): Record<string, unknown>;
41
+ /**
42
+ * Map a pi-ai Message (user/assistant/toolResult) to the canonical
43
+ * gen_ai.input.messages shape: `{ role, parts: [...] }`.
44
+ */
45
+ export declare function toCanonicalInputMessage(message: Message): Record<string, unknown>;
35
46
  /** Summarize a message list without exposing raw message content. */
36
47
  export declare function toGenAiMessagesTraceAttributes(prefix: string, messages: unknown[]): Record<string, TraceAttributeValue>;
37
48
  export {};
@@ -5,7 +5,7 @@ export interface Migration {
5
5
  id: string;
6
6
  statements: readonly string[];
7
7
  }
8
- export declare const migrations: readonly [Migration, Migration, Migration];
8
+ export declare const migrations: readonly [Migration, Migration, Migration, Migration];
9
9
  export { schema };
10
10
  /** Apply pending SQL schema migrations for queryable conversation records. */
11
11
  export declare function migrateSchema(executor: JuniorSqlMigrationExecutor, migrationList?: readonly Migration[]): Promise<void>;
@@ -174,23 +174,6 @@ export declare const juniorConversations: import("drizzle-orm/pg-core").PgTableW
174
174
  identity: undefined;
175
175
  generated: undefined;
176
176
  }, {}, {}>;
177
- requesterIdentityId: import("drizzle-orm/pg-core").PgColumn<{
178
- name: "requester_identity_id";
179
- tableName: "junior_conversations";
180
- dataType: "string";
181
- columnType: "PgText";
182
- data: string;
183
- driverParam: string;
184
- notNull: false;
185
- hasDefault: false;
186
- isPrimaryKey: false;
187
- isAutoincrement: false;
188
- hasRuntimeDefault: false;
189
- enumValues: [string, ...string[]];
190
- baseColumn: never;
191
- identity: undefined;
192
- generated: undefined;
193
- }, {}, {}>;
194
177
  creatorIdentityId: import("drizzle-orm/pg-core").PgColumn<{
195
178
  name: "creator_identity_id";
196
179
  tableName: "junior_conversations";
@@ -225,8 +208,8 @@ export declare const juniorConversations: import("drizzle-orm/pg-core").PgTableW
225
208
  identity: undefined;
226
209
  generated: undefined;
227
210
  }, {}, {}>;
228
- requester: import("drizzle-orm/pg-core").PgColumn<{
229
- name: "requester_json";
211
+ actor: import("drizzle-orm/pg-core").PgColumn<{
212
+ name: "actor_json";
230
213
  tableName: "junior_conversations";
231
214
  dataType: "json";
232
215
  columnType: "PgJsonb";
@@ -180,23 +180,6 @@ export declare const schema: {
180
180
  identity: undefined;
181
181
  generated: undefined;
182
182
  }, {}, {}>;
183
- requesterIdentityId: import("drizzle-orm/pg-core").PgColumn<{
184
- name: "requester_identity_id";
185
- tableName: "junior_conversations";
186
- dataType: "string";
187
- columnType: "PgText";
188
- data: string;
189
- driverParam: string;
190
- notNull: false;
191
- hasDefault: false;
192
- isPrimaryKey: false;
193
- isAutoincrement: false;
194
- hasRuntimeDefault: false;
195
- enumValues: [string, ...string[]];
196
- baseColumn: never;
197
- identity: undefined;
198
- generated: undefined;
199
- }, {}, {}>;
200
183
  creatorIdentityId: import("drizzle-orm/pg-core").PgColumn<{
201
184
  name: "creator_identity_id";
202
185
  tableName: "junior_conversations";
@@ -231,8 +214,8 @@ export declare const schema: {
231
214
  identity: undefined;
232
215
  generated: undefined;
233
216
  }, {}, {}>;
234
- requester: import("drizzle-orm/pg-core").PgColumn<{
235
- name: "requester_json";
217
+ actor: import("drizzle-orm/pg-core").PgColumn<{
218
+ name: "actor_json";
236
219
  tableName: "junior_conversations";
237
220
  dataType: "json";
238
221
  columnType: "PgJsonb";
@@ -1,6 +1,6 @@
1
1
  import type { Destination } from "@sentry/junior-plugin-api";
2
2
  import type { ConversationPrivacy } from "@/chat/conversation-privacy";
3
- import { type StoredSlackRequester } from "@/chat/requester";
3
+ import { type StoredSlackActor } from "@/chat/actor";
4
4
  import type { JuniorSqlDatabase, JuniorSqlMigrationExecutor } from "@/chat/sql/db";
5
5
  import type { Conversation, ConversationExecution, ConversationSource, ConversationStore } from "../store";
6
6
  export declare class SqlStore implements ConversationStore {
@@ -19,7 +19,7 @@ export declare class SqlStore implements ConversationStore {
19
19
  conversationId: string;
20
20
  destination?: Destination;
21
21
  nowMs?: number;
22
- requester?: StoredSlackRequester;
22
+ actor?: StoredSlackActor;
23
23
  source?: ConversationSource;
24
24
  title?: string;
25
25
  visibility?: ConversationPrivacy;
@@ -31,7 +31,7 @@ export declare class SqlStore implements ConversationStore {
31
31
  destination?: Destination;
32
32
  execution: ConversationExecution;
33
33
  lastActivityAtMs: number;
34
- requester?: StoredSlackRequester;
34
+ actor?: StoredSlackActor;
35
35
  source?: ConversationSource;
36
36
  title?: string;
37
37
  updatedAtMs: number;
@@ -1,6 +1,6 @@
1
1
  import type { Destination } from "@sentry/junior-plugin-api";
2
2
  import type { ConversationPrivacy } from "@/chat/conversation-privacy";
3
- import type { StoredSlackRequester } from "@/chat/requester";
3
+ import type { StoredSlackActor } from "@/chat/actor";
4
4
  export type ConversationSource = "api" | "internal" | "local" | "plugin" | "resource_event" | "scheduler" | "slack";
5
5
  export type ConversationStatus = "awaiting_resume" | "failed" | "idle" | "pending" | "running";
6
6
  export interface ConversationExecution {
@@ -17,7 +17,7 @@ export interface Conversation {
17
17
  destination?: Destination;
18
18
  execution: ConversationExecution;
19
19
  lastActivityAtMs: number;
20
- requester?: StoredSlackRequester;
20
+ actor?: StoredSlackActor;
21
21
  schemaVersion: 1;
22
22
  source?: ConversationSource;
23
23
  title?: string;
@@ -42,7 +42,7 @@ export interface ConversationStore {
42
42
  conversationId: string;
43
43
  destination?: Destination;
44
44
  nowMs?: number;
45
- requester?: StoredSlackRequester;
45
+ actor?: StoredSlackActor;
46
46
  source?: ConversationSource;
47
47
  title?: string;
48
48
  /** Source-confirmed visibility from the current event's signal only. */
@@ -56,7 +56,7 @@ export interface ConversationStore {
56
56
  destination?: Destination;
57
57
  execution: ConversationExecution;
58
58
  lastActivityAtMs: number;
59
- requester?: StoredSlackRequester;
59
+ actor?: StoredSlackActor;
60
60
  source?: ConversationSource;
61
61
  title?: string;
62
62
  updatedAtMs: number;
@@ -6,8 +6,8 @@ declare const credentialSubjectBindingSchema: z.ZodObject<{
6
6
  signature: z.ZodString;
7
7
  }, z.core.$strict>;
8
8
  declare const credentialSystemActorSchema: z.ZodObject<{
9
- type: z.ZodLiteral<"system">;
10
- id: z.ZodString;
9
+ platform: z.ZodLiteral<"system">;
10
+ name: z.ZodString;
11
11
  }, z.core.$strict>;
12
12
  export declare const credentialSubjectSchema: z.ZodObject<{
13
13
  type: z.ZodLiteral<"user">;
@@ -27,8 +27,8 @@ export declare const credentialContextSchema: z.ZodUnion<readonly [z.ZodObject<{
27
27
  }, z.core.$strict>;
28
28
  }, z.core.$strict>, z.ZodObject<{
29
29
  actor: z.ZodObject<{
30
- type: z.ZodLiteral<"system">;
31
- id: z.ZodString;
30
+ platform: z.ZodLiteral<"system">;
31
+ name: z.ZodString;
32
32
  }, z.core.$strict>;
33
33
  subject: z.ZodOptional<z.ZodObject<{
34
34
  type: z.ZodLiteral<"user">;
@@ -58,7 +58,7 @@ export declare function createLogContextFromRequest(request: Request, context?:
58
58
  export declare function toSpanAttributes(context: LogContext): Record<string, string>;
59
59
  /** Attach filterable non-user context tags to Sentry. */
60
60
  export declare function setSentryTagsFromContext(context: LogContext): void;
61
- /** Bind requester identity to Sentry's native user fields. */
61
+ /** Bind actor identity to Sentry's native user fields. */
62
62
  export declare function setSentryUser(identity: SentryUserIdentity | undefined): void;
63
63
  /** Attach scoped Sentry context for isolated exception capture. */
64
64
  export declare function setSentryScopeContext(scope: Sentry.Scope, context: LogContext): void;
@@ -103,5 +103,5 @@ export declare function serializeGenAiAttribute(value: unknown, maxChars?: numbe
103
103
  */
104
104
  export declare function extractGenAiUsageSummary(...sources: unknown[]): AgentTurnUsage;
105
105
  /** Extract GenAI token usage attributes from AI provider usage metadata for tracing. */
106
- export declare function extractGenAiUsageAttributes(...sources: unknown[]): Partial<Record<"gen_ai.usage.input_tokens" | "gen_ai.usage.output_tokens" | "gen_ai.usage.cache_read.input_tokens" | "gen_ai.usage.cache_creation.input_tokens", number>>;
106
+ export declare function extractGenAiUsageAttributes(...sources: unknown[]): Partial<Record<"gen_ai.usage.input_tokens" | "gen_ai.usage.output_tokens" | "gen_ai.usage.input_tokens.cached" | "gen_ai.usage.input_tokens.cache_write" | "gen_ai.usage.total_tokens", number>>;
107
107
  export {};
@@ -1,5 +1,5 @@
1
1
  export declare const NO_REPLY_MARKER = "[[NO_REPLY]]";
2
- /** Detect the reserved marker so Slack side effects can intentionally complete without thread text. */
2
+ /** Detect the reserved marker for intentionally completing without thread text. */
3
3
  export declare function isNoReplyMarker(text: string): boolean;
4
4
  /** Detect marker leaks before publication strips or rejects them. */
5
5
  export declare function containsNoReplyMarker(text: string): boolean;
@@ -15,7 +15,7 @@ export type OAuthStatePayload = {
15
15
  scope?: string;
16
16
  };
17
17
  type OAuthFlowInput = {
18
- requesterId: string;
18
+ actorId: string;
19
19
  channelId?: string;
20
20
  destination?: Destination;
21
21
  source?: Source;
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  /** Permissive schema for durable Pi SDK messages whose content shape may evolve. */
3
3
  export declare const piMessageSchema: z.ZodPipe<z.ZodObject<{
4
4
  role: z.ZodString;
5
- }, 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, {
5
+ }, 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, {
6
6
  [x: string]: unknown;
7
7
  role: string;
8
8
  }>>;
@@ -12,7 +12,7 @@ export type PiMessage = z.output<typeof piMessageSchema>;
12
12
  export declare const piContentMessageSchema: z.ZodPipe<z.ZodObject<{
13
13
  content: z.ZodArray<z.ZodUnknown>;
14
14
  role: z.ZodString;
15
- }, 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, {
15
+ }, 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, {
16
16
  [x: string]: unknown;
17
17
  content: unknown[];
18
18
  role: string;
@@ -27,5 +27,20 @@ export declare function getTerminalAssistantMessages(messages: readonly unknown[
27
27
  export declare function trimTrailingAssistantMessages(messages: PiMessage[]): PiMessage[];
28
28
  /** Return whether Pi history already carries session bootstrap context. */
29
29
  export declare function hasRuntimeTurnContext(messages: PiMessage[]): boolean;
30
+ /**
31
+ * Reduce a runtime user-turn prompt to only the current turn's instruction.
32
+ *
33
+ * Live user prompts embed prior-thread context blocks (`<thread-transcript>`,
34
+ * `<recent-thread-messages>`, `<thread-compactions>`, `<thread-background>`) in
35
+ * the same message that carries the `<current-instruction>` block. Those blocks
36
+ * hold other participants' verbatim messages, so completed-run projections
37
+ * consumed by plugins must expose only the instruction authored by this turn's
38
+ * actor — otherwise per-entry provenance can be defeated by reading another
39
+ * user's text out of an instruction-authority entry. Prior thread context is
40
+ * projected separately as per-author context-authority entries, so dropping it
41
+ * here is non-lossy for plugins. This is projection-only; it never touches what
42
+ * the model sees during a live run.
43
+ */
44
+ export declare function instructionTextForProjection(text: string): string;
30
45
  /** Remove volatile runtime context before reusing messages as history. */
31
46
  export declare function stripRuntimeTurnContext(messages: PiMessage[]): PiMessage[];
@@ -3,7 +3,7 @@ import type { PluginPromptContributionContext } from "@/chat/plugins/prompt";
3
3
  import type { AnyToolDefinition } from "@/chat/tools/definition";
4
4
  import type { ToolRuntimeContext } from "@/chat/tools/types";
5
5
  import type { SandboxInstance } from "@/chat/sandbox/workspace";
6
- import type { Requester } from "@/chat/requester";
6
+ import type { Actor } from "@/chat/actor";
7
7
  /** Signal that a plugin intentionally denied a tool execution. */
8
8
  export declare class PluginHookDeniedError extends Error {
9
9
  constructor(message: string);
@@ -37,7 +37,7 @@ export declare function getPlugins(): PluginRegistration[];
37
37
  export declare function getPluginSystemPromptContributions(source: ToolRuntimeContext["source"]): Promise<PluginPromptContributionContext[]>;
38
38
  /** Collect request-scoped plugin prompt contributions. */
39
39
  export declare function getPluginUserPromptContributions(args: {
40
- context: Pick<ToolRuntimeContext, "conversationId" | "destination" | "requester" | "source" | "userText">;
40
+ context: Pick<ToolRuntimeContext, "conversationId" | "destination" | "actor" | "source" | "userText">;
41
41
  }): Promise<PluginPromptContributionContext[]>;
42
42
  /** Collect turn-scoped tools exposed by plugins. */
43
43
  export declare function getPluginTools(context: ToolRuntimeContext): Record<string, AnyToolDefinition>;
@@ -51,5 +51,7 @@ export declare function getPluginSlackConversationLink(conversationId: string):
51
51
  export declare function getPluginOperationalReports(nowMs: number, conversations: PluginConversations): Promise<PluginOperationalReport[]>;
52
52
  /** Create one runner over runtime hook plugins registered by the app. */
53
53
  export declare function createPluginHookRunner(input?: {
54
- requester?: Requester;
54
+ actor?: Actor;
55
+ /** Live getter for the run's committed instruction actors; see `multi-actor-runs.md`. */
56
+ actors?: () => Actor[];
55
57
  }): PluginHookRunner;
@@ -1,4 +1,4 @@
1
- import { type PluginCredentialResult, type PluginGrant, type PluginProviderAccount } from "@sentry/junior-plugin-api";
1
+ import { type PluginCredentialActor, type PluginCredentialResult, type PluginGrant, type PluginProviderAccount } from "@sentry/junior-plugin-api";
2
2
  import type { StoredTokens, UserTokenStore } from "@/chat/credentials/user-token-store";
3
3
  export interface EgressGrantInput {
4
4
  bodyText?: string;
@@ -31,13 +31,7 @@ export declare function onPluginEgressResponse(input: EgressResponseInput): Prom
31
31
  /** Return whether a plugin owns credential issuance for egress. */
32
32
  export declare function hasEgressCredentialHooks(provider: string): boolean;
33
33
  export interface IssueCredentialInput {
34
- actor: {
35
- type: "system";
36
- id: string;
37
- } | {
38
- type: "user";
39
- userId: string;
40
- };
34
+ actor: PluginCredentialActor;
41
35
  credentialSubject?: {
42
36
  type: "user";
43
37
  userId: string;
@@ -3,7 +3,7 @@ import type { ThreadArtifactsState } from "@/chat/state/artifacts";
3
3
  import type { SkillMetadata, SkillInvocation } from "@/chat/skills";
4
4
  import type { ActiveMcpCatalogSummary } from "@/chat/tool-support/skill/mcp-tool-summary";
5
5
  import type { PluginPromptContributionContext } from "@/chat/plugins/prompt";
6
- import type { Destination, Source } from "@sentry/junior-plugin-api";
6
+ import type { Destination, Source, SystemActor } from "@sentry/junior-plugin-api";
7
7
  export declare const JUNIOR_PERSONALITY: string;
8
8
  export declare const JUNIOR_WORLD: string | null;
9
9
  interface ToolPromptContext {
@@ -24,17 +24,14 @@ type TurnContextPromptInput = {
24
24
  slackConversation?: SlackConversationContext;
25
25
  };
26
26
  dispatch?: {
27
- actor?: {
28
- id: string;
29
- type: string;
30
- };
27
+ actor?: SystemActor;
31
28
  destination: Destination;
32
29
  metadata?: Record<string, string>;
33
30
  plugin?: string;
34
31
  source: Source;
35
32
  };
36
33
  invocation: SkillInvocation | null;
37
- requester?: {
34
+ actor?: {
38
35
  userName?: string;
39
36
  fullName?: string;
40
37
  userId?: string;
@@ -27,7 +27,7 @@ interface ReplyExecutorDeps {
27
27
  getSlackAdapter: () => SlackAdapter;
28
28
  resolveUserAttachments: (attachments: Message["attachments"] | undefined, context: {
29
29
  threadId?: string;
30
- requesterId?: string;
30
+ actorId?: string;
31
31
  channelId?: string;
32
32
  runId?: string;
33
33
  conversation?: PreparedTurnState["conversation"];
@@ -1,7 +1,7 @@
1
1
  import type { Message, Thread } from "chat";
2
2
  export interface TurnContext {
3
3
  channelId?: string;
4
- requesterId?: string;
4
+ actorId?: string;
5
5
  threadId?: string;
6
6
  runId?: string;
7
7
  }
@@ -13,8 +13,8 @@ export declare const sandboxEgressCredentialContextSchema: z.ZodObject<{
13
13
  }, z.core.$strict>;
14
14
  }, z.core.$strict>, z.ZodObject<{
15
15
  actor: z.ZodObject<{
16
- type: z.ZodLiteral<"system">;
17
- id: z.ZodString;
16
+ platform: z.ZodLiteral<"system">;
17
+ name: z.ZodString;
18
18
  }, z.core.$strict>;
19
19
  subject: z.ZodOptional<z.ZodObject<{
20
20
  type: z.ZodLiteral<"user">;
@@ -5,7 +5,7 @@ export type { SandboxEgressAuthRequiredSignal, SandboxEgressCredentialContext, S
5
5
  /**
6
6
  * Create the signed Junior credential context embedded in the proxy URL.
7
7
  *
8
- * The token binds requester credentials to a specific sandbox egress id and a
8
+ * The token binds actor credentials to a specific sandbox egress id and a
9
9
  * short expiry. Vercel OIDC proves which VM sent a request; this token proves
10
10
  * which Junior actor and credential context that VM is allowed to use.
11
11
  */