dsh-agency-agents 0.3.5 → 0.4.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.
- package/README.md +7 -8
- package/client.js +1 -25
- package/cordis.patch.yml +0 -2
- package/docs/DETAIL.md +1 -1
- package/index.js +6 -1
- package/package.json +1 -1
- package/src/host/config.js +0 -2
- package/src/host/gh.js +62 -0
- package/src/host/sync.js +4 -10
package/README.md
CHANGED
|
@@ -46,16 +46,14 @@ plugin_manager: action=install_bundle, target=file:C:/Users/63676/dsh-bundles/di
|
|
|
46
46
|
maxTeamMembers: 6 # 团队上限;实际还会被 maxActiveSubagents 夹取
|
|
47
47
|
strictValidation: false # true = 上游任何一个坏文件都整体拒绝;false = 跳过并标注
|
|
48
48
|
autoTeamMode: true # 团队任务板清空后自动关闭 Team 模式(见下)
|
|
49
|
-
githubToken: '' # secret 字段:在 Plugins → Agency Agents 配置里填,不要写进文件
|
|
50
49
|
repository: msitarzewski/agency-agents
|
|
51
50
|
branch: main
|
|
52
51
|
proxy: '' # 例如 http://127.0.0.1:7890
|
|
53
52
|
```
|
|
54
53
|
|
|
55
|
-
### GitHub
|
|
54
|
+
### GitHub 访问(零配置)
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
从 0.2.x 升级:旧版本把 Token 存在 DSH 凭据库(`AGENCY_AGENTS_GITHUB_TOKEN`),0.3.0 起不再读取该凭据,需要在插件配置页重新填写(旧的凭据可以删了)。
|
|
56
|
+
不需要配置任何 Token:Host 启动时自动复用本机的 **GitHub CLI**(`gh auth token`)作为上游凭据;`gh` 未安装或未登录时自动退回匿名请求(60 次/小时)。Token 只停留在进程内,不写配置、不回传页面、不进日志。
|
|
59
57
|
|
|
60
58
|
代理与离线:`proxy` 为空表示直连;填了就走该代理。断网/限流/上游坏文件时插件**不会清空已有版本**,继续使用上一个有效版本并在面板显示原因。
|
|
61
59
|
|
|
@@ -69,7 +67,7 @@ plugin_manager: action=install_bundle, target=file:C:/Users/63676/dsh-bundles/di
|
|
|
69
67
|
| **版本** | 列出已保存版本;对非当前版本「切换到此版本」会原子切换 active 指针,页面立刻回退到旧版本。 |
|
|
70
68
|
| ~~**设置**~~ | 已移除:配置全部交给 DSH 插件页的原生配置表单(Plugins → Agency Agents → 该行「配置」) |
|
|
71
69
|
|
|
72
|
-
>
|
|
70
|
+
> **配置在哪里**:装好即可用,**零配置**(上游凭据自动复用本机 `gh`)。需要调优时再去 **Plugins → Agency Agents → 行「配置」**:间隔 / 团队上限 / 代理 / 严格校验 / 自动关闭。没有 Token 设置项,也没有自己的设置页与偏好文件。
|
|
73
71
|
|
|
74
72
|
**从 runbook 起团队**:协作流程页选 runbook → 「根据此流程组建团队」→ 填目标与规模 → 「生成编排」→ 启动。
|
|
75
73
|
|
|
@@ -199,7 +197,7 @@ GET /agency-agents/api/v1/events # SSE: sync/status, catalog/changed,
|
|
|
199
197
|
| 服务注入 | `ctx.inject(['webServer'])`、`ctx.inject(['tools'])` + `ctx.get(...)` | webServer 重启后路由自动重建 |
|
|
200
198
|
| Agent Team | `agentTeams.setEnabled` + 原生 `subagent`/`team_task_*` | 会话内 `teamMode:'enabled'` |
|
|
201
199
|
| Session 控制 | `sessionController.create/resolveAgent/prompt` | `/session/start`、`agency_team_start` |
|
|
202
|
-
| 凭据 |
|
|
200
|
+
| 凭据 | 复用本机 `gh auth token`(无配置项) | 插件不接触用户输入的 Token;没装 gh 时匿名 |
|
|
203
201
|
| 卸载清理 | 所有注册都挂在 `ctx.effect` 上 | 停用插件后槽占用与工具同时消失 |
|
|
204
202
|
|
|
205
203
|
### 依赖与安装(从 0.2.0 起)
|
|
@@ -278,7 +276,7 @@ node --test
|
|
|
278
276
|
| 侧边栏没有图标 | 确认 Plugins 里该 bundle 已启用;`cordis_inspect_query` 查 Client `Slots.listSubTree` 的 `sidebar.panellist` 是否有 `agency-agents` |
|
|
279
277
|
| 页面显示 "Host API unavailable" | 该组合没有 `webServer`(非 HTTP 载体),面板只能只读;用 `dsh web`/Desktop 的 HTTP 页面 |
|
|
280
278
|
| 一直 "Update available" 但不切换 | 看 `~/.dsh/agency-agents/state.json` 的 `lastError`(常见:磁盘不足、校验失败) |
|
|
281
|
-
| 同步失败 403 |
|
|
279
|
+
| 同步失败 403 | 确认本机 `gh auth status` 已登录(插件会自动复用其 token);否则等 `x-ratelimit-reset` |
|
|
282
280
|
| 想彻底重置 | 停用插件后删 `~/.dsh/agency-agents/`,重新启用 |
|
|
283
281
|
|
|
284
282
|
## 升级记录
|
|
@@ -286,6 +284,7 @@ node --test
|
|
|
286
284
|
| 迁移 | 做了什么 | 证据 |
|
|
287
285
|
|---|---|---|
|
|
288
286
|
| **插件 0.3.3(修复浏览器端注册)** | 包名改为 `dsh-agency-agents` 后,`client.js` 的 `__ModuleLoader__.load({ id })` 仍是旧名,导致整包客户端加载失败(页面同步报错、面板与配置入口消失);已把 id 对齐包名,并新增 `plugins.bundle.config` / `plugins.row.config` 两个原生配置入口 | 刷新后 Plugins → Agency Agents 详情页出现配置区,行也有「配置」入口;工具与面板恢复 |
|
|
287
|
+
| **插件 0.4.0(零配置)** | 删除 `githubToken` 配置字段;Host 新增 `gh auth token` 解析器(10 分钟缓存、失败/未登录自动匿名回退),上游鉴权完全复用本机 GitHub CLI;配置页只剩可选调优项 | `gh.test.mjs` 5 例(取值/缓存/超时重取/失败/并发共享);本机实测 `gh auth token` 40 字符并被解析器读到;`node --test` 91 pass |
|
|
289
288
|
| **插件 0.3.1(补回配置入口)** | 把配置页注册到 DSH 插件页的原生槽 `plugins.row.config`(键 `dsh-agency-agents#agency-agents`):页面 chrome、表单状态与写入全部由宿主提供(`form.mutate` → 配置文档),插件不再有 `/settings` 接口或偏好文件 | Plugins → Agency Agents → 行右侧「配置」可编辑全部 16 个字段;Token 为 secret 字段,读取脱敏 |
|
|
290
289
|
| **插件 0.2.2 → 0.3.0(交接 DSH 统一管理)** | ① 删除插件自管的设置页/保存按钮/`preferences.json` 与 `/settings` 接口;② 16 个配置字段全部回到 DSH 的插件配置页(`Config` → Loader 行),Token 改为 `role('secret')` 配置字段(读取脱敏);③ 旧技能维护动作移入面板(检测到才显示);④ 补 `LICENSE`、`icon`、打包元数据,`pnpm pack` 产物可安装并加载 | 单测 87 pass;`pnpm pack` 34 个文件;tarball 装进临时工程 + 加载 `Config({})` 成功;插件重载后 5 个工具注册 |
|
|
291
290
|
| **0.2.2-rc.5 → 0.2.3-alpha.2**(本插件 0.2.1 → 0.2.2) | ① `dsh-tools` peer+dev → `0.2.3-alpha.2`,`schemastery` → `~3.20.0-alpha.1`(宿主已升到 3.20.0-alpha.1);② `engines.dsh` 按官方新规范改为 `^0.2.3-alpha.2`(caret + prerelease 下界);③ 全量测试对 0.2.3-alpha.2 SDK 重跑;④ 适配**新增强制鉴权**:`dsh-host-authentication-token` 让所有路由默认 `auth: 'required'`,我们把插件路由显式声明为 `required`,并给客户端补了 401 专属提示("此页面未通过 DSH 鉴权") | `node --test` → 81 pass;`index.js` 在 schemastery 3.20.0-alpha.1 下可加载且 `Config({})` 正常;无 cookie 探针 → `GET /agency-agents/api/v1/ping` = **401 `unauthorized`**(证明路由已注册且受鉴权保护);5 个工具在 0.2.3-alpha.2 上注册成功、`agency_roles_search` 实际调用成功 |
|
|
@@ -305,7 +304,7 @@ node --test
|
|
|
305
304
|
|---|---|---|
|
|
306
305
|
| **唯一性** | 配置默认值与范围只写一次:`src/host/config.js` 的 `CONFIG_DEFAULTS` / `CONFIG_BOUNDS`;`index.js` 的 `Config` schema 由这张表生成,`resolveConfig` 也用它夹取 | 单测「one defaults table feeds the schema, the resolver and the tests」逐字段比对 schema 投影与默认表 |
|
|
307
306
|
| | 版本只写一次:`PLUGIN_VERSION` 读 `package.json`,不手写 | `index.js` 里已无字面量版本 |
|
|
308
|
-
| | 有效配置只有一个来源:Loader 行(`Config` schema 的默认值 + 用户在 Plugins
|
|
307
|
+
| | 有效配置只有一个来源:Loader 行(`Config` schema 的默认值 + 用户在 Plugins 页的编辑);上游凭据复用本机 `gh`,不是配置项 | `resolveConfig(raw)`;单测覆盖默认表、越界夹取、无 Token 字段 |
|
|
309
308
|
| | 交付物只有一份:调研报告只留 `docs/research/` | 目录核对 |
|
|
310
309
|
| **复用性** | 组队只有一条管线:`composeTeam`/`buildTeamPrompt`/`isThinObjective` 由工具、HTTP 路由、启动逻辑共用 | `tools.js`、`routes.js` 均 `import` 自 `compose.js` |
|
|
311
310
|
| | 客户端只有一套设置 UI 与一套 `api()`/`StateBlock`/`Skeleton` | 设置节是唯一表单;面板不再有第二份 |
|
package/client.js
CHANGED
|
@@ -150,10 +150,6 @@ window.__ModuleLoader__.load({
|
|
|
150
150
|
'config.maxTeam': '团队上限',
|
|
151
151
|
'config.proxy': '代理',
|
|
152
152
|
'config.proxyPlaceholder': 'http://127.0.0.1:7890(留空表示直连)',
|
|
153
|
-
'config.token': 'GitHub Token(留空不修改)',
|
|
154
|
-
'config.tokenPlaceholder': '粘贴 token 后保存',
|
|
155
|
-
'config.tokenHint': 'Token 是 secret 字段:DSH 读取时脱敏,页面不会再显示已保存的值。',
|
|
156
|
-
'config.tokenClear': '清除 Token',
|
|
157
153
|
'config.strict': '严格校验(上游有坏文件就整体拒绝)',
|
|
158
154
|
'config.autoTeamMode': '任务板清空后自动关闭 Team 模式',
|
|
159
155
|
'config.saved': '已保存',
|
|
@@ -293,10 +289,6 @@ window.__ModuleLoader__.load({
|
|
|
293
289
|
'config.maxTeam': 'Team cap',
|
|
294
290
|
'config.proxy': 'Proxy',
|
|
295
291
|
'config.proxyPlaceholder': 'http://127.0.0.1:7890 (empty = direct)',
|
|
296
|
-
'config.token': 'GitHub token (leave empty to keep)',
|
|
297
|
-
'config.tokenPlaceholder': 'Paste a token and save',
|
|
298
|
-
'config.tokenHint': 'The token is a secret field: DSH redacts it on every read, so a saved value is never shown again.',
|
|
299
|
-
'config.tokenClear': 'Clear token',
|
|
300
292
|
'config.strict': 'Strict validation (reject a sync with a bad file)',
|
|
301
293
|
'config.autoTeamMode': 'Switch Team mode off automatically once the board is empty',
|
|
302
294
|
'config.saved': 'Saved',
|
|
@@ -548,7 +540,7 @@ animation:aag-spin .8s linear infinite}
|
|
|
548
540
|
for (const entry of service.describe() ?? []) {
|
|
549
541
|
const ns = entry?.ns
|
|
550
542
|
if (typeof ns !== 'string') continue
|
|
551
|
-
if (JSON.stringify(entry?.schema ?? {}).includes('
|
|
543
|
+
if (JSON.stringify(entry?.schema ?? {}).includes('maxSnapshotFiles')) names.push(ns)
|
|
552
544
|
}
|
|
553
545
|
}
|
|
554
546
|
for (const ns of names) {
|
|
@@ -590,7 +582,6 @@ animation:aag-spin .8s linear infinite}
|
|
|
590
582
|
strictValidation: values.strictValidation === true,
|
|
591
583
|
autoTeamMode: values.autoTeamMode !== false,
|
|
592
584
|
proxy: values.proxy ?? '',
|
|
593
|
-
githubToken: '',
|
|
594
585
|
})
|
|
595
586
|
}, [values])
|
|
596
587
|
|
|
@@ -614,7 +605,6 @@ animation:aag-spin .8s linear infinite}
|
|
|
614
605
|
try {
|
|
615
606
|
const accepted = await form.mutate(ops)
|
|
616
607
|
setNotice({ kind: accepted ? 'ok' : 'bad', text: accepted ? t('config.saved') : t('config.refused') })
|
|
617
|
-
if (accepted) setDraft(current => (current === undefined ? current : { ...current, githubToken: '' }))
|
|
618
608
|
} catch (error) {
|
|
619
609
|
setNotice({ kind: 'bad', text: t('config.failed').replace('{message}', error instanceof Error ? error.message : String(error)) })
|
|
620
610
|
} finally {
|
|
@@ -636,9 +626,6 @@ animation:aag-spin .8s linear infinite}
|
|
|
636
626
|
{ op: 'set', path: ['autoTeamMode'], value: draft.autoTeamMode !== false },
|
|
637
627
|
{ op: 'set', path: ['proxy'], value: typeof draft.proxy === 'string' ? draft.proxy.trim() : '' },
|
|
638
628
|
]
|
|
639
|
-
if (typeof draft.githubToken === 'string' && draft.githubToken.trim() !== '') {
|
|
640
|
-
ops.push({ op: 'set', path: ['githubToken'], value: draft.githubToken.trim() })
|
|
641
|
-
}
|
|
642
629
|
void persist(ops)
|
|
643
630
|
}
|
|
644
631
|
|
|
@@ -662,10 +649,6 @@ animation:aag-spin .8s linear infinite}
|
|
|
662
649
|
t('config.proxy'),
|
|
663
650
|
h('input', { type: 'text', placeholder: t('config.proxyPlaceholder'), value: draft.proxy, onChange: event => setDraft({ ...draft, proxy: event.target.value }) }),
|
|
664
651
|
),
|
|
665
|
-
field(
|
|
666
|
-
t('config.token'),
|
|
667
|
-
h('input', { type: 'password', placeholder: t('config.tokenPlaceholder'), value: draft.githubToken, onChange: event => setDraft({ ...draft, githubToken: event.target.value }) }),
|
|
668
|
-
),
|
|
669
652
|
),
|
|
670
653
|
h(
|
|
671
654
|
'div',
|
|
@@ -679,18 +662,11 @@ animation:aag-spin .8s linear infinite}
|
|
|
679
662
|
h('span', null, t('config.autoTeamMode')),
|
|
680
663
|
),
|
|
681
664
|
),
|
|
682
|
-
h('p', { className: 'aag-configHint' }, t('config.tokenHint')),
|
|
683
665
|
h(
|
|
684
666
|
'div',
|
|
685
667
|
{ className: 'aag-toolbar' },
|
|
686
668
|
h('button', { type: 'button', className: 'aag-button primary', disabled: busy, onClick: save },
|
|
687
669
|
busy ? h('span', { className: 'aag-spin' }) : null, t('action.save')),
|
|
688
|
-
h('button', {
|
|
689
|
-
type: 'button',
|
|
690
|
-
className: 'aag-button ghost',
|
|
691
|
-
disabled: busy || typeof values?.githubToken === 'string' && values.githubToken !== '',
|
|
692
|
-
onClick: () => void persist([{ op: 'unset', path: ['githubToken'] }]),
|
|
693
|
-
}, t('config.tokenClear')),
|
|
694
670
|
),
|
|
695
671
|
)
|
|
696
672
|
}
|
package/cordis.patch.yml
CHANGED
|
@@ -12,5 +12,3 @@
|
|
|
12
12
|
maxSnapshotBytes: 33554432
|
|
13
13
|
# Maximum entries accepted from one upstream snapshot archive.
|
|
14
14
|
maxSnapshotFiles: 2000
|
|
15
|
-
# The GitHub token is a secret config field: set it in Plugins -> Agency Agents
|
|
16
|
-
# configuration. DSH redacts it from every read; never commit a value here.
|
package/docs/DETAIL.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-

|
|
1
|
+

|
package/index.js
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { readFileSync } from 'node:fs'
|
|
10
|
+
|
|
11
|
+
import { createGhTokenResolver } from './src/host/gh.js'
|
|
10
12
|
import { createRequire } from 'node:module'
|
|
11
13
|
|
|
12
14
|
import z from '@deepseek-ai/schemastery'
|
|
@@ -46,7 +48,6 @@ export const Config = z.object({
|
|
|
46
48
|
keepVersions: bounded('keepVersions', 'Snapshot versions kept on disk.'),
|
|
47
49
|
maxSnapshotBytes: bounded('maxSnapshotBytes', 'Largest accepted upstream archive.'),
|
|
48
50
|
maxSnapshotFiles: bounded('maxSnapshotFiles', 'Largest accepted file count in one snapshot.'),
|
|
49
|
-
githubToken: z.string().default(CONFIG_DEFAULTS.githubToken).role('secret').description('Optional GitHub token raising the API rate limit; stored redacted by DSH.'),
|
|
50
51
|
repository: z.string().default(CONFIG_DEFAULTS.repository).description('Upstream repository.'),
|
|
51
52
|
branch: z.string().default(CONFIG_DEFAULTS.branch).description('Upstream branch.'),
|
|
52
53
|
apiBase: z.string().default(CONFIG_DEFAULTS.apiBase).description('GitHub API base URL.'),
|
|
@@ -162,11 +163,15 @@ export function apply(ctx, rawConfig = {}) {
|
|
|
162
163
|
})
|
|
163
164
|
|
|
164
165
|
|
|
166
|
+
// Zero setup: reuse the machine gh CLI when it is logged in.
|
|
167
|
+
const githubToken = createGhTokenResolver()
|
|
168
|
+
|
|
165
169
|
const sync = createSyncService({
|
|
166
170
|
config,
|
|
167
171
|
root,
|
|
168
172
|
hub,
|
|
169
173
|
limits,
|
|
174
|
+
githubToken,
|
|
170
175
|
logger: ctx.logger,
|
|
171
176
|
onChange(view) {
|
|
172
177
|
state.syncStatus = view
|
package/package.json
CHANGED
package/src/host/config.js
CHANGED
|
@@ -26,7 +26,6 @@ export const CONFIG_DEFAULTS = Object.freeze({
|
|
|
26
26
|
keepVersions: 5,
|
|
27
27
|
maxSnapshotBytes: 32 * 1024 * 1024,
|
|
28
28
|
maxSnapshotFiles: 2000,
|
|
29
|
-
githubToken: '',
|
|
30
29
|
repository: 'msitarzewski/agency-agents',
|
|
31
30
|
branch: 'main',
|
|
32
31
|
apiBase: 'https://api.github.com',
|
|
@@ -72,7 +71,6 @@ export function resolveConfig(raw = {}) {
|
|
|
72
71
|
checkOnStart: input.checkOnStart === undefined ? CONFIG_DEFAULTS.checkOnStart : input.checkOnStart === true,
|
|
73
72
|
strictValidation: input.strictValidation === true,
|
|
74
73
|
autoTeamMode: input.autoTeamMode === undefined ? CONFIG_DEFAULTS.autoTeamMode : input.autoTeamMode === true,
|
|
75
|
-
githubToken: typeof input.githubToken === 'string' ? input.githubToken : '',
|
|
76
74
|
repository: text('repository'),
|
|
77
75
|
branch: text('branch'),
|
|
78
76
|
apiBase: text('apiBase'),
|
package/src/host/gh.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reuse the machine's authenticated GitHub CLI as the upstream credential.
|
|
3
|
+
*
|
|
4
|
+
* The plugin ships with no token setting: when `gh` is installed and logged in,
|
|
5
|
+
* `gh auth token` supplies the API credential, so anonymous rate limits do not
|
|
6
|
+
* apply. Without `gh`, the resolver returns undefined and the existing anonymous
|
|
7
|
+
* request path is used unchanged.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { execFile } from 'node:child_process'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Run `gh auth token` and return its trimmed output.
|
|
14
|
+
* @returns {Promise<string>} Token text.
|
|
15
|
+
*/
|
|
16
|
+
function defaultRun() {
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
18
|
+
execFile(
|
|
19
|
+
'gh',
|
|
20
|
+
['auth', 'token'],
|
|
21
|
+
{ timeout: 5000, windowsHide: true, maxBuffer: 64 * 1024 },
|
|
22
|
+
(error, stdout) => {
|
|
23
|
+
if (error) reject(error)
|
|
24
|
+
else resolve(stdout)
|
|
25
|
+
},
|
|
26
|
+
)
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Create a cached token resolver backed by the GitHub CLI.
|
|
32
|
+
* @param {object} [options] - Resolution options.
|
|
33
|
+
* @param {() => Promise<string>} [options.run] - Command runner returning the token text.
|
|
34
|
+
* @param {number} [options.ttlMs] - How long one resolution stays valid.
|
|
35
|
+
* @param {() => number} [options.now] - Clock, injectable for tests.
|
|
36
|
+
* @returns {() => Promise<string | undefined>} Async token reader.
|
|
37
|
+
*/
|
|
38
|
+
export function createGhTokenResolver({ run = defaultRun, ttlMs = 10 * 60 * 1000, now = Date.now } = {}) {
|
|
39
|
+
let cachedAt = Number.NEGATIVE_INFINITY
|
|
40
|
+
/** @type {string | undefined} */
|
|
41
|
+
let value
|
|
42
|
+
let inFlight
|
|
43
|
+
|
|
44
|
+
return async function token() {
|
|
45
|
+
if (inFlight !== undefined) return inFlight
|
|
46
|
+
if (now() - cachedAt < ttlMs) return value
|
|
47
|
+
inFlight = (async () => {
|
|
48
|
+
cachedAt = now()
|
|
49
|
+
try {
|
|
50
|
+
const output = await run()
|
|
51
|
+
const text = typeof output === 'string' ? output.trim() : ''
|
|
52
|
+
value = text === '' ? undefined : text
|
|
53
|
+
} catch {
|
|
54
|
+
value = undefined
|
|
55
|
+
} finally {
|
|
56
|
+
inFlight = undefined
|
|
57
|
+
}
|
|
58
|
+
return value
|
|
59
|
+
})()
|
|
60
|
+
return inFlight
|
|
61
|
+
}
|
|
62
|
+
}
|
package/src/host/sync.js
CHANGED
|
@@ -51,7 +51,7 @@ const STATUS = Object.freeze({
|
|
|
51
51
|
* @param {{ info?: Function, warn?: Function }} [options.logger] - Host logger.
|
|
52
52
|
* @returns {object} Sync service.
|
|
53
53
|
*/
|
|
54
|
-
export function createSyncService({ config, root, hub, logger, onChange, limits }) {
|
|
54
|
+
export function createSyncService({ config, root, hub, logger, onChange, limits, githubToken }) {
|
|
55
55
|
const requester = createRequester({ proxy: config.proxy, timeoutMs: config.requestTimeoutMs })
|
|
56
56
|
const github = createGithub({ config, requester, token: readToken })
|
|
57
57
|
|
|
@@ -73,15 +73,9 @@ export function createSyncService({ config, root, hub, logger, onChange, limits
|
|
|
73
73
|
transport: 'direct',
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
/**
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
* configured in the plugin configuration page.
|
|
80
|
-
* @returns {string | undefined} Token value, or undefined.
|
|
81
|
-
*/
|
|
82
|
-
function readToken() {
|
|
83
|
-
const token = typeof config.githubToken === 'string' ? config.githubToken.trim() : ''
|
|
84
|
-
return token === '' ? undefined : token
|
|
76
|
+
/** Read the GitHub credential through the local gh CLI resolver. */
|
|
77
|
+
async function readToken() {
|
|
78
|
+
return typeof githubToken === 'function' ? githubToken() : undefined
|
|
85
79
|
}
|
|
86
80
|
|
|
87
81
|
/**
|