sintbot 1.0.16 → 1.3.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.
Files changed (137) hide show
  1. package/CHANGELOG.en.json +99 -0
  2. package/CHANGELOG.json +99 -0
  3. package/README.md +20 -158
  4. package/README.zh-CN.md +20 -166
  5. package/THIRD-PARTY-NOTICES.md +394 -0
  6. package/bin/sintbot-v2.js +363 -0
  7. package/docs/AI-ASSISTED-INSTALL.md +11 -35
  8. package/docs/install.md +61 -167
  9. package/docs/zh-CN/AI-ASSISTED-INSTALL.md +11 -35
  10. package/docs/zh-CN/install.md +61 -165
  11. package/install.sh +84 -0
  12. package/package.json +73 -37
  13. package/src/agent/claudecode.js +149 -108
  14. package/src/agent/codexapp.js +458 -0
  15. package/src/agent/codexcode.js +210 -107
  16. package/src/agent/errtag.js +34 -0
  17. package/src/agent/privatecore.js +790 -0
  18. package/src/agent/privatecore.wasm +0 -0
  19. package/src/agent/runner.js +10 -8
  20. package/src/agent/winexec.js +35 -5
  21. package/src/c2install.js +117 -0
  22. package/src/config.js +2 -1
  23. package/src/core/c2cardeffectbridge.js +51 -0
  24. package/src/core/c2cardterminalpath.js +216 -0
  25. package/src/core/c2durableingress.js +148 -0
  26. package/src/core/c2durablejournal.js +1560 -0
  27. package/src/core/c2durableruntime.js +2361 -0
  28. package/src/core/c2eventidentity.js +90 -0
  29. package/src/core/c2globalfault.js +401 -0
  30. package/src/core/c2localeffectexecutor.js +193 -0
  31. package/src/core/c2payloadhandles.js +333 -0
  32. package/src/core/c2persistrelation.js +179 -0
  33. package/src/core/c2persiststate.js +342 -0
  34. package/src/core/c2platformrecoverysender.js +76 -0
  35. package/src/core/c2recoverygate.js +385 -0
  36. package/src/core/c2runnerinput.js +63 -0
  37. package/src/core/c2servicestartgate.js +103 -0
  38. package/src/core/c2sessionbridge.js +72 -0
  39. package/src/core/c2sourcequarantine.js +30 -0
  40. package/src/core/c2startuprecovery.js +105 -0
  41. package/src/core/c2successorbridge.js +151 -0
  42. package/src/core/c2terminaleffectbridge.js +154 -0
  43. package/src/core/c2terminalprune.js +108 -0
  44. package/src/core/c2turnprojection.js +177 -0
  45. package/src/core/enginecheckpoint.js +211 -0
  46. package/src/core/engineeffectcursor.js +394 -0
  47. package/src/core/enginestepcoordinator.js +183 -0
  48. package/src/core/store.js +52 -8
  49. package/src/core/v2engine.js +1469 -0
  50. package/src/platform/feishu.js +324 -67
  51. package/src/plugins.js +1 -9
  52. package/assets/design-styles/acid-pop.md +0 -155
  53. package/assets/design-styles/archive-index.md +0 -161
  54. package/assets/design-styles/art-deco.md +0 -164
  55. package/assets/design-styles/cinematic-noir.md +0 -178
  56. package/assets/design-styles/editorial.md +0 -121
  57. package/assets/design-styles/extra/README.md +0 -23
  58. package/assets/design-styles/extra/constructivism.md +0 -146
  59. package/assets/design-styles/extra/neo-brutalism.md +0 -175
  60. package/assets/design-styles/extra/new-wave.md +0 -166
  61. package/assets/design-styles/extra/nordic-material.md +0 -162
  62. package/assets/design-styles/extra/paris-couture.md +0 -162
  63. package/assets/design-styles/extra/tropical-modern.md +0 -168
  64. package/assets/design-styles/extra/ulm-functional.md +0 -182
  65. package/assets/design-styles/extra/wa-shikimen.md +0 -160
  66. package/assets/design-styles/extra/y2k-chrome.md +0 -172
  67. package/assets/design-styles/geometric-pop.md +0 -122
  68. package/assets/design-styles/hand-drawn.md +0 -117
  69. package/assets/design-styles/islamic-geometry.md +0 -155
  70. package/assets/design-styles/liquid-glass.md +0 -183
  71. package/assets/design-styles/neo-chinese.md +0 -136
  72. package/assets/design-styles/precision-mono.md +0 -156
  73. package/assets/design-styles/quiet-luxury.md +0 -163
  74. package/assets/design-styles/riso-print.md +0 -116
  75. package/assets/design-styles/soft-friendly.md +0 -174
  76. package/assets/design-styles/swiss-grid.md +0 -156
  77. package/assets/design-styles/tech-dark.md +0 -182
  78. package/assets/favicon.svg +0 -6
  79. package/assets/logo.svg +0 -24
  80. package/bin/sbot.js +0 -4716
  81. package/docs/slack-app-manifest.yaml +0 -104
  82. package/sbot.config.example.json +0 -235
  83. package/src/agent/askonce.js +0 -76
  84. package/src/agent/claudemodels.js +0 -60
  85. package/src/agent/claudestatus.js +0 -74
  86. package/src/agent/claudeusage.js +0 -200
  87. package/src/agent/codexstatus.js +0 -181
  88. package/src/agent/imagen.js +0 -458
  89. package/src/agent/quotaerr.js +0 -44
  90. package/src/agent/transienterr.js +0 -32
  91. package/src/cdp.js +0 -254
  92. package/src/cli-secret.js +0 -36
  93. package/src/clilang.js +0 -31
  94. package/src/core/cron.js +0 -182
  95. package/src/core/cronfire.js +0 -120
  96. package/src/core/cronrun.js +0 -116
  97. package/src/core/engine.js +0 -2758
  98. package/src/core/interfaces.js +0 -114
  99. package/src/core/issues.js +0 -185
  100. package/src/core/ledger.js +0 -30
  101. package/src/core/opsalert.js +0 -214
  102. package/src/core/pending.js +0 -123
  103. package/src/core/proxy.js +0 -424
  104. package/src/core/quotaalert.js +0 -79
  105. package/src/core/quotaerr.js +0 -55
  106. package/src/core/scheduler.js +0 -59
  107. package/src/design.js +0 -5161
  108. package/src/gitrepo.js +0 -150
  109. package/src/health.js +0 -353
  110. package/src/installdeps.js +0 -72
  111. package/src/leftover.js +0 -174
  112. package/src/platform/boardnotice.js +0 -77
  113. package/src/platform/boardops.js +0 -36
  114. package/src/platform/boardwatch.js +0 -447
  115. package/src/platform/cli.js +0 -45
  116. package/src/platform/slack.js +0 -1289
  117. package/src/platform/takeovercard.js +0 -37
  118. package/src/platform/wecom.js +0 -938
  119. package/src/platform/wecomcli.js +0 -128
  120. package/src/platform/wecomgate.js +0 -108
  121. package/src/platform/wecomname.js +0 -43
  122. package/src/platform/wecompoll.js +0 -241
  123. package/src/preview.js +0 -581
  124. package/src/projectmemory.js +0 -175
  125. package/src/service.js +0 -317
  126. package/src/ui/auth.js +0 -31
  127. package/src/ui/browser.html +0 -392
  128. package/src/ui/browserroutes.js +0 -234
  129. package/src/ui/console.html +0 -5526
  130. package/src/ui/dashboard.js +0 -168
  131. package/src/ui/feishulogin.js +0 -136
  132. package/src/ui/server.js +0 -2314
  133. package/src/ui/sessions.js +0 -78
  134. package/src/ui/takeover.js +0 -108
  135. package/src/updater.js +0 -243
  136. package/src/upgrade.js +0 -35
  137. package/src/usage.js +0 -144
@@ -1,55 +0,0 @@
1
- // 额度用尽原话里的「几点重置」按产品时区解析 —— 额度自动切换「到点切回」的依据。
2
- // 判据本体(classifyQuota:哪句原话算额度用尽 / 账号不可用)在 src/agent/quotaerr.js,两个 runner 共用;
3
- // 这里只留依赖产品时区的那一半 —— runner 不知道时区,core 不认原话形状,各管一摊。
4
-
5
- const { tzOffsetMin, tzParts, isValidTz, DEFAULT_TZ } = require('./time')
6
-
7
- const MONTHS = { jan: 0, feb: 1, mar: 2, apr: 3, may: 4, jun: 5, jul: 6, aug: 7, sep: 8, sept: 8, oct: 9, nov: 10, dec: 11 }
8
-
9
- // 某时区的墙上时间 → epoch 毫秒。先按 UTC 猜一个,再用该时刻的时区偏移校正两次(跨夏令时边界时
10
- // 第一次偏移可能取错,第二次按校正后的时刻重取即收敛)。
11
- function wallToEpoch(y, mo, d, h, mi, tz) {
12
- let ts = Date.UTC(y, mo, d, h, mi)
13
- for (let i = 0; i < 2; i++) ts = Date.UTC(y, mo, d, h, mi) - tzOffsetMin(tz, ts) * 60e3
14
- return ts
15
- }
16
-
17
- /**
18
- * 从原话里解出「什么时候重置」。认两种形状:
19
- * · 「resets Oct 1 at 9am (Asia/Shanghai)」—— 带月日、可带时区
20
- * · 「try again at 2:30 PM」/「resets 9am」—— 只有时刻 ⇒ 按产品时区取**下一次**到达该时刻
21
- * 解不出返回 null(调用方退回额度探针给的绝对时刻,或不设)。
22
- * ⚠ 没写年份:取当前年;算出来早于 now 一天以上 ⇒ 说的是明年(跨年边界)。
23
- */
24
- function parseResetAt(text, { now = Date.now(), tz = DEFAULT_TZ } = {}) {
25
- const s = String(text || '')
26
- if (!s) return null
27
- const m = /(?:resets?|try again|available(?: again)?|retry)(?:\s+(?:at|on))?\s+(?:([a-z]{3,4})\.?\s+(\d{1,2}),?\s+(?:at\s+)?)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)?(?:\s*\(([^)]+)\))?/i.exec(s)
28
- if (!m) return null
29
- const [, mon, day, hh, mm, ampm, tzIn] = m
30
- let h = Number(hh)
31
- if (!Number.isFinite(h) || h > 23) return null
32
- if (ampm) { const pm = ampm.toLowerCase() === 'pm'; if (h === 12) h = pm ? 12 : 0; else if (pm) h += 12 }
33
- else if (!mon) return null // 「resets 9」这种没 am/pm 也没日期的,信息不够,不猜
34
- const mi = mm ? Number(mm) : 0
35
- const zone = (tzIn && isValidTz(tzIn)) ? tzIn : tz
36
- const p = tzParts(now, zone)
37
- const Y = +p.year, M = +p.month - 1, D = +p.day
38
- if (mon) {
39
- const mo = MONTHS[mon.toLowerCase()]
40
- if (mo == null) return null
41
- let ts = wallToEpoch(Y, mo, Number(day), h, mi, zone)
42
- if (ts < now - 864e5) ts = wallToEpoch(Y + 1, mo, Number(day), h, mi, zone)
43
- return plausible(ts, now)
44
- }
45
- let ts = wallToEpoch(Y, M, D, h, mi, zone)
46
- if (ts <= now) ts += 864e5
47
- return plausible(ts, now)
48
- }
49
-
50
- // 订阅额度窗口最长一周 ⇒ 解出的重置时刻距今超过 8 天就是解错了(典型:原话里的「Oct 1」其实是去年的,被推到了明年),
51
- // 宁可说「不知道」交给探针,也不能把「约 358 天后切回」落进记录。
52
- const MAX_AHEAD_MS = 8 * 864e5
53
- function plausible(ts, now) { return ts - now > MAX_AHEAD_MS ? null : ts }
54
-
55
- module.exports = { parseResetAt, MAX_AHEAD_MS }
@@ -1,59 +0,0 @@
1
- // Cron scheduler — a minute-resolution ticker that fires due tasks (定时任务 base skill).
2
- //
3
- // Wakes near each minute boundary, asks `tasks()` for the current work-list (so config
4
- // hot-reload is picked up automatically), and fires every task whose cron matches the
5
- // current instant in the product timezone. Dedup by minute-key: a task fires at most once
6
- // per matching minute even if a tick jitters or fires twice. now/tz/tasks/fire and the timer
7
- // fns are injected so the whole thing is unit-testable without real time or timers.
8
- //
9
- // Deliberately does NOT tick on start(): a daemon restart must not back-fire tasks whose
10
- // minute happened to be current at boot (that would double-fire across restarts).
11
-
12
- const { matchCron, matchAt } = require('./cron')
13
- const { tzParts } = require('./time')
14
-
15
- function minuteKey(ts, tz) {
16
- const p = tzParts(ts, tz)
17
- return `${p.year}-${p.month}-${p.day}-${p.hour}-${p.minute}`
18
- }
19
-
20
- function createScheduler({ tasks, fire, tz = () => 'Asia/Shanghai', now = () => Date.now(), log = () => {}, setTimer = setTimeout, clearTimer = clearTimeout } = {}) {
21
- if (typeof tasks !== 'function' || typeof fire !== 'function') throw new Error('scheduler: tasks() and fire() are required')
22
- let timer = null
23
- let stopped = false
24
- const lastFired = new Map() // taskId -> minuteKey already fired (dedup within a minute)
25
-
26
- const tick = () => {
27
- if (stopped) return
28
- const ts = now(), z = tz()
29
- const key = minuteKey(ts, z)
30
- for (const t of (tasks() || [])) {
31
- if (!t || !t.id || (!t.expr && !t.at) || t.enabled === false) continue
32
- let due
33
- try { due = t.at ? matchAt(t.at, ts, z) : matchCron(t.expr, ts, z) } catch (e) { log(`cron 任务 ${t.id} 表达式无效(跳过): ${e && e.message}`); continue }
34
- if (!due) continue
35
- // Dedup key is scoped by chatId so two GROUPS holding a same-id task never suppress each
36
- // other (cross-group isolation): each (group, task) fires independently, once per minute.
37
- const dk = `${t.chatId || ''}:${t.id}`
38
- if (lastFired.get(dk) === key) continue // already fired this minute
39
- lastFired.set(dk, key)
40
- try { fire(t) } catch (e) { log(`cron fire ${t.id} 失败: ${e && e.message}`) }
41
- }
42
- }
43
-
44
- const schedule = () => {
45
- if (stopped) return
46
- // wake ~0.5s into the next minute so a tick reliably lands inside each target minute
47
- const ms = 60000 - (now() % 60000) + 500
48
- timer = setTimer(() => { tick(); schedule() }, ms)
49
- if (timer && timer.unref) timer.unref() // never keep the process alive on our account
50
- }
51
-
52
- return {
53
- start() { stopped = false; schedule() }, // align to the next minute; do NOT tick immediately
54
- stop() { stopped = true; if (timer) { clearTimer(timer); timer = null } },
55
- tick, // exposed for tests / manual drive
56
- }
57
- }
58
-
59
- module.exports = { createScheduler, minuteKey }