A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Update GitHub installs from the release's current address
Fei241101d5b43dd31b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex b1fc4426..685ad0a3 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -12,6 +12,7 @@ All notable changes to DS Bot are listed here. The format follows [Keep a Change### Changed- Every Bot can change its own name, role, color, model and instructions; only a Main Bot changes other Bots.+- Updating a copy installed from GitHub uses the repository's current address.### Fixed@@ -88,7 +89,7 @@ If you used the legacy `dsh-bot` package, remove it before you install `ds-bot`.- Only one DSH can change a team at a time; a second DSH on the same DSH home opens it read-only ([Data and backups](ds-bot/README.md#data-and-backups)).- Group chats use many tokens: each member reads the group and answers in turn.-[Unreleased]: https://github.com/FeiZhuLulu/DeepSeek-Bot/compare/v0.1.2...HEAD-[0.1.2]: https://github.com/FeiZhuLulu/DeepSeek-Bot/compare/v0.1.1...v0.1.2-[0.1.1]: https://github.com/FeiZhuLulu/DeepSeek-Bot/compare/v0.1.0...v0.1.1-[0.1.0]: https://github.com/FeiZhuLulu/DeepSeek-Bot/releases/tag/v0.1.0+[Unreleased]: https://github.com/Fei2411/DeepSeek-Bot/compare/v0.1.2...HEAD+[0.1.2]: https://github.com/Fei2411/DeepSeek-Bot/compare/v0.1.1...v0.1.2+[0.1.1]: https://github.com/Fei2411/DeepSeek-Bot/compare/v0.1.0...v0.1.1+[0.1.0]: https://github.com/Fei2411/DeepSeek-Bot/releases/tag/v0.1.0diff --git a/ds-bot/src/host/update.js b/ds-bot/src/host/update.jsindex 227a8b26..3f159957 100644--- a/ds-bot/src/host/update.js+++ b/ds-bot/src/host/update.js@@ -161,8 +161,12 @@ export function install(rt) {const release = await fetchJson(`https://api.github.com/repos/${source.owner}/${source.repo}/releases/latest`, { 'user-agent': `${PKG.name}/${PKG.version}` })const version = cleanVersion(release?.tag_name)if (!version) return null+ // The API answers through redirects, so the release's html_url names the+ // repository's current address; the install moves to it.+ const current = /^https:\/\/github\.com\/([\w.-]+)\/([\w.-]+)\/releases\//.exec(release.html_url ?? '')+ const [owner, repo] = current ? [current[1], current[2]] : [source.owner, source.repo]const fragment = [release.tag_name, ...source.rest].join('&')- return { version, spec: `github:${source.owner}/${source.repo}#${fragment}` }+ return { version, spec: `github:${owner}/${repo}#${fragment}` }}async function runCheck() {diff --git a/ds-bot/test/update.test.js b/ds-bot/test/update.test.jsindex f711b1ab..6304b5bc 100644--- a/ds-bot/test/update.test.js+++ b/ds-bot/test/update.test.js@@ -55,10 +55,10 @@ test('the install source decides where a newer version is looked for', () => {assert.deepEqual(sourceOf('npm:ds-bot@^0.1.0'), { kind: 'registry' })assert.deepEqual(sourceOf('link:E:/项目库/My Bots/ds-bot'), { kind: 'path' })assert.deepEqual(sourceOf('/home/user/ds-bot'), { kind: 'path' })- assert.deepEqual(sourceOf('github:FeiZhuLulu/DeepSeek-Bot#v0.1.0&path:/ds-bot'),- { kind: 'git', owner: 'FeiZhuLulu', repo: 'DeepSeek-Bot', ref: 'v0.1.0', rest: ['path:/ds-bot'] })- assert.deepEqual(sourceOf('git+https://github.com/FeiZhuLulu/DeepSeek-Bot.git#main'),- { kind: 'git', owner: 'FeiZhuLulu', repo: 'DeepSeek-Bot', rest: [] })+ assert.deepEqual(sourceOf('github:Fei2411/DeepSeek-Bot#v0.1.0&path:/ds-bot'),+ { kind: 'git', owner: 'Fei2411', repo: 'DeepSeek-Bot', ref: 'v0.1.0', rest: ['path:/ds-bot'] })+ assert.deepEqual(sourceOf('git+https://github.com/Fei2411/DeepSeek-Bot.git#main'),+ { kind: 'git', owner: 'Fei2411', repo: 'DeepSeek-Bot', rest: [] })assert.deepEqual(sourceOf('https://example.com/ds-bot-0.1.0.tgz'), { kind: 'tarball' })assert.deepEqual(sourceOf(undefined), { kind: 'unknown' })})@@ -78,7 +78,7 @@ test('a registry install finds the newest version on the next registry and instaassert.equal(view.latest, '9.0.0')assert.equal(view.current, PKG.version)assert.equal(view.source, 'registry')- assert.equal(view.notesUrl, 'https://github.com/FeiZhuLulu/DeepSeek-Bot/releases')+ assert.equal(view.notesUrl, 'https://github.com/Fei2411/DeepSeek-Bot/releases')assert.equal(rt.updateStart().phase, 'installing')await flush()assert.deepEqual(installs, [[`${PKG.name}@9.0.0`, { registry: 'https://registry.npmmirror.com/' }]])@@ -105,19 +105,37 @@ test('a private registry of pnpm\'s own is asked alone, and an answer stands fortest('a versioned GitHub install follows the latest release tag and keeps its path', async () => {const { rt, installs } = start({- source: 'github:FeiZhuLulu/DeepSeek-Bot#v0.1.0&path:/ds-bot',- answers: { 'https://api.github.com/repos/FeiZhuLulu/DeepSeek-Bot/releases/latest': { tag_name: 'v9.1.0' } },+ source: 'github:Fei2411/DeepSeek-Bot#v0.1.0&path:/ds-bot',+ answers: { 'https://api.github.com/repos/Fei2411/DeepSeek-Bot/releases/latest': { tag_name: 'v9.1.0' } },})const view = await rt.updateCheck()assert.equal(view.available, true)assert.equal(view.latest, '9.1.0')rt.updateStart()await flush()- assert.deepEqual(installs, [['github:FeiZhuLulu/DeepSeek-Bot#v9.1.0&path:/ds-bot', {}]])+ assert.deepEqual(installs, [['github:Fei2411/DeepSeek-Bot#v9.1.0&path:/ds-bot', {}]])+})++test('a versioned GitHub install follows the release to the repository\'s current address', async () => {+ const { rt, installs } = start({+ source: 'github:old-owner/DeepSeek-Bot#v0.1.0&path:/ds-bot',+ answers: {+ 'https://api.github.com/repos/old-owner/DeepSeek-Bot/releases/latest': {+ tag_name: 'v9.1.0',+ html_url: 'https://github.com/Fei2411/DeepSeek-Bot/releases/tag/v9.1.0',+ },+ },+ })+ const view = await rt.updateCheck()+ assert.equal(view.available, true)+ assert.equal(view.latest, '9.1.0')+ rt.updateStart()+ await flush()+ assert.deepEqual(installs, [['github:Fei2411/DeepSeek-Bot#v9.1.0&path:/ds-bot', {}]])})test('a linked checkout, an unversioned git install, or a disabled check never asks the network', async () => {- for (const source of [`link:/work/${PKG.name}`, 'github:FeiZhuLulu/DeepSeek-Bot#main', undefined]) {+ for (const source of [`link:/work/${PKG.name}`, 'github:Fei2411/DeepSeek-Bot#main', undefined]) {const { rt, fetched } = start({ source })const view = await rt.updateCheck()assert.equal(view.available, false)@@ -130,10 +148,10 @@ test('a linked checkout, an unversioned git install, or a disabled check never a})test('the star count comes from the repository, is kept for an hour, and survives a failed answer', async () => {- const repo = 'https://api.github.com/repos/FeiZhuLulu/DeepSeek-Bot'+ const repo = 'https://api.github.com/repos/Fei2411/DeepSeek-Bot'const answers = { [repo]: new Error('offline') }const { rt, fetched } = start({ source: `${PKG.name}@^${PKG.version}`, answers })- assert.equal(rt.updateView().repoUrl, 'https://github.com/FeiZhuLulu/DeepSeek-Bot')+ assert.equal(rt.updateView().repoUrl, 'https://github.com/Fei2411/DeepSeek-Bot')assert.equal(await rt.repoStars(), null)answers[repo] = { stargazers_count: 42 }assert.equal(await rt.repoStars(), 42)