@sentry/junior-plugin-api 0.258.0 → 0.260.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.
package/README.md CHANGED
@@ -48,6 +48,12 @@ reports, and other typed hook surfaces exported by this package.
48
48
  - Prompt hooks return bounded structured prompt messages rather than mutate the
49
49
  core prompt.
50
50
  - `formatMarkdown` is a pure text rewrite into ordinary Markdown before delivery.
51
+ - `conversationTitleContext` returns short facts about objects that the first
52
+ human message refers to, such as an issue number and title. The hook gets the
53
+ plugin's config values, such as a default repository. It must read provider
54
+ data through `ctx.egress`, which uses Junior's system identity and never
55
+ starts authorization. Only the title model sees the facts. Junior bounds the
56
+ wait and ignores a failed hook.
51
57
  - User prompt hooks for durable turns may emit registered structured events
52
58
  through `ctx.events` for auxiliary work completed while building context.
53
59
  - Tool hooks return model-visible schemas aligned with their executor inputs.
package/dist/index.d.ts CHANGED
@@ -1164,6 +1164,12 @@ export declare const eventInputSchema: z.ZodObject<{
1164
1164
  }, z.core.$strict>, z.ZodObject<{
1165
1165
  email: z.ZodString;
1166
1166
  }, z.core.$strict>]>>>;
1167
+ doneBy: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
1168
+ provider: z.ZodString;
1169
+ handle: z.ZodString;
1170
+ }, z.core.$strict>, z.ZodObject<{
1171
+ email: z.ZodString;
1172
+ }, z.core.$strict>]>>;
1167
1173
  }, z.core.$strict>;
1168
1174
  export type EventData = z.output<typeof eventDataSchema>;
1169
1175
  export type EventInput = z.output<typeof eventInputSchema>;
@@ -1190,6 +1196,12 @@ export declare const eventSchema: z.ZodObject<{
1190
1196
  }, z.core.$strict>, z.ZodObject<{
1191
1197
  email: z.ZodString;
1192
1198
  }, z.core.$strict>]>>>;
1199
+ doneBy: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
1200
+ provider: z.ZodString;
1201
+ handle: z.ZodString;
1202
+ }, z.core.$strict>, z.ZodObject<{
1203
+ email: z.ZodString;
1204
+ }, z.core.$strict>]>>;
1193
1205
  namespace: z.ZodString;
1194
1206
  }, z.core.$strict>;
1195
1207
  export type Event = z.output<typeof eventSchema>;
@@ -2227,7 +2239,30 @@ export declare function enforceEgressPolicy(input: {
2227
2239
  export interface FormatMarkdownHookContext {
2228
2240
  text: string;
2229
2241
  }
2242
+ /** First human message of a new Conversation, given before title generation. */
2243
+ export interface ConversationTitleContextHookContext extends PluginContext {
2244
+ /**
2245
+ * String config values of this plugin for the Conversation's Location, by
2246
+ * short key. For example, `repo` for the `github.repo` config key.
2247
+ */
2248
+ config: Record<string, string>;
2249
+ /**
2250
+ * Host-owned provider egress for title reads. It uses Junior's system
2251
+ * identity, so it never uses a user's credentials or starts authorization.
2252
+ */
2253
+ egress: PluginEgress;
2254
+ /** Ends the hook when the host stops waiting for title context. */
2255
+ signal: AbortSignal;
2256
+ text: string;
2257
+ }
2230
2258
  export interface PluginHooks {
2259
+ /**
2260
+ * Return short facts that help name a new Conversation, such as
2261
+ * `owner/repo#123: Issue title` for a linked issue. Junior shows these facts
2262
+ * only to the title model. Return nothing when the message has no known
2263
+ * objects.
2264
+ */
2265
+ conversationTitleContext?(ctx: ConversationTitleContextHookContext): Promise<string[] | undefined> | string[] | undefined;
2231
2266
  conversationSidebar?(ctx: ConversationSidebarHookContext): Promise<ConversationSidebarResult> | ConversationSidebarResult;
2232
2267
  systemPrompt?(ctx: SystemPromptContext): Promise<PromptMessage[]> | PromptMessage[];
2233
2268
  userPrompt?(ctx: UserPromptContext): Promise<UserPromptContribution[] | undefined> | UserPromptContribution[] | undefined;
@@ -2380,11 +2415,39 @@ export interface PluginMcpConfig {
2380
2415
  /** Provider tools hidden from the model and callable only by plugin-owned wrapper tools. */
2381
2416
  wrappedTools?: string[];
2382
2417
  }
2418
+ /**
2419
+ * Which provider accounts Junior may use for one plugin.
2420
+ *
2421
+ * By default, each Actor connects their own account with per-actor OAuth.
2422
+ * A plugin can also allow an optional install-wide service account, often a
2423
+ * bot. An Admin connects it one time on the dashboard Admin page.
2424
+ *
2425
+ * An Actor's own connection always wins. An Actor without their own
2426
+ * connection uses the service account for what it lists. Other requests ask
2427
+ * the Actor to connect their own account.
2428
+ *
2429
+ * With `userOAuth: false`, Junior uses only the service account. It never
2430
+ * asks an Actor to connect, ignores their own connections, and hides tools
2431
+ * that the service account does not list. Until an Admin connects the
2432
+ * account, the plugin is not available.
2433
+ */
2434
+ export interface PluginAccountsConfig {
2435
+ /** Set false to turn off per-actor OAuth for the plugin. Defaults to true. */
2436
+ userOAuth?: boolean;
2437
+ /** Optional service account and what it may use. Omit for none. */
2438
+ serviceAccount?: PluginServiceAccountConfig;
2439
+ }
2440
+ /** What one plugin's service account may use. */
2441
+ export interface PluginServiceAccountConfig {
2442
+ /** MCP tools that the account may call. Each must be loaded by `mcp`. */
2443
+ tools: string[];
2444
+ }
2383
2445
  export interface PluginEnvVarDeclaration {
2384
2446
  default?: string;
2385
2447
  exposeToCommandEnv?: boolean;
2386
2448
  }
2387
2449
  export interface PluginManifest {
2450
+ accounts?: PluginAccountsConfig;
2388
2451
  apiHeaders?: Record<string, string>;
2389
2452
  commandEnv?: Record<string, string>;
2390
2453
  configKeys?: string[];
package/dist/index.js CHANGED
@@ -847,7 +847,13 @@ const eventInputSchema = z.object({
847
847
  data: eventDataSchema.optional(),
848
848
  untrustedText: z.string().transform((value) => value.slice(0, EVENT_TEXT_MAX_LENGTH)).optional(),
849
849
  /** People involved in the change. Watch Events list them as mentions. */
850
- people: z.array(eventPersonSchema).max(20).optional()
850
+ people: z.array(eventPersonSchema).max(20).optional(),
851
+ /**
852
+ * The person who did what the Event describes, such as a reviewer or a
853
+ * commenter. Core resolves them like `people`, so the agent knows when a
854
+ * mention and a provider name are the same person.
855
+ */
856
+ doneBy: eventPersonSchema.optional()
851
857
  }).strict();
852
858
  const eventSchema = eventInputSchema.extend({ namespace: z.string().min(1) });
853
859
  // src/tasks.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-plugin-api",
3
- "version": "0.258.0",
3
+ "version": "0.260.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"