openclaw-glance-plugin 0.1.1 → 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/README.md CHANGED
@@ -61,7 +61,7 @@ npm run start:adapter
61
61
  import { OpenClawBridgeClient } from './src/index.js';
62
62
 
63
63
  const client = new OpenClawBridgeClient({
64
- baseWsUrl: 'ws://glanceup-pre.100credit.cn',
64
+ baseWsUrl: 'wss://glanceup-pre.100credit.cn',
65
65
  token: '<JWT_TOKEN>',
66
66
  enqueueIfDisconnected: true
67
67
  });
@@ -90,7 +90,7 @@ const res = await client.createWatch({
90
90
  import { OpenClawPluginAdapter } from './src/index.js';
91
91
 
92
92
  const adapter = new OpenClawPluginAdapter({
93
- baseWsUrl: 'ws://glanceup-pre.100credit.cn',
93
+ baseWsUrl: 'wss://glanceup-pre.100credit.cn',
94
94
  token: '<JWT_TOKEN>'
95
95
  });
96
96
 
@@ -125,5 +125,5 @@ await adapter.submitWatchDemand({
125
125
 
126
126
  ## 说明
127
127
 
128
- - 先获取 ws `token`,然后连接 `ws://<host>:8005/openclaw/ws`,并在握手 Header 传 `Authorization: Bearer <TOKEN>`。
128
+ - 先获取 ws `token`,然后连接 `wss://<host>:8005/openclaw/ws`,并在握手 Header 传 `Authorization: Bearer <TOKEN>`。
129
129
  - 发布时将导出 `src/` 与 `README.md`(见 `package.json` 的 `files/exports`)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-glance-plugin",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "OpenClaw plugin client for ticker-monitor openclaw-bridge",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -1,7 +1,7 @@
1
1
  import EventEmitter from 'node:events';
2
2
  import WebSocket from 'ws';
3
3
 
4
- const DEFAULT_BASE_WS_URL = 'ws://glanceup-pre.100credit.cn';
4
+ const DEFAULT_BASE_WS_URL = 'wss://glanceup-pre.100credit.cn';
5
5
 
6
6
  function sleep(ms) {
7
7
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -141,6 +141,10 @@ export class OpenClawBridgeClient extends EventEmitter {
141
141
  return this._request('ping', {});
142
142
  }
143
143
 
144
+ async queryTickerData(payload) {
145
+ return this._request('ticker.query', payload || {});
146
+ }
147
+
144
148
  async waitUntilConnected(timeoutMs = this.waitConnectTimeoutMs) {
145
149
  if (this.connected && this.ws && this.ws.readyState === WebSocket.OPEN) {
146
150
  return true;
@@ -94,6 +94,10 @@ export class OpenClawPluginAdapter {
94
94
  channelConfigs.call = demand.callConfig;
95
95
  if (!channels.includes('call')) channels.push('call');
96
96
  }
97
+ if (demand.smsConfig) {
98
+ channelConfigs.sms = demand.smsConfig;
99
+ if (!channels.includes('sms')) channels.push('sms');
100
+ }
97
101
  if (!channels.includes('openclaw')) channels.unshift('openclaw');
98
102
  if (!channelConfigs.openclaw) channelConfigs.openclaw = {};
99
103
 
@@ -112,6 +116,25 @@ export class OpenClawPluginAdapter {
112
116
  return this.client.createWatch(payload);
113
117
  }
114
118
 
119
+ /**
120
+ * 查询标的实时行情(透传到 bridge 的 ticker.query)。
121
+ */
122
+ async queryTickerData(query) {
123
+ const stockCode = query?.stockCode || query?.productCode || query?.stock_code || '';
124
+ const productType = query?.productType || query?.product_type || '';
125
+ let market = query?.market;
126
+
127
+ if (market == null && String(productType).toLowerCase() === 'crypto') {
128
+ market = '';
129
+ }
130
+
131
+ return this.client.queryTickerData({
132
+ stock_code: stockCode,
133
+ market: market == null ? '' : String(market),
134
+ product_type: productType
135
+ });
136
+ }
137
+
115
138
  async pause(strategyId) {
116
139
  return this.client.pauseWatch(strategyId);
117
140
  }