@quilltap/plugin-utils 2.2.17 → 2.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to @quilltap/plugin-utils will be documented in this file.
4
4
 
5
+ ## [2.2.19] - 2026-08-03
6
+
7
+ ### Fixed
8
+
9
+ - `PLUGIN_UTILS_VERSION` no longer drifts from the published version. The constant was a hand-written literal and had been stale since 2.2.1 while the package shipped 2.2.18, so any consumer using it for a runtime compatibility check got a wrong answer. It is now generated into `src/version.generated.ts` from the `version` field in package.json by `scripts/generate-version.mjs`, which runs from `prebuild` and `pretypecheck` — bumping package.json is the only step. Both the runtime value and the literal type in `dist/index.d.ts` follow automatically.
10
+
5
11
  ## [2.2.0] - 2026-04-09
6
12
 
7
13
  ### Removed
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { AnthropicToolDefinition, CharacterPluginDataEntry, CharacterPluginDataMap, GoogleToolDefinition, LogContext, LogLevel, OpenAIToolDefinition, PluginLogger, ToolCall, ToolCallRequest, ToolFormatOptions, ToolResult, UniversalTool, createConsoleLogger, createNoopLogger } from '@quilltap/plugin-types';
2
2
  export { T as ToolCallFormat, a as ToolConvertTarget, b as applyDescriptionLimit, c as convertFromAnthropicFormat, d as convertFromGoogleFormat, e as convertOpenAIToAnthropicFormat, f as convertOpenAIToGoogleFormat, g as convertToAnthropicFormat, h as convertToGoogleFormat, i as convertToolTo, j as convertToolsTo, k as detectToolCallFormat, l as hasToolCalls, p as parseAnthropicToolCalls, m as parseGoogleToolCalls, n as parseOpenAIToolCalls, o as parseToolCalls } from './converters-BPYo8xdH.mjs';
3
3
  export { PluginLoggerWithChild, __clearCoreLoggerFactory, __injectCoreLoggerFactory, createPluginLogger, getLogLevelFromEnv, hasCoreLogger } from './logging/index.mjs';
4
- export { OpenAICompatibleProvider, OpenAICompatibleProviderConfig } from './providers/index.mjs';
4
+ export { DEFAULT_REQUEST_TIMEOUT_MS, OpenAICompatibleProvider, OpenAICompatibleProviderConfig, buildRequestAbortSignal, buildSdkClientOptions, buildSdkRequestOptions, resolveRequestTimeoutMs } from './providers/index.mjs';
5
5
  export { CreateSystemPromptPluginOptions, createSystemPromptPlugin, validateSystemPromptPlugin } from './system-prompts/index.mjs';
6
6
  export { isVMEnvironment, resolveHostGateway, rewriteLocalhostUrl } from './host-rewrite.mjs';
7
7
  import 'openai';
@@ -114,25 +114,16 @@ declare function getQuilltapVersion(): string;
114
114
  declare function getQuilltapUserAgent(): string;
115
115
 
116
116
  /**
117
- * @quilltap/plugin-utils
117
+ * GENERATED FILE — DO NOT EDIT.
118
118
  *
119
- * Utility functions for Quilltap plugin development.
120
- *
121
- * This package provides runtime utilities that complement the type definitions
122
- * in @quilltap/plugin-types. It includes:
123
- *
124
- * - **Tool Parsing**: Parse tool calls from any LLM provider's response format
125
- * - **Tool Conversion**: Convert between OpenAI, Anthropic, and Google tool formats
126
- * - **Logger Bridge**: Logging that integrates with Quilltap's core or runs standalone
127
- *
128
- * @packageDocumentation
129
- * @module @quilltap/plugin-utils
119
+ * Written by scripts/generate-version.mjs from the "version" field in
120
+ * package.json. Bump the version there; this file follows automatically on
121
+ * `npm run build` / `npm run typecheck`.
130
122
  */
131
-
132
123
  /**
133
124
  * Version of the plugin-utils package.
134
125
  * Can be used at runtime to check compatibility.
135
126
  */
136
- declare const PLUGIN_UTILS_VERSION = "2.2.1";
127
+ declare const PLUGIN_UTILS_VERSION = "2.2.19";
137
128
 
138
129
  export { BUILTIN_TOOL_NAMES, PLUGIN_UTILS_VERSION, __clearQuilltapVersion, __injectQuilltapVersion, getBuiltinToolNames, getQuilltapUserAgent, getQuilltapVersion };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { AnthropicToolDefinition, CharacterPluginDataEntry, CharacterPluginDataMap, GoogleToolDefinition, LogContext, LogLevel, OpenAIToolDefinition, PluginLogger, ToolCall, ToolCallRequest, ToolFormatOptions, ToolResult, UniversalTool, createConsoleLogger, createNoopLogger } from '@quilltap/plugin-types';
2
2
  export { T as ToolCallFormat, a as ToolConvertTarget, b as applyDescriptionLimit, c as convertFromAnthropicFormat, d as convertFromGoogleFormat, e as convertOpenAIToAnthropicFormat, f as convertOpenAIToGoogleFormat, g as convertToAnthropicFormat, h as convertToGoogleFormat, i as convertToolTo, j as convertToolsTo, k as detectToolCallFormat, l as hasToolCalls, p as parseAnthropicToolCalls, m as parseGoogleToolCalls, n as parseOpenAIToolCalls, o as parseToolCalls } from './converters-BPYo8xdH.js';
3
3
  export { PluginLoggerWithChild, __clearCoreLoggerFactory, __injectCoreLoggerFactory, createPluginLogger, getLogLevelFromEnv, hasCoreLogger } from './logging/index.js';
4
- export { OpenAICompatibleProvider, OpenAICompatibleProviderConfig } from './providers/index.js';
4
+ export { DEFAULT_REQUEST_TIMEOUT_MS, OpenAICompatibleProvider, OpenAICompatibleProviderConfig, buildRequestAbortSignal, buildSdkClientOptions, buildSdkRequestOptions, resolveRequestTimeoutMs } from './providers/index.js';
5
5
  export { CreateSystemPromptPluginOptions, createSystemPromptPlugin, validateSystemPromptPlugin } from './system-prompts/index.js';
6
6
  export { isVMEnvironment, resolveHostGateway, rewriteLocalhostUrl } from './host-rewrite.js';
7
7
  import 'openai';
@@ -114,25 +114,16 @@ declare function getQuilltapVersion(): string;
114
114
  declare function getQuilltapUserAgent(): string;
115
115
 
116
116
  /**
117
- * @quilltap/plugin-utils
117
+ * GENERATED FILE — DO NOT EDIT.
118
118
  *
119
- * Utility functions for Quilltap plugin development.
120
- *
121
- * This package provides runtime utilities that complement the type definitions
122
- * in @quilltap/plugin-types. It includes:
123
- *
124
- * - **Tool Parsing**: Parse tool calls from any LLM provider's response format
125
- * - **Tool Conversion**: Convert between OpenAI, Anthropic, and Google tool formats
126
- * - **Logger Bridge**: Logging that integrates with Quilltap's core or runs standalone
127
- *
128
- * @packageDocumentation
129
- * @module @quilltap/plugin-utils
119
+ * Written by scripts/generate-version.mjs from the "version" field in
120
+ * package.json. Bump the version there; this file follows automatically on
121
+ * `npm run build` / `npm run typecheck`.
130
122
  */
131
-
132
123
  /**
133
124
  * Version of the plugin-utils package.
134
125
  * Can be used at runtime to check compatibility.
135
126
  */
136
- declare const PLUGIN_UTILS_VERSION = "2.2.1";
127
+ declare const PLUGIN_UTILS_VERSION = "2.2.19";
137
128
 
138
129
  export { BUILTIN_TOOL_NAMES, PLUGIN_UTILS_VERSION, __clearQuilltapVersion, __injectQuilltapVersion, getBuiltinToolNames, getQuilltapUserAgent, getQuilltapVersion };
package/dist/index.js CHANGED
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
33
  BUILTIN_TOOL_NAMES: () => BUILTIN_TOOL_NAMES,
34
+ DEFAULT_REQUEST_TIMEOUT_MS: () => DEFAULT_REQUEST_TIMEOUT_MS,
34
35
  OpenAICompatibleProvider: () => OpenAICompatibleProvider,
35
36
  PLUGIN_UTILS_VERSION: () => PLUGIN_UTILS_VERSION,
36
37
  __clearCoreLoggerFactory: () => __clearCoreLoggerFactory,
@@ -38,6 +39,9 @@ __export(src_exports, {
38
39
  __injectCoreLoggerFactory: () => __injectCoreLoggerFactory,
39
40
  __injectQuilltapVersion: () => __injectQuilltapVersion,
40
41
  applyDescriptionLimit: () => applyDescriptionLimit,
42
+ buildRequestAbortSignal: () => buildRequestAbortSignal,
43
+ buildSdkClientOptions: () => buildSdkClientOptions,
44
+ buildSdkRequestOptions: () => buildSdkRequestOptions,
41
45
  convertFromAnthropicFormat: () => convertFromAnthropicFormat,
42
46
  convertFromGoogleFormat: () => convertFromGoogleFormat,
43
47
  convertOpenAIToAnthropicFormat: () => convertOpenAIToAnthropicFormat,
@@ -63,6 +67,7 @@ __export(src_exports, {
63
67
  parseOpenAIToolCalls: () => parseOpenAIToolCalls,
64
68
  parseToolCalls: () => parseToolCalls,
65
69
  resolveHostGateway: () => resolveHostGateway,
70
+ resolveRequestTimeoutMs: () => resolveRequestTimeoutMs,
66
71
  rewriteLocalhostUrl: () => rewriteLocalhostUrl,
67
72
  validateSystemPromptPlugin: () => validateSystemPromptPlugin
68
73
  });
@@ -400,8 +405,29 @@ function getQuilltapUserAgent() {
400
405
  return `Quilltap/${getQuilltapVersion()}`;
401
406
  }
402
407
 
403
- // src/providers/openai-compatible.ts
408
+ // src/providers/request-budget.ts
404
409
  var DEFAULT_REQUEST_TIMEOUT_MS = 3e5;
410
+ function resolveRequestTimeoutMs(params, defaultMs = DEFAULT_REQUEST_TIMEOUT_MS) {
411
+ const requested = params.requestTimeoutMs;
412
+ return typeof requested === "number" && requested > 0 ? requested : defaultMs;
413
+ }
414
+ function buildSdkRequestOptions(params) {
415
+ const requested = params.requestTimeoutMs;
416
+ if (typeof requested !== "number" || requested <= 0) return void 0;
417
+ return { timeout: requested, maxRetries: 0 };
418
+ }
419
+ function buildSdkClientOptions(params, defaultMs = DEFAULT_REQUEST_TIMEOUT_MS) {
420
+ const capped = typeof params.requestTimeoutMs === "number" && params.requestTimeoutMs > 0;
421
+ return {
422
+ timeout: resolveRequestTimeoutMs(params, defaultMs),
423
+ maxRetries: capped ? 0 : 2
424
+ };
425
+ }
426
+ function buildRequestAbortSignal(params, defaultMs = DEFAULT_REQUEST_TIMEOUT_MS) {
427
+ return AbortSignal.timeout(resolveRequestTimeoutMs(params, defaultMs));
428
+ }
429
+
430
+ // src/providers/openai-compatible.ts
405
431
  var DEFAULT_MAX_RETRIES = 2;
406
432
  var OpenAICompatibleProvider = class {
407
433
  /**
@@ -501,10 +527,7 @@ var OpenAICompatibleProvider = class {
501
527
  * @returns Request options for the OpenAI SDK, or undefined to use defaults
502
528
  */
503
529
  buildRequestOptions(params) {
504
- if (typeof params.requestTimeoutMs !== "number" || params.requestTimeoutMs <= 0) {
505
- return void 0;
506
- }
507
- return { timeout: params.requestTimeoutMs, maxRetries: 0 };
530
+ return buildSdkRequestOptions(params);
508
531
  }
509
532
  /**
510
533
  * Sends a message and returns the complete response.
@@ -953,11 +976,12 @@ function rewriteLocalhostUrl(url) {
953
976
  return rewritten;
954
977
  }
955
978
 
956
- // src/index.ts
957
- var PLUGIN_UTILS_VERSION = "2.2.1";
979
+ // src/version.generated.ts
980
+ var PLUGIN_UTILS_VERSION = "2.2.19";
958
981
  // Annotate the CommonJS export names for ESM import in node:
959
982
  0 && (module.exports = {
960
983
  BUILTIN_TOOL_NAMES,
984
+ DEFAULT_REQUEST_TIMEOUT_MS,
961
985
  OpenAICompatibleProvider,
962
986
  PLUGIN_UTILS_VERSION,
963
987
  __clearCoreLoggerFactory,
@@ -965,6 +989,9 @@ var PLUGIN_UTILS_VERSION = "2.2.1";
965
989
  __injectCoreLoggerFactory,
966
990
  __injectQuilltapVersion,
967
991
  applyDescriptionLimit,
992
+ buildRequestAbortSignal,
993
+ buildSdkClientOptions,
994
+ buildSdkRequestOptions,
968
995
  convertFromAnthropicFormat,
969
996
  convertFromGoogleFormat,
970
997
  convertOpenAIToAnthropicFormat,
@@ -990,6 +1017,7 @@ var PLUGIN_UTILS_VERSION = "2.2.1";
990
1017
  parseOpenAIToolCalls,
991
1018
  parseToolCalls,
992
1019
  resolveHostGateway,
1020
+ resolveRequestTimeoutMs,
993
1021
  rewriteLocalhostUrl,
994
1022
  validateSystemPromptPlugin
995
1023
  });