@zapier/kitcore 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -8,9 +8,33 @@ declare module "zod" {
8
8
  }
9
9
  }
10
10
 
11
+ /**
12
+ * The response `meta` sidecar, shared by both output modes: an item method's
13
+ * `{ data, meta }` envelope and a list method's page carry the same shape, so a
14
+ * caller reads a framework report the same way regardless of the mode it came
15
+ * from.
16
+ *
17
+ * Every member is optional and framework-owned. A method's `run` returns `data`;
18
+ * the boundary attaches what belongs here.
19
+ */
20
+ interface ResponseMeta {
21
+ /**
22
+ * What output validation's strip removed from the response, present only when
23
+ * the head enables the `includeOutputValidationDroppedPaths` core option AND
24
+ * something was actually dropped. Paths are relative to `data` in both modes
25
+ * (`a.b` for an item), with array elements collapsed to one `[]` segment and
26
+ * unioned (`[].b` on a page, `items[].b` for an array inside an item), matching
27
+ * connectors' format.
28
+ */
29
+ outputValidation?: {
30
+ droppedPaths: string[];
31
+ };
32
+ }
33
+
11
34
  /**
12
35
  * Pagination shapes used by the plugin framework.
13
36
  */
37
+
14
38
  /**
15
39
  * Single page of a paginated SDK list result. Returned from the page-level
16
40
  * promise and yielded from the page-level async iterable.
@@ -18,6 +42,10 @@ declare module "zod" {
18
42
  interface SdkPage<T = unknown> {
19
43
  data: T[];
20
44
  nextCursor?: string;
45
+ /** Additive per-page framework sidecar, the same shape an item method's
46
+ * envelope carries. Framework-set, not something a handler or `adaptPage`
47
+ * returns. See {@link ResponseMeta}. */
48
+ meta?: ResponseMeta;
21
49
  }
22
50
  /**
23
51
  * Return type of every paginated SDK method. The documented surface is:
@@ -480,6 +508,28 @@ declare function withPositional<T extends z.ZodType>(schema: T): T & {
480
508
  _def: T["_def"] & PositionalMetadata;
481
509
  };
482
510
  declare function isPositional(schema: z.ZodType): boolean;
511
+ /**
512
+ * Marks an optional boolean schema for which omission is distinct from false:
513
+ * omitting the value means "use the server default" or "preserve the current
514
+ * value", so an explicit false needs its own affordance. A string supplies
515
+ * the domain antonym — "disabled" for `enabled` — which each surface renders
516
+ * in its own vocabulary (a CLI as a flag spelling, a tool description as
517
+ * prose). `true` requests generic negation when the domain has no antonym.
518
+ *
519
+ * Declare it via `.meta({ negatable: "disabled" } satisfies NegatableMetadata)`.
520
+ * The `satisfies` matters: zod's metadata type permits arbitrary keys, so it
521
+ * is the only compile-time check against a misspelled key.
522
+ */
523
+ interface NegatableMetadata {
524
+ negatable: true | string;
525
+ }
526
+ /**
527
+ * Read a schema's `negatable` metadata: `true`, the domain antonym, or
528
+ * undefined when the schema doesn't declare one. Unwraps optional/default
529
+ * wrappers like `isPositional`, so the `.meta()` call may sit on any layer
530
+ * of the chain.
531
+ */
532
+ declare function getNegatable(schema: z.ZodType): NegatableMetadata["negatable"] | undefined;
483
533
  declare function openEnum<const T extends readonly [string, ...string[]]>(values: T, description: string): z.ZodUnion<readonly [z.ZodEnum<{ [k_1 in T[number]]: k_1; } extends infer T_1 ? { [k in keyof T_1]: { [k_1 in T[number]]: k_1; }[k]; } : never>, z.ZodString]>;
484
534
 
485
535
  /**
@@ -504,6 +554,13 @@ interface LeafMetaFields {
504
554
  itemType?: string;
505
555
  returnType?: string;
506
556
  outputSchema?: z.ZodSchema;
557
+ /** Behavioral opt-out that rides on this config for every `defineMethod`
558
+ * overload (all merge `LeafMetaFields`), the partner of `outputSchema`: when
559
+ * true, the materializer skips validating/stripping the output. It is
560
+ * consumed at build time and stored as a first-class plugin field, NOT folded
561
+ * into the projected meta (hence absent from `LEAF_META_KEYS`), so it stays
562
+ * off the registry / CLI / MCP surface, exactly like `skipInputValidation`. */
563
+ skipOutputValidation?: boolean;
507
564
  packages?: string[];
508
565
  experimental?: boolean;
509
566
  confirm?: "create-secret" | "delete";
@@ -1008,9 +1065,15 @@ interface MethodPlugin<TName extends string = string, TInput = unknown, TOutput
1008
1065
  /** True for a `declareMethod` stand-in: a typed reference with no real
1009
1066
  * implementation. A real plugin under the same id satisfies it. */
1010
1067
  standIn?: boolean;
1011
- /** True for a `declareOptionalProperty` stand-in over a method id: dependents bind
1012
- * `undefined` if no real plugin satisfies it. */
1068
+ /** True for a `declareOptionalMethod` stand-in: dependents bind `undefined` if
1069
+ * no real plugin satisfies it, and `PluginSurface` types the binding
1070
+ * `| undefined`. */
1013
1071
  optional?: boolean;
1072
+ /** Present on a `declareDefault` wrapper: this entry is the DEFAULT provider
1073
+ * for its id (preempted by any explicit provider). Its value is the wrapped
1074
+ * plugin, so two defaults for one id dedup (same source) or conflict
1075
+ * (different source). */
1076
+ defaultSource?: AnyLeafPlugin;
1014
1077
  imports: readonly AnyPlugin[];
1015
1078
  /** Binding-name to plugin-id edges, normalized from `imports`;
1016
1079
  * what the `imports` bag is built from. */
@@ -1032,6 +1095,10 @@ interface MethodPlugin<TName extends string = string, TInput = unknown, TOutput
1032
1095
  * For raw methods that own their own validation and must not have their input
1033
1096
  * transformed, e.g. `fetch` passing a `RequestInit` bag through unchanged. */
1034
1097
  skipInputValidation?: boolean;
1098
+ /** When true, the materializer skips validating/stripping `run`'s output
1099
+ * against `meta.outputSchema` (the schema stays for projection). The output
1100
+ * partner of {@link MethodPlugin.skipInputValidation}. */
1101
+ skipOutputValidation?: boolean;
1035
1102
  /** Descriptive metadata for the registry / CLI / MCP / docs (carry-only at
1036
1103
  * runtime). */
1037
1104
  meta?: LeafMeta;
@@ -1146,6 +1213,11 @@ interface PropertyPlugin<TName extends string = string, TValue = unknown> {
1146
1213
  * property satisfies it, dependents bind `undefined` rather than the build
1147
1214
  * failing on a missing dependency. */
1148
1215
  optional?: boolean;
1216
+ /** Present on a `declareDefault` wrapper: this entry is the DEFAULT provider
1217
+ * for its id (preempted by any explicit provider). Its value is the wrapped
1218
+ * plugin, so two defaults for one id dedup (same source) or conflict
1219
+ * (different source). */
1220
+ defaultSource?: AnyLeafPlugin;
1149
1221
  imports: readonly AnyPlugin[];
1150
1222
  /** Binding-name to plugin-id edges, normalized from `imports`;
1151
1223
  * what the `imports` bag is built from. */
@@ -1483,7 +1555,11 @@ type ExportSurface<TChild extends AnyLeafPlugin> = TChild extends MethodPlugin<a
1483
1555
  * bag and `ProvidesOf` is the completeness ledger's phantom ids — both
1484
1556
  * different concepts.
1485
1557
  */
1486
- type PluginSurface<P extends AnyPlugin> = P extends MethodPlugin<infer TName, infer TInput, infer TOutput, infer TPositional> ? {
1558
+ type PluginSurface<P extends AnyPlugin> = P extends MethodPlugin<infer TName, infer TInput, infer TOutput, infer TPositional> ? P extends {
1559
+ optional: true;
1560
+ } ? {
1561
+ [K in TName]: SurfaceCall<TInput, TOutput, TPositional> | undefined;
1562
+ } : {
1487
1563
  [K in TName]: SurfaceCall<TInput, TOutput, TPositional>;
1488
1564
  } : P extends PropertyPlugin<infer TName, infer TValue> ? {
1489
1565
  [K in TName]: TValue;
@@ -2229,6 +2305,7 @@ declare function defineMethod<const TName extends string, TInput, TResponse exte
2229
2305
  run: (bag: MethodRunBag<ImportsOf<TImports>, TInput, TState>) => TResponse | Promise<TResponse>;
2230
2306
  } & LeafMetaFields): MethodPlugin<TName, TInput, Promise<{
2231
2307
  data: TData;
2308
+ meta?: ResponseMeta;
2232
2309
  }>> & LeafSummary<TNamespace, TName, TImports>;
2233
2310
  declare function defineMethod<const TName extends string, TInput, TResponse extends StrictPage$1<TResponse>, TItem = ItemOf$1<TResponse>, const TImports extends ImportsInput = readonly [], const TNamespace extends string = "", TState = undefined>(config: {
2234
2311
  name: TName;
@@ -2450,6 +2527,19 @@ declare function defineFormatter<const TImports extends ImportsInput = readonly
2450
2527
  declare function declareMethod<const TId extends string, TInput = unknown, TOutput = unknown>(config: {
2451
2528
  id: LiteralString<TId>;
2452
2529
  }): MethodPlugin<LastSegment<TId>, TInput, TOutput> & PluginSummary<TId, never>;
2530
+ /**
2531
+ * Declare an OPTIONAL stand-in for a method registered elsewhere: the method twin
2532
+ * of `declareOptionalProperty`. Unlike `declareMethod`, an unsatisfied optional
2533
+ * reference is NOT a missing dependency; the binding is typed
2534
+ * `((input) => output) | undefined`, so the consumer must handle the absent case
2535
+ * (`imports.track?.(...)`). Use it to reference a foreign method userland may or
2536
+ * may not import, without claiming its slot.
2537
+ */
2538
+ declare function declareOptionalMethod<const TId extends string, TInput = unknown, TOutput = unknown>(config: {
2539
+ id: LiteralString<TId>;
2540
+ }): MethodPlugin<LastSegment<TId>, TInput, TOutput> & {
2541
+ optional: true;
2542
+ } & PluginSummary<never, never>;
2453
2543
  /**
2454
2544
  * Define a property leaf. Either a static `value` or a computed `get` (eager,
2455
2545
  * dependencies first, like `setup`). `createSdk`, a dependent's `imports`, or
@@ -2507,6 +2597,21 @@ declare function declareProperty<const TId extends string, TValue = unknown>(con
2507
2597
  declare function declareOptionalProperty<const TId extends string, TValue = unknown>(config: {
2508
2598
  id: LiteralString<TId>;
2509
2599
  }): PropertyPlugin<LastSegment<TId>, TValue | undefined> & PluginSummary<never, never>;
2600
+ /**
2601
+ * Declare a DEFAULT provider for a dependency you own: import the capability the
2602
+ * given plugin provides, and fall back to that plugin when nothing else provides
2603
+ * its id. Kind-agnostic (the plugin supplies id, type, and kind), so no
2604
+ * method/property split.
2605
+ *
2606
+ * A default materializes a real, single node, so it works out of the box and can
2607
+ * be wrapped or replaced: an explicit provider of the same id silently preempts
2608
+ * it, and two different defaults for one id error only when nothing else provides
2609
+ * it. See the Defaults section in the kitcore README for default vs optional
2610
+ * reference.
2611
+ */
2612
+ declare function declareDefault<P extends AnyLeafPlugin>({ plugin, }: {
2613
+ plugin: P;
2614
+ }): P;
2510
2615
  /**
2511
2616
  * Define a method-lifecycle hook: a leaf whose `observe` contributes
2512
2617
  * fire-and-forget observers (`onMethodStart` / `onMethodEnd`) the method
@@ -2859,6 +2964,15 @@ interface CoreOptions {
2859
2964
  * reserved for an `on*`-named observer when the unified event bus lands.
2860
2965
  */
2861
2966
  logDeprecation?: (warning: DeprecationWarning) => void;
2967
+ /**
2968
+ * Report what output validation stripped, on the response's
2969
+ * `meta.outputValidation.droppedPaths` (the name mirrors that path). Off by
2970
+ * default: the report is a debugging aid for reconciling a schema against the
2971
+ * wire, and a sidecar every caller has to ignore is worse than one a head
2972
+ * turns on while it audits its schemas. Off also skips the recursive
2973
+ * raw-vs-parsed diff, so the strip costs a parse and nothing more.
2974
+ */
2975
+ includeOutputValidationDroppedPaths?: boolean;
2862
2976
  }
2863
2977
 
2864
2978
  /**
@@ -3449,6 +3563,8 @@ declare function createPaginatedFunction<TUserOptions, TResponse, TItem = ItemTy
3449
3563
  adaptPage?: (response: TResponse) => SdkPage<NoInfer<TItem>>;
3450
3564
  /** Pre-run per-method annotator (see applyAnnotations). */
3451
3565
  annotator?: (input: unknown) => Annotations;
3566
+ /** Applied to each canonical page after the shape guard (output validation). */
3567
+ finalizePage?: (page: SdkPage<TItem>) => SdkPage<TItem>;
3452
3568
  /** Live read of the method's deprecation meta (see signalDeprecation). */
3453
3569
  getDeprecation?: () => FunctionDeprecation | undefined;
3454
3570
  }): (options?: TUserOptions & {
@@ -3749,4 +3865,4 @@ declare class CoreCancelledSignal extends CoreSignal {
3749
3865
  */
3750
3866
  declare function isCoreCancelledSignal(value: unknown): value is CoreCancelledSignal;
3751
3867
 
3752
- export { type AdaptError, type AdaptErrorOptions, type AdaptPage, type AggregatePlugin, type Annotations, type ArrayResolver$1 as ArrayResolver, type AsyncContext, 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 DeprecatedPromptConfigChoice, type DeprecationLogger, type DeprecationWarning, 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 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 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 PromptConfig, type PromptConfigChoice, type PropertyPlugin, type RegistryResult, type RequiredSdkOf, type Resolver$1 as Resolver, type ResolverConfig, type ResolverFieldItem, type ResolverMetadata, type ResolverPromptConfig, type ResolverType, type Sdk, type SdkContext, type SdkPage, type StaticResolver$1 as StaticResolver, type ValidResolvers, addPlugin, canonicalInputSchema, composePlugins, concatLists, concatPaginated, coreOptionsPluginRef, createAsyncContext, createController, createCoreError, createCorePlugin, createDeprecationLogger, createFunction, createPaginatedFunction, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createPrefixedCursor, createSdk, createValidator, dangerousContextPlugin, declareMethod, declareOptionalProperty, declarePlugin, declareProperty, decodeIncomingCursor, defaultLogDeprecation, defineFormatter, defineHook, defineLegacyMerge, defineMethod, defineMethodOverride, definePlugin, defineProperty, defineResolver, disposeSdk, fromFunctionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCurrentDepth, getCurrentScope, getFieldDescriptions, getOutputSchema, getRegistryPlugin, getSchemaDescription, isCoreCancelledSignal, isCoreError, isCoreSignal, isNestedMethodCall, isPositional, isTelemetryNested, omitExports, openEnum, paginate, paginateBuffered, paginateMaxItems, resolvePlugin, runInMethodScope, runWithTelemetryContext, selectExports, splitPrefixedCursor, toIterable, toSnakeCase, toTitleCase, validateOptions, withOutputSchema, withPositional, withResolver };
3868
+ export { type AdaptError, type AdaptErrorOptions, type AdaptPage, type AggregatePlugin, type Annotations, type ArrayResolver$1 as ArrayResolver, type AsyncContext, 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 DeprecatedPromptConfigChoice, type DeprecationLogger, type DeprecationWarning, 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 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 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 PromptConfig, type PromptConfigChoice, type PropertyPlugin, type RegistryResult, type RequiredSdkOf, type Resolver$1 as Resolver, type ResolverConfig, type ResolverFieldItem, type ResolverMetadata, type ResolverPromptConfig, type ResolverType, type ResponseMeta, type Sdk, type SdkContext, type SdkPage, type StaticResolver$1 as StaticResolver, type ValidResolvers, addPlugin, 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, defaultLogDeprecation, defineFormatter, defineHook, defineLegacyMerge, defineMethod, defineMethodOverride, definePlugin, defineProperty, defineResolver, disposeSdk, fromFunctionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCurrentDepth, getCurrentScope, getFieldDescriptions, getNegatable, getOutputSchema, getRegistryPlugin, getSchemaDescription, isCoreCancelledSignal, isCoreError, isCoreSignal, isNestedMethodCall, isPositional, isTelemetryNested, omitExports, openEnum, paginate, paginateBuffered, paginateMaxItems, resolvePlugin, runInMethodScope, runWithTelemetryContext, selectExports, splitPrefixedCursor, toIterable, toSnakeCase, toTitleCase, validateOptions, withOutputSchema, withPositional, withResolver };
package/dist/index.d.ts CHANGED
@@ -8,9 +8,33 @@ declare module "zod" {
8
8
  }
9
9
  }
10
10
 
11
+ /**
12
+ * The response `meta` sidecar, shared by both output modes: an item method's
13
+ * `{ data, meta }` envelope and a list method's page carry the same shape, so a
14
+ * caller reads a framework report the same way regardless of the mode it came
15
+ * from.
16
+ *
17
+ * Every member is optional and framework-owned. A method's `run` returns `data`;
18
+ * the boundary attaches what belongs here.
19
+ */
20
+ interface ResponseMeta {
21
+ /**
22
+ * What output validation's strip removed from the response, present only when
23
+ * the head enables the `includeOutputValidationDroppedPaths` core option AND
24
+ * something was actually dropped. Paths are relative to `data` in both modes
25
+ * (`a.b` for an item), with array elements collapsed to one `[]` segment and
26
+ * unioned (`[].b` on a page, `items[].b` for an array inside an item), matching
27
+ * connectors' format.
28
+ */
29
+ outputValidation?: {
30
+ droppedPaths: string[];
31
+ };
32
+ }
33
+
11
34
  /**
12
35
  * Pagination shapes used by the plugin framework.
13
36
  */
37
+
14
38
  /**
15
39
  * Single page of a paginated SDK list result. Returned from the page-level
16
40
  * promise and yielded from the page-level async iterable.
@@ -18,6 +42,10 @@ declare module "zod" {
18
42
  interface SdkPage<T = unknown> {
19
43
  data: T[];
20
44
  nextCursor?: string;
45
+ /** Additive per-page framework sidecar, the same shape an item method's
46
+ * envelope carries. Framework-set, not something a handler or `adaptPage`
47
+ * returns. See {@link ResponseMeta}. */
48
+ meta?: ResponseMeta;
21
49
  }
22
50
  /**
23
51
  * Return type of every paginated SDK method. The documented surface is:
@@ -480,6 +508,28 @@ declare function withPositional<T extends z.ZodType>(schema: T): T & {
480
508
  _def: T["_def"] & PositionalMetadata;
481
509
  };
482
510
  declare function isPositional(schema: z.ZodType): boolean;
511
+ /**
512
+ * Marks an optional boolean schema for which omission is distinct from false:
513
+ * omitting the value means "use the server default" or "preserve the current
514
+ * value", so an explicit false needs its own affordance. A string supplies
515
+ * the domain antonym — "disabled" for `enabled` — which each surface renders
516
+ * in its own vocabulary (a CLI as a flag spelling, a tool description as
517
+ * prose). `true` requests generic negation when the domain has no antonym.
518
+ *
519
+ * Declare it via `.meta({ negatable: "disabled" } satisfies NegatableMetadata)`.
520
+ * The `satisfies` matters: zod's metadata type permits arbitrary keys, so it
521
+ * is the only compile-time check against a misspelled key.
522
+ */
523
+ interface NegatableMetadata {
524
+ negatable: true | string;
525
+ }
526
+ /**
527
+ * Read a schema's `negatable` metadata: `true`, the domain antonym, or
528
+ * undefined when the schema doesn't declare one. Unwraps optional/default
529
+ * wrappers like `isPositional`, so the `.meta()` call may sit on any layer
530
+ * of the chain.
531
+ */
532
+ declare function getNegatable(schema: z.ZodType): NegatableMetadata["negatable"] | undefined;
483
533
  declare function openEnum<const T extends readonly [string, ...string[]]>(values: T, description: string): z.ZodUnion<readonly [z.ZodEnum<{ [k_1 in T[number]]: k_1; } extends infer T_1 ? { [k in keyof T_1]: { [k_1 in T[number]]: k_1; }[k]; } : never>, z.ZodString]>;
484
534
 
485
535
  /**
@@ -504,6 +554,13 @@ interface LeafMetaFields {
504
554
  itemType?: string;
505
555
  returnType?: string;
506
556
  outputSchema?: z.ZodSchema;
557
+ /** Behavioral opt-out that rides on this config for every `defineMethod`
558
+ * overload (all merge `LeafMetaFields`), the partner of `outputSchema`: when
559
+ * true, the materializer skips validating/stripping the output. It is
560
+ * consumed at build time and stored as a first-class plugin field, NOT folded
561
+ * into the projected meta (hence absent from `LEAF_META_KEYS`), so it stays
562
+ * off the registry / CLI / MCP surface, exactly like `skipInputValidation`. */
563
+ skipOutputValidation?: boolean;
507
564
  packages?: string[];
508
565
  experimental?: boolean;
509
566
  confirm?: "create-secret" | "delete";
@@ -1008,9 +1065,15 @@ interface MethodPlugin<TName extends string = string, TInput = unknown, TOutput
1008
1065
  /** True for a `declareMethod` stand-in: a typed reference with no real
1009
1066
  * implementation. A real plugin under the same id satisfies it. */
1010
1067
  standIn?: boolean;
1011
- /** True for a `declareOptionalProperty` stand-in over a method id: dependents bind
1012
- * `undefined` if no real plugin satisfies it. */
1068
+ /** True for a `declareOptionalMethod` stand-in: dependents bind `undefined` if
1069
+ * no real plugin satisfies it, and `PluginSurface` types the binding
1070
+ * `| undefined`. */
1013
1071
  optional?: boolean;
1072
+ /** Present on a `declareDefault` wrapper: this entry is the DEFAULT provider
1073
+ * for its id (preempted by any explicit provider). Its value is the wrapped
1074
+ * plugin, so two defaults for one id dedup (same source) or conflict
1075
+ * (different source). */
1076
+ defaultSource?: AnyLeafPlugin;
1014
1077
  imports: readonly AnyPlugin[];
1015
1078
  /** Binding-name to plugin-id edges, normalized from `imports`;
1016
1079
  * what the `imports` bag is built from. */
@@ -1032,6 +1095,10 @@ interface MethodPlugin<TName extends string = string, TInput = unknown, TOutput
1032
1095
  * For raw methods that own their own validation and must not have their input
1033
1096
  * transformed, e.g. `fetch` passing a `RequestInit` bag through unchanged. */
1034
1097
  skipInputValidation?: boolean;
1098
+ /** When true, the materializer skips validating/stripping `run`'s output
1099
+ * against `meta.outputSchema` (the schema stays for projection). The output
1100
+ * partner of {@link MethodPlugin.skipInputValidation}. */
1101
+ skipOutputValidation?: boolean;
1035
1102
  /** Descriptive metadata for the registry / CLI / MCP / docs (carry-only at
1036
1103
  * runtime). */
1037
1104
  meta?: LeafMeta;
@@ -1146,6 +1213,11 @@ interface PropertyPlugin<TName extends string = string, TValue = unknown> {
1146
1213
  * property satisfies it, dependents bind `undefined` rather than the build
1147
1214
  * failing on a missing dependency. */
1148
1215
  optional?: boolean;
1216
+ /** Present on a `declareDefault` wrapper: this entry is the DEFAULT provider
1217
+ * for its id (preempted by any explicit provider). Its value is the wrapped
1218
+ * plugin, so two defaults for one id dedup (same source) or conflict
1219
+ * (different source). */
1220
+ defaultSource?: AnyLeafPlugin;
1149
1221
  imports: readonly AnyPlugin[];
1150
1222
  /** Binding-name to plugin-id edges, normalized from `imports`;
1151
1223
  * what the `imports` bag is built from. */
@@ -1483,7 +1555,11 @@ type ExportSurface<TChild extends AnyLeafPlugin> = TChild extends MethodPlugin<a
1483
1555
  * bag and `ProvidesOf` is the completeness ledger's phantom ids — both
1484
1556
  * different concepts.
1485
1557
  */
1486
- type PluginSurface<P extends AnyPlugin> = P extends MethodPlugin<infer TName, infer TInput, infer TOutput, infer TPositional> ? {
1558
+ type PluginSurface<P extends AnyPlugin> = P extends MethodPlugin<infer TName, infer TInput, infer TOutput, infer TPositional> ? P extends {
1559
+ optional: true;
1560
+ } ? {
1561
+ [K in TName]: SurfaceCall<TInput, TOutput, TPositional> | undefined;
1562
+ } : {
1487
1563
  [K in TName]: SurfaceCall<TInput, TOutput, TPositional>;
1488
1564
  } : P extends PropertyPlugin<infer TName, infer TValue> ? {
1489
1565
  [K in TName]: TValue;
@@ -2229,6 +2305,7 @@ declare function defineMethod<const TName extends string, TInput, TResponse exte
2229
2305
  run: (bag: MethodRunBag<ImportsOf<TImports>, TInput, TState>) => TResponse | Promise<TResponse>;
2230
2306
  } & LeafMetaFields): MethodPlugin<TName, TInput, Promise<{
2231
2307
  data: TData;
2308
+ meta?: ResponseMeta;
2232
2309
  }>> & LeafSummary<TNamespace, TName, TImports>;
2233
2310
  declare function defineMethod<const TName extends string, TInput, TResponse extends StrictPage$1<TResponse>, TItem = ItemOf$1<TResponse>, const TImports extends ImportsInput = readonly [], const TNamespace extends string = "", TState = undefined>(config: {
2234
2311
  name: TName;
@@ -2450,6 +2527,19 @@ declare function defineFormatter<const TImports extends ImportsInput = readonly
2450
2527
  declare function declareMethod<const TId extends string, TInput = unknown, TOutput = unknown>(config: {
2451
2528
  id: LiteralString<TId>;
2452
2529
  }): MethodPlugin<LastSegment<TId>, TInput, TOutput> & PluginSummary<TId, never>;
2530
+ /**
2531
+ * Declare an OPTIONAL stand-in for a method registered elsewhere: the method twin
2532
+ * of `declareOptionalProperty`. Unlike `declareMethod`, an unsatisfied optional
2533
+ * reference is NOT a missing dependency; the binding is typed
2534
+ * `((input) => output) | undefined`, so the consumer must handle the absent case
2535
+ * (`imports.track?.(...)`). Use it to reference a foreign method userland may or
2536
+ * may not import, without claiming its slot.
2537
+ */
2538
+ declare function declareOptionalMethod<const TId extends string, TInput = unknown, TOutput = unknown>(config: {
2539
+ id: LiteralString<TId>;
2540
+ }): MethodPlugin<LastSegment<TId>, TInput, TOutput> & {
2541
+ optional: true;
2542
+ } & PluginSummary<never, never>;
2453
2543
  /**
2454
2544
  * Define a property leaf. Either a static `value` or a computed `get` (eager,
2455
2545
  * dependencies first, like `setup`). `createSdk`, a dependent's `imports`, or
@@ -2507,6 +2597,21 @@ declare function declareProperty<const TId extends string, TValue = unknown>(con
2507
2597
  declare function declareOptionalProperty<const TId extends string, TValue = unknown>(config: {
2508
2598
  id: LiteralString<TId>;
2509
2599
  }): PropertyPlugin<LastSegment<TId>, TValue | undefined> & PluginSummary<never, never>;
2600
+ /**
2601
+ * Declare a DEFAULT provider for a dependency you own: import the capability the
2602
+ * given plugin provides, and fall back to that plugin when nothing else provides
2603
+ * its id. Kind-agnostic (the plugin supplies id, type, and kind), so no
2604
+ * method/property split.
2605
+ *
2606
+ * A default materializes a real, single node, so it works out of the box and can
2607
+ * be wrapped or replaced: an explicit provider of the same id silently preempts
2608
+ * it, and two different defaults for one id error only when nothing else provides
2609
+ * it. See the Defaults section in the kitcore README for default vs optional
2610
+ * reference.
2611
+ */
2612
+ declare function declareDefault<P extends AnyLeafPlugin>({ plugin, }: {
2613
+ plugin: P;
2614
+ }): P;
2510
2615
  /**
2511
2616
  * Define a method-lifecycle hook: a leaf whose `observe` contributes
2512
2617
  * fire-and-forget observers (`onMethodStart` / `onMethodEnd`) the method
@@ -2859,6 +2964,15 @@ interface CoreOptions {
2859
2964
  * reserved for an `on*`-named observer when the unified event bus lands.
2860
2965
  */
2861
2966
  logDeprecation?: (warning: DeprecationWarning) => void;
2967
+ /**
2968
+ * Report what output validation stripped, on the response's
2969
+ * `meta.outputValidation.droppedPaths` (the name mirrors that path). Off by
2970
+ * default: the report is a debugging aid for reconciling a schema against the
2971
+ * wire, and a sidecar every caller has to ignore is worse than one a head
2972
+ * turns on while it audits its schemas. Off also skips the recursive
2973
+ * raw-vs-parsed diff, so the strip costs a parse and nothing more.
2974
+ */
2975
+ includeOutputValidationDroppedPaths?: boolean;
2862
2976
  }
2863
2977
 
2864
2978
  /**
@@ -3449,6 +3563,8 @@ declare function createPaginatedFunction<TUserOptions, TResponse, TItem = ItemTy
3449
3563
  adaptPage?: (response: TResponse) => SdkPage<NoInfer<TItem>>;
3450
3564
  /** Pre-run per-method annotator (see applyAnnotations). */
3451
3565
  annotator?: (input: unknown) => Annotations;
3566
+ /** Applied to each canonical page after the shape guard (output validation). */
3567
+ finalizePage?: (page: SdkPage<TItem>) => SdkPage<TItem>;
3452
3568
  /** Live read of the method's deprecation meta (see signalDeprecation). */
3453
3569
  getDeprecation?: () => FunctionDeprecation | undefined;
3454
3570
  }): (options?: TUserOptions & {
@@ -3749,4 +3865,4 @@ declare class CoreCancelledSignal extends CoreSignal {
3749
3865
  */
3750
3866
  declare function isCoreCancelledSignal(value: unknown): value is CoreCancelledSignal;
3751
3867
 
3752
- export { type AdaptError, type AdaptErrorOptions, type AdaptPage, type AggregatePlugin, type Annotations, type ArrayResolver$1 as ArrayResolver, type AsyncContext, 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 DeprecatedPromptConfigChoice, type DeprecationLogger, type DeprecationWarning, 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 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 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 PromptConfig, type PromptConfigChoice, type PropertyPlugin, type RegistryResult, type RequiredSdkOf, type Resolver$1 as Resolver, type ResolverConfig, type ResolverFieldItem, type ResolverMetadata, type ResolverPromptConfig, type ResolverType, type Sdk, type SdkContext, type SdkPage, type StaticResolver$1 as StaticResolver, type ValidResolvers, addPlugin, canonicalInputSchema, composePlugins, concatLists, concatPaginated, coreOptionsPluginRef, createAsyncContext, createController, createCoreError, createCorePlugin, createDeprecationLogger, createFunction, createPaginatedFunction, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createPrefixedCursor, createSdk, createValidator, dangerousContextPlugin, declareMethod, declareOptionalProperty, declarePlugin, declareProperty, decodeIncomingCursor, defaultLogDeprecation, defineFormatter, defineHook, defineLegacyMerge, defineMethod, defineMethodOverride, definePlugin, defineProperty, defineResolver, disposeSdk, fromFunctionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCurrentDepth, getCurrentScope, getFieldDescriptions, getOutputSchema, getRegistryPlugin, getSchemaDescription, isCoreCancelledSignal, isCoreError, isCoreSignal, isNestedMethodCall, isPositional, isTelemetryNested, omitExports, openEnum, paginate, paginateBuffered, paginateMaxItems, resolvePlugin, runInMethodScope, runWithTelemetryContext, selectExports, splitPrefixedCursor, toIterable, toSnakeCase, toTitleCase, validateOptions, withOutputSchema, withPositional, withResolver };
3868
+ export { type AdaptError, type AdaptErrorOptions, type AdaptPage, type AggregatePlugin, type Annotations, type ArrayResolver$1 as ArrayResolver, type AsyncContext, 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 DeprecatedPromptConfigChoice, type DeprecationLogger, type DeprecationWarning, 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 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 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 PromptConfig, type PromptConfigChoice, type PropertyPlugin, type RegistryResult, type RequiredSdkOf, type Resolver$1 as Resolver, type ResolverConfig, type ResolverFieldItem, type ResolverMetadata, type ResolverPromptConfig, type ResolverType, type ResponseMeta, type Sdk, type SdkContext, type SdkPage, type StaticResolver$1 as StaticResolver, type ValidResolvers, addPlugin, 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, defaultLogDeprecation, defineFormatter, defineHook, defineLegacyMerge, defineMethod, defineMethodOverride, definePlugin, defineProperty, defineResolver, disposeSdk, fromFunctionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCurrentDepth, getCurrentScope, getFieldDescriptions, getNegatable, getOutputSchema, getRegistryPlugin, getSchemaDescription, isCoreCancelledSignal, isCoreError, isCoreSignal, isNestedMethodCall, isPositional, isTelemetryNested, omitExports, openEnum, paginate, paginateBuffered, paginateMaxItems, resolvePlugin, runInMethodScope, runWithTelemetryContext, selectExports, splitPrefixedCursor, toIterable, toSnakeCase, toTitleCase, validateOptions, withOutputSchema, withPositional, withResolver };