@sentry/junior-plugin-api 0.294.0 → 0.296.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
@@ -1804,9 +1804,15 @@ export declare const pluginStoredTokensSchema: z.ZodObject<{
1804
1804
  refreshTokenExpiresAt: z.ZodOptional<z.ZodNumber>;
1805
1805
  scope: z.ZodOptional<z.ZodString>;
1806
1806
  }, z.core.$strict>;
1807
+ /**
1808
+ * Provider facts for egress audit events, such as the target repository.
1809
+ * Keys use the plugin's `app.<provider>.*` names. Telemetry only.
1810
+ */
1811
+ export declare const pluginAuditAttributesSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
1807
1812
  /** Runtime schema for a plugin-defined outbound credential grant. */
1808
1813
  export declare const pluginGrantSchema: z.ZodObject<{
1809
1814
  access: z.ZodUnion<readonly [z.ZodLiteral<"read">, z.ZodLiteral<"write">]>;
1815
+ auditAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString>]>>>;
1810
1816
  leaseScope: z.ZodOptional<z.ZodString>;
1811
1817
  name: z.ZodString;
1812
1818
  reason: z.ZodOptional<z.ZodString>;
@@ -1887,18 +1893,102 @@ export declare class EgressAuthRequired extends Error {
1887
1893
  }
1888
1894
  /** Deny provider egress before Junior issues credentials for a disallowed operation. */
1889
1895
  export declare class EgressPolicyDenied extends Error {
1896
+ /** Provider facts for the policy denial event. */
1897
+ readonly auditAttributes?: PluginAuditAttributes;
1890
1898
  constructor(message: string, options?: {
1899
+ auditAttributes?: PluginAuditAttributes;
1891
1900
  cause?: unknown;
1892
1901
  });
1893
1902
  }
1903
+ /** Provider facts for egress audit events. */
1904
+ export type PluginAuditAttributes = z.output<typeof pluginAuditAttributesSchema>;
1894
1905
  /** Provider account identity resolved by a plugin OAuth hook. */
1895
1906
  export type PluginProviderAccount = z.output<typeof pluginProviderAccountSchema>;
1896
1907
  /** Plugin-defined grant required before Junior can forward one outbound request. */
1897
1908
  export type PluginGrant = z.output<typeof pluginGrantSchema>;
1909
+ /** One ref update command in a Git push. */
1910
+ export interface PluginGitRefUpdate {
1911
+ /** True when the push deletes the ref: its new object id is all zeros. */
1912
+ deletes: boolean;
1913
+ /** Full ref name, such as `refs/heads/main`. */
1914
+ ref: string;
1915
+ }
1916
+ /** Why the host could not read the ref updates of a Git push. */
1917
+ export type PluginGitPushUnreadableReason = "gzip" | "malformed" | "signed" | "unterminated";
1918
+ /**
1919
+ * Ref updates of a Git smart HTTP push (`git-receive-pack`), which the host
1920
+ * reads from the body before the pack data. An `unreadable` push changes
1921
+ * refs that the host cannot name.
1922
+ */
1923
+ export type PluginGitPush = {
1924
+ kind: "commands";
1925
+ updates: PluginGitRefUpdate[];
1926
+ } | {
1927
+ kind: "unreadable";
1928
+ reason: PluginGitPushUnreadableReason;
1929
+ };
1930
+ /** One field that a GraphQL operation selects. */
1931
+ export interface PluginGraphqlField {
1932
+ /** Names of the arguments that the field passes. */
1933
+ arguments: string[];
1934
+ /** Schema field name. An alias does not replace it. */
1935
+ name: string;
1936
+ }
1937
+ /** The GraphQL operation that one request runs. */
1938
+ export interface PluginGraphqlOperation {
1939
+ /**
1940
+ * Each distinct field that the operation selects at any depth, also through
1941
+ * fragments.
1942
+ */
1943
+ fields: PluginGraphqlField[];
1944
+ name?: string;
1945
+ /**
1946
+ * Field names at the operation root, also through fragments. There is one
1947
+ * entry for each field selection, so an aliased repeat shows twice.
1948
+ */
1949
+ rootFields: string[];
1950
+ type: "mutation" | "query" | "subscription";
1951
+ }
1952
+ /**
1953
+ * Why the host could not read the operation of a GraphQL request:
1954
+ *
1955
+ * - `document`: the query does not parse, or it spreads a fragment that it
1956
+ * does not define.
1957
+ * - `gzip`: the body is compressed.
1958
+ * - `json`: the body is not a JSON object or a JSON array of objects.
1959
+ * - `operation`: `operationName` names no operation, or the document has more
1960
+ * than one operation and no `operationName`.
1961
+ * - `query`: the body has no `query` string, such as a persisted query hash.
1962
+ * - `too-large`: the body is larger than the host reads before it issues
1963
+ * credentials.
1964
+ */
1965
+ export type PluginGraphqlUnreadableReason = "document" | "gzip" | "json" | "operation" | "query" | "too-large";
1966
+ /**
1967
+ * The operations of a GraphQL POST, which the host reads from the JSON body.
1968
+ * A `batch` is a JSON array of requests. An `unreadable` request can run any
1969
+ * operation, mutations included.
1970
+ */
1971
+ export type PluginGraphqlRequest = {
1972
+ kind: "batch";
1973
+ operations: PluginGraphqlOperation[];
1974
+ } | {
1975
+ kind: "operation";
1976
+ operation: PluginGraphqlOperation;
1977
+ } | {
1978
+ kind: "unreadable";
1979
+ reason: PluginGraphqlUnreadableReason;
1980
+ };
1898
1981
  /** Request details available while selecting the grant for sandbox egress. */
1899
1982
  export interface PluginEgressRequest {
1900
- /** Capped request body text when the host exposes it for provider-specific grant classification. */
1983
+ /**
1984
+ * Capped request body text when the host exposes it for provider-specific
1985
+ * grant classification.
1986
+ */
1901
1987
  bodyText?: string;
1988
+ /** Set for every Git `git-receive-pack` POST. */
1989
+ gitPush?: PluginGitPush;
1990
+ /** Set for every POST to a URL path that ends in `/graphql`. */
1991
+ graphql?: PluginGraphqlRequest;
1902
1992
  method: string;
1903
1993
  /** Plugin-declared operation this request performs, used for grant classification and diagnostics. */
1904
1994
  operation?: string;
@@ -1916,7 +2006,7 @@ export interface PluginEgressResponse {
1916
2006
  export interface EgressResponseHookContext extends PluginContext {
1917
2007
  grant: PluginGrant;
1918
2008
  permissionDenied(message: string): void;
1919
- request: Omit<PluginEgressRequest, "bodyText">;
2009
+ request: Omit<PluginEgressRequest, "bodyText" | "gitPush" | "graphql">;
1920
2010
  response: PluginEgressResponse;
1921
2011
  }
1922
2012
  /** Header mutations a plugin-issued credential lease may apply to owned domains. */
@@ -1961,7 +2051,10 @@ export interface IssueCredentialHookContext extends PluginContext {
1961
2051
  grant: PluginGrant;
1962
2052
  tokens: PluginTokenStore;
1963
2053
  }
1964
- /** A notice that a plugin puts on the review desk. */
2054
+ /**
2055
+ * An item that a plugin puts on the review desk: a notice for information,
2056
+ * or an ask that waits on its assignees.
2057
+ */
1965
2058
  export interface PluginReviewNotice {
1966
2059
  /**
1967
2060
  * Junior assigns the User linked to each Identity, but only when that User
@@ -1981,7 +2074,18 @@ export interface PluginReviewNotice {
1981
2074
  title?: string;
1982
2075
  url?: string;
1983
2076
  };
2077
+ /**
2078
+ * For an item that waits on its assignees, name their step, such as
2079
+ * `Ready to merge · #946`. It is the reason that the dashboard shows.
2080
+ */
1984
2081
  title: string;
2082
+ /**
2083
+ * The assignees must act, such as merge a pull request that is ready. The
2084
+ * item then waits on them: its Conversation shows in their Needs you, and
2085
+ * it counts in their Inbox. Leave it unset for a notice that is only for
2086
+ * information.
2087
+ */
2088
+ waitsOnAssignees?: boolean;
1985
2089
  }
1986
2090
  /**
1987
2091
  * Review items that a plugin adds and closes from its own events. Each item
@@ -1989,7 +2093,7 @@ export interface PluginReviewNotice {
1989
2093
  * the Slack cards.
1990
2094
  */
1991
2095
  export interface PluginReviewItems {
1992
- /** Add an open notice, or replace the content of the open one with the key. */
2096
+ /** Add an open item, or replace the content of the open one with the key. */
1993
2097
  upsert(notice: PluginReviewNotice): Promise<void>;
1994
2098
  /** Close the open item with the key. Do nothing when no item is open. */
1995
2099
  close(input: {
@@ -2915,8 +3019,6 @@ export interface PluginMcpConfig {
2915
3019
  url: string;
2916
3020
  /** Provider tools hidden from the model and callable only by plugin-owned wrapper tools. */
2917
3021
  wrappedTools?: string[];
2918
- /** Provider tools whose successful calls Junior records as audit events. */
2919
- auditTools?: string[];
2920
3022
  }
2921
3023
  /**
2922
3024
  * Which provider accounts Junior may use for one plugin.
package/dist/index.js CHANGED
@@ -1513,9 +1513,20 @@ const pluginStoredTokensSchema = z.object({
1513
1513
  refreshTokenExpiresAt: z.number().finite().optional(),
1514
1514
  scope: nonBlankStringSchema.optional()
1515
1515
  }).strict();
1516
+ /**
1517
+ * Provider facts for egress audit events, such as the target repository.
1518
+ * Keys use the plugin's `app.<provider>.*` names. Telemetry only.
1519
+ */
1520
+ const pluginAuditAttributesSchema = z.record(z.string().regex(/^app\.[a-z0-9_]+(?:\.[a-z0-9_]+)+$/), z.union([
1521
+ z.string(),
1522
+ z.boolean(),
1523
+ z.array(z.string())
1524
+ ]));
1516
1525
  /** Runtime schema for a plugin-defined outbound credential grant. */
1517
1526
  const pluginGrantSchema = z.object({
1518
1527
  access: pluginGrantAccessSchema,
1528
+ /** Provider facts for the write audit event. */
1529
+ auditAttributes: pluginAuditAttributesSchema.optional(),
1519
1530
  leaseScope: nonBlankStringSchema.optional(),
1520
1531
  name: pluginGrantNameSchema,
1521
1532
  reason: nonBlankStringSchema.optional(),
@@ -1560,9 +1571,12 @@ var EgressAuthRequired = class extends Error {
1560
1571
  };
1561
1572
  /** Deny provider egress before Junior issues credentials for a disallowed operation. */
1562
1573
  var EgressPolicyDenied = class extends Error {
1574
+ /** Provider facts for the policy denial event. */
1575
+ auditAttributes;
1563
1576
  constructor(message, options) {
1564
1577
  super(message, { cause: options?.cause });
1565
1578
  this.name = "EgressPolicyDenied";
1579
+ if (options?.auditAttributes) this.auditAttributes = options.auditAttributes;
1566
1580
  }
1567
1581
  };
1568
1582
  // src/egress-policy.ts
@@ -1819,4 +1833,4 @@ const pluginUserPageInputSchema = z.object({
1819
1833
  limit: z.number().int().min(1).max(50),
1820
1834
  query: pluginUserPageQuerySchema
1821
1835
  }).strict();
1822
- export { EVENT_DATA_MAX_JSON_BYTES, EVENT_DATA_MAX_KEYS, EVENT_GUIDANCE_MAX_LENGTH, EVENT_SUMMARY_MAX_LENGTH, EVENT_TEXT_MAX_LENGTH, EgressAuthRequired, EgressPolicyDenied, PluginToolInputError, REQUIRED_TOOL_ANNOTATION_KEYS, actorSchema, actorUserIdSchema, agentEventKeys, agentEventMatchKey, agentEventMatchSchema, agentInvocationSourceSchema, anyResourceEvents, anyResourceMatchFields, codeChangeInputSchema, codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventIconSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, conversationSidebarIconSchema, createEventSource, createLocalSource, createSlackSource, createWebSource, declaredEventKeys, defineConversationEvent, defineJuniorPlugin, definePluginTool, definePromptContext, describeEventTrigger, destinationSchema, destinationVisibilitySchema, dispatchOptionsSchema, enforceEgressPolicy, eventAutomationSourceSchema, eventDataSchema, eventIdentifierSchema, eventInputSchema, eventMatchFieldSchema, eventMatchFieldsSchema, eventMatchFilterText, eventMatchSchema, eventMatches, eventPersonSchema, eventReachSchema, eventSchema, eventSourceSchema, eventTriggerChoices, eventTriggerFiltersText, eventTriggerProblems, eventTriggerText, eventTypeSchema, eventTypeText, eventsWithoutMatchField, getSourceKey, identitySchema, isPluginModelCostEventName, isPrivateSource, isSlackDestination, localActorSchema, localDestinationSchema, localSourceSchema, locationSchema, mergeEventMatchFields, missingToolAnnotationKeys, nonBlankStringSchema, normalizeEventIdentifier, normalizeEventMatch, objectAnnotationSchema, objectFactFields, objectFactsSchema, objectIconPath, objectIconPaths, objectPresentation, objectTypeSchema, ownedObjectAnnotationSchema, parseShellCommands, platformSchema, pluginApiRouteRequestContextSchema, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialLeaseSchema, pluginCredentialResultSchema, pluginCredentialSubjectSchema, pluginDispatchSourceSchema, pluginEventDeclarationSchema, pluginEventTypeSchema, pluginEventsSchema, pluginGrantSchema, pluginModelCostEventNames, pluginProviderAccountSchema, pluginRunContextSchema, pluginRunTranscriptEntrySchema, pluginRunTranscriptProvenanceSchema, pluginStoredTokensSchema, pluginToolContentSchema, pluginToolContinuationSchema, pluginToolOutputSchema, pluginToolReplySchema, pluginUserPageContentSchema, pluginUserPageCursorSchema, pluginUserPageFilterSchema, pluginUserPageInputSchema, pluginUserPageLinkSchema, pluginUserPageLinksSchema, pluginUserPageQuerySchema, promptContextSchema, promptMessageSchema, replyAttributionSchema, resourceLinkAnnotationSchema, resourceTypeSchema, scheduledAutomationSourceSchema, slackActorSchema, slackDestinationSchema, slackLocationSchema, slackSourceSchema, sourceSchema, sourceVisibilitySchema, stableEventMatchKey, subscribableResourceSchema, systemActorSchema, taskOutcomeSchema, toolApprovalModeSchema, userSchema, watchResultSchema, webActorSchema, webSourceSchema, zodTool };
1836
+ export { EVENT_DATA_MAX_JSON_BYTES, EVENT_DATA_MAX_KEYS, EVENT_GUIDANCE_MAX_LENGTH, EVENT_SUMMARY_MAX_LENGTH, EVENT_TEXT_MAX_LENGTH, EgressAuthRequired, EgressPolicyDenied, PluginToolInputError, REQUIRED_TOOL_ANNOTATION_KEYS, actorSchema, actorUserIdSchema, agentEventKeys, agentEventMatchKey, agentEventMatchSchema, agentInvocationSourceSchema, anyResourceEvents, anyResourceMatchFields, codeChangeInputSchema, codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventIconSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, conversationSidebarIconSchema, createEventSource, createLocalSource, createSlackSource, createWebSource, declaredEventKeys, defineConversationEvent, defineJuniorPlugin, definePluginTool, definePromptContext, describeEventTrigger, destinationSchema, destinationVisibilitySchema, dispatchOptionsSchema, enforceEgressPolicy, eventAutomationSourceSchema, eventDataSchema, eventIdentifierSchema, eventInputSchema, eventMatchFieldSchema, eventMatchFieldsSchema, eventMatchFilterText, eventMatchSchema, eventMatches, eventPersonSchema, eventReachSchema, eventSchema, eventSourceSchema, eventTriggerChoices, eventTriggerFiltersText, eventTriggerProblems, eventTriggerText, eventTypeSchema, eventTypeText, eventsWithoutMatchField, getSourceKey, identitySchema, isPluginModelCostEventName, isPrivateSource, isSlackDestination, localActorSchema, localDestinationSchema, localSourceSchema, locationSchema, mergeEventMatchFields, missingToolAnnotationKeys, nonBlankStringSchema, normalizeEventIdentifier, normalizeEventMatch, objectAnnotationSchema, objectFactFields, objectFactsSchema, objectIconPath, objectIconPaths, objectPresentation, objectTypeSchema, ownedObjectAnnotationSchema, parseShellCommands, platformSchema, pluginApiRouteRequestContextSchema, pluginAuditAttributesSchema, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialLeaseSchema, pluginCredentialResultSchema, pluginCredentialSubjectSchema, pluginDispatchSourceSchema, pluginEventDeclarationSchema, pluginEventTypeSchema, pluginEventsSchema, pluginGrantSchema, pluginModelCostEventNames, pluginProviderAccountSchema, pluginRunContextSchema, pluginRunTranscriptEntrySchema, pluginRunTranscriptProvenanceSchema, pluginStoredTokensSchema, pluginToolContentSchema, pluginToolContinuationSchema, pluginToolOutputSchema, pluginToolReplySchema, pluginUserPageContentSchema, pluginUserPageCursorSchema, pluginUserPageFilterSchema, pluginUserPageInputSchema, pluginUserPageLinkSchema, pluginUserPageLinksSchema, pluginUserPageQuerySchema, promptContextSchema, promptMessageSchema, replyAttributionSchema, resourceLinkAnnotationSchema, resourceTypeSchema, scheduledAutomationSourceSchema, slackActorSchema, slackDestinationSchema, slackLocationSchema, slackSourceSchema, sourceSchema, sourceVisibilitySchema, stableEventMatchKey, subscribableResourceSchema, systemActorSchema, taskOutcomeSchema, toolApprovalModeSchema, userSchema, watchResultSchema, webActorSchema, webSourceSchema, zodTool };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-plugin-api",
3
- "version": "0.294.0",
3
+ "version": "0.296.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"