nexus-ai-pro 2.20.2 → 2.22.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.
Files changed (233) hide show
  1. package/API_STABILITY.md +93 -0
  2. package/CHANGELOG.md +208 -1
  3. package/README.md +11 -6
  4. package/SECURITY.md +16 -2
  5. package/dist/adapter-kit/gather.d.ts +76 -0
  6. package/dist/adapter-kit/gather.js +147 -0
  7. package/dist/adapter-kit/index.d.ts +1 -0
  8. package/dist/adapter-kit/index.js +1 -0
  9. package/dist/adapter-kit/record.d.ts +3 -1
  10. package/dist/adapter-kit/record.js +20 -5
  11. package/dist/agent/openapi.d.ts +94 -8
  12. package/dist/agent/openapi.js +528 -32
  13. package/dist/cli/adapters.d.ts +4 -3
  14. package/dist/cli/adapters.js +71 -2
  15. package/dist/cli/doctor.js +3 -0
  16. package/dist/cli.js +3 -1
  17. package/dist/core/config-builder.d.ts +1 -0
  18. package/dist/core/config-builder.js +1 -0
  19. package/dist/core/defaults.d.ts +34 -0
  20. package/dist/core/defaults.js +39 -0
  21. package/dist/core/secure-stream.js +4 -1
  22. package/dist/decisions/completion.d.ts +10 -7
  23. package/dist/decisions/completion.js +82 -8
  24. package/dist/decisions/core.d.ts +88 -43
  25. package/dist/decisions/core.js +115 -28
  26. package/dist/decisions/errors.d.ts +25 -0
  27. package/dist/decisions/errors.js +12 -0
  28. package/dist/decisions/index.d.ts +6 -5
  29. package/dist/decisions/index.js +2 -1
  30. package/dist/decisions/integrations.d.ts +14 -5
  31. package/dist/decisions/integrations.js +16 -1
  32. package/dist/decisions/mock.d.ts +5 -3
  33. package/dist/decisions/mock.js +4 -1
  34. package/dist/decisions/pictures.d.ts +43 -0
  35. package/dist/decisions/pictures.js +103 -0
  36. package/dist/decisions/typesafe.d.ts +33 -5
  37. package/dist/decisions/typesafe.js +121 -8
  38. package/dist/doctor/index.d.ts +6 -9
  39. package/dist/doctor/index.js +41 -0
  40. package/dist/embeddings/adapters.d.ts +1 -1
  41. package/dist/embeddings/adapters.js +3 -3
  42. package/dist/embeddings/batch-google.d.ts +27 -8
  43. package/dist/embeddings/batch-google.js +112 -36
  44. package/dist/embeddings/batch-mock.js +1 -1
  45. package/dist/embeddings/batch.js +10 -4
  46. package/dist/embeddings/engine.js +14 -13
  47. package/dist/embeddings/index.d.ts +1 -1
  48. package/dist/embeddings/inputs.d.ts +26 -3
  49. package/dist/embeddings/inputs.js +84 -5
  50. package/dist/embeddings/mock.js +1 -1
  51. package/dist/embeddings/models.js +39 -4
  52. package/dist/loaders/csv.d.ts +23 -1
  53. package/dist/loaders/csv.js +125 -72
  54. package/dist/loaders/index.d.ts +7 -2
  55. package/dist/loaders/input.d.ts +6 -0
  56. package/dist/loaders/input.js +42 -1
  57. package/dist/loaders/json.d.ts +14 -3
  58. package/dist/loaders/json.js +171 -20
  59. package/dist/loaders/web.d.ts +55 -0
  60. package/dist/loaders/web.js +20 -1
  61. package/dist/mcp/client.d.ts +54 -5
  62. package/dist/mcp/client.js +171 -20
  63. package/dist/mcp/http.d.ts +45 -0
  64. package/dist/mcp/http.js +233 -0
  65. package/dist/mcp/index.d.ts +4 -2
  66. package/dist/mcp/index.js +3 -1
  67. package/dist/mcp/protocol.d.ts +107 -0
  68. package/dist/mcp/sampling.d.ts +41 -0
  69. package/dist/mcp/sampling.js +52 -0
  70. package/dist/mcp/server.d.ts +96 -14
  71. package/dist/mcp/server.js +274 -59
  72. package/dist/models/data.js +20 -1
  73. package/dist/operations/adapters.d.ts +1 -0
  74. package/dist/operations/adapters.js +3 -1
  75. package/dist/protocols/a2a-grpc.js +10 -3
  76. package/dist/protocols/a2a-signing.d.ts +65 -0
  77. package/dist/protocols/a2a-signing.js +133 -0
  78. package/dist/protocols/a2a.d.ts +14 -0
  79. package/dist/protocols/a2a.js +60 -5
  80. package/dist/providers/cohere.js +16 -2
  81. package/dist/providers/google.js +7 -1
  82. package/dist/providers/ollama.d.ts +1 -1
  83. package/dist/providers/ollama.js +35 -27
  84. package/dist/providers/openai.js +19 -2
  85. package/dist/rag/pinecone.d.ts +63 -2
  86. package/dist/rag/pinecone.js +80 -0
  87. package/dist/realtime/conversation.js +18 -0
  88. package/dist/realtime/gemini-live.transport.d.ts +28 -3
  89. package/dist/realtime/gemini-live.transport.js +170 -32
  90. package/dist/realtime/session.d.ts +2 -0
  91. package/dist/realtime/session.js +19 -4
  92. package/dist/realtime/types.d.ts +35 -3
  93. package/dist/security/output-guard.js +4 -1
  94. package/dist/server/auth.d.ts +263 -2
  95. package/dist/server/auth.js +432 -5
  96. package/dist/server/deployments.d.ts +3 -2
  97. package/dist/server/deployments.js +6 -1
  98. package/dist/telephony/index.d.ts +1 -1
  99. package/dist/telephony/manager.d.ts +8 -1
  100. package/dist/telephony/manager.js +13 -0
  101. package/dist/telephony/providers/telnyx.d.ts +18 -5
  102. package/dist/telephony/providers/telnyx.js +44 -7
  103. package/dist/telephony/providers/twilio.d.ts +3 -1
  104. package/dist/telephony/providers/twilio.js +16 -0
  105. package/dist/tracing/stores.d.ts +2 -0
  106. package/dist/tracing/stores.js +1 -0
  107. package/dist/tracing/tracer.d.ts +5 -2
  108. package/dist/tracing/tracer.js +6 -3
  109. package/dist/types/embeddings.d.ts +47 -5
  110. package/dist/types/messages.d.ts +7 -0
  111. package/dist/types/principal.d.ts +1 -1
  112. package/dist/types/response.d.ts +5 -0
  113. package/dist/types/telephony.d.ts +38 -0
  114. package/dist/types/tracing.d.ts +6 -0
  115. package/dist/version.d.ts +1 -1
  116. package/dist/version.js +1 -1
  117. package/dist/voice/providers/google.d.ts +44 -0
  118. package/dist/voice/providers/google.js +215 -0
  119. package/dist-cjs/adapter-kit/gather.d.ts +76 -0
  120. package/dist-cjs/adapter-kit/gather.js +152 -0
  121. package/dist-cjs/adapter-kit/index.d.ts +1 -0
  122. package/dist-cjs/adapter-kit/index.js +4 -1
  123. package/dist-cjs/adapter-kit/record.d.ts +3 -1
  124. package/dist-cjs/adapter-kit/record.js +20 -5
  125. package/dist-cjs/agent/openapi.d.ts +94 -8
  126. package/dist-cjs/agent/openapi.js +530 -32
  127. package/dist-cjs/cli/adapters.d.ts +4 -3
  128. package/dist-cjs/cli/adapters.js +70 -1
  129. package/dist-cjs/cli/doctor.js +3 -0
  130. package/dist-cjs/core/config-builder.d.ts +1 -0
  131. package/dist-cjs/core/config-builder.js +5 -1
  132. package/dist-cjs/core/defaults.d.ts +34 -0
  133. package/dist-cjs/core/defaults.js +44 -0
  134. package/dist-cjs/core/secure-stream.js +4 -1
  135. package/dist-cjs/decisions/completion.d.ts +10 -7
  136. package/dist-cjs/decisions/completion.js +81 -7
  137. package/dist-cjs/decisions/core.d.ts +88 -43
  138. package/dist-cjs/decisions/core.js +134 -46
  139. package/dist-cjs/decisions/errors.d.ts +25 -0
  140. package/dist-cjs/decisions/errors.js +16 -0
  141. package/dist-cjs/decisions/index.d.ts +6 -5
  142. package/dist-cjs/decisions/index.js +5 -1
  143. package/dist-cjs/decisions/integrations.d.ts +14 -5
  144. package/dist-cjs/decisions/integrations.js +16 -1
  145. package/dist-cjs/decisions/mock.d.ts +5 -3
  146. package/dist-cjs/decisions/mock.js +4 -1
  147. package/dist-cjs/decisions/pictures.d.ts +43 -0
  148. package/dist-cjs/decisions/pictures.js +109 -0
  149. package/dist-cjs/decisions/typesafe.d.ts +33 -5
  150. package/dist-cjs/decisions/typesafe.js +126 -13
  151. package/dist-cjs/doctor/index.d.ts +6 -9
  152. package/dist-cjs/doctor/index.js +41 -0
  153. package/dist-cjs/embeddings/adapters.d.ts +1 -1
  154. package/dist-cjs/embeddings/adapters.js +3 -3
  155. package/dist-cjs/embeddings/batch-google.d.ts +27 -8
  156. package/dist-cjs/embeddings/batch-google.js +112 -36
  157. package/dist-cjs/embeddings/batch-mock.js +1 -1
  158. package/dist-cjs/embeddings/batch.js +9 -3
  159. package/dist-cjs/embeddings/engine.js +13 -12
  160. package/dist-cjs/embeddings/index.d.ts +1 -1
  161. package/dist-cjs/embeddings/inputs.d.ts +26 -3
  162. package/dist-cjs/embeddings/inputs.js +89 -5
  163. package/dist-cjs/embeddings/mock.js +1 -1
  164. package/dist-cjs/embeddings/models.js +39 -4
  165. package/dist-cjs/loaders/csv.d.ts +23 -1
  166. package/dist-cjs/loaders/csv.js +126 -71
  167. package/dist-cjs/loaders/index.d.ts +7 -2
  168. package/dist-cjs/loaders/input.d.ts +6 -0
  169. package/dist-cjs/loaders/input.js +43 -1
  170. package/dist-cjs/loaders/json.d.ts +14 -3
  171. package/dist-cjs/loaders/json.js +170 -19
  172. package/dist-cjs/loaders/web.d.ts +55 -0
  173. package/dist-cjs/loaders/web.js +21 -1
  174. package/dist-cjs/mcp/client.d.ts +54 -5
  175. package/dist-cjs/mcp/client.js +171 -20
  176. package/dist-cjs/mcp/http.d.ts +45 -0
  177. package/dist-cjs/mcp/http.js +236 -0
  178. package/dist-cjs/mcp/index.d.ts +4 -2
  179. package/dist-cjs/mcp/index.js +5 -1
  180. package/dist-cjs/mcp/protocol.d.ts +107 -0
  181. package/dist-cjs/mcp/sampling.d.ts +41 -0
  182. package/dist-cjs/mcp/sampling.js +55 -0
  183. package/dist-cjs/mcp/server.d.ts +96 -14
  184. package/dist-cjs/mcp/server.js +273 -58
  185. package/dist-cjs/models/data.js +20 -1
  186. package/dist-cjs/operations/adapters.d.ts +1 -0
  187. package/dist-cjs/operations/adapters.js +3 -1
  188. package/dist-cjs/protocols/a2a-grpc.js +10 -3
  189. package/dist-cjs/protocols/a2a-signing.d.ts +65 -0
  190. package/dist-cjs/protocols/a2a-signing.js +140 -0
  191. package/dist-cjs/protocols/a2a.d.ts +14 -0
  192. package/dist-cjs/protocols/a2a.js +65 -6
  193. package/dist-cjs/providers/cohere.js +16 -2
  194. package/dist-cjs/providers/google.js +7 -1
  195. package/dist-cjs/providers/ollama.d.ts +1 -1
  196. package/dist-cjs/providers/ollama.js +35 -27
  197. package/dist-cjs/providers/openai.js +19 -2
  198. package/dist-cjs/rag/pinecone.d.ts +63 -2
  199. package/dist-cjs/rag/pinecone.js +81 -0
  200. package/dist-cjs/realtime/conversation.js +18 -0
  201. package/dist-cjs/realtime/gemini-live.transport.d.ts +28 -3
  202. package/dist-cjs/realtime/gemini-live.transport.js +170 -32
  203. package/dist-cjs/realtime/session.d.ts +2 -0
  204. package/dist-cjs/realtime/session.js +19 -4
  205. package/dist-cjs/realtime/types.d.ts +35 -3
  206. package/dist-cjs/security/output-guard.js +4 -1
  207. package/dist-cjs/server/auth.d.ts +263 -2
  208. package/dist-cjs/server/auth.js +437 -5
  209. package/dist-cjs/server/deployments.d.ts +3 -2
  210. package/dist-cjs/server/deployments.js +6 -1
  211. package/dist-cjs/telephony/index.d.ts +1 -1
  212. package/dist-cjs/telephony/manager.d.ts +8 -1
  213. package/dist-cjs/telephony/manager.js +13 -0
  214. package/dist-cjs/telephony/providers/telnyx.d.ts +18 -5
  215. package/dist-cjs/telephony/providers/telnyx.js +44 -7
  216. package/dist-cjs/telephony/providers/twilio.d.ts +3 -1
  217. package/dist-cjs/telephony/providers/twilio.js +16 -0
  218. package/dist-cjs/tracing/stores.d.ts +2 -0
  219. package/dist-cjs/tracing/stores.js +1 -0
  220. package/dist-cjs/tracing/tracer.d.ts +5 -2
  221. package/dist-cjs/tracing/tracer.js +6 -3
  222. package/dist-cjs/types/embeddings.d.ts +47 -5
  223. package/dist-cjs/types/messages.d.ts +7 -0
  224. package/dist-cjs/types/principal.d.ts +1 -1
  225. package/dist-cjs/types/response.d.ts +5 -0
  226. package/dist-cjs/types/telephony.d.ts +38 -0
  227. package/dist-cjs/types/tracing.d.ts +6 -0
  228. package/dist-cjs/version.d.ts +1 -1
  229. package/dist-cjs/version.js +1 -1
  230. package/dist-cjs/voice/providers/google.d.ts +44 -0
  231. package/dist-cjs/voice/providers/google.js +252 -0
  232. package/llms.txt +1 -1
  233. package/package.json +17 -1
@@ -161,7 +161,7 @@ export function compatibilityPage(records, options = {}) {
161
161
  record,
162
162
  status,
163
163
  cells: [
164
- record.adapter.repository
164
+ record.adapter.repository && /^https?:\/\//i.test(record.adapter.repository)
165
165
  ? { text: record.adapter.name, href: record.adapter.repository }
166
166
  : { text: record.adapter.name },
167
167
  { text: record.adapter.kind },
@@ -187,7 +187,8 @@ export function compatibilityPage(records, options = {}) {
187
187
  const cell = (item) => item.href ? `<a href="${escapeHtml(item.href)}">${escapeHtml(item.text)}</a>` : escapeHtml(item.text);
188
188
  return [
189
189
  '<!doctype html>',
190
- `<html lang="en"><head><meta charset="utf-8"><title>${escapeHtml(title)}</title></head><body>`,
190
+ `<html lang="en"><head><meta charset="utf-8"><title>${escapeHtml(title)}</title>`,
191
+ `<style>${STATE_STYLE}</style></head><body>`,
191
192
  `<h1>${escapeHtml(title)}</h1>`,
192
193
  ...(options.intro ? [`<p>${escapeHtml(options.intro)}</p>`] : []),
193
194
  `<p>States are judged against nexus-ai-pro ${escapeHtml(nexusVersion)}.</p>`,
@@ -207,9 +208,11 @@ export function compatibilityPage(records, options = {}) {
207
208
  '',
208
209
  ].join('\n');
209
210
  }
211
+ const literal = (text) => oneLine(text).replace(/[|[\]*_`\\]/g, (char) => `\\${char}`);
210
212
  const cell = (item) => {
211
- const text = item.text.replace(/\|/g, '\\|');
212
- return item.href ? `[${text}](${item.href.replace(/\|/g, '%7C')})` : text;
213
+ const text = literal(item.text);
214
+ const href = item.href?.replace(/[|\s()]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase().padStart(2, '0')}`);
215
+ return href ? `[${text}](${href})` : text;
213
216
  };
214
217
  return [
215
218
  `# ${title}`,
@@ -221,7 +224,10 @@ export function compatibilityPage(records, options = {}) {
221
224
  `| ${headers.map(() => '---').join(' | ')} |`,
222
225
  ...rows.map((row) => `| ${row.cells.map(cell).join(' | ')} |`),
223
226
  ...(notes.length > 0
224
- ? ['', ...notes.map((row) => `- **${row.record.adapter.name}**: ${row.status.reasons.join('; ')}`)]
227
+ ? [
228
+ '',
229
+ ...notes.map((row) => `- **${literal(row.record.adapter.name)}**: ${row.status.reasons.map(literal).join('; ')}`),
230
+ ]
225
231
  : []),
226
232
  '',
227
233
  ].join('\n');
@@ -240,6 +246,15 @@ function runtimeName() {
240
246
  function isRecord(value) {
241
247
  return value !== null && typeof value === 'object' && !Array.isArray(value);
242
248
  }
249
+ const STATE_STYLE = [
250
+ 'tr[data-state="passing"] td{color:#1a7f37}',
251
+ 'tr[data-state="failing"] td{color:#cf222e;font-weight:600}',
252
+ 'tr[data-state="incompatible"] td{color:#9a6700}',
253
+ 'tr[data-state="stale"] td{color:#57606a}',
254
+ ].join('');
255
+ function oneLine(text) {
256
+ return text.replace(/\s+/g, ' ').trim();
257
+ }
243
258
  function escapeHtml(text) {
244
259
  return text.replace(/[&<>"']/g, (char) => `&#${char.charCodeAt(0)};`);
245
260
  }
@@ -44,6 +44,38 @@ export interface OpenApiOperation {
44
44
  tags: string[];
45
45
  /** What it does to the service, read from its method: `read` for GET, HEAD, OPTIONS, and TRACE, `destructive` for DELETE, and `write` for the rest. */
46
46
  access: 'read' | 'write' | 'destructive';
47
+ /**
48
+ * The security it asks for, as the document writes it: alternatives, any one of which will do, each
49
+ * the schemes it needs at once with their scopes. Empty when it asks for none.
50
+ */
51
+ security: Array<Record<string, string[]>>;
52
+ }
53
+ /**
54
+ * A credential for one of the API's security schemes: the API key, bearer token, or access token as
55
+ * text or `{ token }`; `{ username, password }` for HTTP basic; or `{ clientId, clientSecret }` for an
56
+ * OAuth 2.0 client-credentials flow, whose token is fetched and kept until it expires.
57
+ */
58
+ export type OpenApiCredential = string | {
59
+ token: string;
60
+ } | {
61
+ username: string;
62
+ password: string;
63
+ } | {
64
+ clientId: string;
65
+ clientSecret: string;
66
+ };
67
+ /** A request or callback the API sends to the application, which no tool calls: its name and the body it carries. */
68
+ export interface OpenApiWebhook {
69
+ /** The webhook's name, or the operation and callback it belongs to. */
70
+ name: string;
71
+ /** `webhook` for one of the document's webhooks, `callback` for an operation's callback. */
72
+ source: 'webhook' | 'callback';
73
+ /** The HTTP method it arrives with, in capitals. */
74
+ method: string;
75
+ /** For a callback, the expression that names where it is sent, such as `{$request.body#/callbackUrl}`. */
76
+ expression?: string;
77
+ /** The JSON Schema of the body it carries, when it carries JSON. */
78
+ body?: Record<string, unknown>;
47
79
  }
48
80
  /** What a tool's headers are chosen from: the operation, and the call's context. */
49
81
  export interface OpenApiHeadersRequest {
@@ -79,6 +111,15 @@ export interface OpenApiToolsOptions {
79
111
  maxResponseBytes?: number;
80
112
  /** Replaces the global `fetch`. */
81
113
  fetch?: typeof globalThis.fetch;
114
+ /**
115
+ * Credentials for the API's own security schemes, by the name the document gives each, or a
116
+ * function choosing one per call, such as by its tenant. Each call sends those its operation asks
117
+ * for: the first of its alternatives every scheme of which has a credential, as an API key in its
118
+ * header, query, or cookie, HTTP basic or bearer, or an OAuth 2.0 or OpenID Connect token. With
119
+ * credentials given, a call whose operation asks for schemes none of which has one fails before it
120
+ * is sent. They win over `headers`.
121
+ */
122
+ credentials?: Readonly<Record<string, OpenApiCredential | ((request: OpenApiHeadersRequest) => OpenApiCredential | Promise<OpenApiCredential>)>>;
82
123
  }
83
124
  /** An API's operations as tools, with what each returns. */
84
125
  export interface OpenApiTools {
@@ -92,19 +133,26 @@ export interface OpenApiTools {
92
133
  operations: OpenApiOperation[];
93
134
  /** The JSON Schema of what each tool returns, by name: its first success response's. Pass it to `emulatedTools()` as `results`. */
94
135
  results: Record<string, Record<string, unknown>>;
95
- /** Operations that could not become tools, and why: a request body of a type the tools do not send. */
136
+ /**
137
+ * Operations that could not become tools, and why.
138
+ *
139
+ * @deprecated Every operation becomes a tool since 2.22, its body sent whatever its type, so this is
140
+ * always empty. It is removed in 3.0.
141
+ */
96
142
  skipped: Array<{
97
143
  method: string;
98
144
  path: string;
99
145
  reason: string;
100
146
  }>;
147
+ /** What the API sends the application, which no tool calls: its webhooks and its operations' callbacks. */
148
+ webhooks: OpenApiWebhook[];
101
149
  }
102
150
  /** Why an API could not be read into tools, or a call to it failed. */
103
151
  export declare class OpenApiError extends Error {
104
152
  /**
105
153
  * `OPENAPI_INVALID` for a malformed document or call, `OPENAPI_UNSUPPORTED` for one these tools
106
- * cannot read, such as Swagger 2.0 or a reference outside the document, and `OPENAPI_REQUEST`
107
- * for a call the API refused or did not answer.
154
+ * cannot read, such as Swagger 1.2 or a reference outside the document not bundled first, and
155
+ * `OPENAPI_REQUEST` for a call the API refused or did not answer.
108
156
  */
109
157
  readonly code: 'OPENAPI_INVALID' | 'OPENAPI_UNSUPPORTED' | 'OPENAPI_REQUEST';
110
158
  /** The HTTP status the API answered with, when it did. */
@@ -112,8 +160,8 @@ export declare class OpenApiError extends Error {
112
160
  constructor(message: string,
113
161
  /**
114
162
  * `OPENAPI_INVALID` for a malformed document or call, `OPENAPI_UNSUPPORTED` for one these tools
115
- * cannot read, such as Swagger 2.0 or a reference outside the document, and `OPENAPI_REQUEST`
116
- * for a call the API refused or did not answer.
163
+ * cannot read, such as Swagger 1.2 or a reference outside the document not bundled first, and
164
+ * `OPENAPI_REQUEST` for a call the API refused or did not answer.
117
165
  */
118
166
  code: 'OPENAPI_INVALID' | 'OPENAPI_UNSUPPORTED' | 'OPENAPI_REQUEST',
119
167
  /** The HTTP status the API answered with, when it did. */
@@ -124,7 +172,10 @@ export declare class OpenApiError extends Error {
124
172
  * method and path; described by its summary; its path, query, and header parameters, and the fields
125
173
  * of a JSON body, as the tool's parameters. Each declares `api.read`, `api.write`, or
126
174
  * `api.destructive` with the API's name and its own, as its method says, and `network` for the
127
- * API's host when it runs. References within the document are followed; one outside it is refused.
175
+ * API's host when it runs. References within the document are followed; one outside it is refused
176
+ * here, and followed by `loadOpenApiTools()` or `bundleOpenApiDocument()`. A Swagger 2.0 document is
177
+ * read as the OpenAPI 3 document it describes. Each call sends the credentials its operation's
178
+ * security asks for, from `credentials`.
128
179
  *
129
180
  * ```ts
130
181
  * const shop = openApiTools(JSON.parse(await readFile('shop.openapi.json', 'utf8')), {
@@ -135,5 +186,40 @@ export declare class OpenApiError extends Error {
135
186
  * ```
136
187
  */
137
188
  export declare function openApiTools(document: OpenApiDocument | string, options?: OpenApiToolsOptions): OpenApiTools;
138
- /** Fetches an OpenAPI document, as JSON, and reads it into tools, resolving its servers against where it came from. */
139
- export declare function loadOpenApiTools(url: string, options?: OpenApiToolsOptions): Promise<OpenApiTools>;
189
+ /**
190
+ * Fetches an OpenAPI document, as JSON, and reads it into tools, resolving its servers against where
191
+ * it came from, and following its references to other documents on the same origin, or as
192
+ * `references` allows.
193
+ */
194
+ export declare function loadOpenApiTools(url: string, options?: OpenApiToolsOptions & Pick<OpenApiBundleOptions, 'references' | 'maxDocuments' | 'maxBytes'>): Promise<OpenApiTools>;
195
+ /**
196
+ * A Swagger 2.0 document as the OpenAPI 3.0 document it describes: its host, base path, and schemes
197
+ * as a server; its definitions, parameters, responses, and security definitions as components; a
198
+ * body parameter, and form data, as a request body of what it consumes; and each response's schema as
199
+ * content of what it produces. Every reference is moved with what it names.
200
+ */
201
+ export declare function swaggerToOpenApi(swagger: Record<string, unknown>): OpenApiDocument;
202
+ /** Options for `bundleOpenApiDocument()`. */
203
+ export interface OpenApiBundleOptions {
204
+ /** Where the document came from: references outside it are read relative to it. */
205
+ documentUrl: string;
206
+ /**
207
+ * Which documents a reference may name: `same-origin`, the default, only those on the document's
208
+ * own origin; `any`, any HTTP or HTTPS URL; or a function deciding each. A document never makes the
209
+ * tools fetch where it was not allowed to.
210
+ */
211
+ references?: 'same-origin' | 'any' | ((url: string) => boolean);
212
+ /** The most documents read, the first included. Defaults to 50. */
213
+ maxDocuments?: number;
214
+ /** The largest document read, the first included, in bytes. Defaults to 5 MB. */
215
+ maxBytes?: number;
216
+ /** Replaces the global `fetch`. */
217
+ fetch?: typeof globalThis.fetch;
218
+ }
219
+ /**
220
+ * The document with every reference outside it read in its place: each other document fetched, as
221
+ * JSON, relative to the one that names it, its own references followed the same way, and a reference
222
+ * back to one still being read left as a description. `loadOpenApiTools()` does this before reading the
223
+ * document into tools.
224
+ */
225
+ export declare function bundleOpenApiDocument(document: OpenApiDocument, options: OpenApiBundleOptions): Promise<OpenApiDocument>;