Files
dsh-markmag/scripts/verify-gateway2.mjs
发条 ff8017bbbb 初始版本 0.1.0:四道菜团队中台 DSH 插件
模型通道:接管官方 API Key 通道指向弹匣网关(GLM-5.3 / GLM-5.3-Flash)
登录:浏览器取一次性接入码 → 换成员专属 key → 写入 DSH 凭据
工具面:MCP 暴露查汇总/查任务/查项目/建任务/完成/改期/whoami
面板:侧边栏入口,个人看板 + 角色可见范围 + 行内操作
离职吊销:成员停用即吊销名下全部 TDB key

发布配置:scope 包名、私有 registry 锁定、prepack 自动构建、prepublishOnly 检查
2026-11-07 19:19:20 +08:00

32 lines
1.6 KiB
JavaScript

import { readFileSync } from 'node:fs'
import { homedir } from 'node:os'
import { join } from 'node:path'
const cfg = JSON.parse(readFileSync(join(homedir(), 'Documents/Essay_AI/Essay_system/dsh-markmag/.local-credentials.json'), 'utf8'))
const key = cfg.key1
const BASE = 'https://brain.sidaocai.cn'
async function call(name, url, headers, body) {
const t0 = Date.now()
try {
const res = await fetch(url, { method: 'POST', headers: { 'content-type': 'application/json', ...headers }, body: JSON.stringify(body), signal: AbortSignal.timeout(60000) })
const text = await res.text()
console.log(`[${name}] ${res.status} ${Date.now() - t0}ms :: ${text.slice(0, 300).replace(/\n/g, ' ')}`)
} catch (e) { console.log(`[${name}] FAIL ${e.name}: ${e.message}`) }
}
const H_ANTH = { 'x-api-key': key, 'anthropic-version': '2023-06-01' }
const H_OAUTH = { authorization: 'Bearer ' + key }
// A. 弹匣链路 + glm-5.3
await call('A-anthropic/glm-5.3', BASE + '/tdb-api/claude-code/default/v1/messages', H_ANTH,
{ model: 'glm-5.3', max_tokens: 32, messages: [{ role: 'user', content: '只回复两个字:在的' }] })
// B. DSH 链路 + 团队头 + glm-5.3
await call('B-dsh/glm-5.3+headers', BASE + '/tdb-api/dsh/default/chat/completions',
{ ...H_OAUTH, 'x-team-id': 'team-oek7kp1cy7', 'x-agent-id': 'agt-of5x44h7ns' },
{ model: 'glm-5.3', max_tokens: 32, messages: [{ role: 'user', content: '只回复两个字:在的' }] })
// C. DSH 链路不带头
await call('C-dsh/glm-5.3-no-header', BASE + '/tdb-api/dsh/default/chat/completions', H_OAUTH,
{ model: 'glm-5.3', max_tokens: 32, messages: [{ role: 'user', content: '只回复两个字:在的' }] })