dsh-cmtoken-oauth 1.0.1 → 1.0.2
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/lib/index.js +4 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -339,10 +339,13 @@ export function apply(ctx, cfg = {}) {
|
|
|
339
339
|
ctx.effect(() => {
|
|
340
340
|
removeRpc = registerRpc(ctx);
|
|
341
341
|
stopTimer = startAutoRefresh(ctx);
|
|
342
|
+
// 启动时立即补刷一次:若停机期间 access 过期、但 refresh 仍有效,马上恢复,
|
|
343
|
+
// 不必等 60 秒定时器;失败只记日志,不影响启动。
|
|
344
|
+
void autoRefresh(ctx).catch((e) => ctx.logger?.warn?.('[cmtoken-oauth] 启动补刷失败: ' + String(e?.message || e)));
|
|
342
345
|
return () => {
|
|
343
346
|
removeRpc();
|
|
344
347
|
stopTimer();
|
|
345
348
|
};
|
|
346
349
|
}, 'cmtoken-oauth: host service');
|
|
347
|
-
ctx.logger?.info?.('[cmtoken-oauth] host
|
|
350
|
+
ctx.logger?.info?.('[cmtoken-oauth] host 服务已启动(自动刷新已开启:启动即补刷 + 每 1 分钟检查 + status 查询按需触发,剩余 <1 小时或已过期即刷新)');
|
|
348
351
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-cmtoken-oauth",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "cmtoken 一键认证 — 通过 OAuth 2.0 Device Grant (RFC 8628) + PKCE 一键认证广东移动 MaaS(cmtoken),自动发现模型并写入 DSH 的 llm-pi-ai provider 配置。零第三方运行时依赖。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|