@kubbisec/ai-linux-arm64 0.1.21 → 0.1.22
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/bundled/clarify/clarify-gate-state.d.ts +1 -1
- package/bundled/clarify/clarify-gate-state.js +3 -3
- package/bundled/clarify/clarify-gate.d.ts +21 -14
- package/bundled/clarify/clarify-gate.js +118 -111
- package/bundled/clarify/clarify-select-panel.d.ts +16 -9
- package/bundled/clarify/clarify-select-panel.js +65 -67
- package/bundled/clarify/clarify-ui-state.d.ts +12 -10
- package/bundled/clarify/clarify-ui-state.js +26 -26
- package/bundled/clarify/parse-clarify-answer.d.ts +29 -18
- package/bundled/clarify/parse-clarify-answer.js +39 -45
- package/bundled/clarify/question-format.d.ts +34 -23
- package/bundled/clarify/question-format.js +112 -119
- package/bundled/clarify/questionnaire-tool.d.ts +28 -17
- package/bundled/clarify/questionnaire-tool.js +180 -144
- package/bundled/clarify/scope-discovery.d.ts +8 -5
- package/bundled/clarify/scope-discovery.js +102 -110
- package/bundled/clarify/session-questionnaire.d.ts +48 -13
- package/bundled/clarify/session-questionnaire.js +304 -312
- package/bundled/clarify/session-questionnaire.types.d.ts +29 -27
- package/bundled/clarify/session-questionnaire.types.js +10 -10
- package/bundled/components/kubbisec-model-selector.d.ts +47 -34
- package/bundled/components/kubbisec-model-selector.js +187 -177
- package/bundled/config/config.d.ts +6 -6
- package/bundled/config/config.js +55 -55
- package/bundled/config/detect-local-llm-providers.d.ts +26 -16
- package/bundled/config/detect-local-llm-providers.js +130 -142
- package/bundled/config/ensure-kubbisec-project-settings.d.ts +9 -9
- package/bundled/config/ensure-kubbisec-project-settings.js +44 -48
- package/bundled/config/extended-context.d.ts +5 -6
- package/bundled/config/extended-context.js +23 -22
- package/bundled/config/feature-flags.d.ts +10 -2
- package/bundled/config/feature-flags.js +8 -2
- package/bundled/config/format-kubbisec-footer-status.d.ts +1 -1
- package/bundled/config/format-kubbisec-footer-status.js +26 -31
- package/bundled/config/kubbisec-extension-manifest.d.ts +22 -2
- package/bundled/config/kubbisec-extension-manifest.js +20 -20
- package/bundled/config/llm-config-mutations.d.ts +51 -25
- package/bundled/config/llm-config-mutations.js +173 -182
- package/bundled/config/llm-config.d.ts +54 -41
- package/bundled/config/llm-config.js +199 -199
- package/bundled/config/llm-provider-catalog.d.ts +18 -15
- package/bundled/config/llm-provider-catalog.js +45 -46
- package/bundled/config/materialize-kubbisec-pi-resources.d.ts +1 -1
- package/bundled/config/materialize-kubbisec-pi-resources.js +174 -183
- package/bundled/config/register-custom-llm-providers.d.ts +11 -5
- package/bundled/config/register-custom-llm-providers.js +17 -15
- package/bundled/config/register-kubbisec-llm-provider.d.ts +14 -10
- package/bundled/config/register-kubbisec-llm-provider.js +50 -42
- package/bundled/config/resolve-agents-context-file.d.ts +1 -1
- package/bundled/config/resolve-agents-context-file.js +33 -34
- package/bundled/config/resource-budget.d.ts +12 -12
- package/bundled/config/resource-budget.js +28 -28
- package/bundled/config/sync-kubbisec-pi-models.d.ts +6 -3
- package/bundled/config/sync-kubbisec-pi-models.js +58 -58
- package/bundled/copy/cli-reference-index.d.ts +3 -2
- package/bundled/copy/cli-reference-index.js +1 -1
- package/bundled/copy/kubbisec-shell-copy.d.ts +11 -6
- package/bundled/copy/kubbisec-shell-copy.js +1 -1
- package/bundled/extensions/cli-local-shared.d.ts +45 -26
- package/bundled/extensions/cli-local-shared.js +128 -118
- package/bundled/extensions/kubbisec-aspm-local.extension.d.ts +18 -15
- package/bundled/extensions/kubbisec-aspm-local.extension.js +118 -114
- package/bundled/extensions/kubbisec-brand.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-brand.extension.js +25 -25
- package/bundled/extensions/kubbisec-byok-provider.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-byok-provider.extension.js +2 -2
- package/bundled/extensions/kubbisec-clarify.extension.d.ts +64 -35
- package/bundled/extensions/kubbisec-clarify.extension.js +323 -305
- package/bundled/extensions/kubbisec-exit.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-exit.extension.js +29 -32
- package/bundled/extensions/kubbisec-extended-context.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-extended-context.extension.js +56 -43
- package/bundled/extensions/kubbisec-footer.extension.d.ts +14 -14
- package/bundled/extensions/kubbisec-footer.extension.js +205 -215
- package/bundled/extensions/kubbisec-github-local.extension.d.ts +26 -18
- package/bundled/extensions/kubbisec-github-local.extension.js +123 -116
- package/bundled/extensions/kubbisec-llm-config.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-llm-config.extension.js +200 -181
- package/bundled/extensions/kubbisec-memory.extension.d.ts +9 -7
- package/bundled/extensions/kubbisec-memory.extension.js +88 -95
- package/bundled/extensions/kubbisec-naus-local.extension.d.ts +18 -15
- package/bundled/extensions/kubbisec-naus-local.extension.js +132 -111
- package/bundled/extensions/kubbisec-platform-tools.extension.d.ts +31 -21
- package/bundled/extensions/kubbisec-platform-tools.extension.js +152 -152
- package/bundled/extensions/kubbisec-runtime-status.extension.d.ts +10 -8
- package/bundled/extensions/kubbisec-runtime-status.extension.js +15 -13
- package/bundled/extensions/kubbisec-scope.extension.d.ts +12 -7
- package/bundled/extensions/kubbisec-scope.extension.js +13 -13
- package/bundled/extensions/kubbisec-skill-mentions.extension.d.ts +27 -16
- package/bundled/extensions/kubbisec-skill-mentions.extension.js +73 -63
- package/bundled/extensions/kubbisec-skill-telemetry.extension.d.ts +2 -3
- package/bundled/extensions/kubbisec-skill-telemetry.extension.js +59 -64
- package/bundled/extensions/kubbisec-theme-lock.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-theme-lock.extension.js +33 -34
- package/bundled/extensions/kubbisec-ui.extension.d.ts +1 -1
- package/bundled/extensions/kubbisec-ui.extension.js +114 -109
- package/bundled/extensions/kubbisec-workflow.extension.d.ts +20 -18
- package/bundled/extensions/kubbisec-workflow.extension.js +138 -140
- package/bundled/node_modules/@aspm/shared/dist/redaction.test.d.ts +2 -0
- package/bundled/node_modules/@aspm/shared/dist/redaction.test.d.ts.map +1 -0
- package/bundled/node_modules/@aspm/shared/dist/redaction.test.js +626 -0
- package/bundled/node_modules/@aspm/shared/dist/redaction.test.js.map +1 -0
- package/bundled/resolve-bundled-dist-root.js +122 -131
- package/bundled/skills/at-path-mentions.d.ts +1 -1
- package/bundled/skills/at-path-mentions.js +146 -153
- package/bundled/skills/chat-mention-render.d.ts +2 -2
- package/bundled/skills/chat-mention-render.js +121 -126
- package/bundled/skills/chat-mentions.d.ts +17 -8
- package/bundled/skills/chat-mentions.js +76 -76
- package/bundled/skills/list-bundled-skills.d.ts +3 -3
- package/bundled/skills/list-bundled-skills.js +33 -35
- package/bundled/skills/skill-mention.d.ts +10 -2
- package/bundled/skills/skill-mention.js +10 -2
- package/bundled/theme/clear-terminal.d.ts +1 -1
- package/bundled/theme/clear-terminal.js +3 -4
- package/bundled/theme/footer-render-hook.d.ts +1 -1
- package/bundled/theme/footer-render-hook.js +3 -3
- package/bundled/theme/kubbisec-brand-fg.d.ts +1 -1
- package/bundled/theme/kubbisec-brand-fg.js +2 -2
- package/bundled/theme/kubbisec-menu-themes.d.ts +7 -7
- package/bundled/theme/kubbisec-menu-themes.js +30 -31
- package/bundled/theme/kubbisec-theme-name.d.ts +1 -1
- package/bundled/theme/kubbisec-theme-name.js +1 -1
- package/bundled/theme/patch-pi-settings-theme.runtime.d.ts +1 -1
- package/bundled/theme/patch-pi-settings-theme.runtime.js +11 -10
- package/bundled/theme/render-compact-header.d.ts +13 -5
- package/bundled/theme/render-compact-header.js +127 -129
- package/bundled/workflow/session-workflow-mode.d.ts +1 -1
- package/bundled/workflow/session-workflow-mode.js +33 -33
- package/package.json +1 -1
|
@@ -2,245 +2,245 @@ import * as fs from "node:fs";
|
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import { KUBBISEC_PROJECT_CONFIG_DIR } from "./ensure-kubbisec-project-settings.js";
|
|
4
4
|
import { KUBBISEC_LLM_PROVIDER_ID, mergeKubbisecModelCatalog } from "./llm-provider-catalog.js";
|
|
5
|
+
|
|
5
6
|
const LLM_CONFIG_FILE = "llm.json";
|
|
6
7
|
const DEFAULT_LLM_CONFIG = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
defaultProvider: KUBBISEC_LLM_PROVIDER_ID,
|
|
9
|
+
defaultThinkingLevel: "medium",
|
|
10
|
+
temperature: 0.2,
|
|
10
11
|
};
|
|
11
12
|
export function resolveLlmConfigPath(cwd = process.cwd()) {
|
|
12
|
-
|
|
13
|
+
return path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR, LLM_CONFIG_FILE);
|
|
13
14
|
}
|
|
14
15
|
function readJsonFile(filePath) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
16
|
+
try {
|
|
17
|
+
return JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
18
|
+
} catch {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
21
|
}
|
|
22
22
|
export function parseLlmConfig(raw) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
? { baseUrl: local.ollama.baseUrl.trim() }
|
|
57
|
-
: {}),
|
|
58
|
-
},
|
|
59
|
-
}
|
|
23
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
24
|
+
return { ...DEFAULT_LLM_CONFIG };
|
|
25
|
+
}
|
|
26
|
+
const input = raw;
|
|
27
|
+
const next = { ...DEFAULT_LLM_CONFIG };
|
|
28
|
+
if (typeof input.defaultProvider === "string" && input.defaultProvider.trim()) {
|
|
29
|
+
next.defaultProvider = input.defaultProvider.trim();
|
|
30
|
+
}
|
|
31
|
+
if (typeof input.defaultModel === "string" && input.defaultModel.trim()) {
|
|
32
|
+
next.defaultModel = input.defaultModel.trim();
|
|
33
|
+
}
|
|
34
|
+
if (
|
|
35
|
+
input.defaultThinkingLevel === "off" ||
|
|
36
|
+
input.defaultThinkingLevel === "minimal" ||
|
|
37
|
+
input.defaultThinkingLevel === "low" ||
|
|
38
|
+
input.defaultThinkingLevel === "medium" ||
|
|
39
|
+
input.defaultThinkingLevel === "high" ||
|
|
40
|
+
input.defaultThinkingLevel === "xhigh"
|
|
41
|
+
) {
|
|
42
|
+
next.defaultThinkingLevel = input.defaultThinkingLevel;
|
|
43
|
+
}
|
|
44
|
+
if (typeof input.temperature === "number" && Number.isFinite(input.temperature)) {
|
|
45
|
+
next.temperature = Math.min(2, Math.max(0, input.temperature));
|
|
46
|
+
}
|
|
47
|
+
if (input.localLlm && typeof input.localLlm === "object" && !Array.isArray(input.localLlm)) {
|
|
48
|
+
const local = input.localLlm;
|
|
49
|
+
next.localLlm = {
|
|
50
|
+
...(typeof local?.autoDetect === "boolean" ? { autoDetect: local.autoDetect } : {}),
|
|
51
|
+
...(local?.ollama && typeof local.ollama === "object"
|
|
52
|
+
? {
|
|
53
|
+
ollama: {
|
|
54
|
+
...(local.ollama.enabled !== undefined
|
|
55
|
+
? { enabled: local.ollama.enabled === true }
|
|
60
56
|
: {}),
|
|
61
|
-
|
|
62
|
-
? {
|
|
63
|
-
lmstudio: {
|
|
64
|
-
...(local.lmstudio.enabled !== undefined
|
|
65
|
-
? { enabled: local.lmstudio.enabled === true }
|
|
66
|
-
: {}),
|
|
67
|
-
...(typeof local.lmstudio.baseUrl === "string" && local.lmstudio.baseUrl.trim()
|
|
68
|
-
? { baseUrl: local.lmstudio.baseUrl.trim() }
|
|
69
|
-
: {}),
|
|
70
|
-
},
|
|
71
|
-
}
|
|
57
|
+
...(typeof local.ollama.baseUrl === "string" && local.ollama.baseUrl.trim()
|
|
58
|
+
? { baseUrl: local.ollama.baseUrl.trim() }
|
|
72
59
|
: {}),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
.map((m) => ({ ...m, id: m.id.trim() }))
|
|
82
|
-
.filter((m) => m.id.length > 0),
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (Array.isArray(input.providers)) {
|
|
87
|
-
next.providers = input.providers
|
|
88
|
-
.filter((p) => {
|
|
89
|
-
return Boolean(p &&
|
|
90
|
-
typeof p === "object" &&
|
|
91
|
-
typeof p.id === "string" &&
|
|
92
|
-
typeof p.baseUrl === "string" &&
|
|
93
|
-
Array.isArray(p.models));
|
|
94
|
-
})
|
|
95
|
-
.map((p) => ({
|
|
96
|
-
...p,
|
|
97
|
-
id: p.id.trim(),
|
|
98
|
-
baseUrl: p.baseUrl.trim(),
|
|
99
|
-
...(p.autodetected === true ? { autodetected: true } : {}),
|
|
100
|
-
...(p.detectSource === "ollama" || p.detectSource === "lmstudio"
|
|
101
|
-
? { detectSource: p.detectSource }
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
: {}),
|
|
63
|
+
...(local?.lmstudio && typeof local.lmstudio === "object"
|
|
64
|
+
? {
|
|
65
|
+
lmstudio: {
|
|
66
|
+
...(local.lmstudio.enabled !== undefined
|
|
67
|
+
? { enabled: local.lmstudio.enabled === true }
|
|
102
68
|
: {}),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
69
|
+
...(typeof local.lmstudio.baseUrl === "string" && local.lmstudio.baseUrl.trim()
|
|
70
|
+
? { baseUrl: local.lmstudio.baseUrl.trim() }
|
|
71
|
+
: {}),
|
|
72
|
+
},
|
|
73
|
+
}
|
|
74
|
+
: {}),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (input.kubbisec && typeof input.kubbisec === "object" && !Array.isArray(input.kubbisec)) {
|
|
78
|
+
const kub = input.kubbisec;
|
|
79
|
+
if (Array.isArray(kub.models)) {
|
|
80
|
+
next.kubbisec = {
|
|
81
|
+
models: kub.models
|
|
82
|
+
.filter((m) => Boolean(m && typeof m === "object" && typeof m.id === "string"))
|
|
83
|
+
.map((m) => ({ ...m, id: m.id.trim() }))
|
|
84
|
+
.filter((m) => m.id.length > 0),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (Array.isArray(input.providers)) {
|
|
89
|
+
next.providers = input.providers
|
|
90
|
+
.filter((p) => {
|
|
91
|
+
return Boolean(
|
|
92
|
+
p &&
|
|
93
|
+
typeof p === "object" &&
|
|
94
|
+
typeof p.id === "string" &&
|
|
95
|
+
typeof p.baseUrl === "string" &&
|
|
96
|
+
Array.isArray(p.models),
|
|
97
|
+
);
|
|
98
|
+
})
|
|
99
|
+
.map((p) => ({
|
|
100
|
+
...p,
|
|
101
|
+
id: p.id.trim(),
|
|
102
|
+
baseUrl: p.baseUrl.trim(),
|
|
103
|
+
...(p.autodetected === true ? { autodetected: true } : {}),
|
|
104
|
+
...(p.detectSource === "ollama" || p.detectSource === "lmstudio"
|
|
105
|
+
? { detectSource: p.detectSource }
|
|
106
|
+
: {}),
|
|
107
|
+
models: p.models.filter((m) => m.id?.trim()).map((m) => ({ ...m, id: m.id.trim() })),
|
|
108
|
+
}))
|
|
109
|
+
.filter((p) => p.id.length > 0 && p.baseUrl.length > 0 && p.models.length > 0);
|
|
110
|
+
}
|
|
111
|
+
return next;
|
|
108
112
|
}
|
|
109
113
|
export function readLlmConfig(cwd = process.cwd()) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
114
|
+
const filePath = resolveLlmConfigPath(cwd);
|
|
115
|
+
const parsed = parseLlmConfig(readJsonFile(filePath));
|
|
116
|
+
return parsed;
|
|
113
117
|
}
|
|
114
118
|
export function writeLlmConfig(cwd, config) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
const filePath = resolveLlmConfigPath(cwd);
|
|
120
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true, mode: 0o755 });
|
|
121
|
+
fs.writeFileSync(filePath, `${JSON.stringify(config, null, 2)}\n`, {
|
|
122
|
+
encoding: "utf8",
|
|
123
|
+
mode: 0o600,
|
|
124
|
+
});
|
|
121
125
|
}
|
|
122
126
|
export function ensureLlmConfigFromOrg(cwd, options) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
127
|
+
const current = readLlmConfig(cwd);
|
|
128
|
+
const orgModel = options.model?.trim();
|
|
129
|
+
const merged = {
|
|
130
|
+
...current,
|
|
131
|
+
defaultProvider: KUBBISEC_LLM_PROVIDER_ID,
|
|
132
|
+
...(orgModel ? { defaultModel: orgModel } : {}),
|
|
133
|
+
kubbisec: {
|
|
134
|
+
models: mergeKubbisecModelCatalog(orgModel, current.kubbisec?.models),
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
writeLlmConfig(cwd, merged);
|
|
138
|
+
return merged;
|
|
135
139
|
}
|
|
136
140
|
function resolveAgentProjectSettingsPath(cwd) {
|
|
137
|
-
|
|
141
|
+
return path.join(cwd, KUBBISEC_PROJECT_CONFIG_DIR, "settings.json");
|
|
138
142
|
}
|
|
139
143
|
export function applyLlmConfigToAgentSettings(cwd = process.cwd(), config = readLlmConfig(cwd)) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
});
|
|
144
|
+
const settingsPath = resolveAgentProjectSettingsPath(cwd);
|
|
145
|
+
fs.mkdirSync(path.dirname(settingsPath), { recursive: true, mode: 0o755 });
|
|
146
|
+
let existing = {};
|
|
147
|
+
try {
|
|
148
|
+
const raw = readJsonFile(settingsPath);
|
|
149
|
+
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
|
|
150
|
+
existing = raw;
|
|
151
|
+
}
|
|
152
|
+
} catch {
|
|
153
|
+
/* fresh */
|
|
154
|
+
}
|
|
155
|
+
const merged = {
|
|
156
|
+
...existing,
|
|
157
|
+
defaultProvider: config.defaultProvider ?? KUBBISEC_LLM_PROVIDER_ID,
|
|
158
|
+
...(config.defaultModel ? { defaultModel: config.defaultModel } : {}),
|
|
159
|
+
...(config.defaultThinkingLevel ? { defaultThinkingLevel: config.defaultThinkingLevel } : {}),
|
|
160
|
+
};
|
|
161
|
+
fs.writeFileSync(settingsPath, `${JSON.stringify(merged, null, 2)}\n`, {
|
|
162
|
+
encoding: "utf8",
|
|
163
|
+
mode: 0o600,
|
|
164
|
+
});
|
|
162
165
|
}
|
|
163
166
|
/** @deprecated Use applyLlmConfigToAgentSettings */
|
|
164
167
|
export const applyLlmConfigToPiSettings = applyLlmConfigToAgentSettings;
|
|
165
168
|
export function resolveApiKeyValue(apiKey) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
return raw;
|
|
169
|
+
const raw = apiKey?.trim();
|
|
170
|
+
if (!raw) return undefined;
|
|
171
|
+
if (/^[A-Z][A-Z0-9_]*$/.test(raw)) {
|
|
172
|
+
const fromEnv = process.env[raw]?.trim();
|
|
173
|
+
return fromEnv || undefined;
|
|
174
|
+
}
|
|
175
|
+
return raw;
|
|
174
176
|
}
|
|
175
177
|
let runtimeTemperature;
|
|
176
178
|
export function getRuntimeTemperature(config = readLlmConfig()) {
|
|
177
|
-
|
|
179
|
+
return runtimeTemperature ?? config.temperature;
|
|
178
180
|
}
|
|
179
181
|
export function setRuntimeTemperature(value, cwd = process.cwd()) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
182
|
+
if (value == null || !Number.isFinite(value)) {
|
|
183
|
+
runtimeTemperature = undefined;
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
runtimeTemperature = Math.min(2, Math.max(0, value));
|
|
187
|
+
const config = readLlmConfig(cwd);
|
|
188
|
+
writeLlmConfig(cwd, { ...config, temperature: runtimeTemperature });
|
|
187
189
|
}
|
|
188
190
|
export function applyTemperatureToProviderPayload(payload, temperature) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
const body = payload;
|
|
194
|
-
if ("temperature" in body) {
|
|
195
|
-
return { ...body, temperature };
|
|
196
|
-
}
|
|
197
|
-
if (typeof body.body === "string") {
|
|
198
|
-
try {
|
|
199
|
-
const parsed = JSON.parse(body.body);
|
|
200
|
-
return { ...body, body: JSON.stringify({ ...parsed, temperature }) };
|
|
201
|
-
}
|
|
202
|
-
catch {
|
|
203
|
-
return payload;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
if (body.body && typeof body.body === "object" && !Array.isArray(body.body)) {
|
|
207
|
-
return {
|
|
208
|
-
...body,
|
|
209
|
-
body: { ...body.body, temperature },
|
|
210
|
-
};
|
|
211
|
-
}
|
|
191
|
+
if (temperature == null || !Number.isFinite(temperature)) return payload;
|
|
192
|
+
if (!payload || typeof payload !== "object") return payload;
|
|
193
|
+
const body = payload;
|
|
194
|
+
if ("temperature" in body) {
|
|
212
195
|
return { ...body, temperature };
|
|
196
|
+
}
|
|
197
|
+
if (typeof body.body === "string") {
|
|
198
|
+
try {
|
|
199
|
+
const parsed = JSON.parse(body.body);
|
|
200
|
+
return { ...body, body: JSON.stringify({ ...parsed, temperature }) };
|
|
201
|
+
} catch {
|
|
202
|
+
return payload;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (body.body && typeof body.body === "object" && !Array.isArray(body.body)) {
|
|
206
|
+
return {
|
|
207
|
+
...body,
|
|
208
|
+
body: { ...body.body, temperature },
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
return { ...body, temperature };
|
|
213
212
|
}
|
|
214
213
|
export function resolveChatModelId(cwd = process.cwd(), orgModel) {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
214
|
+
const config = readLlmConfig(cwd);
|
|
215
|
+
return (
|
|
216
|
+
config.defaultModel?.trim() ||
|
|
217
|
+
process.env.KUBBISEC_AI_MODEL_ID?.trim() ||
|
|
218
|
+
process.env.KUBBISEC_AI_MODEL?.trim() ||
|
|
219
|
+
process.env.KUBBISEC_PI_MODEL?.trim() ||
|
|
220
|
+
process.env.NAUS_PI_MODEL?.trim() ||
|
|
221
|
+
orgModel?.trim() ||
|
|
222
|
+
"gpt-4o"
|
|
223
|
+
);
|
|
223
224
|
}
|
|
224
225
|
export function resolveChatProviderId(cwd = process.cwd()) {
|
|
225
|
-
|
|
226
|
-
|
|
226
|
+
const config = readLlmConfig(cwd);
|
|
227
|
+
return config.defaultProvider?.trim() || KUBBISEC_LLM_PROVIDER_ID;
|
|
227
228
|
}
|
|
228
229
|
export const FOOTER_INFERENCE_UNSET = "—";
|
|
229
230
|
/** Footer model ref: `provider/id` (no provider display name or KubbiSec branding). */
|
|
230
231
|
export function formatModelFooterLabel(provider, modelId) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
const providerId = provider.trim() || KUBBISEC_LLM_PROVIDER_ID;
|
|
237
|
-
return `${providerId}/${id}`;
|
|
232
|
+
const id = modelId.trim();
|
|
233
|
+
if (!id) return "no-model";
|
|
234
|
+
if (id.includes("/")) return id;
|
|
235
|
+
const providerId = provider.trim() || KUBBISEC_LLM_PROVIDER_ID;
|
|
236
|
+
return `${providerId}/${id}`;
|
|
238
237
|
}
|
|
239
238
|
export function formatModelFooterWithInferenceSettings(modelRef, thinkingLevel, temperature) {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
|
|
239
|
+
const thinking = thinkingLevel?.trim() || FOOTER_INFERENCE_UNSET;
|
|
240
|
+
const temp =
|
|
241
|
+
temperature != null && Number.isFinite(temperature)
|
|
242
|
+
? String(temperature)
|
|
243
|
+
: FOOTER_INFERENCE_UNSET;
|
|
244
|
+
return `${modelRef} · ${thinking} · ${temp}`;
|
|
245
|
+
}
|
|
246
|
+
//# sourceMappingURL=llm-config.js.map
|
|
@@ -3,20 +3,23 @@ export declare const KUBBISEC_LLM_PROVIDER_ID = "kubbisec";
|
|
|
3
3
|
export declare const KUBBISEC_LLM_PROVIDER_NAME = "KubbiSec";
|
|
4
4
|
export declare const KUBBISEC_BUILTIN_MODELS: KubbisecLlmModelDef[];
|
|
5
5
|
export type ProviderModelConfigShape = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
api: "openai-completions";
|
|
9
|
+
reasoning: boolean;
|
|
10
|
+
input: ("text" | "image")[];
|
|
11
|
+
cost: {
|
|
12
|
+
input: number;
|
|
13
|
+
output: number;
|
|
14
|
+
cacheRead: number;
|
|
15
|
+
cacheWrite: number;
|
|
16
|
+
};
|
|
17
|
+
contextWindow: number;
|
|
18
|
+
maxTokens: number;
|
|
19
19
|
};
|
|
20
20
|
export declare function toProviderModelConfig(def: KubbisecLlmModelDef): ProviderModelConfigShape;
|
|
21
|
-
export declare function mergeKubbisecModelCatalog(
|
|
22
|
-
|
|
21
|
+
export declare function mergeKubbisecModelCatalog(
|
|
22
|
+
orgModel?: string | null,
|
|
23
|
+
extra?: KubbisecLlmModelDef[],
|
|
24
|
+
): KubbisecLlmModelDef[];
|
|
25
|
+
//# sourceMappingURL=llm-provider-catalog.d.ts.map
|
|
@@ -1,54 +1,53 @@
|
|
|
1
1
|
export const KUBBISEC_LLM_PROVIDER_ID = "kubbisec";
|
|
2
2
|
export const KUBBISEC_LLM_PROVIDER_NAME = "KubbiSec";
|
|
3
3
|
export const KUBBISEC_BUILTIN_MODELS = [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
{ id: "gpt-4o", name: "GPT-4o", reasoning: false, contextWindow: 128_000, maxTokens: 16_384 },
|
|
5
|
+
{
|
|
6
|
+
id: "gpt-4o-mini",
|
|
7
|
+
name: "GPT-4o Mini",
|
|
8
|
+
reasoning: false,
|
|
9
|
+
contextWindow: 128_000,
|
|
10
|
+
maxTokens: 16_384,
|
|
11
|
+
},
|
|
12
|
+
{ id: "o3-mini", name: "O3 Mini", reasoning: true, contextWindow: 200_000, maxTokens: 100_000 },
|
|
13
|
+
{
|
|
14
|
+
id: "claude-sonnet-4-20250514",
|
|
15
|
+
name: "Claude Sonnet 4",
|
|
16
|
+
reasoning: true,
|
|
17
|
+
contextWindow: 200_000,
|
|
18
|
+
maxTokens: 16_384,
|
|
19
|
+
},
|
|
20
20
|
];
|
|
21
21
|
export function toProviderModelConfig(def) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
return {
|
|
23
|
+
id: def.id,
|
|
24
|
+
name: def.name?.trim() || def.id,
|
|
25
|
+
api: "openai-completions",
|
|
26
|
+
reasoning: def.reasoning === true,
|
|
27
|
+
input: ["text"],
|
|
28
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
29
|
+
contextWindow: def.contextWindow ?? 128_000,
|
|
30
|
+
maxTokens: def.maxTokens ?? 8_192,
|
|
31
|
+
};
|
|
32
32
|
}
|
|
33
33
|
export function mergeKubbisecModelCatalog(orgModel, extra) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return ordered;
|
|
34
|
+
const byId = new Map();
|
|
35
|
+
for (const model of KUBBISEC_BUILTIN_MODELS) {
|
|
36
|
+
byId.set(model.id, model);
|
|
37
|
+
}
|
|
38
|
+
for (const model of extra ?? []) {
|
|
39
|
+
if (model.id?.trim()) byId.set(model.id.trim(), { ...model, id: model.id.trim() });
|
|
40
|
+
}
|
|
41
|
+
const org = orgModel?.trim();
|
|
42
|
+
if (org && !byId.has(org)) {
|
|
43
|
+
byId.set(org, { id: org, name: org, reasoning: org.startsWith("o") });
|
|
44
|
+
}
|
|
45
|
+
const ordered = [];
|
|
46
|
+
if (org && byId.has(org)) {
|
|
47
|
+
ordered.push(byId.get(org));
|
|
48
|
+
byId.delete(org);
|
|
49
|
+
}
|
|
50
|
+
ordered.push(...byId.values());
|
|
51
|
+
return ordered;
|
|
53
52
|
}
|
|
54
|
-
//# sourceMappingURL=llm-provider-catalog.js.map
|
|
53
|
+
//# sourceMappingURL=llm-provider-catalog.js.map
|
|
@@ -16,4 +16,4 @@ export declare const materializeKubbisecPiExtensions: typeof materializeKubbisec
|
|
|
16
16
|
export declare const materializeKubbisecPiTheme: typeof materializeKubbisecAgentTheme;
|
|
17
17
|
/** @deprecated Use resolveKubbisecAgentExtensionPaths */
|
|
18
18
|
export declare const resolveKubbisecPiExtensionPaths: typeof resolveKubbisecAgentExtensionPaths;
|
|
19
|
-
//# sourceMappingURL=materialize-kubbisec-pi-resources.d.ts.map
|
|
19
|
+
//# sourceMappingURL=materialize-kubbisec-pi-resources.d.ts.map
|