@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 +2 -2
- package/dist/index.d.ts +90 -74
- package/dist/index.js +96 -93
- package/package.json +1 -1
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.
|
|
46
|
-
scheduled
|
|
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
|
|
98
|
-
declare const
|
|
99
|
-
kind: z.ZodLiteral<"
|
|
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
|
|
106
|
-
declare const
|
|
107
|
-
kind: z.ZodLiteral<"
|
|
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
|
|
110
|
-
declare const
|
|
111
|
-
kind: z.ZodLiteral<"
|
|
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<"
|
|
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<"
|
|
150
|
+
kind: z.ZodLiteral<"scheduled_automation">;
|
|
151
151
|
}, z.core.$strict>, z.ZodObject<{
|
|
152
|
-
kind: z.ZodLiteral<"
|
|
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-
|
|
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-
|
|
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
|
|
302
|
-
kind: "
|
|
301
|
+
type EventSource = Extract<Source, {
|
|
302
|
+
kind: "event";
|
|
303
303
|
}>;
|
|
304
|
-
type
|
|
305
|
-
kind: "
|
|
304
|
+
type ScheduledAutomationSource = Extract<Source, {
|
|
305
|
+
kind: "scheduled_automation";
|
|
306
306
|
}>;
|
|
307
|
-
type
|
|
308
|
-
kind: "
|
|
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
|
|
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
|
|
399
|
-
source:
|
|
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 |
|
|
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
|
|
420
|
-
declare function
|
|
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
|
-
}):
|
|
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
|
|
705
|
-
declare const
|
|
706
|
-
declare const
|
|
707
|
-
declare const
|
|
708
|
-
declare const
|
|
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
|
|
723
|
+
declare const eventDataSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
711
724
|
/** Canonical dotted event type published and selected across plugins. */
|
|
712
|
-
declare const
|
|
725
|
+
declare const eventTypeSchema: z.ZodString;
|
|
713
726
|
declare const resourceTypeSchema: z.ZodString;
|
|
714
|
-
/** One exact value a watch or event
|
|
715
|
-
declare const
|
|
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
|
|
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
|
|
734
|
-
declare const
|
|
735
|
-
type
|
|
736
|
-
type
|
|
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
|
|
751
|
+
declare function stableEventMatchKey(match: EventMatch | undefined): string;
|
|
739
752
|
/** Return whether trusted event data matches one exact match object. */
|
|
740
|
-
declare function
|
|
741
|
-
declare const
|
|
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
|
|
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
|
|
776
|
-
type
|
|
777
|
-
/** Apply a plugin's identifier convention at
|
|
778
|
-
declare function
|
|
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
|
|
789
|
-
declare const
|
|
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
|
|
794
|
-
declare const
|
|
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
|
|
805
|
-
type
|
|
806
|
-
declare const
|
|
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
|
|
818
|
-
interface
|
|
819
|
-
/** Return whether an active watch or event
|
|
820
|
-
hasMatch?(event:
|
|
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:
|
|
835
|
+
publish(event: EventInput): Promise<void>;
|
|
823
836
|
/**
|
|
824
|
-
* Return match keys used by active watches or event
|
|
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<"
|
|
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<"
|
|
1023
|
+
kind: z.ZodLiteral<"scheduled_automation">;
|
|
1011
1024
|
}, z.core.$strict>, z.ZodObject<{
|
|
1012
|
-
kind: z.ZodLiteral<"
|
|
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
|
-
|
|
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
|
|
1710
|
-
/** Whether this invocation can create a working
|
|
1725
|
+
interface PluginEventToolContext {
|
|
1726
|
+
/** Whether this invocation can create a working watch. */
|
|
1711
1727
|
canSubscribe: boolean;
|
|
1712
|
-
/** Create a temporary
|
|
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<
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
178
|
-
kind: z4.literal("
|
|
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
|
|
185
|
-
var
|
|
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
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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
|
|
204
|
-
|
|
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-
|
|
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
|
|
368
|
+
function createEventSource(input) {
|
|
363
369
|
return {
|
|
364
|
-
kind: "
|
|
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 "
|
|
387
|
-
return `
|
|
388
|
-
case "
|
|
389
|
-
case "
|
|
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/
|
|
427
|
+
// src/events.ts
|
|
422
428
|
import { z as z6 } from "zod";
|
|
423
|
-
var
|
|
424
|
-
var
|
|
425
|
-
var
|
|
426
|
-
var
|
|
427
|
-
var
|
|
428
|
-
var
|
|
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 >
|
|
436
|
+
if (keys.length > EVENT_DATA_MAX_KEYS) {
|
|
431
437
|
context.addIssue({
|
|
432
438
|
code: "custom",
|
|
433
|
-
message: `
|
|
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 >
|
|
445
|
+
if (jsonBytes > EVENT_DATA_MAX_JSON_BYTES) {
|
|
440
446
|
context.addIssue({
|
|
441
447
|
code: "custom",
|
|
442
|
-
message: `
|
|
448
|
+
message: `Event data may be at most ${EVENT_DATA_MAX_JSON_BYTES} JSON bytes.`
|
|
443
449
|
});
|
|
444
450
|
}
|
|
445
451
|
});
|
|
446
|
-
var
|
|
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
|
|
453
|
-
var
|
|
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: '
|
|
467
|
+
message: 'Event match field enum requires kind "string".',
|
|
462
468
|
path: ["enum"]
|
|
463
469
|
});
|
|
464
470
|
}
|
|
465
471
|
});
|
|
466
|
-
var
|
|
467
|
-
|
|
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: `
|
|
476
|
+
message: `Event match keys may include at most ${EVENT_DATA_MAX_KEYS} keys.`
|
|
474
477
|
});
|
|
475
478
|
}
|
|
476
479
|
});
|
|
477
|
-
var
|
|
478
|
-
z6.string().regex(
|
|
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 >
|
|
489
|
+
if (Object.keys(match).length > EVENT_DATA_MAX_KEYS) {
|
|
487
490
|
context.addIssue({
|
|
488
491
|
code: "custom",
|
|
489
|
-
message: `
|
|
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: `
|
|
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
|
|
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
|
|
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
|
|
537
|
+
var pluginEventTypeSchema = z6.object({
|
|
535
538
|
type: resourceTypeSchema,
|
|
536
|
-
supportedEvents: z6.array(
|
|
537
|
-
suggestedEvents: z6.array(
|
|
538
|
-
matchFields:
|
|
539
|
+
supportedEvents: z6.array(eventTypeSchema).min(1),
|
|
540
|
+
suggestedEvents: z6.array(eventTypeSchema).optional(),
|
|
541
|
+
matchFields: eventMatchFieldsSchema.optional(),
|
|
539
542
|
guidance: z6.record(
|
|
540
|
-
|
|
541
|
-
z6.string().trim().min(1).max(
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
584
|
-
resourceTypes: z6.array(
|
|
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
|
|
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("
|
|
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(
|
|
613
|
-
supportedEvents: z6.array(
|
|
615
|
+
suggestedEvents: z6.array(eventTypeSchema).optional(),
|
|
616
|
+
supportedEvents: z6.array(eventTypeSchema),
|
|
614
617
|
type: resourceTypeSchema
|
|
615
618
|
}).strict();
|
|
616
|
-
var
|
|
617
|
-
events: z6.array(
|
|
619
|
+
var watchResultSchema = z6.object({
|
|
620
|
+
events: z6.array(eventTypeSchema).min(1),
|
|
618
621
|
id: z6.string().min(1)
|
|
619
622
|
}).strict();
|
|
620
|
-
var
|
|
623
|
+
var eventInputSchema = z6.object({
|
|
621
624
|
eventKey: z6.string().min(1),
|
|
622
|
-
eventType:
|
|
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,
|
|
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:
|
|
629
|
-
untrustedText: z6.string().transform((value) => value.slice(0,
|
|
631
|
+
data: eventDataSchema.optional(),
|
|
632
|
+
untrustedText: z6.string().transform((value) => value.slice(0, EVENT_TEXT_MAX_LENGTH)).optional()
|
|
630
633
|
}).strict();
|
|
631
|
-
var
|
|
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.
|
|
940
|
-
const parsed =
|
|
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}"
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1142
|
+
scheduledAutomationSourceSchema,
|
|
1141
1143
|
slackActorSchema,
|
|
1142
1144
|
slackDestinationSchema,
|
|
1143
1145
|
slackLocationSchema,
|
|
1144
1146
|
slackSourceSchema,
|
|
1145
1147
|
sourceSchema,
|
|
1146
1148
|
sourceVisibilitySchema,
|
|
1147
|
-
|
|
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
|