@pi-ohm/config 0.3.0-dev.22083116751.1.d12e548
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/README.md +13 -0
- package/package.json +27 -0
- package/src/index.ts +491 -0
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @pi-ohm/config
|
|
2
|
+
|
|
3
|
+
Shared runtime configuration package used by Pi OHM feature packages.
|
|
4
|
+
|
|
5
|
+
Responsibilities:
|
|
6
|
+
|
|
7
|
+
- register extension settings with `@juanibiapina/pi-extension-settings`
|
|
8
|
+
- resolve config directory from `PI_CONFIG_DIR` / `PI_CODING_AGENT_DIR` / `PI_AGENT_DIR` / `~/.pi/agent`
|
|
9
|
+
- load and merge:
|
|
10
|
+
- `${cwd}/.pi/ohm.json`
|
|
11
|
+
- `${configDir}/ohm.json`
|
|
12
|
+
- `${configDir}/ohm.providers.json`
|
|
13
|
+
- expose typed runtime config helpers to feature packages
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pi-ohm/config",
|
|
3
|
+
"version": "0.3.0-dev.22083116751.1.d12e548",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "src/index.ts",
|
|
6
|
+
"types": "src/index.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/index.ts"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"src/",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@juanibiapina/pi-extension-settings": "^0.5.0",
|
|
16
|
+
"@mariozechner/pi-coding-agent": "^0.52.0",
|
|
17
|
+
"@mariozechner/pi-tui": "^0.52.0"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"@mariozechner/pi-coding-agent": "*",
|
|
21
|
+
"@mariozechner/pi-tui": "*"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public",
|
|
25
|
+
"provenance": true
|
|
26
|
+
}
|
|
27
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
5
|
+
import {
|
|
6
|
+
getSetting,
|
|
7
|
+
setSetting,
|
|
8
|
+
type SettingDefinition,
|
|
9
|
+
} from "@juanibiapina/pi-extension-settings";
|
|
10
|
+
|
|
11
|
+
export const OHM_EXTENSION_NAME = "pi-ohm";
|
|
12
|
+
|
|
13
|
+
export type OhmMode = "rush" | "smart" | "deep";
|
|
14
|
+
export type OhmSubagentBackend = "none" | "interactive-shell" | "custom-plugin";
|
|
15
|
+
|
|
16
|
+
export interface OhmFeatureFlags {
|
|
17
|
+
handoff: boolean;
|
|
18
|
+
subagents: boolean;
|
|
19
|
+
sessionThreadSearch: boolean;
|
|
20
|
+
handoffVisualizer: boolean;
|
|
21
|
+
painterImagegen: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface OhmPainterProviders {
|
|
25
|
+
googleNanoBanana: {
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
model: string;
|
|
28
|
+
};
|
|
29
|
+
openai: {
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
model: string;
|
|
32
|
+
};
|
|
33
|
+
azureOpenai: {
|
|
34
|
+
enabled: boolean;
|
|
35
|
+
deployment: string;
|
|
36
|
+
endpoint: string;
|
|
37
|
+
apiVersion: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface OhmRuntimeConfig {
|
|
42
|
+
defaultMode: OhmMode;
|
|
43
|
+
subagentBackend: OhmSubagentBackend;
|
|
44
|
+
features: OhmFeatureFlags;
|
|
45
|
+
painter: OhmPainterProviders;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface OhmConfigPaths {
|
|
49
|
+
configDir: string;
|
|
50
|
+
projectConfigFile: string;
|
|
51
|
+
globalConfigFile: string;
|
|
52
|
+
providersConfigFile: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface LoadedOhmRuntimeConfig {
|
|
56
|
+
config: OhmRuntimeConfig;
|
|
57
|
+
paths: OhmConfigPaths;
|
|
58
|
+
loadedFrom: string[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const DEFAULT_OHM_CONFIG: OhmRuntimeConfig = {
|
|
62
|
+
defaultMode: "smart",
|
|
63
|
+
subagentBackend: "interactive-shell",
|
|
64
|
+
features: {
|
|
65
|
+
handoff: true,
|
|
66
|
+
subagents: true,
|
|
67
|
+
sessionThreadSearch: true,
|
|
68
|
+
handoffVisualizer: true,
|
|
69
|
+
painterImagegen: true,
|
|
70
|
+
},
|
|
71
|
+
painter: {
|
|
72
|
+
googleNanoBanana: {
|
|
73
|
+
enabled: true,
|
|
74
|
+
model: "gemini-2.5-flash-image-preview",
|
|
75
|
+
},
|
|
76
|
+
openai: {
|
|
77
|
+
enabled: true,
|
|
78
|
+
model: "gpt-image-1",
|
|
79
|
+
},
|
|
80
|
+
azureOpenai: {
|
|
81
|
+
enabled: false,
|
|
82
|
+
deployment: "",
|
|
83
|
+
endpoint: "",
|
|
84
|
+
apiVersion: "2025-04-01-preview",
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
type JsonMap = Record<string, unknown>;
|
|
90
|
+
|
|
91
|
+
function expandHome(value: string): string {
|
|
92
|
+
if (value === "~") return os.homedir();
|
|
93
|
+
if (value.startsWith("~/")) return path.join(os.homedir(), value.slice(2));
|
|
94
|
+
return value;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function resolveOhmConfigDir(): string {
|
|
98
|
+
const envDir =
|
|
99
|
+
process.env.PI_CONFIG_DIR ?? process.env.PI_CODING_AGENT_DIR ?? process.env.PI_AGENT_DIR;
|
|
100
|
+
|
|
101
|
+
if (envDir && envDir.trim().length > 0) {
|
|
102
|
+
return expandHome(envDir.trim());
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return path.join(os.homedir(), ".pi", "agent");
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function resolveOhmConfigPaths(cwd: string): OhmConfigPaths {
|
|
109
|
+
const configDir = resolveOhmConfigDir();
|
|
110
|
+
return {
|
|
111
|
+
configDir,
|
|
112
|
+
projectConfigFile: path.join(cwd, ".pi", "ohm.json"),
|
|
113
|
+
globalConfigFile: path.join(configDir, "ohm.json"),
|
|
114
|
+
providersConfigFile: path.join(configDir, "ohm.providers.json"),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async function readJsonFile(filePath: string): Promise<JsonMap | null> {
|
|
119
|
+
try {
|
|
120
|
+
const raw = await fs.readFile(filePath, "utf8");
|
|
121
|
+
const parsed = JSON.parse(raw) as unknown;
|
|
122
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
return parsed as JsonMap;
|
|
126
|
+
} catch {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function normalizeBoolean(value: unknown, fallback: boolean): boolean {
|
|
132
|
+
if (typeof value === "boolean") return value;
|
|
133
|
+
if (typeof value !== "string") return fallback;
|
|
134
|
+
|
|
135
|
+
const normalized = value.trim().toLowerCase();
|
|
136
|
+
if (["1", "true", "yes", "on", "enabled"].includes(normalized)) return true;
|
|
137
|
+
if (["0", "false", "no", "off", "disabled"].includes(normalized)) return false;
|
|
138
|
+
return fallback;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function normalizeMode(value: unknown, fallback: OhmMode): OhmMode {
|
|
142
|
+
if (value === "rush" || value === "smart" || value === "deep") return value;
|
|
143
|
+
return fallback;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function normalizeSubagentBackend(
|
|
147
|
+
value: unknown,
|
|
148
|
+
fallback: OhmSubagentBackend,
|
|
149
|
+
): OhmSubagentBackend {
|
|
150
|
+
if (value === "none" || value === "interactive-shell" || value === "custom-plugin") return value;
|
|
151
|
+
return fallback;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function normalizeString(value: unknown, fallback: string): string {
|
|
155
|
+
if (typeof value === "string") return value;
|
|
156
|
+
return fallback;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function mergeConfig(base: OhmRuntimeConfig, patch: JsonMap): OhmRuntimeConfig {
|
|
160
|
+
const next: OhmRuntimeConfig = structuredClone(base);
|
|
161
|
+
|
|
162
|
+
next.defaultMode = normalizeMode(patch.defaultMode, next.defaultMode);
|
|
163
|
+
next.subagentBackend = normalizeSubagentBackend(patch.subagentBackend, next.subagentBackend);
|
|
164
|
+
|
|
165
|
+
const featurePatch = (
|
|
166
|
+
patch.features && typeof patch.features === "object" ? (patch.features as JsonMap) : {}
|
|
167
|
+
) as JsonMap;
|
|
168
|
+
|
|
169
|
+
next.features.handoff = normalizeBoolean(featurePatch.handoff, next.features.handoff);
|
|
170
|
+
next.features.subagents = normalizeBoolean(featurePatch.subagents, next.features.subagents);
|
|
171
|
+
next.features.sessionThreadSearch = normalizeBoolean(
|
|
172
|
+
featurePatch.sessionThreadSearch,
|
|
173
|
+
next.features.sessionThreadSearch,
|
|
174
|
+
);
|
|
175
|
+
next.features.handoffVisualizer = normalizeBoolean(
|
|
176
|
+
featurePatch.handoffVisualizer,
|
|
177
|
+
next.features.handoffVisualizer,
|
|
178
|
+
);
|
|
179
|
+
next.features.painterImagegen = normalizeBoolean(
|
|
180
|
+
featurePatch.painterImagegen,
|
|
181
|
+
next.features.painterImagegen,
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
const painterPatch = (
|
|
185
|
+
patch.painter && typeof patch.painter === "object" ? (patch.painter as JsonMap) : {}
|
|
186
|
+
) as JsonMap;
|
|
187
|
+
|
|
188
|
+
const googlePatch = (
|
|
189
|
+
painterPatch.googleNanoBanana && typeof painterPatch.googleNanoBanana === "object"
|
|
190
|
+
? (painterPatch.googleNanoBanana as JsonMap)
|
|
191
|
+
: {}
|
|
192
|
+
) as JsonMap;
|
|
193
|
+
|
|
194
|
+
const openaiPatch = (
|
|
195
|
+
painterPatch.openai && typeof painterPatch.openai === "object"
|
|
196
|
+
? (painterPatch.openai as JsonMap)
|
|
197
|
+
: {}
|
|
198
|
+
) as JsonMap;
|
|
199
|
+
|
|
200
|
+
const azurePatch = (
|
|
201
|
+
painterPatch.azureOpenai && typeof painterPatch.azureOpenai === "object"
|
|
202
|
+
? (painterPatch.azureOpenai as JsonMap)
|
|
203
|
+
: {}
|
|
204
|
+
) as JsonMap;
|
|
205
|
+
|
|
206
|
+
next.painter.googleNanoBanana.enabled = normalizeBoolean(
|
|
207
|
+
googlePatch.enabled,
|
|
208
|
+
next.painter.googleNanoBanana.enabled,
|
|
209
|
+
);
|
|
210
|
+
next.painter.googleNanoBanana.model = normalizeString(
|
|
211
|
+
googlePatch.model,
|
|
212
|
+
next.painter.googleNanoBanana.model,
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
next.painter.openai.enabled = normalizeBoolean(openaiPatch.enabled, next.painter.openai.enabled);
|
|
216
|
+
next.painter.openai.model = normalizeString(openaiPatch.model, next.painter.openai.model);
|
|
217
|
+
|
|
218
|
+
next.painter.azureOpenai.enabled = normalizeBoolean(
|
|
219
|
+
azurePatch.enabled,
|
|
220
|
+
next.painter.azureOpenai.enabled,
|
|
221
|
+
);
|
|
222
|
+
next.painter.azureOpenai.deployment = normalizeString(
|
|
223
|
+
azurePatch.deployment,
|
|
224
|
+
next.painter.azureOpenai.deployment,
|
|
225
|
+
);
|
|
226
|
+
next.painter.azureOpenai.endpoint = normalizeString(
|
|
227
|
+
azurePatch.endpoint,
|
|
228
|
+
next.painter.azureOpenai.endpoint,
|
|
229
|
+
);
|
|
230
|
+
next.painter.azureOpenai.apiVersion = normalizeString(
|
|
231
|
+
azurePatch.apiVersion,
|
|
232
|
+
next.painter.azureOpenai.apiVersion,
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
return next;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function applyExtensionSettings(config: OhmRuntimeConfig): OhmRuntimeConfig {
|
|
239
|
+
const next = structuredClone(config);
|
|
240
|
+
|
|
241
|
+
next.defaultMode = normalizeMode(
|
|
242
|
+
getSetting(OHM_EXTENSION_NAME, "default-mode", next.defaultMode),
|
|
243
|
+
next.defaultMode,
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
next.subagentBackend = normalizeSubagentBackend(
|
|
247
|
+
getSetting(OHM_EXTENSION_NAME, "subagent-backend", next.subagentBackend),
|
|
248
|
+
next.subagentBackend,
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
next.features.handoff = normalizeBoolean(
|
|
252
|
+
getSetting(OHM_EXTENSION_NAME, "feature-handoff", next.features.handoff ? "on" : "off"),
|
|
253
|
+
next.features.handoff,
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
next.features.subagents = normalizeBoolean(
|
|
257
|
+
getSetting(OHM_EXTENSION_NAME, "feature-subagents", next.features.subagents ? "on" : "off"),
|
|
258
|
+
next.features.subagents,
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
next.features.sessionThreadSearch = normalizeBoolean(
|
|
262
|
+
getSetting(
|
|
263
|
+
OHM_EXTENSION_NAME,
|
|
264
|
+
"feature-session-thread-search",
|
|
265
|
+
next.features.sessionThreadSearch ? "on" : "off",
|
|
266
|
+
),
|
|
267
|
+
next.features.sessionThreadSearch,
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
next.features.handoffVisualizer = normalizeBoolean(
|
|
271
|
+
getSetting(
|
|
272
|
+
OHM_EXTENSION_NAME,
|
|
273
|
+
"feature-handoff-visualizer",
|
|
274
|
+
next.features.handoffVisualizer ? "on" : "off",
|
|
275
|
+
),
|
|
276
|
+
next.features.handoffVisualizer,
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
next.features.painterImagegen = normalizeBoolean(
|
|
280
|
+
getSetting(
|
|
281
|
+
OHM_EXTENSION_NAME,
|
|
282
|
+
"feature-painter-imagegen",
|
|
283
|
+
next.features.painterImagegen ? "on" : "off",
|
|
284
|
+
),
|
|
285
|
+
next.features.painterImagegen,
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
next.painter.googleNanoBanana.enabled = normalizeBoolean(
|
|
289
|
+
getSetting(
|
|
290
|
+
OHM_EXTENSION_NAME,
|
|
291
|
+
"painter-google-enabled",
|
|
292
|
+
next.painter.googleNanoBanana.enabled ? "on" : "off",
|
|
293
|
+
),
|
|
294
|
+
next.painter.googleNanoBanana.enabled,
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
next.painter.googleNanoBanana.model = normalizeString(
|
|
298
|
+
getSetting(OHM_EXTENSION_NAME, "painter-google-model", next.painter.googleNanoBanana.model),
|
|
299
|
+
next.painter.googleNanoBanana.model,
|
|
300
|
+
);
|
|
301
|
+
|
|
302
|
+
next.painter.openai.enabled = normalizeBoolean(
|
|
303
|
+
getSetting(
|
|
304
|
+
OHM_EXTENSION_NAME,
|
|
305
|
+
"painter-openai-enabled",
|
|
306
|
+
next.painter.openai.enabled ? "on" : "off",
|
|
307
|
+
),
|
|
308
|
+
next.painter.openai.enabled,
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
next.painter.openai.model = normalizeString(
|
|
312
|
+
getSetting(OHM_EXTENSION_NAME, "painter-openai-model", next.painter.openai.model),
|
|
313
|
+
next.painter.openai.model,
|
|
314
|
+
);
|
|
315
|
+
|
|
316
|
+
next.painter.azureOpenai.enabled = normalizeBoolean(
|
|
317
|
+
getSetting(
|
|
318
|
+
OHM_EXTENSION_NAME,
|
|
319
|
+
"painter-azure-enabled",
|
|
320
|
+
next.painter.azureOpenai.enabled ? "on" : "off",
|
|
321
|
+
),
|
|
322
|
+
next.painter.azureOpenai.enabled,
|
|
323
|
+
);
|
|
324
|
+
|
|
325
|
+
next.painter.azureOpenai.deployment = normalizeString(
|
|
326
|
+
getSetting(OHM_EXTENSION_NAME, "painter-azure-deployment", next.painter.azureOpenai.deployment),
|
|
327
|
+
next.painter.azureOpenai.deployment,
|
|
328
|
+
);
|
|
329
|
+
|
|
330
|
+
next.painter.azureOpenai.endpoint = normalizeString(
|
|
331
|
+
getSetting(OHM_EXTENSION_NAME, "painter-azure-endpoint", next.painter.azureOpenai.endpoint),
|
|
332
|
+
next.painter.azureOpenai.endpoint,
|
|
333
|
+
);
|
|
334
|
+
|
|
335
|
+
next.painter.azureOpenai.apiVersion = normalizeString(
|
|
336
|
+
getSetting(
|
|
337
|
+
OHM_EXTENSION_NAME,
|
|
338
|
+
"painter-azure-api-version",
|
|
339
|
+
next.painter.azureOpenai.apiVersion,
|
|
340
|
+
),
|
|
341
|
+
next.painter.azureOpenai.apiVersion,
|
|
342
|
+
);
|
|
343
|
+
|
|
344
|
+
return next;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export async function loadOhmRuntimeConfig(cwd: string): Promise<LoadedOhmRuntimeConfig> {
|
|
348
|
+
const paths = resolveOhmConfigPaths(cwd);
|
|
349
|
+
let config = structuredClone(DEFAULT_OHM_CONFIG);
|
|
350
|
+
const loadedFrom: string[] = [];
|
|
351
|
+
|
|
352
|
+
const globalConfig = await readJsonFile(paths.globalConfigFile);
|
|
353
|
+
if (globalConfig) {
|
|
354
|
+
config = mergeConfig(config, globalConfig);
|
|
355
|
+
loadedFrom.push(paths.globalConfigFile);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
const projectConfig = await readJsonFile(paths.projectConfigFile);
|
|
359
|
+
if (projectConfig) {
|
|
360
|
+
config = mergeConfig(config, projectConfig);
|
|
361
|
+
loadedFrom.push(paths.projectConfigFile);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
const providersConfig = await readJsonFile(paths.providersConfigFile);
|
|
365
|
+
if (providersConfig) {
|
|
366
|
+
config = mergeConfig(config, { painter: providersConfig });
|
|
367
|
+
loadedFrom.push(paths.providersConfigFile);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
config = applyExtensionSettings(config);
|
|
371
|
+
|
|
372
|
+
return {
|
|
373
|
+
config,
|
|
374
|
+
paths,
|
|
375
|
+
loadedFrom,
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
let didRegisterSettings = false;
|
|
380
|
+
|
|
381
|
+
export function registerOhmSettings(pi: ExtensionAPI): void {
|
|
382
|
+
if (didRegisterSettings) return;
|
|
383
|
+
didRegisterSettings = true;
|
|
384
|
+
|
|
385
|
+
const settings: SettingDefinition[] = [
|
|
386
|
+
{
|
|
387
|
+
id: "default-mode",
|
|
388
|
+
label: "Default Mode",
|
|
389
|
+
description: "Primary working mode for Pi Ohm",
|
|
390
|
+
defaultValue: DEFAULT_OHM_CONFIG.defaultMode,
|
|
391
|
+
values: ["rush", "smart", "deep"],
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
id: "subagent-backend",
|
|
395
|
+
label: "Subagent Backend",
|
|
396
|
+
description: "How Pi Ohm should delegate subagents",
|
|
397
|
+
defaultValue: DEFAULT_OHM_CONFIG.subagentBackend,
|
|
398
|
+
values: ["interactive-shell", "custom-plugin", "none"],
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
id: "feature-handoff",
|
|
402
|
+
label: "Feature: Handoff",
|
|
403
|
+
defaultValue: "on",
|
|
404
|
+
values: ["on", "off"],
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
id: "feature-subagents",
|
|
408
|
+
label: "Feature: Subagents",
|
|
409
|
+
defaultValue: "on",
|
|
410
|
+
values: ["on", "off"],
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
id: "feature-session-thread-search",
|
|
414
|
+
label: "Feature: Session/Thread Search",
|
|
415
|
+
defaultValue: "on",
|
|
416
|
+
values: ["on", "off"],
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
id: "feature-handoff-visualizer",
|
|
420
|
+
label: "Feature: Handoff Visualizer",
|
|
421
|
+
defaultValue: "on",
|
|
422
|
+
values: ["on", "off"],
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
id: "feature-painter-imagegen",
|
|
426
|
+
label: "Feature: Painter/ImageGen",
|
|
427
|
+
defaultValue: "on",
|
|
428
|
+
values: ["on", "off"],
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
id: "painter-google-enabled",
|
|
432
|
+
label: "Painter Provider: Google Nano Banana",
|
|
433
|
+
defaultValue: "on",
|
|
434
|
+
values: ["on", "off"],
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
id: "painter-google-model",
|
|
438
|
+
label: "Painter Provider: Google Model",
|
|
439
|
+
defaultValue: DEFAULT_OHM_CONFIG.painter.googleNanoBanana.model,
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
id: "painter-openai-enabled",
|
|
443
|
+
label: "Painter Provider: OpenAI",
|
|
444
|
+
defaultValue: "on",
|
|
445
|
+
values: ["on", "off"],
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
id: "painter-openai-model",
|
|
449
|
+
label: "Painter Provider: OpenAI Model",
|
|
450
|
+
defaultValue: DEFAULT_OHM_CONFIG.painter.openai.model,
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
id: "painter-azure-enabled",
|
|
454
|
+
label: "Painter Provider: Azure OpenAI",
|
|
455
|
+
defaultValue: "off",
|
|
456
|
+
values: ["on", "off"],
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
id: "painter-azure-deployment",
|
|
460
|
+
label: "Painter Provider: Azure Deployment",
|
|
461
|
+
defaultValue: "",
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
id: "painter-azure-endpoint",
|
|
465
|
+
label: "Painter Provider: Azure Endpoint",
|
|
466
|
+
defaultValue: "",
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
id: "painter-azure-api-version",
|
|
470
|
+
label: "Painter Provider: Azure API Version",
|
|
471
|
+
defaultValue: DEFAULT_OHM_CONFIG.painter.azureOpenai.apiVersion,
|
|
472
|
+
},
|
|
473
|
+
];
|
|
474
|
+
|
|
475
|
+
pi.events.emit("pi-extension-settings:register", {
|
|
476
|
+
name: OHM_EXTENSION_NAME,
|
|
477
|
+
settings,
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
export function getOhmSetting(settingId: string, defaultValue?: string): string | undefined {
|
|
482
|
+
return getSetting(OHM_EXTENSION_NAME, settingId, defaultValue);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
export function setOhmSetting(settingId: string, value: string): void {
|
|
486
|
+
setSetting(OHM_EXTENSION_NAME, settingId, value);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
export function getDefaultOhmConfig(): OhmRuntimeConfig {
|
|
490
|
+
return structuredClone(DEFAULT_OHM_CONFIG);
|
|
491
|
+
}
|