@sentry/junior-plugin-api 0.206.0 → 0.208.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
@@ -42,8 +42,8 @@ reports, and other typed hook surfaces exported by this package.
42
42
 
43
43
  - Hook context carries the active source, actor, conversation, plugin metadata,
44
44
  database, logging, and only the host capabilities required by that hook.
45
- - Source uses `kind` to state what produced the input. Resource events,
46
- scheduled tasks, event tasks, Plugin dispatches, and Agent invocations do not
45
+ - Source uses `kind` to state what produced the input. Events,
46
+ scheduled automations, event automations, Plugin dispatches, and Agent invocations do not
47
47
  name a provider. Actor and Destination still use `platform` to name one.
48
48
  - Prompt hooks return bounded structured prompt messages rather than mutate the
49
49
  core prompt.
package/dist/index.d.ts CHANGED
@@ -94,21 +94,21 @@ declare const webSourceSchema: z.ZodObject<{
94
94
  }>;
95
95
  conversationId: z.ZodString;
96
96
  }, z.core.$strict>;
97
- /** Runtime-owned Resource event input Source. */
98
- declare const resourceEventSourceSchema: z.ZodObject<{
99
- kind: z.ZodLiteral<"resource_event">;
97
+ /** Runtime-owned Event input Source. */
98
+ declare const eventSourceSchema: z.ZodObject<{
99
+ kind: z.ZodLiteral<"event">;
100
100
  eventKey: z.ZodString;
101
101
  eventType: z.ZodString;
102
102
  identifier: z.ZodString;
103
103
  namespace: z.ZodString;
104
104
  }, z.core.$strict>;
105
- /** Runtime-owned Scheduled task input Source. */
106
- declare const scheduledTaskSourceSchema: z.ZodObject<{
107
- kind: z.ZodLiteral<"scheduled_task">;
105
+ /** Runtime-owned Scheduled automation input Source. */
106
+ declare const scheduledAutomationSourceSchema: z.ZodObject<{
107
+ kind: z.ZodLiteral<"scheduled_automation">;
108
108
  }, z.core.$strict>;
109
- /** Runtime-owned Event task input Source. */
110
- declare const eventTaskSourceSchema: z.ZodObject<{
111
- kind: z.ZodLiteral<"event_task">;
109
+ /** Runtime-owned Event automation input Source. */
110
+ declare const eventAutomationSourceSchema: z.ZodObject<{
111
+ kind: z.ZodLiteral<"event_automation">;
112
112
  }, z.core.$strict>;
113
113
  /** Runtime-owned Plugin dispatch input Source. */
114
114
  declare const pluginDispatchSourceSchema: z.ZodObject<{
@@ -141,15 +141,15 @@ declare const sourceSchema: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject
141
141
  }>;
142
142
  conversationId: z.ZodString;
143
143
  }, z.core.$strict>, z.ZodObject<{
144
- kind: z.ZodLiteral<"resource_event">;
144
+ kind: z.ZodLiteral<"event">;
145
145
  eventKey: z.ZodString;
146
146
  eventType: z.ZodString;
147
147
  identifier: z.ZodString;
148
148
  namespace: z.ZodString;
149
149
  }, z.core.$strict>, z.ZodObject<{
150
- kind: z.ZodLiteral<"scheduled_task">;
150
+ kind: z.ZodLiteral<"scheduled_automation">;
151
151
  }, z.core.$strict>, z.ZodObject<{
152
- kind: z.ZodLiteral<"event_task">;
152
+ kind: z.ZodLiteral<"event_automation">;
153
153
  }, z.core.$strict>, z.ZodObject<{
154
154
  kind: z.ZodLiteral<"plugin_dispatch">;
155
155
  }, z.core.$strict>, z.ZodObject<{
@@ -163,7 +163,7 @@ declare const pluginCredentialSubjectSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
163
163
  }, z.core.$strict>, z.ZodObject<{
164
164
  type: z.ZodLiteral<"user">;
165
165
  userId: z.ZodString;
166
- allowedWhen: z.ZodLiteral<"scheduled-task">;
166
+ allowedWhen: z.ZodLiteral<"scheduled-automation">;
167
167
  taskId: z.ZodString;
168
168
  }, z.core.$strict>], "allowedWhen">;
169
169
  declare const slackActorSchema: z.ZodObject<{
@@ -254,7 +254,7 @@ declare const dispatchOptionsSchema: z.ZodObject<{
254
254
  }, z.core.$strict>, z.ZodObject<{
255
255
  type: z.ZodLiteral<"user">;
256
256
  userId: z.ZodString;
257
- allowedWhen: z.ZodLiteral<"scheduled-task">;
257
+ allowedWhen: z.ZodLiteral<"scheduled-automation">;
258
258
  taskId: z.ZodString;
259
259
  }, z.core.$strict>], "allowedWhen">>;
260
260
  destination: z.ZodObject<{
@@ -298,14 +298,14 @@ type LocalSource = Extract<Source, {
298
298
  type WebSource = Extract<Source, {
299
299
  kind: "web";
300
300
  }>;
301
- type ResourceEventSource = Extract<Source, {
302
- kind: "resource_event";
301
+ type EventSource = Extract<Source, {
302
+ kind: "event";
303
303
  }>;
304
- type ScheduledTaskSource = Extract<Source, {
305
- kind: "scheduled_task";
304
+ type ScheduledAutomationSource = Extract<Source, {
305
+ kind: "scheduled_automation";
306
306
  }>;
307
- type EventTaskSource = Extract<Source, {
308
- kind: "event_task";
307
+ type EventAutomationSource = Extract<Source, {
308
+ kind: "event_automation";
309
309
  }>;
310
310
  type PluginDispatchSource = Extract<Source, {
311
311
  kind: "plugin_dispatch";
@@ -391,17 +391,17 @@ interface WebInvocationContext extends BaseInvocationContext {
391
391
  /** Runtime-owned dashboard/web source for this invocation. */
392
392
  source: WebSource;
393
393
  }
394
- interface ResourceEventInvocationContext extends BaseInvocationContext {
394
+ interface EventInvocationContext extends BaseInvocationContext {
395
395
  /** Existing conversation destination used for tool context. */
396
396
  destination: Destination;
397
397
  actor?: Actor;
398
- /** Runtime-owned Resource event Source for this invocation. */
399
- source: ResourceEventSource;
398
+ /** Runtime-owned Event Source for this invocation. */
399
+ source: EventSource;
400
400
  }
401
401
  type InvocationContext = LocalInvocationContext | SlackInvocationContext | WebInvocationContext | (BaseInvocationContext & {
402
402
  destination: Destination;
403
403
  actor?: Actor;
404
- source: AgentInvocationSource | EventTaskSource | PluginDispatchSource | ResourceEventSource | ScheduledTaskSource;
404
+ source: AgentInvocationSource | EventAutomationSource | PluginDispatchSource | EventSource | ScheduledAutomationSource;
405
405
  });
406
406
  /** Build a normalized Slack source from runtime-owned Slack coordinates. */
407
407
  declare function createSlackSource(input: {
@@ -416,13 +416,13 @@ declare function createSlackSource(input: {
416
416
  declare function createLocalSource(conversationId: string): LocalSource;
417
417
  /** Build a normalized web/dashboard source from a conversation id. */
418
418
  declare function createWebSource(conversationId: string, visibility?: SourceVisibility): WebSource;
419
- /** Build a normalized Resource event Source from one matched event. */
420
- declare function createResourceEventSource(input: {
419
+ /** Build a normalized Event Source from one matched event. */
420
+ declare function createEventSource(input: {
421
421
  eventKey: string;
422
422
  eventType: string;
423
423
  identifier: string;
424
424
  namespace: string;
425
- }): ResourceEventSource;
425
+ }): EventSource;
426
426
  /** Return whether a source is private to a person or restricted group. */
427
427
  declare function isPrivateSource(source: Source): boolean;
428
428
  /** Return the stable source identity used for idempotency and attribution. */
@@ -609,6 +609,19 @@ interface PluginConversationEventCostDay {
609
609
  date: string;
610
610
  events: number;
611
611
  }
612
+ interface PluginConversationEventRecord {
613
+ content: Record<string, unknown>;
614
+ createdAt: string;
615
+ version: number;
616
+ }
617
+ /** Read events owned by the current plugin namespace after Conversation access checks. */
618
+ interface PluginConversationEventReader {
619
+ list(input: {
620
+ conversationId: string;
621
+ eventName: string;
622
+ viewer: User;
623
+ }): Promise<PluginConversationEventRecord[] | undefined>;
624
+ }
612
625
  /** Read aggregate costs for events owned by the current plugin namespace. */
613
626
  interface PluginConversationEventStats {
614
627
  costsByDay(input: {
@@ -701,18 +714,18 @@ interface Dispatch {
701
714
  status: "pending" | "running" | "awaiting_resume" | "completed" | "failed" | "blocked";
702
715
  }
703
716
 
704
- declare const RESOURCE_EVENT_SUMMARY_MAX_LENGTH = 4000;
705
- declare const RESOURCE_EVENT_TEXT_MAX_LENGTH = 8000;
706
- declare const RESOURCE_EVENT_DATA_MAX_KEYS = 32;
707
- declare const RESOURCE_EVENT_DATA_MAX_JSON_BYTES = 4000;
708
- declare const RESOURCE_EVENT_GUIDANCE_MAX_LENGTH = 1000;
717
+ declare const EVENT_SUMMARY_MAX_LENGTH = 4000;
718
+ declare const EVENT_TEXT_MAX_LENGTH = 8000;
719
+ declare const EVENT_DATA_MAX_KEYS = 32;
720
+ declare const EVENT_DATA_MAX_JSON_BYTES = 4000;
721
+ declare const EVENT_GUIDANCE_MAX_LENGTH = 1000;
709
722
  /** Small trusted data from the plugin. The agent should not look these up again. */
710
- declare const resourceEventDataSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
723
+ declare const eventDataSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
711
724
  /** Canonical dotted event type published and selected across plugins. */
712
- declare const resourceEventTypeSchema: z.ZodString;
725
+ declare const eventTypeSchema: z.ZodString;
713
726
  declare const resourceTypeSchema: z.ZodString;
714
- /** One exact value a watch or event task may require on trusted event data. */
715
- declare const resourceEventMatchFieldSchema: z.ZodObject<{
727
+ /** One exact value a watch or event automation may require on trusted event data. */
728
+ declare const eventMatchFieldSchema: z.ZodObject<{
716
729
  kind: z.ZodEnum<{
717
730
  string: "string";
718
731
  number: "number";
@@ -721,7 +734,7 @@ declare const resourceEventMatchFieldSchema: z.ZodObject<{
721
734
  description: z.ZodString;
722
735
  enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
723
736
  }, z.core.$strict>;
724
- declare const resourceEventMatchFieldsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
737
+ declare const eventMatchFieldsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
725
738
  kind: z.ZodEnum<{
726
739
  string: "string";
727
740
  number: "number";
@@ -730,15 +743,15 @@ declare const resourceEventMatchFieldsSchema: z.ZodRecord<z.ZodString, z.ZodObje
730
743
  description: z.ZodString;
731
744
  enum: z.ZodOptional<z.ZodArray<z.ZodString>>;
732
745
  }, z.core.$strict>>;
733
- /** Exact trusted values required before a watch or event task runs. */
734
- declare const resourceEventMatchSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>]>>;
735
- type ResourceEventMatch = z.output<typeof resourceEventMatchSchema>;
736
- type ResourceEventMatchFields = z.output<typeof resourceEventMatchFieldsSchema>;
746
+ /** Exact trusted values required before a watch or event automation runs. */
747
+ declare const eventMatchSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>]>>;
748
+ type EventMatch = z.output<typeof eventMatchSchema>;
749
+ type EventMatchFields = z.output<typeof eventMatchFieldsSchema>;
737
750
  /** Stable JSON for one match object. List order does not matter. */
738
- declare function stableResourceEventMatchKey(match: ResourceEventMatch | undefined): string;
751
+ declare function stableEventMatchKey(match: EventMatch | undefined): string;
739
752
  /** Return whether trusted event data matches one exact match object. */
740
- declare function resourceEventMatches(match: ResourceEventMatch | undefined, data: ResourceEventData | undefined): boolean;
741
- declare const pluginResourceEventTypeSchema: z.ZodObject<{
753
+ declare function eventMatches(match: EventMatch | undefined, data: EventData | undefined): boolean;
754
+ declare const pluginEventTypeSchema: z.ZodObject<{
742
755
  type: z.ZodString;
743
756
  supportedEvents: z.ZodArray<z.ZodString>;
744
757
  suggestedEvents: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -753,7 +766,7 @@ declare const pluginResourceEventTypeSchema: z.ZodObject<{
753
766
  }, z.core.$strict>>>;
754
767
  guidance: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
755
768
  }, z.core.$strict>;
756
- declare const pluginResourceEventsSchema: z.ZodObject<{
769
+ declare const pluginEventsSchema: z.ZodObject<{
757
770
  resourceTypes: z.ZodArray<z.ZodObject<{
758
771
  type: z.ZodString;
759
772
  supportedEvents: z.ZodArray<z.ZodString>;
@@ -772,10 +785,10 @@ declare const pluginResourceEventsSchema: z.ZodObject<{
772
785
  isEnabled: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodBoolean>>;
773
786
  normalizeIdentifier: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodString], null>, z.ZodString>>;
774
787
  }, z.core.$strict>;
775
- type PluginResourceEventType = z.output<typeof pluginResourceEventTypeSchema>;
776
- type PluginResourceEvents = z.output<typeof pluginResourceEventsSchema>;
777
- /** Apply a plugin's identifier convention at resource-event boundaries. */
778
- declare function normalizeResourceEventIdentifier(registration: Pick<PluginResourceEvents, "normalizeIdentifier"> | undefined, identifier: string): string;
788
+ type PluginEventType = z.output<typeof pluginEventTypeSchema>;
789
+ type PluginEvents = z.output<typeof pluginEventsSchema>;
790
+ /** Apply a plugin's identifier convention at event boundaries. */
791
+ declare function normalizeEventIdentifier(registration: Pick<PluginEvents, "normalizeIdentifier"> | undefined, identifier: string): string;
779
792
  declare const subscribableResourceSchema: z.ZodObject<{
780
793
  identifier: z.ZodString;
781
794
  label: z.ZodString;
@@ -785,13 +798,13 @@ declare const subscribableResourceSchema: z.ZodObject<{
785
798
  type: z.ZodString;
786
799
  }, z.core.$strict>;
787
800
  type SubscribableResource = z.output<typeof subscribableResourceSchema>;
788
- /** Result returned after a temporary resource subscription is created. */
789
- declare const resourceEventSubscriptionResultSchema: z.ZodObject<{
801
+ /** Result returned after a temporary watch is created. */
802
+ declare const watchResultSchema: z.ZodObject<{
790
803
  events: z.ZodArray<z.ZodString>;
791
804
  id: z.ZodString;
792
805
  }, z.core.$strict>;
793
- type ResourceEventSubscriptionResult = z.output<typeof resourceEventSubscriptionResultSchema>;
794
- declare const resourceEventInputSchema: z.ZodObject<{
806
+ type WatchResult = z.output<typeof watchResultSchema>;
807
+ declare const eventInputSchema: z.ZodObject<{
795
808
  eventKey: z.ZodString;
796
809
  eventType: z.ZodString;
797
810
  identifier: z.ZodString;
@@ -801,9 +814,9 @@ declare const resourceEventInputSchema: z.ZodObject<{
801
814
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
802
815
  untrustedText: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
803
816
  }, z.core.$strict>;
804
- type ResourceEventData = z.output<typeof resourceEventDataSchema>;
805
- type ResourceEventInput = z.output<typeof resourceEventInputSchema>;
806
- declare const resourceEventSchema: z.ZodObject<{
817
+ type EventData = z.output<typeof eventDataSchema>;
818
+ type EventInput = z.output<typeof eventInputSchema>;
819
+ declare const eventSchema: z.ZodObject<{
807
820
  eventKey: z.ZodString;
808
821
  eventType: z.ZodString;
809
822
  identifier: z.ZodString;
@@ -814,14 +827,14 @@ declare const resourceEventSchema: z.ZodObject<{
814
827
  untrustedText: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
815
828
  namespace: z.ZodString;
816
829
  }, z.core.$strict>;
817
- type ResourceEvent = z.output<typeof resourceEventSchema>;
818
- interface ResourceEventPublisher {
819
- /** Return whether an active watch or event task matches this event. */
820
- hasMatch?(event: ResourceEventInput): Promise<boolean>;
830
+ type Event = z.output<typeof eventSchema>;
831
+ interface EventPublisher {
832
+ /** Return whether an active watch or event automation matches this event. */
833
+ hasMatch?(event: EventInput): Promise<boolean>;
821
834
  /** Publish one normalized event under the owning plugin's namespace. */
822
- publish(event: ResourceEventInput): Promise<void>;
835
+ publish(event: EventInput): Promise<void>;
823
836
  /**
824
- * Return match keys used by active watches or event tasks for these
837
+ * Return match keys used by active watches or event automations for these
825
838
  * identifiers and event types. Plugins use this to load optional trusted
826
839
  * data only when a filter needs it.
827
840
  */
@@ -1001,15 +1014,15 @@ declare const pluginRunContextSchema: z.ZodObject<{
1001
1014
  }>;
1002
1015
  conversationId: z.ZodString;
1003
1016
  }, z.core.$strict>, z.ZodObject<{
1004
- kind: z.ZodLiteral<"resource_event">;
1017
+ kind: z.ZodLiteral<"event">;
1005
1018
  eventKey: z.ZodString;
1006
1019
  eventType: z.ZodString;
1007
1020
  identifier: z.ZodString;
1008
1021
  namespace: z.ZodString;
1009
1022
  }, z.core.$strict>, z.ZodObject<{
1010
- kind: z.ZodLiteral<"scheduled_task">;
1023
+ kind: z.ZodLiteral<"scheduled_automation">;
1011
1024
  }, z.core.$strict>, z.ZodObject<{
1012
- kind: z.ZodLiteral<"event_task">;
1025
+ kind: z.ZodLiteral<"event_automation">;
1013
1026
  }, z.core.$strict>, z.ZodObject<{
1014
1027
  kind: z.ZodLiteral<"plugin_dispatch">;
1015
1028
  }, z.core.$strict>, z.ZodObject<{
@@ -1379,9 +1392,10 @@ interface RouteRegistrationHookContext extends PluginContext {
1379
1392
  /** Provider-neutral write boundary for Junior's native code index. */
1380
1393
  codeChanges: CodeChangePublisher;
1381
1394
  /** Core-owned delivery boundary for provider webhook events. */
1382
- resourceEvents: ResourceEventPublisher;
1395
+ events: EventPublisher;
1383
1396
  }
1384
1397
  interface ApiRouteRegistrationHookContext extends PluginContext {
1398
+ conversationEvents: PluginConversationEventReader;
1385
1399
  eventStats: PluginConversationEventStats;
1386
1400
  users: {
1387
1401
  /** Resolve or create the canonical user for one verified email. */
@@ -1512,6 +1526,8 @@ interface PluginMcp {
1512
1526
  */
1513
1527
  prepare(): Promise<"authorization_pending" | "ready">;
1514
1528
  }
1529
+ /** Complete Workspace repository preparation after credential egress is removed. */
1530
+ type WorkspaceFinalize = () => Promise<void> | void;
1515
1531
  /**
1516
1532
  * Provider-owned, repeatable repository preparation for a Workspace Sandbox.
1517
1533
  * Implementations should refresh complete checkouts and replace missing or
@@ -1706,15 +1722,15 @@ interface SlackToolRegistrationHookContext {
1706
1722
  allowedWhen: "private-direct-conversation";
1707
1723
  }>;
1708
1724
  }
1709
- interface PluginResourceEventToolContext {
1710
- /** Whether this invocation can create a working resource subscription. */
1725
+ interface PluginEventToolContext {
1726
+ /** Whether this invocation can create a working watch. */
1711
1727
  canSubscribe: boolean;
1712
- /** Create a temporary resource subscription for the current conversation. */
1728
+ /** Create a temporary watch for the current conversation. */
1713
1729
  subscribe(input: {
1714
1730
  events: string[];
1715
1731
  intent: string;
1716
1732
  resource: SubscribableResource;
1717
- }): Promise<ResourceEventSubscriptionResult>;
1733
+ }): Promise<WatchResult>;
1718
1734
  }
1719
1735
  interface PluginWorkspaceToolContext {
1720
1736
  /** Find named Workspaces that include one provider repository. */
@@ -1736,7 +1752,7 @@ interface BaseToolRegistrationHookContext extends PluginContext {
1736
1752
  egress: PluginEgress;
1737
1753
  mcp?: PluginMcp;
1738
1754
  model: PluginModel;
1739
- resourceEvents: PluginResourceEventToolContext;
1755
+ events: PluginEventToolContext;
1740
1756
  /** Sandbox filesystem and command capability for plugin-owned workspace tools. */
1741
1757
  sandbox: PluginSandbox;
1742
1758
  state: PluginState;
@@ -1797,7 +1813,7 @@ interface PluginHooks {
1797
1813
  resolveOAuthAccount?(ctx: ResolveOAuthAccountHookContext): Promise<PluginProviderAccount | undefined> | PluginProviderAccount | undefined;
1798
1814
  routes?(ctx: RouteRegistrationHookContext): PluginRoute[];
1799
1815
  sandboxPrepare?(ctx: SandboxPrepareHookContext): Promise<void> | void;
1800
- workspacePrepare?(ctx: WorkspacePrepareHookContext): Promise<void> | void;
1816
+ workspacePrepare?(ctx: WorkspacePrepareHookContext): Promise<WorkspaceFinalize | void> | WorkspaceFinalize | void;
1801
1817
  slackConversationLink?(ctx: SlackConversationLinkHookContext): SlackConversationLink | undefined;
1802
1818
  /** Pure Markdown rewrite. Emit ordinary Markdown only. */
1803
1819
  formatMarkdown?(ctx: FormatMarkdownHookContext): string;
@@ -2030,7 +2046,7 @@ type PluginRegistrationInput = {
2030
2046
  manifest: PluginManifest;
2031
2047
  model?: PluginModelConfig;
2032
2048
  packageName?: string;
2033
- resourceEvents?: PluginResourceEvents;
2049
+ events?: PluginEvents;
2034
2050
  tasks?: PluginTasks;
2035
2051
  userPages?: PluginUserPageDefinition[];
2036
2052
  };
@@ -2039,4 +2055,4 @@ interface PluginRegistration extends PluginRegistrationInput {
2039
2055
  /** Define one Junior plugin registration for app and build-time wiring. */
2040
2056
  declare function defineJuniorPlugin(plugin: PluginRegistrationInput): PluginRegistration;
2041
2057
 
2042
- export { type Actor, type AfterMcpToolHookContext, type AgentInvocationSource, type ApiRouteRegistrationHookContext, type BeforeToolExecuteHookContext, type CodeChangeInput, type CodeChangePublisher, type CodeChangeState, type ConversationAnnotation, type ConversationAnnotationInput, type ConversationEventPresentation, type ConversationSidebarAnnotation, type ConversationSidebarHookContext, type ConversationSidebarResult, type DefinedConversationEvent, type Destination, type DestinationVisibility, type Dispatch, type DispatchOptions, type DispatchResult, EgressAuthRequired, type EgressHookContext, EgressPolicyDenied, type EgressResponseHookContext, type EventTaskSource, type FormatMarkdownHookContext, type HeartbeatHookContext, type HeartbeatResult, type Identity, type InvocationContext, type IssueCredentialHookContext, type LocalActor, type LocalDestination, type LocalInvocationContext, type LocalSource, type Location, type OperationalReportHookContext, type Platform, type PluginAnnotations, type PluginApiRouteRequestContext, type PluginAuthorization, type PluginCliActionCommand, type PluginCliActionContext, type PluginCliActionHandler, type PluginCliCommandDefinition, type PluginCliDefinition, type PluginCliHost, type PluginCliIo, type PluginContext, type PluginConversationAnnotations, type PluginConversationEventCostDay, type PluginConversationEventDefinition, type PluginConversationEventStats, type PluginConversationEventValue, type PluginConversationEvents, type PluginCredentialActor, type PluginCredentialHeaderTransform, type PluginCredentialLease, type PluginCredentialResult, type PluginCredentialSubject, type PluginCredentials, type PluginDecision, type PluginDispatchSource, type PluginEgress, type PluginEgressRequest, type PluginEgressResponse, type PluginEmbedder, type PluginEnv, type PluginEnvVarDeclaration, type PluginGrant, type PluginGrantAccess, type PluginHooks, type PluginLogger, type PluginManifest, type PluginMcp, type PluginMcpAuthorizationPending, type PluginMcpConfig, type PluginMcpContent, type PluginMcpToolError, type PluginMcpToolResult, type PluginMcpToolSuccess, type PluginMetadata, type PluginModel, type PluginModelConfig, type PluginNpmRuntimeDependency, type PluginOAuthBearerCredentials, type PluginOAuthConfig, type PluginOperationalBarChartWidget, type PluginOperationalChartCategory, type PluginOperationalChartSeries, type PluginOperationalField, type PluginOperationalMetric, type PluginOperationalRecord, type PluginOperationalRecordSet, type PluginOperationalReport, type PluginOperationalReportContent, type PluginOperationalTone, type PluginProviderAccount, type PluginReadState, type PluginRegistration, type PluginRegistrationInput, type PluginResolvedCredentialUser, type PluginResourceEventToolContext, type PluginResourceEventType, type PluginResourceEvents, type PluginRoute, type PluginRouteApp, type PluginRouteHandler, type PluginRouteMethod, type PluginRunContext, type PluginRunTranscriptEntry, type PluginRunTranscriptProvenance, type PluginRuntimeDependency, type PluginRuntimePostinstallCommand, type PluginSandbox, type PluginState, type PluginStoredTokens, type PluginSystemRuntimeDependency, type PluginSystemRuntimeDependencyFromUrl, type PluginTaskContext, type PluginTaskDefinition, type PluginTasks, type PluginTokenStore, type PluginToolContent, type PluginToolDefinition, type PluginToolExecute, type PluginToolExecuteOptions, PluginToolInputError, type PluginToolOutput, type PluginToolOutputEnvelope, type PluginUserPageContent, type PluginUserPageContext, type PluginUserPageDefinition, type PluginUserPageInput, type PluginUserPageLink, type PluginUserTokenSlot, type PluginWorkspaceToolContext, type ProfileReportHookContext, type PromptContext, type PromptContextContribution, type PromptMessage, REQUIRED_TOOL_ANNOTATION_KEYS, RESOURCE_EVENT_DATA_MAX_JSON_BYTES, RESOURCE_EVENT_DATA_MAX_KEYS, RESOURCE_EVENT_GUIDANCE_MAX_LENGTH, RESOURCE_EVENT_SUMMARY_MAX_LENGTH, RESOURCE_EVENT_TEXT_MAX_LENGTH, type ReplyAttribution, type RequiredToolAnnotationKey, type ResolveOAuthAccountHookContext, type ResourceEvent, type ResourceEventData, type ResourceEventInput, type ResourceEventInvocationContext, type ResourceEventMatch, type ResourceEventMatchFields, type ResourceEventPublisher, type ResourceEventSource, type ResourceEventSubscriptionResult, type RouteRegistrationHookContext, type SandboxPrepareHookContext, type ScheduledTaskSource, type SlackActor, type SlackConversationLink, type SlackConversationLinkHookContext, type SlackDestination, type SlackInvocationContext, type SlackLocation, type SlackSource, type SlackToolRegistrationHookContext, type Source, type SourceVisibility, type SubscribableResource, type SystemActor, type SystemPromptContext, type TaskOutcome, type ToolAnnotations, type ToolApprovalMetadata, type ToolApprovalMode, type ToolExposure, type ToolRegistrationHookContext, type UnfinishedWorkHookContext, type UnfinishedWorkResult, type User, type UserPromptContext, type UserPromptContribution, type WebActor, type WebInvocationContext, type WebSource, type WorkspacePrepareHookContext, actorSchema, actorUserIdSchema, agentInvocationSourceSchema, codeChangeInputSchema, codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventIconSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, conversationSidebarIconSchema, createLocalSource, createResourceEventSource, createSlackSource, createWebSource, defineConversationEvent, defineJuniorPlugin, definePluginTool, definePromptContext, destinationSchema, destinationVisibilitySchema, dispatchOptionsSchema, enforceEgressPolicy, eventTaskSourceSchema, getSourceKey, identitySchema, isPrivateSource, isSlackDestination, localActorSchema, localDestinationSchema, localSourceSchema, locationSchema, missingToolAnnotationKeys, nonBlankStringSchema, normalizeResourceEventIdentifier, platformSchema, pluginApiRouteRequestContextSchema, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialLeaseSchema, pluginCredentialResultSchema, pluginCredentialSubjectSchema, pluginDispatchSourceSchema, pluginGrantSchema, pluginProviderAccountSchema, pluginResourceEventTypeSchema, pluginResourceEventsSchema, pluginRunContextSchema, pluginRunTranscriptEntrySchema, pluginRunTranscriptProvenanceSchema, pluginStoredTokensSchema, pluginToolContentSchema, pluginToolContinuationSchema, pluginToolOutputSchema, pluginUserPageContentSchema, pluginUserPageCursorSchema, pluginUserPageFilterSchema, pluginUserPageInputSchema, pluginUserPageLinkSchema, pluginUserPageLinksSchema, pluginUserPageQuerySchema, promptContextSchema, promptMessageSchema, replyAttributionSchema, resourceEventDataSchema, resourceEventInputSchema, resourceEventMatchFieldSchema, resourceEventMatchFieldsSchema, resourceEventMatchSchema, resourceEventMatches, resourceEventSchema, resourceEventSourceSchema, resourceEventSubscriptionResultSchema, resourceEventTypeSchema, resourceLinkAnnotationSchema, resourceTypeSchema, scheduledTaskSourceSchema, slackActorSchema, slackDestinationSchema, slackLocationSchema, slackSourceSchema, sourceSchema, sourceVisibilitySchema, stableResourceEventMatchKey, subscribableResourceSchema, systemActorSchema, taskOutcomeSchema, toolApprovalModeSchema, userSchema, webActorSchema, webSourceSchema, zodTool };
2058
+ export { type Actor, type AfterMcpToolHookContext, type AgentInvocationSource, type ApiRouteRegistrationHookContext, type BeforeToolExecuteHookContext, type CodeChangeInput, type CodeChangePublisher, type CodeChangeState, type ConversationAnnotation, type ConversationAnnotationInput, type ConversationEventPresentation, type ConversationSidebarAnnotation, type ConversationSidebarHookContext, type ConversationSidebarResult, type DefinedConversationEvent, type Destination, type DestinationVisibility, type Dispatch, type DispatchOptions, type DispatchResult, EVENT_DATA_MAX_JSON_BYTES, EVENT_DATA_MAX_KEYS, EVENT_GUIDANCE_MAX_LENGTH, EVENT_SUMMARY_MAX_LENGTH, EVENT_TEXT_MAX_LENGTH, EgressAuthRequired, type EgressHookContext, EgressPolicyDenied, type EgressResponseHookContext, type Event, type EventAutomationSource, type EventData, type EventInput, type EventInvocationContext, type EventMatch, type EventMatchFields, type EventPublisher, type EventSource, type FormatMarkdownHookContext, type HeartbeatHookContext, type HeartbeatResult, type Identity, type InvocationContext, type IssueCredentialHookContext, type LocalActor, type LocalDestination, type LocalInvocationContext, type LocalSource, type Location, type OperationalReportHookContext, type Platform, type PluginAnnotations, type PluginApiRouteRequestContext, type PluginAuthorization, type PluginCliActionCommand, type PluginCliActionContext, type PluginCliActionHandler, type PluginCliCommandDefinition, type PluginCliDefinition, type PluginCliHost, type PluginCliIo, type PluginContext, type PluginConversationAnnotations, type PluginConversationEventCostDay, type PluginConversationEventDefinition, type PluginConversationEventReader, type PluginConversationEventRecord, type PluginConversationEventStats, type PluginConversationEventValue, type PluginConversationEvents, type PluginCredentialActor, type PluginCredentialHeaderTransform, type PluginCredentialLease, type PluginCredentialResult, type PluginCredentialSubject, type PluginCredentials, type PluginDecision, type PluginDispatchSource, type PluginEgress, type PluginEgressRequest, type PluginEgressResponse, type PluginEmbedder, type PluginEnv, type PluginEnvVarDeclaration, type PluginEventToolContext, type PluginEventType, type PluginEvents, type PluginGrant, type PluginGrantAccess, type PluginHooks, type PluginLogger, type PluginManifest, type PluginMcp, type PluginMcpAuthorizationPending, type PluginMcpConfig, type PluginMcpContent, type PluginMcpToolError, type PluginMcpToolResult, type PluginMcpToolSuccess, type PluginMetadata, type PluginModel, type PluginModelConfig, type PluginNpmRuntimeDependency, type PluginOAuthBearerCredentials, type PluginOAuthConfig, type PluginOperationalBarChartWidget, type PluginOperationalChartCategory, type PluginOperationalChartSeries, type PluginOperationalField, type PluginOperationalMetric, type PluginOperationalRecord, type PluginOperationalRecordSet, type PluginOperationalReport, type PluginOperationalReportContent, type PluginOperationalTone, type PluginProviderAccount, type PluginReadState, type PluginRegistration, type PluginRegistrationInput, type PluginResolvedCredentialUser, type PluginRoute, type PluginRouteApp, type PluginRouteHandler, type PluginRouteMethod, type PluginRunContext, type PluginRunTranscriptEntry, type PluginRunTranscriptProvenance, type PluginRuntimeDependency, type PluginRuntimePostinstallCommand, type PluginSandbox, type PluginState, type PluginStoredTokens, type PluginSystemRuntimeDependency, type PluginSystemRuntimeDependencyFromUrl, type PluginTaskContext, type PluginTaskDefinition, type PluginTasks, type PluginTokenStore, type PluginToolContent, type PluginToolDefinition, type PluginToolExecute, type PluginToolExecuteOptions, PluginToolInputError, type PluginToolOutput, type PluginToolOutputEnvelope, type PluginUserPageContent, type PluginUserPageContext, type PluginUserPageDefinition, type PluginUserPageInput, type PluginUserPageLink, type PluginUserTokenSlot, type PluginWorkspaceToolContext, type ProfileReportHookContext, type PromptContext, type PromptContextContribution, type PromptMessage, REQUIRED_TOOL_ANNOTATION_KEYS, type ReplyAttribution, type RequiredToolAnnotationKey, type ResolveOAuthAccountHookContext, type RouteRegistrationHookContext, type SandboxPrepareHookContext, type ScheduledAutomationSource, type SlackActor, type SlackConversationLink, type SlackConversationLinkHookContext, type SlackDestination, type SlackInvocationContext, type SlackLocation, type SlackSource, type SlackToolRegistrationHookContext, type Source, type SourceVisibility, type SubscribableResource, type SystemActor, type SystemPromptContext, type TaskOutcome, type ToolAnnotations, type ToolApprovalMetadata, type ToolApprovalMode, type ToolExposure, type ToolRegistrationHookContext, type UnfinishedWorkHookContext, type UnfinishedWorkResult, type User, type UserPromptContext, type UserPromptContribution, type WatchResult, type WebActor, type WebInvocationContext, type WebSource, type WorkspaceFinalize, type WorkspacePrepareHookContext, actorSchema, actorUserIdSchema, agentInvocationSourceSchema, codeChangeInputSchema, codeChangeStateSchema, conversationAnnotationInputSchema, conversationEventIconSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, conversationSidebarIconSchema, createEventSource, createLocalSource, createSlackSource, createWebSource, defineConversationEvent, defineJuniorPlugin, definePluginTool, definePromptContext, destinationSchema, destinationVisibilitySchema, dispatchOptionsSchema, enforceEgressPolicy, eventAutomationSourceSchema, eventDataSchema, eventInputSchema, eventMatchFieldSchema, eventMatchFieldsSchema, eventMatchSchema, eventMatches, eventSchema, eventSourceSchema, eventTypeSchema, getSourceKey, identitySchema, isPrivateSource, isSlackDestination, localActorSchema, localDestinationSchema, localSourceSchema, locationSchema, missingToolAnnotationKeys, nonBlankStringSchema, normalizeEventIdentifier, platformSchema, pluginApiRouteRequestContextSchema, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialLeaseSchema, pluginCredentialResultSchema, pluginCredentialSubjectSchema, pluginDispatchSourceSchema, pluginEventTypeSchema, pluginEventsSchema, pluginGrantSchema, pluginProviderAccountSchema, pluginRunContextSchema, pluginRunTranscriptEntrySchema, pluginRunTranscriptProvenanceSchema, pluginStoredTokensSchema, pluginToolContentSchema, pluginToolContinuationSchema, pluginToolOutputSchema, 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/dist/index.js CHANGED
@@ -174,24 +174,24 @@ var webSourceSchema = z4.object({
174
174
  // Web can continue any existing conversation id, including Slack roots.
175
175
  conversationId: exactNonBlankStringSchema
176
176
  }).strict();
177
- var resourceEventSourceSchema = z4.object({
178
- kind: z4.literal("resource_event"),
177
+ var eventSourceSchema = z4.object({
178
+ kind: z4.literal("event"),
179
179
  eventKey: exactNonBlankStringSchema,
180
180
  eventType: exactNonBlankStringSchema,
181
181
  identifier: exactNonBlankStringSchema,
182
182
  namespace: exactNonBlankStringSchema
183
183
  }).strict();
184
- var scheduledTaskSourceSchema = z4.object({ kind: z4.literal("scheduled_task") }).strict();
185
- var eventTaskSourceSchema = z4.object({ kind: z4.literal("event_task") }).strict();
184
+ var scheduledAutomationSourceSchema = z4.object({ kind: z4.literal("scheduled_automation") }).strict();
185
+ var eventAutomationSourceSchema = z4.object({ kind: z4.literal("event_automation") }).strict();
186
186
  var pluginDispatchSourceSchema = z4.object({ kind: z4.literal("plugin_dispatch") }).strict();
187
187
  var agentInvocationSourceSchema = z4.object({ kind: z4.literal("agent_invocation") }).strict();
188
188
  var currentSourceSchema = z4.discriminatedUnion("kind", [
189
189
  slackSourceSchema,
190
190
  localSourceSchema,
191
191
  webSourceSchema,
192
- resourceEventSourceSchema,
193
- scheduledTaskSourceSchema,
194
- eventTaskSourceSchema,
192
+ eventSourceSchema,
193
+ scheduledAutomationSourceSchema,
194
+ eventAutomationSourceSchema,
195
195
  pluginDispatchSourceSchema,
196
196
  agentInvocationSourceSchema
197
197
  ]);
@@ -200,8 +200,14 @@ function normalizeStoredSource(value) {
200
200
  return value;
201
201
  }
202
202
  const source = value;
203
- if ("kind" in source || !("platform" in source)) {
204
- return value;
203
+ if ("kind" in source) {
204
+ const legacyKinds = {
205
+ event_task: "event_automation",
206
+ resource_event: "event",
207
+ scheduled_task: "scheduled_automation"
208
+ };
209
+ const kind2 = typeof source.kind === "string" ? legacyKinds[source.kind] : void 0;
210
+ return kind2 ? { ...source, kind: kind2 } : value;
205
211
  }
206
212
  if (source.platform !== "slack" && source.platform !== "local" && source.platform !== "web") {
207
213
  return value;
@@ -224,7 +230,7 @@ var pluginCredentialSubjectSchema = z4.discriminatedUnion(
224
230
  z4.object({
225
231
  type: z4.literal("user"),
226
232
  userId: exactActorUserIdSchema,
227
- allowedWhen: z4.literal("scheduled-task"),
233
+ allowedWhen: z4.literal("scheduled-automation"),
228
234
  taskId: exactNonBlankStringSchema
229
235
  }).strict()
230
236
  ]
@@ -359,9 +365,9 @@ function createWebSource(conversationId, visibility = "public") {
359
365
  conversationId
360
366
  };
361
367
  }
362
- function createResourceEventSource(input) {
368
+ function createEventSource(input) {
363
369
  return {
364
- kind: "resource_event",
370
+ kind: "event",
365
371
  eventKey: input.eventKey,
366
372
  eventType: input.eventType,
367
373
  identifier: input.identifier,
@@ -383,10 +389,10 @@ function getSourceKey(source) {
383
389
  }
384
390
  return `slack:${source.teamId}:${source.channelId}:${messageKey}`;
385
391
  }
386
- case "resource_event":
387
- return `resource-event:${source.namespace}:${source.eventKey}`;
388
- case "scheduled_task":
389
- case "event_task":
392
+ case "event":
393
+ return `event:${source.namespace}:${source.eventKey}`;
394
+ case "scheduled_automation":
395
+ case "event_automation":
390
396
  case "plugin_dispatch":
391
397
  case "agent_invocation":
392
398
  return void 0;
@@ -418,39 +424,39 @@ function definePromptContext(definition) {
418
424
  };
419
425
  }
420
426
 
421
- // src/resource-events.ts
427
+ // src/events.ts
422
428
  import { z as z6 } from "zod";
423
- var RESOURCE_EVENT_SUMMARY_MAX_LENGTH = 4e3;
424
- var RESOURCE_EVENT_TEXT_MAX_LENGTH = 8e3;
425
- var RESOURCE_EVENT_DATA_MAX_KEYS = 32;
426
- var RESOURCE_EVENT_DATA_MAX_JSON_BYTES = 4e3;
427
- var RESOURCE_EVENT_GUIDANCE_MAX_LENGTH = 1e3;
428
- var resourceEventDataSchema = z6.record(z6.string(), z6.unknown()).superRefine((value, context) => {
429
+ var EVENT_SUMMARY_MAX_LENGTH = 4e3;
430
+ var EVENT_TEXT_MAX_LENGTH = 8e3;
431
+ var EVENT_DATA_MAX_KEYS = 32;
432
+ var EVENT_DATA_MAX_JSON_BYTES = 4e3;
433
+ var EVENT_GUIDANCE_MAX_LENGTH = 1e3;
434
+ var eventDataSchema = z6.record(z6.string(), z6.unknown()).superRefine((value, context) => {
429
435
  const keys = Object.keys(value);
430
- if (keys.length > RESOURCE_EVENT_DATA_MAX_KEYS) {
436
+ if (keys.length > EVENT_DATA_MAX_KEYS) {
431
437
  context.addIssue({
432
438
  code: "custom",
433
- message: `Resource event data may include at most ${RESOURCE_EVENT_DATA_MAX_KEYS} keys.`
439
+ message: `Event data may include at most ${EVENT_DATA_MAX_KEYS} keys.`
434
440
  });
435
441
  }
436
442
  const jsonBytes = new TextEncoder().encode(
437
443
  JSON.stringify(value)
438
444
  ).byteLength;
439
- if (jsonBytes > RESOURCE_EVENT_DATA_MAX_JSON_BYTES) {
445
+ if (jsonBytes > EVENT_DATA_MAX_JSON_BYTES) {
440
446
  context.addIssue({
441
447
  code: "custom",
442
- message: `Resource event data may be at most ${RESOURCE_EVENT_DATA_MAX_JSON_BYTES} JSON bytes.`
448
+ message: `Event data may be at most ${EVENT_DATA_MAX_JSON_BYTES} JSON bytes.`
443
449
  });
444
450
  }
445
451
  });
446
- var resourceEventTypeSchema = z6.string().regex(/^[a-z][a-z0-9_-]*(?:\.[a-z][a-z0-9_-]*)+$/).describe(
452
+ var eventTypeSchema = z6.string().regex(/^[a-z][a-z0-9_-]*(?:\.[a-z][a-z0-9_-]*)+$/).describe(
447
453
  "Canonical dotted event type, such as issue.closed or pull_request.review.changes_requested."
448
454
  );
449
455
  var resourceTypeSchema = z6.string().regex(/^[a-z][a-z0-9_]*$/).describe(
450
456
  "Canonical plugin-defined resource type, such as issue or pull_request."
451
457
  );
452
- var RESOURCE_EVENT_MATCH_FIELD_NAME = /^[a-z][a-zA-Z0-9]*$/;
453
- var resourceEventMatchFieldSchema = z6.object({
458
+ var EVENT_MATCH_FIELD_NAME = /^[a-z][a-zA-Z0-9]*$/;
459
+ var eventMatchFieldSchema = z6.object({
454
460
  kind: z6.enum(["boolean", "string", "number"]),
455
461
  description: z6.string().trim().min(1).max(200),
456
462
  enum: z6.array(z6.string().min(1)).min(1).optional()
@@ -458,24 +464,21 @@ var resourceEventMatchFieldSchema = z6.object({
458
464
  if (field.enum && field.kind !== "string") {
459
465
  context.addIssue({
460
466
  code: "custom",
461
- message: 'Resource event match field enum requires kind "string".',
467
+ message: 'Event match field enum requires kind "string".',
462
468
  path: ["enum"]
463
469
  });
464
470
  }
465
471
  });
466
- var resourceEventMatchFieldsSchema = z6.record(
467
- z6.string().regex(RESOURCE_EVENT_MATCH_FIELD_NAME),
468
- resourceEventMatchFieldSchema
469
- ).superRefine((fields, context) => {
470
- if (Object.keys(fields).length > RESOURCE_EVENT_DATA_MAX_KEYS) {
472
+ var eventMatchFieldsSchema = z6.record(z6.string().regex(EVENT_MATCH_FIELD_NAME), eventMatchFieldSchema).superRefine((fields, context) => {
473
+ if (Object.keys(fields).length > EVENT_DATA_MAX_KEYS) {
471
474
  context.addIssue({
472
475
  code: "custom",
473
- message: `Resource event match keys may include at most ${RESOURCE_EVENT_DATA_MAX_KEYS} keys.`
476
+ message: `Event match keys may include at most ${EVENT_DATA_MAX_KEYS} keys.`
474
477
  });
475
478
  }
476
479
  });
477
- var resourceEventMatchSchema = z6.record(
478
- z6.string().regex(RESOURCE_EVENT_MATCH_FIELD_NAME),
480
+ var eventMatchSchema = z6.record(
481
+ z6.string().regex(EVENT_MATCH_FIELD_NAME),
479
482
  z6.union([
480
483
  z6.boolean(),
481
484
  z6.number().finite(),
@@ -483,10 +486,10 @@ var resourceEventMatchSchema = z6.record(
483
486
  z6.array(z6.union([z6.number().finite(), z6.string().min(1)])).min(1)
484
487
  ])
485
488
  ).superRefine((match, context) => {
486
- if (Object.keys(match).length > RESOURCE_EVENT_DATA_MAX_KEYS) {
489
+ if (Object.keys(match).length > EVENT_DATA_MAX_KEYS) {
487
490
  context.addIssue({
488
491
  code: "custom",
489
- message: `Resource event match may include at most ${RESOURCE_EVENT_DATA_MAX_KEYS} keys.`
492
+ message: `Event match may include at most ${EVENT_DATA_MAX_KEYS} keys.`
490
493
  });
491
494
  }
492
495
  for (const [key, value] of Object.entries(match)) {
@@ -494,7 +497,7 @@ var resourceEventMatchSchema = z6.record(
494
497
  if (value.some((entry) => typeof entry === "boolean")) {
495
498
  context.addIssue({
496
499
  code: "custom",
497
- message: `Resource event match field "${key}" cannot use a boolean list.`,
500
+ message: `Event match field "${key}" cannot use a boolean list.`,
498
501
  path: [key]
499
502
  });
500
503
  }
@@ -509,7 +512,7 @@ function stableMatchValue(value) {
509
512
  return String(left).localeCompare(String(right));
510
513
  });
511
514
  }
512
- function stableResourceEventMatchKey(match) {
515
+ function stableEventMatchKey(match) {
513
516
  if (!match || Object.keys(match).length === 0) return "";
514
517
  return JSON.stringify(
515
518
  Object.fromEntries(
@@ -517,7 +520,7 @@ function stableResourceEventMatchKey(match) {
517
520
  )
518
521
  );
519
522
  }
520
- function resourceEventMatches(match, data) {
523
+ function eventMatches(match, data) {
521
524
  if (!match || Object.keys(match).length === 0) return true;
522
525
  if (!data) return false;
523
526
  for (const [key, expected] of Object.entries(match)) {
@@ -531,14 +534,14 @@ function resourceEventMatches(match, data) {
531
534
  }
532
535
  return true;
533
536
  }
534
- var pluginResourceEventTypeSchema = z6.object({
537
+ var pluginEventTypeSchema = z6.object({
535
538
  type: resourceTypeSchema,
536
- supportedEvents: z6.array(resourceEventTypeSchema).min(1),
537
- suggestedEvents: z6.array(resourceEventTypeSchema).optional(),
538
- matchFields: resourceEventMatchFieldsSchema.optional(),
539
+ supportedEvents: z6.array(eventTypeSchema).min(1),
540
+ suggestedEvents: z6.array(eventTypeSchema).optional(),
541
+ matchFields: eventMatchFieldsSchema.optional(),
539
542
  guidance: z6.record(
540
- resourceEventTypeSchema,
541
- z6.string().trim().min(1).max(RESOURCE_EVENT_GUIDANCE_MAX_LENGTH)
543
+ eventTypeSchema,
544
+ z6.string().trim().min(1).max(EVENT_GUIDANCE_MAX_LENGTH)
542
545
  ).optional()
543
546
  }).strict().superRefine((resourceType, context) => {
544
547
  const supported = /* @__PURE__ */ new Set();
@@ -546,7 +549,7 @@ var pluginResourceEventTypeSchema = z6.object({
546
549
  if (supported.has(eventType)) {
547
550
  context.addIssue({
548
551
  code: "custom",
549
- message: `Duplicate supported resource event type "${eventType}".`,
552
+ message: `Duplicate supported event type "${eventType}".`,
550
553
  path: ["supportedEvents", index]
551
554
  });
552
555
  }
@@ -556,7 +559,7 @@ var pluginResourceEventTypeSchema = z6.object({
556
559
  if (!supported.has(eventType)) {
557
560
  context.addIssue({
558
561
  code: "custom",
559
- message: `Guidance resource event type "${eventType}" is not supported.`,
562
+ message: `Guidance event type "${eventType}" is not supported.`,
560
563
  path: ["guidance", eventType]
561
564
  });
562
565
  }
@@ -566,22 +569,22 @@ var pluginResourceEventTypeSchema = z6.object({
566
569
  if (suggested.has(eventType)) {
567
570
  context.addIssue({
568
571
  code: "custom",
569
- message: `Duplicate suggested resource event type "${eventType}".`,
572
+ message: `Duplicate suggested event type "${eventType}".`,
570
573
  path: ["suggestedEvents", index]
571
574
  });
572
575
  }
573
576
  if (!supported.has(eventType)) {
574
577
  context.addIssue({
575
578
  code: "custom",
576
- message: `Suggested resource event type "${eventType}" is not supported.`,
579
+ message: `Suggested event type "${eventType}" is not supported.`,
577
580
  path: ["suggestedEvents", index]
578
581
  });
579
582
  }
580
583
  suggested.add(eventType);
581
584
  });
582
585
  });
583
- var pluginResourceEventsSchema = z6.object({
584
- resourceTypes: z6.array(pluginResourceEventTypeSchema).min(1),
586
+ var pluginEventsSchema = z6.object({
587
+ resourceTypes: z6.array(pluginEventTypeSchema).min(1),
585
588
  isEnabled: z6.function({ input: [], output: z6.boolean() }).optional(),
586
589
  normalizeIdentifier: z6.function({ input: [z6.string()], output: z6.string() }).optional()
587
590
  }).strict().superRefine((registration, context) => {
@@ -597,11 +600,11 @@ var pluginResourceEventsSchema = z6.object({
597
600
  seen.add(resourceType.type);
598
601
  });
599
602
  });
600
- function normalizeResourceEventIdentifier(registration, identifier) {
603
+ function normalizeEventIdentifier(registration, identifier) {
601
604
  const trimmed = identifier.trim();
602
605
  const normalized = (registration?.normalizeIdentifier?.(trimmed) ?? trimmed).trim();
603
606
  if (!normalized) {
604
- throw new Error("Resource event identifier must not normalize to empty");
607
+ throw new Error("Event identifier must not normalize to empty");
605
608
  }
606
609
  return normalized;
607
610
  }
@@ -609,26 +612,26 @@ var subscribableResourceSchema = z6.object({
609
612
  identifier: z6.string().min(1),
610
613
  label: z6.string().min(1),
611
614
  namespace: z6.string().min(1),
612
- suggestedEvents: z6.array(resourceEventTypeSchema).optional(),
613
- supportedEvents: z6.array(resourceEventTypeSchema),
615
+ suggestedEvents: z6.array(eventTypeSchema).optional(),
616
+ supportedEvents: z6.array(eventTypeSchema),
614
617
  type: resourceTypeSchema
615
618
  }).strict();
616
- var resourceEventSubscriptionResultSchema = z6.object({
617
- events: z6.array(resourceEventTypeSchema).min(1),
619
+ var watchResultSchema = z6.object({
620
+ events: z6.array(eventTypeSchema).min(1),
618
621
  id: z6.string().min(1)
619
622
  }).strict();
620
- var resourceEventInputSchema = z6.object({
623
+ var eventInputSchema = z6.object({
621
624
  eventKey: z6.string().min(1),
622
- eventType: resourceEventTypeSchema,
625
+ eventType: eventTypeSchema,
623
626
  identifier: z6.string().min(1),
624
627
  occurredAtMs: z6.number().finite(),
625
628
  terminal: z6.boolean().optional(),
626
- trustedSummary: z6.string().min(1).transform((value) => value.slice(0, RESOURCE_EVENT_SUMMARY_MAX_LENGTH)),
629
+ trustedSummary: z6.string().min(1).transform((value) => value.slice(0, EVENT_SUMMARY_MAX_LENGTH)),
627
630
  /** Trusted structured facts. Prefer ids and urls over long prose. */
628
- data: resourceEventDataSchema.optional(),
629
- untrustedText: z6.string().transform((value) => value.slice(0, RESOURCE_EVENT_TEXT_MAX_LENGTH)).optional()
631
+ data: eventDataSchema.optional(),
632
+ untrustedText: z6.string().transform((value) => value.slice(0, EVENT_TEXT_MAX_LENGTH)).optional()
630
633
  }).strict();
631
- var resourceEventSchema = resourceEventInputSchema.extend({
634
+ var eventSchema = eventInputSchema.extend({
632
635
  namespace: z6.string().min(1)
633
636
  });
634
637
 
@@ -936,10 +939,10 @@ function defineJuniorPlugin(plugin) {
936
939
  `Junior plugin "${name}" conversationEvents must be an array.`
937
940
  );
938
941
  }
939
- if (plugin.resourceEvents !== void 0) {
940
- const parsed = pluginResourceEventsSchema.safeParse(plugin.resourceEvents);
942
+ if (plugin.events !== void 0) {
943
+ const parsed = pluginEventsSchema.safeParse(plugin.events);
941
944
  if (!parsed.success) {
942
- throw new Error(`Junior plugin "${name}" resourceEvents is invalid.`, {
945
+ throw new Error(`Junior plugin "${name}" events is invalid.`, {
943
946
  cause: parsed.error
944
947
  });
945
948
  }
@@ -1053,15 +1056,15 @@ var pluginUserPageInputSchema = z11.object({
1053
1056
  query: pluginUserPageQuerySchema
1054
1057
  }).strict();
1055
1058
  export {
1059
+ EVENT_DATA_MAX_JSON_BYTES,
1060
+ EVENT_DATA_MAX_KEYS,
1061
+ EVENT_GUIDANCE_MAX_LENGTH,
1062
+ EVENT_SUMMARY_MAX_LENGTH,
1063
+ EVENT_TEXT_MAX_LENGTH,
1056
1064
  EgressAuthRequired,
1057
1065
  EgressPolicyDenied,
1058
1066
  PluginToolInputError,
1059
1067
  REQUIRED_TOOL_ANNOTATION_KEYS,
1060
- RESOURCE_EVENT_DATA_MAX_JSON_BYTES,
1061
- RESOURCE_EVENT_DATA_MAX_KEYS,
1062
- RESOURCE_EVENT_GUIDANCE_MAX_LENGTH,
1063
- RESOURCE_EVENT_SUMMARY_MAX_LENGTH,
1064
- RESOURCE_EVENT_TEXT_MAX_LENGTH,
1065
1068
  actorSchema,
1066
1069
  actorUserIdSchema,
1067
1070
  agentInvocationSourceSchema,
@@ -1072,8 +1075,8 @@ export {
1072
1075
  conversationEventPresentationSchema,
1073
1076
  conversationSidebarAnnotationSchema,
1074
1077
  conversationSidebarIconSchema,
1078
+ createEventSource,
1075
1079
  createLocalSource,
1076
- createResourceEventSource,
1077
1080
  createSlackSource,
1078
1081
  createWebSource,
1079
1082
  defineConversationEvent,
@@ -1084,7 +1087,16 @@ export {
1084
1087
  destinationVisibilitySchema,
1085
1088
  dispatchOptionsSchema,
1086
1089
  enforceEgressPolicy,
1087
- eventTaskSourceSchema,
1090
+ eventAutomationSourceSchema,
1091
+ eventDataSchema,
1092
+ eventInputSchema,
1093
+ eventMatchFieldSchema,
1094
+ eventMatchFieldsSchema,
1095
+ eventMatchSchema,
1096
+ eventMatches,
1097
+ eventSchema,
1098
+ eventSourceSchema,
1099
+ eventTypeSchema,
1088
1100
  getSourceKey,
1089
1101
  identitySchema,
1090
1102
  isPrivateSource,
@@ -1095,7 +1107,7 @@ export {
1095
1107
  locationSchema,
1096
1108
  missingToolAnnotationKeys,
1097
1109
  nonBlankStringSchema,
1098
- normalizeResourceEventIdentifier,
1110
+ normalizeEventIdentifier,
1099
1111
  platformSchema,
1100
1112
  pluginApiRouteRequestContextSchema,
1101
1113
  pluginAuthorizationSchema,
@@ -1104,10 +1116,10 @@ export {
1104
1116
  pluginCredentialResultSchema,
1105
1117
  pluginCredentialSubjectSchema,
1106
1118
  pluginDispatchSourceSchema,
1119
+ pluginEventTypeSchema,
1120
+ pluginEventsSchema,
1107
1121
  pluginGrantSchema,
1108
1122
  pluginProviderAccountSchema,
1109
- pluginResourceEventTypeSchema,
1110
- pluginResourceEventsSchema,
1111
1123
  pluginRunContextSchema,
1112
1124
  pluginRunTranscriptEntrySchema,
1113
1125
  pluginRunTranscriptProvenanceSchema,
@@ -1125,31 +1137,22 @@ export {
1125
1137
  promptContextSchema,
1126
1138
  promptMessageSchema,
1127
1139
  replyAttributionSchema,
1128
- resourceEventDataSchema,
1129
- resourceEventInputSchema,
1130
- resourceEventMatchFieldSchema,
1131
- resourceEventMatchFieldsSchema,
1132
- resourceEventMatchSchema,
1133
- resourceEventMatches,
1134
- resourceEventSchema,
1135
- resourceEventSourceSchema,
1136
- resourceEventSubscriptionResultSchema,
1137
- resourceEventTypeSchema,
1138
1140
  resourceLinkAnnotationSchema,
1139
1141
  resourceTypeSchema,
1140
- scheduledTaskSourceSchema,
1142
+ scheduledAutomationSourceSchema,
1141
1143
  slackActorSchema,
1142
1144
  slackDestinationSchema,
1143
1145
  slackLocationSchema,
1144
1146
  slackSourceSchema,
1145
1147
  sourceSchema,
1146
1148
  sourceVisibilitySchema,
1147
- stableResourceEventMatchKey,
1149
+ stableEventMatchKey,
1148
1150
  subscribableResourceSchema,
1149
1151
  systemActorSchema,
1150
1152
  taskOutcomeSchema,
1151
1153
  toolApprovalModeSchema,
1152
1154
  userSchema,
1155
+ watchResultSchema,
1153
1156
  webActorSchema,
1154
1157
  webSourceSchema,
1155
1158
  zodTool
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-plugin-api",
3
- "version": "0.206.0",
3
+ "version": "0.208.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"