@veryfront/ext-llm-openai 0.1.1271-rc.23355 → 0.1.1271

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.
@@ -1 +1 @@
1
- {"version":3,"file":"openai-chat-request-builder.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-llm-openai/src/openai-chat-request-builder.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,2BAA2B,CAAC;AAOnC,MAAM,WAAW,+BAAgC,SAAQ,uBAAuB;IAC9E,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IACpD,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,QAAQ,CAAC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IAC9C,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAC3C,CAAC;AAEF,yFAAyF;AACzF,MAAM,MAAM,qBAAqB,GAAG,0BAA0B,CAAC;AAE/D,KAAK,gBAAgB,GAAG;IACtB,IAAI,CAAC,OAAO,EAAE;QACZ,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,IAAI,CAAC;IACT,KAAK,IAAI,KAAK,CAAC;QACb,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ,CAAC;AAUF,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,+BAA+B,EACxC,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,gBAAgB,EAC1B,YAAY,CAAC,EAAE,6BAA6B,GAC3C,2BAA2B,CAmJ7B"}
1
+ {"version":3,"file":"openai-chat-request-builder.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-llm-openai/src/openai-chat-request-builder.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,2BAA2B,CAAC;AAanC,MAAM,WAAW,+BAAgC,SAAQ,uBAAuB;IAC9E,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IACpD,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,QAAQ,CAAC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IAC9C,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAC3C,CAAC;AAEF,yFAAyF;AACzF,MAAM,MAAM,qBAAqB,GAAG,0BAA0B,CAAC;AAE/D,KAAK,gBAAgB,GAAG;IACtB,IAAI,CAAC,OAAO,EAAE;QACZ,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,IAAI,CAAC;IACT,KAAK,IAAI,KAAK,CAAC;QACb,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ,CAAC;AAUF,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,+BAA+B,EACxC,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,gBAAgB,EAC1B,YAAY,CAAC,EAAE,6BAA6B,GAC3C,2BAA2B,CAqJ7B"}
@@ -1,6 +1,8 @@
1
- import { readProviderOptions, toOpenAICompatibleMessages, toOpenAICompatibleTools, unwrapToolInputSchema, } from "veryfront/provider/shared";
1
+ import { toOpenAICompatibleMessages, toOpenAICompatibleTools, unwrapToolInputSchema, } from "veryfront/provider/shared";
2
2
  import { rejectsOpenAISamplingParams, resolveOpenAIReasoningConfig, } from "./openai-reasoning-models.js";
3
- import { defineOpenAIProviderOptions } from "./openai-provider-options.js";
3
+ import { defineOpenAIProviderOptions, readOpenAIProviderOptions, } from "./openai-provider-options.js";
4
+ const ArrayIsArray = Array.isArray;
5
+ const ObjectHasOwn = Object.hasOwn;
4
6
  function isNativeOpenAIModel(modelId) {
5
7
  return /^(gpt-|o[134](-|$)|chatgpt-)/.test(modelId);
6
8
  }
@@ -13,16 +15,15 @@ export function buildOpenAIChatRequest(modelId, providerName, options, stream, w
13
15
  // keep merging that bucket at the lowest precedence. max_tokens is normalized
14
16
  // per bucket BEFORE merging so a higher-precedence bucket's max_tokens
15
17
  // override still beats a lower bucket's max_completion_tokens.
16
- const bucketNames = [
17
- ...(providerName === "openai" ? ["openai-compatible"] : []),
18
- "openai",
19
- providerName,
20
- ];
18
+ const bucketNames = providerName === "openai"
19
+ ? ["openai-compatible", "openai", providerName]
20
+ : ["openai", providerName];
21
21
  const providerOpts = {};
22
- for (const bucketName of bucketNames) {
23
- defineOpenAIProviderOptions(providerOpts, normalizeNativeMaxTokens(readProviderOptions(options.providerOptions, bucketName), modelId));
22
+ for (let index = 0; index < bucketNames.length; index += 1) {
23
+ const bucketName = bucketNames[index];
24
+ defineOpenAIProviderOptions(providerOpts, normalizeNativeMaxTokens(readOpenAIProviderOptions(options.providerOptions, [bucketName]), modelId));
24
25
  }
25
- const finalTools = Object.hasOwn(providerOpts, "tools") ? providerOpts.tools : tools;
26
+ const finalTools = ObjectHasOwn(providerOpts, "tools") ? providerOpts.tools : tools;
26
27
  const resolvedReasoning = resolveOpenAIReasoningConfig(modelId, providerName, options.reasoning);
27
28
  const suppressReasoningForFunctionTools = hasOpenAIFunctionTools(finalTools) &&
28
29
  capabilities?.reasoningWithFunctionTools === false;
@@ -146,10 +147,11 @@ export function buildOpenAIChatRequest(modelId, providerName, options, stream, w
146
147
  return body;
147
148
  }
148
149
  function hasOpenAIFunctionTools(value) {
149
- if (!Array.isArray(value)) {
150
+ if (!ArrayIsArray(value)) {
150
151
  return false;
151
152
  }
152
- for (const tool of value) {
153
+ for (let index = 0; index < value.length; index += 1) {
154
+ const tool = value[index];
153
155
  if (typeof tool === "object" &&
154
156
  tool !== null &&
155
157
  "type" in tool &&
@@ -3,4 +3,5 @@
3
3
  * as `Object.prototype.__proto__`.
4
4
  */
5
5
  export declare function defineOpenAIProviderOptions(target: Record<string, unknown>, source: Record<string, unknown>): void;
6
+ export declare function readOpenAIProviderOptions(providerOptions: Record<string, unknown> | undefined, providerNames: readonly string[]): Record<string, unknown>;
6
7
  //# sourceMappingURL=openai-provider-options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"openai-provider-options.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-llm-openai/src/openai-provider-options.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,IAAI,CASN"}
1
+ {"version":3,"file":"openai-provider-options.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-llm-openai/src/openai-provider-options.ts"],"names":[],"mappings":"AA4DA;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,IAAI,CAON;AAED,wBAAgB,yBAAyB,CACvC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EACpD,aAAa,EAAE,SAAS,MAAM,EAAE,GAC/B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAyBzB"}
@@ -1,14 +1,85 @@
1
+ const ReflectApply = Reflect.apply;
2
+ const ObjectDefineProperty = Object.defineProperty;
3
+ const ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
4
+ const ObjectHasOwn = Object.hasOwn;
5
+ const ObjectKeys = Object.keys;
6
+ const ArrayIsArray = Array.isArray;
7
+ function objectKeys(value) {
8
+ return ReflectApply(ObjectKeys, Object, [value]);
9
+ }
10
+ function defineOwnDataProperty(target, key, value) {
11
+ ReflectApply(ObjectDefineProperty, Object, [target, key, {
12
+ value,
13
+ writable: true,
14
+ enumerable: true,
15
+ configurable: true,
16
+ }]);
17
+ }
18
+ function readProviderBucket(providerOptions, providerName) {
19
+ let descriptor;
20
+ try {
21
+ descriptor = ReflectApply(ObjectGetOwnPropertyDescriptor, Object, [
22
+ providerOptions,
23
+ providerName,
24
+ ]);
25
+ }
26
+ catch {
27
+ throw new TypeError(`Provider options for "${providerName}" could not be read`);
28
+ }
29
+ if (!descriptor)
30
+ return undefined;
31
+ if (!ReflectApply(ObjectHasOwn, Object, [descriptor, "value"])) {
32
+ throw new TypeError(`Provider options for "${providerName}" must be a data property`);
33
+ }
34
+ return descriptor.value;
35
+ }
36
+ function readProviderOption(providerName, bucket, key) {
37
+ let descriptor;
38
+ try {
39
+ descriptor = ReflectApply(ObjectGetOwnPropertyDescriptor, Object, [bucket, key]);
40
+ }
41
+ catch {
42
+ throw new TypeError(`Provider options for "${providerName}" could not be enumerated`);
43
+ }
44
+ if (!descriptor?.enumerable)
45
+ return undefined;
46
+ if (!ReflectApply(ObjectHasOwn, Object, [descriptor, "value"])) {
47
+ throw new TypeError(`Provider options for "${providerName}" must contain data properties`);
48
+ }
49
+ return descriptor.value;
50
+ }
1
51
  /**
2
52
  * Merge provider-native options without invoking legacy prototype setters such
3
53
  * as `Object.prototype.__proto__`.
4
54
  */
5
55
  export function defineOpenAIProviderOptions(target, source) {
6
- for (const key of Object.keys(source)) {
7
- Object.defineProperty(target, key, {
8
- value: source[key],
9
- writable: true,
10
- enumerable: true,
11
- configurable: true,
12
- });
56
+ const keys = objectKeys(source);
57
+ for (let index = 0; index < keys.length; index += 1) {
58
+ const key = keys[index];
59
+ const value = readProviderOption("openai", source, key);
60
+ defineOwnDataProperty(target, key, value);
61
+ }
62
+ }
63
+ export function readOpenAIProviderOptions(providerOptions, providerNames) {
64
+ const output = {};
65
+ if (!providerOptions)
66
+ return output;
67
+ for (let providerIndex = 0; providerIndex < providerNames.length; providerIndex += 1) {
68
+ const providerName = providerNames[providerIndex];
69
+ const bucket = readProviderBucket(providerOptions, providerName);
70
+ if (bucket === null || typeof bucket !== "object" || ArrayIsArray(bucket))
71
+ continue;
72
+ let keys;
73
+ try {
74
+ keys = objectKeys(bucket);
75
+ }
76
+ catch {
77
+ throw new TypeError(`Provider options for "${providerName}" could not be enumerated`);
78
+ }
79
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex += 1) {
80
+ const key = keys[keyIndex];
81
+ defineOwnDataProperty(output, key, readProviderOption(providerName, bucket, key));
82
+ }
13
83
  }
84
+ return output;
14
85
  }
@@ -1 +1 @@
1
- {"version":3,"file":"openai-provider.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-llm-openai/src/openai-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,2BAA2B,EAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,kBAAkB,EAQlB,aAAa,EACb,UAAU,EAEV,iBAAiB,EACjB,aAAa,EACb,uBA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IAa7E,eAAe,CACb,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,iBAAiB,GACxB,YAAY,CAAC,+BAA+B,EAAE,2BAA2B,CAAC;CAY9E"}
1
+ {"version":3,"file":"openai-provider.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-llm-openai/src/openai-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,2BAA2B,EAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,kBAAkB,EAQlB,aAAa,EACb,UAAU,EAEV,iBAAiB,EACjB,aAAa,EACb,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EAQpB,+BAA+B,EAEhC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,KAAK,6BAA6B,EAClC,KAAK,+BAA+B,EACrC,MAAM,kCAAkC,CAAC;AA+B1C,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,+BAA+B,GAChC,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gGAAgG;IAChG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uBAAuB,CAAC,EAAE,6BAA6B,CAAC;IACxD,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAk7BD,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,MAAM,GACd,YAAY,CAAC,+BAA+B,EAAE,2BAA2B,CAAC,CAsF5E;AAMD,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,MAAM,GACd,YAAY,CAAC,+BAA+B,EAAE,2BAA2B,CAAC,CA8J5E;AA2DD,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,MAAM,GACd,gBAAgB,CA4ClB;AAED,qBAAa,cAAe,YAAW,WAAW;IAChD,QAAQ,CAAC,EAAE,YAAY;IAEvB,WAAW,CACT,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,iBAAiB,GACxB,YAAY,CAAC,+BAA+B,EAAE,2BAA2B,CAAC;IAyC7E,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,gBAAgB;IAa7E,eAAe,CACb,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,iBAAiB,GACxB,YAAY,CAAC,+BAA+B,EAAE,2BAA2B,CAAC;CAY9E"}
@@ -697,6 +697,7 @@ export function createOpenAIModelRuntime(config, modelId) {
697
697
  provider: providerLabel,
698
698
  modelProvider: providerName,
699
699
  modelId,
700
+ openAITransport: "chat-completions",
700
701
  specificationVersion: "v3",
701
702
  supportedUrls: {},
702
703
  runtimeCapabilities: { structuredOutput: true },
@@ -769,6 +770,7 @@ export function createOpenAIResponsesRuntime(config, modelId) {
769
770
  provider: providerLabel,
770
771
  modelProvider: providerName,
771
772
  modelId,
773
+ openAITransport: "responses",
772
774
  specificationVersion: "v3",
773
775
  supportedUrls: {},
774
776
  runtimeCapabilities: { structuredOutput: true },
@@ -920,6 +922,7 @@ function createOpenAIChatCompletionsOnlyRuntime(chatRuntime, hostedToolReason) {
920
922
  function createOpenAIAdaptiveModelRuntime(chatRuntime, responsesRuntime) {
921
923
  return {
922
924
  ...chatRuntime,
925
+ openAITransport: "auto",
923
926
  doGenerate(optionsForRuntime) {
924
927
  return requestUsesOpenAIHostedTool(optionsForRuntime)
925
928
  ? responsesRuntime.doGenerate(optionsForRuntime)
@@ -1 +1 @@
1
- {"version":3,"file":"openai-responses-request-builder.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-llm-openai/src/openai-responses-request-builder.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAoBxF,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,wBAAwB,EAAE,CAAC;IAClC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,IAAI,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;IAC3C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,IAAI,CAAC,OAAO,EAAE;QACZ,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,IAAI,CAAC;IACT,KAAK,IAAI,KAAK,CAAC;QACb,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ,CAAC;AAyYF,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,+BAA+B,EACxC,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,gBAAgB,GACzB,sBAAsB,CAgJxB"}
1
+ {"version":3,"file":"openai-responses-request-builder.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-llm-openai/src/openai-responses-request-builder.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAyBxF,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,wBAAwB,EAAE,CAAC;IAClC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,IAAI,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;IAC3C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,IAAI,CAAC,OAAO,EAAE;QACZ,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,IAAI,CAAC;IACT,KAAK,IAAI,KAAK,CAAC;QACb,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC;QACtC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ,CAAC;AAyYF,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,+BAA+B,EACxC,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,gBAAgB,GACzB,sBAAsB,CA8IxB"}
@@ -1,8 +1,9 @@
1
- import { jsonValuesEqual, readProviderOptions, stringifyToolArguments, stringifyToolResultValue, unwrapToolInputSchema, } from "veryfront/provider/shared";
1
+ import { jsonValuesEqual, stringifyToolArguments, stringifyToolResultValue, unwrapToolInputSchema, } from "veryfront/provider/shared";
2
2
  import { rejectsOpenAISamplingParams, resolveOpenAIReasoningConfig, shouldRequestOpenAIReasoningSummary, } from "./openai-reasoning-models.js";
3
- import { defineOpenAIProviderOptions } from "./openai-provider-options.js";
3
+ import { defineOpenAIProviderOptions, readOpenAIProviderOptions, } from "./openai-provider-options.js";
4
4
  import { isBoundedOpenAIStreamString, MAX_OPENAI_STREAM_TOOL_NAME_BYTES, } from "./openai-stream-metadata.js";
5
5
  import { normalizeOpenAIWebSearchCall, OPENAI_REASONING_ENCRYPTED_CONTENT_INCLUDE, OPENAI_WEB_SEARCH_SOURCES_INCLUDE, readOpenAIRawResponseOutputItems, resolveOpenAIWebSearchDescriptor, } from "./openai-web-search.js";
6
+ const ObjectHasOwn = Object.hasOwn;
6
7
  function invalidOpenAIProviderHistory() {
7
8
  return new TypeError("OpenAI raw response metadata did not match canonical provider tool history");
8
9
  }
@@ -398,7 +399,10 @@ export function buildOpenAIResponsesRequest(modelId, providerName, options, stre
398
399
  };
399
400
  // Env-BYOK users historically registered options under "openai-compatible";
400
401
  // keep merging that bucket at the lowest precedence.
401
- defineOpenAIProviderOptions(body, readProviderOptions(options.providerOptions, ...(providerName === "openai" ? ["openai-compatible"] : []), "openai", providerName));
402
+ const bucketNames = providerName === "openai"
403
+ ? ["openai-compatible", "openai", providerName]
404
+ : ["openai", providerName];
405
+ defineOpenAIProviderOptions(body, readOpenAIProviderOptions(options.providerOptions, bucketNames));
402
406
  // Keep provider-native tuning extensible without allowing raw options to
403
407
  // replace the runtime-owned transport, prompt, model, or privacy contract.
404
408
  body.model = modelId;
@@ -431,7 +435,7 @@ export function buildOpenAIResponsesRequest(modelId, providerName, options, stre
431
435
  ]),
432
436
  ];
433
437
  }
434
- if (Object.hasOwn(body, "background")) {
438
+ if (ObjectHasOwn(body, "background")) {
435
439
  delete body.background;
436
440
  warnings.push({
437
441
  type: "unsupported-setting",
@@ -1 +1 @@
1
- {"version":3,"file":"openai-reasoning.d.ts","sourceRoot":"","sources":["../../../../src/src/provider/shared/openai-reasoning.ts"],"names":[],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AAC,CAAC,CAAC;AAE1F,MAAM,MAAM,6BAA6B,GAAG,sBAAsB,CAAC;AAEnE,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,MAAM,EAAE,SAAS,GAAG,UAAU,CAAC;CAChC,CAAC;AAeF,wBAAgB,8BAA8B,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAG5E;AAuBD,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,MAAM,EACf,YAAY,SAAW,GACtB,qBAAqB,GAAG,SAAS,CA0BnC;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,6BAA6B,GAAG,SAAS,GAChD,uBAAuB,GAAG,SAAS,CAoBrC;AAED,wBAAgB,mCAAmC,CACjD,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,uBAAuB,GACjC,OAAO,CAIT;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,SAAW,GAAG,OAAO,CAExF;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAIpE"}
@@ -1,26 +1,36 @@
1
+ import { execPrivateRegExp, testPrivateRegExp } from "../../security/private-regexp.js";
1
2
  const DEFAULT_REASONING_EFFORT = "medium";
3
+ const ReflectApply = Reflect.apply;
4
+ const NumberParseInt = Number.parseInt;
5
+ const StringPrototypeToLowerCase = String.prototype.toLowerCase;
6
+ function stringToLowerCase(value) {
7
+ return ReflectApply(StringPrototypeToLowerCase, value, []);
8
+ }
9
+ function numberParseInt(value, radix) {
10
+ return ReflectApply(NumberParseInt, Number, [value, radix]);
11
+ }
2
12
  export function supportsDefaultReasoningParams(providerName) {
3
- const normalizedProvider = providerName.toLowerCase();
13
+ const normalizedProvider = stringToLowerCase(providerName);
4
14
  return normalizedProvider === "openai" || normalizedProvider === "veryfront-cloud";
5
15
  }
6
16
  function isGpt5ChatSnapshot(modelId) {
7
- return /^gpt-5-chat($|-)/.test(modelId);
17
+ return testPrivateRegExp(/^gpt-5-chat($|-)/, modelId);
8
18
  }
9
19
  function isGpt51(modelId) {
10
- return /^gpt-5\.1($|-)/.test(modelId);
20
+ return testPrivateRegExp(/^gpt-5\.1($|-)/, modelId);
11
21
  }
12
22
  function isReasoningCapableGpt5(modelId) {
13
23
  if (isGpt5ChatSnapshot(modelId) || isGpt51(modelId)) {
14
24
  return false;
15
25
  }
16
- if (/^gpt-5(-|$)/.test(modelId)) {
26
+ if (testPrivateRegExp(/^gpt-5(-|$)/, modelId)) {
17
27
  return true;
18
28
  }
19
- const gpt5Version = /^gpt-5\.(\d+)(-|$)/.exec(modelId)?.[1];
20
- return gpt5Version !== undefined && Number.parseInt(gpt5Version, 10) >= 2;
29
+ const gpt5Version = execPrivateRegExp(/^gpt-5\.(\d+)(-|$)/, modelId)?.[1];
30
+ return gpt5Version !== undefined && numberParseInt(gpt5Version, 10) >= 2;
21
31
  }
22
32
  export function getDefaultOpenAIReasoningEffort(modelId, providerName = "openai") {
23
- const normalized = modelId.toLowerCase();
33
+ const normalized = stringToLowerCase(modelId);
24
34
  if (!supportsDefaultReasoningParams(providerName)) {
25
35
  return undefined;
26
36
  }
@@ -31,7 +41,7 @@ export function getDefaultOpenAIReasoningEffort(modelId, providerName = "openai"
31
41
  if (isGpt51(normalized)) {
32
42
  return undefined;
33
43
  }
34
- if (/^o1($|-\d)/.test(normalized) || /^o[34](-|$)/.test(normalized)) {
44
+ if (testPrivateRegExp(/^o1($|-\d)/, normalized) || testPrivateRegExp(/^o[34](-|$)/, normalized)) {
35
45
  return DEFAULT_REASONING_EFFORT;
36
46
  }
37
47
  if (isReasoningCapableGpt5(normalized)) {
@@ -61,12 +71,12 @@ export function resolveOpenAIReasoningConfig(modelId, providerName, option) {
61
71
  export function shouldRequestOpenAIReasoningSummary(providerName, reasoning) {
62
72
  // Default-reasoning BYOK "openai" requests must not ask for summaries:
63
73
  // unverified customer organizations get a 400 from the Responses API.
64
- return reasoning.source === "explicit" || providerName.toLowerCase() === "veryfront-cloud";
74
+ return reasoning.source === "explicit" || stringToLowerCase(providerName) === "veryfront-cloud";
65
75
  }
66
76
  export function isOpenAIReasoningModel(modelId, providerName = "openai") {
67
77
  return getDefaultOpenAIReasoningEffort(modelId, providerName) !== undefined;
68
78
  }
69
79
  export function rejectsOpenAISamplingParams(modelId) {
70
- const normalized = modelId.toLowerCase();
71
- return /^o[134]($|-)/.test(normalized) || isReasoningCapableGpt5(normalized);
80
+ const normalized = stringToLowerCase(modelId);
81
+ return testPrivateRegExp(/^o[134]($|-)/, normalized) || isReasoningCapableGpt5(normalized);
72
82
  }
@@ -0,0 +1,3 @@
1
+ /** Define own data without inherited descriptor accessors or target setters. */
2
+ export declare function defineOwnDataProperty<T extends object>(target: T, key: PropertyKey, value: unknown, attributes?: Pick<PropertyDescriptor, "enumerable" | "configurable" | "writable">): T;
3
+ //# sourceMappingURL=own-data-property.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"own-data-property.d.ts","sourceRoot":"","sources":["../../../src/src/security/own-data-property.ts"],"names":[],"mappings":"AAGA,gFAAgF;AAChF,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EACpD,MAAM,EAAE,CAAC,EACT,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,OAAO,EACd,UAAU,GAAE,IAAI,CAAC,kBAAkB,EAAE,YAAY,GAAG,cAAc,GAAG,UAAU,CAAM,GACpF,CAAC,CASH"}
@@ -0,0 +1,13 @@
1
+ const defineProperty = Object.defineProperty;
2
+ const hasOwn = Object.hasOwn;
3
+ /** Define own data without inherited descriptor accessors or target setters. */
4
+ export function defineOwnDataProperty(target, key, value, attributes = {}) {
5
+ const descriptor = {
6
+ __proto__: null,
7
+ value,
8
+ enumerable: hasOwn(attributes, "enumerable") && attributes.enumerable === true,
9
+ configurable: hasOwn(attributes, "configurable") && attributes.configurable === true,
10
+ writable: hasOwn(attributes, "writable") && attributes.writable === true,
11
+ };
12
+ return defineProperty(target, key, descriptor);
13
+ }
@@ -0,0 +1,7 @@
1
+ /** Match private text without dispatching through a mutable matcher method. */
2
+ export declare function execPrivateRegExp(pattern: RegExp, text: string): RegExpExecArray | null;
3
+ /** Test private text with the captured native matcher. */
4
+ export declare function testPrivateRegExp(pattern: RegExp, text: string): boolean;
5
+ /** Replace text using a private matcher without mutating caller-owned regex state. */
6
+ export declare function replacePrivateRegExp(pattern: RegExp, text: string, replacement: string): string;
7
+ //# sourceMappingURL=private-regexp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private-regexp.d.ts","sourceRoot":"","sources":["../../../src/src/security/private-regexp.ts"],"names":[],"mappings":"AAuBA,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAEvF;AAED,0DAA0D;AAC1D,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAExE;AAoBD,sFAAsF;AACtF,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAE/F"}
@@ -0,0 +1,51 @@
1
+ import { defineOwnDataProperty } from "./own-data-property.js";
2
+ const NativeRegExp = RegExp;
3
+ const apply = Reflect.apply;
4
+ const exec = RegExp.prototype.exec;
5
+ const replace = RegExp.prototype[Symbol.replace];
6
+ const source = Object.getOwnPropertyDescriptor(RegExp.prototype, "source").get;
7
+ const flagNames = [
8
+ ["hasIndices", "d"],
9
+ ["global", "g"],
10
+ ["ignoreCase", "i"],
11
+ ["multiline", "m"],
12
+ ["dotAll", "s"],
13
+ ["unicode", "u"],
14
+ ["unicodeSets", "v"],
15
+ ["sticky", "y"],
16
+ ];
17
+ const flagGetters = flagNames.map(([name, flag]) => ({
18
+ name,
19
+ flag,
20
+ get: Object.getOwnPropertyDescriptor(RegExp.prototype, name)?.get,
21
+ }));
22
+ /** Match private text without dispatching through a mutable matcher method. */
23
+ export function execPrivateRegExp(pattern, text) {
24
+ return apply(exec, copyPrivateMatcher(pattern), [text]);
25
+ }
26
+ /** Test private text with the captured native matcher. */
27
+ export function testPrivateRegExp(pattern, text) {
28
+ return execPrivateRegExp(pattern, text) !== null;
29
+ }
30
+ function copyPrivateMatcher(pattern) {
31
+ let flags = "";
32
+ const enabled = [];
33
+ for (let index = 0; index < flagGetters.length; index++) {
34
+ const entry = flagGetters[index];
35
+ const active = entry.get !== undefined && apply(entry.get, pattern, []);
36
+ defineOwnDataProperty(enabled, index, active);
37
+ if (active)
38
+ flags += entry.flag;
39
+ }
40
+ const matcher = new NativeRegExp(apply(source, pattern, []), flags);
41
+ matcher.lastIndex = pattern.lastIndex;
42
+ defineOwnDataProperty(matcher, "exec", exec);
43
+ for (let index = 0; index < flagGetters.length; index++) {
44
+ defineOwnDataProperty(matcher, flagGetters[index].name, enabled[index]);
45
+ }
46
+ return matcher;
47
+ }
48
+ /** Replace text using a private matcher without mutating caller-owned regex state. */
49
+ export function replacePrivateRegExp(pattern, text, replacement) {
50
+ return apply(replace, copyPrivateMatcher(pattern), [text, replacement]);
51
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veryfront/ext-llm-openai",
3
- "version": "0.1.1271-rc.23355",
3
+ "version": "0.1.1271",
4
4
  "description": "Veryfront first-party extension package for ext-llm-openai",
5
5
  "keywords": [
6
6
  "veryfront",
@@ -45,7 +45,7 @@
45
45
  "capabilities": []
46
46
  },
47
47
  "peerDependencies": {
48
- "veryfront": "^0.1.1271-rc.23355"
48
+ "veryfront": "^0.1.1271"
49
49
  },
50
50
  "type": "module",
51
51
  "types": "./esm/extensions/ext-llm-openai/src/index.d.ts",
@@ -55,5 +55,5 @@
55
55
  "NOTICE",
56
56
  "README.md"
57
57
  ],
58
- "gitHead": "da5cc33d9fb1f26dd3ce530670c155d37ce3526b"
58
+ "gitHead": "48e040987859350ca028ed696b8774ca092d1846"
59
59
  }