@2en/clawly-plugins 1.29.0-beta.2 → 1.29.0-beta.5

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.
@@ -83,11 +83,31 @@ export function registerConfigRepair(api: PluginApi) {
83
83
 
84
84
  const defaultIds = new Set([defaultModel])
85
85
  const extraModels = EXTRA_GATEWAY_MODELS.filter((m) => !defaultIds.has(m.id)).map(
86
- ({id, name, input}) => ({id, name, input}),
86
+ ({id, name, input, contextWindow, maxTokens, api}) => ({
87
+ id,
88
+ name,
89
+ input,
90
+ contextWindow,
91
+ maxTokens,
92
+ ...(api ? {api} : {}),
93
+ }),
87
94
  )
95
+ const extraMatch = EXTRA_GATEWAY_MODELS.find((m) => m.id === defaultModel)
88
96
  const models = !defaultModel
89
97
  ? (provider?.models ?? [])
90
- : [{id: defaultModel, name: defaultModel, input: ['text', 'image']}, ...extraModels]
98
+ : [
99
+ {
100
+ id: defaultModel,
101
+ name: defaultModel,
102
+ input: extraMatch ? [...extraMatch.input] : (['text', 'image'] as string[]),
103
+ ...(extraMatch && {
104
+ contextWindow: extraMatch.contextWindow,
105
+ maxTokens: extraMatch.maxTokens,
106
+ }),
107
+ ...(extraMatch?.api ? {api: extraMatch.api} : {}),
108
+ },
109
+ ...extraModels,
110
+ ]
91
111
 
92
112
  if (!config.models) config.models = {}
93
113
  if (!(config.models as any).providers) (config.models as any).providers = {}
@@ -27,51 +27,73 @@ export const PUBLIC_GATEWAY_MODELS = [
27
27
  canonicalId: 'moonshotai/kimi-k2.5',
28
28
  alias: 'Kimi K2.5',
29
29
  input: ['text', 'image'],
30
+ contextWindow: 262_144,
31
+ maxTokens: 65_535,
30
32
  },
31
33
  {
32
34
  canonicalId: 'google/gemini-2.5-pro',
33
35
  alias: 'Gemini 2.5 Pro',
34
36
  input: ['text', 'image'],
37
+ contextWindow: 1_048_576,
38
+ maxTokens: 65_536,
35
39
  },
36
40
  {
37
41
  canonicalId: 'google/gemini-3-pro-preview',
38
42
  alias: 'Gemini 3 Pro Preview',
39
43
  input: ['text', 'image'],
44
+ contextWindow: 1_048_576,
45
+ maxTokens: 65_536,
40
46
  },
41
47
  {
42
48
  canonicalId: 'anthropic/claude-sonnet-4.6',
43
49
  alias: 'Claude Sonnet 4.6',
44
50
  input: ['text', 'image'],
51
+ contextWindow: 1_000_000,
52
+ maxTokens: 128_000,
53
+ api: 'anthropic-messages',
45
54
  },
46
55
  {
47
56
  canonicalId: 'anthropic/claude-opus-4.6',
48
57
  alias: 'Claude Opus 4.6',
49
58
  input: ['text', 'image'],
59
+ contextWindow: 1_000_000,
60
+ maxTokens: 128_000,
61
+ api: 'anthropic-messages',
50
62
  },
51
63
  {
52
64
  canonicalId: 'openai/gpt-5.4',
53
65
  alias: 'GPT-5.4',
54
66
  input: ['text', 'image'],
67
+ contextWindow: 1_050_000,
68
+ maxTokens: 128_000,
55
69
  },
56
70
  {
57
71
  canonicalId: 'minimax/minimax-m2.5',
58
72
  alias: 'MiniMax M2.5',
59
73
  input: ['text'],
74
+ contextWindow: 196_608,
75
+ maxTokens: 196_608,
60
76
  },
61
77
  {
62
78
  canonicalId: 'minimax/minimax-m2.1',
63
79
  alias: 'MiniMax M2.1',
64
80
  input: ['text'],
81
+ contextWindow: 196_608,
82
+ maxTokens: 196_608,
65
83
  },
66
84
  {
67
85
  canonicalId: 'qwen/qwen3.5-plus-02-15',
68
86
  alias: 'Qwen 3.5 Plus',
69
87
  input: ['text', 'image'],
88
+ contextWindow: 1_000_000,
89
+ maxTokens: 65_536,
70
90
  },
71
91
  {
72
92
  canonicalId: 'z-ai/glm-5',
73
93
  alias: 'GLM-5',
74
94
  input: ['text'],
95
+ contextWindow: 202_752,
96
+ maxTokens: 131_072,
75
97
  },
76
98
  ] as const
77
99
 
@@ -81,11 +103,17 @@ export const EXTRA_GATEWAY_MODELS: Array<{
81
103
  name: string
82
104
  alias: string
83
105
  input: string[]
106
+ contextWindow: number
107
+ maxTokens: number
108
+ api?: string
84
109
  }> = PUBLIC_GATEWAY_MODELS.map((model) => ({
85
110
  id: model.canonicalId,
86
111
  name: model.canonicalId,
87
112
  alias: model.alias,
88
113
  input: [...model.input],
114
+ contextWindow: model.contextWindow,
115
+ maxTokens: model.maxTokens,
116
+ ...('api' in model && model.api ? {api: model.api} : {}),
89
117
  }))
90
118
 
91
119
  export function readOpenclawConfig(configPath: string): Record<string, unknown> {
@@ -100,6 +128,24 @@ export function writeOpenclawConfig(configPath: string, config: Record<string, u
100
128
  fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n')
101
129
  }
102
130
 
131
+ function buildProviderModel(id: string): {
132
+ id: string
133
+ name: string
134
+ input: string[]
135
+ contextWindow?: number
136
+ maxTokens?: number
137
+ api?: string
138
+ } {
139
+ const extra = EXTRA_GATEWAY_MODELS.find((model) => model.id === id)
140
+ return {
141
+ id,
142
+ name: id,
143
+ input: extra ? [...extra.input] : ['text', 'image'],
144
+ ...(extra ? {contextWindow: extra.contextWindow, maxTokens: extra.maxTokens} : {}),
145
+ ...(extra?.api ? {api: extra.api} : {}),
146
+ }
147
+ }
148
+
103
149
  export function patchModelGateway(
104
150
  config: Record<string, unknown>,
105
151
  api: PluginApi,
@@ -123,7 +169,33 @@ export function patchModelGateway(
123
169
  // Append any missing extra models
124
170
  for (const m of EXTRA_GATEWAY_MODELS) {
125
171
  if (!existingIds.has(m.id)) {
126
- existingModels.push({id: m.id, name: m.name, input: m.input} as any)
172
+ existingModels.push({
173
+ id: m.id,
174
+ name: m.name,
175
+ input: m.input,
176
+ contextWindow: m.contextWindow,
177
+ maxTokens: m.maxTokens,
178
+ ...(m.api ? {api: m.api} : {}),
179
+ } as any)
180
+ dirty = true
181
+ }
182
+ }
183
+
184
+ // Backfill contextWindow/maxTokens and api on existing models that lack them
185
+ const extraLookup = new Map(EXTRA_GATEWAY_MODELS.map((m) => [m.id, m]))
186
+ for (const m of existingModels) {
187
+ const extra = extraLookup.get(m.id)
188
+ if (!extra) continue
189
+ if (
190
+ (m as any).contextWindow !== extra.contextWindow ||
191
+ (m as any).maxTokens !== extra.maxTokens
192
+ ) {
193
+ ;(m as any).contextWindow = extra.contextWindow
194
+ ;(m as any).maxTokens = extra.maxTokens
195
+ dirty = true
196
+ }
197
+ if (extra.api && (m as any).api !== extra.api) {
198
+ ;(m as any).api = extra.api
127
199
  dirty = true
128
200
  }
129
201
  }
@@ -167,7 +239,7 @@ export function patchModelGateway(
167
239
  defaults.models = existingAliases
168
240
  agents.defaults = defaults
169
241
  config.agents = agents
170
- api.logger.info(`Model gateway updated: appended missing extra models/aliases.`)
242
+ api.logger.info('Model gateway updated.')
171
243
  } else {
172
244
  api.logger.info('Model gateway provider already configured.')
173
245
  }
@@ -199,16 +271,14 @@ export function patchModelGateway(
199
271
  return false
200
272
  }
201
273
 
202
- const defaultModels = [{id: defaultModel, name: defaultModel, input: ['text', 'image']}]
274
+ const defaultModels = [buildProviderModel(defaultModel)]
203
275
 
204
276
  const defaultIds = new Set(defaultModels.map((m) => m.id))
205
277
  const models = [
206
278
  ...defaultModels,
207
- ...EXTRA_GATEWAY_MODELS.filter((m) => !defaultIds.has(m.id)).map(({id, name, input}) => ({
208
- id,
209
- name,
210
- input,
211
- })),
279
+ ...EXTRA_GATEWAY_MODELS.filter((m) => !defaultIds.has(m.id)).map(({id}) =>
280
+ buildProviderModel(id),
281
+ ),
212
282
  ]
213
283
 
214
284
  if (!config.models) config.models = {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@2en/clawly-plugins",
3
- "version": "1.29.0-beta.2",
3
+ "version": "1.29.0-beta.5",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "repository": {