pzero-operator 0.1.2 → 0.1.3
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/migrations.js +83 -1
- package/package.json +1 -1
package/dist/migrations.js
CHANGED
|
@@ -4,10 +4,91 @@
|
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "fs";
|
|
6
6
|
import { dirname, join } from "path";
|
|
7
|
-
import { CONFIG_DIR_NAME, getAgentDir, getBinDir } from "./config.js";
|
|
7
|
+
import { CONFIG_DIR_NAME, getAgentDir, getBinDir, getModelsPath, getSettingsPath } from "./config.js";
|
|
8
8
|
import { migrateKeybindingsConfig } from "./core/keybindings.js";
|
|
9
9
|
const MIGRATION_GUIDE_URL = "https://github.com/operator/blob/main/packages/coding-agent/CHANGELOG.md#extensions-migration";
|
|
10
10
|
const EXTENSIONS_DOC_URL = "https://github.com/operator/blob/main/packages/coding-agent/docs/extensions.md";
|
|
11
|
+
const DEFAULT_MODELS_CONFIG = {
|
|
12
|
+
providers: {
|
|
13
|
+
"alem-ai-plus-gpt-oss": {
|
|
14
|
+
baseUrl: "https://llm.alem.ai/chat/completions",
|
|
15
|
+
api: "openai-completions",
|
|
16
|
+
authHeader: true,
|
|
17
|
+
compat: {
|
|
18
|
+
supportsDeveloperRole: true,
|
|
19
|
+
supportsReasoningEffort: true,
|
|
20
|
+
},
|
|
21
|
+
models: [
|
|
22
|
+
{
|
|
23
|
+
id: "gpt-oss",
|
|
24
|
+
name: "gpt-oss 120b",
|
|
25
|
+
reasoning: true,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
"alem-ai-plus-qwen3-6": {
|
|
30
|
+
baseUrl: "https://llm.alem.ai/v1/chat/completions",
|
|
31
|
+
api: "openai-completions",
|
|
32
|
+
authHeader: true,
|
|
33
|
+
compat: {
|
|
34
|
+
supportsDeveloperRole: true,
|
|
35
|
+
supportsReasoningEffort: false,
|
|
36
|
+
},
|
|
37
|
+
models: [
|
|
38
|
+
{
|
|
39
|
+
id: "qwen3-6",
|
|
40
|
+
name: "qwen3.6 27b",
|
|
41
|
+
reasoning: true,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
"alem-ai-plus-gemma4": {
|
|
46
|
+
baseUrl: "https://llm.alem.ai/v1/chat/completions",
|
|
47
|
+
api: "openai-completions",
|
|
48
|
+
authHeader: true,
|
|
49
|
+
compat: {
|
|
50
|
+
supportsDeveloperRole: true,
|
|
51
|
+
supportsReasoningEffort: false,
|
|
52
|
+
},
|
|
53
|
+
models: [
|
|
54
|
+
{
|
|
55
|
+
id: "gemma4",
|
|
56
|
+
name: "gemma4",
|
|
57
|
+
reasoning: true,
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
ollama: {
|
|
62
|
+
baseUrl: "http://127.0.0.1:11434/v1",
|
|
63
|
+
api: "openai-completions",
|
|
64
|
+
compat: {
|
|
65
|
+
supportsReasoningEffort: false,
|
|
66
|
+
},
|
|
67
|
+
modelOverrides: {},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
const DEFAULT_SETTINGS_CONFIG = {
|
|
72
|
+
defaultProvider: "alem-ai-plus-gpt-oss",
|
|
73
|
+
defaultModel: "gpt-oss",
|
|
74
|
+
defaultThinkingLevel: "low",
|
|
75
|
+
};
|
|
76
|
+
function ensureDefaultRuntimeConfig() {
|
|
77
|
+
const agentDir = getAgentDir();
|
|
78
|
+
const modelsPath = getModelsPath();
|
|
79
|
+
const settingsPath = getSettingsPath();
|
|
80
|
+
if (!existsSync(agentDir)) {
|
|
81
|
+
mkdirSync(agentDir, { recursive: true, mode: 0o700 });
|
|
82
|
+
}
|
|
83
|
+
if (!existsSync(modelsPath)) {
|
|
84
|
+
writeFileSync(modelsPath, `${JSON.stringify(DEFAULT_MODELS_CONFIG, null, 2)}\n`, {
|
|
85
|
+
mode: 0o600,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (!existsSync(settingsPath)) {
|
|
89
|
+
writeFileSync(settingsPath, `${JSON.stringify(DEFAULT_SETTINGS_CONFIG, null, 2)}\n`, "utf-8");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
11
92
|
/**
|
|
12
93
|
* Migrate legacy oauth.json and settings.json apiKeys to auth.json.
|
|
13
94
|
*
|
|
@@ -271,6 +352,7 @@ export async function showDeprecationWarnings(warnings) {
|
|
|
271
352
|
* @returns Object with migration results and deprecation warnings
|
|
272
353
|
*/
|
|
273
354
|
export function runMigrations(cwd) {
|
|
355
|
+
ensureDefaultRuntimeConfig();
|
|
274
356
|
const migratedAuthProviders = migrateAuthToAuthJson();
|
|
275
357
|
migrateSessionsFromAgentRoot();
|
|
276
358
|
migrateToolsToBin();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pzero-operator",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Operator is a coding-first terminal AI agent from ProjectZero for software development, shell execution, local project workflows, and broader device-level operator control.",
|