@zapier/zapier-sdk 0.78.0 → 0.80.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.
@@ -51,18 +51,20 @@ function buildRegistry({
51
51
  sdk,
52
52
  meta,
53
53
  formatters,
54
+ boundResolvers,
55
+ positional,
54
56
  packageFilter
55
57
  }) {
56
58
  const definitionsByKey = /* @__PURE__ */ new Map();
57
59
  const objectDeclaredKeys = /* @__PURE__ */ new Set();
58
60
  for (const m of Object.values(meta)) {
59
61
  for (const ref of m.categories ?? []) {
60
- const key = typeof ref === "string" ? ref : ref.key;
62
+ const key2 = typeof ref === "string" ? ref : ref.key;
61
63
  if (typeof ref === "object") {
62
- objectDeclaredKeys.add(key);
63
- definitionsByKey.set(key, resolveCategoryDefinition(ref));
64
- } else if (!objectDeclaredKeys.has(key)) {
65
- definitionsByKey.set(key, resolveCategoryDefinition(ref));
64
+ objectDeclaredKeys.add(key2);
65
+ definitionsByKey.set(key2, resolveCategoryDefinition(ref));
66
+ } else if (!objectDeclaredKeys.has(key2)) {
67
+ definitionsByKey.set(key2, resolveCategoryDefinition(ref));
66
68
  }
67
69
  }
68
70
  }
@@ -70,16 +72,16 @@ function buildRegistry({
70
72
  definitionsByKey.set("other", resolveCategoryDefinition("other"));
71
73
  }
72
74
  const knownCategories = Array.from(definitionsByKey.keys());
73
- const functions = Object.keys(meta).filter((key) => {
74
- const property = sdk[key];
75
+ const functions = Object.keys(meta).filter((key2) => {
76
+ const property = sdk[key2];
75
77
  if (typeof property === "function") return true;
76
- const [rootKey] = key.split(".");
78
+ const [rootKey] = key2.split(".");
77
79
  const rootProperty = sdk[rootKey];
78
80
  return typeof rootProperty === "object" && rootProperty !== null;
79
- }).map((key) => {
80
- const m = meta[key];
81
+ }).map((key2) => {
82
+ const m = meta[key2];
81
83
  return {
82
- name: key,
84
+ name: key2,
83
85
  description: m.description,
84
86
  type: m.type,
85
87
  itemType: m.itemType,
@@ -87,11 +89,13 @@ function buildRegistry({
87
89
  inputSchema: canonicalInputSchema(m.inputSchema),
88
90
  inputParameters: m.inputParameters,
89
91
  outputSchema: m.outputSchema,
92
+ positional: positional?.[key2],
90
93
  categories: (m.categories ?? []).map(
91
94
  (c) => typeof c === "string" ? c : c.key
92
95
  ),
93
96
  resolvers: m.resolvers,
94
- formatter: formatters?.[key],
97
+ boundResolvers: boundResolvers?.[key2],
98
+ formatter: formatters?.[key2],
95
99
  experimental: m.experimental,
96
100
  packages: m.packages,
97
101
  confirm: m.confirm ?? (m.type === "delete" ? "delete" : void 0),
@@ -129,8 +133,8 @@ function composeVoid(existing, added) {
129
133
  }
130
134
  function buildHooks(existing, added) {
131
135
  const result = {};
132
- const start = composeVoid(existing.onMethodStart, added.onMethodStart);
133
- if (start) result.onMethodStart = start;
136
+ const start2 = composeVoid(existing.onMethodStart, added.onMethodStart);
137
+ if (start2) result.onMethodStart = start2;
134
138
  const end = composeVoid(existing.onMethodEnd, added.onMethodEnd);
135
139
  if (end) result.onMethodEnd = end;
136
140
  return result;
@@ -763,11 +767,11 @@ var RESERVED_ROOT_KEYS = /* @__PURE__ */ new Set([
763
767
  "context",
764
768
  "getRegistry"
765
769
  ]);
766
- function hasOwn(obj, key) {
767
- return Object.prototype.hasOwnProperty.call(obj, key);
770
+ function hasOwn(obj, key2) {
771
+ return Object.prototype.hasOwnProperty.call(obj, key2);
768
772
  }
769
- function setOwn(target, key, value) {
770
- Object.defineProperty(target, key, {
773
+ function setOwn(target, key2, value) {
774
+ Object.defineProperty(target, key2, {
771
775
  value,
772
776
  enumerable: true,
773
777
  configurable: true,
@@ -779,31 +783,31 @@ function checkCollisions(target, source, kind, callerLabel, override) {
779
783
  checkRootKeyCollisions(target, Object.keys(source), override, callerLabel);
780
784
  return;
781
785
  }
782
- for (const key of Object.keys(source)) {
783
- if (!override && hasOwn(target, key)) {
786
+ for (const key2 of Object.keys(source)) {
787
+ if (!override && hasOwn(target, key2)) {
784
788
  throw new Error(
785
- `${callerLabel}: duplicate ${kind} "${key}". If the override is intentional, pass { override: true } in the options.`
789
+ `${callerLabel}: duplicate ${kind} "${key2}". If the override is intentional, pass { override: true } in the options.`
786
790
  );
787
791
  }
788
792
  }
789
793
  }
790
794
  function checkRootKeyCollisions(target, keys, override, callerLabel) {
791
- for (const key of keys) {
792
- if (RESERVED_ROOT_KEYS.has(key)) {
795
+ for (const key2 of keys) {
796
+ if (RESERVED_ROOT_KEYS.has(key2)) {
793
797
  throw new Error(
794
- `${callerLabel}: plugin attempted to register reserved root key "${key}". The SDK uses this key for its own accessor; rename the plugin's method.`
798
+ `${callerLabel}: plugin attempted to register reserved root key "${key2}". The SDK uses this key for its own accessor; rename the plugin's method.`
795
799
  );
796
800
  }
797
- if (!override && hasOwn(target, key)) {
801
+ if (!override && hasOwn(target, key2)) {
798
802
  throw new Error(
799
- `${callerLabel}: duplicate root key "${key}". If the override is intentional, pass { override: true } in the options.`
803
+ `${callerLabel}: duplicate root key "${key2}". If the override is intentional, pass { override: true } in the options.`
800
804
  );
801
805
  }
802
806
  }
803
807
  }
804
808
  function applyOwnProperties(target, source) {
805
- for (const key of Object.keys(source)) {
806
- setOwn(target, key, source[key]);
809
+ for (const key2 of Object.keys(source)) {
810
+ setOwn(target, key2, source[key2]);
807
811
  }
808
812
  }
809
813
  function createPluginAccumulator(initialProperties = {}, initialContext = {}) {
@@ -1051,8 +1055,8 @@ function normalizeImports(deps) {
1051
1055
  }
1052
1056
  function collectLeafMeta(config) {
1053
1057
  let meta;
1054
- for (const key of LEAF_META_KEYS) {
1055
- if (config[key] !== void 0) (meta ?? (meta = {}))[key] = config[key];
1058
+ for (const key2 of LEAF_META_KEYS) {
1059
+ if (config[key2] !== void 0) (meta ?? (meta = {}))[key2] = config[key2];
1056
1060
  }
1057
1061
  return meta;
1058
1062
  }
@@ -1075,12 +1079,66 @@ function defineMethod(config) {
1075
1079
  run: config.run
1076
1080
  };
1077
1081
  }
1082
+ function defineResolver(config) {
1083
+ const deps = normalizeImports(config.imports);
1084
+ const base = { imports: deps.plugins, importBindings: deps.bindings };
1085
+ const gates = {
1086
+ requireParameters: config.requireParameters
1087
+ };
1088
+ switch (config.type) {
1089
+ case "static":
1090
+ return {
1091
+ ...base,
1092
+ ...gates,
1093
+ type: "static",
1094
+ inputType: config.inputType,
1095
+ placeholder: config.placeholder
1096
+ };
1097
+ case "constant":
1098
+ return { ...base, ...gates, type: "constant", value: config.value };
1099
+ case "info":
1100
+ return { ...base, type: "info", text: config.text ?? "" };
1101
+ case "object":
1102
+ return {
1103
+ ...base,
1104
+ ...gates,
1105
+ type: "object",
1106
+ properties: config.properties,
1107
+ definitions: config.definitions,
1108
+ getProperties: config.getProperties
1109
+ };
1110
+ case "array":
1111
+ return {
1112
+ ...base,
1113
+ ...gates,
1114
+ type: "array",
1115
+ items: config.items,
1116
+ minItems: config.minItems,
1117
+ maxItems: config.maxItems,
1118
+ itemValueType: config.itemValueType,
1119
+ definitions: config.definitions
1120
+ };
1121
+ default:
1122
+ return {
1123
+ ...base,
1124
+ ...gates,
1125
+ type: "dynamic",
1126
+ inputType: config.inputType,
1127
+ placeholder: config.placeholder,
1128
+ getContext: config.getContext,
1129
+ listItems: config.listItems,
1130
+ prompt: config.prompt,
1131
+ tryResolveWithoutPrompt: config.tryResolveWithoutPrompt,
1132
+ tryResolveFromSearch: config.tryResolveFromSearch
1133
+ };
1134
+ }
1135
+ }
1078
1136
  function defineFormatter(config) {
1079
1137
  const deps = normalizeImports(config.imports);
1080
1138
  return {
1081
1139
  imports: deps.plugins,
1082
1140
  importBindings: deps.bindings,
1083
- fetchContext: config.fetchContext,
1141
+ getContext: config.getContext,
1084
1142
  format: config.format
1085
1143
  };
1086
1144
  }
@@ -1209,7 +1267,7 @@ function legacyGraphEntry(name, value, pluginMeta) {
1209
1267
  function adaptLegacyFormatter(legacy, sdk) {
1210
1268
  const legacyFetch = legacy.fetch;
1211
1269
  return {
1212
- fetchContext: legacyFetch ? async ({ items, input, context }) => {
1270
+ getContext: legacyFetch ? async ({ items, input, context }) => {
1213
1271
  let ctx = context;
1214
1272
  for (const item of items) {
1215
1273
  ctx = await legacyFetch(sdk, input, item, ctx);
@@ -1225,6 +1283,14 @@ function normalizeFormatter(entry, sdk) {
1225
1283
  const legacy = entry.meta?.formatter;
1226
1284
  return legacy ? adaptLegacyFormatter(legacy, sdk) : void 0;
1227
1285
  }
1286
+ function normalizeBoundResolvers(entry) {
1287
+ if (entry.pluginType !== "method") return void 0;
1288
+ return entry.resolvers;
1289
+ }
1290
+ function methodPositional(entry) {
1291
+ if (entry.pluginType !== "method") return void 0;
1292
+ return entry.positional;
1293
+ }
1228
1294
  function pluginEntryMeta(entry) {
1229
1295
  if (entry.pluginType === "method" && entry.meta) {
1230
1296
  return entry.inputSchema ? { ...entry.meta, inputSchema: entry.inputSchema } : entry.meta;
@@ -1245,11 +1311,24 @@ function buildSurfaceRegistry(context, packageFilter) {
1245
1311
  if (m) meta[binding] = m;
1246
1312
  }
1247
1313
  const formatters = {};
1314
+ const boundResolvers = {};
1315
+ const positional = {};
1248
1316
  for (const [binding, entry] of Object.entries(entries)) {
1249
1317
  const f = normalizeFormatter(entry, surface);
1250
1318
  if (f) formatters[binding] = f;
1251
- }
1252
- return buildRegistry({ sdk: surface, meta, formatters, packageFilter });
1319
+ const r = normalizeBoundResolvers(entry);
1320
+ if (r) boundResolvers[binding] = r;
1321
+ const p = methodPositional(entry);
1322
+ if (p) positional[binding] = p;
1323
+ }
1324
+ return buildRegistry({
1325
+ sdk: surface,
1326
+ meta,
1327
+ formatters,
1328
+ boundResolvers,
1329
+ positional,
1330
+ packageFilter
1331
+ });
1253
1332
  }
1254
1333
  var dangerousContextPlugin = {
1255
1334
  pluginType: "property",
@@ -1366,15 +1445,15 @@ function collectPlugins(root, materialized = /* @__PURE__ */ new Set()) {
1366
1445
  }
1367
1446
  return byId;
1368
1447
  }
1369
- function bindValue(target, key, entry) {
1448
+ function bindValue(target, key2, entry) {
1370
1449
  if (entry.pluginType === "property" && entry.getValue) {
1371
- Object.defineProperty(target, key, {
1450
+ Object.defineProperty(target, key2, {
1372
1451
  get: entry.getValue,
1373
1452
  enumerable: true,
1374
1453
  configurable: true
1375
1454
  });
1376
1455
  } else {
1377
- Object.defineProperty(target, key, {
1456
+ Object.defineProperty(target, key2, {
1378
1457
  value: entry.value,
1379
1458
  writable: true,
1380
1459
  enumerable: true,
@@ -1426,8 +1505,7 @@ function bindResolver(resolver, plugins) {
1426
1505
  case "static":
1427
1506
  return {
1428
1507
  type: "static",
1429
- requireParams: resolver.requireParams,
1430
- requireCapabilities: resolver.requireCapabilities,
1508
+ requireParameters: resolver.requireParameters,
1431
1509
  inputType: resolver.inputType,
1432
1510
  placeholder: resolver.placeholder
1433
1511
  };
@@ -1435,8 +1513,7 @@ function bindResolver(resolver, plugins) {
1435
1513
  return {
1436
1514
  type: "constant",
1437
1515
  value: resolver.value,
1438
- requireParams: resolver.requireParams,
1439
- requireCapabilities: resolver.requireCapabilities
1516
+ requireParameters: resolver.requireParameters
1440
1517
  };
1441
1518
  case "info":
1442
1519
  return { type: "info", text: resolver.text };
@@ -1444,24 +1521,24 @@ function bindResolver(resolver, plugins) {
1444
1521
  const imports = buildImports(plugins, resolver.importBindings);
1445
1522
  const bound = {
1446
1523
  type: "object",
1447
- requireParams: resolver.requireParams,
1448
- requireCapabilities: resolver.requireCapabilities
1524
+ requireParameters: resolver.requireParameters
1449
1525
  };
1450
1526
  if (resolver.properties)
1451
1527
  bound.properties = bindFields(resolver.properties, plugins);
1452
1528
  if (resolver.definitions)
1453
1529
  bound.definitions = bindDefinitions(resolver.definitions, plugins);
1454
- const { fetch: fetch2 } = resolver;
1455
- if (fetch2) bound.fetch = ({ params }) => fetch2({ imports, params });
1530
+ const { getProperties } = resolver;
1531
+ if (getProperties)
1532
+ bound.getProperties = ({ input }) => getProperties({ imports, input });
1456
1533
  return bound;
1457
1534
  }
1458
1535
  case "array": {
1459
1536
  const bound = {
1460
1537
  type: "array",
1461
- requireParams: resolver.requireParams,
1462
- requireCapabilities: resolver.requireCapabilities,
1538
+ requireParameters: resolver.requireParameters,
1463
1539
  minItems: resolver.minItems,
1464
1540
  maxItems: resolver.maxItems,
1541
+ itemValueType: resolver.itemValueType,
1465
1542
  items: isResolverRef(resolver.items) ? resolver.items : bindResolver(resolver.items, plugins)
1466
1543
  };
1467
1544
  if (resolver.definitions)
@@ -1472,17 +1549,26 @@ function bindResolver(resolver, plugins) {
1472
1549
  const imports = buildImports(plugins, resolver.importBindings);
1473
1550
  const bound = {
1474
1551
  type: "dynamic",
1475
- requireParams: resolver.requireParams,
1476
- requireCapabilities: resolver.requireCapabilities,
1552
+ requireParameters: resolver.requireParameters,
1477
1553
  inputType: resolver.inputType,
1478
1554
  placeholder: resolver.placeholder,
1479
1555
  prompt: resolver.prompt
1480
1556
  };
1481
- const { fetch: fetch2, tryResolveWithoutPrompt } = resolver;
1482
- if (fetch2)
1483
- bound.fetch = ({ params, search }) => fetch2({ imports, params, search });
1557
+ const {
1558
+ getContext: getContext2,
1559
+ listItems,
1560
+ tryResolveWithoutPrompt,
1561
+ tryResolveFromSearch
1562
+ } = resolver;
1563
+ if (getContext2)
1564
+ bound.getContext = ({ input }) => getContext2({ imports, input });
1565
+ if (listItems)
1566
+ bound.listItems = ({ input, context, search, cursor }) => listItems({ imports, input, context, search, cursor });
1484
1567
  if (tryResolveWithoutPrompt) {
1485
- bound.tryResolveWithoutPrompt = ({ params }) => tryResolveWithoutPrompt({ imports, params });
1568
+ bound.tryResolveWithoutPrompt = ({ input }) => tryResolveWithoutPrompt({ imports, input });
1569
+ }
1570
+ if (tryResolveFromSearch) {
1571
+ bound.tryResolveFromSearch = ({ input, search }) => tryResolveFromSearch({ imports, input, search });
1486
1572
  }
1487
1573
  return bound;
1488
1574
  }
@@ -1490,8 +1576,8 @@ function bindResolver(resolver, plugins) {
1490
1576
  }
1491
1577
  function bindFields(fields, plugins) {
1492
1578
  const out = {};
1493
- for (const [key, field] of Object.entries(fields)) {
1494
- out[key] = {
1579
+ for (const [key2, field] of Object.entries(fields)) {
1580
+ out[key2] = {
1495
1581
  ...field,
1496
1582
  resolver: isResolverRef(field.resolver) ? field.resolver : bindResolver(field.resolver, plugins)
1497
1583
  };
@@ -1500,17 +1586,17 @@ function bindFields(fields, plugins) {
1500
1586
  }
1501
1587
  function bindDefinitions(definitions, plugins) {
1502
1588
  const out = {};
1503
- for (const [key, def] of Object.entries(definitions)) {
1504
- out[key] = bindResolver(def, plugins);
1589
+ for (const [key2, def] of Object.entries(definitions)) {
1590
+ out[key2] = bindResolver(def, plugins);
1505
1591
  }
1506
1592
  return out;
1507
1593
  }
1508
1594
  function bindFormatter(formatter, plugins) {
1509
1595
  const imports = buildImports(plugins, formatter.importBindings);
1510
1596
  const bound = { format: formatter.format };
1511
- const { fetchContext } = formatter;
1512
- if (fetchContext)
1513
- bound.fetchContext = ({ items, input, context }) => fetchContext({ imports, items, input, context });
1597
+ const { getContext: getContext2 } = formatter;
1598
+ if (getContext2)
1599
+ bound.getContext = ({ items, input, context }) => getContext2({ imports, items, input, context });
1514
1600
  return bound;
1515
1601
  }
1516
1602
  function bindAttachments(descriptors, context) {
@@ -1558,6 +1644,7 @@ function runLegacyPass(descriptors, context) {
1558
1644
  const sdk = this ?? exports;
1559
1645
  const meta2 = {};
1560
1646
  const formatters = {};
1647
+ const boundResolvers = {};
1561
1648
  for (const [binding, id2] of Object.entries(context.surface)) {
1562
1649
  const entry = context.plugins[id2];
1563
1650
  if (!entry || entry.pluginType === "aggregate") continue;
@@ -1565,12 +1652,15 @@ function runLegacyPass(descriptors, context) {
1565
1652
  if (m) meta2[binding] = m;
1566
1653
  const f = normalizeFormatter(entry, sdk);
1567
1654
  if (f) formatters[binding] = f;
1655
+ const r = normalizeBoundResolvers(entry);
1656
+ if (r) boundResolvers[binding] = r;
1568
1657
  }
1569
1658
  Object.assign(meta2, context.meta);
1570
1659
  return buildRegistry({
1571
1660
  sdk,
1572
1661
  meta: meta2,
1573
1662
  formatters,
1663
+ boundResolvers,
1574
1664
  packageFilter: options?.package
1575
1665
  });
1576
1666
  };
@@ -1786,7 +1876,7 @@ function createSdk(root) {
1786
1876
  pluginSurface = {};
1787
1877
  bindValue(pluginSurface, plugin.name, plugins2[plugin.id]);
1788
1878
  }
1789
- for (const key of Object.keys(legacyExports)) context.surface[key] = key;
1879
+ for (const key2 of Object.keys(legacyExports)) context.surface[key2] = key2;
1790
1880
  if (plugin.pluginType === "aggregate") {
1791
1881
  recordExportSurface(context, plugin.exports);
1792
1882
  } else {
@@ -1856,6 +1946,756 @@ function addPlugin(sdk, plugin, options) {
1856
1946
  options ?? {}
1857
1947
  );
1858
1948
  }
1949
+ var CORE_SIGNAL_SYMBOL = Symbol.for("kitcore.signal");
1950
+ var CoreSignal = class extends Error {
1951
+ constructor(message) {
1952
+ super(message);
1953
+ Object.setPrototypeOf(this, new.target.prototype);
1954
+ Object.defineProperty(this, CORE_SIGNAL_SYMBOL, {
1955
+ value: true,
1956
+ enumerable: false,
1957
+ configurable: true,
1958
+ writable: false
1959
+ });
1960
+ }
1961
+ };
1962
+ function isCoreSignal(value) {
1963
+ return Boolean(
1964
+ value && typeof value === "object" && value[CORE_SIGNAL_SYMBOL] === true
1965
+ );
1966
+ }
1967
+ var CoreCancelledSignal = class extends CoreSignal {
1968
+ constructor(message = "resolution cancelled") {
1969
+ super(message);
1970
+ this.name = "CoreCancelledSignal";
1971
+ this.code = "CANCELLED";
1972
+ }
1973
+ };
1974
+ function unwrap(schema) {
1975
+ let inner = schema;
1976
+ let required = true;
1977
+ for (; ; ) {
1978
+ if (inner instanceof z.ZodOptional) {
1979
+ required = false;
1980
+ inner = inner._zod.def.innerType;
1981
+ } else if (inner instanceof z.ZodDefault) {
1982
+ required = false;
1983
+ inner = inner._zod.def.innerType;
1984
+ } else if (inner instanceof z.ZodNullable) {
1985
+ inner = inner._zod.def.innerType;
1986
+ } else {
1987
+ break;
1988
+ }
1989
+ }
1990
+ return { inner, required };
1991
+ }
1992
+ function valueTypeOf(inner) {
1993
+ if (inner instanceof z.ZodString) return "string";
1994
+ if (inner instanceof z.ZodNumber) return "number";
1995
+ if (inner instanceof z.ZodBoolean) return "boolean";
1996
+ if (inner instanceof z.ZodEnum) return "string";
1997
+ if (inner instanceof z.ZodArray) return "array";
1998
+ if (inner instanceof z.ZodObject) return "object";
1999
+ return void 0;
2000
+ }
2001
+ function staticChoicesOf(inner) {
2002
+ if (inner instanceof z.ZodEnum) {
2003
+ const values = inner.options;
2004
+ return values.map((value) => ({ label: value, value }));
2005
+ }
2006
+ return void 0;
2007
+ }
2008
+ function objectShape(schema) {
2009
+ const { inner } = schema ? unwrap(schema) : { inner: void 0 };
2010
+ if (inner instanceof z.ZodObject) {
2011
+ return inner.shape;
2012
+ }
2013
+ return void 0;
2014
+ }
2015
+ function topoOrder2(specs) {
2016
+ const byName = new Map(specs.map((s) => [s.name, s]));
2017
+ const ordered = [];
2018
+ const placed = /* @__PURE__ */ new Set();
2019
+ let progressed = true;
2020
+ while (ordered.length < specs.length && progressed) {
2021
+ progressed = false;
2022
+ for (const spec of specs) {
2023
+ if (placed.has(spec.name)) continue;
2024
+ const ready = spec.requires.every((r) => !byName.has(r) || placed.has(r));
2025
+ if (ready) {
2026
+ ordered.push(spec);
2027
+ placed.add(spec.name);
2028
+ progressed = true;
2029
+ }
2030
+ }
2031
+ }
2032
+ for (const spec of specs) if (!placed.has(spec.name)) ordered.push(spec);
2033
+ return ordered;
2034
+ }
2035
+ function planParameters(entry) {
2036
+ const shape = objectShape(entry.inputSchema);
2037
+ const resolvers = entry.boundResolvers ?? {};
2038
+ const names = shape ? Object.keys(shape) : Object.keys(resolvers);
2039
+ const specs = names.map((name) => {
2040
+ const field = shape?.[name];
2041
+ const { inner, required } = field ? unwrap(field) : { inner: void 0, required: false };
2042
+ const resolver = resolvers[name];
2043
+ return {
2044
+ name,
2045
+ required,
2046
+ valueType: inner ? valueTypeOf(inner) : void 0,
2047
+ staticChoices: inner ? staticChoicesOf(inner) : void 0,
2048
+ resolver,
2049
+ requires: resolver?.requireParameters ?? []
2050
+ };
2051
+ });
2052
+ return { parameters: topoOrder2(specs) };
2053
+ }
2054
+ function getAtPath(root, path) {
2055
+ let node = root;
2056
+ for (const seg of path) {
2057
+ if (node == null || typeof node !== "object") return void 0;
2058
+ node = node[seg];
2059
+ }
2060
+ return node;
2061
+ }
2062
+ function setAtPath(root, path, value) {
2063
+ let node = root;
2064
+ for (let i = 0; i < path.length - 1; i++) {
2065
+ const seg = path[i];
2066
+ if (node[seg] == null || typeof node[seg] !== "object") node[seg] = {};
2067
+ node = node[seg];
2068
+ }
2069
+ node[path[path.length - 1]] = value;
2070
+ }
2071
+ var key = (path) => path.join(".");
2072
+ function isSettled(state, path) {
2073
+ return state.settled.includes(key(path));
2074
+ }
2075
+ function settle(state, path) {
2076
+ const k = key(path);
2077
+ if (!state.settled.includes(k)) state.settled.push(k);
2078
+ }
2079
+ function clone(state) {
2080
+ return JSON.parse(JSON.stringify(state));
2081
+ }
2082
+ function coerce(leaf, raw) {
2083
+ if (typeof raw !== "string") return raw;
2084
+ if (leaf.valueType === "number") {
2085
+ const n = Number(raw);
2086
+ return raw.trim() !== "" && !Number.isNaN(n) ? n : raw;
2087
+ }
2088
+ if (leaf.valueType === "boolean") {
2089
+ if (raw === "true") return true;
2090
+ if (raw === "false") return false;
2091
+ }
2092
+ return raw;
2093
+ }
2094
+ async function validationError(leaf, value, state) {
2095
+ const context = await resolveContext(leaf, state.resolved);
2096
+ const config = leaf.resolver?.prompt?.({
2097
+ items: state.listing?.items ?? [],
2098
+ input: mergeInput(state.resolved, leaf.extraInput),
2099
+ context
2100
+ });
2101
+ if (!config?.validate) return null;
2102
+ const verdict = config.validate(value);
2103
+ if (verdict === true) return null;
2104
+ return typeof verdict === "string" ? verdict : `${leaf.name}: invalid value`;
2105
+ }
2106
+ function toChoice(c) {
2107
+ const label = "label" in c ? c.label : c.name;
2108
+ const hint = Array.isArray(c.hint) ? c.hint.join(", ") : c.hint;
2109
+ return { label, value: String(c.value), hint };
2110
+ }
2111
+ function isRef(r) {
2112
+ return typeof r === "object" && r !== null && "ref" in r;
2113
+ }
2114
+ function toLeaf(name, field, definitions) {
2115
+ let resolver;
2116
+ let extraInput;
2117
+ if (isRef(field.resolver)) {
2118
+ resolver = definitions?.[field.resolver.ref];
2119
+ extraInput = field.resolver.input;
2120
+ } else {
2121
+ resolver = field.resolver;
2122
+ }
2123
+ return {
2124
+ name,
2125
+ required: field.required ?? false,
2126
+ resolver,
2127
+ extraInput,
2128
+ // Carry the field's value type so nested answers coerce (number/boolean)
2129
+ // the same way top-level params do. Without this a nested `z.number()`
2130
+ // field's typed answer stays a string and fails final validation.
2131
+ valueType: field.valueType,
2132
+ requires: resolver?.requireParameters ?? []
2133
+ };
2134
+ }
2135
+ async function objectChildren(resolver, input) {
2136
+ if (resolver.properties) {
2137
+ return Object.entries(resolver.properties).map(
2138
+ ([name, field]) => toLeaf(name, field, resolver.definitions)
2139
+ );
2140
+ }
2141
+ if (!resolver.getProperties) return [];
2142
+ const fields = await resolver.getProperties({ input });
2143
+ return Object.entries(fields).map(([name, field]) => {
2144
+ if (!isRef(field.resolver) && (field.resolver.imports?.length ?? 0) > 0) {
2145
+ throw new Error(
2146
+ `dynamic object field "${name}" inlines an import-bearing resolver; use { ref } into the object's definitions so its imports bind`
2147
+ );
2148
+ }
2149
+ return toLeaf(name, field, resolver.definitions);
2150
+ });
2151
+ }
2152
+ function arrayItem(resolver) {
2153
+ const items = resolver.items;
2154
+ const valueType = resolver.itemValueType;
2155
+ if (isRef(items)) {
2156
+ return {
2157
+ name: "",
2158
+ required: true,
2159
+ resolver: resolver.definitions?.[items.ref],
2160
+ extraInput: items.input,
2161
+ valueType,
2162
+ requires: []
2163
+ };
2164
+ }
2165
+ return {
2166
+ name: "",
2167
+ required: true,
2168
+ resolver: items,
2169
+ valueType,
2170
+ requires: []
2171
+ };
2172
+ }
2173
+ function mergeInput(input, extra) {
2174
+ return extra ? { ...input, ...extra } : input;
2175
+ }
2176
+ async function childrenAt(ctx, path, resolved) {
2177
+ if (path.length === 0) return ctx.parameters;
2178
+ const leaf = await leafAt(ctx, path, resolved);
2179
+ if (!leaf?.resolver || leaf.resolver.type !== "object") return [];
2180
+ return objectChildren(leaf.resolver, mergeInput(resolved, leaf.extraInput));
2181
+ }
2182
+ async function leafAt(ctx, path, resolved) {
2183
+ let children = ctx.parameters;
2184
+ let leaf;
2185
+ for (let i = 0; i < path.length; i++) {
2186
+ const seg = path[i];
2187
+ if (typeof seg === "number") {
2188
+ if (leaf?.resolver?.type !== "array") return void 0;
2189
+ leaf = arrayItem(leaf.resolver);
2190
+ } else {
2191
+ leaf = children.find((c) => c.name === seg);
2192
+ if (!leaf) return void 0;
2193
+ }
2194
+ if (i < path.length - 1 && typeof path[i + 1] === "string") {
2195
+ if (leaf?.resolver?.type !== "object") return void 0;
2196
+ children = await objectChildren(
2197
+ leaf.resolver,
2198
+ mergeInput(resolved, leaf.extraInput)
2199
+ );
2200
+ }
2201
+ }
2202
+ return leaf;
2203
+ }
2204
+ async function arrayInfoAt(ctx, path, resolved) {
2205
+ const leaf = await leafAt(ctx, path, resolved);
2206
+ const resolver = leaf?.resolver;
2207
+ if (resolver?.type !== "array") {
2208
+ throw new Error(`expected an array resolver at "${key(path)}"`);
2209
+ }
2210
+ return {
2211
+ min: resolver.minItems ?? 0,
2212
+ max: resolver.maxItems ?? Infinity,
2213
+ item: { ...arrayItem(resolver), name: String(path[path.length - 1]) }
2214
+ };
2215
+ }
2216
+ var AFFORDANCE = {
2217
+ choose: { action: "choose", description: "Pick one of the listed options" },
2218
+ custom: {
2219
+ action: "custom",
2220
+ description: "Provide a value directly",
2221
+ supply: "value"
2222
+ },
2223
+ search: {
2224
+ action: "search",
2225
+ description: "Filter the options by a search term",
2226
+ supply: "term"
2227
+ },
2228
+ more: { action: "more", description: "Load more options" },
2229
+ skip: { action: "skip", description: "Omit this optional parameter" },
2230
+ add: { action: "add", description: "Add another item" },
2231
+ done: { action: "done", description: "Finish the list" },
2232
+ retry: { action: "retry", description: "Retry loading the options" },
2233
+ cancel: { action: "cancel", description: "Cancel resolution" }
2234
+ };
2235
+ async function firstPage(result) {
2236
+ const page = await result;
2237
+ return {
2238
+ data: Array.isArray(page?.data) ? page.data : [],
2239
+ nextCursor: page?.nextCursor
2240
+ };
2241
+ }
2242
+ async function resolveContext(leaf, input) {
2243
+ return leaf.resolver?.getContext?.({
2244
+ input: mergeInput(input, leaf.extraInput)
2245
+ });
2246
+ }
2247
+ async function fetchListing(leaf, input, opts = {}) {
2248
+ const page = await firstPage(
2249
+ leaf.resolver?.listItems?.({
2250
+ input: mergeInput(input, leaf.extraInput),
2251
+ context: opts.context,
2252
+ search: opts.search,
2253
+ cursor: opts.cursor
2254
+ })
2255
+ );
2256
+ return {
2257
+ items: [...opts.priorItems ?? [], ...page.data],
2258
+ cursor: page.nextCursor,
2259
+ search: opts.search,
2260
+ exhausted: page.nextCursor == null
2261
+ };
2262
+ }
2263
+ function selectActions(leaf, listing, multiple) {
2264
+ const actions = multiple ? [AFFORDANCE.choose] : [AFFORDANCE.choose, AFFORDANCE.custom];
2265
+ if (leaf.resolver?.inputType === "search") actions.push(AFFORDANCE.search);
2266
+ if (listing.cursor) actions.push(AFFORDANCE.more);
2267
+ if (!leaf.required) actions.push(AFFORDANCE.skip);
2268
+ return actions;
2269
+ }
2270
+ function selectQuestion(leaf, input, listing, context) {
2271
+ const config = leaf.resolver?.prompt?.({
2272
+ items: listing.items,
2273
+ input: mergeInput(input, leaf.extraInput),
2274
+ context
2275
+ });
2276
+ const multiple = config?.type === "checkbox";
2277
+ return {
2278
+ type: "select",
2279
+ message: config?.message ?? `Select ${leaf.name}:`,
2280
+ choices: (config?.choices ?? []).map(toChoice),
2281
+ ...multiple ? { multiple: true } : {},
2282
+ ...config?.notes?.length ? { notes: config.notes } : {},
2283
+ actions: selectActions(leaf, listing, multiple)
2284
+ };
2285
+ }
2286
+ function toControllerError(error) {
2287
+ if (error instanceof Error) {
2288
+ const code = error.code;
2289
+ return {
2290
+ name: error.name,
2291
+ message: error.message,
2292
+ ...typeof code === "string" ? { code } : {}
2293
+ };
2294
+ }
2295
+ return { name: "Error", message: String(error) };
2296
+ }
2297
+ function failedResult(state, name, error) {
2298
+ return {
2299
+ state,
2300
+ result: {
2301
+ status: "failed",
2302
+ error: toControllerError(error),
2303
+ question: {
2304
+ type: "select",
2305
+ message: `Could not load options for ${name}.`,
2306
+ choices: [],
2307
+ actions: [AFFORDANCE.retry, AFFORDANCE.cancel]
2308
+ }
2309
+ }
2310
+ };
2311
+ }
2312
+ async function buildQuestion(leaf, input) {
2313
+ const optional = !leaf.required;
2314
+ const resolver = leaf.resolver;
2315
+ if (resolver?.listItems) {
2316
+ const context = await resolveContext(leaf, input);
2317
+ const listing = await fetchListing(leaf, input, { context });
2318
+ return {
2319
+ question: selectQuestion(leaf, input, listing, context),
2320
+ listing
2321
+ };
2322
+ }
2323
+ if (leaf.staticChoices) {
2324
+ const actions2 = [AFFORDANCE.choose];
2325
+ if (optional) actions2.push(AFFORDANCE.skip);
2326
+ return {
2327
+ question: {
2328
+ type: "select",
2329
+ message: `Select ${leaf.name}:`,
2330
+ choices: leaf.staticChoices,
2331
+ actions: actions2
2332
+ }
2333
+ };
2334
+ }
2335
+ const inputType = resolver?.inputType && resolver.inputType !== "search" ? resolver.inputType : "text";
2336
+ const actions = [AFFORDANCE.custom];
2337
+ if (optional) actions.push(AFFORDANCE.skip);
2338
+ return {
2339
+ question: {
2340
+ type: "input",
2341
+ message: `Enter ${leaf.name}:`,
2342
+ inputType,
2343
+ placeholder: resolver?.placeholder,
2344
+ actions
2345
+ }
2346
+ };
2347
+ }
2348
+ function finalize(ctx, resolved) {
2349
+ if (!ctx.schema) return { status: "done", value: resolved };
2350
+ const parsed = ctx.schema.safeParse(resolved);
2351
+ if (parsed.success) {
2352
+ return { status: "done", value: parsed.data };
2353
+ }
2354
+ const issues = parsed.error.issues.map((i) => ({
2355
+ parameter: i.path.map(String).join(".") || void 0,
2356
+ message: i.message
2357
+ }));
2358
+ return { status: "invalid", issues };
2359
+ }
2360
+ function collectionQuestion(t) {
2361
+ const actions = [AFFORDANCE.add];
2362
+ if (t.count >= t.min) actions.push(AFFORDANCE.done);
2363
+ return {
2364
+ type: "collection",
2365
+ message: `Add another ${t.path[t.path.length - 1]}? (${t.count} so far)`,
2366
+ count: t.count,
2367
+ min: t.min,
2368
+ // An unbounded array's max is Infinity, which JSON.stringify turns to null;
2369
+ // omit it so the question round-trips across the wall as plain data.
2370
+ ...Number.isFinite(t.max) ? { max: t.max } : {},
2371
+ actions
2372
+ };
2373
+ }
2374
+ async function findInArray(ctx, state, path) {
2375
+ if (isSettled(state, path)) return null;
2376
+ if (getAtPath(state.resolved, path) == null)
2377
+ setAtPath(state.resolved, path, []);
2378
+ if (!state.interactive) {
2379
+ settle(state, path);
2380
+ return null;
2381
+ }
2382
+ const { min, max, item } = await arrayInfoAt(ctx, path, state.resolved);
2383
+ const items = getAtPath(state.resolved, path);
2384
+ const len = items.length;
2385
+ const itemType = item.resolver?.type;
2386
+ if (len > 0 && (itemType === "object" || itemType === "array")) {
2387
+ const inner = await findNext(ctx, state, [...path, len - 1]);
2388
+ if (inner) return inner;
2389
+ }
2390
+ if (len < min) return descendItem(ctx, state, path, len, item);
2391
+ if (len < max) return { kind: "array", path, count: len, min, max };
2392
+ settle(state, path);
2393
+ return null;
2394
+ }
2395
+ function seedItemSlot(state, itemPath, item) {
2396
+ const type = item.resolver?.type;
2397
+ if (type === "object") {
2398
+ setAtPath(state.resolved, itemPath, {});
2399
+ return "object";
2400
+ }
2401
+ if (type === "array") {
2402
+ setAtPath(state.resolved, itemPath, []);
2403
+ return "array";
2404
+ }
2405
+ return "leaf";
2406
+ }
2407
+ async function descendItem(ctx, state, arrayPath, index, item) {
2408
+ const itemPath = [...arrayPath, index];
2409
+ const kind = seedItemSlot(state, itemPath, item);
2410
+ if (kind === "object") return findNext(ctx, state, itemPath);
2411
+ if (kind === "array") return findInArray(ctx, state, itemPath);
2412
+ return { kind: "leaf", path: itemPath, leaf: item };
2413
+ }
2414
+ async function findNext(ctx, state, path = []) {
2415
+ const container = getAtPath(state.resolved, path) ?? {};
2416
+ for (const leaf of await childrenAt(ctx, path, state.resolved)) {
2417
+ const childPath = [...path, leaf.name];
2418
+ if (!leaf.requires.every((r) => container[r] !== void 0)) continue;
2419
+ if (leaf.resolver?.type === "object") {
2420
+ if (getAtPath(state.resolved, childPath) == null)
2421
+ setAtPath(state.resolved, childPath, {});
2422
+ const inner = await findNext(ctx, state, childPath);
2423
+ if (inner) return inner;
2424
+ continue;
2425
+ }
2426
+ if (leaf.resolver?.type === "array") {
2427
+ const inner = await findInArray(ctx, state, childPath);
2428
+ if (inner) return inner;
2429
+ continue;
2430
+ }
2431
+ if (container[leaf.name] !== void 0 || isSettled(state, childPath))
2432
+ continue;
2433
+ return { kind: "leaf", path: childPath, leaf };
2434
+ }
2435
+ return null;
2436
+ }
2437
+ async function askLeaf(state, path, leaf, opts = {}) {
2438
+ state.current = path;
2439
+ try {
2440
+ const { question, listing } = await buildQuestion(leaf, state.resolved);
2441
+ state.listing = listing;
2442
+ return {
2443
+ state,
2444
+ result: {
2445
+ status: "ask",
2446
+ question,
2447
+ ...opts.error ? { error: opts.error } : {}
2448
+ }
2449
+ };
2450
+ } catch (error) {
2451
+ state.listing = { items: [], exhausted: false };
2452
+ return failedResult(state, leaf.name, error);
2453
+ }
2454
+ }
2455
+ async function advance(ctx, state) {
2456
+ for (; ; ) {
2457
+ const target = await findNext(ctx, state);
2458
+ if (!target) {
2459
+ delete state.current;
2460
+ delete state.listing;
2461
+ return { state, result: finalize(ctx, state.resolved) };
2462
+ }
2463
+ if (target.kind === "array") {
2464
+ state.current = target.path;
2465
+ delete state.listing;
2466
+ return {
2467
+ state,
2468
+ result: { status: "ask", question: collectionQuestion(target) }
2469
+ };
2470
+ }
2471
+ const { path, leaf } = target;
2472
+ const auto = await leaf.resolver?.tryResolveWithoutPrompt?.({
2473
+ input: mergeInput(state.resolved, leaf.extraInput)
2474
+ });
2475
+ if (auto) {
2476
+ if (auto.resolvedValue !== void 0)
2477
+ setAtPath(state.resolved, path, auto.resolvedValue);
2478
+ settle(state, path);
2479
+ continue;
2480
+ }
2481
+ if (!state.interactive) {
2482
+ if (!leaf.required) {
2483
+ settle(state, path);
2484
+ continue;
2485
+ }
2486
+ } else if (!leaf.required && !leaf.resolver) {
2487
+ settle(state, path);
2488
+ continue;
2489
+ }
2490
+ return askLeaf(state, path, leaf);
2491
+ }
2492
+ }
2493
+ async function start(ctx, input = {}, interactive = true) {
2494
+ const resolved = {};
2495
+ for (const spec of ctx.parameters) {
2496
+ if (spec.resolver?.type === "constant")
2497
+ resolved[spec.name] = spec.resolver.value;
2498
+ }
2499
+ Object.assign(resolved, input);
2500
+ return advance(ctx, {
2501
+ method: ctx.method,
2502
+ resolved,
2503
+ settled: [],
2504
+ interactive
2505
+ });
2506
+ }
2507
+ async function step(ctx, prior, action) {
2508
+ const state = clone(prior);
2509
+ if (action.type === "cancel") {
2510
+ delete state.current;
2511
+ delete state.listing;
2512
+ return { state, result: { status: "cancelled" } };
2513
+ }
2514
+ const path = state.current;
2515
+ if (!path) throw new Error("step called with no outstanding question");
2516
+ const leaf = await leafAt(ctx, path, state.resolved);
2517
+ if (leaf && (action.type === "search" || action.type === "more" || action.type === "retry")) {
2518
+ return refine(ctx, state, leaf, path, action);
2519
+ }
2520
+ if (action.type === "add" || action.type === "done") {
2521
+ delete state.current;
2522
+ delete state.listing;
2523
+ if (action.type === "done") {
2524
+ settle(state, path);
2525
+ return advance(ctx, state);
2526
+ }
2527
+ const items = getAtPath(state.resolved, path) ?? [];
2528
+ const { item } = await arrayInfoAt(ctx, path, state.resolved);
2529
+ const itemPath = [...path, items.length];
2530
+ if (seedItemSlot(state, itemPath, item) === "leaf")
2531
+ return askLeaf(state, itemPath, item);
2532
+ return advance(ctx, state);
2533
+ }
2534
+ switch (action.type) {
2535
+ case "choose":
2536
+ case "custom": {
2537
+ if (leaf) {
2538
+ const error = await validationError(leaf, action.value, state);
2539
+ if (error) return askLeaf(state, path, leaf, { error });
2540
+ }
2541
+ setAtPath(
2542
+ state.resolved,
2543
+ path,
2544
+ leaf ? coerce(leaf, action.value) : action.value
2545
+ );
2546
+ break;
2547
+ }
2548
+ case "skip":
2549
+ settle(state, path);
2550
+ break;
2551
+ default:
2552
+ throw new Error(`action "${action.type}" is not supported here`);
2553
+ }
2554
+ delete state.current;
2555
+ delete state.listing;
2556
+ return advance(ctx, state);
2557
+ }
2558
+ async function refine(ctx, state, leaf, path, action) {
2559
+ const attempt = action.type === "search" ? { search: action.term, cursor: void 0, priorItems: [] } : {
2560
+ search: state.listing?.search,
2561
+ cursor: state.listing?.cursor,
2562
+ priorItems: state.listing?.items ?? []
2563
+ };
2564
+ try {
2565
+ if (action.type === "search") {
2566
+ const exact = await leaf.resolver?.tryResolveFromSearch?.({
2567
+ input: mergeInput(state.resolved, leaf.extraInput),
2568
+ search: action.term
2569
+ });
2570
+ if (exact) {
2571
+ setAtPath(state.resolved, path, coerce(leaf, exact.resolvedValue));
2572
+ delete state.current;
2573
+ delete state.listing;
2574
+ return advance(ctx, state);
2575
+ }
2576
+ }
2577
+ const context = await resolveContext(leaf, state.resolved);
2578
+ state.listing = await fetchListing(leaf, state.resolved, {
2579
+ ...attempt,
2580
+ context
2581
+ });
2582
+ return {
2583
+ state,
2584
+ result: {
2585
+ status: "ask",
2586
+ question: selectQuestion(leaf, state.resolved, state.listing, context)
2587
+ }
2588
+ };
2589
+ } catch (error) {
2590
+ state.listing = {
2591
+ items: attempt.priorItems,
2592
+ search: attempt.search,
2593
+ cursor: attempt.cursor,
2594
+ exhausted: false
2595
+ };
2596
+ return failedResult(state, leaf.name, error);
2597
+ }
2598
+ }
2599
+ function toJsonSchema(schema) {
2600
+ if (!schema) return void 0;
2601
+ try {
2602
+ return z.toJSONSchema(schema);
2603
+ } catch {
2604
+ return void 0;
2605
+ }
2606
+ }
2607
+ function projectSummary(entry) {
2608
+ return {
2609
+ name: entry.name,
2610
+ ...entry.description ? { description: entry.description } : {},
2611
+ ...entry.categories?.length ? { categories: entry.categories } : {}
2612
+ };
2613
+ }
2614
+ function projectMethod(entry) {
2615
+ const inputProperties = toJsonSchema(entry.inputSchema)?.properties;
2616
+ const parameters = {};
2617
+ for (const spec of planParameters(entry).parameters) {
2618
+ parameters[spec.name] = {
2619
+ required: spec.required,
2620
+ dynamic: Boolean(spec.resolver?.listItems),
2621
+ ...spec.resolver?.inputType === "search" ? { searchable: true } : {},
2622
+ ...inputProperties?.[spec.name] ? { schema: inputProperties[spec.name] } : {},
2623
+ ...spec.staticChoices ? { choices: spec.staticChoices } : {},
2624
+ ...spec.requires.length ? { requireParameters: spec.requires } : {}
2625
+ };
2626
+ }
2627
+ const output = toJsonSchema(entry.outputSchema);
2628
+ return {
2629
+ name: entry.name,
2630
+ ...entry.description ? { description: entry.description } : {},
2631
+ ...entry.categories?.length ? { categories: entry.categories } : {},
2632
+ parameters,
2633
+ ...entry.positional?.length ? { positional: entry.positional } : {},
2634
+ ...output ? { output } : {}
2635
+ };
2636
+ }
2637
+ function createController(sdk) {
2638
+ function entryFor(method) {
2639
+ const entry = sdk.getRegistry().functions.find((f) => f.name === method);
2640
+ if (!entry) throw new Error(`unknown method "${method}"`);
2641
+ return entry;
2642
+ }
2643
+ function contextFor(method) {
2644
+ const entry = entryFor(method);
2645
+ return {
2646
+ method,
2647
+ schema: entry.inputSchema,
2648
+ parameters: planParameters(entry).parameters
2649
+ };
2650
+ }
2651
+ const start2 = ({ method, input, interactive }) => start(contextFor(method), input, interactive);
2652
+ const step2 = ({ state, action }) => step(contextFor(state.method), state, action);
2653
+ const resolve2 = async ({
2654
+ method,
2655
+ input,
2656
+ answer,
2657
+ interactive
2658
+ }) => {
2659
+ const ctx = contextFor(method);
2660
+ let { state, result } = await start(ctx, input, interactive);
2661
+ while (result.status === "ask" || result.status === "failed") {
2662
+ const action = await answer({ state, result });
2663
+ ({ state, result } = await step(ctx, state, action));
2664
+ }
2665
+ if (result.status === "done") return result.value;
2666
+ if (result.status === "cancelled") {
2667
+ throw new CoreCancelledSignal(`resolution cancelled for "${method}"`);
2668
+ }
2669
+ const detail = result.issues.map((i) => i.parameter ? `${i.parameter}: ${i.message}` : i.message).join("; ");
2670
+ throw new Error(`invalid input for "${method}": ${detail}`);
2671
+ };
2672
+ const listMethods = () => ({
2673
+ data: sdk.getRegistry().functions.map(projectSummary)
2674
+ });
2675
+ const getMethod = ({ method }) => ({
2676
+ data: projectMethod(entryFor(method))
2677
+ });
2678
+ const listChoices = async ({
2679
+ method,
2680
+ parameter,
2681
+ input = {},
2682
+ search,
2683
+ cursor
2684
+ }) => {
2685
+ const spec = contextFor(method).parameters.find(
2686
+ (p) => p.name === parameter
2687
+ );
2688
+ if (!spec?.resolver?.listItems) return { data: [] };
2689
+ const context = await spec.resolver.getContext?.({ input });
2690
+ const page = await firstPage(
2691
+ spec.resolver.listItems({ input, context, search, cursor })
2692
+ );
2693
+ const config = spec.resolver.prompt?.({ items: page.data, input, context });
2694
+ const data = (config?.choices ?? []).map(toChoice);
2695
+ return { data, nextCursor: page.nextCursor };
2696
+ };
2697
+ return { resolve: resolve2, start: start2, step: step2, listMethods, getMethod, listChoices };
2698
+ }
1859
2699
  function createCorePlugin(options) {
1860
2700
  return () => ({
1861
2701
  context: {
@@ -2823,8 +3663,8 @@ function normalizeHeaders(optionsHeaders) {
2823
3663
  return headers;
2824
3664
  }
2825
3665
  const headerEntries = optionsHeaders instanceof Headers ? Array.from(optionsHeaders.entries()) : Array.isArray(optionsHeaders) ? optionsHeaders : Object.entries(optionsHeaders);
2826
- for (const [key, value] of headerEntries) {
2827
- headers[key] = value;
3666
+ for (const [key2, value] of headerEntries) {
3667
+ headers[key2] = value;
2828
3668
  }
2829
3669
  return headers;
2830
3670
  }
@@ -3114,28 +3954,28 @@ function censorHeaders(headers) {
3114
3954
  if (!headers) return headers;
3115
3955
  const headersObj = new Headers(headers);
3116
3956
  const authKeys = ["authorization", "x-api-key"];
3117
- for (const [key, value] of headersObj.entries()) {
3118
- if (authKeys.some((authKey) => key.toLowerCase() === authKey)) {
3957
+ for (const [key2, value] of headersObj.entries()) {
3958
+ if (authKeys.some((authKey) => key2.toLowerCase() === authKey)) {
3119
3959
  const spaceIndex = value.indexOf(" ");
3120
3960
  if (spaceIndex > 0 && spaceIndex < value.length - 1) {
3121
3961
  const prefix = value.substring(0, spaceIndex + 1);
3122
3962
  const token = value.substring(spaceIndex + 1);
3123
3963
  if (token.length > 12) {
3124
- const start = token.substring(0, 4);
3964
+ const start2 = token.substring(0, 4);
3125
3965
  const end = token.substring(token.length - 4);
3126
- headersObj.set(key, `${prefix}${start}...${end}`);
3966
+ headersObj.set(key2, `${prefix}${start2}...${end}`);
3127
3967
  } else {
3128
3968
  const firstChar = token.charAt(0);
3129
- headersObj.set(key, `${prefix}${firstChar}...`);
3969
+ headersObj.set(key2, `${prefix}${firstChar}...`);
3130
3970
  }
3131
3971
  } else {
3132
3972
  if (value.length > 12) {
3133
- const start = value.substring(0, 4);
3973
+ const start2 = value.substring(0, 4);
3134
3974
  const end = value.substring(value.length - 4);
3135
- headersObj.set(key, `${start}...${end}`);
3975
+ headersObj.set(key2, `${start2}...${end}`);
3136
3976
  } else {
3137
3977
  const firstChar = value.charAt(0);
3138
- headersObj.set(key, `${firstChar}...`);
3978
+ headersObj.set(key2, `${firstChar}...`);
3139
3979
  }
3140
3980
  }
3141
3981
  }
@@ -3704,21 +4544,21 @@ function getClientIdFromCredentials(credentials) {
3704
4544
  function createMemoryCache() {
3705
4545
  const store = /* @__PURE__ */ new Map();
3706
4546
  return {
3707
- async get(key) {
3708
- const entry = store.get(key);
4547
+ async get(key2) {
4548
+ const entry = store.get(key2);
3709
4549
  if (!entry) return void 0;
3710
4550
  if (entry.expiresAt !== void 0 && entry.expiresAt <= Date.now()) {
3711
- store.delete(key);
4551
+ store.delete(key2);
3712
4552
  return void 0;
3713
4553
  }
3714
4554
  return { value: entry.value, expiresAt: entry.expiresAt };
3715
4555
  },
3716
- async set(key, value, options) {
4556
+ async set(key2, value, options) {
3717
4557
  const expiresAt = options?.ttl ? Date.now() + options.ttl * 1e3 : void 0;
3718
- store.set(key, { value, expiresAt });
4558
+ store.set(key2, { value, expiresAt });
3719
4559
  },
3720
- async delete(key) {
3721
- store.delete(key);
4560
+ async delete(key2) {
4561
+ store.delete(key2);
3722
4562
  }
3723
4563
  };
3724
4564
  }
@@ -4209,14 +5049,14 @@ function createSseParserStream() {
4209
5049
  transform(chunk, controller) {
4210
5050
  buffer += chunk;
4211
5051
  const newline = /\r\n|\r|\n/g;
4212
- let start = 0;
5052
+ let start2 = 0;
4213
5053
  let match;
4214
5054
  while ((match = newline.exec(buffer)) !== null) {
4215
5055
  if (match[0] === "\r" && match.index === buffer.length - 1) break;
4216
- processLine(buffer.slice(start, match.index), controller);
4217
- start = match.index + match[0].length;
5056
+ processLine(buffer.slice(start2, match.index), controller);
5057
+ start2 = match.index + match[0].length;
4218
5058
  }
4219
- buffer = buffer.slice(start);
5059
+ buffer = buffer.slice(start2);
4220
5060
  },
4221
5061
  flush(controller) {
4222
5062
  if (buffer.endsWith("\r")) {
@@ -4318,8 +5158,63 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
4318
5158
  }
4319
5159
  }
4320
5160
 
5161
+ // src/api/deprecation.ts
5162
+ var DEPRECATION_MESSAGE_HEADER = "zapier-sdk-deprecation-message";
5163
+ var DEPRECATION_ID_HEADER = "zapier-sdk-deprecation-id";
5164
+ var DEPRECATION_NOTICE_EVENT = "api:deprecation_notice";
5165
+ var displayedNoticeIds = /* @__PURE__ */ new Set();
5166
+ function handleDeprecationNotice({
5167
+ response,
5168
+ canSendDeprecationMessaging,
5169
+ onEvent
5170
+ }) {
5171
+ try {
5172
+ sniffDeprecationNotice({ response, canSendDeprecationMessaging, onEvent });
5173
+ } catch {
5174
+ }
5175
+ }
5176
+ function sniffDeprecationNotice({
5177
+ response,
5178
+ canSendDeprecationMessaging,
5179
+ onEvent
5180
+ }) {
5181
+ if (!canSendDeprecationMessaging) return;
5182
+ const message = response.headers?.get(DEPRECATION_MESSAGE_HEADER);
5183
+ if (!message) return;
5184
+ const id = response.headers.get(DEPRECATION_ID_HEADER) ?? message;
5185
+ if (!displayedNoticeIds.has(id)) {
5186
+ displayedNoticeIds.add(id);
5187
+ console.warn(`[zapier-sdk] Deprecation: ${message}`);
5188
+ }
5189
+ if (onEvent) {
5190
+ const payload = { id, message };
5191
+ const deprecation = parseDeprecationDate(
5192
+ response.headers.get("deprecation")
5193
+ );
5194
+ if (deprecation !== void 0) payload.deprecation = deprecation;
5195
+ const maybePromise = onEvent({
5196
+ type: DEPRECATION_NOTICE_EVENT,
5197
+ payload: { ...payload },
5198
+ timestamp: Date.now()
5199
+ });
5200
+ if (isPromiseLike(maybePromise)) {
5201
+ void Promise.resolve(maybePromise).catch(() => {
5202
+ });
5203
+ }
5204
+ }
5205
+ }
5206
+ function isPromiseLike(value) {
5207
+ return (typeof value === "object" || typeof value === "function") && value !== null && "then" in value && typeof value.then === "function";
5208
+ }
5209
+ function parseDeprecationDate(value) {
5210
+ if (!value) return void 0;
5211
+ const match = /^@(-?\d+)$/.exec(value.trim());
5212
+ if (!match) return void 0;
5213
+ return Number(match[1]) * 1e3;
5214
+ }
5215
+
4321
5216
  // src/sdk-version.ts
4322
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.78.0" : void 0) || "unknown";
5217
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.80.0" : void 0) || "unknown";
4323
5218
 
4324
5219
  // src/utils/open-url.ts
4325
5220
  var nodePrefix = "node:";
@@ -4431,6 +5326,30 @@ var PollApprovalResponseSchema = z.object({
4431
5326
  reason: z.string().optional()
4432
5327
  });
4433
5328
  var APPROVAL_MAX_POLLING_INTERVAL_MS = 5e3;
5329
+ function validateSdkPath(path) {
5330
+ if (!path.startsWith("/") || path.startsWith("//")) {
5331
+ throw new ZapierValidationError(
5332
+ `fetch expects a path starting with a single '/', got: ${path}`
5333
+ );
5334
+ }
5335
+ }
5336
+ function findPathConfigEntries({
5337
+ path,
5338
+ matchResolvedGatewayPath = false
5339
+ }) {
5340
+ const pathSegments = path.split("/").filter(Boolean);
5341
+ return Object.entries(pathConfig).filter(([configPath, config]) => {
5342
+ if (!matchResolvedGatewayPath) {
5343
+ return path === configPath || path.startsWith(`${configPath}/`);
5344
+ }
5345
+ const prefixSegments = (config.pathPrefix ?? configPath).split("/").filter(Boolean);
5346
+ return pathSegments.some(
5347
+ (_, startIndex) => prefixSegments.every(
5348
+ (segment, offset) => pathSegments[startIndex + offset] === segment
5349
+ )
5350
+ );
5351
+ }).map(([configPath, config]) => ({ configPath, config }));
5352
+ }
4434
5353
  function parseRateLimitHeaders(response) {
4435
5354
  const info = {};
4436
5355
  const retryAfter = response.headers.get("retry-after");
@@ -4475,8 +5394,18 @@ var pathConfig = {
4475
5394
  // e.g. /relay -> https://sdkapi.zapier.com/api/v0/sdk/relay/...
4476
5395
  "/relay": {
4477
5396
  authHeader: "X-Relay-Authorization",
4478
- pathPrefix: "/api/v0/sdk/relay"
5397
+ pathPrefix: "/api/v0/sdk/relay",
5398
+ omitDeprecationMessaging: true
5399
+ },
5400
+ // The concrete gateway form of the relay route. Callers that pass the
5401
+ // already-prefixed path reach the same third-party upstreams, so it must
5402
+ // classify as relay too; without this entry it would match nothing and
5403
+ // sniff deprecation headers off a relay response.
5404
+ "/api/v0/sdk/relay": {
5405
+ omitDeprecationMessaging: true
4479
5406
  },
5407
+ // Concrete sdkapi routes that do not live behind /api/v0/sdk/<service>.
5408
+ "/api/v0": {},
4480
5409
  // e.g. /zapier -> https://sdkapi.zapier.com/api/v0/sdk/zapier/...
4481
5410
  "/zapier": {
4482
5411
  authHeader: "Authorization",
@@ -4531,11 +5460,11 @@ var ZapierApiClient = class {
4531
5460
  );
4532
5461
  const inputHeaders = new Headers(init?.headers ?? {});
4533
5462
  const mergedHeaders = new Headers();
4534
- builtHeaders.forEach((value, key) => {
4535
- mergedHeaders.set(key, value);
5463
+ builtHeaders.forEach((value, key2) => {
5464
+ mergedHeaders.set(key2, value);
4536
5465
  });
4537
- inputHeaders.forEach((value, key) => {
4538
- mergedHeaders.set(key, value);
5466
+ inputHeaders.forEach((value, key2) => {
5467
+ mergedHeaders.set(key2, value);
4539
5468
  });
4540
5469
  this.applyTelemetryHeaders(mergedHeaders);
4541
5470
  let retries = 0;
@@ -4625,17 +5554,50 @@ var ZapierApiClient = class {
4625
5554
  * parallelism into the queue.
4626
5555
  */
4627
5556
  this.rawFetch = async (path, init) => {
4628
- if (!path.startsWith("/")) {
4629
- throw new ZapierValidationError(
4630
- `fetch expects a path starting with '/', got: ${path}`
4631
- );
4632
- }
5557
+ validateSdkPath(path);
4633
5558
  const { url, pathConfig: pathConfig2 } = this.buildUrl(path, init?.searchParams);
4634
5559
  return this.withSemaphore(
4635
5560
  { url, method: init?.method ?? "GET", signal: init?.signal },
4636
5561
  () => this.rawFetchUrl(url, init, pathConfig2)
4637
5562
  );
4638
5563
  };
5564
+ this.runApprovalFetchLoop = async ({
5565
+ path,
5566
+ init,
5567
+ maxRetries,
5568
+ approvalMode,
5569
+ approvalContext
5570
+ }) => {
5571
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
5572
+ const response = await this.rawFetch(path, init);
5573
+ if (response.status !== 403) {
5574
+ return { response };
5575
+ }
5576
+ const errorType = response.headers.get("x-zapier-error-type");
5577
+ if (errorType !== "approval_required") {
5578
+ return { response };
5579
+ }
5580
+ if (attempt === maxRetries) {
5581
+ return { response };
5582
+ }
5583
+ if (approvalMode === "disabled") {
5584
+ return { response };
5585
+ }
5586
+ if (!approvalContext) {
5587
+ return { response };
5588
+ }
5589
+ try {
5590
+ await this.runOneApprovalRound(
5591
+ approvalContext,
5592
+ approvalMode,
5593
+ init?.signal ?? void 0
5594
+ );
5595
+ } catch (error) {
5596
+ return { response, approvalRoundError: error };
5597
+ }
5598
+ }
5599
+ throw new ZapierApiError("Approval retry loop ended unexpectedly");
5600
+ };
4639
5601
  /**
4640
5602
  * Approval-aware HTTP fetch.
4641
5603
  *
@@ -4665,46 +5627,62 @@ var ZapierApiClient = class {
4665
5627
  * `max_retries_exceeded` instead.
4666
5628
  */
4667
5629
  this.fetch = async (path, init) => {
5630
+ validateSdkPath(path);
4668
5631
  const maxRetries = this.options.maxApprovalRetries ?? DEFAULT_MAX_APPROVAL_RETRIES;
4669
- for (let attempt = 0; attempt <= maxRetries; attempt++) {
4670
- const response = await this.rawFetch(path, init);
4671
- if (response.status !== 403) return response;
4672
- const errorType = response.headers.get("x-zapier-error-type");
4673
- if (errorType === "request_denied_by_policy") {
4674
- const { data } = await this.parseResult(response);
4675
- const { message, errors } = this.parseErrorResponse({
4676
- status: response.status,
4677
- statusText: response.statusText,
4678
- data
4679
- });
4680
- throw new ZapierApprovalError(
4681
- message || "Request explicitly denied by policy",
4682
- {
4683
- status: "policy_denied",
4684
- statusCode: response.status,
4685
- errors
4686
- }
4687
- );
4688
- }
4689
- if (errorType !== "approval_required") return response;
4690
- if (attempt === maxRetries) break;
4691
- const mode = this.options.approvalMode ?? getZapierApprovalMode() ?? getZapierDefaultApprovalMode();
4692
- if (mode === "disabled") {
4693
- throw new ZapierApprovalError(
4694
- "Approvals are disabled. Set approvalMode to 'poll' or 'throw' (or ZAPIER_APPROVAL_MODE) to enable.",
4695
- { status: "approval_required" }
4696
- );
4697
- }
4698
- if (!init?.approvalContext) {
4699
- throw new ZapierApiError(
4700
- `Received 403 approval_required for ${path}, but the caller did not provide an approvalContext builder. Every approval-capable request must pass approvalContext so the SDK can create the approval with the correct policy context.`,
4701
- { statusCode: 403 }
4702
- );
4703
- }
4704
- await this.runOneApprovalRound(
4705
- init.approvalContext,
4706
- mode,
4707
- init.signal ?? void 0
5632
+ const { canSendDeprecationMessaging } = this.buildUrl(
5633
+ path,
5634
+ init?.searchParams
5635
+ );
5636
+ const approvalMode = this.options.approvalMode ?? getZapierApprovalMode() ?? getZapierDefaultApprovalMode();
5637
+ const approvalContext = init?.approvalContext;
5638
+ const { response, approvalRoundError } = await this.runApprovalFetchLoop({
5639
+ path,
5640
+ init,
5641
+ maxRetries,
5642
+ approvalMode,
5643
+ approvalContext
5644
+ });
5645
+ handleDeprecationNotice({
5646
+ response,
5647
+ canSendDeprecationMessaging,
5648
+ onEvent: this.options.onEvent
5649
+ });
5650
+ if (response.status !== 403) {
5651
+ return response;
5652
+ }
5653
+ const errorType = response.headers.get("x-zapier-error-type");
5654
+ if (errorType === "request_denied_by_policy") {
5655
+ const { data } = await this.parseResult(response);
5656
+ const { message, errors } = this.parseErrorResponse({
5657
+ status: response.status,
5658
+ statusText: response.statusText,
5659
+ data
5660
+ });
5661
+ throw new ZapierApprovalError(
5662
+ message || "Request explicitly denied by policy",
5663
+ {
5664
+ status: "policy_denied",
5665
+ statusCode: response.status,
5666
+ errors
5667
+ }
5668
+ );
5669
+ }
5670
+ if (errorType !== "approval_required") {
5671
+ return response;
5672
+ }
5673
+ if (approvalRoundError) {
5674
+ throw approvalRoundError;
5675
+ }
5676
+ if (approvalMode === "disabled") {
5677
+ throw new ZapierApprovalError(
5678
+ "Approvals are disabled. Set approvalMode to 'poll' or 'throw' (or ZAPIER_APPROVAL_MODE) to enable.",
5679
+ { status: "approval_required" }
5680
+ );
5681
+ }
5682
+ if (!approvalContext) {
5683
+ throw new ZapierApiError(
5684
+ `Received 403 approval_required for ${path}, but the caller did not provide an approvalContext builder. Every approval-capable request must pass approvalContext so the SDK can create the approval with the correct policy context.`,
5685
+ { statusCode: 403 }
4708
5686
  );
4709
5687
  }
4710
5688
  throw new ZapierApprovalError(
@@ -4966,40 +5944,60 @@ var ZapierApiClient = class {
4966
5944
  }
4967
5945
  // Apply any special routing logic for configured paths.
4968
5946
  applyPathConfiguration(path) {
4969
- const matchingPathKey = Object.keys(pathConfig).find(
4970
- (configPath) => path === configPath || path.startsWith(configPath + "/")
4971
- );
4972
- const config = matchingPathKey ? pathConfig[matchingPathKey] : void 0;
5947
+ const matchingPathEntries = findPathConfigEntries({ path });
5948
+ const routingMatch = matchingPathEntries[0];
5949
+ const buildResult = (url2) => {
5950
+ const resolvedPathEntries = findPathConfigEntries({
5951
+ path: url2.pathname,
5952
+ matchResolvedGatewayPath: true
5953
+ });
5954
+ const deprecationPathMatches = [
5955
+ ...matchingPathEntries,
5956
+ ...resolvedPathEntries
5957
+ ];
5958
+ const canSendDeprecationMessaging = deprecationPathMatches.length > 0 && deprecationPathMatches.every(
5959
+ ({ config }) => config.omitDeprecationMessaging !== true
5960
+ );
5961
+ return {
5962
+ url: url2,
5963
+ pathConfig: routingMatch?.config,
5964
+ canSendDeprecationMessaging
5965
+ };
5966
+ };
4973
5967
  let finalPath = path;
4974
- if (config && "pathPrefix" in config && config.pathPrefix && matchingPathKey) {
4975
- const pathWithoutPrefix = path.slice(matchingPathKey.length) || "/";
4976
- finalPath = `${config.pathPrefix}${pathWithoutPrefix}`;
5968
+ if (routingMatch?.config.pathPrefix) {
5969
+ const pathWithoutPrefix = path.slice(routingMatch.configPath.length) || "/";
5970
+ finalPath = `${routingMatch.config.pathPrefix}${pathWithoutPrefix}`;
4977
5971
  }
4978
5972
  const zapierBaseUrl = getZapierBaseUrl(this.options.baseUrl);
4979
5973
  if (zapierBaseUrl === this.options.baseUrl.replace(/\/$/, "")) {
4980
5974
  const originalBaseUrl = new URL(this.options.baseUrl);
4981
5975
  const finalBaseUrl = `https://sdkapi.${originalBaseUrl.hostname}`;
4982
- return {
4983
- url: new URL(finalPath, finalBaseUrl),
4984
- pathConfig: config
4985
- };
5976
+ const url2 = new URL(finalPath, finalBaseUrl);
5977
+ return buildResult(url2);
4986
5978
  }
4987
5979
  const baseUrl = new URL(this.options.baseUrl);
4988
5980
  const basePath = baseUrl.pathname.replace(/\/$/, "");
4989
- return {
4990
- url: new URL(basePath + finalPath, baseUrl.origin),
4991
- pathConfig: config
4992
- };
5981
+ const url = new URL(basePath + finalPath, baseUrl.origin);
5982
+ return buildResult(url);
4993
5983
  }
4994
5984
  // Helper to build full URLs and return routing info
4995
5985
  buildUrl(path, searchParams) {
4996
- const { url, pathConfig: config } = this.applyPathConfiguration(path);
5986
+ const {
5987
+ url,
5988
+ pathConfig: config,
5989
+ canSendDeprecationMessaging
5990
+ } = this.applyPathConfiguration(path);
4997
5991
  if (searchParams) {
4998
- Object.entries(searchParams).forEach(([key, value]) => {
4999
- url.searchParams.set(key, value);
5992
+ Object.entries(searchParams).forEach(([key2, value]) => {
5993
+ url.searchParams.set(key2, value);
5000
5994
  });
5001
5995
  }
5002
- return { url: url.toString(), pathConfig: config };
5996
+ return {
5997
+ url: url.toString(),
5998
+ pathConfig: config,
5999
+ canSendDeprecationMessaging
6000
+ };
5003
6001
  }
5004
6002
  // Helper to build headers
5005
6003
  async buildHeaders(options = {}, pathConfig2) {
@@ -5643,7 +6641,7 @@ var listAppsPlugin = definePlugin(
5643
6641
  locator
5644
6642
  ];
5645
6643
  }
5646
- const duplicatedLookupAppKeys = Object.keys(implementationNameToLocator).filter((key) => implementationNameToLocator[key].length > 1).map((key) => implementationNameToLocator[key]).flat().map((locator) => locator.lookupAppKey);
6644
+ const duplicatedLookupAppKeys = Object.keys(implementationNameToLocator).filter((key2) => implementationNameToLocator[key2].length > 1).map((key2) => implementationNameToLocator[key2]).flat().map((locator) => locator.lookupAppKey);
5647
6645
  if (duplicatedLookupAppKeys.length > 0) {
5648
6646
  throw new Error(
5649
6647
  `Duplicate lookup app keys found: ${duplicatedLookupAppKeys.join(", ")}`
@@ -6136,7 +7134,7 @@ function formatRecordError(fieldId, err) {
6136
7134
  function formatResponseError(err) {
6137
7135
  const message = err.human_title || err.title || "Unknown error";
6138
7136
  if (err.meta && Object.keys(err.meta).length > 0) {
6139
- const metaParts = Object.entries(err.meta).map(([key, val]) => `${key}: ${JSON.stringify(val)}`).join(", ");
7137
+ const metaParts = Object.entries(err.meta).map(([key2, val]) => `${key2}: ${JSON.stringify(val)}`).join(", ");
6140
7138
  return `${message} (${metaParts})`;
6141
7139
  }
6142
7140
  return message;
@@ -6171,8 +7169,8 @@ var TrashSchema = z.enum(["exclude", "include", "only"]).optional().describe(
6171
7169
  'Control soft-deleted item visibility. "exclude" (default) returns active items only, "include" returns both active and soft-deleted, "only" returns soft-deleted items only.'
6172
7170
  );
6173
7171
  var FIELD_ID_PATTERN = /^f\d+$/;
6174
- function isFieldId(key) {
6175
- return FIELD_ID_PATTERN.test(key);
7172
+ function isFieldId(key2) {
7173
+ return FIELD_ID_PATTERN.test(key2);
6176
7174
  }
6177
7175
  var NESTED_COMPONENTS = {
6178
7176
  labeled_string: /* @__PURE__ */ new Set(["value"]),
@@ -6210,7 +7208,7 @@ async function resolveFieldKeys({
6210
7208
  fieldKeys
6211
7209
  }) {
6212
7210
  const allAreIds = fieldKeys.every(
6213
- (key) => typeof key === "number" || /^(f?\d+)$/.test(key)
7211
+ (key2) => typeof key2 === "number" || /^(f?\d+)$/.test(key2)
6214
7212
  );
6215
7213
  if (allAreIds) {
6216
7214
  return fieldKeys.map(toNumericFieldId);
@@ -6219,13 +7217,13 @@ async function resolveFieldKeys({
6219
7217
  if (!mapping) {
6220
7218
  return fieldKeys.map(toNumericFieldId);
6221
7219
  }
6222
- return fieldKeys.map((key) => {
6223
- if (typeof key === "number") return key;
6224
- if (FIELD_ID_PATTERN.test(key)) return toNumericFieldId(key);
6225
- const id = mapping.nameToId.get(key);
7220
+ return fieldKeys.map((key2) => {
7221
+ if (typeof key2 === "number") return key2;
7222
+ if (FIELD_ID_PATTERN.test(key2)) return toNumericFieldId(key2);
7223
+ const id = mapping.nameToId.get(key2);
6226
7224
  if (!id) {
6227
7225
  throw new ZapierValidationError(
6228
- `Unknown field name: "${key}". Use a valid field name or ID.`
7226
+ `Unknown field name: "${key2}". Use a valid field name or ID.`
6229
7227
  );
6230
7228
  }
6231
7229
  return toNumericFieldId(id);
@@ -6241,13 +7239,13 @@ async function createFieldKeyTranslator({
6241
7239
  translateInput(data) {
6242
7240
  if (!mapping) return data;
6243
7241
  const result = {};
6244
- for (const [key, value] of Object.entries(data)) {
6245
- if (FIELD_ID_PATTERN.test(key) && mapping.idToName.has(key)) {
6246
- result[key] = value;
6247
- } else if (mapping.nameToId.has(key)) {
6248
- result[mapping.nameToId.get(key)] = value;
7242
+ for (const [key2, value] of Object.entries(data)) {
7243
+ if (FIELD_ID_PATTERN.test(key2) && mapping.idToName.has(key2)) {
7244
+ result[key2] = value;
7245
+ } else if (mapping.nameToId.has(key2)) {
7246
+ result[mapping.nameToId.get(key2)] = value;
6249
7247
  } else {
6250
- result[key] = value;
7248
+ result[key2] = value;
6251
7249
  }
6252
7250
  }
6253
7251
  return result;
@@ -6255,29 +7253,29 @@ async function createFieldKeyTranslator({
6255
7253
  translateOutput(data) {
6256
7254
  if (!mapping) return data;
6257
7255
  const result = {};
6258
- for (const [key, value] of Object.entries(data)) {
6259
- if (mapping.idToName.has(key)) {
6260
- result[mapping.idToName.get(key)] = value;
7256
+ for (const [key2, value] of Object.entries(data)) {
7257
+ if (mapping.idToName.has(key2)) {
7258
+ result[mapping.idToName.get(key2)] = value;
6261
7259
  } else {
6262
- result[key] = value;
7260
+ result[key2] = value;
6263
7261
  }
6264
7262
  }
6265
7263
  return result;
6266
7264
  },
6267
- translateFieldKey(key) {
6268
- if (!mapping) return key;
6269
- if (FIELD_ID_PATTERN.test(key) && mapping.idToName.has(key)) {
6270
- const fieldType = mapping.idToType.get(key);
7265
+ translateFieldKey(key2) {
7266
+ if (!mapping) return key2;
7267
+ if (FIELD_ID_PATTERN.test(key2) && mapping.idToName.has(key2)) {
7268
+ const fieldType = mapping.idToType.get(key2);
6271
7269
  if (fieldType) {
6272
7270
  const components = NESTED_COMPONENTS[fieldType];
6273
7271
  if (components?.size === 1) {
6274
- return `${key}__${[...components][0]}`;
7272
+ return `${key2}__${[...components][0]}`;
6275
7273
  }
6276
7274
  }
6277
- return key;
7275
+ return key2;
6278
7276
  }
6279
- if (mapping.nameToId.has(key)) {
6280
- const fieldId = mapping.nameToId.get(key);
7277
+ if (mapping.nameToId.has(key2)) {
7278
+ const fieldId = mapping.nameToId.get(key2);
6281
7279
  const fieldType = mapping.idToType.get(fieldId);
6282
7280
  if (fieldType) {
6283
7281
  const components = NESTED_COMPONENTS[fieldType];
@@ -6287,10 +7285,10 @@ async function createFieldKeyTranslator({
6287
7285
  }
6288
7286
  return fieldId;
6289
7287
  }
6290
- const sepIndex = key.lastIndexOf("__");
7288
+ const sepIndex = key2.lastIndexOf("__");
6291
7289
  if (sepIndex > 0) {
6292
- const prefix = key.slice(0, sepIndex);
6293
- const component = key.slice(sepIndex + 2);
7290
+ const prefix = key2.slice(0, sepIndex);
7291
+ const component = key2.slice(sepIndex + 2);
6294
7292
  let fieldId;
6295
7293
  if (FIELD_ID_PATTERN.test(prefix) && mapping.idToName.has(prefix)) {
6296
7294
  fieldId = prefix;
@@ -6304,7 +7302,7 @@ async function createFieldKeyTranslator({
6304
7302
  }
6305
7303
  }
6306
7304
  }
6307
- return key;
7305
+ return key2;
6308
7306
  }
6309
7307
  };
6310
7308
  }
@@ -7221,9 +8219,9 @@ var RunActionSchemaDeprecated = z.object({
7221
8219
  var RunActionInputSchema = z.union([RunActionSchema, RunActionSchemaDeprecated]).describe(RunActionDescription);
7222
8220
 
7223
8221
  // src/formatters/actionResult.ts
7224
- function getStringProperty(obj, key) {
7225
- if (typeof obj === "object" && obj !== null && key in obj) {
7226
- const value = obj[key];
8222
+ function getStringProperty(obj, key2) {
8223
+ if (typeof obj === "object" && obj !== null && key2 in obj) {
8224
+ const value = obj[key2];
7227
8225
  return typeof value === "string" ? value : void 0;
7228
8226
  }
7229
8227
  return void 0;
@@ -7310,13 +8308,13 @@ var runActionPlugin = definePlugin(
7310
8308
  let oldestKey;
7311
8309
  let oldestExpiry = Infinity;
7312
8310
  let evictedAny = false;
7313
- for (const [key, entry] of runActionContextCache) {
8311
+ for (const [key2, entry] of runActionContextCache) {
7314
8312
  if (now >= entry.expiresAt) {
7315
- runActionContextCache.delete(key);
8313
+ runActionContextCache.delete(key2);
7316
8314
  evictedAny = true;
7317
8315
  } else if (entry.expiresAt < oldestExpiry) {
7318
8316
  oldestExpiry = entry.expiresAt;
7319
- oldestKey = key;
8317
+ oldestKey = key2;
7320
8318
  }
7321
8319
  }
7322
8320
  if (!evictedAny && oldestKey) {
@@ -7944,36 +8942,36 @@ var createConnectionPlugin = definePlugin(
7944
8942
  sdk: inner,
7945
8943
  options
7946
8944
  }) => {
7947
- const { data: start } = await inner.getConnectionStartUrl({
8945
+ const { data: start2 } = await inner.getConnectionStartUrl({
7948
8946
  app: options.app
7949
8947
  });
7950
- setMethodMetadata({ selectedApi: start.app });
8948
+ setMethodMetadata({ selectedApi: start2.app });
7951
8949
  console.error(
7952
8950
  `
7953
8951
  Open this URL to complete the connection:
7954
- ${start.url}
8952
+ ${start2.url}
7955
8953
  `
7956
8954
  );
7957
8955
  const shouldOpen = options.browser === "always" || options.browser === "auto" && shouldOpenBrowser();
7958
8956
  if (shouldOpen) {
7959
8957
  try {
7960
- await open_url_default(start.url);
8958
+ await open_url_default(start2.url);
7961
8959
  } catch {
7962
8960
  }
7963
8961
  }
7964
8962
  const { data: fresh } = await inner.waitForNewConnection({
7965
- app: start.app,
8963
+ app: start2.app,
7966
8964
  // Server-stamped mint time: measured on the same clock as a
7967
8965
  // connection's `date`, so the freshness check is immune to
7968
8966
  // client/server clock skew.
7969
- startedAt: start.startedAt,
8967
+ startedAt: start2.startedAt,
7970
8968
  timeoutMs: options.timeoutMs,
7971
8969
  pollIntervalMs: options.pollIntervalMs
7972
8970
  });
7973
8971
  return {
7974
8972
  data: CreateConnectionItemSchema.parse({
7975
8973
  id: fresh.id,
7976
- app: start.app,
8974
+ app: start2.app,
7977
8975
  title: fresh.title ?? null
7978
8976
  })
7979
8977
  };
@@ -9972,9 +10970,9 @@ function findManifestEntry({
9972
10970
  return [slug, manifest.apps[slug]];
9973
10971
  }
9974
10972
  }
9975
- for (const [key, entry] of Object.entries(manifest.apps)) {
10973
+ for (const [key2, entry] of Object.entries(manifest.apps)) {
9976
10974
  if (entry.implementationName === appKeyWithoutVersion) {
9977
- return [key, entry];
10975
+ return [key2, entry];
9978
10976
  }
9979
10977
  }
9980
10978
  return null;
@@ -10231,21 +11229,21 @@ var manifestPlugin = definePlugin(
10231
11229
  );
10232
11230
 
10233
11231
  // src/plugins/capabilities/index.ts
10234
- function toDescription(key) {
10235
- const words = key.replace(/^can/, "").replace(/([A-Z])/g, " $1").trim().toLowerCase();
11232
+ function toDescription(key2) {
11233
+ const words = key2.replace(/^can/, "").replace(/([A-Z])/g, " $1").trim().toLowerCase();
10236
11234
  return `To ${words}`;
10237
11235
  }
10238
- function toEnvVar(key) {
10239
- return "ZAPIER_" + key.replace(/([A-Z])/g, "_$1").toUpperCase();
11236
+ function toEnvVar(key2) {
11237
+ return "ZAPIER_" + key2.replace(/([A-Z])/g, "_$1").toUpperCase();
10240
11238
  }
10241
- function toCliFlag(key) {
10242
- return "--" + key.replace(/([A-Z])/g, "-$1").toLowerCase();
11239
+ function toCliFlag(key2) {
11240
+ return "--" + key2.replace(/([A-Z])/g, "-$1").toLowerCase();
10243
11241
  }
10244
- function buildCapabilityMessage(key) {
11242
+ function buildCapabilityMessage(key2) {
10245
11243
  return [
10246
- `${toDescription(key)}, use ${toCliFlag(key)} in the CLI,`,
10247
- `set ${key}: true in SDK options or .zapierrc,`,
10248
- `or set ${toEnvVar(key)}=true.`
11244
+ `${toDescription(key2)}, use ${toCliFlag(key2)} in the CLI,`,
11245
+ `set ${key2}: true in SDK options or .zapierrc,`,
11246
+ `or set ${toEnvVar(key2)}=true.`
10249
11247
  ].join(" ");
10250
11248
  }
10251
11249
  var GATED_FLAGS = [
@@ -10253,8 +11251,8 @@ var GATED_FLAGS = [
10253
11251
  "canIncludeSharedTables",
10254
11252
  "canDeleteTables"
10255
11253
  ];
10256
- function isEnabledByEnv(key) {
10257
- const value = globalThis.process?.env?.[toEnvVar(key)];
11254
+ function isEnabledByEnv(key2) {
11255
+ const value = globalThis.process?.env?.[toEnvVar(key2)];
10258
11256
  if (value === void 0) return void 0;
10259
11257
  if (value === "true" || value === "1") return true;
10260
11258
  if (value === "false" || value === "0") return false;
@@ -10277,17 +11275,17 @@ var capabilitiesPlugin = definePlugin(
10277
11275
  }
10278
11276
  return {
10279
11277
  context: {
10280
- checkCapability: async (key) => {
11278
+ checkCapability: async (key2) => {
10281
11279
  const flags = await resolveFlags();
10282
- if (flags[key]) return;
11280
+ if (flags[key2]) return;
10283
11281
  throw new ZapierConfigurationError(
10284
- buildCapabilityMessage(key) + " (If you are an AI agent, you MUST NOT retry. Ask the user if they want to enable this.)",
10285
- { configType: key }
11282
+ buildCapabilityMessage(key2) + " (If you are an AI agent, you MUST NOT retry. Ask the user if they want to enable this.)",
11283
+ { configType: key2 }
10286
11284
  );
10287
11285
  },
10288
- hasCapability: async (key) => {
11286
+ hasCapability: async (key2) => {
10289
11287
  const flags = await resolveFlags();
10290
- return flags[key];
11288
+ return flags[key2];
10291
11289
  }
10292
11290
  }
10293
11291
  };
@@ -10445,8 +11443,8 @@ function getOsInfo() {
10445
11443
  function getPlatformVersions() {
10446
11444
  const versions = {};
10447
11445
  if (typeof globalThis.process?.versions === "object") {
10448
- for (const [key, value] of Object.entries(globalThis.process.versions)) {
10449
- versions[key] = value || null;
11446
+ for (const [key2, value] of Object.entries(globalThis.process.versions)) {
11447
+ versions[key2] = value || null;
10450
11448
  }
10451
11449
  }
10452
11450
  return versions;
@@ -10688,9 +11686,9 @@ async function emitWithTimeout(transport, subject, event) {
10688
11686
  }
10689
11687
  function mergeUserContext(event, userContext) {
10690
11688
  const merged = { ...event };
10691
- for (const [key, value] of Object.entries(userContext)) {
10692
- if (merged[key] == null) {
10693
- merged[key] = value;
11689
+ for (const [key2, value] of Object.entries(userContext)) {
11690
+ if (merged[key2] == null) {
11691
+ merged[key2] = value;
10694
11692
  }
10695
11693
  }
10696
11694
  return merged;
@@ -11963,9 +12961,9 @@ function createWaiter() {
11963
12961
  }
11964
12962
  };
11965
12963
  }
11966
- function addToMap(m, key, value) {
11967
- const existing = m.get(key) ?? [];
11968
- m.set(key, [...existing, value]);
12964
+ function addToMap(m, key2, value) {
12965
+ const existing = m.get(key2) ?? [];
12966
+ m.set(key2, [...existing, value]);
11969
12967
  }
11970
12968
  async function runBatchedDrainPipeline(options) {
11971
12969
  const {
@@ -12768,14 +13766,14 @@ function toWireConnections(connections) {
12768
13766
  }
12769
13767
  function toWireAppVersions(appVersions) {
12770
13768
  const wire = {};
12771
- for (const [key, entry] of Object.entries(appVersions)) {
13769
+ for (const [key2, entry] of Object.entries(appVersions)) {
12772
13770
  const implementationName = entry.implementationName ?? entry.implementation_name;
12773
13771
  if (implementationName === void 0) {
12774
13772
  throw new ZapierValidationError(
12775
- `appVersions["${key}"] is missing implementationName`
13773
+ `appVersions["${key2}"] is missing implementationName`
12776
13774
  );
12777
13775
  }
12778
- wire[key] = {
13776
+ wire[key2] = {
12779
13777
  implementation_name: implementationName,
12780
13778
  ...entry.version !== void 0 ? { version: entry.version } : {}
12781
13779
  };
@@ -14184,4 +15182,4 @@ function createZapierSdk2(options = {}) {
14184
15182
  );
14185
15183
  }
14186
15184
 
14187
- export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthMechanism, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, CORE_ERROR_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreErrorCode, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DebugPropertySchema, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, addPlugin, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createCorePlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierCoreStack, createZapierSdk2 as createZapierSdk, createZapierSdkStack2 as createZapierSdkStack, createZapierSdkWithoutRegistry, dangerousContextPlugin, declareMethod, declareProperty, defineLegacyMerge, defineMethod, definePlugin, defineProperty, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, durableRunIdResolver, eventEmissionPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, fromFunctionPlugin, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAgent, getAppPlugin, getBaseUrlFromCredentials, getCallerContext, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getTtyContext, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierOpenAutoModeApprovalsInBrowser, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreError, isCredentialsFunction, isCredentialsObject, isPermanentHttpError, isPkceCredentials, isPositional, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation2 as logDeprecation, manifestPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings2 as resetDeprecationWarnings, resolveAuth, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runInMethodScope, runWithCallerContext, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError, zapierSdkPlugin };
15185
+ export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthMechanism, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, CORE_ERROR_SYMBOL, CORE_SIGNAL_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreCancelledSignal, CoreErrorCode, CoreSignal, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DEPRECATION_NOTICE_EVENT, DebugPropertySchema, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, addPlugin, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createController, createCorePlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierCoreStack, createZapierSdk2 as createZapierSdk, createZapierSdkStack2 as createZapierSdkStack, createZapierSdkWithoutRegistry, dangerousContextPlugin, declareMethod, declareProperty, defineLegacyMerge, defineMethod, definePlugin, defineProperty, defineResolver, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, durableRunIdResolver, eventEmissionPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, fromFunctionPlugin, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAgent, getAppPlugin, getBaseUrlFromCredentials, getCallerContext, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getTtyContext, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierOpenAutoModeApprovalsInBrowser, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreError, isCoreSignal, isCredentialsFunction, isCredentialsObject, isPermanentHttpError, isPkceCredentials, isPositional, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation2 as logDeprecation, manifestPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings2 as resetDeprecationWarnings, resolveAuth, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runInMethodScope, runWithCallerContext, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError, zapierSdkPlugin };