@pi-ohm/painter 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 +7 -0
- package/package.json +27 -0
- package/src/extension.ts +52 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pi-ohm/painter",
|
|
3
|
+
"version": "0.3.0-dev.22083116751.1.d12e548",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "src/extension.ts",
|
|
6
|
+
"types": "src/extension.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"src/",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"pi": {
|
|
12
|
+
"extensions": [
|
|
13
|
+
"./src/extension.ts"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@mariozechner/pi-coding-agent": "^0.52.0",
|
|
18
|
+
"@pi-ohm/config": "0.3.0-dev.22083116751.1.d12e548"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"@mariozechner/pi-coding-agent": "*"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public",
|
|
25
|
+
"provenance": true
|
|
26
|
+
}
|
|
27
|
+
}
|
package/src/extension.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
2
|
+
import { loadOhmRuntimeConfig, registerOhmSettings } from "@pi-ohm/config";
|
|
3
|
+
|
|
4
|
+
export default function registerPainterExtension(pi: ExtensionAPI): void {
|
|
5
|
+
registerOhmSettings(pi);
|
|
6
|
+
|
|
7
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
8
|
+
const { config } = await loadOhmRuntimeConfig(ctx.cwd);
|
|
9
|
+
if (!ctx.hasUI) return;
|
|
10
|
+
|
|
11
|
+
if (!config.features.painterImagegen) {
|
|
12
|
+
ctx.ui.setStatus("ohm-painter", "painter:off");
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const providers = [
|
|
17
|
+
config.painter.googleNanoBanana.enabled ? "google" : null,
|
|
18
|
+
config.painter.openai.enabled ? "openai" : null,
|
|
19
|
+
config.painter.azureOpenai.enabled ? "azure" : null,
|
|
20
|
+
].filter(Boolean);
|
|
21
|
+
|
|
22
|
+
ctx.ui.setStatus(
|
|
23
|
+
"ohm-painter",
|
|
24
|
+
`painter:on · providers:${providers.length > 0 ? providers.join("+") : "none"}`,
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
pi.registerCommand("ohm-painter", {
|
|
29
|
+
description: "Show painter provider configuration",
|
|
30
|
+
handler: async (_args, ctx) => {
|
|
31
|
+
const { config } = await loadOhmRuntimeConfig(ctx.cwd);
|
|
32
|
+
const text = [
|
|
33
|
+
"Pi OHM: painter/imagegen",
|
|
34
|
+
"",
|
|
35
|
+
`featureEnabled: ${config.features.painterImagegen ? "yes" : "no"}`,
|
|
36
|
+
`googleNanoBanana: ${config.painter.googleNanoBanana.enabled ? "on" : "off"} (${config.painter.googleNanoBanana.model})`,
|
|
37
|
+
`openai: ${config.painter.openai.enabled ? "on" : "off"} (${config.painter.openai.model})`,
|
|
38
|
+
`azureOpenAI: ${config.painter.azureOpenai.enabled ? "on" : "off"}`,
|
|
39
|
+
`azureDeployment: ${config.painter.azureOpenai.deployment || "<unset>"}`,
|
|
40
|
+
`azureEndpoint: ${config.painter.azureOpenai.endpoint || "<unset>"}`,
|
|
41
|
+
`azureApiVersion: ${config.painter.azureOpenai.apiVersion}`,
|
|
42
|
+
].join("\n");
|
|
43
|
+
|
|
44
|
+
if (!ctx.hasUI) {
|
|
45
|
+
console.log(text);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
await ctx.ui.editor("pi-ohm painter", text);
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|