@sentry/junior-plugin-api 0.271.0 → 0.273.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/dist/index.d.ts CHANGED
@@ -9,7 +9,8 @@ import { Command } from "commander";
9
9
  * selects the fields it needs; preview rules must not remove saved facts.
10
10
  *
11
11
  * Keep raw responses, diffs, logs, credentials, and comments out of this schema.
12
- * See "Object annotations and Message cards" in packages/junior/src/chat/conversations/AGENTS.md.
12
+ * Return only facts that the Conversation audience may see. An annotation
13
+ * never grants provider access.
13
14
  */
14
15
  export declare const objectAnnotationSchema: z.ZodObject<{
15
16
  kind: z.ZodLiteral<"object">;
@@ -615,6 +616,18 @@ export interface PluginEmbedder {
615
616
  vectors: number[][];
616
617
  }>;
617
618
  }
619
+ export interface PluginReranker {
620
+ /** Score plugin-owned documents against one query without exposing provider credentials. */
621
+ rerank(input: {
622
+ documents: string[];
623
+ query: string;
624
+ }): Promise<{
625
+ /** Best-effort provider cost for this reranking call. */
626
+ costUsd?: number;
627
+ /** One relevance score per document, in input order. Higher is more relevant. */
628
+ scores: number[];
629
+ }>;
630
+ }
618
631
  export interface PluginContext {
619
632
  /** Short-lived cache scoped to this plugin. */
620
633
  cache: PluginCache;
@@ -1030,6 +1043,14 @@ type UserPromptContext = Pick<PluginContext, "db" | "log" | "plugin"> & {
1030
1043
  /** Conversation-bound event writer when the prompt belongs to a durable turn. */
1031
1044
  events?: PluginConversationEvents;
1032
1045
  model: PluginModel;
1046
+ /** Host reranker bound to the configured reranking model. */
1047
+ reranker: PluginReranker;
1048
+ /**
1049
+ * Record numeric diagnostics on the host span for this hook. Keys must
1050
+ * start with `app.<plugin name>.`; the host drops other keys and
1051
+ * non-finite values.
1052
+ */
1053
+ setSpanAttributes(attributes: Record<string, number>): void;
1033
1054
  /** Location associated with this Conversation. */
1034
1055
  locationId?: string;
1035
1056
  actor?: Actor;
@@ -1232,6 +1253,7 @@ export declare function normalizeEventIdentifier(registration: Pick<PluginEvents
1232
1253
  export declare const subscribableResourceSchema: z.ZodObject<{
1233
1254
  identifier: z.ZodString;
1234
1255
  label: z.ZodString;
1256
+ match: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>]>>>;
1235
1257
  namespace: z.ZodString;
1236
1258
  suggestedEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
1237
1259
  supportedEvents: z.ZodArray<z.ZodString>;
package/dist/index.js CHANGED
@@ -157,7 +157,8 @@ function objectIconPath(icon) {
157
157
  * selects the fields it needs; preview rules must not remove saved facts.
158
158
  *
159
159
  * Keep raw responses, diffs, logs, credentials, and comments out of this schema.
160
- * See "Object annotations and Message cards" in packages/junior/src/chat/conversations/AGENTS.md.
160
+ * Return only facts that the Conversation audience may see. An annotation
161
+ * never grants provider access.
161
162
  */
162
163
  const objectAnnotationSchema = z.object({
163
164
  kind: z.literal("object"),
@@ -983,6 +984,12 @@ function normalizeEventIdentifier(registration, identifier) {
983
984
  const subscribableResourceSchema = z.object({
984
985
  identifier: z.string().min(1),
985
986
  label: z.string().min(1),
987
+ /**
988
+ * Filters that select the events of this resource in an event automation
989
+ * trigger, such as `{ repo, pullRequest }`. A Watch uses `identifier`.
990
+ * Missing when event automations cannot use this resource.
991
+ */
992
+ match: eventMatchSchema.optional(),
986
993
  namespace: z.string().min(1),
987
994
  suggestedEvents: z.array(eventTypeSchema).optional(),
988
995
  supportedEvents: z.array(eventTypeSchema),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-plugin-api",
3
- "version": "0.271.0",
3
+ "version": "0.273.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"