@ai-translate/provider-openai 0.1.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.
- package/LICENSE +21 -0
- package/dist/index.d.mts +39 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +81 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Thiago Peres
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ReasoningEffort, SEMANTIC_AUDIT_OUTPUT_CONTRACT_MATERIAL, SEMANTIC_AUDIT_OUTPUT_CONTRACT_REVISION, SemanticAuditOutputContractMaterial, SemanticAuditPrompt, SemanticAuditPromptArgs, SemanticAuditResponseCache, StructuredCompletionMessage, StructuredCompletionRequest, StructuredCompletionTransport, StructuredCompletionTransport as StructuredCompletionTransport$1, StructuredSemanticAuditProvider, StructuredSemanticAuditProviderOptions, StructuredTranslationProvider, StructuredTranslationProviderOptions, SystemPrompt, SystemPromptArgs, TRANSLATION_OUTPUT_CONTRACT_MATERIAL, TRANSLATION_OUTPUT_CONTRACT_REVISION, TranslationOutputContractMaterial, createSemanticAuditOutputContractRevision, createTranslationOutputContractRevision } from "@ai-translate/provider-core";
|
|
2
|
+
import OpenAI from "openai";
|
|
3
|
+
import { SemanticAuditProvider, TranslationProvider } from "@ai-translate/core/types";
|
|
4
|
+
//#region src/index.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Reasoning-capable and inexpensive. Callers who want a different trade-off
|
|
7
|
+
* pass `model` explicitly.
|
|
8
|
+
*/
|
|
9
|
+
declare const DEFAULT_MODEL = "gpt-5.6-luna";
|
|
10
|
+
interface OpenAiTransportOptions {
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
client?: OpenAI;
|
|
13
|
+
requestTimeoutMs?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Speaks the OpenAI Chat Completions dialect of the engine's request contract.
|
|
17
|
+
* Retries stay off here because the engine owns the retry and repair loop.
|
|
18
|
+
*/
|
|
19
|
+
declare function createOpenAiTransport(options?: OpenAiTransportOptions): StructuredCompletionTransport$1;
|
|
20
|
+
interface OpenAiTranslationProviderOptions extends Omit<StructuredTranslationProviderOptions, "model" | "transport"> {
|
|
21
|
+
apiKey?: string;
|
|
22
|
+
client?: OpenAI;
|
|
23
|
+
model?: string;
|
|
24
|
+
}
|
|
25
|
+
declare class OpenAiTranslationProvider extends StructuredTranslationProvider {
|
|
26
|
+
constructor(options?: OpenAiTranslationProviderOptions);
|
|
27
|
+
}
|
|
28
|
+
interface OpenAiSemanticAuditProviderOptions extends Omit<StructuredSemanticAuditProviderOptions, "transport"> {
|
|
29
|
+
apiKey?: string;
|
|
30
|
+
client?: OpenAI;
|
|
31
|
+
}
|
|
32
|
+
declare class OpenAiSemanticAuditProvider extends StructuredSemanticAuditProvider {
|
|
33
|
+
constructor(options?: OpenAiSemanticAuditProviderOptions);
|
|
34
|
+
}
|
|
35
|
+
declare function createOpenAiTranslationProvider(options?: OpenAiTranslationProviderOptions): TranslationProvider;
|
|
36
|
+
declare function createOpenAiSemanticAuditProvider(options?: OpenAiSemanticAuditProviderOptions): SemanticAuditProvider;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { DEFAULT_MODEL, OpenAiSemanticAuditProvider, OpenAiSemanticAuditProviderOptions, OpenAiTranslationProvider, OpenAiTranslationProviderOptions, OpenAiTransportOptions, type ReasoningEffort, SEMANTIC_AUDIT_OUTPUT_CONTRACT_MATERIAL, SEMANTIC_AUDIT_OUTPUT_CONTRACT_REVISION, type SemanticAuditOutputContractMaterial, type SemanticAuditPrompt, type SemanticAuditPromptArgs, type SemanticAuditResponseCache, type StructuredCompletionMessage, type StructuredCompletionRequest, type StructuredCompletionTransport, type SystemPrompt, type SystemPromptArgs, TRANSLATION_OUTPUT_CONTRACT_MATERIAL, TRANSLATION_OUTPUT_CONTRACT_REVISION, type TranslationOutputContractMaterial, createOpenAiSemanticAuditProvider, createOpenAiTranslationProvider, createOpenAiTransport, createSemanticAuditOutputContractRevision, createTranslationOutputContractRevision };
|
|
39
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;cAwCa;UAII;EACf;EACA,SAAS;EACT;;;;;;iBAOc,sBACd,UAAS,yBACR;UA0Cc,yCACP,KAAK;EACb;EACA,SAAS;EACT;;cAGW,kCAAkC;EAC7C,YAAY,UAAS;;UAgBN,2CACP,KAAK;EACb;EACA,SAAS;;cAGE,oCAAoC;EAC/C,YAAY,UAAS;;iBAeP,gCACd,UAAS,mCACR;iBAIa,kCACd,UAAS,qCACR"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { SEMANTIC_AUDIT_OUTPUT_CONTRACT_MATERIAL, SEMANTIC_AUDIT_OUTPUT_CONTRACT_REVISION, StructuredSemanticAuditProvider, StructuredTranslationProvider, TRANSLATION_OUTPUT_CONTRACT_MATERIAL, TRANSLATION_OUTPUT_CONTRACT_REVISION, createSemanticAuditOutputContractRevision, createTranslationOutputContractRevision } from "@ai-translate/provider-core";
|
|
2
|
+
import OpenAI from "openai";
|
|
3
|
+
import { zodResponseFormat } from "openai/helpers/zod";
|
|
4
|
+
//#region src/index.ts
|
|
5
|
+
/**
|
|
6
|
+
* Reasoning-capable and inexpensive. Callers who want a different trade-off
|
|
7
|
+
* pass `model` explicitly.
|
|
8
|
+
*/
|
|
9
|
+
const DEFAULT_MODEL = "gpt-5.6-luna";
|
|
10
|
+
const DEFAULT_REQUEST_TIMEOUT_MS = 12e4;
|
|
11
|
+
/**
|
|
12
|
+
* Speaks the OpenAI Chat Completions dialect of the engine's request contract.
|
|
13
|
+
* Retries stay off here because the engine owns the retry and repair loop.
|
|
14
|
+
*/
|
|
15
|
+
function createOpenAiTransport(options = {}) {
|
|
16
|
+
if (!options.client && !options.apiKey) throw new Error("OpenAI transport requires either apiKey or client.");
|
|
17
|
+
const requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
18
|
+
const client = options.client ?? new OpenAI({
|
|
19
|
+
apiKey: options.apiKey,
|
|
20
|
+
maxRetries: 0,
|
|
21
|
+
timeout: requestTimeoutMs
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
async complete(request) {
|
|
25
|
+
return (await client.chat.completions.parse({
|
|
26
|
+
messages: request.messages.map((message) => ({
|
|
27
|
+
content: message.content,
|
|
28
|
+
role: message.role
|
|
29
|
+
})),
|
|
30
|
+
model: request.modelId,
|
|
31
|
+
...request.maxCompletionTokens === void 0 ? {} : { max_completion_tokens: request.maxCompletionTokens },
|
|
32
|
+
...request.promptCacheKey === void 0 ? {} : { prompt_cache_key: request.promptCacheKey },
|
|
33
|
+
...request.reasoningEffort === void 0 ? {} : { reasoning_effort: request.reasoningEffort },
|
|
34
|
+
response_format: zodResponseFormat(request.schema, request.schemaName),
|
|
35
|
+
...request.temperature === void 0 ? {} : { temperature: request.temperature }
|
|
36
|
+
}, {
|
|
37
|
+
maxRetries: 0,
|
|
38
|
+
...request.signal === void 0 ? {} : { signal: request.signal },
|
|
39
|
+
timeout: requestTimeoutMs
|
|
40
|
+
})).choices[0]?.message.parsed;
|
|
41
|
+
},
|
|
42
|
+
label: "OpenAI"
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
var OpenAiTranslationProvider = class extends StructuredTranslationProvider {
|
|
46
|
+
constructor(options = {}) {
|
|
47
|
+
const { apiKey, client, model, ...engineOptions } = options;
|
|
48
|
+
super({
|
|
49
|
+
...engineOptions,
|
|
50
|
+
model: model ?? "gpt-5.6-luna",
|
|
51
|
+
transport: createOpenAiTransport({
|
|
52
|
+
...apiKey === void 0 ? {} : { apiKey },
|
|
53
|
+
...client === void 0 ? {} : { client },
|
|
54
|
+
...options.requestTimeoutMs === void 0 ? {} : { requestTimeoutMs: options.requestTimeoutMs }
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var OpenAiSemanticAuditProvider = class extends StructuredSemanticAuditProvider {
|
|
60
|
+
constructor(options = {}) {
|
|
61
|
+
const { apiKey, client, ...engineOptions } = options;
|
|
62
|
+
super({
|
|
63
|
+
...engineOptions,
|
|
64
|
+
transport: createOpenAiTransport({
|
|
65
|
+
...apiKey === void 0 ? {} : { apiKey },
|
|
66
|
+
...client === void 0 ? {} : { client },
|
|
67
|
+
...options.requestTimeoutMs === void 0 ? {} : { requestTimeoutMs: options.requestTimeoutMs }
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
function createOpenAiTranslationProvider(options = {}) {
|
|
73
|
+
return new OpenAiTranslationProvider(options);
|
|
74
|
+
}
|
|
75
|
+
function createOpenAiSemanticAuditProvider(options = {}) {
|
|
76
|
+
return new OpenAiSemanticAuditProvider(options);
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
export { DEFAULT_MODEL, OpenAiSemanticAuditProvider, OpenAiTranslationProvider, SEMANTIC_AUDIT_OUTPUT_CONTRACT_MATERIAL, SEMANTIC_AUDIT_OUTPUT_CONTRACT_REVISION, TRANSLATION_OUTPUT_CONTRACT_MATERIAL, TRANSLATION_OUTPUT_CONTRACT_REVISION, createOpenAiSemanticAuditProvider, createOpenAiTranslationProvider, createOpenAiTransport, createSemanticAuditOutputContractRevision, createTranslationOutputContractRevision };
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { SemanticAuditProvider, TranslationProvider } from \"@ai-translate/core/types\";\nimport {\n StructuredSemanticAuditProvider,\n StructuredTranslationProvider,\n} from \"@ai-translate/provider-core\";\nimport type {\n StructuredCompletionRequest,\n StructuredCompletionTransport,\n StructuredSemanticAuditProviderOptions,\n StructuredTranslationProviderOptions,\n} from \"@ai-translate/provider-core\";\nimport OpenAI from \"openai\";\nimport { zodResponseFormat } from \"openai/helpers/zod\";\n\nexport {\n SEMANTIC_AUDIT_OUTPUT_CONTRACT_MATERIAL,\n SEMANTIC_AUDIT_OUTPUT_CONTRACT_REVISION,\n TRANSLATION_OUTPUT_CONTRACT_MATERIAL,\n TRANSLATION_OUTPUT_CONTRACT_REVISION,\n createSemanticAuditOutputContractRevision,\n createTranslationOutputContractRevision,\n} from \"@ai-translate/provider-core\";\nexport type {\n ReasoningEffort,\n SemanticAuditOutputContractMaterial,\n SemanticAuditPrompt,\n SemanticAuditPromptArgs,\n SemanticAuditResponseCache,\n StructuredCompletionMessage,\n StructuredCompletionRequest,\n StructuredCompletionTransport,\n SystemPrompt,\n SystemPromptArgs,\n TranslationOutputContractMaterial,\n} from \"@ai-translate/provider-core\";\n\n/**\n * Reasoning-capable and inexpensive. Callers who want a different trade-off\n * pass `model` explicitly.\n */\nexport const DEFAULT_MODEL = \"gpt-5.6-luna\";\n\nconst DEFAULT_REQUEST_TIMEOUT_MS = 120_000;\n\nexport interface OpenAiTransportOptions {\n apiKey?: string;\n client?: OpenAI;\n requestTimeoutMs?: number;\n}\n\n/**\n * Speaks the OpenAI Chat Completions dialect of the engine's request contract.\n * Retries stay off here because the engine owns the retry and repair loop.\n */\nexport function createOpenAiTransport(\n options: OpenAiTransportOptions = {},\n): StructuredCompletionTransport {\n if (!options.client && !options.apiKey) {\n throw new Error(\"OpenAI transport requires either apiKey or client.\");\n }\n const requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;\n const client =\n options.client ??\n new OpenAI({ apiKey: options.apiKey, maxRetries: 0, timeout: requestTimeoutMs });\n\n return {\n async complete(request: StructuredCompletionRequest): Promise<unknown> {\n const completion = await client.chat.completions.parse(\n {\n messages: request.messages.map((message) => ({\n content: message.content,\n role: message.role,\n })),\n model: request.modelId,\n ...(request.maxCompletionTokens === undefined\n ? {}\n : { max_completion_tokens: request.maxCompletionTokens }),\n ...(request.promptCacheKey === undefined\n ? {}\n : { prompt_cache_key: request.promptCacheKey }),\n ...(request.reasoningEffort === undefined\n ? {}\n : { reasoning_effort: request.reasoningEffort }),\n response_format: zodResponseFormat(request.schema, request.schemaName),\n ...(request.temperature === undefined ? {} : { temperature: request.temperature }),\n },\n {\n maxRetries: 0,\n ...(request.signal === undefined ? {} : { signal: request.signal }),\n timeout: requestTimeoutMs,\n },\n );\n return completion.choices[0]?.message.parsed;\n },\n label: \"OpenAI\",\n };\n}\n\nexport interface OpenAiTranslationProviderOptions\n extends Omit<StructuredTranslationProviderOptions, \"model\" | \"transport\"> {\n apiKey?: string;\n client?: OpenAI;\n model?: string;\n}\n\nexport class OpenAiTranslationProvider extends StructuredTranslationProvider {\n constructor(options: OpenAiTranslationProviderOptions = {}) {\n const { apiKey, client, model, ...engineOptions } = options;\n super({\n ...engineOptions,\n model: model ?? DEFAULT_MODEL,\n transport: createOpenAiTransport({\n ...(apiKey === undefined ? {} : { apiKey }),\n ...(client === undefined ? {} : { client }),\n ...(options.requestTimeoutMs === undefined\n ? {}\n : { requestTimeoutMs: options.requestTimeoutMs }),\n }),\n });\n }\n}\n\nexport interface OpenAiSemanticAuditProviderOptions\n extends Omit<StructuredSemanticAuditProviderOptions, \"transport\"> {\n apiKey?: string;\n client?: OpenAI;\n}\n\nexport class OpenAiSemanticAuditProvider extends StructuredSemanticAuditProvider {\n constructor(options: OpenAiSemanticAuditProviderOptions = {}) {\n const { apiKey, client, ...engineOptions } = options;\n super({\n ...engineOptions,\n transport: createOpenAiTransport({\n ...(apiKey === undefined ? {} : { apiKey }),\n ...(client === undefined ? {} : { client }),\n ...(options.requestTimeoutMs === undefined\n ? {}\n : { requestTimeoutMs: options.requestTimeoutMs }),\n }),\n });\n }\n}\n\nexport function createOpenAiTranslationProvider(\n options: OpenAiTranslationProviderOptions = {},\n): TranslationProvider {\n return new OpenAiTranslationProvider(options);\n}\n\nexport function createOpenAiSemanticAuditProvider(\n options: OpenAiSemanticAuditProviderOptions = {},\n): SemanticAuditProvider {\n return new OpenAiSemanticAuditProvider(options);\n}\n"],"mappings":";;;;;;;;AAwCA,MAAa,gBAAgB;AAE7B,MAAM,6BAA6B;;;;;AAYnC,SAAgB,sBACd,UAAkC,CAAC,GACJ;CAC/B,IAAI,CAAC,QAAQ,UAAU,CAAC,QAAQ,QAC9B,MAAM,IAAI,MAAM,oDAAoD;CAEtE,MAAM,mBAAmB,QAAQ,oBAAoB;CACrD,MAAM,SACJ,QAAQ,UACR,IAAI,OAAO;EAAE,QAAQ,QAAQ;EAAQ,YAAY;EAAG,SAAS;CAAiB,CAAC;CAEjF,OAAO;EACL,MAAM,SAAS,SAAwD;GA0BrE,QAAO,MAzBkB,OAAO,KAAK,YAAY,MAC/C;IACE,UAAU,QAAQ,SAAS,KAAK,aAAa;KAC3C,SAAS,QAAQ;KACjB,MAAM,QAAQ;IAChB,EAAE;IACF,OAAO,QAAQ;IACf,GAAI,QAAQ,wBAAwB,KAAA,IAChC,CAAC,IACD,EAAE,uBAAuB,QAAQ,oBAAoB;IACzD,GAAI,QAAQ,mBAAmB,KAAA,IAC3B,CAAC,IACD,EAAE,kBAAkB,QAAQ,eAAe;IAC/C,GAAI,QAAQ,oBAAoB,KAAA,IAC5B,CAAC,IACD,EAAE,kBAAkB,QAAQ,gBAAgB;IAChD,iBAAiB,kBAAkB,QAAQ,QAAQ,QAAQ,UAAU;IACrE,GAAI,QAAQ,gBAAgB,KAAA,IAAY,CAAC,IAAI,EAAE,aAAa,QAAQ,YAAY;GAClF,GACA;IACE,YAAY;IACZ,GAAI,QAAQ,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,QAAQ,OAAO;IACjE,SAAS;GACX,CACF,EAAA,CACkB,QAAQ,EAAE,EAAE,QAAQ;EACxC;EACA,OAAO;CACT;AACF;AASA,IAAa,4BAAb,cAA+C,8BAA8B;CAC3E,YAAY,UAA4C,CAAC,GAAG;EAC1D,MAAM,EAAE,QAAQ,QAAQ,OAAO,GAAG,kBAAkB;EACpD,MAAM;GACJ,GAAG;GACH,OAAO,SAAA;GACP,WAAW,sBAAsB;IAC/B,GAAI,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO;IACzC,GAAI,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO;IACzC,GAAI,QAAQ,qBAAqB,KAAA,IAC7B,CAAC,IACD,EAAE,kBAAkB,QAAQ,iBAAiB;GACnD,CAAC;EACH,CAAC;CACH;AACF;AAQA,IAAa,8BAAb,cAAiD,gCAAgC;CAC/E,YAAY,UAA8C,CAAC,GAAG;EAC5D,MAAM,EAAE,QAAQ,QAAQ,GAAG,kBAAkB;EAC7C,MAAM;GACJ,GAAG;GACH,WAAW,sBAAsB;IAC/B,GAAI,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO;IACzC,GAAI,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO;IACzC,GAAI,QAAQ,qBAAqB,KAAA,IAC7B,CAAC,IACD,EAAE,kBAAkB,QAAQ,iBAAiB;GACnD,CAAC;EACH,CAAC;CACH;AACF;AAEA,SAAgB,gCACd,UAA4C,CAAC,GACxB;CACrB,OAAO,IAAI,0BAA0B,OAAO;AAC9C;AAEA,SAAgB,kCACd,UAA8C,CAAC,GACxB;CACvB,OAAO,IAAI,4BAA4B,OAAO;AAChD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ai-translate/provider-openai",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "OpenAI translation and semantic-audit providers for ai-translate, with structured output and batching.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"i18n",
|
|
7
|
+
"l10n",
|
|
8
|
+
"internationalization",
|
|
9
|
+
"localization",
|
|
10
|
+
"translation",
|
|
11
|
+
"openai",
|
|
12
|
+
"ai",
|
|
13
|
+
"llm"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": "Thiago Peres",
|
|
17
|
+
"homepage": "https://github.com/thiagoperes/ai-translate#packages",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/thiagoperes/ai-translate.git",
|
|
21
|
+
"directory": "packages/ai-translate-provider-openai"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/thiagoperes/ai-translate/issues"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"type": "module",
|
|
30
|
+
"sideEffects": false,
|
|
31
|
+
"main": "./dist/index.mjs",
|
|
32
|
+
"types": "./dist/index.d.mts",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.mts",
|
|
36
|
+
"import": "./dist/index.mjs",
|
|
37
|
+
"default": "./dist/index.mjs"
|
|
38
|
+
},
|
|
39
|
+
"./package.json": "./package.json"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"openai": "7.1.0",
|
|
46
|
+
"zod": "4.4.3",
|
|
47
|
+
"@ai-translate/core": "0.1.0",
|
|
48
|
+
"@ai-translate/provider-core": "0.1.0"
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=22.0.0"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "tsdown",
|
|
55
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
56
|
+
"lint": "oxlint -c ../../.oxlintrc.json --type-aware --deny-warnings src test vitest.config.ts tsdown.config.ts",
|
|
57
|
+
"test": "vitest run --config vitest.config.ts",
|
|
58
|
+
"coverage": "vitest run --config vitest.config.ts --coverage",
|
|
59
|
+
"coverage:strict": "vitest run --config vitest.config.ts --coverage --coverage.include=src/index.ts --coverage.thresholds.lines=95 --coverage.thresholds.functions=95 --coverage.thresholds.branches=95 --coverage.thresholds.statements=95",
|
|
60
|
+
"test:pack": "publint . && attw --pack . --profile esm-only"
|
|
61
|
+
}
|
|
62
|
+
}
|