feat: harden loose-offline sync for user JWT, schema, and console ops

Enable Binding-scoped agent push/pull, empty-table schema ensure, SyncPage inspect/drop-table, default module import, and agent-bound publish docs from the 宇恒联调意见.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
whm
2026-08-05 09:47:35 +08:00
parent 76cdcd760e
commit b04b180d30
59 changed files with 4762 additions and 308 deletions

View File

@@ -55,6 +55,12 @@ func (m *Manager) StartChannel(id string) error {
c.Enabled = true
c.LastError = ""
})
// 预热 remote避免首个 agent push 冷开 SQLite 触发超时
go func(driver Driver, dsn string) {
if err := WarmRemote(driver, dsn); err != nil {
log.Printf("dbsync warm remote %s: %v", id, err)
}
}(ch.Remote.Driver, ch.Remote.DSN)
return nil
}
@@ -65,6 +71,9 @@ func (m *Manager) StopChannel(id string) {
cancel()
delete(m.runners, id)
}
if ch, err := m.store.GetChannel(id); err == nil {
InvalidateRemote(ch.Remote.Driver, ch.Remote.DSN)
}
_ = m.store.PatchStats(id, func(c *Channel) { c.Enabled = false })
}