openclaw-glance-plugin 0.1.8 → 0.1.9
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/package.json +4 -2
- package/src/plugin/index.js +75 -14
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-glance-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "OpenClaw plugin client for ticker-monitor openclaw-bridge",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"openclaw": {
|
|
8
|
-
"extensions": [
|
|
8
|
+
"extensions": [
|
|
9
|
+
"./index.js"
|
|
10
|
+
]
|
|
9
11
|
},
|
|
10
12
|
"exports": {
|
|
11
13
|
".": "./index.js",
|
package/src/plugin/index.js
CHANGED
|
@@ -133,11 +133,20 @@ function buildControlApi(startupPromise) {
|
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
function tryRegisterTool(registerTool, name, description, handler) {
|
|
136
|
+
function tryRegisterTool(registerTool, name, description, parameters, handler) {
|
|
137
137
|
if (typeof registerTool !== 'function') return;
|
|
138
|
+
const schema =
|
|
139
|
+
parameters || {
|
|
140
|
+
type: 'object',
|
|
141
|
+
additionalProperties: true,
|
|
142
|
+
properties: {}
|
|
143
|
+
};
|
|
144
|
+
|
|
138
145
|
const def = {
|
|
139
146
|
name,
|
|
140
147
|
description,
|
|
148
|
+
parameters: schema,
|
|
149
|
+
inputSchema: schema,
|
|
141
150
|
handler,
|
|
142
151
|
execute: async (_toolCallId, params) => handler(params || {})
|
|
143
152
|
};
|
|
@@ -170,20 +179,74 @@ function tryRegisterTool(registerTool, name, description, handler) {
|
|
|
170
179
|
|
|
171
180
|
function registerControlTools(api, controlApi) {
|
|
172
181
|
const registerTool = api?.registerTool || api?.runtime?.registerTool;
|
|
173
|
-
|
|
174
|
-
|
|
182
|
+
|
|
183
|
+
tryRegisterTool(
|
|
184
|
+
registerTool,
|
|
185
|
+
'watch_query_ticker',
|
|
186
|
+
'Query ticker data',
|
|
187
|
+
{
|
|
188
|
+
type: 'object',
|
|
189
|
+
additionalProperties: true,
|
|
190
|
+
properties: {
|
|
191
|
+
stock_code: { type: 'string' },
|
|
192
|
+
product_code: { type: 'string' },
|
|
193
|
+
product_type: { type: 'string' },
|
|
194
|
+
market: { type: 'string' }
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
(args) => controlApi.queryTickerData(args || {})
|
|
175
198
|
);
|
|
176
|
-
|
|
177
|
-
|
|
199
|
+
|
|
200
|
+
tryRegisterTool(
|
|
201
|
+
registerTool,
|
|
202
|
+
'watch_create',
|
|
203
|
+
'Create watch strategy',
|
|
204
|
+
{
|
|
205
|
+
type: 'object',
|
|
206
|
+
additionalProperties: true,
|
|
207
|
+
properties: {
|
|
208
|
+
product_code: { type: 'string' },
|
|
209
|
+
product_type: { type: 'string' },
|
|
210
|
+
operator_type: { type: 'string' },
|
|
211
|
+
operator_parameters: { type: 'object' },
|
|
212
|
+
channels: { type: 'array', items: { type: 'string' } },
|
|
213
|
+
channel_configs: { type: 'object' }
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
(args) => controlApi.createWatch(args || {})
|
|
178
217
|
);
|
|
179
|
-
|
|
180
|
-
|
|
218
|
+
|
|
219
|
+
const strategySchema = {
|
|
220
|
+
type: 'object',
|
|
221
|
+
additionalProperties: true,
|
|
222
|
+
properties: {
|
|
223
|
+
strategy_id: { type: 'string' },
|
|
224
|
+
strategyId: { type: 'string' }
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
tryRegisterTool(
|
|
229
|
+
registerTool,
|
|
230
|
+
'watch_pause',
|
|
231
|
+
'Pause watch strategy',
|
|
232
|
+
strategySchema,
|
|
233
|
+
(args) => controlApi.pauseWatch(args?.strategyId || args?.strategy_id)
|
|
181
234
|
);
|
|
182
|
-
|
|
183
|
-
|
|
235
|
+
|
|
236
|
+
tryRegisterTool(
|
|
237
|
+
registerTool,
|
|
238
|
+
'watch_activate',
|
|
239
|
+
'Activate watch strategy',
|
|
240
|
+
strategySchema,
|
|
241
|
+
(args) => controlApi.activateWatch(args?.strategyId || args?.strategy_id)
|
|
184
242
|
);
|
|
185
|
-
|
|
186
|
-
|
|
243
|
+
|
|
244
|
+
tryRegisterTool(
|
|
245
|
+
registerTool,
|
|
246
|
+
'watch_remove',
|
|
247
|
+
'Delete watch strategy',
|
|
248
|
+
strategySchema,
|
|
249
|
+
(args) => controlApi.deleteWatch(args?.strategyId || args?.strategy_id)
|
|
187
250
|
);
|
|
188
251
|
}
|
|
189
252
|
|
|
@@ -194,11 +257,9 @@ const plugin = {
|
|
|
194
257
|
register(api) {
|
|
195
258
|
const pluginConfig =
|
|
196
259
|
api?.config?.plugins?.entries?.['openclaw-glance-plugin']?.config ||
|
|
197
|
-
api?.config?.plugins?.entries?.openclawGlancePlugin?.config ||
|
|
198
|
-
api?.config?.plugins?.['openclaw-glance-plugin']?.config ||
|
|
199
|
-
api?.config?.plugins?.openclawGlancePlugin?.config ||
|
|
200
260
|
api?.config?.plugins?.entries?.['glance-bridge']?.config ||
|
|
201
261
|
api?.config?.plugins?.entries?.glanceBridge?.config ||
|
|
262
|
+
api?.config?.plugins?.['openclaw-glance-plugin']?.config ||
|
|
202
263
|
api?.config?.plugins?.['glance-bridge']?.config ||
|
|
203
264
|
api?.config?.plugins?.glanceBridge?.config ||
|
|
204
265
|
{};
|