@sentry/junior-plugin-api 0.222.0 → 0.224.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 +16 -0
- package/dist/index.d.ts +83 -6
- package/dist/index.js +275 -252
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -147,3 +147,19 @@ Plugins and skills follow `../../policies/security.md`,
|
|
|
147
147
|
`../../policies/data-redaction.md`, and
|
|
148
148
|
`../../policies/provider-boundaries.md`. Skills explain capability use; they do
|
|
149
149
|
not bootstrap runtimes or credentials.
|
|
150
|
+
|
|
151
|
+
## Object annotations
|
|
152
|
+
|
|
153
|
+
A tool can return `objectAnnotations` through `pluginToolOutputSchema` to save
|
|
154
|
+
object facts and attach a card to the next visible reply. The host assigns the
|
|
155
|
+
plugin owner. Use a stable `key` within the plugin, a compact `label`, a `title`,
|
|
156
|
+
a verified HTTP(S) `url` (or null), and an `objectType`: `task`, `code_change`,
|
|
157
|
+
`automation`, or `item`. Status and description are optional. Automations also
|
|
158
|
+
use `trigger` and `warning`. Do not send Slack layout JSON or infer facts that
|
|
159
|
+
the provider did not return.
|
|
160
|
+
|
|
161
|
+
The `afterMcpTool` hook can return `{ objectAnnotations }` after a successful
|
|
162
|
+
hosted tool call. Use `ctx.annotations.upsert` instead when facts must change
|
|
163
|
+
without selecting a reply card, such as a background webhook update. Only return
|
|
164
|
+
facts that can be shared with the current Conversation. Message snapshots remain
|
|
165
|
+
separate from the latest annotation and do not grant access to the provider.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
import { z, ZodTypeAny } from 'zod';
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
|
|
4
|
+
/** Verified object facts shared by Conversation annotations and Message cards. */
|
|
5
|
+
declare const objectAnnotationSchema: z.ZodObject<{
|
|
6
|
+
kind: z.ZodLiteral<"object">;
|
|
7
|
+
key: z.ZodString;
|
|
8
|
+
label: z.ZodString;
|
|
9
|
+
objectType: z.ZodEnum<{
|
|
10
|
+
task: "task";
|
|
11
|
+
code_change: "code_change";
|
|
12
|
+
automation: "automation";
|
|
13
|
+
item: "item";
|
|
14
|
+
}>;
|
|
15
|
+
title: z.ZodString;
|
|
16
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
17
|
+
description: z.ZodOptional<z.ZodString>;
|
|
18
|
+
status: z.ZodOptional<z.ZodString>;
|
|
19
|
+
trigger: z.ZodOptional<z.ZodString>;
|
|
20
|
+
warning: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, z.core.$strict>;
|
|
22
|
+
type ObjectAnnotation = z.output<typeof objectAnnotationSchema>;
|
|
23
|
+
/** A saved object snapshot with its trusted owner. */
|
|
24
|
+
declare const ownedObjectAnnotationSchema: z.ZodObject<{
|
|
25
|
+
kind: z.ZodLiteral<"object">;
|
|
26
|
+
key: z.ZodString;
|
|
27
|
+
label: z.ZodString;
|
|
28
|
+
objectType: z.ZodEnum<{
|
|
29
|
+
task: "task";
|
|
30
|
+
code_change: "code_change";
|
|
31
|
+
automation: "automation";
|
|
32
|
+
item: "item";
|
|
33
|
+
}>;
|
|
34
|
+
title: z.ZodString;
|
|
35
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
36
|
+
description: z.ZodOptional<z.ZodString>;
|
|
37
|
+
status: z.ZodOptional<z.ZodString>;
|
|
38
|
+
trigger: z.ZodOptional<z.ZodString>;
|
|
39
|
+
warning: z.ZodOptional<z.ZodString>;
|
|
40
|
+
plugin: z.ZodString;
|
|
41
|
+
}, z.core.$strict>;
|
|
42
|
+
type OwnedObjectAnnotation = z.output<typeof ownedObjectAnnotationSchema>;
|
|
43
|
+
|
|
4
44
|
/** Exact non-blank actor user id that rejects the sentinel "unknown". */
|
|
5
45
|
declare const actorUserIdSchema: z.ZodString;
|
|
6
46
|
declare const nonBlankStringSchema: z.ZodString;
|
|
@@ -437,11 +477,11 @@ declare const resourceLinkAnnotationSchema: z.ZodObject<{
|
|
|
437
477
|
url: z.ZodString;
|
|
438
478
|
description: z.ZodOptional<z.ZodString>;
|
|
439
479
|
status: z.ZodOptional<z.ZodEnum<{
|
|
480
|
+
warning: "warning";
|
|
440
481
|
open: "open";
|
|
441
482
|
draft: "draft";
|
|
442
483
|
closed: "closed";
|
|
443
484
|
merged: "merged";
|
|
444
|
-
warning: "warning";
|
|
445
485
|
}>>;
|
|
446
486
|
}, z.core.$strict>;
|
|
447
487
|
/** Core-known annotation shapes that plugins may attach to a conversation. */
|
|
@@ -452,12 +492,28 @@ declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<[z.ZodO
|
|
|
452
492
|
url: z.ZodString;
|
|
453
493
|
description: z.ZodOptional<z.ZodString>;
|
|
454
494
|
status: z.ZodOptional<z.ZodEnum<{
|
|
495
|
+
warning: "warning";
|
|
455
496
|
open: "open";
|
|
456
497
|
draft: "draft";
|
|
457
498
|
closed: "closed";
|
|
458
499
|
merged: "merged";
|
|
459
|
-
warning: "warning";
|
|
460
500
|
}>>;
|
|
501
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
502
|
+
kind: z.ZodLiteral<"object">;
|
|
503
|
+
key: z.ZodString;
|
|
504
|
+
label: z.ZodString;
|
|
505
|
+
objectType: z.ZodEnum<{
|
|
506
|
+
task: "task";
|
|
507
|
+
code_change: "code_change";
|
|
508
|
+
automation: "automation";
|
|
509
|
+
item: "item";
|
|
510
|
+
}>;
|
|
511
|
+
title: z.ZodString;
|
|
512
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
513
|
+
description: z.ZodOptional<z.ZodString>;
|
|
514
|
+
status: z.ZodOptional<z.ZodString>;
|
|
515
|
+
trigger: z.ZodOptional<z.ZodString>;
|
|
516
|
+
warning: z.ZodOptional<z.ZodString>;
|
|
461
517
|
}, z.core.$strict>], "kind">;
|
|
462
518
|
type ConversationAnnotationInput = z.output<typeof conversationAnnotationInputSchema>;
|
|
463
519
|
type ConversationAnnotation = ConversationAnnotationInput & {
|
|
@@ -544,8 +600,8 @@ interface CodeChangePublisher {
|
|
|
544
600
|
declare const conversationEventIconSchema: z.ZodEnum<{
|
|
545
601
|
check: "check";
|
|
546
602
|
key: "key";
|
|
547
|
-
link: "link";
|
|
548
603
|
warning: "warning";
|
|
604
|
+
link: "link";
|
|
549
605
|
activity: "activity";
|
|
550
606
|
brain: "brain";
|
|
551
607
|
calendar: "calendar";
|
|
@@ -564,8 +620,8 @@ declare const conversationEventPresentationSchema: z.ZodObject<{
|
|
|
564
620
|
icon: z.ZodOptional<z.ZodEnum<{
|
|
565
621
|
check: "check";
|
|
566
622
|
key: "key";
|
|
567
|
-
link: "link";
|
|
568
623
|
warning: "warning";
|
|
624
|
+
link: "link";
|
|
569
625
|
activity: "activity";
|
|
570
626
|
brain: "brain";
|
|
571
627
|
calendar: "calendar";
|
|
@@ -1605,6 +1661,23 @@ declare const pluginToolContinuationSchema: z.ZodObject<{
|
|
|
1605
1661
|
}, z.core.$strict>;
|
|
1606
1662
|
/** Shared optional fields for canonical plugin tool outputs. */
|
|
1607
1663
|
declare const pluginToolOutputSchema: z.ZodObject<{
|
|
1664
|
+
objectAnnotations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1665
|
+
kind: z.ZodLiteral<"object">;
|
|
1666
|
+
key: z.ZodString;
|
|
1667
|
+
label: z.ZodString;
|
|
1668
|
+
objectType: z.ZodEnum<{
|
|
1669
|
+
task: "task";
|
|
1670
|
+
code_change: "code_change";
|
|
1671
|
+
automation: "automation";
|
|
1672
|
+
item: "item";
|
|
1673
|
+
}>;
|
|
1674
|
+
title: z.ZodString;
|
|
1675
|
+
url: z.ZodNullable<z.ZodURL>;
|
|
1676
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1677
|
+
status: z.ZodOptional<z.ZodString>;
|
|
1678
|
+
trigger: z.ZodOptional<z.ZodString>;
|
|
1679
|
+
warning: z.ZodOptional<z.ZodString>;
|
|
1680
|
+
}, z.core.$strict>>>;
|
|
1608
1681
|
target: z.ZodOptional<z.ZodString>;
|
|
1609
1682
|
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
1610
1683
|
continuation: z.ZodOptional<z.ZodObject<{
|
|
@@ -1796,7 +1869,11 @@ interface PluginHooks {
|
|
|
1796
1869
|
* Prefer this for junior-owned side effects such as conversation annotations.
|
|
1797
1870
|
* Do not use it to invent a parallel tool contract for the provider tool.
|
|
1798
1871
|
*/
|
|
1799
|
-
afterMcpTool?(ctx: AfterMcpToolHookContext): Promise<
|
|
1872
|
+
afterMcpTool?(ctx: AfterMcpToolHookContext): Promise<{
|
|
1873
|
+
objectAnnotations: ObjectAnnotation[];
|
|
1874
|
+
} | void> | {
|
|
1875
|
+
objectAnnotations: ObjectAnnotation[];
|
|
1876
|
+
} | void;
|
|
1800
1877
|
grantForEgress?(ctx: EgressHookContext): Promise<PluginGrant | undefined> | PluginGrant | undefined;
|
|
1801
1878
|
heartbeat?(ctx: HeartbeatHookContext): Promise<HeartbeatResult | void> | HeartbeatResult | void;
|
|
1802
1879
|
unfinishedWork?(ctx: UnfinishedWorkHookContext): Promise<UnfinishedWorkResult> | UnfinishedWorkResult;
|
|
@@ -2067,4 +2144,4 @@ interface PluginRegistration extends PluginRegistrationInput {
|
|
|
2067
2144
|
/** Define one Junior plugin registration for app and build-time wiring. */
|
|
2068
2145
|
declare function defineJuniorPlugin(plugin: PluginRegistrationInput): PluginRegistration;
|
|
2069
2146
|
|
|
2070
|
-
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 PluginMcpAuthConfig, 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 };
|
|
2147
|
+
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 ObjectAnnotation, type OperationalReportHookContext, type OwnedObjectAnnotation, 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 PluginMcpAuthConfig, 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, objectAnnotationSchema, ownedObjectAnnotationSchema, 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
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
// src/annotations.ts
|
|
1
|
+
// src/object-annotations.ts
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
var objectAnnotationSchema = z.object({
|
|
4
|
+
kind: z.literal("object"),
|
|
5
|
+
key: z.string().trim().min(1).max(256),
|
|
6
|
+
label: z.string().trim().min(1).max(256),
|
|
7
|
+
objectType: z.enum(["task", "code_change", "automation", "item"]),
|
|
8
|
+
title: z.string().trim().min(1).max(512),
|
|
9
|
+
url: z.url().max(2048).refine((value) => ["http:", "https:"].includes(new URL(value).protocol)).nullable(),
|
|
10
|
+
description: z.string().max(4e3).optional(),
|
|
11
|
+
status: z.string().trim().min(1).max(100).optional(),
|
|
12
|
+
trigger: z.string().max(4e3).optional(),
|
|
13
|
+
warning: z.string().max(1e3).optional()
|
|
14
|
+
}).strict();
|
|
15
|
+
var ownedObjectAnnotationSchema = objectAnnotationSchema.extend({
|
|
16
|
+
plugin: z.string().min(1)
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// src/annotations.ts
|
|
20
|
+
import { z as z2 } from "zod";
|
|
3
21
|
function usesHttpProtocol(value) {
|
|
4
22
|
try {
|
|
5
23
|
const protocol = new URL(value).protocol;
|
|
@@ -8,18 +26,19 @@ function usesHttpProtocol(value) {
|
|
|
8
26
|
return false;
|
|
9
27
|
}
|
|
10
28
|
}
|
|
11
|
-
var resourceLinkAnnotationSchema =
|
|
12
|
-
kind:
|
|
13
|
-
key:
|
|
14
|
-
label:
|
|
15
|
-
url:
|
|
16
|
-
description:
|
|
17
|
-
status:
|
|
29
|
+
var resourceLinkAnnotationSchema = z2.object({
|
|
30
|
+
kind: z2.literal("resource_link"),
|
|
31
|
+
key: z2.string().trim().min(1).max(256),
|
|
32
|
+
label: z2.string().trim().min(1).max(256),
|
|
33
|
+
url: z2.string().url().max(2048).refine(usesHttpProtocol, "URL must use HTTP or HTTPS."),
|
|
34
|
+
description: z2.string().trim().min(1).max(512).optional(),
|
|
35
|
+
status: z2.enum(["open", "draft", "closed", "merged", "warning"]).optional()
|
|
18
36
|
}).strict();
|
|
19
|
-
var conversationAnnotationInputSchema =
|
|
20
|
-
resourceLinkAnnotationSchema
|
|
37
|
+
var conversationAnnotationInputSchema = z2.discriminatedUnion("kind", [
|
|
38
|
+
resourceLinkAnnotationSchema,
|
|
39
|
+
objectAnnotationSchema
|
|
21
40
|
]);
|
|
22
|
-
var conversationSidebarIconSchema =
|
|
41
|
+
var conversationSidebarIconSchema = z2.enum([
|
|
23
42
|
"circle-dot",
|
|
24
43
|
"circle-dashed",
|
|
25
44
|
"circle-x",
|
|
@@ -27,37 +46,37 @@ var conversationSidebarIconSchema = z.enum([
|
|
|
27
46
|
"git-pull-request",
|
|
28
47
|
"triangle-alert"
|
|
29
48
|
]);
|
|
30
|
-
var conversationSidebarAnnotationSchema =
|
|
49
|
+
var conversationSidebarAnnotationSchema = z2.object({
|
|
31
50
|
icon: conversationSidebarIconSchema.optional(),
|
|
32
|
-
key:
|
|
33
|
-
label:
|
|
51
|
+
key: z2.string().trim().min(1).max(256),
|
|
52
|
+
label: z2.string().trim().min(1).max(256)
|
|
34
53
|
}).strict();
|
|
35
54
|
|
|
36
55
|
// src/code.ts
|
|
37
|
-
import { z as
|
|
38
|
-
var codeChangeStateSchema =
|
|
39
|
-
var codeChangeInputSchema =
|
|
40
|
-
closedAt:
|
|
41
|
-
conversationIds:
|
|
42
|
-
mergedAt:
|
|
43
|
-
number:
|
|
44
|
-
openedAt:
|
|
45
|
-
providerId:
|
|
46
|
-
repository:
|
|
47
|
-
name:
|
|
48
|
-
providerId:
|
|
49
|
-
url:
|
|
56
|
+
import { z as z3 } from "zod";
|
|
57
|
+
var codeChangeStateSchema = z3.enum(["closed", "merged", "open"]);
|
|
58
|
+
var codeChangeInputSchema = z3.object({
|
|
59
|
+
closedAt: z3.date().optional(),
|
|
60
|
+
conversationIds: z3.array(z3.string().min(1)).default([]),
|
|
61
|
+
mergedAt: z3.date().optional(),
|
|
62
|
+
number: z3.number().int().positive(),
|
|
63
|
+
openedAt: z3.date(),
|
|
64
|
+
providerId: z3.string().min(1),
|
|
65
|
+
repository: z3.object({
|
|
66
|
+
name: z3.string().min(1),
|
|
67
|
+
providerId: z3.string().min(1),
|
|
68
|
+
url: z3.string().url().optional()
|
|
50
69
|
}).strict(),
|
|
51
70
|
state: codeChangeStateSchema,
|
|
52
|
-
title:
|
|
53
|
-
updatedAt:
|
|
54
|
-
url:
|
|
71
|
+
title: z3.string().min(1).optional(),
|
|
72
|
+
updatedAt: z3.date(),
|
|
73
|
+
url: z3.string().url().optional()
|
|
55
74
|
}).strict();
|
|
56
75
|
|
|
57
76
|
// src/conversation-events.ts
|
|
58
|
-
import { z as
|
|
59
|
-
var conversationEventNameSchema =
|
|
60
|
-
var conversationEventIconSchema =
|
|
77
|
+
import { z as z4 } from "zod";
|
|
78
|
+
var conversationEventNameSchema = z4.string().trim().min(1).max(64).regex(/^[a-z][a-z0-9_]*$/);
|
|
79
|
+
var conversationEventIconSchema = z4.enum([
|
|
61
80
|
"activity",
|
|
62
81
|
"brain",
|
|
63
82
|
"calendar",
|
|
@@ -69,22 +88,22 @@ var conversationEventIconSchema = z3.enum([
|
|
|
69
88
|
"sparkles",
|
|
70
89
|
"warning"
|
|
71
90
|
]);
|
|
72
|
-
var conversationEventDetailSchema =
|
|
73
|
-
content:
|
|
74
|
-
description:
|
|
75
|
-
metadata:
|
|
76
|
-
title:
|
|
91
|
+
var conversationEventDetailSchema = z4.object({
|
|
92
|
+
content: z4.string().min(1).max(32 * 1024).optional(),
|
|
93
|
+
description: z4.string().trim().min(1).max(2e3).optional(),
|
|
94
|
+
metadata: z4.array(z4.string().trim().min(1).max(120)).max(8).optional(),
|
|
95
|
+
title: z4.string().trim().min(1).max(4e3)
|
|
77
96
|
}).strict();
|
|
78
|
-
var conversationEventPresentationSchema =
|
|
79
|
-
details:
|
|
97
|
+
var conversationEventPresentationSchema = z4.object({
|
|
98
|
+
details: z4.array(conversationEventDetailSchema).max(100).optional(),
|
|
80
99
|
icon: conversationEventIconSchema.optional(),
|
|
81
|
-
preview:
|
|
82
|
-
title:
|
|
100
|
+
preview: z4.string().trim().min(1).max(500).optional(),
|
|
101
|
+
title: z4.string().trim().min(1).max(120)
|
|
83
102
|
}).strict();
|
|
84
103
|
function defineConversationEvent(definition) {
|
|
85
|
-
const identity =
|
|
104
|
+
const identity = z4.object({
|
|
86
105
|
name: conversationEventNameSchema,
|
|
87
|
-
version:
|
|
106
|
+
version: z4.number().int().positive()
|
|
88
107
|
}).strict().parse({ name: definition.name, version: definition.version });
|
|
89
108
|
let eventDefinition;
|
|
90
109
|
const createEvent = (data) => ({
|
|
@@ -107,85 +126,85 @@ function defineConversationEvent(definition) {
|
|
|
107
126
|
}
|
|
108
127
|
|
|
109
128
|
// src/schemas.ts
|
|
110
|
-
import { z as
|
|
111
|
-
var slackTeamIdSchema =
|
|
112
|
-
var slackConversationIdSchema =
|
|
113
|
-
var localConversationIdSchema =
|
|
114
|
-
var actorUserIdSchema =
|
|
129
|
+
import { z as z5 } from "zod";
|
|
130
|
+
var slackTeamIdSchema = z5.string().regex(/^T[A-Z0-9]+$/);
|
|
131
|
+
var slackConversationIdSchema = z5.string().regex(/^(C|G|D)[A-Z0-9]+$/);
|
|
132
|
+
var localConversationIdSchema = z5.string().regex(/^local:[a-z0-9_-]+:[a-z0-9][a-z0-9_-]*$/);
|
|
133
|
+
var actorUserIdSchema = z5.string().min(1).refine(
|
|
115
134
|
(value) => value === value.trim() && value.toLowerCase() !== "unknown"
|
|
116
135
|
);
|
|
117
136
|
var exactActorUserIdSchema = actorUserIdSchema;
|
|
118
|
-
var nonBlankStringSchema =
|
|
137
|
+
var nonBlankStringSchema = z5.string().refine((value) => value.trim().length > 0);
|
|
119
138
|
var exactNonBlankStringSchema = nonBlankStringSchema.refine(
|
|
120
139
|
(value) => value === value.trim()
|
|
121
140
|
);
|
|
122
|
-
var baseLocationSchema =
|
|
141
|
+
var baseLocationSchema = z5.object({
|
|
123
142
|
/** Stable SQL identity used by Location configuration and reporting. */
|
|
124
143
|
id: nonBlankStringSchema,
|
|
125
144
|
provider: exactNonBlankStringSchema
|
|
126
145
|
}).strict();
|
|
127
146
|
var slackLocationSchema = baseLocationSchema.extend({
|
|
128
|
-
provider:
|
|
147
|
+
provider: z5.literal("slack"),
|
|
129
148
|
teamId: slackTeamIdSchema,
|
|
130
149
|
channelId: slackConversationIdSchema,
|
|
131
150
|
threadTs: exactNonBlankStringSchema.optional()
|
|
132
151
|
}).strict();
|
|
133
|
-
var locationSchema =
|
|
152
|
+
var locationSchema = z5.discriminatedUnion("provider", [
|
|
134
153
|
slackLocationSchema
|
|
135
154
|
]);
|
|
136
|
-
var platformSchema =
|
|
137
|
-
var sourceVisibilitySchema =
|
|
138
|
-
var destinationVisibilitySchema =
|
|
139
|
-
var slackAddressSchema =
|
|
140
|
-
platform:
|
|
155
|
+
var platformSchema = z5.enum(["slack", "local"]);
|
|
156
|
+
var sourceVisibilitySchema = z5.enum(["public", "private"]);
|
|
157
|
+
var destinationVisibilitySchema = z5.enum(["public", "private"]);
|
|
158
|
+
var slackAddressSchema = z5.object({
|
|
159
|
+
platform: z5.literal("slack"),
|
|
141
160
|
teamId: slackTeamIdSchema,
|
|
142
161
|
channelId: slackConversationIdSchema,
|
|
143
162
|
threadTs: exactNonBlankStringSchema.optional()
|
|
144
163
|
}).strict();
|
|
145
164
|
var slackDestinationSchema = slackAddressSchema;
|
|
146
|
-
var localDestinationSchema =
|
|
147
|
-
platform:
|
|
165
|
+
var localDestinationSchema = z5.object({
|
|
166
|
+
platform: z5.literal("local"),
|
|
148
167
|
conversationId: localConversationIdSchema
|
|
149
168
|
}).strict();
|
|
150
|
-
var destinationSchema =
|
|
169
|
+
var destinationSchema = z5.discriminatedUnion("platform", [
|
|
151
170
|
slackDestinationSchema,
|
|
152
171
|
localDestinationSchema
|
|
153
172
|
]);
|
|
154
|
-
var taskOutcomeSchema =
|
|
155
|
-
action:
|
|
173
|
+
var taskOutcomeSchema = z5.object({
|
|
174
|
+
action: z5.literal("send_message"),
|
|
156
175
|
destination: slackDestinationSchema
|
|
157
176
|
}).strict();
|
|
158
|
-
var slackSourceSchema =
|
|
159
|
-
kind:
|
|
177
|
+
var slackSourceSchema = z5.object({
|
|
178
|
+
kind: z5.literal("slack"),
|
|
160
179
|
teamId: slackTeamIdSchema,
|
|
161
180
|
channelId: slackConversationIdSchema,
|
|
162
181
|
visibility: sourceVisibilitySchema,
|
|
163
182
|
messageTs: nonBlankStringSchema.optional(),
|
|
164
183
|
threadTs: nonBlankStringSchema.optional()
|
|
165
184
|
}).strict();
|
|
166
|
-
var localSourceSchema =
|
|
167
|
-
kind:
|
|
168
|
-
visibility:
|
|
185
|
+
var localSourceSchema = z5.object({
|
|
186
|
+
kind: z5.literal("local"),
|
|
187
|
+
visibility: z5.literal("private"),
|
|
169
188
|
conversationId: localConversationIdSchema
|
|
170
189
|
}).strict();
|
|
171
|
-
var webSourceSchema =
|
|
172
|
-
kind:
|
|
190
|
+
var webSourceSchema = z5.object({
|
|
191
|
+
kind: z5.literal("web"),
|
|
173
192
|
visibility: sourceVisibilitySchema,
|
|
174
193
|
// Web can continue any existing conversation id, including Slack roots.
|
|
175
194
|
conversationId: exactNonBlankStringSchema
|
|
176
195
|
}).strict();
|
|
177
|
-
var eventSourceSchema =
|
|
178
|
-
kind:
|
|
196
|
+
var eventSourceSchema = z5.object({
|
|
197
|
+
kind: z5.literal("event"),
|
|
179
198
|
eventKey: exactNonBlankStringSchema,
|
|
180
199
|
eventType: exactNonBlankStringSchema,
|
|
181
200
|
identifier: exactNonBlankStringSchema,
|
|
182
201
|
namespace: exactNonBlankStringSchema
|
|
183
202
|
}).strict();
|
|
184
|
-
var scheduledAutomationSourceSchema =
|
|
185
|
-
var eventAutomationSourceSchema =
|
|
186
|
-
var pluginDispatchSourceSchema =
|
|
187
|
-
var agentInvocationSourceSchema =
|
|
188
|
-
var currentSourceSchema =
|
|
203
|
+
var scheduledAutomationSourceSchema = z5.object({ kind: z5.literal("scheduled_automation") }).strict();
|
|
204
|
+
var eventAutomationSourceSchema = z5.object({ kind: z5.literal("event_automation") }).strict();
|
|
205
|
+
var pluginDispatchSourceSchema = z5.object({ kind: z5.literal("plugin_dispatch") }).strict();
|
|
206
|
+
var agentInvocationSourceSchema = z5.object({ kind: z5.literal("agent_invocation") }).strict();
|
|
207
|
+
var currentSourceSchema = z5.discriminatedUnion("kind", [
|
|
189
208
|
slackSourceSchema,
|
|
190
209
|
localSourceSchema,
|
|
191
210
|
webSourceSchema,
|
|
@@ -215,22 +234,22 @@ function normalizeStoredSource(value) {
|
|
|
215
234
|
const { location: _location, platform: kind, ...fields } = source;
|
|
216
235
|
return { ...fields, kind };
|
|
217
236
|
}
|
|
218
|
-
var sourceSchema =
|
|
237
|
+
var sourceSchema = z5.preprocess(
|
|
219
238
|
normalizeStoredSource,
|
|
220
239
|
currentSourceSchema
|
|
221
240
|
);
|
|
222
|
-
var pluginCredentialSubjectSchema =
|
|
241
|
+
var pluginCredentialSubjectSchema = z5.discriminatedUnion(
|
|
223
242
|
"allowedWhen",
|
|
224
243
|
[
|
|
225
|
-
|
|
226
|
-
type:
|
|
244
|
+
z5.object({
|
|
245
|
+
type: z5.literal("user"),
|
|
227
246
|
userId: exactActorUserIdSchema,
|
|
228
|
-
allowedWhen:
|
|
247
|
+
allowedWhen: z5.literal("private-direct-conversation")
|
|
229
248
|
}).strict(),
|
|
230
|
-
|
|
231
|
-
type:
|
|
249
|
+
z5.object({
|
|
250
|
+
type: z5.literal("user"),
|
|
232
251
|
userId: exactActorUserIdSchema,
|
|
233
|
-
allowedWhen:
|
|
252
|
+
allowedWhen: z5.literal("scheduled-automation"),
|
|
234
253
|
taskId: exactNonBlankStringSchema
|
|
235
254
|
}).strict()
|
|
236
255
|
]
|
|
@@ -241,30 +260,30 @@ var actorProfileSchema = {
|
|
|
241
260
|
userId: exactActorUserIdSchema,
|
|
242
261
|
userName: nonBlankStringSchema.optional()
|
|
243
262
|
};
|
|
244
|
-
var slackActorSchema =
|
|
263
|
+
var slackActorSchema = z5.object({
|
|
245
264
|
...actorProfileSchema,
|
|
246
|
-
platform:
|
|
265
|
+
platform: z5.literal("slack"),
|
|
247
266
|
teamId: slackTeamIdSchema
|
|
248
267
|
}).strict();
|
|
249
|
-
var localActorSchema =
|
|
268
|
+
var localActorSchema = z5.object({
|
|
250
269
|
...actorProfileSchema,
|
|
251
|
-
platform:
|
|
270
|
+
platform: z5.literal("local")
|
|
252
271
|
}).strict();
|
|
253
|
-
var webActorSchema =
|
|
272
|
+
var webActorSchema = z5.object({
|
|
254
273
|
...actorProfileSchema,
|
|
255
|
-
platform:
|
|
274
|
+
platform: z5.literal("web")
|
|
256
275
|
}).strict();
|
|
257
|
-
var systemActorSchema =
|
|
258
|
-
platform:
|
|
276
|
+
var systemActorSchema = z5.object({
|
|
277
|
+
platform: z5.literal("system"),
|
|
259
278
|
name: exactActorUserIdSchema
|
|
260
279
|
}).strict();
|
|
261
|
-
var actorSchema =
|
|
280
|
+
var actorSchema = z5.discriminatedUnion("platform", [
|
|
262
281
|
slackActorSchema,
|
|
263
282
|
localActorSchema,
|
|
264
283
|
webActorSchema,
|
|
265
284
|
systemActorSchema
|
|
266
285
|
]);
|
|
267
|
-
var identitySchema =
|
|
286
|
+
var identitySchema = z5.object({
|
|
268
287
|
displayName: nonBlankStringSchema.optional(),
|
|
269
288
|
handle: nonBlankStringSchema.optional(),
|
|
270
289
|
id: exactNonBlankStringSchema,
|
|
@@ -272,17 +291,17 @@ var identitySchema = z4.object({
|
|
|
272
291
|
providerSubjectId: exactNonBlankStringSchema,
|
|
273
292
|
providerTenantId: exactNonBlankStringSchema.optional()
|
|
274
293
|
}).strict();
|
|
275
|
-
var userSchema =
|
|
294
|
+
var userSchema = z5.object({
|
|
276
295
|
displayName: nonBlankStringSchema.optional(),
|
|
277
296
|
email: nonBlankStringSchema.max(320),
|
|
278
297
|
id: exactNonBlankStringSchema,
|
|
279
|
-
identities:
|
|
298
|
+
identities: z5.array(identitySchema).max(100)
|
|
280
299
|
}).strict();
|
|
281
|
-
var dispatchMetadataSchema =
|
|
300
|
+
var dispatchMetadataSchema = z5.record(z5.string(), z5.string()).superRefine((metadata, ctx) => {
|
|
282
301
|
const entries = Object.entries(metadata);
|
|
283
302
|
if (entries.length > 20) {
|
|
284
303
|
ctx.addIssue({
|
|
285
|
-
code:
|
|
304
|
+
code: z5.ZodIssueCode.custom,
|
|
286
305
|
message: "Dispatch metadata has too many keys"
|
|
287
306
|
});
|
|
288
307
|
return;
|
|
@@ -290,7 +309,7 @@ var dispatchMetadataSchema = z4.record(z4.string(), z4.string()).superRefine((me
|
|
|
290
309
|
for (const [key, value] of entries) {
|
|
291
310
|
if (!key.trim()) {
|
|
292
311
|
ctx.addIssue({
|
|
293
|
-
code:
|
|
312
|
+
code: z5.ZodIssueCode.custom,
|
|
294
313
|
message: "Dispatch metadata values must be strings",
|
|
295
314
|
path: [key]
|
|
296
315
|
});
|
|
@@ -298,44 +317,44 @@ var dispatchMetadataSchema = z4.record(z4.string(), z4.string()).superRefine((me
|
|
|
298
317
|
}
|
|
299
318
|
if (key.length > 128) {
|
|
300
319
|
ctx.addIssue({
|
|
301
|
-
code:
|
|
320
|
+
code: z5.ZodIssueCode.custom,
|
|
302
321
|
message: "Dispatch metadata key exceeds the maximum length",
|
|
303
322
|
path: [key]
|
|
304
323
|
});
|
|
305
324
|
}
|
|
306
325
|
if (/[\r\n]/.test(key)) {
|
|
307
326
|
ctx.addIssue({
|
|
308
|
-
code:
|
|
327
|
+
code: z5.ZodIssueCode.custom,
|
|
309
328
|
message: "Dispatch metadata keys must be single-line strings",
|
|
310
329
|
path: [key]
|
|
311
330
|
});
|
|
312
331
|
}
|
|
313
332
|
if (/[\r\n]/.test(value)) {
|
|
314
333
|
ctx.addIssue({
|
|
315
|
-
code:
|
|
334
|
+
code: z5.ZodIssueCode.custom,
|
|
316
335
|
message: "Dispatch metadata values must be single-line strings",
|
|
317
336
|
path: [key]
|
|
318
337
|
});
|
|
319
338
|
}
|
|
320
339
|
if (value.length > 512) {
|
|
321
340
|
ctx.addIssue({
|
|
322
|
-
code:
|
|
341
|
+
code: z5.ZodIssueCode.custom,
|
|
323
342
|
message: "Dispatch metadata value exceeds the maximum length",
|
|
324
343
|
path: [key]
|
|
325
344
|
});
|
|
326
345
|
}
|
|
327
346
|
}
|
|
328
347
|
});
|
|
329
|
-
var replyAttributionSchema =
|
|
330
|
-
label: exactNonBlankStringSchema.pipe(
|
|
331
|
-
detail: exactNonBlankStringSchema.pipe(
|
|
348
|
+
var replyAttributionSchema = z5.object({
|
|
349
|
+
label: exactNonBlankStringSchema.pipe(z5.string().max(48)).refine((value) => !/[\r\n]/.test(value)),
|
|
350
|
+
detail: exactNonBlankStringSchema.pipe(z5.string().max(128)).refine((value) => !/[\r\n]/.test(value)).optional()
|
|
332
351
|
}).strict();
|
|
333
|
-
var dispatchOptionsSchema =
|
|
334
|
-
idempotencyKey: nonBlankStringSchema.pipe(
|
|
352
|
+
var dispatchOptionsSchema = z5.object({
|
|
353
|
+
idempotencyKey: nonBlankStringSchema.pipe(z5.string().max(512)),
|
|
335
354
|
credentialSubject: pluginCredentialSubjectSchema.optional(),
|
|
336
355
|
destination: slackDestinationSchema,
|
|
337
356
|
destinationVisibility: destinationVisibilitySchema,
|
|
338
|
-
input: nonBlankStringSchema.pipe(
|
|
357
|
+
input: nonBlankStringSchema.pipe(z5.string().max(32e3)),
|
|
339
358
|
metadata: dispatchMetadataSchema.optional(),
|
|
340
359
|
replyAttribution: replyAttributionSchema.optional()
|
|
341
360
|
}).strict();
|
|
@@ -403,15 +422,15 @@ function isSlackDestination(destination) {
|
|
|
403
422
|
}
|
|
404
423
|
|
|
405
424
|
// src/prompt.ts
|
|
406
|
-
import { z as
|
|
407
|
-
var promptContextKindSchema =
|
|
408
|
-
var promptMessageSchema =
|
|
409
|
-
text:
|
|
425
|
+
import { z as z6 } from "zod";
|
|
426
|
+
var promptContextKindSchema = z6.string().trim().min(1).max(64).regex(/^[a-z][a-z0-9_-]*$/);
|
|
427
|
+
var promptMessageSchema = z6.object({
|
|
428
|
+
text: z6.string().trim().min(1).max(8e3)
|
|
410
429
|
}).strict();
|
|
411
|
-
var promptContextSchema =
|
|
430
|
+
var promptContextSchema = z6.object({
|
|
412
431
|
kind: promptContextKindSchema,
|
|
413
|
-
version:
|
|
414
|
-
content:
|
|
432
|
+
version: z6.number().int().positive(),
|
|
433
|
+
content: z6.record(z6.string(), z6.unknown())
|
|
415
434
|
}).strict();
|
|
416
435
|
function definePromptContext(definition) {
|
|
417
436
|
const identity = promptContextSchema.pick({ kind: true, version: true }).parse({ kind: definition.kind, version: definition.version });
|
|
@@ -425,13 +444,13 @@ function definePromptContext(definition) {
|
|
|
425
444
|
}
|
|
426
445
|
|
|
427
446
|
// src/events.ts
|
|
428
|
-
import { z as
|
|
447
|
+
import { z as z7 } from "zod";
|
|
429
448
|
var EVENT_SUMMARY_MAX_LENGTH = 4e3;
|
|
430
449
|
var EVENT_TEXT_MAX_LENGTH = 8e3;
|
|
431
450
|
var EVENT_DATA_MAX_KEYS = 32;
|
|
432
451
|
var EVENT_DATA_MAX_JSON_BYTES = 4e3;
|
|
433
452
|
var EVENT_GUIDANCE_MAX_LENGTH = 1e3;
|
|
434
|
-
var eventDataSchema =
|
|
453
|
+
var eventDataSchema = z7.record(z7.string(), z7.unknown()).superRefine((value, context) => {
|
|
435
454
|
const keys = Object.keys(value);
|
|
436
455
|
if (keys.length > EVENT_DATA_MAX_KEYS) {
|
|
437
456
|
context.addIssue({
|
|
@@ -449,17 +468,17 @@ var eventDataSchema = z6.record(z6.string(), z6.unknown()).superRefine((value, c
|
|
|
449
468
|
});
|
|
450
469
|
}
|
|
451
470
|
});
|
|
452
|
-
var eventTypeSchema =
|
|
471
|
+
var eventTypeSchema = z7.string().regex(/^[a-z][a-z0-9_-]*(?:\.[a-z][a-z0-9_-]*)+$/).describe(
|
|
453
472
|
"Canonical dotted event type, such as issue.closed or pull_request.review.changes_requested."
|
|
454
473
|
);
|
|
455
|
-
var resourceTypeSchema =
|
|
474
|
+
var resourceTypeSchema = z7.string().regex(/^[a-z][a-z0-9_]*$/).describe(
|
|
456
475
|
"Canonical plugin-defined resource type, such as issue or pull_request."
|
|
457
476
|
);
|
|
458
477
|
var EVENT_MATCH_FIELD_NAME = /^[a-z][a-zA-Z0-9]*$/;
|
|
459
|
-
var eventMatchFieldSchema =
|
|
460
|
-
kind:
|
|
461
|
-
description:
|
|
462
|
-
enum:
|
|
478
|
+
var eventMatchFieldSchema = z7.object({
|
|
479
|
+
kind: z7.enum(["boolean", "string", "number"]),
|
|
480
|
+
description: z7.string().trim().min(1).max(200),
|
|
481
|
+
enum: z7.array(z7.string().min(1)).min(1).optional()
|
|
463
482
|
}).strict().superRefine((field, context) => {
|
|
464
483
|
if (field.enum && field.kind !== "string") {
|
|
465
484
|
context.addIssue({
|
|
@@ -469,7 +488,7 @@ var eventMatchFieldSchema = z6.object({
|
|
|
469
488
|
});
|
|
470
489
|
}
|
|
471
490
|
});
|
|
472
|
-
var eventMatchFieldsSchema =
|
|
491
|
+
var eventMatchFieldsSchema = z7.record(z7.string().regex(EVENT_MATCH_FIELD_NAME), eventMatchFieldSchema).superRefine((fields, context) => {
|
|
473
492
|
if (Object.keys(fields).length > EVENT_DATA_MAX_KEYS) {
|
|
474
493
|
context.addIssue({
|
|
475
494
|
code: "custom",
|
|
@@ -477,13 +496,13 @@ var eventMatchFieldsSchema = z6.record(z6.string().regex(EVENT_MATCH_FIELD_NAME)
|
|
|
477
496
|
});
|
|
478
497
|
}
|
|
479
498
|
});
|
|
480
|
-
var eventMatchSchema =
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
499
|
+
var eventMatchSchema = z7.record(
|
|
500
|
+
z7.string().regex(EVENT_MATCH_FIELD_NAME),
|
|
501
|
+
z7.union([
|
|
502
|
+
z7.boolean(),
|
|
503
|
+
z7.number().finite(),
|
|
504
|
+
z7.string().min(1),
|
|
505
|
+
z7.array(z7.union([z7.number().finite(), z7.string().min(1)])).min(1)
|
|
487
506
|
])
|
|
488
507
|
).superRefine((match, context) => {
|
|
489
508
|
if (Object.keys(match).length > EVENT_DATA_MAX_KEYS) {
|
|
@@ -534,14 +553,14 @@ function eventMatches(match, data) {
|
|
|
534
553
|
}
|
|
535
554
|
return true;
|
|
536
555
|
}
|
|
537
|
-
var pluginEventTypeSchema =
|
|
556
|
+
var pluginEventTypeSchema = z7.object({
|
|
538
557
|
type: resourceTypeSchema,
|
|
539
|
-
supportedEvents:
|
|
540
|
-
suggestedEvents:
|
|
558
|
+
supportedEvents: z7.array(eventTypeSchema).min(1),
|
|
559
|
+
suggestedEvents: z7.array(eventTypeSchema).optional(),
|
|
541
560
|
matchFields: eventMatchFieldsSchema.optional(),
|
|
542
|
-
guidance:
|
|
561
|
+
guidance: z7.record(
|
|
543
562
|
eventTypeSchema,
|
|
544
|
-
|
|
563
|
+
z7.string().trim().min(1).max(EVENT_GUIDANCE_MAX_LENGTH)
|
|
545
564
|
).optional()
|
|
546
565
|
}).strict().superRefine((resourceType, context) => {
|
|
547
566
|
const supported = /* @__PURE__ */ new Set();
|
|
@@ -583,10 +602,10 @@ var pluginEventTypeSchema = z6.object({
|
|
|
583
602
|
suggested.add(eventType);
|
|
584
603
|
});
|
|
585
604
|
});
|
|
586
|
-
var pluginEventsSchema =
|
|
587
|
-
resourceTypes:
|
|
588
|
-
isEnabled:
|
|
589
|
-
normalizeIdentifier:
|
|
605
|
+
var pluginEventsSchema = z7.object({
|
|
606
|
+
resourceTypes: z7.array(pluginEventTypeSchema).min(1),
|
|
607
|
+
isEnabled: z7.function({ input: [], output: z7.boolean() }).optional(),
|
|
608
|
+
normalizeIdentifier: z7.function({ input: [z7.string()], output: z7.string() }).optional()
|
|
590
609
|
}).strict().superRefine((registration, context) => {
|
|
591
610
|
const seen = /* @__PURE__ */ new Set();
|
|
592
611
|
registration.resourceTypes.forEach((resourceType, index) => {
|
|
@@ -608,62 +627,62 @@ function normalizeEventIdentifier(registration, identifier) {
|
|
|
608
627
|
}
|
|
609
628
|
return normalized;
|
|
610
629
|
}
|
|
611
|
-
var subscribableResourceSchema =
|
|
612
|
-
identifier:
|
|
613
|
-
label:
|
|
614
|
-
namespace:
|
|
615
|
-
suggestedEvents:
|
|
616
|
-
supportedEvents:
|
|
630
|
+
var subscribableResourceSchema = z7.object({
|
|
631
|
+
identifier: z7.string().min(1),
|
|
632
|
+
label: z7.string().min(1),
|
|
633
|
+
namespace: z7.string().min(1),
|
|
634
|
+
suggestedEvents: z7.array(eventTypeSchema).optional(),
|
|
635
|
+
supportedEvents: z7.array(eventTypeSchema),
|
|
617
636
|
type: resourceTypeSchema
|
|
618
637
|
}).strict();
|
|
619
|
-
var watchResultSchema =
|
|
620
|
-
events:
|
|
621
|
-
id:
|
|
638
|
+
var watchResultSchema = z7.object({
|
|
639
|
+
events: z7.array(eventTypeSchema).min(1),
|
|
640
|
+
id: z7.string().min(1)
|
|
622
641
|
}).strict();
|
|
623
|
-
var eventInputSchema =
|
|
624
|
-
eventKey:
|
|
642
|
+
var eventInputSchema = z7.object({
|
|
643
|
+
eventKey: z7.string().min(1),
|
|
625
644
|
eventType: eventTypeSchema,
|
|
626
|
-
identifier:
|
|
627
|
-
occurredAtMs:
|
|
628
|
-
terminal:
|
|
629
|
-
trustedSummary:
|
|
645
|
+
identifier: z7.string().min(1),
|
|
646
|
+
occurredAtMs: z7.number().finite(),
|
|
647
|
+
terminal: z7.boolean().optional(),
|
|
648
|
+
trustedSummary: z7.string().min(1).transform((value) => value.slice(0, EVENT_SUMMARY_MAX_LENGTH)),
|
|
630
649
|
/** Trusted structured facts. Prefer ids and urls over long prose. */
|
|
631
650
|
data: eventDataSchema.optional(),
|
|
632
|
-
untrustedText:
|
|
651
|
+
untrustedText: z7.string().transform((value) => value.slice(0, EVENT_TEXT_MAX_LENGTH)).optional()
|
|
633
652
|
}).strict();
|
|
634
653
|
var eventSchema = eventInputSchema.extend({
|
|
635
|
-
namespace:
|
|
654
|
+
namespace: z7.string().min(1)
|
|
636
655
|
});
|
|
637
656
|
|
|
638
657
|
// src/tasks.ts
|
|
639
|
-
import { z as
|
|
640
|
-
var pluginRunTranscriptProvenanceSchema =
|
|
641
|
-
authority:
|
|
658
|
+
import { z as z8 } from "zod";
|
|
659
|
+
var pluginRunTranscriptProvenanceSchema = z8.object({
|
|
660
|
+
authority: z8.enum(["instruction", "context"]),
|
|
642
661
|
actor: actorSchema.optional()
|
|
643
662
|
}).strict();
|
|
644
|
-
var pluginRunTranscriptEntrySchema =
|
|
645
|
-
|
|
646
|
-
type:
|
|
647
|
-
role:
|
|
648
|
-
text:
|
|
663
|
+
var pluginRunTranscriptEntrySchema = z8.discriminatedUnion("type", [
|
|
664
|
+
z8.object({
|
|
665
|
+
type: z8.literal("message"),
|
|
666
|
+
role: z8.enum(["user", "assistant"]),
|
|
667
|
+
text: z8.string().min(1),
|
|
649
668
|
provenance: pluginRunTranscriptProvenanceSchema.optional(),
|
|
650
|
-
isRunActor:
|
|
669
|
+
isRunActor: z8.boolean().optional()
|
|
651
670
|
}).strict(),
|
|
652
|
-
|
|
653
|
-
type:
|
|
654
|
-
toolName:
|
|
655
|
-
isError:
|
|
656
|
-
text:
|
|
671
|
+
z8.object({
|
|
672
|
+
type: z8.literal("toolResult"),
|
|
673
|
+
toolName: z8.string().min(1),
|
|
674
|
+
isError: z8.boolean(),
|
|
675
|
+
text: z8.string().min(1).optional()
|
|
657
676
|
}).strict()
|
|
658
677
|
]);
|
|
659
|
-
var pluginRunContextSchema =
|
|
678
|
+
var pluginRunContextSchema = z8.object({
|
|
660
679
|
/** User linked to the Actor, when known. */
|
|
661
|
-
actorUserId:
|
|
662
|
-
completedAtMs:
|
|
663
|
-
conversationId:
|
|
680
|
+
actorUserId: z8.string().min(1).optional(),
|
|
681
|
+
completedAtMs: z8.number().finite(),
|
|
682
|
+
conversationId: z8.string().min(1),
|
|
664
683
|
destination: destinationSchema,
|
|
665
684
|
/** Location associated with this Conversation. */
|
|
666
|
-
locationId:
|
|
685
|
+
locationId: z8.string().min(1).optional(),
|
|
667
686
|
/**
|
|
668
687
|
* All distinct actors annotated on this run's committed instruction-authority
|
|
669
688
|
* messages, in first-seen order. Attribution provenance only, never an
|
|
@@ -672,43 +691,45 @@ var pluginRunContextSchema = z7.object({
|
|
|
672
691
|
* exceed the actors visible in the transcript slice. Usually `[run.actor]`;
|
|
673
692
|
* possibly empty for system runs with no human instructions.
|
|
674
693
|
*/
|
|
675
|
-
actors:
|
|
694
|
+
actors: z8.array(actorSchema),
|
|
676
695
|
/**
|
|
677
696
|
* The single actor this run executes as. Absent only for actor-less legacy
|
|
678
697
|
* system records, so authority-sensitive plugins must fail closed.
|
|
679
698
|
*/
|
|
680
699
|
actor: actorSchema.optional(),
|
|
681
|
-
runId:
|
|
700
|
+
runId: z8.string().min(1),
|
|
682
701
|
source: sourceSchema,
|
|
683
|
-
transcript:
|
|
702
|
+
transcript: z8.array(pluginRunTranscriptEntrySchema)
|
|
684
703
|
}).strict();
|
|
685
704
|
|
|
686
705
|
// src/tools.ts
|
|
687
|
-
import { z as
|
|
706
|
+
import { z as z9 } from "zod";
|
|
688
707
|
var PluginToolInputError = class extends Error {
|
|
689
708
|
constructor(message, options) {
|
|
690
709
|
super(message, options);
|
|
691
710
|
this.name = "PluginToolInputError";
|
|
692
711
|
}
|
|
693
712
|
};
|
|
694
|
-
var pluginToolContentSchema =
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
type:
|
|
698
|
-
data:
|
|
699
|
-
mimeType:
|
|
713
|
+
var pluginToolContentSchema = z9.discriminatedUnion("type", [
|
|
714
|
+
z9.object({ type: z9.literal("text"), text: z9.string() }).strict(),
|
|
715
|
+
z9.object({
|
|
716
|
+
type: z9.literal("image"),
|
|
717
|
+
data: z9.string(),
|
|
718
|
+
mimeType: z9.string()
|
|
700
719
|
}).strict()
|
|
701
720
|
]);
|
|
702
|
-
var pluginToolContinuationSchema =
|
|
703
|
-
arguments:
|
|
704
|
-
reason:
|
|
721
|
+
var pluginToolContinuationSchema = z9.object({
|
|
722
|
+
arguments: z9.record(z9.string(), z9.unknown()),
|
|
723
|
+
reason: z9.string().min(1).optional()
|
|
705
724
|
}).strict();
|
|
706
|
-
var pluginToolOutputSchema =
|
|
707
|
-
|
|
708
|
-
|
|
725
|
+
var pluginToolOutputSchema = z9.object({
|
|
726
|
+
/** Object results to save and show with the next reply. Omit for silent updates. */
|
|
727
|
+
objectAnnotations: z9.array(objectAnnotationSchema).optional(),
|
|
728
|
+
target: z9.string().min(1).optional(),
|
|
729
|
+
truncated: z9.boolean().optional(),
|
|
709
730
|
continuation: pluginToolContinuationSchema.optional()
|
|
710
731
|
}).passthrough();
|
|
711
|
-
var toolApprovalModeSchema =
|
|
732
|
+
var toolApprovalModeSchema = z9.enum(["auto", "review", "approve"]);
|
|
712
733
|
var REQUIRED_TOOL_ANNOTATION_KEYS = [
|
|
713
734
|
"destructiveHint",
|
|
714
735
|
"idempotentHint",
|
|
@@ -744,7 +765,7 @@ function createZodTool(definition, helperName) {
|
|
|
744
765
|
let modelInputSchema;
|
|
745
766
|
let modelOutputSchema;
|
|
746
767
|
try {
|
|
747
|
-
modelInputSchema =
|
|
768
|
+
modelInputSchema = z9.toJSONSchema(inputSchema);
|
|
748
769
|
} catch (error) {
|
|
749
770
|
throw new TypeError(
|
|
750
771
|
`${helperName}() inputSchema must be representable as JSON Schema.`,
|
|
@@ -752,7 +773,7 @@ function createZodTool(definition, helperName) {
|
|
|
752
773
|
);
|
|
753
774
|
}
|
|
754
775
|
try {
|
|
755
|
-
modelOutputSchema =
|
|
776
|
+
modelOutputSchema = z9.toJSONSchema(outputSchema);
|
|
756
777
|
} catch (error) {
|
|
757
778
|
throw new TypeError(
|
|
758
779
|
`${helperName}() outputSchema must be representable as JSON Schema.`,
|
|
@@ -778,7 +799,7 @@ function createZodTool(definition, helperName) {
|
|
|
778
799
|
);
|
|
779
800
|
if (isPluginToolOutputEnvelope(result)) {
|
|
780
801
|
return {
|
|
781
|
-
content:
|
|
802
|
+
content: z9.array(pluginToolContentSchema).parse(result.content),
|
|
782
803
|
details: outputSchema.parse(result.details)
|
|
783
804
|
};
|
|
784
805
|
}
|
|
@@ -795,76 +816,76 @@ function definePluginTool(definition) {
|
|
|
795
816
|
}
|
|
796
817
|
|
|
797
818
|
// src/operations.ts
|
|
798
|
-
import { z as
|
|
799
|
-
var pluginApiRouteRequestContextSchema =
|
|
800
|
-
auth:
|
|
801
|
-
user:
|
|
802
|
-
email:
|
|
803
|
-
emailVerified:
|
|
804
|
-
name:
|
|
819
|
+
import { z as z10 } from "zod";
|
|
820
|
+
var pluginApiRouteRequestContextSchema = z10.object({
|
|
821
|
+
auth: z10.object({
|
|
822
|
+
user: z10.object({
|
|
823
|
+
email: z10.string().nullable().optional(),
|
|
824
|
+
emailVerified: z10.boolean().optional(),
|
|
825
|
+
name: z10.string().nullable().optional()
|
|
805
826
|
}).strict()
|
|
806
827
|
}).strict(),
|
|
807
828
|
pluginName: nonBlankStringSchema
|
|
808
829
|
}).strict();
|
|
809
830
|
|
|
810
831
|
// src/credentials.ts
|
|
811
|
-
import { z as
|
|
812
|
-
var pluginProviderNameSchema =
|
|
813
|
-
var pluginGrantNameSchema =
|
|
814
|
-
var pluginGrantAccessSchema =
|
|
815
|
-
|
|
816
|
-
|
|
832
|
+
import { z as z11 } from "zod";
|
|
833
|
+
var pluginProviderNameSchema = z11.string().regex(/^[a-z][a-z0-9-]*$/);
|
|
834
|
+
var pluginGrantNameSchema = z11.string().regex(/^[a-z][a-z0-9.-]*$/);
|
|
835
|
+
var pluginGrantAccessSchema = z11.union([
|
|
836
|
+
z11.literal("read"),
|
|
837
|
+
z11.literal("write")
|
|
817
838
|
]);
|
|
818
|
-
var pluginAuthorizationSchema =
|
|
839
|
+
var pluginAuthorizationSchema = z11.object({
|
|
819
840
|
provider: pluginProviderNameSchema,
|
|
820
841
|
scope: nonBlankStringSchema.optional(),
|
|
821
|
-
type:
|
|
842
|
+
type: z11.literal("oauth")
|
|
822
843
|
}).strict();
|
|
823
|
-
var pluginProviderAccountSchema =
|
|
844
|
+
var pluginProviderAccountSchema = z11.object({
|
|
824
845
|
displayName: nonBlankStringSchema.optional(),
|
|
825
846
|
handle: nonBlankStringSchema.optional(),
|
|
826
847
|
id: nonBlankStringSchema,
|
|
827
848
|
label: nonBlankStringSchema.optional(),
|
|
828
849
|
url: nonBlankStringSchema.optional()
|
|
829
850
|
}).strict();
|
|
830
|
-
var pluginStoredTokensSchema =
|
|
851
|
+
var pluginStoredTokensSchema = z11.object({
|
|
831
852
|
account: pluginProviderAccountSchema.optional(),
|
|
832
853
|
accessToken: nonBlankStringSchema,
|
|
833
|
-
expiresAt:
|
|
854
|
+
expiresAt: z11.number().finite().optional(),
|
|
834
855
|
refreshToken: nonBlankStringSchema,
|
|
835
|
-
refreshTokenExpiresAt:
|
|
856
|
+
refreshTokenExpiresAt: z11.number().finite().optional(),
|
|
836
857
|
scope: nonBlankStringSchema.optional()
|
|
837
858
|
}).strict();
|
|
838
|
-
var pluginGrantSchema =
|
|
859
|
+
var pluginGrantSchema = z11.object({
|
|
839
860
|
access: pluginGrantAccessSchema,
|
|
840
861
|
leaseScope: nonBlankStringSchema.optional(),
|
|
841
862
|
name: pluginGrantNameSchema,
|
|
842
863
|
reason: nonBlankStringSchema.optional(),
|
|
843
|
-
requirements:
|
|
864
|
+
requirements: z11.array(nonBlankStringSchema).min(1).optional()
|
|
844
865
|
}).strict();
|
|
845
|
-
var pluginCredentialHeaderTransformSchema =
|
|
846
|
-
domain:
|
|
847
|
-
headers:
|
|
866
|
+
var pluginCredentialHeaderTransformSchema = z11.object({
|
|
867
|
+
domain: z11.string().min(1),
|
|
868
|
+
headers: z11.record(z11.string(), z11.string()).refine((headers) => Object.keys(headers).length > 0)
|
|
848
869
|
}).strict();
|
|
849
|
-
var pluginCredentialLeaseSchema =
|
|
870
|
+
var pluginCredentialLeaseSchema = z11.object({
|
|
850
871
|
account: pluginProviderAccountSchema.optional(),
|
|
851
872
|
authorization: pluginAuthorizationSchema.optional(),
|
|
852
|
-
expiresAt:
|
|
853
|
-
headerTransforms:
|
|
873
|
+
expiresAt: z11.string().refine((value) => Number.isFinite(Date.parse(value))),
|
|
874
|
+
headerTransforms: z11.array(pluginCredentialHeaderTransformSchema).min(1)
|
|
854
875
|
}).strict();
|
|
855
|
-
var pluginCredentialResultSchema =
|
|
856
|
-
|
|
876
|
+
var pluginCredentialResultSchema = z11.discriminatedUnion("type", [
|
|
877
|
+
z11.object({
|
|
857
878
|
lease: pluginCredentialLeaseSchema,
|
|
858
|
-
type:
|
|
879
|
+
type: z11.literal("lease")
|
|
859
880
|
}).strict(),
|
|
860
|
-
|
|
881
|
+
z11.object({
|
|
861
882
|
authorization: pluginAuthorizationSchema.optional(),
|
|
862
883
|
message: nonBlankStringSchema,
|
|
863
|
-
type:
|
|
884
|
+
type: z11.literal("needed")
|
|
864
885
|
}).strict(),
|
|
865
|
-
|
|
886
|
+
z11.object({
|
|
866
887
|
message: nonBlankStringSchema,
|
|
867
|
-
type:
|
|
888
|
+
type: z11.literal("unavailable")
|
|
868
889
|
}).strict()
|
|
869
890
|
]);
|
|
870
891
|
var EgressAuthRequired = class extends Error {
|
|
@@ -1000,44 +1021,44 @@ function defineJuniorPlugin(plugin) {
|
|
|
1000
1021
|
}
|
|
1001
1022
|
|
|
1002
1023
|
// src/user-pages.ts
|
|
1003
|
-
import { z as
|
|
1024
|
+
import { z as z12 } from "zod";
|
|
1004
1025
|
var userPageIdSchema = nonBlankStringSchema.max(64).regex(/^[a-z][a-z0-9-]*$/);
|
|
1005
1026
|
var userPageLabelSchema = nonBlankStringSchema.max(80);
|
|
1006
1027
|
var userPageDescriptionSchema = nonBlankStringSchema.max(500);
|
|
1007
|
-
var userPageNavigationSchema =
|
|
1008
|
-
var pluginUserPageMetricSchema =
|
|
1028
|
+
var userPageNavigationSchema = z12.enum(["primary", "profile"]);
|
|
1029
|
+
var pluginUserPageMetricSchema = z12.object({
|
|
1009
1030
|
detail: nonBlankStringSchema.max(500).optional(),
|
|
1010
1031
|
label: nonBlankStringSchema.max(80),
|
|
1011
|
-
tone:
|
|
1032
|
+
tone: z12.enum(["good", "neutral", "warning"]).optional(),
|
|
1012
1033
|
value: nonBlankStringSchema.max(120)
|
|
1013
1034
|
}).strict();
|
|
1014
|
-
var pluginUserPageMetadataSchema =
|
|
1035
|
+
var pluginUserPageMetadataSchema = z12.object({
|
|
1015
1036
|
label: nonBlankStringSchema.max(80),
|
|
1016
1037
|
value: nonBlankStringSchema.max(500)
|
|
1017
1038
|
}).strict();
|
|
1018
|
-
var pluginUserPageActionSchema =
|
|
1039
|
+
var pluginUserPageActionSchema = z12.object({
|
|
1019
1040
|
confirmation: nonBlankStringSchema.max(500).optional(),
|
|
1020
1041
|
href: nonBlankStringSchema.max(500).regex(/^\/api\/plugins\/[a-z][a-z0-9-]*(?:\/|$)/),
|
|
1021
1042
|
label: nonBlankStringSchema.max(80),
|
|
1022
|
-
method:
|
|
1023
|
-
tone:
|
|
1043
|
+
method: z12.literal("DELETE"),
|
|
1044
|
+
tone: z12.enum(["danger", "neutral"]).optional()
|
|
1024
1045
|
}).strict();
|
|
1025
|
-
var pluginUserPageRecordSchema =
|
|
1026
|
-
actions:
|
|
1046
|
+
var pluginUserPageRecordSchema = z12.object({
|
|
1047
|
+
actions: z12.array(pluginUserPageActionSchema).max(4).optional(),
|
|
1027
1048
|
description: nonBlankStringSchema.max(1e3).optional(),
|
|
1028
1049
|
id: nonBlankStringSchema.max(128),
|
|
1029
|
-
metadata:
|
|
1050
|
+
metadata: z12.array(pluginUserPageMetadataSchema).max(8).optional(),
|
|
1030
1051
|
title: nonBlankStringSchema.max(4e3)
|
|
1031
1052
|
}).strict();
|
|
1032
|
-
var pluginUserPageContentSchema =
|
|
1053
|
+
var pluginUserPageContentSchema = z12.object({
|
|
1033
1054
|
emptyText: nonBlankStringSchema.max(500).optional(),
|
|
1034
|
-
metrics:
|
|
1055
|
+
metrics: z12.array(pluginUserPageMetricSchema).max(6).optional(),
|
|
1035
1056
|
nextCursor: nonBlankStringSchema.max(1e3).optional(),
|
|
1036
|
-
records:
|
|
1057
|
+
records: z12.array(pluginUserPageRecordSchema).max(100),
|
|
1037
1058
|
searchPlaceholder: nonBlankStringSchema.max(120).optional(),
|
|
1038
|
-
type:
|
|
1059
|
+
type: z12.literal("list")
|
|
1039
1060
|
}).strict();
|
|
1040
|
-
var pluginUserPageLinkSchema =
|
|
1061
|
+
var pluginUserPageLinkSchema = z12.object({
|
|
1041
1062
|
description: userPageDescriptionSchema,
|
|
1042
1063
|
id: userPageIdSchema,
|
|
1043
1064
|
label: userPageLabelSchema,
|
|
@@ -1045,14 +1066,14 @@ var pluginUserPageLinkSchema = z11.object({
|
|
|
1045
1066
|
pluginDisplayName: nonBlankStringSchema.max(200),
|
|
1046
1067
|
pluginName: nonBlankStringSchema.max(100)
|
|
1047
1068
|
}).strict();
|
|
1048
|
-
var pluginUserPageLinksSchema =
|
|
1069
|
+
var pluginUserPageLinksSchema = z12.array(pluginUserPageLinkSchema);
|
|
1049
1070
|
var pluginUserPageCursorSchema = nonBlankStringSchema.max(1e3).optional();
|
|
1050
1071
|
var pluginUserPageFilterSchema = nonBlankStringSchema.max(64).optional();
|
|
1051
|
-
var pluginUserPageQuerySchema =
|
|
1052
|
-
var pluginUserPageInputSchema =
|
|
1072
|
+
var pluginUserPageQuerySchema = z12.string().trim().max(200).optional();
|
|
1073
|
+
var pluginUserPageInputSchema = z12.object({
|
|
1053
1074
|
cursor: pluginUserPageCursorSchema,
|
|
1054
1075
|
filter: pluginUserPageFilterSchema,
|
|
1055
|
-
limit:
|
|
1076
|
+
limit: z12.number().int().min(1).max(50),
|
|
1056
1077
|
query: pluginUserPageQuerySchema
|
|
1057
1078
|
}).strict();
|
|
1058
1079
|
export {
|
|
@@ -1108,6 +1129,8 @@ export {
|
|
|
1108
1129
|
missingToolAnnotationKeys,
|
|
1109
1130
|
nonBlankStringSchema,
|
|
1110
1131
|
normalizeEventIdentifier,
|
|
1132
|
+
objectAnnotationSchema,
|
|
1133
|
+
ownedObjectAnnotationSchema,
|
|
1111
1134
|
platformSchema,
|
|
1112
1135
|
pluginApiRouteRequestContextSchema,
|
|
1113
1136
|
pluginAuthorizationSchema,
|