@openspecui/core 3.7.2 → 3.9.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/dist/{document-translation-CvUxMOPl.mjs → document-translation-BrE402YR.mjs} +16 -2
- package/dist/document-translation-gGEfTK6J.d.mts +263 -0
- package/dist/document-translation.d.mts +2 -2
- package/dist/document-translation.mjs +3 -2
- package/dist/hosted-app.d.mts +1 -1
- package/dist/hosted-app.mjs +1 -1
- package/dist/index.d.mts +190 -33
- package/dist/index.mjs +270 -23
- package/dist/local-download-profiles-BppI_PAq.mjs +255 -0
- package/dist/local-download-profiles-Cx0TCYld.d.mts +100 -0
- package/dist/local-download-profiles.d.mts +3 -0
- package/dist/local-download-profiles.mjs +3 -0
- package/dist/markdown-facts.d.mts +1 -1
- package/dist/markdown-facts.mjs +1 -1
- package/dist/{markdown-reading-CsL1q84q.mjs → markdown-reading-DYBp7qoI.mjs} +1 -1
- package/dist/{markdown-reading-BC6uFgx0.d.mts → markdown-reading-DvLPaaY1.d.mts} +1 -1
- package/dist/markdown-reading.d.mts +2 -2
- package/dist/markdown-reading.mjs +2 -2
- package/dist/{notifications-DXOoOJ3m.mjs → notifications-9vbSJQ8N.mjs} +2 -2
- package/dist/{notifications-C9NFber0.d.mts → notifications-BcyENEk7.d.mts} +14 -14
- package/dist/notifications.d.mts +2 -2
- package/dist/notifications.mjs +3 -3
- package/dist/{openspec-annotations-D_xQqQOB.mjs → openspec-annotations-BxBoWlyv.mjs} +2 -2
- package/dist/{openspec-annotations-DKP1Uuho.d.mts → openspec-annotations-DVbFBz5J.d.mts} +2 -2
- package/dist/openspec-annotations.d.mts +3 -3
- package/dist/openspec-annotations.mjs +3 -3
- package/dist/{openspec-projection-Cv9_trD5.d.mts → openspec-projection-BA3r5CYl.d.mts} +3 -3
- package/dist/{openspec-projection-DLGD1JFD.mjs → openspec-projection-Cd6oydiK.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-FVK74l1t.d.mts → opsx-entity-CuZmeham.d.mts} +15 -15
- package/dist/opsx-entity.d.mts +2 -2
- package/dist/opsx-entity.mjs +1 -1
- package/dist/{opsx-schema-detail-COXlZ7Gm.d.mts → opsx-schema-detail-Ca3CvTQg.d.mts} +1 -1
- package/dist/opsx-schema-detail.d.mts +3 -3
- package/dist/opsx-schema-detail.mjs +1 -1
- package/dist/{schemas-CFIuaIAS.d.mts → schemas-P5NxTHR9.d.mts} +40 -40
- package/dist/{sounds-Dz-aToh_.d.mts → sounds-DABkmyg9.d.mts} +8 -8
- package/dist/sounds.d.mts +1 -1
- package/dist/sounds.mjs +1 -1
- package/dist/{terminal-audio-Btx-il9w.d.mts → terminal-audio-CDyXOIWx.d.mts} +1 -1
- package/dist/{terminal-audio-BiQ9qJJW.mjs → terminal-audio-DVz0HA2H.mjs} +1 -1
- 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-42mkV55p.d.mts → terminal-invocation-CWevPxkf.d.mts} +47 -47
- 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/translator-BEhPdQGs.d.mts +780 -0
- package/dist/translator-C3LT7PqW.mjs +147 -0
- package/dist/translator.d.mts +2 -0
- package/dist/translator.mjs +3 -0
- package/package.json +15 -3
- package/dist/document-translation-D_ryOn9u.d.mts +0 -140
- /package/dist/{hosted-app-Du65UHRo.mjs → hosted-app-CxpQvD1s.mjs} +0 -0
- /package/dist/{hosted-app-BqJw9WgW.d.mts → hosted-app-FuxG4-qA.d.mts} +0 -0
- /package/dist/{markdown-facts-BFqXdPfN.mjs → markdown-facts-B5RvYPKF.mjs} +0 -0
- /package/dist/{markdown-facts-DxElzSsp.d.mts → markdown-facts-DUsbNcjh.d.mts} +0 -0
- /package/dist/{opsx-display-path-BHEPZsJx.mjs → opsx-display-path-Bf89ZyM5.mjs} +0 -0
- /package/dist/{opsx-display-path-BKUYCqwP.d.mts → opsx-display-path-CbO6K0Qq.d.mts} +0 -0
- /package/dist/{opsx-entity-B_Od4N3r.mjs → opsx-entity-BR_6djiM.mjs} +0 -0
- /package/dist/{opsx-schema-detail-Bh-aNaSk.mjs → opsx-schema-detail-5Wv1oWLT.mjs} +0 -0
- /package/dist/{sounds-Ctm3QEtf.mjs → sounds-CB_gpY-y.mjs} +0 -0
- /package/dist/{terminal-control-CMkG-o9C.mjs → terminal-control-CNcEd9Rl.mjs} +0 -0
- /package/dist/{terminal-invocation-CX1LDM89.mjs → terminal-invocation-wUmtJMPl.mjs} +0 -0
- /package/dist/{terminal-theme-BOGPIiVm.mjs → terminal-theme-CHkfTDk4.mjs} +0 -0
- /package/dist/{terminal-theme-DdhVuegL.d.mts → terminal-theme-x_vAHvok.d.mts} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { a as normalizeOpsxEntityPath, c as parseOpsxEntityMetadata, i as isOpsxGlobPattern, n as getOpsxEntityMetadataPath, o as opsxGlobToRegex, r as getOpsxEntityRootRelativePath, s as opsxPathMatchesPattern, t as buildOpsxEntityDetail } from "./opsx-entity-
|
|
2
|
-
import { n as toMarkdownFactKind, t as parseMarkdownFacts } from "./markdown-facts-
|
|
3
|
-
import { a as getMarkdownAnnotation, c as getMarkdownHeadingEnd, d as trimMarkdownSlice, i as createMarkdownReadingDocumentFromFacts, l as getMarkdownHeadingFacts, n as buildMarkdownParentMap, o as getMarkdownAnnotationsForFact, r as createMarkdownReadingDocument, s as getMarkdownFactSpan, t as MarkdownReadingPluginRegistry, u as sortMarkdownReadingPlugins } from "./markdown-reading-
|
|
4
|
-
import { a as getOpenSpecAnnotationsForFact, i as getOpenSpecAnnotation, n as annotateOpenSpecMarkdown, o as openSpecAnnotationRules, r as builtinOpenSpecReadingPlugin, t as annotateOpenSpecFacts } from "./openspec-annotations-
|
|
5
|
-
import { a as getOpenSpecReadingSections, c as projectOpenSpecMarkdown, i as getOpenSpecProjectionAnnotation, n as OPEN_SPEC_SPEC_PROJECTION_ID, o as parseOpenSpecMarkdownToSpec, r as createOpenSpecReadingPlugin, s as projectAnnotatedOpenSpecToSpec, t as OPEN_SPEC_READING_SECTIONS_PROJECTION_ID } from "./openspec-projection-
|
|
6
|
-
import { a as
|
|
7
|
-
import {
|
|
8
|
-
import { n as
|
|
9
|
-
import {
|
|
10
|
-
import { n as
|
|
11
|
-
import {
|
|
12
|
-
import { a as
|
|
13
|
-
import { n as
|
|
14
|
-
import { a as
|
|
15
|
-
import { t as
|
|
1
|
+
import { a as normalizeOpsxEntityPath, c as parseOpsxEntityMetadata, i as isOpsxGlobPattern, n as getOpsxEntityMetadataPath, o as opsxGlobToRegex, r as getOpsxEntityRootRelativePath, s as opsxPathMatchesPattern, t as buildOpsxEntityDetail } from "./opsx-entity-BR_6djiM.mjs";
|
|
2
|
+
import { n as toMarkdownFactKind, t as parseMarkdownFacts } from "./markdown-facts-B5RvYPKF.mjs";
|
|
3
|
+
import { a as getMarkdownAnnotation, c as getMarkdownHeadingEnd, d as trimMarkdownSlice, i as createMarkdownReadingDocumentFromFacts, l as getMarkdownHeadingFacts, n as buildMarkdownParentMap, o as getMarkdownAnnotationsForFact, r as createMarkdownReadingDocument, s as getMarkdownFactSpan, t as MarkdownReadingPluginRegistry, u as sortMarkdownReadingPlugins } from "./markdown-reading-DYBp7qoI.mjs";
|
|
4
|
+
import { a as getOpenSpecAnnotationsForFact, i as getOpenSpecAnnotation, n as annotateOpenSpecMarkdown, o as openSpecAnnotationRules, r as builtinOpenSpecReadingPlugin, t as annotateOpenSpecFacts } from "./openspec-annotations-BxBoWlyv.mjs";
|
|
5
|
+
import { a as getOpenSpecReadingSections, c as projectOpenSpecMarkdown, i as getOpenSpecProjectionAnnotation, n as OPEN_SPEC_SPEC_PROJECTION_ID, o as parseOpenSpecMarkdownToSpec, r as createOpenSpecReadingPlugin, s as projectAnnotatedOpenSpecToSpec, t as OPEN_SPEC_READING_SECTIONS_PROJECTION_ID } from "./openspec-projection-Cd6oydiK.mjs";
|
|
6
|
+
import { _ as TranslationLocalSettingsSchema, a as LocalModelAssetPlanSnapshotSchema, c as SERVICE_TRANSLATION_ENGINE_IDS, d as TRANSLATION_ENGINE_MANIFESTS, f as TRANSLATOR_CONTRACT_VERSION, g as TranslationEngineIdSchema, h as TranslationEngineGlobalSettingsSchema, i as LocalModelAssetLogSchema, l as ServiceTranslationEngineIdSchema, m as TranslationDownloadGroupPlanSchema, n as BatchTranslateInputSchema, o as LocalModelAssetStateSchema, p as TranslationDownloadFilePlanSchema, r as DEFAULT_TRANSLATION_ENGINE_ID, s as LocalModelDownloadStatusSchema, t as BatchTranslateEventSchema, u as TRANSLATION_ENGINE_IDS, v as TranslationOpenAISettingsSchema, y as getTranslationEngineManifest } from "./translator-C3LT7PqW.mjs";
|
|
7
|
+
import { a as MAX_TRANSLATION_CACHE_ENTRY_LIMIT, c as TranslationCacheEntrySchema, d as TranslationCacheStatsSchema, f as TranslationCacheWriteInputSchema, i as DocumentTranslationDisplayModeSchema, l as TranslationCacheReadInputSchema, n as DOCUMENT_TRANSLATION_DISPLAY_MODES, o as MIN_TRANSLATION_CACHE_ENTRY_LIMIT, p as TranslationEngineProjectSettingsSchema, r as DocumentTranslationConfigSchema, s as TRANSLATION_CACHE_POLICY_VERSION, t as DEFAULT_TRANSLATION_CACHE_ENTRY_LIMIT, u as TranslationCacheSettingsSchema } from "./document-translation-BrE402YR.mjs";
|
|
8
|
+
import { _ as customHashFromSoundId, a as CustomSoundHashSchema, b as soundIdFromCustomHash, c as CustomSoundMetadataSchema, f as LEGACY_SOUND_ID_MAP, g as SoundVolumeSchema, h as SoundIdSchema, i as CUSTOM_SOUND_ADD_VALUE, l as DEFAULT_BELL_SOUND_ID, m as SoundConfigIdSchema, n as BUILTIN_SOUND_OPTIONS, o as CustomSoundIdSchema, p as SILENT_SOUND_ID, r as BuiltinSoundIdSchema, s as CustomSoundMetadataFileSchema, t as BUILTIN_SOUND_IDS, u as DEFAULT_NOTIFICATION_SOUND_ID, v as getBuiltinSoundUrl, y as normalizeLegacySoundId } from "./sounds-CB_gpY-y.mjs";
|
|
9
|
+
import { n as terminalNotificationEventToPublishInput, t as TerminalControlParser } from "./terminal-control-CNcEd9Rl.mjs";
|
|
10
|
+
import { a as NotificationPublishInputSchema, c as NotificationSoundSchema, h as groupNotifications, i as NotificationGroupKeySchema, l as NotificationSourceSchema, m as getNotificationGroupLabel, n as NOTIFICATION_SOUND_VALUES, o as NotificationRecordSchema, p as getNotificationGroupKey, r as NotificationActionSchema, s as NotificationSettingsSchema, t as NOTIFICATION_SOUND_OPTIONS, u as TerminalNotificationParser } from "./notifications-9vbSJQ8N.mjs";
|
|
11
|
+
import { n as TERMINAL_BELL_SOUND_VALUES, r as TerminalBellSoundSchema, t as TERMINAL_BELL_SOUND_OPTIONS } from "./terminal-audio-DVz0HA2H.mjs";
|
|
12
|
+
import { a as TERMINAL_THEME_VALUES, i as TERMINAL_THEME_MODE_VALUES, n as DEFAULT_TERMINAL_LIGHT_THEME, r as DEFAULT_TERMINAL_THEME_MODE, t as DEFAULT_TERMINAL_DARK_THEME } from "./terminal-theme-CHkfTDk4.mjs";
|
|
13
|
+
import { i as selectLocalDownloadGroup, n as buildLocalDownloadPlanFromRepositoryFiles, r as buildLocalDownloadPlanFromRuntimeProfileFiles, t as LOCAL_MODEL_PROFILE_DEFINITIONS } from "./local-download-profiles-BppI_PAq.mjs";
|
|
14
|
+
import { a as buildEmbeddedUiLaunchUrl, c as isHostedBackendHealthResponse, d as normalizeHostedAppBaseUrl, f as resolveHostedAppBaseUrl, i as buildBackendHealthPayload, l as isSupportedEmbeddedUiUrl, n as OFFICIAL_APP_BASE_URL, o as buildHostedLaunchUrl, r as OPENSPECUI_RUNTIME_CAPABILITIES, s as isBackendHealthRuntimeMetadata, t as HOSTED_SHELL_PROTOCOL_VERSION, u as normalizeEmbeddedUiUrl } from "./hosted-app-CxpQvD1s.mjs";
|
|
15
|
+
import { n as toOpsxDisplayPath, t as VIRTUAL_PROJECT_DIRNAME } from "./opsx-display-path-Bf89ZyM5.mjs";
|
|
16
|
+
import { a as TerminalInvocationSettingsSchema, c as TerminalSpawnCommandSchema, f as quoteTerminalShellArg, g as resolveTerminalShellDefaults, h as renderTerminalSpawnCommandLine, i as TerminalCommandFieldSchema, n as TERMINAL_COMMAND_FIELD_TYPE_VALUES, o as TerminalShellProfileSchema, p as renderTerminalCommandArgs, r as TERMINAL_SHELL_QUOTE_STYLE_VALUES, s as TerminalShellQuoteStyleSchema, t as BUILTIN_TERMINAL_SPAWN_COMMANDS, u as getTerminalCommandDefaultValues } from "./terminal-invocation-wUmtJMPl.mjs";
|
|
17
|
+
import { t as parseOpsxSchemaDetail } from "./opsx-schema-detail-5Wv1oWLT.mjs";
|
|
16
18
|
import { mkdir, readFile, rename, writeFile } from "fs/promises";
|
|
17
19
|
import { dirname, join } from "path";
|
|
18
20
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -2002,6 +2004,56 @@ function createFileChangeObservable(watcher) {
|
|
|
2002
2004
|
} };
|
|
2003
2005
|
}
|
|
2004
2006
|
|
|
2007
|
+
//#endregion
|
|
2008
|
+
//#region src/persisted-settings-sanitize.ts
|
|
2009
|
+
function isPlainObject(value) {
|
|
2010
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
2011
|
+
}
|
|
2012
|
+
function readPath(value, path) {
|
|
2013
|
+
let current = value;
|
|
2014
|
+
for (const key of path) {
|
|
2015
|
+
if (!isPlainObject(current) || !Object.prototype.hasOwnProperty.call(current, key)) return {
|
|
2016
|
+
exists: false,
|
|
2017
|
+
value: void 0
|
|
2018
|
+
};
|
|
2019
|
+
current = current[key];
|
|
2020
|
+
}
|
|
2021
|
+
return {
|
|
2022
|
+
exists: true,
|
|
2023
|
+
value: current
|
|
2024
|
+
};
|
|
2025
|
+
}
|
|
2026
|
+
function writePath(value, path, nextValue) {
|
|
2027
|
+
if (!isPlainObject(value)) return value;
|
|
2028
|
+
const [head, ...tail] = path;
|
|
2029
|
+
const clone = { ...value };
|
|
2030
|
+
if (tail.length === 0) {
|
|
2031
|
+
if (nextValue === void 0) delete clone[head];
|
|
2032
|
+
else clone[head] = nextValue;
|
|
2033
|
+
return clone;
|
|
2034
|
+
}
|
|
2035
|
+
const currentChild = clone[head];
|
|
2036
|
+
clone[head] = writePath(isPlainObject(currentChild) ? currentChild : {}, tail, nextValue);
|
|
2037
|
+
return clone;
|
|
2038
|
+
}
|
|
2039
|
+
/**
|
|
2040
|
+
* Treat persisted settings/config as untrusted input and repair known invalid
|
|
2041
|
+
* fields before the authoritative schema parse runs.
|
|
2042
|
+
*/
|
|
2043
|
+
function sanitizePersistedSettings(value, rules) {
|
|
2044
|
+
let sanitized = value;
|
|
2045
|
+
for (const rule of rules) {
|
|
2046
|
+
const current = readPath(sanitized, rule.path);
|
|
2047
|
+
if (!current.exists) continue;
|
|
2048
|
+
if (rule.kind === "object") {
|
|
2049
|
+
if (!isPlainObject(current.value)) sanitized = writePath(sanitized, rule.path, rule.fallback);
|
|
2050
|
+
continue;
|
|
2051
|
+
}
|
|
2052
|
+
if (!rule.schema.safeParse(current.value).success) sanitized = writePath(sanitized, rule.path, rule.fallback);
|
|
2053
|
+
}
|
|
2054
|
+
return sanitized;
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2005
2057
|
//#endregion
|
|
2006
2058
|
//#region src/spawn-safe.ts
|
|
2007
2059
|
function getSpawnErrorCode(err) {
|
|
@@ -2501,7 +2553,7 @@ const TerminalConfigSchema = z.object({
|
|
|
2501
2553
|
useTheme: TerminalThemeModeSchema.default(DEFAULT_TERMINAL_THEME_MODE),
|
|
2502
2554
|
lightTheme: TerminalThemeSchema.default(DEFAULT_TERMINAL_LIGHT_THEME),
|
|
2503
2555
|
darkTheme: TerminalThemeSchema.default(DEFAULT_TERMINAL_DARK_THEME),
|
|
2504
|
-
rendererEngine:
|
|
2556
|
+
rendererEngine: TerminalRendererEngineSchema.default("xterm"),
|
|
2505
2557
|
bellSound: TerminalBellSoundSchema.default(DEFAULT_BELL_SOUND_ID),
|
|
2506
2558
|
bellVolume: SoundVolumeSchema
|
|
2507
2559
|
});
|
|
@@ -2543,6 +2595,133 @@ const DEFAULT_CONFIG = {
|
|
|
2543
2595
|
notifications: NotificationSettingsSchema.parse({}),
|
|
2544
2596
|
translation: DocumentTranslationConfigSchema.parse({})
|
|
2545
2597
|
};
|
|
2598
|
+
const PERSISTED_CONFIG_SANITIZE_RULES = [
|
|
2599
|
+
{
|
|
2600
|
+
kind: "object",
|
|
2601
|
+
path: ["cli"],
|
|
2602
|
+
fallback: {}
|
|
2603
|
+
},
|
|
2604
|
+
{
|
|
2605
|
+
kind: "field",
|
|
2606
|
+
path: ["theme"],
|
|
2607
|
+
schema: z.enum(THEME_VALUES),
|
|
2608
|
+
fallback: DEFAULT_CONFIG.theme
|
|
2609
|
+
},
|
|
2610
|
+
{
|
|
2611
|
+
kind: "object",
|
|
2612
|
+
path: ["codeEditor"],
|
|
2613
|
+
fallback: {}
|
|
2614
|
+
},
|
|
2615
|
+
{
|
|
2616
|
+
kind: "field",
|
|
2617
|
+
path: ["codeEditor", "theme"],
|
|
2618
|
+
schema: CodeEditorThemeSchema,
|
|
2619
|
+
fallback: DEFAULT_CONFIG.codeEditor.theme
|
|
2620
|
+
},
|
|
2621
|
+
{
|
|
2622
|
+
kind: "object",
|
|
2623
|
+
path: ["opsx"],
|
|
2624
|
+
fallback: {}
|
|
2625
|
+
},
|
|
2626
|
+
{
|
|
2627
|
+
kind: "field",
|
|
2628
|
+
path: ["opsx", "agentInvocationMode"],
|
|
2629
|
+
schema: OpsxAgentInvocationModeSchema,
|
|
2630
|
+
fallback: DEFAULT_CONFIG.opsx.agentInvocationMode
|
|
2631
|
+
},
|
|
2632
|
+
{
|
|
2633
|
+
kind: "object",
|
|
2634
|
+
path: ["terminal"],
|
|
2635
|
+
fallback: {}
|
|
2636
|
+
},
|
|
2637
|
+
{
|
|
2638
|
+
kind: "field",
|
|
2639
|
+
path: ["terminal", "cursorStyle"],
|
|
2640
|
+
schema: z.enum(CURSOR_STYLE_VALUES),
|
|
2641
|
+
fallback: DEFAULT_CONFIG.terminal.cursorStyle
|
|
2642
|
+
},
|
|
2643
|
+
{
|
|
2644
|
+
kind: "field",
|
|
2645
|
+
path: ["terminal", "useTheme"],
|
|
2646
|
+
schema: TerminalThemeModeSchema,
|
|
2647
|
+
fallback: DEFAULT_CONFIG.terminal.useTheme
|
|
2648
|
+
},
|
|
2649
|
+
{
|
|
2650
|
+
kind: "field",
|
|
2651
|
+
path: ["terminal", "lightTheme"],
|
|
2652
|
+
schema: TerminalThemeSchema,
|
|
2653
|
+
fallback: DEFAULT_CONFIG.terminal.lightTheme
|
|
2654
|
+
},
|
|
2655
|
+
{
|
|
2656
|
+
kind: "field",
|
|
2657
|
+
path: ["terminal", "darkTheme"],
|
|
2658
|
+
schema: TerminalThemeSchema,
|
|
2659
|
+
fallback: DEFAULT_CONFIG.terminal.darkTheme
|
|
2660
|
+
},
|
|
2661
|
+
{
|
|
2662
|
+
kind: "field",
|
|
2663
|
+
path: ["terminal", "rendererEngine"],
|
|
2664
|
+
schema: TerminalRendererEngineSchema,
|
|
2665
|
+
fallback: DEFAULT_CONFIG.terminal.rendererEngine
|
|
2666
|
+
},
|
|
2667
|
+
{
|
|
2668
|
+
kind: "field",
|
|
2669
|
+
path: ["terminal", "bellSound"],
|
|
2670
|
+
schema: TerminalBellSoundSchema,
|
|
2671
|
+
fallback: DEFAULT_CONFIG.terminal.bellSound
|
|
2672
|
+
},
|
|
2673
|
+
{
|
|
2674
|
+
kind: "object",
|
|
2675
|
+
path: ["notifications"],
|
|
2676
|
+
fallback: {}
|
|
2677
|
+
},
|
|
2678
|
+
{
|
|
2679
|
+
kind: "field",
|
|
2680
|
+
path: ["notifications", "sound"],
|
|
2681
|
+
schema: NotificationSettingsSchema.shape.sound,
|
|
2682
|
+
fallback: DEFAULT_CONFIG.notifications.sound
|
|
2683
|
+
},
|
|
2684
|
+
{
|
|
2685
|
+
kind: "object",
|
|
2686
|
+
path: ["translation"],
|
|
2687
|
+
fallback: {}
|
|
2688
|
+
},
|
|
2689
|
+
{
|
|
2690
|
+
kind: "object",
|
|
2691
|
+
path: ["translation", "engines"],
|
|
2692
|
+
fallback: {}
|
|
2693
|
+
},
|
|
2694
|
+
{
|
|
2695
|
+
kind: "object",
|
|
2696
|
+
path: [
|
|
2697
|
+
"translation",
|
|
2698
|
+
"engines",
|
|
2699
|
+
"local"
|
|
2700
|
+
],
|
|
2701
|
+
fallback: {}
|
|
2702
|
+
},
|
|
2703
|
+
{
|
|
2704
|
+
kind: "object",
|
|
2705
|
+
path: [
|
|
2706
|
+
"translation",
|
|
2707
|
+
"engines",
|
|
2708
|
+
"openai"
|
|
2709
|
+
],
|
|
2710
|
+
fallback: {}
|
|
2711
|
+
},
|
|
2712
|
+
{
|
|
2713
|
+
kind: "field",
|
|
2714
|
+
path: ["translation", "displayMode"],
|
|
2715
|
+
schema: DocumentTranslationConfigSchema.shape.displayMode,
|
|
2716
|
+
fallback: DEFAULT_CONFIG.translation.displayMode
|
|
2717
|
+
},
|
|
2718
|
+
{
|
|
2719
|
+
kind: "field",
|
|
2720
|
+
path: ["translation", "engineId"],
|
|
2721
|
+
schema: DocumentTranslationConfigSchema.shape.engineId,
|
|
2722
|
+
fallback: DEFAULT_CONFIG.translation.engineId
|
|
2723
|
+
}
|
|
2724
|
+
];
|
|
2546
2725
|
function areStringArraysEqual(left, right) {
|
|
2547
2726
|
if (left === right) return true;
|
|
2548
2727
|
if (!left || !right) return !left && !right;
|
|
@@ -2613,6 +2792,14 @@ function toPersistedConfig(config, options = {}) {
|
|
|
2613
2792
|
if (config.translation.targetLanguage !== DEFAULT_CONFIG.translation.targetLanguage) translation.targetLanguage = config.translation.targetLanguage;
|
|
2614
2793
|
if (config.translation.displayMode !== DEFAULT_CONFIG.translation.displayMode) translation.displayMode = config.translation.displayMode;
|
|
2615
2794
|
if (config.translation.cacheEnabled !== DEFAULT_CONFIG.translation.cacheEnabled) translation.cacheEnabled = config.translation.cacheEnabled;
|
|
2795
|
+
if (config.translation.engineId !== DEFAULT_CONFIG.translation.engineId) translation.engineId = config.translation.engineId;
|
|
2796
|
+
const translationEngines = {};
|
|
2797
|
+
const localEngine = {};
|
|
2798
|
+
if (config.translation.engines.local.model !== DEFAULT_CONFIG.translation.engines.local.model) localEngine.model = config.translation.engines.local.model;
|
|
2799
|
+
if (config.translation.engines.local.selectedGroupId !== DEFAULT_CONFIG.translation.engines.local.selectedGroupId) localEngine.selectedGroupId = config.translation.engines.local.selectedGroupId;
|
|
2800
|
+
if (localEngine && hasOwnEntries$1(localEngine)) translationEngines.local = localEngine;
|
|
2801
|
+
if (config.translation.engines.openai.model !== DEFAULT_CONFIG.translation.engines.openai.model) translationEngines.openai = { model: config.translation.engines.openai.model };
|
|
2802
|
+
if (hasOwnEntries$1(translationEngines)) translation.engines = translationEngines;
|
|
2616
2803
|
if (hasOwnEntries$1(translation)) persisted.translation = translation;
|
|
2617
2804
|
return persisted;
|
|
2618
2805
|
}
|
|
@@ -2640,8 +2827,8 @@ var ConfigManager = class {
|
|
|
2640
2827
|
parseConfigContent(content) {
|
|
2641
2828
|
if (!content) return DEFAULT_CONFIG;
|
|
2642
2829
|
try {
|
|
2643
|
-
const
|
|
2644
|
-
const result = OpenSpecUIConfigSchema.safeParse(
|
|
2830
|
+
const sanitized = sanitizePersistedSettings(pruneNullish$1(JSON.parse(content)) ?? {}, PERSISTED_CONFIG_SANITIZE_RULES);
|
|
2831
|
+
const result = OpenSpecUIConfigSchema.safeParse(sanitized);
|
|
2645
2832
|
if (result.success) return result.data;
|
|
2646
2833
|
console.warn("Invalid config format, using defaults:", result.error.message);
|
|
2647
2834
|
return DEFAULT_CONFIG;
|
|
@@ -2715,7 +2902,17 @@ var ConfigManager = class {
|
|
|
2715
2902
|
},
|
|
2716
2903
|
translation: {
|
|
2717
2904
|
...current.translation,
|
|
2718
|
-
...config.translation
|
|
2905
|
+
...config.translation,
|
|
2906
|
+
engines: {
|
|
2907
|
+
local: {
|
|
2908
|
+
...current.translation.engines.local,
|
|
2909
|
+
...config.translation?.engines?.local
|
|
2910
|
+
},
|
|
2911
|
+
openai: {
|
|
2912
|
+
...current.translation.engines.openai,
|
|
2913
|
+
...config.translation?.engines?.openai
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2719
2916
|
}
|
|
2720
2917
|
});
|
|
2721
2918
|
if (isPersistedConfigEmpty(persisted) && !fileExists) return;
|
|
@@ -2842,8 +3039,33 @@ var ConfigManager = class {
|
|
|
2842
3039
|
|
|
2843
3040
|
//#endregion
|
|
2844
3041
|
//#region src/global-settings.ts
|
|
2845
|
-
const OpenSpecUIGlobalSettingsSchema = z.object({
|
|
3042
|
+
const OpenSpecUIGlobalSettingsSchema = z.object({
|
|
3043
|
+
translationCache: TranslationCacheSettingsSchema.default(TranslationCacheSettingsSchema.parse({})),
|
|
3044
|
+
translationEngines: TranslationEngineGlobalSettingsSchema.default(TranslationEngineGlobalSettingsSchema.parse({}))
|
|
3045
|
+
});
|
|
2846
3046
|
const DEFAULT_GLOBAL_SETTINGS = OpenSpecUIGlobalSettingsSchema.parse({});
|
|
3047
|
+
const PERSISTED_GLOBAL_SETTINGS_SANITIZE_RULES = [
|
|
3048
|
+
{
|
|
3049
|
+
kind: "object",
|
|
3050
|
+
path: ["translationCache"],
|
|
3051
|
+
fallback: {}
|
|
3052
|
+
},
|
|
3053
|
+
{
|
|
3054
|
+
kind: "object",
|
|
3055
|
+
path: ["translationEngines"],
|
|
3056
|
+
fallback: {}
|
|
3057
|
+
},
|
|
3058
|
+
{
|
|
3059
|
+
kind: "object",
|
|
3060
|
+
path: ["translationEngines", "openai"],
|
|
3061
|
+
fallback: {}
|
|
3062
|
+
},
|
|
3063
|
+
{
|
|
3064
|
+
kind: "object",
|
|
3065
|
+
path: ["translationEngines", "local"],
|
|
3066
|
+
fallback: {}
|
|
3067
|
+
}
|
|
3068
|
+
];
|
|
2847
3069
|
function getDefaultGlobalSettingsPath() {
|
|
2848
3070
|
return join$1(homedir(), ".openspecui", "settings.json");
|
|
2849
3071
|
}
|
|
@@ -2864,6 +3086,19 @@ function toPersistedGlobalSettings(settings) {
|
|
|
2864
3086
|
const translationCache = {};
|
|
2865
3087
|
if (settings.translationCache.entryLimit !== DEFAULT_GLOBAL_SETTINGS.translationCache.entryLimit) translationCache.entryLimit = settings.translationCache.entryLimit;
|
|
2866
3088
|
if (hasOwnEntries(translationCache)) persisted.translationCache = translationCache;
|
|
3089
|
+
const translationEngines = {};
|
|
3090
|
+
const defaultTranslationEngines = DEFAULT_GLOBAL_SETTINGS.translationEngines;
|
|
3091
|
+
const openai = {};
|
|
3092
|
+
if (settings.translationEngines.openai.baseUrl !== defaultTranslationEngines.openai.baseUrl) openai.baseUrl = settings.translationEngines.openai.baseUrl;
|
|
3093
|
+
if (settings.translationEngines.openai.token !== defaultTranslationEngines.openai.token) openai.token = settings.translationEngines.openai.token;
|
|
3094
|
+
if (settings.translationEngines.openai.model !== defaultTranslationEngines.openai.model) openai.model = settings.translationEngines.openai.model;
|
|
3095
|
+
if (hasOwnEntries(openai)) translationEngines.openai = openai;
|
|
3096
|
+
const local = {};
|
|
3097
|
+
if (settings.translationEngines.local.model !== defaultTranslationEngines.local.model) local.model = settings.translationEngines.local.model;
|
|
3098
|
+
if (settings.translationEngines.local.selectedGroupId !== defaultTranslationEngines.local.selectedGroupId) local.selectedGroupId = settings.translationEngines.local.selectedGroupId;
|
|
3099
|
+
if (settings.translationEngines.local.hfEndpoint !== defaultTranslationEngines.local.hfEndpoint) local.hfEndpoint = settings.translationEngines.local.hfEndpoint;
|
|
3100
|
+
if (hasOwnEntries(local)) translationEngines.local = local;
|
|
3101
|
+
if (hasOwnEntries(translationEngines)) persisted.translationEngines = translationEngines;
|
|
2867
3102
|
return persisted;
|
|
2868
3103
|
}
|
|
2869
3104
|
function isPersistedGlobalSettingsEmpty(settings) {
|
|
@@ -2886,8 +3121,8 @@ var GlobalSettingsManager = class {
|
|
|
2886
3121
|
parseSettingsContent(content) {
|
|
2887
3122
|
if (!content) return DEFAULT_GLOBAL_SETTINGS;
|
|
2888
3123
|
try {
|
|
2889
|
-
const
|
|
2890
|
-
const result = OpenSpecUIGlobalSettingsSchema.safeParse(
|
|
3124
|
+
const sanitized = sanitizePersistedSettings(pruneNullish(JSON.parse(content)) ?? {}, PERSISTED_GLOBAL_SETTINGS_SANITIZE_RULES);
|
|
3125
|
+
const result = OpenSpecUIGlobalSettingsSchema.safeParse(sanitized);
|
|
2891
3126
|
if (result.success) return result.data;
|
|
2892
3127
|
console.warn("Invalid global settings format, using defaults:", result.error.message);
|
|
2893
3128
|
return DEFAULT_GLOBAL_SETTINGS;
|
|
@@ -2909,6 +3144,17 @@ var GlobalSettingsManager = class {
|
|
|
2909
3144
|
translationCache: {
|
|
2910
3145
|
...current.translationCache,
|
|
2911
3146
|
...update.translationCache
|
|
3147
|
+
},
|
|
3148
|
+
translationEngines: {
|
|
3149
|
+
...current.translationEngines,
|
|
3150
|
+
openai: {
|
|
3151
|
+
...current.translationEngines.openai,
|
|
3152
|
+
...update.translationEngines?.openai
|
|
3153
|
+
},
|
|
3154
|
+
local: {
|
|
3155
|
+
...current.translationEngines.local,
|
|
3156
|
+
...update.translationEngines?.local
|
|
3157
|
+
}
|
|
2912
3158
|
}
|
|
2913
3159
|
}));
|
|
2914
3160
|
if (isPersistedGlobalSettingsEmpty(persisted) && !fileExists) return;
|
|
@@ -4034,6 +4280,7 @@ async function touchOpsxChangeDeps(projectDir, changeId) {
|
|
|
4034
4280
|
const changeDir = join$1(projectDir, "openspec", "changes", changeId);
|
|
4035
4281
|
await reactiveReadDir(changeDir, { includeHidden: true });
|
|
4036
4282
|
await reactiveReadFile(join$1(changeDir, ".openspec.yaml"));
|
|
4283
|
+
await touchDirectoryTree(changeDir);
|
|
4037
4284
|
}
|
|
4038
4285
|
async function touchDirectoryPathDeps(rootDir, relativePath) {
|
|
4039
4286
|
let currentPath = rootDir;
|
|
@@ -4756,4 +5003,4 @@ const PtyServerMessageSchema = z.discriminatedUnion("type", [
|
|
|
4756
5003
|
]);
|
|
4757
5004
|
|
|
4758
5005
|
//#endregion
|
|
4759
|
-
export { AI_TOOLS, ApplyInstructionsContextFilesSchema, ApplyInstructionsSchema, ApplyTaskSchema, ArtifactInstructionsSchema, ArtifactStatusSchema, BUILTIN_SOUND_IDS, BUILTIN_SOUND_OPTIONS, BUILTIN_TERMINAL_SPAWN_COMMANDS, BuiltinSoundIdSchema, CODE_EDITOR_THEME_VALUES, CUSTOM_SOUND_ADD_VALUE, ChangeFileSchema, ChangeSchema, ChangeStatusSchema, CliExecutor, CodeEditorThemeSchema, ConfigManager, CustomSoundHashSchema, CustomSoundIdSchema, CustomSoundMetadataFileSchema, CustomSoundMetadataSchema, DASHBOARD_METRIC_KEYS, DEFAULT_BELL_SOUND_ID, DEFAULT_CONFIG, DEFAULT_GIT_DIFF_EAGER_LINE_BUDGET, DEFAULT_GLOBAL_SETTINGS, DEFAULT_NOTIFICATION_SOUND_ID, DEFAULT_TERMINAL_DARK_THEME, DEFAULT_TERMINAL_LIGHT_THEME, DEFAULT_TERMINAL_THEME_MODE, DEFAULT_TRANSLATION_CACHE_ENTRY_LIMIT, DOCUMENT_TRANSLATION_DISPLAY_MODES, DashboardConfigSchema, DeltaOperationType, DeltaSchema, DeltaSpecSchema, DependencyInfoSchema, DocumentTranslationConfigSchema, DocumentTranslationDisplayModeSchema, GitConfigSchema, GlobalSettingsManager, HOSTED_SHELL_PROTOCOL_VERSION, LEGACY_SOUND_ID_MAP, MAX_TRANSLATION_CACHE_ENTRY_LIMIT, MIN_TRANSLATION_CACHE_ENTRY_LIMIT, MarkdownParser, MarkdownReadingPluginRegistry, NOTIFICATION_SOUND_OPTIONS, NOTIFICATION_SOUND_VALUES, NotificationActionSchema, NotificationGroupKeySchema, NotificationPublishInputSchema, NotificationRecordSchema, NotificationSettingsSchema, NotificationSoundSchema, NotificationSourceSchema, OFFICIAL_APP_BASE_URL, OPENSPECUI_HOOKS_VERSION, OPENSPECUI_RUNTIME_CAPABILITIES, OPEN_SPEC_READING_SECTIONS_PROJECTION_ID, OPEN_SPEC_SPEC_PROJECTION_ID, OPSX_AGENT_INVOCATION_MODE_VALUES, OpenSpecAdapter, OpenSpecUIConfigSchema, OpenSpecUIGlobalSettingsSchema, OpenSpecWatcher, OpsxAgentInvocationModeSchema, OpsxConfigSchema, OpsxKernel, ProjectWatcher, PtyAttachMessageSchema, PtyBellResponseSchema, PtyBufferResponseSchema, PtyClientMessageSchema, PtyCloseMessageSchema, PtyCreateMessageSchema, PtyCreatedResponseSchema, PtyErrorCodeSchema, PtyErrorResponseSchema, PtyExitResponseSchema, PtyInputMessageSchema, PtyListMessageSchema, PtyListResponseSchema, PtyOutputResponseSchema, PtyPlatformSchema, PtyProcessTitleResponseSchema, PtyResizeMessageSchema, PtyServerMessageSchema, PtyTitleResponseSchema, ReactiveContext, ReactiveState, RequirementSchema, SILENT_SOUND_ID, ScenarioStepKeywordSchema, ScenarioStepSchema, SchemaArtifactSchema, SchemaDetailSchema, SchemaInfoSchema, SchemaResolutionSchema, SoundConfigIdSchema, SoundIdSchema, SpecSchema, TERMINAL_BELL_SOUND_OPTIONS, TERMINAL_BELL_SOUND_VALUES, TERMINAL_COMMAND_FIELD_TYPE_VALUES, TERMINAL_SHELL_QUOTE_STYLE_VALUES, TERMINAL_THEME_MODE_VALUES, TERMINAL_THEME_VALUES, TOOL_WORKFLOW_TO_SKILL_DIR, TRANSLATION_CACHE_POLICY_VERSION, TaskSchema, TemplatesSchema, TerminalBellSoundSchema, TerminalCommandFieldSchema, TerminalConfigSchema, TerminalControlParser, TerminalInvocationSettingsSchema, TerminalNotificationParser, TerminalRendererEngineSchema, TerminalShellProfileSchema, TerminalShellQuoteStyleSchema, TerminalSpawnCommandSchema, TerminalThemeModeSchema, TerminalThemeSchema, TranslationCacheEntrySchema, TranslationCacheReadInputSchema, TranslationCacheSettingsSchema, TranslationCacheStatsSchema, TranslationCacheWriteInputSchema, VIRTUAL_PROJECT_DIRNAME, Validator, acquireWatcher, annotateOpenSpecFacts, annotateOpenSpecMarkdown, buildBackendHealthPayload, buildCliRunnerCandidates, buildEmbeddedUiLaunchUrl, buildHostedLaunchUrl, buildMarkdownParentMap, buildOpsxEntityDetail, builtinOpenSpecReadingPlugin, clearCache, closeAllProjectWatchers, closeAllWatchers, contextStorage, createCleanCliEnv, createFileChangeObservable, createMarkdownReadingDocument, createMarkdownReadingDocumentFromFacts, createOpenSpecReadingPlugin, customHashFromSoundId, getActiveWatcherCount, getAllToolIds, getAllTools, getAvailableToolIds, getAvailableTools, getBuiltinSoundUrl, getCacheSize, getConfiguredTools, getDefaultCliCommand, getDefaultCliCommandString, getDefaultGlobalSettingsPath, getDetectedProjectTools, getMarkdownAnnotation, getMarkdownAnnotationsForFact, getMarkdownFactSpan, getMarkdownHeadingEnd, getMarkdownHeadingFacts, getNotificationGroupKey, getNotificationGroupLabel, getOpenSpecAnnotation, getOpenSpecAnnotationsForFact, getOpenSpecProjectionAnnotation, getOpenSpecReadingSections, getOpsxEntityMetadataPath, getOpsxEntityRootRelativePath, getProjectWatcher, getTerminalCommandDefaultValues, getToolById, getToolInitStates, getWatchedProjectDir, getWatcherRuntimeStatus, groupNotifications, initWatcherPool, isBackendHealthRuntimeMetadata, isGlobPattern, isHostedBackendHealthResponse, isOpsxGlobPattern, isSupportedEmbeddedUiUrl, isTerminalRendererEngine, isToolConfigured, isWatcherPoolInitialized, normalizeEmbeddedUiUrl, normalizeHostedAppBaseUrl, normalizeLegacySoundId, normalizeOpsxEntityPath, openSpecAnnotationRules, opsxGlobToRegex, opsxPathMatchesPattern, parseCliCommand, parseMarkdownFacts, parseOpenSpecMarkdownToSpec, parseOpsxEntityMetadata, parseOpsxSchemaDetail, projectAnnotatedOpenSpecToSpec, projectOpenSpecMarkdown, quoteTerminalShellArg, reactiveExists, reactiveReadDir, reactiveReadFile, reactiveStat, renderTerminalCommandArgs, renderTerminalSpawnCommandLine, resolveHostedAppBaseUrl, resolveTerminalShellDefaults, sniffGlobalCli, sortMarkdownReadingPlugins, soundIdFromCustomHash, subscribeWatcherRuntimeStatus, terminalNotificationEventToPublishInput, toMarkdownFactKind, toOpsxDisplayPath, toPersistedGlobalSettings, trimMarkdownSlice };
|
|
5006
|
+
export { AI_TOOLS, ApplyInstructionsContextFilesSchema, ApplyInstructionsSchema, ApplyTaskSchema, ArtifactInstructionsSchema, ArtifactStatusSchema, BUILTIN_SOUND_IDS, BUILTIN_SOUND_OPTIONS, BUILTIN_TERMINAL_SPAWN_COMMANDS, BatchTranslateEventSchema, BatchTranslateInputSchema, BuiltinSoundIdSchema, CODE_EDITOR_THEME_VALUES, CUSTOM_SOUND_ADD_VALUE, ChangeFileSchema, ChangeSchema, ChangeStatusSchema, CliExecutor, CodeEditorThemeSchema, ConfigManager, CustomSoundHashSchema, CustomSoundIdSchema, CustomSoundMetadataFileSchema, CustomSoundMetadataSchema, DASHBOARD_METRIC_KEYS, DEFAULT_BELL_SOUND_ID, DEFAULT_CONFIG, DEFAULT_GIT_DIFF_EAGER_LINE_BUDGET, DEFAULT_GLOBAL_SETTINGS, DEFAULT_NOTIFICATION_SOUND_ID, DEFAULT_TERMINAL_DARK_THEME, DEFAULT_TERMINAL_LIGHT_THEME, DEFAULT_TERMINAL_THEME_MODE, DEFAULT_TRANSLATION_CACHE_ENTRY_LIMIT, DEFAULT_TRANSLATION_ENGINE_ID, DOCUMENT_TRANSLATION_DISPLAY_MODES, DashboardConfigSchema, DeltaOperationType, DeltaSchema, DeltaSpecSchema, DependencyInfoSchema, DocumentTranslationConfigSchema, DocumentTranslationDisplayModeSchema, GitConfigSchema, GlobalSettingsManager, HOSTED_SHELL_PROTOCOL_VERSION, LEGACY_SOUND_ID_MAP, LOCAL_MODEL_PROFILE_DEFINITIONS, LocalModelAssetLogSchema, LocalModelAssetPlanSnapshotSchema, LocalModelAssetStateSchema, LocalModelDownloadStatusSchema, MAX_TRANSLATION_CACHE_ENTRY_LIMIT, MIN_TRANSLATION_CACHE_ENTRY_LIMIT, MarkdownParser, MarkdownReadingPluginRegistry, NOTIFICATION_SOUND_OPTIONS, NOTIFICATION_SOUND_VALUES, NotificationActionSchema, NotificationGroupKeySchema, NotificationPublishInputSchema, NotificationRecordSchema, NotificationSettingsSchema, NotificationSoundSchema, NotificationSourceSchema, OFFICIAL_APP_BASE_URL, OPENSPECUI_HOOKS_VERSION, OPENSPECUI_RUNTIME_CAPABILITIES, OPEN_SPEC_READING_SECTIONS_PROJECTION_ID, OPEN_SPEC_SPEC_PROJECTION_ID, OPSX_AGENT_INVOCATION_MODE_VALUES, OpenSpecAdapter, OpenSpecUIConfigSchema, OpenSpecUIGlobalSettingsSchema, OpenSpecWatcher, OpsxAgentInvocationModeSchema, OpsxConfigSchema, OpsxKernel, ProjectWatcher, PtyAttachMessageSchema, PtyBellResponseSchema, PtyBufferResponseSchema, PtyClientMessageSchema, PtyCloseMessageSchema, PtyCreateMessageSchema, PtyCreatedResponseSchema, PtyErrorCodeSchema, PtyErrorResponseSchema, PtyExitResponseSchema, PtyInputMessageSchema, PtyListMessageSchema, PtyListResponseSchema, PtyOutputResponseSchema, PtyPlatformSchema, PtyProcessTitleResponseSchema, PtyResizeMessageSchema, PtyServerMessageSchema, PtyTitleResponseSchema, ReactiveContext, ReactiveState, RequirementSchema, SERVICE_TRANSLATION_ENGINE_IDS, SILENT_SOUND_ID, ScenarioStepKeywordSchema, ScenarioStepSchema, SchemaArtifactSchema, SchemaDetailSchema, SchemaInfoSchema, SchemaResolutionSchema, ServiceTranslationEngineIdSchema, SoundConfigIdSchema, SoundIdSchema, SpecSchema, TERMINAL_BELL_SOUND_OPTIONS, TERMINAL_BELL_SOUND_VALUES, TERMINAL_COMMAND_FIELD_TYPE_VALUES, TERMINAL_SHELL_QUOTE_STYLE_VALUES, TERMINAL_THEME_MODE_VALUES, TERMINAL_THEME_VALUES, TOOL_WORKFLOW_TO_SKILL_DIR, TRANSLATION_CACHE_POLICY_VERSION, TRANSLATION_ENGINE_IDS, TRANSLATION_ENGINE_MANIFESTS, TRANSLATOR_CONTRACT_VERSION, TaskSchema, TemplatesSchema, TerminalBellSoundSchema, TerminalCommandFieldSchema, TerminalConfigSchema, TerminalControlParser, TerminalInvocationSettingsSchema, TerminalNotificationParser, TerminalRendererEngineSchema, TerminalShellProfileSchema, TerminalShellQuoteStyleSchema, TerminalSpawnCommandSchema, TerminalThemeModeSchema, TerminalThemeSchema, TranslationCacheEntrySchema, TranslationCacheReadInputSchema, TranslationCacheSettingsSchema, TranslationCacheStatsSchema, TranslationCacheWriteInputSchema, TranslationDownloadFilePlanSchema, TranslationDownloadGroupPlanSchema, TranslationEngineGlobalSettingsSchema, TranslationEngineIdSchema, TranslationEngineProjectSettingsSchema, TranslationLocalSettingsSchema, TranslationOpenAISettingsSchema, VIRTUAL_PROJECT_DIRNAME, Validator, acquireWatcher, annotateOpenSpecFacts, annotateOpenSpecMarkdown, buildBackendHealthPayload, buildCliRunnerCandidates, buildEmbeddedUiLaunchUrl, buildHostedLaunchUrl, buildLocalDownloadPlanFromRepositoryFiles, buildLocalDownloadPlanFromRuntimeProfileFiles, buildMarkdownParentMap, buildOpsxEntityDetail, builtinOpenSpecReadingPlugin, clearCache, closeAllProjectWatchers, closeAllWatchers, contextStorage, createCleanCliEnv, createFileChangeObservable, createMarkdownReadingDocument, createMarkdownReadingDocumentFromFacts, createOpenSpecReadingPlugin, customHashFromSoundId, getActiveWatcherCount, getAllToolIds, getAllTools, getAvailableToolIds, getAvailableTools, getBuiltinSoundUrl, getCacheSize, getConfiguredTools, getDefaultCliCommand, getDefaultCliCommandString, getDefaultGlobalSettingsPath, getDetectedProjectTools, getMarkdownAnnotation, getMarkdownAnnotationsForFact, getMarkdownFactSpan, getMarkdownHeadingEnd, getMarkdownHeadingFacts, getNotificationGroupKey, getNotificationGroupLabel, getOpenSpecAnnotation, getOpenSpecAnnotationsForFact, getOpenSpecProjectionAnnotation, getOpenSpecReadingSections, getOpsxEntityMetadataPath, getOpsxEntityRootRelativePath, getProjectWatcher, getTerminalCommandDefaultValues, getToolById, getToolInitStates, getTranslationEngineManifest, getWatchedProjectDir, getWatcherRuntimeStatus, groupNotifications, initWatcherPool, isBackendHealthRuntimeMetadata, isGlobPattern, isHostedBackendHealthResponse, isOpsxGlobPattern, isSupportedEmbeddedUiUrl, isTerminalRendererEngine, isToolConfigured, isWatcherPoolInitialized, normalizeEmbeddedUiUrl, normalizeHostedAppBaseUrl, normalizeLegacySoundId, normalizeOpsxEntityPath, openSpecAnnotationRules, opsxGlobToRegex, opsxPathMatchesPattern, parseCliCommand, parseMarkdownFacts, parseOpenSpecMarkdownToSpec, parseOpsxEntityMetadata, parseOpsxSchemaDetail, projectAnnotatedOpenSpecToSpec, projectOpenSpecMarkdown, quoteTerminalShellArg, reactiveExists, reactiveReadDir, reactiveReadFile, reactiveStat, renderTerminalCommandArgs, renderTerminalSpawnCommandLine, resolveHostedAppBaseUrl, resolveTerminalShellDefaults, selectLocalDownloadGroup, sniffGlobalCli, sortMarkdownReadingPlugins, soundIdFromCustomHash, subscribeWatcherRuntimeStatus, terminalNotificationEventToPublishInput, toMarkdownFactKind, toOpsxDisplayPath, toPersistedGlobalSettings, trimMarkdownSlice };
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
//#region src/local-download-profiles.ts
|
|
2
|
+
const LOCAL_MODEL_PROFILE_DEFINITIONS = [
|
|
3
|
+
{
|
|
4
|
+
id: "q1",
|
|
5
|
+
label: "q1",
|
|
6
|
+
dtype: "q1",
|
|
7
|
+
suffix: "_q1",
|
|
8
|
+
description: "1-bit quantized ONNX profile."
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
id: "q1f16",
|
|
12
|
+
label: "q1f16",
|
|
13
|
+
dtype: "q1f16",
|
|
14
|
+
suffix: "_q1f16",
|
|
15
|
+
description: "1-bit block quantized fp16 ONNX profile."
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "q2",
|
|
19
|
+
label: "q2",
|
|
20
|
+
dtype: "q2",
|
|
21
|
+
suffix: "_q2",
|
|
22
|
+
description: "2-bit quantized ONNX profile."
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "q2f16",
|
|
26
|
+
label: "q2f16",
|
|
27
|
+
dtype: "q2f16",
|
|
28
|
+
suffix: "_q2f16",
|
|
29
|
+
description: "2-bit block quantized fp16 ONNX profile."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "q4",
|
|
33
|
+
label: "q4",
|
|
34
|
+
dtype: "q4",
|
|
35
|
+
suffix: "_q4",
|
|
36
|
+
description: "4-bit quantized ONNX profile."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "q4f16",
|
|
40
|
+
label: "q4f16",
|
|
41
|
+
dtype: "q4f16",
|
|
42
|
+
suffix: "_q4f16",
|
|
43
|
+
description: "4-bit block quantized fp16 ONNX profile."
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: "bnb4",
|
|
47
|
+
label: "bnb4",
|
|
48
|
+
dtype: "bnb4",
|
|
49
|
+
suffix: "_bnb4",
|
|
50
|
+
description: "bitsandbytes 4-bit ONNX profile."
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: "q8",
|
|
54
|
+
label: "q8",
|
|
55
|
+
dtype: "q8",
|
|
56
|
+
suffix: "_quantized",
|
|
57
|
+
description: "8-bit quantized ONNX profile."
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "int8",
|
|
61
|
+
label: "int8",
|
|
62
|
+
dtype: "int8",
|
|
63
|
+
suffix: "_int8",
|
|
64
|
+
description: "int8 ONNX profile."
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: "uint8",
|
|
68
|
+
label: "uint8",
|
|
69
|
+
dtype: "uint8",
|
|
70
|
+
suffix: "_uint8",
|
|
71
|
+
description: "uint8 ONNX profile."
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: "fp16",
|
|
75
|
+
label: "fp16",
|
|
76
|
+
dtype: "fp16",
|
|
77
|
+
suffix: "_fp16",
|
|
78
|
+
description: "fp16 ONNX profile."
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: "fp32",
|
|
82
|
+
label: "fp32",
|
|
83
|
+
dtype: "fp32",
|
|
84
|
+
suffix: "",
|
|
85
|
+
description: "fp32 ONNX profile."
|
|
86
|
+
}
|
|
87
|
+
];
|
|
88
|
+
const AUXILIARY_FILE_NAMES = new Set([
|
|
89
|
+
"added_tokens.json",
|
|
90
|
+
"config.json",
|
|
91
|
+
"generation_config.json",
|
|
92
|
+
"merges.txt",
|
|
93
|
+
"preprocessor_config.json",
|
|
94
|
+
"sentencepiece.bpe.model",
|
|
95
|
+
"source.spm",
|
|
96
|
+
"special_tokens_map.json",
|
|
97
|
+
"spiece.model",
|
|
98
|
+
"target.spm",
|
|
99
|
+
"tokenizer.json",
|
|
100
|
+
"tokenizer.model",
|
|
101
|
+
"tokenizer_config.json",
|
|
102
|
+
"vocab.json"
|
|
103
|
+
]);
|
|
104
|
+
function buildLocalDownloadPlanFromRepositoryFiles(input) {
|
|
105
|
+
const fileMap = new Map(input.files.filter((file) => file.path.length > 0).map((file) => [file.path, file.sizeBytes]));
|
|
106
|
+
const requiredBaseNames = resolveRequiredBaseNames(fileMap, input.isEncoderDecoder);
|
|
107
|
+
if (requiredBaseNames.length === 0) return null;
|
|
108
|
+
const auxiliaryFiles = collectAuxiliaryFiles(fileMap);
|
|
109
|
+
const groups = LOCAL_MODEL_PROFILE_DEFINITIONS.flatMap((profile) => {
|
|
110
|
+
const onnxFiles = collectProfileOnnxFiles({
|
|
111
|
+
fileMap,
|
|
112
|
+
requiredBaseNames,
|
|
113
|
+
suffix: profile.suffix
|
|
114
|
+
});
|
|
115
|
+
if (!onnxFiles) return [];
|
|
116
|
+
return [createDownloadGroup({
|
|
117
|
+
id: profile.id,
|
|
118
|
+
label: buildProfileLabel(profile.id),
|
|
119
|
+
description: profile.description,
|
|
120
|
+
profile: profile.id,
|
|
121
|
+
dtype: profile.dtype,
|
|
122
|
+
files: [...auxiliaryFiles, ...onnxFiles]
|
|
123
|
+
})];
|
|
124
|
+
});
|
|
125
|
+
return buildPlanFromGroups({
|
|
126
|
+
modelId: input.modelId,
|
|
127
|
+
groups,
|
|
128
|
+
selectedGroupId: input.selectedGroupId
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function buildLocalDownloadPlanFromRuntimeProfileFiles(input) {
|
|
132
|
+
const groups = input.groups.flatMap((entry) => {
|
|
133
|
+
const profile = LOCAL_MODEL_PROFILE_DEFINITIONS.find((item) => item.id === entry.profile);
|
|
134
|
+
if (!profile || entry.files.length === 0) return [];
|
|
135
|
+
return [createDownloadGroup({
|
|
136
|
+
id: profile.id,
|
|
137
|
+
label: buildProfileLabel(profile.id),
|
|
138
|
+
description: profile.description,
|
|
139
|
+
profile: profile.id,
|
|
140
|
+
dtype: entry.dtype,
|
|
141
|
+
files: entry.files
|
|
142
|
+
})];
|
|
143
|
+
});
|
|
144
|
+
return buildPlanFromGroups({
|
|
145
|
+
modelId: input.modelId,
|
|
146
|
+
groups,
|
|
147
|
+
selectedGroupId: input.selectedGroupId
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function selectLocalDownloadGroup(plan, selectedGroupId) {
|
|
151
|
+
if (!plan?.groups?.length) return null;
|
|
152
|
+
return (selectedGroupId ? plan.groups.find((group) => group.id === selectedGroupId && group.selectable) : void 0) ?? plan.groups.find((group) => group.selected) ?? selectSmallestSelectableGroup(plan.groups);
|
|
153
|
+
}
|
|
154
|
+
function buildPlanFromGroups(input) {
|
|
155
|
+
if (input.groups.length === 0) return null;
|
|
156
|
+
const selectedGroup = selectRequestedGroup(input.groups, input.selectedGroupId) ?? selectSmallestSelectableGroup(input.groups);
|
|
157
|
+
const selectedGroupId = selectedGroup?.id;
|
|
158
|
+
const groups = input.groups.map((group) => ({
|
|
159
|
+
...group,
|
|
160
|
+
selected: group.id === selectedGroupId
|
|
161
|
+
}));
|
|
162
|
+
const selectedFiles = selectedGroup?.files ?? [];
|
|
163
|
+
return {
|
|
164
|
+
modelId: input.modelId,
|
|
165
|
+
estimatedTotalBytes: selectedGroup?.estimatedTotalBytes,
|
|
166
|
+
files: selectedFiles,
|
|
167
|
+
selectedGroupId,
|
|
168
|
+
groups
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function selectRequestedGroup(groups, selectedGroupId) {
|
|
172
|
+
if (!selectedGroupId) return null;
|
|
173
|
+
return groups.find((group) => group.id === selectedGroupId && group.selectable) ?? null;
|
|
174
|
+
}
|
|
175
|
+
function selectSmallestSelectableGroup(groups) {
|
|
176
|
+
return groups.filter((group) => group.selectable && group.estimatedTotalBytes !== void 0).sort((left, right) => (left.estimatedTotalBytes ?? 0) - (right.estimatedTotalBytes ?? 0))[0] ?? null;
|
|
177
|
+
}
|
|
178
|
+
function createDownloadGroup(input) {
|
|
179
|
+
const files = dedupeFiles(input.files).map((file) => ({
|
|
180
|
+
path: file.path,
|
|
181
|
+
sizeBytes: file.sizeBytes,
|
|
182
|
+
required: true
|
|
183
|
+
}));
|
|
184
|
+
const estimatedTotalBytes = files.reduce((total, file) => total + (file.sizeBytes ?? 0), 0);
|
|
185
|
+
const hasConcreteSizes = files.length > 0 && files.every((file) => file.sizeBytes !== void 0);
|
|
186
|
+
return {
|
|
187
|
+
id: input.id,
|
|
188
|
+
label: input.label,
|
|
189
|
+
description: input.description,
|
|
190
|
+
profile: input.profile,
|
|
191
|
+
dtype: input.dtype,
|
|
192
|
+
estimatedTotalBytes: estimatedTotalBytes > 0 ? estimatedTotalBytes : void 0,
|
|
193
|
+
selectable: hasConcreteSizes && estimatedTotalBytes > 0,
|
|
194
|
+
selected: false,
|
|
195
|
+
files
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function resolveRequiredBaseNames(fileMap, isEncoderDecoder) {
|
|
199
|
+
const paths = [...fileMap.keys()];
|
|
200
|
+
const hasEncoder = paths.some((path) => path.startsWith("onnx/encoder_model"));
|
|
201
|
+
const hasMergedDecoder = paths.some((path) => path.startsWith("onnx/decoder_model_merged"));
|
|
202
|
+
if (isEncoderDecoder === true || hasEncoder && hasMergedDecoder) return ["encoder_model", "decoder_model_merged"];
|
|
203
|
+
if (paths.some((path) => path.startsWith("onnx/model"))) return ["model"];
|
|
204
|
+
return [];
|
|
205
|
+
}
|
|
206
|
+
function collectProfileOnnxFiles(input) {
|
|
207
|
+
const files = [];
|
|
208
|
+
for (const baseName of input.requiredBaseNames) {
|
|
209
|
+
const onnxPath = `onnx/${baseName}${input.suffix}.onnx`;
|
|
210
|
+
if (!input.fileMap.has(onnxPath)) return null;
|
|
211
|
+
files.push({
|
|
212
|
+
path: onnxPath,
|
|
213
|
+
sizeBytes: input.fileMap.get(onnxPath),
|
|
214
|
+
required: true
|
|
215
|
+
});
|
|
216
|
+
const externalPrefix = `${onnxPath}_data`;
|
|
217
|
+
for (const [path, sizeBytes] of input.fileMap) if (path.startsWith(externalPrefix)) files.push({
|
|
218
|
+
path,
|
|
219
|
+
sizeBytes,
|
|
220
|
+
required: true
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
return files;
|
|
224
|
+
}
|
|
225
|
+
function collectAuxiliaryFiles(fileMap) {
|
|
226
|
+
const files = [];
|
|
227
|
+
for (const [path, sizeBytes] of fileMap) if (AUXILIARY_FILE_NAMES.has(path)) files.push({
|
|
228
|
+
path,
|
|
229
|
+
sizeBytes,
|
|
230
|
+
required: true
|
|
231
|
+
});
|
|
232
|
+
return files.sort((left, right) => left.path.localeCompare(right.path));
|
|
233
|
+
}
|
|
234
|
+
function dedupeFiles(files) {
|
|
235
|
+
const seen = /* @__PURE__ */ new Set();
|
|
236
|
+
const result = [];
|
|
237
|
+
for (const file of files) {
|
|
238
|
+
if (!file.path || seen.has(file.path)) continue;
|
|
239
|
+
seen.add(file.path);
|
|
240
|
+
result.push(file);
|
|
241
|
+
}
|
|
242
|
+
return result;
|
|
243
|
+
}
|
|
244
|
+
function buildProfileLabel(profile) {
|
|
245
|
+
switch (profile) {
|
|
246
|
+
case "q1": return "q1 (1-bit)";
|
|
247
|
+
case "q2": return "q2 (2-bit)";
|
|
248
|
+
case "q4": return "q4 (4-bit)";
|
|
249
|
+
case "q8": return "q8 (8-bit)";
|
|
250
|
+
default: return profile;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
//#endregion
|
|
255
|
+
export { selectLocalDownloadGroup as i, buildLocalDownloadPlanFromRepositoryFiles as n, buildLocalDownloadPlanFromRuntimeProfileFiles as r, LOCAL_MODEL_PROFILE_DEFINITIONS as t };
|