dsh-aupdate 0.6.1 → 0.6.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 +14 -0
- package/client.js +27 -17
- package/index.js +334 -106
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -153,6 +153,11 @@ mtime 为准:那是磁盘事实。会话目录整个读不到时返回「不
|
|
|
153
153
|
- 可选显示最近 100 / 200 / 500 / 1000 行,默认 200
|
|
154
154
|
- **最新的在最上面**:按时间倒序渲染,刚装了什么不用滚到底
|
|
155
155
|
- 时间只到「月-日 时:分:秒」并等宽对齐,省下的宽度留给正文
|
|
156
|
+
- **正文跟着「显示语言」走**:文件里存的是事件码和参数,不是成品句子,所以在中文与
|
|
157
|
+
English 之间切换后,连历史行都会跟着变;0.6.2 之前写下的旧行是句子,原样保留
|
|
158
|
+
- **原因也是事件**:「上一次」的原因、跳过安装的理由、就地生效的结果都存成
|
|
159
|
+
`{ code, args }`,由同一张模板表渲染,切语言一起变。pnpm 的报错、宿主要求重启、
|
|
160
|
+
锁持有者这类**不是我们写的**自由文本原样透出——翻译它们只会更迷惑
|
|
156
161
|
- 打开「自动刷新」后每 5 秒拉一次,正在排查时开着;关掉就完全不动
|
|
157
162
|
- 读之前会先把待写队列刷下去,所以刚点完检查,那几行马上就在里面
|
|
158
163
|
- 时间戳按本地时区显示,文件超过 1MB 轮转给一句提示,另附总行数
|
|
@@ -399,6 +404,15 @@ live in `~/.dsh/aupdate-settings.json`.
|
|
|
399
404
|
The page renders the log newest first, so whatever just happened is at the top of the
|
|
400
405
|
box instead of at the bottom of a scroll.
|
|
401
406
|
|
|
407
|
+
Log lines are stored as an event code plus its arguments, not as finished sentences, so
|
|
408
|
+
switching **Display language** re-renders history too. Lines written before 0.6.2 are
|
|
409
|
+
sentences and stay exactly as they were.
|
|
410
|
+
|
|
411
|
+
Reasons are events as well: the last run's reason, why a package was skipped, and the
|
|
412
|
+
hot-apply outcome are all stored as `{ code, args }` and rendered from the same template
|
|
413
|
+
tables. Free text that we did not write — pnpm errors, a host-requested restart, the lock
|
|
414
|
+
holder — passes through untranslated, because translating it would only mislead.
|
|
415
|
+
|
|
402
416
|
You can read this file straight from the settings page (see above). Point it
|
|
403
417
|
elsewhere with `DSH_AUTO_UPDATE_LOG`.
|
|
404
418
|
|
package/client.js
CHANGED
|
@@ -336,8 +336,14 @@ window.__ModuleLoader__.load({
|
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
|
|
340
|
-
|
|
339
|
+
/** 后端按这个参数渲染原因文本(lastRun.reason 等),所以每个请求都要带上。 */
|
|
340
|
+
function langQuery() {
|
|
341
|
+
return '?lang=' + (LANG === 'en' ? 'en' : 'zh')
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
async function getState(lang) {
|
|
345
|
+
const wanted = lang === 'en' ? 'en' : 'zh'
|
|
346
|
+
const response = await fetch(endpoint('state') + '?lang=' + wanted, {
|
|
341
347
|
headers: { accept: 'application/json' },
|
|
342
348
|
cache: 'no-store',
|
|
343
349
|
})
|
|
@@ -345,8 +351,10 @@ window.__ModuleLoader__.load({
|
|
|
345
351
|
return response.json()
|
|
346
352
|
}
|
|
347
353
|
|
|
348
|
-
async function getLogs(lines) {
|
|
349
|
-
|
|
354
|
+
async function getLogs(lines, lang) {
|
|
355
|
+
// 日志在磁盘上存的是 code + 参数,正文由后端按这里要的语言渲染。
|
|
356
|
+
const wanted = lang === 'en' ? 'en' : 'zh'
|
|
357
|
+
const response = await fetch(endpoint('logs') + '?lines=' + encodeURIComponent(String(lines)) + '&lang=' + wanted, {
|
|
350
358
|
headers: { accept: 'application/json' },
|
|
351
359
|
cache: 'no-store',
|
|
352
360
|
})
|
|
@@ -355,7 +363,7 @@ window.__ModuleLoader__.load({
|
|
|
355
363
|
}
|
|
356
364
|
|
|
357
365
|
async function saveState(patch) {
|
|
358
|
-
const response = await fetch(endpoint('state'), {
|
|
366
|
+
const response = await fetch(endpoint('state') + langQuery(), {
|
|
359
367
|
method: 'POST',
|
|
360
368
|
headers: { 'content-type': 'application/json', accept: 'application/json' },
|
|
361
369
|
body: JSON.stringify(patch),
|
|
@@ -365,7 +373,7 @@ window.__ModuleLoader__.load({
|
|
|
365
373
|
}
|
|
366
374
|
|
|
367
375
|
async function rollback(name) {
|
|
368
|
-
const response = await fetch(endpoint('rollback'), {
|
|
376
|
+
const response = await fetch(endpoint('rollback') + langQuery(), {
|
|
369
377
|
method: 'POST',
|
|
370
378
|
headers: { 'content-type': 'application/json', accept: 'application/json' },
|
|
371
379
|
body: JSON.stringify({ name }),
|
|
@@ -375,7 +383,7 @@ window.__ModuleLoader__.load({
|
|
|
375
383
|
}
|
|
376
384
|
|
|
377
385
|
async function runNow(mode) {
|
|
378
|
-
const response = await fetch(endpoint('run'), {
|
|
386
|
+
const response = await fetch(endpoint('run') + langQuery(), {
|
|
379
387
|
method: 'POST',
|
|
380
388
|
headers: { 'content-type': 'application/json', accept: 'application/json' },
|
|
381
389
|
body: JSON.stringify({ mode }),
|
|
@@ -614,7 +622,7 @@ window.__ModuleLoader__.load({
|
|
|
614
622
|
const load = useCallback(async () => {
|
|
615
623
|
setPhase('loading')
|
|
616
624
|
try {
|
|
617
|
-
const next = await getState()
|
|
625
|
+
const next = await getState(LANG)
|
|
618
626
|
// 语言先落地再渲染:否则第一屏会先按系统语言画一次,再跳成用户选的。
|
|
619
627
|
applyLang(next?.settings?.lang)
|
|
620
628
|
setState(next)
|
|
@@ -623,7 +631,8 @@ window.__ModuleLoader__.load({
|
|
|
623
631
|
} catch {
|
|
624
632
|
setPhase('error')
|
|
625
633
|
}
|
|
626
|
-
|
|
634
|
+
// LANG 进依赖:切换显示语言后要重新取一次,原因文本才是新语言的。
|
|
635
|
+
}, [LANG])
|
|
627
636
|
|
|
628
637
|
useEffect(() => { void load() }, [load])
|
|
629
638
|
|
|
@@ -692,7 +701,7 @@ window.__ModuleLoader__.load({
|
|
|
692
701
|
}
|
|
693
702
|
// 跑完把状态刷一遍,页面上看到的就是最新结果。
|
|
694
703
|
try {
|
|
695
|
-
const next = await getState()
|
|
704
|
+
const next = await getState(LANG)
|
|
696
705
|
setState(next)
|
|
697
706
|
setDraft((prev) => (prev === null ? next.settings : prev))
|
|
698
707
|
} catch {}
|
|
@@ -718,7 +727,7 @@ window.__ModuleLoader__.load({
|
|
|
718
727
|
const result = await rollback(target)
|
|
719
728
|
setRollHint(result.ok ? T.rollbackDone + ' · ' + target : T.rollbackFailed + ' · ' + (result.payload?.reason ?? ''))
|
|
720
729
|
try {
|
|
721
|
-
const next = await getState()
|
|
730
|
+
const next = await getState(LANG)
|
|
722
731
|
setState(next)
|
|
723
732
|
setDraft((prev) => (prev === null ? next.settings : prev))
|
|
724
733
|
} catch {}
|
|
@@ -883,15 +892,16 @@ window.__ModuleLoader__.load({
|
|
|
883
892
|
|
|
884
893
|
const refresh = useCallback(async () => {
|
|
885
894
|
try {
|
|
886
|
-
|
|
895
|
+
// LANG 进依赖:切换显示语言时这一栏要重新取,否则日志正文还是旧语言。
|
|
896
|
+
const next = await getLogs(lines, LANG)
|
|
887
897
|
setData(next)
|
|
888
898
|
setPhase(next?.exists === false ? 'missing' : 'ready')
|
|
889
899
|
} catch {
|
|
890
900
|
setPhase('missing')
|
|
891
901
|
}
|
|
892
|
-
}, [lines])
|
|
902
|
+
}, [lines, LANG])
|
|
893
903
|
|
|
894
|
-
// lines
|
|
904
|
+
// lines 或语言变了要立刻重取;tick 是自动刷新用来触发同一段逻辑的。
|
|
895
905
|
useEffect(() => { void refresh() }, [refresh, tick])
|
|
896
906
|
|
|
897
907
|
useEffect(() => {
|
|
@@ -953,12 +963,12 @@ window.__ModuleLoader__.load({
|
|
|
953
963
|
let alive = true
|
|
954
964
|
void (async () => {
|
|
955
965
|
try {
|
|
956
|
-
const next = await getState()
|
|
966
|
+
const next = await getState(LANG)
|
|
957
967
|
if (alive) setState(next)
|
|
958
968
|
} catch {}
|
|
959
969
|
})()
|
|
960
970
|
return () => { alive = false }
|
|
961
|
-
}, [])
|
|
971
|
+
}, [LANG])
|
|
962
972
|
const last = state?.lastRun
|
|
963
973
|
const text = state === null
|
|
964
974
|
? '…'
|
|
@@ -1052,7 +1062,7 @@ window.__ModuleLoader__.load({
|
|
|
1052
1062
|
const tick = async () => {
|
|
1053
1063
|
if (stopped) return
|
|
1054
1064
|
try {
|
|
1055
|
-
const state = await getState()
|
|
1065
|
+
const state = await getState(LANG)
|
|
1056
1066
|
if (state?.settings?.notify !== false) {
|
|
1057
1067
|
const updates = Array.isArray(state?.lastRun?.updates) ? state.lastRun.updates : []
|
|
1058
1068
|
if (updates.length > 0) {
|
package/index.js
CHANGED
|
@@ -91,37 +91,239 @@ function flushLog() {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
/**
|
|
95
|
-
|
|
94
|
+
/**
|
|
95
|
+
* 结构化日志。
|
|
96
|
+
*
|
|
97
|
+
* 0.6.1 及以前是把成品句子写进文件:中文环境下写中文,那一刻语言就钉死了,
|
|
98
|
+
* 之后在设置页切成 English,历史行仍然全是中文。要让日志跟着语言走,落盘的内容
|
|
99
|
+
* 就不能是句子——这里改成写 code + 参数(一行一个 JSON 数组),等到读取时
|
|
100
|
+
* 才按请求的语言渲染。想加一种语言只是多一张模板表。
|
|
101
|
+
*
|
|
102
|
+
* 兼容:旧格式的行是成品句子,解析失败就原样显示,不丢历史。
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
/** 状态词。运行结果是数据(done/skipped/…),显示成哪种语言由读取侧决定。 */
|
|
106
|
+
const LOG_STATUS = {
|
|
107
|
+
zh: {
|
|
108
|
+
done: '完成', blocked: '已让开', failed: '失败', skipped: '已跳过', none: '无', ok: '成功',
|
|
109
|
+
partial: '部分完成', busy: '正在跑', unavailable: '不可用', applying: '生效中',
|
|
110
|
+
restart: '需重启', cancelled: '已取消',
|
|
111
|
+
},
|
|
112
|
+
en: {
|
|
113
|
+
done: 'done', blocked: 'held off', failed: 'failed', skipped: 'skipped', none: 'none', ok: 'ok',
|
|
114
|
+
partial: 'partly done', busy: 'busy', unavailable: 'unavailable', applying: 'applying',
|
|
115
|
+
restart: 'restart needed', cancelled: 'cancelled',
|
|
116
|
+
},
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** 设置项在日志里的名字:enabled / autoApply 这种字面量不该出现在面板上。 */
|
|
120
|
+
const LOG_FIELD_LABELS = {
|
|
121
|
+
zh: {
|
|
122
|
+
lang: '显示语言', enabled: '定时检查', autoApply: '自动安装', hotReload: '就地生效',
|
|
123
|
+
checkOnStart: '启动先查', idleOnly: '忙时不动手', notify: '更新提醒',
|
|
124
|
+
intervalMinutes: '检查间隔', firstDelayMinutes: '首次延迟', exclude: '不更新的包',
|
|
125
|
+
allowMajor: '跨大版本', allowPrerelease: '预发布', scheduleMode: '调度方式',
|
|
126
|
+
dailyAt: '每天时刻', everyHours: '每几小时', everyDays: '每几天',
|
|
127
|
+
suppressHours: '失败抑制', maxPerCycle: '单轮上限', sessionIdleMinutes: '会话静默',
|
|
128
|
+
},
|
|
129
|
+
en: {
|
|
130
|
+
lang: 'display language', enabled: 'scheduled check', autoApply: 'auto-install',
|
|
131
|
+
hotReload: 'apply in place', checkOnStart: 'check on start', idleOnly: 'hold while busy',
|
|
132
|
+
notify: 'update notices', intervalMinutes: 'check interval', firstDelayMinutes: 'first delay',
|
|
133
|
+
exclude: 'never-update list', allowMajor: 'major upgrades', allowPrerelease: 'prereleases',
|
|
134
|
+
scheduleMode: 'schedule', dailyAt: 'time of day', everyHours: 'every N hours',
|
|
135
|
+
everyDays: 'every N days', suppressHours: 'failure suppression', maxPerCycle: 'per-cycle cap',
|
|
136
|
+
sessionIdleMinutes: 'session idle',
|
|
137
|
+
},
|
|
138
|
+
}
|
|
96
139
|
|
|
97
|
-
function
|
|
98
|
-
|
|
140
|
+
function makeLogTemplates(lang) {
|
|
141
|
+
const S = LOG_STATUS[lang] ?? LOG_STATUS.zh
|
|
142
|
+
const labels = LOG_FIELD_LABELS[lang] ?? LOG_FIELD_LABELS.zh
|
|
143
|
+
const zh = lang !== 'en'
|
|
144
|
+
const sep = zh ? '、' : ', '
|
|
145
|
+
const status = (value) => S[String(value ?? '')] ?? String(value ?? '')
|
|
146
|
+
const list = (value) => (Array.isArray(value) ? value.join(sep) : String(value ?? ''))
|
|
147
|
+
const onOff = (value) => (zh ? (value === true ? '开' : '关') : (value === true ? 'on' : 'off'))
|
|
148
|
+
return {
|
|
149
|
+
raw: (text) => String(text ?? ''),
|
|
150
|
+
checked: (n, u) => (zh ? `检查 ${n} 个插件,${u} 个可更新` : `Checked ${n} plugin(s), ${u} update(s) available`),
|
|
151
|
+
capped: (max, left) => (zh ? `本轮限量装 ${max} 个,剩下 ${left} 个下一轮再装` : `Capped at ${max} install(s) this cycle; ${left} left for the next round`),
|
|
152
|
+
skipInstall: (why) => (zh ? `跳过安装:${list(why)}` : `Skipped installing: ${list(why)}`),
|
|
153
|
+
snapshotTaken: (dir, files) => (zh ? `已留快照 ${dir}(${list(files)})` : `Snapshot saved to ${dir} (${list(files)})`),
|
|
154
|
+
snapshotFailed: (msg) => (zh ? `留快照失败:${msg}` : `Snapshot failed: ${msg}`),
|
|
155
|
+
tookOverLock: (minutes) => (zh ? `接管了一个已挂 ${minutes} 分钟的安装锁` : `Took over an install lock left for ${minutes} min`),
|
|
156
|
+
install: (name, target, ok, detail) => (zh
|
|
157
|
+
? `安装 ${name}@${target} → ${ok ? '成功' : '失败:' + (detail || '')}`
|
|
158
|
+
: `Installed ${name}@${target} → ${ok ? 'ok' : 'failed: ' + (detail || '')}`),
|
|
159
|
+
hotApply: (state, reason) => (zh
|
|
160
|
+
? `就地生效 → ${status(state)}${reason ? ':' + reason : ''}`
|
|
161
|
+
: `Hot apply → ${status(state)}${reason ? ': ' + reason : ''}`),
|
|
162
|
+
cycle: (mode, state, reason) => (zh
|
|
163
|
+
? `本轮${mode === 'check' ? '检查' : '更新'} → ${status(state)}:${reason}`
|
|
164
|
+
: `Cycle ${mode === 'check' ? 'check' : 'update'} → ${status(state)}: ${reason}`),
|
|
165
|
+
cycleFailed: (reason) => (zh ? `本轮失败:${reason}` : `Cycle failed: ${reason}`),
|
|
166
|
+
cycleThrew: (msg) => (zh ? `本轮抛错:${msg}` : `Cycle threw: ${msg}`),
|
|
167
|
+
rollback: (name, from, to, ok, detail) => (zh
|
|
168
|
+
? `回滚 ${name} ${to} → ${from} → ${ok ? '成功' : '失败:' + (detail || '')}`
|
|
169
|
+
: `Rolled back ${name} ${to} → ${from} → ${ok ? 'ok' : 'failed: ' + (detail || '')}`),
|
|
170
|
+
rollbackRequest: (name, ok, reason) => (zh
|
|
171
|
+
? `收到回滚请求 ${name} → ${ok ? '成功' : '失败:' + (reason || '')}`
|
|
172
|
+
: `Rollback requested for ${name} → ${ok ? 'ok' : 'failed: ' + (reason || '')}`),
|
|
173
|
+
settingsChanged: (keys) => (zh
|
|
174
|
+
? `设置页改了:${list((Array.isArray(keys) ? keys : []).map((key) => labels[key] ?? String(key)))}`
|
|
175
|
+
: `Settings changed: ${list((Array.isArray(keys) ? keys : []).map((key) => labels[key] ?? String(key)))}`),
|
|
176
|
+
rescheduleFailed: (msg) => (zh ? `重排定时失败:${msg}` : `Rescheduling failed: ${msg}`),
|
|
177
|
+
toolFailed: (msg) => (zh ? `工具调用失败:${msg}` : `Tool call failed: ${msg}`),
|
|
178
|
+
toolUnavailable: (msg) => (zh ? `无法提供工具:${msg}` : `Could not offer the tool: ${msg}`),
|
|
179
|
+
toolRegistered: (ok) => (zh ? `工具注册:${ok ? '成功' : '失败'}` : `Tool registered: ${ok ? 'ok' : 'failed'}`),
|
|
180
|
+
toolRegisterThrew: (msg) => (zh ? `注册工具时抛错:${msg}` : `Tool registration threw: ${msg}`),
|
|
181
|
+
routeFailed: (msg) => (zh ? `接口处理出错:${msg}` : `Route failed: ${msg}`),
|
|
182
|
+
routeReady: (prefix) => (zh ? `设置接口已就绪:${prefix}` : `Settings route ready: ${prefix}`),
|
|
183
|
+
routeReadyNoScope: (prefix) => (zh ? `设置接口已就绪(没有 effect 作用域):${prefix}` : `Settings route ready (no effect scope): ${prefix}`),
|
|
184
|
+
routeRegisterFailed: (msg) => (zh ? `无法注册设置接口:${msg}` : `Could not register the settings route: ${msg}`),
|
|
185
|
+
routeRegisterThrew: (msg) => (zh ? `注册设置接口时抛错:${msg}` : `Route registration threw: ${msg}`),
|
|
186
|
+
webServerMissing: () => (zh ? '没有 webServer 服务,设置页会显示不可用' : 'No webServer service; the settings page will report it'),
|
|
187
|
+
toolScopeEnded: (msg) => (zh ? `工具作用域已结束:${msg}` : `Tool scope ended: ${msg}`),
|
|
188
|
+
disabledBySettings: () => (zh ? '设置里已关闭自动更新,定时器待命' : 'Auto-update is off in settings; scheduler parked'),
|
|
189
|
+
disabledByConfig: () => (zh ? '配置里已关闭自动更新,定时器待命,设置页仍然可用' : 'Auto-update is off in config; scheduler parked, settings page stays live'),
|
|
190
|
+
ready: (minutes, autoApply, hotReload) => (zh
|
|
191
|
+
? `已就绪:每 ${minutes} 分钟检查一次,自动安装=${onOff(autoApply)},就地生效=${onOff(hotReload)}`
|
|
192
|
+
: `Ready: every ${minutes} min, autoApply=${onOff(autoApply)}, hotReload=${onOff(hotReload)}`),
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const LOG_TEMPLATES = { zh: makeLogTemplates('zh'), en: makeLogTemplates('en') }
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* 原因事件。
|
|
200
|
+
*
|
|
201
|
+
* 运行结果里的「为什么没装 / 为什么不动手」以前直接拼成中文句子:写进 lastRun、
|
|
202
|
+
* 拼进 report.reason、再喂给日志。语言一换,这些句子就是不动的中文,跟日志正文
|
|
203
|
+
* 对不上。所以原因也照日志的做法拆成 { code, args },渲染时才决定语言。
|
|
204
|
+
*
|
|
205
|
+
* 自由文本(pnpm 的报错、锁持有者、宿主给的 restart 原因)仍然是字符串:
|
|
206
|
+
* 那些不是我们写的话,翻译不了,原样透出比乱翻更诚实。
|
|
207
|
+
*/
|
|
208
|
+
function makeReasonTemplates(lang) {
|
|
209
|
+
const zh = lang !== 'en'
|
|
210
|
+
const sep = zh ? ';' : '; '
|
|
211
|
+
const ageText = (age) => {
|
|
212
|
+
if (typeof age !== 'number' || !Number.isFinite(age)) return zh ? '刚才' : 'just now'
|
|
213
|
+
return age < 1 ? (zh ? '不到 1' : 'under 1') : String(Math.round(age))
|
|
214
|
+
}
|
|
215
|
+
return {
|
|
216
|
+
raw: (msg) => String(msg ?? ''),
|
|
217
|
+
uncomparable: () => (zh ? '版本号无法比较' : 'Versions are not comparable'),
|
|
218
|
+
latest: () => (zh ? '已经是最新' : 'Already up to date'),
|
|
219
|
+
prerelease: () => (zh ? '是预发布版本,未允许' : 'Prerelease, not allowed'),
|
|
220
|
+
major: (from, to) => (zh ? `跨大版本(${from} -> ${to}),未允许` : `Major version change (${from} -> ${to}), not allowed`),
|
|
221
|
+
noTag: (tag) => (zh ? `没有 ${tag} 标签` : `No ${tag} tag`),
|
|
222
|
+
noInstalled: () => (zh ? '读不到已装版本' : 'Installed version unreadable'),
|
|
223
|
+
suppressed: (stamp) => (zh ? `上次安装失败,${stamp} UTC 前不再重试` : `Install failed before; not retried until ${stamp} UTC`),
|
|
224
|
+
lookupFailed: (msg) => (zh ? `查不到:${msg}` : `Lookup failed: ${msg}`),
|
|
225
|
+
agentsBusy: (n) => (zh ? `${n} 个子任务在跑` : `${n} subagent(s) running`),
|
|
226
|
+
sessionActive: (age) => (zh ? `会话在 ${ageText(age)} 分钟前还在写入` : `Session was written ${ageText(age)} min ago`),
|
|
227
|
+
noDeps: () => (zh ? '这个 profile 里没有可检查的依赖' : 'No dependencies to check in this profile'),
|
|
228
|
+
noUpdates: () => (zh ? '没有可更新的插件' : 'No updatable plugins'),
|
|
229
|
+
checkOnly: () => (zh ? '只查不装' : 'Check only'),
|
|
230
|
+
gated: (reasons) => (zh
|
|
231
|
+
? `${listOf(reasons, sep)},这一轮不安装`
|
|
232
|
+
: `${listOf(reasons, sep)} — not installing this cycle`),
|
|
233
|
+
noCli: () => (zh ? '找不到 dsh 命令行入口,无法安装' : 'dsh CLI entry not found; cannot install'),
|
|
234
|
+
noneInstalled: () => (zh ? '一个包都没装成' : 'No package installed successfully'),
|
|
235
|
+
installedRestart: (n) => (zh ? `已安装 ${n} 个,待重启` : `Installed ${n}; restart pending`),
|
|
236
|
+
installedNoHot: (n) => (zh ? `已安装 ${n} 个,未热生效` : `Installed ${n}; not applied in place`),
|
|
237
|
+
installedWith: (n, reason) => (zh ? `已安装 ${n} 个;${reason}` : `Installed ${n}; ${reason}`),
|
|
238
|
+
reloadUnavailable: () => (zh ? '这里没有能换插件的服务,已装好但要重启才生效' : 'No hot-reload service here; installed, applies after restart'),
|
|
239
|
+
reloadApplying: () => (zh ? '换代码还没结束,稍后再看一次' : 'Hot apply still running; check again shortly'),
|
|
240
|
+
reloadQueued: () => (zh ? '换代码还在排队,稍后再看一次' : 'Hot apply still queued; check again shortly'),
|
|
241
|
+
reloadDone: () => (zh ? '插件已换好,界面没重开' : 'Plugins swapped; page not reloaded'),
|
|
242
|
+
reloadOff: () => (zh ? '装好了,热生效是关的,重启后生效' : 'Installed; in-place apply is off, applies after restart'),
|
|
243
|
+
reloadCancelled: () => (zh ? '安装期间有子任务开跑,这一次不换代码' : 'A subagent started during install; not swapping code'),
|
|
244
|
+
rollbackRestart: () => (zh ? '回滚完成,重启后生效' : 'Rollback done; applies after restart'),
|
|
245
|
+
lockHeld: (holder, age) => (zh
|
|
246
|
+
? `另一个进程正在装(${holder || '看不见持有者'}${typeof age === 'number' ? `,${age} 分钟前` : ''})`
|
|
247
|
+
: `Another process is installing (${holder || 'holder unknown'}${typeof age === 'number' ? `, ${age} min ago` : ''})`),
|
|
248
|
+
lockFailed: (msg) => (zh ? `抢锁失败:${msg}` : `Could not take the install lock: ${msg}`),
|
|
249
|
+
rollbackNoRecord: (name) => (zh ? `没有可回滚的记录:${name}` : `Nothing to roll back: ${name}`),
|
|
250
|
+
runBusy: () => (zh ? '上一轮还没跑完' : 'The previous cycle is still running'),
|
|
251
|
+
neverRun: () => (zh ? '还没跑过' : 'Never run'),
|
|
252
|
+
lastSummary: (at, reason) => (zh ? `上一次:${at};${reason}` : `Last run: ${at}; ${reason}`),
|
|
253
|
+
stateBroken: () => (zh ? '没能完成,插件状态需要核对' : 'Did not finish; plugin state needs a check'),
|
|
254
|
+
alreadyRunning: () => (zh ? '已经有一轮在跑' : 'A cycle is already running'),
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const REASON_TEMPLATES = { zh: makeReasonTemplates('zh'), en: makeReasonTemplates('en') }
|
|
259
|
+
|
|
260
|
+
function listOf(value, sep) {
|
|
261
|
+
if (Array.isArray(value)) return value.filter((item) => item !== '').join(sep)
|
|
262
|
+
return value === undefined || value === null ? '' : String(value)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** 把参数里的原因对象就地翻成文字;数组要深挖,原因里可能嵌着原因。 */
|
|
266
|
+
function localizeArg(value, lang) {
|
|
267
|
+
if (Array.isArray(value)) return value.map((item) => localizeArg(item, lang))
|
|
268
|
+
if (value !== null && typeof value === 'object') {
|
|
269
|
+
if (typeof value.code === 'string') return renderReason(value, lang)
|
|
270
|
+
return value
|
|
271
|
+
}
|
|
272
|
+
return value
|
|
99
273
|
}
|
|
100
274
|
|
|
101
|
-
/**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
275
|
+
/**
|
|
276
|
+
* 渲染一条原因。字符串原样返回——那是我们翻译不了的自由文本。
|
|
277
|
+
*/
|
|
278
|
+
function renderReason(value, lang) {
|
|
279
|
+
if (value === null || value === undefined) return ''
|
|
280
|
+
if (typeof value === 'string') return value
|
|
281
|
+
if (typeof value !== 'object') return String(value)
|
|
282
|
+
const code = typeof value.code === 'string' ? value.code : ''
|
|
283
|
+
const table = REASON_TEMPLATES[logLangOf(lang)]
|
|
284
|
+
const render = table[code]
|
|
285
|
+
const args = Array.isArray(value.args) ? value.args.map((item) => localizeArg(item, lang)) : []
|
|
286
|
+
if (typeof render !== 'function') return '[' + code + '] ' + args.join(' ')
|
|
287
|
+
try {
|
|
288
|
+
return render(...args)
|
|
289
|
+
} catch {
|
|
290
|
+
return '[' + code + '] ' + args.join(' ')
|
|
291
|
+
}
|
|
109
292
|
}
|
|
110
293
|
|
|
111
|
-
|
|
112
|
-
|
|
294
|
+
/** 只认 zh / en;其余(含 undefined)按中文渲染。 */
|
|
295
|
+
function logLangOf(choice) {
|
|
296
|
+
return choice === 'en' ? 'en' : 'zh'
|
|
113
297
|
}
|
|
114
298
|
|
|
115
|
-
|
|
116
|
-
|
|
299
|
+
/** 渲染一条日志。认不出的 code 退化成一串参数,至少不丢信息。 */
|
|
300
|
+
function renderLogEntry(code, args, lang) {
|
|
301
|
+
const table = LOG_TEMPLATES[logLangOf(lang)]
|
|
302
|
+
// 参数里可能塞着原因对象(例如 skipInstall 的 why),先翻成文字再套模板。
|
|
303
|
+
const values = (Array.isArray(args) ? args : []).map((item) => localizeArg(item, lang))
|
|
304
|
+
const render = table[String(code)]
|
|
305
|
+
if (typeof render !== 'function') return '[' + String(code) + '] ' + values.join(' ')
|
|
306
|
+
try {
|
|
307
|
+
return render(...values)
|
|
308
|
+
} catch {
|
|
309
|
+
return '[' + String(code) + '] ' + values.join(' ')
|
|
310
|
+
}
|
|
117
311
|
}
|
|
118
312
|
|
|
119
|
-
|
|
313
|
+
/**
|
|
314
|
+
* 写一条日志。
|
|
315
|
+
*
|
|
316
|
+
* @param code 模板名(见 makeLogTemplates),不是成品句子。
|
|
317
|
+
* @param args 模板参数;自由文本走 raw。
|
|
318
|
+
*/
|
|
319
|
+
function writeLog(code, args = []) {
|
|
320
|
+
const values = Array.isArray(args) ? args : []
|
|
120
321
|
try {
|
|
121
|
-
|
|
322
|
+
// 控制台固定中文:那是给开发者看的,跟界面语言无关。
|
|
323
|
+
console.log('[dsh-aupdate] ' + oneLine(renderLogEntry(code, values, 'zh'), 400))
|
|
122
324
|
} catch {}
|
|
123
325
|
try {
|
|
124
|
-
logQueue.push('[' + new Date().toISOString() + '] ' + oneLine(
|
|
326
|
+
logQueue.push('[' + new Date().toISOString() + '] ' + oneLine(JSON.stringify([String(code), ...values])) + '\n')
|
|
125
327
|
// 队列异常长说明写盘一直失败,直接丢掉最老的,避免吃内存。
|
|
126
328
|
if (logQueue.length > 500) logQueue = logQueue.slice(-500)
|
|
127
329
|
if (!logFlushing) {
|
|
@@ -149,7 +351,7 @@ const LOG_TAIL_MAX_LINES = 1000
|
|
|
149
351
|
* 面板里却没有这一行」——差的就是 setImmediate 那一拍。
|
|
150
352
|
* 读不到不算错误:可能从没跑过检查,也可能用户把文件删了。
|
|
151
353
|
*/
|
|
152
|
-
function readLogTail(limit) {
|
|
354
|
+
function readLogTail(limit, lang) {
|
|
153
355
|
try {
|
|
154
356
|
flushLogNow()
|
|
155
357
|
} catch {}
|
|
@@ -165,9 +367,24 @@ function readLogTail(limit) {
|
|
|
165
367
|
// 每个进程都会补换行,split 后末尾必然多一个空串。
|
|
166
368
|
if (all.length > 0 && all[all.length - 1] === '') all.pop()
|
|
167
369
|
const rows = []
|
|
370
|
+
const wanted = logLangOf(lang)
|
|
168
371
|
for (const line of all.slice(-want)) {
|
|
169
372
|
const match = /^\[([^\]]+)\] ([\s\S]*)$/u.exec(line)
|
|
170
|
-
|
|
373
|
+
if (match === null) {
|
|
374
|
+
rows.push({ at: '', text: line })
|
|
375
|
+
continue
|
|
376
|
+
}
|
|
377
|
+
const body = match[2]
|
|
378
|
+
// 新格式是 JSON 数组;0.6.1 及更早写的是成品句子,解析不出就原样显示。
|
|
379
|
+
let parsed = null
|
|
380
|
+
if (body.startsWith('[')) {
|
|
381
|
+
try { parsed = JSON.parse(body) } catch {}
|
|
382
|
+
}
|
|
383
|
+
if (Array.isArray(parsed) && typeof parsed[0] === 'string') {
|
|
384
|
+
rows.push({ at: match[1], text: renderLogEntry(parsed[0], parsed.slice(1), wanted) })
|
|
385
|
+
} else {
|
|
386
|
+
rows.push({ at: match[1], text: body })
|
|
387
|
+
}
|
|
171
388
|
}
|
|
172
389
|
let size = 0
|
|
173
390
|
try {
|
|
@@ -546,7 +763,10 @@ function readLastRun() {
|
|
|
546
763
|
updates: textList(raw.updates),
|
|
547
764
|
installed: textList(raw.installed),
|
|
548
765
|
reload: typeof raw.reload === 'string' ? raw.reload : 'none',
|
|
549
|
-
|
|
766
|
+
// 0.6.2 及更早存的是句子;0.6.3 起是 { code, args },两种都要能读。
|
|
767
|
+
reason: typeof raw.reason === 'string'
|
|
768
|
+
? raw.reason
|
|
769
|
+
: (raw.reason !== null && typeof raw.reason === 'object' ? raw.reason : ''),
|
|
550
770
|
snapshot: typeof raw.snapshot === 'string' ? raw.snapshot : '',
|
|
551
771
|
}
|
|
552
772
|
}
|
|
@@ -716,15 +936,15 @@ function suppressedUntil(pkgName, version, settings, now) {
|
|
|
716
936
|
function upgradeVerdict(target, current, tag, settings) {
|
|
717
937
|
const a = parseVersion(target)
|
|
718
938
|
const b = parseVersion(current)
|
|
719
|
-
if (a === null || b === null) return { ok: false, why: '
|
|
720
|
-
if (compareVersions(target, current) <= 0) return { ok: false, why: '
|
|
939
|
+
if (a === null || b === null) return { ok: false, code: 'uncomparable', why: { code: 'uncomparable' } }
|
|
940
|
+
if (compareVersions(target, current) <= 0) return { ok: false, code: 'latest', why: { code: 'latest' } }
|
|
721
941
|
// parseVersion 对正式版返回的是空数组而不是 null,判空得看长度。
|
|
722
942
|
if (a.pre.length > 0 && tag !== 'next' && !settings.allowPrerelease) {
|
|
723
|
-
return { ok: false, why: '
|
|
943
|
+
return { ok: false, code: 'prerelease', why: { code: 'prerelease' } }
|
|
724
944
|
}
|
|
725
945
|
// 版本段存在 core 里:core[0] 是主版本。
|
|
726
946
|
if (!settings.allowMajor && a.core[0] !== b.core[0]) {
|
|
727
|
-
return { ok: false, why: '
|
|
947
|
+
return { ok: false, code: 'major', why: { code: 'major', args: [b.core[0], a.core[0]] } }
|
|
728
948
|
}
|
|
729
949
|
return { ok: true }
|
|
730
950
|
}
|
|
@@ -1082,11 +1302,11 @@ function sessionAgeMinutes(now, root = null) {
|
|
|
1082
1302
|
function activityReasons(ctx, now, idleMinutes) {
|
|
1083
1303
|
const reasons = []
|
|
1084
1304
|
const agents = runningSubagents(ctx)
|
|
1085
|
-
if (agents.length > 0) reasons.push(agents.length
|
|
1305
|
+
if (agents.length > 0) reasons.push({ code: 'agentsBusy', args: [agents.length] })
|
|
1086
1306
|
if (!(idleMinutes > 0)) return reasons
|
|
1087
1307
|
const age = sessionAgeMinutes(now)
|
|
1088
1308
|
if (age !== null && age < idleMinutes) {
|
|
1089
|
-
reasons.push(
|
|
1309
|
+
reasons.push({ code: 'sessionActive', args: [age] })
|
|
1090
1310
|
}
|
|
1091
1311
|
return reasons
|
|
1092
1312
|
}
|
|
@@ -1137,7 +1357,7 @@ function snapshotProfile(profileDir, now) {
|
|
|
1137
1357
|
return { dir, files: saved }
|
|
1138
1358
|
} catch (error) {
|
|
1139
1359
|
// 留底失败不该拦住更新本身:它只是事后证据,不是前置条件。
|
|
1140
|
-
writeLog('
|
|
1360
|
+
writeLog('snapshotFailed', [oneLine(error?.message ?? error, 200)])
|
|
1141
1361
|
return null
|
|
1142
1362
|
}
|
|
1143
1363
|
}
|
|
@@ -1175,7 +1395,7 @@ function takeProfileLock(profileDir, now) {
|
|
|
1175
1395
|
writeFileSync(file, stamp + '\n', { encoding: 'utf8', flag: 'wx' })
|
|
1176
1396
|
return { ok: true, file }
|
|
1177
1397
|
} catch (error) {
|
|
1178
|
-
if (error?.code !== 'EEXIST') return { ok: false, reason: oneLine(error?.message ?? error, 160) }
|
|
1398
|
+
if (error?.code !== 'EEXIST') return { ok: false, reason: { code: 'lockFailed', args: [oneLine(error?.message ?? error, 160)] } }
|
|
1179
1399
|
}
|
|
1180
1400
|
// 锁已存在:只有确认它过期(持有者崩了)才接管,否则老老实实让开。
|
|
1181
1401
|
let ageMinutes = null
|
|
@@ -1187,8 +1407,7 @@ function takeProfileLock(profileDir, now) {
|
|
|
1187
1407
|
if (ageMinutes === null || ageMinutes * 60000 <= LOCK_STALE_MS) {
|
|
1188
1408
|
return {
|
|
1189
1409
|
ok: false,
|
|
1190
|
-
reason:
|
|
1191
|
-
+ (ageMinutes === null ? '' : ',' + ageMinutes + ' 分钟前') + ')',
|
|
1410
|
+
reason: { code: 'lockHeld', args: [lockHolder(file), ageMinutes] },
|
|
1192
1411
|
}
|
|
1193
1412
|
}
|
|
1194
1413
|
try {
|
|
@@ -1196,10 +1415,10 @@ function takeProfileLock(profileDir, now) {
|
|
|
1196
1415
|
} catch {}
|
|
1197
1416
|
try {
|
|
1198
1417
|
writeFileSync(file, stamp + '\n', { encoding: 'utf8', flag: 'wx' })
|
|
1199
|
-
writeLog('
|
|
1418
|
+
writeLog('tookOverLock', [ageMinutes])
|
|
1200
1419
|
return { ok: true, file }
|
|
1201
1420
|
} catch (error) {
|
|
1202
|
-
return { ok: false, reason: '
|
|
1421
|
+
return { ok: false, reason: { code: 'lockFailed', args: [oneLine(error?.message ?? error, 160)] } }
|
|
1203
1422
|
}
|
|
1204
1423
|
}
|
|
1205
1424
|
|
|
@@ -1250,7 +1469,7 @@ function activeEntryIds(ctx) {
|
|
|
1250
1469
|
async function hotApply(ctx, requiredBefore) {
|
|
1251
1470
|
const hmr = serviceOf(ctx, 'hmr')
|
|
1252
1471
|
if (hmr === null || typeof hmr.reconcileProfile !== 'function' || typeof hmr.runExclusive !== 'function') {
|
|
1253
|
-
return { status: 'unavailable', reason: '
|
|
1472
|
+
return { status: 'unavailable', reason: { code: 'reloadUnavailable' } }
|
|
1254
1473
|
}
|
|
1255
1474
|
const context = transactionContext(hmr)
|
|
1256
1475
|
const baseline = requiredBefore.filter((id) => id !== name)
|
|
@@ -1270,14 +1489,14 @@ async function hotApply(ctx, requiredBefore) {
|
|
|
1270
1489
|
for (let attempt = 0; ; attempt += 1) {
|
|
1271
1490
|
try {
|
|
1272
1491
|
result = await Promise.race([run(), timeout])
|
|
1273
|
-
if (timedOut) return { status: 'applying', reason: '
|
|
1492
|
+
if (timedOut) return { status: 'applying', reason: { code: 'reloadApplying' } }
|
|
1274
1493
|
break
|
|
1275
1494
|
} catch (error) {
|
|
1276
1495
|
if (isNestedTransaction(error) && attempt < 9) {
|
|
1277
1496
|
await new Promise((resolvePromise) => {
|
|
1278
1497
|
setTimeout(resolvePromise, 250 * (attempt + 1))
|
|
1279
1498
|
})
|
|
1280
|
-
if (timedOut) return { status: 'applying', reason: '
|
|
1499
|
+
if (timedOut) return { status: 'applying', reason: { code: 'reloadQueued' } }
|
|
1281
1500
|
continue
|
|
1282
1501
|
}
|
|
1283
1502
|
throw error
|
|
@@ -1287,7 +1506,7 @@ async function hotApply(ctx, requiredBefore) {
|
|
|
1287
1506
|
const restartReason = typeof result?.restartReason === 'string' ? result.restartReason : null
|
|
1288
1507
|
if (restartReason !== null) return { status: 'restart', reason: oneLine(restartReason, 400), warnings }
|
|
1289
1508
|
if (warnings.length > 0) return { status: 'blocked', reason: oneLine(warnings[0], 400), warnings }
|
|
1290
|
-
return { status: 'done', reason: '
|
|
1509
|
+
return { status: 'done', reason: { code: 'reloadDone' }, warnings }
|
|
1291
1510
|
} catch (error) {
|
|
1292
1511
|
return { status: 'failed', reason: oneLine(error?.message ?? error, 400) }
|
|
1293
1512
|
}
|
|
@@ -1321,7 +1540,7 @@ async function runCycle(mode, ctxRef) {
|
|
|
1321
1540
|
const deps = dependencyList(profileDir, settings.exclude)
|
|
1322
1541
|
report.checked = deps.length
|
|
1323
1542
|
if (deps.length === 0) {
|
|
1324
|
-
report.reason =
|
|
1543
|
+
report.reason = { code: 'noDeps' }
|
|
1325
1544
|
return report
|
|
1326
1545
|
}
|
|
1327
1546
|
for (let i = 0; i < deps.length; i += FETCH_CONCURRENCY) {
|
|
@@ -1335,12 +1554,12 @@ async function runCycle(mode, ctxRef) {
|
|
|
1335
1554
|
const tags = await registryTags(dep.name)
|
|
1336
1555
|
const tag = distTagFor(dep.name)
|
|
1337
1556
|
const target = typeof tags[tag] === 'string' ? tags[tag] : null
|
|
1338
|
-
if (target === null) return { name: dep.name, current, why:
|
|
1339
|
-
if (current === null) return { name: dep.name, current, why: '
|
|
1557
|
+
if (target === null) return { name: dep.name, current, why: { code: 'noTag', args: [tag] } }
|
|
1558
|
+
if (current === null) return { name: dep.name, current, why: { code: 'noInstalled' } }
|
|
1340
1559
|
const verdict = upgradeVerdict(target, current, tag, settings)
|
|
1341
1560
|
if (!verdict.ok) {
|
|
1342
1561
|
// 「已经是最新」不算异常,不必出现在 skipped 里。
|
|
1343
|
-
if (verdict.
|
|
1562
|
+
if (verdict.code === 'latest') return null
|
|
1344
1563
|
return { name: dep.name, current, target, why: verdict.why }
|
|
1345
1564
|
}
|
|
1346
1565
|
// 这个版本之前装失败过、还在抑制窗口内:这一轮不再试它。
|
|
@@ -1352,12 +1571,12 @@ async function runCycle(mode, ctxRef) {
|
|
|
1352
1571
|
target,
|
|
1353
1572
|
// 这里是服务端拼的纯文本,拿不到浏览器时区,所以显式写 UTC,
|
|
1354
1573
|
// 免得把一个 UTC 时刻当成本地时间读。
|
|
1355
|
-
why: '
|
|
1574
|
+
why: { code: 'suppressed', args: [until.toISOString().slice(0, 16).replace('T', ' ')] },
|
|
1356
1575
|
}
|
|
1357
1576
|
}
|
|
1358
1577
|
return { name: dep.name, current, target, tag }
|
|
1359
1578
|
} catch (error) {
|
|
1360
|
-
return { name: dep.name, current, why: '
|
|
1579
|
+
return { name: dep.name, current, why: { code: 'lookupFailed', args: [oneLine(error?.message ?? error, 120)] } }
|
|
1361
1580
|
}
|
|
1362
1581
|
}))
|
|
1363
1582
|
for (const answer of answers) {
|
|
@@ -1366,9 +1585,9 @@ async function runCycle(mode, ctxRef) {
|
|
|
1366
1585
|
else report.skipped.push(answer)
|
|
1367
1586
|
}
|
|
1368
1587
|
}
|
|
1369
|
-
writeLog('
|
|
1588
|
+
writeLog('checked', [report.checked, report.updates.length])
|
|
1370
1589
|
if (report.updates.length === 0) {
|
|
1371
|
-
report.reason = '
|
|
1590
|
+
report.reason = { code: 'noUpdates' }
|
|
1372
1591
|
return report
|
|
1373
1592
|
}
|
|
1374
1593
|
// 单轮上限:装包会一直占着 pnpm 锁,一轮装 20 个能把 profile 占住几十分钟。
|
|
@@ -1376,10 +1595,10 @@ async function runCycle(mode, ctxRef) {
|
|
|
1376
1595
|
const deferred = settings.maxPerCycle > 0 ? report.updates.length - settings.maxPerCycle : 0
|
|
1377
1596
|
if (deferred > 0) {
|
|
1378
1597
|
report.updates = report.updates.slice(0, settings.maxPerCycle)
|
|
1379
|
-
writeLog('
|
|
1598
|
+
writeLog('capped', [settings.maxPerCycle, deferred])
|
|
1380
1599
|
}
|
|
1381
1600
|
if (mode === 'check' || !settings.autoApply) {
|
|
1382
|
-
report.reason = '
|
|
1601
|
+
report.reason = { code: 'checkOnly' }
|
|
1383
1602
|
return report
|
|
1384
1603
|
}
|
|
1385
1604
|
// 空闲门槛:装包会常驻占住 pnpm 并让界面变卡,换代码会把子任务中止。
|
|
@@ -1390,15 +1609,15 @@ async function runCycle(mode, ctxRef) {
|
|
|
1390
1609
|
const why = activityReasons(ctxRef.ctx, new Date(), idleWindow)
|
|
1391
1610
|
if (why.length > 0) {
|
|
1392
1611
|
report.status = 'blocked'
|
|
1393
|
-
report.reason =
|
|
1394
|
-
writeLog('
|
|
1612
|
+
report.reason = { code: 'gated', args: [why] }
|
|
1613
|
+
writeLog('skipInstall', [why])
|
|
1395
1614
|
return report
|
|
1396
1615
|
}
|
|
1397
1616
|
}
|
|
1398
1617
|
const runner = cliRunner()
|
|
1399
1618
|
if (runner === null) {
|
|
1400
1619
|
report.status = 'failed'
|
|
1401
|
-
report.reason =
|
|
1620
|
+
report.reason = { code: 'noCli' }
|
|
1402
1621
|
return report
|
|
1403
1622
|
}
|
|
1404
1623
|
// 进程内的 running 管得住自己的两轮,管不住别的进程;pnpm 的锁是按 profile 算的。
|
|
@@ -1406,7 +1625,7 @@ async function runCycle(mode, ctxRef) {
|
|
|
1406
1625
|
if (!lock.ok) {
|
|
1407
1626
|
report.status = 'blocked'
|
|
1408
1627
|
report.reason = lock.reason
|
|
1409
|
-
writeLog('
|
|
1628
|
+
writeLog('skipInstall', [lock.reason])
|
|
1410
1629
|
return report
|
|
1411
1630
|
}
|
|
1412
1631
|
try {
|
|
@@ -1414,7 +1633,7 @@ async function runCycle(mode, ctxRef) {
|
|
|
1414
1633
|
const snapshot = snapshotProfile(profileDir, new Date())
|
|
1415
1634
|
if (snapshot !== null) {
|
|
1416
1635
|
report.snapshot = snapshot.dir
|
|
1417
|
-
writeLog('
|
|
1636
|
+
writeLog('snapshotTaken', [snapshot.dir, snapshot.files])
|
|
1418
1637
|
}
|
|
1419
1638
|
return await applyUpdates(ctxRef, report, settings, runner, profileDir, profileName)
|
|
1420
1639
|
} finally {
|
|
@@ -1422,8 +1641,8 @@ async function runCycle(mode, ctxRef) {
|
|
|
1422
1641
|
}
|
|
1423
1642
|
} catch (error) {
|
|
1424
1643
|
report.status = 'failed'
|
|
1425
|
-
report.reason = oneLine(error?.message ?? error, 400)
|
|
1426
|
-
writeLog('
|
|
1644
|
+
report.reason = { code: 'raw', args: [oneLine(error?.message ?? error, 400)] }
|
|
1645
|
+
writeLog('cycleFailed', [report.reason])
|
|
1427
1646
|
return report
|
|
1428
1647
|
} finally {
|
|
1429
1648
|
report.finishedAt = new Date().toISOString()
|
|
@@ -1432,7 +1651,7 @@ async function runCycle(mode, ctxRef) {
|
|
|
1432
1651
|
at: report.finishedAt,
|
|
1433
1652
|
checked: report.checked,
|
|
1434
1653
|
updates: report.updates.map((item) => item.name + ' ' + (item.current ?? '?') + ' -> ' + item.target),
|
|
1435
|
-
installed: report.installed.map((item) => item.name + '@' + item.version + (item.ok ? '' : '
|
|
1654
|
+
installed: report.installed.map((item) => item.name + '@' + item.version + (item.ok ? '' : ' !failed')),
|
|
1436
1655
|
reload: report.reload?.status ?? 'none',
|
|
1437
1656
|
reason: report.reason,
|
|
1438
1657
|
snapshot: report.snapshot,
|
|
@@ -1452,7 +1671,7 @@ async function applyUpdates(ctxRef, report, settings, runner, profileDir, profil
|
|
|
1452
1671
|
for (const update of ordered) {
|
|
1453
1672
|
const outcome = await installOne(runner, profileName, profileDir, update.name, update.target)
|
|
1454
1673
|
report.installed.push(outcome)
|
|
1455
|
-
writeLog('
|
|
1674
|
+
writeLog('install', [update.name, update.target, outcome.ok === true, outcome.detail ?? ''])
|
|
1456
1675
|
if (outcome.ok) {
|
|
1457
1676
|
clearFailure(update.name, update.target)
|
|
1458
1677
|
appendHistory({
|
|
@@ -1472,25 +1691,25 @@ async function applyUpdates(ctxRef, report, settings, runner, profileDir, profil
|
|
|
1472
1691
|
const okCount = report.installed.filter((item) => item.ok).length
|
|
1473
1692
|
if (okCount === 0) {
|
|
1474
1693
|
report.status = 'failed'
|
|
1475
|
-
report.reason = '
|
|
1694
|
+
report.reason = { code: 'noneInstalled' }
|
|
1476
1695
|
return report
|
|
1477
1696
|
}
|
|
1478
1697
|
if (!settings.hotReload) {
|
|
1479
|
-
report.reload = { status: 'skipped', reason: '
|
|
1480
|
-
report.reason =
|
|
1698
|
+
report.reload = { status: 'skipped', reason: { code: 'reloadOff' } }
|
|
1699
|
+
report.reason = { code: 'installedRestart', args: [okCount] }
|
|
1481
1700
|
return report
|
|
1482
1701
|
}
|
|
1483
1702
|
// 装完之后再确认一次:安装可能耗时几分钟,期间可能有人开了子任务。
|
|
1484
1703
|
// 这里只看子任务,不看会话写入——换代码不会打断正在打字的用户,
|
|
1485
1704
|
// 但会因为「刚有写入」就放弃热生效,让装好的东西白等一次重启。
|
|
1486
1705
|
if (settings.idleOnly && runningSubagents(ctxRef.ctx).length > 0) {
|
|
1487
|
-
report.reload = { status: 'cancelled', reason: '
|
|
1488
|
-
report.reason =
|
|
1706
|
+
report.reload = { status: 'cancelled', reason: { code: 'reloadCancelled' } }
|
|
1707
|
+
report.reason = { code: 'installedNoHot', args: [okCount] }
|
|
1489
1708
|
return report
|
|
1490
1709
|
}
|
|
1491
1710
|
report.reload = await hotApply(ctxRef.ctx, requiredBefore)
|
|
1492
|
-
writeLog('
|
|
1493
|
-
report.reason =
|
|
1711
|
+
writeLog('hotApply', [report.reload.status, report.reload.reason ?? ''])
|
|
1712
|
+
report.reason = { code: 'installedWith', args: [okCount, report.reload.reason] }
|
|
1494
1713
|
if (report.reload.status === 'failed') report.status = 'failed'
|
|
1495
1714
|
else if (report.reload.status === 'blocked' || report.reload.status === 'restart') report.status = 'partial'
|
|
1496
1715
|
return report
|
|
@@ -1537,11 +1756,11 @@ async function rollbackOne(ctxRef, entryName) {
|
|
|
1537
1756
|
const settings = settingsOf(ctxRef.config)
|
|
1538
1757
|
const rows = readHistory()
|
|
1539
1758
|
const row = pickRollbackTarget(rows, entryName)
|
|
1540
|
-
if (row === undefined) return { ok: false, reason: '
|
|
1759
|
+
if (row === undefined) return { ok: false, reason: { code: 'rollbackNoRecord', args: [entryName] } }
|
|
1541
1760
|
const profileDir = profileDirOf(ctxRef.ctx)
|
|
1542
1761
|
const profileName = basename(profileDir)
|
|
1543
1762
|
const runner = cliRunner()
|
|
1544
|
-
if (runner === null) return { ok: false, reason:
|
|
1763
|
+
if (runner === null) return { ok: false, reason: { code: 'noCli' } }
|
|
1545
1764
|
// 回滚也是一次 pnpm 安装,和定时轮次抢同一把 profile 锁。
|
|
1546
1765
|
// 拿不到就明确告诉用户「有别的进程在装」,而不是让两个 pnpm 撞锁报 EPERM。
|
|
1547
1766
|
const lock = takeProfileLock(profileDir, new Date())
|
|
@@ -1552,7 +1771,7 @@ async function rollbackOne(ctxRef, entryName) {
|
|
|
1552
1771
|
} finally {
|
|
1553
1772
|
releaseProfileLock(lock)
|
|
1554
1773
|
}
|
|
1555
|
-
writeLog('
|
|
1774
|
+
writeLog('rollback', [row.name, row.from, row.to, outcome.ok === true, outcome.detail ?? ''])
|
|
1556
1775
|
if (!outcome.ok) return { ok: false, reason: outcome.detail }
|
|
1557
1776
|
const next = rows.slice()
|
|
1558
1777
|
next.unshift({
|
|
@@ -1565,7 +1784,7 @@ async function rollbackOne(ctxRef, entryName) {
|
|
|
1565
1784
|
rolledBack: true,
|
|
1566
1785
|
})
|
|
1567
1786
|
saveHistory(next)
|
|
1568
|
-
let reload = { status: 'skipped', reason: '
|
|
1787
|
+
let reload = { status: 'skipped', reason: { code: 'rollbackRestart' } }
|
|
1569
1788
|
if (settings.hotReload) reload = await hotApply(ctxRef.ctx, [])
|
|
1570
1789
|
return { ok: true, name: row.name, to: row.from, reload: reload.status }
|
|
1571
1790
|
}
|
|
@@ -1575,7 +1794,7 @@ function registerTool(ctx, config) {
|
|
|
1575
1794
|
if (tools === null || typeof tools.register !== 'function') return false
|
|
1576
1795
|
const effect = propOf(ctx, 'effect')
|
|
1577
1796
|
if (typeof effect !== 'function') return false
|
|
1578
|
-
const empty = { status: 'busy', reason: '
|
|
1797
|
+
const empty = { status: 'busy', reason: { code: 'runBusy' }, checked: 0, updates: [], installed: [], reload: 'none' }
|
|
1579
1798
|
try {
|
|
1580
1799
|
effect.call(ctx, () => tools.register({
|
|
1581
1800
|
name: 'plugin_updater',
|
|
@@ -1607,17 +1826,22 @@ function registerTool(ctx, config) {
|
|
|
1607
1826
|
required: ['status'],
|
|
1608
1827
|
additionalProperties: false,
|
|
1609
1828
|
},
|
|
1610
|
-
render: (_args, value) => [{
|
|
1829
|
+
render: (_args, value) => [{
|
|
1830
|
+
type: 'text',
|
|
1831
|
+
text: (settingsOf(config).lang === 'en' ? 'Plugin update · ' : '插件更新 · ') + (value?.reason || value?.status || ''),
|
|
1832
|
+
}],
|
|
1611
1833
|
},
|
|
1612
1834
|
execute: async (args) => {
|
|
1613
1835
|
try {
|
|
1836
|
+
// 工具结果是给模型看的,也照设置里的语言出,别让 reason 变成 { code, args } 的裸 JSON。
|
|
1837
|
+
const lang = settingsOf(config).lang
|
|
1614
1838
|
const action = args?.action === 'check' || args?.action === 'update' ? args.action : 'status'
|
|
1615
1839
|
if (action === 'status') {
|
|
1616
1840
|
const seen = lastRun
|
|
1617
|
-
if (seen === null) return { status: 'done', reason: '
|
|
1841
|
+
if (seen === null) return { status: 'done', reason: renderReason({ code: 'neverRun' }, lang), checked: 0, updates: [], installed: [], reload: 'none' }
|
|
1618
1842
|
return {
|
|
1619
1843
|
status: seen.status,
|
|
1620
|
-
reason: '
|
|
1844
|
+
reason: renderReason({ code: 'lastSummary', args: [seen.at, seen.reason || seen.status] }, lang),
|
|
1621
1845
|
checked: seen.checked,
|
|
1622
1846
|
updates: seen.updates,
|
|
1623
1847
|
installed: seen.installed,
|
|
@@ -1625,25 +1849,29 @@ function registerTool(ctx, config) {
|
|
|
1625
1849
|
}
|
|
1626
1850
|
}
|
|
1627
1851
|
const report = await beginningRun(action, { ctx, config })
|
|
1628
|
-
if (report === null) return empty
|
|
1852
|
+
if (report === null) return { ...empty, reason: renderReason(empty.reason, lang) }
|
|
1629
1853
|
return {
|
|
1630
1854
|
status: report.status,
|
|
1631
|
-
reason: report.reason
|
|
1855
|
+
reason: renderReason(report.reason, lang),
|
|
1632
1856
|
checked: report.checked,
|
|
1633
1857
|
updates: report.updates.map((item) => item.name + ' ' + (item.current ?? '?') + ' -> ' + item.target),
|
|
1634
|
-
installed: report.installed.map((item) => item.name + '@' + item.version + (item.ok ? '' : '
|
|
1858
|
+
installed: report.installed.map((item) => item.name + '@' + item.version + (item.ok ? '' : ' !failed')),
|
|
1635
1859
|
reload: report.reload?.status ?? 'none',
|
|
1636
|
-
skipped: report.skipped.map((item) => item.name + ':' + item.why),
|
|
1860
|
+
skipped: report.skipped.map((item) => item.name + (lang === 'en' ? ': ' : ':') + renderReason(item.why, lang)),
|
|
1637
1861
|
}
|
|
1638
1862
|
} catch (error) {
|
|
1639
|
-
writeLog('
|
|
1640
|
-
return {
|
|
1863
|
+
writeLog('toolFailed', [oneLine(error?.message ?? error, 300)])
|
|
1864
|
+
return {
|
|
1865
|
+
status: 'failed',
|
|
1866
|
+
reason: renderReason({ code: 'stateBroken' }, settingsOf(config).lang),
|
|
1867
|
+
checked: 0, updates: [], installed: [], reload: 'none',
|
|
1868
|
+
}
|
|
1641
1869
|
}
|
|
1642
1870
|
},
|
|
1643
1871
|
}), 'dsh-aupdate: plugin_updater')
|
|
1644
1872
|
return true
|
|
1645
1873
|
} catch (error) {
|
|
1646
|
-
writeLog('
|
|
1874
|
+
writeLog('toolUnavailable', [oneLine(error?.message ?? error, 300)])
|
|
1647
1875
|
return false
|
|
1648
1876
|
}
|
|
1649
1877
|
}
|
|
@@ -1749,14 +1977,14 @@ function readBody(req) {
|
|
|
1749
1977
|
})
|
|
1750
1978
|
}
|
|
1751
1979
|
|
|
1752
|
-
function settingsSnapshot(config, ctxRef) {
|
|
1980
|
+
function settingsSnapshot(config, ctxRef, lang) {
|
|
1753
1981
|
const settings = settingsOf(config)
|
|
1754
1982
|
return {
|
|
1755
1983
|
settings,
|
|
1756
1984
|
overrides: readOverrides(),
|
|
1757
1985
|
lastRun: lastRun === null ? null : {
|
|
1758
1986
|
status: lastRun.status,
|
|
1759
|
-
reason: lastRun.reason,
|
|
1987
|
+
reason: renderReason(lastRun.reason, lang),
|
|
1760
1988
|
at: lastRun.at,
|
|
1761
1989
|
checked: lastRun.checked,
|
|
1762
1990
|
updates: lastRun.updates,
|
|
@@ -1831,11 +2059,11 @@ function registerRoutes(scope, ctxRef) {
|
|
|
1831
2059
|
const method = req.method ?? 'GET'
|
|
1832
2060
|
if (method === 'GET' || method === 'HEAD') {
|
|
1833
2061
|
if (suffix === '/state') {
|
|
1834
|
-
sendJson(res, 200, settingsSnapshot(ctxRef.config, ctxRef))
|
|
2062
|
+
sendJson(res, 200, settingsSnapshot(ctxRef.config, ctxRef, url.searchParams.get('lang')))
|
|
1835
2063
|
return
|
|
1836
2064
|
}
|
|
1837
2065
|
if (suffix === '/logs') {
|
|
1838
|
-
sendJson(res, 200, readLogTail(url.searchParams.get('lines')))
|
|
2066
|
+
sendJson(res, 200, readLogTail(url.searchParams.get('lines'), url.searchParams.get('lang')))
|
|
1839
2067
|
return
|
|
1840
2068
|
}
|
|
1841
2069
|
sendJson(res, 404, { error: 'unknown endpoint' })
|
|
@@ -1853,14 +2081,14 @@ function registerRoutes(scope, ctxRef) {
|
|
|
1853
2081
|
sendJson(res, 500, { error: result.error })
|
|
1854
2082
|
return
|
|
1855
2083
|
}
|
|
1856
|
-
writeLog('
|
|
2084
|
+
writeLog('settingsChanged', [Object.keys(body)])
|
|
1857
2085
|
// 改完立刻按新设置重排,否则要等下一次触发才换节奏。
|
|
1858
2086
|
try {
|
|
1859
2087
|
if (typeof ctxRef.reschedule === 'function') ctxRef.reschedule()
|
|
1860
2088
|
} catch (error) {
|
|
1861
|
-
writeLog('
|
|
2089
|
+
writeLog('rescheduleFailed', [oneLine(error?.message ?? error, 200)])
|
|
1862
2090
|
}
|
|
1863
|
-
sendJson(res, 200, settingsSnapshot(ctxRef.config, ctxRef))
|
|
2091
|
+
sendJson(res, 200, settingsSnapshot(ctxRef.config, ctxRef, url.searchParams.get('lang')))
|
|
1864
2092
|
return
|
|
1865
2093
|
}
|
|
1866
2094
|
if (suffix === '/rollback') {
|
|
@@ -1871,8 +2099,8 @@ function registerRoutes(scope, ctxRef) {
|
|
|
1871
2099
|
return
|
|
1872
2100
|
}
|
|
1873
2101
|
const outcome = await rollbackOne(ctxRef, target)
|
|
1874
|
-
writeLog('
|
|
1875
|
-
sendJson(res, outcome.ok ? 200 : 409, outcome)
|
|
2102
|
+
writeLog('rollbackRequest', [target, outcome.ok === true, outcome.reason ?? ''])
|
|
2103
|
+
sendJson(res, outcome.ok ? 200 : 409, { ...outcome, reason: renderReason(outcome.reason, url.searchParams.get('lang')) })
|
|
1876
2104
|
return
|
|
1877
2105
|
}
|
|
1878
2106
|
if (suffix === '/run') {
|
|
@@ -1880,10 +2108,10 @@ function registerRoutes(scope, ctxRef) {
|
|
|
1880
2108
|
const mode = body?.mode === 'check' ? 'check' : 'update'
|
|
1881
2109
|
const report = await beginningRun(mode, ctxRef)
|
|
1882
2110
|
if (report === null) {
|
|
1883
|
-
sendJson(res, 200, { started: false, reason: '
|
|
2111
|
+
sendJson(res, 200, { started: false, reason: renderReason({ code: 'alreadyRunning' }, url.searchParams.get('lang')) })
|
|
1884
2112
|
return
|
|
1885
2113
|
}
|
|
1886
|
-
sendJson(res, 200, { started: true, status: report.status, reason: report.reason })
|
|
2114
|
+
sendJson(res, 200, { started: true, status: report.status, reason: renderReason(report.reason, url.searchParams.get('lang')) })
|
|
1887
2115
|
return
|
|
1888
2116
|
}
|
|
1889
2117
|
sendJson(res, 404, { error: 'unknown endpoint' })
|
|
@@ -1891,7 +2119,7 @@ function registerRoutes(scope, ctxRef) {
|
|
|
1891
2119
|
}
|
|
1892
2120
|
sendJson(res, 405, { error: 'method not allowed' })
|
|
1893
2121
|
} catch (error) {
|
|
1894
|
-
writeLog('
|
|
2122
|
+
writeLog('routeFailed', [oneLine(error?.message ?? error, 300)])
|
|
1895
2123
|
try { sendJson(res, 500, { error: 'internal' }) } catch {}
|
|
1896
2124
|
}
|
|
1897
2125
|
}
|
|
@@ -1900,14 +2128,14 @@ function registerRoutes(scope, ctxRef) {
|
|
|
1900
2128
|
const register = () => webServer.register({ kind: 'prefix', path: ROUTE_PREFIX, handler })
|
|
1901
2129
|
if (typeof effect === 'function') {
|
|
1902
2130
|
effect.call(scope, register, 'dsh-aupdate: settings routes')
|
|
1903
|
-
writeLog('
|
|
2131
|
+
writeLog('routeReady', [ROUTE_PREFIX])
|
|
1904
2132
|
return true
|
|
1905
2133
|
}
|
|
1906
2134
|
register()
|
|
1907
|
-
writeLog('
|
|
2135
|
+
writeLog('routeReadyNoScope', [ROUTE_PREFIX])
|
|
1908
2136
|
return true
|
|
1909
2137
|
} catch (error) {
|
|
1910
|
-
writeLog('
|
|
2138
|
+
writeLog('routeRegisterFailed', [oneLine(error?.message ?? error, 300)])
|
|
1911
2139
|
return false
|
|
1912
2140
|
}
|
|
1913
2141
|
}
|
|
@@ -1926,15 +2154,15 @@ export function apply(ctx, config) {
|
|
|
1926
2154
|
try {
|
|
1927
2155
|
const tools = serviceOf(scope, 'tools')
|
|
1928
2156
|
if (tools === null || typeof tools.register !== 'function') {
|
|
1929
|
-
writeLog('
|
|
2157
|
+
writeLog('toolRegistered', [false])
|
|
1930
2158
|
return
|
|
1931
2159
|
}
|
|
1932
2160
|
if (toolService === tools) return
|
|
1933
2161
|
toolService = tools
|
|
1934
2162
|
const ok = registerTool(scope, config)
|
|
1935
|
-
writeLog('
|
|
2163
|
+
writeLog('toolRegistered', [ok === true])
|
|
1936
2164
|
} catch (error) {
|
|
1937
|
-
writeLog('
|
|
2165
|
+
writeLog('toolRegisterThrew', [oneLine(error?.message ?? error, 300)])
|
|
1938
2166
|
}
|
|
1939
2167
|
}
|
|
1940
2168
|
// 路由和工具是同一类问题:apply 执行时 webServer 可能还没就绪,
|
|
@@ -1944,14 +2172,14 @@ export function apply(ctx, config) {
|
|
|
1944
2172
|
try {
|
|
1945
2173
|
const webServer = serviceOf(scope, 'webServer')
|
|
1946
2174
|
if (webServer === null || typeof webServer.register !== 'function') {
|
|
1947
|
-
writeLog('
|
|
2175
|
+
writeLog('webServerMissing', [])
|
|
1948
2176
|
return
|
|
1949
2177
|
}
|
|
1950
2178
|
if (routeService === webServer) return
|
|
1951
2179
|
const ok = registerRoutes(scope, ctxRef)
|
|
1952
2180
|
if (ok) routeService = webServer
|
|
1953
2181
|
} catch (error) {
|
|
1954
|
-
writeLog('
|
|
2182
|
+
writeLog('routeRegisterThrew', [oneLine(error?.message ?? error, 300)])
|
|
1955
2183
|
}
|
|
1956
2184
|
}
|
|
1957
2185
|
const inject = propOf(ctx, 'inject')
|
|
@@ -1965,10 +2193,10 @@ export function apply(ctx, config) {
|
|
|
1965
2193
|
offerRoutes(scope)
|
|
1966
2194
|
})
|
|
1967
2195
|
Promise.resolve(fiber).catch((error) => {
|
|
1968
|
-
writeLog('
|
|
2196
|
+
writeLog('toolScopeEnded', [oneLine(error?.message ?? error, 300)])
|
|
1969
2197
|
})
|
|
1970
2198
|
} catch (error) {
|
|
1971
|
-
writeLog('
|
|
2199
|
+
writeLog('toolUnavailable', [oneLine(error?.message ?? error, 300)])
|
|
1972
2200
|
offerTool(ctx)
|
|
1973
2201
|
offerRoutes(ctx)
|
|
1974
2202
|
}
|
|
@@ -1981,9 +2209,9 @@ export function apply(ctx, config) {
|
|
|
1981
2209
|
const go = async () => {
|
|
1982
2210
|
try {
|
|
1983
2211
|
const report = await beginningRun(mode, ctxRef)
|
|
1984
|
-
if (report !== null) writeLog('
|
|
2212
|
+
if (report !== null) writeLog('cycle', [mode, report.status, report.reason])
|
|
1985
2213
|
} catch (error) {
|
|
1986
|
-
writeLog('
|
|
2214
|
+
writeLog('cycleThrew', [oneLine(error?.message ?? error, 300)])
|
|
1987
2215
|
}
|
|
1988
2216
|
}
|
|
1989
2217
|
void go()
|
|
@@ -2018,7 +2246,7 @@ export function apply(ctx, config) {
|
|
|
2018
2246
|
clearScheduled()
|
|
2019
2247
|
const live = settingsOf(ctxRef.config)
|
|
2020
2248
|
if (!live.enabled) {
|
|
2021
|
-
writeLog('
|
|
2249
|
+
writeLog('disabledBySettings', [])
|
|
2022
2250
|
return
|
|
2023
2251
|
}
|
|
2024
2252
|
// 启动后第一次仍然只看 firstDelayMinutes,之后按当前调度模式算。
|
|
@@ -2052,7 +2280,7 @@ export function apply(ctx, config) {
|
|
|
2052
2280
|
|
|
2053
2281
|
// 设置页要能读到运行状态并改设置,所以路由最后注册、且与 enabled 无关:
|
|
2054
2282
|
// 关掉定时检查之后,用户仍然要能看到这一页并把它重新打开。
|
|
2055
|
-
if (!settings.enabled) writeLog('
|
|
2283
|
+
if (!settings.enabled) writeLog('disabledByConfig', [])
|
|
2056
2284
|
|
|
2057
2285
|
const stop = () => {
|
|
2058
2286
|
for (const off of timers.splice(0)) {
|
|
@@ -2068,7 +2296,7 @@ export function apply(ctx, config) {
|
|
|
2068
2296
|
} catch {}
|
|
2069
2297
|
}
|
|
2070
2298
|
|
|
2071
|
-
writeLog('
|
|
2299
|
+
writeLog('ready', [settings.intervalMinutes, settings.autoApply === true, settings.hotReload === true])
|
|
2072
2300
|
}
|
|
2073
2301
|
|
|
2074
2302
|
|
package/package.json
CHANGED