openclaw-plugin-model-fetch 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +280 -2
- package/dist/contract.d.ts +158 -0
- package/dist/contract.js +48 -0
- package/dist/control-ui/e7b2a8a372a676495b78ec52dbe12cb5154970f64d64c776a96aec3116b20a23/index.css +1 -0
- package/dist/control-ui/e7b2a8a372a676495b78ec52dbe12cb5154970f64d64c776a96aec3116b20a23/index.js +158 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +26 -0
- package/dist/model-fetch.d.ts +88 -0
- package/dist/model-fetch.js +531 -0
- package/dist/operations.d.ts +33 -0
- package/dist/operations.js +353 -0
- package/dist/schemas.d.ts +192 -0
- package/dist/schemas.js +157 -0
- package/openclaw.plugin.json +74 -0
- package/package.json +71 -4
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
const providerIdSchema = Type.String({
|
|
3
|
+
minLength: 1,
|
|
4
|
+
maxLength: 128,
|
|
5
|
+
pattern: "^\\S+$",
|
|
6
|
+
});
|
|
7
|
+
const regexSchema = Type.String({ maxLength: 1_024 });
|
|
8
|
+
export const modelFetchFilterSchema = Type.Object({
|
|
9
|
+
includeRegex: Type.Optional(regexSchema),
|
|
10
|
+
excludeRegex: Type.Optional(regexSchema),
|
|
11
|
+
manualIds: Type.Optional(Type.Array(Type.String({ minLength: 1, maxLength: 512 }), {
|
|
12
|
+
maxItems: 1_000,
|
|
13
|
+
uniqueItems: true,
|
|
14
|
+
})),
|
|
15
|
+
replace: Type.Optional(Type.Boolean()),
|
|
16
|
+
}, { additionalProperties: false });
|
|
17
|
+
export const modelFetchConfigSchema = Type.Object({
|
|
18
|
+
providers: Type.Optional(Type.Record(Type.String(), Type.Object({
|
|
19
|
+
filter: Type.Optional(modelFetchFilterSchema),
|
|
20
|
+
targetAgents: Type.Optional(Type.Array(Type.String({ minLength: 1, maxLength: 128 }), {
|
|
21
|
+
maxItems: 256,
|
|
22
|
+
uniqueItems: true,
|
|
23
|
+
})),
|
|
24
|
+
}, { additionalProperties: false }))),
|
|
25
|
+
}, { additionalProperties: false });
|
|
26
|
+
export const modelFetchParameters = Type.Object({
|
|
27
|
+
provider: Type.String({
|
|
28
|
+
minLength: 1,
|
|
29
|
+
maxLength: 128,
|
|
30
|
+
description: "Provider id from models.providers. Only this provider's configured filter is used.",
|
|
31
|
+
}),
|
|
32
|
+
includeRegex: Type.Optional(Type.String({
|
|
33
|
+
maxLength: 1_024,
|
|
34
|
+
description: "Temporary include regex. When omitted, the provider's persisted includeRegex is used.",
|
|
35
|
+
})),
|
|
36
|
+
excludeRegex: Type.Optional(Type.String({
|
|
37
|
+
maxLength: 1_024,
|
|
38
|
+
description: "Temporary exclude regex. Manual IDs are never excluded. When omitted, the provider's persisted excludeRegex is used.",
|
|
39
|
+
})),
|
|
40
|
+
manualIds: Type.Optional(Type.Array(Type.String({ minLength: 1, maxLength: 512 }), {
|
|
41
|
+
maxItems: 1_000,
|
|
42
|
+
description: "Temporary exact model IDs to select. Without includeRegex, only these IDs are selected; with includeRegex, they bypass include/exclude.",
|
|
43
|
+
})),
|
|
44
|
+
replace: Type.Optional(Type.Boolean({
|
|
45
|
+
description: "Remove existing models absent from the selected fetched set. Defaults to true.",
|
|
46
|
+
})),
|
|
47
|
+
dryRun: Type.Optional(Type.Boolean({
|
|
48
|
+
description: "Compute and return the planned model list without writing configuration.",
|
|
49
|
+
})),
|
|
50
|
+
}, { additionalProperties: false });
|
|
51
|
+
export const modelFetchResultSchema = Type.Object({
|
|
52
|
+
provider: providerIdSchema,
|
|
53
|
+
fetched: Type.Integer({ minimum: 0 }),
|
|
54
|
+
selected: Type.Array(Type.String({ maxLength: 512 }), { maxItems: 1_000 }),
|
|
55
|
+
added: Type.Integer({ minimum: 0 }),
|
|
56
|
+
unchanged: Type.Integer({ minimum: 0 }),
|
|
57
|
+
removed: Type.Integer({ minimum: 0 }),
|
|
58
|
+
replace: Type.Boolean(),
|
|
59
|
+
dryRun: Type.Boolean(),
|
|
60
|
+
configPath: Type.String({ maxLength: 2_048 }),
|
|
61
|
+
persisted: Type.Boolean(),
|
|
62
|
+
}, { additionalProperties: false });
|
|
63
|
+
export const modelViewSchema = Type.Object({
|
|
64
|
+
id: Type.String({ minLength: 1, maxLength: 512 }),
|
|
65
|
+
name: Type.String({ maxLength: 512 }),
|
|
66
|
+
contextWindow: Type.Optional(Type.Integer({ minimum: 1 })),
|
|
67
|
+
}, { additionalProperties: false });
|
|
68
|
+
export const providerSummarySchema = Type.Object({
|
|
69
|
+
id: providerIdSchema,
|
|
70
|
+
label: Type.String({ minLength: 1, maxLength: 256 }),
|
|
71
|
+
api: Type.String({ maxLength: 128 }),
|
|
72
|
+
baseUrl: Type.String({ maxLength: 2_048 }),
|
|
73
|
+
configPath: Type.String({ maxLength: 2_048 }),
|
|
74
|
+
filter: modelFetchFilterSchema,
|
|
75
|
+
targetAgents: Type.Array(Type.String({ minLength: 1, maxLength: 128 }), {
|
|
76
|
+
maxItems: 256,
|
|
77
|
+
uniqueItems: true,
|
|
78
|
+
}),
|
|
79
|
+
configuredModels: Type.Array(modelViewSchema, { maxItems: 2_000 }),
|
|
80
|
+
}, { additionalProperties: false });
|
|
81
|
+
export const agentSummarySchema = Type.Object({
|
|
82
|
+
id: Type.String({ minLength: 1, maxLength: 128 }),
|
|
83
|
+
hasModelAllowlist: Type.Boolean(),
|
|
84
|
+
}, { additionalProperties: false });
|
|
85
|
+
const emptyInputSchema = Type.Object({}, { additionalProperties: false });
|
|
86
|
+
const providerInputSchema = Type.Object({ provider: providerIdSchema }, { additionalProperties: false });
|
|
87
|
+
export const listProvidersOutputSchema = Type.Object({
|
|
88
|
+
providers: Type.Array(providerSummarySchema, { maxItems: 256 }),
|
|
89
|
+
agents: Type.Array(agentSummarySchema, { maxItems: 512 }),
|
|
90
|
+
}, { additionalProperties: false });
|
|
91
|
+
export const fetchModelsOutputSchema = Type.Object({
|
|
92
|
+
provider: providerIdSchema,
|
|
93
|
+
fetchedAt: Type.String({ maxLength: 64 }),
|
|
94
|
+
models: Type.Array(modelViewSchema, { maxItems: 2_000 }),
|
|
95
|
+
}, { additionalProperties: false });
|
|
96
|
+
export const saveStrategyOutputSchema = Type.Object({
|
|
97
|
+
provider: providerIdSchema,
|
|
98
|
+
savedAt: Type.String({ maxLength: 64 }),
|
|
99
|
+
configPath: Type.String({ maxLength: 2_048 }),
|
|
100
|
+
filter: modelFetchFilterSchema,
|
|
101
|
+
targetAgents: Type.Array(Type.String({ minLength: 1, maxLength: 128 }), {
|
|
102
|
+
maxItems: 256,
|
|
103
|
+
uniqueItems: true,
|
|
104
|
+
}),
|
|
105
|
+
}, { additionalProperties: false });
|
|
106
|
+
export const saveStrategyInputSchema = Type.Object({
|
|
107
|
+
provider: providerIdSchema,
|
|
108
|
+
filter: modelFetchFilterSchema,
|
|
109
|
+
targetAgents: Type.Optional(Type.Array(Type.String({ minLength: 1, maxLength: 128 }), {
|
|
110
|
+
maxItems: 256,
|
|
111
|
+
uniqueItems: true,
|
|
112
|
+
})),
|
|
113
|
+
}, { additionalProperties: false });
|
|
114
|
+
export const applyPlanSchema = Type.Object({
|
|
115
|
+
fingerprint: Type.String({ minLength: 64, maxLength: 64 }),
|
|
116
|
+
fetchedAt: Type.String({ maxLength: 64 }),
|
|
117
|
+
fetchedCount: Type.Integer({ minimum: 0 }),
|
|
118
|
+
addedIds: Type.Array(Type.String({ maxLength: 512 }), { maxItems: 2_000 }),
|
|
119
|
+
removedIds: Type.Array(Type.String({ maxLength: 512 }), { maxItems: 2_000 }),
|
|
120
|
+
selectedIds: Type.Array(Type.String({ maxLength: 512 }), { maxItems: 2_000 }),
|
|
121
|
+
unchangedCount: Type.Integer({ minimum: 0 }),
|
|
122
|
+
}, { additionalProperties: false });
|
|
123
|
+
export const previewApplyOutputSchema = Type.Object({
|
|
124
|
+
provider: providerIdSchema,
|
|
125
|
+
plan: applyPlanSchema,
|
|
126
|
+
models: Type.Array(modelViewSchema, { maxItems: 2_000 }),
|
|
127
|
+
}, { additionalProperties: false });
|
|
128
|
+
export const applyStrategyInputSchema = Type.Object({
|
|
129
|
+
provider: providerIdSchema,
|
|
130
|
+
fingerprint: Type.String({ minLength: 64, maxLength: 64 }),
|
|
131
|
+
expectedRemovals: Type.Array(Type.String({ maxLength: 512 }), { maxItems: 2_000 }),
|
|
132
|
+
targetAgents: Type.Optional(Type.Array(Type.String({ minLength: 1, maxLength: 128 }), {
|
|
133
|
+
maxItems: 256,
|
|
134
|
+
uniqueItems: true,
|
|
135
|
+
})),
|
|
136
|
+
}, { additionalProperties: false });
|
|
137
|
+
export const applyStrategyOutputSchema = Type.Object({
|
|
138
|
+
provider: providerIdSchema,
|
|
139
|
+
persisted: Type.Boolean(),
|
|
140
|
+
configPath: Type.String({ maxLength: 2_048 }),
|
|
141
|
+
fetchedAt: Type.String({ maxLength: 64 }),
|
|
142
|
+
fetchedCount: Type.Integer({ minimum: 0 }),
|
|
143
|
+
added: Type.Integer({ minimum: 0 }),
|
|
144
|
+
unchanged: Type.Integer({ minimum: 0 }),
|
|
145
|
+
removed: Type.Integer({ minimum: 0 }),
|
|
146
|
+
selectedIds: Type.Array(Type.String({ maxLength: 512 }), { maxItems: 2_000 }),
|
|
147
|
+
targetAgents: Type.Array(Type.String({ minLength: 1, maxLength: 128 }), {
|
|
148
|
+
maxItems: 256,
|
|
149
|
+
uniqueItems: true,
|
|
150
|
+
}),
|
|
151
|
+
syncedAgents: Type.Array(Type.String({ minLength: 1, maxLength: 128 }), {
|
|
152
|
+
maxItems: 256,
|
|
153
|
+
uniqueItems: true,
|
|
154
|
+
}),
|
|
155
|
+
models: Type.Array(modelViewSchema, { maxItems: 2_000 }),
|
|
156
|
+
}, { additionalProperties: false });
|
|
157
|
+
export { emptyInputSchema, providerInputSchema };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "model-fetch",
|
|
3
|
+
"name": "Model Fetch",
|
|
4
|
+
"description": "Fetch and refresh configured provider model lists into OpenClaw config with independent per-provider filters.",
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configSchema": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"providers": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"patternProperties": {
|
|
12
|
+
"^.*$": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"properties": {
|
|
15
|
+
"filter": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"properties": {
|
|
18
|
+
"includeRegex": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"maxLength": 1024
|
|
21
|
+
},
|
|
22
|
+
"excludeRegex": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"maxLength": 1024
|
|
25
|
+
},
|
|
26
|
+
"manualIds": {
|
|
27
|
+
"type": "array",
|
|
28
|
+
"items": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"minLength": 1,
|
|
31
|
+
"maxLength": 512
|
|
32
|
+
},
|
|
33
|
+
"maxItems": 1000,
|
|
34
|
+
"uniqueItems": true
|
|
35
|
+
},
|
|
36
|
+
"replace": {
|
|
37
|
+
"type": "boolean"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"additionalProperties": false
|
|
41
|
+
},
|
|
42
|
+
"targetAgents": {
|
|
43
|
+
"type": "array",
|
|
44
|
+
"items": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"minLength": 1,
|
|
47
|
+
"maxLength": 128
|
|
48
|
+
},
|
|
49
|
+
"maxItems": 256,
|
|
50
|
+
"uniqueItems": true
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"additionalProperties": false
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"additionalProperties": false
|
|
59
|
+
},
|
|
60
|
+
"activation": {
|
|
61
|
+
"onStartup": true
|
|
62
|
+
},
|
|
63
|
+
"controlUi": {
|
|
64
|
+
"entry": "dist/control-ui/e7b2a8a372a676495b78ec52dbe12cb5154970f64d64c776a96aec3116b20a23/index.js",
|
|
65
|
+
"styles": [
|
|
66
|
+
"dist/control-ui/e7b2a8a372a676495b78ec52dbe12cb5154970f64d64c776a96aec3116b20a23/index.css"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"contracts": {
|
|
70
|
+
"tools": [
|
|
71
|
+
"model_fetch"
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-plugin-model-fetch",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "OpenClaw plugin tool that refreshes configured provider model lists into OpenClaw config with independent per-provider filters.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/AdoShan/OpenClaw-ModelFetch.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/AdoShan/OpenClaw-ModelFetch#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/AdoShan/OpenClaw-ModelFetch/issues"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"openclaw",
|
|
16
|
+
"openclaw-plugin",
|
|
17
|
+
"model-fetch",
|
|
18
|
+
"openrouter",
|
|
19
|
+
"ollama",
|
|
20
|
+
"models"
|
|
21
|
+
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=24.16.0"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"openclaw.plugin.json",
|
|
28
|
+
"README.md"
|
|
29
|
+
],
|
|
30
|
+
"type": "module",
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "node scripts/clean.mjs && tsc -p tsconfig.json",
|
|
33
|
+
"plugin:build": "npm run build && openclaw plugins build --entry ./dist/index.js",
|
|
34
|
+
"plugin:validate": "npm run plugin:build && openclaw plugins validate --entry ./dist/index.js",
|
|
35
|
+
"test": "vitest run --config ./vitest.config.ts",
|
|
36
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.ui.json",
|
|
37
|
+
"prepublishOnly": "npm run plugin:build",
|
|
38
|
+
"clean": "node scripts/clean.mjs"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"typebox": "^1.1.38"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"openclaw": ">=2026.10.5"
|
|
45
|
+
},
|
|
46
|
+
"peerDependenciesMeta": {
|
|
47
|
+
"openclaw": {
|
|
48
|
+
"optional": true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"esbuild": "^0.28.2",
|
|
53
|
+
"linkedom": "^0.18.13",
|
|
54
|
+
"openclaw": "latest",
|
|
55
|
+
"typescript": "7.0.2",
|
|
56
|
+
"vitest": "^3.2.0"
|
|
57
|
+
},
|
|
58
|
+
"openclaw": {
|
|
59
|
+
"extensions": [
|
|
60
|
+
"./dist/index.js"
|
|
61
|
+
],
|
|
62
|
+
"compat": {
|
|
63
|
+
"pluginApi": ">=2026.10.5"
|
|
64
|
+
},
|
|
65
|
+
"controlUi": "./src/control-ui.ts",
|
|
66
|
+
"build": {
|
|
67
|
+
"openclawVersion": "2026.10.5"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"publishConfig": {
|
|
71
|
+
"access": "public"
|
|
72
|
+
}
|
|
73
|
+
}
|