@sentry/junior-plugin-api 0.180.0 → 0.181.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.
package/README.md CHANGED
@@ -62,14 +62,12 @@ reports, and other typed hook surfaces exported by this package.
62
62
  - Profile report hooks return the same bounded operational report content for
63
63
  one subject user on a person profile. Core owns viewer authorization,
64
64
  collection, sanitization, and browser rendering.
65
- - Tool hooks may lazily resolve the active actor's canonical identity and linked
66
- user through `ctx.users.resolveActor()`.
65
+ - Tool hooks may resolve the active Actor's Identity and User through
66
+ `ctx.users.resolveActor()`.
67
67
  - Authenticated API route hooks receive `ctx.users.resolve(email)` for lazy
68
- canonical user resolution. Routes that do not need personal ownership do not
69
- query identity storage.
70
- - User page readers receive the canonical viewer `User` with linked identities.
71
- Plugins return bounded data and do not mount their own page routes or browser
72
- code.
68
+ User lookup. Routes that do not need User data do not query identity storage.
69
+ - User page readers receive the signed-in `User`. Plugins return limited data.
70
+ They do not mount their own page routes or browser code.
73
71
 
74
72
  ## User Pages
75
73
 
package/dist/context.d.ts CHANGED
@@ -74,6 +74,8 @@ interface BaseInvocationContext {
74
74
  * Interactive Slack turns use `slack:{channelId}:{threadTs}`.
75
75
  */
76
76
  conversationId?: string;
77
+ /** Location associated with this Conversation. */
78
+ locationId?: string;
77
79
  }
78
80
  export interface SlackInvocationContext extends BaseInvocationContext {
79
81
  /** Runtime-owned default outbound destination for this invocation. */
package/dist/index.js CHANGED
@@ -479,9 +479,13 @@ var pluginRunTranscriptEntrySchema = z6.discriminatedUnion("type", [
479
479
  }).strict()
480
480
  ]);
481
481
  var pluginRunContextSchema = z6.object({
482
+ /** User linked to the Actor, when known. */
483
+ actorUserId: z6.string().min(1).optional(),
482
484
  completedAtMs: z6.number().finite(),
483
485
  conversationId: z6.string().min(1),
484
486
  destination: destinationSchema,
487
+ /** Location associated with this Conversation. */
488
+ locationId: z6.string().min(1).optional(),
485
489
  /**
486
490
  * All distinct actors annotated on this run's committed instruction-authority
487
491
  * messages, in first-seen order. Attribution provenance only, never an
package/dist/prompt.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { Destination, Platform, PluginContext, PluginEmbedder, PluginModel, Actor, Source } from "./context";
2
+ import type { Destination, Platform, PluginContext, PluginEmbedder, PluginModel, Actor, Identity, Source, User } from "./context";
3
3
  import type { PluginState } from "./state";
4
4
  import type { PluginConversationEvents } from "./conversation-events";
5
5
  export declare const promptMessageSchema: z.ZodObject<{
@@ -40,8 +40,17 @@ export type UserPromptContext = Pick<PluginContext, "db" | "log" | "plugin"> & {
40
40
  /** Conversation-bound event writer when the prompt belongs to a durable turn. */
41
41
  events?: PluginConversationEvents;
42
42
  model: PluginModel;
43
+ /** Location associated with this Conversation. */
44
+ locationId?: string;
43
45
  actor?: Actor;
44
46
  source: Source;
45
47
  state: PluginState;
46
48
  text: string;
49
+ users: {
50
+ /** Resolve the current Actor's Identity and User. */
51
+ resolveActor(): Promise<{
52
+ identity: Identity;
53
+ user?: User;
54
+ } | undefined>;
55
+ };
47
56
  };
package/dist/tasks.d.ts CHANGED
@@ -89,6 +89,7 @@ export declare const pluginRunTranscriptEntrySchema: z.ZodDiscriminatedUnion<[z.
89
89
  export type PluginRunTranscriptProvenance = z.output<typeof pluginRunTranscriptProvenanceSchema>;
90
90
  /** Runtime-owned completed-run projection exposed to plugin tasks. */
91
91
  export declare const pluginRunContextSchema: z.ZodObject<{
92
+ actorUserId: z.ZodOptional<z.ZodString>;
92
93
  completedAtMs: z.ZodNumber;
93
94
  conversationId: z.ZodString;
94
95
  destination: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -99,6 +100,7 @@ export declare const pluginRunContextSchema: z.ZodObject<{
99
100
  platform: z.ZodLiteral<"local">;
100
101
  conversationId: z.ZodString;
101
102
  }, z.core.$strict>], "platform">;
103
+ locationId: z.ZodOptional<z.ZodString>;
102
104
  actors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
103
105
  platform: z.ZodLiteral<"slack">;
104
106
  teamId: z.ZodString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-plugin-api",
3
- "version": "0.180.0",
3
+ "version": "0.181.1",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
package/src/context.ts CHANGED
@@ -83,6 +83,8 @@ interface BaseInvocationContext {
83
83
  * Interactive Slack turns use `slack:{channelId}:{threadTs}`.
84
84
  */
85
85
  conversationId?: string;
86
+ /** Location associated with this Conversation. */
87
+ locationId?: string;
86
88
  }
87
89
 
88
90
  export interface SlackInvocationContext extends BaseInvocationContext {
package/src/prompt.ts CHANGED
@@ -6,7 +6,9 @@ import type {
6
6
  PluginEmbedder,
7
7
  PluginModel,
8
8
  Actor,
9
+ Identity,
9
10
  Source,
11
+ User,
10
12
  } from "./context";
11
13
  import type { PluginState } from "./state";
12
14
  import type { PluginConversationEvents } from "./conversation-events";
@@ -84,8 +86,14 @@ export type UserPromptContext = Pick<PluginContext, "db" | "log" | "plugin"> & {
84
86
  /** Conversation-bound event writer when the prompt belongs to a durable turn. */
85
87
  events?: PluginConversationEvents;
86
88
  model: PluginModel;
89
+ /** Location associated with this Conversation. */
90
+ locationId?: string;
87
91
  actor?: Actor;
88
92
  source: Source;
89
93
  state: PluginState;
90
94
  text: string;
95
+ users: {
96
+ /** Resolve the current Actor's Identity and User. */
97
+ resolveActor(): Promise<{ identity: Identity; user?: User } | undefined>;
98
+ };
91
99
  };
package/src/schemas.ts CHANGED
@@ -149,6 +149,8 @@ export const systemActorSchema = z
149
149
  })
150
150
  .strict();
151
151
 
152
+ // TODO(dcramer): Separate actor kind from provider platform.
153
+ // System actors should not use `platform: "system"`.
152
154
  /** Runtime-provided actor identity visible to plugin hooks. */
153
155
  export const actorSchema = z.discriminatedUnion("platform", [
154
156
  slackActorSchema,
package/src/tasks.ts CHANGED
@@ -50,9 +50,13 @@ export type PluginRunTranscriptProvenance = z.output<
50
50
  /** Runtime-owned completed-run projection exposed to plugin tasks. */
51
51
  export const pluginRunContextSchema = z
52
52
  .object({
53
+ /** User linked to the Actor, when known. */
54
+ actorUserId: z.string().min(1).optional(),
53
55
  completedAtMs: z.number().finite(),
54
56
  conversationId: z.string().min(1),
55
57
  destination: destinationSchema,
58
+ /** Location associated with this Conversation. */
59
+ locationId: z.string().min(1).optional(),
56
60
  /**
57
61
  * All distinct actors annotated on this run's committed instruction-authority
58
62
  * messages, in first-seen order. Attribution provenance only, never an