@sentry/junior-plugin-api 0.306.0 → 0.307.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
@@ -1,3 +1,4 @@
1
+ import { $ as eventSourceSchema, A as Source, B as createWebSource, C as PluginReranker, D as SlackInvocationContext, E as SlackDestination, F as WebInvocationContext, G as PluginCache, H as isPrivateSource, I as WebSource, J as agentInvocationSourceSchema, K as actorSchema, L as createEventSource, M as SystemActor, N as User, O as SlackLocation, P as WebActor, Q as eventAutomationSourceSchema, R as createLocalSource, S as PluginModel, St as webSourceSchema, T as SlackActor, U as isSlackDestination, V as getSourceKey, W as CacheEntry, X as destinationVisibilitySchema, Y as destinationSchema, Z as dispatchOptionsSchema, _ as PluginDispatchSource, _t as sourceVisibilitySchema, a as EventInvocationContext, at as locationSchema, b as PluginLogger, bt as userSchema, c as InvocationContext, ct as pluginCredentialSubjectSchema, d as LocalInvocationContext, dt as scheduledAutomationSourceSchema, et as identityDispatchOptionsSchema, f as LocalSource, ft as slackActorSchema, g as PluginDecider, gt as sourceSchema, h as PluginContext, ht as slackSourceSchema, i as EventAutomationSource, it as localSourceSchema, j as SourceVisibility, k as SlackSource, l as LocalActor, lt as pluginDispatchSourceSchema, m as Platform, mt as slackLocationSchema, n as AgentInvocationSource, nt as localActorSchema, o as EventSource, ot as nonBlankStringSchema, p as Location, pt as slackDestinationSchema, q as actorUserIdSchema, r as Destination, rt as localDestinationSchema, s as Identity, st as platformSchema, t as Actor, tt as identitySchema, u as LocalDestination, ut as replyAttributionSchema, v as PluginEmbedder, vt as systemActorSchema, w as ScheduledAutomationSource, x as PluginMetadata, xt as webActorSchema, y as PluginEmbeddingInputType, yt as taskOutcomeSchema, z as createSlackSource } from "./context-Buwf8ZyW.js";
1
2
  import * as z from "zod";
2
3
  import { ZodTypeAny } from "zod";
3
4
  import { Command } from "commander";
@@ -135,6 +136,14 @@ export declare const objectFactsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
135
136
  label: z.ZodString;
136
137
  points: z.ZodArray<z.ZodNumber>;
137
138
  }, z.core.$strict>>;
139
+ }, z.core.$strict>, z.ZodObject<{
140
+ type: z.ZodLiteral<"alert">;
141
+ summary: z.ZodOptional<z.ZodString>;
142
+ enabled: z.ZodBoolean;
143
+ projects: z.ZodArray<z.ZodString>;
144
+ trigger: z.ZodOptional<z.ZodString>;
145
+ notifies: z.ZodArray<z.ZodString>;
146
+ lastTriggeredAt: z.ZodOptional<z.ZodISODateTime>;
138
147
  }, z.core.$strict>, z.ZodObject<{
139
148
  type: z.ZodLiteral<"trace">;
140
149
  summary: z.ZodOptional<z.ZodString>;
@@ -201,6 +210,7 @@ type ObjectField = {
201
210
  export declare function objectFactFields(facts: ObjectFacts | undefined): ObjectField[];
202
211
  /** Native object types. `task` is the stored name for a Ticket. */
203
212
  export declare const objectTypeSchema: z.ZodEnum<{
213
+ alert: "alert";
204
214
  automation: "automation";
205
215
  calendar_event: "calendar_event";
206
216
  chart: "chart";
@@ -230,6 +240,7 @@ export declare function objectPresentation(object: {
230
240
  facts?: {
231
241
  type: string;
232
242
  state?: string;
243
+ enabled?: boolean;
233
244
  } | undefined;
234
245
  }): {
235
246
  icon: ObjectIconName;
@@ -261,6 +272,7 @@ export declare const objectAnnotationSchema: z.ZodObject<{
261
272
  key: z.ZodString;
262
273
  label: z.ZodString;
263
274
  objectType: z.ZodEnum<{
275
+ alert: "alert";
264
276
  automation: "automation";
265
277
  calendar_event: "calendar_event";
266
278
  chart: "chart";
@@ -418,6 +430,14 @@ export declare const objectAnnotationSchema: z.ZodObject<{
418
430
  label: z.ZodString;
419
431
  points: z.ZodArray<z.ZodNumber>;
420
432
  }, z.core.$strict>>;
433
+ }, z.core.$strict>, z.ZodObject<{
434
+ type: z.ZodLiteral<"alert">;
435
+ summary: z.ZodOptional<z.ZodString>;
436
+ enabled: z.ZodBoolean;
437
+ projects: z.ZodArray<z.ZodString>;
438
+ trigger: z.ZodOptional<z.ZodString>;
439
+ notifies: z.ZodArray<z.ZodString>;
440
+ lastTriggeredAt: z.ZodOptional<z.ZodISODateTime>;
421
441
  }, z.core.$strict>, z.ZodObject<{
422
442
  type: z.ZodLiteral<"trace">;
423
443
  summary: z.ZodOptional<z.ZodString>;
@@ -474,6 +494,7 @@ export declare const ownedObjectAnnotationSchema: z.ZodObject<{
474
494
  key: z.ZodString;
475
495
  label: z.ZodString;
476
496
  objectType: z.ZodEnum<{
497
+ alert: "alert";
477
498
  automation: "automation";
478
499
  calendar_event: "calendar_event";
479
500
  chart: "chart";
@@ -631,6 +652,14 @@ export declare const ownedObjectAnnotationSchema: z.ZodObject<{
631
652
  label: z.ZodString;
632
653
  points: z.ZodArray<z.ZodNumber>;
633
654
  }, z.core.$strict>>;
655
+ }, z.core.$strict>, z.ZodObject<{
656
+ type: z.ZodLiteral<"alert">;
657
+ summary: z.ZodOptional<z.ZodString>;
658
+ enabled: z.ZodBoolean;
659
+ projects: z.ZodArray<z.ZodString>;
660
+ trigger: z.ZodOptional<z.ZodString>;
661
+ notifies: z.ZodArray<z.ZodString>;
662
+ lastTriggeredAt: z.ZodOptional<z.ZodISODateTime>;
634
663
  }, z.core.$strict>, z.ZodObject<{
635
664
  type: z.ZodLiteral<"trace">;
636
665
  summary: z.ZodOptional<z.ZodString>;
@@ -706,525 +735,6 @@ export declare const objectIconPaths: {
706
735
  package: string[];
707
736
  apps: string[];
708
737
  };
709
- /** Exact non-blank actor user id that rejects the sentinel "unknown". */
710
- export declare const actorUserIdSchema: z.ZodString;
711
- export declare const nonBlankStringSchema: z.ZodString;
712
- /** Complete Slack Location associated with a Conversation. */
713
- export declare const slackLocationSchema: z.ZodObject<{
714
- id: z.ZodString;
715
- provider: z.ZodLiteral<"slack">;
716
- teamId: z.ZodString;
717
- channelId: z.ZodString;
718
- threadTs: z.ZodOptional<z.ZodString>;
719
- }, z.core.$strict>;
720
- /** Complete Location types supported by Junior. */
721
- export declare const locationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
722
- id: z.ZodString;
723
- provider: z.ZodLiteral<"slack">;
724
- teamId: z.ZodString;
725
- channelId: z.ZodString;
726
- threadTs: z.ZodOptional<z.ZodString>;
727
- }, z.core.$strict>], "provider">;
728
- /** Runtime platform names supported by plugin public contracts. */
729
- export declare const platformSchema: z.ZodEnum<{
730
- local: "local";
731
- slack: "slack";
732
- }>;
733
- /** Runtime source visibility visible to plugins. */
734
- export declare const sourceVisibilitySchema: z.ZodEnum<{
735
- private: "private";
736
- public: "public";
737
- }>;
738
- /** Provider-neutral visibility of a routed destination. */
739
- export declare const destinationVisibilitySchema: z.ZodEnum<{
740
- private: "private";
741
- public: "public";
742
- }>;
743
- /** Runtime-owned Slack address for routing future work or side effects. */
744
- export declare const slackDestinationSchema: z.ZodObject<{
745
- platform: z.ZodLiteral<"slack">;
746
- teamId: z.ZodString;
747
- channelId: z.ZodString;
748
- threadTs: z.ZodOptional<z.ZodString>;
749
- }, z.core.$strict>;
750
- /** Runtime-owned local CLI conversation address. */
751
- export declare const localDestinationSchema: z.ZodObject<{
752
- platform: z.ZodLiteral<"local">;
753
- conversationId: z.ZodString;
754
- }, z.core.$strict>;
755
- /** Runtime-owned provider-neutral address for routing future work or side effects. */
756
- export declare const destinationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
757
- platform: z.ZodLiteral<"slack">;
758
- teamId: z.ZodString;
759
- channelId: z.ZodString;
760
- threadTs: z.ZodOptional<z.ZodString>;
761
- }, z.core.$strict>, z.ZodObject<{
762
- platform: z.ZodLiteral<"local">;
763
- conversationId: z.ZodString;
764
- }, z.core.$strict>], "platform">;
765
- /** One visible effect after successful automated work. */
766
- export declare const taskOutcomeSchema: z.ZodObject<{
767
- action: z.ZodLiteral<"send_message">;
768
- destination: z.ZodObject<{
769
- platform: z.ZodLiteral<"slack">;
770
- teamId: z.ZodString;
771
- channelId: z.ZodString;
772
- threadTs: z.ZodOptional<z.ZodString>;
773
- }, z.core.$strict>;
774
- }, z.core.$strict>;
775
- /** Runtime-owned Slack input Source. */
776
- export declare const slackSourceSchema: z.ZodObject<{
777
- kind: z.ZodLiteral<"slack">;
778
- teamId: z.ZodString;
779
- channelId: z.ZodString;
780
- visibility: z.ZodEnum<{
781
- private: "private";
782
- public: "public";
783
- }>;
784
- messageTs: z.ZodOptional<z.ZodString>;
785
- threadTs: z.ZodOptional<z.ZodString>;
786
- }, z.core.$strict>;
787
- /** Runtime-owned local CLI input Source. */
788
- export declare const localSourceSchema: z.ZodObject<{
789
- kind: z.ZodLiteral<"local">;
790
- visibility: z.ZodLiteral<"private">;
791
- conversationId: z.ZodString;
792
- }, z.core.$strict>;
793
- /** Runtime-owned dashboard input Source. */
794
- export declare const webSourceSchema: z.ZodObject<{
795
- kind: z.ZodLiteral<"web">;
796
- visibility: z.ZodEnum<{
797
- private: "private";
798
- public: "public";
799
- }>;
800
- conversationId: z.ZodString;
801
- }, z.core.$strict>;
802
- /** Runtime-owned Event input Source. */
803
- export declare const eventSourceSchema: z.ZodObject<{
804
- kind: z.ZodLiteral<"event">;
805
- eventKey: z.ZodString;
806
- eventType: z.ZodString;
807
- identifier: z.ZodString;
808
- namespace: z.ZodString;
809
- }, z.core.$strict>;
810
- /** Runtime-owned Scheduled automation input Source. */
811
- export declare const scheduledAutomationSourceSchema: z.ZodObject<{
812
- automationId: z.ZodOptional<z.ZodString>;
813
- automationRunId: z.ZodOptional<z.ZodString>;
814
- kind: z.ZodLiteral<"scheduled_automation">;
815
- }, z.core.$strict>;
816
- /** Runtime-owned Event automation input Source. */
817
- export declare const eventAutomationSourceSchema: z.ZodObject<{
818
- automationId: z.ZodOptional<z.ZodString>;
819
- automationRunId: z.ZodOptional<z.ZodString>;
820
- kind: z.ZodLiteral<"event_automation">;
821
- }, z.core.$strict>;
822
- /** Runtime-owned Plugin dispatch input Source. */
823
- export declare const pluginDispatchSourceSchema: z.ZodObject<{
824
- kind: z.ZodLiteral<"plugin_dispatch">;
825
- }, z.core.$strict>;
826
- /** Runtime-owned Agent invocation input Source. */
827
- export declare const agentInvocationSourceSchema: z.ZodObject<{
828
- kind: z.ZodLiteral<"agent_invocation">;
829
- }, z.core.$strict>;
830
- /** Runtime-owned input Source. Stored `platform` and Location fields normalize on read. */
831
- export declare const sourceSchema: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
832
- kind: z.ZodLiteral<"slack">;
833
- teamId: z.ZodString;
834
- channelId: z.ZodString;
835
- visibility: z.ZodEnum<{
836
- private: "private";
837
- public: "public";
838
- }>;
839
- messageTs: z.ZodOptional<z.ZodString>;
840
- threadTs: z.ZodOptional<z.ZodString>;
841
- }, z.core.$strict>, z.ZodObject<{
842
- kind: z.ZodLiteral<"local">;
843
- visibility: z.ZodLiteral<"private">;
844
- conversationId: z.ZodString;
845
- }, z.core.$strict>, z.ZodObject<{
846
- kind: z.ZodLiteral<"web">;
847
- visibility: z.ZodEnum<{
848
- private: "private";
849
- public: "public";
850
- }>;
851
- conversationId: z.ZodString;
852
- }, z.core.$strict>, z.ZodObject<{
853
- kind: z.ZodLiteral<"event">;
854
- eventKey: z.ZodString;
855
- eventType: z.ZodString;
856
- identifier: z.ZodString;
857
- namespace: z.ZodString;
858
- }, z.core.$strict>, z.ZodObject<{
859
- automationId: z.ZodOptional<z.ZodString>;
860
- automationRunId: z.ZodOptional<z.ZodString>;
861
- kind: z.ZodLiteral<"scheduled_automation">;
862
- }, z.core.$strict>, z.ZodObject<{
863
- automationId: z.ZodOptional<z.ZodString>;
864
- automationRunId: z.ZodOptional<z.ZodString>;
865
- kind: z.ZodLiteral<"event_automation">;
866
- }, z.core.$strict>, z.ZodObject<{
867
- kind: z.ZodLiteral<"plugin_dispatch">;
868
- }, z.core.$strict>, z.ZodObject<{
869
- kind: z.ZodLiteral<"agent_invocation">;
870
- }, z.core.$strict>], "kind">, unknown>;
871
- /** Stable user credential subject shape accepted from plugins. */
872
- export declare const pluginCredentialSubjectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
873
- type: z.ZodLiteral<"user">;
874
- userId: z.ZodString;
875
- allowedWhen: z.ZodLiteral<"private-direct-conversation">;
876
- }, z.core.$strict>, z.ZodObject<{
877
- type: z.ZodLiteral<"user">;
878
- userId: z.ZodString;
879
- allowedWhen: z.ZodLiteral<"scheduled-automation">;
880
- taskId: z.ZodString;
881
- }, z.core.$strict>], "allowedWhen">;
882
- export declare const slackActorSchema: z.ZodObject<{
883
- email: z.ZodOptional<z.ZodString>;
884
- fullName: z.ZodOptional<z.ZodString>;
885
- userId: z.ZodString;
886
- userName: z.ZodOptional<z.ZodString>;
887
- platform: z.ZodLiteral<"slack">;
888
- teamId: z.ZodString;
889
- }, z.core.$strict>;
890
- export declare const localActorSchema: z.ZodObject<{
891
- email: z.ZodOptional<z.ZodString>;
892
- fullName: z.ZodOptional<z.ZodString>;
893
- userId: z.ZodString;
894
- userName: z.ZodOptional<z.ZodString>;
895
- platform: z.ZodLiteral<"local">;
896
- }, z.core.$strict>;
897
- export declare const webActorSchema: z.ZodObject<{
898
- email: z.ZodOptional<z.ZodString>;
899
- fullName: z.ZodOptional<z.ZodString>;
900
- userId: z.ZodString;
901
- userName: z.ZodOptional<z.ZodString>;
902
- platform: z.ZodLiteral<"web">;
903
- }, z.core.$strict>;
904
- export declare const systemActorSchema: z.ZodObject<{
905
- platform: z.ZodLiteral<"system">;
906
- name: z.ZodString;
907
- }, z.core.$strict>;
908
- /** Runtime-provided actor identity visible to plugin hooks. */
909
- export declare const actorSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
910
- email: z.ZodOptional<z.ZodString>;
911
- fullName: z.ZodOptional<z.ZodString>;
912
- userId: z.ZodString;
913
- userName: z.ZodOptional<z.ZodString>;
914
- platform: z.ZodLiteral<"slack">;
915
- teamId: z.ZodString;
916
- }, z.core.$strict>, z.ZodObject<{
917
- email: z.ZodOptional<z.ZodString>;
918
- fullName: z.ZodOptional<z.ZodString>;
919
- userId: z.ZodString;
920
- userName: z.ZodOptional<z.ZodString>;
921
- platform: z.ZodLiteral<"local">;
922
- }, z.core.$strict>, z.ZodObject<{
923
- email: z.ZodOptional<z.ZodString>;
924
- fullName: z.ZodOptional<z.ZodString>;
925
- userId: z.ZodString;
926
- userName: z.ZodOptional<z.ZodString>;
927
- platform: z.ZodLiteral<"web">;
928
- }, z.core.$strict>, z.ZodObject<{
929
- platform: z.ZodLiteral<"system">;
930
- name: z.ZodString;
931
- }, z.core.$strict>], "platform">;
932
- /** Core-owned provider account linked to a user when verified. */
933
- export declare const identitySchema: z.ZodObject<{
934
- displayName: z.ZodOptional<z.ZodString>;
935
- handle: z.ZodOptional<z.ZodString>;
936
- id: z.ZodString;
937
- provider: z.ZodString;
938
- providerSubjectId: z.ZodString;
939
- providerTenantId: z.ZodOptional<z.ZodString>;
940
- }, z.core.$strict>;
941
- /** Core-owned person with every linked provider identity. */
942
- export declare const userSchema: z.ZodObject<{
943
- displayName: z.ZodOptional<z.ZodString>;
944
- email: z.ZodString;
945
- id: z.ZodString;
946
- identities: z.ZodArray<z.ZodObject<{
947
- displayName: z.ZodOptional<z.ZodString>;
948
- handle: z.ZodOptional<z.ZodString>;
949
- id: z.ZodString;
950
- provider: z.ZodString;
951
- providerSubjectId: z.ZodString;
952
- providerTenantId: z.ZodOptional<z.ZodString>;
953
- }, z.core.$strict>>;
954
- isAdmin: z.ZodOptional<z.ZodLiteral<true>>;
955
- }, z.core.$strict>;
956
- /** Compact destination-visible context explaining what produced a reply. */
957
- export declare const replyAttributionSchema: z.ZodObject<{
958
- label: z.ZodPipe<z.ZodString, z.ZodString>;
959
- detail: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
960
- }, z.core.$strict>;
961
- /**
962
- * Plugin request to start work for one person. `input` becomes that person's
963
- * first Message in a new public Conversation, so it must be what they asked
964
- * for, not text that someone else wrote. Name the person by exactly one of:
965
- *
966
- * - `subjectId`: the provider account id that the OAuth account-linking flow
967
- * stored. Core binds the provider to the calling plugin.
968
- * - `verifiedEmail`: an address that the plugin proved this person sent from,
969
- * such as the From address of an email that passed DMARC. Never an address
970
- * that only appears in content.
971
- */
972
- export declare const identityDispatchOptionsSchema: z.ZodUnion<readonly [z.ZodObject<{
973
- idempotencyKey: z.ZodPipe<z.ZodString, z.ZodString>;
974
- input: z.ZodPipe<z.ZodString, z.ZodString>;
975
- subjectId: z.ZodPipe<z.ZodString, z.ZodString>;
976
- }, z.core.$strict>, z.ZodObject<{
977
- idempotencyKey: z.ZodPipe<z.ZodString, z.ZodString>;
978
- input: z.ZodPipe<z.ZodString, z.ZodString>;
979
- verifiedEmail: z.ZodEmail;
980
- }, z.core.$strict>]>;
981
- /** Plugin dispatch request accepted by Junior core. */
982
- export declare const dispatchOptionsSchema: z.ZodObject<{
983
- idempotencyKey: z.ZodPipe<z.ZodString, z.ZodString>;
984
- credentialSubject: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
985
- type: z.ZodLiteral<"user">;
986
- userId: z.ZodString;
987
- allowedWhen: z.ZodLiteral<"private-direct-conversation">;
988
- }, z.core.$strict>, z.ZodObject<{
989
- type: z.ZodLiteral<"user">;
990
- userId: z.ZodString;
991
- allowedWhen: z.ZodLiteral<"scheduled-automation">;
992
- taskId: z.ZodString;
993
- }, z.core.$strict>], "allowedWhen">>;
994
- destination: z.ZodObject<{
995
- platform: z.ZodLiteral<"slack">;
996
- teamId: z.ZodString;
997
- channelId: z.ZodString;
998
- threadTs: z.ZodOptional<z.ZodString>;
999
- }, z.core.$strict>;
1000
- destinationVisibility: z.ZodEnum<{
1001
- private: "private";
1002
- public: "public";
1003
- }>;
1004
- input: z.ZodPipe<z.ZodString, z.ZodString>;
1005
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1006
- replyAttribution: z.ZodOptional<z.ZodObject<{
1007
- label: z.ZodPipe<z.ZodString, z.ZodString>;
1008
- detail: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
1009
- }, z.core.$strict>>;
1010
- title: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
1011
- }, z.core.$strict>;
1012
- /** A loaded value and how long to cache it. */
1013
- export interface CacheEntry<T> {
1014
- /** Omit to return the value without caching it, such as for an incomplete response. */
1015
- ttlMs?: number;
1016
- /** Must survive JSON serialization. */
1017
- value: T;
1018
- }
1019
- /**
1020
- * Short-lived copies of values that are slow or costly to load, such as
1021
- * provider API reads. Junior can drop an entry at any time. A lost entry only
1022
- * costs a reload, so never keep data here that Junior must not lose. Use
1023
- * `PluginState` for that.
1024
- */
1025
- export interface PluginCache {
1026
- /**
1027
- * Return the cached value for `key`, or call `load` and cache its result.
1028
- * Concurrent callers share one load. A load that throws is not cached.
1029
- * `refresh` ignores the cached value and replaces it.
1030
- */
1031
- getOrLoad<T>(key: string, load: () => Promise<CacheEntry<T>>, options?: {
1032
- refresh?: boolean;
1033
- }): Promise<T>;
1034
- }
1035
- /** Runtime platform name without source or destination coordinates. */
1036
- export type Platform = z.output<typeof platformSchema>;
1037
- export type Actor = z.output<typeof actorSchema>;
1038
- export type SlackActor = z.output<typeof slackActorSchema>;
1039
- export type LocalActor = z.output<typeof localActorSchema>;
1040
- export type WebActor = z.output<typeof webActorSchema>;
1041
- export type SystemActor = z.output<typeof systemActorSchema>;
1042
- export type Identity = z.output<typeof identitySchema>;
1043
- export type User = z.output<typeof userSchema>;
1044
- export type Source = z.output<typeof sourceSchema>;
1045
- /** Validated Location associated with a Conversation. */
1046
- export type Location = z.output<typeof locationSchema>;
1047
- /** Complete Slack Location associated with a Conversation. */
1048
- export type SlackLocation = z.output<typeof slackLocationSchema>;
1049
- export type SlackSource = Extract<Source, {
1050
- kind: "slack";
1051
- }>;
1052
- export type LocalSource = Extract<Source, {
1053
- kind: "local";
1054
- }>;
1055
- export type WebSource = Extract<Source, {
1056
- kind: "web";
1057
- }>;
1058
- export type EventSource = Extract<Source, {
1059
- kind: "event";
1060
- }>;
1061
- export type ScheduledAutomationSource = Extract<Source, {
1062
- kind: "scheduled_automation";
1063
- }>;
1064
- export type EventAutomationSource = Extract<Source, {
1065
- kind: "event_automation";
1066
- }>;
1067
- export type PluginDispatchSource = Extract<Source, {
1068
- kind: "plugin_dispatch";
1069
- }>;
1070
- export type AgentInvocationSource = Extract<Source, {
1071
- kind: "agent_invocation";
1072
- }>;
1073
- export type SourceVisibility = z.output<typeof sourceVisibilitySchema>;
1074
- export type Destination = z.output<typeof destinationSchema>;
1075
- export type SlackDestination = Extract<Destination, {
1076
- platform: "slack";
1077
- }>;
1078
- export type LocalDestination = Extract<Destination, {
1079
- platform: "local";
1080
- }>;
1081
- export interface PluginMetadata {
1082
- name: string;
1083
- }
1084
- export interface PluginLogger {
1085
- error(message: string, metadata?: Record<string, unknown>): void;
1086
- info(message: string, metadata?: Record<string, unknown>): void;
1087
- warn(message: string, metadata?: Record<string, unknown>): void;
1088
- }
1089
- export interface PluginModel {
1090
- /** Run a host-owned structured model call without exposing provider credentials. */
1091
- completeObject<TSchema extends ZodTypeAny>(input: {
1092
- maxTokens?: number;
1093
- prompt: string;
1094
- schema: TSchema;
1095
- system?: string;
1096
- }): Promise<{
1097
- /** Best-effort estimated provider cost for this completion. */
1098
- costUsd?: number;
1099
- object: z.infer<TSchema>;
1100
- }>;
1101
- }
1102
- /** Host decision model: a fast classifier for one narrow choice, with no reasoning. */
1103
- export interface PluginDecider {
1104
- /**
1105
- * Pick the choice whose criteria fit `state`. `instructions` say what to
1106
- * judge. Keep the state as evidence only; it is not instructions.
1107
- */
1108
- decide<TChoice extends string>(input: {
1109
- criteria: Record<TChoice, string>;
1110
- instructions: string;
1111
- state: string;
1112
- }): Promise<{
1113
- choice: TChoice;
1114
- /** Best-effort estimated provider cost for this decision. */
1115
- costUsd?: number;
1116
- /** Probability of each choice, when the provider returns them. */
1117
- probabilities?: Partial<Record<TChoice, number>>;
1118
- }>;
1119
- }
1120
- /** How embedded text is used. Some models embed queries and documents differently. */
1121
- export type PluginEmbeddingInputType = "document" | "query";
1122
- export interface PluginEmbedder {
1123
- /** Configured embedding model id; embedTexts() reports the same value. */
1124
- model: string;
1125
- /** Provider name that embedTexts() reports. */
1126
- provider: string;
1127
- /** Embed plugin-owned text for derived retrieval without exposing provider credentials. */
1128
- embedTexts(input: {
1129
- inputType?: PluginEmbeddingInputType;
1130
- texts: string[];
1131
- }): Promise<{
1132
- /** Best-effort estimated provider cost for this embedding call. */
1133
- costUsd?: number;
1134
- dimensions: number;
1135
- model: string;
1136
- provider: string;
1137
- vectors: number[][];
1138
- }>;
1139
- }
1140
- export interface PluginReranker {
1141
- /** Score plugin-owned documents against one query without exposing provider credentials. */
1142
- rerank(input: {
1143
- documents: string[];
1144
- query: string;
1145
- }): Promise<{
1146
- /** Best-effort provider cost for this reranking call. */
1147
- costUsd?: number;
1148
- /** One relevance score per document, in input order. Higher is more relevant. */
1149
- scores: number[];
1150
- }>;
1151
- }
1152
- export interface PluginContext {
1153
- /** Short-lived cache scoped to this plugin. */
1154
- cache: PluginCache;
1155
- /** Shared Drizzle database connection for plugin runtime code. */
1156
- db: unknown;
1157
- log: PluginLogger;
1158
- plugin: PluginMetadata;
1159
- }
1160
- interface BaseInvocationContext {
1161
- /**
1162
- * Opaque Junior conversation/session identity for this invocation.
1163
- * Interactive Slack turns use `slack:{channelId}:{threadTs}`.
1164
- */
1165
- conversationId?: string;
1166
- /** Location associated with this Conversation. */
1167
- locationId?: string | undefined;
1168
- }
1169
- export interface SlackInvocationContext extends BaseInvocationContext {
1170
- /** Runtime-owned default outbound destination for this invocation. */
1171
- destination: SlackDestination;
1172
- actor?: SlackActor | undefined;
1173
- /** Runtime-owned source where the invocation came from. */
1174
- source: SlackSource;
1175
- }
1176
- export interface LocalInvocationContext extends BaseInvocationContext {
1177
- /** Runtime-owned default outbound destination for this invocation. */
1178
- destination: LocalDestination;
1179
- actor?: LocalActor | undefined;
1180
- /** Runtime-owned source where the invocation came from. */
1181
- source: LocalSource;
1182
- }
1183
- export interface WebInvocationContext extends BaseInvocationContext {
1184
- /** Existing conversation destination used for location and tool context. */
1185
- destination: Destination;
1186
- actor?: WebActor | undefined;
1187
- /** Runtime-owned dashboard/web source for this invocation. */
1188
- source: WebSource;
1189
- }
1190
- export interface EventInvocationContext extends BaseInvocationContext {
1191
- /** Existing conversation destination used for tool context. */
1192
- destination: Destination;
1193
- actor?: Actor;
1194
- /** Runtime-owned Event Source for this invocation. */
1195
- source: EventSource;
1196
- }
1197
- export type InvocationContext = LocalInvocationContext | SlackInvocationContext | WebInvocationContext | (BaseInvocationContext & {
1198
- destination: Destination;
1199
- actor?: Actor | undefined;
1200
- source: AgentInvocationSource | EventAutomationSource | PluginDispatchSource | EventSource | ScheduledAutomationSource;
1201
- });
1202
- /** Build a normalized Slack source from runtime-owned Slack coordinates. */
1203
- export declare function createSlackSource(input: {
1204
- channelId: string;
1205
- messageTs?: string | undefined;
1206
- teamId: string;
1207
- threadTs?: string | undefined;
1208
- /** Runtime-normalized source visibility. */
1209
- visibility: SourceVisibility;
1210
- }): SlackSource;
1211
- /** Build a normalized local source from a local conversation id. */
1212
- export declare function createLocalSource(conversationId: string): LocalSource;
1213
- /** Build a normalized web/dashboard source from a conversation id. */
1214
- export declare function createWebSource(conversationId: string, visibility?: SourceVisibility): WebSource;
1215
- /** Build a normalized Event Source from one matched event. */
1216
- export declare function createEventSource(input: {
1217
- eventKey: string;
1218
- eventType: string;
1219
- identifier: string;
1220
- namespace: string;
1221
- }): EventSource;
1222
- /** Return whether a source is private to a person or restricted group. */
1223
- export declare function isPrivateSource(source: Source): boolean;
1224
- /** Return the stable source identity used for idempotency and attribution. */
1225
- export declare function getSourceKey(source: Source): string | undefined;
1226
- /** Narrow a runtime destination to the Slack-specific address shape. */
1227
- export declare function isSlackDestination(destination: Destination | undefined): destination is SlackDestination;
1228
738
  declare const pluginGrantAccessSchema: z.ZodUnion<readonly [z.ZodLiteral<"read">, z.ZodLiteral<"write">]>;
1229
739
  /** Runtime schema for provider authorization a plugin may request. */
1230
740
  export declare const pluginAuthorizationSchema: z.ZodObject<{
@@ -1446,6 +956,12 @@ export interface PluginEgressRequest {
1446
956
  /** Plugin-declared operation this request performs, used for grant classification and diagnostics. */
1447
957
  operation?: string;
1448
958
  url: string;
959
+ /**
960
+ * Set when Junior adds no credential, because the Sandbox request carries
961
+ * its own or asks for none. The returned grant is not used. Throw
962
+ * `EgressPolicyDenied` here only for rules that hold for any credential.
963
+ */
964
+ withoutCredential?: true;
1449
965
  }
1450
966
  export interface EgressHookContext extends PluginContext {
1451
967
  request: PluginEgressRequest;
@@ -1513,6 +1029,7 @@ export interface IssueCredentialHookContext extends PluginContext {
1513
1029
  export declare const resourceLinkAnnotationSchema: z.ZodObject<{
1514
1030
  kind: z.ZodLiteral<"resource_link">;
1515
1031
  objectType: z.ZodOptional<z.ZodEnum<{
1032
+ alert: "alert";
1516
1033
  automation: "automation";
1517
1034
  calendar_event: "calendar_event";
1518
1035
  chart: "chart";
@@ -1547,6 +1064,7 @@ export declare const resourceLinkAnnotationSchema: z.ZodObject<{
1547
1064
  export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1548
1065
  kind: z.ZodLiteral<"resource_link">;
1549
1066
  objectType: z.ZodOptional<z.ZodEnum<{
1067
+ alert: "alert";
1550
1068
  automation: "automation";
1551
1069
  calendar_event: "calendar_event";
1552
1070
  chart: "chart";
@@ -1581,6 +1099,7 @@ export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<
1581
1099
  key: z.ZodString;
1582
1100
  label: z.ZodString;
1583
1101
  objectType: z.ZodEnum<{
1102
+ alert: "alert";
1584
1103
  automation: "automation";
1585
1104
  calendar_event: "calendar_event";
1586
1105
  chart: "chart";
@@ -1738,6 +1257,14 @@ export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<
1738
1257
  label: z.ZodString;
1739
1258
  points: z.ZodArray<z.ZodNumber>;
1740
1259
  }, z.core.$strict>>;
1260
+ }, z.core.$strict>, z.ZodObject<{
1261
+ type: z.ZodLiteral<"alert">;
1262
+ summary: z.ZodOptional<z.ZodString>;
1263
+ enabled: z.ZodBoolean;
1264
+ projects: z.ZodArray<z.ZodString>;
1265
+ trigger: z.ZodOptional<z.ZodString>;
1266
+ notifies: z.ZodArray<z.ZodString>;
1267
+ lastTriggeredAt: z.ZodOptional<z.ZodISODateTime>;
1741
1268
  }, z.core.$strict>, z.ZodObject<{
1742
1269
  type: z.ZodLiteral<"trace">;
1743
1270
  summary: z.ZodOptional<z.ZodString>;
@@ -1826,6 +1353,7 @@ export declare const conversationSidebarAnnotationSchema: z.ZodObject<{
1826
1353
  "triangle-alert": "triangle-alert";
1827
1354
  }>>;
1828
1355
  objectType: z.ZodOptional<z.ZodEnum<{
1356
+ alert: "alert";
1829
1357
  automation: "automation";
1830
1358
  calendar_event: "calendar_event";
1831
1359
  chart: "chart";
@@ -2089,6 +1617,7 @@ export declare const eventAuthorSchema: z.ZodObject<{
2089
1617
  export type EventAuthor = z.output<typeof eventAuthorSchema>;
2090
1618
  export declare const eventInputSchema: z.ZodObject<{
2091
1619
  objectType: z.ZodOptional<z.ZodEnum<{
1620
+ alert: "alert";
2092
1621
  automation: "automation";
2093
1622
  calendar_event: "calendar_event";
2094
1623
  chart: "chart";
@@ -2133,6 +1662,7 @@ export type EventData = z.output<typeof eventDataSchema>;
2133
1662
  export type EventInput = z.output<typeof eventInputSchema>;
2134
1663
  export declare const eventSchema: z.ZodObject<{
2135
1664
  objectType: z.ZodOptional<z.ZodEnum<{
1665
+ alert: "alert";
2136
1666
  automation: "automation";
2137
1667
  calendar_event: "calendar_event";
2138
1668
  chart: "chart";
@@ -2206,8 +1736,22 @@ export interface PluginState {
2206
1736
  get<T = unknown>(key: string): Promise<T | undefined>;
2207
1737
  set(key: string, value: unknown, ttlMs?: number): Promise<void>;
2208
1738
  setIfNotExists(key: string, value: unknown, ttlMs?: number): Promise<boolean>;
2209
- withLock<T>(key: string, ttlMs: number, callback: () => Promise<T>): Promise<T>;
1739
+ /**
1740
+ * Run `callback` only when no other caller holds `key`, waiting up to
1741
+ * `waitMs` (default 0) for the holder. A held lock is a normal outcome, so
1742
+ * it returns `{ acquired: false }` instead of throwing.
1743
+ */
1744
+ withLock<T>(key: string, ttlMs: number, callback: () => Promise<T>, options?: {
1745
+ waitMs?: number;
1746
+ }): Promise<PluginLockResult<T>>;
2210
1747
  }
1748
+ /** Outcome of `PluginState.withLock`. */
1749
+ export type PluginLockResult<T> = {
1750
+ acquired: false;
1751
+ } | {
1752
+ acquired: true;
1753
+ value: T;
1754
+ };
2211
1755
  export interface PluginReadState {
2212
1756
  get<T = unknown>(key: string): Promise<T | undefined>;
2213
1757
  }
@@ -2495,6 +2039,7 @@ export declare const pluginToolOutputSchema: z.ZodObject<{
2495
2039
  key: z.ZodString;
2496
2040
  label: z.ZodString;
2497
2041
  objectType: z.ZodEnum<{
2042
+ alert: "alert";
2498
2043
  automation: "automation";
2499
2044
  calendar_event: "calendar_event";
2500
2045
  chart: "chart";
@@ -2652,6 +2197,14 @@ export declare const pluginToolOutputSchema: z.ZodObject<{
2652
2197
  label: z.ZodString;
2653
2198
  points: z.ZodArray<z.ZodNumber>;
2654
2199
  }, z.core.$strict>>;
2200
+ }, z.core.$strict>, z.ZodObject<{
2201
+ type: z.ZodLiteral<"alert">;
2202
+ summary: z.ZodOptional<z.ZodString>;
2203
+ enabled: z.ZodBoolean;
2204
+ projects: z.ZodArray<z.ZodString>;
2205
+ trigger: z.ZodOptional<z.ZodString>;
2206
+ notifies: z.ZodArray<z.ZodString>;
2207
+ lastTriggeredAt: z.ZodOptional<z.ZodISODateTime>;
2655
2208
  }, z.core.$strict>, z.ZodObject<{
2656
2209
  type: z.ZodLiteral<"trace">;
2657
2210
  summary: z.ZodOptional<z.ZodString>;
@@ -4289,6 +3842,13 @@ export interface PluginManifest {
4289
3842
  mcp?: PluginMcpConfig;
4290
3843
  name: string;
4291
3844
  oauth?: PluginOAuthConfig;
3845
+ /**
3846
+ * Facts for action review about where this plugin's writes go, such as
3847
+ * which of them people outside the organization can read. Guardian reads
3848
+ * it in its system prompt. The agent never sees it, and it never grants
3849
+ * authority.
3850
+ */
3851
+ reviewContext?: string;
4292
3852
  runtimeDependencies?: PluginRuntimeDependency[];
4293
3853
  runtimePostinstall?: PluginRuntimePostinstallCommand[];
4294
3854
  target?: {
@@ -4296,6 +3856,12 @@ export interface PluginManifest {
4296
3856
  configKey: string;
4297
3857
  type: string;
4298
3858
  };
3859
+ /**
3860
+ * Set when the plugin's own Sandbox tools, such as git, send no credential.
3861
+ * A Sandbox request to its domains with no credential then gets one.
3862
+ * Otherwise only a request that sends the plugin's placeholder gets one.
3863
+ */
3864
+ toolsSendNoCredential?: boolean;
4299
3865
  }
4300
3866
  /** Bounded list content returned by a plugin-owned user page. */
4301
3867
  export declare const pluginUserPageContentSchema: z.ZodObject<{
@@ -4418,4 +3984,4 @@ export type PluginRegistrationInput = {
4418
3984
  export interface PluginRegistration extends PluginRegistrationInput {}
4419
3985
  /** Define one Junior plugin registration for app and build-time wiring. */
4420
3986
  export declare function defineJuniorPlugin(plugin: PluginRegistrationInput): PluginRegistration;
4421
- export type { PromptContext, PromptContextContribution, PromptMessage, SystemPromptContext, UserPromptContext, UserPromptContribution };
3987
+ export { Actor, AgentInvocationSource, CacheEntry, Destination, EventAutomationSource, EventInvocationContext, EventSource, Identity, InvocationContext, LocalActor, LocalDestination, LocalInvocationContext, LocalSource, Location, Platform, PluginCache, PluginContext, PluginDecider, PluginDispatchSource, PluginEmbedder, PluginEmbeddingInputType, PluginLogger, PluginMetadata, PluginModel, PluginReranker, type PromptContext, type PromptContextContribution, type PromptMessage, ScheduledAutomationSource, SlackActor, SlackDestination, SlackInvocationContext, SlackLocation, SlackSource, Source, SourceVisibility, SystemActor, type SystemPromptContext, User, type UserPromptContext, type UserPromptContribution, WebActor, WebInvocationContext, WebSource, actorSchema, actorUserIdSchema, agentInvocationSourceSchema, createEventSource, createLocalSource, createSlackSource, createWebSource, destinationSchema, destinationVisibilitySchema, dispatchOptionsSchema, eventAutomationSourceSchema, eventSourceSchema, getSourceKey, identityDispatchOptionsSchema, identitySchema, isPrivateSource, isSlackDestination, localActorSchema, localDestinationSchema, localSourceSchema, locationSchema, nonBlankStringSchema, platformSchema, pluginCredentialSubjectSchema, pluginDispatchSourceSchema, replyAttributionSchema, scheduledAutomationSourceSchema, slackActorSchema, slackDestinationSchema, slackLocationSchema, slackSourceSchema, sourceSchema, sourceVisibilitySchema, systemActorSchema, taskOutcomeSchema, userSchema, webActorSchema, webSourceSchema };