@wordrhyme/plugin 0.1.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/index.d.ts +19 -0
- package/dist/admin/index.js +42 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/artifact.d.ts +17 -0
- package/dist/artifact.js +97 -0
- package/dist/artifact.js.map +1 -0
- package/dist/chunk-3IM3FPTJ.js +1470 -0
- package/dist/chunk-3IM3FPTJ.js.map +1 -0
- package/dist/chunk-6GDCFR67.js +218 -0
- package/dist/chunk-6GDCFR67.js.map +1 -0
- package/dist/chunk-7EM22QYB.js +333 -0
- package/dist/chunk-7EM22QYB.js.map +1 -0
- package/dist/chunk-BI7E5CVM.js +26 -0
- package/dist/chunk-BI7E5CVM.js.map +1 -0
- package/dist/chunk-BVOTSKM2.js +254 -0
- package/dist/chunk-BVOTSKM2.js.map +1 -0
- package/dist/chunk-DY44Q4CK.js +188 -0
- package/dist/chunk-DY44Q4CK.js.map +1 -0
- package/dist/chunk-MZOLSLJ7.js +65 -0
- package/dist/chunk-MZOLSLJ7.js.map +1 -0
- package/dist/chunk-O4AYK3YP.js +156 -0
- package/dist/chunk-O4AYK3YP.js.map +1 -0
- package/dist/chunk-UGMYO6AU.js +37 -0
- package/dist/chunk-UGMYO6AU.js.map +1 -0
- package/dist/client-poND5ovI.d.ts +679 -0
- package/dist/client.d.ts +9 -0
- package/dist/client.js +68 -0
- package/dist/client.js.map +1 -0
- package/dist/dev-utils.d.ts +105 -0
- package/dist/dev-utils.js +35 -0
- package/dist/dev-utils.js.map +1 -0
- package/dist/entity-extensions-CnhKoT4k.d.ts +56 -0
- package/dist/globalization.d.ts +85 -0
- package/dist/globalization.js +53 -0
- package/dist/globalization.js.map +1 -0
- package/dist/index.d.ts +724 -0
- package/dist/index.js +931 -0
- package/dist/index.js.map +1 -0
- package/dist/locale.d.ts +15 -0
- package/dist/locale.js +13 -0
- package/dist/locale.js.map +1 -0
- package/dist/manifest-CTFX-h0w.d.ts +2053 -0
- package/dist/react.d.ts +227 -0
- package/dist/react.js +226 -0
- package/dist/react.js.map +1 -0
- package/dist/release-BDJeO54k.d.ts +230 -0
- package/dist/server.d.ts +115 -0
- package/dist/server.js +194 -0
- package/dist/server.js.map +1 -0
- package/dist/time.d.ts +34 -0
- package/dist/time.js +31 -0
- package/dist/time.js.map +1 -0
- package/dist/trpc.d.ts +44 -0
- package/dist/trpc.js +11 -0
- package/dist/trpc.js.map +1 -0
- package/dist/types-BJo3_91V.d.ts +1997 -0
- package/package.json +92 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,724 @@
|
|
|
1
|
+
import { a as PluginContext, d as PluginLogger, e as WebPluginSiteInfo } from './types-BJo3_91V.js';
|
|
2
|
+
export { A as ActionContractMeta, f as ActionDescriptor, g as ActionInvokeRequest, h as AgentToolDescriptor, i as AiAliasDescriptor, j as AiBudget, k as AiModelCatalog, l as AiModelHint, m as AiModelListRequest, n as AiModelOption, o as AiObjectRequest, p as AiObjectResult, q as AiObjectSchema, r as AiRuntimeHandler, s as AiRuntimeHost, t as AiRuntimeInvocation, u as AiStreamEvent, v as AiTextRequest, w as AiTextResult, x as AiUsage, y as AiUsageAuthorization, z as AiUsageObservation, B as ApiPayload, E as EAuthModel, C as EAuthProvider, D as EAuthRefreshInput, F as EAuthRefreshResult, G as EAuthStatus, I as EAuthTokenResult, J as EAuthUpsertInput, K as EAuthUse, L as HookAbortError, H as HookContext, M as HookEmitOptions, b as HookHandlerOptions, N as HookPriority, c as HookTransaction, O as MARKETPLACE_PUBLISH_AUTH_METHODS, Q as MarketplaceAttestationTargetV1, R as MarketplaceExecutionErrorCode, S as MarketplaceExecutionFailureCode, T as MarketplaceOrganizationExecutionV1, U as MarketplacePlatformReadAction, V as MarketplacePublishActor, X as MarketplacePublishAuthMethod, Y as MarketplacePublisherAction, Z as MarketplaceRegistrySigningCapability, _ as OpaquePublisherCandidateV1, $ as PluginActionInvokerCapability, a0 as PluginAgentCapability, a1 as PluginAiCapability, a2 as PluginAiRuntimeCapability, a3 as PluginApisCapability, a4 as PluginArtifactCapability, a5 as PluginAssetCapability, a6 as PluginAssetCreateOptions, a7 as PluginAssetInfo, a8 as PluginAssetQuery, a9 as PluginAssetUpdateData, aa as PluginAssetVariant, ab as PluginCurrencyCapability, ac as PluginEAuthCapability, ad as PluginEntityExtensionCapability, ae as PluginEntityExtensionFilter, af as PluginFileCapability, ag as PluginFileInfo, ah as PluginFileQuery, ai as PluginFileUploadInput, aj as PluginHookCapability, ak as PluginJobOptions, al as PluginJobStatus, am as PluginMediaCapability, P as PluginMediaInfo, an as PluginMediaQuery, ao as PluginMediaUpdateData, ap as PluginMediaUploadInput, aq as PluginMediaVariant, ar as PluginMetricsAllowedLabels, as as PluginMetricsCapability, at as PluginNotificationActor, au as PluginNotificationCapability, av as PluginNotificationChannel, aw as PluginNotificationEvent, ax as PluginNotificationInput, ay as PluginNotificationResult, az as PluginNotificationSendParams, aA as PluginNotificationSendResult, aB as PluginNotificationTarget, aC as PluginNotificationTemplate, aD as PluginOrganizationMembersCapability, aE as PluginOrganizationProvisioningCapability, aF as PluginPaginatedResult, aG as PluginPermissionCapability, aH as PluginPermissionCheckContext, aI as PluginPermissionDef, aJ as PluginQueueCapability, aK as PluginScopedDb, aL as PluginSettingEntry, aM as PluginSettingOptions, aN as PluginSettingsCapability, aO as PluginStorageCapability, aP as PluginStorageProvider, aQ as PluginStorageProviderConfig, aR as PluginStorageProviderInfo, aS as PluginStorageUploadInput, aT as PluginStorageUploadResult, aU as PluginTraceCapability, aV as PluginUsageCapability, aW as PluginWebCapability, aX as ReadonlyPluginScopedDb, aY as WebJsonPrimitive, aZ as WebJsonValue, a_ as WebPluginDocumentMode, a$ as WebPluginHead, b0 as WebPluginHeadLink, b1 as WebPluginPresentationSurfaceResult, b2 as WebPluginRouteHandler, b3 as WebPluginRouteRequest, b4 as WebPluginRouteResult, b5 as WebPluginTenantInfo, b6 as WebPresentationAdapterClientDescriptor, b7 as WebResolvedPresentationAdapter, b8 as WebResolvedSitePresentation, b9 as WebResolvedSiteShell, ba as WebResolvedThemeAsset, bb as WebSerializableGlobalizationState, bc as WebSlotExtensionQuery, bd as WebSlotQueryResult, W as WebSlotRemoteExtension, be as WebSlotRenderMode, bf as WebSlotRenderOptions, bg as WebSlotRenderRequest, bh as WebSlotRenderResult, bi as WebSlotRenderer, bj as WebThemeShellClientDescriptor, bk as WebThemeShellDocumentModel, bl as WebThemeShellRenderResult, bm as WebThemeShellRenderer, bn as WebThemeShellRouteModel } from './types-BJo3_91V.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { Translator } from './globalization.js';
|
|
5
|
+
export { CurrencyInfo, DEFAULT_CURRENCY, FormatPriceOptions, GlobalizationState, I18nTextField, LanguageInfo, PriceFormatter, TextDirection, TranslationMessages, bankersRound, buildGlobalizationUrl, convertCurrency, createPriceFormatter, createTranslator, findCurrency, formatCurrencyAmount, formatPrice, fromCents, getBaseCurrency, getI18nText, getTextDirection, normalizeCurrencies, normalizeCurrencyInfo, resolveCurrencyInfo, toCents, withGlobalizationHelpers } from './globalization.js';
|
|
6
|
+
export { DEFAULT_LOCALE, canonicalizeLocale, isLocale, normalizeLocale } from './locale.js';
|
|
7
|
+
export { CLIENT_TIME_ZONE_COOKIE, CLIENT_TIME_ZONE_HEADER, DEFAULT_TIME_ZONE, DateFilterInput, DateFilterRange, DateRangeResolver, FormatDateTimeOptions, canonicalizeTimeZone, formatDateTime, getClientTimeZone, getSupportedTimeZones, isValidTimeZone, normalizeTimeZone, resolveDateFilterRange, toDateTimeLocal, toUtcDateTime, toUtcDayRange } from './time.js';
|
|
8
|
+
import { P as PluginManifest } from './manifest-CTFX-h0w.js';
|
|
9
|
+
export { A as AdminTour, b as AdminTourPlacement, c as AdminTourStep, d as AggregationStrategy, e as AutoCrudAction, f as AutoCrudActionZone, g as AutoCrudActions, h as EntityExtension, i as EntityExtensionCrudConfig, a as EntityExtensionField, E as EntityExtensionFieldType, j as EntityExtensionSlot, k as EntityExtensionUse, l as PluginCapabilities, m as PluginNotificationType, n as PluginStatus, W as WebDesignAction, o as WebDesignBlock, p as WebDesignDataSource, q as WebDesignSlot, r as WebDesignSurface, s as WebDesignTemplate, t as WebExtension, u as WebExtensionQuery, v as WebExtensionTarget, w as WebPluginRoute, x as WebSsrContractVersion, y as WebSurface, z as adminExtensionSchema, B as adminTourPlacementSchema, C as adminTourSchema, D as adminTourStepSchema, F as autoCrudActionSchema, G as autoCrudActionZoneSchema, H as autoCrudActionsSchema, I as autoCrudDataSourceSchema, J as autoCrudFieldConfigSchema, K as autoCrudFieldOptionSchema, L as dashboardTargetSchema, M as entityExtensionCrudConfigSchema, N as entityExtensionFieldSchema, O as entityExtensionSchema, Q as entityExtensionSlotSchema, R as entityExtensionUseSchema, S as navGroupTargetSchema, T as navTargetSchema, U as pluginI18nSchema, V as pluginManifestSchema, X as pluginUsesSchema, Y as routeTargetSchema, Z as settingsTargetSchema, _ as targetSchema, $ as webDesignActionSchema, a0 as webDesignBlockSchema, a1 as webDesignDataSourceSchema, a2 as webDesignSlotSchema, a3 as webDesignSurfaceSchema, a4 as webDesignTemplateSchema, a5 as webExtensionQuerySchema, a6 as webExtensionSchema, a7 as webExtensionTargetSchema, a8 as webPluginRouteSchema, a9 as webSsrContractVersionSchema, aa as webSurfaceSchema } from './manifest-CTFX-h0w.js';
|
|
10
|
+
export { c as PLUGIN_ARCHIVE_MEDIA_TYPE, d as PLUGIN_RELEASE_SCHEMA_VERSION, e as PluginRegistryCatalog, f as PluginRegistryRelease, P as PluginRelease, g as PluginReleaseFile, h as PluginSignature, i as REGISTRY_CATALOG_SIGNATURE_DOMAIN, b as RegistryCatalogPageEnvelope, R as RegistryReleaseEnvelope, a as RegistrySignature, j as canonicalRegistryCatalogPageEnvelope, k as canonicalRegistryReleaseEnvelope, p as pluginArchivePathSchema, l as pluginRegistryCatalogSchema, m as pluginRegistryReleaseSchema, n as pluginReleaseFileSchema, o as pluginReleaseSchema, q as pluginSignatureSchema, r as registryCatalogPageEnvelopeSchema, s as registryCatalogPageSignaturePayload, t as registryCatalogReleasesPayload, u as registryReleaseEnvelopeSchema, v as registryReleaseSignaturePayload, w as registrySignatureSchema } from './release-BDJeO54k.js';
|
|
11
|
+
export { E as ENTITY_EXTENSION_VALUES_SAVE_HOOK_ID, a as EXTENSION_PROJECT_SAVE_HOOK_ID, b as EntityExtensionProjectionValue, c as EntityExtensionValueSaveHandler, d as EntityExtensionValueSavePayload, e as EntityExtensionValueSaveResult, f as entityExtensions, r as registerEntityExtensionValueSaver } from './entity-extensions-CnhKoT4k.js';
|
|
12
|
+
export { D as DashboardTarget, E as ExtensionComponentMap, G as GenericTarget, N as NavGroupTarget, a as NavTarget, P as PRESENTATION_OBSERVABILITY, b as PresentationAction, c as PresentationAdapter, d as PresentationAdapterContext, e as PresentationAdapterRenderResult, f as PresentationAdapterRenderer, g as PresentationCompatibilityCheck, h as PresentationCompatibilityResult, i as PresentationDiagnostic, j as PresentationModel, k as PresentationRegion, l as PresentationSurface, m as PresentationSurfaceRenderer, R as RouteTarget, S as SettingsTarget, n as SitePresentationRenderContext, o as SlotContext, p as StorefrontApi, q as StorefrontBrowserClient, r as StorefrontOperation, s as StorefrontOperationKind, t as StorefrontRequest, u as StorefrontResponse, v as StorefrontServerBroker, T as Target, w as ThemeAsset, x as ThemeHead, y as ThemeHomeTarget, z as ThemeIntegration, A as ThemeSiteShell, B as ThemeToken, C as ThemeTokenPreset, F as ThemeTokenType, H as ToolbarHandlerMap, U as UIExtensionDef, W as WebAppEmbed, I as WebAppEmbedConsent, J as WebAppEmbedTarget, K as WebDesignBinding, L as WebDesignMigration, M as WebDesignNodeDefinition, O as WebDesignNodeKind, Q as WebDesignRegion, V as WebPresentation, X as dashboardExtension, Y as defineAppEmbed, Z as defineExtension, _ as definePresentationAdapter, $ as definePresentationSurface, a0 as defineStorefrontApi, a1 as defineThemeHomeTarget, a2 as defineWebDesignNode, a3 as defineWebPresentation, a4 as evaluatePresentationCompatibility, a5 as multiSlotExtension, a6 as navExtension, a7 as parsePresentationModel, a8 as presentationActionSchema, a9 as presentationAdapterSchema, aa as presentationCompatibilityResultSchema, ab as presentationCompatibilityStatusSchema, ac as presentationContractRangeSchema, ad as presentationContractVersionSchema, ae as presentationDiagnosticSchema, af as presentationDiagnosticSeveritySchema, ag as presentationIdSchema, ah as presentationModelSchema, ai as presentationPluginIdSchema, aj as presentationRegionSchema, ak as presentationRenderModeSchema, al as presentationSchemaRefSchema, am as presentationSurfaceSchema, an as routeExtension, ao as satisfiesPresentationRange, ap as settingsExtension, aq as storefrontApiSchema, ar as storefrontOperationKindSchema, as as storefrontOperationSchema, at as themeAssetPathSchema, au as themeAssetSchema, av as themeHeadSchema, aw as themeHomeTargetSchema, ax as themeIntegrationSchema, ay as themeSiteShellSchema, az as themeTokenPresetSchema, aA as themeTokenSchema, aB as themeTokenTypeSchema, aC as webAppEmbedConsentSchema, aD as webAppEmbedSchema, aE as webAppEmbedTargetSchema, aF as webDesignBindingSchema, aG as webDesignMigrationSchema, aH as webDesignNodeDefinitionSchema, aI as webDesignNodeKindSchema, aJ as webDesignRegionSchema, aK as webPresentationSchema } from './client-poND5ovI.js';
|
|
13
|
+
export { PluginDevRuntimeConfig, PluginPublicWebSharedName, PluginReactOptions, PluginReactSharedOptions, getPluginDevPort, getPluginDevRemoteEntry, getPluginDevRuntimeConfig, getPluginMfName, isPluginDevRemoteSelected, parsePluginList, pluginPublicWebShared, pluginReactOptions, pluginReactShared } from './dev-utils.js';
|
|
14
|
+
import 'decimal.js';
|
|
15
|
+
|
|
16
|
+
declare const MARKETPLACE_PUBLISH_SOURCES: readonly ["web", "cli", "github-actions"];
|
|
17
|
+
declare const marketplacePublishSourceSchema: z.ZodEnum<{
|
|
18
|
+
web: "web";
|
|
19
|
+
cli: "cli";
|
|
20
|
+
"github-actions": "github-actions";
|
|
21
|
+
}>;
|
|
22
|
+
type MarketplacePublishSource = z.infer<typeof marketplacePublishSourceSchema>;
|
|
23
|
+
declare const MARKETPLACE_PLUGIN_ICON_MEDIA_TYPES: readonly ["image/png", "image/jpeg", "image/webp", "image/gif"];
|
|
24
|
+
declare const MARKETPLACE_PLUGIN_ICON_MAX_BYTES: number;
|
|
25
|
+
type MarketplacePluginIconMediaType = (typeof MARKETPLACE_PLUGIN_ICON_MEDIA_TYPES)[number];
|
|
26
|
+
declare const MARKETPLACE_SUBMISSION_STATUSES: readonly ["uploaded", "scanning", "review_pending", "scan_failed", "approved", "rejected"];
|
|
27
|
+
declare const marketplaceSubmissionStatusSchema: z.ZodEnum<{
|
|
28
|
+
uploaded: "uploaded";
|
|
29
|
+
scanning: "scanning";
|
|
30
|
+
review_pending: "review_pending";
|
|
31
|
+
scan_failed: "scan_failed";
|
|
32
|
+
approved: "approved";
|
|
33
|
+
rejected: "rejected";
|
|
34
|
+
}>;
|
|
35
|
+
type MarketplaceSubmissionStatus = z.infer<typeof marketplaceSubmissionStatusSchema>;
|
|
36
|
+
declare const marketplacePublisherProfileInputSchema: z.ZodObject<{
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
type MarketplacePublisherProfileInput = z.infer<typeof marketplacePublisherProfileInputSchema>;
|
|
40
|
+
declare const marketplacePublisherProfileSchema: z.ZodObject<{
|
|
41
|
+
id: z.ZodString;
|
|
42
|
+
organizationId: z.ZodString;
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
trust: z.ZodEnum<{
|
|
45
|
+
first_party: "first_party";
|
|
46
|
+
third_party: "third_party";
|
|
47
|
+
}>;
|
|
48
|
+
status: z.ZodEnum<{
|
|
49
|
+
suspended: "suspended";
|
|
50
|
+
active: "active";
|
|
51
|
+
}>;
|
|
52
|
+
createdAt: z.ZodISODateTime;
|
|
53
|
+
updatedAt: z.ZodISODateTime;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
type MarketplacePublisherProfile = z.infer<typeof marketplacePublisherProfileSchema>;
|
|
56
|
+
declare const marketplacePublisherProfileResponseSchema: z.ZodObject<{
|
|
57
|
+
profile: z.ZodNullable<z.ZodObject<{
|
|
58
|
+
id: z.ZodString;
|
|
59
|
+
organizationId: z.ZodString;
|
|
60
|
+
name: z.ZodString;
|
|
61
|
+
trust: z.ZodEnum<{
|
|
62
|
+
first_party: "first_party";
|
|
63
|
+
third_party: "third_party";
|
|
64
|
+
}>;
|
|
65
|
+
status: z.ZodEnum<{
|
|
66
|
+
suspended: "suspended";
|
|
67
|
+
active: "active";
|
|
68
|
+
}>;
|
|
69
|
+
createdAt: z.ZodISODateTime;
|
|
70
|
+
updatedAt: z.ZodISODateTime;
|
|
71
|
+
}, z.core.$strip>>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
type MarketplacePublisherProfileResponse = z.infer<typeof marketplacePublisherProfileResponseSchema>;
|
|
74
|
+
declare const marketplacePublisherCapabilitiesSchema: z.ZodObject<{
|
|
75
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
76
|
+
ownedPluginMetadata: z.ZodBoolean;
|
|
77
|
+
pluginIconUpload: z.ZodOptional<z.ZodBoolean>;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
type MarketplacePublisherCapabilities = z.infer<typeof marketplacePublisherCapabilitiesSchema>;
|
|
80
|
+
declare const marketplacePublisherCapabilitiesResponseSchema: z.ZodObject<{
|
|
81
|
+
capabilities: z.ZodObject<{
|
|
82
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
83
|
+
ownedPluginMetadata: z.ZodBoolean;
|
|
84
|
+
pluginIconUpload: z.ZodOptional<z.ZodBoolean>;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
}, z.core.$strip>;
|
|
87
|
+
type MarketplacePublisherCapabilitiesResponse = z.infer<typeof marketplacePublisherCapabilitiesResponseSchema>;
|
|
88
|
+
declare const marketplaceOwnedPluginInputSchema: z.ZodObject<{
|
|
89
|
+
pluginId: z.ZodString;
|
|
90
|
+
name: z.ZodOptional<z.ZodString>;
|
|
91
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
92
|
+
iconUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
93
|
+
}, z.core.$strict>;
|
|
94
|
+
type MarketplaceOwnedPluginInput = z.infer<typeof marketplaceOwnedPluginInputSchema>;
|
|
95
|
+
declare const marketplaceOwnedPluginUpdateSchema: z.ZodObject<{
|
|
96
|
+
name: z.ZodString;
|
|
97
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
98
|
+
iconUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
99
|
+
}, z.core.$strict>;
|
|
100
|
+
type MarketplaceOwnedPluginUpdate = z.infer<typeof marketplaceOwnedPluginUpdateSchema>;
|
|
101
|
+
declare const marketplaceOwnedPluginSchema: z.ZodObject<{
|
|
102
|
+
pluginId: z.ZodString;
|
|
103
|
+
publisherId: z.ZodString;
|
|
104
|
+
name: z.ZodOptional<z.ZodString>;
|
|
105
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
106
|
+
iconUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
107
|
+
createdAt: z.ZodISODateTime;
|
|
108
|
+
updatedAt: z.ZodISODateTime;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
type MarketplaceOwnedPlugin = z.infer<typeof marketplaceOwnedPluginSchema>;
|
|
111
|
+
declare const marketplaceOwnedPluginsResponseSchema: z.ZodObject<{
|
|
112
|
+
items: z.ZodArray<z.ZodObject<{
|
|
113
|
+
pluginId: z.ZodString;
|
|
114
|
+
publisherId: z.ZodString;
|
|
115
|
+
name: z.ZodOptional<z.ZodString>;
|
|
116
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
117
|
+
iconUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
118
|
+
createdAt: z.ZodISODateTime;
|
|
119
|
+
updatedAt: z.ZodISODateTime;
|
|
120
|
+
}, z.core.$strip>>;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
type MarketplaceOwnedPluginsResponse = z.infer<typeof marketplaceOwnedPluginsResponseSchema>;
|
|
123
|
+
declare const marketplaceOwnedPluginResponseSchema: z.ZodObject<{
|
|
124
|
+
plugin: z.ZodObject<{
|
|
125
|
+
pluginId: z.ZodString;
|
|
126
|
+
publisherId: z.ZodString;
|
|
127
|
+
name: z.ZodOptional<z.ZodString>;
|
|
128
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
129
|
+
iconUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
130
|
+
createdAt: z.ZodISODateTime;
|
|
131
|
+
updatedAt: z.ZodISODateTime;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
}, z.core.$strip>;
|
|
134
|
+
type MarketplaceOwnedPluginResponse = z.infer<typeof marketplaceOwnedPluginResponseSchema>;
|
|
135
|
+
declare const marketplaceSubmissionSchema: z.ZodObject<{
|
|
136
|
+
id: z.ZodString;
|
|
137
|
+
publisherId: z.ZodString;
|
|
138
|
+
organizationId: z.ZodString;
|
|
139
|
+
pluginId: z.ZodString;
|
|
140
|
+
version: z.ZodString;
|
|
141
|
+
status: z.ZodEnum<{
|
|
142
|
+
uploaded: "uploaded";
|
|
143
|
+
scanning: "scanning";
|
|
144
|
+
review_pending: "review_pending";
|
|
145
|
+
scan_failed: "scan_failed";
|
|
146
|
+
approved: "approved";
|
|
147
|
+
rejected: "rejected";
|
|
148
|
+
}>;
|
|
149
|
+
uploadSource: z.ZodEnum<{
|
|
150
|
+
web: "web";
|
|
151
|
+
cli: "cli";
|
|
152
|
+
"github-actions": "github-actions";
|
|
153
|
+
}>;
|
|
154
|
+
uploadActorId: z.ZodNullable<z.ZodString>;
|
|
155
|
+
uploadAuthMethod: z.ZodNullable<z.ZodEnum<{
|
|
156
|
+
"portal-session": "portal-session";
|
|
157
|
+
"scoped-api-key": "scoped-api-key";
|
|
158
|
+
}>>;
|
|
159
|
+
uploadCredentialId: z.ZodNullable<z.ZodString>;
|
|
160
|
+
uploadAuthenticatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
161
|
+
reviewReason: z.ZodNullable<z.ZodString>;
|
|
162
|
+
reviewedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
163
|
+
createdAt: z.ZodISODateTime;
|
|
164
|
+
updatedAt: z.ZodISODateTime;
|
|
165
|
+
}, z.core.$strip>;
|
|
166
|
+
type MarketplaceSubmission = z.infer<typeof marketplaceSubmissionSchema>;
|
|
167
|
+
declare const marketplaceSubmissionCursorSchema: z.ZodObject<{
|
|
168
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
169
|
+
pluginId: z.ZodOptional<z.ZodString>;
|
|
170
|
+
}, z.core.$strip>;
|
|
171
|
+
type MarketplaceSubmissionCursor = z.infer<typeof marketplaceSubmissionCursorSchema>;
|
|
172
|
+
declare const marketplaceSubmissionsResponseSchema: z.ZodObject<{
|
|
173
|
+
items: z.ZodArray<z.ZodObject<{
|
|
174
|
+
id: z.ZodString;
|
|
175
|
+
publisherId: z.ZodString;
|
|
176
|
+
organizationId: z.ZodString;
|
|
177
|
+
pluginId: z.ZodString;
|
|
178
|
+
version: z.ZodString;
|
|
179
|
+
status: z.ZodEnum<{
|
|
180
|
+
uploaded: "uploaded";
|
|
181
|
+
scanning: "scanning";
|
|
182
|
+
review_pending: "review_pending";
|
|
183
|
+
scan_failed: "scan_failed";
|
|
184
|
+
approved: "approved";
|
|
185
|
+
rejected: "rejected";
|
|
186
|
+
}>;
|
|
187
|
+
uploadSource: z.ZodEnum<{
|
|
188
|
+
web: "web";
|
|
189
|
+
cli: "cli";
|
|
190
|
+
"github-actions": "github-actions";
|
|
191
|
+
}>;
|
|
192
|
+
uploadActorId: z.ZodNullable<z.ZodString>;
|
|
193
|
+
uploadAuthMethod: z.ZodNullable<z.ZodEnum<{
|
|
194
|
+
"portal-session": "portal-session";
|
|
195
|
+
"scoped-api-key": "scoped-api-key";
|
|
196
|
+
}>>;
|
|
197
|
+
uploadCredentialId: z.ZodNullable<z.ZodString>;
|
|
198
|
+
uploadAuthenticatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
199
|
+
reviewReason: z.ZodNullable<z.ZodString>;
|
|
200
|
+
reviewedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
201
|
+
createdAt: z.ZodISODateTime;
|
|
202
|
+
updatedAt: z.ZodISODateTime;
|
|
203
|
+
}, z.core.$strip>>;
|
|
204
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
205
|
+
}, z.core.$strip>;
|
|
206
|
+
type MarketplaceSubmissionsResponse = z.infer<typeof marketplaceSubmissionsResponseSchema>;
|
|
207
|
+
declare const marketplaceReleaseAcceptedResponseSchema: z.ZodObject<{
|
|
208
|
+
submission: z.ZodObject<{
|
|
209
|
+
id: z.ZodString;
|
|
210
|
+
publisherId: z.ZodString;
|
|
211
|
+
organizationId: z.ZodString;
|
|
212
|
+
pluginId: z.ZodString;
|
|
213
|
+
version: z.ZodString;
|
|
214
|
+
status: z.ZodEnum<{
|
|
215
|
+
uploaded: "uploaded";
|
|
216
|
+
scanning: "scanning";
|
|
217
|
+
review_pending: "review_pending";
|
|
218
|
+
scan_failed: "scan_failed";
|
|
219
|
+
approved: "approved";
|
|
220
|
+
rejected: "rejected";
|
|
221
|
+
}>;
|
|
222
|
+
uploadSource: z.ZodEnum<{
|
|
223
|
+
web: "web";
|
|
224
|
+
cli: "cli";
|
|
225
|
+
"github-actions": "github-actions";
|
|
226
|
+
}>;
|
|
227
|
+
uploadActorId: z.ZodNullable<z.ZodString>;
|
|
228
|
+
uploadAuthMethod: z.ZodNullable<z.ZodEnum<{
|
|
229
|
+
"portal-session": "portal-session";
|
|
230
|
+
"scoped-api-key": "scoped-api-key";
|
|
231
|
+
}>>;
|
|
232
|
+
uploadCredentialId: z.ZodNullable<z.ZodString>;
|
|
233
|
+
uploadAuthenticatedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
234
|
+
reviewReason: z.ZodNullable<z.ZodString>;
|
|
235
|
+
reviewedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
236
|
+
createdAt: z.ZodISODateTime;
|
|
237
|
+
updatedAt: z.ZodISODateTime;
|
|
238
|
+
}, z.core.$strip>;
|
|
239
|
+
}, z.core.$strip>;
|
|
240
|
+
type MarketplaceReleaseAcceptedResponse = z.infer<typeof marketplaceReleaseAcceptedResponseSchema>;
|
|
241
|
+
declare const marketplacePublisherErrorSchema: z.ZodObject<{
|
|
242
|
+
error: z.ZodString;
|
|
243
|
+
}, z.core.$strip>;
|
|
244
|
+
type MarketplacePublisherError = z.infer<typeof marketplacePublisherErrorSchema>;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Plugin Definition - Type-safe plugin configuration
|
|
248
|
+
*/
|
|
249
|
+
interface PluginDefinition {
|
|
250
|
+
/** Plugin manifest (required fields only) */
|
|
251
|
+
manifest: Pick<PluginManifest, 'pluginId' | 'version' | 'name' | 'vendor' | 'engines'> & Partial<PluginManifest>;
|
|
252
|
+
/** Server-side exports */
|
|
253
|
+
server?: {
|
|
254
|
+
/** tRPC router (optional) */
|
|
255
|
+
router?: unknown;
|
|
256
|
+
/** Lifecycle hooks */
|
|
257
|
+
onInstall?: (ctx: PluginContext) => Promise<void>;
|
|
258
|
+
onEnable?: (ctx: PluginContext) => Promise<void>;
|
|
259
|
+
onDisable?: (ctx: PluginContext) => Promise<void>;
|
|
260
|
+
onUninstall?: (ctx: PluginContext) => Promise<void>;
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Define a plugin with type safety
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```ts
|
|
268
|
+
* import { definePlugin } from '@wordrhyme/plugin';
|
|
269
|
+
*
|
|
270
|
+
* export default definePlugin({
|
|
271
|
+
* manifest: {
|
|
272
|
+
* pluginId: 'com.example.hello',
|
|
273
|
+
* version: '1.0.0',
|
|
274
|
+
* name: 'Hello World',
|
|
275
|
+
* vendor: 'Example Inc',
|
|
276
|
+
* engines: { wordrhyme: '^0.1.0' },
|
|
277
|
+
* },
|
|
278
|
+
* server: {
|
|
279
|
+
* router: myRouter,
|
|
280
|
+
* onEnable: async (ctx) => {
|
|
281
|
+
* ctx.logger.info('Plugin enabled!');
|
|
282
|
+
* },
|
|
283
|
+
* },
|
|
284
|
+
* });
|
|
285
|
+
* ```
|
|
286
|
+
*/
|
|
287
|
+
declare function definePlugin(definition: PluginDefinition): PluginDefinition;
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Plugin Runtime Helpers (Client-Side)
|
|
291
|
+
*
|
|
292
|
+
* Utilities for plugins to use logger and permission capabilities.
|
|
293
|
+
* These are convenience wrappers that work within plugin context.
|
|
294
|
+
*/
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Create a scoped logger for a plugin
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```ts
|
|
301
|
+
* import { createLogger } from '@wordrhyme/plugin';
|
|
302
|
+
*
|
|
303
|
+
* const logger = createLogger('com.vendor.my-plugin');
|
|
304
|
+
* logger.info('Plugin started');
|
|
305
|
+
* ```
|
|
306
|
+
*/
|
|
307
|
+
declare function createLogger(pluginId: string): PluginLogger;
|
|
308
|
+
/**
|
|
309
|
+
* Check if a permission is granted in the context
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* ```ts
|
|
313
|
+
* import { checkPermission } from '@wordrhyme/plugin';
|
|
314
|
+
*
|
|
315
|
+
* async function myHandler(ctx: PluginContext) {
|
|
316
|
+
* if (await checkPermission(ctx, 'content:read:*')) {
|
|
317
|
+
* // User has permission
|
|
318
|
+
* }
|
|
319
|
+
* }
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
declare function checkPermission(ctx: PluginContext, capability: string): Promise<boolean>;
|
|
323
|
+
/**
|
|
324
|
+
* Require a permission - throws if denied
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* ```ts
|
|
328
|
+
* import { requirePermission } from '@wordrhyme/plugin';
|
|
329
|
+
*
|
|
330
|
+
* async function protectedHandler(ctx: PluginContext) {
|
|
331
|
+
* await requirePermission(ctx, 'admin:manage:*');
|
|
332
|
+
* // Only executes if permission granted
|
|
333
|
+
* }
|
|
334
|
+
* ```
|
|
335
|
+
*/
|
|
336
|
+
declare function requirePermission(ctx: PluginContext, capability: string): Promise<void>;
|
|
337
|
+
/**
|
|
338
|
+
* Check if plugin declared a capability in its manifest
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```ts
|
|
342
|
+
* import { hasCapability } from '@wordrhyme/plugin';
|
|
343
|
+
*
|
|
344
|
+
* function checkDeclared(ctx: PluginContext) {
|
|
345
|
+
* if (hasCapability(ctx, 'content:write:*')) {
|
|
346
|
+
* // Plugin declared this capability
|
|
347
|
+
* }
|
|
348
|
+
* }
|
|
349
|
+
* ```
|
|
350
|
+
*/
|
|
351
|
+
declare function hasCapability(ctx: PluginContext, capability: string): boolean;
|
|
352
|
+
|
|
353
|
+
type WebUrlSearchValue = boolean | number | string | null | undefined;
|
|
354
|
+
type WebUrlSearchParams = URLSearchParams | Record<string, WebUrlSearchValue>;
|
|
355
|
+
/**
|
|
356
|
+
* Builds an absolute URL for a public Web route without assuming how the site
|
|
357
|
+
* is hosted. Custom domains and platform subdomains use an empty basePath;
|
|
358
|
+
* platform-path sites provide a basePath such as `/s/acme`.
|
|
359
|
+
*/
|
|
360
|
+
declare function buildWebUrl(site: Pick<WebPluginSiteInfo, 'basePath' | 'publicOrigin'> | null | undefined, href: string, searchParams?: WebUrlSearchParams): string | null;
|
|
361
|
+
|
|
362
|
+
declare const AI_ERROR_I18N_KEYS: {
|
|
363
|
+
readonly AI_ALIAS_NOT_DECLARED: "errors.ai.aliasNotDeclared";
|
|
364
|
+
readonly AI_BALANCE_INSUFFICIENT: "errors.ai.balanceInsufficient";
|
|
365
|
+
readonly AI_BUDGET_EXCEEDED: "errors.ai.budgetExceeded";
|
|
366
|
+
readonly AI_CONFIG_INVALID: "errors.ai.configInvalid";
|
|
367
|
+
readonly AI_CONFIG_REQUIRED: "errors.ai.configRequired";
|
|
368
|
+
readonly AI_CONFIG_REVISION_STALE: "errors.ai.configRevisionStale";
|
|
369
|
+
readonly AI_CONNECTION_FAILED: "errors.ai.connectionFailed";
|
|
370
|
+
readonly AI_CONNECTION_NOT_FOUND: "errors.ai.connectionNotFound";
|
|
371
|
+
readonly AI_CONTEXT_REQUIRED: "errors.ai.contextRequired";
|
|
372
|
+
readonly AI_CREDENTIAL_INVALID: "errors.ai.credentialInvalid";
|
|
373
|
+
readonly AI_CREDENTIAL_REQUIRED: "errors.ai.credentialRequired";
|
|
374
|
+
readonly AI_DEFAULT_MODEL_NOT_FOUND: "errors.ai.defaultModelNotFound";
|
|
375
|
+
readonly AI_MODEL_NOT_FOUND: "errors.ai.modelNotFound";
|
|
376
|
+
readonly AI_MODEL_SELECTION_INVALID: "errors.ai.modelSelectionInvalid";
|
|
377
|
+
readonly AI_PROVIDER_ABORTED: "errors.ai.providerAborted";
|
|
378
|
+
readonly AI_PROVIDER_FAILED: "errors.ai.providerFailed";
|
|
379
|
+
readonly AI_QUOTA_EXCEEDED: "errors.ai.quotaExceeded";
|
|
380
|
+
readonly AI_RUNTIME_FAILED: "errors.ai.runtimeFailed";
|
|
381
|
+
readonly AI_RUNTIME_HOST_SERVICES_UNAVAILABLE: "errors.ai.runtimeHostServicesUnavailable";
|
|
382
|
+
readonly AI_RUNTIME_READINESS_UNAVAILABLE: "errors.ai.runtimeReadinessUnavailable";
|
|
383
|
+
readonly AI_RUNTIME_UNAVAILABLE: "errors.ai.runtimeUnavailable";
|
|
384
|
+
};
|
|
385
|
+
type AiErrorCode = keyof typeof AI_ERROR_I18N_KEYS;
|
|
386
|
+
type AiErrorI18nKey = (typeof AI_ERROR_I18N_KEYS)[AiErrorCode];
|
|
387
|
+
interface AiErrorDescriptor {
|
|
388
|
+
code: AiErrorCode;
|
|
389
|
+
i18nKey: AiErrorI18nKey;
|
|
390
|
+
}
|
|
391
|
+
declare function aiErrorDescriptor(error: unknown): AiErrorDescriptor | undefined;
|
|
392
|
+
declare function formatAiError(error: unknown, translateCommon: Translator, fallback: string): string;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Agent tool assembly + pre-call governance (AI Action Gateway, Phase 1).
|
|
396
|
+
*
|
|
397
|
+
* Translates the governed Action Catalog into the tool shape an LLM runtime
|
|
398
|
+
* consumes, and enforces the rules that must hold BEFORE a model-proposed call
|
|
399
|
+
* reaches the invoker. Kept in the SDK so any agent-host plugin gets identical
|
|
400
|
+
* semantics rather than re-deriving them.
|
|
401
|
+
*
|
|
402
|
+
* Two rules carry most of the weight (plan §9):
|
|
403
|
+
*
|
|
404
|
+
* - **The model never picks a procedure path.** Tools are named after stable
|
|
405
|
+
* `actionId`s; the Host resolves the binding. A hallucinated tool name is a
|
|
406
|
+
* miss, not an arbitrary call.
|
|
407
|
+
* - **The model cannot talk its way past a confirmation.** Risk comes from the
|
|
408
|
+
* curated contract, never from tool output or model reasoning, and high-risk
|
|
409
|
+
* calls are refused here unless an approval token is already present.
|
|
410
|
+
*
|
|
411
|
+
* Both rules assume the tool name arrived as protocol data. `ToolChannel` is
|
|
412
|
+
* where that assumption is made explicit and enforced.
|
|
413
|
+
*/
|
|
414
|
+
/**
|
|
415
|
+
* How a tool call reached us.
|
|
416
|
+
*
|
|
417
|
+
* `native` — the provider returned a structured tool call over its own protocol,
|
|
418
|
+
* so the tool name is a protocol fact and maps to a curated `actionId`.
|
|
419
|
+
*
|
|
420
|
+
* `text-recovered` — the call was parsed out of the model's prose, the way
|
|
421
|
+
* text-mode runtimes recover DeepSeek DSML markup and similar. There the tool
|
|
422
|
+
* name *is* model-authored free text, which collapses the boundary the two rules
|
|
423
|
+
* above rest on: prose becomes the source of the action to run. Such a channel
|
|
424
|
+
* therefore carries `query` actions only — a channel that cannot be trusted to
|
|
425
|
+
* name an action cannot be trusted to change data.
|
|
426
|
+
*/
|
|
427
|
+
type ToolChannel = "native" | "text-recovered";
|
|
428
|
+
/** Minimal shape of a catalog entry; mirrors ActionDescriptor without importing it. */
|
|
429
|
+
interface AgentToolSource {
|
|
430
|
+
actionId: string;
|
|
431
|
+
revision: number;
|
|
432
|
+
kind: "query" | "command";
|
|
433
|
+
risk: "low" | "medium" | "high";
|
|
434
|
+
summary?: string | undefined;
|
|
435
|
+
}
|
|
436
|
+
/** JSON-Schema-shaped tool definition, the lingua franca of tool-calling APIs. */
|
|
437
|
+
interface AgentToolDefinition {
|
|
438
|
+
name: string;
|
|
439
|
+
description: string;
|
|
440
|
+
inputSchema: {
|
|
441
|
+
type: "object";
|
|
442
|
+
properties: Record<string, unknown>;
|
|
443
|
+
required?: string[];
|
|
444
|
+
additionalProperties: boolean;
|
|
445
|
+
};
|
|
446
|
+
/** Curated metadata; NOT model-supplied and NOT to be trusted from tool output. */
|
|
447
|
+
metadata: {
|
|
448
|
+
actionId: string;
|
|
449
|
+
revision: number;
|
|
450
|
+
kind: "query" | "command";
|
|
451
|
+
risk: "low" | "medium" | "high";
|
|
452
|
+
requiresApproval: boolean;
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
interface AssembleOptions {
|
|
456
|
+
/** Argument schemas by actionId, when the host can supply them. */
|
|
457
|
+
argumentSchemas?: Record<string, {
|
|
458
|
+
properties: Record<string, unknown>;
|
|
459
|
+
required?: string[];
|
|
460
|
+
}>;
|
|
461
|
+
/** Drop actions above this risk level from what the model can even see. */
|
|
462
|
+
maxRisk?: "low" | "medium" | "high";
|
|
463
|
+
/**
|
|
464
|
+
* The channel these tools will be offered on. A `text-recovered` channel is
|
|
465
|
+
* assembled without commands, so the model is never shown a write the gate
|
|
466
|
+
* would refuse anyway. Defaults to `native`: this is a pure helper, and the
|
|
467
|
+
* callers that hold a real channel (`runAgent`, the host endpoints) are the
|
|
468
|
+
* ones that treat an undeclared channel as untrusted.
|
|
469
|
+
*/
|
|
470
|
+
channel?: ToolChannel;
|
|
471
|
+
}
|
|
472
|
+
/** Tool names must survive provider naming rules (letters, digits, _, -). */
|
|
473
|
+
declare function toolNameFor(actionId: string): string;
|
|
474
|
+
declare function requiresApprovalFor(risk: AgentToolSource["risk"]): boolean;
|
|
475
|
+
/**
|
|
476
|
+
* Build the tool list exposed to a model.
|
|
477
|
+
*
|
|
478
|
+
* Descriptions state the governance consequence explicitly: models behave better
|
|
479
|
+
* when told a call will pause for a human than when silently refused later.
|
|
480
|
+
*/
|
|
481
|
+
declare function assembleTools(sources: readonly AgentToolSource[], options?: AssembleOptions): AgentToolDefinition[];
|
|
482
|
+
type ToolCallDecision = {
|
|
483
|
+
allow: true;
|
|
484
|
+
actionId: string;
|
|
485
|
+
revision: number;
|
|
486
|
+
} | {
|
|
487
|
+
allow: false;
|
|
488
|
+
reason: ToolCallRefusal;
|
|
489
|
+
message: string;
|
|
490
|
+
};
|
|
491
|
+
type ToolCallRefusal = "UNKNOWN_TOOL" | "APPROVAL_REQUIRED" | "BUDGET_EXHAUSTED" | "TENANT_PAUSED" | "CHANNEL_READ_ONLY";
|
|
492
|
+
interface ToolCallGateInput {
|
|
493
|
+
toolName: string;
|
|
494
|
+
tools: readonly AgentToolDefinition[];
|
|
495
|
+
/** Present when the caller already holds a human approval for this call. */
|
|
496
|
+
approvalToken?: string | undefined;
|
|
497
|
+
/** Remaining tool calls in this run; `undefined` means unbounded. */
|
|
498
|
+
remainingCalls?: number | undefined;
|
|
499
|
+
/** Tenant-level kill switch for AI writes (plan §9 resource exhaustion). */
|
|
500
|
+
writesPaused?: boolean;
|
|
501
|
+
/** How this call reached us; a `text-recovered` channel carries reads only. */
|
|
502
|
+
channel?: ToolChannel;
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Decide whether a model-proposed tool call may proceed.
|
|
506
|
+
*
|
|
507
|
+
* Runs before the invoker so refusals cost nothing and can be fed back to the
|
|
508
|
+
* model as a normal tool result — a refused call should steer the model, not
|
|
509
|
+
* crash the run.
|
|
510
|
+
*/
|
|
511
|
+
declare function gateToolCall(input: ToolCallGateInput): ToolCallDecision;
|
|
512
|
+
/**
|
|
513
|
+
* Wrap a tool result before it re-enters the model context.
|
|
514
|
+
*
|
|
515
|
+
* Tool output is untrusted input (plan §9 malicious tool output): it is fenced
|
|
516
|
+
* and labelled so the model cannot pass it off as an instruction, and it can
|
|
517
|
+
* never carry governance metadata of its own.
|
|
518
|
+
*/
|
|
519
|
+
declare function encodeToolResult(actionId: string, result: unknown): string;
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* Governed agent run loop (AI Action Gateway, Phase 1).
|
|
523
|
+
*
|
|
524
|
+
* The multi-turn loop that sits between a model and the governed action
|
|
525
|
+
* surface. It is deliberately **model-agnostic**: the LLM is reached through a
|
|
526
|
+
* narrow `ModelClient` seam, so the chosen runtime (Pi — see
|
|
527
|
+
* `docs/architecture/adr/2026-07-27-agent-runtime-pi.md`) is one implementation
|
|
528
|
+
* rather than a structural dependency, and the whole governance path is
|
|
529
|
+
* testable without a network or API key.
|
|
530
|
+
*
|
|
531
|
+
* What the loop guarantees, regardless of what the model does:
|
|
532
|
+
*
|
|
533
|
+
* - **Budgets are hard.** Turn and tool-call ceilings are enforced by the loop,
|
|
534
|
+
* not requested of the model. A runaway loop stops.
|
|
535
|
+
* - **Refusals steer, they don't crash.** A gated call returns a tool result
|
|
536
|
+
* explaining why, so the model can adapt; only infrastructure faults throw.
|
|
537
|
+
* - **Tool output is data.** Results are fenced and labelled before re-entering
|
|
538
|
+
* the context, and can never redirect which action runs next — the actionId
|
|
539
|
+
* always comes from the curated catalog via the tool name.
|
|
540
|
+
* - **Prose cannot become a command.** That last guarantee holds only while the
|
|
541
|
+
* tool name is protocol data, so a client that recovers calls from model text
|
|
542
|
+
* (`channel: 'text-recovered'`) is confined to read-only actions.
|
|
543
|
+
* - **High-risk work pauses.** A call needing approval suspends the run with
|
|
544
|
+
* everything the caller needs to raise a confirmation, instead of guessing.
|
|
545
|
+
*/
|
|
546
|
+
|
|
547
|
+
interface ModelToolCall {
|
|
548
|
+
id: string;
|
|
549
|
+
/** Tool name as emitted by the model; resolved against the catalog, never trusted as a path. */
|
|
550
|
+
name: string;
|
|
551
|
+
arguments?: unknown;
|
|
552
|
+
}
|
|
553
|
+
interface ModelMessage {
|
|
554
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
555
|
+
content: string;
|
|
556
|
+
toolCalls?: ModelToolCall[];
|
|
557
|
+
toolCallId?: string;
|
|
558
|
+
}
|
|
559
|
+
interface ModelResponse {
|
|
560
|
+
text?: string;
|
|
561
|
+
toolCalls?: ModelToolCall[];
|
|
562
|
+
usage?: {
|
|
563
|
+
inputTokens?: number;
|
|
564
|
+
outputTokens?: number;
|
|
565
|
+
costUsd?: number;
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
interface ModelClient {
|
|
569
|
+
/**
|
|
570
|
+
* How this client surfaces tool calls. An adapter that parses them out of the
|
|
571
|
+
* model's prose rather than reading them off the wire MUST declare
|
|
572
|
+
* `text-recovered`; the loop then withholds every command action.
|
|
573
|
+
*
|
|
574
|
+
* Required so the choice is made by whoever writes the adapter, who is the
|
|
575
|
+
* only one who knows. An absent value is treated as `text-recovered` — the
|
|
576
|
+
* restrictive reading — because reaching that line means the declaration was
|
|
577
|
+
* bypassed rather than considered.
|
|
578
|
+
*/
|
|
579
|
+
readonly channel: ToolChannel;
|
|
580
|
+
complete(input: {
|
|
581
|
+
messages: ModelMessage[];
|
|
582
|
+
tools: AgentToolDefinition[];
|
|
583
|
+
signal?: AbortSignal;
|
|
584
|
+
}): Promise<ModelResponse>;
|
|
585
|
+
}
|
|
586
|
+
/** Executes an accepted call. Implemented by the host over `ctx.actions.invoke`. */
|
|
587
|
+
type ActionExecutor = (call: {
|
|
588
|
+
actionId: string;
|
|
589
|
+
revision: number;
|
|
590
|
+
args: unknown;
|
|
591
|
+
}) => Promise<unknown>;
|
|
592
|
+
type AgentRunEvent = {
|
|
593
|
+
type: "turn.started";
|
|
594
|
+
turn: number;
|
|
595
|
+
} | {
|
|
596
|
+
type: "message.completed";
|
|
597
|
+
text: string;
|
|
598
|
+
} | {
|
|
599
|
+
type: "tool.started";
|
|
600
|
+
toolName: string;
|
|
601
|
+
actionId: string;
|
|
602
|
+
} | {
|
|
603
|
+
type: "tool.completed";
|
|
604
|
+
actionId: string;
|
|
605
|
+
} | {
|
|
606
|
+
type: "tool.refused";
|
|
607
|
+
toolName: string;
|
|
608
|
+
reason: ToolCallRefusal;
|
|
609
|
+
} | {
|
|
610
|
+
type: "tool.approval_required";
|
|
611
|
+
toolName: string;
|
|
612
|
+
actionId: string;
|
|
613
|
+
args: unknown;
|
|
614
|
+
} | {
|
|
615
|
+
type: "run.completed";
|
|
616
|
+
reason: RunStopReason;
|
|
617
|
+
} | {
|
|
618
|
+
type: "run.failed";
|
|
619
|
+
error: string;
|
|
620
|
+
};
|
|
621
|
+
type RunStopReason = "completed" | "turn_budget" | "tool_budget" | "approval_required" | "aborted";
|
|
622
|
+
interface AgentRunOptions {
|
|
623
|
+
model: ModelClient;
|
|
624
|
+
tools: AgentToolDefinition[];
|
|
625
|
+
execute: ActionExecutor;
|
|
626
|
+
messages: ModelMessage[];
|
|
627
|
+
maxTurns?: number;
|
|
628
|
+
maxToolCalls?: number;
|
|
629
|
+
/** Tenant kill switch for AI writes; reads continue. */
|
|
630
|
+
writesPaused?: boolean;
|
|
631
|
+
/** Approval tokens already held, keyed by actionId. */
|
|
632
|
+
approvals?: Record<string, string>;
|
|
633
|
+
onEvent?: (event: AgentRunEvent) => void;
|
|
634
|
+
signal?: AbortSignal;
|
|
635
|
+
}
|
|
636
|
+
interface AgentRunResult {
|
|
637
|
+
stopReason: RunStopReason;
|
|
638
|
+
messages: ModelMessage[];
|
|
639
|
+
text: string;
|
|
640
|
+
toolCallsUsed: number;
|
|
641
|
+
turnsUsed: number;
|
|
642
|
+
usage: {
|
|
643
|
+
inputTokens: number;
|
|
644
|
+
outputTokens: number;
|
|
645
|
+
costUsd: number;
|
|
646
|
+
};
|
|
647
|
+
/** Set when `stopReason === 'approval_required'`. */
|
|
648
|
+
pendingApproval?: {
|
|
649
|
+
toolName: string;
|
|
650
|
+
actionId: string;
|
|
651
|
+
revision: number;
|
|
652
|
+
args: unknown;
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
declare function runAgent(options: AgentRunOptions): Promise<AgentRunResult>;
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* WordRhyme Connector — one codebase, two transports (AI Action Gateway, Phase 0 segment 3).
|
|
659
|
+
*
|
|
660
|
+
* `local` — invokes governed actions in-process through `ctx.actions`
|
|
661
|
+
* (ActionInvokerCapability); identity comes from the live request.
|
|
662
|
+
* `remote` — invokes the SAME action surface on ANOTHER WordRhyme instance over
|
|
663
|
+
* HTTP `POST {baseUrl}/trpc/<path>` with `x-api-key`.
|
|
664
|
+
*
|
|
665
|
+
* Both transports share the `invoke(actionId, revision, args)` shape, so callers
|
|
666
|
+
* cannot tell them apart — that is the point of the segment-3 spike.
|
|
667
|
+
*
|
|
668
|
+
* Security posture (all fail closed):
|
|
669
|
+
* - remote base URLs must be explicitly allowlisted; private/loopback hosts are
|
|
670
|
+
* rejected unless the allowlist entry itself is loopback (dev/tests)
|
|
671
|
+
* - redirects are never followed (`redirect: 'error'`) — no redirect-to-private-net
|
|
672
|
+
* - the remote instance pins the organization to its API token; this client
|
|
673
|
+
* therefore never sends an organizationId, and refuses to accept one
|
|
674
|
+
* - `onBehalfOf` is delegation CONTEXT FOR AUDIT ONLY, never a permission source;
|
|
675
|
+
* the remote side authorizes as the token's own principal
|
|
676
|
+
*/
|
|
677
|
+
/** Actions surface the local transport delegates to (subset of PluginActionInvokerCapability). */
|
|
678
|
+
interface ConnectorLocalActions {
|
|
679
|
+
invoke(request: {
|
|
680
|
+
actionId: string;
|
|
681
|
+
revision: number;
|
|
682
|
+
args?: unknown;
|
|
683
|
+
}): Promise<unknown>;
|
|
684
|
+
}
|
|
685
|
+
interface ConnectorInvokeRequest {
|
|
686
|
+
actionId: string;
|
|
687
|
+
revision: number;
|
|
688
|
+
args?: unknown;
|
|
689
|
+
/** Audit-only delegation context. Never widens permissions on either side. */
|
|
690
|
+
onBehalfOf?: string;
|
|
691
|
+
}
|
|
692
|
+
interface WordRhymeConnector {
|
|
693
|
+
readonly transport: "local" | "remote";
|
|
694
|
+
invoke(request: ConnectorInvokeRequest): Promise<unknown>;
|
|
695
|
+
}
|
|
696
|
+
interface LocalConnectorOptions {
|
|
697
|
+
transport: "local";
|
|
698
|
+
actions: ConnectorLocalActions;
|
|
699
|
+
}
|
|
700
|
+
interface RemoteConnectorOptions {
|
|
701
|
+
transport: "remote";
|
|
702
|
+
baseUrl: string;
|
|
703
|
+
apiKey: string;
|
|
704
|
+
/** Exact origins this connector may call. Empty ⇒ nothing is allowed. */
|
|
705
|
+
allowedOrigins: string[];
|
|
706
|
+
/** Action ids this connector may invoke remotely. Empty ⇒ nothing is allowed. */
|
|
707
|
+
allowedActions: string[];
|
|
708
|
+
/** Injected for tests; defaults to global fetch. */
|
|
709
|
+
fetchImpl?: typeof fetch;
|
|
710
|
+
}
|
|
711
|
+
type ConnectorOptions = LocalConnectorOptions | RemoteConnectorOptions;
|
|
712
|
+
declare class ConnectorError extends Error {
|
|
713
|
+
readonly code: string;
|
|
714
|
+
constructor(code: string, message: string);
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Resolve a remote base URL against the allowlist.
|
|
718
|
+
* Private/loopback targets are only permitted when explicitly allowlisted,
|
|
719
|
+
* which keeps dev and tests usable without opening SSRF in production configs.
|
|
720
|
+
*/
|
|
721
|
+
declare function resolveRemoteOrigin(baseUrl: string, allowedOrigins: string[]): string;
|
|
722
|
+
declare function createWordRhymeConnector(options: ConnectorOptions): WordRhymeConnector;
|
|
723
|
+
|
|
724
|
+
export { AI_ERROR_I18N_KEYS, type ActionExecutor, type AgentRunEvent, type AgentRunOptions, type AgentRunResult, type AgentToolDefinition, type AgentToolSource, type AiErrorCode, type AiErrorDescriptor, type AiErrorI18nKey, type AssembleOptions, ConnectorError, type ConnectorInvokeRequest, type ConnectorLocalActions, type ConnectorOptions, type LocalConnectorOptions, MARKETPLACE_PLUGIN_ICON_MAX_BYTES, MARKETPLACE_PLUGIN_ICON_MEDIA_TYPES, MARKETPLACE_PUBLISH_SOURCES, MARKETPLACE_SUBMISSION_STATUSES, type MarketplaceOwnedPlugin, type MarketplaceOwnedPluginInput, type MarketplaceOwnedPluginResponse, type MarketplaceOwnedPluginUpdate, type MarketplaceOwnedPluginsResponse, type MarketplacePluginIconMediaType, type MarketplacePublishSource, type MarketplacePublisherCapabilities, type MarketplacePublisherCapabilitiesResponse, type MarketplacePublisherError, type MarketplacePublisherProfile, type MarketplacePublisherProfileInput, type MarketplacePublisherProfileResponse, type MarketplaceReleaseAcceptedResponse, type MarketplaceSubmission, type MarketplaceSubmissionCursor, type MarketplaceSubmissionStatus, type MarketplaceSubmissionsResponse, type ModelClient, type ModelMessage, type ModelResponse, type ModelToolCall, PluginContext, PluginLogger, PluginManifest, type RemoteConnectorOptions, type RunStopReason, type ToolCallDecision, type ToolCallGateInput, type ToolCallRefusal, type ToolChannel, Translator, WebPluginSiteInfo, type WebUrlSearchParams, type WebUrlSearchValue, type WordRhymeConnector, aiErrorDescriptor, assembleTools, buildWebUrl, checkPermission, createLogger, createWordRhymeConnector, definePlugin, encodeToolResult, formatAiError, gateToolCall, hasCapability, marketplaceOwnedPluginInputSchema, marketplaceOwnedPluginResponseSchema, marketplaceOwnedPluginSchema, marketplaceOwnedPluginUpdateSchema, marketplaceOwnedPluginsResponseSchema, marketplacePublishSourceSchema, marketplacePublisherCapabilitiesResponseSchema, marketplacePublisherCapabilitiesSchema, marketplacePublisherErrorSchema, marketplacePublisherProfileInputSchema, marketplacePublisherProfileResponseSchema, marketplacePublisherProfileSchema, marketplaceReleaseAcceptedResponseSchema, marketplaceSubmissionCursorSchema, marketplaceSubmissionSchema, marketplaceSubmissionStatusSchema, marketplaceSubmissionsResponseSchema, requirePermission, requiresApprovalFor, resolveRemoteOrigin, runAgent, toolNameFor };
|