@sentry/junior-plugin-api 0.294.0 → 0.295.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,49 @@ 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
+ };
1898
1930
  /** Request details available while selecting the grant for sandbox egress. */
1899
1931
  export interface PluginEgressRequest {
1900
- /** Capped request body text when the host exposes it for provider-specific grant classification. */
1932
+ /**
1933
+ * Capped request body text when the host exposes it for provider-specific
1934
+ * grant classification.
1935
+ */
1901
1936
  bodyText?: string;
1937
+ /** Set for every Git `git-receive-pack` POST. */
1938
+ gitPush?: PluginGitPush;
1902
1939
  method: string;
1903
1940
  /** Plugin-declared operation this request performs, used for grant classification and diagnostics. */
1904
1941
  operation?: string;
@@ -1916,7 +1953,7 @@ export interface PluginEgressResponse {
1916
1953
  export interface EgressResponseHookContext extends PluginContext {
1917
1954
  grant: PluginGrant;
1918
1955
  permissionDenied(message: string): void;
1919
- request: Omit<PluginEgressRequest, "bodyText">;
1956
+ request: Omit<PluginEgressRequest, "bodyText" | "gitPush">;
1920
1957
  response: PluginEgressResponse;
1921
1958
  }
1922
1959
  /** Header mutations a plugin-issued credential lease may apply to owned domains. */
@@ -1961,7 +1998,10 @@ export interface IssueCredentialHookContext extends PluginContext {
1961
1998
  grant: PluginGrant;
1962
1999
  tokens: PluginTokenStore;
1963
2000
  }
1964
- /** A notice that a plugin puts on the review desk. */
2001
+ /**
2002
+ * An item that a plugin puts on the review desk: a notice for information,
2003
+ * or an ask that waits on its assignees.
2004
+ */
1965
2005
  export interface PluginReviewNotice {
1966
2006
  /**
1967
2007
  * Junior assigns the User linked to each Identity, but only when that User
@@ -1981,7 +2021,18 @@ export interface PluginReviewNotice {
1981
2021
  title?: string;
1982
2022
  url?: string;
1983
2023
  };
2024
+ /**
2025
+ * For an item that waits on its assignees, name their step, such as
2026
+ * `Ready to merge · #946`. It is the reason that the dashboard shows.
2027
+ */
1984
2028
  title: string;
2029
+ /**
2030
+ * The assignees must act, such as merge a pull request that is ready. The
2031
+ * item then waits on them: its Conversation shows in their Needs you, and
2032
+ * it counts in their Inbox. Leave it unset for a notice that is only for
2033
+ * information.
2034
+ */
2035
+ waitsOnAssignees?: boolean;
1985
2036
  }
1986
2037
  /**
1987
2038
  * Review items that a plugin adds and closes from its own events. Each item
@@ -1989,7 +2040,7 @@ export interface PluginReviewNotice {
1989
2040
  * the Slack cards.
1990
2041
  */
1991
2042
  export interface PluginReviewItems {
1992
- /** Add an open notice, or replace the content of the open one with the key. */
2043
+ /** Add an open item, or replace the content of the open one with the key. */
1993
2044
  upsert(notice: PluginReviewNotice): Promise<void>;
1994
2045
  /** Close the open item with the key. Do nothing when no item is open. */
1995
2046
  close(input: {
@@ -2915,8 +2966,6 @@ export interface PluginMcpConfig {
2915
2966
  url: string;
2916
2967
  /** Provider tools hidden from the model and callable only by plugin-owned wrapper tools. */
2917
2968
  wrappedTools?: string[];
2918
- /** Provider tools whose successful calls Junior records as audit events. */
2919
- auditTools?: string[];
2920
2969
  }
2921
2970
  /**
2922
2971
  * 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.295.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"