@zapier/kitcore 0.8.0 → 0.10.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 +21 -0
- package/dist/index.cjs +598 -288
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +176 -83
- package/dist/index.d.ts +176 -83
- package/dist/index.mjs +593 -285
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -61,6 +61,83 @@ interface PaginatedSdkResult<TItem> extends Promise<SdkPage<TItem>> {
|
|
|
61
61
|
}
|
|
62
62
|
type PaginatedSdkFunction<TOptions, TItem> = (options: TOptions) => PaginatedSdkResult<TItem>;
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Per-call context threaded explicitly through the method boundary in place of
|
|
66
|
+
* ambient AsyncLocalStorage. It carries call identity, nesting depth, and a
|
|
67
|
+
* per-invocation annotation bag. Because it travels as data, correlation and
|
|
68
|
+
* nested-call dedup work without `async_hooks` — including in browsers, where
|
|
69
|
+
* the old ALS store was inert and nested calls all looked top-level.
|
|
70
|
+
*
|
|
71
|
+
* Framework-neutral: heads surface `callId` under their own name (e.g. a
|
|
72
|
+
* correlation id) and own their annotation field names.
|
|
73
|
+
*/
|
|
74
|
+
/**
|
|
75
|
+
* A private brand (a fresh `Symbol()`, never `Symbol.for`) makes a CallContext
|
|
76
|
+
* unforgeable: no outside code can name the symbol to synthesize an id-bearing
|
|
77
|
+
* context, and the brand never collides across bundled copies. This is the same
|
|
78
|
+
* unforgeability the `INTERNAL_CALL` sentinel relies on.
|
|
79
|
+
*/
|
|
80
|
+
declare const CALL_CONTEXT_BRAND: unique symbol;
|
|
81
|
+
interface CallContext {
|
|
82
|
+
/** Minted once at the root call; copied verbatim to every nested (child) call. */
|
|
83
|
+
callId: string | null;
|
|
84
|
+
/** 0 at the outermost call; `parent.depth + 1` for a delegated call. */
|
|
85
|
+
depth: number;
|
|
86
|
+
/**
|
|
87
|
+
* Per-invocation scratch space. Never forwarded to callees — a child call
|
|
88
|
+
* gets a fresh bag — so annotations describe one method's own invocation.
|
|
89
|
+
*/
|
|
90
|
+
annotations: Record<string, unknown>;
|
|
91
|
+
readonly [CALL_CONTEXT_BRAND]: true;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Method-call lifecycle hooks. Plugins contribute `onMethodStart` and/or
|
|
96
|
+
* `onMethodEnd` on their context; `buildHooks` composes contributions across
|
|
97
|
+
* plugins so multiple observers can coexist. Composition is right-additive
|
|
98
|
+
* (newer plugins fire after earlier ones); only opt-in methods built through
|
|
99
|
+
* `createPluginMethod` / `createPaginatedPluginMethod` trigger the hooks.
|
|
100
|
+
*/
|
|
101
|
+
interface OnMethodStartContext {
|
|
102
|
+
methodName: string;
|
|
103
|
+
args: unknown[];
|
|
104
|
+
isPaginated: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Depth of this method invocation in the SDK call tree. 0 = outermost
|
|
107
|
+
* (user-initiated) call; 1+ = called from inside another SDK method.
|
|
108
|
+
* Observers can use this to ignore nested calls if they only want
|
|
109
|
+
* top-level events.
|
|
110
|
+
*/
|
|
111
|
+
depth: number;
|
|
112
|
+
}
|
|
113
|
+
type OnMethodStart = (ctx: OnMethodStartContext) => void;
|
|
114
|
+
interface OnMethodEndContext {
|
|
115
|
+
methodName: string;
|
|
116
|
+
args: unknown[];
|
|
117
|
+
isPaginated: boolean;
|
|
118
|
+
depth: number;
|
|
119
|
+
durationMs: number;
|
|
120
|
+
error?: Error;
|
|
121
|
+
}
|
|
122
|
+
type OnMethodEnd = (ctx: OnMethodEndContext) => void;
|
|
123
|
+
interface MethodHooks {
|
|
124
|
+
onMethodStart?: OnMethodStart;
|
|
125
|
+
onMethodEnd?: OnMethodEnd;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Plugins with a required-parameter rename declare two schemas: a canonical one
|
|
130
|
+
* (new names only, carrying `.meta({ aliases })`) and a `z.union([canonical,
|
|
131
|
+
* deprecated])` for runtime input parsing (so callers passing old names still
|
|
132
|
+
* validate). The union has no object shape, so everything that reads parameter
|
|
133
|
+
* shape/requiredness — the registry projection, generated docs, and the
|
|
134
|
+
* resolution planner — must read the canonical variant, not the union.
|
|
135
|
+
*
|
|
136
|
+
* Convention: the FIRST union variant is the canonical schema. Every plugin
|
|
137
|
+
* that uses unions follows this; it's explicit and needs no extra metadata.
|
|
138
|
+
* Runtime validation still uses the full union; only shape reading canonicalizes.
|
|
139
|
+
*/
|
|
140
|
+
declare function canonicalInputSchema(schema: z.ZodSchema | undefined): z.ZodSchema | undefined;
|
|
64
141
|
interface FormattedItem {
|
|
65
142
|
title: string;
|
|
66
143
|
/**
|
|
@@ -157,8 +234,6 @@ type ListPromptConfig = PromptConfig & {
|
|
|
157
234
|
* - `filter` — no resolver uses it; transform values in `listItems` instead.
|
|
158
235
|
* - `validate`— validation is the resolver's top-level `validate`, which
|
|
159
236
|
* never routes through rendering (and gets `imports`).
|
|
160
|
-
* (The legacy `SchemaParameterResolver` still honors `default`/`filter`/
|
|
161
|
-
* `validate`, so the full `PromptConfig` stays for that path.)
|
|
162
237
|
*/
|
|
163
238
|
type ResolverPromptConfig = Omit<PromptConfig, "name" | "default" | "filter" | "validate">;
|
|
164
239
|
interface Resolver$1 {
|
|
@@ -338,40 +413,6 @@ declare function withPositional<T extends z.ZodType>(schema: T): T & {
|
|
|
338
413
|
declare function isPositional(schema: z.ZodType): boolean;
|
|
339
414
|
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]>;
|
|
340
415
|
|
|
341
|
-
/**
|
|
342
|
-
* Method-call lifecycle hooks. Plugins contribute `onMethodStart` and/or
|
|
343
|
-
* `onMethodEnd` on their context; `buildHooks` composes contributions across
|
|
344
|
-
* plugins so multiple observers can coexist. Composition is right-additive
|
|
345
|
-
* (newer plugins fire after earlier ones); only opt-in methods built through
|
|
346
|
-
* `createPluginMethod` / `createPaginatedPluginMethod` trigger the hooks.
|
|
347
|
-
*/
|
|
348
|
-
interface OnMethodStartContext {
|
|
349
|
-
methodName: string;
|
|
350
|
-
args: unknown[];
|
|
351
|
-
isPaginated: boolean;
|
|
352
|
-
/**
|
|
353
|
-
* Depth of this method invocation in the SDK call tree. 0 = outermost
|
|
354
|
-
* (user-initiated) call; 1+ = called from inside another SDK method.
|
|
355
|
-
* Observers can use this to ignore nested calls if they only want
|
|
356
|
-
* top-level events.
|
|
357
|
-
*/
|
|
358
|
-
depth: number;
|
|
359
|
-
}
|
|
360
|
-
type OnMethodStart = (ctx: OnMethodStartContext) => void;
|
|
361
|
-
interface OnMethodEndContext {
|
|
362
|
-
methodName: string;
|
|
363
|
-
args: unknown[];
|
|
364
|
-
isPaginated: boolean;
|
|
365
|
-
depth: number;
|
|
366
|
-
durationMs: number;
|
|
367
|
-
error?: Error;
|
|
368
|
-
}
|
|
369
|
-
type OnMethodEnd = (ctx: OnMethodEndContext) => void;
|
|
370
|
-
interface MethodHooks {
|
|
371
|
-
onMethodStart?: OnMethodStart;
|
|
372
|
-
onMethodEnd?: OnMethodEnd;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
416
|
/**
|
|
376
417
|
* Descriptive metadata a leaf carries for the registry / CLI / MCP / docs:
|
|
377
418
|
* description, categories, type, formatter, resolvers, etc.
|
|
@@ -394,10 +435,6 @@ interface LeafMetaFields {
|
|
|
394
435
|
itemType?: string;
|
|
395
436
|
returnType?: string;
|
|
396
437
|
outputSchema?: z.ZodSchema;
|
|
397
|
-
inputParameters?: Array<{
|
|
398
|
-
name: string;
|
|
399
|
-
schema: z.ZodSchema;
|
|
400
|
-
}>;
|
|
401
438
|
packages?: string[];
|
|
402
439
|
experimental?: boolean;
|
|
403
440
|
confirm?: "create-secret" | "delete";
|
|
@@ -571,12 +608,11 @@ interface DynamicResolver extends ResolverBase {
|
|
|
571
608
|
input: Record<string, unknown>;
|
|
572
609
|
}) => PromiseLike<unknown>;
|
|
573
610
|
/** Produce the candidate list. Behaves like an SDK list method: returns a
|
|
574
|
-
* paginated result (
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
*
|
|
578
|
-
*
|
|
579
|
-
* auto-resolution someday) is the `static` kind's job. */
|
|
611
|
+
* paginated result (the engine awaits the first page + `nextCursor`), never a
|
|
612
|
+
* bare array. `cursor` is the stateless re-entry hook for "load more": the
|
|
613
|
+
* engine awaits one page, carries `nextCursor`, and calls again with `cursor`.
|
|
614
|
+
* Required: a dynamic resolver IS a candidate-lister; a free-text field (with
|
|
615
|
+
* or without auto-resolution someday) is the `static` kind's job. */
|
|
580
616
|
listItems: (bag: {
|
|
581
617
|
imports: Record<string, unknown>;
|
|
582
618
|
input: Record<string, unknown>;
|
|
@@ -660,6 +696,27 @@ interface ObjectResolver extends ResolverBase {
|
|
|
660
696
|
input: Record<string, unknown>;
|
|
661
697
|
}) => PromiseLike<Record<string, Field>>;
|
|
662
698
|
definitions?: Record<string, Resolver>;
|
|
699
|
+
/** Open-ended entries whose keys aren't known up front (a `z.record`): the
|
|
700
|
+
* walk collects entries in an add/done loop, asking each entry's key (via
|
|
701
|
+
* `keys`, default a free-text string) then its value (via `values`), and
|
|
702
|
+
* assembling them onto the object alongside any fixed `properties`. The
|
|
703
|
+
* JSON-Schema `additionalProperties` analog. */
|
|
704
|
+
additionalKeys?: AdditionalKeys;
|
|
705
|
+
}
|
|
706
|
+
/** The open-keyed-entry spec for an {@link ObjectResolver.additionalKeys}. */
|
|
707
|
+
interface AdditionalKeys {
|
|
708
|
+
/** Resolver for each entry's key; defaults to a free-text string prompt. A
|
|
709
|
+
* `{ ref }` resolves against the object's `definitions`. */
|
|
710
|
+
keys?: Resolver | ResolverRef;
|
|
711
|
+
/** Resolver for each entry's value. A `{ ref }` resolves against the
|
|
712
|
+
* object's `definitions`. */
|
|
713
|
+
values: Resolver | ResolverRef;
|
|
714
|
+
minEntries?: number;
|
|
715
|
+
maxEntries?: number;
|
|
716
|
+
/** Coarse value types so a free-text key/value answer coerces (usually
|
|
717
|
+
* `"string"` for the key), the way `Field.valueType` does. */
|
|
718
|
+
keyValueType?: string;
|
|
719
|
+
valueValueType?: string;
|
|
663
720
|
}
|
|
664
721
|
/** A homogeneous list: each element resolves through `items`. */
|
|
665
722
|
interface ArrayResolver extends ResolverBase {
|
|
@@ -705,9 +762,9 @@ interface Formatter extends MethodAttachment {
|
|
|
705
762
|
}) => FormattedItem;
|
|
706
763
|
}
|
|
707
764
|
/** What a dynamic resolver's `listItems` yields: an SDK list-method result
|
|
708
|
-
* (
|
|
709
|
-
*
|
|
710
|
-
*
|
|
765
|
+
* (the engine awaits the first page + `nextCursor`), or a plain page / promise
|
|
766
|
+
* of one. No bare array and no scalar: it behaves like any other list method,
|
|
767
|
+
* and exact-match short-circuits live on `tryResolveFromSearch`. */
|
|
711
768
|
type ListItemsResult<TItem> = PaginatedSdkResult<TItem> | SdkPage<TItem> | Promise<SdkPage<TItem>>;
|
|
712
769
|
/** A bound object resolver's literal property: its resolver is already bound
|
|
713
770
|
* (or a `{ ref }` the CLI resolves against `definitions` at runtime). */
|
|
@@ -778,7 +835,8 @@ interface BoundDynamicResolver extends BoundResolverBase {
|
|
|
778
835
|
} | null>;
|
|
779
836
|
}
|
|
780
837
|
/** Keyed members: static `properties` (bound) or a `getProperties`-built
|
|
781
|
-
* (unbound) field map; `definitions` holds ref targets.
|
|
838
|
+
* (unbound) field map; `definitions` holds ref targets. `additionalKeys`
|
|
839
|
+
* carries open-ended entries (a `z.record`). */
|
|
782
840
|
interface BoundObjectResolver extends BoundResolverBase {
|
|
783
841
|
type: "object";
|
|
784
842
|
properties?: Record<string, BoundField>;
|
|
@@ -786,6 +844,17 @@ interface BoundObjectResolver extends BoundResolverBase {
|
|
|
786
844
|
getProperties?: (bag: {
|
|
787
845
|
input: Record<string, unknown>;
|
|
788
846
|
}) => PromiseLike<Record<string, Field>>;
|
|
847
|
+
additionalKeys?: BoundAdditionalKeys;
|
|
848
|
+
}
|
|
849
|
+
/** The bound form of {@link AdditionalKeys}: `keys`/`values` are bound (or a
|
|
850
|
+
* `{ ref }` into the object's `definitions`). */
|
|
851
|
+
interface BoundAdditionalKeys {
|
|
852
|
+
keys?: BoundResolver | ResolverRef;
|
|
853
|
+
values: BoundResolver | ResolverRef;
|
|
854
|
+
minEntries?: number;
|
|
855
|
+
maxEntries?: number;
|
|
856
|
+
keyValueType?: string;
|
|
857
|
+
valueValueType?: string;
|
|
789
858
|
}
|
|
790
859
|
/** A homogeneous list resolved through `items` (bound, or a ref into
|
|
791
860
|
* `definitions`). */
|
|
@@ -1193,9 +1262,18 @@ interface MethodEntry {
|
|
|
1193
1262
|
* `resolvePlugin` bind this; the surface and registry bind `value`. Absent
|
|
1194
1263
|
* on legacy graph entries (they bind `value`). */
|
|
1195
1264
|
internalValue?: (input: any) => any;
|
|
1265
|
+
/** Produce the import-facing twin for a given call context: with a context,
|
|
1266
|
+
* the twin mints a fresh child per invocation (callee inherits `callId`, sits
|
|
1267
|
+
* one level deeper); without one it is the parent-less `internalValue`.
|
|
1268
|
+
* `buildImports` binds this. Absent on legacy graph entries. */
|
|
1269
|
+
bindInternal?: (ctx?: CallContext) => (...args: any[]) => any;
|
|
1196
1270
|
chain: MiddlewareWrap[];
|
|
1197
1271
|
/** Carried from the descriptor for the registry / CLI / MCP / docs. */
|
|
1198
1272
|
inputSchema?: z.ZodType;
|
|
1273
|
+
/** When true, the method owns its input validation and the boundary passes it
|
|
1274
|
+
* through unparsed; carried so the controller skips its final `safeParse` too
|
|
1275
|
+
* (it still uses `inputSchema` to plan/prompt parameters). */
|
|
1276
|
+
skipInputValidation?: boolean;
|
|
1199
1277
|
meta?: LeafMeta;
|
|
1200
1278
|
/** Resolved output mode; the registry derives presentation from it. */
|
|
1201
1279
|
output?: NormalizedOutput;
|
|
@@ -1440,7 +1518,7 @@ interface CategoryDefinition {
|
|
|
1440
1518
|
/** Plural form of `title`. Auto-derived from the resolved title if omitted. */
|
|
1441
1519
|
titlePlural?: string;
|
|
1442
1520
|
}
|
|
1443
|
-
interface FunctionRegistryEntry
|
|
1521
|
+
interface FunctionRegistryEntry {
|
|
1444
1522
|
name: string;
|
|
1445
1523
|
/**
|
|
1446
1524
|
* Human-readable description of the function. Surfaced wherever the
|
|
@@ -1453,29 +1531,30 @@ interface FunctionRegistryEntry<TSdk = any> {
|
|
|
1453
1531
|
itemType?: string;
|
|
1454
1532
|
returnType?: string;
|
|
1455
1533
|
inputSchema?: z.ZodSchema;
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1534
|
+
/**
|
|
1535
|
+
* When true, the method owns its input validation and its boundary passes the
|
|
1536
|
+
* input through unparsed. The resolution controller reads this to skip its
|
|
1537
|
+
* final `safeParse` (it still uses `inputSchema` to plan/prompt parameters),
|
|
1538
|
+
* so a method routed through the controller isn't re-validated against a
|
|
1539
|
+
* schema it deliberately opts out of. Lifted off the materialized entry.
|
|
1540
|
+
*/
|
|
1541
|
+
skipInputValidation?: boolean;
|
|
1460
1542
|
outputSchema?: z.ZodSchema;
|
|
1461
1543
|
/**
|
|
1462
1544
|
* Ordered input keys the public surface projects onto positional arguments
|
|
1463
1545
|
* (the method's `positional` declaration). Absent when the method takes only
|
|
1464
1546
|
* the canonical single bag. Lifted off the materialized method entry by the
|
|
1465
|
-
* surface builder, like `
|
|
1547
|
+
* surface builder, like `resolvers` — a runtime projection, not
|
|
1466
1548
|
* descriptive meta.
|
|
1467
1549
|
*/
|
|
1468
1550
|
positional?: readonly string[];
|
|
1469
1551
|
categories: string[];
|
|
1470
|
-
resolvers?: Record<string, ResolverMetadata<TSdk, any, any>>;
|
|
1471
1552
|
/**
|
|
1472
|
-
* Per-parameter bound resolvers
|
|
1473
|
-
*
|
|
1474
|
-
*
|
|
1475
|
-
* entry. Additive bridge — populated for migrated `defineMethod` plugins; the
|
|
1476
|
-
* legacy `resolvers` field above stays the source for unmigrated ones.
|
|
1553
|
+
* Per-parameter bound resolvers (imports already captured, called with
|
|
1554
|
+
* `input` only, no sdk). Lifted off the materialized method entry by the
|
|
1555
|
+
* surface builder.
|
|
1477
1556
|
*/
|
|
1478
|
-
|
|
1557
|
+
resolvers?: Record<string, BoundResolver>;
|
|
1479
1558
|
packages?: string[];
|
|
1480
1559
|
/**
|
|
1481
1560
|
* True if the plugin is registered only in the experimental SDK
|
|
@@ -1509,8 +1588,8 @@ interface FunctionDeprecation {
|
|
|
1509
1588
|
/** User-facing deprecation message for why/how to migrate */
|
|
1510
1589
|
message: string;
|
|
1511
1590
|
}
|
|
1512
|
-
interface RegistryResult
|
|
1513
|
-
functions: FunctionRegistryEntry
|
|
1591
|
+
interface RegistryResult {
|
|
1592
|
+
functions: FunctionRegistryEntry[];
|
|
1514
1593
|
categories: {
|
|
1515
1594
|
key: string;
|
|
1516
1595
|
title: string;
|
|
@@ -1615,7 +1694,7 @@ type Sdk<T = {
|
|
|
1615
1694
|
}> = T & {
|
|
1616
1695
|
getRegistry(options?: {
|
|
1617
1696
|
package?: string;
|
|
1618
|
-
}): RegistryResult
|
|
1697
|
+
}): RegistryResult;
|
|
1619
1698
|
};
|
|
1620
1699
|
|
|
1621
1700
|
/**
|
|
@@ -2203,6 +2282,8 @@ declare function defineResolver<const TImports extends ImportsInput = readonly [
|
|
|
2203
2282
|
input: TInput;
|
|
2204
2283
|
}) => PromiseLike<Record<string, Field>>;
|
|
2205
2284
|
definitions?: Record<string, Resolver>;
|
|
2285
|
+
/** Open-ended entries whose keys aren't known up front (a `z.record`). */
|
|
2286
|
+
additionalKeys?: AdditionalKeys;
|
|
2206
2287
|
}): ObjectResolver;
|
|
2207
2288
|
declare function defineResolver(config: {
|
|
2208
2289
|
type: "array";
|
|
@@ -2683,7 +2764,7 @@ declare const dangerousContextPlugin: PropertyPlugin<"context", SdkContext>;
|
|
|
2683
2764
|
*/
|
|
2684
2765
|
declare const getRegistryPlugin: MethodPlugin<"getRegistry", {
|
|
2685
2766
|
package?: string | undefined;
|
|
2686
|
-
} | undefined, RegistryResult
|
|
2767
|
+
} | undefined, RegistryResult, readonly []> & LeafSummary<"kitcore", "getRegistry", readonly [PropertyPlugin<"context", SdkContext>]>;
|
|
2687
2768
|
|
|
2688
2769
|
/**
|
|
2689
2770
|
* The external escape-hatch key for an SDK's context. A Symbol,
|
|
@@ -2844,13 +2925,13 @@ type ControllerQuestion = {
|
|
|
2844
2925
|
path: ControllerPath;
|
|
2845
2926
|
message: string;
|
|
2846
2927
|
description?: string;
|
|
2847
|
-
/** Which container
|
|
2848
|
-
*
|
|
2849
|
-
* its fields are fetched
|
|
2850
|
-
*
|
|
2851
|
-
* needs nothing else; this is additive metadata for hosts
|
|
2852
|
-
* containers specially. */
|
|
2853
|
-
container: "array" | "object";
|
|
2928
|
+
/** Which container type this decision is about. `array`/`record` are the
|
|
2929
|
+
* add-another loops; `object` covers both the optional-object gate (fired
|
|
2930
|
+
* BEFORE its fields are fetched: `add` descends, `done` skips it) and the
|
|
2931
|
+
* optional-fields gate. A host that renders `message` + `actions`
|
|
2932
|
+
* generically needs nothing else; this is additive metadata for hosts
|
|
2933
|
+
* that render containers specially. */
|
|
2934
|
+
container: "array" | "object" | "record";
|
|
2854
2935
|
/** Object optionals gate only: the fields the `add` action would walk
|
|
2855
2936
|
* (key + display label + coarse value type), so a smart host can render
|
|
2856
2937
|
* them (or a form section) instead of a blind yes/no. Dumb hosts keep
|
|
@@ -2959,11 +3040,16 @@ interface ControllerState {
|
|
|
2959
3040
|
/** The path of the parameter (or nested field) currently being asked. */
|
|
2960
3041
|
current?: ControllerPath;
|
|
2961
3042
|
/** Which container decision the outstanding `collection` question is, when
|
|
2962
|
-
* `current` points at one
|
|
2963
|
-
*
|
|
2964
|
-
*
|
|
2965
|
-
*
|
|
2966
|
-
|
|
3043
|
+
* `current` points at one, named `<container>_<subject>`: `array_items` and
|
|
3044
|
+
* `record_entries` are the add/done loops; `object_optional` is whether to
|
|
3045
|
+
* provide an optional object at all (fired before its fields are fetched);
|
|
3046
|
+
* `object_optional_properties` is whether to fill that object's optional
|
|
3047
|
+
* fields. `record_key` marks the one bespoke record step (collecting an
|
|
3048
|
+
* entry's key); the value that follows is an ordinary leaf question with no
|
|
3049
|
+
* gate. Recorded explicitly so `step`'s handling never infers the decision
|
|
3050
|
+
* from value presence or resolver shape. Absent when `current` is a plain
|
|
3051
|
+
* leaf question. */
|
|
3052
|
+
gate?: "array_items" | "record_entries" | "record_key" | "object_optional" | "object_optional_properties";
|
|
2967
3053
|
/** Where pagination stands for the current dynamic leaf: coordinates only
|
|
2968
3054
|
* (cursor trail, generation), never items or live iterators — the page's
|
|
2969
3055
|
* items ride the ask's question. */
|
|
@@ -3190,7 +3276,7 @@ type FunctionSdk = {
|
|
|
3190
3276
|
* and `context.core`
|
|
3191
3277
|
* @param options.schema - optional Zod schema for input validation
|
|
3192
3278
|
*/
|
|
3193
|
-
declare function createFunction<TOptions, TResult, TSchemaOptions extends TOptions = TOptions>(coreFn: (options: TOptions) => Promise<TResult>, options: {
|
|
3279
|
+
declare function createFunction<TOptions, TResult, TSchemaOptions extends TOptions = TOptions>(coreFn: (options: TOptions, context?: CallContext) => Promise<TResult>, options: {
|
|
3194
3280
|
sdk: FunctionSdk;
|
|
3195
3281
|
schema?: z.ZodSchema<TSchemaOptions>;
|
|
3196
3282
|
name?: string;
|
|
@@ -3216,7 +3302,7 @@ type ItemType<TResult> = TResult extends {
|
|
|
3216
3302
|
declare function createPaginatedFunction<TUserOptions, TResponse, TItem = ItemType<TResponse>>(coreFn: (options: TUserOptions & {
|
|
3217
3303
|
cursor?: string;
|
|
3218
3304
|
pageSize?: number;
|
|
3219
|
-
}) => Promise<TResponse>, options: {
|
|
3305
|
+
}, context?: CallContext) => Promise<TResponse>, options: {
|
|
3220
3306
|
sdk: FunctionSdk;
|
|
3221
3307
|
schema?: z.ZodSchema<TUserOptions>;
|
|
3222
3308
|
name?: string;
|
|
@@ -3510,7 +3596,7 @@ declare abstract class CoreSignal extends Error {
|
|
|
3510
3596
|
* control-flow throw), as opposed to a real error. Survives the
|
|
3511
3597
|
* bundled/standalone kitcore split, where `instanceof CoreSignal` may not.
|
|
3512
3598
|
*/
|
|
3513
|
-
declare function isCoreSignal(value: unknown):
|
|
3599
|
+
declare function isCoreSignal(value: unknown): value is CoreSignal;
|
|
3514
3600
|
/**
|
|
3515
3601
|
* Thrown by `Controller.resolve` when the host cancels resolution (the answer
|
|
3516
3602
|
* callback returned `{ type: "cancel" }`). The lower-level `start`/`step`
|
|
@@ -3523,5 +3609,12 @@ declare class CoreCancelledSignal extends CoreSignal {
|
|
|
3523
3609
|
readonly code: "CANCELLED";
|
|
3524
3610
|
constructor(message?: string);
|
|
3525
3611
|
}
|
|
3612
|
+
/**
|
|
3613
|
+
* Cross-package-safe check for {@link CoreCancelledSignal}. Keys on the
|
|
3614
|
+
* signal brand + `code` rather than `instanceof`, so it recognizes a
|
|
3615
|
+
* cancel signal raised by a different copy of kitcore (e.g. one bundled
|
|
3616
|
+
* into a head vs. one installed standalone).
|
|
3617
|
+
*/
|
|
3618
|
+
declare function isCoreCancelledSignal(value: unknown): value is CoreCancelledSignal;
|
|
3526
3619
|
|
|
3527
|
-
export { type AdaptError, type AdaptErrorOptions, type AdaptPage, type AggregatePlugin, type ArrayResolver$1 as ArrayResolver, type AsyncContext, type BoundFormatter, type BoundResolver, CONTEXT, CORE_ERROR_SYMBOL, CORE_OPTIONS_ID, CORE_SIGNAL_SYMBOL, type CategoryDefinition, 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 HookPlugin, type LeafMeta, type LeafSummary, type LegacyMergePlugin, type LegacyPlugin, type ListItemsResult, type ListPromptConfig, 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, 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, isCoreError, isCoreSignal, isNestedMethodCall, isPositional, isTelemetryNested, omitExports, openEnum, paginate, paginateBuffered, paginateMaxItems, resolvePlugin, runInMethodScope, runWithTelemetryContext, selectExports, splitPrefixedCursor, toIterable, toSnakeCase, toTitleCase, validateOptions, withOutputSchema, withPositional, withResolver };
|
|
3620
|
+
export { type AdaptError, type AdaptErrorOptions, type AdaptPage, type AggregatePlugin, type ArrayResolver$1 as ArrayResolver, type AsyncContext, type BoundFormatter, type BoundResolver, CONTEXT, CORE_ERROR_SYMBOL, CORE_OPTIONS_ID, CORE_SIGNAL_SYMBOL, type CategoryDefinition, 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 HookPlugin, type LeafMeta, type LeafSummary, type LegacyMergePlugin, type LegacyPlugin, type ListItemsResult, type ListPromptConfig, 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 };
|