openclaw-aicodewith-auth 0.3.0 → 0.3.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/index.ts CHANGED
@@ -72,6 +72,22 @@ function migrateConfigModels(): void {
72
72
  if (defaults.imageModel && migrateModelField(defaults.imageModel)) {
73
73
  changed = true;
74
74
  }
75
+
76
+ const modelsConfig = defaults.models as Record<string, unknown> | undefined;
77
+ if (modelsConfig) {
78
+ const keysToMigrate: Array<[string, string]> = [];
79
+ for (const key of Object.keys(modelsConfig)) {
80
+ if (migrations[key]) {
81
+ keysToMigrate.push([key, migrations[key]]);
82
+ }
83
+ }
84
+ for (const [oldKey, newKey] of keysToMigrate) {
85
+ console.log(`[${PLUGIN_ID}] Migrating models config key: ${oldKey} -> ${newKey}`);
86
+ modelsConfig[newKey] = modelsConfig[oldKey];
87
+ delete modelsConfig[oldKey];
88
+ changed = true;
89
+ }
90
+ }
75
91
  }
76
92
 
77
93
  const agentList = agents.list;
@@ -85,11 +101,48 @@ function migrateConfigModels(): void {
85
101
  if (agent.imageModel && migrateModelField(agent.imageModel)) {
86
102
  changed = true;
87
103
  }
104
+
105
+ const agentModelsConfig = agent.models as Record<string, unknown> | undefined;
106
+ if (agentModelsConfig) {
107
+ const keysToMigrate: Array<[string, string]> = [];
108
+ for (const key of Object.keys(agentModelsConfig)) {
109
+ if (migrations[key]) {
110
+ keysToMigrate.push([key, migrations[key]]);
111
+ }
112
+ }
113
+ for (const [oldKey, newKey] of keysToMigrate) {
114
+ console.log(`[${PLUGIN_ID}] Migrating agent models config key: ${oldKey} -> ${newKey}`);
115
+ agentModelsConfig[newKey] = agentModelsConfig[oldKey];
116
+ delete agentModelsConfig[oldKey];
117
+ changed = true;
118
+ }
119
+ }
88
120
  }
89
121
  }
90
122
  }
91
123
  }
92
124
 
125
+ const models = config.models as Record<string, unknown> | undefined;
126
+ if (models) {
127
+ const providers = models.providers as Record<string, unknown> | undefined;
128
+ if (providers) {
129
+ const ourProviders = [PROVIDER_ID_GPT, PROVIDER_ID_CLAUDE, PROVIDER_ID_GEMINI];
130
+ for (const providerId of ourProviders) {
131
+ if (providers[providerId]) {
132
+ console.log(`[${PLUGIN_ID}] Removing stale provider config: ${providerId}`);
133
+ delete providers[providerId];
134
+ changed = true;
135
+ }
136
+ }
137
+ if (Object.keys(providers).length === 0) {
138
+ delete models.providers;
139
+ }
140
+ }
141
+ if (Object.keys(models).length === 0) {
142
+ delete config.models;
143
+ }
144
+ }
145
+
93
146
  if (changed) {
94
147
  try {
95
148
  writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
@@ -15,8 +15,6 @@ import {
15
15
  AICODEWITH_GPT_BASE_URL,
16
16
  AICODEWITH_CLAUDE_BASE_URL,
17
17
  AICODEWITH_GEMINI_BASE_URL,
18
- CODEX_USER_AGENT,
19
- CODEX_ORIGINATOR,
20
18
  } from "../../src/constants.js";
21
19
 
22
20
  export type ModelFamily = "gpt" | "claude" | "gemini";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-aicodewith-auth",
3
- "version": "0.3.0",
3
+ "version": "0.3.3",
4
4
  "type": "module",
5
5
  "description": "AICodewith provider plugin for OpenClaw - Access GPT, Claude, and Gemini models via AICodewith API",
6
6
  "author": "daneel",
package/src/auth.ts CHANGED
@@ -1,7 +1,4 @@
1
1
  import {
2
- AICODEWITH_GPT_BASE_URL,
3
- AICODEWITH_CLAUDE_BASE_URL,
4
- AICODEWITH_GEMINI_BASE_URL,
5
2
  PROVIDER_ID_GPT,
6
3
  PROVIDER_ID_CLAUDE,
7
4
  PROVIDER_ID_GEMINI,
@@ -54,35 +51,17 @@ export function createAicodewithAuthMethod() {
54
51
  },
55
52
  ],
56
53
  configPatch: {
57
- models: {
58
- providers: {
59
- [PROVIDER_ID_GPT]: {
60
- ...providerConfigs[PROVIDER_ID_GPT],
61
- apiKey: trimmedKey,
62
- },
63
- [PROVIDER_ID_CLAUDE]: {
64
- ...providerConfigs[PROVIDER_ID_CLAUDE],
65
- apiKey: trimmedKey,
66
- },
67
- [PROVIDER_ID_GEMINI]: {
68
- ...providerConfigs[PROVIDER_ID_GEMINI],
69
- apiKey: trimmedKey,
70
- },
54
+ auth: {
55
+ order: {
56
+ [PROVIDER_ID_GPT]: [AUTH_PROFILE_ID],
57
+ [PROVIDER_ID_CLAUDE]: [AUTH_PROFILE_ID],
58
+ [PROVIDER_ID_GEMINI]: [AUTH_PROFILE_ID],
71
59
  },
72
60
  },
73
61
  agents: {
74
62
  defaults: {
75
- model: defaultModelRef,
76
- models: {
77
- ...Object.fromEntries(
78
- providerConfigs[PROVIDER_ID_GPT].models.map((m) => [`${PROVIDER_ID_GPT}/${m.id}`, {}])
79
- ),
80
- ...Object.fromEntries(
81
- providerConfigs[PROVIDER_ID_CLAUDE].models.map((m) => [`${PROVIDER_ID_CLAUDE}/${m.id}`, {}])
82
- ),
83
- ...Object.fromEntries(
84
- providerConfigs[PROVIDER_ID_GEMINI].models.map((m) => [`${PROVIDER_ID_GEMINI}/${m.id}`, {}])
85
- ),
63
+ model: {
64
+ primary: defaultModelRef,
86
65
  },
87
66
  },
88
67
  },
package/src/constants.ts CHANGED
@@ -14,7 +14,3 @@ export const PLUGIN_ID = "openclaw-aicodewith-auth";
14
14
  export const PLUGIN_NAME = "AICodewith";
15
15
  export const PLUGIN_DESCRIPTION =
16
16
  "Access GPT, Claude, and Gemini models via AICodewith API";
17
-
18
- // Codex-specific headers (required for GPT models)
19
- export const CODEX_USER_AGENT = "codex_cli_rs/0.77.0 (Mac OS 26.2.0; arm64) iTerm.app/3.6.6";
20
- export const CODEX_ORIGINATOR = "codex_cli_rs";