@openspecui/core 3.11.0 → 3.11.2
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/dist/{document-translation-BrE402YR.mjs → document-translation-BTEG-uW_.mjs} +5 -1
- package/dist/{document-translation-BZ5QKjN0.d.mts → document-translation-EMIQf5dw.d.mts} +80 -30
- package/dist/document-translation.d.mts +2 -2
- package/dist/document-translation.mjs +2 -2
- package/dist/hosted-app.d.mts +1 -1
- package/dist/hosted-app.mjs +1 -1
- package/dist/index.d.mts +162 -61
- package/dist/index.mjs +337 -56
- package/dist/{local-download-profiles-BppI_PAq.mjs → local-download-profiles-CNDtMG2s.mjs} +7 -3
- package/dist/{local-download-profiles-BdHk_i54.d.mts → local-download-profiles-CSXKbamv.d.mts} +5 -1
- package/dist/local-download-profiles.d.mts +2 -2
- package/dist/local-download-profiles.mjs +1 -1
- package/dist/markdown-facts.d.mts +1 -1
- package/dist/markdown-facts.mjs +1 -1
- package/dist/{markdown-reading-DvLPaaY1.d.mts → markdown-reading-BaHZTf5f.d.mts} +1 -1
- package/dist/{markdown-reading-DYBp7qoI.mjs → markdown-reading-DSlcirYV.mjs} +1 -1
- package/dist/markdown-reading.d.mts +2 -2
- package/dist/markdown-reading.mjs +2 -2
- package/dist/{notifications-B4GiAnmn.d.mts → notifications-Ct6rtBwb.d.mts} +16 -16
- package/dist/{notifications-9vbSJQ8N.mjs → notifications-Xs9VPFWD.mjs} +2 -2
- package/dist/notifications.d.mts +2 -2
- package/dist/notifications.mjs +3 -3
- package/dist/{openspec-annotations-DVbFBz5J.d.mts → openspec-annotations-DYyP_HQh.d.mts} +2 -2
- package/dist/{openspec-annotations-BxBoWlyv.mjs → openspec-annotations-dNJentSE.mjs} +2 -2
- package/dist/openspec-annotations.d.mts +3 -3
- package/dist/openspec-annotations.mjs +3 -3
- package/dist/{openspec-projection-Df5C6CFv.d.mts → openspec-projection-DrTZ0P31.d.mts} +3 -3
- package/dist/{openspec-projection-Cd6oydiK.mjs → openspec-projection-yqwKIKnp.mjs} +2 -2
- package/dist/openspec-projection.d.mts +5 -5
- package/dist/openspec-projection.mjs +4 -4
- package/dist/opsx-display-path.d.mts +1 -1
- package/dist/opsx-display-path.mjs +1 -1
- package/dist/{opsx-entity-DHidvJcx.d.mts → opsx-entity-CIB-Wi0n.d.mts} +13 -13
- package/dist/opsx-entity.d.mts +2 -2
- package/dist/opsx-entity.mjs +1 -1
- package/dist/{opsx-schema-detail-VyCbvX1I.d.mts → opsx-schema-detail-Cjoesix_.d.mts} +1 -1
- package/dist/opsx-schema-detail.d.mts +3 -3
- package/dist/opsx-schema-detail.mjs +1 -1
- package/dist/{schemas-3VC51gAF.d.mts → schemas-DeEkRkAH.d.mts} +126 -126
- package/dist/{sounds-CQJ1eD1u.d.mts → sounds-BaxOUgWE.d.mts} +5 -5
- package/dist/sounds.d.mts +1 -1
- package/dist/sounds.mjs +1 -1
- package/dist/{terminal-audio-DVz0HA2H.mjs → terminal-audio-CUs0sqEO.mjs} +1 -1
- package/dist/{terminal-audio-BrmM5FX_.d.mts → terminal-audio-v3YSYJKq.d.mts} +2 -2
- package/dist/terminal-audio.d.mts +2 -2
- package/dist/terminal-audio.mjs +2 -2
- package/dist/terminal-control.d.mts +2 -2
- package/dist/terminal-control.mjs +1 -1
- package/dist/{terminal-invocation-Z0xbyZ1V.d.mts → terminal-invocation-C5gqne5H.d.mts} +51 -51
- package/dist/terminal-invocation.d.mts +1 -1
- package/dist/terminal-invocation.mjs +1 -1
- package/dist/terminal-theme.d.mts +1 -1
- package/dist/terminal-theme.mjs +1 -1
- package/dist/translation-language-pair-Cb4a0hG6.mjs +52 -0
- package/dist/translation-language-pair-DaSvW83F.d.mts +18 -0
- package/dist/translation-language-pair.d.mts +2 -0
- package/dist/translation-language-pair.mjs +3 -0
- package/dist/translator-BtbU7rjR.d.mts +2498 -0
- package/dist/translator-yHmEiuRX.mjs +375 -0
- package/dist/translator.d.mts +2 -2
- package/dist/translator.mjs +2 -2
- package/package.json +9 -3
- package/dist/translator-BSPMDjZy.d.mts +0 -780
- package/dist/translator-C3LT7PqW.mjs +0 -147
- /package/dist/{hosted-app-CxpQvD1s.mjs → hosted-app-CNZhVLM_.mjs} +0 -0
- /package/dist/{hosted-app-FuxG4-qA.d.mts → hosted-app-CegGJlNp.d.mts} +0 -0
- /package/dist/{markdown-facts-B5RvYPKF.mjs → markdown-facts-DbE1F2LD.mjs} +0 -0
- /package/dist/{markdown-facts-DUsbNcjh.d.mts → markdown-facts-DempqdIX.d.mts} +0 -0
- /package/dist/{opsx-display-path-Bf89ZyM5.mjs → opsx-display-path-Cw-5MTRg.mjs} +0 -0
- /package/dist/{opsx-display-path-CbO6K0Qq.d.mts → opsx-display-path-Ky9qnntM.d.mts} +0 -0
- /package/dist/{opsx-entity-BR_6djiM.mjs → opsx-entity-C_51ZEuP.mjs} +0 -0
- /package/dist/{opsx-schema-detail-5Wv1oWLT.mjs → opsx-schema-detail-Bu415_NB.mjs} +0 -0
- /package/dist/{sounds-CB_gpY-y.mjs → sounds-50cYk5b0.mjs} +0 -0
- /package/dist/{terminal-control-CNcEd9Rl.mjs → terminal-control-CYZhk7FM.mjs} +0 -0
- /package/dist/{terminal-invocation-wUmtJMPl.mjs → terminal-invocation-IopdwXKL.mjs} +0 -0
- /package/dist/{terminal-theme-CHkfTDk4.mjs → terminal-theme-BquTqZIO.mjs} +0 -0
- /package/dist/{terminal-theme-x_vAHvok.d.mts → terminal-theme-CH-VSrAq.d.mts} +0 -0
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
//#region src/translator.ts
|
|
4
|
-
const TRANSLATOR_CONTRACT_VERSION = 2;
|
|
5
|
-
const TRANSLATION_ENGINE_IDS = [
|
|
6
|
-
"browser",
|
|
7
|
-
"local",
|
|
8
|
-
"openai"
|
|
9
|
-
];
|
|
10
|
-
const TranslationEngineIdSchema = z.enum(TRANSLATION_ENGINE_IDS);
|
|
11
|
-
const DEFAULT_TRANSLATION_ENGINE_ID = "browser";
|
|
12
|
-
const SERVICE_TRANSLATION_ENGINE_IDS = ["local", "openai"];
|
|
13
|
-
const ServiceTranslationEngineIdSchema = z.enum(SERVICE_TRANSLATION_ENGINE_IDS);
|
|
14
|
-
const LocalModelDownloadStatusSchema = z.enum([
|
|
15
|
-
"not-downloaded",
|
|
16
|
-
"queued",
|
|
17
|
-
"downloading",
|
|
18
|
-
"paused",
|
|
19
|
-
"downloaded",
|
|
20
|
-
"error",
|
|
21
|
-
"deleting"
|
|
22
|
-
]);
|
|
23
|
-
const TranslationDownloadFilePlanSchema = z.object({
|
|
24
|
-
path: z.string().min(1),
|
|
25
|
-
sizeBytes: z.number().int().nonnegative().optional(),
|
|
26
|
-
required: z.boolean()
|
|
27
|
-
});
|
|
28
|
-
const TranslationDownloadGroupPlanSchema = z.object({
|
|
29
|
-
id: z.string().min(1),
|
|
30
|
-
label: z.string().min(1),
|
|
31
|
-
description: z.string().optional(),
|
|
32
|
-
profile: z.string().min(1).optional(),
|
|
33
|
-
dtype: z.string().min(1).optional(),
|
|
34
|
-
estimatedTotalBytes: z.number().int().nonnegative().optional(),
|
|
35
|
-
selectable: z.boolean(),
|
|
36
|
-
selected: z.boolean(),
|
|
37
|
-
files: z.array(TranslationDownloadFilePlanSchema)
|
|
38
|
-
});
|
|
39
|
-
const LocalModelAssetLogSchema = z.object({
|
|
40
|
-
engineId: z.literal("local"),
|
|
41
|
-
modelId: z.string().min(1),
|
|
42
|
-
selectedGroupId: z.string().min(1).optional(),
|
|
43
|
-
status: LocalModelDownloadStatusSchema,
|
|
44
|
-
message: z.string(),
|
|
45
|
-
progress: z.number().min(0).max(1).optional(),
|
|
46
|
-
bytesDownloaded: z.number().int().nonnegative().optional(),
|
|
47
|
-
totalBytes: z.number().int().nonnegative().optional(),
|
|
48
|
-
sessionId: z.string().optional(),
|
|
49
|
-
resumable: z.boolean().optional(),
|
|
50
|
-
files: z.array(z.object({
|
|
51
|
-
path: z.string().min(1),
|
|
52
|
-
sizeBytes: z.number().int().nonnegative().optional(),
|
|
53
|
-
downloadedBytes: z.number().int().nonnegative().optional()
|
|
54
|
-
})).optional(),
|
|
55
|
-
updatedAt: z.number().int().nonnegative()
|
|
56
|
-
});
|
|
57
|
-
const LocalModelAssetPlanSnapshotSchema = z.object({
|
|
58
|
-
modelId: z.string().min(1),
|
|
59
|
-
estimatedTotalBytes: z.number().int().nonnegative().optional(),
|
|
60
|
-
files: z.array(TranslationDownloadFilePlanSchema),
|
|
61
|
-
profile: z.string().min(1).optional(),
|
|
62
|
-
selectedGroupId: z.string().min(1).optional(),
|
|
63
|
-
groups: z.array(TranslationDownloadGroupPlanSchema).optional()
|
|
64
|
-
});
|
|
65
|
-
const LocalModelAssetStateSchema = z.object({
|
|
66
|
-
modelId: z.string().min(1),
|
|
67
|
-
status: LocalModelDownloadStatusSchema.default("not-downloaded"),
|
|
68
|
-
selected: z.boolean().default(false),
|
|
69
|
-
installedAt: z.number().int().nonnegative().optional(),
|
|
70
|
-
updatedAt: z.number().int().nonnegative().optional(),
|
|
71
|
-
bytesDownloaded: z.number().int().nonnegative().optional(),
|
|
72
|
-
totalBytes: z.number().int().nonnegative().optional(),
|
|
73
|
-
progress: z.number().min(0).max(1).optional(),
|
|
74
|
-
resumable: z.boolean().default(false),
|
|
75
|
-
error: z.string().optional(),
|
|
76
|
-
plan: LocalModelAssetPlanSnapshotSchema.optional(),
|
|
77
|
-
files: z.array(z.object({
|
|
78
|
-
path: z.string().min(1),
|
|
79
|
-
sizeBytes: z.number().int().nonnegative().optional(),
|
|
80
|
-
downloadedBytes: z.number().int().nonnegative().optional()
|
|
81
|
-
})).default([])
|
|
82
|
-
});
|
|
83
|
-
const TRANSLATION_ENGINE_MANIFESTS = [
|
|
84
|
-
{
|
|
85
|
-
id: "browser",
|
|
86
|
-
label: "Browser",
|
|
87
|
-
description: "Uses the browser Translator API and future browser-side providers.",
|
|
88
|
-
technicalSummary: "Browser-native Web Translator adapter. Package payload is about 5 KB; browser language packs are managed by the browser.",
|
|
89
|
-
runtime: "browser",
|
|
90
|
-
moduleName: "@openspecui/browser-translator",
|
|
91
|
-
factoryExport: "createBrowserTranslatorFactory"
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
id: "local",
|
|
95
|
-
label: "Local-Transformers",
|
|
96
|
-
description: "Runs a bundled local Transformers.js translation runtime with managed model files.",
|
|
97
|
-
technicalSummary: "Server-side Transformers.js local adapter. Package payload is about 5 KB; selected model groups are downloaded separately and can range from tens to hundreds of MB.",
|
|
98
|
-
runtime: "server",
|
|
99
|
-
moduleName: "@openspecui/local-translator",
|
|
100
|
-
factoryExport: "createLocalTranslatorFactory"
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
id: "openai",
|
|
104
|
-
label: "OpenAI-Completion",
|
|
105
|
-
description: "Uses an OpenAI-compatible TanStack AI completion provider for context-aware translation.",
|
|
106
|
-
technicalSummary: "Server-side TanStack AI adapter for OpenAI-compatible APIs. Package payload is about 5 KB; model size stays with the remote provider.",
|
|
107
|
-
runtime: "server",
|
|
108
|
-
moduleName: "@openspecui/openai-completion-translator",
|
|
109
|
-
factoryExport: "createOpenAICompletionTranslatorFactory"
|
|
110
|
-
}
|
|
111
|
-
];
|
|
112
|
-
function getTranslationEngineManifest(engineId) {
|
|
113
|
-
const manifest = TRANSLATION_ENGINE_MANIFESTS.find((engine) => engine.id === engineId);
|
|
114
|
-
if (!manifest) throw new Error(`Unknown translation engine: ${engineId}`);
|
|
115
|
-
return manifest;
|
|
116
|
-
}
|
|
117
|
-
const TranslationOpenAISettingsSchema = z.object({
|
|
118
|
-
baseUrl: z.string().default(""),
|
|
119
|
-
token: z.string().default(""),
|
|
120
|
-
model: z.string().default("gpt-4.1-mini")
|
|
121
|
-
});
|
|
122
|
-
const TranslationLocalSettingsSchema = z.object({
|
|
123
|
-
model: z.string().default("Xenova/nllb-200-distilled-600M"),
|
|
124
|
-
selectedGroupId: z.string().optional(),
|
|
125
|
-
hfEndpoint: z.string().default("")
|
|
126
|
-
});
|
|
127
|
-
const TranslationEngineGlobalSettingsSchema = z.object({
|
|
128
|
-
openai: TranslationOpenAISettingsSchema.default(TranslationOpenAISettingsSchema.parse({})),
|
|
129
|
-
local: TranslationLocalSettingsSchema.default(TranslationLocalSettingsSchema.parse({}))
|
|
130
|
-
});
|
|
131
|
-
const BatchTranslateInputSchema = z.object({
|
|
132
|
-
engineId: TranslationEngineIdSchema,
|
|
133
|
-
sourceLanguage: z.string().min(1),
|
|
134
|
-
targetLanguage: z.string().min(1),
|
|
135
|
-
model: z.string().min(1).optional(),
|
|
136
|
-
selectedGroupId: z.string().min(1).optional(),
|
|
137
|
-
inputs: z.array(z.string()).min(1),
|
|
138
|
-
instructions: z.string().optional(),
|
|
139
|
-
context: z.string().optional()
|
|
140
|
-
});
|
|
141
|
-
const BatchTranslateEventSchema = z.object({
|
|
142
|
-
index: z.number().int().nonnegative(),
|
|
143
|
-
output: z.string()
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
//#endregion
|
|
147
|
-
export { TranslationLocalSettingsSchema as _, LocalModelAssetPlanSnapshotSchema as a, SERVICE_TRANSLATION_ENGINE_IDS as c, TRANSLATION_ENGINE_MANIFESTS as d, TRANSLATOR_CONTRACT_VERSION as f, TranslationEngineIdSchema as g, TranslationEngineGlobalSettingsSchema as h, LocalModelAssetLogSchema as i, ServiceTranslationEngineIdSchema as l, TranslationDownloadGroupPlanSchema as m, BatchTranslateInputSchema as n, LocalModelAssetStateSchema as o, TranslationDownloadFilePlanSchema as p, DEFAULT_TRANSLATION_ENGINE_ID as r, LocalModelDownloadStatusSchema as s, BatchTranslateEventSchema as t, TRANSLATION_ENGINE_IDS as u, TranslationOpenAISettingsSchema as v, getTranslationEngineManifest as y };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|