@zapier/kitcore 0.14.0 → 0.15.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/CHANGELOG.md +6 -0
- package/dist/index.cjs +101 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +127 -7
- package/dist/index.d.ts +127 -7
- package/dist/index.mjs +96 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -222,6 +222,72 @@ interface MethodHooks {
|
|
|
222
222
|
annotator?: ComposedAnnotator;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
+
/**
|
|
226
|
+
* API stability tiers.
|
|
227
|
+
*
|
|
228
|
+
* A plugin declares exactly one level via `PluginMeta.stability`; tier
|
|
229
|
+
* membership (which subpath aggregate exports the plugin) is structural,
|
|
230
|
+
* so nothing here compares levels ordinally. The array is the single
|
|
231
|
+
* source of truth: it derives the {@link StabilityLevel} type, gives the
|
|
232
|
+
* ladder tests their adjacent-tier iteration order, and gives docs a
|
|
233
|
+
* render order.
|
|
234
|
+
*/
|
|
235
|
+
declare const STABILITY_LEVELS: readonly ["stable", "beta", "experimental"];
|
|
236
|
+
type StabilityLevel = (typeof STABILITY_LEVELS)[number];
|
|
237
|
+
/**
|
|
238
|
+
* Title-case display names for each level, for section-level badges in
|
|
239
|
+
* generated docs (e.g. `Code Workflows (Beta)`). Inline description
|
|
240
|
+
* labels go through {@link applyStabilityLabel} instead.
|
|
241
|
+
*/
|
|
242
|
+
declare const STABILITY_TITLES: {
|
|
243
|
+
readonly stable: "Stable";
|
|
244
|
+
readonly beta: "Beta";
|
|
245
|
+
readonly experimental: "Experimental";
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* Normalize authored meta to a concrete level: absent means `"stable"`,
|
|
249
|
+
* and the deprecated `experimental: true` boolean means `"experimental"`.
|
|
250
|
+
* The registry projection runs every entry through this, so
|
|
251
|
+
* `FunctionRegistryEntry.stability` is always concrete and consumers
|
|
252
|
+
* never branch on `undefined`.
|
|
253
|
+
*
|
|
254
|
+
* The declared value can cross a JSON boundary from a hand-written
|
|
255
|
+
* plugin, so at runtime it may be any string. An unrecognized level
|
|
256
|
+
* clamps to `"experimental"` — the author declared the method not
|
|
257
|
+
* stable, and clamping keeps the raw string out of notices and labels.
|
|
258
|
+
* It doesn't throw because this also runs in the `getStability` live
|
|
259
|
+
* read on the call path, where a throw would break the observed call.
|
|
260
|
+
*/
|
|
261
|
+
declare function normalizeStability(meta: {
|
|
262
|
+
stability?: StabilityLevel;
|
|
263
|
+
experimental?: boolean;
|
|
264
|
+
}): StabilityLevel;
|
|
265
|
+
/**
|
|
266
|
+
* The shared label renderer: every consumer that renders a registry
|
|
267
|
+
* entry's description (CLI help, MCP tool descriptions) labels it
|
|
268
|
+
* through this function, so a new consumer cannot silently drop the
|
|
269
|
+
* label. `stability` stays structured data on the registry entry — the
|
|
270
|
+
* label is applied at render time, never baked into the stored
|
|
271
|
+
* description (docs badge at the section level, so baking it in would
|
|
272
|
+
* double-badge).
|
|
273
|
+
*
|
|
274
|
+
* The label follows the plugin's declared level, not the subpath that
|
|
275
|
+
* surfaced it: a beta method surfaced through an experimental-tier
|
|
276
|
+
* consumer still reads "(beta)".
|
|
277
|
+
*/
|
|
278
|
+
declare function applyStabilityLabel({ description, stability, placement, }: {
|
|
279
|
+
description: string;
|
|
280
|
+
/** Absent means stable (the value may arrive from outside the
|
|
281
|
+
* normalized registry projection, e.g. hand-built JSON). */
|
|
282
|
+
stability: StabilityLevel | undefined;
|
|
283
|
+
/**
|
|
284
|
+
* `"suffix"` renders `<description> (beta)` (CLI help);
|
|
285
|
+
* `"prefix"` renders `[Beta] <description>` (MCP tool descriptions,
|
|
286
|
+
* where the front of the string is what an LLM reads first).
|
|
287
|
+
*/
|
|
288
|
+
placement?: "suffix" | "prefix";
|
|
289
|
+
}): string;
|
|
290
|
+
|
|
225
291
|
/**
|
|
226
292
|
* Plugins with a required-parameter rename declare two schemas: a canonical one
|
|
227
293
|
* (new names only, carrying `.meta({ aliases })`) and a `z.union([canonical,
|
|
@@ -562,6 +628,8 @@ interface LeafMetaFields {
|
|
|
562
628
|
* off the registry / CLI / MCP surface, exactly like `skipInputValidation`. */
|
|
563
629
|
skipOutputValidation?: boolean;
|
|
564
630
|
packages?: string[];
|
|
631
|
+
stability?: StabilityLevel;
|
|
632
|
+
/** @deprecated Use `stability: "experimental"` instead. */
|
|
565
633
|
experimental?: boolean;
|
|
566
634
|
confirm?: "create-secret" | "delete";
|
|
567
635
|
deprecation?: FunctionDeprecation;
|
|
@@ -1748,8 +1816,17 @@ interface FunctionRegistryEntry {
|
|
|
1748
1816
|
resolvers?: Record<string, BoundResolver>;
|
|
1749
1817
|
packages?: string[];
|
|
1750
1818
|
/**
|
|
1751
|
-
*
|
|
1752
|
-
*
|
|
1819
|
+
* API stability tier of the plugin, normalized from `PluginMeta.stability`
|
|
1820
|
+
* (absent means `"stable"`; the legacy `experimental: true` boolean means
|
|
1821
|
+
* `"experimental"`). Always concrete here, so consumers never branch on
|
|
1822
|
+
* `undefined`.
|
|
1823
|
+
*/
|
|
1824
|
+
stability: StabilityLevel;
|
|
1825
|
+
/**
|
|
1826
|
+
* @deprecated Read `stability` instead. Derived as
|
|
1827
|
+
* `stability === "experimental"` — literal by name, so beta reads
|
|
1828
|
+
* `false`; the not-stable warning duty lives in `stability` and the
|
|
1829
|
+
* runtime stability notice.
|
|
1753
1830
|
*/
|
|
1754
1831
|
experimental?: boolean;
|
|
1755
1832
|
/** Confirmation prompt type - prompts user before executing */
|
|
@@ -1845,10 +1922,19 @@ interface PluginMeta<TSdk = unknown> {
|
|
|
1845
1922
|
/** Confirmation prompt type - prompts user before executing */
|
|
1846
1923
|
confirm?: "create-secret" | "delete";
|
|
1847
1924
|
/**
|
|
1848
|
-
*
|
|
1849
|
-
*
|
|
1850
|
-
*
|
|
1851
|
-
*
|
|
1925
|
+
* API stability tier this plugin belongs to. Absent means `"stable"`;
|
|
1926
|
+
* the registry projection normalizes it, so registry consumers always
|
|
1927
|
+
* read a concrete {@link StabilityLevel}. Wrappers keep non-stable
|
|
1928
|
+
* plugins out of their stable build (by gating them behind a `beta` /
|
|
1929
|
+
* `experimental` subpath import) and consumers badge the level in
|
|
1930
|
+
* generated docs, CLI help, and MCP tool descriptions. No runtime
|
|
1931
|
+
* capability check.
|
|
1932
|
+
*/
|
|
1933
|
+
stability?: StabilityLevel;
|
|
1934
|
+
/**
|
|
1935
|
+
* @deprecated Use `stability: "experimental"` instead. Kept as an
|
|
1936
|
+
* input for external authors; `true` normalizes to
|
|
1937
|
+
* `stability: "experimental"` in the registry projection.
|
|
1852
1938
|
*/
|
|
1853
1939
|
experimental?: boolean;
|
|
1854
1940
|
[key: string]: any;
|
|
@@ -2928,6 +3014,16 @@ interface DeprecationWarning {
|
|
|
2928
3014
|
* once-per-process per message.
|
|
2929
3015
|
*/
|
|
2930
3016
|
declare function defaultLogDeprecation({ methodName, deprecation, }: DeprecationWarning): void;
|
|
3017
|
+
/**
|
|
3018
|
+
* What the boundary reports when a non-stable (beta / experimental) method
|
|
3019
|
+
* is called: the method plus its declared level. `DeprecationWarning`'s
|
|
3020
|
+
* sibling — same self-describing shape, same handler-not-observer contract.
|
|
3021
|
+
*/
|
|
3022
|
+
interface StabilityNotice {
|
|
3023
|
+
type: "stability";
|
|
3024
|
+
methodName: string;
|
|
3025
|
+
stability: StabilityLevel;
|
|
3026
|
+
}
|
|
2931
3027
|
/**
|
|
2932
3028
|
* The well-known id for framework options: heads inject a `CoreOptions` bag
|
|
2933
3029
|
* under it via `createSdk`'s `configuration` (or register a property plugin),
|
|
@@ -2964,6 +3060,16 @@ interface CoreOptions {
|
|
|
2964
3060
|
* reserved for an `on*`-named observer when the unified event bus lands.
|
|
2965
3061
|
*/
|
|
2966
3062
|
logDeprecation?: (warning: DeprecationWarning) => void;
|
|
3063
|
+
/**
|
|
3064
|
+
* `logDeprecation`'s sibling for API stability: the framework signals
|
|
3065
|
+
* every surface call of a method declaring a non-stable `stability`
|
|
3066
|
+
* level (beta / experimental), and this gate decides what happens.
|
|
3067
|
+
* Exactly one: absent falls back to {@link defaultLogStabilityNotice}
|
|
3068
|
+
* (once-per-process per message), supplied replaces it. Runs isolated,
|
|
3069
|
+
* so a throwing handler never breaks the observed call. Internal
|
|
3070
|
+
* delegation never signals, matching the deprecation contract.
|
|
3071
|
+
*/
|
|
3072
|
+
logStabilityNotice?: (notice: StabilityNotice) => void;
|
|
2967
3073
|
/**
|
|
2968
3074
|
* Report what output validation stripped, on the response's
|
|
2969
3075
|
* `meta.outputValidation.droppedPaths` (the name mirrors that path). Off by
|
|
@@ -3527,6 +3633,8 @@ declare function createFunction<TOptions, TResult, TSchemaOptions extends TOptio
|
|
|
3527
3633
|
annotator?: (input: unknown) => Annotations;
|
|
3528
3634
|
/** Live read of the method's deprecation meta (see signalDeprecation). */
|
|
3529
3635
|
getDeprecation?: () => FunctionDeprecation | undefined;
|
|
3636
|
+
/** Live read of the method's stability level (see signalStability). */
|
|
3637
|
+
getStability?: () => StabilityLevel | undefined;
|
|
3530
3638
|
}): (callOptions?: TOptions) => Promise<TResult>;
|
|
3531
3639
|
/**
|
|
3532
3640
|
* Higher-order function that creates a paginated function that wraps
|
|
@@ -3567,6 +3675,8 @@ declare function createPaginatedFunction<TUserOptions, TResponse, TItem = ItemTy
|
|
|
3567
3675
|
finalizePage?: (page: SdkPage<TItem>) => SdkPage<TItem>;
|
|
3568
3676
|
/** Live read of the method's deprecation meta (see signalDeprecation). */
|
|
3569
3677
|
getDeprecation?: () => FunctionDeprecation | undefined;
|
|
3678
|
+
/** Live read of the method's stability level (see signalStability). */
|
|
3679
|
+
getStability?: () => StabilityLevel | undefined;
|
|
3570
3680
|
}): (options?: TUserOptions & {
|
|
3571
3681
|
cursor?: string;
|
|
3572
3682
|
pageSize?: number;
|
|
@@ -3808,6 +3918,16 @@ interface DeprecationLogger {
|
|
|
3808
3918
|
* channels while sharing the implementation.
|
|
3809
3919
|
*/
|
|
3810
3920
|
declare function createDeprecationLogger(tag: string): DeprecationLogger;
|
|
3921
|
+
interface StabilityNoticeLogger {
|
|
3922
|
+
logStabilityNotice(message: string): void;
|
|
3923
|
+
resetStabilityNotices(): void;
|
|
3924
|
+
}
|
|
3925
|
+
/**
|
|
3926
|
+
* Create a package-tagged stability-notice logger: the deprecation logger's
|
|
3927
|
+
* sibling for non-stable (beta / experimental) API warnings, with the same
|
|
3928
|
+
* once-per-process dedupe policy and its own independent message Set.
|
|
3929
|
+
*/
|
|
3930
|
+
declare function createStabilityNoticeLogger(tag: string): StabilityNoticeLogger;
|
|
3811
3931
|
|
|
3812
3932
|
/**
|
|
3813
3933
|
* Core signal machinery.
|
|
@@ -4235,4 +4355,4 @@ declare const normalizeConnectionPlugin: MethodPlugin<"normalizeConnection", Nor
|
|
|
4235
4355
|
*/
|
|
4236
4356
|
declare const resolveConnectionPlugin: MethodPlugin<"resolveConnection", ResolveConnectionInput, string | undefined, readonly []> & LeafSummary<"kitcore", "resolveConnection", readonly []>;
|
|
4237
4357
|
|
|
4238
|
-
export { type AdaptError, type AdaptErrorOptions, type AdaptPage, type AggregatePlugin, type Annotations, type ArrayResolver$1 as ArrayResolver, type AsyncContext, type AttemptHttpRequestInput, type AuthorizeHttpRequestInput, type BoundFormatter, type BoundResolver, CONTEXT, CORE_ERROR_SYMBOL, CORE_OPTIONS_ID, CORE_SIGNAL_SYMBOL, type CallContext, type CallOrigin, type CategoryDefinition, type ComposedAnnotator, type ConstantResolver$1 as ConstantResolver, type Controller, type ControllerAction, type ControllerAffordance, type ControllerAnswerFn, type ControllerChoice, type ControllerError, type ControllerIssue, type ControllerListingPage, type ControllerListingPosition, type ControllerMethodDescription, type ControllerMethodSummary, type ControllerPagination, type ControllerParameterDescription, type ControllerPath, type ControllerQuestion, type ControllerResult, type ControllerSdk, type ControllerSelectPage, type ControllerState, type CoreApiError, CoreCancelledSignal, CoreDisposeError, CoreError, CoreErrorCode, type CoreErrorOptions, type CoreOptions, CoreSignal, type CreateSdkOptions, type DefaultConnectionSchemeInput, type DeprecatedPromptConfigChoice, type DeprecationLogger, type DeprecationWarning, type DispatchHttpRequestInput, type DisposeFn, type DynamicListResolver, type DynamicMember, type DynamicResolver$1 as DynamicResolver, type DynamicSearchResolver, type FieldsResolver, type FormattedItem, type Formatter, type FunctionDeprecation, type FunctionRegistryEntry, type HookAnnotator, type HookPlugin, type HttpAttemptContext, type HttpFetchInit, type HttpOperationContext, type HttpOperationStart, type HttpPipelineState, type HttpRequest, type HttpRequestInput, type HttpResponse, type InitializeHttpRequestInput, type LeafMeta, type LeafSummary, type LegacyMergePlugin, type LegacyPlugin, type ListItemsResult, type ListPromptConfig, type MethodAnnotator, type MethodAttachment, type MethodHooks, type MethodOverridePlugin, type MethodPlugin, type MethodScope, type Resolver as ModelResolver, type NegatableMetadata, type NormalizeConnectionInput, type NormalizedConnection, type OnMethodEnd, type OnMethodEndContext, type OnMethodStart, type OnMethodStartContext, type OutputFormatter, type PaginatedSdkFunction, type PaginatedSdkResult, type Plugin, type PluginMeta, type PluginProvides, type PluginStack, type PluginSummary, type PluginSurface, type PositionalMetadata, type PrepareHttpRequestInput, type PromptConfig, type PromptConfigChoice, type PropertyPlugin, RETRY_HTTP_REQUEST_OPTIONS_ID, type ReceiveHttpResponseInput, type RegistryResult, type RequiredSdkOf, type ResolveConnectionInput, type Resolver$1 as Resolver, type ResolverConfig, type ResolverFieldItem, type ResolverMetadata, type ResolverPromptConfig, type ResolverType, type ResponseMeta, type RetryHttpRequestOptions, type Sdk, type SdkContext, type SdkPage, type SendHttpRequest, type StaticResolver$1 as StaticResolver, type ValidResolvers, addPlugin, attemptHttpRequestPlugin, authorizeHttpRequestPlugin, canonicalInputSchema, composePlugins, concatLists, concatPaginated, coreOptionsPluginRef, createAsyncContext, createController, createCoreError, createCorePlugin, createDeprecationLogger, createFunction, createPaginatedFunction, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createPrefixedCursor, createSdk, createValidator, dangerousContextPlugin, declareDefault, declareMethod, declareOptionalMethod, declareOptionalProperty, declarePlugin, declareProperty, decodeIncomingCursor, defaultConnectionSchemePlugin, defaultLogDeprecation, defineFormatter, defineHook, defineLegacyMerge, defineMethod, defineMethodOverride, definePlugin, defineProperty, defineResolver, dispatchHttpRequestPlugin, disposeSdk, fetchPlugin, fromFunctionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCurrentDepth, getCurrentScope, getFieldDescriptions, getNegatable, getOutputSchema, getRegistryPlugin, getSchemaDescription, initializeHttpRequestPlugin, isCoreCancelledSignal, isCoreError, isCoreSignal, isNestedMethodCall, isPositional, isTelemetryNested, normalizeConnectionPlugin, omitExports, openEnum, paginate, paginateBuffered, paginateMaxItems, prepareHttpRequestPlugin, receiveHttpResponsePlugin, redactHeaders, redactHttpRequest, resolveConnectionPlugin, resolvePlugin, retryHttpRequestOptionsPluginRef, retryHttpRequestPlugin, runInMethodScope, runWithTelemetryContext, selectExports, sendHttpRequestPlugin, splitPrefixedCursor, toIterable, toSnakeCase, toTitleCase, validateOptions, withOutputSchema, withPositional, withResolver };
|
|
4358
|
+
export { type AdaptError, type AdaptErrorOptions, type AdaptPage, type AggregatePlugin, type Annotations, type ArrayResolver$1 as ArrayResolver, type AsyncContext, type AttemptHttpRequestInput, type AuthorizeHttpRequestInput, type BoundFormatter, type BoundResolver, CONTEXT, CORE_ERROR_SYMBOL, CORE_OPTIONS_ID, CORE_SIGNAL_SYMBOL, type CallContext, type CallOrigin, type CategoryDefinition, type ComposedAnnotator, type ConstantResolver$1 as ConstantResolver, type Controller, type ControllerAction, type ControllerAffordance, type ControllerAnswerFn, type ControllerChoice, type ControllerError, type ControllerIssue, type ControllerListingPage, type ControllerListingPosition, type ControllerMethodDescription, type ControllerMethodSummary, type ControllerPagination, type ControllerParameterDescription, type ControllerPath, type ControllerQuestion, type ControllerResult, type ControllerSdk, type ControllerSelectPage, type ControllerState, type CoreApiError, CoreCancelledSignal, CoreDisposeError, CoreError, CoreErrorCode, type CoreErrorOptions, type CoreOptions, CoreSignal, type CreateSdkOptions, type DefaultConnectionSchemeInput, type DeprecatedPromptConfigChoice, type DeprecationLogger, type DeprecationWarning, type DispatchHttpRequestInput, type DisposeFn, type DynamicListResolver, type DynamicMember, type DynamicResolver$1 as DynamicResolver, type DynamicSearchResolver, type FieldsResolver, type FormattedItem, type Formatter, type FunctionDeprecation, type FunctionRegistryEntry, type HookAnnotator, type HookPlugin, type HttpAttemptContext, type HttpFetchInit, type HttpOperationContext, type HttpOperationStart, type HttpPipelineState, type HttpRequest, type HttpRequestInput, type HttpResponse, type InitializeHttpRequestInput, type LeafMeta, type LeafSummary, type LegacyMergePlugin, type LegacyPlugin, type ListItemsResult, type ListPromptConfig, type MethodAnnotator, type MethodAttachment, type MethodHooks, type MethodOverridePlugin, type MethodPlugin, type MethodScope, type Resolver as ModelResolver, type NegatableMetadata, type NormalizeConnectionInput, type NormalizedConnection, type OnMethodEnd, type OnMethodEndContext, type OnMethodStart, type OnMethodStartContext, type OutputFormatter, type PaginatedSdkFunction, type PaginatedSdkResult, type Plugin, type PluginMeta, type PluginProvides, type PluginStack, type PluginSummary, type PluginSurface, type PositionalMetadata, type PrepareHttpRequestInput, type PromptConfig, type PromptConfigChoice, type PropertyPlugin, RETRY_HTTP_REQUEST_OPTIONS_ID, type ReceiveHttpResponseInput, type RegistryResult, type RequiredSdkOf, type ResolveConnectionInput, type Resolver$1 as Resolver, type ResolverConfig, type ResolverFieldItem, type ResolverMetadata, type ResolverPromptConfig, type ResolverType, type ResponseMeta, type RetryHttpRequestOptions, STABILITY_LEVELS, STABILITY_TITLES, type Sdk, type SdkContext, type SdkPage, type SendHttpRequest, type StabilityLevel, type StabilityNotice, type StabilityNoticeLogger, type StaticResolver$1 as StaticResolver, type ValidResolvers, addPlugin, applyStabilityLabel, attemptHttpRequestPlugin, authorizeHttpRequestPlugin, canonicalInputSchema, composePlugins, concatLists, concatPaginated, coreOptionsPluginRef, createAsyncContext, createController, createCoreError, createCorePlugin, createDeprecationLogger, createFunction, createPaginatedFunction, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createPrefixedCursor, createSdk, createStabilityNoticeLogger, createValidator, dangerousContextPlugin, declareDefault, declareMethod, declareOptionalMethod, declareOptionalProperty, declarePlugin, declareProperty, decodeIncomingCursor, defaultConnectionSchemePlugin, defaultLogDeprecation, defineFormatter, defineHook, defineLegacyMerge, defineMethod, defineMethodOverride, definePlugin, defineProperty, defineResolver, dispatchHttpRequestPlugin, disposeSdk, fetchPlugin, fromFunctionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCurrentDepth, getCurrentScope, getFieldDescriptions, getNegatable, getOutputSchema, getRegistryPlugin, getSchemaDescription, initializeHttpRequestPlugin, isCoreCancelledSignal, isCoreError, isCoreSignal, isNestedMethodCall, isPositional, isTelemetryNested, normalizeConnectionPlugin, normalizeStability, omitExports, openEnum, paginate, paginateBuffered, paginateMaxItems, prepareHttpRequestPlugin, receiveHttpResponsePlugin, redactHeaders, redactHttpRequest, resolveConnectionPlugin, resolvePlugin, retryHttpRequestOptionsPluginRef, retryHttpRequestPlugin, runInMethodScope, runWithTelemetryContext, selectExports, sendHttpRequestPlugin, splitPrefixedCursor, toIterable, toSnakeCase, toTitleCase, validateOptions, withOutputSchema, withPositional, withResolver };
|
package/dist/index.d.ts
CHANGED
|
@@ -222,6 +222,72 @@ interface MethodHooks {
|
|
|
222
222
|
annotator?: ComposedAnnotator;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
+
/**
|
|
226
|
+
* API stability tiers.
|
|
227
|
+
*
|
|
228
|
+
* A plugin declares exactly one level via `PluginMeta.stability`; tier
|
|
229
|
+
* membership (which subpath aggregate exports the plugin) is structural,
|
|
230
|
+
* so nothing here compares levels ordinally. The array is the single
|
|
231
|
+
* source of truth: it derives the {@link StabilityLevel} type, gives the
|
|
232
|
+
* ladder tests their adjacent-tier iteration order, and gives docs a
|
|
233
|
+
* render order.
|
|
234
|
+
*/
|
|
235
|
+
declare const STABILITY_LEVELS: readonly ["stable", "beta", "experimental"];
|
|
236
|
+
type StabilityLevel = (typeof STABILITY_LEVELS)[number];
|
|
237
|
+
/**
|
|
238
|
+
* Title-case display names for each level, for section-level badges in
|
|
239
|
+
* generated docs (e.g. `Code Workflows (Beta)`). Inline description
|
|
240
|
+
* labels go through {@link applyStabilityLabel} instead.
|
|
241
|
+
*/
|
|
242
|
+
declare const STABILITY_TITLES: {
|
|
243
|
+
readonly stable: "Stable";
|
|
244
|
+
readonly beta: "Beta";
|
|
245
|
+
readonly experimental: "Experimental";
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* Normalize authored meta to a concrete level: absent means `"stable"`,
|
|
249
|
+
* and the deprecated `experimental: true` boolean means `"experimental"`.
|
|
250
|
+
* The registry projection runs every entry through this, so
|
|
251
|
+
* `FunctionRegistryEntry.stability` is always concrete and consumers
|
|
252
|
+
* never branch on `undefined`.
|
|
253
|
+
*
|
|
254
|
+
* The declared value can cross a JSON boundary from a hand-written
|
|
255
|
+
* plugin, so at runtime it may be any string. An unrecognized level
|
|
256
|
+
* clamps to `"experimental"` — the author declared the method not
|
|
257
|
+
* stable, and clamping keeps the raw string out of notices and labels.
|
|
258
|
+
* It doesn't throw because this also runs in the `getStability` live
|
|
259
|
+
* read on the call path, where a throw would break the observed call.
|
|
260
|
+
*/
|
|
261
|
+
declare function normalizeStability(meta: {
|
|
262
|
+
stability?: StabilityLevel;
|
|
263
|
+
experimental?: boolean;
|
|
264
|
+
}): StabilityLevel;
|
|
265
|
+
/**
|
|
266
|
+
* The shared label renderer: every consumer that renders a registry
|
|
267
|
+
* entry's description (CLI help, MCP tool descriptions) labels it
|
|
268
|
+
* through this function, so a new consumer cannot silently drop the
|
|
269
|
+
* label. `stability` stays structured data on the registry entry — the
|
|
270
|
+
* label is applied at render time, never baked into the stored
|
|
271
|
+
* description (docs badge at the section level, so baking it in would
|
|
272
|
+
* double-badge).
|
|
273
|
+
*
|
|
274
|
+
* The label follows the plugin's declared level, not the subpath that
|
|
275
|
+
* surfaced it: a beta method surfaced through an experimental-tier
|
|
276
|
+
* consumer still reads "(beta)".
|
|
277
|
+
*/
|
|
278
|
+
declare function applyStabilityLabel({ description, stability, placement, }: {
|
|
279
|
+
description: string;
|
|
280
|
+
/** Absent means stable (the value may arrive from outside the
|
|
281
|
+
* normalized registry projection, e.g. hand-built JSON). */
|
|
282
|
+
stability: StabilityLevel | undefined;
|
|
283
|
+
/**
|
|
284
|
+
* `"suffix"` renders `<description> (beta)` (CLI help);
|
|
285
|
+
* `"prefix"` renders `[Beta] <description>` (MCP tool descriptions,
|
|
286
|
+
* where the front of the string is what an LLM reads first).
|
|
287
|
+
*/
|
|
288
|
+
placement?: "suffix" | "prefix";
|
|
289
|
+
}): string;
|
|
290
|
+
|
|
225
291
|
/**
|
|
226
292
|
* Plugins with a required-parameter rename declare two schemas: a canonical one
|
|
227
293
|
* (new names only, carrying `.meta({ aliases })`) and a `z.union([canonical,
|
|
@@ -562,6 +628,8 @@ interface LeafMetaFields {
|
|
|
562
628
|
* off the registry / CLI / MCP surface, exactly like `skipInputValidation`. */
|
|
563
629
|
skipOutputValidation?: boolean;
|
|
564
630
|
packages?: string[];
|
|
631
|
+
stability?: StabilityLevel;
|
|
632
|
+
/** @deprecated Use `stability: "experimental"` instead. */
|
|
565
633
|
experimental?: boolean;
|
|
566
634
|
confirm?: "create-secret" | "delete";
|
|
567
635
|
deprecation?: FunctionDeprecation;
|
|
@@ -1748,8 +1816,17 @@ interface FunctionRegistryEntry {
|
|
|
1748
1816
|
resolvers?: Record<string, BoundResolver>;
|
|
1749
1817
|
packages?: string[];
|
|
1750
1818
|
/**
|
|
1751
|
-
*
|
|
1752
|
-
*
|
|
1819
|
+
* API stability tier of the plugin, normalized from `PluginMeta.stability`
|
|
1820
|
+
* (absent means `"stable"`; the legacy `experimental: true` boolean means
|
|
1821
|
+
* `"experimental"`). Always concrete here, so consumers never branch on
|
|
1822
|
+
* `undefined`.
|
|
1823
|
+
*/
|
|
1824
|
+
stability: StabilityLevel;
|
|
1825
|
+
/**
|
|
1826
|
+
* @deprecated Read `stability` instead. Derived as
|
|
1827
|
+
* `stability === "experimental"` — literal by name, so beta reads
|
|
1828
|
+
* `false`; the not-stable warning duty lives in `stability` and the
|
|
1829
|
+
* runtime stability notice.
|
|
1753
1830
|
*/
|
|
1754
1831
|
experimental?: boolean;
|
|
1755
1832
|
/** Confirmation prompt type - prompts user before executing */
|
|
@@ -1845,10 +1922,19 @@ interface PluginMeta<TSdk = unknown> {
|
|
|
1845
1922
|
/** Confirmation prompt type - prompts user before executing */
|
|
1846
1923
|
confirm?: "create-secret" | "delete";
|
|
1847
1924
|
/**
|
|
1848
|
-
*
|
|
1849
|
-
*
|
|
1850
|
-
*
|
|
1851
|
-
*
|
|
1925
|
+
* API stability tier this plugin belongs to. Absent means `"stable"`;
|
|
1926
|
+
* the registry projection normalizes it, so registry consumers always
|
|
1927
|
+
* read a concrete {@link StabilityLevel}. Wrappers keep non-stable
|
|
1928
|
+
* plugins out of their stable build (by gating them behind a `beta` /
|
|
1929
|
+
* `experimental` subpath import) and consumers badge the level in
|
|
1930
|
+
* generated docs, CLI help, and MCP tool descriptions. No runtime
|
|
1931
|
+
* capability check.
|
|
1932
|
+
*/
|
|
1933
|
+
stability?: StabilityLevel;
|
|
1934
|
+
/**
|
|
1935
|
+
* @deprecated Use `stability: "experimental"` instead. Kept as an
|
|
1936
|
+
* input for external authors; `true` normalizes to
|
|
1937
|
+
* `stability: "experimental"` in the registry projection.
|
|
1852
1938
|
*/
|
|
1853
1939
|
experimental?: boolean;
|
|
1854
1940
|
[key: string]: any;
|
|
@@ -2928,6 +3014,16 @@ interface DeprecationWarning {
|
|
|
2928
3014
|
* once-per-process per message.
|
|
2929
3015
|
*/
|
|
2930
3016
|
declare function defaultLogDeprecation({ methodName, deprecation, }: DeprecationWarning): void;
|
|
3017
|
+
/**
|
|
3018
|
+
* What the boundary reports when a non-stable (beta / experimental) method
|
|
3019
|
+
* is called: the method plus its declared level. `DeprecationWarning`'s
|
|
3020
|
+
* sibling — same self-describing shape, same handler-not-observer contract.
|
|
3021
|
+
*/
|
|
3022
|
+
interface StabilityNotice {
|
|
3023
|
+
type: "stability";
|
|
3024
|
+
methodName: string;
|
|
3025
|
+
stability: StabilityLevel;
|
|
3026
|
+
}
|
|
2931
3027
|
/**
|
|
2932
3028
|
* The well-known id for framework options: heads inject a `CoreOptions` bag
|
|
2933
3029
|
* under it via `createSdk`'s `configuration` (or register a property plugin),
|
|
@@ -2964,6 +3060,16 @@ interface CoreOptions {
|
|
|
2964
3060
|
* reserved for an `on*`-named observer when the unified event bus lands.
|
|
2965
3061
|
*/
|
|
2966
3062
|
logDeprecation?: (warning: DeprecationWarning) => void;
|
|
3063
|
+
/**
|
|
3064
|
+
* `logDeprecation`'s sibling for API stability: the framework signals
|
|
3065
|
+
* every surface call of a method declaring a non-stable `stability`
|
|
3066
|
+
* level (beta / experimental), and this gate decides what happens.
|
|
3067
|
+
* Exactly one: absent falls back to {@link defaultLogStabilityNotice}
|
|
3068
|
+
* (once-per-process per message), supplied replaces it. Runs isolated,
|
|
3069
|
+
* so a throwing handler never breaks the observed call. Internal
|
|
3070
|
+
* delegation never signals, matching the deprecation contract.
|
|
3071
|
+
*/
|
|
3072
|
+
logStabilityNotice?: (notice: StabilityNotice) => void;
|
|
2967
3073
|
/**
|
|
2968
3074
|
* Report what output validation stripped, on the response's
|
|
2969
3075
|
* `meta.outputValidation.droppedPaths` (the name mirrors that path). Off by
|
|
@@ -3527,6 +3633,8 @@ declare function createFunction<TOptions, TResult, TSchemaOptions extends TOptio
|
|
|
3527
3633
|
annotator?: (input: unknown) => Annotations;
|
|
3528
3634
|
/** Live read of the method's deprecation meta (see signalDeprecation). */
|
|
3529
3635
|
getDeprecation?: () => FunctionDeprecation | undefined;
|
|
3636
|
+
/** Live read of the method's stability level (see signalStability). */
|
|
3637
|
+
getStability?: () => StabilityLevel | undefined;
|
|
3530
3638
|
}): (callOptions?: TOptions) => Promise<TResult>;
|
|
3531
3639
|
/**
|
|
3532
3640
|
* Higher-order function that creates a paginated function that wraps
|
|
@@ -3567,6 +3675,8 @@ declare function createPaginatedFunction<TUserOptions, TResponse, TItem = ItemTy
|
|
|
3567
3675
|
finalizePage?: (page: SdkPage<TItem>) => SdkPage<TItem>;
|
|
3568
3676
|
/** Live read of the method's deprecation meta (see signalDeprecation). */
|
|
3569
3677
|
getDeprecation?: () => FunctionDeprecation | undefined;
|
|
3678
|
+
/** Live read of the method's stability level (see signalStability). */
|
|
3679
|
+
getStability?: () => StabilityLevel | undefined;
|
|
3570
3680
|
}): (options?: TUserOptions & {
|
|
3571
3681
|
cursor?: string;
|
|
3572
3682
|
pageSize?: number;
|
|
@@ -3808,6 +3918,16 @@ interface DeprecationLogger {
|
|
|
3808
3918
|
* channels while sharing the implementation.
|
|
3809
3919
|
*/
|
|
3810
3920
|
declare function createDeprecationLogger(tag: string): DeprecationLogger;
|
|
3921
|
+
interface StabilityNoticeLogger {
|
|
3922
|
+
logStabilityNotice(message: string): void;
|
|
3923
|
+
resetStabilityNotices(): void;
|
|
3924
|
+
}
|
|
3925
|
+
/**
|
|
3926
|
+
* Create a package-tagged stability-notice logger: the deprecation logger's
|
|
3927
|
+
* sibling for non-stable (beta / experimental) API warnings, with the same
|
|
3928
|
+
* once-per-process dedupe policy and its own independent message Set.
|
|
3929
|
+
*/
|
|
3930
|
+
declare function createStabilityNoticeLogger(tag: string): StabilityNoticeLogger;
|
|
3811
3931
|
|
|
3812
3932
|
/**
|
|
3813
3933
|
* Core signal machinery.
|
|
@@ -4235,4 +4355,4 @@ declare const normalizeConnectionPlugin: MethodPlugin<"normalizeConnection", Nor
|
|
|
4235
4355
|
*/
|
|
4236
4356
|
declare const resolveConnectionPlugin: MethodPlugin<"resolveConnection", ResolveConnectionInput, string | undefined, readonly []> & LeafSummary<"kitcore", "resolveConnection", readonly []>;
|
|
4237
4357
|
|
|
4238
|
-
export { type AdaptError, type AdaptErrorOptions, type AdaptPage, type AggregatePlugin, type Annotations, type ArrayResolver$1 as ArrayResolver, type AsyncContext, type AttemptHttpRequestInput, type AuthorizeHttpRequestInput, type BoundFormatter, type BoundResolver, CONTEXT, CORE_ERROR_SYMBOL, CORE_OPTIONS_ID, CORE_SIGNAL_SYMBOL, type CallContext, type CallOrigin, type CategoryDefinition, type ComposedAnnotator, type ConstantResolver$1 as ConstantResolver, type Controller, type ControllerAction, type ControllerAffordance, type ControllerAnswerFn, type ControllerChoice, type ControllerError, type ControllerIssue, type ControllerListingPage, type ControllerListingPosition, type ControllerMethodDescription, type ControllerMethodSummary, type ControllerPagination, type ControllerParameterDescription, type ControllerPath, type ControllerQuestion, type ControllerResult, type ControllerSdk, type ControllerSelectPage, type ControllerState, type CoreApiError, CoreCancelledSignal, CoreDisposeError, CoreError, CoreErrorCode, type CoreErrorOptions, type CoreOptions, CoreSignal, type CreateSdkOptions, type DefaultConnectionSchemeInput, type DeprecatedPromptConfigChoice, type DeprecationLogger, type DeprecationWarning, type DispatchHttpRequestInput, type DisposeFn, type DynamicListResolver, type DynamicMember, type DynamicResolver$1 as DynamicResolver, type DynamicSearchResolver, type FieldsResolver, type FormattedItem, type Formatter, type FunctionDeprecation, type FunctionRegistryEntry, type HookAnnotator, type HookPlugin, type HttpAttemptContext, type HttpFetchInit, type HttpOperationContext, type HttpOperationStart, type HttpPipelineState, type HttpRequest, type HttpRequestInput, type HttpResponse, type InitializeHttpRequestInput, type LeafMeta, type LeafSummary, type LegacyMergePlugin, type LegacyPlugin, type ListItemsResult, type ListPromptConfig, type MethodAnnotator, type MethodAttachment, type MethodHooks, type MethodOverridePlugin, type MethodPlugin, type MethodScope, type Resolver as ModelResolver, type NegatableMetadata, type NormalizeConnectionInput, type NormalizedConnection, type OnMethodEnd, type OnMethodEndContext, type OnMethodStart, type OnMethodStartContext, type OutputFormatter, type PaginatedSdkFunction, type PaginatedSdkResult, type Plugin, type PluginMeta, type PluginProvides, type PluginStack, type PluginSummary, type PluginSurface, type PositionalMetadata, type PrepareHttpRequestInput, type PromptConfig, type PromptConfigChoice, type PropertyPlugin, RETRY_HTTP_REQUEST_OPTIONS_ID, type ReceiveHttpResponseInput, type RegistryResult, type RequiredSdkOf, type ResolveConnectionInput, type Resolver$1 as Resolver, type ResolverConfig, type ResolverFieldItem, type ResolverMetadata, type ResolverPromptConfig, type ResolverType, type ResponseMeta, type RetryHttpRequestOptions, type Sdk, type SdkContext, type SdkPage, type SendHttpRequest, type StaticResolver$1 as StaticResolver, type ValidResolvers, addPlugin, attemptHttpRequestPlugin, authorizeHttpRequestPlugin, canonicalInputSchema, composePlugins, concatLists, concatPaginated, coreOptionsPluginRef, createAsyncContext, createController, createCoreError, createCorePlugin, createDeprecationLogger, createFunction, createPaginatedFunction, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createPrefixedCursor, createSdk, createValidator, dangerousContextPlugin, declareDefault, declareMethod, declareOptionalMethod, declareOptionalProperty, declarePlugin, declareProperty, decodeIncomingCursor, defaultConnectionSchemePlugin, defaultLogDeprecation, defineFormatter, defineHook, defineLegacyMerge, defineMethod, defineMethodOverride, definePlugin, defineProperty, defineResolver, dispatchHttpRequestPlugin, disposeSdk, fetchPlugin, fromFunctionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCurrentDepth, getCurrentScope, getFieldDescriptions, getNegatable, getOutputSchema, getRegistryPlugin, getSchemaDescription, initializeHttpRequestPlugin, isCoreCancelledSignal, isCoreError, isCoreSignal, isNestedMethodCall, isPositional, isTelemetryNested, normalizeConnectionPlugin, omitExports, openEnum, paginate, paginateBuffered, paginateMaxItems, prepareHttpRequestPlugin, receiveHttpResponsePlugin, redactHeaders, redactHttpRequest, resolveConnectionPlugin, resolvePlugin, retryHttpRequestOptionsPluginRef, retryHttpRequestPlugin, runInMethodScope, runWithTelemetryContext, selectExports, sendHttpRequestPlugin, splitPrefixedCursor, toIterable, toSnakeCase, toTitleCase, validateOptions, withOutputSchema, withPositional, withResolver };
|
|
4358
|
+
export { type AdaptError, type AdaptErrorOptions, type AdaptPage, type AggregatePlugin, type Annotations, type ArrayResolver$1 as ArrayResolver, type AsyncContext, type AttemptHttpRequestInput, type AuthorizeHttpRequestInput, type BoundFormatter, type BoundResolver, CONTEXT, CORE_ERROR_SYMBOL, CORE_OPTIONS_ID, CORE_SIGNAL_SYMBOL, type CallContext, type CallOrigin, type CategoryDefinition, type ComposedAnnotator, type ConstantResolver$1 as ConstantResolver, type Controller, type ControllerAction, type ControllerAffordance, type ControllerAnswerFn, type ControllerChoice, type ControllerError, type ControllerIssue, type ControllerListingPage, type ControllerListingPosition, type ControllerMethodDescription, type ControllerMethodSummary, type ControllerPagination, type ControllerParameterDescription, type ControllerPath, type ControllerQuestion, type ControllerResult, type ControllerSdk, type ControllerSelectPage, type ControllerState, type CoreApiError, CoreCancelledSignal, CoreDisposeError, CoreError, CoreErrorCode, type CoreErrorOptions, type CoreOptions, CoreSignal, type CreateSdkOptions, type DefaultConnectionSchemeInput, type DeprecatedPromptConfigChoice, type DeprecationLogger, type DeprecationWarning, type DispatchHttpRequestInput, type DisposeFn, type DynamicListResolver, type DynamicMember, type DynamicResolver$1 as DynamicResolver, type DynamicSearchResolver, type FieldsResolver, type FormattedItem, type Formatter, type FunctionDeprecation, type FunctionRegistryEntry, type HookAnnotator, type HookPlugin, type HttpAttemptContext, type HttpFetchInit, type HttpOperationContext, type HttpOperationStart, type HttpPipelineState, type HttpRequest, type HttpRequestInput, type HttpResponse, type InitializeHttpRequestInput, type LeafMeta, type LeafSummary, type LegacyMergePlugin, type LegacyPlugin, type ListItemsResult, type ListPromptConfig, type MethodAnnotator, type MethodAttachment, type MethodHooks, type MethodOverridePlugin, type MethodPlugin, type MethodScope, type Resolver as ModelResolver, type NegatableMetadata, type NormalizeConnectionInput, type NormalizedConnection, type OnMethodEnd, type OnMethodEndContext, type OnMethodStart, type OnMethodStartContext, type OutputFormatter, type PaginatedSdkFunction, type PaginatedSdkResult, type Plugin, type PluginMeta, type PluginProvides, type PluginStack, type PluginSummary, type PluginSurface, type PositionalMetadata, type PrepareHttpRequestInput, type PromptConfig, type PromptConfigChoice, type PropertyPlugin, RETRY_HTTP_REQUEST_OPTIONS_ID, type ReceiveHttpResponseInput, type RegistryResult, type RequiredSdkOf, type ResolveConnectionInput, type Resolver$1 as Resolver, type ResolverConfig, type ResolverFieldItem, type ResolverMetadata, type ResolverPromptConfig, type ResolverType, type ResponseMeta, type RetryHttpRequestOptions, STABILITY_LEVELS, STABILITY_TITLES, type Sdk, type SdkContext, type SdkPage, type SendHttpRequest, type StabilityLevel, type StabilityNotice, type StabilityNoticeLogger, type StaticResolver$1 as StaticResolver, type ValidResolvers, addPlugin, applyStabilityLabel, attemptHttpRequestPlugin, authorizeHttpRequestPlugin, canonicalInputSchema, composePlugins, concatLists, concatPaginated, coreOptionsPluginRef, createAsyncContext, createController, createCoreError, createCorePlugin, createDeprecationLogger, createFunction, createPaginatedFunction, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createPrefixedCursor, createSdk, createStabilityNoticeLogger, createValidator, dangerousContextPlugin, declareDefault, declareMethod, declareOptionalMethod, declareOptionalProperty, declarePlugin, declareProperty, decodeIncomingCursor, defaultConnectionSchemePlugin, defaultLogDeprecation, defineFormatter, defineHook, defineLegacyMerge, defineMethod, defineMethodOverride, definePlugin, defineProperty, defineResolver, dispatchHttpRequestPlugin, disposeSdk, fetchPlugin, fromFunctionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCurrentDepth, getCurrentScope, getFieldDescriptions, getNegatable, getOutputSchema, getRegistryPlugin, getSchemaDescription, initializeHttpRequestPlugin, isCoreCancelledSignal, isCoreError, isCoreSignal, isNestedMethodCall, isPositional, isTelemetryNested, normalizeConnectionPlugin, normalizeStability, omitExports, openEnum, paginate, paginateBuffered, paginateMaxItems, prepareHttpRequestPlugin, receiveHttpResponsePlugin, redactHeaders, redactHttpRequest, resolveConnectionPlugin, resolvePlugin, retryHttpRequestOptionsPluginRef, retryHttpRequestPlugin, runInMethodScope, runWithTelemetryContext, selectExports, sendHttpRequestPlugin, splitPrefixedCursor, toIterable, toSnakeCase, toTitleCase, validateOptions, withOutputSchema, withPositional, withResolver };
|
package/dist/index.mjs
CHANGED
|
@@ -89,6 +89,28 @@ function openEnum(values, description) {
|
|
|
89
89
|
return z.union([z.enum(values), z.string()]).describe(description);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
// src/utils/stability.ts
|
|
93
|
+
var STABILITY_LEVELS = ["stable", "beta", "experimental"];
|
|
94
|
+
var STABILITY_TITLES = {
|
|
95
|
+
stable: "Stable",
|
|
96
|
+
beta: "Beta",
|
|
97
|
+
experimental: "Experimental"
|
|
98
|
+
};
|
|
99
|
+
function normalizeStability(meta) {
|
|
100
|
+
if (meta.stability !== void 0) {
|
|
101
|
+
return STABILITY_LEVELS.includes(meta.stability) ? meta.stability : "experimental";
|
|
102
|
+
}
|
|
103
|
+
return meta.experimental ? "experimental" : "stable";
|
|
104
|
+
}
|
|
105
|
+
function applyStabilityLabel({
|
|
106
|
+
description,
|
|
107
|
+
stability,
|
|
108
|
+
placement = "suffix"
|
|
109
|
+
}) {
|
|
110
|
+
if (stability === void 0 || stability === "stable") return description;
|
|
111
|
+
return placement === "prefix" ? `[${STABILITY_TITLES[stability]}] ${description}` : `${description} (${stability})`;
|
|
112
|
+
}
|
|
113
|
+
|
|
92
114
|
// src/registry.ts
|
|
93
115
|
function resolveCategoryDefinition(ref) {
|
|
94
116
|
const def = typeof ref === "string" ? { key: ref } : ref;
|
|
@@ -133,6 +155,7 @@ function buildRegistry({
|
|
|
133
155
|
return typeof rootProperty === "object" && rootProperty !== null;
|
|
134
156
|
}).map((key) => {
|
|
135
157
|
const m = meta[key];
|
|
158
|
+
const stability = normalizeStability(m);
|
|
136
159
|
return {
|
|
137
160
|
name: key,
|
|
138
161
|
description: m.description,
|
|
@@ -148,7 +171,11 @@ function buildRegistry({
|
|
|
148
171
|
),
|
|
149
172
|
resolvers: resolvers?.[key],
|
|
150
173
|
formatter: formatters?.[key],
|
|
151
|
-
|
|
174
|
+
stability,
|
|
175
|
+
// Deprecated derived read, literal by name: only the experimental
|
|
176
|
+
// tier reads true. Beta reads false — the "not stable" warning duty
|
|
177
|
+
// lives in `stability` and the runtime notice, not this boolean.
|
|
178
|
+
experimental: stability === "experimental",
|
|
152
179
|
packages: m.packages,
|
|
153
180
|
confirm: m.confirm ?? (m.type === "delete" ? "delete" : void 0),
|
|
154
181
|
deprecation: m.deprecation,
|
|
@@ -237,6 +264,20 @@ function createDeprecationLogger(tag) {
|
|
|
237
264
|
};
|
|
238
265
|
}
|
|
239
266
|
var { logDeprecation, resetDeprecationWarnings } = createDeprecationLogger("core");
|
|
267
|
+
function createStabilityNoticeLogger(tag) {
|
|
268
|
+
const loggedNotices = /* @__PURE__ */ new Set();
|
|
269
|
+
return {
|
|
270
|
+
logStabilityNotice(message) {
|
|
271
|
+
if (loggedNotices.has(message)) return;
|
|
272
|
+
loggedNotices.add(message);
|
|
273
|
+
console.warn(`[${tag}] ${message}`);
|
|
274
|
+
},
|
|
275
|
+
resetStabilityNotices() {
|
|
276
|
+
loggedNotices.clear();
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
var { logStabilityNotice, resetStabilityNotices } = createStabilityNoticeLogger("core");
|
|
240
281
|
|
|
241
282
|
// src/types/errors.ts
|
|
242
283
|
var CORE_ERROR_SYMBOL = Symbol.for("kitcore.error");
|
|
@@ -721,6 +762,19 @@ function defaultLogDeprecation({
|
|
|
721
762
|
}) {
|
|
722
763
|
logDeprecation(`${methodName}() is deprecated. ${deprecation.message}`);
|
|
723
764
|
}
|
|
765
|
+
var STABILITY_NOTICE_DETAILS = {
|
|
766
|
+
beta: "Its API shape is settled, but it is not yet covered by stable-tier guarantees.",
|
|
767
|
+
experimental: "It may change shape or disappear without notice."
|
|
768
|
+
};
|
|
769
|
+
function defaultLogStabilityNotice({
|
|
770
|
+
methodName,
|
|
771
|
+
stability
|
|
772
|
+
}) {
|
|
773
|
+
if (stability === "stable") return;
|
|
774
|
+
logStabilityNotice(
|
|
775
|
+
`${methodName}() is a ${stability} API. ${STABILITY_NOTICE_DETAILS[stability]}`
|
|
776
|
+
);
|
|
777
|
+
}
|
|
724
778
|
var CORE_OPTIONS_ID = "kitcore/coreOptions";
|
|
725
779
|
|
|
726
780
|
// src/utils/function-utils.ts
|
|
@@ -769,6 +823,18 @@ function signalDeprecation(context, methodName, getDeprecation) {
|
|
|
769
823
|
const handler = resolveCoreOptions(context)?.logDeprecation ?? defaultLogDeprecation;
|
|
770
824
|
runIsolatedObserver(() => handler(warning));
|
|
771
825
|
}
|
|
826
|
+
function signalStability(context, methodName, getStability) {
|
|
827
|
+
if (isInsideObserver()) return;
|
|
828
|
+
const stability = getStability?.();
|
|
829
|
+
if (!stability || stability === "stable") return;
|
|
830
|
+
const notice = {
|
|
831
|
+
type: "stability",
|
|
832
|
+
methodName,
|
|
833
|
+
stability
|
|
834
|
+
};
|
|
835
|
+
const handler = resolveCoreOptions(context)?.logStabilityNotice ?? defaultLogStabilityNotice;
|
|
836
|
+
runIsolatedObserver(() => handler(notice));
|
|
837
|
+
}
|
|
772
838
|
function normalizeError(error, adaptError) {
|
|
773
839
|
if (error instanceof Error) return error;
|
|
774
840
|
const message = typeof error === "object" && error !== null && "message" in error && typeof error.message === "string" ? error.message : String(error);
|
|
@@ -782,7 +848,7 @@ function normalizeError(error, adaptError) {
|
|
|
782
848
|
);
|
|
783
849
|
}
|
|
784
850
|
function createFunction(coreFn, options) {
|
|
785
|
-
const { sdk, schema, name, annotator, getDeprecation } = options;
|
|
851
|
+
const { sdk, schema, name, annotator, getDeprecation, getStability } = options;
|
|
786
852
|
const functionName = name || coreFn.name;
|
|
787
853
|
const namedFunctions = {
|
|
788
854
|
[functionName]: async function(callOptions) {
|
|
@@ -790,6 +856,7 @@ function createFunction(coreFn, options) {
|
|
|
790
856
|
const context = resolveCallContext(internal);
|
|
791
857
|
if (!isCallContext(internal) && internal !== INTERNAL_CALL) {
|
|
792
858
|
signalDeprecation(sdk.context, functionName, getDeprecation);
|
|
859
|
+
signalStability(sdk.context, functionName, getStability);
|
|
793
860
|
}
|
|
794
861
|
return runInMethodScope(async () => {
|
|
795
862
|
const startTime = Date.now();
|
|
@@ -856,12 +923,21 @@ function createFunction(coreFn, options) {
|
|
|
856
923
|
return namedFunctions[functionName];
|
|
857
924
|
}
|
|
858
925
|
function createRawFunction(coreFn, options) {
|
|
859
|
-
const {
|
|
926
|
+
const {
|
|
927
|
+
sdk,
|
|
928
|
+
name,
|
|
929
|
+
schema,
|
|
930
|
+
positional,
|
|
931
|
+
annotator,
|
|
932
|
+
getDeprecation,
|
|
933
|
+
getStability
|
|
934
|
+
} = options;
|
|
860
935
|
return function(rawInput) {
|
|
861
936
|
const internal = arguments[1];
|
|
862
937
|
const context = resolveCallContext(internal);
|
|
863
938
|
if (!isCallContext(internal) && internal !== INTERNAL_CALL) {
|
|
864
939
|
signalDeprecation(sdk.context, name, getDeprecation);
|
|
940
|
+
signalStability(sdk.context, name, getStability);
|
|
865
941
|
}
|
|
866
942
|
return runInMethodScope(() => {
|
|
867
943
|
const startTime = Date.now();
|
|
@@ -967,7 +1043,8 @@ function createPaginatedFunction(coreFn, options) {
|
|
|
967
1043
|
adaptPage,
|
|
968
1044
|
annotator,
|
|
969
1045
|
finalizePage,
|
|
970
|
-
getDeprecation
|
|
1046
|
+
getDeprecation,
|
|
1047
|
+
getStability
|
|
971
1048
|
} = options;
|
|
972
1049
|
const pageFunction = createPageFunction(coreFn, {
|
|
973
1050
|
sdk,
|
|
@@ -981,6 +1058,7 @@ function createPaginatedFunction(coreFn, options) {
|
|
|
981
1058
|
const context = resolveCallContext(internal);
|
|
982
1059
|
if (!isCallContext(internal) && internal !== INTERNAL_CALL) {
|
|
983
1060
|
signalDeprecation(sdk.context, functionName, getDeprecation);
|
|
1061
|
+
signalStability(sdk.context, functionName, getStability);
|
|
984
1062
|
}
|
|
985
1063
|
return runInMethodScope(() => {
|
|
986
1064
|
const startTime = Date.now();
|
|
@@ -1425,6 +1503,7 @@ var LEAF_META_KEYS = [
|
|
|
1425
1503
|
"returnType",
|
|
1426
1504
|
"outputSchema",
|
|
1427
1505
|
"packages",
|
|
1506
|
+
"stability",
|
|
1428
1507
|
"experimental",
|
|
1429
1508
|
"confirm",
|
|
1430
1509
|
"deprecation",
|
|
@@ -2692,7 +2771,8 @@ function buildMethodEntries(descriptors, context, states) {
|
|
|
2692
2771
|
// (item mode's sibling); dropped paths surface as `[].x` in the page's
|
|
2693
2772
|
// `meta`, unioned across items.
|
|
2694
2773
|
finalizePage: (page) => applyListOutputPolicy(page, outputPolicy()),
|
|
2695
|
-
getDeprecation: () => entry.meta?.deprecation
|
|
2774
|
+
getDeprecation: () => entry.meta?.deprecation,
|
|
2775
|
+
getStability: () => entry.meta ? normalizeStability(entry.meta) : void 0
|
|
2696
2776
|
}
|
|
2697
2777
|
);
|
|
2698
2778
|
} else if (out.type === "item") {
|
|
@@ -2704,7 +2784,8 @@ function buildMethodEntries(descriptors, context, states) {
|
|
|
2704
2784
|
schema: descriptor.inputSchema,
|
|
2705
2785
|
name: descriptor.name,
|
|
2706
2786
|
annotator: boundAnnotator,
|
|
2707
|
-
getDeprecation: () => entry.meta?.deprecation
|
|
2787
|
+
getDeprecation: () => entry.meta?.deprecation,
|
|
2788
|
+
getStability: () => entry.meta ? normalizeStability(entry.meta) : void 0
|
|
2708
2789
|
}
|
|
2709
2790
|
);
|
|
2710
2791
|
} else {
|
|
@@ -2718,8 +2799,10 @@ function buildMethodEntries(descriptors, context, states) {
|
|
|
2718
2799
|
annotator: boundAnnotator,
|
|
2719
2800
|
// The boundary reads the deprecation LIVE off the entry, so a
|
|
2720
2801
|
// deprecation merged after build (defineMethodOverride, addPlugin)
|
|
2721
|
-
// fires too.
|
|
2722
|
-
|
|
2802
|
+
// fires too. Same for the stability level, normalized from the
|
|
2803
|
+
// entry meta (declared level or legacy `experimental` boolean).
|
|
2804
|
+
getDeprecation: () => entry.meta?.deprecation,
|
|
2805
|
+
getStability: () => entry.meta ? normalizeStability(entry.meta) : void 0
|
|
2723
2806
|
}
|
|
2724
2807
|
);
|
|
2725
2808
|
}
|
|
@@ -4779,7 +4862,10 @@ export {
|
|
|
4779
4862
|
CoreErrorCode,
|
|
4780
4863
|
CoreSignal,
|
|
4781
4864
|
RETRY_HTTP_REQUEST_OPTIONS_ID,
|
|
4865
|
+
STABILITY_LEVELS,
|
|
4866
|
+
STABILITY_TITLES,
|
|
4782
4867
|
addPlugin,
|
|
4868
|
+
applyStabilityLabel,
|
|
4783
4869
|
attemptHttpRequestPlugin,
|
|
4784
4870
|
authorizeHttpRequestPlugin,
|
|
4785
4871
|
canonicalInputSchema,
|
|
@@ -4799,6 +4885,7 @@ export {
|
|
|
4799
4885
|
createPluginStack,
|
|
4800
4886
|
createPrefixedCursor,
|
|
4801
4887
|
createSdk,
|
|
4888
|
+
createStabilityNoticeLogger,
|
|
4802
4889
|
createValidator,
|
|
4803
4890
|
dangerousContextPlugin,
|
|
4804
4891
|
declareDefault,
|
|
@@ -4840,6 +4927,7 @@ export {
|
|
|
4840
4927
|
isPositional,
|
|
4841
4928
|
isTelemetryNested,
|
|
4842
4929
|
normalizeConnectionPlugin,
|
|
4930
|
+
normalizeStability,
|
|
4843
4931
|
omitExports,
|
|
4844
4932
|
openEnum,
|
|
4845
4933
|
paginate,
|