/
opt
/
canhelp
/
node_modules
/
openai
/
lib
/
/opt/canhelp/node_modules/openai/lib
mkdir
upload
Name
Size
Mode
Actions
responses/
-
0755
rm
AbstractChatCompletionRunner.d.mts
4197
0644
edit
dl
rm
AbstractChatCompletionRunner.d.mts.map
2329
0644
edit
dl
rm
AbstractChatCompletionRunner.d.ts
4188
0644
edit
dl
rm
AbstractChatCompletionRunner.d.ts.map
2328
0644
edit
dl
rm
AbstractChatCompletionRunner.js
15183
0644
edit
dl
rm
AbstractChatCompletionRunner.js.map
10106
0644
edit
dl
rm
AbstractChatCompletionRunner.mjs
14723
0644
edit
dl
rm
AbstractChatCompletionRunner.mjs.map
10115
0644
edit
dl
rm
AssistantStream.d.mts
4154
0644
edit
dl
rm
AssistantStream.d.mts.map
3566
0644
edit
dl
rm
AssistantStream.d.ts
4145
0644
edit
dl
rm
AssistantStream.d.ts.map
3565
0644
edit
dl
rm
AssistantStream.js
28889
0644
edit
dl
rm
AssistantStream.js.map
18683
0644
edit
dl
rm
AssistantStream.mjs
28127
0644
edit
dl
rm
AssistantStream.mjs.map
18695
0644
edit
dl
rm
ChatCompletionRunner.d.mts
1235
0644
edit
dl
rm
ChatCompletionRunner.d.mts.map
903
0644
edit
dl
rm
ChatCompletionRunner.d.ts
1229
0644
edit
dl
rm
ChatCompletionRunner.d.ts.map
902
0644
edit
dl
rm
ChatCompletionRunner.js
1046
0644
edit
dl
rm
ChatCompletionRunner.js.map
794
0644
edit
dl
rm
ChatCompletionRunner.mjs
823
0644
edit
dl
rm
ChatCompletionRunner.mjs.map
799
0644
edit
dl
rm
ChatCompletionStream.d.mts
8562
0644
edit
dl
rm
ChatCompletionStream.d.mts.map
4366
0644
edit
dl
rm
ChatCompletionStream.d.ts
8555
0644
edit
dl
rm
ChatCompletionStream.d.ts.map
4365
0644
edit
dl
rm
ChatCompletionStream.js
25693
0644
edit
dl
rm
ChatCompletionStream.js.map
17874
0644
edit
dl
rm
ChatCompletionStream.mjs
25240
0644
edit
dl
rm
ChatCompletionStream.mjs.map
17956
0644
edit
dl
rm
ChatCompletionStreamingRunner.d.mts
1535
0644
edit
dl
rm
ChatCompletionStreamingRunner.d.mts.map
1102
0644
edit
dl
rm
ChatCompletionStreamingRunner.d.ts
1527
0644
edit
dl
rm
ChatCompletionStreamingRunner.d.ts.map
1101
0644
edit
dl
rm
ChatCompletionStreamingRunner.js
1035
0644
edit
dl
rm
ChatCompletionStreamingRunner.js.map
783
0644
edit
dl
rm
ChatCompletionStreamingRunner.mjs
822
0644
edit
dl
rm
ChatCompletionStreamingRunner.mjs.map
784
0644
edit
dl
rm
chatCompletionUtils.d.mts
560
0644
edit
dl
rm
chatCompletionUtils.d.mts.map
465
0644
edit
dl
rm
chatCompletionUtils.d.ts
558
0644
edit
dl
rm
chatCompletionUtils.d.ts.map
464
0644
edit
dl
rm
chatCompletionUtils.js
520
0644
edit
dl
rm
chatCompletionUtils.js.map
463
0644
edit
dl
rm
chatCompletionUtils.mjs
285
0644
edit
dl
rm
chatCompletionUtils.mjs.map
427
0644
edit
dl
rm
EventEmitter.d.mts
2690
0644
edit
dl
rm
EventEmitter.d.mts.map
1346
0644
edit
dl
rm
EventEmitter.d.ts
2689
0644
edit
dl
rm
EventEmitter.d.ts.map
1345
0644
edit
dl
rm
EventEmitter.js
3516
0644
edit
dl
rm
EventEmitter.js.map
1741
0644
edit
dl
rm
EventEmitter.mjs
3330
0644
edit
dl
rm
EventEmitter.mjs.map
1731
0644
edit
dl
rm
EventStream.d.mts
3321
0644
edit
dl
rm
EventStream.d.mts.map
1890
0644
edit
dl
rm
EventStream.d.ts
3319
0644
edit
dl
rm
EventStream.d.ts.map
1889
0644
edit
dl
rm
EventStream.js
10080
0644
edit
dl
rm
EventStream.js.map
5114
0644
edit
dl
rm
EventStream.mjs
9696
0644
edit
dl
rm
EventStream.mjs.map
5121
0644
edit
dl
rm
jsonschema.d.mts
4496
0644
edit
dl
rm
jsonschema.d.mts.map
2780
0644
edit
dl
rm
jsonschema.d.ts
4495
0644
edit
dl
rm
jsonschema.d.ts.map
2779
0644
edit
dl
rm
jsonschema.js
732
0644
edit
dl
rm
jsonschema.js.map
216
0644
edit
dl
rm
jsonschema.mjs
667
0644
edit
dl
rm
jsonschema.mjs.map
216
0644
edit
dl
rm
parser.d.mts
3942
0644
edit
dl
rm
parser.d.mts.map
3068
0644
edit
dl
rm
parser.d.ts
3938
0644
edit
dl
rm
parser.d.ts.map
3067
0644
edit
dl
rm
parser.js
6786
0644
edit
dl
rm
parser.js.map
5355
0644
edit
dl
rm
parser.mjs
6077
0644
edit
dl
rm
parser.mjs.map
5289
0644
edit
dl
rm
ResponsesParser.d.mts
2561
0644
edit
dl
rm
ResponsesParser.d.mts.map
2258
0644
edit
dl
rm
ResponsesParser.d.ts
2557
0644
edit
dl
rm
ResponsesParser.d.ts.map
2257
0644
edit
dl
rm
ResponsesParser.js
5622
0644
edit
dl
rm
ResponsesParser.js.map
4870
0644
edit
dl
rm
ResponsesParser.mjs
5202
0644
edit
dl
rm
ResponsesParser.mjs.map
4816
0644
edit
dl
rm
RunnableFunction.d.mts
3766
0644
edit
dl
rm
RunnableFunction.d.mts.map
2432
0644
edit
dl
rm
RunnableFunction.d.ts
3762
0644
edit
dl
rm
RunnableFunction.d.ts.map
2431
0644
edit
dl
rm
RunnableFunction.js
629
0644
edit
dl
rm
RunnableFunction.js.map
373
0644
edit
dl
rm
RunnableFunction.mjs
411
0644
edit
dl
rm
RunnableFunction.mjs.map
358
0644
edit
dl
rm
transform.d.mts
168
0644
edit
dl
rm
transform.d.mts.map
198
0644
edit
dl
rm
transform.d.ts
166
0644
edit
dl
rm
transform.d.ts.map
197
0644
edit
dl
rm
transform.js
6216
0644
edit
dl
rm
transform.js.map
5898
0644
edit
dl
rm
transform.mjs
6098
0644
edit
dl
rm
transform.mjs.map
5890
0644
edit
dl
rm
Util.d.mts
211
0644
edit
dl
rm
Util.d.mts.map
221
0644
edit
dl
rm
Util.d.ts
210
0644
edit
dl
rm
Util.d.ts.map
220
0644
edit
dl
rm
Util.js
950
0644
edit
dl
rm
Util.js.map
805
0644
edit
dl
rm
Util.mjs
792
0644
edit
dl
rm
Util.mjs.map
787
0644
edit
dl
rm
Edit:
/opt/canhelp/node_modules/openai/lib/transform.mjs
(6098B)
export function toStrictJsonSchema(schema) { if (schema.type !== 'object') { throw new Error(`Root schema must have type: 'object' but got type: ${schema.type ? `'${schema.type}'` : 'undefined'}`); } const schemaCopy = structuredClone(schema); return ensureStrictJsonSchema(schemaCopy, [], schemaCopy); } function isNullable(schema) { if (typeof schema === 'boolean') { return false; } if (schema.type === 'null') { return true; } for (const oneOfVariant of schema.oneOf ?? []) { if (isNullable(oneOfVariant)) { return true; } } for (const allOfVariant of schema.anyOf ?? []) { if (isNullable(allOfVariant)) { return true; } } return false; } /** * Mutates the given JSON schema to ensure it conforms to the `strict` standard * that the API expects. */ function ensureStrictJsonSchema(jsonSchema, path, root) { if (typeof jsonSchema === 'boolean') { throw new TypeError(`Expected object schema but got boolean; path=${path.join('/')}`); } if (!isObject(jsonSchema)) { throw new TypeError(`Expected ${JSON.stringify(jsonSchema)} to be an object; path=${path.join('/')}`); } // Handle $defs (non-standard but sometimes used) const defs = jsonSchema.$defs; if (isObject(defs)) { for (const [defName, defSchema] of Object.entries(defs)) { ensureStrictJsonSchema(defSchema, [...path, '$defs', defName], root); } } // Handle definitions (draft-04 style, deprecated in draft-07 but still used) const definitions = jsonSchema.definitions; if (isObject(definitions)) { for (const [definitionName, definitionSchema] of Object.entries(definitions)) { ensureStrictJsonSchema(definitionSchema, [...path, 'definitions', definitionName], root); } } // Add additionalProperties: false to object types const typ = jsonSchema.type; if (typ === 'object' && !('additionalProperties' in jsonSchema)) { jsonSchema.additionalProperties = false; } const required = jsonSchema.required ?? []; // Handle object properties const properties = jsonSchema.properties; if (isObject(properties)) { for (const [key, value] of Object.entries(properties)) { if (!isNullable(value) && !required.includes(key)) { throw new Error(`Zod field at \`${[...path, 'properties', key].join('/')}\` uses \`.optional()\` without \`.nullable()\` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required`); } } jsonSchema.required = Object.keys(properties); jsonSchema.properties = Object.fromEntries(Object.entries(properties).map(([key, propSchema]) => [ key, ensureStrictJsonSchema(propSchema, [...path, 'properties', key], root), ])); } // Handle arrays const items = jsonSchema.items; if (isObject(items)) { jsonSchema.items = ensureStrictJsonSchema(items, [...path, 'items'], root); } // Handle unions (anyOf) const anyOf = jsonSchema.anyOf; if (Array.isArray(anyOf)) { jsonSchema.anyOf = anyOf.map((variant, i) => ensureStrictJsonSchema(variant, [...path, 'anyOf', String(i)], root)); } // Handle intersections (allOf) const allOf = jsonSchema.allOf; if (Array.isArray(allOf)) { if (allOf.length === 1) { const resolved = ensureStrictJsonSchema(allOf[0], [...path, 'allOf', '0'], root); Object.assign(jsonSchema, resolved); delete jsonSchema.allOf; } else { jsonSchema.allOf = allOf.map((entry, i) => ensureStrictJsonSchema(entry, [...path, 'allOf', String(i)], root)); } } // Strip `null` defaults as there's no meaningful distinction if (jsonSchema.default === null) { delete jsonSchema.default; } // Handle $ref with additional properties const ref = jsonSchema.$ref; if (ref && hasMoreThanNKeys(jsonSchema, 1)) { if (typeof ref !== 'string') { throw new TypeError(`Received non-string $ref - ${ref}; path=${path.join('/')}`); } const resolved = resolveRef(root, ref); if (typeof resolved === 'boolean') { throw new Error(`Expected \`$ref: ${ref}\` to resolve to an object schema but got boolean`); } if (!isObject(resolved)) { throw new Error(`Expected \`$ref: ${ref}\` to resolve to an object but got ${JSON.stringify(resolved)}`); } // Properties from the json schema take priority over the ones on the `$ref` Object.assign(jsonSchema, { ...resolved, ...jsonSchema }); delete jsonSchema.$ref; // Since the schema expanded from `$ref` might not have `additionalProperties: false` applied, // we call `ensureStrictJsonSchema` again to fix the inlined schema and ensure it's valid. return ensureStrictJsonSchema(jsonSchema, path, root); } return jsonSchema; } function resolveRef(root, ref) { if (!ref.startsWith('#/')) { throw new Error(`Unexpected $ref format ${JSON.stringify(ref)}; Does not start with #/`); } const pathParts = ref.slice(2).split('/'); let resolved = root; for (const key of pathParts) { if (!isObject(resolved)) { throw new Error(`encountered non-object entry while resolving ${ref} - ${JSON.stringify(resolved)}`); } const value = resolved[key]; if (value === undefined) { throw new Error(`Key ${key} not found while resolving ${ref}`); } resolved = value; } return resolved; } function isObject(obj) { return typeof obj === 'object' && obj !== null && !Array.isArray(obj); } function hasMoreThanNKeys(obj, n) { let i = 0; for (const _ in obj) { i++; if (i > n) { return true; } } return false; } //# sourceMappingURL=transform.mjs.map
Save
cmd:
run